@@ -15,6 +15,11 @@ $mat-dialog-content-max-height: 65vh !default;
1515// don't expose this value as variable.
1616$mat-dialog-button-horizontal-margin : 8px !default ;
1717
18+ // Whether to emit fallback values for the structural styles. Previously MDC was emitting
19+ // paddings in the static styles which meant that users would get them even if they didn't
20+ // include the `dialog-base`. Eventually we should clean up the usages of this flag.
21+ $_emit-fallbacks : true;
22+
1823// Note that we disable fallback declarations, but we don't disable fallback
1924// values, because there are a lot of internal apps that don't include a proper
2025// theme in their tests.
@@ -55,21 +60,31 @@ $mat-dialog-button-horizontal-margin: 8px !default;
5560 }
5661}
5762
63+ @mixin _use-mat-tokens {
64+ @include mdc-helpers .disable-mdc-fallback-declarations {
65+ @include token-utils .use-tokens (tokens-mat-dialog .$prefix ,
66+ tokens-mat-dialog .get-token-slots ()) {
67+ @content ;
68+ }
69+ }
70+ }
71+
5872// This needs extra specificity so it doesn't get overwritten by the CDK structural styles.
5973.cdk-overlay-pane.mat-mdc-dialog-panel {
60- @include token-utils . use-tokens ( tokens- mat-dialog . $prefix , tokens-mat-dialog . get-token-slots ()) {
61- @include token-utils .create-token-slot (max-width , container- max- width);
62- @include token-utils .create-token-slot (min-width , container- min- width);
74+ @include _use- mat-tokens {
75+ @include token-utils .create-token-slot (max-width , container- max- width, $_emit-fallbacks );
76+ @include token-utils .create-token-slot (min-width , container- min- width, $_emit-fallbacks );
6377
6478 @media (variables .$xsmall ) {
65- @include token-utils .create-token-slot (max-width , container- small- max- width);
79+ @include token-utils .create-token-slot (max-width , container- small- max- width,
80+ $_emit-fallbacks );
6681 }
6782 }
6883}
6984
7085.mat-mdc-dialog-title {
71- @include token-utils . use-tokens ( tokens- mat-dialog . $prefix , tokens-mat-dialog . get-token-slots ()) {
72- @include token-utils .create-token-slot (padding , headline- padding);
86+ @include _use- mat-tokens {
87+ @include token-utils .create-token-slot (padding , headline- padding, $_emit-fallbacks );
7388 }
7489}
7590
@@ -78,14 +93,17 @@ $mat-dialog-button-horizontal-margin: 8px !default;
7893.mat-mdc-dialog-content {
7994 display : block ;
8095
81- @include token-utils . use-tokens ( tokens- mat-dialog . $prefix , tokens-mat-dialog . get-token-slots ()) {
96+ @include _use- mat-tokens {
8297 // These styles need a bit more specificity.
8398 .mat-mdc-dialog-container & {
84- @include token-utils .create-token-slot (padding , content- padding);
99+ @include token-utils .create-token-slot (padding , content- padding, $_emit-fallbacks );
85100 }
86101
87- .mat-mdc-dialog-container :has (.mat-mdc-dialog-actions ) & {
88- @include token-utils .create-token-slot (padding , with- actions- content- padding);
102+ // Note: we can achieve this with a `:has` selector, but it results in an
103+ // increased specificity which breaks a lot of internal clients.
104+ .mat-mdc-dialog-container-with-actions & {
105+ @include token-utils .create-token-slot (padding , with- actions- content- padding,
106+ $_emit-fallbacks );
89107 }
90108 }
91109
@@ -97,9 +115,9 @@ $mat-dialog-button-horizontal-margin: 8px !default;
97115.mat-mdc-dialog-actions {
98116 // For backwards compatibility, actions align at start by default. MDC usually
99117 // aligns actions at the end of the container.
100- @include token-utils . use-tokens ( tokens- mat-dialog . $prefix , tokens-mat-dialog . get-token-slots ()) {
101- @include token-utils .create-token-slot (padding , actions- padding);
102- @include token-utils .create-token-slot (justify-content , actions- alignment);
118+ @include _use- mat-tokens {
119+ @include token-utils .create-token-slot (padding , actions- padding, $_emit-fallbacks );
120+ @include token-utils .create-token-slot (justify-content , actions- alignment, $_emit-fallbacks );
103121 }
104122
105123 // .mat-mdc-dialog-actions-align-{start|center|end} are set by directive input "align"
0 commit comments