@angular/material 17.0.0-next.4 → 17.0.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 (55) hide show
  1. package/_index.scss +1 -1
  2. package/button/_button-theme.scss +69 -50
  3. package/card/_card-theme.scss +1 -3
  4. package/core/theming/_m2-inspection.scss +1 -1
  5. package/core/tokens/m2/_index.scss +8 -0
  6. package/core/tokens/m2/mdc/_button-filled.scss +3 -3
  7. package/core/tokens/m2/mdc/_button-protected.scss +94 -0
  8. package/core/typography/_versioning.scss +1 -1
  9. package/esm2022/button/button.mjs +4 -4
  10. package/esm2022/button/fab.mjs +8 -8
  11. package/esm2022/chips/chip-option.mjs +2 -2
  12. package/esm2022/chips/chip-row.mjs +2 -2
  13. package/esm2022/chips/chip.mjs +2 -2
  14. package/esm2022/core/version.mjs +1 -1
  15. package/esm2022/datepicker/calendar.mjs +2 -2
  16. package/esm2022/datepicker/datepicker-errors.mjs +2 -2
  17. package/esm2022/form-field/form-field.mjs +3 -3
  18. package/esm2022/radio/radio.mjs +2 -2
  19. package/esm2022/select/select.mjs +3 -3
  20. package/esm2022/sort/sort-header.mjs +3 -3
  21. package/esm2022/tooltip/tooltip.mjs +2 -2
  22. package/fesm2022/button.mjs +12 -12
  23. package/fesm2022/button.mjs.map +1 -1
  24. package/fesm2022/chips.mjs +6 -6
  25. package/fesm2022/chips.mjs.map +1 -1
  26. package/fesm2022/core.mjs +1 -1
  27. package/fesm2022/core.mjs.map +1 -1
  28. package/fesm2022/datepicker.mjs +3 -3
  29. package/fesm2022/datepicker.mjs.map +1 -1
  30. package/fesm2022/form-field.mjs +2 -2
  31. package/fesm2022/form-field.mjs.map +1 -1
  32. package/fesm2022/radio.mjs +2 -2
  33. package/fesm2022/radio.mjs.map +1 -1
  34. package/fesm2022/select.mjs +2 -2
  35. package/fesm2022/select.mjs.map +1 -1
  36. package/fesm2022/sort.mjs +2 -2
  37. package/fesm2022/sort.mjs.map +1 -1
  38. package/fesm2022/tooltip.mjs +2 -2
  39. package/fesm2022/tooltip.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/prebuilt-themes/deeppurple-amber.css +1 -1
  42. package/prebuilt-themes/indigo-pink.css +1 -1
  43. package/prebuilt-themes/pink-bluegrey.css +1 -1
  44. package/prebuilt-themes/purple-green.css +1 -1
  45. package/radio/_radio-theme.scss +9 -0
  46. package/schematics/ng-add/index.js +1 -1
  47. package/schematics/ng-add/index.mjs +1 -1
  48. package/schematics/ng-add/setup-project.js +2 -2
  49. package/schematics/ng-add/setup-project.mjs +2 -2
  50. package/schematics/ng-add/theming/theming.js +3 -3
  51. package/schematics/ng-add/theming/theming.mjs +3 -3
  52. package/slider/_slider-theme.scss +77 -43
  53. package/snack-bar/_snack-bar-theme.scss +46 -18
  54. package/toolbar/_toolbar-theme.scss +55 -27
  55. package/tooltip/_tooltip-theme.scss +56 -24
package/_index.scss CHANGED
@@ -112,7 +112,7 @@ list-density, list-base;
112
112
  progress-spinner-theme, progress-spinner-color, progress-spinner-typography,
113
113
  progress-spinner-density, progress-spinner-base;
114
114
  @forward './radio/radio-theme' as radio-* show radio-theme, radio-color, radio-typography,
115
- radio-density;
115
+ radio-density, radio-base;
116
116
  @forward './select/select-theme' as select-* show select-theme, select-color, select-typography,
117
117
  select-density;
