@zywave/zui-slider 4.3.2 → 4.4.0-pre.0

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,271 @@
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
33
  cursor: pointer;
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
+ }
85
+ }
86
+
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
+ }
92
+
93
+ &::-moz-range-thumb {
94
+ 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));
95
+ box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
96
+ }
97
+ }
98
+
99
+ &:disabled {
100
+ cursor: not-allowed;
101
+
102
+ &::-webkit-slider-thumb {
103
+ background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
104
+
105
+ &:hover {
106
+ box-shadow: none;
107
+ }
108
+ }
109
+
110
+ &::-moz-range-thumb {
111
+ background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
112
+
113
+ &:hover {
114
+ box-shadow: none;
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ // Shared: floating input above the thumb
121
+
122
+ .thumb-input {
123
+ position: absolute;
124
+ bottom: calc(var(--zui-slider-thumb-size) * 2 + #{rem(4)});
125
+ opacity: 0;
126
+ z-index: 10;
127
+ transform: translateX(-50%);
128
+ transition: opacity 100ms ease-out;
129
+ pointer-events: none;
130
+
131
+ &--visible,
132
+ &:focus-within {
133
+ opacity: 1;
134
+ pointer-events: all;
42
135
  }
43
136
 
44
- &:disabled::-moz-range-thumb {
45
- background-color: var(--zui-gray);
137
+ input[type='number'] {
138
+ @extend %input-base;
139
+ width: var(--zui-slider-input-width);
140
+ text-align: center;
141
+
142
+ &::-webkit-inner-spin-button,
143
+ &::-webkit-outer-spin-button {
144
+ appearance: none;
145
+ }
46
146
  }
47
147
  }
48
148
 
49
- span {
149
+ // Shared: step dots
150
+
151
+ .step-dots {
50
152
  position: absolute;
51
- top: 0.0625rem;
153
+ top: 50%;
154
+ left: 0;
155
+ width: 100%;
156
+ height: 0;
157
+ pointer-events: none;
158
+
159
+ .step-dot {
160
+ position: absolute;
161
+ width: rem(6);
162
+ height: rem(6);
163
+ background-color: var(--zui-blue);
164
+ border-radius: 50%;
165
+ transform: translate(-50%, -50%);
166
+
167
+ &:first-child,
168
+ &:last-child {
169
+ width: rem(2);
170
+ height: rem(16);
171
+ border-radius: rem(2);
172
+ }
173
+ }
174
+ }
175
+
176
+ // Range mode
177
+
178
+ .range-wrapper {
179
+ position: relative;
52
180
  display: flex;
53
- width: var(--zui-slider-thumb-size);
54
- height: 100%;
55
- justify-content: center;
181
+ height: rem(4);
56
182
  align-items: center;
57
- font-weight: 600;
58
- color: #fff;
59
- pointer-events: none;
183
+ overflow: visible;
184
+ margin: rem(5) calc(var(--zui-slider-thumb-size) * -1);
185
+
186
+ input[type='range'] {
187
+ position: absolute;
188
+ width: 100%;
189
+ height: var(--zui-slider-thumb-size);
190
+ background: transparent;
191
+ transform: translateY(-50%);
192
+ pointer-events: none;
193
+
194
+ @supports (-moz-appearance: none) {
195
+ top: 50%;
196
+ left: 0;
197
+ }
198
+
199
+ &::-webkit-slider-runnable-track {
200
+ height: rem(4);
201
+ background: transparent;
202
+ }
203
+
204
+ &::-webkit-slider-thumb {
205
+ margin-top: rem(2);
206
+ cursor: pointer;
207
+ pointer-events: all;
208
+ }
209
+
210
+ &::-moz-range-track {
211
+ height: rem(4);
212
+ background: transparent;
213
+ }
214
+
215
+ &::-moz-range-progress {
216
+ background: transparent;
217
+ }
218
+
219
+ &::-moz-range-thumb {
220
+ cursor: pointer;
221
+ pointer-events: all;
222
+ }
223
+
224
+ &:disabled {
225
+ &::-webkit-slider-thumb {
226
+ cursor: not-allowed;
227
+ pointer-events: all;
228
+ }
229
+
230
+ &::-moz-range-thumb {
231
+ cursor: not-allowed;
232
+ pointer-events: all;
233
+ }
234
+ }
235
+ }
236
+
237
+ .thumb-input {
238
+ bottom: calc(var(--zui-slider-thumb-size) * 2 - #{rem(1)});
239
+ }
240
+ }
241
+
242
+ // Min/max labels
243
+
244
+ .min-max-labels {
245
+ display: flex;
246
+ justify-content: space-between;
247
+
248
+ .min-max-label {
249
+ font-weight: 600;
250
+ color: var(--zui-gray-600);
251
+ }
252
+ }
253
+ }
254
+
255
+ :host([range]) {
256
+ .min-max-labels {
257
+ margin-top: rem(5);
258
+ }
259
+ }
260
+
261
+ :host([disabled]) {
262
+ cursor: not-allowed;
263
+
264
+ .range-wrapper {
265
+ cursor: not-allowed;
266
+ }
267
+
268
+ .step-dot {
269
+ background-color: var(--zui-gray);
60
270
  }
61
271
  }