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

22 lines
731 B
Svelte

<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
<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>