@angular/material 16.2.0-next.3 → 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 (120) hide show
  1. package/autocomplete/index.d.ts +34 -4
  2. package/badge/_badge-theme.scss +84 -118
  3. package/bottom-sheet/_bottom-sheet-theme.scss +10 -11
  4. package/button/_fab-theme.scss +70 -43
  5. package/button-toggle/_button-toggle-theme.scss +20 -97
  6. package/button-toggle/_button-toggle-variables.scss +2 -0
  7. package/card/_card-theme.scss +20 -4
  8. package/checkbox/_checkbox-theme.scss +5 -3
  9. package/chips/index.d.ts +11 -4
  10. package/core/index.d.ts +3 -2
  11. package/core/tokens/_token-utils.scss +2 -0
  12. package/core/tokens/m2/mat/_badge.scss +78 -0
  13. package/core/tokens/m2/mat/_bottom-sheet.scss +56 -0
  14. package/core/tokens/m2/mat/_datepicker.scss +184 -0
  15. package/core/tokens/m2/mat/_divider.scss +45 -0
  16. package/core/tokens/m2/mat/_expansion.scss +90 -0
  17. package/core/tokens/m2/mat/_legacy-button-toggle.scss +63 -0
  18. package/core/tokens/m2/mat/_sidenav.scss +65 -0
  19. package/core/tokens/m2/mat/_standard-button-toggle.scss +87 -0
  20. package/core/tokens/m2/mat/_toolbar.scss +79 -0
  21. package/core/tokens/m2/mdc/_extended-fab.scss +88 -0
  22. package/core/tokens/m2/mdc/_fab.scss +89 -0
  23. package/datepicker/_datepicker-theme.scss +44 -203
  24. package/divider/_divider-theme.scss +6 -8
  25. package/esm2022/autocomplete/autocomplete-trigger.mjs +85 -38
  26. package/esm2022/autocomplete/autocomplete.mjs +25 -4
  27. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  28. package/esm2022/button/fab.mjs +8 -8
  29. package/esm2022/button-toggle/button-toggle.mjs +2 -2
  30. package/esm2022/chips/chip-option.mjs +4 -5
  31. package/esm2022/chips/chip-row.mjs +15 -10
  32. package/esm2022/chips/chip.mjs +29 -12
  33. package/esm2022/core/option/option.mjs +9 -5
  34. package/esm2022/core/private/ripple-loader.mjs +4 -1
  35. package/esm2022/core/version.mjs +1 -1
  36. package/esm2022/datepicker/calendar-body.mjs +2 -2
  37. package/esm2022/datepicker/calendar.mjs +2 -2
  38. package/esm2022/datepicker/date-range-input.mjs +2 -2
  39. package/esm2022/datepicker/datepicker-base.mjs +3 -3
  40. package/esm2022/datepicker/datepicker-toggle.mjs +2 -2
  41. package/esm2022/divider/divider.mjs +2 -2
  42. package/esm2022/expansion/expansion-animations.mjs +5 -2
  43. package/esm2022/expansion/expansion-panel-header.mjs +3 -3
  44. package/esm2022/expansion/expansion-panel.mjs +3 -3
  45. package/esm2022/form-field/form-field.mjs +3 -3
  46. package/esm2022/legacy-autocomplete/autocomplete.mjs +2 -1
  47. package/esm2022/legacy-dialog/testing/dialog-opener.mjs +6 -1
  48. package/esm2022/legacy-menu/menu.mjs +4 -2
  49. package/esm2022/legacy-table/text-column.mjs +6 -2
  50. package/esm2022/legacy-tabs/tab.mjs +6 -3
  51. package/esm2022/legacy-tooltip/tooltip.mjs +5 -2
  52. package/esm2022/menu/menu-item.mjs +4 -4
  53. package/esm2022/menu/menu.mjs +3 -3
  54. package/esm2022/radio/radio.mjs +13 -1
  55. package/esm2022/sidenav/drawer.mjs +3 -3
  56. package/esm2022/sidenav/sidenav.mjs +3 -3
  57. package/esm2022/slide-toggle/slide-toggle.mjs +2 -2
  58. package/esm2022/toolbar/toolbar.mjs +2 -2
  59. package/expansion/_expansion-legacy-index.scss +0 -1
  60. package/expansion/_expansion-theme.import.scss +0 -2
  61. package/expansion/_expansion-theme.scss +12 -68
  62. package/fesm2022/autocomplete.mjs +109 -41
  63. package/fesm2022/autocomplete.mjs.map +1 -1
  64. package/fesm2022/bottom-sheet.mjs +2 -2
  65. package/fesm2022/bottom-sheet.mjs.map +1 -1
  66. package/fesm2022/button-toggle.mjs +2 -2
  67. package/fesm2022/button-toggle.mjs.map +1 -1
  68. package/fesm2022/button.mjs +8 -8
  69. package/fesm2022/button.mjs.map +1 -1
  70. package/fesm2022/chips.mjs +41 -17
  71. package/fesm2022/chips.mjs.map +1 -1
  72. package/fesm2022/core.mjs +12 -5
  73. package/fesm2022/core.mjs.map +1 -1
  74. package/fesm2022/datepicker.mjs +10 -10
  75. package/fesm2022/datepicker.mjs.map +1 -1
  76. package/fesm2022/divider.mjs +2 -2
  77. package/fesm2022/divider.mjs.map +1 -1
  78. package/fesm2022/expansion.mjs +8 -5
  79. package/fesm2022/expansion.mjs.map +1 -1
  80. package/fesm2022/form-field.mjs +2 -2
  81. package/fesm2022/form-field.mjs.map +1 -1
  82. package/fesm2022/legacy-autocomplete.mjs +1 -0
  83. package/fesm2022/legacy-autocomplete.mjs.map +1 -1
  84. package/fesm2022/legacy-dialog/testing.mjs +5 -0
  85. package/fesm2022/legacy-dialog/testing.mjs.map +1 -1
  86. package/fesm2022/legacy-menu.mjs +3 -1
  87. package/fesm2022/legacy-menu.mjs.map +1 -1
  88. package/fesm2022/legacy-table.mjs +5 -1
  89. package/fesm2022/legacy-table.mjs.map +1 -1
  90. package/fesm2022/legacy-tabs.mjs +5 -2
  91. package/fesm2022/legacy-tabs.mjs.map +1 -1
  92. package/fesm2022/legacy-tooltip.mjs +4 -1
  93. package/fesm2022/legacy-tooltip.mjs.map +1 -1
  94. package/fesm2022/menu.mjs +5 -5
  95. package/fesm2022/menu.mjs.map +1 -1
  96. package/fesm2022/radio.mjs +12 -0
  97. package/fesm2022/radio.mjs.map +1 -1
  98. package/fesm2022/sidenav.mjs +4 -4
  99. package/fesm2022/sidenav.mjs.map +1 -1
  100. package/fesm2022/slide-toggle.mjs +2 -2
  101. package/fesm2022/slide-toggle.mjs.map +1 -1
  102. package/fesm2022/toolbar.mjs +2 -2
  103. package/fesm2022/toolbar.mjs.map +1 -1
  104. package/legacy-autocomplete/index.d.ts +1 -0
  105. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  106. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  107. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  108. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  109. package/package.json +2 -2
  110. package/prebuilt-themes/deeppurple-amber.css +1 -1
  111. package/prebuilt-themes/indigo-pink.css +1 -1
  112. package/prebuilt-themes/pink-bluegrey.css +1 -1
  113. package/prebuilt-themes/purple-green.css +1 -1
  114. package/radio/index.d.ts +4 -1
  115. package/schematics/ng-add/index.js +1 -1
  116. package/schematics/ng-add/index.mjs +1 -1
  117. package/sidenav/_sidenav-theme.scss +6 -69
  118. package/toolbar/_toolbar-theme.scss +25 -71
  119. package/expansion/_expansion-mixins.import.scss +0 -1
  120. package/expansion/_expansion-mixins.scss +0 -11
