buefy 0.9.9 → 0.9.13

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.
Files changed (278) hide show
  1. package/CHANGELOG.md +1639 -1609
  2. package/dist/buefy.css +20 -2
  3. package/dist/buefy.esm.js +2227 -1869
  4. package/dist/buefy.esm.min.js +2 -2
  5. package/dist/buefy.js +2266 -1907
  6. package/dist/buefy.min.css +1 -1
  7. package/dist/buefy.min.js +2 -2
  8. package/dist/cjs/autocomplete.js +6 -6
  9. package/dist/cjs/breadcrumb.js +127 -0
  10. package/dist/cjs/button.js +6 -107
  11. package/dist/cjs/carousel.js +9 -7
  12. package/dist/cjs/checkbox.js +5 -5
  13. package/dist/cjs/{chunk-d33a8a78.js → chunk-114191ae.js} +3 -3
  14. package/dist/cjs/{chunk-dafdb70c.js → chunk-2062216d.js} +39 -3
  15. package/dist/cjs/{chunk-64efc596.js → chunk-2911aa4b.js} +20 -16
  16. package/dist/cjs/{chunk-96ab31c1.js → chunk-2ae50815.js} +7 -7
  17. package/dist/cjs/{chunk-c3032504.js → chunk-2c7de785.js} +3 -3
  18. package/dist/cjs/{chunk-50ff3a78.js → chunk-30670fac.js} +96 -15
  19. package/dist/cjs/{chunk-e57b3891.js → chunk-34949503.js} +2 -2
  20. package/dist/cjs/{chunk-0abd2223.js → chunk-3b43d77a.js} +2 -2
  21. package/dist/cjs/{chunk-dcdbe2e8.js → chunk-3cc5d9a6.js} +1 -1
  22. package/dist/cjs/{chunk-0b57168e.js → chunk-61023b09.js} +3 -3
  23. package/dist/cjs/chunk-6cb902f8.js +314 -0
  24. package/dist/cjs/{chunk-adb01a93.js → chunk-7da0c017.js} +26 -24
  25. package/dist/cjs/{chunk-60255743.js → chunk-9103eeda.js} +4 -0
  26. package/dist/cjs/{chunk-14c82365.js → chunk-92621ff7.js} +37 -0
  27. package/dist/cjs/{chunk-816cba7a.js → chunk-9e4cf4c5.js} +1 -1
  28. package/dist/cjs/{chunk-33b9d1cf.js → chunk-a11294f9.js} +27 -26
  29. package/dist/cjs/{chunk-430b5370.js → chunk-bfcad370.js} +25 -2
  30. package/dist/cjs/{chunk-cc470e7c.js → chunk-c6fbc7b4.js} +7 -7
  31. package/dist/cjs/{chunk-993f89de.js → chunk-c7b2aa4b.js} +5 -4
  32. package/dist/cjs/{chunk-6474e963.js → chunk-d0f8ea39.js} +9 -9
  33. package/dist/cjs/{chunk-3acb500b.js → chunk-d120e215.js} +2 -2
  34. package/dist/cjs/{chunk-f5baaa70.js → chunk-d54e40f6.js} +2 -1
  35. package/dist/cjs/{chunk-916a2858.js → chunk-f5106717.js} +4 -4
  36. package/dist/cjs/chunk-fe2f57ee.js +110 -0
  37. package/dist/cjs/{chunk-2571dc7c.js → chunk-fefd7b77.js} +0 -0
  38. package/dist/cjs/clockpicker.js +11 -11
  39. package/dist/cjs/config.js +2 -2
  40. package/dist/cjs/datepicker.js +12 -12
  41. package/dist/cjs/datetimepicker.js +22 -15
  42. package/dist/cjs/dialog.js +13 -11
  43. package/dist/cjs/dropdown.js +8 -8
  44. package/dist/cjs/field.js +5 -5
  45. package/dist/cjs/helpers.js +2 -3
  46. package/dist/cjs/icon.js +3 -3
  47. package/dist/cjs/image.js +6 -311
  48. package/dist/cjs/index.js +29 -23
  49. package/dist/cjs/input.js +5 -5
  50. package/dist/cjs/loading.js +6 -6
  51. package/dist/cjs/menu.js +3 -3
  52. package/dist/cjs/message.js +6 -6
  53. package/dist/cjs/modal.js +6 -6
  54. package/dist/cjs/navbar.js +16 -4
  55. package/dist/cjs/notification.js +23 -11
  56. package/dist/cjs/numberinput.js +9 -7
  57. package/dist/cjs/pagination.js +8 -8
  58. package/dist/cjs/progress.js +10 -6
  59. package/dist/cjs/radio.js +3 -3
  60. package/dist/cjs/rate.js +3 -3
  61. package/dist/cjs/select.js +7 -7
  62. package/dist/cjs/sidebar.js +2 -2
  63. package/dist/cjs/slider.js +4 -4
  64. package/dist/cjs/snackbar.js +5 -5
  65. package/dist/cjs/steps.js +8 -8
  66. package/dist/cjs/switch.js +1 -1
  67. package/dist/cjs/table.js +13 -13
  68. package/dist/cjs/tabs.js +8 -8
  69. package/dist/cjs/tag.js +3 -3
  70. package/dist/cjs/taginput.js +34 -22
  71. package/dist/cjs/timepicker.js +13 -13
  72. package/dist/cjs/toast.js +5 -5
  73. package/dist/cjs/tooltip.js +5 -5
  74. package/dist/cjs/upload.js +5 -5
  75. package/dist/components/autocomplete/index.js +98 -13
  76. package/dist/components/autocomplete/index.min.js +2 -2
  77. package/dist/components/breadcrumb/index.js +293 -0
  78. package/dist/components/breadcrumb/index.min.js +2 -0
  79. package/dist/components/button/index.js +5 -1
  80. package/dist/components/button/index.min.js +2 -2
  81. package/dist/components/carousel/index.js +348 -15
  82. package/dist/components/carousel/index.min.js +2 -2
  83. package/dist/components/checkbox/index.js +1 -1
  84. package/dist/components/checkbox/index.min.js +1 -1
  85. package/dist/components/clockpicker/index.js +54 -47
  86. package/dist/components/clockpicker/index.min.js +2 -2
  87. package/dist/components/collapse/index.js +1 -1
  88. package/dist/components/collapse/index.min.js +1 -1
  89. package/dist/components/datepicker/index.js +41 -32
  90. package/dist/components/datepicker/index.min.js +2 -2
  91. package/dist/components/datetimepicker/index.js +75 -58
  92. package/dist/components/datetimepicker/index.min.js +2 -2
  93. package/dist/components/dialog/index.js +126 -18
  94. package/dist/components/dialog/index.min.js +2 -2
  95. package/dist/components/dropdown/index.js +5 -1
  96. package/dist/components/dropdown/index.min.js +1 -1
  97. package/dist/components/field/index.js +29 -23
  98. package/dist/components/field/index.min.js +2 -2
  99. package/dist/components/icon/index.js +5 -1
  100. package/dist/components/icon/index.min.js +2 -2
  101. package/dist/components/image/index.js +463 -444
  102. package/dist/components/image/index.min.js +2 -2
  103. package/dist/components/input/index.js +5 -1
  104. package/dist/components/input/index.min.js +2 -2
  105. package/dist/components/loading/index.js +2 -2
  106. package/dist/components/loading/index.min.js +2 -2
  107. package/dist/components/menu/index.js +5 -1
  108. package/dist/components/menu/index.min.js +2 -2
  109. package/dist/components/message/index.js +43 -3
  110. package/dist/components/message/index.min.js +2 -2
  111. package/dist/components/modal/index.js +7 -2
  112. package/dist/components/modal/index.min.js +2 -2
  113. package/dist/components/navbar/index.js +16 -4
  114. package/dist/components/navbar/index.min.js +2 -2
  115. package/dist/components/notification/index.js +59 -6
  116. package/dist/components/notification/index.min.js +2 -2
  117. package/dist/components/numberinput/index.js +9 -3
  118. package/dist/components/numberinput/index.min.js +2 -2
  119. package/dist/components/pagination/index.js +5 -1
  120. package/dist/components/pagination/index.min.js +2 -2
  121. package/dist/components/progress/index.js +10 -2
  122. package/dist/components/progress/index.min.js +2 -2
  123. package/dist/components/radio/index.js +1 -1
  124. package/dist/components/radio/index.min.js +1 -1
  125. package/dist/components/rate/index.js +5 -1
  126. package/dist/components/rate/index.min.js +2 -2
  127. package/dist/components/select/index.js +5 -1
  128. package/dist/components/select/index.min.js +2 -2
  129. package/dist/components/sidebar/index.js +5 -1
  130. package/dist/components/sidebar/index.min.js +1 -1
  131. package/dist/components/skeleton/index.js +1 -1
  132. package/dist/components/skeleton/index.min.js +1 -1
  133. package/dist/components/slider/index.js +5 -1
  134. package/dist/components/slider/index.min.js +2 -2
  135. package/dist/components/snackbar/index.js +7 -2
  136. package/dist/components/snackbar/index.min.js +2 -2
  137. package/dist/components/steps/index.js +5 -1
  138. package/dist/components/steps/index.min.js +2 -2
  139. package/dist/components/switch/index.js +5 -1
  140. package/dist/components/switch/index.min.js +1 -1
  141. package/dist/components/table/index.js +6 -2
  142. package/dist/components/table/index.min.js +2 -2
  143. package/dist/components/tabs/index.js +5 -1
  144. package/dist/components/tabs/index.min.js +2 -2
  145. package/dist/components/tag/index.js +26 -3
  146. package/dist/components/tag/index.min.js +2 -2
  147. package/dist/components/taginput/index.js +185 -29
  148. package/dist/components/taginput/index.min.js +2 -2
  149. package/dist/components/timepicker/index.js +54 -47
  150. package/dist/components/timepicker/index.min.js +2 -2
  151. package/dist/components/toast/index.js +7 -2
  152. package/dist/components/toast/index.min.js +2 -2
  153. package/dist/components/tooltip/index.js +5 -1
  154. package/dist/components/tooltip/index.min.js +1 -1
  155. package/dist/components/upload/index.js +5 -1
  156. package/dist/components/upload/index.min.js +2 -2
  157. package/dist/esm/autocomplete.js +7 -7
  158. package/dist/esm/breadcrumb.js +122 -0
  159. package/dist/esm/button.js +6 -107
  160. package/dist/esm/carousel.js +7 -5
  161. package/dist/esm/{chunk-56040896.js → chunk-18e8b067.js} +3 -3
  162. package/dist/esm/{chunk-fa404a2c.js → chunk-21fc0948.js} +7 -7
  163. package/dist/esm/{chunk-f9299099.js → chunk-22e9f916.js} +19 -15
  164. package/dist/esm/{chunk-1fafdf15.js → chunk-2452e3d3.js} +37 -1
  165. package/dist/esm/{chunk-1297c2c9.js → chunk-29ca0df8.js} +1 -1
  166. package/dist/esm/{chunk-3c2169d7.js → chunk-2f2f0a74.js} +25 -2
  167. package/dist/esm/{chunk-cf72ce36.js → chunk-3773c62d.js} +2 -2
  168. package/dist/esm/{chunk-2c957994.js → chunk-4b67a181.js} +3 -3
  169. package/dist/esm/{chunk-45740cdc.js → chunk-6019fd7a.js} +96 -15
  170. package/dist/esm/chunk-71a547bc.js +312 -0
  171. package/dist/esm/{chunk-516e4877.js → chunk-75a5af93.js} +1 -1
  172. package/dist/esm/{chunk-4e380ee2.js → chunk-799e084d.js} +2 -1
  173. package/dist/esm/{chunk-37678809.js → chunk-83eb0d37.js} +3 -3
  174. package/dist/esm/{chunk-34c74085.js → chunk-8d0f95b8.js} +4 -4
  175. package/dist/esm/{chunk-652f2dad.js → chunk-8ed29c41.js} +4 -0
  176. package/dist/esm/{chunk-742a9694.js → chunk-9f7f7441.js} +3 -2
  177. package/dist/esm/{chunk-f160efb9.js → chunk-ae8ab23a.js} +4 -4
  178. package/dist/esm/{chunk-c3b09672.js → chunk-b07e3182.js} +26 -24
  179. package/dist/esm/{chunk-e36a4f2c.js → chunk-b0c0c6b0.js} +0 -0
  180. package/dist/esm/{chunk-ee935ae6.js → chunk-c9c58d0c.js} +1 -1
  181. package/dist/esm/{chunk-1d62828e.js → chunk-d7f92d97.js} +39 -3
  182. package/dist/esm/{chunk-7fd02ffe.js → chunk-d92f0cd9.js} +2 -2
  183. package/dist/esm/chunk-e7c9b2cb.js +108 -0
  184. package/dist/esm/{chunk-0e22ae0a.js → chunk-ece062a7.js} +27 -26
  185. package/dist/esm/clockpicker.js +9 -9
  186. package/dist/esm/config.js +2 -2
  187. package/dist/esm/datepicker.js +11 -11
  188. package/dist/esm/datetimepicker.js +21 -14
  189. package/dist/esm/dialog.js +10 -8
  190. package/dist/esm/dropdown.js +5 -5
  191. package/dist/esm/field.js +4 -4
  192. package/dist/esm/helpers.js +2 -3
  193. package/dist/esm/icon.js +4 -4
  194. package/dist/esm/image.js +6 -311
  195. package/dist/esm/index.js +106 -100
  196. package/dist/esm/input.js +6 -6
  197. package/dist/esm/loading.js +4 -4
  198. package/dist/esm/menu.js +3 -3
  199. package/dist/esm/message.js +5 -5
  200. package/dist/esm/modal.js +4 -4
  201. package/dist/esm/navbar.js +16 -4
  202. package/dist/esm/notification.js +22 -10
  203. package/dist/esm/numberinput.js +9 -7
  204. package/dist/esm/pagination.js +5 -5
  205. package/dist/esm/progress.js +8 -4
  206. package/dist/esm/rate.js +3 -3
  207. package/dist/esm/select.js +6 -6
  208. package/dist/esm/sidebar.js +2 -2
  209. package/dist/esm/slider.js +3 -3
  210. package/dist/esm/snackbar.js +4 -4
  211. package/dist/esm/steps.js +6 -6
  212. package/dist/esm/switch.js +1 -1
  213. package/dist/esm/table.js +9 -9
  214. package/dist/esm/tabs.js +6 -6
  215. package/dist/esm/tag.js +2 -2
  216. package/dist/esm/taginput.js +33 -21
  217. package/dist/esm/timepicker.js +12 -12
  218. package/dist/esm/toast.js +4 -4
  219. package/dist/esm/tooltip.js +4 -4
  220. package/dist/esm/upload.js +3 -3
  221. package/dist/vetur/attributes.json +95 -19
  222. package/dist/vetur/tags.json +37 -4
  223. package/package.json +2 -2
  224. package/src/components/autocomplete/Autocomplete.spec.js +70 -0
  225. package/src/components/autocomplete/Autocomplete.vue +93 -18
  226. package/src/components/breadcrumb/Breadcrumb.spec.js +63 -0
  227. package/src/components/breadcrumb/Breadcrumb.vue +43 -0
  228. package/src/components/breadcrumb/BreadcrumbItem.spec.js +25 -0
  229. package/src/components/breadcrumb/BreadcrumbItem.vue +33 -0
  230. package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.js.snap +7 -0
  231. package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +7 -0
  232. package/src/components/breadcrumb/index.js +20 -0
  233. package/src/components/carousel/CarouselList.vue +3 -1
  234. package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +128 -8
  235. package/src/components/clockpicker/Clockpicker.vue +259 -259
  236. package/src/components/datepicker/Datepicker.vue +10 -6
  237. package/src/components/datetimepicker/Datetimepicker.vue +8 -1
  238. package/src/components/dialog/Dialog.vue +10 -10
  239. package/src/components/field/Field.vue +271 -270
  240. package/src/components/image/Image.spec.js +197 -183
  241. package/src/components/image/Image.vue +4 -2
  242. package/src/components/index.js +2 -0
  243. package/src/components/loading/Loading.vue +1 -1
  244. package/src/components/loading/__snapshots__/Loading.spec.js.snap +1 -1
  245. package/src/components/message/Message.vue +7 -1
  246. package/src/components/message/__snapshots__/Message.spec.js.snap +1 -0
  247. package/src/components/modal/Modal.vue +2 -0
  248. package/src/components/navbar/Navbar.vue +5 -1
  249. package/src/components/navbar/NavbarBurger.vue +1 -0
  250. package/src/components/navbar/NavbarDropdown.vue +8 -2
  251. package/src/components/navbar/__snapshots__/NavBar.spec.js.snap +11 -11
  252. package/src/components/navbar/__snapshots__/NavBarBurger.spec.js.snap +3 -0
  253. package/src/components/navbar/__snapshots__/NavbarDropdown.spec.js.snap +1 -1
  254. package/src/components/notification/Notification.vue +6 -0
  255. package/src/components/notification/NotificationNotice.vue +16 -3
  256. package/src/components/notification/__snapshots__/Notification.spec.js.snap +1 -0
  257. package/src/components/numberinput/Numberinput.spec.js +10 -0
  258. package/src/components/numberinput/Numberinput.vue +4 -2
  259. package/src/components/progress/Progress.vue +6 -2
  260. package/src/components/snackbar/Snackbar.vue +2 -0
  261. package/src/components/tag/Tag.vue +25 -2
  262. package/src/components/tag/__snapshots__/Tag.spec.js.snap +1 -1
  263. package/src/components/taginput/Taginput.spec.js +57 -1
  264. package/src/components/taginput/Taginput.vue +373 -364
  265. package/src/components/toast/Toast.vue +1 -1
  266. package/src/index.js +2 -0
  267. package/src/scss/buefy.scss +1 -0
  268. package/src/scss/components/_loading.scss +2 -1
  269. package/src/scss/components/_message.scss +3 -0
  270. package/src/scss/components/_notification.scss +8 -0
  271. package/src/scss/components/_progress.scss +8 -0
  272. package/src/utils/MessageMixin.js +32 -1
  273. package/src/utils/NoticeMixin.js +1 -0
  274. package/src/utils/TimepickerMixin.js +718 -716
  275. package/src/utils/config.js +4 -0
  276. package/src/utils/helpers.js +1 -2
  277. package/types/components.d.ts +5 -0
  278. package/src/components/navbar/__snapshots__/NavbarBurger.spec.js.snap +0 -3
