@geekapps/silo-elements-nextjs 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/FileUploader.d.ts +7 -3
  2. package/dist/FileUploader.js +279 -38
  3. package/dist/FileUploader.js.map +1 -1
  4. package/dist/ImageUploader.d.ts +7 -3
  5. package/dist/ImageUploader.js +329 -66
  6. package/dist/ImageUploader.js.map +1 -1
  7. package/dist/MediaUploader.d.ts +7 -3
  8. package/dist/MediaUploader.js +654 -43
  9. package/dist/MediaUploader.js.map +1 -1
  10. package/dist/VideoPlayer.d.ts +20 -18
  11. package/dist/VideoPlayer.js +980 -675
  12. package/dist/VideoPlayer.js.map +1 -1
  13. package/dist/VideoUploader.d.ts +7 -3
  14. package/dist/VideoUploader.js +295 -43
  15. package/dist/VideoUploader.js.map +1 -1
  16. package/dist/components/DropZone.d.ts +8 -5
  17. package/dist/components/DropZone.js +134 -49
  18. package/dist/components/DropZone.js.map +1 -1
  19. package/dist/components/ProgressBar.d.ts +6 -4
  20. package/dist/components/ProgressBar.js +35 -15
  21. package/dist/components/ProgressBar.js.map +1 -1
  22. package/dist/index.d.ts +12 -12
  23. package/dist/index.js +1696 -10
  24. package/dist/index.js.map +1 -1
  25. package/dist/types.d.ts +12 -10
  26. package/dist/types.js +2 -1
  27. package/dist/types.js.map +1 -1
  28. package/dist/utils/format.d.ts +4 -3
  29. package/dist/utils/format.js +19 -26
  30. package/dist/utils/format.js.map +1 -1
  31. package/dist/utils/theme.d.ts +8 -5
  32. package/dist/utils/theme.js +34 -30
  33. package/dist/utils/theme.js.map +1 -1
  34. package/package.json +4 -3
  35. package/dist/FileUploader.d.ts.map +0 -1
  36. package/dist/ImageUploader.d.ts.map +0 -1
  37. package/dist/MediaUploader.d.ts.map +0 -1
  38. package/dist/VideoPlayer.d.ts.map +0 -1
  39. package/dist/VideoUploader.d.ts.map +0 -1
  40. package/dist/components/DropZone.d.ts.map +0 -1
  41. package/dist/components/ProgressBar.d.ts.map +0 -1
  42. package/dist/index.d.ts.map +0 -1
  43. package/dist/types.d.ts.map +0 -1
  44. package/dist/utils/format.d.ts.map +0 -1
  45. package/dist/utils/theme.d.ts.map +0 -1
