@props([ 'id' => null, 'label' => null, 'icon' => null, 'hint' => null, 'hintClass' => 'label-text-alt text-gray-400 py-1 pb-0', 'prefix' => null, 'suffix' => null, 'prepend' => null, 'append' => null, 'errorField' => null, 'errorClass' => 'text-red-500 label-text-alt p-1', 'omitError' => false, 'firstErrorOnly' => false, ]) @php $modelName = $attributes->whereStartsWith('wire:model')->first(); $errorFieldName = $errorField ?? $modelName; $id = $id == $modelName ? $modelName : "{$id}{$modelName}"; @endphp
{{-- STANDARD LABEL --}} @if($label) @endif {{-- PREFIX/SUFFIX/PREPEND/APPEND CONTAINER --}} @if($prefix || $suffix || $prepend || $append)
@endif {{-- PREFIX / PREPEND --}} @if($prefix || $prepend)
$prefix, "border-0" => $attributes->has('disabled') && $attributes->get('disabled') == true, "border-dashed" => $attributes->has('readonly') && $attributes->get('readonly') == true, "!border-error" => $errorFieldName && $errors->has($errorFieldName) && !$omitError ]) > {{ $prepend ?? $prefix }}
@endif
{{-- INPUT --}} has('autofocus') && $attributes->get('autofocus') == true) autofocus @endif {{ $attributes ->merge(['type' => 'text']) ->class([ 'input input-primary w-full peer', 'ps-10' => ($icon), 'rounded-s-none' => $prefix || $prepend, 'rounded-e-none' => $suffix || $append, 'border-e-0' => $suffix, 'border border-dashed' => $attributes->has('readonly') && $attributes->get('readonly') == true, 'input-error' => $errorFieldName && $errors->has($errorFieldName) && !$omitError ]) }} /> {{-- ICON --}} @if($icon) @endif
{{-- SUFFIX/APPEND --}} @if($suffix || $append)
$suffix, "border-0" => $attributes->has('disabled') && $attributes->get('disabled') == true, "border-dashed" => $attributes->has('readonly') && $attributes->get('readonly') == true, "!border-error" => $errorFieldName && $errors->has($errorFieldName) && !$omitError ]) > {{ $append ?? $suffix }}
@endif {{-- END: PREFIX/SUFFIX/APPEND/PREPEND CONTAINER --}} @if($prefix || $suffix || $prepend || $append)
@endif {{-- ERROR --}} @if(!$omitError && $errors->has($errorFieldName)) @foreach($errors->get($errorFieldName) as $message) @foreach(Arr::wrap($message) as $line)
{{ $line }}
@break($firstErrorOnly) @endforeach @break($firstErrorOnly) @endforeach @endif {{-- HINT --}} @if($hint)
{{ $hint }}
@endif