import * as React from 'react'; import { Input } from '../../atoms/input'; import { Label } from '../../atoms/label'; import { cn } from '@imphnen-frontend-service/utils'; export type TInputType = | 'text' | 'email' | 'number' | 'password' | 'file' | 'date' | 'time'; export type TInputSize = 'sm' | 'md' | 'lg'; export type TInputFieldProps = Omit< React.InputHTMLAttributes, 'size' | 'type' > & { label: string; type?: TInputType; size?: TInputSize; error?: string; helperText?: string; htmlFor?: string; isRequired?: boolean; }; export const InputField = React.forwardRef( ( { label, placeholder, type = 'text', size = 'md', error, helperText, htmlFor, className, disabled, isRequired = false, id, ...rest }, ref ) => { const autoId = React.useId(); const fieldId = htmlFor ?? id ?? autoId; return (
{error ? (

{error}

) : helperText ? (

{helperText}

) : null}
); } ); InputField.displayName = 'InputField';