{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sidebar",
  "title": "Sidebar",
  "description": "A composable sidebar component with desktop and mobile support.",
  "dependencies": [
    "@base-ui/react",
    "lucide-react",
    "class-variance-authority",
    "clsx",
    "tailwind-merge"
  ],
  "registryDependencies": [
    "https://optics.agusmayol.com.ar/r/button.json",
    "https://optics.agusmayol.com.ar/r/input.json",
    "https://optics.agusmayol.com.ar/r/separator.json",
    "https://optics.agusmayol.com.ar/r/sheet.json",
    "https://optics.agusmayol.com.ar/r/skeleton.json",
    "https://optics.agusmayol.com.ar/r/tooltip.json",
    "https://optics.agusmayol.com.ar/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/optics/sidebar.jsx",
      "content": "\"use client\";\nimport * as React from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/registry/optics/button\";\nimport { Input } from \"@/registry/optics/input\";\nimport { Separator } from \"@/registry/optics/separator\";\nimport {\n\tSheet,\n\tSheetDescription,\n\tSheetHeader,\n\tSheetPopup,\n\tSheetTitle,\n} from \"@/registry/optics/sheet\";\nimport { Skeleton } from \"@/registry/optics/skeleton\";\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipTrigger,\n} from \"@/registry/optics/tooltip\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { PanelLeftIcon } from \"lucide-react\";\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\nconst SidebarContext = React.createContext(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 = undefined,\n\tonOpenChange: setOpenProp = undefined,\n\tclassName = \"\",\n\tstyle = {},\n\tchildren = null,\n\t...props\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) => {\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, setOpenMobile]);\n\n\t// Adds a keyboard shortcut to toggle the sidebar.\n\tReact.useEffect(() => {\n\t\tconst handleKeyDown = (event) => {\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(\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, setOpenMobile, 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\"--sidebar-width\": SIDEBAR_WIDTH,\n\t\t\t\t\t\"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n\t\t\t\t\t...style,\n\t\t\t\t}}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\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 = \"offExamples\",\n\tclassName = \"\",\n\tchildren = null,\n\t...props\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\"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col\",\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<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\n\t\t\t\t<SheetPopup\n\t\t\t\t\tdata-sidebar=\"sidebar\"\n\t\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\t\tdata-mobile=\"true\"\n\t\t\t\t\tshowCloseButton={false}\n\t\t\t\t\tclassName=\"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n\t\t\t\t\t}}\n\t\t\t\t\tside={side}\n\t\t\t\t>\n\t\t\t\t\t<SheetHeader className=\"sr-only\">\n\t\t\t\t\t\t<SheetTitle>Sidebar</SheetTitle>\n\t\t\t\t\t\t<SheetDescription>Displays the mobile sidebar.</SheetDescription>\n\t\t\t\t\t</SheetHeader>\n\t\t\t\t\t<div className=\"flex h-full w-full flex-col\">{children}</div>\n\t\t\t\t</SheetPopup>\n\t\t\t</Sheet>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"group peer text-sidebar-foreground hidden 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\"transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent\",\n\t\t\t\t\t\"group-data-[state=collapsed]:w-0\",\n\t\t\t\t\t\"group-data-[collapsible=offExamples]: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\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 md:flex\",\n\t\t\t\t\tside === \"left\"\n\t\t\t\t\t\t? \"left-0 group-data-[collapsible=offExamples]:left-[calc(var(--sidebar-width)*-1)]\"\n\t\t\t\t\t\t: \"right-0 group-data-[collapsible=offExamples]:right-[calc(var(--sidebar-width)*-1)]\",\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: \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l\",\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=\"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col\"\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({ className = \"\", onClick = undefined, ...props }) {\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 />\n\t\t\t<span className=\"sr-only\">Toggle Sidebar</span>\n\t\t</Button>\n\t);\n}\n\nfunction SidebarRail({ className = \"\", ...props }) {\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\"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\",\n\t\t\t\t\"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n\t\t\t\t\"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n\t\t\t\t\"hover:group-data-[collapsible=offExamples]:bg-sidebar group-data-[collapsible=offExamples]:translate-x-0 group-data-[collapsible=offExamples]:after:left-full\",\n\t\t\t\t\"[[data-side=left][data-collapsible=offExamples]_&]:-right-2\",\n\t\t\t\t\"[[data-side=right][data-collapsible=offExamples]_&]:-left-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 }) {\n\treturn (\n\t\t<main\n\t\t\tdata-slot=\"sidebar-inset\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarInput({ className = \"\", ...props }) {\n\treturn (\n\t\t<Input\n\t\t\tdata-slot=\"sidebar-input\"\n\t\t\tdata-sidebar=\"input\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-muted/20 dark:bg-muted/30 border-input h-8 w-full\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarHeader({ className = \"\", ...props }) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-header\"\n\t\t\tdata-sidebar=\"header\"\n\t\t\tclassName={cn(\"gap-2 p-2 flex flex-col\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarFooter({ className = \"\", ...props }) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-footer\"\n\t\t\tdata-sidebar=\"footer\"\n\t\t\tclassName={cn(\"gap-2 p-2 flex flex-col\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarSeparator({ className = \"\", ...props }) {\n\treturn (\n\t\t<Separator\n\t\t\tdata-slot=\"sidebar-separator\"\n\t\t\tdata-sidebar=\"separator\"\n\t\t\tclassName={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarContent({ className = \"\", ...props }) {\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 gap-0 flex min-h-0 flex-1 flex-col overflow-auto 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 }) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sidebar-group\"\n\t\t\tdata-sidebar=\"group\"\n\t\t\tclassName={cn(\n\t\t\t\t\"px-2 py-1 relative flex w-full min-w-0 flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarGroupLabel({ className = \"\", render = undefined, ...props }) {\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\tprops: mergeProps(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>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({ className = \"\", render = undefined, ...props }) {\n\treturn useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 w-5 rounded-md p-0 focus-visible:ring-2 [&>svg]:size-4 flex aspect-square items-center justify-center outline-hidden transition-transform [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden group-data-[collapsible=icon]:hidden\",\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({ className = \"\", ...props }) {\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(\"text-xs w-full\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenu({ className = \"\", ...props }) {\n\treturn (\n\t\t<ul\n\t\t\tdata-slot=\"sidebar-menu\"\n\t\t\tdata-sidebar=\"menu\"\n\t\t\tclassName={cn(\"gap-px flex w-full min-w-0 flex-col\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuItem({ className = \"\", ...props }) {\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\"ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-[calc(var(--radius-sm)+2px)] p-2 text-left text-xs transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button 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\",\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 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: \"h-8 text-xs\",\n\t\t\t\tsm: \"h-7 text-xs\",\n\t\t\t\tlg: \"h-12 text-xs 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 = undefined,\n\tisActive = false,\n\tvariant = \"default\",\n\tsize = \"default\",\n\ttooltip = undefined,\n\tclassName = \"\",\n\t...props\n}) {\n\tconst { isMobile, state } = useSidebar();\n\tconst comp = useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps(\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,\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}) {\n\treturn useRender({\n\t\tdefaultTagName: \"button\",\n\t\tprops: mergeProps(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"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 aspect-square w-5 rounded-[calc(var(--radius-sm)-2px)] p-0 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 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0\",\n\t\t\t\t\tshowOnHover &&\n\t\t\t\t\t\t\"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-open:opacity-100 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({ className, ...props }) {\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\"text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 rounded-[calc(var(--radius-sm)-2px)] px-1 text-xs font-medium 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 items-center justify-center tabular-nums select-none group-data-[collapsible=icon]:hidden\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuSkeleton({ className, showIcon = false, ...props }) {\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(\"h-8 gap-2 rounded-md px-2 flex items-center\", 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\"--skeleton-width\": width,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction SidebarMenuSub({ className, ...props }) {\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\"border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SidebarMenuSubItem({ className, ...props }) {\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}) {\n\treturn useRender({\n\t\tdefaultTagName: \"a\",\n\t\tprops: mergeProps(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"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 data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-xs data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>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-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\nSidebar.displayName = \"Sidebar\";\nSidebarContent.displayName = \"SidebarContent\";\nSidebarFooter.displayName = \"SidebarFooter\";\nSidebarGroup.displayName = \"SidebarGroup\";\nSidebarGroupAction.displayName = \"SidebarGroupAction\";\nSidebarGroupContent.displayName = \"SidebarGroupContent\";\nSidebarGroupLabel.displayName = \"SidebarGroupLabel\";\nSidebarHeader.displayName = \"SidebarHeader\";\nSidebarInput.displayName = \"SidebarInput\";\nSidebarInset.displayName = \"SidebarInset\";\nSidebarMenu.displayName = \"SidebarMenu\";\nSidebarMenuAction.displayName = \"SidebarMenuAction\";\nSidebarMenuBadge.displayName = \"SidebarMenuBadge\";\nSidebarMenuButton.displayName = \"SidebarMenuButton\";\nSidebarMenuItem.displayName = \"SidebarMenuItem\";\nSidebarMenuSkeleton.displayName = \"SidebarMenuSkeleton\";\nSidebarMenuSub.displayName = \"SidebarMenuSub\";\nSidebarMenuSubButton.displayName = \"SidebarMenuSubButton\";\nSidebarMenuSubItem.displayName = \"SidebarMenuSubItem\";\nSidebarProvider.displayName = \"SidebarProvider\";\nSidebarRail.displayName = \"SidebarRail\";\nSidebarSeparator.displayName = \"SidebarSeparator\";\nSidebarTrigger.displayName = \"SidebarTrigger\";\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:component",
      "target": "components/optics/sidebar.jsx"
    }
  ],
  "type": "registry:component"
}