mtrl 0.9.4 → 0.9.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/dist/components/badge/api.d.ts +0 -1
- package/dist/components/badge/api.js +3 -1
- package/dist/components/bottom-app-bar/bottom-app-bar.js +9 -2
- package/dist/components/button/features/progress.d.ts +5 -0
- package/dist/components/button/features/progress.js +16 -12
- package/dist/components/card/api.js +17 -14
- package/dist/components/card/config.js +1 -1
- package/dist/components/card/content.js +2 -5
- package/dist/components/dialog/config.js +0 -1
- package/dist/components/dialog/features.js +5 -4
- package/dist/components/dialog/types.d.ts +3 -2
- package/dist/components/divider/features.d.ts +2 -46
- package/dist/components/divider/features.js +54 -115
- package/dist/components/menu/config.js +2 -2
- package/dist/components/menu/features/controller.js +37 -23
- package/dist/components/menu/features/opener.js +4 -2
- package/dist/components/menu/types.d.ts +12 -1
- package/dist/components/radios/api.d.ts +4 -6
- package/dist/components/radios/api.js +5 -25
- package/dist/components/radios/radio.js +8 -33
- package/dist/components/search/features/states.js +2 -0
- package/dist/components/search/features/suggestions.js +3 -0
- package/dist/components/select/api.js +2 -0
- package/dist/components/select/features.js +252 -31
- package/dist/components/slider/features/controller.js +11 -2
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/tabs/api.js +12 -6
- package/dist/components/tabs/features.js +5 -7
- package/dist/components/tabs/tabs.js +16 -1
- package/dist/components/tabs/utils.d.ts +8 -0
- package/dist/components/tabs/utils.js +42 -17
- package/dist/components/textfield/features/error.d.ts +2 -0
- package/dist/components/textfield/features/error.js +22 -0
- package/dist/components/textfield/features/supporting-text.d.ts +1 -0
- package/dist/components/textfield/features/supporting-text.js +25 -0
- package/dist/components/tooltip/api.js +42 -7
- package/dist/components/top-app-bar/top-app-bar.js +3 -0
- package/dist/core/compose/features/input.js +1 -1
- package/dist/core/compose/features/textinput.d.ts +4 -0
- package/dist/core/compose/features/textinput.js +1 -0
- package/dist/core/compose/features/textlabel.js +3 -0
- package/dist/index.cjs +0 -0
- package/dist/package.json +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +2 -2
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +2 -2
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +2 -2
- package/dist/styles/card.css +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +2 -2
- package/dist/styles/chips.css +2 -2
- package/dist/styles/dialog.css +2 -2
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +2 -2
- package/dist/styles/extended-fab.css +2 -2
- package/dist/styles/fab.css +2 -2
- package/dist/styles/icon-button.css +2 -2
- package/dist/styles/list.css +2 -2
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +2 -2
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/navigation.css +2 -2
- package/dist/styles/progress.css +2 -2
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/segmented-button.css +2 -2
- package/dist/styles/select.css +2 -2
- package/dist/styles/side-sheet.css +2 -2
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +2 -2
- package/dist/styles/switch.css +2 -2
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/textfield.css +2 -2
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/tooltip.css +2 -2
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/browngreen.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/legacy.css +1 -1
- package/dist/themes/material.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/winter.css +1 -1
- package/package.json +1 -1
- package/src/styles/abstract/_mixins.scss +26 -0
- package/src/styles/abstract/_variables.scss +25 -11
- package/src/styles/components/_bottom-sheet.scss +23 -7
- package/src/styles/components/_dialog.scss +59 -26
- package/src/styles/components/_drawer.scss +60 -7
- package/src/styles/components/_menu.scss +12 -7
- package/src/styles/components/_side-sheet.scss +33 -4
- package/src/styles/components/_tooltip.scss +3 -0
|
@@ -27,9 +27,14 @@ $default-width: 360px;
|
|
|
27
27
|
&--open {
|
|
28
28
|
pointer-events: auto;
|
|
29
29
|
|
|
30
|
+
// Motion follows Compose's ModalNavigationDrawer: the sheet opens on
|
|
31
|
+
// the default spatial spring and closes on fast effects, and the scrim's
|
|
32
|
+
// opacity rides with the sheet. Opacity past 1 is clamped, so the scrim
|
|
33
|
+
// takes the spatial timing without overshooting.
|
|
30
34
|
.#{$component}__sheet {
|
|
31
35
|
transform: translateX(0);
|
|
32
36
|
visibility: visible;
|
|
37
|
+
transition: m.spring(transform, default-spatial);
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
.#{$component}__scrim {
|
|
@@ -38,6 +43,7 @@ $default-width: 360px;
|
|
|
38
43
|
|
|
39
44
|
.#{$component}__scrim--visible {
|
|
40
45
|
opacity: 1;
|
|
46
|
+
transition: m.spring(opacity, default-spatial);
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -117,18 +123,40 @@ $default-width: 360px;
|
|
|
117
123
|
overflow: hidden;
|
|
118
124
|
// Closed: collapse to 0. --#{base.$prefix}-drawer-width is set inline by the JS component.
|
|
119
125
|
width: 0;
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
// Compose's DismissibleNavigationDrawer: open on the default spatial
|
|
127
|
+
// spring, close on fast effects
|
|
128
|
+
transition: m.spring(width, fast-effects);
|
|
122
129
|
|
|
123
130
|
.#{$component}__sheet {
|
|
124
131
|
position: relative;
|
|
125
132
|
background-color: t.color("surface");
|
|
126
133
|
@include m.elevation(0);
|
|
134
|
+
// While the width overshoots, the sheet stretches with it rather
|
|
135
|
+
// than leaving a strip between its edge and the page
|
|
136
|
+
min-width: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// The growing width is the slide: the sheet hangs from the edge facing
|
|
140
|
+
// the page, so it follows that edge without a transform of its own. A
|
|
141
|
+
// transform on the same spring would carry the sheet off the screen
|
|
142
|
+
// edge while it overshoots, where the root clips anything covering the gap.
|
|
143
|
+
&.#{$component}--start .#{$component}__sheet {
|
|
144
|
+
align-self: flex-end;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&.#{$component}--end .#{$component}__sheet {
|
|
148
|
+
align-self: flex-start;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.#{$component} .#{$component}__sheet,
|
|
152
|
+
&.#{$component}--open .#{$component}__sheet {
|
|
153
|
+
transform: none;
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
// Open — expand to the concrete width value via custom property
|
|
130
157
|
&.#{$component}--open {
|
|
131
158
|
width: var(--#{base.$prefix}-drawer-width, $default-width);
|
|
159
|
+
transition: m.spring(width, default-spatial);
|
|
132
160
|
}
|
|
133
161
|
|
|
134
162
|
// Border on the end edge (standard variant visual separator)
|
|
@@ -186,6 +214,25 @@ $default-width: 360px;
|
|
|
186
214
|
background-color: t.color("surface-container-low");
|
|
187
215
|
@include m.elevation(1);
|
|
188
216
|
}
|
|
217
|
+
|
|
218
|
+
// Cover the gap the spring's overshoot opens at the docked edge
|
|
219
|
+
&.#{$component}--start .#{$component}__sheet {
|
|
220
|
+
box-shadow: f.get-elevation(1), (-1 * m.$sheet-overshoot-guard) 0 0 0 t.color("surface-container-low");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&.#{$component}--end .#{$component}__sheet {
|
|
224
|
+
box-shadow: f.get-elevation(1), m.$sheet-overshoot-guard 0 0 0 t.color("surface-container-low");
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@include m.rtl {
|
|
228
|
+
&.#{$component}--start .#{$component}__sheet {
|
|
229
|
+
box-shadow: f.get-elevation(1), m.$sheet-overshoot-guard 0 0 0 t.color("surface-container-low");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&.#{$component}--end .#{$component}__sheet {
|
|
233
|
+
box-shadow: f.get-elevation(1), (-1 * m.$sheet-overshoot-guard) 0 0 0 t.color("surface-container-low");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
189
236
|
}
|
|
190
237
|
|
|
191
238
|
// ========================================================================
|
|
@@ -202,7 +249,7 @@ $default-width: 360px;
|
|
|
202
249
|
overflow-x: hidden;
|
|
203
250
|
box-sizing: border-box;
|
|
204
251
|
padding: 12px 0;
|
|
205
|
-
|
|
252
|
+
transition: m.spring(transform, fast-effects);
|
|
206
253
|
|
|
207
254
|
// Smooth scrollbar
|
|
208
255
|
scrollbar-width: thin;
|
|
@@ -223,7 +270,7 @@ $default-width: 360px;
|
|
|
223
270
|
opacity: 0;
|
|
224
271
|
pointer-events: none;
|
|
225
272
|
z-index: -1;
|
|
226
|
-
|
|
273
|
+
transition: m.spring(opacity, fast-effects);
|
|
227
274
|
}
|
|
228
275
|
|
|
229
276
|
// ========================================================================
|
|
@@ -555,12 +602,18 @@ $default-width: 360px;
|
|
|
555
602
|
// ========================================================================
|
|
556
603
|
|
|
557
604
|
@include m.reduced-motion {
|
|
558
|
-
&--standard
|
|
559
|
-
|
|
605
|
+
&--standard,
|
|
606
|
+
&--standard.#{$component}--open {
|
|
607
|
+
transition: none;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
&__sheet,
|
|
611
|
+
&--open .#{$component}__sheet {
|
|
560
612
|
transition: none;
|
|
561
613
|
}
|
|
562
614
|
|
|
563
|
-
&__scrim
|
|
615
|
+
&__scrim,
|
|
616
|
+
&--open .#{$component}__scrim--visible {
|
|
564
617
|
transition: none;
|
|
565
618
|
}
|
|
566
619
|
|
|
@@ -29,9 +29,10 @@ $component: "#{$prefix}-menu";
|
|
|
29
29
|
flex-direction: column;
|
|
30
30
|
opacity: 0;
|
|
31
31
|
transform-origin: top center;
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
|
|
32
|
+
// The menu grows in height from its anchor when it opens, and closing is
|
|
33
|
+
// the same motion in reverse: the closed state is the height it opens
|
|
34
|
+
// from, on the same duration and curve
|
|
35
|
+
transform: scaleY(0);
|
|
35
36
|
pointer-events: none;
|
|
36
37
|
|
|
37
38
|
// Material Design 3 standard animation curve for menus
|
|
@@ -42,7 +43,7 @@ $component: "#{$prefix}-menu";
|
|
|
42
43
|
// Visible state
|
|
43
44
|
&--visible {
|
|
44
45
|
opacity: 1;
|
|
45
|
-
transform:
|
|
46
|
+
transform: scaleY(1);
|
|
46
47
|
pointer-events: auto;
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -122,7 +123,8 @@ $component: "#{$prefix}-menu";
|
|
|
122
123
|
outline: none;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
&:focus-visible
|
|
126
|
+
&:focus-visible,
|
|
127
|
+
&--active {
|
|
126
128
|
@include m.state-layer(t.color("on-surface"), "focus");
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -186,7 +188,8 @@ $component: "#{$prefix}-menu";
|
|
|
186
188
|
@include m.state-layer(t.color("on-secondary-container"), "hover");
|
|
187
189
|
}
|
|
188
190
|
|
|
189
|
-
&:focus-visible
|
|
191
|
+
&:focus-visible,
|
|
192
|
+
&.#{$component}-item--active {
|
|
190
193
|
@include m.state-layer(t.color("on-secondary-container"), "focus");
|
|
191
194
|
}
|
|
192
195
|
|
|
@@ -386,6 +389,7 @@ $component: "#{$prefix}-menu";
|
|
|
386
389
|
// The shape is the state: 4dp at rest, 12dp once it is touched
|
|
387
390
|
&:hover,
|
|
388
391
|
&:focus-visible,
|
|
392
|
+
&--active,
|
|
389
393
|
&:active {
|
|
390
394
|
border-radius: v.shape("medium");
|
|
391
395
|
}
|
|
@@ -410,7 +414,8 @@ $component: "#{$prefix}-menu";
|
|
|
410
414
|
@include m.state-layer(var(--#{$prefix}-menu-selected-label), "hover");
|
|
411
415
|
}
|
|
412
416
|
|
|
413
|
-
&:focus-visible
|
|
417
|
+
&:focus-visible,
|
|
418
|
+
&.#{$component}-item--active {
|
|
414
419
|
@include m.state-layer(var(--#{$prefix}-menu-selected-label), "focus");
|
|
415
420
|
}
|
|
416
421
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/styles/components/_side-sheet.scss
|
|
2
2
|
@use "../abstract/base" as base;
|
|
3
|
+
@use "../abstract/functions" as f;
|
|
3
4
|
@use "../abstract/variables" as v;
|
|
4
5
|
@use "../abstract/mixins" as m;
|
|
5
6
|
@use "../abstract/theme" as t;
|
|
@@ -35,9 +36,11 @@ $component: "#{base.$prefix}-side-sheet";
|
|
|
35
36
|
background-color: t.alpha("scrim", 0.32);
|
|
36
37
|
opacity: 0;
|
|
37
38
|
visibility: hidden;
|
|
39
|
+
// Closing fades on fast effects, and the scrim leaves the
|
|
40
|
+
// accessibility tree only once the fade is done
|
|
38
41
|
transition:
|
|
39
|
-
|
|
40
|
-
visibility
|
|
42
|
+
m.spring(opacity, fast-effects),
|
|
43
|
+
visibility 0s linear m.spring-duration(fast-effects);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
&-container {
|
|
@@ -49,7 +52,10 @@ $component: "#{base.$prefix}-side-sheet";
|
|
|
49
52
|
box-sizing: border-box;
|
|
50
53
|
pointer-events: auto;
|
|
51
54
|
color: t.color("on-surface");
|
|
52
|
-
|
|
55
|
+
// Motion follows the drawer, the closest Compose surface: open on the
|
|
56
|
+
// default spatial spring, which M3 names for surfaces that partly
|
|
57
|
+
// cover the screen, and close on fast effects
|
|
58
|
+
transition: m.spring(transform, fast-effects);
|
|
53
59
|
|
|
54
60
|
&:focus {
|
|
55
61
|
outline: none;
|
|
@@ -123,6 +129,15 @@ $component: "#{base.$prefix}-side-sheet";
|
|
|
123
129
|
background-color: t.color("surface");
|
|
124
130
|
pointer-events: auto;
|
|
125
131
|
}
|
|
132
|
+
|
|
133
|
+
// Cover the gap the spring's overshoot opens at the docked edge
|
|
134
|
+
&.#{$component}--end .#{$component}-container {
|
|
135
|
+
box-shadow: m.$sheet-overshoot-guard 0 0 0 t.color("surface");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.#{$component}--start .#{$component}-container {
|
|
139
|
+
box-shadow: (-1 * m.$sheet-overshoot-guard) 0 0 0 t.color("surface");
|
|
140
|
+
}
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
&--modal {
|
|
@@ -130,6 +145,14 @@ $component: "#{base.$prefix}-side-sheet";
|
|
|
130
145
|
background-color: t.color("surface-container-low");
|
|
131
146
|
@include m.elevation(1);
|
|
132
147
|
}
|
|
148
|
+
|
|
149
|
+
&.#{$component}--end .#{$component}-container {
|
|
150
|
+
box-shadow: f.get-elevation(1), m.$sheet-overshoot-guard 0 0 0 t.color("surface-container-low");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.#{$component}--start .#{$component}-container {
|
|
154
|
+
box-shadow: f.get-elevation(1), (-1 * m.$sheet-overshoot-guard) 0 0 0 t.color("surface-container-low");
|
|
155
|
+
}
|
|
133
156
|
}
|
|
134
157
|
|
|
135
158
|
// ---------------------------------------------------------------------
|
|
@@ -158,17 +181,23 @@ $component: "#{base.$prefix}-side-sheet";
|
|
|
158
181
|
&--open {
|
|
159
182
|
.#{$component}-container {
|
|
160
183
|
transform: translateX(0);
|
|
184
|
+
transition: m.spring(transform, default-spatial);
|
|
161
185
|
}
|
|
162
186
|
|
|
187
|
+
// Opacity past 1 is clamped, so the scrim takes the sheet's timing
|
|
188
|
+
// without overshooting
|
|
163
189
|
.#{$component}-scrim {
|
|
164
190
|
opacity: 1;
|
|
165
191
|
visibility: visible;
|
|
192
|
+
transition: m.spring(opacity, default-spatial), visibility 0s;
|
|
166
193
|
}
|
|
167
194
|
}
|
|
168
195
|
|
|
169
196
|
@include m.reduced-motion {
|
|
170
197
|
.#{$component}-container,
|
|
171
|
-
.#{$component}-scrim
|
|
198
|
+
.#{$component}-scrim,
|
|
199
|
+
&--open .#{$component}-container,
|
|
200
|
+
&--open .#{$component}-scrim {
|
|
172
201
|
transition: none;
|
|
173
202
|
}
|
|
174
203
|
}
|