form-page-builder 0.1.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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/index.cjs +2395 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +534 -0
- package/dist/index.d.ts +534 -0
- package/dist/index.js +2402 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as lucide_react from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
declare const ICON_LIBRARY: {
|
|
5
|
+
Type: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
6
|
+
Mail: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
7
|
+
Phone: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
8
|
+
Hash: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
9
|
+
Lock: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
AlignLeft: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
11
|
+
ChevronDown: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
12
|
+
Circle: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
13
|
+
CheckSquare: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
14
|
+
ListChecks: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
15
|
+
ToggleLeft: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
16
|
+
Calendar: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
Clock: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
18
|
+
User: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
19
|
+
MapPin: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
20
|
+
Building2: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
21
|
+
Globe: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
22
|
+
CreditCard: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
23
|
+
FileText: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
24
|
+
Star: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
25
|
+
Flag: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
26
|
+
Home: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
27
|
+
Briefcase: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
28
|
+
};
|
|
29
|
+
type IconKey = keyof typeof ICON_LIBRARY;
|
|
30
|
+
|
|
31
|
+
type FieldType = "paragraph" | "image" | "input" | "textarea" | "select" | "radio" | "checkboxGroup" | "checkbox" | "toggle";
|
|
32
|
+
|
|
33
|
+
declare const CHROME: {
|
|
34
|
+
en: {
|
|
35
|
+
contentBlocks: string;
|
|
36
|
+
formFields: string;
|
|
37
|
+
addingTo: string;
|
|
38
|
+
properties: string;
|
|
39
|
+
selectFieldHint: string;
|
|
40
|
+
label: string;
|
|
41
|
+
hideLabel: string;
|
|
42
|
+
inputType: string;
|
|
43
|
+
content: string;
|
|
44
|
+
headingStyle: string;
|
|
45
|
+
typography: string;
|
|
46
|
+
style: string;
|
|
47
|
+
align: string;
|
|
48
|
+
color: string;
|
|
49
|
+
imageUrl: string;
|
|
50
|
+
imageUrlHelper: string;
|
|
51
|
+
altText: string;
|
|
52
|
+
linkOptional: string;
|
|
53
|
+
shape: string;
|
|
54
|
+
placeholder: string;
|
|
55
|
+
maxLength: string;
|
|
56
|
+
noLimit: string;
|
|
57
|
+
minValue: string;
|
|
58
|
+
maxValue: string;
|
|
59
|
+
options: string;
|
|
60
|
+
addOption: string;
|
|
61
|
+
defaultValue: string;
|
|
62
|
+
defaultChecked: string;
|
|
63
|
+
checked: string;
|
|
64
|
+
unchecked: string;
|
|
65
|
+
none: string;
|
|
66
|
+
requiredField: string;
|
|
67
|
+
layout: string;
|
|
68
|
+
width: string;
|
|
69
|
+
full: string;
|
|
70
|
+
labelPosition: string;
|
|
71
|
+
above: string;
|
|
72
|
+
inline: string;
|
|
73
|
+
verticalAlign: string;
|
|
74
|
+
top: string;
|
|
75
|
+
middle: string;
|
|
76
|
+
bottom: string;
|
|
77
|
+
icon: string;
|
|
78
|
+
showIcon: string;
|
|
79
|
+
deleteField: string;
|
|
80
|
+
build: string;
|
|
81
|
+
preview: string;
|
|
82
|
+
newForm: string;
|
|
83
|
+
myForms: string;
|
|
84
|
+
save: string;
|
|
85
|
+
viewJson: string;
|
|
86
|
+
saving: string;
|
|
87
|
+
saved: string;
|
|
88
|
+
saveFailed: string;
|
|
89
|
+
startNewForm: string;
|
|
90
|
+
openSavedForm: string;
|
|
91
|
+
saveToLibraryTitle: string;
|
|
92
|
+
sectionTitlePlaceholder: (n: number) => string;
|
|
93
|
+
noFieldsInSection: string;
|
|
94
|
+
addSection: string;
|
|
95
|
+
moveUp: string;
|
|
96
|
+
moveDown: string;
|
|
97
|
+
duplicate: string;
|
|
98
|
+
delete: string;
|
|
99
|
+
deleteSection: string;
|
|
100
|
+
required: string;
|
|
101
|
+
formJson: string;
|
|
102
|
+
copy: string;
|
|
103
|
+
copied: string;
|
|
104
|
+
nothingSaved: string;
|
|
105
|
+
updated: string;
|
|
106
|
+
open: string;
|
|
107
|
+
saveForm: string;
|
|
108
|
+
formName: string;
|
|
109
|
+
saveToLibrary: string;
|
|
110
|
+
loadingDraft: string;
|
|
111
|
+
current: string;
|
|
112
|
+
customColor: string;
|
|
113
|
+
fieldsCount: (n: number) => string;
|
|
114
|
+
formSettings: string;
|
|
115
|
+
submitLabel: string;
|
|
116
|
+
submitMode: string;
|
|
117
|
+
combined: string;
|
|
118
|
+
perSection: string;
|
|
119
|
+
settings: string;
|
|
120
|
+
fieldTypeInput: string;
|
|
121
|
+
fieldTypeTextarea: string;
|
|
122
|
+
fieldTypeSelect: string;
|
|
123
|
+
fieldTypeRadio: string;
|
|
124
|
+
fieldTypeCheckboxGroup: string;
|
|
125
|
+
fieldTypeCheckbox: string;
|
|
126
|
+
fieldTypeToggle: string;
|
|
127
|
+
fieldTypeParagraph: string;
|
|
128
|
+
fieldTypeImage: string;
|
|
129
|
+
subtypeText: string;
|
|
130
|
+
subtypeEmail: string;
|
|
131
|
+
subtypePhone: string;
|
|
132
|
+
subtypeNumber: string;
|
|
133
|
+
subtypePassword: string;
|
|
134
|
+
subtypeDate: string;
|
|
135
|
+
subtypeTime: string;
|
|
136
|
+
shapeSquare: string;
|
|
137
|
+
shapeCircle: string;
|
|
138
|
+
shapeBanner: string;
|
|
139
|
+
tagBody: string;
|
|
140
|
+
tagCaption: string;
|
|
141
|
+
submitSectionTitle: string;
|
|
142
|
+
submitStyle: string;
|
|
143
|
+
buttonSize: string;
|
|
144
|
+
theme: string;
|
|
145
|
+
primaryColor: string;
|
|
146
|
+
pageBackground: string;
|
|
147
|
+
maxWidthPx: string;
|
|
148
|
+
reset: string;
|
|
149
|
+
deviceLaptop: string;
|
|
150
|
+
deviceTablet: string;
|
|
151
|
+
deviceMobile: string;
|
|
152
|
+
untitledField: string;
|
|
153
|
+
optionSeed: (n: number) => string;
|
|
154
|
+
spacing: string;
|
|
155
|
+
spacingPagePadding: string;
|
|
156
|
+
spacingCanvasPadding: string;
|
|
157
|
+
spacingSectionGap: string;
|
|
158
|
+
spacingFieldGap: string;
|
|
159
|
+
spacingToolbarPadding: string;
|
|
160
|
+
spacingPanelPadding: string;
|
|
161
|
+
spacingTicketPadding: string;
|
|
162
|
+
};
|
|
163
|
+
ja: {
|
|
164
|
+
contentBlocks: string;
|
|
165
|
+
formFields: string;
|
|
166
|
+
addingTo: string;
|
|
167
|
+
properties: string;
|
|
168
|
+
selectFieldHint: string;
|
|
169
|
+
label: string;
|
|
170
|
+
hideLabel: string;
|
|
171
|
+
inputType: string;
|
|
172
|
+
content: string;
|
|
173
|
+
headingStyle: string;
|
|
174
|
+
typography: string;
|
|
175
|
+
style: string;
|
|
176
|
+
align: string;
|
|
177
|
+
color: string;
|
|
178
|
+
imageUrl: string;
|
|
179
|
+
imageUrlHelper: string;
|
|
180
|
+
altText: string;
|
|
181
|
+
linkOptional: string;
|
|
182
|
+
shape: string;
|
|
183
|
+
placeholder: string;
|
|
184
|
+
maxLength: string;
|
|
185
|
+
noLimit: string;
|
|
186
|
+
minValue: string;
|
|
187
|
+
maxValue: string;
|
|
188
|
+
options: string;
|
|
189
|
+
addOption: string;
|
|
190
|
+
defaultValue: string;
|
|
191
|
+
defaultChecked: string;
|
|
192
|
+
checked: string;
|
|
193
|
+
unchecked: string;
|
|
194
|
+
none: string;
|
|
195
|
+
requiredField: string;
|
|
196
|
+
layout: string;
|
|
197
|
+
width: string;
|
|
198
|
+
full: string;
|
|
199
|
+
labelPosition: string;
|
|
200
|
+
above: string;
|
|
201
|
+
inline: string;
|
|
202
|
+
verticalAlign: string;
|
|
203
|
+
top: string;
|
|
204
|
+
middle: string;
|
|
205
|
+
bottom: string;
|
|
206
|
+
icon: string;
|
|
207
|
+
showIcon: string;
|
|
208
|
+
deleteField: string;
|
|
209
|
+
build: string;
|
|
210
|
+
preview: string;
|
|
211
|
+
newForm: string;
|
|
212
|
+
myForms: string;
|
|
213
|
+
save: string;
|
|
214
|
+
viewJson: string;
|
|
215
|
+
saving: string;
|
|
216
|
+
saved: string;
|
|
217
|
+
saveFailed: string;
|
|
218
|
+
startNewForm: string;
|
|
219
|
+
openSavedForm: string;
|
|
220
|
+
saveToLibraryTitle: string;
|
|
221
|
+
sectionTitlePlaceholder: (n: number) => string;
|
|
222
|
+
noFieldsInSection: string;
|
|
223
|
+
addSection: string;
|
|
224
|
+
moveUp: string;
|
|
225
|
+
moveDown: string;
|
|
226
|
+
duplicate: string;
|
|
227
|
+
delete: string;
|
|
228
|
+
deleteSection: string;
|
|
229
|
+
required: string;
|
|
230
|
+
formJson: string;
|
|
231
|
+
copy: string;
|
|
232
|
+
copied: string;
|
|
233
|
+
nothingSaved: string;
|
|
234
|
+
updated: string;
|
|
235
|
+
open: string;
|
|
236
|
+
saveForm: string;
|
|
237
|
+
formName: string;
|
|
238
|
+
saveToLibrary: string;
|
|
239
|
+
loadingDraft: string;
|
|
240
|
+
current: string;
|
|
241
|
+
customColor: string;
|
|
242
|
+
fieldsCount: (n: number) => string;
|
|
243
|
+
formSettings: string;
|
|
244
|
+
submitLabel: string;
|
|
245
|
+
submitMode: string;
|
|
246
|
+
combined: string;
|
|
247
|
+
perSection: string;
|
|
248
|
+
settings: string;
|
|
249
|
+
fieldTypeInput: string;
|
|
250
|
+
fieldTypeTextarea: string;
|
|
251
|
+
fieldTypeSelect: string;
|
|
252
|
+
fieldTypeRadio: string;
|
|
253
|
+
fieldTypeCheckboxGroup: string;
|
|
254
|
+
fieldTypeCheckbox: string;
|
|
255
|
+
fieldTypeToggle: string;
|
|
256
|
+
fieldTypeParagraph: string;
|
|
257
|
+
fieldTypeImage: string;
|
|
258
|
+
subtypeText: string;
|
|
259
|
+
subtypeEmail: string;
|
|
260
|
+
subtypePhone: string;
|
|
261
|
+
subtypeNumber: string;
|
|
262
|
+
subtypePassword: string;
|
|
263
|
+
subtypeDate: string;
|
|
264
|
+
subtypeTime: string;
|
|
265
|
+
shapeSquare: string;
|
|
266
|
+
shapeCircle: string;
|
|
267
|
+
shapeBanner: string;
|
|
268
|
+
tagBody: string;
|
|
269
|
+
tagCaption: string;
|
|
270
|
+
submitSectionTitle: string;
|
|
271
|
+
submitStyle: string;
|
|
272
|
+
buttonSize: string;
|
|
273
|
+
theme: string;
|
|
274
|
+
primaryColor: string;
|
|
275
|
+
pageBackground: string;
|
|
276
|
+
maxWidthPx: string;
|
|
277
|
+
reset: string;
|
|
278
|
+
deviceLaptop: string;
|
|
279
|
+
deviceTablet: string;
|
|
280
|
+
deviceMobile: string;
|
|
281
|
+
untitledField: string;
|
|
282
|
+
optionSeed: (n: number) => string;
|
|
283
|
+
spacing: string;
|
|
284
|
+
spacingPagePadding: string;
|
|
285
|
+
spacingCanvasPadding: string;
|
|
286
|
+
spacingSectionGap: string;
|
|
287
|
+
spacingFieldGap: string;
|
|
288
|
+
spacingToolbarPadding: string;
|
|
289
|
+
spacingPanelPadding: string;
|
|
290
|
+
spacingTicketPadding: string;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
type ChromeShape = typeof CHROME.en;
|
|
294
|
+
|
|
295
|
+
declare const DEFAULT_STRINGS: {
|
|
296
|
+
en: {
|
|
297
|
+
submit: string;
|
|
298
|
+
selectPlaceholder: string;
|
|
299
|
+
requiredError: string;
|
|
300
|
+
invalidEmail: string;
|
|
301
|
+
invalidPhone: string;
|
|
302
|
+
fixErrors: string;
|
|
303
|
+
submittedTitle: string;
|
|
304
|
+
submittedBody: string;
|
|
305
|
+
addFieldsHint: string;
|
|
306
|
+
close: string;
|
|
307
|
+
tooLong: (n: number) => string;
|
|
308
|
+
tooSmall: (n: number) => string;
|
|
309
|
+
tooLarge: (n: number) => string;
|
|
310
|
+
};
|
|
311
|
+
ja: {
|
|
312
|
+
submit: string;
|
|
313
|
+
selectPlaceholder: string;
|
|
314
|
+
requiredError: string;
|
|
315
|
+
invalidEmail: string;
|
|
316
|
+
invalidPhone: string;
|
|
317
|
+
fixErrors: string;
|
|
318
|
+
submittedTitle: string;
|
|
319
|
+
submittedBody: string;
|
|
320
|
+
addFieldsHint: string;
|
|
321
|
+
close: string;
|
|
322
|
+
tooLong: (n: number) => string;
|
|
323
|
+
tooSmall: (n: number) => string;
|
|
324
|
+
tooLarge: (n: number) => string;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
type StringsShape = typeof DEFAULT_STRINGS.en;
|
|
328
|
+
|
|
329
|
+
interface LanguageOption {
|
|
330
|
+
code: string;
|
|
331
|
+
label: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface LocalizedString {
|
|
335
|
+
en: string;
|
|
336
|
+
[lang: string]: string | undefined;
|
|
337
|
+
}
|
|
338
|
+
interface Option {
|
|
339
|
+
label: LocalizedString;
|
|
340
|
+
value: string;
|
|
341
|
+
}
|
|
342
|
+
type WidthOption = "1/3" | "1/2" | "1/1";
|
|
343
|
+
type VerticalAlign = "top" | "middle" | "bottom";
|
|
344
|
+
type LabelPosition = "top" | "inline";
|
|
345
|
+
interface BaseField {
|
|
346
|
+
id: string;
|
|
347
|
+
type: FieldType;
|
|
348
|
+
label: LocalizedString;
|
|
349
|
+
hideLabel: boolean;
|
|
350
|
+
width: WidthOption;
|
|
351
|
+
verticalAlign: VerticalAlign;
|
|
352
|
+
labelPosition: LabelPosition;
|
|
353
|
+
showIcon: boolean;
|
|
354
|
+
displayIcon: IconKey;
|
|
355
|
+
required?: boolean;
|
|
356
|
+
}
|
|
357
|
+
interface InputField extends BaseField {
|
|
358
|
+
type: "input";
|
|
359
|
+
inputType: "text" | "email" | "phone" | "number" | "password" | "date" | "time";
|
|
360
|
+
placeholder: LocalizedString;
|
|
361
|
+
maxLength?: number | null;
|
|
362
|
+
min?: number | null;
|
|
363
|
+
max?: number | null;
|
|
364
|
+
defaultValue: string;
|
|
365
|
+
required: boolean;
|
|
366
|
+
}
|
|
367
|
+
interface TextareaField extends BaseField {
|
|
368
|
+
type: "textarea";
|
|
369
|
+
placeholder: LocalizedString;
|
|
370
|
+
maxLength?: number | null;
|
|
371
|
+
defaultValue: string;
|
|
372
|
+
required: boolean;
|
|
373
|
+
}
|
|
374
|
+
interface SelectField extends BaseField {
|
|
375
|
+
type: "select";
|
|
376
|
+
options: Option[];
|
|
377
|
+
defaultValue: string;
|
|
378
|
+
required: boolean;
|
|
379
|
+
}
|
|
380
|
+
interface RadioField extends BaseField {
|
|
381
|
+
type: "radio";
|
|
382
|
+
options: Option[];
|
|
383
|
+
defaultValue: string;
|
|
384
|
+
required: boolean;
|
|
385
|
+
}
|
|
386
|
+
interface CheckboxGroupField extends BaseField {
|
|
387
|
+
type: "checkboxGroup";
|
|
388
|
+
options: Option[];
|
|
389
|
+
defaultValue: string[];
|
|
390
|
+
required: boolean;
|
|
391
|
+
}
|
|
392
|
+
interface CheckboxField extends BaseField {
|
|
393
|
+
type: "checkbox";
|
|
394
|
+
defaultValue: boolean;
|
|
395
|
+
required: boolean;
|
|
396
|
+
}
|
|
397
|
+
interface ToggleField extends BaseField {
|
|
398
|
+
type: "toggle";
|
|
399
|
+
defaultValue: boolean;
|
|
400
|
+
required: boolean;
|
|
401
|
+
}
|
|
402
|
+
interface ParagraphField extends BaseField {
|
|
403
|
+
type: "paragraph";
|
|
404
|
+
content: LocalizedString;
|
|
405
|
+
tag: "h1" | "h2" | "h3" | "p" | "caption";
|
|
406
|
+
fontSize: "sm" | "md" | "lg" | "xl";
|
|
407
|
+
fontWeight: "normal" | "bold";
|
|
408
|
+
fontStyle: "normal" | "italic";
|
|
409
|
+
textAlign: "left" | "center" | "right";
|
|
410
|
+
color: string;
|
|
411
|
+
}
|
|
412
|
+
interface ImageField extends BaseField {
|
|
413
|
+
type: "image";
|
|
414
|
+
src: string;
|
|
415
|
+
alt: LocalizedString;
|
|
416
|
+
link: string;
|
|
417
|
+
shape: "square" | "circle" | "banner";
|
|
418
|
+
}
|
|
419
|
+
type FormField = InputField | TextareaField | SelectField | RadioField | CheckboxGroupField | CheckboxField | ToggleField | ParagraphField | ImageField;
|
|
420
|
+
/**
|
|
421
|
+
* Flat, fully-optional patch type for updateField/updateOption call sites.
|
|
422
|
+
* A strict `Partial<FormField>` doesn't typecheck for cross-type shallow
|
|
423
|
+
* merges (e.g. `defaultValue: string` vs `boolean` collapses to `never`),
|
|
424
|
+
* so mutation call sites use this instead of the discriminated union.
|
|
425
|
+
*/
|
|
426
|
+
interface FieldPatch {
|
|
427
|
+
label?: LocalizedString;
|
|
428
|
+
hideLabel?: boolean;
|
|
429
|
+
width?: WidthOption;
|
|
430
|
+
verticalAlign?: VerticalAlign;
|
|
431
|
+
labelPosition?: LabelPosition;
|
|
432
|
+
showIcon?: boolean;
|
|
433
|
+
displayIcon?: IconKey;
|
|
434
|
+
required?: boolean;
|
|
435
|
+
inputType?: InputField["inputType"];
|
|
436
|
+
placeholder?: LocalizedString;
|
|
437
|
+
maxLength?: number | null;
|
|
438
|
+
min?: number | null;
|
|
439
|
+
max?: number | null;
|
|
440
|
+
options?: Option[];
|
|
441
|
+
defaultValue?: string | boolean | string[];
|
|
442
|
+
content?: LocalizedString;
|
|
443
|
+
tag?: ParagraphField["tag"];
|
|
444
|
+
fontSize?: ParagraphField["fontSize"];
|
|
445
|
+
fontWeight?: ParagraphField["fontWeight"];
|
|
446
|
+
fontStyle?: ParagraphField["fontStyle"];
|
|
447
|
+
textAlign?: ParagraphField["textAlign"];
|
|
448
|
+
color?: string;
|
|
449
|
+
src?: string;
|
|
450
|
+
alt?: LocalizedString;
|
|
451
|
+
link?: string;
|
|
452
|
+
shape?: ImageField["shape"];
|
|
453
|
+
}
|
|
454
|
+
interface SubmitStyle {
|
|
455
|
+
color: string;
|
|
456
|
+
size: "sm" | "md" | "lg";
|
|
457
|
+
}
|
|
458
|
+
interface Section {
|
|
459
|
+
id: string;
|
|
460
|
+
title: LocalizedString;
|
|
461
|
+
background: string;
|
|
462
|
+
collapsed: boolean;
|
|
463
|
+
submitStyle: SubmitStyle | null;
|
|
464
|
+
fields: FormField[];
|
|
465
|
+
}
|
|
466
|
+
interface DocumentFields {
|
|
467
|
+
title: LocalizedString;
|
|
468
|
+
submitLabel: LocalizedString;
|
|
469
|
+
submitMode: "combined" | "perSection";
|
|
470
|
+
submitStyle: SubmitStyle;
|
|
471
|
+
themeOverrides: ThemeOverrides;
|
|
472
|
+
sections: Section[];
|
|
473
|
+
}
|
|
474
|
+
/** Shape used only for the "View JSON" export (stamped with a version). */
|
|
475
|
+
interface FormDocument extends DocumentFields {
|
|
476
|
+
version: 4;
|
|
477
|
+
}
|
|
478
|
+
interface SavedFormMeta {
|
|
479
|
+
id: string;
|
|
480
|
+
title: string;
|
|
481
|
+
updatedAt: number;
|
|
482
|
+
}
|
|
483
|
+
interface ThemeLayout {
|
|
484
|
+
maxWidth: number;
|
|
485
|
+
pagePadding: number;
|
|
486
|
+
canvasPadding: number;
|
|
487
|
+
sectionGap: number;
|
|
488
|
+
fieldGap: number;
|
|
489
|
+
toolbarPadding: number;
|
|
490
|
+
panelPadding: number;
|
|
491
|
+
ticketPadding: number;
|
|
492
|
+
}
|
|
493
|
+
interface Theme {
|
|
494
|
+
primary: string;
|
|
495
|
+
primarySoft: string;
|
|
496
|
+
danger: string;
|
|
497
|
+
dangerSoft: string;
|
|
498
|
+
ink: string;
|
|
499
|
+
muted: string;
|
|
500
|
+
border: string;
|
|
501
|
+
surface: string;
|
|
502
|
+
canvas: string;
|
|
503
|
+
pageBackground: string;
|
|
504
|
+
layout: ThemeLayout;
|
|
505
|
+
}
|
|
506
|
+
type ThemeOverrides = Partial<Omit<Theme, "layout">> & {
|
|
507
|
+
layout?: Partial<ThemeLayout>;
|
|
508
|
+
};
|
|
509
|
+
interface StorageAdapter {
|
|
510
|
+
get(key: string): Promise<string | null>;
|
|
511
|
+
set(key: string, value: string): Promise<void>;
|
|
512
|
+
delete(key: string): Promise<void>;
|
|
513
|
+
}
|
|
514
|
+
interface FormBuilderProps {
|
|
515
|
+
theme?: Partial<Theme>;
|
|
516
|
+
language?: string;
|
|
517
|
+
languages?: LanguageOption[];
|
|
518
|
+
strings?: Record<string, Partial<StringsShape>>;
|
|
519
|
+
chrome?: Record<string, Partial<ChromeShape>>;
|
|
520
|
+
themeEditable?: boolean;
|
|
521
|
+
storage?: StorageAdapter;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
declare function FormBuilder({ theme: themeOverrideProp, language: languageOverride, languages, strings: stringsOverride, chrome: chromeOverride, themeEditable, storage: storageProp, }?: FormBuilderProps): react.JSX.Element;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Default StorageAdapter, backed by window.localStorage. Availability is
|
|
528
|
+
* checked inside each method (not once at module load) so the same module
|
|
529
|
+
* behaves correctly whether it runs during SSR (no window) or later on the
|
|
530
|
+
* client, within the same process.
|
|
531
|
+
*/
|
|
532
|
+
declare const localStorageAdapter: StorageAdapter;
|
|
533
|
+
|
|
534
|
+
export { type CheckboxField, type CheckboxGroupField, type ChromeShape, type DocumentFields, type FieldPatch, type FieldType, FormBuilder, type FormBuilderProps, type FormDocument, type FormField, type ImageField, type InputField, type LanguageOption, type LocalizedString, type Option, type ParagraphField, type RadioField, type SavedFormMeta, type Section, type SelectField, type StorageAdapter, type StringsShape, type SubmitStyle, type TextareaField, type Theme, type ThemeLayout, type ThemeOverrides, type ToggleField, FormBuilder as default, localStorageAdapter };
|