@spark-ui/components 11.4.2 → 11.4.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.
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs.map +1 -1
- package/dist/docgen.json +42 -296
- package/dist/file-upload/index.d.mts +35 -79
- package/dist/file-upload/index.d.ts +35 -79
- package/dist/file-upload/index.js +149 -179
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +129 -159
- package/dist/file-upload/index.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -23,9 +23,21 @@ interface FileUploadProps {
|
|
|
23
23
|
*/
|
|
24
24
|
value?: File[];
|
|
25
25
|
/**
|
|
26
|
-
* Callback when files are
|
|
26
|
+
* Callback when files are accepted
|
|
27
|
+
* @param details - Details about the accepted files
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
onFileAccept?: (details: FileAcceptDetails) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback when files are rejected
|
|
32
|
+
* @param details - Details about the rejected files and their errors
|
|
33
|
+
*/
|
|
34
|
+
onFileReject?: (details: FileRejectDetails) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback when files change (both accepted and rejected)
|
|
37
|
+
* For controlled mode, use this to update the value prop by extracting details.acceptedFiles
|
|
38
|
+
* @param details - Details about both accepted and rejected files
|
|
39
|
+
*/
|
|
40
|
+
onFileChange?: (details: FileChangeDetails) => void;
|
|
29
41
|
/**
|
|
30
42
|
* Whether multiple files can be selected
|
|
31
43
|
* @default true
|
|
@@ -45,12 +57,6 @@ interface FileUploadProps {
|
|
|
45
57
|
* Files beyond this limit will be rejected
|
|
46
58
|
*/
|
|
47
59
|
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
60
|
/**
|
|
55
61
|
* Maximum file size in bytes
|
|
56
62
|
* Files larger than this will be rejected
|
|
@@ -61,12 +67,6 @@ interface FileUploadProps {
|
|
|
61
67
|
* Files smaller than this will be rejected
|
|
62
68
|
*/
|
|
63
69
|
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
70
|
/**
|
|
71
71
|
* When `true`, prevents the user from interacting with the file upload
|
|
72
72
|
*/
|
|
@@ -87,8 +87,18 @@ interface RejectedFile$1 {
|
|
|
87
87
|
file: File;
|
|
88
88
|
errors: FileUploadFileError[];
|
|
89
89
|
}
|
|
90
|
+
interface FileAcceptDetails {
|
|
91
|
+
files: File[];
|
|
92
|
+
}
|
|
93
|
+
interface FileRejectDetails {
|
|
94
|
+
files: RejectedFile$1[];
|
|
95
|
+
}
|
|
96
|
+
interface FileChangeDetails {
|
|
97
|
+
acceptedFiles: File[];
|
|
98
|
+
rejectedFiles: RejectedFile$1[];
|
|
99
|
+
}
|
|
90
100
|
declare const FileUpload$1: {
|
|
91
|
-
({ asChild: _asChild, children, defaultValue, value: controlledValue,
|
|
101
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled, readOnly, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
92
102
|
displayName: string;
|
|
93
103
|
};
|
|
94
104
|
|
|
@@ -102,10 +112,6 @@ interface FileUploadAcceptedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
|
102
112
|
* The file to display
|
|
103
113
|
*/
|
|
104
114
|
file: File;
|
|
105
|
-
/**
|
|
106
|
-
* The index of the file in the accepted files array
|
|
107
|
-
*/
|
|
108
|
-
fileIndex: number;
|
|
109
115
|
/**
|
|
110
116
|
* Upload progress value (0-100). When provided, displays a progress bar at the bottom of the file item.
|
|
111
117
|
*/
|
|
@@ -121,7 +127,7 @@ interface FileUploadAcceptedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
|
121
127
|
className?: string;
|
|
122
128
|
}
|
|
123
129
|
declare const AcceptedFile: {
|
|
124
|
-
({ asChild: _asChild, className, file,
|
|
130
|
+
({ asChild: _asChild, className, file, uploadProgress, deleteButtonAriaLabel, progressAriaLabel, ...props }: FileUploadAcceptedFileProps): react_jsx_runtime.JSX.Element;
|
|
125
131
|
displayName: string;
|
|
126
132
|
};
|
|
127
133
|
|
|
@@ -141,9 +147,8 @@ declare const Context: {
|
|
|
141
147
|
displayName: string;
|
|
142
148
|
};
|
|
143
149
|
|
|
144
|
-
declare function Dropzone({ children,
|
|
150
|
+
declare function Dropzone({ children, className, unstyled, }: {
|
|
145
151
|
children?: React.ReactNode;
|
|
146
|
-
onFiles?: (files: FileList) => void;
|
|
147
152
|
className?: string;
|
|
148
153
|
unstyled?: boolean;
|
|
149
154
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -151,56 +156,14 @@ declare namespace Dropzone {
|
|
|
151
156
|
var displayName: string;
|
|
152
157
|
}
|
|
153
158
|
|
|
154
|
-
interface FileUploadItemProps extends ComponentPropsWithoutRef<'li'> {
|
|
155
|
-
/**
|
|
156
|
-
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
157
|
-
*/
|
|
158
|
-
asChild?: boolean;
|
|
159
|
-
ref?: Ref<HTMLLIElement>;
|
|
160
|
-
children: ReactNode;
|
|
161
|
-
className?: string;
|
|
162
|
-
}
|
|
163
|
-
declare const Item: {
|
|
164
|
-
({ asChild: _asChild, className, children, ...props }: FileUploadItemProps): react_jsx_runtime.JSX.Element;
|
|
165
|
-
displayName: string;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
159
|
interface FileUploadItemDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
169
160
|
/**
|
|
170
|
-
*
|
|
161
|
+
* The file to delete
|
|
171
162
|
*/
|
|
172
|
-
|
|
163
|
+
file: File;
|
|
173
164
|
}
|
|
174
165
|
declare const ItemDeleteTrigger: {
|
|
175
|
-
({ className,
|
|
176
|
-
displayName: string;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
interface FileUploadItemFileNameProps extends ComponentPropsWithoutRef<'p'> {
|
|
180
|
-
/**
|
|
181
|
-
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
182
|
-
*/
|
|
183
|
-
asChild?: boolean;
|
|
184
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
185
|
-
className?: string;
|
|
186
|
-
children?: ReactNode;
|
|
187
|
-
}
|
|
188
|
-
declare const ItemFileName: {
|
|
189
|
-
({ asChild: _asChild, className, children, ...props }: FileUploadItemFileNameProps): react_jsx_runtime.JSX.Element;
|
|
190
|
-
displayName: string;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
interface FileUploadItemSizeTextProps extends ComponentPropsWithoutRef<'p'> {
|
|
194
|
-
/**
|
|
195
|
-
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
196
|
-
*/
|
|
197
|
-
asChild?: boolean;
|
|
198
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
199
|
-
className?: string;
|
|
200
|
-
children?: ReactNode;
|
|
201
|
-
}
|
|
202
|
-
declare const ItemSizeText: {
|
|
203
|
-
({ asChild: _asChild, className, children, ...props }: FileUploadItemSizeTextProps): react_jsx_runtime.JSX.Element;
|
|
166
|
+
({ className, file, onClick, ...props }: FileUploadItemDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
204
167
|
displayName: string;
|
|
205
168
|
};
|
|
206
169
|
|
|
@@ -235,10 +198,6 @@ interface FileUploadRejectedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
|
235
198
|
* The rejected file to display
|
|
236
199
|
*/
|
|
237
200
|
rejectedFile: RejectedFile$1;
|
|
238
|
-
/**
|
|
239
|
-
* The index of the rejected file in the rejectedFiles array
|
|
240
|
-
*/
|
|
241
|
-
rejectedFileIndex: number;
|
|
242
201
|
/**
|
|
243
202
|
* Function to render the error message for each error code
|
|
244
203
|
* @param error - The error code
|
|
@@ -252,18 +211,18 @@ interface FileUploadRejectedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
|
252
211
|
className?: string;
|
|
253
212
|
}
|
|
254
213
|
declare const RejectedFile: {
|
|
255
|
-
({ asChild: _asChild, className, rejectedFile,
|
|
214
|
+
({ asChild: _asChild, className, rejectedFile, renderError, deleteButtonAriaLabel, ...props }: FileUploadRejectedFileProps): react_jsx_runtime.JSX.Element;
|
|
256
215
|
displayName: string;
|
|
257
216
|
};
|
|
258
217
|
|
|
259
218
|
interface FileUploadRejectedFileDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
260
219
|
/**
|
|
261
|
-
*
|
|
220
|
+
* The rejected file to remove
|
|
262
221
|
*/
|
|
263
|
-
|
|
222
|
+
rejectedFile: RejectedFile$1;
|
|
264
223
|
}
|
|
265
224
|
declare const RejectedFileDeleteTrigger: {
|
|
266
|
-
({ className,
|
|
225
|
+
({ className, rejectedFile, onClick, ...props }: FileUploadRejectedFileDeleteTriggerProps): react_jsx_runtime.JSX.Element;
|
|
267
226
|
displayName: string;
|
|
268
227
|
};
|
|
269
228
|
|
|
@@ -282,9 +241,6 @@ declare const FileUpload: typeof FileUpload$1 & {
|
|
|
282
241
|
Trigger: typeof Trigger;
|
|
283
242
|
Dropzone: typeof Dropzone;
|
|
284
243
|
Context: typeof Context;
|
|
285
|
-
Item: typeof Item;
|
|
286
|
-
ItemFileName: typeof ItemFileName;
|
|
287
|
-
ItemSizeText: typeof ItemSizeText;
|
|
288
244
|
ItemDeleteTrigger: typeof ItemDeleteTrigger;
|
|
289
245
|
PreviewImage: typeof PreviewImage;
|
|
290
246
|
AcceptedFile: typeof AcceptedFile;
|
|
@@ -292,4 +248,4 @@ declare const FileUpload: typeof FileUpload$1 & {
|
|
|
292
248
|
RejectedFileDeleteTrigger: typeof RejectedFileDeleteTrigger;
|
|
293
249
|
};
|
|
294
250
|
|
|
295
|
-
export { FileUpload, type FileUploadFileError, type RejectedFile$1 as RejectedFile };
|
|
251
|
+
export { type FileAcceptDetails, type FileChangeDetails, type FileRejectDetails, FileUpload, type FileUploadFileError, type RejectedFile$1 as RejectedFile };
|