@gitlab/ui 49.0.1 → 49.0.3

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 (128) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/base/accordion/accordion.js +2 -8
  3. package/dist/components/base/accordion/accordion_item.js +0 -14
  4. package/dist/components/base/alert/alert.js +4 -22
  5. package/dist/components/base/avatar/avatar.js +0 -7
  6. package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -2
  7. package/dist/components/base/avatars_inline/avatars_inline.js +2 -10
  8. package/dist/components/base/badge/badge.js +0 -8
  9. package/dist/components/base/banner/banner.js +0 -10
  10. package/dist/components/base/breadcrumb/breadcrumb.js +0 -12
  11. package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -2
  12. package/dist/components/base/broadcast_message/broadcast_message.js +0 -3
  13. package/dist/components/base/button/button.js +0 -11
  14. package/dist/components/base/card/card.js +1 -2
  15. package/dist/components/base/datepicker/datepicker.js +7 -42
  16. package/dist/components/base/daterange_picker/daterange_picker.js +0 -23
  17. package/dist/components/base/drawer/drawer.js +0 -13
  18. package/dist/components/base/dropdown/dropdown.js +3 -17
  19. package/dist/components/base/dropdown/dropdown_item.js +2 -8
  20. package/dist/components/base/filtered_search/common_story_options.js +1 -2
  21. package/dist/components/base/filtered_search/filtered_search.js +9 -61
  22. package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -6
  23. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -16
  24. package/dist/components/base/filtered_search/filtered_search_term.js +0 -9
  25. package/dist/components/base/filtered_search/filtered_search_token.js +10 -49
  26. package/dist/components/base/filtered_search/filtered_search_token_segment.js +3 -56
  27. package/dist/components/base/filtered_search/filtered_search_utils.js +7 -24
  28. package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -2
  29. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -4
  30. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -10
  31. package/dist/components/base/form/form_checkbox_tree/models/node.js +1 -10
  32. package/dist/components/base/form/form_checkbox_tree/models/tree.js +16 -37
  33. package/dist/components/base/form/form_combobox/form_combobox.js +2 -36
  34. package/dist/components/base/form/form_group/form_group.js +2 -7
  35. package/dist/components/base/form/form_input/form_input.js +2 -8
  36. package/dist/components/base/form/form_input_group/form_input_group.js +0 -5
  37. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -8
  38. package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -2
  39. package/dist/components/base/form/form_select/form_select.js +0 -3
  40. package/dist/components/base/form/form_textarea/form_textarea.js +2 -7
  41. package/dist/components/base/icon/icon.js +4 -14
  42. package/dist/components/base/infinite_scroll/infinite_scroll.js +7 -21
  43. package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -9
  44. package/dist/components/base/label/label.js +0 -12
  45. package/dist/components/base/loading_icon/loading_icon.js +7 -10
  46. package/dist/components/base/markdown/markdown.js +1 -0
  47. package/dist/components/base/modal/modal.js +7 -27
  48. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -25
  49. package/dist/components/base/new_dropdowns/constants.js +4 -2
  50. package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -63
  51. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -2
  52. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -5
  53. package/dist/components/base/new_dropdowns/listbox/utils.js +0 -7
  54. package/dist/components/base/paginated_list/paginated_list.js +0 -15
  55. package/dist/components/base/pagination/pagination.js +14 -72
  56. package/dist/components/base/path/path.js +0 -29
  57. package/dist/components/base/popover/popover.js +0 -5
  58. package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -26
  59. package/dist/components/base/search_box_by_type/search_box_by_type.js +2 -12
  60. package/dist/components/base/segmented_control/segmented_control.js +0 -10
  61. package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -19
  62. package/dist/components/base/skeleton_loading/skeleton_loading.js +0 -3
  63. package/dist/components/base/sorting/sorting.js +1 -9
  64. package/dist/components/base/sorting/sorting_item.js +4 -6
  65. package/dist/components/base/table/table.js +0 -4
  66. package/dist/components/base/tabs/tab/tab.js +2 -6
  67. package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -21
  68. package/dist/components/base/tabs/tabs/tabs.js +8 -33
  69. package/dist/components/base/toast/toast.js +4 -15
  70. package/dist/components/base/toggle/toggle.js +0 -18
  71. package/dist/components/base/token/token.js +0 -4
  72. package/dist/components/base/token_selector/token_container.js +0 -24
  73. package/dist/components/base/token_selector/token_selector.js +10 -61
  74. package/dist/components/base/token_selector/token_selector_dropdown.js +4 -32
  75. package/dist/components/charts/area/area.js +8 -32
  76. package/dist/components/charts/bar/bar.js +7 -19
  77. package/dist/components/charts/chart/chart.js +1 -22
  78. package/dist/components/charts/column/column.js +8 -18
  79. package/dist/components/charts/discrete_scatter/discrete_scatter.js +2 -13
  80. package/dist/components/charts/gauge/gauge.js +0 -15
  81. package/dist/components/charts/heatmap/heatmap.js +3 -16
  82. package/dist/components/charts/legend/legend.js +2 -24
  83. package/dist/components/charts/line/line.js +8 -34
  84. package/dist/components/charts/series_label/series_label.js +0 -12
  85. package/dist/components/charts/single_stat/single_stat.js +0 -8
  86. package/dist/components/charts/sparkline/sparkline.js +1 -16
  87. package/dist/components/charts/stacked_column/stacked_column.js +8 -26
  88. package/dist/components/charts/tooltip/tooltip.js +0 -6
  89. package/dist/components/mixins/button_mixin.js +0 -1
  90. package/dist/components/mixins/safe_link_mixin.js +0 -1
  91. package/dist/components/mixins/toolbox_mixin.js +0 -1
  92. package/dist/components/mixins/tooltip_mixin.js +1 -2
  93. package/dist/components/regions/empty_state/empty_state.js +0 -12
  94. package/dist/components/utilities/animated_number/animated_number.js +0 -16
  95. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -3
  96. package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -7
  97. package/dist/components/utilities/intersperse/intersperse.js +3 -9
  98. package/dist/components/utilities/sprintf/sprintf.js +9 -23
  99. package/dist/components/utilities/truncate/truncate.js +0 -10
  100. package/dist/config.js +3 -4
  101. package/dist/directives/hover_load/hover_load.js +2 -8
  102. package/dist/directives/outside/get_event_like_time_stamp.js +4 -2
  103. package/dist/directives/outside/outside.js +5 -20
  104. package/dist/directives/resize_observer/resize_observer.js +0 -10
  105. package/dist/directives/safe_html/safe_html.js +5 -6
  106. package/dist/directives/safe_link/mock_data.js +1 -1
  107. package/dist/directives/safe_link/safe_link.js +0 -13
  108. package/dist/utils/breakpoints.js +0 -3
  109. package/dist/utils/charts/config.js +29 -42
  110. package/dist/utils/charts/constants.js +8 -8
  111. package/dist/utils/charts/mock_data.js +2 -2
  112. package/dist/utils/charts/story_config.js +1 -1
  113. package/dist/utils/charts/theme.js +1 -3
  114. package/dist/utils/charts/utils.js +2 -6
  115. package/dist/utils/constants.js +10 -7
  116. package/dist/utils/data_utils.js +5 -4
  117. package/dist/utils/datetime_utility.js +4 -4
  118. package/dist/utils/number_utils.js +7 -11
  119. package/dist/utils/stories_utils.js +1 -1
  120. package/dist/utils/story_decorators/container.js +0 -1
  121. package/dist/utils/string_utils.js +0 -14
  122. package/dist/utils/test_utils.js +3 -2
  123. package/dist/utils/use_fake_date.js +0 -4
  124. package/dist/utils/use_mock_intersection_observer.js +4 -19
  125. package/dist/utils/utils.js +5 -14
  126. package/package.json +3 -3
  127. package/src/components/base/pagination/pagination.vue +2 -2
  128. package/src/components/base/toast/toast.js +1 -0
