Files
ianitor/packages/ui/src/Progress.svelte

22 lines
721 B
Svelte

<!-- SPDX-License-Identifier: CPAL-1.0
- Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
- License 1.0: see LICENSE (its Exhibit A is this file's notice). -->
<script lang="ts">
// Handoff §2.12: the value text follows the countdown; nothing is announced per second.
let { label, max, now, text }: { label: string; max: number; now: number; text: string } =
$props();
const pct = $derived(max > 0 ? Math.min(100, Math.max(0, (now / max) * 100)) : 0);
</script>
<div
class="ia-progress"
role="progressbar"
aria-label={label}
aria-valuemin="0"
aria-valuemax={max}
aria-valuenow={now}
aria-valuetext={text}
>
<span style="width: {pct}%"></span>
</div>