buefy 1.0.0 → 1.0.2
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.md +21 -0
- package/README.md +242 -0
- package/dist/buefy.css +15895 -0
- package/dist/buefy.d.ts +11706 -0
- package/dist/buefy.esm.js +21082 -0
- package/dist/buefy.esm.min.js +2 -0
- package/dist/buefy.js +21227 -0
- package/dist/buefy.min.css +1 -0
- package/dist/buefy.min.js +2 -0
- package/dist/cjs/Autocomplete-BMmOsPiK.js +864 -0
- package/dist/cjs/Button-Cq7yqI8p.js +118 -0
- package/dist/cjs/CheckRadioMixin-CDu0SN3g.js +58 -0
- package/dist/cjs/Checkbox-GPzAMQqM.js +85 -0
- package/dist/cjs/CompatFallthroughMixin-hhK0Gkhr.js +48 -0
- package/dist/cjs/Datepicker-B-9ReBe6.js +2120 -0
- package/dist/cjs/Dropdown-DtpKU9qf.js +470 -0
- package/dist/cjs/DropdownItem-IMOKyRGV.js +110 -0
- package/dist/cjs/Field-19ZCJFF8.js +405 -0
- package/dist/cjs/FormElementMixin-DavX4iOv.js +170 -0
- package/dist/cjs/Icon-lsDKE2wQ.js +184 -0
- package/dist/cjs/Image-CocPwU3n.js +356 -0
- package/dist/cjs/InjectedChildMixin-CUKn09dB.js +150 -0
- package/dist/cjs/Input-BcloGeZ3.js +350 -0
- package/dist/cjs/Loading-GqqqjipO.js +145 -0
- package/dist/cjs/MessageMixin-bGuuzfev.js +136 -0
- package/dist/cjs/Modal-CYpSQe2Q.js +315 -0
- package/dist/cjs/NoticeMixin--3RjH43z.js +163 -0
- package/dist/cjs/Pagination-D1MVdiLp.js +547 -0
- package/dist/cjs/Progress-DT9Qc8Id.js +177 -0
- package/dist/cjs/Select-DayPKwCY.js +147 -0
- package/dist/cjs/SlotComponent-BruGdRW3.js +41 -0
- package/dist/cjs/TabbedChildMixin-B3JUUwcf.js +211 -0
- package/dist/cjs/Tag-BprnwJJ1.js +167 -0
- package/dist/cjs/Timepicker-CDZ3V-2J.js +283 -0
- package/dist/cjs/TimepickerMixin-C9WVvcUL.js +666 -0
- package/dist/cjs/Tooltip-Cgighv0j.js +393 -0
- package/dist/cjs/_plugin-vue_export-helper-Die8u8yB.js +11 -0
- package/dist/cjs/autocomplete.js +23 -0
- package/dist/cjs/breadcrumb.js +107 -0
- package/dist/cjs/button.js +20 -0
- package/dist/cjs/carousel.js +825 -0
- package/dist/cjs/checkbox.js +88 -0
- package/dist/cjs/clockpicker.js +668 -0
- package/dist/cjs/collapse.js +99 -0
- package/dist/cjs/colorpicker.js +25 -0
- package/dist/cjs/config-DR826Ki2.js +103 -0
- package/dist/cjs/config.js +18 -0
- package/dist/cjs/datepicker.js +28 -0
- package/dist/cjs/datetimepicker.js +483 -0
- package/dist/cjs/dialog.js +506 -0
- package/dist/cjs/dropdown.js +23 -0
- package/dist/cjs/field.js +19 -0
- package/dist/cjs/helpers.js +276 -0
- package/dist/cjs/icon.js +19 -0
- package/dist/cjs/image.js +19 -0
- package/dist/cjs/index-DiQy3SCb.js +1942 -0
- package/dist/cjs/index.js +274 -0
- package/dist/cjs/input.js +22 -0
- package/dist/cjs/loading.js +87 -0
- package/dist/cjs/menu.js +340 -0
- package/dist/cjs/message.js +119 -0
- package/dist/cjs/modal.js +103 -0
- package/dist/cjs/navbar.js +572 -0
- package/dist/cjs/notification.js +281 -0
- package/dist/cjs/numberinput.js +386 -0
- package/dist/cjs/pagination.js +22 -0
- package/dist/cjs/plugins-DbyYGVpp.js +16 -0
- package/dist/cjs/progress.js +91 -0
- package/dist/cjs/radio.js +137 -0
- package/dist/cjs/rate.js +197 -0
- package/dist/cjs/select.js +22 -0
- package/dist/cjs/sidebar.js +309 -0
- package/dist/cjs/skeleton.js +78 -0
- package/dist/cjs/slider.js +699 -0
- package/dist/cjs/snackbar.js +224 -0
- package/dist/cjs/ssr-DVRFTu_P.js +8 -0
- package/dist/cjs/steps.js +347 -0
- package/dist/cjs/switch.js +161 -0
- package/dist/cjs/table.js +2391 -0
- package/dist/cjs/tabs.js +258 -0
- package/dist/cjs/tag.js +44 -0
- package/dist/cjs/taginput.js +425 -0
- package/dist/cjs/timepicker.js +29 -0
- package/dist/cjs/toast.js +162 -0
- package/dist/cjs/tooltip.js +19 -0
- package/dist/cjs/trapFocus-BlX6xykt.js +53 -0
- package/dist/cjs/upload.js +195 -0
- package/dist/components/autocomplete/index.js +1647 -0
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/breadcrumb/index.js +173 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +334 -0
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/carousel/index.js +1534 -0
- package/dist/components/carousel/index.min.js +2 -0
- package/dist/components/checkbox/index.js +236 -0
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +2636 -0
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +111 -0
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/colorpicker/index.js +4251 -0
- package/dist/components/colorpicker/index.min.js +2 -0
- package/dist/components/datepicker/index.js +4110 -0
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/datetimepicker/index.js +5479 -0
- package/dist/components/datetimepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +1202 -0
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +680 -0
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +439 -0
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +212 -0
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/image/index.js +396 -0
- package/dist/components/image/index.min.js +2 -0
- package/dist/components/input/index.js +764 -0
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +280 -0
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +586 -0
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +611 -0
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +516 -0
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +634 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +976 -0
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +1128 -0
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +764 -0
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +280 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +208 -0
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/rate/index.js +391 -0
- package/dist/components/rate/index.min.js +2 -0
- package/dist/components/select/index.js +560 -0
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/sidebar/index.js +337 -0
- package/dist/components/sidebar/index.min.js +2 -0
- package/dist/components/skeleton/index.js +87 -0
- package/dist/components/skeleton/index.min.js +2 -0
- package/dist/components/slider/index.js +1171 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +439 -0
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +925 -0
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +182 -0
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +4208 -0
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +837 -0
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +396 -0
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +2209 -0
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2906 -0
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +377 -0
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +445 -0
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +426 -0
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/Autocomplete-CjbTh9D8.js +862 -0
- package/dist/esm/Button-DyUYShTZ.js +116 -0
- package/dist/esm/CheckRadioMixin-DSD_rjC8.js +56 -0
- package/dist/esm/Checkbox-KUMz0sfA.js +83 -0
- package/dist/esm/CompatFallthroughMixin-C8LPuwDr.js +46 -0
- package/dist/esm/Datepicker-Bl8Wfdkn.js +2118 -0
- package/dist/esm/Dropdown-CGTYVyoL.js +467 -0
- package/dist/esm/DropdownItem-Cn3nM0A3.js +108 -0
- package/dist/esm/Field-B7bX_uUg.js +403 -0
- package/dist/esm/FormElementMixin-Dd_wkBN5.js +168 -0
- package/dist/esm/Icon-DPyGDeRK.js +182 -0
- package/dist/esm/Image-DhX-4hlV.js +354 -0
- package/dist/esm/InjectedChildMixin-D2K-FwuO.js +145 -0
- package/dist/esm/Input-C4L520az.js +348 -0
- package/dist/esm/Loading-tuQoo6TU.js +143 -0
- package/dist/esm/MessageMixin-CQ7LIdvq.js +134 -0
- package/dist/esm/Modal-tfvyhxw_.js +313 -0
- package/dist/esm/NoticeMixin-ByNlva3T.js +161 -0
- package/dist/esm/Pagination-B-LAJQay.js +543 -0
- package/dist/esm/Progress-BPGTVZgr.js +174 -0
- package/dist/esm/Select-bl4qUzij.js +145 -0
- package/dist/esm/SlotComponent-BwNpVnfH.js +39 -0
- package/dist/esm/TabbedChildMixin-C4i6WP9j.js +208 -0
- package/dist/esm/Tag-jS5Bcj6N.js +165 -0
- package/dist/esm/Timepicker-DnkqnOBT.js +281 -0
- package/dist/esm/TimepickerMixin-Bikh6_Fg.js +664 -0
- package/dist/esm/Tooltip-CtDSXAqa.js +391 -0
- package/dist/esm/_plugin-vue_export-helper-OJRSZE6i.js +9 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/breadcrumb.js +101 -0
- package/dist/esm/button.js +15 -0
- package/dist/esm/carousel.js +818 -0
- package/dist/esm/checkbox.js +82 -0
- package/dist/esm/clockpicker.js +663 -0
- package/dist/esm/collapse.js +94 -0
- package/dist/esm/colorpicker.js +16 -0
- package/dist/esm/config-CKuo-p6e.js +100 -0
- package/dist/esm/config.js +14 -0
- package/dist/esm/datepicker.js +23 -0
- package/dist/esm/datetimepicker.js +478 -0
- package/dist/esm/dialog.js +500 -0
- package/dist/esm/dropdown.js +17 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/helpers.js +247 -0
- package/dist/esm/icon.js +14 -0
- package/dist/esm/image.js +14 -0
- package/dist/esm/index-CQegEsxK.js +1938 -0
- package/dist/esm/index.js +164 -0
- package/dist/esm/input.js +17 -0
- package/dist/esm/loading.js +81 -0
- package/dist/esm/menu.js +333 -0
- package/dist/esm/message.js +114 -0
- package/dist/esm/modal.js +97 -0
- package/dist/esm/navbar.js +565 -0
- package/dist/esm/notification.js +275 -0
- package/dist/esm/numberinput.js +381 -0
- package/dist/esm/pagination.js +16 -0
- package/dist/esm/plugins-B172kuKE.js +13 -0
- package/dist/esm/progress.js +85 -0
- package/dist/esm/radio.js +131 -0
- package/dist/esm/rate.js +192 -0
- package/dist/esm/select.js +17 -0
- package/dist/esm/sidebar.js +304 -0
- package/dist/esm/skeleton.js +73 -0
- package/dist/esm/slider.js +693 -0
- package/dist/esm/snackbar.js +218 -0
- package/dist/esm/ssr-C7yEpGLm.js +5 -0
- package/dist/esm/steps.js +341 -0
- package/dist/esm/switch.js +156 -0
- package/dist/esm/table.js +2385 -0
- package/dist/esm/tabs.js +252 -0
- package/dist/esm/tag.js +38 -0
- package/dist/esm/taginput.js +420 -0
- package/dist/esm/timepicker.js +24 -0
- package/dist/esm/toast.js +156 -0
- package/dist/esm/tooltip.js +14 -0
- package/dist/esm/trapFocus-KHP_kCNE.js +51 -0
- package/dist/esm/upload.js +190 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +73 -6
- package/src/components/autocomplete/Autocomplete.spec.ts +783 -0
- package/src/components/autocomplete/Autocomplete.vue +966 -0
- package/src/components/autocomplete/__snapshots__/Autocomplete.spec.ts.snap +21 -0
- package/src/components/autocomplete/index.ts +16 -0
- package/src/components/breadcrumb/Breadcrumb.spec.ts +65 -0
- package/src/components/breadcrumb/Breadcrumb.vue +42 -0
- package/src/components/breadcrumb/BreadcrumbItem.spec.ts +74 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +34 -0
- package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.ts.snap +7 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.ts.snap +3 -0
- package/src/components/breadcrumb/index.ts +19 -0
- package/src/components/button/Button.spec.ts +117 -0
- package/src/components/button/Button.vue +112 -0
- package/src/components/button/__snapshots__/Button.spec.ts.snap +9 -0
- package/src/components/button/index.ts +16 -0
- package/src/components/carousel/Carousel.spec.ts +304 -0
- package/src/components/carousel/Carousel.vue +389 -0
- package/src/components/carousel/CarouselItem.spec.ts +105 -0
- package/src/components/carousel/CarouselItem.vue +38 -0
- package/src/components/carousel/CarouselList.spec.ts +172 -0
- package/src/components/carousel/CarouselList.vue +364 -0
- package/src/components/carousel/__snapshots__/Carousel.spec.ts.snap +19 -0
- package/src/components/carousel/__snapshots__/CarouselItem.spec.ts.snap +7 -0
- package/src/components/carousel/__snapshots__/CarouselList.spec.ts.snap +36 -0
- package/src/components/carousel/index.ts +23 -0
- package/src/components/carousel/types.ts +17 -0
- package/src/components/checkbox/Checkbox.spec.ts +40 -0
- package/src/components/checkbox/Checkbox.vue +63 -0
- package/src/components/checkbox/CheckboxButton.spec.ts +46 -0
- package/src/components/checkbox/CheckboxButton.vue +59 -0
- package/src/components/checkbox/__snapshots__/Checkbox.spec.ts.snap +9 -0
- package/src/components/checkbox/__snapshots__/CheckboxButton.spec.ts.snap +3 -0
- package/src/components/checkbox/index.ts +20 -0
- package/src/components/clockpicker/Clockpicker.spec.ts +161 -0
- package/src/components/clockpicker/Clockpicker.vue +311 -0
- package/src/components/clockpicker/ClockpickerFace.spec.ts +99 -0
- package/src/components/clockpicker/ClockpickerFace.vue +272 -0
- package/src/components/clockpicker/__snapshots__/Clockpicker.spec.ts.snap +36 -0
- package/src/components/clockpicker/__snapshots__/ClockpickerFace.spec.ts.snap +9 -0
- package/src/components/clockpicker/index.ts +16 -0
- package/src/components/collapse/Collapse.spec.ts +106 -0
- package/src/components/collapse/Collapse.vue +98 -0
- package/src/components/collapse/__snapshots__/Collapse.spec.ts.snap +10 -0
- package/src/components/collapse/index.ts +16 -0
- package/src/components/colorpicker/Colorpicker.spec.ts +22 -0
- package/src/components/colorpicker/Colorpicker.vue +416 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.spec.ts +17 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.vue +205 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +380 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +456 -0
- package/src/components/colorpicker/__snapshots__/Colorpicker.spec.ts.snap +77 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.ts.snap +9 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationSquare.spec.ts.snap +12 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.ts.snap +36 -0
- package/src/components/colorpicker/index.ts +16 -0
- package/src/components/datepicker/Datepicker.spec.ts +482 -0
- package/src/components/datepicker/Datepicker.vue +908 -0
- package/src/components/datepicker/DatepickerMonth.spec.ts +346 -0
- package/src/components/datepicker/DatepickerMonth.vue +444 -0
- package/src/components/datepicker/DatepickerTable.spec.ts +290 -0
- package/src/components/datepicker/DatepickerTable.vue +398 -0
- package/src/components/datepicker/DatepickerTableRow.spec.ts +300 -0
- package/src/components/datepicker/DatepickerTableRow.vue +416 -0
- package/src/components/datepicker/__snapshots__/Datepicker.spec.ts.snap +54 -0
- package/src/components/datepicker/__snapshots__/DatepickerMonth.spec.ts.snap +33 -0
- package/src/components/datepicker/__snapshots__/DatepickerTable.spec.ts.snap +16 -0
- package/src/components/datepicker/__snapshots__/DatepickerTableRow.spec.ts.snap +23 -0
- package/src/components/datepicker/index.ts +17 -0
- package/src/components/datepicker/types.ts +41 -0
- package/src/components/datetimepicker/Datetimepicker.spec.ts +132 -0
- package/src/components/datetimepicker/Datetimepicker.vue +491 -0
- package/src/components/datetimepicker/index.ts +16 -0
- package/src/components/dialog/Dialog.spec.ts +108 -0
- package/src/components/dialog/Dialog.vue +300 -0
- package/src/components/dialog/index.ts +169 -0
- package/src/components/dropdown/Dropdown.spec.ts +229 -0
- package/src/components/dropdown/Dropdown.vue +491 -0
- package/src/components/dropdown/DropdownItem.spec.ts +78 -0
- package/src/components/dropdown/DropdownItem.vue +112 -0
- package/src/components/dropdown/__snapshots__/Dropdown.spec.ts.snap +15 -0
- package/src/components/dropdown/__snapshots__/DropdownItem.spec.ts.snap +3 -0
- package/src/components/dropdown/index.ts +20 -0
- package/src/components/field/Field.spec.ts +324 -0
- package/src/components/field/Field.vue +316 -0
- package/src/components/field/FieldBody.spec.ts +96 -0
- package/src/components/field/FieldBody.vue +74 -0
- package/src/components/field/__snapshots__/Field.spec.ts.snap +8 -0
- package/src/components/field/__snapshots__/FieldBody.spec.ts.snap +3 -0
- package/src/components/field/index.ts +16 -0
- package/src/components/icon/Icon.spec.ts +142 -0
- package/src/components/icon/Icon.vue +120 -0
- package/src/components/icon/__snapshots__/Icon.spec.ts.snap +3 -0
- package/src/components/icon/index.ts +17 -0
- package/src/components/image/Image.spec.ts +218 -0
- package/src/components/image/Image.vue +358 -0
- package/src/components/image/__snapshots__/Image.spec.ts.snap +37 -0
- package/src/components/image/index.ts +16 -0
- package/src/components/index.ts +179 -0
- package/src/components/input/Input.spec.ts +396 -0
- package/src/components/input/Input.vue +335 -0
- package/src/components/input/__snapshots__/Input.spec.ts.snap +9 -0
- package/src/components/input/index.ts +17 -0
- package/src/components/loading/Loading.spec.ts +151 -0
- package/src/components/loading/Loading.vue +135 -0
- package/src/components/loading/__snapshots__/Loading.spec.ts.snap +10 -0
- package/src/components/loading/index.ts +91 -0
- package/src/components/menu/Menu.spec.ts +21 -0
- package/src/components/menu/Menu.vue +31 -0
- package/src/components/menu/MenuItem.spec.ts +92 -0
- package/src/components/menu/MenuItem.vue +168 -0
- package/src/components/menu/MenuItemContainerMixin.ts +72 -0
- package/src/components/menu/MenuList.spec.ts +35 -0
- package/src/components/menu/MenuList.vue +47 -0
- package/src/components/menu/__snapshots__/Menu.spec.ts.snap +3 -0
- package/src/components/menu/__snapshots__/MenuItem.spec.ts.snap +9 -0
- package/src/components/menu/__snapshots__/MenuList.spec.ts.snap +8 -0
- package/src/components/menu/index.ts +25 -0
- package/src/components/message/Message.spec.ts +30 -0
- package/src/components/message/Message.vue +73 -0
- package/src/components/message/__snapshots__/Message.spec.ts.snap +11 -0
- package/src/components/message/index.ts +15 -0
- package/src/components/modal/Modal.spec.ts +167 -0
- package/src/components/modal/Modal.vue +335 -0
- package/src/components/modal/__snapshots__/Modal.spec.ts.snap +10 -0
- package/src/components/modal/index.ts +107 -0
- package/src/components/navbar/NavBar.spec.ts +78 -0
- package/src/components/navbar/NavBarBurger.spec.ts +30 -0
- package/src/components/navbar/NavBarItem.spec.ts +92 -0
- package/src/components/navbar/Navbar.vue +274 -0
- package/src/components/navbar/NavbarBurger.vue +29 -0
- package/src/components/navbar/NavbarDropdown.spec.ts +84 -0
- package/src/components/navbar/NavbarDropdown.vue +115 -0
- package/src/components/navbar/NavbarItem.vue +97 -0
- package/src/components/navbar/__snapshots__/NavBar.spec.ts.snap +11 -0
- package/src/components/navbar/__snapshots__/NavBarBurger.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavBarItem.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavbarDropdown.spec.ts.snap +7 -0
- package/src/components/navbar/index.ts +22 -0
- package/src/components/notification/Notification.spec.ts +21 -0
- package/src/components/notification/Notification.vue +77 -0
- package/src/components/notification/NotificationNotice.vue +76 -0
- package/src/components/notification/__snapshots__/Notification.spec.ts.snap +10 -0
- package/src/components/notification/index.ts +121 -0
- package/src/components/numberinput/Numberinput.spec.ts +445 -0
- package/src/components/numberinput/Numberinput.vue +372 -0
- package/src/components/numberinput/index.ts +16 -0
- package/src/components/pagination/Pagination.spec.ts +94 -0
- package/src/components/pagination/Pagination.vue +434 -0
- package/src/components/pagination/PaginationButton.spec.ts +42 -0
- package/src/components/pagination/PaginationButton.vue +59 -0
- package/src/components/pagination/__snapshots__/Pagination.spec.ts.snap +22 -0
- package/src/components/pagination/__snapshots__/PaginationButton.spec.ts.snap +3 -0
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/types.ts +11 -0
- package/src/components/progress/Progress.spec.ts +81 -0
- package/src/components/progress/Progress.vue +168 -0
- package/src/components/progress/ProgressBar.spec.ts +45 -0
- package/src/components/progress/ProgressBar.vue +74 -0
- package/src/components/progress/__snapshots__/Progress.spec.ts.snap +7 -0
- package/src/components/progress/__snapshots__/ProgressBar.spec.ts.snap +7 -0
- package/src/components/progress/index.ts +18 -0
- package/src/components/radio/Radio.spec.ts +40 -0
- package/src/components/radio/Radio.vue +35 -0
- package/src/components/radio/RadioButton.spec.ts +40 -0
- package/src/components/radio/RadioButton.vue +69 -0
- package/src/components/radio/__snapshots__/Radio.spec.ts.snap +3 -0
- package/src/components/radio/__snapshots__/RadioButton.spec.ts.snap +3 -0
- package/src/components/radio/index.ts +18 -0
- package/src/components/rate/Rate.spec.ts +90 -0
- package/src/components/rate/Rate.vue +158 -0
- package/src/components/rate/index.ts +15 -0
- package/src/components/select/Select.spec.ts +74 -0
- package/src/components/select/Select.vue +118 -0
- package/src/components/select/__snapshots__/Select.spec.ts.snap +7 -0
- package/src/components/select/index.ts +16 -0
- package/src/components/sidebar/Sidebar.spec.ts +107 -0
- package/src/components/sidebar/Sidebar.vue +316 -0
- package/src/components/sidebar/__snapshots__/Sidebar.spec.ts.snap +25 -0
- package/src/components/sidebar/index.ts +16 -0
- package/src/components/skeleton/Skeleton.spec.ts +16 -0
- package/src/components/skeleton/Skeleton.vue +98 -0
- package/src/components/skeleton/__snapshots__/Skeleton.spec.ts.snap +7 -0
- package/src/components/skeleton/index.ts +18 -0
- package/src/components/slider/Slider.spec.ts +115 -0
- package/src/components/slider/Slider.vue +374 -0
- package/src/components/slider/SliderThumb.spec.ts +176 -0
- package/src/components/slider/SliderThumb.vue +251 -0
- package/src/components/slider/SliderTick.spec.ts +33 -0
- package/src/components/slider/SliderTick.vue +50 -0
- package/src/components/slider/__snapshots__/Slider.spec.ts.snap +12 -0
- package/src/components/slider/__snapshots__/SliderThumb.spec.ts.snap +16 -0
- package/src/components/slider/__snapshots__/SliderTick.spec.ts.snap +7 -0
- package/src/components/slider/index.ts +19 -0
- package/src/components/slider/types.ts +34 -0
- package/src/components/snackbar/Snackbar.spec.ts +35 -0
- package/src/components/snackbar/Snackbar.vue +88 -0
- package/src/components/snackbar/__snapshots__/Snackbar.spec.ts.snap +12 -0
- package/src/components/snackbar/index.ts +118 -0
- package/src/components/steps/StepItem.spec.ts +114 -0
- package/src/components/steps/StepItem.vue +26 -0
- package/src/components/steps/Steps.spec.ts +125 -0
- package/src/components/steps/Steps.vue +273 -0
- package/src/components/steps/__snapshots__/StepItem.spec.ts.snap +7 -0
- package/src/components/steps/__snapshots__/Steps.spec.ts.snap +40 -0
- package/src/components/steps/index.ts +19 -0
- package/src/components/switch/Switch.spec.ts +74 -0
- package/src/components/switch/Switch.vue +146 -0
- package/src/components/switch/__snapshots__/Switch.spec.ts.snap +3 -0
- package/src/components/switch/index.ts +16 -0
- package/src/components/table/Table.spec.ts +622 -0
- package/src/components/table/Table.vue +1770 -0
- package/src/components/table/TableColumn.spec.ts +85 -0
- package/src/components/table/TableColumn.vue +140 -0
- package/src/components/table/TableMobileSort.spec.ts +47 -0
- package/src/components/table/TableMobileSort.vue +236 -0
- package/src/components/table/TablePagination.vue +86 -0
- package/src/components/table/__snapshots__/Table.spec.ts.snap +24 -0
- package/src/components/table/__snapshots__/TableMobileSort.spec.ts.snap +12 -0
- package/src/components/table/index.ts +32 -0
- package/src/components/table/mockTableColumn.ts +110 -0
- package/src/components/table/types.ts +110 -0
- package/src/components/tabs/TabItem.spec.ts +203 -0
- package/src/components/tabs/TabItem.vue +19 -0
- package/src/components/tabs/Tabs.spec.ts +122 -0
- package/src/components/tabs/Tabs.vue +204 -0
- package/src/components/tabs/__snapshots__/TabItem.spec.ts.snap +7 -0
- package/src/components/tabs/__snapshots__/Tabs.spec.ts.snap +33 -0
- package/src/components/tabs/index.ts +19 -0
- package/src/components/tag/Tag.spec.ts +32 -0
- package/src/components/tag/Tag.vue +132 -0
- package/src/components/tag/Taglist.spec.ts +21 -0
- package/src/components/tag/Taglist.vue +16 -0
- package/src/components/tag/__snapshots__/Tag.spec.ts.snap +6 -0
- package/src/components/tag/__snapshots__/Taglist.spec.ts.snap +3 -0
- package/src/components/tag/index.ts +19 -0
- package/src/components/taginput/Taginput.spec.ts +132 -0
- package/src/components/taginput/Taginput.vue +415 -0
- package/src/components/taginput/__snapshots__/Taginput.spec.ts.snap +10 -0
- package/src/components/taginput/index.ts +16 -0
- package/src/components/timepicker/Timepicker.spec.ts +108 -0
- package/src/components/timepicker/Timepicker.vue +183 -0
- package/src/components/timepicker/__snapshots__/Timepicker.spec.ts.snap +41 -0
- package/src/components/timepicker/index.ts +17 -0
- package/src/components/toast/Toast.spec.ts +74 -0
- package/src/components/toast/Toast.vue +46 -0
- package/src/components/toast/__snapshots__/Toast.spec.ts.snap +10 -0
- package/src/components/toast/index.ts +120 -0
- package/src/components/tooltip/Tooltip.spec.ts +64 -0
- package/src/components/tooltip/Tooltip.vue +393 -0
- package/src/components/tooltip/__snapshots__/Tooltip.spec.ts.snap +12 -0
- package/src/components/tooltip/index.ts +16 -0
- package/src/components/upload/Upload.spec.ts +62 -0
- package/src/components/upload/Upload.vue +188 -0
- package/src/components/upload/__snapshots__/Upload.spec.ts.snap +3 -0
- package/src/components/upload/index.ts +15 -0
- package/src/directives/clickOutside.ts +113 -0
- package/src/directives/trapFocus.ts +61 -0
- package/src/index.ts +43 -0
- package/src/scss/buefy-build.scss +6 -0
- package/src/scss/buefy.scss +39 -0
- package/src/scss/components/_autocomplete.scss +39 -0
- package/src/scss/components/_carousel.scss +204 -0
- package/src/scss/components/_checkbox.scss +106 -0
- package/src/scss/components/_clockpicker.scss +283 -0
- package/src/scss/components/_collapse.scss +9 -0
- package/src/scss/components/_colorpicker.scss +283 -0
- package/src/scss/components/_datepicker.scss +220 -0
- package/src/scss/components/_dialog.scss +54 -0
- package/src/scss/components/_dropdown.scss +143 -0
- package/src/scss/components/_form.scss +309 -0
- package/src/scss/components/_icon.scss +16 -0
- package/src/scss/components/_image.scss +20 -0
- package/src/scss/components/_loading.scss +45 -0
- package/src/scss/components/_menu.scss +11 -0
- package/src/scss/components/_message.scss +16 -0
- package/src/scss/components/_modal.scss +37 -0
- package/src/scss/components/_navbar.scss +22 -0
- package/src/scss/components/_notices.scss +144 -0
- package/src/scss/components/_notification.scss +8 -0
- package/src/scss/components/_numberinput.scss +33 -0
- package/src/scss/components/_pagination.scss +63 -0
- package/src/scss/components/_progress.scss +105 -0
- package/src/scss/components/_radio.scss +123 -0
- package/src/scss/components/_rate.scss +72 -0
- package/src/scss/components/_select.scss +38 -0
- package/src/scss/components/_sidebar.scss +107 -0
- package/src/scss/components/_skeleton.scss +66 -0
- package/src/scss/components/_slider.scss +162 -0
- package/src/scss/components/_steps.scss +491 -0
- package/src/scss/components/_switch.scss +214 -0
- package/src/scss/components/_table.scss +322 -0
- package/src/scss/components/_tabs.scss +197 -0
- package/src/scss/components/_tag.scss +36 -0
- package/src/scss/components/_taginput.scss +73 -0
- package/src/scss/components/_timepicker.scss +73 -0
- package/src/scss/components/_tooltip.scss +192 -0
- package/src/scss/components/_upload.scss +62 -0
- package/src/scss/utils/_all.scss +4 -0
- package/src/scss/utils/_animations.scss +183 -0
- package/src/scss/utils/_functions.scss +49 -0
- package/src/scss/utils/_helpers.scss +6 -0
- package/src/scss/utils/_variables-ext.scss +2 -0
- package/src/scss/utils/_variables.scss +16 -0
- package/src/utils/CheckRadioMixin.spec.ts +28 -0
- package/src/utils/CheckRadioMixin.ts +61 -0
- package/src/utils/CompatFallthroughMixin.ts +34 -0
- package/src/utils/ConfigComponent.ts +12 -0
- package/src/utils/FormElementMixin.spec.ts +41 -0
- package/src/utils/FormElementMixin.ts +206 -0
- package/src/utils/InjectedChildMixin.ts +139 -0
- package/src/utils/MessageMixin.spec.ts +51 -0
- package/src/utils/MessageMixin.ts +138 -0
- package/src/utils/NoticeMixin.spec.ts +55 -0
- package/src/utils/NoticeMixin.ts +181 -0
- package/src/utils/ProvideInjectTypes.ts +20 -0
- package/src/utils/ProviderParentMixin.ts +105 -0
- package/src/utils/SlotComponent.spec.ts +55 -0
- package/src/utils/SlotComponent.ts +38 -0
- package/src/utils/TabbedChildMixin.ts +96 -0
- package/src/utils/TabbedMixin.ts +166 -0
- package/src/utils/TabbedTypes.ts +33 -0
- package/src/utils/TimepickerMixin.spec.ts +75 -0
- package/src/utils/TimepickerMixin.ts +767 -0
- package/src/utils/color.spec.ts +55 -0
- package/src/utils/color.ts +507 -0
- package/src/utils/config.spec.ts +11 -0
- package/src/utils/config.ts +619 -0
- package/src/utils/debounce.spec.ts +52 -0
- package/src/utils/debounce.ts +20 -0
- package/src/utils/helpers.spec.ts +257 -0
- package/src/utils/helpers.ts +527 -0
- package/src/utils/icons.ts +73 -0
- package/src/utils/plugins.ts +20 -0
- package/src/utils/ssr.ts +6 -0
- package/src/utils/vue-augmentation.ts +35 -0
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="dropdown dropdown-menu-animation"
|
|
4
|
+
ref="dropdown"
|
|
5
|
+
:class="rootClasses"
|
|
6
|
+
@mouseleave="isHoverable = false"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
v-if="!inline"
|
|
10
|
+
:tabindex="disabled ? undefined : triggerTabindex"
|
|
11
|
+
ref="trigger"
|
|
12
|
+
class="dropdown-trigger"
|
|
13
|
+
@click="onClick"
|
|
14
|
+
@contextmenu.prevent="onContextMenu"
|
|
15
|
+
@mouseenter="onHover"
|
|
16
|
+
@focus.capture="onFocus"
|
|
17
|
+
@touchstart="onTouchStart"
|
|
18
|
+
@touchmove="onTouchMove"
|
|
19
|
+
@touchend="onTouchEnd"
|
|
20
|
+
aria-haspopup="true"
|
|
21
|
+
>
|
|
22
|
+
<slot name="trigger" :active="isActive" />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<transition :name="animation">
|
|
26
|
+
<div
|
|
27
|
+
v-if="isMobileModal"
|
|
28
|
+
v-show="isActive"
|
|
29
|
+
class="background"
|
|
30
|
+
:aria-hidden="!isActive"
|
|
31
|
+
/>
|
|
32
|
+
</transition>
|
|
33
|
+
<transition :name="animation">
|
|
34
|
+
<div
|
|
35
|
+
v-show="(!disabled && (isActive || isHoverable)) || inline"
|
|
36
|
+
ref="dropdownMenu"
|
|
37
|
+
class="dropdown-menu"
|
|
38
|
+
:style="style"
|
|
39
|
+
:aria-hidden="!isActive"
|
|
40
|
+
v-trap-focus="trapFocus"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="dropdown-content"
|
|
44
|
+
:role="ariaRole"
|
|
45
|
+
:aria-modal="!inline"
|
|
46
|
+
:style="contentStyle"
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</transition>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script lang="ts">
|
|
56
|
+
import { defineComponent } from 'vue'
|
|
57
|
+
import type { PropType } from 'vue'
|
|
58
|
+
|
|
59
|
+
import trapFocus from '../../directives/trapFocus'
|
|
60
|
+
import config from '../../utils/config'
|
|
61
|
+
import { removeElement, createAbsoluteElement, isCustomElement, toCssWidth } from '../../utils/helpers'
|
|
62
|
+
|
|
63
|
+
const DEFAULT_CLOSE_OPTIONS = ['escape', 'outside']
|
|
64
|
+
|
|
65
|
+
export const DROPDOWN_TRIGGERS = ['click', 'contextmenu', 'focus', 'hover'] as const
|
|
66
|
+
|
|
67
|
+
export type DropdownTrigger = typeof DROPDOWN_TRIGGERS[number]
|
|
68
|
+
|
|
69
|
+
export const DROPDOWN_INJECTION_KEY = Symbol('bdropdown')
|
|
70
|
+
|
|
71
|
+
// TODO: `ItemValueType` is ideally a type parameter of `BDropdown`,
|
|
72
|
+
// but I do not know how to do it with the Options API.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
export type ItemValueType = any
|
|
75
|
+
|
|
76
|
+
export default defineComponent({
|
|
77
|
+
name: 'BDropdown',
|
|
78
|
+
directives: {
|
|
79
|
+
trapFocus
|
|
80
|
+
},
|
|
81
|
+
provide() {
|
|
82
|
+
return {
|
|
83
|
+
[DROPDOWN_INJECTION_KEY]: this
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
props: {
|
|
87
|
+
modelValue: {
|
|
88
|
+
type: [
|
|
89
|
+
String, Number, Boolean, Object, Array, Function
|
|
90
|
+
] as PropType<ItemValueType | ItemValueType[]>,
|
|
91
|
+
default: null
|
|
92
|
+
},
|
|
93
|
+
disabled: Boolean,
|
|
94
|
+
inline: Boolean,
|
|
95
|
+
scrollable: Boolean,
|
|
96
|
+
maxHeight: {
|
|
97
|
+
type: [String, Number],
|
|
98
|
+
default: 200
|
|
99
|
+
},
|
|
100
|
+
position: {
|
|
101
|
+
type: String,
|
|
102
|
+
validator(value) {
|
|
103
|
+
return [
|
|
104
|
+
'is-top-right',
|
|
105
|
+
'is-top-left',
|
|
106
|
+
'is-bottom-left',
|
|
107
|
+
'is-bottom-right'
|
|
108
|
+
].indexOf(value as string) > -1
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
triggers: {
|
|
112
|
+
type: Array<DropdownTrigger>,
|
|
113
|
+
default: () => ['click']
|
|
114
|
+
},
|
|
115
|
+
mobileModal: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: () => {
|
|
118
|
+
return config.defaultDropdownMobileModal
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
ariaRole: {
|
|
122
|
+
type: String,
|
|
123
|
+
validator(value) {
|
|
124
|
+
return [
|
|
125
|
+
'menu',
|
|
126
|
+
'list',
|
|
127
|
+
'dialog'
|
|
128
|
+
].indexOf(value as string) > -1
|
|
129
|
+
},
|
|
130
|
+
default: null
|
|
131
|
+
},
|
|
132
|
+
animation: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'fade'
|
|
135
|
+
},
|
|
136
|
+
multiple: Boolean,
|
|
137
|
+
trapFocus: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: () => {
|
|
140
|
+
return config.defaultTrapFocus
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
closeOnClick: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: true
|
|
146
|
+
},
|
|
147
|
+
canClose: {
|
|
148
|
+
type: [Array, Boolean],
|
|
149
|
+
default: true
|
|
150
|
+
},
|
|
151
|
+
expanded: Boolean,
|
|
152
|
+
appendToBody: Boolean,
|
|
153
|
+
appendToBodyCopyParent: Boolean,
|
|
154
|
+
triggerTabindex: {
|
|
155
|
+
type: Number,
|
|
156
|
+
default: 0
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
emits: {
|
|
160
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
161
|
+
'active-change': (_isActive: boolean) => true,
|
|
162
|
+
change: (_selected: ItemValueType | ItemValueType[]) => true,
|
|
163
|
+
'update:modelValue': (_value: ItemValueType | ItemValueType[]) => true
|
|
164
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
165
|
+
},
|
|
166
|
+
data() {
|
|
167
|
+
return {
|
|
168
|
+
selected: this.modelValue,
|
|
169
|
+
style: {},
|
|
170
|
+
isActive: false,
|
|
171
|
+
isHoverable: false,
|
|
172
|
+
maybeTap: false,
|
|
173
|
+
isTouchEnabled: false,
|
|
174
|
+
_bodyEl: undefined as Element | undefined, // Used to append to body
|
|
175
|
+
timeOutID: undefined as ReturnType<typeof setTimeout> | undefined,
|
|
176
|
+
timeOutID2: undefined as ReturnType<typeof setTimeout> | undefined
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
computed: {
|
|
180
|
+
rootClasses() {
|
|
181
|
+
return [this.position, {
|
|
182
|
+
'is-disabled': this.disabled,
|
|
183
|
+
'is-hoverable': this.hoverable,
|
|
184
|
+
'is-inline': this.inline,
|
|
185
|
+
'is-active': this.isActive || this.inline,
|
|
186
|
+
'is-mobile-modal': this.isMobileModal,
|
|
187
|
+
'is-expanded': this.expanded,
|
|
188
|
+
'is-touch-enabled': this.isTouchEnabled
|
|
189
|
+
} as Record<string, boolean | undefined>]
|
|
190
|
+
},
|
|
191
|
+
isMobileModal() {
|
|
192
|
+
return this.mobileModal && !this.inline
|
|
193
|
+
},
|
|
194
|
+
cancelOptions() {
|
|
195
|
+
return typeof this.canClose === 'boolean'
|
|
196
|
+
? this.canClose
|
|
197
|
+
? DEFAULT_CLOSE_OPTIONS
|
|
198
|
+
: []
|
|
199
|
+
: this.canClose
|
|
200
|
+
},
|
|
201
|
+
contentStyle() {
|
|
202
|
+
return {
|
|
203
|
+
maxHeight: this.scrollable ? toCssWidth(this.maxHeight) ?? undefined : undefined,
|
|
204
|
+
overflow: this.scrollable ? 'auto' : undefined
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
hoverable() {
|
|
208
|
+
return this.triggers.indexOf('hover') >= 0
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
watch: {
|
|
212
|
+
/*
|
|
213
|
+
* When v-model is changed set the new selected item.
|
|
214
|
+
*/
|
|
215
|
+
modelValue(value) {
|
|
216
|
+
this.selected = value
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
* Emit event when isActive value is changed.
|
|
221
|
+
*
|
|
222
|
+
* Also resets `isTouchEnabled` when it turns inactive.
|
|
223
|
+
*/
|
|
224
|
+
isActive(value) {
|
|
225
|
+
this.$emit('active-change', value)
|
|
226
|
+
if (!value) {
|
|
227
|
+
// delays to reset the touch enabled flag until the dropdown
|
|
228
|
+
// menu disappears to avoid glitches
|
|
229
|
+
// also takes care of chattering, e.g., repeated quick taps,
|
|
230
|
+
// otherwise the flag may become inconsistent with the actual
|
|
231
|
+
// state of the dropdown menu
|
|
232
|
+
this.timeOutID = setTimeout(() => {
|
|
233
|
+
if (!this.isActive) {
|
|
234
|
+
this.isTouchEnabled = false
|
|
235
|
+
}
|
|
236
|
+
}, 250)
|
|
237
|
+
}
|
|
238
|
+
this.handleScroll()
|
|
239
|
+
if (this.appendToBody) {
|
|
240
|
+
this.$nextTick(() => {
|
|
241
|
+
this.updateAppendToBody()
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
isHoverable(value) {
|
|
247
|
+
if (this.hoverable) {
|
|
248
|
+
this.$emit('active-change', value)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
methods: {
|
|
253
|
+
handleScroll() {
|
|
254
|
+
if (typeof window === 'undefined') return
|
|
255
|
+
|
|
256
|
+
if (this.isMobileModal) {
|
|
257
|
+
if (this.isActive) {
|
|
258
|
+
document.documentElement.classList.add('is-clipped-touch')
|
|
259
|
+
} else {
|
|
260
|
+
document.documentElement.classList.remove('is-clipped-touch')
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
* Click listener from DropdownItem.
|
|
267
|
+
* 1. Set new selected item.
|
|
268
|
+
* 2. Emit input event to update the user v-model.
|
|
269
|
+
* 3. Close the dropdown.
|
|
270
|
+
*/
|
|
271
|
+
selectItem(value: ItemValueType) {
|
|
272
|
+
if (this.multiple) {
|
|
273
|
+
if (this.selected) {
|
|
274
|
+
const selected = this.selected as ItemValueType[]
|
|
275
|
+
if (selected.indexOf(value) === -1) {
|
|
276
|
+
// Add value
|
|
277
|
+
this.selected = [...selected, value]
|
|
278
|
+
} else {
|
|
279
|
+
// Remove value
|
|
280
|
+
this.selected = selected.filter((val) => val !== value)
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
this.selected = [value]
|
|
284
|
+
}
|
|
285
|
+
this.$emit('change', this.selected)
|
|
286
|
+
} else {
|
|
287
|
+
if (this.selected !== value) {
|
|
288
|
+
this.selected = value
|
|
289
|
+
this.$emit('change', this.selected)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
this.$emit('update:modelValue', this.selected)
|
|
293
|
+
if (!this.multiple) {
|
|
294
|
+
this.isActive = !this.closeOnClick
|
|
295
|
+
if (this.hoverable && this.closeOnClick) {
|
|
296
|
+
this.isHoverable = false
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
/*
|
|
302
|
+
* White-listed items to not close when clicked.
|
|
303
|
+
*/
|
|
304
|
+
isInWhiteList(el: EventTarget | null) {
|
|
305
|
+
if (el === this.$refs.dropdownMenu) return true
|
|
306
|
+
if (el === this.$refs.trigger) return true
|
|
307
|
+
// All chidren from dropdown
|
|
308
|
+
if (this.$refs.dropdownMenu != null) {
|
|
309
|
+
const children = (this.$refs.dropdownMenu as Element).querySelectorAll('*')
|
|
310
|
+
for (const child of children) {
|
|
311
|
+
if (el === child) {
|
|
312
|
+
return true
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// All children from trigger
|
|
317
|
+
if (this.$refs.trigger != null) {
|
|
318
|
+
const children = (this.$refs.trigger as Element).querySelectorAll('*')
|
|
319
|
+
for (const child of children) {
|
|
320
|
+
if (el === child) {
|
|
321
|
+
return true
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return false
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
/*
|
|
329
|
+
* Close dropdown if clicked outside.
|
|
330
|
+
*/
|
|
331
|
+
clickedOutside(event: Event) {
|
|
332
|
+
if (this.cancelOptions.indexOf('outside') < 0) return
|
|
333
|
+
if (this.inline) return
|
|
334
|
+
|
|
335
|
+
const target = isCustomElement(this) ? event.composedPath()[0] : event.target
|
|
336
|
+
if (!this.isInWhiteList(target)) this.isActive = false
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
/*
|
|
340
|
+
* Keypress event that is bound to the document
|
|
341
|
+
*/
|
|
342
|
+
keyPress({ key }: { key?: KeyboardEvent['key'] }) {
|
|
343
|
+
if (this.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
344
|
+
if (this.cancelOptions.indexOf('escape') < 0) return
|
|
345
|
+
this.isActive = false
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
onClick() {
|
|
350
|
+
// hover precedes
|
|
351
|
+
if (this.triggers.indexOf('hover') !== -1) return
|
|
352
|
+
if (this.triggers.indexOf('click') < 0) return
|
|
353
|
+
this.toggle()
|
|
354
|
+
},
|
|
355
|
+
onContextMenu() {
|
|
356
|
+
if (this.triggers.indexOf('contextmenu') < 0) return
|
|
357
|
+
this.toggle()
|
|
358
|
+
},
|
|
359
|
+
onHover() {
|
|
360
|
+
if (this.triggers.indexOf('hover') < 0) return
|
|
361
|
+
// touch precedes
|
|
362
|
+
if (this.isTouchEnabled) return
|
|
363
|
+
this.isHoverable = true
|
|
364
|
+
},
|
|
365
|
+
// takes care of touch-enabled devices
|
|
366
|
+
// - does nothing if hover trigger is disabled
|
|
367
|
+
// - suppresses hover trigger by setting isTouchEnabled
|
|
368
|
+
// - handles only a tap; i.e., touchstart on the trigger immediately
|
|
369
|
+
// folowed by touchend
|
|
370
|
+
onTouchStart() {
|
|
371
|
+
this.maybeTap = true
|
|
372
|
+
},
|
|
373
|
+
onTouchMove() {
|
|
374
|
+
this.maybeTap = false
|
|
375
|
+
},
|
|
376
|
+
onTouchEnd(e: TouchEvent) {
|
|
377
|
+
if (this.triggers.indexOf('hover') === -1) return
|
|
378
|
+
if (!this.maybeTap) return
|
|
379
|
+
// tap on dropdown contents may happen without preventDefault
|
|
380
|
+
e.preventDefault()
|
|
381
|
+
this.maybeTap = false
|
|
382
|
+
this.isTouchEnabled = true
|
|
383
|
+
this.toggle()
|
|
384
|
+
},
|
|
385
|
+
onFocus() {
|
|
386
|
+
if (this.triggers.indexOf('focus') < 0) return
|
|
387
|
+
this.toggle()
|
|
388
|
+
},
|
|
389
|
+
|
|
390
|
+
/*
|
|
391
|
+
* Toggle dropdown if it's not disabled.
|
|
392
|
+
*/
|
|
393
|
+
toggle() {
|
|
394
|
+
if (this.disabled) return
|
|
395
|
+
|
|
396
|
+
if (!this.isActive) {
|
|
397
|
+
// if not active, toggle after clickOutside event
|
|
398
|
+
// this fixes toggling programmatic
|
|
399
|
+
// $nextTick may not wait for other events since Vue 3.
|
|
400
|
+
this.timeOutID2 = setTimeout(() => {
|
|
401
|
+
const value = !this.isActive
|
|
402
|
+
this.isActive = value
|
|
403
|
+
})
|
|
404
|
+
} else {
|
|
405
|
+
this.isActive = !this.isActive
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
updateAppendToBody() {
|
|
410
|
+
const dropdown = this.$refs.dropdown as HTMLElement
|
|
411
|
+
const dropdownMenu = this.$refs.dropdownMenu as Element
|
|
412
|
+
const trigger = this.$refs.trigger as Element
|
|
413
|
+
if (dropdownMenu && trigger) {
|
|
414
|
+
// update wrapper dropdown
|
|
415
|
+
const dropdownWrapper = this.$data._bodyEl!.children[0]
|
|
416
|
+
dropdownWrapper.classList.forEach((item) => dropdownWrapper.classList.remove(item))
|
|
417
|
+
dropdownWrapper.classList.add('dropdown')
|
|
418
|
+
dropdownWrapper.classList.add('dropdown-menu-animation')
|
|
419
|
+
// TODO: The following test never becomes true on Vue 3.
|
|
420
|
+
// It was intended to solve the following issue:
|
|
421
|
+
// https://github.com/buefy/buefy/issues/1872
|
|
422
|
+
// Since TypeScript won't tolerate it, I comment it out
|
|
423
|
+
// until we learn more about the issue.
|
|
424
|
+
/*
|
|
425
|
+
if (this.$vnode && this.$vnode.data && this.$vnode.data.staticClass) {
|
|
426
|
+
dropdownWrapper.classList.add(this.$vnode.data.staticClass)
|
|
427
|
+
} */
|
|
428
|
+
this.rootClasses.forEach((item) => {
|
|
429
|
+
// skip position prop
|
|
430
|
+
if (item && typeof item === 'object') {
|
|
431
|
+
for (const key in item) {
|
|
432
|
+
if (item[key]) {
|
|
433
|
+
dropdownWrapper.classList.add(key)
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
if (this.appendToBodyCopyParent) {
|
|
439
|
+
const parentNode = (this.$refs.dropdown as Element).parentNode!
|
|
440
|
+
const parent = this.$data._bodyEl!
|
|
441
|
+
parent.classList.forEach((item) => parent.classList.remove(item));
|
|
442
|
+
(parentNode as Element).classList.forEach((item) => {
|
|
443
|
+
parent.classList.add(item)
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
const rect = trigger.getBoundingClientRect()
|
|
447
|
+
let top = rect.top + window.scrollY
|
|
448
|
+
let left = rect.left + window.scrollX
|
|
449
|
+
if (!this.position || this.position.indexOf('bottom') >= 0) {
|
|
450
|
+
top += trigger.clientHeight
|
|
451
|
+
} else {
|
|
452
|
+
top -= dropdownMenu.clientHeight
|
|
453
|
+
}
|
|
454
|
+
if (this.position && this.position.indexOf('left') >= 0) {
|
|
455
|
+
left -= (dropdownMenu.clientWidth - trigger.clientWidth)
|
|
456
|
+
}
|
|
457
|
+
this.style = {
|
|
458
|
+
position: 'absolute',
|
|
459
|
+
top: `${top}px`,
|
|
460
|
+
left: `${left}px`,
|
|
461
|
+
zIndex: '99',
|
|
462
|
+
width: this.expanded ? `${dropdown.offsetWidth}px` : undefined
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
mounted() {
|
|
468
|
+
if (this.appendToBody) {
|
|
469
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.dropdownMenu as Element)
|
|
470
|
+
this.updateAppendToBody()
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
created() {
|
|
474
|
+
if (typeof window !== 'undefined') {
|
|
475
|
+
document.addEventListener('click', this.clickedOutside)
|
|
476
|
+
document.addEventListener('keyup', this.keyPress)
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
beforeUnmount() {
|
|
480
|
+
if (typeof window !== 'undefined') {
|
|
481
|
+
document.removeEventListener('click', this.clickedOutside)
|
|
482
|
+
document.removeEventListener('keyup', this.keyPress)
|
|
483
|
+
}
|
|
484
|
+
if (this.appendToBody) {
|
|
485
|
+
removeElement(this.$data._bodyEl!)
|
|
486
|
+
}
|
|
487
|
+
clearTimeout(this.timeOutID)
|
|
488
|
+
clearTimeout(this.timeOutID2)
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
</script>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { shallowMount } from '@vue/test-utils'
|
|
3
|
+
import type { VueWrapper } from '@vue/test-utils'
|
|
4
|
+
import { DROPDOWN_INJECTION_KEY } from '@components/dropdown/Dropdown.vue'
|
|
5
|
+
import type { ItemValueType } from '@components/dropdown/Dropdown.vue'
|
|
6
|
+
import BDropdownItem from '@components/dropdown/DropdownItem.vue'
|
|
7
|
+
|
|
8
|
+
let wrapper: VueWrapper<InstanceType<typeof BDropdownItem>>
|
|
9
|
+
const dropdownSelected = 'val'
|
|
10
|
+
|
|
11
|
+
describe('BDropdownItem', () => {
|
|
12
|
+
let parent: {
|
|
13
|
+
selected: ItemValueType,
|
|
14
|
+
selectItem: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
parent = {
|
|
19
|
+
selected: dropdownSelected,
|
|
20
|
+
selectItem: vi.fn()
|
|
21
|
+
} // mocks injected Dropdown
|
|
22
|
+
wrapper = shallowMount(BDropdownItem, {
|
|
23
|
+
global: {
|
|
24
|
+
provide: {
|
|
25
|
+
[DROPDOWN_INJECTION_KEY]: parent
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('is called', () => {
|
|
32
|
+
expect(wrapper.vm).toBeTruthy()
|
|
33
|
+
expect(wrapper.vm.$options.name).toBe('BDropdownItem')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('render correctly', () => {
|
|
37
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('returns item classes accordingly', async () => {
|
|
41
|
+
const value = dropdownSelected
|
|
42
|
+
const hasLink = true
|
|
43
|
+
const disabled = false
|
|
44
|
+
const paddingless = true
|
|
45
|
+
const isActive = true
|
|
46
|
+
await wrapper.setProps({
|
|
47
|
+
value,
|
|
48
|
+
hasLink,
|
|
49
|
+
disabled,
|
|
50
|
+
paddingless
|
|
51
|
+
})
|
|
52
|
+
expect(wrapper.vm.itemClasses).toEqual({
|
|
53
|
+
'dropdown-item': !hasLink,
|
|
54
|
+
'is-disabled': disabled,
|
|
55
|
+
'is-paddingless': paddingless,
|
|
56
|
+
'is-active': isActive,
|
|
57
|
+
'has-link': hasLink
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('returns if item is clickable accordingly', async () => {
|
|
62
|
+
expect(wrapper.vm.isClickable).toBeTruthy()
|
|
63
|
+
|
|
64
|
+
await wrapper.setProps({ separator: true })
|
|
65
|
+
expect(wrapper.vm.isClickable).toBeFalsy()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('react accordingly when the item is selected', async () => {
|
|
69
|
+
await wrapper.setProps({ separator: true })
|
|
70
|
+
wrapper.vm.selectItem()
|
|
71
|
+
expect(parent.selectItem).not.toHaveBeenCalled()
|
|
72
|
+
|
|
73
|
+
await wrapper.setProps({ separator: false })
|
|
74
|
+
wrapper.vm.selectItem()
|
|
75
|
+
expect(parent.selectItem).toHaveBeenCalled()
|
|
76
|
+
expect(wrapper.emitted().click).toBeTruthy()
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<hr v-if="separator" class="dropdown-divider">
|
|
3
|
+
<a
|
|
4
|
+
v-else-if="!custom && !hasLink"
|
|
5
|
+
class="dropdown-item"
|
|
6
|
+
:class="anchorClasses"
|
|
7
|
+
@click="selectItem"
|
|
8
|
+
:role="ariaRoleItem"
|
|
9
|
+
:tabindex="isFocusable ? 0 : undefined"
|
|
10
|
+
>
|
|
11
|
+
<slot />
|
|
12
|
+
</a>
|
|
13
|
+
<div
|
|
14
|
+
v-else
|
|
15
|
+
:class="itemClasses"
|
|
16
|
+
@click="selectItem"
|
|
17
|
+
:role="ariaRoleItem"
|
|
18
|
+
:tabindex="isFocusable ? 0 : undefined"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import { defineComponent } from 'vue'
|
|
26
|
+
import type { PropType } from 'vue'
|
|
27
|
+
|
|
28
|
+
import Dropdown, { DROPDOWN_INJECTION_KEY } from './Dropdown.vue'
|
|
29
|
+
import type { ItemValueType } from './Dropdown.vue'
|
|
30
|
+
|
|
31
|
+
type DropdownInstance = InstanceType<typeof Dropdown>
|
|
32
|
+
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
name: 'BDropdownItem',
|
|
35
|
+
inject: {
|
|
36
|
+
parent: {
|
|
37
|
+
from: DROPDOWN_INJECTION_KEY,
|
|
38
|
+
default: undefined
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
value: {
|
|
43
|
+
type: [String, Number, Boolean, Object, Array, Function] as PropType<ItemValueType>,
|
|
44
|
+
default: null
|
|
45
|
+
},
|
|
46
|
+
separator: Boolean,
|
|
47
|
+
disabled: Boolean,
|
|
48
|
+
custom: Boolean,
|
|
49
|
+
focusable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
paddingless: Boolean,
|
|
54
|
+
hasLink: Boolean,
|
|
55
|
+
ariaRole: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
emits: {
|
|
61
|
+
click: () => true
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
anchorClasses() {
|
|
65
|
+
return {
|
|
66
|
+
'is-disabled': (this.parent as DropdownInstance).disabled || this.disabled,
|
|
67
|
+
'is-paddingless': this.paddingless,
|
|
68
|
+
'is-active': this.isActive
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
itemClasses() {
|
|
72
|
+
return {
|
|
73
|
+
'dropdown-item': !this.hasLink,
|
|
74
|
+
'is-disabled': this.disabled,
|
|
75
|
+
'is-paddingless': this.paddingless,
|
|
76
|
+
'is-active': this.isActive,
|
|
77
|
+
'has-link': this.hasLink
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
ariaRoleItem() {
|
|
81
|
+
return this.ariaRole === 'menuitem' || this.ariaRole === 'listitem' ? this.ariaRole : undefined
|
|
82
|
+
},
|
|
83
|
+
isClickable() {
|
|
84
|
+
return !(this.parent as DropdownInstance).disabled &&
|
|
85
|
+
!this.separator &&
|
|
86
|
+
!this.disabled &&
|
|
87
|
+
!this.custom
|
|
88
|
+
},
|
|
89
|
+
isActive() {
|
|
90
|
+
if ((this.parent as DropdownInstance).selected === null) return false
|
|
91
|
+
if ((this.parent as DropdownInstance).multiple) {
|
|
92
|
+
return (this.parent as DropdownInstance).selected.indexOf(this.value) >= 0
|
|
93
|
+
}
|
|
94
|
+
return this.value === (this.parent as DropdownInstance).selected
|
|
95
|
+
},
|
|
96
|
+
isFocusable() {
|
|
97
|
+
return this.hasLink ? false : this.focusable
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
/*
|
|
102
|
+
* Click listener, select the item.
|
|
103
|
+
*/
|
|
104
|
+
selectItem() {
|
|
105
|
+
if (!this.isClickable) return
|
|
106
|
+
|
|
107
|
+
(this.parent as DropdownInstance).selectItem(this.value)
|
|
108
|
+
this.$emit('click')
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`BDropdown > render correctly 1`] = `
|
|
4
|
+
"<div class="dropdown dropdown-menu-animation is-mobile-modal">
|
|
5
|
+
<div tabindex="0" class="dropdown-trigger" aria-haspopup="true"><button class="trigger">trigger</button></div>
|
|
6
|
+
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
|
7
|
+
<div class="background" aria-hidden="true" style="display: none;"></div>
|
|
8
|
+
</transition-stub>
|
|
9
|
+
<transition-stub name="fade" appear="false" persisted="true" css="true">
|
|
10
|
+
<div class="dropdown-menu" aria-hidden="true" style="display: none;">
|
|
11
|
+
<div class="dropdown-content" aria-modal="true"></div>
|
|
12
|
+
</div>
|
|
13
|
+
</transition-stub>
|
|
14
|
+
</div>"
|
|
15
|
+
`;
|