- Updated dropdown component styles and transitions for improved UX. - Refined checkbox, input, radio, select, and textarea components with consistent error messaging and styling. - Introduced a new card component for better layout options. - Added a stat card component for displaying metrics with trends. - Implemented a command palette for global search and navigation, accessible via Cmd/Ctrl+K. - Enhanced modal and navigation components with new styles and transitions. - Improved layout styles for better responsiveness and visual appeal.
34 lines
2.0 KiB
PHP
34 lines
2.0 KiB
PHP
<div class="relative" x-data="{ open: false, activeIndex: -1 }" @keydown.escape="open = false" @keydown.down.prevent="activeIndex = Math.min(activeIndex + 1, $refs.dropdown.children.length - 1)" @keydown.up.prevent="activeIndex = Math.max(activeIndex - 1, 0)" x-init="$watch('open', value => {
|
|
if (value) {
|
|
activeIndex = -1;
|
|
$nextTick(() => {
|
|
let dropdown = $refs.dropdown;
|
|
dropdown.style.left = '';
|
|
let rect = dropdown.getBoundingClientRect();
|
|
let windowWidth = window.innerWidth;
|
|
dropdown.style.left = rect.right > windowWidth ? `-${rect.width - 40}px` : '0';
|
|
});
|
|
}
|
|
})">
|
|
|
|
<button
|
|
class="flex flex-row items-center px-2 py-1 text-sm font-semibold whitespace-nowrap text-base hover:text-primary transition-colors duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-md"
|
|
x-on:click="open = !open"
|
|
:aria-expanded="open">
|
|
{{ $trigger }}
|
|
<x-ri-arrow-down-s-line x-bind:class="{ '-rotate-180' : open }"
|
|
class="md:block hidden size-4 text-base ease-out duration-300" />
|
|
</button>
|
|
|
|
<div x-ref="dropdown"
|
|
class="absolute mt-3 w-48 glass-panel shadow-floating z-10 overflow-hidden"
|
|
x-show="open"
|
|
x-transition:enter="transition ease-out duration-180" x-transition:enter-start="opacity-0 scale-[0.96] -translate-y-2"
|
|
x-transition:enter-end="opacity-100 scale-100 translate-y-0" x-transition:leave="transition ease-in duration-120"
|
|
x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-[0.96]"
|
|
x-on:click.outside="open = false" x-cloak>
|
|
<div class="py-1 [&>a]:block [&>a]:px-4 [&>a]:py-2.5 [&>a]:text-sm [&>a]:text-color-base [&>a]:transition-colors [&>a]:duration-150 [&>a:hover]:bg-primary/10 [&>a:hover]:text-primary [&>a:focus]:bg-primary/10 [&>a:focus]:text-primary [&>a:focus]:outline-none">
|
|
{{ $content }}
|
|
</div>
|
|
</div>
|
|
</div> |