@codefast/ui 0.3.10 → 0.3.11-canary.1
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/CHANGELOG.md +32 -0
- package/README.md +277 -167
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +5 -5
- package/dist/components/alert-dialog.d.ts +11 -11
- package/dist/components/alert-dialog.js +9 -9
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +5 -5
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/avatar.d.ts +2 -2
- package/dist/components/avatar.js +3 -3
- package/dist/components/badge.d.ts +3 -3
- package/dist/components/badge.js +7 -7
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +6 -8
- package/dist/components/button-group.d.ts +5 -5
- package/dist/components/button-group.js +8 -8
- package/dist/components/button.d.ts +6 -6
- package/dist/components/button.js +17 -17
- package/dist/components/calendar.d.ts +5 -5
- package/dist/components/calendar.js +35 -35
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +7 -7
- package/dist/components/carousel.d.ts +10 -10
- package/dist/components/carousel.js +20 -20
- package/dist/components/chart.d.ts +12 -11
- package/dist/components/chart.js +42 -42
- package/dist/components/checkbox-cards.d.ts +2 -2
- package/dist/components/checkbox-cards.js +2 -2
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/command.d.ts +4 -4
- package/dist/components/command.js +10 -10
- package/dist/components/context-menu.d.ts +4 -4
- package/dist/components/context-menu.js +10 -10
- package/dist/components/dialog.d.ts +10 -10
- package/dist/components/dialog.js +12 -12
- package/dist/components/drawer.d.ts +9 -9
- package/dist/components/drawer.js +9 -9
- package/dist/components/dropdown-menu.d.ts +4 -4
- package/dist/components/dropdown-menu.js +10 -10
- package/dist/components/empty.d.ts +9 -9
- package/dist/components/empty.js +10 -10
- package/dist/components/field.d.ts +14 -14
- package/dist/components/field.js +17 -17
- package/dist/components/form.d.ts +10 -10
- package/dist/components/form.js +8 -8
- package/dist/components/hover-card.d.ts +2 -2
- package/dist/components/hover-card.js +3 -3
- package/dist/components/input-group.d.ts +15 -15
- package/dist/components/input-group.js +20 -20
- package/dist/components/input-number.d.ts +2 -2
- package/dist/components/input-number.js +7 -7
- package/dist/components/input-otp.d.ts +6 -6
- package/dist/components/input-otp.js +4 -4
- package/dist/components/input-password.d.ts +3 -3
- package/dist/components/input-password.js +6 -6
- package/dist/components/input-search.d.ts +3 -3
- package/dist/components/input-search.js +4 -4
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +1 -1
- package/dist/components/item.d.ts +12 -12
- package/dist/components/item.js +23 -23
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +2 -2
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/menubar.d.ts +4 -4
- package/dist/components/menubar.js +13 -13
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +2 -2
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +10 -10
- package/dist/components/pagination.d.ts +10 -10
- package/dist/components/pagination.js +6 -6
- package/dist/components/popover.d.ts +3 -3
- package/dist/components/popover.js +3 -3
- package/dist/components/progress-circle.d.ts +5 -5
- package/dist/components/progress-circle.js +22 -22
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/radio-cards.d.ts +2 -2
- package/dist/components/radio-cards.js +3 -3
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +3 -3
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/radio.js +1 -1
- package/dist/components/resizable.d.ts +2 -2
- package/dist/components/resizable.js +3 -3
- package/dist/components/scroll-area.d.ts +5 -5
- package/dist/components/scroll-area.js +31 -31
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +9 -9
- package/dist/components/separator.d.ts +5 -5
- package/dist/components/separator.js +9 -9
- package/dist/components/sheet.d.ts +9 -9
- package/dist/components/sheet.js +17 -17
- package/dist/components/sidebar.d.ts +31 -31
- package/dist/components/sidebar.js +65 -65
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +4 -4
- package/dist/components/sonner.d.ts +3 -3
- package/dist/components/sonner.js +4 -4
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +5 -5
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +9 -9
- package/dist/components/table.js +8 -8
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +4 -4
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/components/toggle-group.d.ts +4 -4
- package/dist/components/toggle-group.js +5 -5
- package/dist/components/toggle.d.ts +3 -3
- package/dist/components/toggle.js +8 -8
- package/dist/components/tooltip.d.ts +3 -3
- package/dist/components/tooltip.js +2 -2
- package/dist/css/preset.css +4 -4
- package/dist/css/style.css +3 -3
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +1 -1
- package/dist/hooks/use-media-query.js +3 -3
- package/dist/hooks/use-mutation-observer.d.ts +1 -1
- package/dist/hooks/use-pagination.js +1 -1
- package/dist/index.d.ts +130 -130
- package/dist/primitives/checkbox-group.d.ts +11 -11
- package/dist/primitives/checkbox-group.js +3 -3
- package/dist/primitives/input-number.d.ts +8 -8
- package/dist/primitives/input-number.js +46 -46
- package/dist/primitives/input.d.ts +4 -4
- package/dist/primitives/input.js +7 -7
- package/dist/primitives/progress-circle.d.ts +7 -7
- package/dist/primitives/progress-circle.js +8 -8
- package/package.json +111 -189
- package/dist/components/accordion.cjs +0 -98
- package/dist/components/alert-dialog.cjs +0 -156
- package/dist/components/alert.cjs +0 -84
- package/dist/components/aspect-ratio.cjs +0 -44
- package/dist/components/avatar.cjs +0 -66
- package/dist/components/badge.cjs +0 -67
- package/dist/components/breadcrumb.cjs +0 -127
- package/dist/components/button-group.cjs +0 -87
- package/dist/components/button.cjs +0 -92
- package/dist/components/calendar.cjs +0 -151
- package/dist/components/card.cjs +0 -105
- package/dist/components/carousel.cjs +0 -211
- package/dist/components/chart.cjs +0 -251
- package/dist/components/checkbox-cards.cjs +0 -70
- package/dist/components/checkbox-group.cjs +0 -64
- package/dist/components/checkbox.cjs +0 -54
- package/dist/components/collapsible.cjs +0 -62
- package/dist/components/command.cjs +0 -168
- package/dist/components/context-menu.cjs +0 -219
- package/dist/components/dialog.cjs +0 -165
- package/dist/components/drawer.cjs +0 -144
- package/dist/components/dropdown-menu.cjs +0 -222
- package/dist/components/empty.cjs +0 -113
- package/dist/components/field.cjs +0 -194
- package/dist/components/form.cjs +0 -152
- package/dist/components/hover-card.cjs +0 -78
- package/dist/components/input-group.cjs +0 -156
- package/dist/components/input-number.cjs +0 -99
- package/dist/components/input-otp.cjs +0 -102
- package/dist/components/input-password.cjs +0 -72
- package/dist/components/input-search.cjs +0 -81
- package/dist/components/input.cjs +0 -46
- package/dist/components/item.cjs +0 -186
- package/dist/components/kbd.cjs +0 -54
- package/dist/components/label.cjs +0 -46
- package/dist/components/menubar.cjs +0 -233
- package/dist/components/native-select.cjs +0 -75
- package/dist/components/navigation-menu.cjs +0 -146
- package/dist/components/pagination.cjs +0 -138
- package/dist/components/popover.cjs +0 -87
- package/dist/components/progress-circle.cjs +0 -185
- package/dist/components/progress.cjs +0 -53
- package/dist/components/radio-cards.cjs +0 -67
- package/dist/components/radio-group.cjs +0 -60
- package/dist/components/radio.cjs +0 -48
- package/dist/components/resizable.cjs +0 -72
- package/dist/components/scroll-area.cjs +0 -141
- package/dist/components/select.cjs +0 -181
- package/dist/components/separator.cjs +0 -83
- package/dist/components/sheet.cjs +0 -185
- package/dist/components/sidebar.cjs +0 -507
- package/dist/components/skeleton.cjs +0 -44
- package/dist/components/slider.cjs +0 -80
- package/dist/components/sonner.cjs +0 -58
- package/dist/components/spinner.cjs +0 -76
- package/dist/components/switch.cjs +0 -50
- package/dist/components/table.cjs +0 -118
- package/dist/components/tabs.cjs +0 -76
- package/dist/components/textarea.cjs +0 -44
- package/dist/components/toggle-group.cjs +0 -91
- package/dist/components/toggle.cjs +0 -72
- package/dist/components/tooltip.cjs +0 -91
- package/dist/hooks/use-animated-value.cjs +0 -75
- package/dist/hooks/use-copy-to-clipboard.cjs +0 -58
- package/dist/hooks/use-is-mobile.cjs +0 -40
- package/dist/hooks/use-media-query.cjs +0 -57
- package/dist/hooks/use-mutation-observer.cjs +0 -57
- package/dist/hooks/use-pagination.cjs +0 -93
- package/dist/index.cjs +0 -1081
- package/dist/primitives/checkbox-group.cjs +0 -151
- package/dist/primitives/input-number.cjs +0 -439
- package/dist/primitives/input.cjs +0 -99
- package/dist/primitives/progress-circle.cjs +0 -199
package/dist/components/sheet.js
CHANGED
|
@@ -5,16 +5,16 @@ import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } fr
|
|
|
5
5
|
import { XIcon } from "lucide-react";
|
|
6
6
|
import { buttonVariants } from "./button.js";
|
|
7
7
|
const sheetContentVariants = tv({
|
|
8
|
-
base:
|
|
8
|
+
base: "fixed z-50 flex flex-col overflow-auto bg-background shadow-lg ease-ui data-[state=closed]:animate-out data-[state=closed]:animation-duration-500 data-[state=open]:animate-in data-[state=open]:animation-duration-500",
|
|
9
9
|
defaultVariants: {
|
|
10
|
-
side:
|
|
10
|
+
side: "right"
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
13
13
|
side: {
|
|
14
|
-
bottom:
|
|
15
|
-
left:
|
|
16
|
-
right:
|
|
17
|
-
top:
|
|
14
|
+
bottom: "inset-x-0 bottom-0 max-h-[80vh] border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
15
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
16
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
17
|
+
top: "inset-x-0 top-0 max-h-[80vh] border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -31,11 +31,11 @@ function SheetTrigger({ ...props }) {
|
|
|
31
31
|
...props
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function SheetContent({ children, className, classNames, side =
|
|
34
|
+
function SheetContent({ children, className, classNames, side = "right", ...props }) {
|
|
35
35
|
return /*#__PURE__*/ jsxs(Portal, {
|
|
36
36
|
children: [
|
|
37
37
|
/*#__PURE__*/ jsx(Overlay, {
|
|
38
|
-
className: cn(
|
|
38
|
+
className: cn("fixed inset-0 z-50 bg-black/50 ease-ui data-[state=closed]:animate-out data-[state=closed]:animation-duration-500 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:animation-duration-500 data-[state=open]:fade-in-0", classNames?.overlay),
|
|
39
39
|
"data-slot": "sheet-overlay"
|
|
40
40
|
}),
|
|
41
41
|
/*#__PURE__*/ jsxs(Content, {
|
|
@@ -53,11 +53,11 @@ function SheetContent({ children, className, classNames, side = 'right', ...prop
|
|
|
53
53
|
/*#__PURE__*/ jsxs(Close, {
|
|
54
54
|
className: buttonVariants({
|
|
55
55
|
className: [
|
|
56
|
-
|
|
56
|
+
"absolute top-4 right-4 size-7",
|
|
57
57
|
classNames?.close
|
|
58
58
|
],
|
|
59
|
-
size:
|
|
60
|
-
variant:
|
|
59
|
+
size: "icon",
|
|
60
|
+
variant: "ghost"
|
|
61
61
|
}),
|
|
62
62
|
"data-slot": "sheet-close",
|
|
63
63
|
children: [
|
|
@@ -77,40 +77,40 @@ function SheetContent({ children, className, classNames, side = 'right', ...prop
|
|
|
77
77
|
}
|
|
78
78
|
function SheetHeader({ className, ...props }) {
|
|
79
79
|
return /*#__PURE__*/ jsx("header", {
|
|
80
|
-
className: cn(
|
|
80
|
+
className: cn("flex shrink-0 flex-col gap-1.5 px-6 pt-6 pb-4 text-center sm:text-left", className),
|
|
81
81
|
"data-slot": "sheet-header",
|
|
82
82
|
...props
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
function SheetBody({ className, ...props }) {
|
|
86
86
|
return /*#__PURE__*/ jsx("main", {
|
|
87
|
-
className: cn(
|
|
87
|
+
className: cn("px-6 py-2", className),
|
|
88
88
|
"data-slot": "sheet-body",
|
|
89
89
|
...props
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
function SheetFooter({ className, ...props }) {
|
|
93
93
|
return /*#__PURE__*/ jsx("footer", {
|
|
94
|
-
className: cn(
|
|
94
|
+
className: cn("flex shrink-0 flex-col-reverse gap-2 px-6 pt-4 pb-6 sm:flex-row sm:justify-end", className),
|
|
95
95
|
"data-slot": "sheet-footer",
|
|
96
96
|
...props
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
function SheetTitle({ className, ...props }) {
|
|
100
100
|
return /*#__PURE__*/ jsx(Title, {
|
|
101
|
-
className: cn(
|
|
101
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
102
102
|
"data-slot": "sheet-title",
|
|
103
103
|
...props
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
function SheetDescription({ className, ...props }) {
|
|
107
107
|
return /*#__PURE__*/ jsx(Description, {
|
|
108
|
-
className: cn(
|
|
108
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
109
109
|
"data-slot": "sheet-description",
|
|
110
110
|
...props
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
function SheetClose({ className, size, variant =
|
|
113
|
+
function SheetClose({ className, size, variant = "outline", ...props }) {
|
|
114
114
|
return /*#__PURE__*/ jsx(Close, {
|
|
115
115
|
className: buttonVariants({
|
|
116
116
|
className,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { VariantProps } from
|
|
2
|
-
import type { ComponentProps, Dispatch, JSX, SetStateAction } from
|
|
3
|
-
import { Button } from
|
|
4
|
-
import { Input } from
|
|
5
|
-
import { Separator } from
|
|
6
|
-
import { TooltipContent } from
|
|
1
|
+
import type { VariantProps } from "@codefast/tailwind-variants";
|
|
2
|
+
import type { ComponentProps, Dispatch, JSX, SetStateAction } from "react";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
import { Input } from "./input";
|
|
5
|
+
import { Separator } from "./separator";
|
|
6
|
+
import { TooltipContent } from "./tooltip";
|
|
7
7
|
declare const sidebarMenuButtonVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
8
8
|
size: {
|
|
9
9
|
sm: string;
|
|
@@ -21,79 +21,79 @@ interface SidebarContextValue {
|
|
|
21
21
|
openMobile: boolean;
|
|
22
22
|
setOpen: (open: boolean) => void;
|
|
23
23
|
setOpenMobile: Dispatch<SetStateAction<boolean>>;
|
|
24
|
-
state:
|
|
24
|
+
state: "collapsed" | "expanded";
|
|
25
25
|
toggleSidebar: () => void;
|
|
26
26
|
}
|
|
27
27
|
declare const useSidebar: (consumerName: string) => SidebarContextValue;
|
|
28
|
-
interface SidebarProviderProps extends ComponentProps<
|
|
28
|
+
interface SidebarProviderProps extends ComponentProps<"div"> {
|
|
29
29
|
defaultOpen?: boolean;
|
|
30
30
|
onOpenChange?: (open: boolean) => void;
|
|
31
31
|
open?: boolean;
|
|
32
32
|
}
|
|
33
33
|
declare function SidebarProvider({ children, className, defaultOpen, onOpenChange: setOpenProperty, open: openProperty, style, ...props }: SidebarProviderProps): JSX.Element;
|
|
34
|
-
interface SidebarProps extends ComponentProps<
|
|
35
|
-
collapsible?:
|
|
36
|
-
side?:
|
|
37
|
-
variant?:
|
|
34
|
+
interface SidebarProps extends ComponentProps<"div"> {
|
|
35
|
+
collapsible?: "icon" | "none" | "offcanvas";
|
|
36
|
+
side?: "left" | "right";
|
|
37
|
+
variant?: "floating" | "inset" | "sidebar";
|
|
38
38
|
}
|
|
39
39
|
declare function Sidebar({ children, className, collapsible, side, variant, ...props }: SidebarProps): JSX.Element;
|
|
40
40
|
type SidebarTriggerProps = ComponentProps<typeof Button>;
|
|
41
41
|
declare function SidebarTrigger({ className, onClick, ...props }: SidebarTriggerProps): JSX.Element;
|
|
42
|
-
type SidebarRailProps = ComponentProps<
|
|
42
|
+
type SidebarRailProps = ComponentProps<"button">;
|
|
43
43
|
declare function SidebarRail({ className, ...props }: SidebarRailProps): JSX.Element;
|
|
44
|
-
type SidebarInsetProps = ComponentProps<
|
|
44
|
+
type SidebarInsetProps = ComponentProps<"main">;
|
|
45
45
|
declare function SidebarInset({ className, ...props }: SidebarInsetProps): JSX.Element;
|
|
46
46
|
type SidebarInputProps = ComponentProps<typeof Input>;
|
|
47
47
|
declare function SidebarInput({ className, ...props }: SidebarInputProps): JSX.Element;
|
|
48
|
-
type SidebarHeaderProps = ComponentProps<
|
|
48
|
+
type SidebarHeaderProps = ComponentProps<"div">;
|
|
49
49
|
declare function SidebarHeader({ className, ...props }: SidebarHeaderProps): JSX.Element;
|
|
50
|
-
type SidebarFooterProps = ComponentProps<
|
|
50
|
+
type SidebarFooterProps = ComponentProps<"div">;
|
|
51
51
|
declare function SidebarFooter({ className, ...props }: SidebarFooterProps): JSX.Element;
|
|
52
52
|
type SidebarSeparatorProps = ComponentProps<typeof Separator>;
|
|
53
53
|
declare function SidebarSeparator({ className, ...props }: SidebarSeparatorProps): JSX.Element;
|
|
54
|
-
type SidebarContentProps = ComponentProps<
|
|
54
|
+
type SidebarContentProps = ComponentProps<"div">;
|
|
55
55
|
declare function SidebarContent({ className, ...props }: SidebarContentProps): JSX.Element;
|
|
56
|
-
type SidebarGroupProps = ComponentProps<
|
|
56
|
+
type SidebarGroupProps = ComponentProps<"div">;
|
|
57
57
|
declare function SidebarGroup({ className, ...props }: SidebarGroupProps): JSX.Element;
|
|
58
|
-
interface SidebarGroupLabelProps extends ComponentProps<
|
|
58
|
+
interface SidebarGroupLabelProps extends ComponentProps<"div"> {
|
|
59
59
|
asChild?: boolean;
|
|
60
60
|
}
|
|
61
61
|
declare function SidebarGroupLabel({ asChild, className, ...props }: SidebarGroupLabelProps): JSX.Element;
|
|
62
|
-
interface SidebarGroupActionProps extends ComponentProps<
|
|
62
|
+
interface SidebarGroupActionProps extends ComponentProps<"button"> {
|
|
63
63
|
asChild?: boolean;
|
|
64
64
|
}
|
|
65
65
|
declare function SidebarGroupAction({ asChild, className, ...props }: SidebarGroupActionProps): JSX.Element;
|
|
66
|
-
type SidebarGroupContentProps = ComponentProps<
|
|
66
|
+
type SidebarGroupContentProps = ComponentProps<"div">;
|
|
67
67
|
declare function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps): JSX.Element;
|
|
68
|
-
type SidebarMenuProps = ComponentProps<
|
|
68
|
+
type SidebarMenuProps = ComponentProps<"ul">;
|
|
69
69
|
declare function SidebarMenu({ className, ...props }: SidebarMenuProps): JSX.Element;
|
|
70
|
-
type SidebarMenuItemProps = ComponentProps<
|
|
70
|
+
type SidebarMenuItemProps = ComponentProps<"li">;
|
|
71
71
|
declare function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps): JSX.Element;
|
|
72
|
-
interface SidebarMenuButtonProps extends ComponentProps<
|
|
72
|
+
interface SidebarMenuButtonProps extends ComponentProps<"button">, VariantProps<typeof sidebarMenuButtonVariants> {
|
|
73
73
|
asChild?: boolean;
|
|
74
74
|
isActive?: boolean;
|
|
75
75
|
tooltip?: ComponentProps<typeof TooltipContent> | string;
|
|
76
76
|
}
|
|
77
77
|
declare function SidebarMenuButton({ asChild, className, isActive, size, tooltip, variant, ...props }: SidebarMenuButtonProps): JSX.Element;
|
|
78
|
-
interface SidebarMenuActionProps extends ComponentProps<
|
|
78
|
+
interface SidebarMenuActionProps extends ComponentProps<"button"> {
|
|
79
79
|
asChild?: boolean;
|
|
80
80
|
showOnHover?: boolean;
|
|
81
81
|
}
|
|
82
82
|
declare function SidebarMenuAction({ asChild, className, showOnHover, ...props }: SidebarMenuActionProps): JSX.Element;
|
|
83
|
-
type SidebarMenuBadgeProps = ComponentProps<
|
|
83
|
+
type SidebarMenuBadgeProps = ComponentProps<"div">;
|
|
84
84
|
declare function SidebarMenuBadge({ className, ...props }: SidebarMenuBadgeProps): JSX.Element;
|
|
85
|
-
interface SidebarMenuSkeletonProps extends ComponentProps<
|
|
85
|
+
interface SidebarMenuSkeletonProps extends ComponentProps<"div"> {
|
|
86
86
|
showIcon?: boolean;
|
|
87
87
|
}
|
|
88
88
|
declare function SidebarMenuSkeleton({ className, showIcon, ...props }: SidebarMenuSkeletonProps): JSX.Element;
|
|
89
|
-
type SidebarMenuSubProps = ComponentProps<
|
|
89
|
+
type SidebarMenuSubProps = ComponentProps<"ul">;
|
|
90
90
|
declare function SidebarMenuSub({ className, ...props }: SidebarMenuSubProps): JSX.Element;
|
|
91
|
-
type SidebarMenuSubItemProps = ComponentProps<
|
|
91
|
+
type SidebarMenuSubItemProps = ComponentProps<"li">;
|
|
92
92
|
declare function SidebarMenuSubItem({ className, ...props }: SidebarMenuSubItemProps): JSX.Element;
|
|
93
|
-
interface SidebarMenuSubButtonProps extends ComponentProps<
|
|
93
|
+
interface SidebarMenuSubButtonProps extends ComponentProps<"a"> {
|
|
94
94
|
asChild?: boolean;
|
|
95
95
|
isActive?: boolean;
|
|
96
|
-
size?:
|
|
96
|
+
size?: "md" | "sm";
|
|
97
97
|
}
|
|
98
98
|
declare function SidebarMenuSubButton({ asChild, className, isActive, size, ...props }: SidebarMenuSubButtonProps): JSX.Element;
|
|
99
99
|
export { sidebarMenuButtonVariants };
|
|
@@ -13,30 +13,30 @@ import { Skeleton } from "./skeleton.js";
|
|
|
13
13
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
14
14
|
import { useIsMobile } from "../hooks/use-is-mobile.js";
|
|
15
15
|
const sidebarMenuButtonVariants = tv({
|
|
16
|
-
base:
|
|
16
|
+
base: "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-3 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
17
17
|
defaultVariants: {
|
|
18
|
-
size:
|
|
19
|
-
variant:
|
|
18
|
+
size: "md",
|
|
19
|
+
variant: "default"
|
|
20
20
|
},
|
|
21
21
|
variants: {
|
|
22
22
|
size: {
|
|
23
|
-
sm:
|
|
24
|
-
md:
|
|
25
|
-
lg:
|
|
23
|
+
sm: "h-7 text-xs",
|
|
24
|
+
md: "h-8 text-sm",
|
|
25
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
26
26
|
},
|
|
27
27
|
variant: {
|
|
28
|
-
default:
|
|
29
|
-
outline:
|
|
28
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
29
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
const SIDEBAR_COOKIE_NAME =
|
|
33
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
34
34
|
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
35
|
-
const SIDEBAR_WIDTH =
|
|
36
|
-
const SIDEBAR_WIDTH_MOBILE =
|
|
37
|
-
const SIDEBAR_WIDTH_ICON =
|
|
38
|
-
const SIDEBAR_KEYBOARD_SHORTCUT =
|
|
39
|
-
const SIDEBAR_PROVIDER_NAME =
|
|
35
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
36
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
37
|
+
const SIDEBAR_WIDTH_ICON = "3.0625rem";
|
|
38
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
39
|
+
const SIDEBAR_PROVIDER_NAME = "SidebarProvider";
|
|
40
40
|
const [SidebarContextProvider, useSidebar] = createContext(SIDEBAR_PROVIDER_NAME);
|
|
41
41
|
function SidebarProvider({ children, className, defaultOpen = true, onOpenChange: setOpenProperty, open: openProperty, style, ...props }) {
|
|
42
42
|
const isMobile = useIsMobile();
|
|
@@ -44,7 +44,7 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
44
44
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
45
45
|
const open = openProperty ?? isOpen;
|
|
46
46
|
const setOpen = useCallback((value)=>{
|
|
47
|
-
const openState =
|
|
47
|
+
const openState = "function" == typeof value ? value(open) : value;
|
|
48
48
|
if (setOpenProperty) setOpenProperty(openState);
|
|
49
49
|
else setIsOpen(openState);
|
|
50
50
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState.toString()}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE.toString()}`;
|
|
@@ -66,14 +66,14 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
66
66
|
toggleSidebar();
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
window.addEventListener(
|
|
69
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
70
70
|
return ()=>{
|
|
71
|
-
window.removeEventListener(
|
|
71
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
72
72
|
};
|
|
73
73
|
}, [
|
|
74
74
|
toggleSidebar
|
|
75
75
|
]);
|
|
76
|
-
const state = open ?
|
|
76
|
+
const state = open ? "expanded" : "collapsed";
|
|
77
77
|
return /*#__PURE__*/ jsx(SidebarContextProvider, {
|
|
78
78
|
isMobile: isMobile,
|
|
79
79
|
open: open,
|
|
@@ -85,11 +85,11 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
85
85
|
children: /*#__PURE__*/ jsx(TooltipProvider, {
|
|
86
86
|
delayDuration: 0,
|
|
87
87
|
children: /*#__PURE__*/ jsx("div", {
|
|
88
|
-
className: cn(
|
|
88
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
89
89
|
"data-slot": "sidebar-wrapper",
|
|
90
90
|
style: {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
92
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
93
93
|
...style
|
|
94
94
|
},
|
|
95
95
|
...props,
|
|
@@ -98,11 +98,11 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
const SIDEBAR_NAME =
|
|
102
|
-
function Sidebar({ children, className, collapsible =
|
|
101
|
+
const SIDEBAR_NAME = "Sidebar";
|
|
102
|
+
function Sidebar({ children, className, collapsible = "offcanvas", side = "left", variant = "sidebar", ...props }) {
|
|
103
103
|
const { isMobile, openMobile, setOpenMobile, state } = useSidebar(SIDEBAR_NAME);
|
|
104
|
-
if (
|
|
105
|
-
className: cn(
|
|
104
|
+
if ("none" === collapsible) return /*#__PURE__*/ jsx("div", {
|
|
105
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
106
106
|
"data-slot": "sidebar",
|
|
107
107
|
...props,
|
|
108
108
|
children: children
|
|
@@ -112,13 +112,13 @@ function Sidebar({ children, className, collapsible = 'offcanvas', side = 'left'
|
|
|
112
112
|
onOpenChange: setOpenMobile,
|
|
113
113
|
...props,
|
|
114
114
|
children: /*#__PURE__*/ jsxs(SheetContent, {
|
|
115
|
-
className: "
|
|
115
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
116
116
|
"data-mobile": "true",
|
|
117
117
|
"data-sidebar": "sidebar",
|
|
118
118
|
"data-slot": "sidebar",
|
|
119
119
|
side: side,
|
|
120
120
|
style: {
|
|
121
|
-
|
|
121
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
122
122
|
},
|
|
123
123
|
children: [
|
|
124
124
|
/*#__PURE__*/ jsxs(SheetHeader, {
|
|
@@ -140,23 +140,23 @@ function Sidebar({ children, className, collapsible = 'offcanvas', side = 'left'
|
|
|
140
140
|
})
|
|
141
141
|
});
|
|
142
142
|
return /*#__PURE__*/ jsxs("div", {
|
|
143
|
-
className: cn(
|
|
144
|
-
"data-collapsible":
|
|
143
|
+
className: cn("group peer hidden text-sidebar-foreground md:block", className),
|
|
144
|
+
"data-collapsible": "collapsed" === state ? collapsible : "",
|
|
145
145
|
"data-side": side,
|
|
146
146
|
"data-slot": "sidebar",
|
|
147
147
|
"data-state": state,
|
|
148
148
|
"data-variant": variant,
|
|
149
149
|
children: [
|
|
150
150
|
/*#__PURE__*/ jsx("div", {
|
|
151
|
-
className: cn(
|
|
151
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180", "floating" === variant || "inset" === variant ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),
|
|
152
152
|
"data-slot": "sidebar-gap"
|
|
153
153
|
}),
|
|
154
154
|
/*#__PURE__*/ jsx("div", {
|
|
155
|
-
className: cn(
|
|
155
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", "left" === side ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", "floating" === variant || "inset" === variant ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
156
156
|
"data-slot": "sidebar-container",
|
|
157
157
|
...props,
|
|
158
158
|
children: /*#__PURE__*/ jsx("div", {
|
|
159
|
-
className: "
|
|
159
|
+
className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",
|
|
160
160
|
"data-sidebar": "sidebar",
|
|
161
161
|
"data-slot": "sidebar-inner",
|
|
162
162
|
children: children
|
|
@@ -165,11 +165,11 @@ function Sidebar({ children, className, collapsible = 'offcanvas', side = 'left'
|
|
|
165
165
|
]
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
const SIDEBAR_TRIGGER_NAME =
|
|
168
|
+
const SIDEBAR_TRIGGER_NAME = "SidebarTrigger";
|
|
169
169
|
function SidebarTrigger({ className, onClick, ...props }) {
|
|
170
170
|
const { toggleSidebar } = useSidebar(SIDEBAR_TRIGGER_NAME);
|
|
171
171
|
return /*#__PURE__*/ jsxs(Button, {
|
|
172
|
-
className: cn(
|
|
172
|
+
className: cn("size-7", className),
|
|
173
173
|
"data-sidebar": "trigger",
|
|
174
174
|
"data-slot": "sidebar-trigger",
|
|
175
175
|
size: "icon",
|
|
@@ -188,11 +188,11 @@ function SidebarTrigger({ className, onClick, ...props }) {
|
|
|
188
188
|
]
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
const SIDEBAR_RAIL_NAME =
|
|
191
|
+
const SIDEBAR_RAIL_NAME = "SidebarRail";
|
|
192
192
|
function SidebarRail({ className, ...props }) {
|
|
193
193
|
const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
|
|
194
194
|
return /*#__PURE__*/ jsx("button", {
|
|
195
|
-
className: cn(
|
|
195
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[collapsible=offcanvas]:translate-x-0 group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar hover:after:bg-sidebar-border in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize sm:flex [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", className),
|
|
196
196
|
"data-sidebar": "rail",
|
|
197
197
|
"data-slot": "sidebar-rail",
|
|
198
198
|
title: "Toggle Sidebar",
|
|
@@ -203,14 +203,14 @@ function SidebarRail({ className, ...props }) {
|
|
|
203
203
|
}
|
|
204
204
|
function SidebarInset({ className, ...props }) {
|
|
205
205
|
return /*#__PURE__*/ jsx("main", {
|
|
206
|
-
className: cn(
|
|
206
|
+
className: cn("relative flex w-full min-w-0 flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
207
207
|
"data-slot": "sidebar-inset",
|
|
208
208
|
...props
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
function SidebarInput({ className, ...props }) {
|
|
212
212
|
return /*#__PURE__*/ jsx(Input, {
|
|
213
|
-
className: cn(
|
|
213
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
214
214
|
"data-sidebar": "input",
|
|
215
215
|
"data-slot": "sidebar-input",
|
|
216
216
|
...props
|
|
@@ -218,7 +218,7 @@ function SidebarInput({ className, ...props }) {
|
|
|
218
218
|
}
|
|
219
219
|
function SidebarHeader({ className, ...props }) {
|
|
220
220
|
return /*#__PURE__*/ jsx("div", {
|
|
221
|
-
className: cn(
|
|
221
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
222
222
|
"data-sidebar": "header",
|
|
223
223
|
"data-slot": "sidebar-header",
|
|
224
224
|
...props
|
|
@@ -226,7 +226,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
226
226
|
}
|
|
227
227
|
function SidebarFooter({ className, ...props }) {
|
|
228
228
|
return /*#__PURE__*/ jsx("div", {
|
|
229
|
-
className: cn(
|
|
229
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
230
230
|
"data-sidebar": "footer",
|
|
231
231
|
"data-slot": "sidebar-footer",
|
|
232
232
|
...props
|
|
@@ -234,7 +234,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
234
234
|
}
|
|
235
235
|
function SidebarSeparator({ className, ...props }) {
|
|
236
236
|
return /*#__PURE__*/ jsx(Separator, {
|
|
237
|
-
className: cn(
|
|
237
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
238
238
|
"data-sidebar": "separator",
|
|
239
239
|
"data-slot": "sidebar-separator",
|
|
240
240
|
...props
|
|
@@ -242,7 +242,7 @@ function SidebarSeparator({ className, ...props }) {
|
|
|
242
242
|
}
|
|
243
243
|
function SidebarContent({ className, ...props }) {
|
|
244
244
|
return /*#__PURE__*/ jsx("div", {
|
|
245
|
-
className: cn(
|
|
245
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
246
246
|
"data-sidebar": "content",
|
|
247
247
|
"data-slot": "sidebar-content",
|
|
248
248
|
...props
|
|
@@ -250,25 +250,25 @@ function SidebarContent({ className, ...props }) {
|
|
|
250
250
|
}
|
|
251
251
|
function SidebarGroup({ className, ...props }) {
|
|
252
252
|
return /*#__PURE__*/ jsx("div", {
|
|
253
|
-
className: cn(
|
|
253
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
254
254
|
"data-sidebar": "group",
|
|
255
255
|
"data-slot": "sidebar-group",
|
|
256
256
|
...props
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
260
|
-
const Component = asChild ? Slot :
|
|
260
|
+
const Component = asChild ? Slot : "div";
|
|
261
261
|
return /*#__PURE__*/ jsx(Component, {
|
|
262
|
-
className: cn(
|
|
262
|
+
className: cn("flex h-8 shrink-0 items-center truncate rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-3 [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
263
263
|
"data-sidebar": "group-label",
|
|
264
264
|
"data-slot": "sidebar-group-label",
|
|
265
265
|
...props
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
269
|
-
const Component = asChild ? Slot :
|
|
269
|
+
const Component = asChild ? Slot : "button";
|
|
270
270
|
return /*#__PURE__*/ jsx(Component, {
|
|
271
|
-
className: cn(
|
|
271
|
+
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
272
272
|
"data-sidebar": "group-action",
|
|
273
273
|
"data-slot": "sidebar-group-action",
|
|
274
274
|
...props
|
|
@@ -276,7 +276,7 @@ function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
|
276
276
|
}
|
|
277
277
|
function SidebarGroupContent({ className, ...props }) {
|
|
278
278
|
return /*#__PURE__*/ jsx("div", {
|
|
279
|
-
className: cn(
|
|
279
|
+
className: cn("w-full text-sm", className),
|
|
280
280
|
"data-sidebar": "group-content",
|
|
281
281
|
"data-slot": "sidebar-group-content",
|
|
282
282
|
...props
|
|
@@ -284,7 +284,7 @@ function SidebarGroupContent({ className, ...props }) {
|
|
|
284
284
|
}
|
|
285
285
|
function SidebarMenu({ className, ...props }) {
|
|
286
286
|
return /*#__PURE__*/ jsx("ul", {
|
|
287
|
-
className: cn(
|
|
287
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
288
288
|
"data-sidebar": "menu",
|
|
289
289
|
"data-slot": "sidebar-menu",
|
|
290
290
|
...props
|
|
@@ -292,15 +292,15 @@ function SidebarMenu({ className, ...props }) {
|
|
|
292
292
|
}
|
|
293
293
|
function SidebarMenuItem({ className, ...props }) {
|
|
294
294
|
return /*#__PURE__*/ jsx("li", {
|
|
295
|
-
className: cn(
|
|
295
|
+
className: cn("group/menu-item relative", className),
|
|
296
296
|
"data-sidebar": "menu-item",
|
|
297
297
|
"data-slot": "sidebar-menu-item",
|
|
298
298
|
...props
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
const SIDEBAR_MENU_BUTTON_NAME =
|
|
302
|
-
function SidebarMenuButton({ asChild = false, className, isActive = false, size =
|
|
303
|
-
const Component = asChild ? Slot :
|
|
301
|
+
const SIDEBAR_MENU_BUTTON_NAME = "SidebarMenuButton";
|
|
302
|
+
function SidebarMenuButton({ asChild = false, className, isActive = false, size = "md", tooltip, variant = "default", ...props }) {
|
|
303
|
+
const Component = asChild ? Slot : "button";
|
|
304
304
|
const { isMobile, state } = useSidebar(SIDEBAR_MENU_BUTTON_NAME);
|
|
305
305
|
const button = /*#__PURE__*/ jsx(Component, {
|
|
306
306
|
className: cn(sidebarMenuButtonVariants({
|
|
@@ -314,7 +314,7 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
314
314
|
...props
|
|
315
315
|
});
|
|
316
316
|
if (!tooltip) return button;
|
|
317
|
-
if (
|
|
317
|
+
if ("string" == typeof tooltip) tooltip = {
|
|
318
318
|
children: tooltip
|
|
319
319
|
};
|
|
320
320
|
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
@@ -325,7 +325,7 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
325
325
|
}),
|
|
326
326
|
/*#__PURE__*/ jsx(TooltipContent, {
|
|
327
327
|
align: "center",
|
|
328
|
-
hidden:
|
|
328
|
+
hidden: "collapsed" !== state || isMobile,
|
|
329
329
|
side: "right",
|
|
330
330
|
...tooltip
|
|
331
331
|
})
|
|
@@ -333,9 +333,9 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
|
|
336
|
-
const Component = asChild ? Slot :
|
|
336
|
+
const Component = asChild ? Slot : "button";
|
|
337
337
|
return /*#__PURE__*/ jsx(Component, {
|
|
338
|
-
className: cn(
|
|
338
|
+
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0", className),
|
|
339
339
|
"data-sidebar": "menu-action",
|
|
340
340
|
"data-slot": "sidebar-menu-action",
|
|
341
341
|
...props
|
|
@@ -343,7 +343,7 @@ function SidebarMenuAction({ asChild = false, className, showOnHover = false, ..
|
|
|
343
343
|
}
|
|
344
344
|
function SidebarMenuBadge({ className, ...props }) {
|
|
345
345
|
return /*#__PURE__*/ jsx("div", {
|
|
346
|
-
className: cn(
|
|
346
|
+
className: cn("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1", className),
|
|
347
347
|
"data-sidebar": "menu-badge",
|
|
348
348
|
"data-slot": "sidebar-menu-badge",
|
|
349
349
|
...props
|
|
@@ -352,7 +352,7 @@ function SidebarMenuBadge({ className, ...props }) {
|
|
|
352
352
|
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
353
353
|
const [width] = useState(()=>`${String(Math.floor(40 * Math.random()) + 50)}%`);
|
|
354
354
|
return /*#__PURE__*/ jsxs("div", {
|
|
355
|
-
className: cn(
|
|
355
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
356
356
|
"data-sidebar": "menu-skeleton",
|
|
357
357
|
"data-slot": "sidebar-menu-skeleton",
|
|
358
358
|
...props,
|
|
@@ -365,7 +365,7 @@ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
|
365
365
|
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
366
366
|
"data-sidebar": "menu-skeleton-text",
|
|
367
367
|
style: {
|
|
368
|
-
|
|
368
|
+
"--skeleton-width": width
|
|
369
369
|
}
|
|
370
370
|
})
|
|
371
371
|
]
|
|
@@ -373,7 +373,7 @@ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
|
373
373
|
}
|
|
374
374
|
function SidebarMenuSub({ className, ...props }) {
|
|
375
375
|
return /*#__PURE__*/ jsx("ul", {
|
|
376
|
-
className: cn(
|
|
376
|
+
className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", className),
|
|
377
377
|
"data-sidebar": "menu-sub",
|
|
378
378
|
"data-slot": "sidebar-menu-sub",
|
|
379
379
|
...props
|
|
@@ -381,16 +381,16 @@ function SidebarMenuSub({ className, ...props }) {
|
|
|
381
381
|
}
|
|
382
382
|
function SidebarMenuSubItem({ className, ...props }) {
|
|
383
383
|
return /*#__PURE__*/ jsx("li", {
|
|
384
|
-
className: cn(
|
|
384
|
+
className: cn("group/menu-sub-item relative", className),
|
|
385
385
|
"data-sidebar": "menu-sub-item",
|
|
386
386
|
"data-slot": "sidebar-menu-sub-item",
|
|
387
387
|
...props
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
|
-
function SidebarMenuSubButton({ asChild = false, className, isActive = false, size =
|
|
391
|
-
const Component = asChild ? Slot :
|
|
390
|
+
function SidebarMenuSubButton({ asChild = false, className, isActive = false, size = "md", ...props }) {
|
|
391
|
+
const Component = asChild ? Slot : "a";
|
|
392
392
|
return /*#__PURE__*/ jsx(Component, {
|
|
393
|
-
className: cn(
|
|
393
|
+
className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-3 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "sm" === size && "text-xs", "md" === size && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
394
394
|
"data-active": isActive,
|
|
395
395
|
"data-sidebar": "menu-sub-button",
|
|
396
396
|
"data-size": size,
|