1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4import { CosmicPalette } from "styling.slint";
5
6export component ProgressIndicator {
7 in property <float> progress;
8 in property <bool> indeterminate;
9
10 min-height: 4px;
11 horizontal-stretch: 1;
12 vertical-stretch: 0;
13 accessible-role: progress-indicator;
14 accessible-value: !root.indeterminate ? root.progress : "";
15 accessible-value-minimum: 0.0;
16 accessible-value-maximum: 1.0;
17
18 Rectangle {
19 clip: true;
20 border-radius: 2px;
21 background: CosmicPalette.neutral-6-background;
22
23 track := Rectangle {
24 width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
25 height: 100%;
26 x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
27 border-radius: parent.border-radius;
28 background: CosmicPalette.secondary-accent-background;
29 }
30 }
31}
32