dynamic-mui 2.2.0 → 2.3.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 (166) hide show
  1. package/README.md +142 -5
  2. package/dist/accordion-DqBdGRim.mjs +23 -0
  3. package/dist/accordion-lvbD_BpX.js +1 -0
  4. package/dist/addressfield-CGX3UppE.mjs +152 -0
  5. package/dist/addressfield-DDG15fqJ.js +1 -0
  6. package/dist/asyncautocomplete-BAfBR9P7.mjs +89 -0
  7. package/dist/asyncautocomplete-w9q_1DWt.js +1 -0
  8. package/dist/bar-BzO7tvYJ.mjs +20 -0
  9. package/dist/bar-DEVxyUVS.js +1 -0
  10. package/dist/cascadeselect-C3QVfoig.mjs +64 -0
  11. package/dist/cascadeselect-DzbhK9en.js +1 -0
  12. package/dist/colorpicker-5qmEq7ZI.js +1 -0
  13. package/dist/colorpicker-DhNZulJY.mjs +98 -0
  14. package/dist/components/DynamicComponent.d.ts +2 -0
  15. package/dist/components/FormGenerator.d.ts +99 -10
  16. package/dist/components/controls/index.d.ts +45 -79
  17. package/dist/consentfield-B7Rm8d3U.js +1 -0
  18. package/dist/consentfield-CBQUR4J5.mjs +78 -0
  19. package/dist/datatable-BIQznwQe.mjs +20 -0
  20. package/dist/datatable-BWlcUP0M.js +1 -0
  21. package/dist/dynamic-mui.cjs +1 -0
  22. package/dist/dynamic-mui.mjs +32 -0
  23. package/dist/editabletable-DCoRmsEO.js +1 -0
  24. package/dist/editabletable-DRlBV8lk.mjs +126 -0
  25. package/dist/fileupload-ByBv1UjT.mjs +172 -0
  26. package/dist/fileupload-Cze3Oc_2.js +1 -0
  27. package/dist/formrepeater-BBkKGLFJ.mjs +71 -0
  28. package/dist/formrepeater-BxJzXoHx.js +1 -0
  29. package/dist/formwizard-BDZE1UDD.js +1 -0
  30. package/dist/formwizard-D2u1bMvK.mjs +83 -0
  31. package/dist/geofield-8WTeZk0Z.mjs +104 -0
  32. package/dist/geofield-Bw3p4NLJ.js +1 -0
  33. package/dist/group-B2mSylHd.mjs +23 -0
  34. package/dist/group-BlfO3ZZf.js +1 -0
  35. package/dist/imagelist-Bn9QhIv7.js +1 -0
  36. package/dist/imagelist-rqmJajHt.mjs +18 -0
  37. package/dist/index-CddjLTWF.mjs +12499 -0
  38. package/dist/index-D08GIfqF.js +43 -0
  39. package/dist/index.d.ts +9 -1
  40. package/dist/intlphone-B_Xn98pU.js +1 -0
  41. package/dist/intlphone-DtQZ12xk.mjs +140 -0
  42. package/dist/keyvaluefield-B_1NeGuP.mjs +125 -0
  43. package/dist/keyvaluefield-DyKCGd32.js +1 -0
  44. package/dist/line-B-DwR1hm.mjs +20 -0
  45. package/dist/line-BkymZu31.js +1 -0
  46. package/dist/lineitemlist-DGo8UOZC.js +1 -0
  47. package/dist/lineitemlist-vGKzJlQx.mjs +166 -0
  48. package/dist/list-7uNWrepS.mjs +20 -0
  49. package/dist/list-C0FgmtQw.js +1 -0
  50. package/dist/locationfield-CeUgxLkQ.mjs +119 -0
  51. package/dist/locationfield-Duyw1ZEz.js +1 -0
  52. package/dist/markdowneditor-B1y-hfny.mjs +90 -0
  53. package/dist/markdowneditor-Db0Un1_Z.js +2 -0
  54. package/dist/matrixfield-C7Sc-YpI.mjs +117 -0
  55. package/dist/matrixfield-CckODuPn.js +1 -0
  56. package/dist/mixChart-C3o184UT.js +1 -0
  57. package/dist/mixChart-ISf3Kbr-.mjs +75 -0
  58. package/dist/multitextbox-BYazIAeG.js +1 -0
  59. package/dist/multitextbox-ide2lvJ6.mjs +78 -0
  60. package/dist/npsscale-C2e88qk_.js +1 -0
  61. package/dist/npsscale-lndz7GEq.mjs +87 -0
  62. package/dist/numberstepper-DitbcvV9.mjs +128 -0
  63. package/dist/numberstepper-DyRjQM_K.js +1 -0
  64. package/dist/pie-CJSL8Sv5.js +1 -0
  65. package/dist/pie-CL29dlh5.mjs +20 -0
  66. package/dist/richtexteditor-CVg-MnKp.js +1 -0
  67. package/dist/richtexteditor-DsC1XC7h.mjs +141 -0
  68. package/dist/s3Upload-B0JeoLkS.js +1 -0
  69. package/dist/s3Upload-dpioZ2c8.mjs +51 -0
  70. package/dist/signature-14OrZriO.mjs +1225 -0
  71. package/dist/signature-D582X6tB.js +2 -0
  72. package/dist/stepper-B-FpcZvT.js +1 -0
  73. package/dist/stepper-CDfEy_C6.mjs +140 -0
  74. package/dist/summaryfield-B08ZmVHh.js +1 -0
  75. package/dist/summaryfield-CTpPlZBG.mjs +96 -0
  76. package/dist/tabs-BIliqFOs.js +1 -0
  77. package/dist/tabs-DDeJCFt8.mjs +39 -0
  78. package/dist/tagsinput-D-q6rRZS.mjs +58 -0
  79. package/dist/tagsinput-qh_lhdFb.js +1 -0
  80. package/dist/util/registry.d.ts +29 -0
  81. package/dist/util/resolvers.d.ts +45 -0
  82. package/dist/util/useFormEngine.d.ts +74 -0
  83. package/dist/util/validateSchema.d.ts +23 -0
  84. package/dist/v4-BysszJq8.mjs +30 -0
  85. package/dist/v4-CqdK_b8Y.js +1 -0
  86. package/package.json +36 -11
  87. package/dist/AxisSharedComponents-BbsKw1BT.js +0 -3
  88. package/dist/AxisSharedComponents-xLtpOLH_.mjs +0 -605
  89. package/dist/ChartsAxis-CANvBdY9.mjs +0 -47
  90. package/dist/ChartsAxis-EZ7m_KrU.js +0 -1
  91. package/dist/ChartsGrid-BCRTvNTr.js +0 -3
  92. package/dist/ChartsGrid-C_HT7qpL.mjs +0 -381
  93. package/dist/ChartsWrapper-CM7EDyAK.js +0 -5
  94. package/dist/ChartsWrapper-CO5_Z6BD.mjs +0 -1878
  95. package/dist/ChartsXAxis-CPmuCRhq.mjs +0 -487
  96. package/dist/ChartsXAxis-DFFY1sPg.js +0 -3
  97. package/dist/ChartsYAxis-DLUMr9vG.mjs +0 -392
  98. package/dist/ChartsYAxis-fpevi1sP.js +0 -1
  99. package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
  100. package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
  101. package/dist/clampAngle-BvZjnf53.mjs +0 -11
  102. package/dist/clampAngle-DpAsDoeT.js +0 -1
  103. package/dist/createSelector-B-9FwV16.mjs +0 -430
  104. package/dist/createSelector-f0oqn8Lr.js +0 -7
  105. package/dist/date-utils-CFUUt6NL.js +0 -4
  106. package/dist/date-utils-pGzaKb0p.mjs +0 -477
  107. package/dist/dynamic-mui.cjs.js +0 -1
  108. package/dist/dynamic-mui.es.js +0 -22
  109. package/dist/index--8Zky9Oh.js +0 -299
  110. package/dist/index-6WTs1Xy_.js +0 -1
  111. package/dist/index-B1R1akM2.js +0 -1
  112. package/dist/index-BW8_rRff.js +0 -7
  113. package/dist/index-BXFVK_GX.js +0 -1
  114. package/dist/index-B_KNUTjy.js +0 -1
  115. package/dist/index-BhaKvHkU.mjs +0 -62051
  116. package/dist/index-Bif92ima.js +0 -1
  117. package/dist/index-BnZOu8CL.js +0 -1
  118. package/dist/index-CDxpgRlR.mjs +0 -7
  119. package/dist/index-CThMfvtJ.mjs +0 -2555
  120. package/dist/index-CVqLvm8B.js +0 -1
  121. package/dist/index-CodJBIn6.mjs +0 -1665
  122. package/dist/index-Cr6Wp_S-.mjs +0 -3141
  123. package/dist/index-CslPwsrf.mjs +0 -4
  124. package/dist/index-CuV0MQzZ.mjs +0 -1173
  125. package/dist/index-DA0XouZs.mjs +0 -153
  126. package/dist/index-DKS5Sz9e.js +0 -14
  127. package/dist/index-DSkYYZuW.mjs +0 -4
  128. package/dist/index-DU78_FiA.js +0 -1
  129. package/dist/index-D_mYhgJ0.js +0 -10
  130. package/dist/index-DcWfyXJp.mjs +0 -92
  131. package/dist/index-Dlimbnxj.mjs +0 -2965
  132. package/dist/index-MllWgTJ5.mjs +0 -9372
  133. package/dist/index-in5z9hUb.js +0 -133
  134. package/dist/index-qUW7FnZ-.mjs +0 -20540
  135. package/dist/index.browser-BSu11T_q.mjs +0 -363
  136. package/dist/index.browser-By7-GABP.js +0 -4
  137. package/dist/isDeepEqual-BHfPvf9U.mjs +0 -393
  138. package/dist/isDeepEqual-CqxZGVRk.js +0 -1
  139. package/dist/loadCognitoIdentity-DtYTy-DW.js +0 -1
  140. package/dist/loadCognitoIdentity-DzdR91GB.mjs +0 -872
  141. package/dist/loadSts-Cic6UToN.mjs +0 -593
  142. package/dist/loadSts-csbFP6zX.js +0 -1
  143. package/dist/main.d.ts +0 -1
  144. package/dist/noAuth-B8ui2kBg.mjs +0 -71
  145. package/dist/noAuth-JPA2o4dt.js +0 -1
  146. package/dist/playground/AIContext.d.ts +0 -18
  147. package/dist/playground/AIPanel.d.ts +0 -10
  148. package/dist/playground/Builder.d.ts +0 -1
  149. package/dist/playground/Canvas.d.ts +0 -9
  150. package/dist/playground/DemoGallery.d.ts +0 -6
  151. package/dist/playground/PropertiesEditor.d.ts +0 -10
  152. package/dist/playground/Sidebar.d.ts +0 -9
  153. package/dist/playground/demoForms.d.ts +0 -3
  154. package/dist/playground/demoRecipes.d.ts +0 -15
  155. package/dist/playground/demoVariants.d.ts +0 -11
  156. package/dist/playground/documentation.d.ts +0 -6
  157. package/dist/playground/templates.d.ts +0 -7
  158. package/dist/playground/testData.d.ts +0 -2
  159. package/dist/test/setup.d.ts +0 -0
  160. package/dist/theme/theme.d.ts +0 -6
  161. package/dist/useAxis-DSbfEtO7.js +0 -3
  162. package/dist/useAxis-SiNBMMWq.mjs +0 -3010
  163. package/dist/useChartContainerProps-Bl3hO-r1.mjs +0 -5418
  164. package/dist/useChartContainerProps-C_C_PZoi.js +0 -12
  165. package/dist/useItemHighlightedGetter-9CIwqsGj.js +0 -1
  166. package/dist/useItemHighlightedGetter-CTISrNdV.mjs +0 -88
