@gitlab/ui 49.0.0 → 49.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 (131) 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 +14 -34
  49. package/dist/components/base/new_dropdowns/constants.js +4 -2
  50. package/dist/components/base/new_dropdowns/listbox/listbox.js +14 -81
  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 +3 -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/new_dropdowns/base_dropdown/base_dropdown.spec.js +1 -0
  128. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +13 -7
  129. package/src/components/base/new_dropdowns/listbox/listbox.spec.js +13 -7
  130. package/src/components/base/new_dropdowns/listbox/listbox.vue +12 -16
  131. package/src/components/base/pagination/pagination.vue +2 -2
@@ -4,9 +4,7 @@ import GlButton from '../../button/button';
4
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
5
 
6
6
  //
7
-
8
7
  const validatorHelper = obj => Object.keys(obj).every(val => val === 'text' || val === 'attributes');
9
-
10
8
  var script = {
11
9
  components: {
12
10
  BTabs,
@@ -47,7 +45,6 @@ var script = {
47
45
  required: false,
48
46
  default: false
49
47
  },
50
-
51
48
  /**
52
49
  * Sync active tab with query string parameters. Allows for deep linking into specific tabs.
53
50
  */
@@ -56,7 +53,6 @@ var script = {
56
53
  required: false,
57
54
  default: false
58
55
  },
59
-
60
56
  /**
61
57
  * Name to use for query string parameter.
62
58
  */
@@ -71,24 +67,21 @@ var script = {
71
67
  default: 0
72
68
  }
73
69
  },
74
-
75
70
  data() {
76
71
  return {
77
72
  activeTabIndex: 0
78
73
  };
79
74
  },
80
-
81
75
  computed: {
82
76
  hasActions() {
83
77
  return [this.actionPrimary, this.actionSecondary, this.actionTertiary].some(Boolean);
84
78
  },
85
-
86
79
  listeners() {
87
- return { ...this.$listeners,
80
+ return {
81
+ ...this.$listeners,
88
82
  input: this.handleInput
89
83
  };
90
84
  }
91
-
92
85
  },
93
86
  watch: {
94
87
  value: {
@@ -97,49 +90,40 @@ var script = {
97
90
  this.activeTabIndex = newValue;
98
91
  }
99
92
  },
100
-
101
93
  immediate: true
102
94
  }
103
95
  },
104
-
105
96
  mounted() {
106
97
  if (this.syncActiveTabWithQueryParams) {
107
98
  this.syncActiveTabFromQueryParams();
108
99
  window.addEventListener('popstate', this.syncActiveTabFromQueryParams);
109
- } // Because we are manually binding `value` attribute to `b-tabs` the `input`
100
+ }
101
+
102
+ // Because we are manually binding `value` attribute to `b-tabs` the `input`
110
103
  // event is no longer automatically fired when the component is mounted.
111
104
  // To maintain parity with original `b-tabs` functionality
112
105
  // we manually fire the `input` event when the component is mounted.
113
-
114
-
115
106
  this.$emit('input', this.activeTabIndex);
116
107
  },
117
-
118
108
  destroyed() {
119
109
  window.removeEventListener('popstate', this.syncActiveTabFromQueryParams);
120
110
  },
