@takeoff-ui/react-spar 0.3.0 → 0.4.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/README.md +23 -0
- package/agents/AGENTS.template.md +69 -0
- package/dist/index.cjs +1081 -61
- package/dist/index.d.cts +462 -3
- package/dist/index.d.ts +462 -3
- package/dist/index.mjs +1081 -62
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ElementType, ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
+
import { HTMLAttributes, ElementType, ComponentPropsWithoutRef, ReactNode, Ref, ImgHTMLAttributes } from 'react';
|
|
3
3
|
import { PolymorphicProps, AccordionProps as AccordionProps$1, AccordionItemProps as AccordionItemProps$1, AccordionHeaderProps as AccordionHeaderProps$1, AccordionContentProps as AccordionContentProps$1, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbItemRenderProps, BreadcrumbLinkProps as BreadcrumbLinkProps$1, NavigationHandler, PressEvent, ButtonProps as ButtonProps$1, CheckboxRenderProps as CheckboxRenderProps$1, CheckboxProps as CheckboxProps$1, DialogProps as DialogProps$1, DialogTriggerProps as DialogTriggerProps$1, DialogOverlayProps as DialogOverlayProps$1, DialogContentProps, DialogTitleProps as DialogTitleProps$1, DialogCloseProps as DialogCloseProps$1, DropdownMenuProps, DropdownMenuTriggerProps, DropdownMenuContentProps, DropdownMenuViewportProps, DropdownMenuItemProps, DropdownMenuGroupProps, DropdownMenuLabelProps, DropdownMenuSeparatorProps, DropdownMenuArrowProps, FieldProps as FieldProps$1, FieldLabelProps as FieldLabelProps$1, FieldDescriptionProps as FieldDescriptionProps$1, FieldErrorMessageProps as FieldErrorMessageProps$1, InputProps as InputProps$1, InputFieldProps as InputFieldProps$1, LabelProps as LabelProps$1, RadioProps as RadioProps$1, RadioItemRenderProps, RadioItemProps as RadioItemProps$1, PopoverProps as PopoverProps$1, PopoverTriggerProps as PopoverTriggerProps$1, PopoverContentProps as PopoverContentProps$1, PopoverCloseProps as PopoverCloseProps$1, SelectProps as SelectProps$1, SelectTriggerProps as SelectTriggerProps$1, SelectContentProps as SelectContentProps$1, SelectViewportProps as SelectViewportProps$1, SelectItemProps as SelectItemProps$1, SelectGroupProps as SelectGroupProps$1, SelectLabelProps as SelectLabelProps$1, SelectSeparatorProps as SelectSeparatorProps$1, SwitchRenderProps as SwitchRenderProps$1, SwitchProps as SwitchProps$1, TabsProps as TabsProps$1, TabsListProps as TabsListProps$1, TabsTriggerRenderProps as TabsTriggerRenderProps$1, TabsTriggerProps as TabsTriggerProps$1, TabsContentProps as TabsContentProps$1, TabsActivationMode as TabsActivationMode$1, TooltipTriggerProps as TooltipTriggerProps$1, TooltipContentProps as TooltipContentProps$1, TooltipProps as TooltipProps$1, TooltipProviderProps as TooltipProviderProps$1, ToasterController, ToastData as ToastData$1, ToasterProps as ToasterProps$1, ToastOptions as ToastOptions$1 } from '@turkish-technology/spar';
|
|
4
4
|
export { BreadcrumbItemRenderProps, BreadcrumbPosition, CreateToasterOptions, ToastAnnouncement, ToastPlacement, ToastPromiseOptions, ToastStatus, ToastType, ToastUpdateOptions, ToasterController, createToaster } from '@turkish-technology/spar';
|
|
5
5
|
import * as _tanstack_react_table from '@tanstack/react-table';
|
|
@@ -896,7 +896,7 @@ declare const Chip: {
|
|
|
896
896
|
* Side from which the drawer slides in.
|
|
897
897
|
* @defaultValue 'right'
|
|
898
898
|
*/
|
|
899
|
-
type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom'
|
|
899
|
+
type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
|
|
900
900
|
type DrawerOverlaySlot = 'root';
|
|
901
901
|
type DrawerPanelSlot = 'root';
|
|
902
902
|
type DrawerHeaderSlot = 'root';
|
|
@@ -3588,4 +3588,463 @@ declare const Skeleton: {
|
|
|
3588
3588
|
displayName: string;
|
|
3589
3589
|
};
|
|
3590
3590
|
|
|
3591
|
-
|
|
3591
|
+
type UploadSlot = 'root';
|
|
3592
|
+
type UploadDropzoneSlot = 'root';
|
|
3593
|
+
type UploadActionsSlot = 'root';
|
|
3594
|
+
type UploadTriggerSlot = 'root';
|
|
3595
|
+
type UploadSubmitSlot = 'root';
|
|
3596
|
+
type UploadListSlot = 'root';
|
|
3597
|
+
type UploadItemSlot = 'root';
|
|
3598
|
+
type UploadItemContentSlot = 'root' | 'name' | 'size' | 'status' | 'progress';
|
|
3599
|
+
type UploadItemPreviewSlot = 'root' | 'image' | 'icon' | 'extension';
|
|
3600
|
+
type UploadItemActionsSlot = 'root';
|
|
3601
|
+
type UploadItemActionSlot = 'root';
|
|
3602
|
+
/**
|
|
3603
|
+
* Per-file lifecycle status, driven by the consumer (the component does not
|
|
3604
|
+
* upload): `'idle'` is the resting state, `'uploading'` the transfer itself (the
|
|
3605
|
+
* only status that draws the progress bar), `'processing'` the server's own step
|
|
3606
|
+
* once the bytes have landed, which reports no percentage, and `'completed'` /
|
|
3607
|
+
* `'error'` the two outcomes.
|
|
3608
|
+
*/
|
|
3609
|
+
type UploadFileStatus = 'idle' | 'uploading' | 'processing' | 'completed' | 'error';
|
|
3610
|
+
/**
|
|
3611
|
+
* A file in the Upload value: a plain object that *points at* a picked `File`,
|
|
3612
|
+
* or stands for a remote/preloaded one through its `url`. `name` / `size` /
|
|
3613
|
+
* `type` may be set on the entry or read off `file`; the entry's own value
|
|
3614
|
+
* always wins.
|
|
3615
|
+
*/
|
|
3616
|
+
interface UploadFile {
|
|
3617
|
+
/** Stable identity (React key, status mapping). Generated for picked files. */
|
|
3618
|
+
id: string;
|
|
3619
|
+
/** The local bytes. Absent for a remote/preloaded entry, which uses `url`. */
|
|
3620
|
+
file?: File;
|
|
3621
|
+
/** Display name. Read off `file` when the entry does not state it. */
|
|
3622
|
+
name?: string;
|
|
3623
|
+
/** Size in bytes. Read off `file` when the entry does not state it. */
|
|
3624
|
+
size?: number;
|
|
3625
|
+
/** MIME type. Read off `file` when the entry does not state it. */
|
|
3626
|
+
type?: string;
|
|
3627
|
+
/** Remote URL for download / image preview when the bytes are not local. */
|
|
3628
|
+
url?: string;
|
|
3629
|
+
/**
|
|
3630
|
+
* A picture *of* the file rather than the file itself — a server-rendered
|
|
3631
|
+
* first page, a video's poster frame. Shown whatever the entry's `type` is,
|
|
3632
|
+
* which is what puts a non-image on the image branch; the download ignores it.
|
|
3633
|
+
*/
|
|
3634
|
+
thumbUrl?: string;
|
|
3635
|
+
/**
|
|
3636
|
+
* Lifecycle status. Optional because an entry without one already means the
|
|
3637
|
+
* resting state.
|
|
3638
|
+
* @defaultValue 'idle'
|
|
3639
|
+
*/
|
|
3640
|
+
status?: UploadFileStatus;
|
|
3641
|
+
/** Upload progress 0–100 while `status` is `'uploading'`. */
|
|
3642
|
+
progress?: number;
|
|
3643
|
+
/** Human-readable error, shown when `status` is `'error'`. */
|
|
3644
|
+
error?: string;
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* A file that failed validation, emitted (batched) through `onFilesReject` —
|
|
3648
|
+
* rejected files never enter `value`, so this is the only way a consumer learns
|
|
3649
|
+
* about them. Discriminated on `code`, and each branch carries the limit that
|
|
3650
|
+
* was broken, since the sentence shown to the user is the consumer's to write.
|
|
3651
|
+
*/
|
|
3652
|
+
type UploadRejection = {
|
|
3653
|
+
file: File;
|
|
3654
|
+
code: 'file-invalid-type';
|
|
3655
|
+
/** The `accept` list the file failed to match. */
|
|
3656
|
+
accept: string;
|
|
3657
|
+
} | {
|
|
3658
|
+
file: File;
|
|
3659
|
+
code: 'file-too-large';
|
|
3660
|
+
/** The `maxFileSize` (bytes) the file exceeded. */
|
|
3661
|
+
maxFileSize: number;
|
|
3662
|
+
} | {
|
|
3663
|
+
file: File;
|
|
3664
|
+
code: 'too-many-files';
|
|
3665
|
+
/** How many files were allowed — `maxFileCount`, or 1 without `multiple`. */
|
|
3666
|
+
maxFileCount: number;
|
|
3667
|
+
};
|
|
3668
|
+
/**
|
|
3669
|
+
* State + validation props owned by the Upload root. The anatomy — dropzone,
|
|
3670
|
+
* trigger, per-file actions — is expressed by composing parts rather than by
|
|
3671
|
+
* flags, mirroring the Input "modes as composition" model.
|
|
3672
|
+
*/
|
|
3673
|
+
interface UploadOwnProps {
|
|
3674
|
+
/** Committed files (controlled). Pair with `onValueChange`. */
|
|
3675
|
+
value?: UploadFile[];
|
|
3676
|
+
/** Initial files for uncontrolled usage. */
|
|
3677
|
+
defaultValue?: UploadFile[];
|
|
3678
|
+
/** Called with the next file array after a selection, drop, or removal. */
|
|
3679
|
+
onValueChange?: (files: UploadFile[]) => void;
|
|
3680
|
+
/** Acceptable file types — comma-separated MIME types (`image/*`) and/or extensions (`.pdf`). */
|
|
3681
|
+
accept?: string;
|
|
3682
|
+
/**
|
|
3683
|
+
* Allow selecting/holding more than one file. When `false`, a new selection
|
|
3684
|
+
* replaces the current file.
|
|
3685
|
+
* @defaultValue false
|
|
3686
|
+
*/
|
|
3687
|
+
multiple?: boolean;
|
|
3688
|
+
/**
|
|
3689
|
+
* Browse folders instead of single files: the picker takes a directory and
|
|
3690
|
+
* every file inside it (recursively), each keeping its `webkitRelativePath`
|
|
3691
|
+
* (e.g. `reports/2024/q1.pdf`) for rebuilding the tree. Implies `multiple`.
|
|
3692
|
+
* Only affects the picker — dropping a folder on `Upload.Dropzone` does not
|
|
3693
|
+
* expand it.
|
|
3694
|
+
* @defaultValue false
|
|
3695
|
+
*/
|
|
3696
|
+
directory?: boolean;
|
|
3697
|
+
/** Maximum size per file, in bytes. Larger files are rejected. */
|
|
3698
|
+
maxFileSize?: number;
|
|
3699
|
+
/** Maximum number of files (only meaningful with `multiple`). Extra files are rejected. */
|
|
3700
|
+
maxFileCount?: number;
|
|
3701
|
+
/**
|
|
3702
|
+
* Called with the entries that just entered the value — the files wrapped this
|
|
3703
|
+
* batch rather than the whole array, which is what a consumer starts its own
|
|
3704
|
+
* upload from. Files dropped as duplicates of ones already held are not
|
|
3705
|
+
* reported.
|
|
3706
|
+
*/
|
|
3707
|
+
onFileAccept?: (files: UploadFile[]) => void;
|
|
3708
|
+
/** Called with every file rejected by validation (type, size, or count). */
|
|
3709
|
+
onFilesReject?: (rejections: UploadRejection[]) => void;
|
|
3710
|
+
/**
|
|
3711
|
+
* Row support text while a file transfers. Localize per upload; an empty
|
|
3712
|
+
* string drops the status line, glyph included.
|
|
3713
|
+
* @defaultValue 'Uploading…'
|
|
3714
|
+
*/
|
|
3715
|
+
uploadingLabel?: string;
|
|
3716
|
+
/**
|
|
3717
|
+
* Row support text while the server works on a file that has landed.
|
|
3718
|
+
* Localize per upload; an empty string drops the status line, glyph included.
|
|
3719
|
+
* @defaultValue 'Processing…'
|
|
3720
|
+
*/
|
|
3721
|
+
processingLabel?: string;
|
|
3722
|
+
/**
|
|
3723
|
+
* Row support text once a file is done. Localize per upload; an empty string
|
|
3724
|
+
* drops the status line, glyph included.
|
|
3725
|
+
* @defaultValue 'Completed'
|
|
3726
|
+
*/
|
|
3727
|
+
completedLabel?: string;
|
|
3728
|
+
/**
|
|
3729
|
+
* Row support text for a failure that reports no `error` message of its own —
|
|
3730
|
+
* an entry's own `error` always wins. Localize per upload; an empty string
|
|
3731
|
+
* drops the status line, glyph included.
|
|
3732
|
+
* @defaultValue 'Failed'
|
|
3733
|
+
*/
|
|
3734
|
+
errorLabel?: string;
|
|
3735
|
+
/**
|
|
3736
|
+
* Accessible name for a row's progress bar, as a template: `{name}` stands
|
|
3737
|
+
* for the file's name, so several bars uploading at once stay distinguishable.
|
|
3738
|
+
* An empty string counts as unset — the bar cannot go unnamed.
|
|
3739
|
+
* @defaultValue '{name} upload progress'
|
|
3740
|
+
*/
|
|
3741
|
+
progressLabel?: string;
|
|
3742
|
+
/**
|
|
3743
|
+
* Accessible name for the built-in `action="download"`, as a `{name}`
|
|
3744
|
+
* template. An `Upload.ItemAction`'s own `label` wins over it, and an empty
|
|
3745
|
+
* string counts as unset — an icon-only button cannot go unnamed.
|
|
3746
|
+
* @defaultValue 'Download {name}'
|
|
3747
|
+
*/
|
|
3748
|
+
downloadLabel?: string;
|
|
3749
|
+
/**
|
|
3750
|
+
* Accessible name for the built-in `action="remove"`, as a `{name}` template.
|
|
3751
|
+
* An `Upload.ItemAction`'s own `label` wins over it, and an empty string
|
|
3752
|
+
* counts as unset — an icon-only button cannot go unnamed.
|
|
3753
|
+
* @defaultValue 'Remove {name}'
|
|
3754
|
+
*/
|
|
3755
|
+
removeLabel?: string;
|
|
3756
|
+
/** Disables the whole control. Also inherited from a surrounding `Field`. */
|
|
3757
|
+
disabled?: boolean;
|
|
3758
|
+
/** Read-only: files render and remain downloadable, but adding/removing is blocked. Also inherited from `Field`. */
|
|
3759
|
+
readOnly?: boolean;
|
|
3760
|
+
/** Marks the control invalid — mirrored as `data-invalid` for the recipe's danger styling. Also inherited from `Field`. */
|
|
3761
|
+
invalid?: boolean;
|
|
3762
|
+
/** Per-slot class name overrides. */
|
|
3763
|
+
classNames?: ClassNamesMap<UploadSlot>;
|
|
3764
|
+
/** Per-slot HTML attribute overrides. */
|
|
3765
|
+
slotProps?: SlotPropsMap<UploadSlot>;
|
|
3766
|
+
}
|
|
3767
|
+
/** Public props for the Upload root. Polymorphic via `as` (default `div`). */
|
|
3768
|
+
type UploadProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadOwnProps>;
|
|
3769
|
+
interface UploadDropzoneOwnProps {
|
|
3770
|
+
/** Zone content — typically a prompt and an `Upload.Trigger`. */
|
|
3771
|
+
children?: ReactNode;
|
|
3772
|
+
classNames?: ClassNamesMap<UploadDropzoneSlot>;
|
|
3773
|
+
slotProps?: SlotPropsMap<UploadDropzoneSlot>;
|
|
3774
|
+
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Drag-and-drop target. Composing it is what enables drag-and-drop; it owns the
|
|
3777
|
+
* `data-drag-state` (`accept` | `reject`) styling hook while a payload hovers.
|
|
3778
|
+
*/
|
|
3779
|
+
type UploadDropzoneProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadDropzoneOwnProps>;
|
|
3780
|
+
interface UploadActionsOwnProps {
|
|
3781
|
+
/** The controls to put on one line — typically `Upload.Trigger` and `Upload.Submit`. */
|
|
3782
|
+
children?: ReactNode;
|
|
3783
|
+
classNames?: ClassNamesMap<UploadActionsSlot>;
|
|
3784
|
+
slotProps?: SlotPropsMap<UploadActionsSlot>;
|
|
3785
|
+
}
|
|
3786
|
+
/**
|
|
3787
|
+
* A row for controls that belong together. `Upload.Dropzone` stacks its
|
|
3788
|
+
* children, so a Browse button and a Send button written as bare siblings each
|
|
3789
|
+
* take a line of their own; wrapping them in this part puts them side by side.
|
|
3790
|
+
* It holds no behavior — anywhere a set of controls should share a line, this is
|
|
3791
|
+
* the box for it.
|
|
3792
|
+
*/
|
|
3793
|
+
type UploadActionsProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadActionsOwnProps>;
|
|
3794
|
+
interface UploadTriggerOwnProps {
|
|
3795
|
+
/** Trigger label (e.g. `"Choose file"`). */
|
|
3796
|
+
children?: ReactNode;
|
|
3797
|
+
/**
|
|
3798
|
+
* Button appearance. Quieter than Button's own default, and the treatment
|
|
3799
|
+
* `Upload.Submit` takes too — the two stand beside each other in the zone, so
|
|
3800
|
+
* they read as one pair. Re-point it on a Trigger that stands alone.
|
|
3801
|
+
* @defaultValue 'outlined'
|
|
3802
|
+
*/
|
|
3803
|
+
appearance?: ButtonAppearance;
|
|
3804
|
+
/**
|
|
3805
|
+
* Button color variant.
|
|
3806
|
+
* @defaultValue 'neutral'
|
|
3807
|
+
*/
|
|
3808
|
+
variant?: ButtonVariant;
|
|
3809
|
+
classNames?: ClassNamesMap<UploadTriggerSlot>;
|
|
3810
|
+
slotProps?: SlotPropsMap<UploadTriggerSlot>;
|
|
3811
|
+
}
|
|
3812
|
+
/** Button that opens the native file picker. Focusable; disabled when the upload is disabled or read-only. */
|
|
3813
|
+
type UploadTriggerProps<T extends ElementType = 'button'> = PolymorphicProps<'button', T, UploadTriggerOwnProps>;
|
|
3814
|
+
interface UploadSubmitOwnProps {
|
|
3815
|
+
/** Submit label (e.g. `"Upload"`). Wire the actual upload through `onClick`. */
|
|
3816
|
+
children?: ReactNode;
|
|
3817
|
+
/**
|
|
3818
|
+
* Button appearance. The Trigger's, not Button's own: the two stand beside
|
|
3819
|
+
* each other in the zone, so they read as one pair rather than as two weights.
|
|
3820
|
+
* Re-point it where the send is the page's primary action.
|
|
3821
|
+
* @defaultValue 'outlined'
|
|
3822
|
+
*/
|
|
3823
|
+
appearance?: ButtonAppearance;
|
|
3824
|
+
/**
|
|
3825
|
+
* Button color variant.
|
|
3826
|
+
* @defaultValue 'neutral'
|
|
3827
|
+
*/
|
|
3828
|
+
variant?: ButtonVariant;
|
|
3829
|
+
classNames?: ClassNamesMap<UploadSubmitSlot>;
|
|
3830
|
+
slotProps?: SlotPropsMap<UploadSubmitSlot>;
|
|
3831
|
+
}
|
|
3832
|
+
/**
|
|
3833
|
+
* Optional "upload" button. The component does not perform the network upload
|
|
3834
|
+
* (out of scope) — wire it through `onClick`. Disabled while there are no files
|
|
3835
|
+
* or when the upload is disabled; read-only leaves it working, since handing a
|
|
3836
|
+
* fixed list upstream does not change it.
|
|
3837
|
+
*/
|
|
3838
|
+
type UploadSubmitProps<T extends ElementType = 'button'> = PolymorphicProps<'button', T, UploadSubmitOwnProps>;
|
|
3839
|
+
interface UploadListOwnProps {
|
|
3840
|
+
/**
|
|
3841
|
+
* The rows. A function receives the current files and returns them (the usual
|
|
3842
|
+
* form — the consumer owns the map, so each `Upload.Item` gets its `file` and
|
|
3843
|
+
* every action closes over it). Plain nodes are rendered as authored. Omit it
|
|
3844
|
+
* for a default `Upload.Item` per file.
|
|
3845
|
+
*/
|
|
3846
|
+
children?: ReactNode | ((files: UploadFile[]) => ReactNode);
|
|
3847
|
+
classNames?: ClassNamesMap<UploadListSlot>;
|
|
3848
|
+
slotProps?: SlotPropsMap<UploadListSlot>;
|
|
3849
|
+
}
|
|
3850
|
+
/**
|
|
3851
|
+
* File list region. Renders nothing while empty; otherwise its children (or a
|
|
3852
|
+
* default row per file).
|
|
3853
|
+
*/
|
|
3854
|
+
type UploadListProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadListOwnProps>;
|
|
3855
|
+
interface UploadItemOwnProps {
|
|
3856
|
+
/** The file this row renders. Also what its `Upload.ItemAction` children read. */
|
|
3857
|
+
file: UploadFile;
|
|
3858
|
+
/**
|
|
3859
|
+
* Action controls (`Upload.ItemAction`), wrapped in a default
|
|
3860
|
+
* `Upload.ItemActions` for you — and *replacing* its default download + remove
|
|
3861
|
+
* pair rather than joining it. Composing `Upload.ItemPreview`,
|
|
3862
|
+
* `Upload.ItemContent`, or `Upload.ItemActions` replaces that region instead,
|
|
3863
|
+
* each hoisted into its own position wherever it is written; with an
|
|
3864
|
+
* `Upload.ItemActions` composed, anything else stays where it was written.
|
|
3865
|
+
*/
|
|
3866
|
+
children?: ReactNode;
|
|
3867
|
+
classNames?: ClassNamesMap<UploadItemSlot>;
|
|
3868
|
+
slotProps?: SlotPropsMap<UploadItemSlot>;
|
|
3869
|
+
}
|
|
3870
|
+
/**
|
|
3871
|
+
* Per-file row, in three regions: preview · content · actions. Every region has
|
|
3872
|
+
* a default, so a bare row with only `file` is complete. Mirrors the entry's
|
|
3873
|
+
* `status` as `data-status`.
|
|
3874
|
+
*/
|
|
3875
|
+
type UploadItemProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadItemOwnProps>;
|
|
3876
|
+
interface UploadItemContentOwnProps {
|
|
3877
|
+
/**
|
|
3878
|
+
* Replaces the file's details entirely — your own name/meta layout, a
|
|
3879
|
+
* description line, an inline error. Omit it for the default content (name,
|
|
3880
|
+
* size, status icon, and the progress bar while uploading).
|
|
3881
|
+
*/
|
|
3882
|
+
children?: ReactNode;
|
|
3883
|
+
classNames?: ClassNamesMap<UploadItemContentSlot>;
|
|
3884
|
+
slotProps?: SlotPropsMap<UploadItemContentSlot>;
|
|
3885
|
+
}
|
|
3886
|
+
/**
|
|
3887
|
+
* The row's middle region: the file's name, its formatted size, the status icon
|
|
3888
|
+
* (spinner / check / warning), and the progress bar while the entry uploads —
|
|
3889
|
+
* all decorative inline slots of this part, styled through `classNames` /
|
|
3890
|
+
* `slotProps`. `Upload.Item` renders it by default, and it reads its file from
|
|
3891
|
+
* the surrounding row.
|
|
3892
|
+
*/
|
|
3893
|
+
type UploadItemContentProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadItemContentOwnProps>;
|
|
3894
|
+
/**
|
|
3895
|
+
* Per-slot attribute overrides for the preview. The `image` slot renders an
|
|
3896
|
+
* `<img>`, so it also accepts image attributes (`alt`, `loading`, `sizes`, …) —
|
|
3897
|
+
* the part's own `alt=""` / `loading="lazy"` are defaults a call site can
|
|
3898
|
+
* replace, not invariants.
|
|
3899
|
+
*/
|
|
3900
|
+
type UploadItemPreviewSlotProps = SlotPropsMap<UploadItemPreviewSlot> & {
|
|
3901
|
+
image?: ImgHTMLAttributes<HTMLImageElement>;
|
|
3902
|
+
};
|
|
3903
|
+
interface UploadItemPreviewOwnProps {
|
|
3904
|
+
/**
|
|
3905
|
+
* Replaces the built-in thumbnail entirely — your own glyph, a video poster,
|
|
3906
|
+
* a rendered document page. Omit it for the default preview (image thumbnail,
|
|
3907
|
+
* file-type icon, or extension badge).
|
|
3908
|
+
*/
|
|
3909
|
+
children?: ReactNode;
|
|
3910
|
+
classNames?: ClassNamesMap<UploadItemPreviewSlot>;
|
|
3911
|
+
slotProps?: UploadItemPreviewSlotProps;
|
|
3912
|
+
}
|
|
3913
|
+
/**
|
|
3914
|
+
* The row's thumbnail, in three branches: an image preview for image entries (a
|
|
3915
|
+
* local `File` through an object URL revoked on unmount/change, a remote entry
|
|
3916
|
+
* through its `url`), the shipped file-type icon (PDF, Word, Excel, PowerPoint,
|
|
3917
|
+
* JPG, PNG, MP4, TXT, ZIP), and the uppercased extension for everything else.
|
|
3918
|
+
* `Upload.Item` renders it by default, and it reads its file from the
|
|
3919
|
+
* surrounding row.
|
|
3920
|
+
*/
|
|
3921
|
+
type UploadItemPreviewProps<T extends ElementType = 'span'> = PolymorphicProps<'span', T, UploadItemPreviewOwnProps>;
|
|
3922
|
+
interface UploadItemActionsOwnProps {
|
|
3923
|
+
/**
|
|
3924
|
+
* The row's actions. Replaces the default pair (`download` + `remove`)
|
|
3925
|
+
* entirely — pass the `Upload.ItemAction`s you want, in the order you want.
|
|
3926
|
+
*/
|
|
3927
|
+
children?: ReactNode;
|
|
3928
|
+
classNames?: ClassNamesMap<UploadItemActionsSlot>;
|
|
3929
|
+
slotProps?: SlotPropsMap<UploadItemActionsSlot>;
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* The row's trailing action area. `Upload.Item` renders it by default — holding
|
|
3933
|
+
* a download and a remove action — so it only needs composing to change that set
|
|
3934
|
+
* or to style / move the container itself.
|
|
3935
|
+
*/
|
|
3936
|
+
type UploadItemActionsProps<T extends ElementType = 'div'> = PolymorphicProps<'div', T, UploadItemActionsOwnProps>;
|
|
3937
|
+
interface UploadItemActionOwnProps {
|
|
3938
|
+
/**
|
|
3939
|
+
* Names the action, mirrored as `data-action` whatever the name is.
|
|
3940
|
+
*
|
|
3941
|
+
* Two names arrive wired, each with its own icon and label: `'download'` saves
|
|
3942
|
+
* the row's file (its `File` through an object URL, a preloaded entry through
|
|
3943
|
+
* its `url`) and stays available in read-only; `'remove'` drops the file from
|
|
3944
|
+
* `value` and is not rendered at all in read-only. Any other name —
|
|
3945
|
+
* `'preview'`, `'retry'`, `'share'` — is yours: the behavior comes from
|
|
3946
|
+
* `onClick`, the glyph from `children`, the wording from `label`.
|
|
3947
|
+
*/
|
|
3948
|
+
action?: 'download' | 'remove' | (string & {});
|
|
3949
|
+
/**
|
|
3950
|
+
* Accessible name for the action, as a template: `{name}` stands for the
|
|
3951
|
+
* file's name, so `"Preview {name}"` gives `aria-label="Preview report.pdf"`
|
|
3952
|
+
* and icon-only actions stay labelled per file. An explicit `aria-label` wins
|
|
3953
|
+
* over it, and an empty one counts as unset, so a built-in action falls back
|
|
3954
|
+
* to the root's copy rather than losing its name.
|
|
3955
|
+
* @defaultValue the root's copy for the `action` (`downloadLabel` / `removeLabel`)
|
|
3956
|
+
*/
|
|
3957
|
+
label?: string;
|
|
3958
|
+
/** Action content — typically an icon. Defaults to the `action`'s own glyph. */
|
|
3959
|
+
children?: ReactNode;
|
|
3960
|
+
/**
|
|
3961
|
+
* Button appearance. Defaults to the row's shape — a small, quiet icon button
|
|
3962
|
+
* beside the file's details — rather than Button's own default, so a text-only
|
|
3963
|
+
* remove or a danger-coloured one is a re-point, not a rebuild.
|
|
3964
|
+
* @defaultValue 'outlined'
|
|
3965
|
+
*/
|
|
3966
|
+
appearance?: ButtonAppearance;
|
|
3967
|
+
/**
|
|
3968
|
+
* Button color variant.
|
|
3969
|
+
* @defaultValue 'neutral'
|
|
3970
|
+
*/
|
|
3971
|
+
variant?: ButtonVariant;
|
|
3972
|
+
/**
|
|
3973
|
+
* Button size scale.
|
|
3974
|
+
* @defaultValue 'small'
|
|
3975
|
+
*/
|
|
3976
|
+
size?: ButtonSize;
|
|
3977
|
+
classNames?: ClassNamesMap<UploadItemActionSlot>;
|
|
3978
|
+
slotProps?: SlotPropsMap<UploadItemActionSlot>;
|
|
3979
|
+
}
|
|
3980
|
+
/**
|
|
3981
|
+
* Per-file action control: one focusable, file-labelled button covering the
|
|
3982
|
+
* built-in download / remove and every consumer-wired action — preview, retry,
|
|
3983
|
+
* share — through `onClick`. Rendering it as `as="a" href` hands the download to
|
|
3984
|
+
* the platform instead. Inert when the upload is disabled, or when the call site
|
|
3985
|
+
* disables this one action.
|
|
3986
|
+
*/
|
|
3987
|
+
type UploadItemActionProps<T extends ElementType = 'button'> = PolymorphicProps<'button', T, UploadItemActionOwnProps>;
|
|
3988
|
+
declare module '../../core/theme' {
|
|
3989
|
+
interface ComponentThemeRegistry {
|
|
3990
|
+
Upload: ComponentThemeConfig<UploadProps, UploadSlot>;
|
|
3991
|
+
UploadDropzone: ComponentThemeConfig<UploadDropzoneProps, UploadDropzoneSlot>;
|
|
3992
|
+
UploadActions: ComponentThemeConfig<UploadActionsProps, UploadActionsSlot>;
|
|
3993
|
+
UploadTrigger: ComponentThemeConfig<UploadTriggerProps, UploadTriggerSlot>;
|
|
3994
|
+
UploadSubmit: ComponentThemeConfig<UploadSubmitProps, UploadSubmitSlot>;
|
|
3995
|
+
UploadList: ComponentThemeConfig<UploadListProps, UploadListSlot>;
|
|
3996
|
+
UploadItem: ComponentThemeConfig<UploadItemProps, UploadItemSlot>;
|
|
3997
|
+
UploadItemContent: ComponentThemeConfig<UploadItemContentProps, UploadItemContentSlot>;
|
|
3998
|
+
UploadItemPreview: ComponentThemeConfig<UploadItemPreviewProps, UploadItemPreviewSlot, UploadItemPreviewSlotProps>;
|
|
3999
|
+
UploadItemActions: ComponentThemeConfig<UploadItemActionsProps, UploadItemActionsSlot>;
|
|
4000
|
+
UploadItemAction: ComponentThemeConfig<UploadItemActionProps, UploadItemActionSlot>;
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
|
|
4004
|
+
declare const Upload: {
|
|
4005
|
+
<T extends react.ElementType = "div">(props: UploadProps<T>): react.JSX.Element;
|
|
4006
|
+
displayName: string;
|
|
4007
|
+
} & {
|
|
4008
|
+
Dropzone: {
|
|
4009
|
+
<T extends react.ElementType = "div">(props: UploadDropzoneProps<T>): react.JSX.Element;
|
|
4010
|
+
displayName: string;
|
|
4011
|
+
};
|
|
4012
|
+
Actions: {
|
|
4013
|
+
<T extends react.ElementType = "div">(props: UploadActionsProps<T>): react.JSX.Element;
|
|
4014
|
+
displayName: string;
|
|
4015
|
+
};
|
|
4016
|
+
Trigger: {
|
|
4017
|
+
<T extends react.ElementType = "button">(props: UploadTriggerProps<T>): react.JSX.Element;
|
|
4018
|
+
displayName: string;
|
|
4019
|
+
};
|
|
4020
|
+
Submit: {
|
|
4021
|
+
<T extends react.ElementType = "button">(props: UploadSubmitProps<T>): react.JSX.Element;
|
|
4022
|
+
displayName: string;
|
|
4023
|
+
};
|
|
4024
|
+
List: {
|
|
4025
|
+
<T extends react.ElementType = "div">(props: UploadListProps<T>): react.JSX.Element | null;
|
|
4026
|
+
displayName: string;
|
|
4027
|
+
};
|
|
4028
|
+
Item: {
|
|
4029
|
+
<T extends react.ElementType = "div">(props: UploadItemProps<T>): react.JSX.Element;
|
|
4030
|
+
displayName: string;
|
|
4031
|
+
};
|
|
4032
|
+
ItemPreview: {
|
|
4033
|
+
<T extends react.ElementType = "span">(props: UploadItemPreviewProps<T>): react.JSX.Element;
|
|
4034
|
+
displayName: string;
|
|
4035
|
+
};
|
|
4036
|
+
ItemContent: {
|
|
4037
|
+
<T extends react.ElementType = "div">(props: UploadItemContentProps<T>): react.JSX.Element;
|
|
4038
|
+
displayName: string;
|
|
4039
|
+
};
|
|
4040
|
+
ItemActions: {
|
|
4041
|
+
<T extends react.ElementType = "div">(props: UploadItemActionsProps<T>): react.JSX.Element | null;
|
|
4042
|
+
displayName: string;
|
|
4043
|
+
};
|
|
4044
|
+
ItemAction: {
|
|
4045
|
+
<T extends react.ElementType = "button">(props: UploadItemActionProps<T>): react.JSX.Element | null;
|
|
4046
|
+
displayName: string;
|
|
4047
|
+
};
|
|
4048
|
+
};
|
|
4049
|
+
|
|
4050
|
+
export { Accordion, type AccordionContentProps, type AccordionCurrentValue, type AccordionHeaderProps, type AccordionHeadingLevel, type AccordionIndicatorProps, type AccordionIndicatorRenderState, type AccordionItemProps, type AccordionMode, type AccordionProps, type AccordionSize, type AccordionTriggerProps, type AccordionType, type AccordionValue, type AccordionValueChangeHandler, Alert, type AlertActionsProps, type AlertActionsSlot, type AlertAppearance, type AlertCloseProps, type AlertCloseSlot, type AlertContentProps, type AlertContentSlot, type AlertDescriptionProps, type AlertDescriptionSlot, type AlertProps, type AlertSlot, type AlertTitleProps, type AlertTitleSlot, type AlertVariant, Badge, type BadgeAppearance, type BadgeProps, type BadgeSize, type BadgeSlot, type BadgeVariant, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbLinkProps, type BreadcrumbListProps, type BreadcrumbNavigationHandler, type BreadcrumbPageProps, type BreadcrumbPressEvent, type BreadcrumbProps, type BreadcrumbSeparatorProps, type BreadcrumbSize, type BreadcrumbType, Button, type ButtonAppearance, type ButtonProps, type ButtonSize, type ButtonSlot, type ButtonVariant, Card, type CardBodyProps, type CardBodySlot, type CardDescriptionProps, type CardDescriptionSlot, type CardFooterProps, type CardFooterSlot, type CardFooterType, type CardHeaderProps, type CardHeaderSlot, type CardHeaderType, type CardProps, type CardSlot, type CardTitleProps, type CardTitleSlot, Checkbox, type CheckboxIndicatorProps, type CheckboxIndicatorRenderProps, type CheckboxProps, type CheckboxRenderProps, type CheckboxSize, type CheckboxSlot, Chip, type ChipAppearance, type ChipProps, type ChipSize, type ChipSlot, type ChipVariant, type ClassNamesMap, type ColorMode, type ComponentName, type ComponentThemeConfig, type ComponentThemeRegistry, type ComponentsThemeMap, type ControlledState, type DataSlotName, Dialog, type DialogBodyProps, type DialogBodySlot, type DialogCloseProps, type DialogCloseSlot, type DialogDescriptionProps, type DialogDescriptionSlot, type DialogFooterProps, type DialogFooterSlot, type DialogFooterType, type DialogHeaderProps, type DialogHeaderSlot, type DialogHeaderType, type DialogOverlayIntensity, type DialogOverlayProps, type DialogOverlaySlot, type DialogPanelProps, type DialogPanelSlot, type DialogProps, type DialogTitleProps, type DialogTitleSlot, type DialogTriggerProps, type DialogTriggerSlot, Divider, type DividerAlign, type DividerAppearance, type DividerOrientation, type DividerProps, type DividerSlot, Drawer, type DrawerBodyProps, type DrawerCloseProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerHeaderProps, type DrawerOverlayProps, type DrawerPanelProps, type DrawerPlacement, type DrawerProps, type DrawerTitleProps, type DrawerTriggerProps, Dropdown, type DropdownArrowProps, type DropdownContentProps, type DropdownContentWidth, type DropdownGroupProps, type DropdownItemProps, type DropdownLabelProps, type DropdownProps, type DropdownSeparatorProps, type DropdownSize, type DropdownTriggerProps, type DropdownViewportProps, Field, type FieldDescriptionProps, type FieldDescriptionSlot, type FieldErrorMessageProps, type FieldErrorMessageSlot, type FieldLabelProps, type FieldLabelSlot, type FieldProps, type FieldSlot, Input, type InputChipsProps, type InputChipsSlot, type InputClearButtonProps, type InputClearButtonSlot, type InputDecrementProps, type InputDecrementSlot, type InputFieldProps, type InputFieldSlot, type InputIncrementProps, type InputIncrementSlot, type InputLeadingIconProps, type InputLeadingIconSlot, type InputPrefixProps, type InputPrefixSlot, type InputProps, type InputRevealButtonProps, type InputRevealButtonSlot, type InputSize, type InputSlot, type InputSpinnerProps, type InputSpinnerSlot, type InputStepperProps, type InputStepperSlot, type InputStrengthProps, type InputStrengthSlot, type InputSuffixProps, type InputSuffixSlot, type InputTrailingIconProps, type InputTrailingIconSlot, Label, type LabelProps, type LabelSlot, Popover, type PopoverArrowProps, type PopoverArrowSlot, type PopoverCloseProps, type PopoverCloseSlot, type PopoverContentProps, type PopoverContentSlot, type PopoverDescriptionProps, type PopoverDescriptionSlot, type PopoverHeaderProps, type PopoverHeaderSlot, type PopoverProps, type PopoverTriggerProps, type PopoverTriggerSlot, type PopoverVariant, Progress, type ProgressAppearance, type ProgressIndicatorProps, type ProgressIndicatorSlot, type ProgressProps, type ProgressSize, type ProgressSlot, type ProgressTrackProps, type ProgressTrackSlot, type ProgressValueProps, type ProgressValueSlot, type ProgressVariant, Radio, type RadioIndicatorProps, type RadioItemProps, type RadioItemSlot, type RadioLabelProps, type RadioPosition, type RadioProps, type RadioRenderProps, type RadioSize, type RadioSlot, Select, type SelectArrowProps, type SelectContentProps, type SelectGroupProps, type SelectIndicatorProps, type SelectIndicatorRenderState, type SelectItemProps, type SelectLabelProps, type SelectProps, type SelectSeparatorProps, type SelectSize, type SelectTriggerProps, type SelectViewportProps, Skeleton, type SkeletonAnimation, type SkeletonProps, type SkeletonShape, type SkeletonSlot, Slider, type SliderOrientation, type SliderProps, type SliderRangeProps, type SliderRangeValueProps, type SliderSingleValueProps, type SliderSize, type SliderSlot, type SliderThumbProps, type SliderThumbRenderProps, type SliderTicksProps, type SliderTooltip, type SliderTrackMode, type SliderTrackProps, type SliderValue, type SliderValueProps, type SliderValueRenderProps, type SliderVariant, type SlotClassNames, type SlotPropsMap, Spinner, type SpinnerAppearance, type SpinnerProps, type SpinnerSize, type SpinnerSlot, type SpinnerVariant, type StateOnlyComponentThemeConfig$1 as StateOnlyComponentThemeConfig, Stepper, type StepperDescriptionProps, type StepperIndicatorState, type StepperItemProps, type StepperMode, type StepperOrientation, type StepperProps, type StepperSize, type StepperStepClickDetail, type StepperStepStatus, type StepperTitleProps, Switch, type SwitchIndicatorProps, type SwitchIndicatorRenderProps, type SwitchProps, type SwitchRenderProps, type SwitchSize, type SwitchSlot, type SwitchVariant, Table, type TableAlign, type TableColumnAccessor, type TableColumnDef, type TableColumnFilter, type TableColumnFilterContext, type TableColumnFilterOption, type TableColumnFilterType, type TableColumnMeta, type TableDataRequest, type TableExpansionConfig, type TableFilteringConfig, type TablePaginationConfig, type TableProps, type TableSelectionConfig, type TableSize, type TableSlot, type TableSortingConfig, type TableStickySide, Tabs, type TabsActivationMode, type TabsAppearance, type TabsContentProps, type TabsListProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsTriggerRenderProps, type TabsVariant, TakeoffSparProvider, type TakeoffSparProviderProps, type TakeoffSparProviderValue, type ThemeValue, Toast, type ToastAppearance, type ToastData, type ToastOptions, type ToastProps, type ToastSlot, type ToastVariant, Toaster, type ToasterOwnProps, type ToasterProps, type ToasterSlot, Tooltip, type TooltipArrowProps, type TooltipArrowSlot, type TooltipContentProps, type TooltipContentSlot, type TooltipDescriptionProps, type TooltipDescriptionSlot, type TooltipHeaderProps, type TooltipHeaderSlot, type TooltipProps, type TooltipProviderProps, type TooltipTriggerProps, type TooltipTriggerSlot, type TooltipVariant, Upload, type UploadActionsProps, type UploadActionsSlot, type UploadDropzoneProps, type UploadDropzoneSlot, type UploadFile, type UploadFileStatus, type UploadItemActionProps, type UploadItemActionSlot, type UploadItemActionsProps, type UploadItemActionsSlot, type UploadItemContentProps, type UploadItemContentSlot, type UploadItemPreviewProps, type UploadItemPreviewSlot, type UploadItemPreviewSlotProps, type UploadItemProps, type UploadItemSlot, type UploadListProps, type UploadListSlot, type UploadProps, type UploadRejection, type UploadSlot, type UploadSubmitProps, type UploadSubmitSlot, type UploadTriggerProps, type UploadTriggerSlot, getExportRows, useComponentTheme, useTheme };
|