@gitlab/ui 85.4.0 → 85.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "85.4.0",
3
+ "version": "85.5.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -8,6 +8,8 @@
8
8
  @include gl-font-weight-normal;
9
9
  @include gl-py-3;
10
10
  @include gl-px-4;
11
+ background: var(--gl-feedback-background-color-strong);
12
+ color: var(--gl-feedback-text-color-strong);
11
13
  }
12
14
 
13
15
  .arrow {
@@ -30,16 +32,20 @@
30
32
 
31
33
  .gl-tooltip.bs-tooltip-top .arrow::before {
32
34
  @include gl-border-b-0;
35
+ border-top-color: var(--gl-feedback-background-color-strong);
33
36
  }
34
37
 
35
38
  .gl-tooltip.bs-tooltip-right .arrow::before {
36
39
  @include gl-border-l-0;
40
+ border-right-color: var(--gl-feedback-background-color-strong);
37
41
  }
38
42
 
39
43
  .gl-tooltip.bs-tooltip-bottom .arrow::before {
40
44
  @include gl-border-t-0;
45
+ border-bottom-color: var(--gl-feedback-background-color-strong);
41
46
  }
42
47
 
43
48
  .gl-tooltip.bs-tooltip-left .arrow::before {
44
49
  @include gl-border-r-0;
50
+ border-left-color: var(--gl-feedback-background-color-strong);
45
51
  }
@@ -89,6 +89,7 @@ export default {
89
89
  return {
90
90
  chartInstance: null,
91
91
  tooltip: {
92
+ show: false,
92
93
  title: '',
93
94
  content: '',
94
95
  position: {
@@ -178,6 +179,8 @@ export default {
178
179
  methods: {
179
180
  onChartCreated(chartInstance) {
180
181
  this.chartInstance = chartInstance;
182
+ this.tooltip.show = false;
183
+
181
184
  /**
182
185
  * Emitted when the chart is created.
183
186
  * The payload contains the echarts instance.
@@ -189,6 +192,9 @@ export default {
189
192
  handleResize() {
190
193
  this.chartInstance.resize();
191
194
  },
195
+ isNilOrBlank(text) {
196
+ return isNil(text) || (typeof text === 'string' && text.trim() === '');
197
+ },
192
198
  setTooltipPosition(data) {
193
199
  const [left, top] = this.chartInstance.convertToPixel('grid', data);
194
200
  this.tooltip.position = {
@@ -200,6 +206,8 @@ export default {
200
206
  // point on the line is selected). Note that it will not trigger if the axis pointer is removed,
201
207
  // only when it changes from one point to another or is shown for the first time.
202
208
  generateTooltip({ seriesData = [] }) {
209
+ this.tooltip.show = false;
210
+
203
211
  // seriesData is an array of nearby data point coordinates
204
212
  // seriesData[0] is the nearest point at which the tooltip is displayed
205
213
  // https://echarts.apache.org/en/option.html#xAxis.axisPointer.label.formatter
@@ -208,11 +216,12 @@ export default {
208
216
  if (!data) return;
209
217
 
210
218
  const [title, content] = data;
211
- if (isNil(title) || isNil(content)) return;
219
+ if (this.isNilOrBlank(title) || this.isNilOrBlank(content)) return;
212
220
 
213
221
  this.tooltip.title = title;
214
222
  this.tooltip.content = content;
215
223
  this.setTooltipPosition(data);
224
+ this.tooltip.show = null;
216
225
  },
217
226
  },
218
227
  HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES,
@@ -241,6 +250,7 @@ export default {
241
250
  />
242
251
  <chart-tooltip
243
252
  v-if="chartInstance"
253
+ :show="tooltip.show"
244
254
  :chart="chartInstance"
245
255
  :top="tooltip.position.top"
246
256
  :left="tooltip.position.left"