{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "directory-header",
  "type": "registry:block",
  "title": "Directory, header",
  "description": "Title and description of a catalogue page, with optional breadcrumbs, search field, select labels and filter chips. Presentation only: the site wires search and sort.",
  "categories": [
    "directory"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-b-directory.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/directory-header/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/directory-header/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t, req } from '../_shared/schema';\n\nconst schema = z.object({\n  breadcrumbs: z.array(link).max(4),\n  eyebrow: t(60),\n  title: t(80),\n  description: t(300),\n  search: z.object({ placeholder: t(60) }),\n  selects: z.array(req(40)).max(3),\n  chips: z.array(req(30)).max(12),\n  active: t(30),\n});\n\nexport const spec = defineSpec({\n  type: 'directory-header',\n  aliases: ['directory/header'],\n  name: 'Directory, header',\n  category: 'directory',\n  role: 'body',\n  description: 'Title and description of a catalogue page, with optional breadcrumbs, search field, select labels and filter chips. Presentation only: the site wires search and sort.',\n  schema,\n  defaults: {\n    breadcrumbs: [],\n    eyebrow: 'Name the section',\n    title: 'Name the page',\n    description: 'Say in one or two sentences what the page lists and how a reader can narrow it.',\n    search: { placeholder: 'Say what to search by' },\n    selects: ['Name the first filter', 'Name a sort order'],\n    chips: ['Filter one', 'Filter two', 'Filter three', 'Filter four', 'Filter five', 'Filter six'],\n    active: 'Filter one',\n  },\n});\n"
    },
    {
      "path": "src/blocks/directory-header/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/directory-header/index.tsx",
      "content": "import { useId } from 'react';\nimport { ChevronDown, Search } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { Container, Eyebrow, Opt, useEditing } from '../_shared/kit';\nimport { Breadcrumbs, SlotField } from '../_shared/b-directory-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 DirectoryHeader({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const hasTools = !!props.search.placeholder || props.selects.length > 0 || editing;\n  return (\n    <header aria-labelledby={id} className=\"pt-6 pb-4 @3xl:pt-8 @3xl:pb-5\">\n      <Container>\n        <Breadcrumbs items={props.breadcrumbs} className=\"mb-3\" />\n        <Eyebrow path={['eyebrow']} value={props.eyebrow} className=\"mb-3\" />\n        <div id={id}>\n          <Text path={['title']} value={props.title} as=\"h1\" className=\"text-kh-title font-semibold\" />\n        </div>\n        <Opt path={['description']} value={props.description} multiline className=\"mt-2 max-w-3xl text-kh-body text-kh-muted\" placeholder=\"Description\" />\n        {hasTools && (\n          <div className=\"mt-4 flex flex-col gap-3 @2xl:flex-row @2xl:items-center\">\n            {(props.search.placeholder || editing) && (\n              <SlotField\n                path={['search', 'placeholder']}\n                value={props.search.placeholder}\n                icon={<Search aria-hidden className=\"pointer-events-none my-auto mr-2.5 size-4 shrink-0 text-kh-muted\" />}\n                className=\"min-h-11 items-center rounded-kh border border-kh-line-strong bg-kh-surface px-3 shadow-kh-1 transition-[border-color] duration-(--kh-dur) hover:border-kh-muted focus-within:outline-2 focus-within:outline-(--kh-focus) @2xl:max-w-sm @2xl:flex-1\"\n              />\n            )}\n            {props.selects.length > 0 && (\n              <div className=\"flex flex-wrap gap-3\">\n                {props.selects.map((label, i) => (\n                  <button\n                    key={i}\n                    type=\"button\"\n                    aria-haspopup=\"listbox\"\n                    className=\"inline-flex min-h-11 items-center gap-2 rounded-kh border border-kh-line-strong bg-kh-surface px-3.5 text-kh-small font-medium text-kh-ink shadow-kh-1 transition-colors duration-(--kh-dur) hover:bg-kh-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\"\n                  >\n                    <Text path={['selects', i]} value={label} as=\"span\" />\n                    <ChevronDown aria-hidden className=\"size-4 text-kh-muted\" />\n                  </button>\n                ))}\n              </div>\n            )}\n          </div>\n        )}\n        {props.chips.length > 0 && (\n          <ul aria-label=\"Filters\" className=\"mt-5 flex flex-wrap gap-2\">\n            {props.chips.map((chip, i) => {\n              const on = chip === props.active;\n              return (\n                <li key={i}>\n                  <button\n                    type=\"button\"\n                    aria-pressed={on}\n                    className={cn(\n                      'inline-flex min-h-11 items-center rounded-kh-pill border px-4 text-kh-small font-medium transition-colors duration-(--kh-dur) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)',\n                      on ? 'border-kh-ink bg-kh-ink text-kh-on-ink' : 'border-kh-line-strong bg-kh-surface text-kh-ink-2 hover:bg-kh-surface-2 hover:text-kh-ink',\n                    )}\n                  >\n                    <Text path={['chips', i]} value={chip} as=\"span\" />\n                  </button>\n                </li>\n              );\n            })}\n          </ul>\n        )}\n      </Container>\n    </header>\n  );\n}\n\nexport default withHeadingLevel(DirectoryHeader);\n"
    }
  ]
}
