@object-ui/plugin-form 5.0.1 → 5.0.2

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/dist/index.js CHANGED
@@ -1,48 +1,48 @@
1
- import e, { useCallback as t, useEffect as n, useId as r, useMemo as i, useState as a } from "react";
2
- import { ComponentRegistry as o } from "@object-ui/core";
3
- import { SchemaRenderer as s, useSafeFieldLabel as c } from "@object-ui/react";
4
- import { buildValidationRules as l, evaluateCondition as u, formatFileSize as d, mapFieldTypeToFormType as f } from "@object-ui/fields";
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
- import { usePermissions as z } from "@object-ui/permissions";
7
- import { Check as B, ChevronDown as V, ChevronLeft as H, ChevronRight as U, Loader2 as ee } from "lucide-react";
8
- import { Fragment as te, jsx as W, jsxs as G } from "react/jsx-runtime";
1
+ import e, { useCallback as t, useEffect as n, useId as r, useMemo as i, useRef as a, useState as o } from "react";
2
+ import { ComponentRegistry as s } from "@object-ui/core";
3
+ import { SchemaRenderer as c, useSafeFieldLabel as l } from "@object-ui/react";
4
+ import { buildValidationRules as u, evaluateCondition as d, formatFileSize as f, mapFieldTypeToFormType as p } from "@object-ui/fields";
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
+ 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 ne, Lock as W, ShieldCheck as G } from "lucide-react";
8
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
9
9
  //#region src/FormSection.tsx
