@angular/material 16.2.0-next.4 → 16.2.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/badge/_badge-theme.scss +84 -118
  2. package/bottom-sheet/_bottom-sheet-theme.scss +10 -11
  3. package/button-toggle/_button-toggle-theme.scss +20 -97
  4. package/button-toggle/_button-toggle-variables.scss +2 -0
  5. package/chips/index.d.ts +11 -4
  6. package/core/index.d.ts +1 -0
  7. package/core/tokens/_token-utils.scss +1 -0
  8. package/core/tokens/m2/mat/_badge.scss +78 -0
  9. package/core/tokens/m2/mat/_bottom-sheet.scss +56 -0
  10. package/core/tokens/m2/mat/_datepicker.scss +184 -0
  11. package/core/tokens/m2/mat/_divider.scss +45 -0
  12. package/core/tokens/m2/mat/_legacy-button-toggle.scss +63 -0
  13. package/core/tokens/m2/mat/_sidenav.scss +65 -0
  14. package/core/tokens/m2/mat/_standard-button-toggle.scss +87 -0
  15. package/core/tokens/m2/mat/_toolbar.scss +79 -0
  16. package/datepicker/_datepicker-theme.scss +44 -203
  17. package/divider/_divider-theme.scss +6 -8
  18. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  19. package/esm2022/button-toggle/button-toggle.mjs +2 -2
  20. package/esm2022/chips/chip-option.mjs +4 -5
  21. package/esm2022/chips/chip-row.mjs +15 -10
  22. package/esm2022/chips/chip.mjs +29 -12
  23. package/esm2022/core/private/ripple-loader.mjs +4 -1
  24. package/esm2022/core/version.mjs +1 -1
  25. package/esm2022/datepicker/calendar-body.mjs +2 -2
  26. package/esm2022/datepicker/calendar.mjs +2 -2
  27. package/esm2022/datepicker/date-range-input.mjs +2 -2
  28. package/esm2022/datepicker/datepicker-base.mjs +3 -3
  29. package/esm2022/datepicker/datepicker-toggle.mjs +2 -2
  30. package/esm2022/divider/divider.mjs +2 -2
  31. package/esm2022/form-field/form-field.mjs +3 -3
  32. package/esm2022/menu/menu-item.mjs +4 -4
  33. package/esm2022/menu/menu.mjs +3 -3
  34. package/esm2022/radio/radio.mjs +13 -1
  35. package/esm2022/sidenav/drawer.mjs +3 -3
  36. package/esm2022/sidenav/sidenav.mjs +3 -3
  37. package/esm2022/slide-toggle/slide-toggle.mjs +2 -2
  38. package/esm2022/toolbar/toolbar.mjs +2 -2
  39. package/fesm2022/bottom-sheet.mjs +2 -2
  40. package/fesm2022/bottom-sheet.mjs.map +1 -1
  41. package/fesm2022/button-toggle.mjs +2 -2
  42. package/fesm2022/button-toggle.mjs.map +1 -1
  43. package/fesm2022/chips.mjs +41 -17
  44. package/fesm2022/chips.mjs.map +1 -1
  45. package/fesm2022/core.mjs +4 -1
  46. package/fesm2022/core.mjs.map +1 -1
  47. package/fesm2022/datepicker.mjs +10 -10
  48. package/fesm2022/datepicker.mjs.map +1 -1
  49. package/fesm2022/divider.mjs +2 -2
  50. package/fesm2022/divider.mjs.map +1 -1
  51. package/fesm2022/form-field.mjs +2 -2
  52. package/fesm2022/form-field.mjs.map +1 -1
  53. package/fesm2022/menu.mjs +5 -5
  54. package/fesm2022/menu.mjs.map +1 -1
  55. package/fesm2022/radio.mjs +12 -0
  56. package/fesm2022/radio.mjs.map +1 -1
  57. package/fesm2022/sidenav.mjs +4 -4
  58. package/fesm2022/sidenav.mjs.map +1 -1
  59. package/fesm2022/slide-toggle.mjs +2 -2
  60. package/fesm2022/slide-toggle.mjs.map +1 -1
  61. package/fesm2022/toolbar.mjs +2 -2
  62. package/fesm2022/toolbar.mjs.map +1 -1
  63. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  64. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  65. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  66. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  67. package/package.json +2 -2
  68. package/prebuilt-themes/deeppurple-amber.css +1 -1
  69. package/prebuilt-themes/indigo-pink.css +1 -1
  70. package/prebuilt-themes/pink-bluegrey.css +1 -1
  71. package/prebuilt-themes/purple-green.css +1 -1
  72. package/radio/index.d.ts +4 -1
  73. package/schematics/ng-add/index.js +1 -1
  74. package/schematics/ng-add/index.mjs +1 -1
  75. package/sidenav/_sidenav-theme.scss +6 -69
  76. package/toolbar/_toolbar-theme.scss +25 -71