@@ -1,48 +1,300 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useState, useCallback } from "react";
4
- import { useUpload } from "@silo/nextjs";
5
- import { DropZone } from "./components/DropZone.js";
6
- import { ProgressBar } from "./components/ProgressBar.js";
7
- import { formatBytes } from "./utils/format.js";
8
- import { resolveTheme, themeToVars } from "./utils/theme.js";
9
- export function VideoUploader({ bucket, expiresIn, private: isPrivate = true, onUpload, onError, className = "", style, disabled = false, maxSize, accept = "video/*", showPreview = true, theme, renderIcon, renderProgress, renderSuccess, renderError, children, }) {
10
- const uploadOpts = { private: isPrivate, ...(bucket !== undefined && { bucket }), ...(expiresIn !== undefined && { expiresIn }) };
11
- const { state, upload, reset } = useUpload(uploadOpts);
12
- const [preview, setPreview] = useState(null);
13
- const t = resolveTheme(theme);
14
- const vars = themeToVars(t);
15
- const handleFiles = useCallback(async (files) => {
16
- const file = files[0];
17
- if (!file)
18
- return;
19
- if (showPreview) {
20
- const url = URL.createObjectURL(file);
21
- setPreview(url);
22
- }
23
- try {
24
- const result = await upload(file);
25
- onUpload?.(result);
26
- }
27
- catch (err) {
28
- onError?.(err instanceof Error ? err : new Error(String(err)));
1
+ import { useState, useCallback, useRef } from 'react';
2
+ import { useUpload } from '@geekapps/silo-nextjs';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+
5
+ // src/utils/theme.ts
6
+ var defaultTheme = {
7
+ borderColor: "#e2e8f0",
8
+ borderColorActive: "#6366f1",
9
+ backgroundColor: "#f8fafc",
10
+ backgroundColorHover: "#f1f5f9",
11
+ textColor: "#0f172a",
12
+ textColorMuted: "#64748b",
13
+ accentColor: "#6366f1",
14
+ accentColorHover: "#4f46e5",
15
+ errorColor: "#ef4444",
16
+ successColor: "#22c55e",
17
+ borderRadius: "12px",
18
+ fontFamily: "inherit"
19
+ };
20
+ function resolveTheme(theme) {
21
+ return { ...defaultTheme, ...theme };
22
+ }
23
+ function themeToVars(theme) {
24
+ return {
25
+ "--silo-border": theme.borderColor,
26
+ "--silo-border-active": theme.borderColorActive,
27
+ "--silo-bg": theme.backgroundColor,
28
+ "--silo-bg-hover": theme.backgroundColorHover,
29
+ "--silo-text": theme.textColor,
30
+ "--silo-text-muted": theme.textColorMuted,
31
+ "--silo-accent": theme.accentColor,
32
+ "--silo-accent-hover": theme.accentColorHover,
33
+ "--silo-error": theme.errorColor,
34
+ "--silo-success": theme.successColor,
35
+ "--silo-radius": theme.borderRadius,
36
+ "--silo-font": theme.fontFamily
37
+ };
38
+ }
39
+ function DropZone({
40
+ accept,
41
+ multiple = false,
42
+ disabled = false,
43
+ maxSize,
44
+ onFiles,
45
+ onError,
46
+ className = "",
47
+ style,
48
+ theme,
49
+ children
50
+ }) {
51
+ const [dragging, setDragging] = useState(false);
52
+ const inputRef = useRef(null);
53
+ const t = resolveTheme(theme);
54
+ const vars = themeToVars(t);
55
+ const validate = useCallback(
56
+ (files) => {
57
+ return files.filter((f) => {
58
+ if (maxSize && f.size > maxSize) {
59
+ onError?.(new Error(`File "${f.name}" exceeds max size of ${maxSize} bytes`));
60
+ return false;
29
61
  }
30
- }, [upload, onUpload, onError, showPreview]);
31
- const containerStyle = {
32
- ...vars,
33
- display: "flex",
34
- flexDirection: "column",
35
- gap: "12px",
36
- width: "100%",
37
- fontFamily: "var(--silo-font)",
38
- ...style,
39
- };
40
- if (state.status === "error" && renderError) {
41
- return _jsx("div", { style: containerStyle, children: renderError(state.error, reset) });
62
+ return true;
63
+ });
64
+ },
65
+ [maxSize, onError]
66
+ );
67
+ const handleDrop = useCallback(
68
+ (e) => {
69
+ e.preventDefault();
70
+ setDragging(false);
71
+ if (disabled) return;
72
+ const files = Array.from(e.dataTransfer.files);
73
+ const valid = validate(files);
74
+ if (valid.length) onFiles(valid);
75
+ },
76
+ [disabled, validate, onFiles]
77
+ );
78
+ const handleChange = useCallback(
79
+ (e) => {
80
+ const files = Array.from(e.target.files ?? []);
81
+ const valid = validate(files);
82
+ if (valid.length) onFiles(valid);
83
+ e.target.value = "";
84
+ },
85
+ [validate, onFiles]
86
+ );
87
+ const rootStyle = {
88
+ ...vars,
89
+ fontFamily: "var(--silo-font)",
90
+ border: `2px dashed ${dragging ? "var(--silo-border-active)" : "var(--silo-border)"}`,
91
+ borderRadius: "var(--silo-radius)",
92
+ backgroundColor: dragging ? "var(--silo-bg-hover)" : "var(--silo-bg)",
93
+ color: "var(--silo-text)",
94
+ cursor: disabled ? "not-allowed" : "pointer",
95
+ transition: "border-color 0.15s, background-color 0.15s",
96
+ opacity: disabled ? 0.5 : 1,
97
+ ...style
98
+ };
99
+ return /* @__PURE__ */ jsxs(
100
+ "div",
101
+ {
102
+ className: `silo-dropzone${className ? ` ${className}` : ""}`,
103
+ style: rootStyle,
104
+ onDragOver: (e) => {
105
+ e.preventDefault();
106
+ if (!disabled) setDragging(true);
107
+ },
108
+ onDragLeave: () => setDragging(false),
109
+ onDrop: handleDrop,
110
+ onClick: () => !disabled && inputRef.current?.click(),
111
+ role: "button",
112
+ tabIndex: disabled ? -1 : 0,
113
+ onKeyDown: (e) => {
114
+ if (e.key === "Enter" || e.key === " ") inputRef.current?.click();
115
+ },
116
+ "aria-label": "Upload area",
117
+ children: [
118
+ /* @__PURE__ */ jsx(
119
+ "input",
120
+ {
121
+ ref: inputRef,
122
+ type: "file",
123
+ accept,
124
+ multiple,
125
+ style: { display: "none" },
126
+ onChange: handleChange,
127
+ disabled
128
+ }
129
+ ),
130
+ children
131
+ ]
42
132
  }
43
- if (state.status === "done" && renderSuccess) {
44
- return _jsx("div", { style: containerStyle, children: renderSuccess(state.result) });
133
+ );
134
+ }
135
+ function ProgressBar({ progress, className = "", style }) {
136
+ return /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ className: `silo-progress-track${className ? ` ${className}` : ""}`,
140
+ style: {
141
+ height: "6px",
142
+ borderRadius: "3px",
143
+ backgroundColor: "rgba(99,102,241,0.15)",
144
+ overflow: "hidden",
145
+ ...style
146
+ },
147
+ role: "progressbar",
148
+ "aria-valuenow": progress,
149
+ "aria-valuemin": 0,
150
+ "aria-valuemax": 100,
151
+ children: /* @__PURE__ */ jsx(
152
+ "div",
153
+ {
154
+ className: "silo-progress-fill",
155
+ style: {
156
+ height: "100%",
157
+ width: `${progress}%`,
158
+ backgroundColor: "var(--silo-accent, #6366f1)",
159
+ borderRadius: "3px",
160
+ transition: "width 0.2s ease"
161
+ }
162
+ }
163
+ )
45
164
  }
46
- return (_jsxs("div", { className: `silo-video-uploader${className ? ` ${className}` : ""}`, style: containerStyle, children: [_jsx(DropZone, { ...(accept !== undefined && { accept }), ...(maxSize !== undefined && { maxSize }), ...(onError !== undefined && { onError }), ...(theme !== undefined && { theme }), disabled: disabled || state.status === "uploading", onFiles: handleFiles, style: { padding: "32px 24px", textAlign: "center" }, children: preview && state.status !== "uploading" ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" }, children: [_jsx("video", { src: preview, style: { maxWidth: "100%", maxHeight: "180px", borderRadius: "8px" }, controls: false, muted: true, playsInline: true }), _jsx("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Click or drag to replace" })] })) : (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" }, children: [renderIcon ? renderIcon() : (_jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", style: { color: "var(--silo-text-muted)", opacity: 0.6 }, children: _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" }) })), children ?? (_jsxs(_Fragment, { children: [_jsx("span", { style: { fontWeight: 600, color: "var(--silo-text)" }, children: "Drop video here" }), _jsx("span", { style: { fontSize: "13px", color: "var(--silo-text-muted)" }, children: "or click to browse" }), _jsxs("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: ["MP4, MOV, MKV, WebM", maxSize ? ` · Max ${formatBytes(maxSize)}` : ""] })] }))] })) }), state.status === "uploading" && (_jsx("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: renderProgress ? renderProgress(state.progress) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: "13px", color: "var(--silo-text-muted)" }, children: [_jsx("span", { children: "Uploading video\u2026" }), _jsxs("span", { children: [state.progress, "%"] })] }), _jsx(ProgressBar, { progress: state.progress }), _jsx("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Processing will start after upload completes" })] })) })), state.status === "done" && !renderSuccess && (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "10px 14px", borderRadius: "8px", backgroundColor: "rgba(34,197,94,0.1)", color: "var(--silo-success, #22c55e)", fontSize: "14px" }, children: [_jsx("svg", { width: "18", height: "18", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), _jsx("span", { children: "Video uploaded \u2014 processing in background" }), _jsx("button", { onClick: (e) => { e.stopPropagation(); reset(); setPreview(null); }, style: { marginLeft: "auto", background: "none", border: "none", cursor: "pointer", fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Upload another" })] })), state.status === "error" && !renderError && (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "10px 14px", borderRadius: "8px", backgroundColor: "rgba(239,68,68,0.1)", color: "var(--silo-error, #ef4444)", fontSize: "14px" }, children: [_jsx("svg", { width: "18", height: "18", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }), _jsx("span", { children: state.error.message }), _jsx("button", { onClick: (e) => { e.stopPropagation(); reset(); }, style: { marginLeft: "auto", background: "none", border: "none", cursor: "pointer", fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Retry" })] }))] }));
165
+ );
166
+ }
167
+
168
+ // src/utils/format.ts
169
+ function formatBytes(bytes) {
170
+ if (bytes < 1024) return `${bytes} B`;
171
+ if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;
172
+ if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
173
+ return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
174
+ }
175
+ function VideoUploader({
176
+ bucket,
177
+ expiresIn,
178
+ private: isPrivate = true,
179
+ onUpload,
180
+ onError,
181
+ className = "",
182
+ style,
183
+ disabled = false,
184
+ maxSize,
185
+ accept = "video/*",
186
+ showPreview = true,
187
+ theme,
188
+ renderIcon,
189
+ renderProgress,
190
+ renderSuccess,
191
+ renderError,
192
+ children
193
+ }) {
194
+ const uploadOpts = { private: isPrivate, ...bucket !== void 0 && { bucket }, ...expiresIn !== void 0 && { expiresIn } };
195
+ const { state, upload, reset } = useUpload(uploadOpts);
196
+ const [preview, setPreview] = useState(null);
197
+ const t = resolveTheme(theme);
198
+ const vars = themeToVars(t);
199
+ const handleFiles = useCallback(
200
+ async (files) => {
201
+ const file = files[0];
202
+ if (!file) return;
203
+ if (showPreview) {
204
+ const url = URL.createObjectURL(file);
205
+ setPreview(url);
206
+ }
207
+ try {
208
+ const result = await upload(file);
209
+ onUpload?.(result);
210
+ } catch (err) {
211
+ onError?.(err instanceof Error ? err : new Error(String(err)));
212
+ }
213
+ },
214
+ [upload, onUpload, onError, showPreview]
215
+ );
216
+ const containerStyle = {
217
+ ...vars,
218
+ display: "flex",
219
+ flexDirection: "column",
220
+ gap: "12px",
221
+ width: "100%",
222
+ fontFamily: "var(--silo-font)",
223
+ ...style
224
+ };
225
+ if (state.status === "error" && renderError) {
226
+ return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderError(state.error, reset) });
227
+ }
228
+ if (state.status === "done" && renderSuccess) {
229
+ return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderSuccess(state.result) });
230
+ }
231
+ return /* @__PURE__ */ jsxs("div", { className: `silo-video-uploader${className ? ` ${className}` : ""}`, style: containerStyle, children: [
232
+ /* @__PURE__ */ jsx(
233
+ DropZone,
234
+ {
235
+ ...accept !== void 0 && { accept },
236
+ ...maxSize !== void 0 && { maxSize },
237
+ ...onError !== void 0 && { onError },
238
+ ...theme !== void 0 && { theme },
239
+ disabled: disabled || state.status === "uploading",
240
+ onFiles: handleFiles,
241
+ style: { padding: "32px 24px", textAlign: "center" },
242
+ children: preview && state.status !== "uploading" ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" }, children: [
243
+ /* @__PURE__ */ jsx(
244
+ "video",
245
+ {
246
+ src: preview,
247
+ style: { maxWidth: "100%", maxHeight: "180px", borderRadius: "8px" },
248
+ controls: false,
249
+ muted: true,
250
+ playsInline: true
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Click or drag to replace" })
254
+ ] }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "8px" }, children: [
255
+ renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", style: { color: "var(--silo-text-muted)", opacity: 0.6 }, 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" }) }),
256
+ children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
257
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: "var(--silo-text)" }, children: "Drop video here" }),
258
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: "var(--silo-text-muted)" }, children: "or click to browse" }),
259
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: [
260
+ "MP4, MOV, MKV, WebM",
261
+ maxSize ? ` \xB7 Max ${formatBytes(maxSize)}` : ""
262
+ ] })
263
+ ] })
264
+ ] })
265
+ }
266
+ ),
267
+ state.status === "uploading" && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: renderProgress ? renderProgress(state.progress) : /* @__PURE__ */ jsxs(Fragment, { children: [
268
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: "13px", color: "var(--silo-text-muted)" }, children: [
269
+ /* @__PURE__ */ jsx("span", { children: "Uploading video\u2026" }),
270
+ /* @__PURE__ */ jsxs("span", { children: [
271
+ state.progress,
272
+ "%"
273
+ ] })
274
+ ] }),
275
+ /* @__PURE__ */ jsx(ProgressBar, { progress: state.progress }),
276
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Processing will start after upload completes" })
277
+ ] }) }),
278
+ state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "10px 14px", borderRadius: "8px", backgroundColor: "rgba(34,197,94,0.1)", color: "var(--silo-success, #22c55e)", fontSize: "14px" }, children: [
279
+ /* @__PURE__ */ jsx("svg", { width: "18", height: "18", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
280
+ /* @__PURE__ */ jsx("span", { children: "Video uploaded \u2014 processing in background" }),
281
+ /* @__PURE__ */ jsx("button", { onClick: (e) => {
282
+ e.stopPropagation();
283
+ reset();
284
+ setPreview(null);
285
+ }, style: { marginLeft: "auto", background: "none", border: "none", cursor: "pointer", fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Upload another" })
286
+ ] }),
287
+ state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "10px 14px", borderRadius: "8px", backgroundColor: "rgba(239,68,68,0.1)", color: "var(--silo-error, #ef4444)", fontSize: "14px" }, children: [
288
+ /* @__PURE__ */ jsx("svg", { width: "18", height: "18", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
289
+ /* @__PURE__ */ jsx("span", { children: state.error.message }),
290
+ /* @__PURE__ */ jsx("button", { onClick: (e) => {
291
+ e.stopPropagation();
292
+ reset();
293
+ }, style: { marginLeft: "auto", background: "none", border: "none", cursor: "pointer", fontSize: "12px", color: "var(--silo-text-muted)" }, children: "Retry" })
294
+ ] })
295
+ ] });
47
296
  }
