@angular/material 17.0.0-next.1 → 17.0.0-next.3

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 (119) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +19 -26
  4. package/badge/_badge-theme.scss +15 -27
  5. package/badge/index.d.ts +9 -17
  6. package/bottom-sheet/_bottom-sheet-theme.scss +13 -22
  7. package/button-toggle/_button-toggle-theme.scss +17 -28
  8. package/button-toggle/index.d.ts +15 -18
  9. package/checkbox/index.d.ts +21 -27
  10. package/chips/_chips-theme.scss +18 -56
  11. package/core/color/_all-color.scss +7 -15
  12. package/core/density/private/_all-density.scss +34 -39
  13. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  14. package/core/focus-indicators/_private.scss +22 -26
  15. package/core/index.d.ts +7 -11
  16. package/core/style/_form-common.scss +7 -7
  17. package/core/style/_private.scss +2 -4
  18. package/core/testing/index.d.ts +2 -1
  19. package/core/theming/_all-theme.scss +41 -41
  20. package/core/theming/_inspection.scss +47 -0
  21. package/core/theming/_m2-inspection.scss +57 -0
  22. package/core/theming/_theming.scss +0 -14
  23. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  24. package/core/tokens/m2/mat/_badge.scss +12 -15
  25. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  26. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  27. package/core/tokens/m2/mat/_divider.scss +5 -8
  28. package/core/tokens/m2/mat/_expansion.scss +24 -28
  29. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  30. package/core/tokens/m2/mat/_icon.scss +3 -3
  31. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  32. package/core/tokens/m2/mat/_menu.scss +12 -17
  33. package/core/tokens/m2/mat/_select.scss +15 -29
  34. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  35. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  36. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  37. package/core/tokens/m2/mat/_stepper.scss +30 -33
  38. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  39. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  40. package/core/tokens/m2/mat/_table.scss +19 -23
  41. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  42. package/core/tokens/m2/mdc/_chip.scss +38 -24
  43. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  44. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  45. package/core/tokens/m2/mdc/_icon-button.scss +2 -2
  46. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  47. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  48. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  49. package/core/tokens/m2/mdc/_tab.scss +5 -4
  50. package/core/typography/_all-typography.scss +44 -47
  51. package/core/typography/_typography.scss +32 -155
  52. package/core/typography/_versioning.scss +7 -2
  53. package/datepicker/_datepicker-theme.scss +20 -34
  54. package/dialog/_dialog-theme.scss +14 -25
  55. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  56. package/dialog/index.d.ts +2 -0
  57. package/divider/_divider-theme.scss +12 -18
  58. package/esm2022/autocomplete/autocomplete-trigger.mjs +13 -19
  59. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  60. package/esm2022/badge/badge.mjs +11 -29
  61. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  62. package/esm2022/checkbox/checkbox.mjs +32 -39
  63. package/esm2022/core/option/optgroup.mjs +10 -11
  64. package/esm2022/core/option/option.mjs +6 -6
  65. package/esm2022/core/testing/option-harness.mjs +3 -3
  66. package/esm2022/core/version.mjs +1 -1
  67. package/esm2022/dialog/dialog-container.mjs +16 -3
  68. package/esm2022/menu/menu-item.mjs +15 -11
  69. package/esm2022/menu/menu.mjs +9 -22
  70. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  71. package/esm2022/tabs/tab-group.mjs +3 -3
  72. package/expansion/_expansion-theme.scss +16 -24
  73. package/fesm2022/autocomplete.mjs +33 -65
  74. package/fesm2022/autocomplete.mjs.map +1 -1
  75. package/fesm2022/badge.mjs +11 -28
  76. package/fesm2022/badge.mjs.map +1 -1
  77. package/fesm2022/button-toggle.mjs +25 -32
  78. package/fesm2022/button-toggle.mjs.map +1 -1
  79. package/fesm2022/checkbox.mjs +31 -38
  80. package/fesm2022/checkbox.mjs.map +1 -1
  81. package/fesm2022/core/testing.mjs +2 -2
  82. package/fesm2022/core/testing.mjs.map +1 -1
  83. package/fesm2022/core.mjs +14 -13
  84. package/fesm2022/core.mjs.map +1 -1
  85. package/fesm2022/dialog.mjs +15 -2
  86. package/fesm2022/dialog.mjs.map +1 -1
  87. package/fesm2022/menu.mjs +23 -31
  88. package/fesm2022/menu.mjs.map +1 -1
  89. package/fesm2022/slide-toggle.mjs +33 -36
  90. package/fesm2022/slide-toggle.mjs.map +1 -1
  91. package/fesm2022/tabs.mjs +2 -2
  92. package/fesm2022/tabs.mjs.map +1 -1
  93. package/form-field/_form-field-sizing.scss +1 -1
  94. package/grid-list/_grid-list-theme.scss +12 -19
  95. package/icon/_icon-theme.scss +17 -25
  96. package/list/_list-theme.scss +1 -1
  97. package/menu/_menu-theme.scss +13 -22
  98. package/menu/index.d.ts +12 -18
  99. package/package.json +2 -2
  100. package/prebuilt-themes/deeppurple-amber.css +1 -1
  101. package/prebuilt-themes/indigo-pink.css +1 -1
  102. package/prebuilt-themes/pink-bluegrey.css +1 -1
  103. package/prebuilt-themes/purple-green.css +1 -1
  104. package/progress-spinner/_progress-spinner-theme.scss +16 -22
  105. package/schematics/ng-add/index.js +1 -1
  106. package/schematics/ng-add/index.mjs +1 -1
  107. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  108. package/select/_select-theme.scss +17 -31
  109. package/sidenav/_sidenav-theme.scss +12 -18
  110. package/slide-toggle/index.d.ts +20 -23
  111. package/snack-bar/_snack-bar-theme.scss +15 -24
  112. package/sort/_sort-theme.scss +13 -22
  113. package/stepper/_stepper-theme.scss +16 -34
  114. package/table/_table-theme.scss +14 -25
  115. package/tabs/_tabs-theme.scss +31 -45
  116. package/toolbar/_toolbar-theme.scss +22 -31
  117. package/tooltip/_tooltip-theme.scss +15 -23
  118. package/tree/_tree-theme.scss +20 -29
  119. package/core/typography/_typography-deprecated.scss +0 -39
