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