@gitlab/ui 40.4.0 → 40.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "40.4.0",
3
+ "version": "40.6.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -87,15 +87,15 @@
87
87
  "@rollup/plugin-commonjs": "^11.1.0",
88
88
  "@rollup/plugin-node-resolve": "^7.1.3",
89
89
  "@rollup/plugin-replace": "^2.3.2",
90
- "@storybook/addon-a11y": "6.4.22",
91
- "@storybook/addon-docs": "6.4.22",
92
- "@storybook/addon-essentials": "6.4.22",
90
+ "@storybook/addon-a11y": "6.5.0",
91
+ "@storybook/addon-docs": "6.5.0",
92
+ "@storybook/addon-essentials": "6.5.0",
93
93
  "@storybook/addon-knobs": "6.4.0",
94
- "@storybook/addon-storyshots": "6.4.22",
95
- "@storybook/addon-storyshots-puppeteer": "6.4.22",
96
- "@storybook/addon-viewport": "6.4.22",
97
- "@storybook/theming": "6.4.22",
98
- "@storybook/vue": "6.4.22",
94
+ "@storybook/addon-storyshots": "6.5.0",
95
+ "@storybook/addon-storyshots-puppeteer": "6.5.0",
96
+ "@storybook/addon-viewport": "6.5.0",
97
+ "@storybook/theming": "6.5.0",
98
+ "@storybook/vue": "6.5.0",
99
99
  "@vue/test-utils": "1.3.0",
100
100
  "autoprefixer": "^9.7.6",
101
101
  "babel-jest": "^26.6.3",