@@ -0,0 +1,56 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, bottom-sheet);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ // TODO: will be necessary for M3.
15
+ container-shape: 4px,
16
+ );
17
+ }
18
+
19
+ // Tokens that can be configured through Angular Material's color theming API.
20
+ @function get-color-tokens($config) {
21
+ $foreground: map.get($config, foreground);
22
+ $background: map.get($config, background);
23
+
24
+ @return (
25
+ container-text-color: theming.get-color-from-palette($foreground, text),
26
+ container-background-color: theming.get-color-from-palette($background, dialog),
27
+ );
28
+ }
29
+
30
+ // Tokens that can be configured through Angular Material's typography theming API.
31
+ @function get-typography-tokens($config) {
32
+ @return (
33
+ container-text-font: typography-utils.font-family($config, body-1) or
34
+ typography-utils.font-family($config),
35
+ container-text-line-height: typography-utils.line-height($config, body-1),
36
+ container-text-size: typography-utils.font-size($config, body-1),
37
+ container-text-tracking: typography-utils.letter-spacing($config, body-1),
38
+ container-text-weight: typography-utils.font-weight($config, body-1),
39
+ );
40
+ }
41
+
42
+ // Tokens that can be configured through Angular Material's density theming API.
43
+ @function get-density-tokens($config) {
44
+ @return ();
45
+ }
46
+
47
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
48
+ // This is used to create token slots.
49
+ @function get-token-slots() {
50
+ @return sass-utils.deep-merge-all(
51
+ get-unthemable-tokens(),
52
+ get-color-tokens(token-utils.$placeholder-color-config),
53
+ get-typography-tokens(token-utils.$placeholder-typography-config),
54
+ get-density-tokens(token-utils.$placeholder-density-config)
55
+ );
56
+ }
@@ -0,0 +1,184 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use 'sass:math';
5
+ @use '../../token-utils';
6
+ @use '../../../theming/theming';
7
+ @use '../../../typography/typography-utils';
8
+ @use '../../../style/sass-utils';
9
+
10
+ // The prefix used to generate the fully qualified name for tokens in this file.
11
+ $prefix: (mat, datepicker);
12
+
13
+ $_selected-fade-amount: 0.6;
14
+ $_today-fade-amount: 0.2;
15
+
16
+ // Utility that produces a range background color from a specific color.
17
+ @function private-get-range-background-color($color) {
18
+ @return rgba($color, 0.2);
19
+ }
20
+
21
+ // Utility that produces the overlap selected color from an overlap color.
22
+ @function private-get-default-overlap-selected-color($overlap-color) {
23
+ @return color.adjust($overlap-color, $lightness: -30%);
24
+ }
25
+
26
+ // Default range comparison color.
27
+ $private-default-comparison-color: private-get-range-background-color(#f9ab00);
28
+
29
+ // Default range overlap color.
30
+ $private-default-overlap-color: #a8dab5;
31
+
32
+ // Tokens that can't be configured through Angular Material's current theming API,
33
+ // but may be in a future version of the theming API.
34
+ @function get-unthemable-tokens() {
35
+ @return ();
36
+ }
37
+
38
+ // Tokens that can be configured through Angular Material's color theming API.
39
+ @function get-color-tokens($config) {
40
+ $foreground: map.get($config, foreground);
41
+ $background: map.get($config, background);
42
+ $primary: map.get($config, primary);
43
+ $inactive-icon-color: theming.get-color-from-palette($foreground, icon);
44
+ $text-color: theming.get-color-from-palette($foreground, text);
45
+ $secondary-text-color: theming.get-color-from-palette($foreground, secondary-text);
46
+ $disabled-text-color: theming.get-color-from-palette($foreground, disabled-text);
47
+ $divider-color: theming.get-color-from-palette($foreground, divider);
48
+ $hint-text-color: theming.get-color-from-palette($foreground, hint-text);
49
+ $preview-outline-color: $divider-color;
50
+ $today-disabled-outline-color: null;
51
+
52
+ $primary-color: theming.get-color-from-palette(map.get($config, primary));
53
+ $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
54
+ $calendar-tokens: private-get-calendar-color-palette-color-tokens($config, primary);
55
+ $toggle-tokens: private-get-toggle-color-palette-color-tokens($config, primary);
56
+
57
+ // The divider color is set under the assumption that it'll be used
58
+ // for a solid border, but because we're using a dashed border for the
59
+ // preview range, we need to bump its opacity to ensure that it's visible.
60
+ @if meta.type-of($preview-outline-color) == color {
61
+ $preview-outline-opacity: math.min(opacity($preview-outline-color) * 2, 1);
62
+ $preview-outline-color: rgba($preview-outline-color, $preview-outline-opacity);
63
+ }
64
+
65
+ @if (meta.type-of($hint-text-color) == color) {
66
+ $today-disabled-outline-color: color.adjust($hint-text-color, $alpha: -$_today-fade-amount);
67
+ }
68
+ @else {
69
+ $today-disabled-outline-color: $disabled-text-color;
70
+ }
71
+
72
+ @return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
73
+ toggle-icon-color: $inactive-icon-color,
74
+ calendar-body-label-text-color: $secondary-text-color,
75
+ calendar-period-button-icon-color: $inactive-icon-color,
76
+ calendar-navigation-button-icon-color: $inactive-icon-color,
77
+ calendar-header-divider-color: $divider-color,
78
+ calendar-header-text-color: $secondary-text-color,
79
+
80
+ // Note: though it's not text, the border is a hint about the fact
81
+ // that this is today's date, so we use the hint color.
82
+ calendar-date-today-outline-color: $hint-text-color,
83
+ calendar-date-today-disabled-state-outline-color: $today-disabled-outline-color,
84
+ calendar-date-text-color: $text-color,
85
+ calendar-date-outline-color: transparent,
86
+ calendar-date-disabled-state-text-color: $disabled-text-color,
87
+ calendar-date-preview-state-outline-color: $preview-outline-color,
88
+
89
+ range-input-separator-color: $text-color,
90
+ range-input-disabled-state-separator-color: $disabled-text-color,
91
+ range-input-disabled-state-text-color: $disabled-text-color,
92
+
93
+ calendar-container-background-color: theming.get-color-from-palette($background, card),
94
+ calendar-container-text-color: $text-color,
95
+ ));
96
+ }
97
+
98
+ // Tokens that can be configured through Angular Material's typography theming API.
99
+ @function get-typography-tokens($config) {
100
+ $fallback-font: typography-utils.font-family($config);
101
+
102
+ @return (
103
+ // TODO(crisbeto): the typography tokens for other components set every typography dimension of
104
+ // an element (e.g. size, weight, line height, letter spacing). These tokens only set the values
105
+ // that were set in the previous theming API to reduce the amount of subtle screenshot
106
+ // differences. We should look into introducing the other tokens in a follow-up.
107
+ calendar-text-font: $fallback-font,
108
+ calendar-text-size: 13px, // TODO(crisbeto): this doesn't appear to affect anything
109
+
110
+ calendar-body-label-text-size: typography-utils.font-size($config, button),
111
+ calendar-body-label-text-weight: typography-utils.font-weight($config, button),
112
+
113
+ calendar-period-button-text-size: typography-utils.font-size($config, button),
114
+ calendar-period-button-text-weight: typography-utils.font-weight($config, button),
115
+
116
+ calendar-header-text-size: 11px,
117
+ calendar-header-text-weight: typography-utils.font-weight($config, body-1),
118
+ );
119
+ }
120
+
121
+ // Gets the tokens map that can be used to override the range colors.
122
+ @function get-range-color-tokens(
123
+ $range-color,
124
+ $comparison-color: $private-default-comparison-color,
125
+ $overlap-color: $private-default-overlap-color,
126
+ $overlap-selected-color: private-get-default-overlap-selected-color($overlap-color)) {
127
+
128
+ @return (
129
+ calendar-date-in-range-state-background-color: $range-color,
130
+ calendar-date-in-comparison-range-state-background-color: $comparison-color,
131
+ calendar-date-in-overlap-range-state-background-color: $overlap-color,
132
+ calendar-date-in-overlap-range-selected-state-background-color: $overlap-selected-color,
133
+ );
134
+ }
135
+
136
+ @function private-get-calendar-color-palette-color-tokens($config, $palette-name) {
137
+ $foreground: map.get($config, foreground);
138
+ $palette: map.get($config, $palette-name);
139
+ $palette-color: theming.get-color-from-palette($palette);
140
+ $default-contrast: theming.get-color-from-palette($palette, default-contrast);
141
+ $active-background-color: theming.get-color-from-palette($palette, 0.3);
142
+ $active-disabled-color: null;
143
+
144
+ @if (meta.type-of($palette-color) == color) {
145
+ $active-disabled-color: color.adjust($palette-color, $alpha: -$_selected-fade-amount);
146
+ }
147
+ @else {
148
+ $active-disabled-color: theming.get-color-from-palette($foreground, disabled-button);
149
+ }
150
+
151
+ @return (
152
+ calendar-date-selected-state-text-color: $default-contrast,
153
+ calendar-date-selected-state-background-color: $palette-color,
154
+ calendar-date-selected-disabled-state-background-color: $active-disabled-color,
155
+ calendar-date-today-selected-state-outline-color: $default-contrast,
156
+ calendar-date-focus-state-background-color: $active-background-color,
157
+ calendar-date-hover-state-background-color: $active-background-color,
158
+ );
159
+ }
160
+
161
+ @function private-get-toggle-color-palette-color-tokens($config, $palette-name) {
162
+ $palette: map.get($config, $palette-name);
163
+
164
+ @return (
165
+ toggle-active-state-icon-color: theming.get-color-from-palette($palette, text),
166
+ );
167
+ }
168
+
169
+
170
+ // Tokens that can be configured through Angular Material's density theming API.
171
+ @function get-density-tokens($config) {
172
+ @return ();
173
+ }
174
+
175
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
176
+ // This is used to create token slots.
177
+ @function get-token-slots() {
178
+ @return sass-utils.deep-merge-all(
179
+ get-unthemable-tokens(),
180
+ get-color-tokens(token-utils.$placeholder-color-config),
181
+ get-typography-tokens(token-utils.$placeholder-typography-config),
182
+ get-density-tokens(token-utils.$placeholder-density-config)
183
+ );
184
+ }
@@ -0,0 +1,45 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../style/sass-utils';
5
+
6
+ // The prefix used to generate the fully qualified name for tokens in this file.
7
+ $prefix: (mat, divider);
8
+
9
+ // Tokens that can't be configured through Angular Material's current theming API,
10
+ // but may be in a future version of the theming API.
11
+ @function get-unthemable-tokens() {
12
+ @return (
13
+ width: 1px
14
+ );
15
+ }
16
+
17
+ // Tokens that can be configured through Angular Material's color theming API.
18
+ @function get-color-tokens($config) {
19
+ $foreground: map.get($config, foreground);
20
+
21
+ @return (
22
+ color: theming.get-color-from-palette($foreground, divider)
23
+ );
24
+ }
25
+
26
+ // Tokens that can be configured through Angular Material's typography theming API.
27
+ @function get-typography-tokens($config) {
28
+ @return ();
29
+ }
30
+
31
+ // Tokens that can be configured through Angular Material's density theming API.
32
+ @function get-density-tokens($config) {
33
+ @return ();
34
+ }
35
+
36
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
37
+ // This is used to create token slots.
38
+ @function get-token-slots() {
39
+ @return sass-utils.deep-merge-all(
40
+ get-unthemable-tokens(),
41
+ get-color-tokens(token-utils.$placeholder-color-config),
42
+ get-typography-tokens(token-utils.$placeholder-typography-config),
43
+ get-density-tokens(token-utils.$placeholder-density-config)
44
+ );
45
+ }
@@ -0,0 +1,63 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, legacy-button-toggle);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ height: 36px,
15
+ shape: 2px,
16
+ focus-state-layer-opacity: 1,
17
+ );
18
+ }
19
+
20
+ // Tokens that can be configured through Angular Material's color theming API.
21
+ @function get-color-tokens($config) {
22
+ $foreground: map.get($config, foreground);
23
+ $background: map.get($config, background);
24
+
25
+ @return (
26
+ text-color: theming.get-color-from-palette($foreground, hint-text),
27
+ state-layer-color: theming.get-color-from-palette($background, focused-button),
28
+ selected-state-text-color: theming.get-color-from-palette($foreground, secondary-text),
29
+ selected-state-background-color: theming.get-color-from-palette($background, selected-button),
30
+ disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
31
+ disabled-state-background-color:
32
+ theming.get-color-from-palette($background, disabled-button-toggle),
33
+ disabled-selected-state-background-color:
34
+ theming.get-color-from-palette($background, selected-disabled-button)
35
+ );
36
+ }
37
+
38
+ // Tokens that can be configured through Angular Material's typography theming API.
39
+ @function get-typography-tokens($config) {
40
+ @return (
41
+ // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
42
+ // letter spacing etc). The button toggle only has the font to match what it had in the
43
+ // old theming API and to reduce internal breakages. We should introduce more typography
44
+ // tokens at some point.
45
+ text-font: typography-utils.font-family($config),
46
+ );
47
+ }
48
+
49
+ // Tokens that can be configured through Angular Material's density theming API.
50
+ @function get-density-tokens($config) {
51
+ @return ();
52
+ }
53
+
54
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
55
+ // This is used to create token slots.
56
+ @function get-token-slots() {
57
+ @return sass-utils.deep-merge-all(
58
+ get-unthemable-tokens(),
59
+ get-color-tokens(token-utils.$placeholder-color-config),
60
+ get-typography-tokens(token-utils.$placeholder-typography-config),
61
+ get-density-tokens(token-utils.$placeholder-density-config)
62
+ );
63
+ }
@@ -0,0 +1,65 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use '../../token-utils';
5
+ @use '../../../theming/theming';
6
+ @use '../../../style/sass-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mat, sidenav);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ @function get-unthemable-tokens() {
14
+ @return (
15
+ // Currently zero, but it appears to be relevant for M3.
16
+ // See: https://m3.material.io/components/navigation-drawer/overview
17
+ container-shape: 0,
18
+ );
19
+ }
20
+
21
+ // Tokens that can be configured through Angular Material's color theming API.
22
+ @function get-color-tokens($config) {
23
+ $is-dark: map.get($config, is-dark);
24
+ $foreground: map.get($config, foreground);
25
+ $background: map.get($config, background);
26
+ $scrim-opacity: 0.6;
27
+ $scrim-color: theming.get-color-from-palette($background, card, $scrim-opacity);
28
+ $fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
29
+
30
+ @return (
31
+ container-divider-color: theming.get-color-from-palette($foreground, divider),
32
+ container-background-color: theming.get-color-from-palette($background, dialog),
33
+ container-text-color: theming.get-color-from-palette($foreground, text),
34
+ content-background-color: theming.get-color-from-palette($background, background),
35
+ content-text-color: theming.get-color-from-palette($foreground, text),
36
+
37
+ // We use invert() here to have the darken the background color expected to be used.
38
+ // If the background is light, we use a dark backdrop. If the background is dark, we
39
+ // use a light backdrop. If the value isn't a color, Sass will throw an error so we
40
+ // fall back to something generic.
41
+ scrim-color: if(meta.type-of($scrim-color) == color,
42
+ color.invert($scrim-color), $fallback-scrim-color),
43
+ );
44
+ }
45
+
46
+ // Tokens that can be configured through Angular Material's typography theming API.
47
+ @function get-typography-tokens($config) {
48
+ @return ();
49
+ }
50
+
51
+ // Tokens that can be configured through Angular Material's density theming API.
52
+ @function get-density-tokens($config) {
53
+ @return ();
54
+ }
55
+
56
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
57
+ // This is used to create token slots.
58
+ @function get-token-slots() {
59
+ @return sass-utils.deep-merge-all(
60
+ get-unthemable-tokens(),
61
+ get-color-tokens(token-utils.$placeholder-color-config),
62
+ get-typography-tokens(token-utils.$placeholder-typography-config),
63
+ get-density-tokens(token-utils.$placeholder-density-config)
64
+ );
65
+ }
@@ -0,0 +1,87 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use '../../token-utils';
4
+ @use '../../../typography/typography-utils';
5
+ @use '../../../theming/theming';
6
+ @use '../../../style/sass-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mat, standard-button-toggle);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ @function get-unthemable-tokens() {
14
+ @return (
15
+ shape: 4px,
16
+ hover-state-layer-opacity: 0.04,
17
+ focus-state-layer-opacity: 0.12,
18
+ );
19
+ }
20
+
21
+ // Tokens that can be configured through Angular Material's color theming API.
22
+ @function get-color-tokens($config) {
23
+ $foreground: map.get($config, foreground);
24
+ $background: map.get($config, background);
25
+ $theme-divider-color: theming.get-color-from-palette($foreground, divider);
26
+
27
+ // By default the theme usually has an rgba color for the dividers, which can
28
+ // stack up with the background of a button toggle. This can cause the border
29
+ // of a selected toggle to look different from an deselected one. We use a solid
30
+ // color to ensure that the border always stays the same.
31
+ $divider-color: if(meta.type-of($theme-divider-color) == color,
32
+ theming.private-rgba-to-hex($theme-divider-color, map.get($background, card)),
33
+ $theme-divider-color
34
+ );
35
+
36
+ @return (
37
+ text-color: theming.get-color-from-palette($foreground, text),
38
+ background-color: theming.get-color-from-palette($background, card),
39
+ state-layer-color: theming.get-color-from-palette($background, focused-button, 1),
40
+ selected-state-background-color: theming.get-color-from-palette($background, selected-button),
41
+ selected-state-text-color: theming.get-color-from-palette($foreground, text),
42
+ disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
43
+ disabled-state-background-color: theming.get-color-from-palette($background, card),
44
+ disabled-selected-state-text-color: theming.get-color-from-palette($foreground, text),
45
+ disabled-selected-state-background-color:
46
+ theming.get-color-from-palette($background, selected-disabled-button),
47
+ divider-color: $divider-color,
48
+ );
49
+ }
50
+
51
+ // Tokens that can be configured through Angular Material's typography theming API.
52
+ @function get-typography-tokens($config) {
53
+ @return (
54
+ // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
55
+ // letter spacing etc). The button toggle only has the font to match what it had in the
56
+ // old theming API and to reduce internal breakages. We should introduce more typography
57
+ // tokens at some point.
58
+ text-font: typography-utils.font-family($config),
59
+ );
60
+ }
61
+
62
+ // Tokens that can be configured through Angular Material's density theming API.
63
+ @function get-density-tokens($config) {
64
+ $density-scale: theming.clamp-density($config, -4);
65
+ $size-scale: (
66
+ 0: 48px,
67
+ -1: 44px,
68
+ -2: 40px,
69
+ -3: 36px,
70
+ -4: 24px,
71
+ );
72
+
73
+ @return (
74
+ height: map.get($size-scale, $density-scale)
75
+ );
76
+ }
77
+
78
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
79
+ // This is used to create token slots.
80
+ @function get-token-slots() {
81
+ @return sass-utils.deep-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
+ );
87
+ }
@@ -0,0 +1,79 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, toolbar);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return ();
14
+ }
15
+
16
+ // Tokens that can be configured through Angular Material's color theming API.
17
+ @function get-color-tokens($config) {
18
+ $foreground: map.get($config, foreground);
19
+ $background: map.get($config, background);
20
+
21
+ @return private-get-color-palette-color-tokens(
22
+ $background-color: theming.get-color-from-palette($background, app-bar),
23
+ $text-color: theming.get-color-from-palette($foreground, text),
24
+ );
25
+ }
26
+
27
+ // Tokens that can be configured through Angular Material's typography theming API.
28
+ @function get-typography-tokens($config) {
29
+ @return (
30
+ title-text-font: typography-utils.font-family($config, title) or
31
+ typography-utils.font-family($config),
32
+ title-text-line-height: typography-utils.line-height($config, title),
33
+ title-text-size: typography-utils.font-size($config, title),
34
+ title-text-tracking: typography-utils.letter-spacing($config, title),
35
+ title-text-weight: typography-utils.font-weight($config, title),
36
+ );
37
+ }
38
+
39
+ // Tokens that can be configured through Angular Material's density theming API.
40
+ @function get-density-tokens($config) {
41
+ $density-scale: theming.clamp-density($config, -3);
42
+ $standard-scale: (
43
+ 0: 64px,
44
+ -1: 60px,
45
+ -2: 56px,
46
+ -3: 52px,
47
+ );
48
+
49
+ $mobile-scale: (
50
+ 0: 56px,
51
+ -1: 52px,
52
+ -2: 48px,
53
+ -3: 44px,
54
+ );
55
+
56
+ @return (
57
+ standard-height: map.get($standard-scale, $density-scale),
58
+ mobile-height: map.get($mobile-scale, $density-scale),
59
+ );
60
+ }
61
+
62
+ // Generates the tokens used to theme the toolbar based on a palette.
63
+ @function private-get-color-palette-color-tokens($background-color, $text-color) {
64
+ @return (
65
+ container-background-color: $background-color,
66
+ container-text-color: $text-color,
67
+ );
68
+ }
69
+
70
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
71
+ // This is used to create token slots.
72
+ @function get-token-slots() {
73
+ @return sass-utils.deep-merge-all(
74
+ get-unthemable-tokens(),
75
+ get-color-tokens(token-utils.$placeholder-color-config),
76
+ get-typography-tokens(token-utils.$placeholder-typography-config),
77
+ get-density-tokens(token-utils.$placeholder-density-config)
78
+ );
79
+ }