- Refactor JavaScript functions to prevent duplicate initializations on navigation - Add skeleton loaders for invoices and services during loading states - Introduce a new progress bar component with customizable properties - Update dropdown and checkbox components for better styling and accessibility - Improve modal and navigation components with enhanced animations and structure
33 lines
1.9 KiB
PHP
33 lines
1.9 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;
|
|
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"
|
|
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-2 w-48 bg-background-secondary rounded-xl shadow-xl z-10 border border-neutral/50 overflow-hidden"
|
|
x-show="open"
|
|
x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0 scale-95 -translate-y-2"
|
|
x-transition:enter-end="opacity-100 scale-100 translate-y-0" x-transition:leave="transition ease-in duration-100"
|
|
x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95"
|
|
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> |