{"name":"sidebar","dependencies":["@base-ui/react","class-variance-authority","lucide-react"],"registryDependencies":["@herocn/button","@herocn/input","@herocn/separator","@herocn/sheet","@herocn/skeleton","@herocn/tooltip","@herocn/use-mobile"],"files":[{"path":"sidebar.tsx","content":"\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"cn\";\nimport { PanelLeftIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n\tSheet,\n\tSheetContent,\n\tSheetDescription,\n\tSheetHeader,\n\tSheetTitle,\n} from \"@/components/ui/sheet\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipTrigger,\n} from \"@/components/ui/tooltip\";\n\nconst SIDEBAR_COOKIE_NAME = \"sidebar_state\";\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\ntype SidebarContextProps = {\n\tstate: \"expanded\" | \"collapsed\";\n\topen: boolean;\n\tsetOpen: (open: boolean) => void;\n\topenMobile: boolean;\n\tsetOpenMobile: (open: boolean) => void;\n\tisMobile: boolean;\n\ttoggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n\tconst context = React.useContext(SidebarContext);\n\tif (!context) {\n\t\tthrow new Error(\"useSidebar must be used within a SidebarProvider.\");\n\t}\n\n\treturn context;\n}\n\nfunction SidebarProvider({\n\tdefaultOpen = true,\n\topen: openProp,\n\tonOpenChange: setOpenProp,\n\tclassName,\n\tstyle,\n\tchildren,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tdefaultOpen?: boolean;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n}) {\n\tconst isMobile = useIsMobile();\n\tconst [openMobile, setOpenMobile] = React.useState(false);\n\n\t// This is the internal state of the sidebar.\n\t// We use openProp and setOpenProp for control from outside the component.\n\tconst [_open, _setOpen] = React.useState(defaultOpen);\n\tconst open = openProp ?? _open;\n\tconst setOpen = React.useCallback(\n\t\t(value: boolean | ((value: boolean) => boolean)) => {\n\t\t\tconst openState = typeof value === \"function\" ? value(open) : value;\n\t\t\tif (setOpenProp) {\n\t\t\t\tsetOpenProp(openState);\n\t\t\t} else {\n\t\t\t\t_setOpen(openState);\n\t\t\t}\n\n\t\t\t// This sets the cookie to keep the sidebar state.\n\t\t\tdocument.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n\t\t},\n\t\t[setOpenProp, open],\n\t);\n\n\t// Helper to toggle the sidebar.\n\tconst toggleSidebar = React.useCallback(() => {\n\t\treturn isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);\n\t}, [isMobile, setOpen]);\n\n\t// Adds a keyboard shortcut to toggle the sidebar.\n\tReact.useEffect(() => {\n\t\tconst handleKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (\n\t\t\t\tevent.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n\t\t\t\t(event.metaKey || event.ctrlKey)\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleSidebar();\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(\"keydown\", handleKeyDown);\n\t\treturn () => window.removeEventListener(\"keydown\", handleKeyDown);\n\t}, [toggleSidebar]);\n\n\t// We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n\t// This makes it easier to style the sidebar with Tailwind classes.\n\tconst state = open ? \"expanded\" : \"collapsed\";\n\n\tconst contextValue = React.useMemo<SidebarContextProps>(\n\t\t() => ({\n\t\t\tstate,\n\t\t\topen,\n\t\t\tsetOpen,\n\t\t\tisMobile,\n\t\t\topenMobile,\n\t\t\tsetOpenMobile,\n\t\t\ttoggleSidebar,\n\t\t}),\n\t\t[state, open, setOpen, isMobile, openMobile, toggleSidebar],\n\t);\n\n\treturn (\n\t\t<SidebarContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"sidebar-wrapper\"\n\t\t\t\tstyle={\n\t\t\t\t\t{\n\t\t\t\t\t\t\"--sidebar-width\": SIDEBAR_WIDTH,\n\t\t\t\t\t\t\"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n\t\t\t\t\t\t...style,\n\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</SidebarContext.Provider>\n\t);\n}\n\nfunction Sidebar({\n\tside = \"left\",\n\tvariant = \"sidebar\",\n\tcollapsible = \"offcanvas\",\n\tclassName,\n\tchildren,\n\tdir,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tside?: \"left\" | \"right\";\n\tvariant?: \"sidebar\" | \"floating\" | \"inset\";\n\tcollapsible?: \"offcanvas\" | \"icon\" | \"none\";\n}) {\n\tconst { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n\tif (collapsible === \"none\") {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (isMobile) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"sidebar-variant-marker\"\n\t\t\t\t\tdata-variant={variant}\n\t\t\t\t\tclassName=\"peer hidden\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t/>\n\t\t\t\t<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\n\t\t\t\t\t<SheetContent\n\t\t\t\t\t\tdir={dir}\n\t\t\t\t\t\tdata-sidebar=\"sidebar\"\n\t\t\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\t\t\tdata-mobile=\"true\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"w-(--sidebar-width) p-0 text-sidebar-foreground [&>button]:hidden\",\n\t\t\t\t\t\t\tvariant === \"floating\" ? \"bg-surface\" : \"bg-sidebar\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n\t\t\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t\tside={side}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SheetHeader className=\"sr-only\">\n\t\t\t\t\t\t\t<SheetTitle>Sidebar</SheetTitle>\n\t\t\t\t\t\t\t<SheetDescription>Displays the mobile sidebar.</SheetDescription>\n\t\t\t\t\t\t</SheetHeader>\n\t\t\t\t\t\t<div className=\"flex h-full w-full flex-col\">{children}</div>\n\t\t\t\t\t</SheetContent>\n\t\t\t\t</Sheet>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"group peer hidden text-sidebar-foreground md:block\"\n\t\t\tdata-state={state}\n\t\t\tdata-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n\t\t\tdata-variant={variant}\n\t\t\tdata-side={side}\n\t\t\tdata-slot=\"sidebar\"\n\t\t>\n\t\t\t{/* This is what handles the sidebar gap on desktop */}\n\t\t\t<div\n\t\t\t\tdata-slot=\"sidebar-gap\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear\",\n\t\t\t\t\t\"group-data-[collapsible=offcanvas]:w-0\",\n\t\t\t\t\t\"group-data-[side=right]:rotate-180\",\n\t\t\t\t\tvariant === \"floating\" || variant === \"inset\"\n\t\t\t\t\t\t? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n\t\t\t\t\t\t: \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n\t\t\t\t)}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tdata-slot=\"sidebar-container\"\n\t\t\t\tdata-side={side}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=right]:right-0 data-[side=left]:left-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] md:flex\",\n\t\t\t\t\t// Adjust the padding for floating and inset variants.\n\t\t\t\t\tvariant === \"floating\" || variant === \"inset\"\n\t\t\t\t\t\t? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n\t\t\t\t\t\t: \"border-e group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-sidebar=\"sidebar\"\n\t\t\t\t\tdata-slot=\"sidebar-inner\"\n\t\t\t\t\tclassName=\"relative flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-2xl group-data-[variant=floating]:bg-surface group-data-[variant=floating]:shadow-lg group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border\"\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction SidebarTrigger({\n\tclassName,\n\tonClick,\n\t...props\n}: React.ComponentProps<typeof Button>) {\n\tconst { toggleSidebar } = useSidebar();\n\n\treturn (\n\t\t<Button\n\t\t\tdata-sidebar=\"trigger\"\n\t\t\tdata-slot=\"sidebar-trigger\"\n\t\t\tvariant=\"ghost\"\n\t\t\tsize=\"icon-sm\"\n\t\t\tclassName={cn(className)}\n\t\t\tonClick={(event) => {\n\t\t\t\tonClick?.(event);\n\t\t\t\ttoggleSidebar();\n\t\t\t}}\n\t\t\t{...props}\n\t\t>\n\t\t\t<PanelLeftIcon className=\"rtl:rotate-180\" />\n\t\t\t<span className=\"sr-only\">Toggle Sidebar</span>\n\t\t</Button>\n\t);\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n\tconst { toggleSidebar } = useSidebar();\n\n\treturn (\n\t\t<button\n\t\t\tdata-sidebar=\"rail\"\n\t\t\tdata-slot=\"sidebar-rail\"\n\t\t\taria-label=\"Toggle Sidebar\"\n\t\t\ttabIndex={-1}\n\t\t\tonClick={toggleSidebar}\n\t\t\ttitle=\"Toggle Sidebar\"\n\t\t\tclassName={cn(\n\t\t\t\t\"absolute inset-y-0 z-20 hidden w-4 outline-hidden transition-[translate,background-color,box-shadow] ease-linear after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2\",\n\t\t\t\t\"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize rtl:in-data-[side=left]:cursor-e-resize rtl:in-data-[side=right]:cursor-w-resize\",\n\t\t\t\t\"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize\",\n\t\t\t\t\"group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:start-full rtl:group-data-[collapsible=offcanvas]:-translate-x-0\",\n\t\t\t\t\"[[data-side=left][data-collapsible=offcanvas]_&]:-end-2\",\n\t\t\t\t\"[[data-side=right][data-collapsible=offcanvas]_&]:-start-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n\treturn (\n\t\t<main\n\t\t\tdata-slot=\"sidebar-inset\"\n\t\t\tclassName={cn(\n\t\t\t\t\"relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:border peer-data-[variant=inset]:border-border peer-data-[variant=inset]:bg-surface md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarInput({\n\tclassName,\n\tvariant = \"secondary\",\n\t...props\n}: React.ComponentProps<typeof Input>) {\n\treturn (\n\t\t<Input\n\t\t\tdata-slot=\"sidebar-input\"\n\t\t\tdata-sidebar=\"input\"\n\t\t\tvariant={variant}\n\t\t\tclassName={cn(\"h-8\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-header\"\n\t\t\tdata-sidebar=\"header\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col gap-2 p-2 [--radius:var(--radius-xl)]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-footer\"\n\t\t\tdata-sidebar=\"footer\"\n\t\t\tclassName={cn(\"flex flex-col gap-2 p-2\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarSeparator({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof Separator>) {\n\treturn (\n\t\t<Separator\n\t\t\tdata-slot=\"sidebar-separator\"\n\t\t\tdata-sidebar=\"separator\"\n\t\t\tclassName={cn(\"mx-2 w-auto bg-sidebar-border\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-content\"\n\t\t\tdata-sidebar=\"content\"\n\t\t\tclassName={cn(\n\t\t\t\t\"no-scrollbar scroll-fade-y flex min-h-0 flex-1 flex-col gap-2 overflow-auto [--radius:var(--radius-xl)] group-data-[collapsible=icon]:overflow-hidden\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-group\"\n\t\t\tdata-sidebar=\"group\"\n\t\t\tclassName={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarGroupLabel({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"div\"> & React.ComponentProps<\"div\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\tprops: mergeProps<\"div\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs outline-hidden transition-[margin,opacity,box-shadow] duration-200 ease-linear focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"sidebar-group-label\",\n\t\t\tsidebar: \"group-label\",\n\t\t},\n\t});\n}\n\nfunction SidebarGroupAction({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"button\"> & React.ComponentProps<\"button\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps<\"button\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"absolute end-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-[transform,box-shadow] after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar group-data-[collapsible=icon]:hidden md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"sidebar-group-action\",\n\t\t\tsidebar: \"group-action\",\n\t\t},\n\t});\n}\n\nfunction SidebarGroupContent({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-group-content\"\n\t\t\tdata-sidebar=\"group-content\"\n\t\t\tclassName={cn(\"w-full text-sm\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n\treturn (\n\t\t<ul\n\t\t\tdata-slot=\"sidebar-menu\"\n\t\t\tdata-sidebar=\"menu\"\n\t\t\tclassName={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n\treturn (\n\t\t<li\n\t\t\tdata-slot=\"sidebar-menu-item\"\n\t\t\tdata-sidebar=\"menu-item\"\n\t\t\tclassName={cn(\"group/menu-item relative\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst sidebarMenuButtonVariants = cva(\n\t\"peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-3 py-2 text-start text-sm outline-hidden transition-[width,height,padding,box-shadow] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-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\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n\t\t\t\toutline:\n\t\t\t\t\t\"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: \"h-9 text-sm\",\n\t\t\t\tsm: \"h-8 text-xs\",\n\t\t\t\tlg: \"h-14 px-3 text-sm group-data-[collapsible=icon]:p-0!\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\nfunction SidebarMenuButton({\n\trender,\n\tisActive = false,\n\tvariant = \"default\",\n\tsize = \"default\",\n\ttooltip,\n\tclassName,\n\t...props\n}: useRender.ComponentProps<\"button\"> &\n\tReact.ComponentProps<\"button\"> & {\n\t\tisActive?: boolean;\n\t\ttooltip?: string | React.ComponentProps<typeof TooltipContent>;\n\t} & VariantProps<typeof sidebarMenuButtonVariants>) {\n\tconst { isMobile, state } = useSidebar();\n\tconst comp = useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps<\"button\">(\n\t\t\t{\n\t\t\t\tclassName: cn(sidebarMenuButtonVariants({ variant, size }), className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender: !tooltip ? render : <TooltipTrigger render={render} />,\n\t\tstate: {\n\t\t\tslot: \"sidebar-menu-button\",\n\t\t\tsidebar: \"menu-button\",\n\t\t\tsize,\n\t\t\tactive: isActive,\n\t\t},\n\t});\n\n\tif (!tooltip) {\n\t\treturn comp;\n\t}\n\n\tif (typeof tooltip === \"string\") {\n\t\ttooltip = {\n\t\t\tchildren: tooltip,\n\t\t};\n\t}\n\n\treturn (\n\t\t<Tooltip>\n\t\t\t{comp}\n\t\t\t<TooltipContent\n\t\t\t\tside=\"right\"\n\t\t\t\talign=\"center\"\n\t\t\t\thidden={state !== \"collapsed\" || isMobile}\n\t\t\t\t{...tooltip}\n\t\t\t/>\n\t\t</Tooltip>\n\t);\n}\n\nfunction SidebarMenuAction({\n\tclassName,\n\trender,\n\tshowOnHover = false,\n\t...props\n}: useRender.ComponentProps<\"button\"> &\n\tReact.ComponentProps<\"button\"> & {\n\t\tshowOnHover?: boolean;\n\t}) {\n\treturn useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps<\"button\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"absolute end-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-[transform,box-shadow] after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar peer-hover/menu-button:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-2 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\t\t\tshowOnHover &&\n\t\t\t\t\t\t\"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground md:opacity-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"sidebar-menu-action\",\n\t\t\tsidebar: \"menu-action\",\n\t\t},\n\t});\n}\n\nfunction SidebarMenuBadge({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-menu-badge\"\n\t\t\tdata-sidebar=\"menu-badge\"\n\t\t\tclassName={cn(\n\t\t\t\t\"pointer-events-none absolute end-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 font-medium text-sidebar-foreground text-xs tabular-nums peer-hover/menu-button:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuSkeleton({\n\tclassName,\n\tshowIcon = false,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tshowIcon?: boolean;\n}) {\n\t// Random width between 50 to 90%.\n\tconst [width] = React.useState(() => {\n\t\treturn `${Math.floor(Math.random() * 40) + 50}%`;\n\t});\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-menu-skeleton\"\n\t\t\tdata-sidebar=\"menu-skeleton\"\n\t\t\tclassName={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{showIcon && (\n\t\t\t\t<Skeleton\n\t\t\t\t\tclassName=\"size-4 rounded-md\"\n\t\t\t\t\tdata-sidebar=\"menu-skeleton-icon\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<Skeleton\n\t\t\t\tclassName=\"h-4 max-w-(--skeleton-width) flex-1\"\n\t\t\t\tdata-sidebar=\"menu-skeleton-text\"\n\t\t\t\tstyle={\n\t\t\t\t\t{\n\t\t\t\t\t\t\"--skeleton-width\": width,\n\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n\treturn (\n\t\t<ul\n\t\t\tdata-slot=\"sidebar-menu-sub\"\n\t\t\tdata-sidebar=\"menu-sub\"\n\t\t\tclassName={cn(\n\t\t\t\t\"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-sidebar-border border-s px-2.5 py-0.5 group-data-[collapsible=icon]:hidden rtl:-translate-x-px\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuSubItem({\n\tclassName,\n\t...props\n}: React.ComponentProps<\"li\">) {\n\treturn (\n\t\t<li\n\t\t\tdata-slot=\"sidebar-menu-sub-item\"\n\t\t\tdata-sidebar=\"menu-sub-item\"\n\t\t\tclassName={cn(\"group/menu-sub-item relative\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuSubButton({\n\trender,\n\tsize = \"md\",\n\tisActive = false,\n\tclassName,\n\t...props\n}: useRender.ComponentProps<\"a\"> &\n\tReact.ComponentProps<\"a\"> & {\n\t\tsize?: \"sm\" | \"md\";\n\t\tisActive?: boolean;\n\t}) {\n\treturn useRender({\n\t\tdefaultTagName: \"a\",\n\t\tprops: mergeProps<\"a\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden transition-[box-shadow] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-[size=md]:text-sm data-[size=sm]:text-xs data-active:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden rtl:translate-x-px [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"sidebar-menu-sub-button\",\n\t\t\tsidebar: \"menu-sub-button\",\n\t\t\tsize,\n\t\t\tactive: isActive,\n\t\t},\n\t});\n}\n\nexport {\n\tSidebar,\n\tSidebarContent,\n\tSidebarFooter,\n\tSidebarGroup,\n\tSidebarGroupAction,\n\tSidebarGroupContent,\n\tSidebarGroupLabel,\n\tSidebarHeader,\n\tSidebarInput,\n\tSidebarInset,\n\tSidebarMenu,\n\tSidebarMenuAction,\n\tSidebarMenuBadge,\n\tSidebarMenuButton,\n\tSidebarMenuItem,\n\tSidebarMenuSkeleton,\n\tSidebarMenuSub,\n\tSidebarMenuSubButton,\n\tSidebarMenuSubItem,\n\tSidebarProvider,\n\tSidebarRail,\n\tSidebarSeparator,\n\tSidebarTrigger,\n\tuseSidebar,\n};\n","type":"registry:ui"}],"css":{"@utility focus-ring":{"@apply ring-2 ring-ring ring-offset-2 ring-offset-background outline-none":{}}},"type":"registry:ui"}