config-driven-form 1.2.0 → 1.3.0
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 +41 -1
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +1433 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1436 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Stop writing thousands of lines of boilerplate form code. Define your data struc
|
|
|
16
16
|
- 🎨 **Beautiful by Default:** Includes a stunning, modern glassmorphic design system out of the box.
|
|
17
17
|
- 🏗️ **Multi-Column Layouts:** Easily build complex 2, 3, or 4-column grid layouts using the `uiSchema`.
|
|
18
18
|
- 🧩 **Rich Field Types:** Natively supports Text, Numbers, Passwords, Dropdowns, Radios, Checkboxes, File Uploads, and a Tiptap Rich Text Editor!
|
|
19
|
+
- 🏗️ **Visual Form Builder:** Includes a powerful, Strapi-like Drag-and-Drop builder to visually construct schemas and UI schemas without writing code!
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -184,6 +185,45 @@ export default function TailwindForm() {
|
|
|
184
185
|
|
|
185
186
|
---
|
|
186
187
|
|
|
188
|
+
## 🏗️ Visual Form Builder (New!)
|
|
189
|
+
|
|
190
|
+
Tired of writing JSON by hand? We've built a world-class, **Drag-and-Drop Visual Form Builder** directly into the library!
|
|
191
|
+
|
|
192
|
+
You can embed this builder into your own admin panels, let users visually construct their forms, set validation rules, pick themes, and then save the output as standard `JSONSchema` to store in your database!
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
import React from 'react';
|
|
196
|
+
import { FormBuilder } from 'config-driven-form';
|
|
197
|
+
import 'config-driven-form/dist/index.css';
|
|
198
|
+
|
|
199
|
+
export default function AdminFormBuilder() {
|
|
200
|
+
return (
|
|
201
|
+
<div style={{ height: '100vh', width: '100vw' }}>
|
|
202
|
+
<FormBuilder
|
|
203
|
+
// Optional: Pass existing schemas to edit them!
|
|
204
|
+
// initialSchema={existingSchema}
|
|
205
|
+
// initialUiSchema={existingUiSchema}
|
|
206
|
+
onSave={(schema, uiSchema, formSettings) => {
|
|
207
|
+
console.log('Generated Schema:', schema);
|
|
208
|
+
console.log('Generated UI Schema:', uiSchema);
|
|
209
|
+
console.log('Global Form Settings:', formSettings);
|
|
210
|
+
|
|
211
|
+
// Save to your database here!
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Builder Features:
|
|
220
|
+
|
|
221
|
+
- **Drag & Drop Canvas:** Powered by `@dnd-kit` for buttery smooth reordering.
|
|
222
|
+
- **Live Preview Mode:** Toggle between Editor and Preview mode to test validation instantly.
|
|
223
|
+
- **Global Theme & Layout Controls:** Let your users pick their brand colors and column layouts visually.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
187
227
|
## 📚 Supported Field Types
|
|
188
228
|
|
|
189
229
|
The library automatically inspects the `type`, `format`, and `enum` properties of your JSON Schema to render the correct UI component:
|
|
@@ -221,4 +261,4 @@ The library automatically inspects the `type`, `format`, and `enum` properties o
|
|
|
221
261
|
|
|
222
262
|
## 🤝 Contributing
|
|
223
263
|
|
|
224
|
-
We welcome contributions! If you want to fix a bug, add a new field type, or improve the documentation, please read our [Developer's Guide (CONTRIBUTING.md)](
|
|
264
|
+
We welcome contributions! If you want to fix a bug, add a new field type, or improve the documentation, please read our [Developer's Guide (CONTRIBUTING.md)](https://github.com/Aaditya-Rana/config-driven-form/blob/main/CONTRIBUTING.md) to get started with your local development environment.
|
package/dist/index.d.mts
CHANGED
|
@@ -71,4 +71,23 @@ interface FieldRendererProps {
|
|
|
71
71
|
}
|
|
72
72
|
declare const FieldRenderer: React.FC<FieldRendererProps>;
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
interface FormSettings {
|
|
75
|
+
columns: 1 | 2 | 3 | 4;
|
|
76
|
+
theme: {
|
|
77
|
+
primary?: string;
|
|
78
|
+
background?: string;
|
|
79
|
+
text?: string;
|
|
80
|
+
error?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface FormBuilderProps {
|
|
85
|
+
initialSchema?: JSONSchema;
|
|
86
|
+
initialUiSchema?: Record<string, UISchema>;
|
|
87
|
+
initialColumns?: 1 | 2 | 3 | 4;
|
|
88
|
+
initialTheme?: FormSettings['theme'];
|
|
89
|
+
onSave?: (schema: JSONSchema, uiSchema: Record<string, UISchema>, formSettings: FormSettings) => void;
|
|
90
|
+
}
|
|
91
|
+
declare const FormBuilder: React.FC<FormBuilderProps>;
|
|
92
|
+
|
|
93
|
+
export { type FieldFormat, FieldRenderer, type FieldType, FormBuilder, type FormClassNames, type JSONSchema, SchemaForm, type UISchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -71,4 +71,23 @@ interface FieldRendererProps {
|
|
|
71
71
|
}
|
|
72
72
|
declare const FieldRenderer: React.FC<FieldRendererProps>;
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
interface FormSettings {
|
|
75
|
+
columns: 1 | 2 | 3 | 4;
|
|
76
|
+
theme: {
|
|
77
|
+
primary?: string;
|
|
78
|
+
background?: string;
|
|
79
|
+
text?: string;
|
|
80
|
+
error?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface FormBuilderProps {
|
|
85
|
+
initialSchema?: JSONSchema;
|
|
86
|
+
initialUiSchema?: Record<string, UISchema>;
|
|
87
|
+
initialColumns?: 1 | 2 | 3 | 4;
|
|
88
|
+
initialTheme?: FormSettings['theme'];
|
|
89
|
+
onSave?: (schema: JSONSchema, uiSchema: Record<string, UISchema>, formSettings: FormSettings) => void;
|
|
90
|
+
}
|
|
91
|
+
declare const FormBuilder: React.FC<FormBuilderProps>;
|
|
92
|
+
|
|
93
|
+
export { type FieldFormat, FieldRenderer, type FieldType, FormBuilder, type FormClassNames, type JSONSchema, SchemaForm, type UISchema };
|