@gitlab/ui 71.6.0 → 71.7.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 +24 -0
- package/dist/components/base/badge/badge.js +1 -12
- package/dist/components/base/loading_icon/loading_icon.js +1 -1
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -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/avatar_labeled/avatar_labeled.scss +1 -0
- package/src/components/base/badge/badge.scss +3 -40
- package/src/components/base/badge/badge.spec.js +3 -11
- package/src/components/base/badge/badge.stories.js +0 -48
- package/src/components/base/badge/badge.vue +8 -20
- package/src/components/base/loading_icon/loading_icon.spec.js +6 -8
- package/src/components/base/loading_icon/loading_icon.vue +2 -5
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +3 -3
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +1 -1
- package/src/components/base/new_dropdowns/dropdown.scss +14 -10
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -66,38 +66,23 @@
|
|
|
66
66
|
.gl-badge {
|
|
67
67
|
@include gl-display-inline-flex;
|
|
68
68
|
@include gl-align-items-center;
|
|
69
|
-
@include gl-
|
|
69
|
+
@include gl-font-sm;
|
|
70
70
|
@include gl-font-weight-normal;
|
|
71
71
|
@include gl-line-height-normal;
|
|
72
|
+
@include gl-py-2;
|
|
73
|
+
@include gl-px-3;
|
|
72
74
|
|
|
73
75
|
&.sm {
|
|
74
76
|
@include gl-py-0;
|
|
75
|
-
@include gl-px-3;
|
|
76
|
-
@include gl-gap-2;
|
|
77
|
-
@include gl-font-sm;
|
|
78
|
-
|
|
79
|
-
min-height: 1rem;
|
|
80
|
-
min-width: 1rem;
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
&.md {
|
|
84
80
|
@include gl-py-2;
|
|
85
|
-
@include gl-px-3;
|
|
86
|
-
@include gl-gap-2;
|
|
87
|
-
@include gl-font-sm;
|
|
88
|
-
|
|
89
|
-
min-height: 1.5rem;
|
|
90
|
-
min-width: 1.5rem;
|
|
91
81
|
}
|
|
92
82
|
|
|
93
83
|
&.lg {
|
|
94
84
|
@include gl-py-3;
|
|
95
|
-
@include gl-px-4;
|
|
96
|
-
@include gl-gap-2;
|
|
97
85
|
@include gl-font-base;
|
|
98
|
-
|
|
99
|
-
min-height: 2rem;
|
|
100
|
-
min-width: 2rem;
|
|
101
86
|
}
|
|
102
87
|
|
|
103
88
|
.gl-badge-icon {
|
|
@@ -106,28 +91,6 @@
|
|
|
106
91
|
@include gl-flex-shrink-0;
|
|
107
92
|
@include gl-top-auto;
|
|
108
93
|
}
|
|
109
|
-
|
|
110
|
-
&.gl-badge-round-icon.gl-badge-icon-only {
|
|
111
|
-
@include gl-px-0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&.sm.gl-badge-round-icon:not(.gl-badge-icon-only) {
|
|
115
|
-
@include gl-pl-1;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&.md.gl-badge-round-icon:not(.gl-badge-icon-only) {
|
|
119
|
-
.gl-badge-icon.s12 {
|
|
120
|
-
@include gl-ml-n1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.gl-badge-icon.s16 {
|
|
124
|
-
@include gl-ml-n2;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&.lg.gl-badge-round-icon:not(.gl-badge-icon-only) {
|
|
129
|
-
@include gl-pl-3;
|
|
130
|
-
}
|
|
131
94
|
}
|
|
132
95
|
|
|
133
96
|
/* Variants */
|
|
@@ -39,7 +39,9 @@ describe('badge', () => {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('with correct class', () => {
|
|
42
|
-
|
|
42
|
+
const icon = findIcon();
|
|
43
|
+
|
|
44
|
+
expect(icon.classes('gl-mr-2')).toBe(hasSlot);
|
|
43
45
|
});
|
|
44
46
|
|
|
45
47
|
it('with correct size', () => {
|
|
@@ -49,16 +51,6 @@ describe('badge', () => {
|
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
describe('with "roundIcon" prop', () => {
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
createComponent({ propsData: { icon: 'warning', roundIcon: true } });
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('has `gl-badge-round-icon` class', () => {
|
|
58
|
-
expect(wrapper.classes()).toContain('gl-badge-round-icon');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
54
|
describe('without "icon" prop', () => {
|
|
63
55
|
const mockSlotContent = 'slot-content';
|
|
64
56
|
beforeEach(() => {
|
|
@@ -27,7 +27,6 @@ const generateProps = ({
|
|
|
27
27
|
content = 'TestBadge',
|
|
28
28
|
icon = '',
|
|
29
29
|
iconSize = defaultValue('iconSize'),
|
|
30
|
-
roundIcon = false,
|
|
31
30
|
} = {}) => ({
|
|
32
31
|
variant,
|
|
33
32
|
size,
|
|
@@ -35,7 +34,6 @@ const generateProps = ({
|
|
|
35
34
|
content,
|
|
36
35
|
icon,
|
|
37
36
|
iconSize,
|
|
38
|
-
roundIcon,
|
|
39
37
|
});
|
|
40
38
|
|
|
41
39
|
const Template = (args, { argTypes }) => ({
|
|
@@ -158,52 +156,6 @@ IconOnly.args = generateProps({
|
|
|
158
156
|
icon: 'calendar',
|
|
159
157
|
});
|
|
160
158
|
|
|
161
|
-
export const AllVariantsAndCategories = (args, { argTypes }) => ({
|
|
162
|
-
components: { GlBadge },
|
|
163
|
-
props: Object.keys(argTypes),
|
|
164
|
-
template: `
|
|
165
|
-
<div>
|
|
166
|
-
<div class="gl-display-flex gl-gap-3">
|
|
167
|
-
<gl-badge variant="info" size="sm" icon="terminal" iconSize="sm" />
|
|
168
|
-
<gl-badge variant="info" size="sm" icon="cancel" :roundIcon="true" iconSize="sm" />
|
|
169
|
-
<gl-badge variant="info" size="sm" icon="terminal" iconSize="sm">Small</gl-badge>
|
|
170
|
-
<gl-badge variant="info" size="sm" icon="cancel" :roundIcon="true" iconSize="sm">Small</gl-badge>
|
|
171
|
-
<gl-badge variant="info" size="sm">Small</gl-badge>
|
|
172
|
-
<gl-badge variant="info" size="sm">5</gl-badge>
|
|
173
|
-
</div>
|
|
174
|
-
<div class="gl-display-flex gl-gap-3 gl-mt-6">
|
|
175
|
-
<gl-badge variant="info" size="md" icon="terminal" iconSize="sm" />
|
|
176
|
-
<gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="sm" />
|
|
177
|
-
<gl-badge variant="info" size="md" icon="terminal" iconSize="sm">Medium</gl-badge>
|
|
178
|
-
<gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="sm">Medium</gl-badge>
|
|
179
|
-
<gl-badge variant="info" size="md">Medium</gl-badge>
|
|
180
|
-
</div>
|
|
181
|
-
<div class="gl-display-flex gl-gap-3 gl-mt-3">
|
|
182
|
-
<gl-badge variant="info" size="md" icon="terminal" iconSize="md" />
|
|
183
|
-
<gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="md" />
|
|
184
|
-
<gl-badge variant="info" size="md" icon="terminal" iconSize="md">Medium</gl-badge>
|
|
185
|
-
<gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="md">Medium</gl-badge>
|
|
186
|
-
<gl-badge variant="info" size="md">5</gl-badge>
|
|
187
|
-
</div>
|
|
188
|
-
<div class="gl-display-flex gl-gap-3 gl-mt-6">
|
|
189
|
-
<gl-badge variant="info" size="lg" icon="terminal" iconSize="md" />
|
|
190
|
-
<gl-badge variant="info" size="lg" icon="cancel" :roundIcon="true" iconSize="md" />
|
|
191
|
-
<gl-badge variant="info" size="lg" icon="terminal" iconSize="md">Large</gl-badge>
|
|
192
|
-
<gl-badge variant="info" size="lg" icon="cancel" :roundIcon="true" iconSize="md">Large</gl-badge>
|
|
193
|
-
<gl-badge variant="info" size="lg">5</gl-badge>
|
|
194
|
-
<gl-badge variant="info" size="lg">Large</gl-badge>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
`,
|
|
198
|
-
});
|
|
199
|
-
AllVariantsAndCategories.argTypes = disableControls([
|
|
200
|
-
'iconSize',
|
|
201
|
-
'icon',
|
|
202
|
-
'variant',
|
|
203
|
-
'size',
|
|
204
|
-
'roundIcon',
|
|
205
|
-
]);
|
|
206
|
-
|
|
207
159
|
export default {
|
|
208
160
|
title: 'base/badge',
|
|
209
161
|
component: GlBadge,
|
|
@@ -55,14 +55,6 @@ export default {
|
|
|
55
55
|
validator: (value) => Object.keys(badgeIconSizeOptions).includes(value),
|
|
56
56
|
required: false,
|
|
57
57
|
},
|
|
58
|
-
/**
|
|
59
|
-
* Whether the `icon` is round. Affects padding around the icon.
|
|
60
|
-
*/
|
|
61
|
-
roundIcon: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: false,
|
|
64
|
-
required: false,
|
|
65
|
-
},
|
|
66
58
|
},
|
|
67
59
|
computed: {
|
|
68
60
|
hasIconOnly() {
|
|
@@ -80,18 +72,14 @@ export default {
|
|
|
80
72
|
</script>
|
|
81
73
|
|
|
82
74
|
<template>
|
|
83
|
-
<b-badge
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
:role="role"
|
|
92
|
-
pill
|
|
93
|
-
>
|
|
94
|
-
<gl-icon v-if="icon" class="gl-badge-icon" :size="iconSizeComputed" :name="icon" />
|
|
75
|
+
<b-badge v-bind="$attrs" :variant="variant" :class="['gl-badge', size]" :role="role" pill>
|
|
76
|
+
<gl-icon
|
|
77
|
+
v-if="icon"
|
|
78
|
+
class="gl-badge-icon"
|
|
79
|
+
:size="iconSizeComputed"
|
|
80
|
+
:class="{ 'gl-mr-2': !hasIconOnly }"
|
|
81
|
+
:name="icon"
|
|
82
|
+
/>
|
|
95
83
|
<!-- @slot The badge content to display. -->
|
|
96
84
|
<slot></slot>
|
|
97
85
|
</b-badge>
|
|
@@ -16,10 +16,10 @@ describe('loading icon component', () => {
|
|
|
16
16
|
const getDotsLoaderClasses = () => findDotsLoaderEl().classes();
|
|
17
17
|
|
|
18
18
|
describe.each`
|
|
19
|
-
variant | baseCssClass |
|
|
20
|
-
${'spinner'} | ${spinnerBaseCssClass} | ${
|
|
21
|
-
${'dots'} | ${dotsLoaderBaseCssClass} | ${
|
|
22
|
-
`('variant $variant', ({ variant, baseCssClass,
|
|
19
|
+
variant | baseCssClass | getLoaderClasses
|
|
20
|
+
${'spinner'} | ${spinnerBaseCssClass} | ${getSpinnerClasses}
|
|
21
|
+
${'dots'} | ${dotsLoaderBaseCssClass} | ${getDotsLoaderClasses}
|
|
22
|
+
`('variant $variant', ({ variant, baseCssClass, getLoaderClasses }) => {
|
|
23
23
|
describe('display', () => {
|
|
24
24
|
it('should render as a block by default', () => {
|
|
25
25
|
createComponent({ variant });
|
|
@@ -79,17 +79,15 @@ describe('loading icon component', () => {
|
|
|
79
79
|
describe('aria label', () => {
|
|
80
80
|
it('should default to loading', () => {
|
|
81
81
|
createComponent({ variant });
|
|
82
|
-
const loaderEl = findLoaderEl();
|
|
83
82
|
|
|
84
|
-
expect(
|
|
83
|
+
expect(wrapper.attributes('aria-label')).toBe('Loading');
|
|
85
84
|
});
|
|
86
85
|
|
|
87
86
|
it('should change using prop', () => {
|
|
88
87
|
const label = 'label';
|
|
89
88
|
createComponent({ variant, label });
|
|
90
|
-
const loaderEl = findLoaderEl();
|
|
91
89
|
|
|
92
|
-
expect(
|
|
90
|
+
expect(wrapper.attributes('aria-label')).toBe(label);
|
|
93
91
|
});
|
|
94
92
|
});
|
|
95
93
|
|
|
@@ -84,14 +84,11 @@ export default {
|
|
|
84
84
|
<component
|
|
85
85
|
:is="rootElementType"
|
|
86
86
|
v-if="variant === 'spinner'"
|
|
87
|
+
:aria-label="label"
|
|
87
88
|
class="gl-spinner-container"
|
|
88
89
|
role="status"
|
|
89
90
|
>
|
|
90
|
-
<span
|
|
91
|
-
class="gl-vertical-align-text-bottom!"
|
|
92
|
-
:class="spinnerCssClasses"
|
|
93
|
-
:aria-label="label"
|
|
94
|
-
></span>
|
|
91
|
+
<span class="gl-vertical-align-text-bottom!" :class="spinnerCssClasses"></span>
|
|
95
92
|
</component>
|
|
96
93
|
<component :is="rootElementType" v-else :class="dotsCssClasses" role="status" :aria-label="label">
|
|
97
94
|
<span></span>
|
|
@@ -231,9 +231,9 @@ describe('base dropdown', () => {
|
|
|
231
231
|
props | toggleClasses
|
|
232
232
|
${{}} | ${[]}
|
|
233
233
|
${{ toggleText: 'toggleText' }} | ${[]}
|
|
234
|
-
${{ icon: 'close' }} | ${['gl-new-dropdown-icon-only']}
|
|
235
|
-
${{ icon: 'close', toggleText: 'toggleText', textSrOnly: true }} | ${['gl-new-dropdown-icon-only']}
|
|
236
|
-
${{ icon: 'close', textSrOnly: true }} | ${['gl-new-dropdown-icon-only']}
|
|
234
|
+
${{ icon: 'close' }} | ${['gl-new-dropdown-icon-only', 'btn-icon']}
|
|
235
|
+
${{ icon: 'close', toggleText: 'toggleText', textSrOnly: true }} | ${['gl-new-dropdown-icon-only', 'btn-icon']}
|
|
236
|
+
${{ icon: 'close', textSrOnly: true }} | ${['gl-new-dropdown-icon-only', 'btn-icon']}
|
|
237
237
|
${{ toggleText: 'toggleText', noCaret: true }} | ${['gl-new-dropdown-toggle-no-caret']}
|
|
238
238
|
`('dropdown with props $props', ({ props, toggleClasses }) => {
|
|
239
239
|
beforeEach(async () => {
|
|
@@ -176,7 +176,7 @@ export default {
|
|
|
176
176
|
this.toggleClass,
|
|
177
177
|
{
|
|
178
178
|
'gl-new-dropdown-toggle': true,
|
|
179
|
-
'gl-new-dropdown-icon-only': this.isIconOnly,
|
|
179
|
+
'gl-new-dropdown-icon-only btn-icon': this.isIconOnly,
|
|
180
180
|
'gl-new-dropdown-toggle-no-caret': this.noCaret,
|
|
181
181
|
},
|
|
182
182
|
];
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.gl-new-dropdown-toggle {
|
|
51
|
-
|
|
51
|
+
// optically align the caret
|
|
52
|
+
&.gl-button:not(.gl-new-dropdown-toggle-no-caret) {
|
|
52
53
|
@include gl-pr-3;
|
|
53
54
|
|
|
54
55
|
&.btn-sm {
|
|
@@ -56,17 +57,10 @@
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
&.gl-new-dropdown-toggle-no-caret {
|
|
60
|
-
@include gl-
|
|
61
|
-
|
|
62
|
-
.gl-new-dropdown-chevron {
|
|
63
|
-
@include gl-display-none;
|
|
64
|
-
}
|
|
60
|
+
&.gl-new-dropdown-toggle-no-caret .gl-new-dropdown-chevron {
|
|
61
|
+
@include gl-display-none;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
&.gl-new-dropdown-toggle-no-caret.btn-sm {
|
|
68
|
-
@include gl-p-2;
|
|
69
|
-
}
|
|
70
64
|
}
|
|
71
65
|
|
|
72
66
|
.gl-new-dropdown-toggle {
|
|
@@ -96,6 +90,15 @@
|
|
|
96
90
|
}
|
|
97
91
|
|
|
98
92
|
.gl-new-dropdown-icon-only {
|
|
93
|
+
// optically align the caret
|
|
94
|
+
&.gl-button:not(.gl-new-dropdown-toggle-no-caret) {
|
|
95
|
+
@include gl-pr-2;
|
|
96
|
+
|
|
97
|
+
&.btn-sm {
|
|
98
|
+
@include gl-pr-0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
99
102
|
.gl-button-icon.gl-button-icon {
|
|
100
103
|
@include gl-mr-0;
|
|
101
104
|
}
|
|
@@ -103,6 +106,7 @@
|
|
|
103
106
|
&.btn-sm .gl-new-dropdown-chevron {
|
|
104
107
|
@include gl-mx-0;
|
|
105
108
|
}
|
|
109
|
+
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
$dropdown-content-padding: 0.25rem;
|