{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "contact-map",
  "type": "registry:block",
  "title": "Contact, address and map",
  "description": "A visit page in two halves: the address, an opening-hours list, phone and email on one side, a map image with a directions link on the other. For a shop, studio or restaurant that people come to.",
  "categories": [
    "contact"
  ],
  "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/text-link.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/contact-map/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/contact-map/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, req, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: req(120),\n  /** Paragraphs under the title (blank line between them). */\n  description: t(800).optional(),\n  address: t(160).optional(),\n  /** Opening hours: optional now (min 2 -> 0, max 7 -> 10; willow lists six travel-time rows, brewski ten). No hours, no heading. */\n  hoursTitle: t(40).optional(),\n  hours: z.array(z.object({ day: req(30), time: t(40) })).min(0).max(10),\n  phone: t(40),\n  email: t(80),\n  directions: link,\n  /** Up to two buttons under the contact lines (book, call, WhatsApp). */\n  buttons: z.array(link).max(2).optional(),\n  map: media,\n});\n\nexport const spec = defineSpec({\n  type: 'contact-map',\n  aliases: ['contact/map'],\n  name: 'Contact, address and map',\n  category: 'contact',\n  role: 'body',\n  description: 'A visit page in two halves: the address, an opening-hours list, phone and email on one side, a map image with a directions link on the other. For a shop, studio or restaurant that people come to.',\n  schema,\n  defaults: {\n    eyebrow: 'Name a topic',\n    title: 'Invite them to visit',\n    address: 'Give the street address\\nGive the town',\n    hoursTitle: 'Name the hours',\n    hours: [\n      { day: 'Name the days', time: '00:00 to 00:00' },\n      { day: 'Name the days', time: '00:00 to 00:00' },\n      { day: 'Name the day', time: 'Closed' },\n    ],\n    phone: '+00 00 000 00 00',\n    email: 'you@company.example',\n    directions: { label: 'Main action', href: '#directions' },\n    map: { src: '', alt: 'A map of the area with the place marked, and how to get there' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/contact-map/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/contact-map/index.tsx",
      "content": "import { useId } from 'react';\nimport { ArrowUpRight, Mail, MapPin, Phone } from 'lucide-react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { linkClass } from '../../ui/text-link';\nimport { ActionLink, Container, Eyebrow, Opt, Section, useEditing, usePictureSlots } from '../_shared/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\nfunction ContactMap({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const slots = usePictureSlots();\n  const row = 'flex items-start gap-3 text-kh-body';\n  const ico = 'mt-1 size-4 shrink-0 text-kh-muted';\n  // No map picture (a build from their words alone): the hours take the map's half and the directions link sits under the\n  // contact lines, so the block shows no empty box. While editing and in the directory the map slot stays.\n  const map = slots || !!props.map.src;\n  const hasHours = props.hours.length > 0 || editing;\n  const hours = hasHours && (\n    <>\n      <Opt path={['hoursTitle']} value={props.hoursTitle} as=\"h3\" className={cn('text-kh-small font-medium text-kh-muted', map && 'mt-10')} placeholder=\"Hours title\" />\n      <dl className=\"mt-3 divide-y divide-kh-line border-y border-kh-line\">\n        {props.hours.map((h, i) => (\n          <div key={i} className=\"flex justify-between gap-6 py-3 text-kh-small\">\n            <dt><Text path={['hours', i, 'day']} value={h.day} as=\"span\" /></dt>\n            <dd className=\"tabular-nums text-kh-muted\"><Opt path={['hours', i, 'time']} value={h.time} as=\"span\" placeholder=\"Hours\" /></dd>\n          </div>\n        ))}\n      </dl>\n    </>\n  );\n  const directions = (props.directions.label || editing) && (\n    <p className={map ? 'mt-4' : 'mt-6'}>\n      <a href={safeHref(props.directions.href)} className={cn(linkClass(), 'inline-flex min-h-11 items-center gap-1 text-kh-small font-medium no-underline')}>\n        <Text path={['directions', 'label']} value={props.directions.label} as=\"span\" placeholder=\"Label\" />\n        <ArrowUpRight aria-hidden className=\"size-4\" />\n      </a>\n    </p>\n  );\n  return (\n    <Section labelledBy={id}>\n      <Container className={cn('grid gap-10', (map || hasHours) && '@4xl:grid-cols-[1fr_1.2fr] @4xl:gap-16')}>\n        <div>\n          <Eyebrow path={['eyebrow']} value={props.eyebrow} />\n          <div id={id}>\n            <Text path={['title']} value={props.title} as=\"h2\" className=\"text-kh-title font-semibold\" />\n          </div>\n          <Opt path={['description']} value={props.description} as=\"p\" multiline className=\"mt-6 whitespace-pre-line text-kh-body text-kh-muted\" placeholder=\"Description\" />\n          {(props.address || props.phone || props.email || editing) && <ul className=\"mt-8 space-y-4\">\n            {(props.address || editing) && (\n              <li className={row}>\n                <MapPin aria-hidden className={ico} />\n                <Text path={['address']} value={props.address ?? ''} as=\"span\" multiline className=\"whitespace-pre-line\" placeholder=\"Address\" />\n              </li>\n            )}\n            {(props.phone || editing) && (\n              <li className={row}>\n                <Phone aria-hidden className={ico} />\n                <a href={props.phone ? `tel:${props.phone.replace(/[^+\\d]/g, '')}` : '#'} className={cn(linkClass(), 'inline-flex min-h-6 items-center')}>\n                  <Text path={['phone']} value={props.phone} as=\"span\" placeholder=\"Phone\" />\n                </a>\n              </li>\n            )}\n            {(props.email || editing) && (\n              <li className={row}>\n                <Mail aria-hidden className={ico} />\n                <a href={props.email ? `mailto:${props.email}` : '#'} className={cn(linkClass(), 'inline-flex min-h-6 items-center break-all')}>\n                  <Text path={['email']} value={props.email} as=\"span\" placeholder=\"Email\" />\n                </a>\n              </li>\n            )}\n          </ul>}\n          {(props.buttons?.length ?? 0) > 0 && (\n            <div className=\"mt-6 flex flex-wrap gap-3\">\n              {props.buttons!.map((b, i) => <ActionLink key={i} path={['buttons', i]} value={b} variant={i === 0 ? 'primary' : 'secondary'} size=\"md\" />)}\n            </div>\n          )}\n          {!map && directions}\n          {map && hours}\n        </div>\n        {(map || hasHours) && <div>\n          {map ? (\n            <>\n              <Media path={['map']} value={props.map} ratio=\"5/4\" className=\"rounded-kh-xl border border-kh-line\" />\n              {directions}\n            </>\n          ) : hours}\n        </div>}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(ContactMap);\n"
    }
  ]
}
