@angular/material-experimental 17.2.0-next.0 → 17.2.0-rc.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 (37) hide show
  1. package/_index.scss +1 -0
  2. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +4 -4
  3. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +4 -4
  4. package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +4 -4
  5. package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize.mjs +4 -4
  6. package/esm2022/column-resize/column-resize-module.mjs +13 -13
  7. package/esm2022/column-resize/overlay-handle.mjs +4 -4
  8. package/esm2022/column-resize/resizable-directives/default-enabled-resizable.mjs +4 -4
  9. package/esm2022/column-resize/resizable-directives/resizable.mjs +4 -4
  10. package/esm2022/column-resize/resize-strategy.mjs +4 -4
  11. package/esm2022/menubar/menubar-item.mjs +4 -4
  12. package/esm2022/menubar/menubar-module.mjs +5 -5
  13. package/esm2022/menubar/menubar.mjs +4 -4
  14. package/esm2022/popover-edit/lens-directives.mjs +10 -10
  15. package/esm2022/popover-edit/popover-edit-module.mjs +5 -5
  16. package/esm2022/popover-edit/table-directives.mjs +13 -13
  17. package/esm2022/selection/row-selection.mjs +4 -4
  18. package/esm2022/selection/select-all.mjs +4 -4
  19. package/esm2022/selection/selection-column.mjs +4 -4
  20. package/esm2022/selection/selection-module.mjs +5 -5
  21. package/esm2022/selection/selection-toggle.mjs +4 -4
  22. package/esm2022/selection/selection.mjs +4 -4
  23. package/esm2022/version.mjs +1 -1
  24. package/fesm2022/column-resize.mjs +36 -36
  25. package/fesm2022/column-resize.mjs.map +1 -1
  26. package/fesm2022/material-experimental.mjs +1 -1
  27. package/fesm2022/material-experimental.mjs.map +1 -1
  28. package/fesm2022/menubar.mjs +10 -10
  29. package/fesm2022/menubar.mjs.map +1 -1
  30. package/fesm2022/popover-edit.mjs +25 -25
  31. package/fesm2022/popover-edit.mjs.map +1 -1
  32. package/fesm2022/selection.mjs +19 -19
  33. package/fesm2022/selection.mjs.map +1 -1
  34. package/package.json +3 -3
  35. package/theming/_color-api-back-compat.scss +98 -0
  36. package/theming/_custom-tokens.scss +134 -22
  37. package/theming/_m3-tokens.scss +25 -2
@@ -1,5 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use '@angular/material' as mat;
3
+ @use '@material/elevation/elevation-theme' as mdc-elevation;
3
4
 
4
5
  /// Hardcode the given value, or null if hardcoded values are excluded.
5
6
  @function _hardcode($value, $exclude-hardcoded) {
@@ -28,6 +29,9 @@
28
29
  @function autocomplete($systems, $exclude-hardcoded) {
29
30
  @return (
30
31
  background-color: map.get($systems, md-sys-color, surface-container),
32
+ container-shape: map.get($systems, md-sys-shape, corner-extra-small),
33
+ container-elevation-shadow:
34
+ _hardcode(mdc-elevation.elevation-box-shadow(2), $exclude-hardcoded),
31
35
  );
32
36
  }
33
37
 
@@ -186,13 +190,51 @@
186
190
  );
187
191
  }
188
192
 
193
+ /// Generates custom tokens for the mat-chip.
194
+ /// @param {Map} $systems The MDC system tokens
195
+ /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
196
+ /// @return {Map} A set of custom tokens for the mat-chip
197
+ @function chip($systems, $exclude-hardcoded) {
198
+ @return ((
199
+ disabled-container-opacity: _hardcode(1, $exclude-hardcoded),
200
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-secondary-container),
201
+ selected-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface),
202
+ trailing-action-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
203
+ selected-trailing-action-state-layer-color:
204
+ map.get($systems, md-sys-color, on-secondary-container),
205
+ trailing-action-hover-state-layer-opacity:
206
+ map.get($systems, md-sys-state, hover-state-layer-opacity),
207
+ trailing-action-focus-state-layer-opacity:
208
+ map.get($systems, md-sys-state, focus-state-layer-opacity),
209
+ trailing-action-opacity: _hardcode(1, $exclude-hardcoded),
210
+ trailing-action-focus-opacity: _hardcode(1, $exclude-hardcoded),
211
+ ), (
212
+ primary: (
213
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-primary-container),
214
+ selected-trailing-action-state-layer-color:
215
+ map.get($systems, md-sys-color, on-primary-container),
216
+ ),
217
+ secondary: (), // Default, no overrides needed.
218
+ tertiary: (
219
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-tertiary-container),
220
+ selected-trailing-action-state-layer-color:
221
+ map.get($systems, md-sys-color, on-tertiary-container),
222
+ ),
223
+ error: (
224
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-error-container),
225
+ selected-trailing-action-state-layer-color:
226
+ map.get($systems, md-sys-color, on-error-container),
227
+ ),
228
+ ));
229
+ }
230
+
189
231
  /// Generates custom tokens for the mdc-chip. (MDC has a chip component, but they
