@levo-so/react 0.1.1 → 0.1.4

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 (59) hide show
  1. package/dist/{CheckboxWidget-ComdVcZ_.js → CheckboxWidget-Bnx-S2j2.js} +7 -7
  2. package/dist/{CollectionFormBuilder-jwwjyIpv.js → CollectionFormBuilder-B_dXpvPN.js} +114 -105
  3. package/dist/{CurrencyWidget-DVqD_lsY.js → CurrencyWidget-6Ov8DZpo.js} +6 -6
  4. package/dist/{DateTimeWidget-CvgzwY1U.js → DateTimeWidget-DI98zHMn.js} +7 -7
  5. package/dist/{DefaultFormVariant-CbRB9O_e.js → DefaultFormVariant-Bxbh1yc0.js} +22 -22
  6. package/dist/{DropdownWidget-C2YaM9Cf.js → DropdownWidget-DrMkD9vK.js} +2 -2
  7. package/dist/{EmailWidget-BBthwF68.js → EmailWidget-DHjXwVCL.js} +2 -2
  8. package/dist/{GeocoderWidget-Dht_2vi6.js → GeocoderWidget-D8GsLWkV.js} +83 -82
  9. package/dist/LevoProvider-Cp0CKrgY.js +212 -0
  10. package/dist/{MultiGeocoderWidget-paCFW0QZ.js → MultiGeocoderWidget-WzlKESyZ.js} +8 -8
  11. package/dist/{PhoneWidget-CP2T2JDx.js → PhoneWidget-DQSo_DPX.js} +9 -8
  12. package/dist/{RadioWidget-BuFPz7kK.js → RadioWidget-C8sTnz9B.js} +3 -3
  13. package/dist/{RichTextWidget-DGFNZ1jl.js → RichTextWidget-DOMiJ9pX.js} +2 -2
  14. package/dist/{Spinner-CuUosd-S.js → Spinner-DzGH5rKe.js} +49 -49
  15. package/dist/{StepsFormVariant-5_c3f2Vk.js → StepsFormVariant-CzS2wbMD.js} +8 -8
  16. package/dist/{SwitchWidget-t8iwhxk9.js → SwitchWidget-CBottoNO.js} +1 -1
  17. package/dist/TextWidget-Dg-ZYJI2.js +33 -0
  18. package/dist/{TextareaWidget-CG6J_plD.js → TextareaWidget-wsUSnO28.js} +6 -6
  19. package/dist/{ToggleCheckboxWidget-dl8ks4VX.js → ToggleCheckboxWidget-IeHYCie0.js} +1 -1
  20. package/dist/{URLWidget-CHeUEUXl.js → URLWidget-BsIEpzV3.js} +2 -2
  21. package/dist/{UploadWidget-CzYGViqE.js → UploadWidget-BJPmoAW-.js} +170 -168
  22. package/dist/audience/components/component.d.ts.map +1 -1
  23. package/dist/audience/index.js +1 -1
  24. package/dist/collection/components/CollectionFormBuilder.d.ts.map +1 -1
  25. package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +1 -1
  26. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
  27. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +1 -1
  28. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
  29. package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -1
  30. package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
  31. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
  32. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
  33. package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -1
  34. package/dist/collection/index.js +1 -1
  35. package/dist/collection/lib/FormBuilder.d.ts.map +1 -1
  36. package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
  37. package/dist/collection/utils/formHelpers.d.ts +2 -1
  38. package/dist/collection/utils/formHelpers.d.ts.map +1 -1
  39. package/dist/components/button/Button.d.ts.map +1 -1
  40. package/dist/components/index.js +1 -1
  41. package/dist/{index-wTf_TtOG.js → index-BFJ48R-4.js} +1 -1
  42. package/dist/index.css +1 -0
  43. package/dist/index.js +5 -5
  44. package/dist/libs.css +1 -0
  45. package/dist/libs.d.ts +1 -0
  46. package/dist/membership/components/OAuth/Button.d.ts +1 -1
  47. package/dist/membership/components/OAuth/Button.d.ts.map +1 -1
  48. package/dist/membership/components/OAuth/Container.d.ts +1 -1
  49. package/dist/membership/components/OAuth/Container.d.ts.map +1 -1
  50. package/dist/membership/index.js +1 -1
  51. package/dist/page-YRcNFGqi.js +205 -0
  52. package/dist/providers/LevoProvider.d.ts +7 -7
  53. package/dist/providers/LevoProvider.d.ts.map +1 -1
  54. package/dist/{useLevoForm-BcN8f66y.js → useLevoForm-HS_d5OoW.js} +7 -7
  55. package/package.json +72 -71
  56. package/dist/LevoProvider-DNbYyEaf.js +0 -21
  57. package/dist/TextWidget-D0UBxTxe.js +0 -33
  58. package/dist/page-CxaKoH22.js +0 -205
  59. package/dist/style.css +0 -1
@@ -1,38 +1,38 @@
1
1
  "use client";
2
- import { j as r } from "./jsx-runtime-B6kdoens.js";
2
+ import { j as a } from "./jsx-runtime-B6kdoens.js";
3
3
  import { createSrcSet as f, MediaKindList as k } from "@levo-so/core";
