@angular/material-experimental 17.2.0-next.1 → 17.2.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 (34) hide show
  1. package/_index.scss +1 -0
  2. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
  3. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -3
  4. package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +3 -3
  5. package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize.mjs +3 -3
  6. package/esm2022/column-resize/column-resize-module.mjs +12 -12
  7. package/esm2022/column-resize/overlay-handle.mjs +3 -3
  8. package/esm2022/column-resize/resizable-directives/default-enabled-resizable.mjs +3 -3
  9. package/esm2022/column-resize/resizable-directives/resizable.mjs +3 -3
  10. package/esm2022/column-resize/resize-strategy.mjs +3 -3
  11. package/esm2022/menubar/menubar-item.mjs +3 -3
  12. package/esm2022/menubar/menubar-module.mjs +4 -4
  13. package/esm2022/menubar/menubar.mjs +3 -3
  14. package/esm2022/popover-edit/lens-directives.mjs +9 -9
  15. package/esm2022/popover-edit/popover-edit-module.mjs +4 -4
  16. package/esm2022/popover-edit/table-directives.mjs +12 -12
  17. package/esm2022/selection/row-selection.mjs +3 -3
  18. package/esm2022/selection/select-all.mjs +3 -3
  19. package/esm2022/selection/selection-column.mjs +3 -3
  20. package/esm2022/selection/selection-module.mjs +4 -4
  21. package/esm2022/selection/selection-toggle.mjs +3 -3
  22. package/esm2022/selection/selection.mjs +3 -3
  23. package/esm2022/version.mjs +1 -1
  24. package/fesm2022/column-resize.mjs +36 -36
  25. package/fesm2022/material-experimental.mjs +1 -1
  26. package/fesm2022/material-experimental.mjs.map +1 -1
  27. package/fesm2022/menubar.mjs +10 -10
  28. package/fesm2022/popover-edit.mjs +25 -25
  29. package/fesm2022/selection.mjs +19 -19
  30. package/package.json +8 -8
  31. package/theming/_color-api-back-compat.scss +98 -0
  32. package/theming/_custom-tokens.scss +159 -26
  33. package/theming/_m3-density.scss +13 -1
  34. package/theming/_m3-tokens.scss +47 -4
