@blaze @props([ 'placeholder' => null, 'clearable' => true, 'closable' => null, 'icon' => null, ]) @php // Clerable or closable, not both... if ($closable !== null) $clearable = null; $classes = Flux::classes() ->add('h-10 w-full flex items-center px-3 py-2') ->add('font-medium text-base sm:text-sm text-zinc-800 dark:text-white') ->add('ps-9') // Make room for magnifying glass icon... ->add('pe-9') // Make room for clear/clos button and loading indicator... ->add('outline-hidden') ->add('border-b border-zinc-200 dark:border-zinc-600') ->add('bg-white dark:bg-zinc-700') // The below reverts styles added by Tailwind Forms plugin ->add('border-t-0 border-s-0 border-e-0 focus:ring-0 focus:border-zinc-200 dark:focus:border-zinc-600') ->add('data-invalid:text-red-500 dark:data-invalid:text-red-400') ; $name = $attributes->whereStartsWith('wire:model')->first(); $invalid ??= ($name && $errors->has($name)); $loading = $attributes->whereStartsWith('wire:model.live')->isNotEmpty(); if ($loading) { $attributes = $attributes->merge(['wire:loading.attr' => 'data-flux-loading']); } @endphp
{{ $icon }}
class($classes) }} @if ($invalid) aria-invalid="true" data-invalid @endif placeholder="{{ $placeholder ?? __('Search...') }}" data-flux-pillbox-input autofocus />