dynamic-mui 2.5.3 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/dist/accordion-BSh2h2a_.js +1 -0
  2. package/dist/accordion-Cqu-4mCj.mjs +22 -0
  3. package/dist/addressfield-BYisUY6y.mjs +242 -0
  4. package/dist/addressfield-CRd4lfdV.js +1 -0
  5. package/dist/ai/index.cjs +1 -1
  6. package/dist/ai/index.mjs +1 -14
  7. package/dist/ai/react/AIForm.d.ts +2 -1
  8. package/dist/ai/react/AIFormGenerator.d.ts +1 -1
  9. package/dist/ai/react/AISchemaReview.d.ts +1 -1
  10. package/dist/ai/react/AITextAssist.d.ts +1 -1
  11. package/dist/ai/react/AIVisionImport.d.ts +2 -1
  12. package/dist/ai-CXI0Rnu8.js +29 -0
  13. package/dist/ai-D6hkfd_f.mjs +4533 -0
  14. package/dist/asyncautocomplete-B1fK0nUW.js +1 -0
  15. package/dist/asyncautocomplete-D4oCW2B0.mjs +72 -0
  16. package/dist/bar-CgYZxXHl.js +1 -0
  17. package/dist/bar-LVtZP6Ui.mjs +4 -0
  18. package/dist/cascadeselect-CYzYzmqv.js +1 -0
  19. package/dist/cascadeselect-s-LY4P0l.mjs +66 -0
  20. package/dist/chartControl-IQafKpDk.mjs +29 -0
  21. package/dist/chartControl-ifHiG3nr.js +1 -0
  22. package/dist/collection-Ccj0OayP.js +1 -0
  23. package/dist/collection-DGq2rxDx.mjs +1692 -0
  24. package/dist/colorpicker-TDpxW59g.mjs +110 -0
  25. package/dist/colorpicker-q2FYP06A.js +1 -0
  26. package/dist/components/DynamicComponent.d.ts +2 -1
  27. package/dist/components/FormGenerator.d.ts +1 -1
  28. package/dist/components/charts/Bar/bar.d.ts +6 -2
  29. package/dist/components/charts/Line/line.d.ts +6 -2
  30. package/dist/components/charts/Mixchart/mixChart.d.ts +2 -1
  31. package/dist/components/charts/Pie/pie.d.ts +6 -2
  32. package/dist/components/charts/chartControl.d.ts +15 -0
  33. package/dist/components/controls/Accordion/accordion.d.ts +2 -1
  34. package/dist/components/controls/AddressField/addressfield.d.ts +2 -1
  35. package/dist/components/controls/Alert/alert.d.ts +1 -1
  36. package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +1 -1
  37. package/dist/components/controls/Autocomplete/autocomplete.d.ts +1 -1
  38. package/dist/components/controls/Button/button.d.ts +1 -1
  39. package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -1
  40. package/dist/components/controls/CheckBox/checkbox.d.ts +2 -2
  41. package/dist/components/controls/CheckBox/toggleInput.d.ts +25 -0
  42. package/dist/components/controls/Chip/chip.d.ts +1 -1
  43. package/dist/components/controls/ChipSelect/chipselect.d.ts +2 -1
  44. package/dist/components/controls/Collection/CollectionList.d.ts +1 -1
  45. package/dist/components/controls/Collection/ItemDialog.d.ts +1 -1
  46. package/dist/components/controls/Collection/collection.d.ts +1 -1
  47. package/dist/components/controls/Collection/parts.d.ts +6 -6
  48. package/dist/components/controls/ColorPicker/colorpicker.d.ts +2 -1
  49. package/dist/components/controls/Computed/computed.d.ts +1 -1
  50. package/dist/components/controls/ConsentField/consentfield.d.ts +2 -1
  51. package/dist/components/controls/CurrencyField/currencyfield.d.ts +1 -1
  52. package/dist/components/controls/DataTable/datatable.d.ts +2 -1
  53. package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +1 -1
  54. package/dist/components/controls/DateTime/datetime.d.ts +15 -1
  55. package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +6 -2
  56. package/dist/components/controls/Divider/divider.d.ts +1 -1
  57. package/dist/components/controls/EditableTable/editabletable.d.ts +1 -1
  58. package/dist/components/controls/FileUpload/fileupload.d.ts +1 -1
  59. package/dist/components/controls/FormRepeater/formrepeater.d.ts +1 -1
  60. package/dist/components/controls/FormWizard/formwizard.d.ts +1 -1
  61. package/dist/components/controls/GeoField/geofield.d.ts +1 -1
  62. package/dist/components/controls/Group/group.d.ts +2 -1
  63. package/dist/components/controls/Hyperlink/hyperlink.d.ts +1 -1
  64. package/dist/components/controls/ImageList/imagelist.d.ts +1 -1
  65. package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -1
  66. package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -1
  67. package/dist/components/controls/LineItemList/lineitemlist.d.ts +1 -1
  68. package/dist/components/controls/List/list.d.ts +1 -1
  69. package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
  70. package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +2 -1
  71. package/dist/components/controls/MatrixField/matrixfield.d.ts +2 -1
  72. package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
  73. package/dist/components/controls/NpsScale/npsscale.d.ts +2 -1
  74. package/dist/components/controls/NumberField/numberfield.d.ts +2 -1
  75. package/dist/components/controls/NumberStepper/numberstepper.d.ts +1 -1
  76. package/dist/components/controls/OtpField/otpfield.d.ts +2 -1
  77. package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -1
  78. package/dist/components/controls/PhoneField/phonefield.d.ts +1 -1
  79. package/dist/components/controls/Radio/radio.d.ts +2 -1
  80. package/dist/components/controls/Rating/rating.d.ts +2 -1
  81. package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +2 -1
  82. package/dist/components/controls/Select/select.d.ts +2 -1
  83. package/dist/components/controls/Signature/signature.d.ts +1 -1
  84. package/dist/components/controls/Slider/slider.d.ts +1 -1
  85. package/dist/components/controls/Stepper/stepper.d.ts +1 -1
  86. package/dist/components/controls/SummaryField/summaryfield.d.ts +2 -1
  87. package/dist/components/controls/Switch/switch.d.ts +1 -1
  88. package/dist/components/controls/Tabs/tabs.d.ts +2 -1
  89. package/dist/components/controls/TagsInput/tagsinput.d.ts +1 -1
  90. package/dist/components/controls/TextField/textfield.d.ts +1 -1
  91. package/dist/components/controls/TextField/useTextInput.d.ts +18 -0
  92. package/dist/components/controls/TimePicker/timepicker.d.ts +6 -2
  93. package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +1 -1
  94. package/dist/components/controls/Typography/typography.d.ts +1 -1
  95. package/dist/components/controls/index.d.ts +24 -9
  96. package/dist/consentfield-C0qlg4CV.js +1 -0
  97. package/dist/consentfield-D3eHFCZf.mjs +68 -0
  98. package/dist/datatable-CMjaTDPM.js +1 -0
  99. package/dist/datatable-lZIwHx6a.mjs +29 -0
  100. package/dist/dynamic-mui.cjs +1 -1
  101. package/dist/dynamic-mui.d.ts +1 -1
  102. package/dist/dynamic-mui.mjs +264 -204
  103. package/dist/editabletable-B3Cl38Qm.js +1 -0
  104. package/dist/editabletable-BEnZM9qt.mjs +117 -0
  105. package/dist/fileupload-BLH0wrc2.mjs +191 -0
  106. package/dist/fileupload-D0TsC9DF.js +1 -0
  107. package/dist/formrepeater-BEFYw5ly.js +1 -0
  108. package/dist/formrepeater-BvW1lZ2k.mjs +82 -0
  109. package/dist/formwizard-BWdnCsJz.js +1 -0
  110. package/dist/formwizard-I6M99opg.mjs +82 -0
  111. package/dist/geofield-CcbP9EtG.mjs +116 -0
  112. package/dist/geofield-HXXeV9Bm.js +1 -0
  113. package/dist/group-BCGjUNL2.mjs +30 -0
  114. package/dist/group-saCPFLuL.js +1 -0
  115. package/dist/imagelist-CNe1Dp_M.mjs +23 -0
  116. package/dist/imagelist-Wm5Qa6wA.js +1 -0
  117. package/dist/index.d.ts +1 -0
  118. package/dist/intlphone-Bj5nEUMa.mjs +341 -0
  119. package/dist/intlphone-D1V7m6MV.js +1 -0
  120. package/dist/keyvaluefield-ArJ4QM5z.js +1 -0
  121. package/dist/keyvaluefield-C-a0MGDM.mjs +128 -0
  122. package/dist/line-BGSi1tvf.js +1 -0
  123. package/dist/line-cK6taoCA.mjs +4 -0
  124. package/dist/lineitemlist-bmk7fEf9.mjs +169 -0
  125. package/dist/lineitemlist-mulPt3cO.js +1 -0
  126. package/dist/list-5wGZK7wa.js +1 -0
  127. package/dist/list-CIFEhaTq.mjs +20 -0
  128. package/dist/locationfield-DtWkxnX-.js +1 -0
  129. package/dist/locationfield-SPonkbMU.mjs +90 -0
  130. package/dist/markdowneditor-C0KQgAWY.js +2 -0
  131. package/dist/markdowneditor-C3l0_zuX.mjs +82 -0
  132. package/dist/matrixfield-BZ_3KcSk.js +1 -0
  133. package/dist/matrixfield-DQHet7LH.mjs +119 -0
  134. package/dist/mixChart-CSq7pQqJ.mjs +49 -0
  135. package/dist/mixChart-DoehYa8V.js +1 -0
  136. package/dist/muiX-BHOKpogF.mjs +12 -0
  137. package/dist/muiX-CG_D1XQ2.js +1 -0
  138. package/dist/multitextbox-Bsr8mHo5.mjs +96 -0
  139. package/dist/multitextbox-CkhPGI9i.js +1 -0
  140. package/dist/npsscale-BgU-fVZ4.mjs +111 -0
  141. package/dist/npsscale-CFtQ5Dkk.js +1 -0
  142. package/dist/numberstepper-B4ZS7GY_.js +1 -0
  143. package/dist/numberstepper-c0raw-fV.mjs +111 -0
  144. package/dist/pie-CueMspFX.js +1 -0
  145. package/dist/pie-DFO89j-z.mjs +4 -0
  146. package/dist/richtexteditor-B8NFysnM.js +1 -0
  147. package/dist/richtexteditor-aF2uky8O.mjs +178 -0
  148. package/dist/rolldown-runtime-5iZMYShA.js +1 -0
  149. package/dist/s3Upload-C3-wcrua.js +1 -0
  150. package/dist/s3Upload-HtE088XA.mjs +39 -0
  151. package/dist/signature-DjYfiNzq.js +3 -0
  152. package/dist/signature-HiL8FJ6C.mjs +1116 -0
  153. package/dist/stepper-BQB-Zpl2.js +1 -0
  154. package/dist/stepper-C8VaX9xu.mjs +166 -0
  155. package/dist/summaryfield-BN-NhzA6.mjs +65 -0
  156. package/dist/summaryfield-BqpfzvHe.js +1 -0
  157. package/dist/tabs-BBBpbfqk.js +1 -0
  158. package/dist/tabs-DvIbQ1qg.mjs +50 -0
  159. package/dist/tagsinput-CXmsu8K9.mjs +49 -0
  160. package/dist/tagsinput-CYoOBbY1.js +1 -0
  161. package/dist/useSyncedState-CzAO4D1o.mjs +17 -0
  162. package/dist/useSyncedState-DYNKkpDv.js +1 -0
  163. package/dist/useTextInput-Cm0_Ps2V.js +1 -0
  164. package/dist/useTextInput-Dr-ncTE8.mjs +1683 -0
  165. package/dist/useUpdateEffect-CNBo9hj8.js +1 -0
  166. package/dist/useUpdateEffect-CXAhttj7.mjs +14 -0
  167. package/dist/util/helper.d.ts +18 -1
  168. package/dist/util/muiVersion.d.ts +13 -0
  169. package/dist/util/stepperComponents.d.ts +1 -1
  170. package/dist/util/useSyncedState.d.ts +22 -0
  171. package/dist/util/validation.d.ts +40 -0
  172. package/dist/v4-Dyp-SQ1c.js +1 -0
  173. package/dist/v4-YCkfo8OR.mjs +27 -0
  174. package/dist/validation-B7DPZ218.js +7 -0
  175. package/dist/validation-BRcYhhsT.mjs +4991 -0
  176. package/package.json +35 -35
  177. package/dist/AIForm-D204ogdw.js +0 -44
  178. package/dist/AIForm-IafSvW2_.mjs +0 -12281
  179. package/dist/accordion-DA8VpkJ_.mjs +0 -23
  180. package/dist/accordion-yIxiSIl4.js +0 -1
  181. package/dist/addressfield-DCzPapIx.mjs +0 -164
  182. package/dist/addressfield-EFiWgeWB.js +0 -1
  183. package/dist/asyncautocomplete-5-8SXotM.mjs +0 -92
  184. package/dist/asyncautocomplete-BmHm-S4u.js +0 -1
  185. package/dist/bar-BvwjqB4v.mjs +0 -21
  186. package/dist/bar-DRjoPCtv.js +0 -1
  187. package/dist/cascadeselect-BEaoupK6.js +0 -1
  188. package/dist/cascadeselect-CzSf78Pg.mjs +0 -66
  189. package/dist/collection-CthMZ0Go.js +0 -1
  190. package/dist/collection-n9eBOioi.mjs +0 -1157
  191. package/dist/colorpicker-Bm9M38_c.mjs +0 -111
  192. package/dist/colorpicker-DHkdM8Q2.js +0 -1
  193. package/dist/consentfield-B2-UFm5n.mjs +0 -80
  194. package/dist/consentfield-DV8Gz0k9.js +0 -1
  195. package/dist/datatable-BVZFBd-8.mjs +0 -21
  196. package/dist/datatable-DnnyVWJm.js +0 -1
  197. package/dist/editabletable-B_JS4UZ9.js +0 -1
  198. package/dist/editabletable-BwvIvAt7.mjs +0 -128
  199. package/dist/fileupload-BHT7K0YT.mjs +0 -185
  200. package/dist/fileupload-CugVG3o3.js +0 -1
  201. package/dist/formrepeater-CaJMPo3Q.mjs +0 -75
  202. package/dist/formrepeater-DiKPaOfi.js +0 -1
  203. package/dist/formwizard-BzvdbvBY.js +0 -1
  204. package/dist/formwizard-C9fOIHQv.mjs +0 -83
  205. package/dist/geofield-BM4b5Zwx.js +0 -1
  206. package/dist/geofield-DYXx9K9o.mjs +0 -108
  207. package/dist/group-D5fMqJTx.mjs +0 -23
  208. package/dist/group-mwS8FSGJ.js +0 -1
  209. package/dist/imagelist-Bn9QhIv7.js +0 -1
  210. package/dist/imagelist-rqmJajHt.mjs +0 -18
  211. package/dist/intlphone-BQYytFWy.js +0 -1
  212. package/dist/intlphone-DHDwdBbm.mjs +0 -144
  213. package/dist/keyvaluefield-DM0eSfPF.mjs +0 -127
  214. package/dist/keyvaluefield-DXyuqDba.js +0 -1
  215. package/dist/line-Dst2QjuI.mjs +0 -21
  216. package/dist/line-hM3OgPH7.js +0 -1
  217. package/dist/lineitemlist-89hrdS0p.mjs +0 -170
  218. package/dist/lineitemlist-DfEjbNCH.js +0 -1
  219. package/dist/list-B8S2MrOx.js +0 -1
  220. package/dist/list-C97cCc78.mjs +0 -20
  221. package/dist/locationfield-BEMe22_x.mjs +0 -118
  222. package/dist/locationfield-DlgLvvdU.js +0 -1
  223. package/dist/markdowneditor-JoiWE-qO.js +0 -2
  224. package/dist/markdowneditor-K4TAKJ3s.mjs +0 -94
  225. package/dist/matrixfield-D4sHu6rU.mjs +0 -121
  226. package/dist/matrixfield-szah6uOP.js +0 -1
  227. package/dist/mixChart-Doq4lt7Z.mjs +0 -75
  228. package/dist/mixChart-rgyMCdnp.js +0 -1
  229. package/dist/multitextbox-CBChuyw9.js +0 -1
  230. package/dist/multitextbox-Cnrwie5U.mjs +0 -78
  231. package/dist/npsscale-Cc2eD9Nk.js +0 -1
  232. package/dist/npsscale-DgQPa1eH.mjs +0 -91
  233. package/dist/numberstepper-BcuSZHwZ.js +0 -1
  234. package/dist/numberstepper-BqINnIm7.mjs +0 -132
  235. package/dist/pie-B6dXjc4o.mjs +0 -21
  236. package/dist/pie-a_dhmBUq.js +0 -1
  237. package/dist/richtexteditor-Bs5-VQj3.js +0 -1
  238. package/dist/richtexteditor-CveBdsmJ.mjs +0 -143
  239. package/dist/s3Upload-B0JeoLkS.js +0 -1
  240. package/dist/s3Upload-dpioZ2c8.mjs +0 -51
  241. package/dist/signature-BRWAWqeA.mjs +0 -1227
  242. package/dist/signature-Bj9GDrvy.js +0 -2
  243. package/dist/stepper-B9sSsbQD.js +0 -1
  244. package/dist/stepper-DTMAP67o.mjs +0 -140
  245. package/dist/summaryfield-JKL3ZLl2.js +0 -1
  246. package/dist/summaryfield-xhr0Q4RL.mjs +0 -96
  247. package/dist/tabs-ClkmKlV8.mjs +0 -39
  248. package/dist/tabs-DmEP_QW0.js +0 -1
  249. package/dist/tagsinput-B0yVrYgB.mjs +0 -58
  250. package/dist/tagsinput-COKkxIxg.js +0 -1
  251. package/dist/v4-BysszJq8.mjs +0 -30
  252. package/dist/v4-CqdK_b8Y.js +0 -1
