import { InputHTMLAttributes, forwardRef } from 'react'; interface InputProps extends InputHTMLAttributes { label?: string; error?: string; helperText?: string; leftIcon?: React.ReactNode; rightIcon?: React.ReactNode; } const Input = forwardRef(({ label, error, helperText, leftIcon, rightIcon, className = '', id, ...props }, ref) => { const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`; return (
{label && ( )}
{leftIcon && (
{leftIcon}
)} {rightIcon && (
{rightIcon}
)}
{error && (

{error}

)} {helperText && !error && (

{helperText}

)}
); }); Input.displayName = 'Input'; export default Input;