@gitlab/ui 80.7.0 → 80.7.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/CHANGELOG.md +9 -0
- package/dist/components/base/filtered_search/filtered_search_term.js +3 -1
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +1 -1
- package/dist/components/charts/legend/legend.js +20 -3
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/filtered_search/filtered_search.stories.js +2 -2
- package/src/components/base/filtered_search/filtered_search_term.vue +2 -2
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +1 -1
- package/src/components/charts/legend/legend.scss +3 -3
- package/src/components/charts/legend/legend.spec.js +26 -0
- package/src/components/charts/legend/legend.vue +20 -2
package/package.json
CHANGED
|
@@ -33,9 +33,9 @@ const fakeMilestones = [
|
|
|
33
33
|
];
|
|
34
34
|
|
|
35
35
|
const fakeLabels = [
|
|
36
|
-
{ id: 1, title: 'Bug', color: '#
|
|
36
|
+
{ id: 1, title: 'Bug', color: '#D72104', text_color: '#FFFFFF' },
|
|
37
37
|
{ id: 2, title: 'Enhancement', color: '#F0AD4E', text_color: '#FFFFFF' },
|
|
38
|
-
{ id: 3, title: 'Backlog', color: '#
|
|
38
|
+
{ id: 3, title: 'Backlog', color: '#CCCCCC', text_color: '#333333' },
|
|
39
39
|
{ id: 4, title: 'Feature', color: '#A8D695', text_color: '#333333' },
|
|
40
40
|
{ id: 5, title: 'Documentation', color: '#5CB85C', text_color: '#FFFFFF' },
|
|
41
41
|
];
|
|
@@ -214,7 +214,7 @@ export default {
|
|
|
214
214
|
@previous="$emit('previous')"
|
|
215
215
|
@next="$emit('next')"
|
|
216
216
|
>
|
|
217
|
-
<template #view>
|
|
217
|
+
<template #view="{ label }">
|
|
218
218
|
<gl-token
|
|
219
219
|
v-if="showToken"
|
|
220
220
|
:class="{ 'gl-cursor-pointer': !viewOnly }"
|
|
@@ -229,7 +229,7 @@ export default {
|
|
|
229
229
|
class="gl-filtered-search-term-input"
|
|
230
230
|
:class="{ 'gl-bg-gray-10': viewOnly }"
|
|
231
231
|
:placeholder="placeholder"
|
|
232
|
-
:aria-label="
|
|
232
|
+
:aria-label="label"
|
|
233
233
|
:readonly="viewOnly"
|
|
234
234
|
data-testid="filtered-search-term-input"
|
|
235
235
|
@focusin="$emit('activate')"
|
|
@@ -14,8 +14,8 @@ $legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.gl-legend-tabular,
|
|
18
|
-
.gl-chart-h-auto .gl-legend-inline {
|
|
17
|
+
.gl-legend-tabular.gl-legend-b-fade,
|
|
18
|
+
.gl-chart-h-auto .gl-legend-inline.gl-legend-b-fade {
|
|
19
19
|
&::after {
|
|
20
20
|
background-image: linear-gradient(to bottom, $transparent-rgba, var(--white, #{$white}));
|
|
21
21
|
bottom: 0;
|
|
@@ -78,7 +78,7 @@ $legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
|
|
|
78
78
|
|
|
79
79
|
.gl-legend-tabular-row {
|
|
80
80
|
@include gl-display-flex;
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
&:nth-child(odd) {
|
|
83
83
|
background-color: var(--gray-50, #{$gray-50});
|
|
84
84
|
}
|
|
@@ -33,6 +33,15 @@ const mockSeriesInfo = [
|
|
|
33
33
|
},
|
|
34
34
|
];
|
|
35
35
|
|
|
36
|
+
const mockElementHeight = (element, clientHeight, scrollHeight) => {
|
|
37
|
+
Object.defineProperty(element, 'clientHeight', {
|
|
38
|
+
get: () => clientHeight,
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(element, 'scrollHeight', {
|
|
41
|
+
get: () => scrollHeight,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
36
45
|
describe('chart legend component', () => {
|
|
37
46
|
let chartWrapper;
|
|
38
47
|
let legendWrapper;
|
|
@@ -157,6 +166,23 @@ describe('chart legend component', () => {
|
|
|
157
166
|
expect(legendWrapper.find('.gl-legend-tabular').exists()).toBe(false);
|
|
158
167
|
});
|
|
159
168
|
|
|
169
|
+
it('adds a fade when content scrolls', async () => {
|
|
170
|
+
const legendInlineEl = legendWrapper.find('.gl-legend-inline').element;
|
|
171
|
+
mockElementHeight(legendInlineEl, 200, 400);
|
|
172
|
+
|
|
173
|
+
// update component to force recalculation of fade class after we mock the heights
|
|
174
|
+
legendWrapper.setProps({
|
|
175
|
+
averageText: 'averaaaaage',
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Why wait 3 ticks?
|
|
179
|
+
await legendWrapper.vm.$nextTick(); // 1. component waits a tick itself after update, before checking scrollHeight
|
|
180
|
+
await legendWrapper.vm.$nextTick(); // 2. so wait for next render, after component has applied class
|
|
181
|
+
await legendWrapper.vm.$nextTick(); // 3. ??? vue-3 pipeline fails without waiting an extra tick
|
|
182
|
+
|
|
183
|
+
expect(legendWrapper.find('.gl-legend-b-fade').exists()).toBe(true);
|
|
184
|
+
});
|
|
185
|
+
|
|
160
186
|
describe('when setting the layout prop to table', () => {
|
|
161
187
|
beforeEach(() => {
|
|
162
188
|
buildLegend({
|
|
@@ -83,6 +83,7 @@ export default {
|
|
|
83
83
|
return {
|
|
84
84
|
disabledSeries: {},
|
|
85
85
|
lastActiveSeriesLabel: null,
|
|
86
|
+
shouldApplyFadeClass: false,
|
|
86
87
|
};
|
|
87
88
|
},
|
|
88
89
|
computed: {
|
|
@@ -99,6 +100,13 @@ export default {
|
|
|
99
100
|
created() {
|
|
100
101
|
this.chart.on('legendselectchanged', this.suppressLastActiveSeriesLabelToggle);
|
|
101
102
|
},
|
|
103
|
+
mounted() {
|
|
104
|
+
this.applyFadeClass();
|
|
105
|
+
},
|
|
106
|
+
async updated() {
|
|
107
|
+
await this.$nextTick();
|
|
108
|
+
this.applyFadeClass();
|
|
109
|
+
},
|
|
102
110
|
beforeDestroy() {
|
|
103
111
|
this.chart.off('legendselectchanged', this.suppressLastActiveSeriesLabelToggle);
|
|
104
112
|
},
|
|
@@ -163,6 +171,12 @@ export default {
|
|
|
163
171
|
isToggleDisabled(name, isDisabled) {
|
|
164
172
|
return name === this.lastActiveSeriesLabel || isDisabled;
|
|
165
173
|
},
|
|
174
|
+
applyFadeClass() {
|
|
175
|
+
if (this.$refs.inlineLegendEl) {
|
|
176
|
+
const { scrollHeight, clientHeight } = this.$refs.inlineLegendEl;
|
|
177
|
+
this.shouldApplyFadeClass = scrollHeight > clientHeight;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
166
180
|
},
|
|
167
181
|
legendLayoutTypes: {
|
|
168
182
|
LEGEND_LAYOUT_INLINE,
|
|
@@ -174,7 +188,11 @@ export default {
|
|
|
174
188
|
<template>
|
|
175
189
|
<div class="gl-legend" data-testid="gl-chart-legend">
|
|
176
190
|
<template v-if="layout === $options.legendLayoutTypes.LEGEND_LAYOUT_INLINE">
|
|
177
|
-
<div
|
|
191
|
+
<div
|
|
192
|
+
ref="inlineLegendEl"
|
|
193
|
+
class="gl-legend-inline"
|
|
194
|
+
:class="{ 'gl-legend-b-fade': shouldApplyFadeClass }"
|
|
195
|
+
>
|
|
178
196
|
<div
|
|
179
197
|
v-for="(series, key) in seriesInfo"
|
|
180
198
|
:key="key"
|
|
@@ -212,7 +230,7 @@ export default {
|
|
|
212
230
|
</template>
|
|
213
231
|
|
|
214
232
|
<template v-if="layout === $options.legendLayoutTypes.LEGEND_LAYOUT_TABLE">
|
|
215
|
-
<div class="gl-legend-tabular" :style="fontStyle">
|
|
233
|
+
<div class="gl-legend-tabular gl-legend-b-fade" :style="fontStyle">
|
|
216
234
|
<header class="gl-legend-tabular-header">
|
|
217
235
|
<div class="gl-legend-tabular-header-cell">{{ minText }}</div>
|
|
218
236
|
<div class="gl-legend-tabular-header-cell">{{ maxText }}</div>
|