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>
94 lines
4.0 KiB
PHP
94 lines
4.0 KiB
PHP
{{-- A set of M3 chips: a row that wraps, 8px apart, named for screen readers as a group.
|
|
|
|
<x-chip-set label="File types" hint="Show only these" error-field="kinds">
|
|
<x-chip type="filter" label="Photos" value="photos" wire:model.live="kinds" />
|
|
<x-chip type="filter" label="Documents" value="documents" wire:model.live="kinds" />
|
|
</x-chip-set>
|
|
|
|
`label` is shown above the row and names the group; without it, pass `aria-label`. `hint`
|
|
sits under it, and a validation message for `error-field` (the property the chips bind, and
|
|
its items: `kinds` and `kinds.*`) replaces the hint.
|
|
|
|
`scroll` keeps the chips on one line that scrolls sideways, as M3 lays chips out on a narrow
|
|
screen. M3's chips accessibility page asks that a row which overflows say so, so the edge it
|
|
can still scroll towards fades (resources/js/chips.js) and, where the pointer is fine and
|
|
there is no swipe to reach for, a button sits over each fading edge and scrolls the row by
|
|
most of its width. The buttons are pointer affordances only — `tabindex="-1"` and
|
|
`aria-hidden`, because the arrow keys already walk every chip and scroll each one clear of
|
|
the fade. Removing a focused input chip moves focus within the set.
|
|
|
|
The set is one tab stop and the arrow keys move between the chips inside it, with Home and End
|
|
at the ends — M3's chip keyboard table. Backspace and Delete still remove a focused input
|
|
chip.
|
|
|
|
The root renders `data-md-chip-set` (and `data-md-scroll`), the row `data-md-chip-set-row`, which
|
|
resources/js/chips.js marks `data-md-scroll-start` and `data-md-scroll-end`; the drawing is
|
|
resources/css/components/chip-set.css. `class` and every other attribute land on the root. --}}
|
|
|
|
@props([
|
|
'label' => null,
|
|
'hint' => null,
|
|
'errorField' => null,
|
|
'scroll' => false,
|
|
])
|
|
|
|
@php
|
|
$key = \Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(10));
|
|
$messages = \NoNameWeb\LivewireMaterial\Support\Field::messages($errors ?? null, filled($errorField) ? $errorField : null, wildcard: true);
|
|
$describedBy = $messages !== [] || filled($hint) ? "material-chip-set-{$key}-hint" : null;
|
|
@endphp
|
|
|
|
<div
|
|
data-md-chip-set
|
|
@if ($scroll) data-md-scroll @endif
|
|
role="group"
|
|
@if (filled($label)) aria-labelledby="material-chip-set-{{ $key }}-label" @endif
|
|
@if ($describedBy) aria-describedby="{{ $describedBy }}" @endif
|
|
{{ $attributes }}
|
|
>
|
|
@if (filled($label))
|
|
<p id="material-chip-set-{{ $key }}-label" data-md-chip-set-label>{{ $label }}</p>
|
|
@endif
|
|
|
|
@if ($scroll)
|
|
<div x-data="materialChipSet" data-md-chip-set-scroller>
|
|
<div
|
|
data-md-chip-set-row
|
|
x-ref="row"
|
|
x-on:keydown="key($event)"
|
|
x-on:focusin="rove($event.target)"
|
|
wire:ignore.self
|
|
>
|
|
{{ $slot }}
|
|
</div>
|
|
|
|
{{-- After the row, so each button can ask whether the row can still scroll its way. --}}
|
|
@foreach (['start' => 'chevron_left', 'end' => 'chevron_right'] as $edge => $glyph)
|
|
<button
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
data-md-chip-scroll="{{ $edge }}"
|
|
x-on:click="nudge('{{ $edge }}')"
|
|
>
|
|
<x-livewire-material::icon :name="$glyph" size="18" mirror-rtl />
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<div data-md-chip-set-row x-data="materialChipSet" x-on:keydown="key($event)" x-on:focusin="rove($event.target)">
|
|
{{ $slot }}
|
|
</div>
|
|
@endif
|
|
|
|
@if ($messages !== [])
|
|
<div id="{{ $describedBy }}" data-md-chip-set-errors>
|
|
@foreach ($messages as $message)
|
|
<p>{{ $message }}</p>
|
|
@endforeach
|
|
</div>
|
|
@elseif (filled($hint))
|
|
<p id="{{ $describedBy }}" data-md-chip-set-hint>{{ $hint }}</p>
|
|
@endif
|
|
</div>
|