@php use Filament\Support\Enums\Alignment; use Filament\Support\Enums\MaxWidth; @endphp @props([ 'alignment' => Alignment::Start, 'ariaLabelledby' => null, 'autofocus' => \Filament\Support\View\Components\Modal::$isAutofocused, 'closeButton' => \Filament\Support\View\Components\Modal::$hasCloseButton, 'closeByClickingAway' => \Filament\Support\View\Components\Modal::$isClosedByClickingAway, 'closeByEscaping' => \Filament\Support\View\Components\Modal::$isClosedByEscaping, 'closeEventName' => 'close-modal', 'description' => null, 'displayClasses' => 'inline-block', 'extraModalWindowAttributeBag' => null, '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 $hasDescription = filled($description); $hasHeading = filled($heading); $hasIcon = filled($icon); 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; } $closeEventHandler = filled($id) ? '$dispatch(' . \Illuminate\Support\Js::from($closeEventName) . ', { id: ' . \Illuminate\Support\Js::from($id) . ' })' : 'close()'; @endphp
$width === MaxWidth::Screen, $displayClasses, ]) > @if ($trigger)
attributes->class(['fi-modal-trigger flex cursor-pointer']) }} > {{ $trigger }}
@endif
! ($slideOver || ($width === MaxWidth::Screen)), 'cursor-pointer' => $closeByClickingAway, ]) >
class([ 'relative grid min-h-full grid-rows-[1fr_auto_1fr] justify-items-center sm:grid-rows-[1fr_auto_3fr]', 'p-4' => ! ($slideOver || ($width === MaxWidth::Screen)), ]) }} >
class([ 'fi-modal-window pointer-events-auto relative row-start-2 flex w-full cursor-default flex-col bg-white shadow-xl ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10', 'fi-modal-slide-over-window ms-auto overflow-y-auto' => $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, }, 'items-center' => $hasIcon && $hasHeading && (! $hasDescription) && in_array($alignment, [Alignment::Start, Alignment::Left]), ]) > @if ($closeButton)
! $slideOver, 'end-6 top-6' => $slideOver, ]) >
@endif @if ($header) {{ $header }} @else @if ($hasIcon)
$alignment === Alignment::Center, ]) >
'bg-gray-100 dark:bg-gray-500/20', default => 'fi-color-custom bg-custom-100 dark:bg-custom-500/20', }, is_string($iconColor) ? "fi-color-{$iconColor}" : null, 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 ($hasDescription) {{ $description }} @endif
@endif
@endif @if (! \Filament\Support\is_slot_empty($slot))
($width === MaxWidth::Screen) || $slideOver, 'pe-6 ps-[5.25rem]' => $hasIcon && ($alignment === Alignment::Start) && (! $stickyHeader), 'px-6' => ! ($hasIcon && ($alignment === Alignment::Start) && (! $stickyHeader)), ]) > {{ $slot }}
@endif @if ((! \Filament\Support\is_slot_empty($footer)) || (is_array($footerActions) && count($footerActions)) || (! is_array($footerActions) && (! \Filament\Support\is_slot_empty($footerActions))))
$hasIcon && ($alignment === Alignment::Start) && ($footerActionsAlignment !== Alignment::Center) && (! $stickyFooter), 'px-6' => ! ($hasIcon && ($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