Skip to content

Commit aa50c53

Browse files
committed
PR review fixes
1 parent 2f004f3 commit aa50c53

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

packages/react-renderer-demo/src/app/pages/renderer/component-api.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ There is very short list of that can be applied to every form field
2020
|component|string|Component identifier from componentMapper. Rendered component is chosen by this value|
2121
|hideField|boolean|Equivalent to html attribute `hidden`. Hides the field but it remains in DOM. Note that the field is still impacted by the form state. Validation will still apply on hidden field but the error message will not be displayed.|
2222

23-
Each mapper provided in `react-forms` provides a default API for standard components. Standard components are:
23+
Each mapper provided in `react-forms` provides a default API for standard components. If you want to keep compatibility between our mappers and custom ones, please follow these APIs. Otherwise, it is up to you, which props you choose.
24+
25+
Standard components are:
2426
<br />
2527

2628
Wrapped in formGroup: <br/>

packages/react-renderer-demo/src/app/pages/renderer/field-provider.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,19 @@ Next example shows simple input field with label and error message.
2727

2828
```jsx
2929
import React from 'react';
30-
import { FieldProvider } from '@data-driven-forms/react-form-renderer'
31-
32-
const NewComponent = ({ name, ...rest }) => (
33-
<div>
34-
<FieldProvider {...rest} name={name}>
35-
{({ input, meta, ...props }) => {
36-
return (
37-
<div>
38-
<label>{props.label}</label>
39-
<input {...input} />
40-
{meta.error && <label>{meta.error}</label>}
41-
</div>
42-
)
43-
}}
44-
</FieldProvider>
45-
</div>
46-
)
30+
import { useFieldApi } from '@data-driven-forms/react-form-renderer'
31+
32+
const NewComponent = (props) => {
33+
const { input, meta } = useFieldApi(props);
34+
35+
return (
36+
<div>
37+
<label>{props.label}</label>
38+
<input {...input} />
39+
{meta.error && <label>{meta.error}</label>}
40+
</div>
41+
)
42+
}
4743

4844
export default NewComponent
4945
```

packages/react-renderer-demo/src/app/pages/renderer/form-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ListOfContents from '../../src/helpers/list-of-contents';
1010

1111
# FormTemplate
1212

13-
FormTemplate component allows you to fully customize the form. FormTemplate receives only two props:
13+
FormTemplate component allows you to fully customize the form layout. FormTemplate receives only two props:
1414

1515
|Prop|Description|
1616
|----|-----------|

packages/react-renderer-demo/src/app/pages/renderer/get-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import RawComponent from '@docs/raw-component';
1212
Data Driven Forms converts JSON form definitions into fully functional React forms.
1313
It uses [React Final Form](https://github.com/final-form/react-final-form) for the form state management.
1414
It is highly recommended to check their documentations first to fully understand how
15-
the [Data Driven Dorms](https://github.com/data-driven-forms/react-forms) libraries work.
15+
the [Data Driven Forms](https://github.com/data-driven-forms/react-forms) libraries work.
1616

1717
<RawComponent source="get-started/get-started" />
1818

packages/react-renderer-demo/src/app/pages/renderer/migration-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Thank you for your understanding.
3434
### Form Template
3535

3636
- layoutMapper removed - instead of it use FormTemplate
37-
- All props related to form buttons are now removed, use them in you FormTemplate
37+
- All props related to form buttons are now removed, use them in your FormTemplate
3838
- showFormControls
3939
- buttonOrder
4040
- disableSubmit
@@ -111,7 +111,7 @@ import { FieldArray } from '@data-driven-forms/react-form-renderer';
111111
112112
### FieldProvider changed
113113
114-
- FieldProvider is no longer wrapping basic components and you cannot access him through props, instead of it use hook:
114+
- FieldProvider is no longer wrapping basic components and you cannot access it through props, instead of it use hook:
115115
116116
```jsx
117117
import { useFieldApi } from '@data-driven-forms/react-form-renderer';

packages/react-renderer-demo/src/app/pages/renderer/validators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Validator inputs and results are being cached so you will get immediate feedback
5858
If you do not want to trigger the async validator after every stroke, you can use a debounce promise [library](https://github.com/slorber/awesome-debounce-promise)
5959
(or any other implementation of debouncing.)
6060

61-
# validatorMapper
61+
# Custom validator mapper
6262

6363
If you need to expand default Data Driven Forms validator types, you can use <RouterLink href="/renderer/renderer-api#optionalprops"><Link href="/renderer/renderer-api#optionalprops">validatorMapper</Link></RouterLink>.
6464

packages/react-renderer-demo/src/app/src/doc-components/component-mapper/form-fields-mapper.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ const ComponentMapper = () => {
9393
label: 'Your password',
9494
type: 'password'
9595
}
96-
],
97-
title: 'Custom form fields mapper and layout mapper',
98-
description: 'If you want to see the source code, please expand the code example.'
96+
]
9997
};
10098
return (
10199
<div>

0 commit comments

Comments
 (0)