import * as React from 'react' import { TrendingUp, TrendingDown, Minus } from 'lucide-react' import { cn } from '../../utils/cn' export interface StatsCardChange { value: number trend: 'up' | 'down' | 'neutral' label?: string } export interface StatsCardProps { title: string value: string | number change?: StatsCardChange icon?: React.ReactNode href?: string className?: string } /** * StatsCard - KPI/metric card component * * Features: * - Trend indicators with TrendingUp/TrendingDown/Minus icons * - Color-coded trends (success for up, error for down, muted for neutral) * - Interactive hover state when href is provided * - Card styles (rounded-xl, border, shadow on hover) */ export function StatsCard({ title, value, change, icon, href, className, }: StatsCardProps) { const isInteractive = Boolean(href) const TrendIcon = change?.trend === 'up' ? TrendingUp : change?.trend === 'down' ? TrendingDown : Minus const trendColorClass = change?.trend === 'up' ? 'text-success' : change?.trend === 'down' ? 'text-error' : 'text-content-muted' const content = ( <>

{title}

{value}

{change && (
{change.value}% {change.label && ( {change.label} )}
)}
{icon && (
{icon}
)}
) const baseClasses = cn( 'block rounded-xl border border-border bg-surface-elevated p-6', 'transition-all duration-fast', isInteractive && [ 'hover:shadow-md hover:border-brand-500/50 cursor-pointer', 'focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base', ], className ) if (href) { return ( {content} ) } return
{content}
}