mtrl 0.5.2 → 0.5.3

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 (69) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/package.json +1 -1
  4. package/dist/styles.css +1 -1
  5. package/package.json +3 -2
  6. package/src/styles/abstract/_base.scss +2 -0
  7. package/src/styles/abstract/_config.scss +28 -0
  8. package/src/styles/abstract/_functions.scss +124 -0
  9. package/src/styles/abstract/_mixins.scss +401 -0
  10. package/src/styles/abstract/_theme.scss +269 -0
  11. package/src/styles/abstract/_variables.scss +338 -0
  12. package/src/styles/base/_reset.scss +86 -0
  13. package/src/styles/base/_typography.scss +155 -0
  14. package/src/styles/components/_badge.scss +183 -0
  15. package/src/styles/components/_bottom-app-bar.scss +103 -0
  16. package/src/styles/components/_button.scss +756 -0
  17. package/src/styles/components/_card.scss +401 -0
  18. package/src/styles/components/_carousel.scss +645 -0
  19. package/src/styles/components/_checkbox.scss +231 -0
  20. package/src/styles/components/_chips.scss +639 -0
  21. package/src/styles/components/_datepicker.scss +358 -0
  22. package/src/styles/components/_dialog.scss +259 -0
  23. package/src/styles/components/_divider.scss +57 -0
  24. package/src/styles/components/_extended-fab.scss +309 -0
  25. package/src/styles/components/_fab.scss +244 -0
  26. package/src/styles/components/_list.scss +774 -0
  27. package/src/styles/components/_menu.scss +245 -0
  28. package/src/styles/components/_navigation-mobile.scss +244 -0
  29. package/src/styles/components/_navigation-system.scss +151 -0
  30. package/src/styles/components/_navigation.scss +407 -0
  31. package/src/styles/components/_progress.scss +101 -0
  32. package/src/styles/components/_radios.scss +187 -0
  33. package/src/styles/components/_search.scss +306 -0
  34. package/src/styles/components/_segmented-button.scss +227 -0
  35. package/src/styles/components/_select.scss +274 -0
  36. package/src/styles/components/_sheet.scss +236 -0
  37. package/src/styles/components/_slider.scss +264 -0
  38. package/src/styles/components/_snackbar.scss +211 -0
  39. package/src/styles/components/_switch.scss +305 -0
  40. package/src/styles/components/_tabs.scss +421 -0
  41. package/src/styles/components/_textfield.scss +1024 -0
  42. package/src/styles/components/_timepicker.scss +451 -0
  43. package/src/styles/components/_tooltip.scss +241 -0
  44. package/src/styles/components/_top-app-bar.scss +225 -0
  45. package/src/styles/main.scss +129 -0
  46. package/src/styles/themes/_autumn.scss +105 -0
  47. package/src/styles/themes/_base-theme.scss +85 -0
  48. package/src/styles/themes/_baseline.scss +173 -0
  49. package/src/styles/themes/_bluekhaki.scss +125 -0
  50. package/src/styles/themes/_brownbeige.scss +125 -0
  51. package/src/styles/themes/_browngreen.scss +125 -0
  52. package/src/styles/themes/_forest.scss +77 -0
  53. package/src/styles/themes/_greenbeige.scss +125 -0
  54. package/src/styles/themes/_index.scss +19 -0
  55. package/src/styles/themes/_material.scss +125 -0
  56. package/src/styles/themes/_ocean.scss +77 -0
  57. package/src/styles/themes/_sageivory.scss +125 -0
  58. package/src/styles/themes/_spring.scss +77 -0
  59. package/src/styles/themes/_summer.scss +87 -0
  60. package/src/styles/themes/_sunset.scss +60 -0
  61. package/src/styles/themes/_tealcaramel.scss +125 -0
  62. package/src/styles/themes/_winter.scss +77 -0
  63. package/src/styles/utilities/_colors.scss +154 -0
  64. package/src/styles/utilities/_flexbox.scss +194 -0
  65. package/src/styles/utilities/_layout.scss +665 -0
  66. package/src/styles/utilities/_ripple.scss +79 -0
  67. package/src/styles/utilities/_spacing.scss +139 -0
  68. package/src/styles/utilities/_typography.scss +178 -0
  69. package/src/styles/utilities/_visibility.scss +142 -0
