@angular/material 18.1.0-rc.0 → 18.1.0

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 (46) hide show
  1. package/button/_button-base.scss +13 -6
  2. package/button/_button-theme.scss +26 -27
  3. package/core/tokens/m2/mdc/_extended-fab.scss +5 -6
  4. package/core/tokens/m2/mdc/_fab-small.scss +4 -4
  5. package/core/tokens/m2/mdc/_fab.scss +4 -4
  6. package/core/tokens/m2/mdc/_protected-button.scss +13 -7
  7. package/core/tokens/m3/mdc/_protected-button.scss +22 -5
  8. package/datepicker/index.d.ts +5 -1
  9. package/esm2022/button/button.mjs +4 -4
  10. package/esm2022/chips/chip-grid.mjs +24 -6
  11. package/esm2022/core/internal-form-field/internal-form-field.mjs +2 -2
  12. package/esm2022/core/version.mjs +1 -1
  13. package/esm2022/datepicker/datepicker-input-base.mjs +1 -1
  14. package/esm2022/list/action-list.mjs +2 -2
  15. package/esm2022/list/list-option.mjs +18 -4
  16. package/esm2022/list/list.mjs +10 -4
  17. package/esm2022/list/nav-list.mjs +2 -2
  18. package/esm2022/list/selection-list.mjs +2 -2
  19. package/esm2022/tabs/tabs-animations.mjs +2 -2
  20. package/fesm2022/button.mjs +4 -4
  21. package/fesm2022/button.mjs.map +1 -1
  22. package/fesm2022/chips.mjs +23 -5
  23. package/fesm2022/chips.mjs.map +1 -1
  24. package/fesm2022/core.mjs +3 -3
  25. package/fesm2022/core.mjs.map +1 -1
  26. package/fesm2022/datepicker.mjs.map +1 -1
  27. package/fesm2022/list.mjs +32 -12
  28. package/fesm2022/list.mjs.map +1 -1
  29. package/fesm2022/tabs.mjs +1 -1
  30. package/fesm2022/tabs.mjs.map +1 -1
  31. package/list/_list-inherited-structure.scss +516 -0
  32. package/list/_list-item-hcm-indicator.scss +2 -3
  33. package/list/_list-theme.scss +17 -18
  34. package/list/index.d.ts +2 -0
  35. package/package.json +7 -7
  36. package/prebuilt-themes/azure-blue.css +1 -1
  37. package/prebuilt-themes/cyan-orange.css +1 -1
  38. package/prebuilt-themes/deeppurple-amber.css +1 -1
  39. package/prebuilt-themes/indigo-pink.css +1 -1
  40. package/prebuilt-themes/magenta-violet.css +1 -1
  41. package/prebuilt-themes/pink-bluegrey.css +1 -1
  42. package/prebuilt-themes/purple-green.css +1 -1
  43. package/prebuilt-themes/rose-red.css +1 -1
  44. package/schematics/ng-add/index.js +2 -2
  45. package/schematics/ng-add/index.mjs +2 -2
  46. package/list/_list-option-trailing-avatar-compat.scss +0 -59
@@ -1,8 +1,5 @@
1
- @use '@material/touch-target' as mdc-touch-target;
2
-
3
1
  @use '../core/tokens/token-utils';
4
2
  @use '../core/style/layout-common';
5
- @use '../core/mdc-helpers/mdc-helpers';
6
3
 
7
4
  // Adds styles necessary to provide stateful interactions with the button. This includes providing
8
5
  // content for the state container's ::before and ::after so that they can be given a background
@@ -126,9 +123,19 @@
126
123
  // the button itself would require us to wrap it in another div. See:
127
124
  // https://github.com/material-components/material-components-web/tree/master/packages/mdc-button#making-buttons-accessible
