mtrl 0.5.2 → 0.5.4

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