|
415 | 415 | );
|
416 | 416 | }
|
417 | 417 |
|
| 418 | +/// Fixes inconsistent values in the icon button tokens so that they can produce valid styles. |
| 419 | +/// @param {Map} $initial-tokens Map of icon button tokens currently being generated. |
| 420 | +/// @param {Map} $all-tokens Map of all icon button tokens, including hardcoded values. |
| 421 | +/// @return {Map} The given tokens, with the invalid values replaced with valid ones. |
| 422 | +@function _fix-icon-button-tokens($tokens, $all-tokens) { |
| 423 | + $rename-keys: ( |
| 424 | + unselected-icon-color: icon-color, |
| 425 | + ); |
| 426 | + |
| 427 | + $remapped-tokens: _rename-map-keys($tokens, $rename-keys); |
| 428 | + $remapped-all-tokens: _rename-map-keys($all-tokens, $rename-keys); |
| 429 | + |
| 430 | + @return _combine-color-tokens($remapped-tokens, $remapped-all-tokens, ( |
| 431 | + ( |
| 432 | + color: disabled-icon-color, |
| 433 | + opacity: disabled-icon-opacity, |
| 434 | + ), |
| 435 | + )); |
| 436 | +} |
| 437 | + |
418 | 438 | /// Generates a set of namespaced tokens for all components.
|
419 | 439 | /// @param {Map} $systems The MDC system tokens
|
420 | 440 | /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
|
|
509 | 529 | ),
|
510 | 530 | _namespace-tokens(
|
511 | 531 | (mdc, icon-button),
|
512 |
| - mdc-tokens.md-comp-icon-button-values($systems, $exclude-hardcoded), |
| 532 | + _fix-icon-button-tokens( |
| 533 | + mdc-tokens.md-comp-icon-button-values($systems, $exclude-hardcoded), |
| 534 | + // Need to pass in the hardcoded values, because they |
| 535 | + // include opacities that are used for the disabled state. |
| 536 | + mdc-tokens.md-comp-icon-button-values($systems, false) |
| 537 | + ), |
513 | 538 | $token-slots
|
514 | 539 | ),
|
515 | 540 | _namespace-tokens(
|
|
0 commit comments