/** * TyInput Web Component * PORTED FROM: clj/ty/components/input.cljs * Phase D: Complete with delay/debounce feature for input and change events * * Enhanced input component with: * - Label, error messages, semantic styling * - Icon slots (start/end) * - Numeric formatting with shadow values * - Currency, percent, compact notation * - Format-on-blur / raw-on-focus behavior * - Debounce delay (0-5000ms) for input/change events * - Immediate event firing on blur (cancels pending debounce) * * NOTE: Checkbox functionality is in separate ty-checkbox component */ 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'; /** * Ty Input Component (Phase D - Complete with Delay/Debounce) * * @example * ```html * * * * * * * * * * * * * * * * * * * * ``` */ /** * Internal state interface for TyInput component */ 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; }; error: { type: "string"; visual: boolean; default: string; }; size: { type: "string"; visual: boolean; default: string; validate: (v: any) => boolean; coerce: (v: any) => any; }; flavor: { type: "string"; visual: boolean; default: string; validate: (v: any) => boolean; coerce: (v: any) => any; }; 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; }; delay: { type: "number"; default: number; validate: (v: any) => boolean; coerce: (v: any) => number; }; }; private _shadowValue; private _isFocused; private _listenersSetup; private _inputHandler; private _changeHandler; private _focusHandler; private _blurHandler; private _inputDebounceTimer; private _changeDebounceTimer; private _localeObserver?; constructor(); /** * Called when component connects to DOM * TyComponent already handled pre-connection property capture */ protected onConnect(): void; /** * Called when component disconnects from DOM */ protected onDisconnect(): void; /** * Handle property changes - called BEFORE render * This replaces the old attributeChangedCallback logic */ protected onPropertiesChanged(changes: PropertyChange[]): void; /** * Hook: Called when form is reset * Clear shadow value and focus state */ protected onFormReset(): void; /** * Override form value to return shadow value * This ensures numeric types submit their parsed values */ protected getFormValue(): FormDataEntryValue | null; /** * Initialize shadow value from the initial value attribute */ private initializeShadowValue; /** * Parse a string value to the appropriate shadow value type */ private parseShadowValue; /** * Check if current input should format numbers */ private shouldFormat; /** * Get the format configuration for current input */ private getFormatConfig; /** * Get the display value (formatted or raw) */ 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); get required(): boolean; set required(v: boolean); 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 delay(): number; set delay(v: number | string); get form(): HTMLFormElement | null; /** * Build CSS class list for input wrapper */ private buildClassList; /** * Dispatch input event (helper method for debouncing) */ private dispatchInputEvent; /** * Dispatch change event (helper method for debouncing) */ private dispatchChangeEvent; /** * Remove event listeners for cleanup */ private removeEventListeners; /** * Setup event listeners for input element * IMPORTANT: Only called ONCE, not on every render (like ClojureScript) */ private setupEventListeners; /** * Render the input component with wrapper and slots * Phase C: Uses getDisplayValue() for formatted output * */ render(): void; } export {}; //# sourceMappingURL=input.d.ts.map