@loopr-ai/craft 0.7.4 → 0.7.6

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.
@@ -38,7 +38,7 @@ interface Validation {
38
38
  export interface ConfigField extends SelectField {
39
39
  validation?: Validation;
40
40
  customComponent?: string;
41
- submitDataKey?: string;
41
+ submitDataKey: Array<string> | string;
42
42
  preFillWithDateTime?: boolean;
43
43
  groupName?: string;
44
44
  hidden?: boolean;
@@ -27,6 +27,7 @@ declare const styles: {
27
27
  };
28
28
  "& > div": {
29
29
  flex: number;
30
+ overflow: string;
30
31
  };
31
32
  "&:has(.Mui-focused)": {
32
33
  outlineColor: string;
@@ -35,7 +36,8 @@ declare const styles: {
35
36
  heading: {
36
37
  textAlign: string;
37
38
  fontWeight: number;
38
- margin: string;
39
+ marginTop: string;
40
+ marginBottom: string;
39
41
  };
40
42
  label: {
41
43
  color: string;
@@ -73,6 +75,7 @@ declare const styles: {
73
75
  "& .MuiSelect-select": {
74
76
  padding: string;
75
77
  position: string;
78
+ textAlign: string;
76
79
  "& > span::before": {
77
80
  position: string;
78
81
  right: string;
@@ -27,7 +27,8 @@ const r = {
27
27
  flex: 1
28
28
  },
29
29
  "& > div": {
30
- flex: 2
30
+ flex: 2,
31
+ overflow: "hidden"
31
32
  },
32
33
  "&:has(.Mui-focused)": {
33
34
  outlineColor: "black"
@@ -36,7 +37,8 @@ const r = {
36
37
  heading: {
37
38
  textAlign: "left",
38
39
  fontWeight: 500,
39
- margin: "0.75rem 0"
40
+ marginTop: "2rem",
41
+ marginBottom: "0.75rem"
40
42
  },
41
43
  label: {
42
44
  color: e.darkGrey,
@@ -74,6 +76,7 @@ const r = {
74
76
  "& .MuiSelect-select": {
75
77
  padding: "0.75rem",
76
78
  position: "relative",
79
+ textAlign: "right",
77
80
  "& > span::before": {
78
81
  position: "absolute",
79
82
  right: "2rem"
@@ -1,28 +1,27 @@
1
- import oe, { jsx as r, jsxs as S, Fragment as se } from "react/jsx-runtime";
1
+ import oe, { jsx as r, jsxs as z, Fragment as se } from "react/jsx-runtime";
2
2
  import { r as ne, i as ae } from "../../../createSvgIcon-f773ce57.js";
3
- import * as P from "react";
3
+ import * as h from "react";
4
4
  import { useState as re, useCallback as ie, useEffect as le } from "react";
5
- import { customColors as R } from "../../../global/colors.js";
6
- import { images as ce } from "../../../global/constants.js";
7
- import { M as de, T as A } from "../../../index-03287c17.js";
8
- import x from "./Form.styles.js";
9
- import { d as V, B as z, T as pe } from "../../../Tooltip-b926c320.js";
10
- import { u as ue, F as me, L as B, T as fe } from "../../../TextField-fded06e5.js";
11
- import { g as H, a as I, _ as J, P as t, c as _, e as N } from "../../../createTheme-a4db2989.js";
12
- import { g as j, s as K, a as Q, c as k, b as X, r as be } from "../../../styled-126c6a62.js";
13
- import { B as ve } from "../../../ButtonBase-85c9347b.js";
14
- import { c as ge, u as ye } from "../../../TransitionGroupContext-fe9a562f.js";
15
- function xe(e) {
16
- return H("MuiInputAdornment", e);
5
+ import { customColors as P } from "../../../global/colors.js";
6
+ import { M as ce, T as k } from "../../../index-03287c17.js";
7
+ import y from "./Form.styles.js";
8
+ import { d as F, B as R, T as de } from "../../../Tooltip-b926c320.js";
9
+ import { u as ue, F as pe, L as _, T as me } from "../../../TextField-fded06e5.js";
10
+ import { g as W, a as I, _ as Y, P as t, c as S, e as $ } from "../../../createTheme-a4db2989.js";
11
+ import { g as E, s as q, a as H, c as w, b as K, r as fe } from "../../../styled-126c6a62.js";
12
+ import { B as ge } from "../../../ButtonBase-85c9347b.js";
13
+ import { c as be, u as ve } from "../../../TransitionGroupContext-fe9a562f.js";
14
+ function Me(e) {
15
+ return W("MuiInputAdornment", e);
17
16
  }
18
- const Ie = j("MuiInputAdornment", ["root", "filled", "standard", "outlined", "positionStart", "positionEnd", "disablePointerEvents", "hiddenLabel", "sizeSmall"]), D = Ie;
19
- var U;
20
- const Ce = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], he = (e, o) => {
17
+ const ye = E("MuiInputAdornment", ["root", "filled", "standard", "outlined", "positionStart", "positionEnd", "disablePointerEvents", "hiddenLabel", "sizeSmall"]), V = ye;
18
+ var B;
19
+ const Ie = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], xe = (e, o) => {
21
20
  const {
22
21
  ownerState: s
23
22
  } = e;
24
- return [o.root, o[`position${_(s.position)}`], s.disablePointerEvents === !0 && o.disablePointerEvents, o[s.variant]];
25
- }, $e = (e) => {
23
+ return [o.root, o[`position${S(s.position)}`], s.disablePointerEvents === !0 && o.disablePointerEvents, o[s.variant]];
24
+ }, Ne = (e) => {
26
25
  const {
27
26
  classes: o,
28
27
  disablePointerEvents: s,
@@ -30,14 +29,14 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
30
29
  position: i,
31
30
  size: d,
32
31
  variant: l
33
- } = e, v = {
34
- root: ["root", s && "disablePointerEvents", i && `position${_(i)}`, l, a && "hiddenLabel", d && `size${_(d)}`]
32
+ } = e, b = {
33
+ root: ["root", s && "disablePointerEvents", i && `position${S(i)}`, l, a && "hiddenLabel", d && `size${S(d)}`]
35
34
  };
36
- return X(v, xe, o);
37
- }, Me = K("div", {
35
+ return K(b, Me, o);
36
+ }, Ce = q("div", {
38
37
  name: "MuiInputAdornment",
39
38
  slot: "Root",
40
- overridesResolver: he
39
+ overridesResolver: xe
41
40
  })(({
42
41
  theme: e,
43
42
  ownerState: o
@@ -51,7 +50,7 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
51
50
  color: (e.vars || e).palette.action.active
52
51
  }, o.variant === "filled" && {
53
52
  // Styles applied to the root element if `variant="filled"`.
54
- [`&.${D.positionStart}&:not(.${D.hiddenLabel})`]: {
53
+ [`&.${V.positionStart}&:not(.${V.hiddenLabel})`]: {
55
54
  marginTop: 16
56
55
  }
57
56
  }, o.position === "start" && {
@@ -63,43 +62,43 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
63
62
  }, o.disablePointerEvents === !0 && {
64
63
  // Styles applied to the root element if `disablePointerEvents={true}`.
65
64
  pointerEvents: "none"
66
- })), Y = /* @__PURE__ */ P.forwardRef(function(o, s) {
67
- const a = Q({
65
+ })), J = /* @__PURE__ */ h.forwardRef(function(o, s) {
66
+ const a = H({
68
67
  props: o,
69
68
  name: "MuiInputAdornment"
70
69
  }), {
71
70
  children: i,
72
71
  className: d,
73
72
  component: l = "div",
74
- disablePointerEvents: v = !1,
73
+ disablePointerEvents: b = !1,
75
74
  disableTypography: f = !1,
76
- position: h,
77
- variant: g
78
- } = a, p = J(a, Ce), c = ue() || {};
79
- let u = g;
80
- g && c.variant && process.env.NODE_ENV !== "production" && g === c.variant && console.error("MUI: The `InputAdornment` variant infers the variant prop you do not have to provide one."), c && !u && (u = c.variant);
81
- const y = I({}, a, {
75
+ position: N,
76
+ variant: v
77
+ } = a, u = Y(a, Ie), c = ue() || {};
78
+ let p = v;
79
+ v && c.variant && process.env.NODE_ENV !== "production" && v === c.variant && console.error("MUI: The `InputAdornment` variant infers the variant prop you do not have to provide one."), c && !p && (p = c.variant);
80
+ const M = I({}, a, {
82
81
  hiddenLabel: c.hiddenLabel,
83
82
  size: c.size,
84
- disablePointerEvents: v,
85
- position: h,
86
- variant: u
87
- }), $ = $e(y);
88
- return /* @__PURE__ */ r(me.Provider, {
83
+ disablePointerEvents: b,
84
+ position: N,
85
+ variant: p
86
+ }), C = Ne(M);
87
+ return /* @__PURE__ */ r(pe.Provider, {
89
88
  value: null,
90
- children: /* @__PURE__ */ r(Me, I({
89
+ children: /* @__PURE__ */ r(Ce, I({
91
90
  as: l,
92
- ownerState: y,
93
- className: k($.root, d),
91
+ ownerState: M,
92
+ className: w(C.root, d),
94
93
  ref: s
95
- }, p, {
96
- children: typeof i == "string" && !f ? /* @__PURE__ */ r(de, {
94
+ }, u, {
95
+ children: typeof i == "string" && !f ? /* @__PURE__ */ r(ce, {
97
96
  color: "text.secondary",
98
97
  children: i
99
- }) : /* @__PURE__ */ S(P.Fragment, {
100
- children: [h === "start" ? (
98
+ }) : /* @__PURE__ */ z(h.Fragment, {
99
+ children: [N === "start" ? (
101
100
  /* notranslate needed while Google Translate will not fix zero-width space issue */
102
- U || (U = /* @__PURE__ */ r("span", {
101
+ B || (B = /* @__PURE__ */ r("span", {
103
102
  className: "notranslate",
104
103
  children: "​"
105
104
  }))
@@ -108,7 +107,7 @@ const Ce = ["children", "className", "component", "disablePointerEvents", "disab
108
107
  }))
109
108
  });
110
109
  });
111
- process.env.NODE_ENV !== "production" && (Y.propTypes = {
110
+ process.env.NODE_ENV !== "production" && (J.propTypes = {
112
111
  // ----------------------------- Warning --------------------------------
113
112
  // | These PropTypes are generated from the TypeScript type definitions |
114
113
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -156,16 +155,16 @@ process.env.NODE_ENV !== "production" && (Y.propTypes = {
156
155
  */
157
156
  variant: t.oneOf(["filled", "outlined", "standard"])
158
157
  });
159
- const G = Y, Pe = j("MuiListItemIcon", ["root", "alignItemsFlexStart"]), q = Pe, Te = j("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), W = Te;
160
- function Oe(e) {
161
- return H("MuiMenuItem", e);
158
+ const Q = J, Te = E("MuiListItemIcon", ["root", "alignItemsFlexStart"]), G = Te, he = E("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), Z = he;
159
+ function je(e) {
160
+ return W("MuiMenuItem", e);
162
161
  }
163
- const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), O = Ee, Ne = ["autoFocus", "component", "dense", "divider", "disableGutters", "focusVisibleClassName", "role", "tabIndex", "className"], Se = (e, o) => {
162
+ const De = E("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divider", "gutters", "selected"]), D = De, Oe = ["autoFocus", "component", "dense", "divider", "disableGutters", "focusVisibleClassName", "role", "tabIndex", "className"], $e = (e, o) => {
164
163
  const {
165
164
  ownerState: s
166
165
  } = e;
167
166
  return [o.root, s.dense && o.dense, s.divider && o.divider, !s.disableGutters && o.gutters];
168
- }, je = (e) => {
167
+ }, ze = (e) => {
169
168
  const {
170
169
  disabled: o,
171
170
  dense: s,
@@ -173,15 +172,15 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
173
172
  disableGutters: i,
174
173
  selected: d,
175
174
  classes: l
176
- } = e, f = X({
175
+ } = e, f = K({
177
176
  root: ["root", s && "dense", o && "disabled", !i && "gutters", a && "divider", d && "selected"]
178
- }, Oe, l);
177
+ }, je, l);
179
178
  return I({}, l, f);
180
- }, Fe = K(ve, {
181
- shouldForwardProp: (e) => be(e) || e === "classes",
179
+ }, Ee = q(ge, {
180
+ shouldForwardProp: (e) => fe(e) || e === "classes",
182
181
  name: "MuiMenuItem",
183
182
  slot: "Root",
184
- overridesResolver: Se
183
+ overridesResolver: $e
185
184
  })(({
186
185
  theme: e,
187
186
  ownerState: o
@@ -211,40 +210,40 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
211
210
  backgroundColor: "transparent"
212
211
  }
213
212
  },
214
- [`&.${O.selected}`]: {
215
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : N(e.palette.primary.main, e.palette.action.selectedOpacity),
216
- [`&.${O.focusVisible}`]: {
217
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : N(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
213
+ [`&.${D.selected}`]: {
214
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : $(e.palette.primary.main, e.palette.action.selectedOpacity),
215
+ [`&.${D.focusVisible}`]: {
216
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : $(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
218
217
  }
219
218
  },
220
- [`&.${O.selected}:hover`]: {
221
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : N(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
219
+ [`&.${D.selected}:hover`]: {
220
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : $(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
222
221
  // Reset on touch devices, it doesn't add specificity
223
222
  "@media (hover: none)": {
224
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : N(e.palette.primary.main, e.palette.action.selectedOpacity)
223
+ backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : $(e.palette.primary.main, e.palette.action.selectedOpacity)
225
224
  }
226
225
  },
227
- [`&.${O.focusVisible}`]: {
226
+ [`&.${D.focusVisible}`]: {
228
227
  backgroundColor: (e.vars || e).palette.action.focus
229
228
  },
230
- [`&.${O.disabled}`]: {
229
+ [`&.${D.disabled}`]: {
231
230
  opacity: (e.vars || e).palette.action.disabledOpacity
232
231
  },
233
- [`& + .${V.root}`]: {
232
+ [`& + .${F.root}`]: {
234
233
  marginTop: e.spacing(1),
235
234
  marginBottom: e.spacing(1)
236
235
  },
237
- [`& + .${V.inset}`]: {
236
+ [`& + .${F.inset}`]: {
238
237
  marginLeft: 52
239
238
  },
240
- [`& .${W.root}`]: {
239
+ [`& .${Z.root}`]: {
241
240
  marginTop: 0,
242
241
  marginBottom: 0
243
242
  },
244
- [`& .${W.inset}`]: {
243
+ [`& .${Z.inset}`]: {
245
244
  paddingLeft: 36
246
245
  },
247
- [`& .${q.root}`]: {
246
+ [`& .${G.root}`]: {
248
247
  minWidth: 36
249
248
  }
250
249
  }, !o.dense && {
@@ -257,52 +256,52 @@ const Ee = j("MuiMenuItem", ["root", "focusVisible", "dense", "disabled", "divid
257
256
  paddingTop: 4,
258
257
  paddingBottom: 4
259
258
  }, e.typography.body2, {
260
- [`& .${q.root} svg`]: {
259
+ [`& .${G.root} svg`]: {
261
260
  fontSize: "1.25rem"
262
261
  }
263
- }))), Z = /* @__PURE__ */ P.forwardRef(function(o, s) {
264
- const a = Q({
262
+ }))), X = /* @__PURE__ */ h.forwardRef(function(o, s) {
263
+ const a = H({
265
264
  props: o,
266
265
  name: "MuiMenuItem"
267
266
  }), {
268
267
  autoFocus: i = !1,
269
268
  component: d = "li",
270
269
  dense: l = !1,
271
- divider: v = !1,
270
+ divider: b = !1,
272
271
  disableGutters: f = !1,
273
- focusVisibleClassName: h,
274
- role: g = "menuitem",
275
- tabIndex: p,
272
+ focusVisibleClassName: N,
273
+ role: v = "menuitem",
274
+ tabIndex: u,
276
275
  className: c
277
- } = a, u = J(a, Ne), y = P.useContext(B), $ = P.useMemo(() => ({
278
- dense: l || y.dense || !1,
276
+ } = a, p = Y(a, Oe), M = h.useContext(_), C = h.useMemo(() => ({
277
+ dense: l || M.dense || !1,
279
278
  disableGutters: f
280
- }), [y.dense, l, f]), m = P.useRef(null);
281
- ge(() => {
279
+ }), [M.dense, l, f]), m = h.useRef(null);
280
+ be(() => {
282
281
  i && (m.current ? m.current.focus() : process.env.NODE_ENV !== "production" && console.error("MUI: Unable to set focus to a MenuItem whose component has not been rendered."));
283
282
  }, [i]);
284
- const F = I({}, a, {
285
- dense: $.dense,
286
- divider: v,
283
+ const L = I({}, a, {
284
+ dense: C.dense,
285
+ divider: b,
287
286
  disableGutters: f
288
- }), T = je(a), L = ye(m, s);
289
- let M;
290
- return a.disabled || (M = p !== void 0 ? p : -1), /* @__PURE__ */ r(B.Provider, {
291
- value: $,
292
- children: /* @__PURE__ */ r(Fe, I({
293
- ref: L,
294
- role: g,
295
- tabIndex: M,
287
+ }), j = ze(a), A = ve(m, s);
288
+ let T;
289
+ return a.disabled || (T = u !== void 0 ? u : -1), /* @__PURE__ */ r(_.Provider, {
290
+ value: C,
291
+ children: /* @__PURE__ */ r(Ee, I({
292
+ ref: A,
293
+ role: v,
294
+ tabIndex: T,
296
295
  component: d,
297
- focusVisibleClassName: k(T.focusVisible, h),
298
- className: k(T.root, c)
299
- }, u, {
300
- ownerState: F,
301
- classes: T
296
+ focusVisibleClassName: w(j.focusVisible, N),
297
+ className: w(j.root, c)
298
+ }, p, {
299
+ ownerState: L,
300
+ classes: j
302
301
  }))
303
302
  });
304
303
  });
305
- process.env.NODE_ENV !== "production" && (Z.propTypes = {
304
+ process.env.NODE_ENV !== "production" && (X.propTypes = {
306
305
  // ----------------------------- Warning --------------------------------
307
306
  // | These PropTypes are generated from the TypeScript type definitions |
308
307
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -377,16 +376,16 @@ process.env.NODE_ENV !== "production" && (Z.propTypes = {
377
376
  */
378
377
  tabIndex: t.number
379
378
  });
380
- const Le = Z;
381
- var w = {}, Re = ae;
382
- Object.defineProperty(w, "__esModule", {
379
+ const Le = X;
380
+ var U = {}, Ae = ae;
381
+ Object.defineProperty(U, "__esModule", {
383
382
  value: !0
384
383
  });
385
- var ee = w.default = void 0, _e = Re(ne()), ke = oe, we = (0, _e.default)(/* @__PURE__ */ (0, ke.jsx)("path", {
384
+ var ee = U.default = void 0, Pe = Ae(ne()), Se = oe, we = (0, Pe.default)(/* @__PURE__ */ (0, Se.jsx)("path", {
386
385
  d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
387
386
  }), "Error");
388
- ee = w.default = we;
389
- const Xe = ({
387
+ ee = U.default = we;
388
+ const Ue = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxNiAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjg3NzggMy4yNTUzOUMxNC4yODc1IDIuODM3MzkgMTQuOTYwNiAyLjgzNzM5IDE1LjM3MDMgMy4yNTUzOUMxNS43NzggMy42NjczOSAxNS43ODM3IDQuMzMzMDkgMTUuMzg0NSA0Ljc1MjE5TDYuOTU1NjMgMTQuNzE2M0M2LjU1MTYzIDE1LjE2IDUuODU3OTIgMTUuMTczIDUuNDM3NTIgMTQuNzQ0OEwwLjMwODYyNSA5LjU0NzQ5Qy0wLjEwMjg3NSA5LjEyNzg5IC0wLjEwMjg3NSA4LjQ1NjA5IDAuMzA4NjI1IDguMDM2NDlDMC43MTgzMjUgNy42MTg0OSAxLjM5MTQyIDcuNjE4NDkgMS44MDExMiA4LjAzNjQ5TDYuMTUxNzIgMTIuNDQ1NUwxMy44NDkzIDMuMjg2NzlMMTMuODc3OCAzLjI1NTM5WiIgZmlsbD0iIzE2MjMyNCIvPgo8L3N2Zz4K", He = ({
390
389
  name: e,
391
390
  label: o,
392
391
  type: s,
@@ -394,116 +393,116 @@ const Xe = ({
394
393
  handleChange: i,
395
394
  placeholder: d,
396
395
  required: l,
397
- disabled: v,
396
+ disabled: b,
398
397
  beforeField: f,
399
- afterField: h,
400
- options: g,
401
- optionsResponseHandler: p,
398
+ afterField: N,
399
+ options: v,
400
+ optionsResponseHandler: u,
402
401
  api_endpoint: c,
403
- error: u,
404
- helperText: y,
405
- autofocus: $
402
+ error: p,
403
+ helperText: M,
404
+ autofocus: C
406
405
  }) => {
407
- const [m, F] = re([]);
408
- function T(n) {
406
+ const [m, L] = re([]);
407
+ function j(n) {
409
408
  i(e, n.target.value);
410
409
  }
411
- const L = ie(async () => {
410
+ const A = ie(async () => {
412
411
  var n;
413
- return s !== "select" ? [] : g || (c && p ? (n = (await (await fetch(c)).json())[p.key]) == null ? void 0 : n.map((E) => ({
414
- name: E[p.name],
415
- value: E[p.value]
412
+ return s !== "select" ? [] : v || (c && u ? (n = (await (await fetch(c)).json())[u.key]) == null ? void 0 : n.map((O) => ({
413
+ name: O[u.name],
414
+ value: O[u.value]
416
415
  })) : []);
417
- }, [s, p, c]);
416
+ }, [s, u, c]);
418
417
  le(() => {
419
- L().then((n) => F(n));
418
+ A().then((n) => L(n));
420
419
  }, []);
421
- let M = {
422
- ...x.textfield,
423
- backgroundColor: u ? R.redLight : "transparent",
420
+ let T = {
421
+ ...y.textfield,
422
+ backgroundColor: p ? P.redLight : "transparent",
424
423
  "& input::placeholder": {
425
- color: u ? R.redMedium : "grey"
424
+ color: p ? P.redMedium : "grey"
426
425
  }
427
426
  };
428
427
  const te = {
429
428
  "& .MuiSelect-select > span::before": {
430
429
  content: `'${d || ""}'`,
431
- color: u ? "rgba(254, 64, 76, 0.4)" : "rgba(153, 153, 153, 0.6)"
430
+ color: p ? "rgba(254, 64, 76, 0.4)" : "rgba(153, 153, 153, 0.6)"
432
431
  }
433
432
  };
434
- return s === "select" && (M = {
435
- ...M,
433
+ return s === "select" && (T = {
434
+ ...T,
436
435
  ...te
437
- }), s !== "custom" ? /* @__PURE__ */ S(z, { sx: x.formInputWrapper, children: [
438
- /* @__PURE__ */ r("label", { htmlFor: `form-input-${e}`, children: /* @__PURE__ */ r(A, { sx: x.label, children: `${o} ${l ? "*" : ""}` }) }),
439
- /* @__PURE__ */ r(z, { sx: x.textfieldWrapper, children: /* @__PURE__ */ r(
440
- pe,
436
+ }), s !== "custom" ? /* @__PURE__ */ z(R, { sx: y.formInputWrapper, children: [
437
+ /* @__PURE__ */ r("label", { htmlFor: `form-input-${e}`, children: /* @__PURE__ */ r(k, { sx: y.label, children: `${o} ${l ? "*" : ""}` }) }),
438
+ /* @__PURE__ */ r(R, { sx: y.textfieldWrapper, children: /* @__PURE__ */ r(
439
+ de,
441
440
  {
442
- title: y && /* @__PURE__ */ S(A, { type: "subtitleSmall", textColor: "white", children: [
443
- /* @__PURE__ */ r(ee, { sx: x.errorIcon }),
444
- y
441
+ title: M && /* @__PURE__ */ z(k, { type: "subtitleSmall", textColor: "white", children: [
442
+ /* @__PURE__ */ r(ee, { sx: y.errorIcon }),
443
+ M
445
444
  ] }),
446
445
  placement: "bottom",
447
446
  arrow: !0,
448
447
  componentsProps: {
449
448
  tooltip: {
450
- sx: x.tooltip
449
+ sx: y.tooltip
451
450
  },
452
451
  popper: {
453
- sx: x.tooltipPopper
452
+ sx: y.tooltipPopper
454
453
  }
455
454
  },
456
455
  children: /* @__PURE__ */ r(
457
- fe,
456
+ me,
458
457
  {
459
458
  id: `form-input-${e}`,
460
- autoFocus: $,
459
+ autoFocus: C,
461
460
  name: e,
462
461
  type: s,
463
462
  select: s === "select",
464
463
  value: a,
465
- onChange: T,
464
+ onChange: j,
466
465
  placeholder: d,
467
466
  required: l,
468
- disabled: v,
469
- error: u,
467
+ disabled: b,
468
+ error: p,
470
469
  InputProps: {
471
- startAdornment: /* @__PURE__ */ r(G, { position: "start", children: f }),
472
- endAdornment: /* @__PURE__ */ r(G, { position: "end", children: h })
470
+ startAdornment: /* @__PURE__ */ r(Q, { position: "start", children: f }),
471
+ endAdornment: /* @__PURE__ */ r(Q, { position: "end", children: N })
473
472
  },
474
473
  SelectProps: {
475
474
  renderValue: (n) => {
476
- const b = m == null ? void 0 : m.find(
477
- (C) => typeof C == "object" ? C.value === n : C === n
475
+ const g = m == null ? void 0 : m.find(
476
+ (x) => typeof x == "object" ? x.value === n : x === n
478
477
  );
479
- return typeof b == "object" ? b.name : b;
478
+ return typeof g == "object" ? g.name : g;
480
479
  },
481
480
  MenuProps: {
482
481
  PaperProps: {
483
- sx: x.selectDropdown
482
+ sx: y.selectDropdown
484
483
  }
485
484
  }
486
485
  },
487
- sx: M,
486
+ sx: T,
488
487
  children: s === "select" && (m == null ? void 0 : m.map((n) => {
489
- const b = typeof n == "object", C = b ? n.value === a : n === a, E = {
488
+ const g = typeof n == "object", x = g ? n.value === a : n === a, O = {
490
489
  display: "flex",
491
490
  justifyContent: "space-between",
492
491
  alignItems: "center",
493
- color: C ? "black" : R.darkGrey,
492
+ color: x ? "black" : P.darkGrey,
494
493
  gap: "1rem"
495
494
  };
496
- return /* @__PURE__ */ S(
495
+ return /* @__PURE__ */ z(
497
496
  Le,
498
497
  {
499
- value: b ? n.value : n,
500
- sx: E,
498
+ value: g ? n.value : n,
499
+ sx: O,
501
500
  children: [
502
- b ? n.name : n,
503
- C && /* @__PURE__ */ r("img", { src: ce.success, alt: "selected-option" })
501
+ g ? n.name : n,
502
+ x && /* @__PURE__ */ r("img", { src: Ue, alt: "selected-option" })
504
503
  ]
505
504
  },
506
- b ? n.name : n
505
+ g ? n.name : n
507
506
  );
508
507
  }))
509
508
  }
@@ -513,5 +512,5 @@ const Xe = ({
513
512
  ] }) : /* @__PURE__ */ r(se, {});
514
513
  };
515
514
  export {
516
- Xe as default
515
+ He as default
517
516
  };
@@ -1,192 +1,197 @@
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")({
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";
3
+ import j from "../../cell/Button/index.js";
4
+ import { T as R } from "../../../index-03287c17.js";
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")({
11
11
  marginTop: "0.75rem"
12
- }), oe = ({
13
- config: o,
12
+ }), me = ({
13
+ config: i,
14
14
  submitText: V = "Submit",
15
15
  handleSubmit: _,
16
- handleInvalidData: c,
17
- cancelText: C = "Cancel",
18
- handleCancel: E,
19
- onChange: h,
20
- formStyles: O = {},
16
+ handleInvalidData: h,
17
+ cancelText: E = "Cancel",
18
+ handleCancel: O,
19
+ onChange: f,
20
+ formStyles: C = {},
21
21
  formWrapperStyles: T = {},
22
22
  formFieldsWrapperStyles: A = {},
23
- buttonWrapperStyles: D = {},
24
- customFields: x = {}
23
+ buttonWrapperStyles: B = {},
24
+ customFields: y = {}
25
25
  }) => {
26
- const [p, y] = v({}), [B, g] = v([]);
27
- function M(e, t) {
28
- y((n) => ({
26
+ const [l, b] = S({}), [M, g] = S([]);
27
+ function N(t, e) {
28
+ b((n) => ({
29
29
  ...n,
30
- [e]: t
31
- })), h == null || h(e, t), g([]);
30
+ [t]: e
31
+ })), f == null || f(t, e), g([]);
32
32
  }
33
33
  function F() {
34
- const e = {};
35
- o == null || o.forEach((t) => {
36
- if (t.preFillWithDateTime && t.type === "text") {
37
- const n = G();
38
- e[t.name] = n;
34
+ const t = {};
35
+ i == null || i.forEach((e) => {
36
+ if (e.preFillWithDateTime && e.type === "text") {
37
+ const n = z();
38
+ t[e.name] = n;
39
39
  } else
40
- e[t.name] = t.defaultValue || "";
41
- }), y(e), g([]);
40
+ t[e.name] = e.defaultValue || "";
41
+ }), b(t), g([]);
42
42
  }
43
- function N() {
44
- const e = [];
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;
43
+ function k() {
44
+ const t = [];
45
+ return i == null || i.forEach((e) => {
46
+ const { name: n, label: r, type: p, validation: s, required: a } = e, o = l[n], m = n;
47
47
  if (s)
48
- if (a === "number") {
49
- const d = parseInt(m);
50
- s.min && d < s.min && e.push({
51
- field: l,
52
- value: m,
48
+ if (p === "number") {
49
+ const c = parseInt(o);
50
+ s.min && c < s.min && t.push({
51
+ field: m,
52
+ value: o,
53
53
  message: s.invalid_message
54
- }), s.max && d > s.max && e.push({
55
- field: l,
56
- value: m,
54
+ }), s.max && c > s.max && t.push({
55
+ field: m,
56
+ value: o,
57
57
  message: s.invalid_message
58
- }), isNaN(d) && e.push({
59
- field: l,
60
- value: m,
58
+ }), isNaN(c) && t.push({
59
+ field: m,
60
+ value: o,
61
61
  message: "Invalid number"
62
62
  });
63
63
  } else
64
- a === "text" && (s.min_length && m.length < s.min_length && e.push({
65
- field: l,
66
- value: m,
64
+ p === "text" && (s.min_length && o.length < s.min_length && t.push({
65
+ field: m,
66
+ value: o,
67
67
  message: s.invalid_message
68
- }), s.max_length && m.length > s.max_length && e.push({
69
- field: l,
70
- value: m,
68
+ }), s.max_length && o.length > s.max_length && t.push({
69
+ field: m,
70
+ value: o,
71
71
  message: s.invalid_message
72
- }), s.pattern && !new RegExp(s.pattern).test(m) && e.push({
73
- field: l,
74
- value: m,
72
+ }), s.pattern && !new RegExp(s.pattern).test(o) && t.push({
73
+ field: m,
74
+ value: o,
75
75
  message: s.invalid_message
76
76
  }));
77
- i && !m && e.push({
78
- field: l,
79
- value: m,
77
+ a && !o && t.push({
78
+ field: m,
79
+ value: o,
80
80
  message: `${r} is required`
81
81
  });
82
- }), g(e), e.length && (c == null || c(e)), !e.length;
82
+ }), g(t), t.length && (h == null || h(t)), !t.length;
83
83
  }
84
- const k = H(
85
- (e) => {
86
- let t = {};
87
- return e == null || e.forEach((n) => {
88
- const { name: r, type: a, submitDataKey: s } = n;
89
- if (s) {
90
- const i = R(
91
- s,
92
- a,
93
- p[r]
94
- );
95
- t = z(t, i);
96
- } else
97
- t[r] = a === "number" ? parseInt(p[r]) : p[r];
98
- }), t;
84
+ const D = H(
85
+ (t) => {
86
+ let e = {};
87
+ return t == null || t.forEach((n) => {
88
+ const { name: r, type: p, submitDataKey: s } = n, a = p === "number" ? parseInt(l[r]) : l[r];
89
+ function o(m) {
90
+ if (m.indexOf(".") !== -1) {
91
+ const c = G(
92
+ m,
93
+ p,
94
+ l[r]
95
+ );
96
+ e = J(e, c);
97
+ } else
98
+ e[m] = a;
99
+ }
100
+ typeof s != "string" && (s != null && s.length) ? s.forEach((m) => {
101
+ o(m);
102
+ }) : typeof s == "string" && s ? o(s) : e[r] = a;
103
+ }), e;
99
104
  },
100
- [p]
105
+ [l]
101
106
  );
102
- function I(e) {
103
- if (e.preventDefault(), N()) {
104
- const n = k(o);
107
+ function I(t) {
108
+ if (t.preventDefault(), k()) {
109
+ const n = D(i);
105
110
  _(n);
106
111
  }
107
112
  }
108
113
  function W() {
109
- F(), E();
114
+ F(), O();
110
115
  }
111
- function q(e) {
112
- const t = B.find(
113
- (r) => r.field === e.name
116
+ function q(t) {
117
+ const e = M.find(
118
+ (r) => r.field === t.name
114
119
  ), n = {
115
- ...e,
116
- value: p[e.name],
117
- handleChange: M,
118
- error: !!t,
119
- helperText: t == null ? void 0 : t.message
120
+ ...t,
121
+ value: l[t.name],
122
+ handleChange: N,
123
+ error: !!e,
124
+ helperText: e == null ? void 0 : e.message
120
125
  };
121
- if (e.hidden)
126
+ if (t.hidden)
122
127
  return null;
123
- if (e.type === "custom" && e.customComponent && x[e.customComponent]) {
124
- const { component: r, props: a } = x[e.customComponent], s = r, i = {
128
+ if (t.type === "custom" && t.customComponent && y[t.customComponent]) {
129
+ const { component: r, props: p } = y[t.customComponent], s = r, a = {
125
130
  ...n,
126
- ...a
131
+ ...p
127
132
  };
128
- if (s && i)
129
- return /* @__PURE__ */ u(s, { ...i }, e.name);
133
+ if (s && a)
134
+ return /* @__PURE__ */ u(s, { ...a }, t.name);
130
135
  } else
131
- return /* @__PURE__ */ u(J, { ...n }, e.name);
136
+ return /* @__PURE__ */ u(Q, { ...n }, t.name);
132
137
  }
133
138
  function P() {
134
- return o.reduce(
135
- (t, n) => {
139
+ return i.reduce(
140
+ (e, n) => {
136
141
  const { groupName: r } = n;
137
- if (!t.length)
138
- t.push(r ? [r, n] : [n]);
142
+ if (!e.length)
143
+ e.push(r ? [r, n] : [n]);
139
144
  else if (r) {
140
- const s = t.findIndex((i) => i[0] === r);
141
- s === -1 ? t.push([r, n]) : t[s].push(n);
145
+ const s = e.findIndex((a) => a[0] === r);
146
+ s === -1 ? e.push([r, n]) : e[s].push(n);
142
147
  } else {
143
- const s = t[t.length - 1];
144
- typeof s[0] == "string" ? t.push([n]) : s.push(n);
148
+ const s = e[e.length - 1];
149
+ typeof s[0] == "string" ? e.push([n]) : s.push(n);
145
150
  }
146
- return t;
151
+ return e;
147
152
  },
148
153
  []
149
154
  ).map(
150
- (t) => {
151
- const n = typeof t[0] == "string";
155
+ (e) => {
156
+ const n = typeof e[0] == "string";
152
157
  return /* @__PURE__ */ u(
153
- U,
158
+ X,
154
159
  {
155
- children: t.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
156
- L,
160
+ children: e.map((r) => typeof r == "string" ? /* @__PURE__ */ u(
161
+ R,
157
162
  {
158
163
  type: "headingSmall",
159
- sx: f.heading,
164
+ sx: d.heading,
160
165
  children: r
161
166
  },
162
167
  r
163
168
  ) : q(r))
164
169
  },
165
- `group-${n ? t[0] : t[0].name}`
170
+ `group-${n ? e[0] : e[0].name}`
166
171
  );
167
172
  }
168
173
  );
169
174
  }
170
- K(() => {
175
+ L(() => {
171
176
  F();
172
177
  }, []);
173
178
  const $ = {
174
- ...f.alignVertical,
175
- ...O
179
+ ...d.alignVertical,
180
+ ...C
176
181
  }, w = {
177
- ...f.alignVertical,
182
+ ...d.alignVertical,
178
183
  marginTop: "1rem",
179
184
  gap: "0.5rem",
180
- ...D
185
+ ...B
181
186
  };
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 })
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 })
187
192
  ] })
188
193
  ] }) });
189
194
  };
190
195
  export {
191
- oe as default
196
+ me as default
192
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopr-ai/craft",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Component library based out of Material UI customized to support Loopr AI products",
5
5
  "homepage": "https://loopr.ai",
6
6
  "author": {
@@ -1,3 +0,0 @@
1
- export declare const images: {
2
- success: string;
3
- };