{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq-grouped",
  "type": "registry:block",
  "title": "FAQ, grouped",
  "description": "Questions organised under named topics (billing, setup, privacy). Each topic is a labelled row with its own accordion beside it. Use when you have more than eight questions.",
  "categories": [
    "faq"
  ],
  "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-c-proof.json",
    "https://ui.klarhimmel.com/r/kit-d-chrome.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/faq-grouped/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/faq-grouped/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\n\nconst qa = z.object({ question: t(160), answer: t(600) });\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  groups: z.array(z.object({ name: t(60), summary: t(120), items: z.array(qa).min(1).max(6) })).min(2).max(4),\n});\n\nexport const spec = defineSpec({\n  type: 'faq-grouped',\n  aliases: ['faq/grouped'],\n  name: 'FAQ, grouped',\n  category: 'faq',\n  role: 'body',\n  description: 'Questions organised under named topics (billing, setup, privacy). Each topic is a labelled row with its own accordion beside it. Use when you have more than eight questions.',\n  schema,\n  defaults: {\n    eyebrow: 'Section name',\n    title: 'Say what the groups of answers cover',\n    description: 'Say in one sentence what to do if the answer is not here, and who replies.',\n    groups: [\n      {\n        name: 'First group', summary: 'Say what the group covers',\n        items: [\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n        ],\n      },\n      {\n        name: 'Second group', summary: 'Say what the group covers',\n        items: [\n      { question: 'Ask a common question', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n        ],\n      },\n      {\n        name: 'Third group', summary: 'Say what the group covers',\n        items: [\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n      { question: 'Ask a question customers have', answer: 'Answer in one or two plain sentences, with the key fact first, then what to do or where to go next.' },\n        ],\n      },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/faq-grouped/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/faq-grouped/index.tsx",
      "content": "import { useId } from 'react';\nimport { Plus } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Container, Opt, Section, useEditing } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-kit';\nimport { FOCUS } 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\nfunction FaqGrouped({ props }: BlockProps<Props>) {\n  const oneOpen = useId(); // one open answer at a time, across the groups\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <div className=\"mt-14 divide-y divide-kh-line border-y border-kh-line\">\n          {props.groups.map((group, g) => (\n            <div key={g} className=\"grid gap-6 py-10 @3xl:grid-cols-[14rem_1fr] @3xl:gap-14\">\n              <div className=\"@3xl:pt-4\">\n                <Text path={['groups', g, 'name']} value={group.name} as=\"h3\" className=\"text-kh-heading font-semibold\" />\n                <Opt path={['groups', g, 'summary']} value={group.summary} className=\"mt-1 text-kh-small text-kh-muted\" placeholder=\"Summary\" />\n              </div>\n              <div className=\"divide-y divide-kh-line\">\n                {group.items.map((item, i) => {\n                  const question = <Text path={['groups', g, 'items', i, 'question']} value={item.question} as=\"span\" className=\"text-kh-body font-medium\" />;\n                  const answer = <Text path={['groups', g, 'items', i, 'answer']} value={item.answer} as=\"p\" multiline className=\"pb-5 pr-10 text-kh-body text-kh-muted\" />;\n                  if (editing)\n                    return (\n                      <div key={i} className=\"py-4\">\n                        <div className=\"pb-2\">{question}</div>\n                        {answer}\n                      </div>\n                    );\n                  return (\n                    <details key={i} name={oneOpen} className=\"group\">\n                      <summary className={cn('flex min-h-14 cursor-pointer list-none items-center justify-between gap-6 py-4 text-left [&::-webkit-details-marker]:hidden', FOCUS)}>\n                        {question}\n                        <Plus aria-hidden className=\"size-5 shrink-0 text-kh-muted transition-transform duration-(--kh-dur) group-open:rotate-45\" />\n                      </summary>\n                      {answer}\n                    </details>\n                  );\n                })}\n              </div>\n            </div>\n          ))}\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(FaqGrouped);\n"
    }
  ]
}
