dynamic-mui 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{index-B7i3cvH0.mjs → AIForm-Czsvpf7g.mjs} +4178 -4336
  2. package/dist/AIForm-LoeI18mO.js +43 -0
  3. package/dist/accordion-8p1FoyfL.js +1 -0
  4. package/dist/{accordion-Bc3bEKtC.mjs → accordion-CQ4Vldth.mjs} +1 -1
  5. package/dist/{addressfield-bU-3Rnkq.mjs → addressfield-N7DifI3i.mjs} +52 -40
  6. package/dist/addressfield-T4e_d87q.js +1 -0
  7. package/dist/ai/index.cjs +1 -0
  8. package/dist/ai/index.mjs +14 -0
  9. package/dist/asyncautocomplete-BB_MyjIj.mjs +92 -0
  10. package/dist/asyncautocomplete-CpO6EO3W.js +1 -0
  11. package/dist/bar-BOse0ZkP.js +1 -0
  12. package/dist/{bar-DUZXtBln.mjs → bar-CbpJ-MEV.mjs} +1 -1
  13. package/dist/cascadeselect-C30RVgmc.js +1 -0
  14. package/dist/cascadeselect-PzCw6JHX.mjs +66 -0
  15. package/dist/colorpicker-CMhVJNQT.mjs +111 -0
  16. package/dist/colorpicker-DoNrfUY7.js +1 -0
  17. package/dist/consentfield-Bp1dXs7L.js +1 -0
  18. package/dist/{consentfield-DxqzSUsQ.mjs → consentfield-DIa3sXrr.mjs} +18 -16
  19. package/dist/{datatable-vq0d5mZg.mjs → datatable-CO0Iv6R6.mjs} +1 -1
  20. package/dist/datatable-CyfyY3Wh.js +1 -0
  21. package/dist/dynamic-mui.cjs +1 -1
  22. package/dist/dynamic-mui.d.ts +2 -0
  23. package/dist/dynamic-mui.mjs +207 -33
  24. package/dist/editabletable-CCDJ2BPB.js +1 -0
  25. package/dist/{editabletable-C5eH6sPe.mjs → editabletable-C_MA7QEb.mjs} +30 -28
  26. package/dist/{fileupload-XnztToJ2.mjs → fileupload-DX3dxKFN.mjs} +26 -13
  27. package/dist/fileupload-WV5shCIK.js +1 -0
  28. package/dist/formrepeater-Cxu8Dk8P.js +1 -0
  29. package/dist/{formrepeater-CDhYRFqz.mjs → formrepeater-D5K8qgAA.mjs} +24 -20
  30. package/dist/{formwizard-C2QaC746.mjs → formwizard-B-HCfrnp.mjs} +1 -1
  31. package/dist/formwizard-HRF3hTyF.js +1 -0
  32. package/dist/geofield-0k7PkHRa.js +1 -0
  33. package/dist/{geofield-_dw7uIT2.mjs → geofield-DlqMZ_hl.mjs} +35 -31
  34. package/dist/{group-CZgTXmJP.mjs → group-BFDXdAfg.mjs} +1 -1
  35. package/dist/group-mONe185y.js +1 -0
  36. package/dist/{intlphone-357BAzba.mjs → intlphone-Bbk2UF9T.mjs} +16 -12
  37. package/dist/intlphone-zZ0xd-DG.js +1 -0
  38. package/dist/keyvaluefield-B6oRZzic.js +1 -0
  39. package/dist/{keyvaluefield-BRX83BRS.mjs → keyvaluefield-BynOkgTq.mjs} +16 -14
  40. package/dist/line-ChQNdVfl.js +1 -0
  41. package/dist/{line-JDUXJ2fy.mjs → line-DebtzkF3.mjs} +1 -1
  42. package/dist/lineitemlist-CI0LwIUz.js +1 -0
  43. package/dist/{lineitemlist-D84p4ZC5.mjs → lineitemlist-CjFNpqI5.mjs} +29 -25
  44. package/dist/{list-B6gocnmr.mjs → list-B5wBsflP.mjs} +2 -2
  45. package/dist/list-CJFKxKyN.js +1 -0
  46. package/dist/locationfield-CrOMF7jt.js +1 -0
  47. package/dist/locationfield-DQj3yDCa.mjs +118 -0
  48. package/dist/markdowneditor-Jaz7uTyZ.js +2 -0
  49. package/dist/{markdowneditor-B0CYYefE.mjs → markdowneditor-emqJhQV7.mjs} +15 -11
  50. package/dist/matrixfield-BPJsawGk.js +1 -0
  51. package/dist/{matrixfield-D9IJr1qQ.mjs → matrixfield-j5mf9lh5.mjs} +39 -35
  52. package/dist/{mixChart-ISf3Kbr-.mjs → mixChart-Doq4lt7Z.mjs} +2 -2
  53. package/dist/mixChart-rgyMCdnp.js +1 -0
  54. package/dist/{multitextbox-CrHH_t_8.mjs → multitextbox-CyZiTd_E.mjs} +23 -23
  55. package/dist/multitextbox-DQbcEqkM.js +1 -0
  56. package/dist/{npsscale-BS-ooCks.mjs → npsscale-BIkJMD4Z.mjs} +17 -13
  57. package/dist/npsscale-oUUyPdxP.js +1 -0
  58. package/dist/numberstepper-DRIvgtcH.js +1 -0
  59. package/dist/{numberstepper-Dc7wEzfb.mjs → numberstepper-thjufBMI.mjs} +13 -9
  60. package/dist/{pie-BpGQ6Aor.mjs → pie-4SHUYmRs.mjs} +1 -1
  61. package/dist/pie-COA-uozf.js +1 -0
  62. package/dist/richtexteditor-BSV7hG6d.js +1 -0
  63. package/dist/{richtexteditor-DHDVUoic.mjs → richtexteditor-CvZ3Y7X1.mjs} +4 -2
  64. package/dist/{signature-CDaNiDTO.js → signature-6QvVbfkT.js} +2 -2
  65. package/dist/{signature-Twiet_Pp.mjs → signature-DeDxnc8U.mjs} +4 -2
  66. package/dist/stepper-CDsErlLH.js +1 -0
  67. package/dist/{stepper-PK1xI0po.mjs → stepper-Sx3SWXTM.mjs} +4 -4
  68. package/dist/{summaryfield-CDDYwbfV.mjs → summaryfield-CAJjGmE2.mjs} +5 -5
  69. package/dist/summaryfield-DxzQ3g6Z.js +1 -0
  70. package/dist/tabs-CnDP2ngC.js +1 -0
  71. package/dist/{tabs-BJ9HBvyr.mjs → tabs-CvHNZU5o.mjs} +1 -1
  72. package/dist/tagsinput-DZcLPuX1.js +1 -0
  73. package/dist/tagsinput-bWU3Mem0.mjs +58 -0
  74. package/package.json +16 -11
  75. package/dist/accordion-CI-d8sBW.js +0 -1
  76. package/dist/addressfield-BVtAZyuA.js +0 -1
  77. package/dist/asyncautocomplete-BojHePYN.mjs +0 -89
  78. package/dist/asyncautocomplete-CGUaYa8k.js +0 -1
  79. package/dist/bar-D-Mi7Kmk.js +0 -1
  80. package/dist/cascadeselect-CMqn7Tql.mjs +0 -64
  81. package/dist/cascadeselect-Cu_sJIFt.js +0 -1
  82. package/dist/colorpicker-C6X7x0s_.js +0 -1
  83. package/dist/colorpicker-CXWSUm_s.mjs +0 -98
  84. package/dist/consentfield-BbwsP80E.js +0 -1
  85. package/dist/datatable-BThXDunv.js +0 -1
  86. package/dist/editabletable-Bv2TfEOc.js +0 -1
  87. package/dist/fileupload-CmWZnxyT.js +0 -1
  88. package/dist/formrepeater-COl6gNZi.js +0 -1
  89. package/dist/formwizard-hlQ_NCsd.js +0 -1
  90. package/dist/geofield-wtSTkcE0.js +0 -1
  91. package/dist/group-D95eDbtd.js +0 -1
  92. package/dist/index-DX3lZIKI.js +0 -43
  93. package/dist/intlphone-DR5-jK9f.js +0 -1
  94. package/dist/keyvaluefield-C89E1mqp.js +0 -1
  95. package/dist/line-B_-WceU1.js +0 -1
  96. package/dist/lineitemlist-VAV6uqyg.js +0 -1
  97. package/dist/list-DFdCIA2P.js +0 -1
  98. package/dist/locationfield-DSV_O6aK.js +0 -1
  99. package/dist/locationfield-En3apdDQ.mjs +0 -119
  100. package/dist/markdowneditor-LUCZHsC6.js +0 -2
  101. package/dist/matrixfield-BxngfAiS.js +0 -1
  102. package/dist/mixChart-C3o184UT.js +0 -1
  103. package/dist/multitextbox-DETwPeJY.js +0 -1
  104. package/dist/npsscale-5fQ1nTCy.js +0 -1
  105. package/dist/numberstepper-FRaiyZz0.js +0 -1
  106. package/dist/pie-DvzqIIDM.js +0 -1
  107. package/dist/richtexteditor-B7iljrHN.js +0 -1
  108. package/dist/stepper-Cf2nMTEt.js +0 -1
  109. package/dist/summaryfield-XXHz95hU.js +0 -1
  110. package/dist/tabs-B3s52APG.js +0 -1
  111. package/dist/tagsinput-B2W--DfP.mjs +0 -58
  112. package/dist/tagsinput-Dz7D54iz.js +0 -1
