@levo-so/react 0.1.14 → 0.1.15

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 (73) hide show
  1. package/dist/CheckboxWidget-BGS61gcL.js +124 -0
  2. package/dist/CollectionFormBuilder-BIvx_z08.js +1197 -0
  3. package/dist/{CurrencyWidget-COoMkfsA.js → CurrencyWidget-sD8ijLvw.js} +5 -5
  4. package/dist/{DateTimeWidget-DcbQ3smI.js → DateTimeWidget-KrcsxgEF.js} +3 -3
  5. package/dist/DefaultFormVariant-j1HgVDiI.js +127 -0
  6. package/dist/DropdownWidget-rm5oUqOE.js +113 -0
  7. package/dist/{EmailWidget-CG9oNUM5.js → EmailWidget-CvZKOywL.js} +11 -11
  8. package/dist/GeocoderWidget-CSsp_-hW.js +68 -0
  9. package/dist/{LevoProvider-BI6g_T4E.js → LevoProvider-Do3jjJ4j.js} +0 -1
  10. package/dist/{MultiGeocoderWidget-D3Xmv8g4.js → MultiGeocoderWidget-Blqz-lHX.js} +6 -6
  11. package/dist/{MultiTextWidget-CyQRcWC8.js → MultiTextWidget-CxVpyf06.js} +14 -14
  12. package/dist/{PhoneWidget-C1Jt7kXL.js → PhoneWidget-DezcchSP.js} +5 -5
  13. package/dist/{RadioWidget-BrLNF-I2.js → RadioWidget-SfD1fFDG.js} +9 -9
  14. package/dist/{RichTextWidget-BogYcPtS.js → RichTextWidget-Cg3RizdO.js} +21 -21
  15. package/dist/Spinner-Bzu2xCFZ.js +405 -0
  16. package/dist/{StepsFormVariant-Bx-jdciC.js → StepsFormVariant-D35dFYK6.js} +9 -9
  17. package/dist/{SwitchWidget-BT0-waP9.js → SwitchWidget-Id6BNlPe.js} +5 -5
  18. package/dist/{TextWidget-Bvsz-hey.js → TextWidget-CtFaQde1.js} +7 -7
  19. package/dist/{TextareaWidget-8SLym--T.js → TextareaWidget-BKzAeMod.js} +3 -3
  20. package/dist/{ToggleCheckboxWidget-VrCQBF5C.js → ToggleCheckboxWidget-nSlie9sE.js} +7 -7
  21. package/dist/Tooltip-DEBnSqlo.js +36 -0
  22. package/dist/{URLWidget-B99nKr6N.js → URLWidget-DtJai3xY.js} +2 -2
  23. package/dist/UploadWidget-Dxx2_FYo.js +616 -0
  24. package/dist/audience/components/page.d.ts.map +1 -1
  25. package/dist/audience/index.js +1 -1
  26. package/dist/collection/components/Altcha.d.ts +10 -0
  27. package/dist/collection/components/Altcha.d.ts.map +1 -0
  28. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
  29. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +1 -1
  30. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
  31. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +7 -0
  32. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -0
  33. package/dist/collection/components/widgets/collectionWidget/{CollectionWidget.d.ts → CollectionWidgetM2O.d.ts} +1 -1
  34. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +1 -0
  35. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +8 -0
  36. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -0
  37. package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
  38. package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -1
  39. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +11 -0
  40. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -0
  41. package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
  42. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
  43. package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
  44. package/dist/collection/index.js +13 -12
  45. package/dist/collection/lib/hooks/useLevoForm.d.ts +2 -1
  46. package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
  47. package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
  48. package/dist/collection/utils/formHelpers.d.ts.map +1 -1
  49. package/dist/collection/utils/index.d.ts +2 -0
  50. package/dist/collection/utils/index.d.ts.map +1 -1
  51. package/dist/components/Table.d.ts +11 -0
  52. package/dist/components/Table.d.ts.map +1 -0
  53. package/dist/components/index.js +29 -29
  54. package/dist/constants/fileUploadPresets.d.ts +4 -2
  55. package/dist/constants/fileUploadPresets.d.ts.map +1 -1
  56. package/dist/index.css +1 -1
  57. package/dist/index.js +75 -75
  58. package/dist/membership/index.js +1 -1
  59. package/dist/page-DgqTELmZ.js +212 -0
  60. package/dist/useLevoForm-3jSJ9I6v.js +170 -0
  61. package/package.json +8 -7
  62. package/dist/CheckboxWidget-BctVOZiO.js +0 -118
  63. package/dist/CollectionFormBuilder-B6CAVKhg.js +0 -772
  64. package/dist/DefaultFormVariant-C6zbKgwB.js +0 -80
  65. package/dist/DropdownWidget-DszCTSWr.js +0 -115
  66. package/dist/GeocoderWidget-CXu17A7y.js +0 -310
  67. package/dist/Spinner-DzGH5rKe.js +0 -297
  68. package/dist/Tooltip-CI4i4mYr.js +0 -144
  69. package/dist/UploadWidget-ZebPWZZZ.js +0 -505
  70. package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +0 -1
  71. package/dist/fileUploadPresets-2raQmHT0.js +0 -74
  72. package/dist/page-yeiAPg3O.js +0 -200
  73. package/dist/useLevoForm-DjvUas25.js +0 -166
