@loopr-ai/craft 0.7.2 → 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.
Files changed (40) hide show
  1. package/dist/{ButtonBase-fc1e48eb.js → ButtonBase-85c9347b.js} +3 -3
  2. package/dist/{TextField-a534df29.js → TextField-fded06e5.js} +7 -7
  3. package/dist/Tooltip-b926c320.js +2022 -0
  4. package/dist/{TransitionGroupContext-ba502e63.js → TransitionGroupContext-fe9a562f.js} +3 -3
  5. package/dist/ZoomControllers-36e39bb0.js +1432 -0
  6. package/dist/components/cell/AvatarGroup/index.js +3 -3
  7. package/dist/components/cell/Button/index.js +3 -3
  8. package/dist/components/cell/Chip/index.js +5 -5
  9. package/dist/components/cell/ProgressBar/index.js +3 -3
  10. package/dist/components/cell/Search/index.js +2 -2
  11. package/dist/components/cell/Typography/index.js +5 -19
  12. package/dist/components/organ/Form/Form.interfaces.d.ts +6 -6
  13. package/dist/components/organ/Form/Form.styles.d.ts +99 -2
  14. package/dist/components/organ/Form/Form.styles.js +99 -4
  15. package/dist/components/organ/Form/FormInput.js +517 -0
  16. package/dist/components/organ/Form/index.js +155 -107
  17. package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
  18. package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
  19. package/dist/{createSvgIcon-bb3d4825.js → createSvgIcon-58aa3adf.js} +5 -5
  20. package/dist/{Grow-a906cda2.js → createSvgIcon-f773ce57.js} +4020 -3944
  21. package/dist/{createTheme-ca1567c6.js → createTheme-a4db2989.js} +7 -7
  22. package/dist/{exactProp-3d9df1ae.js → exactProp-d79ccada.js} +1 -1
  23. package/dist/{extendSxProp-fc2654e5.js → extendSxProp-db8b9da5.js} +1 -1
  24. package/dist/global/colors.d.ts +5 -0
  25. package/dist/global/colors.js +11 -6
  26. package/dist/global/constants.d.ts +3 -0
  27. package/dist/global/constants.js +6 -1
  28. package/dist/global/theme.js +1 -1
  29. package/dist/{Typography-65e5f8a8.js → index-03287c17.js} +61 -45
  30. package/dist/main.js +10 -10
  31. package/dist/providers/CraftThemeProvider.js +2 -2
  32. package/dist/{styled-80b57810.js → styled-126c6a62.js} +49 -49
  33. package/dist/{useTheme-16446f25.js → useTheme-573c40a2.js} +1 -1
  34. package/package.json +1 -1
  35. package/dist/Box-8cd400c2.js +0 -58
  36. package/dist/ZoomControllers-8a147df0.js +0 -3390
  37. package/dist/components/organ/Form/FieldInput.js +0 -442
  38. package/dist/createSvgIcon-8e5d9dc7.js +0 -81
  39. package/dist/dividerClasses-0233db5a.js +0 -10
  40. /package/dist/components/organ/Form/{FieldInput.d.ts → FormInput.d.ts} +0 -0
