@os-design/form 1.0.21 → 1.0.23
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 +11 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,6 +47,17 @@ const Form: React.FC = () => {
|
|
|
47
47
|
|
|
48
48
|
The `props` is an object that contains 2 properties: `value` and `onChange`, so you can just pass all the properties of this object to your input component for simplicity.
|
|
49
49
|
|
|
50
|
+
⚠️ The type of `onChange` callback is `(value: T) => void`. If your input component has another type, you should pass this callback manually. For example, the `onChange` callback in the native input component has the type `(e: ChangeEvent<HTMLInputElement>) => void` (Ant Design's input component has the same type).
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<Field
|
|
54
|
+
name='title'
|
|
55
|
+
render={({ value, onChange }) => (
|
|
56
|
+
<Input value={value} onChange={(e) => onChange(e.target.value)} />
|
|
57
|
+
)}
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
50
61
|
## 🙉 Complex form
|
|
51
62
|
|
|
52
63
|
Let's look at another example. We need to add multiple fields with options to the form (e.g. `min` and `max`). These options should be stored in the `options` form property.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design/form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@os-design/core": "^1.0.
|
|
31
|
+
"@os-design/core": "^1.0.194",
|
|
32
32
|
"@os-design/icons": "^1.0.46"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "873d6653d3784b53dca629e44d71d68ded6acb74"
|
|
38
38
|
}
|