mtrl 0.2.5 → 0.2.6
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 +1 -1
- package/src/components/badge/_styles.scss +9 -9
- package/src/components/button/_styles.scss +0 -56
- package/src/components/button/button.ts +0 -2
- package/src/components/button/constants.ts +0 -6
- package/src/components/button/index.ts +2 -2
- package/src/components/button/types.ts +1 -7
- package/src/components/card/_styles.scss +67 -25
- package/src/components/card/api.ts +54 -3
- package/src/components/card/card.ts +33 -2
- package/src/components/card/config.ts +143 -21
- package/src/components/card/constants.ts +20 -19
- package/src/components/card/content.ts +299 -2
- package/src/components/card/features.ts +155 -4
- package/src/components/card/index.ts +31 -9
- package/src/components/card/types.ts +138 -15
- package/src/components/chip/chip.ts +1 -9
- package/src/components/chip/constants.ts +0 -10
- package/src/components/chip/index.ts +1 -1
- package/src/components/chip/types.ts +1 -4
- package/src/components/progress/_styles.scss +0 -65
- package/src/components/progress/config.ts +1 -2
- package/src/components/progress/constants.ts +0 -14
- package/src/components/progress/index.ts +1 -1
- package/src/components/progress/progress.ts +1 -4
- package/src/components/progress/types.ts +1 -4
- package/src/components/radios/_styles.scss +0 -45
- package/src/components/radios/api.ts +85 -60
- package/src/components/radios/config.ts +1 -2
- package/src/components/radios/constants.ts +0 -9
- package/src/components/radios/index.ts +1 -1
- package/src/components/radios/radio.ts +34 -11
- package/src/components/radios/radios.ts +2 -1
- package/src/components/radios/types.ts +1 -7
- package/src/components/slider/_styles.scss +149 -155
- package/src/components/slider/accessibility.md +59 -0
- package/src/components/slider/config.ts +4 -6
- package/src/components/slider/features/disabled.ts +41 -16
- package/src/components/slider/features/interactions.ts +153 -18
- package/src/components/slider/features/keyboard.ts +127 -6
- package/src/components/slider/features/structure.ts +32 -5
- package/src/components/slider/features/ui.ts +18 -8
- package/src/components/tabs/_styles.scss +285 -155
- package/src/components/tabs/api.ts +178 -400
- package/src/components/tabs/config.ts +46 -52
- package/src/components/tabs/constants.ts +85 -8
- package/src/components/tabs/features.ts +401 -0
- package/src/components/tabs/index.ts +60 -3
- package/src/components/tabs/indicator.ts +225 -0
- package/src/components/tabs/responsive.ts +144 -0
- package/src/components/tabs/scroll-indicators.ts +149 -0
- package/src/components/tabs/state.ts +186 -0
- package/src/components/tabs/tab-api.ts +258 -0
- package/src/components/tabs/tab.ts +255 -0
- package/src/components/tabs/tabs.ts +50 -31
- package/src/components/tabs/types.ts +324 -128
- package/src/components/tabs/utils.ts +107 -0
- package/src/components/textfield/_styles.scss +0 -98
- package/src/components/textfield/config.ts +2 -3
- package/src/components/textfield/constants.ts +0 -14
- package/src/components/textfield/index.ts +2 -2
- package/src/components/textfield/textfield.ts +0 -2
- package/src/components/textfield/types.ts +1 -4
- package/src/core/compose/component.ts +1 -1
- package/src/core/compose/features/badge.ts +79 -0
- package/src/core/compose/features/index.ts +3 -1
- package/src/styles/abstract/_theme.scss +106 -2
- package/src/components/card/actions.ts +0 -48
- package/src/components/card/header.ts +0 -88
- package/src/components/card/media.ts +0 -52
|
@@ -5,220 +5,350 @@
|
|
|
5
5
|
@use '../../styles/abstract/mixins' as m;
|
|
6
6
|
@use '../../styles/abstract/theme' as t;
|
|
7
7
|
|
|
8
|
-
$component: '#{base.$prefix}-
|
|
8
|
+
$component: '#{base.$prefix}-tab';
|
|
9
|
+
$container: '#{base.$prefix}-tabs';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// Tabs Container Styles (1. Container)
|
|
12
|
+
.#{$container} {
|
|
12
13
|
position: relative;
|
|
13
14
|
display: flex;
|
|
14
15
|
flex-direction: column;
|
|
15
16
|
width: 100%;
|
|
17
|
+
background-color: t.color('surface'); // MD3: Surface color
|
|
16
18
|
box-sizing: border-box;
|
|
17
19
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
// Basic container sizing
|
|
21
|
+
&--primary {
|
|
22
|
+
min-height: 48px;
|
|
23
|
+
|
|
24
|
+
// Tab container with icons and text needs more space
|
|
25
|
+
&:has(.#{$component}--icon-and-text) {
|
|
26
|
+
min-height: 64px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&--secondary {
|
|
31
|
+
min-height: 48px;
|
|
32
|
+
// Tab indicator styling
|
|
33
|
+
.#{$container}-indicator {
|
|
34
|
+
height: 2px;
|
|
35
|
+
border-radius: 0;
|
|
36
|
+
background-color: t.color('on-surface');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Scrollable container
|
|
41
|
+
&--scrollable {
|
|
42
|
+
overflow: hidden;
|
|
24
43
|
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
.#{$container}-scroll {
|
|
45
|
+
display: flex;
|
|
27
46
|
overflow-x: auto;
|
|
28
47
|
scrollbar-width: none; // Firefox
|
|
29
|
-
-ms-overflow-style: none; // IE
|
|
48
|
+
-ms-overflow-style: none; // IE and Edge
|
|
30
49
|
|
|
31
|
-
// Hide scrollbar in WebKit
|
|
32
50
|
&::-webkit-scrollbar {
|
|
33
|
-
display: none;
|
|
51
|
+
display: none; // Chrome, Safari, and Opera
|
|
34
52
|
}
|
|
35
53
|
}
|
|
36
54
|
}
|
|
37
55
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
position:
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
// Container divider (5. Divider)
|
|
57
|
+
&-divider {
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
right: 0;
|
|
62
|
+
height: 1px;
|
|
63
|
+
background-color: t.color('outline-variant'); // MD3: Outline variant color
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Tab indicator styling
|
|
67
|
+
&-indicator {
|
|
68
|
+
position: absolute;
|
|
69
|
+
bottom: 1px;
|
|
70
|
+
height: 4px;
|
|
71
|
+
background-color: t.color('primary');
|
|
72
|
+
border-radius: 3px 3px 0 0;
|
|
73
|
+
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
74
|
+
width 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
75
|
+
z-index: 1; // Ensure indicator appears above divider
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Individual Tab Styles
|
|
80
|
+
.#{$component} {
|
|
81
|
+
position: relative;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
min-width: 90px;
|
|
86
|
+
max-width: 360px;
|
|
87
|
+
padding: 0 16px;
|
|
88
|
+
border: none;
|
|
89
|
+
border-radius: 5px;
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
color: t.color('on-surface-variant');
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
user-select: none;
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
|
|
96
|
+
// Typography for label text (4. Label)
|
|
97
|
+
@include m.typography('label-large');
|
|
98
|
+
|
|
99
|
+
// Transition for state changes
|
|
100
|
+
transition:
|
|
101
|
+
background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
|
102
|
+
color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
103
|
+
|
|
104
|
+
// Container heights based on layout
|
|
105
|
+
&--text-only {
|
|
43
106
|
height: 48px;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&--icon-only {
|
|
110
|
+
height: 48px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&--icon-and-text {
|
|
114
|
+
height: 64px;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Focus styles (3/7. Focused state)
|
|
119
|
+
&:focus {
|
|
49
120
|
outline: none;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&:focus-visible {
|
|
124
|
+
outline: 2px solid t.color('primary');
|
|
125
|
+
outline-offset: 0;
|
|
126
|
+
z-index: 1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Disabled state
|
|
130
|
+
&:disabled, &[disabled], &--disabled {
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
opacity: 0.38;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Tab Icon (3. Icon - optional)
|
|
136
|
+
&-icon {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
width: 24px;
|
|
141
|
+
height: 24px;
|
|
65
142
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
143
|
+
svg {
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
fill: currentColor;
|
|
69
147
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Ensure proper vertical spacing for icon and text
|
|
151
|
+
&--icon-and-text {
|
|
152
|
+
.#{$component}-icon {
|
|
153
|
+
margin-bottom: 4px;
|
|
74
154
|
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Tab Text (4. Label)
|
|
158
|
+
&-text {
|
|
159
|
+
@include m.truncate;
|
|
160
|
+
max-width: 100%;
|
|
161
|
+
text-align: center;
|
|
162
|
+
line-height: 1.2;
|
|
75
163
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
color: t.color('primary');
|
|
164
|
+
.#{$component}--icon-only & {
|
|
165
|
+
@include m.visually-hidden;
|
|
79
166
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Badge positioning (2. Badge - optional)
|
|
170
|
+
.#{base.$prefix}-badge-wrapper {
|
|
171
|
+
.#{base.$prefix}-badge {
|
|
172
|
+
// Position for different tab layouts
|
|
173
|
+
&--top-right {
|
|
174
|
+
.#{$component}--icon-only & {
|
|
175
|
+
top: 4px;
|
|
176
|
+
right: 4px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.#{$component}--text-only & {
|
|
180
|
+
top: 8px;
|
|
181
|
+
right: 8px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.#{$component}--icon-and-text & {
|
|
185
|
+
top: 4px;
|
|
186
|
+
right: calc(50% - 20px);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
86
189
|
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Active Tab - Apply to both primary and secondary
|
|
193
|
+
&--active {
|
|
194
|
+
color: t.color('primary'); // MD3: Primary color
|
|
87
195
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
pointer-events: none;
|
|
91
|
-
color: t.alpha('on-surface', 0.38);
|
|
92
|
-
cursor: default;
|
|
196
|
+
.#{$component}-icon {
|
|
197
|
+
color: t.color('primary'); // MD3: Primary color
|
|
93
198
|
}
|
|
94
199
|
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
align-items: center;
|
|
99
|
-
justify-content: center;
|
|
100
|
-
gap: 8px;
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 100%;
|
|
200
|
+
// Hover state for active tabs
|
|
201
|
+
&:hover:not(:disabled):not([disabled]) {
|
|
202
|
+
background-color: t.alpha('primary', 0.08);
|
|
103
203
|
}
|
|
104
204
|
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
205
|
+
// Pressed state for active tabs
|
|
206
|
+
&:active:not(:disabled):not([disabled]) {
|
|
207
|
+
background-color: t.alpha('primary', 0.12);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Secondary variant overrides
|
|
212
|
+
.#{$container}--secondary & {
|
|
213
|
+
&--active {
|
|
214
|
+
color: t.color('on-surface');
|
|
112
215
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
height: 18px;
|
|
116
|
-
fill: currentColor;
|
|
216
|
+
.#{$component}-icon {
|
|
217
|
+
color: t.color('on-surface');
|
|
117
218
|
}
|
|
118
219
|
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Hover state for inactive tabs
|
|
223
|
+
&:hover:not(:disabled):not(&--active):not([disabled]) {
|
|
224
|
+
background-color: t.alpha('on-surface-variant', 0.08);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Pressed state for inactive tabs
|
|
228
|
+
&:active:not(:disabled):not([disabled]):not(&--active) {
|
|
229
|
+
background-color: t.alpha('on-surface-variant', 0.12);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Ripple effect styling
|
|
233
|
+
.#{$component}-ripple {
|
|
234
|
+
position: absolute;
|
|
235
|
+
top: 0;
|
|
236
|
+
left: 0;
|
|
237
|
+
right: 0;
|
|
238
|
+
bottom: 0;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
border-radius: inherit;
|
|
241
|
+
pointer-events: none;
|
|
119
242
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
243
|
+
.ripple {
|
|
244
|
+
position: absolute;
|
|
245
|
+
border-radius: 50%;
|
|
246
|
+
transform: scale(0);
|
|
247
|
+
pointer-events: none;
|
|
248
|
+
background-color: currentColor;
|
|
249
|
+
opacity: 0.1;
|
|
250
|
+
transform-origin: center;
|
|
123
251
|
}
|
|
124
252
|
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Tab panel styles
|
|
256
|
+
.#{base.$prefix}-tab-panel {
|
|
257
|
+
padding: 16px;
|
|
125
258
|
|
|
126
|
-
|
|
127
|
-
|
|
259
|
+
&[hidden] {
|
|
260
|
+
display: none;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Scroll indicators
|
|
265
|
+
.#{$container} {
|
|
266
|
+
&-scroll-indicator {
|
|
128
267
|
position: absolute;
|
|
268
|
+
top: 0;
|
|
129
269
|
bottom: 0;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
background-color: t.color('primary');
|
|
133
|
-
transform-origin: left center;
|
|
270
|
+
width: 24px;
|
|
271
|
+
pointer-events: none;
|
|
134
272
|
z-index: 1;
|
|
273
|
+
opacity: 0;
|
|
274
|
+
transition: opacity 0.2s ease;
|
|
135
275
|
|
|
136
|
-
|
|
137
|
-
|
|
276
|
+
&.visible {
|
|
277
|
+
opacity: 1;
|
|
138
278
|
}
|
|
139
279
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Variants
|
|
147
|
-
|
|
148
|
-
// Primary variant (default)
|
|
149
|
-
&--primary {
|
|
150
|
-
.#{$component}__tab {
|
|
151
|
-
color: t.color('on-surface-variant');
|
|
152
|
-
|
|
153
|
-
&--active {
|
|
154
|
-
color: t.color('primary');
|
|
155
|
-
}
|
|
280
|
+
&--left {
|
|
281
|
+
left: 0;
|
|
282
|
+
background: linear-gradient(to right, t.color('surface'), transparent);
|
|
156
283
|
}
|
|
157
284
|
|
|
158
|
-
|
|
159
|
-
|
|
285
|
+
&--right {
|
|
286
|
+
right: 0;
|
|
287
|
+
background: linear-gradient(to left, t.color('surface'), transparent);
|
|
160
288
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
289
|
+
|
|
290
|
+
&--shadow {
|
|
291
|
+
&.#{$container}-scroll-indicator--left {
|
|
292
|
+
box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.2);
|
|
293
|
+
background: none;
|
|
294
|
+
}
|
|
167
295
|
|
|
168
|
-
|
|
169
|
-
|
|
296
|
+
&.#{$container}-scroll-indicator--right {
|
|
297
|
+
box-shadow: -2px 0 4px -2px rgba(0, 0, 0, 0.2);
|
|
298
|
+
background: none;
|
|
170
299
|
}
|
|
171
300
|
}
|
|
172
|
-
|
|
173
|
-
.#{$component}__indicator {
|
|
174
|
-
background-color: t.color('secondary');
|
|
175
|
-
}
|
|
176
301
|
}
|
|
177
302
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
303
|
+
&-scroll-button {
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: 50%;
|
|
306
|
+
transform: translateY(-50%);
|
|
307
|
+
width: 40px;
|
|
308
|
+
height: 40px;
|
|
309
|
+
border-radius: 50%;
|
|
310
|
+
background-color: t.color('surface-container-high');
|
|
311
|
+
border: none;
|
|
312
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
|
313
|
+
display: flex;
|
|
314
|
+
align-items: center;
|
|
315
|
+
justify-content: center;
|
|
316
|
+
cursor: pointer;
|
|
317
|
+
z-index: 2;
|
|
183
318
|
|
|
184
|
-
|
|
185
|
-
|
|
319
|
+
&:disabled {
|
|
320
|
+
opacity: 0.38;
|
|
321
|
+
cursor: default;
|
|
186
322
|
}
|
|
187
323
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
&--active {
|
|
193
|
-
background-color: t.color('surface');
|
|
194
|
-
color: t.color('on-surface');
|
|
195
|
-
@include m.elevation(1);
|
|
196
|
-
}
|
|
324
|
+
svg {
|
|
325
|
+
width: 24px;
|
|
326
|
+
height: 24px;
|
|
327
|
+
fill: t.color('on-surface');
|
|
197
328
|
}
|
|
198
329
|
|
|
199
|
-
|
|
200
|
-
|
|
330
|
+
&--left {
|
|
331
|
+
left: 4px;
|
|
201
332
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
&--neutral {
|
|
206
|
-
.#{$component}__tab {
|
|
207
|
-
color: t.color('on-surface-variant');
|
|
208
|
-
|
|
209
|
-
&--active {
|
|
210
|
-
color: t.color('on-surface');
|
|
211
|
-
}
|
|
333
|
+
|
|
334
|
+
&--right {
|
|
335
|
+
right: 4px;
|
|
212
336
|
}
|
|
213
337
|
|
|
214
|
-
|
|
215
|
-
|
|
338
|
+
&:focus {
|
|
339
|
+
outline: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
&:focus-visible {
|
|
343
|
+
outline: 2px solid t.color('primary');
|
|
216
344
|
}
|
|
217
345
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Responsive styles for small screens
|
|
349
|
+
.#{$container}--responsive-small {
|
|
350
|
+
.#{$component} {
|
|
351
|
+
padding: 0 12px;
|
|
352
|
+
min-width: 72px;
|
|
223
353
|
}
|
|
224
354
|
}
|