import * as React from "react" import { type LucideIcon, TrendingDown, TrendingUp } from "lucide-react" import { cn } from "@/lib/utils" import { Badge } from "@/components/ui/badge" import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" export interface StatCardProps extends React.ComponentProps { /** Metric label, e.g. "Total revenue". */ label: string /** Big value, e.g. "$48,120". */ value: React.ReactNode /** Optional period / context line under the value. */ hint?: string /** Signed percentage change. Positive renders up + accent, negative down + destructive. */ delta?: number /** Icon shown top-right. */ icon?: LucideIcon } /** * StatCard — a dashboard KPI tile composed from Card + Badge. * Purely var-driven, so it adopts whatever `data-theme` is active. */ export function StatCard({ label, value, hint, delta, icon: Icon, className, ...props }: StatCardProps) { const up = (delta ?? 0) >= 0 return ( {label} {value} {Icon ? ( ) : null} {(delta !== undefined || hint) && ( {delta !== undefined && ( {up ? : } {up ? "+" : ""} {delta}% )} {hint && ( {hint} )} )} ) }