mtrl 0.2.1 → 0.2.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.
Files changed (98) hide show
  1. package/.typedocignore +11 -0
  2. package/DOCS.md +153 -0
  3. package/index.ts +18 -3
  4. package/package.json +7 -2
  5. package/src/components/badge/_styles.scss +174 -0
  6. package/src/components/badge/api.ts +292 -0
  7. package/src/components/badge/badge.ts +52 -0
  8. package/src/components/badge/config.ts +68 -0
  9. package/src/components/badge/constants.ts +30 -0
  10. package/src/components/badge/features.ts +185 -0
  11. package/src/components/badge/index.ts +4 -0
  12. package/src/components/badge/types.ts +105 -0
  13. package/src/components/button/types.ts +174 -29
  14. package/src/components/card/constants.ts +14 -0
  15. package/src/components/carousel/_styles.scss +645 -0
  16. package/src/components/carousel/api.ts +147 -0
  17. package/src/components/carousel/carousel.ts +178 -0
  18. package/src/components/carousel/config.ts +91 -0
  19. package/src/components/carousel/constants.ts +95 -0
  20. package/src/components/carousel/features/drag.ts +388 -0
  21. package/src/components/carousel/features/index.ts +8 -0
  22. package/src/components/carousel/features/slides.ts +682 -0
  23. package/src/components/carousel/index.ts +38 -0
  24. package/src/components/carousel/types.ts +327 -0
  25. package/src/components/chip/_styles.scss +83 -140
  26. package/src/components/chip/api.ts +231 -102
  27. package/src/components/chip/chip.ts +356 -44
  28. package/src/components/chip/constants.ts +3 -3
  29. package/src/components/chip/index.ts +3 -3
  30. package/src/components/dialog/_styles.scss +213 -0
  31. package/src/components/dialog/api.ts +283 -0
  32. package/src/components/dialog/config.ts +113 -0
  33. package/src/components/dialog/constants.ts +32 -0
  34. package/src/components/dialog/dialog.ts +56 -0
  35. package/src/components/dialog/features.ts +713 -0
  36. package/src/components/dialog/index.ts +15 -0
  37. package/src/components/dialog/types.ts +221 -0
  38. package/src/components/progress/_styles.scss +13 -1
  39. package/src/components/progress/api.ts +2 -2
  40. package/src/components/progress/progress.ts +2 -2
  41. package/src/components/progress/types.ts +3 -0
  42. package/src/components/radios/_styles.scss +232 -0
  43. package/src/components/radios/api.ts +100 -0
  44. package/src/components/radios/config.ts +60 -0
  45. package/src/components/radios/constants.ts +28 -0
  46. package/src/components/radios/index.ts +4 -0
  47. package/src/components/radios/radio.ts +269 -0
  48. package/src/components/radios/radios.ts +42 -0
  49. package/src/components/radios/types.ts +232 -0
  50. package/src/components/sheet/_styles.scss +236 -0
  51. package/src/components/sheet/api.ts +96 -0
  52. package/src/components/sheet/config.ts +66 -0
  53. package/src/components/sheet/constants.ts +20 -0
  54. package/src/components/sheet/features/content.ts +51 -0
  55. package/src/components/sheet/features/gestures.ts +177 -0
  56. package/src/components/sheet/features/index.ts +6 -0
  57. package/src/components/sheet/features/position.ts +42 -0
  58. package/src/components/sheet/features/state.ts +116 -0
  59. package/src/components/sheet/features/title.ts +86 -0
  60. package/src/components/sheet/index.ts +4 -0
  61. package/src/components/sheet/sheet.ts +57 -0
  62. package/src/components/sheet/types.ts +266 -0
  63. package/src/components/slider/_styles.scss +518 -0
  64. package/src/components/slider/api.ts +336 -0
  65. package/src/components/slider/config.ts +145 -0
  66. package/src/components/slider/constants.ts +28 -0
  67. package/src/components/slider/features/appearance.ts +140 -0
  68. package/src/components/slider/features/disabled.ts +43 -0
  69. package/src/components/slider/features/events.ts +164 -0
  70. package/src/components/slider/features/index.ts +5 -0
  71. package/src/components/slider/features/interactions.ts +256 -0
  72. package/src/components/slider/features/keyboard.ts +114 -0
  73. package/src/components/slider/features/slider.ts +336 -0
  74. package/src/components/slider/features/structure.ts +264 -0
  75. package/src/components/slider/features/ui.ts +518 -0
  76. package/src/components/slider/index.ts +9 -0
  77. package/src/components/slider/slider.ts +58 -0
  78. package/src/components/slider/types.ts +166 -0
  79. package/src/components/tabs/_styles.scss +224 -0
  80. package/src/components/tabs/api.ts +443 -0
  81. package/src/components/tabs/config.ts +80 -0
  82. package/src/components/tabs/constants.ts +12 -0
  83. package/src/components/tabs/index.ts +4 -0
  84. package/src/components/tabs/tabs.ts +52 -0
  85. package/src/components/tabs/types.ts +247 -0
  86. package/src/components/textfield/_styles.scss +97 -4
  87. package/src/components/tooltip/_styles.scss +241 -0
  88. package/src/components/tooltip/api.ts +411 -0
  89. package/src/components/tooltip/config.ts +78 -0
  90. package/src/components/tooltip/constants.ts +27 -0
  91. package/src/components/tooltip/index.ts +4 -0
  92. package/src/components/tooltip/tooltip.ts +60 -0
  93. package/src/components/tooltip/types.ts +178 -0
  94. package/src/index.ts +9 -1
  95. package/src/styles/abstract/_variables.scss +24 -0
  96. package/tsconfig.json +22 -0
  97. package/typedoc.json +28 -0
  98. package/typedoc.simple.json +14 -0
