{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "features-image-cards",
  "type": "registry:block",
  "title": "Features, image cards",
  "description": "Section heading with up to two buttons at its right, and two to six equal cards, each a picture on top with a small badge, a title, a line and a text link; three in a row on a wide container, or one row that scrolls sideways.",
  "categories": [
    "features"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.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/features-image-cards/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/features-image-cards/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, t } from '../_shared/schema';\n\nconst item = z.object({\n  media,\n  badge: t(24).optional(),\n  title: t(60),\n  description: t(160),\n  /** An optional nested object needs a default in every item below, or the editor's round trip fails. */\n  link: link.partial().optional(),\n  /** An optional price line between the description and the link: the amount and its unit (such as '/ month'). In a scrolling strip the unit sits at the right of the amount; in the grid it follows the amount, larger. Empty draws nothing. */\n  price: z.object({ amount: t(16), unit: t(24) }).partial().optional(),\n});\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  /** Up to two buttons at the right of the heading block (under it on a narrow container); the first is the primary one. */\n  headerActions: z.array(link.partial()).max(2).optional(),\n  /** The cards as one row that runs off the right edge and scrolls sideways (CSS overflow, snapping, no script), instead of a grid. */\n  scroll: z.boolean().optional(),\n  /** The header buttons stay side by side on a narrow container instead of wrapping under each other (the scroll row always does, and stacks them at the right on a wide one). */\n  actionsInline: z.boolean().optional(),\n  /** The cards as a mosaic on a wide container: the first card is large (two columns wide, two rows high, its picture taking the height), and with four or five cards the last one runs across the bottom (two columns wide with five, all three with four). Off: equal cards. */\n  mosaic: z.boolean().optional(),\n  /** The heading's size: 'display' draws the large headline instead of the section heading. Unset keeps the section heading. */\n  titleSize: z.enum(['heading', 'title', 'display']).optional(),\n  /** The item names' size: 'title' draws them at the section heading size instead of the small heading. Unset keeps the small heading. */\n  itemTitleSize: z.enum(['title']).optional(),\n  /** With scroll: the row starts at the page column's left edge, under the heading, instead of at the page gutter. */\n  alignStrip: z.boolean().optional(),\n  /** With scroll: two round arrow links at the right of the heading block, one back to the first card and one on to the last; plain anchors, no script. */\n  arrows: z.boolean().optional(),\n  /** 'button' draws each card's link as a full-width button at the card's foot instead of a text link. Unset keeps the text link. */\n  linkStyle: z.enum(['button']).optional(),\n  /** The cards are a sideways-scrolling row on a narrow container and the grid on a wide one. Off: they stack on a narrow container. */\n  scrollNarrow: z.boolean().optional(),\n  items: z.array(item).min(2).max(6),\n});\n\nexport const spec = defineSpec({\n  type: 'features-image-cards',\n  aliases: ['features/image-cards'],\n  sourceRuns: ['rmwj00gl81be8e3', 'rmwj00glk10645c', 'rmwj0r19c38034b', 'rmwj106vd1fc22a', 'rmwj0r19e84c627', 'rmwj1cbyr2f2e2e', 'rmwj1c3hdcf88cc', 'rmwj106vz3e8109'],\n  name: 'Features, image cards',\n  category: 'features',\n  role: 'body',\n  description: 'Section heading with up to two buttons at its right, and two to six equal cards, each a picture on top with a small badge, a title, a line and a text link; three in a row on a wide container, or one row that scrolls sideways.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the reader finds in these cards',\n    description: 'Say in one sentence what the cards below have in common and who they are for.',\n    headerActions: [\n      { label: 'Name the main action', href: '#primary' },\n      { label: 'Name the other action', href: '#secondary' },\n    ],\n    items: [\n      { media: { src: '', alt: 'Show the first item at work' }, badge: 'Category', title: 'Name the first item', description: 'Say in one line what it gives the reader.', link: { label: 'Read more', href: '#first' } },\n      { media: { src: '', alt: 'Show the second item at work' }, badge: 'Category', title: 'Name the second item', description: 'Say in one line what it gives the reader.', link: { label: 'Read more', href: '#second' } },\n      { media: { src: '', alt: 'Show the third item at work' }, badge: 'Category', title: 'Name the third item', description: 'Say in one line what it gives the reader.', link: { label: 'Read more', href: '#third' } },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/features-image-cards/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/features-image-cards/index.tsx",
      "content": "import { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Section } from '../_shared/kit';\nimport { useHeadingId } from '../_shared/c-proof-kit';\nimport { Opt } from '../_shared/kit';\nimport { cn } from '../../lib/utils';\nimport { useId } from 'react';\nimport { ArrowRight, ChevronLeft, ChevronRight } from 'lucide-react';\nimport { safeHref } from '../../ui/button';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\n\n// Where a strip that is aligned to the page column starts: the column's left edge plus the gutter, never less than the gutter.\n/** The strip starts on the page's content edge and runs off the right (classes, not a style attribute: CSP style-src self; as gallery-strip). */\nconst START = 'ps-[max(var(--kh-gutter),calc((100%_-_var(--kh-page))/2_+_var(--kh-gutter)))] scroll-ps-[max(var(--kh-gutter),calc((100%_-_var(--kh-page))/2_+_var(--kh-gutter)))]';\ntype Props = z.infer<typeof spec.schema>;\n\nfunction FeaturesImageCards({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const uid = useId().replace(/[^a-zA-Z0-9_-]/g, '');\n  const actions = (props.headerActions ?? []).map((a, i) => ({ a, i })).filter(({ a }) => a.label);\n  const scroll = !!props.scroll;\n  const mosaic = !!props.mosaic && !scroll;\n  const n = props.items.length;\n  const card = (it: Props['items'][number], i: number) => (\n    <>\n      {mosaic && i === 0 ? (\n        <div className=\"relative min-h-[16rem] flex-1\">\n          <Media path={['items', i, 'media']} value={it.media} ratio=\"4 / 3\" className=\"absolute inset-0 h-full w-full !rounded-none\" />\n        </div>\n      ) : (\n        <Media path={['items', i, 'media']} value={it.media} ratio={mosaic && it.media && i === n - 1 && n >= 4 ? '16 / 9' : mosaic && i === n - 2 && n === 5 ? '16 / 10' : '4 / 3'} className=\"w-full !rounded-none\" />\n      )}\n      <div className={cn('flex flex-col items-start gap-3 p-6', !(mosaic && i === 0) && 'flex-1')}>\n        <Opt path={['items', i, 'badge']} value={it.badge} as=\"span\" className=\"rounded-full bg-kh-accent-soft px-3 py-1 font-kh-mono text-kh-caption text-kh-accent-ink\" placeholder=\"Badge\" />\n        <Text path={['items', i, 'title']} value={it.title} as=\"h3\" className={props.itemTitleSize === 'title' ? 'text-kh-title' : 'text-kh-heading'} />\n        <Text path={['items', i, 'description']} value={it.description} as=\"p\" className=\"text-kh-body text-kh-muted\" />\n        {it.price?.amount && (\n          <p className={cn('flex w-full items-baseline', scroll ? 'justify-between' : 'gap-2')}>\n            <Text path={['items', i, 'price', 'amount']} value={it.price.amount} as=\"span\" className={scroll ? 'text-kh-lead' : 'text-kh-title'} />\n            <Opt path={['items', i, 'price', 'unit']} value={it.price.unit} as=\"span\" className=\"text-kh-small text-kh-muted\" placeholder=\"Unit\" />\n          </p>\n        )}\n        {it.link && it.link.label && props.linkStyle === 'button' && (\n          <div className=\"mt-auto w-full pt-2 [&>*]:w-full [&>*]:justify-center\">\n            <ActionLink path={['items', i, 'link']} value={{ label: it.link.label ?? '', href: it.link.href ?? '' }} size=\"md\" />\n          </div>\n        )}\n        {it.link && it.link.label && props.linkStyle !== 'button' && (\n          <a href={safeHref(it.link.href)} className={scroll ? 'inline-flex items-center gap-2 text-kh-body font-medium text-kh-accent-ink hover:underline' : 'mt-auto inline-flex items-center gap-2 pt-2 text-kh-body font-medium text-kh-accent-ink hover:underline'}>\n            <Text path={['items', i, 'link', 'label']} value={it.link.label} as=\"span\" />\n            {!scroll && <ArrowRight aria-hidden className=\"size-4\" />}\n          </a>\n        )}\n      </div>\n    </>\n  );\n  const cardClass = 'flex flex-col overflow-hidden rounded-kh-lg border border-kh-line bg-kh-surface shadow-kh-1';\n  return (\n    <Section labelledBy={id} className={scroll ? 'overflow-hidden' : undefined}>\n      <Container>\n        <div className=\"flex flex-col gap-8 @3xl:flex-row @3xl:items-end @3xl:justify-between\">\n          <div className=\"flex max-w-kh-narrow flex-col gap-4\">\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              <Opt path={['title']} value={props.title} as=\"h2\" className={props.titleSize === 'display' ? 'text-kh-display' : props.titleSize === 'heading' ? 'text-kh-heading' : 'text-kh-title'} placeholder=\"Title\" />\n            </div>\n            <Opt path={['description']} value={props.description} className=\"text-kh-lead text-kh-muted\" placeholder=\"Description\" />\n          </div>\n          {scroll && props.arrows && (\n            <div className=\"flex shrink-0 gap-3\">\n              <a href={`#${uid}-0`} aria-label=\"Back to the first card\" className=\"inline-flex size-12 items-center justify-center rounded-kh-pill border border-kh-line text-kh-ink hover:border-kh-line-strong\"><ChevronLeft aria-hidden className=\"size-5\" /></a>\n              <a href={`#${uid}-${n - 1}`} aria-label=\"On to the last card\" className=\"inline-flex size-12 items-center justify-center rounded-kh-pill bg-kh-ink text-kh-canvas hover:bg-kh-ink/90\"><ChevronRight aria-hidden className=\"size-5\" /></a>\n            </div>\n          )}\n          {actions.length > 0 && (\n            <div className={scroll && !props.actionsInline ? 'flex shrink-0 items-center gap-3 @3xl:flex-col @3xl:items-start' : props.actionsInline ? 'flex shrink-0 items-center gap-3' : 'flex shrink-0 flex-wrap items-center gap-3'}>\n              {actions.map(({ a, i }) => <ActionLink key={i} path={['headerActions', i]} value={{ label: a.label ?? '', href: a.href ?? '' }} variant={i === 0 ? 'primary' : 'secondary'} size=\"md\" />)}\n            </div>\n          )}\n        </div>\n        {!scroll && (\n          <ul className={cn('mt-12 grid gap-6 @3xl:grid-cols-3', mosaic && '@3xl:gap-4', props.scrollNarrow && 'flex snap-x snap-mandatory overflow-x-auto pb-2 @3xl:grid')}>\n            {props.items.map((it, i) => <li key={i} className={cn(cardClass, props.scrollNarrow && 'w-[17rem] shrink-0 snap-start @3xl:w-auto', mosaic && i === 0 && '@3xl:col-span-2 @3xl:row-span-2', mosaic && i > 0 && i === props.items.length - 1 && props.items.length === 5 && '@3xl:col-span-2', mosaic && i > 0 && i === props.items.length - 1 && props.items.length === 4 && '@3xl:col-span-3')}>{card(it, i)}</li>)}\n          </ul>\n        )}\n      </Container>\n      {scroll && (\n        // Plain CSS overflow with snapping: no script. The row starts at the gutter and runs off the right edge.\n        <ul tabIndex={0} className={cn('mt-12 flex snap-x snap-mandatory gap-6 overflow-x-auto', props.alignStrip ? cn('pe-kh-gutter', START) : 'px-kh-gutter', 'pb-6')}>\n          {props.items.map((it, i) => <li key={i} id={props.arrows ? `${uid}-${i}` : undefined} className={`${cardClass} w-[18rem] shrink-0 snap-start @xl:w-[22rem] @4xl:w-[26rem]`}>{card(it, i)}</li>)}\n        </ul>\n      )}\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(FeaturesImageCards);\n"
    }
  ]
}
