mtrl 0.0.2 → 0.1.0
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.
- package/package.json +2 -2
- package/src/components/button/styles.scss +198 -161
- package/src/components/checkbox/checkbox.js +4 -3
- package/src/components/checkbox/styles.scss +105 -55
- package/src/components/container/styles.scss +65 -58
- package/src/components/list/styles.scss +240 -11
- package/src/components/menu/features/items-manager.js +5 -1
- package/src/components/menu/styles.scss +37 -30
- package/src/components/navigation/constants.js +19 -54
- package/src/components/navigation/styles.scss +406 -6
- package/src/components/snackbar/styles.scss +46 -17
- package/src/components/switch/styles.scss +104 -40
- package/src/components/switch/switch.js +1 -1
- package/src/components/textfield/styles.scss +351 -5
- package/src/core/build/_ripple.scss +79 -0
- package/src/core/compose/features/disabled.js +27 -7
- package/src/core/compose/features/input.js +9 -1
- package/src/core/compose/features/textinput.js +16 -20
- package/src/core/dom/create.js +0 -1
- package/src/styles/abstract/_mixins.scss +9 -7
- package/src/styles/abstract/_theme.scss +157 -0
- package/src/styles/abstract/_variables.scss +72 -6
- package/src/styles/base/_reset.scss +86 -0
- package/src/styles/base/_typography.scss +155 -0
- package/src/styles/main.scss +104 -57
- package/src/styles/themes/_base-theme.scss +2 -27
- package/src/styles/themes/_baseline.scss +64 -39
- package/src/styles/utilities/_color.scss +154 -0
- package/src/styles/utilities/_flexbox.scss +194 -0
- package/src/styles/utilities/_spacing.scss +139 -0
- package/src/styles/utilities/_typography.scss +178 -0
- package/src/styles/utilities/_visibility.scss +142 -0
- package/test/components/button.test.js +46 -34
- package/test/components/checkbox.test.js +238 -0
- package/test/components/list.test.js +105 -0
- package/test/components/menu.test.js +385 -0
- package/test/components/navigation.test.js +227 -0
- package/test/components/snackbar.test.js +234 -0
- package/test/components/switch.test.js +186 -0
- package/test/components/textfield.test.js +314 -0
- package/test/core/ripple.test.js +21 -120
- package/test/setup.js +152 -239
- package/src/components/list/styles/_list-item.scss +0 -142
- package/src/components/list/styles/_list.scss +0 -89
- package/src/components/list/styles/_variables.scss +0 -13
- package/src/components/navigation/styles/_bar.scss +0 -51
- package/src/components/navigation/styles/_base.scss +0 -129
- package/src/components/navigation/styles/_drawer.scss +0 -169
- package/src/components/navigation/styles/_rail.scss +0 -65
- package/src/components/textfield/styles/base.scss +0 -107
- package/src/components/textfield/styles/filled.scss +0 -58
- package/src/components/textfield/styles/outlined.scss +0 -66
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// src/styles/abstract/_theme.scss
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'base' as *;
|
|
4
|
+
@use 'variables' as v;
|
|
5
|
+
|
|
6
|
+
// System-level tokens mapped to CSS variables
|
|
7
|
+
$mtrl-sys-state: (
|
|
8
|
+
'hover-state-layer-opacity': v.$state('hover-state-layer-opacity'),
|
|
9
|
+
'focus-state-layer-opacity': v.$state('focus-state-layer-opacity'),
|
|
10
|
+
'pressed-state-layer-opacity': v.$state('pressed-state-layer-opacity'),
|
|
11
|
+
'dragged-state-layer-opacity': v.$state('dragged-state-layer-opacity')
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
$mtrl-sys-motion: (
|
|
15
|
+
'duration-short1': v.$motion('duration-short1'),
|
|
16
|
+
'duration-short2': v.$motion('duration-short2'),
|
|
17
|
+
'duration-short3': v.$motion('duration-short3'),
|
|
18
|
+
'duration-short4': v.$motion('duration-short4'),
|
|
19
|
+
'duration-medium1': v.$motion('duration-medium1'),
|
|
20
|
+
'duration-medium2': v.$motion('duration-medium2'),
|
|
21
|
+
'duration-long1': v.$motion('duration-long1'),
|
|
22
|
+
'duration-long2': v.$motion('duration-long2'),
|
|
23
|
+
'easing-standard': v.$motion('easing-standard'),
|
|
24
|
+
'easing-standard-accelerate': v.$motion('easing-standard-accelerate'),
|
|
25
|
+
'easing-standard-decelerate': v.$motion('easing-standard-decelerate'),
|
|
26
|
+
'easing-emphasized': v.$motion('easing-emphasized'),
|
|
27
|
+
'easing-emphasized-accelerate': v.$motion('easing-emphasized-accelerate'),
|
|
28
|
+
'easing-emphasized-decelerate': v.$motion('easing-emphasized-decelerate')
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
$mtrl-sys-shape: (
|
|
32
|
+
'none': v.$shape('none'),
|
|
33
|
+
'extra-small': v.$shape('extra-small'),
|
|
34
|
+
'small': v.$shape('small'),
|
|
35
|
+
'medium': v.$shape('medium'),
|
|
36
|
+
'large': v.$shape('large'),
|
|
37
|
+
'extra-large': v.$shape('extra-large'),
|
|
38
|
+
'full': v.$shape('full'),
|
|
39
|
+
'pill': v.$shape('pill')
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Generate CSS variable utilities
|
|
43
|
+
@function color($key) {
|
|
44
|
+
@return var(--#{$prefix}-sys-color-#{$key});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@function rgb($key) {
|
|
48
|
+
@return var(--#{$prefix}-sys-color-#{$key}-rgb);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@function alpha($key, $opacity) {
|
|
52
|
+
@return rgba(var(--#{$prefix}-sys-color-#{$key}-rgb), $opacity);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@function state($key) {
|
|
56
|
+
@return var(--#{$prefix}-sys-state-#{$key});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@function motion($key) {
|
|
60
|
+
@return var(--#{$prefix}-sys-motion-#{$key});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@function shape($key) {
|
|
64
|
+
@return var(--#{$prefix}-sys-shape-#{$key});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Theme management utilities
|
|
68
|
+
@mixin dark-theme {
|
|
69
|
+
// Key colors
|
|
70
|
+
--#{$prefix}-sys-color-primary: #D0BCFF;
|
|
71
|
+
--#{$prefix}-sys-color-primary-rgb: 208, 188, 255;
|
|
72
|
+
--#{$prefix}-sys-color-on-primary: #381E72;
|
|
73
|
+
--#{$prefix}-sys-color-primary-container: #4F378B;
|
|
74
|
+
--#{$prefix}-sys-color-on-primary-container: #EADDFF;
|
|
75
|
+
|
|
76
|
+
--#{$prefix}-sys-color-secondary: #CCC2DC;
|
|
77
|
+
--#{$prefix}-sys-color-on-secondary: #332D41;
|
|
78
|
+
--#{$prefix}-sys-color-secondary-container: #4A4458;
|
|
79
|
+
--#{$prefix}-sys-color-on-secondary-container: #E8DEF8;
|
|
80
|
+
|
|
81
|
+
--#{$prefix}-sys-color-tertiary: #EFB8C8;
|
|
82
|
+
--#{$prefix}-sys-color-on-tertiary: #492532;
|
|
83
|
+
--#{$prefix}-sys-color-tertiary-container: #633B48;
|
|
84
|
+
--#{$prefix}-sys-color-on-tertiary-container: #FFD8E4;
|
|
85
|
+
|
|
86
|
+
// Neutral colors
|
|
87
|
+
--#{$prefix}-sys-color-surface: #1C1B1F;
|
|
88
|
+
--#{$prefix}-sys-color-surface-dim: #141218;
|
|
89
|
+
--#{$prefix}-sys-color-surface-bright: #3B383D;
|
|
90
|
+
--#{$prefix}-sys-color-surface-container-lowest: #0F0D13;
|
|
91
|
+
--#{$prefix}-sys-color-surface-container-low: #1D1B20;
|
|
92
|
+
--#{$prefix}-sys-color-surface-container: #211F26;
|
|
93
|
+
--#{$prefix}-sys-color-surface-container-high: #2B2930;
|
|
94
|
+
--#{$prefix}-sys-color-surface-container-highest: #36343B;
|
|
95
|
+
|
|
96
|
+
--#{$prefix}-sys-color-on-surface: #E6E1E5;
|
|
97
|
+
--#{$prefix}-sys-color-on-surface-variant: #CAC4D0;
|
|
98
|
+
--#{$prefix}-sys-color-on-surface-rgb: 230, 225, 229;
|
|
99
|
+
|
|
100
|
+
// Additional colors
|
|
101
|
+
--#{$prefix}-sys-color-outline: #938F99;
|
|
102
|
+
--#{$prefix}-sys-color-outline-variant: #444746;
|
|
103
|
+
--#{$prefix}-sys-color-shadow: #000000;
|
|
104
|
+
--#{$prefix}-sys-color-scrim: #000000;
|
|
105
|
+
--#{$prefix}-sys-color-inverse-surface: #E6E1E5;
|
|
106
|
+
--#{$prefix}-sys-color-inverse-on-surface: #313033;
|
|
107
|
+
--#{$prefix}-sys-color-inverse-primary: #6750A4;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@mixin light-theme {
|
|
111
|
+
// Key colors
|
|
112
|
+
--#{$prefix}-sys-color-primary: #6750A4;
|
|
113
|
+
--#{$prefix}-sys-color-primary-rgb: 103, 80, 164;
|
|
114
|
+
--#{$prefix}-sys-color-on-primary: #FFFFFF;
|
|
115
|
+
--#{$prefix}-sys-color-primary-container: #EADDFF;
|
|
116
|
+
--#{$prefix}-sys-color-on-primary-container: #21005D;
|
|
117
|
+
|
|
118
|
+
--#{$prefix}-sys-color-secondary: #625B71;
|
|
119
|
+
--#{$prefix}-sys-color-on-secondary: #FFFFFF;
|
|
120
|
+
--#{$prefix}-sys-color-secondary-container: #E8DEF8;
|
|
121
|
+
--#{$prefix}-sys-color-on-secondary-container: #1D192B;
|
|
122
|
+
|
|
123
|
+
--#{$prefix}-sys-color-tertiary: #7D5260;
|
|
124
|
+
--#{$prefix}-sys-color-on-tertiary: #FFFFFF;
|
|
125
|
+
--#{$prefix}-sys-color-tertiary-container: #FFD8E4;
|
|
126
|
+
--#{$prefix}-sys-color-on-tertiary-container: #31111D;
|
|
127
|
+
|
|
128
|
+
// Neutral colors
|
|
129
|
+
--#{$prefix}-sys-color-surface: #FFFBFE;
|
|
130
|
+
--#{$prefix}-sys-color-surface-dim: #DED8E1;
|
|
131
|
+
--#{$prefix}-sys-color-surface-bright: #FFF8F7;
|
|
132
|
+
--#{$prefix}-sys-color-surface-container-lowest: #FFFFFF;
|
|
133
|
+
--#{$prefix}-sys-color-surface-container-low: #F7F2FA;
|
|
134
|
+
--#{$prefix}-sys-color-surface-container: #F3EDF7;
|
|
135
|
+
--#{$prefix}-sys-color-surface-container-high: #ECE6F0;
|
|
136
|
+
--#{$prefix}-sys-color-surface-container-highest: #E6E0E9;
|
|
137
|
+
|
|
138
|
+
--#{$prefix}-sys-color-on-surface: #1C1B1F;
|
|
139
|
+
--#{$prefix}-sys-color-on-surface-variant: #49454F;
|
|
140
|
+
--#{$prefix}-sys-color-on-surface-rgb: 28, 27, 31;
|
|
141
|
+
|
|
142
|
+
// Additional colors
|
|
143
|
+
--#{$prefix}-sys-color-outline: #79747E;
|
|
144
|
+
--#{$prefix}-sys-color-outline-variant: #CAC4D0;
|
|
145
|
+
--#{$prefix}-sys-color-shadow: #000000;
|
|
146
|
+
--#{$prefix}-sys-color-scrim: #000000;
|
|
147
|
+
--#{$prefix}-sys-color-inverse-surface: #313033;
|
|
148
|
+
--#{$prefix}-sys-color-inverse-on-surface: #F4EFF4;
|
|
149
|
+
--#{$prefix}-sys-color-inverse-primary: #D0BCFF;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Auto dark mode based on system preference
|
|
153
|
+
@mixin auto-dark-mode {
|
|
154
|
+
@media (prefers-color-scheme: dark) {
|
|
155
|
+
@include dark-theme;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// src/styles/abstract/_variables.scss
|
|
2
2
|
@use 'sass:map';
|
|
3
|
+
@use 'base' as *;
|
|
3
4
|
|
|
4
|
-
// Core
|
|
5
|
-
$prefix: 'mtrl' !default;
|
|
6
|
-
|
|
7
|
-
// Design tokens
|
|
5
|
+
// Core design tokens
|
|
8
6
|
$state: (
|
|
9
7
|
'hover-state-layer-opacity': 0.08,
|
|
10
|
-
'pressed-state-layer-opacity': 0.12,
|
|
11
8
|
'focus-state-layer-opacity': 0.12,
|
|
9
|
+
'pressed-state-layer-opacity': 0.12,
|
|
12
10
|
'dragged-state-layer-opacity': 0.16
|
|
13
11
|
) !default;
|
|
14
12
|
|
|
@@ -81,6 +79,27 @@ $typescale: (
|
|
|
81
79
|
'letter-spacing': 0,
|
|
82
80
|
'font-weight': 400
|
|
83
81
|
),
|
|
82
|
+
'title-large': (
|
|
83
|
+
'font-family': ('Roboto', sans-serif),
|
|
84
|
+
'font-size': 22px,
|
|
85
|
+
'line-height': 28px,
|
|
86
|
+
'letter-spacing': 0,
|
|
87
|
+
'font-weight': 500
|
|
88
|
+
),
|
|
89
|
+
'title-medium': (
|
|
90
|
+
'font-family': ('Roboto', sans-serif),
|
|
91
|
+
'font-size': 16px,
|
|
92
|
+
'line-height': 24px,
|
|
93
|
+
'letter-spacing': 0.15px,
|
|
94
|
+
'font-weight': 500
|
|
95
|
+
),
|
|
96
|
+
'title-small': (
|
|
97
|
+
'font-family': ('Roboto', sans-serif),
|
|
98
|
+
'font-size': 14px,
|
|
99
|
+
'line-height': 20px,
|
|
100
|
+
'letter-spacing': 0.1px,
|
|
101
|
+
'font-weight': 500
|
|
102
|
+
),
|
|
84
103
|
'body-large': (
|
|
85
104
|
'font-family': ('Roboto', sans-serif),
|
|
86
105
|
'font-size': 16px,
|
|
@@ -127,6 +146,8 @@ $typescale: (
|
|
|
127
146
|
|
|
128
147
|
$shape: (
|
|
129
148
|
'none': 0,
|
|
149
|
+
'extra-tiny': 1px,
|
|
150
|
+
'tiny': 2px,
|
|
130
151
|
'extra-small': 4px,
|
|
131
152
|
'small': 8px,
|
|
132
153
|
'medium': 12px,
|
|
@@ -156,4 +177,49 @@ $z-index: (
|
|
|
156
177
|
'fixed': 50,
|
|
157
178
|
'default': 1,
|
|
158
179
|
'below': -1
|
|
159
|
-
) !default;
|
|
180
|
+
) !default;
|
|
181
|
+
|
|
182
|
+
// Component-specific tokens
|
|
183
|
+
$button: (
|
|
184
|
+
'height': 40px,
|
|
185
|
+
'min-width': 64px,
|
|
186
|
+
'padding-horizontal': 24px,
|
|
187
|
+
'padding-horizontal-small': 16px,
|
|
188
|
+
'padding-icon': 16px,
|
|
189
|
+
'border-radius': map.get($shape, 'full'),
|
|
190
|
+
'transition-duration': map.get($motion, 'duration-short2'),
|
|
191
|
+
'transition-easing': map.get($motion, 'easing-standard')
|
|
192
|
+
) !default;
|
|
193
|
+
|
|
194
|
+
// Helper functions for easier token access
|
|
195
|
+
@function state($key) {
|
|
196
|
+
@return map.get($state, $key);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@function motion($key) {
|
|
200
|
+
@return map.get($motion, $key);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@function elevation($level) {
|
|
204
|
+
@return map.get($elevation, $level);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@function typography($scale) {
|
|
208
|
+
@return map.get($typescale, $scale);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@function shape($size) {
|
|
212
|
+
@return map.get($shape, $size);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@function z-index($layer) {
|
|
216
|
+
@return map.get($z-index, $layer);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@function breakpoint($size) {
|
|
220
|
+
@return map.get($breakpoints, $size);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@function button($prop) {
|
|
224
|
+
@return map.get($button, $prop);
|
|
225
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// src/styles/base/_reset.scss
|
|
2
|
+
|
|
3
|
+
// Modern CSS Reset
|
|
4
|
+
// Adapted and simplified for Material Design
|
|
5
|
+
|
|
6
|
+
// Use border-box by default
|
|
7
|
+
*,
|
|
8
|
+
*::before,
|
|
9
|
+
*::after {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Remove default margin and padding
|
|
14
|
+
html,
|
|
15
|
+
body,
|
|
16
|
+
h1, h2, h3, h4, h5, h6,
|
|
17
|
+
p, figure, blockquote, dl, dd {
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Set core body defaults
|
|
23
|
+
body {
|
|
24
|
+
min-height: 100vh;
|
|
25
|
+
text-rendering: optimizeSpeed;
|
|
26
|
+
line-height: 1.5;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Make images easier to work with
|
|
30
|
+
img,
|
|
31
|
+
picture {
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Inherit fonts for inputs and buttons
|
|
37
|
+
input,
|
|
38
|
+
button,
|
|
39
|
+
textarea,
|
|
40
|
+
select {
|
|
41
|
+
font: inherit;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Remove all animations, transitions and smooth scrolling for people who prefer not to see them
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
html:focus-within {
|
|
47
|
+
scroll-behavior: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
*,
|
|
51
|
+
*::before,
|
|
52
|
+
*::after {
|
|
53
|
+
animation-duration: 0.01ms !important;
|
|
54
|
+
animation-iteration-count: 1 !important;
|
|
55
|
+
transition-duration: 0.01ms !important;
|
|
56
|
+
scroll-behavior: auto !important;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Reset button styles
|
|
61
|
+
button {
|
|
62
|
+
background: transparent;
|
|
63
|
+
border: none;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
padding: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Remove list styles
|
|
69
|
+
ul,
|
|
70
|
+
ol {
|
|
71
|
+
list-style: none;
|
|
72
|
+
margin: 0;
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Set default link style
|
|
77
|
+
a {
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
color: inherit;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Tables
|
|
83
|
+
table {
|
|
84
|
+
border-collapse: collapse;
|
|
85
|
+
border-spacing: 0;
|
|
86
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// src/styles/base/_typography.scss
|
|
2
|
+
@use '../abstract/base' as base;
|
|
3
|
+
@use '../abstract/variables' as v;
|
|
4
|
+
@use '../abstract/mixins' as m;
|
|
5
|
+
|
|
6
|
+
// Typography scale classes
|
|
7
|
+
$prefix: base.$prefix;
|
|
8
|
+
|
|
9
|
+
// Display typography
|
|
10
|
+
.#{$prefix}-display-large {
|
|
11
|
+
@include m.typography('display-large');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.#{$prefix}-display-medium {
|
|
15
|
+
@include m.typography('display-medium');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.#{$prefix}-display-small {
|
|
19
|
+
@include m.typography('display-small');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Headline typography
|
|
23
|
+
.#{$prefix}-headline-large {
|
|
24
|
+
@include m.typography('headline-large');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.#{$prefix}-headline-medium {
|
|
28
|
+
@include m.typography('headline-medium');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.#{$prefix}-headline-small {
|
|
32
|
+
@include m.typography('headline-small');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Title typography
|
|
36
|
+
.#{$prefix}-title-large {
|
|
37
|
+
@include m.typography('title-large');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.#{$prefix}-title-medium {
|
|
41
|
+
@include m.typography('title-medium');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{$prefix}-title-small {
|
|
45
|
+
@include m.typography('title-small');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Body typography
|
|
49
|
+
.#{$prefix}-body-large {
|
|
50
|
+
@include m.typography('body-large');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.#{$prefix}-body-medium {
|
|
54
|
+
@include m.typography('body-medium');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.#{$prefix}-body-small {
|
|
58
|
+
@include m.typography('body-small');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Label typography
|
|
62
|
+
.#{$prefix}-label-large {
|
|
63
|
+
@include m.typography('label-large');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.#{$prefix}-label-medium {
|
|
67
|
+
@include m.typography('label-medium');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.#{$prefix}-label-small {
|
|
71
|
+
@include m.typography('label-small');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Convenience modifiers
|
|
75
|
+
.#{$prefix}-text-center {
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.#{$prefix}-text-left {
|
|
80
|
+
text-align: left;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.#{$prefix}-text-right {
|
|
84
|
+
text-align: right;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Font weight modifiers
|
|
88
|
+
.#{$prefix}-font-thin {
|
|
89
|
+
font-weight: 100;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.#{$prefix}-font-light {
|
|
93
|
+
font-weight: 300;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.#{$prefix}-font-regular {
|
|
97
|
+
font-weight: 400;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.#{$prefix}-font-medium {
|
|
101
|
+
font-weight: 500;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.#{$prefix}-font-bold {
|
|
105
|
+
font-weight: 700;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Text truncation with ellipsis
|
|
109
|
+
.#{$prefix}-truncate {
|
|
110
|
+
@include m.truncate;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.#{$prefix}-truncate-2 {
|
|
114
|
+
@include m.truncate(2);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.#{$prefix}-truncate-3 {
|
|
118
|
+
@include m.truncate(3);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Set base styles for heading elements
|
|
122
|
+
h1 {
|
|
123
|
+
@include m.typography('headline-large');
|
|
124
|
+
margin-bottom: 0.5em;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
h2 {
|
|
128
|
+
@include m.typography('headline-medium');
|
|
129
|
+
margin-bottom: 0.5em;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
h3 {
|
|
133
|
+
@include m.typography('headline-small');
|
|
134
|
+
margin-bottom: 0.5em;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
h4 {
|
|
138
|
+
@include m.typography('title-large');
|
|
139
|
+
margin-bottom: 0.5em;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
h5 {
|
|
143
|
+
@include m.typography('title-medium');
|
|
144
|
+
margin-bottom: 0.5em;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
h6 {
|
|
148
|
+
@include m.typography('title-small');
|
|
149
|
+
margin-bottom: 0.5em;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
p {
|
|
153
|
+
@include m.typography('body-medium');
|
|
154
|
+
margin-bottom: 1em;
|
|
155
|
+
}
|
package/src/styles/main.scss
CHANGED
|
@@ -1,78 +1,125 @@
|
|
|
1
1
|
// src/styles/main.scss
|
|
2
2
|
|
|
3
|
-
// Abstract
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@
|
|
3
|
+
// Abstract layer
|
|
4
|
+
@use 'abstract/base';
|
|
5
|
+
@use 'abstract/variables';
|
|
6
|
+
@use 'abstract/functions';
|
|
7
|
+
@use 'abstract/mixins';
|
|
8
|
+
@use 'abstract/theme';
|
|
9
|
+
|
|
10
|
+
// Themes
|
|
11
|
+
@use 'themes/index';
|
|
12
|
+
|
|
13
|
+
// Reset
|
|
14
|
+
@use 'base/reset';
|
|
15
|
+
@use 'base/typography';
|
|
8
16
|
|
|
9
17
|
// Components
|
|
10
|
-
@
|
|
18
|
+
@use '../components/button/styles';
|
|
19
|
+
@use '../components/checkbox/styles';
|
|
20
|
+
@use '../components/container/styles';
|
|
21
|
+
@use '../components/list/styles';
|
|
22
|
+
@use '../components/menu/styles';
|
|
23
|
+
@use '../components/navigation/styles';
|
|
24
|
+
@use '../components/snackbar/styles';
|
|
25
|
+
@use '../components/switch/styles';
|
|
26
|
+
@use '../components/textfield/styles';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@use '../core/build/ripple/ripple';
|
|
11
30
|
|
|
12
|
-
//
|
|
31
|
+
// Utilities
|
|
32
|
+
@use 'utilities/spacing';
|
|
33
|
+
@use 'utilities/visibility';
|
|
34
|
+
@use 'utilities/colors';
|
|
35
|
+
@use 'utilities/flexbox';
|
|
36
|
+
@use 'utilities/typography';
|
|
37
|
+
|
|
38
|
+
// Initialize theme system
|
|
13
39
|
:root {
|
|
14
|
-
|
|
15
|
-
|
|
40
|
+
// Apply the base theme CSS variables
|
|
41
|
+
@include theme.light-theme;
|
|
42
|
+
|
|
43
|
+
// State layer variables
|
|
44
|
+
@each $key, $value in theme.$mtrl-sys-state {
|
|
45
|
+
--#{base.$prefix}-sys-state-#{$key}: #{$value};
|
|
16
46
|
}
|
|
17
47
|
|
|
18
|
-
|
|
19
|
-
|
|
48
|
+
// Motion variables
|
|
49
|
+
@each $key, $value in theme.$mtrl-sys-motion {
|
|
50
|
+
--#{base.$prefix}-sys-motion-#{$key}: #{$value};
|
|
20
51
|
}
|
|
21
52
|
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
// Shape variables
|
|
54
|
+
@each $key, $value in theme.$mtrl-sys-shape {
|
|
55
|
+
--#{base.$prefix}-sys-shape-#{$key}: #{$value};
|
|
24
56
|
}
|
|
25
57
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// --mtrl-sys-color-outline: #79747E;
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// // Dark theme
|
|
47
|
-
// [data-theme="dark"] {
|
|
48
|
-
// --mtrl-sys-color-primary: #D0BCFF;
|
|
49
|
-
// --mtrl-sys-color-primary-rgb: 208, 188, 255;
|
|
50
|
-
// --mtrl-sys-color-on-primary: #381E72;
|
|
51
|
-
// --mtrl-sys-color-primary-container: #4F378B;
|
|
52
|
-
// --mtrl-sys-color-on-primary-container: #EADDFF;
|
|
53
|
-
|
|
54
|
-
// --mtrl-sys-color-secondary: #CCC2DC;
|
|
55
|
-
// --mtrl-sys-color-on-secondary: #332D41;
|
|
56
|
-
// --mtrl-sys-color-secondary-container: #4A4458;
|
|
57
|
-
// --mtrl-sys-color-on-secondary-container: #E8DEF8;
|
|
58
|
-
|
|
59
|
-
// --mtrl-sys-color-surface: #1C1B1F;
|
|
60
|
-
// --mtrl-sys-color-on-surface: #E6E1E5;
|
|
61
|
-
// --mtrl-sys-color-surface-container: #211F26;
|
|
62
|
-
// --mtrl-sys-color-on-surface-rgb: 230, 225, 229;
|
|
63
|
-
|
|
64
|
-
// --mtrl-sys-color-outline: #938F99;
|
|
65
|
-
// }
|
|
58
|
+
// Typography
|
|
59
|
+
@each $scale, $properties in variables.$typescale {
|
|
60
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-font-family-name: #{nth(map-get($properties, font-family), 1)};
|
|
61
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-font-family-fallback: #{if(length(map-get($properties, font-family)) > 1, nth(map-get($properties, font-family), 2), 'sans-serif')};
|
|
62
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-font-size: #{map-get($properties, font-size)};
|
|
63
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-line-height: #{map-get($properties, line-height)};
|
|
64
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-letter-spacing: #{map-get($properties, letter-spacing)};
|
|
65
|
+
--#{base.$prefix}-sys-typescale-#{$scale}-font-weight: #{map-get($properties, font-weight)};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Dark mode support
|
|
70
|
+
@media (prefers-color-scheme: dark) {
|
|
71
|
+
:root:not([data-theme]) {
|
|
72
|
+
@include theme.dark-theme;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
66
75
|
|
|
67
76
|
// Base styles
|
|
68
77
|
body {
|
|
69
78
|
margin: 0;
|
|
70
79
|
padding: 0;
|
|
71
|
-
background-color: var(
|
|
72
|
-
color: var(
|
|
73
|
-
font-family: var(
|
|
80
|
+
background-color: var(--#{base.$prefix}-sys-color-surface);
|
|
81
|
+
color: var(--#{base.$prefix}-sys-color-on-surface);
|
|
82
|
+
font-family: var(--#{base.$prefix}-sys-typescale-body-medium-font-family-name, 'Roboto'),
|
|
83
|
+
var(--#{base.$prefix}-sys-typescale-body-medium-font-family-fallback, sans-serif);
|
|
84
|
+
font-size: var(--#{base.$prefix}-sys-typescale-body-medium-font-size);
|
|
85
|
+
line-height: var(--#{base.$prefix}-sys-typescale-body-medium-line-height);
|
|
74
86
|
-webkit-font-smoothing: antialiased;
|
|
75
87
|
-moz-osx-font-smoothing: grayscale;
|
|
76
88
|
|
|
77
|
-
@include motion-transition(background-color, color);
|
|
89
|
+
@include mixins.motion-transition(background-color, color);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Ensure links have the correct contrast
|
|
93
|
+
a {
|
|
94
|
+
color: var(--#{base.$prefix}-sys-color-primary);
|
|
95
|
+
text-decoration: none;
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
text-decoration: underline;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&:focus-visible {
|
|
102
|
+
outline: 2px solid var(--#{base.$prefix}-sys-color-primary);
|
|
103
|
+
outline-offset: 2px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Focus styles for keyboard navigation
|
|
108
|
+
:focus-visible {
|
|
109
|
+
outline: 2px solid var(--#{base.$prefix}-sys-color-primary);
|
|
110
|
+
outline-offset: 2px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Use smooth scrolling for the page
|
|
114
|
+
html {
|
|
115
|
+
scroll-behavior: smooth;
|
|
116
|
+
|
|
117
|
+
@include mixins.reduced-motion {
|
|
118
|
+
scroll-behavior: auto;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Set box-sizing for all elements
|
|
123
|
+
*, *::before, *::after {
|
|
124
|
+
box-sizing: border-box;
|
|
78
125
|
}
|