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.
- package/README.md +142 -5
- package/dist/accordion-DqBdGRim.mjs +23 -0
- package/dist/accordion-lvbD_BpX.js +1 -0
- package/dist/addressfield-CGX3UppE.mjs +152 -0
- package/dist/addressfield-DDG15fqJ.js +1 -0
- package/dist/asyncautocomplete-BAfBR9P7.mjs +89 -0
- package/dist/asyncautocomplete-w9q_1DWt.js +1 -0
- package/dist/bar-BzO7tvYJ.mjs +20 -0
- package/dist/bar-DEVxyUVS.js +1 -0
- package/dist/cascadeselect-C3QVfoig.mjs +64 -0
- package/dist/cascadeselect-DzbhK9en.js +1 -0
- package/dist/colorpicker-5qmEq7ZI.js +1 -0
- package/dist/colorpicker-DhNZulJY.mjs +98 -0
- package/dist/components/DynamicComponent.d.ts +2 -0
- package/dist/components/FormGenerator.d.ts +99 -10
- package/dist/components/controls/index.d.ts +45 -79
- package/dist/consentfield-B7Rm8d3U.js +1 -0
- package/dist/consentfield-CBQUR4J5.mjs +78 -0
- package/dist/datatable-BIQznwQe.mjs +20 -0
- package/dist/datatable-BWlcUP0M.js +1 -0
- package/dist/dynamic-mui.cjs +1 -0
- package/dist/dynamic-mui.mjs +32 -0
- package/dist/editabletable-DCoRmsEO.js +1 -0
- package/dist/editabletable-DRlBV8lk.mjs +126 -0
- package/dist/fileupload-ByBv1UjT.mjs +172 -0
- package/dist/fileupload-Cze3Oc_2.js +1 -0
- package/dist/formrepeater-BBkKGLFJ.mjs +71 -0
- package/dist/formrepeater-BxJzXoHx.js +1 -0
- package/dist/formwizard-BDZE1UDD.js +1 -0
- package/dist/formwizard-D2u1bMvK.mjs +83 -0
- package/dist/geofield-8WTeZk0Z.mjs +104 -0
- package/dist/geofield-Bw3p4NLJ.js +1 -0
- package/dist/group-B2mSylHd.mjs +23 -0
- package/dist/group-BlfO3ZZf.js +1 -0
- package/dist/imagelist-Bn9QhIv7.js +1 -0
- package/dist/imagelist-rqmJajHt.mjs +18 -0
- package/dist/index-CddjLTWF.mjs +12499 -0
- package/dist/index-D08GIfqF.js +43 -0
- package/dist/index.d.ts +9 -1
- package/dist/intlphone-B_Xn98pU.js +1 -0
- package/dist/intlphone-DtQZ12xk.mjs +140 -0
- package/dist/keyvaluefield-B_1NeGuP.mjs +125 -0
- package/dist/keyvaluefield-DyKCGd32.js +1 -0
- package/dist/line-B-DwR1hm.mjs +20 -0
- package/dist/line-BkymZu31.js +1 -0
- package/dist/lineitemlist-DGo8UOZC.js +1 -0
- package/dist/lineitemlist-vGKzJlQx.mjs +166 -0
- package/dist/list-7uNWrepS.mjs +20 -0
- package/dist/list-C0FgmtQw.js +1 -0
- package/dist/locationfield-CeUgxLkQ.mjs +119 -0
- package/dist/locationfield-Duyw1ZEz.js +1 -0
- package/dist/markdowneditor-B1y-hfny.mjs +90 -0
- package/dist/markdowneditor-Db0Un1_Z.js +2 -0
- package/dist/matrixfield-C7Sc-YpI.mjs +117 -0
- package/dist/matrixfield-CckODuPn.js +1 -0
- package/dist/mixChart-C3o184UT.js +1 -0
- package/dist/mixChart-ISf3Kbr-.mjs +75 -0
- package/dist/multitextbox-BYazIAeG.js +1 -0
- package/dist/multitextbox-ide2lvJ6.mjs +78 -0
- package/dist/npsscale-C2e88qk_.js +1 -0
- package/dist/npsscale-lndz7GEq.mjs +87 -0
- package/dist/numberstepper-DitbcvV9.mjs +128 -0
- package/dist/numberstepper-DyRjQM_K.js +1 -0
- package/dist/pie-CJSL8Sv5.js +1 -0
- package/dist/pie-CL29dlh5.mjs +20 -0
- package/dist/richtexteditor-CVg-MnKp.js +1 -0
- package/dist/richtexteditor-DsC1XC7h.mjs +141 -0
- package/dist/s3Upload-B0JeoLkS.js +1 -0
- package/dist/s3Upload-dpioZ2c8.mjs +51 -0
- package/dist/signature-14OrZriO.mjs +1225 -0
- package/dist/signature-D582X6tB.js +2 -0
- package/dist/stepper-B-FpcZvT.js +1 -0
- package/dist/stepper-CDfEy_C6.mjs +140 -0
- package/dist/summaryfield-B08ZmVHh.js +1 -0
- package/dist/summaryfield-CTpPlZBG.mjs +96 -0
- package/dist/tabs-BIliqFOs.js +1 -0
- package/dist/tabs-DDeJCFt8.mjs +39 -0
- package/dist/tagsinput-D-q6rRZS.mjs +58 -0
- package/dist/tagsinput-qh_lhdFb.js +1 -0
- package/dist/util/registry.d.ts +29 -0
- package/dist/util/resolvers.d.ts +45 -0
- package/dist/util/useFormEngine.d.ts +74 -0
- package/dist/util/validateSchema.d.ts +23 -0
- package/dist/v4-BysszJq8.mjs +30 -0
- package/dist/v4-CqdK_b8Y.js +1 -0
- package/package.json +36 -11
- package/dist/AxisSharedComponents-BbsKw1BT.js +0 -3
- package/dist/AxisSharedComponents-xLtpOLH_.mjs +0 -605
- package/dist/ChartsAxis-CANvBdY9.mjs +0 -47
- package/dist/ChartsAxis-EZ7m_KrU.js +0 -1
- package/dist/ChartsGrid-BCRTvNTr.js +0 -3
- package/dist/ChartsGrid-C_HT7qpL.mjs +0 -381
- package/dist/ChartsWrapper-CM7EDyAK.js +0 -5
- package/dist/ChartsWrapper-CO5_Z6BD.mjs +0 -1878
- package/dist/ChartsXAxis-CPmuCRhq.mjs +0 -487
- package/dist/ChartsXAxis-DFFY1sPg.js +0 -3
- package/dist/ChartsYAxis-DLUMr9vG.mjs +0 -392
- package/dist/ChartsYAxis-fpevi1sP.js +0 -1
- package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
- package/dist/clampAngle-BvZjnf53.mjs +0 -11
- package/dist/clampAngle-DpAsDoeT.js +0 -1
- package/dist/createSelector-B-9FwV16.mjs +0 -430
- package/dist/createSelector-f0oqn8Lr.js +0 -7
- package/dist/date-utils-CFUUt6NL.js +0 -4
- package/dist/date-utils-pGzaKb0p.mjs +0 -477
- package/dist/dynamic-mui.cjs.js +0 -1
- package/dist/dynamic-mui.es.js +0 -22
- package/dist/index--8Zky9Oh.js +0 -299
- package/dist/index-6WTs1Xy_.js +0 -1
- package/dist/index-B1R1akM2.js +0 -1
- package/dist/index-BW8_rRff.js +0 -7
- package/dist/index-BXFVK_GX.js +0 -1
- package/dist/index-B_KNUTjy.js +0 -1
- package/dist/index-BhaKvHkU.mjs +0 -62051
- package/dist/index-Bif92ima.js +0 -1
- package/dist/index-BnZOu8CL.js +0 -1
- package/dist/index-CDxpgRlR.mjs +0 -7
- package/dist/index-CThMfvtJ.mjs +0 -2555
- package/dist/index-CVqLvm8B.js +0 -1
- package/dist/index-CodJBIn6.mjs +0 -1665
- package/dist/index-Cr6Wp_S-.mjs +0 -3141
- package/dist/index-CslPwsrf.mjs +0 -4
- package/dist/index-CuV0MQzZ.mjs +0 -1173
- package/dist/index-DA0XouZs.mjs +0 -153
- package/dist/index-DKS5Sz9e.js +0 -14
- package/dist/index-DSkYYZuW.mjs +0 -4
- package/dist/index-DU78_FiA.js +0 -1
- package/dist/index-D_mYhgJ0.js +0 -10
- package/dist/index-DcWfyXJp.mjs +0 -92
- package/dist/index-Dlimbnxj.mjs +0 -2965
- package/dist/index-MllWgTJ5.mjs +0 -9372
- package/dist/index-in5z9hUb.js +0 -133
- package/dist/index-qUW7FnZ-.mjs +0 -20540
- package/dist/index.browser-BSu11T_q.mjs +0 -363
- package/dist/index.browser-By7-GABP.js +0 -4
- package/dist/isDeepEqual-BHfPvf9U.mjs +0 -393
- package/dist/isDeepEqual-CqxZGVRk.js +0 -1
- package/dist/loadCognitoIdentity-DtYTy-DW.js +0 -1
- package/dist/loadCognitoIdentity-DzdR91GB.mjs +0 -872
- package/dist/loadSts-Cic6UToN.mjs +0 -593
- package/dist/loadSts-csbFP6zX.js +0 -1
- package/dist/main.d.ts +0 -1
- package/dist/noAuth-B8ui2kBg.mjs +0 -71
- package/dist/noAuth-JPA2o4dt.js +0 -1
- package/dist/playground/AIContext.d.ts +0 -18
- package/dist/playground/AIPanel.d.ts +0 -10
- package/dist/playground/Builder.d.ts +0 -1
- package/dist/playground/Canvas.d.ts +0 -9
- package/dist/playground/DemoGallery.d.ts +0 -6
- package/dist/playground/PropertiesEditor.d.ts +0 -10
- package/dist/playground/Sidebar.d.ts +0 -9
- package/dist/playground/demoForms.d.ts +0 -3
- package/dist/playground/demoRecipes.d.ts +0 -15
- package/dist/playground/demoVariants.d.ts +0 -11
- package/dist/playground/documentation.d.ts +0 -6
- package/dist/playground/templates.d.ts +0 -7
- package/dist/playground/testData.d.ts +0 -2
- package/dist/test/setup.d.ts +0 -0
- package/dist/theme/theme.d.ts +0 -6
- package/dist/useAxis-DSbfEtO7.js +0 -3
- package/dist/useAxis-SiNBMMWq.mjs +0 -3010
- package/dist/useChartContainerProps-Bl3hO-r1.mjs +0 -5418
- package/dist/useChartContainerProps-C_C_PZoi.js +0 -12
- package/dist/useItemHighlightedGetter-9CIwqsGj.js +0 -1
- package/dist/useItemHighlightedGetter-CTISrNdV.mjs +0 -88
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs as d, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import u from "react";
|
|
3
|
+
import w from "@mui/material/Box";
|
|
4
|
+
import v from "@mui/material/Stack";
|
|
5
|
+
import b from "@mui/material/Button";
|
|
6
|
+
import k from "@mui/material/TextField";
|
|
7
|
+
import y from "@mui/material/FormControl";
|
|
8
|
+
import C from "@mui/material/FormLabel";
|
|
9
|
+
import { alpha as S } from "@mui/material/styles";
|
|
10
|
+
import { u as j, m as M, a as H } from "./index-CddjLTWF.mjs";
|
|
11
|
+
function R(t) {
|
|
12
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
13
|
+
}
|
|
14
|
+
function T(t) {
|
|
15
|
+
let e = R(t || "");
|
|
16
|
+
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, (a) => `<ul>${a.trimEnd().split(`
|
|
17
|
+
`).map((n) => n.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((a) => {
|
|
18
|
+
const o = a.trim();
|
|
19
|
+
return o ? /^<(h1|h2|h3|ul|pre)/.test(o) ? o : `<p>${o.replace(/\n/g, "<br />")}</p>` : "";
|
|
20
|
+
}).join(""), e;
|
|
21
|
+
}
|
|
22
|
+
function U({ attributes: t = {}, rules: e = {}, onChange: a }) {
|
|
23
|
+
const { id: o = "", label: n, rows: i = 6, MuiAttributes: f = {} } = t, { sx: h, ...g } = f, [m, s] = u.useState(t.value || ""), [p, x] = u.useState(!1);
|
|
24
|
+
j(() => {
|
|
25
|
+
s(t.value || "");
|
|
26
|
+
}, [t.value]);
|
|
27
|
+
const $ = e?.validation?.some(
|
|
28
|
+
(r) => r.rule === "mandatory" || r.rule === "mandatoryselect"
|
|
29
|
+
) || !1;
|
|
30
|
+
return /* @__PURE__ */ d(y, { required: $, component: "fieldset", fullWidth: !0, children: [
|
|
31
|
+
/* @__PURE__ */ d(
|
|
32
|
+
v,
|
|
33
|
+
{
|
|
34
|
+
direction: "row",
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
sx: { mb: 1 },
|
|
38
|
+
children: [
|
|
39
|
+
n ? /* @__PURE__ */ l(C, { component: "legend", children: n }) : /* @__PURE__ */ l("span", {}),
|
|
40
|
+
/* @__PURE__ */ l(
|
|
41
|
+
b,
|
|
42
|
+
{
|
|
43
|
+
size: "small",
|
|
44
|
+
variant: "outlined",
|
|
45
|
+
onClick: () => x((r) => !r),
|
|
46
|
+
sx: { borderRadius: "10px", textTransform: "none" },
|
|
47
|
+
children: p ? "Write" : "Preview"
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
p ? /* @__PURE__ */ l(
|
|
54
|
+
w,
|
|
55
|
+
{
|
|
56
|
+
"data-testid": "markdown-preview",
|
|
57
|
+
dangerouslySetInnerHTML: { __html: T(m) },
|
|
58
|
+
sx: {
|
|
59
|
+
minHeight: (r) => r.spacing(i * 3),
|
|
60
|
+
p: 2,
|
|
61
|
+
borderRadius: "10px",
|
|
62
|
+
border: (r) => `1px solid ${S(r.palette.text.primary, 0.12)}`,
|
|
63
|
+
backgroundColor: (r) => r.palette.background.paper,
|
|
64
|
+
"& :first-of-type": { mt: 0 },
|
|
65
|
+
"& :last-child": { mb: 0 }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
) : /* @__PURE__ */ l(
|
|
69
|
+
k,
|
|
70
|
+
{
|
|
71
|
+
id: o || void 0,
|
|
72
|
+
value: m,
|
|
73
|
+
onChange: (r) => {
|
|
74
|
+
const c = r.target.value;
|
|
75
|
+
s(c), a?.({ id: o, value: c });
|
|
76
|
+
},
|
|
77
|
+
multiline: !0,
|
|
78
|
+
minRows: i,
|
|
79
|
+
fullWidth: !0,
|
|
80
|
+
placeholder: "Write markdown…",
|
|
81
|
+
inputProps: { "aria-label": n || "markdown editor" },
|
|
82
|
+
...g,
|
|
83
|
+
sx: M(H, h)
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
U as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),m=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"),o=require("./index-D08GIfqF.js");function C(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function M(t){let e=C(t||"");return e=e.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),e=e.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),e=e.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),e=e.replace(/(?:^-\s+.*(?:\n|$))+/gm,s=>`<ul>${s.trimEnd().split(`
|
|
2
|
+
`).map(l=>l.replace(/^-\s+(.*)$/,"<li>$1</li>")).join("")}</ul>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,'<a href="$2">$1</a>'),e=e.replace(/`([^`]+)`/g,"<code>$1</code>"),e=e.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),e=e.replace(/\*([^*]+)\*/g,"<em>$1</em>"),e=e.split(/\n{2,}/).map(s=>{const n=s.trim();return n?/^<(h1|h2|h3|ul|pre)/.test(n)?n:`<p>${n.replace(/\n/g,"<br />")}</p>`:""}).join(""),e}function R({attributes:t={},rules:e={},onChange:s}){const{id:n="",label:l,rows:a=6,MuiAttributes:g={}}=t,{sx:h,...x}=g,[u,c]=m.useState(t.value||""),[d,f]=m.useState(!1);o.useUpdateEffect(()=>{c(t.value||"")},[t.value]);const $=e?.validation?.some(r=>r.rule==="mandatory"||r.rule==="mandatoryselect")||!1,b=r=>{const p=r.target.value;c(p),s?.({id:n,value:p})};return i.jsxs(y,{required:$,component:"fieldset",fullWidth:!0,children:[i.jsxs(w,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[l?i.jsx(k,{component:"legend",children:l}):i.jsx("span",{}),i.jsx(j,{size:"small",variant:"outlined",onClick:()=>f(r=>!r),sx:{borderRadius:"10px",textTransform:"none"},children:d?"Write":"Preview"})]}),d?i.jsx(v,{"data-testid":"markdown-preview",dangerouslySetInnerHTML:{__html:M(u)},sx:{minHeight:r=>r.spacing(a*3),p:2,borderRadius:"10px",border:r=>`1px solid ${S.alpha(r.palette.text.primary,.12)}`,backgroundColor:r=>r.palette.background.paper,"& :first-of-type":{mt:0},"& :last-child":{mb:0}}}):i.jsx(q,{id:n||void 0,value:u,onChange:b,multiline:!0,minRows:a,fullWidth:!0,placeholder:"Write markdown…",inputProps:{"aria-label":l||"markdown editor"},...x,sx:o.mergeSx(o.premiumInputSx,h)})]})}exports.default=R;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import w from "@mui/material/Table";
|
|
4
|
+
import B from "@mui/material/TableBody";
|
|
5
|
+
import u from "@mui/material/TableCell";
|
|
6
|
+
import L from "@mui/material/TableContainer";
|
|
7
|
+
import U from "@mui/material/TableHead";
|
|
8
|
+
import M from "@mui/material/TableRow";
|
|
9
|
+
import D from "@mui/material/Radio";
|
|
10
|
+
import G from "@mui/material/Checkbox";
|
|
11
|
+
import J from "@mui/material/FormControl";
|
|
12
|
+
import K from "@mui/material/FormLabel";
|
|
13
|
+
import N from "@mui/material/FormHelperText";
|
|
14
|
+
import { alpha as R } from "@mui/material/styles";
|
|
15
|
+
import { u as O, m as Q, b as V } from "./index-CddjLTWF.mjs";
|
|
16
|
+
const X = (n) => (n || []).map(
|
|
17
|
+
(a) => typeof a == "string" ? { id: a, label: a } : { id: String(a.id), label: a.label ?? String(a.id) }
|
|
18
|
+
), Y = (n) => (n || []).map(
|
|
19
|
+
(a) => typeof a == "string" ? { value: a, label: a } : { value: String(a.value), label: a.label ?? String(a.value) }
|
|
20
|
+
);
|
|
21
|
+
function ce({ attributes: n = {}, rules: a = {}, onChange: $ }) {
|
|
22
|
+
const {
|
|
23
|
+
MuiAttributes: F = {},
|
|
24
|
+
id: h = "",
|
|
25
|
+
rows: b = [],
|
|
26
|
+
columns: g = [],
|
|
27
|
+
multiple: c = !1,
|
|
28
|
+
label: v = ""
|
|
29
|
+
} = n, x = s.useMemo(() => X(b), [b]), y = s.useMemo(() => Y(g), [g]), [o, S] = s.useState(n.value || {}), [C, W] = s.useState(!1), [T, z] = s.useState("");
|
|
30
|
+
O(() => {
|
|
31
|
+
S(n.value || {});
|
|
32
|
+
}, [n.value]);
|
|
33
|
+
const p = a?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, q = (e) => {
|
|
34
|
+
let r = !0, l = "";
|
|
35
|
+
return p && (x.every((m) => {
|
|
36
|
+
const i = e[m.id];
|
|
37
|
+
return c ? Array.isArray(i) && i.length > 0 : i != null && i !== "";
|
|
38
|
+
}) || (r = !1, l = a?.validation?.find(
|
|
39
|
+
(i) => i.rule === "mandatory" || i.rule === "mandatoryselect"
|
|
40
|
+
)?.message || "Required")), { isValid: r, message: l };
|
|
41
|
+
}, k = (e) => {
|
|
42
|
+
S(e);
|
|
43
|
+
const r = q(e);
|
|
44
|
+
W(!r.isValid), z(r.message), $?.({ id: h, value: e, option: e });
|
|
45
|
+
}, H = (e, r) => {
|
|
46
|
+
k({ ...o, [e]: r });
|
|
47
|
+
}, j = (e, r, l) => {
|
|
48
|
+
const f = Array.isArray(o[e]) ? o[e] : [], m = l ? [...f, r] : f.filter((i) => i !== r);
|
|
49
|
+
k({ ...o, [e]: m });
|
|
50
|
+
}, A = (e, r) => {
|
|
51
|
+
const l = o[e];
|
|
52
|
+
return c ? Array.isArray(l) && l.includes(r) : l === r;
|
|
53
|
+
}, { sx: E, ...P } = F;
|
|
54
|
+
return /* @__PURE__ */ d(J, { required: p, error: C, component: "fieldset", fullWidth: !0, children: [
|
|
55
|
+
v && /* @__PURE__ */ t(K, { required: p, error: C, sx: { mb: 1, fontWeight: 600 }, children: v }),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
L,
|
|
58
|
+
{
|
|
59
|
+
sx: Q(V, { width: "100%" }),
|
|
60
|
+
children: /* @__PURE__ */ d(w, { size: "small", ...P, sx: E, children: [
|
|
61
|
+
/* @__PURE__ */ t(U, { children: /* @__PURE__ */ d(
|
|
62
|
+
M,
|
|
63
|
+
{
|
|
64
|
+
sx: (e) => ({
|
|
65
|
+
backgroundColor: R(e.palette.primary.main, 0.06)
|
|
66
|
+
}),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ t(u, { sx: { fontWeight: 700 } }),
|
|
69
|
+
y.map((e) => /* @__PURE__ */ t(u, { align: "center", sx: { fontWeight: 700 }, children: e.label }, e.value))
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) }),
|
|
73
|
+
/* @__PURE__ */ t(B, { children: x.map((e) => /* @__PURE__ */ d(
|
|
74
|
+
M,
|
|
75
|
+
{
|
|
76
|
+
hover: !0,
|
|
77
|
+
sx: (r) => ({
|
|
78
|
+
transition: "background-color .18s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
79
|
+
"&:hover": {
|
|
80
|
+
backgroundColor: R(r.palette.primary.main, 0.04)
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ t(u, { component: "th", scope: "row", sx: { fontWeight: 500 }, children: e.label }),
|
|
85
|
+
y.map((r) => /* @__PURE__ */ t(u, { align: "center", padding: "checkbox", children: c ? /* @__PURE__ */ t(
|
|
86
|
+
G,
|
|
87
|
+
{
|
|
88
|
+
checked: A(e.id, r.value),
|
|
89
|
+
onChange: (l) => j(e.id, r.value, l.target.checked),
|
|
90
|
+
inputProps: {
|
|
91
|
+
"aria-label": `${e.label} ${r.label}`
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
) : /* @__PURE__ */ t(
|
|
95
|
+
D,
|
|
96
|
+
{
|
|
97
|
+
name: `matrix-${h}-${e.id}`,
|
|
98
|
+
checked: A(e.id, r.value),
|
|
99
|
+
onChange: () => H(e.id, r.value),
|
|
100
|
+
inputProps: {
|
|
101
|
+
"aria-label": `${e.label} ${r.label}`
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
) }, r.value))
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
e.id
|
|
108
|
+
)) })
|
|
109
|
+
] })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
T && /* @__PURE__ */ t(N, { children: T })
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
ce as default
|
|
117
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("react"),w=require("@mui/material/Table"),B=require("@mui/material/TableBody"),c=require("@mui/material/TableCell"),L=require("@mui/material/TableContainer"),O=require("@mui/material/TableHead"),M=require("@mui/material/TableRow"),U=require("@mui/material/Radio"),D=require("@mui/material/Checkbox"),G=require("@mui/material/FormControl"),J=require("@mui/material/FormLabel"),K=require("@mui/material/FormHelperText"),k=require("@mui/material/styles"),x=require("./index-D08GIfqF.js"),N=l=>(l||[]).map(s=>typeof s=="string"?{id:s,label:s}:{id:String(s.id),label:s.label??String(s.id)}),Q=l=>(l||[]).map(s=>typeof s=="string"?{value:s,label:s}:{value:String(s.value),label:s.label??String(s.value)});function V({attributes:l={},rules:s={},onChange:A}){const{MuiAttributes:R={},id:b="",rows:p=[],columns:g=[],multiple:d=!1,label:v=""}=l,f=o.useMemo(()=>N(p),[p]),y=o.useMemo(()=>Q(g),[g]),[i,q]=o.useState(l.value||{}),[j,$]=o.useState(!1),[S,F]=o.useState("");x.useUpdateEffect(()=>{q(l.value||{})},[l.value]);const m=s?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,W=e=>{let r=!0,n="";return m&&(f.every(u=>{const a=e[u.id];return d?Array.isArray(a)&&a.length>0:a!=null&&a!==""})||(r=!1,n=s?.validation?.find(a=>a.rule==="mandatory"||a.rule==="mandatoryselect")?.message||"Required")),{isValid:r,message:n}},C=e=>{q(e);const r=W(e);$(!r.isValid),F(r.message),A?.({id:b,value:e,option:e})},z=(e,r)=>{C({...i,[e]:r})},H=(e,r,n)=>{const h=Array.isArray(i[e])?i[e]:[],u=n?[...h,r]:h.filter(a=>a!==r);C({...i,[e]:u})},T=(e,r)=>{const n=i[e];return d?Array.isArray(n)&&n.includes(r):n===r},{sx:P,...E}=R;return t.jsxs(G,{required:m,error:j,component:"fieldset",fullWidth:!0,children:[v&&t.jsx(J,{required:m,error:j,sx:{mb:1,fontWeight:600},children:v}),t.jsx(L,{sx:x.mergeSx(x.premiumSurfaceSx,{width:"100%"}),children:t.jsxs(w,{size:"small",...E,sx:P,children:[t.jsx(O,{children:t.jsxs(M,{sx:e=>({backgroundColor:k.alpha(e.palette.primary.main,.06)}),children:[t.jsx(c,{sx:{fontWeight:700}}),y.map(e=>t.jsx(c,{align:"center",sx:{fontWeight:700},children:e.label},e.value))]})}),t.jsx(B,{children:f.map(e=>t.jsxs(M,{hover:!0,sx:r=>({transition:"background-color .18s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{backgroundColor:k.alpha(r.palette.primary.main,.04)}}),children:[t.jsx(c,{component:"th",scope:"row",sx:{fontWeight:500},children:e.label}),y.map(r=>t.jsx(c,{align:"center",padding:"checkbox",children:d?t.jsx(D,{checked:T(e.id,r.value),onChange:n=>H(e.id,r.value,n.target.checked),inputProps:{"aria-label":`${e.label} ${r.label}`}}):t.jsx(U,{name:`matrix-${b}-${e.id}`,checked:T(e.id,r.value),onChange:()=>z(e.id,r.value),inputProps:{"aria-label":`${e.label} ${r.label}`}})},r.value))]},e.id))})]})}),S&&t.jsx(K,{children:S})]})}exports.default=V;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.create;var x=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var M=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of f(r))!A.call(t,i)&&i!==e&&x(t,i,{get:()=>r[i],enumerable:!(n=p(r,i))||n.enumerable});return t};var o=(t,r,e)=>(e=t!=null?m(b(t)):{},M(r||!t||!t.__esModule?x(e,"default",{value:t,enumerable:!0}):e,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),c=require("react"),u=require("@mui/material/Box"),y=require("@mui/material/CircularProgress"),P=c.lazy(async()=>{const[{ChartContainer:t},{LinePlot:r},{BarPlot:e},{ChartsXAxis:n},{ChartsYAxis:i},{axisClasses:a}]=await Promise.all([import("@mui/x-charts/ChartContainer"),import("@mui/x-charts/LineChart"),import("@mui/x-charts/BarChart"),import("@mui/x-charts/ChartsXAxis"),import("@mui/x-charts/ChartsYAxis"),import("@mui/x-charts/ChartsAxis")]);return{default:({MuiChartContainerAttributes:h={},MuiChartXAxisAttributes:C={},MuiChartYAxisAttributes:j={},MuiChartSX:d={}})=>s.jsxs(t,{sx:{[`.${a.left} .${a.label}`]:{transform:"translate(-25px, 0)"},[`.${a.right} .${a.label}`]:{transform:"translate(30px, 0)"},...d},...h,children:[s.jsx(e,{}),s.jsx(r,{}),s.jsx(n,{...C}),s.jsx(i,{...j})]})}});function g({attributes:t={}}){const{id:r,MuiBoxAttributes:e={},MuiChartContainerAttributes:n={},MuiChartXAxisAttributes:i={},MuiChartYAxisAttributes:a={},MuiChartSX:l={}}=t;return s.jsx(u,{sx:{width:"100%",maxWidth:600},...e,children:s.jsx(c.Suspense,{fallback:s.jsx(u,{sx:{display:"flex",justifyContent:"center",p:2},children:s.jsx(y,{})}),children:s.jsx(P,{MuiChartContainerAttributes:n,MuiChartXAxisAttributes:i,MuiChartYAxisAttributes:a,MuiChartSX:l})})},r)}exports.default=g;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import c, { Suspense as C } from "react";
|
|
3
|
+
import l from "@mui/material/Box";
|
|
4
|
+
import f from "@mui/material/CircularProgress";
|
|
5
|
+
const d = c.lazy(async () => {
|
|
6
|
+
const [
|
|
7
|
+
{ ChartContainer: i },
|
|
8
|
+
{ LinePlot: s },
|
|
9
|
+
{ BarPlot: a },
|
|
10
|
+
{ ChartsXAxis: e },
|
|
11
|
+
{ ChartsYAxis: n },
|
|
12
|
+
{ axisClasses: r }
|
|
13
|
+
] = await Promise.all([
|
|
14
|
+
import("@mui/x-charts/ChartContainer"),
|
|
15
|
+
import("@mui/x-charts/LineChart"),
|
|
16
|
+
import("@mui/x-charts/BarChart"),
|
|
17
|
+
import("@mui/x-charts/ChartsXAxis"),
|
|
18
|
+
import("@mui/x-charts/ChartsYAxis"),
|
|
19
|
+
import("@mui/x-charts/ChartsAxis")
|
|
20
|
+
]);
|
|
21
|
+
return { default: ({
|
|
22
|
+
MuiChartContainerAttributes: x = {},
|
|
23
|
+
MuiChartXAxisAttributes: m = {},
|
|
24
|
+
MuiChartYAxisAttributes: u = {},
|
|
25
|
+
MuiChartSX: h = {}
|
|
26
|
+
}) => /* @__PURE__ */ p(
|
|
27
|
+
i,
|
|
28
|
+
{
|
|
29
|
+
sx: {
|
|
30
|
+
[`.${r.left} .${r.label}`]: {
|
|
31
|
+
transform: "translate(-25px, 0)"
|
|
32
|
+
},
|
|
33
|
+
[`.${r.right} .${r.label}`]: {
|
|
34
|
+
transform: "translate(30px, 0)"
|
|
35
|
+
},
|
|
36
|
+
...h
|
|
37
|
+
},
|
|
38
|
+
...x,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ t(a, {}),
|
|
41
|
+
/* @__PURE__ */ t(s, {}),
|
|
42
|
+
/* @__PURE__ */ t(e, { ...m }),
|
|
43
|
+
/* @__PURE__ */ t(n, { ...u })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) };
|
|
47
|
+
});
|
|
48
|
+
function P({ attributes: i = {} }) {
|
|
49
|
+
const {
|
|
50
|
+
id: s,
|
|
51
|
+
MuiBoxAttributes: a = {},
|
|
52
|
+
MuiChartContainerAttributes: e = {},
|
|
53
|
+
MuiChartXAxisAttributes: n = {},
|
|
54
|
+
MuiChartYAxisAttributes: r = {},
|
|
55
|
+
MuiChartSX: o = {}
|
|
56
|
+
} = i;
|
|
57
|
+
return /* @__PURE__ */ t(l, { sx: { width: "100%", maxWidth: 600 }, ...a, children: /* @__PURE__ */ t(
|
|
58
|
+
C,
|
|
59
|
+
{
|
|
60
|
+
fallback: /* @__PURE__ */ t(l, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(f, {}) }),
|
|
61
|
+
children: /* @__PURE__ */ t(
|
|
62
|
+
d,
|
|
63
|
+
{
|
|
64
|
+
MuiChartContainerAttributes: e,
|
|
65
|
+
MuiChartXAxisAttributes: n,
|
|
66
|
+
MuiChartYAxisAttributes: r,
|
|
67
|
+
MuiChartSX: o
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
) }, s);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
P as default
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material"),d=require("./index-D08GIfqF.js");function k({attributes:r={},rules:h={},onChange:f,submitTick:v,messages:x}){const{id:o=""}=r,y=x?.required||"Required",p=i.useRef(null),[l,u]=i.useState(()=>{if(r.value&&typeof r.value=="object"){const e=Object.entries(r.value).map(([n,t])=>({key:n,value:String(t)}));if(e.length>0)return e}return[{key:"t1",value:""}]}),c=h?.validation?.some(e=>e.rule==="mandatory")||!1;d.useUpdateEffect(()=>{v&&c&&!l[0]?.value&&p.current?.focus()},[v]),d.useUpdateEffect(()=>{if(r.value&&typeof r.value=="object"){const e=Object.entries(r.value).map(([n,t])=>({key:n,value:String(t)}));JSON.stringify(e)!==JSON.stringify(l)&&u(e.length>0?e:[{key:"t1",value:""}])}else r.value||u([{key:"t1",value:""}])},[r.value]),i.useEffect(()=>{const e=l.reduce((n,t)=>(n[t.key]=t.value,n),{});f&&f({id:o,value:e})},[l,o]);const g=()=>{const e=l.length+1;u([...l,{key:`t${e}`,value:""}])},m=e=>{const n=l.filter((t,I)=>I!==e);u(n)},j=(e,n)=>{const t=[...l];t[e].value=n,u(t)};return s.jsx(a.Stack,{spacing:2,sx:{width:"100%"},children:l.map((e,n)=>s.jsxs(a.Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:[s.jsx(a.TextField,{fullWidth:!0,id:n===0?o:`${o}_${e.key}`,inputRef:n===0?p:void 0,required:c,error:c&&!e.value,helperText:c&&!e.value?y:"",label:`Value ${e.key}`,value:e.value,onChange:t=>j(n,t.target.value),size:"small",sx:d.premiumInputSx}),n===l.length-1?s.jsx(a.Button,{variant:"contained",color:"primary",onClick:g,sx:{minWidth:"40px",p:1},children:s.jsx(a.Icon,{children:"add"})}):s.jsx(a.IconButton,{color:"error",onClick:()=>m(n),children:s.jsx(a.Icon,{children:"remove"})})]},n))})}exports.default=k;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as a, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S, useState as j, useEffect as R } from "react";
|
|
3
|
+
import { Stack as q, Box as w, TextField as O, Button as $, Icon as d, IconButton as B } from "@mui/material";
|
|
4
|
+
import { u as v, a as C } from "./index-CddjLTWF.mjs";
|
|
5
|
+
function T({ attributes: r = {}, rules: p = {}, onChange: i, submitTick: c, messages: m }) {
|
|
6
|
+
const { id: u = "" } = r, h = m?.required || "Required", f = S(null), [t, o] = j(() => {
|
|
7
|
+
if (r.value && typeof r.value == "object") {
|
|
8
|
+
const e = Object.entries(r.value).map(([l, n]) => ({
|
|
9
|
+
key: l,
|
|
10
|
+
value: String(n)
|
|
11
|
+
}));
|
|
12
|
+
if (e.length > 0) return e;
|
|
13
|
+
}
|
|
14
|
+
return [{ key: "t1", value: "" }];
|
|
15
|
+
}), s = p?.validation?.some((e) => e.rule === "mandatory") || !1;
|
|
16
|
+
v(() => {
|
|
17
|
+
c && s && !t[0]?.value && f.current?.focus();
|
|
18
|
+
}, [c]), v(() => {
|
|
19
|
+
if (r.value && typeof r.value == "object") {
|
|
20
|
+
const e = Object.entries(r.value).map(([l, n]) => ({
|
|
21
|
+
key: l,
|
|
22
|
+
value: String(n)
|
|
23
|
+
}));
|
|
24
|
+
JSON.stringify(e) !== JSON.stringify(t) && o(e.length > 0 ? e : [{ key: "t1", value: "" }]);
|
|
25
|
+
} else r.value || o([{ key: "t1", value: "" }]);
|
|
26
|
+
}, [r.value]), R(() => {
|
|
27
|
+
const e = t.reduce((l, n) => (l[n.key] = n.value, l), {});
|
|
28
|
+
i && i({ id: u, value: e });
|
|
29
|
+
}, [t, u]);
|
|
30
|
+
const y = () => {
|
|
31
|
+
const e = t.length + 1;
|
|
32
|
+
o([...t, { key: `t${e}`, value: "" }]);
|
|
33
|
+
}, g = (e) => {
|
|
34
|
+
const l = t.filter((n, I) => I !== e);
|
|
35
|
+
o(l);
|
|
36
|
+
}, x = (e, l) => {
|
|
37
|
+
const n = [...t];
|
|
38
|
+
n[e].value = l, o(n);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ a(q, { spacing: 2, sx: { width: "100%" }, children: t.map((e, l) => /* @__PURE__ */ k(w, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
|
|
41
|
+
/* @__PURE__ */ a(
|
|
42
|
+
O,
|
|
43
|
+
{
|
|
44
|
+
fullWidth: !0,
|
|
45
|
+
id: l === 0 ? u : `${u}_${e.key}`,
|
|
46
|
+
inputRef: l === 0 ? f : void 0,
|
|
47
|
+
required: s,
|
|
48
|
+
error: s && !e.value,
|
|
49
|
+
helperText: s && !e.value ? h : "",
|
|
50
|
+
label: `Value ${e.key}`,
|
|
51
|
+
value: e.value,
|
|
52
|
+
onChange: (n) => x(l, n.target.value),
|
|
53
|
+
size: "small",
|
|
54
|
+
sx: C
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
l === t.length - 1 ? /* @__PURE__ */ a(
|
|
58
|
+
$,
|
|
59
|
+
{
|
|
60
|
+
variant: "contained",
|
|
61
|
+
color: "primary",
|
|
62
|
+
onClick: y,
|
|
63
|
+
sx: { minWidth: "40px", p: 1 },
|
|
64
|
+
children: /* @__PURE__ */ a(d, { children: "add" })
|
|
65
|
+
}
|
|
66
|
+
) : /* @__PURE__ */ a(
|
|
67
|
+
B,
|
|
68
|
+
{
|
|
69
|
+
color: "error",
|
|
70
|
+
onClick: () => g(l),
|
|
71
|
+
children: /* @__PURE__ */ a(d, { children: "remove" })
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }, l)) });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
T as default
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),q=require("@mui/material/Box"),k=require("@mui/material/Button"),S=require("@mui/material/Typography"),$=require("@mui/material/FormControl"),A=require("@mui/material/FormLabel"),N=require("@mui/material/FormHelperText"),n=require("@mui/material/styles"),l=require("./index-D08GIfqF.js");function P({attributes:t={},rules:c={},onChange:j,submitTick:d,messages:M}){const{id:p="",label:s,min:E=0,max:R=10,lowLabel:C="Not likely",highLabel:I="Very likely",MuiAttributes:u={}}=t,w=typeof t.value=="number"?t.value:"",[m,x]=i.useState(w),[U,y]=i.useState(!1),[f,h]=i.useState("");l.useUpdateEffect(()=>{x(typeof t.value=="number"?t.value:"")},[t.value]);const g=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,b=e=>g?typeof e!="number"?{isValid:!1,message:c?.validation?.find(r=>r.rule==="mandatory"||r.rule==="mandatoryselect")?.message||M?.required||"Required"}:{isValid:!0,message:""}:{isValid:!0,message:""};l.useUpdateEffect(()=>{if(d){const e=b(m);y(!e.isValid),h(e.message)}},[d]);const V=e=>{x(e);const a=b(e);y(!a.isValid),h(a.message),j?.({id:p,value:e})},v=[];for(let e=E;e<=R;e+=1)v.push(e);return o.jsxs($,{id:p,required:g,error:U,component:"fieldset",sx:{width:"100%"},children:[s&&o.jsx(A,{sx:{mb:1,fontWeight:500},component:"legend",children:s}),o.jsx(q,{role:"radiogroup","aria-label":s||"nps scale",sx:{display:"flex",flexWrap:"wrap",gap:.75},children:v.map(e=>{const a=m===e;return o.jsx(k,{role:"radio","aria-checked":a,variant:a?"contained":"outlined",color:"primary",onClick:()=>V(e),...u,sx:r=>({minWidth:44,height:44,px:0,fontWeight:600,borderRadius:`${l.PREMIUM_RADIUS}px`,transition:`transform .18s ${l.PREMIUM_EASING}, box-shadow .18s ${l.PREMIUM_EASING}, background-color .18s ${l.PREMIUM_EASING}`,...a?{boxShadow:`0 4px 12px ${n.alpha(r.palette.primary.main,.35)}`}:{borderColor:n.alpha(r.palette.text.primary,.2),"&:hover":{borderColor:r.palette.primary.main,backgroundColor:n.alpha(r.palette.primary.main,.06)}},"&:hover":{transform:"translateY(-1px)",...a?{boxShadow:`0 6px 16px ${n.alpha(r.palette.primary.main,.4)}`}:{borderColor:r.palette.primary.main,backgroundColor:n.alpha(r.palette.primary.main,.06)}},...u.sx||{}}),children:e},e)})}),o.jsxs(q,{sx:{display:"flex",justifyContent:"space-between",mt:.75},children:[o.jsx(S,{variant:"caption",color:"text.secondary",children:C}),o.jsx(S,{variant:"caption",color:"text.secondary",children:I})]}),f&&o.jsx(N,{children:f})]})}exports.default=P;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsxs as S, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import C from "@mui/material/Box";
|
|
4
|
+
import q from "@mui/material/Button";
|
|
5
|
+
import w from "@mui/material/Typography";
|
|
6
|
+
import A from "@mui/material/FormControl";
|
|
7
|
+
import F from "@mui/material/FormLabel";
|
|
8
|
+
import L from "@mui/material/FormHelperText";
|
|
9
|
+
import { alpha as l } from "@mui/material/styles";
|
|
10
|
+
import { u as V, P as s, d as N } from "./index-CddjLTWF.mjs";
|
|
11
|
+
function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: d, messages: M }) {
|
|
12
|
+
const {
|
|
13
|
+
id: m = "",
|
|
14
|
+
label: i,
|
|
15
|
+
min: R = 0,
|
|
16
|
+
max: $ = 10,
|
|
17
|
+
lowLabel: E = "Not likely",
|
|
18
|
+
highLabel: I = "Very likely",
|
|
19
|
+
MuiAttributes: c = {}
|
|
20
|
+
} = a, U = typeof a.value == "number" ? a.value : "", [u, f] = n.useState(U), [W, x] = n.useState(!1), [y, h] = n.useState("");
|
|
21
|
+
V(() => {
|
|
22
|
+
f(typeof a.value == "number" ? a.value : "");
|
|
23
|
+
}, [a.value]);
|
|
24
|
+
const g = p?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, b = (e) => g ? typeof e != "number" ? { isValid: !1, message: p?.validation?.find((r) => r.rule === "mandatory" || r.rule === "mandatoryselect")?.message || M?.required || "Required" } : { isValid: !0, message: "" } : { isValid: !0, message: "" };
|
|
25
|
+
V(() => {
|
|
26
|
+
if (d) {
|
|
27
|
+
const e = b(u);
|
|
28
|
+
x(!e.isValid), h(e.message);
|
|
29
|
+
}
|
|
30
|
+
}, [d]);
|
|
31
|
+
const j = (e) => {
|
|
32
|
+
f(e);
|
|
33
|
+
const o = b(e);
|
|
34
|
+
x(!o.isValid), h(o.message), k?.({ id: m, value: e });
|
|
35
|
+
}, v = [];
|
|
36
|
+
for (let e = R; e <= $; e += 1) v.push(e);
|
|
37
|
+
return /* @__PURE__ */ S(A, { id: m, required: g, error: W, component: "fieldset", sx: { width: "100%" }, children: [
|
|
38
|
+
i && /* @__PURE__ */ t(F, { sx: { mb: 1, fontWeight: 500 }, component: "legend", children: i }),
|
|
39
|
+
/* @__PURE__ */ t(C, { role: "radiogroup", "aria-label": i || "nps scale", sx: { display: "flex", flexWrap: "wrap", gap: 0.75 }, children: v.map((e) => {
|
|
40
|
+
const o = u === e;
|
|
41
|
+
return /* @__PURE__ */ t(
|
|
42
|
+
q,
|
|
43
|
+
{
|
|
44
|
+
role: "radio",
|
|
45
|
+
"aria-checked": o,
|
|
46
|
+
variant: o ? "contained" : "outlined",
|
|
47
|
+
color: "primary",
|
|
48
|
+
onClick: () => j(e),
|
|
49
|
+
...c,
|
|
50
|
+
sx: (r) => ({
|
|
51
|
+
minWidth: 44,
|
|
52
|
+
height: 44,
|
|
53
|
+
px: 0,
|
|
54
|
+
fontWeight: 600,
|
|
55
|
+
borderRadius: `${N}px`,
|
|
56
|
+
transition: `transform .18s ${s}, box-shadow .18s ${s}, background-color .18s ${s}`,
|
|
57
|
+
...o ? { boxShadow: `0 4px 12px ${l(r.palette.primary.main, 0.35)}` } : {
|
|
58
|
+
borderColor: l(r.palette.text.primary, 0.2),
|
|
59
|
+
"&:hover": {
|
|
60
|
+
borderColor: r.palette.primary.main,
|
|
61
|
+
backgroundColor: l(r.palette.primary.main, 0.06)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"&:hover": {
|
|
65
|
+
transform: "translateY(-1px)",
|
|
66
|
+
...o ? { boxShadow: `0 6px 16px ${l(r.palette.primary.main, 0.4)}` } : {
|
|
67
|
+
borderColor: r.palette.primary.main,
|
|
68
|
+
backgroundColor: l(r.palette.primary.main, 0.06)
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
...c.sx || {}
|
|
72
|
+
}),
|
|
73
|
+
children: e
|
|
74
|
+
},
|
|
75
|
+
e
|
|
76
|
+
);
|
|
77
|
+
}) }),
|
|
78
|
+
/* @__PURE__ */ S(C, { sx: { display: "flex", justifyContent: "space-between", mt: 0.75 }, children: [
|
|
79
|
+
/* @__PURE__ */ t(w, { variant: "caption", color: "text.secondary", children: E }),
|
|
80
|
+
/* @__PURE__ */ t(w, { variant: "caption", color: "text.secondary", children: I })
|
|
81
|
+
] }),
|
|
82
|
+
y && /* @__PURE__ */ t(L, { children: y })
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
K as default
|
|
87
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsxs as w, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import I from "react";
|
|
3
|
+
import T from "@mui/material/Stack";
|
|
4
|
+
import $ from "@mui/material/InputBase";
|
|
5
|
+
import z from "@mui/material/IconButton";
|
|
6
|
+
import q from "@mui/material/FormControl";
|
|
7
|
+
import D from "@mui/material/FormLabel";
|
|
8
|
+
import E from "@mui/material/FormHelperText";
|
|
9
|
+
import H from "@mui/icons-material/Remove";
|
|
10
|
+
import L from "@mui/icons-material/Add";
|
|
11
|
+
import { alpha as m } from "@mui/material/styles";
|
|
12
|
+
import { u as P, m as U } from "./index-CddjLTWF.mjs";
|
|
13
|
+
const t = (n, c = 0) => {
|
|
14
|
+
const i = Number(n);
|
|
15
|
+
return Number.isFinite(i) ? i : c;
|
|
16
|
+
};
|
|
17
|
+
function re({ attributes: n = {}, rules: c = {}, onChange: i }) {
|
|
18
|
+
const {
|
|
19
|
+
MuiAttributes: A = {},
|
|
20
|
+
id: f = "",
|
|
21
|
+
min: l,
|
|
22
|
+
max: s,
|
|
23
|
+
step: b = 1,
|
|
24
|
+
label: d
|
|
25
|
+
} = n, { sx: B, ...F } = A, h = l != null, v = s != null, u = (e) => {
|
|
26
|
+
let r = e;
|
|
27
|
+
return h && (r = Math.max(r, t(l))), v && (r = Math.min(r, t(s))), r;
|
|
28
|
+
}, [a, g] = I.useState(() => u(t(n.value, 0))), [S, p] = I.useState(String(a)), y = c?.validation?.some(
|
|
29
|
+
(e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
|
|
30
|
+
) || !1;
|
|
31
|
+
P(() => {
|
|
32
|
+
const e = u(t(n.value, 0));
|
|
33
|
+
g(e), p(String(e));
|
|
34
|
+
}, [n.value]);
|
|
35
|
+
const x = (e) => {
|
|
36
|
+
const r = u(e);
|
|
37
|
+
g(r), p(String(r)), i?.({ id: f, value: r });
|
|
38
|
+
}, M = h && a <= t(l), C = v && a >= t(s), N = () => {
|
|
39
|
+
M || x(a - t(b, 1));
|
|
40
|
+
}, R = () => {
|
|
41
|
+
C || x(a + t(b, 1));
|
|
42
|
+
}, j = () => {
|
|
43
|
+
x(t(S, a));
|
|
44
|
+
}, k = {
|
|
45
|
+
borderRadius: 0,
|
|
46
|
+
px: 1.25,
|
|
47
|
+
color: "text.primary",
|
|
48
|
+
transition: "background-color .18s",
|
|
49
|
+
"&:hover": (e) => ({
|
|
50
|
+
backgroundColor: m(e.palette.primary.main, 0.08)
|
|
51
|
+
}),
|
|
52
|
+
"&.Mui-disabled": { color: "text.disabled" }
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ w(q, { component: "fieldset", error: !1, children: [
|
|
55
|
+
d && /* @__PURE__ */ o(D, { component: "legend", required: y, sx: { mb: 1 }, children: d }),
|
|
56
|
+
/* @__PURE__ */ w(
|
|
57
|
+
T,
|
|
58
|
+
{
|
|
59
|
+
direction: "row",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
sx: U(
|
|
62
|
+
(e) => ({
|
|
63
|
+
display: "inline-flex",
|
|
64
|
+
width: "fit-content",
|
|
65
|
+
borderRadius: "10px",
|
|
66
|
+
overflow: "hidden",
|
|
67
|
+
border: `1px solid ${m(e.palette.text.primary, 0.16)}`,
|
|
68
|
+
backgroundColor: e.palette.background.paper,
|
|
69
|
+
transition: "box-shadow .2s, border-color .2s",
|
|
70
|
+
"&:hover": {
|
|
71
|
+
borderColor: m(e.palette.primary.main, 0.5)
|
|
72
|
+
},
|
|
73
|
+
"&:focus-within": {
|
|
74
|
+
borderColor: e.palette.primary.main,
|
|
75
|
+
boxShadow: `0 0 0 3px ${m(e.palette.primary.main, 0.16)}`
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
B
|
|
79
|
+
),
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ o(
|
|
82
|
+
z,
|
|
83
|
+
{
|
|
84
|
+
"aria-label": "decrement",
|
|
85
|
+
onClick: N,
|
|
86
|
+
disabled: M,
|
|
87
|
+
size: "small",
|
|
88
|
+
sx: k,
|
|
89
|
+
children: /* @__PURE__ */ o(H, { fontSize: "small" })
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ o(
|
|
93
|
+
$,
|
|
94
|
+
{
|
|
95
|
+
...F,
|
|
96
|
+
value: S,
|
|
97
|
+
inputProps: {
|
|
98
|
+
"aria-label": d || f || "value",
|
|
99
|
+
inputMode: "numeric",
|
|
100
|
+
style: { textAlign: "center", width: 56 }
|
|
101
|
+
},
|
|
102
|
+
onChange: (e) => p(e.target.value),
|
|
103
|
+
onBlur: j,
|
|
104
|
+
sx: {
|
|
105
|
+
"& input": { py: 0.75 }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ o(
|
|
110
|
+
z,
|
|
111
|
+
{
|
|
112
|
+
"aria-label": "increment",
|
|
113
|
+
onClick: R,
|
|
114
|
+
disabled: C,
|
|
115
|
+
size: "small",
|
|
116
|
+
sx: k,
|
|
117
|
+
children: /* @__PURE__ */ o(L, { fontSize: "small" })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
y && /* @__PURE__ */ o(E, { sx: { mx: 0 }, children: "" })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
re as default
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("react"),N=require("@mui/material/Stack"),T=require("@mui/material/InputBase"),k=require("@mui/material/IconButton"),P=require("@mui/material/FormControl"),$=require("@mui/material/FormLabel"),D=require("@mui/material/FormHelperText"),E=require("@mui/icons-material/Remove"),H=require("@mui/icons-material/Add"),c=require("@mui/material/styles"),w=require("./index-D08GIfqF.js"),n=(o,u=0)=>{const i=Number(o);return Number.isFinite(i)?i:u};function L({attributes:o={},rules:u={},onChange:i}){const{MuiAttributes:I={},id:b="",min:s,max:l,step:h=1,label:d}=o,{sx:R,...z}=I,f=s!=null,g=l!=null,m=e=>{let t=e;return f&&(t=Math.max(t,n(s))),g&&(t=Math.min(t,n(l))),t},[a,v]=C.useState(()=>m(n(o.value,0))),[y,x]=C.useState(String(a)),S=u?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;w.useUpdateEffect(()=>{const e=m(n(o.value,0));v(e),x(String(e))},[o.value]);const p=e=>{const t=m(e);v(t),x(String(t)),i?.({id:b,value:t})},q=f&&a<=n(s),M=g&&a>=n(l),A=()=>{q||p(a-n(h,1))},B=()=>{M||p(a+n(h,1))},F=()=>{p(n(y,a))},j={borderRadius:0,px:1.25,color:"text.primary",transition:"background-color .18s","&:hover":e=>({backgroundColor:c.alpha(e.palette.primary.main,.08)}),"&.Mui-disabled":{color:"text.disabled"}};return r.jsxs(P,{component:"fieldset",error:!1,children:[d&&r.jsx($,{component:"legend",required:S,sx:{mb:1},children:d}),r.jsxs(N,{direction:"row",alignItems:"center",sx:w.mergeSx(e=>({display:"inline-flex",width:"fit-content",borderRadius:"10px",overflow:"hidden",border:`1px solid ${c.alpha(e.palette.text.primary,.16)}`,backgroundColor:e.palette.background.paper,transition:"box-shadow .2s, border-color .2s","&:hover":{borderColor:c.alpha(e.palette.primary.main,.5)},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 3px ${c.alpha(e.palette.primary.main,.16)}`}}),R),children:[r.jsx(k,{"aria-label":"decrement",onClick:A,disabled:q,size:"small",sx:j,children:r.jsx(E,{fontSize:"small"})}),r.jsx(T,{...z,value:y,inputProps:{"aria-label":d||b||"value",inputMode:"numeric",style:{textAlign:"center",width:56}},onChange:e=>x(e.target.value),onBlur:F,sx:{"& input":{py:.75}}}),r.jsx(k,{"aria-label":"increment",onClick:B,disabled:M,size:"small",sx:j,children:r.jsx(H,{fontSize:"small"})})]}),S&&r.jsx(D,{sx:{mx:0},children:""})]})}exports.default=L;
|
|
@@ -0,0 +1 @@
|
|
|
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,n)=>{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:!(n=a(t,i))||n.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 s=require("react/jsx-runtime"),c=require("react"),j=require("@mui/material/Box"),p=require("@mui/material/CircularProgress"),y=c.lazy(()=>import("@mui/x-charts/PieChart").then(e=>({default:e.PieChart})));function C({attributes:e={}}){const{MuiChartAttributes:t={},id:r=""}=e;return s.jsx(c.Suspense,{fallback:s.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:s.jsx(p,{})}),children:s.jsx(y,{height:300,...t},r)})}exports.default=C;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import o, { Suspense as a } from "react";
|
|
3
|
+
import n from "@mui/material/Box";
|
|
4
|
+
import s from "@mui/material/CircularProgress";
|
|
5
|
+
const f = o.lazy(
|
|
6
|
+
() => import("@mui/x-charts/PieChart").then((r) => ({ default: r.PieChart }))
|
|
7
|
+
);
|
|
8
|
+
function u({ attributes: r = {} }) {
|
|
9
|
+
const { MuiChartAttributes: e = {}, id: i = "" } = r;
|
|
10
|
+
return /* @__PURE__ */ t(
|
|
11
|
+
a,
|
|
12
|
+
{
|
|
13
|
+
fallback: /* @__PURE__ */ t(n, { 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
|
+
};
|