@php use Filament\Support\Enums\IconSize; @endphp @props([ 'badge' => null, 'badgeColor' => null, 'badgeTooltip' => null, 'color' => 'gray', 'disabled' => false, 'href' => null, 'icon' => null, 'iconAlias' => null, 'iconSize' => IconSize::Medium, 'image' => null, 'keyBindings' => null, 'loadingIndicator' => true, 'tag' => 'button', 'target' => null, 'tooltip' => null, ]) @php $buttonClasses = \Illuminate\Support\Arr::toCssClasses([ 'fi-dropdown-list-item flex w-full items-center gap-2 whitespace-nowrap rounded-md p-2 text-sm transition-colors duration-75 outline-none disabled:pointer-events-none disabled:opacity-70', 'pointer-events-none opacity-70' => $disabled, match ($color) { 'gray' => 'fi-color-gray', default => 'fi-color-custom', }, // @deprecated `fi-dropdown-list-item-color-*` has been replaced by `fi-color-gray` and `fi-color-custom`. is_string($color) ? "fi-dropdown-list-item-color-{$color}" : null, match ($color) { 'gray' => 'hover:bg-gray-50 focus-visible:bg-gray-50 dark:hover:bg-white/5 dark:focus-visible:bg-white/5', default => 'hover:bg-custom-50 focus-visible:bg-custom-50 dark:hover:bg-custom-400/10 dark:focus-visible:bg-custom-400/10', }, ]); $buttonStyles = \Illuminate\Support\Arr::toCssStyles([ \Filament\Support\get_color_css_variables( $color, shades: [50, 400], alias: 'dropdown.list.item', ) => $color !== 'gray', ]); $iconClasses = \Illuminate\Support\Arr::toCssClasses([ 'fi-dropdown-list-item-icon', match ($iconSize) { IconSize::Small, 'sm' => 'h-4 w-4', IconSize::Medium, 'md' => 'h-5 w-5', IconSize::Large, 'lg' => 'h-6 w-6', default => $iconSize, }, match ($color) { 'gray' => 'text-gray-400 dark:text-gray-500', default => 'text-custom-500 dark:text-custom-400', }, ]); $iconStyles = \Illuminate\Support\Arr::toCssStyles([ \Filament\Support\get_color_css_variables( $color, shades: [400, 500], alias: 'dropdown.list.item.icon', ) => $color !== 'gray', ]); $imageClasses = 'fi-dropdown-list-item-image h-5 w-5 rounded-full bg-cover bg-center'; $labelClasses = \Illuminate\Support\Arr::toCssClasses([ 'fi-dropdown-list-item-label flex-1 truncate text-start', match ($color) { 'gray' => 'text-gray-700 dark:text-gray-200', default => 'text-custom-600 dark:text-custom-400 ', }, ]); $labelStyles = \Illuminate\Support\Arr::toCssStyles([ \Filament\Support\get_color_css_variables( $color, shades: [400, 600], alias: 'dropdown.list.item.label', ) => $color !== 'gray', ]); $wireTarget = $loadingIndicator ? $attributes->whereStartsWith(['wire:target', 'wire:click'])->filter(fn ($value): bool => filled($value))->first() : null; $hasLoadingIndicator = filled($wireTarget); if ($hasLoadingIndicator) { $loadingIndicatorTarget = html_entity_decode($wireTarget, ENT_QUOTES); } $hasTooltip = filled($tooltip); @endphp @if ($tag === 'button') @elseif ($tag === 'a') map(fn (string $keyBinding): string => str_replace('+', '-', $keyBinding))->implode('.') }} @endif @if ($hasTooltip) x-tooltip="{ content: @js($tooltip), theme: $store.theme, }" @endif {{ $attributes ->class([$buttonClasses]) ->style([$buttonStyles]) }} > @if ($icon) @endif @if ($image)
@endif {{ $slot }} @if (filled($badge)) {{ $badge }} @endif
@elseif ($tag === 'form')
only(['action', 'class', 'method', 'wire:submit']) }} > @csrf
@endif