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,19 +1,248 @@
1
- // src/components/list/styles.scss
2
-
3
- // Import core configuration and utilities
4
- @use '../../styles/abstract/config' as c;
1
+ // src/components/list/_list.scss
2
+ @use '../../styles/abstract/base' as base;
3
+ @use '../../styles/abstract/variables' as v;
4
+ @use '../../styles/abstract/functions' as f;
5
5
  @use '../../styles/abstract/mixins' as m;
6
- @use './styles/variables' as v;
7
- @use './styles/list';
8
- @use './styles/list-item';
6
+ @use '../../styles/abstract/theme' as t;
7
+
8
+ // Component variables
9
+ $component: '#{base.$prefix}-list';
10
+ $list-item-height: 48px !default;
11
+ $list-item-dense-height: 40px !default;
12
+ $list-padding: 8px !default;
13
+ $list-item-padding: 16px !default;
14
+ $list-section-padding: 16px !default;
9
15
 
10
16
  // Component-specific mixins
11
17
  @mixin list-item-hover {
12
- @include c.state-layer(v.$list-hover-state-layer-color, 'hover');
18
+ @include m.state-layer(t.color('on-surface'), 'hover');
13
19
  }
14
20
 
15
21
  @mixin list-section-title {
16
- @include c.typography('label-large');
17
- color: v.$list-section-title-color;
18
- padding: v.$list-section-padding v.$list-item-padding 8px;
22
+ @include m.typography('label-large');
23
+ color: t.color('primary');
24
+ padding: $list-section-padding $list-item-padding 8px;
25
+ }
26
+
27
+ // LIST COMPONENT
28
+ .#{$component} {
29
+ display: flex;
30
+ flex-direction: column;
31
+ padding: $list-padding 0;
32
+ min-width: 200px;
33
+ background-color: t.color('surface');
34
+
35
+ // Sections
36
+ &-section {
37
+ display: flex;
38
+ flex-direction: column;
39
+ width: 100%;
40
+
41
+ &:not(:last-child) {
42
+ margin-bottom: $list-padding;
43
+ }
44
+ }
45
+
46
+ &-section-title {
47
+ @include list-section-title;
48
+ }
49
+
50
+ // Dividers
51
+ &-divider {
52
+ height: 1px;
53
+ margin: $list-padding 0;
54
+ background-color: t.color('outline-variant');
55
+ }
56
+
57
+ // Selection states
58
+ &[data-type="single"],
59
+ &[data-type="multi"],
60
+ &[data-type="radio"] {
61
+ .#{$component}-item {
62
+ cursor: pointer;
63
+
64
+ &--selected {
65
+ background-color: t.color('secondary-container');
66
+ color: t.color('on-secondary-container');
67
+
68
+ &:hover {
69
+ background-color: t.color('secondary-container');
70
+ @include m.state-layer(t.color('on-secondary-container'), 'hover');
71
+ }
72
+
73
+ .#{$component}-item-supporting {
74
+ color: t.color('on-secondary-container');
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ // Dense variant
81
+ &--dense {
82
+ .#{$component}-item {
83
+ min-height: $list-item-dense-height;
84
+ }
85
+ }
86
+
87
+ // Disabled state
88
+ &--disabled {
89
+ pointer-events: none;
90
+ opacity: 0.38;
91
+ }
92
+
93
+ // RTL Support
94
+ @include m.rtl {
95
+ .#{$component}-section-title {
96
+ text-align: right;
97
+ }
98
+ }
99
+
100
+ // High contrast mode
101
+ @include m.high-contrast {
102
+ border: 1px solid currentColor;
103
+
104
+ &-divider {
105
+ border-top: 1px solid currentColor;
106
+ background: none;
107
+ }
108
+ }
109
+
110
+ // LIST ITEM STYLES
111
+ &-item {
112
+ display: flex;
113
+ align-items: center;
114
+ min-height: $list-item-height;
115
+ padding: $list-padding $list-item-padding;
116
+ position: relative;
117
+ gap: 16px;
118
+ cursor: pointer;
119
+ color: t.color('on-surface');
120
+ @include m.motion-transition(background-color);
121
+
122
+ &:hover {
123
+ @include list-item-hover;
124
+ }
125
+
126
+ &:focus-visible {
127
+ @include m.state-layer(t.color('on-surface'), 'focus');
128
+ outline: none;
129
+ }
130
+
131
+ &:active {
132
+ @include m.state-layer(t.color('on-surface'), 'pressed');
133
+ }
134
+
135
+ // Content layout
136
+ &-content {
137
+ flex: 1;
138
+ min-width: 0; // Enable text truncation
139
+ display: flex;
140
+ flex-direction: column;
141
+ justify-content: center;
142
+ }
143
+
144
+ // Text elements
145
+ &-text {
146
+ display: flex;
147
+ flex-direction: column;
148
+ gap: 4px;
149
+ }
150
+
151
+ &-overline {
152
+ @include m.typography('label-small');
153
+ color: t.color('on-surface-variant');
154
+ }
155
+
156
+ &-headline {
157
+ @include m.typography('body-large');
158
+ color: t.color('on-surface');
159
+ }
160
+
161
+ &-supporting {
162
+ @include m.typography('body-medium');
163
+ color: t.color('on-surface-variant');
164
+ }
165
+
166
+ &-meta {
167
+ @include m.typography('label-small');
168
+ color: t.color('on-surface-variant');
169
+ margin-top: 4px;
170
+ }
171
+
172
+ // Leading/trailing elements
173
+ &-leading,
174
+ &-trailing {
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: center;
178
+ flex-shrink: 0;
179
+ }
180
+
181
+ &-leading {
182
+ width: 24px;
183
+ height: 24px;
184
+ color: t.color('on-surface-variant');
185
+
186
+ svg {
187
+ width: 100%;
188
+ height: 100%;
189
+ }
190
+ }
191
+
192
+ &-trailing {
193
+ color: t.color('on-surface-variant');
194
+ }
195
+
196
+ // Vertical layout variant
197
+ &.vertical {
198
+ min-height: 72px;
199
+ padding: 12px $list-item-padding;
200
+
201
+ .#{$component}-item {
202
+ &-content {
203
+ flex-direction: column;
204
+ gap: 4px;
205
+ }
206
+
207
+ &-meta {
208
+ margin-top: $list-padding;
209
+ }
210
+ }
211
+ }
212
+
213
+ // States
214
+ &--selected {
215
+ background-color: t.color('secondary-container');
216
+ color: t.color('on-secondary-container');
217
+
218
+ .#{$component}-item {
219
+ &-leading,
220
+ &-trailing {
221
+ color: t.color('on-secondary-container');
222
+ }
223
+ }
224
+ }
225
+
226
+ &--disabled {
227
+ opacity: 0.38;
228
+ pointer-events: none;
229
+ }
230
+
231
+ // RTL Support
232
+ @include m.rtl {
233
+ .#{$component}-item {
234
+ &-text {
235
+ text-align: right;
236
+ }
237
+ }
238
+ }
239
+
240
+ // High contrast mode
241
+ @include m.high-contrast {
242
+ &--selected {
243
+ outline: 2px solid currentColor;
244
+ outline-offset: -2px;
245
+ }
246
+ }
247
+ }
19
248
  }
