@dynamic-field-kit/react 1.0.1 → 1.0.2
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 +32 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ react >= 17
|
|
|
45
45
|
|
|
46
46
|
The library **does NOT define field types** like:
|
|
47
47
|
```ts
|
|
48
|
-
"text" | "number"
|
|
48
|
+
"text" | "number"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Instead, it exposes an **extendable interface** that applications can augment:
|
|
@@ -65,9 +65,9 @@ This pattern is used by mature libraries like **MUI, React Hook Form,** and **Re
|
|
|
65
65
|
Create a `.d.ts` file in your app (e.g. src/types/dynamic-field.d.ts):
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
|
-
import "@dynamic-field-kit/
|
|
68
|
+
import "@dynamic-field-kit/core"
|
|
69
69
|
|
|
70
|
-
declare module "@dynamic-field-kit/
|
|
70
|
+
declare module "@dynamic-field-kit/core" {
|
|
71
71
|
interface FieldTypeMap {
|
|
72
72
|
text: string
|
|
73
73
|
number: number
|
|
@@ -80,6 +80,19 @@ declare module "@dynamic-field-kit/react" {
|
|
|
80
80
|
|
|
81
81
|
---
|
|
82
82
|
|
|
83
|
+
## FieldRendererProps
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
export interface FieldRendererProps<T = any> {
|
|
87
|
+
value?: T
|
|
88
|
+
onValueChange?: (value: T) => void
|
|
89
|
+
label?: string
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
👉 A common contract for all field renderers
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
83
96
|
### FieldDescription
|
|
84
97
|
|
|
85
98
|
A `FieldDescription` defines **what a field is**, not **how it looks**.
|
|
@@ -102,11 +115,14 @@ const fields: FieldDescription[] = [
|
|
|
102
115
|
]
|
|
103
116
|
```
|
|
104
117
|
|
|
105
|
-
**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
**Common Properties**
|
|
119
|
+
| Property | Description |
|
|
120
|
+
|------|------------|
|
|
121
|
+
| name | Field key in form data |
|
|
122
|
+
| type | Field renderer key |
|
|
123
|
+
| label | UI label |
|
|
124
|
+
| value | Default value |
|
|
125
|
+
| appearCondition | Runtime visibility condition |
|
|
110
126
|
|
|
111
127
|
**Field Registry (Render Layer)**
|
|
112
128
|
The library does **not** ship UI components.
|
|
@@ -254,6 +270,10 @@ Renders a single field with value binding.
|
|
|
254
270
|
onChange={(value, key) => {}}
|
|
255
271
|
/>
|
|
256
272
|
```
|
|
273
|
+
|
|
274
|
+
## Demo
|
|
275
|
+
- [Examples](https://github.com/vannt-dev/dynamic-field-kit-demo)
|
|
276
|
+
|
|
257
277
|
---
|
|
258
278
|
|
|
259
279
|
## 🏗 Architecture
|
|
@@ -273,4 +293,7 @@ This library intentionally does not include:
|
|
|
273
293
|
-Built-in UI components
|
|
274
294
|
-Form state management library
|
|
275
295
|
|
|
276
|
-
It is a **form engine**, not a full form framework.
|
|
296
|
+
It is a **form engine**, not a full form framework.
|
|
297
|
+
|
|
298
|
+
## 📄 License
|
|
299
|
+
MIT © vannt-dev
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-field-kit/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React renderer for dynamic-field-kit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react": ">=17"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@dynamic-field-kit/core": "^1.0.
|
|
17
|
+
"@dynamic-field-kit/core": "^1.0.2"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|