Replace Flux UI with TallStackUI 4
Rewrite the layout and all Customers and Users pages with TallStackUI components and remove livewire/flux and its Boost skill. Fix the TallStackUI accessibility gaps found by the axe tests: - password reveal and theme switch have no accessible name: add <x-password-field> and keep the own theme toggle button - select.native label is not tied to the control: add aria-label - contrast: darker primary palette, soft-customized error colours and published alert/link colour classes; neutral buttons use subtle black - follow the system theme by default (localStorage key dark-theme) Load TallStackUI assets from the app URL so they work in the XAMPP subfolder, add Finnish TallStackUI strings, and drop inputmode=numeric from the business ID field so iOS keyboards show the hyphen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+16
-12
@@ -1,25 +1,29 @@
|
||||
@import 'tailwindcss';
|
||||
@import '../../vendor/livewire/flux/dist/flux.css';
|
||||
@import '../../vendor/tallstackui/tallstackui/css/v4.css';
|
||||
|
||||
@plugin '@tailwindcss/forms';
|
||||
|
||||
@source '../../vendor/tallstackui/tallstackui/**/*.php';
|
||||
@source '../views';
|
||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||
@source '../../storage/framework/views/*.php';
|
||||
@source '../../app/Modules/**/*.blade.php';
|
||||
@source '../../app/Providers/*.php';
|
||||
@source '../../app/View/**/*.php';
|
||||
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
@theme {
|
||||
--font-sans: Inter, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
}
|
||||
|
||||
/*
|
||||
* Flux error messages use red-500, which is only 3.8:1 on white.
|
||||
* WCAG 2.2 AA needs 4.5:1 for text, so use darker red in light mode.
|
||||
*/
|
||||
[data-flux-error] {
|
||||
color: var(--color-red-700);
|
||||
}
|
||||
|
||||
.dark [data-flux-error] {
|
||||
color: var(--color-red-400);
|
||||
/*
|
||||
* TallStackUI's primary is indigo with solid buttons on primary-500, which
|
||||
* is only 4.0:1 with their light text. WCAG 2.2 AA needs 4.5:1, so the
|
||||
* shades from 500 up are moved one step darker.
|
||||
*/
|
||||
--color-primary-500: #4f46e5;
|
||||
--color-primary-600: #4338ca;
|
||||
--color-primary-700: #3730a3;
|
||||
--color-primary-800: #312e81;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{{--
|
||||
Password input with an accessible show/hide button.
|
||||
|
||||
Not <x-password />: TallStackUI's reveal button has no accessible name
|
||||
(WCAG 4.1.2), and soft customization cannot add one. The button keeps the
|
||||
stable name "Näytä salasana"; aria-pressed tells whether it is shown.
|
||||
--}}
|
||||
@props([
|
||||
'label',
|
||||
'hint' => null,
|
||||
])
|
||||
|
||||
<div x-data="{ shown: false }">
|
||||
<x-input
|
||||
:attributes="$attributes"
|
||||
:label="$label"
|
||||
:hint="$hint"
|
||||
type="password"
|
||||
x-bind:type="shown ? 'text' : 'password'"
|
||||
>
|
||||
<x-slot:suffix>
|
||||
<button
|
||||
type="button"
|
||||
x-on:click="shown = ! shown"
|
||||
x-bind:aria-pressed="shown ? 'true' : 'false'"
|
||||
aria-label="{{ __('auth.show_password') }}"
|
||||
class="flex size-8 items-center justify-center rounded-md text-zinc-600 hover:text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:text-zinc-300 dark:hover:text-white"
|
||||
>
|
||||
<x-icon name="eye" class="size-5" x-show="! shown" aria-hidden="true" />
|
||||
<x-icon name="eye-slash" class="size-5" x-show="shown" x-cloak aria-hidden="true" />
|
||||
</button>
|
||||
</x-slot:suffix>
|
||||
</x-input>
|
||||
</div>
|
||||
@@ -1,20 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<html
|
||||
lang="{{ str_replace('_', '-', app()->getLocale()) }}"
|
||||
x-data="tallstackui_darkTheme({ default: 'system' })"
|
||||
x-bind:class="{ 'dark': darkTheme }"
|
||||
>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>{{ $title ?? config('app.name') }}</title>
|
||||
|
||||
{{--
|
||||
Apply the stored theme before the first paint. TallStackUI's
|
||||
tallstackui_darkTheme() keeps it in localStorage ("dark-theme"),
|
||||
but only runs once Alpine starts, which would flash the light theme.
|
||||
--}}
|
||||
<script>
|
||||
(() => {
|
||||
const stored = localStorage.getItem('dark-theme');
|
||||
const dark = stored === 'dark' || stored === 'true'
|
||||
|| ((stored === null || stored === 'system') && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
document.documentElement.classList.toggle('dark', dark);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=inter:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
|
||||
@include('partials.tallstackui-script')
|
||||
@livewireStyles
|
||||
@fluxAppearance
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
</head>
|
||||
<body class="min-h-screen bg-white antialiased dark:bg-zinc-800">
|
||||
<body class="min-h-screen bg-white text-zinc-900 antialiased dark:bg-zinc-800 dark:text-zinc-100">
|
||||
<a
|
||||
href="#main-content"
|
||||
class="sr-only focus:not-sr-only focus:fixed focus:start-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-white focus:px-4 focus:py-2 focus:text-zinc-900 focus:shadow-lg focus:outline-2 focus:outline-offset-2 focus:outline-blue-700"
|
||||
@@ -25,32 +42,26 @@
|
||||
@auth
|
||||
<header class="border-b border-zinc-200 dark:border-zinc-700">
|
||||
<div class="mx-auto flex max-w-5xl flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3 sm:px-6">
|
||||
<flux:link :href="route('home')" wire:navigate variant="subtle" class="font-semibold">
|
||||
<a href="{{ route('home') }}" wire:navigate class="rounded font-semibold text-zinc-700 hover:text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:text-zinc-200 dark:hover:text-white">
|
||||
{{ config('app.name') }}
|
||||
</flux:link>
|
||||
</a>
|
||||
|
||||
<flux:navbar :aria-label="__('layout.main_menu')" class="flex-1 py-0">
|
||||
<flux:navbar.item :href="route('customers.index')" :current="request()->routeIs('customers.*')" wire:navigate>
|
||||
{{ __('layout.customers') }}
|
||||
</flux:navbar.item>
|
||||
<nav aria-label="{{ __('layout.main_menu') }}" class="flex flex-1 flex-wrap items-center gap-1">
|
||||
@include('partials.nav-item', ['route' => 'customers.index', 'pattern' => 'customers.*', 'label' => __('layout.customers')])
|
||||
|
||||
@can('users.manage')
|
||||
<flux:navbar.item :href="route('users.index')" :current="request()->routeIs('users.*')" wire:navigate>
|
||||
{{ __('layout.users') }}
|
||||
</flux:navbar.item>
|
||||
@include('partials.nav-item', ['route' => 'users.index', 'pattern' => 'users.*', 'label' => __('layout.users')])
|
||||
@endcan
|
||||
</flux:navbar>
|
||||
</nav>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<flux:text size="sm">{{ __('layout.signed_in_as', ['name' => auth()->user()->name]) }}</flux:text>
|
||||
<span class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('layout.signed_in_as', ['name' => auth()->user()->name]) }}</span>
|
||||
|
||||
@include('partials.theme-toggle')
|
||||
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<flux:button type="submit" variant="ghost" size="sm" icon="arrow-right-start-on-rectangle">
|
||||
{{ __('layout.logout') }}
|
||||
</flux:button>
|
||||
<x-button submit subtle color="black" sm icon="arrow-right-start-on-rectangle" :text="__('layout.logout')" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,6 +77,5 @@
|
||||
</main>
|
||||
|
||||
@livewireScripts
|
||||
@fluxScripts
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -15,15 +15,13 @@ new #[Title('Toiminnanohjaus')] class extends Component
|
||||
?>
|
||||
|
||||
<div class="mx-auto max-w-xl space-y-6 p-6">
|
||||
<flux:heading size="xl" level="1">Toiminnanohjaus</flux:heading>
|
||||
<h1 class="text-2xl font-semibold">Toiminnanohjaus</h1>
|
||||
|
||||
<flux:text>Livewire ja Flux UI toimivat. Tämä on väliaikainen kokeilusivu.</flux:text>
|
||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">Livewire ja TallStackUI toimivat. Tämä on väliaikainen kokeilusivu.</p>
|
||||
|
||||
<flux:button variant="primary" icon="plus" wire:click="incrementClickCount">
|
||||
Lisää klikkaus
|
||||
</flux:button>
|
||||
<x-button icon="plus" wire:click="incrementClickCount" text="Lisää klikkaus" />
|
||||
|
||||
<flux:text role="status" aria-live="polite" aria-atomic="true">
|
||||
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm">
|
||||
Klikattu {{ $clickCount }} kertaa
|
||||
</flux:text>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{{-- Main menu link. The current page is marked with aria-current and an underline, not colour alone. --}}
|
||||
@php($current = request()->routeIs($pattern))
|
||||
|
||||
<a
|
||||
href="{{ route($route) }}"
|
||||
wire:navigate
|
||||
@if ($current) aria-current="page" @endif
|
||||
@class([
|
||||
'rounded-md px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700',
|
||||
'text-zinc-900 underline decoration-2 underline-offset-8 dark:text-white' => $current,
|
||||
'text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white' => ! $current,
|
||||
])
|
||||
>
|
||||
{{ $label }}
|
||||
</a>
|
||||
@@ -0,0 +1,11 @@
|
||||
{{--
|
||||
TallStackUI's <tallstackui:script /> writes root-relative URLs
|
||||
("/tallstackui/script/..."), which 404 when the app runs in a subfolder,
|
||||
as it does locally under XAMPP (/toiminnanohjaus/public). Prefix them with
|
||||
the app's own URL so the assets load in both setups.
|
||||
--}}
|
||||
{!! str_replace(
|
||||
['"/tallstackui/script/', '"/tallstackui/style/'],
|
||||
['"'.url('tallstackui/script').'/', '"'.url('tallstackui/style').'/'],
|
||||
\TallStackUi\Facades\TallStackUi::directives()->script(),
|
||||
) !!}
|
||||
@@ -1,19 +1,21 @@
|
||||
{{--
|
||||
Light/dark theme toggle. Flux stores the choice in localStorage
|
||||
("flux.appearance") and @fluxAppearance applies it before the page paints.
|
||||
Light/dark theme toggle. It drives the tallstackui_darkTheme() state on
|
||||
<html>, which stores the choice in localStorage ("dark-theme"); the
|
||||
inline script in the layout applies it before the first paint.
|
||||
|
||||
Not <x-theme-switch />: its role="switch" button has no accessible name.
|
||||
The name stays "Tumma teema"; aria-pressed tells whether it is on.
|
||||
--}}
|
||||
<flux:button
|
||||
x-data
|
||||
x-on:click="$flux.dark = ! $flux.dark"
|
||||
x-bind:aria-pressed="$flux.dark ? 'true' : 'false'"
|
||||
<x-button.circle
|
||||
x-on:click="mode = darkTheme ? 'light' : 'dark'"
|
||||
x-bind:aria-pressed="darkTheme ? 'true' : 'false'"
|
||||
aria-label="{{ __('layout.theme_toggle') }}"
|
||||
:tooltip="__('layout.theme_toggle')"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
square
|
||||
color="black"
|
||||
subtle
|
||||
sm
|
||||
data-theme-toggle
|
||||
>
|
||||
<flux:icon.moon variant="mini" class="dark:hidden" aria-hidden="true" />
|
||||
<flux:icon.sun variant="mini" class="hidden dark:block" aria-hidden="true" />
|
||||
</flux:button>
|
||||
<x-icon name="moon" class="size-5 dark:hidden" aria-hidden="true" />
|
||||
<x-icon name="sun" class="hidden size-5 dark:block" aria-hidden="true" />
|
||||
</x-button.circle>
|
||||
|
||||
Reference in New Issue
Block a user