import { Color, DataCaptureView } from '@scandit/web-datacapture-core'; import { LabelCaptureValidationFlowLayoutEvents, LabelCaptureValidationFlowLayoutEventMap } from '../../../ui/organisms/LabelCaptureValidationFlowLayout.js'; import { TextInput, TextInputType, TextInputEvents } from '../../../ui/atoms/TextInput.js'; import { InputState } from './ValidationFlowStateManager.js'; import { KeyboardVisibilityChangedEvent } from '../../../ui/controllers/KeyboardVisibilityController.js'; import '@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js'; import '@scandit/web-datacapture-core/build/js/private/utils/index.js'; import '../../../ui/atoms/Button.js'; import '@scandit/web-datacapture-core/build/js/private/GestureRecognizer/GestureRecognizer.js'; import '@scandit/web-datacapture-core/build/js/commons/Color.js'; import '../../../sdcLabelInternalModuleCapture-yM8m0vEc.js'; import '../../../djinni-types/sdcBarcodeData.js'; import '../../../djinni-types/sdcSymbologySettings.js'; import '@scandit/web-datacapture-core/build/js/worker/dataCaptureWorkerRelated'; import '../../../djinni-types/sdcCoreInternalSdkArea.js'; import '../../../djinni-types/sdcCoreInternalSdkCommonGeometry.js'; import '../../../djinni-types/sdcCoreCommonGraphic.js'; import '../../../djinni-types/sdcCoreCommonGeometry.js'; import '../../../djinni-types/sdcCoreInternalSdkCommonAsync.js'; import '../../../djinni-types/sdcCoreInternalSdkOcr.js'; import '../../../djinni-types/sdcCoreCommon.js'; import '../../../djinni-types/sdcLabelData.js'; import '../../../djinni-types/sdcLabelInternalModuleData.js'; import '../../../djinni-types/sdcBarcodeInternalSdkData.js'; import '../../../djinni-types/sdcCoreCommonBuffer.js'; import '../../ValidationFlowField.js'; import '../../LabelField.js'; import '@scandit/web-datacapture-barcode'; import '../../LabelFieldState.js'; import '../../LabelFieldType.js'; import '../../LabelFieldValueType.js'; import '../../LabelDateResult.js'; /** * Configuration for creating an input field */ interface InputFieldConfig { name: string; type: TextInputType; label: string; value: string; required: boolean; loadingText: string; } /** * View layer interface - handles only UI/DOM operations * Does not contain business logic or state management */ interface IValidationFlowView { /** * Get all input elements */ getInputs(): TextInput[]; /** * Get input by field name */ getInputByName(fieldName: string): TextInput | null; /** * Check if an input with the given field name exists */ hasInput(fieldName: string): boolean; /** * Check if an input with the given field name is currently focused */ isInputFocused(fieldName: string): boolean; /** * Show scanning mode buttons (pause button) */ showScanningButtons(): void; /** * Show validation mode buttons (clear all, submit) */ showValidationButtons(): void; /** * Hide all buttons */ hideAllButtons(): void; /** * Enable or disable the submit button */ setSubmitButtonDisabled(disabled: boolean): void; /** * Update input visual state */ updateInputVisualState(fieldName: string, config: { value?: string; loading?: boolean; loadingText?: string; invalid?: boolean; hintMessage?: string; backgroundColor?: Color | string; }): void; /** * Reset input validation state (remove error/success indicators) */ resetInputValidation(fieldName: string): void; /** * Update scan icon visibility for an input */ updateScanIconVisibility(fieldName: string, visible: boolean): void; /** * Update scan icon visibility for all inputs */ updateAllScanIconVisibility(visible: boolean): void; /** * Update input visual state based on InputState enum * This is a high-level method that encapsulates all visual updates for a given state */ updateInputForState(fieldName: string, state: InputState, value: string, config: { scanningText?: string; adaptiveScanningText?: string; hintMessage?: string; backgroundColor?: Color | string; scanIconVisible?: boolean; }): void; /** * Show adaptive recognition overlay */ showAdaptiveRecognitionOverlay(): void; /** * Hide adaptive recognition overlay */ hideAdaptiveRecognitionOverlay(): void; /** * Show backdrop */ showBackdrop(): Promise; /** * Hide backdrop */ hideBackdrop(): Promise; /** * Move input to top of list with animation */ moveInputToTop(fieldName: string): Promise; /** * Restore all inputs to original positions */ restoreInputsPositions(): Promise; /** * Update button text */ updateButtonText(config: { finishButtonText?: string; restartButtonText?: string; pauseButtonText?: string; }): void; /** * Set placeholder text for an input */ setInputPlaceholder(fieldName: string, placeholder: string): void; /** * Clear placeholder text for an input */ clearInputPlaceholder(fieldName: string): void; /** * Set input value */ setInputValue(fieldName: string, value: string): void; /** * Get input value */ getInputValue(fieldName: string): string; /** * Set input background color */ setInputBackgroundColor(fieldName: string, color: Color | string): void; /** * Append inputs to the layout */ appendInputs(...inputs: TextInput[]): void; /** * Initialize inputs from configuration * Clears existing inputs and creates new ones */ initializeInputs(configs: InputFieldConfig[]): void; /** * Remove all inputs from layout */ clearInputs(): void; /** * Focus an input */ focusInput(fieldName: string): void; /** * Blur an input */ blurInput(fieldName: string): void; /** * Scroll an input into view with platform-specific behavior * Automatically handles iOS-specific scroll positioning and margins */ scrollInputIntoView(fieldName: string, event: KeyboardVisibilityChangedEvent): void; /** * Check if an input is the currently active element */ isInputActiveElement(fieldName: string): boolean; /** * Blur the currently active element (typically to dismiss keyboard) */ blurActiveElement(): void; /** * Add event listener to the layout */ addEventListener(type: K, listener: (this: HTMLElement, ev: LabelCaptureValidationFlowLayoutEventMap[K]) => void): void; /** * Remove event listener from the layout */ removeEventListener(type: K, listener: (this: HTMLElement, ev: LabelCaptureValidationFlowLayoutEventMap[K]) => void): void; /** * Add click listener to submit button */ addSubmitButtonListener(listener: () => void): void; /** * Remove click listener from submit button */ removeSubmitButtonListener(listener: () => void): void; /** * Mount the view to the DataCaptureView */ mount(dataCaptureView: DataCaptureView): Promise; /** * Unmount the view and clean up */ unmount(dataCaptureView: DataCaptureView): Promise; } /** * Concrete implementation of the view layer * Wraps the LabelCaptureValidationFlowLayout and provides a clean interface */ declare class ValidationFlowView implements IValidationFlowView { private layout; private dataCaptureViewRoot; private scrollIntoView; /** * Ensure custom elements are registered (called once per application) */ private static ensureCustomElementsRegistered; constructor(); getInputs(): TextInput[]; getInputByName(fieldName: string): TextInput | null; hasInput(fieldName: string): boolean; isInputFocused(fieldName: string): boolean; isFocusedElementAnTextInput(): boolean; showScanningButtons(): void; showValidationButtons(): void; hideAllButtons(): void; setSubmitButtonDisabled(disabled: boolean): void; updateInputVisualState(fieldName: string, config: { value?: string; loading?: boolean; loadingText?: string; invalid?: boolean; hintMessage?: string; backgroundColor?: Color | string; }): void; resetInputValidation(fieldName: string): void; updateScanIconVisibility(fieldName: string, visible: boolean): void; updateAllScanIconVisibility(visible: boolean): void; updateInputForState(fieldName: string, state: InputState, value: string, config: { scanningText?: string; adaptiveScanningText?: string; hintMessage?: string; backgroundColor?: Color | string; scanIconVisible?: boolean; }): void; showAdaptiveRecognitionOverlay(): void; hideAdaptiveRecognitionOverlay(): void; showBackdrop(): Promise; hideBackdrop(): Promise; moveInputToTop(fieldName: string): Promise; restoreInputsPositions(): Promise; updateButtonText(config: { finishButtonText?: string; restartButtonText?: string; pauseButtonText?: string; }): void; setInputPlaceholder(fieldName: string, placeholder: string): void; clearInputPlaceholder(fieldName: string): void; setInputValue(fieldName: string, value: string): void; getInputValue(fieldName: string): string; setInputBackgroundColor(fieldName: string, color: Color | string): void; initializeInputs(configs: InputFieldConfig[]): void; appendInputs(...inputs: TextInput[]): void; clearInputs(): void; focusInput(fieldName: string): void; blurInput(fieldName: string): void; scrollInputIntoView(fieldName: string, event: KeyboardVisibilityChangedEvent): void; isInputActiveElement(fieldName: string): boolean; blurActiveElement(): void; addEventListener(type: K, listener: (this: HTMLElement, ev: LabelCaptureValidationFlowLayoutEventMap[K]) => void): void; removeEventListener(type: K, listener: (this: HTMLElement, ev: LabelCaptureValidationFlowLayoutEventMap[K]) => void): void; addSubmitButtonListener(listener: () => void): void; removeSubmitButtonListener(listener: () => void): void; mount(dataCaptureView: DataCaptureView): Promise; unmount(dataCaptureView: DataCaptureView): Promise; } export { type IValidationFlowView, type InputFieldConfig, ValidationFlowView };