react-upload-pro 0.1.0
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/LICENSE +21 -0
- package/README.md +736 -0
- package/dist/UploadProgress-8cEls1YP.d.cts +145 -0
- package/dist/UploadProgress-uRdhENqW.d.ts +145 -0
- package/dist/chunk-JI2V5ITY.js +2985 -0
- package/dist/chunk-JI2V5ITY.js.map +1 -0
- package/dist/chunk-VVMPVTIX.cjs +3030 -0
- package/dist/chunk-VVMPVTIX.cjs.map +1 -0
- package/dist/cloud/index.cjs +287 -0
- package/dist/cloud/index.cjs.map +1 -0
- package/dist/cloud/index.d.cts +125 -0
- package/dist/cloud/index.d.ts +125 -0
- package/dist/cloud/index.js +279 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/index.cjs +534 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +377 -0
- package/dist/index.d.ts +377 -0
- package/dist/index.js +351 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +81 -0
- package/dist/types-BDyFUrlv.d.cts +218 -0
- package/dist/types-BDyFUrlv.d.ts +218 -0
- package/dist/variants/index.cjs +1028 -0
- package/dist/variants/index.cjs.map +1 -0
- package/dist/variants/index.d.cts +106 -0
- package/dist/variants/index.d.ts +106 -0
- package/dist/variants/index.js +1005 -0
- package/dist/variants/index.js.map +1 -0
- package/package.json +122 -0
- package/tailwind.preset.cjs +37 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { c as DropzoneOptions, f as UploadFile, F as FileMetadata, d as DropzoneState, l as ValidationError, V as ValidationConfig, T as Theme, L as Locale, e as Translations } from './types-BDyFUrlv.js';
|
|
2
|
+
export { A as Accept, C as ChunkState, a as CloudAdapter, b as CloudUploadResult, D as DropzoneCallbacks, U as UploadError, g as UploadMode, h as UploadStatus, i as UploadStrategy, j as UploadTokenPayload, k as UploaderConfig, m as ValidationErrorCode } from './types-BDyFUrlv.js';
|
|
3
|
+
import { c as UseDropzoneReturn, P as ProgressVariant } from './UploadProgress-uRdhENqW.js';
|
|
4
|
+
export { I as InputProps, R as RootProps, U as UploadProgress, a as UploadProgressProps, b as UploadQueue, d as UseUploadQueueOptions, e as UseUploadQueueReturn, u as useDropzone, f as useUploadQueue } from './UploadProgress-uRdhENqW.js';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, SVGProps } from 'react';
|
|
7
|
+
import { ClassValue } from 'clsx';
|
|
8
|
+
|
|
9
|
+
type UseUploaderOptions = DropzoneOptions;
|
|
10
|
+
type UseUploaderReturn = UseDropzoneReturn;
|
|
11
|
+
/**
|
|
12
|
+
* Alias of useDropzone with an `auto` mode default. Useful when the user
|
|
13
|
+
* wants files to upload immediately on selection (no separate "Upload" button).
|
|
14
|
+
*/
|
|
15
|
+
declare function useUploader(options?: UseUploaderOptions): UseUploaderReturn;
|
|
16
|
+
|
|
17
|
+
interface AggregateProgress {
|
|
18
|
+
total: number;
|
|
19
|
+
uploaded: number;
|
|
20
|
+
progress: number;
|
|
21
|
+
speed: number;
|
|
22
|
+
eta: number;
|
|
23
|
+
uploading: number;
|
|
24
|
+
completed: number;
|
|
25
|
+
errored: number;
|
|
26
|
+
pending: number;
|
|
27
|
+
}
|
|
28
|
+
/** Aggregate progress across a list of files. Pure function — no state. */
|
|
29
|
+
declare function useUploadProgress(files: UploadFile[]): AggregateProgress;
|
|
30
|
+
|
|
31
|
+
type PreviewKind = 'image' | 'video' | 'audio' | 'pdf' | 'text' | 'office' | 'archive' | 'other';
|
|
32
|
+
interface FilePreview {
|
|
33
|
+
kind: PreviewKind;
|
|
34
|
+
url?: string;
|
|
35
|
+
/** For text files: first ~64KB as a string. */
|
|
36
|
+
text?: string;
|
|
37
|
+
/** Loading state. */
|
|
38
|
+
loading: boolean;
|
|
39
|
+
/** Any error encountered while building the preview. */
|
|
40
|
+
error?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Lazy preview builder. For images/video/audio/pdf it returns the existing
|
|
44
|
+
* object URL; for text files it reads up to 64KB; office files return kind
|
|
45
|
+
* only (consumers can render a generic icon or call a server-side renderer).
|
|
46
|
+
*/
|
|
47
|
+
declare function useFilePreview(file: UploadFile | null | undefined): FilePreview;
|
|
48
|
+
|
|
49
|
+
type DivAttrs$1 = Omit<HTMLAttributes<HTMLDivElement>, 'onPause' | 'onResume' | 'onAbort'>;
|
|
50
|
+
interface UploadPreviewProps extends DivAttrs$1 {
|
|
51
|
+
file: UploadFile;
|
|
52
|
+
/** Layout density. */
|
|
53
|
+
density?: 'compact' | 'comfortable' | 'card';
|
|
54
|
+
/** Show speed + ETA while uploading. */
|
|
55
|
+
showStats?: boolean;
|
|
56
|
+
/** Show thumbnail for images/video. */
|
|
57
|
+
showThumb?: boolean;
|
|
58
|
+
/** Override the progress visual style. */
|
|
59
|
+
progressVariant?: ProgressVariant;
|
|
60
|
+
/** Override progress bar height (px) or circle diameter (px). */
|
|
61
|
+
progressSize?: number;
|
|
62
|
+
onRetry?: (file: UploadFile) => void;
|
|
63
|
+
onPause?: (file: UploadFile) => void;
|
|
64
|
+
onResume?: (file: UploadFile) => void;
|
|
65
|
+
onCancel?: (file: UploadFile) => void;
|
|
66
|
+
onRemove?: (file: UploadFile) => void;
|
|
67
|
+
onPreview?: (file: UploadFile) => void;
|
|
68
|
+
onDownload?: (file: UploadFile) => void;
|
|
69
|
+
onEdit?: (file: UploadFile) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A single row/card representing one file. Used as the building block of
|
|
73
|
+
* UploadGallery and most variants.
|
|
74
|
+
*/
|
|
75
|
+
declare function UploadPreview({ file, density, showStats, showThumb, progressVariant, progressSize, className, onRetry, onPause, onResume, onCancel, onRemove, onPreview, onDownload, onEdit, ...rest }: UploadPreviewProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
type GalleryLayout = 'list' | 'grid' | 'table' | 'compact';
|
|
78
|
+
type DivAttrs = Omit<HTMLAttributes<HTMLDivElement>, 'onSelect' | 'onPause' | 'onResume' | 'onAbort'>;
|
|
79
|
+
interface UploadGalleryProps extends DivAttrs, Omit<UploadPreviewProps, 'file'> {
|
|
80
|
+
files: UploadFile[];
|
|
81
|
+
layout?: GalleryLayout;
|
|
82
|
+
/** Allow drag-to-reorder. Requires onReorder. */
|
|
83
|
+
reorderable?: boolean;
|
|
84
|
+
onReorder?: (from: number, to: number) => void;
|
|
85
|
+
/** Allow free-text search by filename. */
|
|
86
|
+
searchable?: boolean;
|
|
87
|
+
/** Allow status filter chips. */
|
|
88
|
+
filterable?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable the built-in fullscreen preview modal (images / video / pdf / text).
|
|
91
|
+
* Adds an eye icon to each row. Has no effect if a custom `onPreview` is passed.
|
|
92
|
+
*/
|
|
93
|
+
previewable?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Enable the built-in edit modal (rename + metadata). Adds a pencil icon.
|
|
96
|
+
* Has no effect if a custom `onEdit` is passed.
|
|
97
|
+
*
|
|
98
|
+
* If `onRename` / `onMetadataChange` are provided, they're called on save.
|
|
99
|
+
*/
|
|
100
|
+
editable?: boolean;
|
|
101
|
+
/** Called when the edit modal renames a file. */
|
|
102
|
+
onRename?: (file: UploadFile, newName: string) => void;
|
|
103
|
+
/** Called when the edit modal saves metadata. */
|
|
104
|
+
onMetadataChange?: (file: UploadFile, metadata: FileMetadata) => void;
|
|
105
|
+
/**
|
|
106
|
+
* When the visible file count exceeds this threshold, the file list becomes
|
|
107
|
+
* a scrollable region with the height set by `maxHeight` (default ~3 rows).
|
|
108
|
+
* Set to 0 to disable. Recommended for long lists so the page doesn't grow
|
|
109
|
+
* unbounded.
|
|
110
|
+
*/
|
|
111
|
+
scrollAfter?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Max CSS height for the scrollable list region. Used together with
|
|
114
|
+
* `scrollAfter`. Accepts any valid CSS value ('280px', '24rem', '40vh').
|
|
115
|
+
* Default: '280px' (≈ 3 comfortable rows).
|
|
116
|
+
*/
|
|
117
|
+
maxHeight?: string;
|
|
118
|
+
emptyState?: React.ReactNode;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Renders a list of files using one of several layouts. Search/filter/sort
|
|
122
|
+
* are built-in. Drag-to-reorder is opt-in. When `previewable` or `editable`
|
|
123
|
+
* is set, the gallery also manages the corresponding modals — pass through
|
|
124
|
+
* `onRename` / `onMetadataChange` to persist the changes.
|
|
125
|
+
*/
|
|
126
|
+
declare function UploadGallery({ files, layout, reorderable, onReorder, searchable, filterable, previewable, editable, onRename, onMetadataChange, scrollAfter, maxHeight, emptyState, className, density, showStats, showThumb, progressVariant, progressSize, onRetry, onPause, onResume, onCancel, onRemove, onPreview, onDownload, onEdit, ...rest }: UploadGalleryProps): react_jsx_runtime.JSX.Element;
|
|
127
|
+
|
|
128
|
+
interface DropzoneProps extends DropzoneOptions {
|
|
129
|
+
/** Render-prop API for full control. */
|
|
130
|
+
children?: (api: UseDropzoneReturn) => ReactNode;
|
|
131
|
+
/** Hide the built-in file list. Default false. */
|
|
132
|
+
hideGallery?: boolean;
|
|
133
|
+
/** Layout of the built-in gallery. Default 'list'. */
|
|
134
|
+
galleryLayout?: GalleryLayout;
|
|
135
|
+
/** Pick a progress visualization. */
|
|
136
|
+
progressVariant?: ProgressVariant;
|
|
137
|
+
/** Progress bar height (px) or circle diameter (px). */
|
|
138
|
+
progressSize?: number;
|
|
139
|
+
/** Enable the built-in fullscreen preview modal. */
|
|
140
|
+
previewable?: boolean;
|
|
141
|
+
/** Enable the built-in edit modal (rename + tags + metadata). */
|
|
142
|
+
editable?: boolean;
|
|
143
|
+
/** Called when the edit modal renames a file. Defaults to queue.rename. */
|
|
144
|
+
onRename?: (file: UploadFile, newName: string) => void;
|
|
145
|
+
/** Called when the edit modal saves metadata. Defaults to queue.setMetadata. */
|
|
146
|
+
onMetadataChange?: (file: UploadFile, metadata: FileMetadata) => void;
|
|
147
|
+
/** Once the file list exceeds this count, the list becomes scrollable. 0 = off. */
|
|
148
|
+
scrollAfter?: number;
|
|
149
|
+
/** Max CSS height for the scroll region. Default '280px'. */
|
|
150
|
+
maxHeight?: string;
|
|
151
|
+
/** Outer container width (any CSS value). */
|
|
152
|
+
width?: string;
|
|
153
|
+
/** Outer container height (any CSS value). */
|
|
154
|
+
height?: string;
|
|
155
|
+
/** Extra inline style merged onto the outer container. */
|
|
156
|
+
style?: React.CSSProperties;
|
|
157
|
+
className?: string;
|
|
158
|
+
/** Hint text under the icon. */
|
|
159
|
+
hint?: ReactNode;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The all-in-one drop-in component. For simple cases this is all you need.
|
|
163
|
+
* For more control, pass `children` as a render-prop.
|
|
164
|
+
*
|
|
165
|
+
* <Dropzone endpoint="/upload" maxSize={5e6} previewable editable>
|
|
166
|
+
* {({ getRootProps, getInputProps }) => (
|
|
167
|
+
* <div {...getRootProps()}>...</div>
|
|
168
|
+
* )}
|
|
169
|
+
* </Dropzone>
|
|
170
|
+
*/
|
|
171
|
+
declare function Dropzone({ children, hideGallery, galleryLayout, progressVariant, progressSize, previewable, editable, onRename, onMetadataChange, scrollAfter, maxHeight, width, height, style, className, hint, ...options }: DropzoneProps): react_jsx_runtime.JSX.Element;
|
|
172
|
+
|
|
173
|
+
interface UploadAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
174
|
+
state?: DropzoneState;
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
/** Replaces the default label content. */
|
|
177
|
+
children?: ReactNode;
|
|
178
|
+
/** Icon override. */
|
|
179
|
+
icon?: ReactNode;
|
|
180
|
+
/** Secondary descriptive line. */
|
|
181
|
+
description?: ReactNode;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The visual "drop here" surface, separated from the dropzone logic so users
|
|
185
|
+
* can drop it into any container that spreads getRootProps().
|
|
186
|
+
*/
|
|
187
|
+
declare function UploadArea({ state, disabled, children, icon, description, className, ...rest }: UploadAreaProps): react_jsx_runtime.JSX.Element;
|
|
188
|
+
|
|
189
|
+
type ButtonAttrs = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onDrop' | 'onPause' | 'onResume' | 'onAbort'>;
|
|
190
|
+
interface UploadButtonProps extends ButtonAttrs, DropzoneOptions {
|
|
191
|
+
/** Visual variant. */
|
|
192
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'outline';
|
|
193
|
+
/** Show the upload icon. */
|
|
194
|
+
icon?: ReactNode;
|
|
195
|
+
/** Hide the icon entirely. */
|
|
196
|
+
iconOnly?: boolean;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Standalone button that opens the file picker. Internally uses useDropzone
|
|
200
|
+
* with `noBubble` so nesting inside another dropzone is safe.
|
|
201
|
+
*/
|
|
202
|
+
declare function UploadButton({ variant, icon, iconOnly, children, className, disabled, multiple, directory, clipboard, accept, minSize, maxSize, maxFiles, rejectDuplicates, validators, onDrop, onDropAccepted, onDropRejected, onUploadStart, onUploadProgress, onUploadSuccess, onUploadError, onRetry, onPause, onResume, onRemove, onAllComplete, endpoint, method, headers, fieldName, formData, withCredentials, concurrency, strategy, mode, retries, retryBackoffMs, chunkSize, cloud, getUploadToken, virusScan, ...buttonProps }: UploadButtonProps): react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
interface UploadModalProps {
|
|
205
|
+
open: boolean;
|
|
206
|
+
onClose: () => void;
|
|
207
|
+
title?: ReactNode;
|
|
208
|
+
description?: ReactNode;
|
|
209
|
+
/** Children render inside the modal body. Typically a <Dropzone /> + gallery. */
|
|
210
|
+
children: ReactNode;
|
|
211
|
+
/** Wider modal for galleries. */
|
|
212
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
213
|
+
/** Hide the close button. */
|
|
214
|
+
hideClose?: boolean;
|
|
215
|
+
className?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* SSR-safe modal with a backdrop, ESC-to-close, focus trap (basic), and
|
|
219
|
+
* scroll lock. Mounted via React portal to document.body when available;
|
|
220
|
+
* renders nothing on the server.
|
|
221
|
+
*/
|
|
222
|
+
declare function UploadModal({ open, onClose, title, description, children, size, hideClose, className, }: UploadModalProps): react_jsx_runtime.JSX.Element | null;
|
|
223
|
+
|
|
224
|
+
interface FilePreviewModalProps {
|
|
225
|
+
file: UploadFile | null;
|
|
226
|
+
onClose: () => void;
|
|
227
|
+
/** Override download handler. By default, triggers a browser download of the local File. */
|
|
228
|
+
onDownload?: (file: UploadFile) => void;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Full-screen preview modal supporting images (with zoom/rotate), videos,
|
|
232
|
+
* audio, PDFs (iframe), and text files. Office files fall back to a generic
|
|
233
|
+
* "open in new tab" affordance because rendering DOCX/XLSX/PPTX client-side
|
|
234
|
+
* is out of scope for this library.
|
|
235
|
+
*/
|
|
236
|
+
declare function FilePreviewModal({ file, onClose, onDownload }: FilePreviewModalProps): react_jsx_runtime.JSX.Element;
|
|
237
|
+
|
|
238
|
+
interface FileEditModalProps {
|
|
239
|
+
file: UploadFile | null;
|
|
240
|
+
onClose: () => void;
|
|
241
|
+
/** Persist a new name (rename). */
|
|
242
|
+
onRename?: (file: UploadFile, newName: string) => void;
|
|
243
|
+
/** Persist metadata (tags / category / description / custom fields). */
|
|
244
|
+
onSave?: (file: UploadFile, metadata: FileMetadata) => void;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Modal for editing a single file's name + metadata. Drives the library's
|
|
248
|
+
* built-in `rename()` / `setMetadata()` queue methods when wired through
|
|
249
|
+
* UploadGallery, but the form itself is presentational — pass `onRename` /
|
|
250
|
+
* `onSave` to integrate with your own state.
|
|
251
|
+
*/
|
|
252
|
+
declare function FileEditModal({ file, onClose, onRename, onSave }: FileEditModalProps): react_jsx_runtime.JSX.Element;
|
|
253
|
+
|
|
254
|
+
interface ValidationErrorsModalProps {
|
|
255
|
+
open: boolean;
|
|
256
|
+
errors: ValidationError[];
|
|
257
|
+
onClose: () => void;
|
|
258
|
+
/** Modal title override. Default uses the localized "Failed" string. */
|
|
259
|
+
title?: React.ReactNode;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Shows validation rejections (wrong type, too large, too many, …) in a modal.
|
|
263
|
+
* Use together with the `onDropRejected` callback or by reading
|
|
264
|
+
* `api.rejected` from `useDropzone`.
|
|
265
|
+
*
|
|
266
|
+
* const [errors, setErrors] = useState<ValidationError[]>([]);
|
|
267
|
+
* <Dropzone accept="image/*" onDropRejected={setErrors} />
|
|
268
|
+
* <ValidationErrorsModal open={errors.length > 0} errors={errors} onClose={() => setErrors([])} />
|
|
269
|
+
*/
|
|
270
|
+
declare function ValidationErrorsModal({ open, errors, onClose, title, }: ValidationErrorsModalProps): react_jsx_runtime.JSX.Element | null;
|
|
271
|
+
|
|
272
|
+
declare const UploadIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
273
|
+
declare const FileIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
274
|
+
declare const ImageIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
275
|
+
declare const TrashIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare const PauseIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
277
|
+
declare const PlayIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
278
|
+
declare const RetryIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
279
|
+
declare const CheckIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
280
|
+
declare const AlertIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
281
|
+
declare const CloseIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
282
|
+
declare const DownloadIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
283
|
+
declare const EyeIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare const FolderIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
285
|
+
declare const EditIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
286
|
+
declare const MaximizeIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
287
|
+
declare const TagIcon: (p: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Match a file's MIME / extension against a list of acceptors.
|
|
291
|
+
* Supports `image/*` wildcards and `.ext` entries.
|
|
292
|
+
*/
|
|
293
|
+
declare function matchesAccept(file: File, acceptors: string[]): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Full single-file validation including custom async validators.
|
|
296
|
+
*/
|
|
297
|
+
declare function validateFile(file: File, config: ValidationConfig): Promise<ValidationError | null>;
|
|
298
|
+
/**
|
|
299
|
+
* Validate a batch of files. Applies built-in rules first, then maxFiles,
|
|
300
|
+
* then duplicate detection, then async validators. Returns accepted + rejected.
|
|
301
|
+
*/
|
|
302
|
+
declare function validateBatch(files: File[], config: ValidationConfig, existingCount?: number, existingKeys?: Set<string>): Promise<{
|
|
303
|
+
accepted: File[];
|
|
304
|
+
rejected: ValidationError[];
|
|
305
|
+
}>;
|
|
306
|
+
|
|
307
|
+
interface ThemeContextValue {
|
|
308
|
+
theme: Theme;
|
|
309
|
+
resolved: 'light' | 'dark';
|
|
310
|
+
setTheme: (theme: Theme) => void;
|
|
311
|
+
}
|
|
312
|
+
interface ThemeProviderProps {
|
|
313
|
+
/** Initial theme. Default 'auto'. */
|
|
314
|
+
defaultTheme?: Theme;
|
|
315
|
+
/** Override of resolved theme; useful for controlled mode. */
|
|
316
|
+
theme?: Theme;
|
|
317
|
+
/** Called when the user toggles the theme. */
|
|
318
|
+
onThemeChange?: (theme: Theme) => void;
|
|
319
|
+
children: ReactNode;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Wraps children in a theme context and applies a data-theme attribute to the
|
|
323
|
+
* scope so CSS variables can switch values. SSR-safe: `resolved` defaults to
|
|
324
|
+
* 'light' on the server and reconciles after hydration.
|
|
325
|
+
*/
|
|
326
|
+
declare function ThemeProvider({ defaultTheme, theme: controlled, onThemeChange, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
327
|
+
declare function useTheme(): ThemeContextValue;
|
|
328
|
+
|
|
329
|
+
interface I18nContextValue {
|
|
330
|
+
locale: Locale;
|
|
331
|
+
t: Translations;
|
|
332
|
+
isRtl: boolean;
|
|
333
|
+
}
|
|
334
|
+
interface I18nProviderProps {
|
|
335
|
+
locale?: Locale;
|
|
336
|
+
/** Override or extend translations for the active locale. */
|
|
337
|
+
messages?: Partial<Translations>;
|
|
338
|
+
children: ReactNode;
|
|
339
|
+
}
|
|
340
|
+
declare function I18nProvider({ locale, messages, children }: I18nProviderProps): react_jsx_runtime.JSX.Element;
|
|
341
|
+
declare function useI18n(): I18nContextValue;
|
|
342
|
+
|
|
343
|
+
declare const translations: Record<Locale, Translations>;
|
|
344
|
+
declare const rtlLocales: ReadonlySet<Locale>;
|
|
345
|
+
|
|
346
|
+
/** Combine Tailwind classes safely (resolves conflicts). */
|
|
347
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
348
|
+
|
|
349
|
+
/** Convert a native File into an UploadFile. */
|
|
350
|
+
declare function wrapFile(file: File, metadata?: FileMetadata): UploadFile;
|
|
351
|
+
/**
|
|
352
|
+
* Create an object URL for previews. SSR-safe (returns undefined on server).
|
|
353
|
+
* Caller is responsible for revoking via revokePreview.
|
|
354
|
+
*/
|
|
355
|
+
declare function generatePreview(file: File): string | undefined;
|
|
356
|
+
declare function revokePreview(url: string | undefined): void;
|
|
357
|
+
/** Best-effort file category from MIME or extension. */
|
|
358
|
+
declare function getFileCategory(file: File | UploadFile): 'image' | 'video' | 'audio' | 'pdf' | 'text' | 'office' | 'archive' | 'other';
|
|
359
|
+
/**
|
|
360
|
+
* Read the first 16 bytes of a file to validate its magic-number signature.
|
|
361
|
+
* Returns the detected MIME type or null. Best-effort, not exhaustive.
|
|
362
|
+
*
|
|
363
|
+
* Uses a small dispatch because `Blob.arrayBuffer` isn't always available
|
|
364
|
+
* (e.g., in some jsdom versions) — we fall back to FileReader.
|
|
365
|
+
*/
|
|
366
|
+
declare function detectSignature(file: File): Promise<string | null>;
|
|
367
|
+
|
|
368
|
+
/** Human-readable file size. */
|
|
369
|
+
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
370
|
+
/** Human-readable bytes/sec. */
|
|
371
|
+
declare function formatSpeed(bps: number): string;
|
|
372
|
+
/** Human-readable ETA in seconds. */
|
|
373
|
+
declare function formatEta(seconds: number): string;
|
|
374
|
+
/** Format a percent (0..1). */
|
|
375
|
+
declare function formatPercent(progress: number): string;
|
|
376
|
+
|
|
377
|
+
export { type AggregateProgress, AlertIcon, CheckIcon, CloseIcon, DownloadIcon, Dropzone, DropzoneOptions, type DropzoneProps, DropzoneState, EditIcon, EyeIcon, FileEditModal, type FileEditModalProps, FileIcon, FileMetadata, type FilePreview, FilePreviewModal, type FilePreviewModalProps, FolderIcon, type GalleryLayout, I18nProvider, ImageIcon, Locale, MaximizeIcon, PauseIcon, PlayIcon, type PreviewKind, ProgressVariant, RetryIcon, TagIcon, Theme, ThemeProvider, Translations, TrashIcon, UploadArea, type UploadAreaProps, UploadButton, type UploadButtonProps, UploadFile, UploadGallery, type UploadGalleryProps, UploadIcon, UploadModal, type UploadModalProps, UploadPreview, type UploadPreviewProps, UseDropzoneReturn, type UseUploaderOptions, type UseUploaderReturn, ValidationConfig, ValidationError, ValidationErrorsModal, type ValidationErrorsModalProps, cn, detectSignature, formatBytes, formatEta, formatPercent, formatSpeed, generatePreview, getFileCategory, matchesAccept, revokePreview, rtlLocales, translations, useFilePreview, useI18n, useTheme, useUploadProgress, useUploader, validateBatch, validateFile, wrapFile };
|