128
125
  .mat-mdc-button-touch-target {
129
- @include mdc-touch-target.touch-target(
130
- $set-width: $is-square,
131
- $query: mdc-helpers.$mdc-base-styles-query);
126
+ position: absolute;
127
+ top: 50%;
128
+ height: 48px;
129
+
130
+ @if $is-square {
131
+ left: 50%;
132
+ width: 48px;
133
+ transform: translate(-50%, -50%);
134
+ } @else {
135
+ left: 0;
136
+ right: 0;
137
+ transform: translateY(-50%);
138
+ }
132
139
 
133
140
  @include token-utils.use-tokens($prefix, $slots) {
134
141
  @include token-utils.create-token-slot(display, touch-target-display);
@@ -1,8 +1,3 @@
1
- @use '@material/button/button-text-theme' as mdc-button-text-theme;
2
- @use '@material/button/button-filled-theme' as mdc-button-filled-theme;
3
- @use '@material/button/button-protected-theme' as mdc-button-protected-theme;
4
- @use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;
5
-
6
1
  @use '../core/theming/theming';
7
2
  @use '../core/theming/inspection';
8
3
  @use '../core/theming/validation';
@@ -29,7 +24,7 @@
29
24
  tokens-mat-text-button.get-color-tokens($theme)
30
25
  );
31
26
 
32
- @include mdc-button-text-theme.theme($mdc-tokens);
27
+ @include token-utils.create-token-values(tokens-mdc-text-button.$prefix, $mdc-tokens);
33
28
  @include token-utils.create-token-values(tokens-mat-text-button.$prefix, $mat-tokens);
34
29
  }
35
30
 
@@ -44,7 +39,7 @@
44
39
  tokens-mat-filled-button.get-color-tokens($theme)
45
40
  );
46
41
 
47
- @include mdc-button-filled-theme.theme($mdc-tokens);
42
+ @include token-utils.create-token-values(tokens-mdc-filled-button.$prefix, $mdc-tokens);
48
43
  @include token-utils.create-token-values(tokens-mat-filled-button.$prefix, $mat-tokens);
49
44
  }
50
45
 
@@ -59,7 +54,7 @@
59
54
  tokens-mat-protected-button.get-color-tokens($theme)
60
55
  );
61
56
 
62
- @include mdc-button-protected-theme.theme($mdc-tokens);
57
+ @include token-utils.create-token-values(tokens-mdc-protected-button.$prefix, $mdc-tokens);
63
58
  @include token-utils.create-token-values(tokens-mat-protected-button.$prefix, $mat-tokens);
64
59
  }
65
60
 
@@ -74,7 +69,7 @@
74
69
  tokens-mat-outlined-button.get-color-tokens($theme)
75
70
  );
76
71
 
77
- @include mdc-button-outlined-theme.theme($mdc-tokens);
72
+ @include token-utils.create-token-values(tokens-mdc-outlined-button.$prefix, $mdc-tokens);
78
73
  @include token-utils.create-token-values(tokens-mat-outlined-button.$prefix, $mat-tokens);
79
74
  }
80
75
 
@@ -97,10 +92,14 @@
97
92
  token-utils.get-tokens-for($tokens, tokens-mat-filled-button.$prefix, $options...);
98
93
  $mat-outlined-button-tokens:
99
94
  token-utils.get-tokens-for($tokens, tokens-mat-outlined-button.$prefix, $options...);
100
- @include mdc-button-text-theme.theme($mdc-text-button-tokens);
101
- @include mdc-button-protected-theme.theme($mdc-protected-button-tokens);
102
- @include mdc-button-filled-theme.theme($mdc-filled-button-tokens);
103
- @include mdc-button-outlined-theme.theme($mdc-outlined-button-tokens);
95
+
96
+ @include token-utils.create-token-values(tokens-mdc-text-button.$prefix, $mdc-text-button-tokens);
97
+ @include token-utils.create-token-values(
98
+ tokens-mdc-protected-button.$prefix, $mdc-protected-button-tokens);
99
+ @include token-utils.create-token-values(
100
+ tokens-mdc-filled-button.$prefix, $mdc-filled-button-tokens);
101
+ @include token-utils.create-token-values(
102
+ tokens-mdc-outlined-button.$prefix, $mdc-outlined-button-tokens);
104
103
  @include token-utils.create-token-values(tokens-mat-text-button.$prefix, $mat-text-button-tokens);
105
104
  @include token-utils.create-token-values(
106
105
  tokens-mat-protected-button.$prefix, $mat-protected-button-tokens);
@@ -119,13 +118,13 @@
119
118
  }