@@ -0,0 +1,98 @@
1
+ @use '@angular/material' as mat;
2
+
3
+ @mixin color-variant-styles($theme, $color-variant) {
4
+ // Some components use the secondary color rather than primary color for `.mat-primary`.
5
+ // Those components should use the $secondary-color-variant.
6
+ $secondary-color-variant: if($color-variant == primary, secondary, $color-variant);
7
+
8
+ @include mat.option-color($theme, $color-variant: $secondary-color-variant);
9
+ @include mat.progress-spinner-color($theme, $color-variant: $color-variant);
10
+ @include mat.pseudo-checkbox-color($theme, $color-variant: $color-variant);
11
+ @include mat.stepper-color($theme, $color-variant: $color-variant);
12
+
13
+ &.mat-icon {
14
+ @include mat.icon-color($theme, $color-variant: $color-variant);
15
+ }
16
+
17
+ &.mat-mdc-checkbox {
18
+ @include mat.checkbox-color($theme, $color-variant: $color-variant);
19
+ }
20
+
21
+ &.mat-mdc-slider {
22
+ @include mat.slider-color($theme, $color-variant: $color-variant);
23
+ }
24
+
25
+ &.mat-mdc-tab-group,
26
+ &.mat-mdc-tab-nav-bar {
27
+ @include mat.tabs-color($theme, $color-variant: $color-variant);
28
+ }
29
+
30
+ &.mat-mdc-slide-toggle {
31
+ @include mat.slide-toggle-color($theme, $color-variant: $color-variant);
32
+ }
33
+
34
+ &.mat-mdc-form-field {
35
+ @include mat.select-color($theme, $color-variant: $color-variant);
36
+ }
37
+
38
+ &.mat-mdc-radio-button {
39
+ @include mat.radio-color($theme, $color-variant: $color-variant);
40
+ }
41
+
42
+ &.mat-mdc-progress-bar {
43
+ @include mat.progress-bar-color($theme, $color-variant: $color-variant);
44
+ }
45
+
46
+ &.mat-mdc-form-field {
47
+ @include mat.form-field-color($theme, $color-variant: $color-variant);
48
+ }
49
+
50
+ &.mat-datepicker-content {
51
+ @include mat.datepicker-color($theme, $color-variant: $color-variant);
52
+ }
53
+
54
+ &.mat-mdc-button-base {
55
+ @include mat.button-color($theme, $color-variant: $color-variant);
56
+ }
57
+
58
+ &.mat-mdc-standard-chip {
59
+ @include mat.chips-color($theme, $color-variant: $secondary-color-variant);
60
+ }
61
+
62
+ .mdc-list-item__start,
63
+ .mdc-list-item__end {
64
+ @include mat.checkbox-color($theme, $color-variant: $color-variant);
65
+ @include mat.radio-color($theme, $color-variant: $color-variant);
66
+ }
67
+
68
+ // M3 dropped support for warn/error color FABs.
69
+ @if $color-variant != error {
70
+ &.mat-mdc-fab,
71
+ &.mat-mdc-mini-fab {
72
+ @include mat.fab-color($theme, $color-variant: $color-variant);
73
+ }
74
+ }
75
+ }
76
+
77
+ @mixin color-variants-back-compat($theme) {
78
+ .mat-primary {
79
+ @include color-variant-styles($theme, primary);
80
+ }
81
+ .mat-badge {
82
+ @include mat.badge-color($theme, $color-variant: primary);
83
+ }
84
+
85
+ .mat-accent {
86
+ @include color-variant-styles($theme, tertiary);
87
+ }
88
+ .mat-badge-accent {
89
+ @include mat.badge-color($theme, $color-variant: tertiary);
90
+ }
91
+
92
+ .mat-warn {
93
+ @include color-variant-styles($theme, error);
94
+ }
95
+ .mat-badge-warn {
96
+ @include mat.badge-color($theme, $color-variant: error);
97
+ }
98
+ }
@@ -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
 
@@ -66,15 +70,15 @@
66
70
  small-size-container-size: _hardcode(6px, $exclude-hardcoded),
67
71
  container-padding: _hardcode(0 4px, $exclude-hardcoded),
68
72
  small-size-container-padding: _hardcode(0, $exclude-hardcoded),
69
- container-offset: -12px 0,
70
- small-size-container-offset: -6px 0,
71
- container-overlap-offset: -12px,
72
- small-size-container-overlap-offset: -6px,
73
+ container-offset: _hardcode(-12px 0, $exclude-hardcoded),
74
+ small-size-container-offset: _hardcode(-6px 0, $exclude-hardcoded),
75
+ container-overlap-offset: _hardcode(-12px, $exclude-hardcoded),
76
+ small-size-container-overlap-offset: _hardcode(-6px, $exclude-hardcoded),
73
77
 
74
78
  // This size isn't in the M3 spec so we emit the same values as for `medium`.
75
79
  large-size-container-size: _hardcode(16px, $exclude-hardcoded),
76
- large-size-container-offset: -12px 0,
77
- large-size-container-overlap-offset: -12px,
80
+ large-size-container-offset: _hardcode(-12px 0, $exclude-hardcoded),
81
+ large-size-container-overlap-offset: _hardcode(-12px, $exclude-hardcoded),
78
82
  large-size-text-size: map.get($systems, md-sys-typescale, label-small-size),
79
83
  large-size-container-padding: _hardcode(0 4px, $exclude-hardcoded),
80
84
  legacy-large-size-container-size: _hardcode(unset, $exclude-hardcoded),
@@ -130,8 +134,10 @@
130
134
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
131
135
  /// @return {Map} A set of custom tokens for the mat-button-toggle
