@arolariu/components 0.2.0 → 0.3.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 +15 -0
- package/dist/components/ui/accordion.d.ts +4 -4
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +19 -27
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +17 -11
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +38 -61
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts +4 -5
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +17 -20
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +1 -2
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.js +1 -8
- package/dist/components/ui/aspect-ratio.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +3 -3
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +16 -19
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +7 -10
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +16 -8
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +28 -35
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button-group.d.ts +13 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +47 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +3 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +15 -14
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +20 -20
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.d.ts +7 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +31 -44
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +5 -6
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +29 -20
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts +35 -27
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +28 -26
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +1 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +10 -12
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts +2 -4
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +31 -20
- package/dist/components/ui/collapsible.js.map +1 -1
- package/dist/components/ui/command.d.ts +78 -16
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +47 -72
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +21 -19
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +57 -101
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +16 -12
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +36 -64
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +19 -10
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +32 -57
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +21 -19
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +64 -108
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdrawer.d.ts +1 -1
- package/dist/components/ui/dropdrawer.d.ts.map +1 -1
- package/dist/components/ui/dropdrawer.js +2 -5
- package/dist/components/ui/dropdrawer.js.map +1 -1
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +65 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +135 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/form.d.ts +5 -6
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.js +29 -28
- package/dist/components/ui/form.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts +3 -3
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card.js +11 -25
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +91 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +30 -7
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js +22 -25
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +6 -7
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +122 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +21 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +2 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +8 -7
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.d.ts +18 -16
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar.js +73 -93
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +8 -10
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +36 -55
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +24 -9
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +33 -45
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts +4 -4
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +9 -25
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +5 -7
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +2 -2
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +16 -19
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +20 -4
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +8 -19
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +2 -2
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +12 -16
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts +10 -12
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +54 -77
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +6 -7
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.d.ts +23 -11
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +54 -66
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +34 -38
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +116 -124
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js +1 -2
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.d.ts +1 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +11 -30
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.d.ts +4 -2
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/sonner.js +7 -4
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +16 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +7 -9
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +8 -8
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +36 -45
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -4
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +17 -26
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +6 -7
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +8 -3
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +11 -15
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +4 -1
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +7 -8
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +4 -4
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -38
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/typewriter.d.ts.map +1 -1
- package/dist/components/ui/typewriter.js +2 -6
- package/dist/components/ui/typewriter.js.map +1 -1
- package/dist/index.css +839 -1126
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/package.json +37 -2
- package/src/components/ui/accordion.tsx +43 -44
- package/src/components/ui/alert-dialog.tsx +88 -99
- package/src/components/ui/alert.tsx +24 -25
- package/src/components/ui/aspect-ratio.tsx +1 -9
- package/src/components/ui/avatar.tsx +33 -27
- package/src/components/ui/badge.tsx +8 -16
- package/src/components/ui/breadcrumb.tsx +70 -73
- package/src/components/ui/button-group.tsx +69 -0
- package/src/components/ui/button.tsx +18 -24
- package/src/components/ui/calendar.tsx +20 -20
- package/src/components/ui/card.tsx +52 -71
- package/src/components/ui/carousel.tsx +145 -133
- package/src/components/ui/chart.tsx +174 -182
- package/src/components/ui/checkbox.tsx +18 -18
- package/src/components/ui/collapsible.tsx +2 -26
- package/src/components/ui/command.tsx +101 -99
- package/src/components/ui/context-menu.tsx +150 -193
- package/src/components/ui/dialog.tsx +75 -110
- package/src/components/ui/drawer.tsx +74 -102
- package/src/components/ui/dropdown-menu.tsx +153 -200
- package/src/components/ui/dropdrawer.tsx +0 -5
- package/src/components/ui/empty.tsx +86 -0
- package/src/components/ui/field.tsx +199 -0
- package/src/components/ui/form.tsx +49 -50
- package/src/components/ui/hover-card.tsx +18 -37
- package/src/components/ui/input-group.tsx +145 -0
- package/src/components/ui/input-otp.tsx +49 -59
- package/src/components/ui/input.tsx +5 -6
- package/src/components/ui/item.tsx +163 -0
- package/src/components/ui/kbd.tsx +31 -0
- package/src/components/ui/label.tsx +14 -12
- package/src/components/ui/menubar.tsx +178 -201
- package/src/components/ui/navigation-menu.tsx +84 -100
- package/src/components/ui/pagination.tsx +75 -85
- package/src/components/ui/popover.tsx +19 -38
- package/src/components/ui/progress.tsx +15 -14
- package/src/components/ui/radio-group.tsx +19 -13
- package/src/components/ui/resizable.tsx +23 -36
- package/src/components/ui/scroll-area.tsx +32 -35
- package/src/components/ui/select.tsx +112 -127
- package/src/components/ui/separator.tsx +17 -19
- package/src/components/ui/sheet.tsx +87 -108
- package/src/components/ui/sidebar.tsx +276 -279
- package/src/components/ui/skeleton.tsx +2 -3
- package/src/components/ui/slider.tsx +15 -40
- package/src/components/ui/sonner.tsx +15 -9
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/switch.tsx +18 -17
- package/src/components/ui/table.tsx +66 -71
- package/src/components/ui/tabs.tsx +36 -36
- package/src/components/ui/textarea.tsx +5 -4
- package/src/components/ui/toggle-group.tsx +21 -34
- package/src/components/ui/toggle.tsx +14 -16
- package/src/components/ui/tooltip.tsx +19 -43
- package/src/components/ui/typewriter.tsx +3 -4
- package/src/index.css +6 -6
- package/src/index.ts +43 -4
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
3
|
import {Slot} from "@radix-ui/react-slot";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import {VariantProps, cva} from "class-variance-authority";
|
|
5
|
+
import {PanelLeft} from "lucide-react";
|
|
8
6
|
import * as React from "react";
|
|
9
7
|
|
|
10
8
|
import {Button} from "@/components/ui/button";
|
|
@@ -44,19 +42,14 @@ function useSidebar() {
|
|
|
44
42
|
return context;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}: React.ComponentProps<"div"> & {
|
|
56
|
-
defaultOpen?: boolean;
|
|
57
|
-
open?: boolean;
|
|
58
|
-
onOpenChange?: (open: boolean) => void;
|
|
59
|
-
}) {
|
|
45
|
+
const SidebarProvider = React.forwardRef<
|
|
46
|
+
HTMLDivElement,
|
|
47
|
+
React.ComponentProps<"div"> & {
|
|
48
|
+
defaultOpen?: boolean;
|
|
49
|
+
open?: boolean;
|
|
50
|
+
onOpenChange?: (open: boolean) => void;
|
|
51
|
+
}
|
|
52
|
+
>(({defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props}, ref) => {
|
|
60
53
|
const isMobile = useIsMobile();
|
|
61
54
|
const [openMobile, setOpenMobile] = React.useState(false);
|
|
62
55
|
|
|
@@ -93,8 +86,8 @@ function SidebarProvider({
|
|
|
93
86
|
}
|
|
94
87
|
};
|
|
95
88
|
|
|
96
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
97
|
-
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
89
|
+
globalThis.window.addEventListener("keydown", handleKeyDown);
|
|
90
|
+
return () => globalThis.window.removeEventListener("keydown", handleKeyDown);
|
|
98
91
|
}, [toggleSidebar]);
|
|
99
92
|
|
|
100
93
|
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
@@ -118,7 +111,6 @@ function SidebarProvider({
|
|
|
118
111
|
<SidebarContext.Provider value={contextValue}>
|
|
119
112
|
<TooltipProvider delayDuration={0}>
|
|
120
113
|
<div
|
|
121
|
-
data-slot='sidebar-wrapper'
|
|
122
114
|
style={
|
|
123
115
|
{
|
|
124
116
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
@@ -126,34 +118,32 @@ function SidebarProvider({
|
|
|
126
118
|
...style,
|
|
127
119
|
} as React.CSSProperties
|
|
128
120
|
}
|
|
129
|
-
className={cn("group/sidebar-wrapper has-data-
|
|
121
|
+
className={cn("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full", className)}
|
|
122
|
+
ref={ref}
|
|
130
123
|
{...props}>
|
|
131
124
|
{children}
|
|
132
125
|
</div>
|
|
133
126
|
</TooltipProvider>
|
|
134
127
|
</SidebarContext.Provider>
|
|
135
128
|
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
variant?: "sidebar" | "floating" | "inset";
|
|
148
|
-
collapsible?: "offcanvas" | "icon" | "none";
|
|
149
|
-
}) {
|
|
129
|
+
});
|
|
130
|
+
SidebarProvider.displayName = "SidebarProvider";
|
|
131
|
+
|
|
132
|
+
const Sidebar = React.forwardRef<
|
|
133
|
+
HTMLDivElement,
|
|
134
|
+
React.ComponentProps<"div"> & {
|
|
135
|
+
side?: "left" | "right";
|
|
136
|
+
variant?: "sidebar" | "floating" | "inset";
|
|
137
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
138
|
+
}
|
|
139
|
+
>(({side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props}, ref) => {
|
|
150
140
|
const {isMobile, state, openMobile, setOpenMobile} = useSidebar();
|
|
151
141
|
|
|
152
142
|
if (collapsible === "none") {
|
|
153
143
|
return (
|
|
154
144
|
<div
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
className={cn("bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col", className)}
|
|
146
|
+
ref={ref}
|
|
157
147
|
{...props}>
|
|
158
148
|
{children}
|
|
159
149
|
</div>
|
|
@@ -168,9 +158,8 @@ function Sidebar({
|
|
|
168
158
|
{...props}>
|
|
169
159
|
<SheetContent
|
|
170
160
|
data-sidebar='sidebar'
|
|
171
|
-
data-slot='sidebar'
|
|
172
161
|
data-mobile='true'
|
|
173
|
-
className='bg-sidebar text-sidebar-foreground w-
|
|
162
|
+
className='bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden'
|
|
174
163
|
style={
|
|
175
164
|
{
|
|
176
165
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
@@ -189,86 +178,88 @@ function Sidebar({
|
|
|
189
178
|
|
|
190
179
|
return (
|
|
191
180
|
<div
|
|
181
|
+
ref={ref}
|
|
192
182
|
className='group peer text-sidebar-foreground hidden md:block'
|
|
193
183
|
data-state={state}
|
|
194
184
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
195
185
|
data-variant={variant}
|
|
196
|
-
data-side={side}
|
|
197
|
-
data-slot='sidebar'>
|
|
186
|
+
data-side={side}>
|
|
198
187
|
{/* This is what handles the sidebar gap on desktop */}
|
|
199
188
|
<div
|
|
200
|
-
data-slot='sidebar-gap'
|
|
201
189
|
className={cn(
|
|
202
|
-
"relative w-
|
|
190
|
+
"relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear",
|
|
203
191
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
204
192
|
"group-data-[side=right]:rotate-180",
|
|
205
193
|
variant === "floating" || variant === "inset"
|
|
206
|
-
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(
|
|
207
|
-
: "group-data-[collapsible=icon]:w-
|
|
194
|
+
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
|
195
|
+
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
|
|
208
196
|
)}
|
|
209
197
|
/>
|
|
210
198
|
<div
|
|
211
|
-
data-slot='sidebar-container'
|
|
212
199
|
className={cn(
|
|
213
|
-
"fixed inset-y-0 z-10 hidden h-svh w-
|
|
200
|
+
"fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
214
201
|
side === "left"
|
|
215
202
|
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
216
203
|
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
217
204
|
// Adjust the padding for floating and inset variants.
|
|
218
205
|
variant === "floating" || variant === "inset"
|
|
219
|
-
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(
|
|
220
|
-
: "group-data-[collapsible=icon]:w-
|
|
206
|
+
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
|
|
207
|
+
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
221
208
|
className,
|
|
222
209
|
)}
|
|
223
210
|
{...props}>
|
|
224
211
|
<div
|
|
225
212
|
data-sidebar='sidebar'
|
|
226
|
-
data-
|
|
227
|
-
className='bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm'>
|
|
213
|
+
className='bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow'>
|
|
228
214
|
{children}
|
|
229
215
|
</div>
|
|
230
216
|
</div>
|
|
231
217
|
</div>
|
|
232
218
|
);
|
|
233
|
-
}
|
|
219
|
+
});
|
|
220
|
+
Sidebar.displayName = "Sidebar";
|
|
234
221
|
|
|
235
|
-
|
|
236
|
-
|
|
222
|
+
const SidebarTrigger = React.forwardRef<React.ComponentRef<typeof Button>, React.ComponentProps<typeof Button>>(
|
|
223
|
+
({className, onClick, ...props}, ref) => {
|
|
224
|
+
const {toggleSidebar} = useSidebar();
|
|
237
225
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
226
|
+
return (
|
|
227
|
+
<Button
|
|
228
|
+
ref={ref}
|
|
229
|
+
data-sidebar='trigger'
|
|
230
|
+
variant='ghost'
|
|
231
|
+
size='icon'
|
|
232
|
+
className={cn("h-7 w-7", className)}
|
|
233
|
+
onClick={(event) => {
|
|
234
|
+
onClick?.(event);
|
|
235
|
+
toggleSidebar();
|
|
236
|
+
}}
|
|
237
|
+
{...props}>
|
|
238
|
+
<PanelLeft />
|
|
239
|
+
<span className='sr-only'>Toggle Sidebar</span>
|
|
240
|
+
</Button>
|
|
241
|
+
);
|
|
242
|
+
},
|
|
243
|
+
);
|
|
244
|
+
SidebarTrigger.displayName = "SidebarTrigger";
|
|
255
245
|
|
|
256
|
-
|
|
246
|
+
const SidebarRail = React.forwardRef<HTMLButtonElement, React.ComponentProps<"button">>(({className, ...props}, ref) => {
|
|
257
247
|
const {toggleSidebar} = useSidebar();
|
|
258
248
|
|
|
259
249
|
return (
|
|
260
250
|
<button
|
|
251
|
+
ref={ref}
|
|
261
252
|
data-sidebar='rail'
|
|
262
|
-
data-slot='sidebar-rail'
|
|
263
253
|
aria-label='Toggle Sidebar'
|
|
264
254
|
tabIndex={-1}
|
|
255
|
+
type='button'
|
|
265
256
|
onClick={toggleSidebar}
|
|
266
257
|
title='Toggle Sidebar'
|
|
267
258
|
className={cn(
|
|
268
259
|
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
|
|
269
|
-
"
|
|
260
|
+
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
|
|
270
261
|
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
271
|
-
"
|
|
262
|
+
"group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
272
263
|
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
273
264
|
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
274
265
|
className,
|
|
@@ -276,159 +267,177 @@ function SidebarRail({className, ...props}: React.ComponentProps<"button">) {
|
|
|
276
267
|
{...props}
|
|
277
268
|
/>
|
|
278
269
|
);
|
|
279
|
-
}
|
|
270
|
+
});
|
|
271
|
+
SidebarRail.displayName = "SidebarRail";
|
|
280
272
|
|
|
281
|
-
|
|
273
|
+
const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<"main">>(({className, ...props}, ref) => {
|
|
282
274
|
return (
|
|
283
275
|
<main
|
|
284
|
-
|
|
276
|
+
ref={ref}
|
|
285
277
|
className={cn(
|
|
286
278
|
"relative flex w-full flex-1 flex-col bg-white dark:bg-neutral-950",
|
|
287
|
-
"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
|
|
279
|
+
"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 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2",
|
|
288
280
|
className,
|
|
289
281
|
)}
|
|
290
282
|
{...props}
|
|
291
283
|
/>
|
|
292
284
|
);
|
|
293
|
-
}
|
|
285
|
+
});
|
|
286
|
+
SidebarInset.displayName = "SidebarInset";
|
|
294
287
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
288
|
+
const SidebarInput = React.forwardRef<React.ComponentRef<typeof Input>, React.ComponentProps<typeof Input>>(
|
|
289
|
+
({className, ...props}, ref) => {
|
|
290
|
+
return (
|
|
291
|
+
<Input
|
|
292
|
+
ref={ref}
|
|
293
|
+
data-sidebar='input'
|
|
294
|
+
className={cn(
|
|
295
|
+
"focus-visible:ring-sidebar-ring h-8 w-full bg-white shadow-none focus-visible:ring-2 dark:bg-neutral-950",
|
|
296
|
+
className,
|
|
297
|
+
)}
|
|
298
|
+
{...props}
|
|
299
|
+
/>
|
|
300
|
+
);
|
|
301
|
+
},
|
|
302
|
+
);
|
|
303
|
+
SidebarInput.displayName = "SidebarInput";
|
|
305
304
|
|
|
306
|
-
|
|
305
|
+
const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
307
306
|
return (
|
|
308
307
|
<div
|
|
309
|
-
|
|
308
|
+
ref={ref}
|
|
310
309
|
data-sidebar='header'
|
|
311
310
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
312
311
|
{...props}
|
|
313
312
|
/>
|
|
314
313
|
);
|
|
315
|
-
}
|
|
314
|
+
});
|
|
315
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
318
318
|
return (
|
|
319
319
|
<div
|
|
320
|
-
|
|
320
|
+
ref={ref}
|
|
321
321
|
data-sidebar='footer'
|
|
322
322
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
323
323
|
{...props}
|
|
324
324
|
/>
|
|
325
325
|
);
|
|
326
|
-
}
|
|
326
|
+
});
|
|
327
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
327
328
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
329
|
+
const SidebarSeparator = React.forwardRef<React.ComponentRef<typeof Separator>, React.ComponentProps<typeof Separator>>(
|
|
330
|
+
({className, ...props}, ref) => {
|
|
331
|
+
return (
|
|
332
|
+
<Separator
|
|
333
|
+
ref={ref}
|
|
334
|
+
data-sidebar='separator'
|
|
335
|
+
className={cn("bg-sidebar-border mx-2 w-auto", className)}
|
|
336
|
+
{...props}
|
|
337
|
+
/>
|
|
338
|
+
);
|
|
339
|
+
},
|
|
340
|
+
);
|
|
341
|
+
SidebarSeparator.displayName = "SidebarSeparator";
|
|
338
342
|
|
|
339
|
-
|
|
343
|
+
const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
340
344
|
return (
|
|
341
345
|
<div
|
|
342
|
-
|
|
346
|
+
ref={ref}
|
|
343
347
|
data-sidebar='content'
|
|
344
348
|
className={cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className)}
|
|
345
349
|
{...props}
|
|
346
350
|
/>
|
|
347
351
|
);
|
|
348
|
-
}
|
|
352
|
+
});
|
|
353
|
+
SidebarContent.displayName = "SidebarContent";
|
|
349
354
|
|
|
350
|
-
|
|
355
|
+
const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
351
356
|
return (
|
|
352
357
|
<div
|
|
353
|
-
|
|
358
|
+
ref={ref}
|
|
354
359
|
data-sidebar='group'
|
|
355
360
|
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
356
361
|
{...props}
|
|
357
362
|
/>
|
|
358
363
|
);
|
|
359
|
-
}
|
|
364
|
+
});
|
|
365
|
+
SidebarGroup.displayName = "SidebarGroup";
|
|
360
366
|
|
|
361
|
-
|
|
362
|
-
|
|
367
|
+
const SidebarGroupLabel = React.forwardRef<HTMLDivElement, React.ComponentProps<"div"> & {asChild?: boolean}>(
|
|
368
|
+
({className, asChild = false, ...props}, ref) => {
|
|
369
|
+
const Comp = asChild ? Slot : "div";
|
|
363
370
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const Comp = asChild ? Slot : "button";
|
|
380
|
-
|
|
381
|
-
return (
|
|
382
|
-
<Comp
|
|
383
|
-
data-slot='sidebar-group-action'
|
|
384
|
-
data-sidebar='group-action'
|
|
385
|
-
className={cn(
|
|
386
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
387
|
-
// Increases the hit area of the button on mobile.
|
|
388
|
-
"after:absolute after:-inset-2 md:after:hidden",
|
|
389
|
-
"group-data-[collapsible=icon]:hidden",
|
|
390
|
-
className,
|
|
391
|
-
)}
|
|
392
|
-
{...props}
|
|
393
|
-
/>
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function SidebarGroupContent({className, ...props}: React.ComponentProps<"div">) {
|
|
398
|
-
return (
|
|
399
|
-
<div
|
|
400
|
-
data-slot='sidebar-group-content'
|
|
401
|
-
data-sidebar='group-content'
|
|
402
|
-
className={cn("w-full text-sm", className)}
|
|
403
|
-
{...props}
|
|
404
|
-
/>
|
|
405
|
-
);
|
|
406
|
-
}
|
|
371
|
+
return (
|
|
372
|
+
<Comp
|
|
373
|
+
ref={ref}
|
|
374
|
+
data-sidebar='group-label'
|
|
375
|
+
className={cn(
|
|
376
|
+
"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
377
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
378
|
+
className,
|
|
379
|
+
)}
|
|
380
|
+
{...props}
|
|
381
|
+
/>
|
|
382
|
+
);
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
407
386
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
data-slot='sidebar-menu'
|
|
412
|
-
data-sidebar='menu'
|
|
413
|
-
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
414
|
-
{...props}
|
|
415
|
-
/>
|
|
416
|
-
);
|
|
417
|
-
}
|
|
387
|
+
const SidebarGroupAction = React.forwardRef<HTMLButtonElement, React.ComponentProps<"button"> & {asChild?: boolean}>(
|
|
388
|
+
({className, asChild = false, ...props}, ref) => {
|
|
389
|
+
const Comp = asChild ? Slot : "button";
|
|
418
390
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
391
|
+
return (
|
|
392
|
+
<Comp
|
|
393
|
+
ref={ref}
|
|
394
|
+
data-sidebar='group-action'
|
|
395
|
+
className={cn(
|
|
396
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
397
|
+
// Increases the hit area of the button on mobile.
|
|
398
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
399
|
+
"group-data-[collapsible=icon]:hidden",
|
|
400
|
+
className,
|
|
401
|
+
)}
|
|
402
|
+
{...props}
|
|
403
|
+
/>
|
|
404
|
+
);
|
|
405
|
+
},
|
|
406
|
+
);
|
|
407
|
+
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
408
|
+
|
|
409
|
+
const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => (
|
|
410
|
+
<div
|
|
411
|
+
ref={ref}
|
|
412
|
+
data-sidebar='group-content'
|
|
413
|
+
className={cn("w-full text-sm", className)}
|
|
414
|
+
{...props}
|
|
415
|
+
/>
|
|
416
|
+
));
|
|
417
|
+
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
418
|
+
|
|
419
|
+
const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(({className, ...props}, ref) => (
|
|
420
|
+
<ul
|
|
421
|
+
ref={ref}
|
|
422
|
+
data-sidebar='menu'
|
|
423
|
+
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
424
|
+
{...props}
|
|
425
|
+
/>
|
|
426
|
+
));
|
|
427
|
+
SidebarMenu.displayName = "SidebarMenu";
|
|
428
|
+
|
|
429
|
+
const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({className, ...props}, ref) => (
|
|
430
|
+
<li
|
|
431
|
+
ref={ref}
|
|
432
|
+
data-sidebar='menu-item'
|
|
433
|
+
className={cn("group/menu-item relative", className)}
|
|
434
|
+
{...props}
|
|
435
|
+
/>
|
|
436
|
+
));
|
|
437
|
+
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
429
438
|
|
|
430
439
|
const sidebarMenuButtonVariants = cva(
|
|
431
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-
|
|
440
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] 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 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 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 group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
432
441
|
{
|
|
433
442
|
variants: {
|
|
434
443
|
variant: {
|
|
@@ -439,7 +448,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
439
448
|
size: {
|
|
440
449
|
default: "h-8 text-sm",
|
|
441
450
|
sm: "h-7 text-xs",
|
|
442
|
-
lg: "h-12 text-sm group-data-[collapsible=icon]
|
|
451
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
|
|
443
452
|
},
|
|
444
453
|
},
|
|
445
454
|
defaultVariants: {
|
|
@@ -449,25 +458,20 @@ const sidebarMenuButtonVariants = cva(
|
|
|
449
458
|
},
|
|
450
459
|
);
|
|
451
460
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}: React.ComponentProps<"button"> & {
|
|
461
|
-
asChild?: boolean;
|
|
462
|
-
isActive?: boolean;
|
|
463
|
-
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
464
|
-
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
461
|
+
const SidebarMenuButton = React.forwardRef<
|
|
462
|
+
HTMLButtonElement,
|
|
463
|
+
React.ComponentProps<"button"> & {
|
|
464
|
+
asChild?: boolean;
|
|
465
|
+
isActive?: boolean;
|
|
466
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
467
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>
|
|
468
|
+
>(({asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props}, ref) => {
|
|
465
469
|
const Comp = asChild ? Slot : "button";
|
|
466
470
|
const {isMobile, state} = useSidebar();
|
|
467
471
|
|
|
468
472
|
const button = (
|
|
469
473
|
<Comp
|
|
470
|
-
|
|
474
|
+
ref={ref}
|
|
471
475
|
data-sidebar='menu-button'
|
|
472
476
|
data-size={size}
|
|
473
477
|
data-active={isActive}
|
|
@@ -497,27 +501,26 @@ function SidebarMenuButton({
|
|
|
497
501
|
/>
|
|
498
502
|
</Tooltip>
|
|
499
503
|
);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}) {
|
|
504
|
+
});
|
|
505
|
+
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
506
|
+
|
|
507
|
+
const SidebarMenuAction = React.forwardRef<
|
|
508
|
+
HTMLButtonElement,
|
|
509
|
+
React.ComponentProps<"button"> & {
|
|
510
|
+
asChild?: boolean;
|
|
511
|
+
showOnHover?: boolean;
|
|
512
|
+
}
|
|
513
|
+
>(({className, asChild = false, showOnHover = false, ...props}, ref) => {
|
|
511
514
|
const Comp = asChild ? Slot : "button";
|
|
512
515
|
|
|
513
516
|
return (
|
|
514
517
|
<Comp
|
|
515
|
-
|
|
518
|
+
ref={ref}
|
|
516
519
|
data-sidebar='menu-action'
|
|
517
520
|
className={cn(
|
|
518
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0
|
|
521
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
519
522
|
// Increases the hit area of the button on mobile.
|
|
520
|
-
"after:absolute after:-inset-2 md:
|
|
523
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
521
524
|
"peer-data-[size=sm]/menu-button:top-1",
|
|
522
525
|
"peer-data-[size=default]/menu-button:top-1.5",
|
|
523
526
|
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
@@ -529,34 +532,33 @@ function SidebarMenuAction({
|
|
|
529
532
|
{...props}
|
|
530
533
|
/>
|
|
531
534
|
);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
}) {
|
|
535
|
+
});
|
|
536
|
+
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
537
|
+
|
|
538
|
+
const SidebarMenuBadge = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => (
|
|
539
|
+
<div
|
|
540
|
+
ref={ref}
|
|
541
|
+
data-sidebar='menu-badge'
|
|
542
|
+
className={cn(
|
|
543
|
+
"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
|
|
544
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
545
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
546
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
547
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
548
|
+
"group-data-[collapsible=icon]:hidden",
|
|
549
|
+
className,
|
|
550
|
+
)}
|
|
551
|
+
{...props}
|
|
552
|
+
/>
|
|
553
|
+
));
|
|
554
|
+
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
555
|
+
|
|
556
|
+
const SidebarMenuSkeleton = React.forwardRef<
|
|
557
|
+
HTMLDivElement,
|
|
558
|
+
React.ComponentProps<"div"> & {
|
|
559
|
+
showIcon?: boolean;
|
|
560
|
+
}
|
|
561
|
+
>(({className, showIcon = false, ...props}, ref) => {
|
|
560
562
|
// Random width between 50 to 90%.
|
|
561
563
|
const width = React.useMemo(() => {
|
|
562
564
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
@@ -564,7 +566,7 @@ function SidebarMenuSkeleton({
|
|
|
564
566
|
|
|
565
567
|
return (
|
|
566
568
|
<div
|
|
567
|
-
|
|
569
|
+
ref={ref}
|
|
568
570
|
data-sidebar='menu-skeleton'
|
|
569
571
|
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
570
572
|
{...props}>
|
|
@@ -575,7 +577,7 @@ function SidebarMenuSkeleton({
|
|
|
575
577
|
/>
|
|
576
578
|
)}
|
|
577
579
|
<Skeleton
|
|
578
|
-
className='h-4 max-w-
|
|
580
|
+
className='h-4 max-w-[--skeleton-width] flex-1'
|
|
579
581
|
data-sidebar='menu-skeleton-text'
|
|
580
582
|
style={
|
|
581
583
|
{
|
|
@@ -585,55 +587,49 @@ function SidebarMenuSkeleton({
|
|
|
585
587
|
/>
|
|
586
588
|
</div>
|
|
587
589
|
);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
...props
|
|
622
|
-
}: React.ComponentProps<"a"> & {
|
|
623
|
-
asChild?: boolean;
|
|
624
|
-
size?: "sm" | "md";
|
|
625
|
-
isActive?: boolean;
|
|
626
|
-
}) {
|
|
590
|
+
});
|
|
591
|
+
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
592
|
+
|
|
593
|
+
const SidebarMenuSub = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(({className, ...props}, ref) => (
|
|
594
|
+
<ul
|
|
595
|
+
ref={ref}
|
|
596
|
+
data-sidebar='menu-sub'
|
|
597
|
+
className={cn(
|
|
598
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
|
|
599
|
+
"group-data-[collapsible=icon]:hidden",
|
|
600
|
+
className,
|
|
601
|
+
)}
|
|
602
|
+
{...props}
|
|
603
|
+
/>
|
|
604
|
+
));
|
|
605
|
+
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
606
|
+
|
|
607
|
+
const SidebarMenuSubItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({...props}, ref) => (
|
|
608
|
+
<li
|
|
609
|
+
ref={ref}
|
|
610
|
+
{...props}
|
|
611
|
+
/>
|
|
612
|
+
));
|
|
613
|
+
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
614
|
+
|
|
615
|
+
const SidebarMenuSubButton = React.forwardRef<
|
|
616
|
+
HTMLAnchorElement,
|
|
617
|
+
React.ComponentProps<"a"> & {
|
|
618
|
+
asChild?: boolean;
|
|
619
|
+
size?: "sm" | "md";
|
|
620
|
+
isActive?: boolean;
|
|
621
|
+
}
|
|
622
|
+
>(({asChild = false, size = "md", isActive, className, ...props}, ref) => {
|
|
627
623
|
const Comp = asChild ? Slot : "a";
|
|
628
624
|
|
|
629
625
|
return (
|
|
630
626
|
<Comp
|
|
631
|
-
|
|
627
|
+
ref={ref}
|
|
632
628
|
data-sidebar='menu-sub-button'
|
|
633
629
|
data-size={size}
|
|
634
630
|
data-active={isActive}
|
|
635
631
|
className={cn(
|
|
636
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-
|
|
632
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
637
633
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
638
634
|
size === "sm" && "text-xs",
|
|
639
635
|
size === "md" && "text-sm",
|
|
@@ -643,7 +639,8 @@ function SidebarMenuSubButton({
|
|
|
643
639
|
{...props}
|
|
644
640
|
/>
|
|
645
641
|
);
|
|
646
|
-
}
|
|
642
|
+
});
|
|
643
|
+
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
647
644
|
|
|
648
645
|
export {
|
|
649
646
|
Sidebar,
|