@angular/material 16.1.5 → 16.1.7

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 (84) hide show
  1. package/bottom-sheet/_bottom-sheet-theme.scss +10 -11
  2. package/button/index.d.ts +31 -18
  3. package/button-toggle/_button-toggle-theme.scss +20 -97
  4. package/button-toggle/_button-toggle-variables.scss +2 -0
  5. package/core/selection/pseudo-checkbox/_pseudo-checkbox-common.scss +1 -1
  6. package/core/tokens/_token-utils.scss +1 -0
  7. package/core/tokens/m2/mat/_bottom-sheet.scss +56 -0
  8. package/core/tokens/m2/mat/_divider.scss +45 -0
  9. package/core/tokens/m2/mat/_grid-list.scss +46 -0
  10. package/core/tokens/m2/mat/_legacy-button-toggle.scss +63 -0
  11. package/core/tokens/m2/mat/_sidenav.scss +65 -0
  12. package/core/tokens/m2/mat/_standard-button-toggle.scss +87 -0
  13. package/core/tokens/m2/mat/_toolbar.scss +79 -0
  14. package/core/tokens/m2/mdc/_circular-progress.scss +1 -1
  15. package/core/tokens/m2/mdc/_plain-tooltip.scss +2 -2
  16. package/divider/_divider-theme.scss +6 -8
  17. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  18. package/esm2022/button/button-base.mjs +31 -15
  19. package/esm2022/button/button-lazy-loader.mjs +75 -52
  20. package/esm2022/button/button.mjs +3 -3
  21. package/esm2022/button/fab.mjs +5 -5
  22. package/esm2022/button/icon-button.mjs +4 -15
  23. package/esm2022/button-toggle/button-toggle.mjs +2 -2
  24. package/esm2022/chips/chip-option.mjs +2 -2
  25. package/esm2022/chips/chip-row.mjs +10 -7
  26. package/esm2022/chips/chip.mjs +2 -2
  27. package/esm2022/core/version.mjs +1 -1
  28. package/esm2022/divider/divider.mjs +2 -2
  29. package/esm2022/form-field/form-field.mjs +3 -3
  30. package/esm2022/grid-list/grid-list.mjs +2 -2
  31. package/esm2022/grid-list/grid-tile.mjs +2 -2
  32. package/esm2022/menu/menu-item.mjs +4 -4
  33. package/esm2022/menu/menu.mjs +3 -3
  34. package/esm2022/radio/radio.mjs +13 -1
  35. package/esm2022/sidenav/drawer.mjs +3 -3
  36. package/esm2022/sidenav/sidenav.mjs +3 -3
  37. package/esm2022/slide-toggle/slide-toggle.mjs +2 -2
  38. package/esm2022/tabs/ink-bar.mjs +1 -1
  39. package/esm2022/toolbar/toolbar.mjs +2 -2
  40. package/fesm2022/bottom-sheet.mjs +2 -2
  41. package/fesm2022/bottom-sheet.mjs.map +1 -1
  42. package/fesm2022/button-toggle.mjs +2 -2
  43. package/fesm2022/button-toggle.mjs.map +1 -1
  44. package/fesm2022/button.mjs +113 -86
  45. package/fesm2022/button.mjs.map +1 -1
  46. package/fesm2022/chips.mjs +13 -10
  47. package/fesm2022/chips.mjs.map +1 -1
  48. package/fesm2022/core.mjs +1 -1
  49. package/fesm2022/core.mjs.map +1 -1
  50. package/fesm2022/divider.mjs +2 -2
  51. package/fesm2022/divider.mjs.map +1 -1
  52. package/fesm2022/form-field.mjs +2 -2
  53. package/fesm2022/form-field.mjs.map +1 -1
  54. package/fesm2022/grid-list.mjs +4 -4
  55. package/fesm2022/grid-list.mjs.map +1 -1
  56. package/fesm2022/menu.mjs +5 -5
  57. package/fesm2022/menu.mjs.map +1 -1
  58. package/fesm2022/radio.mjs +12 -0
  59. package/fesm2022/radio.mjs.map +1 -1
  60. package/fesm2022/sidenav.mjs +4 -4
  61. package/fesm2022/sidenav.mjs.map +1 -1
  62. package/fesm2022/slide-toggle.mjs +2 -2
  63. package/fesm2022/slide-toggle.mjs.map +1 -1
  64. package/fesm2022/tabs.mjs.map +1 -1
  65. package/fesm2022/toolbar.mjs +2 -2
  66. package/fesm2022/toolbar.mjs.map +1 -1
  67. package/grid-list/_grid-list-theme.scss +7 -6
  68. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  69. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  70. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  71. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  72. package/package.json +2 -2
  73. package/prebuilt-themes/deeppurple-amber.css +1 -1
  74. package/prebuilt-themes/indigo-pink.css +1 -1
  75. package/prebuilt-themes/pink-bluegrey.css +1 -1
  76. package/prebuilt-themes/purple-green.css +1 -1
  77. package/radio/index.d.ts +4 -1
  78. package/schematics/ng-add/index.js +1 -1
  79. package/schematics/ng-add/index.mjs +1 -1
  80. package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
  81. package/schematics/ng-update/index_bundled.js +25 -25
  82. package/sidenav/_sidenav-theme.scss +6 -69
  83. package/tabs/index.d.ts +1 -1
  84. package/toolbar/_toolbar-theme.scss +25 -71
