Skip to content

Commit 8141f1a

Browse files
authored
Progressbars - fix issues after the refactoring (#15270)
1 parent 05ca1be commit 8141f1a

File tree

11 files changed

+241
-153
lines changed

11 files changed

+241
-153
lines changed

projects/igniteui-angular/src/lib/core/styles/components/progress/circular/_circular-theme.scss

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@
8181
$diameter: calc(var(--circular-size) + var(--stroke-thickness));
8282
$radius: calc(var(--circular-size) / 2 - var(--stroke-thickness) * .5);
8383
$circumference: calc(#{$radius} * 2 * 3.1416);
84-
8584
$variant: map.get($theme, '_meta', 'variant');
86-
$stroke-width: rem(4px);
87-
88-
$font-size: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness)), 1px);
89-
$font-size-fraction: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness) - rem(2px)), 1px);
9085

9186
%display-circular {
9287
--circular-size: calc(#{var-get($theme, 'diameter')} - var(--stroke-thickness));
@@ -128,7 +123,7 @@
128123

129124
%outer {
130125
@if $variant != 'bootstrap' {
131-
animation: initial-dashoffset var(--_transition-duration) linear;
126+
animation: igx-initial-dashoffset var(--_transition-duration) linear;
132127
} @else {
133128
stroke-width: var(--stroke-thickness);
134129
}
@@ -142,7 +137,7 @@
142137
%display-circular:not(%display-circular--indeterminate) {
143138
svg {
144139
%outer {
145-
animation: initial-dashoffset var(--_transition-duration) linear;
140+
animation: igx-initial-dashoffset var(--_transition-duration) linear;
146141
stroke-dasharray: #{$circumference} #{$circumference};
147142
stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference});
148143
}
@@ -152,15 +147,17 @@
152147
%display-circular:dir(rtl):not(%display-circular--indeterminate) {
153148
svg {
154149
%outer {
155-
animation: initial-dashoffset-rtl var(--_transition-duration) linear;
150+
animation: igx-initial-dashoffset-rtl var(--_transition-duration) linear;
156151
animation-direction: reverse;
157152
}
158153
}
159154
}
160155

161156
%display-circular--indeterminate {
162157
svg {
163-
animation: 3s linear 0s infinite $animation-direction none running rotate-center;
158+
@if $variant != 'fluent' {
159+
animation: 3s linear 0s infinite $animation-direction none running rotate-center;
160+
}
164161

165162
@if $variant != 'bootstrap' {
166163
transform-origin: 50% 50%;
@@ -179,9 +176,9 @@
179176

180177
@if $variant == 'fluent' {
181178
stroke-linecap: round;
182-
animation: 2s linear 0s infinite normal none running indeterminate-circular-fluent
179+
animation: 2s linear 0s infinite normal none running igx-indeterminate-circular-fluent
183180
} @else {
184-
animation: indeterminate-accordion 1.5s cubic-bezier(0, 0.085, 0.68, 0.53) $animation-direction infinite;
181+
animation: igx-indeterminate-accordion 1.5s cubic-bezier(0, 0.085, 0.68, 0.53) $animation-direction infinite;
185182
}
186183

187184
@if $variant == 'bootstrap' {
@@ -198,7 +195,7 @@
198195

199196
%outer {
200197
@if $variant == 'fluent' {
201-
animation-name: indeterminate-circular-fluent-rtl;
198+
animation-name: igx-indeterminate-circular-fluent-rtl;
202199
}
203200

204201
@if $variant == 'bootstrap' {
@@ -233,12 +230,17 @@
233230
stroke-dasharray: #{$circumference} #{$circumference};
234231
stroke-dashoffset: calc(#{$circumference} - var(--_progress-whole, 0) * #{$circumference});
235232
transition: stroke-dashoffset var(--_transition-duration) linear;
236-
stroke-width: calc(var(--stroke-thickness) + rem(0.75px));
233+
234+
@if $variant == 'material' {
235+
stroke-width: calc(var(--stroke-thickness) + rem(0.75px));
236+
} @else {
237+
stroke-width: var(--stroke-thickness);
238+
}
237239
}
238240

239241
%outer--indeterminate {
240242
stroke-dasharray: 289;
241-
@include animation(indeterminate-accordion 1.5s cubic-bezier(0, .085, .68, .53) normal infinite);
243+
@include animation(igx-indeterminate-accordion var(--_transition-duration) cubic-bezier(0, .085, .68, .53) normal infinite);
242244
}
243245

244246
%inner,
@@ -255,7 +257,7 @@
255257
%text {
256258
position: absolute;
257259
color: var-get($theme, 'text-color');
258-
260+
font-size: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness)), 1px);
259261
line-height: normal;
260262
text-align: center;
261263
font-weight: 600;
@@ -264,6 +266,7 @@
264266
font-weight: 700;
265267
}
266268

269+
animation: igx-initial-counter var(--_transition-duration) ease-in-out;
267270
counter-reset:
268271
progress-integer var(--_progress-integer, 0)
269272
progress-fraction var(--_progress-fraction, 0);
@@ -273,16 +276,12 @@
273276
}
274277

275278
%text:not(%text--fraction) {
276-
font-size: #{$font-size};
277-
278279
&::before {
279280
content: counter(progress-integer) '%';
280281
}
281282
}
282283

283284
%text--fraction {
284-
font-size: #{$font-size-fraction};
285-
286285
&::before {
287286
content: counter(progress-integer) '.' counter(progress-fraction, decimal-leading-zero) '%';
288287
}
@@ -300,7 +299,7 @@
300299
stop-color: var-get($theme, 'progress-circle-color-end');
301300
}
302301

303-
@keyframes indeterminate-accordion {
302+
@keyframes igx-indeterminate-accordion {
304303
0% {
305304
stroke-dashoffset: calc(#{$circumference} * 2);
306305
stroke-dasharray: calc(#{$circumference} * 9 / 10);
@@ -311,7 +310,7 @@
311310
}
312311
}
313312

314-
@keyframes indeterminate-accordion-rtl {
313+
@keyframes igx-indeterminate-accordion-rtl {
315314
0% {
316315
stroke-dashoffset: calc(#{$circumference} * -2);
317316
stroke-dasharray: calc(#{$circumference} * 9 / 10);
@@ -324,7 +323,7 @@
324323

325324
// Fluent: Circular progress animation for indeterminate state.
326325
// Dynamically changes stroke-dasharray and rotates for a smooth spinning effect.
327-
@keyframes indeterminate-circular-fluent {
326+
@keyframes igx-indeterminate-circular-fluent {
328327
0% {
329328
// Start the stroke at the correct position by adjusting the dasharray and dashoffset
330329
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference};
@@ -355,7 +354,7 @@
355354
}
356355
}
357356

358-
@keyframes indeterminate-circular-fluent-rtl {
357+
@keyframes igx-indeterminate-circular-fluent-rtl {
359358
0% {
360359
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference};
361360

@@ -381,8 +380,26 @@
381380
}
382381
}
383382

383+
@keyframes igx-initial-dashoffset {
384+
from {
385+
/* Start with no progress (0%) */
386+
stroke-dashoffset: #{$circumference};
387+
}
388+
389+
to {
390+
stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference});
391+
}
392+
}
393+
384394
// Generic animations
385-
@keyframes rotate-center {
395+
@keyframes igc-initial-counter {
396+
from {
397+
--_progress-integer: 0;
398+
--_progress-fraction: 0;
399+
}
400+
}
401+
402+
@keyframes igx-rotate-center {
386403
0% {
387404
transform: rotate(0);
388405
}
@@ -392,9 +409,9 @@
392409
}
393410
}
394411

395-
%animation-none {
396-
animation-name: none;
397-
animation-duration: 0s;
412+
// Reset the transition if the animate prop is set to false.
413+
%animation-none:not(%display-circular--indeterminate) {
414+
--_transition-duration: 0s !important;
398415
}
399416

400417
%hide-counter {

projects/igniteui-angular/src/lib/core/styles/components/progress/linear/_linear-component.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
@include e(indicator-secondary) {
6464
@extend %indicator__indeterminate-secondary !optional;
6565
}
66+
67+
@include e(value) {
68+
@extend %value--hidden !optional;
69+
}
6670
}
6771

6872
@include m(animation-none) {
@@ -71,9 +75,7 @@
7175

7276
@include m(hide-counter) {
7377
@include e(value) {
74-
&::before {
75-
@extend %value--hidden !optional;
76-
}
78+
@extend %hide-counter !optional;
7779
}
7880
}
7981
}

0 commit comments

Comments
 (0)