mtrl 0.0.3 → 0.1.2

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 (45) hide show
  1. package/package.json +1 -1
  2. package/src/components/button/styles.scss +198 -161
  3. package/src/components/checkbox/checkbox.js +3 -2
  4. package/src/components/checkbox/styles.scss +105 -55
  5. package/src/components/container/styles.scss +65 -58
  6. package/src/components/list/constants.js +0 -5
  7. package/src/components/list/list-item.js +12 -4
  8. package/src/components/list/list.js +11 -19
  9. package/src/components/list/styles.scss +240 -11
  10. package/src/components/menu/styles.scss +37 -30
  11. package/src/components/navigation/styles.scss +406 -6
  12. package/src/components/snackbar/styles.scss +46 -17
  13. package/src/components/switch/styles.scss +93 -46
  14. package/src/components/textfield/styles.scss +351 -5
  15. package/src/core/build/_ripple.scss +79 -0
  16. package/src/core/dom/create.js +0 -1
  17. package/src/core/layout/index.js +3 -1
  18. package/src/styles/abstract/_mixins.scss +9 -7
  19. package/src/styles/abstract/_theme.scss +157 -0
  20. package/src/styles/abstract/_variables.scss +72 -6
  21. package/src/styles/base/_reset.scss +86 -0
  22. package/src/styles/base/_typography.scss +155 -0
  23. package/src/styles/main.scss +104 -57
  24. package/src/styles/themes/_autumn.scss +81 -0
  25. package/src/styles/themes/_base-theme.scss +2 -27
  26. package/src/styles/themes/_baseline.scss +64 -39
  27. package/src/styles/themes/_forest.scss +46 -46
  28. package/src/styles/themes/_spring.scss +71 -0
  29. package/src/styles/themes/_summer.scss +82 -0
  30. package/src/styles/themes/_winter.scss +71 -0
  31. package/src/styles/utilities/_color.scss +154 -0
  32. package/src/styles/utilities/_flexbox.scss +194 -0
  33. package/src/styles/utilities/_spacing.scss +139 -0
  34. package/src/styles/utilities/_typography.scss +178 -0
  35. package/src/styles/utilities/_visibility.scss +142 -0
  36. package/src/components/list/styles/_list-item.scss +0 -142
  37. package/src/components/list/styles/_list.scss +0 -89
  38. package/src/components/list/styles/_variables.scss +0 -13
  39. package/src/components/navigation/styles/_bar.scss +0 -51
  40. package/src/components/navigation/styles/_base.scss +0 -129
  41. package/src/components/navigation/styles/_drawer.scss +0 -169
  42. package/src/components/navigation/styles/_rail.scss +0 -65
  43. package/src/components/textfield/styles/base.scss +0 -107
  44. package/src/components/textfield/styles/filled.scss +0 -58
  45. package/src/components/textfield/styles/outlined.scss +0 -66
