@props([ 'name', 'label' => null, 'type' => 'text', 'value' => null, 'required' => false, 'optional' => false, 'disabled' => false, 'readonly' => false, 'placeholder' => null, 'help' => null, 'error' => null, 'icon' => null, 'prefix' => null, 'suffix' => null, 'copyable' => false, 'loading' => false, // Not used by this component — declared so the CRUD generator's // _field.blade.php (which passes a fixed superset of props to whichever // component a field targets) doesn't leak these into $attributes, where // an array/bool value can't be cast to a string HTML attribute. 'checked' => false, 'options' => [], 'selected' => null, 'existingUrl' => null, 'aspectRatio' => null, ]) @php $isPassword = $type === 'password'; $resolvedError = $error ?? $errors->first($name); $hasLeftAdornment = $icon || $prefix; $hasRightAdornment = $isPassword || $copyable || $suffix || $loading; @endphp
@if ($icon) @elseif ($prefix) {{ $prefix }} @endif merge([ 'value' => $value, 'class' => 'w-full rounded-xl border border-slate-300 bg-white px-4 py-2.5 text-slate-900 shadow-sm placeholder:text-slate-400 transition focus:border-primary focus:outline-none focus:ring-4 focus:ring-primary/15 disabled:cursor-not-allowed disabled:bg-slate-50 disabled:text-slate-400' . ($hasLeftAdornment ? ' pl-10' : '') . ($hasRightAdornment ? ' pr-10' : ''), ]) }} > @if ($isPassword) @elseif ($copyable) @elseif ($loading) @elseif ($suffix) {{ $suffix }} @endif