118
118
  @forward './sidenav/sidenav-theme' as sidenav-* show sidenav-theme, sidenav-color,
@@ -5,6 +5,7 @@
5
5
  @use '@material/button/button-protected-theme' as mdc-button-protected-theme;
6
6
  @use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;
7
7
  @use '@material/theme/theme-color' as mdc-theme-color;
8
+ @use '@material/elevation/elevation-theme' as mdc-elevation-theme;
8
9
 
9
10
  @use './button-theme-private';
10
11
  @use '../core/mdc-helpers/mdc-helpers';
@@ -12,8 +13,9 @@
12
13
  @use '../core/theming/inspection';
13
14
  @use '../core/typography/typography';
14
15
  @use '../core/tokens/m2/mdc/button-filled' as tokens-mdc-button-filled;
16
+ @use '../core/tokens/m2/mdc/button-protected' as tokens-mdc-button-protected;
15
17
 
16
- @function on-color($theme, $palette) {
18
+ @function _on-color($theme, $palette) {
17
19
  $is-dark: inspection.get-theme-type($theme) == dark;
18
20
  @return if(mdc-helpers.variable-safe-contrast-tone($palette, $is-dark) == 'dark', #000, #fff);
19
21
  }
@@ -24,13 +26,6 @@
24
26
  ));
25
27
  }
26
28
 
27
- @mixin _raised-button-variant($foreground, $background) {
28
- @include mdc-button-protected-theme.theme((
29
- container-color: $background,
30
- label-text-color: $foreground,
31
- ));
32
- }
33
-
34
29
  @mixin _outlined-button-variant($color) {
35
30
  @include mdc-button-outlined-theme.theme((
36
31
  label-text-color: $color,
@@ -78,36 +73,6 @@
78
73
  }
79
74
  }
80
75
 
81
- .mat-mdc-raised-button {
82
- &.mat-unthemed {
83
- @include _raised-button-variant($on-surface, $surface);
84
- }
85
-
86
- &.mat-primary {
87
- @include _raised-button-variant($on-primary, $primary);
88
- }
89
-
90
- &.mat-accent {
91
- @include _raised-button-variant($on-secondary, $secondary);
92
- }
93
-
94
- &.mat-warn {
95
- @include _raised-button-variant($on-error, $error);
96
- }
97
-
98
- @include button-theme-private.apply-disabled-style() {
99
- @include mdc-button-protected-theme.theme((
100
- // We need to pass both the disabled and enabled values, because the enabled
101
- // ones apply to anchors while the disabled ones are for buttons.
102
- disabled-container-color: $disabled-container-color,
103
- disabled-label-text-color: $disabled-ink-color,
104
- container-color: $disabled-container-color,
105
- label-text-color: $disabled-ink-color,
106
- container-elevation: 0,
107
- ));
108
- }
109
- }
110
-
111
76
  .mat-mdc-outlined-button {
112
77
  @include mdc-button-outlined-theme.theme((
113
78
  outline-color: rgba(mdc-theme-color.prop-value(on-surface), 0.12)
@@ -151,17 +116,17 @@
151
116
  }
152
117
  }
153
118
 
154
- .mat-mdc-unelevated-button {
155
- $surface: inspection.get-theme-color($theme, background, card);
156
- $primary: inspection.get-theme-color($theme, primary);
157
- $accent: inspection.get-theme-color($theme, accent);
158
- $error: inspection.get-theme-color($theme, warn);
119
+ $surface: inspection.get-theme-color($theme, background, card);
120
+ $primary: inspection.get-theme-color($theme, primary);
121
+ $accent: inspection.get-theme-color($theme, accent);
122
+ $error: inspection.get-theme-color($theme, warn);
159
123
 
160
- $on-surface: on-color($theme, $surface);
161
- $on-primary: on-color($theme, $primary);
162
- $on-accent: on-color($theme, $accent);
163
- $on-error: on-color($theme, $error);
124
+ $on-surface: _on-color($theme, $surface);
125
+ $on-primary: _on-color($theme, $primary);
126
+ $on-accent: _on-color($theme, $accent);
127
+ $on-error: _on-color($theme, $error);
164
128
 
129
+ .mat-mdc-unelevated-button {
165
130
  $default-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $surface, $on-surface);
166
131
  $primary-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $primary, $on-primary);
167
132
  $accent-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $accent, $on-accent);
@@ -182,12 +147,66 @@
182
147
  &.mat-warn {
183
148
  @include mdc-button-filled-theme.theme($warn-color-tokens);
184
149
  }
150
+ }
151
+
152
+ .mat-mdc-raised-button {
153
+ $default-color-tokens: tokens-mdc-button-protected.get-color-tokens(
154
+ $theme,
155
+ $surface,
156
+ $on-surface
157
+ );
158
+ $primary-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $primary, $on-primary);
159
+ $accent-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $accent, $on-accent);
160
+ $warn-color-tokens: tokens-mdc-button-filled.get-color-tokens($theme, $error, $on-error);
185
161
 
