@object-ui/plugin-form 5.0.2 → 5.2.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/CHANGELOG.md +74 -0
- package/dist/index.js +241 -217
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-form/src/FormSection.d.ts +8 -0
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -4,44 +4,64 @@ import { SchemaRenderer as c, useSafeFieldLabel as l } from "@object-ui/react";
|
|
|
4
4
|
import { buildValidationRules as u, evaluateCondition as d, formatFileSize as f, mapFieldTypeToFormType as p } from "@object-ui/fields";
|
|
5
5
|
import { Button as m, Card as h, CardContent as g, CardDescription as _, CardHeader as v, CardTitle as y, Dialog as b, DialogDescription as x, DialogHeader as S, DialogTitle as C, MobileDialogContent as w, ResizableHandle as T, ResizablePanel as E, ResizablePanelGroup as D, Sheet as O, SheetContent as k, SheetDescription as A, SheetHeader as j, SheetTitle as M, Skeleton as N, Tabs as P, TabsContent as F, TabsList as I, TabsTrigger as L, cn as R, useIsMobile as z } from "@object-ui/components";
|
|
6
6
|
import { usePermissions as B } from "@object-ui/permissions";
|
|
7
|
-
import { Check as ee, CheckCircle2 as V, ChevronDown as H, ChevronLeft as te, ChevronRight as U, Loader2 as
|
|
8
|
-
import { Fragment as
|
|
7
|
+
import { Check as ee, CheckCircle2 as V, ChevronDown as H, ChevronLeft as te, ChevronRight as U, Loader2 as W, Lock as G, ShieldCheck as K } from "lucide-react";
|
|
8
|
+
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
9
9
|
//#region src/FormSection.tsx
|
|
10
|
-
var
|
|
11
|
-
let [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
var X = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: a, className: s, gridClassName: c, showBorder: l }) => {
|
|
11
|
+
let [u, d] = o(r), f = {
|
|
12
|
+
1: "grid-cols-1",
|
|
13
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
14
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
15
|
+
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
16
|
+
}, p = () => {
|
|
17
|
+
n && d(!u);
|
|
18
|
+
}, m = l ?? !!e, b = e || t ? /* @__PURE__ */ Y("div", {
|
|
19
|
+
className: R("flex items-start gap-2", !m && "mb-4", n && "cursor-pointer select-none"),
|
|
20
|
+
onClick: p,
|
|
21
|
+
role: n ? "button" : void 0,
|
|
22
|
+
"aria-expanded": n ? !u : void 0,
|
|
23
|
+
children: [n && /* @__PURE__ */ J("span", {
|
|
24
|
+
className: "mt-0.5 text-muted-foreground",
|
|
25
|
+
children: J(u ? U : H, { className: "h-4 w-4" })
|
|
26
|
+
}), /* @__PURE__ */ Y("div", {
|
|
27
|
+
className: "flex-1",
|
|
28
|
+
children: [e && /* @__PURE__ */ J("h3", {
|
|
29
|
+
className: "text-base font-semibold text-foreground",
|
|
30
|
+
children: e
|
|
31
|
+
}), t && /* @__PURE__ */ J("p", {
|
|
32
|
+
className: "text-sm text-muted-foreground mt-0.5",
|
|
33
|
+
children: t
|
|
33
34
|
})]
|
|
34
|
-
}), !l && /* @__PURE__ */ q("div", {
|
|
35
|
-
className: R("grid gap-4", c || {
|
|
36
|
-
1: "grid-cols-1",
|
|
37
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
38
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
39
|
-
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
40
|
-
}[i]),
|
|
41
|
-
children: a
|
|
42
35
|
})]
|
|
36
|
+
}) : null, x = u ? null : /* @__PURE__ */ J("div", {
|
|
37
|
+
className: R("grid gap-4", c || f[i]),
|
|
38
|
+
children: a
|
|
39
|
+
});
|
|
40
|
+
return m ? /* @__PURE__ */ Y(h, {
|
|
41
|
+
className: R("form-section", s),
|
|
42
|
+
children: [b && /* @__PURE__ */ Y(v, {
|
|
43
|
+
className: "pb-3",
|
|
44
|
+
children: [
|
|
45
|
+
e && /* @__PURE__ */ J(y, {
|
|
46
|
+
className: "text-base",
|
|
47
|
+
children: e
|
|
48
|
+
}),
|
|
49
|
+
t && /* @__PURE__ */ J(_, { children: t }),
|
|
50
|
+
n && /* @__PURE__ */ J("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
className: "absolute right-4 top-4 text-muted-foreground",
|
|
53
|
+
onClick: p,
|
|
54
|
+
"aria-expanded": !u,
|
|
55
|
+
"aria-label": u ? "Expand section" : "Collapse section",
|
|
56
|
+
children: J(u ? U : H, { className: "h-4 w-4" })
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
}), x && /* @__PURE__ */ J(g, { children: x })]
|
|
60
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
61
|
+
className: R("form-section", s),
|
|
62
|
+
children: [b, x]
|
|
43
63
|
});
|
|
44
|
-
},
|
|
64
|
+
}, Z = ({ schema: n, dataSource: r, className: i }) => {
|
|
45
65
|
let { fieldLabel: a } = l(), [s, d] = o(null), [f, m] = o({}), [h, g] = o(!0), [_, v] = o(null), [y, b] = o(n.defaultTab || n.sections[0]?.name || n.sections[0]?.label || "tab-0");
|
|
46
66
|
e.useEffect(() => {
|
|
47
67
|
(async () => {
|
|
@@ -120,19 +140,19 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
120
140
|
}, [n, r]), C = t(() => {
|
|
121
141
|
n.onCancel && n.onCancel();
|
|
122
142
|
}, [n]), w = (e, t) => e.name || e.label || `tab-${t}`;
|
|
123
|
-
if (_) return /* @__PURE__ */
|
|
143
|
+
if (_) return /* @__PURE__ */ Y("div", {
|
|
124
144
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
125
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
126
146
|
className: "text-red-800 font-semibold",
|
|
127
147
|
children: "Error loading form"
|
|
128
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ J("p", {
|
|
129
149
|
className: "text-red-600 text-sm mt-1",
|
|
130
150
|
children: _.message
|
|
131
151
|
})]
|
|
132
152
|
});
|
|
133
|
-
if (h) return /* @__PURE__ */
|
|
153
|
+
if (h) return /* @__PURE__ */ Y("div", {
|
|
134
154
|
className: "p-8 text-center",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ J("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ J("p", {
|
|
136
156
|
className: "mt-2 text-sm text-gray-600",
|
|
137
157
|
children: "Loading form..."
|
|
138
158
|
})]
|
|
@@ -149,29 +169,29 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
149
169
|
onSubmit: S,
|
|
150
170
|
onCancel: C
|
|
151
171
|
}, E = n.tabPosition === "left" || n.tabPosition === "right";
|
|
152
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ J("div", {
|
|
153
173
|
className: R("w-full", i, n.className),
|
|
154
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ Y(P, {
|
|
155
175
|
value: y,
|
|
156
176
|
onValueChange: b,
|
|
157
177
|
orientation: E ? "vertical" : "horizontal",
|
|
158
178
|
className: R(E && "flex gap-4"),
|
|
159
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ J(I, {
|
|
160
180
|
className: R(E ? "flex-col h-auto" : "", n.tabPosition === "bottom" && "order-last", n.tabPosition === "right" && "order-last"),
|
|
161
|
-
children: n.sections.map((e, t) => /* @__PURE__ */
|
|
181
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ J(L, {
|
|
162
182
|
value: w(e, t),
|
|
163
183
|
className: E ? "w-full justify-start" : "",
|
|
164
184
|
children: e.label || `Tab ${t + 1}`
|
|
165
185
|
}, w(e, t)))
|
|
166
|
-
}), /* @__PURE__ */
|
|
186
|
+
}), /* @__PURE__ */ J("div", {
|
|
167
187
|
className: "flex-1",
|
|
168
|
-
children: n.sections.map((e, t) => /* @__PURE__ */
|
|
188
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ J(F, {
|
|
169
189
|
value: w(e, t),
|
|
170
190
|
className: "mt-0",
|
|
171
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ J(X, {
|
|
172
192
|
description: e.description,
|
|
173
193
|
columns: e.columns || 1,
|
|
174
|
-
children: /* @__PURE__ */
|
|
194
|
+
children: /* @__PURE__ */ J(c, { schema: {
|
|
175
195
|
...T,
|
|
176
196
|
fields: x(e),
|
|
177
197
|
showSubmit: n.showSubmit !== !1 && n.mode !== "view",
|
|
@@ -182,7 +202,7 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
182
202
|
})]
|
|
183
203
|
})
|
|
184
204
|
});
|
|
185
|
-
},
|
|
205
|
+
}, Q = ({ schema: n, dataSource: r, className: a }) => {
|
|
186
206
|
let { fieldLabel: s } = l(), [f, h] = o(null), [g, _] = o({}), [v, y] = o(!0), [b, x] = o(null), [S, C] = o(0), [w, T] = o(/* @__PURE__ */ new Set()), [E, D] = o(!1), O = n.sections.length, k = S === 0, A = S === O - 1;
|
|
187
207
|
e.useEffect(() => {
|
|
188
208
|
(async () => {
|
|
@@ -296,51 +316,51 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
296
316
|
S,
|
|
297
317
|
P
|
|
298
318
|
]);
|
|
299
|
-
if (b) return /* @__PURE__ */
|
|
319
|
+
if (b) return /* @__PURE__ */ Y("div", {
|
|
300
320
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
301
|
-
children: [/* @__PURE__ */
|
|
321
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
302
322
|
className: "text-red-800 font-semibold",
|
|
303
323
|
children: "Error loading form"
|
|
304
|
-
}), /* @__PURE__ */
|
|
324
|
+
}), /* @__PURE__ */ J("p", {
|
|
305
325
|
className: "text-red-600 text-sm mt-1",
|
|
306
326
|
children: b.message
|
|
307
327
|
})]
|
|
308
328
|
});
|
|
309
|
-
if (v) return /* @__PURE__ */
|
|
329
|
+
if (v) return /* @__PURE__ */ Y("div", {
|
|
310
330
|
className: "p-8 text-center",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
331
|
+
children: [/* @__PURE__ */ J("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ J("p", {
|
|
312
332
|
className: "mt-2 text-sm text-gray-600",
|
|
313
333
|
children: "Loading form..."
|
|
314
334
|
})]
|
|
315
335
|
});
|
|
316
336
|
let z = n.sections[S];
|
|
317
|
-
return /* @__PURE__ */
|
|
337
|
+
return /* @__PURE__ */ Y("div", {
|
|
318
338
|
className: R("w-full", a, n.className),
|
|
319
339
|
children: [
|
|
320
|
-
n.showStepIndicator !== !1 && /* @__PURE__ */
|
|
340
|
+
n.showStepIndicator !== !1 && /* @__PURE__ */ J("nav", {
|
|
321
341
|
"aria-label": "Progress",
|
|
322
342
|
className: "mb-8",
|
|
323
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ J("ol", {
|
|
324
344
|
className: "flex items-center",
|
|
325
345
|
children: n.sections.map((e, t) => {
|
|
326
346
|
let r = t === S, i = w.has(t), a = n.allowSkip || i || t <= S;
|
|
327
|
-
return /* @__PURE__ */
|
|
347
|
+
return /* @__PURE__ */ Y("li", {
|
|
328
348
|
className: R("relative flex-1", t !== O - 1 && "pr-8 sm:pr-12"),
|
|
329
|
-
children: [t !== O - 1 && /* @__PURE__ */
|
|
349
|
+
children: [t !== O - 1 && /* @__PURE__ */ J("div", {
|
|
330
350
|
className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
|
|
331
351
|
"aria-hidden": "true",
|
|
332
|
-
children: /* @__PURE__ */
|
|
333
|
-
}), /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ J("div", { className: R("h-full", i ? "bg-primary" : "bg-muted") })
|
|
353
|
+
}), /* @__PURE__ */ Y("button", {
|
|
334
354
|
type: "button",
|
|
335
355
|
className: R("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
|
|
336
356
|
onClick: () => L(t),
|
|
337
357
|
disabled: !a,
|
|
338
|
-
children: [/* @__PURE__ */
|
|
358
|
+
children: [/* @__PURE__ */ J("span", {
|
|
339
359
|
className: R("flex h-6 w-6 sm:h-8 sm:w-8 items-center justify-center rounded-full text-xs sm:text-sm font-medium transition-colors", i && "bg-primary text-primary-foreground", r && !i && "border-2 border-primary bg-background text-primary", !r && !i && "border-2 border-muted bg-background text-muted-foreground"),
|
|
340
|
-
children: i ? /* @__PURE__ */
|
|
341
|
-
}), /* @__PURE__ */
|
|
360
|
+
children: i ? /* @__PURE__ */ J(ee, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : t + 1
|
|
361
|
+
}), /* @__PURE__ */ J("span", {
|
|
342
362
|
className: "ml-2 sm:ml-3 text-xs sm:text-sm font-medium hidden sm:block",
|
|
343
|
-
children: /* @__PURE__ */
|
|
363
|
+
children: /* @__PURE__ */ J("span", {
|
|
344
364
|
className: R(r ? "text-foreground" : "text-muted-foreground"),
|
|
345
365
|
children: e.label || `Step ${t + 1}`
|
|
346
366
|
})
|
|
@@ -350,13 +370,13 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
350
370
|
})
|
|
351
371
|
})
|
|
352
372
|
}),
|
|
353
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ J("div", {
|
|
354
374
|
className: "min-h-[200px]",
|
|
355
|
-
children: z && /* @__PURE__ */
|
|
375
|
+
children: z && /* @__PURE__ */ J(X, {
|
|
356
376
|
label: z.label,
|
|
357
377
|
description: z.description,
|
|
358
378
|
columns: z.columns || 1,
|
|
359
|
-
children: M.length > 0 ? /* @__PURE__ */
|
|
379
|
+
children: M.length > 0 ? /* @__PURE__ */ J(c, { schema: {
|
|
360
380
|
type: "form",
|
|
361
381
|
fields: M,
|
|
362
382
|
layout: "vertical",
|
|
@@ -364,22 +384,22 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
364
384
|
showSubmit: !1,
|
|
365
385
|
showCancel: !1,
|
|
366
386
|
onSubmit: N
|
|
367
|
-
} }) : /* @__PURE__ */
|
|
387
|
+
} }) : /* @__PURE__ */ J("div", {
|
|
368
388
|
className: "text-center py-8 text-muted-foreground",
|
|
369
389
|
children: "No fields configured for this step"
|
|
370
390
|
})
|
|
371
391
|
})
|
|
372
392
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ Y("div", {
|
|
374
394
|
className: "flex items-center justify-between mt-6 pt-4 border-t",
|
|
375
|
-
children: [/* @__PURE__ */
|
|
395
|
+
children: [/* @__PURE__ */ J("div", { children: n.showCancel !== !1 && /* @__PURE__ */ J(m, {
|
|
376
396
|
variant: "ghost",
|
|
377
397
|
onClick: I,
|
|
378
398
|
children: n.cancelText || "Cancel"
|
|
379
|
-
}) }), /* @__PURE__ */
|
|
399
|
+
}) }), /* @__PURE__ */ Y("div", {
|
|
380
400
|
className: "flex items-center gap-2",
|
|
381
401
|
children: [
|
|
382
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ Y("span", {
|
|
383
403
|
className: "text-sm text-muted-foreground mr-2",
|
|
384
404
|
children: [
|
|
385
405
|
"Step ",
|
|
@@ -388,25 +408,28 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
388
408
|
O
|
|
389
409
|
]
|
|
390
410
|
}),
|
|
391
|
-
!k && /* @__PURE__ */
|
|
411
|
+
!k && /* @__PURE__ */ Y(m, {
|
|
392
412
|
variant: "outline",
|
|
393
413
|
onClick: F,
|
|
394
|
-
children: [/* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ J(te, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
|
|
395
415
|
}),
|
|
396
|
-
A ? /* @__PURE__ */
|
|
416
|
+
A ? /* @__PURE__ */ Y(m, {
|
|
397
417
|
onClick: () => N(g),
|
|
398
418
|
disabled: E || n.mode === "view",
|
|
399
|
-
children: E
|
|
400
|
-
|
|
419
|
+
children: [E && /* @__PURE__ */ J(W, {
|
|
420
|
+
className: "mr-2 h-4 w-4 animate-spin",
|
|
421
|
+
"aria-hidden": !0
|
|
422
|
+
}), E ? "Submitting..." : n.submitText || (n.mode === "create" ? "Create" : "Update")]
|
|
423
|
+
}) : /* @__PURE__ */ Y(m, {
|
|
401
424
|
onClick: () => N(g),
|
|
402
|
-
children: [n.nextText || "Next", /* @__PURE__ */
|
|
425
|
+
children: [n.nextText || "Next", /* @__PURE__ */ J(U, { className: "h-4 w-4 ml-1" })]
|
|
403
426
|
})
|
|
404
427
|
]
|
|
405
428
|
})]
|
|
406
429
|
})
|
|
407
430
|
]
|
|
408
431
|
});
|
|
409
|
-
},
|
|
432
|
+
}, ne = ({ schema: e, dataSource: r, className: a }) => {
|
|
410
433
|
let { fieldLabel: s } = l(), [f, m] = o(null), [h, g] = o({}), [_, v] = o(!0), [y, b] = o(null);
|
|
411
434
|
n(() => {
|
|
412
435
|
(async () => {
|
|
@@ -495,19 +518,19 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
495
518
|
}, [e]), w = i(() => e.sections.slice(0, 1), [e.sections]), O = i(() => e.sections.slice(1), [e.sections]);
|
|
496
519
|
i(() => e.sections.flatMap((e) => x(e)), [e.sections, x]);
|
|
497
520
|
let k = e.splitDirection || "horizontal", A = e.splitSize || 50;
|
|
498
|
-
if (y) return /* @__PURE__ */
|
|
521
|
+
if (y) return /* @__PURE__ */ Y("div", {
|
|
499
522
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
500
|
-
children: [/* @__PURE__ */
|
|
523
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
501
524
|
className: "text-red-800 font-semibold",
|
|
502
525
|
children: "Error loading form"
|
|
503
|
-
}), /* @__PURE__ */
|
|
526
|
+
}), /* @__PURE__ */ J("p", {
|
|
504
527
|
className: "text-red-600 text-sm mt-1",
|
|
505
528
|
children: y.message
|
|
506
529
|
})]
|
|
507
530
|
});
|
|
508
|
-
if (_) return /* @__PURE__ */
|
|
531
|
+
if (_) return /* @__PURE__ */ Y("div", {
|
|
509
532
|
className: "p-8 text-center",
|
|
510
|
-
children: [/* @__PURE__ */
|
|
533
|
+
children: [/* @__PURE__ */ J("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ J("p", {
|
|
511
534
|
className: "mt-2 text-sm text-gray-600",
|
|
512
535
|
children: "Loading form..."
|
|
513
536
|
})]
|
|
@@ -518,13 +541,13 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
518
541
|
defaultValues: h,
|
|
519
542
|
onSubmit: S,
|
|
520
543
|
onCancel: C
|
|
521
|
-
}, M = (t, n) => /* @__PURE__ */
|
|
544
|
+
}, M = (t, n) => /* @__PURE__ */ J("div", {
|
|
522
545
|
className: "space-y-4 p-4",
|
|
523
|
-
children: t.map((t, r) => /* @__PURE__ */
|
|
546
|
+
children: t.map((t, r) => /* @__PURE__ */ J(X, {
|
|
524
547
|
label: t.label,
|
|
525
548
|
description: t.description,
|
|
526
549
|
columns: t.columns || 1,
|
|
527
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ J(c, { schema: {
|
|
528
551
|
...j,
|
|
529
552
|
fields: x(t),
|
|
530
553
|
showSubmit: n && e.showSubmit !== !1 && e.mode !== "view",
|
|
@@ -534,16 +557,16 @@ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
534
557
|
} })
|
|
535
558
|
}, t.name || t.label || r))
|
|
536
559
|
});
|
|
537
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ J("div", {
|
|
538
561
|
className: R("w-full", a, e.className),
|
|
539
|
-
children: /* @__PURE__ */
|
|
562
|
+
children: /* @__PURE__ */ Y(D, {
|
|
540
563
|
orientation: k,
|
|
541
564
|
className: "min-h-[300px] rounded-lg border",
|
|
542
|
-
children: [/* @__PURE__ */
|
|
565
|
+
children: [/* @__PURE__ */ J(E, {
|
|
543
566
|
defaultSize: A,
|
|
544
567
|
minSize: 20,
|
|
545
568
|
children: M(w, O.length === 0)
|
|
546
|
-
}), O.length > 0 && /* @__PURE__ */
|
|
569
|
+
}), O.length > 0 && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(T, { withHandle: e.splitResizable !== !1 }), /* @__PURE__ */ J(E, {
|
|
547
570
|
defaultSize: 100 - A,
|
|
548
571
|
minSize: 20,
|
|
549
572
|
children: M(O, !0)
|
|
@@ -839,29 +862,29 @@ var ve = {
|
|
|
839
862
|
onSubmit: D,
|
|
840
863
|
onCancel: N
|
|
841
864
|
};
|
|
842
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ J(O, {
|
|
843
866
|
open: S,
|
|
844
867
|
onOpenChange: e.onOpenChange,
|
|
845
|
-
children: /* @__PURE__ */
|
|
868
|
+
children: /* @__PURE__ */ Y(k, {
|
|
846
869
|
side: C,
|
|
847
870
|
className: R("overflow-y-auto", a, e.className),
|
|
848
871
|
style: P,
|
|
849
|
-
children: [(e.title || e.description) && /* @__PURE__ */
|
|
872
|
+
children: [(e.title || e.description) && /* @__PURE__ */ Y(j, { children: [e.title && /* @__PURE__ */ J(M, { children: e.title }), e.description && /* @__PURE__ */ J(A, { children: e.description })] }), /* @__PURE__ */ J("div", {
|
|
850
873
|
className: "@container py-4",
|
|
851
874
|
children: (() => {
|
|
852
|
-
if (b) return /* @__PURE__ */
|
|
875
|
+
if (b) return /* @__PURE__ */ Y("div", {
|
|
853
876
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
854
|
-
children: [/* @__PURE__ */
|
|
877
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
855
878
|
className: "text-red-800 font-semibold",
|
|
856
879
|
children: "Error loading form"
|
|
857
|
-
}), /* @__PURE__ */
|
|
880
|
+
}), /* @__PURE__ */ J("p", {
|
|
858
881
|
className: "text-red-600 text-sm mt-1",
|
|
859
882
|
children: b.message
|
|
860
883
|
})]
|
|
861
884
|
});
|
|
862
|
-
if (v) return /* @__PURE__ */
|
|
885
|
+
if (v) return /* @__PURE__ */ Y("div", {
|
|
863
886
|
className: "p-8 text-center",
|
|
864
|
-
children: [/* @__PURE__ */
|
|
887
|
+
children: [/* @__PURE__ */ J("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ J("p", {
|
|
865
888
|
className: "mt-2 text-sm text-gray-600",
|
|
866
889
|
children: "Loading form..."
|
|
867
890
|
})]
|
|
@@ -887,13 +910,13 @@ var ve = {
|
|
|
887
910
|
...e,
|
|
888
911
|
hidden: !0
|
|
889
912
|
}))) : t.push(...a);
|
|
890
|
-
}), /* @__PURE__ */
|
|
913
|
+
}), /* @__PURE__ */ J(c, { schema: {
|
|
891
914
|
...F,
|
|
892
915
|
fields: t
|
|
893
916
|
} });
|
|
894
917
|
}
|
|
895
918
|
let t = $(m, d, e.columns, e.mode), n = ve[t.columns || 1];
|
|
896
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ J(c, { schema: {
|
|
897
920
|
...F,
|
|
898
921
|
fields: t.fields,
|
|
899
922
|
columns: t.columns,
|
|
@@ -1092,97 +1115,97 @@ var ve = {
|
|
|
1092
1115
|
h
|
|
1093
1116
|
]), H = t(() => {
|
|
1094
1117
|
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
1095
|
-
}, [e]), te = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", U = e.showSubmit !== !1 && e.mode !== "view",
|
|
1118
|
+
}, [e]), te = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", U = e.showSubmit !== !1 && e.mode !== "view", G = e.showCancel !== !1, K = e.submitText || (e.mode === "create" ? "Create" : "Update"), q = e.cancelText || "Cancel", Z = {
|
|
1096
1119
|
type: "form",
|
|
1097
1120
|
layout: te,
|
|
1098
1121
|
defaultValues: E,
|
|
1099
|
-
submitLabel:
|
|
1100
|
-
cancelLabel:
|
|
1122
|
+
submitLabel: K,
|
|
1123
|
+
cancelLabel: q,
|
|
1101
1124
|
showSubmit: U,
|
|
1102
|
-
showCancel:
|
|
1125
|
+
showCancel: G,
|
|
1103
1126
|
onSubmit: V,
|
|
1104
1127
|
onCancel: H,
|
|
1105
1128
|
showActions: !1,
|
|
1106
1129
|
id: I
|
|
1107
|
-
},
|
|
1108
|
-
if (A) return /* @__PURE__ */
|
|
1130
|
+
}, Q = () => {
|
|
1131
|
+
if (A) return /* @__PURE__ */ Y("div", {
|
|
1109
1132
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
1111
1134
|
className: "text-red-800 font-semibold",
|
|
1112
1135
|
children: "Error loading form"
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1136
|
+
}), /* @__PURE__ */ J("p", {
|
|
1114
1137
|
className: "text-red-600 text-sm mt-1",
|
|
1115
1138
|
children: A.message
|
|
1116
1139
|
})]
|
|
1117
1140
|
});
|
|
1118
|
-
if (O) return /* @__PURE__ */
|
|
1141
|
+
if (O) return /* @__PURE__ */ J("div", {
|
|
1119
1142
|
className: "space-y-4",
|
|
1120
1143
|
"data-testid": "modal-form-skeleton",
|
|
1121
1144
|
children: [
|
|
1122
1145
|
1,
|
|
1123
1146
|
2,
|
|
1124
1147
|
3
|
|
1125
|
-
].map((e) => /* @__PURE__ */
|
|
1148
|
+
].map((e) => /* @__PURE__ */ Y("div", {
|
|
1126
1149
|
className: "space-y-2",
|
|
1127
|
-
children: [/* @__PURE__ */
|
|
1150
|
+
children: [/* @__PURE__ */ J(N, { className: "h-4 w-24" }), /* @__PURE__ */ J(N, { className: "h-10 w-full" })]
|
|
1128
1151
|
}, e))
|
|
1129
1152
|
});
|
|
1130
|
-
if (e.sections?.length) return /* @__PURE__ */
|
|
1153
|
+
if (e.sections?.length) return /* @__PURE__ */ J("div", {
|
|
1131
1154
|
className: "space-y-6",
|
|
1132
1155
|
children: e.sections.map((e, t) => {
|
|
1133
1156
|
let n = e.columns || 1;
|
|
1134
|
-
return /* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ J(X, {
|
|
1135
1158
|
label: e.label,
|
|
1136
1159
|
description: e.description,
|
|
1137
1160
|
columns: n,
|
|
1138
1161
|
gridClassName: xe[n],
|
|
1139
|
-
children: /* @__PURE__ */
|
|
1140
|
-
...
|
|
1162
|
+
children: /* @__PURE__ */ J(c, { schema: {
|
|
1163
|
+
...Z,
|
|
1141
1164
|
fields: g(ee(e))
|
|
1142
1165
|
} })
|
|
1143
1166
|
}, e.name || e.label || t);
|
|
1144
1167
|
})
|
|
1145
1168
|
});
|
|
1146
1169
|
let t = L ?? $(y, _, e.columns, e.mode), n = xe[t.columns || 1];
|
|
1147
|
-
return /* @__PURE__ */
|
|
1148
|
-
...
|
|
1170
|
+
return /* @__PURE__ */ J(c, { schema: {
|
|
1171
|
+
...Z,
|
|
1149
1172
|
fields: g(t.fields),
|
|
1150
1173
|
columns: t.columns,
|
|
1151
1174
|
...n ? { fieldContainerClass: n } : {}
|
|
1152
1175
|
} });
|
|
1153
|
-
},
|
|
1154
|
-
return /* @__PURE__ */
|
|
1176
|
+
}, ne = !O && !A && (U || G);
|
|
1177
|
+
return /* @__PURE__ */ J(b, {
|
|
1155
1178
|
open: F,
|
|
1156
1179
|
onOpenChange: e.onOpenChange,
|
|
1157
|
-
children: /* @__PURE__ */
|
|
1180
|
+
children: /* @__PURE__ */ Y(w, {
|
|
1158
1181
|
className: R(z, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", s, e.className),
|
|
1159
1182
|
children: [
|
|
1160
|
-
(e.title || e.description) && /* @__PURE__ */
|
|
1183
|
+
(e.title || e.description) && /* @__PURE__ */ Y(S, {
|
|
1161
1184
|
className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
|
|
1162
|
-
children: [e.title && /* @__PURE__ */
|
|
1185
|
+
children: [e.title && /* @__PURE__ */ J(C, { children: e.title }), e.description && /* @__PURE__ */ J(x, { children: e.description })]
|
|
1163
1186
|
}),
|
|
1164
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ J("div", {
|
|
1165
1188
|
className: "@container flex-1 overflow-y-auto px-4 sm:px-6 py-4",
|
|
1166
|
-
children:
|
|
1189
|
+
children: Q()
|
|
1167
1190
|
}),
|
|
1168
|
-
|
|
1191
|
+
ne && /* @__PURE__ */ J("div", {
|
|
1169
1192
|
className: "shrink-0 border-t px-4 sm:px-6 py-3 bg-background",
|
|
1170
1193
|
"data-testid": "modal-form-footer",
|
|
1171
|
-
children: /* @__PURE__ */
|
|
1194
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1172
1195
|
className: "flex flex-col sm:flex-row gap-2 sm:justify-end",
|
|
1173
|
-
children: [
|
|
1196
|
+
children: [G && /* @__PURE__ */ J(m, {
|
|
1174
1197
|
type: "button",
|
|
1175
1198
|
variant: "outline",
|
|
1176
1199
|
onClick: H,
|
|
1177
1200
|
disabled: M,
|
|
1178
1201
|
className: "w-full sm:w-auto",
|
|
1179
|
-
children:
|
|
1180
|
-
}), U && /* @__PURE__ */
|
|
1202
|
+
children: q
|
|
1203
|
+
}), U && /* @__PURE__ */ Y(m, {
|
|
1181
1204
|
type: "submit",
|
|
1182
1205
|
form: I,
|
|
1183
1206
|
disabled: M,
|
|
1184
1207
|
className: "w-full sm:w-auto",
|
|
1185
|
-
children: [M && /* @__PURE__ */
|
|
1208
|
+
children: [M && /* @__PURE__ */ J(W, { className: "mr-2 h-4 w-4 animate-spin" }), K]
|
|
1186
1209
|
})]
|
|
1187
1210
|
})
|
|
1188
1211
|
})
|
|
@@ -1206,7 +1229,7 @@ var ve = {
|
|
|
1206
1229
|
}))
|
|
1207
1230
|
};
|
|
1208
1231
|
}, [e, n]), { sectionLabel: a } = l(), o = (e) => e?.name ? a(r.objectName, e.name, e.label || e.name) : e?.label;
|
|
1209
|
-
if (r.formType === "tabbed" && r.sections?.length) return /* @__PURE__ */
|
|
1232
|
+
if (r.formType === "tabbed" && r.sections?.length) return /* @__PURE__ */ J(Z, {
|
|
1210
1233
|
schema: {
|
|
1211
1234
|
...r,
|
|
1212
1235
|
formType: "tabbed",
|
|
@@ -1223,7 +1246,7 @@ var ve = {
|
|
|
1223
1246
|
dataSource: t,
|
|
1224
1247
|
className: r.className
|
|
1225
1248
|
});
|
|
1226
|
-
if (r.formType === "wizard" && r.sections?.length) return /* @__PURE__ */
|
|
1249
|
+
if (r.formType === "wizard" && r.sections?.length) return /* @__PURE__ */ J(Q, {
|
|
1227
1250
|
schema: {
|
|
1228
1251
|
...r,
|
|
1229
1252
|
formType: "wizard",
|
|
@@ -1243,7 +1266,7 @@ var ve = {
|
|
|
1243
1266
|
dataSource: t,
|
|
1244
1267
|
className: r.className
|
|
1245
1268
|
});
|
|
1246
|
-
if (r.formType === "split" && r.sections?.length) return /* @__PURE__ */
|
|
1269
|
+
if (r.formType === "split" && r.sections?.length) return /* @__PURE__ */ J(ne, {
|
|
1247
1270
|
schema: {
|
|
1248
1271
|
...r,
|
|
1249
1272
|
formType: "split",
|
|
@@ -1263,7 +1286,7 @@ var ve = {
|
|
|
1263
1286
|
});
|
|
1264
1287
|
if (r.formType === "drawer") {
|
|
1265
1288
|
let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
|
|
1266
|
-
return /* @__PURE__ */
|
|
1289
|
+
return /* @__PURE__ */ J(ye, {
|
|
1267
1290
|
schema: {
|
|
1268
1291
|
...n,
|
|
1269
1292
|
layout: i,
|
|
@@ -1288,7 +1311,7 @@ var ve = {
|
|
|
1288
1311
|
}
|
|
1289
1312
|
if (r.formType === "modal") {
|
|
1290
1313
|
let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
|
|
1291
|
-
return /* @__PURE__ */
|
|
1314
|
+
return /* @__PURE__ */ J(Se, {
|
|
1292
1315
|
schema: {
|
|
1293
1316
|
...n,
|
|
1294
1317
|
layout: i,
|
|
@@ -1309,7 +1332,7 @@ var ve = {
|
|
|
1309
1332
|
className: r.className
|
|
1310
1333
|
});
|
|
1311
1334
|
}
|
|
1312
|
-
return /* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ J(we, {
|
|
1313
1336
|
schema: r,
|
|
1314
1337
|
dataSource: t
|
|
1315
1338
|
});
|
|
@@ -1472,35 +1495,36 @@ var ve = {
|
|
|
1472
1495
|
}, [_]),
|
|
1473
1496
|
...x
|
|
1474
1497
|
};
|
|
1475
|
-
if (T) return /* @__PURE__ */
|
|
1498
|
+
if (T) return /* @__PURE__ */ Y("div", {
|
|
1476
1499
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1477
|
-
children: [/* @__PURE__ */
|
|
1500
|
+
children: [/* @__PURE__ */ J("h3", {
|
|
1478
1501
|
className: "text-red-800 font-semibold",
|
|
1479
1502
|
children: "Error loading form"
|
|
1480
|
-
}), /* @__PURE__ */
|
|
1503
|
+
}), /* @__PURE__ */ J("p", {
|
|
1481
1504
|
className: "text-red-600 text-sm mt-1",
|
|
1482
1505
|
children: T.message
|
|
1483
1506
|
})]
|
|
1484
1507
|
});
|
|
1485
|
-
if (C) return /* @__PURE__ */
|
|
1508
|
+
if (C) return /* @__PURE__ */ Y("div", {
|
|
1486
1509
|
className: "p-4 sm:p-8 text-center",
|
|
1487
|
-
children: [/* @__PURE__ */
|
|
1510
|
+
children: [/* @__PURE__ */ J("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ J("p", {
|
|
1488
1511
|
className: "mt-2 text-sm text-gray-600",
|
|
1489
1512
|
children: "Loading form..."
|
|
1490
1513
|
})]
|
|
1491
1514
|
});
|
|
1492
1515
|
let M = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : "vertical";
|
|
1493
|
-
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */
|
|
1516
|
+
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ J("div", {
|
|
1494
1517
|
className: "w-full space-y-6",
|
|
1495
1518
|
children: r.sections.map((e, t) => {
|
|
1496
1519
|
let n = e.fields.map((e) => typeof e == "string" ? e : e.name), i = g(y.filter((e) => n.includes(e.name)));
|
|
1497
|
-
return /* @__PURE__ */
|
|
1520
|
+
return /* @__PURE__ */ J(X, {
|
|
1498
1521
|
label: e.name ? s(r.objectName, e.name, e.label || e.name) : e.label,
|
|
1499
1522
|
description: e.description,
|
|
1500
1523
|
collapsible: e.collapsible,
|
|
1501
1524
|
collapsed: e.collapsed,
|
|
1502
1525
|
columns: e.columns,
|
|
1503
|
-
|
|
1526
|
+
showBorder: e.showBorder,
|
|
1527
|
+
children: /* @__PURE__ */ J(c, { schema: {
|
|
1504
1528
|
type: "form",
|
|
1505
1529
|
fields: i,
|
|
1506
1530
|
layout: M,
|
|
@@ -1535,7 +1559,7 @@ var ve = {
|
|
|
1535
1559
|
fields: r
|
|
1536
1560
|
});
|
|
1537
1561
|
}
|
|
1538
|
-
return /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ J(Q, {
|
|
1539
1563
|
schema: {
|
|
1540
1564
|
...r,
|
|
1541
1565
|
formType: "wizard",
|
|
@@ -1562,10 +1586,10 @@ var ve = {
|
|
|
1562
1586
|
className: r.className,
|
|
1563
1587
|
mobileStickyActions: !!I?.stickyActions
|
|
1564
1588
|
};
|
|
1565
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ J("div", {
|
|
1566
1590
|
className: I?.stickyActions ? "w-full pb-20 md:pb-0" : "w-full",
|
|
1567
1591
|
"data-mobile-form": I ? "true" : void 0,
|
|
1568
|
-
children: /* @__PURE__ */
|
|
1592
|
+
children: /* @__PURE__ */ J(c, { schema: H })
|
|
1569
1593
|
});
|
|
1570
1594
|
}, Te = {
|
|
1571
1595
|
text: 200,
|
|
@@ -1671,35 +1695,35 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1671
1695
|
}, [e.branding]);
|
|
1672
1696
|
if (l) {
|
|
1673
1697
|
let t = e.thankYouPage, n = e.texts ?? {}, r = Math.ceil((t?.redirectDelay ?? 3e3) / 1e3), i = (n.redirecting ?? "Redirecting in {{seconds}} seconds…").replace("{{seconds}}", String(r));
|
|
1674
|
-
return /* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ J("div", {
|
|
1675
1699
|
className: `min-h-screen flex items-center justify-center p-4 bg-gradient-to-b from-muted/40 via-background to-background ${c || ""}`,
|
|
1676
1700
|
style: k,
|
|
1677
|
-
children: /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1678
1702
|
className: "max-w-md w-full bg-card border rounded-xl shadow-sm p-8 text-center space-y-4",
|
|
1679
1703
|
children: [
|
|
1680
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ J("div", {
|
|
1681
1705
|
className: "mx-auto inline-flex h-14 w-14 items-center justify-center rounded-full bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
1682
|
-
children: /* @__PURE__ */
|
|
1706
|
+
children: /* @__PURE__ */ J(V, {
|
|
1683
1707
|
className: "h-8 w-8",
|
|
1684
1708
|
"aria-hidden": "true"
|
|
1685
1709
|
})
|
|
1686
1710
|
}),
|
|
1687
|
-
/* @__PURE__ */
|
|
1711
|
+
/* @__PURE__ */ J("h2", {
|
|
1688
1712
|
className: "text-xl font-semibold text-foreground",
|
|
1689
1713
|
children: t?.title || n.thankYouTitle || "Thank You!"
|
|
1690
1714
|
}),
|
|
1691
|
-
/* @__PURE__ */
|
|
1715
|
+
/* @__PURE__ */ J("p", {
|
|
1692
1716
|
className: "text-sm text-muted-foreground",
|
|
1693
1717
|
children: t?.message || n.thankYouMessage || "Your submission has been received successfully."
|
|
1694
1718
|
}),
|
|
1695
|
-
e.allowMultiple && /* @__PURE__ */
|
|
1719
|
+
e.allowMultiple && /* @__PURE__ */ J(m, {
|
|
1696
1720
|
variant: "outline",
|
|
1697
1721
|
size: "sm",
|
|
1698
1722
|
onClick: O,
|
|
1699
1723
|
className: "mt-2",
|
|
1700
1724
|
children: n.submitAnother ?? "Submit Another Response"
|
|
1701
1725
|
}),
|
|
1702
|
-
t?.redirectUrl && /* @__PURE__ */
|
|
1726
|
+
t?.redirectUrl && /* @__PURE__ */ J("p", {
|
|
1703
1727
|
className: "text-xs text-muted-foreground",
|
|
1704
1728
|
children: i
|
|
1705
1729
|
})
|
|
@@ -1708,51 +1732,51 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1708
1732
|
});
|
|
1709
1733
|
}
|
|
1710
1734
|
let A = e.texts ?? {}, j = !!e.consent?.required, M = `${e.formId}-consent`;
|
|
1711
|
-
return /* @__PURE__ */
|
|
1735
|
+
return /* @__PURE__ */ J("div", {
|
|
1712
1736
|
className: `min-h-screen flex items-center justify-center p-4 sm:p-6 bg-gradient-to-b from-muted/40 via-background to-background ${c || ""}`,
|
|
1713
1737
|
style: k,
|
|
1714
|
-
children: /* @__PURE__ */
|
|
1738
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1715
1739
|
className: "max-w-2xl w-full bg-card border rounded-xl shadow-sm overflow-hidden",
|
|
1716
1740
|
children: [
|
|
1717
|
-
e.branding?.coverImage && /* @__PURE__ */
|
|
1741
|
+
e.branding?.coverImage && /* @__PURE__ */ J("div", {
|
|
1718
1742
|
className: "h-28 sm:h-32 w-full bg-cover bg-center",
|
|
1719
1743
|
style: { backgroundImage: `url(${JSON.stringify(e.branding.coverImage)})` },
|
|
1720
1744
|
role: "presentation"
|
|
1721
1745
|
}),
|
|
1722
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ Y("div", {
|
|
1723
1747
|
className: "px-6 sm:px-8 pt-7 pb-5 border-b bg-muted/20",
|
|
1724
1748
|
style: e.branding?.primaryColor ? { borderBottomColor: e.branding.primaryColor } : void 0,
|
|
1725
1749
|
children: [
|
|
1726
|
-
e.branding?.logo && /* @__PURE__ */
|
|
1750
|
+
e.branding?.logo && /* @__PURE__ */ J("img", {
|
|
1727
1751
|
src: e.branding.logo,
|
|
1728
1752
|
alt: "",
|
|
1729
1753
|
className: "h-8 mb-4"
|
|
1730
1754
|
}),
|
|
1731
|
-
e.title && /* @__PURE__ */
|
|
1755
|
+
e.title && /* @__PURE__ */ J("h1", {
|
|
1732
1756
|
className: "text-2xl font-semibold tracking-tight text-foreground",
|
|
1733
1757
|
children: e.title
|
|
1734
1758
|
}),
|
|
1735
|
-
e.description && /* @__PURE__ */
|
|
1759
|
+
e.description && /* @__PURE__ */ J("p", {
|
|
1736
1760
|
className: "text-sm text-muted-foreground mt-2 leading-relaxed",
|
|
1737
1761
|
children: e.description
|
|
1738
1762
|
}),
|
|
1739
|
-
/* @__PURE__ */
|
|
1763
|
+
/* @__PURE__ */ J("p", {
|
|
1740
1764
|
className: "text-[11px] text-muted-foreground/70 mt-3",
|
|
1741
1765
|
"aria-hidden": "true",
|
|
1742
1766
|
children: A.requiredHint ?? "* Required field"
|
|
1743
1767
|
})
|
|
1744
1768
|
]
|
|
1745
1769
|
}),
|
|
1746
|
-
/* @__PURE__ */
|
|
1770
|
+
/* @__PURE__ */ Y("div", {
|
|
1747
1771
|
className: "relative px-6 sm:px-8 py-6",
|
|
1748
1772
|
children: [
|
|
1749
|
-
p && /* @__PURE__ */
|
|
1773
|
+
p && /* @__PURE__ */ J("div", {
|
|
1750
1774
|
role: "alert",
|
|
1751
1775
|
"aria-live": "assertive",
|
|
1752
1776
|
className: "mb-4 p-3 bg-destructive/10 border border-destructive/30 rounded-md text-sm text-destructive",
|
|
1753
1777
|
children: p
|
|
1754
1778
|
}),
|
|
1755
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ J(Ce, {
|
|
1756
1780
|
schema: {
|
|
1757
1781
|
type: "object-form",
|
|
1758
1782
|
objectName: e.objectName,
|
|
@@ -1765,13 +1789,13 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1765
1789
|
},
|
|
1766
1790
|
dataSource: T
|
|
1767
1791
|
}),
|
|
1768
|
-
S && /* @__PURE__ */
|
|
1792
|
+
S && /* @__PURE__ */ Y("div", {
|
|
1769
1793
|
"aria-hidden": "true",
|
|
1770
1794
|
className: "absolute left-[-10000px] top-auto h-px w-px overflow-hidden",
|
|
1771
|
-
children: [/* @__PURE__ */
|
|
1795
|
+
children: [/* @__PURE__ */ J("label", {
|
|
1772
1796
|
htmlFor: `${e.formId}-${S}`,
|
|
1773
1797
|
children: "Do not fill this field"
|
|
1774
|
-
}), /* @__PURE__ */
|
|
1798
|
+
}), /* @__PURE__ */ J("input", {
|
|
1775
1799
|
ref: b,
|
|
1776
1800
|
id: `${e.formId}-${S}`,
|
|
1777
1801
|
type: "text",
|
|
@@ -1781,11 +1805,11 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1781
1805
|
defaultValue: ""
|
|
1782
1806
|
})]
|
|
1783
1807
|
}),
|
|
1784
|
-
e.consent && /* @__PURE__ */
|
|
1808
|
+
e.consent && /* @__PURE__ */ Y("div", {
|
|
1785
1809
|
className: "mt-4",
|
|
1786
|
-
children: [/* @__PURE__ */
|
|
1810
|
+
children: [/* @__PURE__ */ Y("label", {
|
|
1787
1811
|
className: "flex items-start gap-2 text-sm text-foreground cursor-pointer select-none",
|
|
1788
|
-
children: [/* @__PURE__ */
|
|
1812
|
+
children: [/* @__PURE__ */ J("input", {
|
|
1789
1813
|
type: "checkbox",
|
|
1790
1814
|
id: M,
|
|
1791
1815
|
checked: g,
|
|
@@ -1796,16 +1820,16 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1796
1820
|
"aria-invalid": v ? "true" : void 0,
|
|
1797
1821
|
"aria-describedby": v ? `${M}-error` : void 0,
|
|
1798
1822
|
className: "mt-0.5 h-4 w-4 rounded border-input accent-primary"
|
|
1799
|
-
}), /* @__PURE__ */
|
|
1823
|
+
}), /* @__PURE__ */ Y("span", {
|
|
1800
1824
|
className: "leading-relaxed",
|
|
1801
1825
|
children: [
|
|
1802
1826
|
e.consent.label ?? A.consentLabelDefault ?? "I agree to the privacy policy.",
|
|
1803
|
-
j && /* @__PURE__ */
|
|
1827
|
+
j && /* @__PURE__ */ J("span", {
|
|
1804
1828
|
"aria-hidden": "true",
|
|
1805
1829
|
className: "text-destructive ml-0.5",
|
|
1806
1830
|
children: "*"
|
|
1807
1831
|
}),
|
|
1808
|
-
e.consent.privacyUrl && /* @__PURE__ */
|
|
1832
|
+
e.consent.privacyUrl && /* @__PURE__ */ Y(q, { children: [" ", /* @__PURE__ */ J("a", {
|
|
1809
1833
|
href: e.consent.privacyUrl,
|
|
1810
1834
|
target: "_blank",
|
|
1811
1835
|
rel: "noopener noreferrer",
|
|
@@ -1814,42 +1838,42 @@ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
|
|
|
1814
1838
|
})] })
|
|
1815
1839
|
]
|
|
1816
1840
|
})]
|
|
1817
|
-
}), v && /* @__PURE__ */
|
|
1841
|
+
}), v && /* @__PURE__ */ J("p", {
|
|
1818
1842
|
id: `${M}-error`,
|
|
1819
1843
|
role: "alert",
|
|
1820
1844
|
className: "mt-1.5 text-xs text-destructive",
|
|
1821
1845
|
children: v
|
|
1822
1846
|
})]
|
|
1823
1847
|
}),
|
|
1824
|
-
d && /* @__PURE__ */
|
|
1848
|
+
d && /* @__PURE__ */ Y("div", {
|
|
1825
1849
|
className: "mt-3 flex items-center gap-2 text-xs text-muted-foreground",
|
|
1826
|
-
children: [/* @__PURE__ */
|
|
1850
|
+
children: [/* @__PURE__ */ J(W, {
|
|
1827
1851
|
className: "h-3.5 w-3.5 animate-spin",
|
|
1828
1852
|
"aria-hidden": "true"
|
|
1829
|
-
}), /* @__PURE__ */
|
|
1853
|
+
}), /* @__PURE__ */ J("span", { children: A.submitting ?? "Submitting…" })]
|
|
1830
1854
|
})
|
|
1831
1855
|
]
|
|
1832
1856
|
}),
|
|
1833
|
-
/* @__PURE__ */
|
|
1857
|
+
/* @__PURE__ */ Y("div", {
|
|
1834
1858
|
className: "px-6 sm:px-8 py-4 border-t bg-muted/20 flex flex-col sm:flex-row items-center justify-between gap-2",
|
|
1835
|
-
children: [/* @__PURE__ */
|
|
1859
|
+
children: [/* @__PURE__ */ Y("p", {
|
|
1836
1860
|
className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
1837
|
-
children: [/* @__PURE__ */
|
|
1861
|
+
children: [/* @__PURE__ */ J(G, {
|
|
1838
1862
|
className: "h-3 w-3",
|
|
1839
1863
|
"aria-hidden": "true"
|
|
1840
|
-
}), /* @__PURE__ */
|
|
1841
|
-
}), /* @__PURE__ */
|
|
1864
|
+
}), /* @__PURE__ */ J("span", { children: A.secureNotice ?? "Your information is transmitted securely and only used to respond to your request." })]
|
|
1865
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1842
1866
|
className: "flex items-center gap-3 text-xs text-muted-foreground/80",
|
|
1843
|
-
children: [e.privacyPolicyUrl && /* @__PURE__ */
|
|
1867
|
+
children: [e.privacyPolicyUrl && /* @__PURE__ */ Y("a", {
|
|
1844
1868
|
href: e.privacyPolicyUrl,
|
|
1845
1869
|
target: "_blank",
|
|
1846
1870
|
rel: "noopener noreferrer",
|
|
1847
1871
|
className: "inline-flex items-center gap-1 underline hover:text-foreground",
|
|
1848
|
-
children: [/* @__PURE__ */
|
|
1872
|
+
children: [/* @__PURE__ */ J(K, {
|
|
1849
1873
|
className: "h-3 w-3",
|
|
1850
1874
|
"aria-hidden": "true"
|
|
1851
1875
|
}), A.consentLink ?? "Privacy policy"]
|
|
1852
|
-
}), /* @__PURE__ */
|
|
1876
|
+
}), /* @__PURE__ */ J("span", { children: A.poweredBy ?? "Powered by ObjectStack" })]
|
|
1853
1877
|
})]
|
|
1854
1878
|
})
|
|
1855
1879
|
]
|
|
@@ -1867,87 +1891,87 @@ var Me = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1867
1891
|
let e = n.totalSubmissions + n.abandonedSubmissions;
|
|
1868
1892
|
return e === 0 ? 0 : Math.round(n.totalSubmissions / e * 100);
|
|
1869
1893
|
}, [n.totalSubmissions, n.abandonedSubmissions]), o = i(() => n.dailySubmissions?.length ? Math.max(...n.dailySubmissions.map((e) => e.count), 1) : 1, [n.dailySubmissions]);
|
|
1870
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ Y("div", {
|
|
1871
1895
|
className: `space-y-4 ${r || ""}`,
|
|
1872
1896
|
children: [
|
|
1873
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("h2", {
|
|
1874
1898
|
className: "text-lg font-semibold text-foreground",
|
|
1875
1899
|
children: t || "Form Analytics"
|
|
1876
|
-
}), /* @__PURE__ */
|
|
1900
|
+
}), /* @__PURE__ */ Y("p", {
|
|
1877
1901
|
className: "text-sm text-muted-foreground",
|
|
1878
1902
|
children: ["Form ID: ", e]
|
|
1879
1903
|
})] }),
|
|
1880
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ Y("div", {
|
|
1881
1905
|
className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
1882
1906
|
children: [
|
|
1883
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ J(h, { children: /* @__PURE__ */ Y(v, {
|
|
1884
1908
|
className: "pb-2",
|
|
1885
|
-
children: [/* @__PURE__ */
|
|
1909
|
+
children: [/* @__PURE__ */ J(_, { children: "Total Submissions" }), /* @__PURE__ */ J(y, {
|
|
1886
1910
|
className: "text-2xl",
|
|
1887
1911
|
children: n.totalSubmissions.toLocaleString()
|
|
1888
1912
|
})]
|
|
1889
1913
|
}) }),
|
|
1890
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ Y(h, { children: [/* @__PURE__ */ Y(v, {
|
|
1891
1915
|
className: "pb-2",
|
|
1892
|
-
children: [/* @__PURE__ */
|
|
1916
|
+
children: [/* @__PURE__ */ J(_, { children: "Fill Rate" }), /* @__PURE__ */ Y(y, {
|
|
1893
1917
|
className: "text-2xl",
|
|
1894
1918
|
children: [a, "%"]
|
|
1895
1919
|
})]
|
|
1896
|
-
}), /* @__PURE__ */
|
|
1920
|
+
}), /* @__PURE__ */ J(g, { children: /* @__PURE__ */ J("div", {
|
|
1897
1921
|
className: "w-full bg-muted rounded-full h-2",
|
|
1898
|
-
children: /* @__PURE__ */
|
|
1922
|
+
children: /* @__PURE__ */ J("div", {
|
|
1899
1923
|
className: "bg-primary rounded-full h-2 transition-all",
|
|
1900
1924
|
style: { width: `${a}%` }
|
|
1901
1925
|
})
|
|
1902
1926
|
}) })] }),
|
|
1903
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ J(h, { children: /* @__PURE__ */ Y(v, {
|
|
1904
1928
|
className: "pb-2",
|
|
1905
|
-
children: [/* @__PURE__ */
|
|
1929
|
+
children: [/* @__PURE__ */ J(_, { children: "Avg. Completion Time" }), /* @__PURE__ */ J(y, {
|
|
1906
1930
|
className: "text-2xl",
|
|
1907
1931
|
children: n.avgCompletionTime ? je(n.avgCompletionTime) : "—"
|
|
1908
1932
|
})]
|
|
1909
1933
|
}) })
|
|
1910
1934
|
]
|
|
1911
1935
|
}),
|
|
1912
|
-
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */
|
|
1936
|
+
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ Y(h, { children: [/* @__PURE__ */ J(v, { children: /* @__PURE__ */ J(y, {
|
|
1913
1937
|
className: "text-sm font-medium",
|
|
1914
1938
|
children: "Daily Submissions"
|
|
1915
|
-
}) }), /* @__PURE__ */
|
|
1939
|
+
}) }), /* @__PURE__ */ J(g, { children: /* @__PURE__ */ J("div", {
|
|
1916
1940
|
className: "flex items-end gap-1 h-32",
|
|
1917
|
-
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */
|
|
1941
|
+
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
1918
1942
|
className: "flex-1 flex flex-col items-center gap-1",
|
|
1919
|
-
children: [/* @__PURE__ */
|
|
1943
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1920
1944
|
className: "w-full bg-primary/80 rounded-t transition-all hover:bg-primary",
|
|
1921
1945
|
style: {
|
|
1922
1946
|
height: `${e.count / o * 100}%`,
|
|
1923
1947
|
minHeight: e.count > 0 ? "4px" : "0"
|
|
1924
1948
|
},
|
|
1925
1949
|
title: `${e.date}: ${e.count} submissions`
|
|
1926
|
-
}), /* @__PURE__ */
|
|
1950
|
+
}), /* @__PURE__ */ J("span", {
|
|
1927
1951
|
className: "text-[10px] text-muted-foreground truncate w-full text-center",
|
|
1928
1952
|
children: e.date.slice(-5)
|
|
1929
1953
|
})]
|
|
1930
1954
|
}, t))
|
|
1931
1955
|
}) })] }),
|
|
1932
|
-
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */
|
|
1956
|
+
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ Y(h, { children: [/* @__PURE__ */ Y(v, { children: [/* @__PURE__ */ J(y, {
|
|
1933
1957
|
className: "text-sm font-medium",
|
|
1934
1958
|
children: "Field Completion Rates"
|
|
1935
|
-
}), /* @__PURE__ */
|
|
1959
|
+
}), /* @__PURE__ */ J(_, { children: "Percentage of users who completed each field" })] }), /* @__PURE__ */ J(g, { children: /* @__PURE__ */ J("div", {
|
|
1936
1960
|
className: "space-y-3",
|
|
1937
|
-
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */
|
|
1961
|
+
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
1938
1962
|
className: "space-y-1",
|
|
1939
|
-
children: [/* @__PURE__ */
|
|
1963
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1940
1964
|
className: "flex justify-between text-sm",
|
|
1941
|
-
children: [/* @__PURE__ */
|
|
1965
|
+
children: [/* @__PURE__ */ J("span", {
|
|
1942
1966
|
className: "text-foreground",
|
|
1943
1967
|
children: e.label
|
|
1944
|
-
}), /* @__PURE__ */
|
|
1968
|
+
}), /* @__PURE__ */ Y("span", {
|
|
1945
1969
|
className: "text-muted-foreground",
|
|
1946
1970
|
children: [e.completionRate, "%"]
|
|
1947
1971
|
})]
|
|
1948
|
-
}), /* @__PURE__ */
|
|
1972
|
+
}), /* @__PURE__ */ J("div", {
|
|
1949
1973
|
className: "w-full bg-muted rounded-full h-1.5",
|
|
1950
|
-
children: /* @__PURE__ */
|
|
1974
|
+
children: /* @__PURE__ */ J("div", {
|
|
1951
1975
|
className: `rounded-full h-1.5 transition-all ${e.completionRate >= 80 ? "bg-green-500" : e.completionRate >= 50 ? "bg-yellow-500" : "bg-destructive"}`,
|
|
1952
1976
|
style: { width: `${e.completionRate}%` }
|
|
1953
1977
|
})
|
|
@@ -1956,7 +1980,7 @@ var Me = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1956
1980
|
}) })] })
|
|
1957
1981
|
]
|
|
1958
1982
|
});
|
|
1959
|
-
}, Ne = ({ schema: e }) => /* @__PURE__ */
|
|
1983
|
+
}, Ne = ({ schema: e }) => /* @__PURE__ */ J(Ce, { schema: e });
|
|
1960
1984
|
s.register("object-form", Ne, {
|
|
1961
1985
|
namespace: "plugin-form",
|
|
1962
1986
|
label: "Object Form",
|
|
@@ -2126,7 +2150,7 @@ s.register("object-form", Ne, {
|
|
|
2126
2150
|
]
|
|
2127
2151
|
}
|
|
2128
2152
|
]
|
|
2129
|
-
}), s.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */
|
|
2153
|
+
}), s.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ J(Ae, { config: e }), {
|
|
2130
2154
|
namespace: "plugin-form",
|
|
2131
2155
|
label: "Embeddable Form",
|
|
2132
2156
|
category: "plugin",
|
|
@@ -2164,7 +2188,7 @@ s.register("object-form", Ne, {
|
|
|
2164
2188
|
label: "Allow Multiple Submissions"
|
|
2165
2189
|
}
|
|
2166
2190
|
]
|
|
2167
|
-
}), s.register("form-analytics", ({ schema: e }) => /* @__PURE__ */
|
|
2191
|
+
}), s.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ J(Me, {
|
|
2168
2192
|
formId: e.formId,
|
|
2169
2193
|
formTitle: e.formTitle,
|
|
2170
2194
|
metrics: e.metrics || { totalSubmissions: 0 }
|
|
@@ -2192,4 +2216,4 @@ s.register("object-form", Ne, {
|
|
|
2192
2216
|
]
|
|
2193
2217
|
});
|
|
2194
2218
|
//#endregion
|
|
2195
|
-
export { ye as DrawerForm, Ae as EmbeddableForm, Me as FormAnalytics,
|
|
2219
|
+
export { ye as DrawerForm, Ae as EmbeddableForm, Me as FormAnalytics, X as FormSection, Se as ModalForm, Ce as ObjectForm, ne as SplitForm, Z as TabbedForm, Q as WizardForm, le as applyAutoColSpan, $ as applyAutoLayout, pe as filterAutoGeneratedFields, fe as filterCreateModeFields, de as filterSystemFields, ce as inferColumns, me as inferModalSize, se as isAutoGeneratedFieldType, oe as isWideFieldType };
|