@gitlab/ui 111.8.0 → 111.9.0

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 (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/base/breadcrumb/breadcrumb.js +1 -1
  3. package/dist/components/base/daterange_picker/daterange_picker.js +1 -1
  4. package/dist/components/base/filtered_search/filtered_search.js +1 -1
  5. package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -1
  6. package/dist/components/base/sorting/sorting.js +1 -1
  7. package/dist/components/base/tooltip/tooltip.js +4 -2
  8. package/dist/components/charts/area/area.js +15 -13
  9. package/dist/components/charts/line/line.js +15 -8
  10. package/dist/components/charts/stacked_column/stacked_column.js +18 -8
  11. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +1 -1
  12. package/dist/components/utilities/truncate/truncate.js +1 -1
  13. package/dist/directives/tooltip/container.js +7 -0
  14. package/dist/directives/tooltip/tooltip.js +18 -0
  15. package/dist/index.js +2 -1
  16. package/dist/tokens/tokens_story.js +1 -1
  17. package/dist/tokens/tokens_table.js +1 -1
  18. package/dist/utils/charts/config.js +4 -0
  19. package/package.json +1 -1
  20. package/src/components/base/breadcrumb/breadcrumb.vue +1 -1
  21. package/src/components/base/daterange_picker/daterange_picker.vue +1 -1
  22. package/src/components/base/filtered_search/filtered_search.vue +1 -1
  23. package/src/components/base/search_box_by_click/search_box_by_click.vue +1 -1
  24. package/src/components/base/sorting/sorting.vue +1 -1
  25. package/src/components/base/tooltip/tooltip.vue +3 -0
  26. package/src/components/charts/area/area.vue +17 -13
  27. package/src/components/charts/line/line.vue +17 -8
  28. package/src/components/charts/stacked_column/stacked_column.vue +48 -36
  29. package/src/components/shared_components/clear_icon_button/clear_icon_button.vue +1 -1
  30. package/src/components/utilities/truncate/truncate.vue +1 -1
  31. package/src/directives/tooltip/container.js +7 -0
  32. package/src/directives/tooltip/tooltip.js +22 -0
  33. package/src/index.js +2 -1
  34. package/src/tokens/tokens_story.vue +1 -1
  35. package/src/tokens/tokens_table.vue +1 -1
  36. package/src/utils/charts/config.js +3 -0
  37. package/dist/directives/tooltip.js +0 -1
  38. package/src/directives/tooltip.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [111.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.8.1...v111.9.0) (2025-03-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlTooltip:** add custom global container selector ([691e2b0](https://gitlab.com/gitlab-org/gitlab-ui/commit/691e2b0a7dda4135f2c8b0a665952edb51ec046e))
7
+
8
+ ## [111.8.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.8.0...v111.8.1) (2025-03-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **GlLineChart, GlAreaChart, GlStackedColumn:** Fix tooltip updates ([7ac5e58](https://gitlab.com/gitlab-org/gitlab-ui/commit/7ac5e589838ad720e2767fb986b628b026467745))
14
+
1
15
  # [111.8.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.7.1...v111.8.0) (2025-03-26)
2
16
 
3
17
 
@@ -2,7 +2,7 @@ import debounce from 'lodash/debounce';
2
2
  import { translate } from '../../../utils/i18n';
3
3
  import GlAvatar from '../avatar/avatar';
4
4
  import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown';
5
- import { GlTooltipDirective } from '../../../directives/tooltip';
5
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
6
6
  import { breadCrumbSizeOptions } from '../../../utils/constants';
7
7
  import GlBreadcrumbItem from './breadcrumb_item';
8
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -1,5 +1,5 @@
1
1
  import uniqueId from 'lodash/uniqueId';
2
- import { GlTooltipDirective } from '../../../directives/tooltip';
2
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
3
3
  import { getDateInPast, getDateInFuture, getDayDifference } from '../../../utils/datetime_utility';
4
4
  import GlDatepicker from '../datepicker/datepicker';
5
5
  import GlIcon from '../icon/icon';
@@ -1,7 +1,7 @@
1
1
  import isEqual from 'lodash/isEqual';
2
2
  import cloneDeep from 'lodash/cloneDeep';
3
3
  import { PortalTarget } from 'portal-vue';
4
- import { GlTooltipDirective } from '../../../directives/tooltip';
4
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
5
5
  import GlIcon from '../icon/icon';
6
6
  import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click';
7
7
  import GlFilteredSearchTerm from './filtered_search_term';
@@ -1,4 +1,4 @@
1
- import { GlTooltipDirective } from '../../../directives/tooltip';
1
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
2
2
  import GlClearIconButton from '../../shared_components/clear_icon_button/clear_icon_button';
3
3
  import GlButton from '../button/button';
4
4
  import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown';
@@ -1,4 +1,4 @@
1
- import { GlTooltipDirective } from '../../../directives/tooltip';
1
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
2
2
  import GlButton from '../button/button';
3
3
  import GlButtonGroup from '../button_group/button_group';
4
4
  import GlCollapsibleListbox from '../new_dropdowns/listbox/listbox';
@@ -1,6 +1,7 @@
1
1
  import { BTooltip } from '../../../vendor/bootstrap-vue/src/components/tooltip/tooltip';
2
2
  import { tooltipDelay } from '../../../utils/constants';
3
3
  import tooltipMixin from '../../mixins/tooltip_mixin';
4
+ import { getGlTooltipDefaultContainer } from '../../../directives/tooltip/container';
4
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
6
 
6
7
  //
@@ -13,14 +14,15 @@ var script = {
13
14
  },
14
15
  mixins: [tooltipMixin(tooltipRefName)],
15
16
  inheritAttrs: false,
16
- tooltipRefName
17
+ tooltipRefName,
18
+ getGlTooltipDefaultContainer
17
19
  };
18
20
 
19
21
  /* script */
20
22
  const __vue_script__ = script;
21
23
 
22
24
  /* template */
23
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tooltip',_vm._g(_vm._b({ref:_vm.$options.tooltipRefName,attrs:{"delay":_vm.$options.tooltipDelay}},'b-tooltip',_vm.$attrs,false),_vm.$listeners),[_vm._t("default")],2)};
25
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tooltip',_vm._g(_vm._b({ref:_vm.$options.tooltipRefName,attrs:{"container":_vm.$attrs.container || _vm.$options.getGlTooltipDefaultContainer(),"delay":_vm.$options.tooltipDelay}},'b-tooltip',_vm.$attrs,false),_vm.$listeners),[_vm._t("default")],2)};
24
26
  var __vue_staticRenderFns__ = [];
25
27
 
26
28
  /* style */
@@ -146,18 +146,7 @@ var script = {
146
146
  return generateAnnotationSeries(this.annotations);
147
147
  },
148
148
  options() {
149
- const defaultAreaChartOptions = {
150
- xAxis: {
151
- axisPointer: {
152
- show: true,
153
- lineStyle: {
154
- type: 'solid'
155
- },
156
- label: {
157
- formatter: this.formatTooltipText
158
- }
159
- }
160
- },
149
+ const areaChartOptions = {
161
150
  yAxis: {
162
151
  axisTick: {
163
152
  show: false
@@ -167,7 +156,20 @@ var script = {
167
156
  show: false
168
157
  }
169
158
  };
170
- const mergedOptions = merge({}, defaultChartOptions, defaultAreaChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom));
159
+
160
+ // `formatTooltipText` is deprecated, these added options should be
161
+ // removed when `formatTooltipText` is removed.
162
+ const deprecatedTooltipFormatterOptions = {
163
+ xAxis: {
164
+ axisPointer: {
165
+ show: true,
166
+ label: {
167
+ formatter: this.formatTooltipText
168
+ }
169
+ }
170
+ }
171
+ };
172
+ const mergedOptions = merge({}, defaultChartOptions, areaChartOptions, this.formatTooltipText ? deprecatedTooltipFormatterOptions : {}, this.option, dataZoomAdjustments(this.option.dataZoom));
171
173
  // All chart options can be merged but series
172
174
  // needs to be handled specially.
173
175
  return mergeSeriesToOptions(mergeAnnotationAxisToOptions(mergedOptions, this.hasAnnotations), this.series);
@@ -140,14 +140,8 @@ var script = {
140
140
  return generateAnnotationSeries(this.annotations);
141
141
  },
142
142
  options() {
143
- const defaultLineChartOptions = {
143
+ const lineChartOptions = {
144
144
  xAxis: {
145
- axisPointer: {
146
- show: true,
147
- label: {
148
- formatter: this.formatTooltipText
149
- }
150
- },
151
145
  axisTick: {
152
146
  alignWithLabel: true,
153
147
  show: true,
@@ -160,7 +154,20 @@ var script = {
160
154
  show: false
161
155
  }
162
156
  };
163
- const mergedOptions = merge({}, defaultChartOptions, defaultLineChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom));
157
+
158
+ // `formatTooltipText` is deprecated, these added options should be
159
+ // removed when `formatTooltipText` is removed.
160
+ const deprecatedTooltipFormatterOptions = {
161
+ xAxis: {
162
+ axisPointer: {
163
+ show: true,
164
+ label: {
165
+ formatter: this.formatTooltipText
166
+ }
167
+ }
168
+ }
169
+ };
170
+ const mergedOptions = merge({}, defaultChartOptions, lineChartOptions, this.formatTooltipText ? deprecatedTooltipFormatterOptions : {}, this.option, dataZoomAdjustments(this.option.dataZoom));
164
171
  // All chart options can be merged but series
165
172
  // needs to be handled specially
166
173
  return mergeSeriesToOptions(mergeAnnotationAxisToOptions(mergedOptions, this.hasAnnotations), this.series);
@@ -1,5 +1,5 @@
1
1
  import merge from 'lodash/merge';
2
- import { yAxis, generateBarSeries, generateLineSeries, defaultChartOptions, gridWithSecondaryYAxis, grid, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
2
+ import { yAxis, generateBarSeries, generateLineSeries, gridWithSecondaryYAxis, grid, defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
3
3
  import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, CHART_TYPE_LINE, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
5
5
  import { columnOptions } from '../../../utils/constants';
@@ -205,7 +205,7 @@ var script = {
205
205
  return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
206
206
  },
207
207
  options() {
208
- const mergedOptions = merge({}, defaultChartOptions, {
208
+ const stackedColumnChartOptions = {
209
209
  grid: this.hasSecondaryAxis ? gridWithSecondaryYAxis : grid,
210
210
  xAxis: {
211
211
  boundaryGap: true,
@@ -217,11 +217,7 @@ var script = {
217
217
  show: false
218
218
  },
219
219
  axisPointer: {
220
- show: true,
221
- type: 'none',
222
- label: {
223
- formatter: this.formatTooltipText
224
- }
220
+ type: 'none'
225
221
  },
226
222
  data: this.groupBy,
227
223
  name: this.xAxisTitle,
@@ -238,7 +234,21 @@ var script = {
238
234
  legend: {
239
235
  show: false
240
236
  }
241
- }, this.option, dataZoomAdjustments(this.option.dataZoom));
237
+ };
238
+
239
+ // `formatTooltipText` is deprecated, these added options should be
240
+ // removed when `formatTooltipText` is removed.
241
+ const deprecatedTooltipFormatterOptions = {
242
+ xAxis: {
243
+ axisPointer: {
244
+ show: true,
245
+ label: {
246
+ formatter: this.formatTooltipText
247
+ }
248
+ }
249
+ }
250
+ };
251
+ const mergedOptions = merge({}, defaultChartOptions, stackedColumnChartOptions, this.formatTooltipText ? deprecatedTooltipFormatterOptions : {}, this.option, dataZoomAdjustments(this.option.dataZoom));
242
252
  // All chart options can be merged but series
243
253
  // needs to be handled specially
244
254
  return mergeSeriesToOptions(mergedOptions, this.series);
@@ -1,4 +1,4 @@
1
- import { GlTooltipDirective } from '../../../directives/tooltip';
1
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
2
2
  import GlButton from '../../base/button/button';
3
3
  import { translate } from '../../../utils/i18n';
4
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -1,4 +1,4 @@
1
- import { GlTooltipDirective } from '../../../directives/tooltip';
1
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
2
2
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
3
3
  import { POSITION, ZERO_WIDTH_SPACE } from './constants';
4
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -0,0 +1,7 @@
1
+ let containerSelector;
2
+ const setGlTooltipDefaultContainer = selector => {
3
+ containerSelector = selector;
4
+ };
5
+ const getGlTooltipDefaultContainer = () => containerSelector;
6
+
7
+ export { getGlTooltipDefaultContainer, setGlTooltipDefaultContainer };
@@ -0,0 +1,18 @@
1
+ import { VBTooltip } from '../../vendor/bootstrap-vue/src/directives/tooltip';
2
+ import { getGlTooltipDefaultContainer } from './container';
3
+
4
+ const patchHook = hook => (el, bindings, vnode) => {
5
+ hook(el, {
6
+ ...bindings,
7
+ arg: bindings.arg || getGlTooltipDefaultContainer()
8
+ }, vnode);
9
+ };
10
+ const bind = patchHook(VBTooltip.bind);
11
+ const componentUpdated = patchHook(VBTooltip.componentUpdated);
12
+ const GlTooltipDirective = {
13
+ ...VBTooltip,
14
+ bind,
15
+ componentUpdated
16
+ };
17
+
18
+ export { GlTooltipDirective };
package/dist/index.js CHANGED
@@ -104,7 +104,8 @@ export { default as GlSprintf } from './components/utilities/sprintf/sprintf';
104
104
  export { default as GlTruncate } from './components/utilities/truncate/truncate';
105
105
  export { default as GlTruncateText } from './components/utilities/truncate_text/truncate_text';
106
106
  export { GlModalDirective } from './directives/modal';
107
- export { GlTooltipDirective } from './directives/tooltip';
107
+ export { GlTooltipDirective } from './directives/tooltip/tooltip';
108
+ export { setGlTooltipDefaultContainer } from './directives/tooltip/container';
108
109
  export { GlResizeObserverDirective } from './directives/resize_observer/resize_observer';
109
110
  export { GlCollapseToggleDirective } from './directives/collapse_toggle';
110
111
  export { SafeLinkDirective as GlSafeLinkDirective } from './directives/safe_link/safe_link';
@@ -1,5 +1,5 @@
1
1
  import { colorFromBackground } from '../utils/utils';
2
- import { GlTooltipDirective } from '../directives/tooltip';
2
+ import { GlTooltipDirective } from '../directives/tooltip/tooltip';
3
3
  import GlBadge from '../components/base/badge/badge';
4
4
  import GlColorContrast from '../internal/color_contrast/color_contrast';
5
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -6,7 +6,7 @@ import GlSearchBoxByType from '../components/base/search_box_by_type/search_box_
6
6
  import GlLink from '../components/base/link/link';
7
7
  import GlTable from '../components/base/table/table';
8
8
  import GlPagination from '../components/base/pagination/pagination';
9
- import { GlTooltipDirective } from '../directives/tooltip';
9
+ import { GlTooltipDirective } from '../directives/tooltip/tooltip';
10
10
  import TOKENS_DEFAULT from './build/json/tokens.json';
11
11
  import TOKENS_DARK from './build/json/tokens.dark.json';
12
12
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -37,6 +37,10 @@ const grid = {
37
37
  left: 64,
38
38
  right: 32
39
39
  };
40
+
41
+ /**
42
+ * Options for charts where the y-axis is the metrics axis.
43
+ */
40
44
  const defaultChartOptions = {
41
45
  grid,
42
46
  xAxis,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "111.8.0",
3
+ "version": "111.9.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -4,7 +4,7 @@ import debounce from 'lodash/debounce';
4
4
  import { translate } from '../../../utils/i18n';
5
5
  import GlAvatar from '../avatar/avatar.vue';
6
6
  import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown.vue';
7
- import { GlTooltipDirective } from '../../../directives/tooltip';
7
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
8
8
  import { breadCrumbSizeOptions } from '../../../utils/constants';
9
9
  import GlBreadcrumbItem from './breadcrumb_item.vue';
10
10
 
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import uniqueId from 'lodash/uniqueId';
3
- import { GlTooltipDirective } from '../../../directives/tooltip';
3
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
4
4
  import { getDayDifference, getDateInPast, getDateInFuture } from '../../../utils/datetime_utility';
5
5
  import GlDatepicker from '../datepicker/datepicker.vue';
6
6
  import GlIcon from '../icon/icon.vue';
@@ -2,7 +2,7 @@
2
2
  import isEqual from 'lodash/isEqual';
3
3
  import cloneDeep from 'lodash/cloneDeep';
4
4
  import { PortalTarget } from 'portal-vue';
5
- import { GlTooltipDirective } from '../../../directives/tooltip';
5
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
6
6
  import GlIcon from '../icon/icon.vue';
7
7
  import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click.vue';
8
8
  import GlFilteredSearchTerm from './filtered_search_term.vue';
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlTooltipDirective } from '../../../directives/tooltip';
2
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
3
3
  import GlClearIconButton from '../../shared_components/clear_icon_button/clear_icon_button.vue';
4
4
  import GlButton from '../button/button.vue';
5
5
  import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown.vue';
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlTooltipDirective } from '../../../directives/tooltip';
2
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
3
3
  import GlButton from '../button/button.vue';
4
4
  import GlButtonGroup from '../button_group/button_group.vue';
5
5
  import GlCollapsibleListbox from '../new_dropdowns/listbox/listbox.vue';
@@ -3,6 +3,7 @@
3
3
  import { BTooltip } from '../../../vendor/bootstrap-vue/src/components/tooltip/tooltip';
4
4
  import { tooltipDelay } from '../../../utils/constants';
5
5
  import tooltipMixin from '../../mixins/tooltip_mixin';
6
+ import { getGlTooltipDefaultContainer } from '../../../directives/tooltip/container';
6
7
 
7
8
  const tooltipRefName = 'bvTooltip';
8
9
 
@@ -15,6 +16,7 @@ export default {
15
16
  mixins: [tooltipMixin(tooltipRefName)],
16
17
  inheritAttrs: false,
17
18
  tooltipRefName,
19
+ getGlTooltipDefaultContainer,
18
20
  };
19
21
  </script>
20
22
 
@@ -22,6 +24,7 @@ export default {
22
24
  <b-tooltip
23
25
  :ref="$options.tooltipRefName"
24
26
  v-bind="$attrs"
27
+ :container="$attrs.container || $options.getGlTooltipDefaultContainer()"
25
28
  :delay="$options.tooltipDelay"
26
29
  v-on="$listeners"
27
30
  >
@@ -186,18 +186,7 @@ export default {
186
186
  return generateAnnotationSeries(this.annotations);
187
187
  },
188
188
  options() {
189
- const defaultAreaChartOptions = {
190
- xAxis: {
191
- axisPointer: {
192
- show: true,
193
- lineStyle: {
194
- type: 'solid',
195
- },
196
- label: {
197
- formatter: this.formatTooltipText,
198
- },
199
- },
200
- },
189
+ const areaChartOptions = {
201
190
  yAxis: {
202
191
  axisTick: {
203
192
  show: false,
@@ -207,10 +196,25 @@ export default {
207
196
  show: false,
208
197
  },
209
198
  };
199
+
200
+ // `formatTooltipText` is deprecated, these added options should be
201
+ // removed when `formatTooltipText` is removed.
202
+ const deprecatedTooltipFormatterOptions = {
203
+ xAxis: {
204
+ axisPointer: {
205
+ show: true,
206
+ label: {
207
+ formatter: this.formatTooltipText,
208
+ },
209
+ },
210
+ },
211
+ };
212
+
210
213
  const mergedOptions = merge(
211
214
  {},
212
215
  defaultChartOptions,
213
- defaultAreaChartOptions,
216
+ areaChartOptions,
217
+ this.formatTooltipText ? deprecatedTooltipFormatterOptions : {},
214
218
  this.option,
215
219
  dataZoomAdjustments(this.option.dataZoom)
216
220
  );
@@ -180,14 +180,8 @@ export default {
180
180
  return generateAnnotationSeries(this.annotations);
181
181
  },
182
182
  options() {
183
- const defaultLineChartOptions = {
183
+ const lineChartOptions = {
184
184
  xAxis: {
185
- axisPointer: {
186
- show: true,
187
- label: {
188
- formatter: this.formatTooltipText,
189
- },
190
- },
191
185
  axisTick: {
192
186
  alignWithLabel: true,
193
187
  show: true,
@@ -200,10 +194,25 @@ export default {
200
194
  show: false,
201
195
  },
202
196
  };
197
+
198
+ // `formatTooltipText` is deprecated, these added options should be
199
+ // removed when `formatTooltipText` is removed.
200
+ const deprecatedTooltipFormatterOptions = {
201
+ xAxis: {
202
+ axisPointer: {
203
+ show: true,
204
+ label: {
205
+ formatter: this.formatTooltipText,
206
+ },
207
+ },
208
+ },
209
+ };
210
+
203
211
  const mergedOptions = merge(
204
212
  {},
205
213
  defaultChartOptions,
206
- defaultLineChartOptions,
214
+ lineChartOptions,
215
+ this.formatTooltipText ? deprecatedTooltipFormatterOptions : {},
207
216
  this.option,
208
217
  dataZoomAdjustments(this.option.dataZoom)
209
218
  );
@@ -192,46 +192,58 @@ export default {
192
192
  return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
193
193
  },
194
194
  options() {
195
- const mergedOptions = merge(
196
- {},
197
- defaultChartOptions,
198
- {
199
- grid: this.hasSecondaryAxis ? gridWithSecondaryYAxis : grid,
200
- xAxis: {
201
- boundaryGap: true,
202
- axisLabel: {
203
- margin: 20,
204
- verticalAlign: 'bottom',
205
- },
206
- axisLine: {
207
- show: false,
208
- },
209
- axisPointer: {
210
- show: true,
211
- type: 'none',
212
- label: {
213
- formatter: this.formatTooltipText,
214
- },
215
- },
216
- data: this.groupBy,
217
- name: this.xAxisTitle,
218
- type: this.xAxisType,
195
+ const stackedColumnChartOptions = {
196
+ grid: this.hasSecondaryAxis ? gridWithSecondaryYAxis : grid,
197
+ xAxis: {
198
+ boundaryGap: true,
199
+ axisLabel: {
200
+ margin: 20,
201
+ verticalAlign: 'bottom',
219
202
  },
220
- yAxis: [
221
- {
222
- ...yAxisDefaults,
223
- name: this.yAxisTitle,
224
- },
225
- {
226
- ...yAxisDefaults,
227
- name: this.secondaryDataTitle,
228
- show: this.hasSecondaryAxis,
229
- },
230
- ],
231
- legend: {
203
+ axisLine: {
232
204
  show: false,
233
205
  },
206
+ axisPointer: {
207
+ type: 'none',
208
+ },
209
+ data: this.groupBy,
210
+ name: this.xAxisTitle,
211
+ type: this.xAxisType,
212
+ },
213
+ yAxis: [
214
+ {
215
+ ...yAxisDefaults,
216
+ name: this.yAxisTitle,
217
+ },
218
+ {
219
+ ...yAxisDefaults,
220
+ name: this.secondaryDataTitle,
221
+ show: this.hasSecondaryAxis,
222
+ },
223
+ ],
224
+ legend: {
225
+ show: false,
226
+ },
227
+ };
228
+
229
+ // `formatTooltipText` is deprecated, these added options should be
230
+ // removed when `formatTooltipText` is removed.
231
+ const deprecatedTooltipFormatterOptions = {
232
+ xAxis: {
233
+ axisPointer: {
234
+ show: true,
235
+ label: {
236
+ formatter: this.formatTooltipText,
237
+ },
238
+ },
234
239
  },
240
+ };
241
+
242
+ const mergedOptions = merge(
243
+ {},
244
+ defaultChartOptions,
245
+ stackedColumnChartOptions,
246
+ this.formatTooltipText ? deprecatedTooltipFormatterOptions : {},
235
247
  this.option,
236
248
  dataZoomAdjustments(this.option.dataZoom)
237
249
  );
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlTooltipDirective } from '../../../directives/tooltip';
2
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
3
3
  import GlButton from '../../base/button/button.vue';
4
4
  import { translate } from '../../../utils/i18n';
5
5
 
@@ -1,6 +1,6 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
- import { GlTooltipDirective } from '../../../directives/tooltip';
3
+ import { GlTooltipDirective } from '../../../directives/tooltip/tooltip';
4
4
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
5
5
  import { POSITION, ZERO_WIDTH_SPACE } from './constants';
6
6
 
@@ -0,0 +1,7 @@
1
+ let containerSelector;
2
+
3
+ export const setGlTooltipDefaultContainer = (selector) => {
4
+ containerSelector = selector;
5
+ };
6
+
7
+ export const getGlTooltipDefaultContainer = () => containerSelector;
@@ -0,0 +1,22 @@
1
+ import { VBTooltip } from '../../vendor/bootstrap-vue/src/directives/tooltip';
2
+ import { getGlTooltipDefaultContainer } from './container';
3
+
4
+ const patchHook = (hook) => (el, bindings, vnode) => {
5
+ hook(
6
+ el,
7
+ {
8
+ ...bindings,
9
+ arg: bindings.arg || getGlTooltipDefaultContainer(),
10
+ },
11
+ vnode
12
+ );
13
+ };
14
+
15
+ const bind = patchHook(VBTooltip.bind);
16
+ const componentUpdated = patchHook(VBTooltip.componentUpdated);
17
+
18
+ export const GlTooltipDirective = {
19
+ ...VBTooltip,
20
+ bind,
21
+ componentUpdated,
22
+ };
package/src/index.js CHANGED
@@ -120,7 +120,8 @@ export { default as GlTruncateText } from './components/utilities/truncate_text/
120
120
 
121
121
  // Directives
122
122
  export { GlModalDirective } from './directives/modal';
123
- export { GlTooltipDirective } from './directives/tooltip';
123
+ export { GlTooltipDirective } from './directives/tooltip/tooltip';
124
+ export { setGlTooltipDefaultContainer } from './directives/tooltip/container';
124
125
  export { GlResizeObserverDirective } from './directives/resize_observer/resize_observer';
125
126
  export { GlCollapseToggleDirective } from './directives/collapse_toggle';
126
127
  export { SafeLinkDirective as GlSafeLinkDirective } from './directives/safe_link/safe_link';
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { colorFromBackground } from '../utils/utils';
3
- import { GlTooltipDirective } from '../directives/tooltip';
3
+ import { GlTooltipDirective } from '../directives/tooltip/tooltip';
4
4
  import GlBadge from '../components/base/badge/badge.vue';
5
5
  import GlColorContrast from '../internal/color_contrast/color_contrast.vue';
6
6
 
@@ -7,7 +7,7 @@ import GlSearchBoxByType from '../components/base/search_box_by_type/search_box_
7
7
  import GlLink from '../components/base/link/link.vue';
8
8
  import GlTable from '../components/base/table/table.vue';
9
9
  import GlPagination from '../components/base/pagination/pagination.vue';
10
- import { GlTooltipDirective } from '../directives/tooltip';
10
+ import { GlTooltipDirective } from '../directives/tooltip/tooltip';
11
11
  import TOKENS_DEFAULT from './build/json/tokens.json';
12
12
  import TOKENS_DARK from './build/json/tokens.dark.json';
13
13
 
@@ -42,6 +42,9 @@ export const grid = {
42
42
  right: 32,
43
43
  };
44
44
 
45
+ /**
46
+ * Options for charts where the y-axis is the metrics axis.
47
+ */
45
48
  export const defaultChartOptions = {
46
49
  grid,
47
50
  xAxis,
@@ -1 +0,0 @@
1
- export { VBTooltip as GlTooltipDirective } from '../vendor/bootstrap-vue/src/directives/tooltip/tooltip';
@@ -1 +0,0 @@
1
- export { VBTooltip as GlTooltipDirective } from '../vendor/bootstrap-vue/src/directives/tooltip/tooltip';