190
232
  /// seem to have made up the tokens rather than using ones generated from the token database,
191
233
  /// therefore we need a custom token function for it).
192
234
  /// @param {Map} $systems The MDC system tokens
193
235
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
194
236
  /// @return {Map} A set of custom tokens for the mdc-chip
195
- @function chip($systems, $exclude-hardcoded) {
237
+ @function mdc-chip($systems, $exclude-hardcoded) {
196
238
  @return (mat.private-merge-all(
197
239
  _generate-typography-tokens($systems, label-text, label-large),
198
240
  (
@@ -201,11 +243,6 @@
201
243
  radius: 8px,
202
244
  ), $exclude-hardcoded),
203
245
  with-avatar-avatar-size: _hardcode(24px, $exclude-hardcoded),
204
- elevated-container-color: map.get($systems, md-sys-color, surface-container-low),
205
- elevated-disabled-container-color: mat.private-safe-color-change(
206
- map.get($systems, md-sys-color, on-surface),
207
- $alpha: 0.12,
208
- ),
209
246
  label-text-color: map.get($systems, md-sys-color, on-surface-variant),
210
247
  disabled-label-text-color: mat.private-safe-color-change(
211
248
  map.get($systems, md-sys-color, on-surface),
@@ -213,30 +250,61 @@
213
250
  ),
214
251
  with-icon-icon-size: _hardcode(18px, $exclude-hardcoded),
215
252
  with-icon-icon-color: map.get($systems, md-sys-color, on-surface-variant),
216
- with-icon-disabled-icon-color: mat.private-safe-color-change(
217
- map.get($systems, md-sys-color, on-surface),
218
- $alpha: 0.38,
219
- ),
253
+ with-icon-disabled-icon-color: map.get($systems, md-sys-color, on-surface),
220
254
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-secondary-container),
221
255
  with-trailing-icon-trailing-icon-color: map.get($systems, md-sys-color, on-surface-variant),
222
- with-trailing-icon-disabled-trailing-icon-color: mat.private-safe-color-change(
223
- map.get($systems, md-sys-color, on-surface),
224
- $alpha: 0.38,
225
- ),
256
+ with-trailing-icon-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface),
226
257
  focus-state-layer-opacity: map.get($systems, md-sys-state, focus-state-layer-opacity),
227
258
  focus-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
259
+ outline-width: _hardcode(1px, $exclude-hardcoded),
260
+ outline-color: map.get($systems, md-sys-color, outline),
261
+ disabled-outline-color: mat.private-safe-color-change(
262
+ map.get($systems, md-sys-color, on-surface),
263
+ $alpha: 0.12,
264
+ ),
265
+ focus-outline-color: map.get($systems, md-sys-color, on-surface-variant),
266
+ hover-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
267
+ hover-state-layer-opacity: map.get($systems, md-sys-state, hover-state-layer-opacity),
268
+ with-avatar-disabled-avatar-opacity: _hardcode(0.38, $exclude-hardcoded),
269
+ elevated-selected-container-color: map.get($systems, md-sys-color, secondary-container),
270
+ flat-selected-outline-width: _hardcode(0, $exclude-hardcoded),
271
+ selected-label-text-color: map.get($systems, md-sys-color, on-secondary-container),
272
+ flat-disabled-selected-container-color: mat.private-safe-color-change(
273
+ map.get($systems, md-sys-color, on-surface),
274
+ $alpha: 0.12,
275
+ ),
276
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-secondary-container),
277
+ selected-hover-state-layer-opacity:
278
+ map.get($systems, md-sys-state, hover-state-layer-opacity),
279
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-secondary-container),
280
+ selected-focus-state-layer-opacity:
281
+ map.get($systems, md-sys-state, focus-state-layer-opacity),
282
+ with-icon-disabled-icon-opacity: _hardcode(0.38, $exclude-hardcoded),
283
+ with-trailing-icon-disabled-trailing-icon-opacity: _hardcode(0.38, $exclude-hardcoded),
228
284
  ),
229
285
  ), (
230
286
  // Color variants:
231
287
  primary: (
232
288
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-primary-container),
289
+ elevated-selected-container-color: map.get($systems, md-sys-color, primary-container),
290
+ selected-label-text-color: map.get($systems, md-sys-color, on-primary-container),
291
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-primary-container),
292
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-primary-container),
233
293
  ),
234
294
  secondary: (), // Default, no overrides needed.
