@oneplatformdev/ui 0.1.99-beta.282 → 0.1.99-beta.284
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/Dropzone/Dropzone.d.ts.map +1 -1
- package/Dropzone/Dropzone.js +251 -239
- package/Dropzone/Dropzone.js.map +1 -1
- package/Dropzone/Dropzone.types.d.ts +1 -0
- package/Dropzone/Dropzone.types.d.ts.map +1 -1
- package/Dropzone/Dropzone.types.js.map +1 -1
- package/Dropzone/DropzoneSinglePickPreview.d.ts +2 -1
- package/Dropzone/DropzoneSinglePickPreview.d.ts.map +1 -1
- package/Dropzone/DropzoneSinglePickPreview.js +134 -97
- package/Dropzone/DropzoneSinglePickPreview.js.map +1 -1
- package/package.json +4 -4
package/Dropzone/Dropzone.js
CHANGED
|
@@ -1,63 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { X as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useDropzone as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Card as
|
|
7
|
-
import { DEFAULT_FILE_TYPES as
|
|
8
|
-
import { FilePreview as
|
|
9
|
-
import { DropzoneSinglePickPreview as
|
|
10
|
-
import { isFile as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { X as M, Plus as Se, UploadIcon as Me, FileTextIcon as V, InfoIcon as ee } from "lucide-react";
|
|
3
|
+
import { forwardRef as ke, useState as te, useEffect as Re, useImperativeHandle as We } from "react";
|
|
4
|
+
import { useDropzone as Ae } from "react-dropzone";
|
|
5
|
+
import { cn as x } from "@oneplatformdev/utils";
|
|
6
|
+
import { Card as _e } from "../Card/Card.js";
|
|
7
|
+
import { DEFAULT_FILE_TYPES as $e } from "./Dropzone.types.js";
|
|
8
|
+
import { FilePreview as re } from "./DropzoneFilePreview.js";
|
|
9
|
+
import { DropzoneSinglePickPreview as Xe } from "./DropzoneSinglePickPreview.js";
|
|
10
|
+
import { isFile as z, isVideoUrl as Ge, extractName as Ke } from "./DropzoneUtils.js";
|
|
11
|
+
import Le from "./icons/file-csv.svg.js";
|
|
12
|
+
import Oe from "./icons/file-doc.svg.js";
|
|
13
|
+
import Pe from "./icons/file-docx.svg.js";
|
|
14
|
+
import le from "./icons/file-jpg.svg.js";
|
|
15
|
+
import Te from "./icons/file-pdf.svg.js";
|
|
16
16
|
import qe from "./icons/file-png.svg.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { Button as
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
import He from "./icons/file-ppt.svg.js";
|
|
18
|
+
import Je from "./icons/file-pptx.svg.js";
|
|
19
|
+
import Ye from "./icons/file-rar.svg.js";
|
|
20
|
+
import Ze from "./icons/file-svg.svg.js";
|
|
21
|
+
import Qe from "./icons/file-webp.svg.js";
|
|
22
|
+
import Ue from "./icons/file-xls.svg.js";
|
|
23
|
+
import Ve from "./icons/file-xlsx.svg.js";
|
|
24
|
+
import et from "./icons/file-zip.svg.js";
|
|
25
|
+
import { Button as tt } from "../Button/Button.js";
|
|
26
|
+
const b = (l = 0) => {
|
|
27
|
+
if (!l || l < 0) return "0 KB";
|
|
28
|
+
const s = 1024, m = s * 1024, a = m * 1024;
|
|
29
|
+
if (l >= a) return `${(l / a).toFixed(2)} GB`;
|
|
30
|
+
if (l >= m) {
|
|
31
|
+
const c = l / m;
|
|
32
|
+
return `${c >= 100 ? c.toFixed(0) : c.toFixed(2)} MB`;
|
|
33
|
+
}
|
|
34
|
+
return l >= s ? `${(l / s).toFixed(l / s >= 100 ? 0 : 1)} KB` : `${l} B`;
|
|
35
|
+
}, rt = {
|
|
36
|
+
csv: Le,
|
|
37
|
+
doc: Oe,
|
|
38
|
+
docx: Pe,
|
|
39
|
+
jpg: le,
|
|
40
|
+
jpeg: le,
|
|
41
|
+
pdf: Te,
|
|
33
42
|
png: qe,
|
|
34
|
-
ppt:
|
|
35
|
-
pptx:
|
|
36
|
-
rar:
|
|
37
|
-
svg:
|
|
38
|
-
webp:
|
|
39
|
-
xls:
|
|
40
|
-
xlsx:
|
|
41
|
-
zip:
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
},
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
52
|
-
for (let
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
if (typeof
|
|
56
|
-
if (
|
|
43
|
+
ppt: He,
|
|
44
|
+
pptx: Je,
|
|
45
|
+
rar: Ye,
|
|
46
|
+
svg: Ze,
|
|
47
|
+
webp: Qe,
|
|
48
|
+
xls: Ue,
|
|
49
|
+
xlsx: Ve,
|
|
50
|
+
zip: et
|
|
51
|
+
}, lt = (l) => {
|
|
52
|
+
if (!l) return "";
|
|
53
|
+
const s = l.toLowerCase().split(".");
|
|
54
|
+
return s.length > 1 ? s[s.length - 1] : "";
|
|
55
|
+
}, it = (l) => {
|
|
56
|
+
const s = lt(l);
|
|
57
|
+
return rt[s] ?? null;
|
|
58
|
+
}, nt = (l, s) => {
|
|
59
|
+
if (l === s) return !0;
|
|
60
|
+
if (l.length !== s.length) return !1;
|
|
61
|
+
for (let m = 0; m < l.length; m++) {
|
|
62
|
+
const a = l[m], c = s[m];
|
|
63
|
+
if (a !== c) {
|
|
64
|
+
if (typeof a == "string" && typeof c == "string") {
|
|
65
|
+
if (a !== c) return !1;
|
|
57
66
|
continue;
|
|
58
67
|
}
|
|
59
|
-
if (
|
|
60
|
-
if (
|
|
68
|
+
if (z(a) && z(c)) {
|
|
69
|
+
if (a.name !== c.name || a.size !== c.size || a.type !== c.type || a.lastModified !== c.lastModified)
|
|
61
70
|
return !1;
|
|
62
71
|
continue;
|
|
63
72
|
}
|
|
@@ -65,111 +74,112 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
65
74
|
}
|
|
66
75
|
}
|
|
67
76
|
return !0;
|
|
68
|
-
},
|
|
77
|
+
}, ot = ke(
|
|
69
78
|
({
|
|
70
|
-
acceptTypes:
|
|
71
|
-
maxSizeMB:
|
|
72
|
-
maxFiles:
|
|
73
|
-
onErrors:
|
|
74
|
-
hideErrors:
|
|
75
|
-
disabled:
|
|
79
|
+
acceptTypes: l = $e,
|
|
80
|
+
maxSizeMB: s,
|
|
81
|
+
maxFiles: m = 1,
|
|
82
|
+
onErrors: a,
|
|
83
|
+
hideErrors: c = !1,
|
|
84
|
+
disabled: f = !1,
|
|
76
85
|
classNames: u,
|
|
77
86
|
value: v,
|
|
78
|
-
onChangeValue:
|
|
79
|
-
className:
|
|
80
|
-
labelDropzonePrompt:
|
|
81
|
-
labelDropzoneSubPrompt:
|
|
87
|
+
onChangeValue: K,
|
|
88
|
+
className: ie,
|
|
89
|
+
labelDropzonePrompt: k = "Drop files here or click to select",
|
|
90
|
+
labelDropzoneSubPrompt: ne = "",
|
|
82
91
|
labelOrClickToSelect: oe = "Upload file",
|
|
83
|
-
labelSelectedFiles:
|
|
84
|
-
labelUploadErrors:
|
|
85
|
-
labelFileTooLarge:
|
|
86
|
-
labelInvalidFileType:
|
|
87
|
-
labelVideoUploaded:
|
|
88
|
-
labelVideoReplace:
|
|
89
|
-
singlePick:
|
|
90
|
-
labelDropzoneClassname:
|
|
91
|
-
labelDropzoneSubClassname:
|
|
92
|
-
isUploading:
|
|
93
|
-
uploadProgress:
|
|
94
|
-
uploadLoadedBytes:
|
|
95
|
-
uploadTotalBytes:
|
|
96
|
-
onCancelUpload:
|
|
97
|
-
labelUploadingTitle:
|
|
98
|
-
labelUploadingHint:
|
|
99
|
-
labelUploadingActionCancel:
|
|
100
|
-
labelUploadingOf:
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
labelSelectedFiles: se = "Selected Files",
|
|
93
|
+
labelUploadErrors: ce = "Upload Errors",
|
|
94
|
+
labelFileTooLarge: R = "File is too large",
|
|
95
|
+
labelInvalidFileType: I = "Invalid file type",
|
|
96
|
+
labelVideoUploaded: ae = "Uploaded",
|
|
97
|
+
labelVideoReplace: de = "Replace",
|
|
98
|
+
singlePick: n = !1,
|
|
99
|
+
labelDropzoneClassname: me,
|
|
100
|
+
labelDropzoneSubClassname: fe,
|
|
101
|
+
isUploading: p = !1,
|
|
102
|
+
uploadProgress: L = 0,
|
|
103
|
+
uploadLoadedBytes: pe = 0,
|
|
104
|
+
uploadTotalBytes: xe = 0,
|
|
105
|
+
onCancelUpload: O,
|
|
106
|
+
labelUploadingTitle: he = "Uploading video...",
|
|
107
|
+
labelUploadingHint: ue = "Please do not close this page",
|
|
108
|
+
labelUploadingActionCancel: ge = "Cancel",
|
|
109
|
+
labelUploadingOf: we = "of",
|
|
110
|
+
playerTranslations: Ne,
|
|
111
|
+
singlePickFileInfo: W,
|
|
112
|
+
persistentDropzone: P = !1,
|
|
103
113
|
previewVariant: g = "default",
|
|
104
|
-
coverFirstItem:
|
|
105
|
-
...
|
|
106
|
-
},
|
|
107
|
-
const [
|
|
108
|
-
|
|
109
|
-
const o =
|
|
110
|
-
|
|
114
|
+
coverFirstItem: Fe = !1,
|
|
115
|
+
...A
|
|
116
|
+
}, ve) => {
|
|
117
|
+
const [i, y] = te(v ?? []), [h, T] = te([]), w = i[0], _ = h[0]?.file, Ce = !!_?.type?.includes("image"), $ = n && i.length > 0 && z(w), be = $ && w.type.includes("image"), q = $ && w.type.includes("video") || n && i.length > 0 && typeof w == "string" && Ge(w), X = $ && !be && !q, H = n && !i.length && !!_ && !Ce, N = X ? w : _, D = it(N?.name), E = n && q, ze = E, j = n && i.length > 0, Ie = j && !X && !E, ye = (t, d) => {
|
|
118
|
+
T(d), a?.(d);
|
|
119
|
+
const o = n ? t.slice(0, 1) : [...i, ...t].slice(0, m);
|
|
120
|
+
y(o), K?.(o);
|
|
111
121
|
};
|
|
112
|
-
|
|
113
|
-
v && !
|
|
114
|
-
}, [
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
122
|
+
Re(() => {
|
|
123
|
+
v && !nt(i, v) && y(v);
|
|
124
|
+
}, [i, v]);
|
|
125
|
+
const B = (t, d) => {
|
|
126
|
+
if (f) return;
|
|
117
127
|
t.stopPropagation();
|
|
118
|
-
const o =
|
|
119
|
-
|
|
120
|
-
}, { getRootProps:
|
|
128
|
+
const o = i.filter((F, S) => S !== d);
|
|
129
|
+
y(o), K?.(o);
|
|
130
|
+
}, { getRootProps: De, getInputProps: Ee, isDragActive: je, open: G } = Ae({
|
|
121
131
|
onDrop: ye,
|
|
122
|
-
accept:
|
|
123
|
-
maxSize:
|
|
124
|
-
maxFiles:
|
|
125
|
-
disabled:
|
|
132
|
+
accept: l.reduce((t, d) => (t[d] = [], t), {}),
|
|
133
|
+
maxSize: s * 1024 * 1024,
|
|
134
|
+
maxFiles: n ? 1 : m,
|
|
135
|
+
disabled: f || p,
|
|
126
136
|
noClick: !0
|
|
127
137
|
});
|
|
128
|
-
|
|
129
|
-
setItems:
|
|
138
|
+
We(ve, () => ({
|
|
139
|
+
setItems: y
|
|
130
140
|
}), []);
|
|
131
|
-
const
|
|
132
|
-
g === "default" && /* @__PURE__ */
|
|
133
|
-
|
|
141
|
+
const C = Fe && g === "image-grid" && !n && i.length > 0, J = !p && !n && P && i.length > 0, Y = C ? i.slice(1) : i, Z = !f && !n && g === "image-grid" && i.length > 0 && i.length < m, Q = !p && !n && (Y.length > 0 || Z) && /* @__PURE__ */ r("div", { className: x("w-full mt-2", u?.previewWrapper), children: [
|
|
142
|
+
g === "default" && /* @__PURE__ */ r("pre", { className: "font-semibold text-gray-600", children: [
|
|
143
|
+
se,
|
|
134
144
|
":"
|
|
135
145
|
] }),
|
|
136
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(
|
|
137
147
|
"ul",
|
|
138
148
|
{
|
|
139
|
-
className:
|
|
149
|
+
className: x(
|
|
140
150
|
"mt-2 text-sm text-gray-500 flex flex-wrap items-start",
|
|
141
151
|
g === "image-grid" ? "gap-2 justify-start" : "gap-4 justify-center"
|
|
142
152
|
),
|
|
143
153
|
children: [
|
|
144
|
-
|
|
145
|
-
const o =
|
|
146
|
-
return /* @__PURE__ */
|
|
154
|
+
Y.map((t, d) => {
|
|
155
|
+
const o = C ? d + 1 : d, F = z(t) ? t.name : Ke(t), S = z(t) ? b(t.size) : "";
|
|
156
|
+
return /* @__PURE__ */ r(
|
|
147
157
|
"li",
|
|
148
158
|
{
|
|
149
|
-
className:
|
|
159
|
+
className: x(
|
|
150
160
|
"relative",
|
|
151
161
|
g === "image-grid" ? "w-[75px] h-[75px]" : "flex flex-col items-center gap-2"
|
|
152
162
|
),
|
|
153
163
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */ e(
|
|
164
|
+
/* @__PURE__ */ r("div", { className: "relative w-full h-full", children: [
|
|
165
|
+
/* @__PURE__ */ e(re, { item: t, styles: u }),
|
|
156
166
|
/* @__PURE__ */ e(
|
|
157
167
|
"div",
|
|
158
168
|
{
|
|
159
|
-
className:
|
|
169
|
+
className: x(
|
|
160
170
|
"absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
|
161
171
|
g === "image-grid" && "top-1 right-1 bg-white/90 rounded-full p-0.5"
|
|
162
172
|
),
|
|
163
|
-
onClick: (
|
|
164
|
-
children: /* @__PURE__ */ e(
|
|
173
|
+
onClick: (Be) => B(Be, o),
|
|
174
|
+
children: /* @__PURE__ */ e(M, { size: 16, strokeWidth: 1, color: "black" })
|
|
165
175
|
}
|
|
166
176
|
)
|
|
167
177
|
] }),
|
|
168
|
-
g === "default" && /* @__PURE__ */
|
|
178
|
+
g === "default" && /* @__PURE__ */ r("span", { className: "inline-flex flex-col items-center", children: [
|
|
169
179
|
/* @__PURE__ */ e("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: F }),
|
|
170
|
-
|
|
180
|
+
S && /* @__PURE__ */ r("span", { children: [
|
|
171
181
|
"(",
|
|
172
|
-
|
|
182
|
+
S,
|
|
173
183
|
")"
|
|
174
184
|
] })
|
|
175
185
|
] })
|
|
@@ -178,14 +188,14 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
178
188
|
o
|
|
179
189
|
);
|
|
180
190
|
}),
|
|
181
|
-
|
|
191
|
+
Z && /* @__PURE__ */ e(
|
|
182
192
|
"li",
|
|
183
193
|
{
|
|
184
194
|
className: "relative w-[75px] h-[75px] flex items-center justify-center rounded-[8px] border border-dashed border-[#9368FF80] bg-[#FCFCFC] cursor-pointer hover:bg-[#9368FF0F]",
|
|
185
195
|
onClick: (t) => {
|
|
186
|
-
t.stopPropagation(), !(
|
|
196
|
+
t.stopPropagation(), !(f || p) && G();
|
|
187
197
|
},
|
|
188
|
-
children: /* @__PURE__ */ e("div", { className: "flex size-6 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(
|
|
198
|
+
children: /* @__PURE__ */ e("div", { className: "flex size-6 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(Se, { size: 16, className: "text-[#9368FF]" }) })
|
|
189
199
|
},
|
|
190
200
|
"add-more"
|
|
191
201
|
)
|
|
@@ -193,95 +203,96 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
193
203
|
}
|
|
194
204
|
)
|
|
195
205
|
] });
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
206
|
+
return /* @__PURE__ */ r("div", { className: "w-full select-none", children: [
|
|
207
|
+
/* @__PURE__ */ r(
|
|
208
|
+
_e,
|
|
199
209
|
{
|
|
200
|
-
...
|
|
201
|
-
...
|
|
210
|
+
...A,
|
|
211
|
+
...De({
|
|
202
212
|
onClick: (t) => {
|
|
203
|
-
if (!(
|
|
204
|
-
if (
|
|
205
|
-
|
|
213
|
+
if (!(f || p)) {
|
|
214
|
+
if (ze) {
|
|
215
|
+
A.onClick?.(t);
|
|
206
216
|
return;
|
|
207
217
|
}
|
|
208
|
-
|
|
218
|
+
G(), A.onClick?.(t);
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
221
|
}),
|
|
212
|
-
className:
|
|
222
|
+
className: x(
|
|
213
223
|
"w-full text-center flex flex-col items-center justify-center gap-6 cursor-pointer",
|
|
214
|
-
!
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
!j && "border border-dashed border-[#9368FF80] rounded-[8px] bg-[#FCFCFC] p-4",
|
|
225
|
+
j && "min-h-0 border-0 bg-transparent p-0",
|
|
226
|
+
C && "relative",
|
|
227
|
+
f && "border-[#E4E4E7] pointer-events-none",
|
|
228
|
+
h.length > 0 && !j && "border-red-500",
|
|
229
|
+
je && "bg-gray-100",
|
|
230
|
+
n && "shadow-none!",
|
|
231
|
+
n && i.length > 0 && !E && "p-0! shadow-none!",
|
|
232
|
+
E && "h-auto! max-h-none! min-h-0! p-2!",
|
|
233
|
+
Ie && "h-64",
|
|
234
|
+
ie
|
|
224
235
|
),
|
|
225
236
|
children: [
|
|
226
|
-
/* @__PURE__ */ e("input", { ...
|
|
227
|
-
|
|
237
|
+
/* @__PURE__ */ e("input", { ...Ee() }),
|
|
238
|
+
p && /* @__PURE__ */ r(
|
|
228
239
|
"div",
|
|
229
240
|
{
|
|
230
241
|
className: "w-full h-full min-h-46 rounded-lg border border-[#E4E4E7] bg-[#FCFCFC] flex flex-col items-center justify-center gap-4 p-4",
|
|
231
242
|
onClick: (t) => t.stopPropagation(),
|
|
232
243
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ r("div", { className: "relative h-24 w-24", children: [
|
|
234
245
|
/* @__PURE__ */ e("svg", { className: "h-24 w-24", viewBox: "0 0 100 100", children: /* @__PURE__ */ e("circle", { cx: "50", cy: "50", r: "42", stroke: "#E6E1F5", strokeWidth: "8", fill: "none" }) }),
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
Math.max(0, Math.min(100, Math.round(
|
|
246
|
+
/* @__PURE__ */ r("span", { className: "absolute inset-0 flex items-center justify-center text-lg font-semibold text-foreground", children: [
|
|
247
|
+
Math.max(0, Math.min(100, Math.round(L))),
|
|
237
248
|
"%"
|
|
238
249
|
] })
|
|
239
250
|
] }),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children:
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
251
|
+
/* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
252
|
+
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children: he }),
|
|
253
|
+
/* @__PURE__ */ r("p", { className: "text-sm text-[#666A78]", children: [
|
|
254
|
+
b(pe),
|
|
244
255
|
" ",
|
|
245
|
-
|
|
256
|
+
we,
|
|
246
257
|
" ",
|
|
247
|
-
|
|
258
|
+
b(xe)
|
|
248
259
|
] }),
|
|
249
|
-
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children:
|
|
260
|
+
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children: ue })
|
|
250
261
|
] }),
|
|
251
262
|
/* @__PURE__ */ e("div", { className: "w-full max-w-[520px] h-2 rounded-full bg-[#E6E1F5] overflow-hidden", children: /* @__PURE__ */ e(
|
|
252
263
|
"div",
|
|
253
264
|
{
|
|
254
265
|
className: "h-full bg-[#9368FF] transition-[width] duration-150 ease-linear",
|
|
255
|
-
style: { width: `${Math.max(0, Math.min(100,
|
|
266
|
+
style: { width: `${Math.max(0, Math.min(100, L))}%` }
|
|
256
267
|
}
|
|
257
268
|
) }),
|
|
258
|
-
|
|
269
|
+
O && /* @__PURE__ */ e(
|
|
259
270
|
"button",
|
|
260
271
|
{
|
|
261
272
|
type: "button",
|
|
262
273
|
className: "mt-1 h-10 min-w-36 rounded-md border border-[#E4E4E7] bg-white px-6 text-base font-medium text-foreground cursor-pointer",
|
|
263
274
|
onClick: (t) => {
|
|
264
|
-
t.stopPropagation(),
|
|
275
|
+
t.stopPropagation(), O();
|
|
265
276
|
},
|
|
266
|
-
children:
|
|
277
|
+
children: ge
|
|
267
278
|
}
|
|
268
279
|
)
|
|
269
280
|
]
|
|
270
281
|
}
|
|
271
282
|
),
|
|
272
|
-
!
|
|
283
|
+
!p && C && /* @__PURE__ */ r(
|
|
273
284
|
"div",
|
|
274
285
|
{
|
|
275
286
|
className: "absolute inset-0 rounded-[8px] overflow-hidden",
|
|
276
287
|
onClick: (t) => t.stopPropagation(),
|
|
277
288
|
children: [
|
|
278
289
|
/* @__PURE__ */ e(
|
|
279
|
-
|
|
290
|
+
re,
|
|
280
291
|
{
|
|
281
|
-
item:
|
|
292
|
+
item: i[0],
|
|
282
293
|
styles: {
|
|
283
294
|
...u,
|
|
284
|
-
previewWraper:
|
|
295
|
+
previewWraper: x(
|
|
285
296
|
"w-full h-full rounded-[8px] border-0",
|
|
286
297
|
u?.previewWraper?.replace(/w-\[[^\]]+\]|h-\[[^\]]+\]/g, "")
|
|
287
298
|
)
|
|
@@ -292,47 +303,47 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
292
303
|
"div",
|
|
293
304
|
{
|
|
294
305
|
className: "absolute top-2 right-2 cursor-pointer bg-white/90 rounded-full p-1",
|
|
295
|
-
onClick: (t) =>
|
|
296
|
-
children: /* @__PURE__ */ e(
|
|
306
|
+
onClick: (t) => B(t, 0),
|
|
307
|
+
children: /* @__PURE__ */ e(M, { size: 16, strokeWidth: 1, color: "black" })
|
|
297
308
|
}
|
|
298
309
|
)
|
|
299
310
|
]
|
|
300
311
|
}
|
|
301
312
|
),
|
|
302
|
-
!
|
|
313
|
+
!p && (i.length === 0 || !n && P) && (h.length === 0 || !n) && /* @__PURE__ */ r(
|
|
303
314
|
"div",
|
|
304
315
|
{
|
|
305
|
-
className:
|
|
316
|
+
className: x(
|
|
306
317
|
"flex flex-col items-center gap-2 w-full",
|
|
307
318
|
u?.idleWrapper,
|
|
308
|
-
|
|
319
|
+
C && "invisible"
|
|
309
320
|
),
|
|
310
321
|
children: [
|
|
311
322
|
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(Me, { className: "size-6 text-[#9368FF]" }) }),
|
|
312
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !
|
|
323
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !f && /* @__PURE__ */ r(U, { children: [
|
|
313
324
|
/* @__PURE__ */ e(
|
|
314
325
|
"span",
|
|
315
326
|
{
|
|
316
|
-
className:
|
|
327
|
+
className: x(
|
|
317
328
|
"font-semibold text-[14px] leading-[125%] text-[#06080D] text-center w-full whitespace-pre-line",
|
|
318
|
-
|
|
329
|
+
me
|
|
319
330
|
),
|
|
320
|
-
children:
|
|
331
|
+
children: k
|
|
321
332
|
}
|
|
322
333
|
),
|
|
323
334
|
/* @__PURE__ */ e(
|
|
324
335
|
"span",
|
|
325
336
|
{
|
|
326
|
-
className:
|
|
337
|
+
className: x(
|
|
327
338
|
"font-medium text-[12px] leading-[120%] text-[#666A78] text-center w-full whitespace-pre-line",
|
|
328
|
-
|
|
339
|
+
fe
|
|
329
340
|
),
|
|
330
|
-
children:
|
|
341
|
+
children: ne
|
|
331
342
|
}
|
|
332
343
|
)
|
|
333
344
|
] }) }),
|
|
334
|
-
!
|
|
335
|
-
|
|
345
|
+
!f && /* @__PURE__ */ e(
|
|
346
|
+
tt,
|
|
336
347
|
{
|
|
337
348
|
type: "button",
|
|
338
349
|
size: "md",
|
|
@@ -342,131 +353,132 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
342
353
|
]
|
|
343
354
|
}
|
|
344
355
|
),
|
|
345
|
-
!
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
|
|
356
|
+
!p && n && h.length > 0 && !H && /* @__PURE__ */ r("div", { className: x("w-full mt-4", u?.errorWrapper), children: [
|
|
357
|
+
/* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
|
|
358
|
+
ce,
|
|
348
359
|
":"
|
|
349
360
|
] }),
|
|
350
|
-
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children:
|
|
361
|
+
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: h.map((t, d) => /* @__PURE__ */ r("li", { children: [
|
|
351
362
|
t.file.name,
|
|
352
363
|
" (",
|
|
353
|
-
(t.file.size
|
|
354
|
-
"
|
|
355
|
-
!
|
|
356
|
-
o.code === "file-too-large" &&
|
|
357
|
-
o.code === "file-invalid-type" &&
|
|
364
|
+
b(t.file.size),
|
|
365
|
+
")",
|
|
366
|
+
!c && /* @__PURE__ */ e("ul", { className: "ml-4 list-disc list-inside", children: t.errors.map((o, F) => /* @__PURE__ */ r("li", { children: [
|
|
367
|
+
o.code === "file-too-large" && R,
|
|
368
|
+
o.code === "file-invalid-type" && I,
|
|
358
369
|
o.code !== "file-too-large" && o.code !== "file-invalid-type" && o.message
|
|
359
370
|
] }, F)) })
|
|
360
|
-
] },
|
|
371
|
+
] }, d)) })
|
|
361
372
|
] }),
|
|
362
|
-
!
|
|
373
|
+
!p && !!(n && i.length) && /* @__PURE__ */ e(U, { children: X ? /* @__PURE__ */ r(
|
|
363
374
|
"div",
|
|
364
375
|
{
|
|
365
376
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
366
377
|
onClick: (t) => t.stopPropagation(),
|
|
367
378
|
children: [
|
|
368
|
-
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children:
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
|
|
379
|
+
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: k }),
|
|
380
|
+
/* @__PURE__ */ r("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
381
|
+
D ? /* @__PURE__ */ e(
|
|
371
382
|
"img",
|
|
372
383
|
{
|
|
373
|
-
src:
|
|
384
|
+
src: D,
|
|
374
385
|
alt: "",
|
|
375
386
|
className: "size-10 shrink-0"
|
|
376
387
|
}
|
|
377
|
-
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
380
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
388
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(V, { size: 20 }) }),
|
|
389
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
390
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: W?.name || N?.name }),
|
|
391
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: b(W?.size || N?.size) })
|
|
381
392
|
] }),
|
|
382
|
-
!
|
|
393
|
+
!f && /* @__PURE__ */ e(
|
|
383
394
|
"div",
|
|
384
395
|
{
|
|
385
396
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
386
|
-
onClick: (t) =>
|
|
387
|
-
children: /* @__PURE__ */ e(
|
|
397
|
+
onClick: (t) => B(t, 0),
|
|
398
|
+
children: /* @__PURE__ */ e(M, { size: 24, color: "#06080D" })
|
|
388
399
|
}
|
|
389
400
|
)
|
|
390
401
|
] })
|
|
391
402
|
]
|
|
392
403
|
}
|
|
393
404
|
) : /* @__PURE__ */ e(
|
|
394
|
-
|
|
405
|
+
Xe,
|
|
395
406
|
{
|
|
396
|
-
item:
|
|
397
|
-
onRemoveClick: (t) =>
|
|
407
|
+
item: i[0],
|
|
408
|
+
onRemoveClick: (t) => B(t, 0),
|
|
398
409
|
onReplaceClick: (t) => {
|
|
399
|
-
t.stopPropagation(), !
|
|
410
|
+
t.stopPropagation(), !f && G();
|
|
400
411
|
},
|
|
401
|
-
labelUploaded:
|
|
402
|
-
labelReplace:
|
|
403
|
-
fileInfo:
|
|
404
|
-
disabled:
|
|
412
|
+
labelUploaded: ae,
|
|
413
|
+
labelReplace: de,
|
|
414
|
+
fileInfo: W,
|
|
415
|
+
disabled: f,
|
|
416
|
+
playerTranslations: Ne
|
|
405
417
|
}
|
|
406
418
|
) }),
|
|
407
|
-
!
|
|
419
|
+
!p && H && /* @__PURE__ */ r(
|
|
408
420
|
"div",
|
|
409
421
|
{
|
|
410
422
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
411
423
|
onClick: (t) => t.stopPropagation(),
|
|
412
424
|
children: [
|
|
413
|
-
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children:
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
|
|
425
|
+
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: k }),
|
|
426
|
+
/* @__PURE__ */ r("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
427
|
+
D ? /* @__PURE__ */ e(
|
|
416
428
|
"img",
|
|
417
429
|
{
|
|
418
|
-
src:
|
|
430
|
+
src: D,
|
|
419
431
|
alt: "",
|
|
420
432
|
className: "size-10 shrink-0"
|
|
421
433
|
}
|
|
422
|
-
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
425
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
434
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(V, { size: 20 }) }),
|
|
435
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
436
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: N?.name }),
|
|
437
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: N ? `${(N.size / (1024 * 1024)).toFixed(0)} MB` : "" })
|
|
426
438
|
] }),
|
|
427
|
-
!
|
|
439
|
+
!f && /* @__PURE__ */ e(
|
|
428
440
|
"div",
|
|
429
441
|
{
|
|
430
442
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
431
443
|
onClick: (t) => {
|
|
432
|
-
t.stopPropagation(),
|
|
444
|
+
t.stopPropagation(), T([]);
|
|
433
445
|
},
|
|
434
|
-
children: /* @__PURE__ */ e(
|
|
446
|
+
children: /* @__PURE__ */ e(M, { size: 24, color: "#06080D" })
|
|
435
447
|
}
|
|
436
448
|
)
|
|
437
449
|
] }),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */ e(
|
|
440
|
-
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children:
|
|
450
|
+
/* @__PURE__ */ r("div", { className: "w-full bg-[#DC26260F] p-4 flex items-start gap-4", children: [
|
|
451
|
+
/* @__PURE__ */ e(ee, { size: 20, color: "#DC2626" }),
|
|
452
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children: h[0]?.errors?.[0]?.code === "file-too-large" ? R : h[0]?.errors?.[0]?.message || I })
|
|
441
453
|
] })
|
|
442
454
|
]
|
|
443
455
|
}
|
|
444
456
|
),
|
|
445
|
-
!
|
|
457
|
+
!J && Q
|
|
446
458
|
]
|
|
447
459
|
}
|
|
448
460
|
),
|
|
449
|
-
|
|
450
|
-
!
|
|
461
|
+
J && /* @__PURE__ */ e("div", { className: "w-full", children: Q }),
|
|
462
|
+
!p && !n && h.length > 0 && /* @__PURE__ */ e(
|
|
451
463
|
"div",
|
|
452
464
|
{
|
|
453
|
-
className:
|
|
454
|
-
children:
|
|
455
|
-
const o = t.errors[0], F = o?.code === "file-too-large" ?
|
|
456
|
-
return /* @__PURE__ */
|
|
465
|
+
className: x("w-full mt-4 flex flex-col gap-2", u?.errorWrapper),
|
|
466
|
+
children: h.map((t, d) => {
|
|
467
|
+
const o = t.errors[0], F = o?.code === "file-too-large" ? R : o?.code === "file-invalid-type" ? I : o?.message || I;
|
|
468
|
+
return /* @__PURE__ */ r(
|
|
457
469
|
"div",
|
|
458
470
|
{
|
|
459
471
|
className: "w-full bg-[#DC26260F] p-4 flex items-start gap-4 rounded-[8px]",
|
|
460
472
|
children: [
|
|
461
|
-
/* @__PURE__ */ e(
|
|
462
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ e(ee, { size: 20, color: "#DC2626", className: "shrink-0" }),
|
|
474
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children: [
|
|
463
475
|
/* @__PURE__ */ e("span", { className: "font-semibold", children: t.file.name }),
|
|
464
476
|
" — ",
|
|
465
477
|
F
|
|
466
478
|
] })
|
|
467
479
|
]
|
|
468
480
|
},
|
|
469
|
-
|
|
481
|
+
d
|
|
470
482
|
);
|
|
471
483
|
})
|
|
472
484
|
}
|
|
@@ -474,8 +486,8 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, et = {
|
|
|
474
486
|
] });
|
|
475
487
|
}
|
|
476
488
|
);
|
|
477
|
-
|
|
489
|
+
ot.displayName = "Dropzone";
|
|
478
490
|
export {
|
|
479
|
-
|
|
491
|
+
ot as Dropzone
|
|
480
492
|
};
|
|
481
493
|
//# sourceMappingURL=Dropzone.js.map
|