132
136
  @function button-toggle($systems, $exclude-hardcoded) {
133
- @return ((
134
- shape: _hardcode(9999px, $exclude-hardcoded),
137
+ @return mat.private-merge-all(
138
+ _generate-typography-tokens($systems, label-text, label-large),
139
+ (
140
+ shape: map.get($systems, md-sys-shape, corner-full),
135
141
  hover-state-layer-opacity: map.get($systems, md-sys-state, hover-state-layer-opacity),
136
142
  focus-state-layer-opacity: map.get($systems, md-sys-state, focus-state-layer-opacity),
137
143
  text-color: map.get($systems, md-sys-color, on-surface),
@@ -153,7 +159,6 @@
153
159
  $alpha: 0.12,
154
160
  ),
155
161
  divider-color: map.get($systems, md-sys-color, outline),
156
- text-font: map.get($systems, md-sys-typescale, label-large-font),
157
162
  ), (
158
163
  // Color variants:
159
164
  primary: (
@@ -186,13 +191,51 @@
186
191
  );
187
192
  }
188
193
 
194
+ /// Generates custom tokens for the mat-chip.
195
+ /// @param {Map} $systems The MDC system tokens
196
+ /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
197
+ /// @return {Map} A set of custom tokens for the mat-chip
198
+ @function chip($systems, $exclude-hardcoded) {
199
+ @return ((
200
+ disabled-container-opacity: _hardcode(1, $exclude-hardcoded),
201
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-secondary-container),
202
+ selected-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface),
203
+ trailing-action-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
204
+ selected-trailing-action-state-layer-color:
205
+ map.get($systems, md-sys-color, on-secondary-container),
206
+ trailing-action-hover-state-layer-opacity:
207
+ map.get($systems, md-sys-state, hover-state-layer-opacity),
208
+ trailing-action-focus-state-layer-opacity:
209
+ map.get($systems, md-sys-state, focus-state-layer-opacity),
210
+ trailing-action-opacity: _hardcode(1, $exclude-hardcoded),
211
+ trailing-action-focus-opacity: _hardcode(1, $exclude-hardcoded),
212
+ ), (
213
+ primary: (
214
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-primary-container),
215
+ selected-trailing-action-state-layer-color:
216
+ map.get($systems, md-sys-color, on-primary-container),
217
+ ),
218
+ secondary: (), // Default, no overrides needed.
219
+ tertiary: (
220
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-tertiary-container),
221
+ selected-trailing-action-state-layer-color:
222
+ map.get($systems, md-sys-color, on-tertiary-container),
223
+ ),
224
+ error: (
225
+ selected-trailing-icon-color: map.get($systems, md-sys-color, on-error-container),
226
+ selected-trailing-action-state-layer-color:
227
+ map.get($systems, md-sys-color, on-error-container),
228
+ ),
229
+ ));
230
+ }
231
+
189
232
  /// Generates custom tokens for the mdc-chip. (MDC has a chip component, but they
190
233
  /// seem to have made up the tokens rather than using ones generated from the token database,
191
234
  /// therefore we need a custom token function for it).
192
235
  /// @param {Map} $systems The MDC system tokens
193
236
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
194
237
  /// @return {Map} A set of custom tokens for the mdc-chip
