|
@@ -1,358 +0,0 @@
|
1
|
|
-@php
|
2
|
|
- use Filament\Support\Enums\Alignment;
|
3
|
|
- use Filament\Support\Enums\MaxWidth;
|
4
|
|
-@endphp
|
5
|
|
-
|
6
|
|
-@props([
|
7
|
|
- 'alignment' => Alignment::Start,
|
8
|
|
- 'ariaLabelledby' => null,
|
9
|
|
- 'closeButton' => \Filament\Support\View\Components\Modal::$hasCloseButton,
|
10
|
|
- 'closeByClickingAway' => \Filament\Support\View\Components\Modal::$isClosedByClickingAway,
|
11
|
|
- 'closeEventName' => 'close-modal',
|
12
|
|
- 'description' => null,
|
13
|
|
- 'displayClasses' => 'inline-block',
|
14
|
|
- 'footer' => null,
|
15
|
|
- 'footerActions' => [],
|
16
|
|
- 'footerActionsAlignment' => Alignment::Start,
|
17
|
|
- 'header' => null,
|
18
|
|
- 'heading' => null,
|
19
|
|
- 'icon' => null,
|
20
|
|
- 'iconAlias' => null,
|
21
|
|
- 'iconColor' => 'primary',
|
22
|
|
- 'id' => null,
|
23
|
|
- 'openEventName' => 'open-modal',
|
24
|
|
- 'slideOver' => false,
|
25
|
|
- 'stickyFooter' => false,
|
26
|
|
- 'stickyHeader' => false,
|
27
|
|
- 'trigger' => null,
|
28
|
|
- 'visible' => true,
|
29
|
|
- 'width' => 'sm',
|
30
|
|
-])
|
31
|
|
-
|
32
|
|
-@php
|
33
|
|
- if (! $alignment instanceof Alignment) {
|
34
|
|
- $alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null;
|
35
|
|
- }
|
36
|
|
-
|
37
|
|
- if (! $footerActionsAlignment instanceof Alignment) {
|
38
|
|
- $footerActionsAlignment = filled($footerActionsAlignment) ? (Alignment::tryFrom($footerActionsAlignment) ?? $footerActionsAlignment) : null;
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- if (! $width instanceof MaxWidth) {
|
42
|
|
- $width = filled($width) ? (MaxWidth::tryFrom($width) ?? $width) : null;
|
43
|
|
- }
|
44
|
|
-
|
45
|
|
- $closeEventHandler = filled($id) ? '$dispatch(' . \Illuminate\Support\Js::from($closeEventName) . ', { id: ' . \Illuminate\Support\Js::from($id) . ' })' : 'close()';
|
46
|
|
-@endphp
|
47
|
|
-
|
48
|
|
-<div
|
49
|
|
- @if ($ariaLabelledby)
|
50
|
|
- aria-labelledby="{{ $ariaLabelledby }}"
|
51
|
|
- @elseif ($heading)
|
52
|
|
- aria-labelledby="{{ "{$id}.heading" }}"
|
53
|
|
- @endif
|
54
|
|
- aria-modal="true"
|
55
|
|
- role="dialog"
|
56
|
|
- x-data="{
|
57
|
|
- isOpen: false,
|
58
|
|
-
|
59
|
|
- livewire: null,
|
60
|
|
-
|
61
|
|
- close: function () {
|
62
|
|
- this.isOpen = false
|
63
|
|
-
|
64
|
|
- this.$refs.modalContainer.dispatchEvent(
|
65
|
|
- new CustomEvent('modal-closed', { id: '{{ $id }}' }),
|
66
|
|
- )
|
67
|
|
-
|
68
|
|
- {{-- this.$nextTick(() => {
|
69
|
|
- if (document.getElementsByClassName('fi-modal-open').length) {
|
70
|
|
- return
|
71
|
|
- }
|
72
|
|
-
|
73
|
|
- window.clearAllBodyScrollLocks()
|
74
|
|
- }) --}}
|
75
|
|
- },
|
76
|
|
-
|
77
|
|
- open: function () {
|
78
|
|
- this.isOpen = true
|
79
|
|
-
|
80
|
|
- {{-- window.clearAllBodyScrollLocks()
|
81
|
|
- window.disableBodyScroll(this.$root) --}}
|
82
|
|
-
|
83
|
|
- this.$refs.modalContainer.dispatchEvent(
|
84
|
|
- new CustomEvent('modal-opened', { id: '{{ $id }}' }),
|
85
|
|
- )
|
86
|
|
- },
|
87
|
|
- }"
|
88
|
|
- @if ($id)
|
89
|
|
- x-on:{{ $closeEventName }}.window="if ($event.detail.id === '{{ $id }}') close()"
|
90
|
|
- x-on:{{ $openEventName }}.window="if ($event.detail.id === '{{ $id }}') open()"
|
91
|
|
- @endif
|
92
|
|
- x-trap.noscroll="isOpen"
|
93
|
|
- x-bind:class="{
|
94
|
|
- 'fi-modal-open': isOpen,
|
95
|
|
- }"
|
96
|
|
- @class([
|
97
|
|
- 'fi-modal',
|
98
|
|
- 'fi-width-screen' => $width === MaxWidth::Screen,
|
99
|
|
- $displayClasses,
|
100
|
|
- ])
|
101
|
|
->
|
102
|
|
- @if ($trigger)
|
103
|
|
- <div
|
104
|
|
- x-on:click="open"
|
105
|
|
- {{ $trigger->attributes->class(['fi-modal-trigger flex cursor-pointer']) }}
|
106
|
|
- >
|
107
|
|
- {{ $trigger }}
|
108
|
|
- </div>
|
109
|
|
- @endif
|
110
|
|
-
|
111
|
|
- <div
|
112
|
|
- x-cloak
|
113
|
|
- x-show="isOpen"
|
114
|
|
- >
|
115
|
|
- <div
|
116
|
|
- aria-hidden="true"
|
117
|
|
- x-show="isOpen"
|
118
|
|
- x-transition.duration.300ms.opacity
|
119
|
|
- @class([
|
120
|
|
- 'fi-modal-close-overlay fixed inset-0 z-40 bg-gray-950/50 dark:bg-gray-950/75',
|
121
|
|
- ])
|
122
|
|
- ></div>
|
123
|
|
-
|
124
|
|
- <div
|
125
|
|
- @class([
|
126
|
|
- 'fixed inset-0 z-40',
|
127
|
|
- 'overflow-hidden' => ! ($slideOver || ($width === MaxWidth::Screen)),
|
128
|
|
- 'cursor-pointer' => $closeByClickingAway,
|
129
|
|
- ])
|
130
|
|
- >
|
131
|
|
- <div
|
132
|
|
- x-ref="modalContainer"
|
133
|
|
- @if ($closeByClickingAway)
|
134
|
|
- x-on:click.self="{{ $closeEventHandler }}"
|
135
|
|
- @endif
|
136
|
|
- {{
|
137
|
|
- $attributes->class([
|
138
|
|
- 'relative min-h-full flex items-start justify-center',
|
139
|
|
- 'mb-auto mt-8 p-4' => ! ($slideOver || ($width === MaxWidth::Screen)),
|
140
|
|
- ])
|
141
|
|
- }}
|
142
|
|
- >
|
143
|
|
- <div
|
144
|
|
- x-data="{ isShown: false }"
|
145
|
|
- x-init="
|
146
|
|
- $nextTick(() => {
|
147
|
|
- isShown = isOpen
|
148
|
|
- $watch('isOpen', () => (isShown = isOpen))
|
149
|
|
- })
|
150
|
|
- "
|
151
|
|
- x-on:keydown.window.escape="{{ $closeEventHandler }}"
|
152
|
|
- x-show="isShown"
|
153
|
|
- x-transition:enter="duration-300"
|
154
|
|
- x-transition:leave="duration-300"
|
155
|
|
- @if ($width === MaxWidth::Screen)
|
156
|
|
- @elseif ($slideOver)
|
157
|
|
- x-transition:enter-start="translate-x-full rtl:-translate-x-full"
|
158
|
|
- x-transition:enter-end="translate-x-0"
|
159
|
|
- x-transition:leave-start="translate-x-0"
|
160
|
|
- x-transition:leave-end="translate-x-full rtl:-translate-x-full"
|
161
|
|
- @else
|
162
|
|
- x-transition:enter-start="scale-95 opacity-0"
|
163
|
|
- x-transition:enter-end="scale-100 opacity-100"
|
164
|
|
- x-transition:leave-start="scale-100 opacity-100"
|
165
|
|
- x-transition:leave-end="scale-95 opacity-0"
|
166
|
|
- @endif
|
167
|
|
- @class([
|
168
|
|
- 'fi-modal-window pointer-events-auto relative 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',
|
169
|
|
- 'fi-modal-slide-over-window ms-auto overflow-y-auto' => $slideOver,
|
170
|
|
- // Using an arbitrary value instead of the h-dvh class that was added in Tailwind CSS v3.4.0
|
171
|
|
- // to ensure compatibility with custom themes that may use an older version of Tailwind CSS.
|
172
|
|
- 'h-[100dvh]' => $slideOver || ($width === MaxWidth::Screen),
|
173
|
|
- 'mx-auto rounded-xl' => ! ($slideOver || ($width === MaxWidth::Screen)),
|
174
|
|
- 'hidden' => ! $visible,
|
175
|
|
- match ($width) {
|
176
|
|
- MaxWidth::ExtraSmall => 'max-w-xs',
|
177
|
|
- MaxWidth::Small => 'max-w-sm',
|
178
|
|
- MaxWidth::Medium => 'max-w-md',
|
179
|
|
- MaxWidth::Large => 'max-w-lg',
|
180
|
|
- MaxWidth::ExtraLarge => 'max-w-xl',
|
181
|
|
- MaxWidth::TwoExtraLarge => 'max-w-2xl',
|
182
|
|
- MaxWidth::ThreeExtraLarge => 'max-w-3xl',
|
183
|
|
- MaxWidth::FourExtraLarge => 'max-w-4xl',
|
184
|
|
- MaxWidth::FiveExtraLarge => 'max-w-5xl',
|
185
|
|
- MaxWidth::SixExtraLarge => 'max-w-6xl',
|
186
|
|
- MaxWidth::SevenExtraLarge => 'max-w-7xl',
|
187
|
|
- MaxWidth::Full => 'max-w-full',
|
188
|
|
- MaxWidth::MinContent => 'max-w-min',
|
189
|
|
- MaxWidth::MaxContent => 'max-w-max',
|
190
|
|
- MaxWidth::FitContent => 'max-w-fit',
|
191
|
|
- MaxWidth::Prose => 'max-w-prose',
|
192
|
|
- MaxWidth::ScreenSmall => 'max-w-screen-sm',
|
193
|
|
- MaxWidth::ScreenMedium => 'max-w-screen-md',
|
194
|
|
- MaxWidth::ScreenLarge => 'max-w-screen-lg',
|
195
|
|
- MaxWidth::ScreenExtraLarge => 'max-w-screen-xl',
|
196
|
|
- MaxWidth::ScreenTwoExtraLarge => 'max-w-screen-2xl',
|
197
|
|
- MaxWidth::Screen => 'fixed inset-0',
|
198
|
|
- default => $width,
|
199
|
|
- },
|
200
|
|
- ])
|
201
|
|
- >
|
202
|
|
- @if ($heading || $header)
|
203
|
|
- <div
|
204
|
|
- @class([
|
205
|
|
- 'fi-modal-header flex px-6 pt-6',
|
206
|
|
- 'fi-sticky sticky top-0 z-10 border-b border-gray-200 bg-white pb-6 dark:border-white/10 dark:bg-gray-900' => $stickyHeader,
|
207
|
|
- 'rounded-t-xl' => $stickyHeader && ! ($slideOver || ($width === MaxWidth::Screen)),
|
208
|
|
- match ($alignment) {
|
209
|
|
- Alignment::Start, Alignment::Left => 'gap-x-5',
|
210
|
|
- Alignment::Center => 'flex-col',
|
211
|
|
- default => null,
|
212
|
|
- },
|
213
|
|
- ])
|
214
|
|
- >
|
215
|
|
- @if ($closeButton)
|
216
|
|
- <div
|
217
|
|
- @class([
|
218
|
|
- 'absolute',
|
219
|
|
- 'end-4 top-4' => ! $slideOver,
|
220
|
|
- 'end-6 top-6' => $slideOver,
|
221
|
|
- ])
|
222
|
|
- >
|
223
|
|
- <x-filament::icon-button
|
224
|
|
- color="gray"
|
225
|
|
- icon="heroicon-o-x-mark"
|
226
|
|
- icon-alias="modal.close-button"
|
227
|
|
- icon-size="lg"
|
228
|
|
- :label="__('filament::components/modal.actions.close.label')"
|
229
|
|
- tabindex="-1"
|
230
|
|
- :x-on:click="$closeEventHandler"
|
231
|
|
- class="fi-modal-close-btn"
|
232
|
|
- />
|
233
|
|
- </div>
|
234
|
|
- @endif
|
235
|
|
-
|
236
|
|
- @if ($header)
|
237
|
|
- {{ $header }}
|
238
|
|
- @else
|
239
|
|
- @if ($icon)
|
240
|
|
- <div
|
241
|
|
- @class([
|
242
|
|
- 'mb-5 flex items-center justify-center' => $alignment === Alignment::Center,
|
243
|
|
- ])
|
244
|
|
- >
|
245
|
|
- <div
|
246
|
|
- @class([
|
247
|
|
- 'rounded-full',
|
248
|
|
- match ($iconColor) {
|
249
|
|
- 'gray' => 'fi-color-gray bg-gray-100 dark:bg-gray-500/20',
|
250
|
|
- default => 'fi-color-custom bg-custom-100 dark:bg-custom-500/20',
|
251
|
|
- },
|
252
|
|
- match ($alignment) {
|
253
|
|
- Alignment::Start, Alignment::Left => 'p-2',
|
254
|
|
- Alignment::Center => 'p-3',
|
255
|
|
- default => null,
|
256
|
|
- },
|
257
|
|
- ])
|
258
|
|
- @style([
|
259
|
|
- \Filament\Support\get_color_css_variables(
|
260
|
|
- $iconColor,
|
261
|
|
- shades: [100, 400, 500, 600],
|
262
|
|
- alias: 'modal.icon',
|
263
|
|
- ) => $iconColor !== 'gray',
|
264
|
|
- ])
|
265
|
|
- >
|
266
|
|
- <x-filament::icon
|
267
|
|
- :alias="$iconAlias"
|
268
|
|
- :icon="$icon"
|
269
|
|
- @class([
|
270
|
|
- 'fi-modal-icon h-6 w-6',
|
271
|
|
- match ($iconColor) {
|
272
|
|
- 'gray' => 'text-gray-500 dark:text-gray-400',
|
273
|
|
- default => 'text-custom-600 dark:text-custom-400',
|
274
|
|
- },
|
275
|
|
- ])
|
276
|
|
- />
|
277
|
|
- </div>
|
278
|
|
- </div>
|
279
|
|
- @endif
|
280
|
|
-
|
281
|
|
- <div
|
282
|
|
- @class([
|
283
|
|
- 'text-center' => $alignment === Alignment::Center,
|
284
|
|
- ])
|
285
|
|
- >
|
286
|
|
- <x-filament::modal.heading>
|
287
|
|
- {{ $heading }}
|
288
|
|
- </x-filament::modal.heading>
|
289
|
|
-
|
290
|
|
- @if (filled($description))
|
291
|
|
- <x-filament::modal.description
|
292
|
|
- class="mt-2"
|
293
|
|
- >
|
294
|
|
- {{ $description }}
|
295
|
|
- </x-filament::modal.description>
|
296
|
|
- @endif
|
297
|
|
- </div>
|
298
|
|
- @endif
|
299
|
|
- </div>
|
300
|
|
- @endif
|
301
|
|
-
|
302
|
|
- @if (! \Filament\Support\is_slot_empty($slot))
|
303
|
|
- <div
|
304
|
|
- @class([
|
305
|
|
- 'fi-modal-content flex flex-col gap-y-4 py-6 overflow-y-auto',
|
306
|
|
- 'max-h-[calc(80vh-4rem)]' => ! ($slideOver || ($width === MaxWidth::Screen)),
|
307
|
|
- 'flex-1' => ($width === MaxWidth::Screen) || $slideOver,
|
308
|
|
- 'pe-6 ps-[5.25rem]' => $icon && ($alignment === Alignment::Start),
|
309
|
|
- 'px-6' => ! ($icon && ($alignment === Alignment::Start)),
|
310
|
|
- ])
|
311
|
|
- >
|
312
|
|
- {{ $slot }}
|
313
|
|
- </div>
|
314
|
|
- @endif
|
315
|
|
-
|
316
|
|
- @if ((! \Filament\Support\is_slot_empty($footer)) || (is_array($footerActions) && count($footerActions)) || (! is_array($footerActions) && (! \Filament\Support\is_slot_empty($footerActions))))
|
317
|
|
- <div
|
318
|
|
- @class([
|
319
|
|
- 'fi-modal-footer w-full',
|
320
|
|
- 'pe-6 ps-[5.25rem]' => $icon && ($alignment === Alignment::Start) && ($footerActionsAlignment !== Alignment::Center) && (! $stickyFooter),
|
321
|
|
- 'px-6' => ! ($icon && ($alignment === Alignment::Start) && ($footerActionsAlignment !== Alignment::Center) && (! $stickyFooter)),
|
322
|
|
- 'fi-sticky sticky bottom-0 border-t border-gray-200 bg-white py-5 dark:border-white/10 dark:bg-gray-900' => $stickyFooter,
|
323
|
|
- 'rounded-b-xl' => $stickyFooter && ! ($slideOver || ($width === MaxWidth::Screen)),
|
324
|
|
- 'pb-6' => ! $stickyFooter,
|
325
|
|
- 'mt-6' => (! $stickyFooter) && \Filament\Support\is_slot_empty($slot),
|
326
|
|
- 'mt-auto' => $slideOver,
|
327
|
|
- ])
|
328
|
|
- >
|
329
|
|
- @if (! \Filament\Support\is_slot_empty($footer))
|
330
|
|
- {{ $footer }}
|
331
|
|
- @else
|
332
|
|
- <div
|
333
|
|
- @class([
|
334
|
|
- 'fi-modal-footer-actions gap-3',
|
335
|
|
- match ($footerActionsAlignment) {
|
336
|
|
- Alignment::Start, Alignment::Left => 'flex flex-wrap items-center',
|
337
|
|
- Alignment::Center => 'flex flex-col-reverse sm:grid sm:grid-cols-[repeat(auto-fit,minmax(0,1fr))]',
|
338
|
|
- Alignment::End, Alignment::Right => 'flex flex-row-reverse flex-wrap items-center',
|
339
|
|
- default => null,
|
340
|
|
- },
|
341
|
|
- ])
|
342
|
|
- >
|
343
|
|
- @if (is_array($footerActions))
|
344
|
|
- @foreach ($footerActions as $action)
|
345
|
|
- {{ $action }}
|
346
|
|
- @endforeach
|
347
|
|
- @else
|
348
|
|
- {{ $footerActions }}
|
349
|
|
- @endif
|
350
|
|
- </div>
|
351
|
|
- @endif
|
352
|
|
- </div>
|
353
|
|
- @endif
|
354
|
|
- </div>
|
355
|
|
- </div>
|
356
|
|
- </div>
|
357
|
|
- </div>
|
358
|
|
-</div>
|