Skip to content

Commit 76a4268

Browse files
committed
refactor: fixes found from internal changes
1 parent 8fa372b commit 76a4268

File tree

2 files changed

+24
-33
lines changed

2 files changed

+24
-33
lines changed

src/material/core/tokens/_token-utils.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
#{map.keys($fallbacks-flattened)};
6363
}
6464

65-
$fallback: map.get($fallbacks-flattened, $token);
66-
@if (sass-utils.is-css-var-name($fallback)) {
67-
$fallback: _create-var($fallback, $fallback);
65+
$sys-fallback: map.get($fallbacks-flattened, $token);
66+
@if (sass-utils.is-css-var-name($sys-fallback)) {
67+
$sys-fallback: _create-var($sys-fallback, $fallback);
6868
}
6969

70-
@return _create-var(--mat-#{$token}, $fallback);
70+
@return _create-var(--mat-#{$token}, $sys-fallback);
7171
}
7272

7373
// Outputs a map of tokens.

src/material/dialog/dialog.scss

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ $mat-dialog-button-horizontal-margin: 8px !default;
1515
// Fixes b/323588333
1616
$mat-dialog-container-max-height: 95vh !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-
2318
$fallbacks: m3-dialog.get-tokens();
2419

2520
// Note that we disable fallback declarations, but we don't disable fallback
@@ -95,10 +90,10 @@ $fallbacks: m3-dialog.get-tokens();
9590
min-width: inherit;
9691
max-width: inherit;
9792

98-
box-shadow: token-utils.slot(dialog-container-elevation-shadow, $fallbacks, $_emit-fallbacks);
93+
box-shadow: token-utils.slot(dialog-container-elevation-shadow, $fallbacks, none);
9994

100-
border-radius: token-utils.slot(dialog-container-shape, $fallbacks, $_emit-fallbacks);
101-
background-color: token-utils.slot(dialog-container-color, $fallbacks, $_emit-fallbacks);
95+
border-radius: token-utils.slot(dialog-container-shape, $fallbacks, 4px);
96+
background-color: token-utils.slot(dialog-container-color, $fallbacks, white);
10297

10398
[dir='rtl'] & {
10499
text-align: right;
@@ -135,7 +130,7 @@ $fallbacks: m3-dialog.get-tokens();
135130
box-sizing: border-box;
136131
margin: 0 0 1px;
137132

138-
padding: token-utils.slot(dialog-headline-padding, $fallbacks, $_emit-fallbacks);
133+
padding: token-utils.slot(dialog-headline-padding, $fallbacks, 6px 24px 13px);
139134

140135
// This was used by MDC to set the text baseline. We should figure out a way to
141136
// remove it, because it can introduce unnecessary whitespace at the beginning
@@ -154,13 +149,12 @@ $fallbacks: m3-dialog.get-tokens();
154149

155150
// Nested to maintain the old specificity.
156151
.mat-mdc-dialog-container & {
157-
color: token-utils.slot(dialog-subhead-color, $fallbacks, $_emit-fallbacks);
158-
font-family: token-utils.slot(dialog-subhead-font,
159-
$fallbacks, if($_emit-fallbacks, inherit, null));
160-
line-height: token-utils.slot(dialog-subhead-line-height, $fallbacks, $_emit-fallbacks);
161-
font-size: token-utils.slot(dialog-subhead-size, $fallbacks, $_emit-fallbacks);
162-
font-weight: token-utils.slot(dialog-subhead-weight, $fallbacks, $_emit-fallbacks);
163-
letter-spacing: token-utils.slot(dialog-subhead-tracking, $fallbacks, $_emit-fallbacks);
152+
color: token-utils.slot(dialog-subhead-color, $fallbacks, rgba(0, 0, 0, 0.87));
153+
font-family: token-utils.slot(dialog-subhead-font, $fallbacks, inherit);
154+
line-height: token-utils.slot(dialog-subhead-line-height, $fallbacks, 1.5rem);
155+
font-size: token-utils.slot(dialog-subhead-size, $fallbacks, 1rem);
156+
font-weight: token-utils.slot(dialog-subhead-weight, $fallbacks, 400);
157+
letter-spacing: token-utils.slot(dialog-subhead-tracking, $fallbacks, 0.03125em);
164158
}
165159
}
166160

@@ -182,26 +176,23 @@ $fallbacks: m3-dialog.get-tokens();
182176

183177
// Nested to maintain the old specificity.
184178
.mat-mdc-dialog-container & {
185-
color: token-utils.slot(dialog-supporting-text-color, $fallbacks, $_emit-fallbacks);
186-
font-family: token-utils.slot(dialog-supporting-text-font,
187-
$fallbacks, if($_emit-fallbacks, inherit, null));
188-
line-height: token-utils.slot(dialog-supporting-text-line-height,
189-
$fallbacks, $_emit-fallbacks);
190-
font-size: token-utils.slot(dialog-supporting-text-size, $fallbacks, $_emit-fallbacks);
191-
font-weight: token-utils.slot(dialog-supporting-text-weight, $fallbacks, $_emit-fallbacks);
192-
letter-spacing: token-utils.slot(dialog-supporting-text-tracking,
193-
$fallbacks, $_emit-fallbacks);
179+
color: token-utils.slot(dialog-supporting-text-color, $fallbacks, rgba(0, 0, 0, 0.6));
180+
font-family: token-utils.slot(dialog-supporting-text-font, $fallbacks, inherit);
181+
line-height: token-utils.slot(dialog-supporting-text-line-height, $fallbacks, 1.5rem);
182+
font-size: token-utils.slot(dialog-supporting-text-size, $fallbacks, 1rem);
183+
font-weight: token-utils.slot(dialog-supporting-text-weight, $fallbacks, 400);
184+
letter-spacing: token-utils.slot(dialog-supporting-text-tracking, $fallbacks, 0.03125em);
194185
}
195186

196187
// These styles need a bit more specificity.
197188
.mat-mdc-dialog-container & {
198-
padding: token-utils.slot(dialog-content-padding, $fallbacks, $_emit-fallbacks);
189+
padding: token-utils.slot(dialog-content-padding, $fallbacks, 20px 24px 0);
199190
}
200191

201192
// Note: we can achieve this with a `:has` selector, but it results in an
202193
// increased specificity which breaks a lot of internal clients.
203194
.mat-mdc-dialog-container-with-actions & {
204-
padding: token-utils.slot(dialog-with-actions-content-padding, $fallbacks, $_emit-fallbacks);
195+
padding: token-utils.slot(dialog-with-actions-content-padding, $fallbacks, 20px 24px 0);
205196
}
206197

207198
.mat-mdc-dialog-container .mat-mdc-dialog-title + & {
@@ -222,8 +213,8 @@ $fallbacks: m3-dialog.get-tokens();
222213

223214
// For backwards compatibility, actions align at start by default. MDC usually
224215
// aligns actions at the end of the container.
225-
padding: token-utils.slot(dialog-actions-padding, $fallbacks, $_emit-fallbacks);
226-
justify-content: token-utils.slot(dialog-actions-alignment, $fallbacks, $_emit-fallbacks);
216+
padding: token-utils.slot(dialog-actions-padding, $fallbacks, 16px 24px);
217+
justify-content: token-utils.slot(dialog-actions-alignment, $fallbacks, flex-end);
227218

228219
@include cdk.high-contrast {
229220
border-top-color: CanvasText;

0 commit comments

Comments
 (0)