/
range.md.scss
143 lines (104 loc) · 3.04 KB
/
range.md.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
@import "./range";
@import "./range.md.vars";
// Material Design Range
// --------------------------------------------------
:host {
--knob-border-radius: 50%;
--knob-background: var(--bar-background-active);
--knob-box-shadow: none;
--knob-size: 18px;
--bar-height: #{$range-md-bar-height};
--bar-background: #{ion-color(primary, base, 0.26)};
--bar-background-active: #{ion-color(primary, base)};
--height: #{$range-md-slider-height};
--pin-background: #{ion-color(primary, base)};
--pin-color: #{ion-color(primary, contrast)};
@include padding($range-md-padding-vertical, $range-md-padding-horizontal);
font-size: $range-md-pin-font-size;
}
:host(.ion-color) .range-bar {
background: current-color(base, 0.26);
}
:host(.ion-color) .range-bar-active,
:host(.ion-color) .range-knob,
:host(.ion-color) .range-pin,
:host(.ion-color) .range-pin::before,
:host(.ion-color) .range-tick {
background: current-color(base);
color: current-color(contrast);
}
::slotted([slot="start"]) {
@include margin(0, 14px, 0, 0);
}
::slotted([slot="end"]) {
@include margin(0, 0, 0, 14px);
}
:host(.range-has-pin) {
@include padding($range-md-padding-vertical + $range-md-pin-font-size + $range-md-pin-padding-vertical, null, null, null);
}
.range-bar-active {
bottom: 0;
width: auto;
background: var(--bar-background-active);
}
.range-knob {
transform: scale(.67);
transition-duration: 120ms;
transition-property: transform, background-color, border;
transition-timing-function: ease;
z-index: 2;
}
.range-tick {
position: absolute;
top: calc((var(--height) - var(--bar-height)) / 2);
width: var(--bar-height);
height: var(--bar-height);
background: var(--bar-background-active);
z-index: 1;
pointer-events: none;
}
.range-tick-active {
background: transparent;
}
.range-pin {
@include padding($range-md-pin-padding-vertical, $range-md-pin-padding-horizontal);
@include border-radius(50%);
@include transform(translate3d(0, 0, 0), scale(.01));
display: inline-block;
position: relative;
min-width: 28px;
height: 28px;
transition: transform 120ms ease, background 120ms ease;
background: var(--pin-background);
color: var(--pin-color);
text-align: center;
&::before {
@include position(3px, null, null, 50%);
@include border-radius(50%, 50%, 50%, 0);
@include margin-horizontal(-13px, null);
position: absolute;
width: 26px;
height: 26px;
transform: rotate(-45deg);
transition: background 120ms ease;
background: var(--pin-background);
content: "";
z-index: -1;
}
}
.range-knob-pressed .range-pin {
@include transform(translate3d(0, -24px, 0), scale(1));
}
:host(:not(.range-has-pin)) .range-knob-pressed .range-knob {
transform: scale(1);
}
:host(.range-disabled) .range-bar-active,
:host(.range-disabled) .range-bar,
:host(.range-disabled) .range-tick {
background-color: $range-md-bar-background-color;
}
:host(.range-disabled) .range-knob {
transform: scale(.55);
outline: 5px solid #fff;
background-color: $range-md-bar-background-color;
}