@@ -1,6 +1,406 @@
1
- // src/components/navigation/styles.scss
2
- @use '../../styles/abstract/config' as c;
3
- @use 'styles/base';
4
- @use 'styles/rail';
5
- @use 'styles/drawer';
6
- @use 'styles/bar';
1
+ // src/components/navigation/_navigation.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}-nav';
9
+
10
+ // BASE STYLES
11
+ .#{$component} {
12
+ display: flex;
13
+ position: relative;
14
+ background-color: t.color('surface-container');
15
+
16
+ // Base nav item styles
17
+ &-item {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ position: relative;
22
+ border: none;
23
+ background: none;
24
+ cursor: pointer;
25
+ padding: 12px;
26
+ gap: 12px;
27
+ color: t.color('on-surface-variant');
28
+ @include m.motion-transition(all);
29
+
30
+ &-icon {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ width: 24px;
35
+ height: 24px;
36
+ color: inherit;
37
+ border-radius: 50%;
38
+ padding: 8px;
39
+
40
+ svg {
41
+ width: 24px;
42
+ height: 24px;
43
+ fill: currentColor;
44
+ }
45
+ }
46
+
47
+ &--active {
48
+ color: t.color('primary');
49
+ }
50
+
51
+ &-label {
52
+ @include m.typography('label-large');
53
+ @include m.motion-transition(opacity);
54
+ }
55
+
56
+ &-badge {
57
+ position: absolute;
58
+ top: 8px;
59
+ right: 8px;
60
+ min-width: 16px;
61
+ height: 16px;
62
+ padding: 0 4px;
63
+ border-radius: 8px;
64
+ background-color: t.color('error');
65
+ color: t.color('on-error');
66
+ @include m.typography('label-small');
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ }
71
+ }
72
+
73
+ // Navigation positions
74
+ &--left {
75
+ left: 0;
76
+ }
77
+
78
+ &--right {
79
+ right: 0;
80
+ }
81
+
82
+ &--top {
83
+ top: 0;
84
+ }
85
+
86
+ &--bottom {
87
+ bottom: 0;
88
+ }
89
+
90
+ // States
91
+ &--disabled {
92
+ opacity: 0.38;
93
+ pointer-events: none;
94
+ }
95
+
96
+ // RTL Support
97
+ @include m.rtl {
98
+ &--left {
99
+ right: 0;
100
+ left: auto;
101
+ }
102
+
103
+ &--right {
104
+ left: 0;
105
+ right: auto;
106
+ }
107
+
108
+ .#{$component}-item {
109
+ &-badge {
110
+ right: auto;
111
+ left: 8px;
112
+ }
113
+ }
114
+ }
115
+
116
+ // Motion
117
+ @include m.reduced-motion {
118
+ &-item,
119
+ &-item-label {
120
+ transition: none;
121
+ }
122
+ }
123
+
124
+ // High contrast
125
+ @include m.high-contrast {
126
+ border: 1px solid currentColor;
127
+
128
+ &-item {
129
+ &--active {
130
+ outline: 2px solid currentColor;
131
+ outline-offset: -2px;
132
+ }
133
+ }
134
+ }
135
+
136
+ // BAR NAVIGATION
137
+ &--bar {
138
+ flex-direction: row;
139
+ width: 100%;
140
+ height: 80px;
141
+ padding: 0 12px;
142
+ justify-content: space-around;
143
+
144
+ .#{$component}-item {
145
+ flex: 1;
146
+ flex-direction: column;
147
+ height: 100%;
148
+ max-width: 168px;
149
+ gap: 4px;
150
+
151
+ &:hover {
152
+ .#{$component}-item-icon {
153
+ @include m.state-layer(t.color('on-surface'), 'hover');
154
+ }
155
+ }
156
+
157
+ &--active {
158
+ .#{$component}-item-icon {
159
+ background-color: t.color('secondary-container');
160
+ }
161
+ }
162
+
163
+ &-icon {
164
+ margin-bottom: 4px;
165
+ padding: 16px;
166
+ @include m.motion-transition(background-color);
167
+ }
168
+
169
+ &-label {
170
+ @include m.typography('label-medium');
171
+ text-align: center;
172
+ }
173
+
174
+ &-badge {
175
+ top: 4px;
176
+ right: 50%;
177
+ transform: translateX(12px);
178
+ }
179
+ }
180
+ }
181
+
182
+ // RAIL NAVIGATION
183
+ &--rail {
184
+ flex-direction: column;
185
+ width: 80px;
186
+ height: 100%;
187
+ padding: 12px 0;
188
+
189
+ .#{$component}-item {
190
+ flex-direction: column;
191
+ width: 100%;
192
+ min-height: 56px;
193
+ padding: 2px;
194
+ margin: -2px auto 14px;
195
+ gap: 0;
196
+
197
+ &:hover {
198
+ .#{$component}-item-icon {
199
+ @include m.state-layer(t.color('on-surface'), 'hover');
200
+ }
201
+ }
202
+
203
+ &--active {
204
+ .#{$component}-item-icon {
205
+ background-color: t.color('secondary-container');
206
+ }
207
+ }
208
+
209
+ &-icon {
210
+ margin-bottom: 4px;
211
+ padding: 8px;
212
+ width: 56px;
213
+ height: 32px;
214
+ display: flex;
215
+ align-items: center;
216
+ justify-content: center;
217
+ border-radius: 16px;
218
+ @include m.motion-transition(background-color);
219
+
220
+ svg {
221
+ width: 24px;
222
+ height: 24px;
223
+ fill: currentColor;
224
+ }
225
+ }
226
+
227
+ &-label {
228
+ @include m.typography('label-small');
229
+ text-align: center;
230
+ color: inherit;
231
+ font-size: 12px;
232
+ line-height: 16px;
233
+ }
234
+
235
+ &-badge {
236
+ top: 4px;
237
+ right: 16px;
238
+ }
239
+ }
240
+ }
241
+
242
+ // DRAWER NAVIGATION STYLES (BOTH MODAL AND STANDARD)
243
+ &--drawer,
244
+ &--drawer-modal,
245
+ &--drawer-standard {
246
+ flex-direction: column;
247
+ width: 256px;
248
+ height: 100%;
249
+ padding: 12px 0;
250
+ transition: transform v.motion('duration-short2') v.motion('easing-standard');
251
+ transform: translateX(0);
252
+
253
+ // Hidden state
254
+ &.#{$component}--hidden {
255
+ transform: translateX(-100%);
256
+
257
+ @include m.rtl {
258
+ transform: translateX(100%);
259
+ }
260
+ }
261
+
262
+ // Item container for nesting
263
+ .#{$component}-item-container {
264
+ width: 100%;
265
+ display: flex;
266
+ flex-direction: column;
267
+ }
268
+
269
+ // Base nav item styles
270
+ .#{$component}-item {
271
+ padding: 12px 16px;
272
+ align-items: center;
273
+ justify-content: flex-start;
274
+ border-radius: 28px;
275
+ margin: 0 12px;
276
+ width: calc(100% - 24px);
277
+
278
+ &:hover {
279
+ @include m.state-layer(t.color('on-surface'), 'hover');
280
+ }
281
+
282
+ &--active {
283
+ background-color: t.color('secondary-container');
284
+ color: t.color('on-secondary-container');
285
+
286
+ &:hover {
287
+ background-color: t.color('secondary-container');
288
+ }
289
+ }
290
+
291
+ &-icon {
292
+ margin-right: 12px;
293
+ flex-shrink: 0;
294
+ }
295
+
296
+ &-label {
297
+ @include m.typography('label-large');
298
+ flex-grow: 1;
299
+ text-align: left;
300
+ }
301
+
302
+ &-badge {
303
+ position: static;
304
+ margin-left: auto;
305
+ margin-right: 8px;
306
+ }
307
+ }
308
+
309
+ // Nested navigation styles
310
+ .#{$component}-nested-container {
311
+ display: flex;
312
+ flex-direction: column;
313
+ width: 100%;
314
+ margin-left: 28px;
315
+ padding-right: 12px;
316
+
317
+ &[hidden] {
318
+ display: none;
319
+ }
320
+
321
+ // Adjust nested items styles
322
+ .#{$component}-item {
323
+ margin: 0;
324
+ padding: 8px 16px;
325
+ font-size: 14px;
326
+
327
+ &-icon {
328
+ width: 20px;
329
+ height: 20px;
330
+ padding: 6px;
331
+
332
+ svg {
333
+ width: 20px;
334
+ height: 20px;
335
+ }
336
+ }
337
+ }
338
+ }
339
+
340
+ // Expand icon styles
341
+ .#{$component}-expand-icon {
342
+ display: flex;
343
+ align-items: center;
344
+ justify-content: center;
345
+ width: 20px;
346
+ height: 20px;
347
+ margin-left: auto;
348
+ color: inherit;
349
+ @include m.motion-transition(transform);
350
+
351
+ svg {
352
+ width: 20px;
353
+ height: 20px;
354
+ fill: none;
355
+ stroke: currentColor;
356
+ stroke-width: 2px;
357
+ }
358
+ }
359
+
360
+ // RTL support
361
+ @include m.rtl {
362
+ .#{$component}-item {
363
+ &-icon {
364
+ margin-right: 0;
365
+ margin-left: 12px;
366
+ }
367
+
368
+ &-label {
369
+ text-align: right;
370
+ }
371
+
372
+ &-badge {
373
+ margin-left: 8px;
374
+ margin-right: auto;
375
+ }
376
+ }
377
+
378
+ .#{$component}-nested-container {
379
+ margin-left: 0;
380
+ margin-right: 28px;
381
+ padding-right: 0;
382
+ padding-left: 12px;
383
+ }
384
+
385
+ .#{$component}-expand-icon {
386
+ margin-left: 0;
387
+ margin-right: auto;
388
+ transform: scaleX(-1);
389
+ }
390
+ }
391
+ }
392
+
393
+ // Specific drawer variants
394
+ &--drawer-modal {
395
+ @include m.elevation(2);
396
+ }
397
+
398
+ &--drawer-standard {
399
+ border-right: 1px solid t.color('outline-variant');
400
+
401
+ @include m.rtl {
402
+ border-right: none;
403
+ border-left: 1px solid t.color('outline-variant');
404
+ }
405
+ }
406
+ }
@@ -1,9 +1,13 @@
1
- // src/components/snackbar/styles.scss
2
- @use 'sass:map';
3
- @use '../../styles/abstract/mixins' as m;
1
+ // src/components/snackbar/_snackbar.scss
2
+ @use '../../styles/abstract/base' as base;
4
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;
5
7
 
