@gitlab/ui 85.3.1 → 85.4.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [85.4.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.4.0...v85.4.1) (2024-06-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlSparklineChart:** Prevent rendering blank or invalid tooltips ([e462352](https://gitlab.com/gitlab-org/gitlab-ui/commit/e46235217c576aaaed63ca38b30f3fdee3c54a63))
7
+
8
+ # [85.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.3.1...v85.4.0) (2024-06-26)
9
+
10
+
11
+ ### Features
12
+
13
+ * **DuoChat:** update user feedback response ([5c51a3f](https://gitlab.com/gitlab-org/gitlab-ui/commit/5c51a3f8c8c2d04aef7507c3032c3992681a4682))
14
+
1
15
  ## [85.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.3.0...v85.3.1) (2024-06-26)
2
16
 
3
17
 
@@ -84,6 +84,7 @@ var script = {
84
84
  return {
85
85
  chartInstance: null,
86
86
  tooltip: {
87
+ show: false,
87
88
  title: '',
88
89
  content: '',
89
90
  position: {
@@ -177,6 +178,8 @@ var script = {
177
178
  methods: {
178
179
  onChartCreated(chartInstance) {
179
180
  this.chartInstance = chartInstance;
181
+ this.tooltip.show = false;
182
+
180
183
  /**
181
184
  * Emitted when the chart is created.
182
185
  * The payload contains the echarts instance.
@@ -188,6 +191,9 @@ var script = {
188
191
  handleResize() {
189
192
  this.chartInstance.resize();
190
193
  },
194
+ isNilOrBlank(text) {
195
+ return isNil(text) || typeof text === 'string' && text.trim() === '';
196
+ },
191
197
  setTooltipPosition(data) {
192
198
  const [left, top] = this.chartInstance.convertToPixel('grid', data);
193
199
  this.tooltip.position = {
@@ -202,6 +208,8 @@ var script = {
202
208
  let {
203
209
  seriesData = []
204
210
  } = _ref;
211
+ this.tooltip.show = false;
212
+
205
213
  // seriesData is an array of nearby data point coordinates
206
214
  // seriesData[0] is the nearest point at which the tooltip is displayed
207
215
  // https://echarts.apache.org/en/option.html#xAxis.axisPointer.label.formatter
@@ -211,10 +219,11 @@ var script = {
211
219
  } = firstEntry;
212
220
  if (!data) return;
213
221
  const [title, content] = data;
214
- if (isNil(title) || isNil(content)) return;
222
+ if (this.isNilOrBlank(title) || this.isNilOrBlank(content)) return;
215
223
  this.tooltip.title = title;
216
224
  this.tooltip.content = content;
217
225
  this.setTooltipPosition(data);
226
+ this.tooltip.show = null;
218
227
  }
219
228
  },
220
229
  HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES
@@ -226,7 +235,7 @@ const __vue_script__ = script;
226
235
  /* template */
227
236
  var __vue_render__ = function () {
228
237
  var _obj;
229
- var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",class:{ 'gl-h-full': _vm.autoHeight }},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES] = _vm.autoHeight, _obj ),attrs:{"data-testid":"chart-container"}},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{attrs:{"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
238
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",class:{ 'gl-h-full': _vm.autoHeight }},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES] = _vm.autoHeight, _obj ),attrs:{"data-testid":"chart-container"}},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{attrs:{"show":_vm.tooltip.show,"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
230
239
  var __vue_staticRenderFns__ = [];
231
240
 
232
241
  /* style */
@@ -1,3 +1,4 @@
1
+ import GlAlert from '../../../base/alert/alert';
1
2
  import GlButton from '../../../base/button/button';
2
3
  import FeedbackModal from './user_feedback_modal';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -9,6 +10,7 @@ const i18n = {
9
10
  var script = {
10
11
  name: 'GlDuoUserFeedback',
11
12
  components: {
13
+ GlAlert,
12
14
  GlButton,
13
15
  FeedbackModal
14
16
  },
@@ -60,7 +62,7 @@ var script = {
60
62
  const __vue_script__ = script;
61
63
 
62
64
  /* template */
63
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-pt-4"},[_c('div',[(!_vm.feedbackReceived)?_c('gl-button',{attrs:{"variant":"link","target":"_blank","href":_vm.feedbackLinkUrl,"button-text-classes":"gl-white-space-normal! gl-text-left"},on:{"click":function($event){_vm.shouldRenderModal && _vm.$refs.feedbackModal.show();}}},[_vm._v(_vm._s(_vm.feedbackLinkText))]):_c('span',{staticClass:"gl-text-gray-500"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.FEEDBACK_THANKS)+"\n ")])],1),_vm._v(" "),(_vm.shouldRenderModal)?_c('feedback-modal',{ref:"feedbackModal",on:{"feedback-submitted":_vm.notify},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_vm._t("feedback-extra-fields")]},proxy:true}],null,true)}):_vm._e()],1)};
65
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-pt-4 gl-w-full"},[_c('div',[(!_vm.feedbackReceived)?_c('gl-button',{attrs:{"variant":"link","target":"_blank","href":_vm.feedbackLinkUrl,"button-text-classes":"gl-white-space-normal! gl-text-left"},on:{"click":function($event){_vm.shouldRenderModal && _vm.$refs.feedbackModal.show();}}},[_vm._v(_vm._s(_vm.feedbackLinkText))]):_c('gl-alert',{attrs:{"variant":"success","dismissible":false}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.FEEDBACK_THANKS)+"\n ")])],1),_vm._v(" "),(_vm.shouldRenderModal)?_c('feedback-modal',{ref:"feedbackModal",on:{"feedback-submitted":_vm.notify},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_vm._t("feedback-extra-fields")]},proxy:true}],null,true)}):_vm._e()],1)};
64
66
  var __vue_staticRenderFns__ = [];
65
67
 
66
68
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "85.3.1",
3
+ "version": "85.4.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -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"
@@ -1,4 +1,5 @@
1
1
  <script>
2
+ import GlAlert from '../../../base/alert/alert.vue';
2
3
  import GlButton from '../../../base/button/button.vue';
3
4
  import FeedbackModal from './user_feedback_modal.vue';
4
5
 
@@ -10,6 +11,7 @@ export const i18n = {
10
11
  export default {
11
12
  name: 'GlDuoUserFeedback',
12
13
  components: {
14
+ GlAlert,
13
15
  GlButton,
14
16
  FeedbackModal,
15
17
  },
@@ -59,7 +61,7 @@ export default {
59
61
  </script>
60
62
 
61
63
  <template>
62
- <div class="gl-pt-4">
64
+ <div class="gl-pt-4 gl-w-full">
63
65
  <div>
64
66
  <gl-button
65
67
  v-if="!feedbackReceived"
@@ -70,9 +72,9 @@ export default {
70
72
  @click="shouldRenderModal && $refs.feedbackModal.show()"
71
73
  >{{ feedbackLinkText }}</gl-button
72
74
  >
73
- <span v-else class="gl-text-gray-500">
75
+ <gl-alert v-else variant="success" :dismissible="false">
74
76
  {{ $options.i18n.FEEDBACK_THANKS }}
75
- </span>
77
+ </gl-alert>
76
78
  </div>
77
79
  <feedback-modal v-if="shouldRenderModal" ref="feedbackModal" @feedback-submitted="notify">
78
80
  <template #feedback-extra-fields>