@shortfuse/materialdesignweb 0.3.0 → 0.4.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/.eslintrc.json +136 -30
- package/.stylelintrc.json +6 -40
- package/.vscode/launch.json +20 -5
- package/CHANGELOG.md +24 -0
- package/README.md +12 -9
- package/adapters/datatable/column.js +82 -74
- package/adapters/datatable/index.js +173 -131
- package/adapters/dom/index.js +529 -75
- package/adapters/list/index.js +25 -12
- package/adapters/search/index.js +13 -13
- package/components/appbar/_spec.scss +87 -64
- package/components/appbar/index.scss +2 -2
- package/components/banner/_spec.scss +8 -8
- package/components/banner/index.scss +2 -2
- package/components/bottomnav/_spec.scss +22 -17
- package/components/bottomnav/index.js +61 -52
- package/components/bottomnav/index.scss +2 -2
- package/components/bottomnav/item.js +44 -25
- package/components/button/README.md +14 -14
- package/components/button/_spec.scss +23 -22
- package/components/button/_theme.scss +37 -21
- package/components/button/index.eta +32 -0
- package/components/button/index.js +12 -12
- package/components/button/index.scss +2 -2
- package/components/card/_spec.scss +40 -36
- package/components/card/index.scss +2 -2
- package/components/chip/_spec.scss +7 -8
- package/components/chip/_theme.scss +31 -31
- package/components/chip/index.js +3 -2
- package/components/chip/index.scss +2 -2
- package/components/chip/item.js +1 -16
- package/components/datatable/_spec.scss +71 -85
- package/components/datatable/_theme.scss +61 -156
- package/components/datatable/cell.js +45 -0
- package/components/datatable/columnheader.js +47 -0
- package/components/datatable/index.js +279 -366
- package/components/datatable/index.scss +2 -2
- package/components/datatable/row.js +49 -0
- package/components/datatable/rowheader.js +18 -0
- package/components/dialog/_spec.scss +61 -41
- package/components/dialog/index.js +325 -297
- package/components/dialog/index.scss +2 -2
- package/components/divider/_spec.scss +8 -6
- package/components/divider/index.scss +2 -2
- package/components/elevation/_spec.scss +2 -2
- package/components/elevation/index.scss +2 -2
- package/components/fab/_spec.scss +23 -24
- package/components/fab/index.js +50 -50
- package/components/fab/index.scss +2 -2
- package/components/grid/_spec.scss +33 -31
- package/components/grid/index.scss +2 -2
- package/components/layout/_mixins.scss +5 -5
- package/components/layout/_spec.scss +206 -176
- package/components/layout/_theme.scss +14 -16
- package/components/layout/index.js +181 -153
- package/components/layout/index.scss +2 -2
- package/components/list/_spec.scss +117 -104
- package/components/list/_theme.scss +31 -34
- package/components/list/content.js +68 -52
- package/components/list/index.js +194 -61
- package/components/list/index.scss +2 -2
- package/components/list/item.js +136 -12
- package/components/list/secondary.js +46 -0
- package/components/menu/_spec.scss +32 -19
- package/components/menu/index.js +242 -229
- package/components/menu/index.scss +2 -2
- package/components/menu/item.js +95 -110
- package/components/progress/_spec.scss +35 -27
- package/components/progress/index.js +21 -0
- package/components/progress/index.scss +2 -1
- package/components/selection/_spec.scss +242 -224
- package/components/selection/_theme.scss +100 -95
- package/components/selection/index.eta +60 -0
- package/components/selection/index.js +76 -0
- package/components/selection/index.pug +15 -8
- package/components/selection/index.scss +2 -2
- package/components/selection/input.js +56 -0
- package/components/selection/radiogroup.js +47 -0
- package/components/slider/_spec.scss +10 -8
- package/components/slider/index.scss +2 -2
- package/components/snackbar/_spec.scss +22 -21
- package/components/snackbar/index.js +102 -111
- package/components/snackbar/index.scss +2 -2
- package/components/tab/_spec.scss +20 -19
- package/components/tab/content.js +41 -40
- package/components/tab/index.js +192 -99
- package/components/tab/index.scss +2 -2
- package/components/tab/item.js +38 -55
- package/components/tab/list.js +96 -72
- package/components/tab/panel.js +12 -13
- package/components/template/_theme.scss +11 -11
- package/components/textfield/_mixins.scss +52 -0
- package/components/textfield/_spec.scss +215 -266
- package/components/textfield/_theme.scss +95 -72
- package/components/textfield/index.eta +74 -0
- package/components/textfield/index.js +63 -57
- package/components/textfield/index.scss +2 -2
- package/components/tooltip/_spec.scss +27 -25
- package/components/tooltip/index.scss +2 -2
- package/components/type/_spec.scss +51 -38
- package/components/type/index.scss +2 -2
- package/core/_breakpoint.scss +75 -91
- package/core/_elevation.scss +10 -10
- package/core/_length.scss +9 -0
- package/core/_motion.scss +14 -14
- package/core/_platform.scss +9 -15
- package/core/_type.scss +33 -32
- package/core/aria/attributes.js +125 -25
- package/core/aria/button.js +23 -23
- package/core/aria/keyboard.js +93 -0
- package/core/aria/rovingtabindex.js +69 -154
- package/core/aria/tab.js +31 -28
- package/core/color/_theme.scss +240 -280
- package/core/color/index.scss +2 -2
- package/core/document/index.js +39 -0
- package/core/dom.js +12 -12
- package/core/overlay/_spec.scss +0 -3
- package/core/overlay/_theme.scss +56 -74
- package/core/overlay/index.js +49 -18
- package/core/overlay/index.scss +2 -2
- package/core/ripple/_spec.scss +22 -39
- package/core/ripple/_theme.scss +13 -13
- package/core/ripple/index.js +137 -134
- package/core/ripple/index.scss +2 -2
- package/core/theme/_config.scss +2 -0
- package/core/theme/_mixins.scss +172 -0
- package/core/theme/_palettes.scss +155 -135
- package/core/theme/_variables.scss +24 -15
- package/core/theme/index.js +50 -0
- package/core/throttler.js +1 -1
- package/core/transition/index.js +36 -20
- package/{docs-src → docs}/_flex.scss +0 -0
- package/{docs-src → docs}/_menuoptions.js +21 -34
- package/{docs-src → docs}/_mixins.pug +39 -26
- package/docs/_partials/_androidnavbar.eta +5 -0
- package/docs/_partials/_androidstatusbar.eta +13 -0
- package/docs/_partials/_appbar.eta +29 -0
- package/docs/_partials/_buttontest.eta +31 -0
- package/docs/_partials/_header.eta +149 -0
- package/docs/_partials/_navlistitem.eta +16 -0
- package/docs/_partials/_target.eta +1 -0
- package/{docs-src → docs}/_sample-utils.js +8 -6
- package/{docs-src → docs}/_storage.js +0 -0
- package/{docs-src → docs}/docs.scss +5 -2
- package/docs/index.eta +16 -0
- package/{docs-src → docs}/index.js +0 -0
- package/docs/pages/appbar.eta +114 -0
- package/{docs-src/components → docs/pages}/appbar.js +0 -0
- package/{docs-src/components → docs/pages}/appbar.pug +15 -18
- package/docs/pages/bottomnav.eta +188 -0
- package/{docs-src/components → docs/pages}/bottomnav.js +23 -24
- package/{docs-src/components → docs/pages}/bottomnav.pug +4 -4
- package/docs/pages/button.eta +124 -0
- package/{docs-src/components → docs/pages}/button.js +19 -19
- package/{docs-src/components → docs/pages}/button.pug +15 -15
- package/docs/pages/card.eta +90 -0
- package/{docs-src/components → docs/pages}/card.js +3 -3
- package/{docs-src/components → docs/pages}/card.pug +7 -7
- package/docs/pages/chip.eta +122 -0
- package/{docs-src/components → docs/pages}/chip.js +3 -6
- package/{docs-src/components → docs/pages}/chip.pug +2 -2
- package/docs/pages/color.eta +143 -0
- package/{docs-src/core → docs/pages}/color.js +95 -20
- package/docs/pages/color.pug +121 -0
- package/docs/pages/datatable.eta +323 -0
- package/{docs-src/components → docs/pages}/datatable.js +26 -13
- package/docs/pages/datatable.pug +283 -0
- package/docs/pages/dialog.eta +186 -0
- package/{docs-src/components → docs/pages}/dialog.js +26 -13
- package/{docs-src/components → docs/pages}/dialog.pug +46 -28
- package/docs/pages/dom.eta +26 -0
- package/docs/pages/dom.js +143 -0
- package/docs/pages/dom.pug +22 -0
- package/docs/pages/elevation.eta +35 -0
- package/{docs-src/components → docs/pages}/elevation.js +0 -0
- package/{docs-src/components → docs/pages}/elevation.pug +0 -0
- package/docs/pages/fab.eta +99 -0
- package/{docs-src/components → docs/pages}/fab.js +3 -3
- package/{docs-src/components → docs/pages}/fab.pug +2 -2
- package/docs/pages/grid.eta +135 -0
- package/{docs-src/components → docs/pages}/grid.js +1 -1
- package/{docs-src/components → docs/pages}/grid.pug +3 -3
- package/docs/pages/layout.eta +8 -0
- package/{docs-src/components → docs/pages}/layout.js +0 -0
- package/{docs-src/components → docs/pages}/layout.pug +0 -0
- package/docs/pages/list.eta +465 -0
- package/{docs-src/components → docs/pages}/list.js +2 -2
- package/{docs-src/components → docs/pages}/list.pug +7 -14
- package/docs/pages/menu.eta +276 -0
- package/{docs-src/components → docs/pages}/menu.js +14 -10
- package/{docs-src/components → docs/pages}/menu.pug +0 -0
- package/docs/pages/overlay.eta +69 -0
- package/docs/pages/overlay.js +4 -0
- package/{docs-src/core → docs/pages}/overlay.pug +14 -11
- package/docs/pages/progress.eta +23 -0
- package/{docs-src/components → docs/pages}/progress.js +1 -1
- package/{docs-src/components → docs/pages}/progress.pug +1 -1
- package/docs/pages/ripple.eta +27 -0
- package/docs/pages/ripple.js +4 -0
- package/{docs-src/core → docs/pages}/ripple.pug +4 -4
- package/docs/pages/search.eta +246 -0
- package/{docs-src/components → docs/pages}/search.js +59 -42
- package/{docs-src/components → docs/pages}/search.pug +50 -51
- package/docs/pages/selection.eta +111 -0
- package/docs/pages/selection.js +13 -0
- package/docs/pages/selection.pug +74 -0
- package/docs/pages/slider.eta +23 -0
- package/{docs-src/components → docs/pages}/slider.js +0 -0
- package/{docs-src/components → docs/pages}/slider.pug +0 -0
- package/docs/pages/snackbar.eta +83 -0
- package/{docs-src/components → docs/pages}/snackbar.js +3 -3
- package/{docs-src/components → docs/pages}/snackbar.pug +0 -0
- package/docs/pages/tab.eta +421 -0
- package/{docs-src/components → docs/pages}/tab.js +18 -35
- package/{docs-src/components → docs/pages}/tab.pug +4 -4
- package/docs/pages/textfield.eta +486 -0
- package/{docs-src/components → docs/pages}/textfield.js +3 -4
- package/{docs-src/components → docs/pages}/textfield.pug +87 -35
- package/docs/pages/tooltip.eta +94 -0
- package/{docs-src/components → docs/pages}/tooltip.js +0 -0
- package/{docs-src/components → docs/pages}/tooltip.pug +0 -1
- package/docs/pages/transition.eta +117 -0
- package/{docs-src/core → docs/pages}/transition.js +7 -8
- package/{docs-src/core → docs/pages}/transition.pug +0 -0
- package/docs/pages/type.eta +31 -0
- package/{docs-src/components → docs/pages}/type.js +0 -0
- package/{docs-src/components → docs/pages}/type.pug +0 -1
- package/docs/postrender.js +39 -0
- package/{docs-src → docs}/prerender.js +3 -9
- package/docs/pwa/_dialogs.eta +143 -0
- package/docs/pwa/_dialogs.pug +96 -0
- package/docs/pwa/_menus.eta +16 -0
- package/{docs-src → docs}/pwa/_menus.pug +0 -0
- package/docs/pwa/pwa-prerender.js +3 -0
- package/docs/pwa/pwa.eta +480 -0
- package/docs/pwa/pwa.js +306 -0
- package/{docs-src → docs}/pwa/pwa.pug +166 -263
- package/docs/pwa/pwa.scss +26 -0
- package/docs/spec.scss +26 -0
- package/docs/themes/_component-themes.scss +26 -0
- package/docs/themes/theme-colored-fallbacks.scss +17 -0
- package/docs/themes/theme-colored.scss +17 -0
- package/docs/themes/theme-default-fallbacks.scss +17 -0
- package/docs/themes/theme-default.scss +17 -0
- package/jsconfig.json +4 -2
- package/package.json +40 -27
- package/scripts/deploy-docs.sh +9 -0
- package/templates/index.eta +2 -0
- package/utils/function.js +3 -0
- package/webpack.config.cjs +257 -0
- package/_spec.scss +0 -27
- package/_theme.scss +0 -27
- package/components/list/expander.js +0 -142
- package/components/list/itemgroup.js +0 -22
- package/core/theme/_builder.scss +0 -116
- package/core/theme/index.scss +0 -68
- package/docs/appbar.html +0 -1
- package/docs/appbar.min.js +0 -2
- package/docs/appbar.min.js.map +0 -1
- 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/chip.html +0 -1
- package/docs/chip.min.js +0 -2
- package/docs/chip.min.js.map +0 -1
- package/docs/color.html +0 -1
- package/docs/color.min.js +0 -2
- package/docs/color.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/default.common.min.js +0 -2
- package/docs/default.common.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/grid.html +0 -1
- package/docs/grid.min.js +0 -2
- package/docs/grid.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/ink.html +0 -1
- package/docs/ink.min.js +0 -2
- package/docs/ink.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/overlay.html +0 -1
- package/docs/overlay.min.js +0 -2
- package/docs/overlay.min.js.map +0 -1
- package/docs/prerender.common.min.js +0 -2
- package/docs/prerender.common.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/pwa-prerender.min.js +0 -2
- package/docs/pwa-prerender.min.js.map +0 -1
- package/docs/pwa.html +0 -11
- package/docs/pwa.min.css +0 -1
- package/docs/pwa.min.js +0 -2
- package/docs/pwa.min.js.map +0 -1
- package/docs/ripple.html +0 -1
- package/docs/ripple.min.js +0 -2
- package/docs/ripple.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/spec.min.css +0 -1
- package/docs/spec.min.js +0 -2
- package/docs/spec.min.js.map +0 -1
- package/docs/surface.html +0 -1
- package/docs/surface.min.js +0 -2
- package/docs/surface.min.js.map +0 -1
- 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/theme-colored-fallbacks.min.css +0 -1
- package/docs/theme-colored-fallbacks.min.js +0 -2
- package/docs/theme-colored-fallbacks.min.js.map +0 -1
- package/docs/theme-colored.min.css +0 -1
- package/docs/theme-colored.min.js +0 -2
- package/docs/theme-colored.min.js.map +0 -1
- package/docs/theme-default-fallbacks.min.css +0 -1
- package/docs/theme-default-fallbacks.min.js +0 -2
- package/docs/theme-default-fallbacks.min.js.map +0 -1
- package/docs/theme-default.min.css +0 -1
- package/docs/theme-default.min.js +0 -2
- package/docs/theme-default.min.js.map +0 -1
- package/docs/themes-fallbacks.min.css +0 -1
- package/docs/themes-fallbacks.min.js +0 -2
- package/docs/themes-fallbacks.min.js.map +0 -1
- package/docs/themes.min.css +0 -1
- package/docs/themes.min.js +0 -2
- package/docs/themes.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/transition.html +0 -1
- package/docs/transition.min.js +0 -2
- package/docs/transition.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/docs-src/components/datatable.pug +0 -327
- package/docs-src/components/selection.js +0 -9
- package/docs-src/components/selection.pug +0 -77
- package/docs-src/core/color.pug +0 -201
- package/docs-src/core/overlay.js +0 -4
- package/docs-src/core/ripple.js +0 -4
- package/docs-src/index.pug +0 -9
- package/docs-src/pwa/_dialogs.pug +0 -15
- package/docs-src/pwa/pwa-prerender.js +0 -3
- package/docs-src/pwa/pwa.js +0 -182
- package/docs-src/pwa/pwa.scss +0 -25
- package/docs-src/spec.scss +0 -1
- package/docs-src/themes/theme-colored-fallbacks.scss +0 -14
- package/docs-src/themes/theme-colored.scss +0 -14
- package/docs-src/themes/theme-default-fallbacks.scss +0 -14
- package/docs-src/themes/theme-default.scss +0 -14
- package/index.js +0 -51
- package/index.scss +0 -2
- package/webpack.config.js +0 -187
package/core/_elevation.scss
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
@function mdwElevation($dp, $filter:false) {
|
|
2
|
-
@if ($filter == true) {
|
|
3
|
-
@return unquote(map-get($mdw-elevation__filter-values, $dp));
|
|
4
|
-
} @else {
|
|
5
|
-
@return unquote(map-get($mdw-elevation__box-shadow-values, $dp));
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
|
|
10
2
|
// https://material.io/archive/guidelines/resources/shadows.html#shadows-sketch
|
|
11
|
-
$
|
|
3
|
+
$shadowValues: (
|
|
12
4
|
0: "none",
|
|
13
5
|
1: "0 00px 02px 0px rgba(0,0,0,0.14), 0 02px 02px 0px rgba(0,0,0,0.12), 0 01px 03px 0 rgba(0,0,0,0.20)",
|
|
14
6
|
2: "0 00px 04px 0px rgba(0,0,0,0.14), 0 03px 04px 0px rgba(0,0,0,0.12), 0 01px 05px 0 rgba(0,0,0,0.20)",
|
|
@@ -23,7 +15,7 @@ $mdw-elevation__box-shadow-values: (
|
|
|
23
15
|
) !default;
|
|
24
16
|
|
|
25
17
|
// https://material.io/archive/guidelines/resources/shadows.html#shadows-illustrator
|
|
26
|
-
$
|
|
18
|
+
$filterValues: (
|
|
27
19
|
0: "none",
|
|
28
20
|
1: "drop-shadow(0 00.92px 00.5px rgba(0,0,0,0.26)) drop-shadow(0 0 00.67px rgba(0,0,0,0.08))",
|
|
29
21
|
2: "drop-shadow(0 01.83px 01.0px rgba(0,0,0,0.26)) drop-shadow(0 0 01.33px rgba(0,0,0,0.08))",
|
|
@@ -36,3 +28,11 @@ $mdw-elevation__filter-values: (
|
|
|
36
28
|
16: "drop-shadow(0 14.67px 08.0px rgba(0,0,0,0.26)) drop-shadow(0 0 10.67px rgba(0,0,0,0.08))",
|
|
37
29
|
24: "drop-shadow(0 22.12px 12.0px rgba(0,0,0,0.26)) drop-shadow(0 0 16.00px rgba(0,0,0,0.08))",
|
|
38
30
|
) !default;
|
|
31
|
+
|
|
32
|
+
@function boxShadow($dp) {
|
|
33
|
+
@return unquote(map-get($shadowValues, $dp));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@function filter($dp) {
|
|
37
|
+
@return unquote(map-get($filterValues, $dp));
|
|
38
|
+
}
|
package/core/_motion.scss
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
// Motion Durations
|
|
2
2
|
// https://material.io/guidelines/motion/duration-easing.html#duration-easing-dynamic-durations
|
|
3
3
|
|
|
4
|
-
$
|
|
5
|
-
$
|
|
6
|
-
$
|
|
4
|
+
$simpleDuration: 100ms !default;
|
|
5
|
+
$fadeInDuration: 150ms !default;
|
|
6
|
+
$fadeOutDuration: 75ms !default;
|
|
7
7
|
|
|
8
|
-
$
|
|
9
|
-
$
|
|
8
|
+
$shapeChangeDuration: 200ms !default;
|
|
9
|
+
$iconDuration: 500ms !default;
|
|
10
10
|
|
|
11
|
-
$
|
|
12
|
-
$
|
|
11
|
+
$expandDuration: 250ms !default;
|
|
12
|
+
$collapseDuration: 200ms !default;
|
|
13
13
|
|
|
14
|
-
$
|
|
15
|
-
$
|
|
14
|
+
$expandDurationFull: 300ms !default;
|
|
15
|
+
$collapseDurationFull: 250ms !default;
|
|
16
16
|
|
|
17
17
|
// Motion Easing Curves
|
|
18
18
|
// https://material.io/guidelines/motion/duration-easing.html#duration-easing-natural-easing-curves
|
|
19
19
|
|
|
20
20
|
// FastOutSlowInInterpolator
|
|
21
|
-
$
|
|
22
|
-
$
|
|
21
|
+
$standardEasing: cubic-bezier(0.4, 0.0, 0.2, 1) !default;
|
|
22
|
+
$standardPeakVelocity: 0.30 !default;
|
|
23
23
|
|
|
24
24
|
// LinearOutSlowInInterpolator
|
|
25
|
-
$
|
|
25
|
+
$decelerateEasing: cubic-bezier(0.0, 0.0, 0.2, 1) !default;
|
|
26
26
|
|
|
27
27
|
// FastOutLinearInInterpolator
|
|
28
|
-
$
|
|
28
|
+
$accelerateEasing: cubic-bezier(0.4, 0.0, 1, 1) !default;
|
|
29
29
|
|
|
30
30
|
// FastOutLinearInInterpolator
|
|
31
|
-
$
|
|
31
|
+
$sharpEasing: cubic-bezier(0.4, 0.0, 0.6, 1) !default;
|
package/core/_platform.scss
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
@
|
|
3
|
-
@return $multiplier * 1px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
@mixin mdw-platform__has-touch-support {
|
|
1
|
+
// Touch support based mixins
|
|
2
|
+
@mixin ifHasTouch {
|
|
7
3
|
@media (any-pointer: coarse) {
|
|
8
4
|
@content;
|
|
9
5
|
}
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
@mixin
|
|
8
|
+
@mixin ifNoTouch {
|
|
13
9
|
@media not all and (any-pointer: coarse) {
|
|
14
10
|
@content;
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
// Browser specific mixins
|
|
19
|
-
@mixin
|
|
20
|
-
@media
|
|
15
|
+
@mixin ifIE {
|
|
16
|
+
@media all\0 {
|
|
21
17
|
@content;
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@mixin mdw-platform__edge {
|
|
21
|
+
@mixin ifEdge {
|
|
28
22
|
@supports (-ms-ime-align:auto) {
|
|
29
23
|
@content;
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
@mixin
|
|
34
|
-
@include
|
|
27
|
+
@mixin ifMS {
|
|
28
|
+
@include ifIE {
|
|
35
29
|
@content;
|
|
36
30
|
}
|
|
37
|
-
@include
|
|
31
|
+
@include ifEdge {
|
|
38
32
|
@content;
|
|
39
33
|
}
|
|
40
34
|
}
|
package/core/_type.scss
CHANGED
|
@@ -1,125 +1,126 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use './_length.scss' as *;
|
|
2
2
|
|
|
3
|
-
$
|
|
4
|
-
$
|
|
5
|
-
$
|
|
6
|
-
$
|
|
7
|
-
$
|
|
8
|
-
$
|
|
3
|
+
$weightThin: 100 !default;
|
|
4
|
+
$weightLight: 300 !default;
|
|
5
|
+
$weightRegular: 400 !default;
|
|
6
|
+
$weightMedium: 500 !default;
|
|
7
|
+
$weightBold: 700 !default;
|
|
8
|
+
$weightBlack: 900 !default;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
@return ($multiplier/16.0) * 1rem;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
$mdw-types: (
|
|
10
|
+
$types: (
|
|
15
11
|
h1: (
|
|
16
|
-
font-weight: $
|
|
12
|
+
font-weight: $weightLight,
|
|
17
13
|
letter-spacing: sp(-1.5),
|
|
18
14
|
font-size: sp(96),
|
|
19
15
|
line-height: sp(112),
|
|
20
16
|
),
|
|
21
17
|
h2: (
|
|
22
|
-
font-weight: $
|
|
18
|
+
font-weight: $weightLight,
|
|
23
19
|
letter-spacing: sp(-0.5),
|
|
24
20
|
font-size: sp(60),
|
|
25
21
|
line-height: sp(72),
|
|
26
22
|
),
|
|
27
23
|
h3: (
|
|
28
|
-
font-weight: $
|
|
24
|
+
font-weight: $weightRegular,
|
|
29
25
|
letter-spacing: 0,
|
|
30
26
|
font-size: sp(48),
|
|
31
27
|
line-height: sp(56),
|
|
32
28
|
),
|
|
33
29
|
h4: (
|
|
34
|
-
font-weight: $
|
|
30
|
+
font-weight: $weightRegular,
|
|
35
31
|
letter-spacing: sp(0.25),
|
|
36
32
|
font-size: sp(34),
|
|
37
33
|
line-height: sp(40),
|
|
38
34
|
),
|
|
39
35
|
h5: (
|
|
40
|
-
font-weight: $
|
|
36
|
+
font-weight: $weightRegular,
|
|
41
37
|
letter-spacing: 0,
|
|
42
38
|
font-size: sp(24),
|
|
43
39
|
line-height: sp(28),
|
|
44
40
|
),
|
|
45
41
|
h6: (
|
|
46
|
-
font-weight: $
|
|
42
|
+
font-weight: $weightMedium,
|
|
47
43
|
letter-spacing: sp(0.15),
|
|
48
44
|
font-size: sp(20),
|
|
49
45
|
line-height: sp(24),
|
|
50
46
|
),
|
|
51
47
|
subtitle: (
|
|
52
|
-
font-weight: $
|
|
48
|
+
font-weight: $weightRegular,
|
|
53
49
|
letter-spacing: sp(0.15),
|
|
54
50
|
font-size: sp(16),
|
|
55
51
|
line-height: sp(20),
|
|
56
52
|
),
|
|
57
53
|
subtitle-2: (
|
|
58
|
-
font-weight: $
|
|
54
|
+
font-weight: $weightMedium,
|
|
59
55
|
letter-spacing: sp(0.1),
|
|
60
56
|
font-size: sp(14),
|
|
61
57
|
line-height: sp(16),
|
|
62
58
|
),
|
|
63
59
|
body: (
|
|
64
|
-
font-weight: $
|
|
60
|
+
font-weight: $weightRegular,
|
|
65
61
|
letter-spacing: sp(0.5),
|
|
66
62
|
font-size: sp(16),
|
|
67
63
|
line-height: sp(24),
|
|
68
64
|
),
|
|
69
65
|
body-2: (
|
|
70
|
-
font-weight: $
|
|
66
|
+
font-weight: $weightRegular,
|
|
71
67
|
letter-spacing: sp(0.25),
|
|
72
68
|
font-size: sp(14),
|
|
73
69
|
line-height: sp(20),
|
|
74
70
|
),
|
|
75
71
|
button: (
|
|
76
|
-
font-weight: $
|
|
72
|
+
font-weight: $weightMedium,
|
|
77
73
|
text-transform: uppercase,
|
|
78
74
|
letter-spacing: sp(1.25),
|
|
79
75
|
font-size: sp(14),
|
|
80
76
|
line-height: sp(16),
|
|
81
77
|
),
|
|
82
78
|
caption: (
|
|
83
|
-
font-weight: $
|
|
79
|
+
font-weight: $weightRegular,
|
|
84
80
|
letter-spacing: sp(0.4),
|
|
85
81
|
font-size: sp(12),
|
|
86
82
|
line-height: sp(16),
|
|
87
83
|
),
|
|
88
84
|
overline: (
|
|
89
|
-
font-weight: $
|
|
85
|
+
font-weight: $weightRegular,
|
|
90
86
|
letter-spacing: sp(1.5),
|
|
91
87
|
font-size: sp(10),
|
|
92
88
|
line-height: sp(12),
|
|
93
89
|
),
|
|
94
|
-
);
|
|
90
|
+
) !default;
|
|
95
91
|
|
|
96
|
-
@mixin
|
|
97
|
-
$rules: map-get($
|
|
92
|
+
@mixin addRules($type) {
|
|
93
|
+
$rules: map-get($types, $type);
|
|
98
94
|
@each $key in map-keys($rules) {
|
|
99
95
|
#{$key}: map-get($rules, $key);
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
@mixin
|
|
99
|
+
@mixin baselineToTop($dp) {
|
|
104
100
|
&::before {
|
|
105
101
|
content: '';
|
|
102
|
+
|
|
106
103
|
display: inline-block;
|
|
104
|
+
|
|
107
105
|
height: dp($dp);
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
@mixin
|
|
109
|
+
@mixin baselineToBottom($dp) {
|
|
112
110
|
&::after {
|
|
113
111
|
content: '';
|
|
112
|
+
|
|
114
113
|
display: inline-block;
|
|
115
114
|
vertical-align: dp(-$dp);
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
@mixin
|
|
118
|
+
@mixin textTopToTop($dp) {
|
|
120
119
|
&::before {
|
|
121
|
-
content:
|
|
120
|
+
content: "\200B";
|
|
121
|
+
|
|
122
122
|
display: inline-block;
|
|
123
|
+
|
|
123
124
|
height: 1em;
|
|
124
125
|
margin-top: dp($dp);
|
|
125
126
|
}
|
package/core/aria/attributes.js
CHANGED
|
@@ -1,41 +1,141 @@
|
|
|
1
|
-
import { dispatchDomEvent } from '../dom';
|
|
2
|
-
|
|
3
|
-
export const SELECTED_CHANGED_EVENT = 'mdw:aria-selectedchanged';
|
|
1
|
+
import { dispatchDomEvent } from '../dom.js';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {boolean}
|
|
9
|
-
* @
|
|
4
|
+
* @param {string} name Attribute Name
|
|
5
|
+
* @param {Element} element Element
|
|
6
|
+
* @param {string|boolean} value Boolean Attribute Value
|
|
7
|
+
* @param {string} [dispatchEventName] OnChangeEvent
|
|
8
|
+
* @param {boolean} [explicit=true]
|
|
9
|
+
* @param {string} [emptyValue=false] Default empty value
|
|
10
|
+
* @return {boolean} successful
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
element.setAttribute('aria-selected', 'true');
|
|
12
|
+
function setAttribute(name, element, value, dispatchEventName, explicit = true, emptyValue = 'false') {
|
|
13
|
+
const attr = element.getAttribute(name);
|
|
14
|
+
let stringValue;
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
stringValue = value;
|
|
18
17
|
} else {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
stringValue = (value ? 'true' : 'false');
|
|
19
|
+
}
|
|
20
|
+
if (attr === stringValue) {
|
|
21
|
+
// Nothing to change
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (stringValue === emptyValue) {
|
|
25
|
+
// Set default empty value
|
|
26
|
+
if (attr == null) {
|
|
27
|
+
// No attribute set
|
|
28
|
+
if (explicit) {
|
|
29
|
+
// Explicitly set attribute
|
|
30
|
+
element.setAttribute(name, stringValue);
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
21
33
|
}
|
|
22
|
-
if (!
|
|
23
|
-
element.
|
|
24
|
-
|
|
34
|
+
if (!explicit) {
|
|
35
|
+
element.removeAttribute(name);
|
|
36
|
+
} else {
|
|
37
|
+
element.setAttribute(name, stringValue);
|
|
25
38
|
}
|
|
26
|
-
|
|
39
|
+
} else {
|
|
40
|
+
// Non default value;
|
|
41
|
+
element.setAttribute(name, stringValue);
|
|
27
42
|
}
|
|
28
|
-
if (!
|
|
43
|
+
if (!dispatchEventName) {
|
|
29
44
|
return true;
|
|
30
45
|
}
|
|
31
|
-
|
|
46
|
+
// Alert change
|
|
47
|
+
if (!dispatchDomEvent(element, dispatchEventName, { value: stringValue })) {
|
|
32
48
|
// Revert
|
|
33
|
-
if (
|
|
34
|
-
element.removeAttribute(
|
|
49
|
+
if (attr == null) {
|
|
50
|
+
element.removeAttribute(name);
|
|
35
51
|
} else {
|
|
36
|
-
element.setAttribute(
|
|
52
|
+
element.setAttribute(name, attr);
|
|
37
53
|
}
|
|
38
54
|
return false;
|
|
39
55
|
}
|
|
40
56
|
return true;
|
|
41
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param {Element} element
|
|
61
|
+
* @param {string|boolean} value
|
|
62
|
+
* @param {string} [dispatchEventName]
|
|
63
|
+
* @return {boolean} successful
|
|
64
|
+
*/
|
|
65
|
+
export function setCurrent(element, value, dispatchEventName) {
|
|
66
|
+
// Some browsers incorrectly style [aria-current="false"]
|
|
67
|
+
// Attribute will be removed when false|"false"
|
|
68
|
+
return setAttribute('aria-current', element, value, dispatchEventName, false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {Element} element
|
|
73
|
+
* @param {string|boolean} value
|
|
74
|
+
* @param {string} [dispatchEventName]
|
|
75
|
+
* @return {boolean} successful
|
|
76
|
+
*/
|
|
77
|
+
export function setSelected(element, value, dispatchEventName) {
|
|
78
|
+
return setAttribute('aria-selected', element, value, dispatchEventName);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @param {Element} element
|
|
83
|
+
* @return {boolean}
|
|
84
|
+
*/
|
|
85
|
+
export function isChecked(element) {
|
|
86
|
+
return element.getAttribute('aria-checked') === 'true';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {Element} element
|
|
91
|
+
* @param {string|boolean} value
|
|
92
|
+
* @param {string} [dispatchEventName]
|
|
93
|
+
* @return {boolean} successful
|
|
94
|
+
*/
|
|
95
|
+
export function setChecked(element, value, dispatchEventName) {
|
|
96
|
+
return setAttribute('aria-checked', element, value, dispatchEventName);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param {Element} element
|
|
101
|
+
* @return {boolean}
|
|
102
|
+
*/
|
|
103
|
+
export function isDisabled(element) {
|
|
104
|
+
return element.getAttribute('aria-disabled') === 'true';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {Element} element
|
|
109
|
+
* @param {string|boolean} value
|
|
110
|
+
* @param {string} [dispatchEventName]
|
|
111
|
+
* @return {boolean} successful
|
|
112
|
+
*/
|
|
113
|
+
export function setDisabled(element, value, dispatchEventName) {
|
|
114
|
+
return setAttribute('aria-disabled', element, value, dispatchEventName);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @param {Element} element
|
|
119
|
+
* @return {boolean}
|
|
120
|
+
*/
|
|
121
|
+
export function isExpanded(element) {
|
|
122
|
+
return element.getAttribute('aria-expanded') === 'true';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {Element} element
|
|
127
|
+
* @param {string|boolean} value
|
|
128
|
+
* @param {string} [dispatchEventName]
|
|
129
|
+
* @return {boolean} successful
|
|
130
|
+
*/
|
|
131
|
+
export function setExpanded(element, value, dispatchEventName) {
|
|
132
|
+
return setAttribute('aria-expanded', element, value, dispatchEventName);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {Element} element
|
|
137
|
+
* @return {boolean}
|
|
138
|
+
*/
|
|
139
|
+
export function isReadonly(element) {
|
|
140
|
+
return element.getAttribute('aria-readonly') === 'true';
|
|
141
|
+
}
|
package/core/aria/button.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
// https://www.w3.org/TR/wai-aria-practices/#button
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @param {KeyboardEvent} event
|
|
5
|
+
* @return {void}
|
|
6
|
+
*/
|
|
7
|
+
function onKeyDown(event) {
|
|
8
|
+
if (event.key !== 'Enter' && event.key !== 'Spacebar' && event.key !== ' ') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
/** @type {HTMLElement} */
|
|
12
|
+
const buttonElement = (event.currentTarget);
|
|
13
|
+
if (!buttonElement) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (buttonElement.getAttribute('aria-disabled') === 'true') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
const newEvent = document.createEvent('Event');
|
|
22
|
+
newEvent.initEvent('click', true, true);
|
|
23
|
+
buttonElement.dispatchEvent(newEvent);
|
|
24
|
+
}
|
|
25
|
+
|
|
3
26
|
/**
|
|
4
27
|
* @param {Element} element
|
|
5
28
|
* @return {void}
|
|
@@ -25,26 +48,3 @@ export function detach(element) {
|
|
|
25
48
|
element.removeEventListener('keydown', onKeyDown);
|
|
26
49
|
element.removeAttribute('mdw-aria-button-js');
|
|
27
50
|
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @param {KeyboardEvent} event
|
|
31
|
-
* @return {void}
|
|
32
|
-
*/
|
|
33
|
-
function onKeyDown(event) {
|
|
34
|
-
if (event.key !== 'Enter' && event.key !== 'Spacebar' && event.key !== ' ') {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
/** @type {HTMLElement} */
|
|
38
|
-
const buttonElement = (event.currentTarget);
|
|
39
|
-
if (!buttonElement) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (buttonElement.getAttribute('aria-disabled') === 'true') {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
event.stopPropagation();
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
const newEvent = document.createEvent('Event');
|
|
48
|
-
newEvent.initEvent('click', true, true);
|
|
49
|
-
buttonElement.dispatchEvent(newEvent);
|
|
50
|
-
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Keyboard Navigation
|
|
2
|
+
|
|
3
|
+
import { dispatchDomEvent, isRtl } from '../dom.js';
|
|
4
|
+
|
|
5
|
+
export const FORWARD_ARROW_KEY = 'mdw:keyboard-forwardarrowkey';
|
|
6
|
+
export const BACK_ARROW_KEY = 'mdw:keyboard-backarrowkey';
|
|
7
|
+
export const UP_ARROW_KEY = 'mdw:keyboard-uparrowkey';
|
|
8
|
+
export const DOWN_ARROW_KEY = 'mdw:keyboard-downarrowkey';
|
|
9
|
+
export const HOME_KEY = 'mdw:keyboard-homekey';
|
|
10
|
+
export const END_KEY = 'mdw:keyboard-endkey';
|
|
11
|
+
export const PAGEUP_KEY = 'mdw:keyboard-pageupkey';
|
|
12
|
+
export const PAGEDOWN_KEY = 'mdw:keyboard-pagedownkey';
|
|
13
|
+
export const SPACEBAR_KEY = 'mdw:keyboard-spacebarkey';
|
|
14
|
+
export const ENTER_KEY = 'mdw:keyboard-enterkey';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {KeyboardEvent} event
|
|
18
|
+
* @return {void}
|
|
19
|
+
*/
|
|
20
|
+
function onKeyDownHandler(event) {
|
|
21
|
+
/** @type {Element} */
|
|
22
|
+
const element = (event.currentTarget);
|
|
23
|
+
const detail = {
|
|
24
|
+
ctrlKey: event.ctrlKey,
|
|
25
|
+
shiftKey: event.shiftKey,
|
|
26
|
+
altKey: event.altKey,
|
|
27
|
+
metaKey: event.metaKey,
|
|
28
|
+
repeat: event.repeat,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let type;
|
|
32
|
+
switch (event.key) {
|
|
33
|
+
case 'Enter':
|
|
34
|
+
type = ENTER_KEY;
|
|
35
|
+
break;
|
|
36
|
+
case ' ':
|
|
37
|
+
case 'Spacebar':
|
|
38
|
+
type = SPACEBAR_KEY;
|
|
39
|
+
break;
|
|
40
|
+
case 'ArrowDown':
|
|
41
|
+
case 'Down':
|
|
42
|
+
type = DOWN_ARROW_KEY;
|
|
43
|
+
break;
|
|
44
|
+
case 'ArrowUp':
|
|
45
|
+
case 'Up':
|
|
46
|
+
type = UP_ARROW_KEY;
|
|
47
|
+
break;
|
|
48
|
+
case 'ArrowLeft':
|
|
49
|
+
case 'Left':
|
|
50
|
+
type = isRtl() ? FORWARD_ARROW_KEY : BACK_ARROW_KEY;
|
|
51
|
+
break;
|
|
52
|
+
case 'ArrowRight':
|
|
53
|
+
case 'Right':
|
|
54
|
+
type = isRtl() ? BACK_ARROW_KEY : FORWARD_ARROW_KEY;
|
|
55
|
+
break;
|
|
56
|
+
case 'Home':
|
|
57
|
+
type = HOME_KEY;
|
|
58
|
+
break;
|
|
59
|
+
case 'End':
|
|
60
|
+
type = END_KEY;
|
|
61
|
+
break;
|
|
62
|
+
case 'PageUp':
|
|
63
|
+
type = PAGEUP_KEY;
|
|
64
|
+
break;
|
|
65
|
+
case 'PageDown':
|
|
66
|
+
type = PAGEDOWN_KEY;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!dispatchDomEvent(element, type, detail)) {
|
|
73
|
+
// preventDefault called
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Element} element
|
|
81
|
+
* @return {void}
|
|
82
|
+
*/
|
|
83
|
+
export function attach(element) {
|
|
84
|
+
element.addEventListener('keydown', onKeyDownHandler);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @param {Element} element
|
|
89
|
+
* @return {void}
|
|
90
|
+
*/
|
|
91
|
+
export function detach(element) {
|
|
92
|
+
element.removeEventListener('keydown', onKeyDownHandler);
|
|
93
|
+
}
|