{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-cover",
  "type": "registry:block",
  "title": "Hero, cover",
  "description": "Their own photo full-bleed under a dark scrim, with their name or wordmark logo, one line, an optional real rating and one or two buttons on it (the second in the brand's second colour), centred or at the foot. Text stays light in either colour mode. For a bakery, salon, restaurant or shop whose own site opens on a dark photo.",
  "categories": [
    "hero"
  ],
  "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/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/hero-cover/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/hero-cover/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, req, t } from '../_shared/schema';\n\nconst schema = z.object({\n  /** The business's name: the page's h1. With a logo it is the logo's accessible name and the logo shows instead. */\n  title: req(60),\n  /** The name's second half, drawn bold after a thin bar with the title light before it ('Bakery' | 'North Street'). Empty: one solid title. */\n  titleStrong: t(40).default(''),\n  /** Their wordmark or logo as an image, light on transparent (it sits on a dark photo). Empty: the name shows as type. */\n  logo: media,\n  /** One line under the name, in their words ('Sourdough, buns and coffee since 2011'). */\n  tagline: t(400), // KB-178: raised from 160; the longest real greeting is 358 chars\n  \n  /** Their real rating as they state it ('4.8 · 612 Google reviews'). Empty: no line. Never invented. */\n  rating: t(80),\n  action: link.partial().optional(),\n  /** A second button beside it (their two calls on the photo: 'Our Locations' and 'Book Now'). Filled in the style's second brand colour\n   *  (colors.accent2) when it has one, else an outline. Empty label: not drawn. */\n  secondaryAction: link.extend({ label: t(40).default(''), href: t(300).default('') }).optional(),\n  /** Their own photo, full-bleed under a dark scrim. Empty on a real page: a plain dark band, no picture box. */\n  media,\n  /** A small uppercase label above the name; leave empty for none. */\n  eyebrow: t(40).optional(),\n  /** A longer paragraph under the tagline; leave empty for none. */\n  body: t(300).optional(),\n  /** The name's size: title is an ordinary page heading, unset the large display size. */\n  titleSize: z.enum(['title']).optional(),\n  align: z.enum(['center', 'start']).default('center'),\n  /** On a phone, centred text can sit at the start instead, still centred on a wide screen. Empty: as align. */\n  alignPhone: z.enum(['center', 'start']).optional(),\n  /** The cover fills the first screen (a hotel, venue or restaurant that opens on its photo). Empty: 32rem, 42rem on a wide screen. */\n  fullHeight: z.boolean().optional(),\n  /** The buttons sit in a plain band under the picture instead of on it. Empty: on the picture. */\n  actionsBelow: z.boolean().optional(),\n  /** Up to three figures under the text at the foot of the picture, split by a thin rule ('120+' 'rooms'). Empty or none: no row. Use for a cover that also states its numbers; a card per person or item is a different block. */\n  cells: z.array(z.object({ figure: t(20), label: t(80) })).max(3).optional(),\n  /** The text sits in a centred white card over the picture, which is veiled in the page colour instead of darkened. Use for a cover with a light, calm picture. Empty: the text sits on the picture. */\n  panel: z.boolean().optional(),\n  /** Up to three contact lines in a row under the buttons, after a thin rule (mail, phone, address); href makes a line a link. Empty or none: no row. */\n  details: z.array(z.object({ label: t(80), href: t(300).optional() })).max(3).optional(),\n});\n\nexport const spec = defineSpec({\n  type: 'hero-cover',\n  aliases: ['hero/cover'],\n  sourceRuns: ['rmwj0uxke26fa5c', 'rmwj0o83z75cdbc', 'rmwjf5z1v25d532', 'rmwjf5ydn5d72ec', 'rmwjf5bjfda17fc', 'rmwj1d6l50c80b2', 'rmwj0w0ig1cdf74', 'rmwj0yvl5385535'],\n  name: 'Hero, cover',\n  category: 'hero',\n  role: 'body',\n  description: 'Their own photo full-bleed under a dark scrim, with their name or wordmark logo, one line, an optional real rating and one or two buttons on it (the second in the brand\\'s second colour), centred or at the foot. Text stays light in either colour mode. For a bakery, salon, restaurant or shop whose own site opens on a dark photo.',\n  schema,\n  defaults: {\n    title: 'Business name',\n    titleStrong: '',\n    logo: { src: '', alt: '' },\n    tagline: 'Say what you offer, where and since when, in one line.',\n    rating: '0.0 · 000 reviews',\n    action: { label: 'Main action', href: '#menu' },\n    media: { src: '', alt: 'Show the place or product, wide and close up' },\n    align: 'center',\n  },\n});\n"
    },
    {
      "path": "src/blocks/hero-cover/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/hero-cover/index.tsx",
      "content": "import { Fragment, useContext, useId } from 'react';\nimport { Star } from 'lucide-react';\nimport { HeadingLevelContext, Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Opt, Section, useEditing, usePictureSlots, Gate } from '../_shared/kit';\nimport { cn } from '../../lib/utils';\nimport { safeHref } from '../../ui/button';\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\nfunction HeroCover({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const slots = usePictureSlots();\n  const photo = slots || !!props.media.src;\n  const logo = !!props.logo.src;\n  const below = !!props.actionsBelow;\n  const center = props.align !== 'start';\n  // On a phone the text can sit at the start while a wide screen centres it; unset follows align.\n  const phoneStart = center && props.alignPhone === 'start';\n  const level = useContext(HeadingLevelContext)?.level ?? '1';\n  const H = `h${level}` as 'h1' | 'h2';\n  const panel = !!props.panel;\n  const Wrap: React.ElementType = panel ? 'div' : Fragment;\n  const actions = (\n    <Gate label={props.action?.label || props.secondaryAction?.label}>\n    <div className={cn(below ? 'flex flex-wrap items-center gap-3' : 'mt-8 flex flex-wrap items-center gap-3', center && (phoneStart ? '@4xl:justify-center' : 'justify-center'))}>\n      <ActionLink path={['action']} value={props.action} className={panel ? 'rounded-kh-pill' : undefined} />\n      {/* the second call, in the brand's second colour when the style has one (theme-base.css .kh-accent2) */}\n      {props.secondaryAction && <ActionLink path={['secondaryAction']} value={props.secondaryAction} variant=\"secondary\" className={panel ? 'rounded-kh-pill' : 'kh-accent2'} />}\n    </div>\n    </Gate>\n  );\n  const titleType = cn('max-w-4xl', props.titleSize === 'title' ? 'text-kh-title' : 'text-kh-display', panel ? 'font-normal' : 'font-semibold', 'tracking-[calc(-0.025em*var(--kh-track,1))]');\n  return (\n    <Section labelledBy={id} flushEnd className=\"pt-0\">\n      <div {...(panel ? {} : { 'data-kh-tone': 'cover' })} className={cn('relative isolate flex flex-col bg-kh-canvas text-kh-ink', props.fullHeight ? 'min-h-svh' : 'min-h-[32rem] @4xl:min-h-[42rem]', center ? 'justify-center' : 'justify-end')}>\n        {photo && (\n          <>\n            <Media path={['media']} value={props.media} priority ratio=\"16/9\" className=\"absolute inset-0 -z-10 h-full rounded-none\" />\n            <div aria-hidden className={panel ? 'absolute inset-0 -z-10 bg-kh-canvas/70' : 'kh-cover-scrim absolute inset-0 -z-10'} />\n          </>\n        )}\n        <Container className={cn('py-kh-section', panel && 'flex justify-center', !panel && center && (phoneStart ? 'flex flex-col items-start text-start @4xl:items-center @4xl:text-center' : 'flex flex-col items-center text-center'))}>\n          <Wrap {...(panel ? { className: 'flex w-full max-w-kh-narrow flex-col items-center rounded-kh-xl border border-kh-line bg-kh-surface/95 p-8 text-center shadow-kh-2 @2xl:p-12' } : {})}>\n          <Opt path={['eyebrow']} value={props.eyebrow} className=\"mb-4 font-kh-mono text-kh-caption uppercase tracking-widest text-kh-muted\" placeholder=\"Eyebrow\" />\n          <div id={id}>\n            {/* With a logo the name stays the h1 for readers and the logo is what shows. */}\n            {props.titleStrong ? (\n              // A two-part name, light then bold after a thin bar ('Bakery | North Street'); one heading for readers.\n              <H className={logo ? 'sr-only' : cn('flex max-w-4xl flex-wrap items-center gap-x-[0.3em] text-kh-display tracking-[calc(-0.025em*var(--kh-track,1))]', center && (phoneStart ? '@4xl:justify-center' : 'justify-center'))}>\n                <Text path={['title']} value={props.title} className=\"font-light\" />\n                {' '}<span aria-hidden className=\"inline-block h-[0.9em] w-0.5 bg-current\" />{' '}\n                <Text path={['titleStrong']} value={props.titleStrong} className=\"font-bold\" />\n              </H>\n            ) : (\n              <Text path={['title']} value={props.title} as=\"h1\" className={logo ? 'sr-only' : titleType} />\n            )}\n            {logo && <Media path={['logo']} value={{ ...props.logo, alt: '' }} ratio=\"auto\" className={cn('h-14 w-auto max-w-[min(100%,28rem)] bg-transparent @3xl:h-20 [&>img]:h-full [&>img]:w-auto', center && (phoneStart ? '@4xl:mx-auto' : 'mx-auto'))} />}\n          </div>\n          <Opt path={['tagline']} value={props.tagline} className={cn('mt-5 max-w-kh-lead text-kh-lead', panel ? 'text-kh-ink-2' : 'text-kh-muted')} placeholder=\"One line about them\" />\n          <Opt path={['body']} value={props.body} multiline className=\"mt-4 max-w-kh-lead text-kh-body text-kh-muted\" placeholder=\"A longer paragraph\" />\n          {(props.rating || editing) && (\n            <p className=\"mt-5 flex items-center gap-2 text-kh-small font-medium\">\n              <Star aria-hidden strokeWidth={1.75} className=\"size-4 fill-current\" />\n              <Text path={['rating']} value={props.rating} as=\"span\" className=\"tabular-nums\" placeholder=\"Their real rating\" />\n            </p>\n          )}\n          {!below && actions}\n          {props.cells && props.cells.length > 0 && (\n            <ul className=\"mt-12 grid w-full grid-cols-1 gap-8 border-t border-current/30 pt-8 text-start @2xl:grid-cols-3\">\n              {props.cells.map((c, i) => (\n                <li key={i}>\n                  <Text path={['cells', i, 'figure']} value={c.figure} as=\"p\" className=\"text-kh-title font-semibold\" />\n                  <Opt path={['cells', i, 'label']} value={c.label} className=\"mt-2 text-kh-small text-kh-muted\" placeholder=\"What it counts\" />\n                </li>\n              ))}\n            </ul>\n          )}\n          {props.details && props.details.length > 0 && (\n            <ul className=\"mt-8 flex w-full flex-col items-center gap-2 border-t border-kh-line pt-6 text-kh-small @2xl:flex-row @2xl:justify-center @2xl:gap-6\">\n              {props.details.map((d, i) => (\n                <li key={i}>\n                  {d.href ? <a href={safeHref(d.href)} className=\"transition hover:text-kh-accent-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-kh-accent\"><Text path={['details', i, 'label']} value={d.label} as=\"span\" /></a> : <Text path={['details', i, 'label']} value={d.label} as=\"span\" />}\n                </li>\n              ))}\n            </ul>\n          )}\n          </Wrap>\n        </Container>\n      </div>\n      {below && (\n        <Container className=\"py-8\">\n          {actions}\n        </Container>\n      )}\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(HeroCover);\n"
    }
  ]
}