10
- var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: o, className: s, gridClassName: c }) => {
11
- let [l, u] = a(r);
12
- return /* @__PURE__ */ G("div", {
13
- className: L("form-section", s),
14
- children: [(e || t) && /* @__PURE__ */ G("div", {
15
- className: L("flex items-start gap-2 mb-4", n && "cursor-pointer select-none"),
10
+ var Y = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: a, className: s, gridClassName: c }) => {
11
+ let [l, u] = o(r);
12
+ return /* @__PURE__ */ J("div", {
13
+ className: R("form-section", s),
14
+ children: [(e || t) && /* @__PURE__ */ J("div", {
15
+ className: R("flex items-start gap-2 mb-4", n && "cursor-pointer select-none"),
16
16
  onClick: () => {
17
17
  n && u(!l);
18
18
  },
19
19
  role: n ? "button" : void 0,
20
20
  "aria-expanded": n ? !l : void 0,
21
- children: [n && /* @__PURE__ */ W("span", {
21
+ children: [n && /* @__PURE__ */ q("span", {
22
22
  className: "mt-0.5 text-muted-foreground",
23
- children: W(l ? U : V, { className: "h-4 w-4" })
24
- }), /* @__PURE__ */ G("div", {
23
+ children: q(l ? U : H, { className: "h-4 w-4" })
24
+ }), /* @__PURE__ */ J("div", {
25
25
  className: "flex-1",
26
- children: [e && /* @__PURE__ */ W("h3", {
26
+ children: [e && /* @__PURE__ */ q("h3", {
27
27
  className: "text-base font-semibold text-foreground",
28
28
  children: e
29
- }), t && /* @__PURE__ */ W("p", {
29
+ }), t && /* @__PURE__ */ q("p", {
30
30
  className: "text-sm text-muted-foreground mt-0.5",
31
31
  children: t
32
32
  })]
33
33
  })]
34
- }), !l && /* @__PURE__ */ W("div", {
35
- className: L("grid gap-4", c || {
34
+ }), !l && /* @__PURE__ */ q("div", {
35
+ className: R("grid gap-4", c || {
36
36
  1: "grid-cols-1",
37
37
  2: "grid-cols-1 md:grid-cols-2",
38
38
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
39
39
  4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
40
40
  }[i]),
41
- children: o
41
+ children: a
42
42
  })]
43
43
  });
44
- }, q = ({ schema: n, dataSource: r, className: i }) => {
45
- 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");
44
+ }, X = ({ schema: n, dataSource: r, className: i }) => {
45
+ 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
46
  e.useEffect(() => {
47
47
  (async () => {
48
48
  if (!r) {
@@ -56,7 +56,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
56
56
  }
57
57
  })();
58
58
  }, [n.objectName, r]), e.useEffect(() => {
59
- (u || !r) && (async () => {
59
+ (s || !r) && (async () => {
60
60
  if (n.mode === "create" || !n.recordId || !r) {
61
61
  m(n.initialData || n.initialValues || {}), g(!1);
62
62
  return;
@@ -70,7 +70,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
70
70
  }
71
71
  })();
72
72
  }, [
73
- u,
73
+ s,
74
74
  n.mode,
75
75
  n.recordId,
76
76
  n.initialData,
@@ -83,17 +83,17 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
83
83
  for (let r of e.fields) {
84
84
  let e = typeof r == "string" ? r : r.name;
85
85
  if (typeof r == "object") t.push(r);
86
- else if (u?.fields?.[e]) {
87
- let r = u.fields[e];
86
+ else if (s?.fields?.[e]) {
87
+ let r = s.fields[e];
88
88
  t.push({
89
89
  name: e,
90
- label: o(n.objectName, e, r.label || e),
91
- type: f(r.type),
90
+ label: a(n.objectName, e, r.label || e),
91
+ type: p(r.type),
92
92
  required: r.required || !1,
93
93
  disabled: n.readOnly || n.mode === "view" || r.readonly,
94
94
  placeholder: r.placeholder,
95
95
  description: r.help || r.description,
96
- validation: l(r),
96
+ validation: u(r),
97
97
  field: r,
98
98
  options: r.options,
99
99
  multiple: r.multiple
@@ -106,7 +106,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
106
106
  }
107
107
  return t;
108
108
  }, [
109
- u,
109
+ s,
110
110
  n.readOnly,
111
111
  n.mode
112
112
  ]), S = t(async (e) => {
@@ -120,19 +120,19 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
120
120
  }, [n, r]), C = t(() => {
121
121
  n.onCancel && n.onCancel();
122
122
  }, [n]), w = (e, t) => e.name || e.label || `tab-${t}`;
123
- if (_) return /* @__PURE__ */ G("div", {
123
+ if (_) return /* @__PURE__ */ J("div", {
124
124
  className: "p-4 border border-red-300 bg-red-50 rounded-md",
125
- children: [/* @__PURE__ */ W("h3", {
125
+ children: [/* @__PURE__ */ q("h3", {
126
126
  className: "text-red-800 font-semibold",
127
127
  children: "Error loading form"
128
- }), /* @__PURE__ */ W("p", {
128
+ }), /* @__PURE__ */ q("p", {
129
129
  className: "text-red-600 text-sm mt-1",
130
130
  children: _.message
131
131
  })]
132
132
  });
133
- if (h) return /* @__PURE__ */ G("div", {
133
+ if (h) return /* @__PURE__ */ J("div", {
134
134
  className: "p-8 text-center",
135
- children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
135
+ children: [/* @__PURE__ */ q("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ q("p", {
136
136
  className: "mt-2 text-sm text-gray-600",
137
137
  children: "Loading form..."
138
138
  })]
@@ -141,7 +141,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
141
141
  type: "form",
142
142
  fields: n.sections.flatMap((e) => x(e)),
143
143
  layout: "vertical",
144
- defaultValues: p,
144
+ defaultValues: f,
145
145
  submitLabel: n.submitText || (n.mode === "create" ? "Create" : "Update"),
146
146
  cancelLabel: n.cancelText,
147
147
  showSubmit: n.showSubmit !== !1 && n.mode !== "view",
@@ -149,29 +149,29 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
149
149
  onSubmit: S,
150
150
  onCancel: C
151
151
  }, E = n.tabPosition === "left" || n.tabPosition === "right";
152
- return /* @__PURE__ */ W("div", {
153
- className: L("w-full", i, n.className),
154
- children: /* @__PURE__ */ G(N, {
152
+ return /* @__PURE__ */ q("div", {
153
+ className: R("w-full", i, n.className),
154
+ children: /* @__PURE__ */ J(P, {
155
155
  value: y,
156
156
  onValueChange: b,
157
157
  orientation: E ? "vertical" : "horizontal",
158
- className: L(E && "flex gap-4"),
159
- children: [/* @__PURE__ */ W(F, {
160
- className: L(E ? "flex-col h-auto" : "", n.tabPosition === "bottom" && "order-last", n.tabPosition === "right" && "order-last"),
161
- children: n.sections.map((e, t) => /* @__PURE__ */ W(I, {
158
+ className: R(E && "flex gap-4"),
159
+ children: [/* @__PURE__ */ q(I, {
160
+ 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__ */ q(L, {
162
162
  value: w(e, t),
163
163
  className: E ? "w-full justify-start" : "",
164
164
  children: e.label || `Tab ${t + 1}`
165
165
  }, w(e, t)))
166
- }), /* @__PURE__ */ W("div", {
166
+ }), /* @__PURE__ */ q("div", {
167
167
  className: "flex-1",
168
- children: n.sections.map((e, t) => /* @__PURE__ */ W(P, {
168
+ children: n.sections.map((e, t) => /* @__PURE__ */ q(F, {
169
169
  value: w(e, t),
170
170
  className: "mt-0",
171
- children: /* @__PURE__ */ W(K, {
171
+ children: /* @__PURE__ */ q(Y, {
172
172
  description: e.description,
173
173
  columns: e.columns || 1,
174
- children: /* @__PURE__ */ W(s, { schema: {
174
+ children: /* @__PURE__ */ q(c, { schema: {
175
175
  ...T,
176
176
  fields: x(e),
177
177
  showSubmit: n.showSubmit !== !1 && n.mode !== "view",
@@ -182,8 +182,8 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
182
182
  })]
183
183
  })
184
184
  });
185
- }, J = ({ schema: n, dataSource: r, className: o }) => {
186
- let { fieldLabel: d } = c(), [m, h] = a(null), [g, _] = a({}), [v, y] = a(!0), [b, x] = a(null), [S, C] = a(0), [w, T] = a(/* @__PURE__ */ new Set()), [E, D] = a(!1), O = n.sections.length, k = S === 0, A = S === O - 1;
185
+ }, Z = ({ schema: n, dataSource: r, className: a }) => {
186
+ 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
187
  e.useEffect(() => {
188
188
  (async () => {
189
189
  if (!r) {
@@ -197,7 +197,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
197
197
  }
198
198
  })();
199
199
  }, [n.objectName, r]), e.useEffect(() => {
200
- (m || !r) && (async () => {
200
+ (f || !r) && (async () => {
201
201
  if (n.mode === "create" || !n.recordId || !r) {
202
202
  _(n.initialData || n.initialValues || {}), y(!1);
203
203
  return;
@@ -211,7 +211,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
211
211
  }
212
212
  })();
213
213
  }, [
214
- m,
214
+ f,
215
215
  n.mode,
216
216
  n.recordId,
217
217
  n.initialData,
@@ -222,22 +222,22 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
222
222
  let j = t((e) => {
223
223
  let t = [], r = (e, t) => typeof t == "string" && t.trim() ? {
224
224
  ...e,
225
- visible: (e) => u(t, e)
225
+ visible: (e) => d(t, e)
226
226
  } : e;
227
227
  for (let i of e.fields) {
228
228
  let e = typeof i == "string" ? i : i.name;
229
229
  if (typeof i == "object") t.push(r(i, i.visibleOn));
230
- else if (m?.fields?.[e]) {
231
- let i = m.fields[e];
230
+ else if (f?.fields?.[e]) {
231
+ let i = f.fields[e];
232
232
  t.push(r({
233
233
  name: e,
234
- label: d(n.objectName, e, i.label || e),
235
- type: f(i.type),
234
+ label: s(n.objectName, e, i.label || e),
235
+ type: p(i.type),
236
236
  required: i.required || !1,
237
237
  disabled: n.readOnly || n.mode === "view" || i.readonly,
238
238
  placeholder: i.placeholder,
239
239
  description: i.help || i.description,
240
- validation: l(i),
240
+ validation: u(i),
241
241
  field: i,
242
242
  options: i.options,
243
243
  multiple: i.multiple
@@ -250,7 +250,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
250
250
  }
251
251
  return t;
252
252
  }, [
253
- m,
253
+ f,
254
254
  n.readOnly,
255
255
  n.mode,
256
256
  n.objectName
@@ -288,7 +288,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
288
288
  P(S - 1);
289
289
  }, [S, P]), I = t(() => {
290
290
  n.onCancel && n.onCancel();
291
- }, [n]), R = t((e) => {
291
+ }, [n]), L = t((e) => {
292
292
  (n.allowSkip || w.has(e) || e <= S) && P(e);
293
293
  }, [
294
294
  n.allowSkip,
@@ -296,52 +296,52 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
296
296
  S,
297
297
  P
298
298
  ]);
299
- if (b) return /* @__PURE__ */ G("div", {
299
+ if (b) return /* @__PURE__ */ J("div", {
300
300
  className: "p-4 border border-red-300 bg-red-50 rounded-md",
301
- children: [/* @__PURE__ */ W("h3", {
301
+ children: [/* @__PURE__ */ q("h3", {
302
302
  className: "text-red-800 font-semibold",
303
303
  children: "Error loading form"
304
- }), /* @__PURE__ */ W("p", {
304
+ }), /* @__PURE__ */ q("p", {
305
305
  className: "text-red-600 text-sm mt-1",
306
306
  children: b.message
307
307
  })]
308
308
  });
309
- if (v) return /* @__PURE__ */ G("div", {
309
+ if (v) return /* @__PURE__ */ J("div", {
310
310
  className: "p-8 text-center",
311
- children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
311
+ children: [/* @__PURE__ */ q("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ q("p", {
312
312
  className: "mt-2 text-sm text-gray-600",
313
313
  children: "Loading form..."
314
314
  })]
315
315
  });
316
316
  let z = n.sections[S];
317
- return /* @__PURE__ */ G("div", {
318
- className: L("w-full", o, n.className),
317
+ return /* @__PURE__ */ J("div", {
318
+ className: R("w-full", a, n.className),
319
319
  children: [
320
- n.showStepIndicator !== !1 && /* @__PURE__ */ W("nav", {
320
+ n.showStepIndicator !== !1 && /* @__PURE__ */ q("nav", {
321
321
  "aria-label": "Progress",
322
322
  className: "mb-8",
323
- children: /* @__PURE__ */ W("ol", {
323
+ children: /* @__PURE__ */ q("ol", {
324
324
  className: "flex items-center",
325
325
  children: n.sections.map((e, t) => {
326
326
  let r = t === S, i = w.has(t), a = n.allowSkip || i || t <= S;
327
- return /* @__PURE__ */ G("li", {
328
- className: L("relative flex-1", t !== O - 1 && "pr-8 sm:pr-12"),
329
- children: [t !== O - 1 && /* @__PURE__ */ W("div", {
327
+ return /* @__PURE__ */ J("li", {
328
+ className: R("relative flex-1", t !== O - 1 && "pr-8 sm:pr-12"),
329
+ children: [t !== O - 1 && /* @__PURE__ */ q("div", {
330
330
  className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
331
331
  "aria-hidden": "true",
332
- children: /* @__PURE__ */ W("div", { className: L("h-full", i ? "bg-primary" : "bg-muted") })
333
- }), /* @__PURE__ */ G("button", {
332
+ children: /* @__PURE__ */ q("div", { className: R("h-full", i ? "bg-primary" : "bg-muted") })
333
+ }), /* @__PURE__ */ J("button", {
334
334
  type: "button",
335
- className: L("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
336
- onClick: () => R(t),
335
+ className: R("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
336
+ onClick: () => L(t),
337
337
  disabled: !a,
338
- children: [/* @__PURE__ */ W("span", {
339
- 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"),
340
- children: i ? /* @__PURE__ */ W(B, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : t + 1
341
- }), /* @__PURE__ */ W("span", {
338
+ children: [/* @__PURE__ */ q("span", {
339
+ 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__ */ q(ee, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : t + 1
341
+ }), /* @__PURE__ */ q("span", {
342
342
  className: "ml-2 sm:ml-3 text-xs sm:text-sm font-medium hidden sm:block",
343
- children: /* @__PURE__ */ W("span", {
344
- className: L(r ? "text-foreground" : "text-muted-foreground"),
343
+ children: /* @__PURE__ */ q("span", {
344
+ className: R(r ? "text-foreground" : "text-muted-foreground"),
345
345
  children: e.label || `Step ${t + 1}`
346
346
  })
347
347
  })]
@@ -350,13 +350,13 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
350
350
  })
351
351
  })
352
352
  }),
353
- /* @__PURE__ */ W("div", {
353
+ /* @__PURE__ */ q("div", {
354
354
  className: "min-h-[200px]",
355
- children: z && /* @__PURE__ */ W(K, {
355
+ children: z && /* @__PURE__ */ q(Y, {
356
356
  label: z.label,
357
357
  description: z.description,
358
358
  columns: z.columns || 1,
359
- children: M.length > 0 ? /* @__PURE__ */ W(s, { schema: {
359
+ children: M.length > 0 ? /* @__PURE__ */ q(c, { schema: {
360
360
  type: "form",
361
361
  fields: M,
362
362
  layout: "vertical",
@@ -364,22 +364,22 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
364
364
  showSubmit: !1,
365
365
  showCancel: !1,
366
366
  onSubmit: N
367
- } }) : /* @__PURE__ */ W("div", {
367
+ } }) : /* @__PURE__ */ q("div", {
368
368
  className: "text-center py-8 text-muted-foreground",
369
369
  children: "No fields configured for this step"
370
370
  })
371
371
  })
372
372
  }),
373
- /* @__PURE__ */ G("div", {
373
+ /* @__PURE__ */ J("div", {
374
374
  className: "flex items-center justify-between mt-6 pt-4 border-t",
375
- children: [/* @__PURE__ */ W("div", { children: n.showCancel !== !1 && /* @__PURE__ */ W(p, {
375
+ children: [/* @__PURE__ */ q("div", { children: n.showCancel !== !1 && /* @__PURE__ */ q(m, {
376
376
  variant: "ghost",
377
377
  onClick: I,
378
378
  children: n.cancelText || "Cancel"
379
- }) }), /* @__PURE__ */ G("div", {
379
+ }) }), /* @__PURE__ */ J("div", {
380
380
  className: "flex items-center gap-2",
381
381
  children: [
382
- /* @__PURE__ */ G("span", {
382
+ /* @__PURE__ */ J("span", {
383
383
  className: "text-sm text-muted-foreground mr-2",
384
384
  children: [
385
385
  "Step ",
@@ -388,26 +388,26 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
388
388
  O
389
389
  ]
390
390
  }),
391
- !k && /* @__PURE__ */ G(p, {
391
+ !k && /* @__PURE__ */ J(m, {
392
392
  variant: "outline",
393
393
  onClick: F,
394
- children: [/* @__PURE__ */ W(H, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
394
+ children: [/* @__PURE__ */ q(te, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
395
395
  }),
396
- A ? /* @__PURE__ */ W(p, {
396
+ A ? /* @__PURE__ */ q(m, {
397
397
  onClick: () => N(g),
398
398
  disabled: E || n.mode === "view",
399
399
  children: E ? "Submitting..." : n.submitText || (n.mode === "create" ? "Create" : "Update")
400
- }) : /* @__PURE__ */ G(p, {
400
+ }) : /* @__PURE__ */ J(m, {
401
401
  onClick: () => N(g),
402
- children: [n.nextText || "Next", /* @__PURE__ */ W(U, { className: "h-4 w-4 ml-1" })]
402
+ children: [n.nextText || "Next", /* @__PURE__ */ q(U, { className: "h-4 w-4 ml-1" })]
403
403
  })
404
404
  ]
405
405
  })]
406
406
  })
407
407
  ]
408
408
  });
409
- }, Y = ({ schema: e, dataSource: r, className: o }) => {
410
- let { fieldLabel: d } = c(), [p, m] = a(null), [h, g] = a({}), [_, v] = a(!0), [y, b] = a(null);
409
+ }, Q = ({ schema: e, dataSource: r, className: a }) => {
410
+ let { fieldLabel: s } = l(), [f, m] = o(null), [h, g] = o({}), [_, v] = o(!0), [y, b] = o(null);
411
411
  n(() => {
412
412
  (async () => {
413
413
  if (!r) {
@@ -421,7 +421,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
421
421
  }
422
422
  })();
423
423
  }, [e.objectName, r]), n(() => {
424
- (p || !r) && (async () => {
424
+ (f || !r) && (async () => {
425
425
  if (e.mode === "create" || !e.recordId) {
426
426
  g(e.initialData || e.initialValues || {}), v(!1);
427
427
  return;
@@ -439,7 +439,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
439
439
  }
440
440
  })();
441
441
  }, [
442
- p,
442
+ f,
443
443
  e.mode,
444
444
  e.recordId,
445
445
  e.initialData,
@@ -450,22 +450,22 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
450
450
  let x = t((t) => {
451
451
  let n = [], r = (e, t) => typeof t == "string" && t.trim() ? {
452
452
  ...e,
453
- visible: (e) => u(t, e)
453
+ visible: (e) => d(t, e)
454
454
  } : e;
455
455
  for (let i of t.fields) {
456
456
  let t = typeof i == "string" ? i : i.name;
457
457
  if (typeof i == "object") n.push(r(i, i.visibleOn));
458
- else if (p?.fields?.[t]) {
459
- let i = p.fields[t];
458
+ else if (f?.fields?.[t]) {
459
+ let i = f.fields[t];
460
460
  n.push(r({
461
461
  name: t,
462
- label: d(e.objectName, t, i.label || t),
463
- type: f(i.type),
462
+ label: s(e.objectName, t, i.label || t),
463
+ type: p(i.type),
464
464
  required: i.required || !1,
465
465
  disabled: e.readOnly || e.mode === "view" || i.readonly,
466
466
  placeholder: i.placeholder,
467
467
  description: i.help || i.description,
468
- validation: l(i),
468
+ validation: u(i),
469
469
  field: i,
470
470
  options: i.options,
471
471
  multiple: i.multiple
@@ -478,7 +478,7 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
478
478
  }
479
479
  return n;
480
480
  }, [
481
- p,
481
+ f,
482
482
  e.readOnly,
483
483
  e.mode,
484
484
  e.objectName
@@ -492,22 +492,22 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
492
492
  }
493
493
  }, [e, r]), C = t(() => {
494
494
  e.onCancel && e.onCancel();
495
- }, [e]), D = i(() => e.sections.slice(0, 1), [e.sections]), O = i(() => e.sections.slice(1), [e.sections]);
495
+ }, [e]), w = i(() => e.sections.slice(0, 1), [e.sections]), O = i(() => e.sections.slice(1), [e.sections]);
496
496
  i(() => e.sections.flatMap((e) => x(e)), [e.sections, x]);
497
497
  let k = e.splitDirection || "horizontal", A = e.splitSize || 50;
498
- if (y) return /* @__PURE__ */ G("div", {
498
+ if (y) return /* @__PURE__ */ J("div", {
499
499
  className: "p-4 border border-red-300 bg-red-50 rounded-md",
500
- children: [/* @__PURE__ */ W("h3", {
500
+ children: [/* @__PURE__ */ q("h3", {
501
501
  className: "text-red-800 font-semibold",
502
502
  children: "Error loading form"
503
- }), /* @__PURE__ */ W("p", {
503
+ }), /* @__PURE__ */ q("p", {
504
504
  className: "text-red-600 text-sm mt-1",
505
505
  children: y.message
506
506
  })]
507
507
  });
508
- if (_) return /* @__PURE__ */ G("div", {
508
+ if (_) return /* @__PURE__ */ J("div", {
509
509
  className: "p-8 text-center",
510
- children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
510
+ children: [/* @__PURE__ */ q("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ q("p", {
511
511
  className: "mt-2 text-sm text-gray-600",
512
512
  children: "Loading form..."
513
513
  })]
@@ -518,13 +518,13 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
518
518
  defaultValues: h,
519
519
  onSubmit: S,
520
520
  onCancel: C
521
- }, M = (t, n) => /* @__PURE__ */ W("div", {
521
+ }, M = (t, n) => /* @__PURE__ */ q("div", {
522
522
  className: "space-y-4 p-4",
523
- children: t.map((t, r) => /* @__PURE__ */ W(K, {
523
+ children: t.map((t, r) => /* @__PURE__ */ q(Y, {
524
524
  label: t.label,
525
525
  description: t.description,
526
526
  columns: t.columns || 1,
527
- children: /* @__PURE__ */ W(s, { schema: {
527
+ children: /* @__PURE__ */ q(c, { schema: {
528
528
  ...j,
529
529
  fields: x(t),
530
530
  showSubmit: n && e.showSubmit !== !1 && e.mode !== "view",
@@ -534,28 +534,28 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
534
534
  } })
535
535
  }, t.name || t.label || r))
536
536
  });
537
- return /* @__PURE__ */ W("div", {
538
- className: L("w-full", o, e.className),
539
- children: /* @__PURE__ */ G(E, {
537
+ return /* @__PURE__ */ q("div", {
538
+ className: R("w-full", a, e.className),
539
+ children: /* @__PURE__ */ J(D, {
540
540
  orientation: k,
541
541
  className: "min-h-[300px] rounded-lg border",
542
- children: [/* @__PURE__ */ W(T, {
542
+ children: [/* @__PURE__ */ q(E, {
543
543
  defaultSize: A,
544
544
  minSize: 20,
545
- children: M(D, O.length === 0)
546
- }), O.length > 0 && /* @__PURE__ */ G(te, { children: [/* @__PURE__ */ W(w, { withHandle: e.splitResizable !== !1 }), /* @__PURE__ */ W(T, {
545
+ children: M(w, O.length === 0)
546
+ }), O.length > 0 && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(T, { withHandle: e.splitResizable !== !1 }), /* @__PURE__ */ q(E, {
547
547
  defaultSize: 100 - A,
548
548
  minSize: 20,
549
549
  children: M(O, !0)
550
550
  })] })]
551
551
  })
552
552
  });
553
- }, X = new Set([
553
+ }, re = new Set([
554
554
  "field:formula",
555
555
  "field:summary",
556
556
  "field:auto_number",
557
557
  "field:autonumber"
558
- ]), Z = new Set([
558
+ ]), ie = new Set([
559
559
  "field:textarea",
560
560
  "field:markdown",
561
561
  "field:html",
@@ -566,28 +566,28 @@ var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
566
566
  "html",
567
567
  "grid",
568
568
  "rich-text"
569
- ]), ne = new Set([
569
+ ]), ae = new Set([
570
570
  "formula",
571
571
  "summary",
572
572
  "auto_number",
573
573
  "autonumber"
574
574
  ]);
575
- function Q(e) {
576
- return Z.has(e);
575
+ function oe(e) {
576
+ return ie.has(e);
577
577
  }
578
- function re(e) {
579
- return ne.has(e);
578
+ function se(e) {
579
+ return ae.has(e);
580
580
  }
581
- function ie(e) {
581
+ function ce(e) {
582
582
  return e <= 3 ? 1 : 2;
583
583
  }
584
- function ae(e, t) {
585
- return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type && Q(e.type) ? {
584
+ function le(e, t) {
585
+ return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type && oe(e.type) ? {
586
586
  ...e,
587
587
  colSpan: t
588
588
  } : e);
589
589
  }
590
- var oe = new Set([
590
+ var ue = new Set([
591
591
  "id",
592
592
  "created_at",
593
593
  "createdAt",
@@ -614,42 +614,42 @@ var oe = new Set([
614
614
  "_version",
615
615
  "_rev"
616
616
  ]);
617
- function se(e, t) {
618
- return e.filter((e) => !(oe.has(e.name) || t?.fields?.[e.name]?.readonly === !0));
617
+ function de(e, t) {
618
+ return e.filter((e) => !(ue.has(e.name) || t?.fields?.[e.name]?.readonly === !0));
619
619
  }
620
- function ce(e, t) {
620
+ function fe(e, t) {
621
621
  return e.filter((e) => {
622
- if (oe.has(e.name) || e.type && X.has(e.type)) return !1;
622
+ if (ue.has(e.name) || e.type && re.has(e.type)) return !1;
623
623
  if (!t?.fields) return !0;
624
624
  let n = t.fields[e.name];
625
- return n ? n.readonly === !0 ? !1 : !re(n.type) : !0;
625
+ return n ? n.readonly === !0 ? !1 : !se(n.type) : !0;
626
626
  });
627
627
  }
628
- function le(e, t) {
628
+ function pe(e, t) {
629
629
  return e.filter((e) => {
630
- if (e.type && X.has(e.type)) return !1;
630
+ if (e.type && re.has(e.type)) return !1;
631
631
  let n = t?.fields?.[e.name];
632
- return n ? !re(n.type) : !0;
632
+ return n ? !se(n.type) : !0;
633
633
  });
634
634
  }
635
- function ue(e) {
635
+ function me(e) {
636
636
  return e <= 1 ? "default" : e === 2 ? "xl" : "full";
637
637
  }
638
638
  function $(e, t, n, r) {
639
639
  let i = [...e];
640
- if (i = se(i, t), r === "create" && (i = le(i, t)), n !== void 0) return i = ae(i, n), {
640
+ if (i = de(i, t), r === "create" && (i = pe(i, t)), n !== void 0) return i = le(i, n), {
641
641
  fields: i,
642
642
  columns: n
643
643
  };
644
- let a = ie(i.length);
645
- return i = ae(i, a), {
644
+ let a = ce(i.length);
645
+ return i = le(i, a), {
646
646
  fields: i,
647
647
  columns: a
648
648
  };
649
649
  }
650
650
  //#endregion
651
651
  //#region src/sanitize.ts
652
- var de = new Set([
652
+ var he = new Set([
653
653
  "id",
654
654
  "_id",
655
655
  "created_at",
@@ -658,7 +658,7 @@ var de = new Set([
658
658
  "updatedAt",
659
659
  "organization_id",
660
660
  "organizationId"
661
- ]), fe = new Set([
661
+ ]), ge = new Set([
662
662
  "formula",
663
663
  "rollup",
664
664
  "lookup_value",
@@ -666,15 +666,15 @@ var de = new Set([
666
666
  "autonumber",
667
667
  "computed"
668
668
  ]);
669
- function pe(e, t) {
669
+ function _e(e, t) {
670
670
  if (!e || typeof e != "object") return e;
671
671
  let n = {}, r = t?.fields;
672
- for (let [t, i] of Object.entries(e)) if (!de.has(t)) {
672
+ for (let [t, i] of Object.entries(e)) if (!he.has(t)) {
673
673
  if (r) {
674
674
  let e = r[t];
675
675
  if (!e) continue;
676
676
  let n = String(e.type || "").toLowerCase();
677
- if (fe.has(n) || e.computed === !0 || e.formula || e.readOnly === !0 || e.readonly === !0) continue;
677
+ if (ge.has(n) || e.computed === !0 || e.formula || e.readOnly === !0 || e.readonly === !0) continue;
678
678
  }
679
679
  n[t] = i;
680
680
  }
@@ -682,13 +682,13 @@ function pe(e, t) {
682
682
  }
683
683
  //#endregion
684
684
  //#region src/DrawerForm.tsx
685
- var me = {
685
+ var ve = {
686
686
  1: void 0,
687
687
  2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
688
688
  3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
689
689
  4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
690
- }, he = ({ schema: e, dataSource: r, className: o }) => {
691
- 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(() => {
690
+ }, ye = ({ schema: e, dataSource: r, className: a }) => {
691
+ let { fieldLabel: s } = l(), [d, f] = o(null), [m, h] = o([]), [g, _] = o({}), [v, y] = o(!0), [b, x] = o(null), S = e.open !== !1, C = e.drawerSide || "right", [w, T] = o(() => {
692
692
  let t = {};
693
693
  return e.sections?.forEach((e, n) => {
694
694
  let r = e.name || String(n);
@@ -702,7 +702,7 @@ var me = {
702
702
  return;
703
703
  }
704
704
  try {
705
- p(await r.getObjectSchema(e.objectName));
705
+ f(await r.getObjectSchema(e.objectName));
706
706
  } catch (e) {
707
707
  x(e), y(!1);
708
708
  }
@@ -743,13 +743,13 @@ var me = {
743
743
  let r = d.fields[t];
744
744
  n.push({
745
745
  name: t,
746
- label: u(e.objectName, t, r.label || t),
747
- type: f(r.type),
746
+ label: s(e.objectName, t, r.label || t),
747
+ type: p(r.type),
748
748
  required: r.required || !1,
749
749
  disabled: e.readOnly || e.mode === "view" || r.readonly,
750
750
  placeholder: r.placeholder,
751
751
  description: r.help || r.description,
752
- validation: l(r),
752
+ validation: u(r),
753
753
  field: r,
754
754
  options: r.options,
755
755
  multiple: r.multiple
@@ -784,13 +784,13 @@ var me = {
784
784
  let i = d.fields?.[t];
785
785
  i && n.push({
786
786
  name: t,
787
- label: u(e.objectName, t, i.label || t),
788
- type: f(i.type),
787
+ label: s(e.objectName, t, i.label || t),
788
+ type: p(i.type),
789
789
  required: i.required || !1,
790
790
  disabled: e.readOnly || e.mode === "view" || i.readonly,
791
791
  placeholder: i.placeholder,
792
792
  description: i.help || i.description,
793
- validation: l(i),
793
+ validation: u(i),
794
794
  field: i,
795
795
  options: i.options,
796
796
  multiple: i.multiple
@@ -806,10 +806,10 @@ var me = {
806
806
  e.mode,
807
807
  r
808
808
  ]);
809
- let M = t(async (t) => {
809
+ let D = t(async (t) => {
810
810
  if (!r) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
811
811
  try {
812
- let n, i = pe(t, d);
812
+ let n, i = _e(t, d);
813
813
  return e.mode === "create" ? n = await r.create(e.objectName, i) : e.mode === "edit" && e.recordId && (n = await r.update(e.objectName, e.recordId, i)), e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
814
814
  } catch (t) {
815
815
  throw e.onError && e.onError(t), t;
@@ -836,32 +836,32 @@ var me = {
836
836
  cancelLabel: e.cancelText,
837
837
  showSubmit: e.showSubmit !== !1 && e.mode !== "view",
838
838
  showCancel: e.showCancel !== !1,
839
- onSubmit: M,
839
+ onSubmit: D,
840
840
  onCancel: N
841
841
  };
842
- return /* @__PURE__ */ W(D, {
842
+ return /* @__PURE__ */ q(O, {
843
843
  open: S,
844
844
  onOpenChange: e.onOpenChange,
845
- children: /* @__PURE__ */ G(O, {
845
+ children: /* @__PURE__ */ J(k, {
846
846
  side: C,
847
- className: L("overflow-y-auto", o, e.className),
847
+ className: R("overflow-y-auto", a, e.className),
848
848
  style: P,
849
- children: [(e.title || e.description) && /* @__PURE__ */ G(A, { children: [e.title && /* @__PURE__ */ W(j, { children: e.title }), e.description && /* @__PURE__ */ W(k, { children: e.description })] }), /* @__PURE__ */ W("div", {
849
+ children: [(e.title || e.description) && /* @__PURE__ */ J(j, { children: [e.title && /* @__PURE__ */ q(M, { children: e.title }), e.description && /* @__PURE__ */ q(A, { children: e.description })] }), /* @__PURE__ */ q("div", {
850
850
  className: "@container py-4",
851
851
  children: (() => {
852
- if (b) return /* @__PURE__ */ G("div", {
852
+ if (b) return /* @__PURE__ */ J("div", {
853
853
  className: "p-4 border border-red-300 bg-red-50 rounded-md",
854
- children: [/* @__PURE__ */ W("h3", {
854
+ children: [/* @__PURE__ */ q("h3", {
855
855
  className: "text-red-800 font-semibold",
856
856
  children: "Error loading form"
857
- }), /* @__PURE__ */ W("p", {
857
+ }), /* @__PURE__ */ q("p", {
858
858
  className: "text-red-600 text-sm mt-1",
859
859
  children: b.message
860
860
  })]
861
861
  });
862
- if (v) return /* @__PURE__ */ G("div", {
862
+ if (v) return /* @__PURE__ */ J("div", {
863
863
  className: "p-8 text-center",
864
- children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
864
+ children: [/* @__PURE__ */ q("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ q("p", {
865
865
  className: "mt-2 text-sm text-gray-600",
866
866
  children: "Loading form..."
867
867
  })]
@@ -887,13 +887,13 @@ var me = {
887
887
  ...e,
888
888
  hidden: !0
889
889
  }))) : t.push(...a);
890
- }), /* @__PURE__ */ W(s, { schema: {
890
+ }), /* @__PURE__ */ q(c, { schema: {
891
891
  ...F,
892
892
  fields: t
893
893
  } });
894
894
  }
895
- let t = $(m, d, e.columns, e.mode), n = me[t.columns || 1];
896
- return /* @__PURE__ */ W(s, { schema: {
895
+ let t = $(m, d, e.columns, e.mode), n = ve[t.columns || 1];
896
+ return /* @__PURE__ */ q(c, { schema: {
897
897
  ...F,
898
898
  fields: t.fields,
899
899
  columns: t.columns,
@@ -903,19 +903,19 @@ var me = {
903
903
  })]
904
904
  })
905
905
  });
906
- }, ge = {
906
+ }, be = {
907
907
  sm: "sm:max-w-sm",
908
908
  default: "sm:max-w-lg",
909
909
  lg: "sm:max-w-2xl",
910
910
  xl: "sm:max-w-5xl",
911
911
  full: "sm:max-w-[95vw] sm:w-full"
912
- }, _e = {
912
+ }, xe = {
913
913
  1: void 0,
914
914
  2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
915
915
  3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
916
916
  4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
917
- }, ve = ({ schema: e, dataSource: o, className: d }) => {
918
- let { fieldLabel: m } = c(), h = z(), g = t((t) => {
917
+ }, Se = ({ schema: e, dataSource: a, className: s }) => {
918
+ let { fieldLabel: f } = l(), h = B(), g = t((t) => {
919
919
  if (!h?.isLoaded) return t;
920
920
  let n = [];
921
921
  for (let r of t) {
@@ -934,50 +934,50 @@ var me = {
934
934
  h,
935
935
  e.objectName,
936
936
  e.mode
937
- ]), [_, v] = a(null), [w, T] = a([]), [E, D] = a({}), [O, k] = a(!0), [A, j] = a(null), [N, P] = a(!1), F = e.open !== !1, I = r(), R = i(() => e.sections?.length || e.customFields?.length ? null : $(w, _, e.columns, e.mode), [
938
- w,
937
+ ]), [_, v] = o(null), [y, T] = o([]), [E, D] = o({}), [O, k] = o(!0), [A, j] = o(null), [M, P] = o(!1), F = e.open !== !1, I = r(), L = i(() => e.sections?.length || e.customFields?.length ? null : $(y, _, e.columns, e.mode), [
938
+ y,
939
939
  _,
940
940
  e.columns,
941
941
  e.mode,
942
942
  e.sections,
943
943
  e.customFields
944
- ]), B = ge[i(() => {
944
+ ]), z = be[i(() => {
945
945
  if (e.modalSize) return e.modalSize;
946
- if (R?.columns && R.columns > 1) return ue(R.columns);
946
+ if (L?.columns && L.columns > 1) return me(L.columns);
947
947
  if (e.sections?.length) {
948
948
  let t = Math.max(...e.sections.map((e) => Number(e.columns) || 1));
949
- if (t > 1) return ue(t);
949
+ if (t > 1) return me(t);
950
950
  }
951
951
  return "default";
952
952
  }, [
953
953
  e.modalSize,
954
- R,
954
+ L,
955
955
  e.sections
956
- ])] || ge.default;
956
+ ])] || be.default;
957
957
  n(() => {
958
958
  (async () => {
959
- if (!o) {
959
+ if (!a) {
960
960
  k(!1);
961
961
  return;
962
962
  }
963
963
  try {
964
- v(await o.getObjectSchema(e.objectName));
964
+ v(await a.getObjectSchema(e.objectName));
965
965
  } catch (e) {
966
966
  j(e), k(!1);
967
967
  }
968
968
  })();
969
- }, [e.objectName, o]), n(() => {
970
- (_ || !o) && (async () => {
969
+ }, [e.objectName, a]), n(() => {
970
+ (_ || !a) && (async () => {
971
971
  if (e.mode === "create" || !e.recordId) {
972
972
  D(e.initialData || e.initialValues || {}), k(!1);
973
973
  return;
974
974
  }
975
- if (!o) {
975
+ if (!a) {
976
976
  D(e.initialData || e.initialValues || {}), k(!1);
977
977
  return;
978
978
  }
979
979
  try {
980
- D(await o.findOne(e.objectName, e.recordId) || {});
980
+ D(await a.findOne(e.objectName, e.recordId) || {});
981
981
  } catch (e) {
982
982
  j(e);
983
983
  } finally {
@@ -990,13 +990,13 @@ var me = {
990
990
  e.recordId,
991
991
  e.initialData,
992
992
  e.initialValues,
993
- o,
993
+ a,
994
994
  e.objectName
995
995
  ]);
996
- let V = t((t) => {
996
+ let ee = t((t) => {
997
997
  let n = [], r = (e, t) => typeof t == "string" && t.trim() ? {
998
998
  ...e,
999
- visible: (e) => u(t, e)
999
+ visible: (e) => d(t, e)
1000
1000
  } : e;
1001
1001
  for (let i of t.fields) {
1002
1002
  let t = typeof i == "string" ? i : i.name;
@@ -1005,13 +1005,13 @@ var me = {
1005
1005
  let i = _.fields[t];
1006
1006
  n.push(r({
1007
1007
  name: t,
1008
- label: m(e.objectName, t, i.label || t),
1009
- type: f(i.type),
1008
+ label: f(e.objectName, t, i.label || t),
1009
+ type: p(i.type),
1010
1010
  required: i.required || !1,
1011
1011
  disabled: e.readOnly || e.mode === "view" || i.readonly,
1012
1012
  placeholder: i.placeholder,
1013
1013
  description: i.help || i.description,
1014
- validation: l(i),
1014
+ validation: u(i),
1015
1015
  field: i,
1016
1016
  options: i.options,
1017
1017
  multiple: i.multiple
@@ -1030,7 +1030,7 @@ var me = {
1030
1030
  e.objectName
1031
1031
  ]);
1032
1032
  n(() => {
1033
- if (!_ && o) return;
1033
+ if (!_ && a) return;
1034
1034
  if (e.customFields?.length) {
1035
1035
  T(e.customFields), k(!1);
1036
1036
  return;
@@ -1047,13 +1047,13 @@ var me = {
1047
1047
  let i = _.fields?.[t];
1048
1048
  i && n.push({
1049
1049
  name: t,
1050
- label: m(e.objectName, t, i.label || t),
1051
- type: f(i.type),
1050
+ label: f(e.objectName, t, i.label || t),
1051
+ type: p(i.type),
1052
1052
  required: i.required || !1,
1053
1053
  disabled: e.readOnly || e.mode === "view" || i.readonly,
1054
1054
  placeholder: i.placeholder,
1055
1055
  description: i.help || i.description,
1056
- validation: l(i),
1056
+ validation: u(i),
1057
1057
  field: i,
1058
1058
  options: i.options,
1059
1059
  multiple: i.multiple
@@ -1067,19 +1067,19 @@ var me = {
1067
1067
  e.sections,
1068
1068
  e.readOnly,
1069
1069
  e.mode,
1070
- o
1070
+ a
1071
1071
  ]);
1072
- let H = t(async (t) => {
1072
+ let V = t(async (t) => {
1073
1073
  P(!0);
1074
1074
  try {
1075
- if (!o) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
1076
- let n, r = pe(t, _);
1075
+ if (!a) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
1076
+ let n, r = _e(t, _);
1077
1077
  if (h?.isLoaded) {
1078
1078
  let t = {};
1079
1079
  for (let n of Object.keys(r)) h.checkField(e.objectName, n, "write") && (t[n] = r[n]);
1080
1080
  r = t;
1081
1081
  }
1082
- return e.mode === "create" ? n = await o.create(e.objectName, r) : e.mode === "edit" && e.recordId && (n = await o.update(e.objectName, e.recordId, r)), e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
1082
+ return e.mode === "create" ? n = await a.create(e.objectName, r) : e.mode === "edit" && e.recordId && (n = await a.update(e.objectName, e.recordId, r)), e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
1083
1083
  } catch (t) {
1084
1084
  throw e.onError && e.onError(t), t;
1085
1085
  } finally {
@@ -1087,110 +1087,110 @@ var me = {
1087
1087
  }
1088
1088
  }, [
1089
1089
  e,
1090
- o,
1090
+ a,
1091
1091
  _,
1092
1092
  h
1093
- ]), U = t(() => {
1093
+ ]), H = t(() => {
1094
1094
  e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
1095
- }, [e]), te = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", q = e.showSubmit !== !1 && e.mode !== "view", J = e.showCancel !== !1, Y = e.submitText || (e.mode === "create" ? "Create" : "Update"), X = e.cancelText || "Cancel", Z = {
1095
+ }, [e]), te = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", U = e.showSubmit !== !1 && e.mode !== "view", W = e.showCancel !== !1, G = e.submitText || (e.mode === "create" ? "Create" : "Update"), K = e.cancelText || "Cancel", X = {
1096
1096
  type: "form",
1097
1097
  layout: te,
1098
1098
  defaultValues: E,
1099
- submitLabel: Y,
1100
- cancelLabel: X,
1101
- showSubmit: q,
1102
- showCancel: J,
1103
- onSubmit: H,
1104
- onCancel: U,
1099
+ submitLabel: G,
1100
+ cancelLabel: K,
1101
+ showSubmit: U,
1102
+ showCancel: W,
1103
+ onSubmit: V,
1104
+ onCancel: H,
1105
1105
  showActions: !1,
1106
1106
  id: I
1107
- }, ne = () => {
1108
- if (A) return /* @__PURE__ */ G("div", {
1107
+ }, Z = () => {
1108
+ if (A) return /* @__PURE__ */ J("div", {
1109
1109
  className: "p-4 border border-red-300 bg-red-50 rounded-md",
1110
- children: [/* @__PURE__ */ W("h3", {
1110
+ children: [/* @__PURE__ */ q("h3", {
1111
1111
  className: "text-red-800 font-semibold",
1112
1112
  children: "Error loading form"
1113
- }), /* @__PURE__ */ W("p", {
1113
+ }), /* @__PURE__ */ q("p", {
1114
1114
  className: "text-red-600 text-sm mt-1",
1115
1115
  children: A.message
1116
1116
  })]
1117
1117
  });
1118
- if (O) return /* @__PURE__ */ W("div", {
1118
+ if (O) return /* @__PURE__ */ q("div", {
1119
1119
  className: "space-y-4",
1120
1120
  "data-testid": "modal-form-skeleton",
1121
1121
  children: [
1122
1122
  1,
1123
1123
  2,
1124
1124
  3
1125
- ].map((e) => /* @__PURE__ */ G("div", {
1125
+ ].map((e) => /* @__PURE__ */ J("div", {
1126
1126
  className: "space-y-2",
1127
- children: [/* @__PURE__ */ W(M, { className: "h-4 w-24" }), /* @__PURE__ */ W(M, { className: "h-10 w-full" })]
1127
+ children: [/* @__PURE__ */ q(N, { className: "h-4 w-24" }), /* @__PURE__ */ q(N, { className: "h-10 w-full" })]
1128
1128
  }, e))
1129
1129
  });
1130
- if (e.sections?.length) return /* @__PURE__ */ W("div", {
1130
+ if (e.sections?.length) return /* @__PURE__ */ q("div", {
1131
1131
  className: "space-y-6",
1132
1132
  children: e.sections.map((e, t) => {
1133
1133
  let n = e.columns || 1;
1134
- return /* @__PURE__ */ W(K, {
1134
+ return /* @__PURE__ */ q(Y, {
1135
1135
  label: e.label,
1136
1136
  description: e.description,
1137
1137
  columns: n,
1138
- gridClassName: _e[n],
1139
- children: /* @__PURE__ */ W(s, { schema: {
1140
- ...Z,
1141
- fields: g(V(e))
1138
+ gridClassName: xe[n],
1139
+ children: /* @__PURE__ */ q(c, { schema: {
1140
+ ...X,
1141
+ fields: g(ee(e))
1142
1142
  } })
1143
1143
  }, e.name || e.label || t);
1144
1144
  })
1145
1145
  });
1146
- let t = R ?? $(w, _, e.columns, e.mode), n = _e[t.columns || 1];
1147
- return /* @__PURE__ */ W(s, { schema: {
1148
- ...Z,
1146
+ let t = L ?? $(y, _, e.columns, e.mode), n = xe[t.columns || 1];
1147
+ return /* @__PURE__ */ q(c, { schema: {
1148
+ ...X,
1149
1149
  fields: g(t.fields),
1150
1150
  columns: t.columns,
1151
1151
  ...n ? { fieldContainerClass: n } : {}
1152
1152
  } });
1153
- }, Q = !O && !A && (q || J);
1154
- return /* @__PURE__ */ W(y, {
1153
+ }, Q = !O && !A && (U || W);
1154
+ return /* @__PURE__ */ q(b, {
1155
1155
  open: F,
1156
1156
  onOpenChange: e.onOpenChange,
1157
- children: /* @__PURE__ */ G(C, {
1158
- className: L(B, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", d, e.className),
1157
+ children: /* @__PURE__ */ J(w, {
1158
+ className: R(z, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", s, e.className),
1159
1159
  children: [
1160
- (e.title || e.description) && /* @__PURE__ */ G(x, {
1160
+ (e.title || e.description) && /* @__PURE__ */ J(S, {
1161
1161
  className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
1162
- children: [e.title && /* @__PURE__ */ W(S, { children: e.title }), e.description && /* @__PURE__ */ W(b, { children: e.description })]
1162
+ children: [e.title && /* @__PURE__ */ q(C, { children: e.title }), e.description && /* @__PURE__ */ q(x, { children: e.description })]
1163
1163
  }),
1164
- /* @__PURE__ */ W("div", {
1164
+ /* @__PURE__ */ q("div", {
1165
1165
  className: "@container flex-1 overflow-y-auto px-4 sm:px-6 py-4",
1166
- children: ne()
1166
+ children: Z()
1167
1167
  }),
1168
- Q && /* @__PURE__ */ W("div", {
1168
+ Q && /* @__PURE__ */ q("div", {
1169
1169
  className: "shrink-0 border-t px-4 sm:px-6 py-3 bg-background",
1170
1170
  "data-testid": "modal-form-footer",
1171
- children: /* @__PURE__ */ G("div", {
1171
+ children: /* @__PURE__ */ J("div", {
1172
1172
  className: "flex flex-col sm:flex-row gap-2 sm:justify-end",
1173
- children: [J && /* @__PURE__ */ W(p, {
1173
+ children: [W && /* @__PURE__ */ q(m, {
1174
1174
  type: "button",
1175
1175
  variant: "outline",
1176
- onClick: U,
1177
- disabled: N,
1176
+ onClick: H,
1177
+ disabled: M,
1178
1178
  className: "w-full sm:w-auto",
1179
- children: X
1180
- }), q && /* @__PURE__ */ G(p, {
1179
+ children: K
1180
+ }), U && /* @__PURE__ */ J(m, {
1181
1181
  type: "submit",
1182
1182
  form: I,
1183
- disabled: N,
1183
+ disabled: M,
1184
1184
  className: "w-full sm:w-auto",
1185
- children: [N && /* @__PURE__ */ W(ee, { className: "mr-2 h-4 w-4 animate-spin" }), Y]
1185
+ children: [M && /* @__PURE__ */ q(ne, { className: "mr-2 h-4 w-4 animate-spin" }), G]
1186
1186
  })]
1187
1187
  })
1188
1188
  })
1189
1189
  ]
1190
1190
  })
1191
1191
  });
1192
- }, ye = ({ schema: e, dataSource: t }) => {
1193
- let n = z(), r = i(() => {
1192
+ }, Ce = ({ schema: e, dataSource: t }) => {
1193
+ let n = B(), r = i(() => {
1194
1194
  if (!n?.isLoaded) return e;
1195
1195
  let t = (t) => t?.name ? n.checkField(e.objectName, t.name, "read") ? !n.checkField(e.objectName, t.name, "write") && e.mode !== "view" ? {
1196
1196
  ...t,
@@ -1205,8 +1205,8 @@ var me = {
1205
1205
  fields: r(e.fields)
1206
1206
  }))
1207
1207
  };
1208
- }, [e, n]), { sectionLabel: a } = c(), 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__ */ W(q, {
1208
+ }, [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__ */ q(X, {
1210
1210
  schema: {
1211
1211
  ...r,
1212
1212
  formType: "tabbed",
@@ -1223,7 +1223,7 @@ var me = {
1223
1223
  dataSource: t,
1224
1224
  className: r.className
1225
1225
  });
1226
- if (r.formType === "wizard" && r.sections?.length) return /* @__PURE__ */ W(J, {
1226
+ if (r.formType === "wizard" && r.sections?.length) return /* @__PURE__ */ q(Z, {
1227
1227
  schema: {
1228
1228
  ...r,
1229
1229
  formType: "wizard",
@@ -1243,7 +1243,7 @@ var me = {
1243
1243
  dataSource: t,
1244
1244
  className: r.className
1245
1245
  });
1246
- if (r.formType === "split" && r.sections?.length) return /* @__PURE__ */ W(Y, {
1246
+ if (r.formType === "split" && r.sections?.length) return /* @__PURE__ */ q(Q, {
1247
1247
  schema: {
1248
1248
  ...r,
1249
1249
  formType: "split",
@@ -1263,7 +1263,7 @@ var me = {
1263
1263
  });
1264
1264
  if (r.formType === "drawer") {
1265
1265
  let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
1266
- return /* @__PURE__ */ W(he, {
1266
+ return /* @__PURE__ */ q(ye, {
1267
1267
  schema: {
1268
1268
  ...n,
1269
1269
  layout: i,
@@ -1288,7 +1288,7 @@ var me = {
1288
1288
  }
1289
1289
  if (r.formType === "modal") {
1290
1290
  let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
1291
- return /* @__PURE__ */ W(ve, {
1291
+ return /* @__PURE__ */ q(Se, {
1292
1292
  schema: {
1293
1293
  ...n,
1294
1294
  layout: i,
@@ -1309,12 +1309,12 @@ var me = {
1309
1309
  className: r.className
1310
1310
  });
1311
1311
  }
1312
- return /* @__PURE__ */ W(be, {
1312
+ return /* @__PURE__ */ q(we, {
1313
1313
  schema: r,
1314
1314
  dataSource: t
1315
1315
  });
1316
- }, be = ({ schema: r, dataSource: i }) => {
1317
- let { fieldLabel: o, sectionLabel: p } = c(), m = R(), h = z(), g = t((e) => {
1316
+ }, we = ({ schema: r, dataSource: i }) => {
1317
+ let { fieldLabel: a, sectionLabel: s } = l(), m = z(), h = B(), g = t((e) => {
1318
1318
  if (!h?.isLoaded) return e;
1319
1319
  let t = [];
1320
1320
  for (let n of e) h.checkField(r.objectName, n.name, "read") && (!h.checkField(r.objectName, n.name, "write") && r.mode !== "view" ? t.push({
@@ -1328,7 +1328,7 @@ var me = {
1328
1328
  h,
1329
1329
  r.objectName,
1330
1330
  r.mode
1331
- ]), [_, v] = a(null), [y, b] = a([]), [x, S] = a(null), [C, w] = a(!0), [T, E] = a(null), D = r.customFields && r.customFields.length > 0;
1331
+ ]), [_, v] = o(null), [y, b] = o([]), [x, S] = o(null), [C, w] = o(!0), [T, E] = o(null), D = r.customFields && r.customFields.length > 0;
1332
1332
  n(() => {
1333
1333
  D && (S(r.initialData || r.initialValues || {}), w(!1));
1334
1334
  }, [
@@ -1389,7 +1389,7 @@ var me = {
1389
1389
  let t = e.visibleOn;
1390
1390
  return typeof t == "string" && t.trim() ? {
1391
1391
  ...e,
1392
- visible: (e) => u(t, e)
1392
+ visible: (e) => d(t, e)
1393
1393
  } : e;
1394
1394
  }, []);
1395
1395
  n(() => {
@@ -1404,27 +1404,27 @@ var me = {
1404
1404
  if (!n) return;
1405
1405
  let i = _.fields?.[n];
1406
1406
  if (!i && !D) return;
1407
- let a = !i?.permissions || i?.permissions.write !== !1;
1408
- if (r.mode !== "view" && !a) return;
1407
+ let o = !i?.permissions || i?.permissions.write !== !1;
1408
+ if (r.mode !== "view" && !o) return;
1409
1409
  let s = r.customFields?.find((e) => e.name === n);
1410
1410
  if (s) e.push(O(s));
1411
1411
  else if (i) {
1412
- let a = {
1412
+ let o = {
1413
1413
  name: n,
1414
- label: o(r.objectName, n, i.label || t),
1415
- type: f(i.type),
1414
+ label: a(r.objectName, n, i.label || t),
1415
+ type: p(i.type),
1416
1416
  required: i.required || !1,
1417
1417
  disabled: r.readOnly || r.mode === "view" || i.readonly || _?.managedBy && _.managedBy !== "platform",
1418
1418
  placeholder: i.placeholder,
1419
1419
  description: i.help || i.description,
1420
- validation: l(i),
1420
+ validation: u(i),
1421
1421
  field: i
1422
1422
  };
1423
- if ((i.type === "select" || i.type === "lookup" || i.type === "master_detail") && (a.options = i.options || [], a.multiple = i.multiple), (i.type === "number" || i.type === "currency" || i.type === "percent") && (a.inputType = "number", a.min = i.min, a.max = i.max, a.step = i.precision ? 10 ** -i.precision : void 0), i.type === "date" && (a.inputType = "date"), i.type === "datetime" && (a.inputType = "datetime-local"), (i.type === "text" || i.type === "textarea" || i.type === "markdown" || i.type === "html") && (a.maxLength = i.max_length, a.minLength = i.min_length), (i.type === "file" || i.type === "image") && (a.inputType = "file", a.multiple = i.multiple, a.accept = i.accept ? i.accept.join(",") : void 0, i.max_size)) {
1424
- let e = `Max size: ${d(i.max_size)}`;
1425
- a.description = a.description ? `${a.description} (${e})` : e;
1423
+ if ((i.type === "select" || i.type === "lookup" || i.type === "master_detail") && (o.options = i.options || [], o.multiple = i.multiple), (i.type === "number" || i.type === "currency" || i.type === "percent") && (o.inputType = "number", o.min = i.min, o.max = i.max, o.step = i.precision ? 10 ** -i.precision : void 0), i.type === "date" && (o.inputType = "date"), i.type === "datetime" && (o.inputType = "datetime-local"), (i.type === "text" || i.type === "textarea" || i.type === "markdown" || i.type === "html") && (o.maxLength = i.max_length, o.minLength = i.min_length), (i.type === "file" || i.type === "image") && (o.inputType = "file", o.multiple = i.multiple, o.accept = i.accept ? i.accept.join(",") : void 0, i.max_size)) {
1424
+ let e = `Max size: ${f(i.max_size)}`;
1425
+ o.description = o.description ? `${o.description} (${e})` : e;
1426
1426
  }
1427
- i.type === "email" && (a.inputType = "email"), i.type === "phone" && (a.inputType = "tel"), i.type === "url" && (a.inputType = "url"), i.type === "password" && (a.inputType = "password"), i.type === "time" && (a.inputType = "time"), (i.type === "formula" || i.type === "summary" || i.type === "auto_number") && (a.disabled = !0), i.visible_on && (a.visible = (e) => u(i.visible_on, e)), e.push(a);
1427
+ i.type === "email" && (o.inputType = "email"), i.type === "phone" && (o.inputType = "tel"), i.type === "url" && (o.inputType = "url"), i.type === "password" && (o.inputType = "password"), i.type === "time" && (o.inputType = "time"), (i.type === "formula" || i.type === "summary" || i.type === "auto_number") && (o.disabled = !0), i.visible_on && (o.visible = (e) => d(i.visible_on, e)), e.push(o);
1428
1428
  }
1429
1429
  }), b(e), !D && r.recordId && r.mode !== "create" && i || w(!1);
1430
1430
  }, [
@@ -1472,35 +1472,35 @@ var me = {
1472
1472
  }, [_]),
1473
1473
  ...x
1474
1474
  };
1475
- if (T) return /* @__PURE__ */ G("div", {
1475
+ if (T) return /* @__PURE__ */ J("div", {
1476
1476
  className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
1477
- children: [/* @__PURE__ */ W("h3", {
1477
+ children: [/* @__PURE__ */ q("h3", {
1478
1478
  className: "text-red-800 font-semibold",
1479
1479
  children: "Error loading form"
1480
- }), /* @__PURE__ */ W("p", {
1480
+ }), /* @__PURE__ */ q("p", {
1481
1481
  className: "text-red-600 text-sm mt-1",
1482
1482
  children: T.message
1483
1483
  })]
1484
1484
  });
1485
- if (C) return /* @__PURE__ */ G("div", {
1485
+ if (C) return /* @__PURE__ */ J("div", {
1486
1486
  className: "p-4 sm:p-8 text-center",
1487
- children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
1487
+ children: [/* @__PURE__ */ q("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ q("p", {
1488
1488
  className: "mt-2 text-sm text-gray-600",
1489
1489
  children: "Loading form..."
1490
1490
  })]
1491
1491
  });
1492
1492
  let M = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : "vertical";
1493
- if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ W("div", {
1493
+ if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ q("div", {
1494
1494
  className: "w-full space-y-6",
1495
1495
  children: r.sections.map((e, t) => {
1496
1496
  let n = e.fields.map((e) => typeof e == "string" ? e : e.name), i = g(y.filter((e) => n.includes(e.name)));
1497
- return /* @__PURE__ */ W(K, {
1498
- label: e.name ? p(r.objectName, e.name, e.label || e.name) : e.label,
1497
+ return /* @__PURE__ */ q(Y, {
1498
+ label: e.name ? s(r.objectName, e.name, e.label || e.name) : e.label,
1499
1499
  description: e.description,
1500
1500
  collapsible: e.collapsible,
1501
1501
  collapsed: e.collapsed,
1502
1502
  columns: e.columns,
1503
- children: /* @__PURE__ */ W(s, { schema: {
1503
+ children: /* @__PURE__ */ q(c, { schema: {
1504
1504
  type: "form",
1505
1505
  fields: i,
1506
1506
  layout: M,
@@ -1524,18 +1524,18 @@ var me = {
1524
1524
  ...e,
1525
1525
  mobile_fullscreen: !0
1526
1526
  } : e;
1527
- }) : F.fields, B = I?.stepper, V = I?.stepperMinFields ?? 8, H = Math.max(1, I?.stepperFieldsPerStep ?? 1);
1528
- if (!r.formType && !N && L.length >= 2 && (B === !0 || B === "auto" && m && L.length >= V)) {
1527
+ }) : F.fields, R = I?.stepper, ee = I?.stepperMinFields ?? 8, V = Math.max(1, I?.stepperFieldsPerStep ?? 1);
1528
+ if (!r.formType && !N && L.length >= 2 && (R === !0 || R === "auto" && m && L.length >= ee)) {
1529
1529
  let e = L, t = [];
1530
- for (let n = 0; n < e.length; n += H) {
1531
- let r = e.slice(n, n + H);
1530
+ for (let n = 0; n < e.length; n += V) {
1531
+ let r = e.slice(n, n + V);
1532
1532
  t.push({
1533
- name: `step-${Math.floor(n / H) + 1}`,
1534
- label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n / H) + 1}`,
1533
+ name: `step-${Math.floor(n / V) + 1}`,
1534
+ label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n / V) + 1}`,
1535
1535
  fields: r
1536
1536
  });
1537
1537
  }
1538
- return /* @__PURE__ */ W(J, {
1538
+ return /* @__PURE__ */ q(Z, {
1539
1539
  schema: {
1540
1540
  ...r,
1541
1541
  formType: "wizard",
@@ -1546,7 +1546,7 @@ var me = {
1546
1546
  className: r.className
1547
1547
  });
1548
1548
  }
1549
- let U = {
1549
+ let H = {
1550
1550
  type: "form",
1551
1551
  fields: L,
1552
1552
  layout: M,
@@ -1562,125 +1562,295 @@ var me = {
1562
1562
  className: r.className,
1563
1563
  mobileStickyActions: !!I?.stickyActions
1564
1564
  };
1565
- return /* @__PURE__ */ W("div", {
1565
+ return /* @__PURE__ */ q("div", {
1566
1566
  className: I?.stickyActions ? "w-full pb-20 md:pb-0" : "w-full",
1567
1567
  "data-mobile-form": I ? "true" : void 0,
1568
- children: /* @__PURE__ */ W(s, { schema: U })
1568
+ children: /* @__PURE__ */ q(c, { schema: H })
1569
+ });
1570
+ }, Te = {
1571
+ text: 200,
1572
+ email: 254,
1573
+ url: 2048,
1574
+ phone: 32,
1575
+ textarea: 5e3,
1576
+ markdown: 5e3,
1577
+ html: 5e3
1578
+ }, Ee = "_company_website_2", De = 1500;
1579
+ function Oe(e, t = []) {
1580
+ try {
1581
+ let n = new URL(e, typeof window < "u" ? window.location.href : "http://localhost");
1582
+ return typeof window < "u" && n.origin === window.location.origin ? !0 : n.protocol !== "https:" && n.protocol !== "http:" ? !1 : t.some((e) => {
1583
+ if (e === n.host) return !0;
1584
+ if (e.startsWith("*.")) {
1585
+ let t = e.slice(1);
1586
+ return n.host.endsWith(t) && n.host.length > t.length;
1587
+ }
1588
+ return !1;
1589
+ });
1590
+ } catch {
1591
+ return !1;
1592
+ }
1593
+ }
1594
+ function ke(e) {
1595
+ return e && e.map((e) => {
1596
+ let t = Te[String(e.type || "").toLowerCase()];
1597
+ return !t || (e.maxLength ?? e.max_length) ? e : {
1598
+ ...e,
1599
+ maxLength: t
1600
+ };
1569
1601
  });
1570
- }, xe = ({ config: e, dataSource: n, prefillParams: r, className: o }) => {
1571
- let [s, c] = a(!1), [l, u] = a(!1), [d, f] = a(null), p = i(() => {
1572
- let e = {};
1573
- if (r) for (let [t, n] of Object.entries(r)) e[t] = n;
1574
- return typeof window < "u" && new URLSearchParams(window.location.search).forEach((t, n) => {
1575
- n in e || (e[n] = t);
1576
- }), Object.keys(e).length > 0 ? e : void 0;
1577
- }, [r]), m = t(async (t) => {
1578
- u(!0), f(null);
1602
+ }
1603
+ var Ae = ({ config: e, dataSource: r, prefillParams: s, className: c }) => {
1604
+ let [l, u] = o(!1), [d, f] = o(!1), [p, h] = o(null), [g, _] = o(!(e.consent?.required ?? !!e.consent)), [v, y] = o(null), b = a(null), x = a(Date.now());
1605
+ n(() => {
1606
+ l || (x.current = Date.now());
1607
+ }, [l]);
1608
+ let S = e.honeypot === !1 ? null : e.honeypot || Ee, C = e.minFillTime ?? De, w = i(() => ke(e.customFields), [e.customFields]), T = i(() => {
1609
+ if (!r || w && w.length > 0 || !e.fields || e.fields.length === 0) return;
1610
+ let t = async (e, t) => t;
1611
+ return {
1612
+ ...r,
1613
+ create: t,
1614
+ update: (e, t, n) => Promise.resolve(n),
1615
+ delete: () => Promise.reject(/* @__PURE__ */ Error("Not permitted on public form"))
1616
+ };
1617
+ }, [
1618
+ r,
1619
+ w,
1620
+ e.fields
1621
+ ]), E = i(() => {
1622
+ let t = {};
1623
+ if (s) for (let [e, n] of Object.entries(s)) t[e] = n;
1624
+ if (typeof window < "u" && e.allowedPrefillFields?.length) {
1625
+ let n = new Set(e.allowedPrefillFields);
1626
+ new URLSearchParams(window.location.search).forEach((e, r) => {
1627
+ n.has(r) && !(r in t) && (t[r] = e);
1628
+ });
1629
+ }
1630
+ return Object.keys(t).length > 0 ? t : void 0;
1631
+ }, [s, e.allowedPrefillFields]), D = t(async (t) => {
1632
+ if (e.consent?.required && !g) {
1633
+ y(e.texts?.consentRequired ?? "Please accept the privacy policy to continue.");
1634
+ return;
1635
+ }
1636
+ if (y(null), S && b.current?.value) {
1637
+ u(!0);
1638
+ return;
1639
+ }
1640
+ if (C > 0 && Date.now() - x.current < C) {
1641
+ h(e.texts?.rateLimited ?? "Please take a moment to review your answers before submitting.");
1642
+ return;
1643
+ }
1644
+ let n = { ...t };
1645
+ S && delete n[S], e.captchaToken && (n._captcha = e.captchaToken), f(!0), h(null);
1579
1646
  try {
1580
- if (n && await n.create(e.objectName, t), c(!0), e.thankYouPage?.redirectUrl) {
1581
- let t = e.thankYouPage.redirectDelay ?? 3e3;
1647
+ r && await r.create(e.objectName, n), u(!0);
1648
+ let t = e.thankYouPage?.redirectUrl;
1649
+ if (t) if (Oe(t, e.allowedRedirectHosts)) {
1650
+ let n = e.thankYouPage?.redirectDelay ?? 3e3;
1582
1651
  setTimeout(() => {
1583
- window.location.href = e.thankYouPage.redirectUrl;
1584
- }, t);
1585
- }
1652
+ window.location.href = t;
1653
+ }, n);
1654
+ } else console.warn("[EmbeddableForm] Blocked unsafe redirect target:", t), h(e.texts?.redirectBlocked ?? null);
1586
1655
  } catch (e) {
1587
- f(e instanceof Error ? e.message : "Failed to submit form. Please try again.");
1656
+ h(e instanceof Error ? e.message : "Failed to submit form. Please try again.");
1588
1657
  } finally {
1589
- u(!1);
1658
+ f(!1);
1590
1659
  }
1591
- }, [n, e]), h = t(() => {
1592
- c(!1), f(null);
1593
- }, []), g = i(() => {
1660
+ }, [
1661
+ r,
1662
+ e,
1663
+ g,
1664
+ S,
1665
+ C
1666
+ ]), O = t(() => {
1667
+ u(!1), h(null);
1668
+ }, []), k = i(() => {
1594
1669
  let t = {};
1595
1670
  return e.branding?.backgroundColor && (t.backgroundColor = e.branding.backgroundColor), t;
1596
1671
  }, [e.branding]);
1597
- if (s) {
1598
- let t = e.thankYouPage;
1599
- return /* @__PURE__ */ W("div", {
1600
- className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
1601
- style: g,
1602
- children: /* @__PURE__ */ G("div", {
1603
- className: "max-w-md w-full bg-card rounded-lg shadow-lg p-8 text-center space-y-4",
1672
+ if (l) {
1673
+ 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__ */ q("div", {
1675
+ className: `min-h-screen flex items-center justify-center p-4 bg-gradient-to-b from-muted/40 via-background to-background ${c || ""}`,
1676
+ style: k,
1677
+ children: /* @__PURE__ */ J("div", {
1678
+ className: "max-w-md w-full bg-card border rounded-xl shadow-sm p-8 text-center space-y-4",
1604
1679
  children: [
1605
- /* @__PURE__ */ W("div", {
1606
- className: "text-4xl",
1607
- children: "✓"
1680
+ /* @__PURE__ */ q("div", {
1681
+ 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__ */ q(V, {
1683
+ className: "h-8 w-8",
1684
+ "aria-hidden": "true"
1685
+ })
1608
1686
  }),
1609
- /* @__PURE__ */ W("h2", {
1687
+ /* @__PURE__ */ q("h2", {
1610
1688
  className: "text-xl font-semibold text-foreground",
1611
- children: t?.title || "Thank You!"
1689
+ children: t?.title || n.thankYouTitle || "Thank You!"
1612
1690
  }),
1613
- /* @__PURE__ */ W("p", {
1614
- className: "text-muted-foreground",
1615
- children: t?.message || "Your submission has been received successfully."
1691
+ /* @__PURE__ */ q("p", {
1692
+ className: "text-sm text-muted-foreground",
1693
+ children: t?.message || n.thankYouMessage || "Your submission has been received successfully."
1616
1694
  }),
1617
- e.allowMultiple && /* @__PURE__ */ W("button", {
1618
- onClick: h,
1619
- 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",
1620
- children: "Submit Another Response"
1695
+ e.allowMultiple && /* @__PURE__ */ q(m, {
1696
+ variant: "outline",
1697
+ size: "sm",
1698
+ onClick: O,
1699
+ className: "mt-2",
1700
+ children: n.submitAnother ?? "Submit Another Response"
1621
1701
  }),
1622
- t?.redirectUrl && /* @__PURE__ */ G("p", {
1702
+ t?.redirectUrl && /* @__PURE__ */ q("p", {
1623
1703
  className: "text-xs text-muted-foreground",
1624
- children: [
1625
- "Redirecting in ",
1626
- Math.ceil((t.redirectDelay ?? 3e3) / 1e3),
1627
- " seconds..."
1628
- ]
1704
+ children: i
1629
1705
  })
1630
1706
  ]
1631
1707
  })
1632
1708
  });
1633
1709
  }
1634
- return /* @__PURE__ */ W("div", {
1635
- className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
1636
- style: g,
1637
- children: /* @__PURE__ */ G("div", {
1638
- className: "max-w-2xl w-full bg-card rounded-lg shadow-lg overflow-hidden",
1710
+ let A = e.texts ?? {}, j = !!e.consent?.required, M = `${e.formId}-consent`;
1711
+ return /* @__PURE__ */ q("div", {
1712
+ 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
+ style: k,
1714
+ children: /* @__PURE__ */ J("div", {
1715
+ className: "max-w-2xl w-full bg-card border rounded-xl shadow-sm overflow-hidden",
1639
1716
  children: [
1640
- /* @__PURE__ */ G("div", {
1641
- className: "p-6 border-b",
1717
+ e.branding?.coverImage && /* @__PURE__ */ q("div", {
1718
+ className: "h-28 sm:h-32 w-full bg-cover bg-center",
1719
+ style: { backgroundImage: `url(${JSON.stringify(e.branding.coverImage)})` },
1720
+ role: "presentation"
1721
+ }),
1722
+ /* @__PURE__ */ J("div", {
1723
+ className: "px-6 sm:px-8 pt-7 pb-5 border-b bg-muted/20",
1642
1724
  style: e.branding?.primaryColor ? { borderBottomColor: e.branding.primaryColor } : void 0,
1643
1725
  children: [
1644
- e.branding?.logo && /* @__PURE__ */ W("img", {
1726
+ e.branding?.logo && /* @__PURE__ */ q("img", {
1645
1727
  src: e.branding.logo,
1646
- alt: "Logo",
1728
+ alt: "",
1647
1729
  className: "h-8 mb-4"
1648
1730
  }),
1649
- e.title && /* @__PURE__ */ W("h1", {
1650
- className: "text-xl font-semibold text-foreground",
1731
+ e.title && /* @__PURE__ */ q("h1", {
1732
+ className: "text-2xl font-semibold tracking-tight text-foreground",
1651
1733
  children: e.title
1652
1734
  }),
1653
- e.description && /* @__PURE__ */ W("p", {
1654
- className: "text-sm text-muted-foreground mt-1",
1735
+ e.description && /* @__PURE__ */ q("p", {
1736
+ className: "text-sm text-muted-foreground mt-2 leading-relaxed",
1655
1737
  children: e.description
1738
+ }),
1739
+ /* @__PURE__ */ q("p", {
1740
+ className: "text-[11px] text-muted-foreground/70 mt-3",
1741
+ "aria-hidden": "true",
1742
+ children: A.requiredHint ?? "* Required field"
1656
1743
  })
1657
1744
  ]
1658
1745
  }),
1659
- /* @__PURE__ */ G("div", {
1660
- className: "p-6",
1661
- children: [d && /* @__PURE__ */ W("div", {
1662
- className: "mb-4 p-3 bg-destructive/10 border border-destructive/30 rounded-md text-sm text-destructive",
1663
- children: d
1664
- }), /* @__PURE__ */ W(ye, {
1665
- schema: {
1666
- type: "object-form",
1667
- objectName: e.objectName,
1668
- mode: "create",
1669
- fields: e.fields,
1670
- customFields: e.customFields,
1671
- initialData: p,
1672
- onSuccess: m,
1673
- submitLabel: l ? "Submitting..." : "Submit"
1674
- },
1675
- dataSource: n
1676
- })]
1746
+ /* @__PURE__ */ J("div", {
1747
+ className: "relative px-6 sm:px-8 py-6",
1748
+ children: [
1749
+ p && /* @__PURE__ */ q("div", {
1750
+ role: "alert",
1751
+ "aria-live": "assertive",
1752
+ className: "mb-4 p-3 bg-destructive/10 border border-destructive/30 rounded-md text-sm text-destructive",
1753
+ children: p
1754
+ }),
1755
+ /* @__PURE__ */ q(Ce, {
1756
+ schema: {
1757
+ type: "object-form",
1758
+ objectName: e.objectName,
1759
+ mode: "create",
1760
+ fields: e.fields,
1761
+ customFields: w,
1762
+ initialData: E,
1763
+ onSuccess: D,
1764
+ submitText: d ? A.submitting ?? "Submitting..." : A.submit ?? "Submit"
1765
+ },
1766
+ dataSource: T
1767
+ }),
1768
+ S && /* @__PURE__ */ J("div", {
1769
+ "aria-hidden": "true",
1770
+ className: "absolute left-[-10000px] top-auto h-px w-px overflow-hidden",
1771
+ children: [/* @__PURE__ */ q("label", {
1772
+ htmlFor: `${e.formId}-${S}`,
1773
+ children: "Do not fill this field"
1774
+ }), /* @__PURE__ */ q("input", {
1775
+ ref: b,
1776
+ id: `${e.formId}-${S}`,
1777
+ type: "text",
1778
+ name: S,
1779
+ tabIndex: -1,
1780
+ autoComplete: "off",
1781
+ defaultValue: ""
1782
+ })]
1783
+ }),
1784
+ e.consent && /* @__PURE__ */ J("div", {
1785
+ className: "mt-4",
1786
+ children: [/* @__PURE__ */ J("label", {
1787
+ className: "flex items-start gap-2 text-sm text-foreground cursor-pointer select-none",
1788
+ children: [/* @__PURE__ */ q("input", {
1789
+ type: "checkbox",
1790
+ id: M,
1791
+ checked: g,
1792
+ onChange: (e) => {
1793
+ _(e.target.checked), e.target.checked && y(null);
1794
+ },
1795
+ "aria-required": j || void 0,
1796
+ "aria-invalid": v ? "true" : void 0,
1797
+ "aria-describedby": v ? `${M}-error` : void 0,
1798
+ className: "mt-0.5 h-4 w-4 rounded border-input accent-primary"
1799
+ }), /* @__PURE__ */ J("span", {
1800
+ className: "leading-relaxed",
1801
+ children: [
1802
+ e.consent.label ?? A.consentLabelDefault ?? "I agree to the privacy policy.",
1803
+ j && /* @__PURE__ */ q("span", {
1804
+ "aria-hidden": "true",
1805
+ className: "text-destructive ml-0.5",
1806
+ children: "*"
1807
+ }),
1808
+ e.consent.privacyUrl && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("a", {
1809
+ href: e.consent.privacyUrl,
1810
+ target: "_blank",
1811
+ rel: "noopener noreferrer",
1812
+ className: "underline text-primary hover:opacity-80",
1813
+ children: A.consentLink ?? "Privacy policy"
1814
+ })] })
1815
+ ]
1816
+ })]
1817
+ }), v && /* @__PURE__ */ q("p", {
1818
+ id: `${M}-error`,
1819
+ role: "alert",
1820
+ className: "mt-1.5 text-xs text-destructive",
1821
+ children: v
1822
+ })]
1823
+ }),
1824
+ d && /* @__PURE__ */ J("div", {
1825
+ className: "mt-3 flex items-center gap-2 text-xs text-muted-foreground",
1826
+ children: [/* @__PURE__ */ q(ne, {
1827
+ className: "h-3.5 w-3.5 animate-spin",
1828
+ "aria-hidden": "true"
1829
+ }), /* @__PURE__ */ q("span", { children: A.submitting ?? "Submitting…" })]
1830
+ })
1831
+ ]
1677
1832
  }),
1678
- /* @__PURE__ */ W("div", {
1679
- className: "px-6 py-3 border-t bg-muted/20 text-center",
1680
- children: /* @__PURE__ */ W("p", {
1681
- className: "text-xs text-muted-foreground",
1682
- children: "Powered by ObjectStack"
1683
- })
1833
+ /* @__PURE__ */ J("div", {
1834
+ 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__ */ J("p", {
1836
+ className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground",
1837
+ children: [/* @__PURE__ */ q(W, {
1838
+ className: "h-3 w-3",
1839
+ "aria-hidden": "true"
1840
+ }), /* @__PURE__ */ q("span", { children: A.secureNotice ?? "Your information is transmitted securely and only used to respond to your request." })]
1841
+ }), /* @__PURE__ */ J("div", {
1842
+ className: "flex items-center gap-3 text-xs text-muted-foreground/80",
1843
+ children: [e.privacyPolicyUrl && /* @__PURE__ */ J("a", {
1844
+ href: e.privacyPolicyUrl,
1845
+ target: "_blank",
1846
+ rel: "noopener noreferrer",
1847
+ className: "inline-flex items-center gap-1 underline hover:text-foreground",
1848
+ children: [/* @__PURE__ */ q(G, {
1849
+ className: "h-3 w-3",
1850
+ "aria-hidden": "true"
1851
+ }), A.consentLink ?? "Privacy policy"]
1852
+ }), /* @__PURE__ */ q("span", { children: A.poweredBy ?? "Powered by ObjectStack" })]
1853
+ })]
1684
1854
  })
1685
1855
  ]
1686
1856
  })
@@ -1688,96 +1858,96 @@ var me = {
1688
1858
  };
1689
1859
  //#endregion
1690
1860
  //#region src/FormAnalytics.tsx
1691
- function Se(e) {
1861
+ function je(e) {
1692
1862
  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`;
1693
1863
  }
1694
- var Ce = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
1864
+ var Me = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
1695
1865
  let a = i(() => {
1696
1866
  if (!n.abandonedSubmissions) return 100;
1697
1867
  let e = n.totalSubmissions + n.abandonedSubmissions;
1698
1868
  return e === 0 ? 0 : Math.round(n.totalSubmissions / e * 100);
1699
1869
  }, [n.totalSubmissions, n.abandonedSubmissions]), o = i(() => n.dailySubmissions?.length ? Math.max(...n.dailySubmissions.map((e) => e.count), 1) : 1, [n.dailySubmissions]);
1700
- return /* @__PURE__ */ G("div", {
1870
+ return /* @__PURE__ */ J("div", {
1701
1871
  className: `space-y-4 ${r || ""}`,
1702
1872
  children: [
1703
- /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h2", {
1873
+ /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h2", {
1704
1874
  className: "text-lg font-semibold text-foreground",
1705
1875
  children: t || "Form Analytics"
1706
- }), /* @__PURE__ */ G("p", {
1876
+ }), /* @__PURE__ */ J("p", {
1707
1877
  className: "text-sm text-muted-foreground",
1708
1878
  children: ["Form ID: ", e]
1709
1879
  })] }),
1710
- /* @__PURE__ */ G("div", {
1880
+ /* @__PURE__ */ J("div", {
1711
1881
  className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
1712
1882
  children: [
1713
- /* @__PURE__ */ W(m, { children: /* @__PURE__ */ G(_, {
1883
+ /* @__PURE__ */ q(h, { children: /* @__PURE__ */ J(v, {
1714
1884
  className: "pb-2",
1715
- children: [/* @__PURE__ */ W(g, { children: "Total Submissions" }), /* @__PURE__ */ W(v, {
1885
+ children: [/* @__PURE__ */ q(_, { children: "Total Submissions" }), /* @__PURE__ */ q(y, {
1716
1886
  className: "text-2xl",
1717
1887
  children: n.totalSubmissions.toLocaleString()
1718
1888
  })]
1719
1889
  }) }),
1720
- /* @__PURE__ */ G(m, { children: [/* @__PURE__ */ G(_, {
1890
+ /* @__PURE__ */ J(h, { children: [/* @__PURE__ */ J(v, {
1721
1891
  className: "pb-2",
1722
- children: [/* @__PURE__ */ W(g, { children: "Fill Rate" }), /* @__PURE__ */ G(v, {
1892
+ children: [/* @__PURE__ */ q(_, { children: "Fill Rate" }), /* @__PURE__ */ J(y, {
1723
1893
  className: "text-2xl",
1724
1894
  children: [a, "%"]
1725
1895
  })]
1726
- }), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
1896
+ }), /* @__PURE__ */ q(g, { children: /* @__PURE__ */ q("div", {
1727
1897
  className: "w-full bg-muted rounded-full h-2",
1728
- children: /* @__PURE__ */ W("div", {
1898
+ children: /* @__PURE__ */ q("div", {
1729
1899
  className: "bg-primary rounded-full h-2 transition-all",
1730
1900
  style: { width: `${a}%` }
1731
1901
  })
1732
1902
  }) })] }),
1733
- /* @__PURE__ */ W(m, { children: /* @__PURE__ */ G(_, {
1903
+ /* @__PURE__ */ q(h, { children: /* @__PURE__ */ J(v, {
1734
1904
  className: "pb-2",
1735
- children: [/* @__PURE__ */ W(g, { children: "Avg. Completion Time" }), /* @__PURE__ */ W(v, {
1905
+ children: [/* @__PURE__ */ q(_, { children: "Avg. Completion Time" }), /* @__PURE__ */ q(y, {
1736
1906
  className: "text-2xl",
1737
- children: n.avgCompletionTime ? Se(n.avgCompletionTime) : "—"
1907
+ children: n.avgCompletionTime ? je(n.avgCompletionTime) : "—"
1738
1908
  })]
1739
1909
  }) })
1740
1910
  ]
1741
1911
  }),
1742
- n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ G(m, { children: [/* @__PURE__ */ W(_, { children: /* @__PURE__ */ W(v, {
1912
+ n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ J(h, { children: [/* @__PURE__ */ q(v, { children: /* @__PURE__ */ q(y, {
1743
1913
  className: "text-sm font-medium",
1744
1914
  children: "Daily Submissions"
1745
- }) }), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
1915
+ }) }), /* @__PURE__ */ q(g, { children: /* @__PURE__ */ q("div", {
1746
1916
  className: "flex items-end gap-1 h-32",
1747
- children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ G("div", {
1917
+ children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ J("div", {
1748
1918
  className: "flex-1 flex flex-col items-center gap-1",
1749
- children: [/* @__PURE__ */ W("div", {
1919
+ children: [/* @__PURE__ */ q("div", {
1750
1920
  className: "w-full bg-primary/80 rounded-t transition-all hover:bg-primary",
1751
1921
  style: {
1752
1922
  height: `${e.count / o * 100}%`,
1753
1923
  minHeight: e.count > 0 ? "4px" : "0"
1754
1924
  },
1755
1925
  title: `${e.date}: ${e.count} submissions`
1756
- }), /* @__PURE__ */ W("span", {
1926
+ }), /* @__PURE__ */ q("span", {
1757
1927
  className: "text-[10px] text-muted-foreground truncate w-full text-center",
1758
1928
  children: e.date.slice(-5)
1759
1929
  })]
1760
1930
  }, t))
1761
1931
  }) })] }),
1762
- n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ G(m, { children: [/* @__PURE__ */ G(_, { children: [/* @__PURE__ */ W(v, {
1932
+ n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ J(h, { children: [/* @__PURE__ */ J(v, { children: [/* @__PURE__ */ q(y, {
1763
1933
  className: "text-sm font-medium",
1764
1934
  children: "Field Completion Rates"
1765
- }), /* @__PURE__ */ W(g, { children: "Percentage of users who completed each field" })] }), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
1935
+ }), /* @__PURE__ */ q(_, { children: "Percentage of users who completed each field" })] }), /* @__PURE__ */ q(g, { children: /* @__PURE__ */ q("div", {
1766
1936
  className: "space-y-3",
1767
- children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ G("div", {
1937
+ children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ J("div", {
1768
1938
  className: "space-y-1",
1769
- children: [/* @__PURE__ */ G("div", {
1939
+ children: [/* @__PURE__ */ J("div", {
1770
1940
  className: "flex justify-between text-sm",
1771
- children: [/* @__PURE__ */ W("span", {
1941
+ children: [/* @__PURE__ */ q("span", {
1772
1942
  className: "text-foreground",
1773
1943
  children: e.label
1774
- }), /* @__PURE__ */ G("span", {
1944
+ }), /* @__PURE__ */ J("span", {
1775
1945
  className: "text-muted-foreground",
1776
1946
  children: [e.completionRate, "%"]
1777
1947
  })]
1778
- }), /* @__PURE__ */ W("div", {
1948
+ }), /* @__PURE__ */ q("div", {
1779
1949
  className: "w-full bg-muted rounded-full h-1.5",
1780
- children: /* @__PURE__ */ W("div", {
1950
+ children: /* @__PURE__ */ q("div", {
1781
1951
  className: `rounded-full h-1.5 transition-all ${e.completionRate >= 80 ? "bg-green-500" : e.completionRate >= 50 ? "bg-yellow-500" : "bg-destructive"}`,
1782
1952
  style: { width: `${e.completionRate}%` }
1783
1953
  })
@@ -1786,8 +1956,8 @@ var Ce = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
1786
1956
  }) })] })
1787
1957
  ]
1788
1958
  });
1789
- }, we = ({ schema: e }) => /* @__PURE__ */ W(ye, { schema: e });
1790
- o.register("object-form", we, {
1959
+ }, Ne = ({ schema: e }) => /* @__PURE__ */ q(Ce, { schema: e });
1960
+ s.register("object-form", Ne, {
1791
1961
  namespace: "plugin-form",
1792
1962
  label: "Object Form",
1793
1963
  category: "plugin",
@@ -1928,7 +2098,7 @@ o.register("object-form", we, {
1928
2098
  ]
1929
2099
  }
1930
2100
  ]
1931
- }), o.register("form", we, {
2101
+ }), s.register("form", Ne, {
1932
2102
  namespace: "view",
1933
2103
  skipFallback: !0,
1934
2104
  label: "Data Form View",
@@ -1956,7 +2126,7 @@ o.register("object-form", we, {
1956
2126
  ]
1957
2127
  }
1958
2128
  ]
1959
- }), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ W(xe, { config: e }), {
2129
+ }), s.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ q(Ae, { config: e }), {
1960
2130
  namespace: "plugin-form",
1961
2131
  label: "Embeddable Form",
1962
2132
  category: "plugin",
@@ -1994,7 +2164,7 @@ o.register("object-form", we, {
1994
2164
  label: "Allow Multiple Submissions"
1995
2165
  }
1996
2166
  ]
1997
- }), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ W(Ce, {
2167
+ }), s.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ q(Me, {
1998
2168
  formId: e.formId,
1999
2169
  formTitle: e.formTitle,
2000
2170
  metrics: e.metrics || { totalSubmissions: 0 }
@@ -2022,4 +2192,4 @@ o.register("object-form", we, {
2022
2192
  ]
2023
2193
  });
2024
2194
  //#endregion
2025
- export { he as DrawerForm, xe as EmbeddableForm, Ce as FormAnalytics, K as FormSection, ve as ModalForm, ye as ObjectForm, Y as SplitForm, q as TabbedForm, J as WizardForm, ae as applyAutoColSpan, $ as applyAutoLayout, le as filterAutoGeneratedFields, ce as filterCreateModeFields, se as filterSystemFields, ie as inferColumns, ue as inferModalSize, re as isAutoGeneratedFieldType, Q as isWideFieldType };
2195
+ export { ye as DrawerForm, Ae as EmbeddableForm, Me as FormAnalytics, Y as FormSection, Se as ModalForm, Ce as ObjectForm, Q as SplitForm, X as TabbedForm, Z 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 };