import { type PropertyValues, type TemplateResult } from "lit"; import { type ClassInfo } from "lit/directives/class-map.js"; import BaseInput from "../base-input/index.ts"; import { getFormValue, getValidityAnchor, onReportValidity } from "../utils/index.ts"; /** * @slot [leading-icon] - the leading icon slot of the input * @slot [trailing] - the trailing slot of the input */ export declare abstract class BaseTextInput extends BaseInput { /** * The maximum number of characters a user can enter into the text input. Set * to -1 for none. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength * * @prop {number} maxLength * @attr {string} maxlength * @default -1 */ maxLength: number; /** * The minimum number of characters a user can enter into the text input. Set * to -1 for none. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength * * @prop {number} minLength * @attr {string} minlength * @default -1 */ minLength: number; /** * Defines the text displayed in the text input when it has no value. Provides * a brief hint to the user as to the expected type of data that should be * entered into the control. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder * * @prop {string} placeholder * @attr {string} placeholder * @default "" */ placeholder: string; /** * Indicates whether or not a user should be able to edit the text input's * value. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly */ readOnly: boolean; /** * Describes what, if any, type of autocomplete functionality the input * should provide. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete * * @prop {AutoFill} autocomplete * @attr {AutoFill} autocomplete * @default "" */ autocomplete: AutoFill; /** * Conveys additional information below the text input, such as how it should * be used. * * @prop {string} supportingText * @attr {string} supporting-text * @default "" */ supportingText: string; /** * Gets or sets whether or not the text input is in a visually invalid state. * * This error state overrides the error state controlled by * `reportValidity()`. * * @prop {boolean} error * @attr {string} error * @default false */ error: boolean; /** * The error message that replaces supporting text when `error` is true. If * `errorText` is an empty string, then the supporting text will continue to * show. * * This error message overrides the error message displayed by * `reportValidity()`. * * @prop {string} errorText * @attr {string} error-text * @default "" */ errorText: string; /** * The label of the text input. * - If the `hideLabel` property is true, the label will be hidden visually * but still accessible to screen readers. * - Otherwise, a visible label element will be rendered. * * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label * * @prop {string} label * @attr {string} label * @default "" */ label: string; /** * Whether to hide the label or not. * * @prop {boolean} hideLabel * @attr {string} hide-label * @default false */ hideLabel: boolean; /** * Whether the input is rounded or not. * * @prop {boolean} rounded * @attr {string} rounded * @default false */ rounded: boolean; /** * The size of the input. * * @prop {"sm" | "md"} size * @attr {"sm" | "md"} size * @default "md" */ size: "sm" | "md"; /** * Whether to show the active border around the input or not. * * @prop {boolean} noActiveBorder * @attr {string} no-active-border * @default false */ noActiveBorder: boolean; private _dirty; private _nativeError; private _nativeErrorText; protected hasTrailingSlot: boolean; protected hasLeadingIconSlot: boolean; /** * When set to true, the error text's `role="alert"` will be removed, then * re-added after an animation frame. This will re-announce an error message * to screen readers. */ private _refreshErrorAlert; private _leadingIconSlotNodes; private _trailingSlotNodes; /** * Selects all the text in the text field. * * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select * * @internal */ select(): void; /** * Reset the text field to its default value. */ reset(): void; protected hasError(): boolean; protected getErrorText(): string; protected getSupportingOrErrorText(): string; /** * Re-announces the field's error supporting text to screen readers. * * Error text announces to screen readers anytime it is visible and changes. * Use the method to re-announce the message when the text has not changed, * but announcement is still needed (such as for `reportValidity()`). */ private _reannounceError; /** @internal */ attributeChangedCallback(attribute: string, newValue: string | null, oldValue: string | null): void; protected updated(changed: PropertyValues): void; protected willUpdate(changed: PropertyValues): void; private _handleLeadingIconSlotChange; private _handleTrailingSlotChange; protected getInputElement(): HTMLInputElement | HTMLTextAreaElement | null; protected handleInput(event: Event): void; protected handleSelect(event: Event): void; protected handleChange(event: Event): void; /** @internal */ [getFormValue](): string; /** @internal */ formResetCallback(): void; /** @internal */ formStateRestoreCallback(state: string): void; /** @internal */ [getValidityAnchor](): HTMLInputElement | HTMLTextAreaElement | null; /** @internal */ [onReportValidity](invalidEvent: Event | null): void; protected renderTrailingContent(): TemplateResult | null; protected renderLeadingContent(): TemplateResult | null; protected abstract renderInput(): TemplateResult; protected getRootClasses(): ClassInfo; protected renderControl(): TemplateResult; }