@loopr-ai/craft 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ButtonBase-85c9347b.js → ButtonBase-08b16b61.js} +3 -3
- package/dist/{TextField-fded06e5.js → TextField-f61d210a.js} +8 -7
- package/dist/{Tooltip-b926c320.js → Tooltip-e797a425.js} +6 -6
- package/dist/{TransitionGroupContext-fe9a562f.js → TransitionGroupContext-0e899f4c.js} +1 -1
- package/dist/{ZoomControllers-36e39bb0.js → ZoomControllers-d04c25f8.js} +5 -5
- 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 +1 -1
- package/dist/components/organ/Form/Form.interfaces.d.ts +11 -3
- package/dist/components/organ/Form/Form.styles.d.ts +7 -2
- package/dist/components/organ/Form/Form.styles.js +9 -4
- package/dist/components/organ/Form/FormInput.d.ts +1 -0
- package/dist/components/organ/Form/FormInput.js +1284 -270
- package/dist/components/organ/Form/index.d.ts +3 -1
- package/dist/components/organ/Form/index.js +50 -47
- package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
- package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
- package/dist/{createSvgIcon-f773ce57.js → createSvgIcon-45340b5e.js} +17 -17
- package/dist/{createSvgIcon-58aa3adf.js → createSvgIcon-5aac746d.js} +2 -2
- package/dist/{createTheme-a4db2989.js → createTheme-759a022d.js} +507 -477
- package/dist/{exactProp-d79ccada.js → exactProp-23d6a154.js} +1 -1
- package/dist/{extendSxProp-db8b9da5.js → extendSxProp-cf8fd923.js} +1 -1
- package/dist/global/theme.js +1 -1
- package/dist/{index-03287c17.js → index-c9c32237.js} +3 -3
- package/dist/main.js +1 -1
- package/dist/providers/CraftThemeProvider.js +2 -2
- package/dist/{styled-126c6a62.js → styled-78608e1f.js} +16 -14
- package/dist/{useTheme-573c40a2.js → useTheme-8906bd79.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SxProps } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { CraftFC } from "../../../global/interfaces";
|
|
4
|
-
import { ConfigField, CustomFields, InvalidData } from "./Form.interfaces";
|
|
4
|
+
import { ConfigField, CustomFields, FormInputAdornments, InvalidData } from "./Form.interfaces";
|
|
5
5
|
interface FormProps {
|
|
6
6
|
config: Array<ConfigField>;
|
|
7
7
|
submitText?: string;
|
|
@@ -15,6 +15,8 @@ interface FormProps {
|
|
|
15
15
|
formFieldsWrapperStyles?: SxProps;
|
|
16
16
|
formStyles?: React.CSSProperties;
|
|
17
17
|
buttonWrapperStyles?: SxProps;
|
|
18
|
+
preFillValues?: any;
|
|
19
|
+
formAdornments?: FormInputAdornments;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Form component
|
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
import { jsx as u, jsxs as v } from "react/jsx-runtime";
|
|
2
|
-
import { useState as S, useCallback as
|
|
2
|
+
import { useState as S, useCallback as R, useEffect as z } from "react";
|
|
3
3
|
import j from "../../cell/Button/index.js";
|
|
4
|
-
import { T as
|
|
4
|
+
import { T as G } from "../../../index-c9c32237.js";
|
|
5
5
|
import d from "./Form.styles.js";
|
|
6
|
-
import { getLocalDateTime as
|
|
7
|
-
import
|
|
8
|
-
import { s as
|
|
9
|
-
import { B as x } from "../../../Tooltip-
|
|
10
|
-
const
|
|
6
|
+
import { getLocalDateTime as J, createNestedObject as Q, deepMergeObjects as U } from "./Form.utils.js";
|
|
7
|
+
import X from "./FormInput.js";
|
|
8
|
+
import { s as Y } from "../../../styled-78608e1f.js";
|
|
9
|
+
import { B as x } from "../../../Tooltip-e797a425.js";
|
|
10
|
+
const Z = Y("div")({
|
|
11
11
|
marginTop: "0.75rem"
|
|
12
|
-
}),
|
|
12
|
+
}), ie = ({
|
|
13
13
|
config: i,
|
|
14
14
|
submitText: V = "Submit",
|
|
15
15
|
handleSubmit: _,
|
|
16
16
|
handleInvalidData: h,
|
|
17
17
|
cancelText: E = "Cancel",
|
|
18
18
|
handleCancel: O,
|
|
19
|
-
onChange:
|
|
20
|
-
formStyles:
|
|
21
|
-
formWrapperStyles:
|
|
22
|
-
formFieldsWrapperStyles:
|
|
19
|
+
onChange: g,
|
|
20
|
+
formStyles: A = {},
|
|
21
|
+
formWrapperStyles: C = {},
|
|
22
|
+
formFieldsWrapperStyles: T = {},
|
|
23
23
|
buttonWrapperStyles: B = {},
|
|
24
|
-
customFields: y = {}
|
|
24
|
+
customFields: y = {},
|
|
25
|
+
preFillValues: M = {},
|
|
26
|
+
formAdornments: N = {}
|
|
25
27
|
}) => {
|
|
26
|
-
const [l, b] = S({}), [
|
|
27
|
-
function
|
|
28
|
+
const [l, b] = S({}), [k, f] = S([]);
|
|
29
|
+
function D(t, e) {
|
|
28
30
|
b((n) => ({
|
|
29
31
|
...n,
|
|
30
32
|
[t]: e
|
|
31
|
-
})),
|
|
33
|
+
})), g == null || g(t, e), f([]);
|
|
32
34
|
}
|
|
33
35
|
function F() {
|
|
34
36
|
const t = {};
|
|
35
37
|
i == null || i.forEach((e) => {
|
|
36
38
|
if (e.preFillWithDateTime && e.type === "text") {
|
|
37
|
-
const n =
|
|
39
|
+
const n = J();
|
|
38
40
|
t[e.name] = n;
|
|
39
41
|
} else
|
|
40
|
-
t[e.name] = e.defaultValue || "";
|
|
41
|
-
}), b(t),
|
|
42
|
+
t[e.name] = e.defaultValue || M[e.name] || "";
|
|
43
|
+
}), b(t), f([]);
|
|
42
44
|
}
|
|
43
|
-
function
|
|
45
|
+
function I() {
|
|
44
46
|
const t = [];
|
|
45
47
|
return i == null || i.forEach((e) => {
|
|
46
48
|
const { name: n, label: r, type: p, validation: s, required: a } = e, o = l[n], m = n;
|
|
@@ -79,21 +81,21 @@ const X = U("div")({
|
|
|
79
81
|
value: o,
|
|
80
82
|
message: `${r} is required`
|
|
81
83
|
});
|
|
82
|
-
}),
|
|
84
|
+
}), f(t), t.length && (h == null || h(t)), !t.length;
|
|
83
85
|
}
|
|
84
|
-
const
|
|
86
|
+
const W = R(
|
|
85
87
|
(t) => {
|
|
86
88
|
let e = {};
|
|
87
89
|
return t == null || t.forEach((n) => {
|
|
88
90
|
const { name: r, type: p, submitDataKey: s } = n, a = p === "number" ? parseInt(l[r]) : l[r];
|
|
89
91
|
function o(m) {
|
|
90
92
|
if (m.indexOf(".") !== -1) {
|
|
91
|
-
const c =
|
|
93
|
+
const c = Q(
|
|
92
94
|
m,
|
|
93
95
|
p,
|
|
94
96
|
l[r]
|
|
95
97
|
);
|
|
96
|
-
e =
|
|
98
|
+
e = U(e, c);
|
|
97
99
|
} else
|
|
98
100
|
e[m] = a;
|
|
99
101
|
}
|
|
@@ -104,24 +106,25 @@ const X = U("div")({
|
|
|
104
106
|
},
|
|
105
107
|
[l]
|
|
106
108
|
);
|
|
107
|
-
function
|
|
108
|
-
if (t.preventDefault(),
|
|
109
|
-
const n =
|
|
109
|
+
function q(t) {
|
|
110
|
+
if (t.preventDefault(), I()) {
|
|
111
|
+
const n = W(i);
|
|
110
112
|
_(n);
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
function
|
|
115
|
+
function P() {
|
|
114
116
|
F(), O();
|
|
115
117
|
}
|
|
116
|
-
function
|
|
117
|
-
const e =
|
|
118
|
+
function $(t) {
|
|
119
|
+
const e = k.find(
|
|
118
120
|
(r) => r.field === t.name
|
|
119
121
|
), n = {
|
|
120
122
|
...t,
|
|
121
123
|
value: l[t.name],
|
|
122
|
-
handleChange:
|
|
124
|
+
handleChange: D,
|
|
123
125
|
error: !!e,
|
|
124
|
-
helperText: e == null ? void 0 : e.message
|
|
126
|
+
helperText: e == null ? void 0 : e.message,
|
|
127
|
+
inputAdornments: N[t.name] || {}
|
|
125
128
|
};
|
|
126
129
|
if (t.hidden)
|
|
127
130
|
return null;
|
|
@@ -133,9 +136,9 @@ const X = U("div")({
|
|
|
133
136
|
if (s && a)
|
|
134
137
|
return /* @__PURE__ */ u(s, { ...a }, t.name);
|
|
135
138
|
} else
|
|
136
|
-
return /* @__PURE__ */ u(
|
|
139
|
+
return /* @__PURE__ */ u(X, { ...n }, t.name);
|
|
137
140
|
}
|
|
138
|
-
function
|
|
141
|
+
function w() {
|
|
139
142
|
return i.reduce(
|
|
140
143
|
(e, n) => {
|
|
141
144
|
const { groupName: r } = n;
|
|
@@ -155,43 +158,43 @@ const X = U("div")({
|
|
|
155
158
|
(e) => {
|
|
156
159
|
const n = typeof e[0] == "string";
|
|
157
160
|
return /* @__PURE__ */ u(
|
|
158
|
-
|
|
161
|
+
Z,
|
|
159
162
|
{
|
|
160
163
|
children: e.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
|
|
161
|
-
|
|
164
|
+
G,
|
|
162
165
|
{
|
|
163
166
|
type: "headingSmall",
|
|
164
167
|
sx: d.heading,
|
|
165
168
|
children: r
|
|
166
169
|
},
|
|
167
170
|
r
|
|
168
|
-
) :
|
|
171
|
+
) : $(r))
|
|
169
172
|
},
|
|
170
173
|
`group-${n ? e[0] : e[0].name}`
|
|
171
174
|
);
|
|
172
175
|
}
|
|
173
176
|
);
|
|
174
177
|
}
|
|
175
|
-
|
|
178
|
+
z(() => {
|
|
176
179
|
F();
|
|
177
180
|
}, []);
|
|
178
|
-
const
|
|
181
|
+
const H = {
|
|
179
182
|
...d.alignVertical,
|
|
180
|
-
...
|
|
181
|
-
},
|
|
183
|
+
...A
|
|
184
|
+
}, L = {
|
|
182
185
|
...d.alignVertical,
|
|
183
186
|
marginTop: "1rem",
|
|
184
187
|
gap: "0.5rem",
|
|
185
188
|
...B
|
|
186
189
|
};
|
|
187
|
-
return /* @__PURE__ */ u(x, { sx:
|
|
188
|
-
/* @__PURE__ */ u(x, { sx:
|
|
189
|
-
/* @__PURE__ */ v(x, { sx:
|
|
190
|
-
/* @__PURE__ */ u(j, { type: "submit", onClick:
|
|
191
|
-
/* @__PURE__ */ u(j, { onClick:
|
|
190
|
+
return /* @__PURE__ */ u(x, { sx: C, children: /* @__PURE__ */ v("form", { style: H, children: [
|
|
191
|
+
/* @__PURE__ */ u(x, { sx: T, children: Object.keys(l).length && w() }),
|
|
192
|
+
/* @__PURE__ */ v(x, { sx: L, children: [
|
|
193
|
+
/* @__PURE__ */ u(j, { type: "submit", onClick: q, children: V }),
|
|
194
|
+
/* @__PURE__ */ u(j, { onClick: P, children: E })
|
|
192
195
|
] })
|
|
193
196
|
] }) });
|
|
194
197
|
};
|
|
195
198
|
export {
|
|
196
|
-
|
|
199
|
+
ie as default
|
|
197
200
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import { Z as p } from "../../../ZoomControllers-
|
|
3
|
-
import "../../../Tooltip-
|
|
2
|
+
import { Z as p } from "../../../ZoomControllers-d04c25f8.js";
|
|
3
|
+
import "../../../Tooltip-e797a425.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 "../../../Tooltip-
|
|
3
|
+
import { T as C, Z as S, a as W } from "../../../ZoomControllers-d04c25f8.js";
|
|
4
|
+
import { B as m } from "../../../Tooltip-e797a425.js";
|
|
5
5
|
const D = {
|
|
6
6
|
position: "relative",
|
|
7
7
|
borderRadius: "1rem",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as ce, a as fa, C as pb, c as vb,
|
|
2
|
-
import { c as lT } from "./styled-
|
|
3
|
-
import { s as y0, c as g0, b as yb, u as Lm, a as gb, _ as Sb, T as gT } from "./TransitionGroupContext-
|
|
1
|
+
import { P as ce, a as fa, C as pb, c as vb, p as hb, _ as x0, q as mb } from "./createTheme-759a022d.js";
|
|
2
|
+
import { c as lT } from "./styled-78608e1f.js";
|
|
3
|
+
import { s as y0, c as g0, b as yb, u as Lm, a as gb, _ as Sb, T as gT } from "./TransitionGroupContext-0e899f4c.js";
|
|
4
4
|
import * as Vt from "react";
|
|
5
5
|
import rf from "react";
|
|
6
6
|
import { jsx as S0 } from "react/jsx-runtime";
|
|
7
|
-
import { e as Eb } from "./exactProp-
|
|
8
|
-
import { u as Cb } from "./useTheme-
|
|
7
|
+
import { e as Eb } from "./exactProp-23d6a154.js";
|
|
8
|
+
import { u as Cb } from "./useTheme-8906bd79.js";
|
|
9
9
|
import { c as ST } from "./chainPropTypes-004bf492.js";
|
|
10
|
-
import { c as Tb } from "./createSvgIcon-
|
|
10
|
+
import { c as Tb } from "./createSvgIcon-5aac746d.js";
|
|
11
11
|
import { u as Rb } from "./unsupportedProp-3dbf01f6.js";
|
|
12
12
|
function xb(O) {
|
|
13
13
|
const {
|
|
@@ -20385,21 +20385,21 @@ export {
|
|
|
20385
20385
|
Db as H,
|
|
20386
20386
|
T0 as P,
|
|
20387
20387
|
Yb as T,
|
|
20388
|
-
|
|
20389
|
-
|
|
20388
|
+
zb as a,
|
|
20389
|
+
Ob as b,
|
|
20390
20390
|
kb as c,
|
|
20391
|
-
|
|
20391
|
+
Wb as d,
|
|
20392
20392
|
wb as e,
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20393
|
+
bb as f,
|
|
20394
|
+
wT as g,
|
|
20395
|
+
Ib as h,
|
|
20396
20396
|
y_ as i,
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20397
|
+
Qb as j,
|
|
20398
|
+
hT as k,
|
|
20399
|
+
h_ as l,
|
|
20400
|
+
Nb as m,
|
|
20401
20401
|
Gb as n,
|
|
20402
20402
|
TT as o,
|
|
20403
20403
|
g_ as r,
|
|
20404
|
-
|
|
20404
|
+
Ub as u
|
|
20405
20405
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as b, c as h, _ as w, a as y, P as o } from "./createTheme-
|
|
1
|
+
import { g as b, c as h, _ as w, a as y, P as o } from "./createTheme-759a022d.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, s as N, a as R, c as O, b as B } from "./styled-
|
|
4
|
+
import { g as T, s as N, a as R, c as O, b as B } from "./styled-78608e1f.js";
|
|
5
5
|
function j(e) {
|
|
6
6
|
return b("MuiSvgIcon", e);
|
|
7
7
|
}
|