@@ -1,111 +0,0 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import $ from "react";
3
- import c from "@mui/material/Box";
4
- import u from "@mui/material/Stack";
5
- import A from "@mui/material/TextField";
6
- import I from "@mui/material/FormControl";
7
- import F from "@mui/material/FormLabel";
8
- import { alpha as l } from "@mui/material/styles";
9
- import { j as R, m as x, k as j } from "./AIForm-IafSvW2_.mjs";
10
- const h = "#000000";
11
- function q({ attributes: t = {}, rules: f = {}, onChange: b }) {
12
- const { id: p = "", label: r, presets: n = [], MuiAttributes: g = {} } = t, { sx: w, ...v } = g, [a, d] = $.useState(
13
- t.value || h
14
- );
15
- R(() => {
16
- d(t.value || h);
17
- }, [t.value]);
18
- const y = f?.validation?.some(
19
- (o) => o.rule === "mandatory" || o.rule === "mandatoryselect"
20
- ) || !1, s = (o) => {
21
- d(o), b?.({ id: p, value: o });
22
- }, k = (o) => {
23
- s(o.target.value);
24
- }, C = (o) => {
25
- s(o.target.value);
26
- }, S = (o) => {
27
- s(o);
28
- };
29
- return /* @__PURE__ */ m(I, { required: y, component: "fieldset", fullWidth: !0, children: [
30
- r && /* @__PURE__ */ e(F, { component: "legend", children: r }),
31
- /* @__PURE__ */ m(
32
- u,
33
- {
34
- direction: "row",
35
- spacing: 1.5,
36
- sx: {
37
- alignItems: "center",
38
- mt: r ? 1 : 0
39
- },
40
- children: [
41
- /* @__PURE__ */ e(c, { sx: { ...{
42
- width: 44,
43
- height: 44,
44
- borderRadius: "10px",
45
- border: (o) => `1px solid ${l(o.palette.text.primary, 0.2)}`,
46
- boxShadow: (o) => `0 2px 8px ${l(o.palette.common.black, 0.12)}`,
47
- cursor: "pointer",
48
- flexShrink: 0,
49
- position: "relative",
50
- overflow: "hidden"
51
- }, backgroundColor: a }, children: /* @__PURE__ */ e(
52
- "input",
53
- {
54
- type: "color",
55
- "aria-label": r ? `${r} colour` : "colour",
56
- value: a,
57
- onChange: k,
58
- ...v,
59
- style: {
60
- position: "absolute",
61
- inset: 0,
62
- width: "100%",
63
- height: "100%",
64
- opacity: 0,
65
- border: "none",
66
- padding: 0,
67
- cursor: "pointer"
68
- }
69
- }
70
- ) }),
71
- /* @__PURE__ */ e(
72
- A,
73
- {
74
- id: p || void 0,
75
- value: a,
76
- onChange: C,
77
- size: "small",
78
- label: "Hex",
79
- sx: x(j, x({ maxWidth: 160 }, w)),
80
- slotProps: {
81
- htmlInput: { "aria-label": "hex value" }
82
- }
83
- }
84
- )
85
- ]
86
- }
87
- ),
88
- Array.isArray(n) && n.length > 0 && /* @__PURE__ */ e(u, { direction: "row", spacing: 1, sx: { mt: 1.5, flexWrap: "wrap", rowGap: 1 }, children: n.map((o) => /* @__PURE__ */ e(
89
- c,
90
- {
91
- role: "button",
92
- "aria-label": `preset ${o}`,
93
- onClick: () => S(o),
94
- sx: {
95
- width: 26,
96
- height: 26,
97
- borderRadius: "8px",
98
- backgroundColor: o,
99
- cursor: "pointer",
100
- flexShrink: 0,
101
- border: (i) => a === o ? `2px solid ${i.palette.primary.main}` : `1px solid ${l(i.palette.text.primary, 0.2)}`,
102
- boxShadow: (i) => `0 1px 4px ${l(i.palette.common.black, 0.12)}`
103
- }
104
- },
105
- o
106
- )) })
107
- ] });
108
- }
109
- export {
110
- q as default
111
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("react"),p=require("@mui/material/Box"),x=require("@mui/material/Stack"),C=require("@mui/material/TextField"),$=require("@mui/material/FormControl"),A=require("@mui/material/FormLabel"),i=require("@mui/material/styles"),n=require("./AIForm-D204ogdw.js"),h="#000000";function I({attributes:t={},rules:m={},onChange:b}){const{id:u="",label:o,presets:s=[],MuiAttributes:g={}}=t,{sx:y,...f}=g,[a,d]=k.useState(t.value||h);n.useUpdateEffect(()=>{d(t.value||h)},[t.value]);const v=m?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,c=e=>{d(e),b?.({id:u,value:e})},S=e=>{c(e.target.value)},w=e=>{c(e.target.value)},j=e=>{c(e)},q={width:44,height:44,borderRadius:"10px",border:e=>`1px solid ${i.alpha(e.palette.text.primary,.2)}`,boxShadow:e=>`0 2px 8px ${i.alpha(e.palette.common.black,.12)}`,cursor:"pointer",flexShrink:0,position:"relative",overflow:"hidden"};return r.jsxs($,{required:v,component:"fieldset",fullWidth:!0,children:[o&&r.jsx(A,{component:"legend",children:o}),r.jsxs(x,{direction:"row",spacing:1.5,sx:{alignItems:"center",mt:o?1:0},children:[r.jsx(p,{sx:{...q,backgroundColor:a},children:r.jsx("input",{type:"color","aria-label":o?`${o} colour`:"colour",value:a,onChange:S,...f,style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0,border:"none",padding:0,cursor:"pointer"}})}),r.jsx(C,{id:u||void 0,value:a,onChange:w,size:"small",label:"Hex",sx:n.mergeSx(n.premiumInputSx,n.mergeSx({maxWidth:160},y)),slotProps:{htmlInput:{"aria-label":"hex value"}}})]}),Array.isArray(s)&&s.length>0&&r.jsx(x,{direction:"row",spacing:1,sx:{mt:1.5,flexWrap:"wrap",rowGap:1},children:s.map(e=>r.jsx(p,{role:"button","aria-label":`preset ${e}`,onClick:()=>j(e),sx:{width:26,height:26,borderRadius:"8px",backgroundColor:e,cursor:"pointer",flexShrink:0,border:l=>a===e?`2px solid ${l.palette.primary.main}`:`1px solid ${i.alpha(l.palette.text.primary,.2)}`,boxShadow:l=>`0 1px 4px ${i.alpha(l.palette.common.black,.12)}`}},e))})]})}exports.default=I;
@@ -1,80 +0,0 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import s from "react";
3
- import M from "@mui/material/Box";
4
- import R from "@mui/material/Checkbox";
5
- import V from "@mui/material/FormControl";
6
- import A from "@mui/material/FormControlLabel";
7
- import B from "@mui/material/FormHelperText";
8
- import { alpha as I } from "@mui/material/styles";
9
- import { j as P, m as f, l as U, n as W } from "./AIForm-IafSvW2_.mjs";
10
- function Z({ attributes: l = {}, rules: n = {}, onChange: h }) {
11
- const {
12
- MuiAttributes: g = {},
13
- id: x = "",
14
- text: S = "",
15
- label: c = "I agree to the terms",
16
- requireScroll: i = !0
17
- } = l, [C, d] = s.useState(!!l.value), [b, v] = s.useState(!i), [k, T] = s.useState(!1), [m, y] = s.useState("");
18
- P(() => {
19
- d(!!l.value);
20
- }, [l.value]);
21
- const a = n?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, H = (e) => {
22
- let r = !0, t = "";
23
- return a && !e && (r = !1, t = n?.validation?.find(
24
- (u) => u.rule === "mandatory" || u.rule === "mandatoryselect"
25
- )?.message || "Required"), { isValid: r, message: t };
26
- }, q = (e) => {
27
- const r = e.currentTarget;
28
- r.scrollTop + r.clientHeight >= r.scrollHeight - 4 && v(!0);
29
- }, E = (e) => {
30
- const r = e.target.checked;
31
- d(r);
32
- const t = H(r);
33
- T(!t.isValid), y(t.message), h?.({ id: x, value: r });
34
- }, F = i && !b, { sx: L, ...j } = g, w = a ? /* @__PURE__ */ p("span", { children: [
35
- c,
36
- /* @__PURE__ */ o("span", { "aria-hidden": "true", style: { color: "#d32f2f", marginLeft: 2 }, children: "*" })
37
- ] }) : c;
38
- return /* @__PURE__ */ p(V, { required: a, error: k, component: "fieldset", fullWidth: !0, children: [
39
- /* @__PURE__ */ o(
40
- M,
41
- {
42
- "data-testid": "consent-terms",
43
- onScroll: q,
44
- sx: f(U, {
45
- maxHeight: 200,
46
- overflow: "auto",
47
- p: 2,
48
- mb: 1,
49
- whiteSpace: "pre-wrap",
50
- backgroundColor: (e) => I(e.palette.background.paper, 1)
51
- }),
52
- children: S
53
- }
54
- ),
55
- /* @__PURE__ */ o(
56
- A,
57
- {
58
- ...j,
59
- sx: f(W, L),
60
- label: w,
61
- control: /* @__PURE__ */ o(
62
- R,
63
- {
64
- checked: C,
65
- disabled: F,
66
- onChange: E,
67
- required: a,
68
- slotProps: {
69
- input: { "aria-label": "consent-agree" }
70
- }
71
- }
72
- )
73
- }
74
- ),
75
- m && /* @__PURE__ */ o(B, { children: m })
76
- ] });
77
- }
78
- export {
79
- Z as default
80
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),M=require("@mui/material/Box"),w=require("@mui/material/Checkbox"),R=require("@mui/material/FormControl"),A=require("@mui/material/FormControlLabel"),I=require("@mui/material/FormHelperText"),P=require("@mui/material/styles"),s=require("./AIForm-D204ogdw.js");function V({attributes:l={},rules:c={},onChange:x}){const{MuiAttributes:g={},id:p="",text:f="",label:i="I agree to the terms",requireScroll:u=!0}=l,[S,d]=a.useState(!!l.value),[q,b]=a.useState(!u),[C,j]=a.useState(!1),[m,v]=a.useState("");s.useUpdateEffect(()=>{d(!!l.value)},[l.value]);const n=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,y=e=>{let r=!0,o="";return n&&!e&&(r=!1,o=c?.validation?.find(h=>h.rule==="mandatory"||h.rule==="mandatoryselect")?.message||"Required"),{isValid:r,message:o}},T=e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-4&&b(!0)},k=e=>{const r=e.target.checked;d(r);const o=y(r);j(!o.isValid),v(o.message),x?.({id:p,value:r})},F=u&&!q,{sx:H,...E}=g,L=n?t.jsxs("span",{children:[i,t.jsx("span",{"aria-hidden":"true",style:{color:"#d32f2f",marginLeft:2},children:"*"})]}):i;return t.jsxs(R,{required:n,error:C,component:"fieldset",fullWidth:!0,children:[t.jsx(M,{"data-testid":"consent-terms",onScroll:T,sx:s.mergeSx(s.premiumSurfaceSx,{maxHeight:200,overflow:"auto",p:2,mb:1,whiteSpace:"pre-wrap",backgroundColor:e=>P.alpha(e.palette.background.paper,1)}),children:f}),t.jsx(A,{...E,sx:s.mergeSx(s.premiumControlLabelSx,H),label:L,control:t.jsx(w,{checked:S,disabled:F,onChange:k,required:n,slotProps:{input:{"aria-label":"consent-agree"}}})}),m&&t.jsx(I,{children:m})]})}exports.default=V;
@@ -1,21 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import e, { Suspense as n } from "react";
3
- import s from "@mui/material/Box";
4
- import c from "@mui/material/CircularProgress";
5
- import { i as l } from "./AIForm-IafSvW2_.mjs";
6
- const m = e.lazy(
7
- () => import("@mui/x-data-grid").then((r) => ({ default: r.DataGrid }))
8
- );
9
- function D({ attributes: r = {} }) {
10
- const { MuiAttributes: a = {}, container: i = {} } = r, o = l("DataGrid") || m;
11
- return /* @__PURE__ */ t("div", { ...i, children: /* @__PURE__ */ t(
12
- n,
13
- {
14
- fallback: /* @__PURE__ */ t(s, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(c, {}) }),
15
- children: /* @__PURE__ */ t(o, { rows: [], columns: [], ...a })
16
- }
17
- ) });
18
- }
19
- export {
20
- D as default
21
- };
@@ -1 +0,0 @@
1
- "use strict";var c=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var j=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!x.call(e,i)&&i!==r&&a(e,i,{get:()=>t[i],enumerable:!(n=u(t,i))||n.enumerable});return e};var f=(e,t,r)=>(r=e!=null?c(d(e)):{},j(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),y=require("@mui/material/Box"),b=require("@mui/material/CircularProgress"),m=require("./AIForm-D204ogdw.js"),p=o.lazy(()=>import("@mui/x-data-grid").then(e=>({default:e.DataGrid})));function q({attributes:e={}}){const{MuiAttributes:t={},container:r={}}=e,n=m.getMuiX("DataGrid")||p;return s.jsx("div",{...r,children:s.jsx(o.Suspense,{fallback:s.jsx(y,{sx:{display:"flex",justifyContent:"center",p:2},children:s.jsx(b,{})}),children:s.jsx(n,{rows:[],columns:[],...t})})})}exports.default=q;
@@ -1 +0,0 @@
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-D204ogdw.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,128 +0,0 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import z from "react";
3
- import I from "@mui/material/Table";
4
- import S from "@mui/material/TableBody";
5
- import s from "@mui/material/TableCell";
6
- import W from "@mui/material/TableContainer";
7
- import j from "@mui/material/TableHead";
8
- import b from "@mui/material/TableRow";
9
- import B from "@mui/material/TextField";
10
- import F from "@mui/material/IconButton";
11
- import $ from "@mui/material/Button";
12
- import E from "@mui/material/FormControl";
13
- import L from "@mui/material/FormLabel";
14
- import M from "@mui/material/Paper";
15
- import P from "@mui/icons-material/Add";
16
- import H from "@mui/icons-material/Close";
17
- import { j as U, m as _, k as q } from "./AIForm-IafSvW2_.mjs";
18
- function x(n) {
19
- return Array.isArray(n) ? n.map((d) => ({ ...d || {} })) : [];
20
- }
21
- function ar({ attributes: n = {}, onChange: d }) {
22
- const {
23
- MuiAttributes: g = {},
24
- id: v = "",
25
- columns: p = [],
26
- addLabel: y = "Add row",
27
- label: u
28
- } = n, { sx: C, ...k } = g, f = Array.isArray(p) ? p : [], [a, i] = z.useState(() => x(n.value));
29
- U(() => {
30
- i(x(n.value));
31
- }, [n.value]);
32
- const c = (r) => {
33
- d?.({ id: v, value: r });
34
- }, w = (r, o, t) => {
35
- const l = a.map((h, T) => T === r ? { ...h, [o]: t } : h);
36
- i(l), c(l);
37
- }, A = () => {
38
- const r = [...a, {}];
39
- i(r), c(r);
40
- }, R = (r) => {
41
- const o = a.filter((t, l) => l !== r);
42
- i(o), c(o);
43
- };
44
- return /* @__PURE__ */ m(E, { component: "fieldset", fullWidth: !0, children: [
45
- u && /* @__PURE__ */ e(L, { component: "legend", sx: { mb: 1 }, children: u }),
46
- /* @__PURE__ */ e(
47
- W,
48
- {
49
- component: M,
50
- variant: "outlined",
51
- sx: {
52
- borderRadius: 2,
53
- overflow: "hidden"
54
- },
55
- children: /* @__PURE__ */ m(I, { size: "small", children: [
56
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ m(b, { sx: { backgroundColor: "action.hover" }, children: [
57
- f.map((r) => /* @__PURE__ */ e(s, { sx: { fontWeight: 600 }, children: r.label }, r.key)),
58
- /* @__PURE__ */ e(s, { align: "right", sx: { width: 48 } })
59
- ] }) }),
60
- /* @__PURE__ */ e(S, { children: a.map((r, o) => /* @__PURE__ */ m(
61
- b,
62
- {
63
- sx: {
64
- transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)",
65
- "&:hover": { backgroundColor: "action.hover" }
66
- },
67
- children: [
68
- f.map((t) => /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
69
- B,
70
- {
71
- ...k,
72
- type: t.type === "number" ? "number" : "text",
73
- value: r[t.key] ?? "",
74
- onChange: (l) => w(o, t.key, l.target.value),
75
- size: "small",
76
- variant: "standard",
77
- fullWidth: !0,
78
- sx: _(q, C),
79
- slotProps: {
80
- htmlInput: {
81
- "aria-label": `${t.label} row ${o + 1}`
82
- }
83
- }
84
- }
85
- ) }, t.key)),
86
- /* @__PURE__ */ e(s, { align: "right", children: /* @__PURE__ */ e(
87
- F,
88
- {
89
- "aria-label": `Remove row ${o + 1}`,
90
- onClick: () => R(o),
91
- size: "small",
92
- sx: {
93
- borderRadius: 2,
94
- color: "text.secondary",
95
- "&:hover": { color: "error.main" }
96
- },
97
- children: /* @__PURE__ */ e(H, { fontSize: "small" })
98
- }
99
- ) })
100
- ]
101
- },
102
- o
103
- )) })
104
- ] })
105
- }
106
- ),
107
- /* @__PURE__ */ e(
108
- $,
109
- {
110
- onClick: A,
111
- startIcon: /* @__PURE__ */ e(P, {}),
112
- size: "small",
113
- variant: "text",
114
- sx: {
115
- alignSelf: "flex-start",
116
- mt: 1,
117
- borderRadius: 2,
118
- textTransform: "none",
119
- fontWeight: 600
120
- },
121
- children: y
122
- }
123
- )
124
- ] });
125
- }
126
- export {
127
- ar as default
128
- };
@@ -1,185 +0,0 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { useRef as _, useState as m } from "react";
3
- import s from "@mui/material/Box";
4
- import c from "@mui/material/Typography";
5
- import q from "@mui/material/IconButton";
6
- import H from "@mui/material/CircularProgress";
7
- import J from "@mui/icons-material/CloudUpload";
8
- import K from "@mui/icons-material/Close";
9
- import N from "@mui/icons-material/InsertDriveFile";
10
- import { j as Q, m as V, l as W } from "./AIForm-IafSvW2_.mjs";
11
- import { u as X } from "./s3Upload-dpioZ2c8.mjs";
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
- const a = new FileReader();
14
- a.onload = () => u(a.result || ""), a.onerror = () => g(a.error), a.readAsDataURL(r);
15
- });
16
- function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
17
- const {
18
- id: a = "",
19
- multiple: p = !1,
20
- accept: h = "",
21
- bucket: z = "",
22
- region: B = "",
23
- identityPoolId: F = "",
24
- path: $ = "",
25
- maxSizeMB: x = 0,
26
- label: w = "Upload file",
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
- Q(() => {
30
- v(R(r.value));
31
- }, [r.value]);
32
- const C = (e, o) => {
33
- g?.({ id: a, value: p ? e : e[0] ?? "", option: o });
34
- }, I = async (e) => {
35
- const o = Array.from(e);
36
- if (!o.length) return;
37
- b(""), U(!0);
38
- const i = [], f = [];
39
- try {
40
- for (const n of o) {
41
- if (x && n.size > x * 1024 * 1024) {
42
- b(`"${n.name}" exceeds the ${x}MB limit.`);
43
- continue;
44
- }
45
- const O = await Z(n), G = await X(O, n.name, z, B, F, $);
46
- i.push(G), f.push(n);
47
- }
48
- } catch (n) {
49
- console.error("FileUpload failed", n), b("Upload failed. Please try again.");
50
- } finally {
51
- U(!1);
52
- }
53
- if (!i.length) return;
54
- const A = p ? [...d, ...i] : i.slice(0, 1);
55
- v(A), C(A, f);
56
- }, M = (e) => {
57
- e.target.files && I(e.target.files), e.target.value = "";
58
- }, T = (e) => {
59
- e.preventDefault(), y(!1), e.dataTransfer?.files?.length && I(e.dataTransfer.files);
60
- }, E = (e) => {
61
- const o = d.filter((i, f) => f !== e);
62
- v(o), C(o);
63
- };
64
- return /* @__PURE__ */ l(s, { sx: { width: "100%", ...j.sx }, children: [
65
- /* @__PURE__ */ l(c, { variant: "subtitle2", gutterBottom: !0, sx: { display: "flex" }, children: [
66
- w,
67
- L && /* @__PURE__ */ t(s, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
68
- ] }),
69
- /* @__PURE__ */ t(
70
- "input",
71
- {
72
- ref: D,
73
- type: "file",
74
- hidden: !0,
75
- multiple: p,
76
- accept: h || void 0,
77
- onChange: M
78
- }
79
- ),
80
- /* @__PURE__ */ l(
81
- s,
82
- {
83
- role: "button",
84
- "aria-label": w,
85
- onClick: () => D.current?.click(),
86
- onDragOver: (e) => {
87
- e.preventDefault(), y(!0);
88
- },
89
- onDragLeave: () => y(!1),
90
- onDrop: T,
91
- sx: {
92
- border: "2px dashed",
93
- borderColor: S ? "primary.main" : "divider",
94
- borderRadius: "12px",
95
- p: 3,
96
- textAlign: "center",
97
- cursor: "pointer",
98
- transition: "all .2s",
99
- bgcolor: S ? "action.hover" : "background.paper",
100
- "&:hover": { borderColor: "primary.main", bgcolor: "action.hover" }
101
- },
102
- children: [
103
- P ? /* @__PURE__ */ t(H, { size: 28 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 40, color: "primary.main" } }),
104
- /* @__PURE__ */ l(c, { variant: "body2", sx: { mt: 1 }, children: [
105
- "Drag & drop ",
106
- p ? "files" : "a file",
107
- " here, or click to browse"
108
- ] }),
109
- h && /* @__PURE__ */ l(c, { variant: "caption", sx: {
110
- color: "text.secondary"
111
- }, children: [
112
- "Accepted: ",
113
- h
114
- ] })
115
- ]
116
- }
117
- ),
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
- ),
130
- d.length > 0 && /* @__PURE__ */ t(s, { sx: V(W, { mt: 1.5, p: 1 }), children: d.map((e, o) => /* @__PURE__ */ l(
131
- s,
132
- {
133
- sx: {
134
- display: "flex",
135
- alignItems: "center",
136
- gap: 1.5,
137
- p: 1,
138
- borderRadius: "8px",
139
- transition: "background-color .18s",
140
- "&:hover": { bgcolor: "action.hover" }
141
- },
142
- children: [
143
- Y(e) ? /* @__PURE__ */ t(
144
- s,
145
- {
146
- component: "img",
147
- src: e,
148
- alt: `upload-${o}`,
149
- sx: {
150
- width: 40,
151
- height: 40,
152
- objectFit: "cover",
153
- borderRadius: "8px",
154
- flexShrink: 0
155
- }
156
- }
157
- ) : /* @__PURE__ */ t(N, { color: "action", sx: { flexShrink: 0 } }),
158
- /* @__PURE__ */ t(
159
- c,
160
- {
161
- variant: "body2",
162
- sx: { flexGrow: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
163
- children: e.split("/").pop()?.split("?")[0] || e
164
- }
165
- ),
166
- /* @__PURE__ */ t(
167
- q,
168
- {
169
- size: "small",
170
- "aria-label": "remove",
171
- onClick: (i) => {
172
- i.stopPropagation(), E(o);
173
- },
174
- children: /* @__PURE__ */ t(K, { fontSize: "small" })
175
- }
176
- )
177
- ]
178
- },
179
- `${e}-${o}`
180
- )) })
181
- ] });
182
- }
183
- export {
184
- de as default
185
- };
@@ -1 +0,0 @@
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-D204ogdw.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;
@@ -1,75 +0,0 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import { useMemo as _, useState as $, useRef as G, useCallback as y } from "react";
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-IafSvW2_.mjs";
5
- import { v as W } from "./v4-BysszJq8.mjs";
6
- function H({ attributes: h = {}, rules: v = {}, onChange: o }) {
7
- const {
8
- id: s = "",
9
- label: g = "Group",
10
- min: n = 1,
11
- max: a,
12
- subFields: b = [],
13
- value: i
14
- } = h, F = v?.validation?.some((r) => r.rule === "mandatory") || !1, N = _(() => {
15
- if (Array.isArray(i) && i.length > 0) return i.length;
16
- const r = Number(h.count);
17
- return !isNaN(r) && r >= n ? r : n;
18
- }, []), [u, C] = $(N), l = G([]), c = y((r) => (l.current[r] || (l.current[r] = W()), l.current[r]), []), x = y((r) => {
19
- if (!o) return;
20
- const t = Array.from({ length: r }, (d, m) => {
21
- const p = `${s}-group-${c(m)}`;
22
- return M(p) ?? {};
23
- });
24
- o({ id: s, value: t });
25
- }, [s, c, o]), I = (r) => {
26
- let t = parseInt(r, 10);
27
- (isNaN(t) || t < n) && (t = n), a !== void 0 && t > a && (t = a), C(t), setTimeout(() => x(t), 0);
28
- };
29
- return /* @__PURE__ */ f(R, { sx: { width: "100%" }, children: [
30
- /* @__PURE__ */ e(
31
- S,
32
- {
33
- type: "number",
34
- size: "small",
35
- label: `Number of ${g}s`,
36
- value: u,
37
- onChange: (r) => I(r.target.value),
38
- required: F,
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
- }
46
- }
47
- ),
48
- Array.from({ length: u }, (r, t) => {
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: [
54
- g,
55
- " ",
56
- t + 1
57
- ] }) }),
58
- /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
59
- P,
60
- {
61
- guid: d,
62
- data: b,
63
- patch: m ?? {},
64
- onChange: (p) => {
65
- x(u), o && o(p);
66
- }
67
- }
68
- ) })
69
- ] }, d);
70
- })
71
- ] });
72
- }
73
- export {
74
- H as default
75
- };
@@ -1 +0,0 @@
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-D204ogdw.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 +0,0 @@
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-D204ogdw.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;