@angular/material 17.0.0-next.0 → 17.0.0-next.2

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 (204) hide show
  1. package/_index.scss +3 -4
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +15 -24
  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/_button-base.scss +3 -3
  8. package/button/_button-theme-private.scss +3 -2
  9. package/button/_button-theme.scss +18 -25
  10. package/button/_fab-theme.scss +31 -49
  11. package/button/_icon-button-theme.scss +19 -26
  12. package/button/index.d.ts +22 -31
  13. package/button-toggle/_button-toggle-theme.scss +17 -28
  14. package/button-toggle/index.d.ts +15 -18
  15. package/card/_card-theme.scss +27 -38
  16. package/checkbox/_checkbox-theme.scss +28 -45
  17. package/checkbox/index.d.ts +21 -27
  18. package/chips/_chips-theme.scss +18 -56
  19. package/core/_core-theme.scss +24 -39
  20. package/core/color/_all-color.scss +7 -15
  21. package/core/density/private/_all-density.scss +34 -39
  22. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  23. package/core/focus-indicators/_private.scss +22 -26
  24. package/core/index.d.ts +7 -11
  25. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  26. package/core/option/_optgroup-theme.scss +13 -23
  27. package/core/option/_option-theme.scss +23 -37
  28. package/core/ripple/_ripple-theme.scss +6 -10
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  30. package/core/style/_form-common.scss +7 -7
  31. package/core/style/_private.scss +5 -7
  32. package/core/style/_sass-utils.scss +7 -0
  33. package/core/testing/index.d.ts +2 -1
  34. package/core/theming/_all-theme.scss +41 -41
  35. package/core/theming/_inspection.scss +133 -59
  36. package/core/theming/_m2-inspection.scss +268 -0
  37. package/core/theming/_theming.scss +59 -20
  38. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  39. package/core/tokens/m2/mat/_badge.scss +12 -15
  40. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  41. package/core/tokens/m2/mat/_card.scss +15 -21
  42. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  43. package/core/tokens/m2/mat/_divider.scss +5 -8
  44. package/core/tokens/m2/mat/_expansion.scss +24 -28
  45. package/core/tokens/m2/mat/_form-field.scss +21 -25
  46. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  47. package/core/tokens/m2/mat/_icon.scss +3 -3
  48. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  49. package/core/tokens/m2/mat/_menu.scss +12 -17
  50. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  51. package/core/tokens/m2/mat/_option.scss +16 -28
  52. package/core/tokens/m2/mat/_paginator.scss +16 -18
  53. package/core/tokens/m2/mat/_radio.scss +7 -10
  54. package/core/tokens/m2/mat/_select.scss +15 -29
  55. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  56. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  57. package/core/tokens/m2/mat/_slider.scss +5 -5
  58. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  59. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  60. package/core/tokens/m2/mat/_stepper.scss +30 -33
  61. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  62. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  63. package/core/tokens/m2/mat/_table.scss +19 -23
  64. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  65. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  66. package/core/tokens/m2/mdc/_chip.scss +38 -24
  67. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  68. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  69. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  70. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  71. package/core/tokens/m2/mdc/_fab.scss +6 -7
  72. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  73. package/core/tokens/m2/mdc/_icon-button.scss +3 -3
  74. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  75. package/core/tokens/m2/mdc/_list.scss +44 -42
  76. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  77. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  78. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  79. package/core/tokens/m2/mdc/_radio.scss +11 -11
  80. package/core/tokens/m2/mdc/_slider.scss +16 -23
  81. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  82. package/core/tokens/m2/mdc/_switch.scss +16 -19
  83. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  84. package/core/tokens/m2/mdc/_tab.scss +5 -4
  85. package/core/typography/_all-typography.scss +44 -47
  86. package/core/typography/_definition.scss +258 -0
  87. package/core/typography/_property-getters.scss +63 -0
  88. package/core/typography/_typography-utils.scss +9 -69
  89. package/core/typography/_typography.scss +38 -494
  90. package/core/typography/_versioning.scss +91 -0
  91. package/datepicker/_datepicker-theme.scss +20 -34
  92. package/datepicker/index.d.ts +3 -3
  93. package/dialog/_dialog-theme.scss +22 -23
  94. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  95. package/dialog/index.d.ts +2 -0
  96. package/divider/_divider-theme.scss +12 -18
  97. package/esm2022/autocomplete/autocomplete-trigger.mjs +5 -17
  98. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  99. package/esm2022/badge/badge.mjs +11 -29
  100. package/esm2022/button/button-base.mjs +32 -27
  101. package/esm2022/button/button.mjs +6 -6
  102. package/esm2022/button/fab.mjs +23 -31
  103. package/esm2022/button/icon-button.mjs +6 -6
  104. package/esm2022/button/testing/button-harness.mjs +3 -3
  105. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  106. package/esm2022/checkbox/checkbox.mjs +32 -39
  107. package/esm2022/core/option/optgroup.mjs +10 -11
  108. package/esm2022/core/option/option.mjs +6 -6
  109. package/esm2022/core/testing/option-harness.mjs +3 -3
  110. package/esm2022/core/version.mjs +1 -1
  111. package/esm2022/datepicker/calendar.mjs +1 -1
  112. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  113. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  114. package/esm2022/datepicker/month-view.mjs +2 -2
  115. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  116. package/esm2022/datepicker/year-view.mjs +2 -2
  117. package/esm2022/dialog/dialog-container.mjs +16 -3
  118. package/esm2022/form-field/form-field.mjs +3 -3
  119. package/esm2022/menu/menu-item.mjs +15 -11
  120. package/esm2022/menu/menu.mjs +9 -22
  121. package/esm2022/paginator/paginator.mjs +1 -1
  122. package/esm2022/select/select.mjs +3 -3
  123. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  124. package/esm2022/slider/slider-input.mjs +19 -9
  125. package/esm2022/slider/slider.mjs +2 -2
  126. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  127. package/esm2022/tabs/tab-group.mjs +3 -3
  128. package/expansion/_expansion-theme.scss +16 -24
  129. package/fesm2022/autocomplete.mjs +25 -63
  130. package/fesm2022/autocomplete.mjs.map +1 -1
  131. package/fesm2022/badge.mjs +11 -28
  132. package/fesm2022/badge.mjs.map +1 -1
  133. package/fesm2022/button/testing.mjs +2 -2
  134. package/fesm2022/button/testing.mjs.map +1 -1
  135. package/fesm2022/button-toggle.mjs +25 -32
  136. package/fesm2022/button-toggle.mjs.map +1 -1
  137. package/fesm2022/button.mjs +59 -61
  138. package/fesm2022/button.mjs.map +1 -1
  139. package/fesm2022/checkbox.mjs +31 -38
  140. package/fesm2022/checkbox.mjs.map +1 -1
  141. package/fesm2022/core/testing.mjs +2 -2
  142. package/fesm2022/core/testing.mjs.map +1 -1
  143. package/fesm2022/core.mjs +14 -13
  144. package/fesm2022/core.mjs.map +1 -1
  145. package/fesm2022/datepicker.mjs +6 -6
  146. package/fesm2022/datepicker.mjs.map +1 -1
  147. package/fesm2022/dialog.mjs +15 -2
  148. package/fesm2022/dialog.mjs.map +1 -1
  149. package/fesm2022/form-field.mjs +2 -2
  150. package/fesm2022/form-field.mjs.map +1 -1
  151. package/fesm2022/menu.mjs +23 -31
  152. package/fesm2022/menu.mjs.map +1 -1
  153. package/fesm2022/paginator.mjs +1 -1
  154. package/fesm2022/paginator.mjs.map +1 -1
  155. package/fesm2022/select.mjs +2 -2
  156. package/fesm2022/select.mjs.map +1 -1
  157. package/fesm2022/slide-toggle.mjs +33 -36
  158. package/fesm2022/slide-toggle.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +20 -10
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar.mjs +1 -1
  162. package/fesm2022/snack-bar.mjs.map +1 -1
  163. package/fesm2022/tabs.mjs +2 -2
  164. package/fesm2022/tabs.mjs.map +1 -1
  165. package/form-field/_form-field-density.scss +3 -4
  166. package/form-field/_form-field-focus-overlay.scss +1 -1
  167. package/form-field/_form-field-sizing.scss +1 -1
  168. package/form-field/_form-field-theme.scss +24 -34
  169. package/grid-list/_grid-list-theme.scss +12 -19
  170. package/icon/_icon-theme.scss +17 -25
  171. package/input/_input-theme.scss +11 -23
  172. package/list/_list-theme.scss +27 -42
  173. package/menu/_menu-theme.scss +13 -22
  174. package/menu/index.d.ts +12 -18
  175. package/package.json +2 -2
  176. package/paginator/_paginator-theme.scss +15 -24
  177. package/prebuilt-themes/deeppurple-amber.css +1 -1
  178. package/prebuilt-themes/indigo-pink.css +1 -1
  179. package/prebuilt-themes/pink-bluegrey.css +1 -1
  180. package/prebuilt-themes/purple-green.css +1 -1
  181. package/progress-bar/_progress-bar-theme.scss +17 -24
  182. package/progress-spinner/_progress-spinner-theme.scss +18 -24
  183. package/radio/_radio-theme.scss +23 -38
  184. package/schematics/ng-add/index.js +1 -1
  185. package/schematics/ng-add/index.mjs +1 -1
  186. package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
  187. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  188. package/schematics/ng-update/index_bundled.js +25 -25
  189. package/select/_select-theme.scss +17 -31
  190. package/sidenav/_sidenav-theme.scss +12 -18
  191. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  192. package/slide-toggle/index.d.ts +20 -23
  193. package/slider/_slider-theme.scss +25 -42
  194. package/snack-bar/_snack-bar-theme.scss +17 -26
  195. package/sort/_sort-theme.scss +13 -22
  196. package/stepper/_stepper-theme.scss +16 -34
  197. package/table/_table-theme.scss +14 -25
  198. package/tabs/_tabs-theme.scss +31 -45
  199. package/toolbar/_toolbar-theme.scss +22 -31
  200. package/tooltip/_tooltip-theme.scss +15 -23
  201. package/tree/_tree-theme.scss +20 -29
  202. package/button-toggle/_button-toggle-variables.scss +0 -16
  203. package/core/typography/_typography-deprecated.scss +0 -39
  204. package/paginator/_paginator-variables.scss +0 -15