@@ -8,9 +8,7 @@ import GlLink from '../link/link';
8
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
9
9
 
10
10
  //
11
-
12
11
  const pageRange = (from, to) => range(from, to + 1, 1);
13
-
14
12
  var script = {
15
13
  name: 'Pagination',
16
14
  components: {
@@ -28,7 +26,6 @@ var script = {
28
26
  default: 1,
29
27
  validator: x => x > 0
30
28
  },
31
-
32
29
  /**
33
30
  * Number of items per page
34
31
  */
@@ -38,7 +35,6 @@ var script = {
38
35
  default: 20,
39
36
  validator: x => x > 0
40
37
  },
41
-
42
38
  /**
43
39
  * Total number of items
44
40
  */
@@ -47,7 +43,6 @@ var script = {
47
43
  required: false,
48
44
  default: 0
49
45
  },
50
-
51
46
  /**
52
47
  * The object must contain the xs, sm, md and default keys
53
48
  */
@@ -65,7 +60,6 @@ var script = {
65
60
  return missingSizes === 0 ? true : value.default;
66
61
  }
67
62
  },
68
-
69
63
  /**
70
64
  * A function that receives the page number and that returns a string representing the page URL
71
65
  */
@@ -74,7 +68,6 @@ var script = {
74
68
  required: false,
75
69
  default: null
76
70
  },
77
-
78
71
  /**
79
72
  * When using the compact pagination, use this prop to pass the previous page number
80
73
  */
@@ -83,7 +76,6 @@ var script = {
83
76
  required: false,
84
77
  default: null
85
78
  },
86
-
87
79
  /**
88
80
  * Text for the previous button (overridden by "previous" slot)
89
81
  */
@@ -92,7 +84,6 @@ var script = {
92
84
  required: false,
93
85
  default: 'Previous'
94
86
  },
95
-
96
87
  /**
97
88
  * When using the compact pagination, use this prop to pass the next page number
98
89
  */
@@ -101,7 +92,6 @@ var script = {
101
92
  required: false,
102
93
  default: null
103
94
  },
104
-
105
95
  /**
106
96
  * Text for the next button (overridden by "next" slot)
107
97
  */
@@ -110,7 +100,6 @@ var script = {
110
100
  required: false,
111
101
  default: 'Next'
112
102
  },
113
-
114
103
  /**
115
104
  * Text for the ellipsis (overridden by "ellipsis-left" and "ellipsis-right" slots)
116
105
  */
@@ -119,7 +108,6 @@ var script = {
119
108
  required: false,
120
109
  default: '…'
121
110
  },
122
-
123
111
  /**
124
112
  * aria-label for the first page item
125
113
  */
@@ -128,7 +116,6 @@ var script = {
128
116
  required: false,
129
117
  default: 'Go to first page'
130
118
  },
131
-
132
119
  /**
133
120
  * aria-label for the previous page item
134
121
  */
@@ -137,7 +124,6 @@ var script = {
137
124
  required: false,
138
125
  default: 'Go to previous page'
139
126
  },
140
-
141
127
  /**
142
128
  * aria-label for the next page item
143
129
  */
@@ -146,7 +132,6 @@ var script = {
146
132
  required: false,
147
133
  default: 'Go to next page'
148
134
  },
149
-
150
135
  /**
151
136
  * aria-label for the last page item
152
137
  */
@@ -155,7 +140,6 @@ var script = {
155
140
  required: false,
156
141
  default: 'Go to last page'
157
142
  },
158
-
159
143
  /**
160
144
  * aria-label getter for numbered page items, defaults to "Go to page <page_number>"
161
145
  */
@@ -164,7 +148,6 @@ var script = {
164
148
  required: false,
165
149
  default: page => `Go to page ${page}`
166
150
  },
167
-
168
151
  /**
169
152
  * Controls the component\'s horizontal alignment, value should be one of "left", "center", "right" or "fill"
170
153
  */
@@ -180,7 +163,6 @@ var script = {
180
163
  default: false
181
164
  }
182
165
  },