@@ -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
 
package/button/index.d.ts CHANGED
@@ -12,7 +12,6 @@ import * as i4 from '@angular/material/core';
12
12
  import { InjectionToken } from '@angular/core';
13
13
  import { MatRipple } from '@angular/material/core';
14
14
  import { NgZone } from '@angular/core';
15
- import { OnChanges } from '@angular/core';
16
15
  import { OnDestroy } from '@angular/core';
17
16
  import { OnInit } from '@angular/core';
18
17
  import { Platform } from '@angular/cdk/platform';
@@ -95,7 +94,7 @@ export declare class MatButton extends MatButtonBase {
95
94
  }
96
95
 
97
96
  /** Base class for all buttons. */
98
- declare class MatButtonBase extends _MatButtonMixin implements CanDisable, CanColor, CanDisableRipple, AfterViewInit, OnChanges, OnDestroy {
97
+ declare class MatButtonBase extends _MatButtonMixin implements CanDisable, CanColor, CanDisableRipple, AfterViewInit, OnDestroy {
99
98
  _platform: Platform;
100
99
  _ngZone: NgZone;
101
100
  _animationMode?: string | undefined;
@@ -114,25 +113,30 @@ declare class MatButtonBase extends _MatButtonMixin implements CanDisable, CanCo
114
113
  */
115
114
  get ripple(): MatRipple;
116
115
  set ripple(v: MatRipple);
117
- /** @docs-private Reference to the MatRipple instance of the button. */
118
- protected _ripple?: MatRipple;
116
+ /** Whether the ripple effect is disabled or not. */
117
+ get disableRipple(): boolean;
118
+ set disableRipple(value: any);
119
+ private _disableRipple;
120
+ get disabled(): boolean;
121
+ set disabled(value: any);
122
+ private _disabled;
119
123
  constructor(elementRef: ElementRef, _platform: Platform, _ngZone: NgZone, _animationMode?: string | undefined);
120
124
  ngAfterViewInit(): void;
121
- ngOnChanges(): void;
122
125
  ngOnDestroy(): void;
123
126
  /** Focuses the button. */
124
127
  focus(_origin?: FocusOrigin, options?: FocusOptions): void;
125
128
  /** Gets whether the button has one of the given attributes. */
126
129
  private _hasHostAttributes;
130
+ private _updateRippleDisabled;
127
131
  static ɵfac: i0.ɵɵFactoryDeclaration<MatButtonBase, never>;
128
132
  static ɵdir: i0.ɵɵDirectiveDeclaration<MatButtonBase, never, never, {}, {}, never, never, false, never>;
129
133
  }
130
134
 
131
135
  /**
132
- * Handles attaching the MatButton's ripple on demand.
136
+ * Handles attaching ripples on demand.
133
137
  *
134
- * This service allows us to avoid eagerly creating & attaching the MatButton's ripple.
135
- * It works by creating & attaching the ripple only when a MatButton is first interacted with.
138
+ * This service allows us to avoid eagerly creating & attaching MatRipples.
139
+ * It works by creating & attaching a ripple only when a component is first interacted with.
136
140
  */
137
141
  declare class MatButtonLazyLoader implements OnDestroy {
138
142
  private _document;
@@ -142,11 +146,26 @@ declare class MatButtonLazyLoader implements OnDestroy {
142
146
  private _ngZone;
143
147
  constructor();
144
148
  ngOnDestroy(): void;
145
- /** Handles creating and attaching button internals when a button is initially interacted with. */
149
+ /**
150
+ * Configures the ripple that will be rendered by the ripple loader.
151
+ *
152
+ * Stores the given information about how the ripple should be configured on the host
153
+ * element so that it can later be retrived & used when the ripple is actually created.
154
+ */
155
+ configureRipple(host: HTMLElement, config: {
156
+ className?: string;
157
+ centered?: boolean;
158
+ disabled?: boolean;
159
+ }): void;
160
+ /** Returns the ripple instance for the given host element. */
161
+ getRipple(host: HTMLElement): MatRipple | undefined;
162
+ /** Sets the disabled state on the ripple instance corresponding to the given host element. */
163
+ setDisabled(host: HTMLElement, disabled: boolean): void;
164
+ /** Handles creating and attaching component internals when a component it is initially interacted with. */
146
165
  private _onInteraction;
147
- /** Creates a MatButtonRipple and appends it to the given button element. */
148
- private _appendRipple;
149
- _createMatRipple(button: HTMLElement): MatRipple | undefined;
166
+ /** Creates a MatRipple and appends it to the given element. */
167
+ createRipple(host: HTMLElement): MatRipple | undefined;
168
+ attachRipple(host: Element, ripple: MatRipple): void;
150
169
  static ɵfac: i0.ɵɵFactoryDeclaration<MatButtonLazyLoader, never>;
151
170
  static ɵprov: i0.ɵɵInjectableDeclaration<MatButtonLazyLoader>;
152
171
  }
@@ -222,12 +241,6 @@ export declare class MatIconAnchor extends MatAnchorBase {
222
241
  * See https://material.io/develop/web/components/buttons/icon-buttons/
223
242
  */
224
243
  export declare class MatIconButton extends MatButtonBase {
225
- /**
226
- * Reference to the MatRipple instance of the button.
227
- * @deprecated Considered an implementation detail. To be removed.
228
- * @breaking-change 17.0.0
229
- */
230
- get ripple(): MatRipple;
231
244
  constructor(elementRef: ElementRef, platform: Platform, ngZone: NgZone, animationMode?: string);
232
245
  static ɵfac: i0.ɵɵFactoryDeclaration<MatIconButton, [null, null, null, { optional: true; }]>;
233
246
  static ɵcmp: i0.ɵɵComponentDeclaration<MatIconButton, "button[mat-icon-button]", ["matButton"], { "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, ["*"], false, never>;
@@ -1,118 +1,41 @@
1
- @use 'sass:map';
2
- @use '../core/style/private';
3
1
  @use '../core/theming/theming';
4
2
  @use '../core/typography/typography';
5
- @use '../core/typography/typography-utils';
6
- @use '../core/density/private/compatibility';
7
- @use './button-toggle-variables';
3
+ @use '../core/tokens/m2/mat/legacy-button-toggle' as tokens-mat-legacy-button-toggle;
4
+ @use '../core/tokens/m2/mat/standard-button-toggle' as tokens-mat-standard-button-toggle;
5
+ @use '../core/tokens/token-utils';
6
+ @use '../core/style/sass-utils';
8
7
 
9
8
  @mixin color($config-or-theme) {
10
9
  $config: theming.get-color-config($config-or-theme);
11
- $foreground: map.get($config, foreground);
12
- $background: map.get($config, background);
13
- $divider-color: theming.get-color-from-palette($foreground, divider);
14
- $theme-divider-color: map.get($foreground, divider);
15
10
 
16
- // By default the theme usually has an rgba color for the dividers, which can
17
- // stack up with the background of a button toggle. This can cause the border
18
- // of a selected toggle to look different from an deselected one. We use a solid
19
- // color to ensure that the border always stays the same.
20
- $divider-color: if(type-of($theme-divider-color) == color,
21
- theming.private-rgba-to-hex($theme-divider-color, map.get($background, card)),
22
- $theme-divider-color
23
- );
24
-
25
- .mat-button-toggle-standalone,
26
- .mat-button-toggle-group {
27
- @include private.private-theme-overridable-elevation(2, $config);
28
- }
29
-
30
- .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
31
- .mat-button-toggle-group-appearance-standard {
32
- &:not([class*='mat-elevation-z']) {
33
- box-shadow: none;
34
- }
35
- }
36
-
37
- .mat-button-toggle {
38
- color: theming.get-color-from-palette($foreground, hint-text);
39
-
40
- .mat-button-toggle-focus-overlay {
41
- background-color: theming.get-color-from-palette($background, focused-button);
42
- }
43
- }
44
-
45
- .mat-button-toggle-appearance-standard {
46
- color: theming.get-color-from-palette($foreground, text);
47
- background: theming.get-color-from-palette($background, card);
48
-
49
- .mat-button-toggle-focus-overlay {
50
- background-color: theming.get-color-from-palette($background, focused-button, 1);
51
- }
52
- }
53
-
54
- .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
55
- border-left: solid 1px $divider-color;
56
- }
57
-
58
- [dir='rtl'] .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
59
- border-left: none;
60
- border-right: solid 1px $divider-color;
61
- }
62
-
63
- .mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical {
64
- .mat-button-toggle + .mat-button-toggle {
65
- border-left: none;
66
- border-right: none;
67
- border-top: solid 1px $divider-color;
68
- }
69
- }
70
-
71
- .mat-button-toggle-checked {
72
- background-color: theming.get-color-from-palette($background, selected-button);
73
- color: theming.get-color-from-palette($foreground, secondary-text);
74
-
75
- &.mat-button-toggle-appearance-standard {
76
- color: theming.get-color-from-palette($foreground, text);
77
- }
78
- }
79
-
80
- .mat-button-toggle-disabled {
81
- color: theming.get-color-from-palette($foreground, disabled-button);
82
- background-color: theming.get-color-from-palette($background, disabled-button-toggle);
83
-
84
- &.mat-button-toggle-appearance-standard {
85
- background: theming.get-color-from-palette($background, card);
86
- }
87
-
88
- &.mat-button-toggle-checked {
89
- background-color: theming.get-color-from-palette($background, selected-disabled-button);
90
- }
91
- }
92
-
93
- .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
94
- .mat-button-toggle-group-appearance-standard {
95
- border: solid 1px $divider-color;
11
+ @include sass-utils.current-selector-or-root() {
12
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
13
+ tokens-mat-legacy-button-toggle.get-color-tokens($config));
14
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
15
+ tokens-mat-standard-button-toggle.get-color-tokens($config));
96
16
  }
97
17
  }
98
18
 
99
19
  @mixin typography($config-or-theme) {
100
20
  $config: typography.private-typography-to-2014-config(
101
21
  theming.get-typography-config($config-or-theme));
102
- .mat-button-toggle {
103
- font-family: typography-utils.font-family($config);
22
+
23
+ @include sass-utils.current-selector-or-root() {
24
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
25
+ tokens-mat-legacy-button-toggle.get-typography-tokens($config));
26
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
27
+ tokens-mat-standard-button-toggle.get-typography-tokens($config));
104
28
  }
105
29
  }
106
30
 
107
31
  @mixin density($config-or-theme) {
108
32
  $density-scale: theming.get-density-config($config-or-theme);
109
- $standard-height: compatibility.private-density-prop-value(
110
- button-toggle-variables.$standard-density-config, $density-scale, height);
111
33
 
112
- @include compatibility.private-density-legacy-compatibility() {
113
- .mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
114
- line-height: $standard-height;
115
- }
34
+ @include sass-utils.current-selector-or-root() {
35
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
36
+ tokens-mat-legacy-button-toggle.get-density-tokens($density-scale));
37
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
38
+ tokens-mat-standard-button-toggle.get-density-tokens($density-scale));
116
39
  }
