mdui 1.0.2 → 2.0.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/LICENSE +1 -1
- package/README.md +49 -70
- package/components/avatar/index.d.ts +49 -0
- package/components/avatar/index.js +55 -0
- package/components/avatar/style.d.ts +1 -0
- package/components/avatar/style.js +2 -0
- package/components/avatar.d.ts +1 -0
- package/components/avatar.js +1 -0
- package/components/badge/index.d.ts +28 -0
- package/components/badge/index.js +41 -0
- package/components/badge/style.d.ts +1 -0
- package/components/badge/style.js +2 -0
- package/components/badge.d.ts +1 -0
- package/components/badge.js +1 -0
- package/components/bottom-app-bar/index.d.ts +60 -0
- package/components/bottom-app-bar/index.js +105 -0
- package/components/bottom-app-bar/style.d.ts +1 -0
- package/components/bottom-app-bar/style.js +2 -0
- package/components/bottom-app-bar.d.ts +1 -0
- package/components/bottom-app-bar.js +1 -0
- package/components/button/button-base-style.d.ts +1 -0
- package/components/button/button-base-style.js +2 -0
- package/components/button/button-base.d.ts +138 -0
- package/components/button/button-base.js +206 -0
- package/components/button/index.d.ts +64 -0
- package/components/button/index.js +110 -0
- package/components/button/style.d.ts +1 -0
- package/components/button/style.js +4 -0
- package/components/button-icon/index.d.ts +66 -0
- package/components/button-icon/index.js +129 -0
- package/components/button-icon/style.d.ts +1 -0
- package/components/button-icon/style.js +4 -0
- package/components/button-icon.d.ts +1 -0
- package/components/button-icon.js +1 -0
- package/components/button.d.ts +1 -0
- package/components/button.js +1 -0
- package/components/card/index.d.ts +49 -0
- package/components/card/index.js +87 -0
- package/components/card/style.d.ts +1 -0
- package/components/card/style.js +2 -0
- package/components/card.d.ts +1 -0
- package/components/card.js +1 -0
- package/components/checkbox/index.d.ts +130 -0
- package/components/checkbox/index.js +257 -0
- package/components/checkbox/style.d.ts +1 -0
- package/components/checkbox/style.js +2 -0
- package/components/checkbox.d.ts +1 -0
- package/components/checkbox.js +1 -0
- package/components/chip/index.d.ts +102 -0
- package/components/chip/index.js +243 -0
- package/components/chip/style.d.ts +1 -0
- package/components/chip/style.js +4 -0
- package/components/chip.d.ts +1 -0
- package/components/chip.js +1 -0
- package/components/circular-progress/index.d.ts +28 -0
- package/components/circular-progress/index.js +61 -0
- package/components/circular-progress/style.d.ts +1 -0
- package/components/circular-progress/style.js +2 -0
- package/components/circular-progress.d.ts +1 -0
- package/components/circular-progress.js +1 -0
- package/components/collapse/collapse-item-style.d.ts +1 -0
- package/components/collapse/collapse-item-style.js +2 -0
- package/components/collapse/collapse-item.d.ts +56 -0
- package/components/collapse/collapse-item.js +126 -0
- package/components/collapse/collapse-style.d.ts +1 -0
- package/components/collapse/collapse-style.js +2 -0
- package/components/collapse/collapse.d.ts +49 -0
- package/components/collapse/collapse.js +175 -0
- package/components/collapse-item.d.ts +1 -0
- package/components/collapse-item.js +1 -0
- package/components/collapse.d.ts +1 -0
- package/components/collapse.js +1 -0
- package/components/dialog/index.d.ts +99 -0
- package/components/dialog/index.js +307 -0
- package/components/dialog/style.d.ts +1 -0
- package/components/dialog/style.js +2 -0
- package/components/dialog.d.ts +1 -0
- package/components/dialog.js +1 -0
- package/components/divider/index.d.ts +30 -0
- package/components/divider/index.js +58 -0
- package/components/divider/style.d.ts +1 -0
- package/components/divider/style.js +2 -0
- package/components/divider.d.ts +1 -0
- package/components/divider.js +1 -0
- package/components/dropdown/index.d.ts +131 -0
- package/components/dropdown/index.js +571 -0
- package/components/dropdown/style.d.ts +1 -0
- package/components/dropdown/style.js +2 -0
- package/components/dropdown.d.ts +1 -0
- package/components/dropdown.js +1 -0
- package/components/fab/index.d.ts +70 -0
- package/components/fab/index.js +144 -0
- package/components/fab/style.d.ts +1 -0
- package/components/fab/style.js +8 -0
- package/components/fab.d.ts +1 -0
- package/components/fab.js +1 -0
- package/components/icon/index.d.ts +29 -0
- package/components/icon/index.js +57 -0
- package/components/icon/style.d.ts +1 -0
- package/components/icon/style.js +2 -0
- package/components/icon.d.ts +1 -0
- package/components/icon.js +1 -0
- package/components/layout/helper.d.ts +67 -0
- package/components/layout/helper.js +212 -0
- package/components/layout/layout-item-base.d.ts +17 -0
- package/components/layout/layout-item-base.js +45 -0
- package/components/layout/layout-item-style.d.ts +1 -0
- package/components/layout/layout-item-style.js +2 -0
- package/components/layout/layout-item.d.ts +37 -0
- package/components/layout/layout-item.js +58 -0
- package/components/layout/layout-main-style.d.ts +1 -0
- package/components/layout/layout-main-style.js +2 -0
- package/components/layout/layout-main.d.ts +27 -0
- package/components/layout/layout-main.js +46 -0
- package/components/layout/layout-style.d.ts +1 -0
- package/components/layout/layout-style.js +2 -0
- package/components/layout/layout.d.ts +28 -0
- package/components/layout/layout.js +43 -0
- package/components/layout-item.d.ts +1 -0
- package/components/layout-item.js +1 -0
- package/components/layout-main.d.ts +1 -0
- package/components/layout-main.js +1 -0
- package/components/layout.d.ts +1 -0
- package/components/layout.js +1 -0
- package/components/linear-progress/index.d.ts +30 -0
- package/components/linear-progress/index.js +48 -0
- package/components/linear-progress/style.d.ts +1 -0
- package/components/linear-progress/style.js +2 -0
- package/components/linear-progress.d.ts +1 -0
- package/components/linear-progress.js +1 -0
- package/components/list/list-item-style.d.ts +1 -0
- package/components/list/list-item-style.js +4 -0
- package/components/list/list-item.d.ts +111 -0
- package/components/list/list-item.js +186 -0
- package/components/list/list-style.d.ts +1 -0
- package/components/list/list-style.js +2 -0
- package/components/list/list-subheader-style.d.ts +1 -0
- package/components/list/list-subheader-style.js +2 -0
- package/components/list/list-subheader.d.ts +24 -0
- package/components/list/list-subheader.js +30 -0
- package/components/list/list.d.ts +24 -0
- package/components/list/list.js +27 -0
- package/components/list-item.d.ts +1 -0
- package/components/list-item.js +1 -0
- package/components/list-subheader.d.ts +1 -0
- package/components/list-subheader.js +1 -0
- package/components/list.d.ts +1 -0
- package/components/list.js +1 -0
- package/components/menu/menu-item-style.d.ts +1 -0
- package/components/menu/menu-item-style.js +2 -0
- package/components/menu/menu-item.d.ts +123 -0
- package/components/menu/menu-item.js +412 -0
- package/components/menu/menu-style.d.ts +1 -0
- package/components/menu/menu-style.js +2 -0
- package/components/menu/menu.d.ts +111 -0
- package/components/menu/menu.js +425 -0
- package/components/menu-item.d.ts +1 -0
- package/components/menu-item.js +1 -0
- package/components/menu.d.ts +1 -0
- package/components/menu.js +1 -0
- package/components/navigation-bar/navigation-bar-item-style.d.ts +1 -0
- package/components/navigation-bar/navigation-bar-item-style.js +2 -0
- package/components/navigation-bar/navigation-bar-item.d.ts +72 -0
- package/components/navigation-bar/navigation-bar-item.js +120 -0
- package/components/navigation-bar/navigation-bar-style.d.ts +1 -0
- package/components/navigation-bar/navigation-bar-style.js +2 -0
- package/components/navigation-bar/navigation-bar.d.ts +78 -0
- package/components/navigation-bar/navigation-bar.js +180 -0
- package/components/navigation-bar-item.d.ts +1 -0
- package/components/navigation-bar-item.js +1 -0
- package/components/navigation-bar.d.ts +1 -0
- package/components/navigation-bar.js +1 -0
- package/components/navigation-drawer/index.d.ts +84 -0
- package/components/navigation-drawer/index.js +365 -0
- package/components/navigation-drawer/style.d.ts +1 -0
- package/components/navigation-drawer/style.js +2 -0
- package/components/navigation-drawer.d.ts +1 -0
- package/components/navigation-drawer.js +1 -0
- package/components/navigation-rail/navigation-rail-item-style.d.ts +1 -0
- package/components/navigation-rail/navigation-rail-item-style.js +2 -0
- package/components/navigation-rail/navigation-rail-item.d.ts +72 -0
- package/components/navigation-rail/navigation-rail-item.js +128 -0
- package/components/navigation-rail/navigation-rail-style.d.ts +1 -0
- package/components/navigation-rail/navigation-rail-style.js +2 -0
- package/components/navigation-rail/navigation-rail.d.ts +87 -0
- package/components/navigation-rail/navigation-rail.js +230 -0
- package/components/navigation-rail-item.d.ts +1 -0
- package/components/navigation-rail-item.js +1 -0
- package/components/navigation-rail.d.ts +1 -0
- package/components/navigation-rail.js +1 -0
- package/components/radio/radio-group-style.d.ts +1 -0
- package/components/radio/radio-group-style.js +2 -0
- package/components/radio/radio-group.d.ts +103 -0
- package/components/radio/radio-group.js +268 -0
- package/components/radio/radio-style.d.ts +1 -0
- package/components/radio/radio-style.js +2 -0
- package/components/radio/radio.d.ts +71 -0
- package/components/radio/radio.js +144 -0
- package/components/radio-group.d.ts +1 -0
- package/components/radio-group.js +1 -0
- package/components/radio.d.ts +1 -0
- package/components/radio.js +1 -0
- package/components/range-slider/index.d.ts +67 -0
- package/components/range-slider/index.js +210 -0
- package/components/range-slider.d.ts +1 -0
- package/components/range-slider.js +1 -0
- package/components/ripple/index.d.ts +44 -0
- package/components/ripple/index.js +173 -0
- package/components/ripple/ripple-mixin.d.ts +28 -0
- package/components/ripple/ripple-mixin.js +258 -0
- package/components/ripple/style.d.ts +1 -0
- package/components/ripple/style.js +2 -0
- package/components/ripple.d.ts +1 -0
- package/components/ripple.js +1 -0
- package/components/segmented-button/segmented-button-group-style.d.ts +1 -0
- package/components/segmented-button/segmented-button-group-style.js +2 -0
- package/components/segmented-button/segmented-button-group.d.ts +125 -0
- package/components/segmented-button/segmented-button-group.js +383 -0
- package/components/segmented-button/segmented-button-style.d.ts +1 -0
- package/components/segmented-button/segmented-button-style.js +4 -0
- package/components/segmented-button/segmented-button.d.ts +73 -0
- package/components/segmented-button/segmented-button.js +160 -0
- package/components/segmented-button-group.d.ts +1 -0
- package/components/segmented-button-group.js +1 -0
- package/components/segmented-button.d.ts +1 -0
- package/components/segmented-button.js +1 -0
- package/components/select/index.d.ts +200 -0
- package/components/select/index.js +390 -0
- package/components/select/style.d.ts +1 -0
- package/components/select/style.js +2 -0
- package/components/select.d.ts +1 -0
- package/components/select.js +1 -0
- package/components/slider/index.d.ts +53 -0
- package/components/slider/index.js +128 -0
- package/components/slider/slider-base-style.d.ts +1 -0
- package/components/slider/slider-base-style.js +2 -0
- package/components/slider/slider-base.d.ts +92 -0
- package/components/slider/slider-base.js +199 -0
- package/components/slider/style.d.ts +1 -0
- package/components/slider/style.js +2 -0
- package/components/slider.d.ts +1 -0
- package/components/slider.js +1 -0
- package/components/snackbar/index.d.ts +98 -0
- package/components/snackbar/index.js +285 -0
- package/components/snackbar/style.d.ts +1 -0
- package/components/snackbar/style.js +2 -0
- package/components/snackbar.d.ts +1 -0
- package/components/snackbar.js +1 -0
- package/components/switch/index.d.ts +123 -0
- package/components/switch/index.js +245 -0
- package/components/switch/style.d.ts +1 -0
- package/components/switch/style.js +2 -0
- package/components/switch.d.ts +1 -0
- package/components/switch.js +1 -0
- package/components/tab-panel.d.ts +1 -0
- package/components/tab-panel.js +1 -0
- package/components/tab.d.ts +1 -0
- package/components/tab.js +1 -0
- package/components/tabs/tab-panel-style.d.ts +1 -0
- package/components/tabs/tab-panel-style.js +2 -0
- package/components/tabs/tab-panel.d.ts +36 -0
- package/components/tabs/tab-panel.js +52 -0
- package/components/tabs/tab-style.d.ts +1 -0
- package/components/tabs/tab-style.js +2 -0
- package/components/tabs/tab.d.ts +69 -0
- package/components/tabs/tab.js +110 -0
- package/components/tabs/tabs-style.d.ts +1 -0
- package/components/tabs/tabs-style.js +2 -0
- package/components/tabs/tabs.d.ts +87 -0
- package/components/tabs/tabs.js +221 -0
- package/components/tabs.d.ts +1 -0
- package/components/tabs.js +1 -0
- package/components/text-field/index.d.ts +400 -0
- package/components/text-field/index.js +752 -0
- package/components/text-field/style.d.ts +1 -0
- package/components/text-field/style.js +2 -0
- package/components/text-field.d.ts +1 -0
- package/components/text-field.js +1 -0
- package/components/tooltip/index.d.ts +140 -0
- package/components/tooltip/index.js +497 -0
- package/components/tooltip/style.d.ts +1 -0
- package/components/tooltip/style.js +2 -0
- package/components/tooltip.d.ts +1 -0
- package/components/tooltip.js +1 -0
- package/components/top-app-bar/top-app-bar-style.d.ts +1 -0
- package/components/top-app-bar/top-app-bar-style.js +2 -0
- package/components/top-app-bar/top-app-bar-title-style.d.ts +1 -0
- package/components/top-app-bar/top-app-bar-title-style.js +2 -0
- package/components/top-app-bar/top-app-bar-title.d.ts +46 -0
- package/components/top-app-bar/top-app-bar-title.js +76 -0
- package/components/top-app-bar/top-app-bar.d.ts +74 -0
- package/components/top-app-bar/top-app-bar.js +178 -0
- package/components/top-app-bar-title.d.ts +1 -0
- package/components/top-app-bar-title.js +1 -0
- package/components/top-app-bar.d.ts +1 -0
- package/components/top-app-bar.js +1 -0
- package/css-data.zh-cn.json +2819 -0
- package/custom-elements.json +28087 -0
- package/functions/alert.d.ts +80 -0
- package/functions/alert.js +59 -0
- package/functions/breakpoint.d.ts +1 -0
- package/functions/breakpoint.js +1 -0
- package/functions/confirm.d.ts +95 -0
- package/functions/confirm.js +68 -0
- package/functions/dialog.d.ts +97 -0
- package/functions/dialog.js +100 -0
- package/functions/getColorFromImage.d.ts +7 -0
- package/functions/getColorFromImage.js +12 -0
- package/functions/getTheme.d.ts +10 -0
- package/functions/getTheme.js +16 -0
- package/functions/observeResize.d.ts +2 -0
- package/functions/observeResize.js +1 -0
- package/functions/prompt.d.ts +110 -0
- package/functions/prompt.js +103 -0
- package/functions/removeColorScheme.d.ts +6 -0
- package/functions/removeColorScheme.js +8 -0
- package/functions/setColorScheme.d.ts +15 -0
- package/functions/setColorScheme.js +15 -0
- package/functions/setTheme.d.ts +10 -0
- package/functions/setTheme.js +16 -0
- package/functions/snackbar.d.ts +91 -0
- package/functions/snackbar.js +84 -0
- package/functions/throttle.d.ts +1 -0
- package/functions/throttle.js +1 -0
- package/functions/utils/colorScheme.d.ts +39 -0
- package/functions/utils/colorScheme.js +133 -0
- package/functions/utils/theme.d.ts +1 -0
- package/html-data.zh-cn.json +6566 -0
- package/jq.d.ts +1 -0
- package/jq.js +1 -0
- package/mdui.css +1 -0
- package/mdui.d.ts +61 -0
- package/mdui.esm.js +22 -0
- package/mdui.global.js +22 -0
- package/mdui.js +61 -0
- package/package.json +39 -68
- package/web-types.zh-cn.json +11728 -0
- package/dist/css/mdui.css +0 -13559
- package/dist/css/mdui.css.map +0 -1
- package/dist/css/mdui.min.css +0 -6
- package/dist/css/mdui.min.css.map +0 -1
- package/dist/fonts/roboto/LICENSE.txt +0 -201
- package/dist/fonts/roboto/Roboto-Black.woff +0 -0
- package/dist/fonts/roboto/Roboto-Black.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-BlackItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Bold.woff +0 -0
- package/dist/fonts/roboto/Roboto-Bold.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-BoldItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Light.woff +0 -0
- package/dist/fonts/roboto/Roboto-Light.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-LightItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Medium.woff +0 -0
- package/dist/fonts/roboto/Roboto-Medium.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-MediumItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Regular.woff +0 -0
- package/dist/fonts/roboto/Roboto-Regular.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-RegularItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Thin.woff +0 -0
- package/dist/fonts/roboto/Roboto-Thin.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-ThinItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
- package/dist/icons/material-icons/LICENSE.txt +0 -393
- package/dist/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
- package/dist/icons/material-icons/MaterialIcons-Regular.woff +0 -0
- package/dist/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
- package/dist/js/mdui.esm.js +0 -5976
- package/dist/js/mdui.esm.js.map +0 -1
- package/dist/js/mdui.js +0 -6474
- package/dist/js/mdui.js.map +0 -1
- package/dist/js/mdui.min.js +0 -7
- package/dist/js/mdui.min.js.map +0 -1
- package/es/components/appbar/index.d.ts +0 -2
- package/es/components/appbar/index.js +0 -17
- package/es/components/bottom_nav/index.d.ts +0 -9
- package/es/components/bottom_nav/index.js +0 -38
- package/es/components/collapse/collapseAbstract.d.ts +0 -110
- package/es/components/collapse/collapseAbstract.js +0 -175
- package/es/components/collapse/customAttr.d.ts +0 -2
- package/es/components/collapse/customAttr.js +0 -11
- package/es/components/collapse/index.d.ts +0 -23
- package/es/components/collapse/index.js +0 -8
- package/es/components/dialog/alert.d.ts +0 -44
- package/es/components/dialog/alert.js +0 -42
- package/es/components/dialog/class.d.ts +0 -133
- package/es/components/dialog/class.js +0 -316
- package/es/components/dialog/confirm.d.ts +0 -54
- package/es/components/dialog/confirm.js +0 -55
- package/es/components/dialog/customAttr.d.ts +0 -4
- package/es/components/dialog/customAttr.js +0 -25
- package/es/components/dialog/dialog.d.ts +0 -91
- package/es/components/dialog/dialog.js +0 -101
- package/es/components/dialog/index.d.ts +0 -20
- package/es/components/dialog/index.js +0 -14
- package/es/components/dialog/prompt.d.ts +0 -74
- package/es/components/dialog/prompt.js +0 -109
- package/es/components/drawer/customAttr.d.ts +0 -4
- package/es/components/drawer/customAttr.js +0 -20
- package/es/components/drawer/index.d.ts +0 -111
- package/es/components/drawer/index.js +0 -310
- package/es/components/fab/customAttr.d.ts +0 -1
- package/es/components/fab/customAttr.js +0 -13
- package/es/components/fab/index.d.ts +0 -100
- package/es/components/fab/index.js +0 -144
- package/es/components/headroom/customAttr.d.ts +0 -2
- package/es/components/headroom/customAttr.js +0 -11
- package/es/components/headroom/index.d.ts +0 -120
- package/es/components/headroom/index.js +0 -167
- package/es/components/menu/customAttr.d.ts +0 -3
- package/es/components/menu/customAttr.js +0 -24
- package/es/components/menu/index.d.ts +0 -167
- package/es/components/menu/index.js +0 -512
- package/es/components/panel/customAttr.d.ts +0 -2
- package/es/components/panel/customAttr.js +0 -11
- package/es/components/panel/index.d.ts +0 -23
- package/es/components/panel/index.js +0 -8
- package/es/components/progress/spinner.d.ts +0 -16
- package/es/components/progress/spinner.js +0 -47
- package/es/components/ripple/index.d.ts +0 -25
- package/es/components/ripple/index.js +0 -170
- package/es/components/select/customAttr.d.ts +0 -2
- package/es/components/select/customAttr.js +0 -11
- package/es/components/select/index.d.ts +0 -160
- package/es/components/select/index.js +0 -340
- package/es/components/slider/index.d.ts +0 -28
- package/es/components/slider/index.js +0 -134
- package/es/components/snackbar/index.d.ts +0 -126
- package/es/components/snackbar/index.js +0 -217
- package/es/components/tab/customAttr.d.ts +0 -2
- package/es/components/tab/customAttr.js +0 -11
- package/es/components/tab/index.d.ts +0 -114
- package/es/components/tab/index.js +0 -266
- package/es/components/table/index.d.ts +0 -25
- package/es/components/table/index.js +0 -178
- package/es/components/textfield/index.d.ts +0 -28
- package/es/components/textfield/index.js +0 -147
- package/es/components/tooltip/customAttr.d.ts +0 -3
- package/es/components/tooltip/customAttr.js +0 -20
- package/es/components/tooltip/index.d.ts +0 -123
- package/es/components/tooltip/index.js +0 -251
- package/es/global/mutation.d.ts +0 -23
- package/es/global/mutation.js +0 -14
- package/es/index.d.ts +0 -36
- package/es/index.js +0 -36
- package/es/interfaces/MduiStatic.d.ts +0 -8
- package/es/jq.d.ts +0 -99
- package/es/jq.js +0 -102
- package/es/jq_extends/methods/mutation.d.ts +0 -11
- package/es/jq_extends/methods/mutation.js +0 -19
- package/es/jq_extends/methods/reflow.d.ts +0 -14
- package/es/jq_extends/methods/reflow.js +0 -7
- package/es/jq_extends/methods/transform.d.ts +0 -14
- package/es/jq_extends/methods/transform.js +0 -8
- package/es/jq_extends/methods/transformOrigin.d.ts +0 -14
- package/es/jq_extends/methods/transformOrigin.js +0 -8
- package/es/jq_extends/methods/transition.d.ts +0 -15
- package/es/jq_extends/methods/transition.js +0 -12
- package/es/jq_extends/methods/transitionEnd.d.ts +0 -17
- package/es/jq_extends/methods/transitionEnd.js +0 -23
- package/es/jq_extends/static/guid.d.ts +0 -18
- package/es/jq_extends/static/guid.js +0 -30
- package/es/jq_extends/static/hideOverlay.d.ts +0 -23
- package/es/jq_extends/static/hideOverlay.js +0 -25
- package/es/jq_extends/static/lockScreen.d.ts +0 -15
- package/es/jq_extends/static/lockScreen.js +0 -14
- package/es/jq_extends/static/showOverlay.d.ts +0 -23
- package/es/jq_extends/static/showOverlay.js +0 -27
- package/es/jq_extends/static/throttle.d.ts +0 -17
- package/es/jq_extends/static/throttle.js +0 -13
- package/es/jq_extends/static/unlockScreen.d.ts +0 -22
- package/es/jq_extends/static/unlockScreen.js +0 -13
- package/es/mdui.d.ts +0 -3
- package/es/mdui.js +0 -8
- package/es/utils/componentEvent.d.ts +0 -13
- package/es/utils/componentEvent.js +0 -37
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -5
- package/es/utils/mutation.d.ts +0 -15
- package/es/utils/mutation.js +0 -24
- package/es/utils/parseOptions.d.ts +0 -9
- package/es/utils/parseOptions.js +0 -15
- package/es/utils/queue.d.ts +0 -18
- package/es/utils/queue.js +0 -26
- package/es/utils/touchHandler.d.ts +0 -50
- package/es/utils/touchHandler.js +0 -76
- package/src/components/appbar/index.less +0 -110
- package/src/components/appbar/index.ts +0 -19
- package/src/components/bottom_nav/index.less +0 -155
- package/src/components/bottom_nav/index.ts +0 -43
- package/src/components/button/index.less +0 -291
- package/src/components/card/index.less +0 -200
- package/src/components/chip/index.less +0 -97
- package/src/components/collapse/collapseAbstract.ts +0 -270
- package/src/components/collapse/customAttr.ts +0 -13
- package/src/components/collapse/index.less +0 -44
- package/src/components/collapse/index.ts +0 -32
- package/src/components/dialog/alert.less +0 -11
- package/src/components/dialog/alert.ts +0 -111
- package/src/components/dialog/class.ts +0 -432
- package/src/components/dialog/confirm.less +0 -11
- package/src/components/dialog/confirm.ts +0 -140
- package/src/components/dialog/customAttr.ts +0 -41
- package/src/components/dialog/dialog.ts +0 -224
- package/src/components/dialog/index.less +0 -154
- package/src/components/dialog/index.ts +0 -40
- package/src/components/dialog/prompt.less +0 -16
- package/src/components/dialog/prompt.ts +0 -231
- package/src/components/divider/index.less +0 -49
- package/src/components/drawer/customAttr.ts +0 -30
- package/src/components/drawer/index.less +0 -177
- package/src/components/drawer/index.ts +0 -425
- package/src/components/fab/customAttr.ts +0 -23
- package/src/components/fab/index.less +0 -158
- package/src/components/fab/index.ts +0 -232
- package/src/components/grid_list/index.less +0 -126
- package/src/components/headroom/customAttr.ts +0 -13
- package/src/components/headroom/index.less +0 -51
- package/src/components/headroom/index.ts +0 -275
- package/src/components/list/index.less +0 -347
- package/src/components/menu/customAttr.ts +0 -40
- package/src/components/menu/index.less +0 -195
- package/src/components/menu/index.ts +0 -725
- package/src/components/menu/svg/arrow_right_dark.svg +0 -1
- package/src/components/menu/svg/arrow_right_light.svg +0 -1
- package/src/components/panel/customAttr.ts +0 -13
- package/src/components/panel/index.less +0 -191
- package/src/components/panel/index.ts +0 -32
- package/src/components/progress/progress.less +0 -113
- package/src/components/progress/spinner.less +0 -198
- package/src/components/progress/spinner.ts +0 -75
- package/src/components/ripple/index.less +0 -92
- package/src/components/ripple/index.ts +0 -217
- package/src/components/select/customAttr.ts +0 -13
- package/src/components/select/index.less +0 -342
- package/src/components/select/index.ts +0 -478
- package/src/components/select/svg/arrow_down_dark.svg +0 -1
- package/src/components/select/svg/arrow_down_light.svg +0 -1
- package/src/components/select/svg/arrow_up_dark.svg +0 -1
- package/src/components/select/svg/arrow_up_light.svg +0 -1
- package/src/components/selection_control/checkbox.less +0 -226
- package/src/components/selection_control/radio.less +0 -163
- package/src/components/selection_control/switch.less +0 -210
- package/src/components/slider/index.less +0 -340
- package/src/components/slider/index.ts +0 -187
- package/src/components/snackbar/index.less +0 -133
- package/src/components/snackbar/index.ts +0 -367
- package/src/components/subheader/index.less +0 -38
- package/src/components/tab/customAttr.ts +0 -13
- package/src/components/tab/index.less +0 -195
- package/src/components/tab/index.ts +0 -372
- package/src/components/table/index.less +0 -169
- package/src/components/table/index.ts +0 -240
- package/src/components/textfield/index.less +0 -425
- package/src/components/textfield/index.ts +0 -217
- package/src/components/toolbar/index.less +0 -92
- package/src/components/tooltip/customAttr.ts +0 -26
- package/src/components/tooltip/index.less +0 -45
- package/src/components/tooltip/index.ts +0 -361
- package/src/fonts/roboto/LICENSE.txt +0 -201
- package/src/fonts/roboto/Roboto-Black.woff +0 -0
- package/src/fonts/roboto/Roboto-Black.woff2 +0 -0
- package/src/fonts/roboto/Roboto-BlackItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Bold.woff +0 -0
- package/src/fonts/roboto/Roboto-Bold.woff2 +0 -0
- package/src/fonts/roboto/Roboto-BoldItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Light.woff +0 -0
- package/src/fonts/roboto/Roboto-Light.woff2 +0 -0
- package/src/fonts/roboto/Roboto-LightItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Medium.woff +0 -0
- package/src/fonts/roboto/Roboto-Medium.woff2 +0 -0
- package/src/fonts/roboto/Roboto-MediumItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Regular.woff +0 -0
- package/src/fonts/roboto/Roboto-Regular.woff2 +0 -0
- package/src/fonts/roboto/Roboto-RegularItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Thin.woff +0 -0
- package/src/fonts/roboto/Roboto-Thin.woff2 +0 -0
- package/src/fonts/roboto/Roboto-ThinItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
- package/src/global/mutation.ts +0 -37
- package/src/icons/material-icons/LICENSE.txt +0 -393
- package/src/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
- package/src/icons/material-icons/MaterialIcons-Regular.woff +0 -0
- package/src/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
- package/src/index.less +0 -73
- package/src/index.ts +0 -39
- package/src/interfaces/MduiStatic.ts +0 -11
- package/src/jq.ts +0 -104
- package/src/jq_extends/methods/mutation.ts +0 -32
- package/src/jq_extends/methods/reflow.ts +0 -23
- package/src/jq_extends/methods/transform.ts +0 -24
- package/src/jq_extends/methods/transformOrigin.ts +0 -24
- package/src/jq_extends/methods/transition.ts +0 -30
- package/src/jq_extends/methods/transitionEnd.ts +0 -49
- package/src/jq_extends/static/guid.ts +0 -56
- package/src/jq_extends/static/hideOverlay.ts +0 -50
- package/src/jq_extends/static/lockScreen.ts +0 -30
- package/src/jq_extends/static/showOverlay.ts +0 -51
- package/src/jq_extends/static/throttle.ts +0 -32
- package/src/jq_extends/static/unlockScreen.ts +0 -36
- package/src/mdui.ts +0 -12
- package/src/styles/color.less +0 -392
- package/src/styles/global.less +0 -75
- package/src/styles/grid.less +0 -150
- package/src/styles/helper.less +0 -242
- package/src/styles/icon.less +0 -31
- package/src/styles/material-icons.less +0 -36
- package/src/styles/media.less +0 -39
- package/src/styles/mixin/color.less +0 -66
- package/src/styles/mixin/divider.less +0 -30
- package/src/styles/mixin/helper.less +0 -126
- package/src/styles/mixin/icon.less +0 -33
- package/src/styles/mixin/layout-theme.less +0 -14
- package/src/styles/mixin/media.less +0 -11
- package/src/styles/mixin/shadow.less +0 -17
- package/src/styles/mixin/typo.less +0 -149
- package/src/styles/mixin.less +0 -8
- package/src/styles/roboto.less +0 -125
- package/src/styles/shadow.less +0 -20
- package/src/styles/typo-styles.less +0 -91
- package/src/styles/typo.less +0 -338
- package/src/styles/variable/animation.less +0 -5
- package/src/styles/variable/color/amber.less +0 -41
- package/src/styles/variable/color/black.less +0 -16
- package/src/styles/variable/color/blue-grey.less +0 -29
- package/src/styles/variable/color/blue.less +0 -41
- package/src/styles/variable/color/brown.less +0 -29
- package/src/styles/variable/color/cyan.less +0 -41
- package/src/styles/variable/color/deep-orange.less +0 -41
- package/src/styles/variable/color/deep-purple.less +0 -41
- package/src/styles/variable/color/default.less +0 -74
- package/src/styles/variable/color/green.less +0 -41
- package/src/styles/variable/color/grey.less +0 -29
- package/src/styles/variable/color/indigo.less +0 -41
- package/src/styles/variable/color/light-blue.less +0 -41
- package/src/styles/variable/color/light-green.less +0 -41
- package/src/styles/variable/color/lime.less +0 -41
- package/src/styles/variable/color/orange.less +0 -41
- package/src/styles/variable/color/pink.less +0 -41
- package/src/styles/variable/color/purple.less +0 -41
- package/src/styles/variable/color/red.less +0 -41
- package/src/styles/variable/color/teal.less +0 -41
- package/src/styles/variable/color/transparent.less +0 -1
- package/src/styles/variable/color/white.less +0 -16
- package/src/styles/variable/color/yellow.less +0 -41
- package/src/styles/variable/global.less +0 -98
- package/src/styles/variable/shadow.less +0 -103
- package/src/styles/variable.less +0 -26
- package/src/tsconfig.json +0 -12
- package/src/utils/componentEvent.ts +0 -63
- package/src/utils/dom.ts +0 -7
- package/src/utils/mutation.ts +0 -41
- package/src/utils/parseOptions.ts +0 -23
- package/src/utils/queue.ts +0 -51
- package/src/utils/touchHandler.ts +0 -92
- /package/{es/interfaces/MduiStatic.js → functions/utils/theme.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import("lit").CSSResult;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const style = css `:host{display:inline-block;width:100%}:host([disabled]){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);padding:0 1rem}.container.has-icon{padding-left:.75rem}.container.has-end-icon,.container.has-error-icon{padding-right:.75rem}:host([variant=filled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));border-radius:var(--mdui-shape-corner-extra-small) var(--mdui-shape-corner-extra-small) 0 0}:host([variant=filled][invalid-style]) .container,:host([variant=filled][invalid]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface))}:host([variant=filled][invalid-style]:hover) .container,:host([variant=filled][invalid]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .container,:host([variant=filled][focused]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-primary))}:host([variant=filled][focused-style][invalid-style]) .container,:host([variant=filled][focused-style][invalid]) .container,:host([variant=filled][focused][invalid-style]) .container,:host([variant=filled][focused][invalid]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled][disabled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),4%)}:host([variant=outlined]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-outline));border-radius:var(--mdui-shape-corner-extra-small)}:host([variant=outlined][invalid-style]) .container,:host([variant=outlined][invalid]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-error))}:host([variant=outlined]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-surface))}:host([variant=outlined][invalid-style]:hover) .container,:host([variant=outlined][invalid]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-error-container))}:host([variant=outlined][focused-style]) .container,:host([variant=outlined][focused]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-primary))}:host([variant=outlined][focused-style][invalid-style]) .container,:host([variant=outlined][focused-style][invalid]) .container,:host([variant=outlined][focused][invalid-style]) .container,:host([variant=outlined][focused][invalid]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-error))}:host([variant=outlined][disabled]) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .icon,:host([disabled]) .prefix,:host([disabled]) .right-icon,:host([disabled]) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}:host([invalid-style]) .right-icon,:host([invalid-style]) .suffix,:host([invalid]) .right-icon,:host([invalid]) .suffix{color:rgb(var(--mdui-color-error))}:host([invalid-style]:hover) .right-icon,:host([invalid-style]:hover) .suffix,:host([invalid]:hover) .right-icon,:host([invalid]:hover) .suffix{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style][invalid-style]) .right-icon,:host([focused-style][invalid-style]) .suffix,:host([focused-style][invalid]) .right-icon,:host([focused-style][invalid]) .suffix,:host([focused][invalid-style]) .right-icon,:host([focused][invalid-style]) .suffix,:host([focused][invalid]) .right-icon,:host([focused][invalid]) .suffix{color:rgb(var(--mdui-color-error))}.icon,.right-icon{font-size:1.5rem}.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-end-icon .end-icon,.right-icon:not(.end-icon){margin-left:1rem}.prefix,.suffix{display:none;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([variant=filled][label]) .prefix,:host([variant=filled][label]) .suffix{padding-top:1rem}.has-value .prefix,.has-value .suffix,:host([focused-style]) .prefix,:host([focused-style]) .suffix,:host([focused]) .prefix,:host([focused]) .suffix{display:flex}.prefix{padding-right:.125rem}.suffix{padding-left:.125rem}.input-container{width:100%}.label{position:absolute;pointer-events:none;max-width:calc(100% - 1rem);display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;top:1rem;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([invalid-style]) .label,:host([invalid]) .label{color:rgb(var(--mdui-color-error))}:host([variant=outlined]) .label{padding:0 .25rem;margin:0 -.25rem}:host([variant=outlined]:hover) .label{color:rgb(var(--mdui-color-on-surface))}:host([variant=filled][invalid-style]:hover) .label,:host([variant=filled][invalid]:hover) .label,:host([variant=outlined][invalid-style]:hover) .label,:host([variant=outlined][invalid]:hover) .label{color:rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label{color:rgb(var(--mdui-color-primary))}:host([variant=filled]) .has-value .label,:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=filled][type=date]) .label,:host([variant=filled][type=datetime-local]) .label,:host([variant=filled][type=month]) .label,:host([variant=filled][type=time]) .label,:host([variant=filled][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:.25rem}:host([variant=outlined]) .has-value .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label,:host([variant=outlined][type=date]) .label,:host([variant=outlined][type=datetime-local]) .label,:host([variant=outlined][type=month]) .label,:host([variant=outlined][type=time]) .label,:host([variant=outlined][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:-.5rem;left:.75rem;background-color:rgb(var(--mdui-color-background))}:host([variant=filled][focused-style][invalid-style]) .label,:host([variant=filled][focused-style][invalid]) .label,:host([variant=filled][focused][invalid-style]) .label,:host([variant=filled][focused][invalid]) .label,:host([variant=outlined][focused-style][invalid-style]) .label,:host([variant=outlined][focused-style][invalid]) .label,:host([variant=outlined][focused][invalid-style]) .label,:host([variant=outlined][focused][invalid]) .label{color:rgb(var(--mdui-color-error))}:host([variant=filled][disabled]) .label,:host([variant=outlined][disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:flex;flex-wrap:wrap;width:100%;border:none;outline:0;background:0 0;-webkit-appearance:none;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:1rem 0;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height);color:rgb(var(--mdui-color-on-surface));caret-color:rgb(var(--mdui-color-primary))}.input.hide-input{opacity:0;height:0;padding:0!important;overflow:hidden}.input::placeholder{color:rgb(var(--mdui-color-on-surface-variant))}:host([invalid-style]) .input,:host([invalid]) .input{caret-color:rgb(var(--mdui-color-error))}:host([disabled]) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]) .input{text-align:right}:host([variant=filled]) .label+.input{padding:1.5rem 0 .5rem 0}.supporting{display:flex;justify-content:space-between;padding:.25rem 1rem;color:rgb(var(--mdui-color-on-surface-variant))}:host([invalid-style]) .supporting,:host([invalid]) .supporting{color:rgb(var(--mdui-color-error))}.helper{display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([disabled]) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]) .helper{opacity:0}:host([helper-on-focus][focused-style]) .helper,:host([helper-on-focus][focused]) .helper{opacity:1}.error{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}.counter{flex-wrap:nowrap;padding-left:1rem;font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}::-ms-reveal{display:none}.is-firefox .input[type=date],.is-firefox .input[type=datetime-local],.is-firefox .input[type=time]{-webkit-clip-path:inset(0 2em 0 0);clip-path:inset(0 2em 0 0)}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;display:none}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './text-field/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './text-field/index.js';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '@mdui/jq/methods/css.js';
|
|
3
|
+
import '@mdui/jq/methods/filter.js';
|
|
4
|
+
import '@mdui/jq/methods/height.js';
|
|
5
|
+
import '@mdui/jq/methods/prop.js';
|
|
6
|
+
import '@mdui/jq/methods/width.js';
|
|
7
|
+
import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
8
|
+
/**
|
|
9
|
+
* @summary 工具提示组件
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <mdui-tooltip content="tooltip content">
|
|
13
|
+
* ..<mdui-button>button</mdui-button>
|
|
14
|
+
* </mdui-tooltip>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @event open - tooltip 开始显示时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 打开
|
|
18
|
+
* @event opened - tooltip 显示动画完成时,事件被触发
|
|
19
|
+
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
20
|
+
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
21
|
+
*
|
|
22
|
+
* @slot - tooltip 触发的目标元素,仅 `default` slot 中的第一个元素会作为目标元素
|
|
23
|
+
* @slot headline - tooltip 的标题,仅 `variant="rich"` 时该 slot 才有效
|
|
24
|
+
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
25
|
+
* @slot action - tooltip 底部的按钮,仅 `variant="rich"` 时该 slot 才有效
|
|
26
|
+
*
|
|
27
|
+
* @csspart popup - 工具提示的容器
|
|
28
|
+
* @csspart headline - 标题
|
|
29
|
+
* @csspart content - 正文
|
|
30
|
+
* @csspart action - 操作按钮
|
|
31
|
+
*
|
|
32
|
+
* @cssprop --shape-corner-plain - variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
33
|
+
* @cssprop --shape-corner-rich - variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
|
+
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
35
|
+
*/
|
|
36
|
+
export declare class Tooltip extends LitElement {
|
|
37
|
+
static styles: CSSResultGroup;
|
|
38
|
+
/**
|
|
39
|
+
* tooltip 的形状。默认为 `plain`。可选值为:
|
|
40
|
+
*
|
|
41
|
+
* * `plain`:纯文本,用于简单的单行文本
|
|
42
|
+
* * `rich`:富文本,可包含标题、正文、及操作按钮
|
|
43
|
+
*/
|
|
44
|
+
variant: /*纯文本,用于简单的单行文本*/ 'plain' | /*富文本,可包含标题、正文、及操作按钮*/ 'rich';
|
|
45
|
+
/**
|
|
46
|
+
* tooltip 的位置。默认为 `auto`。可选值为:
|
|
47
|
+
*
|
|
48
|
+
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
49
|
+
* * `top-left`:位于左上方
|
|
50
|
+
* * `top-start`:位于上方,且左对齐
|
|
51
|
+
* * `top`:位于上方,且居中对齐
|
|
52
|
+
* * `top-end`:位于上方,且右对齐
|
|
53
|
+
* * `top-right`:位于右上方
|
|
54
|
+
* * `bottom-left`:位于左下方
|
|
55
|
+
* * `bottom-start`:位于下方,且左对齐
|
|
56
|
+
* * `bottom`:位于下方,且居中对齐
|
|
57
|
+
* * `bottom-end`:位于下方,且右对齐
|
|
58
|
+
* * `bottom-right`:位于右下方
|
|
59
|
+
* * `left-start`:位于左侧,且顶部对齐
|
|
60
|
+
* * `left`:位于左侧,且居中对齐
|
|
61
|
+
* * `left-end`:位于左侧,且底部对齐
|
|
62
|
+
* * `right-start`:位于右侧,且顶部对齐
|
|
63
|
+
* * `right`:位于右侧,且居中对齐
|
|
64
|
+
* * `right-end`:位于右侧,且底部对齐
|
|
65
|
+
*/
|
|
66
|
+
placement: /*自动判断位置*/ 'auto' | /*位于左上方*/ 'top-left' | /*位于上方,且左对齐*/ 'top-start' | /*位于上方,且居中对齐*/ 'top' | /*位于上方,且右对齐*/ 'top-end' | /*位于右上方*/ 'top-right' | /*位于左下方*/ 'bottom-left' | /*位于下方,且左对齐*/ 'bottom-start' | /*位于下方,且居中对齐*/ 'bottom' | /*位于下方,且右对齐*/ 'bottom-end' | /*位于右下方*/ 'bottom-right' | /*位于左侧,且顶部对齐*/ 'left-start' | /*位于左侧,且居中对齐*/ 'left' | /*位于左侧,且底部对齐*/ 'left-end' | /*位于右侧,且顶部对齐*/ 'right-start' | /*位于右侧,且居中对齐*/ 'right' | /*位于右侧,且底部对齐*/ 'right-end';
|
|
67
|
+
/**
|
|
68
|
+
* hover 触发显示的延时,单位为毫秒
|
|
69
|
+
*/
|
|
70
|
+
openDelay: number;
|
|
71
|
+
/**
|
|
72
|
+
* hover 触发隐藏的延时,单位为毫秒
|
|
73
|
+
*/
|
|
74
|
+
closeDelay: number;
|
|
75
|
+
/**
|
|
76
|
+
* tooltip 的标题。仅 `variant="rich"` 时可使用。也可以通过 `slot="headline"` 设置
|
|
77
|
+
*/
|
|
78
|
+
headline?: string;
|
|
79
|
+
/**
|
|
80
|
+
* tooltip 的内容。也可以通过 `slot="content"` 设置
|
|
81
|
+
*/
|
|
82
|
+
content?: string;
|
|
83
|
+
/**
|
|
84
|
+
* 触发方式,支持传入多个值,用空格分隔。可选值为:
|
|
85
|
+
*
|
|
86
|
+
* * `click`:点击时触发
|
|
87
|
+
* * `hover`:鼠标悬浮触发
|
|
88
|
+
* * `focus`:聚焦时触发
|
|
89
|
+
* * `manual`:使用了该值时,只能使用编程方式打开和关闭 tooltip,且不能再指定其他触发方式
|
|
90
|
+
*/
|
|
91
|
+
trigger: /*点击时触发*/ 'click' | /*鼠标悬浮触发*/ 'hover' | /*聚焦时触发*/ 'focus' | /*使用了该值时,只能使用编程方式打开和关闭 tooltip,且不能再指定其他触发方式*/ 'manual' | string;
|
|
92
|
+
/**
|
|
93
|
+
* 是否禁用 tooltip
|
|
94
|
+
*/
|
|
95
|
+
disabled: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 是否显示 tooltip
|
|
98
|
+
*/
|
|
99
|
+
open: boolean;
|
|
100
|
+
private observeResize?;
|
|
101
|
+
private target;
|
|
102
|
+
private hoverTimeout;
|
|
103
|
+
private readonly popupRef;
|
|
104
|
+
private readonly hasSlotController;
|
|
105
|
+
private readonly hoverController;
|
|
106
|
+
constructor();
|
|
107
|
+
private onPositionChange;
|
|
108
|
+
private onOpenChange;
|
|
109
|
+
connectedCallback(): void;
|
|
110
|
+
disconnectedCallback(): void;
|
|
111
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
112
|
+
protected render(): TemplateResult;
|
|
113
|
+
private isRich;
|
|
114
|
+
/**
|
|
115
|
+
* 请求关闭 tooltip。鼠标未悬浮在 tooltip 上时,直接关闭;否则等鼠标移走再关闭
|
|
116
|
+
*/
|
|
117
|
+
private requestClose;
|
|
118
|
+
/**
|
|
119
|
+
* 获取第一个非 <style> 和 content slot 的子元素,作为 tooltip 的目标元素
|
|
120
|
+
*/
|
|
121
|
+
private getTarget;
|
|
122
|
+
private hasTrigger;
|
|
123
|
+
private onFocus;
|
|
124
|
+
private onBlur;
|
|
125
|
+
private onClick;
|
|
126
|
+
private onKeydown;
|
|
127
|
+
private onMouseEnter;
|
|
128
|
+
private onMouseLeave;
|
|
129
|
+
/**
|
|
130
|
+
* 在 document 上点击时,根据条件判断是否关闭 tooltip
|
|
131
|
+
*/
|
|
132
|
+
private onDocumentClick;
|
|
133
|
+
private onWindowScroll;
|
|
134
|
+
private updatePositioner;
|
|
135
|
+
}
|
|
136
|
+
declare global {
|
|
137
|
+
interface HTMLElementTagNameMap {
|
|
138
|
+
'mdui-tooltip': Tooltip;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
|
+
import { when } from 'lit/directives/when.js';
|
|
6
|
+
import { $ } from '@mdui/jq/$.js';
|
|
7
|
+
import '@mdui/jq/methods/css.js';
|
|
8
|
+
import '@mdui/jq/methods/filter.js';
|
|
9
|
+
import '@mdui/jq/methods/height.js';
|
|
10
|
+
import '@mdui/jq/methods/prop.js';
|
|
11
|
+
import '@mdui/jq/methods/width.js';
|
|
12
|
+
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
13
|
+
import { HoverController } from '@mdui/shared/controllers/hover.js';
|
|
14
|
+
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
15
|
+
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
16
|
+
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
17
|
+
import { emit } from '@mdui/shared/helpers/event.js';
|
|
18
|
+
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
19
|
+
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
20
|
+
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
21
|
+
import { style } from './style.js';
|
|
22
|
+
/**
|
|
23
|
+
* @summary 工具提示组件
|
|
24
|
+
*
|
|
25
|
+
* ```html
|
|
26
|
+
* <mdui-tooltip content="tooltip content">
|
|
27
|
+
* ..<mdui-button>button</mdui-button>
|
|
28
|
+
* </mdui-tooltip>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @event open - tooltip 开始显示时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 打开
|
|
32
|
+
* @event opened - tooltip 显示动画完成时,事件被触发
|
|
33
|
+
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
34
|
+
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
35
|
+
*
|
|
36
|
+
* @slot - tooltip 触发的目标元素,仅 `default` slot 中的第一个元素会作为目标元素
|
|
37
|
+
* @slot headline - tooltip 的标题,仅 `variant="rich"` 时该 slot 才有效
|
|
38
|
+
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
39
|
+
* @slot action - tooltip 底部的按钮,仅 `variant="rich"` 时该 slot 才有效
|
|
40
|
+
*
|
|
41
|
+
* @csspart popup - 工具提示的容器
|
|
42
|
+
* @csspart headline - 标题
|
|
43
|
+
* @csspart content - 正文
|
|
44
|
+
* @csspart action - 操作按钮
|
|
45
|
+
*
|
|
46
|
+
* @cssprop --shape-corner-plain - variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
47
|
+
* @cssprop --shape-corner-rich - variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
48
|
+
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
49
|
+
*/
|
|
50
|
+
export let Tooltip = class Tooltip extends LitElement {
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
/**
|
|
54
|
+
* tooltip 的形状。默认为 `plain`。可选值为:
|
|
55
|
+
*
|
|
56
|
+
* * `plain`:纯文本,用于简单的单行文本
|
|
57
|
+
* * `rich`:富文本,可包含标题、正文、及操作按钮
|
|
58
|
+
*/
|
|
59
|
+
this.variant = 'plain';
|
|
60
|
+
/**
|
|
61
|
+
* tooltip 的位置。默认为 `auto`。可选值为:
|
|
62
|
+
*
|
|
63
|
+
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
64
|
+
* * `top-left`:位于左上方
|
|
65
|
+
* * `top-start`:位于上方,且左对齐
|
|
66
|
+
* * `top`:位于上方,且居中对齐
|
|
67
|
+
* * `top-end`:位于上方,且右对齐
|
|
68
|
+
* * `top-right`:位于右上方
|
|
69
|
+
* * `bottom-left`:位于左下方
|
|
70
|
+
* * `bottom-start`:位于下方,且左对齐
|
|
71
|
+
* * `bottom`:位于下方,且居中对齐
|
|
72
|
+
* * `bottom-end`:位于下方,且右对齐
|
|
73
|
+
* * `bottom-right`:位于右下方
|
|
74
|
+
* * `left-start`:位于左侧,且顶部对齐
|
|
75
|
+
* * `left`:位于左侧,且居中对齐
|
|
76
|
+
* * `left-end`:位于左侧,且底部对齐
|
|
77
|
+
* * `right-start`:位于右侧,且顶部对齐
|
|
78
|
+
* * `right`:位于右侧,且居中对齐
|
|
79
|
+
* * `right-end`:位于右侧,且底部对齐
|
|
80
|
+
*/
|
|
81
|
+
this.placement = 'auto';
|
|
82
|
+
/**
|
|
83
|
+
* hover 触发显示的延时,单位为毫秒
|
|
84
|
+
*/
|
|
85
|
+
this.openDelay = 150;
|
|
86
|
+
/**
|
|
87
|
+
* hover 触发隐藏的延时,单位为毫秒
|
|
88
|
+
*/
|
|
89
|
+
this.closeDelay = 150;
|
|
90
|
+
/**
|
|
91
|
+
* 触发方式,支持传入多个值,用空格分隔。可选值为:
|
|
92
|
+
*
|
|
93
|
+
* * `click`:点击时触发
|
|
94
|
+
* * `hover`:鼠标悬浮触发
|
|
95
|
+
* * `focus`:聚焦时触发
|
|
96
|
+
* * `manual`:使用了该值时,只能使用编程方式打开和关闭 tooltip,且不能再指定其他触发方式
|
|
97
|
+
*/
|
|
98
|
+
this.trigger = 'hover focus';
|
|
99
|
+
/**
|
|
100
|
+
* 是否禁用 tooltip
|
|
101
|
+
*/
|
|
102
|
+
this.disabled = false;
|
|
103
|
+
/**
|
|
104
|
+
* 是否显示 tooltip
|
|
105
|
+
*/
|
|
106
|
+
this.open = false;
|
|
107
|
+
this.popupRef = createRef();
|
|
108
|
+
this.hasSlotController = new HasSlotController(this, 'headline', 'action');
|
|
109
|
+
this.hoverController = new HoverController(this, this.popupRef);
|
|
110
|
+
this.onDocumentClick = this.onDocumentClick.bind(this);
|
|
111
|
+
this.onWindowScroll = this.onWindowScroll.bind(this);
|
|
112
|
+
this.onFocus = this.onFocus.bind(this);
|
|
113
|
+
this.onBlur = this.onBlur.bind(this);
|
|
114
|
+
this.onClick = this.onClick.bind(this);
|
|
115
|
+
this.onKeydown = this.onKeydown.bind(this);
|
|
116
|
+
this.onMouseEnter = this.onMouseEnter.bind(this);
|
|
117
|
+
this.onMouseLeave = this.onMouseLeave.bind(this);
|
|
118
|
+
}
|
|
119
|
+
async onPositionChange() {
|
|
120
|
+
if (this.open) {
|
|
121
|
+
this.updatePositioner();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async onOpenChange() {
|
|
125
|
+
const hasUpdated = this.hasUpdated;
|
|
126
|
+
const duration = getDuration(this, 'short4');
|
|
127
|
+
const easing = getEasing(this, 'standard');
|
|
128
|
+
// 打开
|
|
129
|
+
// 要区分是否首次渲染,首次渲染时不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
130
|
+
if (this.open) {
|
|
131
|
+
// 先关闭页面中所有其他相同 variant 的 tooltip
|
|
132
|
+
$(`mdui-tooltip[variant="${this.variant}"]`)
|
|
133
|
+
.filter((_, element) => element !== this)
|
|
134
|
+
.prop('open', false);
|
|
135
|
+
if (!hasUpdated) {
|
|
136
|
+
await this.updateComplete;
|
|
137
|
+
}
|
|
138
|
+
if (hasUpdated) {
|
|
139
|
+
const requestOpen = emit(this, 'open', {
|
|
140
|
+
cancelable: true,
|
|
141
|
+
});
|
|
142
|
+
if (requestOpen.defaultPrevented) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
await stopAnimations(this.popupRef.value);
|
|
147
|
+
this.popupRef.value.hidden = false;
|
|
148
|
+
this.updatePositioner();
|
|
149
|
+
await animateTo(this.popupRef.value, [{ transform: 'scale(0)' }, { transform: 'scale(1)' }], {
|
|
150
|
+
duration: hasUpdated ? duration : 0,
|
|
151
|
+
easing,
|
|
152
|
+
});
|
|
153
|
+
if (hasUpdated) {
|
|
154
|
+
emit(this, 'opened');
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
// 关闭
|
|
159
|
+
if (!this.open && hasUpdated) {
|
|
160
|
+
const requestClose = emit(this, 'close', {
|
|
161
|
+
cancelable: true,
|
|
162
|
+
});
|
|
163
|
+
if (requestClose.defaultPrevented) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
await stopAnimations(this.popupRef.value);
|
|
167
|
+
await animateTo(this.popupRef.value, [{ transform: 'scale(1)' }, { transform: 'scale(0)' }], { duration, easing });
|
|
168
|
+
this.popupRef.value.hidden = true;
|
|
169
|
+
emit(this, 'closed');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
connectedCallback() {
|
|
174
|
+
super.connectedCallback();
|
|
175
|
+
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
176
|
+
window.addEventListener('scroll', this.onWindowScroll);
|
|
177
|
+
// trigger 尺寸变化时,重新调整 tooltip 的位置
|
|
178
|
+
this.updateComplete.then(() => {
|
|
179
|
+
this.observeResize = observeResize(this.target, () => {
|
|
180
|
+
this.updatePositioner();
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
disconnectedCallback() {
|
|
185
|
+
var _a;
|
|
186
|
+
super.disconnectedCallback();
|
|
187
|
+
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
188
|
+
window.removeEventListener('scroll', this.onWindowScroll);
|
|
189
|
+
(_a = this.observeResize) === null || _a === void 0 ? void 0 : _a.unobserve();
|
|
190
|
+
}
|
|
191
|
+
firstUpdated(changedProperties) {
|
|
192
|
+
super.firstUpdated(changedProperties);
|
|
193
|
+
this.target = this.getTarget();
|
|
194
|
+
this.target.addEventListener('focus', this.onFocus);
|
|
195
|
+
this.target.addEventListener('blur', this.onBlur);
|
|
196
|
+
this.target.addEventListener('pointerdown', this.onClick);
|
|
197
|
+
this.target.addEventListener('keydown', this.onKeydown);
|
|
198
|
+
this.target.addEventListener('mouseenter', this.onMouseEnter);
|
|
199
|
+
this.target.addEventListener('mouseleave', this.onMouseLeave);
|
|
200
|
+
}
|
|
201
|
+
render() {
|
|
202
|
+
const hasHeadline = this.isRich() &&
|
|
203
|
+
(this.headline || this.hasSlotController.test('headline'));
|
|
204
|
+
const hasAction = this.isRich() && this.hasSlotController.test('action');
|
|
205
|
+
return html `<slot></slot><div ${ref(this.popupRef)} part="popup" class="popup" hidden>${when(hasHeadline, () => html `<slot name="headline" part="headline" class="headline">${this.headline}</slot>`)}<slot name="content" part="content" class="content">${this.content}</slot>${when(hasAction, () => html `<slot name="action" part="action" class="action"></slot>`)}</div>`;
|
|
206
|
+
}
|
|
207
|
+
isRich() {
|
|
208
|
+
return this.variant === 'rich';
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* 请求关闭 tooltip。鼠标未悬浮在 tooltip 上时,直接关闭;否则等鼠标移走再关闭
|
|
212
|
+
*/
|
|
213
|
+
async requestClose() {
|
|
214
|
+
if (!this.hoverController.isHover) {
|
|
215
|
+
this.open = false;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.hoverController.onMouseLeave(() => {
|
|
219
|
+
if (this.hasTrigger('hover')) {
|
|
220
|
+
// 同时使用 hover focus 时,leave 比 focus 先触发,导致 leave 后触发 focus,而显示 tooltip
|
|
221
|
+
// 所以延迟执行 leave
|
|
222
|
+
this.hoverTimeout = window.setTimeout(() => {
|
|
223
|
+
this.open = false;
|
|
224
|
+
}, this.closeDelay || 50);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.open = false;
|
|
228
|
+
}
|
|
229
|
+
}, true);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 获取第一个非 <style> 和 content slot 的子元素,作为 tooltip 的目标元素
|
|
233
|
+
*/
|
|
234
|
+
getTarget() {
|
|
235
|
+
return [...this.children].find((el) => el.tagName.toLowerCase() !== 'style' &&
|
|
236
|
+
el.getAttribute('slot') !== 'content');
|
|
237
|
+
}
|
|
238
|
+
hasTrigger(trigger) {
|
|
239
|
+
const triggers = this.trigger.split(' ');
|
|
240
|
+
return triggers.includes(trigger);
|
|
241
|
+
}
|
|
242
|
+
onFocus() {
|
|
243
|
+
if (this.disabled || this.open || !this.hasTrigger('focus')) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.open = true;
|
|
247
|
+
}
|
|
248
|
+
onBlur() {
|
|
249
|
+
if (this.disabled || !this.open || !this.hasTrigger('focus')) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
this.requestClose();
|
|
253
|
+
}
|
|
254
|
+
onClick(e) {
|
|
255
|
+
// e.button 为 0 时,为鼠标左键点击。忽略鼠标中间和右键
|
|
256
|
+
if (this.disabled || e.button || !this.hasTrigger('click')) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// 支持 hover 和 focus 触发时,点击时,不关闭 tooltip
|
|
260
|
+
if (this.open && (this.hasTrigger('hover') || this.hasTrigger('focus'))) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
this.open = !this.open;
|
|
264
|
+
}
|
|
265
|
+
onKeydown(e) {
|
|
266
|
+
if (this.disabled || !this.open || e.key !== 'Escape') {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
e.stopPropagation();
|
|
270
|
+
this.requestClose();
|
|
271
|
+
}
|
|
272
|
+
onMouseEnter() {
|
|
273
|
+
if (this.disabled || this.open || !this.hasTrigger('hover')) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (this.openDelay) {
|
|
277
|
+
window.clearTimeout(this.hoverTimeout);
|
|
278
|
+
this.hoverTimeout = window.setTimeout(() => {
|
|
279
|
+
this.open = true;
|
|
280
|
+
}, this.openDelay);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
this.open = true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
onMouseLeave() {
|
|
287
|
+
window.clearTimeout(this.hoverTimeout);
|
|
288
|
+
if (this.disabled || !this.open || !this.hasTrigger('hover')) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
// 同时使用 hover focus 时,leave 比 focus 先触发,导致 leave 后触发 focus,而显示 tooltip
|
|
292
|
+
// 所以延迟执行 leave
|
|
293
|
+
this.hoverTimeout = window.setTimeout(() => {
|
|
294
|
+
this.requestClose();
|
|
295
|
+
}, this.closeDelay || 50);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 在 document 上点击时,根据条件判断是否关闭 tooltip
|
|
299
|
+
*/
|
|
300
|
+
onDocumentClick(e) {
|
|
301
|
+
if (this.disabled || !this.open) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const path = e.composedPath();
|
|
305
|
+
// 点击 tooltip 外部区域,直接关闭
|
|
306
|
+
if (!path.includes(this)) {
|
|
307
|
+
this.requestClose();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
onWindowScroll() {
|
|
311
|
+
window.requestAnimationFrame(() => this.updatePositioner());
|
|
312
|
+
}
|
|
313
|
+
updatePositioner() {
|
|
314
|
+
const $popup = $(this.popupRef.value);
|
|
315
|
+
const targetMargin = this.isRich() ? 0 : 4; // 触发目标和 popup 之间的间距
|
|
316
|
+
const popupMargin = 4; // popup 和视口之间的间距
|
|
317
|
+
// 触发目标的位置和宽高
|
|
318
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
319
|
+
const targetTop = targetRect.top;
|
|
320
|
+
const targetLeft = targetRect.left;
|
|
321
|
+
const targetHeight = targetRect.height;
|
|
322
|
+
const targetWidth = targetRect.width;
|
|
323
|
+
// popup 的宽高
|
|
324
|
+
const popupHeight = this.popupRef.value.offsetHeight;
|
|
325
|
+
const popupWidth = this.popupRef.value.offsetWidth;
|
|
326
|
+
// popup 在 x 轴和 y 轴占据的空间
|
|
327
|
+
const popupXSpace = popupWidth + targetMargin + popupMargin;
|
|
328
|
+
const popupYSpace = popupHeight + targetMargin + popupMargin;
|
|
329
|
+
let transformOriginX;
|
|
330
|
+
let transformOriginY;
|
|
331
|
+
let top;
|
|
332
|
+
let left;
|
|
333
|
+
let placement = this.placement;
|
|
334
|
+
// 自动判断 popup 方位
|
|
335
|
+
if (placement === 'auto') {
|
|
336
|
+
const $window = $(window);
|
|
337
|
+
const hasTopSpace = targetTop > popupYSpace;
|
|
338
|
+
const hasBottomSpace = $window.height() - targetTop - targetHeight > popupYSpace;
|
|
339
|
+
const hasLeftSpace = targetLeft > popupXSpace;
|
|
340
|
+
const hasRightSpace = $window.width() - targetLeft - targetWidth > popupXSpace;
|
|
341
|
+
// rich 优先级为 bottom-right > bottom-left > top-right > top-left >
|
|
342
|
+
// bottom > top > right > left
|
|
343
|
+
if (this.isRich()) {
|
|
344
|
+
placement = 'bottom-right';
|
|
345
|
+
if (hasBottomSpace && hasRightSpace) {
|
|
346
|
+
placement = 'bottom-right';
|
|
347
|
+
}
|
|
348
|
+
else if (hasBottomSpace && hasLeftSpace) {
|
|
349
|
+
placement = 'bottom-left';
|
|
350
|
+
}
|
|
351
|
+
else if (hasTopSpace && hasRightSpace) {
|
|
352
|
+
placement = 'top-right';
|
|
353
|
+
}
|
|
354
|
+
else if (hasTopSpace && hasLeftSpace) {
|
|
355
|
+
placement = 'top-left';
|
|
356
|
+
}
|
|
357
|
+
else if (hasBottomSpace) {
|
|
358
|
+
placement = 'bottom';
|
|
359
|
+
}
|
|
360
|
+
else if (hasTopSpace) {
|
|
361
|
+
placement = 'top';
|
|
362
|
+
}
|
|
363
|
+
else if (hasRightSpace) {
|
|
364
|
+
placement = 'right';
|
|
365
|
+
}
|
|
366
|
+
else if (hasLeftSpace) {
|
|
367
|
+
placement = 'left';
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// plain 优先级为 top > bottom > left > right
|
|
371
|
+
else {
|
|
372
|
+
placement = 'top';
|
|
373
|
+
if (hasTopSpace) {
|
|
374
|
+
placement = 'top';
|
|
375
|
+
}
|
|
376
|
+
else if (hasBottomSpace) {
|
|
377
|
+
placement = 'bottom';
|
|
378
|
+
}
|
|
379
|
+
else if (hasLeftSpace) {
|
|
380
|
+
placement = 'left';
|
|
381
|
+
}
|
|
382
|
+
else if (hasRightSpace) {
|
|
383
|
+
placement = 'right';
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// 根据 placement 计算 popup 的位置和方向
|
|
388
|
+
const [position, alignment] = placement.split('-');
|
|
389
|
+
switch (position) {
|
|
390
|
+
case 'top':
|
|
391
|
+
transformOriginY = 'bottom';
|
|
392
|
+
top = targetTop - popupHeight - targetMargin;
|
|
393
|
+
break;
|
|
394
|
+
case 'bottom':
|
|
395
|
+
transformOriginY = 'top';
|
|
396
|
+
top = targetTop + targetHeight + targetMargin;
|
|
397
|
+
break;
|
|
398
|
+
default:
|
|
399
|
+
transformOriginY = 'center';
|
|
400
|
+
switch (alignment) {
|
|
401
|
+
case 'start':
|
|
402
|
+
top = targetTop;
|
|
403
|
+
break;
|
|
404
|
+
case 'end':
|
|
405
|
+
top = targetTop + targetHeight - popupHeight;
|
|
406
|
+
break;
|
|
407
|
+
default:
|
|
408
|
+
top = targetTop + targetHeight / 2 - popupHeight / 2;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
switch (position) {
|
|
414
|
+
case 'left':
|
|
415
|
+
transformOriginX = 'right';
|
|
416
|
+
left = targetLeft - popupWidth - targetMargin;
|
|
417
|
+
break;
|
|
418
|
+
case 'right':
|
|
419
|
+
transformOriginX = 'left';
|
|
420
|
+
left = targetLeft + targetWidth + targetMargin;
|
|
421
|
+
break;
|
|
422
|
+
default:
|
|
423
|
+
transformOriginX = 'center';
|
|
424
|
+
switch (alignment) {
|
|
425
|
+
case 'start':
|
|
426
|
+
left = targetLeft;
|
|
427
|
+
break;
|
|
428
|
+
case 'end':
|
|
429
|
+
left = targetLeft + targetWidth - popupWidth;
|
|
430
|
+
break;
|
|
431
|
+
case 'left':
|
|
432
|
+
transformOriginX = 'right';
|
|
433
|
+
left = targetLeft - popupWidth - targetMargin;
|
|
434
|
+
break;
|
|
435
|
+
case 'right':
|
|
436
|
+
transformOriginX = 'left';
|
|
437
|
+
left = targetLeft + targetWidth + targetMargin;
|
|
438
|
+
break;
|
|
439
|
+
default:
|
|
440
|
+
left = targetLeft + targetWidth / 2 - popupWidth / 2;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
$popup.css({
|
|
446
|
+
top,
|
|
447
|
+
left,
|
|
448
|
+
transformOrigin: [transformOriginX, transformOriginY].join(' '),
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
Tooltip.styles = [componentStyle, style];
|
|
453
|
+
__decorate([
|
|
454
|
+
property({ reflect: true })
|
|
455
|
+
], Tooltip.prototype, "variant", void 0);
|
|
456
|
+
__decorate([
|
|
457
|
+
property({ reflect: true })
|
|
458
|
+
], Tooltip.prototype, "placement", void 0);
|
|
459
|
+
__decorate([
|
|
460
|
+
property({ type: Number, reflect: true, attribute: 'open-delay' })
|
|
461
|
+
], Tooltip.prototype, "openDelay", void 0);
|
|
462
|
+
__decorate([
|
|
463
|
+
property({ type: Number, reflect: true, attribute: 'close-delay' })
|
|
464
|
+
], Tooltip.prototype, "closeDelay", void 0);
|
|
465
|
+
__decorate([
|
|
466
|
+
property({ reflect: true })
|
|
467
|
+
], Tooltip.prototype, "headline", void 0);
|
|
468
|
+
__decorate([
|
|
469
|
+
property({ reflect: true })
|
|
470
|
+
], Tooltip.prototype, "content", void 0);
|
|
471
|
+
__decorate([
|
|
472
|
+
property({ reflect: true })
|
|
473
|
+
], Tooltip.prototype, "trigger", void 0);
|
|
474
|
+
__decorate([
|
|
475
|
+
property({
|
|
476
|
+
type: Boolean,
|
|
477
|
+
reflect: true,
|
|
478
|
+
converter: booleanConverter,
|
|
479
|
+
})
|
|
480
|
+
], Tooltip.prototype, "disabled", void 0);
|
|
481
|
+
__decorate([
|
|
482
|
+
property({
|
|
483
|
+
type: Boolean,
|
|
484
|
+
reflect: true,
|
|
485
|
+
converter: booleanConverter,
|
|
486
|
+
})
|
|
487
|
+
], Tooltip.prototype, "open", void 0);
|
|
488
|
+
__decorate([
|
|
489
|
+
watch('placement', true),
|
|
490
|
+
watch('content', true)
|
|
491
|
+
], Tooltip.prototype, "onPositionChange", null);
|
|
492
|
+
__decorate([
|
|
493
|
+
watch('open')
|
|
494
|
+
], Tooltip.prototype, "onOpenChange", null);
|
|
495
|
+
Tooltip = __decorate([
|
|
496
|
+
customElement('mdui-tooltip')
|
|
497
|
+
], Tooltip);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import("lit").CSSResult;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const style = css `:host{--shape-corner-plain:var(--mdui-shape-corner-extra-small);--shape-corner-rich:var(--mdui-shape-corner-medium);--z-index:2500;display:contents}.popup{position:fixed;display:flex;flex-direction:column;z-index:var(--z-index);border-radius:var(--shape-corner-plain);background-color:rgb(var(--mdui-color-inverse-surface));padding:0 .5rem;min-width:1.75rem;max-width:20rem}:host([variant=rich]) .popup{border-radius:var(--shape-corner-rich);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);padding:.75rem 1rem .5rem 1rem}.headline{display:flex;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-title-small-size);font-weight:var(--mdui-typescale-title-small-weight);letter-spacing:var(--mdui-typescale-title-small-tracking);line-height:var(--mdui-typescale-title-small-line-height)}.content{display:flex;padding:.25rem 0;color:rgb(var(--mdui-color-inverse-on-surface));font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([variant=rich]) .content{color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}.action{display:flex;justify-content:flex-start;padding-top:.5rem}.action ::slotted(:not(:last-child)){margin-right:.5rem}`;
|