import { InputHTMLAttributes, forwardRef } from 'react'; import { Trash2 } from 'lucide-react'; interface InputProps extends InputHTMLAttributes { label?: string; error?: string; onClear?: () => void; } const Input = forwardRef( ({ className = '', label, error, id, onClear, ...props }, ref) => { const inputId = id || props.name; const isDateType = props.type === 'date'; const hasValue = props.value !== undefined && props.value !== null && props.value !== ''; const showClearButton = isDateType && onClear && hasValue; return (
{label && ( )}
{showClearButton && ( )}
{error &&

{error}

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