dynamic-mui 2.1.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 (137) hide show
  1. package/README.md +355 -37
  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 +123 -2
  16. package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +9 -0
  17. package/dist/components/controls/CheckBox/checkbox.d.ts +1 -1
  18. package/dist/components/controls/ChipSelect/chipselect.d.ts +1 -1
  19. package/dist/components/controls/EditableTable/editabletable.d.ts +2 -0
  20. package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -0
  21. package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
  22. package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
  23. package/dist/components/controls/NpsScale/npsscale.d.ts +3 -0
  24. package/dist/components/controls/NumberField/numberfield.d.ts +1 -1
  25. package/dist/components/controls/PasswordField/passwordfield.d.ts +1 -1
  26. package/dist/components/controls/Radio/radio.d.ts +1 -1
  27. package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +3 -0
  28. package/dist/components/controls/Select/select.d.ts +1 -1
  29. package/dist/components/controls/Switch/switch.d.ts +1 -1
  30. package/dist/components/controls/TextField/textfield.d.ts +1 -1
  31. package/dist/components/controls/index.d.ts +45 -69
  32. package/dist/consentfield-B7Rm8d3U.js +1 -0
  33. package/dist/consentfield-CBQUR4J5.mjs +78 -0
  34. package/dist/datatable-BIQznwQe.mjs +20 -0
  35. package/dist/datatable-BWlcUP0M.js +1 -0
  36. package/dist/dynamic-mui.cjs +1 -0
  37. package/dist/dynamic-mui.mjs +32 -0
  38. package/dist/editabletable-DCoRmsEO.js +1 -0
  39. package/dist/editabletable-DRlBV8lk.mjs +126 -0
  40. package/dist/fileupload-ByBv1UjT.mjs +172 -0
  41. package/dist/fileupload-Cze3Oc_2.js +1 -0
  42. package/dist/formrepeater-BBkKGLFJ.mjs +71 -0
  43. package/dist/formrepeater-BxJzXoHx.js +1 -0
  44. package/dist/formwizard-BDZE1UDD.js +1 -0
  45. package/dist/formwizard-D2u1bMvK.mjs +83 -0
  46. package/dist/geofield-8WTeZk0Z.mjs +104 -0
  47. package/dist/geofield-Bw3p4NLJ.js +1 -0
  48. package/dist/group-B2mSylHd.mjs +23 -0
  49. package/dist/group-BlfO3ZZf.js +1 -0
  50. package/dist/imagelist-Bn9QhIv7.js +1 -0
  51. package/dist/imagelist-rqmJajHt.mjs +18 -0
  52. package/dist/index-CddjLTWF.mjs +12499 -0
  53. package/dist/index-D08GIfqF.js +43 -0
  54. package/dist/index.d.ts +11 -1
  55. package/dist/intlphone-B_Xn98pU.js +1 -0
  56. package/dist/intlphone-DtQZ12xk.mjs +140 -0
  57. package/dist/keyvaluefield-B_1NeGuP.mjs +125 -0
  58. package/dist/keyvaluefield-DyKCGd32.js +1 -0
  59. package/dist/line-B-DwR1hm.mjs +20 -0
  60. package/dist/line-BkymZu31.js +1 -0
  61. package/dist/lineitemlist-DGo8UOZC.js +1 -0
  62. package/dist/lineitemlist-vGKzJlQx.mjs +166 -0
  63. package/dist/list-7uNWrepS.mjs +20 -0
  64. package/dist/list-C0FgmtQw.js +1 -0
  65. package/dist/locationfield-CeUgxLkQ.mjs +119 -0
  66. package/dist/locationfield-Duyw1ZEz.js +1 -0
  67. package/dist/markdowneditor-B1y-hfny.mjs +90 -0
  68. package/dist/markdowneditor-Db0Un1_Z.js +2 -0
  69. package/dist/matrixfield-C7Sc-YpI.mjs +117 -0
  70. package/dist/matrixfield-CckODuPn.js +1 -0
  71. package/dist/mixChart-C3o184UT.js +1 -0
  72. package/dist/mixChart-ISf3Kbr-.mjs +75 -0
  73. package/dist/multitextbox-BYazIAeG.js +1 -0
  74. package/dist/multitextbox-ide2lvJ6.mjs +78 -0
  75. package/dist/npsscale-C2e88qk_.js +1 -0
  76. package/dist/npsscale-lndz7GEq.mjs +87 -0
  77. package/dist/numberstepper-DitbcvV9.mjs +128 -0
  78. package/dist/numberstepper-DyRjQM_K.js +1 -0
  79. package/dist/pie-CJSL8Sv5.js +1 -0
  80. package/dist/pie-CL29dlh5.mjs +20 -0
  81. package/dist/richtexteditor-CVg-MnKp.js +1 -0
  82. package/dist/richtexteditor-DsC1XC7h.mjs +141 -0
  83. package/dist/s3Upload-B0JeoLkS.js +1 -0
  84. package/dist/s3Upload-dpioZ2c8.mjs +51 -0
  85. package/dist/schema.d.ts +404 -0
  86. package/dist/signature-14OrZriO.mjs +1225 -0
  87. package/dist/signature-D582X6tB.js +2 -0
  88. package/dist/stepper-B-FpcZvT.js +1 -0
  89. package/dist/stepper-CDfEy_C6.mjs +140 -0
  90. package/dist/summaryfield-B08ZmVHh.js +1 -0
  91. package/dist/summaryfield-CTpPlZBG.mjs +96 -0
  92. package/dist/tabs-BIliqFOs.js +1 -0
  93. package/dist/tabs-DDeJCFt8.mjs +39 -0
  94. package/dist/tagsinput-D-q6rRZS.mjs +58 -0
  95. package/dist/tagsinput-qh_lhdFb.js +1 -0
  96. package/dist/types.d.ts +16 -0
  97. package/dist/util/registry.d.ts +29 -0
  98. package/dist/util/resolvers.d.ts +45 -0
  99. package/dist/util/useFormEngine.d.ts +74 -0
  100. package/dist/util/validateSchema.d.ts +23 -0
  101. package/dist/v4-BysszJq8.mjs +30 -0
  102. package/dist/v4-CqdK_b8Y.js +1 -0
  103. package/package.json +36 -11
  104. package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
  105. package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
  106. package/dist/date-utils-CFUUt6NL.js +0 -4
  107. package/dist/date-utils-pGzaKb0p.mjs +0 -477
  108. package/dist/dynamic-mui.cjs.js +0 -469
  109. package/dist/dynamic-mui.es.js +0 -102550
  110. package/dist/index-BW8_rRff.js +0 -7
  111. package/dist/index-BXFVK_GX.js +0 -1
  112. package/dist/index-CVqLvm8B.js +0 -1
  113. package/dist/index-Cr6Wp_S-.mjs +0 -3141
  114. package/dist/index-DA0XouZs.mjs +0 -153
  115. package/dist/index-DKS5Sz9e.js +0 -14
  116. package/dist/index-DcWfyXJp.mjs +0 -92
  117. package/dist/index-MllWgTJ5.mjs +0 -9372
  118. package/dist/index.browser-BSu11T_q.mjs +0 -363
  119. package/dist/index.browser-By7-GABP.js +0 -4
  120. package/dist/loadCognitoIdentity-DtYTy-DW.js +0 -1
  121. package/dist/loadCognitoIdentity-DzdR91GB.mjs +0 -872
  122. package/dist/loadSts-Cic6UToN.mjs +0 -593
  123. package/dist/loadSts-csbFP6zX.js +0 -1
  124. package/dist/main.d.ts +0 -1
  125. package/dist/noAuth-B8ui2kBg.mjs +0 -71
  126. package/dist/noAuth-JPA2o4dt.js +0 -1
  127. package/dist/playground/AIContext.d.ts +0 -18
  128. package/dist/playground/AIPanel.d.ts +0 -10
  129. package/dist/playground/Builder.d.ts +0 -1
  130. package/dist/playground/Canvas.d.ts +0 -9
  131. package/dist/playground/PropertiesEditor.d.ts +0 -10
  132. package/dist/playground/Sidebar.d.ts +0 -1
  133. package/dist/playground/documentation.d.ts +0 -6
  134. package/dist/playground/templates.d.ts +0 -7
  135. package/dist/playground/testData.d.ts +0 -2
  136. package/dist/test/setup.d.ts +0 -0
  137. package/dist/theme/theme.d.ts +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),p=require("@mui/material/Box"),h=require("@mui/material/Paper"),x=require("@mui/material/Divider"),g=require("@mui/material/IconButton"),j=require("@mui/material/Tooltip"),M=require("@mui/material/FormLabel"),q=require("@mui/material/FormControl"),S=require("@mui/icons-material/FormatBold"),R=require("@mui/icons-material/FormatItalic"),y=require("@mui/icons-material/FormatUnderlined"),E=require("@mui/icons-material/FormatListBulleted"),C=require("@mui/icons-material/FormatListNumbered"),L=require("@mui/icons-material/Link"),v=require("@mui/icons-material/FormatClear"),n=require("@mui/material/styles"),o=require("./index-D08GIfqF.js"),U=[{command:"bold",label:"Bold",icon:r.jsx(S,{fontSize:"small"})},{command:"italic",label:"Italic",icon:r.jsx(R,{fontSize:"small"})},{command:"underline",label:"Underline",icon:r.jsx(y,{fontSize:"small"})},{command:"insertUnorderedList",label:"Bulleted list",icon:r.jsx(E,{fontSize:"small"})},{command:"insertOrderedList",label:"Numbered list",icon:r.jsx(C,{fontSize:"small"})},{command:"createLink",label:"Insert link",icon:r.jsx(L,{fontSize:"small"}),prompt:!0},{command:"removeFormat",label:"Clear formatting",icon:r.jsx(v,{fontSize:"small"})}];function k({attributes:a={},onChange:u}){const{id:i="",label:s,minHeight:b=160,MuiAttributes:d={}}=a,l=m.useRef(null);m.useEffect(()=>{const e=l.current;if(!e)return;const t=a.value??"";e.innerHTML!==t&&(e.innerHTML=t)},[a.value]);const f=e=>{l.current?.focus();try{if(e.prompt){const t=window.prompt("Enter a URL");t&&document.execCommand(e.command,!1,t)}else document.execCommand(e.command)}catch{}l.current&&u?.({id:i,value:l.current.innerHTML})},I=e=>{u?.({id:i,value:e.currentTarget.innerHTML})};return r.jsxs(q,{fullWidth:!0,children:[s&&r.jsx(M,{sx:{mb:.75,fontWeight:500},component:"legend",children:s}),r.jsxs(h,{variant:"outlined",sx:e=>({borderRadius:`${o.PREMIUM_RADIUS+2}px`,borderColor:n.alpha(e.palette.text.primary,.12),overflow:"hidden",transition:`box-shadow .2s ${o.PREMIUM_EASING}, border-color .2s ${o.PREMIUM_EASING}`,"&:hover":{borderColor:n.alpha(e.palette.primary.main,.5),boxShadow:`0 2px 10px ${n.alpha(e.palette.common.black,.06)}`},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 3px ${n.alpha(e.palette.primary.main,.16)}`}}),children:[r.jsx(p,{sx:e=>({display:"flex",flexWrap:"wrap",alignItems:"center",gap:.25,px:.75,py:.5,backgroundColor:n.alpha(e.palette.text.primary,.03)}),children:U.map((e,t)=>r.jsxs(m.Fragment,{children:[(t===3||t===5)&&r.jsx(x,{orientation:"vertical",flexItem:!0,sx:{mx:.25,my:.5}}),r.jsx(j,{title:e.label,children:r.jsx(g,{size:"small","aria-label":e.label,onMouseDown:c=>c.preventDefault(),onClick:()=>f(e),sx:c=>({borderRadius:`${o.PREMIUM_RADIUS-2}px`,transition:`background-color .18s ${o.PREMIUM_EASING}, transform .18s ${o.PREMIUM_EASING}`,"&:hover":{backgroundColor:n.alpha(c.palette.primary.main,.1),transform:"translateY(-1px)"}}),children:e.icon})})]},e.command))}),r.jsx(x,{}),r.jsx(p,{id:i,ref:l,role:"textbox","aria-multiline":"true","aria-label":s||"rich text",contentEditable:!0,suppressContentEditableWarning:!0,onInput:I,...d,sx:e=>({minHeight:b,px:1.75,py:1.25,outline:"none",lineHeight:1.6,color:e.palette.text.primary,backgroundColor:e.palette.background.paper,"& p":{margin:"0 0 0.5em"},"& ul, & ol":{paddingLeft:"1.5em",margin:"0 0 0.5em"},"& a":{color:e.palette.primary.main},...d.sx||{}})})]})]})}exports.default=k;
@@ -0,0 +1,141 @@
1
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
+ import c from "react";
3
+ import u from "@mui/material/Box";
4
+ import I from "@mui/material/Paper";
5
+ import x from "@mui/material/Divider";
6
+ import L from "@mui/material/IconButton";
7
+ import y from "@mui/material/Tooltip";
8
+ import v from "@mui/material/FormLabel";
9
+ import S from "@mui/material/FormControl";
10
+ import R from "@mui/icons-material/FormatBold";
11
+ import k from "@mui/icons-material/FormatItalic";
12
+ import F from "@mui/icons-material/FormatUnderlined";
13
+ import M from "@mui/icons-material/FormatListBulleted";
14
+ import w from "@mui/icons-material/FormatListNumbered";
15
+ import T from "@mui/icons-material/Link";
16
+ import z from "@mui/icons-material/FormatClear";
17
+ import { alpha as t } from "@mui/material/styles";
18
+ import { P as l, d as b } from "./index-CddjLTWF.mjs";
19
+ const E = [
20
+ { command: "bold", label: "Bold", icon: /* @__PURE__ */ o(R, { fontSize: "small" }) },
21
+ { command: "italic", label: "Italic", icon: /* @__PURE__ */ o(k, { fontSize: "small" }) },
22
+ { command: "underline", label: "Underline", icon: /* @__PURE__ */ o(F, { fontSize: "small" }) },
23
+ { command: "insertUnorderedList", label: "Bulleted list", icon: /* @__PURE__ */ o(M, { fontSize: "small" }) },
24
+ { command: "insertOrderedList", label: "Numbered list", icon: /* @__PURE__ */ o(w, { fontSize: "small" }) },
25
+ { command: "createLink", label: "Insert link", icon: /* @__PURE__ */ o(T, { fontSize: "small" }), prompt: !0 },
26
+ { command: "removeFormat", label: "Clear formatting", icon: /* @__PURE__ */ o(z, { fontSize: "small" }) }
27
+ ];
28
+ function V({ attributes: a = {}, onChange: s }) {
29
+ const { id: i = "", label: m, minHeight: g = 160, MuiAttributes: f = {} } = a, n = c.useRef(null);
30
+ c.useEffect(() => {
31
+ const r = n.current;
32
+ if (!r) return;
33
+ const e = a.value ?? "";
34
+ r.innerHTML !== e && (r.innerHTML = e);
35
+ }, [a.value]);
36
+ const h = (r) => {
37
+ n.current?.focus();
38
+ try {
39
+ if (r.prompt) {
40
+ const e = window.prompt("Enter a URL");
41
+ e && document.execCommand(r.command, !1, e);
42
+ } else
43
+ document.execCommand(r.command);
44
+ } catch {
45
+ }
46
+ n.current && s?.({ id: i, value: n.current.innerHTML });
47
+ }, C = (r) => {
48
+ s?.({ id: i, value: r.currentTarget.innerHTML });
49
+ };
50
+ return /* @__PURE__ */ d(S, { fullWidth: !0, children: [
51
+ m && /* @__PURE__ */ o(v, { sx: { mb: 0.75, fontWeight: 500 }, component: "legend", children: m }),
52
+ /* @__PURE__ */ d(
53
+ I,
54
+ {
55
+ variant: "outlined",
56
+ sx: (r) => ({
57
+ borderRadius: `${b + 2}px`,
58
+ borderColor: t(r.palette.text.primary, 0.12),
59
+ overflow: "hidden",
60
+ transition: `box-shadow .2s ${l}, border-color .2s ${l}`,
61
+ "&:hover": {
62
+ borderColor: t(r.palette.primary.main, 0.5),
63
+ boxShadow: `0 2px 10px ${t(r.palette.common.black, 0.06)}`
64
+ },
65
+ "&:focus-within": {
66
+ borderColor: r.palette.primary.main,
67
+ boxShadow: `0 0 0 3px ${t(r.palette.primary.main, 0.16)}`
68
+ }
69
+ }),
70
+ children: [
71
+ /* @__PURE__ */ o(
72
+ u,
73
+ {
74
+ sx: (r) => ({
75
+ display: "flex",
76
+ flexWrap: "wrap",
77
+ alignItems: "center",
78
+ gap: 0.25,
79
+ px: 0.75,
80
+ py: 0.5,
81
+ backgroundColor: t(r.palette.text.primary, 0.03)
82
+ }),
83
+ children: E.map((r, e) => /* @__PURE__ */ d(c.Fragment, { children: [
84
+ (e === 3 || e === 5) && /* @__PURE__ */ o(x, { orientation: "vertical", flexItem: !0, sx: { mx: 0.25, my: 0.5 } }),
85
+ /* @__PURE__ */ o(y, { title: r.label, children: /* @__PURE__ */ o(
86
+ L,
87
+ {
88
+ size: "small",
89
+ "aria-label": r.label,
90
+ onMouseDown: (p) => p.preventDefault(),
91
+ onClick: () => h(r),
92
+ sx: (p) => ({
93
+ borderRadius: `${b - 2}px`,
94
+ transition: `background-color .18s ${l}, transform .18s ${l}`,
95
+ "&:hover": {
96
+ backgroundColor: t(p.palette.primary.main, 0.1),
97
+ transform: "translateY(-1px)"
98
+ }
99
+ }),
100
+ children: r.icon
101
+ }
102
+ ) })
103
+ ] }, r.command))
104
+ }
105
+ ),
106
+ /* @__PURE__ */ o(x, {}),
107
+ /* @__PURE__ */ o(
108
+ u,
109
+ {
110
+ id: i,
111
+ ref: n,
112
+ role: "textbox",
113
+ "aria-multiline": "true",
114
+ "aria-label": m || "rich text",
115
+ contentEditable: !0,
116
+ suppressContentEditableWarning: !0,
117
+ onInput: C,
118
+ ...f,
119
+ sx: (r) => ({
120
+ minHeight: g,
121
+ px: 1.75,
122
+ py: 1.25,
123
+ outline: "none",
124
+ lineHeight: 1.6,
125
+ color: r.palette.text.primary,
126
+ backgroundColor: r.palette.background.paper,
127
+ "& p": { margin: "0 0 0.5em" },
128
+ "& ul, & ol": { paddingLeft: "1.5em", margin: "0 0 0.5em" },
129
+ "& a": { color: r.palette.primary.main },
130
+ ...f.sx || {}
131
+ })
132
+ }
133
+ )
134
+ ]
135
+ }
136
+ )
137
+ ] });
138
+ }
139
+ export {
140
+ V as default
141
+ };
@@ -0,0 +1 @@
1
+ "use strict";var y=Object.create;var u=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var E=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of C(o))!R.call(t,n)&&n!==e&&u(t,n,{get:()=>o[n],enumerable:!(r=S(o,n))||r.enumerable});return t};var h=(t,o,e)=>(e=t!=null?y(f(t)):{},E(o||!t||!t.__esModule?u(e,"default",{value:t,enumerable:!0}):e,t));function P(t){const o=(t||"").split(","),e=o[0]?.match(/:(.*?);/);if(o.length<2||!e)throw new Error('uploadToS3: expected a base64 data URL (e.g. "data:image/png;base64,…").');const r=e[1],n=atob(o[1]);let s=n.length;const a=new Uint8Array(s);for(;s--;)a[s]=n.charCodeAt(s);return new Blob([a],{type:r})}async function U(t,o,e,r,n,s=""){if(!n||!e||!r)return console.warn("Missing AWS Config (Pool ID, Bucket, or Region). Returning data URL as fallback."),t;try{let a,i;try{[a,i]=await Promise.all([import("@aws-sdk/client-s3"),import("@aws-sdk/credential-providers")])}catch{throw new Error("uploadToS3 needs the optional AWS SDK. Install it with: npm i @aws-sdk/client-s3 @aws-sdk/credential-providers")}const{S3Client:p,PutObjectCommand:w}=a,{fromCognitoIdentityPool:m}=i,b=new p({region:r,credentials:m({clientConfig:{region:r},identityPoolId:n}),requestChecksumCalculation:"WHEN_REQUIRED",forcePathStyle:!0}),l=P(t);let c=s.trim();c&&!c.endsWith("/")&&(c+="/");const d=c?`${c}${o}`:`signatures/${o}`,g=new w({Bucket:e,Key:d,Body:l,ContentType:l.type});return await b.send(g),`https://${e}/${d}`}catch(a){throw console.error("Error uploading to S3:",a),a}}exports.uploadToS3=U;
@@ -0,0 +1,51 @@
1
+ function b(c) {
2
+ const e = (c || "").split(","), o = e[0]?.match(/:(.*?);/);
3
+ if (e.length < 2 || !o)
4
+ throw new Error('uploadToS3: expected a base64 data URL (e.g. "data:image/png;base64,…").');
5
+ const r = o[1], a = atob(e[1]);
6
+ let n = a.length;
7
+ const t = new Uint8Array(n);
8
+ for (; n--; )
9
+ t[n] = a.charCodeAt(n);
10
+ return new Blob([t], { type: r });
11
+ }
12
+ async function y(c, e, o, r, a, n = "") {
13
+ if (!a || !o || !r)
14
+ return console.warn("Missing AWS Config (Pool ID, Bucket, or Region). Returning data URL as fallback."), c;
15
+ try {
16
+ let t, i;
17
+ try {
18
+ [t, i] = await Promise.all([
19
+ import("@aws-sdk/client-s3"),
20
+ import("@aws-sdk/credential-providers")
21
+ ]);
22
+ } catch {
23
+ throw new Error("uploadToS3 needs the optional AWS SDK. Install it with: npm i @aws-sdk/client-s3 @aws-sdk/credential-providers");
24
+ }
25
+ const { S3Client: u, PutObjectCommand: h } = t, { fromCognitoIdentityPool: p } = i, w = new u({
26
+ region: r,
27
+ credentials: p({
28
+ clientConfig: { region: r },
29
+ identityPoolId: a
30
+ }),
31
+ requestChecksumCalculation: "WHEN_REQUIRED",
32
+ forcePathStyle: !0
33
+ }), l = b(c);
34
+ let s = n.trim();
35
+ s && !s.endsWith("/") && (s += "/");
36
+ const d = s ? `${s}${e}` : `signatures/${e}`, m = new h({
37
+ Bucket: o,
38
+ Key: d,
39
+ Body: l,
40
+ ContentType: l.type
41
+ // Depending on your bucket policy, you might need ACL: 'public-read'
42
+ // ACL: 'public-read',
43
+ });
44
+ return await w.send(m), `https://${o}/${d}`;
45
+ } catch (t) {
46
+ throw console.error("Error uploading to S3:", t), t;
47
+ }
48
+ }
49
+ export {
50
+ y as u
51
+ };
@@ -0,0 +1,404 @@
1
+ import { FormField, RuleExpression } from './types';
2
+ /**
3
+ * TYPED SCHEMA LAYER (additive, authoring-only)
4
+ * ---------------------------------------------
5
+ * A convenience, compile-time layer on top of the loose runtime `FormField`.
6
+ * Authors get autocomplete + type-checking for the common controls, while
7
+ * `defineForm` erases the extra typing and hands FormGenerator the exact
8
+ * `FormField[]` it already expects. Nothing here changes runtime behaviour.
9
+ */
10
+ /** An option entry accepted by option-based controls. */
11
+ export interface TypedOption {
12
+ value: any;
13
+ label: string;
14
+ [k: string]: any;
15
+ }
16
+ /** Options that may be given as bare strings or {value,label} objects. */
17
+ export type LooseOption = string | TypedOption;
18
+ /** Per-field grid/layout hints (subset of runtime `LayoutConfig`). */
19
+ export interface TypedLayout {
20
+ row?: number;
21
+ xs?: number;
22
+ sm?: number;
23
+ md?: number;
24
+ lg?: number;
25
+ xl?: number;
26
+ [k: string]: any;
27
+ }
28
+ /** Typed validation rule for the `rules.validation` array. */
29
+ export interface TypedValidationRule {
30
+ rule: string;
31
+ message?: string;
32
+ value?: any;
33
+ [k: string]: any;
34
+ }
35
+ export interface TypedRules {
36
+ validation?: TypedValidationRule[];
37
+ [k: string]: any;
38
+ }
39
+ /** MUI attribute bag — kept open so any MUI prop still type-checks. */
40
+ export interface TypedMuiAttributes {
41
+ label?: string;
42
+ placeholder?: string;
43
+ helperText?: string;
44
+ variant?: string;
45
+ fullWidth?: boolean;
46
+ [k: string]: any;
47
+ }
48
+ /** Fields shared by every typed variant. */
49
+ export interface TypedFieldBase {
50
+ id: string;
51
+ layout?: TypedLayout;
52
+ rules?: TypedRules;
53
+ visible?: boolean;
54
+ visibleWhen?: RuleExpression | any;
55
+ disabledWhen?: RuleExpression | any;
56
+ requiredWhen?: RuleExpression | any;
57
+ requiredMessage?: string;
58
+ }
59
+ export interface TextFieldField extends TypedFieldBase {
60
+ type: 'textfield';
61
+ props: {
62
+ id: string;
63
+ value?: string;
64
+ multiline?: boolean;
65
+ rows?: number;
66
+ MuiAttributes?: TypedMuiAttributes;
67
+ [k: string]: any;
68
+ };
69
+ }
70
+ export interface NumberFieldField extends TypedFieldBase {
71
+ type: 'numberfield';
72
+ props: {
73
+ id: string;
74
+ value?: number;
75
+ min?: number;
76
+ max?: number;
77
+ step?: number;
78
+ MuiAttributes?: TypedMuiAttributes;
79
+ [k: string]: any;
80
+ };
81
+ }
82
+ export interface PasswordField extends TypedFieldBase {
83
+ type: 'password';
84
+ props: {
85
+ id: string;
86
+ value?: string;
87
+ MuiAttributes?: TypedMuiAttributes;
88
+ [k: string]: any;
89
+ };
90
+ }
91
+ export interface CurrencyField extends TypedFieldBase {
92
+ type: 'currency';
93
+ props: {
94
+ id: string;
95
+ value?: number;
96
+ currency?: string;
97
+ locale?: string;
98
+ MuiAttributes?: TypedMuiAttributes;
99
+ [k: string]: any;
100
+ };
101
+ }
102
+ export interface PhoneField extends TypedFieldBase {
103
+ type: 'phone';
104
+ props: {
105
+ id: string;
106
+ value?: string;
107
+ defaultCountry?: string;
108
+ MuiAttributes?: TypedMuiAttributes;
109
+ [k: string]: any;
110
+ };
111
+ }
112
+ export interface OtpField extends TypedFieldBase {
113
+ type: 'otp';
114
+ props: {
115
+ id: string;
116
+ value?: string;
117
+ length?: number;
118
+ MuiAttributes?: TypedMuiAttributes;
119
+ [k: string]: any;
120
+ };
121
+ }
122
+ export interface SelectField extends TypedFieldBase {
123
+ type: 'select';
124
+ props: {
125
+ id: string;
126
+ value?: any;
127
+ options: TypedOption[];
128
+ multiple?: boolean;
129
+ MuiAttributes?: TypedMuiAttributes;
130
+ MuiBoxAttributes?: any;
131
+ [k: string]: any;
132
+ };
133
+ }
134
+ export interface AutoCompleteField extends TypedFieldBase {
135
+ type: 'autocomplete';
136
+ props: {
137
+ id: string;
138
+ value?: any;
139
+ options: LooseOption[];
140
+ multiple?: boolean;
141
+ MuiAttributes?: TypedMuiAttributes;
142
+ [k: string]: any;
143
+ };
144
+ }
145
+ export interface RadioField extends TypedFieldBase {
146
+ type: 'radio';
147
+ props: {
148
+ id: string;
149
+ value?: any;
150
+ options: LooseOption[];
151
+ row?: boolean;
152
+ MuiAttributes?: TypedMuiAttributes;
153
+ [k: string]: any;
154
+ };
155
+ }
156
+ export interface CheckBoxField extends TypedFieldBase {
157
+ type: 'checkbox';
158
+ props: {
159
+ id: string;
160
+ value?: boolean;
161
+ label?: string;
162
+ MuiAttributes?: TypedMuiAttributes;
163
+ [k: string]: any;
164
+ };
165
+ }
166
+ export interface SwitchField extends TypedFieldBase {
167
+ type: 'switch';
168
+ props: {
169
+ id: string;
170
+ value?: boolean;
171
+ label?: string;
172
+ MuiAttributes?: TypedMuiAttributes;
173
+ [k: string]: any;
174
+ };
175
+ }
176
+ export interface ConsentField extends TypedFieldBase {
177
+ type: 'consent';
178
+ props: {
179
+ id: string;
180
+ value?: boolean;
181
+ label?: string;
182
+ text?: string;
183
+ MuiAttributes?: TypedMuiAttributes;
184
+ [k: string]: any;
185
+ };
186
+ }
187
+ export interface ChipSelectOrToggleField extends TypedFieldBase {
188
+ type: 'chipselect' | 'togglebuttons';
189
+ props: {
190
+ id: string;
191
+ value?: any;
192
+ label?: string;
193
+ options: LooseOption[];
194
+ multiple?: boolean;
195
+ [k: string]: any;
196
+ };
197
+ }
198
+ export interface TagsInputField extends TypedFieldBase {
199
+ type: 'tagsinput';
200
+ props: {
201
+ id: string;
202
+ value?: string[];
203
+ label?: string;
204
+ MuiAttributes?: TypedMuiAttributes;
205
+ [k: string]: any;
206
+ };
207
+ }
208
+ export interface RatingField extends TypedFieldBase {
209
+ type: 'rating';
210
+ props: {
211
+ id: string;
212
+ value?: number;
213
+ max?: number;
214
+ precision?: number;
215
+ label?: string;
216
+ [k: string]: any;
217
+ };
218
+ }
219
+ export interface SliderField extends TypedFieldBase {
220
+ type: 'slider';
221
+ props: {
222
+ id: string;
223
+ value?: number | number[];
224
+ min?: number;
225
+ max?: number;
226
+ step?: number;
227
+ marks?: boolean | {
228
+ value: number;
229
+ label?: string;
230
+ }[];
231
+ label?: string;
232
+ [k: string]: any;
233
+ };
234
+ }
235
+ export interface ColorPickerField extends TypedFieldBase {
236
+ type: 'colorpicker';
237
+ props: {
238
+ id: string;
239
+ value?: string;
240
+ label?: string;
241
+ [k: string]: any;
242
+ };
243
+ }
244
+ export interface DateTimeField extends TypedFieldBase {
245
+ type: 'datetime' | 'datetimepicker' | 'timepicker' | 'daterangepicker';
246
+ props: {
247
+ id: string;
248
+ value?: any;
249
+ format?: string;
250
+ MuiAttributes?: TypedMuiAttributes;
251
+ [k: string]: any;
252
+ };
253
+ }
254
+ export interface FileUploadField extends TypedFieldBase {
255
+ type: 'fileupload';
256
+ props: {
257
+ id: string;
258
+ value?: any;
259
+ accept?: string;
260
+ multiple?: boolean;
261
+ MuiAttributes?: TypedMuiAttributes;
262
+ [k: string]: any;
263
+ };
264
+ }
265
+ export interface SignatureField extends TypedFieldBase {
266
+ type: 'signature';
267
+ props: {
268
+ id: string;
269
+ value?: any;
270
+ MuiAttributes?: TypedMuiAttributes;
271
+ [k: string]: any;
272
+ };
273
+ }
274
+ export interface MarkdownField extends TypedFieldBase {
275
+ type: 'markdown';
276
+ props: {
277
+ id: string;
278
+ value?: string;
279
+ MuiAttributes?: TypedMuiAttributes;
280
+ [k: string]: any;
281
+ };
282
+ }
283
+ export interface KeyValueField extends TypedFieldBase {
284
+ type: 'keyvalue';
285
+ props: {
286
+ id: string;
287
+ value?: Record<string, any> | {
288
+ key: string;
289
+ value: any;
290
+ }[];
291
+ label?: string;
292
+ [k: string]: any;
293
+ };
294
+ }
295
+ export interface MatrixField extends TypedFieldBase {
296
+ type: 'matrix';
297
+ props: {
298
+ id: string;
299
+ value?: any;
300
+ rows?: LooseOption[];
301
+ columns?: LooseOption[];
302
+ [k: string]: any;
303
+ };
304
+ }
305
+ export interface AddressField extends TypedFieldBase {
306
+ type: 'address';
307
+ props: {
308
+ id: string;
309
+ value?: any;
310
+ MuiAttributes?: TypedMuiAttributes;
311
+ [k: string]: any;
312
+ };
313
+ }
314
+ export interface GeoField extends TypedFieldBase {
315
+ type: 'geo';
316
+ props: {
317
+ id: string;
318
+ value?: any;
319
+ [k: string]: any;
320
+ };
321
+ }
322
+ export interface CascadeSelectField extends TypedFieldBase {
323
+ type: 'cascadeselect';
324
+ props: {
325
+ id: string;
326
+ value?: any;
327
+ options: any[];
328
+ [k: string]: any;
329
+ };
330
+ }
331
+ export interface ComputedField extends TypedFieldBase {
332
+ type: 'computed';
333
+ props: {
334
+ id: string;
335
+ formula: string;
336
+ MuiAttributes?: TypedMuiAttributes;
337
+ [k: string]: any;
338
+ };
339
+ formula?: string;
340
+ }
341
+ export interface AlertField extends TypedFieldBase {
342
+ type: 'alert';
343
+ props: {
344
+ id: string;
345
+ severity?: 'error' | 'warning' | 'info' | 'success';
346
+ message?: string;
347
+ MuiAttributes?: TypedMuiAttributes;
348
+ [k: string]: any;
349
+ };
350
+ }
351
+ export interface TypographyField extends TypedFieldBase {
352
+ type: 'typography';
353
+ props: {
354
+ id: string;
355
+ value?: string;
356
+ variant?: string;
357
+ MuiAttributes?: TypedMuiAttributes;
358
+ [k: string]: any;
359
+ };
360
+ }
361
+ export interface ButtonField extends TypedFieldBase {
362
+ type: 'button';
363
+ props: {
364
+ id: string;
365
+ label?: string;
366
+ action?: string;
367
+ MuiAttributes?: TypedMuiAttributes;
368
+ [k: string]: any;
369
+ };
370
+ }
371
+ export interface DividerField extends TypedFieldBase {
372
+ type: 'divider';
373
+ props?: {
374
+ id?: string;
375
+ [k: string]: any;
376
+ };
377
+ }
378
+ /**
379
+ * Catch-all — any control key still type-checks (e.g. the less-common ones in
380
+ * `config/mui.ts`). Kept permissive on purpose so authors are never blocked.
381
+ * Listed LAST so the specific variants win discrimination when they match.
382
+ */
383
+ export interface GenericField {
384
+ type: string;
385
+ id?: string;
386
+ props?: Record<string, any>;
387
+ layout?: TypedLayout;
388
+ rules?: TypedRules;
389
+ visibleWhen?: RuleExpression | any;
390
+ disabledWhen?: RuleExpression | any;
391
+ requiredWhen?: RuleExpression | any;
392
+ [k: string]: any;
393
+ }
394
+ /** Discriminated union across the common controls (+ a permissive fallback). */
395
+ export type TypedField = TextFieldField | NumberFieldField | PasswordField | CurrencyField | PhoneField | OtpField | SelectField | AutoCompleteField | RadioField | CheckBoxField | SwitchField | ConsentField | ChipSelectOrToggleField | TagsInputField | RatingField | SliderField | ColorPickerField | DateTimeField | FileUploadField | SignatureField | MarkdownField | KeyValueField | MatrixField | AddressField | GeoField | CascadeSelectField | ComputedField | AlertField | TypographyField | ButtonField | DividerField | GenericField;
396
+ /** A complete typed form. */
397
+ export type TypedSchema = TypedField[];
398
+ /**
399
+ * Typed authoring entry point. Accepts a `TypedSchema` (autocompleted +
400
+ * type-checked) and returns the runtime `FormField[]` that FormGenerator
401
+ * consumes. Purely a compile-time convenience — no runtime transformation.
402
+ */
403
+ export declare function defineForm(schema: TypedSchema): FormField[];
404
+ export type { FormField, RuleExpression } from './types';