{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats-template",
  "type": "registry:block",
  "title": "Stats Template",
  "description": "Public-facing metrics page. Topbar + header (title + lead) + SectionBoundary(StatGroup) + SectionBoundary(arbitrary chart/table content) + optional methodology footnote + Footer.",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "data",
    "template"
  ],
  "dependencies": [],
  "registryDependencies": [
    "https://ds.interlace.tools/r/theme.json",
    "https://ds.interlace.tools/r/cn.json",
    "https://ds.interlace.tools/r/container.json",
    "https://ds.interlace.tools/r/footer.json",
    "https://ds.interlace.tools/r/section-boundary.json",
    "https://ds.interlace.tools/r/skeleton.json",
    "https://ds.interlace.tools/r/stack.json",
    "https://ds.interlace.tools/r/stat-card.json",
    "https://ds.interlace.tools/r/stat-group.json",
    "https://ds.interlace.tools/r/topbar.json",
    "https://ds.interlace.tools/r/typography.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/templates/stats-template.tsx",
      "target": "components/ui/templates/stats-template.tsx",
      "type": "registry:block",
      "content": "import * as React from 'react';\n\n// @interlace/stats-template v1.2.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/stats-template\n// What changed since: https://ds.interlace.tools/c/stats-template#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — StatsTemplate\n *\n * Public-facing metrics page. Topbar + header (title + lead) +\n * SectionBoundary(StatGroup) + SectionBoundary(arbitrary chart/table\n * content) + optional methodology footnote + Footer.\n *\n * Used by `/stats`, internal reporting dashboards, public analytics\n * surfaces. Each loadable region streams via SectionBoundary so the\n * hero KPIs paint while the detail table is still fetching.\n *\n * ## MIN_VIEWPORT — 320\n */\n\nimport { cn } from '@/lib/utils';\nimport { Container } from '@/components/ui/container';\nimport { SectionBoundary } from '@/components/ui/section-boundary';\nimport { Stack } from '@/components/ui/stack';\nimport { Typography } from '@/components/ui/typography';\nimport { Topbar } from '@/components/ui/patterns/topbar';\nimport { Footer } from '@/components/ui/patterns/footer';\nimport { StatGroup } from '@/components/ui/patterns/stat-group';\nimport { StatCard } from '@/components/ui/patterns/stat-card';\nimport { Skeleton } from '@/components/ui/skeleton';\n\ntype StatCardProps = React.ComponentProps<typeof StatCard>;\n\nexport const MIN_VIEWPORT = 320 as const;\n\ninterface StatsTemplateProps extends Omit<React.ComponentProps<'div'>, 'title'> {\n  topbar: React.ComponentProps<typeof Topbar>;\n  /** Page title. */\n  title: React.ReactNode;\n  /** One-paragraph lead under the title. */\n  lead?: React.ReactNode;\n  /** Hero KPI row (3-5 metrics). */\n  hero?: StatCardProps[];\n  /** Detail content (chart / table / etc.) — consumer-supplied. */\n  children?: React.ReactNode;\n  /**\n   * Optional methodology footnote — explains where the numbers come\n   * from. Rendered as a muted block under the body.\n   */\n  methodology?: React.ReactNode;\n  footer?: React.ComponentProps<typeof Footer>;\n}\n\nfunction StatsTemplate({\n  topbar,\n  title,\n  lead,\n  hero,\n  children,\n  methodology,\n  footer,\n  className,\n  ...props\n}: StatsTemplateProps) {\n  return (\n    <div\n      data-slot=\"stats-template\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      className={cn('bg-background text-foreground', className)}\n      {...props}\n    >\n      <Topbar {...topbar} />\n\n      <main>\n        <Container size=\"content\">\n          <Stack gap=\"xl\" className=\"py-xl\">\n            <SectionBoundary name=\"stats-header\" skeletonVariant=\"page-header\">\n              <Stack gap=\"sm\">\n                <Typography variant=\"h1\" as=\"h1\" className=\"text-balance\">\n                  {title}\n                </Typography>\n                {lead ? (\n                  <Typography variant=\"long\" tone=\"muted\" className=\"max-w-prose\">\n                    {lead}\n                  </Typography>\n                ) : null}\n              </Stack>\n            </SectionBoundary>\n\n            {hero ? (\n              <SectionBoundary\n                name=\"stats-hero\"\n                skeletonVariant=\"stat-card\"\n              >\n                {/* Clamped into the Grid's actual variant range. The `as 2 | 3`\n                    cast this replaces was a lie the compiler accepted: a\n                    `hero` of 0 or 1 produced `cols={0}` / `cols={1}`, neither\n                    of which is a cva variant, so Grid emitted NO grid-cols-*\n                    class at all and the KPI row silently lost its track. */}\n                <StatGroup\n                  stats={hero}\n                  cols={hero.length >= 4 ? 4 : hero.length === 3 ? 3 : 2}\n                />\n              </SectionBoundary>\n            ) : null}\n\n            {children ? (\n              <SectionBoundary\n                name=\"stats-body\"\n                skeletonVariant=\"card\"\n              >\n                {children}\n              </SectionBoundary>\n            ) : null}\n\n            {methodology ? (\n              <SectionBoundary\n                name=\"stats-methodology\"\n                skeletonVariant=\"text\"\n              >\n                <div className=\"border-border border-t pt-md\">\n                  <Typography variant=\"ui-sm\" tone=\"muted\">\n                    {methodology}\n                  </Typography>\n                </div>\n              </SectionBoundary>\n            ) : null}\n          </Stack>\n        </Container>\n      </main>\n\n      {footer ? <Footer {...footer} /> : null}\n    </div>\n  );\n}\nStatsTemplate.displayName = 'StatsTemplate';\n\n/**\n * Page-level loading state — the full-page silhouette of\n * `<StatsTemplate>`, not a single rect. Rendered by the consumer while\n * the whole route's data is in flight (`loading.tsx` in Next.js), or as\n * a `<SectionBoundary skeleton={…}>` override.\n *\n * Shapes mirror the real layout so the swap is CLS-neutral (R23). One\n * `role=\"status\"` region for the page; inner skeletons pass\n * `label={null}` so screen readers hear one announcement, not ten.\n */\nfunction StatsTemplateSkeleton({\n  className,\n  ...props\n}: React.ComponentProps<'div'>) {\n  return (\n    <div\n      data-slot=\"stats-template-skeleton\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      role=\"status\"\n      aria-busy=\"true\"\n      aria-label=\"Loading stats…\"\n      className={cn('bg-background text-foreground', className)}\n      {...props}\n    >\n      <Skeleton\n        variant=\"rect\"\n        className=\"h-14 w-full rounded-none\"\n        label={null}\n      />\n      <Container size=\"content\">\n        <Stack gap=\"xl\" className=\"py-xl\">\n          <Skeleton variant=\"page-header\" label={null} />\n          <Skeleton variant=\"stat-card\" count={3} label={null} />\n          <Skeleton variant=\"card\" label={null} />\n        </Stack>\n      </Container>\n    </div>\n  );\n}\nStatsTemplateSkeleton.displayName = 'StatsTemplateSkeleton';\nStatsTemplate.Skeleton = StatsTemplateSkeleton;\n\nexport { StatsTemplate };\nexport type { StatsTemplateProps };\n"
    }
  ],
  "meta": {
    "tier": "template",
    "client": false,
    "minViewport": 320,
    "loading": false,
    "version": "1.2.0",
    "since": "1.0.0"
  },
  "docs": "## @interlace/stats-template\n\nInstalled to `components/ui/templates/stats-template.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/templates/stats-template';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/stats-template\n\nRequires the `@interlace/theme` CSS baseline (installed automatically as a registry dependency)."
}
