@props([
'name',
'label' => null,
'type' => 'text',
'required' => false,
'minlength' => null,
'maxlength' => null,
'pattern' => null,
'placeholder' => '',
'value' => '',
'help' => null,
'error' => null,
'disabled' => false,
'autocomplete' => null,
'wireModel' => null,
])
@php
$inputId = $name . '-' . uniqid();
$isPassword = $type === 'password';
@endphp
{{-- Label --}}
@if($label)
@endif
{{-- Input wrapper --}}
class([
'input w-full',
'pr-10' => !$isPassword && !$maxlength,
'pr-20' => $isPassword,
'pr-16' => $maxlength && !$isPassword,
]) }}
:class="{
'!border-success/50 focus:!ring-success/30': state === 'valid',
'!border-danger/50 focus:!ring-danger/30': state === 'invalid',
}"
>
{{-- Validation state icon --}}
{{-- Valid check --}}
{{-- Invalid X --}}
{{-- Password visibility toggle --}}
@if($isPassword)
@endif
{{-- Password strength meter --}}
@if($isPassword)
@endif
{{-- Character counter --}}
@if($maxlength)
@endif
{{-- Description / error area --}}