{
  "schemaVersion": 1,
  "name": "sidebar",
  "useFor": "Use for an app's main navigation (an order console, a developer dashboard). Wrap the page in SidebarProvider with the Sidebar and a SidebarInset beside it; put the wordmark or a switcher in SidebarHeader, groups of SidebarMenu rows in SidebarContent and the account in SidebarFooter. Mark the current row with isActive. Set collapsible=\"icon\" to let it narrow to glyphs (give rows a tooltip), floating or inset for the window looks. On phones it opens in the sheet; Cmd or Ctrl and B toggles it.",
  "constraints": [
    "More than seven top-level rows",
    "Nested rows two levels deep",
    "A sidebar on a marketing page",
    "Icons without labels when expanded"
  ],
  "documentation": "",
  "source": "Extension from opencommerce-agentcard-web src/app/globals.css (.nav-link, .win)",
  "exports": [
    "Sidebar",
    "SidebarContent",
    "SidebarFooter",
    "SidebarGroup",
    "SidebarGroupAction",
    "SidebarGroupContent",
    "SidebarGroupLabel",
    "SidebarHeader",
    "SidebarInput",
    "SidebarInset",
    "SidebarMenu",
    "SidebarMenuAction",
    "SidebarMenuBadge",
    "SidebarMenuButton",
    "SidebarMenuItem",
    "SidebarMenuSkeleton",
    "SidebarMenuSub",
    "SidebarMenuSubButton",
    "SidebarMenuSubItem",
    "SidebarProvider",
    "SidebarRail",
    "SidebarSeparator",
    "SidebarTrigger",
    "useSidebar"
  ],
  "client": true,
  "docsUrl": "https://opencommerce-ds.vercel.app/components/sidebar",
  "markdownUrl": "https://opencommerce-ds.vercel.app/r/sidebar.md",
  "examples": [
    {
      "path": "examples/sidebar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { BarChart3, BookOpen, ChevronsUpDown, CreditCard, KeyRound, LifeBuoy, PanelLeftClose, Plus, Search, ShoppingBag, Store, Webhook } from \"lucide-react\";\n\nimport {\n  Sidebar,\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarGroupAction,\n  SidebarGroupContent,\n  SidebarGroupLabel,\n  SidebarHeader,\n  SidebarInput,\n  SidebarInset,\n  SidebarMenu,\n  SidebarMenuBadge,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarMenuSkeleton,\n  SidebarMenuSub,\n  SidebarMenuSubButton,\n  SidebarMenuSubItem,\n  SidebarProvider,\n  SidebarRail,\n  SidebarTrigger,\n  useSidebar,\n} from \"@/components/ui/sidebar\";\n\nconst MAIN = [\n  { id: \"orders\", label: \"Orders\", icon: ShoppingBag, count: \"12\" },\n  { id: \"merchants\", label: \"Merchants\", icon: Store },\n  { id: \"cards\", label: \"Cards\", icon: CreditCard },\n  { id: \"monitoring\", label: \"Monitoring\", icon: BarChart3, mark: \"Live\" },\n];\nconst DEVELOPERS = [\n  { id: \"keys\", label: \"API keys\", icon: KeyRound },\n  { id: \"webhooks\", label: \"Webhooks\", icon: Webhook },\n  { id: \"docs\", label: \"Docs\", icon: BookOpen },\n];\n\nfunction Wordmark() {\n  return (\n    <span className=\"flex items-baseline gap-1.5 px-2 group-data-[collapsible=icon]/sidebar:hidden\">\n      <span className=\"font-display text-h5 font-medium tracking-tight text-fg\">opencommerce</span>\n      <span className=\"text-caption text-fg-muted\">by Agentcard</span>\n    </span>\n  );\n}\n\nfunction CollapseRow() {\n  const { toggleSidebar, state } = useSidebar();\n  return (\n    <SidebarMenuItem>\n      <SidebarMenuButton tooltip=\"Expand\" onClick={toggleSidebar} aria-expanded={state === \"expanded\"}>\n        <PanelLeftClose strokeWidth={1.5} className=\"transition-[rotate] duration-200 ease-in-out group-data-[collapsible=icon]/sidebar:rotate-180 motion-reduce:transition-none\" />\n        <span>{state === \"expanded\" ? \"Collapse\" : \"Expand\"}</span>\n      </SidebarMenuButton>\n    </SidebarMenuItem>\n  );\n}\n\nfunction Rail({ collapsible = \"offcanvas\", variant = \"sidebar\" }: { collapsible?: \"offcanvas\" | \"icon\" | \"none\"; variant?: \"sidebar\" | \"floating\" | \"inset\" }) {\n  const [current, setCurrent] = React.useState(\"orders\");\n  const [sub, setSub] = React.useState(\"all\");\n  return (\n    <Sidebar collapsible={collapsible} variant={variant}>\n      <SidebarHeader>\n        <Wordmark />\n        <SidebarInput placeholder=\"Search orders\" aria-label=\"Search orders\" className=\"group-data-[collapsible=icon]/sidebar:hidden\" />\n      </SidebarHeader>\n      <SidebarContent>\n        <SidebarGroup>\n          <SidebarGroupLabel>Commerce</SidebarGroupLabel>\n          <SidebarGroupContent>\n            <SidebarMenu>\n              {MAIN.map((item) => (\n                <SidebarMenuItem key={item.id}>\n                  <SidebarMenuButton isActive={current === item.id} tooltip={item.label} onClick={() => setCurrent(item.id)}>\n                    <item.icon strokeWidth={1.5} />\n                    <span>{item.label}</span>\n                  </SidebarMenuButton>\n                  {item.count && <SidebarMenuBadge>{item.count}</SidebarMenuBadge>}\n                  {item.mark && <SidebarMenuBadge variant=\"mark\">{item.mark}</SidebarMenuBadge>}\n                  {item.id === \"orders\" && current === \"orders\" && (\n                    <SidebarMenuSub>\n                      {[\n                        [\"all\", \"All orders\"],\n                        [\"failed\", \"Failed checkouts\"],\n                        [\"returns\", \"Returns\"],\n                      ].map(([id, label]) => (\n                        <SidebarMenuSubItem key={id}>\n                          <SidebarMenuSubButton\n                            href={`#${id}`}\n                            isActive={sub === id}\n                            onClick={(event) => {\n                              event.preventDefault();\n                              setSub(id);\n                            }}\n                          >\n                            <span>{label}</span>\n                          </SidebarMenuSubButton>\n                        </SidebarMenuSubItem>\n                      ))}\n                    </SidebarMenuSub>\n                  )}\n                </SidebarMenuItem>\n              ))}\n            </SidebarMenu>\n          </SidebarGroupContent>\n        </SidebarGroup>\n        <SidebarGroup>\n          <SidebarGroupLabel>Developers</SidebarGroupLabel>\n          <SidebarGroupAction aria-label=\"Create an API key\">\n            <Plus strokeWidth={1.5} />\n          </SidebarGroupAction>\n          <SidebarGroupContent>\n            <SidebarMenu>\n              {DEVELOPERS.map((item) => (\n                <SidebarMenuItem key={item.id}>\n                  <SidebarMenuButton isActive={current === item.id} tooltip={item.label} onClick={() => setCurrent(item.id)}>\n                    <item.icon strokeWidth={1.5} />\n                    <span>{item.label}</span>\n                  </SidebarMenuButton>\n                </SidebarMenuItem>\n              ))}\n            </SidebarMenu>\n          </SidebarGroupContent>\n        </SidebarGroup>\n      </SidebarContent>\n      <SidebarFooter>\n        <SidebarMenu>\n          <SidebarMenuItem>\n            <SidebarMenuButton tooltip=\"Help\">\n              <LifeBuoy strokeWidth={1.5} />\n              <span>Help</span>\n            </SidebarMenuButton>\n          </SidebarMenuItem>\n          <SidebarMenuItem>\n            <SidebarMenuButton size=\"lg\" tooltip=\"Acme Labs\">\n              <span className=\"grid size-6 shrink-0 place-items-center rounded-sm border border-line-brand-edge bg-primary font-mono text-bar text-on-primary\">A</span>\n              <span className=\"grid min-w-0 flex-1 text-left leading-tight\">\n                <span className=\"truncate text-body-sm text-fg\">Acme Labs</span>\n                <span className=\"truncate font-mono text-bar text-fg-muted\">Standard plan</span>\n              </span>\n              <ChevronsUpDown strokeWidth={1.5} className=\"ml-auto\" />\n            </SidebarMenuButton>\n          </SidebarMenuItem>\n          {collapsible === \"icon\" && <CollapseRow />}\n        </SidebarMenu>\n      </SidebarFooter>\n      <SidebarRail />\n    </Sidebar>\n  );\n}\n\nfunction Page({ title }: { title: string }) {\n  return (\n    <SidebarInset>\n      <header className=\"flex h-14 items-center gap-2 border-b border-line px-4\">\n        <SidebarTrigger className=\"-ml-1.5\" />\n        <p className=\"font-display text-h5 font-medium tracking-tight text-fg\">{title}</p>\n        <span className=\"ml-auto flex items-center gap-2 text-caption text-fg-muted max-sm:hidden\">\n          <Search strokeWidth={1.5} className=\"size-3.5\" />\n          <kbd className=\"font-mono text-bar\">⌘B</kbd> toggles the rail\n        </span>\n      </header>\n      <div className=\"grid gap-3 p-6\">\n        {[\"ord_8KQ2 · Northwind Outfitters · $222.00\", \"ord_8KR9 · Contoso Coffee · $48.50\", \"ord_8KS6 · Litware Books · $31.20\"].map((row) => (\n          <div key={row} className=\"rounded-control border border-line px-4 py-3 font-mono text-snippet text-fg\">\n            {row}\n          </div>\n        ))}\n      </div>\n    </SidebarInset>\n  );\n}\n\nexport function Site() {\n  return (\n    <SidebarProvider className=\"min-h-150 overflow-hidden rounded-panel border border-line-window\">\n      <Rail />\n      <Page title=\"Orders\" />\n    </SidebarProvider>\n  );\n}\n\nexport function Icons() {\n  return (\n    <SidebarProvider defaultOpen={false} className=\"min-h-150 overflow-hidden rounded-panel border border-line-window\">\n      <Rail collapsible=\"icon\" />\n      <Page title=\"Orders\" />\n    </SidebarProvider>\n  );\n}\n\nexport function Floating() {\n  return (\n    <SidebarProvider className=\"min-h-150 overflow-hidden rounded-panel border border-line-window bg-subtle\">\n      <Rail variant=\"floating\" />\n      <Page title=\"Merchants\" />\n    </SidebarProvider>\n  );\n}\n\nexport function Inset() {\n  return (\n    <SidebarProvider className=\"min-h-150 overflow-hidden rounded-panel border border-line-window\">\n      <Rail variant=\"inset\" />\n      <Page title=\"Monitoring\" />\n    </SidebarProvider>\n  );\n}\n\nexport function Loading() {\n  return (\n    <SidebarProvider className=\"min-h-100 overflow-hidden rounded-panel border border-line-window\">\n      <Sidebar collapsible=\"none\">\n        <SidebarHeader>\n          <Wordmark />\n        </SidebarHeader>\n        <SidebarContent>\n          <SidebarGroup>\n            <SidebarGroupLabel>Commerce</SidebarGroupLabel>\n            <SidebarMenu>\n              {Array.from({ length: 5 }, (_, i) => (\n                <SidebarMenuItem key={i}>\n                  <SidebarMenuSkeleton showIcon />\n                </SidebarMenuItem>\n              ))}\n            </SidebarMenu>\n          </SidebarGroup>\n        </SidebarContent>\n      </Sidebar>\n      <SidebarInset>\n        <div className=\"grid h-full place-items-center p-6 text-body-sm text-fg-muted\">Loading your workspace</div>\n      </SidebarInset>\n    </SidebarProvider>\n  );\n}\n",
      "exports": [
        "Site",
        "Icons",
        "Floating",
        "Inset",
        "Loading"
      ],
      "requires": [
        "sidebar"
      ],
      "packages": [
        "lucide-react"
      ],
      "previews": [
        {
          "name": "Site",
          "url": "https://opencommerce-ds.vercel.app/preview/sidebar/Site"
        },
        {
          "name": "Icons",
          "url": "https://opencommerce-ds.vercel.app/preview/sidebar/Icons"
        },
        {
          "name": "Floating",
          "url": "https://opencommerce-ds.vercel.app/preview/sidebar/Floating"
        },
        {
          "name": "Inset",
          "url": "https://opencommerce-ds.vercel.app/preview/sidebar/Inset"
        },
        {
          "name": "Loading",
          "url": "https://opencommerce-ds.vercel.app/preview/sidebar/Loading"
        }
      ]
    }
  ],
  "type": "ui",
  "title": "Sidebar",
  "description": "An app's rail: a white column with a rule at its edge, quiet rows, mono group labels and the pale blue current row.",
  "surface": "site",
  "kinds": [
    "nav-link"
  ],
  "requires": [
    "theme",
    "button",
    "input",
    "separator",
    "sheet",
    "skeleton",
    "tooltip",
    "utils"
  ],
  "packages": [
    "@radix-ui/react-slot",
    "class-variance-authority",
    "lucide-react"
  ],
  "files": [
    {
      "path": "components/ui/sidebar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { PanelLeft } from \"lucide-react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { Sheet, SheetContent, SheetDescription, SheetTitle } from \"@/components/ui/sheet\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\n\n// An app's rail, extrapolated from the brand's header links and windows (globals.css .nav-link, .win): 256px of white\n// with a 9 percent ink rule at its edge; a 64px head holds the wordmark or a switcher. Rows are 34px with 5px corners,\n// 8px in from the rail's sides: a 16px line glyph and a 14px Inter label at 64 percent ink that take a 5 percent ink\n// wash and ink text under the pointer (150ms, color only); the current row is the pale blue with blue text. A group's\n// label is the window bar's 11.5px mono at 64 percent ink. The foot is ruled off above. `floating` is the rail as one of\n// the brand's windows (12px corners, the 16 percent ink edge, the soft drop) 8px from the page's edges; `inset` sets the\n// rail on the mist with the page as a white window beside it. Collapsing to icons narrows the rail to 51px (200ms, the\n// strong ease-out); Cmd or Ctrl and B toggles it instantly; on a phone it opens in the sheet.\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_ICON = \"3.1875rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\nconst MOBILE_QUERY = \"(max-width: 767px)\";\n\ntype SidebarContextProps = {\n  state: \"expanded\" | \"collapsed\";\n  open: boolean;\n  setOpen: (open: boolean) => void;\n  openMobile: boolean;\n  setOpenMobile: (open: boolean) => void;\n  isMobile: boolean;\n  instant: boolean;\n  toggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n  const context = React.useContext(SidebarContext);\n  if (!context) throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n  return context;\n}\n\nfunction useIsMobile() {\n  const [isMobile, setIsMobile] = React.useState(false);\n  React.useEffect(() => {\n    const query = window.matchMedia(MOBILE_QUERY);\n    const update = () => setIsMobile(query.matches);\n    update();\n    query.addEventListener(\"change\", update);\n    return () => query.removeEventListener(\"change\", update);\n  }, []);\n  return isMobile;\n}\n\n/**\n * Holds whether the rail is open (expanded or collapsed on a desktop, shown in a sheet on a phone). Uncontrolled with\n * `defaultOpen`, or controlled with `open` and `onOpenChange`. Nothing is stored: keep the state yourself if it should\n * survive a reload. Cmd or Ctrl and B toggles it.\n */\nfunction SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<\"div\"> & { defaultOpen?: boolean; open?: boolean; onOpenChange?: (open: boolean) => void }) {\n  const isMobile = useIsMobile();\n  const [openMobile, setOpenMobile] = React.useState(false);\n  const [instant, setInstant] = React.useState(false);\n  const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n  const open = openProp ?? internalOpen;\n  const setOpen = React.useCallback(\n    (value: boolean | ((value: boolean) => boolean)) => {\n      const next = typeof value === \"function\" ? value(open) : value;\n      if (setOpenProp) setOpenProp(next);\n      else setInternalOpen(next);\n    },\n    [setOpenProp, open],\n  );\n  const toggleSidebar = React.useCallback(() => {\n    setInstant(false);\n    return isMobile ? setOpenMobile((o) => !o) : setOpen((o) => !o);\n  }, [isMobile, setOpen]);\n\n  React.useEffect(() => {\n    // A shortcut is pressed many times a day: it changes the rail at once, with no motion.\n    const onKeyDown = (event: KeyboardEvent) => {\n      if (event.key !== SIDEBAR_KEYBOARD_SHORTCUT || !(event.metaKey || event.ctrlKey)) return;\n      event.preventDefault();\n      setInstant(true);\n      if (isMobile) setOpenMobile((o) => !o);\n      else setOpen((o) => !o);\n    };\n    window.addEventListener(\"keydown\", onKeyDown);\n    return () => window.removeEventListener(\"keydown\", onKeyDown);\n  }, [isMobile, setOpen]);\n\n  const state = open ? \"expanded\" : \"collapsed\";\n  const value = React.useMemo<SidebarContextProps>(() => ({ state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, instant }), [state, open, setOpen, isMobile, openMobile, toggleSidebar, instant]);\n\n  return (\n    <SidebarContext.Provider value={value}>\n      <TooltipProvider delayDuration={0}>\n        <div\n          data-slot=\"sidebar-wrapper\"\n          data-instant={instant || undefined}\n          style={{ \"--sidebar-width\": SIDEBAR_WIDTH, \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON, ...style } as React.CSSProperties}\n          className={cn(\"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-subtle\", className)}\n          {...props}\n        >\n          {children}\n        </div>\n      </TooltipProvider>\n    </SidebarContext.Provider>\n  );\n}\n\n/**\n * The rail. `variant`: sidebar (the white rail with its rule), floating (a window 8px from the page's edges) or inset\n * (the rail on the mist with the page as a white window beside it). `collapsible`: offcanvas (slides away), icon\n * (narrows to its glyphs) or none.\n */\nfunction Sidebar({\n  side = \"left\",\n  variant = \"sidebar\",\n  collapsible = \"offcanvas\",\n  className,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & { side?: \"left\" | \"right\"; variant?: \"sidebar\" | \"floating\" | \"inset\"; collapsible?: \"offcanvas\" | \"icon\" | \"none\" }) {\n  const { isMobile, state, openMobile, setOpenMobile, instant } = useSidebar();\n  const ground = variant === \"inset\" ? \"bg-subtle\" : \"bg-surface\";\n\n  if (collapsible === \"none\") {\n    return (\n      <div data-slot=\"sidebar\" data-variant={variant} className={cn(\"group/sidebar flex h-full w-(--sidebar-width) flex-col text-fg\", ground, variant === \"sidebar\" && \"border-r border-line\", className)} {...props}>\n        {children}\n      </div>\n    );\n  }\n\n  if (isMobile) {\n    return (\n      <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n        <SheetContent data-slot=\"sidebar\" data-sidebar=\"sidebar\" data-mobile=\"true\" data-variant={variant} side={side} name=\"navigation\" className={cn(\"group/sidebar w-(--sidebar-width) max-w-[calc(100vw-var(--ds-space-12))] text-fg\", ground)}>\n          <SheetTitle className=\"sr-only\">Navigation</SheetTitle>\n          <SheetDescription className=\"sr-only\">The app's sections and settings.</SheetDescription>\n          <div className=\"flex h-full w-full flex-col\">{children}</div>\n        </SheetContent>\n      </Sheet>\n    );\n  }\n\n  return (\n    <div\n      data-slot=\"sidebar\"\n      data-state={state}\n      data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n      data-variant={variant}\n      data-side={side}\n      className=\"group/sidebar peer hidden shrink-0 text-fg md:block\"\n    >\n      {/* Holds the rail's room in the row, so the page beside it moves as it opens and closes. */}\n      <div\n        data-slot=\"sidebar-gap\"\n        className={cn(\n          \"relative h-full w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-out group-data-[collapsible=offcanvas]/sidebar:w-0 group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon) in-data-[instant=true]:transition-none motion-reduce:transition-none\",\n          (variant === \"floating\" || variant === \"inset\") && \"group-data-[collapsible=icon]/sidebar:w-[calc(var(--sidebar-width-icon)+var(--ds-space-4))]\",\n        )}\n      >\n        <div\n          data-slot=\"sidebar-container\"\n          className={cn(\n            \"sticky top-0 z-10 flex h-svh max-h-full w-(--sidebar-width) overflow-hidden transition-[translate,width] duration-200 ease-out in-data-[instant=true]:transition-none motion-reduce:transition-none\",\n            side === \"left\" ? \"left-0 group-data-[collapsible=offcanvas]/sidebar:-translate-x-full\" : \"ml-auto group-data-[collapsible=offcanvas]/sidebar:translate-x-full\",\n            variant === \"floating\" || variant === \"inset\" ? \"p-2 group-data-[collapsible=icon]/sidebar:w-[calc(var(--sidebar-width-icon)+var(--ds-space-4))]\" : \"group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)\",\n            variant === \"sidebar\" && (side === \"left\" ? \"border-r border-line\" : \"border-l border-line\"),\n            className,\n          )}\n          {...props}\n        >\n          <div data-sidebar=\"sidebar\" data-slot=\"sidebar-inner\" className={cn(\"flex h-full w-full flex-col\", ground, variant === \"floating\" && \"overflow-hidden rounded-panel border border-line-window shadow-card\")}>\n            {children}\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nfunction SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n  const { toggleSidebar, open, isMobile, openMobile } = useSidebar();\n  return (\n    <Button\n      data-sidebar=\"trigger\"\n      data-slot=\"sidebar-trigger\"\n      variant=\"ghost\"\n      size=\"icon\"\n      aria-expanded={isMobile ? openMobile : open}\n      className={cn(\"text-fg-muted\", className)}\n      onClick={(event) => {\n        onClick?.(event);\n        toggleSidebar();\n      }}\n      {...props}\n    >\n      <PanelLeft strokeWidth={1.5} className=\"size-4\" />\n      <span className=\"sr-only\">Toggle the rail</span>\n    </Button>\n  );\n}\n\n/** A thin strip along the rail's edge that toggles it, with a 2px line in the 16 percent ink under the pointer. */\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n  const { toggleSidebar } = useSidebar();\n  return (\n    <button\n      data-sidebar=\"rail\"\n      data-slot=\"sidebar-rail\"\n      aria-label=\"Toggle the rail\"\n      tabIndex={-1}\n      onClick={toggleSidebar}\n      title=\"Toggle the rail\"\n      className={cn(\n        \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 after:bg-transparent after:transition-colors after:duration-150 after:ease-out hover:after:bg-line-strong sm:flex\",\n        \"in-data-[side=left]:-right-4 in-data-[side=left]:cursor-w-resize in-data-[side=right]:left-0 in-data-[side=right]:cursor-e-resize\",\n        \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/** The page beside the rail. With the inset rail it becomes a white window: 12px corners, the 16 percent ink edge. */\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n  return (\n    <main\n      data-slot=\"sidebar-inset\"\n      className={cn(\"relative flex w-full min-w-0 flex-1 flex-col bg-surface\", \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-panel md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-line-window md:peer-data-[variant=inset]:shadow-card\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {\n  return <Input data-slot=\"sidebar-input\" data-sidebar=\"input\" variant=\"search\" className={cn(\"w-full\", className)} {...props} />;\n}\n\n/** The rail's 64px head: the wordmark 16px in, or a switcher. */\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div data-slot=\"sidebar-header\" data-sidebar=\"header\" className={cn(\"flex min-h-16 shrink-0 flex-col justify-center gap-2 px-2 py-3\", className)} {...props} />;\n}\n\n/** The rail's foot (the account, help, Collapse), ruled off above. */\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div data-slot=\"sidebar-footer\" data-sidebar=\"footer\" className={cn(\"flex shrink-0 flex-col gap-0.5 border-t border-line p-2\", className)} {...props} />;\n}\n\nfunction SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {\n  return <Separator data-slot=\"sidebar-separator\" data-sidebar=\"separator\" className={cn(\"mx-2 w-auto\", className)} {...props} />;\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-content\"\n      data-sidebar=\"content\"\n      className={cn(\"flex min-h-0 flex-1 flex-col overflow-auto overscroll-contain [scrollbar-width:none] group-data-[collapsible=icon]/sidebar:overflow-hidden\", className)}\n      {...props}\n    />\n  );\n}\n\n/** A group of rows. A labeled group keeps 8px above and below it; an unlabeled one (the rows under the head) none. */\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div data-slot=\"sidebar-group\" data-sidebar=\"group\" className={cn(\"relative flex w-full min-w-0 flex-col px-2 py-2 [&:not(:has(>[data-slot=sidebar-group-label]))]:py-0\", className)} {...props} />;\n}\n\n/** A group's label in the window bar's 11.5px mono at 64 percent ink; it folds away when the rail shows glyphs only. */\nfunction SidebarGroupLabel({ className, asChild = false, ...props }: React.ComponentProps<\"div\"> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot : \"div\";\n  return (\n    <Comp\n      data-slot=\"sidebar-group-label\"\n      data-sidebar=\"group-label\"\n      className={cn(\n        \"mb-1 flex h-7 shrink-0 items-center px-2.5 font-mono text-bar leading-none whitespace-nowrap text-fg-muted outline-none transition-[margin,opacity] duration-200 ease-out focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-focus-ring group-data-[collapsible=icon]/sidebar:-mt-8 group-data-[collapsible=icon]/sidebar:opacity-0 motion-reduce:transition-none [&>svg]:size-3.5 [&>svg]:shrink-0\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/** A group's action beside its label (add a card, filter): a 14px glyph in a 24px key at the group's right. */\nfunction SidebarGroupAction({ className, asChild = false, ...props }: React.ComponentProps<\"button\"> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot : \"button\";\n  return (\n    <Comp\n      data-slot=\"sidebar-group-action\"\n      data-sidebar=\"group-action\"\n      className={cn(\n        \"absolute top-2.5 right-3 flex size-6 cursor-pointer items-center justify-center rounded-menu text-fg-muted outline-none transition-[background-color,color] duration-150 ease-out hover:bg-wash-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-focus-ring group-data-[collapsible=icon]/sidebar:hidden motion-reduce:transition-none [&>svg]:size-3.5 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction SidebarGroupContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div data-slot=\"sidebar-group-content\" data-sidebar=\"group-content\" className={cn(\"w-full\", className)} {...props} />;\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n  return <ul data-slot=\"sidebar-menu\" data-sidebar=\"menu\" className={cn(\"flex w-full min-w-0 flex-col gap-0.5\", className)} {...props} />;\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n  return <li data-slot=\"sidebar-menu-item\" data-sidebar=\"menu-item\" className={cn(\"group/menu-item relative\", className)} {...props} />;\n}\n\n// A row: a 16px glyph 10px in and the label 8px after it. Hover washes the row; the current row is the pale blue with\n// blue text. Narrowed to icons, the row is a 34px square around its glyph.\nconst sidebarMenuButtonVariants = cva(\n  \"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-menu pr-2.5 pl-2.5 text-left font-sans text-fg-muted outline-none transition-[background-color,color] duration-150 ease-out group-has-data-[sidebar=menu-action]/menu-item:pr-9 group-data-[collapsible=icon]/sidebar:size-8.5! group-data-[collapsible=icon]/sidebar:justify-center group-data-[collapsible=icon]/sidebar:p-0! group-data-[collapsible=icon]/sidebar:[&>span:not([data-slot=avatar])]:sr-only focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-blue-5 data-[active=true]:text-fg-brand data-[state=open]:bg-wash-hover data-[state=open]:text-fg motion-reduce:transition-none [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"hover:bg-wash-hover hover:text-fg data-[active=true]:hover:bg-blue-5 data-[active=true]:hover:text-fg-brand\",\n        outline: \"border border-hairline bg-surface hover:bg-subtle hover:text-fg\",\n      },\n      size: {\n        default: \"h-8.5 text-body-sm leading-tight\",\n        sm: \"h-7.5 text-caption leading-tight [&>svg:not([class*='size-'])]:size-3.5\",\n        lg: \"h-12 text-body-sm leading-tight group-data-[collapsible=icon]/sidebar:p-0!\",\n      },\n    },\n    defaultVariants: { variant: \"default\", size: \"default\" },\n  },\n);\n\nfunction SidebarMenuButton({\n  asChild = false,\n  isActive = false,\n  variant = \"default\",\n  size = \"default\",\n  tooltip,\n  className,\n  ...props\n}: React.ComponentProps<\"button\"> & { asChild?: boolean; isActive?: boolean; tooltip?: string | React.ComponentProps<typeof TooltipContent> } & VariantProps<typeof sidebarMenuButtonVariants>) {\n  const Comp = asChild ? Slot : \"button\";\n  const { isMobile, state } = useSidebar();\n  // The tooltip names a row only while the rail shows glyphs alone; otherwise it stays shut, so it never catches Escape.\n  const [tipOpen, setTipOpen] = React.useState(false);\n  const showTip = state === \"collapsed\" && !isMobile;\n  const button = (\n    <Comp\n      data-slot=\"sidebar-menu-button\"\n      data-sidebar=\"menu-button\"\n      data-size={size}\n      data-active={isActive || undefined}\n      aria-current={isActive ? \"page\" : undefined}\n      className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n      {...props}\n    />\n  );\n  if (!tooltip) return button;\n  const content = typeof tooltip === \"string\" ? { children: tooltip } : tooltip;\n  return (\n    <Tooltip open={showTip && tipOpen} onOpenChange={setTipOpen}>\n      <TooltipTrigger asChild>{button}</TooltipTrigger>\n      <TooltipContent side=\"right\" align=\"center\" {...content} />\n    </Tooltip>\n  );\n}\n\n/** An action at a row's right end (a row's more glyph). `showOnHover` keeps it hidden until the row is hovered or open. */\nfunction SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }: React.ComponentProps<\"button\"> & { asChild?: boolean; showOnHover?: boolean }) {\n  const Comp = asChild ? Slot : \"button\";\n  return (\n    <Comp\n      data-slot=\"sidebar-menu-action\"\n      data-sidebar=\"menu-action\"\n      className={cn(\n        \"absolute top-1.25 right-1.5 flex size-6 cursor-pointer items-center justify-center rounded-menu text-fg-muted outline-none transition-[background-color,color,opacity] duration-150 ease-out hover:bg-wash-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-focus-ring group-data-[collapsible=icon]/sidebar:hidden motion-reduce:transition-none [&>svg]:size-3.5 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden\",\n        \"peer-data-[size=sm]/menu-button:top-0.75 peer-data-[size=lg]/menu-button:top-3\",\n        showOnHover && \"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-fg-brand md:opacity-0\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/**\n * A mark at a row's right end, 10px in: `mark` is the brand's chip (the 11.5px mono in blue on the pale blue, 2px\n * corners: \"Beta\", \"Live\"); `count` is a quiet number in the mono at 64 percent ink (orders waiting).\n */\nfunction SidebarMenuBadge({ className, variant = \"count\", ...props }: React.ComponentProps<\"div\"> & { variant?: \"mark\" | \"count\" }) {\n  return (\n    <div\n      data-slot=\"sidebar-menu-badge\"\n      data-sidebar=\"menu-badge\"\n      className={cn(\n        \"pointer-events-none absolute top-1.75 right-2.5 flex h-5 items-center justify-center whitespace-nowrap select-none group-data-[collapsible=icon]/sidebar:hidden\",\n        \"peer-data-[size=sm]/menu-button:top-1.25 peer-data-[size=lg]/menu-button:top-3.5\",\n        variant === \"mark\" ? \"rounded-chip bg-blue-5 px-1.5 font-mono text-bar leading-none text-fg-brand\" : \"min-w-5 px-1 font-mono text-bar text-fg-muted tabular-nums\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/** A row's placeholder while the rail loads: a glyph square and a label of varying width. */\nfunction SidebarMenuSkeleton({ className, showIcon = false, ...props }: React.ComponentProps<\"div\"> & { showIcon?: boolean }) {\n  // A width between 50 and 90 percent that differs from row to row but is the same on the server and in the browser.\n  const id = React.useId();\n  const width = `${50 + (([...id].reduce((sum, c) => (sum * 31 + c.charCodeAt(0)) % 997, 7) % 41))}%`;\n  return (\n    <div data-slot=\"sidebar-menu-skeleton\" data-sidebar=\"menu-skeleton\" className={cn(\"flex h-8.5 items-center gap-2 rounded-menu px-2.5\", className)} {...props}>\n      {showIcon && <Skeleton className=\"size-4 rounded-chip\" data-sidebar=\"menu-skeleton-icon\" />}\n      <Skeleton className=\"h-3 max-w-(--skeleton-width) flex-1 rounded-chip\" data-sidebar=\"menu-skeleton-text\" style={{ \"--skeleton-width\": width } as React.CSSProperties} />\n    </div>\n  );\n}\n\n/** Rows nested under a row, hung from a 9 percent ink rule under the parent's glyph. */\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"sidebar-menu-sub\"\n      data-sidebar=\"menu-sub\"\n      className={cn(\"mx-4.5 mt-0.5 flex min-w-0 flex-col gap-0.5 border-l border-line py-0.5 pl-2 group-data-[collapsible=icon]/sidebar:hidden\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction SidebarMenuSubItem({ className, ...props }: React.ComponentProps<\"li\">) {\n  return <li data-slot=\"sidebar-menu-sub-item\" data-sidebar=\"menu-sub-item\" className={cn(\"group/menu-sub-item relative\", className)} {...props} />;\n}\n\nfunction SidebarMenuSubButton({ asChild = false, size = \"md\", isActive = false, className, ...props }: React.ComponentProps<\"a\"> & { asChild?: boolean; size?: \"sm\" | \"md\"; isActive?: boolean }) {\n  const Comp = asChild ? Slot : \"a\";\n  return (\n    <Comp\n      data-slot=\"sidebar-menu-sub-button\"\n      data-sidebar=\"menu-sub-button\"\n      data-size={size}\n      data-active={isActive || undefined}\n      aria-current={isActive ? \"page\" : undefined}\n      className={cn(\n        \"flex h-7.5 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-menu px-2.5 font-sans text-fg-muted outline-none transition-[background-color,color] duration-150 ease-out hover:bg-wash-hover hover:text-fg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-blue-5 data-[active=true]:text-fg-brand motion-reduce:transition-none [&>span:last-child]:truncate [&>svg]:size-3.5 [&>svg]:shrink-0\",\n        size === \"sm\" ? \"text-caption\" : \"text-body-sm\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport {\n  Sidebar,\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarGroupAction,\n  SidebarGroupContent,\n  SidebarGroupLabel,\n  SidebarHeader,\n  SidebarInput,\n  SidebarInset,\n  SidebarMenu,\n  SidebarMenuAction,\n  SidebarMenuBadge,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarMenuSkeleton,\n  SidebarMenuSub,\n  SidebarMenuSubButton,\n  SidebarMenuSubItem,\n  SidebarProvider,\n  SidebarRail,\n  SidebarSeparator,\n  SidebarTrigger,\n  useSidebar,\n};\n"
    }
  ]
}
