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 { MaterialPalette } 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 i-background := Rectangle {
19 background: MaterialPalette.control-background-variant;
20 clip: true;
21
22 i-track := Rectangle {
23 background: MaterialPalette.accent-background;
24 x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
25 y: (parent.height - self.height) / 2;
26 width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
27 border-radius: i-background.border-radius;
28 }
29 }
30}
31