{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-centered",
  "type": "registry:block",
  "title": "Navbar, centred",
  "description": "Brand centred with the links split either side, a secondary link and one call to action. Collapses to a menu in narrow containers.",
  "categories": [
    "navbar"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "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/kit-d-chrome.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/navbar-centered/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/navbar-centered/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t, req, wordmark } from '../_shared/schema';\n\nconst schema = z.object({\n  brand: req(40),\n  /** Their logo in place of the brand name; the name stays for screen readers. Not drawn without a src. */\n  wordmark,\n  /** Brand link target; default \"/\". */\n  brandHref: t(300).optional(),\n  links: z.array(link).max(6),\n  /** The href of the current page's link: that link gets aria-current=\"page\". */\n  current: t(300).optional(),\n  secondary: link,\n  cta: link,\n});\n\nexport const spec = defineSpec({\n  type: 'navbar-centered',\n  aliases: ['navigation/centered', 'header/centered'],\n  name: 'Navbar, centred',\n  category: 'navbar',\n  role: 'nav',\n  description: 'Brand centred with the links split either side, a secondary link and one call to action. Collapses to a menu in narrow containers.',\n  schema,\n  defaults: {\n    brand: 'Brand name',\n    links: [\n      { label: 'First page', href: '#product' },\n      { label: 'Second page', href: '#pricing' },\n      { label: 'Third page', href: '#docs' },\n      { label: 'Fourth page', href: '#about' },\n    ],\n    secondary: { label: 'Sign in', href: '#signin' },\n    cta: { label: 'Main action', href: '#start' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/navbar-centered/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/navbar-centered/index.tsx",
      "content": "import { Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { ActionLink, brandName, Container, useEditing, Gate, Named } from '../_shared/kit';\nimport { FOCUS, MenuDetails, navLinkClass, useMenu } from '../_shared/d-chrome-kit';\nimport { cn } from '../../lib/utils';\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\nconst linkClass = cn(navLinkClass, 'w-full whitespace-nowrap text-kh-body @5xl:w-auto @5xl:text-kh-small');\n\nfunction NavbarCentered({ props }: BlockProps<Props>) {\n  const { shown, setOpen, menuId, summaryRef, detailsRef, rootRef, rootProps } = useMenu();\n  const editing = useEditing();\n  const half = Math.ceil(props.links.length / 2);\n  const item = (l: { label: string; href: string }, i: number) => (\n    <Gate key={i} label={l.label}>\n    <li>\n      <a href={safeHref(l.href)} aria-current={props.current && l.href === props.current ? 'page' : undefined} onClick={() => setOpen(false)} className={linkClass}>\n        <Text path={['links', i, 'label']} value={l.label} as=\"span\" />\n      </a>\n    </li>\n    </Gate>\n  );\n  return (\n    <header ref={rootRef} {...rootProps} className=\"relative border-b border-kh-line bg-kh-canvas\">\n      <Container>\n        <nav aria-label=\"Main\" className=\"flex min-h-16 flex-wrap items-center justify-between gap-2 py-2 @5xl:grid @5xl:grid-cols-[1fr_auto_1fr] @5xl:flex-nowrap @5xl:gap-6\">\n          <Named as=\"a\" href={safeHref(props.brandHref ?? '/')} className={cn('max-w-full [overflow-wrap:anywhere] rounded-kh-sm text-kh-heading font-semibold tracking-tight text-kh-ink @5xl:col-start-2 @5xl:row-start-1', FOCUS)}>\n            {brandName({ brand: props.brand, wordmark: props.wordmark })}\n          </Named>\n          <MenuDetails shown={shown} onToggle={setOpen} summaryRef={summaryRef} detailsRef={detailsRef} className=\"@5xl:hidden\" detailsClass={cn('@5xl:contents @5xl:details-content:contents @5xl:details-content:content-visible', editing && 'order-last basis-full')}>\n          <div\n            id={menuId}\n            className={cn(\n              'flex flex-col gap-2 border-b border-kh-line bg-kh-canvas pb-5 pt-2',\n              editing ? 'order-last basis-full' : 'absolute inset-x-0 top-full z-10 max-h-[calc(100dvh-4rem)] overflow-y-auto px-kh-gutter',\n              '@5xl:contents',\n            )}\n          >\n            <ul className=\"-mx-3 flex flex-col gap-0.5 @5xl:col-start-1 @5xl:row-start-1 @5xl:ml-0 @5xl:mr-0 @5xl:-ml-3 @5xl:flex-row @5xl:gap-1\">\n              {props.links.slice(0, half).map((l, i) => item(l, i))}\n            </ul>\n            <div className=\"-mx-3 flex flex-col gap-0.5 @5xl:col-start-3 @5xl:row-start-1 @5xl:mx-0 @5xl:flex-row @5xl:items-center @5xl:justify-end @5xl:gap-1\">\n              <ul className=\"flex flex-col gap-0.5 @5xl:flex-row @5xl:gap-1\">\n                {props.links.slice(half).map((l, i) => item(l, i + half))}\n              </ul>\n              <Gate label={props.secondary.label}>\n                <a href={safeHref(props.secondary.href)} className={linkClass}>\n                  <Text path={['secondary', 'label']} value={props.secondary.label} as=\"span\" />\n                </a>\n              </Gate>\n              <div className=\"mx-3 mt-2 @5xl:mx-0 @5xl:mt-0 @5xl:ml-2\">\n                <ActionLink path={['cta']} value={props.cta} size=\"md\" className=\"w-full whitespace-nowrap @5xl:w-auto\" />\n              </div>\n            </div>\n          </div>\n          </MenuDetails>\n        </nav>\n      </Container>\n    </header>\n  );\n}\n\nexport default withHeadingLevel(NavbarCentered);\n"
    }
  ]
}
