@levo-so/react 0.1.0 → 0.1.2

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 (37) hide show
  1. package/dist/{CheckboxWidget-CD4lv7B4.js → CheckboxWidget-BV2nPDdB.js} +1 -1
  2. package/dist/{CollectionFormBuilder-a0pzMkWL.js → CollectionFormBuilder-uvr15jvu.js} +96 -82
  3. package/dist/{CurrencyWidget-DRMqUgbP.js → CurrencyWidget-VzBWDdzQ.js} +1 -1
  4. package/dist/DateTimeWidget-QmZXdxzS.js +80 -0
  5. package/dist/{DefaultFormVariant-BzHB74Ie.js → DefaultFormVariant-DyyCGXvB.js} +2 -2
  6. package/dist/{DropdownWidget-CW0GSjwE.js → DropdownWidget-CxWQF6r3.js} +1 -1
  7. package/dist/EmailWidget-BxxtgUGU.js +41 -0
  8. package/dist/{GeocoderWidget-Ib15NJcx.js → GeocoderWidget-lh46EUHn.js} +1 -1
  9. package/dist/{MultiGeocoderWidget-BuW8i48_.js → MultiGeocoderWidget-C84ZYxpR.js} +2 -2
  10. package/dist/{PhoneWidget-COo3SBNU.js → PhoneWidget-_-cBcZ_D.js} +9 -8
  11. package/dist/{RadioWidget-C8syq1dO.js → RadioWidget-BJ1qwTRO.js} +1 -1
  12. package/dist/{RichTextWidget-B5qxi5OE.js → RichTextWidget-CC6uShje.js} +14 -13
  13. package/dist/{StepsFormVariant-NSTSIoVV.js → StepsFormVariant-BxANsU4Z.js} +2 -2
  14. package/dist/{SwitchWidget-C-p7lICr.js → SwitchWidget-CbCYweyx.js} +1 -1
  15. package/dist/TextWidget-CfEeuyFV.js +33 -0
  16. package/dist/{TextareaWidget-D0TbFUjX.js → TextareaWidget-Dqt4CVV-.js} +1 -1
  17. package/dist/{ToggleCheckboxWidget-BbVq_dAC.js → ToggleCheckboxWidget-D8CxllEX.js} +1 -1
  18. package/dist/{URLWidget-00u8Svwt.js → URLWidget-C07DCMOd.js} +2 -2
  19. package/dist/{UploadWidget-Dim2TEFc.js → UploadWidget-DoY_CPLy.js} +1 -1
  20. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
  21. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +3 -5
  22. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
  23. package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +2 -3
  24. package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts.map +1 -1
  25. package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
  26. package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -1
  27. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts +2 -3
  28. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
  29. package/dist/collection/index.js +1 -1
  30. package/dist/collection/utils/formHelpers.d.ts +2 -2
  31. package/dist/index.js +1 -1
  32. package/dist/style.css +1 -1
  33. package/dist/{useLevoForm-CR3q-L5Z.js → useLevoForm-B4Dmf73H.js} +1 -1
  34. package/package.json +20 -14
  35. package/dist/DateTimeWidget-FmBvE_lk.js +0 -103
  36. package/dist/EmailWidget-Nyc76pT8.js +0 -42
  37. package/dist/TextWidget-BtZp3DRk.js +0 -34
@@ -2,7 +2,7 @@
2
2
  import { j as t } from "./jsx-runtime-B6kdoens.js";
3
3
  import B, { useState as k } from "react";
4
4
  import { useController as C } from "react-hook-form";
5
- import { h as E, j as I, k as u } from "./CollectionFormBuilder-a0pzMkWL.js";
5
+ import { h as E, j as I, k as u } from "./CollectionFormBuilder-uvr15jvu.js";
6
6
  import { C as w } from "./Checbox-sq-atGlJ.js";
7
7
  import { I as O } from "./Input-2CvZ90f8.js";
8
8
  import { c as _ } from "./cn-C9QoOYNG.js";
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  import { j as s } from "./jsx-runtime-B6kdoens.js";
3
- import { FieldInterfaces as a, defaultByKinds as O, formatsByInterface as se, interfaceKinds as oe, FieldInterfacesList as ae } from "@levo-so/core";
4
- import { G as F, T as ie, a as le, c as ce, B as v, d as ue, r as de, s as ge, S as me } from "./Spinner-CuUosd-S.js";
5
- import j, { useState as R, lazy as h, Suspense as he, useEffect as pe } from "react";
3
+ import { FieldInterfaces as a, defaultByKinds as F, formatsByInterface as se, interfaceKinds as oe, FieldInterfacesList as ae } from "@levo-so/core";
4
+ import { G as O, T as ie, a as le, c as ce, B as v, d as ue, r as de, s as ge, S as me } from "./Spinner-CuUosd-S.js";
5
+ import j, { useState as L, lazy as h, Suspense as he, useEffect as pe } from "react";
6
6
  import { useFieldArray as xe, useController as ye } from "react-hook-form";
