/
_text-button.scss
98 lines (87 loc) · 3.47 KB
/
_text-button.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@use 'sass:map';
@use '../../token-utils';
@use '../../../style/sass-utils';
@use '../../../theming/inspection';
@use '../../../theming/theming';
// The prefix used to generate the fully qualified name for tokens in this file.
$prefix: (mdc, text-button);
// Tokens that can't be configured through Angular Material's current theming API,
// but may be in a future version of the theming API.
//
// Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
// `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
// our CSS.
@function get-unthemable-tokens() {
@return (
container-shape: 4px,
// =============================================================================================
// = TOKENS NOT USED IN ANGULAR MATERIAL =
// =============================================================================================
hover-label-text-color: null,
focus-label-text-color: null,
pressed-label-text-color: null,
focus-state-layer-color: null,
focus-state-layer-opacity: null,
hover-state-layer-color: null,
hover-state-layer-opacity: null,
pressed-state-layer-color: null,
pressed-state-layer-opacity: null,
with-icon-disabled-icon-color: null,
with-icon-focus-icon-color: null,
with-icon-hover-icon-color: null,
with-icon-icon-color: null,
with-icon-icon-size: null,
with-icon-pressed-icon-color: null,
focus-ring-color: null,
focus-ring-offset: null,
keep-touch-target: false,
);
}
// Tokens that can be configured through Angular Material's color theming API.
@function get-color-tokens($theme) {
$is-dark: inspection.get-theme-type($theme) == dark;
$on-surface: if($is-dark, #fff, #000);
@return (
label-text-color: $on-surface,
disabled-label-text-color: rgba($on-surface, if($is-dark, 0.5, 0.38)),
);
}
// Generates the mapping for the properties that change based on the button palette color.
@function private-get-color-palette-color-tokens($theme, $palette-name) {
$palette: map.get($theme, $palette-name);
@return (
label-text-color: inspection.get-theme-color($theme, $palette-name)
);
}
// Tokens that can be configured through Angular Material's typography theming API.
@function get-typography-tokens($theme) {
@return (
label-text-font: inspection.get-theme-typography($theme, button, font-family),
label-text-size: inspection.get-theme-typography($theme, button, font-size),
label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
label-text-transform: none,
);
}
// Tokens that can be configured through Angular Material's density theming API.
@function get-density-tokens($theme) {
$scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
@return (
container-height: map.get((
0: 36px,
-1: 32px,
-2: 28px,
-3: 24px,
), $scale),
);
}
// Combines the tokens generated by the above functions into a single map with placeholder values.
// This is used to create token slots.
@function get-token-slots() {
@return sass-utils.deep-merge-all(
get-unthemable-tokens(),
get-color-tokens(token-utils.$placeholder-color-config),
get-typography-tokens(token-utils.$placeholder-typography-config),
get-density-tokens(token-utils.$placeholder-density-config)
);
}