import { LitElement, type CSSResultGroup, type PropertyValues, type TemplateResult } from "lit"; import { createValidator, getFormValue, getValidityAnchor, onReportValidity, type Validator } from "../utils/index.ts"; import { CompleteEvent } from "./events.ts"; interface TapsiPinInputEventMap extends HTMLElementEventMap { [CompleteEvent.type]: CompleteEvent; } declare const BaseClass: import("../utils/index.ts").MixinReturn import("../utils/index.ts").WithElementInternals) & typeof LitElement & import("../utils/mixins/with-form-associated.ts").FormAssociatedConstructor, import("../utils/index.ts").FormAssociated>, import("../utils/index.ts").ConstraintValidation>, import("../utils/index.ts").OnReportValidity>; /** * @summary Used to capture a pin code or otp from the user. * * @tag tapsi-pin-input * * @fires {CompleteEvent} complete - Fires when all the pins have values. * @fires {Event} change - * Fires when the user modifies the element's value. * Unlike the `input` event, the change event is not necessarily fired for each * alteration to an element's `value`. (bubbles) * @fires {Event} input - * Fires when the value of an input element has been changed as a direct result * of a user action. (bubbles) */ export declare class PinInput extends BaseClass { /** @internal */ static readonly styles: CSSResultGroup; /** @internal */ addEventListener: (type: K, listener: (this: PinInput, ev: TapsiPinInputEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void; /** @internal */ removeEventListener: (type: K, listener: (this: PinInput, ev: TapsiPinInputEventMap[K]) => void, options?: boolean | EventListenerOptions) => void; /** * Indicates that the user must specify a value for the input before the * owning form can be submitted and will render an error state when * `reportValidity()` is invoked when value is empty. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required * * @prop {boolean} required * @attr {string} required * @default false */ required: boolean; /** * Indicates whether or not a user should be able to edit the input's * value. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly * * @prop {boolean} readOnly * @attr {string} readonly * @default false */ readOnly: boolean; /** * The label of the 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; /** * Identifies the element (or elements) that labels the input. * * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby * * @prop {string} labelledBy * @attr {string} labelledby * @default "" */ labelledBy: string; /** * Whether to hide the label or not. * * @prop {boolean} hideLabel * @attr {string} hide-label * @default false */ hideLabel: boolean; /** * Defines the text displayed in the inputs when they have 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; /** * 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 false */ autocomplete: AutoFill; /** * Indicates that the element should be focused on page load. * * https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus * * @prop {boolean} autofocus * @attr {string} autofocus * @default false */ autofocus: boolean; /** * Conveys additional information below the 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; /** * Determines which values can be entered. * * @prop {"numeric" | "alphanumeric"} type * @attr {"numeric" | "alphanumeric"} type * @default "alphanumeric" */ type: "numeric" | "alphanumeric"; /** * Determines whether input values should be masked or not. * * @prop {boolean} masked * @attr {string} masked * @default false */ masked: boolean; /** * The number of inputs. * * @prop {number} pins * @attr {string} pins * @default 4 */ pins: number; /** * The number of each input's length. * * @prop {number} pinLength * @attr {string} pin-length * @default 1 */ pinLength: number; /** * The current value of the input. It is always a string. * * @prop {string} value * @attr {string} value * @default "" */ get value(): string; set value(newValue: string); private _dirty; private _nativeError; private _nativeErrorText; /** * 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 _displayValue; private _values; private _value; constructor(); /** @internal */ connectedCallback(): void; /** @internal */ disconnectedCallback(): void; /** @internal */ attributeChangedCallback(attribute: string, newValue: string | null, oldValue: string | null): void; protected firstUpdated(changed: PropertyValues): void; protected updated(changed: PropertyValues): void; /** @internal */ focus(options?: FocusOptions): void; /** @internal */ blur(): void; /** * 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; private get _pins(); private _getPreviousPin; private _getNextPin; private _hasError; private _getErrorText; private _getSupportingOrErrorText; private _createPinArray; /** * Reset the input to its default value. */ reset(): void; /** * The value as an array. * * @prop {string[]} valueAsArray */ get valueAsArray(): string[]; private _setValues; /** * Retrieves or sets the function used to display values on inputs. * * @prop {Function} displayValue */ get displayValue(): (value: string) => string; set displayValue(fn: (value: string) => string); private _setFocusOnArray; private _focusPin; private _isValidValue; private _handleActivationClick; private _handleHostKeyDown; private _handleChange; private _handleInput; /** @internal */ [getFormValue](): string; /** @internal */ formResetCallback(): void; /** @internal */ formStateRestoreCallback(state: string): void; /** @internal */ formDisabledCallback(disabled: boolean): void; /** @internal */ [getValidityAnchor](): HTMLElement | null; /** @internal */ [onReportValidity](invalidEvent: Event | null): void; /** @internal */ [createValidator](): Validator; private _renderPins; private _renderLabel; private _renderHelperText; protected render(): TemplateResult; } export {};