@@ -10,12 +10,13 @@ describe('toggle', () => {
10
10
  const label = 'toggle label';
11
11
  const helpText = 'help text';
12
12
 
13
- const createWrapper = (props = {}) => {
13
+ const createWrapper = (props = {}, options = {}) => {
14
14
  wrapper = shallowMount(Toggle, {
15
15
  propsData: {
16
16
  label,
17
17
  ...props,
18
18
  },
19
+ ...options,
19
20
  });
20
21
  };
21
22
 
@@ -85,12 +86,13 @@ describe('toggle', () => {
85
86
  });
86
87
 
87
88
  describe.each`
88
- state | help | getAriaDescribedBy
89
- ${'with help'} | ${helpText} | ${() => findHelpElement().attributes('id')}
90
- ${'without help'} | ${undefined} | ${() => undefined}
91
- `('$state', ({ help, getAriaDescribedBy }) => {
89
+ state | help | props | options | getAriaDescribedBy
90
+ ${'with help'} | ${helpText} | ${{ help: helpText }} | ${undefined} | ${() => findHelpElement().attributes('id')}
91
+ ${'with help in slot'} | ${helpText} | ${undefined} | ${{ slots: { help: helpText } }} | ${() => findHelpElement().attributes('id')}
92
+ ${'without help'} | ${undefined} | ${undefined} | ${undefined} | ${() => undefined}
93
+ `('$state', ({ help, props, options, getAriaDescribedBy }) => {
92
94
  beforeEach(() => {
93
- createWrapper({ help });
95
+ createWrapper(props, options);
94
96
  });
95
97
 
96
98
  it(`${help ? 'shows' : 'does not show'} help`, () => {
@@ -81,11 +81,14 @@ export default {
81
81
  };
82
82
  },
83
83
  computed: {
84
+ shouldRenderHelp() {
85
+ return Boolean(this.$slots.help || this.help);
86
+ },
84
87
  icon() {
85
88
  return this.value ? 'mobile-issue-close' : 'close';
86
89
  },
87
90
  helpId() {
88
- return this.help ? `toggle-help-${this.uuid}` : undefined;
91
+ return this.shouldRenderHelp ? `toggle-help-${this.uuid}` : undefined;
89
92
  },
90
93
  isChecked() {
91
94
  return this.value ? 'true' : 'false';
@@ -146,7 +149,7 @@ export default {
146
149
  <gl-icon :name="icon" :size="16" />
147
150
  </span>
148
151
  </button>
149
- <span v-if="help" :id="helpId" class="gl-help-label" data-testid="toggle-help">
152
+ <span v-if="shouldRenderHelp" :id="helpId" class="gl-help-label" data-testid="toggle-help">
150
153
  <!-- @slot A help text to be shown below the toggle. -->
151
154
  <slot name="help">{{ help }}</slot>
152
155
  </span>
@@ -195,5 +195,14 @@ describe('line component', () => {
195
195
 
196
196
  expect(findLegend().props('layout')).toBe(LEGEND_LAYOUT_TABLE);
197
197
  });
198
+ it('can be hidden', async () => {
199
+ createShallowWrapper({
200
+ showLegend: false,
201
+ });
202
+
203
+ await wrapper.vm.$nextTick();
204
+
205
+ expect(findLegend().exists()).toBe(false);
206
+ });
198
207
  });
199
208
  });
@@ -62,6 +62,7 @@ const template = `<gl-line-chart
62
62
  :thresholds="thresholds"
63
63
  :annotations="annotations"
64
64
  :includeLegendAvgMax="includeLegendAvgMax"
65
+ :showLegend="showLegend"
65
66
  />`;
66
67
 
67
68
  const generateProps = ({
@@ -70,7 +71,9 @@ const generateProps = ({
70
71
  thresholds = [],
71
72
  annotations = [],
72
73
  includeLegendAvgMax = true,
74
+ showLegend = true,
73
75
  } = {}) => ({
76
+ showLegend,
74
77
  includeLegendAvgMax,
75
78
  option,
76
79
  thresholds,
@@ -173,6 +176,27 @@ WithToolbox.args = generateProps({
173
176
  },
174
177
  });
175
178
 
179
+ export const NoLegend = Template.bind({});
180
+ NoLegend.args = generateProps({
181
+ data: [
182
+ {
183
+ name: 'Time Series',
184
+ data: generateTimeSeries(),
185
+ },
186
+ ],
187
+ option: {
188
+ animation: false,
189
+ xAxis: {
190
+ type: 'time',
191
+ name: 'Time',
192
+ axisLabel: {
193
+ formatter: timeSeriesDateFormatter,
194
+ },
195
+ },
196
+ },
197
+ showLegend: false,
198
+ });
199
+
176
200
  export default {
177
201
  title: 'charts/line-chart',
178
202
  component: GlLineChart,
@@ -117,6 +117,11 @@ export default {
117
117
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
118
118
  },
119
119
  },
120
+ showLegend: {
121
+ type: Boolean,
122
+ required: false,
123
+ default: true,
124
+ },
120
125
  },
121
126
  data() {
122
127
  // Part of the tooltip related data can be
@@ -230,6 +235,9 @@ export default {
230
235
  legendStyle() {
231
236
  return { paddingLeft: `${grid.left}px` };
232
237
  },
238
+ hasLegend() {
239
+ return this.compiledOptions && this.showLegend;
240
+ },
233
241
  seriesInfo() {
234
242
  return this.compiledOptions.series.reduce((acc, series, index) => {
235
243
  if (series.type === 'line') {
@@ -366,7 +374,7 @@ export default {
366
374
  <tooltip-default-format v-else :tooltip-content="dataTooltipContent" />
367
375
  </chart-tooltip>
368
376
  <chart-legend
369
- v-if="compiledOptions"
377
+ v-if="hasLegend"
370
378
  :chart="chart"
371
379
  :style="legendStyle"
372
380
  :series-info="seriesInfo"
@@ -418,6 +418,14 @@
418
418
  background-color: $purple-50 !important
419
419
  }
420
420
 
421
+ .gl-bg-purple-800 {
422
+ background-color: $purple-800
423
+ }
424
+
425
+ .gl-bg-purple-800\! {
426
+ background-color: $purple-800 !important
427
+ }
428
+
421
429
  .gl-bg-red-50 {
422
430
  background-color: $red-50
423
431
  }
@@ -1197,6 +1205,14 @@
1197
1205
  border-color: $blue-700 !important;
1198
1206
  }
1199
1207
 
1208
+ .gl-border-purple-700 {
1209
+ border-color: $purple-700;
1210
+ }
1211
+
1212
+ .gl-border-purple-700\! {
1213
+ border-color: $purple-700 !important;
1214
+ }
1215
+
1200
1216
  .gl-border-gray-a-08 {
1201
1217
  border-color: $t-gray-a-08;
1202
1218
  }
@@ -2475,6 +2491,14 @@
2475
2491
  color: $purple-700 !important;
2476
2492
  }
2477
2493
 
2494
+ .gl-text-purple-800 {
2495
+ color: $purple-800;
2496
+ }
2497
+
2498
+ .gl-text-purple-800\! {
2499
+ color: $purple-800 !important;
2500
+ }
2501
+
2478
2502
  .gl-text-theme-indigo-200 {
2479
2503
  color: $theme-indigo-200;
2480
2504
  }
@@ -4723,6 +4747,14 @@
4723
4747
  min-height: $gl-spacing-scale-7 !important;
4724
4748
  }
4725
4749
 
4750
+ .gl-min-h-8 {
4751
+ min-height: $gl-spacing-scale-8;
4752
+ }
4753
+
4754
+ .gl-min-h-8\! {
4755
+ min-height: $gl-spacing-scale-8 !important;
4756
+ }
4757
+
4726
4758
  .gl-max-w-15 {
4727
4759
  max-width: $gl-spacing-scale-15;
4728
4760
  }
@@ -146,6 +146,10 @@
146
146
  background-color: $purple-50;
147
147
  }
148
148
 
149
+ @mixin gl-bg-purple-800 {
150
+ background-color: $purple-800;
151
+ }
152
+
149
153
  @mixin gl-bg-red-50 {
150
154
  background-color: $red-50;
151
155
  }
@@ -147,6 +147,10 @@
147
147
  border-color: $blue-700;
148
148
  }
149
149
 
150
+ @mixin gl-border-purple-700 {
151
+ border-color: $purple-700;
152
+ }
153
+
150
154
  @mixin gl-border-gray-a-08 {
151
155
  border-color: $t-gray-a-08;
152
156
  }
@@ -193,6 +193,10 @@
193
193
  color: $purple-700;
194
194
  }
195
195
 
196
+ @mixin gl-text-purple-800 {
197
+ color: $purple-800;
198
+ }
199
+
196
200
  @mixin gl-text-theme-indigo-200 {
197
201
  color: $theme-indigo-200;
198
202
  }
@@ -329,6 +329,10 @@
329
329
  min-height: $gl-spacing-scale-7;
330
330
  }
331
331
 
332
+ @mixin gl-min-h-8 {
333
+ min-height: $gl-spacing-scale-8;
334
+ }
335
+
332
336
  @mixin gl-max-w-15 {
333
337
  max-width: $gl-spacing-scale-15;
334
338
  }