buefy 0.7.9 → 0.8.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.
Files changed (347) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/buefy.css +13759 -8263
  3. package/dist/buefy.js +9073 -14866
  4. package/dist/buefy.min.css +1 -5
  5. package/dist/buefy.min.js +2 -2
  6. package/dist/cjs/autocomplete.js +22 -0
  7. package/dist/cjs/button.js +106 -0
  8. package/dist/cjs/checkbox.js +135 -0
  9. package/dist/cjs/chunk-07fe6fc0.js +247 -0
  10. package/dist/cjs/chunk-0af453a7.js +105 -0
  11. package/dist/cjs/chunk-0e89e51b.js +394 -0
  12. package/dist/cjs/chunk-13e039f5.js +104 -0
  13. package/dist/cjs/chunk-143d9e6d.js +404 -0
  14. package/dist/cjs/chunk-19ebd649.js +114 -0
  15. package/dist/cjs/chunk-1b1231ce.js +94 -0
  16. package/dist/cjs/chunk-1e6abfcf.js +94 -0
  17. package/dist/cjs/chunk-28d164b1.js +172 -0
  18. package/dist/cjs/chunk-3396605d.js +394 -0
  19. package/dist/cjs/chunk-364a37a0.js +404 -0
  20. package/dist/cjs/chunk-3b066933.js +103 -0
  21. package/dist/cjs/chunk-3dffe6e7.js +54 -0
  22. package/dist/cjs/chunk-4a03b064.js +199 -0
  23. package/dist/cjs/chunk-50b06939.js +153 -0
  24. package/dist/cjs/chunk-52623128.js +105 -0
  25. package/dist/cjs/chunk-53d4f332.js +94 -0
  26. package/dist/cjs/chunk-544a95da.js +404 -0
  27. package/dist/cjs/chunk-545f01b1.js +49 -0
  28. package/dist/cjs/chunk-59b91990.js +64 -0
  29. package/dist/cjs/chunk-5b2a3329.js +394 -0
  30. package/dist/cjs/chunk-60061aa8.js +172 -0
  31. package/dist/cjs/chunk-67658e54.js +404 -0
  32. package/dist/cjs/chunk-6963026a.js +86 -0
  33. package/dist/cjs/chunk-6cece6b7.js +140 -0
  34. package/dist/cjs/chunk-6d6465c1.js +140 -0
  35. package/dist/cjs/chunk-6e9c0aca.js +94 -0
  36. package/dist/cjs/chunk-77f69fca.js +106 -0
  37. package/dist/cjs/chunk-7a25d736.js +114 -0
  38. package/dist/cjs/chunk-876befa8.js +247 -0
  39. package/dist/cjs/chunk-8985ffff.js +105 -0
  40. package/dist/cjs/chunk-8a05c8c9.js +207 -0
  41. package/dist/cjs/chunk-90407463.js +258 -0
  42. package/dist/cjs/chunk-956525c9.js +106 -0
  43. package/dist/cjs/chunk-96ce35a2.js +114 -0
  44. package/dist/cjs/chunk-9da1d120.js +86 -0
  45. package/dist/cjs/chunk-9f6a8079.js +54 -0
  46. package/dist/cjs/chunk-a60dc21d.js +281 -0
  47. package/dist/cjs/chunk-b628277d.js +199 -0
  48. package/dist/cjs/chunk-c146745e.js +153 -0
  49. package/dist/cjs/chunk-c2aec7a9.js +547 -0
  50. package/dist/cjs/chunk-c9641331.js +86 -0
  51. package/dist/cjs/chunk-d492406b.js +172 -0
  52. package/dist/cjs/chunk-e0aa62a0.js +404 -0
  53. package/dist/cjs/chunk-e45e0329.js +48 -0
  54. package/dist/cjs/chunk-e5de6583.js +207 -0
  55. package/dist/cjs/chunk-e85cceb6.js +258 -0
  56. package/dist/cjs/chunk-ed5addd6.js +547 -0
  57. package/dist/cjs/chunk-ef4753d5.js +283 -0
  58. package/dist/cjs/chunk-f0c597f9.js +199 -0
  59. package/dist/cjs/chunk-f1df1c63.js +9 -0
  60. package/dist/cjs/chunk-f1ee2f5c.js +207 -0
  61. package/dist/cjs/chunk-fbd4d545.js +247 -0
  62. package/dist/cjs/clockpicker.js +447 -0
  63. package/dist/cjs/collapse.js +102 -0
  64. package/dist/cjs/datepicker.js +1281 -0
  65. package/dist/cjs/dialog.js +237 -0
  66. package/dist/cjs/dropdown.js +19 -0
  67. package/dist/cjs/field.js +18 -0
  68. package/dist/cjs/icon.js +17 -0
  69. package/dist/cjs/index.js +164 -0
  70. package/dist/cjs/input.js +20 -0
  71. package/dist/cjs/loading.js +166 -0
  72. package/dist/cjs/menu.js +231 -0
  73. package/dist/cjs/message.js +65 -0
  74. package/dist/cjs/modal.js +48 -0
  75. package/dist/cjs/navbar.js +258 -0
  76. package/dist/cjs/notification.js +142 -0
  77. package/dist/cjs/numberinput.js +191 -0
  78. package/dist/cjs/pagination.js +19 -0
  79. package/dist/cjs/progress.js +151 -0
  80. package/dist/cjs/radio.js +224 -0
  81. package/dist/cjs/select.js +20 -0
  82. package/dist/cjs/slider.js +511 -0
  83. package/dist/cjs/snackbar.js +114 -0
  84. package/dist/cjs/steps.js +352 -0
  85. package/dist/cjs/switch.js +144 -0
  86. package/dist/cjs/table.js +877 -0
  87. package/dist/cjs/tabs.js +258 -0
  88. package/dist/cjs/tag.js +63 -0
  89. package/dist/cjs/taginput.js +297 -0
  90. package/dist/cjs/timepicker.js +75 -0
  91. package/dist/cjs/toast.js +89 -0
  92. package/dist/cjs/tooltip.js +17 -0
  93. package/dist/cjs/upload.js +210 -0
  94. package/dist/components/autocomplete/index.js +1084 -2
  95. package/dist/components/autocomplete/index.min.js +2 -0
  96. package/dist/components/button/index.js +425 -2
  97. package/dist/components/button/index.min.js +2 -0
  98. package/dist/components/checkbox/index.js +342 -2
  99. package/dist/components/checkbox/index.min.js +2 -0
  100. package/dist/components/clockpicker/index.js +2340 -2
  101. package/dist/components/clockpicker/index.min.js +2 -0
  102. package/dist/components/collapse/index.js +201 -2
  103. package/dist/components/collapse/index.min.js +2 -0
  104. package/dist/components/datepicker/index.js +2720 -2
  105. package/dist/components/datepicker/index.min.js +2 -0
  106. package/dist/components/dialog/index.js +768 -2
  107. package/dist/components/dialog/index.min.js +2 -0
  108. package/dist/components/dropdown/index.js +555 -2
  109. package/dist/components/dropdown/index.min.js +2 -0
  110. package/dist/components/field/index.js +447 -2
  111. package/dist/components/field/index.min.js +2 -0
  112. package/dist/components/icon/index.js +322 -2
  113. package/dist/components/icon/index.min.js +2 -0
  114. package/dist/components/input/index.js +675 -2
  115. package/dist/components/input/index.min.js +2 -0
  116. package/dist/components/loading/index.js +282 -2
  117. package/dist/components/loading/index.min.js +2 -0
  118. package/dist/components/menu/index.js +550 -2
  119. package/dist/components/menu/index.min.js +2 -0
  120. package/dist/components/message/index.js +482 -2
  121. package/dist/components/message/index.min.js +2 -0
  122. package/dist/components/modal/index.js +400 -2
  123. package/dist/components/modal/index.min.js +2 -0
  124. package/dist/components/navbar/index.js +371 -0
  125. package/dist/components/navbar/index.min.js +2 -0
  126. package/dist/components/notification/index.js +705 -2
  127. package/dist/components/notification/index.min.js +2 -0
  128. package/dist/components/numberinput/index.js +846 -2
  129. package/dist/components/numberinput/index.min.js +2 -0
  130. package/dist/components/pagination/index.js +577 -2
  131. package/dist/components/pagination/index.min.js +2 -0
  132. package/dist/components/progress/index.js +250 -0
  133. package/dist/components/progress/index.min.js +2 -0
  134. package/dist/components/radio/index.js +323 -2
  135. package/dist/components/radio/index.min.js +2 -0
  136. package/dist/components/select/index.js +571 -2
  137. package/dist/components/select/index.min.js +2 -0
  138. package/dist/components/slider/index.js +764 -0
  139. package/dist/components/slider/index.min.js +2 -0
  140. package/dist/components/snackbar/index.js +397 -2
  141. package/dist/components/snackbar/index.min.js +2 -0
  142. package/dist/components/steps/index.js +721 -2
  143. package/dist/components/steps/index.min.js +2 -0
  144. package/dist/components/switch/index.js +243 -2
  145. package/dist/components/switch/index.min.js +2 -0
  146. package/dist/components/table/index.js +1870 -2
  147. package/dist/components/table/index.min.js +2 -0
  148. package/dist/components/tabs/index.js +627 -2
  149. package/dist/components/tabs/index.min.js +2 -0
  150. package/dist/components/tag/index.js +262 -2
  151. package/dist/components/tag/index.min.js +2 -0
  152. package/dist/components/taginput/index.js +1459 -2
  153. package/dist/components/taginput/index.min.js +2 -0
  154. package/dist/components/timepicker/index.js +2053 -2
  155. package/dist/components/timepicker/index.min.js +2 -0
  156. package/dist/components/toast/index.js +372 -2
  157. package/dist/components/toast/index.min.js +2 -0
  158. package/dist/components/tooltip/index.js +236 -2
  159. package/dist/components/tooltip/index.min.js +2 -0
  160. package/dist/components/upload/index.js +501 -2
  161. package/dist/components/upload/index.min.js +2 -0
  162. package/dist/esm/autocomplete.js +18 -0
  163. package/dist/esm/button.js +102 -0
  164. package/dist/esm/checkbox.js +131 -0
  165. package/dist/esm/chunk-00e3e67f.js +401 -0
  166. package/dist/esm/chunk-051f8b06.js +105 -0
  167. package/dist/esm/chunk-0566c90d.js +152 -0
  168. package/dist/esm/chunk-07e19446.js +545 -0
  169. package/dist/esm/chunk-085a700d.js +7 -0
  170. package/dist/esm/chunk-0ad6938a.js +53 -0
  171. package/dist/esm/chunk-0e3f4fb5.js +52 -0
  172. package/dist/esm/chunk-10c85529.js +151 -0
  173. package/dist/esm/chunk-121b1efa.js +197 -0
  174. package/dist/esm/chunk-19dad95e.js +256 -0
  175. package/dist/esm/chunk-231b6066.js +113 -0
  176. package/dist/esm/chunk-24d1a01f.js +279 -0
  177. package/dist/esm/chunk-297bff6b.js +393 -0
  178. package/dist/esm/chunk-2b2ae5c6.js +245 -0
  179. package/dist/esm/chunk-2cb6f867.js +46 -0
  180. package/dist/esm/chunk-33717194.js +392 -0
  181. package/dist/esm/chunk-3b811b77.js +139 -0
  182. package/dist/esm/chunk-3e47308f.js +104 -0
  183. package/dist/esm/chunk-411d6eea.js +84 -0
  184. package/dist/esm/chunk-4535dec5.js +92 -0
  185. package/dist/esm/chunk-47a5f3a1.js +103 -0
  186. package/dist/esm/chunk-4a5384da.js +205 -0
  187. package/dist/esm/chunk-4b663574.js +112 -0
  188. package/dist/esm/chunk-4d393f09.js +170 -0
  189. package/dist/esm/chunk-4d695899.js +257 -0
  190. package/dist/esm/chunk-4f508891.js +171 -0
  191. package/dist/esm/chunk-531b8274.js +281 -0
  192. package/dist/esm/chunk-591ee4a2.js +151 -0
  193. package/dist/esm/chunk-5d3bf82e.js +170 -0
  194. package/dist/esm/chunk-5e0b0665.js +104 -0
  195. package/dist/esm/chunk-648b9aa4.js +45 -0
  196. package/dist/esm/chunk-666940cf.js +546 -0
  197. package/dist/esm/chunk-67c97e13.js +246 -0
  198. package/dist/esm/chunk-6844653e.js +401 -0
  199. package/dist/esm/chunk-699b7cb4.js +245 -0
  200. package/dist/esm/chunk-6f881e7d.js +51 -0
  201. package/dist/esm/chunk-7123d158.js +256 -0
  202. package/dist/esm/chunk-7cf87590.js +60 -0
  203. package/dist/esm/chunk-823177ac.js +545 -0
  204. package/dist/esm/chunk-8838757a.js +401 -0
  205. package/dist/esm/chunk-8ca878c0.js +198 -0
  206. package/dist/esm/chunk-8fc2e874.js +85 -0
  207. package/dist/esm/chunk-912ed715.js +92 -0
  208. package/dist/esm/chunk-92acc21f.js +392 -0
  209. package/dist/esm/chunk-98e86f40.js +197 -0
  210. package/dist/esm/chunk-99a1f9df.js +92 -0
  211. package/dist/esm/chunk-9a776697.js +112 -0
  212. package/dist/esm/chunk-9e3207cc.js +46 -0
  213. package/dist/esm/chunk-9ec14e09.js +112 -0
  214. package/dist/esm/chunk-a5ea70d0.js +205 -0
  215. package/dist/esm/chunk-ac3f4847.js +138 -0
  216. package/dist/esm/chunk-b5376f3e.js +92 -0
  217. package/dist/esm/chunk-b56eb2c8.js +197 -0
  218. package/dist/esm/chunk-b796d1b2.js +392 -0
  219. package/dist/esm/chunk-b822a5db.js +205 -0
  220. package/dist/esm/chunk-b9bdb0e4.js +6 -0
  221. package/dist/esm/chunk-bfe15983.js +401 -0
  222. package/dist/esm/chunk-c9039f68.js +104 -0
  223. package/dist/esm/chunk-cc718c15.js +245 -0
  224. package/dist/esm/chunk-cca88db8.js +99 -0
  225. package/dist/esm/chunk-d6200087.js +50 -0
  226. package/dist/esm/chunk-daeac852.js +138 -0
  227. package/dist/esm/chunk-db31c548.js +103 -0
  228. package/dist/esm/chunk-e5568f45.js +84 -0
  229. package/dist/esm/chunk-e5fce48f.js +59 -0
  230. package/dist/esm/chunk-e84b4047.js +170 -0
  231. package/dist/esm/chunk-e8d90b72.js +98 -0
  232. package/dist/esm/chunk-e932bb68.js +206 -0
  233. package/dist/esm/chunk-edd8ff91.js +103 -0
  234. package/dist/esm/chunk-f0465d8d.js +84 -0
  235. package/dist/esm/chunk-f743d154.js +93 -0
  236. package/dist/esm/chunk-f8036b32.js +402 -0
  237. package/dist/esm/chunk-f984748f.js +401 -0
  238. package/dist/esm/chunk-fd5b0e1e.js +99 -0
  239. package/dist/esm/clockpicker.js +443 -0
  240. package/dist/esm/collapse.js +98 -0
  241. package/dist/esm/datepicker.js +1277 -0
  242. package/dist/esm/dialog.js +231 -0
  243. package/dist/esm/dropdown.js +14 -0
  244. package/dist/esm/field.js +14 -0
  245. package/dist/esm/icon.js +13 -0
  246. package/dist/esm/index.js +154 -0
  247. package/dist/esm/input.js +16 -0
  248. package/dist/esm/loading.js +159 -0
  249. package/dist/esm/menu.js +225 -0
  250. package/dist/esm/message.js +61 -0
  251. package/dist/esm/modal.js +42 -0
  252. package/dist/esm/navbar.js +253 -0
  253. package/dist/esm/notification.js +135 -0
  254. package/dist/esm/numberinput.js +187 -0
  255. package/dist/esm/pagination.js +15 -0
  256. package/dist/esm/progress.js +147 -0
  257. package/dist/esm/radio.js +219 -0
  258. package/dist/esm/select.js +16 -0
  259. package/dist/esm/slider.js +506 -0
  260. package/dist/esm/snackbar.js +108 -0
  261. package/dist/esm/steps.js +347 -0
  262. package/dist/esm/switch.js +140 -0
  263. package/dist/esm/table.js +872 -0
  264. package/dist/esm/tabs.js +253 -0
  265. package/dist/esm/tag.js +59 -0
  266. package/dist/esm/taginput.js +293 -0
  267. package/dist/esm/timepicker.js +71 -0
  268. package/dist/esm/toast.js +83 -0
  269. package/dist/esm/tooltip.js +13 -0
  270. package/dist/esm/upload.js +206 -0
  271. package/package.json +26 -4
  272. package/src/components/checkbox/Checkbox.vue +12 -4
  273. package/src/components/checkbox/CheckboxButton.vue +10 -2
  274. package/src/components/clockpicker/Clockpicker.vue +0 -5
  275. package/src/components/datepicker/Datepicker.spec.js +60 -0
  276. package/src/components/datepicker/Datepicker.vue +46 -19
  277. package/src/components/datepicker/DatepickerTable.spec.js +107 -2
  278. package/src/components/datepicker/DatepickerTable.vue +73 -4
  279. package/src/components/datepicker/DatepickerTableRow.spec.js +127 -17
  280. package/src/components/datepicker/DatepickerTableRow.vue +103 -4
  281. package/src/components/dialog/Dialog.vue +5 -3
  282. package/src/components/dialog/index.js +2 -2
  283. package/src/components/dropdown/Dropdown.vue +1 -4
  284. package/src/components/dropdown/DropdownItem.vue +7 -3
  285. package/src/components/field/Field.spec.js +18 -0
  286. package/src/components/field/Field.vue +21 -2
  287. package/src/components/index.js +6 -0
  288. package/src/components/input/Input.vue +2 -2
  289. package/src/components/loading/index.js +1 -1
  290. package/src/components/modal/index.js +1 -1
  291. package/src/components/navbar/NavBar.spec.js +76 -0
  292. package/src/components/navbar/Navbar.vue +127 -0
  293. package/src/components/navbar/NavbarBurger.vue +25 -0
  294. package/src/components/navbar/NavbarItem.vue +21 -0
  295. package/src/components/navbar/index.js +20 -0
  296. package/src/components/notification/index.js +1 -1
  297. package/src/components/pagination/Pagination.vue +28 -6
  298. package/src/components/progress/Progress.spec.js +77 -0
  299. package/src/components/progress/Progress.vue +108 -0
  300. package/src/components/progress/__snapshots__/Progress.spec.js.snap +7 -0
  301. package/src/components/progress/index.js +17 -0
  302. package/src/components/radio/Radio.spec.js +18 -1
  303. package/src/components/radio/Radio.vue +11 -5
  304. package/src/components/radio/RadioButton.spec.js +18 -1
  305. package/src/components/radio/RadioButton.vue +20 -8
  306. package/src/components/select/Select.spec.js +22 -1
  307. package/src/components/select/Select.vue +2 -1
  308. package/src/components/select/__snapshots__/Select.spec.js.snap +7 -0
  309. package/src/components/slider/Slider.spec.js +10 -0
  310. package/src/components/slider/Slider.vue +240 -0
  311. package/src/components/slider/SliderThumb.vue +188 -0
  312. package/src/components/slider/SliderTick.vue +43 -0
  313. package/src/components/slider/index.js +20 -0
  314. package/src/components/snackbar/index.js +2 -2
  315. package/src/components/steps/StepItem.vue +2 -3
  316. package/src/components/steps/Steps.vue +7 -5
  317. package/src/components/switch/Switch.spec.js +29 -0
  318. package/src/components/switch/Switch.vue +29 -5
  319. package/src/components/switch/__snapshots__/Switch.spec.js.snap +3 -0
  320. package/src/components/table/Table.vue +30 -8
  321. package/src/components/table/TableColumn.vue +2 -2
  322. package/src/components/tag/Tag.vue +4 -1
  323. package/src/components/taginput/Taginput.spec.js +10 -0
  324. package/src/components/taginput/Taginput.vue +8 -3
  325. package/src/components/toast/index.js +2 -2
  326. package/src/components/tooltip/Tooltip.vue +5 -5
  327. package/src/components/upload/Upload.vue +15 -8
  328. package/src/index.js +11 -4
  329. package/src/scss/buefy-build.scss +3 -3
  330. package/src/scss/buefy.scss +4 -0
  331. package/src/scss/components/_datepicker.scss +40 -1
  332. package/src/scss/components/_form.scss +52 -1
  333. package/src/scss/components/_progress.scss +45 -0
  334. package/src/scss/components/_radio.scss +14 -14
  335. package/src/scss/components/_slider.scss +138 -0
  336. package/src/scss/components/_steps.scss +4 -4
  337. package/src/scss/components/_switch.scss +54 -2
  338. package/src/scss/components/_taginput.scss +3 -0
  339. package/src/scss/components/_upload.scss +1 -3
  340. package/src/utils/SlotComponent.js +9 -2
  341. package/src/utils/TimepickerMixin.js +17 -6
  342. package/src/utils/config.js +4 -1
  343. package/src/utils/helpers.spec.js +67 -0
  344. package/src/utils/plugins.js +2 -1
  345. package/types/components.d.ts +3 -3
  346. package/types/index.d.ts +24 -11
  347. package/dist/components/index.js +0 -2
