diff --git a/components/button/files/index.blade.php b/components/button/files/index.blade.php index 440dda8..aca11a0 100644 --- a/components/button/files/index.blade.php +++ b/components/button/files/index.blade.php @@ -25,7 +25,7 @@ $sizeClasses = match($size) { 'lg' => '[:where(&)]:h-12 text-md' . ' '. ( $squared ? 'w-12': ($icon ? 'ps-4' : 'ps-5') . ' ' . ($iconAfter ? 'pe-4' : 'pe-5')), 'md' => '[:where(&)]:h-10 text-base' . ' '. ( $squared ? 'w-10': ($icon ? 'ps-3' : 'ps-4') . ' ' . ($iconAfter ? 'pe-3' : 'pe-4')), // default - 'sm' => '[:where(&)]:h-8 text-sm' . ' '. ( $squared ? 'w-8': ($icon ? 'ps-2' : 'ps-3') . ' ' . ($iconAfter ? 'pe-2' : 'pe-3')), + 'sm' => '[:where(&)]:h-9 text-sm' . ' '. ( $squared ? 'w-9': ($icon ? 'ps-2' : 'ps-3') . ' ' . ($iconAfter ? 'pe-2' : 'pe-3')), 'xs' => '[:where(&)]:h-6 text-xs' . ' '. ( $squared ? 'w-6': ($icon ? 'ps-1' : 'ps-2') . ' ' . ($iconAfter ? 'pe-1' : 'pe-2')), default => '[:where(&)]:h-10 text-sm' . ' '. ( $squared ? 'w-10': ($icon ? 'ps-3' : 'ps-4') . ' ' . ($iconAfter ? 'pe-3' : 'pe-4')), }; @@ -82,7 +82,7 @@ // Determine variant-specific classes for background, text, borders, and hover states $variantClasses = match($variant){ 'primary' => [ - 'bg-[var(--color-primary)] hover:bg-[--alpha(var(--color-primary)/50%)', // Background color + 'bg-[var(--color-primary)] hover:bg-[var(--color-primary)]/90', // Background color 'text-[var(--color-primary-fg)]', // Text color 'border border-black/10 dark:border-0', // Border styles $colors => filled($color) @@ -96,13 +96,13 @@ ' bg-transparent' ], 'outline' => [ - 'border border-[--alpha(var(--color-primary)/50%)] hover:border-[color-mix(in_oklab,_var(--color-primary),_black_20%)]', // Border - 'bg-[--alpha(var(--color-primary)/5%)] hover:bg-[--alpha(var(--color-primary)/10%)]', // Background + 'border border-[--alpha(var(--color-primary)/20%)] hover:border-[--alpha(var(--color-primary)/25%)]', // Border + 'bg-[--alpha(var(--color-primary)/5%)] hover:bg-[--alpha(var(--color-primary)/7%)]', // Background 'text-[var(--color-primary)]', $colors => filled($color), // Ensure variables are set ], 'ghost' => [ - 'bg-transparent hover:bg-neutral-800/5 dark:hover:bg-white/15', // Background colors + 'bg-transparent hover:bg-[--alpha(var(--color-neutral-900)/5%)] dark:hover:bg-[--alpha(var(--color-white)/5%)]', // Background colors 'text-neutral-800 dark:text-white' // Text colors ], 'danger' =>[ @@ -116,11 +116,10 @@ // Assemble base button classes, including layout, disabled states, and conditional styles $classes = [ - 'relative inline-flex items-center font-medium justify-center gap-x-2 whitespace-nowrap transition-colors duration-200', - '[contain:layout]', // fix for chrome bug with loading: nothing outside effect this internal layout, + 'relative [:where(&)]:inline-flex items-center font-medium justify-center gap-x-2 whitespace-nowrap transition-colors duration-200', 'disabled:opacity-55 dark:disabled:opacity-55 disabled:cursor-default disabled:pointer-events-none cursor-pointer', '[&_a]:no-underline [&_a]:decoration-none [&_a:hover]:no-underline' => $variant !== 'none' , // Handle anchor tags inside the button - 'rounded-field' => $variant !== 'none' , // Apply rounding unless variant is 'none' + '[:where(&)]:rounded-field' => $variant !== 'none' , // Apply rounding unless variant is 'none' // Handling loading logic via CSS: Show loading indicator as flex and set opacity-0 on its siblings '[&>[data-loading=true]:first-child]:flex', // Override 'hidden' to display the loading div during loading @@ -177,7 +176,7 @@ @endif @if($slot->isNotEmpty()) - + {{ $slot }} @endif diff --git a/components/checkbox/files/index.blade.php b/components/checkbox/files/index.blade.php index e61014a..db38c91 100644 --- a/components/checkbox/files/index.blade.php +++ b/components/checkbox/files/index.blade.php @@ -1,8 +1,3 @@ -{{-- - Custom checkbox component that handles both individual and group states - Supports Livewire and Alpine.js model binding with automatic state synchronization ---}} - @aware([ 'variant' => 'default' ]) diff --git a/components/dropdown/config.yml b/components/dropdown/config.yml index ca5fc59..c666e16 100644 --- a/components/dropdown/config.yml +++ b/components/dropdown/config.yml @@ -3,6 +3,7 @@ files: item: resources/views/components/ui/dropdown/item.blade.php submenu: resources/views/components/ui/dropdown/submenu.blade.php group: resources/views/components/ui/dropdown/group.blade.php + checkbox-or-radio: resources/views/components/ui/dropdown/checkbox-or-radio.blade.php separator: resources/views/components/ui/dropdown/separator.blade.php dependencies: internal: [icon] \ No newline at end of file diff --git a/components/dropdown/files/checkbox-or-radio.blade.php b/components/dropdown/files/checkbox-or-radio.blade.php new file mode 100644 index 0000000..75c2195 --- /dev/null +++ b/components/dropdown/files/checkbox-or-radio.blade.php @@ -0,0 +1,106 @@ +@aware([ + 'radio'=> false, + 'checkbox' => false, + 'disabled' => false, + 'name' => null, + 'checkboxVariant' => false, + 'icon' => null, + 'shortcut' => null +]) + + +@props([ + 'classes' => '', + 'value' => '', + 'iconClasses' => '' +]) + +@php + $role = $checkbox ? 'menuitemcheckbox' : 'menuitemradio'; + +@endphp + + + \ No newline at end of file diff --git a/components/dropdown/files/group.blade.php b/components/dropdown/files/group.blade.php index be06765..0db0b95 100644 --- a/components/dropdown/files/group.blade.php +++ b/components/dropdown/files/group.blade.php @@ -1,7 +1,6 @@ -{{-- dropdown/group.blade.php --}} @props(['label' => null]) -
merge(['class' => 'pt-1 contents']) }}> +
merge(['class' => 'pt-1 space-y-(--dropdown-padding) contents']) }}> @if($label)
{{ $label }} diff --git a/components/dropdown/files/index.blade.php b/components/dropdown/files/index.blade.php index c3db381..518d9da 100644 --- a/components/dropdown/files/index.blade.php +++ b/components/dropdown/files/index.blade.php @@ -1,16 +1,24 @@ @props([ 'position' => 'bottom-center', 'teleport' => 'body', - 'portal' => false + 'portal' => false, + 'trap' => false, + 'offset' => 6, + 'checkbox' => false, + 'radio' => false, + 'resetFocus' => false ]) @php + $isDefaultDropdownVariant = $checkbox || $radio; $classes = [ 'isolate z-50', - 'grid grid-cols-[auto_1fr_auto]', + 'grid grid-cols-[auto_1fr_auto]' => !$isDefaultDropdownVariant , + 'grid grid-cols-[auto_auto_1fr_auto]' => $isDefaultDropdownVariant, '[:where(&)]:max-w-96 [:where(&)]:min-w-40 text-start', - 'bg-white dark:bg-neutral-900 border border-black/10 dark:border-white/10 space-y-0.5', - 'rounded-(--dropdown-radius) p-(--dropdown-padding) [--dropdown-radius:var(--radius-box)] [--dropdown-padding:--spacing(.75)]', + 'bg-white dark:bg-neutral-900 border border-black/10 dark:border-white/10', + '[--dropdown-radius:var(--radius-box)] [--dropdown-padding:--spacing(.75)] + rounded-(--dropdown-radius) p-(--dropdown-padding) space-y-1', ]; @endphp @@ -18,12 +26,13 @@
attributes->class('flex items-center px-2 py-1 rounded-field') }} + {{ $button->attributes }} x-on:keydown.tab.prevent.stop="$focus.focus($focus.within($refs.panel).getFirst())" x-on:keydown.down.prevent.stop="$focus.focus($focus.within($refs.panel).getFirst())" x-on:keydown.space.stop.prevent="toggle()" x-on:keydown.enter.stop.prevent="toggle()" x-on:click="toggle()" x-bind:aria-expanded="open" + x-bind:data-open="open" x-bind:aria-controls="$id('dropdown-button')" > {{ $button }} @@ -82,8 +94,13 @@ class="relative"