@@ -0,0 +1,91 @@
1
+ @use 'sass:map';
2
+ @use './definition';
3
+
4
+ // Whether a config is for the Material Design 2018 typography system.
5
+ @function private-typography-is-2018-config($config) {
6
+ @return map.get($config, headline-1) != null;
7
+ }
8
+
9
+ // Whether a config is for the Material Design 2014 typography system.
10
+ @function private-typography-is-2014-config($config) {
11
+ @return map.get($config, headline) != null;
12
+ }
13
+
14
+ // Given a config for either the 2014 or 2018 Material Design typography system,
15
+ // produces a normalized typography config for the 2014 Material Design typography system.
16
+ // 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles
17
+ // 2018 - https://material.io/design/typography/the-type-system.html#type-scale
18
+ //
19
+ // Components using this function should be migrated to normalize to the 2018 style config instead.
20
+ // New components should not use this function.
21
+ @function private-typography-to-2014-config($config) {
22
+ @if $config == null {
23
+ @return null;
24
+ }
25
+ @if not private-typography-is-2014-config($config) {
26
+ $args: (
27
+ display-4: map.get($config, headline-1),
28
+ display-3: map.get($config, headline-2),
29
+ display-2: map.get($config, headline-3),
30
+ display-1: map.get($config, headline-4),
31
+ headline: map.get($config, headline-5),
32
+ title: map.get($config, headline-6),
33
+ subheading-2: map.get($config, subtitle-1),
34
+ subheading-1: map.get($config, subtitle-2),
35
+ body-2: map.get($config, body-1),
36
+ body-1: map.get($config, body-2),
37
+ button: map.get($config, button),
38
+ caption: map.get($config, caption),
39
+ font-family: map.get($config, font-family),
40
+ );
41
+ $non-null-args: ();
42
+ @each $key, $value in $args {
43
+ @if $value != null {
44
+ $non-null-args: map.merge($non-null-args, ($key: $value));
45
+ }
46
+ }
47
+ @return definition.define-legacy-typography-config($non-null-args...);
48
+ }
49
+ @return $config;
50
+ }
51
+
52
+ // Given a config for either the 2014 or 2018 Material Design typography system,
53
+ // produces a normalized typography config for the 2018 Material Design typography system.
54
+ // 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles
55
+ // 2018 - https://material.io/design/typography/the-type-system.html#type-scale
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) {
62
+ @if $config == null {
63
+ @return null;
64
+ }
65
+ @if $force or not private-typography-is-2018-config($config) {
66
+ @return (
67
+ headline-1: map.get($config, display-4),
68
+ headline-2: map.get($config, display-3),
69
+ headline-3: map.get($config, display-2),
70
+ headline-4: map.get($config, display-1),
71
+ headline-5: map.get($config, headline),
72
+ headline-6: map.get($config, title),
73
+ subtitle-1: map.get($config, subheading-2),
74
+ font-famiy: map.get($config, font-family),
75
+
76
+ // These mappings are odd, but body-2 in the 2014 system actually looks closer to subtitle-2
77
+ // in the 2018 system, and subeading-1 in the 2014 system looks more like body-1 in the 2018
78
+ // system.
79
+ subtitle-2: map.get($config, body-2),
80
+ body-1: map.get($config, subheading-1),
81
+
82
+ body-2: map.get($config, body-1),
83
+ button: map.get($config, button),
84
+ caption: map.get($config, caption),
85
+ overline: if(map.get($config, overline), map.get($config, overline),
86
+ definition.define-typography-level(12px, 32px, 500)
87
+ )
88
+ );
89
+ }
90
+ @return $config;
91
+ }
@@ -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
  }
