|
2 | 2 | @use 'sass:math';
|
3 | 3 | @use '../core/theming/theming';
|
4 | 4 | @use '../core/typography/typography';
|
5 |
| -@use '../core/typography/typography-utils'; |
6 | 5 | @use '../core/density/private/compatibility';
|
| 6 | +@use '../core/style/sass-utils'; |
| 7 | +@use '../core/tokens/token-utils'; |
| 8 | +@use '../core/tokens/m2/mat/stepper' as tokens-mat-stepper; |
7 | 9 | @use './stepper-variables';
|
8 | 10 |
|
9 | 11 | @mixin color($config-or-theme) {
|
10 | 12 | $config: theming.get-color-config($config-or-theme);
|
11 |
| - $foreground: map.get($config, foreground); |
12 |
| - $background: map.get($config, background); |
13 |
| - $primary: map.get($config, primary); |
14 |
| - $accent: map.get($config, accent); |
15 |
| - $warn: map.get($config, warn); |
16 | 13 |
|
17 |
| - .mat-step-header { |
18 |
| - &.cdk-keyboard-focused, |
19 |
| - &.cdk-program-focused, |
20 |
| - &:hover:not([aria-disabled]), |
21 |
| - &:hover[aria-disabled='false'] { |
22 |
| - background-color: theming.get-color-from-palette($background, hover); |
23 |
| - } |
24 |
| - |
25 |
| - &:hover[aria-disabled='true'] { |
26 |
| - cursor: default; |
27 |
| - } |
| 14 | + @include sass-utils.current-selector-or-root() { |
| 15 | + @include token-utils.create-token-values(tokens-mat-stepper.$prefix, |
| 16 | + tokens-mat-stepper.get-color-tokens($config)); |
28 | 17 |
|
29 |
| - // On touch devices the :hover state will linger on the element after a tap. |
30 |
| - // Reset it via `@media` after the declaration, because the media query isn't |
31 |
| - // supported by all browsers yet. |
32 |
| - @media (hover: none) { |
33 |
| - &:hover { |
34 |
| - background: none; |
35 |
| - } |
| 18 | + .mat-step-header.mat-accent { |
| 19 | + @include token-utils.create-token-values(tokens-mat-stepper.$prefix, |
| 20 | + tokens-mat-stepper.private-get-color-palette-color-tokens(map.get($config, accent))); |
36 | 21 | }
|
37 | 22 |
|
38 |
| - .mat-step-label, |
39 |
| - .mat-step-optional { |
40 |
| - // TODO(josephperrott): Update to using a corrected disabled-text contrast |
41 |
| - // instead of secondary-text. |
42 |
| - color: theming.get-color-from-palette($foreground, secondary-text); |
| 23 | + .mat-step-header.mat-warn { |
| 24 | + @include token-utils.create-token-values(tokens-mat-stepper.$prefix, |
| 25 | + tokens-mat-stepper.private-get-color-palette-color-tokens(map.get($config, warn))); |
43 | 26 | }
|
44 |
| - |
45 |
| - .mat-step-icon { |
46 |
| - // TODO(josephperrott): Update to using a corrected disabled-text contrast |
47 |
| - // instead of secondary-text. |
48 |
| - background-color: theming.get-color-from-palette($foreground, secondary-text); |
49 |
| - color: theming.get-color-from-palette($primary, default-contrast); |
50 |
| - } |
51 |
| - |
52 |
| - .mat-step-icon-selected, |
53 |
| - .mat-step-icon-state-done, |
54 |
| - .mat-step-icon-state-edit { |
55 |
| - background-color: theming.get-color-from-palette($primary); |
56 |
| - color: theming.get-color-from-palette($primary, default-contrast); |
57 |
| - } |
58 |
| - |
59 |
| - &.mat-accent { |
60 |
| - .mat-step-icon { |
61 |
| - color: theming.get-color-from-palette($accent, default-contrast); |
62 |
| - } |
63 |
| - |
64 |
| - .mat-step-icon-selected, |
65 |
| - .mat-step-icon-state-done, |
66 |
| - .mat-step-icon-state-edit { |
67 |
| - background-color: theming.get-color-from-palette($accent); |
68 |
| - color: theming.get-color-from-palette($accent, default-contrast); |
69 |
| - } |
70 |
| - } |
71 |
| - |
72 |
| - &.mat-warn { |
73 |
| - .mat-step-icon { |
74 |
| - color: theming.get-color-from-palette($warn, default-contrast); |
75 |
| - } |
76 |
| - |
77 |
| - .mat-step-icon-selected, |
78 |
| - .mat-step-icon-state-done, |
79 |
| - .mat-step-icon-state-edit { |
80 |
| - background-color: theming.get-color-from-palette($warn); |
81 |
| - color: theming.get-color-from-palette($warn, default-contrast); |
82 |
| - } |
83 |
| - } |
84 |
| - |
85 |
| - .mat-step-icon-state-error { |
86 |
| - background-color: transparent; |
87 |
| - color: theming.get-color-from-palette($warn, text); |
88 |
| - } |
89 |
| - |
90 |
| - .mat-step-label.mat-step-label-active { |
91 |
| - color: theming.get-color-from-palette($foreground, text); |
92 |
| - } |
93 |
| - |
94 |
| - .mat-step-label.mat-step-label-error { |
95 |
| - color: theming.get-color-from-palette($warn, text); |
96 |
| - } |
97 |
| - } |
98 |
| - |
99 |
| - .mat-stepper-horizontal, .mat-stepper-vertical { |
100 |
| - background-color: theming.get-color-from-palette($background, card); |
101 |
| - } |
102 |
| - |
103 |
| - .mat-stepper-vertical-line::before { |
104 |
| - border-left-color: theming.get-color-from-palette($foreground, divider); |
105 |
| - } |
106 |
| - |
107 |
| - .mat-horizontal-stepper-header::before, |
108 |
| - .mat-horizontal-stepper-header::after, |
109 |
| - .mat-stepper-horizontal-line { |
110 |
| - border-top-color: theming.get-color-from-palette($foreground, divider); |
111 | 27 | }
|
112 | 28 | }
|
113 | 29 |
|
114 | 30 | @mixin typography($config-or-theme) {
|
115 | 31 | $config: typography.private-typography-to-2014-config(
|
116 | 32 | theming.get-typography-config($config-or-theme));
|
117 |
| - .mat-stepper-vertical, .mat-stepper-horizontal { |
118 |
| - font-family: typography-utils.font-family($config); |
119 |
| - } |
120 |
| - |
121 |
| - .mat-step-label { |
122 |
| - font: { |
123 |
| - size: typography-utils.font-size($config, body-1); |
124 |
| - weight: typography-utils.font-weight($config, body-1); |
125 |
| - }; |
126 |
| - } |
127 |
| - |
128 |
| - .mat-step-sub-label-error { |
129 |
| - font-weight: normal; |
130 |
| - } |
131 |
| - |
132 |
| - .mat-step-label-error { |
133 |
| - font-size: typography-utils.font-size($config, body-2); |
134 |
| - } |
135 | 33 |
|
136 |
| - .mat-step-label-selected { |
137 |
| - font: { |
138 |
| - size: typography-utils.font-size($config, body-2); |
139 |
| - weight: typography-utils.font-weight($config, body-2); |
140 |
| - }; |
| 34 | + @include sass-utils.current-selector-or-root() { |
| 35 | + @include token-utils.create-token-values(tokens-mat-stepper.$prefix, |
| 36 | + tokens-mat-stepper.get-typography-tokens($config)); |
141 | 37 | }
|
142 | 38 | }
|
143 | 39 |
|
|
147 | 43 | $density-scale, height);
|
148 | 44 | $vertical-padding: math.div($height - stepper-variables.$label-header-height, 2);
|
149 | 45 |
|
150 |
| - @include compatibility.private-density-legacy-compatibility() { |
151 |
| - .mat-horizontal-stepper-header { |
152 |
| - height: $height; |
153 |
| - } |
154 |
| - |
155 |
| - .mat-stepper-label-position-bottom .mat-horizontal-stepper-header, |
156 |
| - .mat-vertical-stepper-header { |
157 |
| - padding: $vertical-padding stepper-variables.$side-gap; |
158 |
| - } |
159 |
| - |
160 |
| - // Ensures that the vertical lines for the step content exceed into the step |
161 |
| - // headers with a given distance (`$mat-stepper-line-gap`) to the step icon. |
162 |
| - .mat-stepper-vertical-line::before { |
163 |
| - top: stepper-variables.$line-gap - $vertical-padding; |
164 |
| - bottom: stepper-variables.$line-gap - $vertical-padding; |
165 |
| - } |
166 |
| - |
167 |
| - // Ensures that the horizontal lines for the step header are centered vertically. |
168 |
| - .mat-stepper-label-position-bottom .mat-horizontal-stepper-header { |
169 |
| - &::after, &::before { |
170 |
| - top: $vertical-padding + math.div(stepper-variables.$label-header-height, 2); |
171 |
| - } |
172 |
| - } |
173 |
| - |
174 |
| - // Ensures that the horizontal line for the step content is aligned centered vertically. |
175 |
| - .mat-stepper-label-position-bottom .mat-stepper-horizontal-line { |
176 |
| - top: $vertical-padding + math.div(stepper-variables.$label-header-height, 2); |
177 |
| - } |
| 46 | + @include sass-utils.current-selector-or-root() { |
| 47 | + @include token-utils.create-token-values(tokens-mat-stepper.$prefix, |
| 48 | + tokens-mat-stepper.get-density-tokens($density-scale)); |
178 | 49 | }
|
179 | 50 | }
|
180 | 51 |
|
|
0 commit comments