buefy 1.0.1 → 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.
Files changed (108) hide show
  1. package/README.md +21 -11
  2. package/dist/buefy.css +1 -10
  3. package/dist/buefy.d.ts +11 -18
  4. package/dist/buefy.esm.js +137 -33
  5. package/dist/buefy.esm.min.js +2 -2
  6. package/dist/buefy.js +137 -33
  7. package/dist/buefy.min.css +1 -1
  8. package/dist/buefy.min.js +2 -2
  9. package/dist/cjs/{Autocomplete-bK5HLaUH.js → Autocomplete-BMmOsPiK.js} +120 -27
  10. package/dist/cjs/autocomplete.js +1 -1
  11. package/dist/cjs/clockpicker.js +16 -5
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/taginput.js +1 -1
  14. package/dist/components/autocomplete/index.js +121 -28
  15. package/dist/components/autocomplete/index.min.js +2 -2
  16. package/dist/components/breadcrumb/index.js +1 -1
  17. package/dist/components/breadcrumb/index.min.js +1 -1
  18. package/dist/components/button/index.js +1 -1
  19. package/dist/components/button/index.min.js +1 -1
  20. package/dist/components/carousel/index.js +1 -1
  21. package/dist/components/carousel/index.min.js +1 -1
  22. package/dist/components/checkbox/index.js +1 -1
  23. package/dist/components/checkbox/index.min.js +1 -1
  24. package/dist/components/clockpicker/index.js +17 -6
  25. package/dist/components/clockpicker/index.min.js +2 -2
  26. package/dist/components/collapse/index.js +1 -1
  27. package/dist/components/collapse/index.min.js +1 -1
  28. package/dist/components/colorpicker/index.js +1 -1
  29. package/dist/components/colorpicker/index.min.js +1 -1
  30. package/dist/components/datepicker/index.js +1 -1
  31. package/dist/components/datepicker/index.min.js +1 -1
  32. package/dist/components/datetimepicker/index.js +1 -1
  33. package/dist/components/datetimepicker/index.min.js +1 -1
  34. package/dist/components/dialog/index.js +1 -1
  35. package/dist/components/dialog/index.min.js +1 -1
  36. package/dist/components/dropdown/index.js +1 -1
  37. package/dist/components/dropdown/index.min.js +1 -1
  38. package/dist/components/field/index.js +1 -1
  39. package/dist/components/field/index.min.js +1 -1
  40. package/dist/components/icon/index.js +1 -1
  41. package/dist/components/icon/index.min.js +1 -1
  42. package/dist/components/image/index.js +1 -1
  43. package/dist/components/image/index.min.js +1 -1
  44. package/dist/components/input/index.js +1 -1
  45. package/dist/components/input/index.min.js +1 -1
  46. package/dist/components/loading/index.js +1 -1
  47. package/dist/components/loading/index.min.js +1 -1
  48. package/dist/components/menu/index.js +1 -1
  49. package/dist/components/menu/index.min.js +1 -1
  50. package/dist/components/message/index.js +1 -1
  51. package/dist/components/message/index.min.js +1 -1
  52. package/dist/components/modal/index.js +1 -1
  53. package/dist/components/modal/index.min.js +1 -1
  54. package/dist/components/navbar/index.js +1 -1
  55. package/dist/components/navbar/index.min.js +1 -1
  56. package/dist/components/notification/index.js +1 -1
  57. package/dist/components/notification/index.min.js +1 -1
  58. package/dist/components/numberinput/index.js +1 -1
  59. package/dist/components/numberinput/index.min.js +1 -1
  60. package/dist/components/pagination/index.js +1 -1
  61. package/dist/components/pagination/index.min.js +1 -1
  62. package/dist/components/progress/index.js +1 -1
  63. package/dist/components/progress/index.min.js +1 -1
  64. package/dist/components/radio/index.js +1 -1
  65. package/dist/components/radio/index.min.js +1 -1
  66. package/dist/components/rate/index.js +1 -1
  67. package/dist/components/rate/index.min.js +1 -1
  68. package/dist/components/select/index.js +1 -1
  69. package/dist/components/select/index.min.js +1 -1
  70. package/dist/components/sidebar/index.js +1 -1
  71. package/dist/components/sidebar/index.min.js +1 -1
  72. package/dist/components/skeleton/index.js +1 -1
  73. package/dist/components/skeleton/index.min.js +1 -1
  74. package/dist/components/slider/index.js +1 -1
  75. package/dist/components/slider/index.min.js +1 -1
  76. package/dist/components/snackbar/index.js +1 -1
  77. package/dist/components/snackbar/index.min.js +1 -1
  78. package/dist/components/steps/index.js +1 -1
  79. package/dist/components/steps/index.min.js +1 -1
  80. package/dist/components/switch/index.js +1 -1
  81. package/dist/components/switch/index.min.js +1 -1
  82. package/dist/components/table/index.js +1 -1
  83. package/dist/components/table/index.min.js +1 -1
  84. package/dist/components/tabs/index.js +1 -1
  85. package/dist/components/tabs/index.min.js +1 -1
  86. package/dist/components/tag/index.js +1 -1
  87. package/dist/components/tag/index.min.js +1 -1
  88. package/dist/components/taginput/index.js +121 -28
  89. package/dist/components/taginput/index.min.js +2 -2
  90. package/dist/components/timepicker/index.js +1 -1
  91. package/dist/components/timepicker/index.min.js +1 -1
  92. package/dist/components/toast/index.js +1 -1
  93. package/dist/components/toast/index.min.js +1 -1
  94. package/dist/components/tooltip/index.js +1 -1
  95. package/dist/components/tooltip/index.min.js +1 -1
  96. package/dist/components/upload/index.js +1 -1
  97. package/dist/components/upload/index.min.js +1 -1
  98. package/dist/esm/{Autocomplete-DyPAHhWD.js → Autocomplete-CjbTh9D8.js} +120 -27
  99. package/dist/esm/autocomplete.js +1 -1
  100. package/dist/esm/clockpicker.js +16 -5
  101. package/dist/esm/index.js +1 -1
  102. package/dist/esm/taginput.js +1 -1
  103. package/package.json +6 -3
  104. package/src/components/autocomplete/Autocomplete.spec.ts +349 -11
  105. package/src/components/autocomplete/Autocomplete.vue +232 -64
  106. package/src/components/clockpicker/Clockpicker.vue +18 -5
  107. package/src/components/snackbar/index.ts +1 -1
  108. package/src/scss/components/_upload.scss +0 -11
