{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats",
  "title": "Stats",
  "description": "A row of key figures that count up when they scroll into view, under a centred section header.",
  "registryDependencies": [
    "@corsair-ui/utils",
    "@corsair-ui/stat",
    "@corsair-ui/number-ticker"
  ],
  "files": [
    {
      "path": "registry/default/components/blocks/stats.tsx",
      "content": "import type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"@/registry/default/lib/utils\";\nimport { NumberTicker } from \"@/registry/default/ui/number-ticker\";\nimport {\n  Stat,\n  StatCaption,\n  StatGroup,\n  StatLabel,\n  StatValue,\n  type StatTrend,\n} from \"@/registry/default/ui/stat\";\n\ninterface StatsItem {\n  /** Stable React key. Falls back to the index. */\n  id?: string;\n  label: ReactNode;\n  /** A number counts up when it scrolls into view; anything else renders as is. */\n  value: number | ReactNode;\n  /** Shown before the value, outside the counting number (\"$\"). */\n  prefix?: ReactNode;\n  /** Shown after the value, outside the counting number (\"+\", \"%\"). */\n  suffix?: ReactNode;\n  /** `Intl.NumberFormat` options for a numeric value: compact notation, digits, currency… */\n  format?: Intl.NumberFormatOptions;\n  /** A note under the value: a comparison, a period. */\n  caption?: ReactNode;\n  /** Adds an arrow for the direction of change next to the caption. */\n  trend?: StatTrend;\n}\n\ntype StatsVariant = \"plain\" | \"cards\";\n\ninterface StatsProps extends Omit<ComponentProps<\"section\">, \"title\"> {\n  /** Small line above the title; pass `null` to hide it. */\n  eyebrow?: ReactNode;\n  /** Section title, rendered in an `<h2>`. */\n  title?: ReactNode;\n  description?: ReactNode;\n  stats?: StatsItem[];\n  /** Plain figures, or each figure in a bordered box. */\n  variant?: StatsVariant;\n  /** Locale for numeric values. Defaults to the one NumberTicker uses. */\n  locale?: string;\n  /** Read to screen readers before a caption with a trend, since the arrow is only a picture. */\n  trendLabels?: Partial<Record<StatTrend, string>>;\n}\n\nconst defaultTrendLabels: Record<StatTrend, string> = {\n  up: \"Increase\",\n  down: \"Decrease\",\n  flat: \"No change\",\n};\n\nconst defaultStats: StatsItem[] = [\n  {\n    id: \"teams\",\n    label: \"Teams on Acme\",\n    value: 12000,\n    suffix: \"+\",\n    caption: \"18% more than last year\",\n    trend: \"up\",\n  },\n  { id: \"uptime\", label: \"Uptime\", value: 99.9, suffix: \"%\", caption: \"Over the last 12 months\" },\n  {\n    id: \"requests\",\n    label: \"Requests a day\",\n    value: 150,\n    suffix: \"M\",\n    caption: \"Handled across 30 regions\",\n  },\n  {\n    id: \"response\",\n    label: \"Median response\",\n    value: 42,\n    suffix: \" ms\",\n    caption: \"Measured at the edge\",\n  },\n];\n\n/**\n * A row of key figures under an optional centred header. Built on\n * StatGroup and Stat, so each value is read together with its label (a\n * description list). `<Stats />` renders four example figures.\n *\n * A numeric `value` uses NumberTicker: it counts up once when it scrolls\n * into view and shows the final value at once with `prefers-reduced-motion`.\n * `prefix` and `suffix` sit outside the counting number; `format` and\n * `locale` control how the number is written. Any other value (a string,\n * an element) renders as is. Two columns on mobile, four on large screens;\n * `variant=\"cards\"` puts each figure in a bordered box. The variant is\n * exposed as `data-variant`.\n *\n * Accessibility: screen readers only hear the final number, never the\n * moving digits. Trend arrows are hidden and replaced by `trendLabels`.\n *\n * @example\n * <Stats\n *   title=\"Growing every day\"\n *   variant=\"cards\"\n *   stats={[\n *     { label: \"Revenue\", value: 48200, prefix: \"$\", caption: \"12% since last month\", trend: \"up\" },\n *     { label: \"Customers\", value: 1200, suffix: \"+\" },\n *     { label: \"Rating\", value: \"4.9 / 5\" },\n *   ]}\n * />\n */\nfunction Stats({\n  eyebrow = \"By the numbers\",\n  title = \"Trusted by teams that move fast\",\n  description = \"Acme runs quietly in the background while thousands of teams ship every day.\",\n  stats = defaultStats,\n  variant = \"plain\",\n  locale,\n  trendLabels,\n  className,\n  ...props\n}: StatsProps) {\n  const hasHeader = eyebrow != null || title != null || description != null;\n  const labels = { ...defaultTrendLabels, ...trendLabels };\n\n  return (\n    <section\n      data-slot=\"stats\"\n      data-variant={variant}\n      className={cn(\"py-16 sm:py-24\", className)}\n      {...props}\n    >\n      <div data-slot=\"stats-container\" className=\"mx-auto w-full max-w-6xl px-4 sm:px-6\">\n        {hasHeader ? (\n          <div data-slot=\"stats-header\" className=\"mx-auto max-w-2xl text-center\">\n            {eyebrow != null ? (\n              <p data-slot=\"stats-eyebrow\" className=\"text-muted-foreground text-sm font-medium\">\n                {eyebrow}\n              </p>\n            ) : null}\n            {title != null ? (\n              <h2\n                data-slot=\"stats-title\"\n                className={cn(\n                  \"text-3xl font-semibold tracking-tight text-balance sm:text-4xl\",\n                  eyebrow != null && \"mt-2\"\n                )}\n              >\n                {title}\n              </h2>\n            ) : null}\n            {description != null ? (\n              <p\n                data-slot=\"stats-description\"\n                className=\"text-muted-foreground mt-4 text-lg text-pretty\"\n              >\n                {description}\n              </p>\n            ) : null}\n          </div>\n        ) : null}\n        <StatGroup\n          className={cn(\n            \"grid-cols-2 gap-x-6 gap-y-10 lg:grid-cols-4\",\n            variant === \"cards\" && \"gap-y-6\",\n            hasHeader && \"mt-12\"\n          )}\n        >\n          {stats.map((stat, index) => (\n            <Stat\n              key={stat.id ?? index}\n              className={cn(\n                \"min-w-0 gap-2\",\n                variant === \"cards\" && \"bg-card rounded-xl border p-6\"\n              )}\n            >\n              <StatLabel>{stat.label}</StatLabel>\n              <StatValue className=\"text-3xl break-words sm:text-4xl\">\n                {typeof stat.value === \"number\" ? (\n                  <>\n                    {stat.prefix != null ? (\n                      <span data-slot=\"stats-prefix\">{stat.prefix}</span>\n                    ) : null}\n                    <NumberTicker value={stat.value} format={stat.format} locale={locale} />\n                    {stat.suffix != null ? (\n                      <span data-slot=\"stats-suffix\">{stat.suffix}</span>\n                    ) : null}\n                  </>\n                ) : (\n                  <>\n                    {stat.prefix}\n                    {stat.value}\n                    {stat.suffix}\n                  </>\n                )}\n              </StatValue>\n              {stat.caption != null || stat.trend ? (\n                <StatCaption\n                  trend={stat.trend}\n                  trendLabel={stat.trend ? labels[stat.trend] : undefined}\n                  className=\"text-sm\"\n                >\n                  {stat.caption}\n                </StatCaption>\n              ) : null}\n            </Stat>\n          ))}\n        </StatGroup>\n      </div>\n    </section>\n  );\n}\n\nexport { Stats, type StatsItem, type StatsProps, type StatsVariant };\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:block"
}