{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "app-shell-topbar",
  "type": "registry:block",
  "title": "App, top bar",
  "description": "The top bar of an app: breadcrumbs (the last is the current page, aria-current) and an account menu on an avatar button that opens with Enter, Space or the arrow keys, lists the account actions and returns focus on Escape.",
  "categories": [
    "app"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/avatar.json",
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/menu.json"
  ],
  "files": [
    {
      "path": "src/blocks/app-shell-topbar/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/app-shell-topbar/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t, req } from '../_shared/schema';\n\nconst schema = z.object({\n  /** Names the breadcrumb landmark. Not shown. */\n  crumbsLabel: t(40),\n  /** From the top down; the last one is the page itself and is not a link. */\n  crumbs: z.array(link).min(2).max(5),\n  account: z.object({\n    /** The name of the menu button. Not shown. */\n    label: req(40),\n    name: t(40),\n    email: t(60),\n    items: z.array(t(30)).min(1).max(4),\n    signOut: t(30),\n  }),\n});\n\nexport const spec = defineSpec({\n  type: 'app-shell-topbar',\n  aliases: ['app/shell-topbar'],\n  name: 'App, top bar',\n  category: 'app',\n  role: 'body',\n  description: 'The top bar of an app: breadcrumbs (the last is the current page, aria-current) and an account menu on an avatar button that opens with Enter, Space or the arrow keys, lists the account actions and returns focus on Escape.',\n  schema,\n  defaults: {\n    \"crumbsLabel\": \"You are here\",\n    \"crumbs\": [\n      {\n        \"label\": \"Name the product\",\n        \"href\": \"#home\"\n      },\n      {\n        \"label\": \"Name a section\",\n        \"href\": \"#bookings\"\n      },\n      {\n        \"label\": \"Name the item\",\n        \"href\": \"#booking\"\n      }\n    ],\n    \"account\": {\n      \"label\": \"Account menu\",\n      \"name\": \"Name a person\",\n      \"email\": \"name@example.com\",\n      \"items\": [\n        \"Profile\",\n        \"Notifications\",\n        \"Billing\"\n      ],\n      \"signOut\": \"Sign out\"\n    }\n  },\n});\n"
    },
    {
      "path": "src/blocks/app-shell-topbar/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/app-shell-topbar/index.tsx",
      "content": "import { useId } from 'react';\nimport { ChevronRight, LogOut } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Avatar } from '../../ui/avatar';\nimport { safeHref } from '../../ui/button';\nimport { Menu, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger } from '../../ui/menu';\nimport { Container, Section, useEditing, useNamed } from '../_shared/kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nfunction AppShellTopbar({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const last = props.crumbs.length - 1;\n  const { account } = props;\n  const accountNamed = useNamed(account.label);\n  return (\n    <Section className=\"py-8\">\n      <Container>\n        <header className=\"flex min-h-16 items-center justify-between gap-4 rounded-kh-xl border border-kh-line bg-kh-surface px-4 shadow-kh-1\">\n          <span id={`${id}-c`} className=\"sr-only\">\n            <Text path={['crumbsLabel']} value={props.crumbsLabel} as=\"span\" />\n          </span>\n          <nav aria-labelledby={`${id}-c`} className=\"min-w-0\">\n            <ol className=\"flex min-w-0 flex-wrap items-center gap-x-1 text-kh-small\">\n              {props.crumbs.map((c, i) => (!c.label && !editing ? null : (\n                <li key={i} className=\"flex min-w-0 items-center gap-1\">\n                  {i === last ? (\n                    <span aria-current=\"page\" className=\"truncate font-medium text-kh-ink\">\n                      <Text path={['crumbs', i, 'label']} value={c.label} as=\"span\" />\n                    </span>\n                  ) : (\n                    <a href={safeHref(c.href)} className=\"inline-flex min-h-11 items-center truncate rounded-kh-sm text-kh-muted hover:text-kh-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">\n                      <Text path={['crumbs', i, 'label']} value={c.label} as=\"span\" />\n                    </a>\n                  )}\n                  {i < last && <ChevronRight aria-hidden className=\"size-3.5 shrink-0 text-kh-muted\" />}\n                </li>\n              )))}\n            </ol>\n          </nav>\n          {accountNamed && (\n          <Menu open={editing ? true : undefined}>\n            <MenuTrigger asChild>\n              <button type=\"button\" className=\"inline-flex size-11 shrink-0 items-center justify-center rounded-kh-pill focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">\n                <Avatar name={account.name} size=\"sm\" decorative />\n                <span className=\"sr-only\">\n                  <Text path={['account', 'label']} value={account.label} as=\"span\" />\n                </span>\n              </button>\n            </MenuTrigger>\n            <MenuContent align=\"end\">\n              <MenuLabel>\n                <Text path={['account', 'name']} value={account.name} as=\"span\" className=\"block text-kh-small font-medium text-kh-ink\" />\n                <Text path={['account', 'email']} value={account.email} as=\"span\" className=\"block font-normal\" />\n              </MenuLabel>\n              <MenuSeparator />\n              {account.items.map((it, i) => (\n                <MenuItem key={i}>\n                  <Text path={['account', 'items', i]} value={it} as=\"span\" />\n                </MenuItem>\n              ))}\n              <MenuSeparator />\n              <MenuItem icon={<LogOut />}>\n                <Text path={['account', 'signOut']} value={account.signOut} as=\"span\" />\n              </MenuItem>\n            </MenuContent>\n          </Menu>\n          )}\n        </header>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(AppShellTopbar);\n"
    }
  ]
}
