otp-angular
Version:
**Otp Angular** is a lightweight, highly customizable, and dependency-free OTP (One-Time Password) input component built for Angular 20+ applications. It offers seamless integration, flexible configuration, and a polished user experience for OTP or verifi
80 lines (76 loc) • 2.98 kB
TypeScript
import * as _angular_core from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
interface OtpAngularType {
length: number;
numbersOnly?: boolean;
autoFocus?: boolean;
isPassword?: boolean;
showError?: boolean;
showCaps?: boolean;
containerClass?: string | Array<string>;
containerStyles?: Object;
inputClass?: string | Array<string>;
inputStyles?: Object | Array<Object>;
placeholder?: string;
separator?: string;
resend?: number;
resendLabel?: string;
resendContainerClass?: string;
resendLabelClass?: string;
resendTimerClass?: string;
theme?: 'light-theme' | 'dark-theme';
}
declare class OtpAngular implements ControlValueAccessor {
private readonly document;
config: _angular_core.ModelSignal<OtpAngularType>;
disabled: _angular_core.WritableSignal<boolean>;
onInputChange: _angular_core.OutputEmitterRef<string | number | null>;
onResendAvailable: _angular_core.OutputEmitterRef<boolean>;
protected defaultConfig: _angular_core.Signal<{
length: number;
numbersOnly: boolean;
autoFocus: boolean;
isPassword: boolean;
showError: boolean;
showCaps: boolean;
containerClass: string | Array<string>;
containerStyles: Object;
inputClass: string | Array<string>;
inputStyles: Object;
placeholder: string;
separator: string;
resend: number;
resendLabel: string;
resendContainerClass: string;
resendLabelClass: string;
resendTimerClass: string;
theme: "light-theme" | "dark-theme";
}>;
protected myValue: _angular_core.WritableSignal<(string | number)[]>;
protected inputStyleArray: _angular_core.Signal<any[]>;
protected countdown: _angular_core.WritableSignal<number>;
protected isResendAllowed: _angular_core.WritableSignal<boolean>;
private timer;
private value;
private onChange;
private onTouched;
constructor();
setValue(value: string | number): void;
reset(): void;
protected keydown(e: KeyboardEvent, index: number): void;
protected onPaste(e: ClipboardEvent, index: number): void;
private setBoxValue;
private sanitize;
protected onInput(e: Event, index: number): void;
protected blur(e: FocusEvent, index: number): void;
private emit;
protected resend(): void;
writeValue(obj: any): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
private updateValue;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OtpAngular, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<OtpAngular, "otp-angular", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "config": "configChange"; "onInputChange": "onInputChange"; "onResendAvailable": "onResendAvailable"; }, never, never, true, never>;
}
export { OtpAngular };
export type { OtpAngularType };