This commit is contained in:
Andras Bacsai
2023-05-17 15:46:20 +02:00
parent c350018716
commit f2e91f97ed
14 changed files with 430 additions and 251 deletions

View File

@@ -0,0 +1,24 @@
@props([
'id' => $attributes->has('id') || $attributes->has('label'),
'required' => $attributes->has('required'),
'label' => $attributes->has('label'),
'helper' => $attributes->has('helper'),
'instantSave' => $attributes->has('instantSave'),
'noLabel' => $attributes->has('noLabel'),
'noDirty' => $attributes->has('noDirty'),
'disabled' => null,
])
<label {{ $attributes->merge(['class' => 'flex items-center gap-16 cursor-pointer']) }}>
<span class="label-text">
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
</span>
<input type="checkbox" @if ($disabled !== null) disabled @endif class="toggle" name={{ $id }}
@if (!$noDirty) wire:dirty.class="input-warning" @endif
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
</label>
</div>