@object-ui/plugin-form 4.0.1 → 4.0.4
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 +39 -0
- package/dist/index.js +202 -379
- package/dist/index.umd.cjs +1 -6
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -4,210 +4,33 @@ import { SchemaRenderer as s, useSafeFieldLabel as c } from "@object-ui/react";
|
|
|
4
4
|
import { buildValidationRules as l, evaluateCondition as u, formatFileSize as d, mapFieldTypeToFormType as f } from "@object-ui/fields";
|
|
5
5
|
import { Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v, Dialog as y, DialogDescription as b, DialogHeader as x, DialogTitle as S, MobileDialogContent as C, ResizableHandle as w, ResizablePanel as T, ResizablePanelGroup as E, Sheet as D, SheetContent as O, SheetDescription as k, SheetHeader as A, SheetTitle as j, Skeleton as M, Tabs as N, TabsContent as P, TabsList as F, TabsTrigger as I, cn as L, useIsMobile as R } from "@object-ui/components";
|
|
6
6
|
import { Check as z, ChevronDown as ee, ChevronLeft as B, ChevronRight as V, Loader2 as te } from "lucide-react";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
11
|
-
}), W = /* @__PURE__ */ H(((e) => {
|
|
12
|
-
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
13
|
-
function r(e, n, r) {
|
|
14
|
-
var i = null;
|
|
15
|
-
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
16
|
-
else r = n;
|
|
17
|
-
return n = r.ref, {
|
|
18
|
-
$$typeof: t,
|
|
19
|
-
type: e,
|
|
20
|
-
key: i,
|
|
21
|
-
ref: n === void 0 ? null : n,
|
|
22
|
-
props: r
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
26
|
-
})), ne = /* @__PURE__ */ H(((e) => {
|
|
27
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
28
|
-
function t(e) {
|
|
29
|
-
if (e == null) return null;
|
|
30
|
-
if (typeof e == "function") return e.$$typeof === O ? null : e.displayName || e.name || null;
|
|
31
|
-
if (typeof e == "string") return e;
|
|
32
|
-
switch (e) {
|
|
33
|
-
case _: return "Fragment";
|
|
34
|
-
case y: return "Profiler";
|
|
35
|
-
case v: return "StrictMode";
|
|
36
|
-
case C: return "Suspense";
|
|
37
|
-
case w: return "SuspenseList";
|
|
38
|
-
case D: return "Activity";
|
|
39
|
-
}
|
|
40
|
-
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
41
|
-
case g: return "Portal";
|
|
42
|
-
case x: return e.displayName || "Context";
|
|
43
|
-
case b: return (e._context.displayName || "Context") + ".Consumer";
|
|
44
|
-
case S:
|
|
45
|
-
var n = e.render;
|
|
46
|
-
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
47
|
-
case T: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
48
|
-
case E:
|
|
49
|
-
n = e._payload, e = e._init;
|
|
50
|
-
try {
|
|
51
|
-
return t(e(n));
|
|
52
|
-
} catch {}
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
function n(e) {
|
|
57
|
-
return "" + e;
|
|
58
|
-
}
|
|
59
|
-
function r(e) {
|
|
60
|
-
try {
|
|
61
|
-
n(e);
|
|
62
|
-
var t = !1;
|
|
63
|
-
} catch {
|
|
64
|
-
t = !0;
|
|
65
|
-
}
|
|
66
|
-
if (t) {
|
|
67
|
-
t = console;
|
|
68
|
-
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
69
|
-
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function i(e) {
|
|
73
|
-
if (e === _) return "<>";
|
|
74
|
-
if (typeof e == "object" && e && e.$$typeof === E) return "<...>";
|
|
75
|
-
try {
|
|
76
|
-
var n = t(e);
|
|
77
|
-
return n ? "<" + n + ">" : "<...>";
|
|
78
|
-
} catch {
|
|
79
|
-
return "<...>";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function a() {
|
|
83
|
-
var e = k.A;
|
|
84
|
-
return e === null ? null : e.getOwner();
|
|
85
|
-
}
|
|
86
|
-
function o() {
|
|
87
|
-
return Error("react-stack-top-frame");
|
|
88
|
-
}
|
|
89
|
-
function s(e) {
|
|
90
|
-
if (A.call(e, "key")) {
|
|
91
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
92
|
-
if (t && t.isReactWarning) return !1;
|
|
93
|
-
}
|
|
94
|
-
return e.key !== void 0;
|
|
95
|
-
}
|
|
96
|
-
function c(e, t) {
|
|
97
|
-
function n() {
|
|
98
|
-
N || (N = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
99
|
-
}
|
|
100
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
101
|
-
get: n,
|
|
102
|
-
configurable: !0
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function l() {
|
|
106
|
-
var e = t(this.type);
|
|
107
|
-
return P[e] || (P[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
108
|
-
}
|
|
109
|
-
function u(e, t, n, r, i, a) {
|
|
110
|
-
var o = n.ref;
|
|
111
|
-
return e = {
|
|
112
|
-
$$typeof: h,
|
|
113
|
-
type: e,
|
|
114
|
-
key: t,
|
|
115
|
-
props: n,
|
|
116
|
-
_owner: r
|
|
117
|
-
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
118
|
-
enumerable: !1,
|
|
119
|
-
value: null
|
|
120
|
-
}) : Object.defineProperty(e, "ref", {
|
|
121
|
-
enumerable: !1,
|
|
122
|
-
get: l
|
|
123
|
-
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
124
|
-
configurable: !1,
|
|
125
|
-
enumerable: !1,
|
|
126
|
-
writable: !0,
|
|
127
|
-
value: 0
|
|
128
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
129
|
-
configurable: !1,
|
|
130
|
-
enumerable: !1,
|
|
131
|
-
writable: !0,
|
|
132
|
-
value: null
|
|
133
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
134
|
-
configurable: !1,
|
|
135
|
-
enumerable: !1,
|
|
136
|
-
writable: !0,
|
|
137
|
-
value: i
|
|
138
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
139
|
-
configurable: !1,
|
|
140
|
-
enumerable: !1,
|
|
141
|
-
writable: !0,
|
|
142
|
-
value: a
|
|
143
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
144
|
-
}
|
|
145
|
-
function d(e, n, i, o, l, d) {
|
|
146
|
-
var p = n.children;
|
|
147
|
-
if (p !== void 0) if (o) if (j(p)) {
|
|
148
|
-
for (o = 0; o < p.length; o++) f(p[o]);
|
|
149
|
-
Object.freeze && Object.freeze(p);
|
|
150
|
-
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
151
|
-
else f(p);
|
|
152
|
-
if (A.call(n, "key")) {
|
|
153
|
-
p = t(e);
|
|
154
|
-
var m = Object.keys(n).filter(function(e) {
|
|
155
|
-
return e !== "key";
|
|
156
|
-
});
|
|
157
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", L[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), L[p + o] = !0);
|
|
158
|
-
}
|
|
159
|
-
if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
160
|
-
else i = n;
|
|
161
|
-
return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
|
|
162
|
-
}
|
|
163
|
-
function f(e) {
|
|
164
|
-
p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === E && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
165
|
-
}
|
|
166
|
-
function p(e) {
|
|
167
|
-
return typeof e == "object" && !!e && e.$$typeof === h;
|
|
168
|
-
}
|
|
169
|
-
var m = U("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), k = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, j = Array.isArray, M = console.createTask ? console.createTask : function() {
|
|
170
|
-
return null;
|
|
171
|
-
};
|
|
172
|
-
m = { react_stack_bottom_frame: function(e) {
|
|
173
|
-
return e();
|
|
174
|
-
} };
|
|
175
|
-
var N, P = {}, F = m.react_stack_bottom_frame.bind(m, o)(), I = M(i(o)), L = {};
|
|
176
|
-
e.Fragment = _, e.jsx = function(e, t, n) {
|
|
177
|
-
var r = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
178
|
-
return d(e, t, n, !1, r ? Error("react-stack-top-frame") : F, r ? M(i(e)) : I);
|
|
179
|
-
}, e.jsxs = function(e, t, n) {
|
|
180
|
-
var r = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
181
|
-
return d(e, t, n, !0, r ? Error("react-stack-top-frame") : F, r ? M(i(e)) : I);
|
|
182
|
-
};
|
|
183
|
-
})();
|
|
184
|
-
})), G = (/* @__PURE__ */ H(((e, t) => {
|
|
185
|
-
process.env.NODE_ENV === "production" ? t.exports = W() : t.exports = ne();
|
|
186
|
-
})))(), K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: o, className: s, gridClassName: c }) => {
|
|
7
|
+
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
8
|
+
//#region src/FormSection.tsx
|
|
9
|
+
var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: o, className: s, gridClassName: c }) => {
|
|
187
10
|
let [l, u] = a(r);
|
|
188
|
-
return /* @__PURE__ */ (
|
|
11
|
+
return /* @__PURE__ */ W("div", {
|
|
189
12
|
className: L("form-section", s),
|
|
190
|
-
children: [(e || t) && /* @__PURE__ */ (
|
|
13
|
+
children: [(e || t) && /* @__PURE__ */ W("div", {
|
|
191
14
|
className: L("flex items-start gap-2 mb-4", n && "cursor-pointer select-none"),
|
|
192
15
|
onClick: () => {
|
|
193
16
|
n && u(!l);
|
|
194
17
|
},
|
|
195
18
|
role: n ? "button" : void 0,
|
|
196
19
|
"aria-expanded": n ? !l : void 0,
|
|
197
|
-
children: [n && /* @__PURE__ */ (
|
|
20
|
+
children: [n && /* @__PURE__ */ U("span", {
|
|
198
21
|
className: "mt-0.5 text-muted-foreground",
|
|
199
|
-
children: l ?
|
|
200
|
-
}), /* @__PURE__ */ (
|
|
22
|
+
children: U(l ? V : ee, { className: "h-4 w-4" })
|
|
23
|
+
}), /* @__PURE__ */ W("div", {
|
|
201
24
|
className: "flex-1",
|
|
202
|
-
children: [e && /* @__PURE__ */ (
|
|
25
|
+
children: [e && /* @__PURE__ */ U("h3", {
|
|
203
26
|
className: "text-base font-semibold text-foreground",
|
|
204
27
|
children: e
|
|
205
|
-
}), t && /* @__PURE__ */ (
|
|
28
|
+
}), t && /* @__PURE__ */ U("p", {
|
|
206
29
|
className: "text-sm text-muted-foreground mt-0.5",
|
|
207
30
|
children: t
|
|
208
31
|
})]
|
|
209
32
|
})]
|
|
210
|
-
}), !l && /* @__PURE__ */ (
|
|
33
|
+
}), !l && /* @__PURE__ */ U("div", {
|
|
211
34
|
className: L("grid gap-4", c || {
|
|
212
35
|
1: "grid-cols-1",
|
|
213
36
|
2: "grid-cols-1 md:grid-cols-2",
|
|
@@ -217,7 +40,7 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
217
40
|
children: o
|
|
218
41
|
})]
|
|
219
42
|
});
|
|
220
|
-
},
|
|
43
|
+
}, K = ({ schema: n, dataSource: r, className: i }) => {
|
|
221
44
|
let { fieldLabel: o } = c(), [u, d] = a(null), [p, m] = a({}), [h, g] = a(!0), [_, v] = a(null), [y, b] = a(n.defaultTab || n.sections[0]?.name || n.sections[0]?.label || "tab-0");
|
|
222
45
|
e.useEffect(() => {
|
|
223
46
|
(async () => {
|
|
@@ -296,19 +119,19 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
296
119
|
}, [n, r]), C = t(() => {
|
|
297
120
|
n.onCancel && n.onCancel();
|
|
298
121
|
}, [n]), w = (e, t) => e.name || e.label || `tab-${t}`;
|
|
299
|
-
if (_) return /* @__PURE__ */ (
|
|
122
|
+
if (_) return /* @__PURE__ */ W("div", {
|
|
300
123
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
301
|
-
children: [/* @__PURE__ */ (
|
|
124
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
302
125
|
className: "text-red-800 font-semibold",
|
|
303
126
|
children: "Error loading form"
|
|
304
|
-
}), /* @__PURE__ */ (
|
|
127
|
+
}), /* @__PURE__ */ U("p", {
|
|
305
128
|
className: "text-red-600 text-sm mt-1",
|
|
306
129
|
children: _.message
|
|
307
130
|
})]
|
|
308
131
|
});
|
|
309
|
-
if (h) return /* @__PURE__ */ (
|
|
132
|
+
if (h) return /* @__PURE__ */ W("div", {
|
|
310
133
|
className: "p-8 text-center",
|
|
311
|
-
children: [/* @__PURE__ */ (
|
|
134
|
+
children: [/* @__PURE__ */ U("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ U("p", {
|
|
312
135
|
className: "mt-2 text-sm text-gray-600",
|
|
313
136
|
children: "Loading form..."
|
|
314
137
|
})]
|
|
@@ -325,29 +148,29 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
325
148
|
onSubmit: S,
|
|
326
149
|
onCancel: C
|
|
327
150
|
}, E = n.tabPosition === "left" || n.tabPosition === "right";
|
|
328
|
-
return /* @__PURE__ */ (
|
|
151
|
+
return /* @__PURE__ */ U("div", {
|
|
329
152
|
className: L("w-full", i, n.className),
|
|
330
|
-
children: /* @__PURE__ */ (
|
|
153
|
+
children: /* @__PURE__ */ W(N, {
|
|
331
154
|
value: y,
|
|
332
155
|
onValueChange: b,
|
|
333
156
|
orientation: E ? "vertical" : "horizontal",
|
|
334
157
|
className: L(E && "flex gap-4"),
|
|
335
|
-
children: [/* @__PURE__ */ (
|
|
158
|
+
children: [/* @__PURE__ */ U(F, {
|
|
336
159
|
className: L(E ? "flex-col h-auto" : "", n.tabPosition === "bottom" && "order-last", n.tabPosition === "right" && "order-last"),
|
|
337
|
-
children: n.sections.map((e, t) => /* @__PURE__ */ (
|
|
160
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ U(I, {
|
|
338
161
|
value: w(e, t),
|
|
339
162
|
className: E ? "w-full justify-start" : "",
|
|
340
163
|
children: e.label || `Tab ${t + 1}`
|
|
341
164
|
}, w(e, t)))
|
|
342
|
-
}), /* @__PURE__ */ (
|
|
165
|
+
}), /* @__PURE__ */ U("div", {
|
|
343
166
|
className: "flex-1",
|
|
344
|
-
children: n.sections.map((e, t) => /* @__PURE__ */ (
|
|
167
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ U(P, {
|
|
345
168
|
value: w(e, t),
|
|
346
169
|
className: "mt-0",
|
|
347
|
-
children: /* @__PURE__ */ (
|
|
170
|
+
children: /* @__PURE__ */ U(G, {
|
|
348
171
|
description: e.description,
|
|
349
172
|
columns: e.columns || 1,
|
|
350
|
-
children: /* @__PURE__ */ (
|
|
173
|
+
children: /* @__PURE__ */ U(s, { schema: {
|
|
351
174
|
...T,
|
|
352
175
|
fields: x(e),
|
|
353
176
|
showSubmit: n.showSubmit !== !1 && n.mode !== "view",
|
|
@@ -358,7 +181,7 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
358
181
|
})]
|
|
359
182
|
})
|
|
360
183
|
});
|
|
361
|
-
},
|
|
184
|
+
}, q = ({ schema: n, dataSource: r, className: o }) => {
|
|
362
185
|
let { fieldLabel: u } = c(), [d, m] = a(null), [h, g] = a({}), [_, v] = a(!0), [y, b] = a(null), [x, S] = a(0), [C, w] = a(/* @__PURE__ */ new Set()), [T, E] = a(!1), D = n.sections.length, O = x === 0, k = x === D - 1;
|
|
363
186
|
e.useEffect(() => {
|
|
364
187
|
(async () => {
|
|
@@ -468,51 +291,51 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
468
291
|
x,
|
|
469
292
|
N
|
|
470
293
|
]);
|
|
471
|
-
if (y) return /* @__PURE__ */ (
|
|
294
|
+
if (y) return /* @__PURE__ */ W("div", {
|
|
472
295
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
473
|
-
children: [/* @__PURE__ */ (
|
|
296
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
474
297
|
className: "text-red-800 font-semibold",
|
|
475
298
|
children: "Error loading form"
|
|
476
|
-
}), /* @__PURE__ */ (
|
|
299
|
+
}), /* @__PURE__ */ U("p", {
|
|
477
300
|
className: "text-red-600 text-sm mt-1",
|
|
478
301
|
children: y.message
|
|
479
302
|
})]
|
|
480
303
|
});
|
|
481
|
-
if (_) return /* @__PURE__ */ (
|
|
304
|
+
if (_) return /* @__PURE__ */ W("div", {
|
|
482
305
|
className: "p-8 text-center",
|
|
483
|
-
children: [/* @__PURE__ */ (
|
|
306
|
+
children: [/* @__PURE__ */ U("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ U("p", {
|
|
484
307
|
className: "mt-2 text-sm text-gray-600",
|
|
485
308
|
children: "Loading form..."
|
|
486
309
|
})]
|
|
487
310
|
});
|
|
488
311
|
let R = n.sections[x];
|
|
489
|
-
return /* @__PURE__ */ (
|
|
312
|
+
return /* @__PURE__ */ W("div", {
|
|
490
313
|
className: L("w-full", o, n.className),
|
|
491
314
|
children: [
|
|
492
|
-
n.showStepIndicator !== !1 && /* @__PURE__ */ (
|
|
315
|
+
n.showStepIndicator !== !1 && /* @__PURE__ */ U("nav", {
|
|
493
316
|
"aria-label": "Progress",
|
|
494
317
|
className: "mb-8",
|
|
495
|
-
children: /* @__PURE__ */ (
|
|
318
|
+
children: /* @__PURE__ */ U("ol", {
|
|
496
319
|
className: "flex items-center",
|
|
497
320
|
children: n.sections.map((e, t) => {
|
|
498
321
|
let r = t === x, i = C.has(t), a = n.allowSkip || i || t <= x;
|
|
499
|
-
return /* @__PURE__ */ (
|
|
322
|
+
return /* @__PURE__ */ W("li", {
|
|
500
323
|
className: L("relative flex-1", t !== D - 1 && "pr-8 sm:pr-12"),
|
|
501
|
-
children: [t !== D - 1 && /* @__PURE__ */ (
|
|
324
|
+
children: [t !== D - 1 && /* @__PURE__ */ U("div", {
|
|
502
325
|
className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
|
|
503
326
|
"aria-hidden": "true",
|
|
504
|
-
children: /* @__PURE__ */ (
|
|
505
|
-
}), /* @__PURE__ */ (
|
|
327
|
+
children: /* @__PURE__ */ U("div", { className: L("h-full", i ? "bg-primary" : "bg-muted") })
|
|
328
|
+
}), /* @__PURE__ */ W("button", {
|
|
506
329
|
type: "button",
|
|
507
330
|
className: L("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
|
|
508
331
|
onClick: () => I(t),
|
|
509
332
|
disabled: !a,
|
|
510
|
-
children: [/* @__PURE__ */ (
|
|
333
|
+
children: [/* @__PURE__ */ U("span", {
|
|
511
334
|
className: L("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"),
|
|
512
|
-
children: i ? /* @__PURE__ */ (
|
|
513
|
-
}), /* @__PURE__ */ (
|
|
335
|
+
children: i ? /* @__PURE__ */ U(z, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : t + 1
|
|
336
|
+
}), /* @__PURE__ */ U("span", {
|
|
514
337
|
className: "ml-2 sm:ml-3 text-xs sm:text-sm font-medium hidden sm:block",
|
|
515
|
-
children: /* @__PURE__ */ (
|
|
338
|
+
children: /* @__PURE__ */ U("span", {
|
|
516
339
|
className: L(r ? "text-foreground" : "text-muted-foreground"),
|
|
517
340
|
children: e.label || `Step ${t + 1}`
|
|
518
341
|
})
|
|
@@ -522,13 +345,13 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
522
345
|
})
|
|
523
346
|
})
|
|
524
347
|
}),
|
|
525
|
-
/* @__PURE__ */ (
|
|
348
|
+
/* @__PURE__ */ U("div", {
|
|
526
349
|
className: "min-h-[200px]",
|
|
527
|
-
children: R && /* @__PURE__ */ (
|
|
350
|
+
children: R && /* @__PURE__ */ U(G, {
|
|
528
351
|
label: R.label,
|
|
529
352
|
description: R.description,
|
|
530
353
|
columns: R.columns || 1,
|
|
531
|
-
children: j.length > 0 ? /* @__PURE__ */ (
|
|
354
|
+
children: j.length > 0 ? /* @__PURE__ */ U(s, { schema: {
|
|
532
355
|
type: "form",
|
|
533
356
|
fields: j,
|
|
534
357
|
layout: "vertical",
|
|
@@ -536,22 +359,22 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
536
359
|
showSubmit: !1,
|
|
537
360
|
showCancel: !1,
|
|
538
361
|
onSubmit: M
|
|
539
|
-
} }) : /* @__PURE__ */ (
|
|
362
|
+
} }) : /* @__PURE__ */ U("div", {
|
|
540
363
|
className: "text-center py-8 text-muted-foreground",
|
|
541
364
|
children: "No fields configured for this step"
|
|
542
365
|
})
|
|
543
366
|
})
|
|
544
367
|
}),
|
|
545
|
-
/* @__PURE__ */ (
|
|
368
|
+
/* @__PURE__ */ W("div", {
|
|
546
369
|
className: "flex items-center justify-between mt-6 pt-4 border-t",
|
|
547
|
-
children: [/* @__PURE__ */ (
|
|
370
|
+
children: [/* @__PURE__ */ U("div", { children: n.showCancel !== !1 && /* @__PURE__ */ U(p, {
|
|
548
371
|
variant: "ghost",
|
|
549
372
|
onClick: F,
|
|
550
373
|
children: n.cancelText || "Cancel"
|
|
551
|
-
}) }), /* @__PURE__ */ (
|
|
374
|
+
}) }), /* @__PURE__ */ W("div", {
|
|
552
375
|
className: "flex items-center gap-2",
|
|
553
376
|
children: [
|
|
554
|
-
/* @__PURE__ */ (
|
|
377
|
+
/* @__PURE__ */ W("span", {
|
|
555
378
|
className: "text-sm text-muted-foreground mr-2",
|
|
556
379
|
children: [
|
|
557
380
|
"Step ",
|
|
@@ -560,25 +383,25 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
560
383
|
D
|
|
561
384
|
]
|
|
562
385
|
}),
|
|
563
|
-
!O && /* @__PURE__ */ (
|
|
386
|
+
!O && /* @__PURE__ */ W(p, {
|
|
564
387
|
variant: "outline",
|
|
565
388
|
onClick: P,
|
|
566
|
-
children: [/* @__PURE__ */ (
|
|
389
|
+
children: [/* @__PURE__ */ U(B, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
|
|
567
390
|
}),
|
|
568
|
-
k ? /* @__PURE__ */ (
|
|
391
|
+
k ? /* @__PURE__ */ U(p, {
|
|
569
392
|
onClick: () => M(h),
|
|
570
393
|
disabled: T || n.mode === "view",
|
|
571
394
|
children: T ? "Submitting..." : n.submitText || (n.mode === "create" ? "Create" : "Update")
|
|
572
|
-
}) : /* @__PURE__ */ (
|
|
395
|
+
}) : /* @__PURE__ */ W(p, {
|
|
573
396
|
onClick: () => M(h),
|
|
574
|
-
children: [n.nextText || "Next", /* @__PURE__ */ (
|
|
397
|
+
children: [n.nextText || "Next", /* @__PURE__ */ U(V, { className: "h-4 w-4 ml-1" })]
|
|
575
398
|
})
|
|
576
399
|
]
|
|
577
400
|
})]
|
|
578
401
|
})
|
|
579
402
|
]
|
|
580
403
|
});
|
|
581
|
-
},
|
|
404
|
+
}, J = ({ schema: e, dataSource: r, className: o }) => {
|
|
582
405
|
let { fieldLabel: u } = c(), [d, p] = a(null), [m, h] = a({}), [g, _] = a(!0), [v, y] = a(null);
|
|
583
406
|
n(() => {
|
|
584
407
|
(async () => {
|
|
@@ -663,19 +486,19 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
663
486
|
}, [e]), C = i(() => e.sections.slice(0, 1), [e.sections]), D = i(() => e.sections.slice(1), [e.sections]);
|
|
664
487
|
i(() => e.sections.flatMap((e) => b(e)), [e.sections, b]);
|
|
665
488
|
let O = e.splitDirection || "horizontal", k = e.splitSize || 50;
|
|
666
|
-
if (v) return /* @__PURE__ */ (
|
|
489
|
+
if (v) return /* @__PURE__ */ W("div", {
|
|
667
490
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
668
|
-
children: [/* @__PURE__ */ (
|
|
491
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
669
492
|
className: "text-red-800 font-semibold",
|
|
670
493
|
children: "Error loading form"
|
|
671
|
-
}), /* @__PURE__ */ (
|
|
494
|
+
}), /* @__PURE__ */ U("p", {
|
|
672
495
|
className: "text-red-600 text-sm mt-1",
|
|
673
496
|
children: v.message
|
|
674
497
|
})]
|
|
675
498
|
});
|
|
676
|
-
if (g) return /* @__PURE__ */ (
|
|
499
|
+
if (g) return /* @__PURE__ */ W("div", {
|
|
677
500
|
className: "p-8 text-center",
|
|
678
|
-
children: [/* @__PURE__ */ (
|
|
501
|
+
children: [/* @__PURE__ */ U("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ U("p", {
|
|
679
502
|
className: "mt-2 text-sm text-gray-600",
|
|
680
503
|
children: "Loading form..."
|
|
681
504
|
})]
|
|
@@ -686,13 +509,13 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
686
509
|
defaultValues: m,
|
|
687
510
|
onSubmit: x,
|
|
688
511
|
onCancel: S
|
|
689
|
-
}, j = (t, n) => /* @__PURE__ */ (
|
|
512
|
+
}, j = (t, n) => /* @__PURE__ */ U("div", {
|
|
690
513
|
className: "space-y-4 p-4",
|
|
691
|
-
children: t.map((t, r) => /* @__PURE__ */ (
|
|
514
|
+
children: t.map((t, r) => /* @__PURE__ */ U(G, {
|
|
692
515
|
label: t.label,
|
|
693
516
|
description: t.description,
|
|
694
517
|
columns: t.columns || 1,
|
|
695
|
-
children: /* @__PURE__ */ (
|
|
518
|
+
children: /* @__PURE__ */ U(s, { schema: {
|
|
696
519
|
...A,
|
|
697
520
|
fields: b(t),
|
|
698
521
|
showSubmit: n && e.showSubmit !== !1 && e.mode !== "view",
|
|
@@ -702,29 +525,29 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
702
525
|
} })
|
|
703
526
|
}, t.name || t.label || r))
|
|
704
527
|
});
|
|
705
|
-
return /* @__PURE__ */ (
|
|
528
|
+
return /* @__PURE__ */ U("div", {
|
|
706
529
|
className: L("w-full", o, e.className),
|
|
707
|
-
children: /* @__PURE__ */ (
|
|
530
|
+
children: /* @__PURE__ */ W(E, {
|
|
708
531
|
orientation: O,
|
|
709
532
|
className: "min-h-[300px] rounded-lg border",
|
|
710
|
-
children: [/* @__PURE__ */ (
|
|
533
|
+
children: [/* @__PURE__ */ U(T, {
|
|
711
534
|
defaultSize: k,
|
|
712
535
|
minSize: 20,
|
|
713
536
|
children: j(C, D.length === 0)
|
|
714
|
-
}), D.length > 0 && /* @__PURE__ */ (
|
|
537
|
+
}), D.length > 0 && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(w, { withHandle: e.splitResizable !== !1 }), /* @__PURE__ */ U(T, {
|
|
715
538
|
defaultSize: 100 - k,
|
|
716
539
|
minSize: 20,
|
|
717
540
|
children: j(D, !0)
|
|
718
541
|
})] })]
|
|
719
542
|
})
|
|
720
543
|
});
|
|
721
|
-
},
|
|
544
|
+
}, ne = new Set([
|
|
722
545
|
"field:formula",
|
|
723
546
|
"field:summary",
|
|
724
547
|
"field:auto_number",
|
|
725
548
|
"field:autonumber",
|
|
726
549
|
"field:master_detail"
|
|
727
|
-
]),
|
|
550
|
+
]), re = new Set([
|
|
728
551
|
"field:textarea",
|
|
729
552
|
"field:markdown",
|
|
730
553
|
"field:html",
|
|
@@ -735,7 +558,7 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
735
558
|
"html",
|
|
736
559
|
"grid",
|
|
737
560
|
"rich-text"
|
|
738
|
-
]),
|
|
561
|
+
]), ie = new Set([
|
|
739
562
|
"formula",
|
|
740
563
|
"summary",
|
|
741
564
|
"auto_number",
|
|
@@ -743,22 +566,22 @@ var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
743
566
|
"master_detail",
|
|
744
567
|
"masterDetail"
|
|
745
568
|
]);
|
|
746
|
-
function
|
|
747
|
-
return
|
|
569
|
+
function ae(e) {
|
|
570
|
+
return re.has(e);
|
|
748
571
|
}
|
|
749
|
-
function
|
|
750
|
-
return
|
|
572
|
+
function oe(e) {
|
|
573
|
+
return ie.has(e);
|
|
751
574
|
}
|
|
752
|
-
function
|
|
575
|
+
function se(e) {
|
|
753
576
|
return e <= 3 ? 1 : 2;
|
|
754
577
|
}
|
|
755
578
|
function Y(e, t) {
|
|
756
|
-
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type &&
|
|
579
|
+
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type && ae(e.type) ? {
|
|
757
580
|
...e,
|
|
758
581
|
colSpan: t
|
|
759
582
|
} : e);
|
|
760
583
|
}
|
|
761
|
-
var
|
|
584
|
+
var ce = new Set([
|
|
762
585
|
"id",
|
|
763
586
|
"created_at",
|
|
764
587
|
"createdAt",
|
|
@@ -775,12 +598,12 @@ var ue = new Set([
|
|
|
775
598
|
"_version",
|
|
776
599
|
"_rev"
|
|
777
600
|
]);
|
|
778
|
-
function
|
|
601
|
+
function le(e, t) {
|
|
779
602
|
return e.filter((e) => {
|
|
780
|
-
if (
|
|
603
|
+
if (ce.has(e.name) || e.type && ne.has(e.type)) return !1;
|
|
781
604
|
if (!t?.fields) return !0;
|
|
782
605
|
let n = t.fields[e.name];
|
|
783
|
-
return n ? n.readonly === !0 ? !1 : !
|
|
606
|
+
return n ? n.readonly === !0 ? !1 : !oe(n.type) : !0;
|
|
784
607
|
});
|
|
785
608
|
}
|
|
786
609
|
function X(e) {
|
|
@@ -788,11 +611,11 @@ function X(e) {
|
|
|
788
611
|
}
|
|
789
612
|
function Z(e, t, n, r) {
|
|
790
613
|
let i = [...e];
|
|
791
|
-
if (r === "create" && (i =
|
|
614
|
+
if (r === "create" && (i = le(i, t)), n !== void 0) return i = Y(i, n), {
|
|
792
615
|
fields: i,
|
|
793
616
|
columns: n
|
|
794
617
|
};
|
|
795
|
-
let a =
|
|
618
|
+
let a = se(i.length);
|
|
796
619
|
return i = Y(i, a), {
|
|
797
620
|
fields: i,
|
|
798
621
|
columns: a
|
|
@@ -800,12 +623,12 @@ function Z(e, t, n, r) {
|
|
|
800
623
|
}
|
|
801
624
|
//#endregion
|
|
802
625
|
//#region src/DrawerForm.tsx
|
|
803
|
-
var
|
|
626
|
+
var ue = {
|
|
804
627
|
1: void 0,
|
|
805
628
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
806
629
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
807
630
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
808
|
-
},
|
|
631
|
+
}, Q = ({ schema: e, dataSource: r, className: o }) => {
|
|
809
632
|
let { fieldLabel: u } = c(), [d, p] = a(null), [m, h] = a([]), [g, _] = a({}), [v, y] = a(!0), [b, x] = a(null), S = e.open !== !1, C = e.drawerSide || "right", [w, T] = a(() => {
|
|
810
633
|
let t = {};
|
|
811
634
|
return e.sections?.forEach((e, n) => {
|
|
@@ -953,29 +776,29 @@ var fe = {
|
|
|
953
776
|
onSubmit: M,
|
|
954
777
|
onCancel: N
|
|
955
778
|
};
|
|
956
|
-
return /* @__PURE__ */ (
|
|
779
|
+
return /* @__PURE__ */ U(D, {
|
|
957
780
|
open: S,
|
|
958
781
|
onOpenChange: e.onOpenChange,
|
|
959
|
-
children: /* @__PURE__ */ (
|
|
782
|
+
children: /* @__PURE__ */ W(O, {
|
|
960
783
|
side: C,
|
|
961
784
|
className: L("overflow-y-auto", o, e.className),
|
|
962
785
|
style: P,
|
|
963
|
-
children: [(e.title || e.description) && /* @__PURE__ */ (
|
|
786
|
+
children: [(e.title || e.description) && /* @__PURE__ */ W(A, { children: [e.title && /* @__PURE__ */ U(j, { children: e.title }), e.description && /* @__PURE__ */ U(k, { children: e.description })] }), /* @__PURE__ */ U("div", {
|
|
964
787
|
className: "@container py-4",
|
|
965
788
|
children: (() => {
|
|
966
|
-
if (b) return /* @__PURE__ */ (
|
|
789
|
+
if (b) return /* @__PURE__ */ W("div", {
|
|
967
790
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
968
|
-
children: [/* @__PURE__ */ (
|
|
791
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
969
792
|
className: "text-red-800 font-semibold",
|
|
970
793
|
children: "Error loading form"
|
|
971
|
-
}), /* @__PURE__ */ (
|
|
794
|
+
}), /* @__PURE__ */ U("p", {
|
|
972
795
|
className: "text-red-600 text-sm mt-1",
|
|
973
796
|
children: b.message
|
|
974
797
|
})]
|
|
975
798
|
});
|
|
976
|
-
if (v) return /* @__PURE__ */ (
|
|
799
|
+
if (v) return /* @__PURE__ */ W("div", {
|
|
977
800
|
className: "p-8 text-center",
|
|
978
|
-
children: [/* @__PURE__ */ (
|
|
801
|
+
children: [/* @__PURE__ */ U("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ U("p", {
|
|
979
802
|
className: "mt-2 text-sm text-gray-600",
|
|
980
803
|
children: "Loading form..."
|
|
981
804
|
})]
|
|
@@ -1001,13 +824,13 @@ var fe = {
|
|
|
1001
824
|
...e,
|
|
1002
825
|
hidden: !0
|
|
1003
826
|
}))) : t.push(...a);
|
|
1004
|
-
}), /* @__PURE__ */ (
|
|
827
|
+
}), /* @__PURE__ */ U(s, { schema: {
|
|
1005
828
|
...F,
|
|
1006
829
|
fields: t
|
|
1007
830
|
} });
|
|
1008
831
|
}
|
|
1009
|
-
let t = Z(m, d, e.columns, e.mode), n =
|
|
1010
|
-
return /* @__PURE__ */ (
|
|
832
|
+
let t = Z(m, d, e.columns, e.mode), n = ue[t.columns || 1];
|
|
833
|
+
return /* @__PURE__ */ U(s, { schema: {
|
|
1011
834
|
...F,
|
|
1012
835
|
fields: t.fields,
|
|
1013
836
|
columns: t.columns,
|
|
@@ -1017,18 +840,18 @@ var fe = {
|
|
|
1017
840
|
})]
|
|
1018
841
|
})
|
|
1019
842
|
});
|
|
1020
|
-
},
|
|
843
|
+
}, de = {
|
|
1021
844
|
sm: "sm:max-w-sm",
|
|
1022
845
|
default: "sm:max-w-lg",
|
|
1023
846
|
lg: "sm:max-w-2xl",
|
|
1024
847
|
xl: "sm:max-w-5xl",
|
|
1025
848
|
full: "sm:max-w-[95vw] sm:w-full"
|
|
1026
|
-
},
|
|
849
|
+
}, fe = {
|
|
1027
850
|
1: void 0,
|
|
1028
851
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
1029
852
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
1030
853
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
1031
|
-
},
|
|
854
|
+
}, pe = ({ schema: e, dataSource: o, className: u }) => {
|
|
1032
855
|
let { fieldLabel: d } = c(), [m, h] = a(null), [g, _] = a([]), [v, w] = a({}), [T, E] = a(!0), [D, O] = a(null), [k, A] = a(!1), j = e.open !== !1, N = r(), P = i(() => e.sections?.length || e.customFields?.length ? null : Z(g, m, e.columns, e.mode), [
|
|
1033
856
|
g,
|
|
1034
857
|
m,
|
|
@@ -1036,7 +859,7 @@ var fe = {
|
|
|
1036
859
|
e.mode,
|
|
1037
860
|
e.sections,
|
|
1038
861
|
e.customFields
|
|
1039
|
-
]), F =
|
|
862
|
+
]), F = de[i(() => {
|
|
1040
863
|
if (e.modalSize) return e.modalSize;
|
|
1041
864
|
if (P?.columns && P.columns > 1) return X(P.columns);
|
|
1042
865
|
if (e.sections?.length) {
|
|
@@ -1048,7 +871,7 @@ var fe = {
|
|
|
1048
871
|
e.modalSize,
|
|
1049
872
|
P,
|
|
1050
873
|
e.sections
|
|
1051
|
-
])] ||
|
|
874
|
+
])] || de.default;
|
|
1052
875
|
n(() => {
|
|
1053
876
|
(async () => {
|
|
1054
877
|
if (!o) {
|
|
@@ -1173,97 +996,97 @@ var fe = {
|
|
|
1173
996
|
}
|
|
1174
997
|
}, [e, o]), z = t(() => {
|
|
1175
998
|
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
1176
|
-
}, [e]), ee = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", B = e.showSubmit !== !1 && e.mode !== "view", V = e.showCancel !== !1, H = e.submitText || (e.mode === "create" ? "Create" : "Update"),
|
|
999
|
+
}, [e]), ee = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", B = e.showSubmit !== !1 && e.mode !== "view", V = e.showCancel !== !1, H = e.submitText || (e.mode === "create" ? "Create" : "Update"), K = e.cancelText || "Cancel", q = {
|
|
1177
1000
|
type: "form",
|
|
1178
1001
|
layout: ee,
|
|
1179
1002
|
defaultValues: v,
|
|
1180
1003
|
submitLabel: H,
|
|
1181
|
-
cancelLabel:
|
|
1004
|
+
cancelLabel: K,
|
|
1182
1005
|
showSubmit: B,
|
|
1183
1006
|
showCancel: V,
|
|
1184
1007
|
onSubmit: R,
|
|
1185
1008
|
onCancel: z,
|
|
1186
1009
|
showActions: !1,
|
|
1187
1010
|
id: N
|
|
1188
|
-
},
|
|
1189
|
-
if (D) return /* @__PURE__ */ (
|
|
1011
|
+
}, J = () => {
|
|
1012
|
+
if (D) return /* @__PURE__ */ W("div", {
|
|
1190
1013
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1191
|
-
children: [/* @__PURE__ */ (
|
|
1014
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
1192
1015
|
className: "text-red-800 font-semibold",
|
|
1193
1016
|
children: "Error loading form"
|
|
1194
|
-
}), /* @__PURE__ */ (
|
|
1017
|
+
}), /* @__PURE__ */ U("p", {
|
|
1195
1018
|
className: "text-red-600 text-sm mt-1",
|
|
1196
1019
|
children: D.message
|
|
1197
1020
|
})]
|
|
1198
1021
|
});
|
|
1199
|
-
if (T) return /* @__PURE__ */ (
|
|
1022
|
+
if (T) return /* @__PURE__ */ U("div", {
|
|
1200
1023
|
className: "space-y-4",
|
|
1201
1024
|
"data-testid": "modal-form-skeleton",
|
|
1202
1025
|
children: [
|
|
1203
1026
|
1,
|
|
1204
1027
|
2,
|
|
1205
1028
|
3
|
|
1206
|
-
].map((e) => /* @__PURE__ */ (
|
|
1029
|
+
].map((e) => /* @__PURE__ */ W("div", {
|
|
1207
1030
|
className: "space-y-2",
|
|
1208
|
-
children: [/* @__PURE__ */ (
|
|
1031
|
+
children: [/* @__PURE__ */ U(M, { className: "h-4 w-24" }), /* @__PURE__ */ U(M, { className: "h-10 w-full" })]
|
|
1209
1032
|
}, e))
|
|
1210
1033
|
});
|
|
1211
|
-
if (e.sections?.length) return /* @__PURE__ */ (
|
|
1034
|
+
if (e.sections?.length) return /* @__PURE__ */ U("div", {
|
|
1212
1035
|
className: "space-y-6",
|
|
1213
1036
|
children: e.sections.map((e, t) => {
|
|
1214
1037
|
let n = e.columns || 1;
|
|
1215
|
-
return /* @__PURE__ */ (
|
|
1038
|
+
return /* @__PURE__ */ U(G, {
|
|
1216
1039
|
label: e.label,
|
|
1217
1040
|
description: e.description,
|
|
1218
1041
|
columns: n,
|
|
1219
|
-
gridClassName:
|
|
1220
|
-
children: /* @__PURE__ */ (
|
|
1221
|
-
...
|
|
1042
|
+
gridClassName: fe[n],
|
|
1043
|
+
children: /* @__PURE__ */ U(s, { schema: {
|
|
1044
|
+
...q,
|
|
1222
1045
|
fields: I(e)
|
|
1223
1046
|
} })
|
|
1224
1047
|
}, e.name || e.label || t);
|
|
1225
1048
|
})
|
|
1226
1049
|
});
|
|
1227
|
-
let t = P ?? Z(g, m, e.columns, e.mode), n =
|
|
1228
|
-
return /* @__PURE__ */ (
|
|
1229
|
-
...
|
|
1050
|
+
let t = P ?? Z(g, m, e.columns, e.mode), n = fe[t.columns || 1];
|
|
1051
|
+
return /* @__PURE__ */ U(s, { schema: {
|
|
1052
|
+
...q,
|
|
1230
1053
|
fields: t.fields,
|
|
1231
1054
|
columns: t.columns,
|
|
1232
1055
|
...n ? { fieldContainerClass: n } : {}
|
|
1233
1056
|
} });
|
|
1234
|
-
},
|
|
1235
|
-
return /* @__PURE__ */ (
|
|
1057
|
+
}, ne = !T && !D && (B || V);
|
|
1058
|
+
return /* @__PURE__ */ U(y, {
|
|
1236
1059
|
open: j,
|
|
1237
1060
|
onOpenChange: e.onOpenChange,
|
|
1238
|
-
children: /* @__PURE__ */ (
|
|
1061
|
+
children: /* @__PURE__ */ W(C, {
|
|
1239
1062
|
className: L(F, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", u, e.className),
|
|
1240
1063
|
children: [
|
|
1241
|
-
(e.title || e.description) && /* @__PURE__ */ (
|
|
1064
|
+
(e.title || e.description) && /* @__PURE__ */ W(x, {
|
|
1242
1065
|
className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
|
|
1243
|
-
children: [e.title && /* @__PURE__ */ (
|
|
1066
|
+
children: [e.title && /* @__PURE__ */ U(S, { children: e.title }), e.description && /* @__PURE__ */ U(b, { children: e.description })]
|
|
1244
1067
|
}),
|
|
1245
|
-
/* @__PURE__ */ (
|
|
1068
|
+
/* @__PURE__ */ U("div", {
|
|
1246
1069
|
className: "@container flex-1 overflow-y-auto px-4 sm:px-6 py-4",
|
|
1247
|
-
children:
|
|
1070
|
+
children: J()
|
|
1248
1071
|
}),
|
|
1249
|
-
|
|
1072
|
+
ne && /* @__PURE__ */ U("div", {
|
|
1250
1073
|
className: "shrink-0 border-t px-4 sm:px-6 py-3 bg-background",
|
|
1251
1074
|
"data-testid": "modal-form-footer",
|
|
1252
|
-
children: /* @__PURE__ */ (
|
|
1075
|
+
children: /* @__PURE__ */ W("div", {
|
|
1253
1076
|
className: "flex flex-col sm:flex-row gap-2 sm:justify-end",
|
|
1254
|
-
children: [V && /* @__PURE__ */ (
|
|
1077
|
+
children: [V && /* @__PURE__ */ U(p, {
|
|
1255
1078
|
type: "button",
|
|
1256
1079
|
variant: "outline",
|
|
1257
1080
|
onClick: z,
|
|
1258
1081
|
disabled: k,
|
|
1259
1082
|
className: "w-full sm:w-auto",
|
|
1260
|
-
children:
|
|
1261
|
-
}), B && /* @__PURE__ */ (
|
|
1083
|
+
children: K
|
|
1084
|
+
}), B && /* @__PURE__ */ W(p, {
|
|
1262
1085
|
type: "submit",
|
|
1263
1086
|
form: N,
|
|
1264
1087
|
disabled: k,
|
|
1265
1088
|
className: "w-full sm:w-auto",
|
|
1266
|
-
children: [k && /* @__PURE__ */ (
|
|
1089
|
+
children: [k && /* @__PURE__ */ U(te, { className: "mr-2 h-4 w-4 animate-spin" }), H]
|
|
1267
1090
|
})]
|
|
1268
1091
|
})
|
|
1269
1092
|
})
|
|
@@ -1271,7 +1094,7 @@ var fe = {
|
|
|
1271
1094
|
})
|
|
1272
1095
|
});
|
|
1273
1096
|
}, $ = ({ schema: e, dataSource: t }) => {
|
|
1274
|
-
if (e.formType === "tabbed" && e.sections?.length) return /* @__PURE__ */ (
|
|
1097
|
+
if (e.formType === "tabbed" && e.sections?.length) return /* @__PURE__ */ U(K, {
|
|
1275
1098
|
schema: {
|
|
1276
1099
|
...e,
|
|
1277
1100
|
formType: "tabbed",
|
|
@@ -1288,7 +1111,7 @@ var fe = {
|
|
|
1288
1111
|
dataSource: t,
|
|
1289
1112
|
className: e.className
|
|
1290
1113
|
});
|
|
1291
|
-
if (e.formType === "wizard" && e.sections?.length) return /* @__PURE__ */ (
|
|
1114
|
+
if (e.formType === "wizard" && e.sections?.length) return /* @__PURE__ */ U(q, {
|
|
1292
1115
|
schema: {
|
|
1293
1116
|
...e,
|
|
1294
1117
|
formType: "wizard",
|
|
@@ -1308,7 +1131,7 @@ var fe = {
|
|
|
1308
1131
|
dataSource: t,
|
|
1309
1132
|
className: e.className
|
|
1310
1133
|
});
|
|
1311
|
-
if (e.formType === "split" && e.sections?.length) return /* @__PURE__ */ (
|
|
1134
|
+
if (e.formType === "split" && e.sections?.length) return /* @__PURE__ */ U(J, {
|
|
1312
1135
|
schema: {
|
|
1313
1136
|
...e,
|
|
1314
1137
|
formType: "split",
|
|
@@ -1328,7 +1151,7 @@ var fe = {
|
|
|
1328
1151
|
});
|
|
1329
1152
|
if (e.formType === "drawer") {
|
|
1330
1153
|
let { layout: n, ...r } = e, i = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1331
|
-
return /* @__PURE__ */ (
|
|
1154
|
+
return /* @__PURE__ */ U(Q, {
|
|
1332
1155
|
schema: {
|
|
1333
1156
|
...r,
|
|
1334
1157
|
layout: i,
|
|
@@ -1353,7 +1176,7 @@ var fe = {
|
|
|
1353
1176
|
}
|
|
1354
1177
|
if (e.formType === "modal") {
|
|
1355
1178
|
let { layout: n, ...r } = e, i = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1356
|
-
return /* @__PURE__ */ (
|
|
1179
|
+
return /* @__PURE__ */ U(pe, {
|
|
1357
1180
|
schema: {
|
|
1358
1181
|
...r,
|
|
1359
1182
|
layout: i,
|
|
@@ -1374,11 +1197,11 @@ var fe = {
|
|
|
1374
1197
|
className: e.className
|
|
1375
1198
|
});
|
|
1376
1199
|
}
|
|
1377
|
-
return /* @__PURE__ */ (
|
|
1200
|
+
return /* @__PURE__ */ U(me, {
|
|
1378
1201
|
schema: e,
|
|
1379
1202
|
dataSource: t
|
|
1380
1203
|
});
|
|
1381
|
-
},
|
|
1204
|
+
}, me = ({ schema: r, dataSource: i }) => {
|
|
1382
1205
|
let { fieldLabel: o } = c(), p = R(), [m, h] = a(null), [g, _] = a([]), [v, y] = a(null), [b, x] = a(!0), [S, C] = a(null), w = r.customFields && r.customFields.length > 0;
|
|
1383
1206
|
n(() => {
|
|
1384
1207
|
w && (y(r.initialData || r.initialValues || {}), x(!1));
|
|
@@ -1508,35 +1331,35 @@ var fe = {
|
|
|
1508
1331
|
}, [m]),
|
|
1509
1332
|
...v
|
|
1510
1333
|
};
|
|
1511
|
-
if (S) return /* @__PURE__ */ (
|
|
1334
|
+
if (S) return /* @__PURE__ */ W("div", {
|
|
1512
1335
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1513
|
-
children: [/* @__PURE__ */ (
|
|
1336
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
1514
1337
|
className: "text-red-800 font-semibold",
|
|
1515
1338
|
children: "Error loading form"
|
|
1516
|
-
}), /* @__PURE__ */ (
|
|
1339
|
+
}), /* @__PURE__ */ U("p", {
|
|
1517
1340
|
className: "text-red-600 text-sm mt-1",
|
|
1518
1341
|
children: S.message
|
|
1519
1342
|
})]
|
|
1520
1343
|
});
|
|
1521
|
-
if (b) return /* @__PURE__ */ (
|
|
1344
|
+
if (b) return /* @__PURE__ */ W("div", {
|
|
1522
1345
|
className: "p-4 sm:p-8 text-center",
|
|
1523
|
-
children: [/* @__PURE__ */ (
|
|
1346
|
+
children: [/* @__PURE__ */ U("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ U("p", {
|
|
1524
1347
|
className: "mt-2 text-sm text-gray-600",
|
|
1525
1348
|
children: "Loading form..."
|
|
1526
1349
|
})]
|
|
1527
1350
|
});
|
|
1528
1351
|
let O = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : "vertical";
|
|
1529
|
-
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ (
|
|
1352
|
+
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ U("div", {
|
|
1530
1353
|
className: "w-full space-y-6",
|
|
1531
1354
|
children: r.sections.map((e, t) => {
|
|
1532
1355
|
let n = e.fields.map((e) => typeof e == "string" ? e : e.name), i = g.filter((e) => n.includes(e.name));
|
|
1533
|
-
return /* @__PURE__ */ (
|
|
1356
|
+
return /* @__PURE__ */ U(G, {
|
|
1534
1357
|
label: e.label,
|
|
1535
1358
|
description: e.description,
|
|
1536
1359
|
collapsible: e.collapsible,
|
|
1537
1360
|
collapsed: e.collapsed,
|
|
1538
1361
|
columns: e.columns,
|
|
1539
|
-
children: /* @__PURE__ */ (
|
|
1362
|
+
children: /* @__PURE__ */ U(s, { schema: {
|
|
1540
1363
|
type: "form",
|
|
1541
1364
|
fields: i,
|
|
1542
1365
|
layout: O,
|
|
@@ -1571,7 +1394,7 @@ var fe = {
|
|
|
1571
1394
|
fields: r
|
|
1572
1395
|
});
|
|
1573
1396
|
}
|
|
1574
|
-
return /* @__PURE__ */ (
|
|
1397
|
+
return /* @__PURE__ */ U(q, {
|
|
1575
1398
|
schema: {
|
|
1576
1399
|
...r,
|
|
1577
1400
|
formType: "wizard",
|
|
@@ -1598,12 +1421,12 @@ var fe = {
|
|
|
1598
1421
|
className: r.className,
|
|
1599
1422
|
mobileStickyActions: !!j?.stickyActions
|
|
1600
1423
|
};
|
|
1601
|
-
return /* @__PURE__ */ (
|
|
1424
|
+
return /* @__PURE__ */ U("div", {
|
|
1602
1425
|
className: j?.stickyActions ? "w-full pb-20 md:pb-0" : "w-full",
|
|
1603
1426
|
"data-mobile-form": j ? "true" : void 0,
|
|
1604
|
-
children: /* @__PURE__ */ (
|
|
1427
|
+
children: /* @__PURE__ */ U(s, { schema: I })
|
|
1605
1428
|
});
|
|
1606
|
-
},
|
|
1429
|
+
}, he = ({ config: e, dataSource: n, prefillParams: r, className: o }) => {
|
|
1607
1430
|
let [s, c] = a(!1), [l, u] = a(!1), [d, f] = a(null), p = i(() => {
|
|
1608
1431
|
let e = {};
|
|
1609
1432
|
if (r) for (let [t, n] of Object.entries(r)) e[t] = n;
|
|
@@ -1632,30 +1455,30 @@ var fe = {
|
|
|
1632
1455
|
}, [e.branding]);
|
|
1633
1456
|
if (s) {
|
|
1634
1457
|
let t = e.thankYouPage;
|
|
1635
|
-
return /* @__PURE__ */ (
|
|
1458
|
+
return /* @__PURE__ */ U("div", {
|
|
1636
1459
|
className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
|
|
1637
1460
|
style: g,
|
|
1638
|
-
children: /* @__PURE__ */ (
|
|
1461
|
+
children: /* @__PURE__ */ W("div", {
|
|
1639
1462
|
className: "max-w-md w-full bg-card rounded-lg shadow-lg p-8 text-center space-y-4",
|
|
1640
1463
|
children: [
|
|
1641
|
-
/* @__PURE__ */ (
|
|
1464
|
+
/* @__PURE__ */ U("div", {
|
|
1642
1465
|
className: "text-4xl",
|
|
1643
1466
|
children: "✓"
|
|
1644
1467
|
}),
|
|
1645
|
-
/* @__PURE__ */ (
|
|
1468
|
+
/* @__PURE__ */ U("h2", {
|
|
1646
1469
|
className: "text-xl font-semibold text-foreground",
|
|
1647
1470
|
children: t?.title || "Thank You!"
|
|
1648
1471
|
}),
|
|
1649
|
-
/* @__PURE__ */ (
|
|
1472
|
+
/* @__PURE__ */ U("p", {
|
|
1650
1473
|
className: "text-muted-foreground",
|
|
1651
1474
|
children: t?.message || "Your submission has been received successfully."
|
|
1652
1475
|
}),
|
|
1653
|
-
e.allowMultiple && /* @__PURE__ */ (
|
|
1476
|
+
e.allowMultiple && /* @__PURE__ */ U("button", {
|
|
1654
1477
|
onClick: h,
|
|
1655
1478
|
className: "mt-4 px-4 py-2 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
1656
1479
|
children: "Submit Another Response"
|
|
1657
1480
|
}),
|
|
1658
|
-
t?.redirectUrl && /* @__PURE__ */ (
|
|
1481
|
+
t?.redirectUrl && /* @__PURE__ */ W("p", {
|
|
1659
1482
|
className: "text-xs text-muted-foreground",
|
|
1660
1483
|
children: [
|
|
1661
1484
|
"Redirecting in ",
|
|
@@ -1667,37 +1490,37 @@ var fe = {
|
|
|
1667
1490
|
})
|
|
1668
1491
|
});
|
|
1669
1492
|
}
|
|
1670
|
-
return /* @__PURE__ */ (
|
|
1493
|
+
return /* @__PURE__ */ U("div", {
|
|
1671
1494
|
className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
|
|
1672
1495
|
style: g,
|
|
1673
|
-
children: /* @__PURE__ */ (
|
|
1496
|
+
children: /* @__PURE__ */ W("div", {
|
|
1674
1497
|
className: "max-w-2xl w-full bg-card rounded-lg shadow-lg overflow-hidden",
|
|
1675
1498
|
children: [
|
|
1676
|
-
/* @__PURE__ */ (
|
|
1499
|
+
/* @__PURE__ */ W("div", {
|
|
1677
1500
|
className: "p-6 border-b",
|
|
1678
1501
|
style: e.branding?.primaryColor ? { borderBottomColor: e.branding.primaryColor } : void 0,
|
|
1679
1502
|
children: [
|
|
1680
|
-
e.branding?.logo && /* @__PURE__ */ (
|
|
1503
|
+
e.branding?.logo && /* @__PURE__ */ U("img", {
|
|
1681
1504
|
src: e.branding.logo,
|
|
1682
1505
|
alt: "Logo",
|
|
1683
1506
|
className: "h-8 mb-4"
|
|
1684
1507
|
}),
|
|
1685
|
-
e.title && /* @__PURE__ */ (
|
|
1508
|
+
e.title && /* @__PURE__ */ U("h1", {
|
|
1686
1509
|
className: "text-xl font-semibold text-foreground",
|
|
1687
1510
|
children: e.title
|
|
1688
1511
|
}),
|
|
1689
|
-
e.description && /* @__PURE__ */ (
|
|
1512
|
+
e.description && /* @__PURE__ */ U("p", {
|
|
1690
1513
|
className: "text-sm text-muted-foreground mt-1",
|
|
1691
1514
|
children: e.description
|
|
1692
1515
|
})
|
|
1693
1516
|
]
|
|
1694
1517
|
}),
|
|
1695
|
-
/* @__PURE__ */ (
|
|
1518
|
+
/* @__PURE__ */ W("div", {
|
|
1696
1519
|
className: "p-6",
|
|
1697
|
-
children: [d && /* @__PURE__ */ (
|
|
1520
|
+
children: [d && /* @__PURE__ */ U("div", {
|
|
1698
1521
|
className: "mb-4 p-3 bg-destructive/10 border border-destructive/30 rounded-md text-sm text-destructive",
|
|
1699
1522
|
children: d
|
|
1700
|
-
}), /* @__PURE__ */ (
|
|
1523
|
+
}), /* @__PURE__ */ U($, {
|
|
1701
1524
|
schema: {
|
|
1702
1525
|
type: "object-form",
|
|
1703
1526
|
objectName: e.objectName,
|
|
@@ -1711,9 +1534,9 @@ var fe = {
|
|
|
1711
1534
|
dataSource: n
|
|
1712
1535
|
})]
|
|
1713
1536
|
}),
|
|
1714
|
-
/* @__PURE__ */ (
|
|
1537
|
+
/* @__PURE__ */ U("div", {
|
|
1715
1538
|
className: "px-6 py-3 border-t bg-muted/20 text-center",
|
|
1716
|
-
children: /* @__PURE__ */ (
|
|
1539
|
+
children: /* @__PURE__ */ U("p", {
|
|
1717
1540
|
className: "text-xs text-muted-foreground",
|
|
1718
1541
|
children: "Powered by ObjectStack"
|
|
1719
1542
|
})
|
|
@@ -1724,96 +1547,96 @@ var fe = {
|
|
|
1724
1547
|
};
|
|
1725
1548
|
//#endregion
|
|
1726
1549
|
//#region src/FormAnalytics.tsx
|
|
1727
|
-
function
|
|
1550
|
+
function ge(e) {
|
|
1728
1551
|
return e < 60 ? `${Math.round(e)}s` : e < 3600 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${Math.floor(e / 3600)}h ${Math.floor(e % 3600 / 60)}m`;
|
|
1729
1552
|
}
|
|
1730
|
-
var
|
|
1553
|
+
var _e = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
1731
1554
|
let a = i(() => {
|
|
1732
1555
|
if (!n.abandonedSubmissions) return 100;
|
|
1733
1556
|
let e = n.totalSubmissions + n.abandonedSubmissions;
|
|
1734
1557
|
return e === 0 ? 0 : Math.round(n.totalSubmissions / e * 100);
|
|
1735
1558
|
}, [n.totalSubmissions, n.abandonedSubmissions]), o = i(() => n.dailySubmissions?.length ? Math.max(...n.dailySubmissions.map((e) => e.count), 1) : 1, [n.dailySubmissions]);
|
|
1736
|
-
return /* @__PURE__ */ (
|
|
1559
|
+
return /* @__PURE__ */ W("div", {
|
|
1737
1560
|
className: `space-y-4 ${r || ""}`,
|
|
1738
1561
|
children: [
|
|
1739
|
-
/* @__PURE__ */ (
|
|
1562
|
+
/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("h2", {
|
|
1740
1563
|
className: "text-lg font-semibold text-foreground",
|
|
1741
1564
|
children: t || "Form Analytics"
|
|
1742
|
-
}), /* @__PURE__ */ (
|
|
1565
|
+
}), /* @__PURE__ */ W("p", {
|
|
1743
1566
|
className: "text-sm text-muted-foreground",
|
|
1744
1567
|
children: ["Form ID: ", e]
|
|
1745
1568
|
})] }),
|
|
1746
|
-
/* @__PURE__ */ (
|
|
1569
|
+
/* @__PURE__ */ W("div", {
|
|
1747
1570
|
className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
1748
1571
|
children: [
|
|
1749
|
-
/* @__PURE__ */ (
|
|
1572
|
+
/* @__PURE__ */ U(m, { children: /* @__PURE__ */ W(_, {
|
|
1750
1573
|
className: "pb-2",
|
|
1751
|
-
children: [/* @__PURE__ */ (
|
|
1574
|
+
children: [/* @__PURE__ */ U(g, { children: "Total Submissions" }), /* @__PURE__ */ U(v, {
|
|
1752
1575
|
className: "text-2xl",
|
|
1753
1576
|
children: n.totalSubmissions.toLocaleString()
|
|
1754
1577
|
})]
|
|
1755
1578
|
}) }),
|
|
1756
|
-
/* @__PURE__ */ (
|
|
1579
|
+
/* @__PURE__ */ W(m, { children: [/* @__PURE__ */ W(_, {
|
|
1757
1580
|
className: "pb-2",
|
|
1758
|
-
children: [/* @__PURE__ */ (
|
|
1581
|
+
children: [/* @__PURE__ */ U(g, { children: "Fill Rate" }), /* @__PURE__ */ W(v, {
|
|
1759
1582
|
className: "text-2xl",
|
|
1760
1583
|
children: [a, "%"]
|
|
1761
1584
|
})]
|
|
1762
|
-
}), /* @__PURE__ */ (
|
|
1585
|
+
}), /* @__PURE__ */ U(h, { children: /* @__PURE__ */ U("div", {
|
|
1763
1586
|
className: "w-full bg-muted rounded-full h-2",
|
|
1764
|
-
children: /* @__PURE__ */ (
|
|
1587
|
+
children: /* @__PURE__ */ U("div", {
|
|
1765
1588
|
className: "bg-primary rounded-full h-2 transition-all",
|
|
1766
1589
|
style: { width: `${a}%` }
|
|
1767
1590
|
})
|
|
1768
1591
|
}) })] }),
|
|
1769
|
-
/* @__PURE__ */ (
|
|
1592
|
+
/* @__PURE__ */ U(m, { children: /* @__PURE__ */ W(_, {
|
|
1770
1593
|
className: "pb-2",
|
|
1771
|
-
children: [/* @__PURE__ */ (
|
|
1594
|
+
children: [/* @__PURE__ */ U(g, { children: "Avg. Completion Time" }), /* @__PURE__ */ U(v, {
|
|
1772
1595
|
className: "text-2xl",
|
|
1773
|
-
children: n.avgCompletionTime ?
|
|
1596
|
+
children: n.avgCompletionTime ? ge(n.avgCompletionTime) : "—"
|
|
1774
1597
|
})]
|
|
1775
1598
|
}) })
|
|
1776
1599
|
]
|
|
1777
1600
|
}),
|
|
1778
|
-
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ (
|
|
1601
|
+
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ W(m, { children: [/* @__PURE__ */ U(_, { children: /* @__PURE__ */ U(v, {
|
|
1779
1602
|
className: "text-sm font-medium",
|
|
1780
1603
|
children: "Daily Submissions"
|
|
1781
|
-
}) }), /* @__PURE__ */ (
|
|
1604
|
+
}) }), /* @__PURE__ */ U(h, { children: /* @__PURE__ */ U("div", {
|
|
1782
1605
|
className: "flex items-end gap-1 h-32",
|
|
1783
|
-
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ (
|
|
1606
|
+
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ W("div", {
|
|
1784
1607
|
className: "flex-1 flex flex-col items-center gap-1",
|
|
1785
|
-
children: [/* @__PURE__ */ (
|
|
1608
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1786
1609
|
className: "w-full bg-primary/80 rounded-t transition-all hover:bg-primary",
|
|
1787
1610
|
style: {
|
|
1788
1611
|
height: `${e.count / o * 100}%`,
|
|
1789
1612
|
minHeight: e.count > 0 ? "4px" : "0"
|
|
1790
1613
|
},
|
|
1791
1614
|
title: `${e.date}: ${e.count} submissions`
|
|
1792
|
-
}), /* @__PURE__ */ (
|
|
1615
|
+
}), /* @__PURE__ */ U("span", {
|
|
1793
1616
|
className: "text-[10px] text-muted-foreground truncate w-full text-center",
|
|
1794
1617
|
children: e.date.slice(-5)
|
|
1795
1618
|
})]
|
|
1796
1619
|
}, t))
|
|
1797
1620
|
}) })] }),
|
|
1798
|
-
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ (
|
|
1621
|
+
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ W(m, { children: [/* @__PURE__ */ W(_, { children: [/* @__PURE__ */ U(v, {
|
|
1799
1622
|
className: "text-sm font-medium",
|
|
1800
1623
|
children: "Field Completion Rates"
|
|
1801
|
-
}), /* @__PURE__ */ (
|
|
1624
|
+
}), /* @__PURE__ */ U(g, { children: "Percentage of users who completed each field" })] }), /* @__PURE__ */ U(h, { children: /* @__PURE__ */ U("div", {
|
|
1802
1625
|
className: "space-y-3",
|
|
1803
|
-
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ (
|
|
1626
|
+
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ W("div", {
|
|
1804
1627
|
className: "space-y-1",
|
|
1805
|
-
children: [/* @__PURE__ */ (
|
|
1628
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1806
1629
|
className: "flex justify-between text-sm",
|
|
1807
|
-
children: [/* @__PURE__ */ (
|
|
1630
|
+
children: [/* @__PURE__ */ U("span", {
|
|
1808
1631
|
className: "text-foreground",
|
|
1809
1632
|
children: e.label
|
|
1810
|
-
}), /* @__PURE__ */ (
|
|
1633
|
+
}), /* @__PURE__ */ W("span", {
|
|
1811
1634
|
className: "text-muted-foreground",
|
|
1812
1635
|
children: [e.completionRate, "%"]
|
|
1813
1636
|
})]
|
|
1814
|
-
}), /* @__PURE__ */ (
|
|
1637
|
+
}), /* @__PURE__ */ U("div", {
|
|
1815
1638
|
className: "w-full bg-muted rounded-full h-1.5",
|
|
1816
|
-
children: /* @__PURE__ */ (
|
|
1639
|
+
children: /* @__PURE__ */ U("div", {
|
|
1817
1640
|
className: `rounded-full h-1.5 transition-all ${e.completionRate >= 80 ? "bg-green-500" : e.completionRate >= 50 ? "bg-yellow-500" : "bg-destructive"}`,
|
|
1818
1641
|
style: { width: `${e.completionRate}%` }
|
|
1819
1642
|
})
|
|
@@ -1822,8 +1645,8 @@ var ye = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1822
1645
|
}) })] })
|
|
1823
1646
|
]
|
|
1824
1647
|
});
|
|
1825
|
-
},
|
|
1826
|
-
o.register("object-form",
|
|
1648
|
+
}, ve = ({ schema: e }) => /* @__PURE__ */ U($, { schema: e });
|
|
1649
|
+
o.register("object-form", ve, {
|
|
1827
1650
|
namespace: "plugin-form",
|
|
1828
1651
|
label: "Object Form",
|
|
1829
1652
|
category: "plugin",
|
|
@@ -1964,7 +1787,7 @@ o.register("object-form", be, {
|
|
|
1964
1787
|
]
|
|
1965
1788
|
}
|
|
1966
1789
|
]
|
|
1967
|
-
}), o.register("form",
|
|
1790
|
+
}), o.register("form", ve, {
|
|
1968
1791
|
namespace: "view",
|
|
1969
1792
|
skipFallback: !0,
|
|
1970
1793
|
label: "Data Form View",
|
|
@@ -1992,7 +1815,7 @@ o.register("object-form", be, {
|
|
|
1992
1815
|
]
|
|
1993
1816
|
}
|
|
1994
1817
|
]
|
|
1995
|
-
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ (
|
|
1818
|
+
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ U(he, { config: e }), {
|
|
1996
1819
|
namespace: "plugin-form",
|
|
1997
1820
|
label: "Embeddable Form",
|
|
1998
1821
|
category: "plugin",
|
|
@@ -2030,7 +1853,7 @@ o.register("object-form", be, {
|
|
|
2030
1853
|
label: "Allow Multiple Submissions"
|
|
2031
1854
|
}
|
|
2032
1855
|
]
|
|
2033
|
-
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ (
|
|
1856
|
+
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ U(_e, {
|
|
2034
1857
|
formId: e.formId,
|
|
2035
1858
|
formTitle: e.formTitle,
|
|
2036
1859
|
metrics: e.metrics || { totalSubmissions: 0 }
|
|
@@ -2058,4 +1881,4 @@ o.register("object-form", be, {
|
|
|
2058
1881
|
]
|
|
2059
1882
|
});
|
|
2060
1883
|
//#endregion
|
|
2061
|
-
export {
|
|
1884
|
+
export { Q as DrawerForm, he as EmbeddableForm, _e as FormAnalytics, G as FormSection, pe as ModalForm, $ as ObjectForm, J as SplitForm, K as TabbedForm, q as WizardForm, Y as applyAutoColSpan, Z as applyAutoLayout, le as filterCreateModeFields, se as inferColumns, X as inferModalSize, oe as isAutoGeneratedFieldType, ae as isWideFieldType };
|