235
295
  tertiary: (
236
296
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-tertiary-container),
297
+ elevated-selected-container-color: map.get($systems, md-sys-color, tertiary-container),
298
+ selected-label-text-color: map.get($systems, md-sys-color, on-tertiary-container),
299
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container),
300
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container),
237
301
  ),
238
302
  error: (
239
303
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-error-container),
304
+ elevated-selected-container-color: map.get($systems, md-sys-color, error-container),
305
+ selected-label-text-color: map.get($systems, md-sys-color, on-error-container),
306
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-error-container),
307
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-error-container),
240
308
  )
241
309
  ));
242
310
  }
@@ -822,9 +890,7 @@
822
890
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
823
891
  /// @return {Map} A set of custom tokens for the mat-option
824
892
  @function option($systems, $exclude-hardcoded) {
825
- @return (mat.private-merge-all(
826
- _generate-typography-tokens($systems, label-text, label-large),
827
- (
893
+ @return ((
828
894
  selected-state-label-text-color: map.get($systems, md-sys-color, on-secondary-container),
829
895
  label-text-color: map.get($systems, md-sys-color, on-surface),
830
896
  hover-state-layer-color: mat.private-safe-color-change(
@@ -836,7 +902,17 @@
836
902
  $alpha: map.get($systems, md-sys-state, focus-state-layer-opacity)
837
903
  ),
838
904
  selected-state-layer-color: map.get($systems, md-sys-color, secondary-container),
839
- ),
905
+
906
+ // According to the spec the options have to be `label-large` in all typography
907
+ // dimensions, however this is inconsistent with the designs and with MDC's
908
+ // own implementation. This appears to be a bug in the spec, because MDC overrides
909
+ // the font size and weight to be `body-large` (see b/261838263). We make the same
910
+ // override here so the label looks correct.
911
+ label-text-size: map.get($systems, md-sys-typescale, body-large-size),
912
+ label-text-weight: map.get($systems, md-sys-typescale, body-large-weight),
913
+ label-text-font: map.get($systems, md-sys-typescale, label-large-font),
914
+ label-text-line-height: map.get($systems, md-sys-typescale, label-large-line-height),
915
+ label-text-tracking: map.get($systems, md-sys-typescale, label-large-tracking),
840
916
  ), (
841
917
  // Color variants:
842
918
  primary: (
@@ -995,6 +1071,8 @@
995
1071
  map.get($systems, md-sys-color, on-surface), $alpha: 0.38),
996
1072
  focused-arrow-color: map.get($systems, md-sys-color, primary),
997
1073
  invalid-arrow-color: map.get($systems, md-sys-color, error),
1074
+ container-elevation-shadow:
1075
+ _hardcode(mdc-elevation.elevation-box-shadow(2), $exclude-hardcoded),
998
1076
  )
999
1077
  ), (
1000
1078
  // Color variants:
@@ -1017,12 +1095,14 @@
1017
1095
  /// @return {Map} A set of custom tokens for the mat-sidenav
1018
1096
  @function sidenav($systems, $exclude-hardcoded) {
1019
1097
  @return (
1020
- container-shape: 16px,
1021
- container-divider-color: map.get($systems, md-sys-color, outline),
1098
+ container-elevation-shadow: _hardcode(none, $exclude-hardcoded),
1099
+ container-divider-color: _hardcode(transparent, $exclude-hardcoded),
1100
+ container-width: _hardcode(360px, $exclude-hardcoded),
1101
+ container-shape: map.get($systems, md-sys-shape, corner-large),
1022
1102
  container-background-color: map.get($systems, md-sys-color, surface),
1023
1103
  container-text-color: map.get($systems, md-sys-color, on-surface-variant),
1024
- content-background-color: _hardcode(inherit, $exclude-hardcoded),
1025
- content-text-color: _hardcode(inherit, $exclude-hardcoded),
1104
+ content-background-color: map.get($systems, md-sys-color, background),
1105
+ content-text-color: map.get($systems, md-sys-color, on-background),
1026
1106
  scrim-color: mat.private-safe-color-change(
1027
1107
  map.get($systems, md-ref-palette, neutral-variant20), $alpha: 0.4),
1028
1108
  );
@@ -1075,6 +1155,35 @@
1075
1155
  ));
1076
1156
  }
1077
1157
 
1158
+ /// Generates custom tokens for the mat-slide-toggle.
1159
+ /// @param {Map} $systems The MDC system tokens
1160
+ /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
1161
+ /// @return {Map} A set of custom tokens for the mat-slide-toggle
1162
+ @function switch($systems, $exclude-hardcoded) {
1163
+ @return ((
1164
+ unselected-handle-size: 16px,
1165
+ selected-handle-size: 24px,
1166
+ with-icon-handle-size: 24px,
1167
+ pressed-handle-size: 28px,
1168
+ selected-handle-horizontal-margin: 0 24px,
1169
+ selected-with-icon-handle-horizontal-margin: 0 24px,
1170
+ selected-pressed-handle-horizontal-margin: 0 22px,
1171
+ unselected-handle-horizontal-margin: 0 8px,
1172
+ unselected-with-icon-handle-horizontal-margin: 0 4px,
1173
+ unselected-pressed-handle-horizontal-margin: 0 2px,
1174
+ // The hidden and visible track represent whichever track is visible or
1175
+ // hidden in the ui. This could be the .mdc-switch__track :before or
1176
+ // :after depending on whether the switch is selected or unselected.
1177
+ //
1178
+ // The m2 slide-toggle uses transforms to hide & show the tracks while
1179
+ // the m3 slide-toggle uses opacity.
1180
+ visible-track-opacity: 1,
1181
+ hidden-track-opacity: 0,
1182
+ visible-track-transition: opacity 75ms,
1183
+ hidden-track-transition: opacity 75ms,
1184
+ ), ());
1185
+ }
1186
+
1078
1187
  /// Generates custom tokens for the mat-snack-bar.
1079
1188
  /// @param {Map} $systems The MDC system tokens
1080
1189
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
@@ -1505,12 +1614,15 @@
1505
1614
  primary: (), // Default, no overrides needed
1506
1615
  secondary: (
1507
1616
  active-indicator-color: map.get($systems, md-sys-color, secondary),
1617
+ track-color: map.get($systems, md-sys-color, secondary-container),
1508
1618
  ),
1509
1619
  tertiary: (
1510
1620
  active-indicator-color: map.get($systems, md-sys-color, tertiary),
1621
+ track-color: map.get($systems, md-sys-color, tertiary-container),
1511
1622
  ),
1512
1623
  error: (
1513
1624
  active-indicator-color: map.get($systems, md-sys-color, error),
1625
+ track-color: map.get($systems, md-sys-color, error-container),
1514
1626
  ),
1515
1627
  );
1516
1628
  }
