calidation
Advanced tools
@@ -168,2 +168,3 @@ (function (global, factory) { | ||
| fields = _props2.fields, | ||
| isValid = _props2.isValid, | ||
| resetAll = _props2.resetAll, | ||
@@ -179,2 +180,3 @@ setError = _props2.setError, | ||
| fields: fields, | ||
| isValid: isValid, | ||
| resetAll: resetAll, | ||
@@ -202,5 +204,6 @@ setError: setError, | ||
| // FormContext | ||
| dirty: (0, _propTypes.shape)({}), | ||
| errors: (0, _propTypes.shape)({}), | ||
| fields: (0, _propTypes.shape)({}), | ||
| dirty: (0, _propTypes.shape)({}).isRequired, | ||
| errors: (0, _propTypes.shape)({}).isRequired, | ||
| fields: (0, _propTypes.shape)({}).isRequired, | ||
| isValid: _propTypes.bool.isRequired, | ||
| register: _propTypes.func.isRequired, | ||
@@ -211,3 +214,3 @@ resetAll: _propTypes.func.isRequired, | ||
| submit: _propTypes.func.isRequired, | ||
| submitted: _propTypes.bool, | ||
| submitted: _propTypes.bool.isRequired, | ||
| unregister: _propTypes.func.isRequired | ||
@@ -214,0 +217,0 @@ }); |
+1
-1
| { | ||
| "name": "calidation", | ||
| "version": "1.15.0", | ||
| "version": "1.15.1", | ||
| "description": "A red hot validation library for React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+21
-44
@@ -404,2 +404,20 @@ # calidation | ||
| #### Context | ||
| The `FormContext` object represents the core internal state of the form and is passed through event callbacks and into template functions. | ||
| ```js | ||
| { | ||
| dirty: object, // Object with all fields isDirty state, keyed per field | ||
| errors: object, // Object with all error messages, keyed per field | ||
| fields: object, // Object with all field inputs, keyed per field | ||
| isValid: bool, // Boolean indicating whether your form is valid or not | ||
| resetAll: func, // call this to programmatically trigger a full state reset | ||
| setError: func, // callback accepting a diff object, updating errors like setState | ||
| setField: func, // callback accepting a diff object, updating fields like setState | ||
| submit: func, // call this to programmatically trigger a submitted state | ||
| submitted: bool, // flag showing whether the form has been submitted once or not | ||
| } | ||
| ``` | ||
| ### `Form` | ||
@@ -434,18 +452,4 @@ | ||
| The `onSubmit` function is called with an object with the following props: | ||
| The `onSubmit` function is called with the `FormContext` object as its only prop. | ||
| ```js | ||
| { | ||
| dirty: object, // Object with all fields isDirty state, keyed per field | ||
| errors: object, // Object with all error messages, keyed per field | ||
| fields: object, // Object with all field inputs, keyed per field | ||
| isValid: bool, // Boolean indicating whether your form is valid or not | ||
| resetAll: func, // call this to programmatically trigger a full state reset | ||
| setError: func, // callback accepting a diff object, updating errors like setState | ||
| setField: func, // callback accepting a diff object, updating fields like setState | ||
| submit: func, // call this to programmatically trigger a submitted state | ||
| submitted: bool, // flag showing whether the form has been submitted once or not | ||
| } | ||
| ``` | ||
| ##### `onUpdate: func` | ||
@@ -457,18 +461,4 @@ | ||
| The `onUpdate` function is called with an object with the follow props: | ||
| The `onUpdate` function is called with the `FormContext` object as its only prop. | ||
| ```js | ||
| { | ||
| dirty: object, // Object with all fields isDirty state, keyed per field | ||
| errors: object, // Object with all error messages, keyed per field | ||
| fields: object, // Object with all field inputs, keyed per field | ||
| isValid: bool, // Boolean indicating whether your form is valid or not | ||
| resetAll: func, // call this to programmatically trigger a full state reset | ||
| setError: func, // callback accepting a diff object, updating errors like setState | ||
| setField: func, // callback accepting a diff object, updating fields like setState | ||
| submit: func, // call this to programmatically trigger a submitted state | ||
| submitted: bool, // flag showing whether the form has been submitted once or not | ||
| } | ||
| ``` | ||
| ### `Validation` | ||
@@ -485,17 +475,4 @@ | ||
| The `children` function is called with an object with the following props: | ||
| The `children` function is called with the `FormContext` object as its only prop. | ||
| ```js | ||
| { | ||
| dirty: object, // Object with all fields isDirty state, keyed per field | ||
| errors: object, // object with the same keys as `fields`, but with error messages | ||
| fields: object, // object with the form field values, to make controlled components | ||
| resetAll: func, // call this to programmatically trigger a full state reset | ||
| setError: func, // callback accepting a diff object, updating errors like setState | ||
| setField: func, // callback accepting a diff object, updating fields like setState | ||
| submit: func, // call this to programmatically trigger a submitted state | ||
| submitted: bool, // flag showing whether the form has been submitted once or not | ||
| } | ||
| ``` | ||
| ##### `config: object.isRequired` | ||
@@ -502,0 +479,0 @@ |
935
0.32%56025
-1.84%544
-4.06%