|
11 | 11 | @use '../core/tokens/m2/mat/protected-button' as tokens-mat-protected-button;
|
12 | 12 | @use '../core/tokens/m2/mdc/text-button' as tokens-mdc-text-button;
|
13 | 13 | @use '../core/tokens/m2/mat/text-button' as tokens-mat-text-button;
|
| 14 | +@use '../core/tokens/m2/mat/tonal-button' as tokens-mat-tonal-button; |
14 | 15 | @use '../core/style/sass-utils';
|
15 | 16 |
|
16 | 17 | @mixin _text-button-variant($theme, $palette) {
|
|
81 | 82 | @include token-utils.create-token-values(tokens-mat-outlined-button.$prefix, $mat-tokens);
|
82 | 83 | }
|
83 | 84 |
|
| 85 | +@mixin _tonal-button-variant($theme, $palette) { |
| 86 | + @include token-utils.create-token-values(tokens-mat-tonal-button.$prefix, if( |
| 87 | + $palette, |
| 88 | + tokens-mat-tonal-button.private-get-color-palette-color-tokens($theme, $palette), |
| 89 | + tokens-mat-tonal-button.get-color-tokens($theme) |
| 90 | + )); |
| 91 | +} |
| 92 | + |
| 93 | + |
84 | 94 | @mixin _theme-from-tokens($tokens, $options...) {
|
85 | 95 | @include validation.selector-defined(
|
86 | 96 | 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector'
|
|
125 | 135 | tokens-mat-outlined-button.$prefix,
|
126 | 136 | $options...
|
127 | 137 | );
|
| 138 | + $mat-tonal-button-tokens: token-utils.get-tokens-for( |
| 139 | + $tokens, |
| 140 | + tokens-mat-tonal-button.$prefix, |
| 141 | + $options... |
| 142 | + ); |
128 | 143 |
|
129 | 144 | @include token-utils.create-token-values(tokens-mdc-text-button.$prefix, $mdc-text-button-tokens);
|
130 | 145 | @include token-utils.create-token-values(
|
|
152 | 167 | tokens-mat-outlined-button.$prefix,
|
153 | 168 | $mat-outlined-button-tokens
|
154 | 169 | );
|
| 170 | + @include token-utils.create-token-values( |
| 171 | + tokens-mat-tonal-button.$prefix, |
| 172 | + $mat-tonal-button-tokens |
| 173 | + ); |
155 | 174 | }
|
156 | 175 |
|
157 | 176 | /// Outputs base theme styles (styles not dependent on the color, typography, or density settings)
|
|
195 | 214 | tokens-mat-outlined-button.$prefix,
|
196 | 215 | tokens-mat-outlined-button.get-unthemable-tokens()
|
197 | 216 | );
|
| 217 | + @include token-utils.create-token-values( |
| 218 | + tokens-mat-tonal-button.$prefix, |
| 219 | + tokens-mat-tonal-button.get-unthemable-tokens() |
| 220 | + ); |
198 | 221 | }
|
199 | 222 | }
|
200 | 223 | }
|
|
211 | 234 | @include sass-utils.current-selector-or-root() {
|
212 | 235 | @include _text-button-variant($theme, null);
|
213 | 236 | @include _filled-button-variant($theme, null);
|
| 237 | + @include _tonal-button-variant($theme, null); |
214 | 238 | @include _protected-button-variant($theme, null);
|
215 | 239 | @include _outlined-button-variant($theme, null);
|
216 | 240 | }
|
|
270 | 294 | @include _outlined-button-variant($theme, warn);
|
271 | 295 | }
|
272 | 296 | }
|
| 297 | + |
| 298 | + .mat-tonal-button { |
| 299 | + &.mat-primary { |
| 300 | + @include _tonal-button-variant($theme, primary); |
| 301 | + } |
| 302 | + |
| 303 | + &.mat-accent { |
| 304 | + @include _tonal-button-variant($theme, accent); |
| 305 | + } |
| 306 | + |
| 307 | + &.mat-warn { |
| 308 | + @include _tonal-button-variant($theme, warn); |
| 309 | + } |
| 310 | + } |
273 | 311 | }
|
274 | 312 | }
|
275 | 313 |
|
|
313 | 351 | tokens-mat-outlined-button.$prefix,
|
314 | 352 | tokens-mat-outlined-button.get-typography-tokens($theme)
|
315 | 353 | );
|
| 354 | + @include token-utils.create-token-values( |
| 355 | + tokens-mat-tonal-button.$prefix, |
| 356 | + tokens-mat-tonal-button.get-typography-tokens($theme) |
| 357 | + ); |
316 | 358 | }
|
317 | 359 | }
|
318 | 360 | }
|
|
357 | 399 | tokens-mat-outlined-button.$prefix,
|
358 | 400 | tokens-mat-outlined-button.get-density-tokens($theme)
|
359 | 401 | );
|
| 402 | + @include token-utils.create-token-values( |
| 403 | + tokens-mat-tonal-button.$prefix, |
| 404 | + tokens-mat-tonal-button.get-density-tokens($theme) |
| 405 | + ); |
360 | 406 | }
|
361 | 407 | }
|
362 | 408 | }
|
|
371 | 417 | $mat-protected-button-tokens: tokens-mat-protected-button.get-token-slots();
|
372 | 418 | $mdc-text-button-tokens: tokens-mdc-text-button.get-token-slots();
|
373 | 419 | $mat-text-button-tokens: tokens-mat-text-button.get-token-slots();
|
| 420 | + $mat-tonal-button-tokens: tokens-mat-tonal-button.get-token-slots(); |
374 | 421 |
|
375 | 422 | @return (
|
376 | 423 | (
|
|
413 | 460 | tokens: $mat-text-button-tokens,
|
414 | 461 | prefix: 'text-',
|
415 | 462 | ),
|
| 463 | + ( |
| 464 | + namespace: tokens-mat-tonal-button.$prefix, |
| 465 | + tokens: $mat-tonal-button-tokens, |
| 466 | + prefix: 'tonal-', |
| 467 | + ), |
416 | 468 | );
|
417 | 469 | }
|
418 | 470 |
|
|
0 commit comments