{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-search",
  "type": "registry:block",
  "title": "Navbar, search",
  "description": "A shop header: the brand, a wide rounded search field, round account and basket buttons, then a row of category links under a rule. On a phone the search drops to its own full-width line and the links wrap.",
  "categories": [
    "navbar"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "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-c-proof.json"
  ],
  "files": [
    {
      "path": "src/blocks/navbar-search/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/navbar-search/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, mark, req, t } from '../_shared/schema';\n\nconst schema = z.object({\n  brand: req(40),\n  /** The brand mark before the name: SVG paths in currentColor, aria-hidden. Not drawn without paths. */\n  mark,\n  /** Brand link target; default \"/\". */\n  brandHref: t(300).optional(),\n  /** The search form: it submits a GET to this address with the words in `q`, so it works with no script. */\n  search: z.object({\n    label: req(60),\n    placeholder: t(40),\n    href: t(300),\n  }),\n  /** Round icon buttons beside the search: the visitor's account, the basket, a wish list. The label names the icon for screen readers. */\n  actions: z.array(z.object({ icon: z.enum(['account', 'basket', 'heart']), label: req(60), href: t(300) })).max(3),\n  /** The category row under the rule. It wraps onto more lines instead of folding into a menu. */\n  links: z.array(link).min(1).max(10),\n  /** Name of the category row for screen readers. */\n  linksLabel: req(60),\n  /** true keeps the search field in the first row beside the brand and buttons on a phone, shrunk to fit, instead of dropping it to its own full-width line. */\n  searchInline: z.boolean().optional(),\n});\n\nexport const spec = defineSpec({\n  type: 'navbar-search',\n  aliases: ['navigation/search', 'header/search'],\n  sourceRuns: ['rmwj1vkola2b78f', 'rmwj3dgr54fb1d3'],\n  name: 'Navbar, search',\n  category: 'navbar',\n  role: 'body',\n  description: 'A shop header: the brand, a wide rounded search field, round account and basket buttons, then a row of category links under a rule. On a phone the search drops to its own full-width line and the links wrap.',\n  schema,\n  defaults: {\n    brand: 'Write the business name',\n    search: { label: 'Name the search field for screen readers', placeholder: 'Say what to search for', href: '/search' },\n    actions: [\n      { icon: 'account', label: 'Name the account page', href: '#account' },\n      { icon: 'basket', label: 'Name the basket page', href: '#basket' },\n    ],\n    links: [\n      { label: 'Name the first category', href: '#first' },\n      { label: 'Name the second category', href: '#second' },\n      { label: 'Name the third category', href: '#third' },\n      { label: 'Name the fourth category', href: '#fourth' },\n      { label: 'Name the fifth category', href: '#fifth' },\n    ],\n    linksLabel: 'Name the category row',\n  },\n});\n"
    },
    {
      "path": "src/blocks/navbar-search/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/navbar-search/index.tsx",
      "content": "import { Heart, Search, ShoppingCart, User } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { BrandMark, Container, Gate, Mark, Named, brandName } from '../_shared/kit';\nimport { useHeadingId } from '../_shared/c-proof-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\nconst ICONS = { account: User, basket: ShoppingCart, heart: Heart } as const;\nconst FOCUS = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kh-accent';\n\n// The header's own name is the brand, so no heading is drawn; the search and the category row are named regions.\nfunction NavbarSearch({ props }: BlockProps<Props>) {\n  const searchId = useHeadingId(props.search.label);\n  const linksId = useHeadingId(props.linksLabel);\n  return (\n    <header className=\"border-b border-kh-line bg-kh-surface text-kh-ink\">\n      <Container>\n        <div className=\"flex flex-wrap items-center gap-x-4 gap-y-3 py-4\">\n          <Named as=\"a\" href={safeHref(props.brandHref ?? '/')} className={`inline-flex shrink-0 items-center gap-(--kh-mark-gap) rounded-kh-sm text-kh-heading font-semibold leading-none whitespace-nowrap text-kh-ink ${FOCUS}`}>\n            <Mark mark={props.mark} />\n            <BrandMark path={['logo']} />\n            {brandName({ brand: props.brand })}\n          </Named>\n          <Gate label={props.search.label}>\n          <Gate label={props.search.label}>\n          <form role=\"search\" action={safeHref(props.search.href)} method=\"get\" aria-labelledby={searchId} className={props.searchInline ? 'relative flex min-w-0 flex-1 items-center gap-2 rounded-kh-pill border border-kh-line bg-kh-surface-2 px-4 py-2 text-kh-ink focus-within:ring-2 focus-within:ring-kh-accent' : 'relative order-last flex min-w-0 basis-full items-center gap-2 rounded-kh-pill border border-kh-line bg-kh-surface-2 px-4 py-2 text-kh-ink focus-within:ring-2 focus-within:ring-kh-accent @md:order-none @md:flex-1 @md:basis-auto'}>\n            <span id={searchId} className=\"sr-only\"><Text path={['search', 'label']} value={props.search.label} as=\"span\" /></span>\n            <Search aria-hidden strokeWidth={1.75} className=\"size-5 shrink-0 text-kh-muted\" />\n            <span className=\"relative min-w-0 flex-1\">\n              <input type=\"search\" name=\"q\" placeholder=\" \" aria-labelledby={searchId} className=\"peer w-full min-w-0 bg-transparent text-kh-small text-kh-ink outline-none\" />\n              <Text path={['search', 'placeholder']} value={props.search.placeholder} as=\"span\" className=\"pointer-events-none absolute inset-y-0 start-0 flex items-center truncate text-kh-small text-kh-muted peer-[:not(:placeholder-shown)]:hidden\" />\n            </span>\n          </form>\n          </Gate>\n          </Gate>\n          <div className=\"ml-auto flex shrink-0 items-center gap-1\">\n            {props.actions.map((a, i) => {\n              const I = ICONS[a.icon] ?? User;\n              return (\n                <Gate key={i} label={a.label}>\n                  <a href={safeHref(a.href)} className={`inline-flex size-10 items-center justify-center rounded-kh-pill text-kh-ink-2 hover:bg-kh-surface-2 hover:text-kh-ink ${FOCUS}`}>\n                    <I aria-hidden strokeWidth={1.75} className=\"size-5\" />\n                    <Text path={['actions', i, 'label']} value={a.label} as=\"span\" className=\"sr-only\" />\n                  </a>\n                </Gate>\n              );\n            })}\n          </div>\n        </div>\n        <nav aria-labelledby={linksId} className=\"border-t border-kh-line\">\n          <span id={linksId} className=\"sr-only\"><Text path={['linksLabel']} value={props.linksLabel} as=\"span\" /></span>\n          <ul className=\"flex flex-wrap gap-x-6 gap-y-2 py-3 text-kh-small text-kh-ink-2\">\n            {props.links.map((l, i) => (\n              <Gate key={i} label={l.label}>\n                <li>\n                  <a href={safeHref(l.href)} className={`hover:text-kh-accent ${FOCUS}`}>\n                    <Text path={['links', i, 'label']} value={l.label} as=\"span\" />\n                  </a>\n                </li>\n              </Gate>\n            ))}\n          </ul>\n        </nav>\n      </Container>\n    </header>\n  );\n}\n\nexport default withHeadingLevel(NavbarSearch);\n"
    }
  ]
}
