Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/tabs.blade.php
Joseph.Rawlings af62a16354 Refactor modal close behavior and improve styling
- 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.
2026-02-23 20:02:41 -05:00

108 lines
5.0 KiB
PHP

{{--
Tabs Component - LucentUI Theme
Migrated from AdminLTE to Tailwind
Usage:
<x-proxmox::ui.tabs :tabs="['Overview', 'Settings', 'Logs']" active="Overview">
<x-proxmox::ui.tab-panel name="Overview">Overview content</x-proxmox::ui.tab-panel>
<x-proxmox::ui.tab-panel name="Settings">Settings content</x-proxmox::ui.tab-panel>
<x-proxmox::ui.tab-panel name="Logs">Logs content</x-proxmox::ui.tab-panel>
</x-proxmox::ui.tabs>
--}}
@props([
'tabs' => [],
'active' => null,
'variant' => 'default',
])
@php
$activeTab = $active ?? ($tabs[0] ?? null);
@endphp
<div
x-data="{ activeTab: '{{ $activeTab }}' }"
{{ $attributes }}
>
{{-- Tab Navigation --}}
@if($variant === 'pills')
<div class="flex flex-wrap gap-1 p-1 bg-background-secondary rounded-lg border border-neutral">
@elseif($variant === 'buttons')
<div class="flex gap-2">
@else
<ul class="flex flex-wrap list-none border-b border-neutral">
@endif
@foreach($tabs as $tab)
@php
$tabName = is_array($tab) ? ($tab['name'] ?? $tab['label'] ?? '') : $tab;
$tabLabel = is_array($tab) ? ($tab['label'] ?? $tab['name'] ?? '') : $tab;
$tabIcon = is_array($tab) ? ($tab['icon'] ?? null) : null;
$tabBadge = is_array($tab) ? ($tab['badge'] ?? null) : null;
@endphp
@if($variant === 'pills')
<button
type="button"
@click="activeTab = '{{ $tabName }}'"
:class="activeTab === '{{ $tabName }}'
? 'text-primary bg-background dark:bg-background-secondary shadow-sm'
: 'text-secondary dark:text-base/50 hover:text-primary hover:bg-black/5 dark:hover:bg-white/5'"
class="flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 cursor-pointer"
>
@if($tabIcon)
<x-dynamic-component :component="$tabIcon" class="size-4" />
@endif
<span>{{ $tabLabel }}</span>
@if($tabBadge)
<span class="inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold text-primary bg-primary/10 rounded-full">{{ $tabBadge }}</span>
@endif
</button>
@elseif($variant === 'buttons')
<button
type="button"
@click="activeTab = '{{ $tabName }}'"
:class="activeTab === '{{ $tabName }}'
? 'text-white bg-primary border-primary'
: 'text-secondary dark:text-base/50 bg-background dark:bg-background-secondary border-neutral dark:border-neutral hover:bg-background-secondary dark:hover:bg-background hover:border-primary/30'"
class="flex items-center gap-2 px-4 py-2.5 text-sm font-medium border rounded-lg shadow-sm transition-all duration-200 cursor-pointer"
>
@if($tabIcon)
<x-dynamic-component :component="$tabIcon" class="size-4" />
@endif
<span>{{ $tabLabel }}</span>
@if($tabBadge)
<span class="inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold text-primary bg-primary/10 rounded-full">{{ $tabBadge }}</span>
@endif
</button>
@else
<li class="-mb-px">
<button
type="button"
@click="activeTab = '{{ $tabName }}'"
:class="activeTab === '{{ $tabName }}'
? 'text-primary bg-background dark:bg-background-secondary border-neutral dark:border-neutral border-b-background dark:border-b-background-secondary'
: 'text-secondary dark:text-base/50 border-transparent hover:text-primary hover:border-neutral dark:hover:border-neutral hover:bg-black/5 dark:hover:bg-white/5'"
class="flex items-center gap-2 px-4 py-2.5 text-sm font-medium border border-b-0 rounded-t-lg transition-all duration-150 cursor-pointer"
>
@if($tabIcon)
<x-dynamic-component :component="$tabIcon" class="size-4" />
@endif
<span>{{ $tabLabel }}</span>
@if($tabBadge)
<span class="inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold text-primary bg-primary/10 rounded-full">{{ $tabBadge }}</span>
@endif
</button>
</li>
@endif
@endforeach
@if($variant === 'pills' || $variant === 'buttons')
</div>
@else
</ul>
@endif
{{-- Tab Panels --}}
<div class="mt-5">
{{ $slot }}
</div>
</div>