|
256 | 256 | @return $tokens;
|
257 | 257 | }
|
258 | 258 |
|
| 259 | + |
| 260 | +/// Fixes inconsistent values in the text button tokens so that they can produce valid styles. |
| 261 | +/// @param {Map} $initial-tokens Map of text button tokens currently being generated. |
| 262 | +/// @param {Map} $all-tokens Map of all text button tokens, including hardcoded values. |
| 263 | +/// @return {Map} The given tokens, with the invalid values replaced with valid ones. |
| 264 | +@function _fix-text-button-tokens($initial-tokens, $all-tokens) { |
| 265 | + @return _combine-color-tokens($initial-tokens, $all-tokens, ( |
| 266 | + ( |
| 267 | + color: 'disabled-label-text-color', |
| 268 | + opacity: 'disabled-label-text-opacity', |
| 269 | + ), |
| 270 | + )); |
| 271 | +} |
| 272 | + |
| 273 | +/// Fixes inconsistent values in the filled button tokens so that they can produce valid styles. |
| 274 | +/// @param {Map} $initial-tokens Map of filled button tokens currently being generated. |
| 275 | +/// @param {Map} $all-tokens Map of all filled button tokens, including hardcoded values. |
| 276 | +/// @return {Map} The given tokens, with the invalid values replaced with valid ones. |
| 277 | +@function _fix-filled-button-tokens($initial-tokens, $all-tokens) { |
| 278 | + @return _combine-color-tokens($initial-tokens, $all-tokens, ( |
| 279 | + ( |
| 280 | + color: 'disabled-label-text-color', |
| 281 | + opacity: 'disabled-label-text-opacity', |
| 282 | + ), |
| 283 | + ( |
| 284 | + color: 'disabled-container-color', |
| 285 | + opacity: 'disabled-container-opacity', |
| 286 | + ) |
| 287 | + )); |
| 288 | +} |
| 289 | + |
| 290 | +/// Fixes inconsistent values in the protected button tokens so that they can produce valid styles. |
| 291 | +/// @param {Map} $initial-tokens Map of protected button tokens currently being generated. |
| 292 | +/// @param {Map} $all-tokens Map of all protected button tokens, including hardcoded values. |
| 293 | +/// @return {Map} The given tokens, with the invalid values replaced with valid ones. |
| 294 | +@function _fix-protected-button-tokens($initial-tokens, $all-tokens) { |
| 295 | + @return _combine-color-tokens($initial-tokens, $all-tokens, ( |
| 296 | + ( |
| 297 | + color: 'disabled-label-text-color', |
| 298 | + opacity: 'disabled-label-text-opacity', |
| 299 | + ), |
| 300 | + ( |
| 301 | + color: 'disabled-container-color', |
| 302 | + opacity: 'disabled-container-opacity', |
| 303 | + ) |
| 304 | + )); |
| 305 | +} |
| 306 | + |
| 307 | +/// Fixes inconsistent values in the outlined button tokens so that they can produce valid styles. |
| 308 | +/// @param {Map} $initial-tokens Map of outlined button tokens currently being generated. |
| 309 | +/// @param {Map} $all-tokens Map of all outlined button tokens, including hardcoded values. |
| 310 | +/// @return {Map} The given tokens, with the invalid values replaced with valid ones. |
| 311 | +@function _fix-outlined-button-tokens($initial-tokens, $all-tokens) { |
| 312 | + @return _combine-color-tokens($initial-tokens, $all-tokens, ( |
| 313 | + ( |
| 314 | + color: 'disabled-label-text-color', |
| 315 | + opacity: 'disabled-label-text-opacity', |
| 316 | + ), |
| 317 | + ( |
| 318 | + color: 'disabled-outline-color', |
| 319 | + opacity: 'disabled-outline-opacity', |
| 320 | + ) |
| 321 | + )); |
| 322 | +} |
| 323 | + |
259 | 324 | /// Fixes inconsistent values in the outlined text field tokens so that they can produce valid
|
260 | 325 | /// styles.
|
261 | 326 | /// @param {Map} $initial-tokens Map of outlined text field tokens currently being generated.
|
|
386 | 451 | mdc-tokens.md-comp-icon-button-values($systems, $exclude-hardcoded),
|
387 | 452 | $token-slots
|
388 | 453 | ),
|
| 454 | + _namespace-tokens( |
| 455 | + (mdc, text-button), |
| 456 | + _fix-text-button-tokens( |
| 457 | + mdc-tokens.md-comp-text-button-values($systems, $exclude-hardcoded), |
| 458 | + // Need to pass in the hardcoded values, because they |
| 459 | + // include opacities that are used for the disabled state. |
| 460 | + mdc-tokens.md-comp-text-button-values($systems, false), |
| 461 | + ), |
| 462 | + $token-slots |
| 463 | + ), |
| 464 | + _namespace-tokens( |
| 465 | + // Note: in M3 the "protected" button is called "elevated". |
| 466 | + (mdc, protected-button), |
| 467 | + _fix-protected-button-tokens( |
| 468 | + mdc-tokens.md-comp-elevated-button-values($systems, $exclude-hardcoded), |
| 469 | + // Need to pass in the hardcoded values, because they |
| 470 | + // include opacities that are used for the disabled state. |
| 471 | + mdc-tokens.md-comp-elevated-button-values($systems, false), |
| 472 | + ), |
| 473 | + $token-slots |
| 474 | + ), |
| 475 | + _namespace-tokens( |
| 476 | + (mdc, filled-button), |
| 477 | + _fix-filled-button-tokens( |
| 478 | + mdc-tokens.md-comp-filled-button-values($systems, $exclude-hardcoded), |
| 479 | + // Need to pass in the hardcoded values, because they |
| 480 | + // include opacities that are used for the disabled state. |
| 481 | + mdc-tokens.md-comp-filled-button-values($systems, false), |
| 482 | + ), |
| 483 | + $token-slots |
| 484 | + ), |
| 485 | + _namespace-tokens( |
| 486 | + (mdc, outlined-button), |
| 487 | + _fix-outlined-button-tokens( |
| 488 | + mdc-tokens.md-comp-outlined-button-values($systems, $exclude-hardcoded), |
| 489 | + // Need to pass in the hardcoded values, because they |
| 490 | + // include opacities that are used for the disabled state. |
| 491 | + mdc-tokens.md-comp-outlined-button-values($systems, false), |
| 492 | + ), |
| 493 | + $token-slots |
| 494 | + ), |
389 | 495 | _namespace-tokens(
|
390 | 496 | (mdc, linear-progress),
|
391 | 497 | mdc-tokens.md-comp-linear-progress-indicator-values($systems, $exclude-hardcoded),
|
|
504 | 610 | custom-tokens.icon($systems, $exclude-hardcoded),
|
505 | 611 | $token-slots
|
506 | 612 | ),
|
| 613 | + _namespace-tokens( |
| 614 | + (mat, text-button), |
| 615 | + custom-tokens.text-button($systems, $exclude-hardcoded), |
| 616 | + $token-slots |
| 617 | + ), |
| 618 | + _namespace-tokens( |
| 619 | + (mat, filled-button), |
| 620 | + custom-tokens.filled-button($systems, $exclude-hardcoded), |
| 621 | + $token-slots |
| 622 | + ), |
| 623 | + _namespace-tokens( |
| 624 | + // Note: in M3 the "protected" button is called "elevated". |
| 625 | + (mat, protected-button), |
| 626 | + custom-tokens.elevated-button($systems, $exclude-hardcoded), |
| 627 | + $token-slots |
| 628 | + ), |
| 629 | + _namespace-tokens( |
| 630 | + (mat, outlined-button), |
| 631 | + custom-tokens.outlined-button($systems, $exclude-hardcoded), |
| 632 | + $token-slots |
| 633 | + ), |
507 | 634 | _namespace-tokens(
|
508 | 635 | (mat, icon-button),
|
509 | 636 | custom-tokens.icon-button($systems, $exclude-hardcoded),
|
|
0 commit comments