File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 9
9
class Modal extends Component
10
10
{
11
11
public function __construct (
12
- public string $ id ,
12
+ public ? string $ id = '' ,
13
13
public ?string $ title = null ,
14
14
public ?string $ subtitle = null ,
15
15
public ?bool $ separator = false ,
@@ -23,7 +23,18 @@ public function __construct(
23
23
public function render (): View |Closure |string
24
24
{
25
25
return <<<'HTML'
26
- <dialog id="{{ $id }}" {{ $attributes->class(["modal"]) }}>
26
+ <dialog
27
+ {{ $attributes->class(["modal"]) }}
28
+
29
+ @if($id)
30
+ id="{{ $id }}"
31
+ @else
32
+ x-data="{open: @entangle($attributes->wire('model')).live }"
33
+ :class="{'modal-open': open}"
34
+ :open="open"
35
+ @keydown.escape.window = "$wire.{{ $attributes->wire('model')->value() }} = false"
36
+ @endif
37
+ >
27
38
<div class="modal-box">
28
39
@if($title)
29
40
<x-header :title="$title" :subtitle="$subtitle" size="text-2xl" :separator="$separator" />
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ public function render(): View|Closure|string
79
79
@endforeach
80
80
</tbody>
81
81
</table>
82
+ @php
83
+ # TODO: workaround for bug when using slot with @scope on tables.
84
+ # It seems it loses start/end context with @scope/@endscope. So I am just placing any hidden component here.
85
+ @endphp
86
+ <x-alert style="display:none" />
82
87
</div>
83
88
HTML;
84
89
}
You can’t perform that action at this time.
0 commit comments