@loopr-ai/craft 0.7.4 → 0.7.6
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/components/organ/Form/Form.interfaces.d.ts +1 -1
- package/dist/components/organ/Form/Form.styles.d.ts +4 -1
- package/dist/components/organ/Form/Form.styles.js +5 -2
- package/dist/components/organ/Form/FormInput.js +157 -158
- package/dist/components/organ/Form/index.js +126 -121
- package/package.json +1 -1
- package/dist/global/constants.d.ts +0 -3
|
@@ -38,7 +38,7 @@ interface Validation {
|
|
|
38
38
|
export interface ConfigField extends SelectField {
|
|
39
39
|
validation?: Validation;
|
|
40
40
|
customComponent?: string;
|
|
41
|
-
submitDataKey
|
|
41
|
+
submitDataKey: Array<string> | string;
|
|
42
42
|
preFillWithDateTime?: boolean;
|
|
43
43
|
groupName?: string;
|
|
44
44
|
hidden?: boolean;
|
|
@@ -27,6 +27,7 @@ declare const styles: {
|
|
|
27
27
|
};
|
|
28
28
|
"& > div": {
|
|
29
29
|
flex: number;
|
|
30
|
+
overflow: string;
|
|
30
31
|
};
|
|
31
32
|
"&:has(.Mui-focused)": {
|
|
32
33
|
outlineColor: string;
|
|
@@ -35,7 +36,8 @@ declare const styles: {
|
|
|
35
36
|
heading: {
|
|
36
37
|
textAlign: string;
|
|
37
38
|
fontWeight: number;
|
|
38
|
-
|
|
39
|
+
marginTop: string;
|
|
40
|
+
marginBottom: string;
|
|
39
41
|
};
|
|
40
42
|
label: {
|
|
41
43
|
color: string;
|
|
@@ -73,6 +75,7 @@ declare const styles: {
|
|
|
73
75
|
"& .MuiSelect-select": {
|
|
74
76
|
padding: string;
|
|
75
77
|
position: string;
|
|
78
|
+
textAlign: string;
|
|
76
79
|
"& > span::before": {
|
|
77
80
|
position: string;
|
|
78
81
|
right: string;
|
|
@@ -27,7 +27,8 @@ const r = {
|
|
|
27
27
|
flex: 1
|
|
28
28
|
},
|
|
29
29
|
"& > div": {
|
|
30
|
-
flex: 2
|
|
30
|
+
flex: 2,
|
|
31
|
+
overflow: "hidden"
|
|
31
32
|
},
|
|
32
33
|
"&:has(.Mui-focused)": {
|
|
33
34
|
outlineColor: "black"
|
|
@@ -36,7 +37,8 @@ const r = {
|
|
|
36
37
|
heading: {
|
|
37
38
|
textAlign: "left",
|
|
38
39
|
fontWeight: 500,
|
|
39
|
-
|
|
40
|
+
marginTop: "2rem",
|
|
41
|
+
marginBottom: "0.75rem"
|
|
40
42
|
},
|
|
41
43
|
label: {
|
|
42
44
|
color: e.darkGrey,
|
|
@@ -74,6 +76,7 @@ const r = {
|
|
|
74
76
|
"& .MuiSelect-select": {
|
|
75
77
|
padding: "0.75rem",
|
|
76
78
|
position: "relative",
|
|
79
|
+
textAlign: "right",
|
|
77
80
|
"& > span::before": {
|
|
78
81
|
position: "absolute",
|
|
79
82
|
right: "2rem"
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import oe, { jsx as r, jsxs as
|
|
1
|
+
import oe, { jsx as r, jsxs as z, Fragment as se } from "react/jsx-runtime";
|
|
2
2
|
import { r as ne, i as ae } from "../../../createSvgIcon-f773ce57.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as h from "react";
|
|
4
4
|
import { useState as re, useCallback as ie, useEffect as le } from "react";
|
|
5
|
-
import { customColors as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { g as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return H("MuiInputAdornment", e);
|
|
5
|
+
import { customColors as P } from "../../../global/colors.js";
|
|
6
|
+
import { M as ce, T as k } from "../../../index-03287c17.js";
|
|
7
|
+
import y from "./Form.styles.js";
|
|
8
|
+
import { d as F, B as R, T as de } from "../../../Tooltip-b926c320.js";
|
|
9
|
+
import { u as ue, F as pe, L as _, T as me } from "../../../TextField-fded06e5.js";
|
|
10
|
+
import { g as W, a as I, _ as Y, P as t, c as S, e as $ } from "../../../createTheme-a4db2989.js";
|
|
11
|
+
import { g as E, s as q, a as H, c as w, b as K, r as fe } from "../../../styled-126c6a62.js";
|
|
12
|
+
import { B as ge } from "../../../ButtonBase-85c9347b.js";
|
|
13
|
+
import { c as be, u as ve } from "../../../TransitionGroupContext-fe9a562f.js";
|
|
14
|
+
function Me(e) {
|
|
15
|
+
return W("MuiInputAdornment", e);
|
|
17
16
|
}
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const
|
|
17
|
+
const ye = E("MuiInputAdornment", ["root", "filled", "standard", "outlined", "positionStart", "positionEnd", "disablePointerEvents", "hiddenLabel", "sizeSmall"]), V = ye;
|
|
18
|
+
var B;
|
|
19
|
+
const Ie = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], xe = (e, o) => {
|
|
21
20
|
const {
|
|
22
21
|
ownerState: s
|
|
23
22
|
} = e;
|
|
24
|
-
return [o.root, o[`position${
|
|
25
|
-
},
|
|
23
|
+
return [o.root, o[`position${S(s.position)}`], s.disablePointerEvents === !0 && o.disablePointerEvents, o[s.variant]];
|
|
24
|
+
}, Ne = (e) => {
|
|
26
25
|
const {
|
|
27
26
|
classes: o,
|
|
28
27
|
disablePointerEvents: s,
|
|
@@ -30,14 +29,14 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
|
|
|
30
29
|
position: i,
|
|
31
30
|
size: d,
|
|
32
31
|
variant: l
|
|
33
|
-
} = e,
|
|
34
|
-
root: ["root", s && "disablePointerEvents", i && `position${
|
|
32
|
+
} = e, b = {
|
|
33
|
+
root: ["root", s && "disablePointerEvents", i && `position${S(i)}`, l, a && "hiddenLabel", d && `size${S(d)}`]
|
|
35
34
|
};
|
|
36
|
-
return
|
|
37
|
-
},
|
|
35
|
+
return K(b, Me, o);
|
|
36
|
+
}, Ce = q("div", {
|
|
38
37
|
name: "MuiInputAdornment",
|
|
39
38
|
slot: "Root",
|
|
40
|
-
overridesResolver:
|
|
39
|
+
overridesResolver: xe
|
|
41
40
|
})(({
|
|
42
41
|
theme: e,
|
|
43
42
|
ownerState: o
|
|
@@ -51,7 +50,7 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
|
|
|
51
50
|
color: (e.vars || e).palette.action.active
|
|
52
51
|
}, o.variant === "filled" && {
|
|
53
52
|
// Styles applied to the root element if `variant="filled"`.
|
|
54
|
-
[`&.${
|
|
53
|
+
[`&.${V.positionStart}&:not(.${V.hiddenLabel})`]: {
|
|
55
54
|
marginTop: 16
|
|
56
55
|
}
|
|
57
56
|
}, o.position === "start" && {
|
|
@@ -63,43 +62,43 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
|
|
|
63
62
|
}, o.disablePointerEvents === !0 && {
|
|
64
63
|
// Styles applied to the root element if `disablePointerEvents={true}`.
|
|
65
64
|
pointerEvents: "none"
|
|
66
|
-
})),
|
|
67
|
-
const a =
|
|
65
|
+
})), J = /* @__PURE__ */ h.forwardRef(function(o, s) {
|
|
66
|
+
const a = H({
|
|
68
67
|
props: o,
|
|
69
68
|
name: "MuiInputAdornment"
|
|
70
69
|
}), {
|
|
71
70
|
children: i,
|
|
72
71
|
className: d,
|
|
73
72
|
component: l = "div",
|
|
74
|
-
disablePointerEvents:
|
|
73
|
+
disablePointerEvents: b = !1,
|
|
75
74
|
disableTypography: f = !1,
|
|
76
|
-
position:
|
|
77
|
-
variant:
|
|
78
|
-
} = a,
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
const
|
|
75
|
+
position: N,
|
|
76
|
+
variant: v
|
|
77
|
+
} = a, u = Y(a, Ie), c = ue() || {};
|
|
78
|
+
let p = v;
|
|
79
|
+
v && c.variant && process.env.NODE_ENV !== "production" && v === c.variant && console.error("MUI: The `InputAdornment` variant infers the variant prop you do not have to provide one."), c && !p && (p = c.variant);
|
|
80
|
+
const M = I({}, a, {
|
|
82
81
|
hiddenLabel: c.hiddenLabel,
|
|
83
82
|
size: c.size,
|
|
84
|
-
disablePointerEvents:
|
|
85
|
-
position:
|
|
86
|
-
variant:
|
|
87
|
-
}),
|
|
88
|
-
return /* @__PURE__ */ r(
|
|
83
|
+
disablePointerEvents: b,
|
|
84
|
+
position: N,
|
|
85
|
+
variant: p
|
|
86
|
+
}), C = Ne(M);
|
|
87
|
+
return /* @__PURE__ */ r(pe.Provider, {
|
|
89
88
|
value: null,
|
|
90
|
-
children: /* @__PURE__ */ r(
|
|
89
|
+
children: /* @__PURE__ */ r(Ce, I({
|
|
91
90
|
as: l,
|
|
92
|
-
ownerState:
|
|
93
|
-
className:
|
|
91
|
+
ownerState: M,
|
|
92
|
+
className: w(C.root, d),
|
|
94
93
|
ref: s
|
|
95
|
-
},
|
|
96
|
-
children: typeof i == "string" && !f ? /* @__PURE__ */ r(
|
|
94
|
+
}, u, {
|
|
95
|
+
children: typeof i == "string" && !f ? /* @__PURE__ */ r(ce, {
|
|
97
96
|
color: "text.secondary",
|
|
98
97
|
children: i
|
|
99
|
-
}) : /* @__PURE__ */
|
|
100
|
-
children: [
|
|
98
|
+
}) : /* @__PURE__ */ z(h.Fragment, {
|
|
99
|
+
children: [N === "start" ? (
|
|
101
100
|
/* notranslate needed while Google Translate will not fix zero-width space issue */
|
|
102
|
-
|
|
101
|
+
B || (B = /* @__PURE__ */ r("span", {
|
|
103
102
|
className: "notranslate",
|
|
104
103
|
children: ""
|
|
105
104
|
}))
|
|
@@ -108,7 +107,7 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
|
|
|
108
107
|
}))
|
|
109
108
|
});
|
|
110
109
|
});
|
|
111
|
-
process.env.NODE_ENV !== "production" && (
|
|
110
|
+
process.env.NODE_ENV !== "production" && (J.propTypes = {
|
|
112
111
|
// ----------------------------- Warning --------------------------------
|
|
113
112
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
114
113
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -156,16 +155,16 @@ process.env.NODE_ENV !== "production" && (Y.propTypes = {
|
|
|
156
155
|
*/
|
|
157
156
|
variant: t.oneOf(["filled", "outlined", "standard"])
|
|
158
157
|
});
|
|
159
|
-
const
|
|
160
|
-
function
|
|
161
|
-
return
|
|
158
|
+
const Q = J, Te = E("MuiListItemIcon", ["root", "alignItemsFlexStart"]), G = Te, he = E("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), Z = he;
|
|
159
|
+
function je(e) {
|
|
160
|
+
return W("MuiMenuItem", e);
|
|
162
161
|
}
|
|
163
|
-
const
|
|
162
|
+
const De = E("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), D = De, Oe = ["autoFocus", "component", "dense", "divider", "disableGutters", "focusVisibleClassName", "role", "tabIndex", "className"], $e = (e, o) => {
|
|
164
163
|
const {
|
|
165
164
|
ownerState: s
|
|
166
165
|
} = e;
|
|
167
166
|
return [o.root, s.dense && o.dense, s.divider && o.divider, !s.disableGutters && o.gutters];
|
|
168
|
-
},
|
|
167
|
+
}, ze = (e) => {
|
|
169
168
|
const {
|
|
170
169
|
disabled: o,
|
|
171
170
|
dense: s,
|
|
@@ -173,15 +172,15 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
|
|
|
173
172
|
disableGutters: i,
|
|
174
173
|
selected: d,
|
|
175
174
|
classes: l
|
|
176
|
-
} = e, f =
|
|
175
|
+
} = e, f = K({
|
|
177
176
|
root: ["root", s && "dense", o && "disabled", !i && "gutters", a && "divider", d && "selected"]
|
|
178
|
-
},
|
|
177
|
+
}, je, l);
|
|
179
178
|
return I({}, l, f);
|
|
180
|
-
},
|
|
181
|
-
shouldForwardProp: (e) =>
|
|
179
|
+
}, Ee = q(ge, {
|
|
180
|
+
shouldForwardProp: (e) => fe(e) || e === "classes",
|
|
182
181
|
name: "MuiMenuItem",
|
|
183
182
|
slot: "Root",
|
|
184
|
-
overridesResolver:
|
|
183
|
+
overridesResolver: $e
|
|
185
184
|
})(({
|
|
186
185
|
theme: e,
|
|
187
186
|
ownerState: o
|
|
@@ -211,40 +210,40 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
|
|
|
211
210
|
backgroundColor: "transparent"
|
|
212
211
|
}
|
|
213
212
|
},
|
|
214
|
-
[`&.${
|
|
215
|
-
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` :
|
|
216
|
-
[`&.${
|
|
217
|
-
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` :
|
|
213
|
+
[`&.${D.selected}`]: {
|
|
214
|
+
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : $(e.palette.primary.main, e.palette.action.selectedOpacity),
|
|
215
|
+
[`&.${D.focusVisible}`]: {
|
|
216
|
+
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : $(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
|
|
218
217
|
}
|
|
219
218
|
},
|
|
220
|
-
[`&.${
|
|
221
|
-
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` :
|
|
219
|
+
[`&.${D.selected}:hover`]: {
|
|
220
|
+
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : $(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
|
|
222
221
|
// Reset on touch devices, it doesn't add specificity
|
|
223
222
|
"@media (hover: none)": {
|
|
224
|
-
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` :
|
|
223
|
+
backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : $(e.palette.primary.main, e.palette.action.selectedOpacity)
|
|
225
224
|
}
|
|
226
225
|
},
|
|
227
|
-
[`&.${
|
|
226
|
+
[`&.${D.focusVisible}`]: {
|
|
228
227
|
backgroundColor: (e.vars || e).palette.action.focus
|
|
229
228
|
},
|
|
230
|
-
[`&.${
|
|
229
|
+
[`&.${D.disabled}`]: {
|
|
231
230
|
opacity: (e.vars || e).palette.action.disabledOpacity
|
|
232
231
|
},
|
|
233
|
-
[`& + .${
|
|
232
|
+
[`& + .${F.root}`]: {
|
|
234
233
|
marginTop: e.spacing(1),
|
|
235
234
|
marginBottom: e.spacing(1)
|
|
236
235
|
},
|
|
237
|
-
[`& + .${
|
|
236
|
+
[`& + .${F.inset}`]: {
|
|
238
237
|
marginLeft: 52
|
|
239
238
|
},
|
|
240
|
-
[`& .${
|
|
239
|
+
[`& .${Z.root}`]: {
|
|
241
240
|
marginTop: 0,
|
|
242
241
|
marginBottom: 0
|
|
243
242
|
},
|
|
244
|
-
[`& .${
|
|
243
|
+
[`& .${Z.inset}`]: {
|
|
245
244
|
paddingLeft: 36
|
|
246
245
|
},
|
|
247
|
-
[`& .${
|
|
246
|
+
[`& .${G.root}`]: {
|
|
248
247
|
minWidth: 36
|
|
249
248
|
}
|
|
250
249
|
}, !o.dense && {
|
|
@@ -257,52 +256,52 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
|
|
|
257
256
|
paddingTop: 4,
|
|
258
257
|
paddingBottom: 4
|
|
259
258
|
}, e.typography.body2, {
|
|
260
|
-
[`& .${
|
|
259
|
+
[`& .${G.root} svg`]: {
|
|
261
260
|
fontSize: "1.25rem"
|
|
262
261
|
}
|
|
263
|
-
}))),
|
|
264
|
-
const a =
|
|
262
|
+
}))), X = /* @__PURE__ */ h.forwardRef(function(o, s) {
|
|
263
|
+
const a = H({
|
|
265
264
|
props: o,
|
|
266
265
|
name: "MuiMenuItem"
|
|
267
266
|
}), {
|
|
268
267
|
autoFocus: i = !1,
|
|
269
268
|
component: d = "li",
|
|
270
269
|
dense: l = !1,
|
|
271
|
-
divider:
|
|
270
|
+
divider: b = !1,
|
|
272
271
|
disableGutters: f = !1,
|
|
273
|
-
focusVisibleClassName:
|
|
274
|
-
role:
|
|
275
|
-
tabIndex:
|
|
272
|
+
focusVisibleClassName: N,
|
|
273
|
+
role: v = "menuitem",
|
|
274
|
+
tabIndex: u,
|
|
276
275
|
className: c
|
|
277
|
-
} = a,
|
|
278
|
-
dense: l ||
|
|
276
|
+
} = a, p = Y(a, Oe), M = h.useContext(_), C = h.useMemo(() => ({
|
|
277
|
+
dense: l || M.dense || !1,
|
|
279
278
|
disableGutters: f
|
|
280
|
-
}), [
|
|
281
|
-
|
|
279
|
+
}), [M.dense, l, f]), m = h.useRef(null);
|
|
280
|
+
be(() => {
|
|
282
281
|
i && (m.current ? m.current.focus() : process.env.NODE_ENV !== "production" && console.error("MUI: Unable to set focus to a MenuItem whose component has not been rendered."));
|
|
283
282
|
}, [i]);
|
|
284
|
-
const
|
|
285
|
-
dense:
|
|
286
|
-
divider:
|
|
283
|
+
const L = I({}, a, {
|
|
284
|
+
dense: C.dense,
|
|
285
|
+
divider: b,
|
|
287
286
|
disableGutters: f
|
|
288
|
-
}),
|
|
289
|
-
let
|
|
290
|
-
return a.disabled || (
|
|
291
|
-
value:
|
|
292
|
-
children: /* @__PURE__ */ r(
|
|
293
|
-
ref:
|
|
294
|
-
role:
|
|
295
|
-
tabIndex:
|
|
287
|
+
}), j = ze(a), A = ve(m, s);
|
|
288
|
+
let T;
|
|
289
|
+
return a.disabled || (T = u !== void 0 ? u : -1), /* @__PURE__ */ r(_.Provider, {
|
|
290
|
+
value: C,
|
|
291
|
+
children: /* @__PURE__ */ r(Ee, I({
|
|
292
|
+
ref: A,
|
|
293
|
+
role: v,
|
|
294
|
+
tabIndex: T,
|
|
296
295
|
component: d,
|
|
297
|
-
focusVisibleClassName:
|
|
298
|
-
className:
|
|
299
|
-
},
|
|
300
|
-
ownerState:
|
|
301
|
-
classes:
|
|
296
|
+
focusVisibleClassName: w(j.focusVisible, N),
|
|
297
|
+
className: w(j.root, c)
|
|
298
|
+
}, p, {
|
|
299
|
+
ownerState: L,
|
|
300
|
+
classes: j
|
|
302
301
|
}))
|
|
303
302
|
});
|
|
304
303
|
});
|
|
305
|
-
process.env.NODE_ENV !== "production" && (
|
|
304
|
+
process.env.NODE_ENV !== "production" && (X.propTypes = {
|
|
306
305
|
// ----------------------------- Warning --------------------------------
|
|
307
306
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
308
307
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -377,16 +376,16 @@ process.env.NODE_ENV !== "production" && (Z.propTypes = {
|
|
|
377
376
|
*/
|
|
378
377
|
tabIndex: t.number
|
|
379
378
|
});
|
|
380
|
-
const Le =
|
|
381
|
-
var
|
|
382
|
-
Object.defineProperty(
|
|
379
|
+
const Le = X;
|
|
380
|
+
var U = {}, Ae = ae;
|
|
381
|
+
Object.defineProperty(U, "__esModule", {
|
|
383
382
|
value: !0
|
|
384
383
|
});
|
|
385
|
-
var ee =
|
|
384
|
+
var ee = U.default = void 0, Pe = Ae(ne()), Se = oe, we = (0, Pe.default)(/* @__PURE__ */ (0, Se.jsx)("path", {
|
|
386
385
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
387
386
|
}), "Error");
|
|
388
|
-
ee =
|
|
389
|
-
const
|
|
387
|
+
ee = U.default = we;
|
|
388
|
+
const Ue = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxNiAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjg3NzggMy4yNTUzOUMxNC4yODc1IDIuODM3MzkgMTQuOTYwNiAyLjgzNzM5IDE1LjM3MDMgMy4yNTUzOUMxNS43NzggMy42NjczOSAxNS43ODM3IDQuMzMzMDkgMTUuMzg0NSA0Ljc1MjE5TDYuOTU1NjMgMTQuNzE2M0M2LjU1MTYzIDE1LjE2IDUuODU3OTIgMTUuMTczIDUuNDM3NTIgMTQuNzQ0OEwwLjMwODYyNSA5LjU0NzQ5Qy0wLjEwMjg3NSA5LjEyNzg5IC0wLjEwMjg3NSA4LjQ1NjA5IDAuMzA4NjI1IDguMDM2NDlDMC43MTgzMjUgNy42MTg0OSAxLjM5MTQyIDcuNjE4NDkgMS44MDExMiA4LjAzNjQ5TDYuMTUxNzIgMTIuNDQ1NUwxMy44NDkzIDMuMjg2NzlMMTMuODc3OCAzLjI1NTM5WiIgZmlsbD0iIzE2MjMyNCIvPgo8L3N2Zz4K", He = ({
|
|
390
389
|
name: e,
|
|
391
390
|
label: o,
|
|
392
391
|
type: s,
|
|
@@ -394,116 +393,116 @@ const Xe = ({
|
|
|
394
393
|
handleChange: i,
|
|
395
394
|
placeholder: d,
|
|
396
395
|
required: l,
|
|
397
|
-
disabled:
|
|
396
|
+
disabled: b,
|
|
398
397
|
beforeField: f,
|
|
399
|
-
afterField:
|
|
400
|
-
options:
|
|
401
|
-
optionsResponseHandler:
|
|
398
|
+
afterField: N,
|
|
399
|
+
options: v,
|
|
400
|
+
optionsResponseHandler: u,
|
|
402
401
|
api_endpoint: c,
|
|
403
|
-
error:
|
|
404
|
-
helperText:
|
|
405
|
-
autofocus:
|
|
402
|
+
error: p,
|
|
403
|
+
helperText: M,
|
|
404
|
+
autofocus: C
|
|
406
405
|
}) => {
|
|
407
|
-
const [m,
|
|
408
|
-
function
|
|
406
|
+
const [m, L] = re([]);
|
|
407
|
+
function j(n) {
|
|
409
408
|
i(e, n.target.value);
|
|
410
409
|
}
|
|
411
|
-
const
|
|
410
|
+
const A = ie(async () => {
|
|
412
411
|
var n;
|
|
413
|
-
return s !== "select" ? [] :
|
|
414
|
-
name:
|
|
415
|
-
value:
|
|
412
|
+
return s !== "select" ? [] : v || (c && u ? (n = (await (await fetch(c)).json())[u.key]) == null ? void 0 : n.map((O) => ({
|
|
413
|
+
name: O[u.name],
|
|
414
|
+
value: O[u.value]
|
|
416
415
|
})) : []);
|
|
417
|
-
}, [s,
|
|
416
|
+
}, [s, u, c]);
|
|
418
417
|
le(() => {
|
|
419
|
-
|
|
418
|
+
A().then((n) => L(n));
|
|
420
419
|
}, []);
|
|
421
|
-
let
|
|
422
|
-
...
|
|
423
|
-
backgroundColor:
|
|
420
|
+
let T = {
|
|
421
|
+
...y.textfield,
|
|
422
|
+
backgroundColor: p ? P.redLight : "transparent",
|
|
424
423
|
"& input::placeholder": {
|
|
425
|
-
color:
|
|
424
|
+
color: p ? P.redMedium : "grey"
|
|
426
425
|
}
|
|
427
426
|
};
|
|
428
427
|
const te = {
|
|
429
428
|
"& .MuiSelect-select > span::before": {
|
|
430
429
|
content: `'${d || ""}'`,
|
|
431
|
-
color:
|
|
430
|
+
color: p ? "rgba(254, 64, 76, 0.4)" : "rgba(153, 153, 153, 0.6)"
|
|
432
431
|
}
|
|
433
432
|
};
|
|
434
|
-
return s === "select" && (
|
|
435
|
-
...
|
|
433
|
+
return s === "select" && (T = {
|
|
434
|
+
...T,
|
|
436
435
|
...te
|
|
437
|
-
}), s !== "custom" ? /* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */ r("label", { htmlFor: `form-input-${e}`, children: /* @__PURE__ */ r(
|
|
439
|
-
/* @__PURE__ */ r(
|
|
440
|
-
|
|
436
|
+
}), s !== "custom" ? /* @__PURE__ */ z(R, { sx: y.formInputWrapper, children: [
|
|
437
|
+
/* @__PURE__ */ r("label", { htmlFor: `form-input-${e}`, children: /* @__PURE__ */ r(k, { sx: y.label, children: `${o} ${l ? "*" : ""}` }) }),
|
|
438
|
+
/* @__PURE__ */ r(R, { sx: y.textfieldWrapper, children: /* @__PURE__ */ r(
|
|
439
|
+
de,
|
|
441
440
|
{
|
|
442
|
-
title:
|
|
443
|
-
/* @__PURE__ */ r(ee, { sx:
|
|
444
|
-
|
|
441
|
+
title: M && /* @__PURE__ */ z(k, { type: "subtitleSmall", textColor: "white", children: [
|
|
442
|
+
/* @__PURE__ */ r(ee, { sx: y.errorIcon }),
|
|
443
|
+
M
|
|
445
444
|
] }),
|
|
446
445
|
placement: "bottom",
|
|
447
446
|
arrow: !0,
|
|
448
447
|
componentsProps: {
|
|
449
448
|
tooltip: {
|
|
450
|
-
sx:
|
|
449
|
+
sx: y.tooltip
|
|
451
450
|
},
|
|
452
451
|
popper: {
|
|
453
|
-
sx:
|
|
452
|
+
sx: y.tooltipPopper
|
|
454
453
|
}
|
|
455
454
|
},
|
|
456
455
|
children: /* @__PURE__ */ r(
|
|
457
|
-
|
|
456
|
+
me,
|
|
458
457
|
{
|
|
459
458
|
id: `form-input-${e}`,
|
|
460
|
-
autoFocus:
|
|
459
|
+
autoFocus: C,
|
|
461
460
|
name: e,
|
|
462
461
|
type: s,
|
|
463
462
|
select: s === "select",
|
|
464
463
|
value: a,
|
|
465
|
-
onChange:
|
|
464
|
+
onChange: j,
|
|
466
465
|
placeholder: d,
|
|
467
466
|
required: l,
|
|
468
|
-
disabled:
|
|
469
|
-
error:
|
|
467
|
+
disabled: b,
|
|
468
|
+
error: p,
|
|
470
469
|
InputProps: {
|
|
471
|
-
startAdornment: /* @__PURE__ */ r(
|
|
472
|
-
endAdornment: /* @__PURE__ */ r(
|
|
470
|
+
startAdornment: /* @__PURE__ */ r(Q, { position: "start", children: f }),
|
|
471
|
+
endAdornment: /* @__PURE__ */ r(Q, { position: "end", children: N })
|
|
473
472
|
},
|
|
474
473
|
SelectProps: {
|
|
475
474
|
renderValue: (n) => {
|
|
476
|
-
const
|
|
477
|
-
(
|
|
475
|
+
const g = m == null ? void 0 : m.find(
|
|
476
|
+
(x) => typeof x == "object" ? x.value === n : x === n
|
|
478
477
|
);
|
|
479
|
-
return typeof
|
|
478
|
+
return typeof g == "object" ? g.name : g;
|
|
480
479
|
},
|
|
481
480
|
MenuProps: {
|
|
482
481
|
PaperProps: {
|
|
483
|
-
sx:
|
|
482
|
+
sx: y.selectDropdown
|
|
484
483
|
}
|
|
485
484
|
}
|
|
486
485
|
},
|
|
487
|
-
sx:
|
|
486
|
+
sx: T,
|
|
488
487
|
children: s === "select" && (m == null ? void 0 : m.map((n) => {
|
|
489
|
-
const
|
|
488
|
+
const g = typeof n == "object", x = g ? n.value === a : n === a, O = {
|
|
490
489
|
display: "flex",
|
|
491
490
|
justifyContent: "space-between",
|
|
492
491
|
alignItems: "center",
|
|
493
|
-
color:
|
|
492
|
+
color: x ? "black" : P.darkGrey,
|
|
494
493
|
gap: "1rem"
|
|
495
494
|
};
|
|
496
|
-
return /* @__PURE__ */
|
|
495
|
+
return /* @__PURE__ */ z(
|
|
497
496
|
Le,
|
|
498
497
|
{
|
|
499
|
-
value:
|
|
500
|
-
sx:
|
|
498
|
+
value: g ? n.value : n,
|
|
499
|
+
sx: O,
|
|
501
500
|
children: [
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
g ? n.name : n,
|
|
502
|
+
x && /* @__PURE__ */ r("img", { src: Ue, alt: "selected-option" })
|
|
504
503
|
]
|
|
505
504
|
},
|
|
506
|
-
|
|
505
|
+
g ? n.name : n
|
|
507
506
|
);
|
|
508
507
|
}))
|
|
509
508
|
}
|
|
@@ -513,5 +512,5 @@ const Xe = ({
|
|
|
513
512
|
] }) : /* @__PURE__ */ r(se, {});
|
|
514
513
|
};
|
|
515
514
|
export {
|
|
516
|
-
|
|
515
|
+
He as default
|
|
517
516
|
};
|
|
@@ -1,192 +1,197 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { T as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { s as
|
|
9
|
-
import { B as
|
|
10
|
-
const
|
|
1
|
+
import { jsx as u, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useCallback as H, useEffect as L } from "react";
|
|
3
|
+
import j from "../../cell/Button/index.js";
|
|
4
|
+
import { T as R } from "../../../index-03287c17.js";
|
|
5
|
+
import d from "./Form.styles.js";
|
|
6
|
+
import { getLocalDateTime as z, createNestedObject as G, deepMergeObjects as J } from "./Form.utils.js";
|
|
7
|
+
import Q from "./FormInput.js";
|
|
8
|
+
import { s as U } from "../../../styled-126c6a62.js";
|
|
9
|
+
import { B as x } from "../../../Tooltip-b926c320.js";
|
|
10
|
+
const X = U("div")({
|
|
11
11
|
marginTop: "0.75rem"
|
|
12
|
-
}),
|
|
13
|
-
config:
|
|
12
|
+
}), me = ({
|
|
13
|
+
config: i,
|
|
14
14
|
submitText: V = "Submit",
|
|
15
15
|
handleSubmit: _,
|
|
16
|
-
handleInvalidData:
|
|
17
|
-
cancelText:
|
|
18
|
-
handleCancel:
|
|
19
|
-
onChange:
|
|
20
|
-
formStyles:
|
|
16
|
+
handleInvalidData: h,
|
|
17
|
+
cancelText: E = "Cancel",
|
|
18
|
+
handleCancel: O,
|
|
19
|
+
onChange: f,
|
|
20
|
+
formStyles: C = {},
|
|
21
21
|
formWrapperStyles: T = {},
|
|
22
22
|
formFieldsWrapperStyles: A = {},
|
|
23
|
-
buttonWrapperStyles:
|
|
24
|
-
customFields:
|
|
23
|
+
buttonWrapperStyles: B = {},
|
|
24
|
+
customFields: y = {}
|
|
25
25
|
}) => {
|
|
26
|
-
const [
|
|
27
|
-
function
|
|
28
|
-
|
|
26
|
+
const [l, b] = S({}), [M, g] = S([]);
|
|
27
|
+
function N(t, e) {
|
|
28
|
+
b((n) => ({
|
|
29
29
|
...n,
|
|
30
|
-
[
|
|
31
|
-
})),
|
|
30
|
+
[t]: e
|
|
31
|
+
})), f == null || f(t, e), g([]);
|
|
32
32
|
}
|
|
33
33
|
function F() {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
const n =
|
|
38
|
-
e
|
|
34
|
+
const t = {};
|
|
35
|
+
i == null || i.forEach((e) => {
|
|
36
|
+
if (e.preFillWithDateTime && e.type === "text") {
|
|
37
|
+
const n = z();
|
|
38
|
+
t[e.name] = n;
|
|
39
39
|
} else
|
|
40
|
-
e
|
|
41
|
-
}),
|
|
40
|
+
t[e.name] = e.defaultValue || "";
|
|
41
|
+
}), b(t), g([]);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
const { name: n, label: r, type:
|
|
43
|
+
function k() {
|
|
44
|
+
const t = [];
|
|
45
|
+
return i == null || i.forEach((e) => {
|
|
46
|
+
const { name: n, label: r, type: p, validation: s, required: a } = e, o = l[n], m = n;
|
|
47
47
|
if (s)
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
s.min &&
|
|
51
|
-
field:
|
|
52
|
-
value:
|
|
48
|
+
if (p === "number") {
|
|
49
|
+
const c = parseInt(o);
|
|
50
|
+
s.min && c < s.min && t.push({
|
|
51
|
+
field: m,
|
|
52
|
+
value: o,
|
|
53
53
|
message: s.invalid_message
|
|
54
|
-
}), s.max &&
|
|
55
|
-
field:
|
|
56
|
-
value:
|
|
54
|
+
}), s.max && c > s.max && t.push({
|
|
55
|
+
field: m,
|
|
56
|
+
value: o,
|
|
57
57
|
message: s.invalid_message
|
|
58
|
-
}), isNaN(
|
|
59
|
-
field:
|
|
60
|
-
value:
|
|
58
|
+
}), isNaN(c) && t.push({
|
|
59
|
+
field: m,
|
|
60
|
+
value: o,
|
|
61
61
|
message: "Invalid number"
|
|
62
62
|
});
|
|
63
63
|
} else
|
|
64
|
-
|
|
65
|
-
field:
|
|
66
|
-
value:
|
|
64
|
+
p === "text" && (s.min_length && o.length < s.min_length && t.push({
|
|
65
|
+
field: m,
|
|
66
|
+
value: o,
|
|
67
67
|
message: s.invalid_message
|
|
68
|
-
}), s.max_length &&
|
|
69
|
-
field:
|
|
70
|
-
value:
|
|
68
|
+
}), s.max_length && o.length > s.max_length && t.push({
|
|
69
|
+
field: m,
|
|
70
|
+
value: o,
|
|
71
71
|
message: s.invalid_message
|
|
72
|
-
}), s.pattern && !new RegExp(s.pattern).test(
|
|
73
|
-
field:
|
|
74
|
-
value:
|
|
72
|
+
}), s.pattern && !new RegExp(s.pattern).test(o) && t.push({
|
|
73
|
+
field: m,
|
|
74
|
+
value: o,
|
|
75
75
|
message: s.invalid_message
|
|
76
76
|
}));
|
|
77
|
-
|
|
78
|
-
field:
|
|
79
|
-
value:
|
|
77
|
+
a && !o && t.push({
|
|
78
|
+
field: m,
|
|
79
|
+
value: o,
|
|
80
80
|
message: `${r} is required`
|
|
81
81
|
});
|
|
82
|
-
}), g(
|
|
82
|
+
}), g(t), t.length && (h == null || h(t)), !t.length;
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
(
|
|
86
|
-
let
|
|
87
|
-
return
|
|
88
|
-
const { name: r, type:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const D = H(
|
|
85
|
+
(t) => {
|
|
86
|
+
let e = {};
|
|
87
|
+
return t == null || t.forEach((n) => {
|
|
88
|
+
const { name: r, type: p, submitDataKey: s } = n, a = p === "number" ? parseInt(l[r]) : l[r];
|
|
89
|
+
function o(m) {
|
|
90
|
+
if (m.indexOf(".") !== -1) {
|
|
91
|
+
const c = G(
|
|
92
|
+
m,
|
|
93
|
+
p,
|
|
94
|
+
l[r]
|
|
95
|
+
);
|
|
96
|
+
e = J(e, c);
|
|
97
|
+
} else
|
|
98
|
+
e[m] = a;
|
|
99
|
+
}
|
|
100
|
+
typeof s != "string" && (s != null && s.length) ? s.forEach((m) => {
|
|
101
|
+
o(m);
|
|
102
|
+
}) : typeof s == "string" && s ? o(s) : e[r] = a;
|
|
103
|
+
}), e;
|
|
99
104
|
},
|
|
100
|
-
[
|
|
105
|
+
[l]
|
|
101
106
|
);
|
|
102
|
-
function I(
|
|
103
|
-
if (
|
|
104
|
-
const n =
|
|
107
|
+
function I(t) {
|
|
108
|
+
if (t.preventDefault(), k()) {
|
|
109
|
+
const n = D(i);
|
|
105
110
|
_(n);
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
function W() {
|
|
109
|
-
F(),
|
|
114
|
+
F(), O();
|
|
110
115
|
}
|
|
111
|
-
function q(
|
|
112
|
-
const
|
|
113
|
-
(r) => r.field ===
|
|
116
|
+
function q(t) {
|
|
117
|
+
const e = M.find(
|
|
118
|
+
(r) => r.field === t.name
|
|
114
119
|
), n = {
|
|
115
|
-
...
|
|
116
|
-
value:
|
|
117
|
-
handleChange:
|
|
118
|
-
error: !!
|
|
119
|
-
helperText:
|
|
120
|
+
...t,
|
|
121
|
+
value: l[t.name],
|
|
122
|
+
handleChange: N,
|
|
123
|
+
error: !!e,
|
|
124
|
+
helperText: e == null ? void 0 : e.message
|
|
120
125
|
};
|
|
121
|
-
if (
|
|
126
|
+
if (t.hidden)
|
|
122
127
|
return null;
|
|
123
|
-
if (
|
|
124
|
-
const { component: r, props:
|
|
128
|
+
if (t.type === "custom" && t.customComponent && y[t.customComponent]) {
|
|
129
|
+
const { component: r, props: p } = y[t.customComponent], s = r, a = {
|
|
125
130
|
...n,
|
|
126
|
-
...
|
|
131
|
+
...p
|
|
127
132
|
};
|
|
128
|
-
if (s &&
|
|
129
|
-
return /* @__PURE__ */ u(s, { ...
|
|
133
|
+
if (s && a)
|
|
134
|
+
return /* @__PURE__ */ u(s, { ...a }, t.name);
|
|
130
135
|
} else
|
|
131
|
-
return /* @__PURE__ */ u(
|
|
136
|
+
return /* @__PURE__ */ u(Q, { ...n }, t.name);
|
|
132
137
|
}
|
|
133
138
|
function P() {
|
|
134
|
-
return
|
|
135
|
-
(
|
|
139
|
+
return i.reduce(
|
|
140
|
+
(e, n) => {
|
|
136
141
|
const { groupName: r } = n;
|
|
137
|
-
if (!
|
|
138
|
-
|
|
142
|
+
if (!e.length)
|
|
143
|
+
e.push(r ? [r, n] : [n]);
|
|
139
144
|
else if (r) {
|
|
140
|
-
const s =
|
|
141
|
-
s === -1 ?
|
|
145
|
+
const s = e.findIndex((a) => a[0] === r);
|
|
146
|
+
s === -1 ? e.push([r, n]) : e[s].push(n);
|
|
142
147
|
} else {
|
|
143
|
-
const s =
|
|
144
|
-
typeof s[0] == "string" ?
|
|
148
|
+
const s = e[e.length - 1];
|
|
149
|
+
typeof s[0] == "string" ? e.push([n]) : s.push(n);
|
|
145
150
|
}
|
|
146
|
-
return
|
|
151
|
+
return e;
|
|
147
152
|
},
|
|
148
153
|
[]
|
|
149
154
|
).map(
|
|
150
|
-
(
|
|
151
|
-
const n = typeof
|
|
155
|
+
(e) => {
|
|
156
|
+
const n = typeof e[0] == "string";
|
|
152
157
|
return /* @__PURE__ */ u(
|
|
153
|
-
|
|
158
|
+
X,
|
|
154
159
|
{
|
|
155
|
-
children:
|
|
156
|
-
|
|
160
|
+
children: e.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
|
|
161
|
+
R,
|
|
157
162
|
{
|
|
158
163
|
type: "headingSmall",
|
|
159
|
-
sx:
|
|
164
|
+
sx: d.heading,
|
|
160
165
|
children: r
|
|
161
166
|
},
|
|
162
167
|
r
|
|
163
168
|
) : q(r))
|
|
164
169
|
},
|
|
165
|
-
`group-${n ?
|
|
170
|
+
`group-${n ? e[0] : e[0].name}`
|
|
166
171
|
);
|
|
167
172
|
}
|
|
168
173
|
);
|
|
169
174
|
}
|
|
170
|
-
|
|
175
|
+
L(() => {
|
|
171
176
|
F();
|
|
172
177
|
}, []);
|
|
173
178
|
const $ = {
|
|
174
|
-
...
|
|
175
|
-
...
|
|
179
|
+
...d.alignVertical,
|
|
180
|
+
...C
|
|
176
181
|
}, w = {
|
|
177
|
-
...
|
|
182
|
+
...d.alignVertical,
|
|
178
183
|
marginTop: "1rem",
|
|
179
184
|
gap: "0.5rem",
|
|
180
|
-
...
|
|
185
|
+
...B
|
|
181
186
|
};
|
|
182
|
-
return /* @__PURE__ */ u(
|
|
183
|
-
/* @__PURE__ */ u(
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */ u(
|
|
186
|
-
/* @__PURE__ */ u(
|
|
187
|
+
return /* @__PURE__ */ u(x, { sx: T, children: /* @__PURE__ */ v("form", { style: $, children: [
|
|
188
|
+
/* @__PURE__ */ u(x, { sx: A, children: Object.keys(l).length && P() }),
|
|
189
|
+
/* @__PURE__ */ v(x, { sx: w, children: [
|
|
190
|
+
/* @__PURE__ */ u(j, { type: "submit", onClick: I, children: V }),
|
|
191
|
+
/* @__PURE__ */ u(j, { onClick: W, children: E })
|
|
187
192
|
] })
|
|
188
193
|
] }) });
|
|
189
194
|
};
|
|
190
195
|
export {
|
|
191
|
-
|
|
196
|
+
me as default
|
|
192
197
|
};
|
package/package.json
CHANGED