@gitlab/ui 52.3.0 → 52.4.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.
@@ -15,6 +15,7 @@ const defaultFontSize = 12;
15
15
  const defaultHeight = 400;
16
16
  const defaultWidth = 300;
17
17
  const validRenderers = ['canvas', 'svg'];
18
+ const toolboxHeight = 14;
18
19
  const axes = {
19
20
  name: 'Value',
20
21
  type: 'value',
@@ -504,4 +505,4 @@ const getDefaultTooltipContent = function (params) {
504
505
  };
505
506
  };
506
507
 
507
- export { annotationsYAxisCoords, axes, dataZoomAdjustments, defaultAreaOpacity, defaultChartOptions, defaultFontSize, defaultHeight, defaultWidth, generateAnnotationSeries, generateBarSeries, generateLineSeries, getAnnotationsConfig, getDataZoomConfig, getDefaultTooltipContent, getThresholdConfig, grid, gridWithSecondaryYAxis, lineStyle, mergeAnnotationAxisToOptions, mergeSeriesToOptions, parseAnnotations, symbolSize, validRenderers, xAxis, yAxis };
508
+ export { annotationsYAxisCoords, axes, dataZoomAdjustments, defaultAreaOpacity, defaultChartOptions, defaultFontSize, defaultHeight, defaultWidth, generateAnnotationSeries, generateBarSeries, generateLineSeries, getAnnotationsConfig, getDataZoomConfig, getDefaultTooltipContent, getThresholdConfig, grid, gridWithSecondaryYAxis, lineStyle, mergeAnnotationAxisToOptions, mergeSeriesToOptions, parseAnnotations, symbolSize, toolboxHeight, validRenderers, xAxis, yAxis };
@@ -1,6 +1,7 @@
1
1
  import { scrollHandleSvgPath } from '../svgs/svg_paths';
2
2
  import { hexToRgba } from '../utils';
3
3
 
4
+ const white = '#fff';
4
5
  const whiteNormal = '#f0f0f0';
5
6
  const red500 = '#dd2b0e';
6
7
  const gray50 = '#ececef';
@@ -42,6 +43,7 @@ const dataVizOrange700 = '#92430a';
42
43
  const dataVizOrange800 = '#6f3500';
43
44
  const dataVizOrange900 = '#5e2f05';
44
45
  const dataVizOrange950 = '#4b2707';
46
+ const glBorderRadiusBase = '0.25rem';
45
47
 
46
48
  const themeName = 'gitlab';
47
49
  const heatmapHues = [gray100, dataVizBlue200, dataVizBlue400, dataVizBlue600, dataVizBlue800];
@@ -163,7 +165,10 @@ const createTheme = function () {
163
165
  emphasis: {
164
166
  iconStyle: {
165
167
  borderWidth: 0,
166
- color: gray900
168
+ color: gray900,
169
+ textBackgroundColor: white,
170
+ textBorderRadius: glBorderRadiusBase,
171
+ textPadding: [8, 12]
167
172
  }
168
173
  },
169
174
  iconStyle: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "52.3.0",
3
+ "version": "52.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -91,14 +91,14 @@
91
91
  "@rollup/plugin-commonjs": "^11.1.0",
92
92
  "@rollup/plugin-node-resolve": "^7.1.3",
93
93
  "@rollup/plugin-replace": "^2.3.2",
94
- "@storybook/addon-a11y": "6.5.13",
95
- "@storybook/addon-docs": "6.5.13",
96
- "@storybook/addon-essentials": "6.5.13",
97
- "@storybook/addon-storyshots": "6.5.13",
98
- "@storybook/addon-storyshots-puppeteer": "6.5.13",
99
- "@storybook/addon-viewport": "6.5.13",
100
- "@storybook/theming": "6.5.13",
101
- "@storybook/vue": "6.5.13",
94
+ "@storybook/addon-a11y": "6.5.14",
95
+ "@storybook/addon-docs": "6.5.14",
96
+ "@storybook/addon-essentials": "6.5.14",
97
+ "@storybook/addon-storyshots": "6.5.14",
98
+ "@storybook/addon-storyshots-puppeteer": "6.5.14",
99
+ "@storybook/addon-viewport": "6.5.14",
100
+ "@storybook/theming": "6.5.14",
101
+ "@storybook/vue": "6.5.14",
102
102
  "@vue/compat": "^3.2.40",
103
103
  "@vue/compiler-sfc": "^3.2.40",
104
104
  "@vue/test-utils": "1.3.0",
@@ -1,5 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import * as echarts from 'echarts';
3
+ import { toolboxHeight } from '~/utils/charts/config';
3
4
  import { createTheme } from '~/utils/charts/theme';
4
5
  import { useMockResizeObserver } from '~helpers/mock_dom_observer';
5
6
  import Chart from './chart.vue';
@@ -118,8 +119,11 @@ describe('chart component', () => {
118
119
 
119
120
  describe('draw method', () => {
120
121
  it('sets chart options', () => {
122
+ expect(wrapper.vm.chart.setOption).toHaveBeenCalledTimes(1);
123
+
121
124
  wrapper.vm.draw();
122
125
 
126
+ expect(wrapper.vm.chart.setOption).toHaveBeenCalledTimes(2);
123
127
  expect(wrapper.vm.chart.setOption).toHaveBeenCalledWith(options);
124
128
  });
125
129
 
@@ -142,4 +146,17 @@ describe('chart component', () => {
142
146
  });
143
147
  });
144
148
  });
149
+
150
+ describe('with toolbox in options', () => {
151
+ it('increases grid top by `toolboxHeight`', async () => {
152
+ const optionsWithToolbox = { toolbox: {} };
153
+ wrapper = shallowMount(Chart, { propsData: { options: optionsWithToolbox } });
154
+ await wrapper.vm.$nextTick();
155
+
156
+ expect(wrapper.vm.chart.setOption).toHaveBeenCalledWith({
157
+ ...optionsWithToolbox,
158
+ grid: { top: toolboxHeight },
159
+ });
160
+ });
161
+ });
145
162
  });