121
-
122
111
  methods: {
123
112
  buttonBinding(prop, name) {
124
113
  if (!prop.attributes) {
125
114
  return tabsButtonDefaults[name];
126
115
  }
127
-
128
116
  return prop.attributes;
129
117
  },
130
-
131
118
  primary() {
132
119
  this.$emit('primary');
133
120
  },
134
-
135
121
  secondary() {
136
122
  this.$emit('secondary');
137
123
  },
138
-
139
124
  tertiary() {
140
125
  this.$emit('tertiary');
141
126
  },
142
-
143
127
  /**
144
128
  * When the query parameter is updated, update the active tab to match.
145
129
  */
@@ -148,14 +132,12 @@ var script = {
148
132
  const tabIndexToActivate = this.getTabs().findIndex((tab, tabIndex) => this.getTabQueryParamValue(tabIndex) === queryParamValue);
149
133
  this.activeTabIndex = tabIndexToActivate !== -1 ? tabIndexToActivate : 0;
150
134
  },
151
-
152
135
  /**
153
136
  * Returns a list of all <b-tab> instances associated with this tab control.
154
137
  */
155
138
  getTabs() {
156
139
  return this.$refs.bTabs.getTabs();
157
140
  },
158
-
159
141
  /**
160
142
  * Get the value of the query param as defined by the `queryParamName` prop.
161
143
  */
@@ -163,31 +145,27 @@ var script = {
163
145
  const searchParams = new URLSearchParams(window.location.search);
164
146
  return searchParams.get(this.queryParamName);
165
147
  },
166
-
167
148
  /**
168
149
  * Set the value of the query param as defined by the `queryParamName` prop.
169
150
  * This method does nothing if the query param is already up to date.
170
151
  */
171
152
  setQueryParamValueIfNecessary(tabIndex) {
172
153
  const currentQueryParamValue = this.getQueryParamValue();
173
- const newQueryParamValue = this.getTabQueryParamValue(tabIndex); // If the current query parameter is already up-to-date,
174
- // avoid creating a duplicate history entry.
154
+ const newQueryParamValue = this.getTabQueryParamValue(tabIndex);
175
155
 
156
+ // If the current query parameter is already up-to-date,
157
+ // avoid creating a duplicate history entry.
176
158
  if (tabIndex === 0 && !currentQueryParamValue || tabIndex !== 0 && currentQueryParamValue === newQueryParamValue) {
177
159
  return;
178
160
  }
179
-
180
161
  const searchParams = new URLSearchParams(window.location.search);
181
-
182
162
  if (tabIndex === 0) {
183
163
  searchParams.delete(this.queryParamName);
184
164
  } else {
185
165
  searchParams.set(this.queryParamName, newQueryParamValue);
186
166
  }
187
-
188
167
  window.history.pushState({}, '', `${window.location.pathname}?${searchParams.toString()}`);
189
168
  },
190
-
191
169
  /**
192
170
  * Returns the query param value for a tab.
193
171
  * Defaults to the tab index unless the `query-param-value` attribute is set.
@@ -196,19 +174,16 @@ var script = {
196
174
  const tab = this.getTabs()[tabIndex];
197
175
  return (tab === null || tab === void 0 ? void 0 : tab.$attrs['query-param-value']) || tabIndex.toString();
198
176
  },
199
-
200
177
  /**
201
178
  * Event handler for `input` event.
202
179
  */
203
180
  handleInput(tabIndex) {
204
181
  this.$emit('input', tabIndex);
205
182
  this.activeTabIndex = tabIndex;
206
-
207
183
  if (this.syncActiveTabWithQueryParams) {
208
184
  this.setQueryParamValueIfNecessary(tabIndex);
209
185
  }
210
186
  }
211
-
212
187
  }
213
188
  };
214
189
 
@@ -9,7 +9,6 @@ const DEFAULT_OPTIONS = {
9
9
  toaster: 'b-toaster-bottom-left'
10
10
  };
11
11
  let toastsCount = 0;
12
-
13
12
  function renderTitle(h, toast, options) {
14
13
  const nodes = [h(CloseButton, {
15
14
  class: ['gl-toast-close-button', 'gl-close-btn-color-inherit'],
@@ -17,7 +16,6 @@ function renderTitle(h, toast, options) {
17
16
  click: toast.hide
18
17
  }
19
18
  })];
20
-
21
19
  if (options.action) {
22
20
  nodes.splice(0, 0, h('a', {
23
21
  role: 'button',
@@ -27,24 +25,19 @@ function renderTitle(h, toast, options) {
27
25
  }
28
26
  }, options.action.text));
29
27
  }
30
-
31
28
  return nodes;
32
29
  }
