@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.
- package/dist/CheckboxWidget-CNoS-2W3.js +124 -0
- package/dist/CollectionFormBuilder-MAo2Ob3a.js +1199 -0
- package/dist/{CurrencyWidget-COoMkfsA.js → CurrencyWidget-Cu1Cthnw.js} +5 -5
- package/dist/{DateTimeWidget-DcbQ3smI.js → DateTimeWidget-N-wuCRSJ.js} +3 -3
- package/dist/DefaultFormVariant-IqWi1BiT.js +81 -0
- package/dist/DropdownWidget-BFttB4b-.js +115 -0
- package/dist/{EmailWidget-CG9oNUM5.js → EmailWidget-D_SqXx3M.js} +11 -11
- package/dist/FormCaptcha-CJ9KgDu0.js +197 -0
- package/dist/GeocoderWidget-Bxt3TeAf.js +68 -0
- package/dist/LevoProvider-BAZy7_tP.js +223 -0
- package/dist/{MultiGeocoderWidget-D3Xmv8g4.js → MultiGeocoderWidget-DFjuXZBN.js} +6 -6
- package/dist/{MultiTextWidget-CyQRcWC8.js → MultiTextWidget-CZzT51cH.js} +14 -14
- package/dist/{PhoneWidget-C1Jt7kXL.js → PhoneWidget--K5aS16s.js} +5 -5
- package/dist/{RadioWidget-BrLNF-I2.js → RadioWidget-BbMPtR3P.js} +9 -9
- package/dist/{RichTextWidget-BogYcPtS.js → RichTextWidget-Cce3Bw8d.js} +21 -21
- package/dist/Spinner-Bzu2xCFZ.js +405 -0
- package/dist/{StepsFormVariant-Bx-jdciC.js → StepsFormVariant-5wZbYAA9.js} +58 -55
- package/dist/{SwitchWidget-BT0-waP9.js → SwitchWidget-B0wkSWxa.js} +5 -5
- package/dist/{TextWidget-Bvsz-hey.js → TextWidget-ldbMuLB0.js} +7 -7
- package/dist/{TextareaWidget-8SLym--T.js → TextareaWidget-S8bKUTv0.js} +3 -3
- package/dist/{ToggleCheckboxWidget-VrCQBF5C.js → ToggleCheckboxWidget-CPduXE6Y.js} +7 -7
- package/dist/Tooltip-DEBnSqlo.js +36 -0
- package/dist/{URLWidget-B99nKr6N.js → URLWidget-KbhE2ZUA.js} +2 -2
- package/dist/UploadWidget-DFvfDUT6.js +616 -0
- package/dist/audience/components/block.d.ts.map +1 -1
- package/dist/audience/components/component.d.ts.map +1 -1
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/components/Altcha.d.ts +10 -0
- package/dist/collection/components/Altcha.d.ts.map +1 -0
- package/dist/collection/components/FormCaptcha.d.ts +3 -0
- package/dist/collection/components/FormCaptcha.d.ts.map +1 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -1
- package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -1
- package/dist/collection/components/core/Input/Input.d.ts.map +1 -1
- package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -1
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
- package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -1
- package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -1
- package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +1 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +7 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/{CollectionWidget.d.ts → CollectionWidgetM2O.d.ts} +1 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +8 -0
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -0
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +11 -0
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -1
- package/dist/collection/index.js +13 -12
- package/dist/collection/lib/FormBuilder.d.ts.map +1 -1
- package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -1
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
- package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -1
- package/dist/collection/utils/formHelpers.d.ts.map +1 -1
- package/dist/collection/utils/index.d.ts +2 -0
- package/dist/collection/utils/index.d.ts.map +1 -1
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Table.d.ts +11 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/index.js +29 -29
- package/dist/constants/fileUploadPresets.d.ts +4 -2
- package/dist/constants/fileUploadPresets.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +75 -75
- package/dist/membership/components/Button.d.ts.map +1 -1
- package/dist/membership/components/Container.d.ts.map +1 -1
- package/dist/membership/components/Core.d.ts.map +1 -1
- package/dist/membership/index.js +2 -3
- package/dist/page-BKyDlf0z.js +212 -0
- package/dist/utils/errorHandler.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/CheckboxWidget-BctVOZiO.js +0 -118
- package/dist/CollectionFormBuilder-B6CAVKhg.js +0 -772
- package/dist/DefaultFormVariant-C6zbKgwB.js +0 -80
- package/dist/DropdownWidget-DszCTSWr.js +0 -115
- package/dist/GeocoderWidget-CXu17A7y.js +0 -310
- package/dist/LevoProvider-BI6g_T4E.js +0 -212
- package/dist/Spinner-DzGH5rKe.js +0 -297
- package/dist/Tooltip-CI4i4mYr.js +0 -144
- package/dist/UploadWidget-ZebPWZZZ.js +0 -505
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +0 -1
- package/dist/fileUploadPresets-2raQmHT0.js +0 -74
- package/dist/page-yeiAPg3O.js +0 -200
- package/dist/useLevoForm-DjvUas25.js +0 -166
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
-
import { createSrcSet as f, MediaKindList as k } from "@levo-so/core";
|
|
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-BI6g_T4E.js";
|
|
10
|
-
import { e as X } from "./errorHandler-_34Yv8wA.js";
|
|
11
|
-
import { h as nr, j as lr, k as dr } from "./CollectionFormBuilder-B6CAVKhg.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";
|
|
15
|
-
import { e as O } from "./Sonner-t6JVKA0a.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
|
-
function $(e) {
|
|
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
|
-
}
|
|
23
|
-
function gr(e) {
|
|
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
|
-
}
|
|
26
|
-
function jr(e) {
|
|
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
|
-
}
|
|
29
|
-
const yr = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
|
|
30
|
-
const { media: c } = V(), n = Array.isArray(o) ? o : [], _ = Q(() => {
|
|
31
|
-
let t = {};
|
|
32
|
-
return j.forEach((h) => {
|
|
33
|
-
t = {
|
|
34
|
-
...t,
|
|
35
|
-
...cr[h]
|
|
36
|
-
};
|
|
37
|
-
}), t;
|
|
38
|
-
}, [j]), g = (t) => {
|
|
39
|
-
e == null || e(t);
|
|
40
|
-
}, y = async (t) => {
|
|
41
|
-
if ((t == null ? void 0 : t.length) === 0) {
|
|
42
|
-
O("No file selected. Please select one file.");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const h = new FormData();
|
|
46
|
-
t == null || t.forEach((p) => {
|
|
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
|
-
var l;
|
|
53
|
-
return {
|
|
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
|
-
};
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
g([...n, ...w]);
|
|
63
|
-
}).catch(X));
|
|
64
|
-
}, { getRootProps: z, getInputProps: x, isDragActive: v } = pr({
|
|
65
|
-
onDrop: y,
|
|
66
|
-
accept: _,
|
|
67
|
-
multiple: d,
|
|
68
|
-
maxSize: 25 * 1024 * 1024,
|
|
69
|
-
onDropRejected: (t) => {
|
|
70
|
-
t.forEach((h) => {
|
|
71
|
-
h.errors.forEach((p) => {
|
|
72
|
-
p.code === "file-too-large" && O(`${h.file.name} is bigger than 25MB`);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
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
|
-
n == null ? void 0 : n.map((t) => {
|
|
79
|
-
var h, p;
|
|
80
|
-
return /* @__PURE__ */ a.jsxs(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: "group relative w-full overflow-hidden h-auto max-[350px] rounded-md border border-gray-300",
|
|
84
|
-
style: {
|
|
85
|
-
background: "linear-gradient(to top, black -50%, transparent 45%)"
|
|
86
|
-
},
|
|
87
|
-
children: [
|
|
88
|
-
(t == null ? void 0 : t.kind) !== "image" ? /* @__PURE__ */ a.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ a.jsx(
|
|
89
|
-
$,
|
|
90
|
-
{
|
|
91
|
-
size: "60px",
|
|
92
|
-
className: "text-gray-400 p-2"
|
|
93
|
-
}
|
|
94
|
-
) }) : /* @__PURE__ */ a.jsx(
|
|
95
|
-
"img",
|
|
96
|
-
{
|
|
97
|
-
className: "w-full h-full object-contain",
|
|
98
|
-
src: t == null ? void 0 : t.location
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ a.jsx(
|
|
102
|
-
"div",
|
|
103
|
-
{
|
|
104
|
-
className: I(
|
|
105
|
-
"absolute left-0 right-0 bottom-0 h-16 bg-[linear-gradient(to-t,_rgba(0,_0,_10,_0.35),_transparent)]",
|
|
106
|
-
"group-hover:bg-[linear-gradient(to-t,_rgba(0,0,10,0.5),_transparent)] group-hover:h-[70%]"
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
),
|
|
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
|
-
{
|
|
114
|
-
className: "absolute right-4 top-4 z-10",
|
|
115
|
-
size: "icon",
|
|
116
|
-
variant: "secondary",
|
|
117
|
-
onClick: () => {
|
|
118
|
-
g(
|
|
119
|
-
n == null ? void 0 : n.filter((w) => (w == null ? void 0 : w.id) !== (t == null ? void 0 : t.id))
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
children: /* @__PURE__ */ a.jsx(rr, { className: "text-primary" })
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
t == null ? void 0 : t.id
|
|
128
|
-
);
|
|
129
|
-
}),
|
|
130
|
-
d && /* @__PURE__ */ a.jsxs(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
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
|
-
...z(),
|
|
135
|
-
children: [
|
|
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
|
-
] }) }) })
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
] }) : /* @__PURE__ */ a.jsxs(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
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
|
-
...z(),
|
|
149
|
-
children: [
|
|
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
|
-
] }) }) })
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
) }) });
|
|
158
|
-
}, br = ({
|
|
159
|
-
selectedFiles: e = [],
|
|
160
|
-
onChange: o,
|
|
161
|
-
isMultiple: j = !1,
|
|
162
|
-
kind: d
|
|
163
|
-
}) => {
|
|
164
|
-
const { media: c } = V(), [n, _] = S(1), [g, y] = S([]), [z, x] = S(!1), v = tr(null), [t, h] = S({
|
|
165
|
-
searchText: "",
|
|
166
|
-
currentPage: 1
|
|
167
|
-
}), p = hr(() => {
|
|
168
|
-
x(!0), c == null || c.getAllMedia({
|
|
169
|
-
page: t.currentPage,
|
|
170
|
-
limit: 24,
|
|
171
|
-
sort: {
|
|
172
|
-
created_at: "desc"
|
|
173
|
-
},
|
|
174
|
-
search: t.searchText || void 0
|
|
175
|
-
}).then((r) => {
|
|
176
|
-
var l, A;
|
|
177
|
-
_((A = (l = r == null ? void 0 : r.content) == null ? void 0 : l.meta) == null ? void 0 : A.pages), y((L) => {
|
|
178
|
-
var b;
|
|
179
|
-
return [...L, ...((b = r == null ? void 0 : r.content) == null ? void 0 : b.data) || []];
|
|
180
|
-
});
|
|
181
|
-
}).catch((r) => {
|
|
182
|
-
console.error(r);
|
|
183
|
-
}).finally(() => {
|
|
184
|
-
x(!1);
|
|
185
|
-
});
|
|
186
|
-
}, 500);
|
|
187
|
-
M(() => {
|
|
188
|
-
p();
|
|
189
|
-
}, [t]), M(() => {
|
|
190
|
-
const r = v.current;
|
|
191
|
-
if (r)
|
|
192
|
-
return r.addEventListener("scroll", w), () => r.removeEventListener("scroll", w);
|
|
193
|
-
}, [v, t.currentPage, n]);
|
|
194
|
-
const w = () => {
|
|
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
|
-
}));
|
|
202
|
-
}, E = (r) => {
|
|
203
|
-
if (!(d != null && d.includes(r == null ? void 0 : r.kind))) {
|
|
204
|
-
O(`Only ${d == null ? void 0 : d.join(", ")}s are allowed.`);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
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
|
-
};
|
|
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
|
-
{
|
|
213
|
-
name: "searchText",
|
|
214
|
-
type: "text",
|
|
215
|
-
placeholder: "Search...",
|
|
216
|
-
value: t.searchText,
|
|
217
|
-
onChange: (r) => {
|
|
218
|
-
x(!0), h({ currentPage: 1, searchText: r.target.value }), y([]);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
) }),
|
|
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
|
-
"div",
|
|
224
|
-
{
|
|
225
|
-
ref: v,
|
|
226
|
-
className: "w-full h-[30rem] overflow-y-auto overflow-x-hidden grid lg:grid-cols-4 gap-6 p-2",
|
|
227
|
-
children: [
|
|
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
|
-
"div",
|
|
232
|
-
{
|
|
233
|
-
className: I(
|
|
234
|
-
"relative w-full",
|
|
235
|
-
A ? "opacity-100" : "opacity-50"
|
|
236
|
-
),
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ a.jsxs(
|
|
239
|
-
"div",
|
|
240
|
-
{
|
|
241
|
-
className: I(
|
|
242
|
-
"cursor-pointer w-full group rounded-md overflow-hidden h-[130px] border-2 flex items-center justify-center",
|
|
243
|
-
L ? "border-primary" : "border-gray-100"
|
|
244
|
-
),
|
|
245
|
-
onClick: () => {
|
|
246
|
-
var b;
|
|
247
|
-
return E({
|
|
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
|
-
});
|
|
254
|
-
},
|
|
255
|
-
children: [
|
|
256
|
-
/* @__PURE__ */ a.jsx(
|
|
257
|
-
"div",
|
|
258
|
-
{
|
|
259
|
-
className: I(
|
|
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
|
-
A ? "group-hover:opacity-100" : ""
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
),
|
|
265
|
-
A && /* @__PURE__ */ a.jsx(
|
|
266
|
-
ur,
|
|
267
|
-
{
|
|
268
|
-
name: "isFileIncluded",
|
|
269
|
-
className: "absolute top-[10px] left-[10px]",
|
|
270
|
-
checked: L
|
|
271
|
-
}
|
|
272
|
-
),
|
|
273
|
-
(r == null ? void 0 : r.kind) !== "image" ? /* @__PURE__ */ a.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ a.jsx(
|
|
274
|
-
"img",
|
|
275
|
-
{
|
|
276
|
-
className: "w-full h-full object-contain",
|
|
277
|
-
srcSet: f(r == null ? void 0 : r.srcset),
|
|
278
|
-
src: r == null ? void 0 : r.location
|
|
279
|
-
}
|
|
280
|
-
)
|
|
281
|
-
]
|
|
282
|
-
}
|
|
283
|
-
),
|
|
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
|
-
] })
|
|
288
|
-
]
|
|
289
|
-
},
|
|
290
|
-
`media-layout-file-${l}`
|
|
291
|
-
);
|
|
292
|
-
}),
|
|
293
|
-
z && /* @__PURE__ */ a.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ a.jsx(W, {}) })
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
] });
|
|
298
|
-
}, vr = ({
|
|
299
|
-
isOpen: e,
|
|
300
|
-
onClose: o,
|
|
301
|
-
onChange: j,
|
|
302
|
-
value: d,
|
|
303
|
-
kind: c,
|
|
304
|
-
isMultiple: n = !1,
|
|
305
|
-
isExternal: _
|
|
306
|
-
}) => {
|
|
307
|
-
const [g, y] = S([]), z = () => {
|
|
308
|
-
o();
|
|
309
|
-
};
|
|
310
|
-
return M(() => {
|
|
311
|
-
y(d.filter((x) => !!x.location));
|
|
312
|
-
}, [d]), /* @__PURE__ */ a.jsxs(
|
|
313
|
-
xr,
|
|
314
|
-
{
|
|
315
|
-
title: (c == null ? void 0 : c.length) > 1 ? "Upload file" : `Upload ${c == null ? void 0 : c[0]}`,
|
|
316
|
-
isOpen: e,
|
|
317
|
-
onClose: () => z(),
|
|
318
|
-
contentClassName: "max-w-[60%]",
|
|
319
|
-
children: [
|
|
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
|
-
] }),
|
|
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
|
-
{
|
|
328
|
-
kind: c,
|
|
329
|
-
value: g,
|
|
330
|
-
onChange: (x) => y(x),
|
|
331
|
-
isMultiple: n
|
|
332
|
-
}
|
|
333
|
-
) }) }),
|
|
334
|
-
/* @__PURE__ */ a.jsx(G, { value: "import", children: /* @__PURE__ */ a.jsx(
|
|
335
|
-
br,
|
|
336
|
-
{
|
|
337
|
-
onChange: (x) => {
|
|
338
|
-
y == null || y(x);
|
|
339
|
-
},
|
|
340
|
-
selectedFiles: g,
|
|
341
|
-
isMultiple: n,
|
|
342
|
-
kind: c
|
|
343
|
-
}
|
|
344
|
-
) })
|
|
345
|
-
] }),
|
|
346
|
-
/* @__PURE__ */ a.jsx("div", { className: "flex justify-end mt-[20px]", children: /* @__PURE__ */ a.jsx(
|
|
347
|
-
P,
|
|
348
|
-
{
|
|
349
|
-
variant: "default",
|
|
350
|
-
onClick: () => {
|
|
351
|
-
g && (j == null || j(g)), z();
|
|
352
|
-
},
|
|
353
|
-
children: "Save"
|
|
354
|
-
}
|
|
355
|
-
) })
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
);
|
|
359
|
-
}, $r = ({
|
|
360
|
-
field: e,
|
|
361
|
-
kind: o = k,
|
|
362
|
-
isMultiple: j,
|
|
363
|
-
isExternal: d = !1
|
|
364
|
-
}) => {
|
|
365
|
-
var H;
|
|
366
|
-
const { media: c } = V(), { key: n = "", label: _ = "", helper_text: g = "", readonly: y = !1 } = e, {
|
|
367
|
-
field: { onBlur: z, onChange: x, value: v, disabled: t, ref: h },
|
|
368
|
-
fieldState: p
|
|
369
|
-
} = sr({
|
|
370
|
-
name: n,
|
|
371
|
-
rules: nr(e)
|
|
372
|
-
}), w = Q(() => {
|
|
373
|
-
const s = [];
|
|
374
|
-
return o.forEach((T) => {
|
|
375
|
-
s.push(...K[T]);
|
|
376
|
-
}), s;
|
|
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
|
-
}, Y = async (s) => {
|
|
380
|
-
const T = new FormData();
|
|
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
|
-
var C;
|
|
384
|
-
const N = u.name.split("."), B = (C = N[N.length - 1]) == null ? void 0 : C.toLowerCase();
|
|
385
|
-
o == null || o.forEach((Z) => {
|
|
386
|
-
w.push(...K[Z]);
|
|
387
|
-
}), B && w.includes(B) && T.append("media", u);
|
|
388
|
-
})), b(!0), await (c == null ? void 0 : c.mediaBulkUpload(T).then((u) => {
|
|
389
|
-
var N, B;
|
|
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
|
-
}).catch((u) => {
|
|
392
|
-
X(u);
|
|
393
|
-
}).finally(() => {
|
|
394
|
-
b(!1);
|
|
395
|
-
}));
|
|
396
|
-
};
|
|
397
|
-
return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
398
|
-
/* @__PURE__ */ a.jsx(
|
|
399
|
-
vr,
|
|
400
|
-
{
|
|
401
|
-
isOpen: E,
|
|
402
|
-
onClose: A,
|
|
403
|
-
onChange: (s) => {
|
|
404
|
-
U(s);
|
|
405
|
-
},
|
|
406
|
-
value: m,
|
|
407
|
-
kind: [...o],
|
|
408
|
-
isMultiple: j,
|
|
409
|
-
isExternal: d
|
|
410
|
-
}
|
|
411
|
-
),
|
|
412
|
-
/* @__PURE__ */ a.jsxs(
|
|
413
|
-
lr,
|
|
414
|
-
{
|
|
415
|
-
error: (H = p == null ? void 0 : p.error) == null ? void 0 : H.message,
|
|
416
|
-
helperText: g,
|
|
417
|
-
readOnly: y,
|
|
418
|
-
children: [
|
|
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
|
-
{
|
|
424
|
-
size: "icon-small",
|
|
425
|
-
variant: "outline",
|
|
426
|
-
disabled: t,
|
|
427
|
-
onClick: l,
|
|
428
|
-
children: /* @__PURE__ */ a.jsx(D, { size: 15 })
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
/* @__PURE__ */ a.jsxs("div", { className: "relative flex", children: [
|
|
432
|
-
/* @__PURE__ */ a.jsx(
|
|
433
|
-
J,
|
|
434
|
-
{
|
|
435
|
-
name: "pasteUrl",
|
|
436
|
-
placeholder: "Paste your files here...",
|
|
437
|
-
onBlur: () => z(),
|
|
438
|
-
onPaste: (s) => {
|
|
439
|
-
const T = s.clipboardData.items, i = [];
|
|
440
|
-
for (let u = 0; u < T.length; u++) {
|
|
441
|
-
const N = T[u];
|
|
442
|
-
if ((N == null ? void 0 : N.kind) === "file") {
|
|
443
|
-
const B = N == null ? void 0 : N.getAsFile();
|
|
444
|
-
B && i.push(B);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
(i == null ? void 0 : i.length) > 0 && Y(i);
|
|
448
|
-
},
|
|
449
|
-
disabled: t,
|
|
450
|
-
readOnly: y
|
|
451
|
-
}
|
|
452
|
-
),
|
|
453
|
-
L && /* @__PURE__ */ a.jsxs(
|
|
454
|
-
"div",
|
|
455
|
-
{
|
|
456
|
-
role: "status",
|
|
457
|
-
className: "absolute right-3 top-[50%] translate-y-[-50%]",
|
|
458
|
-
children: [
|
|
459
|
-
/* @__PURE__ */ a.jsx(gr, {}),
|
|
460
|
-
/* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Loading..." })
|
|
461
|
-
]
|
|
462
|
-
}
|
|
463
|
-
)
|
|
464
|
-
] })
|
|
465
|
-
] }),
|
|
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(
|
|
467
|
-
"div",
|
|
468
|
-
{
|
|
469
|
-
className: "relative border overflow-hidden group w-full rounded-xl h-28 flex items-center justify-center",
|
|
470
|
-
children: [
|
|
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(
|
|
473
|
-
"img",
|
|
474
|
-
{
|
|
475
|
-
className: "w-full h-full object-contain",
|
|
476
|
-
src: s == null ? void 0 : s.location,
|
|
477
|
-
alt: s == null ? void 0 : s.id
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
/* @__PURE__ */ a.jsx(
|
|
481
|
-
"button",
|
|
482
|
-
{
|
|
483
|
-
className: "absolute z-10 top-1 right-1 bg-white p-1 rounded-full focus:outline-none",
|
|
484
|
-
onClick: () => {
|
|
485
|
-
U(
|
|
486
|
-
m == null ? void 0 : m.filter((i) => (i == null ? void 0 : i.id) !== (s == null ? void 0 : s.id))
|
|
487
|
-
);
|
|
488
|
-
},
|
|
489
|
-
type: "button",
|
|
490
|
-
children: /* @__PURE__ */ a.jsx(jr, { className: "text-sm" })
|
|
491
|
-
}
|
|
492
|
-
)
|
|
493
|
-
]
|
|
494
|
-
},
|
|
495
|
-
`${s == null ? void 0 : s.location}-${T}`
|
|
496
|
-
) : null) }) })
|
|
497
|
-
]
|
|
498
|
-
}
|
|
499
|
-
)
|
|
500
|
-
] });
|
|
501
|
-
};
|
|
502
|
-
export {
|
|
503
|
-
$r as UploadWidget,
|
|
504
|
-
$r as default
|
|
505
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionWidget.d.ts","sourceRoot":"","sources":["../../../../../src/collection/components/widgets/collectionWidget/CollectionWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAYhD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA+H7D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const o = [
|
|
2
|
-
"pdf",
|
|
3
|
-
"xls",
|
|
4
|
-
"xlsx",
|
|
5
|
-
"doc",
|
|
6
|
-
"docx",
|
|
7
|
-
"csv"
|
|
8
|
-
], a = [
|
|
9
|
-
"svg",
|
|
10
|
-
"png",
|
|
11
|
-
"jpg",
|
|
12
|
-
"jpeg",
|
|
13
|
-
"webp",
|
|
14
|
-
"gif",
|
|
15
|
-
"avif"
|
|
16
|
-
], s = ["mpeg", "mp4"], n = ["mp3", "ogg", "oga"], m = {
|
|
17
|
-
"application/pdf": [".pdf"],
|
|
18
|
-
"application/msword": [".doc"],
|
|
19
|
-
"application/vnd.ms-excel": [".xls"],
|
|
20
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
|
|
21
|
-
".xlsx"
|
|
22
|
-
],
|
|
23
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
|
24
|
-
".docx"
|
|
25
|
-
],
|
|
26
|
-
"text/csv": [".csv"]
|
|
27
|
-
}, d = {
|
|
28
|
-
"image/jpeg": [".jpeg", ".jpg"],
|
|
29
|
-
"image/png": [".png"],
|
|
30
|
-
"image/gif": [".gif"],
|
|
31
|
-
"image/svg+xml": [".svg"],
|
|
32
|
-
"image/webp": [".webp"],
|
|
33
|
-
"image/avif": [".avif"]
|
|
34
|
-
}, t = {
|
|
35
|
-
"video/mp4": [".mp4"],
|
|
36
|
-
"video/mpeg": [".mpeg"]
|
|
37
|
-
}, p = {
|
|
38
|
-
"audio/mpeg": [".mp3"],
|
|
39
|
-
"audio/ogg": [".oga"]
|
|
40
|
-
}, e = {
|
|
41
|
-
audio: p,
|
|
42
|
-
document: m,
|
|
43
|
-
image: d,
|
|
44
|
-
video: t
|
|
45
|
-
}, i = {
|
|
46
|
-
audio: n,
|
|
47
|
-
document: o,
|
|
48
|
-
image: a,
|
|
49
|
-
video: s
|
|
50
|
-
}, c = [
|
|
51
|
-
...i.audio,
|
|
52
|
-
...i.document,
|
|
53
|
-
...i.image,
|
|
54
|
-
...i.video
|
|
55
|
-
], g = {
|
|
56
|
-
...e.audio,
|
|
57
|
-
...e.document,
|
|
58
|
-
...e.image,
|
|
59
|
-
...e.video
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
n as a,
|
|
63
|
-
m as b,
|
|
64
|
-
d as c,
|
|
65
|
-
o as d,
|
|
66
|
-
t as e,
|
|
67
|
-
p as f,
|
|
68
|
-
i as g,
|
|
69
|
-
c as h,
|
|
70
|
-
a as i,
|
|
71
|
-
g as j,
|
|
72
|
-
e as m,
|
|
73
|
-
s as v
|
|
74
|
-
};
|