@shortfuse/materialdesignweb 0.2.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 +188 -30
- package/.stylelintrc.json +643 -2
- package/.vscode/launch.json +20 -5
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +36 -0
- package/README.md +82 -2
- package/adapters/datatable/column.js +176 -0
- package/adapters/datatable/index.js +253 -437
- package/adapters/dom/index.js +586 -0
- package/adapters/list/index.js +36 -113
- package/adapters/search/index.js +153 -180
- package/components/appbar/_spec.scss +165 -0
- package/components/appbar/_theme.scss +0 -0
- package/components/appbar/index.scss +2 -0
- package/components/banner/_spec.scss +83 -0
- package/components/banner/_theme.scss +0 -0
- package/components/banner/index.scss +2 -0
- package/components/bottomnav/README.md +4 -4
- package/components/bottomnav/_spec.scss +149 -0
- package/components/bottomnav/_theme.scss +0 -0
- package/components/bottomnav/index.js +100 -120
- package/components/bottomnav/index.scss +2 -0
- package/components/bottomnav/item.js +88 -0
- package/components/button/README.md +16 -22
- package/components/button/_spec.scss +162 -0
- package/components/button/_theme.scss +42 -0
- package/components/button/index.eta +32 -0
- package/components/button/index.js +37 -48
- package/components/button/index.pug +18 -0
- package/components/button/index.scss +2 -0
- package/components/card/_spec.scss +241 -0
- package/components/card/_theme.scss +0 -0
- package/components/card/index.scss +2 -0
- package/components/chip/_spec.scss +111 -0
- package/components/chip/_theme.scss +105 -0
- package/components/chip/index.js +23 -0
- package/components/chip/index.scss +2 -0
- package/components/chip/item.js +20 -0
- package/components/datatable/_spec.scss +225 -0
- package/components/datatable/_theme.scss +128 -0
- package/components/datatable/cell.js +44 -0
- package/components/datatable/columnheader.js +46 -0
- package/components/datatable/index.js +339 -443
- package/components/datatable/index.scss +2 -0
- package/components/datatable/row.js +48 -0
- package/components/datatable/rowheader.js +18 -0
- package/components/dialog/_spec.scss +203 -0
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +512 -437
- package/components/dialog/index.scss +2 -0
- package/components/divider/_spec.scss +11 -0
- package/components/divider/_theme.scss +0 -0
- package/components/divider/index.scss +2 -0
- package/components/elevation/_spec.scss +9 -0
- package/components/elevation/_theme.scss +0 -0
- package/components/elevation/index.scss +2 -0
- package/components/fab/{style.scss → _spec.scss} +104 -79
- package/components/fab/_theme.scss +0 -0
- package/components/fab/index.js +85 -79
- package/components/fab/index.scss +2 -0
- package/components/grid/_spec.scss +169 -0
- package/components/grid/_theme.scss +0 -0
- package/components/grid/index.scss +2 -0
- package/components/layout/_mixins.scss +11 -0
- package/components/layout/_spec.scss +916 -0
- package/components/layout/_theme.scss +19 -0
- package/components/layout/index.js +454 -0
- package/components/layout/index.scss +2 -0
- package/components/list/_spec.scss +363 -0
- package/components/list/_theme.scss +102 -0
- package/components/list/content.js +106 -0
- package/components/list/index.js +234 -79
- package/components/list/index.scss +2 -0
- package/components/list/item.js +167 -0
- package/components/list/secondary.js +45 -0
- package/components/menu/_spec.scss +329 -0
- package/components/menu/_theme.scss +0 -0
- package/components/menu/index.js +636 -651
- package/components/menu/index.scss +2 -0
- package/components/menu/item.js +231 -0
- package/components/progress/_spec.scss +156 -0
- package/components/progress/_theme.scss +0 -0
- package/components/progress/index.js +29 -13
- package/components/progress/index.scss +2 -0
- package/components/selection/_spec.scss +376 -0
- package/components/selection/_theme.scss +134 -0
- package/components/selection/index.eta +60 -0
- package/components/selection/index.js +70 -0
- package/components/selection/index.pug +30 -0
- package/components/selection/index.scss +2 -0
- package/components/selection/input.js +54 -0
- package/components/selection/radiogroup.js +40 -0
- package/components/slider/{style.scss → _spec.scss} +31 -34
- package/components/slider/_theme.scss +0 -0
- package/components/slider/index.scss +2 -0
- package/components/snackbar/_spec.scss +150 -0
- package/components/snackbar/_theme.scss +0 -0
- package/components/snackbar/index.js +293 -206
- package/components/snackbar/index.scss +2 -0
- package/components/tab/_spec.scss +220 -0
- package/components/tab/_theme.scss +0 -0
- package/components/tab/content.js +210 -0
- package/components/tab/index.js +229 -213
- package/components/tab/index.scss +2 -0
- package/components/tab/item.js +88 -0
- package/components/tab/list.js +196 -0
- package/components/tab/panel.js +54 -0
- package/components/textfield/README.md +4 -4
- package/components/textfield/_spec.scss +763 -0
- package/components/textfield/_theme.scss +264 -0
- package/components/textfield/index.eta +74 -0
- package/components/textfield/index.js +132 -138
- package/components/textfield/index.pug +30 -0
- package/components/textfield/index.scss +2 -0
- package/components/tooltip/_spec.scss +185 -0
- package/components/tooltip/_theme.scss +0 -0
- package/components/tooltip/index.scss +2 -0
- package/components/type/_spec.scss +227 -0
- package/components/type/_theme.scss +0 -0
- package/components/type/index.scss +2 -0
- package/core/_breakpoint.scss +189 -0
- package/core/_elevation.scss +78 -0
- package/core/_length.scss +8 -0
- package/core/_motion.scss +31 -0
- package/core/_platform.scss +12 -0
- package/core/_type.scss +128 -0
- package/core/aria/attributes.js +141 -0
- package/core/aria/button.js +49 -0
- package/core/aria/keyboard.js +92 -0
- package/core/aria/rovingtabindex.js +175 -0
- package/core/aria/tab.js +59 -0
- package/core/document/index.js +39 -0
- package/core/dom.js +180 -0
- package/core/overlay/_spec.scss +28 -0
- package/core/overlay/_theme.scss +147 -0
- package/core/overlay/index.js +95 -0
- package/core/overlay/index.scss +2 -0
- package/core/ripple/_spec.scss +196 -0
- package/core/ripple/_theme.scss +20 -0
- package/core/ripple/index.js +286 -0
- package/core/ripple/index.scss +2 -0
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -0
- package/core/theme/_functions.scss +22 -0
- package/{components/theming/palettes.scss → core/theme/_palettes.scss} +173 -151
- package/core/theme/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.js +50 -0
- package/core/theme/index.scss +4 -0
- package/core/throttler.js +42 -0
- package/core/transition/index.js +465 -0
- package/docs/_flex.scss +28 -0
- package/docs/_menuoptions.js +183 -0
- package/docs/_partials/_androidnavbar.eta +5 -0
- package/docs/_partials/_androidstatusbar.eta +13 -0
- package/docs/_partials/_appbar.eta +27 -0
- package/docs/_partials/_buttontest.eta +31 -0
- package/docs/_partials/_header.eta +146 -0
- package/docs/_partials/_navlistitem.eta +16 -0
- package/docs/_partials/_target.eta +1 -0
- package/docs/_sample-utils.js +88 -0
- package/docs/{src/storage.js → _storage.js} +0 -0
- package/docs/docs.scss +331 -0
- package/docs/framework.scss +26 -0
- package/docs/index.eta +12 -0
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +108 -0
- package/docs/pages/appbar.js +0 -0
- package/docs/pages/bottomnav.eta +188 -0
- package/docs/pages/bottomnav.js +118 -0
- package/docs/pages/button.eta +124 -0
- package/docs/pages/button.js +224 -0
- package/docs/pages/card.eta +90 -0
- package/docs/pages/card.js +175 -0
- package/docs/pages/chip.eta +122 -0
- package/docs/pages/chip.js +80 -0
- package/docs/pages/color.eta +143 -0
- package/docs/pages/color.js +261 -0
- package/docs/pages/datatable.eta +323 -0
- package/docs/pages/datatable.js +160 -0
- package/docs/pages/dialog.eta +184 -0
- package/docs/{src/components → pages}/dialog.js +35 -48
- package/docs/pages/dom.eta +26 -0
- package/docs/pages/dom.js +140 -0
- package/docs/pages/elevation.eta +35 -0
- package/docs/pages/elevation.js +0 -0
- package/docs/pages/fab.eta +99 -0
- package/docs/{src/components → pages}/fab.js +6 -13
- package/docs/pages/grid.eta +135 -0
- package/docs/pages/grid.js +128 -0
- package/docs/pages/layout.eta +8 -0
- package/docs/pages/layout.js +0 -0
- package/docs/pages/list.eta +465 -0
- package/docs/pages/list.js +8 -0
- package/docs/pages/menu.eta +274 -0
- package/docs/{src/components → pages}/menu.js +26 -42
- package/docs/pages/overlay.eta +69 -0
- package/docs/pages/overlay.js +3 -0
- package/docs/pages/progress.eta +23 -0
- package/docs/{src/components → pages}/progress.js +2 -4
- package/docs/pages/ripple.eta +27 -0
- package/docs/pages/ripple.js +3 -0
- package/docs/pages/search.eta +242 -0
- package/docs/pages/search.js +226 -0
- package/docs/pages/selection.eta +107 -0
- package/docs/pages/selection.js +12 -0
- package/docs/pages/slider.eta +23 -0
- package/docs/pages/slider.js +0 -0
- package/docs/pages/snackbar.eta +83 -0
- package/docs/{src/components → pages}/snackbar.js +31 -36
- package/docs/pages/tab.eta +407 -0
- package/docs/pages/tab.js +152 -0
- package/docs/pages/textfield.eta +487 -0
- package/docs/{src/components → pages}/textfield.js +41 -45
- package/docs/pages/tooltip.eta +92 -0
- package/docs/pages/tooltip.js +0 -0
- package/docs/pages/transition.eta +117 -0
- package/docs/pages/transition.js +52 -0
- package/docs/pages/type.eta +31 -0
- package/docs/pages/type.js +0 -0
- package/docs/postrender.js +41 -0
- package/docs/prerender.js +16 -0
- package/docs/pwa/_dialogs.eta +143 -0
- package/docs/pwa/_menus.eta +16 -0
- package/docs/pwa/pwa-prerender.js +3 -0
- package/docs/pwa/pwa.eta +478 -0
- package/docs/pwa/pwa.js +298 -0
- package/docs/pwa/pwa.scss +31 -0
- package/docs/themes/theme-colored.scss +15 -0
- package/docs/themes/theme-default.scss +3 -0
- package/index.scss +27 -0
- package/jsconfig.json +8 -2
- package/package.json +54 -27
- package/scripts/deploy-docs.sh +9 -0
- package/templates/index.eta +2 -0
- package/templates/index.pug +3 -0
- package/tsconfig.json +16 -0
- package/utils/function.js +3 -0
- package/webpack.config.js +224 -68
- package/_index.scss +0 -4
- package/components/all-components.scss +0 -21
- package/components/bottomnav/style.scss +0 -190
- package/components/bottomnav/theming.scss +0 -76
- package/components/button/style.scss +0 -315
- package/components/button/theming.scss +0 -134
- package/components/card/style.scss +0 -175
- package/components/card/theming.scss +0 -43
- package/components/common/dom.js +0 -51
- package/components/common/functions.scss +0 -174
- package/components/common/mixins.scss +0 -122
- package/components/common/motion.scss +0 -36
- package/components/common/type.scss +0 -104
- package/components/common/variables.scss +0 -46
- package/components/datatable/style.scss +0 -257
- package/components/datatable/theming.scss +0 -119
- package/components/dialog/style.scss +0 -159
- package/components/dialog/theming.scss +0 -29
- package/components/divider/style.scss +0 -7
- package/components/divider/theming.scss +0 -20
- package/components/elevation/style.scss +0 -32
- package/components/layout/style.scss +0 -223
- package/components/list/style.scss +0 -358
- package/components/list/theming.scss +0 -83
- package/components/menu/style.scss +0 -280
- package/components/menu/theming.scss +0 -80
- package/components/navdrawer/index.js +0 -200
- package/components/navdrawer/style.scss +0 -595
- package/components/navdrawer/theming.scss +0 -62
- package/components/progress/style.scss +0 -136
- package/components/ripple/index.js +0 -63
- package/components/ripple/ripple.scss +0 -122
- package/components/selection/style.scss +0 -320
- package/components/selection/theming.scss +0 -98
- package/components/snackbar/style.scss +0 -212
- package/components/switch/style.scss +0 -3
- package/components/tab/style.scss +0 -275
- package/components/tab/theming.scss +0 -34
- package/components/template/theming.scss +0 -31
- package/components/textfield/style.scss +0 -795
- package/components/textfield/theming.scss +0 -256
- package/components/theming/globals.scss +0 -25
- package/components/theming/theming.scss +0 -559
- package/components/toolbar/style.scss +0 -190
- package/components/toolbar/theming.scss +0 -32
- package/components/tooltip/style.scss +0 -135
- package/components/type/style.scss +0 -167
- package/components/type/theming.scss +0 -25
- package/docs/bottomnav.html +0 -1
- package/docs/bottomnav.min.js +0 -2
- package/docs/bottomnav.min.js.map +0 -1
- package/docs/button.html +0 -1
- package/docs/button.min.js +0 -2
- package/docs/button.min.js.map +0 -1
- package/docs/card.html +0 -1
- package/docs/card.min.js +0 -2
- package/docs/card.min.js.map +0 -1
- package/docs/components.min.css +0 -1
- package/docs/components.min.js +0 -2
- package/docs/components.min.js.map +0 -1
- package/docs/datatable.html +0 -1
- package/docs/datatable.min.js +0 -2
- package/docs/datatable.min.js.map +0 -1
- package/docs/dialog.html +0 -1
- package/docs/dialog.min.js +0 -2
- package/docs/dialog.min.js.map +0 -1
- package/docs/docs.min.css +0 -1
- package/docs/docs.min.js +0 -2
- package/docs/docs.min.js.map +0 -1
- package/docs/elevation.html +0 -1
- package/docs/elevation.min.js +0 -2
- package/docs/elevation.min.js.map +0 -1
- package/docs/fab.html +0 -1
- package/docs/fab.min.js +0 -2
- package/docs/fab.min.js.map +0 -1
- package/docs/index.html +0 -1
- package/docs/index.min.js +0 -2
- package/docs/index.min.js.map +0 -1
- package/docs/layout.html +0 -1
- package/docs/layout.min.js +0 -2
- package/docs/layout.min.js.map +0 -1
- package/docs/list.html +0 -1
- package/docs/list.min.js +0 -2
- package/docs/list.min.js.map +0 -1
- package/docs/menu.html +0 -1
- package/docs/menu.min.js +0 -2
- package/docs/menu.min.js.map +0 -1
- package/docs/navdrawer.html +0 -1
- package/docs/navdrawer.min.js +0 -2
- package/docs/navdrawer.min.js.map +0 -1
- package/docs/prerender.min.js +0 -2
- package/docs/prerender.min.js.map +0 -1
- package/docs/progress.html +0 -1
- package/docs/progress.min.js +0 -2
- package/docs/progress.min.js.map +0 -1
- package/docs/search.html +0 -1
- package/docs/search.min.js +0 -2
- package/docs/search.min.js.map +0 -1
- package/docs/selection.html +0 -1
- package/docs/selection.min.js +0 -2
- package/docs/selection.min.js.map +0 -1
- package/docs/slider.html +0 -1
- package/docs/slider.min.js +0 -2
- package/docs/slider.min.js.map +0 -1
- package/docs/snackbar.html +0 -1
- package/docs/snackbar.min.js +0 -2
- package/docs/snackbar.min.js.map +0 -1
- package/docs/src/components/bottomnav.js +0 -16
- package/docs/src/components/bottomnav.pug +0 -112
- package/docs/src/components/button.js +0 -156
- package/docs/src/components/button.pug +0 -194
- package/docs/src/components/card.js +0 -136
- package/docs/src/components/card.pug +0 -133
- package/docs/src/components/datatable.js +0 -183
- package/docs/src/components/datatable.pug +0 -324
- package/docs/src/components/dialog.pug +0 -138
- package/docs/src/components/elevation.js +0 -3
- package/docs/src/components/elevation.pug +0 -17
- package/docs/src/components/fab.pug +0 -84
- package/docs/src/components/layout.js +0 -116
- package/docs/src/components/layout.pug +0 -104
- package/docs/src/components/list.js +0 -15
- package/docs/src/components/list.pug +0 -293
- package/docs/src/components/menu.pug +0 -292
- package/docs/src/components/navdrawer.js +0 -112
- package/docs/src/components/navdrawer.pug +0 -113
- package/docs/src/components/progress.pug +0 -17
- package/docs/src/components/search.js +0 -206
- package/docs/src/components/search.pug +0 -149
- package/docs/src/components/selection.js +0 -6
- package/docs/src/components/selection.pug +0 -116
- package/docs/src/components/slider.js +0 -3
- package/docs/src/components/slider.pug +0 -19
- package/docs/src/components/snackbar.pug +0 -145
- package/docs/src/components/tab.js +0 -137
- package/docs/src/components/tab.pug +0 -329
- package/docs/src/components/textfield.pug +0 -416
- package/docs/src/components/toolbar.js +0 -6
- package/docs/src/components/toolbar.pug +0 -86
- package/docs/src/components/tooltip.js +0 -6
- package/docs/src/components/tooltip.pug +0 -76
- package/docs/src/components/type.js +0 -6
- package/docs/src/components/type.pug +0 -34
- package/docs/src/components.scss +0 -1
- package/docs/src/docs.scss +0 -284
- package/docs/src/index.js +0 -3
- package/docs/src/index.pug +0 -6
- package/docs/src/menuoptions.js +0 -136
- package/docs/src/mixins.pug +0 -139
- package/docs/src/prerender.js +0 -26
- package/docs/src/sample-utils.js +0 -108
- package/docs/src/targetHandler.js +0 -50
- package/docs/src/theming.ie11.scss +0 -18
- package/docs/src/theming.scss +0 -18
- package/docs/tab.html +0 -1
- package/docs/tab.min.js +0 -2
- package/docs/tab.min.js.map +0 -1
- package/docs/textfield.html +0 -2
- package/docs/textfield.min.js +0 -2
- package/docs/textfield.min.js.map +0 -1
- package/docs/theming.ie11.min.css +0 -1
- package/docs/theming.ie11.min.js +0 -2
- package/docs/theming.ie11.min.js.map +0 -1
- package/docs/theming.min.css +0 -1
- package/docs/theming.min.js +0 -2
- package/docs/theming.min.js.map +0 -1
- package/docs/toolbar.html +0 -1
- package/docs/toolbar.min.js +0 -2
- package/docs/toolbar.min.js.map +0 -1
- package/docs/tooltip.html +0 -1
- package/docs/tooltip.min.js +0 -2
- package/docs/tooltip.min.js.map +0 -1
- package/docs/type.html +0 -1
- package/docs/type.min.js +0 -2
- package/docs/type.min.js.map +0 -1
- package/index.js +0 -16
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// https://material.io/guidelines/layout/structure.html#structure-app-bar
|
|
2
|
+
// https://material.io/archive/guidelines/components/toolbars.html
|
|
3
|
+
|
|
4
|
+
@use '../../core/_breakpoint.scss' as breakpoint;
|
|
5
|
+
@use '../../core/_length.scss' as *;
|
|
6
|
+
@use '../../core/_type.scss' as type;
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--mdw-appbar__min-block-size: 64px;
|
|
10
|
+
--mdw-appbar__min-block-size__dense: 48px;
|
|
11
|
+
--mdw-appbar__min-block-size__prominent: 128px;
|
|
12
|
+
--mdw-appbar__min-block-size__prominent__dense: 96px;
|
|
13
|
+
--mdw-appbar__min-block-size__mobile: 56px;
|
|
14
|
+
--mdw-appbar__min-block-size__mobile__landscape: 48px;
|
|
15
|
+
--mdw-appbar__content-margin-inline: 24px;
|
|
16
|
+
--mdw-appbar__start-margin-inline-start: 8px;
|
|
17
|
+
@include breakpoint.has16DPMargin() {
|
|
18
|
+
--mdw-appbar__content-margin-inline: 16px;
|
|
19
|
+
--mdw-appbar__start-margin-inline-start: 0;
|
|
20
|
+
}
|
|
21
|
+
@include breakpoint.maxTabletDevice {
|
|
22
|
+
// No high density on mobile
|
|
23
|
+
--mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__mobile);
|
|
24
|
+
--mdw-appbar__min-block-size__dense: var(--mdw-appbar__min-block-size__mobile);
|
|
25
|
+
--mdw-appbar__min-block-size__prominent__dense: var(--mdw-appbar__min-block-size__prominent);
|
|
26
|
+
}
|
|
27
|
+
@include breakpoint.isMobileDeviceLandscape {
|
|
28
|
+
--mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__mobile__landscape);
|
|
29
|
+
--mdw-appbar__min-block-size__dense: var(--mdw-appbar__min-block-size__mobile__landscape);
|
|
30
|
+
}
|
|
31
|
+
--mdw-appbar__icon-min-block-size: 40px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.mdw-appbar {
|
|
35
|
+
display: grid;
|
|
36
|
+
|
|
37
|
+
grid-template-columns: auto 1fr auto;
|
|
38
|
+
grid-template-rows: auto auto;
|
|
39
|
+
|
|
40
|
+
min-block-size: var(--mdw-appbar__min-block-size);
|
|
41
|
+
|
|
42
|
+
transition-duration: inherit;
|
|
43
|
+
transition-property: min-block-size;
|
|
44
|
+
transition-timing-function: inherit;
|
|
45
|
+
|
|
46
|
+
z-index: 1;
|
|
47
|
+
|
|
48
|
+
&[mdw-centered] {
|
|
49
|
+
grid-template-columns: minmax(auto, 1fr) minmax(0, auto) minmax(auto, 1fr);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[mdw-dense] {
|
|
53
|
+
--mdw-appbar__min-block-size: var(--mdw-appbar__min-block-size__dense);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mdw-appbar__action {
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: auto 1fr auto;
|
|
60
|
+
|
|
61
|
+
min-block-size: var(--mdw-appbar__min-block-size);
|
|
62
|
+
|
|
63
|
+
transition-duration: inherit;
|
|
64
|
+
transition-property: min-block-size;
|
|
65
|
+
transition-timing-function: inherit;
|
|
66
|
+
|
|
67
|
+
z-index: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.mdw-appbar__content {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
|
|
74
|
+
grid-column: 1 / span 3;
|
|
75
|
+
grid-row: 2;
|
|
76
|
+
|
|
77
|
+
margin-inline: var(--mdw-appbar__content-margin-inline);
|
|
78
|
+
padding-inline-start: 56px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.mdw-appbar__title {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
|
|
85
|
+
align-self: center;
|
|
86
|
+
|
|
87
|
+
grid-column: 2;
|
|
88
|
+
grid-row: 1 / span 2;
|
|
89
|
+
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
|
|
92
|
+
min-block-size: auto;
|
|
93
|
+
|
|
94
|
+
block-size: auto;
|
|
95
|
+
margin: 0 16px;
|
|
96
|
+
|
|
97
|
+
transition-duration: inherit;
|
|
98
|
+
transition-property: font, letter-spacing, margin-block-size;
|
|
99
|
+
transition-timing-function: inherit;
|
|
100
|
+
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
|
|
104
|
+
@include type.addRules('h6');
|
|
105
|
+
|
|
106
|
+
// TODO: Use CSS Variables instead of nesting
|
|
107
|
+
.mdw-appbar[mdw-prominent] & {
|
|
108
|
+
min-block-size: var(--mdw-appbar__min-block-size__prominent);
|
|
109
|
+
|
|
110
|
+
white-space: normal;
|
|
111
|
+
@include type.addRules('h5');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.mdw-appbar[mdw-prominent][mdw-dense] & {
|
|
115
|
+
min-block-size: var(--mdw-appbar__min-block-size__prominent__dense);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[mdw-custom] {
|
|
119
|
+
margin-block-start: 0;
|
|
120
|
+
|
|
121
|
+
&::after {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.mdw-appbar__start {
|
|
128
|
+
grid-column: 1;
|
|
129
|
+
|
|
130
|
+
margin-inline-start: var(--mdw-appbar__start-margin-inline-start);
|
|
131
|
+
|
|
132
|
+
padding-inline: 8px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.mdw-appbar__end {
|
|
136
|
+
grid-column: 3;
|
|
137
|
+
justify-content: flex-end;
|
|
138
|
+
|
|
139
|
+
margin-inline-end: -12px;
|
|
140
|
+
padding-inline-end: var(--mdw-appbar__content-margin-inline);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.mdw-appbar__start,
|
|
144
|
+
.mdw-appbar__end {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
flex-direction: row;
|
|
148
|
+
grid-row: 1/1;
|
|
149
|
+
|
|
150
|
+
min-block-size: inherit;
|
|
151
|
+
|
|
152
|
+
transition-property: margin-block-start;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mdw-appbar__start .mdw-button {
|
|
156
|
+
margin: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.mdw-appbar__end .mdw-button {
|
|
160
|
+
margin: 0 4px;
|
|
161
|
+
|
|
162
|
+
&[mdw-more-button] {
|
|
163
|
+
margin-inline-end: -2px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// https://material.io/design/components/banners.html
|
|
2
|
+
|
|
3
|
+
@use '../../core/_breakpoint.scss' as breakpoint;
|
|
4
|
+
@use '../../core/_length.scss' as *;
|
|
5
|
+
@use '../../core/_type.scss' as type;
|
|
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
|
+
|
|
20
|
+
.mdw-banner {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
flex-wrap: var(--mdw-banner__flex-wrap);
|
|
25
|
+
justify-content: center;
|
|
26
|
+
|
|
27
|
+
inline-size: 100%;
|
|
28
|
+
border-block-end: solid 1px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mdw-banner__container {
|
|
32
|
+
@include type.addRules('body-2');
|
|
33
|
+
|
|
34
|
+
display: flex;
|
|
35
|
+
position: relative;
|
|
36
|
+
align-items: center;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
max-inline-size: 960px;
|
|
42
|
+
flex: 1;
|
|
43
|
+
padding-block: 8px 7px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mdw-banner__icon {
|
|
47
|
+
position: absolute;
|
|
48
|
+
|
|
49
|
+
inset-block-start: 24px;
|
|
50
|
+
inset-inline: 16px auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.mdw-banner__text {
|
|
54
|
+
@include type.textTopToTop(12);
|
|
55
|
+
@include type.baselineToBottom(12);
|
|
56
|
+
|
|
57
|
+
flex-grow: 1;
|
|
58
|
+
|
|
59
|
+
padding-inline-start: var(--mdw-banner__text-padding-inline-start);
|
|
60
|
+
|
|
61
|
+
white-space: pre-line;
|
|
62
|
+
|
|
63
|
+
.mdw-banner__icon ~ & {
|
|
64
|
+
margin-inline: 56px 0; // 40 + 16
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.mdw-banner__buttons {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row-reverse;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
justify-content: flex-start;
|
|
73
|
+
|
|
74
|
+
max-inline-size: 100%;
|
|
75
|
+
flex: none;
|
|
76
|
+
margin-inline-start: var(--mdw-banner__buttons-margin-inline-start);
|
|
77
|
+
|
|
78
|
+
.mdw-button {
|
|
79
|
+
margin-inline: 0 8px;
|
|
80
|
+
|
|
81
|
+
text-align: end;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
File without changes
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
## Fixed (Primary Color)
|
|
5
5
|
|
|
6
6
|
```
|
|
7
|
-
form.mdw-bottomnav
|
|
7
|
+
form.mdw-bottomnav.mdw-theme(mdw-ink="primary 500")
|
|
8
8
|
label.mdw-bottomnav__item
|
|
9
9
|
input.mdw-bottomnav__input(type="radio" name="bottomnav" value="recents")
|
|
10
10
|
.mdw-bottomnav__icon.material-icons history
|
|
@@ -21,7 +21,7 @@ form.mdw-bottomnav(mdw-theme-color="primary")
|
|
|
21
21
|
|
|
22
22
|
## Fixed (Filled)
|
|
23
23
|
```
|
|
24
|
-
form.mdw-bottomnav
|
|
24
|
+
form.mdw-bottomnav.mdw-theme(mdw-surface="primary 700")
|
|
25
25
|
label.mdw-bottomnav__item
|
|
26
26
|
input.mdw-bottomnav__input(type="radio" name="bottomnav" value="recents")
|
|
27
27
|
.mdw-bottomnav__icon.material-icons history
|
|
@@ -38,7 +38,7 @@ form.mdw-bottomnav(mdw-theme-fill="primary-700")
|
|
|
38
38
|
|
|
39
39
|
## Shifting (Primary Color)
|
|
40
40
|
```
|
|
41
|
-
form.mdw-bottomnav
|
|
41
|
+
form.mdw-bottomnav.mdw-theme(mdw-ink="primary 500" mdw-shifting)
|
|
42
42
|
input.mdw-bottomnav__input(type="radio" name="shiftingbottomnav" value="movies" id='value1')
|
|
43
43
|
label.mdw-bottomnav__item(for='value1')
|
|
44
44
|
.mdw-bottomnav__icon.material-icons tv
|
|
@@ -59,7 +59,7 @@ form.mdw-bottomnav(mdw-theme-color="primary" mdw-shifting)
|
|
|
59
59
|
|
|
60
60
|
## Shifting (Filled)
|
|
61
61
|
```
|
|
62
|
-
form.mdw-bottomnav
|
|
62
|
+
form.mdw-bottomnav.mdw-theme(mdw-surface="primary 700" mdw-shifting)
|
|
63
63
|
input.mdw-bottomnav__input(type="radio" name="shiftingbottomnav" value="movies" id='value1')
|
|
64
64
|
label.mdw-bottomnav__item(for='value1')
|
|
65
65
|
.mdw-bottomnav__icon.material-icons tv
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// https://material.io/design/components/bottom-navigation.html#specs
|
|
2
|
+
|
|
3
|
+
@use '../../core/_length.scss' as *;
|
|
4
|
+
@use '../../core/_motion.scss' as motion;
|
|
5
|
+
@use '../../core/_type.scss' as type;
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
--mdw-bottomnav__label-opacity: 1;
|
|
9
|
+
--mdw-bottomnav__label-transform: none;
|
|
10
|
+
--mdw-bottomnav__icon-transform: #{translateY(8px)};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.mdw-bottomnav {
|
|
14
|
+
display: flex;
|
|
15
|
+
position: relative;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
|
|
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
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mdw-bottomnav__item {
|
|
32
|
+
display: flex;
|
|
33
|
+
position: relative;
|
|
34
|
+
align-items: center;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: flex-start;
|
|
37
|
+
overflow: visible;
|
|
38
|
+
|
|
39
|
+
min-inline-size: 80px;
|
|
40
|
+
flex: 168px;
|
|
41
|
+
flex-grow: 0;
|
|
42
|
+
// flex-shrink: 1;
|
|
43
|
+
// flex-basis: 168px;
|
|
44
|
+
margin: 0;
|
|
45
|
+
padding: 0;
|
|
46
|
+
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
-webkit-tap-highlight-color: transparent;
|
|
49
|
+
-moz-user-select: none;
|
|
50
|
+
-ms-user-select: none;
|
|
51
|
+
-webkit-user-select: none;
|
|
52
|
+
user-select: none;
|
|
53
|
+
|
|
54
|
+
z-index: 0;
|
|
55
|
+
|
|
56
|
+
border-radius: 0;
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.mdw-bottomnav__icon {
|
|
61
|
+
display: flex;
|
|
62
|
+
position: absolute;
|
|
63
|
+
inset-block-start: 0;
|
|
64
|
+
inset-inline-start: 50%;
|
|
65
|
+
|
|
66
|
+
margin-inline-start: -12px;
|
|
67
|
+
|
|
68
|
+
margin: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
|
|
73
|
+
transition-duration: motion.$shapeChangeDuration, motion.$simpleDuration;
|
|
74
|
+
transition-property: transform, color;
|
|
75
|
+
transition-timing-function: motion.$standardEasing;
|
|
76
|
+
|
|
77
|
+
transform: var(--mdw-bottomnav__icon-transform);
|
|
78
|
+
|
|
79
|
+
&:last-child {
|
|
80
|
+
// No label
|
|
81
|
+
transform: translateY(16px);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.mdw-bottomnav__badge {
|
|
86
|
+
position: absolute;
|
|
87
|
+
inset-block-start: 0;
|
|
88
|
+
inset-inline: 16px auto;
|
|
89
|
+
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
min-block-size: 8px;
|
|
92
|
+
min-inline-size: 8px;
|
|
93
|
+
padding: 2px;
|
|
94
|
+
|
|
95
|
+
visibility: hidden;
|
|
96
|
+
|
|
97
|
+
z-index: 1;
|
|
98
|
+
|
|
99
|
+
border-radius: 8px;
|
|
100
|
+
|
|
101
|
+
font: inherit;
|
|
102
|
+
|
|
103
|
+
font-weight: type.$weightRegular;
|
|
104
|
+
font-size: 10px;
|
|
105
|
+
line-height: 12px;
|
|
106
|
+
letter-spacing: normal;
|
|
107
|
+
|
|
108
|
+
&[mdw-badge] {
|
|
109
|
+
visibility: visible;
|
|
110
|
+
|
|
111
|
+
&::before {
|
|
112
|
+
content: attr(mdw-badge);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[data-mdw-badge] {
|
|
117
|
+
visibility: visible;
|
|
118
|
+
|
|
119
|
+
&::before {
|
|
120
|
+
content: attr(data-mdw-badge);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mdw-bottomnav__label {
|
|
126
|
+
@include type.addRules('caption');
|
|
127
|
+
@include type.textTopToTop(32);
|
|
128
|
+
@include type.baselineToBottom(8);
|
|
129
|
+
|
|
130
|
+
// Overriding 12dp for baseline bottom with 8dp for oversized and textwrapped
|
|
131
|
+
// Baseline top will ensure type.baselineToBottom is 12dp for standard layouts
|
|
132
|
+
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
max-inline-size: 100%;
|
|
135
|
+
padding: 0 12px;
|
|
136
|
+
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
|
|
139
|
+
transition-duration: motion.$shapeChangeDuration;
|
|
140
|
+
transition-property: transform, opacity, color;
|
|
141
|
+
transition-timing-function: motion.$standardEasing;
|
|
142
|
+
|
|
143
|
+
opacity: var(--mdw-bottomnav__label-opacity);
|
|
144
|
+
transform: var(--mdw-bottomnav__label-transform);
|
|
145
|
+
|
|
146
|
+
text-align: center;
|
|
147
|
+
word-break: break-all;
|
|
148
|
+
word-break: break-word;
|
|
149
|
+
}
|
|
File without changes
|
|
@@ -1,137 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
import { findElementParentByClassName } from '../common/dom';
|
|
1
|
+
// https://www.w3.org/TR/wai-aria-practices/#tabpanel
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import * as Keyboard from '../../core/aria/keyboard.js';
|
|
4
|
+
import * as RovingTabIndex from '../../core/aria/rovingtabindex.js';
|
|
5
|
+
|
|
6
|
+
import * as BottomNavItem from './item.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Event} event
|
|
10
|
+
* @return {void}
|
|
11
|
+
*/
|
|
12
|
+
function onTabIndexZeroed(event) {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
15
|
+
const currentItem = /** @type {HTMLElement} */ (event.target);
|
|
16
|
+
RovingTabIndex.removeTabIndex(bottomnavElement.querySelectorAll('[role="tab"]'), [currentItem]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {CustomEvent} event
|
|
21
|
+
* @return {void}
|
|
22
|
+
*/
|
|
23
|
+
function onForwardsRequested(event) {
|
|
24
|
+
if (event.detail.ctrlKey || event.detail.altKey
|
|
25
|
+
|| event.detail.shiftKey || event.detail.metaKey) {
|
|
26
|
+
return;
|
|
11
27
|
}
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
31
|
+
RovingTabIndex.selectNext(bottomnavElement.querySelectorAll('[role="tab"]'));
|
|
32
|
+
}
|
|
12
33
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @param {CustomEvent} event
|
|
36
|
+
* @return {void}
|
|
37
|
+
*/
|
|
38
|
+
function onBackwardsRequested(event) {
|
|
39
|
+
if (event.detail.ctrlKey || event.detail.altKey
|
|
40
|
+
|| event.detail.shiftKey || event.detail.metaKey) {
|
|
41
|
+
return;
|
|
19
42
|
}
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
46
|
+
RovingTabIndex.selectPrevious(bottomnavElement.querySelectorAll('[role="tab"]'));
|
|
20
47
|
}
|
|
21
48
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
/**
|
|
50
|
+
* @param {Element} bottomnavElement
|
|
51
|
+
* @return {void}
|
|
52
|
+
*/
|
|
53
|
+
export function setupARIA(bottomnavElement) {
|
|
54
|
+
bottomnavElement.setAttribute('role', 'tablist');
|
|
55
|
+
bottomnavElement.setAttribute('aria-multiselectable', 'false');
|
|
56
|
+
bottomnavElement.setAttribute('aria-orientation', 'horizontal');
|
|
57
|
+
}
|
|
30
58
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
59
|
+
/**
|
|
60
|
+
* @param {CustomEvent} event
|
|
61
|
+
* @return {void}
|
|
62
|
+
*/
|
|
63
|
+
export function onSelectedChangeEvent(event) {
|
|
64
|
+
const itemElement = /** @type {HTMLElement} */ (event.target);
|
|
65
|
+
if (event.detail.value !== 'true') {
|
|
66
|
+
return;
|
|
40
67
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
46
|
-
const item = items.item(i);
|
|
47
|
-
BottomnavItem.detach(item);
|
|
48
|
-
item.removeEventListener('click', Bottomnav.onItemClicked);
|
|
49
|
-
}
|
|
50
|
-
for (let i = 0; i < inputs.length; i += 1) {
|
|
51
|
-
const input = inputs.item(i);
|
|
52
|
-
input.removeEventListener('change', Bottomnav.onInputChanged);
|
|
68
|
+
const bottomnavElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
69
|
+
for (const item of bottomnavElement.querySelectorAll('[role="tab"]')) {
|
|
70
|
+
if (item !== itemElement) {
|
|
71
|
+
BottomNavItem.setSelected(item, false);
|
|
53
72
|
}
|
|
54
73
|
}
|
|
74
|
+
}
|
|
55
75
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
itemElement = inputElement.parentElement;
|
|
66
|
-
}
|
|
67
|
-
if (inputElement.id) {
|
|
68
|
-
itemElement = document.querySelector(`label.mdw-bottomnav__item[for="${inputElement.id}"]`);
|
|
69
|
-
}
|
|
70
|
-
if (itemElement.hasAttribute('mdw-selected') && inputElement.checked) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!itemElement.hasAttribute('mdw-selected') && !inputElement.checked) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const bottomnavElement = findElementParentByClassName(inputElement, 'mdw-bottomnav');
|
|
77
|
-
if (bottomnavElement) {
|
|
78
|
-
Bottomnav.removeSelection(bottomnavElement);
|
|
79
|
-
}
|
|
80
|
-
itemElement.setAttribute('mdw-selected', '');
|
|
81
|
-
}
|
|
76
|
+
/**
|
|
77
|
+
* @param {Element} bottomnavElement
|
|
78
|
+
* @return {void}
|
|
79
|
+
*/
|
|
80
|
+
export function attach(bottomnavElement) {
|
|
81
|
+
setupARIA(bottomnavElement);
|
|
82
|
+
/** @type {?Element} */
|
|
83
|
+
let selectedItem = null;
|
|
84
|
+
const items = bottomnavElement.getElementsByClassName('mdw-bottomnav__item');
|
|
82
85
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
static removeSelection(bottomnavElement) {
|
|
88
|
-
const items = bottomnavElement.getElementsByClassName('mdw-bottomnav__item');
|
|
89
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
90
|
-
const item = items.item(i);
|
|
91
|
-
if (item.hasAttribute('mdw-selected')) {
|
|
92
|
-
item.removeAttribute('mdw-selected');
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
BottomNavItem.attach(item);
|
|
88
|
+
if (!selectedItem && item.getAttribute('aria-selected') === 'true') {
|
|
89
|
+
selectedItem = item;
|
|
95
90
|
}
|
|
96
|
-
return false;
|
|
97
91
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* @param {Event} event
|
|
101
|
-
* @return {void}
|
|
102
|
-
*/
|
|
103
|
-
static onItemClicked(event) {
|
|
104
|
-
/** @type {Element} */
|
|
105
|
-
const itemElement = findElementParentByClassName(event.target, 'mdw-bottomnav__item');
|
|
106
|
-
if (itemElement.hasAttribute('mdw-selected')) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (itemElement.hasAttribute('disabled')) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const bottomnavElement = findElementParentByClassName(itemElement, 'mdw-bottomnav');
|
|
113
|
-
if (bottomnavElement) {
|
|
114
|
-
Bottomnav.removeSelection(bottomnavElement);
|
|
115
|
-
}
|
|
116
|
-
itemElement.setAttribute('mdw-selected', '');
|
|
117
|
-
let inputElement;
|
|
118
|
-
if (itemElement instanceof HTMLLabelElement && itemElement.hasAttribute('for')) {
|
|
119
|
-
const id = itemElement.getAttribute('for');
|
|
120
|
-
if (id) {
|
|
121
|
-
inputElement = document.getElementById(id);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
inputElement = itemElement.getElementsByClassName('mdw-bottomnav__input')[0];
|
|
125
|
-
}
|
|
126
|
-
if (inputElement instanceof HTMLInputElement) {
|
|
127
|
-
inputElement.checked = true;
|
|
128
|
-
} else if (inputElement) {
|
|
129
|
-
throw new Error('Unexpected inputElement type');
|
|
130
|
-
}
|
|
92
|
+
if (!selectedItem) {
|
|
93
|
+
selectedItem = items[0];
|
|
131
94
|
}
|
|
95
|
+
if (selectedItem) {
|
|
96
|
+
BottomNavItem.setSelected(selectedItem, true, true);
|
|
97
|
+
}
|
|
98
|
+
RovingTabIndex.setupTabIndexes(bottomnavElement.querySelectorAll('[role="tab"]'));
|
|
99
|
+
bottomnavElement.addEventListener(BottomNavItem.SELECTED_CHANGE_EVENT, onSelectedChangeEvent);
|
|
100
|
+
bottomnavElement.addEventListener(Keyboard.FORWARD_ARROW_KEY, onForwardsRequested);
|
|
101
|
+
bottomnavElement.addEventListener(Keyboard.BACK_ARROW_KEY, onBackwardsRequested);
|
|
102
|
+
bottomnavElement.addEventListener(RovingTabIndex.TABINDEX_ZEROED, onTabIndexZeroed);
|
|
132
103
|
}
|
|
133
104
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
105
|
+
/**
|
|
106
|
+
* @param {Element} bottomnavElement
|
|
107
|
+
* @return {void}
|
|
108
|
+
*/
|
|
109
|
+
export function detach(bottomnavElement) {
|
|
110
|
+
bottomnavElement.removeEventListener(BottomNavItem.SELECTED_CHANGE_EVENT, onSelectedChangeEvent);
|
|
111
|
+
bottomnavElement.removeEventListener(Keyboard.FORWARD_ARROW_KEY, onForwardsRequested);
|
|
112
|
+
bottomnavElement.removeEventListener(Keyboard.BACK_ARROW_KEY, onBackwardsRequested);
|
|
113
|
+
bottomnavElement.removeEventListener(RovingTabIndex.TABINDEX_ZEROED, onTabIndexZeroed);
|
|
114
|
+
for (const element of bottomnavElement.getElementsByClassName('mdw-bottomnav__item')) {
|
|
115
|
+
BottomNavItem.detach(element);
|
|
116
|
+
}
|
|
117
|
+
}
|