Skip to content

Commit feafb2b

Browse files
devversionandrewseguin
authored andcommitted
feat(material-experimental/mdc-slide-toggle): support density scaling
1 parent d9698fe commit feafb2b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/material-experimental/mdc-slide-toggle/_slide-toggle-theme.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@
8484
}
8585
}
8686

87-
@mixin mat-mdc-slide-toggle-density($density-scale) {}
87+
@mixin mat-mdc-slide-toggle-density($density-scale) {
88+
.mat-mdc-slide-toggle .mdc-switch {
89+
@include mdc-switch-density($density-scale);
90+
}
91+
}
8892

8993
@mixin mat-mdc-slide-toggle-theme($theme) {
9094
$color: mat-get-color-config($theme);

src/material-experimental/mdc-slide-toggle/slide-toggle.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616
// The ripple needs extra specificity so the base ripple styling doesn't override its `position`.
1717
.mat-mdc-slide-toggle-ripple, .mdc-switch__thumb-underlay::after {
1818
@include mat-fill;
19-
19+
border-radius: 50%;
2020
// Disable pointer events for the ripple container so that it doesn't eat the mouse events meant
2121
// for the input. Pointer events can be safely disabled because the ripple trigger element is
2222
// the host element.
2323
pointer-events: none;
24+
// Fixes the ripples not clipping to the border radius on Safari. Uses `:not(:empty)`
25+
// in order to avoid creating extra layers when there aren't any ripples.
26+
&:not(:empty) {
27+
transform: translateZ(0);
28+
}
2429
}
2530

2631
// The MDC switch styles related to the hover state are intertwined with the MDC ripple styles.

0 commit comments

Comments
 (0)