120
119
  @else {
121
120
  @include sass-utils.current-selector-or-root() {
122
- @include mdc-button-text-theme.theme(
121
+ @include token-utils.create-token-values(tokens-mdc-text-button.$prefix,
123
122
  tokens-mdc-text-button.get-unthemable-tokens());
124
- @include mdc-button-filled-theme.theme(
123
+ @include token-utils.create-token-values(tokens-mdc-filled-button.$prefix,
125
124
  tokens-mdc-filled-button.get-unthemable-tokens());
126
- @include mdc-button-protected-theme.theme(
125
+ @include token-utils.create-token-values(tokens-mdc-protected-button.$prefix,
127
126
  tokens-mdc-protected-button.get-unthemable-tokens());
128
- @include mdc-button-outlined-theme.theme(
127
+ @include token-utils.create-token-values(tokens-mdc-outlined-button.$prefix,
129
128
  tokens-mdc-outlined-button.get-unthemable-tokens());
130
129
 
131
130
  @include token-utils.create-token-values(tokens-mat-text-button.$prefix,
@@ -223,14 +222,14 @@
223
222
  }
224
223
  @else {
225
224
  @include sass-utils.current-selector-or-root() {
226
- @include mdc-button-text-theme.theme(
225
+ @include token-utils.create-token-values(tokens-mdc-text-button.$prefix,
227
226
  tokens-mdc-text-button.get-typography-tokens($theme));
228
- @include mdc-button-filled-theme.theme(
227
+ @include token-utils.create-token-values(tokens-mdc-filled-button.$prefix,
229
228
  tokens-mdc-filled-button.get-typography-tokens($theme));
230
- @include mdc-button-outlined-theme.theme(
231
- tokens-mdc-outlined-button.get-typography-tokens($theme));
232
- @include mdc-button-protected-theme.theme(
229
+ @include token-utils.create-token-values(tokens-mdc-protected-button.$prefix,
233
230
  tokens-mdc-protected-button.get-typography-tokens($theme));
231
+ @include token-utils.create-token-values(tokens-mdc-outlined-button.$prefix,
232
+ tokens-mdc-outlined-button.get-typography-tokens($theme));
234
233
 
235
234
  @include token-utils.create-token-values(tokens-mat-text-button.$prefix,
236
235
  tokens-mat-text-button.get-typography-tokens($theme));
@@ -252,14 +251,14 @@
252
251
  }
253
252
  @else {
254
253
  @include sass-utils.current-selector-or-root() {
255
- @include mdc-button-text-theme.theme(
254
+ @include token-utils.create-token-values(tokens-mdc-text-button.$prefix,
256
255
  tokens-mdc-text-button.get-density-tokens($theme));
257
- @include mdc-button-filled-theme.theme(
256
+ @include token-utils.create-token-values(tokens-mdc-filled-button.$prefix,
258
257
  tokens-mdc-filled-button.get-density-tokens($theme));
259
- @include mdc-button-outlined-theme.theme(
260
- tokens-mdc-outlined-button.get-density-tokens($theme));
261
- @include mdc-button-protected-theme.theme(
258
+ @include token-utils.create-token-values(tokens-mdc-protected-button.$prefix,
262
259
  tokens-mdc-protected-button.get-density-tokens($theme));
260
+ @include token-utils.create-token-values(tokens-mdc-outlined-button.$prefix,
261
+ tokens-mdc-outlined-button.get-density-tokens($theme));
263
262
 
264
263
  @include token-utils.create-token-values(tokens-mat-text-button.$prefix,
265
264
  tokens-mat-text-button.get-density-tokens($theme));
@@ -10,6 +10,10 @@ $prefix: (mdc, extended-fab);
10
10
  @return (
11
11
  container-height: 48px,
12
12
  container-shape: 24px,
13
+ container-elevation-shadow: elevation.get-box-shadow(6),
14
+ focus-container-elevation-shadow: elevation.get-box-shadow(8),
15
+ hover-container-elevation-shadow: elevation.get-box-shadow(8),
16
+ pressed-container-elevation-shadow: elevation.get-box-shadow(12),
13
17
 
14
18
  // =============================================================================================
15
19
  // = TOKENS NOT USED IN ANGULAR MATERIAL =
@@ -49,12 +53,7 @@ $prefix: (mdc, extended-fab);
49
53
 
50
54
  // Tokens that can be configured through Angular Material's color theming API.
51
55
  @function get-color-tokens($theme) {
52
- @return (
53
- container-elevation-shadow: elevation.get-box-shadow(6),
54
- focus-container-elevation-shadow: elevation.get-box-shadow(8),
55
- hover-container-elevation-shadow: elevation.get-box-shadow(8),
56
- pressed-container-elevation-shadow: elevation.get-box-shadow(12),
57
- );
56
+ @return ();
58
57
  }
59
58
 
60
59
  // Tokens that can be configured through Angular Material's typography theming API.
@@ -9,6 +9,10 @@ $prefix: (mdc, fab-small);
9
9
  @function get-unthemable-tokens() {
10
10
  @return (
11
11
  container-shape: 50%,
12
+ container-elevation-shadow: elevation.get-box-shadow(6),
13
+ focus-container-elevation-shadow: elevation.get-box-shadow(8),
14
+ hover-container-elevation-shadow: elevation.get-box-shadow(8),
15
+ pressed-container-elevation-shadow: elevation.get-box-shadow(12),
12
16
 
13
17
  // =============================================================================================
14
18
  // = TOKENS NOT USED IN ANGULAR MATERIAL =
@@ -52,10 +56,6 @@ $prefix: (mdc, fab-small);
52
56
  @return (
53
57
  // Background color of the FAB.
54
58
  container-color: inspection.get-theme-color($theme, background, card),
55
- container-elevation-shadow: elevation.get-box-shadow(6),
56
- focus-container-elevation-shadow: elevation.get-box-shadow(8),
57
- hover-container-elevation-shadow: elevation.get-box-shadow(8),
58
- pressed-container-elevation-shadow: elevation.get-box-shadow(12),
59
59
  );
60
60
  }
61
61
 
@@ -9,6 +9,10 @@ $prefix: (mdc, fab);
9
9
  @function get-unthemable-tokens() {
10
10
  @return (
11
11
  container-shape: 50%,
12
+ container-elevation-shadow: elevation.get-box-shadow(6),
13
+ focus-container-elevation-shadow: elevation.get-box-shadow(8),
14
+ hover-container-elevation-shadow: elevation.get-box-shadow(8),
15
+ pressed-container-elevation-shadow: elevation.get-box-shadow(12),
12
16
 
13
17
  // =============================================================================================
14
18
  // = TOKENS NOT USED IN ANGULAR MATERIAL =
@@ -53,10 +57,6 @@ $prefix: (mdc, fab);
53
57
  @return (
54
58
  // Background color of the FAB.
55
59
  container-color: inspection.get-theme-color($theme, background, card),
56
- container-elevation-shadow: elevation.get-box-shadow(6),
57
- focus-container-elevation-shadow: elevation.get-box-shadow(8),
58
- hover-container-elevation-shadow: elevation.get-box-shadow(8),
59
- pressed-container-elevation-shadow: elevation.get-box-shadow(12),
60
60
  );
61
61
  }
62
62
 
@@ -1,6 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
3
  @use '../../../style/sass-utils';
4
+ @use '../../../style/elevation';
4
5
  @use '../../../theming/inspection';
5
6
  @use '../../../theming/theming';
6
7
  @use '../../../mdc-helpers/mdc-helpers';
@@ -17,7 +18,11 @@ $prefix: (mdc, protected-button);
17
18
  @function get-unthemable-tokens() {
18
19
  @return (
19
20
  container-shape: 4px,
20
- keep-touch-target: false,
21
+ container-elevation-shadow: elevation.get-box-shadow(2),
22
+ disabled-container-elevation-shadow: elevation.get-box-shadow(0),
23
+ focus-container-elevation-shadow: elevation.get-box-shadow(4),
24
+ hover-container-elevation-shadow: elevation.get-box-shadow(4),
25
+ pressed-container-elevation-shadow: elevation.get-box-shadow(8),
21
26
 
22
27
  // =============================================================================================
23
28
  // = TOKENS NOT USED IN ANGULAR MATERIAL =
@@ -39,6 +44,13 @@ $prefix: (mdc, protected-button);
39
44
  focus-state-layer-color: null,
40
45
  hover-state-layer-color: null,
41
46
  pressed-state-layer-color: null,
47
+ keep-touch-target: null,
48
+ container-elevation: null,
49
+ disabled-container-elevation: null,
50
+ focus-container-elevation: null,
51
+ hover-container-elevation: null,
52
+ pressed-container-elevation: null,
53
+ container-shadow-color: null,
42
54
  );
43
55
  }
44
56
 
@@ -53,12 +65,6 @@ $prefix: (mdc, protected-button);
53
65
  0.12),
54
66
  disabled-label-text-color: inspection.get-theme-color($theme, foreground, disabled-button,
55
67
  if($is-dark, 0.5, 0.38)),
56
- container-elevation: 2,
57
- disabled-container-elevation: 0,
58
- focus-container-elevation: 4,
59
- hover-container-elevation: 4,
60
- pressed-container-elevation: 8,
61
- container-shadow-color: #000,
62
68
  );
63
69
  }
64
70
 
@@ -1,5 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
+ @use '../../../style/elevation';
3
4
  @use '../../token-utils';
4
5
 
5
6
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -12,7 +13,7 @@ $prefix: (mdc, protected-button);
12
13
  /// @return {Map} A set of tokens for the MDC protected-button
13
14
  @function get-tokens($systems, $exclude-hardcoded, $token-slots) {
14
15
  // Note: in M3 the "protected" button is called "elevated".
15
- $mdc-tokens: token-utils.get-mdc-tokens('elevated-button', $systems, $exclude-hardcoded);
16
+ $tokens: token-utils.get-mdc-tokens('elevated-button', $systems, $exclude-hardcoded);
16
17
  $variant-tokens: (
17
18
  primary: (), // Default, no overrides needed.
18
19
  secondary: (
@@ -57,7 +58,7 @@ $prefix: (mdc, protected-button);
57
58
  );
58
59
 
59
60
  @return token-utils.namespace-tokens($prefix, (
60
- _fix-tokens($mdc-tokens),
61
+ _fix-tokens($tokens),
61
62
  token-utils.map-values($variant-tokens, meta.get-function(_fix-tokens)),
62
63
  ), $token-slots);
63
64
  }
@@ -67,11 +68,27 @@ $prefix: (mdc, protected-button);
67
68
  /// @param {Map} $initial-tokens Map of protected button tokens currently being generated.
68
69
  /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
69
70
  @function _fix-tokens($initial-tokens) {
70
- // Need to get the hardcoded values, because they include opacities that are used for the disabled
71
- // state.
71
+ // Need to get the hardcoded values, because they include
72
+ // opacities that are used for the disabled state.
72
73
  $hardcoded-tokens: token-utils.get-mdc-tokens('elevated-button', (), false);
74
+ $tokens: $initial-tokens;
75
+ $elevation-tokens: (
76
+ container-elevation,
77
+ disabled-container-elevation,
78
+ focus-container-elevation,
79
+ hover-container-elevation,
80
+ pressed-container-elevation,
81
+ );
82
+
83
+ @each $token in $elevation-tokens {
84
+ $elevation: map.get($tokens, $token);
85
+
86
+ @if ($elevation != null) {
87
+ $tokens: map.set($tokens, $token + '-shadow', elevation.get-box-shadow($elevation));
88
+ }
89
+ }
73
90
 
74
- @return token-utils.combine-color-tokens($initial-tokens, $hardcoded-tokens, (
91
+ @return token-utils.combine-color-tokens($tokens, $hardcoded-tokens, (
75
92
  (
76
93
  color: disabled-label-text-color,
77
94
  opacity: disabled-label-text-opacity,
@@ -52,7 +52,11 @@ import { ValidatorFn } from '@angular/forms';
52
52
  import { ViewContainerRef } from '@angular/core';
53
53
  import { WritableSignal } from '@angular/core';
54
54
 
55
- /** Function that can be used to filter out dates from a calendar. */
55
+ /**
56
+ * Function that can be used to filter out dates from a calendar.
57
+ * Datepicker can sometimes receive a null value as input for the date argument.
58
+ * This doesn't represent a "null date" but rather signifies that no date has been selected yet in the calendar.
59
+ */
56
60
  export declare type DateFilterFn<D> = (date: D | null) => boolean;
57
61
 
58
62
  /** Possible positions for the datepicker dropdown along the X axis. */