Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/input.blade.php
Joseph.Rawlings b7b81b0d3a Refactor components to align with AdminLTE styles
- Updated alert component to use AdminLTE variant classes and added callout support.
- Refined badge component with AdminLTE base and variant classes, including size adjustments.
- Modified button component to implement AdminLTE button styles and improved loading indicators.
- Enhanced card component with AdminLTE variant classes and improved header/footer structure.
- Adjusted input component to follow AdminLTE design, including size classes and icon handling.
- Updated layout component to streamline button styles and loading indicators.
- Refined progress component to utilize AdminLTE styles for size and variant classes.
- Enhanced table component with AdminLTE table classes and improved loading state representation.
2025-12-17 17:55:03 -05:00

117 lines
3.6 KiB
PHP

@props([
'label' => null,
'id' => null,
'name' => null,
'type' => 'text',
'placeholder' => null,
'hint' => null,
'error' => null,
'required' => false,
'disabled' => false,
'readonly' => false,
'prefix' => null,
'suffix' => null,
'icon' => null,
'iconPosition' => 'left',
'size' => 'md',
])
@php
$inputId = $id ?? $name ?? Str::random(8);
// AdminLTE size classes
$sizeClasses = match($size) {
'sm' => 'lte-form-control-sm',
'md' => '',
'lg' => 'lte-form-control-lg',
default => '',
};
$iconSizeClasses = match($size) {
'sm' => 'size-4',
'md' => 'size-4',
'lg' => 'size-5',
default => 'size-4',
};
// AdminLTE input classes
$inputClasses = "lte-form-control $sizeClasses";
if ($error) {
$inputClasses .= ' is-invalid';
}
@endphp
<div {{ $attributes->only('class')->merge(['class' => 'mb-3']) }}>
{{-- Label --}}
@if($label)
<label for="{{ $inputId }}" class="form-label" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">
{{ $label }}
@if($required)
<span class="lte-text-danger">*</span>
@endif
</label>
@endif
{{-- Input wrapper --}}
@if($icon || $prefix || $suffix)
<div class="lte-input-group">
{{-- Left icon/prefix --}}
@if($icon && $iconPosition === 'left')
<span class="lte-input-group-text">
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
</span>
@endif
@if($prefix)
<span class="lte-input-group-text">{{ $prefix }}</span>
@endif
{{-- Input --}}
<input
type="{{ $type }}"
id="{{ $inputId }}"
@if($name) name="{{ $name }}" @endif
@if($placeholder) placeholder="{{ $placeholder }}" @endif
@if($required) required @endif
@if($disabled) disabled @endif
@if($readonly) readonly @endif
{{ $attributes->except('class')->merge(['class' => $inputClasses]) }}
>
{{-- Right icon/suffix --}}
@if($icon && $iconPosition === 'right')
<span class="lte-input-group-text">
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
</span>
@endif
@if($suffix)
<span class="lte-input-group-text">{{ $suffix }}</span>
@endif
</div>
@else
{{-- Simple input without addon --}}
<input
type="{{ $type }}"
id="{{ $inputId }}"
@if($name) name="{{ $name }}" @endif
@if($placeholder) placeholder="{{ $placeholder }}" @endif
@if($required) required @endif
@if($disabled) disabled @endif
@if($readonly) readonly @endif
{{ $attributes->except('class')->merge(['class' => $inputClasses]) }}
>
@endif
{{-- Hint text --}}
@if($hint && !$error)
<small class="lte-text-muted" style="display: block; margin-top: 0.25rem;">{{ $hint }}</small>
@endif
{{-- Error message --}}
@if($error)
<div class="invalid-feedback" style="display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; color: var(--lte-danger);">
<x-ri-error-warning-line class="size-3.5" />
{{ $error }}
</div>
@endif
</div>