import type { ChangeEvent, FocusEvent } from 'react'; import { useCallback } from 'react'; import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils'; import { ariaDescribedByIds } from '@rjsf/utils'; /** The `TextareaWidget` is a widget for rendering input fields as textarea. * * @param props - The `WidgetProps` for this component */ function TextareaWidget({ id, options, placeholder, value, required, disabled, readonly, autofocus = false, onChange, onBlur, onFocus, htmlName, }: WidgetProps) { const handleChange = useCallback( ({ target: { value: newValue } }: ChangeEvent) => onChange(newValue === '' ? options.emptyValue : newValue), [onChange, options.emptyValue], ); const handleBlur = useCallback( ({ target }: FocusEvent) => onBlur(id, target?.value), [onBlur, id], ); const handleFocus = useCallback( ({ target }: FocusEvent) => onFocus(id, target?.value), [id, onFocus], ); return (