@loopr-ai/craft 0.7.2 → 0.7.4
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/{ButtonBase-fc1e48eb.js → ButtonBase-85c9347b.js} +3 -3
- package/dist/{TextField-a534df29.js → TextField-fded06e5.js} +7 -7
- package/dist/Tooltip-b926c320.js +2022 -0
- package/dist/{TransitionGroupContext-ba502e63.js → TransitionGroupContext-fe9a562f.js} +3 -3
- package/dist/ZoomControllers-36e39bb0.js +1432 -0
- package/dist/components/cell/AvatarGroup/index.js +3 -3
- package/dist/components/cell/Button/index.js +3 -3
- package/dist/components/cell/Chip/index.js +5 -5
- package/dist/components/cell/ProgressBar/index.js +3 -3
- package/dist/components/cell/Search/index.js +2 -2
- package/dist/components/cell/Typography/index.js +5 -19
- package/dist/components/organ/Form/Form.interfaces.d.ts +6 -6
- package/dist/components/organ/Form/Form.styles.d.ts +99 -2
- package/dist/components/organ/Form/Form.styles.js +99 -4
- package/dist/components/organ/Form/FormInput.js +517 -0
- package/dist/components/organ/Form/index.d.ts +2 -0
- package/dist/components/organ/Form/index.js +156 -106
- package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
- package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
- package/dist/{createSvgIcon-bb3d4825.js → createSvgIcon-58aa3adf.js} +5 -5
- package/dist/{Grow-a906cda2.js → createSvgIcon-f773ce57.js} +4020 -3944
- package/dist/{createTheme-ca1567c6.js → createTheme-a4db2989.js} +7 -7
- package/dist/{exactProp-3d9df1ae.js → exactProp-d79ccada.js} +1 -1
- package/dist/{extendSxProp-fc2654e5.js → extendSxProp-db8b9da5.js} +1 -1
- package/dist/global/colors.d.ts +5 -0
- package/dist/global/colors.js +11 -6
- package/dist/global/constants.d.ts +3 -0
- package/dist/global/constants.js +6 -1
- package/dist/global/theme.js +1 -1
- package/dist/{Typography-65e5f8a8.js → index-03287c17.js} +61 -45
- package/dist/main.js +10 -10
- package/dist/providers/CraftThemeProvider.js +2 -2
- package/dist/{styled-80b57810.js → styled-126c6a62.js} +49 -49
- package/dist/{useTheme-16446f25.js → useTheme-573c40a2.js} +1 -1
- package/package.json +1 -1
- package/dist/Box-8cd400c2.js +0 -58
- package/dist/ZoomControllers-8a147df0.js +0 -3390
- package/dist/components/organ/Form/FieldInput.js +0 -442
- package/dist/createSvgIcon-8e5d9dc7.js +0 -81
- package/dist/dividerClasses-0233db5a.js +0 -10
- /package/dist/components/organ/Form/{FieldInput.d.ts → FormInput.d.ts} +0 -0
|
@@ -1,142 +1,192 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { createNestedObject as
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as u, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useCallback as H, useEffect as K } from "react";
|
|
3
|
+
import S from "../../cell/Button/index.js";
|
|
4
|
+
import { T as L } from "../../../index-03287c17.js";
|
|
5
|
+
import f from "./Form.styles.js";
|
|
6
|
+
import { createNestedObject as R, deepMergeObjects as z, getLocalDateTime as G } from "./Form.utils.js";
|
|
7
|
+
import J from "./FormInput.js";
|
|
8
|
+
import { s as Q } from "../../../styled-126c6a62.js";
|
|
9
|
+
import { B as b } from "../../../Tooltip-b926c320.js";
|
|
10
|
+
const U = Q("div")({
|
|
11
|
+
marginTop: "0.75rem"
|
|
12
|
+
}), oe = ({
|
|
13
|
+
config: o,
|
|
14
|
+
submitText: V = "Submit",
|
|
15
|
+
handleSubmit: _,
|
|
16
|
+
handleInvalidData: c,
|
|
17
|
+
cancelText: C = "Cancel",
|
|
18
|
+
handleCancel: E,
|
|
19
|
+
onChange: h,
|
|
20
|
+
formStyles: O = {},
|
|
21
|
+
formWrapperStyles: T = {},
|
|
22
|
+
formFieldsWrapperStyles: A = {},
|
|
17
23
|
buttonWrapperStyles: D = {},
|
|
18
|
-
customFields:
|
|
24
|
+
customFields: x = {}
|
|
19
25
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
function
|
|
22
|
-
|
|
26
|
+
const [p, y] = v({}), [B, g] = v([]);
|
|
27
|
+
function M(e, t) {
|
|
28
|
+
y((n) => ({
|
|
23
29
|
...n,
|
|
24
|
-
[e]:
|
|
25
|
-
})),
|
|
30
|
+
[e]: t
|
|
31
|
+
})), h == null || h(e, t), g([]);
|
|
26
32
|
}
|
|
27
|
-
function
|
|
33
|
+
function F() {
|
|
28
34
|
const e = {};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
o == null || o.forEach((t) => {
|
|
36
|
+
if (t.preFillWithDateTime && t.type === "text") {
|
|
37
|
+
const n = G();
|
|
38
|
+
e[t.name] = n;
|
|
39
|
+
} else
|
|
40
|
+
e[t.name] = t.defaultValue || "";
|
|
41
|
+
}), y(e), g([]);
|
|
32
42
|
}
|
|
33
|
-
function
|
|
43
|
+
function N() {
|
|
34
44
|
const e = [];
|
|
35
|
-
return
|
|
36
|
-
const { name: n, label:
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
field:
|
|
45
|
+
return o == null || o.forEach((t) => {
|
|
46
|
+
const { name: n, label: r, type: a, validation: s, required: i } = t, m = p[n], l = n;
|
|
47
|
+
if (s)
|
|
48
|
+
if (a === "number") {
|
|
49
|
+
const d = parseInt(m);
|
|
50
|
+
s.min && d < s.min && e.push({
|
|
51
|
+
field: l,
|
|
42
52
|
value: m,
|
|
43
|
-
message:
|
|
44
|
-
}),
|
|
45
|
-
field:
|
|
53
|
+
message: s.invalid_message
|
|
54
|
+
}), s.max && d > s.max && e.push({
|
|
55
|
+
field: l,
|
|
46
56
|
value: m,
|
|
47
|
-
message:
|
|
48
|
-
}), isNaN(
|
|
49
|
-
field:
|
|
57
|
+
message: s.invalid_message
|
|
58
|
+
}), isNaN(d) && e.push({
|
|
59
|
+
field: l,
|
|
50
60
|
value: m,
|
|
51
61
|
message: "Invalid number"
|
|
52
62
|
});
|
|
53
63
|
} else
|
|
54
|
-
|
|
55
|
-
field:
|
|
64
|
+
a === "text" && (s.min_length && m.length < s.min_length && e.push({
|
|
65
|
+
field: l,
|
|
56
66
|
value: m,
|
|
57
|
-
message:
|
|
58
|
-
}),
|
|
59
|
-
field:
|
|
67
|
+
message: s.invalid_message
|
|
68
|
+
}), s.max_length && m.length > s.max_length && e.push({
|
|
69
|
+
field: l,
|
|
60
70
|
value: m,
|
|
61
|
-
message:
|
|
62
|
-
}),
|
|
63
|
-
field:
|
|
71
|
+
message: s.invalid_message
|
|
72
|
+
}), s.pattern && !new RegExp(s.pattern).test(m) && e.push({
|
|
73
|
+
field: l,
|
|
64
74
|
value: m,
|
|
65
|
-
message:
|
|
75
|
+
message: s.invalid_message
|
|
66
76
|
}));
|
|
67
|
-
|
|
68
|
-
field:
|
|
77
|
+
i && !m && e.push({
|
|
78
|
+
field: l,
|
|
69
79
|
value: m,
|
|
70
|
-
message: `${
|
|
80
|
+
message: `${r} is required`
|
|
71
81
|
});
|
|
72
|
-
}),
|
|
82
|
+
}), g(e), e.length && (c == null || c(e)), !e.length;
|
|
73
83
|
}
|
|
74
|
-
const k =
|
|
84
|
+
const k = H(
|
|
75
85
|
(e) => {
|
|
76
|
-
let
|
|
86
|
+
let t = {};
|
|
77
87
|
return e == null || e.forEach((n) => {
|
|
78
|
-
const { name:
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
const { name: r, type: a, submitDataKey: s } = n;
|
|
89
|
+
if (s) {
|
|
90
|
+
const i = R(
|
|
91
|
+
s,
|
|
92
|
+
a,
|
|
93
|
+
p[r]
|
|
84
94
|
);
|
|
85
|
-
|
|
95
|
+
t = z(t, i);
|
|
86
96
|
} else
|
|
87
|
-
|
|
88
|
-
}),
|
|
97
|
+
t[r] = a === "number" ? parseInt(p[r]) : p[r];
|
|
98
|
+
}), t;
|
|
89
99
|
},
|
|
90
|
-
[
|
|
100
|
+
[p]
|
|
91
101
|
);
|
|
92
|
-
function
|
|
93
|
-
if (e.preventDefault(),
|
|
94
|
-
const n = k(
|
|
95
|
-
|
|
102
|
+
function I(e) {
|
|
103
|
+
if (e.preventDefault(), N()) {
|
|
104
|
+
const n = k(o);
|
|
105
|
+
_(n);
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
108
|
+
function W() {
|
|
109
|
+
F(), E();
|
|
110
|
+
}
|
|
111
|
+
function q(e) {
|
|
112
|
+
const t = B.find(
|
|
113
|
+
(r) => r.field === e.name
|
|
114
|
+
), n = {
|
|
115
|
+
...e,
|
|
116
|
+
value: p[e.name],
|
|
117
|
+
handleChange: M,
|
|
118
|
+
error: !!t,
|
|
119
|
+
helperText: t == null ? void 0 : t.message
|
|
120
|
+
};
|
|
121
|
+
if (e.hidden)
|
|
122
|
+
return null;
|
|
123
|
+
if (e.type === "custom" && e.customComponent && x[e.customComponent]) {
|
|
124
|
+
const { component: r, props: a } = x[e.customComponent], s = r, i = {
|
|
125
|
+
...n,
|
|
126
|
+
...a
|
|
127
|
+
};
|
|
128
|
+
if (s && i)
|
|
129
|
+
return /* @__PURE__ */ u(s, { ...i }, e.name);
|
|
130
|
+
} else
|
|
131
|
+
return /* @__PURE__ */ u(J, { ...n }, e.name);
|
|
132
|
+
}
|
|
133
|
+
function P() {
|
|
134
|
+
return o.reduce(
|
|
135
|
+
(t, n) => {
|
|
136
|
+
const { groupName: r } = n;
|
|
137
|
+
if (!t.length)
|
|
138
|
+
t.push(r ? [r, n] : [n]);
|
|
139
|
+
else if (r) {
|
|
140
|
+
const s = t.findIndex((i) => i[0] === r);
|
|
141
|
+
s === -1 ? t.push([r, n]) : t[s].push(n);
|
|
142
|
+
} else {
|
|
143
|
+
const s = t[t.length - 1];
|
|
144
|
+
typeof s[0] == "string" ? t.push([n]) : s.push(n);
|
|
145
|
+
}
|
|
146
|
+
return t;
|
|
147
|
+
},
|
|
148
|
+
[]
|
|
149
|
+
).map(
|
|
150
|
+
(t) => {
|
|
151
|
+
const n = typeof t[0] == "string";
|
|
152
|
+
return /* @__PURE__ */ u(
|
|
153
|
+
U,
|
|
154
|
+
{
|
|
155
|
+
children: t.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
|
|
156
|
+
L,
|
|
157
|
+
{
|
|
158
|
+
type: "headingSmall",
|
|
159
|
+
sx: f.heading,
|
|
160
|
+
children: r
|
|
161
|
+
},
|
|
162
|
+
r
|
|
163
|
+
) : q(r))
|
|
164
|
+
},
|
|
165
|
+
`group-${n ? t[0] : t[0].name}`
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
);
|
|
100
169
|
}
|
|
101
|
-
|
|
102
|
-
|
|
170
|
+
K(() => {
|
|
171
|
+
F();
|
|
103
172
|
}, []);
|
|
104
|
-
const
|
|
105
|
-
...
|
|
106
|
-
...
|
|
107
|
-
},
|
|
108
|
-
...
|
|
173
|
+
const $ = {
|
|
174
|
+
...f.alignVertical,
|
|
175
|
+
...O
|
|
176
|
+
}, w = {
|
|
177
|
+
...f.alignVertical,
|
|
178
|
+
marginTop: "1rem",
|
|
179
|
+
gap: "0.5rem",
|
|
109
180
|
...D
|
|
110
181
|
};
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
)
|
|
116
|
-
if (e.preFillWithDateTime && e.type === "text") {
|
|
117
|
-
const a = R();
|
|
118
|
-
o[e.name] || x(e.name, a);
|
|
119
|
-
}
|
|
120
|
-
const n = {
|
|
121
|
-
...e,
|
|
122
|
-
value: o[e.name],
|
|
123
|
-
handleChange: x,
|
|
124
|
-
error: !!s,
|
|
125
|
-
helperText: s == null ? void 0 : s.message
|
|
126
|
-
};
|
|
127
|
-
if (e.type === "custom" && e.customComponent) {
|
|
128
|
-
const a = B[e.customComponent];
|
|
129
|
-
if (a)
|
|
130
|
-
return /* @__PURE__ */ l(a, { ...n }, e.name);
|
|
131
|
-
} else
|
|
132
|
-
return /* @__PURE__ */ l(K, { ...n }, e.name);
|
|
133
|
-
})),
|
|
134
|
-
/* @__PURE__ */ g($, { sx: W, children: [
|
|
135
|
-
/* @__PURE__ */ l(F, { type: "submit", onClick: N, children: _ }),
|
|
136
|
-
/* @__PURE__ */ l(F, { onClick: T, children: S })
|
|
182
|
+
return /* @__PURE__ */ u(b, { sx: T, children: /* @__PURE__ */ j("form", { style: $, children: [
|
|
183
|
+
/* @__PURE__ */ u(b, { sx: A, children: Object.keys(p).length && P() }),
|
|
184
|
+
/* @__PURE__ */ j(b, { sx: w, children: [
|
|
185
|
+
/* @__PURE__ */ u(S, { type: "submit", onClick: I, children: V }),
|
|
186
|
+
/* @__PURE__ */ u(S, { onClick: W, children: C })
|
|
137
187
|
] })
|
|
138
|
-
] });
|
|
188
|
+
] }) });
|
|
139
189
|
};
|
|
140
190
|
export {
|
|
141
|
-
|
|
191
|
+
oe as default
|
|
142
192
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import { Z as p } from "../../../ZoomControllers-
|
|
3
|
-
import "../../../
|
|
2
|
+
import { Z as p } from "../../../ZoomControllers-36e39bb0.js";
|
|
3
|
+
import "../../../Tooltip-b926c320.js";
|
|
4
4
|
export {
|
|
5
5
|
p as default
|
|
6
6
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useEffect as n, useMemo as w } from "react";
|
|
3
|
-
import { T as C, Z as S, a as W } from "../../../ZoomControllers-
|
|
4
|
-
import { B as m } from "../../../
|
|
3
|
+
import { T as C, Z as S, a as W } from "../../../ZoomControllers-36e39bb0.js";
|
|
4
|
+
import { B as m } from "../../../Tooltip-b926c320.js";
|
|
5
5
|
const D = {
|
|
6
6
|
position: "relative",
|
|
7
7
|
borderRadius: "1rem",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as b, c as h, _ as w, a as y, P as o } from "./createTheme-a4db2989.js";
|
|
2
2
|
import * as v from "react";
|
|
3
3
|
import { jsxs as C, jsx as z } from "react/jsx-runtime";
|
|
4
|
-
import { g as T,
|
|
4
|
+
import { g as T, s as N, a as R, c as O, b as B } from "./styled-126c6a62.js";
|
|
5
5
|
function j(e) {
|
|
6
|
-
return
|
|
6
|
+
return b("MuiSvgIcon", e);
|
|
7
7
|
}
|
|
8
8
|
T("MuiSvgIcon", ["root", "colorPrimary", "colorSecondary", "colorAction", "colorError", "colorDisabled", "fontSizeInherit", "fontSizeSmall", "fontSizeMedium", "fontSizeLarge"]);
|
|
9
9
|
const A = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"], E = (e) => {
|
|
@@ -78,10 +78,10 @@ const A = ["children", "className", "color", "component", "fontSize", "htmlColor
|
|
|
78
78
|
hasSvgAsChild: l
|
|
79
79
|
}), x = {};
|
|
80
80
|
m || (x.viewBox = a);
|
|
81
|
-
const
|
|
81
|
+
const I = E($);
|
|
82
82
|
return /* @__PURE__ */ C(V, y({
|
|
83
83
|
as: c,
|
|
84
|
-
className: O(
|
|
84
|
+
className: O(I.root, d),
|
|
85
85
|
focusable: "false",
|
|
86
86
|
color: u,
|
|
87
87
|
"aria-hidden": s ? void 0 : !0,
|