{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats-plotted",
  "title": "Plotted stats",
  "description": "Figures that count up, each over a gauge a pen plots tick by tick, with an accent band out to the figure's share of the dial and a needle pointing at it.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/stats-plotted.tsx",
      "content": "'use client';\n\n/**\n * stats-plotted — a row of figures that count up, each over a gauge a pen\n * plots tick by tick, clockwise, as the figure arrives: the ticks in ink, a\n * band in the accent colour out to the figure's share of the dial, and a\n * needle pointing at it.\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 default figures are placeholders: pass your own. The figures are in the\n * server HTML (each counter renders its final number); the gauges are drawn in\n * the browser, each finishing as it reaches the middle of the screen, and each\n * is seeded from its label. Reduced motion shows the final figures and the\n * gauges drawn.\n */\n\nimport { useEffect, useState } from 'react';\nimport { ScrollCounter, ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { gauge, scrollWindow, seedOf, staggerFor, type Stroke } from '@/lib/plotter';\n\nexport interface Figure {\n  value: number;\n  decimals?: number;\n  prefix?: string;\n  suffix?: string;\n  label: string;\n  /** How far round the gauge the accent band goes, 0 to 1. */\n  share?: number;\n}\n\nexport interface StatsPlottedProps {\n  eyebrow?: string;\n  heading?: string;\n  description?: string;\n  figures?: Figure[];\n  caption?: string;\n  accent?: string;\n  className?: string;\n}\n\nconst SAMPLES: Figure[] = [\n  { value: 120, suffix: '+', label: 'Sample figure: teams on board', share: 0.6 },\n  { value: 99.9, decimals: 1, suffix: '%', label: 'Sample figure: uptime', share: 0.999 },\n  { value: 4.8, decimals: 1, suffix: '/5', label: 'Sample figure: average rating', share: 0.96 },\n  { value: 36, suffix: ' h', label: 'Sample figure: hours saved a month', share: 0.45 },\n];\n\n// The ticks draw one after another over this many trigger ranges (see scrollWindow).\nconst SPREAD = 0.8;\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\nfunction Gauge({ label, share, accent }: { label: string; share: number; accent: string }) {\n  const [strokes, setStrokes] = useState<Stroke[] | null>(null);\n  useEffect(() => setStrokes(gauge({ seed: seedOf(label), share })), [label, share]);\n  if (!strokes) return null;\n  return (\n    <ScrollDraw stagger={staggerFor(strokes.length, SPREAD)} easing=\"linear\" trigger={scrollWindow(SPREAD)} className=\"absolute inset-0\" aria-hidden>\n      <svg viewBox=\"0 0 100 100\" className=\"size-full\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"0.9\" strokeLinecap=\"round\">\n        {strokes.map((s, i) => (s.pen ? <path key={i} d={s.d} stroke={accent} strokeWidth=\"1.3\" /> : <path key={i} d={s.d} />))}\n      </svg>\n    </ScrollDraw>\n  );\n}\n\nexport function StatsPlotted({\n  eyebrow = 'In numbers',\n  heading = 'The figures, *plotted*.',\n  description = 'Placeholder figures: replace them with your own before you ship.',\n  figures = SAMPLES,\n  caption = 'Fig. — Sample figures, not measurements',\n  accent = '#e0482a',\n  className = '',\n}: StatsPlottedProps) {\n  return (\n    <section className={`mx-auto max-w-7xl px-6 py-28 sm:px-10 ${className}`}>\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        {description && <p className=\"mt-6 max-w-lg text-pretty text-[17px] leading-relaxed text-muted-foreground\">{description}</p>}\n      </div>\n\n      <ul className=\"mt-16 grid gap-x-10 gap-y-14 sm:grid-cols-2 lg:grid-cols-4\">\n        {figures.map((s) => (\n          <li key={s.label} className=\"border-t pt-8\">\n            <div className=\"relative size-28\">\n              <Gauge label={s.label} share={s.share ?? 0.7} accent={accent} />\n            </div>\n            <p className=\"mt-8 font-serif text-6xl tracking-[-0.03em] tabular-nums\">\n              {s.prefix}\n              <ScrollCounter to={s.value} decimals={s.decimals ?? 0} trigger={scrollWindow()} />\n              {s.suffix}\n            </p>\n            <p className=\"mt-3 max-w-[16rem] text-pretty text-[15px] leading-relaxed text-muted-foreground\">{s.label}</p>\n          </li>\n        ))}\n      </ul>\n      {caption && <p className=\"mt-14 font-mono text-[11px] uppercase tracking-[0.2em] text-muted-foreground\">{caption}</p>}\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll to it: the gauges are plotted and the figures count up.",
    "tall": false
  },
  "type": "registry:block"
}