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.
- package/README.md +355 -37
- 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 +123 -2
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +9 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +1 -1
- package/dist/components/controls/EditableTable/editabletable.d.ts +2 -0
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -0
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +3 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +1 -1
- package/dist/components/controls/PasswordField/passwordfield.d.ts +1 -1
- package/dist/components/controls/Radio/radio.d.ts +1 -1
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +3 -0
- package/dist/components/controls/Select/select.d.ts +1 -1
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/index.d.ts +45 -69
- 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 +11 -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/schema.d.ts +404 -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/types.d.ts +16 -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/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
- package/dist/date-utils-CFUUt6NL.js +0 -4
- package/dist/date-utils-pGzaKb0p.mjs +0 -477
- package/dist/dynamic-mui.cjs.js +0 -469
- package/dist/dynamic-mui.es.js +0 -102550
- package/dist/index-BW8_rRff.js +0 -7
- package/dist/index-BXFVK_GX.js +0 -1
- package/dist/index-CVqLvm8B.js +0 -1
- package/dist/index-Cr6Wp_S-.mjs +0 -3141
- package/dist/index-DA0XouZs.mjs +0 -153
- package/dist/index-DKS5Sz9e.js +0 -14
- package/dist/index-DcWfyXJp.mjs +0 -92
- package/dist/index-MllWgTJ5.mjs +0 -9372
- package/dist/index.browser-BSu11T_q.mjs +0 -363
- package/dist/index.browser-By7-GABP.js +0 -4
- 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/PropertiesEditor.d.ts +0 -10
- package/dist/playground/Sidebar.d.ts +0 -1
- 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 -1
|
@@ -1,62 +1,33 @@
|
|
|
1
1
|
import { default as Typography } from './Typography/typography';
|
|
2
2
|
import { default as TextField } from './TextField/textfield';
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as DateTime } from './DateTime/datetime';
|
|
5
|
-
import { default as DateTimePicker } from './DateTimePicker/datetimepicker';
|
|
6
|
-
import { default as TimePicker } from './TimePicker/timepicker';
|
|
3
|
+
import { default as NumberField } from './NumberField/numberfield';
|
|
7
4
|
import { default as Select } from './Select/select';
|
|
5
|
+
import { default as AutoComplete } from './Autocomplete/autocomplete';
|
|
8
6
|
import { default as CheckBox } from './CheckBox/checkbox';
|
|
9
|
-
import { default as Switch } from './Switch/switch';
|
|
10
7
|
import { default as Radio } from './Radio/radio';
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as Line } from '../charts/Line/line';
|
|
14
|
-
import { default as Pie } from '../charts/Pie/pie';
|
|
15
|
-
import { default as MixChart } from '../charts/Mixchart/mixChart';
|
|
8
|
+
import { default as Switch } from './Switch/switch';
|
|
9
|
+
import { default as Button } from './Button/button';
|
|
16
10
|
import { default as Divider } from './Divider/divider';
|
|
11
|
+
import { default as Computed } from './Computed/computed';
|
|
12
|
+
import { default as Alert } from './Alert/alert';
|
|
13
|
+
import { default as DateTime } from './DateTime/datetime';
|
|
14
|
+
import { default as DateTimePicker } from './DateTimePicker/datetimepicker';
|
|
15
|
+
import { default as TimePicker } from './TimePicker/timepicker';
|
|
16
|
+
import { default as DateRangePicker } from './DateRangePicker/daterangepicker';
|
|
17
17
|
import { default as Chip } from './Chip/chip';
|
|
18
18
|
import { default as ChipSelect } from './ChipSelect/chipselect';
|
|
19
|
-
import { default as Button } from './Button/button';
|
|
20
|
-
import { default as DateRangePicker } from './DateRangePicker/daterangepicker';
|
|
21
|
-
import { default as Rating } from './Rating/rating';
|
|
22
19
|
import { default as Slider } from './Slider/slider';
|
|
23
|
-
import { default as
|
|
20
|
+
import { default as Rating } from './Rating/rating';
|
|
24
21
|
import { default as ToggleButtons } from './ToggleButtons/togglebuttons';
|
|
25
22
|
import { default as PasswordField } from './PasswordField/passwordfield';
|
|
26
23
|
import { default as OtpField } from './OtpField/otpfield';
|
|
27
24
|
import { default as PhoneField } from './PhoneField/phonefield';
|
|
28
25
|
import { default as CurrencyField } from './CurrencyField/currencyfield';
|
|
29
|
-
import { default as FileUpload } from './FileUpload/fileupload';
|
|
30
|
-
import { default as Alert } from './Alert/alert';
|
|
31
|
-
import { default as Computed } from './Computed/computed';
|
|
32
|
-
import { default as KeyValueField } from './KeyValueField/keyvaluefield';
|
|
33
|
-
import { default as NumberStepper } from './NumberStepper/numberstepper';
|
|
34
|
-
import { default as MatrixField } from './MatrixField/matrixfield';
|
|
35
|
-
import { default as ConsentField } from './ConsentField/consentfield';
|
|
36
|
-
import { default as ColorPicker } from './ColorPicker/colorpicker';
|
|
37
|
-
import { default as MarkdownEditor } from './MarkdownEditor/markdowneditor';
|
|
38
|
-
import { default as AddressField } from './AddressField/addressfield';
|
|
39
|
-
import { default as CascadeSelect } from './CascadeSelect/cascadeselect';
|
|
40
|
-
import { default as FormWizard } from './FormWizard/formwizard';
|
|
41
|
-
import { default as SummaryField } from './SummaryField/summaryfield';
|
|
42
|
-
import { default as GeoField } from './GeoField/geofield';
|
|
43
|
-
import { default as List } from './List/list';
|
|
44
|
-
import { default as NumberField } from './NumberField/numberfield';
|
|
45
|
-
import { default as MultiTextbox } from './MultiTextbox/multitextbox';
|
|
46
|
-
import { default as LineItemList } from './LineItemList/lineitemlist';
|
|
47
|
-
import { default as FormRepeater } from './FormRepeater/formrepeater';
|
|
48
|
-
import { default as Signature } from './Signature/signature';
|
|
49
|
-
import { default as Group } from './Group/group';
|
|
50
|
-
import { default as Accordion } from './Accordion/accordion';
|
|
51
|
-
import { default as Tabs } from './Tabs/tabs';
|
|
52
|
-
import { default as AutoComplete } from './Autocomplete/autocomplete';
|
|
53
|
-
import { default as ImgList } from './ImageList/imagelist';
|
|
54
26
|
import { default as Hyperlink } from './Hyperlink/hyperlink';
|
|
55
|
-
import { default as LocationField } from './LocationField/locationfield';
|
|
56
27
|
declare const Controls: {
|
|
57
28
|
Typography: typeof Typography;
|
|
58
29
|
TextField: typeof TextField;
|
|
59
|
-
Table: typeof
|
|
30
|
+
Table: import('react').LazyExoticComponent<typeof import('./DataTable/datatable').default>;
|
|
60
31
|
DateTime: typeof DateTime;
|
|
61
32
|
DateTimePicker: typeof DateTimePicker;
|
|
62
33
|
TimePicker: typeof TimePicker;
|
|
@@ -64,11 +35,11 @@ declare const Controls: {
|
|
|
64
35
|
CheckBox: typeof CheckBox;
|
|
65
36
|
Switch: typeof Switch;
|
|
66
37
|
Radio: typeof Radio;
|
|
67
|
-
Stepper: typeof Stepper
|
|
68
|
-
Bar: typeof Bar
|
|
69
|
-
Line: typeof Line
|
|
70
|
-
Pie: typeof Pie
|
|
71
|
-
MixChart: typeof
|
|
38
|
+
Stepper: import('react').LazyExoticComponent<typeof import('./Stepper/stepper').default>;
|
|
39
|
+
Bar: import('react').LazyExoticComponent<typeof import('../charts/Bar/bar').default>;
|
|
40
|
+
Line: import('react').LazyExoticComponent<typeof import('../charts/Line/line').default>;
|
|
41
|
+
Pie: import('react').LazyExoticComponent<typeof import('../charts/Pie/pie').default>;
|
|
42
|
+
MixChart: import('react').LazyExoticComponent<typeof import('../charts/Mixchart/mixChart').default>;
|
|
72
43
|
Divider: typeof Divider;
|
|
73
44
|
Chip: typeof Chip;
|
|
74
45
|
ChipSelect: typeof ChipSelect;
|
|
@@ -76,38 +47,43 @@ declare const Controls: {
|
|
|
76
47
|
DateRangePicker: typeof DateRangePicker;
|
|
77
48
|
Rating: typeof Rating;
|
|
78
49
|
Slider: typeof Slider;
|
|
79
|
-
TagsInput: typeof TagsInput
|
|
50
|
+
TagsInput: import('react').LazyExoticComponent<typeof import('./TagsInput/tagsinput').default>;
|
|
80
51
|
ToggleButtons: typeof ToggleButtons;
|
|
81
52
|
PasswordField: typeof PasswordField;
|
|
82
53
|
OtpField: typeof OtpField;
|
|
83
54
|
PhoneField: typeof PhoneField;
|
|
84
55
|
CurrencyField: typeof CurrencyField;
|
|
85
|
-
FileUpload: typeof FileUpload
|
|
56
|
+
FileUpload: import('react').LazyExoticComponent<typeof import('./FileUpload/fileupload').default>;
|
|
86
57
|
Alert: typeof Alert;
|
|
87
58
|
Computed: typeof Computed;
|
|
88
|
-
KeyValueField: typeof KeyValueField
|
|
89
|
-
NumberStepper: typeof NumberStepper
|
|
90
|
-
MatrixField: typeof MatrixField
|
|
91
|
-
ConsentField: typeof ConsentField
|
|
92
|
-
ColorPicker: typeof ColorPicker
|
|
93
|
-
MarkdownEditor: typeof MarkdownEditor
|
|
94
|
-
AddressField: typeof AddressField
|
|
95
|
-
CascadeSelect: typeof CascadeSelect
|
|
96
|
-
FormWizard: typeof FormWizard
|
|
97
|
-
SummaryField: typeof SummaryField
|
|
98
|
-
GeoField: typeof GeoField
|
|
99
|
-
|
|
59
|
+
KeyValueField: import('react').LazyExoticComponent<typeof import('./KeyValueField/keyvaluefield').default>;
|
|
60
|
+
NumberStepper: import('react').LazyExoticComponent<typeof import('./NumberStepper/numberstepper').default>;
|
|
61
|
+
MatrixField: import('react').LazyExoticComponent<typeof import('./MatrixField/matrixfield').default>;
|
|
62
|
+
ConsentField: import('react').LazyExoticComponent<typeof import('./ConsentField/consentfield').default>;
|
|
63
|
+
ColorPicker: import('react').LazyExoticComponent<typeof import('./ColorPicker/colorpicker').default>;
|
|
64
|
+
MarkdownEditor: import('react').LazyExoticComponent<typeof import('./MarkdownEditor/markdowneditor').default>;
|
|
65
|
+
AddressField: import('react').LazyExoticComponent<typeof import('./AddressField/addressfield').default>;
|
|
66
|
+
CascadeSelect: import('react').LazyExoticComponent<typeof import('./CascadeSelect/cascadeselect').default>;
|
|
67
|
+
FormWizard: import('react').LazyExoticComponent<typeof import('./FormWizard/formwizard').default>;
|
|
68
|
+
SummaryField: import('react').LazyExoticComponent<typeof import('./SummaryField/summaryfield').default>;
|
|
69
|
+
GeoField: import('react').LazyExoticComponent<typeof import('./GeoField/geofield').default>;
|
|
70
|
+
RichTextEditor: import('react').LazyExoticComponent<typeof import('./RichTextEditor/richtexteditor').default>;
|
|
71
|
+
NpsScale: import('react').LazyExoticComponent<typeof import('./NpsScale/npsscale').default>;
|
|
72
|
+
EditableTable: import('react').LazyExoticComponent<typeof import('./EditableTable/editabletable').default>;
|
|
73
|
+
IntlPhone: import('react').LazyExoticComponent<typeof import('./IntlPhone/intlphone').default>;
|
|
74
|
+
AsyncAutocomplete: import('react').LazyExoticComponent<typeof import('./AsyncAutocomplete/asyncautocomplete').default>;
|
|
75
|
+
List: import('react').LazyExoticComponent<typeof import('./List/list').default>;
|
|
100
76
|
NumberField: typeof NumberField;
|
|
101
|
-
MultiTextbox: typeof MultiTextbox
|
|
102
|
-
LineItemList: typeof LineItemList
|
|
103
|
-
FormRepeater: typeof FormRepeater
|
|
104
|
-
Signature: typeof Signature
|
|
105
|
-
Group: typeof Group
|
|
106
|
-
Accordion: typeof Accordion
|
|
107
|
-
Tabs: typeof Tabs
|
|
77
|
+
MultiTextbox: import('react').LazyExoticComponent<typeof import('./MultiTextbox/multitextbox').default>;
|
|
78
|
+
LineItemList: import('react').LazyExoticComponent<typeof import('./LineItemList/lineitemlist').default>;
|
|
79
|
+
FormRepeater: import('react').LazyExoticComponent<typeof import('./FormRepeater/formrepeater').default>;
|
|
80
|
+
Signature: import('react').LazyExoticComponent<typeof import('./Signature/signature').default>;
|
|
81
|
+
Group: import('react').LazyExoticComponent<typeof import('./Group/group').default>;
|
|
82
|
+
Accordion: import('react').LazyExoticComponent<typeof import('./Accordion/accordion').default>;
|
|
83
|
+
Tabs: import('react').LazyExoticComponent<typeof import('./Tabs/tabs').default>;
|
|
108
84
|
AutoComplete: typeof AutoComplete;
|
|
109
|
-
ImgList: typeof
|
|
85
|
+
ImgList: import('react').LazyExoticComponent<typeof import('./ImageList/imagelist').default>;
|
|
110
86
|
Hyperlink: typeof Hyperlink;
|
|
111
|
-
LocationField: typeof LocationField
|
|
87
|
+
LocationField: import('react').LazyExoticComponent<typeof import('./LocationField/locationfield').default>;
|
|
112
88
|
};
|
|
113
89
|
export default Controls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),M=require("@mui/material/Box"),w=require("@mui/material/Checkbox"),R=require("@mui/material/FormControl"),P=require("@mui/material/FormControlLabel"),V=require("@mui/material/FormHelperText"),A=require("@mui/material/styles"),o=require("./index-D08GIfqF.js");function B({attributes:l={},rules:c={},onChange:h}){const{MuiAttributes:g={},id:p="",text:f="",label:i="I agree to the terms",requireScroll:u=!0}=l,[S,d]=a.useState(!!l.value),[q,b]=a.useState(!u),[C,j]=a.useState(!1),[m,v]=a.useState("");o.useUpdateEffect(()=>{d(!!l.value)},[l.value]);const n=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,y=e=>{let r=!0,s="";return n&&!e&&(r=!1,s=c?.validation?.find(x=>x.rule==="mandatory"||x.rule==="mandatoryselect")?.message||"Required"),{isValid:r,message:s}},T=e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-4&&b(!0)},k=e=>{const r=e.target.checked;d(r);const s=y(r);j(!s.isValid),v(s.message),h?.({id:p,value:r})},H=u&&!q,{sx:E,...F}=g,L=n?t.jsxs("span",{children:[i,t.jsx("span",{"aria-hidden":"true",style:{color:"#d32f2f",marginLeft:2},children:"*"})]}):i;return t.jsxs(R,{required:n,error:C,component:"fieldset",fullWidth:!0,children:[t.jsx(M,{"data-testid":"consent-terms",onScroll:T,sx:o.mergeSx(o.premiumSurfaceSx,{maxHeight:200,overflow:"auto",p:2,mb:1,whiteSpace:"pre-wrap",backgroundColor:e=>A.alpha(e.palette.background.paper,1)}),children:f}),t.jsx(P,{...F,sx:o.mergeSx(o.premiumControlLabelSx,E),label:L,control:t.jsx(w,{checked:S,disabled:H,onChange:k,required:n,inputProps:{"aria-label":"consent-agree"}})}),m&&t.jsx(V,{children:m})]})}exports.default=B;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import j from "@mui/material/Box";
|
|
4
|
+
import R from "@mui/material/Checkbox";
|
|
5
|
+
import V from "@mui/material/FormControl";
|
|
6
|
+
import A from "@mui/material/FormControlLabel";
|
|
7
|
+
import B from "@mui/material/FormHelperText";
|
|
8
|
+
import { alpha as I } from "@mui/material/styles";
|
|
9
|
+
import { u as P, m as f, b as U, c as W } from "./index-CddjLTWF.mjs";
|
|
10
|
+
function Z({ attributes: a = {}, rules: n = {}, onChange: h }) {
|
|
11
|
+
const {
|
|
12
|
+
MuiAttributes: g = {},
|
|
13
|
+
id: x = "",
|
|
14
|
+
text: S = "",
|
|
15
|
+
label: c = "I agree to the terms",
|
|
16
|
+
requireScroll: i = !0
|
|
17
|
+
} = a, [b, d] = s.useState(!!a.value), [C, v] = s.useState(!i), [k, T] = s.useState(!1), [m, y] = s.useState("");
|
|
18
|
+
P(() => {
|
|
19
|
+
d(!!a.value);
|
|
20
|
+
}, [a.value]);
|
|
21
|
+
const l = n?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, H = (e) => {
|
|
22
|
+
let r = !0, t = "";
|
|
23
|
+
return l && !e && (r = !1, t = n?.validation?.find(
|
|
24
|
+
(u) => u.rule === "mandatory" || u.rule === "mandatoryselect"
|
|
25
|
+
)?.message || "Required"), { isValid: r, message: t };
|
|
26
|
+
}, q = (e) => {
|
|
27
|
+
const r = e.currentTarget;
|
|
28
|
+
r.scrollTop + r.clientHeight >= r.scrollHeight - 4 && v(!0);
|
|
29
|
+
}, E = (e) => {
|
|
30
|
+
const r = e.target.checked;
|
|
31
|
+
d(r);
|
|
32
|
+
const t = H(r);
|
|
33
|
+
T(!t.isValid), y(t.message), h?.({ id: x, value: r });
|
|
34
|
+
}, F = i && !C, { sx: L, ...w } = g, M = l ? /* @__PURE__ */ p("span", { children: [
|
|
35
|
+
c,
|
|
36
|
+
/* @__PURE__ */ o("span", { "aria-hidden": "true", style: { color: "#d32f2f", marginLeft: 2 }, children: "*" })
|
|
37
|
+
] }) : c;
|
|
38
|
+
return /* @__PURE__ */ p(V, { required: l, error: k, component: "fieldset", fullWidth: !0, children: [
|
|
39
|
+
/* @__PURE__ */ o(
|
|
40
|
+
j,
|
|
41
|
+
{
|
|
42
|
+
"data-testid": "consent-terms",
|
|
43
|
+
onScroll: q,
|
|
44
|
+
sx: f(U, {
|
|
45
|
+
maxHeight: 200,
|
|
46
|
+
overflow: "auto",
|
|
47
|
+
p: 2,
|
|
48
|
+
mb: 1,
|
|
49
|
+
whiteSpace: "pre-wrap",
|
|
50
|
+
backgroundColor: (e) => I(e.palette.background.paper, 1)
|
|
51
|
+
}),
|
|
52
|
+
children: S
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ o(
|
|
56
|
+
A,
|
|
57
|
+
{
|
|
58
|
+
...w,
|
|
59
|
+
sx: f(W, L),
|
|
60
|
+
label: M,
|
|
61
|
+
control: /* @__PURE__ */ o(
|
|
62
|
+
R,
|
|
63
|
+
{
|
|
64
|
+
checked: b,
|
|
65
|
+
disabled: F,
|
|
66
|
+
onChange: E,
|
|
67
|
+
required: l,
|
|
68
|
+
inputProps: { "aria-label": "consent-agree" }
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
m && /* @__PURE__ */ o(B, { children: m })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
Z as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i, { Suspense as a } from "react";
|
|
3
|
+
import n from "@mui/material/Box";
|
|
4
|
+
import s from "@mui/material/CircularProgress";
|
|
5
|
+
const l = i.lazy(
|
|
6
|
+
() => import("@mui/x-data-grid").then((t) => ({ default: t.DataGrid }))
|
|
7
|
+
);
|
|
8
|
+
function d({ attributes: t = {} }) {
|
|
9
|
+
const { MuiAttributes: e = {}, container: o = {} } = t;
|
|
10
|
+
return /* @__PURE__ */ r("div", { ...o, children: /* @__PURE__ */ r(
|
|
11
|
+
a,
|
|
12
|
+
{
|
|
13
|
+
fallback: /* @__PURE__ */ r(n, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ r(s, {}) }),
|
|
14
|
+
children: /* @__PURE__ */ r(l, { rows: [], columns: [], ...e })
|
|
15
|
+
}
|
|
16
|
+
) });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
d as default
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var j=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!x.call(e,s)&&s!==r&&a(e,s,{get:()=>t[s],enumerable:!(i=u(t,s))||i.enumerable});return e};var f=(e,t,r)=>(r=e!=null?o(d(e)):{},j(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("react"),b=require("@mui/material/Box"),p=require("@mui/material/CircularProgress"),y=c.lazy(()=>import("@mui/x-data-grid").then(e=>({default:e.DataGrid})));function h({attributes:e={}}){const{MuiAttributes:t={},container:r={}}=e;return n.jsx("div",{...r,children:n.jsx(c.Suspense,{fallback:n.jsx(b,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(p,{})}),children:n.jsx(y,{rows:[],columns:[],...t})})})}exports.default=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D08GIfqF.js");exports.AIFill=e.AIFill;exports.AIForm=e.AIForm;exports.AIFormGenerator=e.AIFormGenerator;exports.AISchemaReview=e.AISchemaReview;exports.AITextAssist=e.AITextAssist;exports.AIVisionImport=e.AIVisionImport;exports.ClearFormData=e.ClearFormData;exports.Controls=e.Controls_default;exports.DynamicComponent=e.DynamicComponent;exports.FormData=e.FormData;exports.FormGenerator=e.FormGenerator;exports.MuiConfig=e.mui;exports.createAIClient=e.createAIClient;exports.defineForm=e.defineForm;exports.formFieldsToSimple=e.formFieldsToSimple;exports.getRegisteredControl=e.getRegisteredControl;exports.hasRegisteredControl=e.hasRegisteredControl;exports.registerControl=e.registerControl;exports.registerControls=e.registerControls;exports.registeredControlTypes=e.registeredControlTypes;exports.simpleFieldsToFormFields=e.simpleFieldsToFormFields;exports.slug=e.slug;exports.unregisterControl=e.unregisterControl;exports.useAIAssist=e.useAIAssist;exports.useForm=e.useForm;exports.useFormEngine=e.useFormEngine;exports.validateSchema=e.validateSchema;exports.yupResolver=e.yupResolver;exports.zodResolver=e.zodResolver;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A as a, k as o, l as r, o as t, q as i, r as l, s as n, C as m, D as F, e as C, F as A, h as g, t as I, v as d, w as p, x as u, y as v, z as R, B as c, E as f, G as h, H as y, I as D, J as T, K as x, L as G, M as S, N as w, O as z } from "./index-CddjLTWF.mjs";
|
|
2
|
+
export {
|
|
3
|
+
a as AIFill,
|
|
4
|
+
o as AIForm,
|
|
5
|
+
r as AIFormGenerator,
|
|
6
|
+
t as AISchemaReview,
|
|
7
|
+
i as AITextAssist,
|
|
8
|
+
l as AIVisionImport,
|
|
9
|
+
n as ClearFormData,
|
|
10
|
+
m as Controls,
|
|
11
|
+
F as DynamicComponent,
|
|
12
|
+
C as FormData,
|
|
13
|
+
A as FormGenerator,
|
|
14
|
+
g as MuiConfig,
|
|
15
|
+
I as createAIClient,
|
|
16
|
+
d as defineForm,
|
|
17
|
+
p as formFieldsToSimple,
|
|
18
|
+
u as getRegisteredControl,
|
|
19
|
+
v as hasRegisteredControl,
|
|
20
|
+
R as registerControl,
|
|
21
|
+
c as registerControls,
|
|
22
|
+
f as registeredControlTypes,
|
|
23
|
+
h as simpleFieldsToFormFields,
|
|
24
|
+
y as slug,
|
|
25
|
+
D as unregisterControl,
|
|
26
|
+
T as useAIAssist,
|
|
27
|
+
x as useForm,
|
|
28
|
+
G as useFormEngine,
|
|
29
|
+
S as validateSchema,
|
|
30
|
+
w as yupResolver,
|
|
31
|
+
z as zodResolver
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),A=require("@mui/material/Table"),S=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),z=require("@mui/material/TableContainer"),I=require("@mui/material/TableHead"),j=require("@mui/material/TableRow"),W=require("@mui/material/TextField"),B=require("@mui/material/IconButton"),F=require("@mui/material/Button"),M=require("@mui/material/FormControl"),P=require("@mui/material/FormLabel"),E=require("@mui/material/Paper"),L=require("@mui/icons-material/Add"),H=require("@mui/icons-material/Close"),d=require("./index-D08GIfqF.js");function f(o){return Array.isArray(o)?o.map(c=>({...c||{}})):[]}function O({attributes:o={},onChange:c}){const{MuiAttributes:g={},id:p="",columns:x=[],addLabel:q="Add row",label:m}=o,{sx:v,...y}=g,h=Array.isArray(x)?x:[],[l,i]=w.useState(()=>f(o.value));d.useUpdateEffect(()=>{i(f(o.value))},[o.value]);const u=r=>{c?.({id:p,value:r})},C=(r,n,t)=>{const s=l.map((b,k)=>k===r?{...b,[n]:t}:b);i(s),u(s)},R=()=>{const r=[...l,{}];i(r),u(r)},T=r=>{const n=l.filter((t,s)=>s!==r);i(n),u(n)};return e.jsxs(M,{component:"fieldset",fullWidth:!0,children:[m&&e.jsx(P,{component:"legend",sx:{mb:1},children:m}),e.jsx(z,{component:E,variant:"outlined",sx:{borderRadius:2,overflow:"hidden"},children:e.jsxs(A,{size:"small",children:[e.jsx(I,{children:e.jsxs(j,{sx:{backgroundColor:"action.hover"},children:[h.map(r=>e.jsx(a,{sx:{fontWeight:600},children:r.label},r.key)),e.jsx(a,{align:"right",sx:{width:48}})]})}),e.jsx(S,{children:l.map((r,n)=>e.jsxs(j,{sx:{transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{backgroundColor:"action.hover"}},children:[h.map(t=>e.jsx(a,{children:e.jsx(W,{...y,type:t.type==="number"?"number":"text",value:r[t.key]??"",onChange:s=>C(n,t.key,s.target.value),inputProps:{"aria-label":`${t.label} row ${n+1}`},size:"small",variant:"standard",fullWidth:!0,sx:d.mergeSx(d.premiumInputSx,v)})},t.key)),e.jsx(a,{align:"right",children:e.jsx(B,{"aria-label":`Remove row ${n+1}`,onClick:()=>T(n),size:"small",sx:{borderRadius:2,color:"text.secondary","&:hover":{color:"error.main"}},children:e.jsx(H,{fontSize:"small"})})})]},n))})]})}),e.jsx(F,{onClick:R,startIcon:e.jsx(L,{}),size:"small",variant:"text",sx:{alignSelf:"flex-start",mt:1,borderRadius:2,textTransform:"none",fontWeight:600},children:q})]})}exports.default=O;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import z from "react";
|
|
3
|
+
import S from "@mui/material/Table";
|
|
4
|
+
import I from "@mui/material/TableBody";
|
|
5
|
+
import s from "@mui/material/TableCell";
|
|
6
|
+
import W from "@mui/material/TableContainer";
|
|
7
|
+
import B from "@mui/material/TableHead";
|
|
8
|
+
import b from "@mui/material/TableRow";
|
|
9
|
+
import F from "@mui/material/TextField";
|
|
10
|
+
import $ from "@mui/material/IconButton";
|
|
11
|
+
import j from "@mui/material/Button";
|
|
12
|
+
import E from "@mui/material/FormControl";
|
|
13
|
+
import L from "@mui/material/FormLabel";
|
|
14
|
+
import M from "@mui/material/Paper";
|
|
15
|
+
import P from "@mui/icons-material/Add";
|
|
16
|
+
import H from "@mui/icons-material/Close";
|
|
17
|
+
import { u as U, m as _, a as q } from "./index-CddjLTWF.mjs";
|
|
18
|
+
function x(n) {
|
|
19
|
+
return Array.isArray(n) ? n.map((d) => ({ ...d || {} })) : [];
|
|
20
|
+
}
|
|
21
|
+
function lr({ attributes: n = {}, onChange: d }) {
|
|
22
|
+
const {
|
|
23
|
+
MuiAttributes: g = {},
|
|
24
|
+
id: v = "",
|
|
25
|
+
columns: u = [],
|
|
26
|
+
addLabel: y = "Add row",
|
|
27
|
+
label: p
|
|
28
|
+
} = n, { sx: C, ...k } = g, f = Array.isArray(u) ? u : [], [l, i] = z.useState(() => x(n.value));
|
|
29
|
+
U(() => {
|
|
30
|
+
i(x(n.value));
|
|
31
|
+
}, [n.value]);
|
|
32
|
+
const c = (r) => {
|
|
33
|
+
d?.({ id: v, value: r });
|
|
34
|
+
}, w = (r, o, t) => {
|
|
35
|
+
const a = l.map((h, T) => T === r ? { ...h, [o]: t } : h);
|
|
36
|
+
i(a), c(a);
|
|
37
|
+
}, A = () => {
|
|
38
|
+
const r = [...l, {}];
|
|
39
|
+
i(r), c(r);
|
|
40
|
+
}, R = (r) => {
|
|
41
|
+
const o = l.filter((t, a) => a !== r);
|
|
42
|
+
i(o), c(o);
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ m(E, { component: "fieldset", fullWidth: !0, children: [
|
|
45
|
+
p && /* @__PURE__ */ e(L, { component: "legend", sx: { mb: 1 }, children: p }),
|
|
46
|
+
/* @__PURE__ */ e(
|
|
47
|
+
W,
|
|
48
|
+
{
|
|
49
|
+
component: M,
|
|
50
|
+
variant: "outlined",
|
|
51
|
+
sx: {
|
|
52
|
+
borderRadius: 2,
|
|
53
|
+
overflow: "hidden"
|
|
54
|
+
},
|
|
55
|
+
children: /* @__PURE__ */ m(S, { size: "small", children: [
|
|
56
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ m(b, { sx: { backgroundColor: "action.hover" }, children: [
|
|
57
|
+
f.map((r) => /* @__PURE__ */ e(s, { sx: { fontWeight: 600 }, children: r.label }, r.key)),
|
|
58
|
+
/* @__PURE__ */ e(s, { align: "right", sx: { width: 48 } })
|
|
59
|
+
] }) }),
|
|
60
|
+
/* @__PURE__ */ e(I, { children: l.map((r, o) => /* @__PURE__ */ m(
|
|
61
|
+
b,
|
|
62
|
+
{
|
|
63
|
+
sx: {
|
|
64
|
+
transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
65
|
+
"&:hover": { backgroundColor: "action.hover" }
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
f.map((t) => /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
|
|
69
|
+
F,
|
|
70
|
+
{
|
|
71
|
+
...k,
|
|
72
|
+
type: t.type === "number" ? "number" : "text",
|
|
73
|
+
value: r[t.key] ?? "",
|
|
74
|
+
onChange: (a) => w(o, t.key, a.target.value),
|
|
75
|
+
inputProps: {
|
|
76
|
+
"aria-label": `${t.label} row ${o + 1}`
|
|
77
|
+
},
|
|
78
|
+
size: "small",
|
|
79
|
+
variant: "standard",
|
|
80
|
+
fullWidth: !0,
|
|
81
|
+
sx: _(q, C)
|
|
82
|
+
}
|
|
83
|
+
) }, t.key)),
|
|
84
|
+
/* @__PURE__ */ e(s, { align: "right", children: /* @__PURE__ */ e(
|
|
85
|
+
$,
|
|
86
|
+
{
|
|
87
|
+
"aria-label": `Remove row ${o + 1}`,
|
|
88
|
+
onClick: () => R(o),
|
|
89
|
+
size: "small",
|
|
90
|
+
sx: {
|
|
91
|
+
borderRadius: 2,
|
|
92
|
+
color: "text.secondary",
|
|
93
|
+
"&:hover": { color: "error.main" }
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ e(H, { fontSize: "small" })
|
|
96
|
+
}
|
|
97
|
+
) })
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
o
|
|
101
|
+
)) })
|
|
102
|
+
] })
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
j,
|
|
107
|
+
{
|
|
108
|
+
onClick: A,
|
|
109
|
+
startIcon: /* @__PURE__ */ e(P, {}),
|
|
110
|
+
size: "small",
|
|
111
|
+
variant: "text",
|
|
112
|
+
sx: {
|
|
113
|
+
alignSelf: "flex-start",
|
|
114
|
+
mt: 1,
|
|
115
|
+
borderRadius: 2,
|
|
116
|
+
textTransform: "none",
|
|
117
|
+
fontWeight: 600
|
|
118
|
+
},
|
|
119
|
+
children: y
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
lr as default
|
|
126
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as _, useState as m } from "react";
|
|
3
|
+
import s from "@mui/material/Box";
|
|
4
|
+
import c from "@mui/material/Typography";
|
|
5
|
+
import q from "@mui/material/IconButton";
|
|
6
|
+
import H from "@mui/material/CircularProgress";
|
|
7
|
+
import J from "@mui/icons-material/CloudUpload";
|
|
8
|
+
import K from "@mui/icons-material/Close";
|
|
9
|
+
import N from "@mui/icons-material/InsertDriveFile";
|
|
10
|
+
import { u as Q, m as V, b as W } from "./index-CddjLTWF.mjs";
|
|
11
|
+
import { u as X } from "./s3Upload-dpioZ2c8.mjs";
|
|
12
|
+
const R = (r) => r ? Array.isArray(r) ? r.filter(Boolean) : [r] : [], Y = (r) => /^data:image\//i.test(r) || /\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(r), Z = (r) => new Promise((u, g) => {
|
|
13
|
+
const a = new FileReader();
|
|
14
|
+
a.onload = () => u(a.result || ""), a.onerror = () => g(a.error), a.readAsDataURL(r);
|
|
15
|
+
});
|
|
16
|
+
function de({ attributes: r = {}, rules: u = {}, onChange: g }) {
|
|
17
|
+
const {
|
|
18
|
+
id: a = "",
|
|
19
|
+
multiple: p = !1,
|
|
20
|
+
accept: h = "",
|
|
21
|
+
bucket: z = "",
|
|
22
|
+
region: B = "",
|
|
23
|
+
identityPoolId: F = "",
|
|
24
|
+
path: $ = "",
|
|
25
|
+
maxSizeMB: x = 0,
|
|
26
|
+
label: w = "Upload file",
|
|
27
|
+
MuiAttributes: P = {}
|
|
28
|
+
} = r, D = _(null), [d, v] = m(R(r.value)), [S, b] = m(!1), [j, U] = m(!1), [k, y] = m(""), L = u?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1;
|
|
29
|
+
Q(() => {
|
|
30
|
+
v(R(r.value));
|
|
31
|
+
}, [r.value]);
|
|
32
|
+
const C = (e, o) => {
|
|
33
|
+
g?.({ id: a, value: p ? e : e[0] ?? "", option: o });
|
|
34
|
+
}, I = async (e) => {
|
|
35
|
+
const o = Array.from(e);
|
|
36
|
+
if (!o.length) return;
|
|
37
|
+
y(""), U(!0);
|
|
38
|
+
const i = [], f = [];
|
|
39
|
+
try {
|
|
40
|
+
for (const n of o) {
|
|
41
|
+
if (x && n.size > x * 1024 * 1024) {
|
|
42
|
+
y(`"${n.name}" exceeds the ${x}MB limit.`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const O = await Z(n), G = await X(O, n.name, z, B, F, $);
|
|
46
|
+
i.push(G), f.push(n);
|
|
47
|
+
}
|
|
48
|
+
} catch (n) {
|
|
49
|
+
console.error("FileUpload failed", n), y("Upload failed. Please try again.");
|
|
50
|
+
} finally {
|
|
51
|
+
U(!1);
|
|
52
|
+
}
|
|
53
|
+
if (!i.length) return;
|
|
54
|
+
const A = p ? [...d, ...i] : i.slice(0, 1);
|
|
55
|
+
v(A), C(A, f);
|
|
56
|
+
}, M = (e) => {
|
|
57
|
+
e.target.files && I(e.target.files), e.target.value = "";
|
|
58
|
+
}, T = (e) => {
|
|
59
|
+
e.preventDefault(), b(!1), e.dataTransfer?.files?.length && I(e.dataTransfer.files);
|
|
60
|
+
}, E = (e) => {
|
|
61
|
+
const o = d.filter((i, f) => f !== e);
|
|
62
|
+
v(o), C(o);
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ l(s, { sx: { width: "100%", ...P.sx }, children: [
|
|
65
|
+
/* @__PURE__ */ l(c, { variant: "subtitle2", gutterBottom: !0, sx: { display: "flex" }, children: [
|
|
66
|
+
w,
|
|
67
|
+
L && /* @__PURE__ */ t(s, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ t(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
ref: D,
|
|
73
|
+
type: "file",
|
|
74
|
+
hidden: !0,
|
|
75
|
+
multiple: p,
|
|
76
|
+
accept: h || void 0,
|
|
77
|
+
onChange: M
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ l(
|
|
81
|
+
s,
|
|
82
|
+
{
|
|
83
|
+
role: "button",
|
|
84
|
+
"aria-label": w,
|
|
85
|
+
onClick: () => D.current?.click(),
|
|
86
|
+
onDragOver: (e) => {
|
|
87
|
+
e.preventDefault(), b(!0);
|
|
88
|
+
},
|
|
89
|
+
onDragLeave: () => b(!1),
|
|
90
|
+
onDrop: T,
|
|
91
|
+
sx: {
|
|
92
|
+
border: "2px dashed",
|
|
93
|
+
borderColor: S ? "primary.main" : "divider",
|
|
94
|
+
borderRadius: "12px",
|
|
95
|
+
p: 3,
|
|
96
|
+
textAlign: "center",
|
|
97
|
+
cursor: "pointer",
|
|
98
|
+
transition: "all .2s",
|
|
99
|
+
bgcolor: S ? "action.hover" : "background.paper",
|
|
100
|
+
"&:hover": { borderColor: "primary.main", bgcolor: "action.hover" }
|
|
101
|
+
},
|
|
102
|
+
children: [
|
|
103
|
+
j ? /* @__PURE__ */ t(H, { size: 28 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 40, color: "primary.main" } }),
|
|
104
|
+
/* @__PURE__ */ l(c, { variant: "body2", sx: { mt: 1 }, children: [
|
|
105
|
+
"Drag & drop ",
|
|
106
|
+
p ? "files" : "a file",
|
|
107
|
+
" here, or click to browse"
|
|
108
|
+
] }),
|
|
109
|
+
h && /* @__PURE__ */ l(c, { variant: "caption", color: "text.secondary", children: [
|
|
110
|
+
"Accepted: ",
|
|
111
|
+
h
|
|
112
|
+
] })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
k && /* @__PURE__ */ t(c, { variant: "caption", color: "error.main", sx: { display: "block", mt: 1 }, children: k }),
|
|
117
|
+
d.length > 0 && /* @__PURE__ */ t(s, { sx: V(W, { mt: 1.5, p: 1 }), children: d.map((e, o) => /* @__PURE__ */ l(
|
|
118
|
+
s,
|
|
119
|
+
{
|
|
120
|
+
sx: {
|
|
121
|
+
display: "flex",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: 1.5,
|
|
124
|
+
p: 1,
|
|
125
|
+
borderRadius: "8px",
|
|
126
|
+
transition: "background-color .18s",
|
|
127
|
+
"&:hover": { bgcolor: "action.hover" }
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
Y(e) ? /* @__PURE__ */ t(
|
|
131
|
+
s,
|
|
132
|
+
{
|
|
133
|
+
component: "img",
|
|
134
|
+
src: e,
|
|
135
|
+
alt: `upload-${o}`,
|
|
136
|
+
sx: {
|
|
137
|
+
width: 40,
|
|
138
|
+
height: 40,
|
|
139
|
+
objectFit: "cover",
|
|
140
|
+
borderRadius: "8px",
|
|
141
|
+
flexShrink: 0
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
) : /* @__PURE__ */ t(N, { color: "action", sx: { flexShrink: 0 } }),
|
|
145
|
+
/* @__PURE__ */ t(
|
|
146
|
+
c,
|
|
147
|
+
{
|
|
148
|
+
variant: "body2",
|
|
149
|
+
sx: { flexGrow: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
150
|
+
children: e.split("/").pop()?.split("?")[0] || e
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ t(
|
|
154
|
+
q,
|
|
155
|
+
{
|
|
156
|
+
size: "small",
|
|
157
|
+
"aria-label": "remove",
|
|
158
|
+
onClick: (i) => {
|
|
159
|
+
i.stopPropagation(), E(o);
|
|
160
|
+
},
|
|
161
|
+
children: /* @__PURE__ */ t(K, { fontSize: "small" })
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
`${e}-${o}`
|
|
167
|
+
)) })
|
|
168
|
+
] });
|
|
169
|
+
}
|
|
170
|
+
export {
|
|
171
|
+
de as default
|
|
172
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),i=require("@mui/material/Box"),c=require("@mui/material/Typography"),G=require("@mui/material/IconButton"),_=require("@mui/material/CircularProgress"),H=require("@mui/icons-material/CloudUpload"),J=require("@mui/icons-material/Close"),K=require("@mui/icons-material/InsertDriveFile"),b=require("./index-D08GIfqF.js"),N=require("./s3Upload-B0JeoLkS.js"),C=o=>o?Array.isArray(o)?o.filter(Boolean):[o]:[],Q=o=>/^data:image\//i.test(o)||/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(o),V=o=>new Promise((f,x)=>{const s=new FileReader;s.onload=()=>f(s.result||""),s.onerror=()=>x(s.error),s.readAsDataURL(o)});function W({attributes:o={},rules:f={},onChange:x}){const{id:s="",multiple:d=!1,accept:g="",bucket:I="",region:A="",identityPoolId:z="",path:B="",maxSizeMB:h=0,label:j="Upload file",MuiAttributes:F={}}=o,S=l.useRef(null),[p,m]=l.useState(C(o.value)),[w,v]=l.useState(!1),[P,U]=l.useState(!1),[q,y]=l.useState(""),$=f?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1;b.useUpdateEffect(()=>{m(C(o.value))},[o.value]);const D=(e,t)=>{x?.({id:s,value:d?e:e[0]??"",option:t})},k=async e=>{const t=Array.from(e);if(!t.length)return;y(""),U(!0);const a=[],u=[];try{for(const n of t){if(h&&n.size>h*1024*1024){y(`"${n.name}" exceeds the ${h}MB limit.`);continue}const O=await V(n),E=await N.uploadToS3(O,n.name,I,A,z,B);a.push(E),u.push(n)}}catch(n){console.error("FileUpload failed",n),y("Upload failed. Please try again.")}finally{U(!1)}if(!a.length)return;const R=d?[...p,...a]:a.slice(0,1);m(R),D(R,u)},M=e=>{e.target.files&&k(e.target.files),e.target.value=""},T=e=>{e.preventDefault(),v(!1),e.dataTransfer?.files?.length&&k(e.dataTransfer.files)},L=e=>{const t=p.filter((a,u)=>u!==e);m(t),D(t)};return r.jsxs(i,{sx:{width:"100%",...F.sx},children:[r.jsxs(c,{variant:"subtitle2",gutterBottom:!0,sx:{display:"flex"},children:[j,$&&r.jsx(i,{component:"span",sx:{color:"error.main",ml:.5},children:"*"})]}),r.jsx("input",{ref:S,type:"file",hidden:!0,multiple:d,accept:g||void 0,onChange:M}),r.jsxs(i,{role:"button","aria-label":j,onClick:()=>S.current?.click(),onDragOver:e=>{e.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:T,sx:{border:"2px dashed",borderColor:w?"primary.main":"divider",borderRadius:"12px",p:3,textAlign:"center",cursor:"pointer",transition:"all .2s",bgcolor:w?"action.hover":"background.paper","&:hover":{borderColor:"primary.main",bgcolor:"action.hover"}},children:[P?r.jsx(_,{size:28}):r.jsx(H,{sx:{fontSize:40,color:"primary.main"}}),r.jsxs(c,{variant:"body2",sx:{mt:1},children:["Drag & drop ",d?"files":"a file"," here, or click to browse"]}),g&&r.jsxs(c,{variant:"caption",color:"text.secondary",children:["Accepted: ",g]})]}),q&&r.jsx(c,{variant:"caption",color:"error.main",sx:{display:"block",mt:1},children:q}),p.length>0&&r.jsx(i,{sx:b.mergeSx(b.premiumSurfaceSx,{mt:1.5,p:1}),children:p.map((e,t)=>r.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1.5,p:1,borderRadius:"8px",transition:"background-color .18s","&:hover":{bgcolor:"action.hover"}},children:[Q(e)?r.jsx(i,{component:"img",src:e,alt:`upload-${t}`,sx:{width:40,height:40,objectFit:"cover",borderRadius:"8px",flexShrink:0}}):r.jsx(K,{color:"action",sx:{flexShrink:0}}),r.jsx(c,{variant:"body2",sx:{flexGrow:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.split("/").pop()?.split("?")[0]||e}),r.jsx(G,{size:"small","aria-label":"remove",onClick:a=>{a.stopPropagation(),L(t)},children:r.jsx(J,{fontSize:"small"})})]},`${e}-${t}`))})]})}exports.default=W;
|