@@ -2,6 +2,7 @@ import { _AbstractConstructor } from '@angular/material/core';
2
2
  import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
3
3
  import { AfterContentInit } from '@angular/core';
4
4
  import { AfterViewInit } from '@angular/core';
5
+ import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
5
6
  import { BooleanInput } from '@angular/cdk/coercion';
6
7
  import { CanDisableRipple } from '@angular/material/core';
7
8
  import { ChangeDetectorRef } from '@angular/core';
@@ -98,19 +99,21 @@ export declare const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER: {
98
99
  */
99
100
  export declare const MAT_AUTOCOMPLETE_VALUE_ACCESSOR: any;
100
101
 
101
- export declare class MatAutocomplete extends _MatAutocompleteBase {
102
+ export declare class MatAutocomplete extends _MatAutocompleteBase implements OnDestroy {
102
103
  /** Reference to all option groups within the autocomplete. */
103
104
  optionGroups: QueryList<MatOptgroup>;
104
105
  /** Reference to all options within the autocomplete. */
105
106
  options: QueryList<MatOption>;
106
107
  protected _visibleClass: string;
107
108
  protected _hiddenClass: string;
109
+ _animationDone: EventEmitter<AnimationEvent_2>;
108
110
  /** Whether checkmark indicator for single-selection options is hidden. */
109
111
  get hideSingleSelectionIndicator(): boolean;
110
112
  set hideSingleSelectionIndicator(value: BooleanInput);
111
113
  private _hideSingleSelectionIndicator;
112
114
  /** Syncs the parent state with the individual options. */
113
115
  _syncParentProperties(): void;
116
+ ngOnDestroy(): void;
114
117
  protected _skipPredicate(_option: _MatOptionBase): boolean;
115
118
  static ɵfac: i0.ɵɵFactoryDeclaration<MatAutocomplete, never>;
116
119
  static ɵcmp: i0.ɵɵComponentDeclaration<MatAutocomplete, "mat-autocomplete", ["matAutocomplete"], { "disableRipple": { "alias": "disableRipple"; "required": false; }; "hideSingleSelectionIndicator": { "alias": "hideSingleSelectionIndicator"; "required": false; }; }, {}, ["optionGroups", "options"], ["*"], false, never>;
@@ -134,6 +137,8 @@ export declare abstract class _MatAutocompleteBase extends _MatAutocompleteMixin
134
137
  protected abstract _visibleClass: string;
135
138
  /** Class to apply to the panel when it's hidden. */
136
139
  protected abstract _hiddenClass: string;
140
+ /** Emits when the panel animation is done. Null if the panel doesn't animate. */
141
+ abstract _animationDone: EventEmitter<AnimationEvent_2> | null;
137
142
  /** Manages active item in option list based on key events. */
138
143
  _keyManager: ActiveDescendantKeyManager<_MatOptionBase>;
139
144
  /** Whether the autocomplete panel should be visible, depending on option length. */
@@ -170,6 +175,15 @@ export declare abstract class _MatAutocompleteBase extends _MatAutocompleteMixin
170
175
  get autoSelectActiveOption(): boolean;
171
176
  set autoSelectActiveOption(value: BooleanInput);
172
177
  private _autoSelectActiveOption;
178
+ /**
179
+ * Whether the user is required to make a selection when they're interacting with the
180
+ * autocomplete. If the user moves away from the autcomplete without selecting an option from
181
+ * the list, the value will be reset. If the user opens the panel and closes it without
182
+ * interacting or selecting a value, the initial value will be kept.
183
+ */
184
+ get requireSelection(): boolean;
185
+ set requireSelection(value: BooleanInput);
186
+ private _requireSelection;
173
187
  /**
174
188
  * Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will
175
189
  * match the width of its host.
@@ -220,7 +234,7 @@ export declare abstract class _MatAutocompleteBase extends _MatAutocompleteMixin
220
234
  private _setThemeClasses;
221
235
  protected _skipPredicate(option: _MatOptionBase): boolean;
222
236
  static ɵfac: i0.ɵɵFactoryDeclaration<_MatAutocompleteBase, never>;
223
- static ɵdir: i0.ɵɵDirectiveDeclaration<_MatAutocompleteBase, never, never, { "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "displayWith": { "alias": "displayWith"; "required": false; }; "autoActiveFirstOption": { "alias": "autoActiveFirstOption"; "required": false; }; "autoSelectActiveOption": { "alias": "autoSelectActiveOption"; "required": false; }; "panelWidth": { "alias": "panelWidth"; "required": false; }; "classList": { "alias": "class"; "required": false; }; }, { "optionSelected": "optionSelected"; "opened": "opened"; "closed": "closed"; "optionActivated": "optionActivated"; }, never, never, false, never>;
237
+ static ɵdir: i0.ɵɵDirectiveDeclaration<_MatAutocompleteBase, never, never, { "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "displayWith": { "alias": "displayWith"; "required": false; }; "autoActiveFirstOption": { "alias": "autoActiveFirstOption"; "required": false; }; "autoSelectActiveOption": { "alias": "autoSelectActiveOption"; "required": false; }; "requireSelection": { "alias": "requireSelection"; "required": false; }; "panelWidth": { "alias": "panelWidth"; "required": false; }; "classList": { "alias": "class"; "required": false; }; }, { "optionSelected": "optionSelected"; "opened": "opened"; "closed": "closed"; "optionActivated": "optionActivated"; }, never, never, false, never>;
224
238
  }
225
239
 
226
240
  /** Default `mat-autocomplete` options that can be overridden. */
@@ -229,6 +243,11 @@ export declare interface MatAutocompleteDefaultOptions {
229
243
  autoActiveFirstOption?: boolean;
230
244
  /** Whether the active option should be selected as the user is navigating. */
231
245
  autoSelectActiveOption?: boolean;
246
+ /**
247
+ * Whether the user is required to make a selection when
248
+ * they're interacting with the autocomplete.
249
+ */
250
+ requireSelection?: boolean;
232
251
  /** Class or list of classes to be applied to the autocomplete's overlay panel. */
233
252
  overlayPanelClass?: string | string[];
234
253
  /** Wheter icon indicators should be hidden for single-selection. */
@@ -302,8 +321,12 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
302
321
  private _componentDestroyed;
303
322
  private _autocompleteDisabled;
304
323
  private _scrollStrategy;
324
+ private _keydownSubscription;
325
+ private _outsideClickSubscription;
305
326
  /** Old value of the native input. Used to work around issues with the `input` event on IE. */
306
327
  private _previousValue;
328
+ /** Value of the input element when the panel was opened. */
329
+ private _valueOnOpen;
307
330
  /** Strategy that is used to position the panel. */
308
331
  private _positionStrategy;
309
332
  /** Whether or not the label state is being overridden. */
@@ -413,6 +436,11 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
413
436
  * stream every time the option list changes.
414
437
  */
415
438
  private _subscribeToClosingActions;
439
+ /**
440
+ * Emits the opened event once it's known that the panel will be shown and stores
441
+ * the state of the trigger right before the opening sequence was finished.
442
+ */
443
+ private _emitOpened;
416
444
  /** Destroys the autocomplete suggestion panel. */
417
445
  private _destroyPanel;
418
446
  private _assignOptionValue;
@@ -428,6 +456,10 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
428
456
  */
429
457
  private _clearPreviousSelectedOption;
430
458
  private _attachOverlay;
459
+ /** Handles keyboard events coming from the overlay panel. */
460
+ private _handlePanelKeydown;
461
+ /** Updates the panel's visibility state and any trigger state tied to id. */
462
+ private _updatePanelState;
431
463
  private _getOverlayConfig;
432
464
  private _getOverlayPosition;
433
465
  /** Sets the positions on a position strategy based on the directive's input state. */
@@ -450,8 +482,6 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
450
482
  private _getWindow;
451
483
  /** Scrolls to a particular option in the list. */
452
484
  private _scrollToOption;
453
- /** Handles keyboard events coming from the overlay panel. */
454
- private _handleOverlayEvents;
455
485
  /**
456
486
  * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
457
487
  * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
@@ -1,16 +1,15 @@
1
- // This contains all of the styles for the badge
2
- // rather than just the color/theme because of
3
- // no style sheet support for directives.
4
1
  @use 'sass:color';
5
2
  @use 'sass:map';
6
- @use 'sass:meta';
7
3
  @use 'sass:math';
8
4
  @use '@angular/cdk';
9
5
 
10
6
  @use '../core/theming/theming';
11
7
  @use '../core/typography/typography';
12
- @use '../core/typography/typography-utils';
8
+ @use '../core/tokens/m2/mat/badge' as tokens-mat-badge;
9
+ @use '../core/tokens/token-utils';
10
+ @use '../core/style/sass-utils';
13
11
 
12
+ // TODO(crisbeto): some of these variables aren't used anymore and should be deleted.
14
13
  $font-size: 12px;
15
14
  $font-weight: 600;
16
15
  $default-size: 22px !default;
@@ -18,79 +17,71 @@ $small-size: $default-size - 6;
18
17
  $large-size: $default-size + 6;
19
18
  $_badge-structure-emitted: false !default;
20
19
 
20
+ // Internally there are some builds that throw an error if they can't figure out the values
21
+ // of CSS variables during compliation. This flag temporarily enables fallbacks for these builds.
22
+ // Eventually we should clean them up.
23
+ $_emit-fallback-vars: true;
24
+
21
25
  // Mixin for building offset given different sizes
22
- @mixin _badge-size($size) {
26
+ @mixin _badge-size($size, $font-size-token) {
23
27
  // This mixin isn't used in the context of a theme so we can disable the ampersand check.
24
28
  // stylelint-disable material/no-ampersand-beyond-selector-start
25
29
  .mat-badge-content {
26
30
  width: $size;
27
31
  height: $size;
28
32
  line-height: $size;
29
- }
30
33
 
31
- &.mat-badge-above {
32
- .mat-badge-content {
33
- top: math.div(-$size, 2);
34
+ @if ($font-size-token) {
35
+ @include token-utils.use-tokens(tokens-mat-badge.$prefix,
36
+ tokens-mat-badge.get-token-slots()) {
37
+ @include token-utils.create-token-slot(font-size, $font-size-token, $_emit-fallback-vars);
38
+ }
34
39
  }
35
40
  }
36
41
 
37
- &.mat-badge-below {
38
- .mat-badge-content {
39
- bottom: math.div(-$size, 2);
40
- }
42
+ &.mat-badge-above .mat-badge-content {
43
+ top: math.div(-$size, 2);
41
44
  }
42
45
 
43
- &.mat-badge-before {
44
- .mat-badge-content {
45
- left: -$size;
46
- }
46
+ &.mat-badge-below .mat-badge-content {
47
+ bottom: math.div(-$size, 2);
47
48
  }
48
49
 
49
- [dir='rtl'] &.mat-badge-before {
50
- .mat-badge-content {
51
- left: auto;
52
- right: -$size;
53
- }
50
+ &.mat-badge-before .mat-badge-content {
51
+ left: -$size;
54
52
  }
55
53
 
56
- &.mat-badge-after {
57
- .mat-badge-content {
58
- right: -$size;
59
- }
54
+ [dir='rtl'] &.mat-badge-before .mat-badge-content {
55
+ left: auto;
56
+ right: -$size;
60
57
  }
61
58
 
62
- [dir='rtl'] &.mat-badge-after {
63
- .mat-badge-content {
64
- right: auto;
65
- left: -$size;
66
- }
59
+ &.mat-badge-after .mat-badge-content {
60
+ right: -$size;
61
+ }
62
+
63
+ [dir='rtl'] &.mat-badge-after .mat-badge-content {
64
+ right: auto;
65
+ left: -$size;
67
66
  }
68
67
 
69
68
  &.mat-badge-overlap {
70
- &.mat-badge-before {
71
- .mat-badge-content {
72
- left: math.div(-$size, 2);
73
- }
69
+ &.mat-badge-before .mat-badge-content {
70
+ left: math.div(-$size, 2);
74
71
  }
75
72
 
76
- [dir='rtl'] &.mat-badge-before {
77
- .mat-badge-content {
78
- left: auto;
79
- right: math.div(-$size, 2);
80
- }
73
+ [dir='rtl'] &.mat-badge-before .mat-badge-content {
74
+ left: auto;
75
+ right: math.div(-$size, 2);
81
76
  }
82
77
 
83
- &.mat-badge-after {
84
- .mat-badge-content {
85
- right: math.div(-$size, 2);
86
- }
78
+ &.mat-badge-after .mat-badge-content {
79
+ right: math.div(-$size, 2);
87
80
  }
88
81
 
89
- [dir='rtl'] &.mat-badge-after {
90
- .mat-badge-content {
91
- right: auto;
92
- left: math.div(-$size, 2);
93
- }
82
+ [dir='rtl'] &.mat-badge-after .mat-badge-content {
83
+ right: auto;
84
+ left: math.div(-$size, 2);
94
85
  }
95
86
  }
96
87
  // stylelint-enable
@@ -101,19 +92,13 @@ $_badge-structure-emitted: false !default;
101
92
  @mixin _badge-structure {
102
93
  .mat-badge {
103
94
  position: relative;
104
- }
105
95
 
106
- // The badge should make sure its host is overflow visible so that the badge content
107
- // can be rendered outside of the element. Some components such as <mat-icon> explicitly
108
- // style `overflow: hidden` so this requires extra specificity so that it does not
109
- // depend on style load order.
110
- .mat-badge.mat-badge {
111
- overflow: visible;
112
- }
113
-
114
- .mat-badge-hidden {
115
- .mat-badge-content {
116
- display: none;
96
+ // The badge should make sure its host is overflow visible so that the badge content
97
+ // can be rendered outside of the element. Some components such as <mat-icon> explicitly
98
+ // style `overflow: hidden` so this requires extra specificity so that it does not
99
+ // depend on style load order.
100
+ &.mat-badge {
101
+ overflow: visible;
117
102
  }
118
103
  }
119
104
 
@@ -128,6 +113,30 @@ $_badge-structure-emitted: false !default;
128
113
  white-space: nowrap;
129
114
  text-overflow: ellipsis;
130
115
  pointer-events: none;
116
+
117
+ @include token-utils.use-tokens(tokens-mat-badge.$prefix, tokens-mat-badge.get-token-slots()) {
118
+ @include token-utils.create-token-slot(background-color, background-color);
119
+ @include token-utils.create-token-slot(color, text-color);
120
+ @include token-utils.create-token-slot(font-family, text-font, $_emit-fallback-vars);
121
+ @include token-utils.create-token-slot(font-size, text-size, $_emit-fallback-vars);
122
+ @include token-utils.create-token-slot(font-weight, text-weight, $_emit-fallback-vars);
123
+ }
124
+
125
+ @include cdk.high-contrast(active, off) {
126
+ outline: solid 1px;
127
+ border-radius: 0;
128
+ }
129
+ }
130
+
131
+ .mat-badge-disabled .mat-badge-content {
132
+ @include token-utils.use-tokens(tokens-mat-badge.$prefix, tokens-mat-badge.get-token-slots()) {
133
+ @include token-utils.create-token-slot(background-color, disabled-state-background-color);
134
+ @include token-utils.create-token-slot(color, disabled-state-text-color);
135
+ }
136
+ }
137
+
138
+ .mat-badge-hidden .mat-badge-content {
139
+ display: none;
131
140
  }
132
141
 
133
142
  .ng-animate-disabled .mat-badge-content,
@@ -143,15 +152,15 @@ $_badge-structure-emitted: false !default;
143
152
  }
144
153
 
145
154
  .mat-badge-small {
146
- @include _badge-size($small-size);
155
+ @include _badge-size($small-size, small-size-text-size);
147
156
  }
148
157
 
149
158
  .mat-badge-medium {
150
- @include _badge-size($default-size);
159
+ @include _badge-size($default-size, null);
151
160
  }
152
161
 
153
162
  .mat-badge-large {
154
- @include _badge-size($large-size);
163
+ @include _badge-size($large-size, large-size-text-size);
155
164
  }
156
165
  }
157
166
 
@@ -159,73 +168,30 @@ $_badge-structure-emitted: false !default;
159
168
  $config: theming.get-color-config($config-or-theme);
160
169
  $accent: map.get($config, accent);
161
170
  $warn: map.get($config, warn);
162
- $primary: map.get($config, primary);
163
- $background: map.get($config, background);
164
- $foreground: map.get($config, foreground);
165
171
 
166
- .mat-badge-content {
167
- color: theming.get-color-from-palette($primary, default-contrast);
168
- background: theming.get-color-from-palette($primary);
169
-
170
- @include cdk.high-contrast(active, off) {
171
- outline: solid 1px;
172
- border-radius: 0;
173
- }
172
+ @include sass-utils.current-selector-or-root() {
173
+ @include token-utils.create-token-values(tokens-mat-badge.$prefix,
174
+ tokens-mat-badge.get-color-tokens($config));
174
175
  }
175
176
 
176
177
  .mat-badge-accent {
177
- .mat-badge-content {
178
- background: theming.get-color-from-palette($accent);
179
- color: theming.get-color-from-palette($accent, default-contrast);
180
- }
178
+ @include token-utils.create-token-values(tokens-mat-badge.$prefix,
179
+ tokens-mat-badge.private-get-color-palette-color-tokens($accent));
181
180
  }
182
181
 
183
182
  .mat-badge-warn {
184
- .mat-badge-content {
185
- color: theming.get-color-from-palette($warn, default-contrast);
186
- background: theming.get-color-from-palette($warn);
187
- }
188
- }
189
-
190
- .mat-badge-disabled {
191
- .mat-badge-content {
192
- $app-background: theming.get-color-from-palette($background, 'background');
193
- $badge-color: theming.get-color-from-palette($foreground, disabled-button);
194
-
195
- // The disabled color usually has some kind of opacity, but because the badge is overlayed
196
- // on top of something else, it won't look good if it's opaque. If it is a color *type*,
197
- // we convert it into a solid color by taking the opacity from the rgba value and using
198
- // the value to determine the percentage of the background to put into foreground when
199
- // mixing the colors together.
200
- @if (meta.type-of($badge-color) == color and meta.type-of($app-background) == color) {
201
- $badge-opacity: opacity($badge-color);
202
- background: color.mix($app-background, rgba($badge-color, 1), (1 - $badge-opacity) * 100%);
203
- }
204
- @else {
205
- background: $badge-color;
206
- }
207
-
208
- color: theming.get-color-from-palette($foreground, disabled-text);
209
- }
183
+ @include token-utils.create-token-values(tokens-mat-badge.$prefix,
184
+ tokens-mat-badge.private-get-color-palette-color-tokens($warn));
210
185
  }
211
186
  }
212
187
 
213
188
  @mixin typography($config-or-theme) {
214
189
  $config: typography.private-typography-to-2014-config(
215
190
  theming.get-typography-config($config-or-theme));
216
- .mat-badge-content {
217
- font-weight: $font-weight;
218
- font-size: $font-size;
219
- font-family: typography-utils.font-family($config);
220
- }
221
-
222
- .mat-badge-small .mat-badge-content {
223
- // Set the font size to 75% of the original.
224
- font-size: $font-size * 0.75;
225
- }
226
191
 
227
- .mat-badge-large .mat-badge-content {
228
- font-size: $font-size * 2;
192
+ @include sass-utils.current-selector-or-root() {
193
+ @include token-utils.create-token-values(tokens-mat-badge.$prefix,
194
+ tokens-mat-badge.get-typography-tokens($config));
229
195
  }
230
196
  }
231
197
 
@@ -1,26 +1,25 @@
1
- @use 'sass:map';
2
- @use '../core/style/private';
3
1
  @use '../core/typography/typography';
4
- @use '../core/typography/typography-utils';
5
2
  @use '../core/theming/theming';
3
+ @use '../core/style/sass-utils';
4
+ @use '../core/tokens/token-utils';
5
+ @use '../core/tokens/m2/mat/bottom-sheet' as tokens-mat-bottom-sheet;
6
6
 
7
7
  @mixin color($config-or-theme) {
8
8
  $config: theming.get-color-config($config-or-theme);
9
- $background: map.get($config, background);
10
- $foreground: map.get($config, foreground);
11
9
 
12
- .mat-bottom-sheet-container {
13
- @include private.private-theme-elevation(16, $config);
14
- background: theming.get-color-from-palette($background, dialog);
15
- color: theming.get-color-from-palette($foreground, text);
10
+ @include sass-utils.current-selector-or-root() {
11
+ @include token-utils.create-token-values(tokens-mat-bottom-sheet.$prefix,
12
+ tokens-mat-bottom-sheet.get-color-tokens($config));
16
13
  }
17
14
  }
18
15
 
19
16
  @mixin typography($config-or-theme) {
20
17
  $config: typography.private-typography-to-2014-config(
21
18
  theming.get-typography-config($config-or-theme));
22
- .mat-bottom-sheet-container {
23
- @include typography-utils.typography-level($config, body-1);
19
+
20
+ @include sass-utils.current-selector-or-root() {
21
+ @include token-utils.create-token-values(tokens-mat-bottom-sheet.$prefix,
22
+ tokens-mat-bottom-sheet.get-typography-tokens($config));
24
23
  }
25
24
  }
26
25
 
@@ -1,75 +1,102 @@
1
1
  @use 'sass:map';
2
2
  @use '@material/fab/fab' as mdc-fab;
3
3
  @use '@material/fab/fab-theme' as mdc-fab-theme;
4
- @use '@material/theme/theme-color' as mdc-theme-color;
4
+ @use '@material/fab/extended-fab-theme' as mdc-extended-fab-theme;
5
5
 
6
6
  @use './button-theme-private';
7
7
  @use '../core/mdc-helpers/mdc-helpers';
8
8
  @use '../core/theming/theming';
9
+ @use '../core/tokens/m2/mdc/fab' as tokens-mdc-fab;
10
+ @use '../core/tokens/m2/mdc/extended-fab' as tokens-mdc-extended-fab;
9
11
  @use '../core/typography/typography';
10
12
 
11
- @mixin _fab-variant($foreground, $background) {
12
- @include mdc-fab-theme.theme((
13
- container-color: $background,
14
- icon-color: $foreground,
15
- ));
13
+ @mixin _fab-variant($config, $foreground, $background) {
14
+ $color-config: map.merge(
15
+ $config,
16
+ (
17
+ primary: (
18
+ default: $background,
19
+ default-contrast: $foreground,
20
+ ),
21
+ )
22
+ );
23
+ $color-tokens: tokens-mdc-fab.get-color-tokens($color-config);
24
+ @include mdc-fab-theme.theme($color-tokens);
16
25
 
17
26
  --mat-mdc-fab-color: #{$foreground};
18
27
  }
19
28
 
29
+ @function white-or-black($color, $is-dark) {
30
+ @return if(mdc-helpers.variable-safe-contrast-tone($color, $is-dark) == 'dark', #000, #fff);
31
+ }
32
+
20
33
  @mixin color($config-or-theme) {
21
34
  $config: theming.get-color-config($config-or-theme);
22
- @include mdc-helpers.using-mdc-theme($config) {
23
- $on-surface: mdc-theme-color.prop-value(on-surface);
24
- $is-dark: map.get($config, is-dark);
25
35
 
26
- .mat-mdc-fab, .mat-mdc-mini-fab {
36
+ $is-dark: map.get($config, is-dark);
37
+ $background: map.get($config, background);
38
+
39
+ $surface: theming.get-color-from-palette($background, card);
40
+ $primary: theming.get-color-from-palette(map.get($config, primary));
41
+ $accent: theming.get-color-from-palette(map.get($config, accent));
42
+ $warn: theming.get-color-from-palette(map.get($config, warn));
43
+
44
+ $on-surface: white-or-black($surface, $is-dark);
45
+ $on-primary: white-or-black($primary, $is-dark);
46
+ $on-accent: white-or-black($accent, $is-dark);
47
+ $on-warn: white-or-black($warn, $is-dark);
48
+
49
+ $disabled: rgba($on-surface, 0.12);
50
+ $on-disabled: rgba($on-surface, if(map.get($config, is-dark), 0.5, 0.38));
51
+
52
+ .mat-mdc-fab,
53
+ .mat-mdc-mini-fab {
54
+ // TODO(wagnermaciel): The ripple-theme-styles mixin depends heavily on
55
+ // being wrapped by using-mdc-theme. This workaround needs to be
56
+ // revisited w/ a more holistic solution.
57
+ @include mdc-helpers.using-mdc-theme($config) {
27
58
  @include button-theme-private.ripple-theme-styles($config, true);
59
+ }
28
60
 
29
- &.mat-unthemed {
30
- @include _fab-variant($on-surface, mdc-theme-color.prop-value(surface));
31
- }
32
-
33
- &.mat-primary {
34
- @include _fab-variant(
35
- mdc-theme-color.prop-value(on-primary),
36
- mdc-theme-color.prop-value(primary)
37
- );
38
- }
39
-
40
- &.mat-accent {
41
- @include _fab-variant(
42
- mdc-theme-color.prop-value(on-secondary),
43
- mdc-theme-color.prop-value(secondary)
44
- );
45
- }
46
-
47
- &.mat-warn {
48
- @include _fab-variant(
49
- mdc-theme-color.prop-value(on-error),
50
- mdc-theme-color.prop-value(error)
51
- );
52
- }
53
-
54
- @include button-theme-private.apply-disabled-style() {
55
- @include _fab-variant(
56
- rgba($on-surface, if(map.get($config, is-dark), 0.5, 0.38)),
57
- rgba($on-surface, 0.12)
58
- );
59
- }
61
+ @include button-theme-private.apply-disabled-style() {
62
+ @include _fab-variant($config, $on-disabled, $disabled);
63
+ }
64
+
65
+ &.mat-unthemed {
66
+ @include _fab-variant($config, $on-surface, $surface);
67
+ }
68
+
69
+ &.mat-primary {
70
+ @include _fab-variant($config, $on-primary, $primary);
71
+ }
72
+
73
+ &.mat-accent {
74
+ @include _fab-variant($config, $on-accent, $accent);
75
+ }
76
+
77
+ &.mat-warn {
78
+ @include _fab-variant($config, $on-warn, $warn);
60
79
  }
61
80
  }
62
81
  }
63
82
 
64
83
  @mixin typography($config-or-theme) {
65
84
  $config: typography.private-typography-to-2018-config(
66
- theming.get-typography-config($config-or-theme));
85
+ theming.get-typography-config($config-or-theme)
86
+ );
87
+
67
88
  @include mdc-helpers.using-mdc-typography($config) {
68
89
  @include mdc-fab.without-ripple($query: mdc-helpers.$mdc-typography-styles-query);
69
90
  }
91
+
92
+ $typography-tokens: tokens-mdc-extended-fab.get-typography-tokens($config);
93
+ .mat-mdc-extended-fab {
94
+ @include mdc-extended-fab-theme.theme($typography-tokens);
95
+ }
70
96
  }
71
97
 
72
- @mixin density($config-or-theme) {}
98
+ @mixin density($config-or-theme) {
99
+ }
73
100
 
74
101
  @mixin theme($theme-or-color-config) {
75
102
  $theme: theming.private-legacy-get-theme($theme-or-color-config);