- Changed badge, button, card, dropdown, input, modal, select, table, tabs, toggle, and tooltip components to align with the TailAdmin design system. - Updated class names and styles for consistency across components. - Enhanced accessibility and responsiveness in various components. - Improved hover and focus states for better user experience.
117 lines
4.6 KiB
PHP
117 lines
4.6 KiB
PHP
{{--
|
|
Modal Component - TailAdmin Dialog
|
|
|
|
Usage:
|
|
<x-proxmox::ui.modal name="my-modal" title="Modal Title">Content</x-proxmox::ui.modal>
|
|
|
|
Open with: $dispatch('open-modal', { name: 'my-modal' })
|
|
Close with: $dispatch('close-modal', { name: 'my-modal' })
|
|
--}}
|
|
|
|
@props([
|
|
'name',
|
|
'title' => null,
|
|
'subtitle' => null,
|
|
'icon' => null,
|
|
'iconColor' => 'text-brand-500',
|
|
'maxWidth' => 'md',
|
|
'closeable' => true,
|
|
'footer' => null,
|
|
])
|
|
|
|
@php
|
|
$maxWidthClasses = [
|
|
'sm' => 'max-w-sm',
|
|
'md' => 'max-w-md',
|
|
'lg' => 'max-w-lg',
|
|
'xl' => 'max-w-xl',
|
|
'2xl' => 'max-w-2xl',
|
|
'3xl' => 'max-w-3xl',
|
|
'4xl' => 'max-w-4xl',
|
|
'5xl' => 'max-w-5xl',
|
|
'full' => 'max-w-full mx-4',
|
|
];
|
|
$maxWidthClass = $maxWidthClasses[$maxWidth] ?? $maxWidthClasses['md'];
|
|
@endphp
|
|
|
|
<div
|
|
x-data="{ show: false }"
|
|
x-on:open-modal.window="if ($event.detail.name === '{{ $name }}') show = true"
|
|
x-on:close-modal.window="if ($event.detail.name === '{{ $name }}') show = false"
|
|
x-on:keydown.escape.window="@if($closeable) show = false @endif"
|
|
x-show="show"
|
|
x-cloak
|
|
class="fixed inset-0 z-99999 overflow-y-auto"
|
|
{{ $attributes }}
|
|
>
|
|
{{-- Backdrop --}}
|
|
<div
|
|
x-show="show"
|
|
x-transition:enter="transition ease-out duration-200"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition ease-in duration-150"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
@if($closeable) @click="show = false" @endif
|
|
class="fixed inset-0 bg-gray-900/50 backdrop-blur-sm dark:bg-gray-900/80"
|
|
></div>
|
|
|
|
{{-- Modal Panel --}}
|
|
<div class="fixed inset-0 flex items-center justify-center p-4">
|
|
<div
|
|
x-show="show"
|
|
x-transition:enter="transition ease-out duration-200"
|
|
x-transition:enter-start="opacity-0 scale-95"
|
|
x-transition:enter-end="opacity-100 scale-100"
|
|
x-transition:leave="transition ease-in duration-150"
|
|
x-transition:leave-start="opacity-100 scale-100"
|
|
x-transition:leave-end="opacity-0 scale-95"
|
|
@click.stop
|
|
class="relative w-full {{ $maxWidthClass }} max-h-[90vh] overflow-y-auto rounded-2xl border border-gray-200 bg-white shadow-theme-lg dark:border-gray-800 dark:bg-gray-900"
|
|
>
|
|
{{-- Header --}}
|
|
@if($title || $closeable)
|
|
<div class="flex items-start justify-between gap-4 border-b border-gray-200 px-6 py-5 dark:border-gray-800">
|
|
<div class="flex items-center gap-3.5">
|
|
@if($icon)
|
|
<div class="flex size-11 flex-shrink-0 items-center justify-center rounded-xl bg-brand-50 dark:bg-brand-500/10">
|
|
<x-dynamic-component :component="$icon" class="size-5 {{ $iconColor }} dark:text-brand-400" />
|
|
</div>
|
|
@endif
|
|
<div class="space-y-1">
|
|
@if($title)
|
|
<h3 class="text-lg font-semibold text-gray-800 dark:text-white/90">{{ $title }}</h3>
|
|
@endif
|
|
@if($subtitle)
|
|
<p class="text-theme-sm text-gray-500 dark:text-gray-400">{{ $subtitle }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@if($closeable)
|
|
<button
|
|
@click="show = false"
|
|
class="flex size-9 items-center justify-center rounded-lg text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-brand-500/20 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300"
|
|
>
|
|
<x-ri-close-line class="size-5" />
|
|
<span class="sr-only">Close</span>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Content --}}
|
|
<div class="px-6 py-5">
|
|
{{ $slot }}
|
|
</div>
|
|
|
|
{{-- Footer --}}
|
|
@if($footer)
|
|
<div class="flex items-center justify-end gap-3 border-t border-gray-200 px-6 py-4 dark:border-gray-800">
|
|
{{ $footer }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|