@geekapps/silo-elements-nextjs 0.2.36 → 0.2.38
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/FileUploader.js +145 -166
- package/dist/FileUploader.js.map +1 -1
- package/dist/ImageUploader.js +121 -100
- package/dist/ImageUploader.js.map +1 -1
- package/dist/MediaUploader.js +403 -359
- package/dist/MediaUploader.js.map +1 -1
- package/dist/VideoPlayer.js +12 -12
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/VideoUploader.js +151 -125
- package/dist/VideoUploader.js.map +1 -1
- package/dist/components/DropZone.js +4 -4
- package/dist/components/DropZone.js.map +1 -1
- package/dist/components/ProgressBar.js +8 -2
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +593 -533
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -1
- package/package.json +6 -6
- package/styles.css +2 -0
package/dist/MediaUploader.js
CHANGED
|
@@ -89,9 +89,9 @@ function DropZone({
|
|
|
89
89
|
...style
|
|
90
90
|
};
|
|
91
91
|
const cls = [
|
|
92
|
-
"silo-
|
|
93
|
-
dragging ? "silo-
|
|
94
|
-
disabled ? "silo-
|
|
92
|
+
"silo-border-2 silo-border-dashed silo-border-slate-200 silo-rounded-xl silo-bg-slate-50 silo-text-slate-900 silo-cursor-pointer silo-outline-none silo-transition-colors silo-duration-150",
|
|
93
|
+
dragging ? "silo-border-indigo-500 silo-bg-slate-100" : "hover:silo-border-indigo-500 hover:silo-bg-slate-100",
|
|
94
|
+
disabled ? "silo-opacity-50 silo-cursor-not-allowed" : "",
|
|
95
95
|
className
|
|
96
96
|
].filter(Boolean).join(" ");
|
|
97
97
|
return /* @__PURE__ */ jsxs(
|
|
@@ -120,7 +120,7 @@ function DropZone({
|
|
|
120
120
|
type: "file",
|
|
121
121
|
accept,
|
|
122
122
|
multiple,
|
|
123
|
-
|
|
123
|
+
className: "hidden",
|
|
124
124
|
onChange: handleChange,
|
|
125
125
|
disabled
|
|
126
126
|
}
|
|
@@ -134,13 +134,19 @@ function ProgressBar({ progress, className = "", style }) {
|
|
|
134
134
|
return /* @__PURE__ */ jsx(
|
|
135
135
|
"div",
|
|
136
136
|
{
|
|
137
|
-
className: `
|
|
137
|
+
className: `h-1 rounded-full bg-slate-200 overflow-hidden${className ? ` ${className}` : ""}`,
|
|
138
138
|
style,
|
|
139
139
|
role: "progressbar",
|
|
140
140
|
"aria-valuenow": progress,
|
|
141
141
|
"aria-valuemin": 0,
|
|
142
142
|
"aria-valuemax": 100,
|
|
143
|
-
children: /* @__PURE__ */ jsx(
|
|
143
|
+
children: /* @__PURE__ */ jsx(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: "h-full rounded-full bg-indigo-500 transition-[width] duration-200 ease-linear",
|
|
147
|
+
style: { width: `${progress}%` }
|
|
148
|
+
}
|
|
149
|
+
)
|
|
144
150
|
}
|
|
145
151
|
);
|
|
146
152
|
}
|
|
@@ -153,60 +159,38 @@ var FORMATS = [
|
|
|
153
159
|
function ImageOptions({ value, onChange, style }) {
|
|
154
160
|
const fmt = value.format ?? "webp";
|
|
155
161
|
const optimize = value.optimize ?? true;
|
|
156
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5", style, children: [
|
|
157
163
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
158
|
-
/* @__PURE__ */ jsx("div", {
|
|
159
|
-
/* @__PURE__ */ jsx("div", {
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Formato de sa\xEDda" }),
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: FORMATS.map((f) => /* @__PURE__ */ jsx(
|
|
160
166
|
"button",
|
|
161
167
|
{
|
|
162
168
|
type: "button",
|
|
163
169
|
onClick: () => onChange({ ...value, format: f.value }),
|
|
164
170
|
title: f.hint,
|
|
165
|
-
|
|
166
|
-
padding: "4px 12px",
|
|
167
|
-
borderRadius: 6,
|
|
168
|
-
border: `1px solid ${fmt === f.value ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)"}`,
|
|
169
|
-
background: fmt === f.value ? "var(--silo-accent, #6366f1)" : "transparent",
|
|
170
|
-
color: fmt === f.value ? "#fff" : "var(--silo-text, #0f172a)",
|
|
171
|
-
fontSize: 12,
|
|
172
|
-
fontWeight: 600,
|
|
173
|
-
cursor: "pointer"
|
|
174
|
-
},
|
|
171
|
+
className: `py-1 px-3 rounded-md text-xs font-semibold cursor-pointer transition-colors border${fmt === f.value ? "border-indigo-500 bg-indigo-500 text-white" : "border-slate-200 bg-transparent text-slate-900 hover:bg-slate-100"}`,
|
|
175
172
|
children: f.label
|
|
176
173
|
},
|
|
177
174
|
f.value
|
|
178
175
|
)) })
|
|
179
176
|
] }),
|
|
180
|
-
/* @__PURE__ */ jsxs("label", {
|
|
177
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
181
178
|
/* @__PURE__ */ jsx(
|
|
182
179
|
"span",
|
|
183
180
|
{
|
|
184
181
|
onClick: () => onChange({ ...value, optimize: !optimize }),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
cursor: "pointer"
|
|
194
|
-
},
|
|
195
|
-
children: /* @__PURE__ */ jsx("span", { style: {
|
|
196
|
-
position: "absolute",
|
|
197
|
-
top: 2,
|
|
198
|
-
left: optimize ? 18 : 2,
|
|
199
|
-
width: 16,
|
|
200
|
-
height: 16,
|
|
201
|
-
borderRadius: "50%",
|
|
202
|
-
background: "#fff",
|
|
203
|
-
transition: "left 0.15s",
|
|
204
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
205
|
-
} })
|
|
182
|
+
className: `relative w-9 h-5 rounded-full shrink-0 cursor-pointer transition-colors duration-150${optimize ? "bg-indigo-500" : "bg-slate-200"}`,
|
|
183
|
+
children: /* @__PURE__ */ jsx(
|
|
184
|
+
"span",
|
|
185
|
+
{
|
|
186
|
+
className: "absolute top-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-[left] duration-150",
|
|
187
|
+
style: { left: optimize ? "18px" : "2px" }
|
|
188
|
+
}
|
|
189
|
+
)
|
|
206
190
|
}
|
|
207
191
|
),
|
|
208
|
-
/* @__PURE__ */ jsx("span", {
|
|
209
|
-
/* @__PURE__ */ jsx("span", {
|
|
192
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-slate-900 font-medium", children: "Otimizar tamanho" }),
|
|
193
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-400", children: optimize ? "Qualidade 85 \u2014 menor tamanho" : "Qualidade m\xE1xima" })
|
|
210
194
|
] })
|
|
211
195
|
] });
|
|
212
196
|
}
|
|
@@ -284,19 +268,14 @@ function ImageUploader({
|
|
|
284
268
|
}, [showImageOptions, image, imageOpts, doUpload, showPreview]);
|
|
285
269
|
const containerStyle = {
|
|
286
270
|
...vars,
|
|
287
|
-
display: "flex",
|
|
288
|
-
flexDirection: "column",
|
|
289
|
-
gap: "12px",
|
|
290
|
-
width: "100%",
|
|
291
|
-
fontFamily: "var(--silo-font)",
|
|
292
271
|
...style
|
|
293
272
|
};
|
|
294
273
|
const isUploading = state.status === "uploading" || state.status === "preparing" || state.status === "completing";
|
|
295
274
|
const progress = state.status === "uploading" ? state.progress : state.status === "completing" ? 99 : 0;
|
|
296
275
|
const isPaused = state.status === "idle" && preview !== null && !stagedFile;
|
|
297
|
-
if (state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderError(state.error, reset) });
|
|
298
|
-
if (state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderSuccess(state.result) });
|
|
299
|
-
return /* @__PURE__ */ jsxs("div", { className: `
|
|
276
|
+
if (state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderError(state.error, reset) });
|
|
277
|
+
if (state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderSuccess(state.result) });
|
|
278
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-3 w-full${className ? ` ${className}` : ""}`, style: containerStyle, children: [
|
|
300
279
|
/* @__PURE__ */ jsx(
|
|
301
280
|
DropZone,
|
|
302
281
|
{
|
|
@@ -307,15 +286,15 @@ function ImageUploader({
|
|
|
307
286
|
disabled: disabled || isUploading,
|
|
308
287
|
onFiles: handleFiles,
|
|
309
288
|
style: { padding: "32px 24px", textAlign: "center" },
|
|
310
|
-
children: preview && !isUploading && !stagedFile ? /* @__PURE__ */ jsxs("div", {
|
|
311
|
-
/* @__PURE__ */ jsx("img", { src: preview, alt: "Pr\xE9-visualiza\xE7\xE3o",
|
|
312
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
313
|
-
] }) : /* @__PURE__ */ jsxs("div", {
|
|
314
|
-
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "
|
|
289
|
+
children: preview && !isUploading && !stagedFile ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
290
|
+
/* @__PURE__ */ jsx("img", { src: preview, alt: "Pr\xE9-visualiza\xE7\xE3o", className: "max-w-full max-h-[200px] rounded-lg object-contain" }),
|
|
291
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12px] text-slate-400", children: "Clique ou arraste para trocar a imagem" })
|
|
292
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
293
|
+
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "text-slate-400 opacity-50", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
|
|
315
294
|
children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
316
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
317
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
318
|
-
maxSize && /* @__PURE__ */ jsxs("span", { className: "
|
|
295
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-900 font-bold text-[15px]", children: "Arraste sua imagem aqui" }),
|
|
296
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-500 text-[13px]", children: "ou clique para escolher do seu dispositivo" }),
|
|
297
|
+
maxSize && /* @__PURE__ */ jsxs("span", { className: "text-slate-400 text-[12px]", children: [
|
|
319
298
|
"Tamanho m\xE1ximo: ",
|
|
320
299
|
formatBytes(maxSize)
|
|
321
300
|
] })
|
|
@@ -324,61 +303,103 @@ function ImageUploader({
|
|
|
324
303
|
}
|
|
325
304
|
),
|
|
326
305
|
showImageOptions && stagedFile && !isUploading && state.status !== "done" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
327
|
-
preview && /* @__PURE__ */ jsx("div", { className: "
|
|
328
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
329
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
306
|
+
preview && /* @__PURE__ */ jsx("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: /* @__PURE__ */ jsx("img", { src: preview, alt: "Pr\xE9-visualiza\xE7\xE3o", className: "w-full max-h-[200px] object-contain block bg-slate-50" }) }),
|
|
307
|
+
/* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
308
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F5BC}\uFE0F Configura\xE7\xF5es de imagem" }),
|
|
330
309
|
/* @__PURE__ */ jsx(ImageOptions, { value: imageOpts, onChange: setImageOpts, style: { padding: "12px 14px" } })
|
|
331
310
|
] }),
|
|
332
|
-
/* @__PURE__ */ jsxs("div", {
|
|
333
|
-
/* @__PURE__ */ jsx(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
311
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
312
|
+
/* @__PURE__ */ jsx(
|
|
313
|
+
"button",
|
|
314
|
+
{
|
|
315
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer transition-colors hover:bg-slate-100",
|
|
316
|
+
onClick: () => {
|
|
317
|
+
setStagedFile(null);
|
|
318
|
+
setPreview(null);
|
|
319
|
+
},
|
|
320
|
+
children: "Cancelar"
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
"button",
|
|
325
|
+
{
|
|
326
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-indigo-500 text-white cursor-pointer transition-opacity hover:opacity-90",
|
|
327
|
+
onClick: () => {
|
|
328
|
+
const f = stagedFile;
|
|
329
|
+
setStagedFile(null);
|
|
330
|
+
void doUpload(f, imageOpts);
|
|
331
|
+
},
|
|
332
|
+
children: "Enviar imagem"
|
|
333
|
+
}
|
|
334
|
+
)
|
|
342
335
|
] })
|
|
343
336
|
] }),
|
|
344
|
-
isUploading && (renderProgress ? renderProgress(progress) : /* @__PURE__ */ jsxs("div", { className: "
|
|
345
|
-
/* @__PURE__ */ jsxs("div", {
|
|
346
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
347
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
337
|
+
isUploading && (renderProgress ? renderProgress(progress) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-3 py-4 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
338
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
339
|
+
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-slate-900", children: uploadLabel(state.status, progress) }),
|
|
340
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[13px] font-bold text-indigo-500", children: [
|
|
348
341
|
progress,
|
|
349
342
|
"%"
|
|
350
343
|
] })
|
|
351
344
|
] }),
|
|
352
345
|
/* @__PURE__ */ jsx(ProgressBar, { progress })
|
|
353
346
|
] })),
|
|
354
|
-
isPaused && /* @__PURE__ */ jsxs("div", {
|
|
355
|
-
/* @__PURE__ */ jsx(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
347
|
+
isPaused && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-emerald-500 text-white cursor-pointer hover:opacity-90",
|
|
352
|
+
onClick: () => resume({ ...bucket !== void 0 && { bucket }, image: imageOpts }),
|
|
353
|
+
children: "\u25B6 Retomar envio"
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
/* @__PURE__ */ jsx(
|
|
357
|
+
"button",
|
|
358
|
+
{
|
|
359
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100",
|
|
360
|
+
onClick: () => {
|
|
361
|
+
abort();
|
|
362
|
+
setPreview(null);
|
|
363
|
+
},
|
|
364
|
+
children: "Cancelar"
|
|
365
|
+
}
|
|
366
|
+
)
|
|
360
367
|
] }),
|
|
361
|
-
state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "
|
|
362
|
-
/* @__PURE__ */ jsx("span", {
|
|
363
|
-
/* @__PURE__ */ jsxs("div", {
|
|
364
|
-
/* @__PURE__ */ jsx("div", {
|
|
365
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
368
|
+
state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
369
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "\u2705" }),
|
|
370
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
371
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-sm text-green-700", children: "Imagem enviada com sucesso!" }),
|
|
372
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: formatBytes(state.result.size) })
|
|
366
373
|
] }),
|
|
367
|
-
/* @__PURE__ */ jsx(
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
374
|
+
/* @__PURE__ */ jsx(
|
|
375
|
+
"button",
|
|
376
|
+
{
|
|
377
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-green-500/30 text-green-700 bg-transparent cursor-pointer hover:bg-green-500/10 shrink-0",
|
|
378
|
+
onClick: () => {
|
|
379
|
+
reset();
|
|
380
|
+
setPreview(null);
|
|
381
|
+
},
|
|
382
|
+
children: "Enviar outra"
|
|
383
|
+
}
|
|
384
|
+
)
|
|
371
385
|
] }),
|
|
372
|
-
state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "
|
|
373
|
-
/* @__PURE__ */ jsx("span", {
|
|
374
|
-
/* @__PURE__ */ jsxs("div", {
|
|
375
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
376
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
386
|
+
state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-red-500/[0.07] rounded-xl border border-red-500/20", children: [
|
|
387
|
+
/* @__PURE__ */ jsx("span", { className: "text-[22px]", children: "\u26A0\uFE0F" }),
|
|
388
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
389
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-[13px] text-red-500", children: "N\xE3o foi poss\xEDvel enviar a imagem" }),
|
|
390
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: state.error.message })
|
|
377
391
|
] }),
|
|
378
|
-
/* @__PURE__ */ jsx(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
392
|
+
/* @__PURE__ */ jsx(
|
|
393
|
+
"button",
|
|
394
|
+
{
|
|
395
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-red-500/30 text-red-500 bg-transparent cursor-pointer hover:bg-red-500/10 shrink-0",
|
|
396
|
+
onClick: () => {
|
|
397
|
+
reset();
|
|
398
|
+
setPreview(null);
|
|
399
|
+
},
|
|
400
|
+
children: "Tentar novamente"
|
|
401
|
+
}
|
|
402
|
+
)
|
|
382
403
|
] })
|
|
383
404
|
] });
|
|
384
405
|
}
|
|
@@ -397,6 +418,27 @@ var RESOLUTION_LABELS = {
|
|
|
397
418
|
"1440": "1440p",
|
|
398
419
|
"2160": "4K"
|
|
399
420
|
};
|
|
421
|
+
function optionBtnCls(active) {
|
|
422
|
+
return `py-1 px-2.5 rounded-md text-xs font-semibold cursor-pointer transition-colors border ${active ? "border-indigo-500 bg-indigo-500 text-white" : "border-slate-200 bg-transparent text-slate-900 hover:bg-slate-100"}`;
|
|
423
|
+
}
|
|
424
|
+
function Toggle({ checked, onToggle, label }) {
|
|
425
|
+
return /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-1.5 cursor-pointer select-none text-xs text-slate-900 font-medium", onClick: onToggle, children: [
|
|
426
|
+
/* @__PURE__ */ jsx(
|
|
427
|
+
"span",
|
|
428
|
+
{
|
|
429
|
+
className: `relative inline-block w-8 h-[18px] rounded-full shrink-0 cursor-pointer transition-colors duration-150${checked ? "bg-indigo-500" : "bg-slate-200"}`,
|
|
430
|
+
children: /* @__PURE__ */ jsx(
|
|
431
|
+
"span",
|
|
432
|
+
{
|
|
433
|
+
className: "absolute top-0.5 w-3.5 h-3.5 rounded-full bg-white shadow-sm transition-[left] duration-150",
|
|
434
|
+
style: { left: checked ? "16px" : "2px" }
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
label
|
|
440
|
+
] });
|
|
441
|
+
}
|
|
400
442
|
function VideoOptions({ value, onChange, style }) {
|
|
401
443
|
const codec = value.codec ?? "h264";
|
|
402
444
|
const transcoding = value.transcoding ?? "auto";
|
|
@@ -413,76 +455,31 @@ function VideoOptions({ value, onChange, style }) {
|
|
|
413
455
|
function toggleFeature(key) {
|
|
414
456
|
onChange({ ...value, [key]: !value[key] });
|
|
415
457
|
}
|
|
416
|
-
|
|
417
|
-
padding: "4px 10px",
|
|
418
|
-
borderRadius: 6,
|
|
419
|
-
border: `1px solid ${active ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)"}`,
|
|
420
|
-
background: active ? "var(--silo-accent, #6366f1)" : "transparent",
|
|
421
|
-
color: active ? "#fff" : "var(--silo-text, #0f172a)",
|
|
422
|
-
fontSize: 12,
|
|
423
|
-
fontWeight: 600,
|
|
424
|
-
cursor: "pointer"
|
|
425
|
-
});
|
|
426
|
-
const toggle = (on) => ({
|
|
427
|
-
display: "inline-flex",
|
|
428
|
-
alignItems: "center",
|
|
429
|
-
gap: 6,
|
|
430
|
-
cursor: "pointer",
|
|
431
|
-
userSelect: "none",
|
|
432
|
-
fontSize: 12,
|
|
433
|
-
color: "var(--silo-text, #0f172a)",
|
|
434
|
-
fontWeight: 500
|
|
435
|
-
});
|
|
436
|
-
function Toggle({ checked, onToggle, label }) {
|
|
437
|
-
return /* @__PURE__ */ jsxs("label", { style: toggle(), onClick: onToggle, children: [
|
|
438
|
-
/* @__PURE__ */ jsx("span", { style: {
|
|
439
|
-
width: 32,
|
|
440
|
-
height: 18,
|
|
441
|
-
borderRadius: 9,
|
|
442
|
-
flexShrink: 0,
|
|
443
|
-
background: checked ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)",
|
|
444
|
-
position: "relative",
|
|
445
|
-
transition: "background 0.15s",
|
|
446
|
-
cursor: "pointer"
|
|
447
|
-
}, children: /* @__PURE__ */ jsx("span", { style: {
|
|
448
|
-
position: "absolute",
|
|
449
|
-
top: 2,
|
|
450
|
-
left: checked ? 16 : 2,
|
|
451
|
-
width: 14,
|
|
452
|
-
height: 14,
|
|
453
|
-
borderRadius: "50%",
|
|
454
|
-
background: "#fff",
|
|
455
|
-
transition: "left 0.15s",
|
|
456
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
457
|
-
} }) }),
|
|
458
|
-
label
|
|
459
|
-
] });
|
|
460
|
-
}
|
|
461
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12, ...style }, children: [
|
|
458
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", style, children: [
|
|
462
459
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
463
|
-
/* @__PURE__ */ jsx("div", {
|
|
464
|
-
/* @__PURE__ */ jsx("div", {
|
|
460
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Codec" }),
|
|
461
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: CODECS.map((c) => /* @__PURE__ */ jsx(
|
|
465
462
|
"button",
|
|
466
463
|
{
|
|
467
464
|
type: "button",
|
|
468
465
|
title: c.hint,
|
|
469
466
|
onClick: () => onChange({ ...value, codec: c.value }),
|
|
470
|
-
|
|
467
|
+
className: optionBtnCls(codec === c.value),
|
|
471
468
|
children: c.label
|
|
472
469
|
},
|
|
473
470
|
c.value
|
|
474
471
|
)) })
|
|
475
472
|
] }),
|
|
476
473
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
477
|
-
/* @__PURE__ */ jsx("div", {
|
|
478
|
-
/* @__PURE__ */ jsxs("div", {
|
|
479
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }),
|
|
474
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Resolu\xE7\xF5es" }),
|
|
475
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
|
|
476
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }), className: optionBtnCls(isAuto), children: "Auto" }),
|
|
480
477
|
RESOLUTIONS.map((r) => /* @__PURE__ */ jsx(
|
|
481
478
|
"button",
|
|
482
479
|
{
|
|
483
480
|
type: "button",
|
|
484
481
|
onClick: () => toggleRes(r),
|
|
485
|
-
|
|
482
|
+
className: optionBtnCls(!isAuto && selectedRes.includes(r)),
|
|
486
483
|
children: RESOLUTION_LABELS[r]
|
|
487
484
|
},
|
|
488
485
|
r
|
|
@@ -490,8 +487,8 @@ function VideoOptions({ value, onChange, style }) {
|
|
|
490
487
|
] })
|
|
491
488
|
] }),
|
|
492
489
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
493
|
-
/* @__PURE__ */ jsx("div", {
|
|
494
|
-
/* @__PURE__ */ jsxs("div", {
|
|
490
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-2", children: "Recursos" }),
|
|
491
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
495
492
|
/* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => toggleFeature("thumbnails"), label: "Gerar thumbnails" }),
|
|
496
493
|
/* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => toggleFeature("storyboard"), label: "Gerar storyboard" }),
|
|
497
494
|
/* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => toggleFeature("autoCaptions"), label: "Legendas autom\xE1ticas (IA)" }),
|
|
@@ -568,19 +565,14 @@ function VideoUploader({
|
|
|
568
565
|
}, [showVideoOptions, video, videoOpts, doUpload, showPreview]);
|
|
569
566
|
const containerStyle = {
|
|
570
567
|
...vars,
|
|
571
|
-
display: "flex",
|
|
572
|
-
flexDirection: "column",
|
|
573
|
-
gap: "12px",
|
|
574
|
-
width: "100%",
|
|
575
|
-
fontFamily: "var(--silo-font)",
|
|
576
568
|
...style
|
|
577
569
|
};
|
|
578
570
|
const isUploading = state.status === "uploading" || state.status === "preparing" || state.status === "completing";
|
|
579
571
|
const progress = state.status === "uploading" ? state.progress : state.status === "completing" ? 99 : 0;
|
|
580
572
|
const isPaused = state.status === "idle" && preview !== null && !stagedFile;
|
|
581
|
-
if (state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderError(state.error, reset) });
|
|
582
|
-
if (state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderSuccess(state.result) });
|
|
583
|
-
return /* @__PURE__ */ jsxs("div", { className: `
|
|
573
|
+
if (state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderError(state.error, reset) });
|
|
574
|
+
if (state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderSuccess(state.result) });
|
|
575
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-3 w-full${className ? ` ${className}` : ""}`, style: containerStyle, children: [
|
|
584
576
|
/* @__PURE__ */ jsx(
|
|
585
577
|
DropZone,
|
|
586
578
|
{
|
|
@@ -591,15 +583,15 @@ function VideoUploader({
|
|
|
591
583
|
disabled: disabled || isUploading,
|
|
592
584
|
onFiles: handleFiles,
|
|
593
585
|
style: { padding: "32px 24px", textAlign: "center" },
|
|
594
|
-
children: preview && !isUploading && !stagedFile ? /* @__PURE__ */ jsxs("div", {
|
|
595
|
-
/* @__PURE__ */ jsx("video", { src: preview,
|
|
596
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
597
|
-
] }) : /* @__PURE__ */ jsxs("div", {
|
|
598
|
-
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "
|
|
586
|
+
children: preview && !isUploading && !stagedFile ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
587
|
+
/* @__PURE__ */ jsx("video", { src: preview, className: "max-w-full max-h-[180px] rounded-lg", muted: true, playsInline: true }),
|
|
588
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12px] text-slate-400", children: "Clique ou arraste para trocar o v\xEDdeo" })
|
|
589
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
590
|
+
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "text-slate-400 opacity-50", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 10l4.553-2.069A1 1 0 0121 8.878v6.244a1 1 0 01-1.447.894L15 14M3 8a2 2 0 012-2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z" }) }),
|
|
599
591
|
children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
600
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
601
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
602
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
592
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-900 font-bold text-[15px]", children: "Arraste seu v\xEDdeo aqui" }),
|
|
593
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-500 text-[13px]", children: "ou clique para escolher do seu dispositivo" }),
|
|
594
|
+
/* @__PURE__ */ jsxs("span", { className: "text-slate-400 text-[12px]", children: [
|
|
603
595
|
"MP4, MOV, MKV, WebM",
|
|
604
596
|
maxSize ? ` \xB7 M\xE1x ${formatBytes(maxSize)}` : ""
|
|
605
597
|
] })
|
|
@@ -608,70 +600,119 @@ function VideoUploader({
|
|
|
608
600
|
}
|
|
609
601
|
),
|
|
610
602
|
showVideoOptions && stagedFile && !isUploading && state.status !== "done" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
611
|
-
preview && /* @__PURE__ */ jsx("div", { className: "
|
|
612
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
613
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
603
|
+
preview && /* @__PURE__ */ jsx("div", { className: "border border-slate-200 rounded-xl overflow-hidden bg-black", children: /* @__PURE__ */ jsx("video", { src: preview, className: "w-full max-h-[200px] block", muted: true, playsInline: true, controls: true }) }),
|
|
604
|
+
/* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
605
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F3AC} Configura\xE7\xF5es de v\xEDdeo" }),
|
|
614
606
|
/* @__PURE__ */ jsx(VideoOptions, { value: videoOpts, onChange: setVideoOpts, style: { padding: "12px 14px" } })
|
|
615
607
|
] }),
|
|
616
|
-
/* @__PURE__ */ jsxs("div", {
|
|
617
|
-
/* @__PURE__ */ jsx(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
608
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
609
|
+
/* @__PURE__ */ jsx(
|
|
610
|
+
"button",
|
|
611
|
+
{
|
|
612
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100",
|
|
613
|
+
onClick: () => {
|
|
614
|
+
setStagedFile(null);
|
|
615
|
+
setPreview(null);
|
|
616
|
+
setVideoOpts(createInitialVideoOpts(video));
|
|
617
|
+
},
|
|
618
|
+
children: "Cancelar"
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ jsx(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-indigo-500 text-white cursor-pointer hover:opacity-90",
|
|
625
|
+
onClick: () => {
|
|
626
|
+
const f = stagedFile;
|
|
627
|
+
setStagedFile(null);
|
|
628
|
+
void doUpload(f, videoOpts);
|
|
629
|
+
setVideoOpts(createInitialVideoOpts(video));
|
|
630
|
+
},
|
|
631
|
+
children: "Enviar v\xEDdeo"
|
|
632
|
+
}
|
|
633
|
+
)
|
|
628
634
|
] })
|
|
629
635
|
] }),
|
|
630
|
-
isUploading && (renderProgress ? renderProgress(progress) : /* @__PURE__ */ jsxs("div", { className: "
|
|
631
|
-
/* @__PURE__ */ jsxs("div", {
|
|
632
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
633
|
-
/* @__PURE__ */ jsxs("div", {
|
|
634
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
636
|
+
isUploading && (renderProgress ? renderProgress(progress) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-3 py-4 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
637
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
638
|
+
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-slate-900", children: uploadLabel2(state.status, progress) }),
|
|
639
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
640
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[13px] font-bold text-indigo-500", children: [
|
|
635
641
|
progress,
|
|
636
642
|
"%"
|
|
637
643
|
] }),
|
|
638
|
-
/* @__PURE__ */ jsx(
|
|
644
|
+
/* @__PURE__ */ jsx(
|
|
645
|
+
"button",
|
|
646
|
+
{
|
|
647
|
+
className: "inline-flex items-center justify-center text-[11px] font-semibold py-0.5 px-2 rounded-lg border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100",
|
|
648
|
+
onClick: pause,
|
|
649
|
+
children: "Pausar"
|
|
650
|
+
}
|
|
651
|
+
)
|
|
639
652
|
] })
|
|
640
653
|
] }),
|
|
641
654
|
/* @__PURE__ */ jsx(ProgressBar, { progress }),
|
|
642
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
655
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-400", children: "O processamento do v\xEDdeo come\xE7a automaticamente ap\xF3s o envio" })
|
|
643
656
|
] })),
|
|
644
|
-
isPaused && /* @__PURE__ */ jsxs("div", {
|
|
645
|
-
/* @__PURE__ */ jsx(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
657
|
+
isPaused && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
658
|
+
/* @__PURE__ */ jsx(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-emerald-500 text-white cursor-pointer hover:opacity-90",
|
|
662
|
+
onClick: () => resume({ ...bucket !== void 0 && { bucket }, video: videoOpts }),
|
|
663
|
+
children: "\u25B6 Retomar envio"
|
|
664
|
+
}
|
|
665
|
+
),
|
|
666
|
+
/* @__PURE__ */ jsx(
|
|
667
|
+
"button",
|
|
668
|
+
{
|
|
669
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100",
|
|
670
|
+
onClick: () => {
|
|
671
|
+
abort();
|
|
672
|
+
setPreview(null);
|
|
673
|
+
},
|
|
674
|
+
children: "Cancelar"
|
|
675
|
+
}
|
|
676
|
+
)
|
|
650
677
|
] }),
|
|
651
|
-
state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "
|
|
652
|
-
/* @__PURE__ */ jsxs("div", {
|
|
653
|
-
/* @__PURE__ */ jsx("span", {
|
|
654
|
-
/* @__PURE__ */ jsxs("div", {
|
|
655
|
-
/* @__PURE__ */ jsx("div", {
|
|
656
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
678
|
+
state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-4 py-3.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
679
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
680
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "\u2705" }),
|
|
681
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
682
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-sm text-green-700", children: "V\xEDdeo enviado com sucesso!" }),
|
|
683
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: formatBytes(state.result.size) })
|
|
657
684
|
] }),
|
|
658
|
-
/* @__PURE__ */ jsx(
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
685
|
+
/* @__PURE__ */ jsx(
|
|
686
|
+
"button",
|
|
687
|
+
{
|
|
688
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-green-500/30 text-green-700 bg-transparent cursor-pointer hover:bg-green-500/10 shrink-0",
|
|
689
|
+
onClick: () => {
|
|
690
|
+
reset();
|
|
691
|
+
setPreview(null);
|
|
692
|
+
},
|
|
693
|
+
children: "Enviar outro"
|
|
694
|
+
}
|
|
695
|
+
)
|
|
662
696
|
] }),
|
|
663
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
697
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-500 px-3 py-2 rounded-lg bg-green-500/[0.06] border border-green-500/15", children: "\u{1F3AC} Seu v\xEDdeo est\xE1 sendo processado em segundo plano. Isso pode levar alguns minutos dependendo do tamanho." })
|
|
664
698
|
] }),
|
|
665
|
-
state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "
|
|
666
|
-
/* @__PURE__ */ jsx("span", {
|
|
667
|
-
/* @__PURE__ */ jsxs("div", {
|
|
668
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
669
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
699
|
+
state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-red-500/[0.07] rounded-xl border border-red-500/20", children: [
|
|
700
|
+
/* @__PURE__ */ jsx("span", { className: "text-[22px]", children: "\u26A0\uFE0F" }),
|
|
701
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
702
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-[13px] text-red-500", children: "N\xE3o foi poss\xEDvel enviar o v\xEDdeo" }),
|
|
703
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: state.error.message })
|
|
670
704
|
] }),
|
|
671
|
-
/* @__PURE__ */ jsx(
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
705
|
+
/* @__PURE__ */ jsx(
|
|
706
|
+
"button",
|
|
707
|
+
{
|
|
708
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-red-500/30 text-red-500 bg-transparent cursor-pointer hover:bg-red-500/10 shrink-0",
|
|
709
|
+
onClick: () => {
|
|
710
|
+
reset();
|
|
711
|
+
setPreview(null);
|
|
712
|
+
},
|
|
713
|
+
children: "Tentar novamente"
|
|
714
|
+
}
|
|
715
|
+
)
|
|
675
716
|
] })
|
|
676
717
|
] });
|
|
677
718
|
}
|
|
@@ -724,11 +765,6 @@ function FileUploader({
|
|
|
724
765
|
const vars = themeToVars(t);
|
|
725
766
|
const containerStyle = {
|
|
726
767
|
...vars,
|
|
727
|
-
display: "flex",
|
|
728
|
-
flexDirection: "column",
|
|
729
|
-
gap: "12px",
|
|
730
|
-
width: "100%",
|
|
731
|
-
fontFamily: "var(--silo-font)",
|
|
732
768
|
...style
|
|
733
769
|
};
|
|
734
770
|
const single = useMultipartUpload(bucket);
|
|
@@ -805,9 +841,9 @@ function FileUploader({
|
|
|
805
841
|
const isBatchUploading = batch.state.status === "uploading" || batch.state.status === "preparing";
|
|
806
842
|
const isUploading = isSingleUploading || isBatchUploading;
|
|
807
843
|
const singleProgress = single.state.status === "uploading" ? single.state.progress : single.state.status === "completing" ? 99 : 0;
|
|
808
|
-
if (single.state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderError(single.state.error, single.reset) });
|
|
809
|
-
if (single.state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderSuccess(single.state.result) });
|
|
810
|
-
return /* @__PURE__ */ jsxs("div", { className: `
|
|
844
|
+
if (single.state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderError(single.state.error, single.reset) });
|
|
845
|
+
if (single.state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderSuccess(single.state.result) });
|
|
846
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-3 w-full${className ? ` ${className}` : ""}`, style: containerStyle, children: [
|
|
811
847
|
!isBatch && !staged && /* @__PURE__ */ jsx(
|
|
812
848
|
DropZone,
|
|
813
849
|
{
|
|
@@ -819,12 +855,12 @@ function FileUploader({
|
|
|
819
855
|
disabled: disabled || isUploading,
|
|
820
856
|
onFiles: handleFiles,
|
|
821
857
|
style: { padding: "28px 24px", textAlign: "center" },
|
|
822
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
823
|
-
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "
|
|
858
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
859
|
+
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "text-slate-400 opacity-50", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" }) }),
|
|
824
860
|
children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
825
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
826
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
827
|
-
maxSize && /* @__PURE__ */ jsxs("span", { className: "
|
|
861
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-900 font-bold text-[15px]", children: multiple ? "Arraste seus arquivos aqui" : "Arraste seu arquivo aqui" }),
|
|
862
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-500 text-[13px]", children: "ou clique para escolher do seu dispositivo" }),
|
|
863
|
+
maxSize && /* @__PURE__ */ jsxs("span", { className: "text-slate-400 text-[12px]", children: [
|
|
828
864
|
"Tamanho m\xE1ximo: ",
|
|
829
865
|
formatBytes(maxSize)
|
|
830
866
|
] })
|
|
@@ -832,11 +868,11 @@ function FileUploader({
|
|
|
832
868
|
] })
|
|
833
869
|
}
|
|
834
870
|
),
|
|
835
|
-
staged && /* @__PURE__ */ jsxs("div", {
|
|
836
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
837
|
-
staged.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "
|
|
838
|
-
/* @__PURE__ */ jsx("span", {
|
|
839
|
-
/* @__PURE__ */ jsxs("div", {
|
|
871
|
+
staged && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
872
|
+
/* @__PURE__ */ jsx("div", { className: "text-slate-500 text-[13px] font-semibold mb-0.5", children: staged.length === 1 ? "1 arquivo selecionado" : `${staged.length} arquivos selecionados` }),
|
|
873
|
+
staged.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 py-2.5 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
874
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl shrink-0", children: getFileIcon(f.type) }),
|
|
875
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
840
876
|
editingIndex === i ? /* @__PURE__ */ jsx(
|
|
841
877
|
"input",
|
|
842
878
|
{
|
|
@@ -854,30 +890,28 @@ function FileUploader({
|
|
|
854
890
|
}
|
|
855
891
|
if (e.key === "Escape") setEditingIndex(null);
|
|
856
892
|
},
|
|
857
|
-
|
|
893
|
+
className: "w-full text-[13px] font-medium border border-indigo-500 rounded-md py-0.5 px-2 outline-none bg-slate-50 text-slate-900"
|
|
858
894
|
}
|
|
859
895
|
) : /* @__PURE__ */ jsxs(
|
|
860
896
|
"div",
|
|
861
897
|
{
|
|
862
|
-
className: "
|
|
863
|
-
style: { fontSize: 13, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", cursor: allowRename ? "text" : "default" },
|
|
898
|
+
className: `text-[13px] font-semibold text-slate-900 overflow-hidden text-ellipsis whitespace-nowrap${allowRename ? "cursor-text" : "cursor-default"}`,
|
|
864
899
|
onClick: () => allowRename && setEditingIndex(i),
|
|
865
900
|
title: allowRename ? "Clique para renomear" : void 0,
|
|
866
901
|
children: [
|
|
867
902
|
effectiveName(i, staged),
|
|
868
|
-
renames.has(i) && /* @__PURE__ */ jsx("span", { className: "
|
|
903
|
+
renames.has(i) && /* @__PURE__ */ jsx("span", { className: "text-indigo-500 ml-1.5 text-[10px] font-bold", children: "renomeado" })
|
|
869
904
|
]
|
|
870
905
|
}
|
|
871
906
|
),
|
|
872
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
907
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] text-slate-400 mt-0.5", children: formatBytes(f.size) })
|
|
873
908
|
] }),
|
|
874
909
|
allowRename && /* @__PURE__ */ jsx(
|
|
875
910
|
"button",
|
|
876
911
|
{
|
|
877
912
|
onClick: () => setEditingIndex(i),
|
|
878
913
|
title: "Renomear",
|
|
879
|
-
className: "
|
|
880
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 14, padding: "0 4px", flexShrink: 0 },
|
|
914
|
+
className: "text-slate-400 bg-none border-none cursor-pointer text-sm px-1 shrink-0 hover:text-slate-600",
|
|
881
915
|
children: "\u270F\uFE0F"
|
|
882
916
|
}
|
|
883
917
|
),
|
|
@@ -889,63 +923,75 @@ function FileUploader({
|
|
|
889
923
|
if (next.length === 0) clearStaging();
|
|
890
924
|
else setStaged(next);
|
|
891
925
|
},
|
|
892
|
-
className: "
|
|
893
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 18, padding: "0 4px", lineHeight: 1, flexShrink: 0 },
|
|
926
|
+
className: "text-slate-400 bg-none border-none cursor-pointer text-lg px-1 leading-none shrink-0 hover:text-slate-600",
|
|
894
927
|
children: "\xD7"
|
|
895
928
|
}
|
|
896
929
|
)
|
|
897
930
|
] }, i)),
|
|
898
|
-
showImageOptions && staged.some((f) => f.type.startsWith("image/")) && /* @__PURE__ */ jsxs("div", { className: "
|
|
899
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
931
|
+
showImageOptions && staged.some((f) => f.type.startsWith("image/")) && /* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
932
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F5BC}\uFE0F Configura\xE7\xF5es de imagem" }),
|
|
900
933
|
/* @__PURE__ */ jsx(ImageOptions, { value: imageOpts, onChange: setImageOpts, style: { padding: "12px 14px" } })
|
|
901
934
|
] }),
|
|
902
|
-
showVideoOptions && staged.some((f) => f.type.startsWith("video/")) && /* @__PURE__ */ jsxs("div", { className: "
|
|
903
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
935
|
+
showVideoOptions && staged.some((f) => f.type.startsWith("video/")) && /* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
936
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F3AC} Configura\xE7\xF5es de v\xEDdeo" }),
|
|
904
937
|
/* @__PURE__ */ jsx(VideoOptions, { value: videoOpts, onChange: setVideoOpts, style: { padding: "12px 14px" } })
|
|
905
938
|
] }),
|
|
906
|
-
/* @__PURE__ */ jsxs("div", {
|
|
907
|
-
/* @__PURE__ */ jsx(
|
|
908
|
-
|
|
939
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-1", children: [
|
|
940
|
+
/* @__PURE__ */ jsx(
|
|
941
|
+
"button",
|
|
942
|
+
{
|
|
943
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer transition-colors hover:bg-slate-100",
|
|
944
|
+
onClick: clearStaging,
|
|
945
|
+
children: "Cancelar"
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
/* @__PURE__ */ jsx(
|
|
949
|
+
"button",
|
|
950
|
+
{
|
|
951
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-indigo-500 text-white cursor-pointer transition-opacity hover:opacity-90",
|
|
952
|
+
onClick: handleConfirmUpload,
|
|
953
|
+
children: staged.length > 1 ? `Enviar ${staged.length} arquivos` : "Enviar arquivo"
|
|
954
|
+
}
|
|
955
|
+
)
|
|
909
956
|
] })
|
|
910
957
|
] }),
|
|
911
|
-
isSingleUploading && !isBatch && (renderProgress ? renderProgress(singleProgress) : /* @__PURE__ */ jsxs("div", { className: "
|
|
912
|
-
/* @__PURE__ */ jsxs("div", {
|
|
913
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
914
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
958
|
+
isSingleUploading && !isBatch && (renderProgress ? renderProgress(singleProgress) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-3 py-4 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
959
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
960
|
+
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-slate-900", children: uploadLabel3(single.state.status, singleProgress) }),
|
|
961
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[13px] font-bold text-indigo-500", children: [
|
|
915
962
|
singleProgress,
|
|
916
963
|
"%"
|
|
917
964
|
] })
|
|
918
965
|
] }),
|
|
919
966
|
/* @__PURE__ */ jsx(ProgressBar, { progress: singleProgress })
|
|
920
967
|
] })),
|
|
921
|
-
isBatch && /* @__PURE__ */ jsxs("div", {
|
|
968
|
+
isBatch && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
922
969
|
batch.state.files.map((f, i) => {
|
|
923
970
|
const st = f.status;
|
|
924
971
|
const p = st.status === "uploading" ? st.progress : st.status === "paused" ? st.progress : st.status === "done" ? 100 : st.status === "completing" ? 99 : 0;
|
|
925
972
|
const isPaused = st.status === "paused";
|
|
926
973
|
const isDone = st.status === "done";
|
|
927
974
|
const isErr = st.status === "error";
|
|
928
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
929
|
-
/* @__PURE__ */ jsxs("div", {
|
|
930
|
-
/* @__PURE__ */ jsx("span", {
|
|
931
|
-
/* @__PURE__ */ jsxs("div", {
|
|
932
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
933
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
975
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-stretch gap-2 px-3.5 py-3 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
976
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
977
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg shrink-0", children: getFileIcon(f.file.type) }),
|
|
978
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
979
|
+
/* @__PURE__ */ jsx("div", { className: "text-[13px] font-semibold text-slate-900 overflow-hidden text-ellipsis whitespace-nowrap", children: f.file.name }),
|
|
980
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] text-slate-400", children: formatBytes(f.file.size) })
|
|
934
981
|
] }),
|
|
935
|
-
isDone && /* @__PURE__ */ jsx("span", {
|
|
936
|
-
isErr && /* @__PURE__ */ jsx("span", { className: "
|
|
937
|
-
!isDone && !isErr && /* @__PURE__ */ jsx("span", { className: isPaused ? "
|
|
938
|
-
!isDone && !isErr && f.fileId && (isPaused ? /* @__PURE__ */ jsx("button", { className: "
|
|
982
|
+
isDone && /* @__PURE__ */ jsx("span", { className: "text-lg shrink-0", children: "\u2705" }),
|
|
983
|
+
isErr && /* @__PURE__ */ jsx("span", { className: "text-[12px] font-semibold text-red-500 shrink-0", children: "Erro no envio" }),
|
|
984
|
+
!isDone && !isErr && /* @__PURE__ */ jsx("span", { className: `text-[12px] font-bold shrink-0${isPaused ? "text-slate-400" : "text-indigo-500"}`, children: isPaused ? "Pausado" : `${p}%` }),
|
|
985
|
+
!isDone && !isErr && f.fileId && (isPaused ? /* @__PURE__ */ jsx("button", { className: "inline-flex items-center justify-center gap-1.5 text-[11px] font-semibold py-0.5 px-2.5 rounded-lg border-transparent bg-emerald-500 text-white cursor-pointer hover:opacity-90", onClick: () => batch.resumeFile(f.fileId), children: "Retomar" }) : st.status === "uploading" ? /* @__PURE__ */ jsx("button", { className: "inline-flex items-center justify-center gap-1.5 text-[11px] font-semibold py-0.5 px-2.5 rounded-lg border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100", onClick: () => batch.pauseFile(f.fileId), children: "Pausar" }) : null)
|
|
939
986
|
] }),
|
|
940
987
|
!isDone && !isErr && /* @__PURE__ */ jsx(ProgressBar, { progress: p })
|
|
941
988
|
] }, i);
|
|
942
989
|
}),
|
|
943
|
-
/* @__PURE__ */ jsxs("div", {
|
|
990
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
944
991
|
batch.state.status !== "done" && /* @__PURE__ */ jsx(
|
|
945
992
|
"button",
|
|
946
993
|
{
|
|
947
|
-
className: `
|
|
948
|
-
style: { flex: 1 },
|
|
994
|
+
className: `flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent text-white cursor-pointer hover:opacity-90${isBatchUploading ? "bg-amber-500" : "bg-emerald-500"}`,
|
|
949
995
|
onClick: isBatchUploading ? batch.pauseAll : batch.resumeAll,
|
|
950
996
|
children: isBatchUploading ? "\u23F8 Pausar tudo" : "\u25B6 Retomar tudo"
|
|
951
997
|
}
|
|
@@ -953,32 +999,46 @@ function FileUploader({
|
|
|
953
999
|
/* @__PURE__ */ jsx(
|
|
954
1000
|
"button",
|
|
955
1001
|
{
|
|
956
|
-
className: `
|
|
1002
|
+
className: `inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent text-white cursor-pointer hover:opacity-90${batch.state.status === "done" ? "bg-indigo-500" : "bg-red-500/90"}`,
|
|
957
1003
|
onClick: batch.state.status === "done" ? batch.reset : batch.abortAll,
|
|
958
1004
|
children: batch.state.status === "done" ? "Enviar mais arquivos" : "Cancelar"
|
|
959
1005
|
}
|
|
960
1006
|
)
|
|
961
1007
|
] }),
|
|
962
|
-
batch.state.status === "done" && /* @__PURE__ */ jsxs("div", { className: "
|
|
963
|
-
/* @__PURE__ */ jsx("span", {
|
|
964
|
-
/* @__PURE__ */ jsx("span", {
|
|
1008
|
+
batch.state.status === "done" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 py-2.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
1009
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl", children: "\u{1F389}" }),
|
|
1010
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-green-700", children: batch.state.files.length === 1 ? "Arquivo enviado com sucesso!" : `${batch.state.files.length} arquivos enviados com sucesso!` })
|
|
965
1011
|
] })
|
|
966
1012
|
] }),
|
|
967
|
-
single.state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "
|
|
968
|
-
/* @__PURE__ */ jsx("span", {
|
|
969
|
-
/* @__PURE__ */ jsxs("div", {
|
|
970
|
-
/* @__PURE__ */ jsx("div", {
|
|
971
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1013
|
+
single.state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
1014
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "\u2705" }),
|
|
1015
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1016
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-sm text-green-700", children: "Arquivo enviado com sucesso!" }),
|
|
1017
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: formatBytes(single.state.result.size) })
|
|
972
1018
|
] }),
|
|
973
|
-
/* @__PURE__ */ jsx(
|
|
1019
|
+
/* @__PURE__ */ jsx(
|
|
1020
|
+
"button",
|
|
1021
|
+
{
|
|
1022
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-green-500/30 text-green-700 bg-transparent cursor-pointer hover:bg-green-500/10 shrink-0",
|
|
1023
|
+
onClick: single.reset,
|
|
1024
|
+
children: "Enviar outro"
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
974
1027
|
] }),
|
|
975
|
-
single.state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "
|
|
976
|
-
/* @__PURE__ */ jsx("span", {
|
|
977
|
-
/* @__PURE__ */ jsxs("div", {
|
|
978
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
979
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1028
|
+
single.state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-red-500/[0.07] rounded-xl border border-red-500/20", children: [
|
|
1029
|
+
/* @__PURE__ */ jsx("span", { className: "text-[22px]", children: "\u26A0\uFE0F" }),
|
|
1030
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1031
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-[13px] text-red-500", children: "N\xE3o foi poss\xEDvel enviar o arquivo" }),
|
|
1032
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: single.state.error.message })
|
|
980
1033
|
] }),
|
|
981
|
-
/* @__PURE__ */ jsx(
|
|
1034
|
+
/* @__PURE__ */ jsx(
|
|
1035
|
+
"button",
|
|
1036
|
+
{
|
|
1037
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-red-500/30 text-red-500 bg-transparent cursor-pointer hover:bg-red-500/10 shrink-0",
|
|
1038
|
+
onClick: single.reset,
|
|
1039
|
+
children: "Tentar novamente"
|
|
1040
|
+
}
|
|
1041
|
+
)
|
|
982
1042
|
] })
|
|
983
1043
|
] });
|
|
984
1044
|
}
|
|
@@ -1006,80 +1066,64 @@ function MediaUploader({
|
|
|
1006
1066
|
const vars = themeToVars(t);
|
|
1007
1067
|
const containerStyle = {
|
|
1008
1068
|
...vars,
|
|
1009
|
-
display: "flex",
|
|
1010
|
-
flexDirection: "column",
|
|
1011
|
-
gap: "0",
|
|
1012
|
-
width: "100%",
|
|
1013
|
-
fontFamily: "var(--silo-font)",
|
|
1014
|
-
border: "1px solid var(--silo-border)",
|
|
1015
|
-
borderRadius: "var(--silo-radius)",
|
|
1016
|
-
overflow: "hidden",
|
|
1017
|
-
backgroundColor: "var(--silo-bg)",
|
|
1018
1069
|
...style
|
|
1019
1070
|
};
|
|
1020
|
-
return /* @__PURE__ */ jsxs(
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
{
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
...onUpload !== void 0 && { onUpload },
|
|
1077
|
-
...onBatchUpload !== void 0 && { onBatchUpload },
|
|
1078
|
-
...onError !== void 0 && { onError }
|
|
1079
|
-
}
|
|
1080
|
-
)
|
|
1081
|
-
] })
|
|
1082
|
-
] });
|
|
1071
|
+
return /* @__PURE__ */ jsxs(
|
|
1072
|
+
"div",
|
|
1073
|
+
{
|
|
1074
|
+
className: `flex flex-col w-full border border-slate-200 rounded-xl overflow-hidden bg-slate-50${className ? ` ${className}` : ""}`,
|
|
1075
|
+
style: containerStyle,
|
|
1076
|
+
children: [
|
|
1077
|
+
/* @__PURE__ */ jsx("div", { className: "flex border-b border-slate-200", children: tabs.map((tab) => /* @__PURE__ */ jsxs(
|
|
1078
|
+
"button",
|
|
1079
|
+
{
|
|
1080
|
+
onClick: () => setActiveTab(tab),
|
|
1081
|
+
className: `flex-1 flex items-center justify-center gap-1.5 py-2.5 px-2 bg-transparent border-none border-b-2 cursor-pointer text-[13px] transition-colors duration-150${activeTab === tab ? "border-b-indigo-500 font-semibold text-indigo-500" : "border-b-transparent font-normal text-slate-400 hover:text-slate-600"}`,
|
|
1082
|
+
style: { borderBottom: `2px solid ${activeTab === tab ? "#6366f1" : "transparent"}` },
|
|
1083
|
+
children: [
|
|
1084
|
+
/* @__PURE__ */ jsx("span", { children: TAB_LABELS[tab].icon }),
|
|
1085
|
+
/* @__PURE__ */ jsx("span", { children: TAB_LABELS[tab].label })
|
|
1086
|
+
]
|
|
1087
|
+
},
|
|
1088
|
+
tab
|
|
1089
|
+
)) }),
|
|
1090
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1091
|
+
activeTab === "image" && /* @__PURE__ */ jsx(
|
|
1092
|
+
ImageUploader,
|
|
1093
|
+
{
|
|
1094
|
+
...shared,
|
|
1095
|
+
...imageProps,
|
|
1096
|
+
...theme !== void 0 && { theme },
|
|
1097
|
+
...onUpload !== void 0 && { onUpload },
|
|
1098
|
+
...onError !== void 0 && { onError }
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
activeTab === "video" && /* @__PURE__ */ jsx(
|
|
1102
|
+
VideoUploader,
|
|
1103
|
+
{
|
|
1104
|
+
...shared,
|
|
1105
|
+
...videoProps,
|
|
1106
|
+
...theme !== void 0 && { theme },
|
|
1107
|
+
...onUpload !== void 0 && { onUpload },
|
|
1108
|
+
...onError !== void 0 && { onError }
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
activeTab === "file" && /* @__PURE__ */ jsx(
|
|
1112
|
+
FileUploader,
|
|
1113
|
+
{
|
|
1114
|
+
...shared,
|
|
1115
|
+
...fileProps,
|
|
1116
|
+
multiple: true,
|
|
1117
|
+
...theme !== void 0 && { theme },
|
|
1118
|
+
...onUpload !== void 0 && { onUpload },
|
|
1119
|
+
...onBatchUpload !== void 0 && { onBatchUpload },
|
|
1120
|
+
...onError !== void 0 && { onError }
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
] })
|
|
1124
|
+
]
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1083
1127
|
}
|
|
1084
1128
|
|
|
1085
1129
|
export { MediaUploader };
|