{{-- Componente de campo de texto reutilizable @param string $name - Nombre del campo @param string $label - Etiqueta del campo @param string $type - Tipo de input (text, email, password, number, etc.) @param string $value - Valor por defecto @param string $placeholder - Placeholder del campo @param bool $required - Campo obligatorio @param int $maxlength - Longitud máxima @param int $minlength - Longitud mínima @param string $pattern - Patrón de validación @param string $helpText - Texto de ayuda @param bool $readonly - Campo de solo lectura @param bool $disabled - Campo deshabilitado --}} @props([ 'name', 'label', 'type' => 'text', 'value' => null, 'placeholder' => null, 'required' => false, 'maxlength' => null, 'minlength' => null, 'pattern' => null, 'helpText' => null, 'readonly' => false, 'disabled' => false, 'class' => '' ]) @php $fieldId = $name . '_' . uniqid(); $value = $value ?? old($name); $hasError = $errors->has($name); @endphp
@if($helpText) {{ $helpText }} @endif @if($maxlength) {{ strlen($value) }}/{{ $maxlength }} caracteres @endif @if($hasError)
{{ $errors->first($name) }}
@endif