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,285 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { when } from 'lit/directives/when.js';
|
|
5
|
+
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
6
|
+
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
7
|
+
import { breakpoint } from '@mdui/shared/helpers/breakpoint.js';
|
|
8
|
+
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
9
|
+
import { emit } from '@mdui/shared/helpers/event.js';
|
|
10
|
+
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
11
|
+
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
12
|
+
import '@mdui/shared/icons/clear.js';
|
|
13
|
+
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
14
|
+
import '../button-icon.js';
|
|
15
|
+
import '../button.js';
|
|
16
|
+
import '../icon.js';
|
|
17
|
+
import { style } from './style.js';
|
|
18
|
+
/**
|
|
19
|
+
* @summary 消息条组件
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <mdui-snackbar>message</mdui-snackbar>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @event open - Snackbar 开始显示时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 Snackbar 显示
|
|
26
|
+
* @event opened - Snackbar 显示动画完成时,事件被触发
|
|
27
|
+
* @event close - Snackbar 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 Snackbar 关闭
|
|
28
|
+
* @event closed - Snackbar 隐藏动画完成时,事件被触发
|
|
29
|
+
* @event action-click - 点击操作按钮时触发
|
|
30
|
+
*
|
|
31
|
+
* @slot - Snackbar 中的消息文本内容
|
|
32
|
+
* @slot action - 右侧的操作按钮
|
|
33
|
+
* @slot close-button - 右侧的关闭按钮。必须设置 `closeable` 属性为 `true` 才会显示该按钮
|
|
34
|
+
* @slot close-icon - 右侧的关闭按钮中的图标
|
|
35
|
+
*
|
|
36
|
+
* @csspart message - 消息文本
|
|
37
|
+
* @csspart action - 操作按钮
|
|
38
|
+
* @csspart close-button - 关闭按钮
|
|
39
|
+
* @csspart close-icon - 关闭按钮中的图标
|
|
40
|
+
*
|
|
41
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
42
|
+
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
43
|
+
*/
|
|
44
|
+
export let Snackbar = class Snackbar extends LitElement {
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
/**
|
|
48
|
+
* 是否显示 Snackbar
|
|
49
|
+
*/
|
|
50
|
+
this.open = false;
|
|
51
|
+
/**
|
|
52
|
+
* Snackbar 出现的位置。默认为 `bottom`。可选值为:
|
|
53
|
+
*
|
|
54
|
+
* * `top`:位于顶部,居中对齐
|
|
55
|
+
* * `top-start`:位于顶部,左对齐
|
|
56
|
+
* * `top-end`:位于顶部,右对齐
|
|
57
|
+
* * `bottom`:位于底部,居中对齐
|
|
58
|
+
* * `bottom-start`:位于底部,左对齐
|
|
59
|
+
* * `bottom-end`:位于底部,右对齐
|
|
60
|
+
*/
|
|
61
|
+
this.placement = 'bottom';
|
|
62
|
+
/**
|
|
63
|
+
* 操作按钮是否为 loading 状态
|
|
64
|
+
*/
|
|
65
|
+
this.actionLoading = false;
|
|
66
|
+
/**
|
|
67
|
+
* 是否在右侧显示关闭按钮
|
|
68
|
+
*/
|
|
69
|
+
this.closeable = false;
|
|
70
|
+
/**
|
|
71
|
+
* 在多长时间后自动关闭(单位为毫秒)。设置为 `0` 时,不自动关闭。默认为 5 秒后自动关闭。
|
|
72
|
+
*/
|
|
73
|
+
this.autoCloseDelay = 5000;
|
|
74
|
+
/**
|
|
75
|
+
* 点击或触摸 Snackbar 以外的区域时是否关闭 Snackbar
|
|
76
|
+
*/
|
|
77
|
+
this.closeOnOutsideClick = false;
|
|
78
|
+
this.onDocumentClick = this.onDocumentClick.bind(this);
|
|
79
|
+
}
|
|
80
|
+
async onOpenChange() {
|
|
81
|
+
const isMobile = breakpoint().down('sm');
|
|
82
|
+
const isCenteredHorizontally = ['top', 'bottom'].includes(this.placement);
|
|
83
|
+
const easingLinear = getEasing(this, 'linear');
|
|
84
|
+
const easingEmphasizedDecelerate = getEasing(this, 'emphasized-decelerate');
|
|
85
|
+
const children = Array.from(this.renderRoot.querySelectorAll('.message, .action-group'));
|
|
86
|
+
// 手机上始终使用全宽的样式,但 @media 选择器中无法使用 CSS 变量,所以使用 js 来设置样式
|
|
87
|
+
const commonStyle = isMobile
|
|
88
|
+
? { left: '1rem', right: '1rem', minWidth: 0 }
|
|
89
|
+
: isCenteredHorizontally
|
|
90
|
+
? { left: '50%' }
|
|
91
|
+
: {};
|
|
92
|
+
// 打开
|
|
93
|
+
// 要区分是否首次渲染,首次渲染时不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
94
|
+
if (this.open) {
|
|
95
|
+
const hasUpdated = this.hasUpdated;
|
|
96
|
+
if (!hasUpdated) {
|
|
97
|
+
await this.updateComplete;
|
|
98
|
+
}
|
|
99
|
+
if (hasUpdated) {
|
|
100
|
+
const requestOpen = emit(this, 'open', { cancelable: true });
|
|
101
|
+
if (requestOpen.defaultPrevented) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
window.clearTimeout(this.closeTimeout);
|
|
106
|
+
if (this.autoCloseDelay) {
|
|
107
|
+
this.closeTimeout = window.setTimeout(() => {
|
|
108
|
+
this.open = false;
|
|
109
|
+
}, this.autoCloseDelay);
|
|
110
|
+
}
|
|
111
|
+
this.style.display = 'flex';
|
|
112
|
+
await Promise.all([
|
|
113
|
+
stopAnimations(this),
|
|
114
|
+
...children.map((child) => stopAnimations(child)),
|
|
115
|
+
]);
|
|
116
|
+
const duration = getDuration(this, 'medium4');
|
|
117
|
+
const getOpenStyle = (ident) => {
|
|
118
|
+
const scaleY = `scaleY(${ident === 'start' ? 0 : 1})`;
|
|
119
|
+
if (isMobile) {
|
|
120
|
+
return { transform: scaleY };
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return {
|
|
124
|
+
transform: [
|
|
125
|
+
scaleY,
|
|
126
|
+
isCenteredHorizontally ? 'translateX(-50%)' : '',
|
|
127
|
+
]
|
|
128
|
+
.filter((i) => i)
|
|
129
|
+
.join(' '),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
await Promise.all([
|
|
134
|
+
animateTo(this, [
|
|
135
|
+
{ ...getOpenStyle('start'), ...commonStyle },
|
|
136
|
+
{ ...getOpenStyle('end'), ...commonStyle },
|
|
137
|
+
], {
|
|
138
|
+
duration: hasUpdated ? duration : 0,
|
|
139
|
+
easing: easingEmphasizedDecelerate,
|
|
140
|
+
fill: 'forwards',
|
|
141
|
+
}),
|
|
142
|
+
animateTo(this, [{ opacity: 0 }, { opacity: 1, offset: 0.5 }, { opacity: 1 }], {
|
|
143
|
+
duration: hasUpdated ? duration : 0,
|
|
144
|
+
easing: easingLinear,
|
|
145
|
+
fill: 'forwards',
|
|
146
|
+
}),
|
|
147
|
+
...children.map((child) => animateTo(child, [
|
|
148
|
+
{ opacity: 0 },
|
|
149
|
+
{ opacity: 0, offset: 0.2 },
|
|
150
|
+
{ opacity: 1, offset: 0.8 },
|
|
151
|
+
{ opacity: 1 },
|
|
152
|
+
], {
|
|
153
|
+
duration: hasUpdated ? duration : 0,
|
|
154
|
+
easing: easingLinear,
|
|
155
|
+
})),
|
|
156
|
+
]);
|
|
157
|
+
if (hasUpdated) {
|
|
158
|
+
emit(this, 'opened');
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// 关闭
|
|
163
|
+
if (!this.open && this.hasUpdated) {
|
|
164
|
+
const requestClose = emit(this, 'close', { cancelable: true });
|
|
165
|
+
if (requestClose.defaultPrevented) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
window.clearTimeout(this.closeTimeout);
|
|
169
|
+
await Promise.all([
|
|
170
|
+
stopAnimations(this),
|
|
171
|
+
...children.map((child) => stopAnimations(child)),
|
|
172
|
+
]);
|
|
173
|
+
const duration = getDuration(this, 'short4');
|
|
174
|
+
const getCloseStyle = (ident) => {
|
|
175
|
+
const opacity = ident === 'start' ? 1 : 0;
|
|
176
|
+
const styles = { opacity };
|
|
177
|
+
if (!isMobile && isCenteredHorizontally) {
|
|
178
|
+
Object.assign(styles, { transform: 'translateX(-50%)' });
|
|
179
|
+
}
|
|
180
|
+
return styles;
|
|
181
|
+
};
|
|
182
|
+
await Promise.all([
|
|
183
|
+
animateTo(this, [
|
|
184
|
+
{ ...getCloseStyle('start'), ...commonStyle },
|
|
185
|
+
{ ...getCloseStyle('end'), ...commonStyle },
|
|
186
|
+
], {
|
|
187
|
+
duration,
|
|
188
|
+
easing: easingLinear,
|
|
189
|
+
fill: 'forwards',
|
|
190
|
+
}),
|
|
191
|
+
...children.map((child) => animateTo(child, [{ opacity: 1 }, { opacity: 0, offset: 0.75 }, { opacity: 0 }], { duration, easing: easingLinear })),
|
|
192
|
+
]);
|
|
193
|
+
this.style.display = 'none';
|
|
194
|
+
emit(this, 'closed');
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
connectedCallback() {
|
|
199
|
+
super.connectedCallback();
|
|
200
|
+
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
201
|
+
}
|
|
202
|
+
disconnectedCallback() {
|
|
203
|
+
super.disconnectedCallback();
|
|
204
|
+
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
205
|
+
}
|
|
206
|
+
render() {
|
|
207
|
+
return html `<slot part="message" class="message"></slot><div class="action-group"><slot name="action" part="action" class="action" @click="${this.onActionClick}">${this.action
|
|
208
|
+
? html `<mdui-button variant="text" loading="${this.actionLoading}">${this.action}</mdui-button>`
|
|
209
|
+
: nothingTemplate}</slot>${when(this.closeable, () => html `<slot name="close-button" part="close-button" class="close-button" @click="${this.onCloseClick}"><mdui-button-icon><slot name="close-icon" part="close-icon">${this.closeIcon
|
|
210
|
+
? html `<mdui-icon name="${this.closeIcon}" class="i"></mdui-icon>`
|
|
211
|
+
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}</slot></mdui-button-icon></slot>`)}</div>`;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 在 document 上点击时,根据条件判断是否要关闭 snackbar
|
|
215
|
+
*/
|
|
216
|
+
onDocumentClick(e) {
|
|
217
|
+
if (!this.open || !this.closeOnOutsideClick) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const target = e.target;
|
|
221
|
+
if (!this.contains(target) && this !== target) {
|
|
222
|
+
this.open = false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
onActionClick(event) {
|
|
226
|
+
event.stopPropagation();
|
|
227
|
+
emit(this, 'action-click');
|
|
228
|
+
}
|
|
229
|
+
onCloseClick() {
|
|
230
|
+
this.open = false;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
Snackbar.styles = [componentStyle, style];
|
|
234
|
+
__decorate([
|
|
235
|
+
property({
|
|
236
|
+
type: Boolean,
|
|
237
|
+
reflect: true,
|
|
238
|
+
converter: booleanConverter,
|
|
239
|
+
})
|
|
240
|
+
], Snackbar.prototype, "open", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ reflect: true })
|
|
243
|
+
], Snackbar.prototype, "placement", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
property({ reflect: true, attribute: 'action' })
|
|
246
|
+
], Snackbar.prototype, "action", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({
|
|
249
|
+
type: Boolean,
|
|
250
|
+
reflect: true,
|
|
251
|
+
converter: booleanConverter,
|
|
252
|
+
attribute: 'action-loading',
|
|
253
|
+
})
|
|
254
|
+
], Snackbar.prototype, "actionLoading", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({
|
|
257
|
+
type: Boolean,
|
|
258
|
+
reflect: true,
|
|
259
|
+
converter: booleanConverter,
|
|
260
|
+
})
|
|
261
|
+
], Snackbar.prototype, "closeable", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
property({ reflect: true, attribute: 'close-icon' })
|
|
264
|
+
], Snackbar.prototype, "closeIcon", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
property({ type: Number, reflect: true, attribute: 'message-line' })
|
|
267
|
+
// eslint-disable-next-line prettier/prettier
|
|
268
|
+
], Snackbar.prototype, "messageLine", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
property({ type: Number, reflect: true, attribute: 'auto-close-delay' })
|
|
271
|
+
], Snackbar.prototype, "autoCloseDelay", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
property({
|
|
274
|
+
type: Boolean,
|
|
275
|
+
reflect: true,
|
|
276
|
+
attribute: 'close-on-outside-click',
|
|
277
|
+
converter: booleanConverter,
|
|
278
|
+
})
|
|
279
|
+
], Snackbar.prototype, "closeOnOutsideClick", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
watch('open')
|
|
282
|
+
], Snackbar.prototype, "onOpenChange", null);
|
|
283
|
+
Snackbar = __decorate([
|
|
284
|
+
customElement('mdui-snackbar')
|
|
285
|
+
], Snackbar);
|
|
@@ -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:var(--mdui-shape-corner-extra-small);--z-index:2400;position:fixed;z-index:var(--z-index);display:none;align-items:center;flex-wrap:wrap;border-radius:var(--shape-corner);min-width:20rem;max-width:36rem;padding:.25rem 0;box-shadow:var(--mdui-elevation-level3);background-color:rgb(var(--mdui-color-inverse-surface));color:rgb(var(--mdui-color-inverse-on-surface));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)}:host([placement^=top]){transform-origin:top;top:1rem}:host([placement^=bottom]){transform-origin:bottom;bottom:1rem}:host([placement=bottom-start]),:host([placement=top-start]){left:1rem}:host([placement=bottom-end]),:host([placement=top-end]){right:1rem}.message{display:block;margin:.625rem 1rem}:host([message-line='1']) .message{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([message-line='2']) .message{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2}.action-group{display:flex;align-items:center;margin-left:auto;padding-right:.5rem}.action,.close-button{display:inline-flex;align-items:center;justify-content:center}.action{color:rgb(var(--mdui-color-inverse-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.action mdui-button,::slotted(mdui-button[slot=action][variant=outlined]),::slotted(mdui-button[slot=action][variant=text]){color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-primary)}.action mdui-button::part(button){padding:0 .5rem}.close-button{margin:0 -.25rem 0 .25rem;font-size:1.5rem;color:rgb(var(--mdui-color-inverse-on-surface))}.close-button mdui-button-icon,::slotted(mdui-button-icon[slot=close-button][variant=outlined]),::slotted(mdui-button-icon[slot=close-button][variant=standard]){font-size:inherit;color:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}.close-button .i,::slotted([slot=close-icon]){font-size:inherit}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './snackbar/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './snackbar/index.js';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '@mdui/shared/icons/check.js';
|
|
3
|
+
import '../icon.js';
|
|
4
|
+
import type { Ripple } from '../ripple/index.js';
|
|
5
|
+
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
6
|
+
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
7
|
+
declare const Switch_base: import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof LitElement;
|
|
8
|
+
/**
|
|
9
|
+
* @summary 开关切换组件
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <mdui-switch></mdui-switch>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @event focus - 获得焦点时触发
|
|
16
|
+
* @event blur - 失去焦点时触发
|
|
17
|
+
* @event change - 选中状态变更时触发
|
|
18
|
+
* @event input - 选中状态变更时触发
|
|
19
|
+
* @event invalid - 表单字段验证不通过时触发
|
|
20
|
+
*
|
|
21
|
+
* @slot unchecked-icon - 未选中状态的元素
|
|
22
|
+
* @slot checked-icon - 选中状态的元素
|
|
23
|
+
*
|
|
24
|
+
* @csspart track - 轨道
|
|
25
|
+
* @csspart thumb - 图标容器
|
|
26
|
+
* @csspart unchecked-icon - 未选中状态的图标
|
|
27
|
+
* @csspart checked-icon 选中状态的图标
|
|
28
|
+
*
|
|
29
|
+
* @cssprop --shape-corner - 组件的轨道的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
+
* @cssprop --shape-corner-thumb - 组件的图标容器的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
31
|
+
*/
|
|
32
|
+
export declare class Switch extends Switch_base implements FormControl {
|
|
33
|
+
static styles: CSSResultGroup;
|
|
34
|
+
/**
|
|
35
|
+
* 是否为禁用状态
|
|
36
|
+
*/
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 是否为选中状态
|
|
40
|
+
*/
|
|
41
|
+
checked: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 默认选中状态。在重置表单时,将重置为该默认状态。该属性只能通过 JavaScript 属性设置
|
|
44
|
+
*/
|
|
45
|
+
defaultChecked: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 未选中状态的 Material Icons 图标名。也可以通过 `slot="unchecked-icon"` 设置
|
|
48
|
+
*/
|
|
49
|
+
uncheckedIcon?: string;
|
|
50
|
+
/**
|
|
51
|
+
* 选中状态的 Material Icons 图标名。也可以通过 `slot="checked-icon"` 设置
|
|
52
|
+
*
|
|
53
|
+
* 默认为 check 图标,可传入空字符串移除默认图标
|
|
54
|
+
*/
|
|
55
|
+
checkedIcon?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 提交表单时,是否必须选中该开关
|
|
58
|
+
*/
|
|
59
|
+
required: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 关联的 `form` 元素。此属性值必须为同一页面中的一个 `<form>` 元素的 `id` 属性。
|
|
62
|
+
*
|
|
63
|
+
* 如果此属性未指定,则元素必须是 `form` 元素的后代。利用此属性,你可以将元素放置在页面中的任何位置,而不仅仅是作为 `form` 元素的后代。
|
|
64
|
+
*/
|
|
65
|
+
form?: string;
|
|
66
|
+
/**
|
|
67
|
+
* 开关的名称,将与表单数据一起提交
|
|
68
|
+
*/
|
|
69
|
+
name: string;
|
|
70
|
+
/**
|
|
71
|
+
* 开关的值,将于表单数据一起提交
|
|
72
|
+
*/
|
|
73
|
+
value: string;
|
|
74
|
+
/**
|
|
75
|
+
* 是否验证未通过
|
|
76
|
+
*/
|
|
77
|
+
private invalid;
|
|
78
|
+
private readonly rippleRef;
|
|
79
|
+
private readonly inputRef;
|
|
80
|
+
private readonly formController;
|
|
81
|
+
private readonly hasSlotController;
|
|
82
|
+
/**
|
|
83
|
+
* 表单验证状态对象
|
|
84
|
+
*/
|
|
85
|
+
get validity(): ValidityState;
|
|
86
|
+
/**
|
|
87
|
+
* 表单验证的错误提示信息
|
|
88
|
+
*/
|
|
89
|
+
get validationMessage(): string;
|
|
90
|
+
protected get rippleElement(): Ripple;
|
|
91
|
+
protected get rippleDisabled(): boolean;
|
|
92
|
+
protected get focusElement(): HTMLElement;
|
|
93
|
+
protected get focusDisabled(): boolean;
|
|
94
|
+
private onDisabledChange;
|
|
95
|
+
private onCheckedChange;
|
|
96
|
+
/**
|
|
97
|
+
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
|
|
98
|
+
*/
|
|
99
|
+
checkValidity(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`。
|
|
102
|
+
*
|
|
103
|
+
* 验证未通过时,还将在组件上显示未通过的提示。
|
|
104
|
+
*/
|
|
105
|
+
reportValidity(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* 设置自定义的错误提示文本。只要文本不为空,则表示字段验证未通过
|
|
108
|
+
*
|
|
109
|
+
* @param message 自定义的提示文本
|
|
110
|
+
*/
|
|
111
|
+
setCustomValidity(message: string): void;
|
|
112
|
+
protected render(): TemplateResult;
|
|
113
|
+
/**
|
|
114
|
+
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|
|
115
|
+
*/
|
|
116
|
+
private onChange;
|
|
117
|
+
}
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
'mdui-switch': Switch;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import { live } from 'lit/directives/live.js';
|
|
7
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
8
|
+
import { FormController, formResets } from '@mdui/shared/controllers/form.js';
|
|
9
|
+
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
10
|
+
import { defaultValue } from '@mdui/shared/decorators/default-value.js';
|
|
11
|
+
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
12
|
+
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
13
|
+
import { emit } from '@mdui/shared/helpers/event.js';
|
|
14
|
+
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
15
|
+
import '@mdui/shared/icons/check.js';
|
|
16
|
+
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
|
+
import { FocusableMixin } from '@mdui/shared/mixins/focusable.js';
|
|
18
|
+
import '../icon.js';
|
|
19
|
+
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
20
|
+
import { style } from './style.js';
|
|
21
|
+
/**
|
|
22
|
+
* @summary 开关切换组件
|
|
23
|
+
*
|
|
24
|
+
* ```html
|
|
25
|
+
* <mdui-switch></mdui-switch>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @event focus - 获得焦点时触发
|
|
29
|
+
* @event blur - 失去焦点时触发
|
|
30
|
+
* @event change - 选中状态变更时触发
|
|
31
|
+
* @event input - 选中状态变更时触发
|
|
32
|
+
* @event invalid - 表单字段验证不通过时触发
|
|
33
|
+
*
|
|
34
|
+
* @slot unchecked-icon - 未选中状态的元素
|
|
35
|
+
* @slot checked-icon - 选中状态的元素
|
|
36
|
+
*
|
|
37
|
+
* @csspart track - 轨道
|
|
38
|
+
* @csspart thumb - 图标容器
|
|
39
|
+
* @csspart unchecked-icon - 未选中状态的图标
|
|
40
|
+
* @csspart checked-icon 选中状态的图标
|
|
41
|
+
*
|
|
42
|
+
* @cssprop --shape-corner - 组件的轨道的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
|
+
* @cssprop --shape-corner-thumb - 组件的图标容器的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
44
|
+
*/
|
|
45
|
+
export let Switch = class Switch extends RippleMixin(FocusableMixin(LitElement)) {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
/**
|
|
49
|
+
* 是否为禁用状态
|
|
50
|
+
*/
|
|
51
|
+
this.disabled = false;
|
|
52
|
+
/**
|
|
53
|
+
* 是否为选中状态
|
|
54
|
+
*/
|
|
55
|
+
this.checked = false;
|
|
56
|
+
/**
|
|
57
|
+
* 默认选中状态。在重置表单时,将重置为该默认状态。该属性只能通过 JavaScript 属性设置
|
|
58
|
+
*/
|
|
59
|
+
this.defaultChecked = false;
|
|
60
|
+
/**
|
|
61
|
+
* 提交表单时,是否必须选中该开关
|
|
62
|
+
*/
|
|
63
|
+
this.required = false;
|
|
64
|
+
/**
|
|
65
|
+
* 开关的名称,将与表单数据一起提交
|
|
66
|
+
*/
|
|
67
|
+
this.name = '';
|
|
68
|
+
/**
|
|
69
|
+
* 开关的值,将于表单数据一起提交
|
|
70
|
+
*/
|
|
71
|
+
this.value = 'on';
|
|
72
|
+
/**
|
|
73
|
+
* 是否验证未通过
|
|
74
|
+
*/
|
|
75
|
+
this.invalid = false;
|
|
76
|
+
this.rippleRef = createRef();
|
|
77
|
+
this.inputRef = createRef();
|
|
78
|
+
this.formController = new FormController(this, {
|
|
79
|
+
value: (control) => (control.checked ? control.value : undefined),
|
|
80
|
+
defaultValue: (control) => control.defaultChecked,
|
|
81
|
+
setValue: (control, checked) => (control.checked = checked),
|
|
82
|
+
});
|
|
83
|
+
this.hasSlotController = new HasSlotController(this, 'unchecked-icon');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 表单验证状态对象
|
|
87
|
+
*/
|
|
88
|
+
get validity() {
|
|
89
|
+
return this.inputRef.value.validity;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 表单验证的错误提示信息
|
|
93
|
+
*/
|
|
94
|
+
get validationMessage() {
|
|
95
|
+
return this.inputRef.value.validationMessage;
|
|
96
|
+
}
|
|
97
|
+
get rippleElement() {
|
|
98
|
+
return this.rippleRef.value;
|
|
99
|
+
}
|
|
100
|
+
get rippleDisabled() {
|
|
101
|
+
return this.disabled;
|
|
102
|
+
}
|
|
103
|
+
get focusElement() {
|
|
104
|
+
return this.inputRef.value;
|
|
105
|
+
}
|
|
106
|
+
get focusDisabled() {
|
|
107
|
+
return this.disabled;
|
|
108
|
+
}
|
|
109
|
+
async onDisabledChange() {
|
|
110
|
+
await this.updateComplete;
|
|
111
|
+
this.invalid = !this.inputRef.value.checkValidity();
|
|
112
|
+
}
|
|
113
|
+
async onCheckedChange() {
|
|
114
|
+
var _a;
|
|
115
|
+
await this.updateComplete;
|
|
116
|
+
// reset 引起的值变更,不执行验证;直接修改值引起的变更,需要进行验证
|
|
117
|
+
const form = this.formController.getForm();
|
|
118
|
+
if (form && ((_a = formResets.get(form)) === null || _a === void 0 ? void 0 : _a.has(this))) {
|
|
119
|
+
this.invalid = false;
|
|
120
|
+
formResets.get(form).delete(this);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.invalid = !this.inputRef.value.checkValidity();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
|
|
128
|
+
*/
|
|
129
|
+
checkValidity() {
|
|
130
|
+
const valid = this.inputRef.value.checkValidity();
|
|
131
|
+
if (!valid) {
|
|
132
|
+
emit(this, 'invalid', {
|
|
133
|
+
bubbles: false,
|
|
134
|
+
cancelable: true,
|
|
135
|
+
composed: false,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return valid;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`。
|
|
142
|
+
*
|
|
143
|
+
* 验证未通过时,还将在组件上显示未通过的提示。
|
|
144
|
+
*/
|
|
145
|
+
reportValidity() {
|
|
146
|
+
this.invalid = !this.inputRef.value.reportValidity();
|
|
147
|
+
if (this.invalid) {
|
|
148
|
+
const requestInvalid = emit(this, 'invalid', {
|
|
149
|
+
bubbles: false,
|
|
150
|
+
cancelable: true,
|
|
151
|
+
composed: false,
|
|
152
|
+
});
|
|
153
|
+
// 调用了 preventDefault() 时,隐藏默认的表单错误提示
|
|
154
|
+
if (requestInvalid.defaultPrevented) {
|
|
155
|
+
this.blur();
|
|
156
|
+
this.focus();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return !this.invalid;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 设置自定义的错误提示文本。只要文本不为空,则表示字段验证未通过
|
|
163
|
+
*
|
|
164
|
+
* @param message 自定义的提示文本
|
|
165
|
+
*/
|
|
166
|
+
setCustomValidity(message) {
|
|
167
|
+
this.inputRef.value.setCustomValidity(message);
|
|
168
|
+
this.invalid = !this.inputRef.value.checkValidity();
|
|
169
|
+
}
|
|
170
|
+
render() {
|
|
171
|
+
return html `<label class="${classMap({
|
|
172
|
+
'has-unchecked-icon': this.uncheckedIcon || this.hasSlotController.test('unchecked-icon'),
|
|
173
|
+
})}"><input ${ref(this.inputRef)} type="checkbox" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .disabled="${this.disabled}" .checked="${live(this.checked)}" .required="${this.required}" @change="${this.onChange}"><div part="track" class="track"><div part="thumb" class="thumb"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="checked-icon" part="checked-icon" class="checked-icon">${this.checkedIcon
|
|
174
|
+
? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
|
|
175
|
+
: this.checkedIcon === ''
|
|
176
|
+
? nothingTemplate
|
|
177
|
+
: html `<mdui-icon-check class="i"></mdui-icon-check>`}</slot><slot name="unchecked-icon" part="unchecked-icon" class="unchecked-icon">${this.uncheckedIcon
|
|
178
|
+
? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
|
|
179
|
+
: nothingTemplate}</slot></div></div></label>`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|
|
183
|
+
*/
|
|
184
|
+
onChange() {
|
|
185
|
+
this.checked = this.inputRef.value.checked;
|
|
186
|
+
emit(this, 'change');
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
Switch.styles = [componentStyle, style];
|
|
190
|
+
__decorate([
|
|
191
|
+
property({
|
|
192
|
+
type: Boolean,
|
|
193
|
+
reflect: true,
|
|
194
|
+
converter: booleanConverter,
|
|
195
|
+
})
|
|
196
|
+
], Switch.prototype, "disabled", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
property({
|
|
199
|
+
type: Boolean,
|
|
200
|
+
reflect: true,
|
|
201
|
+
converter: booleanConverter,
|
|
202
|
+
})
|
|
203
|
+
], Switch.prototype, "checked", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
defaultValue('checked')
|
|
206
|
+
], Switch.prototype, "defaultChecked", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ reflect: true, attribute: 'unchecked-icon' })
|
|
209
|
+
], Switch.prototype, "uncheckedIcon", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ reflect: true, attribute: 'checked-icon' })
|
|
212
|
+
], Switch.prototype, "checkedIcon", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({
|
|
215
|
+
type: Boolean,
|
|
216
|
+
reflect: true,
|
|
217
|
+
converter: booleanConverter,
|
|
218
|
+
})
|
|
219
|
+
], Switch.prototype, "required", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ reflect: true })
|
|
222
|
+
], Switch.prototype, "form", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ reflect: true })
|
|
225
|
+
], Switch.prototype, "name", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ reflect: true })
|
|
228
|
+
], Switch.prototype, "value", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({
|
|
231
|
+
type: Boolean,
|
|
232
|
+
reflect: true,
|
|
233
|
+
converter: booleanConverter,
|
|
234
|
+
})
|
|
235
|
+
], Switch.prototype, "invalid", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
watch('disabled', true),
|
|
238
|
+
watch('required', true)
|
|
239
|
+
], Switch.prototype, "onDisabledChange", null);
|
|
240
|
+
__decorate([
|
|
241
|
+
watch('checked', true)
|
|
242
|
+
], Switch.prototype, "onCheckedChange", null);
|
|
243
|
+
Switch = __decorate([
|
|
244
|
+
customElement('mdui-switch')
|
|
245
|
+
], Switch);
|
|
@@ -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:var(--mdui-shape-corner-full);--shape-corner-thumb:var(--mdui-shape-corner-full);position:relative;display:inline-block;cursor:pointer;-webkit-tap-highlight-color:transparent;height:2.5rem}:host([disabled]){cursor:default;pointer-events:none}label{display:inline-flex;align-items:center;width:100%;height:100%;white-space:nowrap;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}.track{position:relative;display:flex;align-items:center;border-radius:var(--shape-corner);transition-property:background-color,border-width;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);height:2rem;width:3.25rem;border:.125rem solid rgb(var(--mdui-color-outline));background-color:rgb(var(--mdui-color-surface-container-highest))}:host([checked]) .track{background-color:rgb(var(--mdui-color-primary));border-width:0}:host([invalid]) .track{background-color:rgb(var(--mdui-color-error-container));border-color:rgb(var(--mdui-color-error))}:host([disabled]) .track{background-color:rgba(var(--mdui-color-surface-container-highest),.12);border-color:rgba(var(--mdui-color-on-surface),.12)}:host([disabled][checked]) .track{background-color:rgba(var(--mdui-color-on-surface),.12)}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.25rem;height:1.25rem;margin:0 0 0 .625rem}mdui-ripple{border-radius:50%;transition-property:left,top;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);width:2.5rem;height:2.5rem}.thumb{position:absolute;display:flex;align-items:center;justify-content:center;border-radius:var(--shape-corner-thumb);transition-property:width,height,left,background-color;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);height:1rem;width:1rem;left:.375rem;background-color:rgb(var(--mdui-color-outline));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.thumb mdui-ripple{left:-.75rem;top:-.75rem}.has-unchecked-icon .thumb{height:1.5rem;width:1.5rem;left:.125rem}.has-unchecked-icon .thumb mdui-ripple{left:-.5rem;top:-.5rem}:host([focus-visible]) .thumb,:host([hover]) .thumb,:host([pressed]) .thumb{background-color:rgb(var(--mdui-color-on-surface-variant))}:host([checked]) .thumb{height:1.5rem;width:1.5rem;left:1.5rem;background-color:rgb(var(--mdui-color-on-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .thumb mdui-ripple{left:-.5rem;top:-.5rem}:host([pressed]) .thumb{height:1.75rem;width:1.75rem;left:0}:host([pressed]) .thumb mdui-ripple{left:-.375rem;top:-.375rem}:host([pressed][checked]) .thumb{left:1.375rem}:host([focus-visible][checked]) .thumb,:host([hover][checked]) .thumb,:host([pressed][checked]) .thumb{background-color:rgb(var(--mdui-color-primary-container))}:host([invalid]) .thumb{background-color:rgb(var(--mdui-color-error));--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}:host([focus-visible][invalid]) .thumb,:host([hover][invalid]) .thumb,:host([pressed][invalid]) .thumb{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .thumb{background-color:rgba(var(--mdui-color-on-surface),.38)}:host([disabled][checked]) .thumb{background-color:rgb(var(--mdui-color-surface))}.checked-icon,.unchecked-icon{display:flex;position:absolute;transition-property:opacity,transform;font-size:1rem}.unchecked-icon{opacity:1;transform:scale(1);transition-delay:var(--mdui-motion-duration-short1);transition-duration:var(--mdui-motion-duration-short3);transition-timing-function:var(--mdui-motion-easing-linear);color:rgb(var(--mdui-color-surface-container-highest))}:host([checked]) .unchecked-icon{opacity:0;transform:scale(.92);transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1)}:host([disabled]) .unchecked-icon{color:rgba(var(--mdui-color-surface-container-highest),.38)}.checked-icon{opacity:0;transform:scale(.92);transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1);transition-timing-function:var(--mdui-motion-easing-linear);color:rgb(var(--mdui-color-on-primary-container))}:host([checked]) .checked-icon{opacity:1;transform:scale(1);transition-delay:var(--mdui-motion-duration-short1);transition-duration:var(--mdui-motion-duration-short3)}:host([invalid]) .checked-icon{color:rgb(var(--mdui-color-error-container))}:host([disabled]) .checked-icon{color:rgba(var(--mdui-color-on-surface),.38)}.checked-icon .i,.unchecked-icon .i,::slotted([slot=checked-icon]),::slotted([slot=unchecked-icon]){font-size:inherit;color:inherit}`;
|