-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathtext-mask-core.d.ts
43 lines (38 loc) · 1.29 KB
/
text-mask-core.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
declare module 'text-mask-core' {
export type Mask = Array<string | RegExp>;
export type TextMaskConfig = {
currentCaretPosition: number;
rawValue: string;
previousConformedValue: string;
mask?: Mask | ((rawValue: string) => Mask);
guide?: boolean;
showMask?: boolean;
placeholderChar?: string;
keepCharPositions?: boolean;
pipe?: (
conformedValue: string,
config: TextMaskConfig,
) => false | string | { value: string; indexesOfPipedChars: number[] };
};
export type TextMaskInputElement = {
state: { previousConformedValue: string; previousPlaceholder: string };
update: (
rawValue?: string,
textMaskConfig?: TextMaskConfig & { inputElement: HTMLInputElement },
) => void;
};
export function createTextMaskInputElement(
config: TextMaskConfig & { inputElement: HTMLInputElement },
): TextMaskInputElement;
export function conformToMask(
text: string,
mask: Mask | ((rawValue: string) => Mask),
config?: TextMaskConfig,
): conformToMaskResult;
export type conformToMaskResult = {
conformedValue: string;
meta: {
someCharsRejected: boolean;
};
};
}