import {Input} from '@headlessui/react'; /** * A headless-based Text Input component. * replacement for WordPress TextControl. * * @param {string} value - The current value. * @param {function} onChange - Callback receiving the NEW VALUE (string), not the event. * @param {string} placeholder - Placeholder text. * @param {string} className - Additional classes. * @param {string} type - Input type (text, email, number, etc.), default: 'text'. * @param icon * @param onIconClick * @param {object} props - Any other props passed to the input. */ const TextInput = ( { value, onChange, placeholder, className = '', type = 'text', icon = null, onIconClick, ...props } ) => { const inputElement = ( onChange( e.target.value )} placeholder={placeholder} autoComplete="off" {...props} /> ); if ( !icon ) { return inputElement; } return ( ); }; export default TextInput;