@gitlab/ui 40.3.0 → 40.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [40.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v40.5.0...v40.6.0) (2022-05-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlLineChart:** allow chart legend to be hidden ([8d9fa8b](https://gitlab.com/gitlab-org/gitlab-ui/commit/8d9fa8b1c352a8894b3e36509402e4388380ffb0))
7
+
8
+ # [40.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v40.4.0...v40.5.0) (2022-05-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * **add billing plan colors:** Add utility classes used in billing page ([61de498](https://gitlab.com/gitlab-org/gitlab-ui/commit/61de4980842a1045215f91a7e100cd66e2074fcc))
14
+
15
+ # [40.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v40.3.0...v40.4.0) (2022-05-17)
16
+
17
+
18
+ ### Features
19
+
20
+ * **GlAvatar:** add responsive size support ([bded2c9](https://gitlab.com/gitlab-org/gitlab-ui/commit/bded2c962b40e942a1b0edb2a085d47a3fa91b4e))
21
+
1
22
  # [40.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v40.2.2...v40.3.0) (2022-05-17)
2
23
 
3
24
 
@@ -1,8 +1,8 @@
1
+ import _isNumber from 'lodash/isNumber';
1
2
  import { avatarSizeOptions, avatarShapeOptions } from '../../../utils/constants';
2
3
  import { getAvatarChar } from '../../../utils/string_utils';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
5
 
5
- //
6
6
  const IDENTICON_BG_COUNT = 7;
7
7
  var script = {
8
8
  props: {
@@ -27,18 +27,22 @@ var script = {
27
27
  default: 'avatar'
28
28
  },
29
29
  size: {
30
- type: Number,
30
+ type: [Number, Object],
31
31
  required: false,
32
32
  default: avatarSizeOptions[1],
33
33
  validator: value => {
34
- const isValidSize = avatarSizeOptions.includes(value);
34
+ const sizes = _isNumber(value) ? [value] : Object.values(value);
35
+ const areValidSizes = sizes.every(size => {
36
+ const isValidSize = avatarSizeOptions.includes(size);
35
37
 
36
- if (!isValidSize) {
37
- /* eslint-disable-next-line no-console */
38
- console.error(`Avatar size should be one of [${avatarSizeOptions}], received: ${value}`);
39
- }
38
+ if (!isValidSize) {
39
+ /* eslint-disable-next-line no-console */
40
+ console.error(`Avatar size should be one of [${avatarSizeOptions}], received: ${size}`);
41
+ }
40
42
 
41
- return isValidSize;
43
+ return isValidSize;
44
+ });
45
+ return areValidSizes;
42
46
  }
43
47
  },
44
48
  shape: {
@@ -48,8 +52,19 @@ var script = {
48
52
  }
49
53
  },
50
54
  computed: {
51
- sizeClass() {
52
- return `gl-avatar-s${this.size}`;
55
+ sizeClasses() {
56
+ if (_isNumber(this.size)) {
57
+ return `gl-avatar-s${this.size}`;
58
+ }
59
+
60
+ const {
61
+ default: defaultSize,
62
+ ...nonDefaultSizes
63
+ } = this.size;
64
+ return [`gl-avatar-s${defaultSize || avatarSizeOptions[1]}`, ...Object.entries(nonDefaultSizes).map(_ref => {
65
+ let [breakpoint, size] = _ref;
66
+ return `gl-${breakpoint}-avatar-s${size}`;
67
+ })];
53
68
  },
54
69
 
55
70
  isCircle() {
@@ -76,10 +91,10 @@ var script = {
76
91
  const __vue_script__ = script;
77
92
 
78
93
  /* template */
79
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.src)?_c('img',{class:['gl-avatar', { 'gl-avatar-circle': _vm.isCircle }, _vm.sizeClass],attrs:{"src":_vm.src,"alt":_vm.alt}}):_c('div',{class:[
94
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.src)?_c('img',{class:['gl-avatar', { 'gl-avatar-circle': _vm.isCircle }, _vm.sizeClasses],attrs:{"src":_vm.src,"alt":_vm.alt}}):_c('div',{class:[
80
95
  'gl-avatar gl-avatar-identicon',
81
96
  { 'gl-avatar-circle': _vm.isCircle },
82
- _vm.sizeClass,
97
+ _vm.sizeClasses,
83
98
  _vm.identiconBackgroundClass ]},[_vm._v("\n "+_vm._s(_vm.identiconText)+"\n")])};
84
99
  var __vue_staticRenderFns__ = [];
85
100
 
@@ -82,6 +82,11 @@ var script = {
82
82
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
83
83
  }
84
84
 
85
+ },
86
+ showLegend: {
87
+ type: Boolean,
88
+ required: false,
89
+ default: true
85
90
  }
86
91
  },
87
92
 
@@ -197,6 +202,10 @@ var script = {
197
202
  };
198
203
  },
199
204
 
205
+ hasLegend() {
206
+ return this.compiledOptions && this.showLegend;
207
+ },
208
+
200
209
  seriesInfo() {
201
210
  return this.compiledOptions.series.reduce((acc, series, index) => {
202
211
  if (series.type === 'line') {
@@ -311,7 +320,7 @@ var script = {
311
320
  const __vue_script__ = script;
312
321
 
313
322
  /* template */
314
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
323
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.hasLegend)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
315
324
  var __vue_staticRenderFns__ = [];
316
325
 
317
326
  /* style */