162
+ &.mat-unthemed {
163
+ @include mdc-button-protected-theme.theme($default-color-tokens);
164
+ }
165
+
166
+ &.mat-primary {
167
+ @include mdc-button-protected-theme.theme($primary-color-tokens);
168
+ }
169
+
170
+ &.mat-accent {
171
+ @include mdc-button-protected-theme.theme($accent-color-tokens);
172
+ }
173
+
174
+ &.mat-warn {
175
+ @include mdc-button-protected-theme.theme($warn-color-tokens);
176
+ }
177
+
178
+ // TODO(wagnermaciel): Remove this workaround when b/301126527 is resolved
179
+ @include mdc-helpers.disable-mdc-fallback-declarations {
180
+ @include mdc-elevation-theme.elevation(2);
181
+
182
+ &:hover, &:focus {
183
+ @include mdc-elevation-theme.elevation(4);
184
+ }
185
+
186
+ &:active, &:focus:active {
187
+ @include mdc-elevation-theme.elevation(8);
188
+ }
189
+ }
190
+ }
191
+
192
+ $is-dark: inspection.get-theme-type($theme) == dark;
193
+ $disabled-ink-color: rgba($on-surface, if($is-dark, 0.5, 0.38));
194
+ $disabled-container-color: rgba($on-surface, 0.12);
195
+
196
+ .mat-mdc-raised-button {
186
197
  @include button-theme-private.apply-disabled-style() {
187
- $is-dark: inspection.get-theme-type($theme) == dark;
188
- $disabled-ink-color: rgba($on-surface, if($is-dark, 0.5, 0.38));
189
- $disabled-container-color: rgba($on-surface, 0.12);
198
+ @include mdc-elevation-theme.elevation(0);
199
+ @include mdc-button-protected-theme.theme((
200
+ disabled-container-color: $disabled-container-color,
201
+ disabled-label-text-color: $disabled-ink-color,
202
+ container-color: $disabled-container-color,
203
+ label-text-color: $disabled-ink-color,
204
+ ));
205
+ }
206
+ }
190
207
 
