import { FormControlBase } from "../helper/internals/form-control-base"; export type SkyInputValue = string | number | File[] | null; export type SkyInputType = string; export type SkyInputErrorDisplayMode = "none" | "single" | "all"; export type SkyInputIconPosition = "left" | "right"; export type SkyInputValidation = (value: string | File[]) => true | string; export type SkyInputValueChangedDetail = { value: string | number; }; export type SkyInputValueClearedDetail = { value: string | number; }; export type SkyInputFileSelectedDetail = { files: File[]; fileName: string; totalSize: number; fileCount: number; }; export type SkyInputValidationErrorDetail = { errors: string[]; }; export type SkyInputIconClickDetail = { position: SkyInputIconPosition; eventType: string | null; eventData: Event | null; }; /** * @element sky-input * * @summary Versatile form input supporting text, password, number, textarea, and file workflows. * * @status stable * @since 1.0.0 * * @documentation https://sky-ui.com/components/input * @dependency sky-icon * * @uiVModel value value-changed * * @slot icon-left - Optional icon/content placed in the left slot. * @slot icon-right - Optional icon/content placed in the right slot. * @property {SkyInputValue} value - Current input value. * @property {string} placeholder - Placeholder text. * @property {string} label - Label text. Above the field by default; on the border for `fieldset`; inside the field for `inside`. * @property {string} variant - Visual style: `default`, `highlight`, `fieldset`, or `inside`. * @property {SkyInputType} type - Input type (`text`, `password`, `number`, `textarea`, `file`, etc.). * @property {string} suffix - Optional suffix label fragment. * @property {string} prefix - Optional prefix label fragment. * @property {string} prefixColor - Prefix color override. * @property {string} suffixColor - Suffix color override. * @property {string} color - Accent color token/value. * @property {SkyInputValidation[]} validations - Validation functions. * @property {boolean} compact - Compact display mode. * @property {string} preset - Named prop preset from nearest `sky-config-provider`. Default: `""`. * @property {boolean} loading - Loading state. * @property {boolean} showErrors - Enables error rendering. * @property {boolean} clearable - Enables clear button. * @property {SkyInputErrorDisplayMode} errorDisplayMode - Error rendering mode. * @property {boolean} showNumberButtons - Enables number increment/decrement controls. * @property {boolean} showPasswordToggle - Enables password visibility toggle. * @property {string} passwordVisibleIcon - Icon used when password is visible. * @property {string} passwordHiddenIcon - Icon used when password is hidden. * * @fires {CustomEvent} value-changed - Fired when value changes. * @fires {CustomEvent} value-cleared - Fired after clear action. * @fires {CustomEvent} file-selected - Fired after file selection changes. * @fires {CustomEvent} validation-error - Fired after validations run. * @fires {CustomEvent} left-icon-click - Fired when left icon slot is clicked. * @fires {CustomEvent} right-icon-click - Fired when right icon slot is clicked. * * @method validateInput Runs configured validations and updates invalid state. * @method handleClear Clears value and emits corresponding events. * @method formatFileSize Formats byte size for UI display. * @method focusInput Focuses the underlying native input or textarea. * * @csspart input-container - The outer container wrapping label and input wrapper. * @csspart label - The label element above the input. * @csspart input-wrapper - The wrapper around input/textarea and icons. * @csspart icon-slot - Base class for left/right icon slots. * @csspart icon-slot-left - Left icon slot. * @csspart icon-slot-right - Right icon slot. * @csspart clear-button - The clear/reset button. * @csspart toggle-password - The toggle icon for password visibility. * @csspart loading-indicator - The spinner shown when loading. * @csspart error-list - UL element containing validation errors. * @csspart error - Individual error message. * @csspart file-info - File count and size info below the file input. * @csspart input-prefix - Inline prefix fragment inside the field. * @csspart input-suffix - Inline suffix fragment inside the field. * * @Behavior * - Extends `FormControlBase` for automatic form association and validation integration * - Supports all standard HTML input types with enhanced styling and functionality * - File inputs with multi-file support, preview, and size tracking * - Automatic validation integration with parent forms via `sky-form` * * - **none**: No error messages displayed * - **single**: Show only the first error message * - **all**: Show all validation error messages * * @example * ```html * * * * ``` * ```vue * * ``` * ```jsx * export default function Demo() { * return ( * * * * ); * } * ``` */ export declare class SkyInput extends FormControlBase { static dependencies: Record; value: SkyInputValue; placeholder: string; label: string; type: SkyInputType; suffix: string; prefix: string; prefixColor: string; suffixColor: string; color: string; private _validations; get validations(): SkyInputValidation[]; set validations(value: SkyInputValidation[] | null | undefined); compact: boolean; loading: boolean; showErrors: boolean; clearable: boolean; errorDisplayMode: SkyInputErrorDisplayMode; required: boolean; step: string | null; min: string | null; max: string | null; autocapitalize: string; autocomplete: string; spellcheck: boolean; dir: string; rows: number; resizable: string; accept: string; multiple: boolean; inputmode: string | null; enterkeyhint: string | null; pattern: string | null; minlength: number | null; maxlength: number | null; list: string | null; size: number | null; cols: number | null; autofocus: boolean; capture: boolean; inputRole: string | null; ariaLabel: string | null; ariaLabelledby: string | null; ariaDescribedby: string | null; showNumberButtons: boolean; showPasswordToggle: boolean; passwordVisibleIcon: string; passwordHiddenIcon: string; validationActive: boolean; invalid: boolean; variant: "default" | "highlight" | "fieldset" | "inside"; /** Named prop preset from nearest `sky-config-provider`. */ preset: string; private _presets; private selectedFileName; private selectedFiles; private focused; private validationStatus; private validationErrors; private typingStarted; private autofillIconSlot; private autofillGuardActive; private showPassword; private totalFileSize; private selectedFileCount; private filePreview; private inputWrapperEl; private nativeInputEl; private _leftIconSlot; private _rightIconSlot; private _iconClickWired; private _onLeftIconSlotChange; private _onRightIconSlotChange; static styles: import("lit").CSSResult; static shadowRootOptions: { clonable?: boolean; customElementRegistry?: CustomElementRegistry | null; mode: ShadowRootMode; serializable?: boolean; slotAssignment?: SlotAssignmentMode; delegatesFocus: boolean; }; connectedCallback(): void; disconnectedCallback(): void; private _setupIconSlots; private _wireIconSlot; firstUpdated(_changedProperties: Map): void; willUpdate(changedProperties: Map): void; updated(changedProperties: Map): void; /** @protected */ protected getFormValue(): string | File | FormData | null; /** @protected */ protected setValueFromFormState(state: string | File | FormData | null): void; /** @protected */ protected getValidityAnchor(): HTMLElement | undefined; /** @protected */ protected isEmpty(): boolean; /** @protected */ protected getCustomErrorMessage(): string; /** @protected */ protected getNativeControl(): HTMLElement | null; /** @protected */ protected onNativeValueMutated(native: any): void; /** * Resets the input field to its initial state. * @public */ reset(): void; /** @private */ private get nativeRequiredMessage(); /** @private */ private getEmittedValue; /** * Clears the input value and resets typing state. * @public */ handleClear(): void; /** * Handles the `change` event triggered by the file input element. * @param {Event} event - The event object generated by the file input element when files are selected. * @public */ handleFileChange(event: Event): void; /** * Handles the keydown event for the input component. * @param event - The keyboard event triggered by the user. * @private */ private handleKeydown; /** * Gets the current file preview. * @returns The preview of the file, as stored in `filePreview`. * @public */ get preview(): string | ArrayBuffer | null; /** * Handles the input event for the input field. * @param {Event} event - The input event triggered by user interaction. * @public */ handleInput(event: Event): void; /** * Handles the focus event for the input field. * @public */ handleFocus(event: Event): void; /** Chrome may autofill saved usernames into filter fields; readonly until interaction blocks that. */ private releaseAutofillGuard; private handleAutofillGuardPointerDown; /** @protected */ protected onFormReset(): void; /** * Handles the blur event for the input field. * @public */ handleBlur(event: Event): void; /** @protected */ protected validateForForm(): string; /** * Validates the input value against the configured validation rules. * @returns {boolean} True if validation passes, false otherwise. * @public */ validateInput(): boolean; /** * Retrieves validation error messages based on the configured error display mode. * @returns {Array} - An array of error messages to display. * @private */ private getErrorMessages; /** * Handles click events for the left or right icon slots. * @param {String} position - The position of the icon ("left" or "right"). * @param {Event|null} event - The original event triggered by the click (optional). * @public */ handleIconClick(position: "left" | "right", event?: Event | null): void; /** * Formats a file size in bytes into a human-readable string. * @param {number} bytes - The file size in bytes. * @returns {string} - The formatted file size string. * @public */ formatFileSize(bytes: number): string; /** * Increments the input value by the specified step, respecting min/max constraints. * @private */ private incrementValue; /** * Decrements the input value by the specified step, respecting min/max constraints. * @private */ private decrementValue; /** * Renders validation error messages if applicable. * @returns {TemplateResult|null} - The rendered error messages or null. * @private */ private renderValidationErrors; /** * Toggles the visibility of the password input. * @public */ togglePasswordVisibility(): void; focusInput(): void; /** * Handles click events on the input wrapper. * @param {Event} event - The original click event. * @private */ private handleWrapperClick; /** @private */ private get isInvalid(); /** @private */ private get describedById(); /** * Refocuses the input element. * @private */ private refocusInput; /** * Keeps the input focused when interacting with related controls. * @param {Event} e - The original event. * @private */ private keepInputFocused; /** * Triggers the native dropdown for date/time/file inputs. * @private */ private triggerNativeDropdown; /** * Filter/search inputs (`type="search"`) are rendered as plain text fields so * Chrome does not treat them as login username targets. Credential autofill is * further blocked with readonly-until-focus (Chrome ignores autocomplete tokens). */ private isFilterSearchInput; private nativeAutocomplete; private nativeTextInputType; private nativeInputMode; private nativeEnterKeyHint; private nativeInputRole; private affixColorStyle; private renderInputAffix; render(): import("lit-html").TemplateResult<1>; }