@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.
@@ -127,14 +127,14 @@ var FileUpload = ({
127
127
  children,
128
128
  defaultValue = [],
129
129
  value: controlledValue,
130
- onFilesChange,
130
+ onFileAccept,
131
+ onFileReject,
132
+ onFileChange,
131
133
  multiple = true,
132
134
  accept,
133
135
  maxFiles,
134
- onMaxFilesReached,
135
136
  maxFileSize,
136
137
  minFileSize,
137
- onFileSizeError,
138
138
  disabled = false,
139
139
  readOnly = false,
140
140
  locale
@@ -144,11 +144,7 @@ var FileUpload = ({
144
144
  const triggerRef = useRef(null);
145
145
  const dropzoneRef = useRef(null);
146
146
  const deleteButtonRefs = useRef([]);
147
- const [filesState, setFilesState, ,] = useCombinedState(
148
- controlledValue,
149
- defaultValue,
150
- onFilesChange
151
- );
147
+ const [filesState, setFilesState, ,] = useCombinedState(controlledValue, defaultValue);
152
148
  const files = filesState ?? [];
153
149
  const setFiles = setFilesState;
154
150
  const [rejectedFiles, setRejectedFiles] = useState([]);
@@ -177,9 +173,6 @@ var FileUpload = ({
177
173
  errors: [error]
178
174
  });
179
175
  }
180
- if (onFileSizeError) {
181
- onFileSizeError(file, error);
182
- }
183
176
  };
184
177
  setFiles((prev) => {
185
178
  const currentFiles = prev ?? [];
@@ -243,19 +236,29 @@ var FileUpload = ({
243
236
  filesToAdd.forEach((file) => {
244
237
  addRejectedFile(file, "TOO_MANY_FILES");
245
238
  });
246
- onMaxFilesReached?.(maxFiles, filesToAdd.length);
247
239
  filesToAdd = [];
248
240
  } else if (filesToAdd.length > remainingSlots) {
249
241
  filesToAdd.forEach((file) => {
250
242
  addRejectedFile(file, "TOO_MANY_FILES");
251
243
  });
252
- onMaxFilesReached?.(maxFiles, filesToAdd.length);
253
244
  filesToAdd = [];
254
245
  }
255
246
  }
256
247
  const updated = multiple ? [...currentFiles, ...filesToAdd] : filesToAdd;
257
248
  const rejectedFilesToAdd = [...newRejectedFiles];
258
249
  setRejectedFiles(rejectedFilesToAdd);
250
+ if (filesToAdd.length > 0 && onFileAccept) {
251
+ onFileAccept({ files: filesToAdd });
252
+ }
253
+ if (rejectedFilesToAdd.length > 0 && onFileReject) {
254
+ onFileReject({ files: rejectedFilesToAdd });
255
+ }
256
+ if (onFileChange) {
257
+ onFileChange({
258
+ acceptedFiles: updated,
259
+ rejectedFiles: rejectedFilesToAdd
260
+ });
261
+ }
259
262
  return updated;
260
263
  });
261
264
  };
@@ -266,10 +269,18 @@ var FileUpload = ({
266
269
  setFiles((prev) => {
267
270
  const currentFiles = prev ?? [];
268
271
  const updated = currentFiles.filter((_, i) => i !== index);
272
+ let updatedRejectedFiles = rejectedFiles;
269
273
  if (maxFiles !== void 0 && updated.length < maxFiles) {
270
- setRejectedFiles(
271
- (prevRejected) => prevRejected.filter((rejected) => !rejected.errors.includes("TOO_MANY_FILES"))
274
+ updatedRejectedFiles = rejectedFiles.filter(
275
+ (rejected) => !rejected.errors.includes("TOO_MANY_FILES")
272
276
  );
277
+ setRejectedFiles(updatedRejectedFiles);
278
+ }
279
+ if (onFileChange) {
280
+ onFileChange({
281
+ acceptedFiles: updated,
282
+ rejectedFiles: updatedRejectedFiles
283
+ });
273
284
  }
274
285
  return updated;
275
286
  });
@@ -281,6 +292,12 @@ var FileUpload = ({
281
292
  setFiles([]);
282
293
  setRejectedFiles([]);
283
294
  deleteButtonRefs.current = [];
295
+ if (onFileChange) {
296
+ onFileChange({
297
+ acceptedFiles: [],
298
+ rejectedFiles: []
299
+ });
300
+ }
284
301
  };
285
302
  const removeRejectedFile = (index) => {
286
303
  if (disabled || readOnly) {
@@ -353,45 +370,23 @@ var useFileUploadContext = () => {
353
370
  return context;
354
371
  };
355
372
 
356
- // src/file-upload/FileUploadItem.tsx
357
- import { cx } from "class-variance-authority";
358
- import { jsx as jsx2 } from "react/jsx-runtime";
359
- var Item = ({
360
- asChild: _asChild = false,
361
- className,
362
- children,
363
- ...props
364
- }) => {
365
- return /* @__PURE__ */ jsx2(
366
- "li",
367
- {
368
- "data-spark-component": "file-upload-item",
369
- className: cx(
370
- "relative",
371
- "default:bg-surface default:border-sm default:border-outline default:p-md default:rounded-md",
372
- "gap-md flex items-center justify-between default:w-full",
373
- className
374
- ),
375
- ...props,
376
- children
377
- }
378
- );
379
- };
380
- Item.displayName = "FileUpload.Item";
373
+ // src/file-upload/FileUploadAcceptedFile.tsx
374
+ import { cx as cx2 } from "class-variance-authority";
381
375
 
382
376
  // src/file-upload/FileUploadItemDeleteTrigger.tsx
383
377
  import { Close } from "@spark-ui/icons/Close";
384
- import { cx as cx2 } from "class-variance-authority";
378
+ import { cx } from "class-variance-authority";
385
379
  import { useRef as useRef2 } from "react";
386
- import { jsx as jsx3 } from "react/jsx-runtime";
380
+ import { jsx as jsx2 } from "react/jsx-runtime";
387
381
  var ItemDeleteTrigger = ({
388
382
  className,
389
- fileIndex,
383
+ file,
390
384
  onClick,
391
385
  ...props
392
386
  }) => {
393
- const { removeFile, triggerRef, dropzoneRef, deleteButtonRefs, disabled, readOnly } = useFileUploadContext();
387
+ const { removeFile, triggerRef, dropzoneRef, deleteButtonRefs, disabled, readOnly, files } = useFileUploadContext();
394
388
  const buttonRef = useRef2(null);
389
+ const fileIndex = files.findIndex((f) => f.name === file.name && f.size === file.size);
395
390
  const handleClick = (e) => {
396
391
  if (disabled || readOnly) {
397
392
  return;
@@ -427,98 +422,68 @@ var ItemDeleteTrigger = ({
427
422
  }
428
423
  }
429
424
  };
430
- return /* @__PURE__ */ jsx3(
425
+ return /* @__PURE__ */ jsx2(
431
426
  IconButton,
432
427
  {
433
428
  ref: setRef,
434
429
  "data-spark-component": "file-upload-item-delete-trigger",
435
- className: cx2(className),
430
+ className: cx(className),
436
431
  onClick: handleClick,
437
432
  disabled: disabled || readOnly,
438
433
  size: "sm",
439
434
  design: "contrast",
440
435
  intent: "surface",
441
436
  ...props,
442
- children: /* @__PURE__ */ jsx3(Icon, { size: "sm", children: /* @__PURE__ */ jsx3(Close, {}) })
437
+ children: /* @__PURE__ */ jsx2(Icon, { size: "sm", children: /* @__PURE__ */ jsx2(Close, {}) })
443
438
  }
444
439
  );
445
440
  };
446
441
  ItemDeleteTrigger.displayName = "FileUpload.ItemDeleteTrigger";
447
442
 
448
- // src/file-upload/FileUploadItemFileName.tsx
449
- import { cx as cx3 } from "class-variance-authority";
450
- import { jsx as jsx4 } from "react/jsx-runtime";
451
- var ItemFileName = ({
452
- asChild: _asChild = false,
453
- className,
454
- children,
455
- ...props
456
- }) => {
457
- return /* @__PURE__ */ jsx4(
458
- "p",
459
- {
460
- "data-spark-component": "file-upload-item-file-name",
461
- className: cx3("text-body-2 truncate font-medium", className),
462
- ...props,
463
- children
464
- }
465
- );
466
- };
467
- ItemFileName.displayName = "FileUpload.ItemFileName";
468
-
469
- // src/file-upload/FileUploadItemSizeText.tsx
470
- import { cx as cx4 } from "class-variance-authority";
471
- import { jsx as jsx5 } from "react/jsx-runtime";
472
- var ItemSizeText = ({
473
- asChild: _asChild = false,
474
- className,
475
- children,
476
- ...props
477
- }) => {
478
- return /* @__PURE__ */ jsx5(
479
- "p",
480
- {
481
- "data-spark-component": "file-upload-item-size-text",
482
- className: cx4("text-caption", className),
483
- ...props,
484
- children
485
- }
486
- );
487
- };
488
- ItemSizeText.displayName = "FileUpload.ItemSizeText";
489
-
490
443
  // src/file-upload/FileUploadAcceptedFile.tsx
491
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
444
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
492
445
  var AcceptedFile = ({
493
446
  asChild: _asChild = false,
494
447
  className,
495
448
  file,
496
- fileIndex,
497
449
  uploadProgress,
498
450
  deleteButtonAriaLabel,
499
451
  progressAriaLabel,
500
452
  ...props
501
453
  }) => {
502
454
  const { locale } = useFileUploadContext();
503
- return /* @__PURE__ */ jsxs2(Item, { className, ...props, children: [
504
- /* @__PURE__ */ jsx6("div", { className: "size-sz-40 bg-support-container flex items-center justify-center rounded-md", children: /* @__PURE__ */ jsx6(Icon, { size: "md", children: getFileIcon(file) }) }),
505
- /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
506
- /* @__PURE__ */ jsxs2("div", { className: "gap-md flex flex-row items-center justify-between", children: [
507
- /* @__PURE__ */ jsx6(ItemFileName, { children: file.name }),
508
- /* @__PURE__ */ jsx6(ItemSizeText, { className: "opacity-dim-1", children: formatFileSize(file.size, locale) })
509
- ] }),
510
- uploadProgress !== void 0 && /* @__PURE__ */ jsx6("div", { className: "mt-md", children: /* @__PURE__ */ jsx6(Progress, { value: uploadProgress, max: 100, "aria-label": progressAriaLabel }) })
511
- ] }),
512
- /* @__PURE__ */ jsx6(ItemDeleteTrigger, { "aria-label": deleteButtonAriaLabel, fileIndex })
513
- ] });
455
+ return /* @__PURE__ */ jsxs2(
456
+ "li",
457
+ {
458
+ "data-spark-component": "file-upload-accepted-file",
459
+ className: cx2(
460
+ "relative",
461
+ "default:bg-surface default:border-sm default:border-outline default:p-md default:rounded-md",
462
+ "gap-md flex items-center justify-between default:w-full",
463
+ className
464
+ ),
465
+ ...props,
466
+ children: [
467
+ /* @__PURE__ */ jsx3("div", { className: "size-sz-40 bg-support-container flex items-center justify-center rounded-md", children: /* @__PURE__ */ jsx3(Icon, { size: "md", children: getFileIcon(file) }) }),
468
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
469
+ /* @__PURE__ */ jsxs2("div", { className: "gap-md flex flex-row items-center justify-between", children: [
470
+ /* @__PURE__ */ jsx3("p", { className: "text-body-2 truncate font-medium", children: file.name }),
471
+ /* @__PURE__ */ jsx3("p", { className: "text-caption opacity-dim-1", children: formatFileSize(file.size, locale) })
472
+ ] }),
473
+ uploadProgress !== void 0 && /* @__PURE__ */ jsx3("div", { className: "mt-md", children: /* @__PURE__ */ jsx3(Progress, { value: uploadProgress, max: 100, "aria-label": progressAriaLabel }) })
474
+ ] }),
475
+ /* @__PURE__ */ jsx3(ItemDeleteTrigger, { "aria-label": deleteButtonAriaLabel, file })
476
+ ]
477
+ }
478
+ );
514
479
  };
515
480
  AcceptedFile.displayName = "FileUpload.AcceptedFile";
516
481
 
517
482
  // src/file-upload/FileUploadContext.tsx
518
- import { Fragment, jsx as jsx7 } from "react/jsx-runtime";
483
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
519
484
  var Context = ({ children }) => {
520
485
  const { files = [], rejectedFiles = [], locale } = useFileUploadContext();
521
- return /* @__PURE__ */ jsx7(Fragment, { children: children({
486
+ return /* @__PURE__ */ jsx4(Fragment, { children: children({
522
487
  acceptedFiles: files,
523
488
  rejectedFiles,
524
489
  formatFileSize,
@@ -528,12 +493,11 @@ var Context = ({ children }) => {
528
493
  Context.displayName = "FileUpload.Context";
529
494
 
530
495
  // src/file-upload/FileUploadDropzone.tsx
531
- import { cx as cx5 } from "class-variance-authority";
496
+ import { cx as cx3 } from "class-variance-authority";
532
497
  import { useRef as useRef3 } from "react";
533
- import { jsx as jsx8 } from "react/jsx-runtime";
498
+ import { jsx as jsx5 } from "react/jsx-runtime";
534
499
  function Dropzone({
535
500
  children,
536
- onFiles,
537
501
  className,
538
502
  unstyled = false
539
503
  }) {
@@ -548,7 +512,6 @@ function Dropzone({
548
512
  return;
549
513
  }
550
514
  const files = e.dataTransfer.files;
551
- onFiles?.(files);
552
515
  let filesArray = [];
553
516
  if (files) {
554
517
  filesArray = Array.isArray(files) ? [...files] : Array.from(files);
@@ -571,7 +534,7 @@ function Dropzone({
571
534
  }
572
535
  };
573
536
  const isDisabled = ctx.disabled || ctx.readOnly;
574
- return /* @__PURE__ */ jsx8(
537
+ return /* @__PURE__ */ jsx5(
575
538
  "div",
576
539
  {
577
540
  ref: (node) => {
@@ -589,12 +552,12 @@ function Dropzone({
589
552
  onDragOver: (e) => {
590
553
  e.preventDefault();
591
554
  },
592
- className: unstyled ? className : cx5(
593
- "default:bg-surface default:border-sm default:border-outline default:rounded-lg default:border-dashed",
555
+ className: unstyled ? className : cx3(
556
+ "default:bg-surface default:border-sm default:border-outline default:relative default:rounded-lg default:border-dashed",
594
557
  "gap-lg flex flex-col items-center justify-center text-center",
595
558
  "default:p-xl",
596
559
  "transition-colors duration-200",
597
- !isDisabled && "hover:bg-surface-hovered",
560
+ !isDisabled && "default:hover:bg-surface-hovered",
598
561
  "data-[drag-over=true]:border-outline-high data-[drag-over=true]:bg-surface-hovered data-[drag-over=true]:border-solid",
599
562
  // Disabled: more visually disabled (opacity + cursor)
600
563
  ctx.disabled && "cursor-not-allowed opacity-50",
@@ -617,9 +580,9 @@ function Dropzone({
617
580
  Dropzone.displayName = "FileUploadDropzone";
618
581
 
619
582
  // src/file-upload/FileUploadPreviewImage.tsx
620
- import { cx as cx6 } from "class-variance-authority";
583
+ import { cx as cx4 } from "class-variance-authority";
621
584
  import { useEffect, useState as useState2 } from "react";
622
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
585
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
623
586
  var PreviewImage = ({
624
587
  asChild: _asChild = false,
625
588
  className,
@@ -639,11 +602,11 @@ var PreviewImage = ({
639
602
  };
640
603
  }, [imageUrl]);
641
604
  if (!isImage || imageError) {
642
- return /* @__PURE__ */ jsx9(
605
+ return /* @__PURE__ */ jsx6(
643
606
  "div",
644
607
  {
645
608
  "data-spark-component": "file-upload-preview-image",
646
- className: cx6(
609
+ className: cx4(
647
610
  "bg-neutral-container flex items-center justify-center rounded-md",
648
611
  className
649
612
  ),
@@ -656,20 +619,20 @@ var PreviewImage = ({
656
619
  "div",
657
620
  {
658
621
  "data-spark-component": "file-upload-preview-image",
659
- className: cx6("bg-neutral-container overflow-hidden", className),
622
+ className: cx4("bg-neutral-container overflow-hidden", className),
660
623
  ...props,
661
624
  children: [
662
- /* @__PURE__ */ jsx9(
625
+ /* @__PURE__ */ jsx6(
663
626
  "img",
664
627
  {
665
628
  src: imageUrl,
666
629
  alt: file.name,
667
- className: cx6("size-full object-cover", !imageLoaded && "opacity-0"),
630
+ className: cx4("size-full object-cover", !imageLoaded && "opacity-0"),
668
631
  onLoad: () => setImageLoaded(true),
669
632
  onError: () => setImageError(true)
670
633
  }
671
634
  ),
672
- !imageLoaded && /* @__PURE__ */ jsx9("div", { className: "absolute inset-0 flex items-center justify-center", children: fallback })
635
+ !imageLoaded && /* @__PURE__ */ jsx6("div", { className: "absolute inset-0 flex items-center justify-center", children: fallback })
673
636
  ]
674
637
  }
675
638
  );
@@ -678,21 +641,24 @@ PreviewImage.displayName = "FileUpload.PreviewImage";
678
641
 
679
642
  // src/file-upload/FileUploadRejectedFile.tsx
680
643
  import { WarningOutline } from "@spark-ui/icons/WarningOutline";
681
- import { cx as cx8 } from "class-variance-authority";
644
+ import { cx as cx6 } from "class-variance-authority";
682
645
 
683
646
  // src/file-upload/FileUploadRejectedFileDeleteTrigger.tsx
684
647
  import { Close as Close2 } from "@spark-ui/icons/Close";
685
- import { cx as cx7 } from "class-variance-authority";
648
+ import { cx as cx5 } from "class-variance-authority";
686
649
  import { useRef as useRef4 } from "react";
687
- import { jsx as jsx10 } from "react/jsx-runtime";
650
+ import { jsx as jsx7 } from "react/jsx-runtime";
688
651
  var RejectedFileDeleteTrigger = ({
689
652
  className,
690
- rejectedFileIndex,
653
+ rejectedFile,
691
654
  onClick,
692
655
  ...props
693
656
  }) => {
694
- const { removeRejectedFile, triggerRef, dropzoneRef, disabled, readOnly } = useFileUploadContext();
657
+ const { removeRejectedFile, triggerRef, dropzoneRef, disabled, readOnly, rejectedFiles } = useFileUploadContext();
695
658
  const buttonRef = useRef4(null);
659
+ const rejectedFileIndex = rejectedFiles.findIndex(
660
+ (rf) => rf.file.name === rejectedFile.file.name && rf.file.size === rejectedFile.file.size
661
+ );
696
662
  const handleClick = (e) => {
697
663
  if (disabled || readOnly) {
698
664
  return;
@@ -706,59 +672,66 @@ var RejectedFileDeleteTrigger = ({
706
672
  }, 0);
707
673
  onClick?.(e);
708
674
  };
709
- return /* @__PURE__ */ jsx10(
675
+ return /* @__PURE__ */ jsx7(
710
676
  IconButton,
711
677
  {
712
678
  ref: buttonRef,
713
679
  "data-spark-component": "file-upload-rejected-file-delete-trigger",
714
- className: cx7(className),
680
+ className: cx5(className),
715
681
  onClick: handleClick,
716
682
  disabled: disabled || readOnly,
717
683
  size: "sm",
718
684
  design: "contrast",
719
685
  intent: "surface",
720
686
  ...props,
721
- children: /* @__PURE__ */ jsx10(Icon, { size: "sm", children: /* @__PURE__ */ jsx10(Close2, {}) })
687
+ children: /* @__PURE__ */ jsx7(Icon, { size: "sm", children: /* @__PURE__ */ jsx7(Close2, {}) })
722
688
  }
723
689
  );
724
690
  };
725
691
  RejectedFileDeleteTrigger.displayName = "FileUpload.RejectedFileDeleteTrigger";
726
692
 
727
693
  // src/file-upload/FileUploadRejectedFile.tsx
728
- import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
694
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
729
695
  var RejectedFile = ({
730
696
  asChild: _asChild = false,
731
697
  className,
732
698
  rejectedFile,
733
- rejectedFileIndex,
734
699
  renderError,
735
700
  deleteButtonAriaLabel,
736
701
  ...props
737
702
  }) => {
738
703
  const { locale } = useFileUploadContext();
739
- return /* @__PURE__ */ jsxs4(Item, { className: cx8("border-error border-md", className), ...props, children: [
740
- /* @__PURE__ */ jsx11("div", { className: "size-sz-40 bg-error-container flex items-center justify-center rounded-md", children: /* @__PURE__ */ jsx11(Icon, { size: "md", className: "text-error", children: /* @__PURE__ */ jsx11(WarningOutline, {}) }) }),
741
- /* @__PURE__ */ jsx11("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs4("div", { className: "gap-md flex flex-col", children: [
742
- /* @__PURE__ */ jsxs4("div", { className: "gap-md flex flex-row items-center justify-between", children: [
743
- /* @__PURE__ */ jsx11(ItemFileName, { children: rejectedFile.file.name }),
744
- /* @__PURE__ */ jsx11(ItemSizeText, { className: "opacity-dim-1", children: formatFileSize(rejectedFile.file.size, locale) })
745
- ] }),
746
- /* @__PURE__ */ jsx11("div", { className: "gap-xs flex flex-col", children: rejectedFile.errors.map((error, errorIndex) => /* @__PURE__ */ jsx11("div", { className: "text-caption text-error", "data-error-code": error, children: renderError(error) }, errorIndex)) })
747
- ] }) }),
748
- /* @__PURE__ */ jsx11(
749
- RejectedFileDeleteTrigger,
750
- {
751
- "aria-label": deleteButtonAriaLabel,
752
- rejectedFileIndex
753
- }
754
- )
755
- ] });
704
+ return /* @__PURE__ */ jsxs4(
705
+ "li",
706
+ {
707
+ "data-spark-component": "file-upload-rejected-file",
708
+ className: cx6(
709
+ "relative",
710
+ "default:bg-surface default:border-sm default:border-outline default:p-md default:rounded-md",
711
+ "gap-md flex items-center justify-between default:w-full",
712
+ "border-error border-md",
713
+ className
714
+ ),
715
+ ...props,
716
+ children: [
717
+ /* @__PURE__ */ jsx8("div", { className: "size-sz-40 bg-error-container flex items-center justify-center rounded-md", children: /* @__PURE__ */ jsx8(Icon, { size: "md", className: "text-error", children: /* @__PURE__ */ jsx8(WarningOutline, {}) }) }),
718
+ /* @__PURE__ */ jsx8("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs4("div", { className: "gap-md flex flex-col", children: [
719
+ /* @__PURE__ */ jsxs4("div", { className: "gap-md flex flex-row items-center justify-between", children: [
720
+ /* @__PURE__ */ jsx8("p", { className: "text-body-2 truncate font-medium", children: rejectedFile.file.name }),
721
+ /* @__PURE__ */ jsx8("p", { className: "text-caption opacity-dim-1", children: formatFileSize(rejectedFile.file.size, locale) })
722
+ ] }),
723
+ /* @__PURE__ */ jsx8("div", { className: "gap-xs flex flex-col", children: rejectedFile.errors.map((error, errorIndex) => /* @__PURE__ */ jsx8("div", { className: "text-caption text-error", "data-error-code": error, children: renderError(error) }, errorIndex)) })
724
+ ] }) }),
725
+ /* @__PURE__ */ jsx8(RejectedFileDeleteTrigger, { "aria-label": deleteButtonAriaLabel, rejectedFile })
726
+ ]
727
+ }
728
+ );
756
729
  };
757
730
  RejectedFile.displayName = "FileUpload.RejectedFile";
758
731
 
759
732
  // src/file-upload/FileUploadTrigger.tsx
760
- import { cx as cx9 } from "class-variance-authority";
761
- import { jsx as jsx12 } from "react/jsx-runtime";
733
+ import { cx as cx7 } from "class-variance-authority";
734
+ import { jsx as jsx9 } from "react/jsx-runtime";
762
735
  var Trigger = ({
763
736
  className,
764
737
  children,
@@ -779,7 +752,7 @@ var Trigger = ({
779
752
  };
780
753
  const buttonComponent = unstyled ? "button" : Button;
781
754
  const Comp = asChild ? Slot : buttonComponent;
782
- return /* @__PURE__ */ jsx12(
755
+ return /* @__PURE__ */ jsx9(
783
756
  Comp,
784
757
  {
785
758
  type: "button",
@@ -798,7 +771,7 @@ var Trigger = ({
798
771
  design,
799
772
  intent,
800
773
  "data-spark-component": "file-upload-trigger",
801
- className: cx9(className),
774
+ className: cx7(className),
802
775
  disabled: disabled || readOnly,
803
776
  onClick: handleClick,
804
777
  ...props,
@@ -810,25 +783,22 @@ Trigger.displayName = "FileUpload.Trigger";
810
783
 
811
784
  // src/file-upload/index.ts
812
785
  var FileUpload2 = Object.assign(FileUpload, {
786
+ // Main input components
813
787
  Trigger,
814
788
  Dropzone,
789
+ // Context components
815
790
  Context,
816
- Item,
817
- ItemFileName,
818
- ItemSizeText,
819
- ItemDeleteTrigger,
820
- PreviewImage,
821
791
  AcceptedFile,
822
792
  RejectedFile,
793
+ // Helpers for custom renders
794
+ PreviewImage,
795
+ ItemDeleteTrigger,
823
796
  RejectedFileDeleteTrigger
824
797
  });
825
798
  FileUpload2.displayName = "FileUpload";
826
799
  Trigger.displayName = "FileUpload.Trigger";
827
800
  Dropzone.displayName = "FileUpload.Dropzone";
828
801
  Context.displayName = "FileUpload.Context";
829
- Item.displayName = "FileUpload.Item";
830
- ItemFileName.displayName = "FileUpload.ItemFileName";
831
- ItemSizeText.displayName = "FileUpload.ItemSizeText";
832
802
  ItemDeleteTrigger.displayName = "FileUpload.ItemDeleteTrigger";
833
803
  PreviewImage.displayName = "FileUpload.PreviewImage";
834
804
  AcceptedFile.displayName = "FileUpload.AcceptedFile";