{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq-list",
  "type": "registry:block",
  "title": "FAQ, list",
  "description": "A heading with a ruled list of questions that open to show the answer: beside the list, stacked above it, or stacked and centred over a narrower list.",
  "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"
  ],
  "files": [
    {
      "path": "src/blocks/faq-list/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/faq-list/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  items: z.array(z.object({ question: t(140), answer: t(600) })).min(1).max(10),\n  /** Where the heading sits: beside the list (the default), stacked above it at the start, or stacked and centred over a narrower list. */\n  layout: z.enum(['beside', 'stacked', 'center']).optional(),\n  /** Optional actions, placed by the layout: under the heading (beside), under the list and centred (center), or at the end of the heading row (stacked). Leave both out for none. */\n  /** Heading size: the section title size (the default) or the smaller heading size, for a quiet heading over a long list. */\n  headingSize: z.enum(['title', 'heading']).optional(),\n  primaryAction: link.partial().optional(),\n  secondaryAction: link.partial().optional(),\n});\n\nexport const spec = defineSpec({\n  type: 'faq-list',\n  aliases: ['faq/accordion'],\n  sourceRuns: ['rmwj0ua7g59097e', 'rmwj0ua7hbf506b'],\n  name: 'FAQ, list',\n  category: 'faq',\n  role: 'body',\n  description: 'A heading with a ruled list of questions that open to show the answer: beside the list, stacked above it, or stacked and centred over a narrower list.',\n  schema,\n  defaults: {\n    eyebrow: 'Section',\n    title: 'Say what the answers cover',\n    description: 'Say in one sentence what to do if the answer is not here, and who replies.',\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      { 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      { question: 'Ask a question a customer would ask before deciding', 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"
    },
    {
      "path": "src/blocks/faq-list/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/faq-list/index.tsx",
      "content": "import { useId } from 'react';\nimport { Plus } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Section, SectionHeader, useEditing } 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 FaqList({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const layout = props.layout ?? 'beside';\n  const actions = (cls: string) =>\n    props.primaryAction || props.secondaryAction ? (\n      <div className={`flex flex-wrap gap-3 ${cls}`}>\n        {props.primaryAction && <ActionLink path={['primaryAction']} value={{ label: props.primaryAction.label ?? '', href: props.primaryAction.href ?? '' }} size=\"md\" />}\n        {props.secondaryAction && <ActionLink path={['secondaryAction']} value={{ label: props.secondaryAction.label ?? '', href: props.secondaryAction.href ?? '' }} variant=\"secondary\" size=\"md\" />}\n      </div>\n    ) : null;\n  const hasActions = !!(props.primaryAction || props.secondaryAction);\n  const header = <SectionHeader id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} align={layout === 'center' ? 'center' : 'left'} className={props.headingSize === 'heading' ? '[&_h2]:text-kh-heading [&_h2]:font-medium' : undefined} />;\n  return (\n    <Section labelledBy={id}>\n      <Container className={layout === 'beside' ? 'grid gap-12 @4xl:grid-cols-[1fr_1.6fr] @4xl:gap-20' : 'grid gap-10'}>\n        {hasActions && layout === 'beside' ? (\n          <div className=\"flex flex-col items-start gap-6\">{header}{actions('pt-2')}</div>\n        ) : hasActions && layout === 'stacked' ? (\n          <div className=\"flex flex-wrap items-end justify-between gap-6\">{header}{actions('')}</div>\n        ) : (\n          header\n        )}\n        <div className={`divide-y divide-kh-line border-y border-kh-line ${layout === 'stacked' ? 'max-w-4xl' : layout === 'center' ? 'mx-auto w-full max-w-3xl' : ''}`}>\n          {props.items.map((item, i) => {\n            const question = <Text path={['items', i, 'question']} value={item.question} as=\"span\" className=\"text-kh-heading font-medium\" />;\n            const answer = <Text path={['items', i, 'answer']} value={item.answer} as=\"p\" multiline className=\"pb-6 pr-10 text-kh-body text-kh-muted\" />;\n            // While editing, every answer is open and the question is not a <summary>, so Space and Enter type instead of toggling.\n            if (editing)\n              return (\n                <div key={i} className=\"py-5\">\n                  <div className=\"pb-3\">{question}</div>\n                  {answer}\n                </div>\n              );\n            return (\n              <details key={i} name={id} className=\"group\">\n                <summary className=\"flex min-h-14 cursor-pointer list-none items-center justify-between gap-6 py-5 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus) [&::-webkit-details-marker]:hidden\">\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        {hasActions && layout === 'center' && actions('justify-center')}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(FaqList);\n"
    }
  ]
}
