@php
    /**
     * Admin UI Component: Mini Bar Row (link)
     *
     * Required:
     * - $href
     * - $label
     * - $pct
     * - $value
     *
     * Optional:
     * - $rowRole
     * - $barRole
     * - $title
     * - $ariaLabel
     * - $class
     */

    $href = (string) ($href ?? '#');
    $label = (string) ($label ?? '');
    $pct = (float) ($pct ?? 0);
    $value = (string) ($value ?? '');

    $rowRole = (string) ($rowRole ?? '');
    $barRole = (string) ($barRole ?? '');
    $title = (string) ($title ?? '');
    $ariaLabel = (string) ($ariaLabel ?? '');
    $class = (string) ($class ?? '');

    $pct = max(0, min(100, $pct));
@endphp

<a class="adm-mini-bar-row adm-mini-bar-row-link {{ $class }}"
   @if($rowRole !== '') data-role="{{ $rowRole }}" @endif
   href="{!! $href !!}"
   @if($ariaLabel !== '') aria-label="{{ $ariaLabel }}" @endif
>
    <div class="adm-mini-bar-label" title="{{ $label }}">{{ $label }}</div>

    @include('admin.components.mini_bar', [
        'role' => $barRole,
        'pct' => $pct,
        'title' => $title,
    ])

    <div class="adm-mini-bar-value" title="{{ $value }}">{{ $value }}</div>
</a>
