- Dark indigo header and tinted page background; the mobile main menu gets its own row, in the same order as the keyboard reaches it. - Page titles with an icon chip (x-page-title, x-page, x-page-header) and card sections (x-panel, the card utility); x-table styled as a card with an indigo header row in AppServiceProvider::styleTables(). - Job and task statuses, late work, unapproved hours and stock states as badges with icon and text (x-status-badge, x-jobs.status, x-jobs.task-status), never colour alone. - Empty lists as x-empty-state; dashboard quick link tiles, week hour bars and trend arrows; Kanban columns and task cards edged by status; calendar today column and bar accents; quick sale, reports and machine console restyled; signed-out pages show the app name. - Focus rings use the primary colour in both themes (white in the header). - Document the components in CLAUDE.md; test the status badges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
67 lines
2.5 KiB
PHP
67 lines
2.5 KiB
PHP
{{--
|
|
Tabs after the WAI-ARIA tabs pattern, because TallStackUI's <x-tab> ties its
|
|
panels to ids that do not exist and has no arrow keys. Only the selected tab
|
|
is in the tab order; arrow keys, Home and End move between the tabs and
|
|
select them. Panels are <x-tabs.panel> children with the same id.
|
|
|
|
$tabs: ['key' => 'title', ...] in display order.
|
|
--}}
|
|
@props([
|
|
'id',
|
|
'label',
|
|
'tabs',
|
|
'selected' => null,
|
|
])
|
|
|
|
@php
|
|
$selected ??= array_key_first($tabs);
|
|
@endphp
|
|
|
|
<div
|
|
{{ $attributes->class('space-y-3') }}
|
|
x-data="{
|
|
selected: @js($selected),
|
|
select(key) {
|
|
this.selected = key;
|
|
this.$nextTick(() => document.getElementById(@js($id) + '-tab-' + key)?.focus());
|
|
},
|
|
move(event) {
|
|
const keys = @js(array_keys($tabs));
|
|
const index = keys.indexOf(this.selected);
|
|
const next = { ArrowRight: index + 1, ArrowLeft: index - 1, Home: 0, End: keys.length - 1 }[event.key];
|
|
if (next === undefined) {
|
|
return;
|
|
}
|
|
event.preventDefault();
|
|
this.select(keys[(next + keys.length) % keys.length]);
|
|
},
|
|
}"
|
|
>
|
|
<div
|
|
role="tablist"
|
|
aria-label="{{ $label }}"
|
|
x-on:keydown="move($event)"
|
|
class="flex flex-wrap gap-x-4 gap-y-1 border-b border-zinc-200 dark:border-zinc-700"
|
|
>
|
|
@foreach ($tabs as $key => $title)
|
|
<button
|
|
type="button"
|
|
role="tab"
|
|
id="{{ $id }}-tab-{{ $key }}"
|
|
aria-controls="{{ $id }}-panel-{{ $key }}"
|
|
aria-selected="{{ $key === $selected ? 'true' : 'false' }}"
|
|
tabindex="{{ $key === $selected ? '0' : '-1' }}"
|
|
x-bind:aria-selected="(selected === @js($key)).toString()"
|
|
x-bind:tabindex="selected === @js($key) ? 0 : -1"
|
|
x-on:click="select(@js($key))"
|
|
x-bind:class="selected === @js($key)
|
|
? 'border-primary-700 font-semibold text-zinc-900 dark:border-primary-400 dark:text-white'
|
|
: 'border-transparent text-zinc-700 hover:border-zinc-400 dark:text-zinc-300'"
|
|
class="-mb-px min-h-6 rounded-t-md border-b-2 px-1 py-2 text-left text-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300"
|
|
>{{ $title }}</button>
|
|
@endforeach
|
|
</div>
|
|
|
|
{{ $slot }}
|
|
</div>
|