import { ScanditHTMLElement } from "@scandit/web-datacapture-core/build/js/private/utils/index.js";
import { Color } from "@scandit/web-datacapture-core/build/js/commons/Color.js";
//#region src/main/ui/atoms/TextInput.d.ts
type TextInputType = "text" | "number";
declare const TextInputEvents: {
readonly Input: "scandit-text-input-input";
readonly Focus: "scandit-text-input-focus";
readonly Blur: "scandit-text-input-blur";
readonly Clear: "scandit-text-input-clear";
readonly Scan: "scandit-text-input-scan";
readonly Keydown: "scandit-text-input-keydown";
};
interface TextInputEventMap {
[TextInputEvents.Scan]: TextInputScanEvent;
[TextInputEvents.Clear]: TextInputClearEvent;
[TextInputEvents.Focus]: TextInputFocusEvent;
[TextInputEvents.Blur]: TextInputBlurEvent;
[TextInputEvents.Input]: TextInputInputEvent;
[TextInputEvents.Keydown]: TextInputKeydownEvent;
}
interface TextInputEventDetail {
target: TextInput;
innerInput: HTMLInputElement;
value: string;
}
interface TextInputKeydownEventDetail {
target: TextInput;
key: string;
originalEvent: KeyboardEvent;
}
declare class TextInputScanEvent extends CustomEvent {
constructor(detail: TextInputEventDetail);
}
declare class TextInputClearEvent extends CustomEvent {
constructor(detail: TextInputEventDetail);
}
declare class TextInputFocusEvent extends CustomEvent {
constructor(detail: TextInputEventDetail);
}
declare class TextInputBlurEvent extends CustomEvent {
constructor(detail: TextInputEventDetail);
}
declare class TextInputInputEvent extends CustomEvent {
constructor(detail: TextInputEventDetail);
}
declare class TextInputKeydownEvent extends CustomEvent {
constructor(detail: TextInputKeydownEventDetail);
}
declare class TextInput extends ScanditHTMLElement {
static tag: "scandit-text-input";
static formAssociated: boolean;
private _internals;
private _inputElement;
private _labelElement;
private _mainWrapper;
private _inputContainer;
private _iconContainerElement;
private _hintMessageElement;
private _type;
private _value;
private _label;
private _placeholder;
private _required;
private _isInitialized;
private _handleInput;
private _handleFocus;
private _handleBlur;
private _handleKeydown;
private _handleCrossIconPointerDown;
private _handleCrossIconPointerUp;
private _handleCrossIconKeyDown;
private _handleScanIconPointerDown;
private _handleScanIconPointerUp;
private _handleScanIconKeyDown;
private _crossIcon;
private _scanIcon;
private _hintMessage;
private _loadingText;
private _clearTabIndexTimeout;
private static createStyleElement;
constructor();
get hintMessage(): string;
set hintMessage(val: string);
get loading(): boolean;
set loading(val: boolean);
get loadingText(): string;
set loadingText(val: string);
get value(): string;
set value(val: string);
get name(): string;
set name(val: string);
get type(): TextInputType;
set type(val: TextInputType);
get label(): string;
set label(val: string);
get placeholder(): string;
set placeholder(val: string);
get required(): boolean;
set required(val: boolean);
get invalid(): boolean;
set invalid(val: boolean);
set readOnly(val: boolean);
get readOnly(): boolean;
set disabled(val: boolean);
get disabled(): boolean;
/**
* Hide or show the scan icon.
* When hidden, the icon will fade out and become non-interactive.
*/
set hideScanIcon(val: boolean);
get hideScanIcon(): boolean;
/**
* Override the background color of the input container.
* the TextInput component in the design system does not have
* the state will be used in the Validation flow v2
*/
set backgroundColor(val: Color | string);
/**
* Check the native HTML5 validity state without updating component state.
* Use setValidationState() to update the visual state.
*
* @returns true if the input is valid, false otherwise
*/
checkValidity(): boolean;
/**
* Report validity through the form internals API.
* Shows the browser's validation UI and returns the validity state.
*
* @returns true if the input is valid, false otherwise
*/
reportValidity(): boolean;
/**
* Set the validation state and optionally display an error message.
* Consumers should call this after validating the input value.
*
* @param isValid - true if valid, false if invalid
* @param hintMessage - optional error message to display when invalid
*/
setValidationState(isValid: boolean, hintMessage?: string): void;
/**
* Reset the validation state to initial (not validation-triggered).
* Clears invalid state, error message, and validation-triggered class.
*/
resetValidation(): void;
/**
* Set custom validity message and sync with form internals.
* This allows custom validation messages to be set.
* @param message - The validation message (empty string = valid)
*/
setCustomValidity(message: string): void;
/**
* Unified internal method to set validity state across all systems.
* Handles visual state (invalid attribute), ARIA attributes, form internals, and messages.
*
* @param flags - ValidityStateFlags for form internals (pass empty object for valid)
* @param message - Error message to display (empty = clear message)
*/
private _setValidityState;
private _onInput;
private _onFocus;
private _onBlur;
private _onKeydown;
focus(options?: FocusOptions): void;
select(): void;
blur(): void;
scrollIntoView(options?: ScrollIntoViewOptions): void;
private _initializeIcons;
private _updateCrossIconTabIndex;
private _updateInputDisplay;
connectedCallback(): void;
private _initializeAttributesFromElement;
disconnectedCallback(): void;
/**
* Called when the element is associated or disassociated with a form.
* @param _form - The form element or null if disassociated
*/
formAssociatedCallback(_form: HTMLFormElement | null): void;
/**
* Called when the disabled state of the form changes.
* @param disabled - Whether the form is now disabled
*/
formDisabledCallback(disabled: boolean): void;
/**
* Called when the form is reset.
* Resets the input to its initial value and clears validation state.
*/
formResetCallback(): void;
private _addEventListeners;
private _removeEventListeners;
private _onCrossIconPointerDown;
private _onCrossIconPointerUp;
private _onCrossIconKeyDown;
private _onScanIconPointerDown;
private _onScanIconPointerUp;
private _triggerClear;
private _onScanIconKeyDown;
private _triggerScan;
static create(): TextInput;
static register(): void;
}
declare global {
interface HTMLElementTagNameMap {
[TextInput.tag]: TextInput;
}
interface HTMLElementEventMap {
[TextInputEvents.Input]: CustomEvent;
[TextInputEvents.Focus]: CustomEvent;
[TextInputEvents.Blur]: CustomEvent;
[TextInputEvents.Clear]: CustomEvent;
[TextInputEvents.Scan]: CustomEvent;
}
}
//#endregion
export { TextInput, TextInputBlurEvent, TextInputClearEvent, TextInputEventDetail, TextInputEventMap, TextInputEvents, TextInputFocusEvent, TextInputInputEvent, TextInputKeydownEvent, TextInputKeydownEventDetail, TextInputScanEvent, TextInputType };