reactaform 1.8.2 → 1.8.4
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.full.md +432 -0
- package/README.md +63 -286
- package/dist/components/renderFields.d.ts +2 -2
- package/dist/reactaform.cjs.js +4 -4
- package/dist/reactaform.es.js +171 -171
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,146 +1,50 @@
|
|
|
1
1
|
# ReactaForm
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build dynamic React forms visually — no JSX, no boilerplate.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
ReactaForm is a schema-driven, extendable form platform for React. Define forms as JSON (or visually), render them at runtime, and scale complex, configurable UIs without rewriting JSX.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Visual Form Builder
|
|
8
|
+
- Forms as data (JSON, not JSX)
|
|
9
|
+
- Fully extendable (components, themes, validation, i18n)
|
|
10
|
+
- TypeScript-first
|
|
11
|
+
- Optimized for large, dynamic forms
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
✨ TypeScript-first
|
|
11
|
-
✨ Themeable & extensible
|
|
12
|
-
✨ Designed for dynamic, backend-driven UIs
|
|
13
|
-
✨ Optimized performance dynamic forms — fast, predictable rendering.
|
|
13
|
+
## Why ReactaForm?
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- https://reactaform.vercel.app
|
|
17
|
-
- **Builder:** https://reactaform.vercel.app/builder
|
|
15
|
+
Most React form libraries are code-first:
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
- Forms are written in JSX
|
|
18
|
+
- Changes require code edits and redeploys
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
ReactaForm is different:
|
|
22
21
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- [Quick Start](#quick-start)
|
|
28
|
-
- [Conditional Logic](#conditional-logic)
|
|
29
|
-
- [Validation and Validators](#validation-and-validators)
|
|
30
|
-
- [Documentation](#documentation)
|
|
31
|
-
- [Roadmap](#roadmap)
|
|
32
|
-
- [Contributing](#contributing)
|
|
33
|
-
- [License](#license)
|
|
22
|
+
- Forms are schema-driven
|
|
23
|
+
- Stored in APIs, databases, or CMSs
|
|
24
|
+
- Editable visually (low-code / no-code)
|
|
25
|
+
- Rendered dynamically at runtime
|
|
34
26
|
|
|
27
|
+
If your forms change often or are backend-owned, ReactaForm fits naturally.
|
|
35
28
|
|
|
36
|
-
##
|
|
29
|
+
## Use Cases
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ReactaForm is built for cases where forms are:
|
|
41
|
-
- Generated from backend data
|
|
42
|
-
- Configurable at runtime
|
|
43
|
-
- Built visually (low-code / no-code)
|
|
44
|
-
- Shared across multiple apps
|
|
45
|
-
- Highly customizable and themeable
|
|
46
|
-
|
|
47
|
-
### Comparison
|
|
48
|
-
|
|
49
|
-
| Feature | React Hook Form | Formik | ReactaForm |
|
|
50
|
-
|------|------|------|------|
|
|
51
|
-
| JSX required | ✔ | ✔ | ❌ |
|
|
52
|
-
| Schema-driven | ❌ | ❌ | ✔ |
|
|
53
|
-
| Runtime dynamic forms | ⚠️ | ⚠️ | ✔ |
|
|
54
|
-
| Visual form builder | ❌ | ❌ | ✔ |
|
|
55
|
-
| Built-in theming | ❌ | ⚠️ | ✔ |
|
|
56
|
-
| Plugin architecture | ❌ | ❌ | ✔ |
|
|
57
|
-
| Backend-driven UI | ❌ | ❌ | ✔ |
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## <a id="reactaform-builder"></a> 🏗 ReactaForm Builder
|
|
62
|
-
|
|
63
|
-
Visual drag-and-drop builder for creating dynamic forms:
|
|
64
|
-
|
|
65
|
-
<img src="./docs/assets/images/builder_ui.jpg" alt="ReactaForm Builder Screenshot" width="900" style="max-width:100%;height:auto;display:block;margin:0.5rem auto;" />
|
|
66
|
-
|
|
67
|
-
## <a id="key-features"></a> ✨ Key Features
|
|
68
|
-
|
|
69
|
-
### 🔧 Core
|
|
70
|
-
- Schema-driven form rendering
|
|
71
|
-
- 20+ built-in field types
|
|
72
|
-
- Automatic state management
|
|
73
|
-
- Full TypeScript support
|
|
74
|
-
|
|
75
|
-
### 🛠 Visual Form Builder
|
|
76
|
-
- Drag-and-drop form creation
|
|
77
|
-
- Live preview
|
|
78
|
-
- Validation & conditional logic
|
|
79
|
-
- Export production-ready JSON schemas
|
|
80
|
-
|
|
81
|
-
👉 https://reactaform.vercel.app/builder
|
|
82
|
-
|
|
83
|
-
### 🎨 Theming
|
|
84
|
-
- CSS-variable-based themes
|
|
85
|
-
- Light & dark modes
|
|
86
|
-
- 20+ built-in themes
|
|
87
|
-
|
|
88
|
-
### 🧠 Logic & Validation
|
|
89
|
-
- Conditional visibility
|
|
90
|
-
- Custom validators
|
|
91
|
-
- Custom submission handlers
|
|
92
|
-
|
|
93
|
-
### 🔌 Extensibility
|
|
94
|
-
- Component registry
|
|
95
|
-
- Plugin system
|
|
96
|
-
- Custom fields and workflows
|
|
97
|
-
|
|
98
|
-
### 🌍 i18n
|
|
99
|
-
- Built-in multi-language support
|
|
100
|
-
- Translation caching
|
|
101
|
-
- Support custom per-form translation dictionaries for user defined translation.
|
|
102
|
-
|
|
103
|
-
### ⚡ Performance & Accessibility
|
|
104
|
-
- Fast initial load via incremental (chunked) mounting.
|
|
105
|
-
- Efficient updates using requestAnimationFrame batching and targeted visibility recomputation.
|
|
106
|
-
- Reduced input overhead with debounced callbacks for expensive handlers.
|
|
107
|
-
- ARIA-compliant by default
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## 👥 Who Is ReactaForm For?
|
|
112
|
-
|
|
113
|
-
- SaaS settings pages
|
|
31
|
+
- SaaS settings & configuration pages
|
|
114
32
|
- Admin dashboards
|
|
115
|
-
- Product configurators
|
|
116
33
|
- CMS-driven forms
|
|
117
|
-
-
|
|
34
|
+
- Product configurators
|
|
35
|
+
- Low-code / no-code platforms
|
|
118
36
|
- Enterprise dynamic UIs
|
|
119
37
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## <a id="installation"></a> 📦 Installation
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
npm install reactaform
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Peer Dependencies**
|
|
129
|
-
- React ^18 || ^19
|
|
130
|
-
- React-DOM ^18 || ^19
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## <a id="quick-start"></a> 🚀 Quick Start
|
|
38
|
+
## Quick example
|
|
135
39
|
|
|
136
40
|
```tsx
|
|
137
41
|
import { ReactaForm } from 'reactaform';
|
|
138
42
|
|
|
139
43
|
const definition = {
|
|
140
|
-
name:
|
|
141
|
-
displayName:
|
|
44
|
+
name: 'contactForm',
|
|
45
|
+
displayName: 'Contact',
|
|
142
46
|
properties: [
|
|
143
|
-
{ name:
|
|
47
|
+
{ name: 'email', type: 'email', required: true }
|
|
144
48
|
]
|
|
145
49
|
};
|
|
146
50
|
|
|
@@ -149,185 +53,58 @@ export default function App() {
|
|
|
149
53
|
}
|
|
150
54
|
```
|
|
151
55
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Dynamically show or hide individual fields or groups based on parent–child rules or group conditions.
|
|
155
|
-
|
|
156
|
-
Parent–child example (schema fragment):
|
|
157
|
-
Parents are defined in the parents field by specifying the parent field name and the corresponding values.
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"properties": [
|
|
162
|
-
{
|
|
163
|
-
"name": "country",
|
|
164
|
-
"displayName": "Country",
|
|
165
|
-
"type": "dropdown",
|
|
166
|
-
"options": [
|
|
167
|
-
{ "label": "United States", "value": "US" },
|
|
168
|
-
{ "label": "Canada", "value": "CA" }
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"name": "state",
|
|
173
|
-
"displayName": "State",
|
|
174
|
-
"type": "dropdown",
|
|
175
|
-
"parents": { "country": ["US"] }
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"name": "province",
|
|
179
|
-
"displayName": "Province",
|
|
180
|
-
"type": "dropdown",
|
|
181
|
-
"parents": { "country": ["CA"] }
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
```
|
|
56
|
+
No JSX fields. No wiring. Just render.
|
|
186
57
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Groups let you treat multiple fields as a unit and control the group's visibility with group name defined in field. Consecutive fields with same group name will be grouped while non consecutive fields with same group name are treated as different groups.
|
|
190
|
-
|
|
191
|
-
Example — `Address` group contains `address1` and `address2`
|
|
192
|
-
|
|
193
|
-
```json
|
|
194
|
-
{
|
|
195
|
-
{
|
|
196
|
-
"type": "text",
|
|
197
|
-
"name": "address1",
|
|
198
|
-
"displayName": "Address Line 1",
|
|
199
|
-
"defaultValue": "",
|
|
200
|
-
"group": "Address"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"type": "text",
|
|
204
|
-
"name": "address2",
|
|
205
|
-
"displayName": "Address Line 2",
|
|
206
|
-
"defaultValue": "",
|
|
207
|
-
"group": "Address"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## <a id="validation-and-validators"></a> 🔒 Validation and Validators
|
|
58
|
+
## Key features
|
|
215
59
|
|
|
216
|
-
|
|
60
|
+
- Schema-driven rendering (JSON, not JSX)
|
|
61
|
+
- Visual drag-and-drop form builder
|
|
62
|
+
- Runtime-configurable forms
|
|
63
|
+
- Conditional logic & grouping
|
|
64
|
+
- Pluggable validation & submission
|
|
65
|
+
- Themeable via CSS variables
|
|
66
|
+
- Built-in i18n
|
|
67
|
+
- High-performance rendering
|
|
68
|
+
- ARIA-compliant by default
|
|
217
69
|
|
|
218
|
-
|
|
219
|
-
- Form-level: cross-field validation performed during submission.
|
|
70
|
+
## Extensible by design
|
|
220
71
|
|
|
221
|
-
|
|
72
|
+
ReactaForm is a platform, not just a renderer. You can extend:
|
|
222
73
|
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
74
|
+
- Field components
|
|
75
|
+
- Validation logic (field, form, type)
|
|
76
|
+
- Submission workflows
|
|
77
|
+
- Themes & design systems
|
|
78
|
+
- Languages & translations
|
|
79
|
+
- Custom field types & metadata
|
|
226
80
|
|
|
227
|
-
|
|
81
|
+
No forks. No hacks.
|
|
228
82
|
|
|
229
|
-
|
|
230
|
-
- Form custom validator — register a handler for cross-field logic (runs during submission).
|
|
231
|
-
- Field type validator — define validation for a custom field/component type.
|
|
232
|
-
---
|
|
83
|
+
## How it compares
|
|
233
84
|
|
|
234
|
-
|
|
235
|
-
|
|
85
|
+
- Formik / React Hook Form → code-first, JSX-based
|
|
86
|
+
- ReactaForm → schema-first, runtime-driven
|
|
236
87
|
|
|
237
|
-
|
|
88
|
+
ReactaForm doesn’t replace form state libraries — it replaces hand-coding forms when forms are dynamic.
|
|
238
89
|
|
|
239
|
-
|
|
90
|
+
## Installation
|
|
240
91
|
|
|
241
|
-
|
|
92
|
+
```bash
|
|
93
|
+
npm install reactaform
|
|
94
|
+
```
|
|
242
95
|
|
|
243
|
-
|
|
244
|
-
import { registerSubmissionHandler } from 'reactaform';
|
|
96
|
+
### Peer dependencies
|
|
245
97
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const res = await fetch('/api/save', { method: 'POST', body: JSON.stringify(valuesMap), headers: { 'Content-Type': 'application/json' } });
|
|
249
|
-
if (!res.ok) return [t('Server error while submitting form')];
|
|
250
|
-
return undefined; // returning undefined (or falsy) means success
|
|
251
|
-
});
|
|
252
|
-
```
|
|
98
|
+
- React ^18 || ^19
|
|
99
|
+
- React DOM ^18 || ^19
|
|
253
100
|
|
|
254
|
-
|
|
101
|
+
## Learn more
|
|
255
102
|
|
|
256
|
-
|
|
103
|
+
- [Full README](README.full.md)
|
|
104
|
+
- [Documentation](https://reactaform.vercel.app/docs)
|
|
105
|
+
- [ReactaForm Website (Demos)](https://reactaform.vercel.app)
|
|
106
|
+
- [Visual Builder](https://reactaform.vercel.app/builder)
|
|
257
107
|
|
|
258
|
-
|
|
259
|
-
{
|
|
260
|
-
"name": "contactForm",
|
|
261
|
-
"version": "1.0",
|
|
262
|
-
"displayName": "Contact",
|
|
263
|
-
"submitHandlerName": "api:saveForm",
|
|
264
|
-
"properties": [ /* ... */ ]
|
|
265
|
-
}
|
|
266
|
-
```
|
|
108
|
+
## License
|
|
267
109
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
👉 https://reactaform.vercel.app/docs
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## <a id="roadmap"></a> 🗺️ Roadmap
|
|
275
|
-
|
|
276
|
-
### Core & Standards
|
|
277
|
-
- [ ] Accessibility certification (WCAG 2.2 AA)
|
|
278
|
-
- [ ] Performance & accessibility audit tooling
|
|
279
|
-
- [ ] Schema versioning & migration tools
|
|
280
|
-
|
|
281
|
-
### Conditional Logic
|
|
282
|
-
- [x] Parent–child conditional visibility (current)
|
|
283
|
-
- [x] Field grouping (current)
|
|
284
|
-
- [ ] Advanced conditional logic engine
|
|
285
|
-
- [ ] Logical operators (AND / OR / NOT)
|
|
286
|
-
- [ ] Multi-field conditions
|
|
287
|
-
- [ ] Expression-based rules
|
|
288
|
-
- [ ] Nested condition groups
|
|
289
|
-
- [ ] Layout enhancement
|
|
290
|
-
- [ ] Tabbed forms (planned)
|
|
291
|
-
- [ ] Navigation sections (planned)
|
|
292
|
-
- [ ] Multi-step forms
|
|
293
|
-
|
|
294
|
-
### Visual Builders
|
|
295
|
-
- [ ] Enhanced visual form builder
|
|
296
|
-
- [ ]Advanced conditional logic editor
|
|
297
|
-
- [ ]Validation rule designer
|
|
298
|
-
- [ ] **Theme Builder (Visual)**
|
|
299
|
-
- [ ]Visual CSS-variable editor
|
|
300
|
-
- [ ]Live preview across field types
|
|
301
|
-
- [ ]Light / dark theme generation
|
|
302
|
-
- [ ]Exportable, versioned theme packages
|
|
303
|
-
- [ ]Tailwind-compatible themes
|
|
304
|
-
- [ ] **Plugin Builder**
|
|
305
|
-
- [ ] Scaffold custom field components
|
|
306
|
-
- [ ] Scaffold validators & submission handlers
|
|
307
|
-
- [ ] Plugin metadata & versioning
|
|
308
|
-
- [ ] One-click plugin export
|
|
309
|
-
|
|
310
|
-
### Ecosystem
|
|
311
|
-
- [ ] Definition templates (community-driven)
|
|
312
|
-
- [ ] Plugin marketplace (community-driven)
|
|
313
|
-
- [ ] Theme sharing & presets gallery
|
|
314
|
-
- [ ] Official plugin & theme collections
|
|
315
|
-
|
|
316
|
-
### Enterprise
|
|
317
|
-
- [ ] Form analytics & submission insights
|
|
318
|
-
- [ ] Role-based builder permissions
|
|
319
|
-
- [ ] Hosted schema & asset management
|
|
320
|
-
- [ ] Enterprise integrations
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
## <a id="contributing"></a> 🤝 Contributing
|
|
325
|
-
|
|
326
|
-
Contributions are welcome!
|
|
327
|
-
Open an issue or submit a pull request.
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## <a id="license"></a> 📄 License
|
|
332
|
-
|
|
333
|
-
MIT
|
|
110
|
+
MIT
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../core/reactaFormTypes";
|
|
2
|
-
export declare const renderFields: (fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, handleChange: (fieldName: string, value: FieldValueType
|
|
3
|
-
export declare const renderFieldsWithGroups: (groupState: Record<string, boolean>, fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, t: (key: string) => string, handleChange: (fieldName: string, value: FieldValueType
|
|
2
|
+
export declare const renderFields: (fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, handleChange: (fieldName: string, value: FieldValueType) => void, visibility: Record<string, boolean>, loadedCount: number, handleError?: (fieldName: string, error: ErrorType) => void, errorsMap?: Record<string, string>) => (import("react/jsx-runtime").JSX.Element | null)[];
|
|
3
|
+
export declare const renderFieldsWithGroups: (groupState: Record<string, boolean>, fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, t: (key: string) => string, handleChange: (fieldName: string, value: FieldValueType) => void, handleError: (fieldName: string, error: ErrorType) => void, visibility: Record<string, boolean>, loadedCount: number, toggleGroup: (groupName: string) => void, errors?: Record<string, string>) => JSX.Element[];
|