@@ -35,17 +35,14 @@
35
35
  @use '../../snack-bar/snack-bar-theme';
36
36
  @use '../../form-field/form-field-theme';
37
37
  @use '../../tree/tree-theme';
38
- @use '../theming/theming';
38
+ @use '../theming/inspection';
39
39
  @use '../core-theme';
40
40
 
41
41
  // Includes all of the typographic styles.
42
- @mixin all-component-typographies($config-or-theme: null) {
43
- $config: if(theming.private-is-theme-object($config-or-theme),
44
- theming.get-typography-config($config-or-theme), $config-or-theme);
45
-
42
+ @mixin all-component-typographies($theme: null) {
46
43
  // If no actual color configuration has been specified, create a default one.
47
- @if not $config {
48
- $config: typography.define-typography-config();
44
+ @if not inspection.theme-has($theme, typography) {
45
+ $theme: typography.define-typography-config();
49
46
  }
50
47
 
51
48
  // TODO: COMP-309: Do not use individual mixins. Instead, use the all-theme mixin and only
@@ -53,47 +50,47 @@
53
50
  // not possible as it would introduce a circular dependency for typography because the `mat-core`
54
51
  // mixin that is transitively loaded by the `all-theme` file, imports `all-typography` which
55
52
  // would then load `all-theme` again. This ultimately results a circular dependency.
56
- @include badge-theme.typography($config);
57
- @include typography.typography-hierarchy($config);
58
- @include bottom-sheet-theme.typography($config);
59
- @include button-toggle-theme.typography($config);
60
- @include divider-theme.typography($config);
61
- @include datepicker-theme.typography($config);
62
- @include expansion-theme.typography($config);
63
- @include grid-list-theme.typography($config);
64
- @include icon-theme.typography($config);
65
- @include progress-spinner-theme.typography($config);
66
- @include sidenav-theme.typography($config);
67
- @include stepper-theme.typography($config);
68
- @include sort-theme.typography($config);
69
- @include toolbar-theme.typography($config);
70
- @include tree-theme.typography($config);
71
- @include core-theme.typography($config);
72
- @include card-theme.typography($config);
73
- @include progress-bar-theme.typography($config);
74
- @include tooltip-theme.typography($config);
75
- @include form-field-theme.typography($config);
76
- @include input-theme.typography($config);
77
- @include select-theme.typography($config);
78
- @include autocomplete-theme.typography($config);
79
- @include dialog-theme.typography($config);
80
- @include chips-theme.typography($config);
81
- @include slide-toggle-theme.typography($config);
82
- @include radio-theme.typography($config);
83
- @include slider-theme.typography($config);
84
- @include menu-theme.typography($config);
85
- @include list-theme.typography($config);
86
- @include paginator-theme.typography($config);
87
- @include tabs-theme.typography($config);
88
- @include checkbox-theme.typography($config);
89
- @include button-theme.typography($config);
90
- @include icon-button-theme.typography($config);
91
- @include fab-theme.typography($config);
92
- @include snack-bar-theme.typography($config);
93
- @include table-theme.typography($config);
53
+ @include badge-theme.typography($theme);
54
+ @include typography.typography-hierarchy($theme);
55
+ @include bottom-sheet-theme.typography($theme);
56
+ @include button-toggle-theme.typography($theme);
57
+ @include divider-theme.typography($theme);
58
+ @include datepicker-theme.typography($theme);
59
+ @include expansion-theme.typography($theme);
60
+ @include grid-list-theme.typography($theme);
61
+ @include icon-theme.typography($theme);
62
+ @include progress-spinner-theme.typography($theme);
63
+ @include sidenav-theme.typography($theme);
64
+ @include stepper-theme.typography($theme);
65
+ @include sort-theme.typography($theme);
66
+ @include toolbar-theme.typography($theme);
67
+ @include tree-theme.typography($theme);
68
+ @include core-theme.typography($theme);
69
+ @include card-theme.typography($theme);
70
+ @include progress-bar-theme.typography($theme);
71
+ @include tooltip-theme.typography($theme);
72
+ @include form-field-theme.typography($theme);
73
+ @include input-theme.typography($theme);
74
+ @include select-theme.typography($theme);
75
+ @include autocomplete-theme.typography($theme);
76
+ @include dialog-theme.typography($theme);
77
+ @include chips-theme.typography($theme);
78
+ @include slide-toggle-theme.typography($theme);
79
+ @include radio-theme.typography($theme);
80
+ @include slider-theme.typography($theme);
81
+ @include menu-theme.typography($theme);
82
+ @include list-theme.typography($theme);
83
+ @include paginator-theme.typography($theme);
84
+ @include tabs-theme.typography($theme);
85
+ @include checkbox-theme.typography($theme);
86
+ @include button-theme.typography($theme);
87
+ @include icon-button-theme.typography($theme);
88
+ @include fab-theme.typography($theme);
89
+ @include snack-bar-theme.typography($theme);
90
+ @include table-theme.typography($theme);
94
91
  }
95
92
 
96
93
  // @deprecated Use `all-component-typographies`.
97
- @mixin angular-material-typography($config-or-theme: null) {
98
- @include all-component-typographies($config-or-theme);
94
+ @mixin angular-material-typography($theme: null) {
95
+ @include all-component-typographies($theme);
99
96
  }
@@ -1,5 +1,5 @@
1
1
  @use 'typography-utils';
2
- @use '../theming/theming';
2
+ @use '../theming/inspection';
3
3
  @use './versioning';
4
4
 
5
5
  // Definition and versioning functions live in their own files to avoid circular dependencies, but
@@ -12,10 +12,7 @@
12
12
  /// @param {Map} $config-or-theme A typography config for an entire theme.
13
13
  /// @param {String} $selector Ancestor selector under which native elements, such as h1, will
14
14
  /// be styled.
15
- @mixin typography-hierarchy($config-or-theme, $selector: '.mat-typography') {
16
- $config: versioning.private-typography-to-2018-config(
17
- theming.get-typography-config($config-or-theme));
18
-
15
+ @mixin typography-hierarchy($theme, $selector: '.mat-typography') {
19
16
  // Note that it seems redundant to prefix the class rules with the `$selector`, however it's
20
17
  // necessary if we want to allow people to overwrite the tag selectors. This is due to
21
18
  // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`.
@@ -24,7 +21,8 @@
24
21
  #{$selector} .mat-h1,
25
22
  #{$selector} .mat-headline-5,
26
23
  #{$selector} h1 {
27
- @include typography-utils.typography-level($config, headline-5);
24
+ font: inspection.get-theme-typography($theme, headline-5, font);
25
+ letter-spacing: inspection.get-theme-typography($theme, headline-5, letter-spacing);
28
26
  margin: 0 0 16px;
29
27
  }
30
28
 
@@ -33,7 +31,8 @@
33
31
  #{$selector} .mat-h2,
34
32
  #{$selector} .mat-headline-6,
35
33
  #{$selector} h2 {
36
- @include typography-utils.typography-level($config, headline-6);
34
+ font: inspection.get-theme-typography($theme, headline-6, font);
35
+ letter-spacing: inspection.get-theme-typography($theme, headline-6, letter-spacing);
37
36
  margin: 0 0 16px;
38
37
  }
39
38
 
@@ -42,7 +41,8 @@
42
41
  #{$selector} .mat-h3,
43
42
  #{$selector} .mat-subtitle-1,
44
43
  #{$selector} h3 {
45
- @include typography-utils.typography-level($config, subtitle-1);
44
+ font: inspection.get-theme-typography($theme, subtitle-1, font);
45
+ letter-spacing: inspection.get-theme-typography($theme, subtitle-1, letter-spacing);
46
46
  margin: 0 0 16px;
47
47
  }
48
48
 
@@ -51,7 +51,8 @@
51
51
  #{$selector} .mat-h4,
52
52
  #{$selector} .mat-body-1,
53
53
  #{$selector} h4 {
54
- @include typography-utils.typography-level($config, body-1);
54
+ font: inspection.get-theme-typography($theme, body-1, font);
55
+ letter-spacing: inspection.get-theme-typography($theme, body-1, letter-spacing);
55
56
  margin: 0 0 16px;
56
57
  }
57
58
 
@@ -63,10 +64,10 @@
63
64
  #{$selector} h5 {
64
65
  @include typography-utils.font-shorthand(
65
66
  // calc is used here to support css variables
66
- calc(#{typography-utils.font-size($config, body-2)} * 0.83),
67
- typography-utils.font-weight($config, body-2),
68
- typography-utils.line-height($config, body-2),
69
- typography-utils.font-family($config, body-2)
67
+ calc(#{inspection.get-theme-typography($theme, body-2, font-size)} * 0.83),
68
+ inspection.get-theme-typography($theme, body-2, font-weight),
69
+ inspection.get-theme-typography($theme, body-2, line-height),
70
+ inspection.get-theme-typography($theme, body-2, font-family)
70
71
  );
71
72
 
72
73
  margin: 0 0 12px;
@@ -77,10 +78,10 @@
77
78
  #{$selector} h6 {
78
79
  @include typography-utils.font-shorthand(
79
80
  // calc is used here to support css variables
80
- calc(#{typography-utils.font-size($config, body-2)} * 0.67),
81
- typography-utils.font-weight($config, body-2),
82
- typography-utils.line-height($config, body-2),
83
- typography-utils.font-family($config, body-2)
81
+ calc(#{inspection.get-theme-typography($theme, body-2, font-size)} * 0.67),
82
+ inspection.get-theme-typography($theme, body-2, font-weight),
83
+ inspection.get-theme-typography($theme, body-2, line-height),
84
+ inspection.get-theme-typography($theme, body-2, font-family)
84
85
  );
85
86
 
86
87
  margin: 0 0 12px;
@@ -90,7 +91,8 @@
90
91
  .mat-subtitle-2,
91
92
  #{$selector} .mat-body-strong,
92
93
  #{$selector} .mat-subtitle-2 {
93
- @include typography-utils.typography-level($config, subtitle-2);
94
+ font: inspection.get-theme-typography($theme, subtitle-2, font);
95
+ letter-spacing: inspection.get-theme-typography($theme, subtitle-2, letter-spacing);
94
96
  }
95
97
 
96
98
  .mat-body,
@@ -98,7 +100,8 @@
98
100
  #{$selector} .mat-body,
99
101
  #{$selector} .mat-body-2,
100
102
  #{$selector} {
101
- @include typography-utils.typography-level($config, body-2);
103
+ font: inspection.get-theme-typography($theme, body-2, font);
104
+ letter-spacing: inspection.get-theme-typography($theme, body-2, letter-spacing);
102
105
 
103
106
  p {
104
107
  margin: 0 0 12px;
@@ -109,161 +112,35 @@
109
112
  .mat-caption,
110
113
  #{$selector} .mat-small,
111
114
  #{$selector} .mat-caption {
112
- @include typography-utils.typography-level($config, caption);
115
+ font: inspection.get-theme-typography($theme, caption, font);
116
+ letter-spacing: inspection.get-theme-typography($theme, caption, letter-spacing);
113
117
  }
114
118
 
115
119
  .mat-headline-1,
116
120
  #{$selector} .mat-headline-1 {
117
- @include typography-utils.typography-level($config, headline-1);
121
+ font: inspection.get-theme-typography($theme, headline-1, font);
122
+ letter-spacing: inspection.get-theme-typography($theme, headline-1, letter-spacing);
118
123
  margin: 0 0 56px;
119
124
  }
120
125
 
121
126
  .mat-headline-2,
122
127
  #{$selector} .mat-headline-2 {
123
- @include typography-utils.typography-level($config, headline-2);
128
+ font: inspection.get-theme-typography($theme, headline-2, font);
129
+ letter-spacing: inspection.get-theme-typography($theme, headline-2, letter-spacing);
124
130
  margin: 0 0 64px;
125
131
  }
126
132
 
127
133
  .mat-headline-3,
128
134
  #{$selector} .mat-headline-3 {
129
- @include typography-utils.typography-level($config, headline-3);
135
+ font: inspection.get-theme-typography($theme, headline-3, font);
136
+ letter-spacing: inspection.get-theme-typography($theme, headline-3, letter-spacing);
130
137
  margin: 0 0 64px;
131
138
  }
132
139
 
133
140
  .mat-headline-4,
134
141
  #{$selector} .mat-headline-4 {
135
- @include typography-utils.typography-level($config, headline-4);
136
- margin: 0 0 64px;
137
- }
138
- }
139
-
140
- /// Emits baseline typographic styles based on a given config.
141
- /// @param {Map} $config-or-theme A typography config for an entire theme.
142
- /// @param {String} $selector Ancestor selector under which native elements, such as h1, will
143
- /// be styled.
144
- /// @deprecated Use `mat.typography-hierarchy` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
145
- /// @breaking-change 17.0.0
146
- @mixin legacy-typography-hierarchy($config-or-theme, $selector: '.mat-typography') {
147
- $config: versioning.private-typography-to-2014-config(
148
- theming.get-typography-config($config-or-theme));
149
-
150
- // Note that it seems redundant to prefix the class rules with the `$selector`, however it's
151
- // necessary if we want to allow people to overwrite the tag selectors. This is due to
152
- // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`.
153
- .mat-h1,
154
- .mat-headline,
155
- #{$selector} .mat-h1,
156
- #{$selector} .mat-headline,
157
- #{$selector} h1 {
158
- @include typography-utils.typography-level($config, headline);
159
- margin: 0 0 16px;
160
- }
161
-
162
- .mat-h2,
163
- .mat-title,
164
- #{$selector} .mat-h2,
165
- #{$selector} .mat-title,
166
- #{$selector} h2 {
167
- @include typography-utils.typography-level($config, title);
168
- margin: 0 0 16px;
169
- }
170
-
171
- .mat-h3,
172
- .mat-subheading-2,
173
- #{$selector} .mat-h3,
174
- #{$selector} .mat-subheading-2,
175
- #{$selector} h3 {
176
- @include typography-utils.typography-level($config, subheading-2);
177
- margin: 0 0 16px;
178
- }
179
-
180
- .mat-h4,
181
- .mat-subheading-1,
182
- #{$selector} .mat-h4,
183
- #{$selector} .mat-subheading-1,
184
- #{$selector} h4 {
185
- @include typography-utils.typography-level($config, subheading-1);
186
- margin: 0 0 16px;
187
- }
188
-
189
- // Note: the spec doesn't have anything that would correspond to h5 and h6, but we add these for
190
- // consistency. The font sizes come from the Chrome user agent styles which have h5 at 0.83em
191
- // and h6 at 0.67em.
192
- .mat-h5,
193
- #{$selector} .mat-h5,
194
- #{$selector} h5 {
195
- @include typography-utils.font-shorthand(
196
- // calc is used here to support css variables
197
- calc(#{typography-utils.font-size($config, body-1)} * 0.83),
198
- typography-utils.font-weight($config, body-1),
199
- typography-utils.line-height($config, body-1),
200
- typography-utils.font-family($config, body-1)
201
- );
202
-
203
- margin: 0 0 12px;
204
- }
205
-
206
- .mat-h6,
207
- #{$selector} .mat-h6,
208
- #{$selector} h6 {
209
- @include typography-utils.font-shorthand(
210
- // calc is used here to support css variables
211
- calc(#{typography-utils.font-size($config, body-1)} * 0.67),
212
- typography-utils.font-weight($config, body-1),
213
- typography-utils.line-height($config, body-1),
214
- typography-utils.font-family($config, body-1)
215
- );
216
-
217
- margin: 0 0 12px;
218
- }
219
-
220
- .mat-body-strong,
221
- .mat-body-2,
222
- #{$selector} .mat-body-strong,
223
- #{$selector} .mat-body-2 {
224
- @include typography-utils.typography-level($config, body-2);
225
- }
226
-
227
- .mat-body,
228
- .mat-body-1,
229
- #{$selector} .mat-body,
230
- #{$selector} .mat-body-1,
231
- #{$selector} {
232
- @include typography-utils.typography-level($config, body-1);
233
-
234
- p {
235
- margin: 0 0 12px;
236
- }
237
- }
238
-
239
- .mat-small,
240
- .mat-caption,
241
- #{$selector} .mat-small,
242
- #{$selector} .mat-caption {
243
- @include typography-utils.typography-level($config, caption);
244
- }
245
-
246
- .mat-display-4,
247
- #{$selector} .mat-display-4 {
248
- @include typography-utils.typography-level($config, display-4);
249
- margin: 0 0 56px;
250
- }
251
-
252
- .mat-display-3,
253
- #{$selector} .mat-display-3 {
254
- @include typography-utils.typography-level($config, display-3);
255
- margin: 0 0 64px;
256
- }
257
-
258
- .mat-display-2,
259
- #{$selector} .mat-display-2 {
260
- @include typography-utils.typography-level($config, display-2);
261
- margin: 0 0 64px;
262
- }
263
-
264
- .mat-display-1,
265
- #{$selector} .mat-display-1 {
266
- @include typography-utils.typography-level($config, display-1);
142
+ font: inspection.get-theme-typography($theme, headline-4, font);
143
+ letter-spacing: inspection.get-theme-typography($theme, headline-4, letter-spacing);
267
144
  margin: 0 0 64px;
