@loopr-ai/craft 0.7.1 → 0.7.3
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 +8 -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/Form.utils.d.ts +1 -0
- package/dist/components/organ/Form/Form.utils.js +20 -15
- package/dist/components/organ/Form/FormInput.js +517 -0
- package/dist/components/organ/Form/index.js +161 -108
- 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 -440
- 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,137 +1,190 @@
|
|
|
1
|
-
import { jsxs as
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsxs as F, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useCallback as P, useEffect as $ } from "react";
|
|
3
|
+
import v from "../../cell/Button/index.js";
|
|
4
|
+
import { T as w } from "../../../index-03287c17.js";
|
|
5
|
+
import d from "./Form.styles.js";
|
|
6
|
+
import { createNestedObject as H, deepMergeObjects as K, getLocalDateTime as L } from "./Form.utils.js";
|
|
7
|
+
import R from "./FormInput.js";
|
|
8
|
+
import { s as z } from "../../../styled-126c6a62.js";
|
|
9
|
+
import { B as G } from "../../../Tooltip-b926c320.js";
|
|
10
|
+
const J = z("div")({
|
|
11
|
+
marginTop: "0.75rem"
|
|
12
|
+
}), re = ({
|
|
13
|
+
config: o,
|
|
14
|
+
submitText: S = "Submit",
|
|
15
|
+
handleSubmit: V,
|
|
16
|
+
handleInvalidData: c,
|
|
17
|
+
cancelText: _ = "Cancel",
|
|
18
|
+
handleCancel: C,
|
|
19
|
+
onChange: h,
|
|
20
|
+
formStyles: E = {},
|
|
21
|
+
buttonWrapperStyles: O = {},
|
|
22
|
+
customFields: b = {}
|
|
19
23
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
...
|
|
24
|
-
[e]:
|
|
25
|
-
})),
|
|
24
|
+
const [u, y] = j({}), [T, g] = j([]);
|
|
25
|
+
function A(e, t) {
|
|
26
|
+
y((n) => ({
|
|
27
|
+
...n,
|
|
28
|
+
[e]: t
|
|
29
|
+
})), h == null || h(e, t), g([]);
|
|
26
30
|
}
|
|
27
31
|
function x() {
|
|
28
32
|
const e = {};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
o == null || o.forEach((t) => {
|
|
34
|
+
if (t.preFillWithDateTime && t.type === "text") {
|
|
35
|
+
const n = L();
|
|
36
|
+
e[t.name] = n;
|
|
37
|
+
} else
|
|
38
|
+
e[t.name] = t.defaultValue || "";
|
|
39
|
+
}), y(e), g([]);
|
|
32
40
|
}
|
|
33
|
-
function
|
|
41
|
+
function D() {
|
|
34
42
|
const e = [];
|
|
35
|
-
return
|
|
36
|
-
const { name:
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
field:
|
|
42
|
-
value:
|
|
43
|
-
message:
|
|
44
|
-
}),
|
|
45
|
-
field:
|
|
46
|
-
value:
|
|
47
|
-
message:
|
|
48
|
-
}), isNaN(
|
|
49
|
-
field:
|
|
50
|
-
value:
|
|
43
|
+
return o == null || o.forEach((t) => {
|
|
44
|
+
const { name: n, label: r, type: a, validation: s, required: i } = t, m = u[n], p = n;
|
|
45
|
+
if (s)
|
|
46
|
+
if (a === "number") {
|
|
47
|
+
const f = parseInt(m);
|
|
48
|
+
s.min && f < s.min && e.push({
|
|
49
|
+
field: p,
|
|
50
|
+
value: m,
|
|
51
|
+
message: s.invalid_message
|
|
52
|
+
}), s.max && f > s.max && e.push({
|
|
53
|
+
field: p,
|
|
54
|
+
value: m,
|
|
55
|
+
message: s.invalid_message
|
|
56
|
+
}), isNaN(f) && e.push({
|
|
57
|
+
field: p,
|
|
58
|
+
value: m,
|
|
51
59
|
message: "Invalid number"
|
|
52
60
|
});
|
|
53
61
|
} else
|
|
54
|
-
|
|
55
|
-
field:
|
|
56
|
-
value:
|
|
57
|
-
message:
|
|
58
|
-
}),
|
|
59
|
-
field:
|
|
60
|
-
value:
|
|
61
|
-
message:
|
|
62
|
-
}),
|
|
63
|
-
field:
|
|
64
|
-
value:
|
|
65
|
-
message:
|
|
62
|
+
a === "text" && (s.min_length && m.length < s.min_length && e.push({
|
|
63
|
+
field: p,
|
|
64
|
+
value: m,
|
|
65
|
+
message: s.invalid_message
|
|
66
|
+
}), s.max_length && m.length > s.max_length && e.push({
|
|
67
|
+
field: p,
|
|
68
|
+
value: m,
|
|
69
|
+
message: s.invalid_message
|
|
70
|
+
}), s.pattern && !new RegExp(s.pattern).test(m) && e.push({
|
|
71
|
+
field: p,
|
|
72
|
+
value: m,
|
|
73
|
+
message: s.invalid_message
|
|
66
74
|
}));
|
|
67
|
-
|
|
68
|
-
field:
|
|
69
|
-
value:
|
|
70
|
-
message: `${
|
|
75
|
+
i && !m && e.push({
|
|
76
|
+
field: p,
|
|
77
|
+
value: m,
|
|
78
|
+
message: `${r} is required`
|
|
71
79
|
});
|
|
72
|
-
}),
|
|
80
|
+
}), g(e), e.length && (c == null || c(e)), !e.length;
|
|
73
81
|
}
|
|
74
|
-
const
|
|
82
|
+
const B = P(
|
|
75
83
|
(e) => {
|
|
76
|
-
let
|
|
77
|
-
return e == null || e.forEach((
|
|
78
|
-
const { name:
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
let t = {};
|
|
85
|
+
return e == null || e.forEach((n) => {
|
|
86
|
+
const { name: r, type: a, submitDataKey: s } = n;
|
|
87
|
+
if (s) {
|
|
88
|
+
const i = H(
|
|
89
|
+
s,
|
|
90
|
+
a,
|
|
91
|
+
u[r]
|
|
84
92
|
);
|
|
85
|
-
|
|
93
|
+
t = K(t, i);
|
|
86
94
|
} else
|
|
87
|
-
|
|
88
|
-
}),
|
|
95
|
+
t[r] = a === "number" ? parseInt(u[r]) : u[r];
|
|
96
|
+
}), t;
|
|
89
97
|
},
|
|
90
|
-
[
|
|
98
|
+
[u]
|
|
91
99
|
);
|
|
92
|
-
function
|
|
93
|
-
if (e.preventDefault(),
|
|
94
|
-
const
|
|
95
|
-
|
|
100
|
+
function M(e) {
|
|
101
|
+
if (e.preventDefault(), D()) {
|
|
102
|
+
const n = B(o);
|
|
103
|
+
V(n);
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
|
-
function
|
|
99
|
-
x(),
|
|
106
|
+
function N() {
|
|
107
|
+
x(), C();
|
|
108
|
+
}
|
|
109
|
+
function k(e) {
|
|
110
|
+
const t = T.find(
|
|
111
|
+
(r) => r.field === e.name
|
|
112
|
+
), n = {
|
|
113
|
+
...e,
|
|
114
|
+
value: u[e.name],
|
|
115
|
+
handleChange: A,
|
|
116
|
+
error: !!t,
|
|
117
|
+
helperText: t == null ? void 0 : t.message
|
|
118
|
+
};
|
|
119
|
+
if (e.hidden)
|
|
120
|
+
return null;
|
|
121
|
+
if (e.type === "custom" && e.customComponent && b[e.customComponent]) {
|
|
122
|
+
const { component: r, props: a } = b[e.customComponent], s = r, i = {
|
|
123
|
+
...n,
|
|
124
|
+
...a
|
|
125
|
+
};
|
|
126
|
+
if (s && i)
|
|
127
|
+
return /* @__PURE__ */ l(s, { ...i }, e.name);
|
|
128
|
+
} else
|
|
129
|
+
return /* @__PURE__ */ l(R, { ...n }, e.name);
|
|
130
|
+
}
|
|
131
|
+
function I() {
|
|
132
|
+
return o.reduce(
|
|
133
|
+
(t, n) => {
|
|
134
|
+
const { groupName: r } = n;
|
|
135
|
+
if (!t.length)
|
|
136
|
+
t.push(r ? [r, n] : [n]);
|
|
137
|
+
else if (r) {
|
|
138
|
+
const s = t.findIndex((i) => i[0] === r);
|
|
139
|
+
s === -1 ? t.push([r, n]) : t[s].push(n);
|
|
140
|
+
} else {
|
|
141
|
+
const s = t[t.length - 1];
|
|
142
|
+
typeof s[0] == "string" ? t.push([n]) : s.push(n);
|
|
143
|
+
}
|
|
144
|
+
return t;
|
|
145
|
+
},
|
|
146
|
+
[]
|
|
147
|
+
).map(
|
|
148
|
+
(t) => {
|
|
149
|
+
const n = typeof t[0] == "string";
|
|
150
|
+
return /* @__PURE__ */ l(
|
|
151
|
+
J,
|
|
152
|
+
{
|
|
153
|
+
children: t.map((r) => typeof r == "string" ? /* @__PURE__ */ l(
|
|
154
|
+
w,
|
|
155
|
+
{
|
|
156
|
+
type: "headingSmall",
|
|
157
|
+
sx: d.heading,
|
|
158
|
+
children: r
|
|
159
|
+
},
|
|
160
|
+
r
|
|
161
|
+
) : k(r))
|
|
162
|
+
},
|
|
163
|
+
`group-${n ? t[0] : t[0].name}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
);
|
|
100
167
|
}
|
|
101
|
-
|
|
168
|
+
$(() => {
|
|
102
169
|
x();
|
|
103
170
|
}, []);
|
|
104
|
-
const
|
|
105
|
-
...
|
|
171
|
+
const W = {
|
|
172
|
+
...d.alignVertical,
|
|
173
|
+
...E
|
|
174
|
+
}, q = {
|
|
175
|
+
...d.alignVertical,
|
|
176
|
+
marginTop: "1rem",
|
|
177
|
+
gap: "0.5rem",
|
|
106
178
|
...O
|
|
107
|
-
}, A = {
|
|
108
|
-
..._.alignVertical,
|
|
109
|
-
...C
|
|
110
179
|
};
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
Object.keys(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
...e,
|
|
117
|
-
value: o[e.name],
|
|
118
|
-
handleChange: M,
|
|
119
|
-
error: !!s,
|
|
120
|
-
helperText: s == null ? void 0 : s.message
|
|
121
|
-
};
|
|
122
|
-
if (e.type === "custom" && e.customComponent) {
|
|
123
|
-
const n = B[e.customComponent];
|
|
124
|
-
if (n)
|
|
125
|
-
return /* @__PURE__ */ u(n, { ...m }, e.name);
|
|
126
|
-
} else
|
|
127
|
-
return /* @__PURE__ */ u(R, { ...m }, e.name);
|
|
128
|
-
})),
|
|
129
|
-
/* @__PURE__ */ j($, { sx: A, children: [
|
|
130
|
-
/* @__PURE__ */ u(V, { type: "submit", onClick: N, children: g }),
|
|
131
|
-
/* @__PURE__ */ u(V, { onClick: q, children: F })
|
|
180
|
+
return /* @__PURE__ */ F("form", { style: W, children: [
|
|
181
|
+
Object.keys(u).length && I(),
|
|
182
|
+
/* @__PURE__ */ F(G, { sx: q, children: [
|
|
183
|
+
/* @__PURE__ */ l(v, { type: "submit", onClick: M, children: S }),
|
|
184
|
+
/* @__PURE__ */ l(v, { onClick: N, children: _ })
|
|
132
185
|
] })
|
|
133
186
|
] });
|
|
134
187
|
};
|
|
135
188
|
export {
|
|
136
|
-
|
|
189
|
+
re as default
|
|
137
190
|
};
|
|
@@ -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,
|