|
2 | 2 | 'side' => 'right',
|
3 | 3 | ])
|
4 | 4 |
|
5 |
| -@php |
6 |
| - $one = match ($side) { |
7 |
| - 'top' => '-translate-y-full', |
8 |
| - 'right' => 'translate-x-full', |
9 |
| - 'bottom' => 'translate-y-full', |
10 |
| - 'left' => '-translate-x-full', |
11 |
| - }; |
| 5 | +@inject('sheet', 'App\Services\DialogCvaService') |
12 | 6 |
|
13 |
| - $two = match ($side) { |
14 |
| - 'top' => '-translate-y-0', |
15 |
| - 'right' => 'translate-x-0', |
16 |
| - 'bottom' => 'translate-y-0', |
17 |
| - 'left' => 'translate-x-0', |
18 |
| - }; |
19 |
| -@endphp |
20 |
| - |
21 |
| -@inject('sheet', 'App\Services\SheetCvaService') |
22 |
| - |
23 |
| -<div @keydown.escape.window="open = false"> |
24 |
| - <template x-teleport="body"> |
25 |
| - <x-sheet.overlay /> |
26 |
| - </template> |
27 |
| - |
28 |
| - <template x-teleport="body"> |
29 |
| - <div |
30 |
| - x-show="open" |
31 |
| - x-transition:enter="transition ease-out duration-500" |
32 |
| - x-transition:enter-start="{{ $one }}" |
33 |
| - x-transition:enter-end="{{ $two }}" |
34 |
| - x-transition:leave="transition ease-in duration-300" |
35 |
| - x-transition:leave-start="{{ $two }}" |
36 |
| - x-transition:leave-end="{{ $one }}" |
37 |
| - {{ $attributes->twMerge($sheet(['side' => $side])) }} |
38 |
| - > |
39 |
| - <x-sheet.close |
40 |
| - variant="icon" |
41 |
| - class="noway absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none" |
42 |
| - > |
43 |
| - <x-lucide-x class="size-4" /> |
44 |
| - </x-sheet.close> |
45 |
| - {{ $slot }} |
46 |
| - </div> |
47 |
| - |
48 |
| - </template> |
49 |
| - |
50 |
| -</div> |
| 7 | +<dialog |
| 8 | + wire:ignore.self |
| 9 | + x-on:cancel="__sheetOpen = false" |
| 10 | + x-trap.noscroll="__sheetOpen" |
| 11 | + x-effect="__sheetOpen ? $el.showModal() : $el.close()" |
| 12 | + {{ $attributes->twMerge($sheet(['side' => $side, 'variant' => 'sheet'])) }} |
| 13 | +> |
| 14 | + <x-sheet.close |
| 15 | + variant="icon" |
| 16 | + class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none" |
| 17 | + > |
| 18 | + <x-lucide-x class="size-4" /> |
| 19 | + </x-sheet.close> |
| 20 | + {{ $slot }} |
| 21 | +</dialog> |
0 commit comments