package/dist/index.d.ts CHANGED
@@ -1,8 +1,16 @@
1
1
  export { FormGenerator, FormData, ClearFormData, useForm } from './components/FormGenerator';
2
- export type { FormApi, FormMessages, FormGeneratorProps } from './components/FormGenerator';
2
+ export type { FormApi, FormMessages, FormGeneratorProps, SubmitButtonConfig, AsyncValidator } from './components/FormGenerator';
3
3
  export { default as DynamicComponent } from './components/DynamicComponent';
4
4
  export { default as Controls } from './components/controls';
5
5
  export { default as MuiConfig } from './config/mui';
6
+ export { registerControl, registerControls, unregisterControl, getRegisteredControl, hasRegisteredControl, registeredControlTypes, } from './util/registry';
7
+ export type { ControlComponent } from './util/registry';
8
+ export { zodResolver, yupResolver } from './util/resolvers';
9
+ export type { FormResolver, FieldError } from './util/resolvers';
10
+ export { useFormEngine } from './util/useFormEngine';
11
+ export type { FormEngine, FieldState, UseFormEngineOptions } from './util/useFormEngine';
12
+ export { validateSchema } from './util/validateSchema';
13
+ export type { SchemaIssue } from './util/validateSchema';
6
14
  export * from './types';
