@hex-core/components 1.4.0 → 1.6.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/_tsup-dts-rollup.d.ts +3556 -0
- package/dist/accordion.d.ts +4 -13
- package/dist/alert-dialog.d.ts +11 -34
- package/dist/alert.d.ts +4 -17
- package/dist/aspect-ratio.d.ts +1 -7
- package/dist/attachment.d.ts +4 -0
- package/dist/attachment.js +157 -0
- package/dist/attachment.js.map +1 -0
- package/dist/avatar.d.ts +3 -11
- package/dist/badge.d.ts +3 -22
- package/dist/breadcrumb.d.ts +7 -27
- package/dist/button.d.ts +3 -13
- package/dist/calendar.d.ts +1 -17
- package/dist/card.d.ts +6 -16
- package/dist/checkbox.d.ts +2 -11
- package/dist/citation.d.ts +2 -0
- package/dist/citation.js +70 -0
- package/dist/citation.js.map +1 -0
- package/dist/cluster.d.ts +3 -34
- package/dist/code-block-copy.d.ts +2 -0
- package/dist/code-block-copy.js +108 -0
- package/dist/code-block-copy.js.map +1 -0
- package/dist/code-block.d.ts +3 -0
- package/dist/code-block.js +90 -0
- package/dist/code-block.js.map +1 -0
- package/dist/collapsible.d.ts +3 -11
- package/dist/color-picker.d.ts +2 -44
- package/dist/combobox.d.ts +3 -45
- package/dist/command.d.ts +9 -111
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +75 -0
- package/dist/composer.js.map +1 -0
- package/dist/container.d.ts +3 -41
- package/dist/context-menu.d.ts +12 -37
- package/dist/data-table.d.ts +2 -33
- package/dist/date-picker.d.ts +2 -43
- package/dist/dialog.d.ts +11 -46
- package/dist/drawer.d.ts +10 -41
- package/dist/dropdown-menu.d.ts +13 -39
- package/dist/dropzone.d.ts +3 -54
- package/dist/dropzone.js +46 -44
- package/dist/dropzone.js.map +1 -1
- package/dist/empty.d.ts +3 -0
- package/dist/empty.js +94 -0
- package/dist/empty.js.map +1 -0
- package/dist/error-state.d.ts +3 -0
- package/dist/error-state.js +67 -0
- package/dist/error-state.js.map +1 -0
- package/dist/file-tree.d.ts +3 -53
- package/dist/form.d.ts +8 -45
- package/dist/grid.d.ts +3 -50
- package/dist/hover-card.d.ts +3 -11
- package/dist/index.d.ts +325 -179
- package/dist/index.js +1592 -122
- package/dist/index.js.map +1 -1
- package/dist/input-otp.d.ts +5 -19
- package/dist/input.d.ts +2 -6
- package/dist/label.d.ts +2 -11
- package/dist/loading-indicator.d.ts +3 -0
- package/dist/loading-indicator.js +64 -0
- package/dist/loading-indicator.js.map +1 -0
- package/dist/loading.d.ts +3 -0
- package/dist/loading.js +80 -0
- package/dist/loading.js.map +1 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +28 -0
- package/dist/markdown.js.map +1 -0
- package/dist/menubar.d.ts +11 -35
- package/dist/message-actions.d.ts +2 -0
- package/dist/message-actions.js +28 -0
- package/dist/message-actions.js.map +1 -0
- package/dist/message-list.d.ts +2 -0
- package/dist/message-list.js +49 -0
- package/dist/message-list.js.map +1 -0
- package/dist/message.d.ts +3 -0
- package/dist/message.js +35 -0
- package/dist/message.js.map +1 -0
- package/dist/multi-combobox.d.ts +3 -51
- package/dist/navigation-menu.d.ts +9 -23
- package/dist/pagination.d.ts +7 -40
- package/dist/popover.d.ts +4 -13
- package/dist/progress.d.ts +1 -10
- package/dist/radio-group.d.ts +2 -9
- package/dist/reasoning.d.ts +2 -0
- package/dist/reasoning.js +90 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/resizable.d.ts +3 -28
- package/dist/schemas.d.ts +79 -121
- package/dist/schemas.js +1649 -1
- package/dist/schemas.js.map +1 -1
- package/dist/scroll-area.d.ts +3 -18
- package/dist/select.d.ts +8 -21
- package/dist/separator.d.ts +2 -11
- package/dist/sheet.d.ts +10 -39
- package/dist/sidebar.d.ts +8 -75
- package/dist/skeleton.d.ts +1 -11
- package/dist/slider.d.ts +2 -20
- package/dist/sonner.d.ts +2 -14
- package/dist/spacer.d.ts +3 -38
- package/dist/stack.d.ts +3 -34
- package/dist/stepper.d.ts +4 -48
- package/dist/suggestion.d.ts +2 -0
- package/dist/suggestion.js +55 -0
- package/dist/suggestion.js.map +1 -0
- package/dist/switch.d.ts +2 -11
- package/dist/table.d.ts +8 -24
- package/dist/tabs.d.ts +4 -13
- package/dist/tag.d.ts +3 -0
- package/dist/tag.js +107 -0
- package/dist/tag.js.map +1 -0
- package/dist/textarea.d.ts +2 -10
- package/dist/time-picker.d.ts +2 -34
- package/dist/timeline.d.ts +4 -42
- package/dist/toggle-group.d.ts +2 -17
- package/dist/toggle.d.ts +2 -19
- package/dist/tool-call.d.ts +2 -0
- package/dist/tool-call.js +133 -0
- package/dist/tool-call.js.map +1 -0
- package/dist/toolbar.d.ts +8 -0
- package/dist/toolbar.js +120 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tooltip.d.ts +4 -13
- package/dist/tree.d.ts +3 -0
- package/dist/tree.js +275 -0
- package/dist/tree.js.map +1 -0
- package/package.json +5 -1
- package/dist/button-variants-Bx6gCUFp.d.ts +0 -19
package/dist/context-menu.d.ts
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** Group for checkable radio items. */
|
|
14
|
-
declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
/** The menu panel shown when the trigger is right-clicked. */
|
|
16
|
-
declare const ContextMenuContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
/** A clickable menu item. */
|
|
18
|
-
declare const ContextMenuItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
19
|
-
inset?: boolean;
|
|
20
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
/** A checkable menu item. */
|
|
22
|
-
declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
-
/** A radio menu item. */
|
|
24
|
-
declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
/** A non-interactive heading label. */
|
|
26
|
-
declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
27
|
-
inset?: boolean;
|
|
28
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
/** Horizontal divider. */
|
|
30
|
-
declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
/**
|
|
32
|
-
* Right-aligned shortcut text (e.g. ⌘⇧N).
|
|
33
|
-
* @returns A span with muted typography
|
|
34
|
-
*/
|
|
35
|
-
declare function ContextMenuShortcut({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
36
|
-
|
|
37
|
-
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger };
|
|
1
|
+
export { ContextMenu_alias_1 as ContextMenu } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { ContextMenuTrigger_alias_1 as ContextMenuTrigger } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { ContextMenuContent_alias_1 as ContextMenuContent } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { ContextMenuItem_alias_1 as ContextMenuItem } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { ContextMenuCheckboxItem_alias_1 as ContextMenuCheckboxItem } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { ContextMenuRadioItem_alias_1 as ContextMenuRadioItem } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { ContextMenuLabel_alias_1 as ContextMenuLabel } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { ContextMenuSeparator_alias_1 as ContextMenuSeparator } from './_tsup-dts-rollup.js';
|
|
9
|
+
export { ContextMenuShortcut_alias_1 as ContextMenuShortcut } from './_tsup-dts-rollup.js';
|
|
10
|
+
export { ContextMenuGroup_alias_1 as ContextMenuGroup } from './_tsup-dts-rollup.js';
|
|
11
|
+
export { ContextMenuPortal_alias_1 as ContextMenuPortal } from './_tsup-dts-rollup.js';
|
|
12
|
+
export { ContextMenuRadioGroup_alias_1 as ContextMenuRadioGroup } from './_tsup-dts-rollup.js';
|
package/dist/data-table.d.ts
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generic DataTable wrapper that renders a TanStack Table model using Hex UI's
|
|
7
|
-
* Table primitives. Pass columns + data; use TanStack hooks for sorting,
|
|
8
|
-
* filtering, pagination, row-selection as needed.
|
|
9
|
-
* @template TData - Row data type. Cell value types are inferred per column by TanStack.
|
|
10
|
-
*/
|
|
11
|
-
interface DataTableProps<TData> {
|
|
12
|
-
columns: ColumnDef<TData, unknown>[];
|
|
13
|
-
data: TData[];
|
|
14
|
-
/**
|
|
15
|
-
* Visible caption rendered below the table. Announced by screen readers
|
|
16
|
-
* when the user enters the table. Provide either `caption` or `aria-label`.
|
|
17
|
-
*/
|
|
18
|
-
caption?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Accessible label for the table when no visible caption is shown.
|
|
21
|
-
* Forwarded as `aria-label` on the underlying `<table>` element. Kebab-case
|
|
22
|
-
* to match the canonical ARIA prop convention used elsewhere in Hex UI.
|
|
23
|
-
*/
|
|
24
|
-
"aria-label"?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Render a data-driven table from TanStack column definitions.
|
|
28
|
-
* @param props - Columns, data, and optional accessible labelling (`caption` or `aria-label`)
|
|
29
|
-
* @returns A styled Table rendered from the TanStack row model
|
|
30
|
-
*/
|
|
31
|
-
declare function DataTable<TData>({ columns, data, caption, "aria-label": ariaLabel, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
32
|
-
|
|
33
|
-
export { DataTable, type DataTableProps };
|
|
1
|
+
export { DataTable_alias_1 as DataTable } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { DataTableProps_alias_1 as DataTableProps } from './_tsup-dts-rollup.js';
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface DatePickerProps {
|
|
4
|
-
/** Controlled selected date. */
|
|
5
|
-
value?: Date;
|
|
6
|
-
/** Fired when the user picks a date in the calendar. */
|
|
7
|
-
onChange?: (date: Date | undefined) => void;
|
|
8
|
-
/** Placeholder shown when no date is selected. */
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
/** date-fns format string for the trigger label. */
|
|
11
|
-
dateFormat?: string;
|
|
12
|
-
/** Disable the trigger. */
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
/** Extra class names on the trigger button. */
|
|
15
|
-
className?: string;
|
|
16
|
-
/** Accessible label for the trigger (required when no visible label is adjacent). */
|
|
17
|
-
"aria-label"?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Caption layout forwarded to react-day-picker. Use `"dropdown"` (or
|
|
20
|
-
* `"dropdown-years"` / `"dropdown-months"`) to render native `<select>`
|
|
21
|
-
* navigation — useful for birth-date pickers and far-out years.
|
|
22
|
-
*
|
|
23
|
-
* Always pair `dropdown` layouts with explicit `startMonth` and `endMonth`;
|
|
24
|
-
* the RDP default span is ±100 years.
|
|
25
|
-
*/
|
|
26
|
-
captionLayout?: "label" | "dropdown" | "dropdown-months" | "dropdown-years";
|
|
27
|
-
/** Earliest month/year navigable in the calendar. Forwarded to react-day-picker. */
|
|
28
|
-
startMonth?: Date;
|
|
29
|
-
/** Latest month/year navigable in the calendar. Forwarded to react-day-picker. */
|
|
30
|
-
endMonth?: Date;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Date picker composed from Popover + Calendar + a styled trigger button.
|
|
34
|
-
*
|
|
35
|
-
* This is a minimal single-date picker. For multi/range, compose Calendar + Popover yourself.
|
|
36
|
-
* @returns A button that opens a single-date calendar popover.
|
|
37
|
-
*/
|
|
38
|
-
declare function DatePicker({ value, onChange, placeholder, dateFormat, disabled, className, "aria-label": ariaLabel, captionLayout, startMonth, endMonth, }: DatePickerProps): react_jsx_runtime.JSX.Element;
|
|
39
|
-
declare namespace DatePicker {
|
|
40
|
-
var displayName: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { DatePicker, type DatePickerProps };
|
|
1
|
+
export { DatePicker_alias_1 as DatePicker } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { DatePickerProps_alias_1 as DatePickerProps } from './_tsup-dts-rollup.js';
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
-
/** Dimmed backdrop rendered behind the dialog content. */
|
|
14
|
-
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
16
|
-
/**
|
|
17
|
-
* When `true` (the default), DialogContent caps its height at viewport-2rem
|
|
18
|
-
* and renders children inside a padded inner scroll container. The Close
|
|
19
|
-
* button stays anchored to the (non-scrolling) outer panel so it remains
|
|
20
|
-
* visible even when the user scrolls long content.
|
|
21
|
-
*
|
|
22
|
-
* Pass `scrollable={false}` to opt out — useful when the consumer manages
|
|
23
|
-
* its own scroll surface (e.g. CommandDialog defers scroll to cmdk's
|
|
24
|
-
* internal CommandList).
|
|
25
|
-
*/
|
|
26
|
-
scrollable?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/** The dialog content panel, centered on the overlay. Includes a close button by default. */
|
|
29
|
-
declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Header container inside DialogContent; stacks title and description.
|
|
33
|
-
* @returns A div wrapping title/description with vertical rhythm
|
|
34
|
-
*/
|
|
35
|
-
declare function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Footer container inside DialogContent; aligns action buttons.
|
|
38
|
-
* @returns A div that stacks buttons on mobile and right-aligns on desktop
|
|
39
|
-
*/
|
|
40
|
-
declare function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
41
|
-
/** Accessible dialog title; Radix wires it to aria-labelledby automatically. */
|
|
42
|
-
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
43
|
-
/** Accessible dialog description; Radix wires it to aria-describedby automatically. */
|
|
44
|
-
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
45
|
-
|
|
46
|
-
export { Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
1
|
+
export { DialogContentProps } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { Dialog_alias_1 as Dialog } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { DialogPortal_alias_1 as DialogPortal } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { DialogOverlay_alias_1 as DialogOverlay } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { DialogTrigger_alias_1 as DialogTrigger } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { DialogClose_alias_1 as DialogClose } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { DialogContent_alias_1 as DialogContent } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { DialogHeader_alias_1 as DialogHeader } from './_tsup-dts-rollup.js';
|
|
9
|
+
export { DialogFooter_alias_1 as DialogFooter } from './_tsup-dts-rollup.js';
|
|
10
|
+
export { DialogTitle_alias_1 as DialogTitle } from './_tsup-dts-rollup.js';
|
|
11
|
+
export { DialogDescription_alias_1 as DialogDescription } from './_tsup-dts-rollup.js';
|
package/dist/drawer.d.ts
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
declare function Drawer({ shouldScaleBackground, ...props }: DrawerRootProps): react_jsx_runtime.JSX.Element;
|
|
13
|
-
declare namespace Drawer {
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
|
-
/** The element that opens the drawer when clicked. */
|
|
17
|
-
declare const DrawerTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
-
/** Portals drawer overlay and content into the body. */
|
|
19
|
-
declare const DrawerPortal: typeof vaul.Portal;
|
|
20
|
-
/** Closes the drawer when rendered inside DrawerContent. */
|
|
21
|
-
declare const DrawerClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
-
/** Dimmed backdrop behind the drawer content. */
|
|
23
|
-
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
-
/** The drawer content panel. Slides up from the bottom and can be dragged down to dismiss. */
|
|
25
|
-
declare const DrawerContent: React.ForwardRefExoticComponent<Omit<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
-
/**
|
|
27
|
-
* Header container inside DrawerContent; stacks title and description.
|
|
28
|
-
* @returns A div with vertical rhythm.
|
|
29
|
-
*/
|
|
30
|
-
declare function DrawerHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
31
|
-
/**
|
|
32
|
-
* Footer container inside DrawerContent; stacks action buttons.
|
|
33
|
-
* @returns A div that stacks buttons vertically with consistent gutters.
|
|
34
|
-
*/
|
|
35
|
-
declare function DrawerFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
36
|
-
/** Accessible drawer title; vaul wires it to aria-labelledby automatically. */
|
|
37
|
-
declare const DrawerTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
38
|
-
/** Accessible drawer description; vaul wires it to aria-describedby automatically. */
|
|
39
|
-
declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
40
|
-
|
|
41
|
-
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger };
|
|
1
|
+
export { Drawer_alias_1 as Drawer } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { DrawerPortal_alias_1 as DrawerPortal } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { DrawerOverlay_alias_1 as DrawerOverlay } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { DrawerTrigger_alias_1 as DrawerTrigger } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { DrawerClose_alias_1 as DrawerClose } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { DrawerContent_alias_1 as DrawerContent } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { DrawerHeader_alias_1 as DrawerHeader } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { DrawerFooter_alias_1 as DrawerFooter } from './_tsup-dts-rollup.js';
|
|
9
|
+
export { DrawerTitle_alias_1 as DrawerTitle } from './_tsup-dts-rollup.js';
|
|
10
|
+
export { DrawerDescription_alias_1 as DrawerDescription } from './_tsup-dts-rollup.js';
|
package/dist/dropdown-menu.d.ts
CHANGED
|
@@ -1,39 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
15
|
-
/** Group for checkable radio items (one selected at a time). */
|
|
16
|
-
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
/** The visible dropdown panel. */
|
|
18
|
-
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
-
/** A clickable menu item. */
|
|
20
|
-
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
21
|
-
inset?: boolean;
|
|
22
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
-
/** A menu item with a checkbox state. */
|
|
24
|
-
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
/** A menu item in a radio group. */
|
|
26
|
-
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
/** A non-interactive section heading inside the menu. */
|
|
28
|
-
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
29
|
-
inset?: boolean;
|
|
30
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
/** Horizontal divider between menu items. */
|
|
32
|
-
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
-
/**
|
|
34
|
-
* Right-aligned shortcut text (e.g. ⌘K) shown next to a menu item.
|
|
35
|
-
* @returns A span with muted, tracked typography
|
|
36
|
-
*/
|
|
37
|
-
declare function DropdownMenuShortcut({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
38
|
-
|
|
39
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger };
|
|
1
|
+
export { DropdownMenu_alias_1 as DropdownMenu } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { DropdownMenuTrigger_alias_1 as DropdownMenuTrigger } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { DropdownMenuContent_alias_1 as DropdownMenuContent } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { DropdownMenuItem_alias_1 as DropdownMenuItem } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { DropdownMenuCheckboxItem_alias_1 as DropdownMenuCheckboxItem } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { DropdownMenuRadioItem_alias_1 as DropdownMenuRadioItem } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { DropdownMenuLabel_alias_1 as DropdownMenuLabel } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { DropdownMenuSeparator_alias_1 as DropdownMenuSeparator } from './_tsup-dts-rollup.js';
|
|
9
|
+
export { DropdownMenuShortcut_alias_1 as DropdownMenuShortcut } from './_tsup-dts-rollup.js';
|
|
10
|
+
export { DropdownMenuGroup_alias_1 as DropdownMenuGroup } from './_tsup-dts-rollup.js';
|
|
11
|
+
export { DropdownMenuPortal_alias_1 as DropdownMenuPortal } from './_tsup-dts-rollup.js';
|
|
12
|
+
export { DropdownMenuSub_alias_1 as DropdownMenuSub } from './_tsup-dts-rollup.js';
|
|
13
|
+
export { DropdownMenuRadioGroup_alias_1 as DropdownMenuRadioGroup } from './_tsup-dts-rollup.js';
|
package/dist/dropzone.d.ts
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface DropzoneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "onDrop" | "children"> {
|
|
5
|
-
/** Fired with the accepted file list every time the user picks or drops files. */
|
|
6
|
-
onFilesSelected?: (files: File[]) => void;
|
|
7
|
-
/**
|
|
8
|
-
* Fired when files are dropped/picked but ALL of them are filtered out by
|
|
9
|
-
* `accept` / `maxSize` / `maxFiles`. Useful for surfacing "file too large"
|
|
10
|
-
* or "wrong type" toasts to the user. Receives the rejected File[].
|
|
11
|
-
*/
|
|
12
|
-
onFilesRejected?: (files: File[]) => void;
|
|
13
|
-
/** `accept` attribute forwarded to the hidden file input (e.g. "image/*", ".csv"). */
|
|
14
|
-
accept?: string;
|
|
15
|
-
/** Allow multiple files. Default true. */
|
|
16
|
-
multiple?: boolean;
|
|
17
|
-
/** Maximum total file count (after dedupe). Excess files are dropped silently — surface in your handler. */
|
|
18
|
-
maxFiles?: number;
|
|
19
|
-
/** Maximum size per file in bytes. Files over the cap are filtered before onFilesSelected fires. */
|
|
20
|
-
maxSize?: number;
|
|
21
|
-
/** Disable interaction. */
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
/** Optional render override for the dropzone body. Receives drag state. */
|
|
24
|
-
children?: React.ReactNode | ((state: DropzoneRenderState) => React.ReactNode);
|
|
25
|
-
/** Required accessible name for the drop area. */
|
|
26
|
-
"aria-label": string;
|
|
27
|
-
}
|
|
28
|
-
interface DropzoneRenderState {
|
|
29
|
-
isDragOver: boolean;
|
|
30
|
-
isDisabled: boolean;
|
|
31
|
-
openFileDialog: () => void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Drag-and-drop file input built on the native HTML5 drag-drop API plus a
|
|
35
|
-
* visually-hidden (sr-only) `<input type="file">` for screen-reader and
|
|
36
|
-
* keyboard access.
|
|
37
|
-
*
|
|
38
|
-
* Two interaction surfaces:
|
|
39
|
-
* - The visible drop area is a `role="button"` div with `tabIndex=0` and the
|
|
40
|
-
* required `aria-label`. Click, Enter, or Space proxies through to click the
|
|
41
|
-
* hidden input, opening the system file dialog.
|
|
42
|
-
* - The hidden input itself remains in the accessibility tree (sr-only, NOT
|
|
43
|
-
* `aria-hidden`) so AT-driven file pickers can find it directly.
|
|
44
|
-
*
|
|
45
|
-
* Pass `children` as a node (default placeholder) or a function receiving
|
|
46
|
-
* `{ isDragOver, isDisabled, openFileDialog }` for full layout control.
|
|
47
|
-
* @returns A drop area + hidden file input pair that yields a File[].
|
|
48
|
-
*/
|
|
49
|
-
declare function Dropzone({ onFilesSelected, onFilesRejected, accept, multiple, maxFiles, maxSize, disabled, children, className, "aria-label": ariaLabel, ...rest }: DropzoneProps): react_jsx_runtime.JSX.Element;
|
|
50
|
-
declare namespace Dropzone {
|
|
51
|
-
var displayName: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { Dropzone, type DropzoneProps, type DropzoneRenderState };
|
|
1
|
+
export { Dropzone_alias_1 as Dropzone } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { DropzoneProps_alias_1 as DropzoneProps } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { DropzoneRenderState_alias_1 as DropzoneRenderState } from './_tsup-dts-rollup.js';
|
package/dist/dropzone.js
CHANGED
|
@@ -121,31 +121,31 @@ function Dropzone({
|
|
|
121
121
|
isDisabled: disabled,
|
|
122
122
|
openFileDialog
|
|
123
123
|
};
|
|
124
|
-
return /* @__PURE__ */ jsxs(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
typeof children === "function" ? children(renderState) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
124
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
role: "button",
|
|
129
|
+
tabIndex: disabled ? -1 : 0,
|
|
130
|
+
"aria-label": ariaLabel,
|
|
131
|
+
"aria-disabled": disabled || void 0,
|
|
132
|
+
"data-drag-over": isDragOver || void 0,
|
|
133
|
+
onClick: openFileDialog,
|
|
134
|
+
onKeyDown: handleKeyDown,
|
|
135
|
+
onDragEnter: handleDragEnter,
|
|
136
|
+
onDragOver: handleDragOver,
|
|
137
|
+
onDragLeave: handleDragLeave,
|
|
138
|
+
onDrop: handleDrop,
|
|
139
|
+
className: cn(
|
|
140
|
+
"flex w-full cursor-pointer select-none flex-col items-center justify-center gap-[var(--space-2,0.5rem)] rounded-md border-2 border-dashed border-input bg-background px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)] text-center text-sm transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
141
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
142
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
143
|
+
isDragOver && "border-primary bg-accent text-accent-foreground",
|
|
144
|
+
disabled && "pointer-events-none opacity-50",
|
|
145
|
+
className
|
|
146
|
+
),
|
|
147
|
+
...rest,
|
|
148
|
+
children: typeof children === "function" ? children(renderState) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
149
149
|
/* @__PURE__ */ jsxs(
|
|
150
150
|
"svg",
|
|
151
151
|
{
|
|
@@ -167,25 +167,27 @@ function Dropzone({
|
|
|
167
167
|
),
|
|
168
168
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: isDragOver ? "Drop files to upload" : "Drag files here or click to browse" }),
|
|
169
169
|
accept ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: accept }) : null
|
|
170
|
-
] })
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
170
|
+
] })
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
"input",
|
|
175
|
+
{
|
|
176
|
+
ref: inputRef,
|
|
177
|
+
type: "file",
|
|
178
|
+
accept,
|
|
179
|
+
multiple,
|
|
180
|
+
disabled,
|
|
181
|
+
"aria-hidden": "true",
|
|
182
|
+
tabIndex: -1,
|
|
183
|
+
className: "sr-only",
|
|
184
|
+
onChange: (e) => {
|
|
185
|
+
emit(e.target.files);
|
|
186
|
+
e.target.value = "";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
189
191
|
}
|
|
190
192
|
Dropzone.displayName = "Dropzone";
|
|
191
193
|
|
package/dist/dropzone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/utils.ts","../src/components/dropzone/dropzone.tsx"],"names":[],"mappings":";;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;AC+BA,SAAS,YACR,KAAA,EACA,EAAE,MAAA,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AA,EACL,CAAA;AAAA,wBAEH,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACA,GAAA,EAAK,QAAA;AAAA,YACL,IAAA,EAAK,MAAA;AAAA,YACL,MAAA;AAAA,YACA,QAAA;AAAA,YACA,QAAA;AAAA,YACA,SAAA,EAAU,SAAA;AAAA,YAMV,QAAA,EAAU,CAAC,CAAA,KAAM;AAChB,cAAA,IAAA,CAAK,CAAA,CAAE,OAAO,KAAK,CAAA;AAEnB,cAAA,CAAA,CAAE,OAAO,KAAA,GAAQ,EAAA;AAAA,YAClB;AAAA;AAAA;AACD;AAAA;AAAA,GACD;AAEF;AACA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"dropzone.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\ninterface DropzoneProps\n\textends Omit<\n\t\tReact.HTMLAttributes<HTMLDivElement>,\n\t\t\"onChange\" | \"onDrop\" | \"children\"\n\t> {\n\t/** Fired with the accepted file list every time the user picks or drops files. */\n\tonFilesSelected?: (files: File[]) => void;\n\t/**\n\t * Fired when files are dropped/picked but ALL of them are filtered out by\n\t * `accept` / `maxSize` / `maxFiles`. Useful for surfacing \"file too large\"\n\t * or \"wrong type\" toasts to the user. Receives the rejected File[].\n\t */\n\tonFilesRejected?: (files: File[]) => void;\n\t/** `accept` attribute forwarded to the hidden file input (e.g. \"image/*\", \".csv\"). */\n\taccept?: string;\n\t/** Allow multiple files. Default true. */\n\tmultiple?: boolean;\n\t/** Maximum total file count (after dedupe). Excess files are dropped silently — surface in your handler. */\n\tmaxFiles?: number;\n\t/** Maximum size per file in bytes. Files over the cap are filtered before onFilesSelected fires. */\n\tmaxSize?: number;\n\t/** Disable interaction. */\n\tdisabled?: boolean;\n\t/** Optional render override for the dropzone body. Receives drag state. */\n\tchildren?: React.ReactNode | ((state: DropzoneRenderState) => React.ReactNode);\n\t/** Required accessible name for the drop area. */\n\t\"aria-label\": string;\n}\n\ninterface DropzoneRenderState {\n\tisDragOver: boolean;\n\tisDisabled: boolean;\n\topenFileDialog: () => void;\n}\n\n/** Apply `accept` / `maxSize` / `maxFiles` filters before emitting to onFilesSelected. */\nfunction filterFiles(\n\tfiles: FileList | File[],\n\t{ accept, maxSize, maxFiles }: { accept?: string; maxSize?: number; maxFiles?: number },\n): File[] {\n\tconst list = Array.from(files);\n\tconst acceptList = accept\n\t\t? accept\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter(Boolean)\n\t\t: undefined;\n\n\tconst matchAccept = (file: File): boolean => {\n\t\tif (!acceptList) return true;\n\t\treturn acceptList.some((entry) => {\n\t\t\tif (entry.startsWith(\".\")) {\n\t\t\t\treturn file.name.toLowerCase().endsWith(entry.toLowerCase());\n\t\t\t}\n\t\t\tif (entry.endsWith(\"/*\")) {\n\t\t\t\tconst prefix = entry.slice(0, -1); // \"image/\"\n\t\t\t\treturn file.type.startsWith(prefix);\n\t\t\t}\n\t\t\treturn file.type === entry;\n\t\t});\n\t};\n\n\tconst sized =\n\t\ttypeof maxSize === \"number\" ? list.filter((f) => f.size <= maxSize) : list;\n\tconst accepted = sized.filter(matchAccept);\n\tif (typeof maxFiles === \"number\") return accepted.slice(0, maxFiles);\n\treturn accepted;\n}\n\n/**\n * Drag-and-drop file input built on the native HTML5 drag-drop API plus a\n * visually-hidden (sr-only) `<input type=\"file\">` for screen-reader and\n * keyboard access.\n *\n * Two interaction surfaces:\n * - The visible drop area is a `role=\"button\"` div with `tabIndex=0` and the\n * required `aria-label`. Click, Enter, or Space proxies through to click the\n * hidden input, opening the system file dialog.\n * - The hidden input itself remains in the accessibility tree (sr-only, NOT\n * `aria-hidden`) so AT-driven file pickers can find it directly.\n *\n * Pass `children` as a node (default placeholder) or a function receiving\n * `{ isDragOver, isDisabled, openFileDialog }` for full layout control.\n * @returns A drop area + hidden file input pair that yields a File[].\n */\nfunction Dropzone({\n\tonFilesSelected,\n\tonFilesRejected,\n\taccept,\n\tmultiple = true,\n\tmaxFiles,\n\tmaxSize,\n\tdisabled = false,\n\tchildren,\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t...rest\n}: DropzoneProps) {\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\tconst [isDragOver, setIsDragOver] = React.useState(false);\n\tconst dragCounter = React.useRef(0);\n\n\tconst emit = React.useCallback(\n\t\t(files: FileList | File[] | null | undefined) => {\n\t\t\tif (!files || disabled) return;\n\t\t\tconst all = Array.from(files);\n\t\t\tif (all.length === 0) return;\n\t\t\tconst accepted = filterFiles(all, { accept, maxSize, maxFiles });\n\t\t\tif (accepted.length === 0) {\n\t\t\t\tonFilesRejected?.(all);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst finalAccepted = !multiple ? accepted.slice(0, 1) : accepted;\n\t\t\tconst rejected = all.filter((f) => !finalAccepted.includes(f));\n\t\t\tonFilesSelected?.(finalAccepted);\n\t\t\tif (rejected.length > 0) onFilesRejected?.(rejected);\n\t\t},\n\t\t[\n\t\t\taccept,\n\t\t\tdisabled,\n\t\t\tmaxFiles,\n\t\t\tmaxSize,\n\t\t\tmultiple,\n\t\t\tonFilesSelected,\n\t\t\tonFilesRejected,\n\t\t],\n\t);\n\n\t/*\n\t * Reset the drag counter + isDragOver when the user cancels a drag outside\n\t * the dropzone (Esc, drag off the page, switch tab). Without this, the\n\t * counter can stay >0 and the dropzone gets stuck in its hover style.\n\t */\n\tReact.useEffect(() => {\n\t\tconst reset = () => {\n\t\t\tdragCounter.current = 0;\n\t\t\tsetIsDragOver(false);\n\t\t};\n\t\twindow.addEventListener(\"dragend\", reset);\n\t\twindow.addEventListener(\"drop\", reset);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"dragend\", reset);\n\t\t\twindow.removeEventListener(\"drop\", reset);\n\t\t};\n\t}, []);\n\n\tconst openFileDialog = React.useCallback(() => {\n\t\tif (disabled) return;\n\t\tinputRef.current?.click();\n\t}, [disabled]);\n\n\tconst handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current += 1;\n\t\tif (e.dataTransfer.types.includes(\"Files\")) setIsDragOver(true);\n\t};\n\tconst handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\te.dataTransfer.dropEffect = \"copy\";\n\t};\n\tconst handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current = Math.max(0, dragCounter.current - 1);\n\t\tif (dragCounter.current === 0) setIsDragOver(false);\n\t};\n\tconst handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current = 0;\n\t\tsetIsDragOver(false);\n\t\temit(e.dataTransfer.files);\n\t};\n\tconst handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\te.preventDefault();\n\t\t\topenFileDialog();\n\t\t}\n\t};\n\n\tconst renderState: DropzoneRenderState = {\n\t\tisDragOver,\n\t\tisDisabled: disabled,\n\t\topenFileDialog,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\trole=\"button\"\n\t\t\ttabIndex={disabled ? -1 : 0}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-disabled={disabled || undefined}\n\t\t\tdata-drag-over={isDragOver || undefined}\n\t\t\tonClick={openFileDialog}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonDragEnter={handleDragEnter}\n\t\t\tonDragOver={handleDragOver}\n\t\t\tonDragLeave={handleDragLeave}\n\t\t\tonDrop={handleDrop}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex w-full cursor-pointer select-none flex-col items-center justify-center gap-[var(--space-2,0.5rem)] rounded-md border-2 border-dashed border-input bg-background px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)] text-center text-sm transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\t\t\"hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\tisDragOver && \"border-primary bg-accent text-accent-foreground\",\n\t\t\t\tdisabled && \"pointer-events-none opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{typeof children === \"function\"\n\t\t\t\t? children(renderState)\n\t\t\t\t: (children ?? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\t\tclassName=\"h-6 w-6 text-muted-foreground\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n\t\t\t\t\t\t\t\t<polyline points=\"17 8 12 3 7 8\" />\n\t\t\t\t\t\t\t\t<line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\" />\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t<span className=\"font-medium\">\n\t\t\t\t\t\t\t\t{isDragOver ? \"Drop files to upload\" : \"Drag files here or click to browse\"}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{accept ? (\n\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">{accept}</span>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</>\n\t\t\t\t\t))}\n\t\t\t<input\n\t\t\t\tref={inputRef}\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept={accept}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tclassName=\"sr-only\"\n\t\t\t\t/*\n\t\t\t\t * Intentionally NOT aria-hidden + NOT tabIndex=-1: the input\n\t\t\t\t * stays in the a11y tree so AT-driven file pickers (NVDA's\n\t\t\t\t * forms mode, JAWS) can find it. Visually hidden via sr-only.\n\t\t\t\t */\n\t\t\t\tonChange={(e) => {\n\t\t\t\t\temit(e.target.files);\n\t\t\t\t\t// Reset so picking the same file twice still fires onChange\n\t\t\t\t\te.target.value = \"\";\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n}\nDropzone.displayName = \"Dropzone\";\n\nexport { Dropzone };\nexport type { DropzoneProps, DropzoneRenderState };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/components/dropzone/dropzone.tsx"],"names":[],"mappings":";;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;AC+BA,SAAS,YACR,KAAA,EACA,EAAE,MAAA,EAAQ,OAAA,EAAS,UAAS,EACnB;AACT,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,IAAA,CAAK,KAAK,CAAA;AAC7B,EAAA,MAAM,UAAA,GAAa,MAAA,GAChB,MAAA,CACC,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,IAAA,EAAM,CAAA,CACnB,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MAAA;AAAA,QACZ,QAAA,EAAU,EAAA;AAAA,QACV,SAAA,EAAU,SAAA;AAAA,QACV,QAAA,EAAU,CAAC,CAAA,KAAM;AAChB,UAAA,IAAA,CAAK,CAAA,CAAE,OAAO,KAAK,CAAA;AAEnB,UAAA,CAAA,CAAE,OAAO,KAAA,GAAQ,EAAA;AAAA,QAClB;AAAA;AAAA;AACD,GAAA,EACD,CAAA;AAEF;AACA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"dropzone.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\ninterface DropzoneProps\n\textends Omit<\n\t\tReact.HTMLAttributes<HTMLDivElement>,\n\t\t\"onChange\" | \"onDrop\" | \"children\"\n\t> {\n\t/** Fired with the accepted file list every time the user picks or drops files. */\n\tonFilesSelected?: (files: File[]) => void;\n\t/**\n\t * Fired when files are dropped/picked but ALL of them are filtered out by\n\t * `accept` / `maxSize` / `maxFiles`. Useful for surfacing \"file too large\"\n\t * or \"wrong type\" toasts to the user. Receives the rejected File[].\n\t */\n\tonFilesRejected?: (files: File[]) => void;\n\t/** `accept` attribute forwarded to the hidden file input (e.g. \"image/*\", \".csv\"). */\n\taccept?: string;\n\t/** Allow multiple files. Default true. */\n\tmultiple?: boolean;\n\t/** Maximum total file count (after dedupe). Excess files are dropped silently — surface in your handler. */\n\tmaxFiles?: number;\n\t/** Maximum size per file in bytes. Files over the cap are filtered before onFilesSelected fires. */\n\tmaxSize?: number;\n\t/** Disable interaction. */\n\tdisabled?: boolean;\n\t/** Optional render override for the dropzone body. Receives drag state. */\n\tchildren?: React.ReactNode | ((state: DropzoneRenderState) => React.ReactNode);\n\t/** Required accessible name for the drop area. */\n\t\"aria-label\": string;\n}\n\ninterface DropzoneRenderState {\n\tisDragOver: boolean;\n\tisDisabled: boolean;\n\topenFileDialog: () => void;\n}\n\n/** Apply `accept` / `maxSize` / `maxFiles` filters before emitting to onFilesSelected. */\nfunction filterFiles(\n\tfiles: FileList | File[],\n\t{ accept, maxSize, maxFiles }: { accept?: string; maxSize?: number; maxFiles?: number },\n): File[] {\n\tconst list = Array.from(files);\n\tconst acceptList = accept\n\t\t? accept\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter(Boolean)\n\t\t: undefined;\n\n\tconst matchAccept = (file: File): boolean => {\n\t\tif (!acceptList) return true;\n\t\treturn acceptList.some((entry) => {\n\t\t\tif (entry.startsWith(\".\")) {\n\t\t\t\treturn file.name.toLowerCase().endsWith(entry.toLowerCase());\n\t\t\t}\n\t\t\tif (entry.endsWith(\"/*\")) {\n\t\t\t\tconst prefix = entry.slice(0, -1); // \"image/\"\n\t\t\t\treturn file.type.startsWith(prefix);\n\t\t\t}\n\t\t\treturn file.type === entry;\n\t\t});\n\t};\n\n\tconst sized =\n\t\ttypeof maxSize === \"number\" ? list.filter((f) => f.size <= maxSize) : list;\n\tconst accepted = sized.filter(matchAccept);\n\tif (typeof maxFiles === \"number\") return accepted.slice(0, maxFiles);\n\treturn accepted;\n}\n\n/**\n * Drag-and-drop file input built on the native HTML5 drag-drop API plus a\n * visually-hidden (sr-only) `<input type=\"file\">` for screen-reader and\n * keyboard access.\n *\n * Two interaction surfaces:\n * - The visible drop area is a `role=\"button\"` div with `tabIndex=0` and the\n * required `aria-label`. Click, Enter, or Space proxies through to click the\n * hidden input, opening the system file dialog.\n * - The hidden input itself remains in the accessibility tree (sr-only, NOT\n * `aria-hidden`) so AT-driven file pickers can find it directly.\n *\n * Pass `children` as a node (default placeholder) or a function receiving\n * `{ isDragOver, isDisabled, openFileDialog }` for full layout control.\n * @returns A drop area + hidden file input pair that yields a File[].\n */\nfunction Dropzone({\n\tonFilesSelected,\n\tonFilesRejected,\n\taccept,\n\tmultiple = true,\n\tmaxFiles,\n\tmaxSize,\n\tdisabled = false,\n\tchildren,\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t...rest\n}: DropzoneProps) {\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\tconst [isDragOver, setIsDragOver] = React.useState(false);\n\tconst dragCounter = React.useRef(0);\n\n\tconst emit = React.useCallback(\n\t\t(files: FileList | File[] | null | undefined) => {\n\t\t\tif (!files || disabled) return;\n\t\t\tconst all = Array.from(files);\n\t\t\tif (all.length === 0) return;\n\t\t\tconst accepted = filterFiles(all, { accept, maxSize, maxFiles });\n\t\t\tif (accepted.length === 0) {\n\t\t\t\tonFilesRejected?.(all);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst finalAccepted = !multiple ? accepted.slice(0, 1) : accepted;\n\t\t\tconst rejected = all.filter((f) => !finalAccepted.includes(f));\n\t\t\tonFilesSelected?.(finalAccepted);\n\t\t\tif (rejected.length > 0) onFilesRejected?.(rejected);\n\t\t},\n\t\t[\n\t\t\taccept,\n\t\t\tdisabled,\n\t\t\tmaxFiles,\n\t\t\tmaxSize,\n\t\t\tmultiple,\n\t\t\tonFilesSelected,\n\t\t\tonFilesRejected,\n\t\t],\n\t);\n\n\t/*\n\t * Reset the drag counter + isDragOver when the user cancels a drag outside\n\t * the dropzone (Esc, drag off the page, switch tab). Without this, the\n\t * counter can stay >0 and the dropzone gets stuck in its hover style.\n\t */\n\tReact.useEffect(() => {\n\t\tconst reset = () => {\n\t\t\tdragCounter.current = 0;\n\t\t\tsetIsDragOver(false);\n\t\t};\n\t\twindow.addEventListener(\"dragend\", reset);\n\t\twindow.addEventListener(\"drop\", reset);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"dragend\", reset);\n\t\t\twindow.removeEventListener(\"drop\", reset);\n\t\t};\n\t}, []);\n\n\tconst openFileDialog = React.useCallback(() => {\n\t\tif (disabled) return;\n\t\tinputRef.current?.click();\n\t}, [disabled]);\n\n\tconst handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current += 1;\n\t\tif (e.dataTransfer.types.includes(\"Files\")) setIsDragOver(true);\n\t};\n\tconst handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\te.dataTransfer.dropEffect = \"copy\";\n\t};\n\tconst handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current = Math.max(0, dragCounter.current - 1);\n\t\tif (dragCounter.current === 0) setIsDragOver(false);\n\t};\n\tconst handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\te.preventDefault();\n\t\tdragCounter.current = 0;\n\t\tsetIsDragOver(false);\n\t\temit(e.dataTransfer.files);\n\t};\n\tconst handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\te.preventDefault();\n\t\t\topenFileDialog();\n\t\t}\n\t};\n\n\tconst renderState: DropzoneRenderState = {\n\t\tisDragOver,\n\t\tisDisabled: disabled,\n\t\topenFileDialog,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\trole=\"button\"\n\t\t\t\ttabIndex={disabled ? -1 : 0}\n\t\t\t\taria-label={ariaLabel}\n\t\t\t\taria-disabled={disabled || undefined}\n\t\t\t\tdata-drag-over={isDragOver || undefined}\n\t\t\t\tonClick={openFileDialog}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\tonDragEnter={handleDragEnter}\n\t\t\t\tonDragOver={handleDragOver}\n\t\t\t\tonDragLeave={handleDragLeave}\n\t\t\t\tonDrop={handleDrop}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex w-full cursor-pointer select-none flex-col items-center justify-center gap-[var(--space-2,0.5rem)] rounded-md border-2 border-dashed border-input bg-background px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)] text-center text-sm transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\t\t\t\"hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\tisDragOver && \"border-primary bg-accent text-accent-foreground\",\n\t\t\t\t\tdisabled && \"pointer-events-none opacity-50\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{typeof children === \"function\"\n\t\t\t\t\t? children(renderState)\n\t\t\t\t\t: (children ?? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\t\t\tclassName=\"h-6 w-6 text-muted-foreground\"\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n\t\t\t\t\t\t\t\t\t<polyline points=\"17 8 12 3 7 8\" />\n\t\t\t\t\t\t\t\t\t<line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\" />\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t<span className=\"font-medium\">\n\t\t\t\t\t\t\t\t\t{isDragOver ? \"Drop files to upload\" : \"Drag files here or click to browse\"}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{accept ? (\n\t\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">{accept}</span>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t))}\n\t\t\t</div>\n\t\t\t{/*\n\t\t\t * Input lives OUTSIDE the role=\"button\" container to satisfy axe\n\t\t\t * nested-interactive. It is aria-hidden (outer button is the AT\n\t\t\t * surface) and clicked programmatically via inputRef.current?.click().\n\t\t\t */}\n\t\t\t<input\n\t\t\t\tref={inputRef}\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept={accept}\n\t\t\t\tmultiple={multiple}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tclassName=\"sr-only\"\n\t\t\t\tonChange={(e) => {\n\t\t\t\t\temit(e.target.files);\n\t\t\t\t\t// Reset so picking the same file twice still fires onChange\n\t\t\t\t\te.target.value = \"\";\n\t\t\t\t}}\n\t\t\t/>\n\t\t</>\n\t);\n}\nDropzone.displayName = \"Dropzone\";\n\nexport { Dropzone };\nexport type { DropzoneProps, DropzoneRenderState };\n"]}
|
package/dist/empty.d.ts
ADDED