summaryrefslogtreecommitdiff
path: root/sass/components/forms/_range.scss
blob: 18607f5d082298a92939d3870eaa58e27619abda (plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* Range
   ========================================================================== */

.range-field {
  position: relative;
}

input[type=range],
input[type=range] + .thumb {
  @extend .no-select;
  cursor: pointer;
}

input[type=range] {
  position: relative;
  background-color: transparent;
  border: none;
  outline: none;
  width: 100%;
  margin: 15px 0;
  padding: 0;

  &:focus {
    outline: none;
  }
}

input[type=range] + .thumb {
  position: absolute;
  top: 10px;
  left: 0;
  border: none;
  height: 0;
  width: 0;
  border-radius: 50%;
  background-color: $radio-fill-color;
  margin-left: 7px;

  transform-origin: 50% 50%;
  transform: rotate(-45deg);

  .value {
    display: block;
    width: 30px;
    text-align: center;
    color: $radio-fill-color;
    font-size: 0;
    transform: rotate(45deg);
  }

  &.active {
    border-radius: 50% 50% 50% 0;

    .value {
      color: $input-background;
      margin-left: -1px;
      margin-top: 8px;
      font-size: 10px;
    }
  }
}

// Shared
@mixin range-track {
  height: $track-height;
  background: #c2c0c2;
  border: none;
}

@mixin range-thumb {
  border: none;
  height: $range-height;
  width: $range-width;
  border-radius: 50%;
  background: $radio-fill-color;
  transition: box-shadow .3s;
}

// WebKit
input[type=range] {
  -webkit-appearance: none;
}

input[type=range]::-webkit-slider-runnable-track {
  @include range-track;
}

input[type=range]::-webkit-slider-thumb {
  @include range-thumb;
  -webkit-appearance: none;
  background-color: $radio-fill-color;
  transform-origin: 50% 50%;
  margin: -5px 0 0 0;

}

.keyboard-focused input[type=range]:focus:not(.active)::-webkit-slider-thumb {
  box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
}

// FireFox
input[type=range] {
  /* fix for FF unable to apply focus style bug  */
  border: 1px solid white;

  /*required for proper track sizing in FF*/
}

input[type=range]::-moz-range-track {
  @include range-track;
}

input[type=range]::-moz-focus-inner {
  border: 0;
}

input[type=range]::-moz-range-thumb {
  @include range-thumb;
  margin-top: -5px;
}

// hide the outline behind the border
input[type=range]:-moz-focusring {
  outline: 1px solid #fff;
  outline-offset: -1px;
}

.keyboard-focused input[type=range]:focus:not(.active)::-moz-range-thumb {
  box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
}

// IE 10+
input[type=range]::-ms-track {
  height: $track-height;

  // remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead
  background: transparent;

  // leave room for the larger thumb to overflow with a transparent border */
  border-color: transparent;
  border-width: 6px 0;

  /*remove default tick marks*/
  color: transparent;
}

input[type=range]::-ms-fill-lower {
  background: #777;
}

input[type=range]::-ms-fill-upper {
  background: #ddd;
}

input[type=range]::-ms-thumb {
  @include range-thumb;
}

.keyboard-focused input[type=range]:focus:not(.active)::-ms-thumb {
  box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
}