{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stat-card",
  "title": "Stat Card",
  "description": "A metric with its trend and a sparkline.",
  "dependencies": [
    "cn"
  ],
  "files": [
    {
      "path": "ui/stat-card.tsx",
      "content": "import { cn } from \"cn\";\nimport * as React from \"react\";\n\nimport { IconPlaceholder } from \"@/registry/icons/icon-placeholder\";\n\nfunction StatCard({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"stat-card\"\n      className={cn(\"gap-2.5 rounded-xl border bg-card p-5 text-card-foreground shadow-[0_1px_2px_rgb(0_0_0/4%),0_8px_24px_rgb(0_0_0/5%)] flex flex-col\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction StatCardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"stat-card-header\"\n      className={cn(\n        \"gap-2 flex items-center justify-between\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction StatCardLabel({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"stat-card-label\"\n      className={cn(\"text-[13px] text-muted-foreground\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction StatCardDelta({\n  trend = \"up\",\n  className,\n  children,\n  ...props\n}: React.ComponentProps<\"span\"> & { trend?: \"up\" | \"down\" }) {\n  return (\n    <span\n      data-slot=\"stat-card-delta\"\n      data-trend={trend}\n      className={cn(\n        \"gap-0.75 rounded-full bg-secondary px-1.75 py-0.5 text-xs font-medium text-secondary-foreground [&_svg:not([class*='size-'])]:size-3 inline-flex shrink-0 items-center\",\n        className,\n      )}\n      {...props}\n    >\n      {trend === \"up\" ? (\n        <IconPlaceholder\n          lucide=\"ArrowUpRightIcon\"\n          tabler=\"IconArrowUpRight\"\n          hugeicons=\"ArrowUpRight01Icon\"\n          phosphor=\"ArrowUpRightIcon\"\n          remixicon=\"RiArrowRightUpLine\"\n        />\n      ) : (\n        <IconPlaceholder\n          lucide=\"ArrowDownRightIcon\"\n          tabler=\"IconArrowDownRight\"\n          hugeicons=\"ArrowDownRight01Icon\"\n          phosphor=\"ArrowDownRightIcon\"\n          remixicon=\"RiArrowRightDownLine\"\n        />\n      )}\n      <span className=\"sr-only\">{trend === \"up\" ? \"Up\" : \"Down\"}</span>\n      {children}\n    </span>\n  );\n}\n\nfunction StatCardValue({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"stat-card-value\"\n      className={cn(\"text-[28px]/none font-semibold tracking-tight tabular-nums\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction StatCardCaption({ className, ...props }: React.ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"stat-card-caption\"\n      className={cn(\"text-xs text-muted-foreground\", className)}\n      {...props}\n    />\n  );\n}\n\n// The last bar is the current period. It's decoration, so the value and\n// caption carry the meaning.\nfunction StatCardSparkline({\n  data,\n  className,\n  ...props\n}: React.ComponentProps<\"div\"> & { data: readonly number[] }) {\n  // A NaN or infinite value would stretch every other bar.\n  const values = data.map((value) =>\n    Number.isFinite(value) ? Math.max(value, 0) : 0,\n  );\n  const max = values.reduce((a, b) => Math.max(a, b), 0) || 1;\n\n  return (\n    <div\n      data-slot=\"stat-card-sparkline\"\n      aria-hidden=\"true\"\n      className={cn(\"h-9 gap-1 pt-1.5 flex items-end\", className)}\n      {...props}\n    >\n      {values.map((value, index) => (\n        <span\n          key={index}\n          data-current={index === values.length - 1 || undefined}\n          className=\"rounded-[2px] bg-secondary data-current:bg-primary flex-1\"\n          style={{ height: `${(value / max) * 100}%` }}\n        />\n      ))}\n    </div>\n  );\n}\n\nexport {\n  StatCard,\n  StatCardCaption,\n  StatCardDelta,\n  StatCardHeader,\n  StatCardLabel,\n  StatCardSparkline,\n  StatCardValue,\n};\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}