@shortfuse/materialdesignweb 0.4.0 → 0.5.0
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/.browserslistrc +2 -1
- package/.eslintrc.json +59 -8
- package/.stylelintrc.json +94 -49
- package/CHANGELOG.md +12 -0
- package/README.md +1 -3
- package/adapters/datatable/column.js +27 -54
- package/adapters/datatable/index.js +69 -81
- package/adapters/dom/index.js +32 -47
- package/adapters/search/index.js +107 -133
- package/components/appbar/_spec.scss +77 -137
- package/components/banner/_spec.scss +28 -63
- package/components/bottomnav/_spec.scss +46 -54
- package/components/bottomnav/index.js +15 -20
- package/components/bottomnav/item.js +4 -5
- package/components/button/README.md +1 -1
- package/components/button/_spec.scss +43 -42
- package/components/button/_theme.scss +27 -50
- package/components/card/_spec.scss +61 -69
- package/components/chip/_spec.scss +21 -44
- package/components/chip/_theme.scss +79 -151
- package/components/chip/index.js +6 -4
- package/components/datatable/_spec.scss +36 -99
- package/components/datatable/_theme.scss +98 -124
- package/components/datatable/cell.js +1 -2
- package/components/datatable/columnheader.js +1 -2
- package/components/datatable/index.js +33 -47
- package/components/datatable/row.js +4 -5
- package/components/dialog/_spec.scss +53 -63
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +62 -88
- package/components/divider/_spec.scss +6 -8
- package/components/elevation/_spec.scss +1 -1
- package/components/fab/_spec.scss +30 -42
- package/components/fab/index.js +4 -8
- package/components/grid/_spec.scss +68 -211
- package/components/layout/_mixins.scss +0 -22
- package/components/layout/_spec.scss +267 -363
- package/components/layout/_theme.scss +10 -35
- package/components/layout/index.js +40 -50
- package/components/list/_spec.scss +57 -91
- package/components/list/_theme.scss +75 -84
- package/components/list/content.js +9 -13
- package/components/list/index.js +34 -38
- package/components/list/item.js +8 -11
- package/components/list/secondary.js +8 -9
- package/components/menu/_spec.scss +134 -167
- package/components/menu/index.js +45 -61
- package/components/menu/item.js +11 -19
- package/components/progress/_spec.scss +43 -34
- package/components/selection/_spec.scss +123 -133
- package/components/selection/_theme.scss +88 -120
- package/components/selection/index.js +9 -15
- package/components/selection/input.js +3 -5
- package/components/selection/radiogroup.js +8 -15
- package/components/slider/_spec.scss +23 -28
- package/components/snackbar/_spec.scss +17 -62
- package/components/snackbar/index.js +15 -21
- package/components/tab/_spec.scss +35 -50
- package/components/tab/content.js +33 -28
- package/components/tab/index.js +30 -33
- package/components/tab/item.js +4 -5
- package/components/tab/list.js +22 -36
- package/components/textfield/README.md +2 -2
- package/components/textfield/_spec.scss +241 -287
- package/components/textfield/_theme.scss +197 -232
- package/components/textfield/index.js +8 -16
- package/components/tooltip/_spec.scss +23 -26
- package/components/type/_spec.scss +19 -16
- package/core/_breakpoint.scss +33 -33
- package/core/_elevation.scss +40 -0
- package/core/_length.scss +0 -1
- package/core/_platform.scss +0 -22
- package/core/_type.scss +7 -6
- package/core/aria/button.js +4 -5
- package/core/aria/keyboard.js +1 -2
- package/core/aria/rovingtabindex.js +14 -17
- package/core/aria/tab.js +1 -2
- package/core/dom.js +18 -109
- package/core/overlay/_spec.scss +5 -8
- package/core/overlay/_theme.scss +126 -150
- package/core/overlay/index.js +19 -32
- package/core/ripple/_spec.scss +16 -17
- package/core/ripple/_theme.scss +13 -33
- package/core/ripple/index.js +36 -44
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -2
- package/core/theme/_functions.scss +22 -0
- package/core/theme/_palettes.scss +0 -1
- package/core/{color → theme}/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.scss +4 -0
- package/core/transition/index.js +73 -76
- package/docs/_flex.scss +7 -1
- package/docs/_menuoptions.js +2 -2
- package/docs/_partials/_appbar.eta +12 -14
- package/docs/_partials/_header.eta +41 -44
- package/docs/_sample-utils.js +15 -20
- package/docs/docs.scss +123 -87
- package/docs/framework.scss +26 -0
- package/docs/index.eta +2 -6
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +22 -28
- package/docs/pages/bottomnav.js +17 -14
- package/docs/pages/button.js +10 -10
- package/docs/pages/card.js +20 -22
- package/docs/pages/chip.js +11 -13
- package/docs/pages/color.js +35 -36
- package/docs/pages/datatable.js +11 -15
- package/docs/pages/dialog.eta +9 -11
- package/docs/pages/dialog.js +6 -9
- package/docs/pages/dom.js +6 -9
- package/docs/pages/elevation.eta +10 -10
- package/docs/pages/fab.js +2 -3
- package/docs/pages/grid.js +5 -5
- package/docs/pages/list.js +1 -2
- package/docs/pages/menu.eta +17 -19
- package/docs/pages/menu.js +7 -11
- package/docs/pages/overlay.js +1 -2
- package/docs/pages/progress.eta +2 -2
- package/docs/pages/progress.js +1 -1
- package/docs/pages/ripple.js +1 -2
- package/docs/pages/search.eta +20 -24
- package/docs/pages/search.js +24 -41
- package/docs/pages/selection.eta +2 -6
- package/docs/pages/selection.js +3 -4
- package/docs/pages/snackbar.js +3 -4
- package/docs/pages/tab.eta +61 -75
- package/docs/pages/tab.js +16 -15
- package/docs/pages/textfield.eta +9 -8
- package/docs/pages/textfield.js +26 -23
- package/docs/pages/tooltip.eta +10 -12
- package/docs/pages/transition.js +5 -7
- package/docs/postrender.js +7 -5
- package/docs/pwa/pwa.eta +14 -16
- package/docs/pwa/pwa.js +19 -27
- package/docs/pwa/pwa.scss +12 -7
- package/docs/themes/theme-colored.scss +9 -11
- package/docs/themes/theme-default.scss +0 -14
- package/index.scss +27 -0
- package/jsconfig.json +7 -3
- package/package.json +26 -15
- package/tsconfig.json +16 -0
- package/{webpack.config.cjs → webpack.config.js} +105 -58
- package/components/template/_theme.scss +0 -27
- package/components/textfield/_mixins.scss +0 -52
- package/core/color/_theme.scss +0 -390
- package/core/color/index.scss +0 -2
- package/core/theme/_mixins.scss +0 -172
- package/core/theme/_variables.scss +0 -24
- package/docs/_mixins.pug +0 -155
- package/docs/pages/appbar.pug +0 -78
- package/docs/pages/bottomnav.pug +0 -137
- package/docs/pages/button.pug +0 -121
- package/docs/pages/card.pug +0 -74
- package/docs/pages/chip.pug +0 -91
- package/docs/pages/color.pug +0 -121
- package/docs/pages/datatable.pug +0 -283
- package/docs/pages/dialog.pug +0 -132
- package/docs/pages/dom.pug +0 -22
- package/docs/pages/elevation.pug +0 -25
- package/docs/pages/fab.pug +0 -66
- package/docs/pages/grid.pug +0 -95
- package/docs/pages/layout.pug +0 -7
- package/docs/pages/list.pug +0 -326
- package/docs/pages/menu.pug +0 -205
- package/docs/pages/overlay.pug +0 -55
- package/docs/pages/progress.pug +0 -16
- package/docs/pages/ripple.pug +0 -21
- package/docs/pages/search.pug +0 -165
- package/docs/pages/selection.pug +0 -74
- package/docs/pages/slider.pug +0 -17
- package/docs/pages/snackbar.pug +0 -60
- package/docs/pages/tab.pug +0 -304
- package/docs/pages/textfield.pug +0 -360
- package/docs/pages/tooltip.pug +0 -78
- package/docs/pages/transition.pug +0 -76
- package/docs/pages/type.pug +0 -29
- package/docs/pwa/_dialogs.pug +0 -96
- package/docs/pwa/_menus.pug +0 -11
- package/docs/pwa/pwa.pug +0 -325
- package/docs/spec.scss +0 -26
- package/docs/themes/_component-themes.scss +0 -26
- package/docs/themes/theme-colored-fallbacks.scss +0 -17
- package/docs/themes/theme-default-fallbacks.scss +0 -17
|
@@ -4,14 +4,28 @@
|
|
|
4
4
|
@use '../../core/_length.scss' as *;
|
|
5
5
|
@use '../../core/_type.scss' as type;
|
|
6
6
|
|
|
7
|
+
:root {
|
|
8
|
+
--mdw-banner__flex-wrap: nowrap;
|
|
9
|
+
--mdw-banner__text-padding-inline-start: 24px;
|
|
10
|
+
--mdw-banner__buttons-margin-inline-start: 0;
|
|
11
|
+
@include breakpoint.has16DPMargin() {
|
|
12
|
+
--mdw-banner__text-padding-inline-start: 16px;
|
|
13
|
+
}
|
|
14
|
+
@include breakpoint.minMediumWindow() {
|
|
15
|
+
--mdw-banner__flex-wrap: wrap;
|
|
16
|
+
--mdw-banner__buttons-margin-inline-start: 90px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
.mdw-banner {
|
|
8
21
|
display: flex;
|
|
9
22
|
align-items: center;
|
|
10
23
|
flex-direction: row;
|
|
24
|
+
flex-wrap: var(--mdw-banner__flex-wrap);
|
|
11
25
|
justify-content: center;
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
border-
|
|
27
|
+
inline-size: 100%;
|
|
28
|
+
border-block-end: solid 1px;
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
.mdw-banner__container {
|
|
@@ -22,34 +36,18 @@
|
|
|
22
36
|
align-items: center;
|
|
23
37
|
flex-wrap: wrap;
|
|
24
38
|
justify-content: flex-end;
|
|
25
|
-
|
|
39
|
+
|
|
26
40
|
box-sizing: border-box;
|
|
27
|
-
max-
|
|
41
|
+
max-inline-size: 960px;
|
|
28
42
|
flex: 1;
|
|
29
|
-
padding-
|
|
30
|
-
padding-bottom: dp(7);
|
|
43
|
+
padding-block: 8px 7px;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
.mdw-banner__icon {
|
|
34
47
|
position: absolute;
|
|
35
|
-
top: dp(24);
|
|
36
|
-
right: auto;
|
|
37
|
-
left: dp(16);
|
|
38
48
|
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
left: auto;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
& ~ .mdw-banner__text {
|
|
45
|
-
margin-right: 0;
|
|
46
|
-
margin-left: dp(40 + 16);
|
|
47
|
-
|
|
48
|
-
:root[dir="rtl"] & {
|
|
49
|
-
margin-right: dp(40 + 16);
|
|
50
|
-
margin-left: 0;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
49
|
+
inset-block-start: 24px;
|
|
50
|
+
inset-inline: 16px auto;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
.mdw-banner__text {
|
|
@@ -58,24 +56,12 @@
|
|
|
58
56
|
|
|
59
57
|
flex-grow: 1;
|
|
60
58
|
|
|
61
|
-
padding-
|
|
62
|
-
padding-left: dp(24);
|
|
59
|
+
padding-inline-start: var(--mdw-banner__text-padding-inline-start);
|
|
63
60
|
|
|
64
61
|
white-space: pre-line;
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
padding-left: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@include breakpoint.has16DPMargin() {
|
|
72
|
-
padding-right: 0;
|
|
73
|
-
padding-left: dp(16);
|
|
74
|
-
|
|
75
|
-
:root[dir="rtl"] & {
|
|
76
|
-
padding-right: dp(16);
|
|
77
|
-
padding-left: 0;
|
|
78
|
-
}
|
|
63
|
+
.mdw-banner__icon ~ & {
|
|
64
|
+
margin-inline: 56px 0; // 40 + 16
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
67
|
|
|
@@ -84,35 +70,14 @@
|
|
|
84
70
|
flex-direction: row-reverse;
|
|
85
71
|
flex-wrap: wrap;
|
|
86
72
|
justify-content: flex-start;
|
|
87
|
-
|
|
88
|
-
max-
|
|
73
|
+
|
|
74
|
+
max-inline-size: 100%;
|
|
89
75
|
flex: none;
|
|
76
|
+
margin-inline-start: var(--mdw-banner__buttons-margin-inline-start);
|
|
90
77
|
|
|
91
78
|
.mdw-button {
|
|
92
|
-
margin-
|
|
93
|
-
margin-left: 0;
|
|
79
|
+
margin-inline: 0 8px;
|
|
94
80
|
|
|
95
81
|
text-align: end;
|
|
96
|
-
|
|
97
|
-
:root[dir="rtl"] & {
|
|
98
|
-
margin-right: 0;
|
|
99
|
-
margin-left: dp(8);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@include breakpoint.minMediumWindow {
|
|
105
|
-
.mdw-banner {
|
|
106
|
-
flex-wrap: nowrap;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.mdw-banner__buttons {
|
|
110
|
-
margin-right: 0;
|
|
111
|
-
margin-left: dp(90);
|
|
112
|
-
|
|
113
|
-
:root[dir="rtl"] & {
|
|
114
|
-
margin-right: dp(90);
|
|
115
|
-
margin-left: 0;
|
|
116
|
-
}
|
|
117
82
|
}
|
|
118
83
|
}
|
|
@@ -4,14 +4,28 @@
|
|
|
4
4
|
@use '../../core/_motion.scss' as motion;
|
|
5
5
|
@use '../../core/_type.scss' as type;
|
|
6
6
|
|
|
7
|
+
:root {
|
|
8
|
+
--mdw-bottomnav__label-opacity: 1;
|
|
9
|
+
--mdw-bottomnav__label-transform: none;
|
|
10
|
+
--mdw-bottomnav__icon-transform: #{translateY(8px)};
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
.mdw-bottomnav {
|
|
8
14
|
display: flex;
|
|
9
15
|
position: relative;
|
|
10
16
|
justify-content: center;
|
|
11
17
|
overflow: hidden;
|
|
12
18
|
|
|
13
|
-
min-
|
|
14
|
-
|
|
19
|
+
min-block-size: 56px;
|
|
20
|
+
inline-size: 100%;
|
|
21
|
+
|
|
22
|
+
&[mdw-shifting] {
|
|
23
|
+
.mdw-bottomnav__item:not([aria-selected="true"]) {
|
|
24
|
+
--mdw-bottomnav__label-opacity: 0;
|
|
25
|
+
--mdw-bottomnav__label-transform: #{translateY(8px)};
|
|
26
|
+
--mdw-bottomnav__icon-transform: #{translateY(16px)};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
.mdw-bottomnav__item {
|
|
@@ -21,12 +35,12 @@
|
|
|
21
35
|
flex-direction: column;
|
|
22
36
|
justify-content: flex-start;
|
|
23
37
|
overflow: visible;
|
|
24
|
-
|
|
25
|
-
min-
|
|
26
|
-
flex:
|
|
38
|
+
|
|
39
|
+
min-inline-size: 80px;
|
|
40
|
+
flex: 168px;
|
|
27
41
|
flex-grow: 0;
|
|
28
42
|
// flex-shrink: 1;
|
|
29
|
-
// flex-basis:
|
|
43
|
+
// flex-basis: 168px;
|
|
30
44
|
margin: 0;
|
|
31
45
|
padding: 0;
|
|
32
46
|
|
|
@@ -38,7 +52,7 @@
|
|
|
38
52
|
user-select: none;
|
|
39
53
|
|
|
40
54
|
z-index: 0;
|
|
41
|
-
|
|
55
|
+
|
|
42
56
|
border-radius: 0;
|
|
43
57
|
box-shadow: none;
|
|
44
58
|
}
|
|
@@ -46,56 +60,51 @@
|
|
|
46
60
|
.mdw-bottomnav__icon {
|
|
47
61
|
display: flex;
|
|
48
62
|
position: absolute;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
inset-block-start: 0;
|
|
64
|
+
inset-inline-start: 50%;
|
|
65
|
+
|
|
66
|
+
margin-inline-start: -12px;
|
|
67
|
+
|
|
52
68
|
margin: 0;
|
|
53
|
-
margin-left: dp(-12);
|
|
54
69
|
padding: 0;
|
|
55
70
|
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
|
|
56
73
|
transition-duration: motion.$shapeChangeDuration, motion.$simpleDuration;
|
|
57
74
|
transition-property: transform, color;
|
|
58
75
|
transition-timing-function: motion.$standardEasing;
|
|
59
76
|
|
|
60
|
-
|
|
61
|
-
transform: translateY(dp(8));
|
|
77
|
+
transform: var(--mdw-bottomnav__icon-transform);
|
|
62
78
|
|
|
63
79
|
&:last-child {
|
|
64
80
|
// No label
|
|
65
|
-
transform: translateY(
|
|
81
|
+
transform: translateY(16px);
|
|
66
82
|
}
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
.mdw-bottomnav__badge {
|
|
70
86
|
position: absolute;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
left: dp(16);
|
|
87
|
+
inset-block-start: 0;
|
|
88
|
+
inset-inline: 16px auto;
|
|
74
89
|
|
|
75
|
-
|
|
76
90
|
box-sizing: border-box;
|
|
77
|
-
min-
|
|
78
|
-
min-
|
|
79
|
-
padding:
|
|
91
|
+
min-block-size: 8px;
|
|
92
|
+
min-inline-size: 8px;
|
|
93
|
+
padding: 2px;
|
|
80
94
|
|
|
81
95
|
visibility: hidden;
|
|
82
96
|
|
|
83
97
|
z-index: 1;
|
|
84
98
|
|
|
85
|
-
border-radius:
|
|
99
|
+
border-radius: 8px;
|
|
86
100
|
|
|
87
101
|
font: inherit;
|
|
88
102
|
|
|
89
103
|
font-weight: type.$weightRegular;
|
|
90
|
-
font-size:
|
|
91
|
-
line-height:
|
|
104
|
+
font-size: 10px;
|
|
105
|
+
line-height: 12px;
|
|
92
106
|
letter-spacing: normal;
|
|
93
107
|
|
|
94
|
-
:root[dir="rtl"] & {
|
|
95
|
-
right: dp(16);
|
|
96
|
-
left: auto;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
108
|
&[mdw-badge] {
|
|
100
109
|
visibility: visible;
|
|
101
110
|
|
|
@@ -117,41 +126,24 @@
|
|
|
117
126
|
@include type.addRules('caption');
|
|
118
127
|
@include type.textTopToTop(32);
|
|
119
128
|
@include type.baselineToBottom(8);
|
|
120
|
-
|
|
129
|
+
|
|
121
130
|
// Overriding 12dp for baseline bottom with 8dp for oversized and textwrapped
|
|
122
131
|
// Baseline top will ensure type.baselineToBottom is 12dp for standard layouts
|
|
123
132
|
|
|
124
133
|
box-sizing: border-box;
|
|
125
|
-
max-
|
|
126
|
-
padding: 0
|
|
127
|
-
|
|
134
|
+
max-inline-size: 100%;
|
|
135
|
+
padding: 0 12px;
|
|
136
|
+
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
|
|
128
139
|
transition-duration: motion.$shapeChangeDuration;
|
|
129
140
|
transition-property: transform, opacity, color;
|
|
130
141
|
transition-timing-function: motion.$standardEasing;
|
|
131
142
|
|
|
132
|
-
|
|
143
|
+
opacity: var(--mdw-bottomnav__label-opacity);
|
|
144
|
+
transform: var(--mdw-bottomnav__label-transform);
|
|
133
145
|
|
|
134
146
|
text-align: center;
|
|
135
147
|
word-break: break-all;
|
|
136
148
|
word-break: break-word;
|
|
137
149
|
}
|
|
138
|
-
|
|
139
|
-
.mdw-bottomnav[mdw-shifting] {
|
|
140
|
-
.mdw-bottomnav__icon {
|
|
141
|
-
transform: translateY(dp(16));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.mdw-bottomnav__label {
|
|
145
|
-
opacity: 0;
|
|
146
|
-
transform: translateY(dp(8));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.mdw-bottomnav__item[aria-selected="true"] > .mdw-bottomnav__label {
|
|
150
|
-
opacity: 1;
|
|
151
|
-
transform: translateY(0);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.mdw-bottomnav__item[aria-selected="true"] > .mdw-bottomnav__icon {
|
|
155
|
-
transform: translateY(dp(8));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Keyboard from '../../core/aria/keyboard.js';
|
|
4
4
|
import * as RovingTabIndex from '../../core/aria/rovingtabindex.js';
|
|
5
|
-
import { iterateArrayLike } from '../../core/dom.js';
|
|
6
5
|
|
|
7
6
|
import * as BottomNavItem from './item.js';
|
|
8
7
|
|
|
@@ -12,10 +11,8 @@ import * as BottomNavItem from './item.js';
|
|
|
12
11
|
*/
|
|
13
12
|
function onTabIndexZeroed(event) {
|
|
14
13
|
event.stopPropagation();
|
|
15
|
-
/** @type {HTMLElement} */
|
|
16
|
-
const
|
|
17
|
-
/** @type {HTMLElement} */
|
|
18
|
-
const currentItem = (event.target);
|
|
14
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
15
|
+
const currentItem = /** @type {HTMLElement} */ (event.target);
|
|
19
16
|
RovingTabIndex.removeTabIndex(bottomnavElement.querySelectorAll('[role="tab"]'), [currentItem]);
|
|
20
17
|
}
|
|
21
18
|
|
|
@@ -30,8 +27,7 @@ function onForwardsRequested(event) {
|
|
|
30
27
|
}
|
|
31
28
|
event.preventDefault();
|
|
32
29
|
event.stopPropagation();
|
|
33
|
-
/** @type {HTMLElement} */
|
|
34
|
-
const bottomnavElement = (event.currentTarget);
|
|
30
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
35
31
|
RovingTabIndex.selectNext(bottomnavElement.querySelectorAll('[role="tab"]'));
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -46,8 +42,7 @@ function onBackwardsRequested(event) {
|
|
|
46
42
|
}
|
|
47
43
|
event.preventDefault();
|
|
48
44
|
event.stopPropagation();
|
|
49
|
-
/** @type {HTMLElement} */
|
|
50
|
-
const bottomnavElement = (event.currentTarget);
|
|
45
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
51
46
|
RovingTabIndex.selectPrevious(bottomnavElement.querySelectorAll('[role="tab"]'));
|
|
52
47
|
}
|
|
53
48
|
|
|
@@ -66,18 +61,16 @@ export function setupARIA(bottomnavElement) {
|
|
|
66
61
|
* @return {void}
|
|
67
62
|
*/
|
|
68
63
|
export function onSelectedChangeEvent(event) {
|
|
69
|
-
/** @type {HTMLElement} */
|
|
70
|
-
const itemElement = (event.target);
|
|
64
|
+
const itemElement = /** @type {HTMLElement} */ (event.target);
|
|
71
65
|
if (event.detail.value !== 'true') {
|
|
72
66
|
return;
|
|
73
67
|
}
|
|
74
|
-
/** @type {HTMLElement} */
|
|
75
|
-
const
|
|
76
|
-
iterateArrayLike(bottomnavElement.querySelectorAll('[role="tab"]'), (item) => {
|
|
68
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
69
|
+
for (const item of bottomnavElement.querySelectorAll('[role="tab"]')) {
|
|
77
70
|
if (item !== itemElement) {
|
|
78
71
|
BottomNavItem.setSelected(item, false);
|
|
79
72
|
}
|
|
80
|
-
}
|
|
73
|
+
}
|
|
81
74
|
}
|
|
82
75
|
|
|
83
76
|
/**
|
|
@@ -86,16 +79,16 @@ export function onSelectedChangeEvent(event) {
|
|
|
86
79
|
*/
|
|
87
80
|
export function attach(bottomnavElement) {
|
|
88
81
|
setupARIA(bottomnavElement);
|
|
89
|
-
/** @type {Element} */
|
|
90
|
-
let selectedItem;
|
|
82
|
+
/** @type {?Element} */
|
|
83
|
+
let selectedItem = null;
|
|
91
84
|
const items = bottomnavElement.getElementsByClassName('mdw-bottomnav__item');
|
|
92
85
|
|
|
93
|
-
|
|
86
|
+
for (const item of items) {
|
|
94
87
|
BottomNavItem.attach(item);
|
|
95
88
|
if (!selectedItem && item.getAttribute('aria-selected') === 'true') {
|
|
96
89
|
selectedItem = item;
|
|
97
90
|
}
|
|
98
|
-
}
|
|
91
|
+
}
|
|
99
92
|
if (!selectedItem) {
|
|
100
93
|
selectedItem = items[0];
|
|
101
94
|
}
|
|
@@ -118,5 +111,7 @@ export function detach(bottomnavElement) {
|
|
|
118
111
|
bottomnavElement.removeEventListener(Keyboard.FORWARD_ARROW_KEY, onForwardsRequested);
|
|
119
112
|
bottomnavElement.removeEventListener(Keyboard.BACK_ARROW_KEY, onBackwardsRequested);
|
|
120
113
|
bottomnavElement.removeEventListener(RovingTabIndex.TABINDEX_ZEROED, onTabIndexZeroed);
|
|
121
|
-
|
|
114
|
+
for (const element of bottomnavElement.getElementsByClassName('mdw-bottomnav__item')) {
|
|
115
|
+
BottomNavItem.detach(element);
|
|
116
|
+
}
|
|
122
117
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// https://www.w3.org/TR/wai-aria-1.1/#tab
|
|
2
2
|
|
|
3
3
|
import * as AriaTab from '../../core/aria/tab.js';
|
|
4
|
-
import { iterateArrayLike } from '../../core/dom.js';
|
|
5
4
|
import * as Overlay from '../../core/overlay/index.js';
|
|
6
5
|
import * as Ripple from '../../core/ripple/index.js';
|
|
7
6
|
|
|
@@ -22,8 +21,7 @@ export function setSelected(element, value, dispatchEvent = true) {
|
|
|
22
21
|
* @return {void}
|
|
23
22
|
*/
|
|
24
23
|
function onClick(event) {
|
|
25
|
-
/** @type {HTMLElement} */
|
|
26
|
-
const element = (event.currentTarget);
|
|
24
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
27
25
|
if (element.getAttribute('aria-disabled') === 'true') {
|
|
28
26
|
return;
|
|
29
27
|
}
|
|
@@ -36,8 +34,9 @@ function onClick(event) {
|
|
|
36
34
|
*/
|
|
37
35
|
export function attachAria(element) {
|
|
38
36
|
AriaTab.attach(element);
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
for (const el of element.getElementsByClassName('mdw-bottomnav__icon')) {
|
|
38
|
+
el.setAttribute('aria-hidden', 'true');
|
|
39
|
+
}
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// https://material.io/guidelines/components/buttons.html#buttons-raised-buttons
|
|
2
2
|
// https://material.io/guidelines/style/icons.html#
|
|
3
3
|
|
|
4
|
-
@use '../../core/_breakpoint.scss' as breakpoint;
|
|
5
4
|
@use '../../core/_elevation.scss' as elevation;
|
|
6
5
|
@use '../../core/_length.scss' as *;
|
|
7
6
|
@use '../../core/_motion.scss' as motion;
|
|
8
7
|
@use '../../core/_platform.scss' as platform;
|
|
9
8
|
@use '../../core/_type.scss' as type;
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
:root {
|
|
11
|
+
--mdw-button__click-target-size: 48px;
|
|
12
|
+
--mdw-button__outline-size: 1px;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
.mdw-button {
|
|
16
16
|
display: inline-flex;
|
|
@@ -20,11 +20,11 @@ $outlineSize: dp(1) !default;
|
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
|
|
22
22
|
box-sizing: border-box;
|
|
23
|
-
|
|
24
|
-
min-
|
|
25
|
-
margin: 0
|
|
23
|
+
block-size: 36px;
|
|
24
|
+
min-inline-size: 64px;
|
|
25
|
+
margin: 0 8px;
|
|
26
26
|
border: none;
|
|
27
|
-
padding: 0
|
|
27
|
+
padding: 0 8px;
|
|
28
28
|
|
|
29
29
|
-moz-appearance: none;
|
|
30
30
|
-webkit-appearance: none;
|
|
@@ -42,20 +42,21 @@ $outlineSize: dp(1) !default;
|
|
|
42
42
|
|
|
43
43
|
z-index: 0;
|
|
44
44
|
|
|
45
|
-
border-radius:
|
|
45
|
+
border-radius: 4px;
|
|
46
46
|
color: inherit;
|
|
47
47
|
|
|
48
48
|
text-align: center;
|
|
49
49
|
text-decoration: none;
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// Remove Firefox inner
|
|
52
|
+
|
|
52
53
|
&::-moz-focus-inner {
|
|
53
54
|
border: 0;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
&[mdw-border-ink],
|
|
57
58
|
&[mdw-surface] {
|
|
58
|
-
padding: 0
|
|
59
|
+
padding: 0 16px;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
&:not([mdw-surface]) {
|
|
@@ -63,6 +64,7 @@ $outlineSize: dp(1) !default;
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// Don't override font icon properties
|
|
67
|
+
|
|
66
68
|
&:not([mdw-icon]) {
|
|
67
69
|
@include type.addRules('button');
|
|
68
70
|
font-family: inherit;
|
|
@@ -71,25 +73,26 @@ $outlineSize: dp(1) !default;
|
|
|
71
73
|
|
|
72
74
|
&[mdw-border-ink] {
|
|
73
75
|
border-style: solid;
|
|
74
|
-
border-width:
|
|
76
|
+
border-width: var(--mdw-button__outline-size);
|
|
75
77
|
|
|
76
78
|
&::before,
|
|
77
79
|
& > .mdw-ripple {
|
|
78
80
|
box-sizing: content-box;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
margin-
|
|
82
|
-
margin-
|
|
83
|
-
padding-
|
|
84
|
-
padding-
|
|
81
|
+
block-size: 100%;
|
|
82
|
+
inline-size: 100%;
|
|
83
|
+
margin-block-start: calc(-1 * var(--mdw-button__outline-size));
|
|
84
|
+
margin-inline-start: calc(-1 * var(--mdw-button__outline-size));
|
|
85
|
+
padding-block-end: calc(2 * var(--mdw-button__outline-size));
|
|
86
|
+
padding-inline-end: calc(2 * var(--mdw-button__outline-size));
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
// Icon properties
|
|
91
|
+
|
|
89
92
|
&[mdw-icon] {
|
|
90
|
-
|
|
91
|
-
min-
|
|
92
|
-
padding:
|
|
93
|
+
block-size: 40px;
|
|
94
|
+
min-inline-size: 40px;
|
|
95
|
+
padding: 8px;
|
|
93
96
|
|
|
94
97
|
-moz-user-select: none;
|
|
95
98
|
-ms-user-select: none;
|
|
@@ -98,12 +101,12 @@ $outlineSize: dp(1) !default;
|
|
|
98
101
|
|
|
99
102
|
border-radius: 50%;
|
|
100
103
|
|
|
101
|
-
font-size:
|
|
104
|
+
font-size: 24px; // Internal padding provided by font
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
&[mdw-image] {
|
|
105
|
-
|
|
106
|
-
min-
|
|
108
|
+
block-size: 24px;
|
|
109
|
+
min-inline-size: 24px;
|
|
107
110
|
margin: 0;
|
|
108
111
|
padding: 0;
|
|
109
112
|
|
|
@@ -116,11 +119,11 @@ $outlineSize: dp(1) !default;
|
|
|
116
119
|
|
|
117
120
|
& > {
|
|
118
121
|
position: absolute;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
inset-block-start: 0;
|
|
123
|
+
inset-inline-start: 0;
|
|
124
|
+
|
|
125
|
+
block-size: 100%;
|
|
126
|
+
inline-size: auto;
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
129
|
}
|
|
@@ -131,31 +134,29 @@ $outlineSize: dp(1) !default;
|
|
|
131
134
|
content: "";
|
|
132
135
|
|
|
133
136
|
position: absolute;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
inset-block-start: 50%;
|
|
138
|
+
inset-inline-start: 0;
|
|
139
|
+
|
|
140
|
+
block-size: var(--mdw-button__click-target-size);
|
|
141
|
+
inline-size: 100%;
|
|
139
142
|
|
|
140
143
|
transform: translateY(-50%);
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
// Raised
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
|
|
149
|
+
.mdw-button[mdw-raised]:not([disabled]):not([aria-disabled="true"]) {
|
|
150
|
+
@include elevation.boxShadowMixin(2);
|
|
147
151
|
|
|
148
152
|
&:active {
|
|
149
|
-
|
|
153
|
+
@include elevation.boxShadowMixin(8);
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
|
|
157
|
+
// Disabled
|
|
153
158
|
.mdw-button[disabled],
|
|
154
159
|
.mdw-button[aria-disabled="true"] {
|
|
160
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
155
161
|
cursor: not-allowed;
|
|
156
|
-
|
|
157
|
-
&,
|
|
158
|
-
&[mdw-raised] {
|
|
159
|
-
box-shadow: elevation.boxShadow(0);
|
|
160
|
-
}
|
|
161
162
|
}
|