Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/input.blade.php
Joseph.Rawlings 7190d7a818 refactor: update UI components to shadcn-style
- Refactored select component to align with shadcn design principles.
- Updated server status indicator component for consistency with shadcn style.
- Modified spinner component to follow shadcn design guidelines.
- Enhanced stat card component with shadcn-inspired styles.
- Adjusted tab panel component to reflect shadcn design updates.
- Revamped table row and table data cell components to match shadcn aesthetics.
- Updated table header cell component for improved styling consistency.
- Refined table component to align with shadcn design principles.
- Enhanced tabs component with shadcn-inspired styles.
- Updated toggle component to follow shadcn design guidelines.
- Refactored tooltip component to align with shadcn design principles.
- Updated server card component to reflect shadcn-inspired design.
2025-12-17 11:47:42 -05:00

90 lines
2.9 KiB
PHP

{{--
Input Component - shadcn-style
Usage:
<x-proxmox::ui.input name="email" label="Email" />
<x-proxmox::ui.input name="search" placeholder="Search..." icon="ri-search-line" />
<x-proxmox::ui.input name="password" type="password" label="Password" error="Password is required" />
--}}
@props([
'type' => 'text',
'name' => null,
'label' => null,
'placeholder' => null,
'icon' => null,
'iconRight' => null,
'error' => null,
'hint' => null,
'disabled' => false,
'readonly' => false,
'required' => false,
'size' => 'md',
])
@php
$sizeClasses = [
'sm' => 'h-8 text-sm',
'md' => 'h-9 text-sm',
'lg' => 'h-10 text-base',
];
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['md'];
$inputClasses = 'flex w-full rounded-md border bg-transparent px-3 py-1 text-sm transition-colors duration-150 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50';
if ($error) {
$inputClasses .= ' border-danger focus-visible:ring-danger';
} else {
$inputClasses .= ' border-input';
}
if ($icon) {
$inputClasses .= ' ps-9';
}
if ($iconRight) {
$inputClasses .= ' pe-9';
}
@endphp
<div {{ $attributes->only('class')->class(['space-y-2']) }}>
@if($label)
<label @if($name) for="{{ $name }}" @endif class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
{{ $label }}
@if($required)
<span class="text-danger">*</span>
@endif
</label>
@endif
<div class="relative">
@if($icon)
<div class="pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3 text-muted-foreground">
<x-dynamic-component :component="$icon" class="size-4" />
</div>
@endif
<input
type="{{ $type }}"
@if($name) name="{{ $name }}" id="{{ $name }}" @endif
@if($placeholder) placeholder="{{ $placeholder }}" @endif
@if($disabled) disabled @endif
@if($readonly) readonly @endif
@if($required) required @endif
{{ $attributes->except('class')->class([$inputClasses, $sizeClass]) }}
/>
@if($iconRight)
<div class="pointer-events-none absolute inset-y-0 end-0 flex items-center pe-3 text-muted-foreground">
<x-dynamic-component :component="$iconRight" class="size-4" />
</div>
@endif
</div>
@if($error)
<p class="text-[0.8rem] font-medium text-danger">{{ $error }}</p>
@elseif($hint)
<p class="text-[0.8rem] text-muted-foreground">{{ $hint }}</p>
@endif
</div>