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,105 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import type { VueWrapper } from '@vue/test-utils'
|
|
4
|
+
import { defineComponent } from 'vue'
|
|
5
|
+
import BCarousel from '@components/carousel/Carousel.vue'
|
|
6
|
+
import BCarouselItem from '@components/carousel/CarouselItem.vue'
|
|
7
|
+
|
|
8
|
+
type BCarouselInstance = InstanceType<typeof BCarousel>
|
|
9
|
+
type BCarouselItemInstance = InstanceType<typeof BCarouselItem>
|
|
10
|
+
|
|
11
|
+
const WrapperComp = defineComponent({
|
|
12
|
+
components: {
|
|
13
|
+
BCarousel,
|
|
14
|
+
BCarouselItem
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
// to indirectly change BCarousel's animated prop
|
|
18
|
+
animated: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'slide'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<BCarousel ref="carousel" :animated="animated">
|
|
25
|
+
<BCarouselItem value="item1"/>
|
|
26
|
+
<BCarouselItem ref="testItem" value="item2"/>
|
|
27
|
+
<BCarouselItem ref="testItem2" value="item3"/>
|
|
28
|
+
</BCarousel>`
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
let wrapper: VueWrapper<BCarouselItemInstance>
|
|
32
|
+
let wrapperParent: VueWrapper<InstanceType<typeof WrapperComp>>
|
|
33
|
+
let wrapperCarousel: VueWrapper<BCarouselInstance>
|
|
34
|
+
|
|
35
|
+
describe('BCarouselItem', () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
wrapperParent = mount(WrapperComp)
|
|
38
|
+
wrapperCarousel = wrapperParent.findComponent<BCarouselInstance>({ ref: 'carousel' })
|
|
39
|
+
wrapper = wrapperParent.findComponent<BCarouselItemInstance>({ ref: 'testItem' })
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('is called', () => {
|
|
43
|
+
expect(wrapper.vm).toBeTruthy()
|
|
44
|
+
expect(wrapper.vm.$options.name).toBe('BCarouselItem')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('render correctly', () => {
|
|
48
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('computes its position correctly', () => {
|
|
52
|
+
expect(wrapper.vm.index).toBe(1)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('transition correctly', async () => {
|
|
56
|
+
wrapperCarousel.vm.changeActive(2)
|
|
57
|
+
expect(wrapper.vm.transition).toBe('slide-prev')
|
|
58
|
+
|
|
59
|
+
wrapperCarousel.vm.changeActive(0)
|
|
60
|
+
expect(wrapper.vm.transition).toBe('slide-next')
|
|
61
|
+
|
|
62
|
+
await wrapperParent.setProps({ animated: 'fade' })
|
|
63
|
+
wrapperCarousel.vm.changeActive(0)
|
|
64
|
+
expect(wrapper.vm.transition).toBe('fade')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('update active state', () => {
|
|
68
|
+
expect(wrapper.vm.isActive).toBe(false)
|
|
69
|
+
|
|
70
|
+
wrapperCarousel.vm.changeActive(1)
|
|
71
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
72
|
+
|
|
73
|
+
wrapperCarousel.vm.changeActive(2)
|
|
74
|
+
expect(wrapper.vm.isActive).toBe(false)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
describe('with explicit order', () => {
|
|
78
|
+
let wrapperCarousel: VueWrapper<BCarouselInstance>
|
|
79
|
+
let wrapperTestItem: VueWrapper<BCarouselItemInstance>
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
const wrapper = mount({
|
|
83
|
+
template: `
|
|
84
|
+
<BCarousel ref="carousel">
|
|
85
|
+
<BCarouselItem ref="testItem" :order="2" />
|
|
86
|
+
<BCarouselItem :order="1" />
|
|
87
|
+
<BCarouselItem :order="3" />
|
|
88
|
+
</BCarousel>`,
|
|
89
|
+
components: { BCarousel, BCarouselItem }
|
|
90
|
+
})
|
|
91
|
+
wrapperCarousel = wrapper.findComponent<BCarouselInstance>({ ref: 'carousel' })
|
|
92
|
+
wrapperTestItem = wrapper.findComponent<BCarouselItemInstance>({ ref: 'testItem' })
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('update active state', () => {
|
|
96
|
+
expect(wrapperTestItem.vm.isActive).toBe(false)
|
|
97
|
+
|
|
98
|
+
wrapperCarousel.vm.changeActive(1)
|
|
99
|
+
expect(wrapperTestItem.vm.isActive).toBe(true)
|
|
100
|
+
|
|
101
|
+
wrapperCarousel.vm.changeActive(2)
|
|
102
|
+
expect(wrapperTestItem.vm.isActive).toBe(false)
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition :name="transition">
|
|
3
|
+
<div v-show="isActive" class="carousel-item">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</transition>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from 'vue'
|
|
11
|
+
|
|
12
|
+
import InjectedChildMixin, { Sorted } from '../../utils/InjectedChildMixin'
|
|
13
|
+
import type { ICarousel } from './types'
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
name: 'BCarouselItem',
|
|
17
|
+
mixins: [InjectedChildMixin<typeof Sorted, ICarousel>('carousel', Sorted)],
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
transitionName: null
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
computed: {
|
|
24
|
+
transition() {
|
|
25
|
+
if (this.parent.animated === 'fade') {
|
|
26
|
+
return 'fade'
|
|
27
|
+
} else if (this.parent.transition) {
|
|
28
|
+
return 'slide-' + this.parent.transition
|
|
29
|
+
} else {
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
isActive() {
|
|
34
|
+
return this.parent.activeChildIndex === this.index
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,172 @@
|
|
|
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 BCarouselList from '@components/carousel/CarouselList.vue'
|
|
5
|
+
|
|
6
|
+
let wrapper: VueWrapper<InstanceType<typeof BCarouselList>>
|
|
7
|
+
const data = [
|
|
8
|
+
{
|
|
9
|
+
title: 'Slide 1',
|
|
10
|
+
image: 'https://picsum.photos/id/0/1230/500'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
title: 'Slide 2',
|
|
14
|
+
image: 'https://picsum.photos/id/1/1230/500'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: 'Slide 3',
|
|
18
|
+
image: 'https://picsum.photos/id/2/1230/500'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: 'Slide 4',
|
|
22
|
+
image: 'https://picsum.photos/id/3/1230/500'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: 'Slide 5',
|
|
26
|
+
image: 'https://picsum.photos/id/4/1230/500'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: 'Slide 6',
|
|
30
|
+
image: 'https://picsum.photos/id/5/1230/500'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: 'Slide 7',
|
|
34
|
+
image: 'https://picsum.photos/id/6/1230/500'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: 'Slide 8',
|
|
38
|
+
image: 'https://picsum.photos/id/7/1230/500'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
describe('BCarouselList', () => {
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
wrapper = shallowMount(BCarouselList, {
|
|
45
|
+
props: {
|
|
46
|
+
data
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('is called', () => {
|
|
52
|
+
expect(wrapper.vm).toBeTruthy()
|
|
53
|
+
expect(wrapper.vm.$options.name).toBe('BCarouselList')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('render correctly', () => {
|
|
57
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('uses breakpoints', async () => {
|
|
61
|
+
await wrapper.setProps({
|
|
62
|
+
itemsToShow: 4,
|
|
63
|
+
itemsToList: 1,
|
|
64
|
+
breakpoints: {
|
|
65
|
+
768: {
|
|
66
|
+
hasGrayscale: false,
|
|
67
|
+
itemsToShow: 6,
|
|
68
|
+
itemsToList: 2
|
|
69
|
+
},
|
|
70
|
+
960: {
|
|
71
|
+
hasGrayscale: true,
|
|
72
|
+
itemsToShow: 8
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
expect(wrapper.vm.settings.itemsToShow).toBe(8)
|
|
78
|
+
|
|
79
|
+
global.innerWidth = 960
|
|
80
|
+
global.dispatchEvent(new Event('resize'))
|
|
81
|
+
await wrapper.vm.$nextTick()
|
|
82
|
+
|
|
83
|
+
expect(wrapper.vm.settings.itemsToShow).toBe(8)
|
|
84
|
+
|
|
85
|
+
global.innerWidth = 959
|
|
86
|
+
global.dispatchEvent(new Event('resize'))
|
|
87
|
+
await wrapper.vm.$nextTick()
|
|
88
|
+
|
|
89
|
+
expect(wrapper.vm.settings.itemsToShow).toBe(6)
|
|
90
|
+
|
|
91
|
+
global.innerWidth = 767
|
|
92
|
+
global.dispatchEvent(new Event('resize'))
|
|
93
|
+
await wrapper.vm.$nextTick()
|
|
94
|
+
expect(wrapper.vm.settings.itemsToShow).toBe(4)
|
|
95
|
+
expect(wrapper.vm.settings.itemsToList).toBe(1)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('doesn\'t show empty slots', async () => {
|
|
99
|
+
await wrapper.setProps({
|
|
100
|
+
itemsToShow: 4,
|
|
101
|
+
modelValue: 8
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
expect(wrapper.vm.scrollIndex).toBe(4)
|
|
105
|
+
expect(wrapper.vm.hasNext).toBe(false)
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('repeats', async () => {
|
|
109
|
+
await wrapper.setProps({
|
|
110
|
+
itemsToShow: 4,
|
|
111
|
+
itemsToList: 1,
|
|
112
|
+
repeat: true,
|
|
113
|
+
modelValue: 0
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
expect(wrapper.vm.scrollIndex).toBe(0)
|
|
117
|
+
wrapper.vm.next()
|
|
118
|
+
wrapper.vm.next()
|
|
119
|
+
wrapper.vm.next()
|
|
120
|
+
wrapper.vm.next()
|
|
121
|
+
await wrapper.vm.$nextTick()
|
|
122
|
+
expect(wrapper.vm.scrollIndex).toBe(4)
|
|
123
|
+
|
|
124
|
+
wrapper.vm.next()
|
|
125
|
+
expect(wrapper.vm.scrollIndex).toBe(0)
|
|
126
|
+
|
|
127
|
+
wrapper.vm.prev()
|
|
128
|
+
expect(wrapper.vm.scrollIndex).toBe(4)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
it('removes events listener when removed', () => {
|
|
132
|
+
const map: Record<string, EventListenerOrEventListenerObject> = {}
|
|
133
|
+
vi.spyOn(window, 'removeEventListener').mockImplementation((event, cb) => {
|
|
134
|
+
map[event] = cb
|
|
135
|
+
})
|
|
136
|
+
wrapper.find('.carousel-list').trigger('mousedown')
|
|
137
|
+
wrapper.unmount()
|
|
138
|
+
|
|
139
|
+
expect(map.resize).toBe(wrapper.vm.resized)
|
|
140
|
+
expect(map.mousemove).toBe(wrapper.vm.dragMove)
|
|
141
|
+
expect(map.mouseup).toBe(wrapper.vm.dragEnd)
|
|
142
|
+
vi.mocked(window.removeEventListener).mockRestore()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('drags correctly', async () => {
|
|
146
|
+
wrapper.vm.$el.getBoundingClientRect = vi.fn(() => ({
|
|
147
|
+
width: 400
|
|
148
|
+
}))
|
|
149
|
+
await wrapper.setData({ windowWidth: 400 })
|
|
150
|
+
await wrapper.setProps({
|
|
151
|
+
itemsToShow: 4
|
|
152
|
+
})
|
|
153
|
+
await wrapper.setData({ delta: 0 })
|
|
154
|
+
expect(wrapper.vm.itemWidth).toBe(100)
|
|
155
|
+
|
|
156
|
+
await wrapper.vm.$nextTick()
|
|
157
|
+
expect(wrapper.vm.translation).toBe(-0)
|
|
158
|
+
|
|
159
|
+
await wrapper.setData({ delta: -600 })
|
|
160
|
+
expect(wrapper.vm.translation).toBe(-0)
|
|
161
|
+
|
|
162
|
+
await wrapper.setData({ delta: 2000 })
|
|
163
|
+
expect(wrapper.vm.translation).toBe(-400)
|
|
164
|
+
|
|
165
|
+
await wrapper.setProps({
|
|
166
|
+
modelValue: 4
|
|
167
|
+
})
|
|
168
|
+
expect(wrapper.vm.translation).toBe(-400)
|
|
169
|
+
await wrapper.setData({ delta: -300 })
|
|
170
|
+
expect(wrapper.vm.translation).toBe(-100)
|
|
171
|
+
})
|
|
172
|
+
})
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="carousel-list"
|
|
4
|
+
:class="{'has-shadow': scrollIndex > 0}"
|
|
5
|
+
@mousedown.prevent="dragStart"
|
|
6
|
+
@touchstart="dragStart"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="carousel-slides"
|
|
10
|
+
:class="listClass"
|
|
11
|
+
:style="'transform:translateX('+translation+'px)'"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
v-for="(list, index) in data"
|
|
15
|
+
class="carousel-slide"
|
|
16
|
+
:class="{'is-active': asIndicator ? activeItem === index : scrollIndex === index}"
|
|
17
|
+
@mouseup="checkAsIndicator(index, $event)"
|
|
18
|
+
@touchend="checkAsIndicator(index, $event)"
|
|
19
|
+
:key="index"
|
|
20
|
+
:style="itemStyle"
|
|
21
|
+
>
|
|
22
|
+
<slot
|
|
23
|
+
:index="index"
|
|
24
|
+
:active="activeItem"
|
|
25
|
+
:scroll="scrollIndex"
|
|
26
|
+
v-bind="list"
|
|
27
|
+
:list="list"
|
|
28
|
+
name="item"
|
|
29
|
+
>
|
|
30
|
+
<b-image
|
|
31
|
+
:src="list.image"
|
|
32
|
+
v-bind="list"
|
|
33
|
+
/>
|
|
34
|
+
</slot>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div
|
|
38
|
+
v-if="arrow"
|
|
39
|
+
class="carousel-arrow"
|
|
40
|
+
:class="{'is-hovered': settings.arrowHover}"
|
|
41
|
+
>
|
|
42
|
+
<b-icon
|
|
43
|
+
v-show="hasPrev"
|
|
44
|
+
class="has-icons-left"
|
|
45
|
+
@click.prevent="prev"
|
|
46
|
+
:pack="settings.iconPack"
|
|
47
|
+
:icon="settings.iconPrev"
|
|
48
|
+
:size="settings.iconSize"
|
|
49
|
+
both
|
|
50
|
+
/>
|
|
51
|
+
<b-icon
|
|
52
|
+
v-show="hasNext"
|
|
53
|
+
class="has-icons-right"
|
|
54
|
+
@click.prevent="next"
|
|
55
|
+
:pack="settings.iconPack"
|
|
56
|
+
:icon="settings.iconNext"
|
|
57
|
+
:size="settings.iconSize"
|
|
58
|
+
both
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script lang="ts">
|
|
65
|
+
import { defineComponent } from 'vue'
|
|
66
|
+
import type { PropType } from 'vue'
|
|
67
|
+
|
|
68
|
+
import { sign, mod, bound } from '../../utils/helpers'
|
|
69
|
+
import config from '../../utils/config'
|
|
70
|
+
|
|
71
|
+
import BIcon from '../icon/Icon.vue'
|
|
72
|
+
import BImage from '../image/Image.vue'
|
|
73
|
+
|
|
74
|
+
// Item type of the `data` prop.
|
|
75
|
+
// Ideally, this should be a type parameter, but I was not able to figure out
|
|
76
|
+
// how to realize it with the Options API.
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
export type Datum = any
|
|
79
|
+
|
|
80
|
+
export interface BreakpointSettings {
|
|
81
|
+
arrowHover: boolean
|
|
82
|
+
hasGrayscale?: boolean
|
|
83
|
+
hasOpacity?: boolean
|
|
84
|
+
repeat?: boolean
|
|
85
|
+
hasDrag: boolean
|
|
86
|
+
itemsToShow: number
|
|
87
|
+
itemsToList: number
|
|
88
|
+
iconPack?: string
|
|
89
|
+
iconSize?: string
|
|
90
|
+
iconPrev: string
|
|
91
|
+
iconNext: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type BreakpointOptions = Partial<BreakpointSettings>
|
|
95
|
+
|
|
96
|
+
export default defineComponent({
|
|
97
|
+
name: 'BCarouselList',
|
|
98
|
+
components: {
|
|
99
|
+
BIcon,
|
|
100
|
+
BImage
|
|
101
|
+
},
|
|
102
|
+
props: {
|
|
103
|
+
data: {
|
|
104
|
+
type: Array<Datum>,
|
|
105
|
+
default: () => []
|
|
106
|
+
},
|
|
107
|
+
modelValue: {
|
|
108
|
+
type: Number,
|
|
109
|
+
default: 0
|
|
110
|
+
},
|
|
111
|
+
scrollValue: {
|
|
112
|
+
type: Number,
|
|
113
|
+
default: 0
|
|
114
|
+
},
|
|
115
|
+
hasDrag: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true
|
|
118
|
+
},
|
|
119
|
+
hasGrayscale: Boolean,
|
|
120
|
+
hasOpacity: Boolean,
|
|
121
|
+
repeat: Boolean,
|
|
122
|
+
itemsToShow: {
|
|
123
|
+
type: Number,
|
|
124
|
+
default: 4
|
|
125
|
+
},
|
|
126
|
+
itemsToList: {
|
|
127
|
+
type: Number,
|
|
128
|
+
default: 1
|
|
129
|
+
},
|
|
130
|
+
asIndicator: Boolean,
|
|
131
|
+
arrow: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: true
|
|
134
|
+
},
|
|
135
|
+
arrowHover: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: true
|
|
138
|
+
},
|
|
139
|
+
iconPack: String,
|
|
140
|
+
iconSize: String,
|
|
141
|
+
iconPrev: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: () => {
|
|
144
|
+
return config.defaultIconPrev
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
iconNext: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: () => {
|
|
150
|
+
return config.defaultIconNext
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
breakpoints: {
|
|
154
|
+
type: Object as PropType<Record<number, BreakpointOptions>>,
|
|
155
|
+
default: () => ({})
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
emits: {
|
|
159
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
160
|
+
switch: (_value: number) => true,
|
|
161
|
+
'update:modelValue': (_value: number) => true,
|
|
162
|
+
'updated:scroll': (_index: number) => true
|
|
163
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
164
|
+
},
|
|
165
|
+
data() {
|
|
166
|
+
return {
|
|
167
|
+
activeItem: this.modelValue,
|
|
168
|
+
scrollIndex: this.asIndicator ? this.scrollValue : this.modelValue,
|
|
169
|
+
delta: 0,
|
|
170
|
+
dragX: false as number | false,
|
|
171
|
+
hold: 0,
|
|
172
|
+
windowWidth: 0,
|
|
173
|
+
touch: false,
|
|
174
|
+
observer: null as ResizeObserver | null,
|
|
175
|
+
refresh_: 0
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
computed: {
|
|
179
|
+
dragging() {
|
|
180
|
+
return this.dragX !== false
|
|
181
|
+
},
|
|
182
|
+
listClass() {
|
|
183
|
+
return [
|
|
184
|
+
{
|
|
185
|
+
'has-grayscale': this.settings.hasGrayscale,
|
|
186
|
+
'has-opacity': this.settings.hasOpacity,
|
|
187
|
+
'is-dragging': this.dragging
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
itemStyle() {
|
|
192
|
+
return `width: ${this.itemWidth}px;`
|
|
193
|
+
},
|
|
194
|
+
translation() {
|
|
195
|
+
return -bound(
|
|
196
|
+
this.delta + (this.scrollIndex * this.itemWidth), 0,
|
|
197
|
+
(this.data.length - this.settings.itemsToShow) * this.itemWidth
|
|
198
|
+
)
|
|
199
|
+
},
|
|
200
|
+
total() {
|
|
201
|
+
return this.data.length - this.settings.itemsToShow
|
|
202
|
+
},
|
|
203
|
+
hasPrev() {
|
|
204
|
+
return (this.settings.repeat || this.scrollIndex > 0)
|
|
205
|
+
},
|
|
206
|
+
hasNext() {
|
|
207
|
+
return (this.settings.repeat || this.scrollIndex < this.total)
|
|
208
|
+
},
|
|
209
|
+
breakpointKeys() {
|
|
210
|
+
return Object.keys(this.breakpoints).sort((a, b) => +b - +a)
|
|
211
|
+
},
|
|
212
|
+
settings(): BreakpointSettings {
|
|
213
|
+
const breakpoint = this.breakpointKeys.filter((breakpoint) => {
|
|
214
|
+
if (this.windowWidth >= +breakpoint) {
|
|
215
|
+
return true
|
|
216
|
+
} else {
|
|
217
|
+
return false
|
|
218
|
+
}
|
|
219
|
+
})[0]
|
|
220
|
+
if (breakpoint) {
|
|
221
|
+
return { ...this.$props, ...this.breakpoints[+breakpoint] }
|
|
222
|
+
}
|
|
223
|
+
return this.$props
|
|
224
|
+
},
|
|
225
|
+
itemWidth() {
|
|
226
|
+
if (this.windowWidth) { // Ensure component is mounted
|
|
227
|
+
/* eslint-disable-next-line */
|
|
228
|
+
this.refresh_; // We force the computed property to refresh if this prop is changed
|
|
229
|
+
|
|
230
|
+
const rect = this.$el.getBoundingClientRect()
|
|
231
|
+
return rect.width / this.settings.itemsToShow
|
|
232
|
+
}
|
|
233
|
+
return 0
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
watch: {
|
|
237
|
+
/*
|
|
238
|
+
* When v-model is changed set the new active item.
|
|
239
|
+
*/
|
|
240
|
+
modelValue(value) {
|
|
241
|
+
this.switchTo(this.asIndicator ? value - (this.itemsToShow - 3) / 2 : value)
|
|
242
|
+
if (this.activeItem !== value) {
|
|
243
|
+
this.activeItem = bound(value, 0, this.data.length - 1)
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
scrollValue(value) {
|
|
247
|
+
this.switchTo(value)
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
methods: {
|
|
251
|
+
resized() {
|
|
252
|
+
this.windowWidth = window.innerWidth
|
|
253
|
+
},
|
|
254
|
+
switchTo(newIndex: number) {
|
|
255
|
+
if (newIndex === this.scrollIndex || isNaN(newIndex)) { return }
|
|
256
|
+
|
|
257
|
+
if (this.settings.repeat) {
|
|
258
|
+
newIndex = mod(newIndex, this.total + 1)
|
|
259
|
+
}
|
|
260
|
+
newIndex = bound(newIndex, 0, this.total)
|
|
261
|
+
this.scrollIndex = newIndex
|
|
262
|
+
if (!this.asIndicator && this.modelValue !== newIndex) {
|
|
263
|
+
this.$emit('update:modelValue', newIndex)
|
|
264
|
+
} else if (this.scrollIndex !== newIndex) {
|
|
265
|
+
this.$emit('updated:scroll', newIndex)
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
next() {
|
|
269
|
+
this.switchTo(this.scrollIndex + this.settings.itemsToList)
|
|
270
|
+
},
|
|
271
|
+
prev() {
|
|
272
|
+
this.switchTo(this.scrollIndex - this.settings.itemsToList)
|
|
273
|
+
},
|
|
274
|
+
checkAsIndicator(value: number, event: MouseEvent | TouchEvent) {
|
|
275
|
+
if (!this.asIndicator) return
|
|
276
|
+
|
|
277
|
+
const dragEndX = (event as TouchEvent).changedTouches
|
|
278
|
+
? (event as TouchEvent).changedTouches[0].clientX
|
|
279
|
+
: (event as MouseEvent).clientX
|
|
280
|
+
if (this.hold - Date.now() > 2000 || Math.abs(+this.dragX - dragEndX) > 10) return
|
|
281
|
+
|
|
282
|
+
this.dragX = false
|
|
283
|
+
this.hold = 0
|
|
284
|
+
event.preventDefault()
|
|
285
|
+
|
|
286
|
+
// Make the item appear in the middle
|
|
287
|
+
this.activeItem = value
|
|
288
|
+
|
|
289
|
+
this.$emit('switch', value)
|
|
290
|
+
},
|
|
291
|
+
// handle drag event
|
|
292
|
+
dragStart(event: MouseEvent | TouchEvent) {
|
|
293
|
+
if (
|
|
294
|
+
this.dragging ||
|
|
295
|
+
!this.settings.hasDrag ||
|
|
296
|
+
((event as MouseEvent).button !== 0 && event.type !== 'touchstart')
|
|
297
|
+
) return
|
|
298
|
+
this.hold = Date.now()
|
|
299
|
+
this.touch = !!(event as TouchEvent).touches
|
|
300
|
+
this.dragX = this.touch
|
|
301
|
+
? (event as TouchEvent).touches[0].clientX
|
|
302
|
+
: (event as MouseEvent).clientX
|
|
303
|
+
window.addEventListener(this.touch ? 'touchmove' : 'mousemove', this.dragMove)
|
|
304
|
+
window.addEventListener(this.touch ? 'touchend' : 'mouseup', this.dragEnd)
|
|
305
|
+
},
|
|
306
|
+
dragMove(event: MouseEvent | TouchEvent) {
|
|
307
|
+
if (!this.dragging) return
|
|
308
|
+
const dragEndX = (event as TouchEvent).touches
|
|
309
|
+
? ((event as TouchEvent).changedTouches[0] ||
|
|
310
|
+
(event as TouchEvent).touches[0]).clientX
|
|
311
|
+
: (event as MouseEvent).clientX
|
|
312
|
+
this.delta = +this.dragX - dragEndX
|
|
313
|
+
if (!(event as TouchEvent).touches) {
|
|
314
|
+
event.preventDefault()
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
dragEnd() {
|
|
318
|
+
if (!this.dragging && !this.hold) return
|
|
319
|
+
if (this.hold) {
|
|
320
|
+
const signCheck = sign(this.delta)
|
|
321
|
+
const results = Math.round(Math.abs(this.delta / this.itemWidth) + 0.15)// Hack
|
|
322
|
+
this.switchTo(this.scrollIndex + signCheck * results)
|
|
323
|
+
}
|
|
324
|
+
this.delta = 0
|
|
325
|
+
this.dragX = false
|
|
326
|
+
window.removeEventListener(this.touch ? 'touchmove' : 'mousemove', this.dragMove)
|
|
327
|
+
window.removeEventListener(this.touch ? 'touchend' : 'mouseup', this.dragEnd)
|
|
328
|
+
},
|
|
329
|
+
refresh() {
|
|
330
|
+
this.$nextTick(() => {
|
|
331
|
+
this.refresh_++
|
|
332
|
+
})
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
mounted() {
|
|
336
|
+
if (typeof window !== 'undefined') {
|
|
337
|
+
if (window.ResizeObserver) {
|
|
338
|
+
this.observer = new ResizeObserver(this.refresh)
|
|
339
|
+
this.observer.observe(this.$el)
|
|
340
|
+
}
|
|
341
|
+
window.addEventListener('resize', this.resized)
|
|
342
|
+
document.addEventListener('animationend', this.refresh)
|
|
343
|
+
document.addEventListener('transitionend', this.refresh)
|
|
344
|
+
document.addEventListener('transitionstart', this.refresh)
|
|
345
|
+
this.resized()
|
|
346
|
+
}
|
|
347
|
+
if (this.$attrs.config) {
|
|
348
|
+
throw new Error('The config prop was removed, you need to use v-bind instead')
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
beforeUnmount() {
|
|
352
|
+
if (typeof window !== 'undefined') {
|
|
353
|
+
if (window.ResizeObserver) {
|
|
354
|
+
this.observer!.disconnect()
|
|
355
|
+
}
|
|
356
|
+
window.removeEventListener('resize', this.resized)
|
|
357
|
+
document.removeEventListener('animationend', this.refresh)
|
|
358
|
+
document.removeEventListener('transitionend', this.refresh)
|
|
359
|
+
document.removeEventListener('transitionstart', this.refresh)
|
|
360
|
+
this.dragEnd()
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`BCarousel > render correctly 1`] = `
|
|
4
|
+
"<div class="carousel">
|
|
5
|
+
<!--v-if-->
|
|
6
|
+
<div class="carousel-items">
|
|
7
|
+
<div></div>
|
|
8
|
+
<div></div>
|
|
9
|
+
<div class="carousel-arrow is-hovered">
|
|
10
|
+
<b-icon-stub icon="chevron-left" both="true" class="has-icons-left" style="display: none;"></b-icon-stub>
|
|
11
|
+
<b-icon-stub icon="chevron-right" both="true" class="has-icons-right" style=""></b-icon-stub>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<!--v-if-->
|
|
15
|
+
<!--v-if-->
|
|
16
|
+
<div class="carousel-indicator is-inside is-bottom"><a class="indicator-item is-active"><span class="indicator-style is-dots"></span></a><a class="indicator-item"><span class="indicator-style is-dots"></span></a></div>
|
|
17
|
+
<!--v-if-->
|
|
18
|
+
</div>"
|
|
19
|
+
`;
|