@@ -1594,7 +1594,7 @@ export declare class MatMonthView<D> implements AfterContentInit, OnChanges, OnD
1594
1594
  /** Handles when a new date is selected. */
1595
1595
  _dateSelected(event: MatCalendarUserEvent<number>): void;
1596
1596
  /**
1597
- * Takes the index of a calendar body cell wrapped in in an event as argument. For the date that
1597
+ * Takes the index of a calendar body cell wrapped in an event as argument. For the date that
1598
1598
  * corresponds to the given cell, set `activeDate` to that date and fire `activeDateChange` with
1599
1599
  * that date.
1600
1600
  *
@@ -1706,7 +1706,7 @@ export declare class MatMultiYearView<D> implements AfterContentInit, OnDestroy
1706
1706
  /** Handles when a new year is selected. */
1707
1707
  _yearSelected(event: MatCalendarUserEvent<number>): void;
1708
1708
  /**
1709
- * Takes the index of a calendar body cell wrapped in in an event as argument. For the date that
1709
+ * Takes the index of a calendar body cell wrapped in an event as argument. For the date that
1710
1710
  * corresponds to the given cell, set `activeDate` to that date and fire `activeDateChange` with
1711
1711
  * that date.
1712
1712
  *
@@ -1863,7 +1863,7 @@ export declare class MatYearView<D> implements AfterContentInit, OnDestroy {
1863
1863
  /** Handles when a new month is selected. */
