{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-block",
  "type": "registry:item",
  "title": "Pricing Block",
  "description": "Pricing plans side by side, with a monthly or yearly switch, a featured plan, and what each includes. Choosing a plan fires `choose` with the plan and period.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "block"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json",
    "https://zubra-js.github.io/zubra-ui/r/segmented-control.json"
  ],
  "files": [
    {
      "path": "components/pricing-block.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/pricing-block.js",
      "content": "// Generated by zubra from pricing-block.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { emit, id } from '@zubra/runtime';\nimport \"./segmented-control.js\";\n\nexport const tag = \"pricing-block\";\n\nexport default $define(tag, {\n  props: {\n    \"plans\": { attribute: \"plans\", default: [], required: false },\n    \"period\": { attribute: \"period\", default: \"monthly\", required: false, model: true },\n    \"currency\": { attribute: \"currency\", default: \"USD\", required: false },\n    \"locale\": { attribute: \"locale\", default: \"\", required: false },\n    \"heading\": { attribute: \"heading\", default: \"Pricing\", required: false },\n    \"intro\": { attribute: \"intro\", default: \"\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [\"periodchange\", \"choose\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (pricing-block) to ([data-zb-slotted=\\\"pricing-block\\\"]) {\\n  :scope { display: block; }\\n  header { display: grid; justify-items: center; gap: 0.75rem; margin-bottom: 1.75rem; text-align: center; }\\n  h2 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem); line-height: 1.2; letter-spacing: -0.02em; }\\n  .pricing-intro { max-width: 34rem; margin: 0; color: var(--muted-foreground, #71717a); }\\n  .pricing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem; align-items: stretch; }\\n  article { display: flex; flex-direction: column; gap: 1rem; min-width: 0; padding: 1.5rem; border: 1px solid var(--border, #e4e4e7); border-radius: calc(var(--radius, 0.625rem) + 4px); background: var(--card, #fff); color: var(--card-foreground, #09090b); }\\n  article.pricing-featured { border-color: var(--primary, #18181b); box-shadow: 0 0 0 1px var(--primary, #18181b); }\\n  .pricing-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }\\n  h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }\\n  .pricing-badge { flex-shrink: 0; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--primary, #18181b); color: var(--primary-foreground, #fafafa); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }\\n  .pricing-description { margin: -0.5rem 0 0; color: var(--muted-foreground, #71717a); font-size: 0.9rem; overflow-wrap: anywhere; }\\n  .pricing-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; margin: 0; }\\n  .pricing-amount { font-size: 2.1rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }\\n  .pricing-per, .pricing-note { color: var(--muted-foreground, #71717a); font-size: 0.875rem; }\\n  .pricing-note { margin: -0.7rem 0 0; }\\n  ul { display: grid; align-content: start; gap: 0.5rem; flex: 1; margin: 0; padding: 0; list-style: none; font-size: 0.925rem; }\\n  li { display: grid; grid-template-columns: 1.1rem 1fr; gap: 0.4rem; overflow-wrap: anywhere; }\\n  li::before { content: \\\"✓\\\" / \\\"\\\"; color: var(--primary, #18181b); font-weight: 700; }\\n  .pricing-choose { display: block; box-sizing: border-box; padding: 0.6rem 1rem; border: 1px solid var(--border, #e4e4e7); border-radius: calc(var(--radius, 0.625rem) - 2px); background: var(--background, #fff); color: var(--foreground, #09090b); font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }\\n  .pricing-choose:hover { background: var(--accent, #f4f4f5); }\\n  .pricing-featured .pricing-choose { border-color: var(--primary, #18181b); background: var(--primary, #18181b); color: var(--primary-foreground, #fafafa); }\\n  .pricing-featured .pricing-choose:hover { opacity: 0.92; }\\n  .pricing-choose:focus-visible { outline: 2px solid var(--ring, #18181b); outline-offset: 2px; }\\n}\\n}\\n\",\n  template: \"\\n  <header>\\n    <h2></h2>\\n    <!--[--><!--]-->\\n    <!--[--><!--]-->\\n  </header>\\n  <div class=\\\"pricing-plans\\\">\\n    <!--[--><!--]-->\\n  </div>\\n\",\n  setup($p, $emit) {\n    const emit = $emit;\n                                             \n                                           \n                                 \n\n  const PERIODS = [{ value: \"monthly\", label: \"Monthly\" }, { value: \"yearly\", label: \"Yearly\" }]\n  const prefix = id()\n  const money = (amount) => new Intl.NumberFormat($p.locale || undefined, { style: \"currency\", currency: $p.currency, maximumFractionDigits: amount % 1 ? 2 : 0 }).format(amount)\n  // Yearly plans show their price a month, so they compare at a glance; the year's total is below.\n  const perMonth = (plan) => ($p.period === \"yearly\" && plan.yearly != null ? plan.yearly / 12 : plan.monthly)\n  const saving = (plan) => plan.monthly > 0 && plan.yearly != null ? Math.round((1 - plan.yearly / (plan.monthly * 12)) * 100) : 0\n    return [\n      { path: [0, 0], text: () => $t($p.heading) },\n      { path: [0, 1], when: () => $p.intro, blocks: [{ template: \"<p class=\\\"pricing-intro\\\"></p>\", parts: () => [{ path: [0], text: () => $t($p.intro) }] }, null] },\n      { path: [0, 2], when: () => $p.plans.length, blocks: [{ template: \"<segmented-control></segmented-control>\", parts: () => [{ path: [0], property: \"label\", value: () => \"Billing period\" }, { path: [0], property: \"options\", value: () => $r(PERIODS) }, { path: [0], property: \"value\", value: () => $p.period }, { path: [0], on: \"valuechange\", handler: () => ((event) => ($p.period = event.detail)) }] }, null] },\n      { path: [1, 0], each: () => $p.plans, key: (plan, $index) => $r(plan).id, block: { template: \"\\n      <article>\\n        <div class=\\\"pricing-top\\\">\\n          <h3></h3>\\n          <!--[--><!--]-->\\n        </div>\\n        <!--[--><!--]-->\\n        <p class=\\\"pricing-price\\\"><span class=\\\"pricing-amount\\\"></span><span class=\\\"pricing-per\\\">a month</span></p>\\n        <!--[--><!--]-->\\n        <ul>\\n          <!--[--><!--]-->\\n        </ul>\\n        <!--[--><!--]-->\\n      </article>\\n    \", parts: (plan, $index) => [{ path: [0], toggle: \"pricing-featured\", value: () => ($r(plan).featured ?? false) }, { path: [0], attribute: \"aria-labelledby\", value: () => (`${prefix}-${$r(plan).id}`) }, { path: [0, 0, 0], attribute: \"id\", value: () => (`${prefix}-${$r(plan).id}`) }, { path: [0, 0, 0], text: () => $t($r(plan).name) }, { path: [0, 0, 1], when: () => $r(plan).featured, blocks: [{ template: \"<span class=\\\"pricing-badge\\\">Most popular</span>\", parts: () => [] }, null] }, { path: [0, 1], when: () => $r(plan).description, blocks: [{ template: \"<p class=\\\"pricing-description\\\"></p>\", parts: () => [{ path: [0], text: () => $t($r(plan).description) }] }, null] }, { path: [0, 2, 0], text: () => $t((money(perMonth($r(plan))))) }, { path: [0, 3], when: () => (($p.period === \"yearly\") && ($r(plan).yearly > 0)), blocks: [{ template: \"<p class=\\\"pricing-note\\\"></p>\", parts: () => [{ path: [0], text: () => $t((money($r(plan).yearly))) + \" billed yearly\" + $t((saving($r(plan)) > 0 ? `, save ${saving($r(plan))}%` : \"\")) }] }, null] }, { path: [0, 4], attribute: \"aria-label\", value: () => (`${$r(plan).name} includes`) }, { path: [0, 4, 0], each: () => ($r(plan).features ?? []), key: (feature, $index) => $r(feature), block: { template: \"<li></li>\", parts: (feature, $index) => [{ path: [0], text: () => $t($r(feature)) }] } }, { path: [0, 5], when: () => $r(plan).href, blocks: [{ template: \"\\n          <a class=\\\"pricing-choose\\\"></a>\\n          \", parts: () => [{ path: [0], attribute: \"href\", url: true, value: () => $r(plan).href }, { path: [0], text: () => $t(($r(plan).cta ?? \"Choose plan\")) }] }, { template: \"\\n            <button type=\\\"button\\\" class=\\\"pricing-choose\\\"></button>\\n          \", parts: () => [{ path: [0], on: \"click\", handler: () => (() => emit('choose', { plan: $r(plan).id, period: $p.period })) }, { path: [0], text: () => $t(($r(plan).cta ?? \"Choose plan\")) }] }] }] } },\n    ];\n  },\n});\n"
    }
  ]
}
