@angular/material 17.3.0-next.0 → 17.3.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 (177) hide show
  1. package/autocomplete/index.d.ts +5 -0
  2. package/button-toggle/index.d.ts +18 -1
  3. package/core/index.d.ts +57 -13
  4. package/core/theming/_inspection.scss +2 -2
  5. package/core/theming/_theming.scss +4 -3
  6. package/core/tokens/_token-utils.scss +3 -0
  7. package/core/tokens/m2/mat/_datepicker.scss +1 -2
  8. package/core/tokens/m2/mat/_fab-small.scss +32 -13
  9. package/core/tokens/m2/mat/_fab.scss +32 -13
  10. package/core/tokens/m2/mat/_filled-button.scss +24 -10
  11. package/core/tokens/m2/mat/_form-field.scss +5 -5
  12. package/core/tokens/m2/mat/_icon-button.scss +8 -5
  13. package/core/tokens/m2/mat/_menu.scss +2 -2
  14. package/core/tokens/m2/mat/_option.scss +2 -2
  15. package/core/tokens/m2/mat/_outlined-button.scss +8 -5
  16. package/core/tokens/m2/mat/_protected-button.scss +24 -10
  17. package/core/tokens/m2/mat/_radio.scss +1 -3
  18. package/core/tokens/m2/mat/_select.scss +17 -7
  19. package/core/tokens/m2/mat/_switch.scss +1 -0
  20. package/core/tokens/m2/mat/_tab-header.scss +2 -2
  21. package/core/tokens/m2/mat/_text-button.scss +8 -5
  22. package/core/tokens/m2/mdc/_checkbox.scss +14 -12
  23. package/core/tokens/m2/mdc/_chip.scss +3 -9
  24. package/core/tokens/m2/mdc/_dialog.scss +9 -3
  25. package/core/tokens/m2/mdc/_filled-button.scss +19 -9
  26. package/core/tokens/m2/mdc/_filled-text-field.scss +22 -10
  27. package/core/tokens/m2/mdc/_outlined-button.scss +12 -8
  28. package/core/tokens/m2/mdc/_outlined-text-field.scss +21 -10
  29. package/core/tokens/m2/mdc/_protected-button.scss +18 -7
  30. package/core/tokens/m2/mdc/_radio.scss +4 -5
  31. package/core/tokens/m2/mdc/_text-button.scss +3 -3
  32. package/datepicker/index.d.ts +1 -0
  33. package/esm2022/autocomplete/autocomplete-trigger.mjs +34 -19
  34. package/esm2022/autocomplete/autocomplete.mjs +3 -3
  35. package/esm2022/badge/badge.mjs +1 -1
  36. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +1 -1
  37. package/esm2022/button/fab.mjs +1 -1
  38. package/esm2022/button-toggle/button-toggle-module.mjs +2 -2
  39. package/esm2022/button-toggle/button-toggle.mjs +39 -6
  40. package/esm2022/card/card.mjs +1 -1
  41. package/esm2022/checkbox/checkbox.mjs +1 -1
  42. package/esm2022/chips/chip-grid.mjs +1 -1
  43. package/esm2022/chips/chip-listbox.mjs +1 -1
  44. package/esm2022/chips/chip-option.mjs +1 -1
  45. package/esm2022/chips/chip-row.mjs +1 -1
  46. package/esm2022/chips/chip-set.mjs +1 -1
  47. package/esm2022/chips/chip.mjs +1 -1
  48. package/esm2022/core/common-behaviors/color.mjs +1 -1
  49. package/esm2022/core/common-behaviors/disable-ripple.mjs +1 -1
  50. package/esm2022/core/common-behaviors/disabled.mjs +1 -1
  51. package/esm2022/core/common-behaviors/error-state.mjs +1 -1
  52. package/esm2022/core/common-behaviors/initialized.mjs +6 -2
  53. package/esm2022/core/common-behaviors/tabindex.mjs +1 -1
  54. package/esm2022/core/internal-form-field/internal-form-field.mjs +1 -1
  55. package/esm2022/core/option/optgroup.mjs +1 -1
  56. package/esm2022/core/option/option.mjs +1 -1
  57. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +1 -1
  58. package/esm2022/core/version.mjs +1 -1
  59. package/esm2022/datepicker/calendar-body.mjs +1 -1
  60. package/esm2022/datepicker/calendar.mjs +5 -5
  61. package/esm2022/datepicker/date-range-input-parts.mjs +11 -6
  62. package/esm2022/datepicker/date-range-input.mjs +1 -1
  63. package/esm2022/datepicker/datepicker-actions.mjs +1 -1
  64. package/esm2022/datepicker/datepicker-base.mjs +1 -1
  65. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  66. package/esm2022/dialog/dialog-container.mjs +1 -1
  67. package/esm2022/divider/divider.mjs +1 -1
  68. package/esm2022/expansion/expansion-panel-header.mjs +1 -1
  69. package/esm2022/expansion/expansion-panel.mjs +35 -25
  70. package/esm2022/form-field/form-field.mjs +3 -3
  71. package/esm2022/grid-list/grid-list.mjs +1 -1
  72. package/esm2022/grid-list/grid-tile.mjs +1 -1
  73. package/esm2022/icon/icon.mjs +1 -1
  74. package/esm2022/list/action-list.mjs +1 -1
  75. package/esm2022/list/list-option.mjs +3 -3
  76. package/esm2022/list/list.mjs +1 -1
  77. package/esm2022/list/nav-list.mjs +1 -1
  78. package/esm2022/list/selection-list.mjs +1 -1
  79. package/esm2022/menu/menu.mjs +1 -1
  80. package/esm2022/paginator/paginator.mjs +1 -1
  81. package/esm2022/progress-bar/progress-bar.mjs +1 -1
  82. package/esm2022/progress-spinner/progress-spinner.mjs +1 -1
  83. package/esm2022/radio/radio.mjs +1 -1
  84. package/esm2022/select/select.mjs +15 -8
  85. package/esm2022/sidenav/drawer.mjs +1 -1
  86. package/esm2022/sidenav/sidenav.mjs +1 -1
  87. package/esm2022/slide-toggle/slide-toggle.mjs +3 -3
  88. package/esm2022/slider/slider-input.mjs +3 -1
  89. package/esm2022/slider/slider-interface.mjs +1 -1
  90. package/esm2022/slider/slider-thumb.mjs +1 -1
  91. package/esm2022/slider/slider.mjs +1 -1
  92. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  93. package/esm2022/snack-bar/snack-bar-container.mjs +1 -1
  94. package/esm2022/sort/sort-header.mjs +1 -1
  95. package/esm2022/stepper/step-header.mjs +1 -1
  96. package/esm2022/stepper/stepper.mjs +1 -1
  97. package/esm2022/table/cell.mjs +2 -3
  98. package/esm2022/table/row.mjs +16 -7
  99. package/esm2022/table/table.mjs +1 -1
  100. package/esm2022/table/text-column.mjs +2 -2
  101. package/esm2022/tabs/ink-bar.mjs +4 -4
  102. package/esm2022/tabs/tab-body.mjs +1 -1
  103. package/esm2022/tabs/tab-group.mjs +2 -2
  104. package/esm2022/tabs/tab-header.mjs +1 -1
  105. package/esm2022/tabs/tab-label-wrapper.mjs +2 -3
  106. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +1 -1
  107. package/esm2022/toolbar/toolbar.mjs +1 -1
  108. package/esm2022/tooltip/tooltip.mjs +3 -7
  109. package/esm2022/tree/node.mjs +2 -2
  110. package/esm2022/tree/toggle.mjs +2 -2
  111. package/esm2022/tree/tree.mjs +1 -1
  112. package/expansion/index.d.ts +5 -2
  113. package/fesm2022/autocomplete.mjs +36 -21
  114. package/fesm2022/autocomplete.mjs.map +1 -1
  115. package/fesm2022/badge.mjs.map +1 -1
  116. package/fesm2022/bottom-sheet.mjs.map +1 -1
  117. package/fesm2022/button-toggle.mjs +40 -7
  118. package/fesm2022/button-toggle.mjs.map +1 -1
  119. package/fesm2022/button.mjs.map +1 -1
  120. package/fesm2022/card.mjs.map +1 -1
  121. package/fesm2022/checkbox.mjs.map +1 -1
  122. package/fesm2022/chips.mjs.map +1 -1
  123. package/fesm2022/core.mjs +6 -2
  124. package/fesm2022/core.mjs.map +1 -1
  125. package/fesm2022/datepicker.mjs +14 -9
  126. package/fesm2022/datepicker.mjs.map +1 -1
  127. package/fesm2022/dialog.mjs.map +1 -1
  128. package/fesm2022/divider.mjs.map +1 -1
  129. package/fesm2022/expansion.mjs +34 -24
  130. package/fesm2022/expansion.mjs.map +1 -1
  131. package/fesm2022/form-field.mjs +2 -2
  132. package/fesm2022/form-field.mjs.map +1 -1
  133. package/fesm2022/grid-list.mjs.map +1 -1
  134. package/fesm2022/icon.mjs.map +1 -1
  135. package/fesm2022/list.mjs +2 -2
  136. package/fesm2022/list.mjs.map +1 -1
  137. package/fesm2022/menu.mjs.map +1 -1
  138. package/fesm2022/paginator.mjs.map +1 -1
  139. package/fesm2022/progress-bar.mjs.map +1 -1
  140. package/fesm2022/progress-spinner.mjs.map +1 -1
  141. package/fesm2022/radio.mjs.map +1 -1
  142. package/fesm2022/select.mjs +11 -4
  143. package/fesm2022/select.mjs.map +1 -1
  144. package/fesm2022/sidenav.mjs.map +1 -1
  145. package/fesm2022/slide-toggle.mjs +2 -2
  146. package/fesm2022/slide-toggle.mjs.map +1 -1
  147. package/fesm2022/slider.mjs +2 -0
  148. package/fesm2022/slider.mjs.map +1 -1
  149. package/fesm2022/snack-bar.mjs.map +1 -1
  150. package/fesm2022/sort.mjs.map +1 -1
  151. package/fesm2022/stepper.mjs.map +1 -1
  152. package/fesm2022/table.mjs +17 -9
  153. package/fesm2022/table.mjs.map +1 -1
  154. package/fesm2022/tabs.mjs +5 -6
  155. package/fesm2022/tabs.mjs.map +1 -1
  156. package/fesm2022/toolbar.mjs.map +1 -1
  157. package/fesm2022/tooltip.mjs +2 -6
  158. package/fesm2022/tooltip.mjs.map +1 -1
  159. package/fesm2022/tree.mjs +2 -2
  160. package/fesm2022/tree.mjs.map +1 -1
  161. package/form-field/_mdc-text-field-structure-overrides.scss +16 -0
  162. package/package.json +7 -7
  163. package/prebuilt-themes/deeppurple-amber.css +1 -1
  164. package/prebuilt-themes/indigo-pink.css +1 -1
  165. package/prebuilt-themes/pink-bluegrey.css +1 -1
  166. package/prebuilt-themes/purple-green.css +1 -1
  167. package/schematics/ng-add/index.js +2 -2
  168. package/schematics/ng-add/index.mjs +2 -2
  169. package/schematics/ng-add/setup-project.js +21 -6
  170. package/schematics/ng-add/setup-project.mjs +21 -6
  171. package/schematics/ng-add/theming/create-custom-theme.js +4 -2
  172. package/schematics/ng-add/theming/create-custom-theme.mjs +4 -2
  173. package/select/index.d.ts +7 -2
  174. package/slider/index.d.ts +2 -0
  175. package/table/index.d.ts +3 -1
  176. package/tabs/index.d.ts +1 -1
  177. package/tooltip/index.d.ts +2 -0
