- 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.
68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
{{--
|
|
Select Component - TailAdmin style
|
|
|
|
Usage:
|
|
<x-proxmox::ui.select name="country" label="Country">
|
|
<option value="us">United States</option>
|
|
<option value="uk">United Kingdom</option>
|
|
</x-proxmox::ui.select>
|
|
--}}
|
|
|
|
@props([
|
|
'name' => null,
|
|
'label' => null,
|
|
'error' => null,
|
|
'hint' => null,
|
|
'disabled' => false,
|
|
'required' => false,
|
|
'size' => 'md',
|
|
])
|
|
|
|
@php
|
|
$sizeClasses = [
|
|
'sm' => 'h-9 text-theme-xs py-2',
|
|
'md' => 'h-11 text-theme-sm py-2.5',
|
|
'lg' => 'h-12 text-base py-3',
|
|
];
|
|
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['md'];
|
|
|
|
$selectClasses = 'block w-full appearance-none rounded-lg border bg-transparent px-4 pr-10 shadow-theme-xs transition-colors duration-150 placeholder:text-gray-400 focus:outline-none focus:ring-3 disabled:cursor-not-allowed disabled:bg-gray-50 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-gray-500 dark:disabled:bg-gray-800';
|
|
|
|
if ($error) {
|
|
$selectClasses .= ' border-error-300 focus:border-error-300 focus:ring-error-500/10 dark:border-error-700';
|
|
} else {
|
|
$selectClasses .= ' border-gray-300 focus:border-brand-300 focus:ring-brand-500/10 dark:border-gray-700 dark:focus:border-brand-600';
|
|
}
|
|
@endphp
|
|
|
|
<div {{ $attributes->only('class')->class(['space-y-2']) }}>
|
|
@if($label)
|
|
<label @if($name) for="{{ $name }}" @endif class="text-theme-sm font-medium text-gray-700 dark:text-gray-300">
|
|
{{ $label }}
|
|
@if($required)
|
|
<span class="text-error-500">*</span>
|
|
@endif
|
|
</label>
|
|
@endif
|
|
|
|
<div class="relative">
|
|
<select
|
|
@if($name) name="{{ $name }}" id="{{ $name }}" @endif
|
|
@if($disabled) disabled @endif
|
|
@if($required) required @endif
|
|
{{ $attributes->except('class')->class([$selectClasses, $sizeClass]) }}
|
|
>
|
|
{{ $slot }}
|
|
</select>
|
|
<div class="pointer-events-none absolute inset-y-0 end-0 flex items-center pe-4 text-gray-500 dark:text-gray-400">
|
|
<x-ri-arrow-down-s-line class="size-5" />
|
|
</div>
|
|
</div>
|
|
|
|
@if($error)
|
|
<p class="text-theme-xs font-medium text-error-500">{{ $error }}</p>
|
|
@elseif($hint)
|
|
<p class="text-theme-xs text-gray-500 dark:text-gray-400">{{ $hint }}</p>
|
|
@endif
|
|
</div>
|