dynamic-mui 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{index-B7i3cvH0.mjs → AIForm-Czsvpf7g.mjs} +4178 -4336
  2. package/dist/AIForm-LoeI18mO.js +43 -0
  3. package/dist/accordion-8p1FoyfL.js +1 -0
  4. package/dist/{accordion-Bc3bEKtC.mjs → accordion-CQ4Vldth.mjs} +1 -1
  5. package/dist/{addressfield-bU-3Rnkq.mjs → addressfield-N7DifI3i.mjs} +52 -40
  6. package/dist/addressfield-T4e_d87q.js +1 -0
  7. package/dist/ai/index.cjs +1 -0
  8. package/dist/ai/index.mjs +14 -0
  9. package/dist/asyncautocomplete-BB_MyjIj.mjs +92 -0
  10. package/dist/asyncautocomplete-CpO6EO3W.js +1 -0
  11. package/dist/bar-BOse0ZkP.js +1 -0
  12. package/dist/{bar-DUZXtBln.mjs → bar-CbpJ-MEV.mjs} +1 -1
  13. package/dist/cascadeselect-C30RVgmc.js +1 -0
  14. package/dist/cascadeselect-PzCw6JHX.mjs +66 -0
  15. package/dist/colorpicker-CMhVJNQT.mjs +111 -0
  16. package/dist/colorpicker-DoNrfUY7.js +1 -0
  17. package/dist/consentfield-Bp1dXs7L.js +1 -0
  18. package/dist/{consentfield-DxqzSUsQ.mjs → consentfield-DIa3sXrr.mjs} +18 -16
  19. package/dist/{datatable-vq0d5mZg.mjs → datatable-CO0Iv6R6.mjs} +1 -1
  20. package/dist/datatable-CyfyY3Wh.js +1 -0
  21. package/dist/dynamic-mui.cjs +1 -1
  22. package/dist/dynamic-mui.d.ts +2 -0
  23. package/dist/dynamic-mui.mjs +207 -33
  24. package/dist/editabletable-CCDJ2BPB.js +1 -0
  25. package/dist/{editabletable-C5eH6sPe.mjs → editabletable-C_MA7QEb.mjs} +30 -28
  26. package/dist/{fileupload-XnztToJ2.mjs → fileupload-DX3dxKFN.mjs} +26 -13
  27. package/dist/fileupload-WV5shCIK.js +1 -0
  28. package/dist/formrepeater-Cxu8Dk8P.js +1 -0
  29. package/dist/{formrepeater-CDhYRFqz.mjs → formrepeater-D5K8qgAA.mjs} +24 -20
  30. package/dist/{formwizard-C2QaC746.mjs → formwizard-B-HCfrnp.mjs} +1 -1
  31. package/dist/formwizard-HRF3hTyF.js +1 -0
  32. package/dist/geofield-0k7PkHRa.js +1 -0
  33. package/dist/{geofield-_dw7uIT2.mjs → geofield-DlqMZ_hl.mjs} +35 -31
  34. package/dist/{group-CZgTXmJP.mjs → group-BFDXdAfg.mjs} +1 -1
  35. package/dist/group-mONe185y.js +1 -0
  36. package/dist/{intlphone-357BAzba.mjs → intlphone-Bbk2UF9T.mjs} +16 -12
  37. package/dist/intlphone-zZ0xd-DG.js +1 -0
  38. package/dist/keyvaluefield-B6oRZzic.js +1 -0
  39. package/dist/{keyvaluefield-BRX83BRS.mjs → keyvaluefield-BynOkgTq.mjs} +16 -14
  40. package/dist/line-ChQNdVfl.js +1 -0
  41. package/dist/{line-JDUXJ2fy.mjs → line-DebtzkF3.mjs} +1 -1
  42. package/dist/lineitemlist-CI0LwIUz.js +1 -0
  43. package/dist/{lineitemlist-D84p4ZC5.mjs → lineitemlist-CjFNpqI5.mjs} +29 -25
  44. package/dist/{list-B6gocnmr.mjs → list-B5wBsflP.mjs} +2 -2
  45. package/dist/list-CJFKxKyN.js +1 -0
  46. package/dist/locationfield-CrOMF7jt.js +1 -0
  47. package/dist/locationfield-DQj3yDCa.mjs +118 -0
  48. package/dist/markdowneditor-Jaz7uTyZ.js +2 -0
  49. package/dist/{markdowneditor-B0CYYefE.mjs → markdowneditor-emqJhQV7.mjs} +15 -11
  50. package/dist/matrixfield-BPJsawGk.js +1 -0
  51. package/dist/{matrixfield-D9IJr1qQ.mjs → matrixfield-j5mf9lh5.mjs} +39 -35
  52. package/dist/{mixChart-ISf3Kbr-.mjs → mixChart-Doq4lt7Z.mjs} +2 -2
  53. package/dist/mixChart-rgyMCdnp.js +1 -0
  54. package/dist/{multitextbox-CrHH_t_8.mjs → multitextbox-CyZiTd_E.mjs} +23 -23
  55. package/dist/multitextbox-DQbcEqkM.js +1 -0
  56. package/dist/{npsscale-BS-ooCks.mjs → npsscale-BIkJMD4Z.mjs} +17 -13
  57. package/dist/npsscale-oUUyPdxP.js +1 -0
  58. package/dist/numberstepper-DRIvgtcH.js +1 -0
  59. package/dist/{numberstepper-Dc7wEzfb.mjs → numberstepper-thjufBMI.mjs} +13 -9
  60. package/dist/{pie-BpGQ6Aor.mjs → pie-4SHUYmRs.mjs} +1 -1
  61. package/dist/pie-COA-uozf.js +1 -0
  62. package/dist/richtexteditor-BSV7hG6d.js +1 -0
  63. package/dist/{richtexteditor-DHDVUoic.mjs → richtexteditor-CvZ3Y7X1.mjs} +4 -2
  64. package/dist/{signature-CDaNiDTO.js → signature-6QvVbfkT.js} +2 -2
  65. package/dist/{signature-Twiet_Pp.mjs → signature-DeDxnc8U.mjs} +4 -2
  66. package/dist/stepper-CDsErlLH.js +1 -0
  67. package/dist/{stepper-PK1xI0po.mjs → stepper-Sx3SWXTM.mjs} +4 -4
  68. package/dist/{summaryfield-CDDYwbfV.mjs → summaryfield-CAJjGmE2.mjs} +5 -5
  69. package/dist/summaryfield-DxzQ3g6Z.js +1 -0
  70. package/dist/tabs-CnDP2ngC.js +1 -0
  71. package/dist/{tabs-BJ9HBvyr.mjs → tabs-CvHNZU5o.mjs} +1 -1
  72. package/dist/tagsinput-DZcLPuX1.js +1 -0
  73. package/dist/tagsinput-bWU3Mem0.mjs +58 -0
  74. package/package.json +16 -11
  75. package/dist/accordion-CI-d8sBW.js +0 -1
  76. package/dist/addressfield-BVtAZyuA.js +0 -1
  77. package/dist/asyncautocomplete-BojHePYN.mjs +0 -89
  78. package/dist/asyncautocomplete-CGUaYa8k.js +0 -1
  79. package/dist/bar-D-Mi7Kmk.js +0 -1
  80. package/dist/cascadeselect-CMqn7Tql.mjs +0 -64
  81. package/dist/cascadeselect-Cu_sJIFt.js +0 -1
  82. package/dist/colorpicker-C6X7x0s_.js +0 -1
  83. package/dist/colorpicker-CXWSUm_s.mjs +0 -98
  84. package/dist/consentfield-BbwsP80E.js +0 -1
  85. package/dist/datatable-BThXDunv.js +0 -1
  86. package/dist/editabletable-Bv2TfEOc.js +0 -1
  87. package/dist/fileupload-CmWZnxyT.js +0 -1
  88. package/dist/formrepeater-COl6gNZi.js +0 -1
  89. package/dist/formwizard-hlQ_NCsd.js +0 -1
  90. package/dist/geofield-wtSTkcE0.js +0 -1
  91. package/dist/group-D95eDbtd.js +0 -1
  92. package/dist/index-DX3lZIKI.js +0 -43
  93. package/dist/intlphone-DR5-jK9f.js +0 -1
  94. package/dist/keyvaluefield-C89E1mqp.js +0 -1
  95. package/dist/line-B_-WceU1.js +0 -1
  96. package/dist/lineitemlist-VAV6uqyg.js +0 -1
  97. package/dist/list-DFdCIA2P.js +0 -1
  98. package/dist/locationfield-DSV_O6aK.js +0 -1
  99. package/dist/locationfield-En3apdDQ.mjs +0 -119
  100. package/dist/markdowneditor-LUCZHsC6.js +0 -2
  101. package/dist/matrixfield-BxngfAiS.js +0 -1
  102. package/dist/mixChart-C3o184UT.js +0 -1
  103. package/dist/multitextbox-DETwPeJY.js +0 -1
  104. package/dist/npsscale-5fQ1nTCy.js +0 -1
  105. package/dist/numberstepper-FRaiyZz0.js +0 -1
  106. package/dist/pie-DvzqIIDM.js +0 -1
  107. package/dist/richtexteditor-B7iljrHN.js +0 -1
  108. package/dist/stepper-Cf2nMTEt.js +0 -1
  109. package/dist/summaryfield-XXHz95hU.js +0 -1
  110. package/dist/tabs-B3s52APG.js +0 -1
  111. package/dist/tagsinput-B2W--DfP.mjs +0 -58
  112. package/dist/tagsinput-Dz7D54iz.js +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
