-
Notifications
You must be signed in to change notification settings - Fork 160
[Progress bars]: Bundle theme styles with component #15720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
desig9stein
wants to merge
5
commits into
simeonoff/scoped-styles
Choose a base branch
from
mpopov/scoped-styles/progressbars
base: simeonoff/scoped-styles
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ac2eb4f
refactor(linear-bar): scope component styles
desig9stein 75f1dcd
refactor(circular-bar): scope component styles
desig9stein 0aaff8b
refactor(circular-bar): revert file folder
desig9stein 141ca27
fix(circular-bar): fix material and indigo indeterminate animation
desig9stein bd6acc3
fix(circular-bar): make sure that --igx-circular-bar-fill-color-defau…
desig9stein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
projects/igniteui-angular/src/lib/progressbar/circular/circular-bar.component.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@use 'themes/base'; | ||
@use 'themes/shared'; | ||
@use 'themes/light'; | ||
@use 'themes/dark'; |
261 changes: 261 additions & 0 deletions
261
projects/igniteui-angular/src/lib/progressbar/circular/themes/_base.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
@use 'sass:map'; | ||
@use 'igniteui-theming/sass/typography/index' as *; | ||
@use 'igniteui-theming/sass/bem/index' as *; | ||
@use 'igniteui-theming/sass/themes/index' as *; | ||
@use 'igniteui-theming/sass/animations' as *; | ||
@use 'styles/themes/standalone' as *; | ||
@use 'light/tokens' as *; | ||
|
||
$theme: $base; | ||
$diameter: calc(var(--circular-size) + var(--stroke-thickness)); | ||
$radius: calc(var(--circular-size) / 2 - var(--stroke-thickness) * .5); | ||
$circumference: calc(#{$radius} * 2 * 3.1416); | ||
|
||
%circle { | ||
width: 100%; | ||
height: 100%; | ||
fill: transparent; | ||
cx: calc(#{$diameter} / 2); | ||
cy: calc(#{$diameter} / 2); | ||
r: $radius; | ||
transform-origin: center; | ||
} | ||
|
||
@keyframes igx-indeterminate-accordion { | ||
0% { | ||
stroke-dashoffset: calc(#{$circumference} * 2); | ||
stroke-dasharray: calc(#{$circumference} * 9 / 10); | ||
} | ||
|
||
100% { | ||
stroke-dashoffset: calc(#{$circumference} * 2 / 5); | ||
} | ||
} | ||
|
||
@keyframes igx-indeterminate-accordion-rtl { | ||
0% { | ||
stroke-dashoffset: calc(#{$circumference} * -2); | ||
stroke-dasharray: calc(#{$circumference} * 9 / 10); | ||
} | ||
|
||
100% { | ||
stroke-dashoffset: calc(#{$circumference} * -2 / 5); | ||
} | ||
} | ||
|
||
// Fluent: Circular progress animation for indeterminate state. | ||
// Dynamically changes stroke-dasharray and rotates for a smooth spinning effect. | ||
@keyframes igx-indeterminate-circular-fluent { | ||
0% { | ||
// Start the stroke at the correct position by adjusting the dasharray and dashoffset | ||
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; | ||
stroke-dashoffset: calc(-1 * #{$circumference} / 4); | ||
|
||
// Start at 12 o'clock | ||
transform: rotate(-90deg); | ||
} | ||
|
||
50% { | ||
stroke-dasharray: calc(#{$circumference} / 2), calc(#{$circumference} / 2); | ||
|
||
// Adjust to keep starting point correct | ||
stroke-dashoffset: calc(-1 * #{$circumference} / 4); | ||
|
||
// Continue rotating smoothly | ||
transform: rotate(360deg); | ||
} | ||
|
||
100% { | ||
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; | ||
|
||
// Reset properly | ||
stroke-dashoffset: calc(-1 * #{$circumference} / 4); | ||
|
||
// Complete the full rotation | ||
transform: rotate(990deg); | ||
} | ||
} | ||
|
||
@keyframes igx-indeterminate-circular-fluent-rtl { | ||
0% { | ||
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; | ||
|
||
// Positive offset for opposite direction | ||
stroke-dashoffset: calc(#{$circumference} / 4); | ||
transform: rotate(90deg); | ||
} | ||
|
||
50% { | ||
stroke-dasharray: calc(#{$circumference} / 2), calc(#{$circumference} / 2); | ||
|
||
// Positive offset for opposite direction | ||
stroke-dashoffset: calc(#{$circumference} / 4); | ||
transform: rotate(-360deg); | ||
} | ||
|
||
100% { | ||
stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; | ||
|
||
// Positive offset for opposite direction | ||
stroke-dashoffset: calc(#{$circumference} / 4); | ||
transform: rotate(-990deg); | ||
} | ||
} | ||
|
||
@keyframes igx-initial-dashoffset { | ||
from { | ||
/* Start with no progress (0%) */ | ||
stroke-dashoffset: #{$circumference}; | ||
} | ||
|
||
to { | ||
stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference}); | ||
} | ||
} | ||
|
||
// Generic animations | ||
@keyframes igc-initial-counter { | ||
from { | ||
--_progress-integer: 0; | ||
--_progress-fraction: 0; | ||
} | ||
} | ||
|
||
@keyframes igx-rotate-center { | ||
0% { | ||
transform: rotate(0); | ||
} | ||
|
||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@include layer(base) { | ||
@include b(igx-circular-bar) { | ||
--circular-size: calc(#{var-get($theme, 'diameter')} - var(--stroke-thickness)); | ||
|
||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: relative; | ||
|
||
|
||
@include e(text) { | ||
position: absolute; | ||
color: var-get($theme, 'text-color'); | ||
font-size: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness)), 1px); | ||
line-height: normal; | ||
text-align: center; | ||
font-weight: 600; | ||
|
||
animation: igx-initial-counter var(--_transition-duration) ease-in-out; | ||
counter-reset: | ||
progress-integer var(--_progress-integer, 0) | ||
progress-fraction var(--_progress-fraction, 0); | ||
transition: | ||
--_progress-integer var(--_transition-duration) ease-in-out, | ||
--_progress-fraction var(--_transition-duration) ease-in-out; | ||
} | ||
|
||
@include e(text, $not: ('fraction')) { | ||
&::before { | ||
content: counter(progress-integer) '%'; | ||
} | ||
} | ||
|
||
@include e(value, $m: fraction) { | ||
&::before { | ||
content: counter(progress-integer) '.' counter(progress-fraction, decimal-leading-zero) '%'; | ||
} | ||
} | ||
|
||
@include m(indeterminate) { | ||
@include e(text) { | ||
visibility: hidden; | ||
} | ||
} | ||
|
||
@each $modifier in ('danger', 'warning', 'info', 'success') { | ||
@include m($modifier) { | ||
@include e(outer) { | ||
stroke: var-get($theme, 'fill-color-#{$modifier}'); | ||
} | ||
} | ||
} | ||
|
||
@include m(animation-none) { | ||
--_transition-duration: 0s !important; | ||
} | ||
|
||
@include m(hide-counter) { | ||
@include e(text) { | ||
&::before { | ||
display: none; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@include b(igx-circular-svg) { | ||
width: $diameter; | ||
height: $diameter; | ||
transform: rotate(-90deg); | ||
transform-origin: center; | ||
|
||
@include e(gradient-start) { | ||
stop-color: var(--igx-circular-bar-fill-color-default-end, var(--fill-color-default-end)); | ||
} | ||
|
||
@include e(gradient-end) { | ||
stop-color: var(--igx-circular-bar-fill-color-default-start, var(--fill-color-default-start)); | ||
} | ||
|
||
@include e(inner) { | ||
@extend %circle; | ||
|
||
stroke-width: var(--stroke-thickness); | ||
stroke: var-get($theme, 'base-circle-color'); | ||
} | ||
|
||
@include e(outer) { | ||
--_progress-percentage: calc(var(--_progress-whole, 0) / 100); | ||
|
||
@extend %circle; | ||
|
||
transition: stroke-dashoffset var(--_transition-duration) linear; | ||
|
||
stroke: var-get($theme, 'fill-color-default'); | ||
stroke-dasharray: #{$circumference} #{$circumference}; | ||
stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference}); | ||
} | ||
|
||
@include m(indeterminate) { | ||
@include e(outer) { | ||
stroke-dashoffset: calc(#{$circumference} * 2); | ||
animation: igx-indeterminate-accordion 1.5s cubic-bezier(0, 0.085, 0.68, 0.53) normal infinite; | ||
} | ||
|
||
&:dir(rtl) { | ||
@include e(outer) { | ||
stroke-dashoffset: calc(#{$circumference} + var(--_progress-percentage) * #{$circumference}); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.igx-circular-svg:not(.igx-circular-svg--indeterminate) { | ||
.igx-circular-svg__outer { | ||
animation: igx-initial-dashoffset var(--_transition-duration) linear; | ||
stroke-dasharray: #{$circumference} #{$circumference}; | ||
stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference}); | ||
} | ||
|
||
&:dir(rtl) { | ||
.igx-circular-svg__outer { | ||
animation: igx-initial-dashoffset-rtl var(--_transition-duration) linear; | ||
animation-direction: reverse; | ||
} | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
projects/igniteui-angular/src/lib/progressbar/circular/themes/dark/_index.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@use 'sass:meta'; | ||
@use 'tokens'; | ||
@use 'styles/themes/standalone' as *; | ||
|
||
$tokens: meta.module-variables(tokens); | ||
@include themes(igx-circular-bar, $tokens, dark); |
8 changes: 8 additions & 0 deletions
8
projects/igniteui-angular/src/lib/progressbar/circular/themes/dark/_tokens.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@use 'igniteui-theming/sass/themes/index' as *; | ||
@use 'igniteui-theming/sass/themes/schemas/components/dark/progress' as *; | ||
|
||
$base: digest-schema($dark-base-progress-circular); | ||
$material: digest-schema($dark-material-progress-circular); | ||
$bootstrap: digest-schema($dark-bootstrap-progress-circular); | ||
$fluent: digest-schema($dark-fluent-progress-circular); | ||
$indigo: digest-schema($dark-indigo-progress-circular); |
6 changes: 6 additions & 0 deletions
6
projects/igniteui-angular/src/lib/progressbar/circular/themes/light/_index.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@use 'sass:meta'; | ||
@use 'tokens'; | ||
@use 'styles/themes/standalone' as *; | ||
|
||
$tokens: meta.module-variables(tokens); | ||
@include themes(igx-circular-bar, $tokens, light); |
8 changes: 8 additions & 0 deletions
8
projects/igniteui-angular/src/lib/progressbar/circular/themes/light/_tokens.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@use 'igniteui-theming/sass/themes/index' as *; | ||
@use 'igniteui-theming/sass/themes/schemas/components/light/progress' as *; | ||
|
||
$base: digest-schema($light-progress-circular); | ||
$material: digest-schema($material-progress-circular); | ||
$bootstrap: digest-schema($bootstrap-progress-circular); | ||
$fluent: digest-schema($fluent-progress-circular); | ||
$indigo: digest-schema($indigo-progress-circular); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put these in a separate file to clean this up a bit. Also make sure to put the keyframes in the base layer.