195
- @function chip($systems, $exclude-hardcoded) {
238
+ @function mdc-chip($systems, $exclude-hardcoded) {
196
239
  @return (mat.private-merge-all(
197
240
  _generate-typography-tokens($systems, label-text, label-large),
198
241
  (
@@ -208,16 +251,10 @@
208
251
  ),
209
252
  with-icon-icon-size: _hardcode(18px, $exclude-hardcoded),
210
253
  with-icon-icon-color: map.get($systems, md-sys-color, on-surface-variant),
211
- with-icon-disabled-icon-color: mat.private-safe-color-change(
212
- map.get($systems, md-sys-color, on-surface),
213
- $alpha: 0.38,
214
- ),
254
+ with-icon-disabled-icon-color: map.get($systems, md-sys-color, on-surface),
215
255
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-secondary-container),
216
256
  with-trailing-icon-trailing-icon-color: map.get($systems, md-sys-color, on-surface-variant),
217
- with-trailing-icon-disabled-trailing-icon-color: mat.private-safe-color-change(
218
- map.get($systems, md-sys-color, on-surface),
219
- $alpha: 0.38,
220
- ),
257
+ with-trailing-icon-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface),
221
258
  focus-state-layer-opacity: map.get($systems, md-sys-state, focus-state-layer-opacity),
222
259
  focus-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
223
260
  outline-width: _hardcode(1px, $exclude-hardcoded),
@@ -227,18 +264,48 @@
227
264
  $alpha: 0.12,
228
265
  ),
229
266
  focus-outline-color: map.get($systems, md-sys-color, on-surface-variant),
267
+ hover-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
268
+ hover-state-layer-opacity: map.get($systems, md-sys-state, hover-state-layer-opacity),
269
+ with-avatar-disabled-avatar-opacity: _hardcode(0.38, $exclude-hardcoded),
270
+ elevated-selected-container-color: map.get($systems, md-sys-color, secondary-container),
271
+ flat-selected-outline-width: _hardcode(0, $exclude-hardcoded),
272
+ selected-label-text-color: map.get($systems, md-sys-color, on-secondary-container),
273
+ flat-disabled-selected-container-color: mat.private-safe-color-change(
274
+ map.get($systems, md-sys-color, on-surface),
275
+ $alpha: 0.12,
276
+ ),
277
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-secondary-container),
278
+ selected-hover-state-layer-opacity:
279
+ map.get($systems, md-sys-state, hover-state-layer-opacity),
280
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-secondary-container),
281
+ selected-focus-state-layer-opacity:
282
+ map.get($systems, md-sys-state, focus-state-layer-opacity),
283
+ with-icon-disabled-icon-opacity: _hardcode(0.38, $exclude-hardcoded),
284
+ with-trailing-icon-disabled-trailing-icon-opacity: _hardcode(0.38, $exclude-hardcoded),
230
285
  ),
231
286
  ), (
232
287
  // Color variants:
233
288
  primary: (
234
289
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-primary-container),
290
+ elevated-selected-container-color: map.get($systems, md-sys-color, primary-container),
291
+ selected-label-text-color: map.get($systems, md-sys-color, on-primary-container),
292
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-primary-container),
293
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-primary-container),
235
294
  ),
236
295
  secondary: (), // Default, no overrides needed.
237
296
  tertiary: (
238
297
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-tertiary-container),
298
+ elevated-selected-container-color: map.get($systems, md-sys-color, tertiary-container),
299
+ selected-label-text-color: map.get($systems, md-sys-color, on-tertiary-container),
300
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container),
301
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container),
239
302
  ),
240
303
  error: (
241
304
  with-icon-selected-icon-color: map.get($systems, md-sys-color, on-error-container),
305
+ elevated-selected-container-color: map.get($systems, md-sys-color, error-container),
306
+ selected-label-text-color: map.get($systems, md-sys-color, on-error-container),
307
+ selected-hover-state-layer-color: map.get($systems, md-sys-color, on-error-container),
308
+ selected-focus-state-layer-color: map.get($systems, md-sys-color, on-error-container),
242
309
  )
243
310
  ));
244
311
  }
@@ -275,9 +342,10 @@
275
342
  toggle-active-state-icon-color: map.get($systems, md-sys-color, on-surface-variant),
276
343
  toggle-icon-color: map.get($systems, md-sys-color, on-surface-variant),
277
344
  calendar-body-label-text-color: map.get($systems, md-sys-color, on-surface),
345
+ calendar-period-button-text-color: map.get($systems, md-sys-color, on-surface-variant),
278
346
  calendar-period-button-icon-color: map.get($systems, md-sys-color, on-surface-variant),
279
347
  calendar-navigation-button-icon-color: map.get($systems, md-sys-color, on-surface-variant),
280
- calendar-header-divider-color: map.get($systems, md-sys-color, outline-variant),
348
+ calendar-header-divider-color: _hardcode(transparent, $exclude-hardcoded),
281
349
  calendar-header-text-color: map.get($systems, md-sys-color, on-surface-variant),
