@levo-so/react 0.1.14 → 0.1.16

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 (106) hide show
  1. package/dist/CheckboxWidget-CNoS-2W3.js +124 -0
  2. package/dist/CollectionFormBuilder-MAo2Ob3a.js +1199 -0
  3. package/dist/{CurrencyWidget-COoMkfsA.js → CurrencyWidget-Cu1Cthnw.js} +5 -5
  4. package/dist/{DateTimeWidget-DcbQ3smI.js → DateTimeWidget-N-wuCRSJ.js} +3 -3
  5. package/dist/DefaultFormVariant-IqWi1BiT.js +81 -0
  6. package/dist/DropdownWidget-BFttB4b-.js +115 -0
  7. package/dist/{EmailWidget-CG9oNUM5.js → EmailWidget-D_SqXx3M.js} +11 -11
  8. package/dist/FormCaptcha-CJ9KgDu0.js +197 -0
  9. package/dist/GeocoderWidget-Bxt3TeAf.js +68 -0
  10. package/dist/LevoProvider-BAZy7_tP.js +223 -0
  11. package/dist/{MultiGeocoderWidget-D3Xmv8g4.js → MultiGeocoderWidget-DFjuXZBN.js} +6 -6
  12. package/dist/{MultiTextWidget-CyQRcWC8.js → MultiTextWidget-CZzT51cH.js} +14 -14
  13. package/dist/{PhoneWidget-C1Jt7kXL.js → PhoneWidget--K5aS16s.js} +5 -5
  14. package/dist/{RadioWidget-BrLNF-I2.js → RadioWidget-BbMPtR3P.js} +9 -9
  15. package/dist/{RichTextWidget-BogYcPtS.js → RichTextWidget-Cce3Bw8d.js} +21 -21
  16. package/dist/Spinner-Bzu2xCFZ.js +405 -0
  17. package/dist/{StepsFormVariant-Bx-jdciC.js → StepsFormVariant-5wZbYAA9.js} +58 -55
  18. package/dist/{SwitchWidget-BT0-waP9.js → SwitchWidget-B0wkSWxa.js} +5 -5
  19. package/dist/{TextWidget-Bvsz-hey.js → TextWidget-ldbMuLB0.js} +7 -7
  20. package/dist/{TextareaWidget-8SLym--T.js → TextareaWidget-S8bKUTv0.js} +3 -3
  21. package/dist/{ToggleCheckboxWidget-VrCQBF5C.js → ToggleCheckboxWidget-CPduXE6Y.js} +7 -7
  22. package/dist/Tooltip-DEBnSqlo.js +36 -0
  23. package/dist/{URLWidget-B99nKr6N.js → URLWidget-KbhE2ZUA.js} +2 -2
  24. package/dist/UploadWidget-DFvfDUT6.js +616 -0
  25. package/dist/audience/components/block.d.ts.map +1 -1
  26. package/dist/audience/components/component.d.ts.map +1 -1
  27. package/dist/audience/components/page.d.ts.map +1 -1
  28. package/dist/audience/index.js +1 -1
  29. package/dist/collection/components/Altcha.d.ts +10 -0
  30. package/dist/collection/components/Altcha.d.ts.map +1 -0
  31. package/dist/collection/components/FormCaptcha.d.ts +3 -0
  32. package/dist/collection/components/FormCaptcha.d.ts.map +1 -0
  33. package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -1
  34. package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -1
  35. package/dist/collection/components/core/Input/Input.d.ts.map +1 -1
  36. package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -1
  37. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
  38. package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -1
  39. package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -1
  40. package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -1
  41. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +1 -1
  42. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
  43. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +7 -0
  44. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -0
  45. package/dist/collection/components/widgets/collectionWidget/{CollectionWidget.d.ts → CollectionWidgetM2O.d.ts} +1 -1
  46. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +1 -0
  47. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +8 -0
  48. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -0
  49. package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -1
  50. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
  51. package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
  52. package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -1
  53. package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -1
  54. package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts.map +1 -1
  55. package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
  56. package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -1
  57. package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -1
  58. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
  59. package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -1
  60. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +11 -0
  61. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -0
  62. package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
  63. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
  64. package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
  65. package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -1
  66. package/dist/collection/index.js +13 -12
  67. package/dist/collection/lib/FormBuilder.d.ts.map +1 -1
  68. package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -1
  69. package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
  70. package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
  71. package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -1
  72. package/dist/collection/utils/formHelpers.d.ts.map +1 -1
  73. package/dist/collection/utils/index.d.ts +2 -0
  74. package/dist/collection/utils/index.d.ts.map +1 -1
  75. package/dist/components/Dialog.d.ts.map +1 -1
  76. package/dist/components/Spinner.d.ts.map +1 -1
  77. package/dist/components/Table.d.ts +11 -0
  78. package/dist/components/Table.d.ts.map +1 -0
  79. package/dist/components/Tabs.d.ts.map +1 -1
  80. package/dist/components/Tooltip.d.ts.map +1 -1
  81. package/dist/components/button/Button.d.ts.map +1 -1
  82. package/dist/components/index.js +29 -29
  83. package/dist/constants/fileUploadPresets.d.ts +4 -2
  84. package/dist/constants/fileUploadPresets.d.ts.map +1 -1
  85. package/dist/index.css +1 -1
  86. package/dist/index.js +75 -75
  87. package/dist/membership/components/Button.d.ts.map +1 -1
  88. package/dist/membership/components/Container.d.ts.map +1 -1
  89. package/dist/membership/components/Core.d.ts.map +1 -1
  90. package/dist/membership/index.js +2 -3
  91. package/dist/page-BKyDlf0z.js +212 -0
  92. package/dist/utils/errorHandler.d.ts.map +1 -1
  93. package/package.json +12 -11
  94. package/dist/CheckboxWidget-BctVOZiO.js +0 -118
  95. package/dist/CollectionFormBuilder-B6CAVKhg.js +0 -772
  96. package/dist/DefaultFormVariant-C6zbKgwB.js +0 -80
  97. package/dist/DropdownWidget-DszCTSWr.js +0 -115
  98. package/dist/GeocoderWidget-CXu17A7y.js +0 -310
  99. package/dist/LevoProvider-BI6g_T4E.js +0 -212
  100. package/dist/Spinner-DzGH5rKe.js +0 -297
  101. package/dist/Tooltip-CI4i4mYr.js +0 -144
  102. package/dist/UploadWidget-ZebPWZZZ.js +0 -505
  103. package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +0 -1
  104. package/dist/fileUploadPresets-2raQmHT0.js +0 -74
  105. package/dist/page-yeiAPg3O.js +0 -200
  106. 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-BAZy7_tP.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
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/utils/errorHandler.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,UAAW,GAAG,sCAMtC,CAAC"}
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/utils/errorHandler.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAW,GAAG,sCAMtC,CAAC"}
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.16",
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,19 +79,20 @@
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
- "@levo/ts-config": "0.0.0",
93
- "@levo/tw-config": "0.0.0"
93
+ "@levo/eslint-config": "0.0.0",
94
+ "@levo/tw-config": "0.0.0",
95
+ "@levo/ts-config": "0.0.0"
94
96
  },
95
97
  "main": "./dist/index.js",
96
98
  "module": "./dist/index.js",
@@ -126,8 +128,7 @@
126
128
  "scripts": {
127
129
  "clean": "rimraf dist node_modules .turbo",
128
130
  "check-types": "tsc --noEmit",
129
- "format-and-lint": "biome check .",
130
- "format-and-lint:fix": "biome check . --write --diagnostic-level=error",
131
+ "lint": "eslint",
131
132
  "build": "vite build",
132
133
  "dev": "vite build --watch"
133
134
  }
@@ -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
- };