Skip to content

Commit fb47f58

Browse files
committed
fixup! refactor(material/progress-spinner): change mat-progress-spinner to use MDC's token API
1 parent 03f3a9d commit fb47f58

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/material/core/tokens/m2/mdc/_progress-spinner.scss renamed to src/material/core/tokens/m2/mdc/_circular-progress.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@use '../../token-utils';
44

55
// The prefix used to generate the fully qualified name for tokens in this file.
6-
$prefix: (mdc, progress-spinner);
6+
$prefix: (mdc, circular-progress);
77

88
// Tokens that can't be configured through Angular Material's current theming API,
99
// but may be in a future version of the theming API.
@@ -13,21 +13,30 @@ $prefix: (mdc, progress-spinner);
1313
// our CSS.
1414
@function get-unthemable-tokens() {
1515
@return (
16+
// The thickness of the progress spinner's active indicator.
1617
active-indicator-width: 4px,
18+
// The the diameter of the spinner
1719
size: 48px,
1820
// =============================================================================================
1921
// = TOKENS NOT USED IN ANGULAR MATERIAL =
2022
// =============================================================================================
23+
// Angular Material does not support four color spinners
2124
four-color-active-indicator-one-color: null,
25+
// Angular Material does not support four color spinners
2226
four-color-active-indicator-two-color: null,
27+
// Angular Material does not support four color spinners
2328
four-color-active-indicator-three-color: null,
29+
// Angular Material does not support four color spinners
2430
four-color-active-indicator-four-color: null
2531
);
2632
}
2733

2834
// Tokens that can be configured through Angular Material's color theming API.
2935
@function get-color-tokens($config) {
30-
@return (active-indicator-color: theming.get-color-from-palette(map.get($config, primary)));
36+
@return (
37+
// The color of the progress spinner's active indicator.
38+
active-indicator-color: theming.get-color-from-palette(map.get($config, primary))
39+
);
3140
}
3241

3342
// Tokens that can be configured through Angular Material's typography theming API.

src/material/core/tokens/tests/test-validate-tokens.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@use '@material/list/list-theme' as mdc-list-theme;
77

88
@use '../m2/mdc/list' as tokens-mdc-list;
9-
@use '../m2/mdc/progress-spinner' as tokens-mdc-progress-spinner;
9+
@use '../m2/mdc/circular-progress' as tokens-mdc-circular-progress;
1010

1111
@mixin validate-slots($component, $slots, $reference) {
1212
@debug 'Validating #{$component}...';
@@ -27,7 +27,7 @@
2727
);
2828

2929
@include validate-slots(
30-
$component: 'm2.mdc.progress-spinner',
31-
$slots: tokens-mdc-progress-spinner.get-token-slots(),
30+
$component: 'm2.mdc.circular-progress',
31+
$slots: tokens-mdc-circular-progress.get-token-slots(),
3232
$reference: mdc-circular-progress-theme.$light-theme
3333
);

src/material/progress-spinner/progress-spinner.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
@use '@material/circular-progress/circular-progress' as mdc-circular-progress;
33
@use '@material/circular-progress/circular-progress-theme' as mdc-circular-progress-theme;
44
@use '@material/theme/custom-properties' as mdc-custom-properties;
5-
@use '../core/tokens/m2/mdc/progress-spinner' as m2-mdc-progress-spinner;
5+
@use '../core/tokens/m2/mdc/circular-progress' as m2-mdc-circular-progress;
66

77
// The slots for tokens that will be configured in the theme can be emitted with no fallback.
88
@include mdc-custom-properties.configure($emit-fallback-values: false, $emit-fallback-vars: false) {
9-
$mdc-circular-progress-token-slots: m2-mdc-progress-spinner.get-token-slots();
9+
$mdc-circular-progress-token-slots: m2-mdc-circular-progress.get-token-slots();
1010

1111
// Add the MDC progress spinner static styles.
1212
@include mdc-circular-progress.static-styles();
@@ -16,7 +16,7 @@
1616

1717
// Add default values for tokens that aren't outputted by the theming API.
1818
.mat-mdc-progress-spinner {
19-
@include mdc-circular-progress-theme.theme(m2-mdc-progress-spinner.get-unthemable-tokens());
19+
@include mdc-circular-progress-theme.theme(m2-mdc-circular-progress.get-unthemable-tokens());
2020
}
2121
}
2222

0 commit comments

Comments
 (0)