@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,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
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Element} element
|
|
3
|
+
* @param {string} className
|
|
4
|
+
* @return {Element}
|
|
5
|
+
*/
|
|
6
|
+
export function getChildElementByClass(element, className) {
|
|
7
|
+
const child = element.getElementsByClassName(className)[0];
|
|
8
|
+
if (child && child.parentElement !== element) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return child;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** @return {boolean} */
|
|
15
|
+
export function isRtl() {
|
|
16
|
+
return document.documentElement.dir === 'rtl';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {EventTarget} eventTarget
|
|
21
|
+
* @param {string} type
|
|
22
|
+
* @param {Object} [detail]
|
|
23
|
+
* @return {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export function dispatchDomEvent(eventTarget, type, detail) {
|
|
26
|
+
let event;
|
|
27
|
+
if (typeof CustomEvent === 'function') {
|
|
28
|
+
event = new CustomEvent(type, {
|
|
29
|
+
bubbles: true,
|
|
30
|
+
cancelable: true,
|
|
31
|
+
detail,
|
|
32
|
+
});
|
|
33
|
+
} else if (detail == null) {
|
|
34
|
+
if (typeof Event === 'function') {
|
|
35
|
+
event = new Event(type, {
|
|
36
|
+
bubbles: true,
|
|
37
|
+
cancelable: true,
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
event = document.createEvent('Event');
|
|
41
|
+
event.initEvent(type, true, true);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
event = document.createEvent('CustomEvent');
|
|
45
|
+
event.initCustomEvent(type, true, true, detail);
|
|
46
|
+
}
|
|
47
|
+
return eventTarget.dispatchEvent(event);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Element} element
|
|
52
|
+
* @param {function(Element, number):boolean|void} fn
|
|
53
|
+
* @return {boolean}
|
|
54
|
+
*/
|
|
55
|
+
export function iterateElementSiblings(element, fn) {
|
|
56
|
+
let distance = -1;
|
|
57
|
+
let sibling = element.previousElementSibling;
|
|
58
|
+
while (sibling) {
|
|
59
|
+
fn(sibling, distance);
|
|
60
|
+
sibling = sibling.previousElementSibling;
|
|
61
|
+
distance -= 1;
|
|
62
|
+
}
|
|
63
|
+
sibling = element.nextElementSibling;
|
|
64
|
+
distance = 1;
|
|
65
|
+
while (sibling) {
|
|
66
|
+
fn(sibling, distance);
|
|
67
|
+
sibling = sibling.nextElementSibling;
|
|
68
|
+
distance += 1;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {Element} element
|
|
75
|
+
* @param {function(Element, number):boolean|void} fn
|
|
76
|
+
* @return {boolean}
|
|
77
|
+
*/
|
|
78
|
+
export function iterateSomeOfElementSiblings(element, fn) {
|
|
79
|
+
let distance = -1;
|
|
80
|
+
let sibling = element.previousElementSibling;
|
|
81
|
+
while (sibling) {
|
|
82
|
+
if (fn(sibling, distance)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
sibling = sibling.previousElementSibling;
|
|
86
|
+
distance -= 1;
|
|
87
|
+
}
|
|
88
|
+
sibling = element.nextElementSibling;
|
|
89
|
+
distance = 1;
|
|
90
|
+
while (sibling) {
|
|
91
|
+
if (fn(sibling, distance)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
sibling = sibling.previousElementSibling;
|
|
95
|
+
distance += 1;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {Node} node
|
|
102
|
+
* @param {boolean} [create]
|
|
103
|
+
* @return {?Text}
|
|
104
|
+
*/
|
|
105
|
+
export function getTextNode(node, create) {
|
|
106
|
+
for (const childNode of node.childNodes) {
|
|
107
|
+
if (childNode.nodeType === Node.TEXT_NODE) {
|
|
108
|
+
return /** @type {Text} */ (childNode);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!create) return null;
|
|
112
|
+
return node.appendChild(document.createTextNode(''));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @param {Node} node
|
|
117
|
+
* @param {string} value
|
|
118
|
+
* @return {?Text}
|
|
119
|
+
*/
|
|
120
|
+
export function setTextNode(node, value) {
|
|
121
|
+
for (const childNode of node.childNodes) {
|
|
122
|
+
if (childNode.nodeType === Node.TEXT_NODE) {
|
|
123
|
+
if (value) {
|
|
124
|
+
childNode.nodeValue = value;
|
|
125
|
+
} else {
|
|
126
|
+
node.removeChild(childNode);
|
|
127
|
+
}
|
|
128
|
+
return /** @type {Text} */ (childNode);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!value) return null;
|
|
132
|
+
return node.appendChild(document.createTextNode(value));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {HTMLElement} element
|
|
137
|
+
* @param {boolean} [smooth=false]
|
|
138
|
+
* @param {boolean} [rtl=false]
|
|
139
|
+
* @return {void}
|
|
140
|
+
*/
|
|
141
|
+
export function scrollToElement(element, smooth, rtl) {
|
|
142
|
+
if (!element) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const parent = element.parentElement;
|
|
146
|
+
if (!parent) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let targetScrollLeft = rtl
|
|
151
|
+
? parent.scrollWidth + element.offsetLeft - element.offsetWidth
|
|
152
|
+
: element.offsetLeft;
|
|
153
|
+
|
|
154
|
+
const elementRect = element.getBoundingClientRect();
|
|
155
|
+
const parentRect = parent.getBoundingClientRect();
|
|
156
|
+
let subPixelScrollPosition = elementRect.left - parentRect.left;
|
|
157
|
+
if (subPixelScrollPosition < 0) {
|
|
158
|
+
subPixelScrollPosition = 0;
|
|
159
|
+
}
|
|
160
|
+
if (Math.abs(subPixelScrollPosition - targetScrollLeft) < 2) {
|
|
161
|
+
targetScrollLeft = subPixelScrollPosition;
|
|
162
|
+
}
|
|
163
|
+
if (parent.scrollLeft === targetScrollLeft) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (parent.scrollTo) {
|
|
168
|
+
parent.scrollTo({
|
|
169
|
+
top: 0,
|
|
170
|
+
left: targetScrollLeft,
|
|
171
|
+
behavior: smooth ? 'smooth' : 'auto',
|
|
172
|
+
});
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
parent.style.setProperty('scroll-behavior', 'auto');
|
|
176
|
+
parent.scrollLeft = targetScrollLeft;
|
|
177
|
+
requestAnimationFrame(() => {
|
|
178
|
+
parent.style.removeProperty('scroll-behavior');
|
|
179
|
+
});
|
|
180
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.mdw-overlay {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
outline: none;
|
|
5
|
+
-webkit-tap-highlight-color: transparent;
|
|
6
|
+
// Remove Firefox inner
|
|
7
|
+
&::-moz-focus-inner {
|
|
8
|
+
border: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&::before {
|
|
12
|
+
content: '';
|
|
13
|
+
|
|
14
|
+
position: absolute;
|
|
15
|
+
inset: 0;
|
|
16
|
+
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
|
|
19
|
+
transition-delay: 1ms;
|
|
20
|
+
transition-duration: 0ms;
|
|
21
|
+
transition-property: opacity, color, background-color;
|
|
22
|
+
|
|
23
|
+
/* opacity handled by theme engine */
|
|
24
|
+
|
|
25
|
+
background-color: currentColor;
|
|
26
|
+
border-radius: inherit;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// https://material.io/design/interaction/states.html
|
|
2
|
+
|
|
3
|
+
.mdw-theme {
|
|
4
|
+
--mdw-overlay__overlay-rgb: var(--mdw-ink-default);
|
|
5
|
+
--mdw-overlay__high-opacity: var(--mdw-high-opacity);
|
|
6
|
+
--mdw-overlay__medium-opacity: var(--mdw-medium-opacity);
|
|
7
|
+
--mdw-overlay__inactive-opacity: var(--mdw-inactive-opacity);
|
|
8
|
+
--mdw-overlay__divider-opacity: var(--mdw-divider-opacity);
|
|
9
|
+
--mdw-overlay__base-opacity: var(--mdw-overlay__base-opacity-value);
|
|
10
|
+
--mdw-overlay__disabled-opacity: var(--mdw-overlay__disabled-opacity-value);
|
|
11
|
+
--mdw-overlay__hover-opacity: var(--mdw-overlay__hover-opacity-value);
|
|
12
|
+
--mdw-overlay__focus-opacity: var(--mdw-overlay__focus-opacity-value);
|
|
13
|
+
--mdw-overlay__selected-opacity: var(--mdw-overlay__selected-opacity-value);
|
|
14
|
+
--mdw-overlay__activated-opacity: var(--mdw-overlay__activated-opacity-value);
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.mdw-theme[mdw-light] {
|
|
19
|
+
--mdw-overlay__base-opacity-value: 0;
|
|
20
|
+
--mdw-overlay__base-opacity-elevation_1: 0;
|
|
21
|
+
--mdw-overlay__base-opacity-elevation_2: 0;
|
|
22
|
+
--mdw-overlay__base-opacity-elevation_3: 0;
|
|
23
|
+
--mdw-overlay__base-opacity-elevation_4: 0;
|
|
24
|
+
--mdw-overlay__base-opacity-elevation_6: 0;
|
|
25
|
+
--mdw-overlay__base-opacity-elevation_8: 0;
|
|
26
|
+
--mdw-overlay__base-opacity-elevation_9: 0;
|
|
27
|
+
--mdw-overlay__base-opacity-elevation_12: 0;
|
|
28
|
+
--mdw-overlay__base-opacity-elevation_16: 0;
|
|
29
|
+
--mdw-overlay__base-opacity-elevation_24: 0;
|
|
30
|
+
--mdw-overlay__disabled-opacity-value: 0.38;
|
|
31
|
+
--mdw-overlay__hover-opacity-value: 0.04;
|
|
32
|
+
--mdw-overlay__focus-opacity-value: 0.12;
|
|
33
|
+
--mdw-overlay__selected-opacity-value: 0.08;
|
|
34
|
+
--mdw-overlay__activated-opacity-value: 0.12;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.mdw-theme[mdw-dark] {
|
|
38
|
+
--mdw-overlay__base-opacity-value: 0;
|
|
39
|
+
--mdw-overlay__base-opacity-elevation_1: 0.05;
|
|
40
|
+
--mdw-overlay__base-opacity-elevation_2: 0.07;
|
|
41
|
+
--mdw-overlay__base-opacity-elevation_3: 0.08;
|
|
42
|
+
--mdw-overlay__base-opacity-elevation_4: 0.09;
|
|
43
|
+
--mdw-overlay__base-opacity-elevation_6: 0.11;
|
|
44
|
+
--mdw-overlay__base-opacity-elevation_8: 0.12;
|
|
45
|
+
--mdw-overlay__base-opacity-elevation_9: 0.13;
|
|
46
|
+
--mdw-overlay__base-opacity-elevation_12: 0.14;
|
|
47
|
+
--mdw-overlay__base-opacity-elevation_16: 0.15;
|
|
48
|
+
--mdw-overlay__base-opacity-elevation_24: 0.16;
|
|
49
|
+
--mdw-overlay__disabled-opacity-value: 0.50;
|
|
50
|
+
--mdw-overlay__hover-opacity-value: 0.08;
|
|
51
|
+
--mdw-overlay__focus-opacity-value: 0.24;
|
|
52
|
+
--mdw-overlay__selected-opacity-value: 0.16;
|
|
53
|
+
--mdw-overlay__activated-opacity-value: 0.24;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.mdw-overlay {
|
|
57
|
+
// Disable Hover State
|
|
58
|
+
&[aria-disabled="true"],
|
|
59
|
+
&[mdw-overlay-touch="true"],
|
|
60
|
+
&[mdw-overlay-off~="hover"],
|
|
61
|
+
&:not(:hover) {
|
|
62
|
+
--mdw-overlay__hover-opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Disable Focus State
|
|
66
|
+
&[aria-disabled="true"],
|
|
67
|
+
&[mdw-overlay-touch="true"],
|
|
68
|
+
&[mdw-overlay-off~="focus"],
|
|
69
|
+
&:not(:focus) {
|
|
70
|
+
--mdw-overlay__focus-opacity: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Disable Selected State
|
|
74
|
+
// Activated overrides Selected
|
|
75
|
+
&[mdw-overlay-off~="selected"],
|
|
76
|
+
&:not([aria-selected="true"]),
|
|
77
|
+
&[aria-current],
|
|
78
|
+
&[aria-pressed="true"] {
|
|
79
|
+
--mdw-overlay__selected-opacity: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&[mdw-overlay-off~="activated"],
|
|
83
|
+
&:not([aria-current]):not([aria-pressed="true"]) {
|
|
84
|
+
--mdw-overlay__activated-opacity: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&::before {
|
|
88
|
+
opacity: calc(var(--mdw-overlay__base-opacity) + var(--mdw-overlay__hover-opacity) + var(--mdw-overlay__focus-opacity) + var(--mdw-overlay__selected-opacity) + var(--mdw-overlay__activated-opacity));
|
|
89
|
+
|
|
90
|
+
color: RGB(var(--mdw-overlay__overlay-rgb));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:hover,
|
|
94
|
+
&:focus,
|
|
95
|
+
&[aria-pressed="false"]:active,
|
|
96
|
+
&[aria-selected="true"],
|
|
97
|
+
&[aria-pressed="true"],
|
|
98
|
+
&[aria-current] {
|
|
99
|
+
&::before {
|
|
100
|
+
color: RGB(var(--mdw-ink));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&[aria-selected="false"],
|
|
105
|
+
&[aria-pressed="false"],
|
|
106
|
+
&[aria-disabled="true"],
|
|
107
|
+
&[aria-disabled="true"]:active {
|
|
108
|
+
&::before {
|
|
109
|
+
color: RGB(var(--mdw-overlay__overlay-rgb));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Off color
|
|
114
|
+
&[aria-selected="false"],
|
|
115
|
+
&[aria-pressed="false"],
|
|
116
|
+
&[aria-selected="true"]:not([aria-current]) {
|
|
117
|
+
--mdw-overlay__text-opacity: var(--mdw-overlay__high-opacity);
|
|
118
|
+
|
|
119
|
+
color: RGBA(var(--mdw-overlay__overlay-rgb), var(--mdw-overlay__text-opacity));
|
|
120
|
+
|
|
121
|
+
&[mdw-overlay-default="medium"] {
|
|
122
|
+
--mdw-overlay__text-opacity: var(--mdw-overlay__medium-opacity);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&[mdw-overlay-default="inactive"] {
|
|
126
|
+
--mdw-overlay__text-opacity: var(--mdw-overlay__inactive-opacity);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&[mdw-overlay-default="divider"] {
|
|
130
|
+
--mdw-overlay__text-opacity: var(--mdw-overlay__divider-opacity);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&[mdw-border-ink] {
|
|
134
|
+
border-color: RGBA(var(--mdw-overlay__overlay-rgb), var(--mdw-overlay__divider-opacity));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&[aria-disabled="true"] {
|
|
139
|
+
&[mdw-overlay-disabled="ink"] {
|
|
140
|
+
color: RGBA(var(--mdw-overlay__overlay-rgb), var(--mdw-overlay__inactive-opacity));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:not([mdw-overlay-disabled]) {
|
|
144
|
+
opacity: var(--mdw-overlay__disabled-opacity);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
let lastInteractionWasTouch = false;
|
|
2
|
+
|
|
3
|
+
if (window && window.matchMedia) {
|
|
4
|
+
lastInteractionWasTouch = window.matchMedia('(any-pointer: coarse)').matches;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {PointerEvent|MouseEvent} event
|
|
9
|
+
* @return {void}
|
|
10
|
+
*/
|
|
11
|
+
export function onMouseDown(event) {
|
|
12
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
13
|
+
if (element.hasAttribute('mdw-overlay-touch')) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
element.setAttribute('mdw-overlay-touch', 'false');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TouchEvent} event
|
|
21
|
+
* @return {void}
|
|
22
|
+
*/
|
|
23
|
+
export function onTouchStart(event) {
|
|
24
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
25
|
+
element.setAttribute('mdw-overlay-touch', 'true');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {TouchEvent} event
|
|
30
|
+
* @return {void}
|
|
31
|
+
*/
|
|
32
|
+
export function onKeyDown(event) {
|
|
33
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
34
|
+
element.setAttribute('mdw-overlay-touch', 'false');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {FocusEvent} event
|
|
39
|
+
* @return {void}
|
|
40
|
+
*/
|
|
41
|
+
export function onBlur(event) {
|
|
42
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
43
|
+
const value = element.getAttribute('mdw-overlay-touch');
|
|
44
|
+
if (value == null) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
lastInteractionWasTouch = value === 'true';
|
|
48
|
+
element.removeAttribute('mdw-overlay-touch');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {FocusEvent} event
|
|
53
|
+
* @return {void}
|
|
54
|
+
*/
|
|
55
|
+
export function onFocus(event) {
|
|
56
|
+
const element = /** @type {HTMLElement} */ (event.currentTarget);
|
|
57
|
+
// Element was focused without a mouse or touch event (keyboard or programmatic)
|
|
58
|
+
if (!element.hasAttribute('mdw-overlay-touch') && lastInteractionWasTouch) {
|
|
59
|
+
element.setAttribute('mdw-overlay-touch', 'true');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @param {Element} element
|
|
65
|
+
* @return {void}
|
|
66
|
+
*/
|
|
67
|
+
export function attach(element) {
|
|
68
|
+
element.setAttribute('mdw-overlay-js', '');
|
|
69
|
+
element.addEventListener('mousedown', onMouseDown, { passive: true });
|
|
70
|
+
element.addEventListener('touchstart', onTouchStart, { passive: true });
|
|
71
|
+
element.addEventListener('keydown', onKeyDown, { passive: true });
|
|
72
|
+
element.addEventListener('blur', onBlur, { passive: true });
|
|
73
|
+
element.addEventListener('focus', onFocus, { passive: true });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {Element|Document} [root=document]
|
|
78
|
+
* @return {void}
|
|
79
|
+
*/
|
|
80
|
+
export function attachAll(root = document) {
|
|
81
|
+
for (const el of root.getElementsByClassName('mdw-overlay')) attach(el);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {Element} element
|
|
86
|
+
* @return {void}
|
|
87
|
+
*/
|
|
88
|
+
export function detach(element) {
|
|
89
|
+
element.removeAttribute('mdw-overlay-js');
|
|
90
|
+
element.removeAttribute('mdw-overlay-touch');
|
|
91
|
+
element.removeEventListener('mousedown', onMouseDown);
|
|
92
|
+
element.removeEventListener('touchstart', onTouchStart);
|
|
93
|
+
element.removeEventListener('keydown', onKeyDown);
|
|
94
|
+
element.removeEventListener('blur', onBlur);
|
|
95
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// https://android.googlesource.com/platform/frameworks/base/+/dbcbca4/graphics/java/android/graphics/drawable/Ripple.java
|
|
2
|
+
|
|
3
|
+
@use "sass:math";
|
|
4
|
+
|
|
5
|
+
@use "../_breakpoint.scss" as breakpoint;
|
|
6
|
+
@use "../_platform.scss" as platform;
|
|
7
|
+
@use "../_motion.scss" as motion;
|
|
8
|
+
|
|
9
|
+
$enterDelay: 80ms !default;
|
|
10
|
+
|
|
11
|
+
$fadeOutDuration: math.div(1000ms, 3.0) !default;
|
|
12
|
+
$touchDownAcceleration: 1024 !default;
|
|
13
|
+
$touchUpAcceleration: 3400 !default;
|
|
14
|
+
|
|
15
|
+
// Ripple starts at 100% opacity
|
|
16
|
+
// Ripple fills linearly
|
|
17
|
+
// Ripple fills on touch down with duration: 1000ms * √(radius / 1024)
|
|
18
|
+
// Ripple fills on touch up with duration: 1000ms * √(Δradius / (1024 + 3400)
|
|
19
|
+
// Ripple opacity down to 0 on touch-up event with deceleration and duration: 1000ms / 3.0
|
|
20
|
+
|
|
21
|
+
// Use motion.$expandDuration temporarily
|
|
22
|
+
|
|
23
|
+
// TODO: Use variable ripple scale durations
|
|
24
|
+
// TODO: Use enter-delay with JS Ripple
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* --Issues rendering a circle inside an element--
|
|
28
|
+
* See: https://codepen.io/shortfuse/pen/VxYxYj
|
|
29
|
+
*
|
|
30
|
+
* When using block display:
|
|
31
|
+
* - Firefox incorrectly stretches ripple when inside flexbox
|
|
32
|
+
* - Safari incorrectly inherit parent's padding
|
|
33
|
+
*
|
|
34
|
+
* Using using table display:
|
|
35
|
+
* - Firefox renders correctly
|
|
36
|
+
* - Safari renders correctly
|
|
37
|
+
* - IE and Edge don't animate opacity correctly
|
|
38
|
+
* - Ripples don't show if inside actual table
|
|
39
|
+
*
|
|
40
|
+
* When using JS (wrapped with block element):
|
|
41
|
+
* - Firefox renders correctly
|
|
42
|
+
* - Safari renders correctly
|
|
43
|
+
* - IE and Edge renders correctly but still has forced 0.26 opacity
|
|
44
|
+
*
|
|
45
|
+
* Chrome works fine under all conditions
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
.mdw-ripple {
|
|
50
|
+
position: relative;
|
|
51
|
+
|
|
52
|
+
-webkit-tap-highlight-color: transparent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.mdw-ripple:not([mdw-ripple-js]) {
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
// Do not override any declarations
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.mdw-ripple__container {
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset: 0;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
|
|
69
|
+
z-index: 1;
|
|
70
|
+
|
|
71
|
+
border-radius: inherit;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.mdw-ripple__inner {
|
|
75
|
+
display: block;
|
|
76
|
+
position: absolute;
|
|
77
|
+
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
|
|
80
|
+
animation-name: none;
|
|
81
|
+
animation-duration: motion.$expandDuration;
|
|
82
|
+
animation-timing-function: linear;
|
|
83
|
+
animation-direction: normal;
|
|
84
|
+
animation-fill-mode: forwards;
|
|
85
|
+
transition-delay: 0s;
|
|
86
|
+
transition-duration: motion.$simpleDuration;
|
|
87
|
+
transition-property: background-color, color;
|
|
88
|
+
transition-timing-function: motion.$standardEasing;
|
|
89
|
+
|
|
90
|
+
opacity: 0.16;
|
|
91
|
+
transform: scale(0);
|
|
92
|
+
|
|
93
|
+
background-color: currentColor;
|
|
94
|
+
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.mdw-ripple__inner[mdw-fade-in] {
|
|
99
|
+
animation-name: ripple-fade-in;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.mdw-ripple__inner[mdw-fade-in-repeat] {
|
|
103
|
+
animation-name: ripple-fade-in-repeat;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.mdw-ripple:not(:active) > .mdw-ripple__container > .mdw-ripple__inner[mdw-fade-in-complete][mdw-fade-in],
|
|
107
|
+
.mdw-ripple__inner[mdw-fade-out] {
|
|
108
|
+
animation-name: ripple-fade-out;
|
|
109
|
+
animation-duration: $fadeOutDuration;
|
|
110
|
+
animation-timing-function: motion.$decelerateEasing;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@keyframes ripple-fade-in {
|
|
114
|
+
from {
|
|
115
|
+
transform: scale(0);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
to {
|
|
119
|
+
transform: scale(2);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@keyframes ripple-fade-in-repeat {
|
|
124
|
+
from {
|
|
125
|
+
transform: scale(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
to {
|
|
129
|
+
transform: scale(2);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@keyframes ripple-fade-out {
|
|
134
|
+
from {
|
|
135
|
+
transform: scale(2);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
to {
|
|
139
|
+
opacity: 0;
|
|
140
|
+
transform: scale(2);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.mdw-ripple::after {
|
|
145
|
+
content: '';
|
|
146
|
+
|
|
147
|
+
display: table; // See above
|
|
148
|
+
position: absolute;
|
|
149
|
+
inset-block-start: 50%;
|
|
150
|
+
inset-inline-start: 50%;
|
|
151
|
+
|
|
152
|
+
block-size: 0;
|
|
153
|
+
inline-size: 0;
|
|
154
|
+
padding: 50%;
|
|
155
|
+
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
// z-index: -1; // Safari has a negative z-index scrolling bug (hides elements)
|
|
158
|
+
-moz-user-select: none;
|
|
159
|
+
-ms-user-select: none;
|
|
160
|
+
-webkit-user-select: none;
|
|
161
|
+
user-select: none;
|
|
162
|
+
|
|
163
|
+
transition:
|
|
164
|
+
transform #{motion.$expandDuration + $fadeOutDuration} linear $enterDelay,
|
|
165
|
+
background-color $fadeOutDuration motion.$decelerateEasing #{$enterDelay + motion.$expandDuration};
|
|
166
|
+
will-change: transform, background-color;
|
|
167
|
+
|
|
168
|
+
opacity: 0.16;
|
|
169
|
+
transform: translateX(-50%) translateY(-50%) scale(2);
|
|
170
|
+
|
|
171
|
+
background-color: transparent;
|
|
172
|
+
border-radius: 50%;
|
|
173
|
+
color: inherit;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// On active, pop up initial state
|
|
177
|
+
.mdw-ripple:active::after {
|
|
178
|
+
transition-delay: 0s;
|
|
179
|
+
transition-duration: 0s;
|
|
180
|
+
|
|
181
|
+
transform: translateX(-50%) translateY(-50%) scale(0);
|
|
182
|
+
|
|
183
|
+
background-color: currentColor;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.mdw-ripple[mdw-ripple-js]::after {
|
|
187
|
+
display: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.mdw-ripple[disabled],
|
|
191
|
+
.mdw-ripple[aria-disabled="true"] {
|
|
192
|
+
& > .mdw-ripple__container,
|
|
193
|
+
&::after {
|
|
194
|
+
visibility: hidden;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* https://material.io/design/interaction/states.html */
|
|
2
|
+
/* https://material.io/design/components/buttons.html */
|
|
3
|
+
/* https://material.io/design/iconography/system-icons.html#color */
|
|
4
|
+
|
|
5
|
+
.mdw-theme[mdw-light] {
|
|
6
|
+
--mdw-ripple__pressed-opacity: 0.16;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.mdw-theme[mdw-dark] {
|
|
10
|
+
--mdw-ripple__pressed-opacity: 0.32;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.mdw-ripple {
|
|
14
|
+
& > .mdw-ripple__container > .mdw-ripple__inner,
|
|
15
|
+
&::after {
|
|
16
|
+
opacity: var(--mdw-ripple__pressed-opacity);
|
|
17
|
+
|
|
18
|
+
color: RGB(var(--mdw-ink));
|
|
19
|
+
}
|
|
20
|
+
}
|