{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "features-tabs",
  "type": "registry:block",
  "title": "Features, tabs",
  "description": "Two to five tabs, each with a title, description, a short list of points and an image. All panels show while editing.",
  "categories": [
    "features"
  ],
  "dependencies": [
    "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/tabs.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/features-tabs/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/features-tabs/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, t } from '../_shared/schema';\n\n// KB-178: panel points max 5 -> 8 and each point 80 -> 160 so real feature lists fit.\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  /** Tabs switch with no script: a native radio per tab, drawn as a row of pills, the first panel open and the others hidden until picked. Off: a script switcher, or with no script every panel one under another. */\n  cssTabs: z.boolean().optional(),\n  /** The picture sits first in each panel: at the left of the text on a wide container, above it on a narrow one. Off: the text first, the picture after it. */\n  mediaFirst: z.boolean().optional(),\n  /** 'start' sets the heading and the tab row flush left instead of centred. Unset keeps them centred. */\n  align: z.enum(['center', 'start']).optional(),\n  /** 'heading' draws the title at the small heading size instead of the section heading size. Unset keeps the section heading. */\n  titleSize: z.enum(['heading']).optional(),\n  tabs: z.array(z.object({\n    label: t(30), title: t(80), description: t(300), points: z.array(t(160)).max(8), media,\n    /** Optional buttons under the panel's points: the first is the primary one; an empty label draws nothing. */\n    link: link.partial().optional(),\n    link2: link.partial().optional(),\n  })).min(2).max(5),\n});\n\nexport const spec = defineSpec({\n  type: 'features-tabs',\n  aliases: ['features/tabs'],\n  sourceRuns: ['rmwj10lzd4f0277'],\n  name: 'Features, tabs',\n  category: 'features',\n  role: 'body',\n  description: 'Two to five tabs, each with a title, description, a short list of points and an image. All panels show while editing.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the tabs take the reader through',\n    description: 'Say in one sentence what the tabs are and what the reader should pick.',\n    tabs: [\n      {\n        label: 'First tab',\n        title: 'Say what the first stage gives the reader',\n        description: 'Say what the reader does in the first stage and what they have by the end of it, in two sentences.',\n        points: ['Name a first thing it includes', 'Name a second thing it includes', 'Name a third thing it includes'],\n        media: { src: '', alt: 'Show a report with one overall score and what it found' },\n      },\n      {\n        label: 'Second tab',\n        title: 'Say what the second stage gives the reader',\n        description: 'Say what the reader does in the second stage and what they have by the end of it, in one sentence.',\n        points: ['Name a first thing it includes', 'Name a second thing it includes', 'Name a third thing it includes'],\n        media: { src: '', alt: 'Show a report with one overall score and what it found' },\n      },\n      {\n        label: 'Third tab',\n        title: 'Say what the third stage gives the reader',\n        description: 'Say what the reader does in the third stage and what they have by the end of it, in two sentences or so.',\n        points: ['Name a first thing it includes', 'Name a second thing it includes', 'Name a third thing it includes'],\n        media: { src: '', alt: 'Show the product at work, with each option side by side' },\n      },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/features-tabs/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/features-tabs/index.tsx",
      "content": "import { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Section, useEditing } from '../_shared/kit';\nimport { cn } from '../../lib/utils';\nimport { CheckItem, Heading, useHeadingId } from '../_shared/c-proof-kit';\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs';\nimport { useInteractive } from '../_shared/d-chrome-kit';\nimport { spec } from './spec';\nimport { useId } from 'react';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\ntype Tab = Props['tabs'][number];\n\n// Native switcher (cssTabs): one hidden radio per tab; its panel follows it and shows when it is checked, and the pill of the checked\n// one is filled. Class names are written out so the stylesheet scan finds them.\nconst PEER = ['peer/t0', 'peer/t1', 'peer/t2', 'peer/t3', 'peer/t4'];\nconst SHOW = ['peer-checked/t0:block', 'peer-checked/t1:block', 'peer-checked/t2:block', 'peer-checked/t3:block', 'peer-checked/t4:block'];\nconst LIT = [\n  'peer-checked/t0:[&>li:nth-child(1)_label]:border-kh-accent peer-checked/t0:[&>li:nth-child(1)_label]:bg-kh-accent peer-checked/t0:[&>li:nth-child(1)_label]:text-kh-accent-fg',\n  'peer-checked/t1:[&>li:nth-child(2)_label]:border-kh-accent peer-checked/t1:[&>li:nth-child(2)_label]:bg-kh-accent peer-checked/t1:[&>li:nth-child(2)_label]:text-kh-accent-fg',\n  'peer-checked/t2:[&>li:nth-child(3)_label]:border-kh-accent peer-checked/t2:[&>li:nth-child(3)_label]:bg-kh-accent peer-checked/t2:[&>li:nth-child(3)_label]:text-kh-accent-fg',\n  'peer-checked/t3:[&>li:nth-child(4)_label]:border-kh-accent peer-checked/t3:[&>li:nth-child(4)_label]:bg-kh-accent peer-checked/t3:[&>li:nth-child(4)_label]:text-kh-accent-fg',\n  'peer-checked/t4:[&>li:nth-child(5)_label]:border-kh-accent peer-checked/t4:[&>li:nth-child(5)_label]:bg-kh-accent peer-checked/t4:[&>li:nth-child(5)_label]:text-kh-accent-fg',\n];\nconst FOCUS = [\n  'peer-focus-visible/t0:[&>li:nth-child(1)_label]:outline-2', 'peer-focus-visible/t1:[&>li:nth-child(2)_label]:outline-2',\n  'peer-focus-visible/t2:[&>li:nth-child(3)_label]:outline-2', 'peer-focus-visible/t3:[&>li:nth-child(4)_label]:outline-2',\n  'peer-focus-visible/t4:[&>li:nth-child(5)_label]:outline-2',\n];\n\nfunction Panel({ tab, i, first }: { tab: Tab; i: number; first?: boolean }) {\n  return (\n    <div className={cn('grid items-center gap-10', first ? '@4xl:grid-cols-[1.1fr_1fr]' : '@4xl:grid-cols-[1fr_1.1fr]', '@4xl:gap-16')}>\n      <div className={first ? 'order-2' : undefined}>\n        <Text path={['tabs', i, 'title']} value={tab.title} as=\"h3\" className=\"text-kh-heading font-semibold @3xl:text-kh-lead\" />\n        <Text path={['tabs', i, 'description']} value={tab.description} as=\"p\" multiline className=\"mt-3 text-kh-body text-kh-muted\" />\n        <ul className=\"mt-6 space-y-3\">\n          {tab.points.map((p, j) => (\n            <CheckItem key={j} path={['tabs', i, 'points', j]} value={p} />\n          ))}\n        </ul>\n        {(tab.link?.label || tab.link2?.label) && (\n          <div className=\"mt-6 flex flex-wrap items-center gap-3\">\n            <ActionLink path={['tabs', i, 'link']} value={{ label: tab.link?.label ?? '', href: tab.link?.href ?? '' }} size=\"md\" />\n            <ActionLink path={['tabs', i, 'link2']} value={{ label: tab.link2?.label ?? '', href: tab.link2?.href ?? '' }} variant=\"secondary\" size=\"md\" />\n          </div>\n        )}\n      </div>\n      <div className={cn('overflow-hidden rounded-kh-xl border border-kh-line shadow-kh-2', first && 'order-1')}>\n        <Media path={['tabs', i, 'media']} value={tab.media} ratio=\"4 / 3\" />\n      </div>\n    </div>\n  );\n}\n\nfunction FeaturesTabs({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  const name = `kh-tabs-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n  const start = props.align === 'start';\n  const css = props.cssTabs === true;\n  const interactive = useInteractive(); // without JavaScript the tabs cannot switch: every panel is shown, labelled, and there are no tab buttons\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} align={start ? 'left' : 'center'} titleClass={props.titleSize === 'heading' ? 'text-kh-heading font-semibold' : undefined} />\n        {css && !editing ? (\n          <div className=\"mt-12 flex flex-col\">\n            {props.tabs.map((tab, i) => (\n              <input key={i} type=\"radio\" name={name} id={`${name}-${i}`} defaultChecked={i === 0} data-kh-css-control=\"\" aria-label={tab.label} className={cn('sr-only', PEER[i])} />\n            ))}\n            <ul className={cn('order-1 flex flex-wrap gap-2', !start && 'justify-center', LIT.join(' '), FOCUS.join(' '))}>\n              {props.tabs.map((tab, i) => (\n                <li key={i}>\n                  <label htmlFor={`${name}-${i}`} className=\"inline-flex min-h-11 cursor-pointer items-center rounded-kh-pill border border-kh-line px-4 text-kh-small hover:border-kh-line-strong focus-visible:outline-offset-2 focus-visible:outline-kh-accent\">\n                    <Text path={['tabs', i, 'label']} value={tab.label} as=\"span\" />\n                  </label>\n                </li>\n              ))}\n            </ul>\n            {props.tabs.map((tab, i) => (\n              <div key={i} className={cn('order-2 mt-12 hidden', SHOW[i])}>\n                <Panel tab={tab} i={i} first={props.mediaFirst} />\n              </div>\n            ))}\n          </div>\n        ) : editing || !interactive ? (\n          // Every panel is open so all copy is reachable; the label is a plain slot instead of a tab button.\n          <div className=\"mt-12 space-y-16\">\n            {props.tabs.map((tab, i) => (\n              <div key={i}>\n                <Text path={['tabs', i, 'label']} value={tab.label} as=\"p\" className=\"mb-4 text-kh-small font-medium text-kh-accent-ink\" />\n                <Panel tab={tab} i={i} first={props.mediaFirst} />\n              </div>\n            ))}\n          </div>\n        ) : (\n          <Tabs defaultValue=\"0\" className=\"mt-12\">\n            <div className=\"flex justify-center\">\n              <TabsList label={props.title || 'Features'} className=\"max-w-full overflow-x-auto\">\n                {props.tabs.map((tab, i) => (\n                  <TabsTrigger key={i} value={String(i)} className=\"min-h-11 px-4\">\n                    <Text path={['tabs', i, 'label']} value={tab.label} as=\"span\" />\n                  </TabsTrigger>\n                ))}\n              </TabsList>\n            </div>\n            {props.tabs.map((tab, i) => (\n              <TabsContent key={i} value={String(i)} className=\"mt-12\">\n                <Panel tab={tab} i={i} first={props.mediaFirst} />\n              </TabsContent>\n            ))}\n          </Tabs>\n        )}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(FeaturesTabs);\n"
    }
  ]
}
