Skip to content

Commit c21d155

Browse files
committed
Merge branch 'hotfix/doc-revisions' into develop
2 parents 0cbf133 + abbe8a2 commit c21d155

File tree

3 files changed

+66
-63
lines changed

3 files changed

+66
-63
lines changed

README.md

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ In modern JavaScript development bundle size is always a concern - currently for
1717

1818
## Contents
1919

20-
* [Examples](#examples)
21-
* [Installation](#installation)
22-
* [Usage](#usage)
23-
* [Form](#form)
24-
* [Field](#field)
25-
* [Validation](#validation)
26-
* [Built-In Validators](#built-in-validators)
27-
* [Custom Errors](#custom-validation-errors)
28-
* [Combining Validators](#combining-validators)
29-
* [Covalidating Fields](#covalidated-fields)
30-
* [Custom Validators](#writing-your-own-validators)
31-
* [Internationalization](#internationalization)
32-
* [State Management](#state-management)
20+
* [Examples](#examples)
21+
* [Installation](#installation)
22+
* [Usage](#usage)
23+
* [Form](#form)
24+
* [Field](#field)
25+
* [Validation](#validation)
26+
* [Built-In Validators](#built-in-validators)
27+
* [Custom Errors](#custom-validation-errors)
28+
* [Combining Validators](#combining-validators)
29+
* [Covalidating Fields](#covalidated-fields)
30+
* [Custom Validators](#writing-your-own-validators)
31+
* [Internationalization](#internationalization)
32+
* [State Management](#state-management)
3333

3434
## Examples
3535

@@ -160,58 +160,58 @@ export const YourApp = () => (
160160

161161
The `Form` component will accept the following props:
162162

163-
* name (string, required) - The name of the form.
164-
* render (component/function, required) - Function/functional component that will render the form - passed InjectedFormProps as below
165-
* renderProps (object, optional) - Custom props to pass to the render component
166-
* validators (object, optional) - Form validation object - see validation
167-
* initialValues (object, optional) - Initial form values in the form `{ [fieldName]: value }`
168-
* onSubmit (function, optional) - Called on form submission with form values. Should return void or Promise<void>
169-
* onSubmitFailed (function, optional) - Called when submission fails due to validation errors, with form values. Should return void or Promise<void>
170-
* onChange (function, optional) - Called when any form value changes, with all form values
163+
* name (string, required) - The name of the form.
164+
* render (component/function, required) - Function/functional component that will render the form - passed InjectedFormProps as below
165+
* renderProps (object, optional) - Custom props to pass to the render component
166+
* validators (object, optional) - Form validation object - see validation
167+
* initialValues (object, optional) - Initial form values in the form `{ [fieldName]: value }`
168+
* onSubmit (function, optional) - Called on form submission with form values. Should return void or Promise<void>
169+
* onSubmitFailed (function, optional) - Called when submission fails due to validation errors, with form values. Should return void or Promise<void>
170+
* onChange (function, optional) - Called when any form value changes, with all form values
171171

172172
The render component you provide will receive the following props:
173173

174-
* Field (Component) - A component to create fields
175-
* form (object) - Props that must be passed to a <form> element
176-
* values (object) - Current form values
177-
* meta (object)
178-
* valid (boolean) - Is validation currently passing
179-
* submitted (boolean) - Has the form been submitted at any time
180-
* errors: (object) - Current errors for the form, { [fieldName]: { error: string }}
181-
* isValidating (boolean) - Is validation currently ongoing
182-
* isSubmitting (boolean) - Is submission currently ongoing
183-
* actions (object)
184-
* reset (function) - Call to reset the form to initial values and clear validation errors
185-
* submit: (function) - Call to submit the form
186-
* ownProps (object) - Any additional props passed via `renderProps` above
174+
* Field (Component) - A component to create fields
175+
* form (object) - Props that must be passed to a <form> element
176+
* values (object) - Current form values
177+
* meta (object)
178+
* valid (boolean) - Is validation currently passing
179+
* submitted (boolean) - Has the form been submitted at any time
180+
* errors: (object) - Current errors for the form, { [fieldName]: { error: string }}
181+
* isValidating (boolean) - Is validation currently ongoing
182+
* isSubmitting (boolean) - Is submission currently ongoing
183+
* actions (object)
184+
* reset (function) - Call to reset the form to initial values and clear validation errors
185+
* submit: (function) - Call to submit the form
186+
* ownProps (object) - Any additional props passed via `renderProps` above
187187

188188
### Field
189189

190190
The `Field` component (as provided to the `Form` renderer), can be passed the following props:
191191

192-
* name (string, required) - The field name
193-
* render (component/function, required) - Field renderer - passed InjectedFieldProps as below
194-
* renderProps (object, optional) - Custom props to pass to the field renderer
195-
* onChange (function, optional) - Called with the change event, and the field value, whenever the field value changes I.e. (e: SyntheticEvent, value: string | number | undefined) => void
196-
* onFocus (function, optional) - Called with the focus event, and the field value, whenever the field value is focused
197-
* onBlur (function, optional) - Called with the blur event, and the field value, whenever the field value is blurred
192+
* name (string, required) - The field name
193+
* render (component/function, required) - Field renderer - passed InjectedFieldProps as below
194+
* renderProps (object, optional) - Custom props to pass to the field renderer
195+
* onChange (function, optional) - Called with the change event, and the field value, whenever the field value changes I.e. (e: SyntheticEvent, value: string | number | undefined) => void
196+
* onFocus (function, optional) - Called with the focus event, and the field value, whenever the field value is focused
197+
* onBlur (function, optional) - Called with the blur event, and the field value, whenever the field value is blurred
198198

199199
The render component passed to `Field` is provided with the following props. The input prop should generally be passed directly to the underlying <input> element, i.e. <input {...input} />
200200

201-
* meta (object)
202-
* valid (boolean) - Does the field pass validation
203-
* error (string | undefined) - Current validation error
204-
* pristine (boolean) - True if the field has the same value as its initial value
205-
* touched (boolean) - Has the field has ever been focused
206-
* active (boolean) - Is the field currently focused
207-
* isValidating (boolean) - Is the field currently being validated
208-
* input (object)
209-
* onChange (function) - Called with (event, value) when the field value changes
210-
* onFocus (function) - Called with (event, value) when the field is focused
211-
* onBlur (function) - Called with (event, value) when the field is blurred
212-
* value (string | number | undefined) - Current field value
213-
* name (string) - Name of the field
214-
* ownProps - Any custom props passed to `Field`s `renderProps`
201+
* meta (object)
202+
* valid (boolean) - Does the field pass validation
203+
* error (string | undefined) - Current validation error
204+
* pristine (boolean) - True if the field has the same value as its initial value
205+
* touched (boolean) - Has the field has ever been focused
206+
* active (boolean) - Is the field currently focused
207+
* isValidating (boolean) - Is the field currently being validated
208+
* input (object)
209+
* onChange (function) - Called with (event, value) when the field value changes
210+
* onFocus (function) - Called with (event, value) when the field is focused
211+
* onBlur (function) - Called with (event, value) when the field is blurred
212+
* value (string | number | undefined) - Current field value
213+
* name (string) - Name of the field
214+
* ownProps - Any custom props passed to `Field`s `renderProps`
215215

216216
### Validation
217217

@@ -239,13 +239,13 @@ import { Form, validation } from "form-and-function";
239239

240240
If this looks long-winded then say hello to some built in validators! Currently we provide the following:
241241

242-
* `validation.required` - Is the value defined, with a length of > 0 when converted to a string
243-
* `validation.atLeast` - Is the value at least some length.
244-
* `validation.atMost` - Is the value at most some length.
245-
* `validation.numeric` - Is the value numeric only.
246-
* `validation.equalTo` - Does the value match that of another field
247-
* `validation.exactly` - Is the value exactly equal ( === ) to a specified value
248-
* `validation.matches` - Does the value match a specified regular expression
242+
* `validation.required` - Is the value defined, with a length of > 0 when converted to a string
243+
* `validation.atLeast` - Is the value at least some length.
244+
* `validation.atMost` - Is the value at most some length.
245+
* `validation.numeric` - Is the value numeric only.
246+
* `validation.equalTo` - Does the value match that of another field
247+
* `validation.exactly` - Is the value exactly equal ( === ) to a specified value
248+
* `validation.matches` - Does the value match a specified regular expression
249249

250250
They can be used as follows:
251251

@@ -357,7 +357,7 @@ As an example, we might want to check if a field is numeric AND more than 5 char
357357

358358
```js
359359
<Form
360-
validators={validation.all({
360+
validators={validation.create({
361361
longNumber: validation.all([
362362
validation.atLeast(
363363
{ chars: 3 },
@@ -384,7 +384,7 @@ an array of strings, and should return a string.
384384

385385
```js
386386
<Form
387-
validators={validation.all({
387+
validators={validation.create({
388388
longNumber: validation.all([
389389
validation.atLeast({ chars: 3 }, {
390390
short: ({ chars }) => `${chars} characters minimum`,

docs/static/js/main.78760357.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/main.78760357.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)