- Updated tab-panel component to use Tailwind for styling and transitions. - Refactored table-row component to implement Tailwind classes for hover effects and borders. - Converted table-td component to utilize Tailwind for alignment and text styles. - Changed table-th component to apply Tailwind for header styling and sorting indicators. - Revised table component to adopt Tailwind for layout, borders, and responsive design. - Enhanced tabs component with Tailwind for navigation styles and transitions. - Updated toggle component to use Tailwind for switch styles and accessibility. - Refactored tooltip component to implement Tailwind for positioning and styling. - Added visual enhancements to app.css for improved UI interactions and animations.
117 lines
4.5 KiB
PHP
117 lines
4.5 KiB
PHP
@props([
|
|
'type' => 'button',
|
|
'variant' => 'primary',
|
|
'size' => 'md',
|
|
'icon' => null,
|
|
'iconPosition' => 'left',
|
|
'iconClass' => null,
|
|
'loading' => false,
|
|
'disabled' => false,
|
|
'fullWidth' => false,
|
|
'href' => null,
|
|
'outline' => false,
|
|
'rounded' => 'lg',
|
|
])
|
|
|
|
@php
|
|
// LucentUI button base classes
|
|
$baseClasses = 'inline-flex items-center justify-center gap-2 font-semibold transition-all duration-200 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 active:scale-95';
|
|
|
|
// Size classes
|
|
$sizeClasses = match($size) {
|
|
'xs' => 'px-2 py-1 text-xs',
|
|
'sm' => 'px-3 py-1.5 text-sm',
|
|
'md' => 'px-4 py-2 text-sm',
|
|
'lg' => 'px-5 py-2.5 text-base',
|
|
'xl' => 'px-6 py-3 text-base',
|
|
default => 'px-4 py-2 text-sm',
|
|
};
|
|
|
|
// Icon size classes
|
|
$iconSizeClasses = $iconClass ?? match($size) {
|
|
'xs' => 'size-3',
|
|
'sm' => 'size-3.5',
|
|
'md' => 'size-4',
|
|
'lg' => 'size-5',
|
|
'xl' => 'size-5',
|
|
default => 'size-4',
|
|
};
|
|
|
|
// Variant classes - LucentUI Tailwind
|
|
$variantClasses = match($variant) {
|
|
'primary' => $outline
|
|
? 'border border-primary text-primary bg-transparent hover:bg-primary/10 focus:ring-2 focus:ring-primary/50'
|
|
: 'bg-primary text-white hover:bg-primary/80 focus:ring-2 focus:ring-primary/50',
|
|
'secondary' => $outline
|
|
? 'border border-neutral text-base/80 bg-transparent hover:bg-neutral/10 focus:ring-2 focus:ring-neutral/50'
|
|
: 'bg-background-secondary text-base/80 border border-neutral hover:bg-background-secondary/80 focus:ring-2 focus:ring-neutral/50',
|
|
'success' => $outline
|
|
? 'border border-success text-success bg-transparent hover:bg-success/10 focus:ring-2 focus:ring-success/50'
|
|
: 'bg-success text-white hover:bg-success/80 focus:ring-2 focus:ring-success/50',
|
|
'danger' => $outline
|
|
? 'border border-error text-error bg-transparent hover:bg-error/10 focus:ring-2 focus:ring-error/50'
|
|
: 'bg-error text-white hover:bg-error/80 focus:ring-2 focus:ring-error/50',
|
|
'warning' => $outline
|
|
? 'border border-warning text-warning bg-transparent hover:bg-warning/10 focus:ring-2 focus:ring-warning/50'
|
|
: 'bg-warning text-white hover:bg-warning/80 focus:ring-2 focus:ring-warning/50',
|
|
'info' => $outline
|
|
? 'border border-info text-info bg-transparent hover:bg-info/10 focus:ring-2 focus:ring-info/50'
|
|
: 'bg-info text-white hover:bg-info/80 focus:ring-2 focus:ring-info/50',
|
|
'ghost' => 'text-base/80 bg-transparent hover:bg-neutral/10 focus:ring-2 focus:ring-neutral/50',
|
|
'link' => 'text-primary bg-transparent hover:underline p-0',
|
|
'neutral' => $outline
|
|
? 'border border-neutral text-base/70 bg-transparent hover:bg-neutral/10 focus:ring-2 focus:ring-neutral/50'
|
|
: 'bg-neutral/20 text-base/80 hover:bg-neutral/30 focus:ring-2 focus:ring-neutral/50',
|
|
default => $outline
|
|
? 'border border-primary text-primary bg-transparent hover:bg-primary/10 focus:ring-2 focus:ring-primary/50'
|
|
: 'bg-primary text-white hover:bg-primary/80 focus:ring-2 focus:ring-primary/50',
|
|
};
|
|
|
|
// Full width
|
|
$widthClasses = $fullWidth ? 'w-full' : '';
|
|
|
|
// Border radius
|
|
$roundedClasses = match($rounded) {
|
|
'none' => 'rounded-none',
|
|
'sm' => 'rounded-sm',
|
|
'md' => 'rounded-md',
|
|
'lg' => 'rounded-lg',
|
|
'xl' => 'rounded-xl',
|
|
'full' => 'rounded-full',
|
|
default => 'rounded-lg',
|
|
};
|
|
|
|
// Combined classes
|
|
$classes = trim("$baseClasses $sizeClasses $variantClasses $widthClasses $roundedClasses");
|
|
@endphp
|
|
|
|
@if($href)
|
|
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
|
|
@else
|
|
<button
|
|
type="{{ $type }}"
|
|
{{ $disabled || $loading ? 'disabled' : '' }}
|
|
{{ $attributes->merge(['class' => $classes]) }}
|
|
>
|
|
@endif
|
|
|
|
@if($loading)
|
|
<x-ri-loader-5-fill class="{{ $iconSizeClasses }} animate-spin" />
|
|
@elseif($icon && $iconPosition === 'left')
|
|
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
|
|
@endif
|
|
|
|
@if($slot->isNotEmpty())
|
|
<span>{{ $slot }}</span>
|
|
@endif
|
|
|
|
@if($icon && $iconPosition === 'right' && !$loading)
|
|
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
|
|
@endif
|
|
|
|
@if($href)
|
|
</a>
|
|
@else
|
|
</button>
|
|
@endif
|