wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 166 forks source link

V2 Select not set wire model value #803

Open Artessan opened 6 months ago

Artessan commented 6 months ago

Describe the bug In V2 the select component loose wire model property and has to be place outside of the component

To Reproduce Steps to reproduce the behavior:

<div class="col-span-2 lg:col-span-1">
    <x-select
        label="{{__('Contact type')}}"
        placeholder="{{__('Select one type')}}"
        option-label="label"
        option-value="value"
        :options="[
            ['value' => 'company', 'label' => 'Company'],
            ['value' => 'person' , 'label' => 'Person'],
        ]" wire:model="contactForm.type"/>
</div>

the property value is not set in livewire

                    <div class="col-span-2 lg:col-span-1" wire:model="contactForm.type">
                        <x-select
                            label="{{__('Contact type')}}"
                            placeholder="{{__('Select one type')}}"
                            option-label="label"
                            option-value="value"
                            :options="[
                                ['value' => 'company', 'label' => 'Company'],
                                ['value' => 'person' , 'label' => 'Person'],
                            ]"/>
                    </div>

this works (the model is set outside the component)

Expected behavior Maybe the component should add the given properties as properties of the most external div as the input is hidden

Dependencies

BoGnY commented 6 months ago

Same problem, but other than in Select, also even in Select (with async), Currency, DateTimePicker, and maybe other.