form-builder-pro 0.0.1
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 +118 -0
- package/dist/index.css +1204 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +107 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.js +1154 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1125 -0
- package/dist/index.mjs.map +1 -0
- package/dist/web-components.d.mts +3 -0
- package/dist/web-components.d.ts +3 -0
- package/dist/web-components.js +1139 -0
- package/dist/web-components.js.map +1 -0
- package/dist/web-components.mjs +1114 -0
- package/dist/web-components.mjs.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Form Builder Pro
|
|
2
|
+
|
|
3
|
+
A production-grade, reusable Drag & Drop Form Builder for React.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🏗 **Drag & Drop Builder**: Intuitive interface to build forms.
|
|
8
|
+
- 🧩 **Modular Architecture**: Separate Builder and Renderer components.
|
|
9
|
+
- 📱 **Responsive Grid**: 4-column grid system with configurable field widths (25%, 50%, 100%).
|
|
10
|
+
- ⚡ **Performance**: Built with Vite and optimized for speed.
|
|
11
|
+
- 🎨 **Customizable**: Built with TailwindCSS, easy to theme.
|
|
12
|
+
- 🛡 **Type Safe**: Written in TypeScript with Zod validation.
|
|
13
|
+
- 💾 **State Management**: Zustand store with Undo/Redo support.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install form-builder-pro
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Form Builder
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { FormBuilder } from 'form-builder-pro';
|
|
27
|
+
import 'form-builder-pro/dist/index.css';
|
|
28
|
+
|
|
29
|
+
function App() {
|
|
30
|
+
return (
|
|
31
|
+
<div className="h-screen">
|
|
32
|
+
<FormBuilder />
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Form Renderer
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { FormRenderer, FormSchema } from 'form-builder-pro';
|
|
42
|
+
import 'form-builder-pro/dist/index.css';
|
|
43
|
+
|
|
44
|
+
const schema: FormSchema = {
|
|
45
|
+
// ... your schema
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function App() {
|
|
49
|
+
const handleSubmit = (data: any) => {
|
|
50
|
+
console.log(data);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<FormRenderer
|
|
55
|
+
schema={schema}
|
|
56
|
+
onSubmit={handleSubmit}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Angular / Vanilla JS (Web Components)
|
|
63
|
+
|
|
64
|
+
This package exports standard Web Components that can be used in any framework.
|
|
65
|
+
|
|
66
|
+
1. **Import the registration function** in your app's entry point (e.g., `main.ts` in Angular):
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { registerWebComponents } from 'form-builder-pro';
|
|
70
|
+
import 'form-builder-pro/dist/index.css';
|
|
71
|
+
|
|
72
|
+
registerWebComponents();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. **Use in HTML/Template**:
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<!-- Builder -->
|
|
79
|
+
<form-builder-pro></form-builder-pro>
|
|
80
|
+
|
|
81
|
+
<!-- Renderer -->
|
|
82
|
+
<form-renderer-pro id="my-renderer"></form-renderer-pro>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
3. **Pass complex data via JavaScript**:
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
const renderer = document.getElementById('my-renderer');
|
|
89
|
+
renderer.schema = { ... }; // Pass your schema object
|
|
90
|
+
renderer.onSubmit = (data) => console.log(data);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
1. Clone the repository
|
|
96
|
+
2. Install dependencies:
|
|
97
|
+
```bash
|
|
98
|
+
npm install
|
|
99
|
+
```
|
|
100
|
+
3. Run the development server:
|
|
101
|
+
```bash
|
|
102
|
+
npm run dev
|
|
103
|
+
```
|
|
104
|
+
4. Run tests:
|
|
105
|
+
```bash
|
|
106
|
+
npm test
|
|
107
|
+
```
|
|
108
|
+
5. Build for production:
|
|
109
|
+
```bash
|
|
110
|
+
npm run build
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
|
116
|
+
# form-builder
|
|
117
|
+
# form-builder
|
|
118
|
+
# form-builder
|