|
1 | 1 | @use 'sass:map';
|
2 | 2 | @use 'sass:meta';
|
3 |
| -@use 'sass:list'; |
4 | 3 | @use '../../token-definition';
|
5 | 4 |
|
6 | 5 | // The prefix used to generate the fully qualified name for tokens in this file.
|
@@ -34,17 +33,18 @@ $prefix: (mdc, filled-text-field);
|
34 | 33 | );
|
35 | 34 |
|
36 | 35 | @return token-definition.namespace-tokens($prefix, (
|
37 |
| - _fix-tokens($mdc-tokens), |
38 |
| - token-definition.map-values($variant-tokens, meta.get-function(_fix-tokens)) |
| 36 | + _fix-tokens($mdc-tokens, $systems), |
| 37 | + token-definition.map-values($variant-tokens, meta.get-function(_fix-tokens), $systems) |
39 | 38 | ), $token-slots);
|
40 | 39 | }
|
41 | 40 |
|
42 | 41 |
|
43 | 42 | /// Fixes inconsistent values in the filled text field tokens so that they can produce valid
|
44 | 43 | /// styles.
|
45 | 44 | /// @param {Map} $initial-tokens Map of filled text field tokens currently being generated.
|
| 45 | +/// @param {Map} $systems The MDC system tokens |
46 | 46 | /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
47 |
| -@function _fix-tokens($initial-tokens) { |
| 47 | +@function _fix-tokens($initial-tokens, $systems) { |
48 | 48 | // Need to get the hardcoded values, because they include opacities that are used for the disabled
|
49 | 49 | // state.
|
50 | 50 | $hardcoded-tokens: token-definition.get-mdc-tokens('filled-text-field', (), false);
|
@@ -80,13 +80,11 @@ $prefix: (mdc, filled-text-field);
|
80 | 80 | )
|
81 | 81 | ));
|
82 | 82 |
|
83 |
| - $container-shape: map.get($tokens, container-shape); |
84 |
| - |
85 |
| - // The M2 token slots define a single `container-shape` slot while the M3 tokens provide a list |
86 |
| - // of shapes (e.g. top/bottom/left/right). Extract the first value so it matches the expected |
87 |
| - // token slot in M2. |
88 |
| - @if meta.type-of($container-shape) == 'list' { |
89 |
| - $tokens: map.set($tokens, container-shape, list.nth($container-shape, 1)); |
| 83 | + // The system tokens have this set as `corner-extra-small-top` which assumes that the value will |
| 84 | + // be set as a `border-radius`, however we set it as `border-top-left-radius` and |
| 85 | + // `border-top-right-radius`. Changing it at this point will be breaking so instead we remap it. |
| 86 | + @if (map.get($tokens, container-shape)) { |
| 87 | + $tokens: map.set($tokens, container-shape, map.get($systems, md-sys-shape, corner-extra-small)); |
90 | 88 | }
|
91 | 89 |
|
92 | 90 | @return $tokens;
|
|
0 commit comments