@gitlab/ui 32.14.0 → 32.18.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 (23) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/skeleton_loading/skeleton_loading.documentation.js +2 -14
  3. package/dist/components/base/skeleton_loading/skeleton_loading.js +3 -0
  4. package/dist/components/charts/stacked_column/stacked_column.js +16 -6
  5. package/dist/index.css +2 -2
  6. package/dist/index.css.map +1 -1
  7. package/documentation/documented_stories.js +1 -0
  8. package/package.json +11 -11
  9. package/src/components/base/datepicker/datepicker.scss +14 -1
  10. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.spec.js +2 -2
  11. package/src/components/base/skeleton_loading/skeleton_loading.documentation.js +0 -11
  12. package/src/components/base/skeleton_loading/skeleton_loading.md +0 -2
  13. package/src/components/base/skeleton_loading/skeleton_loading.stories.js +30 -18
  14. package/src/components/base/skeleton_loading/skeleton_loading.vue +3 -0
  15. package/src/components/charts/stacked_column/__snapshots__/stacked_column.spec.js.snap +256 -0
  16. package/src/components/charts/stacked_column/stacked_column.spec.js +42 -0
  17. package/src/components/charts/stacked_column/stacked_column.vue +13 -7
  18. package/dist/components/base/skeleton_loading/examples/index.js +0 -19
  19. package/dist/components/base/skeleton_loading/examples/skeleton_loading.basic.example.js +0 -38
  20. package/dist/components/base/skeleton_loading/examples/skeleton_loading.one_line.example.js +0 -38
  21. package/src/components/base/skeleton_loading/examples/index.js +0 -22
  22. package/src/components/base/skeleton_loading/examples/skeleton_loading.basic.example.vue +0 -3
  23. package/src/components/base/skeleton_loading/examples/skeleton_loading.one_line.example.vue +0 -3
@@ -83,6 +83,7 @@ export const setupStorybookReadme = () =>
83
83
  'GlPath',
84
84
  'GlFriendlyWrap',
85
85
  'GlLoadingIcon',
86
+ 'GlDeprecatedSkeletonLoading',
86
87
  ],
87
88
  components: {
88
89
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.14.0",
3
+ "version": "32.18.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@babel/standalone": "^7.0.0",
61
- "bootstrap-vue": "2.18.1",
61
+ "bootstrap-vue": "2.19.0",
62
62
  "copy-to-clipboard": "^3.0.8",
63
63
  "dompurify": "^2.3.3",
64
64
  "echarts": "^4.9.0",
@@ -88,15 +88,15 @@
88
88
  "@rollup/plugin-commonjs": "^11.1.0",
89
89
  "@rollup/plugin-node-resolve": "^7.1.3",
90
90
  "@rollup/plugin-replace": "^2.3.2",
91
- "@storybook/addon-a11y": "6.3.6",
92
- "@storybook/addon-docs": "6.3.6",
93
- "@storybook/addon-essentials": "6.3.6",
94
- "@storybook/addon-knobs": "6.2.9",
95
- "@storybook/addon-storyshots": "6.3.6",
96
- "@storybook/addon-storyshots-puppeteer": "6.3.6",
97
- "@storybook/addon-viewport": "6.3.6",
98
- "@storybook/theming": "6.3.6",
99
- "@storybook/vue": "6.3.6",
91
+ "@storybook/addon-a11y": "6.3.9",
92
+ "@storybook/addon-docs": "6.3.9",
93
+ "@storybook/addon-essentials": "6.3.9",
94
+ "@storybook/addon-knobs": "6.3.1",
95
+ "@storybook/addon-storyshots": "6.3.9",
96
+ "@storybook/addon-storyshots-puppeteer": "6.3.9",
97
+ "@storybook/addon-viewport": "6.3.9",
98
+ "@storybook/theming": "6.3.9",
99
+ "@storybook/vue": "6.3.9",
100
100
  "@vue/test-utils": "1.1.3",
101
101
  "autoprefixer": "^9.7.6",
102
102
  "babel-jest": "^26.6.3",
@@ -72,6 +72,15 @@ $gl-datepicker-width: $grid-size * 30;
72
72
  @include gl-bg-size-100p;
73
73
  @include gl-w-5;
74
74
  @include gl-h-5;
75
+
76
+ &:hover {
77
+ @include gl-rounded-small;
78
+ @include gl-bg-gray-50;
79
+ }
80
+
81
+ &.is-disabled {
82
+ @include gl-cursor-not-allowed;
83
+ }
75
84
  }
