mtrl 0.5.2 → 0.5.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 (69) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/package.json +1 -1
  4. package/dist/styles.css +1 -1
  5. package/package.json +3 -2
  6. package/src/styles/abstract/_base.scss +2 -0
  7. package/src/styles/abstract/_config.scss +28 -0
  8. package/src/styles/abstract/_functions.scss +124 -0
  9. package/src/styles/abstract/_mixins.scss +401 -0
  10. package/src/styles/abstract/_theme.scss +269 -0
  11. package/src/styles/abstract/_variables.scss +338 -0
  12. package/src/styles/base/_reset.scss +86 -0
  13. package/src/styles/base/_typography.scss +155 -0
  14. package/src/styles/components/_badge.scss +183 -0
  15. package/src/styles/components/_bottom-app-bar.scss +103 -0
  16. package/src/styles/components/_button.scss +756 -0
  17. package/src/styles/components/_card.scss +401 -0
  18. package/src/styles/components/_carousel.scss +645 -0
  19. package/src/styles/components/_checkbox.scss +231 -0
  20. package/src/styles/components/_chips.scss +639 -0
  21. package/src/styles/components/_datepicker.scss +358 -0
  22. package/src/styles/components/_dialog.scss +259 -0
  23. package/src/styles/components/_divider.scss +57 -0
  24. package/src/styles/components/_extended-fab.scss +309 -0
  25. package/src/styles/components/_fab.scss +244 -0
  26. package/src/styles/components/_list.scss +774 -0
  27. package/src/styles/components/_menu.scss +245 -0
  28. package/src/styles/components/_navigation-mobile.scss +244 -0
  29. package/src/styles/components/_navigation-system.scss +151 -0
  30. package/src/styles/components/_navigation.scss +407 -0
  31. package/src/styles/components/_progress.scss +101 -0
  32. package/src/styles/components/_radios.scss +187 -0
  33. package/src/styles/components/_search.scss +306 -0
  34. package/src/styles/components/_segmented-button.scss +227 -0
  35. package/src/styles/components/_select.scss +274 -0
  36. package/src/styles/components/_sheet.scss +236 -0
  37. package/src/styles/components/_slider.scss +264 -0
  38. package/src/styles/components/_snackbar.scss +211 -0
  39. package/src/styles/components/_switch.scss +305 -0
  40. package/src/styles/components/_tabs.scss +421 -0
  41. package/src/styles/components/_textfield.scss +1024 -0
  42. package/src/styles/components/_timepicker.scss +451 -0
  43. package/src/styles/components/_tooltip.scss +241 -0
  44. package/src/styles/components/_top-app-bar.scss +225 -0
  45. package/src/styles/main.scss +129 -0
  46. package/src/styles/themes/_autumn.scss +105 -0
  47. package/src/styles/themes/_base-theme.scss +85 -0
  48. package/src/styles/themes/_baseline.scss +173 -0
  49. package/src/styles/themes/_bluekhaki.scss +125 -0
  50. package/src/styles/themes/_brownbeige.scss +125 -0
  51. package/src/styles/themes/_browngreen.scss +125 -0
  52. package/src/styles/themes/_forest.scss +77 -0
  53. package/src/styles/themes/_greenbeige.scss +125 -0
  54. package/src/styles/themes/_index.scss +19 -0
  55. package/src/styles/themes/_material.scss +125 -0
  56. package/src/styles/themes/_ocean.scss +77 -0
  57. package/src/styles/themes/_sageivory.scss +125 -0
  58. package/src/styles/themes/_spring.scss +77 -0
  59. package/src/styles/themes/_summer.scss +87 -0
  60. package/src/styles/themes/_sunset.scss +60 -0
  61. package/src/styles/themes/_tealcaramel.scss +125 -0
  62. package/src/styles/themes/_winter.scss +77 -0
  63. package/src/styles/utilities/_colors.scss +154 -0
  64. package/src/styles/utilities/_flexbox.scss +194 -0
  65. package/src/styles/utilities/_layout.scss +665 -0
  66. package/src/styles/utilities/_ripple.scss +79 -0
  67. package/src/styles/utilities/_spacing.scss +139 -0
  68. package/src/styles/utilities/_typography.scss +178 -0
  69. package/src/styles/utilities/_visibility.scss +142 -0
