@php
use Filament\Support\Enums\IconPosition;
$chartColor = $getChartColor() ?? 'gray';
$descriptionColor = $getDescriptionColor() ?? 'gray';
$descriptionIcon = $getDescriptionIcon();
$descriptionIconPosition = $getDescriptionIconPosition();
$url = $getUrl();
$tag = $url ? 'a' : 'div';
$descriptionIconClasses = \Illuminate\Support\Arr::toCssClasses([
'fi-wi-stats-overview-stat-description-icon h-5 w-5',
match ($descriptionColor) {
'gray' => 'text-gray-400 dark:text-gray-500',
default => 'text-custom-500',
},
]);
$descriptionIconStyles = \Illuminate\Support\Arr::toCssStyles([
\Filament\Support\get_color_css_variables($descriptionColor, shades: [500]) => $descriptionColor !== 'gray',
]);
@endphp
<{!! $tag !!}
@if ($url)
href="{{ $url }}"
@if ($shouldOpenUrlInNewTab())
target="_blank"
@endif
@endif
{{
$getExtraAttributeBag()
->class([
'fi-wi-stats-overview-stat relative rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
])
}}
>
@if ($icon = $getIcon())
@endif
{{ $getLabel() }}
{{ $getValue() }}
@if ($description = $getDescription())
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::Before, 'before']))
@endif
'text-gray-500 dark:text-gray-400',
default => 'text-custom-600 dark:text-custom-400',
},
])
@style([
\Filament\Support\get_color_css_variables($descriptionColor, shades: [400, 600]) => $descriptionColor !== 'gray',
])
>
{{ $description }}
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::After, 'after']))
@endif
@endif
@if ($chart = $getChart())
{{-- An empty function to initialize the Alpine component with until it's loaded with `ax-load`. This removes the need for `x-ignore`, allowing the chart to be updated via Livewire polling. --}}
$chartColor !== 'gray',
])
>
'text-gray-100 dark:text-gray-800',
default => 'text-custom-50 dark:text-custom-400/10',
},
])
>
'text-gray-400',
default => 'text-custom-500 dark:text-custom-400',
},
])
>
@endif
{!! $tag !!}>