@@ -1,5 +1,8 @@
1
1
  <template>
2
2
  <div class="datepicker-row">
3
+ <a class="datepicker-cell is-week-number" v-if="showWeekNumber">
4
+ {{ getWeekNumber(week[6]) }}
5
+ </a>
3
6
  <template v-for="(day, index) in week">
4
7
  <a
5
8
  v-if="selectableDate(day) && !disabled"
@@ -11,7 +14,8 @@
11
14
  :disabled="disabled"
12
15
  @click.prevent="emitChosenDate(day)"
13
16
  @keydown.enter.prevent="emitChosenDate(day)"
14
- @keydown.space.prevent="emitChosenDate(day)">
17
+ @keydown.space.prevent="emitChosenDate(day)"
18
+ @mouseenter="setRangeHoverEndDate(day)">
15
19
  {{ day.getDate() }}
16
20
  <div class="events" v-if="eventsDateMatch(day)">
17
21
  <div
@@ -36,7 +40,10 @@
36
40
  export default {
37
41
  name: 'BDatepickerTableRow',
38
42
  props: {
39
- selectedDate: Date,
43
+ selectedDate: {
44
+ type: [Date, Array]
45
+ },
46
+ hoveredDateRange: Array,
40
47
  week: {
41
48
  type: Array,
42
49
  required: true
@@ -55,9 +62,62 @@ export default {
55
62
  indicators: String,
56
63
  dateCreator: Function,
57
64
  nearbyMonthDays: Boolean,
58
- nearbySelectableMonthDays: Boolean
65
+ nearbySelectableMonthDays: Boolean,
66
+ showWeekNumber: {
67
+ type: Boolean,
68
+ default: () => false
69
+ },
70
+ rulesForFirstWeek: {
71
+ type: Number,
72
+ default: () => 4
73
+ },
74
+ firstDayOfWeek: Number
59
75
  },
60
76
  methods: {
77
+ firstWeekOffset(year, dow, doy) {
78
+ // first-week day -- which january is always in the first week (4 for iso, 1 for other)
79
+ var fwd = 7 + dow - doy
80
+ // first-week day local weekday -- which local weekday is fwd
81
+ var firstJanuary = new Date(year, 0, fwd)
82
+ var fwdlw = (7 + firstJanuary.getDay() - dow) % 7
83
+ return -fwdlw + fwd - 1
84
+ },
85
+ daysInYear(year) {
86
+ return this.isLeapYear(year) ? 366 : 365
87
+ },
88
+ isLeapYear(year) {
89
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0
90
+ },
91
+ getSetDayOfYear(input) {
92
+ var dayOfYear = Math.round((input - new Date(input.getFullYear(), 0, 1)) / 864e5) + 1
93
+ return dayOfYear
94
+ },
95
+ weeksInYear(year, dow, doy) {
96
+ var weekOffset = this.firstWeekOffset(year, dow, doy)
97
+ var weekOffsetNext = this.firstWeekOffset(year + 1, dow, doy)
98
+ return (this.daysInYear(year) - weekOffset + weekOffsetNext) / 7
99
+ },
100
+ getWeekNumber(mom) {
101
+ var dow = this.firstDayOfWeek // first day of week
102
+ // Rules for the first week : 1 for the 1st January, 4 for the 4th January
103
+ var doy = this.rulesForFirstWeek
104
+ var weekOffset = this.firstWeekOffset(mom.getFullYear(), dow, doy)
105
+ var week = Math.floor((this.getSetDayOfYear(mom) - weekOffset - 1) / 7) + 1
106
+ var resWeek
107
+ var resYear
108
+ if (week < 1) {
109
+ resYear = mom.getFullYear() - 1
110
+ resWeek = week + this.weeksInYear(resYear, dow, doy)
111
+ } else if (week > this.weeksInYear(mom.getFullYear(), dow, doy)) {
112
+ resWeek = week - this.weeksInYear(mom.getFullYear(), dow, doy)
113
+ resYear = mom.getFullYear() + 1
114
+ } else {
115
+ resYear = mom.getFullYear()
116
+ resWeek = week
117
+ }
118
+
119
+ return resWeek
120
+ },
61
121
  /*
62
122
  * Check that selected day is within earliest/latest params and
63
123
  * is within this month
@@ -150,19 +210,58 @@ export default {
150
210
  return false
151
211
  }
152
212
 
213
+ if (Array.isArray(dateTwo)) {
214
+ return dateTwo.some((date) => (
215
+ dateOne.getDate() === date.getDate() &&
216
+ dateOne.getFullYear() === date.getFullYear() &&
217
+ dateOne.getMonth() === date.getMonth()
218
+ ))
219
+ }
153
220
  return (dateOne.getDate() === dateTwo.getDate() &&
154
221
  dateOne.getFullYear() === dateTwo.getFullYear() &&
155
222
  dateOne.getMonth() === dateTwo.getMonth())
156
223
  }
157
224
 
225
+ function dateWithin(dateOne, dates) {
226
+ if (!Array.isArray(dates)) { return false }
227
+
228
+ return dateOne > dates[0] && dateOne < dates[1]
229
+ }
230
+
158
231
  return {
159
- 'is-selected': dateMatch(day, this.selectedDate),
232
+ 'is-selected': dateMatch(day, this.selectedDate) || dateWithin(day, this.selectedDate),
233
+ 'is-first-selected':
234
+ dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[0]),
235
+ 'is-within-selected':
236
+ dateWithin(day, this.selectedDate),
237
+ 'is-last-selected':
238
+ dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[1]),
239
+ 'is-within-hovered-range':
240
+ this.hoveredDateRange && this.hoveredDateRange.length === 2 &&
241
+ (dateMatch(day, this.hoveredDateRange) ||
242
+ dateWithin(day, this.hoveredDateRange)),
243
+ 'is-first-hovered': dateMatch(
244
+ day,
245
+ Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[0]
246
+ ),
247
+ 'is-within-hovered':
248
+ dateWithin(day, this.hoveredDateRange),
249
+ 'is-last-hovered': dateMatch(
250
+ day,
251
+ Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[1]
252
+ ),
160
253
  'is-today': dateMatch(day, this.dateCreator()),
161
254
  'is-selectable': this.selectableDate(day) && !this.disabled,
162
255
  'is-unselectable': !this.selectableDate(day) || this.disabled,
163
256
  'is-invisible': !this.nearbyMonthDays && day.getMonth() !== this.month,
164
257
  'is-nearby': this.nearbySelectableMonthDays && day.getMonth() !== this.month
165
258
  }
259
+ },
260
+ setRangeHoverEndDate(day) {
261
+ const isRangeInput = Array.isArray(this.selectedDate)
262
+ if (isRangeInput) {
263
+ this.$emit('rangeHoverEndDate', day)
264
+ }
166
265
  }
167
266
  }
168
267
  }
@@ -180,9 +180,11 @@ export default {
180
180
  },
181
181
  beforeMount() {
182
182
  // Insert the Dialog component in body tag
183
- this.$nextTick(() => {
184
- document.body.appendChild(this.$el)
185
- })
183
+ if (typeof window !== 'undefined') {
184
+ this.$nextTick(() => {
185
+ document.body.appendChild(this.$el)
186
+ })
187
+ }
186
188
  },
187
189
  mounted() {
188
190
  this.isActive = true
@@ -41,7 +41,7 @@ const DialogProgrammatic = {
41
41
  const Plugin = {
42
42
  install(Vue) {
43
43
  registerComponent(Vue, Dialog)
44
- registerComponentProgrammatic(Vue, '$dialog', DialogProgrammatic)
44
+ registerComponentProgrammatic(Vue, 'dialog', DialogProgrammatic)
45
45
  }
46
46
  }
47
47
 
@@ -50,5 +50,5 @@ use(Plugin)
50
50
  export default Plugin
51
51
 
52
52
  export {
53
- DialogProgrammatic as Dialog
53
+ DialogProgrammatic
54
54
  }
@@ -41,7 +41,7 @@ export default {
41
41
  name: 'BDropdown',
42
42
  props: {
43
43
  value: {
44
- type: [String, Number, Boolean, Object, Array, Symbol, Function],
44
+ type: [String, Number, Boolean, Object, Array, Function],
45
45
  default: null
46
46
  },
47
47
  disabled: Boolean,
@@ -146,8 +146,6 @@ export default {
146
146
  this.$emit('input', this.selected)
147
147
  if (!this.multiple) {
148
148
  this.isActive = !this.closeOnClick
149
- /*
150
- * breaking change
151
149
  if (this.hoverable && this.closeOnClick) {
152
150
  this.isHoverable = false
153
151
  // Timeout for the animation complete before destroying
@@ -155,7 +153,6 @@ export default {
155
153
  this.isHoverable = true
156
154
  }, 250)
157
155
  }
158
- */
159
156
  }
160
157
  },
161
158
 
@@ -6,7 +6,7 @@
6
6
  :class="anchorClasses"
7
7
  @click="selectItem"
8
8
  :role="ariaRoleItem"
9
- tabindex="0">
9
+ :tabindex="focusable ? 0 : null">
10
10
  <slot/>
11
11
  </a>
12
12
  <div
@@ -14,7 +14,7 @@
14
14
  :class="itemClasses"
15
15
  @click="selectItem"
16
16
  :role="ariaRoleItem"
17
- tabindex="0">
17
+ :tabindex="focusable ? 0 : null">
18
18
  <slot/>
19
19
  </div>
20
20
  </template>
@@ -24,12 +24,16 @@ export default {
24
24
  name: 'BDropdownItem',
25
25
  props: {
26
26
  value: {
27
- type: [String, Number, Boolean, Object, Array, Symbol, Function],
27
+ type: [String, Number, Boolean, Object, Array, Function],
28
28
  default: null
29
29
  },
30
30
  separator: Boolean,
31
31
  disabled: Boolean,
32
32
  custom: Boolean,
33
+ focusable: {
34
+ type: Boolean,
35
+ default: true
36
+ },
33
37
  paddingless: Boolean,
34
38
  hasLink: Boolean,
35
39
  ariaRole: {
@@ -25,6 +25,16 @@ describe('BField', () => {
25
25
  expect(wrapper.vm._data).toEqual(expect.objectContaining({fieldLabelSize: 'is-normal'}))
26
26
  })
27
27
 
28
+ it('sets input class with type value when prop "type" is changed dynamically', () => {
29
+ const type = 'is-danger'
30
+ const wrapper = mount(BField, {
31
+ localVue,
32
+ slots: { default: [BInput] }
33
+ })
34
+ wrapper.setProps({ type })
35
+ expect(wrapper.find('.input').classes()).toContain(type)
36
+ })
37
+
28
38
  describe('class names for the root div.field', () => {
29
39
  it('contains "is-expanded" when prop "expanded" is set', () => {
30
40
  const wrapper = shallowMount(BField, { propsData: { expanded: true } })
@@ -55,6 +65,14 @@ describe('BField', () => {
55
65
  expect(wrapper.find('.field').find('p.help').text()).toEqual(message)
56
66
  })
57
67
 
68
+ it('changes the <p> element content in the root div.field when "message" prop is changed dynamically', () => {
69
+ const message = 'Some string message'
70
+ const mountOptions = generateMountOptions({ message: 'initial message' })
71
+ const wrapper = shallowMount(BField, mountOptions)
72
+ wrapper.setProps({ message })
73
+ expect(wrapper.find('.field').find('p.help').text()).toEqual(message)
74
+ })
75
+
58
76
  it('given an array of string as message, it joins the messages with line breaks', () => {
59
77
  const message = [
60
78
  'Some string message 1',
@@ -88,7 +88,8 @@ export default {
88
88
  this.labelPosition === 'inside',
89
89
  'is-floating-label': this.hasLabel && !this.horizontal &&
90
90
  this.labelPosition === 'on-border'
91
- }]
91
+ },
92
+ this.numberInputClasses]
92
93
  },
93
94
  /**
94
95
  * Correct Bulma class for the side of the addon or group.
@@ -142,6 +143,24 @@ export default {
142
143
  },
143
144
  hasLabel() {
144
145
  return this.label || this.$slots.label
146
+ },
147
+ numberInputClasses() {
148
+ if (this.$slots.default) {
149
+ const numberinput = this.$slots.default.filter((node) => node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0)[0]
150
+ if (numberinput) {
151
+ const classes = ['has-numberinput']
152
+ const controlsPosition = numberinput.componentOptions.propsData.controlsPosition
153
+ const size = numberinput.componentOptions.propsData.size
154
+ if (controlsPosition) {
155
+ classes.push(`has-numberinput-${controlsPosition}`)
156
+ }
157
+ if (size) {
158
+ classes.push(`has-numberinput-${size}`)
159
+ }
160
+ return classes
161
+ }
162
+ }
163
+ return null
145
164
  }
146
165
  },
147
166
  watch: {
@@ -185,7 +204,7 @@ export default {
185
204
  mounted() {
186
205
  if (this.horizontal) {
187
206
  // Bulma docs: .is-normal for any .input or .button
188
- const elements = this.$el.querySelectorAll('.input, .select, .button, .textarea')
207
+ const elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider')
189
208
  if (elements.length > 0) {
190
209
  this.fieldLabelSize = 'is-normal'
191
210
  }
@@ -14,10 +14,13 @@ import Menu from './menu'
14
14
  import Message from './message'
15
15
  import Modal from './modal'
16
16
  import Notification from './notification'
17
+ import Navbar from './navbar'
17
18
  import Numberinput from './numberinput'
18
19
  import Pagination from './pagination'
20
+ import Progress from './progress'
19
21
  import Radio from './radio'
20
22
  import Select from './select'
23
+ import Slider from './slider'
21
24
  import Snackbar from './snackbar'
22
25
  import Steps from './steps'
23
26
  import Switch from './switch'
@@ -46,11 +49,14 @@ export {
46
49
  Menu,
47
50
  Message,
48
51
  Modal,
52
+ Navbar,
49
53
  Notification,
50
54
  Numberinput,
51
55
  Pagination,
56
+ Progress,
52
57
  Radio,
53
58
  Select,
59
+ Slider,
54
60
  Snackbar,
55
61
  Steps,
56
62
  Switch,
@@ -34,7 +34,7 @@
34
34
  :size="iconSize"/>
35
35
 
36
36
  <b-icon
37
- v-if="!loading && (passwordReveal || statusType)"
37
+ v-if="!loading && (passwordReveal || statusTypeIcon)"
38
38
  class="is-right"
39
39
  :class="{ 'is-clickable': passwordReveal }"
40
40
  :icon="passwordReveal ? passwordVisibleIcon : statusTypeIcon"
@@ -122,7 +122,7 @@ export default {
122
122
  ]
123
123
  },
124
124
  hasIconRight() {
125
- return this.passwordReveal || this.loading || this.statusType
125
+ return this.passwordReveal || this.loading || this.statusTypeIcon
126
126
  },
127
127
 
128
128
  /**
@@ -22,7 +22,7 @@ const LoadingProgrammatic = {
22
22
  const Plugin = {
23
23
  install(Vue) {
24
24
  registerComponent(Vue, Loading)
25
- registerComponentProgrammatic(Vue, '$loading', LoadingProgrammatic)
25
+ registerComponentProgrammatic(Vue, 'loading', LoadingProgrammatic)
26
26
  }
27
27
  }
28
28
 
@@ -32,7 +32,7 @@ const ModalProgrammatic = {
32
32
  const Plugin = {
33
33
  install(Vue) {
34
34
  registerComponent(Vue, Modal)
35
- registerComponentProgrammatic(Vue, '$modal', ModalProgrammatic)
35
+ registerComponentProgrammatic(Vue, 'modal', ModalProgrammatic)
36
36
  }
37
37
  }
38
38
 
@@ -0,0 +1,76 @@
1
+ import { shallowMount, mount } from '@vue/test-utils'
2
+ import BNavbar from '@components/navbar/Navbar.vue'
3
+ import BNavbarBurger from '@components/navbar/NavbarBurger.vue'
4
+ import BNavbarItem from '@components/navbar/NavbarItem.vue'
5
+
6
+ describe('BNavbar', () => {
7
+ let wrapper
8
+ beforeEach(() => {
9
+ wrapper = mount(BNavbar)
10
+ })
11
+
12
+ it('is called', () => {
13
+ expect(wrapper.isVueInstance()).toBeTruthy()
14
+ })
15
+
16
+ it('should have a nav tag', () => {
17
+ expect(wrapper.contains('nav')).toBeTruthy()
18
+ })
19
+
20
+ it('should emmit the sync event when the burger menu was clicked', () => {
21
+ const anchorTag = wrapper.find('.navbar-burger')
22
+ anchorTag.trigger('click')
23
+ const valueEmitted = wrapper.emitted()['update:isActive'][0]
24
+ expect(valueEmitted).toContainEqual(true)
25
+ expect(wrapper.vm.isOpened).toBe(true)
26
+ })
27
+
28
+ it('should have the is-active class when we set the isActive prop manually', () => {
29
+ const navBar = mount(BNavbar)
30
+ navBar.setProps({ isActive: true })
31
+ const menuContainer = navBar.find('.navbar-menu')
32
+ expect(menuContainer.classes('is-active')).toBe(true)
33
+ })
34
+
35
+ describe('BNavbarBurger', () => {
36
+ let wrapper
37
+ beforeEach(() => {
38
+ wrapper = shallowMount(BNavbarBurger)
39
+ })
40
+
41
+ it('is called', () => {
42
+ expect(wrapper.isVueInstance()).toBeTruthy()
43
+ })
44
+
45
+ it('should be an anchor tag', () => {
46
+ const anchorTag = wrapper.find('.navbar-burger')
47
+ expect(anchorTag.is('a')).toBe(true)
48
+ })
49
+
50
+ it('should have the is-active class when the prop isOpened is true', () => {
51
+ const burgerWrapper = mount(BNavbarBurger)
52
+ burgerWrapper.setProps({ isOpened: true })
53
+ expect(burgerWrapper.classes('is-active')).toBe(true)
54
+ })
55
+ })
56
+
57
+ describe('BNavbarItem', () => {
58
+ it('is called', () => {
59
+ expect(wrapper.isVueInstance()).toBeTruthy()
60
+ })
61
+
62
+ it('correctly renders the provided tag', () => {
63
+ const tag = 'div'
64
+ const NavbarItem = {
65
+ components: { BNavbarItem },
66
+ template: `
67
+ <div>
68
+ <b-navbar-item tag="${tag}"></b-navbar-item>
69
+ </div>
70
+ `
71
+ }
72
+ const wrapper = mount(NavbarItem)
73
+ expect(wrapper.contains(tag)).toBeTruthy()
74
+ })
75
+ })
76
+ })
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <nav
3
+ class="navbar"
4
+ role="navigation"
5
+ aria-label="main navigation"
6
+ :class="computedClasses"
7
+ >
8
+ <div class="navbar-brand">
9
+ <slot name="brand"/>
10
+ <slot name="burger" v-bind="{ isOpened, toggleActive }">
11
+ <navbar-burger @click.native="toggleActive" :is-opened="isOpened"/>
12
+ </slot>
13
+ </div>
14
+ <div class="navbar-menu" :class="{ 'is-active': isOpened }">
15
+ <div class="navbar-start">
16
+ <slot name="start" />
17
+ </div>
18
+ <div class="navbar-end">
19
+ <slot name="end" />
20
+ </div>
21
+ </div>
22
+ </nav>
23
+ </template>
24
+
25
+ <script>
26
+ import NavbarBurger from './NavbarBurger.vue'
27
+
28
+ const FIXED_TOP_CLASS = 'is-fixed-top'
29
+ const FIXED_BOTTOM_CLASS = 'is-fixed-bottom'
30
+
31
+ export default {
32
+ name: 'BNavbar',
33
+ components: {
34
+ NavbarBurger
35
+ },
36
+ props: {
37
+ type: [String, Object],
38
+ transparent: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ fixedTop: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ fixedBottom: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ isActive: {
51
+ type: Boolean,
52
+ default: false
53
+ }
54
+ },
55
+ data() {
56
+ return {
57
+ internalIsActive: this.isActive
58
+ }
59
+ },
60
+ computed: {
61
+ isOpened() {
62
+ return this.internalIsActive
63
+ },
64
+ computedClasses() {
65
+ return [
66
+ this.type,
67
+ { [FIXED_TOP_CLASS]: this.fixedTop },
68
+ { [FIXED_BOTTOM_CLASS]: this.fixedBottom }
69
+ ]
70
+ }
71
+ },
72
+ watch: {
73
+ isActive: {
74
+ handler(isActive) {
75
+ this.internalIsActive = isActive
76
+ },
77
+ immediate: true
78
+ },
79
+ fixedTop: {
80
+ handler(isSet) {
81
+ this.checkIfFixedPropertiesAreColliding()
82
+ if (isSet) {
83
+ return this.setBodyClass(FIXED_TOP_CLASS)
84
+ }
85
+ this.removeBodyClass(FIXED_TOP_CLASS)
86
+ },
87
+ immediate: true
88
+ },
89
+ fixedBottom: {
90
+ handler(isSet) {
91
+ this.checkIfFixedPropertiesAreColliding()
92
+ if (isSet) {
93
+ return this.setBodyClass(FIXED_BOTTOM_CLASS)
94
+ }
95
+ this.removeBodyClass(FIXED_BOTTOM_CLASS)
96
+ },
97
+ immediate: true
98
+ }
99
+ },
100
+ methods: {
101
+ toggleActive() {
102
+ this.internalIsActive = !this.internalIsActive
103
+ this.$emit('update:isActive', this.internalIsActive)
104
+ },
105
+ setBodyClass(className) {
106
+ if (typeof window !== 'undefined') {
107
+ document.body.classList.add(className)
108
+ }
109
+ },
110
+ removeBodyClass(className) {
111
+ if (typeof window !== 'undefined') {
112
+ document.body.classList.remove(className)
113
+ }
114
+ },
115
+ checkIfFixedPropertiesAreColliding() {
116
+ const areColliding = this.fixedTop && this.fixedBottom
117
+ if (areColliding) {
118
+ throw new Error('You should choose if the BNavbar is fixed bottom or fixed top, but not both')
119
+ }
120
+ }
121
+ },
122
+ beforeDestroy() {
123
+ this.removeBodyClass(FIXED_BOTTOM_CLASS)
124
+ this.removeBodyClass(FIXED_TOP_CLASS)
125
+ }
126
+ }
127
+ </script>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <a
3
+ role="button"
4
+ class="navbar-burger burger"
5
+ :class="{ 'is-active': isOpened }"
6
+ aria-label="menu"
7
+ :aria-expanded="isOpened"
8
+ >
9
+ <span aria-hidden="true"/>
10
+ <span aria-hidden="true"/>
11
+ <span aria-hidden="true"/>
12
+ </a>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ name: 'NavbarBurger',
18
+ props: {
19
+ isOpened: {
20
+ type: Boolean,
21
+ default: false
22
+ }
23
+ }
24
+ }
25
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <component
3
+ :is="tag"
4
+ class="navbar-item"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot/>
8
+ </component>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'BNavbarItem',
14
+ props: {
15
+ tag: {
16
+ type: String,
17
+ default: 'a'
18
+ }
19
+ }
20
+ }
21
+ </script>
@@ -0,0 +1,20 @@
1
+ import Navbar from './Navbar'
2
+ import NavbarItem from './NavbarItem'
3
+
4
+ import { use, registerComponent } from '../../utils/plugins'
5
+
6
+ const Plugin = {
7
+ install(Vue) {
8
+ registerComponent(Vue, Navbar)
9
+ registerComponent(Vue, NavbarItem)
10
+ }
11
+ }
12
+
13
+ use(Plugin)
14
+
15
+ export default Plugin
16
+
17
+ export {
18
+ Navbar,
19
+ NavbarItem
20
+ }
@@ -34,7 +34,7 @@ const NotificationProgrammatic = {
34
34
  const Plugin = {
35
35
  install(Vue) {
36
36
  registerComponent(Vue, Notification)
37
- registerComponentProgrammatic(Vue, '$notification', NotificationProgrammatic)
37
+ registerComponentProgrammatic(Vue, 'notification', NotificationProgrammatic)
38
38
  }
39
39
  }
40
40