@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.
Files changed (41) 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.d.ts +2 -0
  17. package/dist/components/organ/Form/index.js +156 -106
  18. package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
  19. package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
  20. package/dist/{createSvgIcon-bb3d4825.js → createSvgIcon-58aa3adf.js} +5 -5
  21. package/dist/{Grow-a906cda2.js → createSvgIcon-f773ce57.js} +4020 -3944
  22. package/dist/{createTheme-ca1567c6.js → createTheme-a4db2989.js} +7 -7
  23. package/dist/{exactProp-3d9df1ae.js → exactProp-d79ccada.js} +1 -1
  24. package/dist/{extendSxProp-fc2654e5.js → extendSxProp-db8b9da5.js} +1 -1
  25. package/dist/global/colors.d.ts +5 -0
  26. package/dist/global/colors.js +11 -6
  27. package/dist/global/constants.d.ts +3 -0
  28. package/dist/global/constants.js +6 -1
  29. package/dist/global/theme.js +1 -1
  30. package/dist/{Typography-65e5f8a8.js → index-03287c17.js} +61 -45
  31. package/dist/main.js +10 -10
  32. package/dist/providers/CraftThemeProvider.js +2 -2
  33. package/dist/{styled-80b57810.js → styled-126c6a62.js} +49 -49
  34. package/dist/{useTheme-16446f25.js → useTheme-573c40a2.js} +1 -1
  35. package/package.json +1 -1
  36. package/dist/Box-8cd400c2.js +0 -58
  37. package/dist/ZoomControllers-8a147df0.js +0 -3390
  38. package/dist/components/organ/Form/FieldInput.js +0 -442
  39. package/dist/createSvgIcon-8e5d9dc7.js +0 -81
  40. package/dist/dividerClasses-0233db5a.js +0 -10
  41. /package/dist/components/organ/Form/{FieldInput.d.ts → FormInput.d.ts} +0 -0
@@ -1,142 +1,192 @@
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 = {},
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: B = {}
24
+ customFields: x = {}
19
25
  }) => {
20
- const [o, f] = j({}), [E, d] = j([]);
21
- function x(e, s) {
22
- f((n) => ({
26
+ const [p, y] = v({}), [B, g] = v([]);
27
+ function M(e, t) {
28
+ y((n) => ({
23
29
  ...n,
24
- [e]: s
25
- })), c == null || c(e, s);
30
+ [e]: t
31
+ })), h == null || h(e, t), g([]);
26
32
  }
27
- function y() {
33
+ function F() {
28
34
  const e = {};
29
- r == null || r.forEach((s) => {
30
- e[s.name] = s.defaultValue || "";
31
- }), f(e), d([]);
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 M() {
43
+ function N() {
34
44
  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,
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: t.invalid_message
44
- }), t.max && b > t.max && e.push({
45
- field: i,
53
+ message: s.invalid_message
54
+ }), s.max && d > s.max && e.push({
55
+ field: l,
46
56
  value: m,
47
- message: t.invalid_message
48
- }), isNaN(b) && e.push({
49
- field: i,
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
- u === "text" && (t.min_length && m.length < t.min_length && e.push({
55
- field: i,
64
+ a === "text" && (s.min_length && m.length < s.min_length && e.push({
65
+ field: l,
56
66
  value: m,
57
- message: t.invalid_message
58
- }), t.max_length && m.length > t.max_length && e.push({
59
- field: i,
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: t.invalid_message
62
- }), t.pattern && !new RegExp(t.pattern).test(m) && e.push({
63
- field: i,
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: t.invalid_message
75
+ message: s.invalid_message
66
76
  }));
67
- h && !m && e.push({
68
- field: i,
77
+ i && !m && e.push({
78
+ field: l,
69
79
  value: m,
70
- message: `${a} is required`
80
+ message: `${r} is required`
71
81
  });
72
- }), d(e), e.length && (p == null || p(e)), !e.length;
82
+ }), g(e), e.length && (c == null || c(e)), !e.length;
73
83
  }
74
- const k = w(
84
+ const k = H(
75
85
  (e) => {
76
- let s = {};
86
+ let t = {};
77
87
  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]
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
- s = P(s, h);
95
+ t = z(t, i);
86
96
  } else
87
- s[a] = u === "number" ? parseInt(o[a]) : o[a];
88
- }), s;
97
+ t[r] = a === "number" ? parseInt(p[r]) : p[r];
98
+ }), t;
89
99
  },
90
- [o]
100
+ [p]
91
101
  );
92
- function N(e) {
93
- if (e.preventDefault(), M()) {
94
- const n = k(r);
95
- v(n);
102
+ function I(e) {
103
+ if (e.preventDefault(), N()) {
104
+ const n = k(o);
105
+ _(n);
96
106
  }
97
107
  }
98
- function T() {
99
- y(), O();
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
- A(() => {
102
- y();
170
+ K(() => {
171
+ F();
103
172
  }, []);
104
- const q = {
105
- ...V.alignVertical,
106
- ...C
107
- }, W = {
108
- ...V.alignVertical,
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__ */ 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 })
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
- X as default
191
+ oe as default
142
192
  };
@@ -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,