-
Notifications
You must be signed in to change notification settings - Fork 419
/
Copy pathnumber_format.d.ts
executable file
·67 lines (59 loc) · 2.14 KB
/
number_format.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/// <reference types="react" />
declare module "react-number-format" {
//exclude types from the InputHTMLAttributes
const {defaultValue, value, ...inputAttributes}: React.InputHTMLAttributes<HTMLInputElement>;
type InputAttributes = typeof inputAttributes;
export interface NumberFormatState {
value?: string;
numAsString?: string;
}
export interface NumberFormatValues {
floatValue: number | undefined;
formattedValue: string;
value: string;
}
export type FormatInputValueFunction = (inputValue: string) => string;
export interface SyntheticInputEvent
extends React.SyntheticEvent<HTMLInputElement> {
readonly target: HTMLInputElement;
data: any;
}
export interface NumberFormatProps
extends InputAttributes {
thousandSeparator?: boolean | string;
decimalSeparator?: boolean | string;
thousandsGroupStyle?: 'thousand' | 'lakh' | 'wan';
decimalScale?: number;
fixedDecimalScale?: boolean;
displayType?: 'input' | 'text';
prefix?: string;
suffix?: string;
format?: string | FormatInputValueFunction;
removeFormatting?: (formattedValue: string) => string;
mask?: string | string[];
value?: number | string;
defaultValue?: number | string;
isNumericString?: boolean;
customInput?: React.ComponentType<any>;
allowNegative?: boolean;
allowEmptyFormatting?: boolean;
allowLeadingZeros?: boolean;
onValueChange?: (values: NumberFormatValues) => void;
/**
* these are already included in React.HTMLAttributes<HTMLInputElement>
* onKeyDown: Function;
* onMouseUp: Function;
* onChange: Function;
* onFocus: Function;
* onBlur: Function;
*/
type?: 'text' | 'tel' | 'password';
isAllowed?: (values: NumberFormatValues) => boolean;
renderText?: (formattedValue: string) => React.ReactNode;
getInputRef?: ((el: HTMLInputElement) => void) | React.Ref<any>;
allowedDecimalSeparators?: Array<string>;
[key: string]: any;
}
class NumberFormat extends React.Component<NumberFormatProps, any> {}
export default NumberFormat;
}