{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "price-list",
  "type": "registry:block",
  "title": "Price list",
  "description": "A menu or a list of services with prices: named groups (with an optional note such as serving hours), each item a name, a dotted leader and a price on one line, a short description and up to three tags. Two columns of groups in wide containers. For a café, restaurant, bakery, salon, barber or class passes.",
  "categories": [
    "pricing"
  ],
  "dependencies": [
    "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/price-list/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/price-list/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, req, t } from '../_shared/schema';\n\nconst item = z.object({\n  name: req(80),\n  /** t(300) (a tap list's tasting notes, Brewski); */\n  description: t(300),\n  price: t(24),\n  /** Up to five tags (style, strength, allergens). */\n  tags: z.array(t(24)).max(5).default([]),\n  /** A small picture drawn before the name (a dish, a beer label, a stylist). */\n  image: media.optional(),\n  /** A number or code before the name (a tap number, a dish number on a menu): '07', 'B12'. */\n  number: t(12).optional(),\n  /** The item's own page (an order link, an untappd page): the name becomes a link. */\n  href: t(300).optional(),\n});\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  groups: z.array(z.object({ title: req(60), note: t(120), /** up to 24 items per group (Brewski's tap list has 19 beers) */ items: z.array(item).min(1).max(24) })).min(1).max(6),\n  note: t(200),\n  link: link.optional(),\n});\n\nexport const spec = defineSpec({\n  type: 'price-list',\n  aliases: ['pricing/list'],\n  name: 'Price list',\n  category: 'pricing',\n  role: 'body',\n  description: 'A menu or a list of services with prices: named groups (with an optional note such as serving hours), each item a name, a dotted leader and a price on one line, a short description and up to three tags. Two columns of groups in wide containers. For a café, restaurant, bakery, salon, barber or class passes.',\n  schema,\n  defaults: {\n    eyebrow: 'Section name',\n    title: 'Say what the list covers',\n    description: 'Say in a sentence or two how the items are made or served, and what to ask about.',\n    groups: [\n      {\n        title: 'First group',\n        note: 'Say when it is available',\n        items: [\n          { name: 'Name the first item', description: 'Say what it is made of, in a short line.', price: '00.00', tags: ['A tag'] },\n          { name: 'Name an item', description: 'Say what it is made of and how it is served, in one short line.', price: '00.00', tags: [] },\n          { name: 'Name an item', description: 'Say what it is made of, in a short line.', price: '00.00', tags: [] },\n          { name: 'Name an item', description: '', price: '00.00', tags: [] },\n        ],\n      },\n      {\n        title: 'Second group',\n        note: 'Say when it is available',\n        items: [\n          { name: 'Name an item', description: 'Say what it is made of.', price: '00.00', tags: ['A tag'] },\n          { name: 'Name an item', description: 'Say what it is made of, in a short line.', price: '00.00', tags: ['A tag'] },\n          { name: 'Name an item', description: 'Say what it is made of, in a short line.', price: '00.00', tags: [] },\n        ],\n      },\n      {\n        title: 'Third group',\n        note: '',\n        items: [\n          { name: 'Name an item', description: '', price: '00.00', tags: [] },\n          { name: 'Name an item', description: '', price: '00.00', tags: [] },\n          { name: 'Name an item', description: 'Say what it is made of.', price: '00.00', tags: [] },\n          { name: 'Name an item', description: '', price: '00.00', tags: [] },\n        ],\n      },\n    ],\n    note: 'Say what the prices include or exclude.',\n    link: { label: '', href: '' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/price-list/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/price-list/index.tsx",
      "content": "import { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Opt, Section, useEditing } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-kit';\nimport { safeHref } from '../../ui/button';\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// A menu reads down a column: the name, a dotted leader, the price on the same baseline; the description and tags under the name.\n// Groups sit two to a row from @3xl; 3, 5 or 6 groups go three to a row from @6xl (narrower thirds wrap the names). One group keeps\n// the full width.\nfunction PriceList({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  const n = props.groups.length;\n  const cols = n === 1 ? '' : n % 3 === 0 || n === 5 ? '@3xl:grid-cols-2 @6xl:grid-cols-3 @6xl:gap-x-12' : '@3xl:grid-cols-2';\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <div className={cn('mt-12 grid items-start gap-x-16 gap-y-12', cols)}>\n          {props.groups.map((group, g) => (\n            <div key={g} className=\"min-w-0\">\n              <div className=\"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 border-b border-kh-ink pb-3\">\n                <Text path={['groups', g, 'title']} value={group.title} as=\"h3\" className=\"text-kh-heading font-semibold\" />\n                <Opt path={['groups', g, 'note']} value={group.note} className=\"text-kh-small text-kh-muted\" placeholder=\"Note, e.g. served 12:00 to 15:00\" />\n              </div>\n              <ul className=\"divide-y divide-kh-line\">\n                {group.items.map((item, i) => (\n                  <li key={i} className={cn('py-4', item.image?.src && 'flex items-start gap-4')}>\n                    {item.image?.src && <Media path={['groups', g, 'items', i, 'image']} value={item.image} ratio=\"1 / 1\" className=\"size-16 shrink-0 rounded-kh\" />}\n                    <div className=\"min-w-0 flex-1\">\n                    <div className=\"flex items-baseline gap-3\">\n                      <Opt path={['groups', g, 'items', i, 'number']} value={item.number} as=\"span\" className=\"shrink-0 text-kh-small tabular-nums text-kh-muted\" placeholder=\"No.\" />\n                      {item.href ? (\n                        <a href={safeHref(item.href)} className=\"min-w-0 text-kh-body font-medium underline-offset-2 hover:underline\">\n                          <Text path={['groups', g, 'items', i, 'name']} value={item.name} as=\"span\" />\n                        </a>\n                      ) : (\n                        <Text path={['groups', g, 'items', i, 'name']} value={item.name} as=\"span\" className=\"min-w-0 text-kh-body font-medium\" />\n                      )}\n                      <span aria-hidden className=\"min-w-6 flex-1 translate-y-[-0.3em] border-b border-dotted border-kh-line\" />\n                      <Opt path={['groups', g, 'items', i, 'price']} value={item.price} as=\"span\" className=\"max-w-[50%] shrink-0 text-end text-kh-body font-medium tabular-nums [overflow-wrap:anywhere]\" placeholder=\"Price\" />\n                    </div>\n                    <Opt path={['groups', g, 'items', i, 'description']} value={item.description} className=\"mt-1 max-w-kh-lead text-kh-small text-kh-muted\" placeholder=\"Description\" />\n                    {(item.tags.some(Boolean) || editing) && (\n                      <ul className=\"mt-2 flex flex-wrap gap-1.5\" aria-label=\"Tags\">\n                        {item.tags.map((tag, k) => (tag || editing) && (\n                          <li key={k}>\n                            <Text path={['groups', g, 'items', i, 'tags', k]} value={tag} as=\"span\" className=\"inline-flex rounded-full border border-kh-line px-2 py-0.5 text-kh-caption text-kh-muted\" placeholder=\"Tag\" />\n                          </li>\n                        ))}\n                      </ul>\n                    )}\n                    </div>\n                  </li>\n                ))}\n              </ul>\n            </div>\n          ))}\n        </div>\n        {(props.note || props.link?.label || editing) && (\n          <div className=\"mt-10 flex flex-wrap items-center justify-between gap-4\">\n            <Opt path={['note']} value={props.note} className=\"text-kh-small text-kh-muted\" placeholder=\"Note under the list, e.g. prices include VAT\" />\n            {props.link && <ActionLink path={['link']} value={props.link} variant=\"secondary\" size=\"md\" />}\n          </div>\n        )}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(PriceList);\n"
    }
  ]
}
