@php $baseClasses = 'inline-flex items-center justify-center rounded-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 transition ease-in-out duration-150'; $variants = [ 'primary' => 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500', 'secondary' => 'bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500', 'info' => 'bg-cyan-600 text-white hover:bg-cyan-700 focus:ring-cyan-500', 'success' => 'bg-green-600 text-white hover:bg-green-700 focus:ring-green-500', 'warning' => 'bg-yellow-500 text-white hover:bg-yellow-600 focus:ring-yellow-400', 'danger' => 'bg-red-600 text-white hover:bg-red-700 focus:ring-red-500', ]; $sizes = [ 'sm' => 'text-xs px-3 py-1.5', 'md' => 'text-sm px-4 py-2', 'lg' => 'text-base px-6 py-3', ]; $variantClass = $variants[$variant] ?? $variants['primary']; $sizeClass = $sizes[$size] ?? $sizes['md']; $classes = "$baseClasses $variantClass $sizeClass"; // Simple spinner SVG for loading indicator $spinner = <<<'SVG' SVG; @endphp @if ($href) merge(['class' => $classes]) }} @if ($loading && $attributes->has('wire:click')) wire:loading.attr="aria-disabled" wire:target="{{ $attributes->get('wire:click') }}" onclick="return false;" @endif > @if ($icon) @endif @if ($loading) {{ $slot }} {!! $spinner !!} @else {{ $slot }} @endif @if ($iconRight) @endif @else @endif