282
350
  calendar-date-today-outline-color: map.get($systems, md-sys-color, primary),
283
351
  calendar-date-today-disabled-state-outline-color: mat.private-safe-color-change(
@@ -302,6 +370,12 @@
302
370
  ),
303
371
  calendar-container-background-color: map.get($systems, md-sys-color, surface-container-high),
304
372
  calendar-container-text-color: map.get($systems, md-sys-color, on-surface),
373
+ calendar-container-elevation-shadow: _hardcode(mdc-elevation.elevation-box-shadow(0),
374
+ $exclude-hardcoded),
375
+ calendar-container-touch-elevation-shadow: _hardcode(mdc-elevation.elevation-box-shadow(0),
376
+ $exclude-hardcoded),
377
+ calendar-container-shape: map.get($systems, md-sys-shape, corner-large),
378
+ calendar-container-touch-shape: map.get($systems, md-sys-shape, corner-extra-large),
305
379
  calendar-text-font: map.get($systems, md-sys-typescale, body-large-font),
306
380
  calendar-text-size: map.get($systems, md-sys-typescale, body-large-size),
307
381
  calendar-body-label-text-size: map.get($systems, md-sys-typescale, title-small-size),
@@ -357,7 +431,7 @@
357
431
  @return (
358
432
  container-max-width: _hardcode(560px, $exclude-hardcoded),
359
433
  container-small-max-width: _hardcode(calc(100vw - 32px), $exclude-hardcoded),
360
- container-min-width: _harcode(280px, $exclude-hardcoded),
434
+ container-min-width: _hardcode(280px, $exclude-hardcoded),
361
435
  actions-alignment: _hardcode(flex-end, $exclude-hardcoded),
362
436
  content-padding: _hardcode(20px 24px, $exclude-hardcoded),
363
437
  with-actions-content-padding: _hardcode(20px 24px 0, $exclude-hardcoded),
@@ -583,6 +657,17 @@
583
657
  ));
584
658
  }
585
659
 
660
+ /// Generates custom tokens for the mat-list.
661
+ /// @param {Map} $systems The MDC system tokens
662
+ /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
663
+ /// @return {Map} A set of custom tokens for the mat-list
664
+ @function list($systems, $exclude-hardcoded) {
665
+ @return (
666
+ active-indicator-color: map.get($systems, md-sys-color, secondary-container),
667
+ active-indicator-shape: map.get($systems, md-sys-shape, corner-full),
668
+ );
669
+ }
670
+
586
671
  /// Generates custom tokens for the mat-button.
587
672
  /// @param {Map} $systems The MDC system tokens
588
673
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
@@ -790,9 +875,13 @@
790
875
  @return mat.private-merge-all(
791
876
  _generate-typography-tokens($systems, item-label-text, label-large),
792
877
  (
793
- container-shape: _hardcode(4px, $exclude-hardcoded),
878
+ container-shape: map.get($systems, md-sys-shape, corner-extra-small),
879
+ divider-color: map.get($systems, md-sys-color, surface-variant),
880
+ divider-bottom-spacing: _hardcode(8px, $exclude-hardcoded),
881
+ divider-top-spacing: _hardcode(8px, $exclude-hardcoded),
794
882
  item-label-text-color: map.get($systems, md-sys-color, on-surface),
795
883
  item-icon-color: map.get($systems, md-sys-color, on-surface-variant),
884
+ item-icon-size: _hardcode(24px, $exclude-hardcoded),
796
885
  item-hover-state-layer-color: mat.private-safe-color-change(
797
886
  map.get($systems, md-sys-color, on-surface),
798
887
  $alpha: map.get($systems, md-sys-state, hover-state-layer-opacity)
@@ -801,6 +890,11 @@
801
890
  map.get($systems, md-sys-color, on-surface),
802
891
  $alpha: map.get($systems, md-sys-state, focus-state-layer-opacity)
803
892
  ),
893
+ item-spacing: _hardcode(12px, $exclude-hardcoded),
894
+ item-leading-spacing: _hardcode(12px, $exclude-hardcoded),
895
+ item-trailing-spacing: _hardcode(12px, $exclude-hardcoded),
896
+ item-with-icon-leading-spacing: _hardcode(12px, $exclude-hardcoded),
897
+ item-with-icon-trailing-spacing: _hardcode(12px, $exclude-hardcoded),
804
898
  container-color: map.get($systems, md-sys-color, surface-container),
805
899
  )
806
900
  );
