{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gallery-thumbs",
  "type": "registry:block",
  "title": "Gallery, thumbs",
  "description": "A header row (label, heading, lead) with two actions beside it, then one large wide picture with a caption and a strip of thumbnails beneath; choosing a thumbnail swaps the large picture, with no script. On a phone the actions sit under the header.",
  "categories": [
    "gallery"
  ],
  "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/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/gallery-thumbs/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/gallery-thumbs/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, req, t } from '../_shared/schema';\n\nconst shot = z.object({\n  media,\n  /** Shown under the large picture while this thumbnail is the chosen one. */\n  caption: t(140),\n});\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: req(120),\n  description: t(240),\n  primary: link,\n  secondary: link.optional(),\n  /** A list is an array field, never a slot. The first picture is shown large; each thumbnail picks its own. */\n  items: z.array(shot).min(2).max(8),\n});\n\nexport const spec = defineSpec({\n  type: 'gallery-thumbs',\n  aliases: ['gallery/thumbs'],\n  sourceRuns: ['rmwj1d6ldc43656'],\n  name: 'Gallery, thumbs',\n  category: 'gallery',\n  role: 'body',\n  description: 'A header row (label, heading, lead) with two actions beside it, then one large wide picture with a caption and a strip of thumbnails beneath; choosing a thumbnail swaps the large picture, with no script. On a phone the actions sit under the header.',\n  schema,\n  defaults: {\n    eyebrow: 'Section name',\n    title: 'Say what the pictures show',\n    description: 'Say what the visitor is about to look at and why it matters.',\n    primary: { label: 'Main action', href: '#start' },\n    secondary: { label: 'Second action', href: '#contact' },\n    items: [\n      { media: { src: '', alt: 'Show the main subject, wide and clear' }, caption: 'Say what this picture shows' },\n      { media: { src: '', alt: 'Show a second view of the subject' }, caption: 'Say what this picture shows' },\n      { media: { src: '', alt: 'Show a third view of the subject' }, caption: 'Say what this picture shows' },\n      { media: { src: '', alt: 'Show a fourth view of the subject' }, caption: 'Say what this picture shows' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/gallery-thumbs/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/gallery-thumbs/index.tsx",
      "content": "import { useId } from 'react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Opt, Section } from '../_shared/kit';\nimport { useHeadingId } from '../_shared/c-proof-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\n// Native picker: one hidden radio per picture, each large figure follows its radio and shows when it is checked, and the strip\n// lights the thumbnail of the checked one. Class names are written out so the stylesheet scan finds them.\nconst SHOW = [\n  'peer-checked/g0:block', 'peer-checked/g1:block', 'peer-checked/g2:block', 'peer-checked/g3:block',\n  'peer-checked/g4:block', 'peer-checked/g5:block', 'peer-checked/g6:block', 'peer-checked/g7:block',\n];\nconst LIT = [\n  'peer-checked/g0:[&>li:nth-child(1)_label]:opacity-100 peer-checked/g0:[&>li:nth-child(1)_label]:ring-kh-accent',\n  'peer-checked/g1:[&>li:nth-child(2)_label]:opacity-100 peer-checked/g1:[&>li:nth-child(2)_label]:ring-kh-accent',\n  'peer-checked/g2:[&>li:nth-child(3)_label]:opacity-100 peer-checked/g2:[&>li:nth-child(3)_label]:ring-kh-accent',\n  'peer-checked/g3:[&>li:nth-child(4)_label]:opacity-100 peer-checked/g3:[&>li:nth-child(4)_label]:ring-kh-accent',\n  'peer-checked/g4:[&>li:nth-child(5)_label]:opacity-100 peer-checked/g4:[&>li:nth-child(5)_label]:ring-kh-accent',\n  'peer-checked/g5:[&>li:nth-child(6)_label]:opacity-100 peer-checked/g5:[&>li:nth-child(6)_label]:ring-kh-accent',\n  'peer-checked/g6:[&>li:nth-child(7)_label]:opacity-100 peer-checked/g6:[&>li:nth-child(7)_label]:ring-kh-accent',\n  'peer-checked/g7:[&>li:nth-child(8)_label]:opacity-100 peer-checked/g7:[&>li:nth-child(8)_label]:ring-kh-accent',\n];\nconst PEER = ['peer/g0', 'peer/g1', 'peer/g2', 'peer/g3', 'peer/g4', 'peer/g5', 'peer/g6', 'peer/g7'];\nconst FOCUS = [\n  'peer-focus-visible/g0:[&>li:nth-child(1)_label]:outline-2', 'peer-focus-visible/g1:[&>li:nth-child(2)_label]:outline-2',\n  'peer-focus-visible/g2:[&>li:nth-child(3)_label]:outline-2', 'peer-focus-visible/g3:[&>li:nth-child(4)_label]:outline-2',\n  'peer-focus-visible/g4:[&>li:nth-child(5)_label]:outline-2', 'peer-focus-visible/g5:[&>li:nth-child(6)_label]:outline-2',\n  'peer-focus-visible/g6:[&>li:nth-child(7)_label]:outline-2', 'peer-focus-visible/g7:[&>li:nth-child(8)_label]:outline-2',\n];\n\n// A header row with the actions beside it, one large wide picture with its caption, and a strip of four-up thumbnails beneath.\nfunction GalleryThumbs({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const name = `kh-gal-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n  const items = props.items.slice(0, 8);\n  return (\n    <Section labelledBy={id}>\n      <div className=\"px-kh-gutter\">\n        <div className=\"mx-auto max-w-kh-page\">\n          <div className=\"flex flex-col gap-6 @3xl:flex-row @3xl:items-end @3xl:justify-between\">\n            <div className=\"max-w-kh-narrow\">\n              <Opt path={['eyebrow']} value={props.eyebrow} className=\"font-kh-mono text-kh-caption uppercase tracking-widest text-kh-accent-ink\" placeholder=\"Eyebrow\" />\n              <div id={id}>\n                <Text path={['title']} value={props.title} as=\"h2\" className=\"mt-3 font-kh-display text-kh-title text-kh-ink\" />\n              </div>\n              <Opt path={['description']} value={props.description} multiline className=\"mt-4 font-kh-sans text-kh-lead text-kh-ink-2\" placeholder=\"Description\" />\n            </div>\n            <div className=\"flex flex-wrap gap-3\">\n              <ActionLink path={['primary']} value={props.primary} size=\"md\" className=\"rounded-kh-pill\" />\n              {props.secondary && <ActionLink path={['secondary']} value={props.secondary} variant=\"secondary\" size=\"md\" className=\"rounded-kh-pill\" />}\n            </div>\n          </div>\n\n          <div className=\"mt-12 flex flex-col\">\n            {items.map((it, i) => (\n              <input key={i} type=\"radio\" name={name} id={`${name}-${i}`} defaultChecked={i === 0} data-kh-css-control=\"\" aria-label={it.caption || it.media.alt || `Picture ${i + 1}`} className={cn('sr-only', PEER[i])} />\n            ))}\n            {items.map((it, i) => (\n              <figure key={i} className={cn('order-1 hidden', SHOW[i])}>\n                <Media path={['items', i, 'media']} value={it.media} ratio=\"16 / 9\" className=\"w-full rounded-kh-xl shadow-kh-2\" />\n                <Opt path={['items', i, 'caption']} value={it.caption} as=\"figcaption\" className=\"mt-4 font-kh-sans text-kh-small text-kh-muted\" placeholder=\"Caption\" />\n              </figure>\n            ))}\n            <ul className={cn('order-2 mt-4 grid grid-cols-4 gap-4', LIT.join(' '), FOCUS.join(' '))}>\n              {items.map((it, i) => (\n                <li key={i}>\n                  <label htmlFor={`${name}-${i}`} className={cn('block w-full cursor-pointer overflow-hidden rounded-kh opacity-70 ring-2 ring-transparent hover:opacity-100 hover:ring-kh-line-strong focus-visible:outline-offset-2 focus-visible:outline-kh-accent')}>\n                    <Media path={['items', i, 'media']} value={it.media} ratio=\"4 / 3\" className=\"w-full\" />\n                  </label>\n                </li>\n              ))}\n            </ul>\n          </div>\n        </div>\n      </div>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(GalleryThumbs);\n"
    }
  ]
}
