'use client'; import { useDebouncedOnChangeCallback, useFocus } from './hooks'; import { Label } from '@repo/ui/components/ui/label'; import { type ChangeEvent, useState } from 'react'; type FieldProps = { readonly disabled?: boolean; readonly id: string; readonly label: string; readonly onChange?: (value: string) => void; readonly readOnly?: boolean; readonly rows?: number; readonly value: string; }; export function TextareaField({ disabled = false, id, label, onChange, readOnly, rows = 3, value: initialValue, }: FieldProps) { const [value, setValue] = useState(initialValue); const { debouncedCallback, isPending } = useDebouncedOnChangeCallback(onChange); const textareaRef = useFocus(isPending); const handleChange = (event: ChangeEvent) => { const newValue = event.target.value; setValue(newValue); debouncedCallback(newValue); }; return (