@payfit/unity-components
Version:
29 lines (28 loc) • 1.46 kB
TypeScript
import { ChangeEventHandler, ReactElement, Ref } from 'react';
import { TextAreaProps as AriaTextAreaProps } from 'react-aria-components/TextArea';
/** Props for a controlled free-text answer field. */
export interface AIStructuredInputFreeTextAnswerProps extends Omit<AriaTextAreaProps, 'children' | 'className' | 'disabled' | 'onChange' | 'readOnly' | 'value'> {
/** The current answer draft, owned by the consumer or form. */
value: string;
/** Updates the consumer-owned answer draft. */
onChange: ChangeEventHandler<HTMLTextAreaElement>;
/** Called when the person confirms this answer. It does not submit the answer batch. */
onSubmit: () => void;
/** Whether the answer field is disabled. */
isDisabled?: boolean;
/** Whether confirming the answer is in progress. */
isLoading?: boolean;
/** Whether the answer needs correction. */
isInvalid?: boolean;
/** Feedback shown below the text area, normally when `isInvalid` is true. */
feedbackMessage?: string;
/** ID for the feedback message when another control also describes it. */
feedbackId?: string;
/** Accessible name for the answer confirmation button. */
submitAriaLabel?: string;
/** Merges custom styles with the field styles. */
className?: string;
}
export declare const AIStructuredInputFreeTextAnswer: (props: AIStructuredInputFreeTextAnswerProps & {
ref?: Ref<HTMLTextAreaElement>;
}) => ReactElement;