{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stat-group-01",
  "description": "Metrics side by side, each with its change written as a sentence.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/stat-group.json",
    "https://www.dashboardblocks.com/r/radix/status-label.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/stat-group/stat-group-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateProvider,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  Stat,\n  StatChange,\n  StatGroup,\n  StatLabel,\n  type StatMetric,\n  StatValue,\n  formatStatValue,\n  getStatColumns,\n  getStatPlaceholders,\n} from '@/registry/components/dashboardblocks/stat-group'\nimport { statusToneClasses } from '@/registry/components/dashboardblocks/status-label'\nimport { formatCurrency, formatPercent } from '@/registry/lib/dashboardblocks/format'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\nimport { cn } from '@/lib/utils'\n\ninterface StatGroup1Props extends BlockStateProps {\n  /** Follows each previous value, such as `last month`. */\n  comparison: string\n  /** Leave out, or pass none, to show the empty state. */\n  metrics?: StatMetric[]\n  /** How many metrics to sketch while loading. @default 3 */\n  placeholders?: number\n}\n\nconst exampleProps: StatGroup1Props = {\n  comparison: 'last month',\n  metrics: [\n    {\n      formatter: (value) => formatCurrency(value),\n      key: 'revenue',\n      label: 'Revenue',\n      previous: 42_890,\n      value: 48_210,\n    },\n    { key: 'orders', label: 'Orders', previous: 1_210, value: 1_284 },\n    {\n      changeType: 'points',\n      formatter: (value) => formatPercent(value / 100),\n      goodDirection: 'down',\n      key: 'refundRate',\n      label: 'Refund rate',\n      previous: 2.1,\n      value: 1.8,\n    },\n  ],\n}\n\nconst StatGroup1 = (props: StatGroup1Props) => {\n  const { comparison, metrics = [], placeholders = 3, errorMessage, status } = props\n  const shown = status === 'loading' ? getStatPlaceholders(placeholders) : metrics\n\n  return (\n    <BlockStateProvider\n      errorMessage={errorMessage}\n      state={getBlockState(status, metrics)}\n    >\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-4'>\n            <StatGroup className={getStatColumns(shown.length)}>\n              {shown.map((metric) => (\n                <Stat key={metric.key}>\n                  <StatLabel>{metric.label}</StatLabel>\n                  <StatValue\n                    className={cn(\n                      'text-3xl @2xl:text-4xl',\n                      metric.tone && statusToneClasses[metric.tone],\n                    )}\n                  >\n                    {formatStatValue(metric)}\n                  </StatValue>\n                  {metric.previous === undefined && metric.detail ? (\n                    <dd className='text-muted-foreground text-sm'>{metric.detail}</dd>\n                  ) : (\n                    <StatChange comparison={comparison} metric={metric} />\n                  )}\n                </Stat>\n              ))}\n            </StatGroup>\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { StatGroup1, exampleProps as statGroup1ExampleProps, type StatGroup1Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/stat-group/stat-group-01.tsx"
    }
  ],
  "meta": {
    "shows": "Metrics side by side, each with its change written as a sentence.",
    "size": "full",
    "usedWith": [
      "chart-panel-01",
      "kpi-01",
      "comparison-01"
    ],
    "component": "StatGroup1",
    "props": "{ comparison: string; metrics?: { changeType?: \"percent\" | \"points\" | \"count\"; detail?: ReactNode; formatter?: (value: number) => string; goodDirection?: \"up\" | \"down\"; key: string; label: string; previous?: number; tone?: \"warning\" | \"bad\"; value: number }[]; placeholders?: number; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
