|
64 | 64 |
|
65 | 65 | $wireSubmitHandler = $attributes->get('wire:submit.prevent'); |
66 | 66 | $attributes = $attributes->except(['wire:submit.prevent']); |
67 | | - $isClickThrough = $clickThrough && !$closeByClickingAway; |
| 67 | + $isClickThrough = $clickThrough && ! $closeByClickingAway; |
68 | 68 | @endphp |
69 | 69 |
|
70 | 70 | @if ($trigger) |
71 | 71 | {!! '<div>' !!} |
72 | 72 | {{-- Avoid formatting issues with unclosed elements --}} |
73 | 73 |
|
74 | 74 | <div |
75 | | - @if (! $trigger->attributes->get('disabled')) |
76 | | - @if ($id) |
77 | | - x-on:click="$dispatch(@js($openEventName), { id: @js($id) })" |
| 75 | + @if (! $trigger->attributes->get('disabled')) |
| 76 | + @if ($id) |
| 77 | + x-on:click="$dispatch(@js($openEventName), { id: @js($id) })" |
78 | 78 | @else |
79 | 79 | x-on:click="$el.nextElementSibling.dispatchEvent(new CustomEvent(@js($openEventName)))" |
80 | 80 | @endif |
81 | | - @endif |
82 | | - {{ $trigger->attributes->except(['disabled'])->class(['fi-modal-trigger']) }} |
| 81 | + @endif |
| 82 | + {{ $trigger->attributes->except(['disabled'])->class(['fi-modal-trigger']) }} |
83 | 83 | > |
84 | 84 | {{ $trigger }} |
85 | 85 | </div> |
|
91 | 91 | @endif |
92 | 92 |
|
93 | 93 | <div |
94 | | - @if ($ariaLabelledby) |
95 | | - aria-labelledby="{{ $ariaLabelledby }}" |
96 | | - @elseif ($heading) |
97 | | - aria-labelledby="{{ "{$id}.heading" }}" |
98 | | - @endif |
99 | | - aria-modal="true" |
100 | | - id="{{ $id }}" |
101 | | - role="dialog" |
102 | | - x-data="filamentModal({ |
| 94 | + @if ($ariaLabelledby) |
| 95 | + aria-labelledby="{{ $ariaLabelledby }}" |
| 96 | + @elseif ($heading) |
| 97 | + aria-labelledby="{{ "{$id}.heading" }}" |
| 98 | + @endif |
| 99 | + aria-modal="true" |
| 100 | + id="{{ $id }}" |
| 101 | + role="dialog" |
| 102 | + x-data="filamentModal({ |
103 | 103 | id: @js($id), |
104 | 104 | })" |
105 | | - @if ($id) |
106 | | - data-fi-modal-id="{{ $id }}" |
| 105 | + @if ($id) |
| 106 | + data-fi-modal-id="{{ $id }}" |
107 | 107 | x-on:{{ $closeEventName }}.window="if (($event.detail.id === @js($id)) && isOpen) close()" |
108 | 108 | x-on:{{ $closeQuietlyEventName }}.window="if (($event.detail.id === @js($id)) && isOpen) closeQuietly()" |
109 | 109 | x-on:{{ $openEventName }}.window="if (($event.detail.id === @js($id)) && (! isOpen)) open()" |
110 | | - @else |
111 | | - x-on:{{ $closeEventName }}.stop="if (isOpen) close()" |
| 110 | + @else |
| 111 | + x-on:{{ $closeEventName }}.stop="if (isOpen) close()" |
112 | 112 | x-on:{{ $closeQuietlyEventName }}.stop="if (isOpen) closeQuietly()" |
113 | 113 | x-on:{{ $openEventName }}.stop="if (! isOpen) open()" |
114 | | - @endif |
115 | | - x-bind:class="{ |
| 114 | + @endif |
| 115 | + x-bind:class="{ |
116 | 116 | 'fi-modal-open': isOpen, |
117 | 117 | }" |
118 | 118 | x-cloak |
|
134 | 134 | ]) |
135 | 135 | }} |
136 | 136 | > |
137 | | - @unless($isClickThrough) |
| 137 | + @unless ($isClickThrough) |
138 | 138 | <div |
139 | | - aria-hidden="true" |
140 | | - x-show="isOpen" |
141 | | - x-transition.duration.300ms.opacity |
142 | | - {{ |
143 | | - ($extraModalOverlayAttributeBag ?? new \Illuminate\View\ComponentAttributeBag)->class([ |
144 | | - 'fi-modal-close-overlay', |
145 | | - ]) |
146 | | - }} |
| 139 | + aria-hidden="true" |
| 140 | + x-show="isOpen" |
| 141 | + x-transition.duration.300ms.opacity |
| 142 | + {{ |
| 143 | + ($extraModalOverlayAttributeBag ?? new \Illuminate\View\ComponentAttributeBag)->class([ |
| 144 | + 'fi-modal-close-overlay', |
| 145 | + ]) |
| 146 | + }} |
147 | 147 | ></div> |
148 | 148 | @endunless |
149 | 149 |
|
150 | 150 | <div |
151 | | - @if ($closeByClickingAway) |
152 | | - x-on:click.self="{{ $closeEventHandler }}" |
153 | | - @endif |
154 | | - @class([ |
155 | | - 'fi-modal-window-ctn', |
156 | | - 'fi-clickable' => $closeByClickingAway, |
157 | | - 'pointer-events-none' => $isClickThrough, |
158 | | - ]) |
| 151 | + @if ($closeByClickingAway) |
| 152 | + x-on:click.self="{{ $closeEventHandler }}" |
| 153 | + @endif |
| 154 | + @class([ |
| 155 | + 'fi-modal-window-ctn', |
| 156 | + 'fi-clickable' => $closeByClickingAway, |
| 157 | + 'pointer-events-none' => $isClickThrough, |
| 158 | + ]) |
159 | 159 | > |
160 | 160 | <{{ filled($wireSubmitHandler) ? 'form' : 'div' }} |
161 | 161 | @if ($closeByEscaping) |
162 | | - x-on:keydown.window.escape="if (isTopmost()) {{ $closeEventHandler }}" |
163 | | - @endif |
164 | | - x-show="isWindowVisible" |
165 | | - x-transition:enter="fi-transition-enter" |
166 | | - x-transition:leave="fi-transition-leave" |
167 | | - @if ($width !== Width::Screen) |
168 | | - x-transition:enter-start="fi-transition-enter-start" |
169 | | - x-transition:enter-end="fi-transition-enter-end" |
170 | | - x-transition:leave-start="fi-transition-leave-start" |
171 | | - x-transition:leave-end="fi-transition-leave-end" |
172 | | - @endif |
173 | | - @if (filled($wireSubmitHandler)) |
174 | | - wire:submit.prevent="{!! $wireSubmitHandler !!}" |
175 | | - @endif |
176 | | - @if (filled($id)) |
177 | | - wire:key="{{ isset($this) ? "{$this->getId()}." : '' }}modal.{{ $id }}.window" |
178 | | - @endif |
179 | | - {{ |
180 | | - ($extraModalWindowAttributeBag ?? new \Illuminate\View\ComponentAttributeBag)->class([ |
181 | | - 'fi-modal-window', |
182 | | - 'fi-modal-window-has-close-btn' => $closeButton, |
183 | | - 'fi-modal-window-has-content' => $hasContent, |
184 | | - 'fi-modal-window-has-footer' => $hasFooter, |
185 | | - 'fi-modal-window-has-icon' => $hasIcon, |
186 | | - 'fi-hidden' => ! $visible, |
187 | | - ($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : null, |
188 | | - ($width instanceof Width) ? "fi-width-{$width->value}" : (is_string($width) ? $width : null), |
189 | | - ]) |
190 | | - }} |
| 162 | + x-on:keydown.window.escape="if (isTopmost()) {{ $closeEventHandler }}" |
| 163 | + @endif |
| 164 | + x-show="isWindowVisible" |
| 165 | + x-transition:enter="fi-transition-enter" |
| 166 | + x-transition:leave="fi-transition-leave" |
| 167 | + @if ($width !== Width::Screen) |
| 168 | + x-transition:enter-start="fi-transition-enter-start" |
| 169 | + x-transition:enter-end="fi-transition-enter-end" |
| 170 | + x-transition:leave-start="fi-transition-leave-start" |
| 171 | + x-transition:leave-end="fi-transition-leave-end" |
| 172 | + @endif |
| 173 | + @if (filled($wireSubmitHandler)) |
| 174 | + wire:submit.prevent="{!! $wireSubmitHandler !!}" |
| 175 | + @endif |
| 176 | + @if (filled($id)) |
| 177 | + wire:key="{{ isset($this) ? "{$this->getId()}." : '' }}modal.{{ $id }}.window" |
| 178 | + @endif |
| 179 | + {{ |
| 180 | + ($extraModalWindowAttributeBag ?? new \Illuminate\View\ComponentAttributeBag)->class([ |
| 181 | + 'fi-modal-window', |
| 182 | + 'fi-modal-window-has-close-btn' => $closeButton, |
| 183 | + 'fi-modal-window-has-content' => $hasContent, |
| 184 | + 'fi-modal-window-has-footer' => $hasFooter, |
| 185 | + 'fi-modal-window-has-icon' => $hasIcon, |
| 186 | + 'fi-hidden' => ! $visible, |
| 187 | + ($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : null, |
| 188 | + ($width instanceof Width) ? "fi-width-{$width->value}" : (is_string($width) ? $width : null), |
| 189 | + ]) |
| 190 | + }} |
191 | 191 | > |
192 | | - @if ($heading || $header) |
193 | | - <div |
| 192 | + @if ($heading || $header) |
| 193 | + <div |
194 | 194 | @if (filled($id)) |
195 | 195 | wire:key="{{ isset($this) ? "{$this->getId()}." : '' }}modal.{{ $id }}.header" |
196 | 196 | @endif |
197 | 197 | @class([ |
198 | 198 | 'fi-modal-header', |
199 | 199 | 'fi-vertical-align-center' => $hasIcon && $hasHeading && (! $hasDescription) && in_array($alignment, [Alignment::Start, Alignment::Left]), |
200 | 200 | ]) |
201 | | - > |
202 | | - @if ($closeButton) |
203 | | - <x-filament::icon-button |
| 201 | + > |
| 202 | + @if ($closeButton) |
| 203 | + <x-filament::icon-button |
204 | 204 | color="gray" |
205 | 205 | :icon="\Filament\Support\Icons\Heroicon::OutlinedXMark" |
206 | 206 | :icon-alias="\Filament\Support\View\SupportIconAlias::MODAL_CLOSE_BUTTON" |
|
209 | 209 | tabindex="-1" |
210 | 210 | :x-on:click="$closeEventHandler" |
211 | 211 | class="fi-modal-close-btn" |
212 | | - /> |
213 | | - @endif |
| 212 | + /> |
| 213 | + @endif |
214 | 214 |
|
215 | | - @if ($header) |
216 | | - {{ $header }} |
217 | | - @else |
218 | | - @if ($hasIcon) |
219 | | - <div class="fi-modal-icon-ctn"> |
220 | | - <div |
| 215 | + @if ($header) |
| 216 | + {{ $header }} |
| 217 | + @else |
| 218 | + @if ($hasIcon) |
| 219 | + <div class="fi-modal-icon-ctn"> |
| 220 | + <div |
221 | 221 | {{ (new ComponentAttributeBag)->color(IconComponent::class, $iconColor)->class(['fi-modal-icon-bg']) }} |
222 | 222 | > |
223 | 223 | {{ $iconHtml }} |
224 | 224 | </div> |
225 | 225 | </div> |
226 | 226 | @endif |
227 | 227 |
|
228 | | - <div> |
229 | | - <h2 class="fi-modal-heading"> |
230 | | - {{ $heading }} |
231 | | - </h2> |
| 228 | + <div> |
| 229 | + <h2 class="fi-modal-heading"> |
| 230 | + {{ $heading }} |
| 231 | + </h2> |
232 | 232 |
|
233 | | - @if ($hasDescription) |
234 | | - <p class="fi-modal-description"> |
235 | | - {{ $description }} |
236 | | - </p> |
237 | | - @endif |
238 | | - </div> |
239 | | - @endif |
240 | | - </div> |
241 | | - @endif |
| 233 | + @if ($hasDescription) |
| 234 | + <p class="fi-modal-description"> |
| 235 | + {{ $description }} |
| 236 | + </p> |
| 237 | + @endif |
| 238 | + </div> |
| 239 | + @endif |
| 240 | + </div> |
| 241 | + @endif |
242 | 242 |
|
243 | | - @if ($hasContent) |
244 | | - <div |
| 243 | + @if ($hasContent) |
| 244 | + <div |
245 | 245 | @if (filled($id)) |
246 | 246 | wire:key="{{ isset($this) ? "{$this->getId()}." : '' }}modal.{{ $id }}.content" |
247 | 247 | @endif |
248 | 248 | class="fi-modal-content" |
249 | | - > |
250 | | - {{ $slot }} |
251 | | - </div> |
252 | | - @endif |
| 249 | + > |
| 250 | + {{ $slot }} |
| 251 | + </div> |
| 252 | + @endif |
253 | 253 |
|
254 | | - @if ($hasFooter) |
255 | | - <div |
| 254 | + @if ($hasFooter) |
| 255 | + <div |
256 | 256 | @if (filled($id)) |
257 | 257 | wire:key="{{ isset($this) ? "{$this->getId()}." : '' }}modal.{{ $id }}.footer" |
258 | 258 | @endif |
259 | 259 | @class([ |
260 | 260 | 'fi-modal-footer', |
261 | 261 | ($footerActionsAlignment instanceof Alignment) ? "fi-align-{$footerActionsAlignment->value}" : null, |
262 | 262 | ]) |
263 | | - > |
264 | | - @if (! \Filament\Support\is_slot_empty($footer)) |
265 | | - {{ $footer }} |
266 | | - @else |
267 | | - <div class="fi-modal-footer-actions"> |
268 | | - @if (is_array($footerActions)) |
269 | | - @foreach ($footerActions as $action) |
270 | | - {{ $action }} |
271 | | - @endforeach |
272 | | - @else |
273 | | - {{ $footerActions }} |
274 | | - @endif |
275 | | - </div> |
276 | | - @endif |
277 | | - </div> |
278 | | - @endif |
279 | | - </{{ filled($wireSubmitHandler) ? 'form' : 'div' }}> |
280 | | -</div> |
| 263 | + > |
| 264 | + @if (! \Filament\Support\is_slot_empty($footer)) |
| 265 | + {{ $footer }} |
| 266 | + @else |
| 267 | + <div class="fi-modal-footer-actions"> |
| 268 | + @if (is_array($footerActions)) |
| 269 | + @foreach ($footerActions as $action) |
| 270 | + {{ $action }} |
| 271 | + @endforeach |
| 272 | + @else |
| 273 | + {{ $footerActions }} |
| 274 | + @endif |
| 275 | + </div> |
| 276 | + @endif |
| 277 | + </div> |
| 278 | + @endif |
| 279 | + </{{ filled($wireSubmitHandler) ? 'form' : 'div' }}> |
| 280 | + </div> |
281 | 281 | </div> |
282 | 282 |
|
283 | 283 | @if (filled($teleport)) |
|
0 commit comments