import { ChangeEvent, ComponentPropsWithoutRef, ReactElement } from 'react'; import { DataTrackingId, LayoutUtilProps, MaxLengthCounterProps } from '../../types'; import { FieldLabelProps } from '../FieldLabel'; import { HelperProps } from '../../internal/components'; import { TextareaAutosizeConditionalProps, TextareaState } from './types'; /** * Props for the Textarea component */ export type TextareaProps = Omit, "onChange"> & LayoutUtilProps & DataTrackingId & MaxLengthCounterProps & TextareaAutosizeConditionalProps & Pick & { /** * Error state for the field. Pass `true` to indicate error styling without a message. * Pass a string, string[], or ReactElement (deprecated) for error messages. */ error?: boolean | string | ReactElement | string[]; /** * Hint text displayed below the textarea */ hint?: ReactElement | string; /** * Description text displayed below the textarea */ description?: ReactElement | string; /** * Label for the textarea. * Omitting `label` is deprecated — it will be required in v4.0.0. Use `hideLabel` to visually hide it. * Passing `ReactNode` is deprecated — use a plain string with inline markdown instead. */ label?: string | ReactElement; /** * When `true`, hides the visible label and moves it to `aria-label` on the textarea. * Requires `label` to be set — the label is always needed for accessibility. * @default false */ hideLabel?: boolean; /** * Sets textarea's element no user-controllable method for resizing * @default false */ disableResize?: boolean; /** * Fires on each change of textarea's value * @param e The change event * @param state Object containing the current value */ onChange?: (e: ChangeEvent, state?: TextareaState) => void; /** * Props passed to the internal label component. */ labelProps?: FieldLabelProps; } & { /** * @deprecated No longer used. Error messages always use `aria-live="assertive"`. */ errorAriaLive?: HelperProps["errorAriaLive"]; /** * Warning message(s) to display. Supports a single string or an array of strings. */ warning?: string | string[]; }; /** * Textarea component for multi-line text input with advanced features. * * Features: * - Character counter with maxLength validation * - Auto-height adjustment based on content * - Error state handling with custom error messages * - Hint and description text support * - Disable resize functionality * - Accessible with proper ARIA attributes * - Label association and required field support * - Focus and blur event handling * - Supports layout utilities for positioning and spacing * - SSR-safe auto-height implementation * - Automatic tracking ID generation for analytics * * @example *