6
- .#{v.$prefix}-snackbar {
8
+ $component: '#{base.$prefix}-snackbar';
9
+
10
+ .#{$component} {
7
11
  // Base styles following modern minimal design
8
12
  @include m.typography('body-medium');
9
13
  position: fixed;
@@ -12,26 +16,29 @@
12
16
  justify-content: space-between;
13
17
  min-width: 280px;
14
18
  max-width: 480px;
15
- padding: 12px 16px;
19
+ padding: 14px 16px;
16
20
  gap: 12px;
17
21
 
18
22
  // Updated colors and appearance
19
23
  background-color: rgba(32, 33, 36, 0.9);
20
24
  color: rgb(255, 255, 255);
21
- border-radius: 4px;
25
+ border-radius: f.get-shape('extra-small');
22
26
  backdrop-filter: blur(8px);
23
27
 
24
28
  // Animation setup - separated properties for better transitions
25
29
  opacity: 0;
26
30
  transform: translateY(20px);
27
31
  transition:
28
- opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),
29
- transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
32
+ opacity v.motion('duration-short2') v.motion('easing-standard'),
33
+ transform v.motion('duration-short2') v.motion('easing-standard');
30
34
 
31
- z-index: var(--mtrl-sys-z-index-snackbar);
35
+ // Using a fixed z-index since 'snackbar' isn't defined in z-index tokens
36
+ z-index: f.get-z-index('popover');
32
37
  pointer-events: none;
