@gitlab/ui 42.2.0 → 42.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.
- package/CHANGELOG.md +21 -0
- package/dist/components/base/label/label.js +10 -2
- package/dist/components/base/token_selector/token_container.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +1 -1
- package/scss_to_js/scss_variables.js +2 -2
- package/scss_to_js/scss_variables.json +3 -3
- package/src/components/base/label/label.scss +0 -4
- package/src/components/base/label/label.spec.js +35 -1
- package/src/components/base/label/label.stories.js +3 -0
- package/src/components/base/label/label.vue +16 -4
- package/src/components/base/token_selector/token_container.spec.js +12 -1
- package/src/components/base/token_selector/token_container.vue +1 -1
- package/src/scss/variables.scss +1 -1
package/package.json
CHANGED
|
@@ -89,7 +89,7 @@ export const purple700 = '#5943b6'
|
|
|
89
89
|
export const purple800 = '#453894'
|
|
90
90
|
export const purple900 = '#2f2a6b'
|
|
91
91
|
export const purple950 = '#232150'
|
|
92
|
-
export const gray10 = '#
|
|
92
|
+
export const gray10 = '#f5f5f5'
|
|
93
93
|
export const gray50 = '#f0f0f0'
|
|
94
94
|
export const gray100 = '#dbdbdb'
|
|
95
95
|
export const gray200 = '#bfbfbf'
|
|
@@ -342,7 +342,7 @@ export const spacer = '0.5rem'
|
|
|
342
342
|
export const spacers = '(1: 0.25rem, 2: 0.5rem, 3: 1rem, 4: 1.5rem, 5: 2rem, 6: 2.5rem, 7: 3rem, 8: 3.5rem, 9: 4rem)'
|
|
343
343
|
export const tableAccentBg = '#f0f0f0'
|
|
344
344
|
export const cardBorderColor = '#dbdbdb'
|
|
345
|
-
export const cardCapBg = '#
|
|
345
|
+
export const cardCapBg = '#f5f5f5'
|
|
346
346
|
export const glFormInputSizes = '(xs: 5rem, sm: 10rem, md: 15rem, lg: 20rem, xl: 35rem)'
|
|
347
347
|
export const popoverBg = '#fff'
|
|
348
348
|
export const popoverArrowWidth = '0.5rem'
|
|
@@ -484,8 +484,8 @@
|
|
|
484
484
|
},
|
|
485
485
|
{
|
|
486
486
|
"name": "$gray-10",
|
|
487
|
-
"value": "#
|
|
488
|
-
"compiledValue": "#
|
|
487
|
+
"value": "#f5f5f5",
|
|
488
|
+
"compiledValue": "#f5f5f5"
|
|
489
489
|
},
|
|
490
490
|
{
|
|
491
491
|
"name": "$gray-50",
|
|
@@ -1795,7 +1795,7 @@
|
|
|
1795
1795
|
{
|
|
1796
1796
|
"name": "$card-cap-bg",
|
|
1797
1797
|
"value": "$gray-10",
|
|
1798
|
-
"compiledValue": "#
|
|
1798
|
+
"compiledValue": "#f5f5f5"
|
|
1799
1799
|
},
|
|
1800
1800
|
{
|
|
1801
1801
|
"name": "$gl-form-input-sizes",
|
|
@@ -36,9 +36,11 @@ describe('Label component', () => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const findLink = () => wrapper.findComponent(GlLink);
|
|
39
|
+
const findContent = () => wrapper.find('.gl-label-link');
|
|
39
40
|
const findTitle = () => wrapper.find('.gl-label-text');
|
|
40
41
|
const findSubTitle = () => wrapper.find('.gl-label-text-scoped');
|
|
41
|
-
const
|
|
42
|
+
const findTooltip = () => wrapper.findComponent(GlTooltip);
|
|
43
|
+
const findTooltipText = () => findTooltip().text();
|
|
42
44
|
const findCloseButton = () => wrapper.findComponent(CloseButton);
|
|
43
45
|
|
|
44
46
|
describe('basic label', () => {
|
|
@@ -137,6 +139,22 @@ describe('Label component', () => {
|
|
|
137
139
|
expect(wrapper.emitted().close).toBeFalsy();
|
|
138
140
|
});
|
|
139
141
|
});
|
|
142
|
+
|
|
143
|
+
describe('label has no target', () => {
|
|
144
|
+
const props = { ...defaultProps, target: '' };
|
|
145
|
+
|
|
146
|
+
it('renders the label content as text', () => {
|
|
147
|
+
createComponent(props, { mountFn: mount });
|
|
148
|
+
|
|
149
|
+
expect(findContent().element.tagName.toLowerCase()).toBe('span');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('does not render a link', () => {
|
|
153
|
+
createComponent(props, { mountFn: shallowMount });
|
|
154
|
+
|
|
155
|
+
expect(findLink().exists()).toBe(false);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
140
158
|
});
|
|
141
159
|
|
|
142
160
|
describe('scoped label', () => {
|
|
@@ -220,5 +238,21 @@ describe('Label component', () => {
|
|
|
220
238
|
expect(wrapper.emitted().close).toBeFalsy();
|
|
221
239
|
});
|
|
222
240
|
});
|
|
241
|
+
|
|
242
|
+
describe('label has no target', () => {
|
|
243
|
+
const props = { ...defaultProps, target: '' };
|
|
244
|
+
|
|
245
|
+
it('renders the label content as text', () => {
|
|
246
|
+
createComponent(props, { mountFn: mount });
|
|
247
|
+
|
|
248
|
+
expect(findContent().element.tagName.toLowerCase()).toBe('span');
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('does not render a link', () => {
|
|
252
|
+
createComponent(props, { mountFn: shallowMount });
|
|
253
|
+
|
|
254
|
+
expect(findLink().exists()).toBe(false);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
223
257
|
});
|
|
224
258
|
});
|
|
@@ -54,6 +54,9 @@ Scoped.args = generateProps({ title: 'scoped::label', scoped: true });
|
|
|
54
54
|
export const WithCloseButton = Template.bind({});
|
|
55
55
|
WithCloseButton.args = generateProps({ showCloseButton: true });
|
|
56
56
|
|
|
57
|
+
export const WithoutTarget = Template.bind({});
|
|
58
|
+
WithoutTarget.args = generateProps({ target: '' });
|
|
59
|
+
|
|
57
60
|
export default {
|
|
58
61
|
title: 'base/label',
|
|
59
62
|
component: GlLabel,
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
target: {
|
|
42
42
|
type: String,
|
|
43
43
|
required: false,
|
|
44
|
-
default: '
|
|
44
|
+
default: '',
|
|
45
45
|
},
|
|
46
46
|
scoped: {
|
|
47
47
|
type: Boolean,
|
|
@@ -91,6 +91,12 @@ export default {
|
|
|
91
91
|
closeIconSize() {
|
|
92
92
|
return this.size === 'sm' ? 12 : 16;
|
|
93
93
|
},
|
|
94
|
+
labelComponent() {
|
|
95
|
+
return this.target ? GlLink : 'span';
|
|
96
|
+
},
|
|
97
|
+
tooltipTarget() {
|
|
98
|
+
return this.target ? this.$refs.labelTitle.$el : this.$refs.labelTitle;
|
|
99
|
+
},
|
|
94
100
|
},
|
|
95
101
|
watch: {
|
|
96
102
|
title() {
|
|
@@ -122,14 +128,20 @@ export default {
|
|
|
122
128
|
|
|
123
129
|
<template>
|
|
124
130
|
<span class="gl-label" :class="cssClasses" :style="cssVariables" v-bind="$attrs" @click="onClick">
|
|
125
|
-
<
|
|
131
|
+
<component
|
|
132
|
+
:is="labelComponent"
|
|
133
|
+
ref="labelTitle"
|
|
134
|
+
:href="target ? target : false"
|
|
135
|
+
class="gl-label-link"
|
|
136
|
+
tabindex="0"
|
|
137
|
+
>
|
|
126
138
|
<span class="gl-label-text">
|
|
127
139
|
{{ scopedKey }}
|
|
128
140
|
</span>
|
|
129
141
|
<span v-if="scoped && scopedValue" class="gl-label-text-scoped">
|
|
130
142
|
{{ scopedValue }}
|
|
131
143
|
</span>
|
|
132
|
-
</
|
|
144
|
+
</component>
|
|
133
145
|
<close-button
|
|
134
146
|
v-if="showCloseButton"
|
|
135
147
|
class="gl-label-close gl-p-0!"
|
|
@@ -140,7 +152,7 @@ export default {
|
|
|
140
152
|
/>
|
|
141
153
|
<gl-tooltip
|
|
142
154
|
v-if="description"
|
|
143
|
-
:target="() =>
|
|
155
|
+
:target="() => tooltipTarget"
|
|
144
156
|
:placement="tooltipPlacement"
|
|
145
157
|
boundary="viewport"
|
|
146
158
|
>
|
|
@@ -257,7 +257,7 @@ describe('GlTokenContainer', () => {
|
|
|
257
257
|
expect(expectedFocusedToken.element).toHaveFocus();
|
|
258
258
|
});
|
|
259
259
|
|
|
260
|
-
it('emits the `cancel-focus` event when tab key is pressed', async () => {
|
|
260
|
+
it('emits the `cancel-focus` event when tab key is pressed without modifiers', async () => {
|
|
261
261
|
createComponent({});
|
|
262
262
|
|
|
263
263
|
const focusedToken = findTokenByName(tokens[0].name);
|
|
@@ -267,6 +267,17 @@ describe('GlTokenContainer', () => {
|
|
|
267
267
|
|
|
268
268
|
expect(wrapper.emitted('cancel-focus')).toEqual([[]]);
|
|
269
269
|
});
|
|
270
|
+
|
|
271
|
+
it('does not emit the `cancel-focus` event when tab key is pressed with modifiers', async () => {
|
|
272
|
+
createComponent({});
|
|
273
|
+
|
|
274
|
+
const focusedToken = findTokenByName(tokens[0].name);
|
|
275
|
+
|
|
276
|
+
await focusedToken.trigger('focus');
|
|
277
|
+
await focusedToken.trigger('keydown', { key: keyboard.tab, shiftKey: true });
|
|
278
|
+
|
|
279
|
+
expect(wrapper.emitted('cancel-focus')).toBeUndefined();
|
|
280
|
+
});
|
|
270
281
|
});
|
|
271
282
|
});
|
|
272
283
|
});
|
package/src/scss/variables.scss
CHANGED