@inspirare/design-system 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -61
- package/dist/book-logo-filled.svg +55 -0
- package/dist/components/ui/accessibility-improvements.js +26 -23
- package/dist/components/ui/accordion.js +34 -24
- package/dist/components/ui/alert-dialog.js +91 -57
- package/dist/components/ui/alert.js +38 -26
- package/dist/components/ui/aspect-ratio.js +11 -3
- package/dist/components/ui/avatar.js +30 -8
- package/dist/components/ui/badge.js +20 -14
- package/dist/components/ui/breadcrumb.js +69 -56
- package/dist/components/ui/button-group.js +17 -13
- package/dist/components/ui/button.js +19 -15
- package/dist/components/ui/calendar.js +63 -59
- package/dist/components/ui/card.js +11 -9
- package/dist/components/ui/carousel.js +70 -75
- package/dist/components/ui/chart.js +75 -72
- package/dist/components/ui/checkbox.js +4 -5
- package/dist/components/ui/collapsible.js +12 -14
- package/dist/components/ui/color-picker.js +60 -80
- package/dist/components/ui/combobox.js +153 -33
- package/dist/components/ui/command.js +50 -48
- package/dist/components/ui/context-menu.js +129 -68
- package/dist/components/ui/dialog.js +65 -60
- package/dist/components/ui/drawer.js +81 -40
- package/dist/components/ui/dropdown-menu.js +100 -87
- package/dist/components/ui/empty.js +7 -6
- package/dist/components/ui/field.js +44 -47
- package/dist/components/ui/form.js +22 -23
- package/dist/components/ui/hover-card.js +14 -11
- package/dist/components/ui/input-group.js +16 -13
- package/dist/components/ui/input-otp.js +37 -32
- package/dist/components/ui/input.js +9 -7
- package/dist/components/ui/item.js +42 -36
- package/dist/components/ui/kbd.js +2 -1
- package/dist/components/ui/label.js +6 -7
- package/dist/components/ui/menubar.js +124 -93
- package/dist/components/ui/navigation-menu.js +79 -54
- package/dist/components/ui/pagination.js +78 -58
- package/dist/components/ui/popover.js +35 -16
- package/dist/components/ui/progress.js +37 -13
- package/dist/components/ui/radio-group.js +14 -14
- package/dist/components/ui/resizable.js +24 -15
- package/dist/components/ui/scroll-area.js +29 -11
- package/dist/components/ui/select.js +98 -56
- package/dist/components/ui/separator.js +5 -7
- package/dist/components/ui/sheet.js +47 -42
- package/dist/components/ui/sidebar.js +279 -248
- package/dist/components/ui/skeleton.js +4 -40
- package/dist/components/ui/slider.js +27 -29
- package/dist/components/ui/sonner.js +27 -10
- package/dist/components/ui/spinner.js +2 -0
- package/dist/components/ui/switch.js +3 -4
- package/dist/components/ui/table.js +6 -6
- package/dist/components/ui/tabs.js +45 -22
- package/dist/components/ui/textarea.js +3 -2
- package/dist/components/ui/theme-toggle.js +38 -41
- package/dist/components/ui/toggle-group.js +30 -21
- package/dist/components/ui/toggle.js +8 -9
- package/dist/components/ui/tooltip.js +28 -23
- package/dist/index.css +1 -1
- package/dist/index.d.ts +446 -468
- package/dist/index.js +58 -58
- package/package.json +42 -41
- package/src/App.tsx +28 -34
- package/src/components/branding/assets/book-logo-filled.svg +55 -0
- package/src/components/branding/logo/logo.tsx +56 -0
- package/src/components/ui/accessibility-improvements.stories.tsx +18 -0
- package/src/components/ui/accessibility-improvements.test.tsx +13 -0
- package/src/components/ui/accessibility-improvements.tsx +16 -6
- package/src/components/ui/accordion.stories.tsx +19 -0
- package/src/components/ui/accordion.test.tsx +14 -0
- package/src/components/ui/accordion.tsx +28 -20
- package/src/components/ui/alert-dialog.stories.tsx +19 -0
- package/src/components/ui/alert-dialog.test.tsx +14 -0
- package/src/components/ui/alert-dialog.tsx +159 -123
- package/src/components/ui/alert.stories.tsx +19 -0
- package/src/components/ui/alert.test.tsx +14 -0
- package/src/components/ui/alert.tsx +60 -41
- package/src/components/ui/aspect-ratio.stories.tsx +19 -0
- package/src/components/ui/aspect-ratio.test.tsx +14 -0
- package/src/components/ui/aspect-ratio.tsx +19 -2
- package/src/components/ui/attachment.stories.tsx +19 -0
- package/src/components/ui/attachment.test.tsx +14 -0
- package/src/components/ui/attachment.tsx +209 -0
- package/src/components/ui/avatar.stories.tsx +19 -0
- package/src/components/ui/avatar.test.tsx +14 -0
- package/src/components/ui/avatar.tsx +73 -17
- package/src/components/ui/badge.stories.tsx +19 -0
- package/src/components/ui/badge.test.tsx +14 -0
- package/src/components/ui/badge.tsx +33 -25
- package/src/components/ui/breadcrumb.stories.tsx +19 -0
- package/src/components/ui/breadcrumb.test.tsx +14 -0
- package/src/components/ui/breadcrumb.tsx +98 -86
- package/src/components/ui/bubble.stories.tsx +19 -0
- package/src/components/ui/bubble.test.tsx +14 -0
- package/src/components/ui/bubble.tsx +130 -0
- package/src/components/ui/button-group.stories.tsx +19 -0
- package/src/components/ui/button-group.test.tsx +14 -0
- package/src/components/ui/button-group.tsx +26 -20
- package/src/components/ui/button.stories.tsx +19 -0
- package/src/components/ui/button.test.tsx +14 -0
- package/src/components/ui/button.tsx +30 -31
- package/src/components/ui/calendar.stories.tsx +19 -0
- package/src/components/ui/calendar.test.tsx +14 -0
- package/src/components/ui/calendar.tsx +28 -26
- package/src/components/ui/card.stories.tsx +19 -0
- package/src/components/ui/card.test.tsx +14 -0
- package/src/components/ui/card.tsx +30 -17
- package/src/components/ui/carousel.stories.tsx +19 -0
- package/src/components/ui/carousel.test.tsx +14 -0
- package/src/components/ui/carousel.tsx +115 -135
- package/src/components/ui/chart.stories.tsx +18 -0
- package/src/components/ui/chart.test.tsx +13 -0
- package/src/components/ui/chart.tsx +220 -216
- package/src/components/ui/checkbox.stories.tsx +19 -0
- package/src/components/ui/checkbox.test.tsx +14 -0
- package/src/components/ui/checkbox.tsx +7 -10
- package/src/components/ui/collapsible.stories.tsx +19 -0
- package/src/components/ui/collapsible.test.tsx +14 -0
- package/src/components/ui/collapsible.tsx +11 -26
- package/src/components/ui/color-picker.stories.tsx +19 -0
- package/src/components/ui/color-picker.test.tsx +14 -0
- package/src/components/ui/color-picker.tsx +36 -26
- package/src/components/ui/combobox.stories.tsx +19 -0
- package/src/components/ui/combobox.test.tsx +14 -0
- package/src/components/ui/combobox.tsx +281 -96
- package/src/components/ui/command.stories.tsx +19 -0
- package/src/components/ui/command.test.tsx +14 -0
- package/src/components/ui/command.tsx +59 -47
- package/src/components/ui/context-menu.stories.tsx +19 -0
- package/src/components/ui/context-menu.test.tsx +14 -0
- package/src/components/ui/context-menu.tsx +231 -160
- package/src/components/ui/dialog.stories.tsx +19 -0
- package/src/components/ui/dialog.test.tsx +14 -0
- package/src/components/ui/dialog.tsx +81 -72
- package/src/components/ui/direction.stories.tsx +19 -0
- package/src/components/ui/direction.test.tsx +14 -0
- package/src/components/ui/direction.tsx +6 -0
- package/src/components/ui/drawer.stories.tsx +19 -0
- package/src/components/ui/drawer.test.tsx +14 -0
- package/src/components/ui/drawer.tsx +143 -64
- package/src/components/ui/dropdown-menu.stories.tsx +19 -0
- package/src/components/ui/dropdown-menu.test.tsx +14 -0
- package/src/components/ui/dropdown-menu.tsx +199 -153
- package/src/components/ui/empty.stories.tsx +18 -0
- package/src/components/ui/empty.test.tsx +13 -0
- package/src/components/ui/empty.tsx +11 -9
- package/src/components/ui/field.stories.tsx +18 -0
- package/src/components/ui/field.test.tsx +13 -0
- package/src/components/ui/field.tsx +26 -32
- package/src/components/ui/form.stories.tsx +22 -0
- package/src/components/ui/form.test.tsx +15 -0
- package/src/components/ui/form.tsx +1 -2
- package/src/components/ui/hover-card.stories.tsx +19 -0
- package/src/components/ui/hover-card.test.tsx +14 -0
- package/src/components/ui/hover-card.tsx +34 -32
- package/src/components/ui/input-group.stories.tsx +18 -0
- package/src/components/ui/input-group.test.tsx +13 -0
- package/src/components/ui/input-group.tsx +21 -28
- package/src/components/ui/input-otp.stories.tsx +19 -0
- package/src/components/ui/input-otp.test.tsx +14 -0
- package/src/components/ui/input-otp.tsx +58 -42
- package/src/components/ui/input.stories.tsx +19 -0
- package/src/components/ui/input.test.tsx +14 -0
- package/src/components/ui/input.tsx +9 -8
- package/src/components/ui/item.stories.tsx +18 -0
- package/src/components/ui/item.test.tsx +13 -0
- package/src/components/ui/item.tsx +38 -28
- package/src/components/ui/kbd.stories.tsx +18 -0
- package/src/components/ui/kbd.test.tsx +13 -0
- package/src/components/ui/kbd.tsx +3 -3
- package/src/components/ui/label.stories.tsx +18 -0
- package/src/components/ui/label.test.tsx +13 -0
- package/src/components/ui/label.tsx +7 -11
- package/src/components/ui/marker.stories.tsx +19 -0
- package/src/components/ui/marker.test.tsx +14 -0
- package/src/components/ui/marker.tsx +73 -0
- package/src/components/ui/menubar.stories.tsx +19 -0
- package/src/components/ui/menubar.test.tsx +14 -0
- package/src/components/ui/menubar.tsx +226 -202
- package/src/components/ui/message-scroller.stories.tsx +19 -0
- package/src/components/ui/message-scroller.test.tsx +14 -0
- package/src/components/ui/message-scroller.tsx +131 -0
- package/src/components/ui/message.stories.tsx +19 -0
- package/src/components/ui/message.test.tsx +14 -0
- package/src/components/ui/message.tsx +94 -0
- package/src/components/ui/native-select.stories.tsx +18 -0
- package/src/components/ui/native-select.test.tsx +13 -0
- package/src/components/ui/native-select.tsx +63 -0
- package/src/components/ui/navigation-menu.stories.tsx +19 -0
- package/src/components/ui/navigation-menu.test.tsx +14 -0
- package/src/components/ui/navigation-menu.tsx +145 -103
- package/src/components/ui/pagination.stories.tsx +19 -0
- package/src/components/ui/pagination.test.tsx +14 -0
- package/src/components/ui/pagination.tsx +114 -83
- package/src/components/ui/popover.stories.tsx +19 -0
- package/src/components/ui/popover.test.tsx +14 -0
- package/src/components/ui/popover.tsx +68 -33
- package/src/components/ui/progress.stories.tsx +19 -0
- package/src/components/ui/progress.test.tsx +14 -0
- package/src/components/ui/progress.tsx +67 -15
- package/src/components/ui/questionnaire.stories.tsx +19 -0
- package/src/components/ui/questionnaire.test.tsx +14 -0
- package/src/components/ui/questionnaire.tsx +324 -0
- package/src/components/ui/radio-group.stories.tsx +19 -0
- package/src/components/ui/radio-group.test.tsx +14 -0
- package/src/components/ui/radio-group.tsx +15 -20
- package/src/components/ui/resizable.stories.tsx +19 -0
- package/src/components/ui/resizable.test.tsx +14 -0
- package/src/components/ui/resizable.tsx +37 -30
- package/src/components/ui/scroll-area.stories.tsx +19 -0
- package/src/components/ui/scroll-area.test.tsx +14 -0
- package/src/components/ui/scroll-area.tsx +41 -19
- package/src/components/ui/select.stories.tsx +19 -0
- package/src/components/ui/select.test.tsx +14 -0
- package/src/components/ui/select.tsx +145 -78
- package/src/components/ui/separator.stories.tsx +19 -0
- package/src/components/ui/separator.test.tsx +14 -0
- package/src/components/ui/separator.tsx +8 -11
- package/src/components/ui/sheet.stories.tsx +19 -0
- package/src/components/ui/sheet.test.tsx +14 -0
- package/src/components/ui/sheet.tsx +56 -71
- package/src/components/ui/sidebar.stories.tsx +18 -0
- package/src/components/ui/sidebar.test.tsx +13 -0
- package/src/components/ui/sidebar.tsx +469 -513
- package/src/components/ui/skeleton.stories.tsx +19 -0
- package/src/components/ui/skeleton.test.tsx +14 -0
- package/src/components/ui/skeleton.tsx +8 -114
- package/src/components/ui/slider.stories.tsx +19 -0
- package/src/components/ui/slider.test.tsx +14 -0
- package/src/components/ui/slider.tsx +31 -40
- package/src/components/ui/sonner.stories.tsx +19 -0
- package/src/components/ui/sonner.test.tsx +14 -0
- package/src/components/ui/sonner.tsx +39 -7
- package/src/components/ui/spinner.stories.tsx +18 -0
- package/src/components/ui/spinner.test.tsx +13 -0
- package/src/components/ui/spinner.tsx +3 -7
- package/src/components/ui/switch.stories.tsx +19 -0
- package/src/components/ui/switch.test.tsx +14 -0
- package/src/components/ui/switch.tsx +4 -7
- package/src/components/ui/table.stories.tsx +19 -0
- package/src/components/ui/table.test.tsx +14 -0
- package/src/components/ui/table.tsx +17 -17
- package/src/components/ui/tabs.stories.tsx +19 -0
- package/src/components/ui/tabs.test.tsx +14 -0
- package/src/components/ui/tabs.tsx +71 -31
- package/src/components/ui/textarea.stories.tsx +19 -0
- package/src/components/ui/textarea.test.tsx +14 -0
- package/src/components/ui/textarea.tsx +7 -5
- package/src/components/ui/theme-toggle.stories.tsx +18 -0
- package/src/components/ui/theme-toggle.test.tsx +13 -0
- package/src/components/ui/theme-toggle.tsx +35 -37
- package/src/components/ui/toggle-group.stories.tsx +19 -0
- package/src/components/ui/toggle-group.test.tsx +14 -0
- package/src/components/ui/toggle-group.tsx +41 -25
- package/src/components/ui/toggle.stories.tsx +19 -0
- package/src/components/ui/toggle.test.tsx +14 -0
- package/src/components/ui/toggle.tsx +17 -19
- package/src/components/ui/tooltip.stories.tsx +19 -0
- package/src/components/ui/tooltip.test.tsx +14 -0
- package/src/components/ui/tooltip.tsx +53 -44
- package/src/demo/AIDemo.tsx +50 -0
- package/src/demo/ButtonsDemo.tsx +41 -18
- package/src/demo/CalendarDemo.tsx +1 -1
- package/src/demo/FeedbackDemo.tsx +4 -6
- package/src/demo/FormsDemo.tsx +34 -11
- package/src/demo/NavigationDemo.tsx +38 -13
- package/src/demo/OverlaysDemo.tsx +22 -36
- package/src/demo/update-demos.js +82 -0
- package/src/index.css +66 -46
- package/src/lib/utils.ts +3 -3
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +36 -0
- package/src/stories/Configure.mdx +388 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +55 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props"
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render"
|
|
5
6
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
-
import { PanelLeft } from "lucide-react"
|
|
7
7
|
|
|
8
8
|
import { useIsMobile } from "@/hooks/use-mobile"
|
|
9
9
|
import { cn } from "@/lib/utils"
|
|
@@ -21,9 +21,9 @@ import { Skeleton } from "@/components/ui/skeleton"
|
|
|
21
21
|
import {
|
|
22
22
|
Tooltip,
|
|
23
23
|
TooltipContent,
|
|
24
|
-
TooltipProvider,
|
|
25
24
|
TooltipTrigger,
|
|
26
25
|
} from "@/components/ui/tooltip"
|
|
26
|
+
import { PanelLeftIcon } from "lucide-react"
|
|
27
27
|
|
|
28
28
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
29
29
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
@@ -53,487 +53,446 @@ function useSidebar() {
|
|
|
53
53
|
return context
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(value: boolean | ((value: boolean) => boolean)) => {
|
|
85
|
-
const openState = typeof value === "function" ? value(open) : value
|
|
86
|
-
if (setOpenProp) {
|
|
87
|
-
setOpenProp(openState)
|
|
88
|
-
} else {
|
|
89
|
-
_setOpen(openState)
|
|
90
|
-
}
|
|
56
|
+
function SidebarProvider({
|
|
57
|
+
defaultOpen = true,
|
|
58
|
+
open: openProp,
|
|
59
|
+
onOpenChange: setOpenProp,
|
|
60
|
+
className,
|
|
61
|
+
style,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}: React.ComponentProps<"div"> & {
|
|
65
|
+
defaultOpen?: boolean
|
|
66
|
+
open?: boolean
|
|
67
|
+
onOpenChange?: (open: boolean) => void
|
|
68
|
+
}) {
|
|
69
|
+
const isMobile = useIsMobile()
|
|
70
|
+
const [openMobile, setOpenMobile] = React.useState(false)
|
|
71
|
+
|
|
72
|
+
// This is the internal state of the sidebar.
|
|
73
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
74
|
+
const [_open, _setOpen] = React.useState(defaultOpen)
|
|
75
|
+
const open = openProp ?? _open
|
|
76
|
+
const setOpen = React.useCallback(
|
|
77
|
+
(value: boolean | ((value: boolean) => boolean)) => {
|
|
78
|
+
const openState = typeof value === "function" ? value(open) : value
|
|
79
|
+
if (setOpenProp) {
|
|
80
|
+
setOpenProp(openState)
|
|
81
|
+
} else {
|
|
82
|
+
_setOpen(openState)
|
|
83
|
+
}
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
// This sets the cookie to keep the sidebar state.
|
|
86
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
|
|
87
|
+
},
|
|
88
|
+
[setOpenProp, open]
|
|
89
|
+
)
|
|
97
90
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
event.preventDefault()
|
|
113
|
-
toggleSidebar()
|
|
114
|
-
}
|
|
91
|
+
// Helper to toggle the sidebar.
|
|
92
|
+
const toggleSidebar = React.useCallback(() => {
|
|
93
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
|
|
94
|
+
}, [isMobile, setOpen, setOpenMobile])
|
|
95
|
+
|
|
96
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
99
|
+
if (
|
|
100
|
+
event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
|
|
101
|
+
(event.metaKey || event.ctrlKey)
|
|
102
|
+
) {
|
|
103
|
+
event.preventDefault()
|
|
104
|
+
toggleSidebar()
|
|
115
105
|
}
|
|
106
|
+
}
|
|
116
107
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
108
|
+
window.addEventListener("keydown", handleKeyDown)
|
|
109
|
+
return () => window.removeEventListener("keydown", handleKeyDown)
|
|
110
|
+
}, [toggleSidebar])
|
|
111
|
+
|
|
112
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
113
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
114
|
+
const state = open ? "expanded" : "collapsed"
|
|
115
|
+
|
|
116
|
+
const contextValue = React.useMemo<SidebarContextProps>(
|
|
117
|
+
() => ({
|
|
118
|
+
state,
|
|
119
|
+
open,
|
|
120
|
+
setOpen,
|
|
121
|
+
isMobile,
|
|
122
|
+
openMobile,
|
|
123
|
+
setOpenMobile,
|
|
124
|
+
toggleSidebar,
|
|
125
|
+
}),
|
|
126
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<SidebarContext.Provider value={contextValue}>
|
|
131
|
+
<div
|
|
132
|
+
data-slot="sidebar-wrapper"
|
|
133
|
+
style={
|
|
134
|
+
{
|
|
135
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
136
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
137
|
+
...style,
|
|
138
|
+
} as React.CSSProperties
|
|
139
|
+
}
|
|
140
|
+
className={cn(
|
|
141
|
+
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
|
|
142
|
+
className
|
|
143
|
+
)}
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
</div>
|
|
148
|
+
</SidebarContext.Provider>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
137
151
|
|
|
152
|
+
function Sidebar({
|
|
153
|
+
side = "left",
|
|
154
|
+
variant = "sidebar",
|
|
155
|
+
collapsible = "offcanvas",
|
|
156
|
+
className,
|
|
157
|
+
children,
|
|
158
|
+
dir,
|
|
159
|
+
...props
|
|
160
|
+
}: React.ComponentProps<"div"> & {
|
|
161
|
+
side?: "left" | "right"
|
|
162
|
+
variant?: "sidebar" | "floating" | "inset"
|
|
163
|
+
collapsible?: "offcanvas" | "icon" | "none"
|
|
164
|
+
}) {
|
|
165
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
|
|
166
|
+
|
|
167
|
+
if (collapsible === "none") {
|
|
138
168
|
return (
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
className={cn(
|
|
150
|
-
"group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
|
|
151
|
-
className
|
|
152
|
-
)}
|
|
153
|
-
ref={ref}
|
|
154
|
-
{...props}
|
|
155
|
-
>
|
|
156
|
-
{children}
|
|
157
|
-
</div>
|
|
158
|
-
</TooltipProvider>
|
|
159
|
-
</SidebarContext.Provider>
|
|
169
|
+
<div
|
|
170
|
+
data-slot="sidebar"
|
|
171
|
+
className={cn(
|
|
172
|
+
"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
175
|
+
{...props}
|
|
176
|
+
>
|
|
177
|
+
{children}
|
|
178
|
+
</div>
|
|
160
179
|
)
|
|
161
180
|
}
|
|
162
|
-
)
|
|
163
|
-
SidebarProvider.displayName = "SidebarProvider"
|
|
164
|
-
|
|
165
|
-
const Sidebar = React.forwardRef<
|
|
166
|
-
HTMLDivElement,
|
|
167
|
-
React.ComponentProps<"div"> & {
|
|
168
|
-
side?: "left" | "right"
|
|
169
|
-
variant?: "sidebar" | "floating" | "inset"
|
|
170
|
-
collapsible?: "offcanvas" | "icon" | "none"
|
|
171
|
-
}
|
|
172
|
-
>(
|
|
173
|
-
(
|
|
174
|
-
{
|
|
175
|
-
side = "left",
|
|
176
|
-
variant = "sidebar",
|
|
177
|
-
collapsible = "offcanvas",
|
|
178
|
-
className,
|
|
179
|
-
children,
|
|
180
|
-
...props
|
|
181
|
-
},
|
|
182
|
-
ref
|
|
183
|
-
) => {
|
|
184
|
-
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
if (isMobile) {
|
|
183
|
+
return (
|
|
184
|
+
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
185
|
+
<SheetContent
|
|
186
|
+
dir={dir}
|
|
187
|
+
data-sidebar="sidebar"
|
|
188
|
+
data-slot="sidebar"
|
|
189
|
+
data-mobile="true"
|
|
190
|
+
className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
191
|
+
style={
|
|
192
|
+
{
|
|
193
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
194
|
+
} as React.CSSProperties
|
|
195
|
+
}
|
|
196
|
+
side={side}
|
|
195
197
|
>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
data-sidebar="sidebar"
|
|
206
|
-
data-mobile="true"
|
|
207
|
-
className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
208
|
-
style={
|
|
209
|
-
{
|
|
210
|
-
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
211
|
-
} as React.CSSProperties
|
|
212
|
-
}
|
|
213
|
-
side={side}
|
|
214
|
-
>
|
|
215
|
-
<SheetHeader className="sr-only">
|
|
216
|
-
<SheetTitle>Sidebar</SheetTitle>
|
|
217
|
-
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
218
|
-
</SheetHeader>
|
|
219
|
-
<div className="flex h-full w-full flex-col">{children}</div>
|
|
220
|
-
</SheetContent>
|
|
221
|
-
</Sheet>
|
|
222
|
-
)
|
|
223
|
-
}
|
|
198
|
+
<SheetHeader className="sr-only">
|
|
199
|
+
<SheetTitle>Sidebar</SheetTitle>
|
|
200
|
+
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
201
|
+
</SheetHeader>
|
|
202
|
+
<div className="flex h-full w-full flex-col">{children}</div>
|
|
203
|
+
</SheetContent>
|
|
204
|
+
</Sheet>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
224
207
|
|
|
225
|
-
|
|
208
|
+
return (
|
|
209
|
+
<div
|
|
210
|
+
className="group peer hidden text-sidebar-foreground md:block"
|
|
211
|
+
data-state={state}
|
|
212
|
+
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
213
|
+
data-variant={variant}
|
|
214
|
+
data-side={side}
|
|
215
|
+
data-slot="sidebar"
|
|
216
|
+
>
|
|
217
|
+
{/* This is what handles the sidebar gap on desktop */}
|
|
218
|
+
<div
|
|
219
|
+
data-slot="sidebar-gap"
|
|
220
|
+
className={cn(
|
|
221
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
222
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
223
|
+
"group-data-[side=right]:rotate-180",
|
|
224
|
+
variant === "floating" || variant === "inset"
|
|
225
|
+
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
|
|
226
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
227
|
+
)}
|
|
228
|
+
/>
|
|
226
229
|
<div
|
|
227
|
-
|
|
228
|
-
className="group peer hidden text-sidebar-foreground md:block"
|
|
229
|
-
data-state={state}
|
|
230
|
-
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
231
|
-
data-variant={variant}
|
|
230
|
+
data-slot="sidebar-container"
|
|
232
231
|
data-side={side}
|
|
232
|
+
className={cn(
|
|
233
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",
|
|
234
|
+
// Adjust the padding for floating and inset variants.
|
|
235
|
+
variant === "floating" || variant === "inset"
|
|
236
|
+
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
237
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
238
|
+
className
|
|
239
|
+
)}
|
|
240
|
+
{...props}
|
|
233
241
|
>
|
|
234
|
-
{/* This is what handles the sidebar gap on desktop */}
|
|
235
242
|
<div
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
"group-data-[side=right]:rotate-180",
|
|
240
|
-
variant === "floating" || variant === "inset"
|
|
241
|
-
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
|
242
|
-
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
|
|
243
|
-
)}
|
|
244
|
-
/>
|
|
245
|
-
<div
|
|
246
|
-
className={cn(
|
|
247
|
-
"fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
248
|
-
side === "left"
|
|
249
|
-
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
250
|
-
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
251
|
-
// Adjust the padding for floating and inset variants.
|
|
252
|
-
variant === "floating" || variant === "inset"
|
|
253
|
-
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
|
|
254
|
-
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
255
|
-
className
|
|
256
|
-
)}
|
|
257
|
-
{...props}
|
|
243
|
+
data-sidebar="sidebar"
|
|
244
|
+
data-slot="sidebar-inner"
|
|
245
|
+
className="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
|
|
258
246
|
>
|
|
259
|
-
|
|
260
|
-
data-sidebar="sidebar"
|
|
261
|
-
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"
|
|
262
|
-
>
|
|
263
|
-
{children}
|
|
264
|
-
</div>
|
|
247
|
+
{children}
|
|
265
248
|
</div>
|
|
266
249
|
</div>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Sidebar.displayName = "Sidebar"
|
|
250
|
+
</div>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
271
253
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
254
|
+
function SidebarTrigger({
|
|
255
|
+
className,
|
|
256
|
+
onClick,
|
|
257
|
+
...props
|
|
258
|
+
}: React.ComponentProps<typeof Button>) {
|
|
276
259
|
const { toggleSidebar } = useSidebar()
|
|
277
260
|
|
|
278
261
|
return (
|
|
279
262
|
<Button
|
|
280
|
-
ref={ref}
|
|
281
263
|
data-sidebar="trigger"
|
|
264
|
+
data-slot="sidebar-trigger"
|
|
282
265
|
variant="ghost"
|
|
283
|
-
size="icon"
|
|
284
|
-
className={cn(
|
|
266
|
+
size="icon-sm"
|
|
267
|
+
className={cn(className)}
|
|
285
268
|
onClick={(event) => {
|
|
286
269
|
onClick?.(event)
|
|
287
270
|
toggleSidebar()
|
|
288
271
|
}}
|
|
289
272
|
{...props}
|
|
290
273
|
>
|
|
291
|
-
<
|
|
274
|
+
<PanelLeftIcon />
|
|
292
275
|
<span className="sr-only">Toggle Sidebar</span>
|
|
293
276
|
</Button>
|
|
294
277
|
)
|
|
295
|
-
}
|
|
296
|
-
SidebarTrigger.displayName = "SidebarTrigger"
|
|
278
|
+
}
|
|
297
279
|
|
|
298
|
-
|
|
299
|
-
HTMLButtonElement,
|
|
300
|
-
React.ComponentProps<"button">
|
|
301
|
-
>(({ className, ...props }, ref) => {
|
|
280
|
+
function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
302
281
|
const { toggleSidebar } = useSidebar()
|
|
303
282
|
|
|
304
283
|
return (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
284
|
+
<Tooltip>
|
|
285
|
+
<TooltipTrigger
|
|
286
|
+
render={
|
|
287
|
+
<button
|
|
288
|
+
data-sidebar="rail"
|
|
289
|
+
data-slot="sidebar-rail"
|
|
290
|
+
aria-label="Toggle Sidebar"
|
|
291
|
+
tabIndex={-1}
|
|
292
|
+
onClick={toggleSidebar}
|
|
293
|
+
className={cn(
|
|
294
|
+
"absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
|
|
295
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
296
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
297
|
+
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
|
|
298
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
299
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
300
|
+
className
|
|
301
|
+
)}
|
|
302
|
+
{...props}
|
|
303
|
+
/>
|
|
304
|
+
}
|
|
305
|
+
/>
|
|
306
|
+
<TooltipContent>Toggle Sidebar</TooltipContent>
|
|
307
|
+
</Tooltip>
|
|
323
308
|
)
|
|
324
|
-
}
|
|
325
|
-
SidebarRail.displayName = "SidebarRail"
|
|
309
|
+
}
|
|
326
310
|
|
|
327
|
-
|
|
328
|
-
HTMLDivElement,
|
|
329
|
-
React.ComponentProps<"main">
|
|
330
|
-
>(({ className, ...props }, ref) => {
|
|
311
|
+
function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
|
|
331
312
|
return (
|
|
332
313
|
<main
|
|
333
|
-
|
|
314
|
+
data-slot="sidebar-inset"
|
|
334
315
|
className={cn(
|
|
335
|
-
"relative flex w-full flex-1 flex-col bg-background",
|
|
336
|
-
"md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
|
|
316
|
+
"relative flex w-full 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",
|
|
337
317
|
className
|
|
338
318
|
)}
|
|
339
319
|
{...props}
|
|
340
320
|
/>
|
|
341
321
|
)
|
|
342
|
-
}
|
|
343
|
-
SidebarInset.displayName = "SidebarInset"
|
|
322
|
+
}
|
|
344
323
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
324
|
+
function SidebarInput({
|
|
325
|
+
className,
|
|
326
|
+
...props
|
|
327
|
+
}: React.ComponentProps<typeof Input>) {
|
|
349
328
|
return (
|
|
350
329
|
<Input
|
|
351
|
-
|
|
330
|
+
data-slot="sidebar-input"
|
|
352
331
|
data-sidebar="input"
|
|
353
|
-
className={cn(
|
|
354
|
-
"h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
|
|
355
|
-
className
|
|
356
|
-
)}
|
|
332
|
+
className={cn("h-8 w-full bg-background shadow-none", className)}
|
|
357
333
|
{...props}
|
|
358
334
|
/>
|
|
359
335
|
)
|
|
360
|
-
}
|
|
361
|
-
SidebarInput.displayName = "SidebarInput"
|
|
336
|
+
}
|
|
362
337
|
|
|
363
|
-
|
|
364
|
-
HTMLDivElement,
|
|
365
|
-
React.ComponentProps<"div">
|
|
366
|
-
>(({ className, ...props }, ref) => {
|
|
338
|
+
function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
367
339
|
return (
|
|
368
340
|
<div
|
|
369
|
-
|
|
341
|
+
data-slot="sidebar-header"
|
|
370
342
|
data-sidebar="header"
|
|
371
343
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
372
344
|
{...props}
|
|
373
345
|
/>
|
|
374
346
|
)
|
|
375
|
-
}
|
|
376
|
-
SidebarHeader.displayName = "SidebarHeader"
|
|
347
|
+
}
|
|
377
348
|
|
|
378
|
-
|
|
379
|
-
HTMLDivElement,
|
|
380
|
-
React.ComponentProps<"div">
|
|
381
|
-
>(({ className, ...props }, ref) => {
|
|
349
|
+
function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
382
350
|
return (
|
|
383
351
|
<div
|
|
384
|
-
|
|
352
|
+
data-slot="sidebar-footer"
|
|
385
353
|
data-sidebar="footer"
|
|
386
354
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
387
355
|
{...props}
|
|
388
356
|
/>
|
|
389
357
|
)
|
|
390
|
-
}
|
|
391
|
-
SidebarFooter.displayName = "SidebarFooter"
|
|
358
|
+
}
|
|
392
359
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
360
|
+
function SidebarSeparator({
|
|
361
|
+
className,
|
|
362
|
+
...props
|
|
363
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
397
364
|
return (
|
|
398
365
|
<Separator
|
|
399
|
-
|
|
366
|
+
data-slot="sidebar-separator"
|
|
400
367
|
data-sidebar="separator"
|
|
401
368
|
className={cn("mx-2 w-auto bg-sidebar-border", className)}
|
|
402
369
|
{...props}
|
|
403
370
|
/>
|
|
404
371
|
)
|
|
405
|
-
}
|
|
406
|
-
SidebarSeparator.displayName = "SidebarSeparator"
|
|
372
|
+
}
|
|
407
373
|
|
|
408
|
-
|
|
409
|
-
HTMLDivElement,
|
|
410
|
-
React.ComponentProps<"div">
|
|
411
|
-
>(({ className, ...props }, ref) => {
|
|
374
|
+
function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
412
375
|
return (
|
|
413
376
|
<div
|
|
414
|
-
|
|
377
|
+
data-slot="sidebar-content"
|
|
415
378
|
data-sidebar="content"
|
|
416
379
|
className={cn(
|
|
417
|
-
"flex min-h-0 flex-1 flex-col gap-
|
|
380
|
+
"no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
418
381
|
className
|
|
419
382
|
)}
|
|
420
383
|
{...props}
|
|
421
384
|
/>
|
|
422
385
|
)
|
|
423
|
-
}
|
|
424
|
-
SidebarContent.displayName = "SidebarContent"
|
|
386
|
+
}
|
|
425
387
|
|
|
426
|
-
|
|
427
|
-
HTMLDivElement,
|
|
428
|
-
React.ComponentProps<"div">
|
|
429
|
-
>(({ className, ...props }, ref) => {
|
|
388
|
+
function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
430
389
|
return (
|
|
431
390
|
<div
|
|
432
|
-
|
|
391
|
+
data-slot="sidebar-group"
|
|
433
392
|
data-sidebar="group"
|
|
434
393
|
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
435
394
|
{...props}
|
|
436
395
|
/>
|
|
437
396
|
)
|
|
438
|
-
}
|
|
439
|
-
SidebarGroup.displayName = "SidebarGroup"
|
|
397
|
+
}
|
|
440
398
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
399
|
+
function SidebarGroupLabel({
|
|
400
|
+
className,
|
|
401
|
+
render,
|
|
402
|
+
...props
|
|
403
|
+
}: useRender.ComponentProps<"div"> & React.ComponentProps<"div">) {
|
|
404
|
+
return useRender({
|
|
405
|
+
defaultTagName: "div",
|
|
406
|
+
props: mergeProps<"div">(
|
|
407
|
+
{
|
|
408
|
+
className: cn(
|
|
409
|
+
"flex h-8 shrink-0 items-center 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-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
410
|
+
className
|
|
411
|
+
),
|
|
412
|
+
},
|
|
413
|
+
props
|
|
414
|
+
),
|
|
415
|
+
render,
|
|
416
|
+
state: {
|
|
417
|
+
slot: "sidebar-group-label",
|
|
418
|
+
sidebar: "group-label",
|
|
419
|
+
},
|
|
420
|
+
})
|
|
421
|
+
}
|
|
446
422
|
|
|
423
|
+
function SidebarGroupAction({
|
|
424
|
+
className,
|
|
425
|
+
render,
|
|
426
|
+
...props
|
|
427
|
+
}: useRender.ComponentProps<"button"> & React.ComponentProps<"button">) {
|
|
428
|
+
return useRender({
|
|
429
|
+
defaultTagName: "button",
|
|
430
|
+
props: mergeProps<"button">(
|
|
431
|
+
{
|
|
432
|
+
className: cn(
|
|
433
|
+
"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-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
|
|
434
|
+
className
|
|
435
|
+
),
|
|
436
|
+
},
|
|
437
|
+
props
|
|
438
|
+
),
|
|
439
|
+
render,
|
|
440
|
+
state: {
|
|
441
|
+
slot: "sidebar-group-action",
|
|
442
|
+
sidebar: "group-action",
|
|
443
|
+
},
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function SidebarGroupContent({
|
|
448
|
+
className,
|
|
449
|
+
...props
|
|
450
|
+
}: React.ComponentProps<"div">) {
|
|
447
451
|
return (
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
data-sidebar="group-
|
|
451
|
-
className={cn(
|
|
452
|
-
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
453
|
-
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
454
|
-
className
|
|
455
|
-
)}
|
|
452
|
+
<div
|
|
453
|
+
data-slot="sidebar-group-content"
|
|
454
|
+
data-sidebar="group-content"
|
|
455
|
+
className={cn("w-full text-sm", className)}
|
|
456
456
|
{...props}
|
|
457
457
|
/>
|
|
458
458
|
)
|
|
459
|
-
}
|
|
460
|
-
SidebarGroupLabel.displayName = "SidebarGroupLabel"
|
|
459
|
+
}
|
|
461
460
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
461
|
+
function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
|
|
462
|
+
return (
|
|
463
|
+
<ul
|
|
464
|
+
data-slot="sidebar-menu"
|
|
465
|
+
data-sidebar="menu"
|
|
466
|
+
className={cn("flex w-full min-w-0 flex-col gap-0", className)}
|
|
467
|
+
{...props}
|
|
468
|
+
/>
|
|
469
|
+
)
|
|
470
|
+
}
|
|
467
471
|
|
|
472
|
+
function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
468
473
|
return (
|
|
469
|
-
<
|
|
470
|
-
|
|
471
|
-
data-sidebar="
|
|
472
|
-
className={cn(
|
|
473
|
-
"absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
474
|
-
// Increases the hit area of the button on mobile.
|
|
475
|
-
"after:absolute after:-inset-2 after:md:hidden",
|
|
476
|
-
"group-data-[collapsible=icon]:hidden",
|
|
477
|
-
className
|
|
478
|
-
)}
|
|
474
|
+
<li
|
|
475
|
+
data-slot="sidebar-menu-item"
|
|
476
|
+
data-sidebar="menu-item"
|
|
477
|
+
className={cn("group/menu-item relative", className)}
|
|
479
478
|
{...props}
|
|
480
479
|
/>
|
|
481
480
|
)
|
|
482
|
-
}
|
|
483
|
-
SidebarGroupAction.displayName = "SidebarGroupAction"
|
|
484
|
-
|
|
485
|
-
const SidebarGroupContent = React.forwardRef<
|
|
486
|
-
HTMLDivElement,
|
|
487
|
-
React.ComponentProps<"div">
|
|
488
|
-
>(({ className, ...props }, ref) => (
|
|
489
|
-
<div
|
|
490
|
-
ref={ref}
|
|
491
|
-
data-sidebar="group-content"
|
|
492
|
-
className={cn("w-full text-sm", className)}
|
|
493
|
-
{...props}
|
|
494
|
-
/>
|
|
495
|
-
))
|
|
496
|
-
SidebarGroupContent.displayName = "SidebarGroupContent"
|
|
497
|
-
|
|
498
|
-
const SidebarMenu = React.forwardRef<
|
|
499
|
-
HTMLUListElement,
|
|
500
|
-
React.ComponentProps<"ul">
|
|
501
|
-
>(({ className, ...props }, ref) => (
|
|
502
|
-
<ul
|
|
503
|
-
ref={ref}
|
|
504
|
-
data-sidebar="menu"
|
|
505
|
-
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
506
|
-
{...props}
|
|
507
|
-
/>
|
|
508
|
-
))
|
|
509
|
-
SidebarMenu.displayName = "SidebarMenu"
|
|
510
|
-
|
|
511
|
-
const SidebarMenuItem = React.forwardRef<
|
|
512
|
-
HTMLLIElement,
|
|
513
|
-
React.ComponentProps<"li">
|
|
514
|
-
>(({ className, ...props }, ref) => (
|
|
515
|
-
<li
|
|
516
|
-
ref={ref}
|
|
517
|
-
data-sidebar="menu-item"
|
|
518
|
-
className={cn("group/menu-item relative", className)}
|
|
519
|
-
{...props}
|
|
520
|
-
/>
|
|
521
|
-
))
|
|
522
|
-
SidebarMenuItem.displayName = "SidebarMenuItem"
|
|
481
|
+
}
|
|
523
482
|
|
|
524
483
|
const sidebarMenuButtonVariants = cva(
|
|
525
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm
|
|
484
|
+
"peer/menu-button group/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-2 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-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
|
|
526
485
|
{
|
|
527
486
|
variants: {
|
|
528
487
|
variant: {
|
|
529
488
|
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
530
489
|
outline:
|
|
531
|
-
"bg-background shadow-[
|
|
490
|
+
"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
|
|
532
491
|
},
|
|
533
492
|
size: {
|
|
534
493
|
default: "h-8 text-sm",
|
|
535
494
|
sm: "h-7 text-xs",
|
|
536
|
-
lg: "h-12 text-sm group-data-[collapsible=icon]
|
|
495
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
537
496
|
},
|
|
538
497
|
},
|
|
539
498
|
defaultVariants: {
|
|
@@ -543,131 +502,122 @@ const sidebarMenuButtonVariants = cva(
|
|
|
543
502
|
}
|
|
544
503
|
)
|
|
545
504
|
|
|
546
|
-
|
|
547
|
-
|
|
505
|
+
function SidebarMenuButton({
|
|
506
|
+
render,
|
|
507
|
+
isActive = false,
|
|
508
|
+
variant = "default",
|
|
509
|
+
size = "default",
|
|
510
|
+
tooltip,
|
|
511
|
+
className,
|
|
512
|
+
...props
|
|
513
|
+
}: useRender.ComponentProps<"button"> &
|
|
548
514
|
React.ComponentProps<"button"> & {
|
|
549
|
-
asChild?: boolean
|
|
550
515
|
isActive?: boolean
|
|
551
516
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
552
|
-
} & VariantProps<typeof sidebarMenuButtonVariants>
|
|
553
|
-
|
|
554
|
-
(
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
517
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
518
|
+
const { isMobile, state } = useSidebar()
|
|
519
|
+
const comp = useRender({
|
|
520
|
+
defaultTagName: "button",
|
|
521
|
+
props: mergeProps<"button">(
|
|
522
|
+
{
|
|
523
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
524
|
+
},
|
|
525
|
+
props
|
|
526
|
+
),
|
|
527
|
+
render: !tooltip ? render : <TooltipTrigger render={render} />,
|
|
528
|
+
state: {
|
|
529
|
+
slot: "sidebar-menu-button",
|
|
530
|
+
sidebar: "menu-button",
|
|
531
|
+
size,
|
|
532
|
+
active: isActive,
|
|
563
533
|
},
|
|
564
|
-
|
|
565
|
-
) => {
|
|
566
|
-
const Comp = asChild ? Slot : "button"
|
|
567
|
-
const { isMobile, state } = useSidebar()
|
|
568
|
-
|
|
569
|
-
const button = (
|
|
570
|
-
<Comp
|
|
571
|
-
ref={ref}
|
|
572
|
-
data-sidebar="menu-button"
|
|
573
|
-
data-size={size}
|
|
574
|
-
data-active={isActive}
|
|
575
|
-
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
576
|
-
{...props}
|
|
577
|
-
/>
|
|
578
|
-
)
|
|
534
|
+
})
|
|
579
535
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
536
|
+
if (!tooltip) {
|
|
537
|
+
return comp
|
|
538
|
+
}
|
|
583
539
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
540
|
+
if (typeof tooltip === "string") {
|
|
541
|
+
tooltip = {
|
|
542
|
+
children: tooltip,
|
|
588
543
|
}
|
|
589
|
-
|
|
590
|
-
return (
|
|
591
|
-
<Tooltip>
|
|
592
|
-
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
593
|
-
<TooltipContent
|
|
594
|
-
side="right"
|
|
595
|
-
align="center"
|
|
596
|
-
hidden={state !== "collapsed" || isMobile}
|
|
597
|
-
{...tooltip}
|
|
598
|
-
/>
|
|
599
|
-
</Tooltip>
|
|
600
|
-
)
|
|
601
544
|
}
|
|
602
|
-
)
|
|
603
|
-
SidebarMenuButton.displayName = "SidebarMenuButton"
|
|
604
545
|
|
|
605
|
-
|
|
606
|
-
|
|
546
|
+
return (
|
|
547
|
+
<Tooltip>
|
|
548
|
+
{comp}
|
|
549
|
+
<TooltipContent
|
|
550
|
+
side="right"
|
|
551
|
+
align="center"
|
|
552
|
+
hidden={state !== "collapsed" || isMobile}
|
|
553
|
+
{...tooltip}
|
|
554
|
+
/>
|
|
555
|
+
</Tooltip>
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function SidebarMenuAction({
|
|
560
|
+
className,
|
|
561
|
+
render,
|
|
562
|
+
showOnHover = false,
|
|
563
|
+
...props
|
|
564
|
+
}: useRender.ComponentProps<"button"> &
|
|
607
565
|
React.ComponentProps<"button"> & {
|
|
608
|
-
asChild?: boolean
|
|
609
566
|
showOnHover?: boolean
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
567
|
+
}) {
|
|
568
|
+
return useRender({
|
|
569
|
+
defaultTagName: "button",
|
|
570
|
+
props: mergeProps<"button">(
|
|
571
|
+
{
|
|
572
|
+
className: cn(
|
|
573
|
+
"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-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
|
|
574
|
+
showOnHover &&
|
|
575
|
+
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
|
|
576
|
+
className
|
|
577
|
+
),
|
|
578
|
+
},
|
|
579
|
+
props
|
|
580
|
+
),
|
|
581
|
+
render,
|
|
582
|
+
state: {
|
|
583
|
+
slot: "sidebar-menu-action",
|
|
584
|
+
sidebar: "menu-action",
|
|
585
|
+
},
|
|
586
|
+
})
|
|
587
|
+
}
|
|
613
588
|
|
|
589
|
+
function SidebarMenuBadge({
|
|
590
|
+
className,
|
|
591
|
+
...props
|
|
592
|
+
}: React.ComponentProps<"div">) {
|
|
614
593
|
return (
|
|
615
|
-
<
|
|
616
|
-
|
|
617
|
-
data-sidebar="menu-
|
|
594
|
+
<div
|
|
595
|
+
data-slot="sidebar-menu-badge"
|
|
596
|
+
data-sidebar="menu-badge"
|
|
618
597
|
className={cn(
|
|
619
|
-
"absolute right-1
|
|
620
|
-
// Increases the hit area of the button on mobile.
|
|
621
|
-
"after:absolute after:-inset-2 after:md:hidden",
|
|
622
|
-
"peer-data-[size=sm]/menu-button:top-1",
|
|
623
|
-
"peer-data-[size=default]/menu-button:top-1.5",
|
|
624
|
-
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
625
|
-
"group-data-[collapsible=icon]:hidden",
|
|
626
|
-
showOnHover &&
|
|
627
|
-
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
|
|
598
|
+
"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-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",
|
|
628
599
|
className
|
|
629
600
|
)}
|
|
630
601
|
{...props}
|
|
631
602
|
/>
|
|
632
603
|
)
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
data-sidebar="menu-badge"
|
|
643
|
-
className={cn(
|
|
644
|
-
"pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
|
|
645
|
-
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
646
|
-
"peer-data-[size=sm]/menu-button:top-1",
|
|
647
|
-
"peer-data-[size=default]/menu-button:top-1.5",
|
|
648
|
-
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
649
|
-
"group-data-[collapsible=icon]:hidden",
|
|
650
|
-
className
|
|
651
|
-
)}
|
|
652
|
-
{...props}
|
|
653
|
-
/>
|
|
654
|
-
))
|
|
655
|
-
SidebarMenuBadge.displayName = "SidebarMenuBadge"
|
|
656
|
-
|
|
657
|
-
const SidebarMenuSkeleton = React.forwardRef<
|
|
658
|
-
HTMLDivElement,
|
|
659
|
-
React.ComponentProps<"div"> & {
|
|
660
|
-
showIcon?: boolean
|
|
661
|
-
}
|
|
662
|
-
>(({ className, showIcon = false, ...props }, ref) => {
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function SidebarMenuSkeleton({
|
|
607
|
+
className,
|
|
608
|
+
showIcon = false,
|
|
609
|
+
...props
|
|
610
|
+
}: React.ComponentProps<"div"> & {
|
|
611
|
+
showIcon?: boolean
|
|
612
|
+
}) {
|
|
663
613
|
// Random width between 50 to 90%.
|
|
664
|
-
const width = React.
|
|
614
|
+
const [width] = React.useState(() => {
|
|
665
615
|
return `${Math.floor(Math.random() * 40) + 50}%`
|
|
666
|
-
}
|
|
616
|
+
})
|
|
667
617
|
|
|
668
618
|
return (
|
|
669
619
|
<div
|
|
670
|
-
|
|
620
|
+
data-slot="sidebar-menu-skeleton"
|
|
671
621
|
data-sidebar="menu-skeleton"
|
|
672
622
|
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
673
623
|
{...props}
|
|
@@ -679,7 +629,7 @@ const SidebarMenuSkeleton = React.forwardRef<
|
|
|
679
629
|
/>
|
|
680
630
|
)}
|
|
681
631
|
<Skeleton
|
|
682
|
-
className="h-4 max-w-
|
|
632
|
+
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
683
633
|
data-sidebar="menu-skeleton-text"
|
|
684
634
|
style={
|
|
685
635
|
{
|
|
@@ -689,61 +639,67 @@ const SidebarMenuSkeleton = React.forwardRef<
|
|
|
689
639
|
/>
|
|
690
640
|
</div>
|
|
691
641
|
)
|
|
692
|
-
}
|
|
693
|
-
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton"
|
|
694
|
-
|
|
695
|
-
const SidebarMenuSub = React.forwardRef<
|
|
696
|
-
HTMLUListElement,
|
|
697
|
-
React.ComponentProps<"ul">
|
|
698
|
-
>(({ className, ...props }, ref) => (
|
|
699
|
-
<ul
|
|
700
|
-
ref={ref}
|
|
701
|
-
data-sidebar="menu-sub"
|
|
702
|
-
className={cn(
|
|
703
|
-
"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",
|
|
704
|
-
"group-data-[collapsible=icon]:hidden",
|
|
705
|
-
className
|
|
706
|
-
)}
|
|
707
|
-
{...props}
|
|
708
|
-
/>
|
|
709
|
-
))
|
|
710
|
-
SidebarMenuSub.displayName = "SidebarMenuSub"
|
|
711
|
-
|
|
712
|
-
const SidebarMenuSubItem = React.forwardRef<
|
|
713
|
-
HTMLLIElement,
|
|
714
|
-
React.ComponentProps<"li">
|
|
715
|
-
>(({ ...props }, ref) => <li ref={ref} {...props} />)
|
|
716
|
-
SidebarMenuSubItem.displayName = "SidebarMenuSubItem"
|
|
717
|
-
|
|
718
|
-
const SidebarMenuSubButton = React.forwardRef<
|
|
719
|
-
HTMLAnchorElement,
|
|
720
|
-
React.ComponentProps<"a"> & {
|
|
721
|
-
asChild?: boolean
|
|
722
|
-
size?: "sm" | "md"
|
|
723
|
-
isActive?: boolean
|
|
724
|
-
}
|
|
725
|
-
>(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
726
|
-
const Comp = asChild ? Slot : "a"
|
|
642
|
+
}
|
|
727
643
|
|
|
644
|
+
function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
|
|
728
645
|
return (
|
|
729
|
-
<
|
|
730
|
-
|
|
731
|
-
data-sidebar="menu-sub
|
|
732
|
-
data-size={size}
|
|
733
|
-
data-active={isActive}
|
|
646
|
+
<ul
|
|
647
|
+
data-slot="sidebar-menu-sub"
|
|
648
|
+
data-sidebar="menu-sub"
|
|
734
649
|
className={cn(
|
|
735
|
-
"flex
|
|
736
|
-
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
737
|
-
size === "sm" && "text-xs",
|
|
738
|
-
size === "md" && "text-sm",
|
|
739
|
-
"group-data-[collapsible=icon]:hidden",
|
|
650
|
+
"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",
|
|
740
651
|
className
|
|
741
652
|
)}
|
|
742
653
|
{...props}
|
|
743
654
|
/>
|
|
744
655
|
)
|
|
745
|
-
}
|
|
746
|
-
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function SidebarMenuSubItem({
|
|
659
|
+
className,
|
|
660
|
+
...props
|
|
661
|
+
}: React.ComponentProps<"li">) {
|
|
662
|
+
return (
|
|
663
|
+
<li
|
|
664
|
+
data-slot="sidebar-menu-sub-item"
|
|
665
|
+
data-sidebar="menu-sub-item"
|
|
666
|
+
className={cn("group/menu-sub-item relative", className)}
|
|
667
|
+
{...props}
|
|
668
|
+
/>
|
|
669
|
+
)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function SidebarMenuSubButton({
|
|
673
|
+
render,
|
|
674
|
+
size = "md",
|
|
675
|
+
isActive = false,
|
|
676
|
+
className,
|
|
677
|
+
...props
|
|
678
|
+
}: useRender.ComponentProps<"a"> &
|
|
679
|
+
React.ComponentProps<"a"> & {
|
|
680
|
+
size?: "sm" | "md"
|
|
681
|
+
isActive?: boolean
|
|
682
|
+
}) {
|
|
683
|
+
return useRender({
|
|
684
|
+
defaultTagName: "a",
|
|
685
|
+
props: mergeProps<"a">(
|
|
686
|
+
{
|
|
687
|
+
className: cn(
|
|
688
|
+
"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 group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
|
|
689
|
+
className
|
|
690
|
+
),
|
|
691
|
+
},
|
|
692
|
+
props
|
|
693
|
+
),
|
|
694
|
+
render,
|
|
695
|
+
state: {
|
|
696
|
+
slot: "sidebar-menu-sub-button",
|
|
697
|
+
sidebar: "menu-sub-button",
|
|
698
|
+
size,
|
|
699
|
+
active: isActive,
|
|
700
|
+
},
|
|
701
|
+
})
|
|
702
|
+
}
|
|
747
703
|
|
|
748
704
|
export {
|
|
749
705
|
Sidebar,
|