1864
1864
  _monthSelected(event: MatCalendarUserEvent<number>): void;
1865
1865
  /**
1866
- * Takes the index of a calendar body cell wrapped in in an event as argument. For the date that
1866
+ * Takes the index of a calendar body cell wrapped in an event as argument. For the date that
1867
1867
  * corresponds to the given cell, set `activeDate` to that date and fire `activeDateChange` with
1868
1868
  * that date.
1869
1869
  *
@@ -1,44 +1,43 @@
1
1
  @use '@material/dialog/dialog-theme' as mdc-dialog-theme;
2
+ @use '../core/style/sass-utils';
2
3
  @use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog;
3
4
  @use '../core/theming/theming';
5
+ @use '../core/theming/inspection';
4
6
  @use '../core/typography/typography';
5
7
 
6
- @mixin color($config-or-theme) {
7
- $config: theming.get-color-config($config-or-theme);
8
8
 
9
- .mat-mdc-dialog-container {
10
- @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($config));
9
+ @mixin base($theme) {
10
+ // Add default values for tokens not related to color, typography, or density.
11
+ @include sass-utils.current-selector-or-root() {
12
+ @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens());
11
13
  }
12
14
  }
13
15
 
14
- @mixin typography($config-or-theme) {
15
- $config: typography.private-typography-to-2018-config(
16
- theming.get-typography-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-typography-tokens($config));
18
+ @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($theme));
20
19
  }
21
20
  }
22
21
 
23
- @mixin density($config-or-theme) {
24
- $density-scale: theming.get-density-config($config-or-theme);
22
+ @mixin typography($theme) {
23
+ .mat-mdc-dialog-container {
24
+ @include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($theme));
25
+ }
25
26
  }
26
27
 
27
- @mixin theme($theme-or-color-config) {
28
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
29
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') {
30
- $color: theming.get-color-config($theme);
31
- $density: theming.get-density-config($theme);
32
- $typography: theming.get-typography-config($theme);
28
+ @mixin density($theme) {}
33
29
 
34
- @if $color != null {
35
- @include color($color);
30
+ @mixin theme($theme) {
31
+ @include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') {
32
+ @include base($theme);
33
+ @if inspection.theme-has($theme, color) {
34
+ @include color($theme);
36
35
  }
37
- @if $density != null {
38
- @include density($density);
36
+ @if inspection.theme-has($theme, density) {
37
+ @include density($theme);
39
38
  }
40
- @if $typography != null {
41
- @include typography($typography);
39
+ @if inspection.theme-has($theme, typography) {
40
+ @include typography($theme);
42
41
  }
43
42
  }
44
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
  }
@@ -1,36 +1,30 @@
1
1
  @use '../core/style/sass-utils';
2
2
  @use '../core/theming/theming';
3
+ @use '../core/theming/inspection';
3
4
  @use '../core/tokens/token-utils';
4
5
  @use '../core/tokens/m2/mat/divider' as tokens-mat-divider;
5
6
 
6
- @mixin color($config-or-theme) {
7
- $config: theming.get-color-config($config-or-theme);
8
-
7
+ @mixin color($theme) {
9
8
  @include sass-utils.current-selector-or-root() {
10
9
  @include token-utils.create-token-values(tokens-mat-divider.$prefix,
11
- tokens-mat-divider.get-color-tokens($config));
10
+ tokens-mat-divider.get-color-tokens($theme));
12
11
  }
13
12
  }
14
13
 
15
- @mixin typography($config-or-theme) {}
14
+ @mixin typography($theme) {}
16
15
 
17
- @mixin density($config-or-theme) {}
16
+ @mixin density($theme) {}
18
17
 
19
- @mixin theme($theme-or-color-config) {
20
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
18
+ @mixin theme($theme) {
21
19
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-divider') {
22
- $color: theming.get-color-config($theme);
23
- $density: theming.get-density-config($theme);
24
- $typography: theming.get-typography-config($theme);
25
-
26
- @if $color != null {
27
- @include color($color);
20
+ @if inspection.theme-has($theme, color) {
21
+ @include color($theme);
28
22
  }
29
- @if $density != null {
30
- @include density($density);
23
+ @if inspection.theme-has($theme, density) {
24
+ @include density($theme);
31
25
  }
32
- @if $typography != null {
33
- @include typography($typography);
26
+ @if inspection.theme-has($theme, typography) {
27
+ @include typography($theme);
34
28
  }
35
29
  }
36
30
  }