@@ -0,0 +1,639 @@
1
+ // src/styles/components/_chips.scss
2
+ @use '../abstract/base' as base;
3
+ @use '../abstract/variables' as v;
4
+ @use '../abstract/functions' as f;
5
+ @use '../abstract/mixins' as m;
6
+ @use '../abstract/theme' as t;
7
+
8
+ $component: '#{base.$prefix}-chip';
9
+ $container: '#{base.$prefix}-chips';
10
+
11
+ // Chip component styling
12
+ .#{$component} {
13
+ // Base styles
14
+ position: relative;
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ height: v.chip('height');
19
+ padding: 0 v.chip('padding-horizontal');
20
+ border-radius: v.chip('border-radius');
21
+ background-color: transparent;
22
+ max-width: 100%;
23
+ user-select: none;
24
+ cursor: pointer;
25
+
26
+ // Typography
27
+ @include m.typography('label-large');
28
+
29
+ // Enhanced transition for width changes
30
+ transition: background-color v.motion('duration-short4') v.motion('easing-standard'),
31
+ color v.motion('duration-short4') v.motion('easing-standard'),
32
+ // border-color v.motion('duration-short4') v.motion('easing-standard'),
33
+ box-shadow v.motion('duration-short4') v.motion('easing-standard'),
34
+ // padding v.motion('duration-short4') v.motion('easing-standard'),
35
+ width v.motion('duration-short4') v.motion('easing-standard');
36
+
37
+ // Focus styles
38
+ &:focus {
39
+ outline: none;
40
+ }
41
+
42
+ &:focus-visible {
43
+ outline: 2px solid t.color('outline');
44
+ outline-offset: 2px;
45
+ }
46
+
47
+ // Active state - applied when the chip has a menu open
48
+ &--active {
49
+ // Base active state styling
50
+ // Will use variant-specific implementations below
51
+
52
+ // ARIA attribute to indicate active state for accessibility
53
+ &[aria-expanded="true"] {
54
+ // For compatibility with ARIA
55
+ }
56
+ }
57
+
58
+ // Disabled state
59
+ &--disabled {
60
+ opacity: 0.38;
61
+ pointer-events: none;
62
+ }
63
+
64
+ // Content container
65
+ &-content {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ width: 100%;
70
+ height: 100%;
71
+ gap: v.spacing('2');
72
+ }
73
+
74
+ // Ensure proper layout with icons - independent of scrollable state
75
+ &-leading-icon,
76
+ &-trailing-icon {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ min-width: v.chip('icon-size');
81
+ height: v.chip('icon-size');
82
+ flex-shrink: 0;
83
+ position: relative; // Add this to ensure stable positioning
84
+
85
+ svg {
86
+ width: v.chip('icon-size');
87
+ height: v.chip('icon-size');
88
+ }
89
+ }
90
+
91
+ &-leading-icon {
92
+ margin-right: 0; // Gap is handled by the content container
93
+ }
94
+
95
+ &-trailing-icon {
96
+ margin-left: 0; // Gap is handled by the content container
97
+
98
+ &:hover {
99
+ opacity: 0.8;
100
+ }
101
+ }
102
+
103
+ &-text {
104
+ // Allow text to display normally
105
+ white-space: nowrap;
106
+ overflow: visible;
107
+ }
108
+
109
+ // Selected state (base)
110
+ &--selected {
111
+ font-weight: 500;
112
+ }
113
+
114
+ // Ripple container - state layers for interaction feedback
115
+ .ripple {
116
+ position: absolute;
117
+ border-radius: 50%;
118
+ transform: scale(0);
119
+ pointer-events: none;
120
+ background-color: currentColor;
121
+ opacity: 0.12;
122
+ }
123
+
124
+ // ====== CHIP VARIANTS ======
125
+
126
+ // Filled chip
127
+ &--filled {
128
+ background-color: t.color('surface-container-highest');
129
+ color: t.color('on-surface');
130
+
131
+ &:hover::after {
132
+ content: '';
133
+ position: absolute;
134
+ inset: 0;
135
+ background-color: t.color('on-surface');
136
+ opacity: 0.08;
137
+ pointer-events: none;
138
+ border-radius: v.chip('border-radius');
139
+ }
140
+
141
+ &:active::after,
142
+ &.#{$component}--active::after {
143
+ content: '';
144
+ position: absolute;
145
+ inset: 0;
146
+ background-color: t.color('on-surface');
147
+ opacity: 0.12;
148
+ pointer-events: none;
149
+ border-radius: inherit;
150
+ }
151
+
152
+ &.#{$component}--selected {
153
+ background-color: t.color('secondary-container');
154
+ color: t.color('on-secondary-container');
155
+
156
+ &:hover::after {
157
+ content: '';
158
+ position: absolute;
159
+ inset: 0;
160
+ background-color: t.color('on-secondary-container');
161
+ opacity: 0.08;
162
+ pointer-events: none;
163
+ border-radius: inherit;
164
+ }
165
+
166
+ &:active::after,
167
+ &.#{$component}--active::after {
168
+ content: '';
169
+ position: absolute;
170
+ inset: 0;
171
+ background-color: t.color('on-secondary-container');
172
+ opacity: 0.12;
173
+ pointer-events: none;
174
+ border-radius: inherit;
175
+ }
176
+ }
177
+ }
178
+
179
+ // Outlined chip
180
+ &--outlined {
181
+ border: 1px solid t.alpha('outline', v.chip('outlined-border-opacity'));
182
+ color: t.color('on-surface');
183
+
184
+ &:hover::after {
185
+ content: '';
186
+ position: absolute;
187
+ inset: 0;
188
+ background-color: t.color('on-surface');
189
+ opacity: 0.08;
190
+ pointer-events: none;
191
+ border-radius: inherit;
192
+ }
193
+
194
+ &:focus-visible {
195
+ border-color: t.alpha('outline', v.chip('outlined-border-focus-opacity'));
196
+ }
197
+
198
+ &:active::after,
199
+ &.#{$component}--active::after {
200
+ content: '';
201
+ position: absolute;
202
+ inset: 0;
203
+ background-color: t.color('on-surface');
204
+ opacity: 0.12;
205
+ pointer-events: none;
206
+ border-radius: inherit;
207
+ }
208
+
209
+ &.#{$component}--selected {
210
+ border-color: transparent;
211
+ background-color: t.color('secondary-container');
212
+ color: t.color('on-secondary-container');
213
+
214
+ &:hover::after {
215
+ content: '';
216
+ position: absolute;
217
+ inset: 0;
218
+ background-color: t.color('on-secondary-container');
219
+ opacity: 0.08;
220
+ pointer-events: none;
221
+ border-radius: inherit;
222
+ }
223
+
224
+ &:active::after,
225
+ &.#{$component}--active::after {
226
+ content: '';
227
+ position: absolute;
228
+ inset: 0;
229
+ background-color: t.color('on-secondary-container');
230
+ opacity: 0.12;
231
+ pointer-events: none;
232
+ border-radius: inherit;
233
+ }
234
+ }
235
+ }
236
+
237
+ // Elevated chip
238
+ &--elevated {
239
+ background-color: t.color('surface-container-low');
240
+ color: t.color('on-surface');
241
+ box-shadow: f.get-elevation(1);
242
+
243
+ &:hover::after {
244
+ content: '';
245
+ position: absolute;
246
+ inset: 0;
247
+ background-color: t.color('on-surface');
248
+ opacity: 0.08;
249
+ pointer-events: none;
250
+ border-radius: inherit;
251
+ }
252
+
253
+ &:active::after,
254
+ &.#{$component}--active::after {
255
+ content: '';
256
+ position: absolute;
257
+ inset: 0;
258
+ background-color: t.color('on-surface');
259
+ opacity: 0.12;
260
+ pointer-events: none;
261
+ border-radius: inherit;
262
+ }
263
+
264
+ &.#{$component}--selected {
265
+ background-color: t.color('secondary-container');
266
+ color: t.color('on-secondary-container');
267
+
268
+ &:hover::after {
269
+ content: '';
270
+ position: absolute;
271
+ inset: 0;
272
+ background-color: t.color('on-secondary-container');
273
+ opacity: 0.08;
274
+ pointer-events: none;
275
+ border-radius: inherit;
276
+ }
277
+
278
+ &:active::after,
279
+ &.#{$component}--active::after {
280
+ content: '';
281
+ position: absolute;
282
+ inset: 0;
283
+ background-color: t.color('on-secondary-container');
284
+ opacity: 0.12;
285
+ pointer-events: none;
286
+ border-radius: inherit;
287
+ }
288
+ }
289
+ }
290
+
291
+ // Filter chip
292
+ &--filter {
293
+ color: t.color('on-surface');
294
+ position: relative;
295
+ border: 1px solid t.alpha('outline', v.chip('outlined-border-opacity'));
296
+
297
+ // Hover state for unselected chips
298
+ &:hover::after {
299
+ content: '';
300
+ position: absolute;
301
+ inset: 0;
302
+ background-color: t.color('on-surface');
303
+ opacity: 0.08;
304
+ pointer-events: none;
305
+ border-radius: calc(v.chip('border-radius') - 1px);
306
+ }
307
+
308
+ &:active::after,
309
+ &.#{$component}--active::after {
310
+ content: '';
311
+ position: absolute;
312
+ inset: 0;
313
+ background-color: t.color('on-surface');
314
+ opacity: 0.12;
315
+ pointer-events: none;
316
+ border-radius: calc(v.chip('border-radius') - 1px);
317
+ }
318
+
319
+ &.#{$component}--selected {
320
+
321
+ padding-left: 8px;
322
+ background-color: t.color('secondary-container');
323
+ color: t.color('on-secondary-container');
324
+ --checkmark-color: currentColor; // Will inherit from text color
325
+ border: none;
326
+ .#{$component}-leading-icon {
327
+ color: t.color('on-secondary-container');
328
+ }
329
+
330
+ // Use ::before exclusively for the checkmark icon with mask technique
331
+ &::before {
332
+ content: '';
333
+ display: inline-block;
334
+ width: 18px;
335
+ height: 18px;
336
+ background-color: var(--checkmark-color);
337
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
338
+ mask-position: center;
339
+ mask-repeat: no-repeat;
340
+ mask-size: contain;
341
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
342
+ -webkit-mask-position: center;
343
+ -webkit-mask-repeat: no-repeat;
344
+ -webkit-mask-size: contain;
345
+ margin-right: 8px;
346
+ flex-shrink: 0;
347
+ position: static;
348
+ animation: checkmark-appear v.motion('duration-short4') v.motion('easing-emphasized') forwards;
349
+ }
350
+
351
+ // Hover state for selected chips
352
+ &:hover::after {
353
+ content: '';
354
+ position: absolute;
355
+ inset: 0;
356
+ background-color: t.color('on-secondary-container');
357
+ opacity: 0.08;
358
+ pointer-events: none;
359
+ border-radius: calc(v.chip('border-radius') - 1px);
360
+ }
361
+
362
+ &:active::after,
363
+ &.#{$component}--active::after {
364
+ content: '';
365
+ position: absolute;
366
+ inset: 0;
367
+ background-color: t.color('on-secondary-container');
368
+ opacity: 0.12;
369
+ pointer-events: none;
370
+ border-radius: calc(v.chip('border-radius') - 1px);
371
+ }
372
+ }
373
+ }
374
+
375
+ // Assist chip
376
+ &--assist {
377
+ background-color: t.color('surface-container-low');
378
+ color: t.color('on-surface');
379
+
380
+ .#{$component}-leading-icon {
381
+ color: t.color('primary');
382
+ }
383
+
384
+ &:hover::after {
385
+ content: '';
386
+ position: absolute;
387
+ inset: 0;
388
+ background-color: t.color('on-surface');
389
+ opacity: 0.08;
390
+ pointer-events: none;
391
+ border-radius: v.chip('border-radius');
392
+ }
393
+
394
+ &:active::after,
395
+ &.#{$component}--active::after {
396
+ content: '';
397
+ position: absolute;
398
+ inset: 0;
399
+ background-color: t.color('on-surface');
400
+ opacity: 0.12;
401
+ pointer-events: none;
402
+ border-radius: v.chip('border-radius');
403
+ }
404
+
405
+ &.#{$component}--selected {
406
+ background-color: t.color('secondary-container');
407
+ color: t.color('on-secondary-container');
408
+
409
+ .#{$component}-leading-icon {
410
+ color: t.color('on-secondary-container');
411
+ }
412
+
413
+ &:hover::after {
414
+ content: '';
415
+ position: absolute;
416
+ inset: 0;
417
+ background-color: t.color('on-secondary-container');
418
+ opacity: 0.08;
419
+ pointer-events: none;
420
+ border-radius: inherit;
421
+ }
422
+
423
+ &:active::after,
424
+ &.#{$component}--active::after {
425
+ content: '';
426
+ position: absolute;
427
+ inset: 0;
428
+ background-color: t.color('on-secondary-container');
429
+ opacity: 0.12;
430
+ pointer-events: none;
431
+ border-radius: inherit;
432
+ }
433
+ }
434
+ }
435
+
436
+ // Input chip
437
+ &--input {
438
+ background-color: t.color('surface-container-highest');
439
+ color: t.color('on-surface');
440
+ border-radius: v.chip('border-radius');
441
+
442
+ .#{$component}-trailing-icon {
443
+ cursor: pointer;
444
+
445
+ &:hover {
446
+ color: t.color('error');
447
+ }
448
+ }
449
+
450
+ &:hover::after {
451
+ content: '';
452
+ position: absolute;
453
+ inset: 0;
454
+ background-color: t.color('on-surface');
455
+ opacity: 0.08;
456
+ pointer-events: none;
457
+ border-radius: inherit;
458
+ }
459
+
460
+ &:active::after,
461
+ &.#{$component}--active::after {
462
+ content: '';
463
+ position: absolute;
464
+ inset: 0;
465
+ background-color: t.color('on-surface');
466
+ opacity: 0.12;
467
+ pointer-events: none;
468
+ border-radius: inherit;
469
+ }
470
+ }
471
+
472
+ // Suggestion chip
473
+ &--suggestion {
474
+ background-color: t.color('surface-container');
475
+ color: t.color('on-surface');
476
+ height: v.chip('suggestion-height');
477
+
478
+ .#{$component}-leading-icon {
479
+ width: v.chip('suggestion-icon-size');
480
+ height: v.chip('suggestion-icon-size');
481
+
482
+ svg {
483
+ width: v.chip('suggestion-icon-size');
484
+ height: v.chip('suggestion-icon-size');
485
+ }
486
+ }
487
+
488
+ &:hover::after {
489
+ content: '';
490
+ position: absolute;
491
+ inset: 0;
492
+ background-color: t.color('on-surface');
493
+ opacity: 0.08;
494
+ pointer-events: none;
495
+ border-radius: inherit;
496
+ }
497
+
498
+ &:active::after,
499
+ &.#{$component}--active::after {
500
+ content: '';
501
+ position: absolute;
502
+ inset: 0;
503
+ background-color: t.color('on-surface');
504
+ opacity: 0.12;
505
+ pointer-events: none;
506
+ border-radius: inherit;
507
+ }
508
+
509
+ &.#{$component}--selected {
510
+ background-color: t.color('secondary-container');
511
+ color: t.color('on-secondary-container');
512
+
513
+ &:hover::after {
514
+ content: '';
515
+ position: absolute;
516
+ inset: 0;
517
+ background-color: t.color('on-secondary-container');
518
+ opacity: 0.08;
519
+ pointer-events: none;
520
+ border-radius: inherit;
521
+ }
522
+
523
+ &:active::after,
524
+ &.#{$component}--active::after {
525
+ content: '';
526
+ position: absolute;
527
+ inset: 0;
528
+ background-color: t.color('on-secondary-container');
529
+ opacity: 0.12;
530
+ pointer-events: none;
531
+ border-radius: inherit;
532
+ }
533
+ }
534
+ }
535
+ }
536
+
537
+ // Animation for checkmark appearance
538
+ @keyframes checkmark-appear {
539
+ from {
540
+ transform: scale(0);
541
+ opacity: 0;
542
+ }
543
+ to {
544
+ transform: scale(1);
545
+ opacity: 1;
546
+ }
547
+ }
548
+
549
+ // Chips container
550
+ .#{$container} {
551
+ display: flex;
552
+ flex-wrap: wrap;
553
+ gap: v.spacing('2');
554
+ width: 100%;
555
+ min-height: fit-content;
556
+ height: auto;
557
+
558
+ // Label styling
559
+ &-label {
560
+ @include m.typography('label-medium');
561
+ font-size: 18px;
562
+ color: t.color('on-surface-variant');
563
+ margin-bottom: v.spacing('2');
564
+ display: block;
565
+ width: 100%;
566
+ }
567
+
568
+ // Layout with label
569
+ &--with-label {
570
+ display: flex;
571
+ flex-direction: column;
572
+
573
+ // When label is at the end
574
+ &.#{$container}--label-end {
575
+ flex-direction: column-reverse;
576
+
577
+ .#{$container}-label {
578
+ margin-bottom: 0;
579
+ margin-top: v.spacing('2');
580
+ }
581
+ }
582
+ }
583
+
584
+ // Container for chips
585
+ &-container {
586
+ display: flex;
587
+ flex-wrap: wrap;
588
+ gap: v.spacing('2');
589
+ width: 100%;
590
+ }
591
+
592
+ // Important: Scrollable state only affects the container, not the chip icons
593
+ &--scrollable {
594
+ .#{$container}-container {
595
+ flex-wrap: nowrap;
596
+ overflow-x: auto;
597
+ overflow-y: visible; // Don't clip chips vertically
598
+ -webkit-overflow-scrolling: touch;
599
+ scroll-behavior: smooth;
600
+ padding-bottom: v.spacing('2');
601
+
602
+ // Enhanced scrollable behavior
603
+ position: relative;
604
+ white-space: nowrap;
605
+
606
+ // Improved scrollbar styling
607
+ &::-webkit-scrollbar {
608
+ height: 4px;
609
+ }
610
+
611
+ &::-webkit-scrollbar-thumb {
612
+ background-color: t.alpha('on-surface', 0.2);
613
+ border-radius: 4px;
614
+ }
615
+
616
+ &::-webkit-scrollbar-track {
617
+ background-color: t.alpha('on-surface', 0.05);
618
+ border-radius: 4px;
619
+ }
620
+
621
+ // Style for Firefox
622
+ scrollbar-width: thin;
623
+ scrollbar-color: t.alpha('on-surface', 0.2) t.alpha('on-surface', 0.05);
624
+
625
+ // Ensure chip visibility without affecting internal structure
626
+ .#{$component} {
627
+ flex-shrink: 0; // Prevent chips from shrinking
628
+ }
629
+ }
630
+ }
631
+
632
+ &--vertical {
633
+ .#{$container}-container {
634
+ flex-direction: column;
635
+ align-items: flex-start;
636
+ gap: v.spacing('2');
637
+ }
638
+ }
639
+ }