- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals. - Updated various modal button styles for consistency and improved accessibility. - Adjusted transition durations for modal animations to enhance user experience. - Added aria-labels to close buttons for better screen reader support.
110 lines
5.1 KiB
PHP
110 lines
5.1 KiB
PHP
{{--
|
|
Section Header Component - AdminLTE style
|
|
|
|
Usage:
|
|
<x-proxmox::ui.section-header title="Section Title" />
|
|
<x-proxmox::ui.section-header title="Title" subtitle="Subtitle" icon="ri-server-line">
|
|
<x-slot:actions>
|
|
<x-proxmox::ui.button>Action</x-proxmox::ui.button>
|
|
</x-slot:actions>
|
|
</x-proxmox::ui.section-header>
|
|
--}}
|
|
|
|
@props([
|
|
'title',
|
|
'subtitle' => null,
|
|
'icon' => null,
|
|
'iconColor' => null,
|
|
'actions' => null,
|
|
'helpText' => null,
|
|
'size' => 'lg',
|
|
])
|
|
|
|
@php
|
|
$titleSizes = [
|
|
'sm' => 'font-size: .875rem; font-weight: 600;',
|
|
'md' => 'font-size: 1rem; font-weight: 600;',
|
|
'lg' => 'font-size: 1.125rem; font-weight: 600;',
|
|
'xl' => 'font-size: 1.25rem; font-weight: 700;',
|
|
];
|
|
$titleStyle = $titleSizes[$size] ?? $titleSizes['lg'];
|
|
@endphp
|
|
|
|
<div {{ $attributes->class(['flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between group']) }}>
|
|
<div class="flex items-start gap-3.5">
|
|
@if($icon)
|
|
<div class="flex items-center justify-center w-11 h-11 flex-shrink-0 rounded-lg bg-primary/10 transition-transform duration-300 group-hover:scale-105">
|
|
<x-dynamic-component :component="$icon" class="size-5 text-primary transition-colors duration-200" />
|
|
</div>
|
|
@endif
|
|
<div class="flex flex-col gap-1">
|
|
<div class="flex min-w-0 items-center gap-2">
|
|
<h2 class="text-xl font-semibold" style="{{ $titleStyle }}">{{ $title }}</h2>
|
|
@if($helpText)
|
|
<div class="relative" x-data="{ open: false }" x-cloak>
|
|
<button
|
|
type="button"
|
|
@click="open = true"
|
|
class="text-base/50 hover:text-base/70 transition-colors"
|
|
>
|
|
<x-ri-question-line class="size-4.5" />
|
|
</button>
|
|
{{-- Help Modal --}}
|
|
<div
|
|
x-show="open"
|
|
x-transition:enter="transition ease-out duration-300"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition ease-in duration-200"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
@click="open = false"
|
|
@keydown.escape.window="open = false"
|
|
class="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"
|
|
style="display: none;"
|
|
></div>
|
|
<div
|
|
x-show="open"
|
|
x-transition:enter="transition ease-out duration-300"
|
|
x-transition:enter-start="opacity-0 scale-95 translate-y-4"
|
|
x-transition:enter-end="opacity-100 scale-100 translate-y-0"
|
|
x-transition:leave="transition ease-in duration-200"
|
|
x-transition:leave-start="opacity-100 scale-100 translate-y-0"
|
|
x-transition:leave-end="opacity-0 scale-95 translate-y-4"
|
|
@click.self="open = false"
|
|
class="fixed inset-0 z-50 flex items-center justify-center p-4"
|
|
style="display: none;"
|
|
>
|
|
<div class="relative w-full max-w-2xl max-h-[90vh] overflow-y-auto bg-background-secondary rounded-xl border border-neutral/20 shadow-2xl p-6">
|
|
<button @click="open = false" class="absolute top-4 right-4 text-base/50 hover:text-base transition-colors">
|
|
<x-ri-close-line class="size-5" />
|
|
</button>
|
|
<div class="flex items-center gap-3 mb-4 pr-8">
|
|
@if($icon)
|
|
<div class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">
|
|
<x-dynamic-component :component="$icon" class="size-5 text-primary" />
|
|
</div>
|
|
@endif
|
|
<h6 class="font-sans text-lg font-semibold leading-tight">{{ $title }}</h6>
|
|
</div>
|
|
<p class="block font-sans text-sm font-normal leading-relaxed text-base/75">
|
|
{{ $helpText }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@if($subtitle)
|
|
<p class="text-sm text-base/60">{{ $subtitle }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
@if($actions)
|
|
<div class="flex flex-shrink-0 items-center gap-3">
|
|
{{ $actions }}
|
|
</div>
|
|
@endif
|
|
</div>
|