@mt-gloss/styles 0.0.3

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.
@@ -0,0 +1,353 @@
1
+ // ============================================
2
+ // COMPONENT: SLIDER
3
+ // ============================================
4
+
5
+ @use '../tokens' as *;
6
+ @use '../mixins' as *;
7
+
8
+ .gloss-slider-wrapper {
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: $space-2;
12
+
13
+ &--disabled {
14
+ opacity: 0.6;
15
+ }
16
+ }
17
+
18
+ .gloss-slider {
19
+ position: relative;
20
+ display: flex;
21
+ align-items: center;
22
+ touch-action: none;
23
+ user-select: none;
24
+
25
+ // --- LABEL ---
26
+ &__label {
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ font-size: $text-sm;
31
+ font-weight: 500;
32
+ color: $alias-text-primary;
33
+ margin-bottom: $space-1;
34
+ }
35
+
36
+ &__value-label {
37
+ font-weight: 400;
38
+ color: $alias-text-secondary;
39
+ font-feature-settings: 'tnum';
40
+ }
41
+
42
+ // --- TRACK ---
43
+ &__track {
44
+ position: relative;
45
+ flex: 1;
46
+ height: 6px;
47
+ background: $color-gray-200;
48
+ border-radius: $radius-full;
49
+ cursor: pointer;
50
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
51
+ }
52
+
53
+ // --- FILL ---
54
+ &__fill {
55
+ position: absolute;
56
+ height: 100%;
57
+ background: $alias-primary;
58
+ border-radius: $radius-full;
59
+ pointer-events: none;
60
+
61
+ // For single slider, starts from left
62
+ left: 0;
63
+ }
64
+
65
+ // --- THUMB ---
66
+ &__thumb {
67
+ position: absolute;
68
+ top: 50%;
69
+ width: 20px;
70
+ height: 20px;
71
+ background: $color-white;
72
+ border: 2px solid $alias-primary;
73
+ border-radius: 50%;
74
+ transform: translate(-50%, -50%);
75
+ cursor: grab;
76
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
77
+ transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
78
+ z-index: 2;
79
+
80
+ &:hover {
81
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
82
+ transform: translate(-50%, -50%) scale(1.1);
83
+ }
84
+
85
+ &:focus-visible {
86
+ outline: none;
87
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(59, 130, 246, 0.4);
88
+ }
89
+
90
+ &:active,
91
+ &--active {
92
+ cursor: grabbing;
93
+ transform: translate(-50%, -50%) scale(1.15);
94
+ }
95
+ }
96
+
97
+ // --- TOOLTIP ---
98
+ &__tooltip {
99
+ position: absolute;
100
+ bottom: 100%;
101
+ left: 50%;
102
+ transform: translateX(-50%);
103
+ padding: $space-1 $space-2;
104
+ margin-bottom: $space-2;
105
+ background: $color-gray-800;
106
+ color: $color-white;
107
+ font-size: $text-xs;
108
+ font-weight: 500;
109
+ border-radius: $radius-sm;
110
+ white-space: nowrap;
111
+ pointer-events: none;
112
+ opacity: 0;
113
+ transition: opacity 0.2s ease;
114
+
115
+ &::after {
116
+ content: '';
117
+ position: absolute;
118
+ top: 100%;
119
+ left: 50%;
120
+ transform: translateX(-50%);
121
+ border: 4px solid transparent;
122
+ border-top-color: $color-gray-800;
123
+ }
124
+ }
125
+
126
+ &__thumb:hover &__tooltip,
127
+ &__thumb:focus-visible &__tooltip,
128
+ &--dragging &__tooltip {
129
+ opacity: 1;
130
+ }
131
+
132
+ // --- MARKS ---
133
+ &__marks {
134
+ position: absolute;
135
+ inset: 0;
136
+ pointer-events: none;
137
+ }
138
+
139
+ &__mark {
140
+ position: absolute;
141
+ display: flex;
142
+ flex-direction: column;
143
+ align-items: center;
144
+ transform: translateX(-50%);
145
+ top: 50%;
146
+ }
147
+
148
+ &__mark-dot {
149
+ width: 4px;
150
+ height: 4px;
151
+ background: $color-gray-400;
152
+ border-radius: 50%;
153
+ transform: translateY(-50%);
154
+ transition: background-color 0.2s ease;
155
+ }
156
+
157
+ &__mark--active &__mark-dot {
158
+ background: $alias-primary;
159
+ }
160
+
161
+ &__mark-label {
162
+ position: absolute;
163
+ top: 16px;
164
+ font-size: $text-xs;
165
+ color: $alias-text-secondary;
166
+ white-space: nowrap;
167
+ }
168
+
169
+ // --- HELPER TEXT ---
170
+ &__helper {
171
+ display: flex;
172
+ align-items: center;
173
+ gap: $space-1;
174
+ font-size: $text-sm;
175
+ color: $alias-text-secondary;
176
+
177
+ &--error {
178
+ color: $alias-text-error;
179
+
180
+ svg {
181
+ color: $color-red-500;
182
+ }
183
+ }
184
+ }
185
+
186
+ // --- SIZE VARIANTS ---
187
+ &--sm {
188
+ .gloss-slider__track {
189
+ height: 4px;
190
+ }
191
+
192
+ .gloss-slider__thumb {
193
+ width: 16px;
194
+ height: 16px;
195
+ }
196
+
197
+ .gloss-slider__mark-dot {
198
+ width: 3px;
199
+ height: 3px;
200
+ }
201
+ }
202
+
203
+ &--lg {
204
+ .gloss-slider__track {
205
+ height: 8px;
206
+ }
207
+
208
+ .gloss-slider__thumb {
209
+ width: 24px;
210
+ height: 24px;
211
+ border-width: 3px;
212
+ }
213
+
214
+ .gloss-slider__mark-dot {
215
+ width: 5px;
216
+ height: 5px;
217
+ }
218
+ }
219
+
220
+ // --- VERTICAL ORIENTATION ---
221
+ &--vertical {
222
+ flex-direction: column;
223
+ height: 200px;
224
+ width: auto;
225
+
226
+ .gloss-slider__track {
227
+ width: 6px;
228
+ height: 100%;
229
+ flex: 1;
230
+ }
231
+
232
+ .gloss-slider__fill {
233
+ width: 100%;
234
+ height: auto;
235
+ bottom: 0;
236
+ left: auto;
237
+ }
238
+
239
+ .gloss-slider__thumb {
240
+ left: 50%;
241
+ top: auto;
242
+ transform: translate(-50%, 50%);
243
+
244
+ &:hover {
245
+ transform: translate(-50%, 50%) scale(1.1);
246
+ }
247
+
248
+ &:active,
249
+ &--active {
250
+ transform: translate(-50%, 50%) scale(1.15);
251
+ }
252
+ }
253
+
254
+ .gloss-slider__mark {
255
+ left: 50%;
256
+ top: auto;
257
+ transform: translate(-50%, 50%);
258
+ }
259
+
260
+ .gloss-slider__mark-label {
261
+ top: auto;
262
+ left: 20px;
263
+ }
264
+
265
+ .gloss-slider__tooltip {
266
+ bottom: auto;
267
+ left: 100%;
268
+ top: 50%;
269
+ transform: translateY(-50%);
270
+ margin-bottom: 0;
271
+ margin-left: $space-2;
272
+
273
+ &::after {
274
+ top: 50%;
275
+ left: -4px;
276
+ transform: translateY(-50%);
277
+ border: 4px solid transparent;
278
+ border-right-color: $color-gray-800;
279
+ border-top-color: transparent;
280
+ }
281
+ }
282
+
283
+ &.gloss-slider--sm .gloss-slider__track {
284
+ width: 4px;
285
+ }
286
+
287
+ &.gloss-slider--lg .gloss-slider__track {
288
+ width: 8px;
289
+ }
290
+ }
291
+
292
+ // --- RANGE SLIDER ---
293
+ &--range {
294
+ .gloss-slider__fill {
295
+ left: auto; // Overridden by inline styles
296
+ }
297
+ }
298
+
299
+ // --- STATUS VARIANTS ---
300
+ &--success {
301
+ .gloss-slider__fill {
302
+ background: $color-green-500;
303
+ }
304
+
305
+ .gloss-slider__thumb {
306
+ border-color: $color-green-500;
307
+ }
308
+
309
+ .gloss-slider__mark--active .gloss-slider__mark-dot {
310
+ background: $color-green-500;
311
+ }
312
+ }
313
+
314
+ &--error {
315
+ .gloss-slider__fill {
316
+ background: $color-red-500;
317
+ }
318
+
319
+ .gloss-slider__thumb {
320
+ border-color: $color-red-500;
321
+ }
322
+
323
+ .gloss-slider__mark--active .gloss-slider__mark-dot {
324
+ background: $color-red-500;
325
+ }
326
+ }
327
+
328
+ // --- DISABLED STATE ---
329
+ &--disabled {
330
+ pointer-events: none;
331
+
332
+ .gloss-slider__track {
333
+ cursor: not-allowed;
334
+ }
335
+
336
+ .gloss-slider__thumb {
337
+ cursor: not-allowed;
338
+ border-color: $color-gray-300;
339
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
340
+ }
341
+
342
+ .gloss-slider__fill {
343
+ background: $color-gray-300;
344
+ }
345
+ }
346
+
347
+ // --- DRAGGING STATE ---
348
+ &--dragging {
349
+ .gloss-slider__thumb {
350
+ cursor: grabbing;
351
+ }
352
+ }
353
+ }