@@ -1,7 +1,12 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
3
  import * as echarts from 'echarts';
4
- import { defaultHeight, defaultWidth, validRenderers } from '../../../utils/charts/config';
4
+ import {
5
+ defaultHeight,
6
+ defaultWidth,
7
+ validRenderers,
8
+ toolboxHeight,
9
+ } from '../../../utils/charts/config';
5
10
  import { createTheme, themeName } from '../../../utils/charts/theme';
6
11
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
7
12
 
@@ -11,6 +16,16 @@ import { GlResizeObserverDirective } from '../../../directives/resize_observer/r
11
16
  */
12
17
  const sizeValidator = (size) => Number.isFinite(size) || size === 'auto' || size == null;
13
18
 
19
+ const isChartWithToolbox = (options) => options?.toolbox !== undefined;
20
+
21
+ const increaseChartGridTop = (options, increaseBy) => ({
22
+ ...options,
23
+ grid: {
24
+ ...options.grid,
25
+ top: (options?.grid?.top || 0) + increaseBy,
26
+ },
27
+ });
28
+
14
29
  export default {
15
30
  directives: {
16
31
  resizeObserver: GlResizeObserverDirective,
@@ -78,6 +93,13 @@ export default {
78
93
  chart: null,
79
94
  };
80
95
  },
96
+ computed: {
97
+ normalizedOptions() {
98
+ return isChartWithToolbox(this.options)
99
+ ? increaseChartGridTop(this.options, toolboxHeight)
100
+ : this.options;
101
+ },
102
+ },
81
103
  watch: {
82
104
  options() {
83
105
  if (this.chart) {
@@ -123,7 +145,7 @@ export default {
123
145
  },
124
146
  methods: {
125
147
  draw() {
126
- this.chart.setOption(this.options);
148
+ this.chart.setOption(this.normalizedOptions);
127
149
  /**
128
150
  * Emitted after calling `echarts.setOption`
129
151
  */
@@ -4939,6 +4939,14 @@
4939
4939
  min-height: $gl-spacing-scale-8 !important;
4940
4940
  }
4941
4941
 
4942
+ .gl-max-w-0 {
4943
+ max-width: 0;
4944
+ }
4945
+
4946
+ .gl-max-w-0\! {
4947
+ max-width: 0 !important;
4948
+ }
4949
+
4942
4950
  .gl-max-w-15 {
4943
4951
  max-width: $gl-spacing-scale-15;
4944
4952
  }
@@ -354,6 +354,10 @@
354
354
  min-height: $gl-spacing-scale-8;
355
355
  }
356
356
 
357
+ @mixin gl-max-w-0 {
358
+ max-width: 0;
359
+ }
360
+
357
361
  @mixin gl-max-w-15 {
358
362
  max-width: $gl-spacing-scale-15;
359
363
  }
@@ -14,6 +14,7 @@ export const defaultFontSize = 12;
14
14
  export const defaultHeight = 400;
15
15
  export const defaultWidth = 300;
16
16
  export const validRenderers = ['canvas', 'svg'];
17
+ export const toolboxHeight = 14;
17
18
 
18
19
  export const axes = {
19
20
  name: 'Value',
@@ -40,6 +40,8 @@ import {
40
40
  dataVizOrange800,
41
41
  dataVizOrange950,
42
42
  dataVizOrange900,
43
+ glBorderRadiusBase,
44
+ white,
43
45
  } from '../../../scss_to_js/scss_variables';
44
46
  import { scrollHandleSvgPath } from '../svgs/svg_paths';
45
47
  import { hexToRgba } from '../utils';
@@ -209,6 +211,9 @@ export const createTheme = (options = {}) => ({
209
211
  iconStyle: {
210
212
  borderWidth: 0,
211
213
  color: gray900,
214
+ textBackgroundColor: white,
215
+ textBorderRadius: glBorderRadiusBase,
216
+ textPadding: [8, 12],
212
217
  },
213
218
  },
214
219
  iconStyle: {