@zywave/zui-slider 4.3.3-pre.0 → 4.4.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,61 +1,301 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-input/src/input' as *;
2
3
 
3
4
  :host {
4
- --zui-slider-thumb-size: #{rem(30)};
5
- display: block; // browsers will do 'display: inline' by default because backwards compatibility
5
+ --zui-slider-thumb-size: #{rem(14)};
6
+ --zui-slider-input-width: 8ch;
7
+
8
+ $thumb-ring-color: rgba(120, 120, 140, 0.16);
9
+
10
+ position: relative;
11
+ display: block;
6
12
  padding: calc(var(--zui-slider-thumb-size) / 2) 0;
7
13
 
8
- input {
14
+ // Single mode
15
+
16
+ .single-wrapper {
17
+ position: relative;
18
+ display: flex;
19
+ height: var(--zui-slider-thumb-size);
20
+ align-items: center;
21
+ margin: 0 calc(var(--zui-slider-thumb-size) * -1);
22
+ }
23
+
24
+ // Shared: range input thumb styles
25
+
26
+ input[type='range'] {
9
27
  width: 100%;
10
28
  height: rem(4);
11
- vertical-align: middle;
29
+ margin: 0;
12
30
  background: var(--zui-gray-200);
13
- border-radius: 3px;
31
+ border-radius: rem(3);
14
32
  outline: none;
15
- cursor: pointer;
33
+ cursor: grab;
16
34
  -webkit-appearance: none;
17
35
  -moz-appearance: none;
18
-
19
- &:disabled {
20
- cursor: not-allowed;
21
- }
36
+ appearance: none;
22
37
 
23
38
  &::-webkit-slider-thumb {
24
- width: var(--zui-slider-thumb-size);
25
- height: var(--zui-slider-thumb-size);
26
- background-color: var(--zui-blue);
39
+ width: calc(var(--zui-slider-thumb-size) * 3);
40
+ height: calc(var(--zui-slider-thumb-size) * 3);
41
+ background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
27
42
  border-radius: 50%;
43
+ box-shadow: none;
44
+ transition: background 100ms ease-out, box-shadow 100ms ease-out;
28
45
  -webkit-appearance: none;
29
- }
46
+ appearance: none;
30
47
 
31
- &:disabled::-webkit-slider-thumb {
32
- background-color: var(--zui-gray);
48
+ &:hover {
49
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
50
+ }
33
51
  }
34
52
 
35
53
  &::-moz-range-thumb {
36
- width: var(--zui-slider-thumb-size);
37
- height: var(--zui-slider-thumb-size);
38
- background-color: var(--zui-blue);
54
+ width: calc(var(--zui-slider-thumb-size) * 3);
55
+ height: calc(var(--zui-slider-thumb-size) * 3);
56
+ background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
39
57
  border: 0;
40
58
  border-radius: 50%;
41
- -moz-appearance: none;
59
+ box-shadow: none;
60
+ transition: background 100ms ease-out, box-shadow 100ms ease-out;
61
+
62
+ &:hover {
63
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
64
+ }
65
+ }
66
+
67
+ &:hover {
68
+ &::-webkit-slider-thumb {
69
+ background: radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
70
+ }
71
+
72
+ &::-moz-range-thumb {
73
+ background: radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
74
+ }
75
+ }
76
+
77
+ &:focus {
78
+ &::-webkit-slider-thumb {
79
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
80
+ }
81
+
82
+ &::-moz-range-thumb {
83
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
84
+ }
42
85
  }
43
86
 
44
- &:disabled::-moz-range-thumb {
45
- background-color: var(--zui-gray);
87
+ &:active {
88
+ &::-webkit-slider-thumb {
89
+ background: radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
90
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
91
+ cursor: grabbing;
92
+ }
93
+
94
+ &::-moz-range-thumb {
95
+ background: radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
96
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
97
+ cursor: grabbing;
98
+ }
99
+ }
100
+
101
+ &:disabled {
102
+ cursor: not-allowed;
103
+
104
+ &::-webkit-slider-thumb {
105
+ background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
106
+
107
+ &:hover {
108
+ box-shadow: none;
109
+ }
110
+ }
111
+
112
+ &::-moz-range-thumb {
113
+ background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
114
+
115
+ &:hover {
116
+ box-shadow: none;
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ // Shared: floating input above the thumb
123
+
124
+ .thumb-input {
125
+ position: absolute;
126
+ bottom: calc(var(--zui-slider-thumb-size) * 2 + #{rem(4)});
127
+ opacity: 0;
128
+ z-index: 10;
129
+ transform: translateX(-50%);
130
+ transition: opacity 100ms ease-out;
131
+ pointer-events: none;
132
+
133
+ &--visible,
134
+ &:focus-within {
135
+ opacity: 1;
136
+ pointer-events: all;
137
+ }
138
+
139
+ input[type='number'] {
140
+ @extend %input-base;
141
+ width: var(--zui-slider-input-width);
142
+ text-align: center;
143
+
144
+ &::-webkit-inner-spin-button,
145
+ &::-webkit-outer-spin-button {
146
+ appearance: none;
147
+ }
46
148
  }
47
149
  }
48
150
 
49
- span {
151
+ // Shared: step dots
152
+
153
+ .step-dots {
50
154
  position: absolute;
51
- top: 0.0625rem;
155
+ top: 50%;
156
+ left: 0;
157
+ width: 100%;
158
+ height: 0;
159
+ pointer-events: none;
160
+
161
+ .step-dot {
162
+ position: absolute;
163
+ width: rem(6);
164
+ height: rem(6);
165
+ background-color: var(--zui-blue);
166
+ border-radius: 50%;
167
+ transform: translate(-50%, -50%);
168
+
169
+ &:first-child,
170
+ &:last-child {
171
+ width: rem(2);
172
+ height: rem(16);
173
+ border-radius: rem(2);
174
+ }
175
+ }
176
+ }
177
+
178
+ // Range mode
179
+
180
+ .range-wrapper {
181
+ position: relative;
52
182
  display: flex;
53
- width: var(--zui-slider-thumb-size);
54
- height: 100%;
55
- justify-content: center;
183
+ height: rem(4);
56
184
  align-items: center;
57
- font-weight: 600;
58
- color: #fff;
59
- pointer-events: none;
185
+ overflow: visible;
186
+ margin: rem(5) calc(var(--zui-slider-thumb-size) * -1);
187
+
188
+ input[type='range'] {
189
+ position: absolute;
190
+ width: 100%;
191
+ height: var(--zui-slider-thumb-size);
192
+ background: transparent;
193
+ transform: translateY(-50%);
194
+ pointer-events: none;
195
+
196
+ @supports (-moz-appearance: none) {
197
+ top: 50%;
198
+ left: 0;
199
+ }
200
+
201
+ &::-webkit-slider-runnable-track {
202
+ height: rem(4);
203
+ background: transparent;
204
+ }
205
+
206
+ &::-webkit-slider-thumb {
207
+ margin-top: rem(2);
208
+ cursor: grab;
209
+ pointer-events: all;
210
+ }
211
+
212
+ &::-moz-range-track {
213
+ height: rem(4);
214
+ background: transparent;
215
+ }
216
+
217
+ &::-moz-range-progress {
218
+ background: transparent;
219
+ }
220
+
221
+ &::-moz-range-thumb {
222
+ cursor: grab;
223
+ pointer-events: all;
224
+ }
225
+
226
+ &:active {
227
+ &::-webkit-slider-thumb {
228
+ cursor: grabbing;
229
+ }
230
+
231
+ &::-moz-range-thumb {
232
+ cursor: grabbing;
233
+ }
234
+ }
235
+
236
+ &:disabled {
237
+ &::-webkit-slider-thumb {
238
+ cursor: not-allowed;
239
+ pointer-events: all;
240
+ }
241
+
242
+ &::-moz-range-thumb {
243
+ cursor: not-allowed;
244
+ pointer-events: all;
245
+ }
246
+ }
247
+ }
248
+
249
+ .thumb-input {
250
+ bottom: calc(var(--zui-slider-thumb-size) * 2 - #{rem(1)});
251
+ }
252
+ }
253
+
254
+ // Min/max labels
255
+
256
+ .min-max-labels {
257
+ display: flex;
258
+ justify-content: space-between;
259
+
260
+ .min-max-label {
261
+ font-weight: 600;
262
+ color: var(--zui-gray-600);
263
+ }
264
+ }
265
+ }
266
+
267
+ :host([range]) {
268
+ .min-max-labels {
269
+ margin-top: rem(5);
270
+ }
271
+ }
272
+
273
+ :host([readonly]) {
274
+ // The native range input is set to disabled to block dragging, since input[type=range]
275
+ // ignores the readonly attribute. Override the disabled appearance to look normal.
276
+ input[type='range']:disabled {
277
+ cursor: default;
278
+
279
+ &::-webkit-slider-thumb {
280
+ background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
281
+ cursor: default;
282
+ }
283
+
284
+ &::-moz-range-thumb {
285
+ background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
286
+ cursor: default;
287
+ }
288
+ }
289
+ }
290
+
291
+ :host([disabled]) {
292
+ cursor: not-allowed;
293
+
294
+ .range-wrapper {
295
+ cursor: not-allowed;
296
+ }
297
+
298
+ .step-dot {
299
+ background-color: var(--zui-gray);
60
300
  }
61
301
  }