4
- import { useMemo as Q, useState as S, useRef as aa, useEffect as D } from "react";
5
- import { useController as ra } from "react-hook-form";
6
- import { G as R, B as I, S as W, T as ta, a as sa, c as q, d as G } from "./Spinner-CuUosd-S.js";
7
- import { X as ea, Upload as M } from "lucide-react";
8
- import { h as oa, j as ca, k as na } from "./CollectionFormBuilder-jwwjyIpv.js";
9
- import { I as X } from "./Input-2CvZ90f8.js";
10
- import { l as la, S as K, i as da } from "./Tooltip-CI4i4mYr.js";
11
- import { useDropzone as xa } from "react-dropzone";
12
- import { m as ia, g as F } from "./fileUploadPresets-2raQmHT0.js";
4
+ import { X as rr, Upload as D, ExternalLink as ar } from "lucide-react";
5
+ import { useMemo as Q, useState as S, useRef as tr, useEffect as M } from "react";
6
+ import { useController as sr } from "react-hook-form";
7
+ import { G as R, B as P, S as W, T as er, a as or, c as q, d as G } from "./Spinner-DzGH5rKe.js";
8
+ import { m as cr, g as K } from "./fileUploadPresets-2raQmHT0.js";
9
+ import { u as V } from "./LevoProvider-Cp0CKrgY.js";
10
+ import { e as X } from "./errorHandler-BJcFS2qV.js";
11
+ import { h as nr, j as lr, k as dr } from "./CollectionFormBuilder-B_dXpvPN.js";
12
+ import { I as J } from "./Input-2CvZ90f8.js";
13
+ import { l as ir, S as F, i as xr } from "./Tooltip-CI4i4mYr.js";
14
+ import { useDropzone as pr } from "react-dropzone";
13
15
  import { e as O } from "./Sonner-t6JVKA0a.js";
14
- import { c as P } from "./cn-C9QoOYNG.js";
15
- import { u as V } from "./LevoProvider-DNbYyEaf.js";
16
- import { e as J } from "./errorHandler-BJcFS2qV.js";
17
- import { useDebouncedCallback as pa } from "use-debounce";
18
- import { C as ma } from "./Checbox-sq-atGlJ.js";
19
- import { b as ha } from "./byteToSize-BFKZSBu1.js";
16
+ import { c as I } from "./cn-C9QoOYNG.js";
17
+ import { useDebouncedCallback as hr } from "use-debounce";
18
+ import { b as mr } from "./byteToSize-BFKZSBu1.js";
19
+ import { C as ur } from "./Checbox-sq-atGlJ.js";
20
20
  function $(e) {
21
21
  return R({ 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: [] }] })(e);
22
22
  }
23
- function ua(e) {
23
+ function gr(e) {
24
24
  return R({ 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: [] }] })(e);
25
25
  }
26
- function ga(e) {
26
+ function jr(e) {
27
27
  return R({ 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: [] }] })(e);
28
28
  }
