-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
slider.scss
75 lines (63 loc) · 2.59 KB
/
slider.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@use '@material/slider/slider' as mdc-slider;
@use '@material/slider/slider-theme' as mdc-slider-theme;
@use '../core/mdc-helpers/mdc-helpers';
@include mdc-helpers.disable-mdc-fallback-declarations {
@include mdc-slider.static-styles($query: mdc-helpers.$mdc-base-styles-query);
}
$mat-slider-min-size: 128px !default;
$mat-slider-horizontal-margin: 8px !default;
// Overwrites the mdc-slider default styles to match the visual appearance of the
// Angular Material standard slider. This involves making the slider an inline-block
// element, aligning it in the vertical middle of a line, specifying a default minimum
// width and adding horizontal margin.
.mat-mdc-slider {
@include mdc-helpers.disable-mdc-fallback-declarations {
@include mdc-slider-theme.theme-styles(mdc-slider-theme.$light-theme);
}
display: inline-block;
box-sizing: border-box;
outline: none;
vertical-align: middle;
margin: {
left: $mat-slider-horizontal-margin;
right: $mat-slider-horizontal-margin;
}
// Unset the default "width" property from the MDC slider class. We don't want
// the slider to automatically expand horizontally for backwards compatibility.
width: auto;
min-width: $mat-slider-min-size - (2 * $mat-slider-horizontal-margin);
.mdc-slider__value-indicator {
// There's no token to control this opacity so we have to do it ourselves.
opacity: var(--mat-mdc-slider-value-indicator-opacity, 1);
}
// The `.mat-ripple` wrapper here is redundant, but we need it to
// increase the specificity due to how some styles are setup in g3.
.mat-ripple {
// These ripple colors are custom so we have to introduce our own tokens.
.mat-ripple-element {
background-color: var(--mat-mdc-slider-ripple-color, transparent);
}
.mat-mdc-slider-hover-ripple {
background-color: var(--mat-mdc-slider-hover-ripple-color, transparent);
}
.mat-mdc-slider-focus-ripple, .mat-mdc-slider-active-ripple {
background-color: var(--mat-mdc-slider-focus-ripple-color, transparent);
}
}
&._mat-animation-noopable {
&.mdc-slider--discrete .mdc-slider__thumb,
&.mdc-slider--discrete .mdc-slider__track--active_fill,
.mdc-slider__value-indicator {
transition: none;
}
}
// Slider components have to set `border-radius: 50%` in order to support density scaling
// which will clip a square focus indicator so we have to turn it into a circle.
.mat-mdc-focus-indicator::before {
border-radius: 50%;
}
}
// In the MDC slider the focus indicator is inside the thumb.
.mdc-slider__thumb--focused .mat-mdc-focus-indicator::before {
content: '';
}