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
@@ -0,0 +1,178 @@
1
+ // src/styles/utilities/_typography.scss
2
+ @use '../abstract/base' as base;
3
+ @use '../abstract/mixins' as m;
4
+
5
+ $prefix: base.$prefix;
6
+
7
+ // Font style utilities
8
+ .#{$prefix}-italic {
9
+ font-style: italic;
10
+ }
11
+
12
+ .#{$prefix}-not-italic {
13
+ font-style: normal;
14
+ }
15
+
16
+ // Letter spacing
17
+ .#{$prefix}-tracking-tighter {
18
+ letter-spacing: -0.05em;
19
+ }
20
+
21
+ .#{$prefix}-tracking-tight {
22
+ letter-spacing: -0.025em;
23
+ }
24
+
25
+ .#{$prefix}-tracking-normal {
26
+ letter-spacing: 0;
27
+ }
28
+
29
+ .#{$prefix}-tracking-wide {
30
+ letter-spacing: 0.025em;
31
+ }
32
+
33
+ .#{$prefix}-tracking-wider {
34
+ letter-spacing: 0.05em;
35
+ }
36
+
37
+ .#{$prefix}-tracking-widest {
38
+ letter-spacing: 0.1em;
39
+ }
40
+
41
+ // Line height
42
+ .#{$prefix}-leading-none {
43
+ line-height: 1;
44
+ }
45
+
46
+ .#{$prefix}-leading-tight {
47
+ line-height: 1.25;
48
+ }
49
+
50
+ .#{$prefix}-leading-snug {
51
+ line-height: 1.375;
52
+ }
53
+
54
+ .#{$prefix}-leading-normal {
55
+ line-height: 1.5;
56
+ }
57
+
58
+ .#{$prefix}-leading-relaxed {
59
+ line-height: 1.625;
60
+ }
61
+
62
+ .#{$prefix}-leading-loose {
63
+ line-height: 2;
64
+ }
65
+
66
+ // Text transform
67
+ .#{$prefix}-uppercase {
68
+ text-transform: uppercase;
69
+ }
70
+
71
+ .#{$prefix}-lowercase {
72
+ text-transform: lowercase;
73
+ }
74
+
75
+ .#{$prefix}-capitalize {
76
+ text-transform: capitalize;
77
+ }
78
+
79
+ .#{$prefix}-normal-case {
80
+ text-transform: none;
81
+ }
82
+
83
+ // Text decoration
84
+ .#{$prefix}-underline {
85
+ text-decoration: underline;
86
+ }
87
+
88
+ .#{$prefix}-line-through {
89
+ text-decoration: line-through;
90
+ }
91
+
92
+ .#{$prefix}-no-underline {
93
+ text-decoration: none;
94
+ }
95
+
96
+ // Font smoothing
97
+ .#{$prefix}-antialiased {
98
+ -webkit-font-smoothing: antialiased;
99
+ -moz-osx-font-smoothing: grayscale;
100
+ }
101
+
102
+ .#{$prefix}-subpixel-antialiased {
103
+ -webkit-font-smoothing: auto;
104
+ -moz-osx-font-smoothing: auto;
105
+ }
106
+
107
+ // Text overflow
108
+ .#{$prefix}-truncate {
109
+ @include m.truncate;
110
+ }
111
+
112
+ .#{$prefix}-overflow-ellipsis {
113
+ text-overflow: ellipsis;
114
+ }
115
+
116
+ .#{$prefix}-overflow-clip {
117
+ text-overflow: clip;
118
+ }
119
+
120
+ // Word break
121
+ .#{$prefix}-break-normal {
122
+ overflow-wrap: normal;
123
+ word-break: normal;
124
+ }
125
+
126
+ .#{$prefix}-break-words {
127
+ overflow-wrap: break-word;
128
+ }
129
+
130
+ .#{$prefix}-break-all {
131
+ word-break: break-all;
132
+ }
133
+
134
+ // Text columns for easier reading
135
+ .#{$prefix}-columns-1 {
136
+ column-count: 1;
137
+ }
138
+
139
+ .#{$prefix}-columns-2 {
140
+ column-count: 2;
141
+ }
142
+
143
+ .#{$prefix}-columns-3 {
144
+ column-count: 3;
145
+ }
146
+
147
+ .#{$prefix}-columns-gap-4 {
148
+ column-gap: 1rem;
149
+ }
150
+
151
+ .#{$prefix}-columns-gap-8 {
152
+ column-gap: 2rem;
153
+ }
154
+
155
+ // Text vertical alignment
156
+ .#{$prefix}-align-baseline {
157
+ vertical-align: baseline;
158
+ }
159
+
160
+ .#{$prefix}-align-top {
161
+ vertical-align: top;
162
+ }
163
+
164
+ .#{$prefix}-align-middle {
165
+ vertical-align: middle;
166
+ }
167
+
168
+ .#{$prefix}-align-bottom {
169
+ vertical-align: bottom;
170
+ }
171
+
172
+ .#{$prefix}-align-text-top {
173
+ vertical-align: text-top;
174
+ }
175
+
176
+ .#{$prefix}-align-text-bottom {
177
+ vertical-align: text-bottom;
178
+ }
@@ -0,0 +1,142 @@
1
+ // src/styles/utilities/_visibility.scss
2
+ @use '../abstract/base' as base;
3
+ @use '../abstract/mixins' as m;
4
+ @use 'sass:map';
5
+
6
+ $prefix: base.$prefix;
7
+
8
+ // Hide element but keep it accessible to screen readers
9
+ .#{$prefix}-sr-only {
10
+ @include m.visually-hidden;
11
+ }
12
+
13
+ // Standard display utilities
14
+ .#{$prefix}-block {
15
+ display: block;
16
+ }
17
+
18
+ .#{$prefix}-inline-block {
19
+ display: inline-block;
20
+ }
21
+
22
+ .#{$prefix}-inline {
23
+ display: inline;
24
+ }
25
+
26
+ .#{$prefix}-flex {
27
+ display: flex;
28
+ }
29
+
30
+ .#{$prefix}-inline-flex {
31
+ display: inline-flex;
32
+ }
33
+
34
+ .#{$prefix}-grid {
35
+ display: grid;
36
+ }
37
+
38
+ .#{$prefix}-inline-grid {
39
+ display: inline-grid;
40
+ }
41
+
42
+ .#{$prefix}-hidden {
43
+ display: none;
44
+ }
45
+
46
+ // Visibility
47
+ .#{$prefix}-visible {
48
+ visibility: visible;
49
+ }
50
+
51
+ .#{$prefix}-invisible {
52
+ visibility: hidden;
53
+ }
54
+
55
+ // Responsive visibility utilities
56
+ $breakpoints: (
57
+ 'sm': 600px,
58
+ 'md': 960px,
59
+ 'lg': 1280px,
60
+ 'xl': 1920px
61
+ );
62
+
63
+ @each $breakpoint, $value in $breakpoints {
64
+ // Hide on and above a breakpoint
65
+ .#{$prefix}-hide-#{$breakpoint}-up {
66
+ @media (min-width: $value) {
67
+ display: none !important;
68
+ }
69
+ }
70
+
71
+ // Hide below a breakpoint
72
+ .#{$prefix}-hide-#{$breakpoint}-down {
73
+ @media (max-width: $value - 1) {
74
+ display: none !important;
75
+ }
76
+ }
77
+
78
+ // Show only at and above a breakpoint
79
+ .#{$prefix}-show-#{$breakpoint}-up {
80
+ display: none !important;
81
+
82
+ @media (min-width: $value) {
83
+ display: block !important;
84
+ }
85
+ }
86
+
87
+ // Show only below a breakpoint
88
+ .#{$prefix}-show-#{$breakpoint}-down {
89
+ display: none !important;
90
+
91
+ @media (max-width: $value - 1) {
92
+ display: block !important;
93
+ }
94
+ }
95
+ }
96
+
97
+ // Print visibility
98
+ .#{$prefix}-print-only {
99
+ display: none !important;
100
+
101
+ @media print {
102
+ display: block !important;
103
+ }
104
+ }
105
+
106
+ .#{$prefix}-print-hidden {
107
+ @media print {
108
+ display: none !important;
109
+ }
110
+ }
111
+
112
+ // Positioning utilities
113
+ .#{$prefix}-relative {
114
+ position: relative;
115
+ }
116
+
117
+ .#{$prefix}-absolute {
118
+ position: absolute;
119
+ }
120
+
121
+ .#{$prefix}-fixed {
122
+ position: fixed;
123
+ }
124
+
125
+ .#{$prefix}-sticky {
126
+ position: sticky;
127
+ }
128
+
129
+ // Accessibility utilities
130
+ .#{$prefix}-focusable {
131
+ &:focus-visible {
132
+ outline: 2px solid var(--#{$prefix}-sys-color-primary);
133
+ outline-offset: 2px;
134
+ }
135
+ }
136
+
137
+ // Elevation utilities
138
+ @for $i from 0 through 5 {
139
+ .#{$prefix}-elevation-#{$i} {
140
+ @include m.elevation($i);
141
+ }
142
+ }
@@ -1,142 +0,0 @@
1
- // src/components/list/styles/_list-item.scss
2
-
3
- @use '../../../styles/abstract/config' as c;
4
- @use 'variables' as v;
5
-
6
- .#{c.$prefix}-list-item {
7
- display: flex;
8
- align-items: center;
9
- min-height: v.$list-item-height;
10
- padding: v.$list-padding v.$list-item-padding;
11
- position: relative;
12
- gap: 16px;
13
- cursor: pointer;
14
- color: var(--mtrl-sys-color-on-surface);
15
- @include c.motion-transition(background-color);
16
-
17
- &:hover {
18
- @include c.state-layer(v.$list-hover-state-layer-color, 'hover');
19
- }
20
-
21
- &:focus-visible {
22
- @include c.state-layer(v.$list-hover-state-layer-color, 'focus');
23
- outline: none;
24
- }
25
-
26
- &:active {
27
- @include c.state-layer(v.$list-hover-state-layer-color, 'pressed');
28
- }
29
-
30
- // Content layout
31
- &-content {
32
- flex: 1;
33
- min-width: 0; // Enable text truncation
34
- display: flex;
35
- flex-direction: column;
36
- justify-content: center;
37
- }
38
-
39
- // Text elements
40
- &-text {
41
- display: flex;
42
- flex-direction: column;
43
- gap: 4px;
44
- }
45
-
46
- &-overline {
47
- @include c.typography('label-small');
48
- color: var(--mtrl-sys-color-on-surface-variant);
49
- }
50
-
51
- &-headline {
52
- @include c.typography('body-large');
53
- color: var(--mtrl-sys-color-on-surface);
54
- }
55
-
56
- &-supporting {
57
- @include c.typography('body-medium');
58
- color: var(--mtrl-sys-color-on-surface-variant);
59
- }
60
-
61
- &-meta {
62
- @include c.typography('label-small');
63
- color: var(--mtrl-sys-color-on-surface-variant);
64
- margin-top: 4px;
65
- }
66
-
67
- // Leading/trailing elements
68
- &-leading,
69
- &-trailing {
70
- display: flex;
71
- align-items: center;
72
- justify-content: center;
73
- flex-shrink: 0;
74
- }
75
-
76
- &-leading {
77
- width: 24px;
78
- height: 24px;
79
- color: var(--mtrl-sys-color-on-surface-variant);
80
-
81
- svg {
82
- width: 100%;
83
- height: 100%;
84
- }
85
- }
86
-
87
- &-trailing {
88
- color: var(--mtrl-sys-color-on-surface-variant);
89
- }
90
-
91
- // Vertical layout variant
92
- &.vertical {
93
- min-height: 72px;
94
- padding: 12px v.$list-item-padding;
95
-
96
- .#{c.$prefix}-list-item {
97
- &-content {
98
- flex-direction: column;
99
- gap: 4px;
100
- }
101
-
102
- &-meta {
103
- margin-top: v.$list-padding;
104
- }
105
- }
106
- }
107
-
108
- // States
109
- &--selected {
110
- background-color: var(--mtrl-sys-color-secondary-container);
111
- color: var(--mtrl-sys-color-on-secondary-container);
112
-
113
- .#{c.$prefix}-list-item {
114
- &-leading,
115
- &-trailing {
116
- color: var(--mtrl-sys-color-on-secondary-container);
117
- }
118
- }
119
- }
120
-
121
- &--disabled {
122
- opacity: 0.38;
123
- pointer-events: none;
124
- }
125
-
126
- // RTL Support
127
- @include c.rtl {
128
- .#{c.$prefix}-list-item {
129
- &-text {
130
- text-align: right;
131
- }
132
- }
133
- }
134
-
135
- // High contrast mode
136
- @include c.high-contrast {
137
- &--selected {
138
- outline: 2px solid currentColor;
139
- outline-offset: -2px;
140
- }
141
- }
142
- }
@@ -1,89 +0,0 @@
1
- // src/components/list/styles/_list.scss
2
-
3
- @use '../../../styles/abstract/config' as c;
4
- @use 'variables' as v;
5
-
6
- .#{c.$prefix}-list {
7
- display: flex;
8
- flex-direction: column;
9
- padding: v.$list-padding 0;
10
- min-width: 200px;
11
- background-color: var(--mtrl-sys-color-surface);
12
-
13
- // Sections
14
- &-section {
15
- display: flex;
16
- flex-direction: column;
17
- width: 100%;
18
-
19
- &:not(:last-child) {
20
- margin-bottom: v.$list-padding;
21
- }
22
- }
23
-
24
- &-section-title {
25
- @include c.typography('label-large');
26
- color: v.$list-section-title-color;
27
- padding: v.$list-section-padding v.$list-item-padding 8px;
28
- }
29
-
30
- // Dividers
31
- &-divider {
32
- height: 1px;
33
- margin: v.$list-padding 0;
34
- background-color: v.$list-divider-color;
35
- }
36
-
37
- // Selection states
38
- &[data-type="single"],
39
- &[data-type="multi"],
40
- &[data-type="radio"] {
41
- .#{c.$prefix}-list-item {
42
- cursor: pointer;
43
-
44
- &--selected {
45
- background-color: var(--mtrl-sys-color-secondary-container);
46
- color: var(--mtrl-sys-color-on-secondary-container);
47
-
48
- &:hover {
49
- background-color: var(--mtrl-sys-color-secondary-container);
50
- @include c.state-layer(var(--mtrl-sys-color-on-secondary-container), 'hover');
51
- }
52
-
53
- .#{c.$prefix}-list-item-supporting {
54
- color: var(--mtrl-sys-color-on-secondary-container);
55
- }
56
- }
57
- }
58
- }
59
-
60
- // Dense variant
61
- &--dense {
62
- .#{c.$prefix}-list-item {
63
- min-height: v.$list-item-dense-height;
64
- }
65
- }
66
-
67
- // Disabled state
68
- &--disabled {
69
- pointer-events: none;
70
- opacity: 0.38;
71
- }
72
-
73
- // RTL Support
74
- @include c.rtl {
75
- .#{c.$prefix}-list-section-title {
76
- text-align: right;
77
- }
78
- }
79
-
80
- // High contrast mode
81
- @include c.high-contrast {
82
- border: 1px solid currentColor;
83
-
84
- &-divider {
85
- border-top: 1px solid currentColor;
86
- background: none;
87
- }
88
- }
89
- }
@@ -1,13 +0,0 @@
1
- // src/components/list/styles/_variables.scss
2
-
3
- // Component variables
4
- $list-item-height: 48px !default;
5
- $list-item-dense-height: 40px !default;
6
- $list-padding: 8px !default;
7
- $list-item-padding: 16px !default;
8
- $list-section-padding: 16px !default;
9
-
10
- // Color variables - can be overridden
11
- $list-divider-color: var(--mtrl-sys-color-outline-variant) !default;
12
- $list-section-title-color: var(--mtrl-sys-color-primary) !default;
13
- $list-hover-state-layer-color: var(--mtrl-sys-color-on-surface) !default;
@@ -1,51 +0,0 @@
1
- // src/components/navigation/styles/_bar.scss
2
- @use 'sass:map';
3
- @use '../../../styles/abstract/config' as c;
4
- @use 'base';
5
-
6
- .#{c.$prefix}-nav {
7
- &--bar {
8
- flex-direction: row;
9
- width: 100%;
10
- height: 80px;
11
- padding: 0 12px;
12
- justify-content: space-around;
13
-
14
- .#{c.$prefix}-nav-item {
15
- flex: 1;
16
- flex-direction: column;
17
- height: 100%;
18
- max-width: 168px;
19
- gap: 4px;
20
-
21
- &:hover {
22
- .#{c.$prefix}-nav-item-icon {
23
- @include c.state-layer(var(--mtrl-sys-color-on-surface), 'hover');
24
- }
25
- }
26
-
27
- &--active {
28
- .#{c.$prefix}-nav-item-icon {
29
- background-color: var(--mtrl-sys-color-secondary-container);
30
- }
31
- }
32
-
33
- &-icon {
34
- margin-bottom: 4px;
35
- padding: 16px;
36
- @include c.motion-transition(background-color);
37
- }
38
-
39
- &-label {
40
- @include c.typography('label-medium');
41
- text-align: center;
42
- }
43
-
44
- &-badge {
45
- top: 4px;
46
- right: 50%;
47
- transform: translateX(12px);
48
- }
49
- }
50
- }
51
- }