1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import * as React from "react";
|
10 |
|
11 | export type maskArray = Array<string | RegExp> | boolean;
|
12 |
|
13 | export interface MaskedInputProps
|
14 | extends React.InputHTMLAttributes<HTMLInputElement> {
|
15 | mask?: maskArray | ((value: string) => maskArray);
|
16 |
|
17 | guide?: boolean;
|
18 |
|
19 | placeholderChar?: string;
|
20 |
|
21 | keepCharPositions?: boolean;
|
22 |
|
23 | pipe?: (
|
24 | conformedValue: string,
|
25 | config: any
|
26 | ) => false | string | { value: string; indexesOfPipedChars: number[] };
|
27 |
|
28 | showMask?: boolean;
|
29 |
|
30 | render?: (ref: (inputElement: HTMLElement) => void, props: any) => any;
|
31 | }
|
32 |
|
33 | export interface conformToMaskResult {
|
34 | conformedValue: string;
|
35 | meta: {
|
36 | someCharsRejected: boolean;
|
37 | };
|
38 | }
|
39 |
|
40 | export default class MaskedInput extends React.Component<
|
41 | MaskedInputProps,
|
42 | any
|
43 | > {
|
44 | inputElement: HTMLElement;
|
45 | }
|
46 |
|
47 | export function conformToMask(
|
48 | text: string,
|
49 | mask: maskArray | ((value: string) => maskArray),
|
50 | config?: any
|
51 | ): conformToMaskResult;
|