@trusty_abhishek/form-builder 1.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.
@@ -0,0 +1,175 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const FormBuilderContent: () => react_jsx_runtime.JSX.Element;
4
+
5
+ declare const CanvasPanel: () => react_jsx_runtime.JSX.Element;
6
+
7
+ declare const ToolboxPanel: () => react_jsx_runtime.JSX.Element;
8
+
9
+ declare const SettingsPanel: () => react_jsx_runtime.JSX.Element;
10
+
11
+ interface ApiDataSource {
12
+ type: 'static' | 'api' | 'dependency';
13
+ endpoint?: string;
14
+ method?: 'GET' | 'POST';
15
+ headers?: Record<string, string>;
16
+ responsePath?: string;
17
+ labelKey?: string;
18
+ valueKey?: string;
19
+ staticData?: FieldOption[];
20
+ dependsOn?: string | string[];
21
+ dependencyEndpoint?: string;
22
+ dependencyParam?: string;
23
+ dependencyValueKey?: string;
24
+ }
25
+ interface ButtonApiConfig {
26
+ enabled?: boolean;
27
+ url?: string;
28
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
29
+ headers?: Record<string, string>;
30
+ bodyTemplate?: string;
31
+ successMessage?: string;
32
+ errorMessage?: string;
33
+ }
34
+ interface FieldValidation {
35
+ required?: boolean;
36
+ disabled?: boolean;
37
+ readOnly?: boolean;
38
+ minLength?: number;
39
+ maxLength?: number;
40
+ min?: number;
41
+ max?: number;
42
+ pattern?: string;
43
+ patternMessage?: string;
44
+ }
45
+ interface CustomCSS {
46
+ container?: string;
47
+ label?: string;
48
+ input?: string;
49
+ helpText?: string;
50
+ error?: string;
51
+ wrapper?: string;
52
+ }
53
+ type FieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'switch' | 'date' | 'time' | 'datetime-local' | "multidate" | 'file' | 'image' | 'range' | 'color' | 'hidden' | 'label' | 'heading' | 'divider' | 'button' | 'otp' | 'captcha' | 'country' | 'state' | 'city' | 'program' | "scheme" | "standard" | "cluster";
54
+ interface FieldOption {
55
+ label: string;
56
+ value: string;
57
+ _raw?: any;
58
+ [key: string]: any;
59
+ }
60
+ interface Field {
61
+ id: string;
62
+ type: FieldType;
63
+ name: string;
64
+ label: string;
65
+ placeholder?: string;
66
+ helpText?: string;
67
+ validation: FieldValidation;
68
+ options?: FieldOption[];
69
+ apiDataSource?: ApiDataSource;
70
+ buttonApiConfig?: ButtonApiConfig;
71
+ defaultValue?: any;
72
+ gridCols?: 1 | 2 | 3 | 4;
73
+ alignment?: 'left' | 'center' | 'right';
74
+ customCSS?: CustomCSS;
75
+ step?: number;
76
+ rows?: number;
77
+ min?: number;
78
+ max?: number;
79
+ accept?: string;
80
+ order: number;
81
+ multiple?: boolean;
82
+ }
83
+ interface FormSchema {
84
+ id: string;
85
+ name: string;
86
+ description?: string;
87
+ fields: Field[];
88
+ settings: {
89
+ submitUrl?: string;
90
+ submitMethod?: 'POST' | 'PUT';
91
+ redirectUrl?: string;
92
+ storeSubmissions?: boolean;
93
+ customCSS?: string;
94
+ formGridCols?: 1 | 2 | 3 | 4;
95
+ };
96
+ createdAt: string;
97
+ updatedAt: string;
98
+ }
99
+ interface FormSubmission {
100
+ id: string;
101
+ formId: string;
102
+ formName: string;
103
+ data: Record<string, any>;
104
+ submittedAt: string;
105
+ userAgent?: string;
106
+ }
107
+ type Store = {
108
+ fields: Field[];
109
+ selectedField: Field | null;
110
+ formSchema: FormSchema;
111
+ savedForms: SavedForm[];
112
+ isBuilderOpen: boolean;
113
+ selectedFields: Set<string>;
114
+ setFields: (f: Field[]) => void;
115
+ setSelectedField: (f: Field | null) => void;
116
+ setFormSchema: (f: FormSchema) => void;
117
+ setIsBuilderOpen: (v: boolean) => void;
118
+ setSelectedFields: (s: Set<string>) => void;
119
+ toggleFieldSelection: (id: string) => void;
120
+ selectAllFields: () => void;
121
+ deselectAllFields: () => void;
122
+ addField: (field: Field, index?: number) => void;
123
+ updateField: (id: string, updates: Partial<Field>) => void;
124
+ removeField: (id: string) => void;
125
+ removeSelectedFields: () => void;
126
+ duplicateField: (id: string) => void;
127
+ duplicateSelectedFields: () => void;
128
+ reorderFields: (activeId: string, overId: string) => void;
129
+ updateFormSchema: (u: Partial<FormSchema>) => void;
130
+ saveForm: (name: string, desc?: string) => void;
131
+ loadForm: (id: string) => void;
132
+ deleteForm: (id: string) => void;
133
+ createNewForm: () => void;
134
+ clearForm: () => void;
135
+ addSubmission: (formId: string, data: Record<string, any>) => void;
136
+ getSubmissions: (formId: string) => FormSubmission[];
137
+ };
138
+ interface Ctx {
139
+ fields: Field[];
140
+ selectedField: Field | null;
141
+ formSchema: FormSchema;
142
+ savedForms: SavedForm[];
143
+ isBuilderOpen: boolean;
144
+ selectedFields: Set<string>;
145
+ setFields: (f: Field[]) => void;
146
+ setSelectedField: (f: Field | null) => void;
147
+ setFormSchema: (s: FormSchema) => void;
148
+ setIsBuilderOpen: (b: boolean) => void;
149
+ setSelectedFields: (s: Set<string>) => void;
150
+ toggleFieldSelection: (id: string) => void;
151
+ selectAllFields: () => void;
152
+ deselectAllFields: () => void;
153
+ addField: (f: Field, idx?: number) => void;
154
+ updateField: (id: string, u: Partial<Field>) => void;
155
+ removeField: (id: string) => void;
156
+ removeSelectedFields: () => void;
157
+ duplicateField: (id: string) => void;
158
+ duplicateSelectedFields: () => void;
159
+ reorderFields: (a: string, o: string) => void;
160
+ updateFormSchema: (u: Partial<FormSchema>) => void;
161
+ saveForm: (name: string, desc?: string) => void;
162
+ loadForm: (id: string) => void;
163
+ deleteForm: (id: string) => void;
164
+ createNewForm: () => void;
165
+ clearForm: () => void;
166
+ addSubmission: (formId: string, data: Record<string, any>) => void;
167
+ getSubmissions: (formId: string) => FormSubmission[];
168
+ getFieldById: (id: string) => Field | undefined;
169
+ applyLayoutToSelected: (cols: 1 | 2 | 3 | 4) => void;
170
+ }
171
+ interface SavedForm extends FormSchema {
172
+ submissions?: FormSubmission[];
173
+ }
174
+
175
+ export { type ApiDataSource, type ButtonApiConfig, CanvasPanel, type Ctx, type CustomCSS, type Field, type FieldOption, type FieldType, type FieldValidation, FormBuilderContent, type FormSchema, type FormSubmission, type SavedForm, SettingsPanel, type Store, ToolboxPanel };
@@ -0,0 +1,175 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const FormBuilderContent: () => react_jsx_runtime.JSX.Element;
4
+
5
+ declare const CanvasPanel: () => react_jsx_runtime.JSX.Element;
6
+
7
+ declare const ToolboxPanel: () => react_jsx_runtime.JSX.Element;
8
+
9
+ declare const SettingsPanel: () => react_jsx_runtime.JSX.Element;
10
+
11
+ interface ApiDataSource {
12
+ type: 'static' | 'api' | 'dependency';
13
+ endpoint?: string;
14
+ method?: 'GET' | 'POST';
15
+ headers?: Record<string, string>;
16
+ responsePath?: string;
17
+ labelKey?: string;
18
+ valueKey?: string;
19
+ staticData?: FieldOption[];
20
+ dependsOn?: string | string[];
21
+ dependencyEndpoint?: string;
22
+ dependencyParam?: string;
23
+ dependencyValueKey?: string;
24
+ }
25
+ interface ButtonApiConfig {
26
+ enabled?: boolean;
27
+ url?: string;
28
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
29
+ headers?: Record<string, string>;
30
+ bodyTemplate?: string;
31
+ successMessage?: string;
32
+ errorMessage?: string;
33
+ }
34
+ interface FieldValidation {
35
+ required?: boolean;
36
+ disabled?: boolean;
37
+ readOnly?: boolean;
38
+ minLength?: number;
39
+ maxLength?: number;
40
+ min?: number;
41
+ max?: number;
42
+ pattern?: string;
43
+ patternMessage?: string;
44
+ }
45
+ interface CustomCSS {
46
+ container?: string;
47
+ label?: string;
48
+ input?: string;
49
+ helpText?: string;
50
+ error?: string;
51
+ wrapper?: string;
52
+ }
53
+ type FieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'switch' | 'date' | 'time' | 'datetime-local' | "multidate" | 'file' | 'image' | 'range' | 'color' | 'hidden' | 'label' | 'heading' | 'divider' | 'button' | 'otp' | 'captcha' | 'country' | 'state' | 'city' | 'program' | "scheme" | "standard" | "cluster";
54
+ interface FieldOption {
55
+ label: string;
56
+ value: string;
57
+ _raw?: any;
58
+ [key: string]: any;
59
+ }
60
+ interface Field {
61
+ id: string;
62
+ type: FieldType;
63
+ name: string;
64
+ label: string;
65
+ placeholder?: string;
66
+ helpText?: string;
67
+ validation: FieldValidation;
68
+ options?: FieldOption[];
69
+ apiDataSource?: ApiDataSource;
70
+ buttonApiConfig?: ButtonApiConfig;
71
+ defaultValue?: any;
72
+ gridCols?: 1 | 2 | 3 | 4;
73
+ alignment?: 'left' | 'center' | 'right';
74
+ customCSS?: CustomCSS;
75
+ step?: number;
76
+ rows?: number;
77
+ min?: number;
78
+ max?: number;
79
+ accept?: string;
80
+ order: number;
81
+ multiple?: boolean;
82
+ }
83
+ interface FormSchema {
84
+ id: string;
85
+ name: string;
86
+ description?: string;
87
+ fields: Field[];
88
+ settings: {
89
+ submitUrl?: string;
90
+ submitMethod?: 'POST' | 'PUT';
91
+ redirectUrl?: string;
92
+ storeSubmissions?: boolean;
93
+ customCSS?: string;
94
+ formGridCols?: 1 | 2 | 3 | 4;
95
+ };
96
+ createdAt: string;
97
+ updatedAt: string;
98
+ }
99
+ interface FormSubmission {
100
+ id: string;
101
+ formId: string;
102
+ formName: string;
103
+ data: Record<string, any>;
104
+ submittedAt: string;
105
+ userAgent?: string;
106
+ }
107
+ type Store = {
108
+ fields: Field[];
109
+ selectedField: Field | null;
110
+ formSchema: FormSchema;
111
+ savedForms: SavedForm[];
112
+ isBuilderOpen: boolean;
113
+ selectedFields: Set<string>;
114
+ setFields: (f: Field[]) => void;
115
+ setSelectedField: (f: Field | null) => void;
116
+ setFormSchema: (f: FormSchema) => void;
117
+ setIsBuilderOpen: (v: boolean) => void;
118
+ setSelectedFields: (s: Set<string>) => void;
119
+ toggleFieldSelection: (id: string) => void;
120
+ selectAllFields: () => void;
121
+ deselectAllFields: () => void;
122
+ addField: (field: Field, index?: number) => void;
123
+ updateField: (id: string, updates: Partial<Field>) => void;
124
+ removeField: (id: string) => void;
125
+ removeSelectedFields: () => void;
126
+ duplicateField: (id: string) => void;
127
+ duplicateSelectedFields: () => void;
128
+ reorderFields: (activeId: string, overId: string) => void;
129
+ updateFormSchema: (u: Partial<FormSchema>) => void;
130
+ saveForm: (name: string, desc?: string) => void;
131
+ loadForm: (id: string) => void;
132
+ deleteForm: (id: string) => void;
133
+ createNewForm: () => void;
134
+ clearForm: () => void;
135
+ addSubmission: (formId: string, data: Record<string, any>) => void;
136
+ getSubmissions: (formId: string) => FormSubmission[];
137
+ };
138
+ interface Ctx {
139
+ fields: Field[];
140
+ selectedField: Field | null;
141
+ formSchema: FormSchema;
142
+ savedForms: SavedForm[];
143
+ isBuilderOpen: boolean;
144
+ selectedFields: Set<string>;
145
+ setFields: (f: Field[]) => void;
146
+ setSelectedField: (f: Field | null) => void;
147
+ setFormSchema: (s: FormSchema) => void;
148
+ setIsBuilderOpen: (b: boolean) => void;
149
+ setSelectedFields: (s: Set<string>) => void;
150
+ toggleFieldSelection: (id: string) => void;
151
+ selectAllFields: () => void;
152
+ deselectAllFields: () => void;
153
+ addField: (f: Field, idx?: number) => void;
154
+ updateField: (id: string, u: Partial<Field>) => void;
155
+ removeField: (id: string) => void;
156
+ removeSelectedFields: () => void;
157
+ duplicateField: (id: string) => void;
158
+ duplicateSelectedFields: () => void;
159
+ reorderFields: (a: string, o: string) => void;
160
+ updateFormSchema: (u: Partial<FormSchema>) => void;
161
+ saveForm: (name: string, desc?: string) => void;
162
+ loadForm: (id: string) => void;
163
+ deleteForm: (id: string) => void;
164
+ createNewForm: () => void;
165
+ clearForm: () => void;
166
+ addSubmission: (formId: string, data: Record<string, any>) => void;
167
+ getSubmissions: (formId: string) => FormSubmission[];
168
+ getFieldById: (id: string) => Field | undefined;
169
+ applyLayoutToSelected: (cols: 1 | 2 | 3 | 4) => void;
170
+ }
171
+ interface SavedForm extends FormSchema {
172
+ submissions?: FormSubmission[];
173
+ }
174
+
175
+ export { type ApiDataSource, type ButtonApiConfig, CanvasPanel, type Ctx, type CustomCSS, type Field, type FieldOption, type FieldType, type FieldValidation, FormBuilderContent, type FormSchema, type FormSubmission, type SavedForm, SettingsPanel, type Store, ToolboxPanel };