268
145
  }
269
146
  }
@@ -53,11 +53,16 @@
53
53
  // produces a normalized typography config for the 2018 Material Design typography system.
54
54
  // 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles
55
55
  // 2018 - https://material.io/design/typography/the-type-system.html#type-scale
56
- @function private-typography-to-2018-config($config) {
56
+ //
57
+ // The $force option is used to allow components to specify that they want to re-map the keys, even
58
+ // if the 2018 keys are already present. This allows those components to preserve the (incorrect)
59
+ // behavior they had previously, when they called `private-typography-to-2014-config`. Eventually we
60
+ // should clean this up, remove the $force option, and reconcile any screen diffs.
61
+ @function private-typography-to-2018-config($config, $force: false) {
57
62
  @if $config == null {
58
63
  @return null;
59
64
  }
60
- @if not private-typography-is-2018-config($config) {
65
+ @if $force or not private-typography-is-2018-config($config) {
61
66
  @return (
62
67
  headline-1: map.get($config, display-4),
63
68
  headline-2: map.get($config, display-3),
@@ -2,6 +2,7 @@
2
2
  @use 'sass:map';
3
3
  @use '../core/tokens/m2/mat/datepicker' as tokens-mat-datepicker;
4
4
  @use '../core/theming/theming';
5
+ @use '../core/theming/inspection';
5
6
  @use '../core/tokens/token-utils';
6
7
  @use '../core/style/sass-utils';
7
8
  @use '../core/typography/typography';
@@ -15,60 +16,52 @@ $today-fade-amount: 0.2;
15
16
  $calendar-body-font-size: 13px !default;
16
17
  $calendar-weekday-table-font-size: 11px !default;
17
18
 
18
- @mixin _calendar-color($config, $palette) {
19
- $palette-color: theming.get-color-from-palette(map.get($config, $palette));
19
+ @mixin _calendar-color($theme, $palette-name) {
20
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
20
21
  $range-color: tokens-mat-datepicker.private-get-range-background-color($palette-color);
21
22
  $range-tokens: tokens-mat-datepicker.get-range-color-tokens($range-color);
22
23
  $calendar-tokens:
23
- tokens-mat-datepicker.private-get-calendar-color-palette-color-tokens($config, $palette);
24
+ tokens-mat-datepicker.private-get-calendar-color-palette-color-tokens($theme, $palette-name);
24
25
 
25
26
  @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
26
27
  map.merge($calendar-tokens, $range-tokens));
27
28
  }
28
29
 
29
- @mixin color($config-or-theme) {
30
- $config: theming.get-color-config($config-or-theme);
31
- $foreground: map.get($config, foreground);
32
- $background: map.get($config, background);
33
- $disabled-color: theming.get-color-from-palette($foreground, disabled-text);
34
-
30
+ @mixin color($theme) {
35
31
  @include sass-utils.current-selector-or-root() {
36
32
  @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
37
- tokens-mat-datepicker.get-color-tokens($config));
33
+ tokens-mat-datepicker.get-color-tokens($theme));
38
34
  }
39
35
 
40
36
  .mat-datepicker-content {
41
37
  &.mat-accent {
42
- @include _calendar-color($config, accent);
38
+ @include _calendar-color($theme, accent);
43
39
  }
44
40
 
45
41
  &.mat-warn {
46
- @include _calendar-color($config, warn);
42
+ @include _calendar-color($theme, warn);
47
43
  }
48
44
  }
49
45
 
50
46
  .mat-datepicker-toggle-active {
51
47
  &.mat-accent {
52
48
  $accent-tokens:
53
- tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, accent);
49
+ tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($theme, accent);
54
50
  @include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $accent-tokens);
55
51
  }
56
52
 
57
53
  &.mat-warn {
58
54
  $warn-tokens:
59
- tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, warn);
55
+ tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($theme, warn);
60
56
  @include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $warn-tokens);
61
57
  }
62
58
  }
63
59
  }
