@php use Filament\Support\Enums\Alignment; use Filament\Support\Enums\MaxWidth; @endphp @props([ 'alignment' => Alignment::Start, 'ariaLabelledby' => null, 'closeButton' => \Filament\Support\View\Components\Modal::$hasCloseButton, 'closeByClickingAway' => \Filament\Support\View\Components\Modal::$isClosedByClickingAway, 'closeEventName' => 'close-modal', 'description' => null, 'displayClasses' => 'inline-block', 'footer' => null, 'footerActions' => [], 'footerActionsAlignment' => Alignment::Start, 'header' => null, 'heading' => null, 'icon' => null, 'iconAlias' => null, 'iconColor' => 'primary', 'id' => null, 'openEventName' => 'open-modal', 'slideOver' => false, 'stickyFooter' => false, 'stickyHeader' => false, 'trigger' => null, 'visible' => true, 'width' => 'sm', ]) @php if (! $alignment instanceof Alignment) { $alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null; } if (! $footerActionsAlignment instanceof Alignment) { $footerActionsAlignment = filled($footerActionsAlignment) ? (Alignment::tryFrom($footerActionsAlignment) ?? $footerActionsAlignment) : null; } if (! $width instanceof MaxWidth) { $width = filled($width) ? (MaxWidth::tryFrom($width) ?? $width) : null; } @endphp
$width === MaxWidth::Screen, $displayClasses, ]) > @if ($trigger)
attributes->class(['fi-modal-trigger flex cursor-pointer']) }} > {{ $trigger }}
@endif
! $slideOver, ]) >
class([ 'pointer-events-none relative w-full transition', 'my-auto p-4' => ! ($slideOver || ($width === MaxWidth::Screen)), ]) }} >
$slideOver, // Using an arbitrary value instead of the h-dvh class that was added in Tailwind CSS v3.4.0 // to ensure compatibility with custom themes that may use an older version of Tailwind CSS. 'h-[100dvh]' => $slideOver || ($width === MaxWidth::Screen), 'mx-auto rounded-xl' => ! ($slideOver || ($width === MaxWidth::Screen)), 'hidden' => ! $visible, match ($width) { MaxWidth::ExtraSmall => 'max-w-xs', MaxWidth::Small => 'max-w-sm', MaxWidth::Medium => 'max-w-md', MaxWidth::Large => 'max-w-lg', MaxWidth::ExtraLarge => 'max-w-xl', MaxWidth::TwoExtraLarge => 'max-w-2xl', MaxWidth::ThreeExtraLarge => 'max-w-3xl', MaxWidth::FourExtraLarge => 'max-w-4xl', MaxWidth::FiveExtraLarge => 'max-w-5xl', MaxWidth::SixExtraLarge => 'max-w-6xl', MaxWidth::SevenExtraLarge => 'max-w-7xl', MaxWidth::Full => 'max-w-full', MaxWidth::MinContent => 'max-w-min', MaxWidth::MaxContent => 'max-w-max', MaxWidth::FitContent => 'max-w-fit', MaxWidth::Prose => 'max-w-prose', MaxWidth::ScreenSmall => 'max-w-screen-sm', MaxWidth::ScreenMedium => 'max-w-screen-md', MaxWidth::ScreenLarge => 'max-w-screen-lg', MaxWidth::ScreenExtraLarge => 'max-w-screen-xl', MaxWidth::ScreenTwoExtraLarge => 'max-w-screen-2xl', MaxWidth::Screen => 'fixed inset-0', default => $width, }, ]) > @if ($heading || $header)
$stickyHeader, 'rounded-t-xl' => $stickyHeader && ! ($slideOver || ($width === MaxWidth::Screen)), match ($alignment) { Alignment::Start, Alignment::Left => 'gap-x-5', Alignment::Center => 'flex-col', default => null, }, ]) > @if ($closeButton)
! $slideOver, 'end-6 top-6' => $slideOver, ]) >
@endif @if ($header) {{ $header }} @else @if ($icon)
$alignment === Alignment::Center, ]) >
'fi-color-gray bg-gray-100 dark:bg-gray-500/20', default => 'fi-color-custom bg-custom-100 dark:bg-custom-500/20', }, match ($alignment) { Alignment::Start, Alignment::Left => 'p-2', Alignment::Center => 'p-3', default => null, }, ]) @style([ \Filament\Support\get_color_css_variables( $iconColor, shades: [100, 400, 500, 600], alias: 'modal.icon', ) => $iconColor !== 'gray', ]) > 'text-gray-500 dark:text-gray-400', default => 'text-custom-600 dark:text-custom-400', }, ]) />
@endif
$alignment === Alignment::Center, ]) > {{ $heading }} @if (filled($description)) {{ $description }} @endif
@endif
@endif @if (! \Filament\Support\is_slot_empty($slot))
($width === MaxWidth::Screen) || $slideOver, 'pe-6 ps-[5.25rem]' => $icon && ($alignment === Alignment::Start), 'px-6' => ! ($icon && ($alignment === Alignment::Start)), ]) > {{ $slot }}
@endif @if ((! \Filament\Support\is_slot_empty($footer)) || (is_array($footerActions) && count($footerActions)) || (! is_array($footerActions) && (! \Filament\Support\is_slot_empty($footerActions))))
$icon && ($alignment === Alignment::Start) && ($footerActionsAlignment !== Alignment::Center) && (! $stickyFooter), 'px-6' => ! ($icon && ($alignment === Alignment::Start) && ($footerActionsAlignment !== Alignment::Center) && (! $stickyFooter)), 'fi-sticky sticky bottom-0 border-t border-gray-200 bg-white py-5 dark:border-white/10 dark:bg-gray-900' => $stickyFooter, 'rounded-b-xl' => $stickyFooter && ! ($slideOver || ($width === MaxWidth::Screen)), 'pb-6' => ! $stickyFooter, 'mt-6' => (! $stickyFooter) && \Filament\Support\is_slot_empty($slot), 'mt-auto' => $slideOver, ]) > @if (! \Filament\Support\is_slot_empty($footer)) {{ $footer }} @else
'flex flex-wrap items-center', Alignment::Center => 'flex flex-col-reverse sm:grid sm:grid-cols-[repeat(auto-fit,minmax(0,1fr))]', Alignment::End, Alignment::Right => 'flex flex-row-reverse flex-wrap items-center', default => null, }, ]) > @if (is_array($footerActions)) @foreach ($footerActions as $action) {{ $action }} @endforeach @else {{ $footerActions }} @endif
@endif
@endif