- Refactored select component to align with shadcn design principles. - Updated server status indicator component for consistency with shadcn style. - Modified spinner component to follow shadcn design guidelines. - Enhanced stat card component with shadcn-inspired styles. - Adjusted tab panel component to reflect shadcn design updates. - Revamped table row and table data cell components to match shadcn aesthetics. - Updated table header cell component for improved styling consistency. - Refined table component to align with shadcn design principles. - Enhanced tabs component with shadcn-inspired styles. - Updated toggle component to follow shadcn design guidelines. - Refactored tooltip component to align with shadcn design principles. - Updated server card component to reflect shadcn-inspired design.
117 lines
4.3 KiB
PHP
117 lines
4.3 KiB
PHP
{{--
|
|
Modal Component - shadcn-style 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-primary',
|
|
'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-50 overflow-y-auto"
|
|
{{ $attributes }}
|
|
>
|
|
{{-- Backdrop --}}
|
|
<div
|
|
x-show="show"
|
|
x-transition:enter="transition ease-out duration-150"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition ease-in duration-100"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
@if($closeable) @click="show = false" @endif
|
|
class="fixed inset-0 bg-black/50 backdrop-blur-sm"
|
|
></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-150"
|
|
x-transition:enter-start="opacity-0 scale-95"
|
|
x-transition:enter-end="opacity-100 scale-100"
|
|
x-transition:leave="transition ease-in duration-100"
|
|
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-xl border bg-background-secondary shadow-lg"
|
|
>
|
|
{{-- Header --}}
|
|
@if($title || $closeable)
|
|
<div class="flex items-start justify-between gap-4 px-6 pt-6 pb-4">
|
|
<div class="flex items-center gap-3">
|
|
@if($icon)
|
|
<div class="flex-shrink-0 flex items-center justify-center size-9 rounded-lg bg-primary/10">
|
|
<x-dynamic-component :component="$icon" class="size-4 {{ $iconColor }}" />
|
|
</div>
|
|
@endif
|
|
<div class="space-y-1">
|
|
@if($title)
|
|
<h3 class="text-lg font-semibold leading-none tracking-tight">{{ $title }}</h3>
|
|
@endif
|
|
@if($subtitle)
|
|
<p class="text-sm text-muted-foreground">{{ $subtitle }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@if($closeable)
|
|
<button
|
|
@click="show = false"
|
|
class="rounded-sm opacity-70 ring-offset-background transition-opacity duration-150 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
|
>
|
|
<x-ri-close-line class="size-4" />
|
|
<span class="sr-only">Close</span>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Content --}}
|
|
<div class="px-6 pb-6">
|
|
{{ $slot }}
|
|
</div>
|
|
|
|
{{-- Footer --}}
|
|
@if($footer)
|
|
<div class="flex items-center justify-end gap-2 px-6 py-4 border-t">
|
|
{{ $footer }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|