import { useEffect, useState } from 'react' interface InputTextProps { labelTitle?: string labelStyle?: string type?: string dataField?: string containerStyle?: string inputStyle?: string defaultValue?: string placeholder?: string autocomplete?: string pattern?: string required?: boolean updateFormValue?: (value: string) => void } /** * @category Input */ export function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required = true, updateFormValue, }: InputTextProps) { const [inputValue, setInputValue] = useState(defaultValue ?? '') useEffect(() => { setInputValue(defaultValue ?? '') }, [defaultValue]) const handleChange = (e: React.ChangeEvent) => { const newValue = e.target.value setInputValue(newValue) if (updateFormValue) { updateFormValue(newValue) } } return (
{labelTitle ? ( ) : null}
) }