@props([ 'label', 'value', 'change' => null, 'formattedValue' => null, 'color' => 'slate', 'watchTime' => false, ]) @php $displayValue = $formattedValue ?? (is_numeric($value) ? number_format((float) $value, 0, ',', ' ') : (string) $value); $ringClass = match ($color) { 'violet' => 'ring-violet-100', 'rose' => 'ring-rose-100', 'sky' => 'ring-sky-100', 'emerald' => 'ring-emerald-100', 'amber' => 'ring-amber-100', 'indigo' => 'ring-indigo-100', default => 'ring-slate-100', }; $textClass = match ($color) { 'violet' => 'text-violet-600', 'rose' => 'text-rose-600', 'sky' => 'text-sky-600', 'emerald' => 'text-emerald-600', 'amber' => 'text-amber-600', 'indigo' => 'text-indigo-600', default => 'text-slate-600', }; $valueClass = match ($color) { 'violet' => 'text-violet-700', 'rose' => 'text-rose-700', 'sky' => 'text-sky-700', 'emerald' => 'text-emerald-700', 'amber' => 'text-amber-700', 'indigo' => 'text-indigo-700', default => 'text-slate-900', }; $direction = $change['direction'] ?? 'flat'; $changeFormatted = $change['formatted'] ?? null; @endphp
{{ $displayValue }}
@if ($changeFormatted) $direction === 'up', 'text-rose-600' => $direction === 'down', 'text-slate-400' => $direction === 'flat', ])> @if ($direction === 'up') @elseif ($direction === 'down') @else @endif {{ $changeFormatted }} @endif