{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spotlight-tour-whats-new-demo",
  "type": "registry:block",
  "title": "Spotlight Tour: What's New",
  "description": "Product Tour Overlay example, What's New: Three new features spread down a page. Each one scrolls into view while the spotlight travels to it. The Live switch stays usable while it's highlighted. A take on the product tour (walkthrough) and tooltip (popover). Fits onboarding, changelog and app UI sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "onboarding",
    "changelog",
    "app-ui",
    "product-tour",
    "tooltip",
    "overlay",
    "motion"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/spotlight-tour#spotlight-tour-whats-new-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/spotlight-tour.json"
  ],
  "files": [
    {
      "path": "components/spotlight-tour-whats-new-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { SpotlightTour, type SpotlightTourStep } from \"@/components/ui/spotlight-tour\";\n\n// The features are spread down the page. The tour scrolls each one into view\n// while the spotlight travels to it.\nconst steps: SpotlightTourStep[] = [\n  {\n    target: \"[data-tour=whats-new]\",\n    title: \"3 new features\",\n    body: \"Here's what shipped this week. It takes about 20 seconds.\",\n  },\n  {\n    target: \"[data-tour=live]\",\n    title: \"Live mode\",\n    body: \"Charts now update in real time. Flip the switch to watch the numbers move.\",\n    interactive: true,\n  },\n  {\n    target: \"[data-tour=notes]\",\n    title: \"Notes on charts\",\n    body: \"Pin a note to any point on a chart, so next week's spike explains itself.\",\n  },\n  {\n    target: \"[data-tour=export]\",\n    title: \"Export to CSV\",\n    body: \"Download any table as a CSV, with your filters applied.\",\n  },\n];\n\nconst seed = [42, 48, 45, 53, 50, 58, 61, 57, 66, 63, 70, 74, 69, 78, 82, 79, 88, 85, 92, 96];\nconst weeks = [32, 38, 35, 44, 41, 47, 96, 58, 52, 55, 60, 63];\nconst pages = [\n  { path: \"/\", views: \"48,210\", change: \"+12%\" },\n  { path: \"/pricing\", views: \"18,904\", change: \"+31%\" },\n  { path: \"/docs/getting-started\", views: \"12,377\", change: \"+8%\" },\n  { path: \"/blog/launch-week\", views: \"9,120\", change: \"+164%\" },\n  { path: \"/changelog\", views: \"6,483\", change: \"-3%\" },\n  { path: \"/careers\", views: \"2,941\", change: \"+5%\" },\n];\n\nfunction useLive(on: boolean) {\n  const [points, setPoints] = React.useState(seed);\n  React.useEffect(() => {\n    if (!on) return;\n    const timer = window.setInterval(() => {\n      setPoints((current) => {\n        const last = current[current.length - 1];\n        const next = Math.max(40, Math.min(120, last + Math.round(Math.random() * 14 - 6)));\n        return [...current.slice(1), next];\n      });\n    }, 900);\n    return () => window.clearInterval(timer);\n  }, [on]);\n  return points;\n}\n\nfunction line(points: number[], width: number, height: number) {\n  const max = 130;\n  return points\n    .map((value, i) => `${i ? \"L\" : \"M\"}${((i / (points.length - 1)) * width).toFixed(1)} ${(height - (value / max) * height).toFixed(1)}`)\n    .join(\"\");\n}\n\nconst card = \"rounded-xl bg-white p-4 ring-1 ring-zinc-900/[0.06] dark:bg-zinc-950 dark:ring-white/[0.07]\";\n\nexport function SpotlightTourWhatsNewDemo() {\n  const [open, setOpen] = React.useState(false);\n  const [live, setLive] = React.useState(false);\n  const points = useLive(live);\n  const visitors = points[points.length - 1] * 37;\n  const path = line(points, 300, 96);\n\n  return (\n    <div className=\"w-full overflow-hidden rounded-xl border border-zinc-200 bg-zinc-50 dark:border-zinc-800 dark:bg-zinc-900\">\n      <div className=\"h-[var(--demo-height,36rem)] overflow-y-auto overscroll-contain\">\n        <header className=\"sticky top-0 z-10 flex h-14 items-center justify-between gap-3 border-b border-zinc-200/80 bg-zinc-50/85 px-4 backdrop-blur sm:px-6 dark:border-zinc-800/80 dark:bg-zinc-900/85\">\n          <span className=\"flex items-center gap-2 text-sm font-semibold text-zinc-900 dark:text-zinc-50\">\n            <span aria-hidden className=\"size-5 rounded-full bg-gradient-to-br from-emerald-400 to-teal-600\" />\n            Pulse\n          </span>\n          <button\n            data-tour=\"whats-new\"\n            type=\"button\"\n            onClick={() => setOpen(true)}\n            className=\"inline-flex h-7 items-center gap-1.5 rounded-full bg-white pr-1 pl-2.5 text-xs font-medium text-zinc-900 ring-1 ring-zinc-900/10 transition-[background-color,scale] duration-150 hover:bg-zinc-100 active:scale-[0.97] dark:bg-zinc-950 dark:text-zinc-50 dark:ring-white/10 dark:hover:bg-zinc-800\"\n          >\n            What&apos;s new\n            <span className=\"grid h-5 min-w-5 place-items-center rounded-full bg-emerald-500 px-1.5 text-[11px] text-white\">3</span>\n          </button>\n        </header>\n\n        <div className=\"mx-auto max-w-2xl space-y-4 px-4 py-6 sm:px-6\">\n          <div>\n            <h2 className=\"text-xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-50\">Overview</h2>\n            <p className=\"mt-1 text-sm text-zinc-500\">acme.com · Last 30 days</p>\n          </div>\n\n          <div className=\"grid grid-cols-3 gap-2 sm:gap-3\">\n            {[\n              [\"Visitors\", \"184k\"],\n              [\"Bounce\", \"38%\"],\n              [\"Avg. visit\", \"2m 41s\"],\n            ].map(([label, value]) => (\n              <div key={label} className={card}>\n                <p className=\"text-xs text-zinc-500\">{label}</p>\n                <p className=\"mt-1 text-lg font-semibold tracking-tight text-zinc-900 tabular-nums dark:text-zinc-50\">{value}</p>\n              </div>\n            ))}\n          </div>\n\n          <section className={card}>\n            <div className=\"flex items-center justify-between gap-3\">\n              <div>\n                <p className=\"text-sm font-medium text-zinc-900 dark:text-zinc-50\">Visitors right now</p>\n                <p className=\"mt-0.5 text-2xl font-semibold tracking-tight text-zinc-900 tabular-nums dark:text-zinc-50\">\n                  {visitors.toLocaleString(\"en-US\")}\n                </p>\n              </div>\n              <label data-tour=\"live\" className=\"flex cursor-pointer items-center gap-2 rounded-full py-1 pr-1 pl-2.5 text-xs font-medium text-zinc-600 dark:text-zinc-300\">\n                Live\n                <button\n                  type=\"button\"\n                  role=\"switch\"\n                  aria-checked={live}\n                  onClick={() => setLive((on) => !on)}\n                  className={`relative h-5 w-9 cursor-pointer rounded-full transition-colors duration-200 ${live ? \"bg-emerald-500\" : \"bg-zinc-300 dark:bg-zinc-700\"}`}\n                >\n                  <span\n                    className={`absolute top-0.5 left-0.5 size-4 rounded-full bg-white shadow-sm transition-transform duration-200 ease-out ${live ? \"translate-x-4\" : \"\"}`}\n                  />\n                </button>\n              </label>\n            </div>\n            <svg aria-hidden viewBox=\"0 0 300 96\" preserveAspectRatio=\"none\" className=\"mt-4 h-24 w-full overflow-visible\">\n              <path d={`${path}L300 96L0 96Z`} className=\"fill-emerald-500/10\" />\n              <path d={path} fill=\"none\" strokeWidth={1.75} vectorEffect=\"non-scaling-stroke\" className=\"stroke-emerald-500\" />\n            </svg>\n          </section>\n\n          <div className=\"pt-4\">\n            <h2 className=\"text-base font-semibold tracking-tight text-zinc-900 dark:text-zinc-50\">Weekly signups</h2>\n            <p className=\"mt-1 text-sm text-zinc-500\">Week 7 was launch week.</p>\n          </div>\n\n          <section className={card}>\n            <div className=\"relative flex h-40 items-end gap-1.5 sm:gap-2\">\n              {weeks.map((value, i) => (\n                <div\n                  key={i}\n                  className={`flex-1 rounded-t-[4px] ${i === 6 ? \"bg-emerald-500\" : \"bg-zinc-200 dark:bg-zinc-800\"}`}\n                  style={{ height: `${value}%` }}\n                />\n              ))}\n              <div\n                data-tour=\"notes\"\n                className=\"absolute top-1 left-[38%] w-44 rounded-lg bg-zinc-900 px-3 py-2 text-xs text-white shadow-lg sm:left-[46%] dark:bg-zinc-100 dark:text-zinc-900\"\n              >\n                <p className=\"font-medium\">Launch day</p>\n                <p className=\"mt-0.5 text-zinc-400 dark:text-zinc-600\">Front page of Hacker News for 9 hours.</p>\n              </div>\n            </div>\n          </section>\n\n          <div className=\"grid gap-3 pt-4 sm:grid-cols-2\">\n            {[\n              [\"Top referrer\", \"news.ycombinator.com\", \"31% of visits\"],\n              [\"Top country\", \"United States\", \"42% of visits\"],\n              [\"Top device\", \"Desktop\", \"68% of visits\"],\n              [\"Top browser\", \"Chrome\", \"57% of visits\"],\n            ].map(([label, value, note]) => (\n              <div key={label} className={card}>\n                <p className=\"text-xs text-zinc-500\">{label}</p>\n                <p className=\"mt-1 truncate text-sm font-medium text-zinc-900 dark:text-zinc-50\">{value}</p>\n                <p className=\"mt-0.5 text-xs text-zinc-500\">{note}</p>\n              </div>\n            ))}\n          </div>\n\n          <section className={`${card} p-0`}>\n            <div className=\"flex items-center justify-between gap-3 px-4 py-3\">\n              <p className=\"text-sm font-medium text-zinc-900 dark:text-zinc-50\">Top pages</p>\n              <button\n                data-tour=\"export\"\n                type=\"button\"\n                className=\"inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium text-zinc-700 ring-1 ring-zinc-900/10 transition-colors hover:bg-zinc-50 dark:text-zinc-200 dark:ring-white/10 dark:hover:bg-zinc-900\"\n              >\n                <svg aria-hidden viewBox=\"0 0 24 24\" className=\"size-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                  <path d=\"M12 3v12M7 10l5 5 5-5M5 21h14\" />\n                </svg>\n                Export CSV\n              </button>\n            </div>\n            <table className=\"w-full text-sm\">\n              <tbody>\n                {pages.map((page) => (\n                  <tr key={page.path} className=\"border-t border-zinc-100 dark:border-zinc-900\">\n                    <td className=\"max-w-0 truncate px-4 py-2.5 text-zinc-700 dark:text-zinc-300\">{page.path}</td>\n                    <td className=\"px-2 py-2.5 text-right text-zinc-900 tabular-nums dark:text-zinc-100\">{page.views}</td>\n                    <td\n                      className={`px-4 py-2.5 text-right text-xs tabular-nums ${page.change.startsWith(\"-\") ? \"text-rose-600 dark:text-rose-400\" : \"text-emerald-600 dark:text-emerald-400\"}`}\n                    >\n                      {page.change}\n                    </td>\n                  </tr>\n                ))}\n              </tbody>\n            </table>\n          </section>\n        </div>\n      </div>\n\n      <SpotlightTour open={open} onOpenChange={setOpen} steps={steps} />\n    </div>\n  );\n}\n"
    }
  ]
}