@@ -1005,6 +1099,8 @@
1005
1099
  map.get($systems, md-sys-color, on-surface), $alpha: 0.38),
1006
1100
  focused-arrow-color: map.get($systems, md-sys-color, primary),
1007
1101
  invalid-arrow-color: map.get($systems, md-sys-color, error),
1102
+ container-elevation-shadow:
1103
+ _hardcode(mdc-elevation.elevation-box-shadow(2), $exclude-hardcoded),
1008
1104
  )
1009
1105
  ), (
1010
1106
  // Color variants:
@@ -1027,12 +1123,14 @@
1027
1123
  /// @return {Map} A set of custom tokens for the mat-sidenav
1028
1124
  @function sidenav($systems, $exclude-hardcoded) {
1029
1125
  @return (
1030
- container-shape: 16px,
1031
- container-divider-color: map.get($systems, md-sys-color, outline),
1126
+ container-elevation-shadow: _hardcode(none, $exclude-hardcoded),
1127
+ container-divider-color: _hardcode(transparent, $exclude-hardcoded),
1128
+ container-width: _hardcode(360px, $exclude-hardcoded),
1129
+ container-shape: map.get($systems, md-sys-shape, corner-large),
1032
1130
  container-background-color: map.get($systems, md-sys-color, surface),
1033
1131
  container-text-color: map.get($systems, md-sys-color, on-surface-variant),
1034
- content-background-color: _hardcode(inherit, $exclude-hardcoded),
1035
- content-text-color: _hardcode(inherit, $exclude-hardcoded),
1132
+ content-background-color: map.get($systems, md-sys-color, background),
1133
+ content-text-color: map.get($systems, md-sys-color, on-background),
1036
1134
  scrim-color: mat.private-safe-color-change(
1037
1135
  map.get($systems, md-ref-palette, neutral-variant20), $alpha: 0.4),
1038
1136
  );
@@ -1085,6 +1183,41 @@
1085
1183
  ));
1086
1184
  }
1087
1185
 
1186
+ /// Generates custom tokens for the mat-slide-toggle.
1187
+ /// @param {Map} $systems The MDC system tokens
1188
+ /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
1189
+ /// @return {Map} A set of custom tokens for the mat-slide-toggle
1190
+ @function switch($systems, $exclude-hardcoded) {
1191
+ @return (
1192
+ disabled-selected-handle-opacity: _hardcode(1, $exclude-hardcoded),
1193
+ disabled-unselected-handle-opacity: _hardcode(0.38, $exclude-hardcoded),
1194
+ unselected-handle-size: _hardcode(16px, $exclude-hardcoded),
1195
+ selected-handle-size: _hardcode(24px, $exclude-hardcoded),
1196
+ with-icon-handle-size: _hardcode(24px, $exclude-hardcoded),
1197
+ pressed-handle-size: _hardcode(28px, $exclude-hardcoded),
1198
+ selected-handle-horizontal-margin: _hardcode(0 24px, $exclude-hardcoded),
1199
+ selected-with-icon-handle-horizontal-margin: _hardcode(0 24px, $exclude-hardcoded),
1200
+ selected-pressed-handle-horizontal-margin: _hardcode(0 22px, $exclude-hardcoded),
1201
+ unselected-handle-horizontal-margin: _hardcode(0 8px, $exclude-hardcoded),
1202
+ unselected-with-icon-handle-horizontal-margin: _hardcode(0 4px, $exclude-hardcoded),
1203
+ unselected-pressed-handle-horizontal-margin: _hardcode(0 2px, $exclude-hardcoded),
1204
+ // The hidden and visible track represent whichever track is visible or
1205
+ // hidden in the ui. This could be the .mdc-switch__track :before or
1206
+ // :after depending on whether the switch is selected or unselected.
1207
+ //
1208
+ // The m2 slide-toggle uses transforms to hide & show the tracks while
1209
+ // the m3 slide-toggle uses opacity.
1210
+ visible-track-opacity: _hardcode(1, $exclude-hardcoded),
1211
+ hidden-track-opacity: _hardcode(0, $exclude-hardcoded),
1212
+ visible-track-transition: _hardcode(opacity 75ms, $exclude-hardcoded),
1213
+ hidden-track-transition: _hardcode(opacity 75ms, $exclude-hardcoded),
1214
+ track-outline-width: _hardcode(2px, $exclude-hardcoded),
1215
+ track-outline-color: map.get($systems, md-sys-color, outline),
1216
+ disabled-unselected-track-outline-width: _hardcode(2px, $exclude-hardcoded),
1217
+ disabled-unselected-track-outline-color: map.get($systems, md-sys-color, on-surface),
1218
+ ), ();
1219
+ }
1220
+
1088
1221
  /// Generates custom tokens for the mat-snack-bar.
