dynamic-mui 2.3.1 → 2.4.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 (111) hide show
  1. package/README.md +22 -0
  2. package/dist/{index-Bh6BLrzq.mjs → AIForm-DtRl0WdY.mjs} +4213 -4371
  3. package/dist/AIForm-Dv8ahXyE.js +43 -0
  4. package/dist/accordion-BaiGxDcw.js +1 -0
  5. package/dist/{accordion-DEd2a2Ps.mjs → accordion-xg_TxxYS.mjs} +1 -1
  6. package/dist/{addressfield-FjNJCCuC.mjs → addressfield-BvQEHdEk.mjs} +1 -1
  7. package/dist/addressfield-vVizrbZP.js +1 -0
  8. package/dist/ai/index.cjs +1 -0
  9. package/dist/ai/index.mjs +14 -0
  10. package/dist/{asyncautocomplete-B8qI_lz9.mjs → asyncautocomplete-AmSRs7PY.mjs} +19 -19
  11. package/dist/asyncautocomplete-Dtmxh4l1.js +1 -0
  12. package/dist/bar-BiIzbOC3.js +1 -0
  13. package/dist/bar-DNc7TMKj.mjs +21 -0
  14. package/dist/{cascadeselect-D8sVXV1g.mjs → cascadeselect-BlznIKS6.mjs} +16 -16
  15. package/dist/cascadeselect-DqLtG-W9.js +1 -0
  16. package/dist/colorpicker-DpLvK1WR.js +1 -0
  17. package/dist/{colorpicker-DcyceL6g.mjs → colorpicker-hP3b7teC.mjs} +2 -2
  18. package/dist/consentfield-B21l9tGo.js +1 -0
  19. package/dist/{consentfield-B_qBOIuX.mjs → consentfield-CGT98YbR.mjs} +8 -8
  20. package/dist/datatable-B_6wXh2g.mjs +21 -0
  21. package/dist/datatable-Bv0Q37Zy.js +1 -0
  22. package/dist/dynamic-mui.cjs +1 -1
  23. package/dist/dynamic-mui.d.ts +2 -0
  24. package/dist/dynamic-mui.mjs +207 -30
  25. package/dist/editabletable-D3c3DJxX.js +1 -0
  26. package/dist/{editabletable-D6_U9op8.mjs → editabletable-YaFqdLvf.mjs} +13 -13
  27. package/dist/fileupload--KzSGb5a.js +1 -0
  28. package/dist/{fileupload-CugTpR-B.mjs → fileupload-ZBi72f1R.mjs} +11 -11
  29. package/dist/formrepeater-BhUEa4BI.js +1 -0
  30. package/dist/{formrepeater-Cxawn2sQ.mjs → formrepeater-Cwgtvz1c.mjs} +8 -8
  31. package/dist/formwizard-BlozHDc_.js +1 -0
  32. package/dist/{formwizard-Cfd5IPkE.mjs → formwizard-CYcgf5jL.mjs} +1 -1
  33. package/dist/geofield-BynrTSVm.js +1 -0
  34. package/dist/{geofield-k2V0hglK.mjs → geofield-xqZy_DAY.mjs} +12 -12
  35. package/dist/{group-D40b3E1V.mjs → group-DmLN-b09.mjs} +1 -1
  36. package/dist/group-Dtju1rHQ.js +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/intlphone-BeHXAcFi.js +1 -0
  39. package/dist/{intlphone-BbTprmmA.mjs → intlphone-CXUQP9Gp.mjs} +5 -5
  40. package/dist/{keyvaluefield-zD6Kf4D0.mjs → keyvaluefield-BJoEbe4I.mjs} +13 -13
  41. package/dist/keyvaluefield-BZQDG0l5.js +1 -0
  42. package/dist/line-B3CAbZOo.mjs +21 -0
  43. package/dist/line-tIm99vYW.js +1 -0
  44. package/dist/{lineitemlist-BZbAId8H.mjs → lineitemlist-CBSqoC9g.mjs} +7 -7
  45. package/dist/lineitemlist-RqStjYB-.js +1 -0
  46. package/dist/{list-BhTzYFrR.mjs → list-C8QMpJOJ.mjs} +2 -2
  47. package/dist/list-D_cawpPI.js +1 -0
  48. package/dist/locationfield-BiLy-c09.js +1 -0
  49. package/dist/{locationfield-BZpGC10B.mjs → locationfield-KBbu-98L.mjs} +19 -19
  50. package/dist/{markdowneditor-B5F4okCW.mjs → markdowneditor-DFOgRmdL.mjs} +1 -1
  51. package/dist/markdowneditor-Dy7Q01FM.js +2 -0
  52. package/dist/{matrixfield-CUo7zFWC.mjs → matrixfield-0lnuaEks.mjs} +7 -7
  53. package/dist/matrixfield-nWt6Cug5.js +1 -0
  54. package/dist/{multitextbox-CsNOrHZP.mjs → multitextbox-DmAWV163.mjs} +23 -23
  55. package/dist/multitextbox-oEgl2F8-.js +1 -0
  56. package/dist/{npsscale-Cb8NxADb.mjs → npsscale-CdTEwERY.mjs} +12 -12
  57. package/dist/npsscale-DW4sxcLz.js +1 -0
  58. package/dist/{numberstepper-DLk_r1HM.mjs → numberstepper-BwQ5coLc.mjs} +8 -8
  59. package/dist/numberstepper-cDosevJb.js +1 -0
  60. package/dist/pie-CBRckgd4.mjs +21 -0
  61. package/dist/pie-gAfuDR1F.js +1 -0
  62. package/dist/richtexteditor-DI-h5Efn.js +1 -0
  63. package/dist/{richtexteditor-pQIK2f-6.mjs → richtexteditor-xrbv8PXZ.mjs} +1 -1
  64. package/dist/{signature-CFv0jhVN.mjs → signature-CP_lA_Yh.mjs} +1 -1
  65. package/dist/{signature-G-XCOszC.js → signature-FM6L60nk.js} +2 -2
  66. package/dist/{stepper-U0kv127E.mjs → stepper-BprezTzX.mjs} +4 -4
  67. package/dist/stepper-CjGNFyBz.js +1 -0
  68. package/dist/{summaryfield-QcpYr9Xt.mjs → summaryfield-5mJRwVZ4.mjs} +5 -5
  69. package/dist/summaryfield-C3xmqZQp.js +1 -0
  70. package/dist/tabs-B4P59kHX.js +1 -0
  71. package/dist/{tabs-DCLyTKVm.mjs → tabs-By-Mm8vm.mjs} +1 -1
  72. package/dist/tagsinput-BwM3NYK_.js +1 -0
  73. package/dist/{tagsinput-D1VP8Bjq.mjs → tagsinput-Ce4EWy4i.mjs} +10 -10
  74. package/dist/util/muiX.d.ts +45 -0
  75. package/package.json +6 -1
  76. package/dist/accordion-Bf0VwGuE.js +0 -1
  77. package/dist/addressfield-Dfd9ilpe.js +0 -1
  78. package/dist/asyncautocomplete-9O6nwGP_.js +0 -1
  79. package/dist/bar-BzO7tvYJ.mjs +0 -20
  80. package/dist/bar-DEVxyUVS.js +0 -1
  81. package/dist/cascadeselect-DeoPn4_V.js +0 -1
  82. package/dist/colorpicker-BcnqB34i.js +0 -1
  83. package/dist/consentfield-CR69IP1l.js +0 -1
  84. package/dist/datatable-BIQznwQe.mjs +0 -20
  85. package/dist/datatable-BWlcUP0M.js +0 -1
  86. package/dist/editabletable-BdywdA42.js +0 -1
  87. package/dist/fileupload-YzpAUgok.js +0 -1
  88. package/dist/formrepeater-B_2UOIBm.js +0 -1
  89. package/dist/formwizard-CCBY6s19.js +0 -1
  90. package/dist/geofield-CJm8hivf.js +0 -1
  91. package/dist/group-IFZTzo-g.js +0 -1
  92. package/dist/index-eJceCjKS.js +0 -43
  93. package/dist/intlphone-CmiRFHv-.js +0 -1
  94. package/dist/keyvaluefield-CoOmou7m.js +0 -1
  95. package/dist/line-B-DwR1hm.mjs +0 -20
  96. package/dist/line-BkymZu31.js +0 -1
  97. package/dist/lineitemlist-BRsW0O7Z.js +0 -1
  98. package/dist/list-DWf2NWix.js +0 -1
  99. package/dist/locationfield-DC_2IN-B.js +0 -1
  100. package/dist/markdowneditor-Coi3sksx.js +0 -2
  101. package/dist/matrixfield-DAjfXU96.js +0 -1
  102. package/dist/multitextbox-Cq7vt1-g.js +0 -1
  103. package/dist/npsscale-BWpMrK_O.js +0 -1
  104. package/dist/numberstepper-BqQeBbR9.js +0 -1
  105. package/dist/pie-CJSL8Sv5.js +0 -1
  106. package/dist/pie-CL29dlh5.mjs +0 -20
  107. package/dist/richtexteditor-BUrvVR_T.js +0 -1
  108. package/dist/stepper-Bc9NlbU7.js +0 -1
  109. package/dist/summaryfield-B_bePxLk.js +0 -1
  110. package/dist/tabs-Cs9eNEbR.js +0 -1
  111. package/dist/tagsinput-DlopThdw.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { jsxs as g, jsx as a } from "react/jsx-runtime";
