Skip to content

Commit 15923a8

Browse files
committed
refactor: update density
1 parent 4569a81 commit 15923a8

File tree

3 files changed

+24
-49
lines changed

3 files changed

+24
-49
lines changed

src/material/button/_m2-button.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,23 @@ $prefix: (mat, button);
148148
filled-ripple-color: $ripple-color,
149149
filled-state-layer-color: $state-layer-color,
150150
outlined-label-text-color: inspection.get-theme-color($theme, $palette-name, default),
151-
outlined-outline-color: map.get(get-color-tokens($theme), outline-color),
151+
outlined-outline-color: map.get(get-color-tokens($theme), outlined-outline-color),
152152
outlined-ripple-color:
153-
if(meta.type-of($color) == color,
154-
rgba($color, $ripple-opacity),
153+
if(
154+
meta.type-of(inspection.get-theme-color($theme, $palette-name)) == color,
155+
rgba(inspection.get-theme-color($theme, $palette-name), $ripple-opacity),
155156
inspection.get-theme-color($theme, foreground, base, $ripple-opacity)),
156-
outlined-state-layer-color: $color,
157+
outlined-state-layer-color: inspection.get-theme-color($theme, $palette-name),
157158
protected-container-color: $container-color,
158159
protected-label-text-color: $label-text-color,
159160
protected-ripple-color: $ripple-color,
160161
protected-state-layer-color: $state-layer-color,
161162
text-label-text-color: inspection.get-theme-color($theme, $palette-name),
162163
text-ripple-color:
163-
if(meta.type-of($color) == color,
164-
rgba($color, $ripple-opacity),
164+
if(meta.type-of(inspection.get-theme-color($theme, $palette-name)) == color,
165+
rgba(inspection.get-theme-color($theme, $palette-name), $ripple-opacity),
165166
inspection.get-theme-color($theme, foreground, base, $ripple-opacity)),
166-
text-state-layer-color: $color,
167+
text-state-layer-color: inspection.get-theme-color($theme, $palette-name),
167168
tonal-container-color: inspection.get-theme-color($theme, $palette-name, default),
168169
tonal-label-text-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 1),
169170
tonal-ripple-color: inspection.get-theme-color($theme, $palette-name, default-contrast, 0.1),

src/material/core/tokens/_density.scss

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,32 @@ $_density-tokens: (
3030
(mat, datepicker): (),
3131
(mat, dialog): (),
3232
(mat, divider): (),
33-
(mat, card-elevated): (),
3433
(mat, expansion): (
3534
header-collapsed-state-height: (48px, 44px, 40px, 36px),
3635
header-expanded-state-height: (64px, 60px, 56px, 48px),
3736
),
38-
(mat, fab-extended): (),
3937
(mat, fab): (
4038
touch-target-display: (block, block, none, none),
4139
),
42-
(mat, fab-small): (),
43-
(mat, button-filled): (
44-
touch-target-display: (block, block, none, none),
45-
container-height: (40px, 36px, 32px, 28px),
40+
(mat, button): (
41+
filled-touch-target-display: (block, block, none, none),
42+
filled-container-height: (40px, 36px, 32px, 28px),
43+
outlined-container-height: (40px, 36px, 32px, 28px),
44+
outlined-touch-target-display: (block, block, none, none),
45+
protected-touch-target-display: (block, block, none, none),
46+
protected-container-height: (40px, 36px, 32px, 28px),
47+
text-touch-target-display: (block, block, none, none),
48+
text-container-height: (40px, 36px, 32px, 28px),
49+
tonal-container-height: (40px, 36px, 32px, 28px),
50+
tonal-touch-target-display: (block, block, none, none),
4651
),
47-
(mat, form-field-filled): (),
4852
(mat, form-field): (
4953
container-height: (56px, 52px, 48px, 44px, 40px, 36px),
5054
filled-label-display: (block, block, none, none, none, none),
5155
container-vertical-padding: (16px, 14px, 12px, 10px, 8px, 6px),
5256
filled-with-label-container-padding-top: (24px, 22px, 12px, 10px, 8px, 6px),
5357
filled-with-label-container-padding-bottom: (8px, 6px, 12px, 10px, 8px, 6px),
5458
),
55-
(mat, pseudo-checkbox-full): (),
5659
(mat, grid-list): (),
5760
(mat, icon): (),
5861
(mat, icon-button): (
@@ -69,26 +72,15 @@ $_density-tokens: (
6972
list-item-three-line-container-height: (88px, 84px, 80px, 76px, 72px, 56px),
7073
),
7174
(mat, menu): (),
72-
(mat, pseudo-checkbox-minimal): (),
7375
(mat, optgroup): (),
7476
(mat, option): (),
75-
(mat, button-outlined): (
76-
container-height: (40px, 36px, 32px, 28px),
77-
touch-target-display: (block, block, none, none),
78-
),
79-
(mat, card-outlined): (),
80-
(mat, form-field-outlined): (),
8177
(mat, paginator): (
8278
container-size: (56px, 52px, 48px, 40px),
8379
form-field-container-height: (40px, 40px, 40px, 40px, 40px, 36px),
8480
form-field-container-vertical-padding: (8px, 8px, 8px, 8px, 8px, 6px),
8581
touch-target-display: (block, block, none, none),
8682
),
8783
(mat, tooltip): (),
88-
(mat, button-protected): (
89-
touch-target-display: (block, block, none, none),
90-
container-height: (40px, 36px, 32px, 28px),
91-
),
9284
(mat, radio): (
9385
touch-target-display: (block, block, none, none),
9486
state-layer-size: (40px, 36px, 32px, 28px),
@@ -116,15 +108,7 @@ $_density-tokens: (
116108
footer-container-height: (52px, 48px, 44px, 40px, 36px),
117109
row-item-container-height: (52px, 48px, 44px, 40px, 36px),
118110
),
119-
(mat, button-text): (
120-
touch-target-display: (block, block, none, none),
121-
container-height: (40px, 36px, 32px, 28px),
122-
),
123111
(mat, timepicker): (),
124-
(mat, button-tonal): (
125-
container-height: (40px, 36px, 32px, 28px),
126-
touch-target-display: (block, block, none, none),
127-
),
128112
(mat, toolbar): (
129113
standard-height: (64px, 60px, 56px, 52px),
130114
mobile-height: (56px, 52px, 48px, 44px),

src/material/slide-toggle/_m3-slide-toggle.scss

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:map';
22
@use '../core/tokens/m3-utils';
3-
@use '../core/style/elevation';
43

54
// The prefix used to generate the fully qualified name for tokens in this file.
65
$prefix: (mat, slide-toggle);
@@ -104,21 +103,12 @@ $prefix: (mat, slide-toggle);
104103
visible-track-opacity: m3-utils.hardcode(1, $exclude-hardcoded),
105104
visible-track-transition: m3-utils.hardcode(opacity 75ms, $exclude-hardcoded),
106105
with-icon-handle-size: m3-utils.hardcode(24px, $exclude-hardcoded),
107-
handle-elevation-shadow: map.get($systems, md-sys-elevation, level0),
108-
disabled-handle-elevation-shadow: map.get($systems, md-sys-elevation, level0),
106+
// These tokens have always been empty for M3, but these token values should be used
107+
// (with the same technique of calling `elevation.get-box-shadow`)
108+
// Currently, internal users have M2 tokens being applied by accident
109+
// handle-elevation-shadow: map.get($systems, md-sys-elevation, level0),
110+
// disabled-handle-elevation-shadow: map.get($systems, md-sys-elevation, level0),
109111
);
110-
$elevation-tokens: (
111-
handle-elevation-shadow,
112-
disabled-handle-elevation-shadow
113-
);
114-
115-
@each $token in $elevation-tokens {
116-
$elevation: map.get($tokens, $token);
117-
118-
@if ($elevation != null) {
119-
$tokens: map.set($tokens, $token, elevation.get-box-shadow($elevation));
120-
}
121-
}
122112

123113
$variant-tokens: (
124114
primary: (), // Default, no overrides needed

0 commit comments

Comments
 (0)