@arolariu/components 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +11 -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.d.ts.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 +30 -21
- 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 +3 -4
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +3 -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 +25 -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 +28 -27
- 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 +23 -26
- 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 +37 -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 -5
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +9 -21
- 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 +113 -122
- 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 +23 -25
- package/src/components/ui/aspect-ratio.tsx +1 -9
- package/src/components/ui/avatar.tsx +29 -24
- 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 -22
- package/src/components/ui/card.tsx +52 -71
- package/src/components/ui/carousel.tsx +145 -133
- package/src/components/ui/chart.tsx +173 -183
- package/src/components/ui/checkbox.tsx +18 -18
- package/src/components/ui/collapsible.tsx +3 -25
- package/src/components/ui/command.tsx +100 -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 +198 -0
- package/src/components/ui/form.tsx +47 -48
- 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 +85 -100
- package/src/components/ui/pagination.tsx +74 -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 -37
- 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 +262 -271
- package/src/components/ui/skeleton.tsx +2 -3
- package/src/components/ui/slider.tsx +10 -36
- 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
|
|
|
@@ -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,87 @@ 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.ElementRef<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}
|
|
265
255
|
onClick={toggleSidebar}
|
|
266
256
|
title='Toggle Sidebar'
|
|
267
257
|
className={cn(
|
|
268
258
|
"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
|
-
"
|
|
259
|
+
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
|
|
270
260
|
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
271
|
-
"
|
|
261
|
+
"group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
272
262
|
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
273
263
|
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
274
264
|
className,
|
|
@@ -276,159 +266,172 @@ function SidebarRail({className, ...props}: React.ComponentProps<"button">) {
|
|
|
276
266
|
{...props}
|
|
277
267
|
/>
|
|
278
268
|
);
|
|
279
|
-
}
|
|
269
|
+
});
|
|
270
|
+
SidebarRail.displayName = "SidebarRail";
|
|
280
271
|
|
|
281
|
-
|
|
272
|
+
const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<"main">>(({className, ...props}, ref) => {
|
|
282
273
|
return (
|
|
283
274
|
<main
|
|
284
|
-
|
|
275
|
+
ref={ref}
|
|
285
276
|
className={cn(
|
|
286
277
|
"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
|
|
278
|
+
"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
279
|
className,
|
|
289
280
|
)}
|
|
290
281
|
{...props}
|
|
291
282
|
/>
|
|
292
283
|
);
|
|
293
|
-
}
|
|
284
|
+
});
|
|
285
|
+
SidebarInset.displayName = "SidebarInset";
|
|
294
286
|
|
|
295
|
-
|
|
287
|
+
const SidebarInput = React.forwardRef<React.ElementRef<typeof Input>, React.ComponentProps<typeof Input>>(({className, ...props}, ref) => {
|
|
296
288
|
return (
|
|
297
289
|
<Input
|
|
298
|
-
|
|
290
|
+
ref={ref}
|
|
299
291
|
data-sidebar='input'
|
|
300
|
-
className={cn("h-8 w-full bg-white shadow-none dark:bg-neutral-950", className)}
|
|
292
|
+
className={cn("focus-visible:ring-sidebar-ring h-8 w-full bg-white shadow-none focus-visible:ring-2 dark:bg-neutral-950", className)}
|
|
301
293
|
{...props}
|
|
302
294
|
/>
|
|
303
295
|
);
|
|
304
|
-
}
|
|
296
|
+
});
|
|
297
|
+
SidebarInput.displayName = "SidebarInput";
|
|
305
298
|
|
|
306
|
-
|
|
299
|
+
const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
307
300
|
return (
|
|
308
301
|
<div
|
|
309
|
-
|
|
302
|
+
ref={ref}
|
|
310
303
|
data-sidebar='header'
|
|
311
304
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
312
305
|
{...props}
|
|
313
306
|
/>
|
|
314
307
|
);
|
|
315
|
-
}
|
|
308
|
+
});
|
|
309
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
316
310
|
|
|
317
|
-
|
|
311
|
+
const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
318
312
|
return (
|
|
319
313
|
<div
|
|
320
|
-
|
|
314
|
+
ref={ref}
|
|
321
315
|
data-sidebar='footer'
|
|
322
316
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
323
317
|
{...props}
|
|
324
318
|
/>
|
|
325
319
|
);
|
|
326
|
-
}
|
|
320
|
+
});
|
|
321
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
327
322
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
323
|
+
const SidebarSeparator = React.forwardRef<React.ElementRef<typeof Separator>, React.ComponentProps<typeof Separator>>(
|
|
324
|
+
({className, ...props}, ref) => {
|
|
325
|
+
return (
|
|
326
|
+
<Separator
|
|
327
|
+
ref={ref}
|
|
328
|
+
data-sidebar='separator'
|
|
329
|
+
className={cn("bg-sidebar-border mx-2 w-auto", className)}
|
|
330
|
+
{...props}
|
|
331
|
+
/>
|
|
332
|
+
);
|
|
333
|
+
},
|
|
334
|
+
);
|
|
335
|
+
SidebarSeparator.displayName = "SidebarSeparator";
|
|
338
336
|
|
|
339
|
-
|
|
337
|
+
const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
340
338
|
return (
|
|
341
339
|
<div
|
|
342
|
-
|
|
340
|
+
ref={ref}
|
|
343
341
|
data-sidebar='content'
|
|
344
342
|
className={cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className)}
|
|
345
343
|
{...props}
|
|
346
344
|
/>
|
|
347
345
|
);
|
|
348
|
-
}
|
|
346
|
+
});
|
|
347
|
+
SidebarContent.displayName = "SidebarContent";
|
|
349
348
|
|
|
350
|
-
|
|
349
|
+
const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => {
|
|
351
350
|
return (
|
|
352
351
|
<div
|
|
353
|
-
|
|
352
|
+
ref={ref}
|
|
354
353
|
data-sidebar='group'
|
|
355
354
|
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
356
355
|
{...props}
|
|
357
356
|
/>
|
|
358
357
|
);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function SidebarGroupLabel({className, asChild = false, ...props}: React.ComponentProps<"div"> & {asChild?: boolean}) {
|
|
362
|
-
const Comp = asChild ? Slot : "div";
|
|
363
|
-
|
|
364
|
-
return (
|
|
365
|
-
<Comp
|
|
366
|
-
data-slot='sidebar-group-label'
|
|
367
|
-
data-sidebar='group-label'
|
|
368
|
-
className={cn(
|
|
369
|
-
"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
370
|
-
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
371
|
-
className,
|
|
372
|
-
)}
|
|
373
|
-
{...props}
|
|
374
|
-
/>
|
|
375
|
-
);
|
|
376
|
-
}
|
|
358
|
+
});
|
|
359
|
+
SidebarGroup.displayName = "SidebarGroup";
|
|
377
360
|
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
}
|
|
361
|
+
const SidebarGroupLabel = React.forwardRef<HTMLDivElement, React.ComponentProps<"div"> & {asChild?: boolean}>(
|
|
362
|
+
({className, asChild = false, ...props}, ref) => {
|
|
363
|
+
const Comp = asChild ? Slot : "div";
|
|
396
364
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
365
|
+
return (
|
|
366
|
+
<Comp
|
|
367
|
+
ref={ref}
|
|
368
|
+
data-sidebar='group-label'
|
|
369
|
+
className={cn(
|
|
370
|
+
"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",
|
|
371
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
372
|
+
className,
|
|
373
|
+
)}
|
|
374
|
+
{...props}
|
|
375
|
+
/>
|
|
376
|
+
);
|
|
377
|
+
},
|
|
378
|
+
);
|
|
379
|
+
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
407
380
|
|
|
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
|
-
}
|
|
381
|
+
const SidebarGroupAction = React.forwardRef<HTMLButtonElement, React.ComponentProps<"button"> & {asChild?: boolean}>(
|
|
382
|
+
({className, asChild = false, ...props}, ref) => {
|
|
383
|
+
const Comp = asChild ? Slot : "button";
|
|
418
384
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
385
|
+
return (
|
|
386
|
+
<Comp
|
|
387
|
+
ref={ref}
|
|
388
|
+
data-sidebar='group-action'
|
|
389
|
+
className={cn(
|
|
390
|
+
"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",
|
|
391
|
+
// Increases the hit area of the button on mobile.
|
|
392
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
393
|
+
"group-data-[collapsible=icon]:hidden",
|
|
394
|
+
className,
|
|
395
|
+
)}
|
|
396
|
+
{...props}
|
|
397
|
+
/>
|
|
398
|
+
);
|
|
399
|
+
},
|
|
400
|
+
);
|
|
401
|
+
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
402
|
+
|
|
403
|
+
const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => (
|
|
404
|
+
<div
|
|
405
|
+
ref={ref}
|
|
406
|
+
data-sidebar='group-content'
|
|
407
|
+
className={cn("w-full text-sm", className)}
|
|
408
|
+
{...props}
|
|
409
|
+
/>
|
|
410
|
+
));
|
|
411
|
+
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
412
|
+
|
|
413
|
+
const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(({className, ...props}, ref) => (
|
|
414
|
+
<ul
|
|
415
|
+
ref={ref}
|
|
416
|
+
data-sidebar='menu'
|
|
417
|
+
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
418
|
+
{...props}
|
|
419
|
+
/>
|
|
420
|
+
));
|
|
421
|
+
SidebarMenu.displayName = "SidebarMenu";
|
|
422
|
+
|
|
423
|
+
const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({className, ...props}, ref) => (
|
|
424
|
+
<li
|
|
425
|
+
ref={ref}
|
|
426
|
+
data-sidebar='menu-item'
|
|
427
|
+
className={cn("group/menu-item relative", className)}
|
|
428
|
+
{...props}
|
|
429
|
+
/>
|
|
430
|
+
));
|
|
431
|
+
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
429
432
|
|
|
430
433
|
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-
|
|
434
|
+
"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
435
|
{
|
|
433
436
|
variants: {
|
|
434
437
|
variant: {
|
|
@@ -439,7 +442,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
439
442
|
size: {
|
|
440
443
|
default: "h-8 text-sm",
|
|
441
444
|
sm: "h-7 text-xs",
|
|
442
|
-
lg: "h-12 text-sm group-data-[collapsible=icon]
|
|
445
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
|
|
443
446
|
},
|
|
444
447
|
},
|
|
445
448
|
defaultVariants: {
|
|
@@ -449,25 +452,20 @@ const sidebarMenuButtonVariants = cva(
|
|
|
449
452
|
},
|
|
450
453
|
);
|
|
451
454
|
|
|
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>) {
|
|
455
|
+
const SidebarMenuButton = React.forwardRef<
|
|
456
|
+
HTMLButtonElement,
|
|
457
|
+
React.ComponentProps<"button"> & {
|
|
458
|
+
asChild?: boolean;
|
|
459
|
+
isActive?: boolean;
|
|
460
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
461
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>
|
|
462
|
+
>(({asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props}, ref) => {
|
|
465
463
|
const Comp = asChild ? Slot : "button";
|
|
466
464
|
const {isMobile, state} = useSidebar();
|
|
467
465
|
|
|
468
466
|
const button = (
|
|
469
467
|
<Comp
|
|
470
|
-
|
|
468
|
+
ref={ref}
|
|
471
469
|
data-sidebar='menu-button'
|
|
472
470
|
data-size={size}
|
|
473
471
|
data-active={isActive}
|
|
@@ -497,27 +495,26 @@ function SidebarMenuButton({
|
|
|
497
495
|
/>
|
|
498
496
|
</Tooltip>
|
|
499
497
|
);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}) {
|
|
498
|
+
});
|
|
499
|
+
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
500
|
+
|
|
501
|
+
const SidebarMenuAction = React.forwardRef<
|
|
502
|
+
HTMLButtonElement,
|
|
503
|
+
React.ComponentProps<"button"> & {
|
|
504
|
+
asChild?: boolean;
|
|
505
|
+
showOnHover?: boolean;
|
|
506
|
+
}
|
|
507
|
+
>(({className, asChild = false, showOnHover = false, ...props}, ref) => {
|
|
511
508
|
const Comp = asChild ? Slot : "button";
|
|
512
509
|
|
|
513
510
|
return (
|
|
514
511
|
<Comp
|
|
515
|
-
|
|
512
|
+
ref={ref}
|
|
516
513
|
data-sidebar='menu-action'
|
|
517
514
|
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
|
|
515
|
+
"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
516
|
// Increases the hit area of the button on mobile.
|
|
520
|
-
"after:absolute after:-inset-2 md:
|
|
517
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
521
518
|
"peer-data-[size=sm]/menu-button:top-1",
|
|
522
519
|
"peer-data-[size=default]/menu-button:top-1.5",
|
|
523
520
|
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
@@ -529,34 +526,33 @@ function SidebarMenuAction({
|
|
|
529
526
|
{...props}
|
|
530
527
|
/>
|
|
531
528
|
);
|
|
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
|
-
}) {
|
|
529
|
+
});
|
|
530
|
+
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
531
|
+
|
|
532
|
+
const SidebarMenuBadge = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(({className, ...props}, ref) => (
|
|
533
|
+
<div
|
|
534
|
+
ref={ref}
|
|
535
|
+
data-sidebar='menu-badge'
|
|
536
|
+
className={cn(
|
|
537
|
+
"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",
|
|
538
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
539
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
540
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
541
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
542
|
+
"group-data-[collapsible=icon]:hidden",
|
|
543
|
+
className,
|
|
544
|
+
)}
|
|
545
|
+
{...props}
|
|
546
|
+
/>
|
|
547
|
+
));
|
|
548
|
+
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
549
|
+
|
|
550
|
+
const SidebarMenuSkeleton = React.forwardRef<
|
|
551
|
+
HTMLDivElement,
|
|
552
|
+
React.ComponentProps<"div"> & {
|
|
553
|
+
showIcon?: boolean;
|
|
554
|
+
}
|
|
555
|
+
>(({className, showIcon = false, ...props}, ref) => {
|
|
560
556
|
// Random width between 50 to 90%.
|
|
561
557
|
const width = React.useMemo(() => {
|
|
562
558
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
@@ -564,7 +560,7 @@ function SidebarMenuSkeleton({
|
|
|
564
560
|
|
|
565
561
|
return (
|
|
566
562
|
<div
|
|
567
|
-
|
|
563
|
+
ref={ref}
|
|
568
564
|
data-sidebar='menu-skeleton'
|
|
569
565
|
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
570
566
|
{...props}>
|
|
@@ -575,7 +571,7 @@ function SidebarMenuSkeleton({
|
|
|
575
571
|
/>
|
|
576
572
|
)}
|
|
577
573
|
<Skeleton
|
|
578
|
-
className='h-4 max-w-
|
|
574
|
+
className='h-4 max-w-[--skeleton-width] flex-1'
|
|
579
575
|
data-sidebar='menu-skeleton-text'
|
|
580
576
|
style={
|
|
581
577
|
{
|
|
@@ -585,55 +581,49 @@ function SidebarMenuSkeleton({
|
|
|
585
581
|
/>
|
|
586
582
|
</div>
|
|
587
583
|
);
|
|
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
|
-
}) {
|
|
584
|
+
});
|
|
585
|
+
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
586
|
+
|
|
587
|
+
const SidebarMenuSub = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(({className, ...props}, ref) => (
|
|
588
|
+
<ul
|
|
589
|
+
ref={ref}
|
|
590
|
+
data-sidebar='menu-sub'
|
|
591
|
+
className={cn(
|
|
592
|
+
"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",
|
|
593
|
+
"group-data-[collapsible=icon]:hidden",
|
|
594
|
+
className,
|
|
595
|
+
)}
|
|
596
|
+
{...props}
|
|
597
|
+
/>
|
|
598
|
+
));
|
|
599
|
+
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
600
|
+
|
|
601
|
+
const SidebarMenuSubItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({...props}, ref) => (
|
|
602
|
+
<li
|
|
603
|
+
ref={ref}
|
|
604
|
+
{...props}
|
|
605
|
+
/>
|
|
606
|
+
));
|
|
607
|
+
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
608
|
+
|
|
609
|
+
const SidebarMenuSubButton = React.forwardRef<
|
|
610
|
+
HTMLAnchorElement,
|
|
611
|
+
React.ComponentProps<"a"> & {
|
|
612
|
+
asChild?: boolean;
|
|
613
|
+
size?: "sm" | "md";
|
|
614
|
+
isActive?: boolean;
|
|
615
|
+
}
|
|
616
|
+
>(({asChild = false, size = "md", isActive, className, ...props}, ref) => {
|
|
627
617
|
const Comp = asChild ? Slot : "a";
|
|
628
618
|
|
|
629
619
|
return (
|
|
630
620
|
<Comp
|
|
631
|
-
|
|
621
|
+
ref={ref}
|
|
632
622
|
data-sidebar='menu-sub-button'
|
|
633
623
|
data-size={size}
|
|
634
624
|
data-active={isActive}
|
|
635
625
|
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-
|
|
626
|
+
"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
627
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
638
628
|
size === "sm" && "text-xs",
|
|
639
629
|
size === "md" && "text-sm",
|
|
@@ -643,7 +633,8 @@ function SidebarMenuSubButton({
|
|
|
643
633
|
{...props}
|
|
644
634
|
/>
|
|
645
635
|
);
|
|
646
|
-
}
|
|
636
|
+
});
|
|
637
|
+
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
647
638
|
|
|
648
639
|
export {
|
|
649
640
|
Sidebar,
|