@php extract(Flux::forwardedAttributes($attributes, [ 'name', 'multiple', 'size', ])); @endphp @props([ 'name' => $attributes->whereStartsWith('wire:model')->first(), 'multiple' => null, 'size' => null, ]) @php $classes = Flux::classes() ->add('w-full flex items-center gap-4') // NOTE: We need to add relative positioning here to prevent odd overflow behaviors because of // "sr-only": https://github.com/tailwindlabs/tailwindcss/discussions/12429 ->add('relative') ; [ $styleAttributes, $attributes ] = Flux::splitAttributes($attributes); @endphp
class($classes) }} data-flux-input-file wire:ignore tabindex="0" x-data {{-- This is here to "scope" the x-ref references inside this component from interfering with others outside... --}} x-on:click.prevent.stop="$refs.input.click()" x-on:keydown.enter.prevent.stop="$refs.input.click()" x-on:keydown.space.prevent.stop x-on:keyup.space.prevent.stop="$refs.input.click()" x-on:change="$refs.name.textContent = $event.target.files[1] ? ($event.target.files.length + ' {!! __('files') !!}') : ($event.target.files[0]?.name || '{!! __('No file chosen') !!}')" >