297
+
298
+ export { VideoUploader };
299
+ //# sourceMappingURL=VideoUploader.js.map
48
300
  //# sourceMappingURL=VideoUploader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoUploader.js","sourceRoot":"","sources":["../src/VideoUploader.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAsB,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,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AmD,GAAG,GACvH,EACN,yBAAO,KAAK,CAAC,KAAK,CAAC,OAAO,GAAQ,EAClC,iBAAQ,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,EAAE,sBAEzL,IACL,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"sources":["../src/utils/theme.ts","../src/components/DropZone.tsx","../src/components/ProgressBar.tsx","../src/utils/format.ts","../src/VideoUploader.tsx"],"names":["jsx","useState","useCallback","jsxs"],"mappings":";;;;;AAEO,IAAM,YAAA,GAAoC;AAAA,EAC/C,WAAA,EAAa,SAAA;AAAA,EACb,iBAAA,EAAmB,SAAA;AAAA,EACnB,eAAA,EAAiB,SAAA;AAAA,EACjB,oBAAA,EAAsB,SAAA;AAAA,EACtB,SAAA,EAAW,SAAA;AAAA,EACX,cAAA,EAAgB,SAAA;AAAA,EAChB,WAAA,EAAa,SAAA;AAAA,EACb,gBAAA,EAAkB,SAAA;AAAA,EAClB,UAAA,EAAY,SAAA;AAAA,EACZ,YAAA,EAAc,SAAA;AAAA,EACd,YAAA,EAAc,MAAA;AAAA,EACd,UAAA,EAAY;AACd,CAAA;AAEO,SAAS,aAAa,KAAA,EAAwC;AACnE,EAAA,OAAO,EAAE,GAAG,YAAA,EAAc,GAAG,KAAA,EAAM;AACrC;AAEO,SAAS,YAAY,KAAA,EAAoD;AAC9E,EAAA,OAAO;AAAA,IACL,iBAAiB,KAAA,CAAM,WAAA;AAAA,IACvB,wBAAwB,KAAA,CAAM,iBAAA;AAAA,IAC9B,aAAa,KAAA,CAAM,eAAA;AAAA,IACnB,mBAAmB,KAAA,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AA,CAAM,MAAM,OAAA,EAAQ,CAAA;AAAA,sBAC3BA,GAAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,CAAC,CAAA,KAAM;AAAE,QAAA,CAAA,CAAE,eAAA,EAAgB;AAAG,QAAA,KAAA,EAAM;AAAA,MAAG,GAAG,KAAA,EAAO,EAAE,UAAA,EAAY,MAAA,EAAQ,YAAY,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,WAAW,QAAA,EAAU,MAAA,EAAQ,KAAA,EAAO,wBAAA,IAA4B,QAAA,EAAA,OAAA,EAEpM;AAAA,KAAA,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"VideoUploader.js","sourcesContent":["import type { SiloTheme } from \"../types.js\";\n\nexport const defaultTheme: Required<SiloTheme> = {\n borderColor: \"#e2e8f0\",\n borderColorActive: \"#6366f1\",\n backgroundColor: \"#f8fafc\",\n backgroundColorHover: \"#f1f5f9\",\n textColor: \"#0f172a\",\n textColorMuted: \"#64748b\",\n accentColor: \"#6366f1\",\n accentColorHover: \"#4f46e5\",\n errorColor: \"#ef4444\",\n successColor: \"#22c55e\",\n borderRadius: \"12px\",\n fontFamily: \"inherit\",\n};\n\nexport function resolveTheme(theme?: SiloTheme): Required<SiloTheme> {\n return { ...defaultTheme, ...theme };\n}\n\nexport function themeToVars(theme: Required<SiloTheme>): Record<string, string> {\n return {\n \"--silo-border\": theme.borderColor,\n \"--silo-border-active\": theme.borderColorActive,\n \"--silo-bg\": theme.backgroundColor,\n \"--silo-bg-hover\": theme.backgroundColorHover,\n \"--silo-text\": theme.textColor,\n \"--silo-text-muted\": theme.textColorMuted,\n \"--silo-accent\": theme.accentColor,\n \"--silo-accent-hover\": theme.accentColorHover,\n \"--silo-error\": theme.errorColor,\n \"--silo-success\": theme.successColor,\n \"--silo-radius\": theme.borderRadius,\n \"--silo-font\": theme.fontFamily,\n };\n}\n","\"use client\";\n\nimport {\n useState,\n useRef,\n useCallback,\n type DragEvent,\n type ChangeEvent,\n type ReactNode,\n type CSSProperties,\n} from \"react\";\nimport type { SiloTheme } from \"../types.js\";\nimport { resolveTheme, themeToVars } from \"../utils/theme.js\";\n\ninterface DropZoneProps {\n accept?: string;\n multiple?: boolean;\n disabled?: boolean;\n maxSize?: number;\n onFiles: (files: File[]) => void;\n onError?: (error: Error) => void;\n className?: string;\n style?: CSSProperties;\n theme?: SiloTheme;\n children: ReactNode;\n}\n\nexport function DropZone({\n accept,\n multiple = false,\n disabled = false,\n maxSize,\n onFiles,\n onError,\n className = \"\",\n style,\n theme,\n children,\n}: DropZoneProps) {\n const [dragging, setDragging] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const t = resolveTheme(theme);\n const vars = themeToVars(t);\n\n const validate = useCallback(\n (files: File[]): File[] => {\n return files.filter((f) => {\n if (maxSize && f.size > maxSize) {\n onError?.(new Error(`File \"${f.name}\" exceeds max size of ${maxSize} bytes`));\n return false;\n }\n return true;\n });\n },\n [maxSize, onError]\n );\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragging(false);\n if (disabled) return;\n const files = Array.from(e.dataTransfer.files);\n const valid = validate(files);\n if (valid.length) onFiles(valid);\n },\n [disabled, validate, onFiles]\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(e.target.files ?? []);\n const valid = validate(files);\n if (valid.length) onFiles(valid);\n e.target.value = \"\";\n },\n [validate, onFiles]\n );\n\n const rootStyle: CSSProperties = {\n ...vars as CSSProperties,\n fontFamily: \"var(--silo-font)\",\n border: `2px dashed ${dragging ? \"var(--silo-border-active)\" : \"var(--silo-border)\"}`,\n borderRadius: \"var(--silo-radius)\",\n backgroundColor: dragging ? \"var(--silo-bg-hover)\" : \"var(--silo-bg)\",\n color: \"var(--silo-text)\",\n cursor: disabled ? \"not-allowed\" : \"pointer\",\n transition: \"border-color 0.15s, background-color 0.15s\",\n opacity: disabled ? 0.5 : 1,\n ...style,\n };\n\n return (\n <div\n className={`silo-dropzone${className ? ` ${className}` : \"\"}`}\n style={rootStyle}\n onDragOver={(e) => { e.preventDefault(); if (!disabled) setDragging(true); }}\n onDragLeave={() => setDragging(false)}\n onDrop={handleDrop}\n onClick={() => !disabled && inputRef.current?.click()}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onKeyDown={(e) => { if (e.key === \"Enter\" || e.key === \" \") inputRef.current?.click(); }}\n aria-label=\"Upload area\"\n >\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n style={{ display: \"none\" }}\n onChange={handleChange}\n disabled={disabled}\n />\n {children}\n </div>\n );\n}\n","\"use client\";\n\nimport type { CSSProperties } from \"react\";\n\ninterface ProgressBarProps {\n progress: number;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ProgressBar({ progress, className = \"\", style }: ProgressBarProps) {\n return (\n <div\n className={`silo-progress-track${className ? ` ${className}` : \"\"}`}\n style={{\n height: \"6px\",\n borderRadius: \"3px\",\n backgroundColor: \"rgba(99,102,241,0.15)\",\n overflow: \"hidden\",\n ...style,\n }}\n role=\"progressbar\"\n aria-valuenow={progress}\n aria-valuemin={0}\n aria-valuemax={100}\n >\n <div\n className=\"silo-progress-fill\"\n style={{\n height: \"100%\",\n width: `${progress}%`,\n backgroundColor: \"var(--silo-accent, #6366f1)\",\n borderRadius: \"3px\",\n transition: \"width 0.2s ease\",\n }}\n />\n </div>\n );\n}\n","export function formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;\n if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MB`;\n return `${(bytes / 1024 ** 3).toFixed(2)} GB`;\n}\n\nexport function getFileIcon(mimeType: string): string {\n if (mimeType.startsWith(\"image/\")) return \"🖼️\";\n if (mimeType.startsWith(\"video/\")) return \"🎬\";\n if (mimeType.startsWith(\"audio/\")) return \"🎵\";\n if (mimeType === \"application/pdf\") return \"📄\";\n if (mimeType.includes(\"spreadsheet\") || mimeType.includes(\"excel\")) return \"📊\";\n if (mimeType.includes(\"presentation\") || mimeType.includes(\"powerpoint\")) return \"📑\";\n if (mimeType.includes(\"word\") || mimeType.includes(\"document\")) return \"📝\";\n if (mimeType.includes(\"zip\") || mimeType.includes(\"tar\") || mimeType.includes(\"gzip\")) return \"📦\";\n return \"📎\";\n}\n","\"use client\";\n\nimport { useState, useCallback, type CSSProperties } from \"react\";\nimport { useUpload } from \"@geekapps/silo-nextjs\";\nimport type { VideoUploaderProps } from \"./types.js\";\nimport { DropZone } from \"./components/DropZone.js\";\nimport { ProgressBar } from \"./components/ProgressBar.js\";\nimport { formatBytes } from \"./utils/format.js\";\nimport { resolveTheme, themeToVars } from \"./utils/theme.js\";\n\nexport function VideoUploader({\n bucket,\n expiresIn,\n private: isPrivate = true,\n onUpload,\n onError,\n className = \"\",\n style,\n disabled = false,\n maxSize,\n accept = \"video/*\",\n showPreview = true,\n theme,\n renderIcon,\n renderProgress,\n renderSuccess,\n renderError,\n children,\n}: VideoUploaderProps) {\n const uploadOpts = { private: isPrivate, ...(bucket !== undefined && { bucket }), ...(expiresIn !== undefined && { expiresIn }) };\n const { state, upload, reset } = useUpload(uploadOpts);\n const [preview, setPreview] = useState<string | null>(null);\n const t = resolveTheme(theme);\n const vars = themeToVars(t);\n\n const handleFiles = useCallback(\n async (files: File[]) => {\n const file = files[0];\n if (!file) return;\n\n if (showPreview) {\n const url = URL.createObjectURL(file);\n setPreview(url);\n }\n\n try {\n const result = await upload(file);\n onUpload?.(result);\n } catch (err) {\n onError?.(err instanceof Error ? err : new Error(String(err)));\n }\n },\n [upload, onUpload, onError, showPreview]\n );\n\n const containerStyle: CSSProperties = {\n ...vars as CSSProperties,\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"12px\",\n width: \"100%\",\n fontFamily: \"var(--silo-font)\",\n ...style,\n };\n\n if (state.status === \"error\" && renderError) {\n return <div style={containerStyle}>{renderError(state.error, reset)}</div>;\n }\n if (state.status === \"done\" && renderSuccess) {\n return <div style={containerStyle}>{renderSuccess(state.result)}</div>;\n }\n\n return (\n <div className={`silo-video-uploader${className ? ` ${className}` : \"\"}`} style={containerStyle}>\n <DropZone\n {...(accept !== undefined && { accept })}\n {...(maxSize !== undefined && { maxSize })}\n {...(onError !== undefined && { onError })}\n {...(theme !== undefined && { theme })}\n disabled={disabled || state.status === \"uploading\"}\n onFiles={handleFiles}\n style={{ padding: \"32px 24px\", textAlign: \"center\" }}\n >\n {preview && state.status !== \"uploading\" ? (\n <div style={{ display: \"flex\", flexDirection: \"column\", alignItems: \"center\", gap: \"8px\" }}>\n <video\n src={preview}\n style={{ maxWidth: \"100%\", maxHeight: \"180px\", borderRadius: \"8px\" }}\n controls={false}\n muted\n playsInline\n />\n <span style={{ fontSize: \"12px\", color: \"var(--silo-text-muted)\" }}>\n Click or drag to replace\n </span>\n </div>\n ) : (\n <div style={{ display: \"flex\", flexDirection: \"column\", alignItems: \"center\", gap: \"8px\" }}>\n {renderIcon ? renderIcon() : (\n <svg width=\"40\" height=\"40\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" style={{ color: \"var(--silo-text-muted)\", opacity: 0.6 }}>\n <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\" />\n </svg>\n )}\n {children ?? (\n <>\n <span style={{ fontWeight: 600, color: \"var(--silo-text)\" }}>Drop video here</span>\n <span style={{ fontSize: \"13px\", color: \"var(--silo-text-muted)\" }}>or click to browse</span>\n <span style={{ fontSize: \"12px\", color: \"var(--silo-text-muted)\" }}>\n MP4, MOV, MKV, WebM{maxSize ? ` · Max ${formatBytes(maxSize)}` : \"\"}\n </span>\n </>\n )}\n </div>\n )}\n </DropZone>\n\n {state.status === \"uploading\" && (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"6px\" }}>\n {renderProgress ? renderProgress(state.progress) : (\n <>\n <div style={{ display: \"flex\", justifyContent: \"space-between\", fontSize: \"13px\", color: \"var(--silo-text-muted)\" }}>\n <span>Uploading video…</span>\n <span>{state.progress}%</span>\n </div>\n <ProgressBar progress={state.progress} />\n <span style={{ fontSize: \"12px\", color: \"var(--silo-text-muted)\" }}>\n Processing will start after upload completes\n </span>\n </>\n )}\n </div>\n )}\n\n {state.status === \"done\" && !renderSuccess && (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"8px\", padding: \"10px 14px\", borderRadius: \"8px\", backgroundColor: \"rgba(34,197,94,0.1)\", color: \"var(--silo-success, #22c55e)\", fontSize: \"14px\" }}>\n <svg width=\"18\" height=\"18\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 13l4 4L19 7\" />\n </svg>\n <span>Video uploaded — processing in background</span>\n <button onClick={(e) => { e.stopPropagation(); reset(); setPreview(null); }} style={{ marginLeft: \"auto\", background: \"none\", border: \"none\", cursor: \"pointer\", fontSize: \"12px\", color: \"var(--silo-text-muted)\" }}>\n Upload another\n </button>\n </div>\n )}\n\n {state.status === \"error\" && !renderError && (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"8px\", padding: \"10px 14px\", borderRadius: \"8px\", backgroundColor: \"rgba(239,68,68,0.1)\", color: \"var(--silo-error, #ef4444)\", fontSize: \"14px\" }}>\n <svg width=\"18\" height=\"18\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n <span>{state.error.message}</span>\n <button onClick={(e) => { e.stopPropagation(); reset(); }} style={{ marginLeft: \"auto\", background: \"none\", border: \"none\", cursor: \"pointer\", fontSize: \"12px\", color: \"var(--silo-text-muted)\" }}>\n Retry\n </button>\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -1,5 +1,8 @@