@@ -38,7 +38,14 @@
38
38
  class="dropdown-content"
39
39
  v-show="isActive"
40
40
  :style="contentStyle">
41
- <div v-if="hasHeaderSlot" class="dropdown-item">
41
+ <div
42
+ v-if="hasHeaderSlot"
43
+ class="dropdown-item dropdown-header"
44
+ role="button"
45
+ tabindex="0"
46
+ :class="{ 'is-hovered': headerHovered }"
47
+ @click="selectHeaderOrFoterByClick($event, 'header')"
48
+ >
42
49
  <slot name="header" />
43
50
  </div>
44
51
  <template v-for="(element, groupindex) in computedData">
@@ -62,7 +69,7 @@
62
69
  role="button"
63
70
  tabindex="0"
64
71
  :class="{ 'is-hovered': option === hovered }"
65
- @click="setSelected(option, undefined, $event)"
72
+ @click.stop="setSelected(option, !keepOpen, $event)"
66
73
  >
67
74
  <slot
68
75
  v-if="hasDefaultSlot"
@@ -78,7 +85,14 @@
78
85
  class="dropdown-item is-disabled">
79
86
  <slot name="empty" />
80
87
  </div>
81
- <div v-if="hasFooterSlot" class="dropdown-item">
88
+ <div
89
+ v-if="hasFooterSlot"
90
+ class="dropdown-item dropdown-footer"
91
+ role="button"
92
+ tabindex="0"
93
+ :class="{ 'is-hovered': footerHovered }"
94
+ @click="selectHeaderOrFoterByClick($event, 'footer')"
95
+ >
82
96
  <slot name="footer" />