33
-
34
30
  function showToast(message) {
35
31
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
36
32
  const id = `gl-toast-${toastsCount}`;
37
33
  toastsCount += 1;
38
-
39
34
  const hide = () => {
40
35
  this.$bvToast.hide(id);
41
36
  };
42
-
43
37
  const toast = {
44
38
  id,
45
39
  hide
46
40
  };
47
-
48
41
  if (_isFunction(options.onComplete)) {
49
42
  const toastHiddenCallback = e => {
50
43
  if (e.componentId === id) {
@@ -52,24 +45,22 @@ function showToast(message) {
52
45
  options.onComplete(e);
53
46
  }
54
47
  };
55
-
56
48
  this.$root.$on('bv::toast:hidden', toastHiddenCallback);
57
49
  }
58
-
59
- this.$bvToast.toast(message, { ...DEFAULT_OPTIONS,
50
+ this.$bvToast.toast(message, {
51
+ ...DEFAULT_OPTIONS,
60
52
  id,
61
53
  title: renderTitle(this.$createElement, toast, options)
62
54
  });
63
55
  return toast;
64
56
  }
57
+
65
58
  /**
66
59
  * Note: This is not a typical Vue component and needs to be registered before instantiating a Vue app.
67
60
  * Once registered, the toast will be globally available throughout your app.
68
61
  *
69
62
  * See https://gitlab-org.gitlab.io/gitlab-ui/ for detailed documentation.
70
63
  */
71
-
72
-
73
64
  var toast = {
74
65
  install(Vue) {
75
66
  Vue.use(ToastPlugin);
@@ -78,15 +69,12 @@ var toast = {
78
69
  if (this.$toast) {
79
70
  return;
80
71
  }
81
-
82
72
  this.$toast = {
83
73
  show: showToast.bind(this)
84
74
  };
85
75
  }
86
-
87
76
  });
88
77
  }
89
-
90
78
  };
91
79
 
92
80
  export default toast;
@@ -20,7 +20,6 @@ var script = {
20
20
  required: false,
21
21
  default: null
22
22
  },
23
-
24
23
  /**
25
24
  * The toggle's state.
26
25
  * @model
@@ -30,7 +29,6 @@ var script = {
30
29
  required: false,
31
30
  default: null
32
31
  },
33
-
34
32
  /**
35
33
  * Whether the toggle should be disabled.
36
34
  */
@@ -39,7 +37,6 @@ var script = {
39
37
  required: false,
40
38
  default: false
41
39
  },
42
-
43
40
  /**
44
41
  * Whether the toggle is in the loading state.
45
42
  */
@@ -48,7 +45,6 @@ var script = {
48
45
  required: false,
49
46
  default: false
50
47
  },
51
-
52
48
  /**
53
49
  * The toggle's label.
54
50
  */
@@ -56,7 +52,6 @@ var script = {
56
52
  type: String,
57
53
  required: true
58
54
  },
59
-
60
55
  /**
61
56
  * A help text to be shown below the toggle.
62
57
  */
@@ -65,7 +60,6 @@ var script = {
65
60
  required: false,
66
61
  default: undefined
67
62
  },
68
-
69
63
  /**
70
64
  * The label's position relative to the toggle. If 'hidden', the toggle will add the .gl-sr-only class so the label is still accessible to screen readers.
71
65
  */
@@ -73,49 +67,38 @@ var script = {
73
67
  type: String,
74
68
  required: false,
75
69
  default: 'top',
76
-
77
70
  validator(position) {
78
71
  return Object.values(toggleLabelPosition).includes(position);
79
72
  }
80
-
81
73
  }
82
74
  },
83
-
84
75
  data() {
85
76
  return {
86
77
  labelId: _uniqueId('toggle-label-')
87
78
  };
88
79
  },
89
-
90
80
  computed: {
91
81
  shouldRenderHelp() {
92
82
  // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
93
83
  return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
94
84
  },
95
-
96
85
  icon() {
97
86
  return this.value ? 'mobile-issue-close' : 'close';
98
87
  },
99
-
100
88
  helpId() {
101
89
  return this.shouldRenderHelp ? `toggle-help-${this.uuid}` : undefined;
102
90
  },
103
-
104
91
  isChecked() {
105
92
  return this.value ? 'true' : 'false';
106
93
  },
107
-
108
94
  isVerticalLayout() {
109
95
  return this.labelPosition === 'top' || this.labelPosition === 'hidden';
110
96
  }
111
-
112
97
  },
113
-
114
98
  beforeCreate() {
115
99
  this.uuid = uuid;
116
100
  uuid += 1;
117
101
  },
118
-
119
102
  methods: {
120
103
  toggleFeature() {
121
104
  if (!this.disabled) {
@@ -128,7 +111,6 @@ var script = {
128
111
  this.$emit('change', !this.value);
129
112
  }
130
113
  }
131
-
132
114
  }
133
115
  };
134
116
 
@@ -13,7 +13,6 @@ var script = {
13
13
  required: false,
14
14
  default: false
15
15
  },
16
-
17
16
  /**
18
17
  * Token visual variants: default, search-type, and search-value.
19
18
  */