117
40
  }
118
41
 
@@ -1,3 +1,5 @@
1
+ // TODO(crisbeto): this file isn't used anymore and should be removed.
2
+
1
3
  $standard-height: 48px !default;
2
4
  // Minimum height for highest density can vary based on the content that developers
3
5
  // project into button-toggle's. We use a minimum of `24px` though because commonly
@@ -42,7 +42,7 @@ $padding: checkbox-common.$border-width * 2;
42
42
  // `$box-size`: size of the checkbox.
43
43
  // `$border-size`: size of the checkbox's border.
44
44
  @mixin _checkbox-indeterminate-styles-with-size($box-size, $border-size) {
45
- // Center the line in the the checkbox. `$checkbox-common.$border-width` is the width of the line.
45
+ // Center the line in the checkbox. `$checkbox-common.$border-width` is the width of the line.
46
46
  top: math.div($box-size - checkbox-common.$border-width, 2) - $border-size;
47
47
  width: $box-size - checkbox-common.$border-width - (2 * $border-size);
48
48
  }
@@ -40,6 +40,7 @@ $placeholder-typography-config: (
40
40
  button: $_placeholder-typography-level-config,
41
41
  overline: $_placeholder-typography-level-config,
42
42
  subheading-1: $_placeholder-typography-level-config,
43
+ title: $_placeholder-typography-level-config,
43
44
  );
