forked from Shopify/polaris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DualThumb.scss
223 lines (200 loc) · 7.99 KB
/
DualThumb.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
@import '../../../../styles/common';
@import '../../RangeSlider';
$range-wrapper: 28px;
.DualThumb {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: relative;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
width: 100%;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
display: flex;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
align-items: center;
}
.TrackWrapper {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: relative;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
display: flex;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
align-items: center;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
width: 100%;
min-height: $range-wrapper;
cursor: pointer;
&.disabled {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
opacity: 0.8;
cursor: not-allowed;
}
}
.Track {
// stylelint-disable -- Polaris component custom properties
--pc-dual-thumb-unselected-range: transparent;
--pc-dual-thumb-selected-range: var(--p-interactive);
--pc-dual-thumb-gradient-colors: var(--pc-dual-thumb-unselected-range) 0%,
var(--pc-dual-thumb-unselected-range) var(--pc-range-slider-progress-lower),
var(--pc-dual-thumb-selected-range) var(--pc-range-slider-progress-lower),
var(--pc-dual-thumb-selected-range) var(--pc-range-slider-progress-upper),
var(--pc-dual-thumb-unselected-range) var(--pc-range-slider-progress-upper),
var(--pc-dual-thumb-unselected-range) 100%;
// stylelint-enable
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: absolute;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
z-index: 1;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
width: 100%;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
height: var(--pc-range-slider-track-height);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
border-radius: var(--pc-range-slider-thumb-size);
// stylelint-disable -- generated by polaris-migrator DO NOT COPY
background-image: linear-gradient(
to right,
var(--pc-dual-thumb-gradient-colors)
);
// stylelint-enable
.error & {
// stylelint-disable -- Polaris component custom properties
--pc-dual-thumb-selected-range: var(--p-action-critical);
--pc-dual-thumb-gradient-colors: var(--pc-dual-thumb-unselected-range) 0%,
var(--pc-dual-thumb-unselected-range)
var(--pc-range-slider-progress-lower),
var(--pc-dual-thumb-selected-range) var(--pc-range-slider-progress-lower),
var(--pc-dual-thumb-selected-range) var(--pc-range-slider-progress-upper),
var(--pc-dual-thumb-unselected-range)
var(--pc-range-slider-progress-upper),
var(--pc-dual-thumb-unselected-range) 100%;
// stylelint-enable
// stylelint-disable -- generated by polaris-migrator DO NOT COPY
background-image: linear-gradient(
to right,
var(--pc-dual-thumb-gradient-colors)
);
// stylelint-enable
}
.disabled & {
background: var(--p-border-disabled) none;
}
}
.Track--dashed {
@include track-dashed;
}
.Thumbs {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($size: 'wide', $border-width: 1px);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: absolute;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
z-index: var(--pc-range-slider-input);
padding: 0;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
width: var(--pc-range-slider-thumb-size);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
height: var(--pc-range-slider-thumb-size);
border-radius: var(--p-border-radius-half);
border: var(--p-border-width-1) solid var(--p-interactive);
background: linear-gradient(var(--p-interactive), var(--p-interactive));
-webkit-tap-highlight-color: transparent;
// stylelint-disable-next-line value-no-vendor-prefix -- generated by polaris-migrator DO NOT COPY
cursor: -webkit-grab;
transition: transform var(--p-duration-150) var(--p-ease);
&.disabled {
cursor: not-allowed;
border-color: var(--p-border-disabled);
background: var(--p-border-disabled);
}
&:active {
transform: scale(1.5);
}
&:focus {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($style: 'focused');
outline: 0;
}
.error & {
border-color: var(--p-action-critical);
background: linear-gradient(
var(--p-action-critical),
var(--p-action-critical)
);
}
}
$range-output-size: 32px;
.Prefix {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
flex: 0 0 auto;
margin-right: var(--p-space-2);
}
.Suffix {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
flex: 0 0 auto;
margin-left: var(--p-space-2);
}
.Output {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-range-slider-output-spacing: var(--p-space-4);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: absolute;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
z-index: var(--pc-range-slider-output);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
bottom: var(--p-range-slider-thumb-size-active);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition-property: opacity, visibility, bottom;
transition-duration: var(--p-duration-150);
transition-timing-function: var(--p-ease);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
transform: translateX(calc(-50% + (var(--pc-range-slider-thumb-size) / 2)));
.Thumbs:active + & {
// stylelint-enable
opacity: 1;
visibility: visible;
// stylelint-disable -- generated by polaris-migrator DO NOT COPY
bottom: calc(
var(--p-range-slider-thumb-size-active) + var(--p-range-slider-thumb-size-active) - var(--p-range-slider-thumb-size-base)
);
// stylelint-enable
}
}
.OutputBubble {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
position: relative;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
display: flex;
padding: 0 var(--p-space-2);
min-width: $range-output-size;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
height: $range-output-size;
background-color: var(--p-surface);
box-shadow: var(--p-shadow-popover);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
border-radius: var(--p-border-radius-base);
transition-property: transform;
transition-duration: var(--p-duration-150);
transition-timing-function: var(--p-ease);
// stylelint-disable selector-max-specificity, selector-max-combinators, selector-max-class -- generated by polaris-migrator DO NOT COPY
.Thumbs:hover + .Output &,
.Thumbs:active + .Output &,
.Thumbs:focus + .Output & {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
transform: translateY(calc(-1 * var(--pc-range-slider-output-spacing)));
@media #{$p-breakpoints-md-up} {
// stylelint-disable-next-line -- polaris/conventions/polaris/custom-property-allowed-list
transform: translateY(
calc(-1 * (var(--pc-range-slider-output-spacing) * 0.5))
);
}
}
// stylelint-enable selector-max-specificity, selector-max-combinators, selector-max-class -- generated by polaris-migrator DO NOT COPY
> :first-child {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
display: block;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
flex: 1 1 auto;
margin: auto;
}
}