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.
This commit is contained in:
2025-12-17 17:55:03 -05:00
parent e6e0f34d3a
commit b7b81b0d3a
8 changed files with 259 additions and 298 deletions

View File

@@ -19,12 +19,12 @@
@php
$inputId = $id ?? $name ?? Str::random(8);
// Size classes
// AdminLTE size classes
$sizeClasses = match($size) {
'sm' => 'px-3 py-1.5 text-sm',
'md' => 'px-4 py-2 text-sm',
'lg' => 'px-4 py-2.5 text-base',
default => 'px-4 py-2 text-sm',
'sm' => 'lte-form-control-sm',
'md' => '',
'lg' => 'lte-form-control-lg',
default => '',
};
$iconSizeClasses = match($size) {
@@ -34,47 +34,61 @@
default => 'size-4',
};
// Input base classes
$baseClasses = 'w-full bg-background border rounded-lg transition-all duration-200 outline-none';
$focusClasses = 'focus:ring-2 focus:ring-primary/20 focus:border-primary';
$disabledClasses = $disabled ? 'opacity-50 cursor-not-allowed bg-neutral/5' : '';
$errorClasses = $error ? 'border-danger focus:ring-danger/20 focus:border-danger' : 'border-neutral/30';
// Padding adjustments for icons/affixes
$paddingLeft = ($icon && $iconPosition === 'left') || $prefix ? 'pl-10' : '';
$paddingRight = ($icon && $iconPosition === 'right') || $suffix ? 'pr-10' : '';
$inputClasses = "$baseClasses $sizeClasses $focusClasses $disabledClasses $errorClasses $paddingLeft $paddingRight";
// AdminLTE input classes
$inputClasses = "lte-form-control $sizeClasses";
if ($error) {
$inputClasses .= ' is-invalid';
}
@endphp
<div {{ $attributes->only('class')->merge(['class' => 'flex flex-col gap-1.5']) }}>
<div {{ $attributes->only('class')->merge(['class' => 'mb-3']) }}>
{{-- Label --}}
@if($label)
<label for="{{ $inputId }}" class="text-sm font-medium text-base/80">
<label for="{{ $inputId }}" class="form-label" style="display: block; margin-bottom: 0.5rem; font-weight: 500;">
{{ $label }}
@if($required)
<span class="text-danger">*</span>
<span class="lte-text-danger">*</span>
@endif
</label>
@endif
{{-- Input wrapper --}}
<div class="relative">
{{-- Left icon --}}
@if($icon && $iconPosition === 'left')
<div class="absolute left-3 top-1/2 -translate-y-1/2 text-base/50 pointer-events-none">
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
</div>
@endif
{{-- Prefix --}}
@if($prefix)
<div class="absolute left-3 top-1/2 -translate-y-1/2 text-base/50 text-sm pointer-events-none">
{{ $prefix }}
</div>
@endif
{{-- Input --}}
@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 }}"
@@ -85,32 +99,18 @@
@if($readonly) readonly @endif
{{ $attributes->except('class')->merge(['class' => $inputClasses]) }}
>
{{-- Right icon --}}
@if($icon && $iconPosition === 'right')
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-base/50 pointer-events-none">
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
</div>
@endif
{{-- Suffix --}}
@if($suffix)
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-base/50 text-sm pointer-events-none">
{{ $suffix }}
</div>
@endif
</div>
@endif
{{-- Hint text --}}
@if($hint && !$error)
<p class="text-xs text-base/60">{{ $hint }}</p>
<small class="lte-text-muted" style="display: block; margin-top: 0.25rem;">{{ $hint }}</small>
@endif
{{-- Error message --}}
@if($error)
<p class="text-xs text-danger flex items-center gap-1">
<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 }}
</p>
</div>
@endif
</div>