1
1
@use ' sass:map' ;
2
+ @use ' ../../../style/elevation' ;
2
3
@use ' ../../../theming/theming' ;
3
4
@use ' ../../token-utils' ;
4
5
@@ -14,54 +15,57 @@ $prefix: (mdc, outlined-card);
14
15
@function get-unthemable-tokens () {
15
16
@return (
16
17
// The border-radius of the card.
17
- container- shape: 4px ,
18
+ container- shape: 4px ,
18
19
// The thickness of the card's border.
19
- outline-width : 1px ,
20
+ outline-width : 1px ,
20
21
// =============================================================================================
21
22
// = TOKENS NOT USED IN ANGULAR MATERIAL =
22
23
// =============================================================================================
23
- // TODO(mmalerba): The elevation tokens don't seem to work currently.
24
- // Should work with MDC to figure out what's wrong.
25
- container- elevation: null,
26
- container- shadow- color: null,
27
24
// Angular Material's card is not an interactive element, and therefore does not support states.
28
- disabled- container- elevation: null,
29
- disabled- outline- color: null,
30
- disabled- outline- opacity: null,
31
- dragged- container- elevation: null,
32
- dragged- outline- color: null,
33
- dragged- state- layer- color: null,
34
- dragged- state- layer- opacity: null,
35
- focus- container- elevation: null,
36
- focus- outline- color: null,
37
- focus- state- layer- color: null,
38
- focus- state- layer- opacity: null,
39
- hover- container- elevation: null,
40
- hover- outline- color: null,
41
- hover- state- layer- color: null,
42
- hover- state- layer- opacity: null,
43
- pressed- container- elevation: null,
44
- pressed- outline- color: null,
45
- pressed- state- layer- color: null,
46
- pressed- state- layer- opacity: null,
25
+ disabled- container- elevation: null,
26
+ disabled- outline- color: null,
27
+ disabled- outline- opacity: null,
28
+ dragged- container- elevation: null,
29
+ dragged- outline- color: null,
30
+ dragged- state- layer- color: null,
31
+ dragged- state- layer- opacity: null,
32
+ focus- container- elevation: null,
33
+ focus- outline- color: null,
34
+ focus- state- layer- color: null,
35
+ focus- state- layer- opacity: null,
36
+ hover- container- elevation: null,
37
+ hover- outline- color: null,
38
+ hover- state- layer- color: null,
39
+ hover- state- layer- opacity: null,
40
+ pressed- container- elevation: null,
41
+ pressed- outline- color: null,
42
+ pressed- state- layer- color: null,
43
+ pressed- state- layer- opacity: null,
47
44
// Angular Material does not currently support surface tint.
48
- container- surface- tint- layer- color: null,
45
+ container- surface- tint- layer- color: null,
49
46
// MDC does not seem to use these tokens.
50
- icon- color: null,
51
- icon- size: null,
47
+ icon- color: null,
48
+ icon- size: null,
52
49
);
53
50
}
54
51
55
52
// Tokens that can be configured through Angular Material's color theming API.
56
53
@function get-color-tokens ($config ) {
57
54
$background : map .get ($config , background );
58
55
$foreground : map .get ($config , foreground );
56
+ $elevation : theming .get-color-from-palette ($foreground , elevation );
59
57
60
58
@return (
61
59
// The background color of the card.
62
- container- color: theming .get-color-from-palette ($background , card ),
60
+ container- color: theming .get-color-from-palette ($background , card ),
63
61
// The border color of the card.
64
- outline-color : theming .get-color-from-palette ($foreground , base , 0.12 ),
62
+ outline-color : theming .get-color-from-palette ($foreground , base , 0.12 ),
63
+ // The elevation level of the card.
64
+ // (Part of the color tokens because it needs to be combined with the shadow color to generate
65
+ // the final box-shadow).
66
+ container- elevation: 0 ,
67
+ // The color of the card's shadow.
68
+ container- shadow- color: if ($elevation != null , $elevation , elevation .$color ),
65
69
);
66
70
}
67
71
@@ -79,9 +83,9 @@ $prefix: (mdc, outlined-card);
79
83
// This is used to create token slots.
80
84
@function get-token-slots () {
81
85
@return token-utils .merge-all (
82
- get-unthemable-tokens (),
83
- get-color-tokens (token-utils .$placeholder-color-config ),
84
- get-typography-tokens (token-utils .$placeholder-typography-config ),
85
- get-density-tokens (token-utils .$placeholder-density-config )
86
+ get-unthemable-tokens (),
87
+ get-color-tokens (token-utils .$placeholder-color-config ),
88
+ get-typography-tokens (token-utils .$placeholder-typography-config ),
89
+ get-density-tokens (token-utils .$placeholder-density-config )
86
90
);
87
91
}
0 commit comments