64
60
 
65
- @mixin typography($config-or-theme) {
66
- $config: typography.private-typography-to-2014-config(
67
- theming.get-typography-config($config-or-theme));
68
-
61
+ @mixin typography($theme) {
69
62
  @include sass-utils.current-selector-or-root() {
70
63
  @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
71
- tokens-mat-datepicker.get-typography-tokens($config));
64
+ tokens-mat-datepicker.get-typography-tokens($theme));
72
65
  }
73
66
  }
74
67
 
@@ -90,9 +83,7 @@ $calendar-weekday-table-font-size: 11px !default;
90
83
  }
91
84
  }
92
85
 
93
- @mixin density($config-or-theme) {
94
- $density-scale: theming.get-density-config($config-or-theme);
95
-
86
+ @mixin density($theme) {
96
87
  // TODO(crisbeto): move this into the structural styles
97
88
  // once the icon button density is switched to tokens.
98
89
 
@@ -103,21 +94,16 @@ $calendar-weekday-table-font-size: 11px !default;
103
94
  }
104
95
  }
105
96
 
106
- @mixin theme($theme-or-color-config) {
107
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
97
+ @mixin theme($theme) {
108
98
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-datepicker') {
109
- $color: theming.get-color-config($theme);
110
- $density: theming.get-density-config($theme);
111
- $typography: theming.get-typography-config($theme);
112
-
113
- @if $color != null {
114
- @include color($color);
99
+ @if inspection.theme-has($theme, color) {
100
+ @include color($theme);
115
101
  }
116
- @if $density != null {
117
- @include density($density);
102
+ @if inspection.theme-has($theme, density) {
103
+ @include density($theme);
118
104
  }
119
- @if $typography != null {
120
- @include typography($typography);
105
+ @if inspection.theme-has($theme, typography) {
106
+ @include typography($theme);
121
107
  }
122
108
  }
123
109
  }
@@ -2,53 +2,42 @@
2
2
  @use '../core/style/sass-utils';
3
3
  @use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog;
4
4
  @use '../core/theming/theming';
5
+ @use '../core/theming/inspection';
5
6
  @use '../core/typography/typography';
6
7
 
7
8
 
8
- @mixin base($config-or-theme) {
9
+ @mixin base($theme) {
9
10
  // Add default values for tokens not related to color, typography, or density.
10
11
  @include sass-utils.current-selector-or-root() {
11
12
  @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens());
12
13
  }
13
14
  }
14
15
 
15
- @mixin color($config-or-theme) {
16
- $config: theming.get-color-config($config-or-theme);
17
-
16
+ @mixin color($theme) {
18
17
  .mat-mdc-dialog-container {
19
- @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($config));
18
+ @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($theme));
20
19
  }
21
20
  }
22
21
 
23
- @mixin typography($config-or-theme) {
24
- $config: typography.private-typography-to-2018-config(
25
- theming.get-typography-config($config-or-theme));
26
-
22
+ @mixin typography($theme) {
27
23
  .mat-mdc-dialog-container {
28
- @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($config));
24
+ @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($theme));
29
25
  }
30
26
  }
31
27
 
32
- @mixin density($config-or-theme) {
33
- $density-scale: theming.get-density-config($config-or-theme);
34
- }
28
+ @mixin density($theme) {}
35
29
 
36
- @mixin theme($theme-or-color-config) {
37
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
30
+ @mixin theme($theme) {
38
31
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') {
39
- $color: theming.get-color-config($theme);
40
- $density: theming.get-density-config($theme);
41
- $typography: theming.get-typography-config($theme);
42
-
43
32
  @include base($theme);
44
- @if $color != null {
45
- @include color($color);
33
+ @if inspection.theme-has($theme, color) {
34
+ @include color($theme);
46
35
  }
47
- @if $density != null {
48
- @include density($density);
36
+ @if inspection.theme-has($theme, density) {
37
+ @include density($theme);
49
38
  }
50
- @if $typography != null {
51
- @include typography($typography);
39
+ @if inspection.theme-has($theme, typography) {
40
+ @include typography($theme);
52
41
  }
53
42
  }
54
43
  }
@@ -38,19 +38,21 @@
38
38
  max-width: inherit;
39
39
  }
40
40
 
41
- // MDC by default sets the `surface` to `display: flex`. MDC does this in order to
42
- // be able to make the content scrollable while locking the title and actions. This
43
- // does not work in our dialog anyway because due to the content projection, arbitrary
44
- // components can be immediate children of the surface and make this a noop. If only
45
- // templates or DOM elements are projected, the flex display could cause unexpected
46
- // alignment issues as explained in our coding standards (see `CODING_STANDARDS.md`).
47
- // Additionally, the surface by default should expand based on the parent overlay
48
- // boundaries (so that boundaries for the overlay config are respected). The surface
49
- // by default would only expand based on its content.
50
41
  .mdc-dialog__surface {
51
- display: block;
52
42
  width: 100%;
53
43
  height: 100%;
54
44
  }
55
45
  }
46
+
47
+ // When a component is passed into the dialog, the host element interrupts
48
+ // the `display:flex` from affecting the dialog title, content, and
49
+ // actions. To fix this, we make the component host `display: contents` by
50
+ // marking its host with the `mat-mdc-dialog-component-host` class.
51
+ //
52
+ // Note that this problem does not exist when a template ref is used since
53
+ // the title, contents, and actions are then nested directly under the
54
+ // dialog surface.
55
+ .mat-mdc-dialog-component-host {
56
+ display: contents;
57
+ }
56
58
  }
package/dialog/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AnimationTriggerMetadata } from '@angular/animations';
2
2
  import { CdkDialogContainer } from '@angular/cdk/dialog';
3
3
  import { ComponentFactoryResolver } from '@angular/core';
4
+ import { ComponentPortal } from '@angular/cdk/portal';
4
5
  import { ComponentRef } from '@angular/core';
5
6
  import { ComponentType } from '@angular/cdk/overlay';
6
7
  import { DialogRef } from '@angular/cdk/dialog';
@@ -365,6 +366,7 @@ export declare class MatDialogContainer extends CdkDialogContainer<MatDialogConf
365
366
  */
366
367
  protected _openAnimationDone(totalTime: number): void;
367
368
  ngOnDestroy(): void;
369
+ attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
368
370
  static ɵfac: i0.ɵɵFactoryDeclaration<MatDialogContainer, [null, null, { optional: true; }, null, null, null, null, { optional: true; }, null]>;
369
371
  static ɵcmp: i0.ɵɵComponentDeclaration<MatDialogContainer, "mat-dialog-container", never, {}, {}, never, never, false, never>;
370
372
  }