mtrl 0.5.2 → 0.5.4
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/dist/components/checkbox/api.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts +17 -6
- package/dist/components/chips/api.d.ts +5 -2
- package/dist/components/chips/chip/api.d.ts +1 -1
- package/dist/components/chips/config.d.ts +5 -1
- package/dist/components/chips/types.d.ts +14 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/select/types.d.ts +21 -3
- package/dist/components/switch/types.d.ts +8 -4
- package/dist/index.cjs +14 -14
- package/dist/index.cjs.map +13 -13
- package/dist/index.js +14 -14
- package/dist/index.js.map +13 -13
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +4 -2
- package/src/styles/abstract/_base.scss +2 -0
- package/src/styles/abstract/_config.scss +28 -0
- package/src/styles/abstract/_functions.scss +124 -0
- package/src/styles/abstract/_mixins.scss +401 -0
- package/src/styles/abstract/_theme.scss +269 -0
- package/src/styles/abstract/_variables.scss +338 -0
- package/src/styles/base/_reset.scss +86 -0
- package/src/styles/base/_typography.scss +155 -0
- package/src/styles/components/_badge.scss +183 -0
- package/src/styles/components/_bottom-app-bar.scss +103 -0
- package/src/styles/components/_button.scss +756 -0
- package/src/styles/components/_card.scss +401 -0
- package/src/styles/components/_carousel.scss +645 -0
- package/src/styles/components/_checkbox.scss +231 -0
- package/src/styles/components/_chips.scss +643 -0
- package/src/styles/components/_datepicker.scss +358 -0
- package/src/styles/components/_dialog.scss +259 -0
- package/src/styles/components/_divider.scss +57 -0
- package/src/styles/components/_extended-fab.scss +309 -0
- package/src/styles/components/_fab.scss +244 -0
- package/src/styles/components/_list.scss +774 -0
- package/src/styles/components/_menu.scss +245 -0
- package/src/styles/components/_navigation-mobile.scss +244 -0
- package/src/styles/components/_navigation-system.scss +151 -0
- package/src/styles/components/_navigation.scss +407 -0
- package/src/styles/components/_progress.scss +101 -0
- package/src/styles/components/_radios.scss +187 -0
- package/src/styles/components/_search.scss +306 -0
- package/src/styles/components/_segmented-button.scss +227 -0
- package/src/styles/components/_select.scss +274 -0
- package/src/styles/components/_sheet.scss +236 -0
- package/src/styles/components/_slider.scss +264 -0
- package/src/styles/components/_snackbar.scss +211 -0
- package/src/styles/components/_switch.scss +305 -0
- package/src/styles/components/_tabs.scss +421 -0
- package/src/styles/components/_textfield.scss +1035 -0
- package/src/styles/components/_timepicker.scss +451 -0
- package/src/styles/components/_tooltip.scss +241 -0
- package/src/styles/components/_top-app-bar.scss +225 -0
- package/src/styles/main.scss +129 -0
- package/src/styles/themes/_autumn.scss +105 -0
- package/src/styles/themes/_base-theme.scss +85 -0
- package/src/styles/themes/_baseline.scss +173 -0
- package/src/styles/themes/_bluekhaki.scss +125 -0
- package/src/styles/themes/_brownbeige.scss +125 -0
- package/src/styles/themes/_browngreen.scss +125 -0
- package/src/styles/themes/_forest.scss +77 -0
- package/src/styles/themes/_greenbeige.scss +125 -0
- package/src/styles/themes/_index.scss +19 -0
- package/src/styles/themes/_material.scss +125 -0
- package/src/styles/themes/_ocean.scss +77 -0
- package/src/styles/themes/_sageivory.scss +125 -0
- package/src/styles/themes/_spring.scss +77 -0
- package/src/styles/themes/_summer.scss +87 -0
- package/src/styles/themes/_sunset.scss +60 -0
- package/src/styles/themes/_tealcaramel.scss +125 -0
- package/src/styles/themes/_winter.scss +77 -0
- package/src/styles/utilities/_colors.scss +154 -0
- package/src/styles/utilities/_flexbox.scss +194 -0
- package/src/styles/utilities/_layout.scss +665 -0
- package/src/styles/utilities/_ripple.scss +79 -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
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
// src/components/card/_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}-card';
|
|
9
|
+
|
|
10
|
+
.#{$component} {
|
|
11
|
+
// Base styles
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
border-radius: f.get-shape('medium'); // Use function for MD3 standard shape
|
|
17
|
+
background-color: t.color('surface');
|
|
18
|
+
color: t.color('on-surface');
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
width: v.card('width'); // Use card width variable
|
|
21
|
+
--card-elevation: 0;
|
|
22
|
+
|
|
23
|
+
// Typography - use mixin
|
|
24
|
+
@include m.typography('body-medium');
|
|
25
|
+
|
|
26
|
+
// Transition for elevation and hover states - use motion-transition mixin
|
|
27
|
+
@include m.motion-transition(
|
|
28
|
+
box-shadow,
|
|
29
|
+
background-color,
|
|
30
|
+
border-color
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Focus outline for accessibility - use focus-ring mixin
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
@include m.focus-ring(t.color('secondary'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Focus state class
|
|
39
|
+
&--focused {
|
|
40
|
+
@include m.focus-ring(t.color('secondary'));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Ripple styles for clickable cards
|
|
44
|
+
.ripple {
|
|
45
|
+
position: absolute;
|
|
46
|
+
border-radius: 50%;
|
|
47
|
+
transform: scale(0);
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
background-color: currentColor;
|
|
50
|
+
opacity: f.get-state-opacity('hover'); // Use function for standard opacity
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Ensure proper stacking for inner components
|
|
54
|
+
> :not(:last-child) {
|
|
55
|
+
margin-bottom: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// === Variants - use proper theme colors ===
|
|
59
|
+
|
|
60
|
+
// Elevated variant
|
|
61
|
+
&--elevated {
|
|
62
|
+
background-color: t.color('surface-container-low');
|
|
63
|
+
@include m.elevation(1); // Use elevation mixin
|
|
64
|
+
|
|
65
|
+
&:hover.#{$component}--interactive {
|
|
66
|
+
@include m.elevation(2); // Use elevation mixin for hover state
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:active.#{$component}--interactive {
|
|
70
|
+
@include m.state-layer(t.color('on-surface'), 'pressed'); // Use state-layer mixin
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Filled variant
|
|
75
|
+
&--filled {
|
|
76
|
+
background-color: t.color('surface-container-highest');
|
|
77
|
+
@include m.elevation(0); // No elevation
|
|
78
|
+
|
|
79
|
+
&:hover.#{$component}--interactive {
|
|
80
|
+
@include m.state-layer(t.color('on-surface'), 'hover');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:active.#{$component}--interactive {
|
|
84
|
+
@include m.state-layer(t.color('on-surface'), 'pressed');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Outlined variant
|
|
89
|
+
&--outlined {
|
|
90
|
+
border: 1px solid t.color('outline');
|
|
91
|
+
background-color: t.color('surface');
|
|
92
|
+
@include m.elevation(0); // No elevation
|
|
93
|
+
|
|
94
|
+
&:hover.#{$component}--interactive {
|
|
95
|
+
@include m.state-layer(t.color('on-surface'), 'hover');
|
|
96
|
+
border-color: t.color('outline-variant');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:active.#{$component}--interactive {
|
|
100
|
+
@include m.state-layer(t.color('on-surface'), 'pressed');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// === Modifiers ===
|
|
105
|
+
|
|
106
|
+
// Interactive cards
|
|
107
|
+
&--interactive {
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
user-select: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Full-width cards
|
|
113
|
+
&--full-width {
|
|
114
|
+
width: 100%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// === Sub-components ===
|
|
118
|
+
|
|
119
|
+
// Card Header
|
|
120
|
+
&-header {
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
padding: v.card('padding');
|
|
124
|
+
padding-bottom: 0;
|
|
125
|
+
|
|
126
|
+
&-avatar {
|
|
127
|
+
margin-right: v.card('padding');
|
|
128
|
+
flex-shrink: 0;
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
|
|
133
|
+
img {
|
|
134
|
+
width: 40px;
|
|
135
|
+
height: 40px;
|
|
136
|
+
border-radius: 50%;
|
|
137
|
+
object-fit: cover;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&-text {
|
|
142
|
+
flex: 1;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&-title {
|
|
147
|
+
margin: 0;
|
|
148
|
+
@include m.typography('title-large');
|
|
149
|
+
@include m.truncate;
|
|
150
|
+
color: t.color('on-surface');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&-subtitle {
|
|
154
|
+
margin: 0;
|
|
155
|
+
@include m.typography('body-medium');
|
|
156
|
+
@include m.truncate;
|
|
157
|
+
color: t.color('on-surface-variant');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&-action {
|
|
161
|
+
margin-left: 8px;
|
|
162
|
+
flex-shrink: 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Card Media
|
|
167
|
+
&-media {
|
|
168
|
+
position: relative;
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
border-radius: f.get-shape('medium');
|
|
171
|
+
&-img {
|
|
172
|
+
display: block;
|
|
173
|
+
width: 100%;
|
|
174
|
+
object-fit: cover;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Aspect ratios
|
|
178
|
+
&--16-9 {
|
|
179
|
+
aspect-ratio: 16 / 9;
|
|
180
|
+
|
|
181
|
+
img {
|
|
182
|
+
height: 100%;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&--4-3 {
|
|
187
|
+
aspect-ratio: 4 / 3;
|
|
188
|
+
|
|
189
|
+
img {
|
|
190
|
+
height: 100%;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&--1-1 {
|
|
195
|
+
aspect-ratio: 1 / 1;
|
|
196
|
+
|
|
197
|
+
img {
|
|
198
|
+
height: 100%;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&--contain {
|
|
203
|
+
img {
|
|
204
|
+
object-fit: contain;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Card Content
|
|
210
|
+
&-content {
|
|
211
|
+
padding: v.card('padding');
|
|
212
|
+
flex: 1 1 auto;
|
|
213
|
+
|
|
214
|
+
> *:first-child {
|
|
215
|
+
margin-top: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
> *:last-child {
|
|
219
|
+
margin-bottom: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// When content follows media without padding
|
|
223
|
+
.#{$component}-media + &:not(.#{$component}-content--no-padding) {
|
|
224
|
+
padding-top: v.card('padding');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// No padding modifier
|
|
228
|
+
&--no-padding {
|
|
229
|
+
padding: 0;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Card Actions
|
|
234
|
+
&-actions {
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-wrap: wrap;
|
|
237
|
+
padding: 8px;
|
|
238
|
+
align-items: center;
|
|
239
|
+
|
|
240
|
+
> * {
|
|
241
|
+
margin: 0 4px;
|
|
242
|
+
|
|
243
|
+
&:first-child {
|
|
244
|
+
margin-left: 8px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&:last-child {
|
|
248
|
+
margin-right: 8px;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Full-bleed actions
|
|
253
|
+
&--full-bleed {
|
|
254
|
+
padding: 0;
|
|
255
|
+
|
|
256
|
+
> * {
|
|
257
|
+
margin: 0;
|
|
258
|
+
border-radius: 0;
|
|
259
|
+
flex: 1 1 auto;
|
|
260
|
+
|
|
261
|
+
&:first-child {
|
|
262
|
+
margin-left: 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&:last-child {
|
|
266
|
+
margin-right: 0;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Vertical actions
|
|
272
|
+
&--vertical {
|
|
273
|
+
flex-direction: column;
|
|
274
|
+
|
|
275
|
+
> * {
|
|
276
|
+
width: 100%;
|
|
277
|
+
margin: 4px 0;
|
|
278
|
+
|
|
279
|
+
&:first-child {
|
|
280
|
+
margin-top: 8px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&:last-child {
|
|
284
|
+
margin-bottom: 8px;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Alignment variations
|
|
290
|
+
&--center {
|
|
291
|
+
justify-content: center;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&--end {
|
|
295
|
+
justify-content: flex-end;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&--space-between {
|
|
299
|
+
justify-content: space-between;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// State classes
|
|
304
|
+
&--state-disabled {
|
|
305
|
+
opacity: 0.38; // Use mtrl standard opacity
|
|
306
|
+
pointer-events: none;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
&--state-loading {
|
|
310
|
+
pointer-events: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
&--dragging {
|
|
314
|
+
@include m.elevation(4); // Use elevation mixin
|
|
315
|
+
opacity: 0.9;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Loading overlay
|
|
319
|
+
&-loading-overlay {
|
|
320
|
+
position: absolute;
|
|
321
|
+
top: 0;
|
|
322
|
+
left: 0;
|
|
323
|
+
width: 100%;
|
|
324
|
+
height: 100%;
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: center;
|
|
328
|
+
background-color: t.alpha('surface', 0.7);
|
|
329
|
+
z-index: f.get-z-index('default');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&-loading-spinner {
|
|
333
|
+
width: 40px;
|
|
334
|
+
height: 40px;
|
|
335
|
+
border-radius: 50%;
|
|
336
|
+
border: 3px solid t.alpha('primary', 0.2);
|
|
337
|
+
border-top-color: t.color('primary');
|
|
338
|
+
animation: card-spinner 1s infinite linear;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Expandable content
|
|
342
|
+
&-expandable-content {
|
|
343
|
+
overflow: hidden;
|
|
344
|
+
transition: max-height f.get-motion-duration('medium1') f.get-motion-easing('standard');
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&-expand-button {
|
|
348
|
+
background: none;
|
|
349
|
+
border: none;
|
|
350
|
+
padding: 8px;
|
|
351
|
+
cursor: pointer;
|
|
352
|
+
color: t.color('primary');
|
|
353
|
+
display: inline-flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
|
|
357
|
+
&::before {
|
|
358
|
+
content: '';
|
|
359
|
+
display: inline-block;
|
|
360
|
+
width: 10px;
|
|
361
|
+
height: 10px;
|
|
362
|
+
border-right: 2px solid currentColor;
|
|
363
|
+
border-bottom: 2px solid currentColor;
|
|
364
|
+
transform: rotate(45deg);
|
|
365
|
+
transition: transform f.get-motion-duration('short2') f.get-motion-easing('standard');
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
&[aria-expanded="true"]::before {
|
|
369
|
+
transform: rotate(-135deg);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Swipeable card
|
|
374
|
+
&--swipeable {
|
|
375
|
+
touch-action: pan-y;
|
|
376
|
+
transition: transform f.get-motion-duration('medium1') f.get-motion-easing('standard');
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Hidden buttons for accessibility
|
|
380
|
+
&-swipe-left-action,
|
|
381
|
+
&-swipe-right-action {
|
|
382
|
+
@include m.visually-hidden; // Use visually-hidden mixin
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Spinner animation
|
|
387
|
+
@keyframes card-spinner {
|
|
388
|
+
0% {
|
|
389
|
+
transform: rotate(0deg);
|
|
390
|
+
}
|
|
391
|
+
100% {
|
|
392
|
+
transform: rotate(360deg);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Media query for responsive adjustments
|
|
397
|
+
@include m.breakpoint-down('sm') {
|
|
398
|
+
.#{$component} {
|
|
399
|
+
width: 100%; // Full width on small screens
|
|
400
|
+
}
|
|
401
|
+
}
|