({
children,
className,
label,
info,
error,
}: WithLabel)
| 15 | type InputWithLabelProps = InputProps & Omit<WithLabel, 'children'>; |
| 16 | |
| 17 | export const WithLabel = ({ |
| 18 | children, |
| 19 | className, |
| 20 | label, |
| 21 | info, |
| 22 | error, |
| 23 | }: WithLabel) => { |
| 24 | return ( |
| 25 | <div className={className}> |
| 26 | <div className="mb-2 flex items-end justify-between"> |
| 27 | <Label |
| 28 | className="mb-0 flex flex-1 shrink-0 items-center gap-1 whitespace-nowrap" |
| 29 | htmlFor={label} |
| 30 | > |
| 31 | {label} |
| 32 | {info && ( |
| 33 | <Tooltiper content={info}> |
| 34 | <InfoIcon size={14} /> |
| 35 | </Tooltiper> |
| 36 | )} |
| 37 | </Label> |
| 38 | {error && ( |
| 39 | <Tooltiper |
| 40 | align="end" |
| 41 | asChild |
| 42 | content={error} |
| 43 | tooltipClassName="max-w-80 leading-normal" |
| 44 | > |
| 45 | <div className="flex items-center gap-1 text-destructive leading-none"> |
| 46 | Issues |
| 47 | <BanIcon size={14} /> |
| 48 | </div> |
| 49 | </Tooltiper> |
| 50 | )} |
| 51 | </div> |
| 52 | {children} |
| 53 | </div> |
| 54 | ); |
| 55 | }; |
| 56 | |
| 57 | export const InputWithLabel = forwardRef<HTMLInputElement, InputWithLabelProps>( |
| 58 | (props, ref) => { |
nothing calls this directly
no outgoing calls
no test coverage detected