package/dist/buefy.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Buefy v1.0.1 | MIT License | github.com/buefy/buefy */
1
+ /*! Buefy v1.0.2 | MIT License | github.com/buefy/buefy */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
@@ -2007,7 +2007,9 @@
2007
2007
  },
2008
2008
  isEmpty() {
2009
2009
  if (!this.computedData) return true;
2010
- return !this.computedData.some((element) => element.items && element.items.length);
2010
+ return !this.computedData.some(
2011
+ (element) => element.items && element.items.length
2012
+ );
2011
2013
  },
2012
2014
  /*
2013
2015
  * White-listed items to not close when clicked.
@@ -2015,6 +2017,7 @@
2015
2017
  */
2016
2018
  whiteList() {
2017
2019
  var _a;
2020
+ this.computedData;
2018
2021
  const whiteList = [];
2019
2022
  whiteList.push(this.$refs.input.$el.querySelector("input"));
2020
2023
  whiteList.push(this.$refs.dropdown);
@@ -2110,13 +2113,22 @@
2110
2113
  * When checkInfiniteScroll property changes scroll event should be removed or added
2111
2114
  */
2112
2115
  checkInfiniteScroll(checkInfiniteScroll) {
2113
- if ((this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content")) === false) return;
2114
- const list = this.$refs.dropdown.querySelector(".dropdown-content");
2116
+ if (!this.$refs.dropdown) return;
2117
+ const list = this.$refs.dropdown.querySelector(
2118
+ ".dropdown-content"
2119
+ );
2120
+ if (!list) return;
2115
2121
  if (checkInfiniteScroll === true) {
2116
- list.addEventListener("scroll", this.checkIfReachedTheEndOfScroll);
2122
+ list.addEventListener(
2123
+ "scroll",
2124
+ this.checkIfReachedTheEndOfScroll
2125
+ );
2117
2126
  return;
2118
2127
  }
2119
- list.removeEventListener("scroll", this.checkIfReachedTheEndOfScroll);
2128
+ list.removeEventListener(
2129
+ "scroll",
2130
+ this.checkIfReachedTheEndOfScroll
2131
+ );
2120
2132
  },
2121
2133
  /*
2122
2134
  * When updating input's value
@@ -2127,11 +2139,11 @@
2127
2139
  newValue(value) {
2128
2140
  this.$emit("update:modelValue", value);
2129
2141
  const currentValue = this.getValue(this.selected);
2130
- if (currentValue && currentValue !== value) {
2142
+ if (currentValue !== void 0 && currentValue !== null && currentValue !== value) {
2131
2143
  this.setSelected(null, false);
2132
2144
  }
2133
- if (this.hasFocus && (!this.openOnFocus || value)) {
2134
- this.isActive = !!value;
2145
+ if (this.hasFocus && (!this.openOnFocus || value !== "")) {
2146
+ this.isActive = value !== "" && value !== void 0 && value !== null;
2135
2147
  }
2136
2148
  },
2137
2149
  /*
@@ -2142,6 +2154,9 @@
2142
2154
  modelValue(value) {
2143
2155
  this.newValue = value;
2144
2156
  },
2157
+ keepFirst(value) {
2158
+ this.ariaAutocomplete = value ? "both" : "list";
2159
+ },
2145
2160
  /*
2146
2161
  * Select first option if "keep-first
2147
2162
  */
@@ -2163,6 +2178,24 @@
2163
2178
  }
2164
2179
  }
2165
2180
  }