@@ -1,30 +1,33 @@
1
- // src/components/menu/styles.scss
2
- @use 'sass:map';
3
- @use '../../styles/abstract/config' as c;
4
- @use '../../styles/abstract/mixins' as m;
1
+ // src/components/menu/_menu.scss
2
+ @use '../../styles/abstract/base' as base;
5
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}-menu';
6
9
 
7
- .#{c.$prefix}-menu {
10
+ .#{$component} {
8
11
  // Base styles
9
- @include c.typography('body-medium');
10
- @include c.shape('small');
12
+ @include m.typography('body-medium');
13
+ @include m.shape('extra-small');
11
14
 
12
15
  position: fixed;
13
- z-index: map.get(v.$z-index, 'menu');
16
+ z-index: f.get-z-index('menu');
14
17
  min-width: 112px;
15
18
  max-width: 280px;
16
19
  padding: 8px 0;
17
- background-color: var(--mtrl-sys-color-surface-container);
18
- color: var(--mtrl-sys-color-on-surface);
19
- @include c.elevation(2);
20
+ background-color: t.color('surface-container');
21
+ color: t.color('on-surface');
22
+ @include m.elevation(2);
20
23
 
21
24
  display: none;
22
25
  opacity: 0;
23
26
  transform: scale(0.8);
