Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/copyable.blade.php
Joseph.Rawlings b4e2923a2c refactor: update Proxmox UI components to use TailAdmin styling
- Changed component styles and classes to align with TailAdmin design patterns.
- Updated color schemes, typography, and layout for consistency across components.
- Refactored Info Row, Network Address Card, Notice Banner, Progress Bar, Resource Gauge, Section Header, Server Status, Spinner, Stat Card, and Tab Panel components.
- Enhanced responsiveness and accessibility features in various components.
2025-12-17 12:33:10 -05:00

57 lines
2.3 KiB
PHP

{{--
Copyable Text Component - TailAdmin style
Text field with copy to clipboard functionality
Usage:
<x-proxmox::ui.copyable label="IPv4 Address" value="192.168.1.1" />
--}}
@props([
'label' => null,
'value',
'masked' => false,
])
<div class="space-y-2">
@if($label)
<label class="text-theme-sm font-medium text-gray-700 dark:text-gray-300">{{ $label }}</label>
@endif
<div
x-data="{
copied: false,
showValue: @js(!$masked),
copyText: @js($value),
copyToClipboard() {
navigator.clipboard.writeText(this.copyText);
this.copied = true;
setTimeout(() => this.copied = false, 2000);
}
}"
class="flex items-center gap-2.5 rounded-lg border border-gray-300 bg-gray-50 px-4 py-2.5 text-theme-sm transition-colors duration-150 dark:border-gray-700 dark:bg-gray-800"
>
@if($masked)
<span class="flex-1 truncate font-mono text-gray-700 dark:text-gray-300" x-text="showValue ? copyText : '••••••••••••'"></span>
<button
@click="showValue = !showValue"
type="button"
class="text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300"
:aria-label="showValue ? 'Hide value' : 'Show value'"
>
<x-ri-eye-line x-show="!showValue" class="size-4" />
<x-ri-eye-off-line x-show="showValue" x-cloak class="size-4" />
</button>
@else
<span class="flex-1 truncate font-mono text-gray-700 dark:text-gray-300">{{ $value }}</span>
@endif
<button
@click="copyToClipboard()"
type="button"
class="relative inline-flex size-5 items-center justify-center text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300"
aria-label="Copy to clipboard"
>
<x-ri-check-fill x-show="copied" x-transition x-cloak class="absolute size-4 text-success-500" />
<x-ri-file-copy-line x-show="!copied" x-transition class="absolute size-4" />
</button>
</div>
</div>