@@ -1,35 +1,209 @@
1
- import { A as a, l as r, o, q as t, r as i, s as l, t as n, C as m, D as F, e as g, F as C, i as u, v as A, w as I, x as d, y as p, g as R, z as c, B as f, E as v, G as M, H as y, I as D, J as S, K as T, L as h, M as x, N as G, O as X, Q as w, R as z, S as E } from "./index-B7i3cvH0.mjs";
1
+ import { y as I, z as k, B as Q, V as U, D as Z } from "./AIForm-Czsvpf7g.mjs";
2
+ import { A as pe, a as fe, b as me, c as ge, d as ve, e as ye, E as be, C as Ae, G as Ee, q as we, F as Me, w as Se, H as Fe, f as Ie, g as Oe, i as Ve, I as $e, J as Ce, K as We, L as qe, M as Re, N as De, s as ke, h as Te, O as Le, u as _e, Q as ze } from "./AIForm-Czsvpf7g.mjs";
3
+ import { useMemo as V, useState as T, useRef as x, useCallback as A } from "react";
4
+ function te(e) {
5
+ return (n) => {
6
+ const r = e.safeParse(n);
7
+ return !r || r.success ? [] : (r.error?.issues || r.error?.errors || []).map((u) => ({ id: String(u?.path?.[0] ?? ""), message: u?.message || "Invalid value", rule: u?.code || "zod" })).filter((u) => u.id);
8
+ };
9
+ }
10
+ function ae(e) {
11
+ return (n) => {
12
+ try {
13
+ return e.validateSync(n, { abortEarly: !1 }), [];
14
+ } catch (r) {
15
+ return (r?.inner?.length ? r.inner : r ? [r] : []).map((u) => ({ id: String(u?.path ?? ""), message: u?.message || "Invalid value", rule: u?.type || "yup" })).filter((u) => u.id);
16
+ }
17
+ };
18
+ }
19
+ const $ = ["mandatory", "mandatoryselect"], S = (e, n) => {
20
+ const r = [];
21
+ return (e || []).forEach((h) => {
22
+ if (r.push(h), Array.isArray(h.subforms) && h.subforms.length) {
23
+ const u = h?.id || h?.props?.id, l = u ? n[u] : void 0;
24
+ h.subforms.forEach((t) => {
25
+ (Array.isArray(l) ? l.includes(t.conditionValue) : t.conditionValue === l) && r.push(...S(t.data || [], n));
26
+ });
27
+ }
28
+ }), r;
29
+ }, E = (e) => e?.id || e?.props?.id || "", L = (e, n) => !e?.visibleWhen || I(e.visibleWhen, n), ee = (e, n) => e?.optionsMap && e?.dependsOn ? e.optionsMap[n[e.dependsOn]] || [] : e?.props?.options;
30
+ function de(e, n = {}) {
31
+ const { resolver: r } = n, h = n.messages?.required || "This field is required", u = V(() => {
32
+ const i = { ...n.initialValues || {} };
33
+ return S(e, i).forEach((s) => {
34
+ const f = E(s), d = s?.props?.value;
35
+ f && i[f] === void 0 && d !== void 0 && (i[f] = d);
36
+ }), i;
37
+ }, []), [l, t] = T(u), [a, w] = T([]), m = x(u), v = A((i) => {
38
+ const s = { ...i };
39
+ return S(e, s).forEach((d) => {
40
+ const o = E(d);
41
+ if (o && d.visibleWhen && !I(d.visibleWhen, s) && delete s[o], o && d.optionsMap && d.dependsOn) {
42
+ const y = (d.optionsMap[s[d.dependsOn]] || []).map((g) => typeof g == "string" ? g : g?.value), b = s[o];
43
+ b != null && b !== "" && !y.includes(b) && delete s[o];
44
+ }
45
+ }), (e || []).forEach((d) => {
46
+ if (!Array.isArray(d.subforms) || !d.subforms.length) return;
47
+ const o = E(d), c = o ? s[o] : void 0, y = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
48
+ d.subforms.forEach((g) => {
49
+ const M = Array.isArray(c) ? c.includes(g.conditionValue) : g.conditionValue === c;
50
+ (g.data || []).forEach((C) => {
51
+ const p = E(C);
52
+ p && (M ? y : b).add(p);
53
+ });
54
+ }), b.forEach((g) => {
55
+ y.has(g) || delete s[g];
56
+ });
57
+ }), S(e, s).forEach((d) => {
58
+ const o = E(d);
59
+ o && d.formula && (s[o] = k(d.formula, s));
60
+ }), s;
61
+ }, [e]), N = A((i, s) => {
62
+ t((f) => v({ ...f, [i]: s }));
63
+ }, [v]), X = A((i) => {
64
+ t((s) => v({ ...s, ...i || {} }));
65
+ }, [v]), O = A((i) => {
66
+ const s = S(e, i), f = [], d = /* @__PURE__ */ new Set();
67
+ if (s.forEach((o) => {
68
+ const c = E(o);
69
+ c && !L(o, i) && d.add(c);
70
+ }), s.forEach((o) => {
71
+ const c = E(o);
72
+ if (!c || d.has(c)) return;
73
+ const y = [...o?.rules?.validation || []], b = y.some((p) => $.includes(p.rule));
74
+ if (o.requiredWhen && !b && I(o.requiredWhen, i) && y.push({ rule: "mandatory", message: o.requiredMessage || h }), !y.length) return;
75
+ const g = i[c], M = g == null ? "" : String(g), C = y.some((p) => $.includes(p.rule));
76
+ y.forEach((p) => {
77
+ const R = Q[p.rule];
78
+ if (R) {
79
+ if (!M && !C) return;
80
+ const D = i[p.field ?? p.value], K = D == null ? "" : String(D);
81
+ R(M, K) || f.push({ id: c, rule: p.rule, message: p.message });
82
+ return;
83
+ }
84
+ const W = U[p.rule];
85
+ if (typeof W != "function") return;
86
+ const q = $.includes(p.rule);
87
+ if (!M && !q) return;
88
+ W(q ? g : M, p.value) || f.push({ id: c, rule: p.rule, message: p.message || (q ? h : "") });
89
+ });
90
+ }), r) {
91
+ let o = [];
92
+ try {
93
+ o = r(i) || [];
94
+ } catch {
95
+ o = [];
96
+ }
97
+ o.forEach((c) => {
98
+ c && c.id && !d.has(c.id) && f.push({ id: c.id, rule: c.rule || "schema", message: c.message });
99
+ });
100
+ }
101
+ return f;
102
+ }, [e, r, h]), Y = A(() => {
103
+ const i = O(l);
104
+ return w(i), i;
105
+ }, [O, l]), B = A((i) => {
106
+ const s = O(l);
107
+ return w(s), s.length === 0 && i && i({ ...l }), s;
108
+ }, [O, l]), P = A(() => {
109
+ t({ ...m.current }), w([]);
110
+ }, []), F = V(() => {
111
+ const i = /* @__PURE__ */ new Map();
112
+ return a.forEach((s) => {
113
+ s.id && !i.has(s.id) && i.set(s.id, s.message);
114
+ }), S(e, l).map((s) => {
115
+ const f = E(s), o = (s?.rules?.validation || []).some((y) => $.includes(y.rule)) || !!(s.requiredWhen && I(s.requiredWhen, l)), c = s.formula ? k(s.formula, l) : l[f];
116
+ return {
117
+ id: f,
118
+ field: s,
119
+ value: c,
120
+ visible: L(s, l),
121
+ disabled: !!(s.disabledWhen && I(s.disabledWhen, l)),
122
+ required: o,
123
+ options: ee(s, l),
124
+ error: i.get(f)
125
+ };
126
+ });
127
+ }, [e, l, a]), j = V(() => F.filter((i) => i.visible), [F]), H = A((i) => F.find((s) => s.id === i), [F]), J = V(() => !Z(l, m.current), [l]);
128
+ return {
129
+ values: l,
130
+ errors: a,
131
+ fields: F,
132
+ visibleFields: j,
133
+ getFieldState: H,
134
+ setValue: N,
135
+ setValues: X,
136
+ validate: Y,
137
+ isValid: a.length === 0,
138
+ isDirty: J,
139
+ reset: P,
140
+ submit: B
141
+ };
142
+ }
143
+ const se = /* @__PURE__ */ new Set(["typography", "divider", "alert", "image", "imagelist", "hyperlink", "button"]), _ = (e) => e?.id || e?.props?.id, z = (e, n = /* @__PURE__ */ new Set()) => ((e || []).forEach((r) => {
144
+ const h = _(r);
145
+ h && n.add(h), Array.isArray(r?.subforms) && r.subforms.forEach((u) => z(u?.data || [], n));
146
+ }), n), G = (e) => {
147
+ if (!e || typeof e != "object") return [];
148
+ if (typeof e.field == "string") return [e.field];
149
+ const n = e.all || e.any || e.none;
150
+ return Array.isArray(n) ? n.flatMap(G) : [];
151
+ }, ne = (e) => (Array.isArray(e) ? e : []).map((n) => typeof n == "string" ? n : n?.value);
152
+ function le(e) {
153
+ const n = [], r = z(e), h = (u) => {
154
+ const l = /* @__PURE__ */ new Set();
155
+ (u || []).forEach((t) => {
156
+ const a = _(t), w = t?.type;
157
+ if (!a && !se.has(w) && n.push({ level: "warning", code: "missing-id", message: `A "${w || "field"}" has no id; its value can't be captured.` }), a && (l.has(a) && n.push({ level: "error", code: "duplicate-id", field: a, message: `Duplicate field id "${a}" among siblings — their values will collide.` }), l.add(a)), t?.dependsOn && !t?.optionsMap && n.push({ level: "warning", code: "depends-without-options", field: a, message: `"${a}" has \`dependsOn\` but no \`optionsMap\`, so its options never change.` }), t?.optionsMap && !t?.dependsOn && n.push({ level: "warning", code: "options-without-depends", field: a, message: `"${a}" has \`optionsMap\` but no \`dependsOn\`, so it can't pick a branch.` }), t?.dependsOn && !r.has(t.dependsOn) && n.push({ level: "error", code: "unknown-depends-target", field: a, message: `"${a}" dependsOn "${t.dependsOn}", which is not a field in this schema.` }), ["visibleWhen", "disabledWhen", "requiredWhen"].forEach((m) => {
158
+ G(t?.[m]).forEach((v) => {
159
+ r.has(v) || n.push({ level: "error", code: "unknown-rule-field", field: a, message: `"${a}" ${m} references field "${v}", which does not exist.` });
160
+ });
161
+ }), (t?.rules?.validation || []).forEach((m) => {
162
+ m?.field && /Field$/.test(m?.rule || "") && !r.has(m.field) && n.push({ level: "error", code: "unknown-cross-field", field: a, message: `"${a}" rule "${m.rule}" compares against "${m.field}", which does not exist.` });
163
+ }), Array.isArray(t?.subforms) && t.subforms.length) {
164
+ const m = ne(t?.props?.options);
165
+ m.length && t.subforms.forEach((v) => {
166
+ v?.conditionValue !== void 0 && !m.includes(v.conditionValue) && n.push({ level: "warning", code: "subform-condition-not-an-option", field: a, message: `"${a}" has a subform for value "${v.conditionValue}", which isn't one of its options.` });
167
+ }), t.subforms.forEach((v) => h(v?.data || []));
168
+ }
169
+ });
170
+ };
171
+ return h(e), n;
172
+ }
173
+ function ce(e) {
174
+ return e;
175
+ }
2
176
  export {
3
- a as AIFill,
4
- r as AIForm,
5
- o as AIFormGenerator,
6
- t as AISchemaReview,
7
- i as AITextAssist,
8
- l as AIVisionImport,
9
- n as ClearFormData,
10
- m as Controls,
11
- F as DynamicComponent,
12
- g as FormData,
13
- C as FormGenerator,
14
- u as MuiConfig,
15
- A as configureMuiX,
16
- I as createAIClient,
17
- d as defineForm,
18
- p as formFieldsToSimple,
19
- R as getMuiX,
20
- c as getRegisteredControl,
21
- f as hasRegisteredControl,
22
- v as registerControl,
23
- M as registerControls,
24
- y as registeredControlTypes,
25
- D as resetMuiX,
26
- S as simpleFieldsToFormFields,
27
- T as slug,
28
- h as unregisterControl,
29
- x as useAIAssist,
30
- G as useForm,
31
- X as useFormEngine,
32
- w as validateSchema,
33
- z as yupResolver,
34
- E as zodResolver
177
+ pe as AIFill,
178
+ fe as AIForm,
179
+ me as AIFormGenerator,
180
+ ge as AISchemaReview,
181
+ ve as AITextAssist,
182
+ ye as AIVisionImport,
183
+ be as ClearFormData,
184
+ Ae as Controls,
185
+ Ee as DynamicComponent,
186
+ we as FormData,
187
+ Me as FormGenerator,
188
+ Se as MuiConfig,
189
+ Fe as configureMuiX,
190
+ Ie as createAIClient,
191
+ ce as defineForm,
192
+ Oe as formFieldsToSimple,
193
+ Ve as getMuiX,
194
+ $e as getRegisteredControl,
195
+ Ce as hasRegisteredControl,
196
+ We as registerControl,
197
+ qe as registerControls,
198
+ Re as registeredControlTypes,
199
+ De as resetMuiX,
200
+ ke as simpleFieldsToFormFields,
201
+ Te as slug,
202
+ Le as unregisterControl,
203
+ _e as useAIAssist,
204
+ ze as useForm,
205
+ de as useFormEngine,
206
+ le as validateSchema,
207
+ ae as yupResolver,
208
+ te as zodResolver
35
209
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),w=require("@mui/material/Table"),S=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),I=require("@mui/material/TableContainer"),z=require("@mui/material/TableHead"),j=require("@mui/material/TableRow"),F=require("@mui/material/TextField"),W=require("@mui/material/IconButton"),B=require("@mui/material/Button"),M=require("@mui/material/FormControl"),P=require("@mui/material/FormLabel"),$=require("@mui/material/Paper"),E=require("@mui/icons-material/Add"),L=require("@mui/icons-material/Close"),d=require("./AIForm-LoeI18mO.js");function f(o){return Array.isArray(o)?o.map(c=>({...c||{}})):[]}function H({attributes:o={},onChange:c}){const{MuiAttributes:g={},id:p="",columns:x=[],addLabel:q="Add row",label:m}=o,{sx:v,...y}=g,h=Array.isArray(x)?x:[],[l,i]=k.useState(()=>f(o.value));d.useUpdateEffect(()=>{i(f(o.value))},[o.value]);const u=r=>{c?.({id:p,value:r})},C=(r,t,n)=>{const s=l.map((b,T)=>T===r?{...b,[t]:n}:b);i(s),u(s)},A=()=>{const r=[...l,{}];i(r),u(r)},R=r=>{const t=l.filter((n,s)=>s!==r);i(t),u(t)};return e.jsxs(M,{component:"fieldset",fullWidth:!0,children:[m&&e.jsx(P,{component:"legend",sx:{mb:1},children:m}),e.jsx(I,{component:$,variant:"outlined",sx:{borderRadius:2,overflow:"hidden"},children:e.jsxs(w,{size:"small",children:[e.jsx(z,{children:e.jsxs(j,{sx:{backgroundColor:"action.hover"},children:[h.map(r=>e.jsx(a,{sx:{fontWeight:600},children:r.label},r.key)),e.jsx(a,{align:"right",sx:{width:48}})]})}),e.jsx(S,{children:l.map((r,t)=>e.jsxs(j,{sx:{transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{backgroundColor:"action.hover"}},children:[h.map(n=>e.jsx(a,{children:e.jsx(F,{...y,type:n.type==="number"?"number":"text",value:r[n.key]??"",onChange:s=>C(t,n.key,s.target.value),size:"small",variant:"standard",fullWidth:!0,sx:d.mergeSx(d.premiumInputSx,v),slotProps:{htmlInput:{"aria-label":`${n.label} row ${t+1}`}}})},n.key)),e.jsx(a,{align:"right",children:e.jsx(W,{"aria-label":`Remove row ${t+1}`,onClick:()=>R(t),size:"small",sx:{borderRadius:2,color:"text.secondary","&:hover":{color:"error.main"}},children:e.jsx(L,{fontSize:"small"})})})]},t))})]})}),e.jsx(B,{onClick:A,startIcon:e.jsx(E,{}),size:"small",variant:"text",sx:{alignSelf:"flex-start",mt:1,borderRadius:2,textTransform:"none",fontWeight:600},children:q})]})}exports.default=H;
@@ -1,48 +1,48 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import z from "react";
3
- import S from "@mui/material/Table";
4
- import I from "@mui/material/TableBody";
3
+ import I from "@mui/material/Table";
4
+ import S from "@mui/material/TableBody";
5
5
  import s from "@mui/material/TableCell";
