mtrl 0.9.5 → 0.9.8
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/README.md +20 -0
- package/dist/README.md +20 -0
- package/dist/components/bottom-app-bar/bottom-app-bar.js +2 -2
- package/dist/components/bottom-sheet/features/structure.js +4 -3
- package/dist/components/button/api.js +3 -2
- package/dist/components/button/features/progress.js +26 -21
- package/dist/components/button-group/config.d.ts +11 -3
- package/dist/components/button-group/config.js +1 -1
- package/dist/components/card/content.js +5 -4
- package/dist/components/carousel/features/slides.js +2 -1
- package/dist/components/checkbox/checkbox.js +22 -0
- package/dist/components/checkbox/config.d.ts +3 -3
- package/dist/components/checkbox/config.js +10 -9
- package/dist/components/checkbox/types.d.ts +19 -4
- package/dist/components/chips/api.js +3 -1
- package/dist/components/chips/chip/api.js +3 -2
- package/dist/components/chips/chip/chip.js +6 -4
- package/dist/components/chips/config.js +1 -1
- package/dist/components/datepicker/api.d.ts +8 -2
- package/dist/components/datepicker/api.js +1 -0
- package/dist/components/datepicker/config.d.ts +14 -4
- package/dist/components/datepicker/datepicker.js +5 -2
- package/dist/components/datepicker/types.d.ts +14 -0
- package/dist/components/datepicker/utils.js +4 -6
- package/dist/components/dialog/config.js +0 -1
- package/dist/components/dialog/features.js +10 -8
- package/dist/components/dialog/types.d.ts +3 -2
- package/dist/components/drawer/features/items.js +3 -2
- package/dist/components/list/features/renderer.js +4 -3
- package/dist/components/menu/api.d.ts +1 -1
- package/dist/components/menu/config.js +2 -2
- package/dist/components/menu/features/controller.js +41 -26
- package/dist/components/menu/features/keyboard.js +7 -5
- package/dist/components/menu/features/opener.js +19 -12
- package/dist/components/menu/features/position.js +1 -1
- package/dist/components/menu/features/submenu.js +7 -1
- package/dist/components/menu/types.d.ts +13 -2
- package/dist/components/navigation/nav-item.js +4 -3
- package/dist/components/navigation/system/mobile.js +3 -2
- package/dist/components/navigation-rail/navigation-rail.js +3 -2
- package/dist/components/progress/features/canvas.js +0 -2
- package/dist/components/search/features/states.js +3 -3
- package/dist/components/search/features/structure.js +3 -0
- package/dist/components/search/features/suggestions.js +2 -2
- package/dist/components/search/types.d.ts +6 -0
- package/dist/components/segmented-button/config.d.ts +4 -1
- package/dist/components/segmented-button/config.js +1 -1
- package/dist/components/segmented-button/segment.d.ts +2 -5
- package/dist/components/segmented-button/segment.js +7 -3
- package/dist/components/select/features.js +267 -44
- package/dist/components/side-sheet/features/structure.js +5 -4
- package/dist/components/slider/features/controller.js +7 -0
- package/dist/components/slider/features/dom.d.ts +1 -0
- package/dist/components/slider/features/dom.js +11 -0
- package/dist/components/slider/features/handlers.js +8 -3
- package/dist/components/slider/features/states.js +8 -0
- package/dist/components/slider/types.d.ts +7 -0
- package/dist/components/switch/config.d.ts +3 -3
- package/dist/components/switch/config.js +7 -7
- package/dist/components/switch/features.js +5 -5
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/switch/types.d.ts +10 -0
- package/dist/components/tabs/features.d.ts +1 -0
- package/dist/components/tabs/scroll-indicators.js +3 -2
- package/dist/components/tabs/tab.d.ts +0 -5
- package/dist/components/tabs/tab.js +12 -3
- package/dist/components/tabs/tabs.js +10 -1
- package/dist/components/tabs/utils.d.ts +8 -0
- package/dist/components/tabs/utils.js +63 -18
- package/dist/components/textfield/api.js +12 -4
- package/dist/components/textfield/features/error.d.ts +1 -0
- package/dist/components/textfield/features/error.js +10 -0
- package/dist/components/textfield/features/leading-icon.js +32 -33
- package/dist/components/textfield/features/prefix-text.js +30 -18
- package/dist/components/textfield/features/suffix-text.js +30 -14
- package/dist/components/textfield/features/supporting-text.d.ts +1 -0
- package/dist/components/textfield/features/supporting-text.js +25 -0
- package/dist/components/textfield/features/trailing-icon.js +36 -19
- package/dist/components/timepicker/api.d.ts +1 -1
- package/dist/components/timepicker/api.js +16 -11
- package/dist/components/timepicker/render.js +27 -24
- package/dist/components/timepicker/timepicker.js +4 -2
- package/dist/components/timepicker/types.d.ts +7 -0
- package/dist/components/timepicker/utils.d.ts +14 -0
- package/dist/components/timepicker/utils.js +4 -0
- package/dist/components/tooltip/api.js +27 -2
- package/dist/components/top-app-bar/top-app-bar.js +3 -2
- package/dist/core/compose/component.d.ts +1 -1
- package/dist/core/compose/component.js +1 -1
- package/dist/core/compose/features/icon.js +3 -2
- package/dist/core/compose/features/input.js +1 -1
- package/dist/core/compose/features/lifecycle.js +10 -11
- package/dist/core/compose/features/textlabel.js +3 -0
- package/dist/core/compose/features/track.js +2 -1
- package/dist/core/config/component.d.ts +1 -1
- package/dist/core/config/component.js +1 -1
- package/dist/core/dom/create.js +5 -4
- package/dist/core/dom/form-value.d.ts +24 -0
- package/dist/core/dom/form-value.js +14 -0
- package/dist/core/dom/html.d.ts +34 -0
- package/dist/core/dom/html.js +13 -0
- package/dist/core/dom/index.d.ts +2 -0
- package/dist/core/dom/index.js +1 -0
- package/dist/core/dom/utils.js +1 -1
- package/dist/core/state/emitter.js +8 -1
- package/dist/core/state/index.d.ts +1 -1
- package/dist/core/state/store.d.ts +10 -2
- package/dist/core/state/store.js +2 -1
- package/dist/index.cjs +0 -0
- package/dist/package.json +5 -2
- 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/styles.d.ts +1 -0
- 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 +7 -3
- package/src/styles/abstract/_mixins.scss +26 -0
- package/src/styles/abstract/_variables.scss +25 -11
- package/src/styles/base/_reset.scss +9 -2
- package/src/styles/components/_bottom-sheet.scss +23 -7
- package/src/styles/components/_button.scss +1 -12
- 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
|
@@ -15,8 +15,7 @@ $component: "#{base.$prefix}-dialog";
|
|
|
15
15
|
left: 0;
|
|
16
16
|
right: 0;
|
|
17
17
|
bottom: 0;
|
|
18
|
-
background-color:
|
|
19
|
-
opacity: 0;
|
|
18
|
+
background-color: transparent;
|
|
20
19
|
visibility: hidden;
|
|
21
20
|
z-index: v.z-index("modal");
|
|
22
21
|
display: flex;
|
|
@@ -26,19 +25,32 @@ $component: "#{base.$prefix}-dialog";
|
|
|
26
25
|
padding: 24px;
|
|
27
26
|
box-sizing: border-box;
|
|
28
27
|
|
|
29
|
-
//
|
|
28
|
+
// The scrim fades on its own colour rather than on opacity: the dialog is
|
|
29
|
+
// its child, so fading the layer faded the dialog with it, and the two
|
|
30
|
+
// opacities multiplied into what read as a cut.
|
|
31
|
+
// material-web animates the scrim linearly, 500ms in and 150ms out
|
|
32
|
+
// (dialog/internal/animations.ts).
|
|
30
33
|
transition:
|
|
31
|
-
|
|
32
|
-
visibility v.motion("duration-
|
|
34
|
+
background-color v.motion("duration-short3") linear,
|
|
35
|
+
visibility 0s linear v.motion("duration-short3");
|
|
33
36
|
|
|
34
37
|
&--visible {
|
|
35
|
-
|
|
38
|
+
background-color: t.alpha("scrim", 0.32);
|
|
36
39
|
visibility: visible;
|
|
40
|
+
transition: background-color v.motion("duration-long2") linear, visibility 0s;
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
// Dialog container
|
|
41
45
|
// MD3: surface-container-high, 28dp corners, elevation 3
|
|
46
|
+
//
|
|
47
|
+
// Motion follows material-web, the Material web implementation
|
|
48
|
+
// (dialog/internal/animations.ts): the surface grows in height, 35% to 100%
|
|
49
|
+
// over 500ms emphasized, while the dialog slides down into place and the
|
|
50
|
+
// headline, content and actions fade in one after another. Closing takes
|
|
51
|
+
// 150ms on emphasized accelerate. The growth is a scale of the dialog's
|
|
52
|
+
// height from its top, the motion the menu opens with.
|
|
53
|
+
|
|
42
54
|
.#{$component} {
|
|
43
55
|
position: relative;
|
|
44
56
|
background-color: t.color("surface-container-high");
|
|
@@ -50,24 +62,43 @@ $component: "#{base.$prefix}-dialog";
|
|
|
50
62
|
margin: auto;
|
|
51
63
|
@include m.elevation(3);
|
|
52
64
|
|
|
53
|
-
// Hidden
|
|
65
|
+
// Hidden: 35% of its height, lifted slightly, not yet painted
|
|
66
|
+
transform-origin: top center;
|
|
67
|
+
transform: translateY(-50px) scaleY(0.35);
|
|
54
68
|
opacity: 0;
|
|
55
|
-
transform-origin: center center;
|
|
56
|
-
// Dialogs fade in with a slight scale; the vertical squash this replaced
|
|
57
|
-
// is not an M3 pattern
|
|
58
|
-
transform: scale(0.8);
|
|
59
69
|
pointer-events: none;
|
|
60
|
-
|
|
61
|
-
// MD3 emphasized easing for dialogs
|
|
62
70
|
transition:
|
|
63
|
-
transform v.motion("duration-
|
|
64
|
-
opacity v.motion("duration-
|
|
71
|
+
transform v.motion("duration-short3") v.motion("easing-emphasized-accelerate"),
|
|
72
|
+
opacity v.motion("duration-short1") linear v.motion("duration-short2");
|
|
73
|
+
|
|
74
|
+
// Its contents fade with the surface, and lead it on the way out
|
|
75
|
+
.#{$component}-header,
|
|
76
|
+
.#{$component}-content,
|
|
77
|
+
.#{$component}-footer {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transition: opacity v.motion("duration-short2") linear;
|
|
80
|
+
}
|
|
65
81
|
|
|
66
82
|
// Visible state
|
|
67
83
|
&--visible {
|
|
84
|
+
transform: translateY(0) scaleY(1);
|
|
68
85
|
opacity: 1;
|
|
69
|
-
transform: scale(1);
|
|
70
86
|
pointer-events: auto;
|
|
87
|
+
transition:
|
|
88
|
+
transform v.motion("duration-long2") v.motion("easing-emphasized"),
|
|
89
|
+
opacity v.motion("duration-short1") linear;
|
|
90
|
+
|
|
91
|
+
// The headline and content follow the surface, the actions last
|
|
92
|
+
.#{$component}-header,
|
|
93
|
+
.#{$component}-content {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
transition: opacity v.motion("duration-medium1") linear v.motion("duration-short1");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.#{$component}-footer {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
transition: opacity v.motion("duration-medium2") linear v.motion("duration-short3");
|
|
101
|
+
}
|
|
71
102
|
}
|
|
72
103
|
|
|
73
104
|
// Size variants
|
|
@@ -102,28 +133,28 @@ $component: "#{base.$prefix}-dialog";
|
|
|
102
133
|
margin: 0;
|
|
103
134
|
border-radius: 0;
|
|
104
135
|
transform-origin: center center;
|
|
105
|
-
|
|
106
|
-
transform: scale(0.9);
|
|
136
|
+
transform: translateY(24px);
|
|
107
137
|
|
|
108
138
|
&.#{$component}--visible {
|
|
109
|
-
transform:
|
|
139
|
+
transform: translateY(0);
|
|
110
140
|
}
|
|
111
141
|
}
|
|
112
142
|
|
|
113
|
-
//
|
|
143
|
+
// The variants change where the dialog comes from; it grows in height
|
|
144
|
+
// either way, which is the M3 motion
|
|
114
145
|
&--slide-up {
|
|
115
|
-
transform: translateY(24px);
|
|
146
|
+
transform: translateY(24px) scaleY(0.35);
|
|
116
147
|
|
|
117
148
|
&.#{$component}--visible {
|
|
118
|
-
transform: translateY(0);
|
|
149
|
+
transform: translateY(0) scaleY(1);
|
|
119
150
|
}
|
|
120
151
|
}
|
|
121
152
|
|
|
122
153
|
&--slide-down {
|
|
123
|
-
transform: translateY(-24px);
|
|
154
|
+
transform: translateY(-24px) scaleY(0.35);
|
|
124
155
|
|
|
125
156
|
&.#{$component}--visible {
|
|
126
|
-
transform: translateY(0);
|
|
157
|
+
transform: translateY(0) scaleY(1);
|
|
127
158
|
}
|
|
128
159
|
}
|
|
129
160
|
|
|
@@ -135,7 +166,7 @@ $component: "#{base.$prefix}-dialog";
|
|
|
135
166
|
}
|
|
136
167
|
}
|
|
137
168
|
|
|
138
|
-
//
|
|
169
|
+
// The basic dialog of the previous spec: a scale rather than a slide
|
|
139
170
|
&--scale {
|
|
140
171
|
transform-origin: center center;
|
|
141
172
|
transform: scale(0.8);
|
|
@@ -386,7 +417,9 @@ $component: "#{base.$prefix}-dialog";
|
|
|
386
417
|
// Accessibility - Reduced motion preference support
|
|
387
418
|
@include m.reduced-motion {
|
|
388
419
|
.#{$component},
|
|
389
|
-
.#{$component}
|
|
420
|
+
.#{$component}--visible,
|
|
421
|
+
.#{$component}-overlay,
|
|
422
|
+
.#{$component}-overlay--visible {
|
|
390
423
|
transition: opacity v.motion("duration-short2") linear;
|
|
391
424
|
}
|
|
392
425
|
|
|
@@ -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
|
}
|