{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-usage",
  "type": "registry:block",
  "title": "Pricing, pay as you use",
  "description": "Usage-based pricing: a rate card (what is metered, per unit, how much is free) beside a worked example bill with line items and a total, so nobody has to do the sum. Use when there is no plan to pick.",
  "categories": [
    "pricing"
  ],
  "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",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/pricing-usage/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/pricing-usage/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, req, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: req(120),\n  description: t(300),\n  ratesTitle: req(60),\n  rates: z.array(z.object({ name: req(40), unit: t(30), price: req(20), included: t(40) })).min(2).max(6),\n  exampleTitle: req(60),\n  exampleLines: z.array(z.object({ label: req(60), amount: req(20) })).min(2).max(5),\n  totalLabel: req(30),\n  total: req(20),\n  note: t(160),\n  cta: link,\n});\n\nexport const spec = defineSpec({\n  type: 'pricing-usage',\n  aliases: ['pricing/usage'],\n  name: 'Pricing, pay as you use',\n  category: 'pricing',\n  role: 'body',\n  description: 'Usage-based pricing: a rate card (what is metered, per unit, how much is free) beside a worked example bill with line items and a total, so nobody has to do the sum. Use when there is no plan to pick.',\n  schema,\n  defaults: {\n    eyebrow: 'Section name',\n    title: 'Say what the price is based on',\n    description: 'Say in one sentence what the price covers and what is free.',\n    ratesTitle: 'Name the rates',\n    rates: [\n      { name: 'Name a billed thing', unit: 'per unit', price: '$0.00', included: 'First 00 free' },\n      { name: 'Name a billed thing', unit: 'per unit', price: '$0.00', included: 'First 00 free' },\n      { name: 'Name a billed thing', unit: 'per unit', price: '$0.00', included: 'First 00 free' },\n      { name: 'Name a billed thing', unit: 'per unit', price: '$0.00', included: 'Say what is free' },\n    ],\n    exampleTitle: 'Name the worked example',\n    exampleLines: [\n      { label: 'Say what was used, and how much', amount: '$00.00' },\n      { label: 'Say what was used, and how much', amount: '$00.00' },\n      { label: 'Say what was used, and how much', amount: '$0.00' },\n    ],\n    totalLabel: 'Name the total line',\n    total: '$00.00',\n    note: 'Say what the prices exclude and when the customer is told before being charged.',\n    cta: { label: 'Main action', href: '#start' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/pricing-usage/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/pricing-usage/index.tsx",
      "content": "import { Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { ActionLink, Container, Opt, Section, nowrapIfShort } from '../_shared/kit';\nimport { Heading, 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>;\n\nfunction PricingUsage({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <div className=\"mt-12 grid gap-6 @4xl:grid-cols-[1.4fr_1fr]\">\n          <div className=\"overflow-hidden rounded-kh-xl border border-kh-line bg-kh-surface\">\n            <Text path={['ratesTitle']} value={props.ratesTitle} as=\"h3\" className=\"border-b border-kh-line px-6 py-4 text-kh-small font-medium text-kh-muted\" />\n            <ul className=\"divide-y divide-kh-line\">\n              {props.rates.map((r, i) => (\n                <li key={i} className=\"grid gap-1 px-6 py-5 @xl:grid-cols-[1fr_auto] @xl:items-baseline @xl:gap-6\">\n                  <div>\n                    <Text path={['rates', i, 'name']} value={r.name} as=\"p\" className=\"text-kh-body font-medium\" />\n                    <Opt path={['rates', i, 'included']} value={r.included} className=\"text-kh-small text-kh-accent-ink\" placeholder=\"Included\" />\n                  </div>\n                  <p className=\"flex items-baseline gap-2 @xl:justify-end\">\n                    <Text path={['rates', i, 'price']} value={r.price} as=\"span\" className={cn(nowrapIfShort(r.price), 'text-kh-heading font-semibold tabular-nums')} />\n                    <Opt path={['rates', i, 'unit']} value={r.unit} as=\"span\" className=\"text-kh-small text-kh-muted\" placeholder=\"Unit\" />\n                  </p>\n                </li>\n              ))}\n            </ul>\n          </div>\n          <div className=\"flex flex-col rounded-kh-xl border border-kh-ink bg-kh-surface p-6 shadow-kh-2 @2xl:p-8\">\n            <Text path={['exampleTitle']} value={props.exampleTitle} as=\"h3\" className=\"text-kh-small font-medium text-kh-muted\" />\n            <ul className=\"mt-4 divide-y divide-kh-line\">\n              {props.exampleLines.map((l, i) => (\n                <li key={i} className=\"flex items-baseline justify-between gap-4 py-3 text-kh-small\">\n                  <Text path={['exampleLines', i, 'label']} value={l.label} as=\"span\" />\n                  <Text path={['exampleLines', i, 'amount']} value={l.amount} as=\"span\" className=\"font-medium tabular-nums\" />\n                </li>\n              ))}\n            </ul>\n            <p className=\"mt-2 flex items-baseline justify-between gap-4 border-t border-kh-ink pt-4\">\n              <Text path={['totalLabel']} value={props.totalLabel} as=\"span\" className=\"text-kh-body font-semibold\" />\n              <Text path={['total']} value={props.total} as=\"span\" className=\"text-kh-title font-semibold tabular-nums\" />\n            </p>\n            <Opt path={['note']} value={props.note} className=\"mt-4 text-kh-caption text-kh-muted\" placeholder=\"Note\" />\n            <div className=\"mt-auto pt-6\">\n              <ActionLink path={['cta']} value={props.cta} size=\"md\" className=\"w-full\" />\n            </div>\n          </div>\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(PricingUsage);\n"
    }
  ]
}
