{{-- An M3 dialog, on the native `` opened with `showModal()`. Native because it gets the hard parts right on its own: the top layer above everything, the rest of the page inert, focus moved in and handed back, Escape. The open state is the Livewire property in `wire:model` (entangled live) — a flag (`$confirmingDelete`) or an id (`$deletingShareId`) — and closing writes back whichever "closed" means for it, `false` or `null`. Without `wire:model` it reads and writes `open` in the Alpine scope around it:
`wire:ignore.self`, because `showModal()` sets the `open` attribute, which the server's HTML does not have: without it the next Livewire render morphs the attribute away and the dialog shuts under the person using it. The contents still morph. M3's basic dialog (DialogTokens, androidx Compose Material 3, Apache-2.0): surface-container- high, extra-large corner, elevation 3, a headline-small `title`, body-medium `subtitle` in on-surface-variant, and the `actions` slot at the end. `icon` puts a secondary-coloured icon above a centred title, as M3 draws a dialog with a hero icon. `fullscreen` makes a dialog that holds a form take the whole screen below `sm`, with a close button and the title in a top bar clear of the notch. `persistent` ignores Escape and the scrim, for a dialog that must be answered. It opens on the fast spatial spring and closes at once, as M3's do. --}} @props([ 'title' => null, 'subtitle' => null, 'icon' => null, 'separator' => false, 'persistent' => false, 'fullscreen' => false, 'boxClass' => null, ]) @php $model = $attributes->wire('model')->value() ?: null; $id = $attributes->get('id') ?? 'material-dialog-'.substr(md5($model.'|'.$title), 0, 10); @endphp whereDoesntStartWith('wire:model')->except(['id', 'class'])->merge(['id' => $id]) }} @class([ 'm-auto max-h-[calc(100dvh-3rem)] w-[calc(100vw-3rem)] max-w-[35rem] min-w-70 overflow-visible bg-transparent p-0 text-on-surface', 'backdrop:bg-scrim/32', 'opacity-100 scale-100 starting:opacity-0 starting:scale-95 transition-[opacity,scale] duration-(--md-sys-motion-spatial-fast-duration) ease-spatial-fast', 'max-sm:m-0 max-sm:h-dvh max-sm:max-h-none max-sm:w-full max-sm:max-w-none max-sm:min-w-0' => $fullscreen, $attributes->get('class'), ]) >
$fullscreen, $boxClass, ])> @if ($fullscreen)
@if (filled($title)) {{ $title }} @endif
@endif
$fullscreen])> @if (filled($title) || $icon)
$fullscreen && ! $icon, 'text-center' => $icon])> @if ($icon) @endif @if (filled($title))

{{ $title }}

@endif @if (filled($subtitle))

{{ $subtitle }}

@endif @if ($separator) @endif
@endif
{{ $slot }}
@isset($actions)
$fullscreen, ])> {{ $actions }}
@endisset