44
45
 
45
46
  // Placeholder density config that can be passed to token getter functions when generating token
@@ -0,0 +1,56 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, bottom-sheet);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ // TODO: will be necessary for M3.
15
+ container-shape: 4px,
16
+ );
17
+ }
18
+
19
+ // Tokens that can be configured through Angular Material's color theming API.
20
+ @function get-color-tokens($config) {
21
+ $foreground: map.get($config, foreground);
22
+ $background: map.get($config, background);
23
+
24
+ @return (
25
+ container-text-color: theming.get-color-from-palette($foreground, text),
26
+ container-background-color: theming.get-color-from-palette($background, dialog),
27
+ );
28
+ }
29
+
30
+ // Tokens that can be configured through Angular Material's typography theming API.
31
+ @function get-typography-tokens($config) {
32
+ @return (
33
+ container-text-font: typography-utils.font-family($config, body-1) or
34
+ typography-utils.font-family($config),
35
+ container-text-line-height: typography-utils.line-height($config, body-1),
36
+ container-text-size: typography-utils.font-size($config, body-1),
37
+ container-text-tracking: typography-utils.letter-spacing($config, body-1),
38
+ container-text-weight: typography-utils.font-weight($config, body-1),
39
+ );
40
+ }
41
+
42
+ // Tokens that can be configured through Angular Material's density theming API.
43
+ @function get-density-tokens($config) {
44
+ @return ();
45
+ }
46
+
47
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
48
+ // This is used to create token slots.
49
+ @function get-token-slots() {
50
+ @return sass-utils.deep-merge-all(
51
+ get-unthemable-tokens(),
52
+ get-color-tokens(token-utils.$placeholder-color-config),
53
+ get-typography-tokens(token-utils.$placeholder-typography-config),
54
+ get-density-tokens(token-utils.$placeholder-density-config)
55
+ );
56
+ }
@@ -0,0 +1,45 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../style/sass-utils';
5
+
6
+ // The prefix used to generate the fully qualified name for tokens in this file.
7
+ $prefix: (mat, divider);
8
+
9
+ // Tokens that can't be configured through Angular Material's current theming API,
10
+ // but may be in a future version of the theming API.
11
+ @function get-unthemable-tokens() {
12
+ @return (
13
+ width: 1px
14
+ );
15
+ }
16
+
17
+ // Tokens that can be configured through Angular Material's color theming API.
18
+ @function get-color-tokens($config) {
19
+ $foreground: map.get($config, foreground);
20
+
21
+ @return (
22
+ color: theming.get-color-from-palette($foreground, divider)
23
+ );
24
+ }
25
+
26
+ // Tokens that can be configured through Angular Material's typography theming API.
27
+ @function get-typography-tokens($config) {
28
+ @return ();
29
+ }
30
+
31
+ // Tokens that can be configured through Angular Material's density theming API.
32
+ @function get-density-tokens($config) {
33
+ @return ();
34
+ }
35
+
36
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
37
+ // This is used to create token slots.
38
+ @function get-token-slots() {
39
+ @return sass-utils.deep-merge-all(
40
+ get-unthemable-tokens(),
41
+ get-color-tokens(token-utils.$placeholder-color-config),
42
+ get-typography-tokens(token-utils.$placeholder-typography-config),
43
+ get-density-tokens(token-utils.$placeholder-density-config)
44
+ );
45
+ }
@@ -0,0 +1,46 @@
1
+ @use '../../token-utils';
2
+ @use '../../../typography/typography-utils';
3
+ @use '../../../style/sass-utils';
4
+
5
+ // The prefix used to generate the fully qualified name for tokens in this file.
6
+ $prefix: (mat, grid-list);
7
+
8
+ // Tokens that can't be configured through Angular Material's current theming API,
9
+ // but may be in a future version of the theming API.
10
+ @function get-unthemable-tokens() {
11
+ @return ();
12
+ }
13
+
14
+ // Tokens that can be configured through Angular Material's color theming API.
15
+ @function get-color-tokens($config) {
16
+ @return ();
17
+ }
18
+
19
+ // Tokens that can be configured through Angular Material's typography theming API.
20
+ @function get-typography-tokens($config) {
21
+ @return (
22
+ // TODO(crisbeto): other components have tokens for all typography dimensions.
23
+ // Here we only set the font size to maintain the same appearance as the pre-tokens
24
+ // theming API. Consider adding more tokens for letter spacing, font weight etc.
25
+ tile-header-primary-text-size: typography-utils.font-size($config, body-1),
26
+ tile-header-secondary-text-size: typography-utils.font-size($config, caption),
27
+ tile-footer-primary-text-size: typography-utils.font-size($config, body-1),
28
+ tile-footer-secondary-text-size: typography-utils.font-size($config, caption),
29
+ );
30
+ }
31
+
32
+ // Tokens that can be configured through Angular Material's density theming API.
33
+ @function get-density-tokens($config) {
34
+ @return ();
35
+ }
36
+
37
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
38
+ // This is used to create token slots.
39
+ @function get-token-slots() {
40
+ @return sass-utils.deep-merge-all(
41
+ get-unthemable-tokens(),
42
+ get-color-tokens(token-utils.$placeholder-color-config),
43
+ get-typography-tokens(token-utils.$placeholder-typography-config),
44
+ get-density-tokens(token-utils.$placeholder-density-config)
45
+ );
46
+ }
@@ -0,0 +1,63 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, legacy-button-toggle);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ height: 36px,
15
+ shape: 2px,
16
+ focus-state-layer-opacity: 1,
17
+ );
18
+ }
19
+
20
+ // Tokens that can be configured through Angular Material's color theming API.
21
+ @function get-color-tokens($config) {
22
+ $foreground: map.get($config, foreground);
23
+ $background: map.get($config, background);
24
+
25
+ @return (
26
+ text-color: theming.get-color-from-palette($foreground, hint-text),
27
+ state-layer-color: theming.get-color-from-palette($background, focused-button),
28
+ selected-state-text-color: theming.get-color-from-palette($foreground, secondary-text),
29
+ selected-state-background-color: theming.get-color-from-palette($background, selected-button),
30
+ disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
31
+ disabled-state-background-color:
32
+ theming.get-color-from-palette($background, disabled-button-toggle),
33
+ disabled-selected-state-background-color:
34
+ theming.get-color-from-palette($background, selected-disabled-button)
35
+ );
36
+ }
37
+
38
+ // Tokens that can be configured through Angular Material's typography theming API.
39
+ @function get-typography-tokens($config) {
40
+ @return (
41
+ // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
42
+ // letter spacing etc). The button toggle only has the font to match what it had in the
43
+ // old theming API and to reduce internal breakages. We should introduce more typography
44
+ // tokens at some point.
45
+ text-font: typography-utils.font-family($config),
46
+ );
47
+ }
48
+
49
+ // Tokens that can be configured through Angular Material's density theming API.
50
+ @function get-density-tokens($config) {
51
+ @return ();
52
+ }
53
+
54
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
55
+ // This is used to create token slots.
56
+ @function get-token-slots() {
57
+ @return sass-utils.deep-merge-all(
58
+ get-unthemable-tokens(),
59
+ get-color-tokens(token-utils.$placeholder-color-config),
60
+ get-typography-tokens(token-utils.$placeholder-typography-config),
61
+ get-density-tokens(token-utils.$placeholder-density-config)
62
+ );
63
+ }
@@ -0,0 +1,65 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use '../../token-utils';
5
+ @use '../../../theming/theming';
6
+ @use '../../../style/sass-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mat, sidenav);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ @function get-unthemable-tokens() {
14
+ @return (
15
+ // Currently zero, but it appears to be relevant for M3.
16
+ // See: https://m3.material.io/components/navigation-drawer/overview
17
+ container-shape: 0,
18
+ );
19
+ }
20
+
21
+ // Tokens that can be configured through Angular Material's color theming API.
22
+ @function get-color-tokens($config) {
23
+ $is-dark: map.get($config, is-dark);
24
+ $foreground: map.get($config, foreground);
25
+ $background: map.get($config, background);
26
+ $scrim-opacity: 0.6;
27
+ $scrim-color: theming.get-color-from-palette($background, card, $scrim-opacity);
28
+ $fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
29
+
30
+ @return (
31
+ container-divider-color: theming.get-color-from-palette($foreground, divider),
32
+ container-background-color: theming.get-color-from-palette($background, dialog),
33
+ container-text-color: theming.get-color-from-palette($foreground, text),
34
+ content-background-color: theming.get-color-from-palette($background, background),
35
+ content-text-color: theming.get-color-from-palette($foreground, text),
36
+
37
+ // We use invert() here to have the darken the background color expected to be used.
38
+ // If the background is light, we use a dark backdrop. If the background is dark, we
39
+ // use a light backdrop. If the value isn't a color, Sass will throw an error so we
40
+ // fall back to something generic.
41
+ scrim-color: if(meta.type-of($scrim-color) == color,
42
+ color.invert($scrim-color), $fallback-scrim-color),
43
+ );
44
+ }
45
+
46
+ // Tokens that can be configured through Angular Material's typography theming API.
47
+ @function get-typography-tokens($config) {
48
+ @return ();
49
+ }
50
+
51
+ // Tokens that can be configured through Angular Material's density theming API.
52
+ @function get-density-tokens($config) {
53
+ @return ();
54
+ }
55
+
56
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
57
+ // This is used to create token slots.
58
+ @function get-token-slots() {
59
+ @return sass-utils.deep-merge-all(
60
+ get-unthemable-tokens(),
61
+ get-color-tokens(token-utils.$placeholder-color-config),
62
+ get-typography-tokens(token-utils.$placeholder-typography-config),
63
+ get-density-tokens(token-utils.$placeholder-density-config)
64
+ );
65
+ }
@@ -0,0 +1,87 @@
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use '../../token-utils';
4
+ @use '../../../typography/typography-utils';
5
+ @use '../../../theming/theming';
6
+ @use '../../../style/sass-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mat, standard-button-toggle);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ @function get-unthemable-tokens() {
14
+ @return (
15
+ shape: 4px,
16
+ hover-state-layer-opacity: 0.04,
17
+ focus-state-layer-opacity: 0.12,
18
+ );
19
+ }
20
+
21
+ // Tokens that can be configured through Angular Material's color theming API.
22
+ @function get-color-tokens($config) {
23
+ $foreground: map.get($config, foreground);
24
+ $background: map.get($config, background);
25
+ $theme-divider-color: theming.get-color-from-palette($foreground, divider);
26
+
27
+ // By default the theme usually has an rgba color for the dividers, which can
28
+ // stack up with the background of a button toggle. This can cause the border
29
+ // of a selected toggle to look different from an deselected one. We use a solid
30
+ // color to ensure that the border always stays the same.
31
+ $divider-color: if(meta.type-of($theme-divider-color) == color,
32
+ theming.private-rgba-to-hex($theme-divider-color, map.get($background, card)),
33
+ $theme-divider-color
34
+ );
35
+
36
+ @return (
37
+ text-color: theming.get-color-from-palette($foreground, text),
38
+ background-color: theming.get-color-from-palette($background, card),
39
+ state-layer-color: theming.get-color-from-palette($background, focused-button, 1),
40
+ selected-state-background-color: theming.get-color-from-palette($background, selected-button),
41
+ selected-state-text-color: theming.get-color-from-palette($foreground, text),
42
+ disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
43
+ disabled-state-background-color: theming.get-color-from-palette($background, card),
44
+ disabled-selected-state-text-color: theming.get-color-from-palette($foreground, text),
45
+ disabled-selected-state-background-color:
46
+ theming.get-color-from-palette($background, selected-disabled-button),
47
+ divider-color: $divider-color,
48
+ );
49
+ }
50
+
51
+ // Tokens that can be configured through Angular Material's typography theming API.
52
+ @function get-typography-tokens($config) {
53
+ @return (
54
+ // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
55
+ // letter spacing etc). The button toggle only has the font to match what it had in the
56
+ // old theming API and to reduce internal breakages. We should introduce more typography
57
+ // tokens at some point.
58
+ text-font: typography-utils.font-family($config),
59
+ );
60
+ }
61
+
62
+ // Tokens that can be configured through Angular Material's density theming API.
63
+ @function get-density-tokens($config) {
64
+ $density-scale: theming.clamp-density($config, -4);
65
+ $size-scale: (
66
+ 0: 48px,
67
+ -1: 44px,
68
+ -2: 40px,
69
+ -3: 36px,
70
+ -4: 24px,
71
+ );
72
+
73
+ @return (
74
+ height: map.get($size-scale, $density-scale)
75
+ );
76
+ }
77
+
78
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
79
+ // This is used to create token slots.
80
+ @function get-token-slots() {
81
+ @return sass-utils.deep-merge-all(
82
+ get-unthemable-tokens(),
83
+ get-color-tokens(token-utils.$placeholder-color-config),
84
+ get-typography-tokens(token-utils.$placeholder-typography-config),
85
+ get-density-tokens(token-utils.$placeholder-density-config)
86
+ );
87
+ }