@@ -464,6 +464,17 @@
464
464
  @return $tokens;
465
465
  }
466
466
 
467
+ /// Fixes values in the list tokens that are inconsistent with its usage.
468
+ /// @param {Map} $initial-tokens Map of list tokens currently being generated.
469
+ /// @return {Map} The given tokens, with the inconsistent values replaced with valid ones.
470
+ @function _fix-list-tokens($tokens) {
471
+ // This does not match the spec, which defines this to be `md.sys.color.surface`.
472
+ // However, this interferes with the use case of placing a list on other components. For example,
473
+ // the bottom sheet's container color is `md.sys.color.surface-container-low`. Instead, allow the
474
+ // list to just display the colors for its background.
475
+ @return map.set($tokens, list-item-container-color, transparent);
476
+ }
477
+
467
478
  /// Generates a set of namespaced tokens for all components.
468
479
  /// @param {Map} $systems The MDC system tokens
469
480
  /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
@@ -514,7 +525,7 @@
514
525
  ),
515
526
  _namespace-tokens(
516
527
  (mdc, chip),
517
- custom-tokens.chip($systems, $exclude-hardcoded),
528
+ custom-tokens.mdc-chip($systems, $exclude-hardcoded),
518
529
  $token-slots
519
530
  ),
520
531
  _namespace-tokens(
@@ -660,7 +671,9 @@
660
671
  ),
661
672
  _namespace-tokens(
662
673
  (mdc, list),
663
- mdc-tokens.md-comp-list-values($systems, $exclude-hardcoded),
674
+ _fix-list-tokens(
675
+ mdc-tokens.md-comp-list-values($systems, $exclude-hardcoded)
676
+ ),
664
677
  $token-slots
665
678
  ),
666
679
  _namespace-tokens(
@@ -753,6 +766,11 @@
753
766
  custom-tokens.card($systems, $exclude-hardcoded),
754
767
  $token-slots
755
768
  ),
769
+ _namespace-tokens(
770
+ (mat, chip),
771
+ custom-tokens.chip($systems, $exclude-hardcoded),
772
+ $token-slots
773
+ ),
756
774
  _namespace-tokens(
757
775
  (mat, datepicker),
758
776
  custom-tokens.datepicker($systems, $exclude-hardcoded),
@@ -904,6 +922,11 @@
904
922
  custom-tokens.stepper($systems, $exclude-hardcoded),
905
923
  $token-slots
906
924
  ),
925
+ _namespace-tokens(
926
+ (mat, switch),
927
+ custom-tokens.switch($systems, $exclude-hardcoded),
928
+ $token-slots
929
+ ),
907
930
  _namespace-tokens(
908
931
  (mat, tab-header),
909
932
  custom-tokens.tab-header($systems, $exclude-hardcoded),