{{-- One tab's panel, inside ``, which draws the bar from its own `tabs` list. Shown while its `name` is the chosen one; every panel is rendered, so switching never waits on the server. The id and the `hidden` panels come from the server, not from Alpine: until Alpine boots, every panel would otherwise be on screen at once — four `role="tabpanel"` regions for a screen reader to walk — and the tab buttons' `aria-controls` would point at nothing. `` renders this slot before its own view, so it cannot hand the panel anything; the panel reads `tabs`, `id` and `selected` off the component stack with `@aware` and rebuilds tabs.blade.php's id and initial tab from them (Support\Field::bound for the initial, since `wire:model` is not a `@props` value `@aware` can read). The two must agree, so change them together. The panel renders `data-md-tab-panel`, drawn by resources/css/components/tabs.css. --}} @props([ 'name', ]) @aware([ 'tabs' => [], 'id' => null, 'selected' => null, ]) @php $field = \NoNameWeb\LivewireMaterial\Support\Field::class; // `wire:model` is a key, not a prop, so `@aware` cannot read it; its modifiers are part of the // key too — the spellings that make sense on a tab set. An exotic one only means the panel // falls back to the first tab. $model = collect(['wire:model', 'wire:model.live', 'wire:model.blur', 'wire:model.change', 'wire:model.lazy']) ->map(fn (string $key) => $__env->getConsumableComponentData($key)) ->first(fn ($value): bool => filled($value)); $tabsId = $id ?? 'tabs-'.substr(md5($model.'|'.implode('|', array_column($tabs, 'name'))), 0, 8); $initial = $selected ?? (collect($tabs)->first(fn (array $tab): bool => ! ($tab['disabled'] ?? false))['name'] ?? null); $initial = $field::bound($model, $initial, requireFilled: true); @endphp