{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-comparison",
  "type": "registry:block",
  "title": "Pricing, comparison table",
  "description": "A feature-by-plan table for two to four plans. Cells show a check (\"yes\"), a dash (\"no\") or short text.",
  "categories": [
    "pricing"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "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",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/pricing-comparison/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/pricing-comparison/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  /** Header alignment: centred (the default) or at the start, to share the left edge of a left-aligned page. */\n  align: z.enum(['start', 'center']).optional(),\n  /** The first column's header, read by screen readers only (\"Funktion\" on a Swedish page). Default 'Feature'; empty: no text. */\n  featureLabel: t(30).optional(),\n  plans: z.array(z.object({ name: t(30), featured: z.boolean() })).min(2).max(4),\n  /** One value per plan, in plan order. 'yes' shows a check, 'no' or empty a dash, anything else is shown as text. */\n  rows: z.array(z.object({ feature: t(80), values: z.array(t(30)).max(4) })).min(1).max(16),\n});\n\nexport const spec = defineSpec({\n  type: 'pricing-comparison',\n  aliases: ['pricing/comparison'],\n  name: 'Pricing, comparison table',\n  category: 'pricing',\n  role: 'body',\n  description: 'A feature-by-plan table for two to four plans. Cells show a check (\"yes\"), a dash (\"no\") or short text.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the table compares',\n    description: 'Say in one sentence what every plan has and what the higher plans add.',\n    plans: [\n      { name: 'First plan', featured: false },\n      { name: 'Second plan', featured: true },\n      { name: 'Third plan', featured: false },\n    ],\n    rows: [\n      { feature: 'Name a feature', values: ['0', 'A value', 'A value'] },\n      { feature: 'Name a feature', values: ['0', 'A value', 'A value'] },\n      { feature: 'Name a feature', values: ['00 days', 'A value', 'A value'] },\n      { feature: 'Name a feature, in a few words', values: ['yes', 'yes', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'yes', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'yes', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'yes', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'no', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'no', 'yes'] },\n      { feature: 'Name a feature', values: ['no', 'no', 'yes'] },\n      { feature: 'Name a feature', values: ['A short value', 'A short value', 'A short value'] },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/pricing-comparison/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/pricing-comparison/index.tsx",
      "content": "import { Check, Minus } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Container, Section, useEditing } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-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 Cell({ value, path }: { value: string; path: (string | number)[] }) {\n  const editing = useEditing();\n  const v = value.trim().toLowerCase();\n  // While editing the raw value stays visible and editable; otherwise yes/no/empty become an icon with a text alternative.\n  if (!editing && (v === 'yes' || v === 'no' || v === '')) {\n    return v === 'yes' ? (\n      <Check role=\"img\" aria-label=\"Included\" className=\"mx-auto size-5 text-kh-accent-ink\" strokeWidth={2.25} />\n    ) : (\n      <Minus role=\"img\" aria-label=\"Not included\" className=\"mx-auto size-5 text-kh-line-strong\" strokeWidth={2} />\n    );\n  }\n  return <Text path={path} value={value} as=\"span\" className=\"text-kh-small\" placeholder=\"Value\" />;\n}\n\nfunction PricingComparison({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  // Up to three plans fit a phone (390) with the tighter cells below. A fourth fits too when every value is a check, a dash or a few\n  // characters (a season calendar, a feature grid); text values in four columns keep a minimum width and scroll sideways.\n  const short = props.rows.every((r) => r.values.every((v) => v.trim().length <= 4));\n  const fits = props.plans.length <= 3 || (props.plans.length === 4 && short);\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} align={props.align === 'start' ? 'left' : 'center'} />\n        <div tabIndex={0} role=\"region\" aria-labelledby={id} className=\"mt-14 overflow-x-auto rounded-kh-xl border border-kh-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">\n          <table aria-labelledby={id} className={cn('w-full border-collapse text-left', !fits && 'min-w-[34rem]')}>\n            <thead>\n              <tr className=\"border-b border-kh-line\">\n                <th scope=\"col\" className=\"sticky left-0 z-10 w-[34%] bg-kh-canvas p-3 text-kh-small font-medium text-kh-muted @md:p-5\">\n                  {(props.featureLabel ?? 'Feature') && <span className=\"sr-only\">{props.featureLabel ?? 'Feature'}</span>}\n                </th>\n                {props.plans.map((plan, j) => (\n                  <th key={j} scope=\"col\" className={cn('px-2 py-3 text-center text-kh-small font-semibold @md:p-5 @md:text-kh-heading', plan.featured ? 'bg-kh-surface-2 @md:text-kh-accent-ink' : 'bg-kh-canvas')}>\n                    <Text path={['plans', j, 'name']} value={plan.name} as=\"span\" />\n                  </th>\n                ))}\n              </tr>\n            </thead>\n            <tbody>\n              {props.rows.map((row, i) => (\n                <tr key={i} className=\"border-b border-kh-line last:border-b-0\">\n                  <th scope=\"row\" className=\"sticky left-0 z-10 bg-kh-canvas p-3 text-kh-small font-medium @md:p-5\">\n                    <Text path={['rows', i, 'feature']} value={row.feature} as=\"span\" />\n                  </th>\n                  {props.plans.map((plan, j) => (\n                    <td key={j} className={cn('px-2 py-3 text-center align-middle text-kh-ink-2 @md:p-5', plan.featured && 'bg-kh-surface-2')}>\n                      <Cell value={row.values[j] ?? ''} path={['rows', i, 'values', j]} />\n                    </td>\n                  ))}\n                </tr>\n              ))}\n            </tbody>\n          </table>\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(PricingComparison);\n"
    }
  ]
}
