Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/progress.blade.php
Joseph.Rawlings af62a16354 Refactor modal close behavior and improve styling
- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals.
- Updated various modal button styles for consistency and improved accessibility.
- Adjusted transition durations for modal animations to enhance user experience.
- Added aria-labels to close buttons for better screen reader support.
2026-02-23 20:02:41 -05:00

76 lines
2.3 KiB
PHP

{{--
Progress Bar Component - LucentUI Theme
Migrated from AdminLTE to Tailwind
Usage:
<x-proxmox::ui.progress :value="75" />
<x-proxmox::ui.progress :value="90" color="danger" showLabel />
<x-proxmox::ui.progress :value="60" color="auto" />
--}}
@props([
'value' => 0,
'max' => 100,
'color' => 'primary',
'size' => 'md',
'showLabel' => false,
'label' => null,
'gradient' => null,
'animated' => false,
'striped' => false,
])
@php
$percent = $max > 0 ? min(100, ($value / $max) * 100) : 0;
$colorClasses = [
'primary' => 'bg-primary',
'secondary' => 'bg-secondary',
'success' => 'bg-success',
'warning' => 'bg-warning',
'danger' => 'bg-error',
'info' => 'bg-info',
];
$sizeClasses = [
'xs' => 'h-1',
'sm' => 'h-2',
'md' => 'h-3',
'lg' => 'h-4',
'xl' => 'h-5',
];
$colorClass = $colorClasses[$color] ?? $colorClasses['primary'];
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['md'];
// Auto-select color based on value if specified
if ($color === 'auto') {
if ($percent >= 90) {
$colorClass = $colorClasses['danger'];
} elseif ($percent >= 70) {
$colorClass = $colorClasses['warning'];
} else {
$colorClass = $colorClasses['success'];
}
}
@endphp
<div {{ $attributes->class(['w-full']) }}>
@if($showLabel || $label)
<div class="mb-2 flex items-center justify-between text-sm">
<span class="font-medium text-secondary dark:text-base/60">{{ $label ?? 'Usage' }}</span>
<span class="font-semibold text-primary dark:text-base/90">{{ number_format($percent, 1) }}%</span>
</div>
@endif
<div class="{{ $sizeClass }} w-full bg-neutral/30 rounded-full overflow-hidden">
<div
class="{{ $colorClass }} h-full rounded-full transition-all duration-500 {{ $striped ? 'progress-striped' : '' }} {{ $animated ? 'progress-animated' : '' }}"
role="progressbar"
style="width: {{ $percent }}%; {{ $gradient ? 'background-image: ' . $gradient . ';' : '' }}"
aria-valuenow="{{ $percent }}"
aria-valuemin="0"
aria-valuemax="100"
></div>
</div>
</div>