6
6
  import W from "@mui/material/TableContainer";
7
- import B from "@mui/material/TableHead";
7
+ import j from "@mui/material/TableHead";
8
8
  import b from "@mui/material/TableRow";
9
- import F from "@mui/material/TextField";
10
- import $ from "@mui/material/IconButton";
11
- import j from "@mui/material/Button";
9
+ import B from "@mui/material/TextField";
10
+ import F from "@mui/material/IconButton";
11
+ import $ from "@mui/material/Button";
12
12
  import E from "@mui/material/FormControl";
13
13
  import L from "@mui/material/FormLabel";
14
14
  import M from "@mui/material/Paper";
15
15
  import P from "@mui/icons-material/Add";
16
16
  import H from "@mui/icons-material/Close";
17
- import { u as U, m as _, a as q } from "./index-B7i3cvH0.mjs";
17
+ import { j as U, m as _, k as q } from "./AIForm-Czsvpf7g.mjs";
18
18
  function x(n) {
19
19
  return Array.isArray(n) ? n.map((d) => ({ ...d || {} })) : [];
20
20
  }
21
- function lr({ attributes: n = {}, onChange: d }) {
21
+ function ar({ attributes: n = {}, onChange: d }) {
22
22
  const {
23
23
  MuiAttributes: g = {},
24
24
  id: v = "",
25
- columns: u = [],
25
+ columns: p = [],
26
26
  addLabel: y = "Add row",
27
- label: p
28
- } = n, { sx: C, ...k } = g, f = Array.isArray(u) ? u : [], [l, i] = z.useState(() => x(n.value));
27
+ label: u
28
+ } = n, { sx: C, ...k } = g, f = Array.isArray(p) ? p : [], [a, i] = z.useState(() => x(n.value));
29
29
  U(() => {
30
30
  i(x(n.value));
31
31
  }, [n.value]);
32
32
  const c = (r) => {
33
33
  d?.({ id: v, value: r });
34
34
  }, w = (r, o, t) => {
35
- const a = l.map((h, T) => T === r ? { ...h, [o]: t } : h);
36
- i(a), c(a);
35
+ const l = a.map((h, T) => T === r ? { ...h, [o]: t } : h);
36
+ i(l), c(l);
37
37
  }, A = () => {
38
- const r = [...l, {}];
38
+ const r = [...a, {}];
39
39
  i(r), c(r);
40
40
  }, R = (r) => {
41
- const o = l.filter((t, a) => a !== r);
41
+ const o = a.filter((t, l) => l !== r);
42
42
  i(o), c(o);
43
43
  };
44
44
  return /* @__PURE__ */ m(E, { component: "fieldset", fullWidth: !0, children: [
45
- p && /* @__PURE__ */ e(L, { component: "legend", sx: { mb: 1 }, children: p }),
45
+ u && /* @__PURE__ */ e(L, { component: "legend", sx: { mb: 1 }, children: u }),
46
46
  /* @__PURE__ */ e(
47
47
  W,
48
48
  {
@@ -52,12 +52,12 @@ function lr({ attributes: n = {}, onChange: d }) {
52
52
  borderRadius: 2,
53
53
  overflow: "hidden"
54
54
  },
55
- children: /* @__PURE__ */ m(S, { size: "small", children: [
56
- /* @__PURE__ */ e(B, { children: /* @__PURE__ */ m(b, { sx: { backgroundColor: "action.hover" }, children: [
55
+ children: /* @__PURE__ */ m(I, { size: "small", children: [
56
+ /* @__PURE__ */ e(j, { children: /* @__PURE__ */ m(b, { sx: { backgroundColor: "action.hover" }, children: [
57
57
  f.map((r) => /* @__PURE__ */ e(s, { sx: { fontWeight: 600 }, children: r.label }, r.key)),
58
58
  /* @__PURE__ */ e(s, { align: "right", sx: { width: 48 } })
59
59
  ] }) }),
60
- /* @__PURE__ */ e(I, { children: l.map((r, o) => /* @__PURE__ */ m(
60
+ /* @__PURE__ */ e(S, { children: a.map((r, o) => /* @__PURE__ */ m(
61
61
  b,
62
62
  {
63
63
  sx: {
@@ -66,23 +66,25 @@ function lr({ attributes: n = {}, onChange: d }) {
66
66
  },
67
67
  children: [
68
68
  f.map((t) => /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
69
- F,
69
+ B,
70
70
  {
71
71
  ...k,
72
72
  type: t.type === "number" ? "number" : "text",
73
73
  value: r[t.key] ?? "",
74
- onChange: (a) => w(o, t.key, a.target.value),
75
- inputProps: {
76
- "aria-label": `${t.label} row ${o + 1}`
77
- },
74
+ onChange: (l) => w(o, t.key, l.target.value),
78
75
  size: "small",
79
76
  variant: "standard",
80
77
  fullWidth: !0,
81
- sx: _(q, C)
78
+ sx: _(q, C),
79
+ slotProps: {
80
+ htmlInput: {
81
+ "aria-label": `${t.label} row ${o + 1}`
82
+ }
83
+ }
82
84
  }
83
85
  ) }, t.key)),
84
86
  /* @__PURE__ */ e(s, { align: "right", children: /* @__PURE__ */ e(
85
- $,
87
+ F,
86
88
  {
87
89
  "aria-label": `Remove row ${o + 1}`,
88
90
  onClick: () => R(o),
@@ -103,7 +105,7 @@ function lr({ attributes: n = {}, onChange: d }) {
103
105
  }
104
106
  ),
105
107
  /* @__PURE__ */ e(
106
- j,
108
+ $,
107
109
  {
108
110
  onClick: A,
109
111
  startIcon: /* @__PURE__ */ e(P, {}),
@@ -122,5 +124,5 @@ function lr({ attributes: n = {}, onChange: d }) {
122
124
  ] });
123
125
  }
124
126
  export {
125
- lr as default
127
+ ar as default
126
128
  };
@@ -7,7 +7,7 @@ import H from "@mui/material/CircularProgress";
7
7
  import J from "@mui/icons-material/CloudUpload";
8
8
  import K from "@mui/icons-material/Close";
9
9
  import N from "@mui/icons-material/InsertDriveFile";
10
- import { u as Q, m as V, b as W } from "./index-B7i3cvH0.mjs";
10
+ import { j as Q, m as V, l as W } from "./AIForm-Czsvpf7g.mjs";
11
11
  import { u as X } from "./s3Upload-dpioZ2c8.mjs";
12
12
  const R = (r) => r ? Array.isArray(r) ? r.filter(Boolean) : [r] : [], Y = (r) => /^data:image\//i.test(r) || /\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(r), Z = (r) => new Promise((u, g) => {
13
13
  const a = new FileReader();
@@ -24,8 +24,8 @@ function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
24
24
  path: $ = "",
25
25
  maxSizeMB: x = 0,
26
26
  label: w = "Upload file",
27
- MuiAttributes: P = {}
28
- } = r, D = _(null), [d, v] = m(R(r.value)), [S, b] = m(!1), [j, U] = m(!1), [k, y] = m(""), L = u?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1;
27
+ MuiAttributes: j = {}
28
+ } = r, D = _(null), [d, v] = m(R(r.value)), [S, y] = m(!1), [P, U] = m(!1), [k, b] = m(""), L = u?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1;
29
29
  Q(() => {
30
30
  v(R(r.value));
31
31
  }, [r.value]);
@@ -34,19 +34,19 @@ function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
34
34
  }, I = async (e) => {
35
35
  const o = Array.from(e);
36
36
  if (!o.length) return;
37
- y(""), U(!0);
37
+ b(""), U(!0);
38
38
  const i = [], f = [];
39
39
  try {
40
40
  for (const n of o) {
41
41
  if (x && n.size > x * 1024 * 1024) {
42
- y(`"${n.name}" exceeds the ${x}MB limit.`);
42
+ b(`"${n.name}" exceeds the ${x}MB limit.`);
43
43
  continue;
44
44
  }
45
45
  const O = await Z(n), G = await X(O, n.name, z, B, F, $);
46
46
  i.push(G), f.push(n);
47
47
  }
48
48
  } catch (n) {
49
- console.error("FileUpload failed", n), y("Upload failed. Please try again.");
49
+ console.error("FileUpload failed", n), b("Upload failed. Please try again.");
50
50
  } finally {
51
51
  U(!1);
52
52
  }
@@ -56,12 +56,12 @@ function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
56
56
  }, M = (e) => {
57
57
  e.target.files && I(e.target.files), e.target.value = "";
58
58
  }, T = (e) => {
59
- e.preventDefault(), b(!1), e.dataTransfer?.files?.length && I(e.dataTransfer.files);
59
+ e.preventDefault(), y(!1), e.dataTransfer?.files?.length && I(e.dataTransfer.files);
60
60
  }, E = (e) => {
61
61
  const o = d.filter((i, f) => f !== e);
62
62
  v(o), C(o);
63
63
  };
64
- return /* @__PURE__ */ l(s, { sx: { width: "100%", ...P.sx }, children: [
64
+ return /* @__PURE__ */ l(s, { sx: { width: "100%", ...j.sx }, children: [
65
65
  /* @__PURE__ */ l(c, { variant: "subtitle2", gutterBottom: !0, sx: { display: "flex" }, children: [
66
66
  w,
67
67
  L && /* @__PURE__ */ t(s, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
@@ -84,9 +84,9 @@ function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
84
84
  "aria-label": w,
85
85
  onClick: () => D.current?.click(),
86
86
  onDragOver: (e) => {
87
- e.preventDefault(), b(!0);
87
+ e.preventDefault(), y(!0);
88
88
  },
89
- onDragLeave: () => b(!1),
89
+ onDragLeave: () => y(!1),
90
90
  onDrop: T,
91
91
  sx: {
92
92
  border: "2px dashed",
@@ -100,20 +100,33 @@ function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
100
100
  "&:hover": { borderColor: "primary.main", bgcolor: "action.hover" }
101
101
  },
102
102
  children: [
103
- j ? /* @__PURE__ */ t(H, { size: 28 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 40, color: "primary.main" } }),
103
+ P ? /* @__PURE__ */ t(H, { size: 28 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 40, color: "primary.main" } }),
104
104
  /* @__PURE__ */ l(c, { variant: "body2", sx: { mt: 1 }, children: [
105
105
  "Drag & drop ",
106
106
  p ? "files" : "a file",
107
107
  " here, or click to browse"
108
108
  ] }),
109
- h && /* @__PURE__ */ l(c, { variant: "caption", color: "text.secondary", children: [
109
+ h && /* @__PURE__ */ l(c, { variant: "caption", sx: {
110
+ color: "text.secondary"
111
+ }, children: [
110
112
  "Accepted: ",
111
113
  h
112
114
  ] })
113
115
  ]
114
116
  }
115
117
  ),
116
- k && /* @__PURE__ */ t(c, { variant: "caption", color: "error.main", sx: { display: "block", mt: 1 }, children: k }),
118
+ k && /* @__PURE__ */ t(
119
+ c,
120
+ {
121
+ variant: "caption",
122
+ sx: {
123
+ color: "error.main",
124
+ display: "block",
125
+ mt: 1
126
+ },
127
+ children: k
128
+ }
129
+ ),
117
130
  d.length > 0 && /* @__PURE__ */ t(s, { sx: V(W, { mt: 1.5, p: 1 }), children: d.map((e, o) => /* @__PURE__ */ l(
118
131
  s,
119
132
  {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),i=require("@mui/material/Box"),c=require("@mui/material/Typography"),G=require("@mui/material/IconButton"),_=require("@mui/material/CircularProgress"),H=require("@mui/icons-material/CloudUpload"),J=require("@mui/icons-material/Close"),K=require("@mui/icons-material/InsertDriveFile"),b=require("./AIForm-LoeI18mO.js"),N=require("./s3Upload-B0JeoLkS.js"),R=o=>o?Array.isArray(o)?o.filter(Boolean):[o]:[],Q=o=>/^data:image\//i.test(o)||/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(o),V=o=>new Promise((f,x)=>{const s=new FileReader;s.onload=()=>f(s.result||""),s.onerror=()=>x(s.error),s.readAsDataURL(o)});function W({attributes:o={},rules:f={},onChange:x}){const{id:s="",multiple:d=!1,accept:g="",bucket:A="",region:C="",identityPoolId:F="",path:z="",maxSizeMB:h=0,label:j="Upload file",MuiAttributes:B={}}=o,S=l.useRef(null),[p,m]=l.useState(R(o.value)),[w,v]=l.useState(!1),[P,U]=l.useState(!1),[q,y]=l.useState(""),$=f?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;b.useUpdateEffect(()=>{m(R(o.value))},[o.value]);const D=(e,t)=>{x?.({id:s,value:d?e:e[0]??"",option:t})},k=async e=>{const t=Array.from(e);if(!t.length)return;y(""),U(!0);const a=[],u=[];try{for(const n of t){if(h&&n.size>h*1024*1024){y(`"${n.name}" exceeds the ${h}MB limit.`);continue}const O=await V(n),E=await N.uploadToS3(O,n.name,A,C,F,z);a.push(E),u.push(n)}}catch(n){console.error("FileUpload failed",n),y("Upload failed. Please try again.")}finally{U(!1)}if(!a.length)return;const I=d?[...p,...a]:a.slice(0,1);m(I),D(I,u)},M=e=>{e.target.files&&k(e.target.files),e.target.value=""},T=e=>{e.preventDefault(),v(!1),e.dataTransfer?.files?.length&&k(e.dataTransfer.files)},L=e=>{const t=p.filter((a,u)=>u!==e);m(t),D(t)};return r.jsxs(i,{sx:{width:"100%",...B.sx},children:[r.jsxs(c,{variant:"subtitle2",gutterBottom:!0,sx:{display:"flex"},children:[j,$&&r.jsx(i,{component:"span",sx:{color:"error.main",ml:.5},children:"*"})]}),r.jsx("input",{ref:S,type:"file",hidden:!0,multiple:d,accept:g||void 0,onChange:M}),r.jsxs(i,{role:"button","aria-label":j,onClick:()=>S.current?.click(),onDragOver:e=>{e.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:T,sx:{border:"2px dashed",borderColor:w?"primary.main":"divider",borderRadius:"12px",p:3,textAlign:"center",cursor:"pointer",transition:"all .2s",bgcolor:w?"action.hover":"background.paper","&:hover":{borderColor:"primary.main",bgcolor:"action.hover"}},children:[P?r.jsx(_,{size:28}):r.jsx(H,{sx:{fontSize:40,color:"primary.main"}}),r.jsxs(c,{variant:"body2",sx:{mt:1},children:["Drag & drop ",d?"files":"a file"," here, or click to browse"]}),g&&r.jsxs(c,{variant:"caption",sx:{color:"text.secondary"},children:["Accepted: ",g]})]}),q&&r.jsx(c,{variant:"caption",sx:{color:"error.main",display:"block",mt:1},children:q}),p.length>0&&r.jsx(i,{sx:b.mergeSx(b.premiumSurfaceSx,{mt:1.5,p:1}),children:p.map((e,t)=>r.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1.5,p:1,borderRadius:"8px",transition:"background-color .18s","&:hover":{bgcolor:"action.hover"}},children:[Q(e)?r.jsx(i,{component:"img",src:e,alt:`upload-${t}`,sx:{width:40,height:40,objectFit:"cover",borderRadius:"8px",flexShrink:0}}):r.jsx(K,{color:"action",sx:{flexShrink:0}}),r.jsx(c,{variant:"body2",sx:{flexGrow:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.split("/").pop()?.split("?")[0]||e}),r.jsx(G,{size:"small","aria-label":"remove",onClick:a=>{a.stopPropagation(),L(t)},children:r.jsx(J,{fontSize:"small"})})]},`${e}-${t}`))})]})}exports.default=W;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),b=require("./AIForm-LoeI18mO.js"),C=require("./v4-CqdK_b8Y.js");function N({attributes:f={},rules:j={},onChange:o}){const{id:c="",label:g="Group",min:s=1,max:u,subFields:A=[],value:a}=f,v=j?.validation?.some(e=>e.rule==="mandatory")||!1,F=i.useMemo(()=>{if(Array.isArray(a)&&a.length>0)return a.length;const e=Number(f.count);return!isNaN(e)&&e>=s?e:s},[]),[l,I]=i.useState(F),d=i.useRef([]),m=i.useCallback(e=>(d.current[e]||(d.current[e]=C.v4()),d.current[e]),[]),y=i.useCallback(e=>{if(!o)return;const r=Array.from({length:e},(p,x)=>{const h=`${c}-group-${m(x)}`;return b.FormData(h)??{}});o({id:c,value:r})},[c,m,o]),q=e=>{let r=parseInt(e,10);(isNaN(r)||r<s)&&(r=s),u!==void 0&&r>u&&(r=u),I(r),setTimeout(()=>y(r),0)};return t.jsxs(n.Box,{sx:{width:"100%"},children:[t.jsx(n.TextField,{type:"number",size:"small",label:`Number of ${g}s`,value:l,onChange:e=>q(e.target.value),required:v,sx:{mb:2,minWidth:200},slotProps:{input:{startAdornment:t.jsx(n.InputAdornment,{position:"start",children:t.jsx(n.Icon,{fontSize:"small",children:"format_list_numbered"})})},htmlInput:{min:s,...u!==void 0?{max:u}:{}}}}),Array.from({length:l},(e,r)=>{const p=`${c}-group-${m(r)}`,x=Array.isArray(a)?a[r]:void 0;return t.jsxs(n.Accordion,{defaultExpanded:r===0,sx:{mb:1},children:[t.jsx(n.AccordionSummary,{expandIcon:t.jsx(n.Icon,{children:"expand_more"}),children:t.jsxs(n.Typography,{sx:{fontWeight:600},children:[g," ",r+1]})}),t.jsx(n.AccordionDetails,{children:t.jsx(b.FormGenerator,{guid:p,data:A,patch:x??{},onChange:h=>{y(l),o&&o(h)}})})]},p)})]})}exports.default=N;
@@ -1,8 +1,8 @@
1
1
  import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
2
  import { useMemo as _, useState as $, useRef as G, useCallback as y } from "react";
3
- import { Box as P, TextField as R, InputAdornment as S, Icon as A, Accordion as T, AccordionSummary as j, Typography as z, AccordionDetails as D } from "@mui/material";
4
- import { e as M, F as W } from "./index-B7i3cvH0.mjs";
5
- import { v as k } from "./v4-BysszJq8.mjs";
3
+ import { Box as R, TextField as S, InputAdornment as T, Icon as A, Accordion as j, AccordionSummary as q, Typography as z, AccordionDetails as D } from "@mui/material";
4
+ import { q as M, F as P } from "./AIForm-Czsvpf7g.mjs";
5
+ import { v as W } from "./v4-BysszJq8.mjs";
6
6
  function H({ attributes: h = {}, rules: v = {}, onChange: o }) {
7
7
  const {
8
8
  id: s = "",
@@ -15,20 +15,20 @@ function H({ attributes: h = {}, rules: v = {}, onChange: o }) {
15
15
  if (Array.isArray(i) && i.length > 0) return i.length;
16
16
  const r = Number(h.count);
17
17
  return !isNaN(r) && r >= n ? r : n;
18
- }, []), [u, C] = $(N), c = G([]), d = y((r) => (c.current[r] || (c.current[r] = k()), c.current[r]), []), x = y((r) => {
18
+ }, []), [u, C] = $(N), l = G([]), c = y((r) => (l.current[r] || (l.current[r] = W()), l.current[r]), []), x = y((r) => {
19
19
  if (!o) return;
20
- const t = Array.from({ length: r }, (l, m) => {
21
- const p = `${s}-group-${d(m)}`;
20
+ const t = Array.from({ length: r }, (d, m) => {
21
+ const p = `${s}-group-${c(m)}`;
22
22
  return M(p) ?? {};
23
23
  });
24
24
  o({ id: s, value: t });
25
- }, [s, d, o]), I = (r) => {
25
+ }, [s, c, o]), I = (r) => {
26
26
  let t = parseInt(r, 10);
27
27
  (isNaN(t) || t < n) && (t = n), a !== void 0 && t > a && (t = a), C(t), setTimeout(() => x(t), 0);
28
28
  };
29
- return /* @__PURE__ */ f(P, { sx: { width: "100%" }, children: [
29
+ return /* @__PURE__ */ f(R, { sx: { width: "100%" }, children: [
30
30
  /* @__PURE__ */ e(
31
- R,
31
+ S,
32
32
  {
33
33
  type: "number",
34
34
  size: "small",
@@ -36,25 +36,29 @@ function H({ attributes: h = {}, rules: v = {}, onChange: o }) {
36
36
  value: u,
37
37
  onChange: (r) => I(r.target.value),
38
38
  required: F,
39
- inputProps: { min: n, ...a !== void 0 ? { max: a } : {} },
40
- InputProps: {
41
- startAdornment: /* @__PURE__ */ e(S, { position: "start", children: /* @__PURE__ */ e(A, { fontSize: "small", children: "format_list_numbered" }) })
42
- },
43
- sx: { mb: 2, minWidth: 200 }
39
+ sx: { mb: 2, minWidth: 200 },
40
+ slotProps: {
41
+ input: {
42
+ startAdornment: /* @__PURE__ */ e(T, { position: "start", children: /* @__PURE__ */ e(A, { fontSize: "small", children: "format_list_numbered" }) })
43
+ },
44
+ htmlInput: { min: n, ...a !== void 0 ? { max: a } : {} }
45
+ }
44
46
  }
45
47
  ),
46
48
  Array.from({ length: u }, (r, t) => {
47
- const l = `${s}-group-${d(t)}`, m = Array.isArray(i) ? i[t] : void 0;
48
- return /* @__PURE__ */ f(T, { defaultExpanded: t === 0, sx: { mb: 1 }, children: [
49
- /* @__PURE__ */ e(j, { expandIcon: /* @__PURE__ */ e(A, { children: "expand_more" }), children: /* @__PURE__ */ f(z, { fontWeight: 600, children: [
49
+ const d = `${s}-group-${c(t)}`, m = Array.isArray(i) ? i[t] : void 0;
50
+ return /* @__PURE__ */ f(j, { defaultExpanded: t === 0, sx: { mb: 1 }, children: [
51
+ /* @__PURE__ */ e(q, { expandIcon: /* @__PURE__ */ e(A, { children: "expand_more" }), children: /* @__PURE__ */ f(z, { sx: {
52
+ fontWeight: 600
53
+ }, children: [
50
54
  g,
51
55
  " ",
52
56
  t + 1
53
57
  ] }) }),
54
58
  /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
55
- W,
59
+ P,
56
60
  {
57
- guid: l,
61
+ guid: d,
58
62
  data: b,
59
63
  patch: m ?? {},
60
64
  onChange: (p) => {
@@ -62,7 +66,7 @@ function H({ attributes: h = {}, rules: v = {}, onChange: o }) {
62
66
  }
63
67
  }
64
68
  ) })
65
- ] }, l);
69
+ ] }, d);
66
70
  })
67
71
  ] });
68
72
  }
@@ -1,7 +1,7 @@
1
1
  import { jsxs as b, jsx as a } from "react/jsx-runtime";
2
2
  import { useState as G, useRef as w, useMemo as B, useCallback as S } from "react";
3
3
  import { Box as l, Stepper as U, Step as j, StepLabel as C, Button as v } from "@mui/material";
4
- import { P as c, F as E, m as M, d as N } from "./index-B7i3cvH0.mjs";
4
+ import { P as c, F as E, m as M, o as N } from "./AIForm-Czsvpf7g.mjs";
5
5
  import { v as P } from "./v4-BysszJq8.mjs";
6
6
  function T({ attributes: $ = {}, onChange: n }) {
7
7
  const {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("react"),n=require("@mui/material"),i=require("./AIForm-LoeI18mO.js"),y=require("./v4-CqdK_b8Y.js");function B({attributes:f={},onChange:l}){const{id:c="",guid:M,steps:x=[],patch:v={},finishLabel:j="Finish",validateSteps:d=!1,MuiAttributes:$={}}=f,[e,p]=a.useState(0),u=a.useRef(null),h=a.useMemo(()=>M||`${c}-${y.v4()}`,[]),r=Array.isArray(x)?x:[],o=Math.max(r.length-1,0),I=e>=o,R=e<=0,m=`${h}-step-${e}`,A=a.useCallback(()=>{p(t=>Math.max(t-1,0))},[]),g=a.useCallback(()=>{if(!(d&&u.current&&!u.current.validate())){if(e>=o){l?.({id:c,value:"complete",option:e});return}p(t=>Math.min(t+1,o))}},[e,o,c,l,d]),b=(t=>({borderRadius:`${i.PREMIUM_RADIUS+8}px`,textTransform:"none",fontWeight:600,px:3,transition:`box-shadow .18s ${i.PREMIUM_EASING}, transform .18s ${i.PREMIUM_EASING}`,"&:hover":{transform:"translateY(-1px)",boxShadow:`0 4px 12px ${t.palette.primary.main}22`}}));return s.jsxs(n.Box,{sx:{width:"100%"},...$,children:[s.jsx(n.Stepper,{activeStep:e,alternativeLabel:!0,sx:{mb:3,"& .MuiStepLabel-label":{fontWeight:500},"& .MuiStepIcon-root.Mui-active":{transition:`color .2s ${i.PREMIUM_EASING}`}},children:r.map((t,S)=>s.jsx(n.Step,{children:s.jsx(n.StepLabel,{children:t?.label??`Step ${S+1}`})},`${h}-label-${S}`))}),s.jsx(n.Box,{sx:{mb:3},children:r[e]&&s.jsx(i.FormGenerator,{guid:m,data:r[e].fields??[],patch:v,persistOnUnmount:!0,apiRef:u,onChange:t=>{l?.(t)}},m)}),s.jsxs(n.Box,{sx:{display:"flex",justifyContent:"space-between",gap:2},children:[s.jsx(n.Button,{variant:"outlined",onClick:A,disabled:R,sx:i.mergeSx(b),children:"Back"}),s.jsx(n.Button,{variant:"contained",onClick:g,sx:i.mergeSx(b),children:I?j:"Next"})]})]})}exports.default=B;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),S=require("react"),i=require("@mui/material/Box"),$=require("@mui/material/Link"),x=require("@mui/material/TextField"),w=require("@mui/material/Typography"),o=require("./AIForm-LoeI18mO.js"),h=t=>{if(t&&typeof t=="object")return{lat:t.lat!==void 0&&t.lat!==null?String(t.lat):"",lng:t.lng!==void 0&&t.lng!==null?String(t.lng):""};if(typeof t=="string"&&t.includes(",")){const[c="",a=""]=t.split(",");return{lat:c.trim(),lng:a.trim()}}return{lat:"",lng:""}};function q({attributes:t={},onChange:c}){const{id:a="",label:g="",showMap:b=!1,MuiAttributes:p={}}=t,[n,u]=S.useState(()=>h(t.value));o.useUpdateEffect(()=>{u(h(t.value))},[t.value]);const f=e=>{c?.({id:a,value:{lat:e.lat,lng:e.lng},option:`${e.lat},${e.lng}`})},d=e=>s=>{const r={...n,[e]:s.target.value};u(r),f(r)},y=n.lat!==""&&n.lng!=="",m=o.mergeSx(o.premiumInputSx,p.sx),j=()=>{const e=parseFloat(n.lat),s=parseFloat(n.lng),r=.01;return`https://www.openstreetmap.org/export/embed.html?bbox=${`${s-r},${e-r},${s+r},${e+r}`}&marker=${e},${s}`};return l.jsxs(i,{id:a,children:[g?l.jsx(w,{variant:"body2",sx:{mb:.75,fontWeight:500},children:g}):null,l.jsxs(i,{sx:{display:"flex",gap:1.5,flexWrap:"wrap"},children:[l.jsx(x,{type:"number",...p,label:"Latitude",value:n.lat,onChange:d("lat"),sx:m,slotProps:{htmlInput:{"aria-label":"Latitude",step:"any"}}}),l.jsx(x,{type:"number",...p,label:"Longitude",value:n.lng,onChange:d("lng"),sx:m,slotProps:{htmlInput:{"aria-label":"Longitude",step:"any"}}})]}),l.jsx(i,{sx:{mt:1},children:l.jsx($,{href:`https://www.google.com/maps?q=${n.lat},${n.lng}`,target:"_blank",rel:"noreferrer",variant:"body2",children:"Open in Maps"})}),b&&y?l.jsx(i,{sx:o.mergeSx(e=>({...o.premiumSurfaceSx(e),mt:1.5})),children:l.jsx("iframe",{title:"map",width:"100%",height:"240",style:{border:0,display:"block"},src:j()})}):null]})}exports.default=q;