183
-
184
166
  data() {
185
167
  return {
186
168
  breakpoint: Breakpoints.getBreakpointSize(),
@@ -188,138 +170,109 @@ var script = {
188
170
  minTotalPagesToCollapse: 4
189
171
  };
190
172
  },
191
-
192
173
  computed: {
193
174
  isVisible() {
194
175
  return this.totalPages > 1 || this.isCompactPagination;
195
176
  },
196
-
197
177
  isLinkBased() {
198
178
  return isFunction(this.linkGen);
199
179
  },
200
-
201
180
  paginationLimit() {
202
181
  return typeof this.limits[this.breakpoint] !== 'undefined' ? this.limits[this.breakpoint] : this.limits.default;
203
182
  },
204
-
205
183
  maxAdjacentPages() {
206
184
  return Math.max(Math.ceil((this.paginationLimit - 1) / 2), 0);
207
185
  },
208
-
209
186
  totalPages() {
210
187
  return Math.ceil(this.totalItems / this.perPage);
211
188
  },
212
-
213
189
  isFillAlign() {
214
190
  return this.align === alignOptions.fill;
215
191
  },
216
-
217
192
  wrapperClasses() {
218
193
  const classes = [];
219
-
220
194
  if (this.align === alignOptions.center) {
221
195
  classes.push('justify-content-center');
222
196
  }
223
-
224
197
  if (this.align === alignOptions.right) {
225
198
  classes.push('justify-content-end');
226
199
  }
227
-
228
200
  if (this.isFillAlign) {
229
201
  classes.push('text-center');
230
202
  }
231
-
232
203
  return classes;
233
204
  },
234
-
235
205
  shouldCollapseLeftSide() {
236
- const diff = this.value - this.maxAdjacentPages; // Magic 3: prevents collapsing a single page on the left side
206
+ const diff = this.value - this.maxAdjacentPages;
237
207
 
208
+ // Magic 3: prevents collapsing a single page on the left side
238
209
  return diff >= this.maxAdjacentPages && diff > 3 && this.totalPages > this.minTotalPagesToCollapse;
239
210
  },
240
-
241
211
  shouldCollapseRightSide() {
242
212
  // Magic 2: prevents collapsing a single page on the right side
243
213
  const diff = this.totalPages - 2 - this.value;
244
214
  return diff > this.maxAdjacentPages && this.totalPages > this.minTotalPagesToCollapse;
245
215
  },
246
-
247
216
  visibleItems() {
248
217
  let items = [];
249
-
250
218
  if (!this.isCompactPagination) {
251
- let firstPage = this.shouldCollapseLeftSide ? this.value - this.maxAdjacentPages : 1; // If we're on last page, show at least one page to the left
252
-
219
+ let firstPage = this.shouldCollapseLeftSide ? this.value - this.maxAdjacentPages : 1;
220
+ // If we're on last page, show at least one page to the left
253
221
  firstPage = Math.min(firstPage, this.totalPages - 1);
254
- let lastPage = this.shouldCollapseRightSide ? this.value + this.maxAdjacentPages : this.totalPages; // If we're on first page, show at least one page to the right
255
-
256
- lastPage = Math.max(lastPage, 2); // Default numbered items
222
+ let lastPage = this.shouldCollapseRightSide ? this.value + this.maxAdjacentPages : this.totalPages;
223
+ // If we're on first page, show at least one page to the right
224
+ lastPage = Math.max(lastPage, 2);
257
225
 
226
+ // Default numbered items
258
227
  items = pageRange(firstPage, lastPage).map(page => this.getPageItem(page));
259
-
260
228
  if (this.shouldCollapseLeftSide) {
261
229
  items.splice(0, 0, this.getPageItem(1, this.labelFirstPage), this.getEllipsisItem('left'));
262
230
  }
263
-
264
231
  if (this.shouldCollapseRightSide) {
265
232
  items.push(this.getEllipsisItem('right'), this.getPageItem(this.totalPages, this.labelLastPage));
266
233
  }
267
234
  }
268
-
269
235
  return items;
270
236
  },
271
-
272
237
  isCompactPagination() {
273
238
  return Boolean(!this.totalItems && (this.prevPage || this.nextPage));
274
239
  },
275
-
276
240
  prevPageIsDisabled() {
277
241
  return this.pageIsDisabled(this.value - 1);
278
242
  },
279
-
280
243
  nextPageIsDisabled() {
281
244
  return this.pageIsDisabled(this.value + 1);
282
245
  },
283
-
284
246
  prevPageAriaLabel() {
285
247
  return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelPage(this.value - 1);
286
248
  },
287
-
288
249
  nextPageAriaLabel() {
289
250
  return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelPage(this.value + 1);
290
251
  },
291
-
292
252
  prevPageHref() {
293
253
  if (this.prevPageIsDisabled) return false;
294
254
  if (this.isLinkBased) return this.linkGen(this.value - 1);
295
255
  return '#';
296
256
  },
297
-
298
257
  nextPageHref() {
299
258
  if (this.nextPageIsDisabled) return false;
300
259
  if (this.isLinkBased) return this.linkGen(this.value + 1);
301
260
  return '#';
302
261
  }
303
-
304
262
  },
305
-
306
263
  created() {
307
264
  window.addEventListener('resize', debounce(this.setBreakpoint, resizeDebounceTime));
308
265
  },
309
-
310
266
  beforeDestroy() {
311
267
  window.removeEventListener('resize', debounce(this.setBreakpoint, resizeDebounceTime));
312
268
  },
313
-
314
269
  methods: {
315
270
  setBreakpoint() {
316
271
  this.breakpoint = Breakpoints.getBreakpointSize();
317
272
  },
318
-
319
273
  pageIsDisabled(page) {
320
274
  return this.disabled || page < 1 || this.isCompactPagination && page > this.value && !this.nextPage || !this.isCompactPagination && page > this.totalPages;
321
275
  },
322
-
323
276
  getPageItem(page) {
324
277
  let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
325
278
  const commonAttrs = {
@@ -329,22 +282,19 @@ var script = {
329
282
  };
330
283
  const isActivePage = page === this.value;
331
284
  const isDisabled = this.pageIsDisabled(page);
332
- const attrs = { ...commonAttrs
285
+ const attrs = {
286
+ ...commonAttrs
333
287
  };
334
288
  const listeners = {};
335
-
336
289
  if (isActivePage) {
337
290
  attrs.class.push('active');
338
291
  attrs['aria-current'] = 'page';
339
- } // Disable previous and/or next buttons if needed
340
-
341
-
292
+ }
293
+ // Disable previous and/or next buttons if needed
342
294
  if (this.isLinkBased) {
343
295
  attrs.href = this.linkGen(page);
344
296
  }
345
-
346
297
  listeners.click = e => this.handleClick(e, page);
347
-
348
298
  return {
349
299
  content: page,
350
300
  component: isDisabled ? 'span' : GlLink,
@@ -360,7 +310,6 @@ var script = {
360
310
  listeners
361
311
  };
362
312
  },
363
-
364
313
  getEllipsisItem(side) {
365
314
  return {
366
315
  content: this.ellipsisText,
@@ -372,7 +321,6 @@ var script = {
372
321
  listeners: {}
373
322
  };
374
323
  },
375
-
376
324
  handleClick(event, value) {
377
325
  if (!this.isLinkBased) {
378
326
  event.preventDefault();
@@ -381,31 +329,25 @@ var script = {
381
329
  * @event input
382
330
  * @arg {number} value The page that just got loaded
383
331
  */
384
-
385
332
  this.$emit('input', value);
386
333
  }
387
334
  },
388
-
389
335
  handlePrevious(event, value) {
390
336
  this.handleClick(event, value);
391
337
  /**
392
338
  * Emitted when the "previous" button is clicked
393
339
  * @event previous
394
340
  */
395
-
396
341
  this.$emit('previous');
397
342
  },
398
-
399
343
  handleNext(event, value) {
400
344
  this.handleClick(event, value);
401
345
  /**
402
346
  * Emitted when the "next" button is clicked
403
347
  * @event next
404
348
  */
405
-
406
349
  this.$emit('next');
407
350
  }
408
-
409
351
  }
410
352
  };
411
353
 
@@ -413,7 +355,7 @@ var script = {
413
355
  const __vue_script__ = script;
414
356
 
415
357
  /* template */
416
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{attrs:{"aria-label":"Pagination"}},[(_vm.isVisible)?_c('ul',{staticClass:"pagination gl-pagination text-nowrap",class:_vm.wrapperClasses},[_c('li',{staticClass:"page-item",class:{
358
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.isVisible)?_c('nav',{staticClass:"gl-pagination text-nowrap",attrs:{"aria-label":"Pagination"}},[_c('ul',{staticClass:"pagination",class:_vm.wrapperClasses},[_c('li',{staticClass:"page-item",class:{
417
359
  disabled: _vm.prevPageIsDisabled,
418
360
  'flex-fill': _vm.isFillAlign,
419
361
  },attrs:{"aria-hidden":_vm.prevPageIsDisabled}},[_c(_vm.prevPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link prev-page-item gl-display-flex",attrs:{"aria-label":_vm.prevPageAriaLabel,"href":_vm.prevPageHref},on:{"click":function($event){return _vm.handlePrevious($event, _vm.value - 1)}}},[_vm._t("previous",function(){return [_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.prevText))])]},null,{ page: _vm.value - 1, disabled: _vm.prevPageIsDisabled })],2)],1),_vm._v(" "),_vm._l((_vm.visibleItems),function(item){return _c('li',{key:item.key,staticClass:"page-item",class:{
@@ -422,7 +364,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
422
364
  }},[_c(item.component,_vm._g(_vm._b({tag:"component",staticClass:"page-link",attrs:{"size":"md","aria-disabled":item.disabled}},'component',item.attrs,false),item.listeners),[_vm._t(item.slot,function(){return [_vm._v(_vm._s(item.content))]},null,item.slotData)],2)],1)}),_vm._v(" "),_c('li',{staticClass:"page-item",class:{
423
365
  disabled: _vm.nextPageIsDisabled,
424
366
  'flex-fill': _vm.isFillAlign,
425
- },attrs:{"aria-hidden":_vm.nextPageIsDisabled}},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-label":_vm.nextPageAriaLabel,"href":_vm.nextPageHref},on:{"click":function($event){return _vm.handleNext($event, _vm.value + 1)}}},[_vm._t("next",function(){return [_c('span',[_vm._v(_vm._s(_vm.nextText))]),_vm._v(" "),_c('gl-icon',{attrs:{"name":"chevron-right"}})]},null,{ page: _vm.value + 1, disabled: _vm.nextPageIsDisabled })],2)],1)],2):_vm._e()])};
367
+ },attrs:{"aria-hidden":_vm.nextPageIsDisabled}},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-label":_vm.nextPageAriaLabel,"href":_vm.nextPageHref},on:{"click":function($event){return _vm.handleNext($event, _vm.value + 1)}}},[_vm._t("next",function(){return [_c('span',[_vm._v(_vm._s(_vm.nextText))]),_vm._v(" "),_c('gl-icon',{attrs:{"name":"chevron-right"}})]},null,{ page: _vm.value + 1, disabled: _vm.nextPageIsDisabled })],2)],1)],2)]):_vm._e()};
426
368
  var __vue_staticRenderFns__ = [];
427
369
 
428
370
  /* style */
@@ -33,7 +33,6 @@ var script = {
33
33
  required: false,
34
34
  default: () => []
35
35
  },
36
-
37
36
  /**
38
37
  * The color theme to be used.
39
38
  */
@@ -43,7 +42,6 @@ var script = {
43
42
  default: 'indigo',
44
43
  validator: theme => glThemes.includes(theme)
45
44
  },
46
-
47
45
  /**
48
46
  * The items' background color.
49
47
  */
@@ -53,7 +51,6 @@ var script = {
53
51
  default: 'white'
54
52
  }
55
53
  },
56
-
57
54
  data() {
58
55
  return {
59
56
  selectedIndex: 0,
@@ -61,64 +58,50 @@ var script = {
61
58
  scrollLeft: 0
62
59
  };
63
60
  },
64
-
65
61
  computed: {
66
62
  activeClass() {
67
63
  return `${PATH_ACTIVE_ITEM_PREFIX}-${this.theme}`;
68
64
  },
69
-
70
65
  entireListVisible() {
71
66
  return this.width >= this.getScrollWidth();
72
67
  },
73
-
74
68
  displayScrollLeft() {
75
69
  return !this.entireListVisible && this.scrollLeft;
76
70
  },
77
-
78
71
  displayScrollRight() {
79
72
  const scrollOffset = this.getScrollWidth() - this.width;
80
73
  return !this.entireListVisible && scrollOffset !== this.scrollLeft;
81
74
  },
82
-
83
75
  rightHandBoundary() {
84
76
  return this.width - BOUNDARY_WIDTH + this.scrollLeft;
85
77
  },
86
-
87
78
  leftHandBoundary() {
88
79
  return this.scrollLeft + BOUNDARY_WIDTH;
89
80
  }
90
-
91
81
  },
92
82
  watch: {
93
83
  items: {
94
84
  immediate: true,
95
-
96
85
  handler(items) {
97
86
  const selectedIndex = items.findIndex(item => item.selected);
98
87
  this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
99
88
  }
100
-
101
89
  }
102
90
  },
103
-
104
91
  beforeCreate() {
105
92
  this.pathUuid = _uniqueId('path-');
106
93
  },
107
-
108
94
  methods: {
109
95
  pathItemClass(index) {
110
96
  return index === this.selectedIndex ? `${PATH_ITEM_CLASS} ${this.activeClass}` : PATH_ITEM_CLASS;
111
97
  },
112
-
113
98
  onItemClicked(selectedIndex) {
114
99
  this.selectedIndex = selectedIndex;
115
100
  /**
116
101
  * Emitted when an item is selected.
117
102
  */
118
-
119
103
  this.$emit('selected', this.items[this.selectedIndex]);
120
104
  },
121
-
122
105
  handleResize(_ref) {
123
106
  let {
124
107
  contentRect: {
@@ -127,33 +110,25 @@ var script = {
127
110
  } = _ref;
128
111
  this.width = width;
129
112
  },
130
-
131
113
  scrollPathLeft() {
132
114
  const previousItemToScollTo = _findLast(this.$refs.pathListItems, listItem => {
133
115
  return listItem.offsetLeft < this.leftHandBoundary;
134
116
  });
135
-
136
117
  const availableWidth = this.width - previousItemToScollTo.offsetWidth - BOUNDARY_WIDTH - BOUNDARY_WIDTH;
137
118
  let scrollTo = previousItemToScollTo.offsetLeft - BOUNDARY_WIDTH - availableWidth;
138
-
139
119
  if (scrollTo < 0) {
140
120
  scrollTo = 0;
141
121
  }
142
-
143
122
  this.scrollPath(scrollTo);
144
123
  },
145
-
146
124
  scrollPathRight() {
147
125
  const nextItemToScollTo = this.$refs.pathListItems.find(listItem => listItem.offsetLeft + listItem.offsetWidth > this.rightHandBoundary);
148
126
  let scrollTo = nextItemToScollTo.offsetLeft - BOUNDARY_WIDTH;
149
-
150
127
  if (scrollTo > this.getScrollWidth() - this.width) {
151
128
  scrollTo = this.getScrollWidth() - this.width;
152
129
  }
153
-
154
130
  this.scrollPath(scrollTo);
155
131
  },
156
-
157
132
  scrollPath(scrollTo) {
158
133
  this.$refs.pathNavList.scrollTo({
159
134
  left: scrollTo,
@@ -161,19 +136,15 @@ var script = {
161
136
  });
162
137
  this.scrollLeft = scrollTo;
163
138
  },
164
-
165
139
  getScrollWidth() {
166
140
  return this.$refs.pathNavList ? this.$refs.pathNavList.scrollWidth : 0;
167
141
  },
168
-
169
142
  shouldDisplayIcon(icon) {
170
143
  return icon && iconSpriteInfo.icons.includes(icon);
171
144
  },
172
-
173
145
  pathId(index) {
174
146
  return `${this.pathUuid}-item-${index}`;
175
147
  }
176
-
177
148
  }
178
149
  };
179
150
 
@@ -19,7 +19,6 @@ var script = {
19
19
  required: false,
20
20
  default: () => []
21
21
  },
22
-
23
22
  /**
24
23
  * Space-separated triggers for the popover.
25
24
  *
@@ -50,11 +49,9 @@ var script = {
50
49
  customClass() {
51
50
  return ['gl-popover', ...this.cssClasses].join(' ');
52
51
  },
53
-
54
52
  shouldShowTitle() {
55
53
  return this.$scopedSlots.title || this.title || this.showCloseButton;
56
54
  }
57
-
58
55
  },
59
56
  methods: {
60
57
  close(e) {
@@ -62,10 +59,8 @@ var script = {
62
59
  /**
63
60
  * Emitted when the close button is clicked (requires showCloseButton to be `true`).
64
61
  */
65
-
66
62
  this.$emit('close-button-clicked', e);
67
63
  }
68
-
69
64
  },
70
65
  popoverRefName
71
66
  };
@@ -36,7 +36,6 @@ var script = {
36
36
  // so we should not force any specific type for value here
37
37
  validator: () => true
38
38
  },
39
-
40
39
  /**
41
40
  * If provided, used as history items for this component
42
41
  */
@@ -45,7 +44,6 @@ var script = {
45
44
  required: false,
46
45
  default: null
47
46
  },
48
-
49
47
  /**
50
48
  * If provided, used as a placeholder for this component
51
49
  */
@@ -59,7 +57,6 @@ var script = {
59
57
  required: false,
60
58
  default: true
61
59
  },
62
-
63
60
  /**
64
61
  * If provided and true, disables the input and controls
65
62
  */
@@ -68,7 +65,6 @@ var script = {
68
65
  required: false,
69
66
  default: false
70
67
  },
71
-
72
68
  /**
73
69
  * i18n for recent searches title within history dropdown
74
70
  */
@@ -77,7 +73,6 @@ var script = {
77
73
  required: false,
78
74
  default: 'Recent searches'
79
75
  },
80
-
81
76
  /**
82
77
  * i18n for clear button title
83
78
  */
@@ -86,7 +81,6 @@ var script = {
86
81
  required: false,
87
82
  default: 'Clear'
88
83
  },
89
-
90
84
  /**
91
85
  * i18n for close button title within history dropdown
92
86
  */
@@ -95,7 +89,6 @@ var script = {
95
89
  required: false,
96
90
  default: 'Close'
97
91
  },
98
-
99
92
  /**
100
93
  * i18n for recent searches clear text
101
94
  */
@@ -109,7 +102,6 @@ var script = {
109
102
  required: false,
110
103
  default: "You don't have any recent searches"
111
104
  },
112
-
113
105
  /**
114
106
  * Container for tooltip. Valid values: DOM node, selector string or `false` for default
115
107
  */
@@ -118,7 +110,6 @@ var script = {
118
110
  default: false,
119
111
  validator: value => value === false || typeof value === 'string' || value instanceof HTMLElement
120
112
  },
121
-
122
113
  /**
123
114
  * HTML attributes to add to the search button
124
115
  */
@@ -128,14 +119,12 @@ var script = {
128
119
  default: () => ({})
129
120
  }
130
121
  },
131
-
132
122
  data() {
133
123
  return {
134
124
  currentValue: null,
135
125
  isFocused: false
136
126
  };
137
127
  },
138
-
139
128
  computed: {
140
129
  inputAttributes() {
141
130
  const attributes = {
@@ -143,39 +132,31 @@ var script = {
143
132
  placeholder: this.placeholder,
144
133
  ...this.$attrs
145
134
  };
146
-
147
135
  if (!attributes['aria-label']) {
148
136
  attributes['aria-label'] = attributes.placeholder;
149
137
  }
150
-
151
138
  return attributes;
152
139
  },
153
-
154
140
  hasValue() {
155
141
  return Boolean(this.currentValue);
156
142
  }
157
-
158
143
  },
159
144
  watch: {
160
145
  value: {
161
146
  handler(newValue) {
162
147
  this.currentValue = newValue;
163
148
  },
164
-
165
149
  immediate: true
166
150
  },
167
-
168
151
  currentValue(newValue) {
169
152
  if (newValue === this.value) return;
170
153
  this.$emit('input', newValue);
171
154
  }
172
-
173
155
  },
174
156
  methods: {
175
157
  closeHistoryDropdown() {
176
158
  this.$refs.historyDropdown.hide();
177
159
  },
178
-
179
160
  search(value) {
180
161
  /**
181
162
  * Emitted when search is submitted
@@ -183,40 +164,34 @@ var script = {
183
164
  */
184
165
  this.$emit('submit', value);
185
166
  },
186
-
187
167
  selectHistoryItem(item) {
188
168
  this.currentValue = item;
169
+
189
170
  /**
190
171
  * Emitted when item from history is selected
191
172
  * @property {*} item History item
192
173
  */
193
-
194
174
  this.$emit('history-item-selected', item);
195
175
  setTimeout(() => {
196
176
  document.activeElement.blur();
197
177
  });
198
178
  },
199
-
200
179
  clearInput() {
201
180
  this.currentValue = '';
202
181
  /**
203
182
  * Emitted when search is cleared
204
183
  */
205
-
206
184
  this.$emit('clear');
207
-
208
185
  if (this.$refs.input) {
209
186
  this.$refs.input.$el.focus();
210
187
  }
211
188
  },
212
-
213
189
  emitClearHistory() {
214
190
  /**
215
191
  * Emitted when clear history button is clicked
216
192
  */
217
193
  this.$emit('clear-history');
218
194
  }
219
-
220
195
  }
221
196
  };
222
197