@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,212 @@
1
+ "use client";
2
+ import { j as R } from "./jsx-runtime-B6kdoens.js";
3
+ import { useEffect as m, useState as S } from "react";
4
+ import { useInView as C } from "react-intersection-observer";
5
+ import { u as O } from "./LevoProvider-Do3jjJ4j.js";
6
+ import { usePageLifecycle as H, LifecycleState as I } from "use-page-lifecycle";
7
+ const wt = ({ id: t, properties: r = {} }) => {
8
+ const { audience: e } = O(), { ref: n, inView: s } = C({
9
+ triggerOnce: !0
10
+ });
11
+ return m(() => {
12
+ e != null && e.instance && s && (e == null || e.track("block.view", {
13
+ ...r,
14
+ resource: "block",
15
+ identifier: t
16
+ }));
17
+ }, [s]), /* @__PURE__ */ R.jsx("div", { ref: n, style: { height: "0px" } });
18
+ }, Tt = ({ event: t, properties: r }) => {
19
+ const { audience: e } = O();
20
+ return m(() => {
21
+ e != null && e.instance && (e == null || e.track(t, r));
22
+ }, [e == null ? void 0 : e.instance, t, r]), null;
23
+ };
24
+ function k(t) {
25
+ var r = typeof t;
26
+ return t != null && (r == "object" || r == "function");
27
+ }
28
+ var F = typeof global == "object" && global && global.Object === Object && global, _ = typeof self == "object" && self && self.Object === Object && self, W = F || _ || Function("return this")(), j = function() {
29
+ return W.Date.now();
30
+ }, G = /\s/;
31
+ function V(t) {
32
+ for (var r = t.length; r-- && G.test(t.charAt(r)); )
33
+ ;
34
+ return r;
35
+ }
36
+ var z = /^\s+/;
37
+ function X(t) {
38
+ return t && t.slice(0, V(t) + 1).replace(z, "");
39
+ }
40
+ var y = W.Symbol, A = Object.prototype, Y = A.hasOwnProperty, Z = A.toString, b = y ? y.toStringTag : void 0;
41
+ function q(t) {
42
+ var r = Y.call(t, b), e = t[b];
43
+ try {
44
+ t[b] = void 0;
45
+ var n = !0;
46
+ } catch {
47
+ }
48
+ var s = Z.call(t);
49
+ return n && (r ? t[b] = e : delete t[b]), s;
50
+ }
51
+ var J = Object.prototype, K = J.toString;
52
+ function Q(t) {
53
+ return K.call(t);
54
+ }
55
+ var tt = "[object Null]", et = "[object Undefined]", P = y ? y.toStringTag : void 0;
56
+ function nt(t) {
57
+ return t == null ? t === void 0 ? et : tt : P && P in Object(t) ? q(t) : Q(t);
58
+ }
59
+ function rt(t) {
60
+ return t != null && typeof t == "object";
61
+ }
62
+ var it = "[object Symbol]";
63
+ function ot(t) {
64
+ return typeof t == "symbol" || rt(t) && nt(t) == it;
65
+ }
66
+ var U = NaN, st = /^[-+]0x[0-9a-f]+$/i, at = /^0b[01]+$/i, ct = /^0o[0-7]+$/i, ft = parseInt;
67
+ function $(t) {
68
+ if (typeof t == "number")
69
+ return t;
70
+ if (ot(t))
71
+ return U;
72
+ if (k(t)) {
73
+ var r = typeof t.valueOf == "function" ? t.valueOf() : t;
74
+ t = k(r) ? r + "" : r;
75
+ }
76
+ if (typeof t != "string")
77
+ return t === 0 ? t : +t;
78
+ t = X(t);
79
+ var e = at.test(t);
80
+ return e || ct.test(t) ? ft(t.slice(2), e ? 2 : 8) : st.test(t) ? U : +t;
81
+ }
82
+ var lt = "Expected a function", ut = Math.max, gt = Math.min;
83
+ function dt(t, r, e) {
84
+ var n, s, c, l, i, a, f = 0, h = !1, u = !1, g = !0;
85
+ if (typeof t != "function")
86
+ throw new TypeError(lt);
87
+ r = $(r) || 0, k(e) && (h = !!e.leading, u = "maxWait" in e, c = u ? ut($(e.maxWait) || 0, r) : c, g = "trailing" in e ? !!e.trailing : g);
88
+ function w(o) {
89
+ var d = n, p = s;
90
+ return n = s = void 0, f = o, l = t.apply(p, d), l;
91
+ }
92
+ function D(o) {
93
+ return f = o, i = setTimeout(v, r), h ? w(o) : l;
94
+ }
95
+ function N(o) {
96
+ var d = o - a, p = o - f, L = r - d;
97
+ return u ? gt(L, c - p) : L;
98
+ }
99
+ function x(o) {
100
+ var d = o - a, p = o - f;
101
+ return a === void 0 || d >= r || d < 0 || u && p >= c;
102
+ }
103
+ function v() {
104
+ var o = j();
105
+ if (x(o))
106
+ return E(o);
107
+ i = setTimeout(v, N(o));
108
+ }
109
+ function E(o) {
110
+ return i = void 0, g && n ? w(o) : (n = s = void 0, l);
111
+ }
112
+ function M() {
113
+ i !== void 0 && clearTimeout(i), f = 0, n = a = s = i = void 0;
114
+ }
115
+ function B() {
116
+ return i === void 0 ? l : E(j());
117
+ }
118
+ function T() {
119
+ var o = j(), d = x(o);
120
+ if (n = arguments, s = this, a = o, d) {
121
+ if (i === void 0)
122
+ return D(a);
123
+ if (u)
124
+ return clearTimeout(i), i = setTimeout(v, r), w(a);
125
+ }
126
+ return i === void 0 && (i = setTimeout(v, r)), l;
127
+ }
128
+ return T.cancel = M, T.flush = B, T;
129
+ }
130
+ const mt = () => {
131
+ const [t, r] = S(0), [e, n] = S(0), s = dt((c) => {
132
+ n(c), r(c);
133
+ }, 250);
134
+ return m(() => {
135
+ const c = () => {
136
+ const l = window.scrollY, i = document.documentElement.scrollHeight, a = window.innerHeight, f = Math.round(
137
+ l / (i - a) * 100
138
+ );
139
+ f % 10 === 0 && f > e && s(f);
140
+ };
141
+ return window.addEventListener("scroll", c), () => window.removeEventListener("scroll", c);
142
+ }, [e]), t;
143
+ }, jt = ({ id: t, properties: r = {} }) => {
144
+ var h;
145
+ const { client: e, audience: n } = O(), [s, c] = S(), l = mt(), i = typeof window < "u" ? window.location.href : void 0;
146
+ m(() => {
147
+ i && c(i);
148
+ }, [i]), m(() => {
149
+ n != null && n.instance && (n == null || n.track("page.scroll", {
150
+ resource: "page",
151
+ identifier: t,
152
+ percent: l
153
+ }));
154
+ }, [n == null ? void 0 : n.instance, l]), m(() => {
155
+ const u = () => {
156
+ n == null || n.track("page.bounce", {
157
+ resource: "page",
158
+ identifier: t
159
+ });
160
+ };
161
+ return window && window.addEventListener("beforeunload", u), () => {
162
+ window && window.removeEventListener("beforeunload", u);
163
+ };
164
+ }, [i]);
165
+ const [a] = H();
166
+ if (m(() => {
167
+ a === I.TERMINATED && (n == null || n.track("page.bounce", {
168
+ resource: "page",
169
+ identifier: t,
170
+ state: a
171
+ })), a === I.FROZEN && (n == null || n.track("page.bounce", {
172
+ resource: "page",
173
+ identifier: t,
174
+ state: a
175
+ }));
176
+ }, [a]), !(e != null && e.insightsUrl) || !e.workspace || !e.workspace.startsWith("W"))
177
+ return console.error(
178
+ "[@levo-so/audience] The utility could not be initialized, due to missing workspace, or endpoint for insights."
179
+ ), null;
180
+ let f = "";
181
+ try {
182
+ const u = (h = e == null ? void 0 : e.insightsUrl) != null && h.startsWith("/") ? `${window.location.origin}${e.insightsUrl}` : "", g = new URL(
183
+ `${u}/v1/insights/event/hello.gif` || "http://localhost/v1/insights/event/hello.gif"
184
+ );
185
+ g.searchParams.set("workspace", e.workspace), s && (g.searchParams.set("url", s), g.searchParams.set("location", btoa(s))), typeof document < "u" && g.searchParams.set("page_title", document.title), t && g.searchParams.set("identifier", t), f = g.toString();
186
+ } catch {
187
+ }
188
+ return e != null && e.insightsUrl && e.workspace && s ? /* @__PURE__ */ R.jsx(
189
+ "img",
190
+ {
191
+ alt: "",
192
+ src: f,
193
+ style: {
194
+ height: "0px"
195
+ },
196
+ onLoad: () => {
197
+ n != null && n.instance ? n == null || n.instance.page({
198
+ resource: "page",
199
+ identifier: r.id
200
+ }) : n == null || n.initiate({
201
+ ...r,
202
+ id: t
203
+ });
204
+ }
205
+ }
206
+ ) : null;
207
+ };
208
+ export {
209
+ wt as L,
210
+ Tt as a,
211
+ jt as b
212
+ };
@@ -0,0 +1,170 @@
1
+ "use client";
2
+ import { useEffect as L, useState as F, useRef as H } from "react";
3
+ import { useFormContext as W, useWatch as q, useForm as z } from "react-hook-form";
4
+ import { useDebouncedCallback as Q } from "use-debounce";
5
+ import { u as J } from "./LevoProvider-Do3jjJ4j.js";
6
+ import { D as N, c as M, s as X, h as Z } from "./CollectionFormBuilder-BIvx_z08.js";
7
+ import { s as m } from "./Sonner-t6JVKA0a.js";
8
+ import { e as U } from "./errorHandler-_34Yv8wA.js";
9
+ import { a as h } from "./isEmptyObject-C5s4GzLE.js";
10
+ const D = {
11
+ FORM_DIRTY: "form-dirty",
12
+ FORM_VALUES: "form-values"
13
+ }, tt = (t) => {
14
+ const s = localStorage.getItem(`${t}-${D.FORM_VALUES}`);
15
+ return s ? JSON.parse(s) : {};
16
+ }, rt = (t, s) => {
17
+ localStorage.setItem(
18
+ `${t}-${D.FORM_VALUES}`,
19
+ JSON.stringify(s)
20
+ );
21
+ }, j = (t) => {
22
+ localStorage.removeItem(`${t}-${D.FORM_VALUES}`);
23
+ }, nt = async ({
24
+ collection_key: t,
25
+ data: s
26
+ }) => {
27
+ const { client: g } = J(), r = await fetch(
28
+ `${g.apiUrl}/v1/bevy/content/${t}/save-entry`,
29
+ {
30
+ method: "POST",
31
+ body: JSON.stringify({ ...s }),
32
+ headers: {
33
+ "Content-Type": "application/json"
34
+ }
35
+ }
36
+ );
37
+ return r != null && r.ok ? await r.json() : null;
38
+ }, at = ({ currentValues: t, isError: s, getContentId: g }) => {
39
+ var _;
40
+ const { schema: r, isLoggedIn: d } = N(), a = W(), e = q(), E = Q((y) => {
41
+ r != null && r.key && !s && r != null && r.allow_draft && (d ? nt({
42
+ collection_key: r == null ? void 0 : r.key,
43
+ data: y
44
+ }).then((i) => {
45
+ var b, I, k, O;
46
+ (I = (b = i == null ? void 0 : i.content) == null ? void 0 : b.data) != null && I._id && g((O = (k = i == null ? void 0 : i.content) == null ? void 0 : k.data) == null ? void 0 : O._id);
47
+ }) : rt(r == null ? void 0 : r.key, y));
48
+ }, 2500);
49
+ return L(() => {
50
+ var y, i;
51
+ !s && d && (y = a == null ? void 0 : a.formState) != null && y.isDirty && ((i = Object == null ? void 0 : Object.keys(e || {})) == null ? void 0 : i.length) > 0 && E({
52
+ currentValues: t,
53
+ ...e
54
+ });
55
+ }, [(_ = a == null ? void 0 : a.formState) == null ? void 0 : _.isDirty, s, d, e]), null;
56
+ }, yt = ({
57
+ schema: t,
58
+ saveToRemote: s,
59
+ onSubmit: g,
60
+ onSubmitSuccess: r,
61
+ onSubmitError: d,
62
+ captchaValue: a
63
+ }) => {
64
+ const { collection: e } = J(), {
65
+ toastConfig: E,
66
+ onSuccess: _,
67
+ onError: y,
68
+ isLoggedIn: i,
69
+ isDisabled: b,
70
+ externalInitialValues: I = {},
71
+ isInternal: k
72
+ } = N(), [O, R] = F({}), [v, w] = F(null), [P, T] = F(!1), [K, $] = F(!1), n = H({}), Y = M(t), p = z({
73
+ mode: "all",
74
+ disabled: b,
75
+ defaultValues: Y,
76
+ values: O,
77
+ resetOptions: {
78
+ keepErrors: !0
79
+ }
80
+ }), B = p.handleSubmit(async (f) => {
81
+ var V, S, c, o, C, x;
82
+ if (!(!k && a !== "verified")) {
83
+ if (n.current = {
84
+ ...n.current || {},
85
+ ...f
86
+ }, s && e) {
87
+ if (t)
88
+ try {
89
+ const l = X(n == null ? void 0 : n.current, t);
90
+ let u = null;
91
+ if (v ? u = await (e == null ? void 0 : e.submitDraftEntry(t == null ? void 0 : t.key, l).catch((A) => (U(A), null))) : u = await (e == null ? void 0 : e.saveCollectionData({
92
+ collection_id: t == null ? void 0 : t.id,
93
+ data: l
94
+ }).catch((A) => (U(A), null))), (V = u == null ? void 0 : u.content) != null && V.data)
95
+ return E != null && E.showSuccessToast && m(
96
+ E.successToastText || "Form submitted successfully."
97
+ ), n.current = h(I) ? {} : { ...I }, j(t == null ? void 0 : t.key), w(null), _ && _({
98
+ schemaId: t == null ? void 0 : t.id,
99
+ response: (S = u == null ? void 0 : u.content) == null ? void 0 : S.data
100
+ }), !0;
101
+ throw new Error("Failed to save form details, API response invalid");
102
+ } catch (l) {
103
+ const u = (C = (o = (c = l == null ? void 0 : l.response) == null ? void 0 : c.data) == null ? void 0 : o.content) == null ? void 0 : C.errors;
104
+ return Z(u, p.setError), d && d(u), y && y(((x = l == null ? void 0 : l.response) == null ? void 0 : x.data) || l), !1;
105
+ }
106
+ return !1;
107
+ }
108
+ f && g && g(f);
109
+ }
110
+ }), G = (f) => {
111
+ f && f !== v && w(f);
112
+ };
113
+ return L(() => {
114
+ if (t && e) {
115
+ const f = M(t);
116
+ if (n.current = {
117
+ ...f,
118
+ ...I || {},
119
+ ...n.current || {}
120
+ }, !v && t != null && t.allow_draft) {
121
+ if (i) {
122
+ T(!0), e == null || e.getDraftEntry(t == null ? void 0 : t.key).then((S) => {
123
+ if (S === null) {
124
+ $(!0);
125
+ return;
126
+ }
127
+ $(!1);
128
+ const c = Array.isArray(S) ? S == null ? void 0 : S.filter((o) => (o == null ? void 0 : o._status) === "draft") : [];
129
+ if ((c == null ? void 0 : c.length) > 0) {
130
+ const o = (c == null ? void 0 : c[0]) || {};
131
+ o != null && o._id && (n.current = {
132
+ ...n.current || {},
133
+ ...o
134
+ }, w(o == null ? void 0 : o._id));
135
+ }
136
+ }).catch(() => null).finally(() => {
137
+ R({
138
+ ...n == null ? void 0 : n.current
139
+ }), T(!1);
140
+ });
141
+ return;
142
+ }
143
+ const V = tt(t == null ? void 0 : t.key);
144
+ V && (n.current = {
145
+ ...V,
146
+ ...n.current || {}
147
+ });
148
+ }
149
+ R({
150
+ ...(n == null ? void 0 : n.current) || {}
151
+ });
152
+ }
153
+ }, [t]), L(() => {
154
+ t && v && j(t == null ? void 0 : t.key);
155
+ }, [v]), L(() => {
156
+ p.formState.isSubmitSuccessful && (r && r(), p.reset(), p.clearErrors());
157
+ }, [p.formState.isSubmitSuccessful]), {
158
+ methods: p,
159
+ isLoading: P,
160
+ isError: K,
161
+ contentId: v,
162
+ allFormValues: n.current,
163
+ handleContentId: G,
164
+ handleSubmit: B
165
+ };
166
+ };
167
+ export {
168
+ at as S,
169
+ yt as u
170
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/react",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo suite for React based applications",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  "peerDependencies": {
17
17
  "react": ">=18",
18
18
  "react-dom": ">=18",
19
- "@levo-so/core": "0.1.13"
19
+ "@levo-so/core": "0.1.15"
20
20
  },
21
21
  "dependencies": {
22
22
  "@radix-ui/react-checkbox": "1.1.1",
@@ -43,6 +43,7 @@
43
43
  "@tiptap/extension-text-align": "2.6.4",
44
44
  "@tiptap/extension-underline": "2.6.4",
45
45
  "@tiptap/react": "2.6.4",
46
+ "altcha": "^1.0.7",
46
47
  "class-variance-authority": "0.7.0",
47
48
  "clsx": "2.1.1",
48
49
  "google-libphonenumber": "3.2.38",
@@ -78,17 +79,17 @@
78
79
  "@types/validator": "13.12.0",
79
80
  "@types/validatorjs": "3.15.5",
80
81
  "@vitejs/plugin-react": "4.3.1",
82
+ "autoprefixer": "10.4.16",
81
83
  "clsx": "2.1.1",
84
+ "postcss": "8.4.41",
85
+ "postcss-import": "16.1.0",
82
86
  "rollup-preserve-directives": "1.1.1",
83
87
  "tailwind-merge": "2.4.0",
88
+ "tailwindcss": "3.4.1",
89
+ "tailwindcss-animate": "1.0.7",
84
90
  "typescript": "5.5.4",
85
91
  "vite": "5.4.3",
86
92
  "vite-plugin-dts": "4.1.0",
87
- "autoprefixer": "10.4.16",
88
- "postcss": "8.4.41",
89
- "postcss-import": "16.1.0",
90
- "tailwindcss": "3.4.1",
91
- "tailwindcss-animate": "1.0.7",
92
93
  "@levo/ts-config": "0.0.0",
93
94
  "@levo/tw-config": "0.0.0"
94
95
  },
@@ -1,118 +0,0 @@
1
- "use client";
2
- import { j as t } from "./jsx-runtime-B6kdoens.js";
3
- import B, { useState as k } from "react";
4
- import { useController as C } from "react-hook-form";
5
- import { c as E } from "./cn-C9QoOYNG.js";
6
- import { h as I, j as O, k as u } from "./CollectionFormBuilder-B6CAVKhg.js";
7
- import { C as w } from "./Checbox-sq-atGlJ.js";
8
- import { I as _ } from "./Input-2CvZ90f8.js";
9
- const T = ({ field: i }) => {
10
- const [n, p] = k(""), [o, j] = k(!1), {
11
- key: $ = "",
12
- label: b = "",
13
- helper_text: g = "",
14
- readonly: y = !1,
15
- values: c = [],
16
- options: f = {}
17
- } = i, {
18
- field: { name: a, onBlur: d, onChange: l, value: r, ref: F, disabled: h },
19
- fieldState: { error: x }
20
- } = C({
21
- name: $,
22
- rules: I(i)
23
- }), N = (e) => {
24
- let s = Array.isArray(r || null) ? [...r] : [];
25
- s.includes(e) ? s = s == null ? void 0 : s.filter((m) => m !== e) : s.push(e), l(s);
26
- }, A = !!(f != null && f.custom_input);
27
- return B.useEffect(() => {
28
- o || r && (c == null ? void 0 : c.findIndex((e) => e === r)) === -1 && (j(!0), p(r));
29
- }, [r]), /* @__PURE__ */ t.jsxs(
30
- O,
31
- {
32
- error: x == null ? void 0 : x.message,
33
- helperText: g,
34
- readOnly: y,
35
- ref: F,
36
- children: [
37
- b && /* @__PURE__ */ t.jsx(u, { htmlFor: a, isRequired: i == null ? void 0 : i.required, children: b }),
38
- /* @__PURE__ */ t.jsx(
39
- "div",
40
- {
41
- className: E(
42
- "w-full flex gap-4 flex-col flex-wrap pt-1",
43
- y && "pointer-events-none cursor-not-allowed"
44
- ),
45
- children: c == null ? void 0 : c.map((e, s) => /* @__PURE__ */ t.jsxs(
46
- "div",
47
- {
48
- className: "w-full flex gap-2 items-start flex-nowrap",
49
- children: [
50
- /* @__PURE__ */ t.jsx(
51
- w,
52
- {
53
- id: `${e}-${s}`,
54
- name: a,
55
- checked: r == null ? void 0 : r.includes(e),
56
- onCheckedChange: () => N(e),
57
- onBlur: () => {
58
- d();
59
- },
60
- disabled: h
61
- }
62
- ),
63
- /* @__PURE__ */ t.jsx(u, { htmlFor: `${e}-${s}`, className: "!mb-0", children: e })
64
- ]
65
- },
66
- `${e}-${s}`
67
- ))
68
- }
69
- ),
70
- A && /* @__PURE__ */ t.jsxs("div", { className: "flex w-full items-center my-4 gap-2 flex-wrap", children: [
71
- /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 flex-nowrap shrink-0", children: [
72
- /* @__PURE__ */ t.jsx(
73
- w,
74
- {
75
- name: `${a}-other`,
76
- disabled: h,
77
- checked: o,
78
- onCheckedChange: (e) => {
79
- j(!!e), e ? Array.isArray(r) ? l == null || l(a, [...r, n]) : l == null || l(a, [n]) : l == null || l(
80
- a,
81
- r == null ? void 0 : r.filter((s) => s !== n)
82
- );
83
- },
84
- onBlur: () => {
85
- d && d();
86
- }
87
- }
88
- ),
89
- /* @__PURE__ */ t.jsxs(u, { htmlFor: `${a}-other`, className: "!mb-0", children: [
90
- "Other:",
91
- " "
92
- ] })
93
- ] }),
94
- /* @__PURE__ */ t.jsx(
95
- _,
96
- {
97
- name: `other-checkbox-${a}`,
98
- containerStyles: "max-w-[300px] ml-3",
99
- value: n,
100
- onChange: (e) => {
101
- let s = 0;
102
- l == null || l(
103
- r == null ? void 0 : r.map((m) => m === n && !s ? (s = 1, e.target.value) : m)
104
- ), p(e.target.value);
105
- },
106
- disabled: !o || h,
107
- placeholder: "Please specify"
108
- }
109
- )
110
- ] })
111
- ]
112
- }
113
- );
114
- };
115
- export {
116
- T as CheckboxWidget,
117
- T as default
118
- };