@props([ 'label' => null, 'name' => null, 'type' => 'text', 'viewable' => false, 'icon' => null, ]) @php $wireModelKey = collect($attributes->getAttributes())->keys()->first(fn ($key) => str_starts_with((string) $key, 'wire:model')); $wireModelValue = $wireModelKey ? $attributes->get($wireModelKey) : null; $fieldName = $name ?? $wireModelValue; $hasError = $fieldName && $errors->has($fieldName); $inputId = 'field-'.str_replace(['.', '[', ']'], '-', $name ?? $wireModelValue ?? uniqid()); @endphp
@if ($label) @endif
@if ($icon) @endif except(['label', 'name', 'type'])->class([ 'block w-full rounded-lg border bg-white px-3.5 py-2.5 text-sm text-stone-900 placeholder:text-stone-400 shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-offset-0 dark:bg-stone-900 dark:text-stone-100 dark:placeholder:text-stone-500', 'pl-10' => $icon, 'pr-10' => $viewable, 'border-red-400 focus:border-red-500 focus:ring-red-500/30 dark:border-red-500/60' => $hasError, 'border-stone-300 focus:border-brand-500 focus:ring-brand-500/20 dark:border-stone-700 dark:focus:border-brand-400 dark:focus:ring-brand-400/20' => ! $hasError, ]) }} /> @if ($viewable) @endif
@if ($hasError)

{{ $errors->first($fieldName) }}

@endif