@@ -0,0 +1,306 @@
1
+ // src/components/search/_styles.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}-search';
9
+
10
+ .#{$component} {
11
+ // Base styles
12
+ position: relative;
13
+ display: flex;
14
+ flex-direction: column;
15
+ width: 100%;
16
+ max-width: 720px;
17
+ min-width: 360px;
18
+ background-color: transparent;
19
+ transition: background-color 0.2s ease;
20
+ z-index: 1;
21
+
22
+ // Container
23
+ &-container {
24
+ position: relative;
25
+ display: flex;
26
+ align-items: center;
27
+ height: 56px;
28
+ padding: 0 16px;
29
+ border-radius: v.shape('pill');
30
+ background-color: t.color('surface-container-high');
31
+ transition: background-color 0.2s ease;
32
+ overflow: hidden;
33
+
34
+ .#{$component}--disabled & {
35
+ opacity: 0.38;
36
+ pointer-events: none;
37
+ }
38
+ }
39
+
40
+ // Leading Icon
41
+ &-leading-icon {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ min-width: 24px;
46
+ height: 24px;
47
+ margin-right: 16px;
48
+ color: t.color('on-surface');
49
+ cursor: pointer;
50
+ flex-shrink: 0;
51
+
52
+ svg {
53
+ width: 24px;
54
+ height: 24px;
55
+ }
56
+
57
+ &:focus {
58
+ outline: none;
59
+ }
60
+
61
+ &:focus-visible {
62
+ outline: 2px solid t.color('outline');
63
+ border-radius: 50%;
64
+ }
65
+ }
66
+
67
+ // Input wrapper
68
+ &-input-wrapper {
69
+ flex: 1;
70
+ min-width: 0;
71
+ height: 100%;
72
+ display: flex;
73
+ align-items: center;
74
+ }
75
+
76
+ // Input field
77
+ &-input {
78
+ width: 100%;
79
+ height: 100%;
80
+ min-height: 36px;
81
+ border: none;
82
+ background: transparent;
83
+ font-size: 16px;
84
+ color: t.color('on-surface');
85
+ padding: 8px 0;
86
+ box-sizing: border-box;
87
+ outline: none;
88
+
89
+ &::placeholder {
90
+ color: t.color('on-surface-variant');
91
+ }
92
+
93
+ .#{$component}--disabled & {
94
+ cursor: not-allowed;
95
+ }
96
+ }
97
+
98
+ // Clear button
99
+ &-clear-button {
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ min-width: 24px;
104
+ height: 24px;
105
+ margin-left: 16px;
106
+ color: t.color('on-surface-variant');
107
+ cursor: pointer;
108
+ flex-shrink: 0;
109
+ opacity: 1;
110
+ visibility: visible;
111
+ transition: opacity 0.2s ease, visibility 0s;
112
+
113
+ svg {
114
+ width: 20px;
115
+ height: 20px;
116
+ }
117
+
118
+ &--hidden {
119
+ opacity: 0;
120
+ visibility: hidden;
121
+ transition: opacity 0.2s ease, visibility 0s 0.2s;
122
+ }
123
+
124
+ &:focus {
125
+ outline: none;
126
+ }
127
+
128
+ &:focus-visible {
129
+ outline: 2px solid t.color('outline');
130
+ border-radius: 50%;
131
+ }
132
+ }
133
+
134
+ // Trailing icons
135
+ &-trailing-icon {
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ min-width: 24px;
140
+ height: 24px;
141
+ margin-left: 16px;
142
+ color: t.color('on-surface-variant');
143
+ cursor: pointer;
144
+ flex-shrink: 0;
145
+
146
+ svg {
147
+ width: 24px;
148
+ height: 24px;
149
+ }
150
+
151
+ &:focus {
152
+ outline: none;
153
+ }
154
+
155
+ &:focus-visible {
156
+ outline: 2px solid t.color('outline');
157
+ border-radius: 50%;
158
+ }
159
+ }
160
+
161
+ // Avatar
162
+ &-avatar {
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ margin-left: 16px;
167
+ min-width: 30px;
168
+ height: 30px;
169
+ flex-shrink: 0;
170
+ border-radius: 50%;
171
+ overflow: hidden;
172
+
173
+ img {
174
+ width: 100%;
175
+ height: 100%;
176
+ object-fit: cover;
177
+ }
178
+ }
179
+
180
+ // Search variants
181
+ &--bar {
182
+ border-radius: v.shape('pill');
183
+ overflow: hidden;
184
+ transition: max-width 0.3s ease, width 0.3s ease;
185
+ }
186
+
187
+ &--view {
188
+ border-radius: 0;
189
+ max-width: 100%;
190
+ width: 100%;
191
+
192
+ .#{$component}-container {
193
+ border-radius: 0;
194
+ }
195
+
196
+ // For docked view mode
197
+ @include m.breakpoint-up('md') {
198
+ border-radius: v.shape('extra-large');
199
+
200
+ .#{$component}-container {
201
+ border-radius: v.shape('extra-large') v.shape('extra-large') 0 0;
202
+ height: 56px;
203
+ }
204
+ }
205
+ }
206
+
207
+ // Divider
208
+ &-divider {
209
+ display: block;
210
+ width: 100%;
211
+ height: 1px;
212
+ background-color: t.color('outline');
213
+ opacity: 0.5;
214
+ }
215
+
216
+ // Suggestions container
217
+ &-suggestions-container {
218
+ display: none;
219
+ background-color: t.color('surface-container-high');
220
+ max-height: 400px;
221
+ overflow-y: auto;
222
+ border-bottom-left-radius: v.shape('medium');
223
+ border-bottom-right-radius: v.shape('medium');
224
+
225
+ &--visible {
226
+ display: block;
227
+ }
228
+
229
+ // For docked view mode
230
+ @include m.breakpoint-up('md') {
231
+ border-radius: 0 0 v.shape('extra-large') v.shape('extra-large');
232
+ }
233
+ }
234
+
235
+ // Suggestions list
236
+ &-suggestions-list {
237
+ list-style: none;
238
+ padding: 8px 0;
239
+ margin: 0;
240
+ }
241
+
242
+ // Suggestion item
243
+ &-suggestion-item {
244
+ display: flex;
245
+ align-items: center;
246
+ padding: 12px 16px;
247
+ min-height: 48px;
248
+ font-size: 16px;
249
+ color: t.color('on-surface');
250
+ cursor: pointer;
251
+ transition: background-color 0.15s ease;
252
+
253
+ &:hover, &:focus {
254
+ background-color: t.alpha('on-surface', 0.05);
255
+ }
256
+
257
+ &:focus {
258
+ outline: none;
259
+ }
260
+
261
+ // Highlight matched text
262
+ strong {
263
+ font-weight: 600;
264
+ color: t.color('on-surface');
265
+ }
266
+ }
267
+
268
+ // Suggestion item icon
269
+ &-suggestion-icon {
270
+ display: flex;
271
+ align-items: center;
272
+ justify-content: center;
273
+ width: 24px;
274
+ height: 24px;
275
+ margin-right: 16px;
276
+ color: t.color('on-surface-variant');
277
+
278
+ svg {
279
+ width: 20px;
280
+ height: 20px;
281
+ }
282
+ }
283
+
284
+ // Suggestion item text
285
+ &-suggestion-text {
286
+ flex: 1;
287
+ }
288
+
289
+ // Focus state
290
+ &--focused {
291
+ .#{$component}-container {
292
+ // No additional styles needed for focus in MD3
293
+ }
294
+ }
295
+
296
+ // Full width
297
+ &--fullwidth {
298
+ max-width: 100%;
299
+ }
300
+
301
+ // Expanded state (transitioning from bar to view)
302
+ &--expanded {
303
+ max-width: 100%;
304
+ width: 100%;
305
+ }
306
+ }
@@ -0,0 +1,227 @@
1
+ // src/components/segmented-button/_styles.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}-segmented-button';
9
+
10
+ .#{$component} {
11
+ // Base styles
12
+ position: relative;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ border-radius: 20px; // Half of height per MD3 specs
17
+ border: 1px solid t.color('outline');
18
+ background-color: transparent;
19
+ overflow: hidden;
20
+
21
+ // Density variables with defaults (Material Design 3 standard density)
22
+ --segment-height: 40px;
23
+ --segment-padding-x: 24px;
24
+ --segment-padding-icon-only: 12px;
25
+ --segment-padding-icon-text-left: 16px;
26
+ --segment-padding-icon-text-right: 24px;
27
+ --segment-icon-size: 18px;
28
+ --segment-text-size: 0.875rem;
29
+ --segment-border-radius: 20px;
30
+
31
+ // Set height from the CSS variable
32
+ height: var(--segment-height);
33
+ // Adjust border radius based on height
34
+ border-radius: calc(var(--segment-height) / 2);
35
+
36
+ // Comfortable density (medium)
37
+ &--comfortable {
38
+ --segment-height: 36px;
39
+ --segment-padding-x: 20px;
40
+ --segment-padding-icon-only: 10px;
41
+ --segment-padding-icon-text-left: 14px;
42
+ --segment-padding-icon-text-right: 20px;
43
+ --segment-icon-size: 16px;
44
+ --segment-text-size: 0.8125rem;
45
+ --segment-border-radius: 18px;
46
+
47
+ border-radius: var(--segment-border-radius);
48
+ }
49
+
50
+ // Compact density (small)
51
+ &--compact {
52
+ --segment-height: 32px;
53
+ --segment-padding-x: 16px;
54
+ --segment-padding-icon-only: 8px;
55
+ --segment-padding-icon-text-left: 12px;
56
+ --segment-padding-icon-text-right: 16px;
57
+ --segment-icon-size: 16px;
58
+ --segment-text-size: 0.75rem;
59
+ --segment-border-radius: 16px;
60
+
61
+ border-radius: var(--segment-border-radius);
62
+ }
63
+
64
+ // Disabled state for whole component
65
+ &--disabled {
66
+ opacity: 0.38;
67
+ pointer-events: none;
68
+ }
69
+
70
+ // Style for button elements used as segments
71
+ .#{base.$prefix}-button {
72
+ // Reset button styles that we don't want
73
+ margin: 0;
74
+ box-shadow: none;
75
+ background-color: transparent;
76
+ border: none;
77
+ position: relative; // For pseudo-elements
78
+ border-radius: 0; // Reset any border-radius
79
+ min-width: 48px;
80
+ height: 100%;
81
+ color: t.color('on-surface'); // Original color
82
+
83
+ // Use CSS variables for dynamic sizing based on density
84
+ padding: 0 var(--segment-padding-x);
85
+
86
+ // Icon-only segments have equal padding all around
87
+ &.#{base.$prefix}-button--circular {
88
+ padding: 0 var(--segment-padding-icon-only);
89
+ }
90
+
91
+ // Segments with both icon and text
92
+ &:has(.#{base.$prefix}-button-icon + .#{base.$prefix}-button-text) {
93
+ padding: 0 var(--segment-padding-icon-text-right) 0 var(--segment-padding-icon-text-left);
94
+ }
95
+
96
+ // Only add border radius to first and last segments
97
+ &:first-child {
98
+ border-top-left-radius: var(--segment-border-radius);
99
+ border-bottom-left-radius: var(--segment-border-radius);
100
+ }
101
+
102
+ &:last-child {
103
+ border-top-right-radius: var(--segment-border-radius);
104
+ border-bottom-right-radius: var(--segment-border-radius);
105
+ }
106
+
107
+ // Hover state - keeping original color
108
+ &:hover:not([disabled]) {
109
+ background-color: t.alpha('on-surface', 0.08);
110
+ }
111
+
112
+ // Focus state
113
+ &:focus {
114
+ outline: none;
115
+ }
116
+
117
+ &:focus-visible {
118
+ outline: 2px solid t.color('outline');
119
+ outline-offset: -2px;
120
+ }
121
+
122
+ // Replace border with pseudo-elements for better control
123
+ // Each segment has its own right border (except last)
124
+ &:not(:last-child)::after {
125
+ content: '';
126
+ position: absolute;
127
+ top: 0;
128
+ right: 0;
129
+ height: 100%;
130
+ width: 1px;
131
+ background-color: t.color('outline');
132
+ pointer-events: none;
133
+ }
134
+
135
+ // Disabled state handling
136
+ &[disabled] {
137
+ opacity: 0.38;
138
+
139
+ // When a disabled button has a right border, make it lower opacity
140
+ &::after {
141
+ background-color: t.alpha('outline', 0.38);
142
+ }
143
+
144
+ // When a disabled button is before a non-disabled button, let the non-disabled handle the border
145
+ + .#{base.$prefix}-button:not([disabled])::before {
146
+ content: '';
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ height: 100%;
151
+ width: 1px;
152
+ background-color: t.color('outline');
153
+ pointer-events: none;
154
+ }
155
+
156
+ // When a disabled button is after a non-disabled button, make the non-disabled button's border low opacity
157
+ &:not(:first-child) {
158
+ &::before {
159
+ content: '';
160
+ position: absolute;
161
+ top: 0;
162
+ left: 0;
163
+ height: 100%;
164
+ width: 1px;
165
+ background-color: t.alpha('outline', 0.38);
166
+ pointer-events: none;
167
+ }
168
+ }
169
+ }
170
+
171
+ // Ensure all button styles are reset appropriately
172
+ &.#{base.$prefix}-button--filled,
173
+ &.#{base.$prefix}-button--outlined,
174
+ &.#{base.$prefix}-button--tonal,
175
+ &.#{base.$prefix}-button--elevated,
176
+ &.#{base.$prefix}-button--text {
177
+ background-color: transparent;
178
+ box-shadow: none;
179
+ color: t.color('on-surface');
180
+ }
181
+ }
182
+
183
+ // Selected state
184
+ .#{base.$prefix}-segment--selected {
185
+ background-color: t.color('secondary-container');
186
+ color: t.color('on-secondary-container');
187
+
188
+ &:hover:not([disabled]) {
189
+ background-color: t.alpha('secondary-container', 0.8);
190
+ }
191
+
192
+ // Ensure color change even with different button variants
193
+ &.#{base.$prefix}-button--filled,
194
+ &.#{base.$prefix}-button--outlined,
195
+ &.#{base.$prefix}-button--tonal,
196
+ &.#{base.$prefix}-button--elevated,
197
+ &.#{base.$prefix}-button--text {
198
+ background-color: t.color('secondary-container');
199
+ color: t.color('on-secondary-container');
200
+ }
201
+ }
202
+
203
+ // Ensure proper spacing in button contents
204
+ .#{base.$prefix}-button-text {
205
+ margin: 0;
206
+ white-space: nowrap;
207
+ @include m.typography('label-large');
208
+ // Apply density-specific font sizing
209
+ font-size: var(--segment-text-size);
210
+ }
211
+
212
+ .#{base.$prefix}-button-icon + .#{base.$prefix}-button-text {
213
+ margin-left: 8px; // MD3 spec for space between icon and text
214
+ }
215
+
216
+ // Icon sizing per MD3
217
+ .#{base.$prefix}-button-icon {
218
+ display: flex;
219
+ align-items: center;
220
+ justify-content: center;
221
+
222
+ svg {
223
+ width: var(--segment-icon-size);
224
+ height: var(--segment-icon-size);
225
+ }
226
+ }
227
+ }