@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.
Files changed (32) hide show
  1. package/dist/{ButtonBase-85c9347b.js → ButtonBase-08b16b61.js} +3 -3
  2. package/dist/{TextField-fded06e5.js → TextField-f61d210a.js} +8 -7
  3. package/dist/{Tooltip-b926c320.js → Tooltip-e797a425.js} +6 -6
  4. package/dist/{TransitionGroupContext-fe9a562f.js → TransitionGroupContext-0e899f4c.js} +1 -1
  5. package/dist/{ZoomControllers-36e39bb0.js → ZoomControllers-d04c25f8.js} +5 -5
  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 +1 -1
  12. package/dist/components/organ/Form/Form.interfaces.d.ts +11 -3
  13. package/dist/components/organ/Form/Form.styles.d.ts +7 -2
  14. package/dist/components/organ/Form/Form.styles.js +9 -4
  15. package/dist/components/organ/Form/FormInput.d.ts +1 -0
  16. package/dist/components/organ/Form/FormInput.js +1284 -270
  17. package/dist/components/organ/Form/index.d.ts +3 -1
  18. package/dist/components/organ/Form/index.js +50 -47
  19. package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
  20. package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
  21. package/dist/{createSvgIcon-f773ce57.js → createSvgIcon-45340b5e.js} +17 -17
  22. package/dist/{createSvgIcon-58aa3adf.js → createSvgIcon-5aac746d.js} +2 -2
  23. package/dist/{createTheme-a4db2989.js → createTheme-759a022d.js} +507 -477
  24. package/dist/{exactProp-d79ccada.js → exactProp-23d6a154.js} +1 -1
  25. package/dist/{extendSxProp-db8b9da5.js → extendSxProp-cf8fd923.js} +1 -1
  26. package/dist/global/theme.js +1 -1
  27. package/dist/{index-03287c17.js → index-c9c32237.js} +3 -3
  28. package/dist/main.js +1 -1
  29. package/dist/providers/CraftThemeProvider.js +2 -2
  30. package/dist/{styled-126c6a62.js → styled-78608e1f.js} +16 -14
  31. package/dist/{useTheme-573c40a2.js → useTheme-8906bd79.js} +1 -1
  32. 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 H, useEffect as L } from "react";
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 R } from "../../../index-03287c17.js";
4
+ import { T as G } from "../../../index-c9c32237.js";
5
5
  import d from "./Form.styles.js";
6
- import { getLocalDateTime as z, createNestedObject as G, deepMergeObjects as J } from "./Form.utils.js";
7
- import Q from "./FormInput.js";
8
- import { s as U } from "../../../styled-126c6a62.js";
9
- import { B as x } from "../../../Tooltip-b926c320.js";
10
- const X = U("div")({
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
- }), me = ({
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: f,
20
- formStyles: C = {},
21
- formWrapperStyles: T = {},
22
- formFieldsWrapperStyles: A = {},
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({}), [M, g] = S([]);
27
- function N(t, e) {
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
- })), f == null || f(t, e), g([]);
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 = z();
39
+ const n = J();
38
40
  t[e.name] = n;
39
41
  } else
40
- t[e.name] = e.defaultValue || "";
41
- }), b(t), g([]);
42
+ t[e.name] = e.defaultValue || M[e.name] || "";
43
+ }), b(t), f([]);
42
44
  }
43
- function k() {
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
- }), g(t), t.length && (h == null || h(t)), !t.length;
84
+ }), f(t), t.length && (h == null || h(t)), !t.length;
83
85
  }
84
- const D = H(
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 = G(
93
+ const c = Q(
92
94
  m,
93
95
  p,
94
96
  l[r]
95
97
  );
96
- e = J(e, c);
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 I(t) {
108
- if (t.preventDefault(), k()) {
109
- const n = D(i);
109
+ function q(t) {
110
+ if (t.preventDefault(), I()) {
111
+ const n = W(i);
110
112
  _(n);
111
113
  }
112
114
  }
113
- function W() {
115
+ function P() {
114
116
  F(), O();
115
117
  }
116
- function q(t) {
117
- const e = M.find(
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: N,
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(Q, { ...n }, t.name);
139
+ return /* @__PURE__ */ u(X, { ...n }, t.name);
137
140
  }
138
- function P() {
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
- X,
161
+ Z,
159
162
  {
160
163
  children: e.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
161
- R,
164
+ G,
162
165
  {
163
166
  type: "headingSmall",
164
167
  sx: d.heading,
165
168
  children: r
166
169
  },
167
170
  r
168
- ) : q(r))
171
+ ) : $(r))
169
172
  },
170
173
  `group-${n ? e[0] : e[0].name}`
171
174
  );
172
175
  }
173
176
  );
174
177
  }
175
- L(() => {
178
+ z(() => {
176
179
  F();
177
180
  }, []);
178
- const $ = {
181
+ const H = {
179
182
  ...d.alignVertical,
180
- ...C
181
- }, w = {
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: T, children: /* @__PURE__ */ v("form", { style: $, children: [
188
- /* @__PURE__ */ u(x, { sx: A, children: Object.keys(l).length && P() }),
189
- /* @__PURE__ */ v(x, { sx: w, children: [
190
- /* @__PURE__ */ u(j, { type: "submit", onClick: I, children: V }),
191
- /* @__PURE__ */ u(j, { onClick: W, children: E })
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
- me as default
199
+ ie as default
197
200
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
- import { Z as p } from "../../../ZoomControllers-36e39bb0.js";
3
- import "../../../Tooltip-b926c320.js";
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-36e39bb0.js";
4
- import { B as m } from "../../../Tooltip-b926c320.js";
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, j as hb, _ as x0, k as mb } from "./createTheme-a4db2989.js";
2
- import { c as lT } from "./styled-126c6a62.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-fe9a562f.js";
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-d79ccada.js";
8
- import { u as Cb } from "./useTheme-573c40a2.js";
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-58aa3adf.js";
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
- Ob as a,
20389
- Wb as b,
20388
+ zb as a,
20389
+ Ob as b,
20390
20390
  kb as c,
20391
- bb as d,
20391
+ Wb as d,
20392
20392
  wb as e,
20393
- wT as f,
20394
- Ib as g,
20395
- Qb as h,
20393
+ bb as f,
20394
+ wT as g,
20395
+ Ib as h,
20396
20396
  y_ as i,
20397
- hT as j,
20398
- Nb as k,
20399
- Ub as l,
20400
- zb as m,
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
- h_ as u
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-a4db2989.js";
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-126c6a62.js";
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
  }