{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "metric-chart-card",
  "title": "Metric Chart Card",
  "description": "A compact metric card with animated numbers, deltas, and a small line, bar, or area chart.",
  "dependencies": [
    "@number-flow/react",
    "lucide-react",
    "motion",
    "recharts"
  ],
  "registryDependencies": [
    "card",
    "chart"
  ],
  "files": [
    {
      "path": "registry/corr/components/metric-chart-card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ArrowDownIcon, ArrowUpIcon, MinusIcon } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport {\n  Area,\n  AreaChart,\n  Bar,\n  BarChart,\n  CartesianGrid,\n  Line,\n  LineChart,\n  XAxis,\n} from \"recharts\"\n\nimport { AnimatedNumber } from \"./animated-number\"\nimport {\n  ChartContainer,\n  ChartTooltip,\n  ChartTooltipContent,\n  type ChartConfig,\n} from \"@/components/ui/chart\"\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\"\nimport { cn } from \"@/lib/utils\"\n\nexport type MetricChartCardTone =\n  | \"neutral\"\n  | \"success\"\n  | \"warning\"\n  | \"destructive\"\n\nexport function MetricChartCard({\n  label,\n  value,\n  delta,\n  data,\n  dataKey,\n  chart = \"line\",\n  tone = \"neutral\",\n  className,\n}: {\n  label: string\n  value: number\n  delta?: number\n  data: Array<Record<string, unknown>>\n  dataKey: string\n  tone?: MetricChartCardTone\n  chart?: \"line\" | \"bar\" | \"area\"\n  className?: string\n}) {\n  const reduceMotion = useReducedMotion()\n  const isPositive = typeof delta === \"number\" && delta > 0\n  const isNegative = typeof delta === \"number\" && delta < 0\n  const DeltaIcon = isPositive ? ArrowUpIcon : isNegative ? ArrowDownIcon : MinusIcon\n  const config = {\n    [dataKey]: {\n      label,\n      color: \"var(--color-metric)\",\n    },\n  } satisfies ChartConfig\n\n  return (\n    <Card\n      className={cn(\n        \"overflow-hidden\",\n        tone === \"success\" && \"border-emerald-500/20 bg-emerald-500/5\",\n        tone === \"warning\" && \"border-amber-500/20 bg-amber-500/5\",\n        tone === \"destructive\" && \"border-destructive/30 bg-destructive/5\",\n        className\n      )}\n      style={\n        {\n          \"--color-metric\":\n            tone === \"success\"\n              ? \"oklch(0.69 0.16 160)\"\n              : tone === \"warning\"\n                ? \"oklch(0.78 0.16 80)\"\n                : tone === \"destructive\"\n                  ? \"var(--destructive)\"\n                  : \"var(--chart-5)\",\n        } as React.CSSProperties\n      }\n    >\n      <CardHeader className=\"pb-2\">\n        <div className=\"flex items-start justify-between gap-3\">\n          <CardTitle className=\"text-sm font-medium text-muted-foreground\">\n            {label}\n          </CardTitle>\n          {typeof delta === \"number\" ? (\n            <span\n              className={cn(\n                \"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium\",\n                isPositive && \"text-emerald-700 dark:text-emerald-300\",\n                isNegative && \"text-destructive\"\n              )}\n            >\n              <DeltaIcon className=\"size-3\" />\n              <AnimatedNumber value={Math.abs(delta)} suffix=\"%\" />\n            </span>\n          ) : null}\n        </div>\n      </CardHeader>\n      <CardContent className=\"space-y-3\">\n        <motion.div\n          initial={{ opacity: 0, y: reduceMotion ? 0 : 4 }}\n          animate={{ opacity: 1, y: 0 }}\n          transition={{ duration: reduceMotion ? 0 : 0.18 }}\n          className=\"text-3xl font-semibold tabular-nums\"\n        >\n          <AnimatedNumber value={value} />\n        </motion.div>\n        <ChartContainer config={config} className=\"h-24 w-full\">\n          {chart === \"bar\" ? (\n            <BarChart data={data}>\n              <XAxis dataKey=\"name\" hide />\n              <ChartTooltip content={<ChartTooltipContent />} />\n              <Bar dataKey={dataKey} fill=\"var(--color-metric)\" radius={3} />\n            </BarChart>\n          ) : chart === \"area\" ? (\n            <AreaChart data={data}>\n              <XAxis dataKey=\"name\" hide />\n              <CartesianGrid vertical={false} strokeDasharray=\"3 3\" />\n              <ChartTooltip content={<ChartTooltipContent />} />\n              <Area\n                dataKey={dataKey}\n                stroke=\"var(--color-metric)\"\n                fill=\"var(--color-metric)\"\n                fillOpacity={0.16}\n                type=\"monotone\"\n              />\n            </AreaChart>\n          ) : (\n            <LineChart data={data}>\n              <XAxis dataKey=\"name\" hide />\n              <CartesianGrid vertical={false} strokeDasharray=\"3 3\" />\n              <ChartTooltip content={<ChartTooltipContent />} />\n              <Line\n                dataKey={dataKey}\n                stroke=\"var(--color-metric)\"\n                strokeWidth={2}\n                type=\"monotone\"\n                dot={false}\n              />\n            </LineChart>\n          )}\n        </ChartContainer>\n      </CardContent>\n    </Card>\n  )\n}\n",
      "type": "registry:component"
    },
    {
      "path": "registry/corr/components/animated-number.tsx",
      "content": "\"use client\"\n\nimport NumberFlow, { type NumberFlowProps } from \"@number-flow/react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type AnimatedNumberProps = Omit<NumberFlowProps, \"value\"> & {\n  value: number\n}\n\nexport function AnimatedNumber({\n  value,\n  className,\n  willChange = true,\n  ...props\n}: AnimatedNumberProps) {\n  return (\n    <NumberFlow\n      value={value}\n      willChange={willChange}\n      className={cn(\"tabular-nums\", className)}\n      {...props}\n    />\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}