@props([ 'name' => null, 'id' => null, 'label' => null, 'type' => 'text', 'placeholder' => null, 'value' => null, 'required' => false, 'disabled' => false, 'readonly' => false, 'helper' => null, 'error' => null, 'containerClass' => 'w-full', 'inputClass' => '', 'leftIcon' => null, 'rightIcon' => null, 'variant' => 'default', // Options: default, underlined, floating ]) @php $inputId = $id ?? $name ?? 'input-' . Str::random(6); // Define classes for different variants $variantClasses = [ 'default' => 'input', 'underlined' => 'py-2 px-3 w-full border-0 border-b border-base-content/30 focus:border-primary focus:ring-0 bg-transparent rounded-none', 'floating' => 'peer input pt-4', ]; // Get the appropriate class for the selected variant $variantClass = $variantClasses[$variant] ?? $variantClasses['default']; @endphp
@if($label && $variant !== 'floating') @endif
@if($leftIcon) @endif merge(['class' => $variantClass . ' w-full ' . ($leftIcon ? 'pl-10 ' : '') . ($rightIcon ? 'pr-10 ' : '') . ($error ? ($variant === 'underlined' ? 'border-error' : 'input-error ') : '') . $inputClass]) }} /> @if($rightIcon) @endif @if($variant === 'floating') @endif
@if($helper && !$error)
{{ $helper }}
@endif @if($error)
{{ $error }}
@endif