@gitlab/ui 66.27.0 → 66.29.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 +14 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +11 -0
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +6 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +15 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +1 -61
- package/src/components/base/new_dropdowns/listbox/listbox.vue +11 -0
- package/src/components/charts/discrete_scatter/discrete_scatter.spec.js +17 -0
- package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +1 -0
- package/src/components/charts/discrete_scatter/discrete_scatter.vue +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [66.29.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.28.0...v66.29.0) (2023-10-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Listbox:** Add startOpened prop ([5bb3d17](https://gitlab.com/gitlab-org/gitlab-ui/commit/5bb3d173f78f5a53d67430bbaf15c8a5366983be))
|
|
7
|
+
|
|
8
|
+
# [66.28.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.27.0...v66.28.0) (2023-10-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlDiscreteScatterChart:** Add disableTooltip prop ([cd430c2](https://gitlab.com/gitlab-org/gitlab-ui/commit/cd430c2ca17749af3c2fca21164141d80d1edd3a))
|
|
14
|
+
|
|
1
15
|
# [66.27.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.26.0...v66.27.0) (2023-10-11)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -314,6 +314,14 @@ var script = {
|
|
|
314
314
|
required: false,
|
|
315
315
|
default: POSITION_ABSOLUTE,
|
|
316
316
|
validator: strategy => [POSITION_ABSOLUTE, POSITION_FIXED].includes(strategy)
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* Opens dropdown on render
|
|
320
|
+
*/
|
|
321
|
+
startOpened: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
required: false,
|
|
324
|
+
default: false
|
|
317
325
|
}
|
|
318
326
|
},
|
|
319
327
|
data() {
|
|
@@ -496,6 +504,9 @@ var script = {
|
|
|
496
504
|
} : {})
|
|
497
505
|
},
|
|
498
506
|
mounted() {
|
|
507
|
+
if (this.startOpened) {
|
|
508
|
+
this.open();
|
|
509
|
+
}
|
|
499
510
|
this.observeScroll();
|
|
500
511
|
},
|
|
501
512
|
beforeDestroy() {
|
|
@@ -45,6 +45,11 @@ var script = {
|
|
|
45
45
|
required: false,
|
|
46
46
|
default: null
|
|
47
47
|
},
|
|
48
|
+
disableTooltip: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
default: () => false
|
|
52
|
+
},
|
|
48
53
|
/**
|
|
49
54
|
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
50
55
|
*/
|
|
@@ -168,7 +173,7 @@ const __vue_script__ = script;
|
|
|
168
173
|
/* template */
|
|
169
174
|
var __vue_render__ = function () {
|
|
170
175
|
var _obj;
|
|
171
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e()],1)};
|
|
176
|
+
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(!_vm.disableTooltip && _vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e()],1)};
|
|
172
177
|
var __vue_staticRenderFns__ = [];
|
|
173
178
|
|
|
174
179
|
/* style */
|
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@ describe('GlCollapsibleListbox', () => {
|
|
|
57
57
|
const findResetButton = () => wrapper.find("[data-testid='listbox-reset-button']");
|
|
58
58
|
const findSelectAllButton = () => wrapper.find("[data-testid='listbox-select-all-button']");
|
|
59
59
|
const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver);
|
|
60
|
+
const findDropdownMenu = () => wrapper.find("[data-testid='base-dropdown-menu']");
|
|
60
61
|
|
|
61
62
|
it('passes custom offset to the base dropdown', () => {
|
|
62
63
|
const dropdownOffset = { mainAxis: 10, crossAxis: 40 };
|
|
@@ -878,4 +879,18 @@ describe('GlCollapsibleListbox', () => {
|
|
|
878
879
|
}
|
|
879
880
|
);
|
|
880
881
|
});
|
|
882
|
+
|
|
883
|
+
describe('startOpened', () => {
|
|
884
|
+
it('should open dropdown on render when startOpened is true', async () => {
|
|
885
|
+
buildWrapper({ items: mockOptions, startOpened: true });
|
|
886
|
+
await nextTick();
|
|
887
|
+
expect(findDropdownMenu().classes()).toContain('gl-display-block!');
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
it('should not open dropdown on render as default', async () => {
|
|
891
|
+
buildWrapper({ items: mockOptions });
|
|
892
|
+
await nextTick();
|
|
893
|
+
expect(findDropdownMenu().classes()).not.toContain('gl-display-block!');
|
|
894
|
+
});
|
|
895
|
+
});
|
|
881
896
|
});
|
|
@@ -122,17 +122,12 @@ const makeBindings = (overrides = {}) =>
|
|
|
122
122
|
':show-select-all-button-label': 'showSelectAllButtonLabel',
|
|
123
123
|
':fluid-width': 'fluidWidth',
|
|
124
124
|
':positioning-strategy': 'positioningStrategy',
|
|
125
|
+
':startOpened': 'startOpened',
|
|
125
126
|
...overrides,
|
|
126
127
|
})
|
|
127
128
|
.map(([key, value]) => `${key}="${value}"`)
|
|
128
129
|
.join('\n');
|
|
129
130
|
|
|
130
|
-
function openListbox(component) {
|
|
131
|
-
component.$nextTick(() => {
|
|
132
|
-
component.$refs.listbox.open();
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
131
|
const template = (content, { label = '', bindingOverrides = {} } = {}) => `
|
|
137
132
|
<div>
|
|
138
133
|
${label}
|
|
@@ -157,11 +152,6 @@ export const Default = (args, { argTypes }) => ({
|
|
|
157
152
|
selected: mockOptions[1].value,
|
|
158
153
|
};
|
|
159
154
|
},
|
|
160
|
-
mounted() {
|
|
161
|
-
if (this.startOpened) {
|
|
162
|
-
openListbox(this);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
155
|
template: template('', {
|
|
166
156
|
label: `<span class="gl-my-0" id="listbox-label">Select a department</span>`,
|
|
167
157
|
}),
|
|
@@ -182,11 +172,6 @@ export const HeaderAndFooter = (args, { argTypes }) => ({
|
|
|
182
172
|
selected: [],
|
|
183
173
|
};
|
|
184
174
|
},
|
|
185
|
-
mounted() {
|
|
186
|
-
if (this.startOpened) {
|
|
187
|
-
openListbox(this);
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
175
|
methods: {
|
|
191
176
|
selectAllItems() {
|
|
192
177
|
const allValues = mockOptions.map(({ value }) => value);
|
|
@@ -243,11 +228,6 @@ export const HeaderActions = (args, { argTypes }) => ({
|
|
|
243
228
|
return mockOptions.map(({ value }) => value);
|
|
244
229
|
},
|
|
245
230
|
},
|
|
246
|
-
mounted() {
|
|
247
|
-
if (this.startOpened) {
|
|
248
|
-
openListbox(this);
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
231
|
methods: {
|
|
252
232
|
selectAllItems() {
|
|
253
233
|
this.selected = [...this.allValues];
|
|
@@ -286,11 +266,6 @@ export const CustomListItem = (args, { argTypes }) => ({
|
|
|
286
266
|
GlIcon,
|
|
287
267
|
GlAvatar,
|
|
288
268
|
},
|
|
289
|
-
mounted() {
|
|
290
|
-
if (this.startOpened) {
|
|
291
|
-
openListbox(this);
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
269
|
computed: {
|
|
295
270
|
customToggleText() {
|
|
296
271
|
if (this.selected.length === 0) return 'Select assignee(s)';
|
|
@@ -344,11 +319,6 @@ export const CustomToggle = (args, { argTypes }) => ({
|
|
|
344
319
|
selected: mockUsers[1].value,
|
|
345
320
|
};
|
|
346
321
|
},
|
|
347
|
-
mounted() {
|
|
348
|
-
if (this.startOpened) {
|
|
349
|
-
openListbox(this);
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
322
|
template: template(
|
|
353
323
|
`
|
|
354
324
|
<template #toggle>
|
|
@@ -389,11 +359,6 @@ const makeGroupedExample = (changes) => {
|
|
|
389
359
|
selected: 'v1.0',
|
|
390
360
|
};
|
|
391
361
|
},
|
|
392
|
-
mounted() {
|
|
393
|
-
if (this.startOpened) {
|
|
394
|
-
openListbox(this);
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
362
|
...changes,
|
|
398
363
|
});
|
|
399
364
|
|
|
@@ -473,11 +438,6 @@ export const GroupWithoutLabel = (args, { argTypes }) => ({
|
|
|
473
438
|
selected: mockGroupsWithTextSrOnly[1].options[1].value,
|
|
474
439
|
};
|
|
475
440
|
},
|
|
476
|
-
mounted() {
|
|
477
|
-
if (this.startOpened) {
|
|
478
|
-
openListbox(this);
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
441
|
template: template(`
|
|
482
442
|
<template #list-item="{ item }">
|
|
483
443
|
{{ item.text }} <gl-badge v-if="item.value === 'main'" size="sm">default</gl-badge>
|
|
@@ -649,11 +609,6 @@ export const Searchable = (args, { argTypes }) => ({
|
|
|
649
609
|
timeoutId: null,
|
|
650
610
|
};
|
|
651
611
|
},
|
|
652
|
-
mounted() {
|
|
653
|
-
if (this.startOpened) {
|
|
654
|
-
openListbox(this);
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
612
|
methods: {
|
|
658
613
|
filterList(searchTerm) {
|
|
659
614
|
if (this.timeoutId) {
|
|
@@ -722,11 +677,6 @@ export const SearchableGroups = (args, { argTypes }) => ({
|
|
|
722
677
|
timeoutId: null,
|
|
723
678
|
};
|
|
724
679
|
},
|
|
725
|
-
mounted() {
|
|
726
|
-
if (this.startOpened) {
|
|
727
|
-
openListbox(this);
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
680
|
computed: {
|
|
731
681
|
flattenedOptions() {
|
|
732
682
|
return flattenedOptions(this.items);
|
|
@@ -813,11 +763,6 @@ export const InfiniteScroll = (
|
|
|
813
763
|
infiniteScroll: true,
|
|
814
764
|
};
|
|
815
765
|
},
|
|
816
|
-
mounted() {
|
|
817
|
-
if (this.startOpened) {
|
|
818
|
-
openListbox(this);
|
|
819
|
-
}
|
|
820
|
-
},
|
|
821
766
|
methods: {
|
|
822
767
|
onBottomReached() {
|
|
823
768
|
this.infiniteScrollLoading = true;
|
|
@@ -871,11 +816,6 @@ export const WithLongContent = (args, { argTypes: { items, ...argTypes } }) => (
|
|
|
871
816
|
items: longItems,
|
|
872
817
|
};
|
|
873
818
|
},
|
|
874
|
-
mounted() {
|
|
875
|
-
if (this.startOpened) {
|
|
876
|
-
openListbox(this);
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
819
|
computed: {
|
|
880
820
|
customToggleText() {
|
|
881
821
|
return this.items.find(({ value }) => value === this.selected).text;
|
|
@@ -331,6 +331,14 @@ export default {
|
|
|
331
331
|
default: POSITION_ABSOLUTE,
|
|
332
332
|
validator: (strategy) => [POSITION_ABSOLUTE, POSITION_FIXED].includes(strategy),
|
|
333
333
|
},
|
|
334
|
+
/**
|
|
335
|
+
* Opens dropdown on render
|
|
336
|
+
*/
|
|
337
|
+
startOpened: {
|
|
338
|
+
type: Boolean,
|
|
339
|
+
required: false,
|
|
340
|
+
default: false,
|
|
341
|
+
},
|
|
334
342
|
},
|
|
335
343
|
data() {
|
|
336
344
|
return {
|
|
@@ -518,6 +526,9 @@ export default {
|
|
|
518
526
|
: {}),
|
|
519
527
|
},
|
|
520
528
|
mounted() {
|
|
529
|
+
if (this.startOpened) {
|
|
530
|
+
this.open();
|
|
531
|
+
}
|
|
521
532
|
this.observeScroll();
|
|
522
533
|
},
|
|
523
534
|
beforeDestroy() {
|
|
@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import { createMockChartInstance } from '~helpers/chart_stubs';
|
|
3
3
|
import { expectHeightAutoClasses } from '~helpers/chart_height';
|
|
4
4
|
import Chart from '../chart/chart.vue';
|
|
5
|
+
import ChartTooltip from '../tooltip/tooltip.vue';
|
|
5
6
|
import DiscreteScatterChart from './discrete_scatter.vue';
|
|
6
7
|
|
|
7
8
|
let mockChartInstance;
|
|
@@ -38,4 +39,20 @@ describe('column chart component', () => {
|
|
|
38
39
|
findChart,
|
|
39
40
|
});
|
|
40
41
|
});
|
|
42
|
+
|
|
43
|
+
describe('disable-tooltip', () => {
|
|
44
|
+
it('is set to false by default', async () => {
|
|
45
|
+
createComponent();
|
|
46
|
+
|
|
47
|
+
await findChart().vm.$emit('created', mockChartInstance);
|
|
48
|
+
|
|
49
|
+
expect(wrapper.findComponent(ChartTooltip).exists()).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('disables the tooltip', () => {
|
|
53
|
+
createComponent({ disableTooltip: true });
|
|
54
|
+
|
|
55
|
+
expect(wrapper.findComponent(ChartTooltip).exists()).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
41
58
|
});
|
|
@@ -49,6 +49,11 @@ export default {
|
|
|
49
49
|
required: false,
|
|
50
50
|
default: null,
|
|
51
51
|
},
|
|
52
|
+
disableTooltip: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: () => false,
|
|
56
|
+
},
|
|
52
57
|
/**
|
|
53
58
|
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
54
59
|
*/
|
|
@@ -187,7 +192,7 @@ export default {
|
|
|
187
192
|
@created="onCreated"
|
|
188
193
|
/>
|
|
189
194
|
<chart-tooltip
|
|
190
|
-
v-if="chart"
|
|
195
|
+
v-if="!disableTooltip && chart"
|
|
191
196
|
:show="showTooltip"
|
|
192
197
|
:chart="chart"
|
|
193
198
|
:top="tooltipPosition.top"
|