import React, { useId } from 'react'; import { X } from 'lucide-react'; interface FilledInputProps { label: string; value: string | number; onChange: (e: React.ChangeEvent) => void; onClear?: () => void; onFocus?: (e: React.FocusEvent) => void; onBlur?: (e: React.FocusEvent) => void; type?: string; icon?: React.ReactNode; autoFocus?: boolean; step?: string; inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal"; autocapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters"; autoComplete?: string; rightElement?: React.ReactNode; } const FilledInput: React.FC = ({ label, value, onChange, onClear, onFocus, onBlur, type = "number", icon, autoFocus, step, inputMode, autocapitalize, autoComplete, rightElement }) => { const id = useId(); const handleClear = () => { const syntheticEvent = { target: { value: '' } } as React.ChangeEvent; onChange(syntheticEvent); if (onClear) onClear(); }; return (
{value !== '' && value !== 0 && ( )} {rightElement && (
{rightElement}
)}
); }; export default FilledInput;