24
27
  transform-origin: top left;
25
28
  pointer-events: none;
26
- transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
27
- transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
29
+ transition: opacity v.motion('duration-short2') v.motion('easing-standard'),
30
+ transform v.motion('duration-short2') v.motion('easing-standard');
28
31
 
29
32
  &--visible {
30
33
  display: block;
@@ -35,7 +38,7 @@
35
38
 
36
39
  &--submenu {
37
40
  position: absolute;
38
- z-index: map.get(v.$z-index, 'menu') + 1;
41
+ z-index: f.get-z-index('menu') + 1;
39
42
  }
40
43
 
41
44
  // List container
@@ -50,7 +53,7 @@
50
53
 
51
54
  // Menu items
52
55
  &-item {
53
- @include c.typography('body-large');
56
+ @include m.typography('body-large');
54
57
  @include m.flex-row;
55
58
 
56
59
  position: relative;
@@ -58,20 +61,20 @@
58
61
  padding: 12px 16px;
59
62
  cursor: pointer;
60
63
  user-select: none;
61
- color: var(--mtrl-sys-color-on-surface);
62
- transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
64
+ color: t.color('on-surface');
65
+ @include m.motion-transition(background-color);
63
66
 
64
67
  &:hover {
65
- @include c.state-layer(var(--mtrl-sys-color-on-surface), 'hover');
68
+ @include m.state-layer(t.color('on-surface'), 'hover');
66
69
  }
67
70
 
68
71
  &:focus {
69
- @include c.state-layer(var(--mtrl-sys-color-on-surface), 'focus');
72
+ @include m.state-layer(t.color('on-surface'), 'focus');
70
73
  outline: none;
71
74
  }
72
75
 
73
76
  &:active {
74
- @include c.state-layer(var(--mtrl-sys-color-on-surface), 'pressed');
77
+ @include m.state-layer(t.color('on-surface'), 'pressed');
75
78
  }
76
79
 
77
80
  // Submenu indicator
@@ -88,7 +91,7 @@
88
91
  }
89
92
 
90
93
  &[aria-expanded="true"] {
91
- @include c.state-layer(var(--mtrl-sys-color-on-surface), 'hover');
94
+ @include m.state-layer(t.color('on-surface'), 'hover');
92
95
 
93
96
  &::after {
94
97
  opacity: 1;
@@ -99,7 +102,7 @@
99
102
  // Disabled state
100
103
  &--disabled {
101
104
  pointer-events: none;
102
- color: rgba(var(--mtrl-sys-color-on-surface-rgb), 0.38);
105
+ color: t.alpha('on-surface', 0.38);
103
106
  }
104
107
  }
105
108
 
@@ -107,34 +110,38 @@
107
110
  &-divider {
108
111
  height: 1px;
109
112
  margin: 8px 0;
110
- background-color: var(--mtrl-sys-color-outline-variant);
113
+ background-color: t.color('outline-variant');
111
114
  }
112
115
 
113
116
  // Accessibility
114
- @include c.focus-ring('.#{c.$prefix}-menu-item:focus-visible');
117
+ @include m.focus-ring('.#{$component}-item:focus-visible');
115
118
 
116
- @include c.reduced-motion {
119
+ @include m.reduced-motion {
117
120
  transition: none;
121
+
122
+ .#{$component}-item {
123
+ transition: none;
124
+ }
118
125
  }
119
126
 
120
- @include c.high-contrast {
127
+ @include m.high-contrast {
121
128
  border: 1px solid CurrentColor;
122
129
 
123
- .#{c.$prefix}-menu-divider {
130
+ .#{$component}-divider {
124
131
  background-color: CurrentColor;
125
132
  }
126
133
 
127
- .#{c.$prefix}-menu-item--disabled {
134
+ .#{$component}-item--disabled {
128
135
  opacity: 1;
129
136
  color: GrayText;
130
137
  }
131
138
  }
132
139
 
133
140
  // RTL Support
134
- @include c.rtl {
141
+ @include m.rtl {
135
142
  transform-origin: top right;
136
143
 
137
- .#{c.$prefix}-menu-item {
144
+ .#{$component}-item {
138
145
  &--submenu {
139
146
  padding-right: 16px;
140
147
  padding-left: 48px;