{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-plotted",
  "title": "Plotted pricing",
  "description": "Plans headed by marks that grow denser with the plan, the recommended one framed by a pen that goes round it twice, and prices that count.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/pricing-plotted.tsx",
      "content": "'use client';\n\n/**\n * pricing-plotted — plans in columns, each headed by a mark that grows denser\n * with the plan, plotted as the section arrives. The recommended plan is\n * framed by a pen that goes round it twice, and the prices count up.\n *\n * Built on svg-scroll-draw (MIT): https://github.com/DhruvilChauahan0210/scrollfx\n * Needs: react, svg-scroll-draw, and lib/plotter (installed with it).\n * Styling: Tailwind CSS with shadcn/ui tokens. The heading takes one emphasised\n * word between asterisks, set in `font-serif`.\n *\n * The prices are in the server HTML (the counter renders its final number).\n * Reduced motion shows the final prices, the marks and the frame drawn.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { ScrollCounter, ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { scrollWindow, sketchRect, staggerFor, type Stroke } from '@/lib/plotter';\n\nexport interface Plan {\n  name: string;\n  description: string;\n  monthly: number;\n  yearly: number;\n  features: string[];\n  cta: { label: string; href: string };\n  featured?: boolean;\n}\n\nexport interface PricingPlottedProps {\n  eyebrow?: string;\n  heading?: string;\n  description?: string;\n  plans?: Plan[];\n  currency?: string;\n  accent?: string;\n  className?: string;\n}\n\nconst DEFAULT_PLANS: Plan[] = [\n  { name: 'Starter', description: 'For trying it on a side project.', monthly: 0, yearly: 0, features: ['3 dashboards', '7 days of history', 'Email reports', 'Community support'], cta: { label: 'Start free', href: '#' } },\n  { name: 'Pro', description: 'For teams that run on their numbers.', monthly: 24, yearly: 19, features: ['Unlimited dashboards', '2 years of history', 'Realtime updates', 'Scheduled reports', 'Slack alerts', 'Priority support'], cta: { label: 'Start a 14-day trial', href: '#' }, featured: true },\n  { name: 'Business', description: 'For companies with security reviews.', monthly: 64, yearly: 52, features: ['Everything in Pro', 'Unlimited history', 'SSO and SCIM', 'Audit log', 'Custom retention', 'A named engineer'], cta: { label: 'Talk to sales', href: '#' } },\n];\n\nfunction Heading({ text }: { text: string }) {\n  return <>{text.split(/(\\*[^*]+\\*)/).map((p, i) => (p.startsWith('*') ? <em key={i} className=\"italic\">{p.slice(1, -1)}</em> : <span key={i}>{p}</span>))}</>;\n}\n\n/** A mark of concentric rings: more rings for a bigger plan. */\nfunction Mark({ rings, accent }: { rings: number; accent?: string }) {\n  return (\n    <ScrollDraw stagger={staggerFor(rings, 0.6)} easing=\"linear\" trigger={scrollWindow(0.6)} className=\"size-14\" aria-hidden>\n      <svg viewBox=\"0 0 56 56\" className=\"size-full\" fill=\"none\" stroke={accent ?? 'currentColor'} strokeWidth=\"0.9\">\n        {Array.from({ length: rings }, (_, i) => <circle key={i} cx=\"28\" cy=\"28\" r={26 - i * (22 / rings)} />)}\n      </svg>\n    </ScrollDraw>\n  );\n}\n\n/** The pen's frame round the recommended plan, measured to fit it. */\nfunction Frame({ accent }: { accent: string }) {\n  const ref = useRef<HTMLDivElement>(null);\n  const [frame, setFrame] = useState<{ w: number; h: number; strokes: Stroke[] } | null>(null);\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const measure = () => {\n      const w = Math.round(el.offsetWidth), h = Math.round(el.offsetHeight);\n      setFrame((f) => (f && f.w === w && f.h === h ? f : { w, h, strokes: sketchRect({ w, h, seed: 3 }) }));\n    };\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n  return (\n    <div ref={ref} className=\"pointer-events-none absolute inset-0\">\n      {frame && (\n        // The second pass follows the first, both round as the card reaches\n        // the middle of the screen.\n        <ScrollDraw key={`${frame.w}x${frame.h}`} stagger={0.5} easing=\"linear\" trigger={scrollWindow(0.5)} className=\"size-full\" aria-hidden>\n          <svg width={frame.w} height={frame.h} viewBox={`0 0 ${frame.w} ${frame.h}`} className=\"block overflow-visible\" fill=\"none\" strokeWidth=\"1.3\" strokeLinecap=\"round\">\n            {frame.strokes.map((s, i) => <path key={i} d={s.d} stroke={s.pen ? accent : 'currentColor'} />)}\n          </svg>\n        </ScrollDraw>\n      )}\n    </div>\n  );\n}\n\nexport function PricingPlotted({\n  eyebrow = 'Pricing',\n  heading = 'Simple, *honest* pricing.',\n  description = 'Start free. Upgrade when your team needs more history, more people or more control.',\n  plans = DEFAULT_PLANS,\n  currency = '$',\n  accent = '#e0482a',\n  className = '',\n}: PricingPlottedProps) {\n  const [yearly, setYearly] = useState(true);\n\n  return (\n    <section className={`mx-auto max-w-7xl px-6 py-28 sm:px-10 ${className}`}>\n      <div className=\"flex flex-wrap items-end justify-between gap-8\">\n        <div className=\"max-w-2xl\">\n          <p className=\"font-mono text-[11px] uppercase tracking-[0.22em] text-muted-foreground\">{eyebrow}</p>\n          <h2 className=\"mt-6 font-serif text-[clamp(2.6rem,5vw,4.2rem)] leading-[0.98] tracking-[-0.03em]\">\n            <Heading text={heading} />\n          </h2>\n          <p className=\"mt-6 max-w-lg text-pretty text-[17px] leading-relaxed text-muted-foreground\">{description}</p>\n        </div>\n        <div role=\"radiogroup\" aria-label=\"Billing period\" className=\"inline-flex rounded-full border p-1 font-mono text-[12px] uppercase tracking-[0.14em]\">\n          {[{ label: 'Monthly', value: false }, { label: 'Yearly', value: true }].map((o) => (\n            <button key={o.label} type=\"button\" role=\"radio\" aria-checked={yearly === o.value} onClick={() => setYearly(o.value)}\n              className={`rounded-full px-4 py-2 transition-colors ${yearly === o.value ? 'bg-foreground text-background' : 'text-muted-foreground hover:text-foreground'}`}>\n              {o.label}\n            </button>\n          ))}\n        </div>\n      </div>\n\n      <div className=\"mt-16 grid gap-6 lg:grid-cols-3 lg:gap-0\">\n        {plans.map((plan, i) => {\n          const price = yearly ? plan.yearly : plan.monthly;\n          return (\n            <article key={plan.name} className={`relative flex flex-col p-8 sm:p-10 ${plan.featured ? 'bg-card' : i > 0 ? 'border-t lg:border-l lg:border-t-0' : ''} ${plan.featured ? 'rounded-[20px]' : ''}`}>\n              {plan.featured && <Frame accent={accent} />}\n              <Mark rings={2 + i * 3} accent={plan.featured ? accent : undefined} />\n              <h3 className=\"mt-8 font-serif text-3xl tracking-[-0.02em]\">{plan.name}</h3>\n              <p className=\"mt-2 text-muted-foreground\">{plan.description}</p>\n\n              <p className=\"mt-10 flex items-baseline gap-2\">\n                <span className=\"font-serif text-6xl tracking-[-0.03em] tabular-nums\">\n                  {currency}\n                  {/* A new key per period: the counter starts again from the new number. */}\n                  <ScrollCounter key={`${plan.name}-${yearly}`} to={price} trigger={scrollWindow()} />\n                </span>\n                <span className=\"font-mono text-[11px] uppercase tracking-[0.14em] text-muted-foreground\">/ month</span>\n              </p>\n              <p className=\"mt-2 h-5 text-sm text-muted-foreground\">{price > 0 ? (yearly ? 'Billed yearly' : 'Billed monthly') : 'Free, for as long as you like'}</p>\n\n              <a href={plan.cta.href} className={`mt-8 inline-flex h-12 items-center justify-center rounded-full px-6 text-[15px] font-medium transition-transform hover:-translate-y-px ${plan.featured ? 'bg-foreground text-background' : 'border hover:bg-accent'}`}>\n                {plan.cta.label}\n              </a>\n\n              <ul className=\"mt-10 space-y-3.5\">\n                {plan.features.map((ft) => (\n                  <li key={ft} className=\"flex items-baseline gap-3.5\">\n                    <span aria-hidden className=\"mt-[0.55em] h-px w-4 shrink-0 bg-foreground/50\" />\n                    <span>{ft}</span>\n                  </li>\n                ))}\n              </ul>\n            </article>\n          );\n        })}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll to it: the marks and the frame are drawn.",
    "tall": true
  },
  "type": "registry:block"
}