83
97
  </div>
84
98
  </div>
@@ -140,12 +154,16 @@ export default {
140
154
  confirmKeys: {
141
155
  type: Array,
142
156
  default: () => ['Tab', 'Enter']
143
- }
157
+ },
158
+ selectableHeader: Boolean,
159
+ selectableFooter: Boolean
144
160
  },
145
161
  data() {
146
162
  return {
147
163
  selected: null,
148
164
  hovered: null,
165
+ headerHovered: null,
166
+ footerHovered: null,
149
167
  isActive: false,
150
168
  newValue: this.value,
151
169
  newAutocomplete: this.autocomplete || 'off',
@@ -310,9 +328,7 @@ export default {
310
328
  this.$emit('input', value)
311
329
  // Check if selected is invalid
312
330
  const currentValue = this.getValue(this.selected)
313
- // empty or different value
314
- if ((typeof currentValue === 'undefined' || currentValue === null) ||
315
- (currentValue && currentValue !== value)) {
331
+ if (currentValue && currentValue !== value) {
316
332
  this.setSelected(null, false)
317
333
  }
318
334
  // Close dropdown if input is clear or else open it
@@ -362,11 +378,16 @@ export default {
362
378
  */
363
379
  setSelected(option, closeDropdown = true, event = undefined) {
364
380
  if (option === undefined) return
365
-
366
381
  this.selected = option
367
382
  this.$emit('select', this.selected, event)
368
383
  if (this.selected !== null) {
369
- this.newValue = this.clearOnSelect ? '' : this.getValue(this.selected)
384
+ if (this.clearOnSelect) {
385
+ const input = this.$refs.input
386
+ input.newValue = ''
387
+ input.$refs.input.value = ''
388
+ } else {
389
+ this.newValue = this.getValue(this.selected)
390
+ }
370
391
  this.setHovered(null)
371
392
  }
372
393
  closeDropdown && this.$nextTick(() => {
@@ -394,26 +415,50 @@ export default {
394
415
 
395
416
  keydown(event) {
396
417
  const { key } = event // cannot destructure preventDefault (https://stackoverflow.com/a/49616808/2774496)
397
-
398
418
  // prevent emit submit event
399
419
  if (key === 'Enter') event.preventDefault()
400
-
401
420
  // Close dropdown on Tab & no hovered
402
421
  if (key === 'Escape' || key === 'Tab') {
403
- event.preventDefault()
404
422
  this.isActive = false
405
423
  }
406
- if (this.hovered === null) return
424
+
407
425
  if (this.confirmKeys.indexOf(key) >= 0) {
408
426
  // If adding by comma, don't add the comma to the input
409
427
  if (key === ',') event.preventDefault()
410
-
411
428
  // Close dropdown on select by Tab
412
429
  const closeDropdown = !this.keepOpen || key === 'Tab'
430
+ if (this.hovered === null) {
431
+ // header and footer uses headerHovered && footerHovered. If header or footer
432
+ // was selected then fire event otherwise just return so a value isn't selected
433
+ this.checkIfHeaderOrFooterSelected(event, null, closeDropdown)
434
+ return
435
+ }
413
436
  this.setSelected(this.hovered, closeDropdown, event)
414
437
  }
415
438
  },
416
439
 
440
+ selectHeaderOrFoterByClick(event, origin) {
441
+ this.checkIfHeaderOrFooterSelected(event, {origin: origin})
442
+ },
443
+
444
+ /**
445
+ * Check if header or footer was selected.
446
+ */
447
+ checkIfHeaderOrFooterSelected(event, triggerClick, closeDropdown = true) {
448
+ if (this.selectableHeader && (this.headerHovered || (triggerClick && triggerClick.origin === 'header'))) {
449
+ this.$emit('select-header', event)
450
+ this.headerHovered = false
451
+ if (triggerClick) this.setHovered(null)
452
+ if (closeDropdown) this.isActive = false
453
+ }
454
+ if (this.selectableFooter && (this.footerHovered || (triggerClick && triggerClick.origin === 'footer'))) {
455
+ this.$emit('select-footer', event)
456
+ this.footerHovered = false
457
+ if (triggerClick) this.setHovered(null)
458
+ if (closeDropdown) this.isActive = false
459
+ }
460
+ },
461
+
417
462
  /**
418
463
  * Close dropdown if clicked outside.
419
464
  */
@@ -484,14 +529,44 @@ export default {
484
529
  if (this.isActive) {
485
530
  const data = this.computedData.map(
486
531
  (d) => d.items).reduce((a, b) => ([...a, ...b]), [])
487
- let index = data.indexOf(this.hovered) + sum
532
+ if (this.hasHeaderSlot && this.selectableHeader) {
533
+ data.unshift(undefined)
534
+ }
535
+ if (this.hasFooterSlot && this.selectableFooter) {
536
+ data.push(undefined)
537
+ }
538
+
539
+ let index
540
+ if (this.headerHovered) {
541
+ index = 0 + sum
542
+ } else if (this.footerHovered) {
543
+ index = (data.length - 1) + sum
544
+ } else {
545
+ index = data.indexOf(this.hovered) + sum
546
+ }
547
+
488
548
  index = index > data.length - 1 ? data.length - 1 : index
489
549
  index = index < 0 ? 0 : index
490
550
 
491
- this.setHovered(data[index])
551
+ this.footerHovered = false
552
+ this.headerHovered = false
553
+ this.setHovered(data[index] !== undefined ? data[index] : null)
554
+ if (this.hasFooterSlot && this.selectableFooter && index === data.length - 1) {
555
+ this.footerHovered = true
556
+ }
557
+ if (this.hasHeaderSlot && this.selectableHeader && index === 0) {
558
+ this.headerHovered = true
559
+ }
492
560
 
493
561
  const list = this.$refs.dropdown.querySelector('.dropdown-content')
494
- const element = list.querySelectorAll('a.dropdown-item:not(.is-disabled)')[index]
562
+ let querySelectorText = 'a.dropdown-item:not(.is-disabled)'
563
+ if (this.hasHeaderSlot && this.selectableHeader) {
564
+ querySelectorText += ',div.dropdown-header'
565
+ }
566
+ if (this.hasFooterSlot && this.selectableFooter) {
567
+ querySelectorText += ',div.dropdown-footer'
568
+ }
569
+ const element = list.querySelectorAll(querySelectorText)[index]
495
570
 
496
571
  if (!element) return
497
572
 
@@ -534,7 +609,7 @@ export default {
534
609
  this.hasFocus = false
535
610
  this.$emit('blur', event)
536
611
  },
537
- onInput(event) {
612
+ onInput() {
538
613
  const currentValue = this.getValue(this.selected)
539
614
  if (currentValue && currentValue === this.newValue) return
540
615
  this.$emit('typing', this.newValue)
@@ -0,0 +1,63 @@
1
+ import { shallowMount, mount } from '@vue/test-utils'
2
+ import BBreadcrumb from '@components/breadcrumb/Breadcrumb'
3
+
4
+ describe('BBreadcrumb', () => {
5
+ let wrapper
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(BBreadcrumb)
9
+ })
10
+
11
+ it('is called', () => {
12
+ expect(wrapper.name()).toBe('BBreadcrumb')
13
+ expect(wrapper.isVueInstance()).toBeTruthy()
14
+ })
15
+
16
+ it('render correctly', () => {
17
+ expect(wrapper.html()).toMatchSnapshot()
18
+ })
19
+
20
+ it('should set align to right', () => {
21
+ wrapper = mount(BBreadcrumb, {
22
+ propsData: {
23
+ align: 'is-right'
24
+ }
25
+ })
26
+
27
+ expect(wrapper.classes()).toContain('is-right')
28
+ })
29
+
30
+ it('should set separator to arrow', () => {
31
+ wrapper = mount(BBreadcrumb, {
32
+ propsData: {
33
+ separator: 'has-arrow-separator'
34
+ }
35
+ })
36
+
37
+ expect(wrapper.classes()).toContain('has-arrow-separator')
38
+ })
39
+
40
+ it('should set size to large', () => {
41
+ wrapper = mount(BBreadcrumb, {
42
+ propsData: {
43
+ size: 'is-large'
44
+ }
45
+ })
46
+
47
+ expect(wrapper.classes()).toContain('is-large')
48
+ })
49
+
50
+ it('computes breadcrumbClasses correctly', () => {
51
+ wrapper = mount(BBreadcrumb, {
52
+ propsData: {
53
+ align: 'is-left',
54
+ separator: 'has-dot-separator',
55
+ size: 'is-medium'
56
+ }
57
+ })
58
+
59
+ expect(wrapper.classes()).toContain('is-left')
60
+ expect(wrapper.classes()).toContain('has-dot-separator')
61
+ expect(wrapper.classes()).toContain('is-medium')
62
+ })
63
+ })
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <nav :class="breadcrumbClasses">
3
+ <ul>
4
+ <slot />
5
+ </ul>
6
+ </nav>
7
+ </template>
8
+
9
+ <script>
10
+ import config from '../../utils/config'
11
+
12
+ export default {
13
+
14
+ name: 'BBreadcrumb',
15
+
16
+ props: {
17
+ align: {
18
+ type: String,
19
+ default: () => {
20
+ return config.defaultBreadcrumbAlign
21
+ }
22
+ },
23
+ separator: {
24
+ type: String,
25
+ default: () => {
26
+ return config.defaultBreadcrumbSeparator
27
+ }
28
+ },
29
+ size: {
30
+ type: String,
31
+ default: () => {
32
+ return config.defaultBreadcrumbSize
33
+ }
34
+ }
35
+ },
36
+
37
+ computed: {
38
+ breadcrumbClasses() {
39
+ return ['breadcrumb', this.align, this.separator, this.size]
40
+ }
41
+ }
42
+ }
43
+ </script>
@@ -0,0 +1,25 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import BBreadcrumbItem from '@components/breadcrumb/BreadcrumbItem.vue'
3
+
4
+ describe('BBreadcrumbItem', () => {
5
+ let wrapper
6
+ beforeEach(() => {
7
+ wrapper = mount(BBreadcrumbItem, {
8
+ propsData: {
9
+ tag: 'a'
10
+ }
11
+ })
12
+ })
13
+
14
+ it('is called', () => {
15
+ expect(wrapper.isVueInstance()).toBeTruthy()
16
+ })
17
+
18
+ it('render correctly', () => {
19
+ expect(wrapper.html()).toMatchSnapshot()
20
+ })
21
+
22
+ it('should have a li tag', () => {
23
+ expect(wrapper.contains('li')).toBeTruthy()
24
+ })
25
+ })
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <li
3
+ :class="{ 'is-active': active }">
4
+ <component
5
+ :is="tag"
6
+ v-bind="$attrs"
7
+ v-on="$listeners"
8
+ >
9
+ <slot />
10
+ </component>
11
+ </li>
12
+ </template>
13
+
14
+ <script>
15
+ import config from '../../utils/config'
16
+
17
+ export default {
18
+
19
+ name: 'BBreadcrumbItem',
20
+
21
+ inheritAttrs: false,
22
+
23
+ props: {
24
+ tag: {
25
+ type: String,
26
+ default: () => {
27
+ return config.defaultBreadcrumbTag
28
+ }
29
+ },
30
+ active: Boolean
31
+ }
32
+ }
33
+ </script>
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BBreadcrumb render correctly 1`] = `
4
+ <nav class="breadcrumb is-left is-medium">
5
+ <ul></ul>
6
+ </nav>
7
+ `;
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BBreadcrumbItem render correctly 1`] = `
4
+ <li class="">
5
+ <router-link to="/"></router-link>
6
+ </li>
7
+ `;
@@ -0,0 +1,20 @@
1
+ import Breadcrumb from './Breadcrumb'
2
+ import BreadcrumbItem from './BreadcrumbItem'
3
+
4
+ import { use, registerComponent } from '../../utils/plugins'
5
+
6
+ const Plugin = {
7
+ install(Vue) {
8
+ registerComponent(Vue, Breadcrumb)
9
+ registerComponent(Vue, BreadcrumbItem)
10
+ }
11
+ }
12
+
13
+ use(Plugin)
14
+
15
+ export default Plugin
16
+
17
+ export {
18
+ Breadcrumb as BBreadcrumb,
19
+ BreadcrumbItem as BBreadcrumbItem
20
+ }
@@ -59,11 +59,13 @@ import {sign, mod, bound} from '../../utils/helpers'
59
59
  import config from '../../utils/config'
60
60
 
61
61
  import Icon from '../icon/Icon'
62
+ import Image from '../image/Image'
62
63
 
63
64
  export default {
64
65
  name: 'BCarouselList',
65
66
  components: {
66
- [Icon.name]: Icon
67
+ [Icon.name]: Icon,
68
+ [Image.name]: Image
67
69
  },
68
70
  props: {
69
71
  data: {
@@ -4,28 +4,148 @@ exports[`BCarouselList render correctly 1`] = `
4
4
  <div class="carousel-list">
5
5
  <div class="carousel-slides" style="transform: translateX(0px);">
6
6
  <div class="carousel-slide is-active" style="width: 0px;">
7
- <b-image src="https://picsum.photos/id/0/1230/500" title="Slide 1" image="https://picsum.photos/id/0/1230/500"></b-image>
7
+ <b-image-stub src="https://picsum.photos/id/0/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
8
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
9
+ cov_13zmb589fa.s[13]++;
10
+
11
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
12
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
13
+ cov_13zmb589fa.s[14]++;
14
+
15
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
16
+ } else {
17
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
18
+ cov_13zmb589fa.s[15]++;
19
+
20
+ return vm.formatSrcset(src, size);
21
+ }
22
+ }" title="Slide 1" image="https://picsum.photos/id/0/1230/500"></b-image-stub>
8
23
  </div>
9
24
  <div class="carousel-slide" style="width: 0px;">
10
- <b-image src="https://picsum.photos/id/1/1230/500" title="Slide 2" image="https://picsum.photos/id/1/1230/500"></b-image>
25
+ <b-image-stub src="https://picsum.photos/id/1/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
26
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
27
+ cov_13zmb589fa.s[13]++;
28
+
29
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
30
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
31
+ cov_13zmb589fa.s[14]++;
32
+
33
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
34
+ } else {
35
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
36
+ cov_13zmb589fa.s[15]++;
37
+
38
+ return vm.formatSrcset(src, size);
39
+ }
40
+ }" title="Slide 2" image="https://picsum.photos/id/1/1230/500"></b-image-stub>
11
41
  </div>
12
42
  <div class="carousel-slide" style="width: 0px;">
13
- <b-image src="https://picsum.photos/id/2/1230/500" title="Slide 3" image="https://picsum.photos/id/2/1230/500"></b-image>
43
+ <b-image-stub src="https://picsum.photos/id/2/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
44
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
45
+ cov_13zmb589fa.s[13]++;
46
+
47
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
48
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
49
+ cov_13zmb589fa.s[14]++;
50
+
51
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
52
+ } else {
53
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
54
+ cov_13zmb589fa.s[15]++;
55
+
56
+ return vm.formatSrcset(src, size);
57
+ }
58
+ }" title="Slide 3" image="https://picsum.photos/id/2/1230/500"></b-image-stub>
14
59
  </div>
15
60
  <div class="carousel-slide" style="width: 0px;">
16
- <b-image src="https://picsum.photos/id/3/1230/500" title="Slide 4" image="https://picsum.photos/id/3/1230/500"></b-image>
61
+ <b-image-stub src="https://picsum.photos/id/3/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
62
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
63
+ cov_13zmb589fa.s[13]++;
64
+
65
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
66
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
67
+ cov_13zmb589fa.s[14]++;
68
+
69
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
70
+ } else {
71
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
72
+ cov_13zmb589fa.s[15]++;
73
+
74
+ return vm.formatSrcset(src, size);
75
+ }
76
+ }" title="Slide 4" image="https://picsum.photos/id/3/1230/500"></b-image-stub>
17
77
  </div>
18
78
  <div class="carousel-slide" style="width: 0px;">
19
- <b-image src="https://picsum.photos/id/4/1230/500" title="Slide 5" image="https://picsum.photos/id/4/1230/500"></b-image>
79
+ <b-image-stub src="https://picsum.photos/id/4/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
80
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
81
+ cov_13zmb589fa.s[13]++;
82
+
83
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
84
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
85
+ cov_13zmb589fa.s[14]++;
86
+
87
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
88
+ } else {
89
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
90
+ cov_13zmb589fa.s[15]++;
91
+
92
+ return vm.formatSrcset(src, size);
93
+ }
94
+ }" title="Slide 5" image="https://picsum.photos/id/4/1230/500"></b-image-stub>
20
95
  </div>
21
96
  <div class="carousel-slide" style="width: 0px;">
22
- <b-image src="https://picsum.photos/id/5/1230/500" title="Slide 6" image="https://picsum.photos/id/5/1230/500"></b-image>
97
+ <b-image-stub src="https://picsum.photos/id/5/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
98
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
99
+ cov_13zmb589fa.s[13]++;
100
+
101
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
102
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
103
+ cov_13zmb589fa.s[14]++;
104
+
105
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
106
+ } else {
107
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
108
+ cov_13zmb589fa.s[15]++;
109
+
110
+ return vm.formatSrcset(src, size);
111
+ }
112
+ }" title="Slide 6" image="https://picsum.photos/id/5/1230/500"></b-image-stub>
23
113
  </div>
24
114
  <div class="carousel-slide" style="width: 0px;">
25
- <b-image src="https://picsum.photos/id/6/1230/500" title="Slide 7" image="https://picsum.photos/id/6/1230/500"></b-image>
115
+ <b-image-stub src="https://picsum.photos/id/6/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
116
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
117
+ cov_13zmb589fa.s[13]++;
118
+
119
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
120
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
121
+ cov_13zmb589fa.s[14]++;
122
+
123
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
124
+ } else {
125
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
126
+ cov_13zmb589fa.s[15]++;
127
+
128
+ return vm.formatSrcset(src, size);
129
+ }
130
+ }" title="Slide 7" image="https://picsum.photos/id/6/1230/500"></b-image-stub>
26
131
  </div>
27
132
  <div class="carousel-slide" style="width: 0px;">
28
- <b-image src="https://picsum.photos/id/7/1230/500" title="Slide 8" image="https://picsum.photos/id/7/1230/500"></b-image>
133
+ <b-image-stub src="https://picsum.photos/id/7/1230/500" lazy="true" responsive="true" srcsetformatter="function _default(src, size, vm) {
134
+ /* istanbul ignore next */cov_13zmb589fa.f[6]++;
135
+ cov_13zmb589fa.s[13]++;
136
+
137
+ if (typeof _config2.default.defaultImageSrcsetFormatter === 'function') {
138
+ /* istanbul ignore next */cov_13zmb589fa.b[2][0]++;
139
+ cov_13zmb589fa.s[14]++;
140
+
141
+ return _config2.default.defaultImageSrcsetFormatter(src, size);
142
+ } else {
143
+ /* istanbul ignore next */cov_13zmb589fa.b[2][1]++;
144
+ cov_13zmb589fa.s[15]++;
145
+
146
+ return vm.formatSrcset(src, size);
147
+ }
148
+ }" title="Slide 8" image="https://picsum.photos/id/7/1230/500"></b-image-stub>
29
149
  </div>
30
150
  </div>
31
151
  <div class="carousel-arrow is-hovered">