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 { CupertinoPalette } from "styling.slint";
5
6export component ProgressIndicator {
7 in property <float> progress;
8 in property <bool> indeterminate;
9
10 min-height: 6px;
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: 3px;
21
22 i-rail := Rectangle {
23 border-radius: parent.border-radius;
24 background: CupertinoPalette.alternate-control-background;
25 border-width: 0.5px;
26 border-color: CupertinoPalette.border;
27 clip: true;
28
29 Rectangle {
30 border-width: 1px;
31 border-color: @radial-gradient(circle, #00000026, #00000000);
32 border-radius: parent.border-radius;
33 }
34 }
35
36 i-track := Rectangle {
37 width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
38 height: 100%;
39 x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
40 border-radius: parent.border-radius;
41 background: CupertinoPalette.accent-background;
42 }
43 }
44}
45