2
2
  import W from "react";
3
- import v from "@mui/material/Stack";
4
- import k from "@mui/material/TextField";
3
+ import k from "@mui/material/Stack";
4
+ import v from "@mui/material/TextField";
5
5
  import E from "@mui/material/IconButton";
6
6
  import L from "@mui/material/Button";
7
7
  import T from "@mui/material/FormControl";
@@ -9,7 +9,7 @@ import q from "@mui/material/FormLabel";
9
9
  import w from "@mui/material/FormHelperText";
10
10
  import B from "@mui/icons-material/Add";
11
11
  import K from "@mui/icons-material/Close";
12
- import { u as V, m as b, a as A } from "./index-Bh6BLrzq.mjs";
12
+ import { j as V, m as b, k as A } from "./AIForm-DtRl0WdY.mjs";
13
13
  function C(t) {
14
14
  return Array.isArray(t) ? t.map((r) => ({
15
15
  key: r?.key ?? "",
@@ -27,7 +27,7 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
27
27
  MuiAttributes: S = {},
28
28
  id: I = "",
29
29
  keyLabel: R = "Key",
30
- valueLabel: z = "Value",
30
+ valueLabel: j = "Value",
31
31
  label: u
32
32
  } = t, { sx: d, ...f } = S, [i, s] = W.useState(() => C(t.value)), p = r?.validation?.some(
33
33
  (e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
@@ -40,24 +40,24 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
40
40
  }, y = (e, o, l) => {
41
41
  const m = i.map((x, M) => M === e ? { ...x, [o]: l } : x);
42
42
  s(m), c(m);
43
- }, F = () => {
43
+ }, z = () => {
44
44
  const e = [...i, { key: "", value: "" }];
45
45
  s(e), c(e);
46
- }, j = (e) => {
46
+ }, F = (e) => {
47
47
  const o = i.filter((l, m) => m !== e);
48
48
  s(o), c(o);
49
49
  }, h = p && i.filter((e) => e.key !== "").length === 0;
50
50
  return /* @__PURE__ */ g(T, { component: "fieldset", error: h, fullWidth: !0, children: [
51
51
  u && /* @__PURE__ */ a(q, { component: "legend", required: p, sx: { mb: 1 }, children: u }),
52
- /* @__PURE__ */ a(v, { spacing: 1.25, children: i.map((e, o) => /* @__PURE__ */ g(
53
- v,
52
+ /* @__PURE__ */ a(k, { spacing: 1.25, children: i.map((e, o) => /* @__PURE__ */ g(
53
+ k,
54
54
  {
55
55
  direction: "row",
56
56
  spacing: 1,
57
57
  alignItems: "center",
58
58
  children: [
59
59
  /* @__PURE__ */ a(
60
- k,
60
+ v,
61
61
  {
62
62
  ...f,
63
63
  label: R,
@@ -69,10 +69,10 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
69
69
  }
70
70
  ),
71
71
  /* @__PURE__ */ a(
72
- k,
72
+ v,
73
73
  {
74
74
  ...f,
75
- label: z,
75
+ label: j,
76
76
  value: e.value,
77
77
  onChange: (l) => y(o, "value", l.target.value),
78
78
  size: "small",
@@ -84,7 +84,7 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
84
84
  E,
85
85
  {
86
86
  "aria-label": `Remove ${e.key || "row"}`,
87
- onClick: () => j(o),
87
+ onClick: () => F(o),
88
88
  size: "small",
89
89
  sx: {
90
90
  borderRadius: 2,
@@ -101,7 +101,7 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
101
101
  /* @__PURE__ */ a(
102
102
  L,
103
103
  {
104
- onClick: F,
104
+ onClick: z,
105
105
  startIcon: /* @__PURE__ */ a(B, {}),
106
106
  size: "small",
107
107
  variant: "text",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),F=require("react"),v=require("@mui/material/Stack"),j=require("@mui/material/TextField"),z=require("@mui/material/IconButton"),M=require("@mui/material/Button"),T=require("@mui/material/FormControl"),W=require("@mui/material/FormLabel"),E=require("@mui/material/FormHelperText"),L=require("@mui/icons-material/Add"),w=require("@mui/icons-material/Close"),i=require("./AIForm-Dv8ahXyE.js");function k(t){return Array.isArray(t)?t.map(r=>({key:r?.key??"",value:r?.value??""})):t&&typeof t=="object"?Object.keys(t).map(r=>({key:r,value:String(t[r]??"")})):[]}function B(t){const r={};return t.forEach(l=>{l.key!==""&&(r[l.key]=l.value)}),r}function K({attributes:t={},rules:r={},onChange:l}){const{MuiAttributes:q={},id:b="",keyLabel:S="Key",valueLabel:A="Value",label:m}=t,{sx:x,...y}=q,[a,u]=F.useState(()=>k(t.value)),f=r?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;i.useUpdateEffect(()=>{u(k(t.value))},[t.value]);const d=e=>{l?.({id:b,value:B(e),option:e})},h=(e,o,s)=>{const c=a.map((g,R)=>R===e?{...g,[o]:s}:g);u(c),d(c)},C=()=>{const e=[...a,{key:"",value:""}];u(e),d(e)},I=e=>{const o=a.filter((s,c)=>c!==e);u(o),d(o)},p=f&&a.filter(e=>e.key!=="").length===0;return n.jsxs(T,{component:"fieldset",error:p,fullWidth:!0,children:[m&&n.jsx(W,{component:"legend",required:f,sx:{mb:1},children:m}),n.jsx(v,{spacing:1.25,children:a.map((e,o)=>n.jsxs(v,{direction:"row",spacing:1,alignItems:"center",children:[n.jsx(j,{...y,label:S,value:e.key,onChange:s=>h(o,"key",s.target.value),size:"small",fullWidth:!0,sx:i.mergeSx(i.premiumInputSx,x)}),n.jsx(j,{...y,label:A,value:e.value,onChange:s=>h(o,"value",s.target.value),size:"small",fullWidth:!0,sx:i.mergeSx(i.premiumInputSx,x)}),n.jsx(z,{"aria-label":`Remove ${e.key||"row"}`,onClick:()=>I(o),size:"small",sx:{borderRadius:2,color:"text.secondary","&:hover":{color:"error.main"}},children:n.jsx(w,{fontSize:"small"})})]},o))}),n.jsx(M,{onClick:C,startIcon:n.jsx(L,{}),size:"small",variant:"text",sx:{alignSelf:"flex-start",mt:1,borderRadius:2,textTransform:"none",fontWeight:600},children:"Add"}),p&&n.jsx(E,{children:r?.validation?.find(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")?.message||"At least one entry is required"})]})}exports.default=K;
@@ -0,0 +1,21 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import n, { Suspense as a } from "react";
3
+ import s from "@mui/material/Box";
4
+ import f from "@mui/material/CircularProgress";
5
+ import { i as m } from "./AIForm-DtRl0WdY.mjs";
6
+ const c = n.lazy(
7
+ () => import("@mui/x-charts/LineChart").then((r) => ({ default: r.LineChart }))
8
+ );
9
+ function d({ attributes: r = {} }) {
10
+ const { MuiChartAttributes: e = {}, id: i = "" } = r, o = m("LineChart") || c;
11
+ return /* @__PURE__ */ t(
12
+ a,
13
+ {
14
+ fallback: /* @__PURE__ */ t(s, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(f, {}) }),
15
+ children: /* @__PURE__ */ t(o, { height: 300, ...e }, i)
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ d as default
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.create;var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var x=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!d.call(e,i)&&i!==r&&u(e,i,{get:()=>t[i],enumerable:!(n=a(t,i))||n.enumerable});return e};var f=(e,t,r)=>(r=e!=null?c(h(e)):{},x(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),j=require("@mui/material/Box"),C=require("@mui/material/CircularProgress"),y=require("./AIForm-Dv8ahXyE.js"),g=o.lazy(()=>import("@mui/x-charts/LineChart").then(e=>({default:e.LineChart})));function p({attributes:e={}}){const{MuiChartAttributes:t={},id:r=""}=e,n=y.getMuiX("LineChart")||g;return s.jsx(o.Suspense,{fallback:s.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:s.jsx(C,{})}),children:s.jsx(n,{height:300,...t},r)})}exports.default=p;
@@ -1,7 +1,7 @@
1
1
  import { jsx as s, jsxs as O } from "react/jsx-runtime";
2
2
  import { useState as N, useEffect as T } from "react";
3
3
  import { Stack as q, Box as z, Typography as E, TextField as g, InputAdornment as F, Button as D, Icon as x, IconButton as J } from "@mui/material";
4
- import { u as L } from "./index-Bh6BLrzq.mjs";
4
+ import { j as L } from "./AIForm-DtRl0WdY.mjs";
5
5
  function k(r, o) {
6
6
  if (Array.isArray(r) && r.length > 0) {
7
7
  const c = r[0], a = Object.keys(c).find((d) => d !== "fee");
@@ -51,13 +51,13 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
51
51
  }, [r.value]), T(() => {
52
52
  c && c({ id: a, value: M(i) });
53
53
  }, [i, a]);
54
- const R = () => {
54
+ const j = () => {
55
55
  const e = i.length + 1;
56
56
  p([...i, { key: `${h}${e}`, description: "", fee: 0 }]);
57
- }, W = (e) => {
57
+ }, R = (e) => {
58
58
  const t = i.filter((y, m) => m !== e).map((y, m) => ({ ...y, key: `${h}${m + 1}` }));
59
59
  p(t);
60
- }, j = (e, n) => {
60
+ }, W = (e, n) => {
61
61
  const t = [...i];
62
62
  t[e] = { ...t[e], description: n }, p(t);
63
63
  }, K = (e, n) => {
@@ -110,7 +110,7 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
110
110
  error: u && !e.description,
111
111
  helperText: u && !e.description ? "Required" : "",
112
112
  value: e.description,
113
- onChange: (t) => j(n, t.target.value),
113
+ onChange: (t) => W(n, t.target.value),
114
114
  InputProps: { readOnly: l },
115
115
  ...B
116
116
  }
@@ -139,7 +139,7 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
139
139
  {
140
140
  variant: "contained",
141
141
  color: "primary",
142
- onClick: R,
142
+ onClick: j,
143
143
  sx: { minWidth: 40, px: 1, height: 40, flexShrink: 0 },
144
144
  title: "Add row",
145
145
  ...$,
@@ -149,7 +149,7 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
149
149
  J,
150
150
  {
151
151
  color: "error",
152
- onClick: () => W(n),
152
+ onClick: () => R(n),
153
153
  sx: { height: 40, flexShrink: 0 },
154
154
  title: "Remove row",
155
155
  ...S,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),g=require("react"),a=require("@mui/material"),T=require("./AIForm-Dv8ahXyE.js");function k(r,o){if(Array.isArray(r)&&r.length>0){const d=r[0],c=Object.keys(d).find(l=>l!=="fee");if(c)return c.replace(/\d+$/,"")}return o}function I(r,o){return Array.isArray(r)&&r.length>0?r.map((d,c)=>{const{fee:l=0,...f}=d,u=Object.keys(f)[0]||`${o}${c+1}`;return{key:u,description:String(f[u]??""),fee:Number(l)||0}}):[{key:`${o}1`,description:"",fee:0}]}function W(r){return r.map(o=>({fee:o.fee,[o.key]:o.description}))}function F({attributes:r={},rules:o={},onChange:d}){const{id:c="",keyPrefix:l="item",showRowBadge:f=!0,readOnly:u=!1,showActions:v=!0,MuiAttributes:j={}}=r,w=v&&!u,{row:P={},rowBadge:b={},description:A={},fee:B={},addButton:S={},removeButton:C={}}=j,h=o?.validation?.some(e=>e.rule==="mandatory")||!1,m=k(r.value,l),[s,p]=g.useState(()=>I(r.value,m));T.useUpdateEffect(()=>{const e=k(r.value,l),n=I(r.value,e);JSON.stringify(n)!==JSON.stringify(s)&&p(n)},[r.value]),g.useEffect(()=>{d&&d({id:c,value:W(s)})},[s,c]);const $=()=>{const e=s.length+1;p([...s,{key:`${m}${e}`,description:"",fee:0}])},R=e=>{const t=s.filter((x,y)=>y!==e).map((x,y)=>({...x,key:`${m}${y+1}`}));p(t)},q=(e,n)=>{const t=[...s];t[e]={...t[e],description:n},p(t)},O=(e,n)=>{const t=[...s];t[e]={...t[e],fee:Number(n)||0},p(t)};return i.jsx(a.Stack,{spacing:1.5,sx:{width:"100%"},children:s.map((e,n)=>i.jsxs(a.Box,{sx:{display:"flex",gap:1,alignItems:"flex-start",p:1.5,border:"1px solid",borderColor:"divider",borderRadius:1,backgroundColor:"background.paper"},...P,children:[f&&i.jsx(a.Typography,{variant:"caption",sx:{minWidth:24,height:24,borderRadius:"50%",backgroundColor:"primary.main",color:"primary.contrastText",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,flexShrink:0,mt:.75},...b,children:n+1}),i.jsx(a.TextField,{fullWidth:!0,size:"small",label:"Description",required:h,error:h&&!e.description,helperText:h&&!e.description?"Required":"",value:e.description,onChange:t=>q(n,t.target.value),InputProps:{readOnly:u},...A}),i.jsx(a.TextField,{size:"small",label:"Fee",type:"number",sx:{minWidth:120},required:h,value:e.fee,onChange:t=>O(n,t.target.value),InputProps:{readOnly:u,startAdornment:i.jsx(a.InputAdornment,{position:"start",children:"$"})},inputProps:{min:0,step:.01},onWheel:t=>t.target.blur(),...B}),w&&(n===s.length-1?i.jsx(a.Button,{variant:"contained",color:"primary",onClick:$,sx:{minWidth:40,px:1,height:40,flexShrink:0},title:"Add row",...S,children:i.jsx(a.Icon,{children:"add"})}):i.jsx(a.IconButton,{color:"error",onClick:()=>R(n),sx:{height:40,flexShrink:0},title:"Remove row",...C,children:i.jsx(a.Icon,{children:"delete"})}))]},e.key))})}exports.default=F;
@@ -1,9 +1,9 @@
1
1
  import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
2
  import { List as a, ListItem as u, ListItemIcon as x, Icon as L, ListItemText as p } from "@mui/material";
3
- import { m as d, b as I } from "./index-Bh6BLrzq.mjs";
3
+ import { m as d, l } from "./AIForm-DtRl0WdY.mjs";
4
4
  function A({ attributes: i = {} }) {
5
5
  const { MuiAttributes: e = {}, items: s = [] } = i, { sx: o, ...n } = e;
6
- return /* @__PURE__ */ r(a, { ...n, sx: d(I, o), children: (Array.isArray(s) ? s : []).map((t, c) => /* @__PURE__ */ m(u, { ...t.MuiListItemAttributes, children: [
6
+ return /* @__PURE__ */ r(a, { ...n, sx: d(l, o), children: (Array.isArray(s) ? s : []).map((t, c) => /* @__PURE__ */ m(u, { ...t.MuiListItemAttributes, children: [
7
7
  t.icon && /* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(L, { children: t.icon }) }),
8
8
  /* @__PURE__ */ r(
9
9
  p,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),e=require("@mui/material"),i=require("./AIForm-Dv8ahXyE.js");function x({attributes:n={}}){const{MuiAttributes:c={},items:s=[]}=n,{sx:u,...o}=c;return r.jsx(e.List,{...o,sx:i.mergeSx(i.premiumSurfaceSx,u),children:(Array.isArray(s)?s:[]).map((t,a)=>r.jsxs(e.ListItem,{...t.MuiListItemAttributes,children:[t.icon&&r.jsx(e.ListItemIcon,{children:r.jsx(e.Icon,{children:t.icon})}),r.jsx(e.ListItemText,{primary:t.primary,secondary:t.secondary,...t.MuiListItemTextAttributes})]},a))})}exports.default=x;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),B=require("react"),c=require("./AIForm-Dv8ahXyE.js"),C=require("@mui/material/TextField"),L=require("@mui/material/Button"),v=require("@mui/material/Box"),R=require("@mui/material");function U({attributes:l={},rules:m={},onChange:a,submitTick:h,messages:S}){const{id:d="",MuiAttributes:n={},InputProps:F={},format:g="",buttonText:P="Update Location",buttonIcon:b="location_on",buttonDisplay:w="both",MuiButtonAttributes:q={},disabled:y=!1}=l,[i,u]=B.useState({value:l.value!==void 0?l.value:"",helperText:n.helperText||"",error:!1});B.useEffect(()=>{l.value!==void 0&&l.value!==i.value&&u(e=>({...e,value:l.value}))},[l.value]);const A=e=>g?c.numeral(e).format(g):e,p=e=>{const{validation:t}=m;if(t)for(let o=0;o<t.length;o+=1){const r=t[o],j=c.Validation[r.rule];if(!(typeof j=="function"?j(e,r.value):!0)){const _=r.rule==="mandatory"?S?.required||"This field is required":"";return{isValid:!1,message:r.message||_}}}return{isValid:!0,message:""}};c.useUpdateEffect(()=>{if(h){const e=p(i.value);u(t=>({...t,helperText:e.message,error:!e.isValid}))}},[h]);const M=e=>{const{value:t}=e.target,o=p(t);u({value:t,helperText:o.message,error:!o.isValid})},k=e=>{const{value:t}=e.target,o=A(t),r=p(o);u({value:o,helperText:r.message,error:!r.isValid}),typeof a=="function"&&a({id:d,value:o})},z=()=>{a&&a({id:d,value:i.value,option:"location_update_request"})},D=()=>{const e=w,t=s.jsx(R.Icon,{children:b});switch(e){case"icon":return t;case"text":return s.jsx(s.Fragment,{children:P});default:return s.jsxs(s.Fragment,{children:[t,s.jsx(v,{component:"span",sx:{ml:.5},children:P})]})}},E=m?.validation?.some(e=>e.rule==="mandatory")||!1,f=!!n?.slotProps,x={...n};let I,T;if(f){const e=n.slotProps&&n.slotProps.input||{};T={...n.slotProps||{},input:{...e}},delete x.slotProps}else I={...n.inputProps||{}},delete x.inputProps;const O=n.variant||"outlined",V=n.size||"medium",W=V==="small"?O==="outlined"?40:48:56;return s.jsxs(v,{sx:{display:"flex",gap:1,alignItems:"flex-start",width:"100%"},children:[s.jsx(v,{sx:{flex:1,minWidth:0},children:s.jsx(C,{fullWidth:!0,...x,id:d,required:E,inputProps:f?void 0:I,slotProps:f?T:void 0,InputProps:c.getInputProps(F),onChange:M,onBlur:k,value:i.value,error:i.error,helperText:i.helperText,disabled:y})}),s.jsx(L,{variant:"outlined",color:"primary",size:V==="small"?"small":"medium",onClick:z,disabled:y,...q,sx:{whiteSpace:"nowrap",minWidth:"auto",height:W,flexShrink:0,...q?.sx},children:D()})]})}exports.default=U;
@@ -1,14 +1,14 @@
1
1
  import { jsxs as S, jsx as i, Fragment as q } from "react/jsx-runtime";
2
2
  import w from "react";
3
- import { u as O, j as U, V as H, n as R } from "./index-Bh6BLrzq.mjs";
3
+ import { j as O, t as U, V as H, v as R } from "./AIForm-DtRl0WdY.mjs";
4
4
  import G from "@mui/material/TextField";
5
5
  import J from "@mui/material/Button";
6
6
  import m from "@mui/material/Box";
7
7
  import { Icon as K } from "@mui/material";
8
- function oe({ attributes: s = {}, rules: v = {}, onChange: r, submitTick: h, messages: F }) {
8
+ function oe({ attributes: l = {}, rules: v = {}, onChange: r, submitTick: h, messages: F }) {
9
9
  const {
10
10
  id: d = "",
11
- MuiAttributes: n = {},
11
+ MuiAttributes: s = {},
12
12
  InputProps: b = {},
13
13
  format: x = "",
14
14
  buttonText: g = "Update Location",
@@ -16,22 +16,22 @@ function oe({ attributes: s = {}, rules: v = {}, onChange: r, submitTick: h, mes
16
16
  buttonDisplay: k = "both",
17
17
  MuiButtonAttributes: P = {},
18
18
  disabled: V = !1
19
- } = s, [a, u] = w.useState({
20
- value: s.value !== void 0 ? s.value : "",
21
- helperText: n.helperText || "",
19
+ } = l, [a, u] = w.useState({
20
+ value: l.value !== void 0 ? l.value : "",
21
+ helperText: s.helperText || "",
22
22
  error: !1
23
23
  });
24
24
  w.useEffect(() => {
25
- s.value !== void 0 && s.value !== a.value && u((e) => ({ ...e, value: s.value }));
26
- }, [s.value]);
25
+ l.value !== void 0 && l.value !== a.value && u((e) => ({ ...e, value: l.value }));
26
+ }, [l.value]);
27
27
  const z = (e) => x ? R(e).format(x) : e, c = (e) => {
28
28
  const { validation: t } = v;
29
29
  if (t)
30
30
  for (let o = 0; o < t.length; o += 1) {
31
- const l = t[o], B = H[l.rule];
32
- if (!(typeof B == "function" ? B(e, l.value) : !0)) {
33
- const L = l.rule === "mandatory" ? F?.required || "This field is required" : "";
34
- return { isValid: !1, message: l.message || L };
31
+ const n = t[o], B = H[n.rule];
32
+ if (!(typeof B == "function" ? B(e, n.value) : !0)) {
33
+ const L = n.rule === "mandatory" ? F?.required || "This field is required" : "";
34
+ return { isValid: !1, message: n.message || L };
35
35
  }
36
36
  }
37
37
  return { isValid: !0, message: "" };
@@ -46,8 +46,8 @@ function oe({ attributes: s = {}, rules: v = {}, onChange: r, submitTick: h, mes
46
46
  const { value: t } = e.target, o = c(t);
47
47
  u({ value: t, helperText: o.message, error: !o.isValid });
48
48
  }, D = (e) => {
49
- const { value: t } = e.target, o = z(t), l = c(o);
50
- u({ value: o, helperText: l.message, error: !l.isValid }), typeof r == "function" && r({ id: d, value: o });
49
+ const { value: t } = e.target, o = z(t), n = c(o);
50
+ u({ value: o, helperText: n.message, error: !n.isValid }), typeof r == "function" && r({ id: d, value: o });
51
51
  }, E = () => {
52
52
  r && r({ id: d, value: a.value, option: "location_update_request" });
53
53
  }, M = () => {
@@ -63,17 +63,17 @@ function oe({ attributes: s = {}, rules: v = {}, onChange: r, submitTick: h, mes
63
63
  /* @__PURE__ */ i(m, { component: "span", sx: { ml: 0.5 }, children: g })
64
64
  ] });
65
65
  }
66
- }, W = v?.validation?.some((e) => e.rule === "mandatory") || !1, p = !!n?.slotProps, f = { ...n };
66
+ }, W = v?.validation?.some((e) => e.rule === "mandatory") || !1, p = !!s?.slotProps, f = { ...s };
67
67
  let I, T;
68
68
  if (p) {
69
- const e = n.slotProps && n.slotProps.input || {};
69
+ const e = s.slotProps && s.slotProps.input || {};
70
70
  T = {
71
- ...n.slotProps || {},
71
+ ...s.slotProps || {},
72
72
  input: { ...e }
73
73
  }, delete f.slotProps;
74
74
  } else
75
- I = { ...n.inputProps || {} }, delete f.inputProps;
76
- const _ = n.variant || "outlined", y = n.size || "medium", C = y === "small" ? _ === "outlined" ? 40 : 48 : 56;
75
+ I = { ...s.inputProps || {} }, delete f.inputProps;
76
+ const _ = s.variant || "outlined", y = s.size || "medium", C = y === "small" ? _ === "outlined" ? 40 : 48 : 56;
77
77
  return /* @__PURE__ */ S(m, { sx: { display: "flex", gap: 1, alignItems: "flex-start", width: "100%" }, children: [
78
78
  /* @__PURE__ */ i(m, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ i(
79
79
  G,
@@ -7,7 +7,7 @@ import k from "@mui/material/TextField";
7
7
  import y from "@mui/material/FormControl";
8
8
  import C from "@mui/material/FormLabel";
9
9
  import { alpha as S } from "@mui/material/styles";
10
- import { u as j, m as M, a as H } from "./index-Bh6BLrzq.mjs";
10
+ import { j, m as M, k as H } from "./AIForm-DtRl0WdY.mjs";
11
11
  function R(t) {
12
12
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
13
13
  }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),v=require("@mui/material/Box"),w=require("@mui/material/Stack"),j=require("@mui/material/Button"),q=require("@mui/material/TextField"),y=require("@mui/material/FormControl"),k=require("@mui/material/FormLabel"),S=require("@mui/material/styles"),l=require("./AIForm-Dv8ahXyE.js");function C(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M(t){let e=C(t||"");return e=e.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),e=e.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),e=e.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),e=e.replace(/(?:^-\s+.*(?:\n|$))+/gm,s=>`<ul>${s.trimEnd().split(`
2
+ `).map(i=>i.replace(/^-\s+(.*)$/,"<li>$1</li>")).join("")}</ul>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,'<a href="$2">$1</a>'),e=e.replace(/`([^`]+)`/g,"<code>$1</code>"),e=e.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),e=e.replace(/\*([^*]+)\*/g,"<em>$1</em>"),e=e.split(/\n{2,}/).map(s=>{const n=s.trim();return n?/^<(h1|h2|h3|ul|pre)/.test(n)?n:`<p>${n.replace(/\n/g,"<br />")}</p>`:""}).join(""),e}function R({attributes:t={},rules:e={},onChange:s}){const{id:n="",label:i,rows:a=6,MuiAttributes:g={}}=t,{sx:h,...x}=g,[u,c]=p.useState(t.value||""),[d,f]=p.useState(!1);l.useUpdateEffect(()=>{c(t.value||"")},[t.value]);const $=e?.validation?.some(r=>r.rule==="mandatory"||r.rule==="mandatoryselect")||!1,b=r=>{const m=r.target.value;c(m),s?.({id:n,value:m})};return o.jsxs(y,{required:$,component:"fieldset",fullWidth:!0,children:[o.jsxs(w,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[i?o.jsx(k,{component:"legend",children:i}):o.jsx("span",{}),o.jsx(j,{size:"small",variant:"outlined",onClick:()=>f(r=>!r),sx:{borderRadius:"10px",textTransform:"none"},children:d?"Write":"Preview"})]}),d?o.jsx(v,{"data-testid":"markdown-preview",dangerouslySetInnerHTML:{__html:M(u)},sx:{minHeight:r=>r.spacing(a*3),p:2,borderRadius:"10px",border:r=>`1px solid ${S.alpha(r.palette.text.primary,.12)}`,backgroundColor:r=>r.palette.background.paper,"& :first-of-type":{mt:0},"& :last-child":{mb:0}}}):o.jsx(q,{id:n||void 0,value:u,onChange:b,multiline:!0,minRows:a,fullWidth:!0,placeholder:"Write markdown…",inputProps:{"aria-label":i||"markdown editor"},...x,sx:l.mergeSx(l.premiumInputSx,h)})]})}exports.default=R;
@@ -12,7 +12,7 @@ import J from "@mui/material/FormControl";
12
12
  import K from "@mui/material/FormLabel";
13
13
  import N from "@mui/material/FormHelperText";
14
14
  import { alpha as R } from "@mui/material/styles";
15
- import { u as O, m as Q, b as V } from "./index-Bh6BLrzq.mjs";
15
+ import { j as O, m as Q, l as V } from "./AIForm-DtRl0WdY.mjs";
16
16
  const X = (n) => (n || []).map(
17
17
  (a) => typeof a == "string" ? { id: a, label: a } : { id: String(a.id), label: a.label ?? String(a.id) }
18
18
  ), Y = (n) => (n || []).map(
@@ -30,7 +30,7 @@ function ce({ attributes: n = {}, rules: a = {}, onChange: $ }) {
30
30
  O(() => {
31
31
  S(n.value || {});
32
32
  }, [n.value]);
33
- const p = a?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, q = (e) => {
33
+ const p = a?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, j = (e) => {
34
34
  let r = !0, l = "";
35
35
  return p && (x.every((m) => {
36
36
  const i = e[m.id];
@@ -40,11 +40,11 @@ function ce({ attributes: n = {}, rules: a = {}, onChange: $ }) {
40
40
  )?.message || "Required")), { isValid: r, message: l };
41
41
  }, k = (e) => {
42
42
  S(e);
43
- const r = q(e);
43
+ const r = j(e);
44
44
  W(!r.isValid), z(r.message), $?.({ id: h, value: e, option: e });
45
- }, H = (e, r) => {
45
+ }, q = (e, r) => {
46
46
  k({ ...o, [e]: r });
47
- }, j = (e, r, l) => {
47
+ }, H = (e, r, l) => {
48
48
  const f = Array.isArray(o[e]) ? o[e] : [], m = l ? [...f, r] : f.filter((i) => i !== r);
49
49
  k({ ...o, [e]: m });
50
50
  }, A = (e, r) => {
@@ -86,7 +86,7 @@ function ce({ attributes: n = {}, rules: a = {}, onChange: $ }) {
86
86
  G,
87
87
  {
88
88
  checked: A(e.id, r.value),
89
- onChange: (l) => j(e.id, r.value, l.target.checked),
89
+ onChange: (l) => H(e.id, r.value, l.target.checked),
90
90
  inputProps: {
91
91
  "aria-label": `${e.label} ${r.label}`
92
92
  }
@@ -96,7 +96,7 @@ function ce({ attributes: n = {}, rules: a = {}, onChange: $ }) {
96
96
  {
97
97
  name: `matrix-${h}-${e.id}`,
98
98
  checked: A(e.id, r.value),
99
- onChange: () => H(e.id, r.value),
99
+ onChange: () => q(e.id, r.value),
100
100
  inputProps: {
101
101
  "aria-label": `${e.label} ${r.label}`
102
102
  }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("react"),w=require("@mui/material/Table"),B=require("@mui/material/TableBody"),c=require("@mui/material/TableCell"),L=require("@mui/material/TableContainer"),O=require("@mui/material/TableHead"),A=require("@mui/material/TableRow"),U=require("@mui/material/Radio"),D=require("@mui/material/Checkbox"),G=require("@mui/material/FormControl"),J=require("@mui/material/FormLabel"),K=require("@mui/material/FormHelperText"),M=require("@mui/material/styles"),x=require("./AIForm-Dv8ahXyE.js"),N=l=>(l||[]).map(s=>typeof s=="string"?{id:s,label:s}:{id:String(s.id),label:s.label??String(s.id)}),Q=l=>(l||[]).map(s=>typeof s=="string"?{value:s,label:s}:{value:String(s.value),label:s.label??String(s.value)});function V({attributes:l={},rules:s={},onChange:k}){const{MuiAttributes:R={},id:b="",rows:p=[],columns:g=[],multiple:d=!1,label:v=""}=l,f=o.useMemo(()=>N(p),[p]),y=o.useMemo(()=>Q(g),[g]),[i,q]=o.useState(l.value||{}),[j,F]=o.useState(!1),[S,$]=o.useState("");x.useUpdateEffect(()=>{q(l.value||{})},[l.value]);const m=s?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,W=e=>{let r=!0,n="";return m&&(f.every(u=>{const a=e[u.id];return d?Array.isArray(a)&&a.length>0:a!=null&&a!==""})||(r=!1,n=s?.validation?.find(a=>a.rule==="mandatory"||a.rule==="mandatoryselect")?.message||"Required")),{isValid:r,message:n}},C=e=>{q(e);const r=W(e);F(!r.isValid),$(r.message),k?.({id:b,value:e,option:e})},z=(e,r)=>{C({...i,[e]:r})},H=(e,r,n)=>{const h=Array.isArray(i[e])?i[e]:[],u=n?[...h,r]:h.filter(a=>a!==r);C({...i,[e]:u})},T=(e,r)=>{const n=i[e];return d?Array.isArray(n)&&n.includes(r):n===r},{sx:P,...E}=R;return t.jsxs(G,{required:m,error:j,component:"fieldset",fullWidth:!0,children:[v&&t.jsx(J,{required:m,error:j,sx:{mb:1,fontWeight:600},children:v}),t.jsx(L,{sx:x.mergeSx(x.premiumSurfaceSx,{width:"100%"}),children:t.jsxs(w,{size:"small",...E,sx:P,children:[t.jsx(O,{children:t.jsxs(A,{sx:e=>({backgroundColor:M.alpha(e.palette.primary.main,.06)}),children:[t.jsx(c,{sx:{fontWeight:700}}),y.map(e=>t.jsx(c,{align:"center",sx:{fontWeight:700},children:e.label},e.value))]})}),t.jsx(B,{children:f.map(e=>t.jsxs(A,{hover:!0,sx:r=>({transition:"background-color .18s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{backgroundColor:M.alpha(r.palette.primary.main,.04)}}),children:[t.jsx(c,{component:"th",scope:"row",sx:{fontWeight:500},children:e.label}),y.map(r=>t.jsx(c,{align:"center",padding:"checkbox",children:d?t.jsx(D,{checked:T(e.id,r.value),onChange:n=>H(e.id,r.value,n.target.checked),inputProps:{"aria-label":`${e.label} ${r.label}`}}):t.jsx(U,{name:`matrix-${b}-${e.id}`,checked:T(e.id,r.value),onChange:()=>z(e.id,r.value),inputProps:{"aria-label":`${e.label} ${r.label}`}})},r.value))]},e.id))})]})}),S&&t.jsx(K,{children:S})]})}exports.default=V;
@@ -1,9 +1,9 @@
1
- import { jsx as a, jsxs as k } from "react/jsx-runtime";
2
- import { useRef as S, useState as j, useEffect as R } from "react";
1
+ import { jsx as o, jsxs as k } from "react/jsx-runtime";
2
+ import { useRef as j, useState as S, useEffect as R } from "react";
3
3
  import { Stack as q, Box as w, TextField as O, Button as $, Icon as d, IconButton as B } from "@mui/material";
4
- import { u as v, a as C } from "./index-Bh6BLrzq.mjs";
4
+ import { j as v, k as C } from "./AIForm-DtRl0WdY.mjs";
5
5
  function T({ attributes: r = {}, rules: p = {}, onChange: i, submitTick: c, messages: m }) {
6
- const { id: u = "" } = r, h = m?.required || "Required", f = S(null), [t, o] = j(() => {
6
+ const { id: s = "" } = r, h = m?.required || "Required", f = j(null), [t, a] = S(() => {
7
7
  if (r.value && typeof r.value == "object") {
8
8
  const e = Object.entries(r.value).map(([l, n]) => ({
9
9
  key: l,
@@ -12,41 +12,41 @@ function T({ attributes: r = {}, rules: p = {}, onChange: i, submitTick: c, mess
12
12
  if (e.length > 0) return e;
13
13
  }
14
14
  return [{ key: "t1", value: "" }];
15
- }), s = p?.validation?.some((e) => e.rule === "mandatory") || !1;
15
+ }), u = p?.validation?.some((e) => e.rule === "mandatory") || !1;
16
16
  v(() => {
17
- c && s && !t[0]?.value && f.current?.focus();
17
+ c && u && !t[0]?.value && f.current?.focus();
18
18
  }, [c]), v(() => {
19
19
  if (r.value && typeof r.value == "object") {
20
20
  const e = Object.entries(r.value).map(([l, n]) => ({
21
21
  key: l,
22
22
  value: String(n)
23
23
  }));
24
- JSON.stringify(e) !== JSON.stringify(t) && o(e.length > 0 ? e : [{ key: "t1", value: "" }]);
25
- } else r.value || o([{ key: "t1", value: "" }]);
24
+ JSON.stringify(e) !== JSON.stringify(t) && a(e.length > 0 ? e : [{ key: "t1", value: "" }]);
25
+ } else r.value || a([{ key: "t1", value: "" }]);
26
26
  }, [r.value]), R(() => {
27
27
  const e = t.reduce((l, n) => (l[n.key] = n.value, l), {});
28
- i && i({ id: u, value: e });
29
- }, [t, u]);
28
+ i && i({ id: s, value: e });
29
+ }, [t, s]);
30
30
  const y = () => {
31
31
  const e = t.length + 1;
32
- o([...t, { key: `t${e}`, value: "" }]);
32
+ a([...t, { key: `t${e}`, value: "" }]);
33
33
  }, g = (e) => {
34
34
  const l = t.filter((n, I) => I !== e);
35
- o(l);
35
+ a(l);
36
36
  }, x = (e, l) => {
37
37
  const n = [...t];
38
- n[e].value = l, o(n);
38
+ n[e].value = l, a(n);
39
39
  };
40
- return /* @__PURE__ */ a(q, { spacing: 2, sx: { width: "100%" }, children: t.map((e, l) => /* @__PURE__ */ k(w, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
41
- /* @__PURE__ */ a(
40
+ return /* @__PURE__ */ o(q, { spacing: 2, sx: { width: "100%" }, children: t.map((e, l) => /* @__PURE__ */ k(w, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
41
+ /* @__PURE__ */ o(
42
42
  O,
43
43
  {
44
44
  fullWidth: !0,
45
- id: l === 0 ? u : `${u}_${e.key}`,
45
+ id: l === 0 ? s : `${s}_${e.key}`,
46
46
  inputRef: l === 0 ? f : void 0,
47
- required: s,
48
- error: s && !e.value,
49
- helperText: s && !e.value ? h : "",
47
+ required: u,
48
+ error: u && !e.value,
49
+ helperText: u && !e.value ? h : "",
50
50
  label: `Value ${e.key}`,
51
51
  value: e.value,
52
52
  onChange: (n) => x(l, n.target.value),
@@ -54,21 +54,21 @@ function T({ attributes: r = {}, rules: p = {}, onChange: i, submitTick: c, mess
54
54
  sx: C
55
55
  }
56
56
  ),
57
- l === t.length - 1 ? /* @__PURE__ */ a(
57
+ l === t.length - 1 ? /* @__PURE__ */ o(
58
58
  $,
59
59
  {
60
60
  variant: "contained",
61
61
  color: "primary",
62
62
  onClick: y,
63
63
  sx: { minWidth: "40px", p: 1 },
64
- children: /* @__PURE__ */ a(d, { children: "add" })
64
+ children: /* @__PURE__ */ o(d, { children: "add" })
65
65
  }
66
- ) : /* @__PURE__ */ a(
66
+ ) : /* @__PURE__ */ o(
67
67
  B,
68
68
  {
69
69
  color: "error",
70
70
  onClick: () => g(l),
71
- children: /* @__PURE__ */ a(d, { children: "remove" })
71
+ children: /* @__PURE__ */ o(d, { children: "remove" })
72
72
  }
73
73
  )
74
74
  ] }, l)) });
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material"),d=require("./AIForm-Dv8ahXyE.js");function k({attributes:r={},rules:h={},onChange:f,submitTick:v,messages:m}){const{id:o=""}=r,x=m?.required||"Required",p=i.useRef(null),[l,u]=i.useState(()=>{if(r.value&&typeof r.value=="object"){const e=Object.entries(r.value).map(([n,t])=>({key:n,value:String(t)}));if(e.length>0)return e}return[{key:"t1",value:""}]}),c=h?.validation?.some(e=>e.rule==="mandatory")||!1;d.useUpdateEffect(()=>{v&&c&&!l[0]?.value&&p.current?.focus()},[v]),d.useUpdateEffect(()=>{if(r.value&&typeof r.value=="object"){const e=Object.entries(r.value).map(([n,t])=>({key:n,value:String(t)}));JSON.stringify(e)!==JSON.stringify(l)&&u(e.length>0?e:[{key:"t1",value:""}])}else r.value||u([{key:"t1",value:""}])},[r.value]),i.useEffect(()=>{const e=l.reduce((n,t)=>(n[t.key]=t.value,n),{});f&&f({id:o,value:e})},[l,o]);const y=()=>{const e=l.length+1;u([...l,{key:`t${e}`,value:""}])},g=e=>{const n=l.filter((t,I)=>I!==e);u(n)},j=(e,n)=>{const t=[...l];t[e].value=n,u(t)};return s.jsx(a.Stack,{spacing:2,sx:{width:"100%"},children:l.map((e,n)=>s.jsxs(a.Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:[s.jsx(a.TextField,{fullWidth:!0,id:n===0?o:`${o}_${e.key}`,inputRef:n===0?p:void 0,required:c,error:c&&!e.value,helperText:c&&!e.value?x:"",label:`Value ${e.key}`,value:e.value,onChange:t=>j(n,t.target.value),size:"small",sx:d.premiumInputSx}),n===l.length-1?s.jsx(a.Button,{variant:"contained",color:"primary",onClick:y,sx:{minWidth:"40px",p:1},children:s.jsx(a.Icon,{children:"add"})}):s.jsx(a.IconButton,{color:"error",onClick:()=>g(n),children:s.jsx(a.Icon,{children:"remove"})})]},n))})}exports.default=k;
@@ -7,34 +7,34 @@ import A from "@mui/material/FormControl";
7
7
  import F from "@mui/material/FormLabel";
8
8
  import L from "@mui/material/FormHelperText";
9
9
  import { alpha as l } from "@mui/material/styles";
10
- import { u as V, P as s, d as N } from "./index-Bh6BLrzq.mjs";
11
- function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: d, messages: M }) {
10
+ import { j as V, P as s, o as N } from "./AIForm-DtRl0WdY.mjs";
11
+ function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: m, messages: M }) {
12
12
  const {
13
- id: m = "",
13
+ id: d = "",
14
14
  label: i,
15
15
  min: R = 0,
16
16
  max: $ = 10,
17
17
  lowLabel: E = "Not likely",
18
- highLabel: I = "Very likely",
18
+ highLabel: j = "Very likely",
19
19
  MuiAttributes: c = {}
20
- } = a, U = typeof a.value == "number" ? a.value : "", [u, f] = n.useState(U), [W, x] = n.useState(!1), [y, h] = n.useState("");
20
+ } = a, I = typeof a.value == "number" ? a.value : "", [u, f] = n.useState(I), [U, x] = n.useState(!1), [y, h] = n.useState("");
21
21
  V(() => {
22
22
  f(typeof a.value == "number" ? a.value : "");
23
23
  }, [a.value]);
24
24
  const g = p?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, b = (e) => g ? typeof e != "number" ? { isValid: !1, message: p?.validation?.find((r) => r.rule === "mandatory" || r.rule === "mandatoryselect")?.message || M?.required || "Required" } : { isValid: !0, message: "" } : { isValid: !0, message: "" };
25
25
  V(() => {
26
- if (d) {
26
+ if (m) {
27
27
  const e = b(u);
28
28
  x(!e.isValid), h(e.message);
29
29
  }
30
- }, [d]);
31
- const j = (e) => {
30
+ }, [m]);
31
+ const W = (e) => {
32
32
  f(e);
33
33
  const o = b(e);
34
- x(!o.isValid), h(o.message), k?.({ id: m, value: e });
34
+ x(!o.isValid), h(o.message), k?.({ id: d, value: e });
35
35
  }, v = [];
36
36
  for (let e = R; e <= $; e += 1) v.push(e);
37
- return /* @__PURE__ */ S(A, { id: m, required: g, error: W, component: "fieldset", sx: { width: "100%" }, children: [
37
+ return /* @__PURE__ */ S(A, { id: d, required: g, error: U, component: "fieldset", sx: { width: "100%" }, children: [
38
38
  i && /* @__PURE__ */ t(F, { sx: { mb: 1, fontWeight: 500 }, component: "legend", children: i }),
39
39
  /* @__PURE__ */ t(C, { role: "radiogroup", "aria-label": i || "nps scale", sx: { display: "flex", flexWrap: "wrap", gap: 0.75 }, children: v.map((e) => {
40
40
  const o = u === e;
@@ -45,7 +45,7 @@ function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: d, mess
45
45
  "aria-checked": o,
46
46
  variant: o ? "contained" : "outlined",
47
47
  color: "primary",
48
- onClick: () => j(e),
48
+ onClick: () => W(e),
49
49
  ...c,
50
50
  sx: (r) => ({
51
51
  minWidth: 44,
@@ -77,7 +77,7 @@ function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: d, mess
77
77
  }) }),
78
78
  /* @__PURE__ */ S(C, { sx: { display: "flex", justifyContent: "space-between", mt: 0.75 }, children: [
79
79
  /* @__PURE__ */ t(w, { variant: "caption", color: "text.secondary", children: E }),
80
- /* @__PURE__ */ t(w, { variant: "caption", color: "text.secondary", children: I })
80
+ /* @__PURE__ */ t(w, { variant: "caption", color: "text.secondary", children: j })
81
81
  ] }),
82
82
  y && /* @__PURE__ */ t(L, { children: y })
83
83
  ] });
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),q=require("@mui/material/Box"),k=require("@mui/material/Button"),S=require("@mui/material/Typography"),A=require("@mui/material/FormControl"),$=require("@mui/material/FormLabel"),N=require("@mui/material/FormHelperText"),s=require("@mui/material/styles"),l=require("./AIForm-Dv8ahXyE.js");function P({attributes:t={},rules:c={},onChange:j,submitTick:d,messages:M}){const{id:p="",label:n,min:E=0,max:I=10,lowLabel:R="Not likely",highLabel:C="Very likely",MuiAttributes:u={}}=t,w=typeof t.value=="number"?t.value:"",[m,x]=i.useState(w),[U,y]=i.useState(!1),[f,h]=i.useState("");l.useUpdateEffect(()=>{x(typeof t.value=="number"?t.value:"")},[t.value]);const g=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,b=e=>g?typeof e!="number"?{isValid:!1,message:c?.validation?.find(r=>r.rule==="mandatory"||r.rule==="mandatoryselect")?.message||M?.required||"Required"}:{isValid:!0,message:""}:{isValid:!0,message:""};l.useUpdateEffect(()=>{if(d){const e=b(m);y(!e.isValid),h(e.message)}},[d]);const V=e=>{x(e);const a=b(e);y(!a.isValid),h(a.message),j?.({id:p,value:e})},v=[];for(let e=E;e<=I;e+=1)v.push(e);return o.jsxs(A,{id:p,required:g,error:U,component:"fieldset",sx:{width:"100%"},children:[n&&o.jsx($,{sx:{mb:1,fontWeight:500},component:"legend",children:n}),o.jsx(q,{role:"radiogroup","aria-label":n||"nps scale",sx:{display:"flex",flexWrap:"wrap",gap:.75},children:v.map(e=>{const a=m===e;return o.jsx(k,{role:"radio","aria-checked":a,variant:a?"contained":"outlined",color:"primary",onClick:()=>V(e),...u,sx:r=>({minWidth:44,height:44,px:0,fontWeight:600,borderRadius:`${l.PREMIUM_RADIUS}px`,transition:`transform .18s ${l.PREMIUM_EASING}, box-shadow .18s ${l.PREMIUM_EASING}, background-color .18s ${l.PREMIUM_EASING}`,...a?{boxShadow:`0 4px 12px ${s.alpha(r.palette.primary.main,.35)}`}:{borderColor:s.alpha(r.palette.text.primary,.2),"&:hover":{borderColor:r.palette.primary.main,backgroundColor:s.alpha(r.palette.primary.main,.06)}},"&:hover":{transform:"translateY(-1px)",...a?{boxShadow:`0 6px 16px ${s.alpha(r.palette.primary.main,.4)}`}:{borderColor:r.palette.primary.main,backgroundColor:s.alpha(r.palette.primary.main,.06)}},...u.sx||{}}),children:e},e)})}),o.jsxs(q,{sx:{display:"flex",justifyContent:"space-between",mt:.75},children:[o.jsx(S,{variant:"caption",color:"text.secondary",children:R}),o.jsx(S,{variant:"caption",color:"text.secondary",children:C})]}),f&&o.jsx(N,{children:f})]})}exports.default=P;
@@ -9,7 +9,7 @@ import E from "@mui/material/FormHelperText";
9
9
  import H from "@mui/icons-material/Remove";
10
10
  import L from "@mui/icons-material/Add";
11
11
  import { alpha as m } from "@mui/material/styles";
12
- import { u as P, m as U } from "./index-Bh6BLrzq.mjs";
12
+ import { j as P, m as U } from "./AIForm-DtRl0WdY.mjs";
13
13
  const t = (n, c = 0) => {
14
14
  const i = Number(n);
15
15
  return Number.isFinite(i) ? i : c;
@@ -22,19 +22,19 @@ function re({ attributes: n = {}, rules: c = {}, onChange: i }) {
22
22
  max: s,
23
23
  step: b = 1,
24
24
  label: d
25
- } = n, { sx: B, ...F } = A, h = l != null, v = s != null, u = (e) => {
25
+ } = n, { sx: B, ...F } = A, h = l != null, v = s != null, p = (e) => {
26
26
  let r = e;
27
27
  return h && (r = Math.max(r, t(l))), v && (r = Math.min(r, t(s))), r;
28
- }, [a, g] = I.useState(() => u(t(n.value, 0))), [S, p] = I.useState(String(a)), y = c?.validation?.some(
28
+ }, [a, g] = I.useState(() => p(t(n.value, 0))), [S, u] = I.useState(String(a)), y = c?.validation?.some(
29
29
  (e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
30
30
  ) || !1;
31
31
  P(() => {
32
- const e = u(t(n.value, 0));
33
- g(e), p(String(e));
32
+ const e = p(t(n.value, 0));
33
+ g(e), u(String(e));
34
34
  }, [n.value]);
35
35
  const x = (e) => {
36
- const r = u(e);
37
- g(r), p(String(r)), i?.({ id: f, value: r });
36
+ const r = p(e);
37
+ g(r), u(String(r)), i?.({ id: f, value: r });
38
38
  }, M = h && a <= t(l), C = v && a >= t(s), N = () => {
39
39
  M || x(a - t(b, 1));
40
40
  }, R = () => {
@@ -99,7 +99,7 @@ function re({ attributes: n = {}, rules: c = {}, onChange: i }) {
99
99
  inputMode: "numeric",
100
100
  style: { textAlign: "center", width: 56 }
101
101
  },
102
- onChange: (e) => p(e.target.value),
102
+ onChange: (e) => u(e.target.value),
103
103
  onBlur: j,
104
104
  sx: {
105
105
  "& input": { py: 0.75 }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("react"),N=require("@mui/material/Stack"),T=require("@mui/material/InputBase"),k=require("@mui/material/IconButton"),P=require("@mui/material/FormControl"),$=require("@mui/material/FormLabel"),D=require("@mui/material/FormHelperText"),E=require("@mui/icons-material/Remove"),H=require("@mui/icons-material/Add"),c=require("@mui/material/styles"),w=require("./AIForm-Dv8ahXyE.js"),n=(o,u=0)=>{const i=Number(o);return Number.isFinite(i)?i:u};function L({attributes:o={},rules:u={},onChange:i}){const{MuiAttributes:I={},id:b="",min:s,max:l,step:h=1,label:d}=o,{sx:A,...F}=I,f=s!=null,g=l!=null,m=e=>{let t=e;return f&&(t=Math.max(t,n(s))),g&&(t=Math.min(t,n(l))),t},[a,v]=C.useState(()=>m(n(o.value,0))),[y,x]=C.useState(String(a)),S=u?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;w.useUpdateEffect(()=>{const e=m(n(o.value,0));v(e),x(String(e))},[o.value]);const p=e=>{const t=m(e);v(t),x(String(t)),i?.({id:b,value:t})},q=f&&a<=n(s),M=g&&a>=n(l),R=()=>{q||p(a-n(h,1))},z=()=>{M||p(a+n(h,1))},B=()=>{p(n(y,a))},j={borderRadius:0,px:1.25,color:"text.primary",transition:"background-color .18s","&:hover":e=>({backgroundColor:c.alpha(e.palette.primary.main,.08)}),"&.Mui-disabled":{color:"text.disabled"}};return r.jsxs(P,{component:"fieldset",error:!1,children:[d&&r.jsx($,{component:"legend",required:S,sx:{mb:1},children:d}),r.jsxs(N,{direction:"row",alignItems:"center",sx:w.mergeSx(e=>({display:"inline-flex",width:"fit-content",borderRadius:"10px",overflow:"hidden",border:`1px solid ${c.alpha(e.palette.text.primary,.16)}`,backgroundColor:e.palette.background.paper,transition:"box-shadow .2s, border-color .2s","&:hover":{borderColor:c.alpha(e.palette.primary.main,.5)},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 3px ${c.alpha(e.palette.primary.main,.16)}`}}),A),children:[r.jsx(k,{"aria-label":"decrement",onClick:R,disabled:q,size:"small",sx:j,children:r.jsx(E,{fontSize:"small"})}),r.jsx(T,{...F,value:y,inputProps:{"aria-label":d||b||"value",inputMode:"numeric",style:{textAlign:"center",width:56}},onChange:e=>x(e.target.value),onBlur:B,sx:{"& input":{py:.75}}}),r.jsx(k,{"aria-label":"increment",onClick:z,disabled:M,size:"small",sx:j,children:r.jsx(H,{fontSize:"small"})})]}),S&&r.jsx(D,{sx:{mx:0},children:""})]})}exports.default=L;
@@ -0,0 +1,21 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import a, { Suspense as s } from "react";
3
+ import n from "@mui/material/Box";
4
+ import f from "@mui/material/CircularProgress";
5
+ import { i as m } from "./AIForm-DtRl0WdY.mjs";
6
+ const c = a.lazy(
7
+ () => import("@mui/x-charts/PieChart").then((r) => ({ default: r.PieChart }))
8
+ );
9
+ function d({ attributes: r = {} }) {
10
+ const { MuiChartAttributes: e = {}, id: i = "" } = r, o = m("PieChart") || c;
11
+ return /* @__PURE__ */ t(
12
+ s,
13
+ {
14
+ fallback: /* @__PURE__ */ t(n, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(f, {}) }),
15
+ children: /* @__PURE__ */ t(o, { height: 300, ...e }, i)
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ d as default
21
+ };