Debian Codegraph @

node/@patternfly/patternfly/components/Progress/progress.scss

raw
1 @use '../../sass-utilities' as *;
2
3 @include pf-root($progress) {
4 // Component variables
5 --#{$progress}--GridGap: var(--pf-t--global--spacer--md);
6
7 // Element variables
8 --#{$progress}__bar--Height: var(--pf-t--global--spacer--md);
9 --#{$progress}__bar--BackgroundColor: var(--pf-t--global--color--nonstatus--gray--default); // the bar always needs white under it so that the semi-transparent color shows correctly
10 --#{$progress}__bar--BorderRadius: var(--pf-t--global--border--radius--pill);
11 --#{$progress}__bar--BorderColor: var(--pf-t--global--border--color--high-contrast);
12 --#{$progress}__bar--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular);
13 --#{$progress}__measure--m-static-width--MinWidth: 4.5ch; // 4.5 because the % character is wider than a 0
14 --#{$progress}__status--Gap: var(--pf-t--global--spacer--sm);
15 --#{$progress}__status-icon--Color: var(--pf-t--global--icon--color--regular);
16 --#{$progress}__indicator--Height: var(--#{$progress}__bar--Height);
17 --#{$progress}__indicator--BackgroundColor: var(--pf-t--global--color--brand--default);
18 --#{$progress}__indicator--BorderWidth: var(--pf-t--global--border--width--high-contrast--extra-strong);
19 --#{$progress}__indicator--BorderColor: transparent;
20 --#{$progress}__indicator--BorderRadius: var(--pf-t--global--border--radius--pill);
21 --#{$progress}__helper-text--MarginBlockStart: calc(var(--pf-t--global--spacer--sm) - var(--#{$progress}--GridGap));
22
23 // Modifier variables
24 --#{$progress}--m-success__indicator--BackgroundColor: var(--pf-t--global--color--status--success--default);
25 --#{$progress}--m-warning__indicator--BackgroundColor: var(--pf-t--global--color--status--warning--default);
26 --#{$progress}--m-danger__indicator--BackgroundColor: var(--pf-t--global--color--status--danger--default);
27 --#{$progress}--m-success__status-icon--Color: var(--pf-t--global--icon--color--status--success--default);
28 --#{$progress}--m-warning__status-icon--Color: var(--pf-t--global--icon--color--status--warning--default);
29 --#{$progress}--m-danger__status-icon--Color: var(--pf-t--global--icon--color--status--danger--default);
30 --#{$progress}--m-inside__indicator--MinWidth: var(--pf-t--global--spacer--xl);
31 --#{$progress}--m-inside__measure--Color: var(--pf-t--global--text--color--on-brand--default);
32 --#{$progress}--m-success--m-inside__measure--Color: var(--pf-t--global--text--color--status--on-success--default);
33 --#{$progress}--m-warning--m-inside__measure--Color: var(--pf-t--global--text--color--status--on-warning--default);
34 --#{$progress}--m-danger--m-inside__measure--Color: var(--pf-t--global--text--color--status--on-danger--default);
35 --#{$progress}--m-inside__measure--FontSize: var(--pf-t--global--font--size--sm);
36 --#{$progress}--m-outside__measure--FontSize: var(--pf-t--global--font--size--sm);
37 --#{$progress}--m-sm__bar--Height: var(--pf-t--global--spacer--sm);
38 --#{$progress}--m-sm__measure--FontSize: var(--pf-t--global--font--size--body--sm);
39 --#{$progress}--m-lg__bar--Height: var(--pf-t--global--spacer--lg);
40 }
41
42 .#{$progress} {
43 display: grid;
44 grid-template-rows: 1fr auto;
45 grid-template-columns: auto auto;
46 gap: var(--#{$progress}--GridGap);
47 align-items: end;
48
49 // Modifiers
50 // size modifiers
51 &.pf-m-sm {
52 --#{$progress}__bar--Height: var(--#{$progress}--m-sm__bar--Height);
53
54 .#{$progress}__measure {
55 font-size: var(--#{$progress}--m-sm__measure--FontSize);
56 }
57 }
58
59 &.pf-m-lg {
60 --#{$progress}__bar--Height: var(--#{$progress}--m-lg__bar--Height);
61 }
62
63 // an inside-style progress component shows the measure inside the indicator
64 &.pf-m-inside {
65 .#{$progress}__indicator {
66 display: flex;
67 align-items: center;
68 justify-content: center;
69 min-width: var(--#{$progress}--m-inside__indicator--MinWidth);
70 }
71
72 .#{$progress}__measure {
73 font-size: var(--#{$progress}--m-inside__measure--FontSize);
74 color: var(--#{$progress}--m-inside__measure--Color);
75 text-align: center;
76 }
77 }
78
79 // an outside-style progress component shows the measure and status icon to the right of the bar
80 &.pf-m-outside {
81 .#{$progress}__description {
82 grid-column: 1 / 3;
83 }
84
85 .#{$progress}__status {
86 grid-row: 2 / 3;
87 grid-column: 2 / 3;
88 align-self: center;
89 }
90
91 .#{$progress}__measure {
92 display: inline-block;
93 font-size: var(--#{$progress}--m-outside__measure--FontSize);
94
95 &.pf-m-static-width {
96 min-width: var(--#{$progress}__measure--m-static-width--MinWidth);
97 text-align: start;
98 }
99 }
100
101 .#{$progress}__bar,
102 .#{$progress}__indicator {
103 grid-column: 1 / 2;
104 }
105 }
106
107 // No Description. If a measure or status is needed, use with inside or outside measure modifier.
108 &.pf-m-singleline {
109 grid-template-rows: 1fr;
110
111 .#{$progress}__description {
112 display: none;
113 }
114
115 .#{$progress}__bar {
116 grid-row: 1 / 2;
117 grid-column: 1 / 2;
118 }
119
120 .#{$progress}__status {
121 grid-row: 1 / 2;
122 grid-column: 2 / 3;
123 }
124 }
125
126 &.pf-m-outside,
127 &.pf-m-singleline {
128 grid-template-columns: 1fr fit-content(50%);
129 }
130
131 // status modifiers
132 &.pf-m-success {
133 --#{$progress}__indicator--BackgroundColor: var(--#{$progress}--m-success__indicator--BackgroundColor);
134 --#{$progress}__status-icon--Color: var(--#{$progress}--m-success__status-icon--Color);
135 --#{$progress}--m-inside__measure--Color: var(--#{$progress}--m-success--m-inside__measure--Color);
136 }
137
138 &.pf-m-warning {
139 --#{$progress}__indicator--BackgroundColor: var(--#{$progress}--m-warning__indicator--BackgroundColor);
140 --#{$progress}__status-icon--Color: var(--#{$progress}--m-warning__status-icon--Color);
141 --#{$progress}--m-inside__measure--Color: var(--#{$progress}--m-warning--m-inside__measure--Color);
142 }
143
144 &.pf-m-danger {
145 --#{$progress}__indicator--BackgroundColor: var(--#{$progress}--m-danger__indicator--BackgroundColor);
146 --#{$progress}__status-icon--Color: var(--#{$progress}--m-danger__status-icon--Color);
147 --#{$progress}--m-inside__measure--Color: var(--#{$progress}--m-danger--m-inside__measure--Color);
148
149 .#{$progress}__bar {
150 @media (prefers-reduced-motion: no-preference) {
151 @include pf-v6-animate-danger-jiggle;
152 }
153 }
154
155 .#{$progress}__status-icon {
156 @include pf-v6-fade-default(#{$progress});
157 }
158 }
159 }
160
161 // Elements
162
163 // the progress__description is displayed above the progress bar on the left
164 .#{$progress}__description {
165 grid-column: 1 / 2;
166 overflow-wrap: anywhere;
167
168 &.pf-m-truncate {
169 @include pf-v6-text-overflow;
170 }
171 }
172
173 // the progress__status is displayed in the upper right
174 .#{$progress}__status {
175 display: flex;
176 grid-row: 1 / 2;
177 grid-column: 2 / 3;
178 gap: var(--#{$progress}__status--Gap);
179 align-items: flex-start;
180 justify-content: flex-end;
181 text-align: end;
182 overflow-wrap: anywhere;
183 }
184
185 // the progress__status-icon is an icon displayed always in the upper right
186 .#{$progress}__status-icon {
187 color: var(--#{$progress}__status-icon--Color);
188 }
189
190 .#{$progress}__bar::before,
191 .#{$progress}__indicator {
192 inset-block-start: 0;
193 inset-inline-start: 0;
194 }
195
196 // The progress__bar is a white underlay with a semi-transparent color on top, which matches the progress__indicator color
197 .#{$progress}__bar {
198 position: relative;
199 grid-row: 2 / 3;
200 grid-column: 1 / 3;
201 align-self: center;
202 height: var(--#{$progress}__bar--Height);
203 overflow: hidden;
204 background-color: var(--#{$progress}__bar--BackgroundColor);
205 border-radius: var(--#{$progress}__bar--BorderRadius);
206
207 &::before {
208 position: absolute;
209 inset: 0;
210 pointer-events: none;
211 content: '';
212 border: var(--#{$progress}__bar--BorderWidth) solid var(--#{$progress}__bar--BorderColor);
213 border-radius: inherit;
214 }
215 }
216
217 // the progress__indicator is the part that advances (widens) as progress is made
218 // It is assumed that the width of the progress__indicator is set inline or via Javascript
219 .#{$progress}__indicator {
220 position: absolute; // position absolute to bring above the semi-transparent bar overlay
221 height: var(--#{$progress}__indicator--Height);
222 background-color: var(--#{$progress}__indicator--BackgroundColor);
223 border-radius: var(--#{$progress}__indicator--BorderRadius);
224
225 // for forced colors mode
226 &::before {
227 position: absolute;
228 inset: 0;
229 content: "";
230 border: var(--#{$progress}__indicator--BorderWidth) solid var(--#{$progress}__indicator--BorderColor);
231 border-radius: var(--#{$progress}__bar--BorderRadius);
232 }
233 }
234
235 .#{$progress}__helper-text {
236 grid-row: 3 / 4;
237 grid-column: 1 / 3;
238 margin-block-start: var(--#{$progress}__helper-text--MarginBlockStart);
239 }
240
241 .#{$progress}__measure {
242 font-variant-numeric: tabular-nums;
243 }