33
38
  will-change: transform, opacity;
34
39
 
40
+ @include m.elevation(2);
41
+
35
42
  // Message text styles
36
43
  &-text {
37
44
  @include m.truncate(1);
@@ -44,17 +51,18 @@
44
51
  &-action {
45
52
  @include m.typography('label-large');
46
53
  padding: 8px 12px;
47
- margin: -8px -12px;
54
+ margin: -8px -10px -8px -4px;
55
+ // margin-left: 4px;
48
56
  color: rgb(138, 180, 248);
49
57
  background: none;
50
58
  border: none;
51
- border-radius: 4px;
59
+ border-radius: f.get-shape('extra-small');
52
60
  cursor: pointer;
53
61
  font-weight: 500;
54
62
  font-size: 14px;
55
63
  text-transform: capitalize;
56
64
  white-space: nowrap;
57
- transition: background-color 150ms ease;
65
+ @include m.motion-transition(background-color);
58
66
 
59
67
  &:hover {
60
68
  background-color: rgba(138, 180, 248, 0.08);
@@ -129,12 +137,12 @@
129
137
  opacity: 1;
130
138
  pointer-events: auto;
131
139
 
132
- &.#{v.$prefix}-snackbar--start,
133
- &.#{v.$prefix}-snackbar--end {
140
+ &.#{$component}--start,
141
+ &.#{$component}--end {
134
142
  transform: translateY(0);
135
143
  }
136
144
 
137
- &.#{v.$prefix}-snackbar--center {
145
+ &.#{$component}--center {
138
146
  transform: translate(-50%, 0);
139
147
  }
140
148
  }
@@ -144,11 +152,32 @@
144
152
  padding-top: 14px;
145
153
  padding-bottom: 14px;
146
154
 
147
- .#{v.$prefix}-snackbar-text {
155
+ .#{$component}-text {
148
156
  @include m.truncate(2);
149
157
  }
150
158
  }
151
159
 
160
+ // Color variants
161
+ &--primary {
162
+ background-color: t.alpha('primary', 0.9);
163
+
164
+ .#{$component}-action {
165
+ color: t.color('on-primary');
166
+
167
+ &:hover {
168
+ background-color: t.alpha('on-primary', 0.08);
169
+ }
170
+
171
+ &:active {
172
+ background-color: t.alpha('on-primary', 0.12);
173
+ }
174
+
175
+ &:focus-visible {
176
+ outline-color: t.color('on-primary');
177
+ }
178
+ }
179
+ }
180
+
152
181
  // Accessibility
153
182
  @include m.reduced-motion {
154
183
  transition: none;
@@ -157,7 +186,7 @@
157
186
  &--visible {
158
187
  transform: none;
159
188
 
160
- &.#{v.$prefix}-snackbar--center {
189
+ &.#{$component}--center {
161
190
  transform: translateX(-50%);
162
191
  }
163
192
  }