@gitlab/ui 64.17.0 → 64.18.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 +14 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +7 -3
- 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/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +2 -2
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +37 -43
- package/src/components/base/new_dropdowns/listbox/listbox.vue +7 -4
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/border.scss +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "64.
|
|
3
|
+
"version": "64.18.1",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"babel-loader": "^8.0.5",
|
|
119
119
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
120
120
|
"bootstrap": "4.6.2",
|
|
121
|
-
"cypress": "12.
|
|
121
|
+
"cypress": "12.16.0",
|
|
122
122
|
"emoji-regex": "^10.0.0",
|
|
123
123
|
"eslint": "8.42.0",
|
|
124
124
|
"eslint-import-resolver-jest": "3.0.2",
|
|
@@ -485,31 +485,33 @@ describe('GlCollapsibleListbox', () => {
|
|
|
485
485
|
});
|
|
486
486
|
|
|
487
487
|
it.each`
|
|
488
|
-
|
|
489
|
-
${'
|
|
490
|
-
${'
|
|
488
|
+
description | props
|
|
489
|
+
${'multi-select'} | ${{ multiple: true, selected: mockOptionsValues }}
|
|
490
|
+
${'single-select'} | ${{ multiple: false, selected: mockOptions[1].value }}
|
|
491
491
|
`(
|
|
492
|
-
'
|
|
493
|
-
({
|
|
492
|
+
'shows the button if the label is provided and the selection is complete in $description mode',
|
|
493
|
+
({ props }) => {
|
|
494
494
|
buildWrapper({
|
|
495
495
|
headerText: 'Select assignee',
|
|
496
496
|
resetButtonLabel: 'Unassign',
|
|
497
|
-
selected,
|
|
498
497
|
items: mockOptions,
|
|
499
|
-
|
|
498
|
+
...props,
|
|
500
499
|
});
|
|
501
500
|
|
|
502
|
-
expect(findResetButton().exists()).toBe(
|
|
501
|
+
expect(findResetButton().exists()).toBe(true);
|
|
503
502
|
}
|
|
504
503
|
);
|
|
505
504
|
|
|
506
|
-
it
|
|
505
|
+
it.each`
|
|
506
|
+
description | props
|
|
507
|
+
${'multi-select'} | ${{ multiple: true, selected: [] }}
|
|
508
|
+
${'single-select'} | ${{ multiple: false, selected: [] }}
|
|
509
|
+
`('hides the button if the selection is empty in $description mode', ({ props }) => {
|
|
507
510
|
buildWrapper({
|
|
508
511
|
headerText: 'Select assignee',
|
|
509
512
|
resetButtonLabel: 'Unassign',
|
|
510
|
-
selected: mockOptions[1].value,
|
|
511
513
|
items: mockOptions,
|
|
512
|
-
|
|
514
|
+
...props,
|
|
513
515
|
});
|
|
514
516
|
|
|
515
517
|
expect(findResetButton().exists()).toBe(false);
|
|
@@ -527,22 +529,7 @@ describe('GlCollapsibleListbox', () => {
|
|
|
527
529
|
expect(findResetButton().exists()).toBe(false);
|
|
528
530
|
});
|
|
529
531
|
|
|
530
|
-
it
|
|
531
|
-
description | props
|
|
532
|
-
${'multi-select'} | ${{ multiple: true, selected: [] }}
|
|
533
|
-
${'single-select'} | ${{ multiple: false, selected: null }}
|
|
534
|
-
`('hides the button if the selection is empty in $description mode', ({ props }) => {
|
|
535
|
-
buildWrapper({
|
|
536
|
-
headerText: 'Select assignee',
|
|
537
|
-
resetButtonLabel: 'Unassign',
|
|
538
|
-
items: mockOptions,
|
|
539
|
-
...props,
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
expect(findResetButton().exists()).toBe(false);
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
it('on click, emits the reset event does not and call closeAndFocus() for multiple mode', () => {
|
|
532
|
+
it('on click, emits the `reset` event but does not call `closeAndFocus`', () => {
|
|
546
533
|
buildWrapper({
|
|
547
534
|
headerText: 'Select assignee',
|
|
548
535
|
resetButtonLabel: 'Unassign',
|
|
@@ -572,24 +559,31 @@ describe('GlCollapsibleListbox', () => {
|
|
|
572
559
|
expect(wrapper).toHaveLoggedVueErrors();
|
|
573
560
|
});
|
|
574
561
|
|
|
575
|
-
|
|
576
|
-
multiple | resetVisible | selectAllVisible
|
|
577
|
-
${false} | ${false} | ${false}
|
|
578
|
-
${true} | ${false} | ${true}
|
|
562
|
+
describe.each`
|
|
563
|
+
multiple | resetVisible | selectAllVisible | selected
|
|
564
|
+
${false} | ${false} | ${false} | ${[]}
|
|
565
|
+
${true} | ${false} | ${true} | ${[]}
|
|
579
566
|
`(
|
|
580
|
-
'
|
|
581
|
-
({ multiple, resetVisible, selectAllVisible }) => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
567
|
+
'when label is provided, selection is empty and multiple option is $multiple',
|
|
568
|
+
({ multiple, resetVisible, selectAllVisible, selected }) => {
|
|
569
|
+
beforeEach(() => {
|
|
570
|
+
buildWrapper({
|
|
571
|
+
headerText: 'Select assignee',
|
|
572
|
+
resetButtonLabel: 'Unassign',
|
|
573
|
+
showSelectAllButtonLabel: 'Select All',
|
|
574
|
+
items: mockOptions,
|
|
575
|
+
selected,
|
|
576
|
+
multiple,
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it(`${selectAllVisible ? 'shows' : 'does not show'} the Select all button`, () => {
|
|
581
|
+
expect(findSelectAllButton().exists()).toBe(selectAllVisible);
|
|
589
582
|
});
|
|
590
583
|
|
|
591
|
-
|
|
592
|
-
|
|
584
|
+
it(`${resetVisible ? 'shows' : 'does not show'} the Reset button`, () => {
|
|
585
|
+
expect(findResetButton().exists()).toBe(resetVisible);
|
|
586
|
+
});
|
|
593
587
|
}
|
|
594
588
|
);
|
|
595
589
|
|
|
@@ -644,7 +638,7 @@ describe('GlCollapsibleListbox', () => {
|
|
|
644
638
|
expect(findSelectAllButton().text()).toBe('Select All');
|
|
645
639
|
});
|
|
646
640
|
|
|
647
|
-
it('on click, emits the select-all event and calls closeAndFocus
|
|
641
|
+
it('on click, emits the `select-all` event and calls `closeAndFocus`', () => {
|
|
648
642
|
buildWrapper({
|
|
649
643
|
headerText: 'Select assignee',
|
|
650
644
|
resetButtonLabel: 'Unassign',
|
|
@@ -398,10 +398,6 @@ export default {
|
|
|
398
398
|
return false;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
if (!this.multiple) {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
401
|
/**
|
|
406
402
|
* if dropdown has no items
|
|
407
403
|
* reset all should be hidden
|
|
@@ -410,6 +406,13 @@ export default {
|
|
|
410
406
|
return false;
|
|
411
407
|
}
|
|
412
408
|
|
|
409
|
+
/**
|
|
410
|
+
* hide if no selection
|
|
411
|
+
*/
|
|
412
|
+
if (this.selected.length === 0) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
|
|
413
416
|
if (this.multiple) {
|
|
414
417
|
return this.selected.length === this.items.length;
|
|
415
418
|
}
|
package/src/scss/utilities.scss
CHANGED
|
@@ -1149,6 +1149,14 @@
|
|
|
1149
1149
|
border-left-color: transparent !important;
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
|
+
.gl-border-gray-10 {
|
|
1153
|
+
border-color: $gray-10;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.gl-border-gray-10\! {
|
|
1157
|
+
border-color: $gray-10 !important;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1152
1160
|
.gl-border-gray-50 {
|
|
1153
1161
|
border-color: $gray-50;
|
|
1154
1162
|
}
|