@@ -0,0 +1,518 @@
1
+ // src/components/slider/_styles.scss
2
+ @use '../../styles/abstract/base' as base;
3
+ @use '../../styles/abstract/variables' as v;
4
+ @use '../../styles/abstract/functions' as f;
5
+ @use '../../styles/abstract/mixins' as m;
6
+ @use '../../styles/abstract/theme' as t;
7
+
8
+ $component: '#{base.$prefix}-slider';
9
+
10
+ .#{$component} {
11
+ // Base styles
12
+ position: relative;
13
+ width: 100%;
14
+ height: 40px;
15
+ display: flex;
16
+ align-items: center;
17
+ user-select: none;
18
+ touch-action: none;
19
+
20
+ &-track {
21
+ position: relative;
22
+ width: 100%;
23
+ padding: 0 4px;
24
+ height: 16px;
25
+ background-color: transparent;
26
+ border-radius: 8px;
27
+ overflow: hidden;
28
+ cursor: pointer;
29
+
30
+ // Disabled state
31
+ .#{$component}--disabled & {
32
+ opacity: 0.38;
33
+ cursor: not-allowed;
34
+ }
35
+ }
36
+
37
+ // Start track (new element for range slider - beginning to first thumb)
38
+ &-start-track {
39
+ position: absolute;
40
+ top: 0;
41
+ left: 0;
42
+ height: 100%;
43
+ background-color: t.color('primary');
44
+ transform-origin: left center;
45
+ // transition: transform 0.1s ease, width 0.1s ease, height 0.1s ease;
46
+ border-radius: 5px;
47
+ opacity: 0.24;
48
+ z-index: 1;
49
+
50
+ .#{$component}--secondary & {
51
+ background-color: t.color('secondary');
52
+ }
53
+
54
+ .#{$component}--tertiary & {
55
+ background-color: t.color('tertiary');
56
+ }
57
+
58
+ .#{$component}--error & {
59
+ background-color: t.color('error');
60
+ }
61
+
62
+ .#{$component}--disabled & {
63
+ opacity: 0.12;
64
+ }
65
+ }
66
+
67
+ // Active track (filled part)
68
+ &-active-track {
69
+ position: absolute;
70
+ top: 0;
71
+ height: 100%;
72
+ background-color: t.color('primary');
73
+ transform-origin: left center;
74
+ // transition: transform 0.1s ease, width 0.1s ease, height 0.1s ease, left 0.1s ease, bottom 0.1s ease;
75
+ border-radius: 5px;
76
+ z-index: 1;
77
+
78
+ .#{$component}--secondary & {
79
+ background-color: t.color('secondary');
80
+ }
81
+
82
+ .#{$component}--tertiary & {
83
+ background-color: t.color('tertiary');
84
+ }
85
+
86
+ .#{$component}--error & {
87
+ background-color: t.color('error');
88
+ }
89
+ }
90
+
91
+ // Remaining track (unfilled part) - new for MD3
92
+ &-remaining-track {
93
+ opacity: .24;
94
+ position: absolute;
95
+ top: 0;
96
+ height: 100%;
97
+ background-color: t.color('primary');
98
+ transform-origin: left center;
99
+ // transition: transform 0.1s ease, width 0.1s ease, height 0.1s ease, left 0.1s ease, bottom 0.1s ease;
100
+ border-radius: 5px;
101
+ width: 100%;
102
+ z-index: 0;
103
+
104
+ .#{$component}--secondary & {
105
+ background-color: t.color('secondary');
106
+ }
107
+
108
+ .#{$component}--tertiary & {
109
+ background-color: t.color('tertiary');
110
+ }
111
+
112
+ .#{$component}--error & {
113
+ background-color: t.color('error');
114
+ }
115
+
116
+ .#{$component}--disabled & {
117
+ opacity: 0.12;
118
+ }
119
+ }
120
+
121
+ // Dot elements for track ends (separate from thumbs)
122
+ &-dot {
123
+ pointer-events: none;
124
+ position: absolute;
125
+ width: 4px;
126
+ height: 4px;
127
+ border-radius: 50%;
128
+ background-color: t.color('primary');
129
+ top: 50%;
130
+ transform: translateY(-50%);
131
+ z-index: 1;
132
+
133
+ // Start dot
134
+ &--start {
135
+ left: 4px;
136
+ }
137
+
138
+ // End dot
139
+ &--end {
140
+ right: 4px;
141
+ }
142
+
143
+ // Color variants
144
+ .#{$component}--secondary & {
145
+ background-color: t.color('secondary');
146
+ }
147
+
148
+ .#{$component}--tertiary & {
149
+ background-color: t.color('tertiary');
150
+ }
151
+
152
+ .#{$component}--error & {
153
+ background-color: t.color('error');
154
+ }
155
+
156
+ // Disabled state
157
+ .#{$component}--disabled & {
158
+ opacity: 0.38;
159
+ }
160
+ }
161
+
162
+ // Thumb - updated to MD3 style with T-shape
163
+ &-thumb {
164
+ position: absolute;
165
+ top: 50%;
166
+ transform: translate(-50%, -50%);
167
+ cursor: pointer;
168
+ z-index: 2;
169
+ // transition: left 0.1s ease, bottom 0.1s ease;
170
+ width: 16px;
171
+ height: 100%;
172
+
173
+ // Create a T-shaped thumb using pseudo-elements
174
+ &::before {
175
+ pointer-events: none;
176
+ content: '';
177
+ position: absolute;
178
+ width: 4px;
179
+ height: 40px;
180
+ background-color: t.color('primary');
181
+ border-radius: 2px;
182
+ left: 50%;
183
+ top: 50%;
184
+ transform: translate(-50%, -50%);
185
+ transition: background-color 0.15s ease;
186
+
187
+ .#{$component}--secondary & {
188
+ background-color: t.color('secondary');
189
+ }
190
+
191
+ .#{$component}--tertiary & {
192
+ background-color: t.color('tertiary');
193
+ }
194
+
195
+ .#{$component}--error & {
196
+ background-color: t.color('error');
197
+ }
198
+
199
+ .#{$component}--disabled & {
200
+ background-color: t.color('on-surface');
201
+ opacity: 0.38;
202
+ }
203
+ }
204
+
205
+ // Enable pointer events on the pseudo-elements
206
+ &::before, &::after {
207
+ pointer-events: auto;
208
+ }
209
+
210
+ // Hover state
211
+ &:hover::before, &:hover::after {
212
+ background-color: t.color('primary');
213
+
214
+ .#{$component}--secondary & {
215
+ background-color: t.color('secondary');
216
+ }
217
+
218
+ .#{$component}--tertiary & {
219
+ background-color: t.color('tertiary');
220
+ }
221
+
222
+ .#{$component}--error & {
223
+ background-color: t.color('error');
224
+ }
225
+
226
+ .#{$component}--disabled & {
227
+ background-color: t.color('on-surface');
228
+ opacity: 0.38;
229
+ }
230
+ }
231
+
232
+ // Focus state
233
+ &:focus {
234
+ outline: none;
235
+ }
236
+
237
+ &:focus::before, &:focus::after {
238
+ background-color: t.color('primary');
239
+
240
+ .#{$component}--secondary & {
241
+ background-color: t.color('secondary');
242
+ }
243
+
244
+ .#{$component}--tertiary & {
245
+ background-color: t.color('tertiary');
246
+ }
247
+
248
+ .#{$component}--error & {
249
+ background-color: t.color('error');
250
+ }
251
+ }
252
+
253
+ // Active state
254
+ &:active::before, &:active::after {
255
+ background-color: t.color('primary');
256
+
257
+ .#{$component}--secondary & {
258
+ background-color: t.color('secondary');
259
+ }
260
+
261
+ .#{$component}--tertiary & {
262
+ background-color: t.color('tertiary');
263
+ }
264
+
265
+ .#{$component}--error & {
266
+ background-color: t.color('error');
267
+ }
268
+ }
269
+
270
+ // Disabled state
271
+ .#{$component}--disabled & {
272
+ cursor: not-allowed;
273
+
274
+ &::before, &::after {
275
+ opacity: 0.38;
276
+ background-color: t.color('on-surface');
277
+ }
278
+ }
279
+ }
280
+
281
+ // Tick marks
282
+ &-tick {
283
+ position: absolute;
284
+ width: 2px;
285
+ height: 2px;
286
+ background-color: t.color('outline');
287
+ border-radius: 50%;
288
+ top: 50%;
289
+ transform: translate(-50%, -50%);
290
+ pointer-events: none;
291
+ opacity: 0.6;
292
+
293
+ &:last-child, &:first-child {
294
+ display: none
295
+ }
296
+
297
+ // Active tick (filled)
298
+ &--active {
299
+ background-color: t.alpha('on-primary', 0.38);
300
+
301
+ .#{$component}--secondary & {
302
+ background-color: t.alpha('on-secondary', 0.38);
303
+ }
304
+
305
+ .#{$component}--tertiary & {
306
+ background-color: t.alpha('on-tertiary', 0.38);
307
+ }
308
+
309
+ .#{$component}--error & {
310
+ background-color: t.alpha('on-error', 0.38);
311
+ }
312
+ }
313
+ }
314
+
315
+ // Labels for tick marks
316
+ &-label {
317
+ position: absolute;
318
+ font-size: 12px;
319
+ color: t.color('on-surface-variant');
320
+ top: 45px;
321
+ transform: translateX(-50%);
322
+ white-space: nowrap;
323
+ pointer-events: none;
324
+ font-weight: 500;
325
+ }
326
+
327
+ // Range slider styles (for two thumbs)
328
+ &--range {
329
+ .#{$component}-thumb {
330
+ &:nth-of-type(1) {
331
+ z-index: 3;
332
+ }
333
+ }
334
+
335
+ // In range mode, both dots should be visible
336
+ .#{$component}-dot {
337
+ z-index: 2;
338
+ }
339
+ }
340
+
341
+ // Value bubble (shows current value when dragging)
342
+ &-value {
343
+ position: absolute;
344
+ top: -40px;
345
+ left: 0;
346
+ background-color: t.color('on-surface');
347
+ color: t.color('surface-container-highest');
348
+ padding: 6px 10px;
349
+ border-radius: 21px;
350
+ font-size: 12px;
351
+ font-weight: 500;
352
+ transform: translateX(-50%);
353
+ visibility: hidden;
354
+ opacity: 0;
355
+ transition: opacity 0.2s ease, visibility 0s linear 0.2s;
356
+ pointer-events: none;
357
+
358
+ // Show value when dragging
359
+ &--visible {
360
+ visibility: visible;
361
+ opacity: 1;
362
+ transition: opacity 0.2s ease, visibility 0s;
363
+ }
364
+ }
365
+
366
+ // Vertical orientation
367
+ &--vertical {
368
+ width: 40px;
369
+ height: 200px;
370
+ flex-direction: column;
371
+
372
+ .#{$component}-track {
373
+ width: 16px;
374
+ height: 100%;
375
+ padding: 0;
376
+ }
377
+
378
+ .#{$component}-active-track {
379
+ width: 100%;
380
+ height: auto;
381
+ transform-origin: bottom center;
382
+ }
383
+
384
+ .#{$component}-start-track {
385
+ width: 100%;
386
+ height: auto;
387
+ transform-origin: bottom center;
388
+ }
389
+
390
+ .#{$component}-remaining-track {
391
+ width: 100%;
392
+ bottom: auto;
393
+ top: 0;
394
+ transform-origin: bottom center;
395
+ }
396
+
397
+ // Reorient thumb for vertical slider
398
+ .#{$component}-thumb {
399
+ &::before {
400
+ width: 40px;
401
+ height: 4px;
402
+ }
403
+
404
+ &::after {
405
+ width: 16px;
406
+ height: 16px;
407
+ top: 50%;
408
+ left: 0;
409
+ transform: translate(0, -50%);
410
+ }
411
+
412
+ transform: translate(-50%, 50%);
413
+ }
414
+
415
+ // Dots for vertical orientation
416
+ .#{$component}-dot {
417
+ left: 50%;
418
+ top: auto;
419
+ transform: translateX(-50%);
420
+
421
+ &--start {
422
+ bottom: 0;
423
+ }
424
+
425
+ &--end {
426
+ top: 0;
427
+ }
428
+ }
429
+
430
+ .#{$component}-tick {
431
+ left: 50%;
432
+ transform: translate(-50%, 50%);
433
+ }
434
+
435
+ .#{$component}-label {
436
+ top: auto;
437
+ left: 35px;
438
+ transform: translateY(50%);
439
+ }
440
+
441
+ .#{$component}-value {
442
+ top: auto;
443
+ left: -55px;
444
+ transform: translateY(50%);
445
+ }
446
+ }
447
+
448
+ // Discrete slider with steps
449
+ &--discrete {
450
+ .#{$component}-tick {
451
+ width: 4px;
452
+ height: 4px;
453
+ }
454
+ }
455
+
456
+ // Sizes
457
+ &--small {
458
+ height: 32px;
459
+
460
+ .#{$component}-thumb {
461
+ &::before {
462
+ height: 34px;
463
+ }
464
+
465
+ &::after {
466
+ width: 14px;
467
+ height: 14px;
468
+ }
469
+ }
470
+
471
+ &.#{$component}--vertical {
472
+ width: 32px;
473
+
474
+ .#{$component}-thumb {
475
+ &::before {
476
+ width: 34px;
477
+ height: 3px;
478
+ }
479
+
480
+ &::after {
481
+ width: 14px;
482
+ height: 14px;
483
+ }
484
+ }
485
+ }
486
+ }
487
+
488
+ &--large {
489
+ height: 48px;
490
+
491
+ .#{$component}-thumb {
492
+ &::before {
493
+ height: 48px;
494
+ }
495
+
496
+ &::after {
497
+ width: 18px;
498
+ height: 18px;
499
+ }
500
+ }
501
+
502
+ &.#{$component}--vertical {
503
+ width: 48px;
504
+
505
+ .#{$component}-thumb {
506
+ &::before {
507
+ width: 48px;
508
+ height: 4px;
509
+ }
510
+
511
+ &::after {
512
+ width: 18px;
513
+ height: 18px;
514
+ }
515
+ }
516
+ }
517
+ }
518
+ }