29
- const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
29
+ const yr = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
30
30
  const { media: c } = V(), n = Array.isArray(o) ? o : [], _ = Q(() => {
31
31
  let t = {};
32
- return j.forEach((m) => {
32
+ return j.forEach((h) => {
33
33
  t = {
34
34
  ...t,
35
- ...ia[m]
35
+ ...cr[h]
36
36
  };
37
37
  }), t;
38
38
  }, [j]), g = (t) => {
@@ -42,42 +42,42 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
42
42
  O("No file selected. Please select one file.");
43
43
  return;
44
44
  }
45
- const m = new FormData();
45
+ const h = new FormData();
46
46
  t == null || t.forEach((p) => {
47
- m.append("media", p);
48
- }), await (c == null ? void 0 : c.mediaBulkUpload(m).then((p) => {
49
- var h, E;
50
- const w = (E = (h = p == null ? void 0 : p.content) == null ? void 0 : h.data) == null ? void 0 : E.map(
51
- (a) => {
47
+ h.append("media", p);
48
+ }), await (c == null ? void 0 : c.mediaBulkUpload(h).then((p) => {
49
+ var m, E;
50
+ const w = (E = (m = p == null ? void 0 : p.content) == null ? void 0 : m.data) == null ? void 0 : E.map(
51
+ (r) => {
52
52
  var l;
53
53
  return {
54
- id: a == null ? void 0 : a.id,
55
- kind: a == null ? void 0 : a.kind,
56
- location: a == null ? void 0 : a.location,
57
- mimetype: (l = a == null ? void 0 : a.metadata) == null ? void 0 : l.mimetype,
58
- srcset: a == null ? void 0 : a.srcset
54
+ id: r == null ? void 0 : r.id,
55
+ kind: r == null ? void 0 : r.kind,
56
+ location: r == null ? void 0 : r.location,
57
+ mimetype: (l = r == null ? void 0 : r.metadata) == null ? void 0 : l.mimetype,
58
+ srcset: r == null ? void 0 : r.srcset
59
59
  };
60
60
  }
61
61
  );
62
62
  g([...n, ...w]);
63
- }).catch(J));
64
- }, { getRootProps: z, getInputProps: i, isDragActive: v } = xa({
63
+ }).catch(X));
64
+ }, { getRootProps: z, getInputProps: x, isDragActive: v } = pr({
65
65
  onDrop: y,
66
66
  accept: _,
67
67
  multiple: d,
68
68
  maxSize: 25 * 1024 * 1024,
69
69
  onDropRejected: (t) => {
70
- t.forEach((m) => {
71
- m.errors.forEach((p) => {
72
- p.code === "file-too-large" && O(`${m.file.name} is bigger than 25MB`);
70
+ t.forEach((h) => {
71
+ h.errors.forEach((p) => {
72
+ p.code === "file-too-large" && O(`${h.file.name} is bigger than 25MB`);
73
73
  });
74
74
  });
75
75
  }
76
76
  });
77
- return /* @__PURE__ */ r.jsx(la, { children: /* @__PURE__ */ r.jsx("div", { className: "w-full min-h-[150px]", children: (n == null ? void 0 : n.length) > 0 ? /* @__PURE__ */ r.jsxs("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fit,_minmax(150px,_1fr))]", children: [
77
+ return /* @__PURE__ */ a.jsx(ir, { children: /* @__PURE__ */ a.jsx("div", { className: "w-full min-h-[150px]", children: (n == null ? void 0 : n.length) > 0 ? /* @__PURE__ */ a.jsxs("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fit,_minmax(150px,_1fr))]", children: [
78
78
  n == null ? void 0 : n.map((t) => {
79
- var m, p;
80
- return /* @__PURE__ */ r.jsxs(
79
+ var h, p;
80
+ return /* @__PURE__ */ a.jsxs(
81
81
  "div",
82
82
  {
83
83
  className: "group relative w-full overflow-hidden h-auto max-[350px] rounded-md border border-gray-300",
@@ -85,31 +85,31 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
85
85
  background: "linear-gradient(to top, black -50%, transparent 45%)"
86
86
  },
87
87
  children: [
88
- (t == null ? void 0 : t.kind) !== "image" ? /* @__PURE__ */ r.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ r.jsx(
88
+ (t == null ? void 0 : t.kind) !== "image" ? /* @__PURE__ */ a.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ a.jsx(
89
89
  $,
90
90
  {
91
91
  size: "60px",
92
92
  className: "text-gray-400 p-2"
93
93
  }
94
- ) }) : /* @__PURE__ */ r.jsx(
94
+ ) }) : /* @__PURE__ */ a.jsx(
95
95
  "img",
96
96
  {
97
97
  className: "w-full h-full object-contain",
98
98
  src: t == null ? void 0 : t.location
99
99
  }
100
100
  ),
101
- /* @__PURE__ */ r.jsx(
101
+ /* @__PURE__ */ a.jsx(
102
102
  "div",
103
103
  {
104
- className: P(
104
+ className: I(
105
105
  "absolute left-0 right-0 bottom-0 h-16 bg-[linear-gradient(to-t,_rgba(0,_0,_10,_0.35),_transparent)]",
106
106
  "group-hover:bg-[linear-gradient(to-t,_rgba(0,0,10,0.5),_transparent)] group-hover:h-[70%]"
107
107
  )
108
108
  }
109
109
  ),
110
- /* @__PURE__ */ r.jsx("p", { className: "absolute left-4 bottom-2 text-base text-white", children: (p = t == null ? void 0 : t.location) == null ? void 0 : p.split("/")[((m = t == null ? void 0 : t.location) == null ? void 0 : m.split("/").length) - 1] }),
111
- /* @__PURE__ */ r.jsx(
112
- I,
110
+ /* @__PURE__ */ a.jsx("p", { className: "absolute left-4 bottom-2 text-base text-white", children: (p = t == null ? void 0 : t.location) == null ? void 0 : p.split("/")[((h = t == null ? void 0 : t.location) == null ? void 0 : h.split("/").length) - 1] }),
111
+ /* @__PURE__ */ a.jsx(
112
+ P,
113
113
  {
114
114
  className: "absolute right-4 top-4 z-10",
115
115
  size: "icon",
@@ -119,7 +119,7 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
119
119
  n == null ? void 0 : n.filter((w) => (w == null ? void 0 : w.id) !== (t == null ? void 0 : t.id))
120
120
  );
121
121
  },
122
- children: /* @__PURE__ */ r.jsx(ea, { className: "text-primary" })
122
+ children: /* @__PURE__ */ a.jsx(rr, { className: "text-primary" })
123
123
  }
124
124
  )
125
125
  ]
@@ -127,175 +127,175 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
127
127
  t == null ? void 0 : t.id
128
128
  );
129
129
  }),
130
- d && /* @__PURE__ */ r.jsxs(
130
+ d && /* @__PURE__ */ a.jsxs(
131
131
  "div",
132
132
  {
133
133
  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",
134
134
  ...z(),
135
135
  children: [
136
- /* @__PURE__ */ r.jsx("p", { className: "text-xl text-center my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
137
- /* @__PURE__ */ r.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ r.jsx(K, { label: "Upload a file", children: /* @__PURE__ */ r.jsxs(I, { size: "icon", className: "text-md", children: [
138
- /* @__PURE__ */ r.jsx("input", { ...i() }),
139
- /* @__PURE__ */ r.jsx(M, { size: 20 })
136
+ /* @__PURE__ */ a.jsx("p", { className: "text-xl text-center my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
137
+ /* @__PURE__ */ a.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ a.jsx(F, { label: "Upload a file", children: /* @__PURE__ */ a.jsxs(P, { size: "icon", className: "text-md", children: [
138
+ /* @__PURE__ */ a.jsx("input", { ...x() }),
139
+ /* @__PURE__ */ a.jsx(D, { size: 20 })
140
140
  ] }) }) })
141
141
  ]
142
142
  }
143
143
  )
144
- ] }) : /* @__PURE__ */ r.jsxs(
144
+ ] }) : /* @__PURE__ */ a.jsxs(
145
145
  "div",
146
146
  {
147
147
  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",
148
148
  ...z(),
149
149
  children: [
150
- /* @__PURE__ */ r.jsx("p", { className: "text-xl my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
151
- /* @__PURE__ */ r.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ r.jsx(K, { label: "Upload a file", children: /* @__PURE__ */ r.jsxs(I, { size: "icon", className: "text-md", children: [
152
- /* @__PURE__ */ r.jsx("input", { ...i() }),
153
- /* @__PURE__ */ r.jsx(M, { size: 20 })
150
+ /* @__PURE__ */ a.jsx("p", { className: "text-xl my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
151
+ /* @__PURE__ */ a.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ a.jsx(F, { label: "Upload a file", children: /* @__PURE__ */ a.jsxs(P, { size: "icon", className: "text-md", children: [
152
+ /* @__PURE__ */ a.jsx("input", { ...x() }),
153
+ /* @__PURE__ */ a.jsx(D, { size: 20 })
154
154
  ] }) }) })
155
155
  ]
156
156
  }
157
157
  ) }) });
158
- }, ya = ({
158
+ }, br = ({
159
159
  selectedFiles: e = [],
160
160
  onChange: o,
161
161
  isMultiple: j = !1,
162
162
  kind: d
163
163
  }) => {
164
- const { media: c } = V(), [n, _] = S(1), [g, y] = S([]), [z, i] = S(!1), v = aa(null), [t, m] = S({
164
+ const { media: c } = V(), [n, _] = S(1), [g, y] = S([]), [z, x] = S(!1), v = tr(null), [t, h] = S({
165
165
  searchText: "",
166
166
  currentPage: 1
167
- }), p = pa(() => {
168
- i(!0), c == null || c.getAllMedia({
167
+ }), p = hr(() => {
168
+ x(!0), c == null || c.getAllMedia({
169
169
  page: t.currentPage,
170
170
  limit: 24,
171
171
  sort: {
172
172
  created_at: "desc"
173
173
  },
174
174
  search: t.searchText || void 0
175
- }).then((a) => {
175
+ }).then((r) => {
176
176
  var l, A;
177
- _((A = (l = a == null ? void 0 : a.content) == null ? void 0 : l.meta) == null ? void 0 : A.pages), y((L) => {
177
+ _((A = (l = r == null ? void 0 : r.content) == null ? void 0 : l.meta) == null ? void 0 : A.pages), y((L) => {
178
178
  var b;
179
- return [...L, ...((b = a == null ? void 0 : a.content) == null ? void 0 : b.data) || []];
179
+ return [...L, ...((b = r == null ? void 0 : r.content) == null ? void 0 : b.data) || []];
180
180
  });
181
- }).catch((a) => {
182
- console.error(a);
181
+ }).catch((r) => {
182
+ console.error(r);
183
183
  }).finally(() => {
184
- i(!1);
184
+ x(!1);
185
185
  });
186
186
  }, 500);
187
- D(() => {
187
+ M(() => {
188
188
  p();
189
- }, [t]), D(() => {
190
- const a = v.current;
191
- if (a)
192
- return a.addEventListener("scroll", w), () => a.removeEventListener("scroll", w);
189
+ }, [t]), M(() => {
190
+ const r = v.current;
191
+ if (r)
192
+ return r.addEventListener("scroll", w), () => r.removeEventListener("scroll", w);
193
193
  }, [v, t.currentPage, n]);
194
194
  const w = () => {
195
- const a = v.current;
196
- a && a.scrollTop + a.clientHeight + 1 >= a.scrollHeight && h();
197
- }, h = () => {
198
- t.currentPage < n && m((a) => ({
199
- searchText: a.searchText,
200
- currentPage: a.currentPage + 1
195
+ const r = v.current;
196
+ r && r.scrollTop + r.clientHeight + 1 >= r.scrollHeight && m();
197
+ }, m = () => {
198
+ t.currentPage < n && h((r) => ({
199
+ searchText: r.searchText,
200
+ currentPage: r.currentPage + 1
201
201
  }));
202
- }, E = (a) => {
203
- if (!(d != null && d.includes(a == null ? void 0 : a.kind))) {
202
+ }, E = (r) => {
203
+ if (!(d != null && d.includes(r == null ? void 0 : r.kind))) {
204
204
  O(`Only ${d == null ? void 0 : d.join(", ")}s are allowed.`);
205
205
  return;
206
206
  }
207
- j ? (e == null ? void 0 : e.findIndex((l) => (l == null ? void 0 : l.id) === (a == null ? void 0 : a.id))) >= 0 ? o == null || o(e == null ? void 0 : e.filter((l) => (l == null ? void 0 : l.id) !== (a == null ? void 0 : a.id))) : o == null || o([...e || [], a]) : o == null || o([a]);
207
+ j ? (e == null ? void 0 : e.findIndex((l) => (l == null ? void 0 : l.id) === (r == null ? void 0 : r.id))) >= 0 ? o == null || o(e == null ? void 0 : e.filter((l) => (l == null ? void 0 : l.id) !== (r == null ? void 0 : r.id))) : o == null || o([...e || [], r]) : o == null || o([r]);
208
208
  };
209
- return /* @__PURE__ */ r.jsxs("div", { className: "bg-white p-0 rounded-md w-full relative", children: [
210
- /* @__PURE__ */ r.jsx("div", { className: "py-2 bg-white sticky top-0 z-50 w-full", children: /* @__PURE__ */ r.jsx(
211
- X,
209
+ return /* @__PURE__ */ a.jsxs("div", { className: "bg-white p-0 rounded-md w-full relative", children: [
210
+ /* @__PURE__ */ a.jsx("div", { className: "py-2 bg-white sticky top-0 z-50 w-full", children: /* @__PURE__ */ a.jsx(
211
+ J,
212
212
  {
213
213
  name: "searchText",
214
214
  type: "text",
215
215
  placeholder: "Search...",
216
216
  value: t.searchText,
217
- onChange: (a) => {
218
- i(!0), m({ currentPage: 1, searchText: a.target.value }), y([]);
217
+ onChange: (r) => {
218
+ x(!0), h({ currentPage: 1, searchText: r.target.value }), y([]);
219
219
  }
220
220
  }
221
221
  ) }),
222
- z && !g.length ? /* @__PURE__ */ r.jsx("div", { className: "w-full h-full min-h-[30rem] flex items-center justify-center", children: /* @__PURE__ */ r.jsx(W, {}) }) : /* @__PURE__ */ r.jsxs(
222
+ z && !g.length ? /* @__PURE__ */ a.jsx("div", { className: "w-full h-full min-h-[30rem] flex items-center justify-center", children: /* @__PURE__ */ a.jsx(W, {}) }) : /* @__PURE__ */ a.jsxs(
223
223
  "div",
224
224
  {
225
225
  ref: v,
226
226
  className: "w-full h-[30rem] overflow-y-auto overflow-x-hidden grid lg:grid-cols-4 gap-6 p-2",
227
227
  children: [
228
- g == null ? void 0 : g.map((a, l) => {
229
- const A = d == null ? void 0 : d.includes(a == null ? void 0 : a.kind), L = (e == null ? void 0 : e.findIndex((b) => (b == null ? void 0 : b.id) === (a == null ? void 0 : a.id))) >= 0;
230
- return /* @__PURE__ */ r.jsxs(
228
+ g == null ? void 0 : g.map((r, l) => {
229
+ const A = d == null ? void 0 : d.includes(r == null ? void 0 : r.kind), L = (e == null ? void 0 : e.findIndex((b) => (b == null ? void 0 : b.id) === (r == null ? void 0 : r.id))) >= 0;
230
+ return /* @__PURE__ */ a.jsxs(
231
231
  "div",
232
232
  {
233
- className: P(
233
+ className: I(
234
234
  "relative w-full",
235
235
  A ? "opacity-100" : "opacity-50"
236
236
  ),
237
237
  children: [
238
- /* @__PURE__ */ r.jsxs(
238
+ /* @__PURE__ */ a.jsxs(
239
239
  "div",
240
240
  {
241
- className: P(
241
+ className: I(
242
242
  "cursor-pointer w-full group rounded-md overflow-hidden h-[130px] border-2 flex items-center justify-center",
243
243
  L ? "border-primary" : "border-gray-100"
244
244
  ),
245
245
  onClick: () => {
246
246
  var b;
247
247
  return E({
248
- id: a == null ? void 0 : a.id,
249
- location: a == null ? void 0 : a.location,
250
- mimetype: (b = a == null ? void 0 : a.metadata) == null ? void 0 : b.mimetype,
251
- kind: a == null ? void 0 : a.kind,
252
- srcset: a == null ? void 0 : a.srcset
248
+ id: r == null ? void 0 : r.id,
249
+ location: r == null ? void 0 : r.location,
250
+ mimetype: (b = r == null ? void 0 : r.metadata) == null ? void 0 : b.mimetype,
251
+ kind: r == null ? void 0 : r.kind,
252
+ srcset: r == null ? void 0 : r.srcset
253
253
  });
254
254
  },
255
255
  children: [
256
- /* @__PURE__ */ r.jsx(
256
+ /* @__PURE__ */ a.jsx(
257
257
  "div",
258
258
  {
259
- className: P(
259
+ className: I(
260
260
  "rounded-md opacity-0 absolute left-0 right-0 top-0 w-full h-[42px] bg-[linear-gradient(0deg,_transparent_0%,_#000000_200%)]",
261
261
  A ? "group-hover:opacity-100" : ""
262
262
  )
263
263
  }
264
264
  ),
265
- A && /* @__PURE__ */ r.jsx(
266
- ma,
265
+ A && /* @__PURE__ */ a.jsx(
266
+ ur,
267
267
  {
268
268
  name: "isFileIncluded",
269
269
  className: "absolute top-[10px] left-[10px]",
270
270
  checked: L
271
271
  }
272
272
  ),
273
- (a == null ? void 0 : a.kind) !== "image" ? /* @__PURE__ */ r.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ r.jsx(
273
+ (r == null ? void 0 : r.kind) !== "image" ? /* @__PURE__ */ a.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ a.jsx(
274
274
  "img",
275
275
  {
276
276
  className: "w-full h-full object-contain",
277
- srcSet: f(a == null ? void 0 : a.srcset),
278
- src: a == null ? void 0 : a.location
277
+ srcSet: f(r == null ? void 0 : r.srcset),
278
+ src: r == null ? void 0 : r.location
279
279
  }
280
280
  )
281
281
  ]
282
282
  }
283
283
  ),
284
- /* @__PURE__ */ r.jsxs("div", { className: "my-[10px]", children: [
285
- /* @__PURE__ */ r.jsx("p", { className: "text-sm whitespace-nowrap overflow-hidden text-ellipsis", children: a == null ? void 0 : a.filename }),
286
- /* @__PURE__ */ r.jsx("p", { className: "text-xs text-gray-500", children: ha(a == null ? void 0 : a.metadata.size) })
284
+ /* @__PURE__ */ a.jsxs("div", { className: "my-[10px]", children: [
285
+ /* @__PURE__ */ a.jsx("p", { className: "text-sm whitespace-nowrap overflow-hidden text-ellipsis", children: r == null ? void 0 : r.filename }),
286
+ /* @__PURE__ */ a.jsx("p", { className: "text-xs text-gray-500", children: mr(r == null ? void 0 : r.metadata.size) })
287
287
  ] })
288
288
  ]
289
289
  },
290
290
  `media-layout-file-${l}`
291
291
  );
292
292
  }),
293
- z && /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ r.jsx(W, {}) })
293
+ z && /* @__PURE__ */ a.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ a.jsx(W, {}) })
294
294
  ]
295
295
  }
296
296
  )
297
297
  ] });
298
- }, ba = ({
298
+ }, vr = ({
299
299
  isOpen: e,
300
300
  onClose: o,
301
301
  onChange: j,
@@ -307,35 +307,35 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
307
307
  const [g, y] = S([]), z = () => {
308
308
  o();
309
309
  };
310
- return D(() => {
311
- y(d.filter((i) => !!i.location));
312
- }, [d]), /* @__PURE__ */ r.jsxs(
313
- da,
310
+ return M(() => {
311
+ y(d.filter((x) => !!x.location));
312
+ }, [d]), /* @__PURE__ */ a.jsxs(
313
+ xr,
314
314
  {
315
315
  title: (c == null ? void 0 : c.length) > 1 ? "Upload file" : `Upload ${c == null ? void 0 : c[0]}`,
316
316
  isOpen: e,
317
317
  onClose: () => z(),
318
318
  contentClassName: "max-w-[60%]",
319
319
  children: [
320
- /* @__PURE__ */ r.jsxs(ta, { defaultValue: "upload", children: [
321
- /* @__PURE__ */ r.jsxs(sa, { children: [
322
- /* @__PURE__ */ r.jsx(q, { value: "upload", children: "Local File" }),
323
- !_ && /* @__PURE__ */ r.jsx(q, { value: "import", children: "Import from Gallery" })
320
+ /* @__PURE__ */ a.jsxs(er, { defaultValue: "upload", children: [
321
+ /* @__PURE__ */ a.jsxs(or, { children: [
322
+ /* @__PURE__ */ a.jsx(q, { value: "upload", children: "Local File" }),
323
+ !_ && /* @__PURE__ */ a.jsx(q, { value: "import", children: "Import from Gallery" })
324
324
  ] }),
325
- /* @__PURE__ */ r.jsx(G, { value: "upload", children: /* @__PURE__ */ r.jsx("div", { className: "mt-[20px] max-h-[70vh] overflow-y-auto", children: /* @__PURE__ */ r.jsx(
326
- ja,
325
+ /* @__PURE__ */ a.jsx(G, { value: "upload", children: /* @__PURE__ */ a.jsx("div", { className: "mt-[20px] max-h-[70vh] overflow-y-auto", children: /* @__PURE__ */ a.jsx(
326
+ yr,
327
327
  {
328
328
  kind: c,
329
329
  value: g,
330
- onChange: (i) => y(i),
330
+ onChange: (x) => y(x),
331
331
  isMultiple: n
332
332
  }
333
333
  ) }) }),
334
- /* @__PURE__ */ r.jsx(G, { value: "import", children: /* @__PURE__ */ r.jsx(
335
- ya,
334
+ /* @__PURE__ */ a.jsx(G, { value: "import", children: /* @__PURE__ */ a.jsx(
335
+ br,
336
336
  {
337
- onChange: (i) => {
338
- y == null || y(i);
337
+ onChange: (x) => {
338
+ y == null || y(x);
339
339
  },
340
340
  selectedFiles: g,
341
341
  isMultiple: n,
@@ -343,8 +343,8 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
343
343
  }
344
344
  ) })
345
345
  ] }),
346
- /* @__PURE__ */ r.jsx("div", { className: "flex justify-end mt-[20px]", children: /* @__PURE__ */ r.jsx(
347
- I,
346
+ /* @__PURE__ */ a.jsx("div", { className: "flex justify-end mt-[20px]", children: /* @__PURE__ */ a.jsx(
347
+ P,
348
348
  {
349
349
  variant: "default",
350
350
  onClick: () => {
@@ -356,7 +356,7 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
356
356
  ]
357
357
  }
358
358
  );
359
- }, Va = ({
359
+ }, $r = ({
360
360
  field: e,
361
361
  kind: o = k,
362
362
  isMultiple: j,
@@ -364,110 +364,112 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
364
364
  }) => {
365
365
  var H;
366
366
  const { media: c } = V(), { key: n = "", label: _ = "", helper_text: g = "", readonly: y = !1 } = e, {
367
- field: { onBlur: z, onChange: i, value: v, disabled: t, ref: m },
367
+ field: { onBlur: z, onChange: x, value: v, disabled: t, ref: h },
368
368
  fieldState: p
369
- } = ra({
369
+ } = sr({
370
370
  name: n,
371
- rules: oa(e)
371
+ rules: nr(e)
372
372
  }), w = Q(() => {
373
373
  const s = [];
374
374
  return o.forEach((T) => {
375
- s.push(...F[T]);
375
+ s.push(...K[T]);
376
376
  }), s;
377
- }, [o]), h = v ? Array.isArray(v) ? v : [v] : [], [E, a] = S(!1), l = () => a(!0), A = () => a(!1), [L, b] = S(!1), U = (s) => {
378
- i && (j === !0 ? i(s) : j === !1 && i(s == null ? void 0 : s[0]));
377
+ }, [o]), m = v ? Array.isArray(v) ? v : [v] : [], [E, r] = S(!1), l = () => r(!0), A = () => r(!1), [L, b] = S(!1), U = (s) => {
378
+ x && (j === !0 ? x(s) : j === !1 && x(s == null ? void 0 : s[0]));
379
379
  }, Y = async (s) => {
380
380
  const T = new FormData();
381
- let x = [...s];
382
- j || (x = s == null ? void 0 : s.slice(0, 1)), (x == null ? void 0 : x.length) > 0 && (x == null || x.forEach((u) => {
381
+ let i = [...s];
382
+ j || (i = s == null ? void 0 : s.slice(0, 1)), (i == null ? void 0 : i.length) > 0 && (i == null || i.forEach((u) => {
383
383
  var C;
384
384
  const N = u.name.split("."), B = (C = N[N.length - 1]) == null ? void 0 : C.toLowerCase();
385
385
  o == null || o.forEach((Z) => {
386
- w.push(...F[Z]);
386
+ w.push(...K[Z]);
387
387
  }), B && w.includes(B) && T.append("media", u);
388
388
  })), b(!0), await (c == null ? void 0 : c.mediaBulkUpload(T).then((u) => {
389
389
  var N, B;
390
390
  b(!1), (N = u == null ? void 0 : u.content) != null && N.data && U((B = u == null ? void 0 : u.content) == null ? void 0 : B.data);
391
391
  }).catch((u) => {
392
- J(u);
392
+ X(u);
393
393
  }).finally(() => {
394
394
  b(!1);
395
395
  }));
396
396
  };
397
- return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
398
- /* @__PURE__ */ r.jsx(
399
- ba,
397
+ return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
398
+ /* @__PURE__ */ a.jsx(
399
+ vr,
400
400
  {
401
401
  isOpen: E,
402
402
  onClose: A,
403
403
  onChange: (s) => {
404
404
  U(s);
405
405
  },
406
- value: h,
406
+ value: m,
407
407
  kind: [...o],
408
408
  isMultiple: j,
409
409
  isExternal: d
410
410
  }
411
411
  ),
412
- /* @__PURE__ */ r.jsxs(
413
- ca,
412
+ /* @__PURE__ */ a.jsxs(
413
+ lr,
414
414
  {
415
415
  error: (H = p == null ? void 0 : p.error) == null ? void 0 : H.message,
416
416
  helperText: g,
417
417
  readOnly: y,
418
418
  children: [
419
- _ && /* @__PURE__ */ r.jsx(na, { htmlFor: n, isRequired: e == null ? void 0 : e.required, children: _ }),
420
- /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2", ref: m, children: [
421
- /* @__PURE__ */ r.jsx(
422
- I,
419
+ _ && /* @__PURE__ */ a.jsx(dr, { htmlFor: n, isRequired: e == null ? void 0 : e.required, children: _ }),
420
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2", ref: h, children: [
421
+ /* @__PURE__ */ a.jsx(
422
+ P,
423
423
  {
424
424
  size: "icon-small",
425
425
  variant: "outline",
426
426
  disabled: t,
427
427
  onClick: l,
428
- children: /* @__PURE__ */ r.jsx(M, { size: 15 })
428
+ children: /* @__PURE__ */ a.jsx(D, { size: 15 })
429
429
  }
430
430
  ),
431
- /* @__PURE__ */ r.jsxs("div", { className: "relative flex", children: [
432
- /* @__PURE__ */ r.jsx(
433
- X,
431
+ /* @__PURE__ */ a.jsxs("div", { className: "relative flex", children: [
432
+ /* @__PURE__ */ a.jsx(
433
+ J,
434
434
  {
435
435
  name: "pasteUrl",
436
+ placeholder: "Paste your files here...",
436
437
  onBlur: () => z(),
437
438
  onPaste: (s) => {
438
- const T = s.clipboardData.items, x = [];
439
+ const T = s.clipboardData.items, i = [];
439
440
  for (let u = 0; u < T.length; u++) {
440
441
  const N = T[u];
441
442
  if ((N == null ? void 0 : N.kind) === "file") {
442
443
  const B = N == null ? void 0 : N.getAsFile();
443
- B && x.push(B);
444
+ B && i.push(B);
444
445
  }
445
446
  }
446
- (x == null ? void 0 : x.length) > 0 && Y(x);
447
+ (i == null ? void 0 : i.length) > 0 && Y(i);
447
448
  },
448
449
  disabled: t,
449
450
  readOnly: y
450
451
  }
451
452
  ),
452
- L && /* @__PURE__ */ r.jsxs(
453
+ L && /* @__PURE__ */ a.jsxs(
453
454
  "div",
454
455
  {
455
456
  role: "status",
456
457
  className: "absolute right-3 top-[50%] translate-y-[-50%]",
457
458
  children: [
458
- /* @__PURE__ */ r.jsx(ua, {}),
459
- /* @__PURE__ */ r.jsx("span", { className: "sr-only", children: "Loading..." })
459
+ /* @__PURE__ */ a.jsx(gr, {}),
460
+ /* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Loading..." })
460
461
  ]
461
462
  }
462
463
  )
463
464
  ] })
464
465
  ] }),
465
- (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ r.jsx("div", { className: "mt-3 w-full", children: /* @__PURE__ */ r.jsx("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fill,_minmax(100px,_1fr))]", children: h == null ? void 0 : h.map((s, T) => s != null && s.location ? /* @__PURE__ */ r.jsxs(
466
+ (m == null ? void 0 : m.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: m == null ? void 0 : m.map((s, T) => s != null && s.location ? /* @__PURE__ */ a.jsxs(
466
467
  "div",
467
468
  {
468
- className: "relative border overflow-hidden group w-full rounded-xl h-[120px] flex items-center justify-center",
469
+ className: "relative border overflow-hidden group w-full rounded-xl h-28 flex items-center justify-center",
469
470
  children: [
470
- (s == null ? void 0 : s.kind) !== "image" ? /* @__PURE__ */ r.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ r.jsx(
471
+ /* @__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: s == null ? void 0 : s.location, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ a.jsx(ar, { size: 24 }) }) }),
472
+ (s == null ? void 0 : s.kind) !== "image" ? /* @__PURE__ */ a.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ a.jsx(
471
473
  "img",
472
474
  {
473
475
  className: "w-full h-full object-contain",
@@ -475,17 +477,17 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
475
477
  alt: s == null ? void 0 : s.id
476
478
  }
477
479
  ),
478
- /* @__PURE__ */ r.jsx(
480
+ /* @__PURE__ */ a.jsx(
479
481
  "button",
480
482
  {
481
- className: "absolute top-1 right-1 bg-white p-1 rounded-full focus:outline-none",
483
+ className: "absolute z-10 top-1 right-1 bg-white p-1 rounded-full focus:outline-none",
482
484
  onClick: () => {
483
485
  U(
484
- h == null ? void 0 : h.filter((x) => (x == null ? void 0 : x.id) !== (s == null ? void 0 : s.id))
486
+ m == null ? void 0 : m.filter((i) => (i == null ? void 0 : i.id) !== (s == null ? void 0 : s.id))
485
487
  );
486
488
  },
487
489
  type: "button",
488
- children: /* @__PURE__ */ r.jsx(ga, { className: "text-sm" })
490
+ children: /* @__PURE__ */ a.jsx(jr, { className: "text-sm" })
489
491
  }
490
492
  )
491
493
  ]
@@ -498,6 +500,6 @@ const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
498
500
  ] });
499
501
  };
500
502
  export {
501
- Va as UploadWidget,
502
- Va as default
503
+ $r as UploadWidget,
504
+ $r as default
503
505
  };