Files
livewire-material/resources/views/components/supporting-pane.blade.php
T
Andreas Reinhold / reiniandClaude Opus 5 247c596c3a Cut duplicated and speculative code across the package
An over-engineering audit of the whole tree, applied in five reviewed
batches. Behaviour stays the same except where UPGRADE.md says otherwise.

PHP: the showcase and error-page stylesheets are prebuilt into
resources/dist by bin/stylesheets.mjs, through Vite's own postcss-import
(first occurrence kept, the order an application's build gives), instead
of Stylesheets::bundle() inlining imports on every request; only the
import walk DesignGuard needs stays. SchemeStylesheet::withProfiles()
replaces three copies of the scheme-plus-profiles loop, material:scheme
leaves spec and contrast checks to the node script that already made
them, and the error page's scheme cache, the hashed view namespace, the
translations path with no lang/ folder and DesignGuard's 1.x-name hints
are gone.

JS: the androidx shape port progress.js and both bin scripts each carried
lives once in resources/js/shapes.js (the generated SVGs are unchanged);
util.js holds ringIndex(), ms(), reopenGuard() and remember(), which
were written out several times; listeners are released through
AbortController; tooltip.js's hoverPopover() serves the rich tooltip too.

CSS: every rule for an element inside the navigation rail queries
`--md-navigation-rail-value` instead of repeating the seven collapsed
conditions under five media branches; badge, alert, progress, slider and
button read one non-inheriting colour-role table (components/color.css);
the dialog chrome, the submenu's popover chrome, the chip's state layer
and touch target, and the visually-hidden inputs use the shared rules
they copied; foundation/tokens.css is folded into foundation.css.

Views: Support\Field and Support\Link replace the error-key, bound-value
and link-attribute blocks copied into the fields and link components;
the timepicker period group, the menu filter and the showcase head are
partials; the datepicker's steppers and entry fields are loops; component
docblocks no longer restate SKILL.md.

Tests and tooling: one dataset-driven ComponentStylesheetsTest replaces
four per-group files, DesignGuardTest and the layout-component tests use
datasets, browser tests share one ready() helper, CSS parsing lives in
ComponentStylesheet alone. docs/audits and the finding IDs citing it are
removed, as are pestphp/pest-plugin-laravel, the unused composer scripts
and check:font; the lint job runs in the feature job, which now installs
node packages so the prebuilt-stylesheet staleness test runs in CI.

Feature suite 1177 passed, Chrome browser suite 299 passed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 19:29:21 +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([
'data-md-supporting-pane' => true,
'data-md-width' => $layout::choice($width, ['fixed', 'split'], 'fixed'),
'data-md-compact' => $compact,
] + $layout::visibility($hideBelow, $hideFrom));
@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()) { $event.preventDefault(); 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 }}>