@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,616 @@
1
+ "use client";
2
+ import { j as a } from "./jsx-runtime-B6kdoens.js";
3
+ import { MediaKindList as F } from "@levo-so/core";
4
+ import { X, Upload as O, ExternalLink as aa } from "lucide-react";
5
+ import { useMemo as J, useState as U, useRef as ra, useEffect as M } from "react";
6
+ import { useController as ta } from "react-hook-form";
7
+ import { G as H, B as P, S as G, j as sa, T as ea, k as oa, l as $, m as V } from "./Spinner-Bzu2xCFZ.js";
8
+ import { t as na, g as ca, z as la, w as C, A as da, B as ia } from "./CollectionFormBuilder-BIvx_z08.js";
9
+ import { u as k } from "./LevoProvider-Do3jjJ4j.js";
10
+ import { e as Y } from "./errorHandler-_34Yv8wA.js";
11
+ import { I as K } from "./Input-2CvZ90f8.js";
12
+ import { c as xa, S as Q } from "./Tooltip-DEBnSqlo.js";
13
+ import { useDropzone as pa } from "react-dropzone";
14
+ import { e as D } from "./Sonner-t6JVKA0a.js";
15
+ import { c as S } from "./cn-C9QoOYNG.js";
16
+ import { useDebouncedCallback as ha } from "use-debounce";
17
+ import { b as ma } from "./byteToSize-BFKZSBu1.js";
18
+ import { C as ua } from "./Checbox-sq-atGlJ.js";
19
+ function R(s) {
20
+ return H({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" }, child: [] }] })(s);
21
+ }
22
+ function ga(s) {
23
+ return H({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z" }, child: [] }] })(s);
24
+ }
25
+ function ja(s) {
26
+ return H({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z" }, child: [] }] })(s);
27
+ }
28
+ const ba = ({ onChange: s, value: c, kind: g, isMultiple: p = !1 }) => {
29
+ const { media: l } = k(), i = Array.isArray(c) ? c : [], o = J(() => {
30
+ let t = {};
31
+ return g.forEach((j) => {
32
+ t = {
33
+ ...t,
34
+ ...na[j]
35
+ };
36
+ }), t;
37
+ }, [g]), d = (t) => {
38
+ s == null || s(t);
39
+ }, x = async (t) => {
40
+ if ((t == null ? void 0 : t.length) === 0) {
41
+ D("No file selected. Please select one file.");
42
+ return;
43
+ }
44
+ const j = new FormData();
45
+ t == null || t.forEach((m) => {
46
+ j.append("media", m);
47
+ }), await (l == null ? void 0 : l.mediaBulkUpload(j).then((m) => {
48
+ var b, I, r;
49
+ (((b = m.content) == null ? void 0 : b.errors) ?? []).forEach(
50
+ (n) => {
51
+ var v, A, w;
52
+ (A = (v = n.param) == null ? void 0 : v.split(".")) != null && A[1] && D(
53
+ n.message,
54
+ `Error uploading ${((w = t[n.param.split(".")[1]]) == null ? void 0 : w.name) ?? "File"}`
55
+ );
56
+ }
57
+ );
58
+ const _ = (r = (I = m == null ? void 0 : m.content) == null ? void 0 : I.data) == null ? void 0 : r.map(
59
+ (n) => {
60
+ var v;
61
+ return {
62
+ id: n == null ? void 0 : n.id,
63
+ kind: n == null ? void 0 : n.kind,
64
+ location: n == null ? void 0 : n.location,
65
+ mimetype: (v = n == null ? void 0 : n.metadata) == null ? void 0 : v.mimetype,
66
+ srcset: n == null ? void 0 : n.srcset
67
+ };
68
+ }
69
+ );
70
+ d([...i, ..._]);
71
+ }).catch(Y));
72
+ }, { getRootProps: T, getInputProps: h, isDragActive: N } = pa({
73
+ onDrop: x,
74
+ accept: o,
75
+ multiple: p,
76
+ maxSize: 25 * 1024 * 1024,
77
+ onDropRejected: (t) => {
78
+ t.forEach((j) => {
79
+ j.errors.forEach((m) => {
80
+ m.code === "file-too-large" && D(`${j.file.name} is bigger than 25MB`);
81
+ });
82
+ });
83
+ }
84
+ });
85
+ return /* @__PURE__ */ a.jsx(xa, { children: /* @__PURE__ */ a.jsx("div", { className: "w-full min-h-[150px]", children: (i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */ a.jsxs("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fit,_minmax(150px,_1fr))]", children: [
86
+ i == null ? void 0 : i.map((t) => {
87
+ var j, m;
88
+ return /* @__PURE__ */ a.jsxs(
89
+ "div",
90
+ {
91
+ className: "group relative w-full overflow-hidden h-auto max-[350px] rounded-md border border-gray-300",
92
+ style: {
93
+ background: "linear-gradient(to top, black -50%, transparent 45%)"
94
+ },
95
+ children: [
96
+ (t == null ? void 0 : t.kind) !== "image" ? /* @__PURE__ */ a.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ a.jsx(
97
+ R,
98
+ {
99
+ size: "60px",
100
+ className: "text-gray-400 p-2"
101
+ }
102
+ ) }) : /* @__PURE__ */ a.jsx(
103
+ "img",
104
+ {
105
+ className: "w-full h-full object-contain",
106
+ src: t == null ? void 0 : t.location
107
+ }
108
+ ),
109
+ /* @__PURE__ */ a.jsx(
110
+ "div",
111
+ {
112
+ className: S(
113
+ "absolute left-0 right-0 bottom-0 h-16 bg-[linear-gradient(to-t,_rgba(0,_0,_10,_0.35),_transparent)]",
114
+ "group-hover:bg-[linear-gradient(to-t,_rgba(0,0,10,0.5),_transparent)] group-hover:h-[70%]"
115
+ )
116
+ }
117
+ ),
118
+ /* @__PURE__ */ a.jsx("p", { className: "absolute left-4 bottom-2 text-base text-white", children: (m = t == null ? void 0 : t.location) == null ? void 0 : m.split("/")[((j = t == null ? void 0 : t.location) == null ? void 0 : j.split("/").length) - 1] }),
119
+ /* @__PURE__ */ a.jsx(
120
+ P,
121
+ {
122
+ className: "absolute right-4 top-4 z-10",
123
+ size: "icon",
124
+ variant: "secondary",
125
+ onClick: () => {
126
+ d(
127
+ i == null ? void 0 : i.filter((_) => (_ == null ? void 0 : _.id) !== (t == null ? void 0 : t.id))
128
+ );
129
+ },
130
+ children: /* @__PURE__ */ a.jsx(X, { className: "text-primary" })
131
+ }
132
+ )
133
+ ]
134
+ },
135
+ t == null ? void 0 : t.id
136
+ );
137
+ }),
138
+ p && /* @__PURE__ */ a.jsxs(
139
+ "div",
140
+ {
141
+ className: "flex items-center justify-center flex-col w-full rounded-md border-dashed border-[2px] border-gray-400 h-[14rem] p-4 gap-2",
142
+ ...T(),
143
+ children: [
144
+ /* @__PURE__ */ a.jsx("p", { className: "text-xl text-center my-2", children: N ? "Drop your files here..." : "Drag & Drop here to upload!" }),
145
+ /* @__PURE__ */ a.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ a.jsx(Q, { label: "Upload a file", children: /* @__PURE__ */ a.jsxs(P, { size: "icon", className: "text-md", children: [
146
+ /* @__PURE__ */ a.jsx("input", { ...h() }),
147
+ /* @__PURE__ */ a.jsx(O, { size: 20 })
148
+ ] }) }) })
149
+ ]
150
+ }
151
+ )
152
+ ] }) : /* @__PURE__ */ a.jsxs(
153
+ "div",
154
+ {
155
+ className: "flex items-center justify-center flex-col w-full rounded-md border-dashed border-[2px] border-gray-400 h-[14rem] p-4 gap-2",
156
+ ...T(),
157
+ children: [
158
+ /* @__PURE__ */ a.jsx("p", { className: "text-xl my-2", children: N ? "Drop your files here..." : "Drag & Drop here to upload!" }),
159
+ /* @__PURE__ */ a.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ a.jsx(Q, { label: "Upload a file", children: /* @__PURE__ */ a.jsxs(P, { size: "icon", className: "text-md", children: [
160
+ /* @__PURE__ */ a.jsx("input", { ...h() }),
161
+ /* @__PURE__ */ a.jsx(O, { size: 20 })
162
+ ] }) }) })
163
+ ]
164
+ }
165
+ ) }) });
166
+ }, ya = ({
167
+ selectedFiles: s = [],
168
+ onChange: c,
169
+ isMultiple: g = !1,
170
+ kind: p
171
+ }) => {
172
+ const { media: l } = k(), [i, o] = U(1), [d, x] = U([]), [T, h] = U(!1), N = ra(null), [t, j] = U({
173
+ searchText: "",
174
+ currentPage: 1
175
+ }), m = ha(() => {
176
+ h(!0), l == null || l.getAllMedia({
177
+ page: t.currentPage,
178
+ limit: 24,
179
+ sort: {
180
+ created_at: "desc"
181
+ },
182
+ search: t.searchText || void 0
183
+ }).then((r) => {
184
+ var n, v;
185
+ o((v = (n = r == null ? void 0 : r.content) == null ? void 0 : n.meta) == null ? void 0 : v.pages), x((A) => {
186
+ var w;
187
+ return [...A, ...((w = r == null ? void 0 : r.content) == null ? void 0 : w.data) || []];
188
+ });
189
+ }).catch((r) => {
190
+ console.error(r);
191
+ }).finally(() => {
192
+ h(!1);
193
+ });
194
+ }, 500);
195
+ M(() => {
196
+ m();
197
+ }, [t]), M(() => {
198
+ const r = N.current;
199
+ if (r)
200
+ return r.addEventListener("scroll", _), () => r.removeEventListener("scroll", _);
201
+ }, [N, t.currentPage, i]);
202
+ const _ = () => {
203
+ const r = N.current;
204
+ r && r.scrollTop + r.clientHeight + 1 >= r.scrollHeight && b();
205
+ }, b = () => {
206
+ t.currentPage < i && j((r) => ({
207
+ searchText: r.searchText,
208
+ currentPage: r.currentPage + 1
209
+ }));
210
+ }, I = (r) => {
211
+ if (!(p != null && p.includes(r == null ? void 0 : r.kind))) {
212
+ D(`Only ${p == null ? void 0 : p.join(", ")}s are allowed.`);
213
+ return;
214
+ }
215
+ g ? (s == null ? void 0 : s.findIndex((n) => (n == null ? void 0 : n.id) === (r == null ? void 0 : r.id))) >= 0 ? c == null || c(s == null ? void 0 : s.filter((n) => (n == null ? void 0 : n.id) !== (r == null ? void 0 : r.id))) : c == null || c([...s || [], r]) : c == null || c([r]);
216
+ };
217
+ return /* @__PURE__ */ a.jsxs("div", { className: "bg-white p-0 rounded-md w-full relative", children: [
218
+ /* @__PURE__ */ a.jsx("div", { className: "py-2 bg-white sticky top-0 z-50 w-full", children: /* @__PURE__ */ a.jsx(
219
+ K,
220
+ {
221
+ name: "searchText",
222
+ type: "text",
223
+ placeholder: "Search...",
224
+ value: t.searchText,
225
+ onChange: (r) => {
226
+ h(!0), j({ currentPage: 1, searchText: r.target.value }), x([]);
227
+ }
228
+ }
229
+ ) }),
230
+ T && !d.length ? /* @__PURE__ */ a.jsx("div", { className: "w-full h-full min-h-[30rem] flex items-center justify-center", children: /* @__PURE__ */ a.jsx(G, {}) }) : /* @__PURE__ */ a.jsxs(
231
+ "div",
232
+ {
233
+ ref: N,
234
+ className: "w-full h-[30rem] overflow-y-auto overflow-x-hidden grid lg:grid-cols-4 gap-6 p-2",
235
+ children: [
236
+ d == null ? void 0 : d.map((r, n) => {
237
+ var w;
238
+ const v = p == null ? void 0 : p.includes(r == null ? void 0 : r.kind), A = (s == null ? void 0 : s.findIndex((E) => (E == null ? void 0 : E.id) === (r == null ? void 0 : r.id))) >= 0;
239
+ return /* @__PURE__ */ a.jsxs(
240
+ "div",
241
+ {
242
+ className: S(
243
+ "relative w-full",
244
+ v ? "opacity-100" : "opacity-50"
245
+ ),
246
+ children: [
247
+ /* @__PURE__ */ a.jsxs(
248
+ "div",
249
+ {
250
+ className: S(
251
+ "cursor-pointer w-full group rounded-md overflow-hidden h-[130px] border-2 flex items-center justify-center",
252
+ A ? "border-primary" : "border-gray-100"
253
+ ),
254
+ onClick: () => {
255
+ var E;
256
+ return I({
257
+ id: r == null ? void 0 : r.id,
258
+ location: r == null ? void 0 : r.location,
259
+ mimetype: (E = r == null ? void 0 : r.metadata) == null ? void 0 : E.mimetype,
260
+ kind: r == null ? void 0 : r.kind,
261
+ srcset: r == null ? void 0 : r.srcset
262
+ });
263
+ },
264
+ children: [
265
+ /* @__PURE__ */ a.jsx(
266
+ "div",
267
+ {
268
+ className: S(
269
+ "rounded-md opacity-0 absolute left-0 right-0 top-0 w-full h-[42px] bg-[linear-gradient(0deg,_transparent_0%,_#000000_200%)]",
270
+ v ? "group-hover:opacity-100" : ""
271
+ )
272
+ }
273
+ ),
274
+ v && /* @__PURE__ */ a.jsx(
275
+ ua,
276
+ {
277
+ name: "isFileIncluded",
278
+ className: "absolute top-[10px] left-[10px]",
279
+ checked: A
280
+ }
281
+ ),
282
+ (r == null ? void 0 : r.kind) !== "image" ? /* @__PURE__ */ a.jsx(R, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ a.jsx(
283
+ "img",
284
+ {
285
+ className: "w-full h-full object-contain",
286
+ srcSet: (w = r == null ? void 0 : r.srcset) == null ? void 0 : w.path,
287
+ src: r == null ? void 0 : r.location
288
+ }
289
+ )
290
+ ]
291
+ }
292
+ ),
293
+ /* @__PURE__ */ a.jsxs("div", { className: "my-[10px]", children: [
294
+ /* @__PURE__ */ a.jsx("p", { className: "text-sm whitespace-nowrap overflow-hidden text-ellipsis", children: r == null ? void 0 : r.filename }),
295
+ /* @__PURE__ */ a.jsx("p", { className: "text-xs text-gray-500", children: ma(r == null ? void 0 : r.metadata.size) })
296
+ ] })
297
+ ]
298
+ },
299
+ `media-layout-file-${n}`
300
+ );
301
+ }),
302
+ T && /* @__PURE__ */ a.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ a.jsx(G, {}) })
303
+ ]
304
+ }
305
+ )
306
+ ] });
307
+ }, va = ({
308
+ selectedFiles: s = [],
309
+ onChange: c,
310
+ isMultiple: g = !1,
311
+ kind: p
312
+ }) => {
313
+ const [l, i] = U("");
314
+ return M(() => {
315
+ var o, d;
316
+ !g && s[0] && !((o = s[0]) != null && o.location.includes("levo")) && i((d = s[0]) == null ? void 0 : d.location);
317
+ }, [s]), /* @__PURE__ */ a.jsxs("div", { className: "bg-white p-0 rounded-md w-full relative", children: [
318
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-4 py-2 bg-white sticky top-0 z-50 w-full", children: [
319
+ /* @__PURE__ */ a.jsx(
320
+ K,
321
+ {
322
+ name: "searchText",
323
+ type: "text",
324
+ value: l,
325
+ placeholder: "Enter image URL...",
326
+ onChange: (o) => i(o.target.value)
327
+ }
328
+ ),
329
+ /* @__PURE__ */ a.jsx(
330
+ P,
331
+ {
332
+ onClick: () => {
333
+ c && fetch(l).then((o) => o.blob()).then((o) => {
334
+ const d = o.type, x = ca(d);
335
+ x && c([
336
+ {
337
+ id: `external-${(/* @__PURE__ */ new Date()).getTime()}`,
338
+ location: l,
339
+ kind: x,
340
+ mimetype: d
341
+ }
342
+ ]);
343
+ }).catch(
344
+ (o) => console.error("Error fetching file details:", o)
345
+ );
346
+ },
347
+ disabled: !l,
348
+ children: "Add"
349
+ }
350
+ )
351
+ ] }),
352
+ /* @__PURE__ */ a.jsx("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fit,_minmax(150px,_1fr))]", children: s == null ? void 0 : s.map((o) => {
353
+ var d;
354
+ return /* @__PURE__ */ a.jsxs(
355
+ "div",
356
+ {
357
+ className: "group relative w-full overflow-hidden h-auto max-h-[350px] rounded-md border border-gray-300",
358
+ style: {
359
+ background: "linear-gradient(to top, black -50%, transparent 45%)"
360
+ },
361
+ children: [
362
+ (o == null ? void 0 : o.kind) !== "image" ? /* @__PURE__ */ a.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ a.jsx(R, { size: "60px", className: "text-gray-400 p-2" }) }) : /* @__PURE__ */ a.jsx(
363
+ "img",
364
+ {
365
+ className: "w-full h-full object-contain",
366
+ src: o == null ? void 0 : o.location
367
+ }
368
+ ),
369
+ /* @__PURE__ */ a.jsx(
370
+ "div",
371
+ {
372
+ className: S(
373
+ "absolute left-0 right-0 bottom-0 h-16 bg-[linear-gradient(to-t,_rgba(0,_0,_10,_0.35),_transparent)]",
374
+ "group-hover:bg-[linear-gradient(to-t,_rgba(0,0,10,0.5),_transparent)] group-hover:h-[70%]"
375
+ )
376
+ }
377
+ ),
378
+ /* @__PURE__ */ a.jsx("p", { className: "absolute left-4 bottom-2 text-base text-white", children: (d = o == null ? void 0 : o.location) == null ? void 0 : d.split("/").pop() }),
379
+ /* @__PURE__ */ a.jsx(
380
+ P,
381
+ {
382
+ className: "absolute right-4 top-4 z-10",
383
+ size: "icon",
384
+ variant: "secondary",
385
+ onClick: () => {
386
+ c == null || c(
387
+ s == null ? void 0 : s.filter((x) => (x == null ? void 0 : x.id) !== (o == null ? void 0 : o.id))
388
+ );
389
+ },
390
+ children: /* @__PURE__ */ a.jsx(X, { className: "text-primary" })
391
+ }
392
+ )
393
+ ]
394
+ },
395
+ o == null ? void 0 : o.id
396
+ );
397
+ }) })
398
+ ] });
399
+ }, Na = ({
400
+ isOpen: s,
401
+ onClose: c,
402
+ onChange: g,
403
+ value: p,
404
+ kind: l,
405
+ isMultiple: i = !1,
406
+ isExternal: o
407
+ }) => {
408
+ const [d, x] = U([]), T = () => {
409
+ c();
410
+ };
411
+ return M(() => {
412
+ x(p.filter((h) => !!h.location));
413
+ }, [p]), /* @__PURE__ */ a.jsxs(
414
+ sa,
415
+ {
416
+ title: (l == null ? void 0 : l.length) > 1 ? "Upload file" : `Upload ${l == null ? void 0 : l[0]}`,
417
+ isOpen: s,
418
+ onClose: () => T(),
419
+ contentClassName: "max-w-[60%]",
420
+ children: [
421
+ /* @__PURE__ */ a.jsxs(ea, { defaultValue: "upload", children: [
422
+ /* @__PURE__ */ a.jsxs(oa, { children: [
423
+ /* @__PURE__ */ a.jsx($, { value: "upload", children: "Local File" }),
424
+ !o && /* @__PURE__ */ a.jsx($, { value: "import", children: "Import from Gallery" }),
425
+ !o && l.includes("image") && /* @__PURE__ */ a.jsx($, { value: "external_url", children: "External URL" })
426
+ ] }),
427
+ /* @__PURE__ */ a.jsx(V, { value: "upload", children: /* @__PURE__ */ a.jsx("div", { className: "mt-[20px] max-h-[70vh] overflow-y-auto", children: /* @__PURE__ */ a.jsx(
428
+ ba,
429
+ {
430
+ kind: l,
431
+ value: d,
432
+ onChange: (h) => x(h),
433
+ isMultiple: i
434
+ }
435
+ ) }) }),
436
+ /* @__PURE__ */ a.jsx(V, { value: "import", children: /* @__PURE__ */ a.jsx(
437
+ ya,
438
+ {
439
+ onChange: (h) => x == null ? void 0 : x(h),
440
+ selectedFiles: d,
441
+ isMultiple: i,
442
+ kind: l
443
+ }
444
+ ) }),
445
+ /* @__PURE__ */ a.jsx(V, { value: "external_url", children: /* @__PURE__ */ a.jsx(
446
+ va,
447
+ {
448
+ onChange: (h) => {
449
+ x == null || x(h);
450
+ },
451
+ selectedFiles: d,
452
+ isMultiple: i,
453
+ kind: l
454
+ }
455
+ ) })
456
+ ] }),
457
+ /* @__PURE__ */ a.jsx("div", { className: "flex justify-end mt-[20px]", children: /* @__PURE__ */ a.jsx(
458
+ P,
459
+ {
460
+ variant: "default",
461
+ onClick: () => {
462
+ d && (g == null || g(d)), T();
463
+ },
464
+ children: "Save"
465
+ }
466
+ ) })
467
+ ]
468
+ }
469
+ );
470
+ }, Oa = ({
471
+ field: s,
472
+ kind: c = F,
473
+ isMultiple: g,
474
+ isExternal: p = !1
475
+ }) => {
476
+ var W;
477
+ const { media: l } = k(), { key: i = "", label: o = "", helper_text: d = "", readonly: x = !1 } = s, {
478
+ field: { onBlur: T, onChange: h, value: N, disabled: t, ref: j },
479
+ fieldState: m
480
+ } = ta({
481
+ name: i,
482
+ rules: la(s)
483
+ }), _ = J(() => {
484
+ const e = [];
485
+ return c.forEach((L) => {
486
+ e.push(...C[L]);
487
+ }), e;
488
+ }, [c]), b = N ? Array.isArray(N) ? N : [N] : [], [I, r] = U(!1), n = () => r(!0), v = () => r(!1), [A, w] = U(!1), E = (e) => {
489
+ h && (g === !0 ? h(e) : g === !1 && h(e == null ? void 0 : e[0]));
490
+ }, Z = async (e) => {
491
+ const L = new FormData();
492
+ let u = [...e];
493
+ g || (u = e == null ? void 0 : e.slice(0, 1)), (u == null ? void 0 : u.length) > 0 && (u == null || u.forEach((y) => {
494
+ var q;
495
+ const z = y.name.split("."), B = (q = z[z.length - 1]) == null ? void 0 : q.toLowerCase();
496
+ c == null || c.forEach((f) => {
497
+ _.push(...C[f]);
498
+ }), B && _.includes(B) && L.append("media", y);
499
+ })), w(!0), await (l == null ? void 0 : l.mediaBulkUpload(L).then((y) => {
500
+ var z, B;
501
+ w(!1), (z = y == null ? void 0 : y.content) != null && z.data && E((B = y == null ? void 0 : y.content) == null ? void 0 : B.data);
502
+ }).catch((y) => {
503
+ Y(y);
504
+ }).finally(() => {
505
+ w(!1);
506
+ }));
507
+ };
508
+ return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
509
+ /* @__PURE__ */ a.jsx(
510
+ Na,
511
+ {
512
+ isOpen: I,
513
+ onClose: v,
514
+ onChange: (e) => {
515
+ E(e);
516
+ },
517
+ value: b,
518
+ kind: [...c],
519
+ isMultiple: g,
520
+ isExternal: p
521
+ }
522
+ ),
523
+ /* @__PURE__ */ a.jsxs(
524
+ da,
525
+ {
526
+ error: (W = m == null ? void 0 : m.error) == null ? void 0 : W.message,
527
+ helperText: d,
528
+ readOnly: x,
529
+ children: [
530
+ o && /* @__PURE__ */ a.jsx(ia, { htmlFor: i, isRequired: s == null ? void 0 : s.required, children: o }),
531
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2", ref: j, children: [
532
+ /* @__PURE__ */ a.jsx(
533
+ P,
534
+ {
535
+ size: "icon-small",
536
+ variant: "outline",
537
+ disabled: t,
538
+ onClick: n,
539
+ children: /* @__PURE__ */ a.jsx(O, { size: 15 })
540
+ }
541
+ ),
542
+ /* @__PURE__ */ a.jsxs("div", { className: "relative flex", children: [
543
+ /* @__PURE__ */ a.jsx(
544
+ K,
545
+ {
546
+ name: "pasteUrl",
547
+ placeholder: "Paste your files here...",
548
+ onBlur: () => T(),
549
+ onPaste: (e) => {
550
+ const L = e.clipboardData.items, u = [];
551
+ for (let y = 0; y < L.length; y++) {
552
+ const z = L[y];
553
+ if ((z == null ? void 0 : z.kind) === "file") {
554
+ const B = z == null ? void 0 : z.getAsFile();
555
+ B && u.push(B);
556
+ }
557
+ }
558
+ (u == null ? void 0 : u.length) > 0 && Z(u);
559
+ },
560
+ disabled: t,
561
+ readOnly: x
562
+ }
563
+ ),
564
+ A && /* @__PURE__ */ a.jsxs(
565
+ "div",
566
+ {
567
+ role: "status",
568
+ className: "absolute right-3 top-[50%] translate-y-[-50%]",
569
+ children: [
570
+ /* @__PURE__ */ a.jsx(ga, {}),
571
+ /* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Loading..." })
572
+ ]
573
+ }
574
+ )
575
+ ] })
576
+ ] }),
577
+ (b == null ? void 0 : b.length) > 0 && /* @__PURE__ */ a.jsx("div", { className: "mt-3 w-full", children: /* @__PURE__ */ a.jsx("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fill,_minmax(100px,_1fr))]", children: b == null ? void 0 : b.map((e, L) => e != null && e.location ? /* @__PURE__ */ a.jsxs(
578
+ "div",
579
+ {
580
+ className: "relative border overflow-hidden group w-full rounded-xl h-28 flex items-center justify-center",
581
+ children: [
582
+ /* @__PURE__ */ a.jsx("div", { className: "w-full bg-black/20 h-full absolute top-0 left-0 z-10 hidden group-hover:flex items-center justify-center", children: /* @__PURE__ */ a.jsx("a", { href: e == null ? void 0 : e.location, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ a.jsx(aa, { size: 24 }) }) }),
583
+ (e == null ? void 0 : e.kind) !== "image" ? /* @__PURE__ */ a.jsx(R, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ a.jsx(
584
+ "img",
585
+ {
586
+ className: "w-full h-full object-contain",
587
+ src: e == null ? void 0 : e.location,
588
+ alt: e == null ? void 0 : e.id
589
+ }
590
+ ),
591
+ /* @__PURE__ */ a.jsx(
592
+ "button",
593
+ {
594
+ className: "absolute z-10 top-1 right-1 bg-white p-1 rounded-full focus:outline-none",
595
+ onClick: () => {
596
+ E(
597
+ b == null ? void 0 : b.filter((u) => (u == null ? void 0 : u.id) !== (e == null ? void 0 : e.id))
598
+ );
599
+ },
600
+ type: "button",
601
+ children: /* @__PURE__ */ a.jsx(ja, { className: "text-sm" })
602
+ }
603
+ )
604
+ ]
605
+ },
606
+ `${e == null ? void 0 : e.location}-${L}`
607
+ ) : null) }) })
608
+ ]
609
+ }
610
+ )
611
+ ] });
612
+ };
613
+ export {
614
+ Oa as UploadWidget,
615
+ Oa as default
616
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CA+FA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CA8HA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { L as e, a, b as n } from "../page-yeiAPg3O.js";
1
+ import { L as e, a, b as n } from "../page-DgqTELmZ.js";
2
2
  export {
3
3
  e as LevoInsightsBlock,
4
4
  a as LevoInsightsComponent,
@@ -0,0 +1,10 @@
1
+ interface AltchaProps {
2
+ onStateChange?: (ev: Event | CustomEvent) => void;
3
+ challengeurl: string;
4
+ verifyurl: string;
5
+ }
6
+ declare const Altcha: import('react').ForwardRefExoticComponent<AltchaProps & import('react').RefAttributes<{
7
+ value: string | null;
8
+ }>>;
9
+ export default Altcha;
10
+ //# sourceMappingURL=Altcha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Altcha.d.ts","sourceRoot":"","sources":["../../../src/collection/components/Altcha.tsx"],"names":[],"mappings":"AASA,OAAO,QAAQ,CAAC;AAEhB,UAAU,WAAW;IACnB,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,WAAW,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,MAAM;WAAuB,MAAM,GAAG,IAAI;GAiD/C,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderCommonField.d.ts","sourceRoot":"","sources":["../../../../src/collection/components/renderer/RenderCommonField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAyCjE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6H5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"RenderCommonField.d.ts","sourceRoot":"","sources":["../../../../src/collection/components/renderer/RenderCommonField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AA0CjE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmI5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ILemaField } from '@levo-so/core';
2
1
  import { default as React } from 'react';
2
+ import { ILemaField } from '@levo-so/core';
3
3
  export interface ICheckboxWidgetProps {
4
4
  field: ILemaField;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxWidget.d.ts","sourceRoot":"","sources":["../../../../../src/collection/components/widgets/checkboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4IzD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CheckboxWidget.d.ts","sourceRoot":"","sources":["../../../../../src/collection/components/widgets/checkboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAWhD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoJzD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ILemaField } from '@levo-so/core';
2
+ export interface ICollectionWidgetM2MProps {
3
+ field: ILemaField;
4
+ }
5
+ export declare const CollectionWidgetM2M: React.FC<ICollectionWidgetM2MProps>;
6
+ export default CollectionWidgetM2M;
7
+ //# sourceMappingURL=CollectionWidgetM2M.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionWidgetM2M.d.ts","sourceRoot":"","sources":["../../../../../src/collection/components/widgets/collectionWidget/CollectionWidgetM2M.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA0BhD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwKnE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}