@props([ 'label' => null, 'value' => null, 'icon' => null, 'prefix' => null, 'suffix' => null, 'trend' => null, 'trendDirection' => null, 'trendLabel' => null, 'progress' => null, 'hint' => null, 'color' => null, // accent color for marker: 'primary' | 'success' | 'warning' | 'error' | 'info' | null 'size' => null, // 'sm' | null (default) | 'lg' ]) @php $numericTrend = is_numeric($trend) ? (float) $trend : null; $finalTrendDirection = $trendDirection; if ($finalTrendDirection === null && $numericTrend !== null) { $finalTrendDirection = $numericTrend >= 0 ? 'up' : 'down'; } $trendText = is_null($trend) ? null : (is_numeric($trend) ? ($numericTrend > 0 ? '+' : '') . $numericTrend . '%' : (string) $trend); $progressValue = is_null($progress) ? null : max(0, min(100, (int) $progress)); @endphp
merge(['class' => 'metric' . ($size ? ' metric--' . $size : '') . ($color ? ' metric--' . $color : '')]) }}> @if ($icon || $label)
@if ($icon) @endif @if ($label) {{ $label }} @endif
@endif
@if ($prefix) {{ $prefix }} @endif {{ $value }} @if ($suffix) {{ $suffix }} @endif
@if ($trendText) $finalTrendDirection === 'up', 'metric__trend--down' => $finalTrendDirection === 'down', ])> @if ($finalTrendDirection === 'down') @else @endif {{ $trendText }} @endif
@if (!is_null($progressValue))
@endif @if ($hint || $trendLabel)

{{ $hint ?? $trendLabel }}

@endif @if ($slot->isNotEmpty())
{{ $slot }}
@endif