208
+ .mat-mdc-unelevated-button {
209
+ @include button-theme-private.apply-disabled-style() {
191
210
  @include mdc-button-filled-theme.theme((
192
211
  disabled-container-color: $disabled-container-color,
193
212
  disabled-label-text-color: $disabled-ink-color,
@@ -87,9 +87,7 @@
87
87
  }
88
88
  }
89
89
 
90
- @mixin theme($theme-or-color-config) {
91
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
92
-
90
+ @mixin theme($theme) {
93
91
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-card') {
94
92
  @if inspection.get-theme-version($theme) == 1 {
95
93
  @include _theme-from-tokens(inspection.get-theme-tokens($theme));
@@ -28,7 +28,7 @@ $_typography-keys: (
28
28
  headline-5,
29
29
  headline-6,
30
30
  subtitle-1,
31
- font-famiy,
31
+ font-family,
32
32
  subtitle-2,
33
33
  body-1,
34
34
  body-2,
@@ -3,10 +3,12 @@
3
3
  @use '../../style/sass-utils';
4
4
 
5
5
  @use './mat/card' as tokens-mat-card;
6
+ @use './mat/toolbar' as tokens-mat-toolbar;
6
7
  @use './mat/radio' as tokens-mat-radio;
7
8
  @use './mat/snack-bar' as tokens-mat-snack-bar;
8
9
  @use './mat/tab-header' as tokens-mat-tab-header;
9
10
  @use './mat/tab-header-with-background' as tokens-mat-tab-header-with-background;
11
+ @use './mat/slider' as tokens-mat-slider;
10
12
  @use './mdc/checkbox' as tokens-mdc-checkbox;
11
13
  @use './mdc/circular-progress' as tokens-mdc-circular-progress;
12
14
  @use './mdc/dialog' as tokens-mdc-dialog;
@@ -19,6 +21,8 @@
19
21
  @use './mdc/snack-bar' as tokens-mdc-snack-bar;
20
22
  @use './mdc/tab' as tokens-mdc-tab;
21
23
  @use './mdc/tab-indicator' as tokens-mdc-tab-indicator;
24
+ @use './mdc/slider' as tokens-mdc-slider;
25
+ @use './mdc/plain-tooltip' as tokens-mdc-plain-tooltip;
22
26
 
23
27
  /// Gets the tokens for the given theme, m2 tokens module, and theming system.
24
28
  /// @param {Map} $theme The Angular Material theme object to generate token values from.
@@ -68,6 +72,8 @@
68
72
  _get-tokens-for-module($theme, tokens-mat-snack-bar),
69
73
  _get-tokens-for-module($theme, tokens-mat-tab-header),
70
74
  _get-tokens-for-module($theme, tokens-mat-tab-header-with-background),
75
+ _get-tokens-for-module($theme, tokens-mat-toolbar),
76
+ _get-tokens-for-module($theme, tokens-mat-slider),
71
77
  _get-tokens-for-module($theme, tokens-mdc-checkbox),
72
78
  _get-tokens-for-module($theme, tokens-mdc-circular-progress),
73
79
  _get-tokens-for-module($theme, tokens-mdc-dialog),
@@ -80,5 +86,7 @@
80
86
  _get-tokens-for-module($theme, tokens-mdc-snack-bar),
81
87
  _get-tokens-for-module($theme, tokens-mdc-tab),
82
88
  _get-tokens-for-module($theme, tokens-mdc-tab-indicator),
89
+ _get-tokens-for-module($theme, tokens-mdc-slider),
90
+ _get-tokens-for-module($theme, tokens-mdc-plain-tooltip),
83
91
  );
84
92
  }
@@ -44,7 +44,7 @@ $prefix: (mdc, button-filled);
44
44
  );
45
45
  }
46
46
 
47
- @function on-color($theme, $palette) {
47
+ @function _on-color($theme, $palette) {
48
48
  @if ($palette) {
49
49
  $is-dark: inspection.get-theme-type($theme) == dark;
50
50
  @return if(mdc-helpers.variable-safe-contrast-tone($palette, $is-dark) == 'dark', #000, #fff);
@@ -56,8 +56,8 @@ $prefix: (mdc, button-filled);
56
56
  $is-dark: inspection.get-theme-type($theme) == dark;
57
57
  $primary: inspection.get-theme-color($theme, primary);
58
58
  $surface: inspection.get-theme-color($theme, background, card);
59
- $on-primary: on-color($theme, $primary);
60
- $on-surface: on-color($theme, $surface);
59
+ $on-primary: _on-color($theme, $primary);
60
+ $on-surface: _on-color($theme, $surface);
61
61
 
62
62
  @return (
63
63
  container-color: if($color, $color, transparent),
@@ -0,0 +1,94 @@
1
+ @use '../../token-utils';
2
+ @use '../../../mdc-helpers/mdc-helpers';
3
+ @use '../../../style/sass-utils';
4
+ @use '../../../theming/inspection';
5
+
6
+ // The prefix used to generate the fully qualified name for tokens in this file.
7
+ $prefix: (mdc, button-protected);
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
+ //
12
+ // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
13
+ // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
14
+ // our CSS.
15
+ @function get-unthemable-tokens() {
16
+ @return (
17
+ container-shape: 4px,
18
+ container-height: 36px,
19
+ keep-touch-target: false,
20
+
21
+ focus-ring-color: null,
22
+ focus-ring-offset: null,
23
+ focus-state-layer-opacity: null,
24
+ hover-state-layer-opacity: null,
25
+ pressed-state-layer-opacity: null,
26
+ container-shadow-color: null,
27
+ container-elevation: null,
28
+ hover-container-elevation: null,
29
+ disabled-container-elevation: null,
30
+ focus-container-elevation: null,
31
+ pressed-container-elevation: null,
32
+ label-text-font: null,
33
+ label-text-size: null,
34
+ label-text-tracking: null,
35
+ label-text-transform: null,
36
+ label-text-weight: null,
37
+ with-icon-icon-size: null,
38
+ focus-label-text-color: null,
39
+ hover-label-text-color: null,
40
+ pressed-label-text-color: null,
41
+ with-icon-disabled-icon-color: null,
42
+ with-icon-focus-icon-color: null,
43
+ with-icon-hover-icon-color: null,
44
+ with-icon-icon-color: null,
45
+ with-icon-pressed-icon-color: null
46
+ );
47
+ }
48
+
49
+ @function _on-color($theme, $palette) {
50
+ @if ($palette) {
51
+ $is-dark: inspection.get-theme-type($theme) == dark;
52
+ @return if(mdc-helpers.variable-safe-contrast-tone($palette, $is-dark) == 'dark', #000, #fff);
53
+ }
54
+ }
55
+
56
+ // Tokens that can be configured through Angular Material's color theming API.
57
+ @function get-color-tokens($theme, $color: null, $on-color: null) {
58
+ $is-dark: inspection.get-theme-type($theme) == dark;
59
+ $primary: inspection.get-theme-color($theme, primary);
60
+ $surface: inspection.get-theme-color($theme, background, card);
61
+ $on-primary: _on-color($theme, $primary);
62
+ $on-surface: _on-color($theme, $surface);
63
+
64
+ @return (
65
+ container-color: if($color, $color, transparent),
66
+ focus-state-layer-color: $on-primary,
67
+ hover-state-layer-color: $on-primary,
68
+ pressed-state-layer-color: $on-primary,
69
+ label-text-color: if($on-color, $on-color, inherit),
70
+ disabled-container-color: rgba($on-surface, 0.12),
71
+ disabled-label-text-color: rgba($on-surface, 0.38)
72
+ );
73
+ }
74
+
75
+ // Tokens that can be configured through Angular Material's typography theming API.
76
+ @function get-typography-tokens($theme) {
77
+ @return ();
78
+ }
79
+
80
+ // Tokens that can be configured through Angular Material's density theming API.
81
+ @function get-density-tokens($theme) {
82
+ @return ();
83
+ }
84
+
85
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
86
+ // This is used to create token slots.
87
+ @function get-token-slots() {
88
+ @return sass-utils.deep-merge-all(
89
+ get-unthemable-tokens(),
90
+ get-color-tokens(token-utils.$placeholder-color-config),
91
+ get-typography-tokens(token-utils.$placeholder-typography-config),
92
+ get-density-tokens(token-utils.$placeholder-density-config)
93
+ );
94
+ }
@@ -71,7 +71,7 @@
71
71
  headline-5: map.get($config, headline),
72
72
  headline-6: map.get($config, title),
73
73
  subtitle-1: map.get($config, subheading-2),
74
- font-famiy: map.get($config, font-family),
74
+ font-family: map.get($config, font-family),
75
75
 
76
76
  // These mappings are odd, but body-2 in the 2014 system actually looks closer to subtitle-2
77
77
  // in the 2018 system, and subeading-1 in the 2014 system looks more like body-1 in the 2018