2181
+ },
2182
+ /*
2183
+ * When appendToBody property changes, handle the transition properly
2184
+ */
2185
+ appendToBody(newValue, oldValue) {
2186
+ if (newValue && !oldValue) {
2187
+ if (this.isActive && this.$refs.dropdown && !this.$data._bodyEl) {
2188
+ this.$data._bodyEl = createAbsoluteElement(
2189
+ this.$refs.dropdown
2190
+ );
2191
+ this.updateAppendToBody();
2192
+ }
2193
+ } else if (!newValue && oldValue) {
2194
+ if (this.$data._bodyEl) {
2195
+ removeElement(this.$data._bodyEl);
2196
+ this.$data._bodyEl = void 0;
2197
+ }
2198
+ }
2166
2199
  }
2167
2200
  },
2168
2201
  methods: {
@@ -2185,10 +2218,7 @@
2185
2218
  this.$emit("select", this.selected, event);
2186
2219
  if (this.selected !== null) {
2187
2220
  if (this.clearOnSelect) {
2188
- const input = this.$refs.input;
2189
- input.newValue = "";
2190
- const innerInput = input.$refs.input;
2191
- innerInput.value = "";
2221
+ this.newValue = "";
2192
2222
  } else {
2193
2223
  this.newValue = this.getValue(this.selected);
2194
2224
  }
@@ -2215,6 +2245,31 @@
2215
2245
  }
2216
2246
  });
2217
2247
  },
