@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** @return {void} */
|
|
2
|
+
export function detectStandalone() {
|
|
3
|
+
// @ts-ignore: Safari uses navigator.standalone
|
|
4
|
+
if (navigator.standalone === true || window.matchMedia('(display-mode: standalone)').matches) {
|
|
5
|
+
document.documentElement.setAttribute('mdw-standalone', '');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** @return {void} */
|
|
10
|
+
export function detectUserAgent() {
|
|
11
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
12
|
+
if (/iphone/i.test(ua) || /ipad/i.test(ua) || /macintosh/i.test(ua)) {
|
|
13
|
+
document.documentElement.setAttribute('mdw-ios', '');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @return {void} */
|
|
18
|
+
export function detectColorScheme() {
|
|
19
|
+
// Auto lightness and fill
|
|
20
|
+
if (!document.documentElement.hasAttribute('mdw-surface')
|
|
21
|
+
&& !document.documentElement.hasAttribute('mdw-light')
|
|
22
|
+
&& !document.documentElement.hasAttribute('mdw-dark')) {
|
|
23
|
+
if (window.matchMedia('(prefers-color-scheme:dark)').matches) {
|
|
24
|
+
document.documentElement.setAttribute('mdw-dark', '');
|
|
25
|
+
} else {
|
|
26
|
+
document.documentElement.setAttribute('mdw-light', '');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Run before document has loaded
|
|
33
|
+
* @return {void}
|
|
34
|
+
*/
|
|
35
|
+
export function onPrerender() {
|
|
36
|
+
detectStandalone();
|
|
37
|
+
detectUserAgent();
|
|
38
|
+
detectColorScheme();
|
|
39
|
+
}
|
package/core/dom.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @type {?boolean} */
|
|
1
2
|
let passiveEventListenerSupported = null;
|
|
2
3
|
|
|
3
4
|
/** @return {void} */
|
|
@@ -10,9 +11,9 @@ function testPassiveEventListenerOptionSupport() {
|
|
|
10
11
|
return true;
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
|
-
// @ts-ignore
|
|
14
|
+
// @ts-ignore: Custom test event
|
|
14
15
|
window.addEventListener('test', options, options);
|
|
15
|
-
// @ts-ignore
|
|
16
|
+
// @ts-ignore: Custom test event
|
|
16
17
|
window.removeEventListener('test', options, options);
|
|
17
18
|
} catch (err) {
|
|
18
19
|
passiveEventListenerSupported = false;
|
|
@@ -30,7 +31,7 @@ export function getPassiveEventListenerOption() {
|
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
export const nextTick = window.requestAnimationFrame || (cb => window.setTimeout(cb, 17));
|
|
34
|
+
export const nextTick = window.requestAnimationFrame || ((cb) => window.setTimeout(cb, 17));
|
|
34
35
|
|
|
35
36
|
export const cancelTick = window.cancelAnimationFrame || window.clearTimeout;
|
|
36
37
|
|
|
@@ -48,18 +49,18 @@ export function getChildElementByClass(element, className) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* @param {
|
|
52
|
+
* @param {Element} element
|
|
52
53
|
* @param {string} className
|
|
53
54
|
* @param {boolean} [includeSelf=true]
|
|
54
55
|
* @return {HTMLElement}
|
|
55
56
|
*/
|
|
56
57
|
export function findElementParentByClassName(element, className, includeSelf) {
|
|
57
|
-
/** @type {HTMLElement} */
|
|
58
58
|
let el;
|
|
59
59
|
if (includeSelf === false) {
|
|
60
60
|
el = element.parentElement;
|
|
61
61
|
} else {
|
|
62
|
-
|
|
62
|
+
/** @type {HTMLElement} */
|
|
63
|
+
el = (element);
|
|
63
64
|
}
|
|
64
65
|
while (el != null && !el.classList.contains(className)) {
|
|
65
66
|
el = el.parentElement;
|
|
@@ -69,17 +70,16 @@ export function findElementParentByClassName(element, className, includeSelf) {
|
|
|
69
70
|
|
|
70
71
|
/** @return {boolean} */
|
|
71
72
|
export function isRtl() {
|
|
72
|
-
return document.documentElement.
|
|
73
|
-
&& document.documentElement.getAttribute('dir').toLowerCase() === 'rtl';
|
|
73
|
+
return document.documentElement.dir === 'rtl';
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* @param {
|
|
77
|
+
* @param {EventTarget} eventTarget
|
|
78
78
|
* @param {string} type
|
|
79
79
|
* @param {Object} [detail]
|
|
80
80
|
* @return {boolean}
|
|
81
81
|
*/
|
|
82
|
-
export function dispatchDomEvent(
|
|
82
|
+
export function dispatchDomEvent(eventTarget, type, detail) {
|
|
83
83
|
let event;
|
|
84
84
|
if (typeof CustomEvent === 'function') {
|
|
85
85
|
event = new CustomEvent(type, {
|
|
@@ -101,7 +101,7 @@ export function dispatchDomEvent(element, type, detail) {
|
|
|
101
101
|
event = document.createEvent('CustomEvent');
|
|
102
102
|
event.initCustomEvent(type, true, true, detail);
|
|
103
103
|
}
|
|
104
|
-
return
|
|
104
|
+
return eventTarget.dispatchEvent(event);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -177,7 +177,7 @@ export function iterateSomeOfElementSiblings(element, fn) {
|
|
|
177
177
|
/**
|
|
178
178
|
* @param {Node} node
|
|
179
179
|
* @param {boolean} [create]
|
|
180
|
-
* @return {
|
|
180
|
+
* @return {Text}
|
|
181
181
|
*/
|
|
182
182
|
export function getTextNode(node, create) {
|
|
183
183
|
let textNode;
|
package/core/overlay/_spec.scss
CHANGED
package/core/overlay/_theme.scss
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// https://material.io/design/interaction/states.html
|
|
2
2
|
|
|
3
|
-
@
|
|
3
|
+
@use '../theme/_mixins.scss' as theme;
|
|
4
4
|
|
|
5
|
-
$
|
|
6
|
-
|
|
7
|
-
off-color: $mdw-theme__default-ink,
|
|
8
|
-
off-medium-color: $mdw-theme__medium-ink,
|
|
9
|
-
off-inactive-color: $mdw-theme__inactive-ink,
|
|
10
|
-
off-divider-color: $mdw-theme__divider-ink,
|
|
5
|
+
$themeValues: (
|
|
6
|
+
overlay-color: theme.$foreground,
|
|
11
7
|
|
|
8
|
+
high-opacity: theme.$high-opacity,
|
|
9
|
+
medium-opacity: theme.$medium-opacity,
|
|
10
|
+
inactive-opacity: theme.$inactive-opacity,
|
|
11
|
+
divider-opacity: theme.$divider-opacity,
|
|
12
|
+
|
|
12
13
|
disabled-opacity: (0.38, 0.50),
|
|
13
14
|
|
|
14
15
|
// states
|
|
15
|
-
overlay-color: (('foreground-light', 1.00), ('foreground-dark', 1.00)),
|
|
16
16
|
|
|
17
17
|
hover-opacity: (0.04, 0.08),
|
|
18
18
|
focus-opacity: (0.12, 0.24),
|
|
@@ -30,98 +30,81 @@ $mdw-overlay__theme-values: (
|
|
|
30
30
|
activated-hover-focus-opacity: (0.12 + 0.04 + 0.12, 0.24 + 0.08 + 0.24),
|
|
31
31
|
) !default;
|
|
32
32
|
|
|
33
|
-
@function
|
|
34
|
-
@return
|
|
33
|
+
@function getThemeValue($key, $type) {
|
|
34
|
+
@return theme.getThemeValue('overlay', $themeValues, $key, $type);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
@mixin
|
|
37
|
+
@mixin addThemeRules($type: 'var') {
|
|
38
38
|
.mdw-overlay {
|
|
39
39
|
&,
|
|
40
|
-
|
|
41
|
-
&:active,
|
|
40
|
+
&[aria-pressed="false"]:active,
|
|
42
41
|
&[aria-selected="true"],
|
|
43
42
|
&[aria-pressed="true"],
|
|
44
43
|
&[aria-current] {
|
|
45
44
|
&::before {
|
|
46
|
-
color: inherit;
|
|
47
45
|
@if ($type == 'var') {
|
|
48
|
-
color: RGB(var(--ink
|
|
46
|
+
color: RGB(var(--mdw-ink));
|
|
47
|
+
} @else {
|
|
48
|
+
// Handled by mdw-color
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&[aria-selected="false"],
|
|
54
54
|
&[aria-pressed="false"],
|
|
55
|
-
&[disabled],
|
|
56
55
|
&[aria-disabled="true"],
|
|
57
|
-
&[disabled]:active,
|
|
58
56
|
&[aria-disabled="true"]:active {
|
|
59
57
|
&::before {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.mdw-overlay__group[aria-multiselectable="true"] &[aria-selected="true"] {
|
|
66
|
-
color: mdwOverlayThemeValue("off-color", $type);
|
|
58
|
+
@if ($type == 'var') {
|
|
59
|
+
color: RGB(getThemeValue("overlay-color", $type));
|
|
60
|
+
} @else {
|
|
61
|
+
background-color: RGB(getThemeValue("overlay-color", $type));
|
|
62
|
+
}
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
|
|
66
|
+
// Off color
|
|
70
67
|
&[aria-selected="false"],
|
|
71
68
|
&[aria-pressed="false"],
|
|
72
|
-
&[
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
color: mdwOverlayThemeValue("off-color", $type);
|
|
69
|
+
&[aria-selected="true"]:not([aria-current]) {
|
|
70
|
+
#{if($type == 'var', '&', '&,&.mdw-theme')} {
|
|
71
|
+
color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("high-opacity", $type));
|
|
76
72
|
&[mdw-border-ink] {
|
|
77
|
-
border-color:
|
|
73
|
+
border-color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("divider-opacity", $type));
|
|
78
74
|
}
|
|
79
75
|
&[mdw-overlay-default="medium"] {
|
|
80
|
-
color:
|
|
76
|
+
color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("medium-opacity", $type));
|
|
81
77
|
}
|
|
82
78
|
&[mdw-overlay-default="inactive"] {
|
|
83
|
-
color:
|
|
79
|
+
color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("inactive-opacity", $type));
|
|
84
80
|
}
|
|
85
81
|
&[mdw-overlay-default="divider"] {
|
|
86
|
-
color:
|
|
82
|
+
color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("divider-opacity", $type));
|
|
87
83
|
}
|
|
88
|
-
}
|
|
89
|
-
&,&.mdw-theme {
|
|
90
|
-
color: mdwOverlayThemeValue("off-color", $type);
|
|
91
|
-
&[mdw-border-ink] {
|
|
92
|
-
border-color: mdwOverlayThemeValue("off-divider-color", $type);
|
|
93
|
-
}
|
|
94
|
-
&[mdw-overlay-default="medium"] {
|
|
95
|
-
color: mdwOverlayThemeValue("off-medium-color", $type);
|
|
96
|
-
}
|
|
97
|
-
&[mdw-overlay-default="inactive"] {
|
|
98
|
-
color: mdwOverlayThemeValue("off-inactive-color", $type);
|
|
99
|
-
}
|
|
100
|
-
&[mdw-overlay-default="divider"] {
|
|
101
|
-
color: mdwOverlayThemeValue("off-divider-color", $type);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
84
|
+
}
|
|
106
85
|
}
|
|
107
86
|
|
|
108
|
-
&[disabled],
|
|
109
87
|
&[aria-disabled="true"] {
|
|
110
|
-
|
|
88
|
+
&[mdw-overlay-disabled="ink"] {
|
|
89
|
+
color: RGBA(getThemeValue("overlay-color", $type), getThemeValue("inactive-opacity", $type));
|
|
90
|
+
}
|
|
91
|
+
&:not([mdw-overlay-disabled]) {
|
|
92
|
+
opacity: getThemeValue("disabled-opacity", $type);
|
|
93
|
+
}
|
|
111
94
|
}
|
|
112
95
|
|
|
113
96
|
&:not([mdw-overlay-touch="true"]) {
|
|
114
97
|
&:focus:not([mdw-overlay-off~="focus"]):not([mdw-overlay-touch="true"])::before {
|
|
115
|
-
opacity:
|
|
98
|
+
opacity: getThemeValue("focus-opacity", $type);
|
|
116
99
|
}
|
|
117
100
|
|
|
118
|
-
&:not([
|
|
101
|
+
&:not([aria-disabled="true"]):not([mdw-overlay-touch="true"]) {
|
|
119
102
|
&:hover:not([mdw-overlay-off~="hover"])::before {
|
|
120
|
-
opacity:
|
|
103
|
+
opacity: getThemeValue("hover-opacity", $type);
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
&:hover:focus:not([mdw-overlay-off~="hover"]):not([mdw-overlay-off~="focus"])::before {
|
|
124
|
-
opacity:
|
|
107
|
+
opacity: getThemeValue("hover-focus-opacity", $type);
|
|
125
108
|
}
|
|
126
109
|
}
|
|
127
110
|
}
|
|
@@ -129,46 +112,45 @@ $mdw-overlay__theme-values: (
|
|
|
129
112
|
// Selected
|
|
130
113
|
&[aria-selected="true"]:not([mdw-overlay-off~="selected"]) {
|
|
131
114
|
&::before {
|
|
132
|
-
opacity:
|
|
115
|
+
opacity: getThemeValue("selected-opacity", $type);
|
|
133
116
|
}
|
|
134
117
|
|
|
135
118
|
&:not([mdw-overlay-touch="true"]) {
|
|
136
119
|
&:focus:not([mdw-overlay-off~="focus"])::before {
|
|
137
|
-
opacity:
|
|
120
|
+
opacity: getThemeValue("selected-focus-opacity", $type);
|
|
138
121
|
}
|
|
139
122
|
|
|
140
|
-
&:not([
|
|
123
|
+
&:not([aria-disabled="true"]) {
|
|
141
124
|
&:hover:not([mdw-overlay-off~="hover"])::before {
|
|
142
|
-
opacity:
|
|
125
|
+
opacity: getThemeValue("selected-hover-opacity", $type);
|
|
143
126
|
}
|
|
144
127
|
|
|
145
128
|
&:hover:focus:not([mdw-overlay-off~="hover"]):not([mdw-overlay-off~="focus"])::before {
|
|
146
|
-
opacity:
|
|
129
|
+
opacity: getThemeValue("selected-hover-focus-opacity", $type);
|
|
147
130
|
}
|
|
148
131
|
}
|
|
149
132
|
}
|
|
150
133
|
}
|
|
151
134
|
|
|
152
135
|
// Activated
|
|
153
|
-
|
|
154
|
-
&[aria-current]:not([mdw-overlay-off~="current"]),
|
|
136
|
+
&[aria-current]:not([mdw-overlay-off~="activated"]),
|
|
155
137
|
&[aria-pressed="true"]:not([mdw-overlay-off~="activated"]) {
|
|
156
138
|
&::before {
|
|
157
|
-
opacity:
|
|
139
|
+
opacity: getThemeValue("activated-opacity", $type);
|
|
158
140
|
}
|
|
159
141
|
|
|
160
142
|
&:not([mdw-overlay-touch="true"]) {
|
|
161
143
|
&:focus:not([mdw-overlay-off~="focus"])::before {
|
|
162
|
-
opacity:
|
|
144
|
+
opacity: getThemeValue("activated-focus-opacity", $type);
|
|
163
145
|
}
|
|
164
146
|
|
|
165
|
-
&:not([
|
|
147
|
+
&:not([aria-disabled="true"]) {
|
|
166
148
|
&:hover:not([mdw-overlay-off~="hover"])::before {
|
|
167
|
-
opacity:
|
|
149
|
+
opacity: getThemeValue("activated-hover-opacity", $type);
|
|
168
150
|
}
|
|
169
151
|
|
|
170
152
|
&:hover:focus:not([mdw-overlay-off~="hover"]):not([mdw-overlay-off~="focus"])::before {
|
|
171
|
-
opacity:
|
|
153
|
+
opacity: getThemeValue("activated-hover-focus-opacity", $type);
|
|
172
154
|
}
|
|
173
155
|
}
|
|
174
156
|
}
|
|
@@ -176,14 +158,14 @@ $mdw-overlay__theme-values: (
|
|
|
176
158
|
}
|
|
177
159
|
}
|
|
178
160
|
|
|
179
|
-
@include
|
|
180
|
-
@include
|
|
161
|
+
@include theme.addComponentFallbackRules('light') {
|
|
162
|
+
@include addThemeRules('light');
|
|
181
163
|
}
|
|
182
|
-
@include
|
|
183
|
-
@include
|
|
164
|
+
@include theme.addComponentFallbackRules('dark') {
|
|
165
|
+
@include addThemeRules('dark');
|
|
184
166
|
}
|
|
185
167
|
|
|
186
168
|
|
|
187
|
-
@include
|
|
188
|
-
@include
|
|
169
|
+
@include theme.addComponentCSSVariableRules('overlay', $themeValues) {
|
|
170
|
+
@include addThemeRules();
|
|
189
171
|
}
|
package/core/overlay/index.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import { getPassiveEventListenerOption, iterateArrayLike } from '../dom';
|
|
1
|
+
import { getPassiveEventListenerOption, iterateArrayLike } from '../dom.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* @param {Element|Document} [root=document]
|
|
5
|
-
* @return {void}
|
|
6
|
-
*/
|
|
7
|
-
export function attachAll(root = document) {
|
|
8
|
-
iterateArrayLike(root.getElementsByClassName('mdw-overlay'), attach);
|
|
9
|
-
}
|
|
3
|
+
let lastInteractionWasTouch = false;
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @return {void}
|
|
14
|
-
*/
|
|
15
|
-
export function attach(element) {
|
|
16
|
-
element.setAttribute('mdw-overlay-js', '');
|
|
17
|
-
element.addEventListener('mousedown', onMouseDown, getPassiveEventListenerOption());
|
|
18
|
-
element.addEventListener('touchstart', onTouchStart, getPassiveEventListenerOption());
|
|
19
|
-
element.addEventListener('keydown', onKeyDown, getPassiveEventListenerOption());
|
|
20
|
-
element.addEventListener('blur', onBlur, getPassiveEventListenerOption());
|
|
5
|
+
if (window && window.matchMedia) {
|
|
6
|
+
lastInteractionWasTouch = window.matchMedia('(any-pointer: coarse)').matches;
|
|
21
7
|
}
|
|
22
8
|
|
|
23
9
|
/**
|
|
@@ -60,9 +46,54 @@ export function onKeyDown(event) {
|
|
|
60
46
|
export function onBlur(event) {
|
|
61
47
|
/** @type {HTMLElement} */
|
|
62
48
|
const element = (event.currentTarget);
|
|
49
|
+
const value = element.getAttribute('mdw-overlay-touch');
|
|
50
|
+
if (value == null) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (value === 'true') {
|
|
54
|
+
lastInteractionWasTouch = true;
|
|
55
|
+
} else {
|
|
56
|
+
lastInteractionWasTouch = false;
|
|
57
|
+
}
|
|
63
58
|
element.removeAttribute('mdw-overlay-touch');
|
|
64
59
|
}
|
|
65
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @param {FocusEvent} event
|
|
63
|
+
* @return {void}
|
|
64
|
+
*/
|
|
65
|
+
export function onFocus(event) {
|
|
66
|
+
/** @type {HTMLElement} */
|
|
67
|
+
const element = (event.currentTarget);
|
|
68
|
+
if (!element.hasAttribute('mdw-overlay-touch')) {
|
|
69
|
+
// Element was focused without a mouse or touch event (keyboard or programmatic)
|
|
70
|
+
if (lastInteractionWasTouch) {
|
|
71
|
+
element.setAttribute('mdw-overlay-touch', 'true');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {Element} element
|
|
78
|
+
* @return {void}
|
|
79
|
+
*/
|
|
80
|
+
export function attach(element) {
|
|
81
|
+
element.setAttribute('mdw-overlay-js', '');
|
|
82
|
+
element.addEventListener('mousedown', onMouseDown, getPassiveEventListenerOption());
|
|
83
|
+
element.addEventListener('touchstart', onTouchStart, getPassiveEventListenerOption());
|
|
84
|
+
element.addEventListener('keydown', onKeyDown, getPassiveEventListenerOption());
|
|
85
|
+
element.addEventListener('blur', onBlur, getPassiveEventListenerOption());
|
|
86
|
+
element.addEventListener('focus', onFocus, getPassiveEventListenerOption());
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {Element|Document} [root=document]
|
|
91
|
+
* @return {void}
|
|
92
|
+
*/
|
|
93
|
+
export function attachAll(root = document) {
|
|
94
|
+
iterateArrayLike(root.getElementsByClassName('mdw-overlay'), attach);
|
|
95
|
+
}
|
|
96
|
+
|
|
66
97
|
/**
|
|
67
98
|
* @param {Element} element
|
|
68
99
|
* @return {void}
|
package/core/overlay/index.scss
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@forward './_spec.scss';
|
|
2
|
+
@forward './_theme.scss';
|
package/core/ripple/_spec.scss
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
// https://android.googlesource.com/platform/frameworks/base/+/dbcbca4/graphics/java/android/graphics/drawable/Ripple.java
|
|
2
2
|
|
|
3
|
-
@
|
|
4
|
-
@import "../_platform.scss";
|
|
5
|
-
@import "../_motion.scss";
|
|
3
|
+
@use "sass:math";
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
@use "../_breakpoint.scss" as breakpoint;
|
|
6
|
+
@use "../_platform.scss" as platform;
|
|
7
|
+
@use "../_motion.scss" as motion;
|
|
8
8
|
|
|
9
|
-
$
|
|
10
|
-
|
|
11
|
-
$
|
|
9
|
+
$enterDelay: 80ms !default;
|
|
10
|
+
|
|
11
|
+
$fadeOutDuration: math.div(1000ms, 3.0) !default;
|
|
12
|
+
$touchDownAcceleration: 1024 !default;
|
|
13
|
+
$touchUpAcceleration: 3400 !default;
|
|
12
14
|
|
|
13
15
|
// Ripple starts at 100% opacity
|
|
14
16
|
// Ripple fills linearly
|
|
@@ -16,7 +18,7 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
16
18
|
// Ripple fills on touch up with duration: 1000ms * √(Δradius / (1024 + 3400)
|
|
17
19
|
// Ripple opacity down to 0 on touch-up event with deceleration and duration: 1000ms / 3.0
|
|
18
20
|
|
|
19
|
-
// Use
|
|
21
|
+
// Use motion.$expandDuration temporarily
|
|
20
22
|
|
|
21
23
|
// TODO: Use variable ripple scale durations
|
|
22
24
|
// TODO: Use enter-delay with JS Ripple
|
|
@@ -46,6 +48,7 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
46
48
|
|
|
47
49
|
.mdw-ripple {
|
|
48
50
|
position: relative;
|
|
51
|
+
|
|
49
52
|
-webkit-tap-highlight-color: transparent;
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -75,14 +78,14 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
75
78
|
position: absolute;
|
|
76
79
|
|
|
77
80
|
animation-name: none;
|
|
78
|
-
animation-duration:
|
|
81
|
+
animation-duration: motion.$expandDuration;
|
|
79
82
|
animation-timing-function: linear;
|
|
80
83
|
animation-direction: normal;
|
|
81
84
|
animation-fill-mode: forwards;
|
|
82
85
|
transition-delay: 0s;
|
|
83
|
-
transition-duration:
|
|
86
|
+
transition-duration: motion.$simpleDuration;
|
|
84
87
|
transition-property: background-color, color;
|
|
85
|
-
transition-timing-function:
|
|
88
|
+
transition-timing-function: motion.$standardEasing;
|
|
86
89
|
|
|
87
90
|
opacity: 0.16;
|
|
88
91
|
pointer-events: none;
|
|
@@ -91,13 +94,6 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
91
94
|
background-color: currentColor;
|
|
92
95
|
|
|
93
96
|
border-radius: 50%;
|
|
94
|
-
|
|
95
|
-
&[mdw-fade-in-out] {
|
|
96
|
-
animation-name: ripple-fade-in, ripple-fade-out;
|
|
97
|
-
animation-duration: $mdw-motion__expand-duration, $mdw-ripple__fade-out-duration;
|
|
98
|
-
animation-timing-function: linear, $mdw-motion__decelerate-easing;
|
|
99
|
-
animation-delay: 0ms, $mdw-motion__expand-duration;
|
|
100
|
-
}
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
.mdw-ripple__inner[mdw-fade-in] {
|
|
@@ -111,8 +107,8 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
111
107
|
.mdw-ripple:not(:active) > .mdw-ripple__container > .mdw-ripple__inner[mdw-fade-in-complete][mdw-fade-in],
|
|
112
108
|
.mdw-ripple__inner[mdw-fade-out] {
|
|
113
109
|
animation-name: ripple-fade-out;
|
|
114
|
-
animation-duration: $
|
|
115
|
-
animation-timing-function:
|
|
110
|
+
animation-duration: $fadeOutDuration;
|
|
111
|
+
animation-timing-function: motion.$decelerateEasing;
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
|
|
@@ -142,10 +138,8 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
to {
|
|
145
|
-
|
|
146
|
-
transform: scale(2);
|
|
147
|
-
|
|
148
141
|
opacity: 0;
|
|
142
|
+
transform: scale(2);
|
|
149
143
|
}
|
|
150
144
|
}
|
|
151
145
|
|
|
@@ -164,21 +158,10 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
164
158
|
-webkit-user-select: none;
|
|
165
159
|
user-select: none;
|
|
166
160
|
|
|
167
|
-
transition
|
|
168
|
-
$
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
$mdw-motion__expand-duration + $mdw-ripple__fade-out-duration,
|
|
172
|
-
$mdw-ripple__fade-out-duration;
|
|
173
|
-
transition-property:
|
|
174
|
-
transform,
|
|
175
|
-
background-color;
|
|
176
|
-
transition-timing-function:
|
|
177
|
-
linear,
|
|
178
|
-
$mdw-motion__decelerate-easing;
|
|
179
|
-
will-change:
|
|
180
|
-
transform,
|
|
181
|
-
background-color;
|
|
161
|
+
transition:
|
|
162
|
+
transform #{motion.$expandDuration + $fadeOutDuration} linear $enterDelay,
|
|
163
|
+
background-color $fadeOutDuration motion.$decelerateEasing #{$enterDelay + motion.$expandDuration};
|
|
164
|
+
will-change: transform, background-color;
|
|
182
165
|
|
|
183
166
|
opacity: 0.16;
|
|
184
167
|
pointer-events: none;
|
|
@@ -208,7 +191,7 @@ $mdw-ripple__touch-up-acceleration: 3400 !default;
|
|
|
208
191
|
.mdw-ripple[aria-disabled="true"] {
|
|
209
192
|
& > .mdw-ripple__container,
|
|
210
193
|
&::after {
|
|
211
|
-
|
|
194
|
+
visibility: hidden;
|
|
212
195
|
}
|
|
213
196
|
}
|
|
214
197
|
|
package/core/ripple/_theme.scss
CHANGED
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
// https://material.io/design/components/buttons.html
|
|
3
3
|
// https://material.io/design/iconography/system-icons.html#color
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@use '../theme/_mixins.scss' as theme;
|
|
6
6
|
|
|
7
|
-
$
|
|
7
|
+
$themeValues: (
|
|
8
8
|
overlay-color: (('foreground-light', 1.00), ('foreground-dark', 1.00)),
|
|
9
9
|
pressed-opacity: (0.16, 0.32),
|
|
10
10
|
) !default;
|
|
11
11
|
|
|
12
|
-
@function
|
|
13
|
-
@return
|
|
12
|
+
@function getThemeValue($key, $type) {
|
|
13
|
+
@return theme.getThemeValue('ripple', $themeValues, $key, $type);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
@mixin
|
|
16
|
+
@mixin addThemeRules($type: 'var') {
|
|
17
17
|
.mdw-ripple {
|
|
18
18
|
& > .mdw-ripple__container > .mdw-ripple__inner,
|
|
19
19
|
&::after {
|
|
20
|
-
opacity:
|
|
20
|
+
opacity: getThemeValue("pressed-opacity", $type);
|
|
21
21
|
color: inherit;
|
|
22
22
|
@if ($type == 'var') {
|
|
23
23
|
// Fallback handed by previous inherit rule
|
|
24
|
-
color: RGB(var(--ink
|
|
24
|
+
color: RGB(var(--mdw-ink));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
@include
|
|
32
|
-
@include
|
|
31
|
+
@include theme.addComponentFallbackRules('light') {
|
|
32
|
+
@include addThemeRules('light');
|
|
33
33
|
}
|
|
34
|
-
@include
|
|
35
|
-
@include
|
|
34
|
+
@include theme.addComponentFallbackRules('dark') {
|
|
35
|
+
@include addThemeRules('dark');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
@include
|
|
39
|
-
@include
|
|
38
|
+
@include theme.addComponentCSSVariableRules('ripple', $themeValues) {
|
|
39
|
+
@include addThemeRules();
|
|
40
40
|
}
|