import * as _angular_core from '@angular/core'; import { Signal } from '@angular/core'; import { BooleanInput } from '@angular/cdk/coercion'; import * as ng_primitives_state from 'ng-primitives/state'; import { Observable } from 'rxjs'; type NgpInputOtpInputMode = 'numeric' | 'text' | 'decimal' | 'tel' | 'search' | 'email' | 'url'; declare class NgpInputOtp { /** * The id of the input-otp. */ readonly id: _angular_core.InputSignal; /** * The current value of the OTP. A null/undefined value (e.g. from a form * `writeValue(null)` or `reset()`) is coerced to an empty string. */ readonly value: _angular_core.InputSignalWithTransform; /** * The regex pattern for allowed characters. */ readonly pattern: _angular_core.InputSignal; /** * The input mode for the hidden input. */ readonly inputMode: _angular_core.InputSignal; /** * Function to transform pasted text. */ readonly pasteTransformer: _angular_core.InputSignal<((text: string) => string) | undefined>; /** * Whether the input-otp is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * The placeholder character to display when a slot is empty. */ readonly placeholder: _angular_core.InputSignal; /** * Event emitted when the value changes. */ readonly valueChange: _angular_core.OutputEmitterRef; /** * Event emitted when the OTP is complete (maxLength characters entered). */ readonly complete: _angular_core.OutputEmitterRef; /** * The state of the input-otp. */ private readonly state; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } interface NgpInputOtpInputState { /** * Focus the input. */ focus(): void; /** * Set the selection range on the input. * @internal */ setSelectionRange(start: number, end: number): void; } declare const NgpInputOtpInputStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal>; declare const ngpInputOtpInput: () => NgpInputOtpInputState; interface NgpInputOtpSlotState { } declare const NgpInputOtpSlotStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal>; declare const ngpInputOtpSlot: () => NgpInputOtpSlotState; interface NgpInputOtpProps { /** * The current value of the OTP. * @default '' */ readonly value?: Signal; /** * The regex pattern for allowed characters. * @default '[0-9]' */ readonly pattern?: Signal; /** * The input mode for the hidden input. * @default 'text' */ readonly inputMode?: Signal; /** * Function to transform pasted text. */ readonly pasteTransformer?: Signal<((text: string) => string) | undefined>; /** * Whether the input-otp is disabled. * @default false */ readonly disabled?: Signal; /** * The placeholder character to display when a slot is empty. * @default '' */ readonly placeholder?: Signal; /** * Callback invoked when the value changes. */ readonly onValueChange?: (value: string) => void; /** * Callback invoked when the OTP is complete (maxLength characters entered). */ readonly onComplete?: (value: string) => void; } interface NgpInputOtpState { /** * The current value of the OTP. */ readonly value: Signal; /** * The regex pattern for allowed characters. */ readonly pattern: Signal; /** * The input mode for the hidden input. */ readonly inputMode: Signal; /** * Function to transform pasted text. */ readonly pasteTransformer: Signal<((text: string) => string) | undefined>; /** * Whether the input-otp is disabled. */ readonly disabled: Signal; /** * The placeholder character to display when a slot is empty. */ readonly placeholder: Signal; /** * The number of characters in the OTP, derived from the registered slots. */ readonly maxLength: Signal; /** * The focus state of the input. * @internal */ readonly isFocused: Signal; /** * The selection start position. * @internal */ readonly selectionStart: Signal; /** * The selection end position. * @internal */ readonly selectionEnd: Signal; /** * Emits when the value changes. */ readonly valueChange: Observable; /** * Emits once the OTP is complete (`maxLength` characters entered). It does * not emit when a complete value is shortened. */ readonly complete: Observable; /** * Register the hidden input with the input-otp. * @internal */ registerInput(input: NgpInputOtpInputState): void; /** * Register a slot with the input-otp. * @internal */ registerSlot(slot: NgpInputOtpSlotState): void; /** * Unregister a slot from the input-otp. * @internal */ unregisterSlot(slot: NgpInputOtpSlotState): void; /** * Get the index of a registered slot. * @internal */ getSlotIndex(slot: NgpInputOtpSlotState): number; /** * Update the value and emit change events. * @internal */ updateValue(value: string): void; /** * Update the focus state. * @internal */ updateFocus(focused: boolean): void; /** * Update the selection state. * @internal */ updateSelection(start: number, end: number): void; /** * Focus the input and set the caret to the given position. * @internal */ focusAtPosition(position: number): void; } declare const ngpInputOtp: ({ value: _value, pattern, inputMode, pasteTransformer, disabled, placeholder, onValueChange, onComplete, }: NgpInputOtpProps) => NgpInputOtpState; declare const injectInputOtpState: { (): Signal; (options: ng_primitives_state.StateInjectionOptions): Signal; (options?: ng_primitives_state.StateInjectionOptions): Signal | Signal; }; declare const provideInputOtpState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; declare class NgpInputOtpInput { /** * The state of the input-otp input. */ protected readonly state: NgpInputOtpInputState; /** * Focus the input. */ focus(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } declare class NgpInputOtpSlot { /** * The state of the input-otp slot. */ protected readonly state: NgpInputOtpSlotState; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } export { NgpInputOtp, NgpInputOtpInput, NgpInputOtpInputStateToken, NgpInputOtpSlot, NgpInputOtpSlotStateToken, injectInputOtpState, ngpInputOtp, ngpInputOtpInput, ngpInputOtpSlot, provideInputOtpState }; export type { NgpInputOtpInputMode, NgpInputOtpProps, NgpInputOtpState };