{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-release-activity",
  "title": "Release adoption",
  "author": "andongmin94",
  "description": "Install and update activity with count/share views, period controls, and exact values.",
  "dependencies": [
    "recharts@^3.10.1"
  ],
  "registryDependencies": [
    "https://neobrutal-ui.andongmin.com/r/chart.json",
    "https://neobrutal-ui.andongmin.com/r/card.json"
  ],
  "files": [
    {
      "path": "src/components/ui/chart-release-activity.tsx",
      "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Area, AreaChart, CartesianGrid, XAxis, YAxis } from \"recharts\";\n\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport {\n  ChartContainer,\n  ChartSelect,\n  ChartTooltip,\n  ChartTooltipContent,\n  type ChartConfig,\n} from \"@/components/ui/chart\";\n\nconst releases = [\n  { release: \"R1\", installs: 148, updates: 62 },\n  { release: \"R2\", installs: 232, updates: 104 },\n  { release: \"R3\", installs: 196, updates: 88 },\n  { release: \"R4\", installs: 284, updates: 132 },\n  { release: \"R5\", installs: 341, updates: 176 },\n  { release: \"R6\", installs: 378, updates: 209 },\n];\nconst config = {\n  installs: { label: \"New installs\", color: \"var(--chart-1)\" },\n  updates: {\n    label: \"Updates\",\n    color: \"color-mix(in srgb, var(--chart-2) 65%, var(--foreground))\",\n  },\n} satisfies ChartConfig;\nconst number = new Intl.NumberFormat(\"en-US\");\n\nexport default function ChartReleaseActivity() {\n  const [view, setView] = useState(\"count\");\n  const [range, setRange] = useState(\"6\");\n  const data = releases.slice(-Number(range));\n  const installs = data.reduce((total, row) => total + row.installs, 0);\n  const updates = data.reduce((total, row) => total + row.updates, 0);\n  const total = installs + updates;\n  const share = view === \"share\";\n\n  return (\n    <Card className=\"min-w-0\" data-chart-recipe=\"activity\">\n      <CardHeader>\n        <p className=\"font-mono text-xs uppercase tracking-widest\">\n          Activity / Volume or composition?\n        </p>\n        <CardTitle>\n          <h3>Release adoption</h3>\n        </CardTitle>\n        <CardDescription>\n          Separate new adoption from repeat use. Illustrative event counts, not unique users.\n        </CardDescription>\n      </CardHeader>\n      <CardContent className=\"grid min-w-0 gap-6\">\n        <div className=\"flex flex-wrap gap-4\">\n          <ChartSelect\n            label=\"Activity measure\"\n            value={view}\n            onValueChange={setView}\n            options={[\n              { value: \"count\", label: \"Event counts\" },\n              { value: \"share\", label: \"Share of each release\" },\n            ]}\n          />\n          <ChartSelect\n            label=\"Release period\"\n            value={range}\n            onValueChange={setRange}\n            options={[\n              { value: \"6\", label: \"All 6 releases\" },\n              { value: \"3\", label: \"Latest 3 releases\" },\n            ]}\n          />\n        </div>\n        <dl className=\"grid gap-4 border-y-2 border-border py-4 sm:grid-cols-3\" aria-live=\"polite\">\n          {[\n            [\"Total activity\", number.format(total)],\n            [\"New installs\", number.format(installs)],\n            [\"Update share\", `${((updates / total) * 100).toFixed(1)}%`],\n          ].map(([label, value]) => (\n            <div key={label}>\n              <dt className=\"text-xs\">{label}</dt>\n              <dd className=\"mt-1 text-2xl font-heading tabular-nums\">{value}</dd>\n            </div>\n          ))}\n        </dl>\n        <figure\n          aria-label={\n            share ? \"Install and update share by release\" : \"Install and update events by release\"\n          }\n          className=\"min-w-0\"\n        >\n          <ChartContainer config={config} className=\"h-72 w-full min-w-0 aspect-auto\">\n            <AreaChart\n              accessibilityLayer\n              data={data}\n              stackOffset={share ? \"expand\" : \"none\"}\n              margin={{ top: 12, right: 12, left: 0, bottom: 0 }}\n            >\n              <CartesianGrid vertical={false} />\n              <XAxis dataKey=\"release\" tickLine={false} axisLine={false} tickMargin={10} />\n              <YAxis\n                width={48}\n                domain={share ? [0, 1] : [0, \"auto\"]}\n                tickLine={false}\n                axisLine={false}\n                tickFormatter={(value) =>\n                  share ? `${Math.round(Number(value) * 100)}%` : number.format(Number(value))\n                }\n              />\n              <ChartTooltip\n                content={\n                  <ChartTooltipContent\n                    formatter={(value, name) =>\n                      `${name === \"installs\" ? \"New installs\" : \"Updates\"}: ${number.format(Number(value))} events`\n                    }\n                  />\n                }\n              />\n              <Area\n                dataKey=\"installs\"\n                type=\"linear\"\n                stackId=\"events\"\n                fill=\"var(--color-installs)\"\n                fillOpacity={0.7}\n                stroke=\"var(--foreground)\"\n                strokeWidth={2}\n                isAnimationActive={false}\n              />\n              <Area\n                dataKey=\"updates\"\n                type=\"linear\"\n                stackId=\"events\"\n                fill=\"var(--color-updates)\"\n                fillOpacity={0.6}\n                stroke=\"var(--foreground)\"\n                strokeWidth={2}\n                strokeDasharray=\"6 4\"\n                isAnimationActive={false}\n              />\n            </AreaChart>\n          </ChartContainer>\n          <figcaption className=\"mt-3 text-xs leading-5\">\n            Lower area / solid boundary: new installs. Upper area / dashed boundary: updates.\n          </figcaption>\n        </figure>\n        <output className=\"border-l-4 border-main pl-3 text-sm leading-6\">\n          {share\n            ? \"Every release totals 100%. A larger share does not necessarily mean more events.\"\n            : \"Stack height is total activity. The solid and dashed boundaries separate installs and updates.\"}\n        </output>\n        <details className=\"min-w-0 border-t-2 border-border pt-4\">\n          <summary className=\"cursor-pointer text-sm font-heading\">View activity data</summary>\n          <table className=\"mt-3 w-full text-left text-xs tabular-nums\">\n            <caption className=\"pb-3 text-left\">\n              The same {data.length} releases. Update share uses each release&apos;s total.\n            </caption>\n            <thead>\n              <tr>\n                {[\"Release\", \"Installs\", \"Updates\", \"Update share\"].map((label) => (\n                  <th key={label} scope=\"col\" className=\"border-b-2 border-border py-2 pr-2\">\n                    {label}\n                  </th>\n                ))}\n              </tr>\n            </thead>\n            <tbody>\n              {data.map((row) => (\n                <tr key={row.release}>\n                  <th scope=\"row\" className=\"py-3 pr-2\">\n                    {row.release}\n                  </th>\n                  <td>{row.installs}</td>\n                  <td>{row.updates}</td>\n                  <td>{((row.updates / (row.installs + row.updates)) * 100).toFixed(1)}%</td>\n                </tr>\n              ))}\n            </tbody>\n          </table>\n        </details>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "data-display",
    "data-visualization",
    "recipe"
  ],
  "type": "registry:component"
}