import { EventEmitter } from '../../stencil-public-runtime'; import { HintExpander } from '../ontario-hint-expander/hint-expander.interface'; import { Hint, Input } from '../../utils/common/common.interface'; import { Caption } from '../../utils/common/input-caption/caption.interface'; import { Language } from '../../utils/common/language-types'; import { InputFocusBlurEvent, InputInteractionEvent, InputInputEvent } from '../../utils/events/event-handler.interface'; import { HeaderLanguageToggleEventDetails } from '../../utils/events/common-events.interface'; /** * Ontario Textarea captures multi-line text input. * * This component intentionally does not expose `readOnly` or `disabled` props. * * To support accessible and understandable form completion: * - keep form fields and submission actions available * - use validation and error messaging to guide corrections * * For component guidance, see: * - https://designsystem.ontario.ca/components/detail/text-areas.html * - https://designsystem.ontario.ca/developer-docs/components/ontario-textarea/ * * Disabled/read-only policy source: * - https://designsystem.ontario.ca/components/detail/buttons.html#disabled-buttons */ export declare class OntarioTextarea implements Input { element: HTMLElement; internals: ElementInternals; hintTextRef: HTMLOntarioHintTextElement | undefined; /** * The text to display as the textarea label. * * @example * * */ caption: Caption | string; /** * The name assigned to the textarea. The name value is used to reference form data after a form is submitted. */ name: string; /** * The unique identifier of the textarea. This is optional - if no ID is passed, one will be generated. */ elementId?: string; /** * This is used to determine whether the textarea is required or not. * This prop also gets passed to the InputCaption utility to display either an optional or required flag in the label. * If no prop is set, it will default to false (optional). */ required?: boolean; /** * The textarea content value. */ value?: string; /** * Used to include the ontario-hint-text component for the textarea. * This is optional. */ hintText?: string | Hint; /** * Used to include the ontario-hint-expander component for the textarea component. * This is passed in as an object with key-value pairs. * * This is optional. * * @example * * */ hintExpander?: HintExpander | string; /** * The language of the component. * This is used for translations, and is by default set through event listeners checking for a language property from the header. If no language is passed, it will default to English. */ language?: Language; /** * Set this to display an error message */ errorMessage?: string; /** * Used to add a custom function to the textarea onInput event. */ customOnInput?: (event: globalThis.Event) => void; /** * Used to add a custom function to the textarea onChange event. */ customOnChange?: (event: globalThis.Event) => void; /** * Used to add a custom function to the textarea onBlur event. */ customOnBlur?: (event: globalThis.Event) => void; /** * Used to add a custom function to the textarea onFocus event. */ customOnFocus?: (event: globalThis.Event) => void; /** * Used for the `aria-describedby` value of the textarea. This will match with the id of the hint text. */ hintTextId: string | null | undefined; /** * The hint text options are re-assigned to the internalHintText array. */ private internalHintText; /** * The hint expander options are re-assigned to the internalHintExpander array. */ private internalHintExpander; /** * Instantiate an InputCaption object for internal logic use */ private captionState; /** * Emitted when a input event occurs when an input has been changed. */ inputOnInput: EventEmitter; /** * Emitted when a keyboard input or mouse event occurs when an input has been changed. */ inputOnChange: EventEmitter; /** * Emitted when a keyboard input event occurs when an input has lost focus. */ inputOnBlur: EventEmitter; /** * Emitted when a keyboard input event occurs when an input has gained focus. */ inputOnFocus: EventEmitter; /** * Emitted when an error message is reported to the component. */ inputErrorOccurred: EventEmitter<{ inputId: string; errorMessage: string; }>; /** * This listens for the `setAppLanguage` event sent from the test language toggler when it is is connected to the DOM. It is used for the initial language when the textarea component loads. */ handleSetAppLanguage(event: CustomEvent): void; /** * Handles an update to the language should the user request a language update from the language toggle. * @param {CustomEvent} - The language that has been selected. */ handleHeaderLanguageToggled(event: CustomEvent): void; /** * Watch for changes to the `hintText` prop. * * If a `hintText` prop is passed, the `constructHintTextObject` function will convert it to the correct format, and set the result to the `internalHintText` state. */ private parseHintText; /** * Watch for changes to the `hintExpander` prop. * * If a `hintExpander` prop is passed, it will be parsed (if it is a string), and the result will be set to the `internalHintExpander` state. */ private parseHintExpander; validateName(newValue: string): void; /** * Watch for changes to the `caption` prop. * * The caption will be run through the InputCaption constructor to convert it to the correct format, and set the result to the `captionState` state. * @param newValue: Caption | string */ private updateCaptionState; /** * Watch for changes to the `language` prop to render either the English or French translations */ updateLanguage(): void; broadcastInputErrorOccurredEvent(): void; /** * Function to handle textarea events and the information pertaining to the textarea to emit. */ private handleEvent; getId(): string; private getValue; private getClass; /** * If a `hintText` prop is passed, the id generated from it will be set to the internal `hintTextId` state to match with the textarea `aria-describedBy` attribute. */ componentDidLoad(): Promise; componentWillLoad(): void; render(): any; }