Files
livewire-material/resources/views/components/supporting-pane.blade.php
T
Andreas Reinhold / reiniandClaude Opus 5 9eb06323aa Add the supporting-pane canonical layout
Plan step 35: <x-supporting-pane>, following the reference's placement
table - below the focus pane below expanded, beside it from 840px at a
fixed 360px (412px from large) or the two-thirds split. Below expanded
compact="sheet" docks the supporting pane as a bottom sheet whose drag
handle opens it; always on the trailing side, so focus order matches the
panes on screen, and mirrored in RTL.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
2026-09-14 14:51:22 +02:00

93 lines
4.6 KiB
PHP

{{-- M3's supporting-pane canonical layout: a focus pane, and beside it what only means something
in relation to it — the comments on a document, the details of a video.
<x-supporting-pane label="Comments" compact="sheet">
<x-slot:main><x-pane title="Proposal">…</x-pane></x-slot:main>
<x-slot:supporting><x-pane title="Comments" heading="h2">…</x-pane></x-slot:supporting>
</x-supporting-pane>
M3's placement table, row by row (docs/reference/m3/foundations-supplement.md § Canonical
layouts Supporting pane): below the focus pane at a flexible width on a compact or medium
window (below 840px), and at the side of the focus pane, a fixed 360dp, from expanded (840px).
If the relationship is parent and child a list and what it selected use `<x-list-detail>`.
`width`, from 840px: `fixed` (the default) is 360px, and 412px from 1200px, M3's fixed pane at
large and extra-large (§ Breakpoints); `split` gives the focus pane two-thirds and the
supporting pane the other third, the overview's split. Always on the trailing side, 24px from
the focus pane, which keeps the focus order the order on screen at every width, as M3 asks of
panes side by side (docs/reference/m3/foundations.md § Layout Scaffold, Panes); a
right-to-left document mirrors it.
`compact`, below 840px: `below` (the default) stacks the supporting pane under the focus pane;
`sheet` docks it to the bottom of the window as a bottom sheet M3's compact advice, "a
bottom sheet is a good way to keep focus on the primary pane while still giving access to
supporting info". The sheet shows its drag handle and `label` until the handle, a button
(`aria-expanded`), opens it; open, its content scrolls within half the window, and Escape
inside it closes it and returns focus to the handle. It clears a navigation bar and the
bottom safe area. From 840px the sheet is the side pane again, open.
`main` (or the default slot) is the focus pane, `supporting` the supporting one; `label`
names the supporting pane, an `<aside>`, and the sheet's handle. The
layout keeps M3's margin (16px below medium, 24px from it) unless it sits inside something
that already does, such as `<x-scaffold>`'s content region. It takes `as`, `hide-below` and
`hide-from` like every layout component, and the caller's `class` and `style` land on it
untouched. Drawn by resources/css/layout/supporting-pane.css. --}}
@props([
'as' => null,
'label' => null,
'width' => null,
'compact' => null,
'hideBelow' => null,
'hideFrom' => null,
])
@php
$layout = \NoNameWeb\LivewireMaterial\Support\Layout::class;
$element = $layout::element($as);
$compact = $layout::choice($compact, ['below', 'sheet'], 'below');
$sheet = $compact === 'sheet';
$body = 'material-supporting-pane-'.\Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(10));
$attributes = $attributes->merge(array_filter([
'data-md-supporting-pane' => true,
'data-md-width' => $layout::choice($width, ['fixed', 'split'], 'fixed'),
'data-md-compact' => $compact,
] + $layout::visibility($hideBelow, $hideFrom), fn ($value): bool => $value !== null));
@endphp
<{{ $element }} {{ $attributes }}>
<div data-md-supporting-pane-main>{{ $main ?? $slot }}</div>
<aside
data-md-supporting-pane-supporting
@if (filled($label)) aria-label="{{ $label }}" @endif
@if ($sheet)
x-data="{ sheetOpen: false }"
x-bind:data-md-open="sheetOpen ? '' : null"
x-on:keydown.escape="if (sheetOpen && $refs.handle.checkVisibility()) { sheetOpen = false; $refs.handle.focus() }"
@endif
>
@if ($sheet)
<button
type="button"
class="md-state-layer md-focus-ring"
data-md-supporting-pane-handle
aria-expanded="false"
aria-controls="{{ $body }}"
x-ref="handle"
x-bind:aria-expanded="sheetOpen.toString()"
x-on:click="sheetOpen = ! sheetOpen"
@if (blank($label)) aria-label="{{ __('Show more') }}" @endif
>
<span data-md-supporting-pane-grip aria-hidden="true"></span>
@if (filled($label))
<span class="md-type-title-sm" data-md-supporting-pane-label>{{ $label }}</span>
@endif
</button>
@endif
<div data-md-supporting-pane-body id="{{ $body }}">{{ $supporting ?? '' }}</div>
</aside>
</{{ $element }}>