@@ -28,13 +27,11 @@ var script = {
28
27
  variantClass() {
29
28
  return `gl-token-${this.variant}-variant`;
30
29
  },
31
-
32
30
  viewOnlyClass() {
33
31
  return {
34
32
  'gl-token-view-only': this.viewOnly
35
33
  };
36
34
  }
37
-
38
35
  },
39
36
  methods: {
40
37
  close($event) {
@@ -45,7 +42,6 @@ var script = {
45
42
  */
46
43
  this.$emit('close', $event);
47
44
  }
48
-
49
45
  }
50
46
  };
51
47
 
@@ -36,30 +36,24 @@ var script = {
36
36
  default: false
37
37
  }
38
38
  },
39
-
40
39
  data() {
41
40
  return {
42
41
  bindFocusEvent: true,
43
42
  focusedTokenIndex: null
44
43
  };
45
44
  },
46
-
47
45
  computed: {
48
46
  focusedToken() {
49
47
  return this.tokens[this.focusedTokenIndex] || null;
50
48
  }
51
-
52
49
  },
53
50
  watch: {
54
51
  focusedToken(newValue) {
55
52
  var _this$$refs$tokens;
56
-
57
53
  if (newValue === null) {
58
54
  return;
59
55
  }
60
-
61
56
  const tokenRef = (_this$$refs$tokens = this.$refs.tokens) === null || _this$$refs$tokens === void 0 ? void 0 : _this$$refs$tokens.find(ref => ref.dataset.tokenId === newValue.id.toString());
62
-
63
57
  if (tokenRef) {
64
58
  // Prevent `handleTokenFocus` from being called when we manually focus on a token
65
59
  this.bindFocusEvent = false;
@@ -67,19 +61,15 @@ var script = {
67
61
  this.bindFocusEvent = true;
68
62
  }
69
63
  }
70
-
71
64
  },
72
-
73
65
  created() {
74
66
  this.registerFocusOnToken(this.focusOnToken);
75
67
  },
76
-
77
68
  methods: {
78
69
  handleClose(token) {
79
70
  this.$emit('token-remove', token);
80
71
  this.focusedTokenIndex = null;
81
72
  },
82
-
83
73
  handleLeftArrow() {
84
74
  if (this.focusedTokenIndex === 0) {
85
75
  this.focusLastToken();
@@ -87,7 +77,6 @@ var script = {
87
77
  this.focusPrevToken();
88
78
  }
89
79
  },
90
-
91
80
  handleRightArrow() {
92
81
  if (this.focusedTokenIndex === this.tokens.length - 1) {
93
82
  this.focusFirstToken();
@@ -95,58 +84,45 @@ var script = {
95
84
  this.focusNextToken();
96
85
  }
97
86
  },
98
-
99
87
  handleHome() {
100
88
  this.focusFirstToken();
101
89
  },
102
-
103
90
  handleEnd() {
104
91
  this.focusLastToken();
105
92
  },
106
-
107
93
  handleDelete() {
108
94
  this.$emit('token-remove', this.focusedToken);
109
-
110
95
  if (this.focusedTokenIndex > 0) {
111
96
  this.focusPrevToken();
112
97
  }
113
98
  },
114
-
115
99
  handleEscape() {
116
100
  this.focusedTokenIndex = null;
117
101
  this.$emit('cancel-focus');
118
102
  },
119
-
120
103
  handleTab() {
121
104
  this.$emit('cancel-focus');
122
105
  },
123
-
124
106
  // Only called when a token is focused by a click/tap
125
107
  handleTokenFocus(index) {
126
108
  this.focusedTokenIndex = index;
127
109
  },
128
-
129
110
  focusLastToken() {
130
111
  this.focusedTokenIndex = this.tokens.length - 1;
131
112
  },
132
-
133
113
  focusFirstToken() {
134
114
  this.focusedTokenIndex = 0;
135
115
  },
136
-
137
116
  focusNextToken() {
138
117
  this.focusedTokenIndex += 1;
139
118
  },
140
-
141
119
  focusPrevToken() {
142
120
  this.focusedTokenIndex -= 1;
143
121
  },
144
-
145
122
  focusOnToken() {
146
123
  let tokenIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
147
124
  this.focusedTokenIndex = tokenIndex;
148
125
  }
149
-
150
126
  }
151
127
  };
152
128