@spark-ui/components 11.2.4 → 11.3.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/dist/alert-dialog/index.mjs +1 -1
- package/dist/avatar/index.mjs +2 -2
- package/dist/carousel/index.mjs +2 -2
- package/dist/chunk-TKAU6SMC.mjs +197 -0
- package/dist/chunk-TKAU6SMC.mjs.map +1 -0
- package/dist/combobox/index.mjs +3 -3
- package/dist/dialog/index.mjs +1 -1
- package/dist/docgen.json +1800 -6
- package/dist/drawer/index.mjs +2 -2
- package/dist/dropdown/index.mjs +2 -2
- package/dist/file-upload/index.d.mts +283 -0
- package/dist/file-upload/index.d.ts +283 -0
- package/dist/file-upload/index.js +2042 -0
- package/dist/file-upload/index.js.map +1 -0
- package/dist/file-upload/index.mjs +828 -0
- package/dist/file-upload/index.mjs.map +1 -0
- package/dist/pagination/index.mjs +3 -3
- package/dist/popover/index.mjs +1 -1
- package/dist/progress/index.d.mts +2 -2
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/index.mjs +4 -193
- package/dist/progress/index.mjs.map +1 -1
- package/dist/scrolling-list/index.mjs +3 -3
- package/dist/snackbar/index.mjs +3 -3
- package/dist/stepper/index.mjs +2 -2
- package/dist/tabs/index.mjs +3 -3
- package/dist/toast/index.mjs +3 -3
- package/package.json +5 -5
package/dist/drawer/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
3
|
} from "../chunk-XYK6V3JF.mjs";
|
|
4
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
5
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
6
4
|
import {
|
|
7
5
|
Icon
|
|
8
6
|
} from "../chunk-UMUMFMFB.mjs";
|
|
7
|
+
import "../chunk-HEKSVWYW.mjs";
|
|
8
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
9
9
|
import "../chunk-KEGAAGJW.mjs";
|
|
10
10
|
import "../chunk-6QCEPQ3U.mjs";
|
|
11
11
|
|
package/dist/dropdown/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Popover
|
|
3
3
|
} from "../chunk-D7YBYT5H.mjs";
|
|
4
4
|
import "../chunk-XYK6V3JF.mjs";
|
|
5
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
6
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
7
5
|
import {
|
|
8
6
|
Icon
|
|
9
7
|
} from "../chunk-UMUMFMFB.mjs";
|
|
8
|
+
import "../chunk-HEKSVWYW.mjs";
|
|
9
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
10
10
|
import {
|
|
11
11
|
VisuallyHidden
|
|
12
12
|
} from "../chunk-KEGAAGJW.mjs";
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Ref, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { IconButton } from '../icon-button/index.mjs';
|
|
4
|
+
import { ButtonProps } from '../button/index.mjs';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
interface FileUploadProps {
|
|
9
|
+
/**
|
|
10
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
11
|
+
*/
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Initial files to display when the component mounts (uncontrolled mode)
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: File[];
|
|
20
|
+
/**
|
|
21
|
+
* Controlled files value (controlled mode)
|
|
22
|
+
* When provided, the component becomes controlled
|
|
23
|
+
*/
|
|
24
|
+
value?: File[];
|
|
25
|
+
/**
|
|
26
|
+
* Callback when files are selected
|
|
27
|
+
*/
|
|
28
|
+
onFilesChange?: (files: File[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether multiple files can be selected
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Comma-separated list of accepted file types
|
|
36
|
+
* Supports MIME types (e.g., "image/*", "image/png", "application/pdf")
|
|
37
|
+
* and file extensions (e.g., ".pdf", ".doc", ".jpg")
|
|
38
|
+
* @example "image/*"
|
|
39
|
+
* @example ".pdf,.doc"
|
|
40
|
+
* @example "image/png,image/jpeg,.pdf"
|
|
41
|
+
*/
|
|
42
|
+
accept?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum number of files that can be uploaded
|
|
45
|
+
* Files beyond this limit will be rejected
|
|
46
|
+
*/
|
|
47
|
+
maxFiles?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Callback when the maximum number of files is reached
|
|
50
|
+
* @param maxFiles - The maximum number of files allowed
|
|
51
|
+
* @param rejectedCount - The number of files that were rejected
|
|
52
|
+
*/
|
|
53
|
+
onMaxFilesReached?: (maxFiles: number, rejectedCount: number) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum file size in bytes
|
|
56
|
+
* Files larger than this will be rejected
|
|
57
|
+
*/
|
|
58
|
+
maxFileSize?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Minimum file size in bytes
|
|
61
|
+
* Files smaller than this will be rejected
|
|
62
|
+
*/
|
|
63
|
+
minFileSize?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Callback when a file size validation error occurs
|
|
66
|
+
* @param file - The file that failed validation
|
|
67
|
+
* @param error - The error message
|
|
68
|
+
*/
|
|
69
|
+
onFileSizeError?: (file: File, error: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* When `true`, prevents the user from interacting with the file upload
|
|
72
|
+
*/
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, sets the file upload to read-only mode
|
|
76
|
+
*/
|
|
77
|
+
readOnly?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
|
|
80
|
+
* Used for formatting file sizes and error messages.
|
|
81
|
+
* @default Browser locale or 'en' if not available
|
|
82
|
+
*/
|
|
83
|
+
locale?: string;
|
|
84
|
+
}
|
|
85
|
+
type FileUploadFileError = 'TOO_MANY_FILES' | 'FILE_INVALID_TYPE' | 'FILE_TOO_LARGE' | 'FILE_TOO_SMALL' | 'FILE_INVALID' | 'FILE_EXISTS';
|
|
86
|
+
interface RejectedFile$1 {
|
|
87
|
+
file: File;
|
|
88
|
+
errors: FileUploadFileError[];
|
|
89
|
+
}
|
|
90
|
+
declare const FileUpload$1: {
|
|
91
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFilesChange, multiple, accept, maxFiles, onMaxFilesReached, maxFileSize, minFileSize, onFileSizeError, disabled, readOnly, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
displayName: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
interface FileUploadAcceptedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
96
|
+
/**
|
|
97
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
98
|
+
*/
|
|
99
|
+
asChild?: boolean;
|
|
100
|
+
ref?: Ref<HTMLLIElement>;
|
|
101
|
+
/**
|
|
102
|
+
* The file to display
|
|
103
|
+
*/
|
|
104
|
+
file: File;
|
|
105
|
+
/**
|
|
106
|
+
* The index of the file in the accepted files array
|
|
107
|
+
*/
|
|
108
|
+
fileIndex: number;
|
|
109
|
+
/**
|
|
110
|
+
* Upload progress value (0-100). When provided, displays a progress bar at the bottom of the file item.
|
|
111
|
+
*/
|
|
112
|
+
uploadProgress?: number;
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
declare const AcceptedFile: {
|
|
116
|
+
({ asChild: _asChild, className, file, fileIndex, uploadProgress, ...props }: FileUploadAcceptedFileProps): react_jsx_runtime.JSX.Element;
|
|
117
|
+
displayName: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
interface FileUploadContextProps {
|
|
121
|
+
/**
|
|
122
|
+
* Render prop that receives acceptedFiles, rejectedFiles, formatFileSize, and locale
|
|
123
|
+
*/
|
|
124
|
+
children: (props: {
|
|
125
|
+
acceptedFiles: File[];
|
|
126
|
+
rejectedFiles: RejectedFile$1[];
|
|
127
|
+
formatFileSize: (bytes: number, locale?: string) => string;
|
|
128
|
+
locale?: string;
|
|
129
|
+
}) => ReactNode;
|
|
130
|
+
}
|
|
131
|
+
declare const Context: {
|
|
132
|
+
({ children }: FileUploadContextProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
displayName: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
declare function Dropzone({ children, onFiles, className, unstyled, }: {
|
|
137
|
+
children?: React.ReactNode;
|
|
138
|
+
onFiles?: (files: FileList) => void;
|
|
139
|
+
className?: string;
|
|
140
|
+
unstyled?: boolean;
|
|
141
|
+
}): react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare namespace Dropzone {
|
|
143
|
+
var displayName: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface FileUploadItemProps extends ComponentPropsWithoutRef<'li'> {
|
|
147
|
+
/**
|
|
148
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
149
|
+
*/
|
|
150
|
+
asChild?: boolean;
|
|
151
|
+
ref?: Ref<HTMLLIElement>;
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
className?: string;
|
|
154
|
+
}
|
|
155
|
+
declare const Item: {
|
|
156
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemProps): react_jsx_runtime.JSX.Element;
|
|
157
|
+
displayName: string;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
interface FileUploadItemDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
161
|
+
/**
|
|
162
|
+
* Index of the file to delete
|
|
163
|
+
*/
|
|
164
|
+
fileIndex: number;
|
|
165
|
+
}
|
|
166
|
+
declare const ItemDeleteTrigger: {
|
|
167
|
+
({ className, fileIndex, onClick, ...props }: FileUploadItemDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
displayName: string;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
interface FileUploadItemFileNameProps extends ComponentPropsWithoutRef<'p'> {
|
|
172
|
+
/**
|
|
173
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
174
|
+
*/
|
|
175
|
+
asChild?: boolean;
|
|
176
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
177
|
+
className?: string;
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
}
|
|
180
|
+
declare const ItemFileName: {
|
|
181
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemFileNameProps): react_jsx_runtime.JSX.Element;
|
|
182
|
+
displayName: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
interface FileUploadItemSizeTextProps extends ComponentPropsWithoutRef<'p'> {
|
|
186
|
+
/**
|
|
187
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
188
|
+
*/
|
|
189
|
+
asChild?: boolean;
|
|
190
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
191
|
+
className?: string;
|
|
192
|
+
children?: ReactNode;
|
|
193
|
+
}
|
|
194
|
+
declare const ItemSizeText: {
|
|
195
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemSizeTextProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
displayName: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
interface FileUploadPreviewImageProps extends ComponentPropsWithoutRef<'div'> {
|
|
200
|
+
/**
|
|
201
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
202
|
+
*/
|
|
203
|
+
asChild?: boolean;
|
|
204
|
+
ref?: Ref<HTMLDivElement>;
|
|
205
|
+
className?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The file to preview
|
|
208
|
+
*/
|
|
209
|
+
file: File;
|
|
210
|
+
/**
|
|
211
|
+
* Fallback content when file is not an image or preview fails
|
|
212
|
+
*/
|
|
213
|
+
fallback?: React.ReactNode;
|
|
214
|
+
}
|
|
215
|
+
declare const PreviewImage: {
|
|
216
|
+
({ asChild: _asChild, className, file, fallback, ...props }: FileUploadPreviewImageProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
displayName: string;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
interface FileUploadRejectedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
221
|
+
/**
|
|
222
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
223
|
+
*/
|
|
224
|
+
asChild?: boolean;
|
|
225
|
+
ref?: Ref<HTMLLIElement>;
|
|
226
|
+
/**
|
|
227
|
+
* The rejected file to display
|
|
228
|
+
*/
|
|
229
|
+
rejectedFile: RejectedFile$1;
|
|
230
|
+
/**
|
|
231
|
+
* The index of the rejected file in the rejectedFiles array
|
|
232
|
+
*/
|
|
233
|
+
rejectedFileIndex: number;
|
|
234
|
+
/**
|
|
235
|
+
* Function to render the error message for each error code
|
|
236
|
+
* @param error - The error code
|
|
237
|
+
* @returns The error message to display
|
|
238
|
+
*/
|
|
239
|
+
renderError: (error: FileUploadFileError) => string;
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare const RejectedFile: {
|
|
243
|
+
({ asChild: _asChild, className, rejectedFile, rejectedFileIndex, renderError, ...props }: FileUploadRejectedFileProps): react_jsx_runtime.JSX.Element;
|
|
244
|
+
displayName: string;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
interface FileUploadRejectedFileDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
248
|
+
/**
|
|
249
|
+
* Index of the rejected file to remove
|
|
250
|
+
*/
|
|
251
|
+
rejectedFileIndex: number;
|
|
252
|
+
}
|
|
253
|
+
declare const RejectedFileDeleteTrigger: {
|
|
254
|
+
({ className, rejectedFileIndex, onClick, ...props }: FileUploadRejectedFileDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
255
|
+
displayName: string;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
interface FileUploadTriggerProps extends Omit<ButtonProps, 'children' | 'disabled'> {
|
|
259
|
+
ref?: Ref<HTMLButtonElement>;
|
|
260
|
+
className?: string;
|
|
261
|
+
children: ReactNode;
|
|
262
|
+
unstyled?: boolean;
|
|
263
|
+
}
|
|
264
|
+
declare const Trigger: {
|
|
265
|
+
({ className, children, asChild, unstyled, design, intent, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
266
|
+
displayName: string;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare const FileUpload: typeof FileUpload$1 & {
|
|
270
|
+
Trigger: typeof Trigger;
|
|
271
|
+
Dropzone: typeof Dropzone;
|
|
272
|
+
Context: typeof Context;
|
|
273
|
+
Item: typeof Item;
|
|
274
|
+
ItemFileName: typeof ItemFileName;
|
|
275
|
+
ItemSizeText: typeof ItemSizeText;
|
|
276
|
+
ItemDeleteTrigger: typeof ItemDeleteTrigger;
|
|
277
|
+
PreviewImage: typeof PreviewImage;
|
|
278
|
+
AcceptedFile: typeof AcceptedFile;
|
|
279
|
+
RejectedFile: typeof RejectedFile;
|
|
280
|
+
RejectedFileDeleteTrigger: typeof RejectedFileDeleteTrigger;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export { FileUpload, type FileUploadFileError, type RejectedFile$1 as RejectedFile };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Ref, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { IconButton } from '../icon-button/index.js';
|
|
4
|
+
import { ButtonProps } from '../button/index.js';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
interface FileUploadProps {
|
|
9
|
+
/**
|
|
10
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
11
|
+
*/
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Initial files to display when the component mounts (uncontrolled mode)
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: File[];
|
|
20
|
+
/**
|
|
21
|
+
* Controlled files value (controlled mode)
|
|
22
|
+
* When provided, the component becomes controlled
|
|
23
|
+
*/
|
|
24
|
+
value?: File[];
|
|
25
|
+
/**
|
|
26
|
+
* Callback when files are selected
|
|
27
|
+
*/
|
|
28
|
+
onFilesChange?: (files: File[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether multiple files can be selected
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Comma-separated list of accepted file types
|
|
36
|
+
* Supports MIME types (e.g., "image/*", "image/png", "application/pdf")
|
|
37
|
+
* and file extensions (e.g., ".pdf", ".doc", ".jpg")
|
|
38
|
+
* @example "image/*"
|
|
39
|
+
* @example ".pdf,.doc"
|
|
40
|
+
* @example "image/png,image/jpeg,.pdf"
|
|
41
|
+
*/
|
|
42
|
+
accept?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum number of files that can be uploaded
|
|
45
|
+
* Files beyond this limit will be rejected
|
|
46
|
+
*/
|
|
47
|
+
maxFiles?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Callback when the maximum number of files is reached
|
|
50
|
+
* @param maxFiles - The maximum number of files allowed
|
|
51
|
+
* @param rejectedCount - The number of files that were rejected
|
|
52
|
+
*/
|
|
53
|
+
onMaxFilesReached?: (maxFiles: number, rejectedCount: number) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum file size in bytes
|
|
56
|
+
* Files larger than this will be rejected
|
|
57
|
+
*/
|
|
58
|
+
maxFileSize?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Minimum file size in bytes
|
|
61
|
+
* Files smaller than this will be rejected
|
|
62
|
+
*/
|
|
63
|
+
minFileSize?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Callback when a file size validation error occurs
|
|
66
|
+
* @param file - The file that failed validation
|
|
67
|
+
* @param error - The error message
|
|
68
|
+
*/
|
|
69
|
+
onFileSizeError?: (file: File, error: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* When `true`, prevents the user from interacting with the file upload
|
|
72
|
+
*/
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, sets the file upload to read-only mode
|
|
76
|
+
*/
|
|
77
|
+
readOnly?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
|
|
80
|
+
* Used for formatting file sizes and error messages.
|
|
81
|
+
* @default Browser locale or 'en' if not available
|
|
82
|
+
*/
|
|
83
|
+
locale?: string;
|
|
84
|
+
}
|
|
85
|
+
type FileUploadFileError = 'TOO_MANY_FILES' | 'FILE_INVALID_TYPE' | 'FILE_TOO_LARGE' | 'FILE_TOO_SMALL' | 'FILE_INVALID' | 'FILE_EXISTS';
|
|
86
|
+
interface RejectedFile$1 {
|
|
87
|
+
file: File;
|
|
88
|
+
errors: FileUploadFileError[];
|
|
89
|
+
}
|
|
90
|
+
declare const FileUpload$1: {
|
|
91
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFilesChange, multiple, accept, maxFiles, onMaxFilesReached, maxFileSize, minFileSize, onFileSizeError, disabled, readOnly, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
displayName: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
interface FileUploadAcceptedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
96
|
+
/**
|
|
97
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
98
|
+
*/
|
|
99
|
+
asChild?: boolean;
|
|
100
|
+
ref?: Ref<HTMLLIElement>;
|
|
101
|
+
/**
|
|
102
|
+
* The file to display
|
|
103
|
+
*/
|
|
104
|
+
file: File;
|
|
105
|
+
/**
|
|
106
|
+
* The index of the file in the accepted files array
|
|
107
|
+
*/
|
|
108
|
+
fileIndex: number;
|
|
109
|
+
/**
|
|
110
|
+
* Upload progress value (0-100). When provided, displays a progress bar at the bottom of the file item.
|
|
111
|
+
*/
|
|
112
|
+
uploadProgress?: number;
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
declare const AcceptedFile: {
|
|
116
|
+
({ asChild: _asChild, className, file, fileIndex, uploadProgress, ...props }: FileUploadAcceptedFileProps): react_jsx_runtime.JSX.Element;
|
|
117
|
+
displayName: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
interface FileUploadContextProps {
|
|
121
|
+
/**
|
|
122
|
+
* Render prop that receives acceptedFiles, rejectedFiles, formatFileSize, and locale
|
|
123
|
+
*/
|
|
124
|
+
children: (props: {
|
|
125
|
+
acceptedFiles: File[];
|
|
126
|
+
rejectedFiles: RejectedFile$1[];
|
|
127
|
+
formatFileSize: (bytes: number, locale?: string) => string;
|
|
128
|
+
locale?: string;
|
|
129
|
+
}) => ReactNode;
|
|
130
|
+
}
|
|
131
|
+
declare const Context: {
|
|
132
|
+
({ children }: FileUploadContextProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
displayName: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
declare function Dropzone({ children, onFiles, className, unstyled, }: {
|
|
137
|
+
children?: React.ReactNode;
|
|
138
|
+
onFiles?: (files: FileList) => void;
|
|
139
|
+
className?: string;
|
|
140
|
+
unstyled?: boolean;
|
|
141
|
+
}): react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare namespace Dropzone {
|
|
143
|
+
var displayName: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface FileUploadItemProps extends ComponentPropsWithoutRef<'li'> {
|
|
147
|
+
/**
|
|
148
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
149
|
+
*/
|
|
150
|
+
asChild?: boolean;
|
|
151
|
+
ref?: Ref<HTMLLIElement>;
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
className?: string;
|
|
154
|
+
}
|
|
155
|
+
declare const Item: {
|
|
156
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemProps): react_jsx_runtime.JSX.Element;
|
|
157
|
+
displayName: string;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
interface FileUploadItemDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
161
|
+
/**
|
|
162
|
+
* Index of the file to delete
|
|
163
|
+
*/
|
|
164
|
+
fileIndex: number;
|
|
165
|
+
}
|
|
166
|
+
declare const ItemDeleteTrigger: {
|
|
167
|
+
({ className, fileIndex, onClick, ...props }: FileUploadItemDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
displayName: string;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
interface FileUploadItemFileNameProps extends ComponentPropsWithoutRef<'p'> {
|
|
172
|
+
/**
|
|
173
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
174
|
+
*/
|
|
175
|
+
asChild?: boolean;
|
|
176
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
177
|
+
className?: string;
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
}
|
|
180
|
+
declare const ItemFileName: {
|
|
181
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemFileNameProps): react_jsx_runtime.JSX.Element;
|
|
182
|
+
displayName: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
interface FileUploadItemSizeTextProps extends ComponentPropsWithoutRef<'p'> {
|
|
186
|
+
/**
|
|
187
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
188
|
+
*/
|
|
189
|
+
asChild?: boolean;
|
|
190
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
191
|
+
className?: string;
|
|
192
|
+
children?: ReactNode;
|
|
193
|
+
}
|
|
194
|
+
declare const ItemSizeText: {
|
|
195
|
+
({ asChild: _asChild, className, children, ...props }: FileUploadItemSizeTextProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
displayName: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
interface FileUploadPreviewImageProps extends ComponentPropsWithoutRef<'div'> {
|
|
200
|
+
/**
|
|
201
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
202
|
+
*/
|
|
203
|
+
asChild?: boolean;
|
|
204
|
+
ref?: Ref<HTMLDivElement>;
|
|
205
|
+
className?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The file to preview
|
|
208
|
+
*/
|
|
209
|
+
file: File;
|
|
210
|
+
/**
|
|
211
|
+
* Fallback content when file is not an image or preview fails
|
|
212
|
+
*/
|
|
213
|
+
fallback?: React.ReactNode;
|
|
214
|
+
}
|
|
215
|
+
declare const PreviewImage: {
|
|
216
|
+
({ asChild: _asChild, className, file, fallback, ...props }: FileUploadPreviewImageProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
displayName: string;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
interface FileUploadRejectedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
221
|
+
/**
|
|
222
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
223
|
+
*/
|
|
224
|
+
asChild?: boolean;
|
|
225
|
+
ref?: Ref<HTMLLIElement>;
|
|
226
|
+
/**
|
|
227
|
+
* The rejected file to display
|
|
228
|
+
*/
|
|
229
|
+
rejectedFile: RejectedFile$1;
|
|
230
|
+
/**
|
|
231
|
+
* The index of the rejected file in the rejectedFiles array
|
|
232
|
+
*/
|
|
233
|
+
rejectedFileIndex: number;
|
|
234
|
+
/**
|
|
235
|
+
* Function to render the error message for each error code
|
|
236
|
+
* @param error - The error code
|
|
237
|
+
* @returns The error message to display
|
|
238
|
+
*/
|
|
239
|
+
renderError: (error: FileUploadFileError) => string;
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare const RejectedFile: {
|
|
243
|
+
({ asChild: _asChild, className, rejectedFile, rejectedFileIndex, renderError, ...props }: FileUploadRejectedFileProps): react_jsx_runtime.JSX.Element;
|
|
244
|
+
displayName: string;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
interface FileUploadRejectedFileDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
248
|
+
/**
|
|
249
|
+
* Index of the rejected file to remove
|
|
250
|
+
*/
|
|
251
|
+
rejectedFileIndex: number;
|
|
252
|
+
}
|
|
253
|
+
declare const RejectedFileDeleteTrigger: {
|
|
254
|
+
({ className, rejectedFileIndex, onClick, ...props }: FileUploadRejectedFileDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
255
|
+
displayName: string;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
interface FileUploadTriggerProps extends Omit<ButtonProps, 'children' | 'disabled'> {
|
|
259
|
+
ref?: Ref<HTMLButtonElement>;
|
|
260
|
+
className?: string;
|
|
261
|
+
children: ReactNode;
|
|
262
|
+
unstyled?: boolean;
|
|
263
|
+
}
|
|
264
|
+
declare const Trigger: {
|
|
265
|
+
({ className, children, asChild, unstyled, design, intent, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
266
|
+
displayName: string;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare const FileUpload: typeof FileUpload$1 & {
|
|
270
|
+
Trigger: typeof Trigger;
|
|
271
|
+
Dropzone: typeof Dropzone;
|
|
272
|
+
Context: typeof Context;
|
|
273
|
+
Item: typeof Item;
|
|
274
|
+
ItemFileName: typeof ItemFileName;
|
|
275
|
+
ItemSizeText: typeof ItemSizeText;
|
|
276
|
+
ItemDeleteTrigger: typeof ItemDeleteTrigger;
|
|
277
|
+
PreviewImage: typeof PreviewImage;
|
|
278
|
+
AcceptedFile: typeof AcceptedFile;
|
|
279
|
+
RejectedFile: typeof RejectedFile;
|
|
280
|
+
RejectedFileDeleteTrigger: typeof RejectedFileDeleteTrigger;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export { FileUpload, type FileUploadFileError, type RejectedFile$1 as RejectedFile };
|