@props([ 'direction' => 'neutral', 'value' => null, 'label' => null, 'tone' => null, 'icon' => null, 'compact' => false, ]) @php $direction = in_array($direction, ['up', 'down', 'neutral'], true) ? $direction : 'neutral'; $tone = $tone ?: match ($direction) { 'up' => 'positive', 'down' => 'negative', default => 'neutral', }; $tone = in_array($tone, ['positive', 'negative', 'neutral'], true) ? $tone : 'neutral'; $icon = $icon ?: match ($direction) { 'up' => 'trend-up', 'down' => 'trend-down', default => 'minus', }; @endphp class([ 'ui-metric-trend', 'ui-metric-trend--'.$tone, 'ui-metric-trend--compact' => $compact, ]) }}> @if ($value !== null && $value !== '') {{ $value }} @endif @if ($label !== null && $label !== '') {{ $label }} @endif {{ $slot }}