2248
+ /*
2249
+ * Find index of hovered item in data array by comparing display values
2250
+ * instead of object references. This fixes the bug with computed data
2251
+ * where proxy objects cause indexOf to fail.
2252
+ */
2253
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2254
+ findHoveredIndex(data) {
2255
+ if (this.hovered === null || this.hovered === void 0) {
2256
+ return -1;
2257
+ }
2258
+ const exactIndex = data.indexOf(this.hovered);
2259
+ if (exactIndex !== -1) {
2260
+ return exactIndex;
2261
+ }
2262
+ const hoveredValue = this.getValue(this.hovered);
2263
+ if (hoveredValue === null || hoveredValue === void 0) {
2264
+ return -1;
2265
+ }
2266
+ return data.findIndex((item) => {
2267
+ if (item === null || item === void 0) {
2268
+ return hoveredValue === null || hoveredValue === void 0;
2269
+ }
2270
+ return this.getValue(item) === hoveredValue;
2271
+ });
2272
+ },
2218
2273
  keydown(event) {
2219
2274
  const { key } = event;
2220
2275
  if (key === "Enter") event.preventDefault();
@@ -2225,7 +2280,11 @@
2225
2280
  if (key === ",") event.preventDefault();
2226
2281
  const closeDropdown = !this.keepOpen || key === "Tab";
2227
2282
  if (this.hovered === null) {
2228
- this.checkIfHeaderOrFooterSelected(event, null, closeDropdown);
2283
+ this.checkIfHeaderOrFooterSelected(
2284
+ event,
2285
+ null,
2286
+ closeDropdown
2287
+ );
2229
2288
  return;
2230
2289
  }
2231
2290
  this.setSelected(this.hovered, closeDropdown, event);
@@ -2281,7 +2340,9 @@
2281
2340
  * reached it's end.
2282
2341
  */
2283
2342
  checkIfReachedTheEndOfScroll() {
2284
- const list = this.$refs.dropdown.querySelector(".dropdown-content");
2343
+ const list = this.$refs.dropdown.querySelector(
2344
+ ".dropdown-content"
2345
+ );
2285
2346
  const footerHeight = this.hasFooterSlot ? list.querySelectorAll("div.dropdown-footer")[0].clientHeight : 0;
2286
2347
  if (list.clientHeight !== list.scrollHeight && list.scrollTop + list.parentElement.clientHeight + footerHeight >= list.scrollHeight) {
2287
2348
  this.$emit("infinite-scroll");
@@ -2309,9 +2370,7 @@
2309
2370
  keyArrows(direction) {
2310
2371
  const sum = direction === "down" ? 1 : -1;
2311
2372
  if (this.isActive) {
2312
- const data = this.computedData.map(
2313
- (d) => d.items
2314
- ).reduce((a, b) => [...a, ...b], []);
2373
+ const data = this.computedData.map((d) => d.items).reduce((a, b) => [...a, ...b], []);
2315
2374
  if (this.hasHeaderSlot && this.selectableHeader) {
2316
2375
  data.unshift(void 0);
2317
2376
  }
@@ -2324,7 +2383,7 @@
2324
2383
  } else if (this.footerHovered) {
2325
2384
  index = data.length - 1 + sum;
2326
2385
  } else {
2327
- index = data.indexOf(this.hovered) + sum;
2386
+ index = this.findHoveredIndex(data) + sum;
2328
2387
  }
2329
2388
  index = index > data.length - 1 ? data.length - 1 : index;
2330
2389
  index = index < 0 ? 0 : index;
@@ -2337,7 +2396,9 @@
2337
2396
  if (this.hasHeaderSlot && this.selectableHeader && index === 0) {
2338
2397
  this.headerHovered = true;
2339
2398
  }
2340
- const list = this.$refs.dropdown.querySelector(".dropdown-content");
2399
+ const list = this.$refs.dropdown.querySelector(
2400
+ ".dropdown-content"
2401
+ );
2341
2402
  let querySelectorText = "a.dropdown-item:not(.is-disabled)";
2342
2403
  if (this.hasHeaderSlot && this.selectableHeader) {
2343
2404
  querySelectorText += ",div.dropdown-header";
@@ -2384,7 +2445,9 @@
2384
2445
  },
2385
2446
  onInput() {
2386
2447
  const currentValue = this.getValue(this.selected);
2387
- if (currentValue && currentValue === this.newValue) return;
2448
+ if (currentValue !== void 0 && currentValue !== null && currentValue === this.newValue) {
2449
+ return;
2450
+ }
2388
2451
  this.$emit("typing", this.newValue);
2389
2452
  this.checkValidity();
2390
2453
  },
@@ -2410,6 +2473,9 @@
2410
2473
  const dropdownMenu = this.$refs.dropdown;
2411
2474
  const trigger = this.$parent.$data._isTaginput ? this.$parent.$el : this.$refs.input.$el;
2412
2475
  if (dropdownMenu && trigger) {
2476
+ if (!this.$data._bodyEl) {
2477
+ this.$data._bodyEl = createAbsoluteElement(dropdownMenu);
2478
+ }
2413
2479
  const root = this.$data._bodyEl;
2414
2480
  root.classList.forEach((item) => root.classList.remove(item));
2415
2481
  root.classList.add("autocomplete");
@@ -2440,17 +2506,30 @@
2440
2506
  if (typeof window !== "undefined") {
2441
2507
  document.addEventListener("click", this.clickedOutside);
2442
2508
  if (this.dropdownPosition === "auto") {
2443
- window.addEventListener("resize", this.calcDropdownInViewportVertical);
2509
+ window.addEventListener(
2510
+ "resize",
2511
+ this.calcDropdownInViewportVertical
2512
+ );
2513
+ }
2514
+ if (this.appendToBody) {
2515
+ window.addEventListener(
2516
+ "scroll",
2517
+ this.calcDropdownInViewportVertical
2518
+ );
2444
2519
  }
2445
2520
  }
2446
2521
  },
2447
2522
  mounted() {
2448
2523
  if (this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content")) {
2449
- const list = this.$refs.dropdown.querySelector(".dropdown-content");
2524
+ const list = this.$refs.dropdown.querySelector(
2525
+ ".dropdown-content"
2526
+ );
2450
2527
  list.addEventListener("scroll", this.checkIfReachedTheEndOfScroll);
2451
2528
  }
2452
2529
  if (this.appendToBody) {
2453
- this.$data._bodyEl = createAbsoluteElement(this.$refs.dropdown);
2530
+ this.$data._bodyEl = createAbsoluteElement(
2531
+ this.$refs.dropdown
2532
+ );
2454
2533
  this.updateAppendToBody();
2455
2534
  }
2456
2535
  },
@@ -2458,14 +2537,28 @@
2458
2537
  if (typeof window !== "undefined") {
2459
2538
  document.removeEventListener("click", this.clickedOutside);
2460
2539
  if (this.dropdownPosition === "auto") {
2461
- window.removeEventListener("resize", this.calcDropdownInViewportVertical);
2540
+ window.removeEventListener(
2541
+ "resize",
2542
+ this.calcDropdownInViewportVertical
2543
+ );
2544
+ }
2545
+ if (this.appendToBody) {
2546
+ window.removeEventListener(
2547
+ "scroll",
2548
+ this.calcDropdownInViewportVertical
2549
+ );
2462
2550
  }
2463
2551
  }
2464
2552
  if (this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content")) {
2465
- const list = this.$refs.dropdown.querySelector(".dropdown-content");
2466
- list.removeEventListener("scroll", this.checkIfReachedTheEndOfScroll);
2553
+ const list = this.$refs.dropdown.querySelector(
2554
+ ".dropdown-content"
2555
+ );
2556
+ list.removeEventListener(
2557
+ "scroll",
2558
+ this.checkIfReachedTheEndOfScroll
2559
+ );
2467
2560
  }
2468
- if (this.appendToBody) {
2561
+ if (this.appendToBody && this.$data._bodyEl) {
2469
2562
  removeElement(this.$data._bodyEl);
2470
2563
  }
2471
2564
  clearTimeout(this.timeOutID);
@@ -6059,10 +6152,6 @@
6059
6152
  type: Number,
6060
6153
  default: 5
6061
6154
  },
6062
- autoSwitch: {
6063
- type: Boolean,
6064
- default: true
6065
- },
6066
6155
  type: {
6067
6156
  type: String,
6068
6157
  default: "is-primary"
@@ -6121,8 +6210,22 @@
6121
6210
  }
6122
6211
  },
6123
6212
  onClockChange() {
6124
- if (this.autoSwitch && this.isSelectingHour) {
6213
+ if (this.isSelectingHour) {
6125
6214
  this.isSelectingHour = !this.isSelectingHour;
6215
+ } else {
6216
+ this.toggle(false);
6217
+ }
6218
+ },
6219
+ /*
6220
+ * Toggle clockpicker
6221
+ */
6222
+ toggle(active) {
6223
+ if (this.$refs.dropdown) {
6224
+ const dropdown = this.$refs.dropdown;
6225
+ dropdown.isActive = active != null ? active : !dropdown.isActive;
6226
+ if (dropdown.isActive) {
6227
+ this.isSelectingHour = true;
6228
+ }
6126
6229
  }
6127
6230
  },
6128
6231
  onMeridienClick(value) {
@@ -6309,6 +6412,7 @@
6309
6412
  )
6310
6413
  ])) : vue.createCommentVNode("v-if", true),
6311
6414
  vue.createVNode(_component_b_clockpicker_face, {
6415
+ ref: "clockpickerFace",
6312
6416
  "picker-size": _ctx.faceSize,
6313
6417
  min: _ctx.minFaceValue,
6314
6418
  max: _ctx.maxFaceValue,