kdutify 0.16.9-rc.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 +21 -0
- package/README.md +70 -0
- package/dist/kdutify.css +12850 -0
- package/dist/kdutify.css.map +1 -0
- package/dist/kdutify.js +16285 -0
- package/dist/kdutify.js.map +1 -0
- package/dist/kdutify.min.css +7 -0
- package/dist/kdutify.min.css.map +1 -0
- package/dist/kdutify.min.js +6 -0
- package/es5/components/KAlert/KAlert.js +80 -0
- package/es5/components/KAlert/index.js +7 -0
- package/es5/components/KApp/KApp.js +67 -0
- package/es5/components/KApp/index.js +7 -0
- package/es5/components/KAvatar/KAvatar.js +31 -0
- package/es5/components/KAvatar/index.js +7 -0
- package/es5/components/KBadge/KBadge.js +59 -0
- package/es5/components/KBadge/index.js +7 -0
- package/es5/components/KBottomNav/KBottomNav.js +50 -0
- package/es5/components/KBottomNav/index.js +7 -0
- package/es5/components/KBottomSheet/KBottomSheet.js +36 -0
- package/es5/components/KBottomSheet/index.js +7 -0
- package/es5/components/KBreadcrumbs/KBreadcrumbs.js +36 -0
- package/es5/components/KBreadcrumbs/KBreadcrumbsItem.js +38 -0
- package/es5/components/KBreadcrumbs/index.js +11 -0
- package/es5/components/KBtn/KBtn.js +153 -0
- package/es5/components/KBtn/index.js +7 -0
- package/es5/components/KBtnToggle/KBtnToggle.js +92 -0
- package/es5/components/KBtnToggle/index.js +7 -0
- package/es5/components/KCard/KCard.js +63 -0
- package/es5/components/KCard/KCardMedia.js +41 -0
- package/es5/components/KCard/KCardTitle.js +21 -0
- package/es5/components/KCard/index.js +19 -0
- package/es5/components/KCarousel/KCarousel.js +178 -0
- package/es5/components/KCarousel/KCarouselItem.js +63 -0
- package/es5/components/KCarousel/index.js +11 -0
- package/es5/components/KCheckbox/KCheckbox.js +89 -0
- package/es5/components/KCheckbox/index.js +7 -0
- package/es5/components/KChip/KChip.js +81 -0
- package/es5/components/KChip/index.js +7 -0
- package/es5/components/KDataTable/KDataTable.js +347 -0
- package/es5/components/KDataTable/KEditDialog.js +108 -0
- package/es5/components/KDataTable/index.js +14 -0
- package/es5/components/KDataTable/mixins/body.js +103 -0
- package/es5/components/KDataTable/mixins/foot.js +118 -0
- package/es5/components/KDataTable/mixins/head.js +123 -0
- package/es5/components/KDataTable/mixins/progress.js +16 -0
- package/es5/components/KDatePicker/KDatePicker.js +416 -0
- package/es5/components/KDatePicker/index.js +7 -0
- package/es5/components/KDatePicker/mixins/date-header.js +68 -0
- package/es5/components/KDatePicker/mixins/date-table.js +101 -0
- package/es5/components/KDatePicker/mixins/date-title.js +64 -0
- package/es5/components/KDatePicker/mixins/date-years.js +53 -0
- package/es5/components/KDatePicker/mixins/month-table.js +91 -0
- package/es5/components/KDialog/KDialog.js +181 -0
- package/es5/components/KDialog/index.js +7 -0
- package/es5/components/KDivider/KDivider.js +29 -0
- package/es5/components/KDivider/index.js +7 -0
- package/es5/components/KExpansionPanel/KExpansionPanel.js +60 -0
- package/es5/components/KExpansionPanel/KExpansionPanelContent.js +114 -0
- package/es5/components/KExpansionPanel/index.js +9 -0
- package/es5/components/KFooter/KFooter.js +61 -0
- package/es5/components/KFooter/index.js +7 -0
- package/es5/components/KForm/KForm.js +203 -0
- package/es5/components/KForm/index.js +7 -0
- package/es5/components/KGrid/KContainer.js +5 -0
- package/es5/components/KGrid/KContent.js +33 -0
- package/es5/components/KGrid/KFlex.js +5 -0
- package/es5/components/KGrid/KLayout.js +5 -0
- package/es5/components/KGrid/grid.js +43 -0
- package/es5/components/KGrid/index.js +20 -0
- package/es5/components/KIcon/KIcon.js +93 -0
- package/es5/components/KIcon/index.js +7 -0
- package/es5/components/KList/KList.js +82 -0
- package/es5/components/KList/KListGroup.js +100 -0
- package/es5/components/KList/KListTile.js +65 -0
- package/es5/components/KList/KListTileAction.js +15 -0
- package/es5/components/KList/index.js +27 -0
- package/es5/components/KMenu/KMenu.js +178 -0
- package/es5/components/KMenu/index.js +7 -0
- package/es5/components/KMenu/mixins/menu-activator.js +59 -0
- package/es5/components/KMenu/mixins/menu-generators.js +88 -0
- package/es5/components/KMenu/mixins/menu-keyable.js +64 -0
- package/es5/components/KMenu/mixins/menu-position.js +64 -0
- package/es5/components/KNavigationDrawer/KNavigationDrawer.js +238 -0
- package/es5/components/KNavigationDrawer/index.js +7 -0
- package/es5/components/KPagination/KPagination.js +167 -0
- package/es5/components/KPagination/index.js +7 -0
- package/es5/components/KParallax/KParallax.js +98 -0
- package/es5/components/KParallax/index.js +7 -0
- package/es5/components/KProgressCircular/KProgressCircular.js +145 -0
- package/es5/components/KProgressCircular/index.js +7 -0
- package/es5/components/KProgressLinear/KProgressLinear.js +146 -0
- package/es5/components/KProgressLinear/index.js +7 -0
- package/es5/components/KRadioGroup/KRadio.js +148 -0
- package/es5/components/KRadioGroup/KRadioGroup.js +139 -0
- package/es5/components/KRadioGroup/index.js +11 -0
- package/es5/components/KSelect/KSelect.js +635 -0
- package/es5/components/KSelect/index.js +7 -0
- package/es5/components/KSelect/mixins/select-autocomplete.js +125 -0
- package/es5/components/KSelect/mixins/select-generators.js +298 -0
- package/es5/components/KSlider/KSlider.js +306 -0
- package/es5/components/KSlider/index.js +7 -0
- package/es5/components/KSnackbar/KSnackbar.js +106 -0
- package/es5/components/KSnackbar/index.js +7 -0
- package/es5/components/KSpeedDial/KSpeedDial.js +89 -0
- package/es5/components/KSpeedDial/index.js +7 -0
- package/es5/components/KStepper/KStepper.js +112 -0
- package/es5/components/KStepper/KStepperContent.js +134 -0
- package/es5/components/KStepper/KStepperStep.js +105 -0
- package/es5/components/KStepper/index.js +17 -0
- package/es5/components/KSubheader/KSubheader.js +29 -0
- package/es5/components/KSubheader/index.js +7 -0
- package/es5/components/KSwitch/KSwitch.js +55 -0
- package/es5/components/KSwitch/index.js +7 -0
- package/es5/components/KSystemBar/KSystemBar.js +54 -0
- package/es5/components/KSystemBar/index.js +7 -0
- package/es5/components/KTabs/KTabs.js +272 -0
- package/es5/components/KTabs/KTabsBar.js +205 -0
- package/es5/components/KTabs/KTabsContent.js +86 -0
- package/es5/components/KTabs/KTabsItem.js +103 -0
- package/es5/components/KTabs/KTabsItems.js +40 -0
- package/es5/components/KTabs/KTabsSlider.js +14 -0
- package/es5/components/KTabs/index.js +17 -0
- package/es5/components/KTextField/KTextField.js +275 -0
- package/es5/components/KTextField/index.js +7 -0
- package/es5/components/KTimePicker/KTimePicker.js +302 -0
- package/es5/components/KTimePicker/index.js +7 -0
- package/es5/components/KTimePicker/mixins/time-body.js +207 -0
- package/es5/components/KTimePicker/mixins/time-title.js +55 -0
- package/es5/components/KToolbar/KToolbar.js +193 -0
- package/es5/components/KToolbar/KToolbarSideIcon.js +29 -0
- package/es5/components/KToolbar/index.js +17 -0
- package/es5/components/KTooltip/KTooltip.js +156 -0
- package/es5/components/KTooltip/index.js +7 -0
- package/es5/components/Kdutify/index.js +50 -0
- package/es5/components/index.js +45 -0
- package/es5/components/transitions/expand-transition.js +36 -0
- package/es5/components/transitions/index.js +47 -0
- package/es5/components/transitions/row-expand-transition.js +38 -0
- package/es5/directives/click-outside.js +100 -0
- package/es5/directives/index.js +15 -0
- package/es5/directives/resize.js +30 -0
- package/es5/directives/ripple.js +144 -0
- package/es5/directives/scroll.js +32 -0
- package/es5/directives/touch.js +102 -0
- package/es5/index.js +30 -0
- package/es5/mixins/applicationable.js +9 -0
- package/es5/mixins/bootable.js +31 -0
- package/es5/mixins/button-group.js +82 -0
- package/es5/mixins/colorable.js +24 -0
- package/es5/mixins/contextualable.js +10 -0
- package/es5/mixins/delayable.js +57 -0
- package/es5/mixins/dependent.js +121 -0
- package/es5/mixins/detachable.js +41 -0
- package/es5/mixins/filterable.js +8 -0
- package/es5/mixins/input.js +219 -0
- package/es5/mixins/loadable.js +31 -0
- package/es5/mixins/maskable.js +181 -0
- package/es5/mixins/menuable.js +293 -0
- package/es5/mixins/overlayable.js +202 -0
- package/es5/mixins/picker.js +36 -0
- package/es5/mixins/positionable.js +10 -0
- package/es5/mixins/rippleable.js +21 -0
- package/es5/mixins/routable.js +66 -0
- package/es5/mixins/selectable.js +79 -0
- package/es5/mixins/stackable.js +70 -0
- package/es5/mixins/tab-focusable.js +7 -0
- package/es5/mixins/themeable.js +15 -0
- package/es5/mixins/toggleable.js +31 -0
- package/es5/mixins/transitionable.js +7 -0
- package/es5/mixins/translatable.js +62 -0
- package/es5/mixins/validatable.js +138 -0
- package/es5/util/breakpoint.js +128 -0
- package/es5/util/helpers.js +139 -0
- package/es5/util/load.js +15 -0
- package/es5/util/mask.js +159 -0
- package/es5/util/testing.js +160 -0
- package/es5/util/to-have-been-warned.js +117 -0
- package/es5/util/touchSupport.js +14 -0
- package/index.d.ts +8 -0
- package/package.json +134 -0
- package/src/components/KAlert/KAlert.js +77 -0
- package/src/components/KAlert/index.js +7 -0
- package/src/components/KApp/KApp.js +64 -0
- package/src/components/KApp/index.js +7 -0
- package/src/components/KAvatar/KAvatar.js +27 -0
- package/src/components/KAvatar/index.js +7 -0
- package/src/components/KBadge/KBadge.js +62 -0
- package/src/components/KBadge/index.js +7 -0
- package/src/components/KBottomNav/KBottomNav.js +50 -0
- package/src/components/KBottomNav/index.js +7 -0
- package/src/components/KBottomSheet/KBottomSheet.js +41 -0
- package/src/components/KBottomSheet/index.js +7 -0
- package/src/components/KBreadcrumbs/KBreadcrumbs.js +35 -0
- package/src/components/KBreadcrumbs/KBreadcrumbsItem.js +38 -0
- package/src/components/KBreadcrumbs/index.js +11 -0
- package/src/components/KBtn/KBtn.js +163 -0
- package/src/components/KBtn/index.js +7 -0
- package/src/components/KBtnToggle/KBtnToggle.js +92 -0
- package/src/components/KBtnToggle/index.js +7 -0
- package/src/components/KCard/KCard.js +61 -0
- package/src/components/KCard/KCardMedia.js +41 -0
- package/src/components/KCard/KCardTitle.js +17 -0
- package/src/components/KCard/index.js +19 -0
- package/src/components/KCarousel/KCarousel.js +174 -0
- package/src/components/KCarousel/KCarouselItem.js +65 -0
- package/src/components/KCarousel/index.js +11 -0
- package/src/components/KCheckbox/KCheckbox.js +92 -0
- package/src/components/KCheckbox/index.js +7 -0
- package/src/components/KChip/KChip.js +83 -0
- package/src/components/KChip/index.js +7 -0
- package/src/components/KDataTable/KDataTable.js +346 -0
- package/src/components/KDataTable/KEditDialog.js +110 -0
- package/src/components/KDataTable/index.js +16 -0
- package/src/components/KDataTable/mixins/body.js +98 -0
- package/src/components/KDataTable/mixins/foot.js +128 -0
- package/src/components/KDataTable/mixins/head.js +119 -0
- package/src/components/KDataTable/mixins/progress.js +16 -0
- package/src/components/KDatePicker/KDatePicker.js +382 -0
- package/src/components/KDatePicker/index.js +7 -0
- package/src/components/KDatePicker/mixins/date-header.js +74 -0
- package/src/components/KDatePicker/mixins/date-table.js +95 -0
- package/src/components/KDatePicker/mixins/date-title.js +76 -0
- package/src/components/KDatePicker/mixins/date-years.js +42 -0
- package/src/components/KDatePicker/mixins/month-table.js +82 -0
- package/src/components/KDialog/KDialog.js +184 -0
- package/src/components/KDialog/index.js +7 -0
- package/src/components/KDivider/KDivider.js +25 -0
- package/src/components/KDivider/index.js +7 -0
- package/src/components/KExpansionPanel/KExpansionPanel.js +55 -0
- package/src/components/KExpansionPanel/KExpansionPanelContent.js +112 -0
- package/src/components/KExpansionPanel/index.js +9 -0
- package/src/components/KFooter/KFooter.js +67 -0
- package/src/components/KFooter/index.js +7 -0
- package/src/components/KForm/KForm.js +117 -0
- package/src/components/KForm/index.js +7 -0
- package/src/components/KGrid/KContainer.js +5 -0
- package/src/components/KGrid/KContent.js +29 -0
- package/src/components/KGrid/KFlex.js +5 -0
- package/src/components/KGrid/KLayout.js +5 -0
- package/src/components/KGrid/grid.js +40 -0
- package/src/components/KGrid/index.js +27 -0
- package/src/components/KIcon/KIcon.js +87 -0
- package/src/components/KIcon/index.js +7 -0
- package/src/components/KList/KList.js +75 -0
- package/src/components/KList/KListGroup.js +95 -0
- package/src/components/KList/KListTile.js +62 -0
- package/src/components/KList/KListTileAction.js +12 -0
- package/src/components/KList/index.js +27 -0
- package/src/components/KMenu/KMenu.js +207 -0
- package/src/components/KMenu/index.js +7 -0
- package/src/components/KMenu/mixins/menu-activator.js +51 -0
- package/src/components/KMenu/mixins/menu-generators.js +84 -0
- package/src/components/KMenu/mixins/menu-keyable.js +68 -0
- package/src/components/KMenu/mixins/menu-position.js +72 -0
- package/src/components/KNavigationDrawer/KNavigationDrawer.js +267 -0
- package/src/components/KNavigationDrawer/index.js +7 -0
- package/src/components/KPagination/KPagination.js +168 -0
- package/src/components/KPagination/index.js +7 -0
- package/src/components/KParallax/KParallax.js +99 -0
- package/src/components/KParallax/index.js +7 -0
- package/src/components/KProgressCircular/KProgressCircular.js +160 -0
- package/src/components/KProgressCircular/index.js +7 -0
- package/src/components/KProgressLinear/KProgressLinear.js +157 -0
- package/src/components/KProgressLinear/index.js +7 -0
- package/src/components/KRadioGroup/KRadio.js +153 -0
- package/src/components/KRadioGroup/KRadioGroup.js +118 -0
- package/src/components/KRadioGroup/index.js +11 -0
- package/src/components/KSelect/KSelect.js +641 -0
- package/src/components/KSelect/index.js +7 -0
- package/src/components/KSelect/mixins/select-autocomplete.js +125 -0
- package/src/components/KSelect/mixins/select-generators.js +300 -0
- package/src/components/KSlider/KSlider.js +311 -0
- package/src/components/KSlider/index.js +7 -0
- package/src/components/KSnackbar/KSnackbar.js +97 -0
- package/src/components/KSnackbar/index.js +7 -0
- package/src/components/KSpeedDial/KSpeedDial.js +80 -0
- package/src/components/KSpeedDial/index.js +7 -0
- package/src/components/KStepper/KStepper.js +95 -0
- package/src/components/KStepper/KStepperContent.js +138 -0
- package/src/components/KStepper/KStepperStep.js +100 -0
- package/src/components/KStepper/index.js +17 -0
- package/src/components/KSubheader/KSubheader.js +25 -0
- package/src/components/KSubheader/index.js +7 -0
- package/src/components/KSwitch/KSwitch.js +58 -0
- package/src/components/KSwitch/index.js +7 -0
- package/src/components/KSystemBar/KSystemBar.js +54 -0
- package/src/components/KSystemBar/index.js +7 -0
- package/src/components/KTabs/KTabs.js +240 -0
- package/src/components/KTabs/KTabsBar.js +202 -0
- package/src/components/KTabs/KTabsContent.js +90 -0
- package/src/components/KTabs/KTabsItem.js +99 -0
- package/src/components/KTabs/KTabsItems.js +40 -0
- package/src/components/KTabs/KTabsSlider.js +14 -0
- package/src/components/KTabs/index.js +17 -0
- package/src/components/KTextField/KTextField.js +246 -0
- package/src/components/KTextField/index.js +7 -0
- package/src/components/KTimePicker/KTimePicker.js +282 -0
- package/src/components/KTimePicker/index.js +7 -0
- package/src/components/KTimePicker/mixins/time-body.js +208 -0
- package/src/components/KTimePicker/mixins/time-title.js +51 -0
- package/src/components/KToolbar/KToolbar.js +206 -0
- package/src/components/KToolbar/KToolbarSideIcon.js +26 -0
- package/src/components/KToolbar/index.js +19 -0
- package/src/components/KTooltip/KTooltip.js +161 -0
- package/src/components/KTooltip/index.js +7 -0
- package/src/components/Kdutify/index.js +48 -0
- package/src/components/index.js +45 -0
- package/src/components/transitions/expand-transition.js +34 -0
- package/src/components/transitions/index.js +50 -0
- package/src/components/transitions/row-expand-transition.js +38 -0
- package/src/directives/click-outside.js +72 -0
- package/src/directives/index.js +21 -0
- package/src/directives/resize.js +30 -0
- package/src/directives/ripple.js +120 -0
- package/src/directives/scroll.js +31 -0
- package/src/directives/touch.js +90 -0
- package/src/index.js +30 -0
- package/src/mixins/applicationable.js +9 -0
- package/src/mixins/bootable.js +31 -0
- package/src/mixins/button-group.js +77 -0
- package/src/mixins/colorable.js +20 -0
- package/src/mixins/contextualable.js +10 -0
- package/src/mixins/delayable.js +54 -0
- package/src/mixins/dependent.js +55 -0
- package/src/mixins/detachable.js +44 -0
- package/src/mixins/filterable.js +8 -0
- package/src/mixins/input.js +220 -0
- package/src/mixins/loadable.js +33 -0
- package/src/mixins/maskable.js +117 -0
- package/src/mixins/menuable.js +299 -0
- package/src/mixins/overlayable.js +180 -0
- package/src/mixins/picker.js +35 -0
- package/src/mixins/positionable.js +10 -0
- package/src/mixins/rippleable.js +21 -0
- package/src/mixins/routable.js +66 -0
- package/src/mixins/selectable.js +84 -0
- package/src/mixins/stackable.js +44 -0
- package/src/mixins/tab-focusable.js +7 -0
- package/src/mixins/themeable.js +15 -0
- package/src/mixins/toggleable.js +28 -0
- package/src/mixins/transitionable.js +7 -0
- package/src/mixins/translatable.js +67 -0
- package/src/mixins/validatable.js +124 -0
- package/src/stylus/app.styl +6 -0
- package/src/stylus/bootstrap.styl +1 -0
- package/src/stylus/components/_alerts.styl +44 -0
- package/src/stylus/components/_app.styl +21 -0
- package/src/stylus/components/_avatars.styl +22 -0
- package/src/stylus/components/_badges.styl +49 -0
- package/src/stylus/components/_bottom-navs.styl +86 -0
- package/src/stylus/components/_bottom-sheets.styl +18 -0
- package/src/stylus/components/_breadcrumbs.styl +46 -0
- package/src/stylus/components/_button-toggle.styl +55 -0
- package/src/stylus/components/_buttons.styl +339 -0
- package/src/stylus/components/_cards.styl +85 -0
- package/src/stylus/components/_carousel.styl +76 -0
- package/src/stylus/components/_chips.styl +102 -0
- package/src/stylus/components/_content.styl +6 -0
- package/src/stylus/components/_data-table.styl +113 -0
- package/src/stylus/components/_date-picker.styl +214 -0
- package/src/stylus/components/_dialogs.styl +63 -0
- package/src/stylus/components/_dividers.styl +19 -0
- package/src/stylus/components/_expansion-panel.styl +85 -0
- package/src/stylus/components/_footer.styl +40 -0
- package/src/stylus/components/_grid.styl +171 -0
- package/src/stylus/components/_icons.styl +32 -0
- package/src/stylus/components/_input-groups.styl +310 -0
- package/src/stylus/components/_lists.styl +263 -0
- package/src/stylus/components/_menus.styl +87 -0
- package/src/stylus/components/_navigation-drawer.styl +150 -0
- package/src/stylus/components/_overlay.styl +42 -0
- package/src/stylus/components/_pagination.styl +95 -0
- package/src/stylus/components/_parallax.styl +35 -0
- package/src/stylus/components/_pickers.styl +66 -0
- package/src/stylus/components/_progress-circular.styl +58 -0
- package/src/stylus/components/_progress-linear.styl +104 -0
- package/src/stylus/components/_radio-group.styl +23 -0
- package/src/stylus/components/_ripples.styl +31 -0
- package/src/stylus/components/_select.styl +153 -0
- package/src/stylus/components/_selection-controls.styl +122 -0
- package/src/stylus/components/_sliders.styl +234 -0
- package/src/stylus/components/_small-dialog.styl +37 -0
- package/src/stylus/components/_snackbars.styl +110 -0
- package/src/stylus/components/_speed-dial.styl +78 -0
- package/src/stylus/components/_steppers.styl +216 -0
- package/src/stylus/components/_subheaders.styl +18 -0
- package/src/stylus/components/_switch.styl +89 -0
- package/src/stylus/components/_system-bars.styl +49 -0
- package/src/stylus/components/_tables.styl +103 -0
- package/src/stylus/components/_tabs.styl +159 -0
- package/src/stylus/components/_text-fields.styl +243 -0
- package/src/stylus/components/_time-picker.styl +199 -0
- package/src/stylus/components/_toolbar.styl +148 -0
- package/src/stylus/components/_tooltips.styl +25 -0
- package/src/stylus/elements/_blockquote.styl +5 -0
- package/src/stylus/elements/_code.styl +20 -0
- package/src/stylus/elements/_global.styl +31 -0
- package/src/stylus/elements/_headings.styl +17 -0
- package/src/stylus/elements/_lists.styl +2 -0
- package/src/stylus/elements/_typography.styl +54 -0
- package/src/stylus/generic/_bootstrap.styl +49 -0
- package/src/stylus/generic/_reset.styl +332 -0
- package/src/stylus/generic/_transitions.styl +116 -0
- package/src/stylus/main.styl +2 -0
- package/src/stylus/settings/_colors.styl +339 -0
- package/src/stylus/settings/_elevations.styl +111 -0
- package/src/stylus/settings/_theme.styl +201 -0
- package/src/stylus/settings/_variables.styl +396 -0
- package/src/stylus/theme.styl +24 -0
- package/src/stylus/tools/_animations.styl +9 -0
- package/src/stylus/tools/_colors.styl +17 -0
- package/src/stylus/tools/_elevations.styl +7 -0
- package/src/stylus/trumps/_display.styl +14 -0
- package/src/stylus/trumps/_helpers.styl +5 -0
- package/src/stylus/trumps/_spacing.styl +37 -0
- package/src/stylus/trumps/_text.styl +13 -0
- package/src/util/breakpoint.js +134 -0
- package/src/util/helpers.d.ts +21 -0
- package/src/util/helpers.js +125 -0
- package/src/util/load.js +13 -0
- package/src/util/mask.js +138 -0
- package/src/util/testing.js +154 -0
- package/src/util/to-have-been-warned.js +68 -0
- package/src/util/touchSupport.js +12 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Bootable from './bootable'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
mixins: [Bootable],
|
|
5
|
+
|
|
6
|
+
props: {
|
|
7
|
+
contentClass: {
|
|
8
|
+
default: ''
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
mounted () {
|
|
13
|
+
this.$kdutify.load(this.initDetach)
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
beforeDestroy () {
|
|
17
|
+
if (!this.$refs.content) return
|
|
18
|
+
|
|
19
|
+
// IE11 Fix
|
|
20
|
+
try {
|
|
21
|
+
this.$refs.content.parentNode.removeChild(this.$refs.content)
|
|
22
|
+
} catch (e) {}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
methods: {
|
|
26
|
+
initDetach () {
|
|
27
|
+
if (this._isDestroyed) return
|
|
28
|
+
|
|
29
|
+
const app = document.querySelector('[data-app]')
|
|
30
|
+
|
|
31
|
+
if (!app) {
|
|
32
|
+
return console.warn('Application is missing <k-app> component.')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// If child has already been removed, bail
|
|
36
|
+
if (!this.$refs.content) return
|
|
37
|
+
|
|
38
|
+
app.insertBefore(
|
|
39
|
+
this.$refs.content,
|
|
40
|
+
app.firstChild
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import Loadable from './loadable'
|
|
2
|
+
import Themeable from './themeable'
|
|
3
|
+
import Validatable from './validatable'
|
|
4
|
+
import KIcon from '../components/KIcon'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
components: {
|
|
8
|
+
KIcon
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
mixins: [Loadable, Themeable, Validatable],
|
|
12
|
+
|
|
13
|
+
data () {
|
|
14
|
+
return {
|
|
15
|
+
isFocused: false,
|
|
16
|
+
tabFocused: false,
|
|
17
|
+
internalTabIndex: null,
|
|
18
|
+
lazyValue: this.value
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
appendIcon: String,
|
|
24
|
+
appendIconCb: Function,
|
|
25
|
+
disabled: Boolean,
|
|
26
|
+
hint: String,
|
|
27
|
+
hideDetails: Boolean,
|
|
28
|
+
label: String,
|
|
29
|
+
persistentHint: Boolean,
|
|
30
|
+
placeholder: String,
|
|
31
|
+
prependIcon: String,
|
|
32
|
+
prependIconCb: Function,
|
|
33
|
+
readonly: Boolean,
|
|
34
|
+
required: Boolean,
|
|
35
|
+
tabindex: {
|
|
36
|
+
default: 0
|
|
37
|
+
},
|
|
38
|
+
toggleKeys: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => [13, 32]
|
|
41
|
+
},
|
|
42
|
+
value: {
|
|
43
|
+
required: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
computed: {
|
|
48
|
+
inputGroupClasses () {
|
|
49
|
+
return Object.assign({
|
|
50
|
+
'input-group': true,
|
|
51
|
+
'input-group--async-loading': this.loading !== false,
|
|
52
|
+
'input-group--focused': this.isFocused,
|
|
53
|
+
'input-group--dirty': this.isDirty,
|
|
54
|
+
'input-group--tab-focused': this.tabFocused,
|
|
55
|
+
'input-group--disabled': this.disabled,
|
|
56
|
+
'input-group--error': this.hasError,
|
|
57
|
+
'input-group--append-icon': this.appendIcon,
|
|
58
|
+
'input-group--prepend-icon': this.prependIcon,
|
|
59
|
+
'input-group--required': this.required,
|
|
60
|
+
'input-group--hide-details': this.hideDetails,
|
|
61
|
+
'input-group--placeholder': !!this.placeholder,
|
|
62
|
+
'theme--dark': this.dark,
|
|
63
|
+
'theme--light': this.light
|
|
64
|
+
}, this.classes)
|
|
65
|
+
},
|
|
66
|
+
isDirty () {
|
|
67
|
+
return !!this.inputValue
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
methods: {
|
|
72
|
+
groupFocus (e) {},
|
|
73
|
+
groupBlur (e) {
|
|
74
|
+
this.tabFocused = false
|
|
75
|
+
},
|
|
76
|
+
genLabel () {
|
|
77
|
+
return this.$createElement('label', {
|
|
78
|
+
attrs: {
|
|
79
|
+
for: this.$attrs.id
|
|
80
|
+
}
|
|
81
|
+
}, this.$slots.label || this.label)
|
|
82
|
+
},
|
|
83
|
+
genMessages () {
|
|
84
|
+
let messages = []
|
|
85
|
+
|
|
86
|
+
if ((this.hint &&
|
|
87
|
+
this.isFocused ||
|
|
88
|
+
this.hint &&
|
|
89
|
+
this.persistentHint) &&
|
|
90
|
+
this.validations.length === 0
|
|
91
|
+
) {
|
|
92
|
+
messages = [this.genHint()]
|
|
93
|
+
} else if (this.validations.length) {
|
|
94
|
+
messages = this.validations.map(v => this.genError(v))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return this.$createElement('transition-group', {
|
|
98
|
+
'class': 'input-group__messages',
|
|
99
|
+
props: {
|
|
100
|
+
tag: 'div',
|
|
101
|
+
name: 'slide-y-transition'
|
|
102
|
+
}
|
|
103
|
+
}, messages)
|
|
104
|
+
},
|
|
105
|
+
genHint () {
|
|
106
|
+
return this.$createElement('div', {
|
|
107
|
+
'class': 'input-group__hint',
|
|
108
|
+
key: this.hint,
|
|
109
|
+
domProps: { innerHTML: this.hint }
|
|
110
|
+
})
|
|
111
|
+
},
|
|
112
|
+
genError (error) {
|
|
113
|
+
return this.$createElement(
|
|
114
|
+
'div',
|
|
115
|
+
{
|
|
116
|
+
'class': 'input-group__error',
|
|
117
|
+
key: error
|
|
118
|
+
},
|
|
119
|
+
error
|
|
120
|
+
)
|
|
121
|
+
},
|
|
122
|
+
genIcon (type, defaultCallback = null) {
|
|
123
|
+
const shouldClear = type === 'append' && this.clearable && this.isDirty
|
|
124
|
+
const icon = shouldClear ? 'clear' : this[`${type}Icon`]
|
|
125
|
+
const callback = shouldClear
|
|
126
|
+
? this.clearableCallback
|
|
127
|
+
: (this[`${type}IconCb`] || defaultCallback)
|
|
128
|
+
|
|
129
|
+
return this.$createElement('k-icon', {
|
|
130
|
+
attrs: {
|
|
131
|
+
'aria-hidden': true
|
|
132
|
+
},
|
|
133
|
+
'class': {
|
|
134
|
+
[`input-group__${type}-icon`]: true,
|
|
135
|
+
'input-group__icon-cb': !!callback,
|
|
136
|
+
'input-group__icon-clearable': shouldClear
|
|
137
|
+
},
|
|
138
|
+
props: {
|
|
139
|
+
disabled: this.disabled
|
|
140
|
+
},
|
|
141
|
+
on: {
|
|
142
|
+
click: e => {
|
|
143
|
+
if (!callback) return
|
|
144
|
+
|
|
145
|
+
e.stopPropagation()
|
|
146
|
+
callback()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, icon)
|
|
150
|
+
},
|
|
151
|
+
genInputGroup (input, data = {}, defaultAppendCallback = null) {
|
|
152
|
+
const children = []
|
|
153
|
+
const wrapperChildren = []
|
|
154
|
+
const detailsChildren = []
|
|
155
|
+
|
|
156
|
+
data = Object.assign({}, {
|
|
157
|
+
'class': this.inputGroupClasses,
|
|
158
|
+
attrs: {
|
|
159
|
+
tabindex: this.disabled
|
|
160
|
+
? -1
|
|
161
|
+
: this.internalTabIndex || this.tabindex
|
|
162
|
+
},
|
|
163
|
+
on: {
|
|
164
|
+
focus: this.groupFocus,
|
|
165
|
+
blur: this.groupBlur,
|
|
166
|
+
click: () => (this.tabFocused = false),
|
|
167
|
+
keyup: e => {
|
|
168
|
+
if ([9, 16].includes(e.keyCode)) {
|
|
169
|
+
this.tabFocused = true
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
keydown: e => {
|
|
173
|
+
if (!this.toggle) return
|
|
174
|
+
|
|
175
|
+
if (this.toggleKeys.includes(e.keyCode)) {
|
|
176
|
+
e.preventDefault()
|
|
177
|
+
this.toggle()
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, data)
|
|
182
|
+
|
|
183
|
+
if (this.$slots.label || this.label) {
|
|
184
|
+
children.push(this.genLabel())
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
wrapperChildren.push(input)
|
|
188
|
+
|
|
189
|
+
if (this.prependIcon) {
|
|
190
|
+
wrapperChildren.unshift(this.genIcon('prepend'))
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (this.appendIcon || this.clearable) {
|
|
194
|
+
wrapperChildren.push(this.genIcon('append', defaultAppendCallback))
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const progress = this.genProgress()
|
|
198
|
+
progress && detailsChildren.push(progress)
|
|
199
|
+
|
|
200
|
+
children.push(
|
|
201
|
+
this.$createElement('div', {
|
|
202
|
+
'class': 'input-group__input'
|
|
203
|
+
}, wrapperChildren)
|
|
204
|
+
)
|
|
205
|
+
detailsChildren.push(this.genMessages())
|
|
206
|
+
|
|
207
|
+
if (this.counter) {
|
|
208
|
+
detailsChildren.push(this.genCounter())
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
children.push(
|
|
212
|
+
this.$createElement('div', {
|
|
213
|
+
'class': 'input-group__details'
|
|
214
|
+
}, detailsChildren)
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
return this.$createElement('div', data, children)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loadable
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Used to add linear progress bar to components
|
|
7
|
+
* Can use a default bar with a specific color
|
|
8
|
+
* or designate a custom progress linear bar
|
|
9
|
+
*/
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
loading: {
|
|
13
|
+
type: [Boolean, String],
|
|
14
|
+
default: false
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
methods: {
|
|
19
|
+
genProgress () {
|
|
20
|
+
if (this.loading === false) return null
|
|
21
|
+
|
|
22
|
+
return this.$slots.progress || this.$createElement('k-progress-linear', {
|
|
23
|
+
props: {
|
|
24
|
+
color: (this.loading === true || this.loading === '')
|
|
25
|
+
? (this.color || 'primary')
|
|
26
|
+
: this.loading,
|
|
27
|
+
height: 2,
|
|
28
|
+
indeterminate: true
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maskable
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Creates an input mask that is
|
|
7
|
+
* generated from a masked str
|
|
8
|
+
*
|
|
9
|
+
* Example: mask="#### #### #### ####"
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
isMaskDelimiter,
|
|
14
|
+
maskText,
|
|
15
|
+
unmaskText
|
|
16
|
+
} from '../util/mask'
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
data: () => ({
|
|
20
|
+
selection: 0,
|
|
21
|
+
preDefined: {
|
|
22
|
+
'credit-card': '#### - #### - #### - ####',
|
|
23
|
+
'date': '##/##/####',
|
|
24
|
+
'date-with-time': '##/##/#### ##:##',
|
|
25
|
+
'phone': '(###) ### - ####',
|
|
26
|
+
'social': '###-##-####',
|
|
27
|
+
'time': '##:##',
|
|
28
|
+
'time-with-seconds': '##:##:##'
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
|
|
32
|
+
props: {
|
|
33
|
+
dontFillMaskBlanks: Boolean,
|
|
34
|
+
mask: {
|
|
35
|
+
type: [Object, String],
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
returnMaskedValue: Boolean
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
computed: {
|
|
42
|
+
masked () {
|
|
43
|
+
const preDefined = this.preDefined[this.mask]
|
|
44
|
+
const mask = preDefined || this.mask || ''
|
|
45
|
+
|
|
46
|
+
return mask.split('')
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
watch: {
|
|
51
|
+
/**
|
|
52
|
+
* Make sure the cursor is in the correct
|
|
53
|
+
* location when the mask changes
|
|
54
|
+
*/
|
|
55
|
+
mask () {
|
|
56
|
+
if (!this.$refs.input) return
|
|
57
|
+
|
|
58
|
+
const oldText = this.$refs.input.value
|
|
59
|
+
const newText = this.maskText(this.lazyValue)
|
|
60
|
+
let position = 0
|
|
61
|
+
let selection = this.selection
|
|
62
|
+
|
|
63
|
+
for (const char of oldText.substr(0, selection)) {
|
|
64
|
+
isMaskDelimiter(char) || position++
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
selection = 0
|
|
68
|
+
for (const char of newText) {
|
|
69
|
+
isMaskDelimiter(char) || position--
|
|
70
|
+
selection++
|
|
71
|
+
if (position <= 0) break
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.setCaretPosition(selection)
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
methods: {
|
|
79
|
+
setCaretPosition (selection) {
|
|
80
|
+
this.selection = selection
|
|
81
|
+
window.setTimeout(() => {
|
|
82
|
+
this.$refs.input && this.$refs.input.setSelectionRange(this.selection, this.selection)
|
|
83
|
+
}, 0)
|
|
84
|
+
},
|
|
85
|
+
updateRange () {
|
|
86
|
+
if (!this.$refs.input) return
|
|
87
|
+
|
|
88
|
+
const newValue = this.maskText(this.lazyValue)
|
|
89
|
+
let selection = 0
|
|
90
|
+
|
|
91
|
+
this.$refs.input.value = newValue
|
|
92
|
+
for (const char of newValue) {
|
|
93
|
+
if (this.lazySelection <= 0) break
|
|
94
|
+
isMaskDelimiter(char) || this.lazySelection--
|
|
95
|
+
selection++
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.setCaretPosition(selection)
|
|
99
|
+
},
|
|
100
|
+
maskText (text) {
|
|
101
|
+
if (!this.mask) return text
|
|
102
|
+
|
|
103
|
+
return maskText(text, this.masked, this.dontFillMaskBlanks)
|
|
104
|
+
},
|
|
105
|
+
unmaskText (text) {
|
|
106
|
+
if (this.returnMaskedValue || !this.mask) return text
|
|
107
|
+
|
|
108
|
+
return unmaskText(text)
|
|
109
|
+
},
|
|
110
|
+
// When the input changes and is
|
|
111
|
+
// re-created, ensure that the
|
|
112
|
+
// caret location is correct
|
|
113
|
+
setSelectionRange () {
|
|
114
|
+
this.$nextTick(this.updateRange)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import Positionable from './positionable'
|
|
2
|
+
|
|
3
|
+
import Stackable from './stackable'
|
|
4
|
+
|
|
5
|
+
const dimensions = {
|
|
6
|
+
activator: {
|
|
7
|
+
top: 0, left: 0,
|
|
8
|
+
bottom: 0, right: 0,
|
|
9
|
+
width: 0, height: 0,
|
|
10
|
+
offsetTop: 0, scrollHeight: 0
|
|
11
|
+
},
|
|
12
|
+
content: {
|
|
13
|
+
top: 0, left: 0,
|
|
14
|
+
bottom: 0, right: 0,
|
|
15
|
+
width: 0, height: 0,
|
|
16
|
+
offsetTop: 0, scrollHeight: 0
|
|
17
|
+
},
|
|
18
|
+
hasWindow: false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Menuable
|
|
23
|
+
*
|
|
24
|
+
* @mixin
|
|
25
|
+
*
|
|
26
|
+
* Used for fixed or absolutely positioning
|
|
27
|
+
* elements within the DOM
|
|
28
|
+
* Can calculate X and Y axis overflows
|
|
29
|
+
* As well as be manually positioned
|
|
30
|
+
*/
|
|
31
|
+
export default {
|
|
32
|
+
mixins: [Positionable, Stackable],
|
|
33
|
+
|
|
34
|
+
data: () => ({
|
|
35
|
+
absoluteX: 0,
|
|
36
|
+
absoluteY: 0,
|
|
37
|
+
dimensions: Object.assign({}, dimensions),
|
|
38
|
+
isContentActive: false,
|
|
39
|
+
pageYOffset: 0,
|
|
40
|
+
stackClass: 'menuable__content__active',
|
|
41
|
+
stackMinZIndex: 6
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
props: {
|
|
45
|
+
activator: {
|
|
46
|
+
default: null,
|
|
47
|
+
validate: val => {
|
|
48
|
+
return ['string', 'object'].includes(typeof val)
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
allowOverflow: Boolean,
|
|
52
|
+
maxWidth: {
|
|
53
|
+
type: [Number, String],
|
|
54
|
+
default: 'auto'
|
|
55
|
+
},
|
|
56
|
+
minWidth: [Number, String],
|
|
57
|
+
nudgeBottom: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 0
|
|
60
|
+
},
|
|
61
|
+
nudgeLeft: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 0
|
|
64
|
+
},
|
|
65
|
+
nudgeRight: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 0
|
|
68
|
+
},
|
|
69
|
+
nudgeTop: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 0
|
|
72
|
+
},
|
|
73
|
+
nudgeWidth: {
|
|
74
|
+
type: Number,
|
|
75
|
+
default: 0
|
|
76
|
+
},
|
|
77
|
+
offsetOverflow: Boolean,
|
|
78
|
+
positionX: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: null
|
|
81
|
+
},
|
|
82
|
+
positionY: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: null
|
|
85
|
+
},
|
|
86
|
+
zIndex: {
|
|
87
|
+
type: [Number, String],
|
|
88
|
+
default: null
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
computed: {
|
|
93
|
+
hasActivator () {
|
|
94
|
+
return !!this.$slots.activator || this.activator
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
watch: {
|
|
99
|
+
disabled (val) {
|
|
100
|
+
val && this.callDeactivate()
|
|
101
|
+
},
|
|
102
|
+
isActive (val) {
|
|
103
|
+
if (this.disabled) return
|
|
104
|
+
|
|
105
|
+
val && this.callActivate() || this.callDeactivate()
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
methods: {
|
|
110
|
+
absolutePosition () {
|
|
111
|
+
return {
|
|
112
|
+
offsetTop: 0,
|
|
113
|
+
scrollHeight: 0,
|
|
114
|
+
top: this.positionY || this.absoluteY,
|
|
115
|
+
bottom: this.positionY || this.absoluteY,
|
|
116
|
+
left: this.positionX || this.absoluteX,
|
|
117
|
+
right: this.positionX || this.absoluteX,
|
|
118
|
+
height: 0,
|
|
119
|
+
width: 0
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
activate () {},
|
|
123
|
+
calcLeft () {
|
|
124
|
+
const a = this.dimensions.activator
|
|
125
|
+
const c = this.dimensions.content
|
|
126
|
+
let left = this.left ? a.right - c.width : a.left
|
|
127
|
+
|
|
128
|
+
if (this.offsetX) left += this.left ? -a.width : a.width
|
|
129
|
+
if (this.nudgeLeft) left -= this.nudgeLeft
|
|
130
|
+
if (this.nudgeRight) left += this.nudgeRight
|
|
131
|
+
|
|
132
|
+
return left
|
|
133
|
+
},
|
|
134
|
+
calcTop () {
|
|
135
|
+
this.checkForWindow()
|
|
136
|
+
|
|
137
|
+
const a = this.dimensions.activator
|
|
138
|
+
const c = this.dimensions.content
|
|
139
|
+
let top = this.top ? a.bottom - c.height : a.top
|
|
140
|
+
|
|
141
|
+
if (this.offsetY) top += this.top ? -a.height : a.height
|
|
142
|
+
if (this.nudgeTop) top -= this.nudgeTop
|
|
143
|
+
if (this.nudgeBottom) top += this.nudgeBottom
|
|
144
|
+
|
|
145
|
+
return top + this.pageYOffset
|
|
146
|
+
},
|
|
147
|
+
calcXOverflow (left) {
|
|
148
|
+
const parsedMaxWidth = isNaN(parseInt(this.maxWidth))
|
|
149
|
+
? 0
|
|
150
|
+
: parseInt(this.maxWidth)
|
|
151
|
+
const innerWidth = this.getInnerWidth()
|
|
152
|
+
const maxWidth = Math.max(
|
|
153
|
+
this.dimensions.content.width,
|
|
154
|
+
parsedMaxWidth
|
|
155
|
+
)
|
|
156
|
+
const totalWidth = left + maxWidth
|
|
157
|
+
const availableWidth = totalWidth - innerWidth
|
|
158
|
+
|
|
159
|
+
if ((!this.left || this.right) && availableWidth > 0) {
|
|
160
|
+
left = (
|
|
161
|
+
innerWidth -
|
|
162
|
+
maxWidth -
|
|
163
|
+
(innerWidth > 600 ? 30 : 12) // Account for scrollbar
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (left < 0) left = 12
|
|
168
|
+
|
|
169
|
+
return left
|
|
170
|
+
},
|
|
171
|
+
calcYOverflow (top) {
|
|
172
|
+
const documentHeight = this.getInnerHeight()
|
|
173
|
+
const toTop = this.pageYOffset + documentHeight
|
|
174
|
+
const activator = this.dimensions.activator
|
|
175
|
+
const contentHeight = this.dimensions.content.height
|
|
176
|
+
const totalHeight = top + contentHeight
|
|
177
|
+
const isOverflowing = toTop < totalHeight
|
|
178
|
+
|
|
179
|
+
// If overflowing bottom and offset
|
|
180
|
+
if (isOverflowing && this.offsetOverflow) {
|
|
181
|
+
top = this.pageYOffset + (activator.top - contentHeight)
|
|
182
|
+
// If overflowing bottom
|
|
183
|
+
} else if (isOverflowing && !this.allowOverflow) {
|
|
184
|
+
top = toTop - contentHeight - 12
|
|
185
|
+
// If overflowing top
|
|
186
|
+
} else if (top < this.pageYOffset && !this.allowOverflow) {
|
|
187
|
+
top = this.pageYOffset + 12
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return top < 12 ? 12 : top
|
|
191
|
+
},
|
|
192
|
+
callActivate () {
|
|
193
|
+
this.checkForWindow()
|
|
194
|
+
if (!this.hasWindow) return
|
|
195
|
+
|
|
196
|
+
this.activate()
|
|
197
|
+
},
|
|
198
|
+
callDeactivate () {
|
|
199
|
+
this.isContentActive = false
|
|
200
|
+
|
|
201
|
+
this.deactivate()
|
|
202
|
+
},
|
|
203
|
+
checkForWindow () {
|
|
204
|
+
this.hasWindow = typeof window !== 'undefined'
|
|
205
|
+
|
|
206
|
+
if (this.hasWindow) {
|
|
207
|
+
this.pageYOffset = this.getOffsetTop()
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
deactivate () {},
|
|
211
|
+
getActivator () {
|
|
212
|
+
if (this.activator) {
|
|
213
|
+
return typeof this.activator === 'string'
|
|
214
|
+
? document.querySelector(this.activator)
|
|
215
|
+
: this.activator
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return this.$refs.activator.children
|
|
219
|
+
? this.$refs.activator.children[0]
|
|
220
|
+
: this.$refs.activator
|
|
221
|
+
},
|
|
222
|
+
getInnerHeight () {
|
|
223
|
+
if (!this.hasWindow) return 0
|
|
224
|
+
|
|
225
|
+
return window.innerHeight ||
|
|
226
|
+
document.documentElement.clientHeight
|
|
227
|
+
},
|
|
228
|
+
getInnerWidth () {
|
|
229
|
+
if (!this.hasWindow) return 0
|
|
230
|
+
|
|
231
|
+
return window.innerWidth
|
|
232
|
+
},
|
|
233
|
+
getOffsetTop () {
|
|
234
|
+
if (!this.hasWindow) return 0
|
|
235
|
+
|
|
236
|
+
return window.pageYOffset ||
|
|
237
|
+
document.documentElement.scrollTop
|
|
238
|
+
},
|
|
239
|
+
measure (el, selector) {
|
|
240
|
+
el = selector ? el.querySelector(selector) : el
|
|
241
|
+
|
|
242
|
+
if (!el) return null
|
|
243
|
+
|
|
244
|
+
const {
|
|
245
|
+
top,
|
|
246
|
+
bottom,
|
|
247
|
+
left,
|
|
248
|
+
right,
|
|
249
|
+
height,
|
|
250
|
+
width
|
|
251
|
+
} = el.getBoundingClientRect()
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
offsetTop: el.offsetTop,
|
|
255
|
+
scrollHeight: el.scrollHeight,
|
|
256
|
+
top, bottom, left, right, height, width
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
sneakPeek (cb) {
|
|
260
|
+
requestAnimationFrame(() => {
|
|
261
|
+
const el = this.$refs.content
|
|
262
|
+
|
|
263
|
+
if (this.isShown(el)) return cb()
|
|
264
|
+
|
|
265
|
+
el.style.display = 'inline-block'
|
|
266
|
+
cb()
|
|
267
|
+
el.style.display = 'none'
|
|
268
|
+
})
|
|
269
|
+
},
|
|
270
|
+
startTransition () {
|
|
271
|
+
requestAnimationFrame(() => (this.isContentActive = true))
|
|
272
|
+
},
|
|
273
|
+
isShown (el) {
|
|
274
|
+
return el.style.display !== 'none'
|
|
275
|
+
},
|
|
276
|
+
resetDimensions () {
|
|
277
|
+
this.dimensions = Object.assign({}, dimensions)
|
|
278
|
+
},
|
|
279
|
+
updateDimensions () {
|
|
280
|
+
// Ensure that overflow calculation
|
|
281
|
+
// can work properly every update
|
|
282
|
+
this.resetDimensions()
|
|
283
|
+
|
|
284
|
+
const dimensions = {}
|
|
285
|
+
|
|
286
|
+
// Activate should already be shown
|
|
287
|
+
dimensions.activator = !this.hasActivator || this.absolute
|
|
288
|
+
? this.absolutePosition()
|
|
289
|
+
: this.measure(this.getActivator())
|
|
290
|
+
|
|
291
|
+
// Display and hide to get dimensions
|
|
292
|
+
this.sneakPeek(() => {
|
|
293
|
+
dimensions.content = this.measure(this.$refs.content)
|
|
294
|
+
|
|
295
|
+
this.dimensions = dimensions
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|