@coxy/react-validator 2.0.0 → 2.0.1
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/CHANGELOG.md +6 -0
- package/README.md +15 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ See more examples [here](example/example.jsx)
|
|
|
24
24
|
|
|
25
25
|
```jsx
|
|
26
26
|
import React, { useState } from 'react';
|
|
27
|
-
import ValidatorWrapper,
|
|
27
|
+
import { ValidatorWrapper, rules, ValidatorField } from '@coxy/react-validator';
|
|
28
28
|
|
|
29
29
|
const validator = React.createRef();
|
|
30
30
|
|
|
@@ -105,21 +105,20 @@ This component has a default set of rules that you can use right away:
|
|
|
105
105
|
|
|
106
106
|
#### ValidatorWrapper props
|
|
107
107
|
|
|
108
|
-
**name** | **default** | **required** | **description**
|
|
109
|
-
|
|
110
|
-
ref | null | no | React\.ref or useRef
|
|
111
|
-
stopAtFirstError | false | no | The validator will stop checking after the first error
|
|
112
|
-
|
|
108
|
+
| **name** | **default** | **required** | **description** |
|
|
109
|
+
|------------------|-------------|--------------|--------------------------------------------------------|
|
|
110
|
+
| ref | null | no | React\.ref or useRef |
|
|
111
|
+
| stopAtFirstError | false | no | The validator will stop checking after the first error |
|
|
113
112
|
|
|
114
113
|
|
|
115
114
|
#### ValidatorField props
|
|
116
115
|
|
|
117
|
-
****name**** | ****default**** | ****required**** | **description**
|
|
118
|
-
|
|
119
|
-
value | undefined | yes | Value for validation
|
|
120
|
-
rules | \[\] | yes | Array of rules for validation
|
|
121
|
-
required | true | no | The field will be required
|
|
122
|
-
id | null | no | ID for get field
|
|
116
|
+
| ****name**** | ****default**** | ****required**** | **description** |
|
|
117
|
+
|--------------|-----------------|------------------|-------------------------------|
|
|
118
|
+
| value | undefined | yes | Value for validation |
|
|
119
|
+
| rules | \[\] | yes | Array of rules for validation |
|
|
120
|
+
| required | true | no | The field will be required |
|
|
121
|
+
| id | null | no | ID for get field |
|
|
123
122
|
|
|
124
123
|
|
|
125
124
|
# React api useValidator
|
|
@@ -136,9 +135,10 @@ console.log(isValid, errors) // false
|
|
|
136
135
|
|
|
137
136
|
#### Validator constructor parameters
|
|
138
137
|
|
|
139
|
-
**name** | **default** | **required** | **description**
|
|
140
|
-
|
|
141
|
-
stopAtFirstError | false | no | The validator will stop checking after the first error
|
|
138
|
+
| **name** | **default** | **required** | **description** |
|
|
139
|
+
|------------------|-------------|--------------|--------------------------------------------------------|
|
|
140
|
+
| stopAtFirstError | false | no | The validator will stop checking after the first error |
|
|
141
|
+
|
|
142
142
|
|
|
143
143
|
#### Validator.addField()
|
|
144
144
|
|