7
7
  import { Mate as $ } from "@theinternetfolks/mate";
8
8
  import { Snowflake as fe } from "@theinternetfolks/snowflake";
9
- import be from "google-libphonenumber";
9
+ import We from "google-libphonenumber";
10
10
  import P from "validator";
11
11
  import w from "validatorjs";
12
12
  import { c as f } from "./cn-C9QoOYNG.js";
13
13
  import { u as G } from "./LevoProvider-DNbYyEaf.js";
14
- import * as We from "inflection";
14
+ import * as be from "inflection";
15
15
  import { useInView as je } from "react-intersection-observer";
16
- const { PhoneNumberUtil: ke } = be, ve = (e) => {
16
+ const { PhoneNumberUtil: ke } = We, ve = (e) => {
17
17
  const r = [];
18
18
  for (const t of Object.keys(e))
19
19
  for (const n of (e == null ? void 0 : e[t]) || [])
@@ -82,7 +82,7 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
82
82
  var t, n;
83
83
  const r = {};
84
84
  for (const i of e)
85
- r[i.key] = (t = O) == null ? void 0 : t[i == null ? void 0 : i.kind], (i == null ? void 0 : i.field_interface) === a.RecordWidget && ((n = i == null ? void 0 : i.fields) != null && n.length) && (r[i.key] = C(i.fields));
85
+ r[i.key] = (t = F) == null ? void 0 : t[i == null ? void 0 : i.kind], (i == null ? void 0 : i.field_interface) === a.RecordWidget && ((n = i == null ? void 0 : i.fields) != null && n.length) && (r[i.key] = C(i.fields));
86
86
  return r;
87
87
  }, ht = (e) => {
88
88
  var t;
@@ -137,7 +137,7 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
137
137
  values: [],
138
138
  editable: !0
139
139
  }
140
- ]), t.kind = oe[r] || "string", t.default_value || (t.default_value = O[t.kind] || null), r !== a.CollectionWidget && ae.includes(r) && (t.field_interface = r), { field: t, fieldFocused: n };
140
+ ]), t.kind = oe[r] || "string", t.default_value || (t.default_value = F[t.kind] || null), r !== a.CollectionWidget && ae.includes(r) && (t.field_interface = r), { field: t, fieldFocused: n };
141
141
  }, yt = (e, r) => {
142
142
  var d;
143
143
  const t = { ...e }, n = [], i = "_id";
@@ -166,13 +166,13 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
166
166
  );
167
167
  }
168
168
  };
