@props([
    'name',
    'label',
    'type' => 'text',
    'required' => false,
    'value' => null,
])

<div {{ $attributes->only('class') }}>
    <label for="{{ $name }}" class="block text-sm font-medium text-slate-ink mb-1.5">
        {{ $label }}@if ($required) <span class="text-brand-600">*</span>@endif
    </label>
    <input
        type="{{ $type }}"
        id="{{ $name }}"
        name="{{ $name }}"
        value="{{ old($name, $value) }}"
        @if ($required) required @endif
        {{ $attributes->except('class')->merge([
            'class' => 'w-full rounded-xl bg-paper px-4 py-3 text-slate-ink focus:border-brand-500 focus:ring-0 border ' . ($errors->has($name) ? 'border-red-400' : 'border-slate-200'),
        ]) }}
    >
    @error($name)
        <p class="text-sm text-red-600 mt-1">{{ $message }}</p>
    @enderror
</div>
