{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gallery-strip",
  "type": "registry:block",
  "title": "Gallery, scroll strip",
  "description": "A single row of same-height images that scrolls sideways with snap points and keyboard focus. Takes little height, so it fits between sections. The label names the region for screen readers.",
  "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/kit-d-chrome.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/gallery-strip/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/gallery-strip/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, media, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  stripLabel: t(60),\n  items: z.array(z.object({ media, caption: t(100) })).min(3).max(10),\n});\n\nexport const spec = defineSpec({\n  type: 'gallery-strip',\n  aliases: ['gallery/strip'],\n  name: 'Gallery, scroll strip',\n  category: 'gallery',\n  role: 'body',\n  description: 'A single row of same-height images that scrolls sideways with snap points and keyboard focus. Takes little height, so it fits between sections. The label names the region for screen readers.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the topic',\n    title: 'Say what the pictures show',\n    description: 'Say in one line how far away they are.',\n    stripLabel: 'Say what the pictures show, and how to scroll',\n    items: [\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place and how far it is' },\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place' },\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place' },\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place' },\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place' },\n      { media: { src: '', alt: 'Show the subject of this picture, close' }, caption: 'Name the place' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/gallery-strip/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/gallery-strip/index.tsx",
      "content": "import { useId } from 'react';\nimport { Media, 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\n// Three or four pictures fit the page width, so from @3xl they sit in one row on the content edges instead of running past the right one.\nconst FIT: Record<number, string> = { 3: '@3xl:grid @3xl:grid-cols-3 @3xl:overflow-visible', 4: '@3xl:grid @3xl:grid-cols-4 @3xl:overflow-visible' };\n\nconst INSET = 'px-[max(var(--kh-gutter),calc((100%_-_var(--container-kh-page))/2_+_var(--kh-gutter)))] scroll-px-[max(var(--kh-gutter),calc((100%_-_var(--container-kh-page))/2_+_var(--kh-gutter)))]';\n\nfunction GalleryStrip({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const labelId = useId();\n  const editing = useEditing();\n  const fit = FIT[props.items.length];\n  const headed = editing || Boolean(props.eyebrow || props.title || props.description);\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n      </Container>\n      <p id={labelId} className={editing ? cn('mt-8 text-kh-caption text-kh-muted', INSET) : 'sr-only'}>\n        <Text path={['stripLabel']} value={props.stripLabel} as=\"span\" />\n      </p>\n      {/* The strip is a focusable scroll region so keyboard users can reach every picture with the arrow keys. Its inset matches the\n          Container's, so the first picture shares the heading's left edge at any width and the strip still bleeds to the right. */}\n      <div\n        role=\"region\"\n        aria-labelledby={labelId}\n        tabIndex={0}\n        className={cn('flex snap-x snap-mandatory gap-5 overflow-x-auto pb-4', headed && 'mt-12', fit, INSET, FOCUS)}\n      >\n        {props.items.map((item, i) => (\n          <figure key={i} className={cn('w-72 shrink-0 snap-start', fit ? '@3xl:w-auto' : '@3xl:w-96')}>\n            <Media path={['items', i, 'media']} value={item.media} ratio=\"4 / 3\" className=\"rounded-kh-lg border border-kh-line\" />\n            <Opt path={['items', i, 'caption']} value={item.caption} as=\"figcaption\" className=\"mt-3 text-kh-small text-kh-muted\" placeholder=\"Caption\" />\n          </figure>\n        ))}\n      </div>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(GalleryStrip);\n"
    }
  ]
}
