import type { ChangeEvent, FocusEvent } from 'react'; import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils'; import { ariaDescribedByIds } from '@rjsf/utils'; import FormControl from 'react-bootstrap/FormControl'; import InputGroup from 'react-bootstrap/InputGroup'; type CustomWidgetProps = WidgetProps< T, S, F > & { options: any; }; export default function TextareaWidget< T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any, >({ id, htmlName, placeholder, value, required, disabled, autofocus, readonly, onBlur, onFocus, onChange, options, }: CustomWidgetProps) { const handleChange = ({ target: { value: newValue } }: ChangeEvent) => onChange(newValue === '' ? options.emptyValue : newValue); const handleBlur = ({ target }: FocusEvent) => onBlur(id, target?.value); const handleFocus = ({ target }: FocusEvent) => onFocus(id, target?.value); return ( ); }