169
- function bt(e) {
170
- return F({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M9.243 3.03a1 1 0 01.727 1.213L9.53 6h2.94l.56-2.243a1 1 0 111.94.486L14.53 6H17a1 1 0 110 2h-2.97l-1 4H15a1 1 0 110 2h-2.47l-.56 2.242a1 1 0 11-1.94-.485L10.47 14H7.53l-.56 2.242a1 1 0 11-1.94-.485L5.47 14H3a1 1 0 110-2h2.97l1-4H5a1 1 0 110-2h2.47l.56-2.243a1 1 0 011.213-.727zM9.03 8l-1 4h2.938l1-4H9.031z", clipRule: "evenodd" }, child: [] }] })(e);
169
+ function Wt(e) {
170
+ return O({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M9.243 3.03a1 1 0 01.727 1.213L9.53 6h2.94l.56-2.243a1 1 0 111.94.486L14.53 6H17a1 1 0 110 2h-2.97l-1 4H15a1 1 0 110 2h-2.47l-.56 2.242a1 1 0 11-1.94-.485L10.47 14H7.53l-.56 2.242a1 1 0 11-1.94-.485L5.47 14H3a1 1 0 110-2h2.97l1-4H5a1 1 0 110-2h2.47l.56-2.243a1 1 0 011.213-.727zM9.03 8l-1 4h2.938l1-4H9.031z", clipRule: "evenodd" }, child: [] }] })(e);
171
171
  }
172
- function H(e) {
173
- return F({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z", clipRule: "evenodd" }, child: [] }] })(e);
172
+ function E(e) {
173
+ return O({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z", clipRule: "evenodd" }, child: [] }] })(e);
174
174
  }
175
- const L = ({
175
+ const A = ({
176
176
  children: e,
177
177
  isRequired: r,
178
178
  className: t,
@@ -196,11 +196,11 @@ const L = ({
196
196
  field: e,
197
197
  isInternal: r
198
198
  }) => {
199
- const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e, [o, c] = R("0"), { fields: u, ...g } = xe({
199
+ const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e, [o, c] = L("0"), { fields: u, ...g } = xe({
200
200
  name: t
201
201
  });
202
202
  return !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "w-full max-w-full", children: [
203
- /* @__PURE__ */ s.jsx(L, { className: "text-md font-medium mb-4", children: n }),
203
+ /* @__PURE__ */ s.jsx(A, { className: "text-md font-medium mb-4", children: n }),
204
204
  u && Array.isArray(u) ? /* @__PURE__ */ s.jsxs(ie, { value: o, onValueChange: c, className: "w-full", children: [
205
205
  /* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
206
206
  u.length ? /* @__PURE__ */ s.jsx(le, { className: "h-11 overflow-y-hidden overflow-x-auto flex-1 w-1 justify-start", children: u == null ? void 0 : u.map((x, l) => /* @__PURE__ */ s.jsx(
@@ -222,7 +222,7 @@ const L = ({
222
222
  g.append(C(d)), c(((u == null ? void 0 : u.length) ?? 0).toString());
223
223
  },
224
224
  children: [
225
- /* @__PURE__ */ s.jsx(H, { className: "inline-block mr-1", size: "14px" }),
225
+ /* @__PURE__ */ s.jsx(E, { className: "inline-block mr-1", size: "14px" }),
226
226
  "Add"
227
227
  ]
228
228
  }
@@ -235,14 +235,14 @@ const L = ({
235
235
  value: l.toString(),
236
236
  children: [
237
237
  /* @__PURE__ */ s.jsx("div", { className: "flex flex-col px-3 py-2 gap-3", children: d.map((p) => {
238
- const W = {
238
+ const b = {
239
239
  ...p,
240
240
  key: `${t}.${l}.${p == null ? void 0 : p.key}`
241
241
  };
242
242
  return /* @__PURE__ */ s.jsx(
243
243
  J,
244
244
  {
245
- field: W,
245
+ field: b,
246
246
  isInternal: r
247
247
  },
248
248
  `common-fields-${p == null ? void 0 : p.id}`
@@ -298,7 +298,7 @@ const L = ({
298
298
  g.append(C(d)), c("0");
299
299
  },
300
300
  children: [
301
- /* @__PURE__ */ s.jsx(H, { className: "inline-block mr-1", size: "14px" }),
301
+ /* @__PURE__ */ s.jsx(E, { className: "inline-block mr-1", size: "14px" }),
302
302
  "Add"
303
303
  ]
304
304
  }
@@ -334,7 +334,7 @@ const L = ({
334
334
  },
335
335
  validate: (i) => {
336
336
  var c, u;
337
- if ((c = e == null ? void 0 : e.options) != null && c.disableValidation)
337
+ if ((c = e == null ? void 0 : e.options) != null && c.disableValidation || !i)
338
338
  return !0;
339
339
  const d = K(
340
340
  {
@@ -347,12 +347,12 @@ const L = ({
347
347
  return o && (o == null ? void 0 : o.length) > 0 ? (u = o == null ? void 0 : o[0]) == null ? void 0 : u.message : !0;
348
348
  }
349
349
  };
350
- }, Re = _e, Te = j.lazy(
350
+ }, Re = _e, Le = j.lazy(
351
351
  () => import("react-select-async-paginate").then((e) => ({
352
352
  default: e.AsyncPaginate
353
353
  }))
354
354
  ), Ne = (e) => /* @__PURE__ */ s.jsx(
355
- Te,
355
+ Le,
356
356
  {
357
357
  isClearable: !0,
358
358
  menuPlacement: "auto",
@@ -390,11 +390,11 @@ const L = ({
390
390
  },
391
391
  ...e
392
392
  }
393
- ), Ie = ({
393
+ ), Te = ({
394
394
  children: e
395
- }) => /* @__PURE__ */ s.jsx("p", { className: "text-xs font-normal text-red-400 text-wrap", children: e }), Le = ({
395
+ }) => /* @__PURE__ */ s.jsx("p", { className: "text-xs font-normal text-red-400 text-wrap", children: e }), Ae = ({
396
396
  children: e
397
- }) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }), Ae = j.forwardRef(({ error: e, helperText: r, containerStyles: t, readOnly: n, children: i }, d) => /* @__PURE__ */ s.jsx(
397
+ }) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }), Ie = j.forwardRef(({ error: e, helperText: r, containerStyles: t, readOnly: n, children: i }, d) => /* @__PURE__ */ s.jsx(
398
398
  "div",
399
399
  {
400
400
  className: f(
@@ -405,27 +405,27 @@ const L = ({
405
405
  ref: d,
406
406
  children: /* @__PURE__ */ s.jsxs("div", { className: f("w-full shrink-0", "sm:flex-1"), children: [
407
407
  i,
408
- e && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Ie, { children: e }) }),
409
- r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Le, { children: r }) })
408
+ e && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Te, { children: e }) }),
409
+ r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Ae, { children: r }) })
410
410
  ] })
411
411
  }
412
- )), De = ({
412
+ )), Me = ({
413
413
  field: e
414
414
  }) => {
415
- var A, D, M;
416
- const { collection: r } = G(), [t, n] = R(!1), { key: i = "", label: d = "", helper_text: o = "", readonly: c = !1 } = e, u = i, g = ((A = e == null ? void 0 : e.options) == null ? void 0 : A.collection_key) || "", x = ((D = e == null ? void 0 : e.options) == null ? void 0 : D.label_field_key) || "", {
417
- field: { value: l, onBlur: p, onChange: W, ref: b, disabled: X, ...Y },
418
- fieldState: T
415
+ var I, M, D;
416
+ const { collection: r } = G(), [t, n] = L(!1), { key: i = "", label: d = "", helper_text: o = "", readonly: c = !1 } = e, u = i, g = ((I = e == null ? void 0 : e.options) == null ? void 0 : I.collection_key) || "", x = ((M = e == null ? void 0 : e.options) == null ? void 0 : M.label_field_key) || "", {
417
+ field: { value: l, onBlur: p, onChange: b, ref: W, disabled: X, ...Y },
418
+ fieldState: N
419
419
  } = ye({
420
420
  name: u,
421
421
  rules: Re(e)
422
- }), Z = !!(e != null && e.required), ee = (M = T == null ? void 0 : T.error) == null ? void 0 : M.message, te = async (y, Ye, { page: N = 1 }) => {
422
+ }), Z = !!(e != null && e.required), ee = (D = N == null ? void 0 : N.error) == null ? void 0 : D.message, te = async (y, Ye, { page: T = 1 }) => {
423
423
  var S;
424
424
  n(!0);
425
425
  try {
426
426
  const _ = await (r == null ? void 0 : r.getCollectionContentList({
427
427
  collection_key: g,
428
- page: N,
428
+ page: T,
429
429
  search: y,
430
430
  limit: 10
431
431
  })), k = (S = _ == null ? void 0 : _.content) == null ? void 0 : S.data, V = (k || []).map((m) => {
@@ -443,7 +443,7 @@ const L = ({
443
443
  options: Array.isArray(V) ? V : [],
444
444
  hasMore: k && !((k == null ? void 0 : k.length) < 10),
445
445
  additional: {
446
- page: N + 1
446
+ page: T + 1
447
447
  }
448
448
  };
449
449
  } catch {
@@ -451,7 +451,7 @@ const L = ({
451
451
  options: [],
452
452
  hasMore: !1,
453
453
  additional: {
454
- page: N
454
+ page: T
455
455
  }
456
456
  };
457
457
  } finally {
@@ -466,21 +466,21 @@ const L = ({
466
466
  }
467
467
  } : null;
468
468
  return /* @__PURE__ */ s.jsxs(
469
- Ae,
469
+ Ie,
470
470
  {
471
- ref: b,
471
+ ref: W,
472
472
  error: ee,
473
473
  helperText: o,
474
474
  readOnly: c,
475
475
  children: [
476
- d && /* @__PURE__ */ s.jsx(L, { htmlFor: u, isRequired: Z, children: d }),
476
+ d && /* @__PURE__ */ s.jsx(A, { htmlFor: u, isRequired: Z, children: d }),
477
477
  /* @__PURE__ */ s.jsx(
478
478
  Ne,
479
479
  {
480
480
  id: u,
481
481
  value: re,
482
482
  onChange: (y) => {
483
- W((y == null ? void 0 : y.value) || null);
483
+ b((y == null ? void 0 : y.value) || null);
484
484
  },
485
485
  onBlur: () => {
486
486
  p();
@@ -502,25 +502,25 @@ const L = ({
502
502
  ]
503
503
  }
504
504
  );
505
- }, U = h(() => import("./TextWidget-BtZp3DRk.js")), Me = h(
506
- () => import("./CurrencyWidget-DRMqUgbP.js")
505
+ }, H = h(() => import("./TextWidget-CfEeuyFV.js")), De = h(
506
+ () => import("./CurrencyWidget-VzBWDdzQ.js")
507
507
  ), Se = h(
508
- () => import("./CheckboxWidget-CD4lv7B4.js")
509
- ), E = h(
510
- () => import("./DateTimeWidget-FmBvE_lk.js")
508
+ () => import("./CheckboxWidget-BV2nPDdB.js")
509
+ ), U = h(
510
+ () => import("./DateTimeWidget-QmZXdxzS.js")
511
511
  ), q = h(
512
- () => import("./DropdownWidget-CW0GSjwE.js")
513
- ), Ve = h(() => import("./EmailWidget-Nyc76pT8.js")), $e = h(
514
- () => import("./GeocoderWidget-Ib15NJcx.js")
512
+ () => import("./DropdownWidget-CxWQF6r3.js")
513
+ ), Ve = h(() => import("./EmailWidget-BxxtgUGU.js")), $e = h(
514
+ () => import("./GeocoderWidget-lh46EUHn.js")
515
515
  ), Pe = h(
516
- () => import("./MultiGeocoderWidget-BuW8i48_.js")
517
- ), ze = h(() => import("./PhoneWidget-COo3SBNU.js")), Be = h(() => import("./RadioWidget-C8syq1dO.js")), He = h(
518
- () => import("./RichTextWidget-B5qxi5OE.js")
519
- ), Ue = h(() => import("./SwitchWidget-C-p7lICr.js")), Ee = h(
520
- () => import("./TextareaWidget-D0TbFUjX.js")
516
+ () => import("./MultiGeocoderWidget-C84ZYxpR.js")
517
+ ), ze = h(() => import("./PhoneWidget-_-cBcZ_D.js")), Be = h(() => import("./RadioWidget-BJ1qwTRO.js")), Ee = h(
518
+ () => import("./RichTextWidget-CC6uShje.js")
519
+ ), He = h(() => import("./SwitchWidget-CbCYweyx.js")), Ue = h(
520
+ () => import("./TextareaWidget-Dqt4CVV-.js")
521
521
  ), qe = h(
522
- () => import("./ToggleCheckboxWidget-BbVq_dAC.js")
523
- ), Oe = h(() => import("./URLWidget-00u8Svwt.js")), I = h(() => import("./UploadWidget-Dim2TEFc.js")), Fe = ({
522
+ () => import("./ToggleCheckboxWidget-D8CxllEX.js")
523
+ ), Fe = h(() => import("./URLWidget-C07DCMOd.js")), R = h(() => import("./UploadWidget-DoY_CPLy.js")), Oe = ({
524
524
  field: e,
525
525
  isInternal: r
526
526
  }) => {
@@ -530,17 +530,17 @@ const L = ({
530
530
  return null;
531
531
  switch (t) {
532
532
  case a.TextWidget:
533
- return /* @__PURE__ */ s.jsx(U, { field: e });
533
+ return /* @__PURE__ */ s.jsx(H, { field: e });
534
534
  case a.NumberWidget:
535
- return /* @__PURE__ */ s.jsx(U, { type: "number", field: e });
535
+ return /* @__PURE__ */ s.jsx(H, { type: "number", field: e });
536
536
  case a.CurrencyWidget:
537
- return /* @__PURE__ */ s.jsx(Me, { field: e });
537
+ return /* @__PURE__ */ s.jsx(De, { field: e });
538
538
  case a.CheckboxWidget:
539
539
  return /* @__PURE__ */ s.jsx(Se, { field: e });
540
540
  case a.DateTimeWidget:
541
- return /* @__PURE__ */ s.jsx(E, { field: e, enableTime: !0 });
541
+ return /* @__PURE__ */ s.jsx(U, { field: e });
542
542
  case a.DateWidget:
543
- return /* @__PURE__ */ s.jsx(E, { field: e, enableTime: !1 });
543
+ return /* @__PURE__ */ s.jsx(U, { field: e });
544
544
  case a.DropdownWidget:
545
545
  return /* @__PURE__ */ s.jsx(q, { field: e, isMulti: !1 });
546
546
  case a.MultiDropdownWidget:
@@ -556,18 +556,18 @@ const L = ({
556
556
  case a.RadioWidget:
557
557
  return /* @__PURE__ */ s.jsx(Be, { field: e });
558
558
  case a.RichTextWidget:
559
- return /* @__PURE__ */ s.jsx(He, { field: e });
559
+ return /* @__PURE__ */ s.jsx(Ee, { field: e });
560
560
  case a.SwitchWidget:
561
- return /* @__PURE__ */ s.jsx(Ue, { field: e });
561
+ return /* @__PURE__ */ s.jsx(He, { field: e });
562
562
  case a.TextareaWidget:
563
- return /* @__PURE__ */ s.jsx(Ee, { field: e });
563
+ return /* @__PURE__ */ s.jsx(Ue, { field: e });
564
564
  case a.ToggleCheckboxWidget:
565
565
  return /* @__PURE__ */ s.jsx(qe, { field: e });
566
566
  case a.URLWidget:
567
- return /* @__PURE__ */ s.jsx(Oe, { field: e });
567
+ return /* @__PURE__ */ s.jsx(Fe, { field: e });
568
568
  case a.ImageUploadWidget:
569
569
  return /* @__PURE__ */ s.jsx(
570
- I,
570
+ R,
571
571
  {
572
572
  field: e,
573
573
  isMultiple: !1,
@@ -577,7 +577,7 @@ const L = ({
577
577
  );
578
578
  case a.MultiImageUploadWidget:
579
579
  return /* @__PURE__ */ s.jsx(
580
- I,
580
+ R,
581
581
  {
582
582
  field: e,
583
583
  isMultiple: !0,
@@ -587,16 +587,30 @@ const L = ({
587
587
  );
588
588
  case a.FileUploadWidget:
589
589
  return /* @__PURE__ */ s.jsx(
590
- I,
590
+ R,
591
591
  {
592
592
  field: e,
593
593
  isMultiple: !1,
594
- kind: ["document"],
594
+ kind: ["audio", "video", "image", "document"],
595
+ isExternal: !r
596
+ }
597
+ );
598
+ case a.MultiFileUploadWidget:
599
+ return /* @__PURE__ */ s.jsx(
600
+ R,
601
+ {
602
+ field: e,
603
+ isMultiple: !0,
604
+ kind: ["audio", "video", "image", "document"],
595
605
  isExternal: !r
596
606
  }
597
607
  );
598
608
  case a.CollectionWidget:
599
- return !((i = e == null ? void 0 : e.options) != null && i.collection_key) || !((d = e == null ? void 0 : e.options) != null && d.label_field_key) || (o = e == null ? void 0 : e.options) != null && o.connected_have_many_current && ((c = e == null ? void 0 : e.options) != null && c.current_have_many_connected) ? null : /* @__PURE__ */ s.jsx(De, { field: e });
609
+ return !((i = e == null ? void 0 : e.options) != null && i.collection_key) || !((d = e == null ? void 0 : e.options) != null && d.label_field_key) ? (console.error(
610
+ "[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."
611
+ ), null) : (o = e == null ? void 0 : e.options) != null && o.connected_have_many_current && ((c = e == null ? void 0 : e.options) != null && c.current_have_many_connected) ? (console.error(
612
+ "[LevoCollection]: Error while rendering collection widget. Field options not set correctly."
613
+ ), null) : /* @__PURE__ */ s.jsx(Me, { field: e });
600
614
  default:
601
615
  return null;
602
616
  }
@@ -606,7 +620,7 @@ const L = ({
606
620
  }) => {
607
621
  const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e;
608
622
  return !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "w-full", children: [
609
- /* @__PURE__ */ s.jsx(L, { className: "text-md font-medium mb-4", children: n }),
623
+ /* @__PURE__ */ s.jsx(A, { className: "text-md font-medium mb-4", children: n }),
610
624
  /* @__PURE__ */ s.jsx("div", { className: "border rounded bg-secondary/40 flex flex-col px-3 py-4 gap-3", children: d.map((o) => {
611
625
  const c = {
612
626
  ...o,
@@ -632,7 +646,7 @@ const L = ({
632
646
  case a.RecordWidget:
633
647
  return /* @__PURE__ */ s.jsx(Ge, { ...e });
634
648
  default:
635
- return /* @__PURE__ */ s.jsx(Fe, { ...e });
649
+ return /* @__PURE__ */ s.jsx(Oe, { ...e });
636
650
  }
637
651
  }, Q = j.createContext({
638
652
  schema: null,
@@ -653,10 +667,10 @@ const L = ({
653
667
  /* @__PURE__ */ s.jsx("div", { ref: i }),
654
668
  e
655
669
  ] });
656
- }, Wt = () => j.useContext(Q), Je = j.lazy(
657
- () => import("./DefaultFormVariant-BzHB74Ie.js")
670
+ }, bt = () => j.useContext(Q), Je = j.lazy(
671
+ () => import("./DefaultFormVariant-DyyCGXvB.js")
658
672
  ), Qe = j.lazy(
659
- () => import("./StepsFormVariant-NSTSIoVV.js")
673
+ () => import("./StepsFormVariant-BxANsU4Z.js")
660
674
  ), Xe = ({
661
675
  formVariant: e,
662
676
  ...r
@@ -672,7 +686,7 @@ const L = ({
672
686
  ),
673
687
  children: [
674
688
  "Create new ",
675
- We.singularize((t == null ? void 0 : t.name) || "")
689
+ be.singularize((t == null ? void 0 : t.name) || "")
676
690
  ]
677
691
  }
678
692
  ),
@@ -683,7 +697,7 @@ const L = ({
683
697
  hiddenFields: r,
684
698
  ...t
685
699
  }) => {
686
- const { collection: n } = G(), [i, d] = R(!0), [o, c] = R(null);
700
+ const { collection: n } = G(), [i, d] = L(!0), [o, c] = L(null);
687
701
  return pe(() => {
688
702
  e ? n == null || n.getCollectionByIDExpanded(e, {
689
703
  headers: {
@@ -695,8 +709,8 @@ const L = ({
695
709
  if (g)
696
710
  g.sections = (l = g == null ? void 0 : g.sections) == null ? void 0 : l.map(
697
711
  (p) => {
698
- var W;
699
- return p.fields = (W = p == null ? void 0 : p.fields) == null ? void 0 : W.map((b) => (r != null && r.includes(b == null ? void 0 : b.key) && (b.hidden = !0), b)), p;
712
+ var b;
713
+ return p.fields = (b = p == null ? void 0 : p.fields) == null ? void 0 : b.map((W) => (r != null && r.includes(W == null ? void 0 : W.key) && (W.hidden = !0), W)), p;
700
714
  }
701
715
  ), c(g);
702
716
  else
@@ -713,7 +727,7 @@ const L = ({
713
727
  export {
714
728
  jt as C,
715
729
  J as F,
716
- bt as H,
730
+ Wt as H,
717
731
  K as a,
718
732
  ht as b,
719
733
  B as c,
@@ -723,10 +737,10 @@ export {
723
737
  C as g,
724
738
  Re as h,
725
739
  we as i,
726
- Ae as j,
727
- L as k,
740
+ Ie as j,
741
+ A as k,
728
742
  _e as l,
729
- Wt as m,
743
+ bt as m,
730
744
  z as p,
731
745
  yt as s,
732
746
  xt as u,
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useController as j } from "react-hook-form";
3
3
  import { NumericFormat as F } from "react-number-format";
4
- import { h as w, j as C, k } from "./CollectionFormBuilder-a0pzMkWL.js";
4
+ import { h as w, j as C, k } from "./CollectionFormBuilder-uvr15jvu.js";
5
5
  import { c as N } from "./cn-C9QoOYNG.js";
6
6
  const V = ({
7
7
  field: r,
@@ -0,0 +1,80 @@
1
+ import { j as r } from "./jsx-runtime-B6kdoens.js";
2
+ import { Calendar as b, X as w } from "lucide-react";
3
+ import * as l from "react-datepicker";
4
+ import { FieldInterfaces as N } from "@levo-so/core";
5
+ import { useController as v } from "react-hook-form";
6
+ import { h as M, j as D, k as C } from "./CollectionFormBuilder-uvr15jvu.js";
7
+ import { I as F } from "./Input-2CvZ90f8.js";
8
+ import { c as p } from "./cn-C9QoOYNG.js";
9
+ const T = l.default.default || l.default || l, I = (e) => {
10
+ if (e) {
11
+ const o = new Date(e);
12
+ return Number.isNaN(o.getTime()) ? null : o;
13
+ }
14
+ return null;
15
+ }, B = ({ field: e }) => {
16
+ var d;
17
+ const { key: o = "", label: m = "", helper_text: f = "", readonly: x = !1 } = e, n = o, {
18
+ field: { value: i, onBlur: u, onChange: s, ref: h, ...j },
19
+ fieldState: a
20
+ } = v({
21
+ name: n,
22
+ rules: M(e)
23
+ }), y = !!(e != null && e.required), g = (d = a == null ? void 0 : a.error) == null ? void 0 : d.message, c = (e == null ? void 0 : e.field_interface) === N.DateTimeWidget;
24
+ return /* @__PURE__ */ r.jsxs(D, { helperText: f, readOnly: x, error: g, children: [
25
+ m && /* @__PURE__ */ r.jsx(C, { htmlFor: n, isRequired: y, children: m }),
26
+ /* @__PURE__ */ r.jsxs("div", { className: "w-full relative rounded-md", children: [
27
+ /* @__PURE__ */ r.jsx(
28
+ "div",
29
+ {
30
+ className: p(
31
+ "absolute left-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-l-md overflow-hidden pointer-events-none"
32
+ ),
33
+ children: /* @__PURE__ */ r.jsx(b, { size: "20px", className: "text-muted-foreground" })
34
+ }
35
+ ),
36
+ /* @__PURE__ */ r.jsx(
37
+ T,
38
+ {
39
+ id: n,
40
+ selected: I(i),
41
+ onChange: (t) => {
42
+ s && s((t == null ? void 0 : t.toISOString()) || null);
43
+ },
44
+ onBlur: () => {
45
+ u && u();
46
+ },
47
+ className: "w-full pl-8",
48
+ showTimeSelect: c,
49
+ customInput: /* @__PURE__ */ r.jsx(F, { ref: h }),
50
+ autoComplete: "off",
51
+ dateFormat: c ? "d MMMM, yyyy h:mm aa" : "d MMMM, yyyy",
52
+ popperPlacement: "bottom-start",
53
+ showPopperArrow: !1,
54
+ ...j
55
+ }
56
+ ),
57
+ i && /* @__PURE__ */ r.jsx(
58
+ "div",
59
+ {
60
+ className: p(
61
+ "absolute right-0 top-0 bottom-0 w-9 z-10 flex items-center justify-center rounded-l-md overflow-hidden"
62
+ ),
63
+ children: /* @__PURE__ */ r.jsx(
64
+ "button",
65
+ {
66
+ type: "button",
67
+ onClick: (t) => {
68
+ t == null || t.preventDefault(), t == null || t.stopPropagation(), s && s(null);
69
+ },
70
+ children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" })
71
+ }
72
+ )
73
+ }
74
+ )
75
+ ] })
76
+ ] });
77
+ };
78
+ export {
79
+ B as default
80
+ };
@@ -1,7 +1,7 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
2
  import { FormProvider as S } from "react-hook-form";
3
- import { m as b, F as y } from "./CollectionFormBuilder-a0pzMkWL.js";
4
- import { u as F, S as N } from "./useLevoForm-CR3q-L5Z.js";
3
+ import { m as b, F as y } from "./CollectionFormBuilder-uvr15jvu.js";
4
+ import { u as F, S as N } from "./useLevoForm-B4Dmf73H.js";
5
5
  import { c as m } from "./cn-C9QoOYNG.js";
6
6
  import { B as g } from "./Spinner-CuUosd-S.js";
7
7
  const E = () => {
@@ -3,7 +3,7 @@ import { j as i } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useState as f, useEffect as j } from "react";
4
4
  import { useController as k } from "react-hook-form";
5
5
  import D from "react-select";
6
- import { h as N, j as q, k as B } from "./CollectionFormBuilder-a0pzMkWL.js";
6
+ import { h as N, j as q, k as B } from "./CollectionFormBuilder-uvr15jvu.js";
7
7
  import { I as L } from "./Input-2CvZ90f8.js";
8
8
  import { c as x } from "./cn-C9QoOYNG.js";
9
9
  const G = ({
@@ -0,0 +1,41 @@
1
+ import { j as r } from "./jsx-runtime-B6kdoens.js";
2
+ import { useController as y } from "react-hook-form";
3
+ import { G as C } from "./Spinner-CuUosd-S.js";
4
+ import { h as F, j as I, k as V } from "./CollectionFormBuilder-uvr15jvu.js";
5
+ import { I as b } from "./Input-2CvZ90f8.js";
6
+ function w(e) {
7
+ return C({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M1.75 3h20.5c.966 0 1.75.784 1.75 1.75v14a1.75 1.75 0 0 1-1.75 1.75H1.75A1.75 1.75 0 0 1 0 18.75v-14C0 3.784.784 3 1.75 3ZM1.5 7.412V18.75c0 .138.112.25.25.25h20.5a.25.25 0 0 0 .25-.25V7.412l-9.52 6.433c-.592.4-1.368.4-1.96 0Zm0-2.662v.852l10.36 7a.25.25 0 0 0 .28 0l10.36-7V4.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z" }, child: [] }] })(e);
8
+ }
9
+ const k = ({ field: e, ...c }) => {
10
+ var l;
11
+ const { key: u = "", label: s = "", helper_text: d = "", readonly: h = !1 } = e, t = u, {
12
+ field: { value: p, onBlur: x, onChange: g, ...f },
13
+ fieldState: a
14
+ } = y({
15
+ name: t,
16
+ rules: F(e)
17
+ }), j = !!(e != null && e.required), v = (l = a == null ? void 0 : a.error) == null ? void 0 : l.message;
18
+ return /* @__PURE__ */ r.jsxs(I, { error: v, helperText: d, children: [
19
+ s && /* @__PURE__ */ r.jsx(V, { htmlFor: t, isRequired: j, children: s }),
20
+ /* @__PURE__ */ r.jsx(
21
+ b,
22
+ {
23
+ id: t,
24
+ type: "email",
25
+ leftIcon: /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-center justify-center bg-muted", children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" }) }),
26
+ value: p || "",
27
+ onChange: (o) => {
28
+ var n, i, m;
29
+ return g((m = (i = (n = o == null ? void 0 : o.target) == null ? void 0 : n.value) == null ? void 0 : i.trim()) == null ? void 0 : m.toLocaleLowerCase());
30
+ },
31
+ onBlur: x,
32
+ readOnly: h,
33
+ ...f,
34
+ ...c
35
+ }
36
+ )
37
+ ] });
38
+ };
39
+ export {
40
+ k as default
41
+ };
@@ -3,7 +3,7 @@ import { j as h } from "./jsx-runtime-B6kdoens.js";
3
3
  import le, { useState as J, useEffect as fe } from "react";
4
4
  import { useController as de } from "react-hook-form";
5
5
  import { q as pe } from "./Spinner-CuUosd-S.js";
6
- import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-a0pzMkWL.js";
6
+ import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-uvr15jvu.js";
7
7
  import { I as _e } from "./Input-2CvZ90f8.js";
8
8
  var U = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ne = {}, ve = "Expected a function", Y = NaN, be = "[object Symbol]", Se = /^\s+|\s+$/g, Pe = /^[-+]0x[0-9a-f]+$/i, Oe = /^0b[01]+$/i, he = /^0o[0-7]+$/i, Te = parseInt, je = typeof U == "object" && U && U.Object === Object && U, xe = typeof self == "object" && self && self.Object === Object && self, Ae = je || xe || Function("return this")(), Le = Object.prototype, Ee = Le.toString, we = Math.max, Ie = Math.min, $ = function() {
9
9
  return Ae.Date.now();
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { j as e } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useFieldArray as m } from "react-hook-form";
4
- import { k as n } from "./CollectionFormBuilder-a0pzMkWL.js";
4
+ import { k as n } from "./CollectionFormBuilder-uvr15jvu.js";
5
5
  import { Plus as c } from "lucide-react";
6
- import { GeocoderWidget as d } from "./GeocoderWidget-Ib15NJcx.js";
6
+ import { GeocoderWidget as d } from "./GeocoderWidget-lh46EUHn.js";
7
7
  import { B as p } from "./Spinner-CuUosd-S.js";
8
8
  const g = ({
9
9
  field: l