{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or th",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read),\n * collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a\n * panel of the current section's links). side puts it at the start or the end.\n */\nimport { type ReactNode } from \"react\";\nimport { Block, Box, ButtonPlain, Group, Inline, List, ListItem, Text } from \"../compose\";\nimport { LucideIcon } from \"../icons/LucideIcon\";\nimport { MenuEntry } from \"../components/menu-entry\";\nimport { NavBlock } from \"../components/nav-block\";\nimport { cn, tpl, uniqLabel } from \"../utils\";\nimport type { ShellNav } from \"../blocks/dashboard-shell.types\";\n\nexport type ShellSidebarProps = {\n  nav: ShellNav;\n  mode?: \"wide\" | \"rail\" | \"collapsed\" | \"twolevel\" | \"none\";\n  side?: \"start\" | \"end\";\n  brand?: \"show\" | \"hide\";\n  landmarkLabel?: string;\n  onToggle?: () => void;\n};\n\nexport function ShellSidebar({\n  nav,\n  mode = \"wide\",\n  side = \"start\",\n  brand = \"show\",\n  landmarkLabel,\n  onToggle,\n}: ShellSidebarProps) {\n  const named = (mode as string) === \"wide\";\n  return (\n    <Block\n      tag=\"aside\"\n      className={cn(\n        \"flex shrink-0 bg-card\",\n        (\n          (side as string) === \"end\" ? \"flex-row-reverse border-l border-border\"\n          : \"border-r border-border\"\n        )\n      )}\n      aria-label={(landmarkLabel ?? nav.label)}\n      data-mode={mode}\n      data-slot=\"sidebar\"\n    >\n      <Box className={cn(\"flex flex-col gap-6 py-4\", (named ? \"w-64 px-4\" : \"w-16 items-center px-2\"))}>\n        {((brand as string) === \"show\") ? (\n          <Group gap=\"2\" align=\"center\" className=\"shrink-0\" data-slot=\"brand\">\n            <LucideIcon name=\"layers\" size={24} />\n            <Text size=\"base\" weight=\"bold\" className={(named ? \"\" : \"sr-only\")}>\n              {nav.brand}\n            </Text>\n          </Group>\n        ) : null}\n        {((nav.links?.length ?? 0) > 0) ? (\n          <NavBlock\n            label={(landmarkLabel ? uniqLabel(tpl(\"{0}, {1}\", nav.label, landmarkLabel)) : nav.label)}\n            className=\"flex-1\"\n          >\n            <List className=\"m-0 flex list-none flex-col gap-2 p-0\" data-slot=\"items\">\n              {(nav.links ?? []).map((l) => (\n                <ListItem key={l.id} data-slot=\"links-row\">\n                  <MenuEntry\n                    href={l.href}\n                    className={cn(\n                      \"flex items-center gap-4 rounded py-2 text-sm\",\n                      (named ? \"px-4\" : \"justify-center px-2\"),\n                      ((l.id === nav.current) ? \"bg-muted font-medium\" : \"\")\n                    )}\n                    current={(l.id === nav.current)}\n                    size=\"sm\"\n                    testid=\"item\"\n                  >\n                    <LucideIcon name={l.icon} size={16} />\n                    <Inline className={(named ? \"\" : \"sr-only\")}>\n                      {l.name}\n                    </Inline>\n                  </MenuEntry>\n                </ListItem>\n              ))}\n            </List>\n          </NavBlock>\n        ) : null}\n        {((mode as string) === \"collapsed\") ? (\n          <ButtonPlain\n            type=\"button\"\n            className=\"inline-flex size-10 items-center justify-center rounded text-muted-foreground\"\n            aria-label={nav.expand}\n            aria-expanded={(((mode as string) === \"wide\") ? \"true\" : \"false\")}\n            data-slot=\"toggle\"\n            onClick={() => onToggle?.()}\n          >\n            <LucideIcon name=\"panel-left\" size={20} />\n          </ButtonPlain>\n        ) : null}\n      </Box>\n      {(((mode as string) === \"twolevel\") && ((nav.sub?.length ?? 0) > 0)) ? (\n        <Box\n          className={cn(\n            \"flex w-56 flex-col gap-4 px-4 py-6\",\n            (((side as string) === \"end\") ? \"border-r border-border\" : \"border-l border-border\")\n          )}\n          data-slot=\"subnav\"\n        >\n          <Text size=\"sm\" weight=\"semibold\" className=\"px-4\">\n            {nav.subTitle}\n          </Text>\n          <NavBlock label={(landmarkLabel ? uniqLabel(tpl(\"{0}, {1}\", nav.subTitle, landmarkLabel)) : nav.subTitle)}>\n            <List className=\"m-0 flex list-none flex-col gap-2 p-0\">\n              {(nav.sub ?? []).map((s) => (\n                <ListItem key={s.id} data-slot=\"sub-row\">\n                  <MenuEntry\n                    href={s.href}\n                    className={cn(\n                      \"flex items-center gap-4 rounded py-2 text-sm\",\n                      (true ? \"px-4\" : \"justify-center px-2\"),\n                      ((s.id === nav.subCurrent) ? \"bg-muted font-medium\" : \"\")\n                    )}\n                    current={(s.id === nav.subCurrent)}\n                    size=\"sm\"\n                    testid=\"item\"\n                  >\n                    <LucideIcon name={s.icon} size={16} />\n                    <Inline className={(true ? \"\" : \"sr-only\")}>\n                      {s.name}\n                    </Inline>\n                  </MenuEntry>\n                </ListItem>\n              ))}\n            </List>\n          </NavBlock>\n        </Box>\n      ) : null}\n    </Block>\n  );\n}\n",
      "path": "components/shell-sidebar.tsx",
      "target": "components/shell-sidebar.tsx"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "react",
      "component"
    ]
  },
  "name": "shell-sidebar",
  "registryDependencies": [
    "compose",
    "dashboard-shell",
    "lucide-icon",
    "menu-entry",
    "nav-block",
    "utils"
  ],
  "runtime": "react",
  "title": "Shell Sidebar",
  "type": "registry:component"
}
