@props([ 'label', 'value', 'icon' => null, 'color' => 'brand', 'trend' => null, // numeric: +12.5 / -8.2 / null 'trendLabel' => null, // texto extra opcional 'hint' => null, 'sparkline' => null, // array de nĂºmeros opcional 'sparkColor' => null, ]) @php $palette = [ 'brand' => ['bg' => 'bg-brand-50', 'text' => 'text-brand-600', 'spark' => '#6366f1'], 'emerald' => ['bg' => 'bg-emerald-50', 'text' => 'text-emerald-600', 'spark' => '#10b981'], 'amber' => ['bg' => 'bg-amber-50', 'text' => 'text-amber-600', 'spark' => '#f59e0b'], 'rose' => ['bg' => 'bg-rose-50', 'text' => 'text-rose-600', 'spark' => '#f43f5e'], 'sky' => ['bg' => 'bg-sky-50', 'text' => 'text-sky-600', 'spark' => '#0ea5e9'], 'violet' => ['bg' => 'bg-violet-50', 'text' => 'text-violet-600', 'spark' => '#8b5cf6'], 'orange' => ['bg' => 'bg-orange-50', 'text' => 'text-orange-600', 'spark' => '#f97316'], 'slate' => ['bg' => 'bg-ink-100', 'text' => 'text-ink-700', 'spark' => '#64748b'], ]; $tones = $palette[$color] ?? $palette['brand']; $sparkColor = $sparkColor ?? $tones['spark']; $chartId = 'spark-'.uniqid(); @endphp

{{ $label }}

{{ $value }}

@if ($trend !== null) (float) $trend > 0, 'bg-rose-50 text-rose-700' => (float) $trend < 0, 'bg-ink-100 text-ink-600' => (float) $trend == 0, ])> @if ((float) $trend > 0) @elseif ((float) $trend < 0) @endif {{ (float) $trend > 0 ? '+' : '' }}{{ $trend }}% @endif @if ($trendLabel) {{ $trendLabel }} @elseif ($hint) {{ $hint }} @endif
@if ($icon)
{!! $icon !!}
@endif
@if ($sparkline)
@push('scripts') @endpush @endif