react-mui-form-validator 1.2.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +28 -171
- package/lib/index.d.ts +141 -259
- package/lib/index.js +13449 -12048
- package/package.json +17 -31
- package/tsconfig.json +3 -3
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -69
package/Readme.md
CHANGED
|
@@ -14,10 +14,16 @@ npm install react-mui-form-validator
|
|
|
14
14
|
Some rules can accept extra parameter, example:
|
|
15
15
|
|
|
16
16
|
TextField
|
|
17
|
+
|
|
17
18
|
```javascript
|
|
18
19
|
<MuiTextField
|
|
19
20
|
{...someProps}
|
|
20
|
-
validators={[
|
|
21
|
+
validators={[
|
|
22
|
+
{
|
|
23
|
+
validator: "maxNumber",
|
|
24
|
+
max: 10,
|
|
25
|
+
},
|
|
26
|
+
]}
|
|
21
27
|
/>
|
|
22
28
|
```
|
|
23
29
|
|
|
@@ -27,193 +33,44 @@ You can pass any props of field components, but note that `errorText` prop will
|
|
|
27
33
|
Your component must [provide a theme](http://www.material-ui.com/#/get-started/usage).
|
|
28
34
|
|
|
29
35
|
```javascript
|
|
30
|
-
|
|
31
36
|
import { useState } from "react";
|
|
32
|
-
import "./App.css";
|
|
33
37
|
import { MuiForm, MuiTextField } from "react-mui-form-validator";
|
|
34
|
-
import { Button
|
|
35
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
36
|
-
import {
|
|
37
|
-
faEnvelope,
|
|
38
|
-
faEye,
|
|
39
|
-
faEyeSlash,
|
|
40
|
-
} from "@fortawesome/free-solid-svg-icons";
|
|
38
|
+
import { Button } from "@mui/material";
|
|
41
39
|
|
|
42
40
|
export default function App(props: any) {
|
|
43
|
-
const [name, setName] = useState();
|
|
44
41
|
const [email, setEmail] = useState();
|
|
45
|
-
const [password, setPassword] = useState();
|
|
46
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
47
|
-
|
|
48
|
-
const changeName = (event: any) => {
|
|
49
|
-
const name = event.target.value;
|
|
50
|
-
setName(name);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const changeEmail = (event: any) => {
|
|
54
|
-
const email = event.target.value;
|
|
55
|
-
setEmail(email);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const changePassword = (event: any) => {
|
|
59
|
-
const password = event.target.value;
|
|
60
|
-
setPassword(password);
|
|
61
|
-
};
|
|
62
42
|
|
|
63
43
|
const handleSubmit = () => {
|
|
64
44
|
// your submit logic
|
|
65
45
|
};
|
|
66
46
|
|
|
67
47
|
return (
|
|
68
|
-
<div
|
|
69
|
-
<
|
|
70
|
-
<Paper className="container">
|
|
71
|
-
<h3>Example Sign In</h3>
|
|
72
|
-
<MuiForm
|
|
73
|
-
onSubmit={handleSubmit}
|
|
74
|
-
onError={(errors: any) => console.log(errors)}
|
|
75
|
-
>
|
|
76
|
-
<MuiTextField
|
|
77
|
-
name="name"
|
|
78
|
-
//className="css-style-name" add your css style
|
|
79
|
-
//classes={classes.emailInput} //add your js or ts style
|
|
80
|
-
label="Name"
|
|
81
|
-
placeholder="Name"
|
|
82
|
-
onChange={changeName}
|
|
83
|
-
value={name}
|
|
84
|
-
validators={["required"]}
|
|
85
|
-
errorMessages={["this field is required"]}
|
|
86
|
-
fullWidth
|
|
87
|
-
/>
|
|
88
|
-
<br />
|
|
89
|
-
<MuiTextField
|
|
90
|
-
name="email"
|
|
91
|
-
//className="css-style-name" add your css style
|
|
92
|
-
//classes={classes.emailInput} //add your js or ts style
|
|
93
|
-
label="Email"
|
|
94
|
-
placeholder="Email"
|
|
95
|
-
onChange={changeEmail}
|
|
96
|
-
value={email}
|
|
97
|
-
validators={["required", "isEmail"]}
|
|
98
|
-
errorMessages={["this field is required", "email is not valid"]}
|
|
99
|
-
InputProps={{
|
|
100
|
-
startAdornment: (
|
|
101
|
-
<InputAdornment position="start">
|
|
102
|
-
<FontAwesomeIcon icon={faEnvelope} />
|
|
103
|
-
</InputAdornment>
|
|
104
|
-
),
|
|
105
|
-
}}
|
|
106
|
-
fullWidth
|
|
107
|
-
/>
|
|
108
|
-
<br />
|
|
109
|
-
<MuiTextField
|
|
110
|
-
type={showPassword ? "text" : "password"}
|
|
111
|
-
style={{ marginBottom: 0 }}
|
|
112
|
-
name="password"
|
|
113
|
-
label="Password"
|
|
114
|
-
//InputLabelProps={{ shrink: true }}
|
|
115
|
-
placeholder="Password"
|
|
116
|
-
value={password}
|
|
117
|
-
onChange={changePassword}
|
|
118
|
-
InputProps={{
|
|
119
|
-
startAdornment: (
|
|
120
|
-
<InputAdornment position="start">
|
|
121
|
-
<FontAwesomeIcon icon={faEnvelope} />
|
|
122
|
-
</InputAdornment>
|
|
123
|
-
),
|
|
124
|
-
endAdornment: (
|
|
125
|
-
<InputAdornment position="end">
|
|
126
|
-
<IconButton
|
|
127
|
-
aria-label="toggle password visibility"
|
|
128
|
-
onClick={() => setShowPassword(!showPassword)}
|
|
129
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
130
|
-
edge="end"
|
|
131
|
-
>
|
|
132
|
-
<FontAwesomeIcon
|
|
133
|
-
icon={showPassword ? faEyeSlash : faEye}
|
|
134
|
-
/>
|
|
135
|
-
</IconButton>
|
|
136
|
-
</InputAdornment>
|
|
137
|
-
),
|
|
138
|
-
}}
|
|
139
|
-
validators={["required"]}
|
|
140
|
-
errorMessages={["Password is required"]}
|
|
141
|
-
variant="outlined"
|
|
142
|
-
fullWidth
|
|
143
|
-
/>
|
|
144
|
-
<br />
|
|
145
|
-
<Button type="submit" variant="outlined">
|
|
146
|
-
Sign In
|
|
147
|
-
</Button>
|
|
148
|
-
</MuiForm>
|
|
149
|
-
</Paper>
|
|
150
|
-
</center>
|
|
151
|
-
</div>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
css style example:
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
.App {
|
|
160
|
-
text-align: center;
|
|
161
|
-
width: 100%;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.container {
|
|
165
|
-
width: 500px;
|
|
166
|
-
height: auto;
|
|
167
|
-
background: #FFFFFF;
|
|
168
|
-
box-shadow: 0px 20px 56px rgba(0, 0, 0, 0.1);
|
|
169
|
-
border-radius: 16px;
|
|
170
|
-
padding: 15px;
|
|
171
|
-
margin: 20px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Class component example:
|
|
177
|
-
|
|
178
|
-
```javascript
|
|
179
|
-
|
|
180
|
-
import React from "react";
|
|
181
|
-
import Button from "@mui/material/Button";
|
|
182
|
-
import { MuiForm, MuiTextField } from "react-mui-form-validator";
|
|
183
|
-
|
|
184
|
-
class MyForm extends React.Component {
|
|
185
|
-
state = {
|
|
186
|
-
email: "",
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
handleChange = (event) => {
|
|
190
|
-
const email = event.target.value;
|
|
191
|
-
this.setState({ email });
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
handleSubmit = () => {
|
|
195
|
-
// your submit logic
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
render() {
|
|
199
|
-
const { email } = this.state;
|
|
200
|
-
return (
|
|
48
|
+
<div>
|
|
49
|
+
<h3>Example Sign In</h3>
|
|
201
50
|
<MuiForm
|
|
202
|
-
onSubmit={
|
|
203
|
-
onError={(errors) => console.log(errors)}
|
|
51
|
+
onSubmit={handleSubmit}
|
|
52
|
+
onError={(errors: any) => console.log(errors)}
|
|
204
53
|
>
|
|
205
54
|
<MuiTextField
|
|
206
|
-
label="Email"
|
|
207
|
-
onChange={this.handleChange}
|
|
208
55
|
name="email"
|
|
56
|
+
label="Email"
|
|
57
|
+
placeholder="example@domain.com"
|
|
58
|
+
onChange={(v) => setEmail(v.target.value)}
|
|
209
59
|
value={email}
|
|
210
|
-
validators={[
|
|
211
|
-
|
|
60
|
+
validators={[
|
|
61
|
+
{
|
|
62
|
+
validator: "isEmail",
|
|
63
|
+
},
|
|
64
|
+
]}
|
|
65
|
+
errorMessages={["Email is required"]}
|
|
66
|
+
fullWidth
|
|
212
67
|
/>
|
|
213
|
-
<
|
|
68
|
+
<br />
|
|
69
|
+
<Button type="submit" variant="outlined">
|
|
70
|
+
Sign In
|
|
71
|
+
</Button>
|
|
214
72
|
</MuiForm>
|
|
215
|
-
|
|
216
|
-
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
217
75
|
}
|
|
218
|
-
|
|
219
76
|
```
|
package/lib/index.d.ts
CHANGED
|
@@ -1,285 +1,167 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { TextFieldVariants, FilledTextFieldProps, StandardTextFieldProps, OutlinedTextFieldProps } from '@mui/material';
|
|
4
|
+
import { MuiTelInputInfo } from 'mui-tel-input';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: any;
|
|
9
|
-
validators: any;
|
|
10
|
-
errorMessages: any;
|
|
11
|
-
} | {
|
|
12
|
-
value: any;
|
|
13
|
-
validators?: undefined;
|
|
14
|
-
errorMessages?: undefined;
|
|
15
|
-
};
|
|
16
|
-
constructor(props: any);
|
|
17
|
-
constructor(props: any, context: any);
|
|
18
|
-
state: {
|
|
19
|
-
isValid: boolean;
|
|
20
|
-
value: any;
|
|
21
|
-
errorMessages: any;
|
|
22
|
-
validators: any;
|
|
23
|
-
};
|
|
24
|
-
componentDidMount(): void;
|
|
25
|
-
shouldComponentUpdate(nextProps: any, nextState: any): boolean;
|
|
26
|
-
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
27
|
-
componentWillUnmount(): void;
|
|
28
|
-
getErrorMessage: () => any;
|
|
29
|
-
instantValidate: boolean;
|
|
30
|
-
invalid: any[];
|
|
31
|
-
configure: () => void;
|
|
32
|
-
debounceTime: any;
|
|
33
|
-
validateDebounced: {
|
|
34
|
-
(value?: any, includeRequired?: boolean | undefined, dryRun?: boolean | undefined): void;
|
|
35
|
-
cancel: () => void;
|
|
36
|
-
} | undefined;
|
|
37
|
-
validate: (value: any, includeRequired?: boolean, dryRun?: boolean) => Promise<boolean>;
|
|
38
|
-
isValid: () => boolean;
|
|
39
|
-
makeInvalid: () => void;
|
|
40
|
-
makeValid: () => void;
|
|
41
|
-
renderComponent: (form: any) => any;
|
|
42
|
-
form: any;
|
|
43
|
-
render(): React__default.JSX.Element;
|
|
6
|
+
interface required {
|
|
7
|
+
validator: "required";
|
|
44
8
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let validators: PropTypes.Requireable<any[]>;
|
|
49
|
-
let value: PropTypes.Requireable<any>;
|
|
50
|
-
let validatorListener: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
-
let withRequiredValidator: PropTypes.Requireable<boolean>;
|
|
52
|
-
let containerProps: PropTypes.Requireable<object>;
|
|
53
|
-
}
|
|
54
|
-
namespace defaultProps {
|
|
55
|
-
let errorMessages_1: string;
|
|
56
|
-
export { errorMessages_1 as errorMessages };
|
|
57
|
-
let validators_1: never[];
|
|
58
|
-
export { validators_1 as validators };
|
|
59
|
-
export function validatorListener_1(): void;
|
|
60
|
-
export { validatorListener_1 as validatorListener };
|
|
61
|
-
}
|
|
9
|
+
interface matchRegexp {
|
|
10
|
+
validator: "matchRegexp";
|
|
11
|
+
regexp: RegExp | string;
|
|
62
12
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
13
|
+
interface isEmail {
|
|
14
|
+
validator: "isEmail";
|
|
15
|
+
}
|
|
16
|
+
interface isEmpty {
|
|
17
|
+
validator: "isEmpty";
|
|
18
|
+
}
|
|
19
|
+
interface trim {
|
|
20
|
+
validator: "trim";
|
|
21
|
+
}
|
|
22
|
+
interface isNumber {
|
|
23
|
+
validator: "isNumber";
|
|
24
|
+
}
|
|
25
|
+
interface isFloat {
|
|
26
|
+
validator: "isFloat";
|
|
27
|
+
}
|
|
28
|
+
interface isPositive {
|
|
29
|
+
validator: "isPositive";
|
|
30
|
+
}
|
|
31
|
+
interface maxNumber {
|
|
32
|
+
validator: "maxNumber";
|
|
33
|
+
max: number;
|
|
34
|
+
}
|
|
35
|
+
interface minNumber {
|
|
36
|
+
validator: "minNumber";
|
|
37
|
+
min: number;
|
|
38
|
+
}
|
|
39
|
+
interface maxFloat {
|
|
40
|
+
validator: "maxFloat";
|
|
41
|
+
max: number;
|
|
42
|
+
}
|
|
43
|
+
interface minFloat {
|
|
44
|
+
validator: "minFloat";
|
|
45
|
+
min: number;
|
|
46
|
+
}
|
|
47
|
+
interface isString {
|
|
48
|
+
validator: "isString";
|
|
49
|
+
}
|
|
50
|
+
interface minStringLength {
|
|
51
|
+
validator: "minStringLength";
|
|
52
|
+
min: number;
|
|
53
|
+
}
|
|
54
|
+
interface maxStringLength {
|
|
55
|
+
validator: "maxStringLength";
|
|
56
|
+
max: number;
|
|
57
|
+
}
|
|
58
|
+
interface isFile {
|
|
59
|
+
validator: "isFile";
|
|
60
|
+
}
|
|
61
|
+
interface maxFileSize {
|
|
62
|
+
validator: "maxFileSize";
|
|
63
|
+
max: number;
|
|
66
64
|
}
|
|
65
|
+
interface allowedExtensions {
|
|
66
|
+
validator: "allowedExtensions";
|
|
67
|
+
fileTypes: string;
|
|
68
|
+
}
|
|
69
|
+
type Validator = required | matchRegexp | isEmail | isEmpty | trim | isNumber | isFloat | isPositive | maxNumber | minNumber | maxFloat | minFloat | isString | minStringLength | maxStringLength | isFile | maxFileSize | allowedExtensions;
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
type MuiTextFieldProps<Variant extends TextFieldVariants = TextFieldVariants> = Variant extends "filled" ? FilledTextFieldProps : Variant extends "standard" ? StandardTextFieldProps : OutlinedTextFieldProps & ValidatorComponentProps;
|
|
72
|
+
interface ValidatorComponentProps {
|
|
73
|
+
errorMessages?: string | string[];
|
|
74
|
+
validators?: Validator[];
|
|
75
|
+
value: any;
|
|
76
|
+
validatorListener?: (value: boolean) => void;
|
|
77
|
+
withRequiredValidator?: boolean;
|
|
78
|
+
containerProps?: object;
|
|
79
|
+
onChangeTel?: (value: string, info: MuiTelInputInfo) => void;
|
|
80
|
+
}
|
|
81
|
+
interface ValidatorComponentState {
|
|
82
|
+
isValid?: boolean;
|
|
83
|
+
value: any;
|
|
84
|
+
errorMessages?: string | string[];
|
|
85
|
+
validators?: Validator[];
|
|
86
|
+
}
|
|
87
|
+
interface ValidatorFormProps {
|
|
88
|
+
onSubmit: () => void;
|
|
89
|
+
instantValidate?: boolean;
|
|
90
|
+
children?: React.ReactNode;
|
|
91
|
+
onError?: (errors: any[]) => void;
|
|
92
|
+
debounceTime?: number;
|
|
70
93
|
}
|
|
71
94
|
|
|
72
|
-
declare class ValidatorForm extends
|
|
73
|
-
static getValidator: (
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
declare class ValidatorForm extends React$1.Component<ValidatorFormProps> {
|
|
96
|
+
static getValidator: (value: any, validator: Validator) => boolean;
|
|
97
|
+
childs: any[];
|
|
98
|
+
errors: any[];
|
|
99
|
+
instantValidate: boolean;
|
|
100
|
+
debounceTime: number | undefined;
|
|
76
101
|
getFormHelpers: () => {
|
|
77
102
|
form: {
|
|
78
103
|
attachToForm: (component: any) => void;
|
|
104
|
+
debounceTime: number | undefined;
|
|
79
105
|
detachFromForm: (component: any) => void;
|
|
80
|
-
instantValidate:
|
|
81
|
-
debounceTime: any;
|
|
106
|
+
instantValidate: boolean | undefined;
|
|
82
107
|
};
|
|
83
108
|
};
|
|
84
|
-
instantValidate: any;
|
|
85
|
-
debounceTime: any;
|
|
86
|
-
childs: any[];
|
|
87
|
-
errors: any[];
|
|
88
109
|
attachToForm: (component: any) => void;
|
|
89
110
|
detachFromForm: (component: any) => void;
|
|
90
|
-
submit: (event:
|
|
91
|
-
walk: (children: any, dryRun
|
|
92
|
-
checkInput: (input: any, dryRun
|
|
93
|
-
validate: (input: any, includeRequired:
|
|
94
|
-
find: (collection: any, fn: any) => any;
|
|
111
|
+
submit: (event: React$1.FormEvent<HTMLFormElement>) => void;
|
|
112
|
+
walk: (children: any[], dryRun?: boolean) => Promise<boolean>;
|
|
113
|
+
checkInput: (input: any, dryRun?: boolean) => Promise<boolean>;
|
|
114
|
+
validate: (input: any, includeRequired: boolean, dryRun?: boolean) => Promise<boolean>;
|
|
115
|
+
find: (collection: any[], fn: (item: any) => boolean) => any;
|
|
95
116
|
resetValidations: () => void;
|
|
96
|
-
isFormValid: (dryRun?: boolean) => Promise<
|
|
97
|
-
render():
|
|
98
|
-
}
|
|
99
|
-
declare namespace ValidatorForm {
|
|
100
|
-
function addValidationRule(name: any, callback: any): void;
|
|
101
|
-
function getValidationRule(name: any): any;
|
|
102
|
-
function hasValidationRule(name: any): any;
|
|
103
|
-
function removeValidationRule(name: any): void;
|
|
104
|
-
namespace propTypes {
|
|
105
|
-
let onSubmit: PropTypes.Validator<(...args: any[]) => any>;
|
|
106
|
-
let instantValidate: PropTypes.Requireable<boolean>;
|
|
107
|
-
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
108
|
-
let onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
109
|
-
let debounceTime: PropTypes.Requireable<number>;
|
|
110
|
-
}
|
|
111
|
-
namespace defaultProps {
|
|
112
|
-
export function onError_1(): void;
|
|
113
|
-
export { onError_1 as onError };
|
|
114
|
-
let debounceTime_1: number;
|
|
115
|
-
export { debounceTime_1 as debounceTime };
|
|
116
|
-
}
|
|
117
|
+
isFormValid: (dryRun?: boolean) => Promise<boolean>;
|
|
118
|
+
render(): React$1.JSX.Element;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
declare class
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
selectedCountry: any;
|
|
130
|
-
highlightCountryIndex: number;
|
|
131
|
-
queryString: string;
|
|
132
|
-
freezeSelection: boolean;
|
|
133
|
-
debouncedQueryStingSearcher: lodash.DebouncedFunc<() => void>;
|
|
134
|
-
anchorEl: null;
|
|
135
|
-
};
|
|
136
|
-
componentDidMount(): void;
|
|
137
|
-
componentDidUpdate({ value: prevValue }: {
|
|
121
|
+
declare class ValidatorComponent extends React$1.Component<MuiTextFieldProps & ValidatorComponentProps, ValidatorComponentState> {
|
|
122
|
+
renderValidatorComponent(): React$1.ReactNode;
|
|
123
|
+
form: any;
|
|
124
|
+
debounceTime: any;
|
|
125
|
+
validateDebounced: {
|
|
126
|
+
(value: any, includeRequired?: boolean | undefined, dryRun?: boolean | undefined): void;
|
|
127
|
+
cancel: () => void;
|
|
128
|
+
} | any;
|
|
129
|
+
constructor(props: MuiTextFieldProps & ValidatorComponentProps);
|
|
130
|
+
getSnapshotBeforeUpdate(nextProps: Readonly<MuiTextFieldProps & ValidatorComponentProps>, prevState: Readonly<ValidatorComponentState>): {
|
|
138
131
|
value: any;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
getProbableCandidate: ((queryString: any) => string | null) & lodash.MemoizedFunction;
|
|
142
|
-
getOnlyCountries: (onlyCountriesArray: any, filteredCountries: any) => any;
|
|
143
|
-
excludeCountries: (selectedCountries: any, excludedCountries: any) => any;
|
|
144
|
-
filterRegions: (regions: any, filteredCountries: any) => any;
|
|
145
|
-
deleteAreaCodes: (filteredCountries: any) => any;
|
|
146
|
-
updateDefaultCountry: (country: any) => void;
|
|
147
|
-
scrollTo: (country: any) => void;
|
|
148
|
-
formatNumber: (text: any, patternArg: any) => any;
|
|
149
|
-
cursorToEnd: () => void;
|
|
150
|
-
getElement: (index: any) => any;
|
|
151
|
-
getCountryData: () => {
|
|
152
|
-
name?: undefined;
|
|
153
|
-
dialCode?: undefined;
|
|
154
|
-
countryCode?: undefined;
|
|
132
|
+
validators: Validator[];
|
|
133
|
+
errorMessages: string | string[];
|
|
155
134
|
} | {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
handleInput: (e: any) => void;
|
|
161
|
-
handleRefInput: (ref: any) => void;
|
|
162
|
-
inputRef: any;
|
|
163
|
-
handleInputClick: (e: any) => void;
|
|
164
|
-
handleFlagItemClick: (country: any) => void;
|
|
165
|
-
handleInputFocus: (e: any) => void;
|
|
166
|
-
handleInputBlur: (e: any) => void;
|
|
167
|
-
getHighlightCountryIndex: (direction: any) => any;
|
|
168
|
-
searchCountry: () => void;
|
|
169
|
-
handleKeydown: (e: any) => void;
|
|
170
|
-
handleInputKeyDown: (e: any) => void;
|
|
171
|
-
checkIfValid: () => any;
|
|
172
|
-
updateFormattedNumber: (number: any) => void;
|
|
173
|
-
getDropdownProps: () => {
|
|
174
|
-
startAdornment?: undefined;
|
|
175
|
-
} | {
|
|
176
|
-
startAdornment: React.JSX.Element;
|
|
135
|
+
value: any;
|
|
136
|
+
validators?: undefined;
|
|
137
|
+
errorMessages?: undefined;
|
|
177
138
|
};
|
|
178
|
-
|
|
139
|
+
instantValidate: boolean;
|
|
140
|
+
invalid: number[];
|
|
141
|
+
componentDidMount(): void;
|
|
142
|
+
configure: () => void;
|
|
143
|
+
shouldComponentUpdate(nextProps: MuiTextFieldProps, nextState: ValidatorComponentState): boolean;
|
|
144
|
+
componentDidUpdate(prevProps: MuiTextFieldProps, prevState: ValidatorComponentState): void;
|
|
145
|
+
componentWillUnmount(): void;
|
|
146
|
+
getErrorMessage: () => string | boolean | string[];
|
|
147
|
+
validate: (value: any, dryRun?: boolean) => Promise<boolean>;
|
|
148
|
+
isValid: () => boolean;
|
|
149
|
+
makeInvalid: () => void;
|
|
150
|
+
makeValid: () => void;
|
|
151
|
+
renderComponent: (form: ValidatorForm) => React$1.ReactNode;
|
|
152
|
+
render(): React$1.JSX.Element;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare class MuiSelect extends ValidatorComponent {
|
|
156
|
+
renderValidatorComponent(): React$1.JSX.Element;
|
|
179
157
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
let onlyCountries: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
184
|
-
let preferredCountries: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
185
|
-
let defaultCountry: PropTypes.Requireable<string>;
|
|
186
|
-
let value: PropTypes.Requireable<string>;
|
|
187
|
-
let placeholder: PropTypes.Requireable<string>;
|
|
188
|
-
let disabled: PropTypes.Requireable<boolean>;
|
|
189
|
-
let error: PropTypes.Requireable<boolean>;
|
|
190
|
-
let variant: PropTypes.Requireable<string>;
|
|
191
|
-
let native: PropTypes.Requireable<boolean>;
|
|
192
|
-
let inputClass: PropTypes.Requireable<string>;
|
|
193
|
-
let dropdownClass: PropTypes.Requireable<string>;
|
|
194
|
-
let InputProps: PropTypes.Requireable<object>;
|
|
195
|
-
let inputProps: PropTypes.Requireable<object>;
|
|
196
|
-
let inputRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
197
|
-
let autoFormat: PropTypes.Requireable<boolean>;
|
|
198
|
-
let disableAreaCodes: PropTypes.Requireable<boolean>;
|
|
199
|
-
let disableCountryCode: PropTypes.Requireable<boolean>;
|
|
200
|
-
let disableDropdown: PropTypes.Requireable<boolean>;
|
|
201
|
-
let enableLongNumbers: PropTypes.Requireable<boolean>;
|
|
202
|
-
let countryCodeEditable: PropTypes.Requireable<boolean>;
|
|
203
|
-
let regions: PropTypes.Requireable<NonNullable<string | (string | null | undefined)[] | null | undefined>>;
|
|
204
|
-
let localization: PropTypes.Requireable<object>;
|
|
205
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
206
|
-
let onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
207
|
-
let onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
208
|
-
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
209
|
-
let onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
210
|
-
let isValid: PropTypes.Requireable<(...args: any[]) => any>;
|
|
211
|
-
let isModernBrowser: PropTypes.Requireable<(...args: any[]) => any>;
|
|
212
|
-
let onEnterKeyPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
213
|
-
let keys: PropTypes.Requireable<object>;
|
|
214
|
-
}
|
|
215
|
-
namespace defaultProps {
|
|
216
|
-
let excludeCountries_1: never[];
|
|
217
|
-
export { excludeCountries_1 as excludeCountries };
|
|
218
|
-
let onlyCountries_1: never[];
|
|
219
|
-
export { onlyCountries_1 as onlyCountries };
|
|
220
|
-
let preferredCountries_1: never[];
|
|
221
|
-
export { preferredCountries_1 as preferredCountries };
|
|
222
|
-
let defaultCountry_1: string;
|
|
223
|
-
export { defaultCountry_1 as defaultCountry };
|
|
224
|
-
let placeholder_1: string;
|
|
225
|
-
export { placeholder_1 as placeholder };
|
|
226
|
-
let disabled_1: boolean;
|
|
227
|
-
export { disabled_1 as disabled };
|
|
228
|
-
let error_1: boolean;
|
|
229
|
-
export { error_1 as error };
|
|
230
|
-
let variant_1: string;
|
|
231
|
-
export { variant_1 as variant };
|
|
232
|
-
let native_1: boolean;
|
|
233
|
-
export { native_1 as native };
|
|
234
|
-
let inputClass_1: string;
|
|
235
|
-
export { inputClass_1 as inputClass };
|
|
236
|
-
let dropdownClass_1: string;
|
|
237
|
-
export { dropdownClass_1 as dropdownClass };
|
|
238
|
-
let autoFormat_1: boolean;
|
|
239
|
-
export { autoFormat_1 as autoFormat };
|
|
240
|
-
let disableAreaCodes_1: boolean;
|
|
241
|
-
export { disableAreaCodes_1 as disableAreaCodes };
|
|
242
|
-
export function isValid_1(inputNumber: any): boolean;
|
|
243
|
-
export { isValid_1 as isValid };
|
|
244
|
-
let disableCountryCode_1: boolean;
|
|
245
|
-
export { disableCountryCode_1 as disableCountryCode };
|
|
246
|
-
let disableDropdown_1: boolean;
|
|
247
|
-
export { disableDropdown_1 as disableDropdown };
|
|
248
|
-
let enableLongNumbers_1: boolean;
|
|
249
|
-
export { enableLongNumbers_1 as enableLongNumbers };
|
|
250
|
-
let countryCodeEditable_1: boolean;
|
|
251
|
-
export { countryCodeEditable_1 as countryCodeEditable };
|
|
252
|
-
let regions_1: string;
|
|
253
|
-
export { regions_1 as regions };
|
|
254
|
-
let localization_1: {};
|
|
255
|
-
export { localization_1 as localization };
|
|
256
|
-
export function onEnterKeyPress_1(): void;
|
|
257
|
-
export { onEnterKeyPress_1 as onEnterKeyPress };
|
|
258
|
-
export function onChange_1(): void;
|
|
259
|
-
export { onChange_1 as onChange };
|
|
260
|
-
export function isModernBrowser_1(): boolean;
|
|
261
|
-
export { isModernBrowser_1 as isModernBrowser };
|
|
262
|
-
export namespace keys_1 {
|
|
263
|
-
let UP: number;
|
|
264
|
-
let DOWN: number;
|
|
265
|
-
let RIGHT: number;
|
|
266
|
-
let LEFT: number;
|
|
267
|
-
let ENTER: number;
|
|
268
|
-
let ESC: number;
|
|
269
|
-
let PLUS: number;
|
|
270
|
-
let A: number;
|
|
271
|
-
let Z: number;
|
|
272
|
-
let SPACE: number;
|
|
273
|
-
}
|
|
274
|
-
export { keys_1 as keys };
|
|
275
|
-
}
|
|
276
|
-
let displayName: string;
|
|
158
|
+
|
|
159
|
+
declare class MuiTextField extends ValidatorComponent {
|
|
160
|
+
renderValidatorComponent(): React__default.JSX.Element;
|
|
277
161
|
}
|
|
278
162
|
|
|
279
|
-
declare
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
declare const MuiComponent: typeof ValidatorComponent;
|
|
283
|
-
declare const MuiForm: typeof ValidatorForm;
|
|
163
|
+
declare class MuiTelInputDefault extends ValidatorComponent {
|
|
164
|
+
renderValidatorComponent(): React__default.JSX.Element;
|
|
165
|
+
}
|
|
284
166
|
|
|
285
|
-
export { MuiComponent, MuiForm, MuiPhoneNumber, MuiSelect, MuiTextField };
|
|
167
|
+
export { ValidatorComponent as MuiComponent, ValidatorForm as MuiForm, MuiTelInputDefault as MuiPhoneNumber, MuiSelect, MuiTextField, Validator as MuiValidator };
|