@@ -0,0 +1,124 @@
1
+ "use client";
2
+ import { j as a } from "./jsx-runtime-B6kdoens.js";
3
+ import { useState as w, useEffect as B } from "react";
4
+ import { useController as E } from "react-hook-form";
5
+ import { c as C } from "./cn-C9QoOYNG.js";
6
+ import { z as O, A as I, B as x } from "./CollectionFormBuilder-BIvx_z08.js";
7
+ import { C as g } from "./Checbox-sq-atGlJ.js";
8
+ import { I as S } from "./Input-2CvZ90f8.js";
9
+ const L = ({ field: i }) => {
10
+ const [o, p] = w(""), [j, m] = w(!1), {
11
+ key: k = "",
12
+ label: b = "",
13
+ helper_text: F = "",
14
+ readonly: y = !1,
15
+ values: n = [],
16
+ options: f = {}
17
+ } = i, {
18
+ field: { name: t, onBlur: d, onChange: l, value: s, ref: N, disabled: u },
19
+ fieldState: { error: h }
20
+ } = E({
21
+ name: k,
22
+ rules: O(i)
23
+ }), A = (r) => {
24
+ let e = Array.isArray(s || null) ? [...s] : [];
25
+ e.includes(r) ? e = e == null ? void 0 : e.filter((c) => c !== r) : e.push(r), l(e);
26
+ }, $ = !!(f != null && f.custom_input);
27
+ return B(() => {
28
+ if ($) {
29
+ let r = !1;
30
+ (s ?? []).forEach((e) => {
31
+ n.includes(e) || (r = !0, p(e));
32
+ }), m(!!r);
33
+ }
34
+ }, [s, n]), /* @__PURE__ */ a.jsxs(
35
+ I,
36
+ {
37
+ error: h == null ? void 0 : h.message,
38
+ helperText: F,
39
+ readOnly: y,
40
+ ref: N,
41
+ children: [
42
+ b && /* @__PURE__ */ a.jsx(x, { htmlFor: t, isRequired: i == null ? void 0 : i.required, children: b }),
43
+ /* @__PURE__ */ a.jsx(
44
+ "div",
45
+ {
46
+ className: C(
47
+ "w-full flex gap-4 flex-col flex-wrap pt-1",
48
+ y && "pointer-events-none cursor-not-allowed"
49
+ ),
50
+ children: n == null ? void 0 : n.map((r, e) => /* @__PURE__ */ a.jsxs(
51
+ "div",
52
+ {
53
+ className: "w-full flex gap-2 items-start flex-nowrap",
54
+ children: [
55
+ /* @__PURE__ */ a.jsx(
56
+ g,
57
+ {
58
+ id: `${r}-${e}`,
59
+ name: t,
60
+ checked: s == null ? void 0 : s.includes(r),
61
+ onCheckedChange: () => A(r),
62
+ onBlur: () => {
63
+ d();
64
+ },
65
+ disabled: u
66
+ }
67
+ ),
68
+ /* @__PURE__ */ a.jsx(x, { htmlFor: `${r}-${e}`, className: "!mb-0", children: r })
69
+ ]
70
+ },
71
+ `${r}-${e}`
72
+ ))
73
+ }
74
+ ),
75
+ $ && /* @__PURE__ */ a.jsxs("div", { className: "flex w-full items-center my-4 gap-2 flex-wrap", children: [
76
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2 flex-nowrap shrink-0", children: [
77
+ /* @__PURE__ */ a.jsx(
78
+ g,
79
+ {
80
+ name: `${t}-other`,
81
+ id: `${t}-other`,
82
+ disabled: u,
83
+ checked: j,
84
+ onCheckedChange: (r) => {
85
+ var e;
86
+ m(!!r), r ? Array.isArray(s) ? l == null || l([...s, o]) : l == null || l([o]) : l == null || l(
87
+ (e = s ?? []) == null ? void 0 : e.filter((c) => c !== o)
88
+ );
89
+ },
90
+ onBlur: () => {
91
+ d && d();
92
+ }
93
+ }
94
+ ),
95
+ /* @__PURE__ */ a.jsxs(x, { htmlFor: `${t}-other`, className: "!mb-0", children: [
96
+ "Other:",
97
+ " "
98
+ ] })
99
+ ] }),
100
+ /* @__PURE__ */ a.jsx(
101
+ S,
102
+ {
103
+ name: `other-checkbox-${t}`,
104
+ containerStyles: "max-w-[300px] ml-3",
105
+ value: o,
106
+ onChange: (r) => {
107
+ let e = 0;
108
+ l == null || l(
109
+ s == null ? void 0 : s.map((c) => c === o && !e ? (e = 1, r.target.value) : c)
110
+ ), p(r.target.value);
111
+ },
112
+ disabled: !j || u,
113
+ placeholder: "Please specify"
114
+ }
115
+ )
116
+ ] })
117
+ ]
118
+ }
119
+ );
120
+ };
121
+ export {
122
+ L as CheckboxWidget,
123
+ L as default
124
+ };