@gitlab/ui 43.11.0 → 43.12.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 +7 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +10 -1
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +19 -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 +1 -0
- package/scss_to_js/scss_variables.json +5 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +9 -1
- package/src/components/base/new_dropdowns/listbox/listbox.vue +9 -0
- package/src/components/base/new_dropdowns/listbox/listbox_item.spec.js +25 -0
- package/src/components/base/new_dropdowns/listbox/listbox_item.vue +19 -2
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/sizing.scss +4 -0
- package/src/scss/variables.scss +1 -0
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ export const breakpointLg = '992px'
|
|
|
26
26
|
export const breakpointXl = '1200px'
|
|
27
27
|
export const breakpoints = '(xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)'
|
|
28
28
|
export const limitedLayoutWidth = '990px'
|
|
29
|
+
export const containerXl = '1280px'
|
|
29
30
|
export const black = '#000'
|
|
30
31
|
export const blackNormal = '#333'
|
|
31
32
|
export const white = '#fff'
|
|
@@ -79,6 +79,7 @@ const generateProps = ({
|
|
|
79
79
|
textSrOnly = defaultValue('textSrOnly'),
|
|
80
80
|
icon = '',
|
|
81
81
|
multiple = defaultValue('multiple'),
|
|
82
|
+
isCheckCentered = defaultValue('isCheckCentered'),
|
|
82
83
|
ariaLabelledby,
|
|
83
84
|
startOpened = true,
|
|
84
85
|
} = {}) => ({
|
|
@@ -94,6 +95,7 @@ const generateProps = ({
|
|
|
94
95
|
textSrOnly,
|
|
95
96
|
icon,
|
|
96
97
|
multiple,
|
|
98
|
+
isCheckCentered,
|
|
97
99
|
ariaLabelledby,
|
|
98
100
|
startOpened,
|
|
99
101
|
});
|
|
@@ -120,6 +122,7 @@ const template = (content, label = '') => `
|
|
|
120
122
|
:text-sr-only="textSrOnly"
|
|
121
123
|
:icon="icon"
|
|
122
124
|
:multiple="multiple"
|
|
125
|
+
:is-check-centered="isCheckCentered"
|
|
123
126
|
:aria-labelledby="ariaLabelledby"
|
|
124
127
|
>
|
|
125
128
|
${content}
|
|
@@ -183,7 +186,10 @@ export const HeaderAndFooter = (args, { argTypes }) => ({
|
|
|
183
186
|
</div>
|
|
184
187
|
</template>`),
|
|
185
188
|
});
|
|
186
|
-
HeaderAndFooter.args = generateProps({
|
|
189
|
+
HeaderAndFooter.args = generateProps({
|
|
190
|
+
toggleText: 'Header and Footer',
|
|
191
|
+
multiple: true,
|
|
192
|
+
});
|
|
187
193
|
HeaderAndFooter.decorators = [makeContainer({ height: '370px' })];
|
|
188
194
|
|
|
189
195
|
export const CustomListItem = (args, { argTypes }) => ({
|
|
@@ -225,6 +231,7 @@ export const CustomListItem = (args, { argTypes }) => ({
|
|
|
225
231
|
:text-sr-only="textSrOnly"
|
|
226
232
|
:icon="icon"
|
|
227
233
|
:multiple="multiple"
|
|
234
|
+
:is-check-centered="isCheckCentered"
|
|
228
235
|
:aria-labelledby="ariaLabelledby"
|
|
229
236
|
>
|
|
230
237
|
<template #list-item="{ item }">
|
|
@@ -247,6 +254,7 @@ CustomListItem.args = generateProps({
|
|
|
247
254
|
{ value: 'markian', text: 'Mark Florian', secondaryText: '@markian', icon: 'bin' },
|
|
248
255
|
],
|
|
249
256
|
multiple: true,
|
|
257
|
+
isCheckCentered: true,
|
|
250
258
|
});
|
|
251
259
|
CustomListItem.decorators = [makeContainer({ height: '200px' })];
|
|
252
260
|
|
|
@@ -152,6 +152,14 @@ export default {
|
|
|
152
152
|
required: false,
|
|
153
153
|
default: false,
|
|
154
154
|
},
|
|
155
|
+
/**
|
|
156
|
+
* Center selected item checkmark
|
|
157
|
+
*/
|
|
158
|
+
isCheckCentered: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
required: false,
|
|
161
|
+
default: false,
|
|
162
|
+
},
|
|
155
163
|
/**
|
|
156
164
|
* The `aria-labelledby` attribute value for the toggle button
|
|
157
165
|
*/
|
|
@@ -335,6 +343,7 @@ export default {
|
|
|
335
343
|
:key="item.value"
|
|
336
344
|
:is-selected="isSelected(item)"
|
|
337
345
|
:is-focused="nextFocusedItemIndex === index"
|
|
346
|
+
:is-check-centered="isCheckCentered"
|
|
338
347
|
@select="onSelect(item, $event)"
|
|
339
348
|
>
|
|
340
349
|
<!-- @slot Custom template of the listbox item -->
|
|
@@ -80,6 +80,31 @@ describe('GlListboxItem', () => {
|
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
describe('checkbox', () => {
|
|
84
|
+
describe('is NOT centered', () => {
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
buildWrapper({ isSelected: true });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should not center check icon by default', () => {
|
|
90
|
+
expect(findCheckIcon().classes()).toEqual(
|
|
91
|
+
expect.arrayContaining(['gl-mt-3', 'gl-align-self-start'])
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('is centered', () => {
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
buildWrapper({ isSelected: true, isCheckCentered: true });
|
|
99
|
+
});
|
|
100
|
+
it('should center the check icon', () => {
|
|
101
|
+
expect(findCheckIcon().classes()).not.toEqual(
|
|
102
|
+
expect.arrayContaining(['gl-mt-3', 'gl-align-self-start'])
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
83
108
|
describe('tabindex', () => {
|
|
84
109
|
it('should set tabindex to `-1` when item is not focused', () => {
|
|
85
110
|
buildWrapper({ isFocused: false });
|
|
@@ -18,6 +18,20 @@ export default {
|
|
|
18
18
|
default: false,
|
|
19
19
|
required: false,
|
|
20
20
|
},
|
|
21
|
+
isCheckCentered: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
checkedClasses() {
|
|
29
|
+
if (this.isCheckCentered) {
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return 'gl-mt-3 gl-align-self-start';
|
|
34
|
+
},
|
|
21
35
|
},
|
|
22
36
|
methods: {
|
|
23
37
|
toggleSelection() {
|
|
@@ -48,8 +62,11 @@ export default {
|
|
|
48
62
|
<gl-icon
|
|
49
63
|
name="mobile-issue-close"
|
|
50
64
|
data-testid="dropdown-item-checkbox"
|
|
51
|
-
class="
|
|
52
|
-
|
|
65
|
+
:class="[
|
|
66
|
+
'gl-new-dropdown-item-check-icon',
|
|
67
|
+
{ 'gl-visibility-hidden': !isSelected },
|
|
68
|
+
checkedClasses,
|
|
69
|
+
]"
|
|
53
70
|
/>
|
|
54
71
|
<span class="gl-new-dropdown-item-text-wrapper">
|
|
55
72
|
<slot></slot>
|
package/src/scss/utilities.scss
CHANGED
|
@@ -4559,6 +4559,14 @@
|
|
|
4559
4559
|
max-width: $limited-layout-width !important;
|
|
4560
4560
|
}
|
|
4561
4561
|
|
|
4562
|
+
.gl-max-w-container-xl {
|
|
4563
|
+
max-width: $container-xl;
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4566
|
+
.gl-max-w-container-xl\! {
|
|
4567
|
+
max-width: $container-xl !important;
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4562
4570
|
.gl-h-auto {
|
|
4563
4571
|
height: auto;
|
|
4564
4572
|
}
|