@@ -287,6 +287,8 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
287
287
  private _previousValue;
288
288
  /** Value of the input element when the panel was attached (even if there are no options). */
289
289
  private _valueOnAttach;
290
+ /** Value on the previous keydown event. */
291
+ private _valueOnLastKeydown;
290
292
  /** Strategy that is used to position the panel. */
291
293
  private _positionStrategy;
292
294
  /** Whether or not the label state is being overridden. */
@@ -402,6 +404,8 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
402
404
  private _emitOpened;
403
405
  /** Destroys the autocomplete suggestion panel. */
404
406
  private _destroyPanel;
407
+ /** Given a value, returns the string that should be shown within the input. */
408
+ private _getDisplayValue;
405
409
  private _assignOptionValue;
406
410
  private _updateNativeInputValue;
407
411
  /**
@@ -414,6 +418,7 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
414
418
  * Clear any previous selected option and emit a selection change event for this option
415
419
  */
416
420
  private _clearPreviousSelectedOption;
421
+ private _openPanelInternal;
417
422
  private _attachOverlay;
418
423
  /** Handles keyboard events coming from the overlay panel. */
419
424
  private _handlePanelKeydown;
@@ -14,6 +14,7 @@ import { QueryList } from '@angular/core';
14
14
 
15
15
  declare namespace i2 {
16
16
  export {
17
+ MAT_BUTTON_TOGGLE_GROUP_DEFAULT_OPTIONS_FACTORY,
17
18
  ToggleType,
18
19
  MatButtonToggleAppearance,
19
20
  MatButtonToggleDefaultOptions,
@@ -39,6 +40,8 @@ export declare const MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS: InjectionToken<MatButton
39
40
  */
40
41
  export declare const MAT_BUTTON_TOGGLE_GROUP: InjectionToken<MatButtonToggleGroup>;
41
42
 
43
+ export declare function MAT_BUTTON_TOGGLE_GROUP_DEFAULT_OPTIONS_FACTORY(): MatButtonToggleDefaultOptions;
44
+
42
45
  /**
43
46
  * Provider Expression that allows mat-button-toggle-group to register as a ControlValueAccessor.
44
47
  * This allows it to support [(ngModel)].
@@ -141,6 +144,10 @@ export declare interface MatButtonToggleDefaultOptions {
141
144
  * setting an appearance on a button toggle or group.
142
145
  */
143
146
  appearance?: MatButtonToggleAppearance;
147
+ /** Whetehr icon indicators should be hidden for single-selection button toggle groups. */
148
+ hideSingleSelectionIndicator?: boolean;
149
+ /** Whether icon indicators should be hidden for multiple-selection button toggle groups. */
150
+ hideMultipleSelectionIndicator?: boolean;
144
151
  }
145
152
 
146
153
  /** Exclusive selection button toggle group that behaves like a radio-button group. */
@@ -192,6 +199,14 @@ export declare class MatButtonToggleGroup implements ControlValueAccessor, OnIni
192
199
  set disabled(value: boolean);
193
200
  /** Event emitted when the group's value changes. */
194
201
  readonly change: EventEmitter<MatButtonToggleChange>;
202
+ /** Whether checkmark indicator for single-selection button toggle groups is hidden. */
203
+ get hideSingleSelectionIndicator(): boolean;
204
+ set hideSingleSelectionIndicator(value: boolean);
205
+ private _hideSingleSelectionIndicator;
206
+ /** Whether checkmark indicator for multiple-selection button toggle groups is hidden. */
207
+ get hideMultipleSelectionIndicator(): boolean;
208
+ set hideMultipleSelectionIndicator(value: boolean);
209
+ private _hideMultipleSelectionIndicator;
195
210
  constructor(_changeDetector: ChangeDetectorRef, defaultOptions?: MatButtonToggleDefaultOptions);
196
211
  ngOnInit(): void;
197
212
  ngAfterContentInit(): void;
@@ -228,10 +243,12 @@ export declare class MatButtonToggleGroup implements ControlValueAccessor, OnIni
228
243
  /** Marks all of the child button toggles to be checked. */
229
244
  private _markButtonsForCheck;
230
245
  static ɵfac: i0.ɵɵFactoryDeclaration<MatButtonToggleGroup, [null, { optional: true; }]>;
231
- static ɵdir: i0.ɵɵDirectiveDeclaration<MatButtonToggleGroup, "mat-button-toggle-group", ["matButtonToggleGroup"], { "appearance": { "alias": "appearance"; "required": false; }; "name": { "alias": "name"; "required": false; }; "vertical": { "alias": "vertical"; "required": false; }; "value": { "alias": "value"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; "change": "change"; }, ["_buttonToggles"], never, true, never>;
246
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MatButtonToggleGroup, "mat-button-toggle-group", ["matButtonToggleGroup"], { "appearance": { "alias": "appearance"; "required": false; }; "name": { "alias": "name"; "required": false; }; "vertical": { "alias": "vertical"; "required": false; }; "value": { "alias": "value"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hideSingleSelectionIndicator": { "alias": "hideSingleSelectionIndicator"; "required": false; }; "hideMultipleSelectionIndicator": { "alias": "hideMultipleSelectionIndicator"; "required": false; }; }, { "valueChange": "valueChange"; "change": "change"; }, ["_buttonToggles"], never, true, never>;
232
247
  static ngAcceptInputType_vertical: unknown;
233
248
  static ngAcceptInputType_multiple: unknown;
234
249
  static ngAcceptInputType_disabled: unknown;
250
+ static ngAcceptInputType_hideSingleSelectionIndicator: unknown;
251
+ static ngAcceptInputType_hideMultipleSelectionIndicator: unknown;
235
252
  }
236
253
 
237
254
  export declare class MatButtonToggleModule {
package/core/index.d.ts CHANGED
@@ -44,7 +44,11 @@ export declare class AnimationDurations {
44
44
  static EXITING: string;
45
45
  }
46
46
 
47
- /** @docs-private */
47
+ /**
48
+ * @docs-private
49
+ * @deprecated Will be removed together with `mixinColor`.
50
+ * @breaking-change 19.0.0
51
+ */
48
52
  export declare interface CanColor {
49
53
  /** Theme color palette for the component. */
50
54
  color: ThemePalette;
@@ -54,7 +58,11 @@ export declare interface CanColor {
54
58
 
55
59
  declare type CanColorCtor = _Constructor<CanColor> & _AbstractConstructor<CanColor>;
56
60
 
57
- /** @docs-private */
61
+ /**
62
+ * @docs-private
63
+ * @deprecated Will be removed together with `mixinDisabled`.
64
+ * @breaking-change 19.0.0
65
+ */
58
66
  export declare interface CanDisable {
59
67
  /** Whether the component is disabled. */
60
68
  disabled: boolean;
@@ -62,7 +70,11 @@ export declare interface CanDisable {
62
70
 
63
71
  declare type CanDisableCtor = _Constructor<CanDisable> & _AbstractConstructor<CanDisable>;
64
72
 
65
- /** @docs-private */
73
+ /**
74
+ * @docs-private
75
+ * @deprecated Will be removed together with `mixinDisableRipple`.
76
+ * @breaking-change 19.0.0
77
+ */
66
78
  export declare interface CanDisableRipple {
67
79
  /** Whether ripples are disabled. */
68
80
  disableRipple: boolean;
@@ -70,7 +82,11 @@ export declare interface CanDisableRipple {
70
82
 
71
83
  declare type CanDisableRippleCtor = _Constructor<CanDisableRipple> & _AbstractConstructor<CanDisableRipple>;
72
84
 
73
- /** @docs-private */
85
+ /**
86
+ * @docs-private
87
+ * @deprecated Will be removed together with `mixinErrorState`.
88
+ * @breaking-change 19.0.0
89
+ */
74
90
  export declare interface CanUpdateErrorState {
75
91
  /** Updates the error state based on the provided error state matcher. */
76
92
  updateErrorState(): void;
@@ -360,10 +376,10 @@ declare interface HasElementRef {
360
376
 
361
377
  /** @docs-private */
362
378
  declare interface HasErrorState {
363
- _parentFormGroup: FormGroupDirective;
364
- _parentForm: NgForm;
379
+ _parentFormGroup: FormGroupDirective | null;
380
+ _parentForm: NgForm | null;
365
381
  _defaultErrorStateMatcher: ErrorStateMatcher_2;
366
- ngControl: NgControl;
382
+ ngControl: NgControl | null;
367
383
  stateChanges: Subject<void>;
368
384
  }
369
385
 
@@ -373,6 +389,8 @@ declare interface HasErrorState {
373
389
  * If the subscription is made after it has already been marked as initialized, then it will trigger
374
390
  * an emit immediately.
375
391
  * @docs-private
392
+ * @deprecated Will be removed together with `mixinInitializer`.
393
+ * @breaking-change 19.0.0
376
394
  */
377
395
  export declare interface HasInitialized {
378
396
  /** Stream that emits once during the directive/component's ngOnInit. */
@@ -387,7 +405,11 @@ export declare interface HasInitialized {
387
405
 
388
406
  declare type HasInitializedCtor = _Constructor<HasInitialized>;
389
407
 
390
- /** @docs-private */
408
+ /**
409
+ * @docs-private
410
+ * @deprecated Will be removed together with `mixinTabIndex`.
411
+ * @breaking-change 19.0.0
412
+ */
391
413
  export declare interface HasTabIndex {
392
414
  /** Tabindex of the component. */
393
415
  tabIndex: number;
@@ -862,25 +884,47 @@ export declare class MatRippleModule {
862
884
  static ɵinj: i0.ɵɵInjectorDeclaration<MatRippleModule>;
863
885
  }
864
886
 
865
- /** Mixin to augment a directive with a `color` property. */
887
+ /**
888
+ * Mixin to augment a directive with a `color` property.
889
+ * @deprecated Use a plain input and host bindings instead.
890
+ * @breaking-change 19.0.0
891
+ */
866
892
  export declare function mixinColor<T extends _AbstractConstructor<HasElementRef>>(base: T, defaultColor?: ThemePalette): CanColorCtor & T;
867
893
 
868
- /** Mixin to augment a directive with a `disabled` property. */
894
+ /**
895
+ * Mixin to augment a directive with a `disabled` property.
896
+ * @deprecated Use an input with a transform instead.
897
+ * @breaking-change 19.0.0
898
+ */
869
899
  export declare function mixinDisabled<T extends _AbstractConstructor<{}>>(base: T): CanDisableCtor & T;
870
900
 
871
- /** Mixin to augment a directive with a `disableRipple` property. */
901
+ /**
902
+ * Mixin to augment a directive with a `disableRipple` property.
903
+ * @deprecated Use an input with a transform instead.
904
+ * @breaking-change 19.0.0
905
+ */
872
906
  export declare function mixinDisableRipple<T extends _AbstractConstructor<{}>>(base: T): CanDisableRippleCtor & T;
873
907
 
874
908
  /**
875
909
  * Mixin to augment a directive with updateErrorState method.
876
910
  * For component with `errorState` and need to update `errorState`.
911
+ * @deprecated Implement the `updateErrorState` method directly.
912
+ * @breaking-change 19.0.0
877
913
  */
878
914
  export declare function mixinErrorState<T extends _AbstractConstructor<HasErrorState>>(base: T): CanUpdateErrorStateCtor & T;
879
915
 
880
- /** Mixin to augment a directive with an initialized property that will emits when ngOnInit ends. */
916
+ /**
917
+ * Mixin to augment a directive with an initialized property that will emits when ngOnInit ends.
918
+ * @deprecated Track the initialized state manually.
919
+ * @breaking-change 19.0.0
920
+ */
881
921
  export declare function mixinInitialized<T extends _Constructor<{}>>(base: T): HasInitializedCtor & T;
882
922
 
883
- /** Mixin to augment a directive with a `tabIndex` property. */
923
+ /**
924
+ * Mixin to augment a directive with a `tabIndex` property.
925
+ * @deprecated Use an input with a transform instead.
926
+ * @breaking-change 19.0.0
927
+ */
884
928
  export declare function mixinTabIndex<T extends _AbstractConstructor<CanDisable>>(base: T, defaultTabIndex?: number): HasTabIndexCtor & T;
885
929
 
886
930
  /** Adapts the native JS Date for use with cdk-based components that work with dates. */
@@ -75,8 +75,8 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
75
75
  @function get-theme-color($theme, $args...) {
76
76
  $version: get-theme-version($theme);
77
77
  $args-count: list.length($args);
78
- @if $args-count != 1 and $args-count != 2 {
79
- @error #{'Expected 2 or 3 arguments. Got:'} $args-count + 1;
78
+ @if $args-count != 1 and $args-count != 2 and $args-count != 3 {
79
+ @error #{'Expected between 2 and 4 arguments. Got:'} $args-count + 1;
80
80
  }
81
81
 
82
82
  @if $version == 0 {
@@ -432,9 +432,10 @@ $_internals: _mat-theming-internals-do-not-access;
432
432
  // Checks for duplicate styles in a `theme-version: 0` style theme.
433
433
  @mixin _check-duplicate-theme-styles-v0($theme-or-color-config, $id) {
434
434
  $theme: private-legacy-get-theme($theme-or-color-config);
435
- $color-config: get-color-config($theme);
436
- $density-config: get-density-config($theme);
437
- $typography-config: get-typography-config($theme);
435
+ $color-config: map.get($theme, $_internals, m2-config, color) or get-color-config($theme);
436
+ $density-config: map.get($theme, $_internals, m2-config, density) or get-density-config($theme);
437
+ $typography-config:
438
+ map.get($theme, $_internals, m2-config, typography) or get-typography-config($theme);
438
439
  // Lists of previous `color`, `density` and `typography` configurations.
439
440
  $previous-color: map.get($_emitted-color, $id) or ();
440
441
  $previous-typography: map.get($_emitted-typography, $id) or ();
@@ -9,6 +9,9 @@
9
9
  @use '../theming/theming';
10
10
  @use '../typography/typography';
11
11
 
12
+ // Indicates whether we're building internally. Used for backwards compatibility.
13
+ $private-is-internal-build: false;
14
+
12
15
  $_placeholder-color-palette: theming.define-palette(palette.$red-palette);
13
16
 
14
17
  // Placeholder color config that can be passed to token getter functions when generating token
@@ -50,7 +50,6 @@ $private-default-overlap-color: #a8dab5;
50
50
  $preview-outline-color: $divider-color;
51
51
  $today-disabled-outline-color: null;
52
52
  $is-dark: inspection.get-theme-type($theme) == dark;
53
- $on-surface: if($is-dark, #fff, #000);
54
53
 
55
54
  $primary-color: inspection.get-theme-color($theme, primary);
56
55
  $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
@@ -75,7 +74,7 @@ $private-default-overlap-color: #a8dab5;
75
74
  @return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
76
75
  toggle-icon-color: $inactive-icon-color,
77
76
  calendar-body-label-text-color: $secondary-text-color,
78
- calendar-period-button-text-color: $on-surface,
77
+ calendar-period-button-text-color: inspection.get-theme-color($theme, foreground, text, 1),
79
78
  calendar-period-button-icon-color: $inactive-icon-color,
80
79
  calendar-navigation-button-icon-color: $inactive-icon-color,
81
80
  calendar-header-divider-color: $divider-color,
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
  @use '@material/ripple/ripple-theme' as mdc-ripple-theme;
3
4
  @use '../../token-utils';
4
5
  @use '../../../theming/theming';
@@ -18,7 +19,6 @@ $prefix: (mat, fab-small);
18
19
  // Tokens that can be configured through Angular Material's color theming API.
19
20
  @function get-color-tokens($theme) {
20
21
  $is-dark: inspection.get-theme-type($theme) == dark;
21
- $on-surface: if($is-dark, #fff, #000);
22
22
  $ripple-opacities: if($is-dark,
23
23
  mdc-ripple-theme.$light-ink-opacities,
24
24
  mdc-ripple-theme.$dark-ink-opacities
@@ -29,13 +29,13 @@ $prefix: (mat, fab-small);
29
29
  foreground-color: inspection.get-theme-color($theme, foreground, base),
30
30
 
31
31
  // Color of the element that shows the hover, focus and pressed states.
32
- state-layer-color: $on-surface,
32
+ state-layer-color: inspection.get-theme-color($theme, foreground, base),
33
33
 
34
34
  // Color of the element that shows the hover, focus and pressed states while disabled.
35
- disabled-state-layer-color: $on-surface,
35
+ disabled-state-layer-color: inspection.get-theme-color($theme, foreground, base),
36
36
 
37
37
  // Color of the ripple element.
38
- ripple-color: rgba($on-surface, 0.1),
38
+ ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
39
39
 
40
40
  // Opacity of the ripple when the button is hovered.
41
41
  hover-state-layer-opacity: map.get($ripple-opacities, hover),
@@ -48,24 +48,43 @@ $prefix: (mat, fab-small);
48
48
 
49
49
  // MDC doesn't have tokens for disabled FABs so we need to implemented them ourselves.
50
50
  // Background color of the container when the FAB is disabled.
51
- disabled-state-container-color: rgba($on-surface, 0.12),
51
+ disabled-state-container-color: inspection.get-theme-color($theme, background, disabled-button,
52
+ 0.12),
52
53
 
53
54
  // Color of the icons and projected text when the FAB is disabled.
54
- disabled-state-foreground-color: rgba($on-surface, if($is-dark, 0.5, 0.38)),
55
+ disabled-state-foreground-color: inspection.get-theme-color($theme, foreground, disabled-button,
56
+ if($is-dark, 0.5, 0.38)),
55
57
  );
56
58
  }
57
59
 
58
60
  // Generates the mapping for the properties that change based on the FAB palette color.
59
61
  @function private-get-color-palette-color-tokens($theme, $palette-name) {
60
- $is-dark: inspection.get-theme-type($theme) == dark;
61
- $container-color: inspection.get-theme-color($theme, $palette-name);
62
- $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
63
- $color: if($contrast-tone == 'dark', #000, #fff);
62
+ // Ideally we would derive all values directly from the theme, but it causes a lot of regressions
63
+ // internally. For now we fall back to the old hardcoded behavior only for internal apps.
64
+ $foreground-color: null;
65
+ $state-layer-color: null;
66
+ $ripple-color: null;
67
+ $contrast-color: inspection.get-theme-color($theme, $palette-name, default-contrast);
68
+
69
+ @if (token-utils.$private-is-internal-build or meta.type-of($contrast-color) != 'color') {
70
+ $is-dark: inspection.get-theme-type($theme) == dark;
71
+ $container-color: inspection.get-theme-color($theme, $palette-name);
72
+ $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
73
+ $color: if($contrast-tone == 'dark', #000, #fff);
74
+ $foreground-color: $color;
75
+ $state-layer-color: $color;
76
+ $ripple-color: rgba($color, 0.1);
77
+ }
78
+ @else {
79
+ $foreground-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1);
80
+ $state-layer-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1);
81
+ $ripple-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 0.1);
82
+ }
64
83
 
65
84
  @return (
66
- foreground-color: $color,
67
- state-layer-color: $color,
68
- ripple-color: rgba($color, 0.1),
85
+ foreground-color: $foreground-color,
86
+ state-layer-color: $state-layer-color,
87
+ ripple-color: $ripple-color,
69
88
  );
70
89
  }
71
90
 
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
  @use '@material/ripple/ripple-theme' as mdc-ripple-theme;
3
4
  @use '../../token-utils';
4
5
  @use '../../../theming/theming';
@@ -18,7 +19,6 @@ $prefix: (mat, fab);
18
19
  // Tokens that can be configured through Angular Material's color theming API.
19
20
  @function get-color-tokens($theme) {
20
21
  $is-dark: inspection.get-theme-type($theme) == dark;
21
- $on-surface: if($is-dark, #fff, #000);
22
22
  $ripple-opacities: if($is-dark,
23
23
  mdc-ripple-theme.$light-ink-opacities,
24
24
  mdc-ripple-theme.$dark-ink-opacities
@@ -29,13 +29,13 @@ $prefix: (mat, fab);
29
29
  foreground-color: inspection.get-theme-color($theme, foreground, base),
30
30
 
31
31
  // Color of the element that shows the hover, focus and pressed states.
32
- state-layer-color: $on-surface,
32
+ state-layer-color: inspection.get-theme-color($theme, foreground, base),
33
33
 
34
34
  // Color of the element that shows the hover, focus and pressed states while disabled.
35
- disabled-state-layer-color: $on-surface,
35
+ disabled-state-layer-color: inspection.get-theme-color($theme, foreground, base),
36
36
 
37
37
  // Color of the ripple element.
38
- ripple-color: rgba($on-surface, 0.1),
38
+ ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
39
39
 
40
40
  // Opacity of the ripple when the button is hovered.
41
41
  hover-state-layer-opacity: map.get($ripple-opacities, hover),
@@ -48,24 +48,43 @@ $prefix: (mat, fab);
48
48
 
49
49
  // MDC doesn't have tokens for disabled FABs so we need to implemented them ourselves.
50
50
  // Background color of the container when the FAB is disabled.
51
- disabled-state-container-color: rgba($on-surface, 0.12),
51
+ disabled-state-container-color: inspection.get-theme-color($theme, background, disabled-button,
52
+ 0.12),
52
53
 
53
54
  // Color of the icons and projected text when the FAB is disabled.
54
- disabled-state-foreground-color: rgba($on-surface, if($is-dark, 0.5, 0.38)),
55
+ disabled-state-foreground-color: inspection.get-theme-color($theme, foreground, disabled-button,
56
+ if($is-dark, 0.5, 0.38)),
55
57
  );
56
58
  }
57
59
 
58
60
  // Generates the mapping for the properties that change based on the FAB palette color.
59
61
  @function private-get-color-palette-color-tokens($theme, $palette-name) {
60
- $is-dark: inspection.get-theme-type($theme) == dark;
61
- $container-color: inspection.get-theme-color($theme, $palette-name);
62
- $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
63
- $color: if($contrast-tone == 'dark', #000, #fff);
62
+ // Ideally we would derive all values directly from the theme, but it causes a lot of regressions
63
+ // internally. For now we fall back to the old hardcoded behavior only for internal apps.
64
+ $foreground-color: null;
65
+ $state-layer-color: null;
66
+ $ripple-color: null;
67
+ $contrast-color: inspection.get-theme-color($theme, $palette-name, default-contrast);
68
+
69
+ @if (token-utils.$private-is-internal-build or meta.type-of($contrast-color) != 'color') {
70
+ $is-dark: inspection.get-theme-type($theme) == dark;
71
+ $container-color: inspection.get-theme-color($theme, $palette-name);
72
+ $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
73
+ $color: if($contrast-tone == 'dark', #000, #fff);
74
+ $foreground-color: $color;
75
+ $state-layer-color: $color;
76
+ $ripple-color: rgba($color, 0.1);
77
+ }
78
+ @else {
79
+ $foreground-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1);
80
+ $state-layer-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1);
81
+ $ripple-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 0.1);
82
+ }
64
83
 
65
84
  @return (
66
- foreground-color: $color,
67
- state-layer-color: $color,
68
- ripple-color: rgba($color, 0.1),
85
+ foreground-color: $foreground-color,
86
+ state-layer-color: $state-layer-color,
87
+ ripple-color: $ripple-color,
69
88
  );
70
89
  }
71
90
 
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
  @use '@material/ripple/ripple-theme' as mdc-ripple-theme;
3
4
  @use '../../token-utils';
4
5
  @use '../../../theming/theming';
@@ -28,7 +29,6 @@ $prefix: (mat, filled-button);
28
29
  // Tokens that can be configured through Angular Material's color theming API.
29
30
  @function get-color-tokens($theme) {
30
31
  $is-dark: inspection.get-theme-type($theme) == dark;
31
- $on-surface: if($is-dark, #fff, #000);
32
32
  $ripple-opacities: if($is-dark,
33
33
  mdc-ripple-theme.$light-ink-opacities,
34
34
  mdc-ripple-theme.$dark-ink-opacities
@@ -36,13 +36,13 @@ $prefix: (mat, filled-button);
36
36
 
37
37
  @return (
38
38
  // Color of the element that shows the hover, focus and pressed states.
39
- state-layer-color: $on-surface,
39
+ state-layer-color: inspection.get-theme-color($theme, foreground, base),
40
40
 
41
41
  // Color of the element that shows the hover, focus and pressed states while disabled.
42
- disabled-state-layer-color: $on-surface,
42
+ disabled-state-layer-color: inspection.get-theme-color($theme, foreground, base),
43
43
 
44
44
  // Color of the ripple element.
45
- ripple-color: rgba($on-surface, 0.1),
45
+ ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
46
46
 
47
47
  // Opacity of the ripple when the button is hovered.
48
48
  hover-state-layer-opacity: map.get($ripple-opacities, hover),
@@ -57,14 +57,28 @@ $prefix: (mat, filled-button);
57
57
 
58
58
  // Generates the mapping for the properties that change based on the button palette color.
59
59
  @function private-get-color-palette-color-tokens($theme, $palette-name) {
60
- $is-dark: inspection.get-theme-type($theme) == dark;
61
- $container-color: inspection.get-theme-color($theme, $palette-name);
62
- $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
63
- $color: if($contrast-tone == 'dark', #000, #fff);
60
+ $state-layer-color: null;
61
+ $ripple-color: null;
62
+ $contrast-color: inspection.get-theme-color($theme, $palette-name, default-contrast);
63
+
64
+ // Ideally we would derive all values directly from the theme, but it causes a lot of regressions
65
+ // internally. For now we fall back to the old hardcoded behavior only for internal apps.
66
+ @if (token-utils.$private-is-internal-build or meta.type-of($contrast-color) != 'color') {
67
+ $is-dark: inspection.get-theme-type($theme) == dark;
68
+ $container-color: inspection.get-theme-color($theme, $palette-name);
69
+ $contrast-tone: mdc-helpers.variable-safe-contrast-tone($container-color, $is-dark);
70
+ $color: if($contrast-tone == 'dark', #000, #fff);
71
+ $state-layer-color: $color;
72
+ $ripple-color: rgba($color, 0.1);
73
+ }
74
+ @else {
75
+ $state-layer-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1);
76
+ $ripple-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 0.1);
77
+ }
64
78
 
65
79
  @return (
66
- state-layer-color: $color,
67
- ripple-color: rgba($color, 0.1),
80
+ state-layer-color: $state-layer-color,
81
+ ripple-color: $ripple-color,
68
82
  );
69
83
  }
70
84
 
@@ -20,13 +20,13 @@ $prefix: (mat, form-field);
20
20
  // Tokens that can be configured through Angular Material's color theming API.
21
21
  @function get-color-tokens($theme) {
22
22
  $is-dark: inspection.get-theme-type($theme) == dark;
23
- $on-surface: if($is-dark, #fff, #000);
24
23
  $color-tokens: private-get-color-palette-color-tokens($theme, primary);
25
24
 
26
25
  @return map.merge($color-tokens, (
27
26
  // MDC has a token for the enabled placeholder, but not for the disabled one.
28
- disabled-input-text-placeholder-color: rgba($on-surface, 0.38),
29
- state-layer-color: rgba($on-surface, 0.87),
27
+ disabled-input-text-placeholder-color:
28
+ inspection.get-theme-color($theme, foreground, icon, 0.38),
29
+ state-layer-color: inspection.get-theme-color($theme, foreground, base, 0.87),
30
30
  error-text-color: inspection.get-theme-color($theme, warn),
31
31
 
32
32
  // On dark themes we set the native `select` color to some shade of white,
@@ -56,8 +56,8 @@ $prefix: (mat, form-field);
56
56
 
57
57
  // These values are taken from the MDC select implementation:
58
58
  // https://github.com/material-components/material-components-web/blob/master/packages/mdc-select/_select-theme.scss
59
- enabled-select-arrow-color: rgba($on-surface, 0.54),
60
- disabled-select-arrow-color: rgba($on-surface, 0.38),
59
+ enabled-select-arrow-color: inspection.get-theme-color($theme, foreground, icon, 0.54),
60
+ disabled-select-arrow-color: inspection.get-theme-color($theme, foreground, icon, 0.38),
61
61
 
62
62
  hover-state-layer-opacity: if($is-dark, 0.08, 0.04),
63
63
  focus-state-layer-opacity: if($is-dark, 0.24, 0.08),
@@ -18,7 +18,6 @@ $prefix: (mat, icon-button);
18
18
  // Tokens that can be configured through Angular Material's color theming API.
19
19
  @function get-color-tokens($theme) {
20
20
  $is-dark: inspection.get-theme-type($theme) == dark;
21
- $on-surface: if($is-dark, #fff, #000);
22
21
  $ripple-opacities: if($is-dark,
23
22
  mdc-ripple-theme.$light-ink-opacities,
24
23
  mdc-ripple-theme.$dark-ink-opacities
@@ -26,13 +25,13 @@ $prefix: (mat, icon-button);
26
25
 
27
26
  @return (
28
27
  // Color of the element that shows the hover, focus and pressed states.
29
- state-layer-color: $on-surface,
28
+ state-layer-color: inspection.get-theme-color($theme, foreground, base),
30
29
 
31
30
  // Color of the element that shows the hover, focus and pressed states while disabled.
32
- disabled-state-layer-color: $on-surface,
31
+ disabled-state-layer-color: inspection.get-theme-color($theme, foreground, base),
33
32
 
34
33
  // Color of the ripple element.
35
- ripple-color: rgba($on-surface, 0.1),
34
+ ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
36
35
 
37
36
  // Opacity of the ripple when the button is hovered.
38
37
  hover-state-layer-opacity: map.get($ripple-opacities, hover),
@@ -48,10 +47,14 @@ $prefix: (mat, icon-button);
48
47
  // Generates the mapping for the properties that change based on the button palette color.
49
48
  @function private-get-color-palette-color-tokens($theme, $palette-name) {
50
49
  $color: inspection.get-theme-color($theme, $palette-name);
50
+ $ripple-opacity: 0.1;
51
51
 
52
52
  @return (
53
53
  state-layer-color: $color,
54
- ripple-color: if(meta.type-of($color) == color, rgba($color, 0.1), $color),
54
+ ripple-color: if(
55
+ meta.type-of($color) == color,
56
+ rgba($color, $ripple-opacity),
57
+ inspection.get-theme-color($theme, foreground, base, $ripple-opacity)),
55
58
  );
56
59
  }
57
60
 
@@ -24,8 +24,8 @@ $prefix: (mat, menu);
24
24
  // Tokens that can be configured through Angular Material's color theming API.
25
25
  @function get-color-tokens($theme) {
26
26
  $is-dark: inspection.get-theme-type($theme) == dark;
27
- $on-surface: if($is-dark, #fff, #000);
28
- $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
27
+ $active-state-layer-color: inspection.get-theme-color($theme, foreground, base,
28
+ if($is-dark, 0.08, 0.04));
29
29
  $text-color: inspection.get-theme-color($theme, foreground, text);
30
30
 
31
31
  @return (
@@ -15,8 +15,8 @@ $prefix: (mat, option);
15
15
  // Tokens that can be configured through Angular Material's color theming API.
16
16
  @function get-color-tokens($theme, $palette-name: primary) {
17
17
  $is-dark: inspection.get-theme-type($theme) == dark;
18
- $on-surface: if($is-dark, #fff, #000);
19
- $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
18
+ $active-state-layer-color: inspection.get-theme-color($theme, foreground, base,
19
+ if($is-dark, 0.08, 0.04));
20
20
 
21
21
  @return (
22
22
  selected-state-label-text-color: inspection.get-theme-color($theme, $palette-name),
@@ -28,7 +28,6 @@ $prefix: (mat, outlined-button);
28
28
  // Tokens that can be configured through Angular Material's color theming API.
29
29
  @function get-color-tokens($theme) {
30
30
  $is-dark: inspection.get-theme-type($theme) == dark;
31
- $on-surface: if($is-dark, #fff, #000);
32
31
  $ripple-opacities: if($is-dark,
33
32
  mdc-ripple-theme.$light-ink-opacities,
34
33
  mdc-ripple-theme.$dark-ink-opacities
@@ -36,13 +35,13 @@ $prefix: (mat, outlined-button);
36
35
 
37
36
  @return (
38
37
  // Color of the element that shows the hover, focus and pressed states.
39
- state-layer-color: $on-surface,
38
+ state-layer-color: inspection.get-theme-color($theme, foreground, base),
40
39
 
41
40
  // Color of the element that shows the hover, focus and pressed states while disabled.
42
- disabled-state-layer-color: $on-surface,
41
+ disabled-state-layer-color: inspection.get-theme-color($theme, foreground, base),
43
42
 
44
43
  // Color of the ripple element.
45
- ripple-color: rgba($on-surface, 0.1),
44
+ ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
46
45
 
47
46
  // Opacity of the ripple when the button is hovered.
48
47
  hover-state-layer-opacity: map.get($ripple-opacities, hover),
@@ -58,10 +57,14 @@ $prefix: (mat, outlined-button);
58
57
  // Generates the mapping for the properties that change based on the button palette color.
59
58
  @function private-get-color-palette-color-tokens($theme, $palette-name) {
60
59
  $color: inspection.get-theme-color($theme, $palette-name);
60
+ $ripple-opacity: 0.1;
61
61
 
62
62
  @return (
63
63
  state-layer-color: $color,
64
- ripple-color: if(meta.type-of($color) == color, rgba($color, 0.1), $color),
64
+ ripple-color: if(
65
+ meta.type-of($color) == color,
66
+ rgba($color, $ripple-opacity),
67
+ inspection.get-theme-color($theme, foreground, base, $ripple-opacity)),
65
68
  );
66
69
  }
67
70