dynamic-mui 2.5.3 → 2.6.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/dist/accordion-DB151BNT.mjs +22 -0
- package/dist/accordion-YWjUldL8.js +1 -0
- package/dist/addressfield-CpvOajVo.mjs +242 -0
- package/dist/addressfield-CwKjfnTq.js +1 -0
- package/dist/ai/index.cjs +1 -1
- package/dist/ai/index.mjs +1 -14
- package/dist/ai/react/AIForm.d.ts +2 -1
- package/dist/ai/react/AIFormGenerator.d.ts +1 -1
- package/dist/ai/react/AISchemaReview.d.ts +1 -1
- package/dist/ai/react/AITextAssist.d.ts +1 -1
- package/dist/ai/react/AIVisionImport.d.ts +2 -1
- package/dist/ai-BFpA3uHx.js +29 -0
- package/dist/ai-UvDYQ30b.mjs +4533 -0
- package/dist/asyncautocomplete-DQLDdmVl.js +1 -0
- package/dist/asyncautocomplete-mwra2KKJ.mjs +72 -0
- package/dist/bar-CgYZxXHl.js +1 -0
- package/dist/bar-LVtZP6Ui.mjs +4 -0
- package/dist/cascadeselect-BJzHZA9-.js +1 -0
- package/dist/cascadeselect-Cl4OHq-L.mjs +66 -0
- package/dist/chartControl-IQafKpDk.mjs +29 -0
- package/dist/chartControl-ifHiG3nr.js +1 -0
- package/dist/collection-DPJTrAiB.mjs +1692 -0
- package/dist/collection-Dd_Ojgwl.js +1 -0
- package/dist/colorpicker-9AUe21p1.mjs +110 -0
- package/dist/colorpicker-DgKTLBmU.js +1 -0
- package/dist/components/DynamicComponent.d.ts +2 -1
- package/dist/components/FormGenerator.d.ts +1 -1
- package/dist/components/charts/Bar/bar.d.ts +6 -2
- package/dist/components/charts/Line/line.d.ts +6 -2
- package/dist/components/charts/Mixchart/mixChart.d.ts +2 -1
- package/dist/components/charts/Pie/pie.d.ts +6 -2
- package/dist/components/charts/chartControl.d.ts +15 -0
- package/dist/components/controls/Accordion/accordion.d.ts +2 -1
- package/dist/components/controls/AddressField/addressfield.d.ts +2 -1
- package/dist/components/controls/Alert/alert.d.ts +1 -1
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +1 -1
- package/dist/components/controls/Autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/controls/Button/button.d.ts +1 -1
- package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -1
- package/dist/components/controls/CheckBox/checkbox.d.ts +2 -2
- package/dist/components/controls/CheckBox/toggleInput.d.ts +25 -0
- package/dist/components/controls/Chip/chip.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +2 -1
- package/dist/components/controls/Collection/CollectionList.d.ts +1 -1
- package/dist/components/controls/Collection/ItemDialog.d.ts +1 -1
- package/dist/components/controls/Collection/collection.d.ts +1 -1
- package/dist/components/controls/Collection/parts.d.ts +6 -6
- package/dist/components/controls/ColorPicker/colorpicker.d.ts +2 -1
- package/dist/components/controls/Computed/computed.d.ts +1 -1
- package/dist/components/controls/ConsentField/consentfield.d.ts +2 -1
- package/dist/components/controls/CurrencyField/currencyfield.d.ts +1 -1
- package/dist/components/controls/DataTable/datatable.d.ts +2 -1
- package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +1 -1
- package/dist/components/controls/DateTime/datetime.d.ts +15 -1
- package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +6 -2
- package/dist/components/controls/Divider/divider.d.ts +1 -1
- package/dist/components/controls/EditableTable/editabletable.d.ts +1 -1
- package/dist/components/controls/FileUpload/fileupload.d.ts +1 -1
- package/dist/components/controls/FormRepeater/formrepeater.d.ts +1 -1
- package/dist/components/controls/FormWizard/formwizard.d.ts +1 -1
- package/dist/components/controls/GeoField/geofield.d.ts +1 -1
- package/dist/components/controls/Group/group.d.ts +2 -1
- package/dist/components/controls/Hyperlink/hyperlink.d.ts +1 -1
- package/dist/components/controls/ImageList/imagelist.d.ts +1 -1
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -1
- package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -1
- package/dist/components/controls/LineItemList/lineitemlist.d.ts +1 -1
- package/dist/components/controls/List/list.d.ts +1 -1
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +2 -1
- package/dist/components/controls/MatrixField/matrixfield.d.ts +2 -1
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +2 -1
- package/dist/components/controls/NumberField/numberfield.d.ts +2 -1
- package/dist/components/controls/NumberStepper/numberstepper.d.ts +1 -1
- package/dist/components/controls/OtpField/otpfield.d.ts +2 -1
- package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -1
- package/dist/components/controls/PhoneField/phonefield.d.ts +1 -1
- package/dist/components/controls/Radio/radio.d.ts +2 -1
- package/dist/components/controls/Rating/rating.d.ts +2 -1
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +2 -1
- package/dist/components/controls/Select/select.d.ts +2 -1
- package/dist/components/controls/Signature/signature.d.ts +1 -1
- package/dist/components/controls/Slider/slider.d.ts +1 -1
- package/dist/components/controls/Stepper/stepper.d.ts +1 -1
- package/dist/components/controls/SummaryField/summaryfield.d.ts +2 -1
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/Tabs/tabs.d.ts +2 -1
- package/dist/components/controls/TagsInput/tagsinput.d.ts +1 -1
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/TextField/useTextInput.d.ts +18 -0
- package/dist/components/controls/TimePicker/timepicker.d.ts +6 -2
- package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +1 -1
- package/dist/components/controls/Typography/typography.d.ts +1 -1
- package/dist/components/controls/index.d.ts +24 -9
- package/dist/consentfield-CFm1IDa5.mjs +68 -0
- package/dist/consentfield-z8W0Yfx8.js +1 -0
- package/dist/datatable-CMjaTDPM.js +1 -0
- package/dist/datatable-lZIwHx6a.mjs +29 -0
- package/dist/dynamic-mui.cjs +1 -1
- package/dist/dynamic-mui.d.ts +1 -1
- package/dist/dynamic-mui.mjs +264 -204
- package/dist/editabletable-B3Df4Jys.mjs +117 -0
- package/dist/editabletable-r0RwM1rO.js +1 -0
- package/dist/fileupload-Cr-Mz7oH.js +1 -0
- package/dist/fileupload-D2fXyMIu.mjs +191 -0
- package/dist/formrepeater-BP-RBrQv.js +1 -0
- package/dist/formrepeater-BrYTYCzc.mjs +82 -0
- package/dist/formwizard-CQ2z6fUX.mjs +82 -0
- package/dist/formwizard-DR7fa59M.js +1 -0
- package/dist/geofield-CxVFA0og.mjs +116 -0
- package/dist/geofield-DtN-d2Bq.js +1 -0
- package/dist/group-CiohorzN.mjs +30 -0
- package/dist/group-HQL7UqHt.js +1 -0
- package/dist/imagelist-CNe1Dp_M.mjs +23 -0
- package/dist/imagelist-Wm5Qa6wA.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/intlphone-DwsiSfSt.js +1 -0
- package/dist/intlphone-LGE-cB6X.mjs +341 -0
- package/dist/keyvaluefield-B7NlE0AT.js +1 -0
- package/dist/keyvaluefield-Cd4NQf6d.mjs +128 -0
- package/dist/line-BGSi1tvf.js +1 -0
- package/dist/line-cK6taoCA.mjs +4 -0
- package/dist/lineitemlist-bmk7fEf9.mjs +169 -0
- package/dist/lineitemlist-mulPt3cO.js +1 -0
- package/dist/list-D5qW-7Xg.js +1 -0
- package/dist/list-xPNiijgm.mjs +20 -0
- package/dist/locationfield-DtWkxnX-.js +1 -0
- package/dist/locationfield-SPonkbMU.mjs +90 -0
- package/dist/markdowneditor-6lJQ5cEn.mjs +82 -0
- package/dist/markdowneditor-nPP0t2eK.js +2 -0
- package/dist/matrixfield-CUYoJCwi.js +1 -0
- package/dist/matrixfield-Jm9Yx0EP.mjs +119 -0
- package/dist/mixChart-CSq7pQqJ.mjs +49 -0
- package/dist/mixChart-DoehYa8V.js +1 -0
- package/dist/muiX-BHOKpogF.mjs +12 -0
- package/dist/muiX-CG_D1XQ2.js +1 -0
- package/dist/multitextbox-D-JUSnT7.js +1 -0
- package/dist/multitextbox-gUt8BmfQ.mjs +96 -0
- package/dist/npsscale-D_VtbpJi.js +1 -0
- package/dist/npsscale-LWe7yCxB.mjs +111 -0
- package/dist/numberstepper-BXXlSKT_.js +1 -0
- package/dist/numberstepper-K_JfJJtg.mjs +111 -0
- package/dist/pie-CueMspFX.js +1 -0
- package/dist/pie-DFO89j-z.mjs +4 -0
- package/dist/richtexteditor-BHM-8xe3.js +1 -0
- package/dist/richtexteditor-gmObNHZ7.mjs +178 -0
- package/dist/rolldown-runtime-5iZMYShA.js +1 -0
- package/dist/s3Upload-C3-wcrua.js +1 -0
- package/dist/s3Upload-HtE088XA.mjs +39 -0
- package/dist/signature-DjYfiNzq.js +3 -0
- package/dist/signature-HiL8FJ6C.mjs +1116 -0
- package/dist/stepper-cpOj2wWz.mjs +166 -0
- package/dist/stepper-zEfhqmbA.js +1 -0
- package/dist/summaryfield-BzrdvTVy.js +1 -0
- package/dist/summaryfield-DIQfJjjo.mjs +65 -0
- package/dist/tabs-DvPu-zDC.mjs +50 -0
- package/dist/tabs-xdkLXUCp.js +1 -0
- package/dist/tagsinput-B33m6GJ_.js +1 -0
- package/dist/tagsinput-CTBGuv0M.mjs +49 -0
- package/dist/useSyncedState-CzAO4D1o.mjs +17 -0
- package/dist/useSyncedState-DYNKkpDv.js +1 -0
- package/dist/useTextInput-Cm0_Ps2V.js +1 -0
- package/dist/useTextInput-Dr-ncTE8.mjs +1683 -0
- package/dist/useUpdateEffect-CNBo9hj8.js +1 -0
- package/dist/useUpdateEffect-CXAhttj7.mjs +14 -0
- package/dist/util/helper.d.ts +18 -1
- package/dist/util/muiVersion.d.ts +13 -0
- package/dist/util/stepperComponents.d.ts +1 -1
- package/dist/util/useSyncedState.d.ts +22 -0
- package/dist/util/validation.d.ts +40 -0
- package/dist/v4-Dyp-SQ1c.js +1 -0
- package/dist/v4-YCkfo8OR.mjs +27 -0
- package/dist/validation-B7DPZ218.js +7 -0
- package/dist/validation-BRcYhhsT.mjs +4991 -0
- package/package.json +35 -35
- package/dist/AIForm-D204ogdw.js +0 -44
- package/dist/AIForm-IafSvW2_.mjs +0 -12281
- package/dist/accordion-DA8VpkJ_.mjs +0 -23
- package/dist/accordion-yIxiSIl4.js +0 -1
- package/dist/addressfield-DCzPapIx.mjs +0 -164
- package/dist/addressfield-EFiWgeWB.js +0 -1
- package/dist/asyncautocomplete-5-8SXotM.mjs +0 -92
- package/dist/asyncautocomplete-BmHm-S4u.js +0 -1
- package/dist/bar-BvwjqB4v.mjs +0 -21
- package/dist/bar-DRjoPCtv.js +0 -1
- package/dist/cascadeselect-BEaoupK6.js +0 -1
- package/dist/cascadeselect-CzSf78Pg.mjs +0 -66
- package/dist/collection-CthMZ0Go.js +0 -1
- package/dist/collection-n9eBOioi.mjs +0 -1157
- package/dist/colorpicker-Bm9M38_c.mjs +0 -111
- package/dist/colorpicker-DHkdM8Q2.js +0 -1
- package/dist/consentfield-B2-UFm5n.mjs +0 -80
- package/dist/consentfield-DV8Gz0k9.js +0 -1
- package/dist/datatable-BVZFBd-8.mjs +0 -21
- package/dist/datatable-DnnyVWJm.js +0 -1
- package/dist/editabletable-B_JS4UZ9.js +0 -1
- package/dist/editabletable-BwvIvAt7.mjs +0 -128
- package/dist/fileupload-BHT7K0YT.mjs +0 -185
- package/dist/fileupload-CugVG3o3.js +0 -1
- package/dist/formrepeater-CaJMPo3Q.mjs +0 -75
- package/dist/formrepeater-DiKPaOfi.js +0 -1
- package/dist/formwizard-BzvdbvBY.js +0 -1
- package/dist/formwizard-C9fOIHQv.mjs +0 -83
- package/dist/geofield-BM4b5Zwx.js +0 -1
- package/dist/geofield-DYXx9K9o.mjs +0 -108
- package/dist/group-D5fMqJTx.mjs +0 -23
- package/dist/group-mwS8FSGJ.js +0 -1
- package/dist/imagelist-Bn9QhIv7.js +0 -1
- package/dist/imagelist-rqmJajHt.mjs +0 -18
- package/dist/intlphone-BQYytFWy.js +0 -1
- package/dist/intlphone-DHDwdBbm.mjs +0 -144
- package/dist/keyvaluefield-DM0eSfPF.mjs +0 -127
- package/dist/keyvaluefield-DXyuqDba.js +0 -1
- package/dist/line-Dst2QjuI.mjs +0 -21
- package/dist/line-hM3OgPH7.js +0 -1
- package/dist/lineitemlist-89hrdS0p.mjs +0 -170
- package/dist/lineitemlist-DfEjbNCH.js +0 -1
- package/dist/list-B8S2MrOx.js +0 -1
- package/dist/list-C97cCc78.mjs +0 -20
- package/dist/locationfield-BEMe22_x.mjs +0 -118
- package/dist/locationfield-DlgLvvdU.js +0 -1
- package/dist/markdowneditor-JoiWE-qO.js +0 -2
- package/dist/markdowneditor-K4TAKJ3s.mjs +0 -94
- package/dist/matrixfield-D4sHu6rU.mjs +0 -121
- package/dist/matrixfield-szah6uOP.js +0 -1
- package/dist/mixChart-Doq4lt7Z.mjs +0 -75
- package/dist/mixChart-rgyMCdnp.js +0 -1
- package/dist/multitextbox-CBChuyw9.js +0 -1
- package/dist/multitextbox-Cnrwie5U.mjs +0 -78
- package/dist/npsscale-Cc2eD9Nk.js +0 -1
- package/dist/npsscale-DgQPa1eH.mjs +0 -91
- package/dist/numberstepper-BcuSZHwZ.js +0 -1
- package/dist/numberstepper-BqINnIm7.mjs +0 -132
- package/dist/pie-B6dXjc4o.mjs +0 -21
- package/dist/pie-a_dhmBUq.js +0 -1
- package/dist/richtexteditor-Bs5-VQj3.js +0 -1
- package/dist/richtexteditor-CveBdsmJ.mjs +0 -143
- package/dist/s3Upload-B0JeoLkS.js +0 -1
- package/dist/s3Upload-dpioZ2c8.mjs +0 -51
- package/dist/signature-BRWAWqeA.mjs +0 -1227
- package/dist/signature-Bj9GDrvy.js +0 -2
- package/dist/stepper-B9sSsbQD.js +0 -1
- package/dist/stepper-DTMAP67o.mjs +0 -140
- package/dist/summaryfield-JKL3ZLl2.js +0 -1
- package/dist/summaryfield-xhr0Q4RL.mjs +0 -96
- package/dist/tabs-ClkmKlV8.mjs +0 -39
- package/dist/tabs-DmEP_QW0.js +0 -1
- package/dist/tagsinput-B0yVrYgB.mjs +0 -58
- package/dist/tagsinput-COKkxIxg.js +0 -1
- package/dist/v4-BysszJq8.mjs +0 -30
- package/dist/v4-CqdK_b8Y.js +0 -1
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as k } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as j, useState as S, useEffect as R } from "react";
|
|
3
|
-
import { Stack as q, Box as w, TextField as O, Button as $, Icon as d, IconButton as B } from "@mui/material";
|
|
4
|
-
import { j as v, k as C } from "./AIForm-IafSvW2_.mjs";
|
|
5
|
-
function T({ attributes: r = {}, rules: p = {}, onChange: i, submitTick: c, messages: m }) {
|
|
6
|
-
const { id: s = "" } = r, h = m?.required || "Required", f = j(null), [t, a] = S(() => {
|
|
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
|
-
}), u = p?.validation?.some((e) => e.rule === "mandatory") || !1;
|
|
16
|
-
v(() => {
|
|
17
|
-
c && u && !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) && a(e.length > 0 ? e : [{ key: "t1", value: "" }]);
|
|
25
|
-
} else r.value || a([{ key: "t1", value: "" }]);
|
|
26
|
-
}, [r.value]), R(() => {
|
|
27
|
-
const e = t.reduce((l, n) => (l[n.key] = n.value, l), {});
|
|
28
|
-
i && i({ id: s, value: e });
|
|
29
|
-
}, [t, s]);
|
|
30
|
-
const y = () => {
|
|
31
|
-
const e = t.length + 1;
|
|
32
|
-
a([...t, { key: `t${e}`, value: "" }]);
|
|
33
|
-
}, g = (e) => {
|
|
34
|
-
const l = t.filter((n, I) => I !== e);
|
|
35
|
-
a(l);
|
|
36
|
-
}, x = (e, l) => {
|
|
37
|
-
const n = [...t];
|
|
38
|
-
n[e].value = l, a(n);
|
|
39
|
-
};
|
|
40
|
-
return /* @__PURE__ */ o(q, { spacing: 2, sx: { width: "100%" }, children: t.map((e, l) => /* @__PURE__ */ k(w, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
|
|
41
|
-
/* @__PURE__ */ o(
|
|
42
|
-
O,
|
|
43
|
-
{
|
|
44
|
-
fullWidth: !0,
|
|
45
|
-
id: l === 0 ? s : `${s}_${e.key}`,
|
|
46
|
-
inputRef: l === 0 ? f : void 0,
|
|
47
|
-
required: u,
|
|
48
|
-
error: u && !e.value,
|
|
49
|
-
helperText: u && !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__ */ o(
|
|
58
|
-
$,
|
|
59
|
-
{
|
|
60
|
-
variant: "contained",
|
|
61
|
-
color: "primary",
|
|
62
|
-
onClick: y,
|
|
63
|
-
sx: { minWidth: "40px", p: 1 },
|
|
64
|
-
children: /* @__PURE__ */ o(d, { children: "add" })
|
|
65
|
-
}
|
|
66
|
-
) : /* @__PURE__ */ o(
|
|
67
|
-
B,
|
|
68
|
-
{
|
|
69
|
-
color: "error",
|
|
70
|
-
onClick: () => g(l),
|
|
71
|
-
children: /* @__PURE__ */ o(d, { children: "remove" })
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] }, l)) });
|
|
75
|
-
}
|
|
76
|
-
export {
|
|
77
|
-
T as default
|
|
78
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),q=require("@mui/material/Box"),k=require("@mui/material/Button"),S=require("@mui/material/Typography"),A=require("@mui/material/FormControl"),$=require("@mui/material/FormLabel"),N=require("@mui/material/FormHelperText"),s=require("@mui/material/styles"),l=require("./AIForm-D204ogdw.js");function P({attributes:t={},rules:c={},onChange:j,submitTick:d,messages:M}){const{id:p="",label:n,min:E=0,max:I=10,lowLabel:R="Not likely",highLabel:C="Very likely",MuiAttributes:u={}}=t,w=typeof t.value=="number"?t.value:"",[m,x]=i.useState(w),[U,y]=i.useState(!1),[f,h]=i.useState("");l.useUpdateEffect(()=>{x(typeof t.value=="number"?t.value:"")},[t.value]);const g=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,b=e=>g?typeof e!="number"?{isValid:!1,message:c?.validation?.find(r=>r.rule==="mandatory"||r.rule==="mandatoryselect")?.message||M?.required||"Required"}:{isValid:!0,message:""}:{isValid:!0,message:""};l.useUpdateEffect(()=>{if(d){const e=b(m);y(!e.isValid),h(e.message)}},[d]);const V=e=>{x(e);const a=b(e);y(!a.isValid),h(a.message),j?.({id:p,value:e})},v=[];for(let e=E;e<=I;e+=1)v.push(e);return o.jsxs(A,{id:p,required:g,error:U,component:"fieldset",sx:{width:"100%"},children:[n&&o.jsx($,{sx:{mb:1,fontWeight:500},component:"legend",children:n}),o.jsx(q,{role:"radiogroup","aria-label":n||"nps scale",sx:{display:"flex",flexWrap:"wrap",gap:.75},children:v.map(e=>{const a=m===e;return o.jsx(k,{role:"radio","aria-checked":a,variant:a?"contained":"outlined",color:"primary",onClick:()=>V(e),...u,sx:r=>({minWidth:44,height:44,px:0,fontWeight:600,borderRadius:`${l.PREMIUM_RADIUS}px`,transition:`transform .18s ${l.PREMIUM_EASING}, box-shadow .18s ${l.PREMIUM_EASING}, background-color .18s ${l.PREMIUM_EASING}`,...a?{boxShadow:`0 4px 12px ${s.alpha(r.palette.primary.main,.35)}`}:{borderColor:s.alpha(r.palette.text.primary,.2),"&:hover":{borderColor:r.palette.primary.main,backgroundColor:s.alpha(r.palette.primary.main,.06)}},"&:hover":{transform:"translateY(-1px)",...a?{boxShadow:`0 6px 16px ${s.alpha(r.palette.primary.main,.4)}`}:{borderColor:r.palette.primary.main,backgroundColor:s.alpha(r.palette.primary.main,.06)}},...u.sx||{}}),children:e},e)})}),o.jsxs(q,{sx:{display:"flex",justifyContent:"space-between",mt:.75},children:[o.jsx(S,{variant:"caption",sx:{color:"text.secondary"},children:R}),o.jsx(S,{variant:"caption",sx:{color:"text.secondary"},children:C})]}),f&&o.jsx(N,{children:f})]})}exports.default=P;
|
|
@@ -1,91 +0,0 @@
|
|
|
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 { j as V, P as s, o as N } from "./AIForm-IafSvW2_.mjs";
|
|
11
|
-
function K({ attributes: a = {}, rules: p = {}, onChange: k, submitTick: m, messages: M }) {
|
|
12
|
-
const {
|
|
13
|
-
id: d = "",
|
|
14
|
-
label: i,
|
|
15
|
-
min: R = 0,
|
|
16
|
-
max: $ = 10,
|
|
17
|
-
lowLabel: E = "Not likely",
|
|
18
|
-
highLabel: j = "Very likely",
|
|
19
|
-
MuiAttributes: c = {}
|
|
20
|
-
} = a, I = typeof a.value == "number" ? a.value : "", [u, f] = n.useState(I), [U, 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 (m) {
|
|
27
|
-
const e = b(u);
|
|
28
|
-
x(!e.isValid), h(e.message);
|
|
29
|
-
}
|
|
30
|
-
}, [m]);
|
|
31
|
-
const W = (e) => {
|
|
32
|
-
f(e);
|
|
33
|
-
const o = b(e);
|
|
34
|
-
x(!o.isValid), h(o.message), k?.({ id: d, value: e });
|
|
35
|
-
}, v = [];
|
|
36
|
-
for (let e = R; e <= $; e += 1) v.push(e);
|
|
37
|
-
return /* @__PURE__ */ S(A, { id: d, required: g, error: U, 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: () => W(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", sx: {
|
|
80
|
-
color: "text.secondary"
|
|
81
|
-
}, children: E }),
|
|
82
|
-
/* @__PURE__ */ t(w, { variant: "caption", sx: {
|
|
83
|
-
color: "text.secondary"
|
|
84
|
-
}, children: j })
|
|
85
|
-
] }),
|
|
86
|
-
y && /* @__PURE__ */ t(L, { children: y })
|
|
87
|
-
] });
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
K as default
|
|
91
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("react"),N=require("@mui/material/Stack"),T=require("@mui/material/InputBase"),k=require("@mui/material/IconButton"),P=require("@mui/material/FormControl"),$=require("@mui/material/FormLabel"),D=require("@mui/material/FormHelperText"),E=require("@mui/icons-material/Remove"),H=require("@mui/icons-material/Add"),c=require("@mui/material/styles"),w=require("./AIForm-D204ogdw.js"),n=(o,u=0)=>{const i=Number(o);return Number.isFinite(i)?i:u};function L({attributes:o={},rules:u={},onChange:i}){const{MuiAttributes:I={},id:b="",min:s,max:l,step:h=1,label:d}=o,{sx:A,...F}=I,f=s!=null,g=l!=null,m=e=>{let t=e;return f&&(t=Math.max(t,n(s))),g&&(t=Math.min(t,n(l))),t},[a,v]=C.useState(()=>m(n(o.value,0))),[y,x]=C.useState(String(a)),S=u?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;w.useUpdateEffect(()=>{const e=m(n(o.value,0));v(e),x(String(e))},[o.value]);const p=e=>{const t=m(e);v(t),x(String(t)),i?.({id:b,value:t})},q=f&&a<=n(s),M=g&&a>=n(l),R=()=>{q||p(a-n(h,1))},z=()=>{M||p(a+n(h,1))},B=()=>{p(n(y,a))},j={borderRadius:0,px:1.25,color:"text.primary",transition:"background-color .18s","&:hover":e=>({backgroundColor:c.alpha(e.palette.primary.main,.08)}),"&.Mui-disabled":{color:"text.disabled"}};return r.jsxs(P,{component:"fieldset",error:!1,children:[d&&r.jsx($,{component:"legend",required:S,sx:{mb:1},children:d}),r.jsxs(N,{direction:"row",sx:w.mergeSx(e=>({alignItems:"center",display:"inline-flex",width:"fit-content",borderRadius:"10px",overflow:"hidden",border:`1px solid ${c.alpha(e.palette.text.primary,.16)}`,backgroundColor:e.palette.background.paper,transition:"box-shadow .2s, border-color .2s","&:hover":{borderColor:c.alpha(e.palette.primary.main,.5)},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 3px ${c.alpha(e.palette.primary.main,.16)}`}}),A),children:[r.jsx(k,{"aria-label":"decrement",onClick:R,disabled:q,size:"small",sx:j,children:r.jsx(E,{fontSize:"small"})}),r.jsx(T,{...F,value:y,inputProps:{"aria-label":d||b||"value",inputMode:"numeric",style:{textAlign:"center",width:56}},onChange:e=>x(e.target.value),onBlur:B,sx:{"& input":{py:.75}}}),r.jsx(k,{"aria-label":"increment",onClick:z,disabled:M,size:"small",sx:j,children:r.jsx(H,{fontSize:"small"})})]}),S&&r.jsx(D,{sx:{mx:0},children:""})]})}exports.default=L;
|
|
@@ -1,132 +0,0 @@
|
|
|
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 { j as P, m as U } from "./AIForm-IafSvW2_.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, p = (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(() => p(t(n.value, 0))), [S, u] = I.useState(String(a)), y = c?.validation?.some(
|
|
29
|
-
(e) => e.rule === "mandatory" || e.rule === "mandatoryselect"
|
|
30
|
-
) || !1;
|
|
31
|
-
P(() => {
|
|
32
|
-
const e = p(t(n.value, 0));
|
|
33
|
-
g(e), u(String(e));
|
|
34
|
-
}, [n.value]);
|
|
35
|
-
const x = (e) => {
|
|
36
|
-
const r = p(e);
|
|
37
|
-
g(r), u(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
|
-
sx: U(
|
|
61
|
-
(e) => ({
|
|
62
|
-
// `alignItems` was a Stack system prop before v9. Folded
|
|
63
|
-
// into the base style object rather than left in an sx
|
|
64
|
-
// array — mergeSx already returns SxProps, and SxProps
|
|
65
|
-
// arrays cannot be nested inside another sx array.
|
|
66
|
-
alignItems: "center",
|
|
67
|
-
display: "inline-flex",
|
|
68
|
-
width: "fit-content",
|
|
69
|
-
borderRadius: "10px",
|
|
70
|
-
overflow: "hidden",
|
|
71
|
-
border: `1px solid ${m(e.palette.text.primary, 0.16)}`,
|
|
72
|
-
backgroundColor: e.palette.background.paper,
|
|
73
|
-
transition: "box-shadow .2s, border-color .2s",
|
|
74
|
-
"&:hover": {
|
|
75
|
-
borderColor: m(e.palette.primary.main, 0.5)
|
|
76
|
-
},
|
|
77
|
-
"&:focus-within": {
|
|
78
|
-
borderColor: e.palette.primary.main,
|
|
79
|
-
boxShadow: `0 0 0 3px ${m(e.palette.primary.main, 0.16)}`
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
B
|
|
83
|
-
),
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ o(
|
|
86
|
-
z,
|
|
87
|
-
{
|
|
88
|
-
"aria-label": "decrement",
|
|
89
|
-
onClick: N,
|
|
90
|
-
disabled: M,
|
|
91
|
-
size: "small",
|
|
92
|
-
sx: k,
|
|
93
|
-
children: /* @__PURE__ */ o(H, { fontSize: "small" })
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ o(
|
|
97
|
-
$,
|
|
98
|
-
{
|
|
99
|
-
...F,
|
|
100
|
-
value: S,
|
|
101
|
-
inputProps: {
|
|
102
|
-
"aria-label": d || f || "value",
|
|
103
|
-
inputMode: "numeric",
|
|
104
|
-
style: { textAlign: "center", width: 56 }
|
|
105
|
-
},
|
|
106
|
-
onChange: (e) => u(e.target.value),
|
|
107
|
-
onBlur: j,
|
|
108
|
-
sx: {
|
|
109
|
-
"& input": { py: 0.75 }
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ o(
|
|
114
|
-
z,
|
|
115
|
-
{
|
|
116
|
-
"aria-label": "increment",
|
|
117
|
-
onClick: R,
|
|
118
|
-
disabled: C,
|
|
119
|
-
size: "small",
|
|
120
|
-
sx: k,
|
|
121
|
-
children: /* @__PURE__ */ o(L, { fontSize: "small" })
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
y && /* @__PURE__ */ o(E, { sx: { mx: 0 }, children: "" })
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
export {
|
|
131
|
-
re as default
|
|
132
|
-
};
|
package/dist/pie-B6dXjc4o.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import a, { Suspense as s } from "react";
|
|
3
|
-
import n from "@mui/material/Box";
|
|
4
|
-
import f from "@mui/material/CircularProgress";
|
|
5
|
-
import { i as m } from "./AIForm-IafSvW2_.mjs";
|
|
6
|
-
const c = a.lazy(
|
|
7
|
-
() => import("@mui/x-charts/PieChart").then((r) => ({ default: r.PieChart }))
|
|
8
|
-
);
|
|
9
|
-
function d({ attributes: r = {} }) {
|
|
10
|
-
const { MuiChartAttributes: e = {}, id: i = "" } = r, o = m("PieChart") || c;
|
|
11
|
-
return /* @__PURE__ */ t(
|
|
12
|
-
s,
|
|
13
|
-
{
|
|
14
|
-
fallback: /* @__PURE__ */ t(n, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ t(f, {}) }),
|
|
15
|
-
children: /* @__PURE__ */ t(o, { height: 300, ...e }, i)
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
d as default
|
|
21
|
-
};
|
package/dist/pie-a_dhmBUq.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var c=Object.create;var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var x=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!d.call(e,i)&&i!==r&&u(e,i,{get:()=>t[i],enumerable:!(s=a(t,i))||s.enumerable});return e};var f=(e,t,r)=>(r=e!=null?c(h(e)):{},x(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),j=require("@mui/material/Box"),C=require("@mui/material/CircularProgress"),y=require("./AIForm-D204ogdw.js"),P=o.lazy(()=>import("@mui/x-charts/PieChart").then(e=>({default:e.PieChart})));function g({attributes:e={}}){const{MuiChartAttributes:t={},id:r=""}=e,s=y.getMuiX("PieChart")||P;return n.jsx(o.Suspense,{fallback:n.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(C,{})}),children:n.jsx(s,{height:300,...t},r)})}exports.default=g;
|
|
@@ -1 +0,0 @@
|
|
|
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("./AIForm-D204ogdw.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,{sx:{fontSize:"small"}}),prompt:!0},{command:"removeFormat",label:"Clear formatting",icon:r.jsx(v,{fontSize:"small"})}];function F({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=F;
|
|
@@ -1,143 +0,0 @@
|
|
|
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, o as b } from "./AIForm-IafSvW2_.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, { sx: {
|
|
26
|
-
fontSize: "small"
|
|
27
|
-
} }), prompt: !0 },
|
|
28
|
-
{ command: "removeFormat", label: "Clear formatting", icon: /* @__PURE__ */ o(z, { fontSize: "small" }) }
|
|
29
|
-
];
|
|
30
|
-
function V({ attributes: a = {}, onChange: s }) {
|
|
31
|
-
const { id: i = "", label: m, minHeight: g = 160, MuiAttributes: f = {} } = a, n = c.useRef(null);
|
|
32
|
-
c.useEffect(() => {
|
|
33
|
-
const r = n.current;
|
|
34
|
-
if (!r) return;
|
|
35
|
-
const e = a.value ?? "";
|
|
36
|
-
r.innerHTML !== e && (r.innerHTML = e);
|
|
37
|
-
}, [a.value]);
|
|
38
|
-
const h = (r) => {
|
|
39
|
-
n.current?.focus();
|
|
40
|
-
try {
|
|
41
|
-
if (r.prompt) {
|
|
42
|
-
const e = window.prompt("Enter a URL");
|
|
43
|
-
e && document.execCommand(r.command, !1, e);
|
|
44
|
-
} else
|
|
45
|
-
document.execCommand(r.command);
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
n.current && s?.({ id: i, value: n.current.innerHTML });
|
|
49
|
-
}, C = (r) => {
|
|
50
|
-
s?.({ id: i, value: r.currentTarget.innerHTML });
|
|
51
|
-
};
|
|
52
|
-
return /* @__PURE__ */ d(S, { fullWidth: !0, children: [
|
|
53
|
-
m && /* @__PURE__ */ o(v, { sx: { mb: 0.75, fontWeight: 500 }, component: "legend", children: m }),
|
|
54
|
-
/* @__PURE__ */ d(
|
|
55
|
-
I,
|
|
56
|
-
{
|
|
57
|
-
variant: "outlined",
|
|
58
|
-
sx: (r) => ({
|
|
59
|
-
borderRadius: `${b + 2}px`,
|
|
60
|
-
borderColor: t(r.palette.text.primary, 0.12),
|
|
61
|
-
overflow: "hidden",
|
|
62
|
-
transition: `box-shadow .2s ${l}, border-color .2s ${l}`,
|
|
63
|
-
"&:hover": {
|
|
64
|
-
borderColor: t(r.palette.primary.main, 0.5),
|
|
65
|
-
boxShadow: `0 2px 10px ${t(r.palette.common.black, 0.06)}`
|
|
66
|
-
},
|
|
67
|
-
"&:focus-within": {
|
|
68
|
-
borderColor: r.palette.primary.main,
|
|
69
|
-
boxShadow: `0 0 0 3px ${t(r.palette.primary.main, 0.16)}`
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ o(
|
|
74
|
-
u,
|
|
75
|
-
{
|
|
76
|
-
sx: (r) => ({
|
|
77
|
-
display: "flex",
|
|
78
|
-
flexWrap: "wrap",
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
gap: 0.25,
|
|
81
|
-
px: 0.75,
|
|
82
|
-
py: 0.5,
|
|
83
|
-
backgroundColor: t(r.palette.text.primary, 0.03)
|
|
84
|
-
}),
|
|
85
|
-
children: E.map((r, e) => /* @__PURE__ */ d(c.Fragment, { children: [
|
|
86
|
-
(e === 3 || e === 5) && /* @__PURE__ */ o(x, { orientation: "vertical", flexItem: !0, sx: { mx: 0.25, my: 0.5 } }),
|
|
87
|
-
/* @__PURE__ */ o(y, { title: r.label, children: /* @__PURE__ */ o(
|
|
88
|
-
L,
|
|
89
|
-
{
|
|
90
|
-
size: "small",
|
|
91
|
-
"aria-label": r.label,
|
|
92
|
-
onMouseDown: (p) => p.preventDefault(),
|
|
93
|
-
onClick: () => h(r),
|
|
94
|
-
sx: (p) => ({
|
|
95
|
-
borderRadius: `${b - 2}px`,
|
|
96
|
-
transition: `background-color .18s ${l}, transform .18s ${l}`,
|
|
97
|
-
"&:hover": {
|
|
98
|
-
backgroundColor: t(p.palette.primary.main, 0.1),
|
|
99
|
-
transform: "translateY(-1px)"
|
|
100
|
-
}
|
|
101
|
-
}),
|
|
102
|
-
children: r.icon
|
|
103
|
-
}
|
|
104
|
-
) })
|
|
105
|
-
] }, r.command))
|
|
106
|
-
}
|
|
107
|
-
),
|
|
108
|
-
/* @__PURE__ */ o(x, {}),
|
|
109
|
-
/* @__PURE__ */ o(
|
|
110
|
-
u,
|
|
111
|
-
{
|
|
112
|
-
id: i,
|
|
113
|
-
ref: n,
|
|
114
|
-
role: "textbox",
|
|
115
|
-
"aria-multiline": "true",
|
|
116
|
-
"aria-label": m || "rich text",
|
|
117
|
-
contentEditable: !0,
|
|
118
|
-
suppressContentEditableWarning: !0,
|
|
119
|
-
onInput: C,
|
|
120
|
-
...f,
|
|
121
|
-
sx: (r) => ({
|
|
122
|
-
minHeight: g,
|
|
123
|
-
px: 1.75,
|
|
124
|
-
py: 1.25,
|
|
125
|
-
outline: "none",
|
|
126
|
-
lineHeight: 1.6,
|
|
127
|
-
color: r.palette.text.primary,
|
|
128
|
-
backgroundColor: r.palette.background.paper,
|
|
129
|
-
"& p": { margin: "0 0 0.5em" },
|
|
130
|
-
"& ul, & ol": { paddingLeft: "1.5em", margin: "0 0 0.5em" },
|
|
131
|
-
"& a": { color: r.palette.primary.main },
|
|
132
|
-
...f.sx || {}
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
] });
|
|
140
|
-
}
|
|
141
|
-
export {
|
|
142
|
-
V as default
|
|
143
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
};
|