1089
1222
  /// @param {Map} $systems The MDC system tokens
1090
1223
  /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
@@ -1183,7 +1316,7 @@
1183
1316
  _generate-typography-tokens($systems, label-text, title-small),
1184
1317
  (
1185
1318
  divider-color: map.get($systems, md-sys-color, surface-variant),
1186
- divider-height: 1px,
1319
+ divider-height: _hardcode(1px, $exclude-hardcoded),
1187
1320
  disabled-ripple-color: null, // TODO(mmalerba): Figure out correct value.
1188
1321
  pagination-icon-color: map.get($systems, md-sys-color, on-surface),
1189
1322
  inactive-label-text-color: map.get($systems, md-sys-color, on-surface),
@@ -95,6 +95,10 @@ $_density-tokens: (
95
95
  (mat, icon-button): (
96
96
  touch-target-display: (block, block, none, none),
97
97
  ),
98
+ (mat, list): (
99
+ list-item-leading-icon-start-space: (16px, 12px, 8px, 4px),
100
+ list-item-leading-icon-end-space: (16px, 12px, 8px, 4px),
101
+ ),
98
102
  (mat, text-button): (
99
103
  touch-target-display: (block, block, none, none),
100
104
  ),
@@ -114,12 +118,20 @@ $_density-tokens: (
114
118
  (mat, minimal-pseudo-checkbox): (),
115
119
  (mat, paginator): (
116
120
  container-size: (56px, 52px, 48px, 40px),
121
+ form-field-container-height: (40px, 40px, 40px, 40px, 40px, 36px),
122
+ form-field-container-vertical-padding: (8px, 8px, 8px, 8px, 8px, 6px),
117
123
  ),
118
124
  (mat, radio): (
119
125
  touch-target-display: (block, block, none, none),
120
126
  ),
121
127
  (mat, ripple): (),
122
- (mat, select): (),
128
+ (mat, select): (
129
+ arrow-transform: (
130
+ translateY(-8px),
131
+ translateY(-8px),
132
+ none,
133
+ ),
134
+ ),
123
135
  (mat, sidenav): (),
124
136
  (mat, slide-toggle): (),
125
137
  (mat, slider): (),
@@ -446,7 +446,7 @@
446
446
  headline-weight: subhead-weight,
447
447
  ));
448
448
 
449
- @if (map.has-key($tokens, container-elevation)) {
449
+ @if map.get($tokens, container-elevation) != null {
450
450
  $tokens: map.merge($tokens, (
451
451
  // The spec has the dialog at an elevation of 3 which is consistent with the current
452
452
  // version of the tokens (0_161), however both the designs and MDC's implementation
@@ -464,6 +464,27 @@
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
+ @if map.get($tokens, list-item-container-color) != null {
476
+ $tokens: map.set($tokens, list-item-container-color, transparent);
477
+ }
478
+
479
+ // Match spec, which has list-item-leading-icon-size of 24px. Current version of tokens (0_161)
480
+ // has 18px.
481
+ @if map.get($tokens, list-item-leading-icon-size) != null {
482
+ $tokens: map.set($tokens, list-item-leading-icon-size, 24px);
483
+ }
484
+
485
+ @return $tokens;
486
+ }
487
+
467
488
  /// Generates a set of namespaced tokens for all components.
468
489
  /// @param {Map} $systems The MDC system tokens
469
490
  /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
@@ -514,7 +535,7 @@
514
535
  ),
515
536
  _namespace-tokens(
516
537
  (mdc, chip),
517
- custom-tokens.chip($systems, $exclude-hardcoded),
538
+ custom-tokens.mdc-chip($systems, $exclude-hardcoded),
518
539
  $token-slots
519
540
  ),
520
541
  _namespace-tokens(
@@ -660,7 +681,9 @@
660
681
  ),
661
682
  _namespace-tokens(
662
683
  (mdc, list),
663
- mdc-tokens.md-comp-list-values($systems, $exclude-hardcoded),
684
+ _fix-list-tokens(
685
+ mdc-tokens.md-comp-list-values($systems, $exclude-hardcoded)
686
+ ),
664
687
  $token-slots
665
688
  ),
666
689
  _namespace-tokens(
@@ -753,6 +776,11 @@
753
776
  custom-tokens.card($systems, $exclude-hardcoded),
754
777
  $token-slots
755
778
  ),
779
+ _namespace-tokens(
780
+ (mat, chip),
781
+ custom-tokens.chip($systems, $exclude-hardcoded),
782
+ $token-slots
783
+ ),
756
784
  _namespace-tokens(
757
785
  (mat, datepicker),
758
786
  custom-tokens.datepicker($systems, $exclude-hardcoded),
@@ -808,6 +836,11 @@
808
836
  custom-tokens.filled-button($systems, $exclude-hardcoded),
809
837
  $token-slots
810
838
  ),
839
+ _namespace-tokens(
840
+ (mat, list),
841
+ custom-tokens.list($systems, $exclude-hardcoded),
842
+ $token-slots
843
+ ),
811
844
  _namespace-tokens(
812
845
  // Note: in M3 the "protected" button is called "elevated".
813
846
  (mat, protected-button),
@@ -904,6 +937,11 @@
904
937
  custom-tokens.stepper($systems, $exclude-hardcoded),
905
938
  $token-slots
906
939
  ),
940
+ _namespace-tokens(
941
+ (mat, switch),
942
+ custom-tokens.switch($systems, $exclude-hardcoded),
943
+ $token-slots
944
+ ),
907
945
  _namespace-tokens(
908
946
  (mat, tab-header),
909
947
  custom-tokens.tab-header($systems, $exclude-hardcoded),
@@ -953,7 +991,13 @@
953
991
  mdc-tokens.md-sys-color-values-light($ref));
954
992
  @return _generate-tokens(map.merge($ref, (
955
993
  md-sys-color: $sys-color,
994
+ // Because the elevation values are always combined with color values to create the box shadow,
995
+ // elevation needs to be part of the color dimension.
956
996
  md-sys-elevation: mdc-tokens.md-sys-elevation-values(),
997
+ // Because the state values are sometimes combined with color values to create rgba colors,
998
+ // state needs to be part of color dimension.
999
+ // TODO(mmalerba): If at some point we remove the need for these combined values, we can move
1000
+ // state to the base dimension.
957
1001
  md-sys-state: mdc-tokens.md-sys-state-values(),
958
1002
  )));
959
1003
  }
@@ -989,6 +1033,5 @@
989
1033
  @return _generate-tokens((
990
1034
  md-sys-motion: mdc-tokens.md-sys-motion-values(),
991
1035
  md-sys-shape: mdc-tokens.md-sys-shape-values(),
992
- md-sys-state: mdc-tokens.md-sys-state-values(),
993
1036
  ), $include-non-systemized: true);
994
1037
  }