import type { CSSResultGroup } from 'lit'; import { FormControlLayout } from '../../internal/components/form-control/form-control-layout'; import type { ShoelaceFormControl } from '../../internal/shoelace-element'; /** * @summary Textareas collect data from the user and allow multiple lines of text. * @documentation https://dsa.service-public-autonomie.fr/latest/librairie-webcomponents/champs-de-saisie/textarea/web-KBiPSDd9 * * @dependency dsa-error-text * * @slot label - The textarea's label. Alternatively, you can use the `label` attribute. * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute. * @slot tooltip - The tooltip slot allows additional information to be passed along the label. * * @event dsa-blur - Emitted when the control loses focus. * @event dsa-change - Emitted when an alteration to the control's value is committed by the user. * @event dsa-focus - Emitted when the control gains focus. * @event dsa-input - Emitted when the control receives input. * @event dsa-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ export default class DSATextarea extends FormControlLayout implements ShoelaceFormControl { static styles: CSSResultGroup; private readonly formControlController; private resizeObserver; input: HTMLTextAreaElement; private hasFocus; /** The current value of the textarea, submitted as a name/value pair with form data. */ value: string; /** The default value of the textarea. Primarily used for resetting the form control. */ defaultValue: string; /** The number of rows to display by default. */ rows: number; /** Controls how the textarea can be resized. */ resize: 'none' | 'vertical' | 'auto'; /** The minimum length of input that will be considered valid. */ minlength: number; /** The maximum length of input that will be considered valid. */ maxlength: number; /** Display the counter if maxlength is provided */ counter: boolean; /** Controls whether and how text input is automatically capitalized as it is entered by the user. */ autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'; /** Indicates whether the browser's autocorrect feature is on or off. */ private _autocorrect; get autocorrect(): boolean; set autocorrect(value: boolean); /** * Specifies what permission the browser has to provide assistance in filling out form field values. Refer to * [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values. */ autocomplete: string; /** Indicates that the input should receive focus on page load. */ autofocus: boolean; /** Used to customize the label or icon of the Enter key on virtual keyboards. */ enterkeyhint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'; /** Enables spell checking on the textarea. */ spellcheck: boolean; /** * Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual * keyboard on supportive devices. */ inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'; /** Gets the validity state object */ get validity(): ValidityState; /** Gets the validation message */ get validationMessage(): string; connectedCallback(): void; firstUpdated(): void; disconnectedCallback(): void; private handleBlur; private handleChange; private handleFocus; private handleInput; private handleInvalid; private setTextareaHeight; private getDescriptionIds; handleDisabledChange(): void; handleRowsChange(): void; handleValueChange(): Promise; /** Sets focus on the textarea. */ focus(options?: FocusOptions): void; /** Removes focus from the textarea. */ blur(): void; /** Selects all the text in the textarea. */ select(): void; /** Gets or sets the textarea's scroll position. */ scrollPosition(position?: { top?: number; left?: number; }): { top: number; left: number; } | undefined; /** Sets the start and end positions of the text selection (0-based). */ setSelectionRange(selectionStart: number, selectionEnd: number, selectionDirection?: 'forward' | 'backward' | 'none'): void; /** Replaces a range of text with a new string. */ setRangeText(replacement: string, start?: number, end?: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void; /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */ checkValidity(): boolean; /** Gets the associated form, if one exists. */ getForm(): HTMLFormElement | null; /** Checks for validity and shows the browser's validation message if the control is invalid. */ reportValidity(): boolean; /** Sets a custom validation message. Pass an empty string to restore validity. */ setCustomValidity(message: string): void; renderInput(): import("lit").TemplateResult<1>; renderCounter(): import("lit").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'dsa-textarea': DSATextarea; } }