1
- import { type ReactNode, type CSSProperties } from "react";
2
- import type { SiloTheme } from "../types.js";
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ import { SiloTheme } from '../types.js';
4
+ import '@geekapps/silo-nextjs';
5
+
3
6
  interface DropZoneProps {
4
7
  accept?: string;
5
8
  multiple?: boolean;
@@ -12,6 +15,6 @@ interface DropZoneProps {
12
15
  theme?: SiloTheme;
13
16
  children: ReactNode;
14
17
  }
15
- export declare function DropZone({ accept, multiple, disabled, maxSize, onFiles, onError, className, style, theme, children, }: DropZoneProps): import("react/jsx-runtime").JSX.Element;
16
- export {};
17
- //# sourceMappingURL=DropZone.d.ts.map
18
+ declare function DropZone({ accept, multiple, disabled, maxSize, onFiles, onError, className, style, theme, children, }: DropZoneProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { DropZone };
@@ -1,52 +1,137 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useRef, useCallback, } from "react";
4
- import { resolveTheme, themeToVars } from "../utils/theme.js";
5
- export function DropZone({ accept, multiple = false, disabled = false, maxSize, onFiles, onError, className = "", style, theme, children, }) {
6
- const [dragging, setDragging] = useState(false);
7
- const inputRef = useRef(null);
8
- const t = resolveTheme(theme);
9
- const vars = themeToVars(t);
10
- const validate = useCallback((files) => {
11
- return files.filter((f) => {
12
- if (maxSize && f.size > maxSize) {
13
- onError?.(new Error(`File "${f.name}" exceeds max size of ${maxSize} bytes`));
14
- return false;
15
- }
16
- return true;
17
- });
18
- }, [maxSize, onError]);
19
- const handleDrop = useCallback((e) => {
1
+ import { useState, useRef, useCallback } from 'react';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/utils/theme.ts
5
+ var defaultTheme = {
6
+ borderColor: "#e2e8f0",
7
+ borderColorActive: "#6366f1",
8
+ backgroundColor: "#f8fafc",
9
+ backgroundColorHover: "#f1f5f9",
10
+ textColor: "#0f172a",
11
+ textColorMuted: "#64748b",
12
+ accentColor: "#6366f1",
13
+ accentColorHover: "#4f46e5",
14
+ errorColor: "#ef4444",
15
+ successColor: "#22c55e",
16
+ borderRadius: "12px",
17
+ fontFamily: "inherit"
18
+ };
19
+ function resolveTheme(theme) {
20
+ return { ...defaultTheme, ...theme };
21
+ }
22
+ function themeToVars(theme) {
23
+ return {
24
+ "--silo-border": theme.borderColor,
25
+ "--silo-border-active": theme.borderColorActive,
26
+ "--silo-bg": theme.backgroundColor,
27
+ "--silo-bg-hover": theme.backgroundColorHover,
28
+ "--silo-text": theme.textColor,
29
+ "--silo-text-muted": theme.textColorMuted,
30
+ "--silo-accent": theme.accentColor,
31
+ "--silo-accent-hover": theme.accentColorHover,
32
+ "--silo-error": theme.errorColor,
33
+ "--silo-success": theme.successColor,
34
+ "--silo-radius": theme.borderRadius,
35
+ "--silo-font": theme.fontFamily
36
+ };
37
+ }
38
+ function DropZone({
39
+ accept,
40
+ multiple = false,
41
+ disabled = false,
42
+ maxSize,
43
+ onFiles,
44
+ onError,
45
+ className = "",
46
+ style,
47
+ theme,
48
+ children
49
+ }) {
50
+ const [dragging, setDragging] = useState(false);
51
+ const inputRef = useRef(null);
52
+ const t = resolveTheme(theme);
53
+ const vars = themeToVars(t);
54
+ const validate = useCallback(
55
+ (files) => {
56
+ return files.filter((f) => {
57
+ if (maxSize && f.size > maxSize) {
58
+ onError?.(new Error(`File "${f.name}" exceeds max size of ${maxSize} bytes`));
59
+ return false;
60
+ }
61
+ return true;
62
+ });
63
+ },
64
+ [maxSize, onError]
65
+ );
66
+ const handleDrop = useCallback(
67
+ (e) => {
68
+ e.preventDefault();
69
+ setDragging(false);
70
+ if (disabled) return;
71
+ const files = Array.from(e.dataTransfer.files);
72
+ const valid = validate(files);
73
+ if (valid.length) onFiles(valid);
74
+ },
75
+ [disabled, validate, onFiles]
76
+ );
77
+ const handleChange = useCallback(
78
+ (e) => {
79
+ const files = Array.from(e.target.files ?? []);
80
+ const valid = validate(files);
81
+ if (valid.length) onFiles(valid);
82
+ e.target.value = "";
83
+ },
84
+ [validate, onFiles]
85
+ );
86
+ const rootStyle = {
87
+ ...vars,
88
+ fontFamily: "var(--silo-font)",
89
+ border: `2px dashed ${dragging ? "var(--silo-border-active)" : "var(--silo-border)"}`,
90
+ borderRadius: "var(--silo-radius)",
91
+ backgroundColor: dragging ? "var(--silo-bg-hover)" : "var(--silo-bg)",
92
+ color: "var(--silo-text)",
93
+ cursor: disabled ? "not-allowed" : "pointer",
94
+ transition: "border-color 0.15s, background-color 0.15s",
95
+ opacity: disabled ? 0.5 : 1,
96
+ ...style
97
+ };
98
+ return /* @__PURE__ */ jsxs(
99
+ "div",
100
+ {
101
+ className: `silo-dropzone${className ? ` ${className}` : ""}`,
102
+ style: rootStyle,
103
+ onDragOver: (e) => {
20
104
  e.preventDefault();
21
- setDragging(false);
22
- if (disabled)
23
- return;
24
- const files = Array.from(e.dataTransfer.files);
25
- const valid = validate(files);
26
- if (valid.length)
27
- onFiles(valid);
28
- }, [disabled, validate, onFiles]);
29
- const handleChange = useCallback((e) => {
30
- const files = Array.from(e.target.files ?? []);
31
- const valid = validate(files);
32
- if (valid.length)
33
- onFiles(valid);
34
- e.target.value = "";
35
- }, [validate, onFiles]);
36
- const rootStyle = {
37
- ...vars,
38
- fontFamily: "var(--silo-font)",
39
- border: `2px dashed ${dragging ? "var(--silo-border-active)" : "var(--silo-border)"}`,
40
- borderRadius: "var(--silo-radius)",
41
- backgroundColor: dragging ? "var(--silo-bg-hover)" : "var(--silo-bg)",
42
- color: "var(--silo-text)",
43
- cursor: disabled ? "not-allowed" : "pointer",
44
- transition: "border-color 0.15s, background-color 0.15s",
45
- opacity: disabled ? 0.5 : 1,
46
- ...style,
47
- };
48
- return (_jsxs("div", { className: `silo-dropzone${className ? ` ${className}` : ""}`, style: rootStyle, onDragOver: (e) => { e.preventDefault(); if (!disabled)
49
- setDragging(true); }, onDragLeave: () => setDragging(false), onDrop: handleDrop, onClick: () => !disabled && inputRef.current?.click(), role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ")
50
- inputRef.current?.click(); }, "aria-label": "Upload area", children: [_jsx("input", { ref: inputRef, type: "file", accept: accept, multiple: multiple, style: { display: "none" }, onChange: handleChange, disabled: disabled }), children] }));
105
+ if (!disabled) setDragging(true);
106
+ },
107
+ onDragLeave: () => setDragging(false),
108
+ onDrop: handleDrop,
109
+ onClick: () => !disabled && inputRef.current?.click(),
110
+ role: "button",
111
+ tabIndex: disabled ? -1 : 0,
112
+ onKeyDown: (e) => {
113
+ if (e.key === "Enter" || e.key === " ") inputRef.current?.click();
114
+ },
115
+ "aria-label": "Upload area",
116
+ children: [
117
+ /* @__PURE__ */ jsx(
118
+ "input",
119
+ {
120
+ ref: inputRef,
121
+ type: "file",
122
+ accept,
123
+ multiple,
124
+ style: { display: "none" },
125
+ onChange: handleChange,
126
+ disabled
127
+ }
128
+ ),
129
+ children
130
+ ]
131
+ }
132
+ );
51
133
  }
134
+
135
+ export { DropZone };
136
+ //# sourceMappingURL=DropZone.js.map
52
137
  //# sourceMappingURL=DropZone.js.map