{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "area-chart-kpi-02",
  "description": "A large total with an area chart along the bottom, as a hero number at the top of a dashboard.",
  "dependencies": [
    "recharts"
  ],
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/chart.json",
    "https://www.dashboardblocks.com/r/radix/kpi.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/kpi/area-chart-kpi-02.tsx",
      "content": "'use client'\n\nimport {\n  BlockReady,\n  BlockStateProvider,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { TinyAreaChart } from '@/registry/components/dashboardblocks/chart'\nimport {\n  KPI,\n  KPIChange,\n  KPIChart,\n  KPIContent,\n  KPITitle,\n  type KPIFormat,\n  KPIValue,\n  describeSeries,\n  getKPIFormatter,\n} from '@/registry/components/dashboardblocks/kpi'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface DailyValue {\n  label: string\n  value: number\n}\n\ninterface AreaChartKPI2Props extends BlockStateProps {\n  comparison: string\n  /** Leave out, or pass no days, to show the empty state. */\n  data?: DailyValue[]\n  format?: KPIFormat\n  /** @default 88 */\n  height?: number\n  previous?: number\n  title: string\n}\n\nconst exampleProps: AreaChartKPI2Props = {\n  comparison: 'last week',\n  data: [\n    { label: 'Mon', value: 14_200 },\n    { label: 'Tue', value: 17_100 },\n    { label: 'Wed', value: 12_800 },\n    { label: 'Thu', value: 19_600 },\n    { label: 'Fri', value: 22_300 },\n    { label: 'Sat', value: 18_400 },\n    { label: 'Sun', value: 24_000 },\n  ],\n  format: 'currency',\n  previous: 108_450,\n  title: 'Transaction volume',\n}\n\nconst AreaChartKPI2 = (props: AreaChartKPI2Props) => {\n  const {\n    comparison,\n    data = [],\n    format,\n    height = 88,\n    previous,\n    errorMessage,\n    status,\n    title,\n  } = props\n  const formatter = getKPIFormatter(format)\n  const total = data.reduce((sum, point) => sum + point.value, 0)\n  const peak = data.reduce<DailyValue | undefined>(\n    (top, point) => (!top || point.value > top.value ? point : top),\n    undefined,\n  )\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={getBlockState(status, data)}>\n      <Card>\n        <CardContent>\n          <KPI className='relative overflow-hidden'>\n            <KPIContent className='gap-1 pb-20'>\n              <KPITitle className='relative z-10'>{title}</KPITitle>\n              <KPIValue\n                className='relative z-10 text-5xl'\n                value={total}\n                format={format}\n                animated\n              />\n              <KPIChange\n                className='relative z-10'\n                comparison={comparison}\n                previous={previous}\n                value={total}\n              />\n              <BlockReady className='relative z-10 text-xs'>\n                {peak && (\n                  <p className='text-muted-foreground relative z-10 text-xs'>\n                    Busiest on {peak.label}, at{' '}\n                    <span className='text-foreground font-medium tabular-nums'>\n                      {formatter(peak.value)}\n                    </span>\n                    .\n                  </p>\n                )}\n              </BlockReady>\n            </KPIContent>\n            <KPIChart\n              className='pointer-events-none absolute inset-x-0 bottom-0'\n              label={describeSeries(`${title} by day`, data, format)}\n            >\n              <TinyAreaChart\n                accessibilityLayer={false}\n                areas={[\n                  {\n                    dataKey: 'value',\n                    fill: 'var(--color-chart-2)',\n                    stroke: 'color-mix(in oklab, var(--color-chart-2) 60%, transparent)',\n                    strokeWidth: 1.5,\n                  },\n                ]}\n                data={data}\n                formatter={formatter}\n                height={height}\n                markLast='value'\n                scale='data'\n              />\n            </KPIChart>\n          </KPI>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  AreaChartKPI2,\n  exampleProps as areaChartKpi2ExampleProps,\n  type AreaChartKPI2Props,\n  type DailyValue,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/kpi/area-chart-kpi-02.tsx"
    }
  ],
  "meta": {
    "shows": "A large total with an area chart along the bottom, as a hero number at the top of a dashboard.",
    "size": "compact",
    "usedWith": [
      "stat-group-02",
      "kpi-01",
      "chart-panel-01"
    ],
    "component": "AreaChartKPI2",
    "props": "{ comparison: string; data?: { label: string; value: number }[]; format?: \"number\" | \"compact\" | \"currency\" | \"currency-compact\" | \"percent\"; height?: number; previous?: number; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