@@ -1,142 +1,190 @@
1
- import { jsxs as g, jsx as l } from "react/jsx-runtime";
2
- import { useState as j, useCallback as w, useEffect as A } from "react";
3
- import F from "../../cell/Button/index.js";
4
- import K from "./FieldInput.js";
5
- import V from "./Form.styles.js";
6
- import { createNestedObject as L, deepMergeObjects as P, getLocalDateTime as R } from "./Form.utils.js";
7
- import { B as $ } from "../../../Box-8cd400c2.js";
8
- const X = ({
9
- config: r,
10
- submitText: _ = "Submit",
11
- handleSubmit: v,
12
- handleInvalidData: p,
13
- cancelText: S = "Cancel",
14
- handleCancel: O,
15
- onChange: c,
16
- formStyles: C = {},
17
- buttonWrapperStyles: D = {},
18
- customFields: B = {}
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 [o, f] = j({}), [E, d] = j([]);
21
- function x(e, s) {
22
- f((n) => ({
24
+ const [u, y] = j({}), [T, g] = j([]);
25
+ function A(e, t) {
26
+ y((n) => ({
23
27
  ...n,
24
- [e]: s
25
- })), c == null || c(e, s);
28
+ [e]: t
29
+ })), h == null || h(e, t), g([]);
26
30
  }
27
- function y() {
31
+ function x() {
28
32
  const e = {};
29
- r == null || r.forEach((s) => {
30
- e[s.name] = s.defaultValue || "";
31
- }), f(e), d([]);
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 M() {
41
+ function D() {
34
42
  const e = [];
35
- return r == null || r.forEach((s) => {
36
- const { name: n, label: a, type: u, validation: t, required: h } = s, m = o[n], i = n;
37
- if (t)
38
- if (u === "number") {
39
- const b = parseInt(m);
40
- t.min && b < t.min && e.push({
41
- field: i,
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,
42
50
  value: m,
43
- message: t.invalid_message
44
- }), t.max && b > t.max && e.push({
45
- field: i,
51
+ message: s.invalid_message
52
+ }), s.max && f > s.max && e.push({
53
+ field: p,
46
54
  value: m,
47
- message: t.invalid_message
48
- }), isNaN(b) && e.push({
49
- field: i,
55
+ message: s.invalid_message
56
+ }), isNaN(f) && e.push({
57
+ field: p,
50
58
  value: m,
51
59
  message: "Invalid number"
52
60
  });
53
61
  } else
54
- u === "text" && (t.min_length && m.length < t.min_length && e.push({
55
- field: i,
62
+ a === "text" && (s.min_length && m.length < s.min_length && e.push({
63
+ field: p,
56
64
  value: m,
57
- message: t.invalid_message
58
- }), t.max_length && m.length > t.max_length && e.push({
59
- field: i,
65
+ message: s.invalid_message
66
+ }), s.max_length && m.length > s.max_length && e.push({
67
+ field: p,
60
68
  value: m,
61
- message: t.invalid_message
62
- }), t.pattern && !new RegExp(t.pattern).test(m) && e.push({
63
- field: i,
69
+ message: s.invalid_message
70
+ }), s.pattern && !new RegExp(s.pattern).test(m) && e.push({
71
+ field: p,
64
72
  value: m,
65
- message: t.invalid_message
73
+ message: s.invalid_message
66
74
  }));
67
- h && !m && e.push({
68
- field: i,
75
+ i && !m && e.push({
76
+ field: p,
69
77
  value: m,
70
- message: `${a} is required`
78
+ message: `${r} is required`
71
79
  });
72
- }), d(e), e.length && (p == null || p(e)), !e.length;
80
+ }), g(e), e.length && (c == null || c(e)), !e.length;
73
81
  }
74
- const k = w(
82
+ const B = P(
75
83
  (e) => {
76
- let s = {};
84
+ let t = {};
77
85
  return e == null || e.forEach((n) => {
78
- const { name: a, type: u, submitDataKey: t } = n;
79
- if (t) {
80
- const h = L(
81
- t,
82
- u,
83
- o[a]
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
- s = P(s, h);
93
+ t = K(t, i);
86
94
  } else
87
- s[a] = u === "number" ? parseInt(o[a]) : o[a];
88
- }), s;
95
+ t[r] = a === "number" ? parseInt(u[r]) : u[r];
96
+ }), t;
89
97
  },
90
- [o]
98
+ [u]
91
99
  );
92
- function N(e) {
93
- if (e.preventDefault(), M()) {
94
- const n = k(r);
95
- v(n);
100
+ function M(e) {
101
+ if (e.preventDefault(), D()) {
102
+ const n = B(o);
103
+ V(n);
96
104
  }
97
105
  }
98
- function T() {
99
- y(), O();
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
- A(() => {
102
- y();
168
+ $(() => {
169
+ x();
103
170
  }, []);
104
- const q = {
105
- ...V.alignVertical,
106
- ...C
107
- }, W = {
108
- ...V.alignVertical,
109
- ...D
171
+ const W = {
172
+ ...d.alignVertical,
173
+ ...E
174
+ }, q = {
175
+ ...d.alignVertical,
176
+ marginTop: "1rem",
177
+ gap: "0.5rem",
178
+ ...O
110
179
  };
111
- return /* @__PURE__ */ g("form", { style: q, children: [
112
- Object.keys(o).length && (r == null ? void 0 : r.map((e) => {
113
- const s = E.find(
114
- (a) => a.field === e.name
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 })
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: _ })
137
185
  ] })
138
186
  ] });
139
187
  };
140
188
  export {
141
- X as default
189
+ re as default
142
190
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
- import { Z as p } from "../../../ZoomControllers-8a147df0.js";
3
- import "../../../Box-8cd400c2.js";
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-8a147df0.js";
4
- import { B as m } from "../../../Box-8cd400c2.js";
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 I, b as h, _ as w, a as y, P as o } from "./createTheme-ca1567c6.js";
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, a as N, b as R, c as O, e as B } from "./styled-80b57810.js";
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 I("MuiSvgIcon", e);
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 b = E($);
81
+ const I = E($);
82
82
  return /* @__PURE__ */ C(V, y({
83
83
  as: c,
84
- className: O(b.root, d),
84
+ className: O(I.root, d),
85
85
  focusable: "false",
86
86
  color: u,
87
87
  "aria-hidden": s ? void 0 : !0,