{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nonprofit-impact",
  "title": "Nonprofit: Impact page",
  "description": "A short annual report: the year's number set huge, four more in cards with the year, a small chart or count drawn from the number and what it means, filters fitted each month drawn as bars, the spending split, the promises and the accounts placeholder.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://eased.dev/r/eased-tokens.json",
    "https://eased.dev/r/eased-motion.json",
    "https://eased.dev/r/nonprofit-core.json",
    "https://eased.dev/r/nonprofit-spend.json",
    "https://eased.dev/r/number-roll.json"
  ],
  "files": [
    {
      "path": "src/registry/eased/templates/nonprofit/impact.tsx",
      "content": "\"use client\";\n\nimport { motion, useInView } from \"motion/react\";\nimport { useRef } from \"react\";\nimport { enter, instant, stagger, useSafeReducedMotion } from \"../../lib/motion\";\nimport { NumberRoll } from \"../../number-roll/number-roll\";\nimport { impactPage, locale, sampleNote } from \"./content\";\nimport { COLUMN, LABEL, NOTE, PageHead, Reveal, SECTION } from \"./kit\";\nimport { Spend } from \"./spend\";\n\n/** Filters fitted in the year: the months added up, so the headline and the chart never disagree. */\nexport const fittedInYear = impactPage.months.values.reduce((a, b) => a + b, 0);\n\n/**\n * Impact, set like a short annual report: the year's one big number, four more in cards (the\n * year, what it counts, a small chart or count drawn from it, the number and what it means),\n * the filters fitted each month as a bar chart drawn in code, where the money went (the home\n * page's split, from the same lines), what we promise and where the accounts are. Numbers roll\n * up once on first sight; the bars rise 35ms apart. Every figure is a sample, said once.\n */\nexport function Impact() {\n  const numbers = [{ id: \"fitted\", value: fittedInYear, label: impactPage.fitted, means: impactPage.fittedMeans }, ...impactPage.numbers];\n  return (\n    <>\n      <div className={`${COLUMN} flex flex-col gap-group pt-pad-xl pb-group`}>\n        <PageHead label={`${impactPage.label} · ${impactPage.year}`} title={impactPage.title} lead={impactPage.lead} />\n        <div className=\"nf-rise flex flex-col gap-1 border-t-4 border-(--nf-sea) pt-pad-md [--i:3]\">\n          <Rolling value={impactPage.headline.value} className=\"font-display text-[clamp(4.5rem,15vw,13rem)] leading-[1.05] font-bold tracking-[-0.06em] text-text\" />\n          <p className=\"font-display text-display-2xl font-semibold tracking-display text-text-secondary sm:text-display-3xl\">{impactPage.headline.label}</p>\n        </div>\n        <dl className=\"grid gap-tiles sm:grid-cols-2 lg:grid-cols-4\">\n          {numbers.map((n) => (\n            <div key={n.label} className=\"flex flex-col gap-pad-sm rounded-panel border border-line-subtle bg-surface p-pad-md\">\n              <dt className=\"flex flex-col gap-0.5\">\n                <span className={LABEL}>{impactPage.year}</span>\n                <span className=\"text-ui-md font-medium text-pretty text-text\">{n.label}</span>\n              </dt>\n              <dd aria-hidden className=\"py-pad-xs\">\n                <Mini id={n.id} value={n.value} />\n              </dd>\n              <dd>\n                <Rolling value={\"percent\" in n && n.percent ? n.value / 100 : n.value} percent={\"percent\" in n && n.percent} className=\"font-display text-display-5xl font-bold tracking-[-0.05em] text-text\" />\n              </dd>\n              <dd className=\"text-ui-sm text-pretty text-text-secondary\">{n.means}</dd>\n            </div>\n          ))}\n        </dl>\n      </div>\n      <Months />\n      <Spend className=\"border-t border-line-subtle\" />\n      <div className={`${COLUMN} ${SECTION} grid gap-group border-t border-line-subtle lg:grid-cols-[5fr_7fr] lg:gap-group-lg`}>\n        <Reveal className=\"flex flex-col gap-pad-md\">\n          <h2 className=\"font-display text-display-4xl font-semibold tracking-display text-text\">{impactPage.promise.title}</h2>\n          <ol className=\"flex flex-col gap-pad-sm\">\n            {impactPage.promise.items.map((item, i) => (\n              <li key={item} className=\"grid grid-cols-[2rem_1fr] text-ui-lg text-pretty text-text\">\n                <span className=\"font-medium text-brand-text tabular-nums\">{i + 1}</span>\n                {item}\n              </li>\n            ))}\n          </ol>\n        </Reveal>\n        <Reveal index={1} className=\"flex flex-col gap-pad-sm self-end rounded-surface bg-surface-sunken p-pad-md\">\n          <p className={LABEL}>{impactPage.accounts.label}</p>\n          <p className=\"text-ui-md text-text-secondary\">{impactPage.accounts.body}</p>\n          <p className={NOTE}>{sampleNote}</p>\n        </Reveal>\n      </div>\n    </>\n  );\n}\n\n/**\n * Each tile's small picture of its number, drawn from the same figures: the year's months as\n * bars, one mark per well or school, and a ring for the share still working.\n */\nfunction Mini({ id, value }: { id: string; value: number }) {\n  if (id === \"fitted\") {\n    const top = Math.max(...impactPage.months.values);\n    return (\n      <span className=\"flex h-12 items-end gap-1\">\n        {impactPage.months.values.map((v, i) => (\n          <span key={i} className=\"flex-1 rounded-t-[2px] bg-(--nf-sea)\" style={{ height: `${(v / top) * 100}%` }} />\n        ))}\n      </span>\n    );\n  }\n  if (id === \"working\") {\n    const r = 20;\n    const c = 2 * Math.PI * r;\n    return (\n      <svg viewBox=\"0 0 48 48\" className=\"size-12 -rotate-90\">\n        <circle cx=\"24\" cy=\"24\" r={r} fill=\"none\" stroke=\"var(--eased-surface-active)\" strokeWidth=\"7\" />\n        <circle cx=\"24\" cy=\"24\" r={r} fill=\"none\" stroke=\"var(--nf-sea)\" strokeWidth=\"7\" strokeDasharray={`${(c * value) / 100} ${c}`} />\n      </svg>\n    );\n  }\n  return (\n    <span className=\"flex h-12 flex-wrap content-end gap-1.5\">\n      {Array.from({ length: value }, (_, i) => (\n        <span key={i} className={id === \"wells\" ? \"h-5 w-2.5 rounded-t-pill bg-(--nf-sun)\" : \"h-4 w-6 rounded-[3px] bg-(--nf-water)\"} />\n      ))}\n    </span>\n  );\n}\n\n/** A number that rolls up from 0 the first time it is half in view; at its value from the start under reduced motion. */\nfunction Rolling({ value, percent = false, className = \"\" }: { value: number; percent?: boolean; className?: string }) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const seen = useInView(ref, { once: true, amount: 0.5 });\n  const reduced = useSafeReducedMotion();\n  const label = percent ? new Intl.NumberFormat(locale, { style: \"percent\" }).format(value) : value.toLocaleString(locale);\n  return (\n    <span ref={ref} className=\"block\">\n      <NumberRoll value={seen || reduced ? value : 0} format={percent ? { style: \"percent\" } : undefined} locale={locale} aria-hidden className={`tabular-nums ${className}`} />\n      <span className=\"sr-only\">{label}</span>\n    </span>\n  );\n}\n\n/** The filters fitted each month, drawn as twelve bars that rise 35ms apart on first sight. */\nfunction Months() {\n  const ref = useRef<HTMLDivElement>(null);\n  const seen = useInView(ref, { once: true, amount: 0.5 });\n  const reduced = useSafeReducedMotion();\n  const { values, names, label } = impactPage.months;\n  const top = Math.max(...values);\n  return (\n    <section aria-labelledby=\"months-title\" className={`${COLUMN} pb-section`}>\n      <div className=\"flex flex-col gap-pad-md\">\n        <h2 id=\"months-title\" className=\"font-display text-display-2xl font-semibold tracking-display text-text\">\n          {label}\n        </h2>\n        <div ref={ref} className=\"grid h-64 grid-cols-12 items-end gap-1.5 sm:gap-3\">\n          {values.map((v, i) => (\n            <div key={names[i]} className=\"flex h-full flex-col justify-end gap-2\">\n              <span className=\"text-center text-ui-xs text-text-muted tabular-nums max-sm:hidden\">{v}</span>\n              <span className=\"relative block w-full overflow-hidden rounded-t-control-xs\" style={{ height: `${(v / top) * 100}%` }}>\n                <motion.span\n                  className=\"absolute inset-0 origin-bottom bg-(--nf-sea)\"\n                  initial={false}\n                  animate={{ scaleY: seen || reduced ? 1 : 0 }}\n                  transition={reduced ? instant : { ...enter, duration: 0.5, delay: i * stagger.item }}\n                />\n              </span>\n            </div>\n          ))}\n        </div>\n        <div aria-hidden className=\"grid grid-cols-12 gap-1.5 border-t border-line pt-2 text-center text-ui-xs text-text-muted sm:gap-3\">\n          {names.map((m) => (\n            <span key={m}>{m}</span>\n          ))}\n        </div>\n        <table className=\"sr-only\">\n          <caption>{label}</caption>\n          <tbody>\n            {values.map((v, i) => (\n              <tr key={names[i]}>\n                <th scope=\"row\">{names[i]}</th>\n                <td>{v}</td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n        <p className={NOTE}>\n          {impactPage.year}. {sampleNote}\n        </p>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/eased/templates/nonprofit/impact.tsx"
    }
  ],
  "meta": {
    "template": "nonprofit",
    "kind": "template-section",
    "industries": [
      "health"
    ]
  },
  "type": "registry:block"
}