lasthourcloud/resources/views/components/forms/input.blade.php

49 lines
2.0 KiB
PHP
Raw Normal View History

2023-05-03 12:09:10 +00:00
@props([
2023-05-25 12:05:44 +00:00
'id' => $attributes->has('id'),
2023-05-18 11:26:35 +00:00
'type' => $attributes->get('type') ?? 'text',
2023-05-05 08:13:43 +00:00
'label' => $attributes->has('label'),
2023-05-25 12:05:44 +00:00
'required' => null,
'disabled' => null,
2023-05-17 13:46:20 +00:00
'helper' => $attributes->has('helper'),
2023-05-05 08:13:43 +00:00
'noDirty' => $attributes->has('noDirty'),
2023-05-03 12:09:10 +00:00
])
2023-05-18 11:26:35 +00:00
<div {{ $attributes->merge(['class' => 'w-full form-control']) }}>
2023-05-25 12:05:44 +00:00
@if ($label)
2023-05-17 13:46:20 +00:00
<label class="label">
<span class="label-text">
2023-05-25 12:05:44 +00:00
{{ $label }}
2023-05-17 13:46:20 +00:00
@if ($required)
<span class="text-warning">*</span>
@endif
@if ($helper)
2023-05-22 08:34:00 +00:00
<div class="-mb-1 dropdown dropdown-right dropdown-hover">
2023-05-18 11:49:49 +00:00
<label tabindex="0" class="cursor-pointer text-warning">
2023-05-17 13:46:20 +00:00
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
2023-05-18 11:49:49 +00:00
class="w-4 h-4 stroke-current">
2023-05-17 13:46:20 +00:00
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</label>
<div tabindex="0"
2023-05-23 07:53:24 +00:00
class="border rounded shadow border-coolgray-400 card compact dropdown-content bg-coolgray-200 w-96">
2023-05-17 13:46:20 +00:00
<div class="card-body">
2023-05-18 11:49:49 +00:00
{!! $helper !!}
2023-05-17 13:46:20 +00:00
</div>
</div>
</div>
@endif
</span>
2023-05-05 07:28:00 +00:00
</label>
@endif
2023-05-25 12:05:44 +00:00
<input type={{ $type }}
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
@if ($disabled !== null) disabled @endif
@if ($required !== null) required @endif
@if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
2023-04-25 12:43:35 +00:00
@error($id)
2023-05-17 13:46:20 +00:00
<label class="label">
<span class="text-red-500 label-text-alt">{{ $message }}</span>
</label>
2023-04-25 12:43:35 +00:00
@enderror
2023-05-17 13:46:20 +00:00
</div>