76
85
 
77
86
  .pika-next {
@@ -84,8 +93,12 @@ $gl-datepicker-width: $grid-size * 30;
84
93
 
85
94
  .pika-label {
86
95
  @include gl-font-base;
87
- @include gl-line-height-normal;
88
96
  @include gl-py-0;
97
+
98
+ &:hover {
99
+ @include gl-rounded-small;
100
+ @include gl-bg-gray-50;
101
+ }
89
102
  }
90
103
 
91
104
  .pika-select {
@@ -257,8 +257,8 @@ describe('GlFormCheckboxTree', () => {
257
257
  expect(toggleAllCheckbox.element.indeterminate).toBe(indeterminate);
258
258
  });
259
259
 
260
- it('once toggled, puts all checkboxes in the correct state', () => {
261
- toggleAllCheckbox.trigger('click');
260
+ it('once toggled, puts all checkboxes in the correct state', async () => {
261
+ await toggleAllCheckbox.trigger('click');
262
262
  return wrapper.vm.$nextTick(() => {
263
263
  findCheckboxes().wrappers.forEach((checkbox) => {
264
264
  expect(findCheckboxInput(checkbox).element.checked).toBe(finallyChecked);
@@ -1,16 +1,5 @@
1
- import examples from './examples';
2
1
  import description from './skeleton_loading.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
- propsInfo: {
8
- lines: {
9
- validation: {
10
- type: 'range',
11
- min: 1,
12
- max: 3,
13
- },
14
- },
15
- },
16
5
  };
@@ -1,5 +1,3 @@
1
- # (Deprecated) Skeleton Loading
2
-
3
1
  The Skeleton Loading component has been deprecated, please use [Skeleton Loader](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-skeleton-loader--default).
4
2
 
5
3
  How to replace this component with [Skeleton Loader](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-skeleton-loader--default):
@@ -1,5 +1,3 @@
1
- import { withKnobs, number } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { GlDeprecatedSkeletonLoading } from '../../../../index';
4
2
  import readme from './skeleton_loading.md';
5
3
 
@@ -11,22 +9,36 @@ const template = '<gl-deprecated-skeleton-loading :lines="lines" />';
11
9
 
12
10
  function generateProps() {
13
11
  return {
14
- lines: {
15
- type: Number,
16
- default: number('lines', 3, {
17
- range: true,
18
- min: 1,
19
- max: 3,
20
- step: 1,
21
- }),
22
- },
12
+ lines: 3,
23
13
  };
24
14
  }
25
15
 
26
- documentedStoriesOf('base/skeleton-loading', readme)
27
- .addDecorator(withKnobs)
28
- .add('default', () => ({
29
- props: generateProps(),
30
- components,
31
- template,
32
- }));
16
+ const Template = (args) => ({
17
+ components,
18
+ props: Object.keys(args),
19
+ template,
20
+ });
21
+
22
+ export const Default = Template.bind({});
23
+ Default.args = generateProps();
24
+
25
+ export default {
26
+ title: 'base/skeleton loading',
27
+ component: GlDeprecatedSkeletonLoading,
28
+ parameters: {
29
+ docs: {
30
+ description: {
31
+ component: readme,
32
+ },
33
+ },
34
+ knobs: { disable: true },
35
+ },
36
+ argTypes: {
37
+ lines: {
38
+ control: {
39
+ type: 'select',
40
+ options: [1, 2, 3],
41
+ },
42
+ },
43
+ },
44
+ };
@@ -1,6 +1,9 @@
1
1
  <script>
2
2
  export default {
3
3
  props: {
4
+ /**
5
+ * Controls the number of lines.
6
+ */
4
7
  lines: {
5
8
  type: Number,
6
9
  required: false,
@@ -1,5 +1,261 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`stacked column chart component color palette custom palette matches the snapshot 1`] = `
4
+ Object {
5
+ "grid": Object {
6
+ "bottom": 44,
7
+ "left": 64,
8
+ "right": 32,
9
+ "top": 16,
10
+ },
11
+ "legend": Object {
12
+ "show": false,
13
+ },
14
+ "series": Array [
15
+ Object {
16
+ "barMaxWidth": "50%",
17
+ "data": Array [
18
+ 58,
19
+ 49,
20
+ 38,
21
+ 23,
22
+ 27,
23
+ 68,
24
+ 38,
25
+ 35,
26
+ 7,
27
+ 64,
28
+ 65,
29
+ 31,
30
+ ],
31
+ "emphasis": Object {
32
+ "itemStyle": Object {
33
+ "color": "rgba(255, undefined, undefined, 0.4)",
34
+ },
35
+ },
36
+ "itemStyle": Object {
37
+ "barBorderColor": "#FFFHHH",
38
+ "barBorderWidth": 1,
39
+ "color": "rgba(255, undefined, undefined, 0.2)",
40
+ },
41
+ "name": "Fun 1",
42
+ "stack": Array [
43
+ "Jan",
44
+ "Feb",
45
+ "Mar",
46
+ "Apr",
47
+ "May",
48
+ "Jun",
49
+ "Jul",
50
+ "Aug",
51
+ "Sep",
52
+ "Oct",
53
+ "Nov",
54
+ "Dec",
55
+ ],
56
+ "type": "bar",
57
+ "yAxisIndex": 0,
58
+ },
59
+ Object {
60
+ "barMaxWidth": "50%",
61
+ "data": Array [
62
+ 8,
63
+ 6,
64
+ 34,
65
+ 19,
66
+ 9,
67
+ 7,
68
+ 17,
69
+ 25,
70
+ 14,
71
+ 7,
72
+ 10,
73
+ 32,
74
+ ],
75
+ "emphasis": Object {
76
+ "itemStyle": Object {
77
+ "color": "rgba(255, undefined, undefined, 0.4)",
78
+ },
79
+ },
80
+ "itemStyle": Object {
81
+ "barBorderColor": "#FFFJJJ",
82
+ "barBorderWidth": 1,
83
+ "color": "rgba(255, undefined, undefined, 0.2)",
84
+ },
85
+ "name": "Fun 2",
86
+ "stack": Array [
87
+ "Jan",
88
+ "Feb",
89
+ "Mar",
90
+ "Apr",
91
+ "May",
92
+ "Jun",
93
+ "Jul",
94
+ "Aug",
95
+ "Sep",
96
+ "Oct",
97
+ "Nov",
98
+ "Dec",
99
+ ],
100
+ "type": "bar",
101
+ "yAxisIndex": 0,
102
+ },
103
+ Object {
104
+ "barMaxWidth": "50%",
105
+ "data": Array [
106
+ 67,
107
+ 60,
108
+ 66,
109
+ 32,
110
+ 61,
111
+ 54,
112
+ 13,
113
+ 50,
114
+ 16,
115
+ 11,
116
+ 47,
117
+ 28,
118
+ ],
119
+ "emphasis": Object {
120
+ "itemStyle": Object {
121
+ "color": "rgba(255, undefined, undefined, 0.4)",
122
+ },
123
+ },
124
+ "itemStyle": Object {
125
+ "barBorderColor": "#FFFIII",
126
+ "barBorderWidth": 1,
127
+ "color": "rgba(255, undefined, undefined, 0.2)",
128
+ },
129
+ "name": "Fun 3",
130
+ "stack": Array [
131
+ "Jan",
132
+ "Feb",
133
+ "Mar",
134
+ "Apr",
135
+ "May",
136
+ "Jun",
137
+ "Jul",
138
+ "Aug",
139
+ "Sep",
140
+ "Oct",
141
+ "Nov",
142
+ "Dec",
143
+ ],
144
+ "type": "bar",
145
+ "yAxisIndex": 0,
146
+ },
147
+ Object {
148
+ "barMaxWidth": "50%",
149
+ "data": Array [
150
+ 8,
151
+ 9,
152
+ 5,
153
+ 40,
154
+ 13,
155
+ 19,
156
+ 58,
157
+ 21,
158
+ 47,
159
+ 59,
160
+ 23,
161
+ 46,
162
+ ],
163
+ "emphasis": Object {
164
+ "itemStyle": Object {
165
+ "color": "rgba(255, undefined, undefined, 0.4)",
166
+ },
167
+ },
168
+ "itemStyle": Object {
169
+ "barBorderColor": "#FFFKKK",
170
+ "barBorderWidth": 1,
171
+ "color": "rgba(255, undefined, undefined, 0.2)",
172
+ },
173
+ "name": "Fun 4",
174
+ "stack": Array [
175
+ "Jan",
176
+ "Feb",
177
+ "Mar",
178
+ "Apr",
179
+ "May",
180
+ "Jun",
181
+ "Jul",
182
+ "Aug",
183
+ "Sep",
184
+ "Oct",
185
+ "Nov",
186
+ "Dec",
187
+ ],
188
+ "type": "bar",
189
+ "yAxisIndex": 0,
190
+ },
191
+ ],
192
+ "xAxis": Object {
193
+ "axisLabel": Object {
194
+ "margin": 20,
195
+ "verticalAlign": "bottom",
196
+ },
197
+ "axisLine": Object {
198
+ "show": false,
199
+ },
200
+ "axisPointer": Object {
201
+ "label": Object {
202
+ "formatter": [Function],
203
+ },
204
+ "show": true,
205
+ "type": "none",
206
+ },
207
+ "boundaryGap": true,
208
+ "data": Array [
209
+ "Jan",
210
+ "Feb",
211
+ "Mar",
212
+ "Apr",
213
+ "May",
214
+ "Jun",
215
+ "Jul",
216
+ "Aug",
217
+ "Sep",
218
+ "Oct",
219
+ "Nov",
220
+ "Dec",
221
+ ],
222
+ "name": "January - December 2018",
223
+ "nameLocation": "center",
224
+ "splitLine": Object {
225
+ "show": false,
226
+ },
227
+ "type": "category",
228
+ },
229
+ "yAxis": Array [
230
+ Object {
231
+ "axisLabel": Object {
232
+ "formatter": [Function],
233
+ },
234
+ "axisTick": Object {
235
+ "show": false,
236
+ },
237
+ "name": "Commits",
238
+ "nameGap": 50,
239
+ "nameLocation": "center",
240
+ "type": "value",
241
+ },
242
+ Object {
243
+ "axisLabel": Object {
244
+ "formatter": [Function],
245
+ },
246
+ "axisTick": Object {
247
+ "show": false,
248
+ },
249
+ "name": "",
250
+ "nameGap": 50,
251
+ "nameLocation": "center",
252
+ "show": false,
253
+ "type": "value",
254
+ },
255
+ ],
256
+ }
257
+ `;
258
+
3
259
  exports[`stacked column chart component should correctly render the chart 1`] = `
4
260
  Object {
5
261
  "grid": Object {
@@ -7,6 +7,7 @@ import {
7
7
  } from '../../../utils/charts/mock_data';
8
8
  import Chart from '../chart/chart.vue';
9
9
  import ChartLegend from '../legend/legend.vue';
10
+ import * as themeUtils from '../../../utils/charts/theme';
10
11
  import StackedColumnChart from './stacked_column.vue';
11
12
  import ChartTooltip from '~/components/charts/tooltip/tooltip.vue';
12
13
  import TooltipDefaultFormat from '~/components/shared_components/charts/tooltip_default_format.vue';
@@ -73,6 +74,7 @@ describe('stacked column chart component', () => {
73
74
 
74
75
  afterEach(() => {
75
76
  wrapper.destroy();
77
+ jest.restoreAllMocks();
76
78
  });
77
79
 
78
80
  it('emits `created`, with the chart instance', () => {
@@ -85,6 +87,8 @@ describe('stacked column chart component', () => {
85
87
  });
86
88
 
87
89
  it('should correctly render the chart', () => {
90
+ createShallowWrapper();
91
+
88
92
  const chart = findChart();
89
93
 
90
94
  expect(chart.props('options')).toMatchSnapshot();
@@ -256,4 +260,42 @@ describe('stacked column chart component', () => {
256
260
  });
257
261
  });
258
262
  });
263
+
264
+ describe('color palette', () => {
265
+ let paletteSpy;
266
+
267
+ describe('default palette', () => {
268
+ beforeEach(() => {
269
+ paletteSpy = jest.spyOn(themeUtils, 'colorFromDefaultPalette');
270
+
271
+ createShallowWrapper();
272
+ });
273
+
274
+ it('calls colorFromDefaultPalette', () => {
275
+ expect(paletteSpy).toHaveBeenCalled();
276
+ });
277
+ });
278
+
279
+ describe('custom palette', () => {
280
+ beforeEach(() => {
281
+ paletteSpy = jest.spyOn(themeUtils, 'colorFromDefaultPalette');
282
+
283
+ createShallowWrapper({
284
+ props: {
285
+ customPalette: ['#FFFHHH', '#FFFJJJ', '#FFFIII', '#FFFKKK'],
286
+ },
287
+ });
288
+ });
289
+
290
+ it('does not call colorFromDefaultPalette', () => {
291
+ expect(paletteSpy).not.toHaveBeenCalled();
292
+ });
293
+
294
+ it('matches the snapshot', () => {
295
+ const chart = findChart();
296
+
297
+ expect(chart.props('options')).toMatchSnapshot();
298
+ });
299
+ });
300
+ });
259
301
  });
@@ -131,6 +131,11 @@ export default {
131
131
  required: false,
132
132
  default: null,
133
133
  },
134
+ customPalette: {
135
+ type: Array,
136
+ required: false,
137
+ default: null,
138
+ },
134
139
  },
135
140
  data() {
136
141
  return {
@@ -152,21 +157,21 @@ export default {
152
157
  barSeries() {
153
158
  return this.bars.map(({ name, data }, index) => {
154
159
  const stack = this.presentation === 'stacked' ? this.groupBy : null;
155
- const color = colorFromDefaultPalette(index);
160
+ const color = this.getColor(index);
156
161
  return generateBarSeries({ stack, name, data, color });
157
162
  });
158
163
  },
159
164
  lineSeries() {
160
165
  const offset = this.bars.length;
161
166
  return this.lines.map(({ name, data }, index) => {
162
- const color = colorFromDefaultPalette(offset + index);
167
+ const color = this.getColor(offset + index);
163
168
  return generateLineSeries({ name, data, color });
164
169
  });
165
170
  },
166
171
  secondarySeries() {
167
172
  const offset = this.bars.length + this.lines.length;
168
173
  return this.secondaryData.map(({ name, data, type, stack = columnOptions.tiled }, index) => {
169
- const color = colorFromDefaultPalette(offset + index);
174
+ const color = this.getColor(offset + index);
170
175
  return type === CHART_TYPE_LINE
171
176
  ? generateLineSeries({ color, name, data, yAxisIndex: 1 })
172
177
  : generateBarSeries({ color, name, data, yAxisIndex: 1, stack });
@@ -235,7 +240,7 @@ export default {
235
240
  acc.push({
236
241
  name: series.name,
237
242
  type: series.type,
238
- color: colorFromDefaultPalette(index),
243
+ color: this.getColor(index),
239
244
  data: series.data.map((data) => data),
240
245
  yAxisIndex: series.yAxisIndex,
241
246
  });
@@ -248,6 +253,9 @@ export default {
248
253
  this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
249
254
  },
250
255
  methods: {
256
+ getColor(index) {
257
+ return this.customPalette ? this.customPalette?.[index] : colorFromDefaultPalette(index);
258
+ },
251
259
  moveShowTooltip(mouseEvent) {
252
260
  this.tooltipPosition = {
253
261
  left: `${mouseEvent.zrX}px`,
@@ -264,12 +272,10 @@ export default {
264
272
  defaultFormatTooltipText(params) {
265
273
  const { tooltipContent } = params.seriesData.reverse().reduce(
266
274
  (acc, bar) => {
267
- const barColor = colorFromDefaultPalette(bar.seriesIndex);
268
-
269
275
  acc.tooltipContent[bar.seriesName] = {
270
276
  value: bar.value,
271
277
  index: bar.seriesIndex,
272
- color: barColor,
278
+ color: this.getColor(bar.seriesIndex),
273
279
  };
274
280
 
275
281
  return acc;
@@ -1,19 +0,0 @@
1
- import SkeletonLoadingBasicExample from './skeleton_loading.basic.example';
2
- import SkeletonLoadingOneLineExample from './skeleton_loading.one_line.example';
3
-
4
- var index = [{
5
- name: 'Basic',
6
- items: [{
7
- id: 'skeleton-loader-basic',
8
- name: 'Basic',
9
- description: 'Basic Skeleton Loader',
10
- component: SkeletonLoadingBasicExample
11
- }, {
12
- id: 'skeleton-loader-single-line',
13
- name: 'One Line',
14
- description: 'Skeleton Loader with one line',
15
- component: SkeletonLoadingOneLineExample
16
- }]
17
- }];
18
-
19
- export default index;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-deprecated-skeleton-loading')};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-deprecated-skeleton-loading',{attrs:{"lines":1}})};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;