@props([ 'name', 'label', 'value' => null, 'type' => 'text', 'icon' => null, 'required' => false, 'helper' => null, 'max' => null, 'autofocus' => false, ]) @php $current = old($name, $value); $invalid = $errors->has($name); $id = 'field-'.$name; @endphp {{-- One input definition for the whole app: icon, label, focus ring, error state and helper text stay identical wherever a field appears. --}}
@if ($icon) {{-- The icon picks up the focus colour too, so the whole control reacts as one thing rather than just the border. --}} @endif merge(['class' => 'w-full rounded-xl border bg-white py-2.5 text-sm text-slate-900 transition duration-150 placeholder:text-slate-400 focus:outline-none focus:ring-4 dark:bg-slate-900 dark:text-white '.($icon ? 'pl-9 pr-3' : 'px-3').' '. {{-- dark:focus: is needed explicitly: a bare focus:border-* loses to dark:border-* in the cascade, so without it the branded focus border simply never appears in dark mode. --}} ($invalid ? 'border-red-300 focus:border-red-400 focus:ring-red-500/10 dark:border-red-500/50 dark:focus:border-red-400' : 'border-slate-200 focus:border-brand-400 focus:ring-brand-500/10 dark:border-slate-700 dark:focus:border-brand-400')]) }}>
@if ($invalid) @elseif ($helper)

{{ $helper }}

@endif