import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from "react"; interface InputProps extends InputHTMLAttributes { label?: ReactNode; labelIcon?: ReactNode; helperText?: string; error?: string; } export const Input = forwardRef( ({ label, labelIcon, helperText, error, className, id: idProp, ...rest }, ref) => { const generatedId = useId(); const id = idProp ?? generatedId; const helperId = helperText ? `${id}-helper` : undefined; const errorId = error ? `${id}-error` : undefined; return (
{label ? ( ) : null} {error ? (

{error}

) : helperText ? (

{helperText}

) : null}
); }, ); Input.displayName = "Input";