2
  import S from "react";
3
3
  import s from "@mui/material/Box";
4
- import L from "@mui/material/Link";
5
- import f from "@mui/material/TextField";
6
- import k from "@mui/material/Typography";
7
- import { u as C, m as b, a as F, b as j } from "./index-B7i3cvH0.mjs";
8
- const h = (t) => {
4
+ import k from "@mui/material/Link";
5
+ import h from "@mui/material/TextField";
6
+ import L from "@mui/material/Typography";
7
+ import { j, m as f, k as C, l as F } from "./AIForm-Czsvpf7g.mjs";
8
+ const b = (t) => {
9
9
  if (t && typeof t == "object")
10
10
  return {
11
11
  lat: t.lat !== void 0 && t.lat !== null ? String(t.lat) : "",
@@ -17,61 +17,65 @@ const h = (t) => {
17
17
  }
18
18
  return { lat: "", lng: "" };
19
19
  };
20
- function A({ attributes: t = {}, onChange: i }) {
20
+ function v({ attributes: t = {}, onChange: i }) {
21
21
  const {
22
22
  id: a = "",
23
23
  label: m = "",
24
24
  showMap: x = !1,
25
25
  MuiAttributes: p = {}
26
- } = t, [l, g] = S.useState(() => h(t.value));
27
- C(() => {
28
- g(h(t.value));
26
+ } = t, [e, g] = S.useState(() => b(t.value));
27
+ j(() => {
28
+ g(b(t.value));
29
29
  }, [t.value]);
30
- const y = (e) => {
30
+ const y = (l) => {
31
31
  i?.({
32
32
  id: a,
33
- value: { lat: e.lat, lng: e.lng },
34
- option: `${e.lat},${e.lng}`
33
+ value: { lat: l.lat, lng: l.lng },
34
+ option: `${l.lat},${l.lng}`
35
35
  });
36
- }, c = (e) => (o) => {
37
- const n = { ...l, [e]: o.target.value };
36
+ }, c = (l) => (o) => {
37
+ const n = { ...e, [l]: o.target.value };
38
38
  g(n), y(n);
39
- }, $ = l.lat !== "" && l.lng !== "", d = b(F, p.sx), w = () => {
40
- const e = parseFloat(l.lat), o = parseFloat(l.lng), n = 0.01;
41
- return `https://www.openstreetmap.org/export/embed.html?bbox=${`${o - n},${e - n},${o + n},${e + n}`}&marker=${e},${o}`;
39
+ }, $ = e.lat !== "" && e.lng !== "", d = f(C, p.sx), w = () => {
40
+ const l = parseFloat(e.lat), o = parseFloat(e.lng), n = 0.01;
41
+ return `https://www.openstreetmap.org/export/embed.html?bbox=${`${o - n},${l - n},${o + n},${l + n}`}&marker=${l},${o}`;
42
42
  };
43
43
  return /* @__PURE__ */ u(s, { id: a, children: [
44
- m ? /* @__PURE__ */ r(k, { variant: "body2", sx: { mb: 0.75, fontWeight: 500 }, children: m }) : null,
44
+ m ? /* @__PURE__ */ r(L, { variant: "body2", sx: { mb: 0.75, fontWeight: 500 }, children: m }) : null,
45
45
  /* @__PURE__ */ u(s, { sx: { display: "flex", gap: 1.5, flexWrap: "wrap" }, children: [
46
46
  /* @__PURE__ */ r(
47
- f,
47
+ h,
48
48
  {
49
49
  type: "number",
50
50
  ...p,
51
51
  label: "Latitude",
52
- value: l.lat,
52
+ value: e.lat,
53
53
  onChange: c("lat"),
54
- inputProps: { "aria-label": "Latitude", step: "any" },
55
- sx: d
54
+ sx: d,
55
+ slotProps: {
56
+ htmlInput: { "aria-label": "Latitude", step: "any" }
57
+ }
56
58
  }
57
59
  ),
58
60
  /* @__PURE__ */ r(
59
- f,
61
+ h,
60
62
  {
61
63
  type: "number",
62
64
  ...p,
63
65
  label: "Longitude",
64
- value: l.lng,
66
+ value: e.lng,
65
67
  onChange: c("lng"),
66
- inputProps: { "aria-label": "Longitude", step: "any" },
67
- sx: d
68
+ sx: d,
69
+ slotProps: {
70
+ htmlInput: { "aria-label": "Longitude", step: "any" }
71
+ }
68
72
  }
69
73
  )
70
74
  ] }),
71
75
  /* @__PURE__ */ r(s, { sx: { mt: 1 }, children: /* @__PURE__ */ r(
72
- L,
76
+ k,
73
77
  {
74
- href: `https://www.google.com/maps?q=${l.lat},${l.lng}`,
78
+ href: `https://www.google.com/maps?q=${e.lat},${e.lng}`,
75
79
  target: "_blank",
76
80
  rel: "noreferrer",
77
81
  variant: "body2",
@@ -81,8 +85,8 @@ function A({ attributes: t = {}, onChange: i }) {
81
85
  x && $ ? /* @__PURE__ */ r(
82
86
  s,
83
87
  {
84
- sx: b((e) => ({
85
- ...j(e),
88
+ sx: f((l) => ({
89
+ ...F(l),
86
90
  mt: 1.5
87
91
  })),
88
92
  children: /* @__PURE__ */ r(
@@ -100,5 +104,5 @@ function A({ attributes: t = {}, onChange: i }) {
100
104
  ] });
101
105
  }
102
106
  export {
103
- A as default
107
+ v as default
104
108
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as u, jsx as t } from "react/jsx-runtime";
2
2
  import n from "react";
3
3
  import { Paper as p, Typography as l, Box as f } from "@mui/material";
4
- import { F as c } from "./index-B7i3cvH0.mjs";
4
+ import { F as c } from "./AIForm-Czsvpf7g.mjs";
5
5
  import { v as d } from "./v4-BysszJq8.mjs";
6
6
  function F({ attributes: o = {}, patch: e, onChange: i }) {
7
7
  const { MuiAttributes: r = {}, label: s = "Group", subFields: a = [] } = o, m = n.useMemo(() => d(), []);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),t=require("@mui/material"),l=require("./AIForm-LoeI18mO.js"),d=require("./v4-CqdK_b8Y.js");function x({attributes:o={},patch:s,onChange:i}){const{MuiAttributes:r={},label:u="Group",subFields:n=[]}=o,a=c.useMemo(()=>d.v4(),[]);return e.jsxs(t.Paper,{elevation:1,sx:{p:2,mb:2,...r.sx},...r,children:[e.jsx(t.Typography,{variant:"subtitle1",gutterBottom:!0,sx:{fontWeight:600},children:u}),e.jsx(t.Box,{children:e.jsx(l.FormGenerator,{guid:a,data:n,patch:s,onChange:i})})]})}exports.default=x;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
2
  import x from "react";
3
- import { u as G, m as I, a as A, f as k } from "./index-B7i3cvH0.mjs";
3
+ import { j as k, m as I, k as A, r as G } from "./AIForm-Czsvpf7g.mjs";
4
4
  import v from "@mui/material/Stack";
5
5
  import N from "@mui/material/TextField";
6
6
  import F from "@mui/material/MenuItem";
@@ -56,14 +56,14 @@ function E(e, r) {
56
56
  }
57
57
  return { code: r, number: "" };
58
58
  }
59
- function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
59
+ function H({ attributes: e = {}, rules: r = {}, onChange: f }) {
60
60
  const {
61
61
  id: d = "",
62
62
  defaultCountry: o = "US",
63
63
  label: t,
64
64
  MuiAttributes: P = {}
65
65
  } = e, { sx: s, ...R } = P, g = n.some((a) => a.code === o) ? o : "US", u = E(e.value, g), [p, h] = x.useState(u.code), [S, b] = x.useState(u.number);
66
- G(() => {
66
+ k(() => {
67
67
  const a = E(e.value, g);
68
68
  h(a.code), b(a.number);
69
69
  }, [e.value]);
@@ -84,7 +84,9 @@ function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
84
84
  };
85
85
  return /* @__PURE__ */ m(K, { component: "fieldset", fullWidth: !0, children: [
86
86
  t && /* @__PURE__ */ c(w, { component: "legend", required: y, sx: { mb: 1 }, children: t }),
87
- /* @__PURE__ */ m(v, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
87
+ /* @__PURE__ */ m(v, { direction: "row", spacing: 1, sx: {
88
+ alignItems: "flex-start"
89
+ }, children: [
88
90
  /* @__PURE__ */ c(
89
91
  N,
90
92
  {
@@ -94,17 +96,19 @@ function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
94
96
  size: "small",
95
97
  label: "Country",
96
98
  "aria-label": "Country dial code",
97
- SelectProps: {
98
- renderValue: (a) => {
99
- const l = n.find((i) => i.code === a) || n[0];
100
- return `${l.flag} ${l.dial}`;
101
- }
102
- },
103
99
  sx: I(A, {
104
100
  minWidth: 120,
105
101
  flexShrink: 0,
106
102
  ...s
107
103
  }),
104
+ slotProps: {
105
+ select: {
106
+ renderValue: (a) => {
107
+ const l = n.find((i) => i.code === a) || n[0];
108
+ return `${l.flag} ${l.dial}`;
109
+ }
110
+ }
111
+ },
108
112
  children: n.map((a) => /* @__PURE__ */ m(F, { value: a.code, children: [
109
113
  a.flag,
110
114
  " ",
@@ -116,7 +120,7 @@ function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
116
120
  }
117
121
  ),
118
122
  /* @__PURE__ */ c(
119
- k,
123
+ G,
120
124
  {
121
125
  customInput: N,
122
126
  format: "### ### ####",
@@ -136,5 +140,5 @@ function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
136
140
  ] });
137
141
  }
138
142
  export {
139
- Z as default
143
+ H as default
140
144
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("react"),t=require("./AIForm-LoeI18mO.js"),U=require("@mui/material/Stack"),I=require("@mui/material/TextField"),M=require("@mui/material/MenuItem"),T=require("@mui/material/FormControl"),j=require("@mui/material/FormLabel"),n=[{code:"US",name:"United States",dial:"+1",flag:"🇺🇸"},{code:"GB",name:"United Kingdom",dial:"+44",flag:"🇬🇧"},{code:"IN",name:"India",dial:"+91",flag:"🇮🇳"},{code:"CA",name:"Canada",dial:"+1",flag:"🇨🇦"},{code:"AU",name:"Australia",dial:"+61",flag:"🇦🇺"},{code:"DE",name:"Germany",dial:"+49",flag:"🇩🇪"},{code:"FR",name:"France",dial:"+33",flag:"🇫🇷"},{code:"IT",name:"Italy",dial:"+39",flag:"🇮🇹"},{code:"ES",name:"Spain",dial:"+34",flag:"🇪🇸"},{code:"BR",name:"Brazil",dial:"+55",flag:"🇧🇷"},{code:"MX",name:"Mexico",dial:"+52",flag:"🇲🇽"},{code:"JP",name:"Japan",dial:"+81",flag:"🇯🇵"},{code:"CN",name:"China",dial:"+86",flag:"🇨🇳"},{code:"RU",name:"Russia",dial:"+7",flag:"🇷🇺"},{code:"ZA",name:"South Africa",dial:"+27",flag:"🇿🇦"},{code:"NG",name:"Nigeria",dial:"+234",flag:"🇳🇬"},{code:"KE",name:"Kenya",dial:"+254",flag:"🇰🇪"},{code:"AE",name:"United Arab Emirates",dial:"+971",flag:"🇦🇪"},{code:"SA",name:"Saudi Arabia",dial:"+966",flag:"🇸🇦"},{code:"SG",name:"Singapore",dial:"+65",flag:"🇸🇬"},{code:"MY",name:"Malaysia",dial:"+60",flag:"🇲🇾"},{code:"ID",name:"Indonesia",dial:"+62",flag:"🇮🇩"},{code:"PH",name:"Philippines",dial:"+63",flag:"🇵🇭"},{code:"TH",name:"Thailand",dial:"+66",flag:"🇹🇭"},{code:"VN",name:"Vietnam",dial:"+84",flag:"🇻🇳"},{code:"KR",name:"South Korea",dial:"+82",flag:"🇰🇷"},{code:"NZ",name:"New Zealand",dial:"+64",flag:"🇳🇿"},{code:"IE",name:"Ireland",dial:"+353",flag:"🇮🇪"},{code:"NL",name:"Netherlands",dial:"+31",flag:"🇳🇱"},{code:"SE",name:"Sweden",dial:"+46",flag:"🇸🇪"},{code:"NO",name:"Norway",dial:"+47",flag:"🇳🇴"},{code:"DK",name:"Denmark",dial:"+45",flag:"🇩🇰"},{code:"CH",name:"Switzerland",dial:"+41",flag:"🇨🇭"},{code:"PL",name:"Poland",dial:"+48",flag:"🇵🇱"},{code:"PT",name:"Portugal",dial:"+351",flag:"🇵🇹"},{code:"GR",name:"Greece",dial:"+30",flag:"🇬🇷"},{code:"TR",name:"Turkey",dial:"+90",flag:"🇹🇷"},{code:"EG",name:"Egypt",dial:"+20",flag:"🇪🇬"},{code:"AR",name:"Argentina",dial:"+54",flag:"🇦🇷"},{code:"CL",name:"Chile",dial:"+56",flag:"🇨🇱"}];function A(a,m){if(typeof a=="string"&&a.trim()){const d=[...n].sort((i,c)=>c.dial.length-i.dial.length).find(i=>a.startsWith(i.dial));if(d)return{code:d.code,number:a.slice(d.dial.length).trim()}}return{code:m,number:""}}function v({attributes:a={},rules:m={},onChange:s}){const{id:d="",defaultCountry:i="US",label:c,MuiAttributes:N={}}=a,{sx:u,...P}=N,f=n.some(e=>e.code===i)?i:"US",g=A(a.value,f),[h,S]=C.useState(g.code),[p,x]=C.useState(g.number);t.useUpdateEffect(()=>{const e=A(a.value,f);S(e.code),x(e.number)},[a.value]);const b=m?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,y=(e,l)=>{const r=n.find(q=>q.code===e)||n[0];s?.({id:d,value:`${r.dial} ${l}`.trim(),option:{country:r.code,dial:r.dial,number:l}})},E=e=>{const l=e.target.value;S(l),y(l,p)},R=e=>{x(e.value),y(h,e.value)};return o.jsxs(T,{component:"fieldset",fullWidth:!0,children:[c&&o.jsx(j,{component:"legend",required:b,sx:{mb:1},children:c}),o.jsxs(U,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[o.jsx(I,{select:!0,value:h,onChange:E,size:"small",label:"Country","aria-label":"Country dial code",sx:t.mergeSx(t.premiumInputSx,{minWidth:120,flexShrink:0,...u}),slotProps:{select:{renderValue:e=>{const l=n.find(r=>r.code===e)||n[0];return`${l.flag} ${l.dial}`}}},children:n.map(e=>o.jsxs(M,{value:e.code,children:[e.flag," ",e.name," (",e.dial,")"]},e.code))}),o.jsx(t.PatternFormat,{customInput:I,format:"### ### ####",mask:"_",value:p,onValueChange:R,fullWidth:!0,required:b,label:"Phone number",id:d,name:"intlphone",...P,sx:t.mergeSx(t.premiumInputSx,u)})]})]})}exports.default=v;
@@ -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-LoeI18mO.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,sx:{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;
@@ -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-B7i3cvH0.mjs";
12
+ import { j as V, m as b, k as A } from "./AIForm-Czsvpf7g.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,26 @@ 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
- alignItems: "center",
57
+ sx: {
58
+ alignItems: "center"
59
+ },
58
60
  children: [
59
61
  /* @__PURE__ */ a(
60
- k,
62
+ v,
61
63
  {
62
64
  ...f,
63
65
  label: R,
@@ -69,10 +71,10 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
69
71
  }
70
72
  ),
71
73
  /* @__PURE__ */ a(
72
- k,
74
+ v,
73
75
  {
74
76
  ...f,
75
- label: z,
77
+ label: j,
76
78
  value: e.value,
77
79
  onChange: (l) => y(o, "value", l.target.value),
78
80
  size: "small",
@@ -84,7 +86,7 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
84
86
  E,
85
87
  {
86
88
  "aria-label": `Remove ${e.key || "row"}`,
87
- onClick: () => j(o),
89
+ onClick: () => F(o),
88
90
  size: "small",
89
91
  sx: {
90
92
  borderRadius: 2,
@@ -101,7 +103,7 @@ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
101
103
  /* @__PURE__ */ a(
102
104
  L,
103
105
  {
104
- onClick: F,
106
+ onClick: z,
105
107
  startIcon: /* @__PURE__ */ a(B, {}),
106
108
  size: "small",
107
109
  variant: "text",
@@ -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-LoeI18mO.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;
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
2
2
  import n, { Suspense as a } from "react";
3
3
  import s from "@mui/material/Box";
4
4
  import f from "@mui/material/CircularProgress";
5
- import { g as m } from "./index-B7i3cvH0.mjs";
5
+ import { i as m } from "./AIForm-Czsvpf7g.mjs";
6
6
  const c = n.lazy(
7
7
  () => import("@mui/x-charts/LineChart").then((r) => ({ default: r.LineChart }))
8
8
  );
@@ -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-LoeI18mO.js");function k(t,o){if(Array.isArray(t)&&t.length>0){const l=t[0],c=Object.keys(l).find(d=>d!=="fee");if(c)return c.replace(/\d+$/,"")}return o}function v(t,o){return Array.isArray(t)&&t.length>0?t.map((l,c)=>{const{fee:d=0,...f}=l,u=Object.keys(f)[0]||`${o}${c+1}`;return{key:u,description:String(f[u]??""),fee:Number(d)||0}}):[{key:`${o}1`,description:"",fee:0}]}function W(t){return t.map(o=>({fee:o.fee,[o.key]:o.description}))}function F({attributes:t={},rules:o={},onChange:l}){const{id:c="",keyPrefix:d="item",showRowBadge:f=!0,readOnly:u=!1,showActions:I=!0,MuiAttributes:j={}}=t,w=I&&!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(t.value,d),[s,p]=g.useState(()=>v(t.value,m));T.useUpdateEffect(()=>{const e=k(t.value,d),n=v(t.value,e);JSON.stringify(n)!==JSON.stringify(s)&&p(n)},[t.value]),g.useEffect(()=>{l&&l({id:c,value:W(s)})},[s,c]);const $=()=>{const e=s.length+1;p([...s,{key:`${m}${e}`,description:"",fee:0}])},R=e=>{const r=s.filter((x,y)=>y!==e).map((x,y)=>({...x,key:`${m}${y+1}`}));p(r)},q=(e,n)=>{const r=[...s];r[e]={...r[e],description:n},p(r)},O=(e,n)=>{const r=[...s];r[e]={...r[e],fee:Number(n)||0},p(r)};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:r=>q(n,r.target.value),...A,slotProps:{input:{readOnly:u}}}),i.jsx(a.TextField,{size:"small",label:"Fee",type:"number",sx:{minWidth:120},required:h,value:e.fee,onChange:r=>O(n,r.target.value),onWheel:r=>r.target.blur(),...B,slotProps:{input:{readOnly:u,startAdornment:i.jsx(a.InputAdornment,{position:"start",children:"$"})},htmlInput:{min:0,step:.01}}}),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,10 +1,10 @@
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-B7i3cvH0.mjs";
4
+ import { j as L } from "./AIForm-Czsvpf7g.mjs";
5
5
  function k(r, o) {
6
6
  if (Array.isArray(r) && r.length > 0) {
7
- const c = r[0], a = Object.keys(c).find((d) => d !== "fee");
7
+ const c = r[0], a = Object.keys(c).find((l) => l !== "fee");
8
8
  if (a)
9
9
  return a.replace(/\d+$/, "");
10
10
  }
@@ -12,11 +12,11 @@ function k(r, o) {
12
12
  }
13
13
  function v(r, o) {
14
14
  return Array.isArray(r) && r.length > 0 ? r.map((c, a) => {
15
- const { fee: d = 0, ...f } = c, l = Object.keys(f)[0] || `${o}${a + 1}`;
15
+ const { fee: l = 0, ...f } = c, d = Object.keys(f)[0] || `${o}${a + 1}`;
16
16
  return {
17
- key: l,
18
- description: String(f[l] ?? ""),
19
- fee: Number(d) || 0
17
+ key: d,
18
+ description: String(f[d] ?? ""),
19
+ fee: Number(l) || 0
20
20
  };
21
21
  }) : [{ key: `${o}1`, description: "", fee: 0 }];
22
22
  }
@@ -29,35 +29,35 @@ function M(r) {
29
29
  function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
30
30
  const {
31
31
  id: a = "",
32
- keyPrefix: d = "item",
32
+ keyPrefix: l = "item",
33
33
  /** Set to false to hide the row number badge. Defaults to true. */
34
34
  showRowBadge: f = !0,
35
35
  /** Set to true to render the Description/Fee fields as read-only and hide the Add/Remove buttons. */
36
- readOnly: l = !1,
36
+ readOnly: d = !1,
37
37
  /** Set to false to hide the Add/Remove buttons while keeping fields editable. Defaults to true. */
38
38
  showActions: w = !0,
39
39
  MuiAttributes: I = {}
40
- } = r, P = w && !l, {
40
+ } = r, P = w && !d, {
41
41
  row: b = {},
42
42
  rowBadge: A = {},
43
43
  description: B = {},
44
44
  fee: C = {},
45
45
  addButton: $ = {},
46
46
  removeButton: S = {}
47
- } = I, u = o?.validation?.some((e) => e.rule === "mandatory") || !1, h = k(r.value, d), [i, p] = N(() => v(r.value, h));
47
+ } = I, u = o?.validation?.some((e) => e.rule === "mandatory") || !1, h = k(r.value, l), [i, p] = N(() => v(r.value, h));
48
48
  L(() => {
49
- const e = k(r.value, d), n = v(r.value, e);
49
+ const e = k(r.value, l), n = v(r.value, e);
50
50
  JSON.stringify(n) !== JSON.stringify(i) && p(n);
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,9 +110,11 @@ 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),
114
- InputProps: { readOnly: l },
115
- ...B
113
+ onChange: (t) => W(n, t.target.value),
114
+ ...B,
115
+ slotProps: {
116
+ input: { readOnly: d }
117
+ }
116
118
  }
117
119
  ),
118
120
  /* @__PURE__ */ s(
@@ -125,13 +127,15 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
125
127
  required: u,
126
128
  value: e.fee,
127
129
  onChange: (t) => K(n, t.target.value),
128
- InputProps: {
129
- readOnly: l,
130
- startAdornment: /* @__PURE__ */ s(F, { position: "start", children: "$" })
131
- },
132
- inputProps: { min: 0, step: 0.01 },
133
130
  onWheel: (t) => t.target.blur(),
134
- ...C
131
+ ...C,
132
+ slotProps: {
133
+ input: {
134
+ readOnly: d,
135
+ startAdornment: /* @__PURE__ */ s(F, { position: "start", children: "$" })
136
+ },
137
+ htmlInput: { min: 0, step: 0.01 }
138
+ }
135
139
  }
136
140
  ),
137
141
  P && (n === i.length - 1 ? /* @__PURE__ */ s(
@@ -139,7 +143,7 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
139
143
  {
140
144
  variant: "contained",
141
145
  color: "primary",
142
- onClick: R,
146
+ onClick: j,
143
147
  sx: { minWidth: 40, px: 1, height: 40, flexShrink: 0 },
144
148
  title: "Add row",
145
149
  ...$,
@@ -149,7 +153,7 @@ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
149
153
  J,
150
154
  {
151
155
  color: "error",
152
- onClick: () => W(n),
156
+ onClick: () => R(n),
153
157
  sx: { height: 40, flexShrink: 0 },
154
158
  title: "Remove row",
155
159
  ...S,
@@ -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-B7i3cvH0.mjs";
3
+ import { m as d, l } from "./AIForm-Czsvpf7g.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-LoeI18mO.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 o=require("react/jsx-runtime"),V=require("react"),d=require("./AIForm-LoeI18mO.js"),C=require("@mui/material/TextField"),H=require("@mui/material/Button"),m=require("@mui/material/Box"),L=require("@mui/material");function R({attributes:l={},rules:h={},onChange:i,submitTick:v,messages:B}){const{id:p="",MuiAttributes:s={},InputProps:F={},format:x="",buttonText:g="Update Location",buttonIcon:S="location_on",buttonDisplay:b="both",MuiButtonAttributes:P={},disabled:I=!1}=l,[a,u]=V.useState({value:l.value!==void 0?l.value:"",helperText:s.helperText||"",error:!1});V.useEffect(()=>{l.value!==void 0&&l.value!==a.value&&u(e=>({...e,value:l.value}))},[l.value]);const w=e=>x?d.numeral(e).format(x):e,f=e=>{const{validation:t}=h;if(t)for(let n=0;n<t.length;n+=1){const r=t[n],j=d.Validation[r.rule];if(!(typeof j=="function"?j(e,r.value):!0)){const _=r.rule==="mandatory"?B?.required||"This field is required":"";return{isValid:!1,message:r.message||_}}}return{isValid:!0,message:""}};d.useUpdateEffect(()=>{if(v){const e=f(a.value);u(t=>({...t,helperText:e.message,error:!e.isValid}))}},[v]);const A=e=>{const{value:t}=e.target,n=f(t);u({value:t,helperText:n.message,error:!n.isValid})},M=e=>{const{value:t}=e.target,n=w(t),r=f(n);u({value:n,helperText:r.message,error:!r.isValid}),typeof i=="function"&&i({id:p,value:n})},k=()=>{i&&i({id:p,value:a.value,option:"location_update_request"})},z=()=>{const e=b,t=o.jsx(L.Icon,{children:S});switch(e){case"icon":return t;case"text":return o.jsx(o.Fragment,{children:g});default:return o.jsxs(o.Fragment,{children:[t,o.jsx(m,{component:"span",sx:{ml:.5},children:g})]})}},D=h?.validation?.some(e=>e.rule==="mandatory")||!1,c={...s},q=s.inputProps||s.slotProps?.htmlInput||{},y={...s.InputProps||s.slotProps?.input||{},...d.getInputProps(F)},E={...s.slotProps||{},input:y,htmlInput:q};delete c.slotProps,delete c.inputProps,delete c.InputProps;const O=s.variant||"outlined",T=s.size||"medium",W=T==="small"?O==="outlined"?40:48:56;return o.jsxs(m,{sx:{display:"flex",gap:1,alignItems:"flex-start",width:"100%"},children:[o.jsx(m,{sx:{flex:1,minWidth:0},children:o.jsx(C,{fullWidth:!0,...c,id:p,required:D,slotProps:E,inputProps:q,InputProps:y,onChange:A,onBlur:M,value:a.value,error:a.error,helperText:a.helperText,disabled:I})}),o.jsx(H,{variant:"outlined",color:"primary",size:T==="small"?"small":"medium",onClick:k,disabled:I,...P,sx:{whiteSpace:"nowrap",minWidth:"auto",height:W,flexShrink:0,...P?.sx},children:z()})]})}exports.default=R;
@@ -0,0 +1,118 @@
1
+ import { jsxs as B, jsx as s, Fragment as q } from "react/jsx-runtime";
2
+ import w from "react";
3
+ import { j as L, t as O, V as U, v as R } from "./AIForm-Czsvpf7g.mjs";
4
+ import G from "@mui/material/TextField";
5
+ import J from "@mui/material/Button";
6
+ import f from "@mui/material/Box";
7
+ import { Icon as K } from "@mui/material";
8
+ function ot({ attributes: l = {}, rules: m = {}, onChange: i, submitTick: h, messages: F }) {
9
+ const {
10
+ id: c = "",
11
+ MuiAttributes: a = {},
12
+ InputProps: S = {},
13
+ format: v = "",
14
+ buttonText: x = "Update Location",
15
+ buttonIcon: b = "location_on",
16
+ buttonDisplay: j = "both",
17
+ MuiButtonAttributes: g = {},
18
+ disabled: P = !1
19
+ } = l, [r, u] = w.useState({
20
+ value: l.value !== void 0 ? l.value : "",
21
+ helperText: a.helperText || "",
22
+ error: !1
23
+ });
24
+ w.useEffect(() => {
25
+ l.value !== void 0 && l.value !== r.value && u((t) => ({ ...t, value: l.value }));
26
+ }, [l.value]);
27
+ const k = (t) => v ? R(t).format(v) : t, p = (t) => {
28
+ const { validation: e } = m;
29
+ if (e)
30
+ for (let o = 0; o < e.length; o += 1) {
31
+ const n = e[o], y = U[n.rule];
32
+ if (!(typeof y == "function" ? y(t, n.value) : !0)) {
33
+ const H = n.rule === "mandatory" ? F?.required || "This field is required" : "";
34
+ return { isValid: !1, message: n.message || H };
35
+ }
36
+ }
37
+ return { isValid: !0, message: "" };
38
+ };
39
+ L(() => {
40
+ if (h) {
41
+ const t = p(r.value);
42
+ u((e) => ({ ...e, helperText: t.message, error: !t.isValid }));
43
+ }
44
+ }, [h]);
45
+ const z = (t) => {
46
+ const { value: e } = t.target, o = p(e);
47
+ u({ value: e, helperText: o.message, error: !o.isValid });
48
+ }, A = (t) => {
49
+ const { value: e } = t.target, o = k(e), n = p(o);
50
+ u({ value: o, helperText: n.message, error: !n.isValid }), typeof i == "function" && i({ id: c, value: o });
51
+ }, D = () => {
52
+ i && i({ id: c, value: r.value, option: "location_update_request" });
53
+ }, E = () => {
54
+ const t = j, e = /* @__PURE__ */ s(K, { children: b });
55
+ switch (t) {
56
+ case "icon":
57
+ return e;
58
+ case "text":
59
+ return /* @__PURE__ */ s(q, { children: x });
60
+ default:
61
+ return /* @__PURE__ */ B(q, { children: [
62
+ e,
63
+ /* @__PURE__ */ s(f, { component: "span", sx: { ml: 0.5 }, children: x })
64
+ ] });
65
+ }
66
+ }, M = m?.validation?.some((t) => t.rule === "mandatory") || !1, d = { ...a }, I = a.inputProps || a.slotProps?.htmlInput || {}, V = {
67
+ ...a.InputProps || a.slotProps?.input || {},
68
+ ...O(S)
69
+ }, W = {
70
+ ...a.slotProps || {},
71
+ input: V,
72
+ htmlInput: I
73
+ };
74
+ delete d.slotProps, delete d.inputProps, delete d.InputProps;
75
+ const _ = a.variant || "outlined", T = a.size || "medium", C = T === "small" ? _ === "outlined" ? 40 : 48 : 56;
76
+ return /* @__PURE__ */ B(f, { sx: { display: "flex", gap: 1, alignItems: "flex-start", width: "100%" }, children: [
77
+ /* @__PURE__ */ s(f, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ s(
78
+ G,
79
+ {
80
+ fullWidth: !0,
81
+ ...d,
82
+ id: c,
83
+ required: M,
84
+ slotProps: W,
85
+ inputProps: I,
86
+ InputProps: V,
87
+ onChange: z,
88
+ onBlur: A,
89
+ value: r.value,
90
+ error: r.error,
91
+ helperText: r.helperText,
92
+ disabled: P
93
+ }
94
+ ) }),
95
+ /* @__PURE__ */ s(
96
+ J,
97
+ {
98
+ variant: "outlined",
99
+ color: "primary",
100
+ size: T === "small" ? "small" : "medium",
101
+ onClick: D,
102
+ disabled: P,
103
+ ...g,
104
+ sx: {
105
+ whiteSpace: "nowrap",
106
+ minWidth: "auto",
107
+ height: C,
108
+ flexShrink: 0,
109
+ ...g?.sx
110
+ },
111
+ children: E()
112
+ }
113
+ )
114
+ ] });
115
+ }
116
+ export {
117
+ ot as default
118
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=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"),a=require("./AIForm-LoeI18mO.js");function C(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M(r){let e=C(r||"");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,o=>`<ul>${o.trimEnd().split(`
2
+ `).map(s=>s.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(o=>{const n=o.trim();return n?/^<(h1|h2|h3|ul|pre)/.test(n)?n:`<p>${n.replace(/\n/g,"<br />")}</p>`:""}).join(""),e}function I({attributes:r={},rules:e={},onChange:o}){const{id:n="",label:s,rows:i=6,MuiAttributes:g={}}=r,{sx:h,...x}=g,[u,c]=p.useState(r.value||""),[d,f]=p.useState(!1);a.useUpdateEffect(()=>{c(r.value||"")},[r.value]);const $=e?.validation?.some(t=>t.rule==="mandatory"||t.rule==="mandatoryselect")||!1,b=t=>{const m=t.target.value;c(m),o?.({id:n,value:m})};return l.jsxs(y,{required:$,component:"fieldset",fullWidth:!0,children:[l.jsxs(w,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",mb:1},children:[s?l.jsx(k,{component:"legend",children:s}):l.jsx("span",{}),l.jsx(j,{size:"small",variant:"outlined",onClick:()=>f(t=>!t),sx:{borderRadius:"10px",textTransform:"none"},children:d?"Write":"Preview"})]}),d?l.jsx(v,{"data-testid":"markdown-preview",dangerouslySetInnerHTML:{__html:M(u)},sx:{minHeight:t=>t.spacing(i*3),p:2,borderRadius:"10px",border:t=>`1px solid ${S.alpha(t.palette.text.primary,.12)}`,backgroundColor:t=>t.palette.background.paper,"& :first-of-type":{mt:0},"& :last-child":{mb:0}}}):l.jsx(q,{id:n||void 0,value:u,onChange:b,multiline:!0,minRows:i,fullWidth:!0,placeholder:"Write markdown…",...x,sx:a.mergeSx(a.premiumInputSx,h),slotProps:{htmlInput:{"aria-label":s||"markdown editor"}}})]})}exports.default=I;