7
15
  export * from './ai';
8
16
  export * from './schema';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("react"),t=require("./index-D08GIfqF.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,alignItems:"flex-start",children:[o.jsx(I,{select:!0,value:h,onChange:E,size:"small",label:"Country","aria-label":"Country dial code",SelectProps:{renderValue:e=>{const l=n.find(r=>r.code===e)||n[0];return`${l.flag} ${l.dial}`}},sx:t.mergeSx(t.premiumInputSx,{minWidth:120,flexShrink:0,...u}),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,140 @@
1
+ import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
+ import x from "react";
3
+ import { u as G, m as I, a as A, f as k } from "./index-CddjLTWF.mjs";
4
+ import v from "@mui/material/Stack";
5
+ import N from "@mui/material/TextField";
6
+ import F from "@mui/material/MenuItem";
7
+ import K from "@mui/material/FormControl";
8
+ import w from "@mui/material/FormLabel";
9
+ const n = [
10
+ { code: "US", name: "United States", dial: "+1", flag: "🇺🇸" },
11
+ { code: "GB", name: "United Kingdom", dial: "+44", flag: "🇬🇧" },
12
+ { code: "IN", name: "India", dial: "+91", flag: "🇮🇳" },
13
+ { code: "CA", name: "Canada", dial: "+1", flag: "🇨🇦" },
14
+ { code: "AU", name: "Australia", dial: "+61", flag: "🇦🇺" },
15
+ { code: "DE", name: "Germany", dial: "+49", flag: "🇩🇪" },
16
+ { code: "FR", name: "France", dial: "+33", flag: "🇫🇷" },
17
+ { code: "IT", name: "Italy", dial: "+39", flag: "🇮🇹" },
18
+ { code: "ES", name: "Spain", dial: "+34", flag: "🇪🇸" },
19
+ { code: "BR", name: "Brazil", dial: "+55", flag: "🇧🇷" },
20
+ { code: "MX", name: "Mexico", dial: "+52", flag: "🇲🇽" },
21
+ { code: "JP", name: "Japan", dial: "+81", flag: "🇯🇵" },
22
+ { code: "CN", name: "China", dial: "+86", flag: "🇨🇳" },
23
+ { code: "RU", name: "Russia", dial: "+7", flag: "🇷🇺" },
24
+ { code: "ZA", name: "South Africa", dial: "+27", flag: "🇿🇦" },
25
+ { code: "NG", name: "Nigeria", dial: "+234", flag: "🇳🇬" },
26
+ { code: "KE", name: "Kenya", dial: "+254", flag: "🇰🇪" },
27
+ { code: "AE", name: "United Arab Emirates", dial: "+971", flag: "🇦🇪" },
28
+ { code: "SA", name: "Saudi Arabia", dial: "+966", flag: "🇸🇦" },
29
+ { code: "SG", name: "Singapore", dial: "+65", flag: "🇸🇬" },
30
+ { code: "MY", name: "Malaysia", dial: "+60", flag: "🇲🇾" },
31
+ { code: "ID", name: "Indonesia", dial: "+62", flag: "🇮🇩" },
32
+ { code: "PH", name: "Philippines", dial: "+63", flag: "🇵🇭" },
33
+ { code: "TH", name: "Thailand", dial: "+66", flag: "🇹🇭" },
34
+ { code: "VN", name: "Vietnam", dial: "+84", flag: "🇻🇳" },
35
+ { code: "KR", name: "South Korea", dial: "+82", flag: "🇰🇷" },
36
+ { code: "NZ", name: "New Zealand", dial: "+64", flag: "🇳🇿" },
37
+ { code: "IE", name: "Ireland", dial: "+353", flag: "🇮🇪" },
38
+ { code: "NL", name: "Netherlands", dial: "+31", flag: "🇳🇱" },
39
+ { code: "SE", name: "Sweden", dial: "+46", flag: "🇸🇪" },
40
+ { code: "NO", name: "Norway", dial: "+47", flag: "🇳🇴" },
41
+ { code: "DK", name: "Denmark", dial: "+45", flag: "🇩🇰" },
42
+ { code: "CH", name: "Switzerland", dial: "+41", flag: "🇨🇭" },
43
+ { code: "PL", name: "Poland", dial: "+48", flag: "🇵🇱" },
44
+ { code: "PT", name: "Portugal", dial: "+351", flag: "🇵🇹" },
45
+ { code: "GR", name: "Greece", dial: "+30", flag: "🇬🇷" },
46
+ { code: "TR", name: "Turkey", dial: "+90", flag: "🇹🇷" },
47
+ { code: "EG", name: "Egypt", dial: "+20", flag: "🇪🇬" },
48
+ { code: "AR", name: "Argentina", dial: "+54", flag: "🇦🇷" },
49
+ { code: "CL", name: "Chile", dial: "+56", flag: "🇨🇱" }
50
+ ];
51
+ function E(e, r) {
52
+ if (typeof e == "string" && e.trim()) {
53
+ const d = [...n].sort((o, t) => t.dial.length - o.dial.length).find((o) => e.startsWith(o.dial));
54
+ if (d)
55
+ return { code: d.code, number: e.slice(d.dial.length).trim() };
56
+ }
57
+ return { code: r, number: "" };
58
+ }
59
+ function Z({ attributes: e = {}, rules: r = {}, onChange: f }) {
60
+ const {
61
+ id: d = "",
62
+ defaultCountry: o = "US",
63
+ label: t,
64
+ MuiAttributes: P = {}
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(() => {
67
+ const a = E(e.value, g);
68
+ h(a.code), b(a.number);
69
+ }, [e.value]);
70
+ const y = r?.validation?.some(
71
+ (a) => a.rule === "mandatory" || a.rule === "mandatoryselect"
72
+ ) || !1, C = (a, l) => {
73
+ const i = n.find((T) => T.code === a) || n[0];
74
+ f?.({
75
+ id: d,
76
+ value: `${i.dial} ${l}`.trim(),
77
+ option: { country: i.code, dial: i.dial, number: l }
78
+ });
79
+ }, U = (a) => {
80
+ const l = a.target.value;
81
+ h(l), C(l, S);
82
+ }, M = (a) => {
83
+ b(a.value), C(p, a.value);
84
+ };
85
+ return /* @__PURE__ */ m(K, { component: "fieldset", fullWidth: !0, children: [
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: [
88
+ /* @__PURE__ */ c(
89
+ N,
90
+ {
91
+ select: !0,
92
+ value: p,
93
+ onChange: U,
94
+ size: "small",
95
+ label: "Country",
96
+ "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
+ sx: I(A, {
104
+ minWidth: 120,
105
+ flexShrink: 0,
106
+ ...s
107
+ }),
108
+ children: n.map((a) => /* @__PURE__ */ m(F, { value: a.code, children: [
109
+ a.flag,
110
+ " ",
111
+ a.name,
112
+ " (",
113
+ a.dial,
114
+ ")"
115
+ ] }, a.code))
116
+ }
117
+ ),
118
+ /* @__PURE__ */ c(
119
+ k,
120
+ {
121
+ customInput: N,
122
+ format: "### ### ####",
123
+ mask: "_",
124
+ value: S,
125
+ onValueChange: M,
126
+ fullWidth: !0,
127
+ required: y,
128
+ label: "Phone number",
129
+ id: d,
130
+ name: "intlphone",
131
+ ...R,
132
+ sx: I(A, s)
133
+ }
134
+ )
135
+ ] })
136
+ ] });
137
+ }
138
+ export {
139
+ Z as default
140
+ };
@@ -0,0 +1,125 @@
1
+ import { jsxs as g, jsx as a } from "react/jsx-runtime";
2
+ import W from "react";
3
+ import v from "@mui/material/Stack";
4
+ import k from "@mui/material/TextField";
5
+ import E from "@mui/material/IconButton";
6
+ import L from "@mui/material/Button";
7
+ import T from "@mui/material/FormControl";
8
+ import q from "@mui/material/FormLabel";
9
+ import w from "@mui/material/FormHelperText";
10
+ import B from "@mui/icons-material/Add";
11
+ import K from "@mui/icons-material/Close";
12
+ import { u as V, m as b, a as A } from "./index-CddjLTWF.mjs";
13
+ function C(t) {
14
+ return Array.isArray(t) ? t.map((r) => ({
15
+ key: r?.key ?? "",
16
+ value: r?.value ?? ""
17
+ })) : t && typeof t == "object" ? Object.keys(t).map((r) => ({ key: r, value: String(t[r] ?? "") })) : [];
18
+ }
19
+ function H(t) {
20
+ const r = {};
21
+ return t.forEach((n) => {
22
+ n.key !== "" && (r[n.key] = n.value);
23
+ }), r;
24
+ }
25
+ function Z({ attributes: t = {}, rules: r = {}, onChange: n }) {
26
+ const {
27
+ MuiAttributes: S = {},
28
+ id: I = "",
29
+ keyLabel: R = "Key",
30
+ valueLabel: z = "Value",
31
+ label: u
32
+ } = t, { sx: d, ...f } = S, [i, s] = W.useState(() => C(t.value)), p = r?.validation?.some(
33
+ (e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
34
+ ) || !1;
35
+ V(() => {
36
+ s(C(t.value));
37
+ }, [t.value]);
38
+ const c = (e) => {
39
+ n?.({ id: I, value: H(e), option: e });
40
+ }, y = (e, o, l) => {
41
+ const m = i.map((x, M) => M === e ? { ...x, [o]: l } : x);
42
+ s(m), c(m);
43
+ }, F = () => {
44
+ const e = [...i, { key: "", value: "" }];
45
+ s(e), c(e);
46
+ }, j = (e) => {
47
+ const o = i.filter((l, m) => m !== e);
48
+ s(o), c(o);
49
+ }, h = p && i.filter((e) => e.key !== "").length === 0;
50
+ return /* @__PURE__ */ g(T, { component: "fieldset", error: h, fullWidth: !0, children: [
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,
54
+ {
55
+ direction: "row",
56
+ spacing: 1,
57
+ alignItems: "center",
58
+ children: [
59
+ /* @__PURE__ */ a(
60
+ k,
61
+ {
62
+ ...f,
63
+ label: R,
64
+ value: e.key,
65
+ onChange: (l) => y(o, "key", l.target.value),
66
+ size: "small",
67
+ fullWidth: !0,
68
+ sx: b(A, d)
69
+ }
70
+ ),
71
+ /* @__PURE__ */ a(
72
+ k,
73
+ {
74
+ ...f,
75
+ label: z,
76
+ value: e.value,
77
+ onChange: (l) => y(o, "value", l.target.value),
78
+ size: "small",
79
+ fullWidth: !0,
80
+ sx: b(A, d)
81
+ }
82
+ ),
83
+ /* @__PURE__ */ a(
84
+ E,
85
+ {
86
+ "aria-label": `Remove ${e.key || "row"}`,
87
+ onClick: () => j(o),
88
+ size: "small",
89
+ sx: {
90
+ borderRadius: 2,
91
+ color: "text.secondary",
92
+ "&:hover": { color: "error.main" }
93
+ },
94
+ children: /* @__PURE__ */ a(K, { fontSize: "small" })
95
+ }
96
+ )
97
+ ]
98
+ },
99
+ o
100
+ )) }),
101
+ /* @__PURE__ */ a(
102
+ L,
103
+ {
104
+ onClick: F,
105
+ startIcon: /* @__PURE__ */ a(B, {}),
106
+ size: "small",
107
+ variant: "text",
108
+ sx: {
109
+ alignSelf: "flex-start",
110
+ mt: 1,
111
+ borderRadius: 2,
112
+ textTransform: "none",
113
+ fontWeight: 600
114
+ },
115
+ children: "Add"
116
+ }
117
+ ),
118
+ h && /* @__PURE__ */ a(w, { children: r?.validation?.find(
119
+ (e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
120
+ )?.message || "At least one entry is required" })
121
+ ] });
122
+ }
123
+ export {
124
+ Z as default
125
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),z=require("react"),v=require("@mui/material/Stack"),j=require("@mui/material/TextField"),F=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("./index-D08GIfqF.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]=z.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(F,{"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,20 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import o, { Suspense as n } from "react";
3
+ import a from "@mui/material/Box";
4
+ import s from "@mui/material/CircularProgress";
5
+ const f = o.lazy(
6
+ () => import("@mui/x-charts/LineChart").then((r) => ({ default: r.LineChart }))
7
+ );
8
+ function u({ attributes: r = {} }) {
9
+ const { MuiChartAttributes: e = {}, id: i = "" } = r;
10
+ return /* @__PURE__ */ t(
11
+ n,
12
+ {
13
+ fallback: /* @__PURE__ */ t(a, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(s, {}) }),
14
+ children: /* @__PURE__ */ t(f, { height: 300, ...e }, i)
15
+ }
16
+ );
17
+ }
18
+ export {
19
+ u as default
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.create;var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var x=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!h.call(e,i)&&i!==r&&u(e,i,{get:()=>t[i],enumerable:!(s=a(t,i))||s.enumerable});return e};var f=(e,t,r)=>(r=e!=null?o(d(e)):{},x(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("react"),j=require("@mui/material/Box"),p=require("@mui/material/CircularProgress"),y=c.lazy(()=>import("@mui/x-charts/LineChart").then(e=>({default:e.LineChart})));function C({attributes:e={}}){const{MuiChartAttributes:t={},id:r=""}=e;return n.jsx(c.Suspense,{fallback:n.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(p,{})}),children:n.jsx(y,{height:300,...t},r)})}exports.default=C;
@@ -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("./index-D08GIfqF.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 v(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 K({attributes:r={},rules:o={},onChange:d}){const{id:c="",keyPrefix:l="item",showRowBadge:f=!0,readOnly:u=!1,showActions:I=!0,MuiAttributes:j={}}=r,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,y=k(r.value,l),[s,p]=g.useState(()=>v(r.value,y));T.useUpdateEffect(()=>{const e=k(r.value,l),n=v(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:`${y}${e}`,description:"",fee:0}])},R=e=>{const t=s.filter((x,m)=>m!==e).map((x,m)=>({...x,key:`${y}${m+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=K;
@@ -0,0 +1,166 @@
1
+ import { jsx as s, jsxs as O } from "react/jsx-runtime";
2
+ import { useState as N, useEffect as T } from "react";
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-CddjLTWF.mjs";
5
+ function k(r, o) {
6
+ if (Array.isArray(r) && r.length > 0) {
7
+ const c = r[0], a = Object.keys(c).find((d) => d !== "fee");
8
+ if (a)
9
+ return a.replace(/\d+$/, "");
10
+ }
11
+ return o;
12
+ }
13
+ function v(r, o) {
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}`;
16
+ return {
17
+ key: l,
18
+ description: String(f[l] ?? ""),
19
+ fee: Number(d) || 0
20
+ };
21
+ }) : [{ key: `${o}1`, description: "", fee: 0 }];
22
+ }
23
+ function M(r) {
24
+ return r.map((o) => ({
25
+ fee: o.fee,
26
+ [o.key]: o.description
27
+ }));
28
+ }
29
+ function H({ attributes: r = {}, rules: o = {}, onChange: c }) {
30
+ const {
31
+ id: a = "",
32
+ keyPrefix: d = "item",
33
+ /** Set to false to hide the row number badge. Defaults to true. */
34
+ showRowBadge: f = !0,
35
+ /** Set to true to render the Description/Fee fields as read-only and hide the Add/Remove buttons. */
36
+ readOnly: l = !1,
37
+ /** Set to false to hide the Add/Remove buttons while keeping fields editable. Defaults to true. */
38
+ showActions: w = !0,
39
+ MuiAttributes: I = {}
40
+ } = r, P = w && !l, {
41
+ row: b = {},
42
+ rowBadge: A = {},
43
+ description: B = {},
44
+ fee: C = {},
45
+ addButton: $ = {},
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));
48
+ L(() => {
49
+ const e = k(r.value, d), n = v(r.value, e);
50
+ JSON.stringify(n) !== JSON.stringify(i) && p(n);
51
+ }, [r.value]), T(() => {
52
+ c && c({ id: a, value: M(i) });
53
+ }, [i, a]);
54
+ const R = () => {
55
+ const e = i.length + 1;
56
+ p([...i, { key: `${h}${e}`, description: "", fee: 0 }]);
57
+ }, W = (e) => {
58
+ const t = i.filter((y, m) => m !== e).map((y, m) => ({ ...y, key: `${h}${m + 1}` }));
59
+ p(t);
60
+ }, j = (e, n) => {
61
+ const t = [...i];
62
+ t[e] = { ...t[e], description: n }, p(t);
63
+ }, K = (e, n) => {
64
+ const t = [...i];
65
+ t[e] = { ...t[e], fee: Number(n) || 0 }, p(t);
66
+ };
67
+ return /* @__PURE__ */ s(q, { spacing: 1.5, sx: { width: "100%" }, children: i.map((e, n) => /* @__PURE__ */ O(
68
+ z,
69
+ {
70
+ sx: {
71
+ display: "flex",
72
+ gap: 1,
73
+ alignItems: "flex-start",
74
+ p: 1.5,
75
+ border: "1px solid",
76
+ borderColor: "divider",
77
+ borderRadius: 1,
78
+ backgroundColor: "background.paper"
79
+ },
80
+ ...b,
81
+ children: [
82
+ f && /* @__PURE__ */ s(
83
+ E,
84
+ {
85
+ variant: "caption",
86
+ sx: {
87
+ minWidth: 24,
88
+ height: 24,
89
+ borderRadius: "50%",
90
+ backgroundColor: "primary.main",
91
+ color: "primary.contrastText",
92
+ display: "flex",
93
+ alignItems: "center",
94
+ justifyContent: "center",
95
+ fontWeight: 700,
96
+ flexShrink: 0,
97
+ mt: 0.75
98
+ },
99
+ ...A,
100
+ children: n + 1
101
+ }
102
+ ),
103
+ /* @__PURE__ */ s(
104
+ g,
105
+ {
106
+ fullWidth: !0,
107
+ size: "small",
108
+ label: "Description",
109
+ required: u,
110
+ error: u && !e.description,
111
+ helperText: u && !e.description ? "Required" : "",
112
+ value: e.description,
113
+ onChange: (t) => j(n, t.target.value),
114
+ InputProps: { readOnly: l },
115
+ ...B
116
+ }
117
+ ),
118
+ /* @__PURE__ */ s(
119
+ g,
120
+ {
121
+ size: "small",
122
+ label: "Fee",
123
+ type: "number",
124
+ sx: { minWidth: 120 },
125
+ required: u,
126
+ value: e.fee,
127
+ 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
+ onWheel: (t) => t.target.blur(),
134
+ ...C
135
+ }
136
+ ),
137
+ P && (n === i.length - 1 ? /* @__PURE__ */ s(
138
+ D,
139
+ {
140
+ variant: "contained",
141
+ color: "primary",
142
+ onClick: R,
143
+ sx: { minWidth: 40, px: 1, height: 40, flexShrink: 0 },
144
+ title: "Add row",
145
+ ...$,
146
+ children: /* @__PURE__ */ s(x, { children: "add" })
147
+ }
148
+ ) : /* @__PURE__ */ s(
149
+ J,
150
+ {
151
+ color: "error",
152
+ onClick: () => W(n),
153
+ sx: { height: 40, flexShrink: 0 },
154
+ title: "Remove row",
155
+ ...S,
156
+ children: /* @__PURE__ */ s(x, { children: "delete" })
157
+ }
158
+ ))
159
+ ]
160
+ },
161
+ e.key
162
+ )) });
163
+ }
164
+ export {
165
+ H as default
166
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
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-CddjLTWF.mjs";
4
+ function A({ attributes: i = {} }) {
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: [
7
+ t.icon && /* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(L, { children: t.icon }) }),
8
+ /* @__PURE__ */ r(
9
+ p,
10
+ {
11
+ primary: t.primary,
12
+ secondary: t.secondary,
13
+ ...t.MuiListItemTextAttributes
14
+ }
15
+ )
16
+ ] }, c)) });
17
+ }
18
+ export {
19
+ A as default
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@mui/material"),i=require("./index-D08GIfqF.js");function a({attributes:n={}}){const{MuiAttributes:c={},items:s=[]}=n,{sx:u,...o}=c;return e.jsx(r.List,{...o,sx:i.mergeSx(i.premiumSurfaceSx,u),children:(Array.isArray(s)?s:[]).map((t,x)=>e.jsxs(r.ListItem,{...t.MuiListItemAttributes,children:[t.icon&&e.jsx(r.ListItemIcon,{children:e.jsx(r.Icon,{children:t.icon})}),e.jsx(r.ListItemText,{primary:t.primary,secondary:t.secondary,...t.MuiListItemTextAttributes})]},x))})}exports.default=a;
@@ -0,0 +1,119 @@
1
+ import { jsxs as S, jsx as i, Fragment as q } from "react/jsx-runtime";
2
+ import w from "react";
3
+ import { u as O, j as U, V as H, n as R } from "./index-CddjLTWF.mjs";
4
+ import G from "@mui/material/TextField";
5
+ import J from "@mui/material/Button";
6
+ import m from "@mui/material/Box";
7
+ import { Icon as K } from "@mui/material";
8
+ function oe({ attributes: s = {}, rules: v = {}, onChange: r, submitTick: h, messages: F }) {
9
+ const {
10
+ id: d = "",
11
+ MuiAttributes: n = {},
12
+ InputProps: b = {},
13
+ format: x = "",
14
+ buttonText: g = "Update Location",
15
+ buttonIcon: j = "location_on",
16
+ buttonDisplay: k = "both",
17
+ MuiButtonAttributes: P = {},
18
+ disabled: V = !1
19
+ } = s, [a, u] = w.useState({
20
+ value: s.value !== void 0 ? s.value : "",
21
+ helperText: n.helperText || "",
22
+ error: !1
23
+ });
24
+ w.useEffect(() => {
25
+ s.value !== void 0 && s.value !== a.value && u((e) => ({ ...e, value: s.value }));
26
+ }, [s.value]);
27
+ const z = (e) => x ? R(e).format(x) : e, c = (e) => {
28
+ const { validation: t } = v;
29
+ if (t)
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 };
35
+ }
36
+ }
37
+ return { isValid: !0, message: "" };
38
+ };
39
+ O(() => {
40
+ if (h) {
41
+ const e = c(a.value);
42
+ u((t) => ({ ...t, helperText: e.message, error: !e.isValid }));
43
+ }
44
+ }, [h]);
45
+ const A = (e) => {
46
+ const { value: t } = e.target, o = c(t);
47
+ u({ value: t, helperText: o.message, error: !o.isValid });
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 });
51
+ }, E = () => {
52
+ r && r({ id: d, value: a.value, option: "location_update_request" });
53
+ }, M = () => {
54
+ const e = k, t = /* @__PURE__ */ i(K, { children: j });
55
+ switch (e) {
56
+ case "icon":
57
+ return t;
58
+ case "text":
59
+ return /* @__PURE__ */ i(q, { children: g });
60
+ default:
61
+ return /* @__PURE__ */ S(q, { children: [
62
+ t,
63
+ /* @__PURE__ */ i(m, { component: "span", sx: { ml: 0.5 }, children: g })
64
+ ] });
65
+ }
66
+ }, W = v?.validation?.some((e) => e.rule === "mandatory") || !1, p = !!n?.slotProps, f = { ...n };
67
+ let I, T;
68
+ if (p) {
69
+ const e = n.slotProps && n.slotProps.input || {};
70
+ T = {
71
+ ...n.slotProps || {},
72
+ input: { ...e }
73
+ }, delete f.slotProps;
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;
77
+ return /* @__PURE__ */ S(m, { sx: { display: "flex", gap: 1, alignItems: "flex-start", width: "100%" }, children: [
78
+ /* @__PURE__ */ i(m, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ i(
79
+ G,
80
+ {
81
+ fullWidth: !0,
82
+ ...f,
83
+ id: d,
84
+ required: W,
85
+ inputProps: p ? void 0 : I,
86
+ slotProps: p ? T : void 0,
87
+ InputProps: U(b),
88
+ onChange: A,
89
+ onBlur: D,
90
+ value: a.value,
91
+ error: a.error,
92
+ helperText: a.helperText,
93
+ disabled: V
94
+ }
95
+ ) }),
96
+ /* @__PURE__ */ i(
97
+ J,
98
+ {
99
+ variant: "outlined",
100
+ color: "primary",
101
+ size: y === "small" ? "small" : "medium",
102
+ onClick: E,
103
+ disabled: V,
104
+ ...P,
105
+ sx: {
106
+ whiteSpace: "nowrap",
107
+ minWidth: "auto",
108
+ height: C,
109
+ flexShrink: 0,
110
+ ...P?.sx
111
+ },
112
+ children: M()
113
+ }
114
+ )
115
+ ] });
116
+ }
117
+ export {
118
+ oe as default
119
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),B=require("react"),c=require("./index-D08GIfqF.js"),C=require("@mui/material/TextField"),L=require("@mui/material/Button"),v=require("@mui/material/Box"),R=require("@mui/material");function U({attributes:i={},rules:h={},onChange:a,submitTick:m,messages:S}){const{id:d="",MuiAttributes:n={},InputProps:b={},format:g="",buttonText:P="Update Location",buttonIcon:F="location_on",buttonDisplay:w="both",MuiButtonAttributes:q={},disabled:y=!1}=i,[r,u]=B.useState({value:i.value!==void 0?i.value:"",helperText:n.helperText||"",error:!1});B.useEffect(()=>{i.value!==void 0&&i.value!==r.value&&u(e=>({...e,value:i.value}))},[i.value]);const M=e=>g?c.numeral(e).format(g):e,p=e=>{const{validation:t}=h;if(t)for(let o=0;o<t.length;o+=1){const l=t[o],I=c.Validation[l.rule];if(!(typeof I=="function"?I(e,l.value):!0)){const _=l.rule==="mandatory"?S?.required||"This field is required":"";return{isValid:!1,message:l.message||_}}}return{isValid:!0,message:""}};c.useUpdateEffect(()=>{if(m){const e=p(r.value);u(t=>({...t,helperText:e.message,error:!e.isValid}))}},[m]);const k=e=>{const{value:t}=e.target,o=p(t);u({value:t,helperText:o.message,error:!o.isValid})},z=e=>{const{value:t}=e.target,o=M(t),l=p(o);u({value:o,helperText:l.message,error:!l.isValid}),typeof a=="function"&&a({id:d,value:o})},A=()=>{a&&a({id:d,value:r.value,option:"location_update_request"})},D=()=>{const e=w,t=s.jsx(R.Icon,{children:F});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=h?.validation?.some(e=>e.rule==="mandatory")||!1,f=!!n?.slotProps,x={...n};let T,V;if(f){const e=n.slotProps&&n.slotProps.input||{};V={...n.slotProps||{},input:{...e}},delete x.slotProps}else T={...n.inputProps||{}},delete x.inputProps;const O=n.variant||"outlined",j=n.size||"medium",W=j==="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:T,slotProps:f?V:void 0,InputProps:c.getInputProps(b),onChange:k,onBlur:z,value:r.value,error:r.error,helperText:r.helperText,disabled:y})}),s.jsx(L,{variant:"outlined",color:"primary",size:j==="small"?"small":"medium",onClick:A,disabled:y,...q,sx:{whiteSpace:"nowrap",minWidth:"auto",height:W,flexShrink:0,...q?.sx},children:D()})]})}exports.default=U;