2023-05-03 12:09:10 +00:00
|
|
|
@props([
|
2023-05-05 08:13:43 +00:00
|
|
|
'id' => $attributes->has('id') || $attributes->has('label'),
|
2023-05-04 08:00:08 +00:00
|
|
|
'type' => 'text',
|
2023-05-05 07:28:00 +00:00
|
|
|
'required' => $attributes->has('required'),
|
2023-05-05 08:13:43 +00:00
|
|
|
'label' => $attributes->has('label'),
|
|
|
|
'instantSave' => $attributes->has('instantSave'),
|
|
|
|
'noLabel' => $attributes->has('noLabel'),
|
|
|
|
'noDirty' => $attributes->has('noDirty'),
|
2023-05-03 12:09:10 +00:00
|
|
|
])
|
|
|
|
|
2023-05-04 08:00:08 +00:00
|
|
|
<span @class([
|
2023-05-08 07:16:50 +00:00
|
|
|
'flex' => $type === 'checkbox',
|
2023-05-04 08:00:08 +00:00
|
|
|
'flex flex-col' => $type !== 'checkbox',
|
|
|
|
])>
|
2023-05-05 07:28:00 +00:00
|
|
|
@if (!$noLabel)
|
2023-05-05 12:20:10 +00:00
|
|
|
<label for={{ $id }} @if (!$noDirty) wire:dirty.class="text-amber-300" @endif
|
|
|
|
wire:target={{ $id }}>
|
2023-05-05 07:28:00 +00:00
|
|
|
@if ($label)
|
|
|
|
{{ $label }}
|
|
|
|
@else
|
|
|
|
{{ $id }}
|
|
|
|
@endif
|
|
|
|
@if ($required)
|
|
|
|
*
|
|
|
|
@endif
|
|
|
|
</label>
|
|
|
|
@endif
|
2023-04-26 13:38:50 +00:00
|
|
|
@if ($type === 'textarea')
|
2023-05-05 07:28:00 +00:00
|
|
|
<textarea @if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif {{ $attributes }}
|
|
|
|
required={{ $required }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
|
2023-04-26 13:38:50 +00:00
|
|
|
@else
|
2023-05-05 08:13:43 +00:00
|
|
|
<input {{ $attributes }} @if ($required) required @endif
|
2023-05-05 12:20:10 +00:00
|
|
|
@if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif
|
2023-05-12 10:22:41 +00:00
|
|
|
type={{ $type }} id={{ $id }} name={{ $id }}
|
2023-05-04 13:45:53 +00:00
|
|
|
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
2023-04-26 13:38:50 +00:00
|
|
|
@endif
|
2023-04-25 12:43:35 +00:00
|
|
|
@error($id)
|
|
|
|
<div class="text-red-500">{{ $message }}</div>
|
|
|
|
@enderror
|
2023-05-04 08:00:08 +00:00
|
|
|
</span>
|