updates
This commit is contained in:
@@ -1,15 +1,4 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id'),
|
||||
'type' => $attributes->get('type') ?? 'text',
|
||||
'label' => $attributes->has('label'),
|
||||
'readonly' => null,
|
||||
'required' => null,
|
||||
'disabled' => null,
|
||||
'helper' => $attributes->has('helper'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
'cannotPeak' => $attributes->has('cannotPeak'),
|
||||
])
|
||||
<div {{ $attributes->merge(['class' => 'w-full form-control']) }}>
|
||||
<div class="w-full">
|
||||
@if ($label)
|
||||
<label class="label">
|
||||
<span class="flex gap-1 label-text">
|
||||
@@ -18,52 +7,28 @@
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="group">
|
||||
<div class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<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>
|
||||
</div>
|
||||
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4 card-body">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</span>
|
||||
</label>
|
||||
@endif
|
||||
@if ($type === 'password')
|
||||
<div class="join" x-data>
|
||||
<input class="w-full join-item" type={{ $type }} @class([
|
||||
'border-r-0 rounded-l' => $cannotPeak,
|
||||
]) @if ($id) id={{ $id }} name={{ $id }}
|
||||
wire:model.defer={{ $id }} @endisset
|
||||
@if ($disabled !== null) disabled @endif
|
||||
@if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
|
||||
@if (!$noDirty && $id) wire:dirty.class="input-warning"
|
||||
@endif {{ $attributes }} />
|
||||
@if (!$cannotPeak)
|
||||
@if (!$disabled)
|
||||
|
||||
<div class="w-full">
|
||||
@if ($type === 'password')
|
||||
<div class="w-full join" x-data>
|
||||
<input class="join-item" @readonly($readonly) @disabled($disabled || $errors->isNotEmpty()) type={{ $type }}
|
||||
id={{ $id }} name={{ $name }} value={{ $value }}
|
||||
placeholder={{ $placeholder }}>
|
||||
@if ($cannotPeakPassword)
|
||||
<span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
|
||||
class="border-l-0 border-none rounded-r hover:bg-coolgray-200 no-animation h-7 btn join-item btn-xs bg-coolgray-200 "><svg
|
||||
xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||
<path
|
||||
d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
|
||||
</svg></span>
|
||||
@else
|
||||
<span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
|
||||
class="text-opacity-25 border-l-0 rounded-r bg-coolgray-200/50 hover:bg-coolgray-200/50 no-animation h-7 btn join-item btn-xs"><svg
|
||||
xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
@class([
|
||||
'border-l-0 border-none rounded-r no-animation h-7 btn join-item btn-xs',
|
||||
'bg-coolgray-200/50 hover:bg-coolgray-200/50 text-opacity-25' =>
|
||||
$disabled || $readonly,
|
||||
'bg-coolgray-200 hover:bg-coolgray-200' => !$disabled || !$readonly,
|
||||
])><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||
<path
|
||||
@@ -71,19 +36,15 @@
|
||||
</svg>
|
||||
</span>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<input id={{ $id }} name={{ $name }} wire:model.defer={{ $id }}
|
||||
wire:dirty.class="input-warning" @readonly($readonly) @disabled($disabled || $errors->isNotEmpty())
|
||||
@isset($value) value={{ $value }} @endisset
|
||||
@isset($placeholder) placeholder={{ $placeholder }} @endisset>
|
||||
@endif
|
||||
@if (!$label && $helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<input type={{ $type }}
|
||||
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
|
||||
@if ($disabled !== null) disabled @endif
|
||||
@if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
|
||||
@if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
|
||||
@endif
|
||||
|
||||
@error($id)
|
||||
<label class="label">
|
||||
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||
</label>
|
||||
@enderror
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user