import * as _angular_core from '@angular/core'; import { OnInit, AfterViewInit, OnDestroy, ElementRef, Renderer2, DoCheck } from '@angular/core'; import { BooleanInput, NumberInput } from '@angular/cdk/coercion'; import { NgControl, ControlValueAccessor } from '@angular/forms'; import * as i1 from '@eui/components/shared'; /** * A directive that automatically adjusts the height of a textarea based on its content. * * @directive * @selector textarea[autoResize] * @description * The AutoResizeDirective automatically adjusts the height of a textarea element as the user types, * ensuring that all content is visible without requiring manual resizing or scrolling. * It supports minimum and maximum row constraints and can be enabled/disabled dynamically. * * @example * ```html * * ``` */ declare class AutoResizeDirective implements OnInit, AfterViewInit, OnDestroy { /** * @description * Controls whether the auto-resize functionality is enabled. * When true, the textarea will automatically adjust its height based on content. * When false, the textarea will behave normally. * * @default true */ autoResize: _angular_core.InputSignalWithTransform; /** * @description * Sets the minimum number of rows for the textarea. * This value determines the initial height of the textarea. * * @param minRows - The minimum number of rows to display * @default 1 */ minRows: _angular_core.InputSignalWithTransform; /** * @description * Sets the maximum number of rows for the textarea. * When set to a value greater than 0, the textarea will not grow beyond this number of rows * and will show scrollbars if necessary. * When set to 0, there is no maximum limit. * * @default 0 */ maxRows: _angular_core.InputSignalWithTransform; protected el: ElementRef; protected renderer: Renderer2; protected control: NgControl; private destroy$; private observer; constructor(); /** * Event handler for input events on the textarea. * Triggers the resize calculation when the content changes. * * @internal */ onInput(): void; /** * Initializes the directive by setting up window resize event handling * and mutation observer for readonly attribute changes. * * @internal */ ngOnInit(): void; /** * Performs initial resize after view initialization and sets up form control value change handling if applicable. * * @internal */ ngAfterViewInit(): void; /** * Cleans up subscriptions and disconnects observers when the directive is destroyed. * * @internal */ ngOnDestroy(): void; /** * Calculates and sets the appropriate height for the textarea based on its content. * This method creates a temporary clone of the textarea to measure the required height, * taking into account minRows and maxRows constraints. * * The calculation process: * 1. Creates a hidden clone of the textarea * 2. Sets the clone's width to match the original * 3. Measures the required height based on content * 4. Applies maxRows constraint if specified * 5. Updates the original textarea's height * * @public */ resize(): void; /** * Sets up subscription to form control value changes to trigger resize when the value * is changed programmatically through the form control. * * @protected */ protected handleFormControlChanges(): void; /** * Mutation observer callback that handles changes to the readonly attribute * and triggers resize when necessary. * * @param mutationsList - List of mutations that occurred * @private */ private readonlyMutationObserver; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * @description * Multiline text input field for entering longer text content. * `euiTextArea` provides an enhanced textarea component with full Angular forms integration, validation state handling, readonly display mode, and optional automatic height adjustment. * It is designed to be used as an attribute selector on a `textarea` element. * * @usageNotes * ### Basic Usage * ```html * * * * *
* *
* * * * ``` * * ```typescript * form = new FormGroup({ * description: new FormControl('', [Validators.required, Validators.maxLength(500)]) * }); * ``` * * ### Accessibility * - Associate with label using for/id attributes * - Provide placeholder text as guidance, not as label replacement * - Use aria-describedby for helper text or error messages * - Ensure sufficient color contrast in all states * * ### Notes * - Automatically tracks number of text rows via rowsChange event * - Validation state (invalid/danger) syncs with form control * - Readonly mode displays content in a styled container * - Disabled state prevents all user interaction */ declare class EuiTextareaComponent implements OnInit, OnDestroy, DoCheck, ControlValueAccessor { /** * Static counter used to generate unique IDs for textarea instances * @static */ static idCounter: number; /** * Event emitter that fires when the number of text rows in the textarea changes */ rowsChange: _angular_core.OutputEmitterRef; get class(): string; /** * The disabled state of the textarea * @description When set to true, prevents user interaction with the textarea. * This can be controlled either directly or through form control binding. */ disabled: _angular_core.InputSignalWithTransform; /** * The readonly state of the textarea * @description When true, displays the textarea content in a read-only format * with special styling. */ readonly: _angular_core.InputSignalWithTransform; /** * Unique identifier for the textarea * @default eui-textarea_{increment} */ id: _angular_core.InputSignal; /** * Flag indicating if the textarea is in an invalid state * @description When true, applies error styling to the textarea. * This can be set manually or automatically through form validation. */ isInvalid: _angular_core.InputSignalWithTransform; /** * @description * Data attribute for end-to-end testing * @default eui-textarea */ e2eAttr: _angular_core.InputSignal; protected hostEl: HTMLTextAreaElement; protected hostParentEl: HTMLElement; protected hostWrapperEl: HTMLDivElement; protected valueContainerEl: HTMLDivElement; protected innerDisabled: _angular_core.WritableSignal; private innerIsInvalid; private destroy$; private control; private rows; private injector; private _elementRef; private _renderer; private baseStatesDirective; constructor(); /** * Handles input changes in the textarea * @param {string} value - The new value of the textarea * @description Updates the number of rows and triggers change detection */ onInputChange(value: string): void; /** * Handles blur events on the textarea * @param {string} value - The current value of the textarea * @description Marks the control as touched and triggers validation */ onBlur(value: string): void; /** * @description * Lifecycle hook that initializes the component. Sets up DOM elements, * initializes form control integration, and establishes state management */ ngOnInit(): void; /** * @description * Lifecycle hook that checks for changes in form control state * Updates invalid state based on form control validation */ ngDoCheck(): void; /** * @description * Lifecycle hook that cleans up component resources * Completes observables and removes generated DOM elements */ ngOnDestroy(): void; /** * @description * ControlValueAccessor implementation for writing values * @param {unknown} obj - The value to write to the textarea */ writeValue(obj: unknown): void; /** * @description * Registers the callback function for change events * @param {Function} fn - The callback function */ registerOnChange(fn: () => void): void; /** * @description * Registers the callback function for touched events * @param {Function} fn - The callback function */ registerOnTouched(fn: () => void): void; /** * @description * Sets the disabled state of the textarea * @param {boolean} isDisabled - The disabled state to set */ setDisabledState(isDisabled: boolean): void; protected onChange(_: unknown): void; protected onTouched(_: unknown): void; /** * @description * Creates the container for the textarea element * @returns {HTMLDivElement} The created wrapper container element * @private */ private createHostWrapperContainer; /** * @description * Creates the container for displaying readonly values * @returns {HTMLDivElement} The created value container element * @private */ private createValueContainer; /** * @description * Handles the DOM manipulation for the textarea structure * Wraps the textarea in necessary containers and adds * the readonly value display element * * @private */ private handleMarkup; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare const EUI_TEXTAREA: readonly [typeof EuiTextareaComponent, typeof AutoResizeDirective]; export { AutoResizeDirective, EUI_TEXTAREA, EuiTextareaComponent }; //# sourceMappingURL=eui-components-eui-textarea.d.ts.map