{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-panel-tiles",
  "type": "registry:block",
  "title": "Hero, panel tiles",
  "description": "A calm opener: a tall white panel with a label, a big title, a lead and two actions at its foot, beside a mosaic of tiles (a picture, a number, an icon or captioned pictures). On a phone the panel comes first and the tiles stack under it, two to a row.",
  "categories": [
    "hero"
  ],
  "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"
  ],
  "files": [
    {
      "path": "src/blocks/hero-panel-tiles/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/hero-panel-tiles/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, icon, link, media, t } from '../_shared/schema';\n\n/**\n * One tile of the mosaic beside the panel. `picture` is a bare picture that spans the mosaic's width, `captioned` a picture on a soft\n * card with a line under it, `stat` a number over its label, `icon` a small symbol over its label. The fields a kind does not use are left out.\n */\nconst tile = z.object({\n  kind: z.enum(['picture', 'captioned', 'stat', 'icon']),\n  media: media.optional(),\n  /** A stat's number; on a captioned tile, its name line above the caption. */\n  value: t(40).optional(),\n  icon: icon.optional(),\n  label: t(80).optional(),\n  /** Captioned only: `full` runs the tile across the mosaic's width, in any position, with a wider picture; unset or `half` sits two to a row. */\n  span: z.enum(['full', 'half']).optional(),\n});\n\nconst schema = z.object({\n  eyebrow: t(40),\n  title: t(80),\n  description: t(240),\n  /** `title` sets the panel heading one step smaller than the default `display`; unset draws `display`. */\n  titleSize: z.enum(['display', 'title']).optional(),\n  primary: link.partial().optional(),\n  secondary: link.partial().optional(),\n  /** A list is an array field, never a slot. The first tile of kind picture spans the mosaic; the rest sit two to a row. */\n  tiles: z.array(tile).min(1).max(6),\n});\n\nexport const spec = defineSpec({\n  type: 'hero-panel-tiles',\n  aliases: ['hero/panel-tiles'],\n  sourceRuns: ['rmwj0on6j828c11', 'rmwj1vgxl207e4f', 'rmwj0xrtd008428'],\n  name: 'Hero, panel tiles',\n  category: 'hero',\n  role: 'body',\n  description: 'A calm opener: a tall white panel with a label, a big title, a lead and two actions at its foot, beside a mosaic of tiles (a picture, a number, an icon or captioned pictures). On a phone the panel comes first and the tiles stack under it, two to a row.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the topic in a few words',\n    title: 'Say what the page offers in one big line',\n    description: 'Say in one or two sentences what this is and who it is for.',\n    primary: { label: 'Name the main step', href: '#start' },\n    secondary: { label: 'Name the gentler step', href: '#more' },\n    tiles: [\n      { kind: 'picture', media: { src: '', alt: 'Show the main subject' } },\n      { kind: 'stat', value: '000+', label: 'Say what the figure measures' },\n      { kind: 'icon', icon: 'clock', label: 'Say what the symbol means' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/hero-panel-tiles/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/hero-panel-tiles/index.tsx",
      "content": "import { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Icon, Section, Gate } from '../_shared/kit';\nimport { useHeadingId } from '../_shared/c-proof-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>;\ntype TileProps = z.infer<typeof spec.schema>['tiles'][number];\n\nfunction Tile({ tile, i, first }: { tile: TileProps; i: number; first: boolean }) {\n  const at = ['tiles', i] as const;\n  if (tile.kind === 'picture') {\n    return (\n      <Media path={[...at, 'media']} value={tile.media ?? { src: '', alt: '' }} ratio=\"16 / 9\"\n        className={`rounded-kh-xl shadow-kh-1 @4xl:h-full ${first ? 'col-span-2' : ''}`} />\n    );\n  }\n  if (tile.kind === 'captioned') {\n    const full = tile.span === 'full';\n    return (\n      <figure className={`col-span-2 flex min-w-0 flex-col gap-3 rounded-kh-xl bg-kh-surface-2 p-3 shadow-kh-1 ${full ? '' : '@md:col-span-1'}`}>\n        <Media path={[...at, 'media']} value={tile.media ?? { src: '', alt: '' }} ratio={full ? '21 / 9' : '4 / 3'} className=\"rounded-kh-lg\" />\n        <figcaption className={`px-2 pb-2 text-kh-small text-kh-muted ${tile.value ? 'flex flex-col gap-1' : ''}`.trimEnd()}>\n          {tile.value ? <Text path={[...at, 'value']} value={tile.value} as=\"span\" className=\"font-kh-display text-kh-heading text-kh-ink\" /> : null}\n          <Text path={[...at, 'label']} value={tile.label ?? ''} />\n        </figcaption>\n      </figure>\n    );\n  }\n  const stat = tile.kind === 'stat';\n  return (\n    <div className={`flex min-w-0 flex-col justify-between gap-6 rounded-kh-xl p-6 ${stat ? 'bg-kh-accent-soft' : 'bg-kh-surface-2'}`}>\n      {stat ? (\n        <Text path={[...at, 'value']} value={tile.value ?? ''} as=\"p\" className=\"font-kh-display text-kh-title text-kh-accent-ink\" />\n      ) : (\n        <Icon name={tile.icon ?? 'clock'} className=\"size-8 text-kh-ink\" />\n      )}\n      <Text path={[...at, 'label']} value={tile.label ?? ''} as=\"p\" multiline className=\"text-kh-small text-kh-ink-2\" />\n    </div>\n  );\n}\n\nfunction HeroPanelTiles({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  // A bare picture on top makes the mosaic narrow (a picture over a stat and an icon); four captioned pictures take two thirds.\n  const bare = props.tiles.some((x) => x.kind === 'picture');\n  const firstPicture = props.tiles.findIndex((x) => x.kind === 'picture');\n  return (\n    <Section labelledBy={id}>\n      <div className=\"px-kh-gutter\">\n      <div className={`mx-auto grid w-full max-w-kh-page grid-cols-1 gap-4 @4xl:min-h-[40rem] ${bare ? '@4xl:grid-cols-[1.4fr_1fr]' : '@4xl:grid-cols-[1.4fr_2fr]'}`}>\n        <div className=\"flex min-w-0 flex-col justify-between gap-12 rounded-kh-xl bg-kh-surface p-8 shadow-kh-1 @4xl:p-12\">\n          <div className=\"flex flex-col gap-6\">\n            <Text path={['eyebrow']} value={props.eyebrow} as=\"p\" className=\"font-kh-mono text-kh-caption uppercase tracking-widest text-kh-accent-ink\" />\n            <div id={id}>\n              <Text path={['title']} value={props.title} as=\"h2\" className={`font-kh-display ${props.titleSize === 'title' ? 'text-kh-title' : 'text-kh-display'} text-balance`} />\n            </div>\n            <Text path={['description']} value={props.description} as=\"p\" multiline className=\"max-w-kh-narrow text-kh-lead text-kh-ink-2\" />\n          </div>\n          <Gate label={props.primary?.label || props.secondary?.label}>\n          <div className=\"flex flex-wrap gap-3\">\n            <ActionLink path={['primary']} value={props.primary} size=\"md\" className=\"rounded-kh-pill bg-kh-accent-fill text-kh-accent-fg shadow-kh-2\" />\n            {props.secondary && <ActionLink path={['secondary']} value={props.secondary} variant=\"secondary\" size=\"md\" className=\"rounded-kh-pill border border-kh-line-strong\" />}\n          </div>\n          </Gate>\n        </div>\n        <div className=\"grid min-w-0 grid-cols-2 content-stretch gap-4 @4xl:grid-rows-[1fr_1fr]\">\n          {props.tiles.map((tile, i) => (\n            <Tile key={i} tile={tile} i={i} first={i === firstPicture} />\n          ))}\n        </div>\n      </div>\n      </div>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(HeroPanelTiles);\n"
    }
  ]
}
