UNPKG

restricted-input

Version:

Restrict inputs to certain valid characters (e.g. formatting phone or card numbers)

17 lines (16 loc) 505 B
export type Input = HTMLInputElement | HTMLTextAreaElement; export type OnPasteEventMethod = (options: { unformattedInputValue: string; }) => void; export type StrategyOptions = { element: Input; pattern: string; onPasteEvent?: OnPasteEventMethod; }; export declare abstract class StrategyInterface { inputElement: Input; isFormatted: boolean; constructor(options: StrategyOptions); abstract getUnformattedValue(): string; abstract setPattern(pattern: string): void; }