/** * TyInput Web Component - text input with label, error, icon slots and * locale-aware numeric formatting (format-on-blur / raw-on-focus via a parsed * "shadow value"). Debounce 0-5000ms; blur flushes any pending debounced event. */ import type { Flavor, Size, InputType, TyInputElement } from '../types/common.js'; import { TyComponent } from '../base/ty-component.js'; import type { PropertyChange } from '../utils/property-manager.js'; interface InputState { shadowValue: number | string | null; isFocused: boolean; listenersSetup: boolean; inputHandler: ((e: Event) => void) | null; changeHandler: ((e: Event) => void) | null; focusHandler: ((e: Event) => void) | null; blurHandler: ((e: Event) => void) | null; inputDebounceTimer: number | null; changeDebounceTimer: number | null; localeObserver?: () => void; } export declare class TyInput extends TyComponent implements TyInputElement { static formAssociated: boolean; protected static properties: { type: { type: "string"; visual: boolean; default: string; validate: (v: any) => boolean; coerce: (v: any) => any; }; value: { type: "string"; visual: boolean; formValue: boolean; emitChange: boolean; default: string; }; name: { type: "string"; default: string; }; placeholder: { type: "string"; visual: boolean; default: string; }; label: { type: "string"; visual: boolean; default: string; }; disabled: { type: "boolean"; visual: boolean; default: boolean; }; required: { type: "boolean"; visual: boolean; default: boolean; }; pattern: { type: "string"; visual: boolean; default: string; }; minlength: { type: "string"; visual: boolean; default: string; }; maxlength: { type: "string"; visual: boolean; default: string; }; min: { type: "string"; visual: boolean; default: string; }; max: { type: "string"; visual: boolean; default: string; }; tooShortMessage: { type: "string"; visual: boolean; default: string; }; tooLongMessage: { type: "string"; visual: boolean; default: string; }; error: { type: "string"; visual: boolean; default: string; }; size: { type: "string"; visual: boolean; default: Size; validate: (v: any) => boolean; coerce: (v: any) => any; }; flavor: { type: "string"; visual: boolean; default: string; }; currency: { type: "string"; visual: boolean; default: string; }; locale: { type: "string"; visual: boolean; default: string; }; precision: { type: "number"; visual: boolean; default: undefined; validate: (v: any) => boolean; coerce: (v: any) => number | undefined; }; debounce: { type: "number"; default: number; validate: (v: any) => boolean; coerce: (v: any) => number; }; }; private _shadowValue; private _isFocused; private _listenersSetup; private _customFlavorSheet; private _inputHandler; private _changeHandler; private _focusHandler; private _blurHandler; private _inputDebounceTimer; private _changeDebounceTimer; private _localeObserver?; constructor(); /** TyComponent already handled pre-connection property capture. */ protected onConnect(): void; /** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */ private _syncCustomFlavor; protected onDisconnect(): void; /** Handle property changes — called BEFORE render. */ protected onPropertiesChanged(changes: PropertyChange[]): void; protected onFormReset(): void; /** * Override form value to return shadow value * This ensures numeric types submit their parsed values */ protected getFormValue(): FormDataEntryValue | null; private initializeShadowValue; private parseShadowValue; private shouldFormat; private getFormatConfig; private getDisplayValue; get type(): InputType; set type(v: InputType); get value(): string; set value(v: string); get name(): string; set name(v: string); get placeholder(): string; set placeholder(v: string); get label(): string; set label(v: string); get disabled(): boolean; set disabled(v: boolean); /** Focus the inner : the host itself isn't focusable. */ focus(options?: FocusOptions): void; get required(): boolean; set required(v: boolean); get pattern(): string; set pattern(v: string); get minLength(): number; set minLength(v: number); get maxLength(): number; set maxLength(v: number); get min(): string; set min(v: string); get max(): string; set max(v: string); get tooShortMessage(): string; set tooShortMessage(v: string); get tooLongMessage(): string; set tooLongMessage(v: string); get error(): string; set error(v: string); get size(): Size; set size(v: Size); get flavor(): Flavor; set flavor(v: Flavor); get currency(): string; set currency(v: string); get locale(): string; set locale(v: string); get precision(): number | undefined; set precision(v: number | string | undefined); get debounce(): number; set debounce(v: number | string); get form(): HTMLFormElement | null; private buildClassList; private dispatchInputEvent; private dispatchChangeEvent; private removeEventListeners; /** IMPORTANT: Only called ONCE, not on every render. */ /** * Enter submits the owning form, like a native input (HTML implicit * submission): through the form's default button when it has one (nothing * if that button is disabled), otherwise only when this is the form's only * text field. */ private _implicitSubmit; private setupEventListeners; /** Render the input component with wrapper and slots. */ render(): void; /** * Wire the password reveal toggle (rendered only for type="password"). * Toggles the NATIVE input's type between password/text — the component's * `type` property stays "password" (form value and API unaffected). */ private setupPasswordToggle; /** * pattern, minlength and maxlength go on the inner : pattern for the * browser's own patternMismatch check, minlength for its tooShort message * after the user types, maxlength so typing stops at the limit like a * native field. Formatted (numeric) types show a display string, so they * get none. */ private syncConstraintAttributes; /** * Reflect constraint validation to the owning
via ElementInternals. * Without this the inner shadow can't block the outer form. * Rules, first failing one supplies the message: * - required: empty => valueMissing * - email/url: the inner input's own typeMismatch * - text types: pattern, minlength, maxlength * - number/currency/percent/compact: min, max against the numeric value * Empty values only fail `required`, like native inputs. * Disabled fields are barred from constraint validation. */ private updateValidity; } export {};