@php use Filament\Support\Enums\Alignment; use Filament\Support\Enums\IconSize; @endphp @props([ 'aside' => false, 'collapsed' => false, 'collapsible' => false, 'compact' => false, 'contentBefore' => false, 'description' => null, 'label' => null, 'footerActions' => [], 'footerActionsAlignment' => Alignment::Start, 'headerActions' => [], 'headerEnd' => null, 'heading' => null, 'icon' => null, 'iconColor' => 'gray', 'iconBackgroundColor' => '', 'badge' => null, 'badgeColor' => 'gray', 'badgeIcon' => null, 'badgeIconPosition' => null, 'badgeSize' => null, 'iconSize' => IconSize::Large, 'persistCollapsed' => false, ]) @php $hasDescription = filled((string) $description); $hasLabel = filled((string) $label); $hasHeading = filled($heading); $hasIcon = filled($icon); $hasBadge = filled($badge); $iconContainerClasses = "{$iconBackgroundColor} h-fit p-1 rounded-lg"; if (is_array($headerActions)) { $headerActions = array_filter($headerActions, fn($headerAction): bool => $headerAction->isVisible()); } if (is_array($footerActions)) { $footerActions = array_filter($footerActions, fn($footerAction): bool => $footerAction->isVisible()); } $hasHeaderActions = $headerActions instanceof \Illuminate\Contracts\Support\Htmlable ? !\Filament\Support\is_slot_empty($headerActions) : filled($headerActions); $hasFooterActions = $footerActions instanceof \Illuminate\Contracts\Support\Htmlable ? !\Filament\Support\is_slot_empty($footerActions) : filled($footerActions); $hasHeader = $hasIcon || $hasHeading || $hasDescription || $collapsible || $hasHeaderActions || filled((string) $headerEnd); @endphp
class([ 'fi-section', match ($aside) { true => 'fi-aside grid grid-cols-1 items-start gap-x-6 gap-y-4 md:grid-cols-3', false => 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10', }, ]) }}> @if ($hasHeader)
$collapsible, match ($compact) { true => 'px-4 py-2.5', false => 'px-6 py-4', } => !$aside, ])>
@if ($hasIcon)
'text-gray-400 dark:text-gray-500', default => 'fi-color-custom text-custom-500 dark:text-custom-400', }, is_string($iconColor) ? "fi-color-{$iconColor}" : null, match ($iconSize) { IconSize::Small, 'sm' => 'h-4 w-4 mt-1', IconSize::Medium, 'md' => 'h-5 w-5 mt-0.5', IconSize::Large, 'lg' => 'h-8 w-8', default => $iconSize, }, ]) @style([ \Filament\Support\get_color_css_variables($iconColor, shades: [400, 500], alias: 'section.header.icon') => $iconColor !== 'gray', ]) />
@endif
@if ($hasHeading || $hasDescription)
@if ($hasLabel) {{ $label }} @endif @if ($hasHeading)
{{ $heading }} @if ($hasBadge)
{{ $badge }}
@endif
@endif @if ($hasDescription) {{ $description }} @endif
@endif
@if ($hasHeaderActions) @endif {{ $headerEnd }} @if ($collapsible) @endif
@if ($hasHeaderActions)
@endif
@endif
$hasHeader && !$aside, 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 md:col-span-2' => $aside, 'md:order-first' => $contentBefore, ]) >
'p-4', false => 'p-6', }, ])> {{ $slot }}
@if ($hasFooterActions) @endif