import { ChangeEvent, FocusEvent, useCallback } from 'react'; import { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } 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, }: WidgetProps) { const handleChange = useCallback( ({ target: { value } }: ChangeEvent) => onChange(value === '' ? options.emptyValue : value), [onChange, options.emptyValue] ); const handleBlur = useCallback( ({ target }: FocusEvent) => onBlur(id, target && target.value), [onBlur, id] ); const handleFocus = useCallback( ({ target }: FocusEvent) => onFocus(id, target && target.value), [id, onFocus] ); return (