@gitlab/ui 113.3.2 → 113.5.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 +14 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +6 -2
- package/dist/components/base/new_dropdowns/listbox/listbox.js +145 -44
- package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +2 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +4 -4
- package/src/components/base/animated_icon/animated_icon.scss +2 -2
- package/src/components/base/avatar/avatar.scss +12 -9
- package/src/components/base/badge/badge.scss +1 -1
- package/src/components/base/breadcrumb/breadcrumb.scss +1 -1
- package/src/components/base/button/button.scss +4 -4
- package/src/components/base/form/form_input/form_input.scss +4 -4
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +15 -5
- package/src/components/base/new_dropdowns/dropdown_item.scss +2 -2
- package/src/components/base/new_dropdowns/listbox/listbox.vue +321 -186
- package/src/components/base/new_dropdowns/listbox/listbox_search_input.vue +2 -0
- package/src/components/base/pagination/pagination.scss +4 -4
- package/src/components/charts/single_stat/single_stat.scss +3 -1
- package/src/scss/functions.scss +4 -3
- package/src/scss/mixins.scss +6 -4
- package/src/scss/variables.scss +9 -8
- package/src/vendor/bootstrap/scss/_custom-forms.scss +3 -3
- package/src/vendor/bootstrap/scss/_dropdown.scss +2 -1
- package/src/vendor/bootstrap/scss/_forms.scss +2 -1
- package/src/vendor/bootstrap/scss/_functions.scss +36 -30
- package/src/vendor/bootstrap/scss/_list-group.scss +2 -1
- package/src/vendor/bootstrap/scss/_modal.scss +1 -1
- package/src/vendor/bootstrap/scss/_navbar.scss +2 -1
- package/src/vendor/bootstrap/scss/_popover.scss +2 -1
- package/src/vendor/bootstrap/scss/_root.scss +3 -2
- package/src/vendor/bootstrap/scss/_tables.scss +2 -1
- package/src/vendor/bootstrap/scss/_variables.scss +21 -17
- package/src/vendor/bootstrap/scss/mixins/_alert.scss +3 -2
- package/src/vendor/bootstrap/scss/mixins/_background-variant.scss +3 -2
- package/src/vendor/bootstrap/scss/mixins/_badge.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_border-radius.scss +5 -3
- package/src/vendor/bootstrap/scss/mixins/_box-shadow.scss +6 -5
- package/src/vendor/bootstrap/scss/mixins/_breakpoints.scss +6 -4
- package/src/vendor/bootstrap/scss/mixins/_buttons.scss +6 -5
- package/src/vendor/bootstrap/scss/mixins/_forms.scss +3 -2
- package/src/vendor/bootstrap/scss/mixins/_gradients.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_grid-framework.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_grid.scss +4 -3
- package/src/vendor/bootstrap/scss/mixins/_list-group.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_table-row.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_text-emphasis.scss +2 -1
- package/src/vendor/bootstrap/scss/mixins/_transition.scss +5 -4
- package/src/vendor/bootstrap/scss/utilities/_display.scss +2 -1
- package/src/vendor/bootstrap/scss/utilities/_embed.scss +5 -3
- package/src/vendor/bootstrap/scss/utilities/_flex.scss +2 -1
- package/src/vendor/bootstrap/scss/utilities/_float.scss +2 -1
- package/src/vendor/bootstrap/scss/utilities/_spacing.scss +2 -1
- package/src/vendor/bootstrap/scss/utilities/_text.scss +2 -1
- package/src/vendor/bootstrap/scss/vendor/_rfs.scss +13 -10
- package/src/vendor/bootstrap-vue/src/_variables.scss +3 -1
- package/src/vendor/bootstrap-vue/src/components/form-input/_form-input.scss +8 -6
- package/src/vendor/bootstrap-vue/src/components/table/_table.scss +5 -2
- package/src/vendor/bootstrap-vue/src/components/toast/_toast.scss +4 -2
- package/translations.js +3 -0
|
@@ -26,7 +26,7 @@ import GlLoadingIcon from '../../loading_icon/loading_icon.vue';
|
|
|
26
26
|
import GlIntersectionObserver from '../../../utilities/intersection_observer/intersection_observer.vue';
|
|
27
27
|
import GlSearchBoxByType from '../../search_box_by_type/search_box_by_type.vue';
|
|
28
28
|
import GlBaseDropdown from '../base_dropdown/base_dropdown.vue';
|
|
29
|
-
import { translatePlural } from '../../../../utils/i18n';
|
|
29
|
+
import { translate, translatePlural } from '../../../../utils/i18n';
|
|
30
30
|
import GlListboxItem from './listbox_item.vue';
|
|
31
31
|
import GlListboxSearchInput from './listbox_search_input.vue';
|
|
32
32
|
import GlListboxGroup from './listbox_group.vue';
|
|
@@ -373,13 +373,22 @@ export default {
|
|
|
373
373
|
return {
|
|
374
374
|
selectedValues: [],
|
|
375
375
|
listboxId: uniqueId('listbox-'),
|
|
376
|
+
searchInputId: uniqueId('listbox-search-input-'),
|
|
376
377
|
nextFocusedItemIndex: null,
|
|
377
378
|
searchStr: '',
|
|
378
379
|
topBoundaryVisible: true,
|
|
379
380
|
bottomBoundaryVisible: true,
|
|
381
|
+
activeItemId: null,
|
|
382
|
+
itemIds: new Map(),
|
|
380
383
|
};
|
|
381
384
|
},
|
|
382
385
|
computed: {
|
|
386
|
+
ariaLabelledByID() {
|
|
387
|
+
if (this.searchable) {
|
|
388
|
+
return this.searchInputId;
|
|
389
|
+
}
|
|
390
|
+
return this.listAriaLabelledBy || this.headerId || this.toggleIdComputed;
|
|
391
|
+
},
|
|
383
392
|
toggleIdComputed() {
|
|
384
393
|
return this.toggleId || uniqueId('dropdown-toggle-btn-');
|
|
385
394
|
},
|
|
@@ -477,6 +486,9 @@ export default {
|
|
|
477
486
|
showIntersectionObserver() {
|
|
478
487
|
return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
|
|
479
488
|
},
|
|
489
|
+
isBusy() {
|
|
490
|
+
return this.infiniteScrollLoading || this.loading || this.searching;
|
|
491
|
+
},
|
|
480
492
|
hasCustomToggle() {
|
|
481
493
|
return Boolean(this.$scopedSlots.toggle);
|
|
482
494
|
},
|
|
@@ -497,6 +509,24 @@ export default {
|
|
|
497
509
|
hasFooter() {
|
|
498
510
|
return Boolean(this.$scopedSlots.footer);
|
|
499
511
|
},
|
|
512
|
+
loadingAnnouncementText() {
|
|
513
|
+
if (this.infiniteScrollLoading) {
|
|
514
|
+
return translate(
|
|
515
|
+
'GlCollapsibleListbox.loadingAnnouncementText.loadingMoreItems',
|
|
516
|
+
'Loading more items'
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
if (this.searching) {
|
|
520
|
+
return translate('GlCollapsibleListbox.loadingAnnouncementText.searching', 'Searching');
|
|
521
|
+
}
|
|
522
|
+
if (this.loading) {
|
|
523
|
+
return translate(
|
|
524
|
+
'GlCollapsibleListbox.loadingAnnouncementText.loadingItems',
|
|
525
|
+
'Loading items'
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
return '';
|
|
529
|
+
},
|
|
500
530
|
},
|
|
501
531
|
watch: {
|
|
502
532
|
selected: {
|
|
@@ -595,6 +625,9 @@ export default {
|
|
|
595
625
|
*/
|
|
596
626
|
if (this.searchHasOptions) {
|
|
597
627
|
this.nextFocusedItemIndex = 0;
|
|
628
|
+
// Set activeItemId for the first item
|
|
629
|
+
const firstItem = this.flattenedOptions[0];
|
|
630
|
+
this.activeItemId = this.generateItemId(firstItem);
|
|
598
631
|
}
|
|
599
632
|
} else {
|
|
600
633
|
this.focusItem(this.selectedIndices[0] ?? 0, this.getFocusableListItemElements());
|
|
@@ -615,54 +648,80 @@ export default {
|
|
|
615
648
|
this.$emit(GL_DROPDOWN_HIDDEN);
|
|
616
649
|
this.nextFocusedItemIndex = null;
|
|
617
650
|
},
|
|
651
|
+
getNextIndex(currentIndex, keyCode, totalLength) {
|
|
652
|
+
// For UP: move up or wrap to end
|
|
653
|
+
if (keyCode === ARROW_UP) {
|
|
654
|
+
return currentIndex > 0 ? currentIndex - 1 : totalLength - 1;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// For DOWN: move down or wrap to start
|
|
658
|
+
return currentIndex < totalLength - 1 ? currentIndex + 1 : 0;
|
|
659
|
+
},
|
|
660
|
+
handleListNavigation(keyCode, elements) {
|
|
661
|
+
const currentIndex = this.nextFocusedItemIndex ?? -1;
|
|
662
|
+
const nextIndex = this.getNextIndex(currentIndex, keyCode, elements.length);
|
|
663
|
+
this.focusItem(nextIndex, elements, this.searchable);
|
|
664
|
+
},
|
|
618
665
|
onKeydown(event) {
|
|
619
666
|
const { code, target } = event;
|
|
620
667
|
const elements = this.getFocusableListItemElements();
|
|
621
668
|
|
|
622
669
|
if (elements.length < 1) return;
|
|
623
670
|
|
|
624
|
-
let stop = true;
|
|
625
671
|
const isSearchInput = target.matches(SEARCH_INPUT_SELECTOR);
|
|
672
|
+
let stop = true;
|
|
626
673
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
} else if (code === END) {
|
|
633
|
-
if (isSearchInput) {
|
|
634
|
-
return;
|
|
635
|
-
}
|
|
636
|
-
this.focusItem(elements.length - 1, elements);
|
|
637
|
-
} else if (code === ARROW_UP) {
|
|
638
|
-
if (isSearchInput) {
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
if (this.searchable && elements.indexOf(target) === 0) {
|
|
642
|
-
this.focusSearchInput();
|
|
643
|
-
if (!this.searchHasOptions) {
|
|
644
|
-
this.nextFocusedItemIndex = null;
|
|
674
|
+
switch (code) {
|
|
675
|
+
case HOME:
|
|
676
|
+
// Jump to first item if searchable or not in search input
|
|
677
|
+
if (this.searchable || !isSearchInput) {
|
|
678
|
+
this.focusItem(0, elements, this.searchable);
|
|
645
679
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
680
|
+
break;
|
|
681
|
+
|
|
682
|
+
case END:
|
|
683
|
+
// Jump to last item if searchable or not in search input
|
|
684
|
+
if (this.searchable || !isSearchInput) {
|
|
685
|
+
this.focusItem(elements.length - 1, elements, this.searchable);
|
|
686
|
+
}
|
|
687
|
+
break;
|
|
688
|
+
|
|
689
|
+
case ARROW_UP:
|
|
690
|
+
// Let default behavior work for non-searchable input
|
|
691
|
+
if (isSearchInput && !this.searchable) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
this.handleListNavigation(ARROW_UP, elements);
|
|
695
|
+
break;
|
|
696
|
+
|
|
697
|
+
case ARROW_DOWN:
|
|
698
|
+
// Focus first item from search input, otherwise navigate down
|
|
699
|
+
if (isSearchInput && !this.searchable) {
|
|
700
|
+
this.focusItem(0, elements);
|
|
701
|
+
} else {
|
|
702
|
+
this.handleListNavigation(ARROW_DOWN, elements);
|
|
703
|
+
}
|
|
704
|
+
break;
|
|
705
|
+
|
|
706
|
+
case ENTER:
|
|
707
|
+
if (isSearchInput) {
|
|
708
|
+
// Toggle selection of highlighted item if one exists
|
|
709
|
+
if (elements.length > 0 && this.nextFocusedItemIndex !== null) {
|
|
710
|
+
const highlightedItem = this.flattenedOptions[this.nextFocusedItemIndex];
|
|
711
|
+
this.onSelect(highlightedItem, !this.isSelected(highlightedItem));
|
|
712
|
+
}
|
|
713
|
+
} else {
|
|
714
|
+
stop = false;
|
|
715
|
+
}
|
|
716
|
+
break;
|
|
717
|
+
|
|
718
|
+
default:
|
|
719
|
+
// Allow default behavior for unhandled keys
|
|
720
|
+
stop = false;
|
|
721
|
+
break;
|
|
664
722
|
}
|
|
665
723
|
|
|
724
|
+
// Prevent default behavior for handled keys
|
|
666
725
|
if (stop) {
|
|
667
726
|
stopEvent(event);
|
|
668
727
|
}
|
|
@@ -678,10 +737,25 @@ export default {
|
|
|
678
737
|
|
|
679
738
|
this.focusItem(nextIndex, elements);
|
|
680
739
|
},
|
|
681
|
-
focusItem(index, elements) {
|
|
740
|
+
focusItem(index, elements, keepSearchFocused = false) {
|
|
682
741
|
this.nextFocusedItemIndex = index;
|
|
683
742
|
|
|
684
|
-
|
|
743
|
+
// Always update the activeItemId when focus changes
|
|
744
|
+
const item = this.flattenedOptions[index];
|
|
745
|
+
if (item) {
|
|
746
|
+
this.activeItemId = this.generateItemId(item);
|
|
747
|
+
} else {
|
|
748
|
+
this.activeItemId = null;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// If we're not keeping the search focused, focus the item
|
|
752
|
+
if (!keepSearchFocused) {
|
|
753
|
+
elements[index]?.focus();
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
this.$nextTick(() => {
|
|
757
|
+
this.scrollActiveItemIntoView();
|
|
758
|
+
});
|
|
685
759
|
},
|
|
686
760
|
focusSearchInput() {
|
|
687
761
|
this.$refs.searchBox.focusInput();
|
|
@@ -806,6 +880,41 @@ export default {
|
|
|
806
880
|
this.scrollObserver = observer;
|
|
807
881
|
},
|
|
808
882
|
isOption,
|
|
883
|
+
generateItemId(item) {
|
|
884
|
+
const key = item.value === null ? ITEM_NULL_KEY : item.value;
|
|
885
|
+
if (!this.itemIds.has(key)) {
|
|
886
|
+
this.itemIds.set(key, uniqueId('listbox-item-'));
|
|
887
|
+
}
|
|
888
|
+
return this.itemIds.get(key);
|
|
889
|
+
},
|
|
890
|
+
scrollActiveItemIntoView() {
|
|
891
|
+
const listContainer = this.$refs.list;
|
|
892
|
+
if (!this.activeItemId || !this.searchable || !listContainer) return;
|
|
893
|
+
|
|
894
|
+
const activeElement = document.getElementById(this.activeItemId);
|
|
895
|
+
if (!activeElement) return;
|
|
896
|
+
|
|
897
|
+
const containerRect = listContainer.getBoundingClientRect();
|
|
898
|
+
const itemRect = activeElement.getBoundingClientRect();
|
|
899
|
+
const itemTop = activeElement.offsetTop;
|
|
900
|
+
const padding = 30;
|
|
901
|
+
|
|
902
|
+
// If item is above the visible area
|
|
903
|
+
if (itemRect.top < containerRect.top) {
|
|
904
|
+
listContainer.scrollTo({
|
|
905
|
+
top: itemTop - padding,
|
|
906
|
+
behavior: 'smooth',
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// If item is below the visible area
|
|
911
|
+
else if (itemRect.bottom > containerRect.bottom) {
|
|
912
|
+
listContainer.scrollTo({
|
|
913
|
+
top: itemTop - containerRect.height + activeElement.offsetHeight + padding,
|
|
914
|
+
behavior: 'smooth',
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
},
|
|
809
918
|
},
|
|
810
919
|
};
|
|
811
920
|
</script>
|
|
@@ -839,165 +948,191 @@ export default {
|
|
|
839
948
|
<slot name="toggle"></slot>
|
|
840
949
|
</template>
|
|
841
950
|
|
|
842
|
-
<
|
|
843
|
-
v-if="headerText"
|
|
844
|
-
class="gl-flex gl-min-h-8 gl-items-center !gl-p-4"
|
|
845
|
-
:class="$options.HEADER_ITEMS_BORDER_CLASSES"
|
|
846
|
-
>
|
|
951
|
+
<template #default="{ visible }">
|
|
847
952
|
<div
|
|
848
|
-
|
|
849
|
-
class="gl-
|
|
850
|
-
|
|
851
|
-
>
|
|
852
|
-
{{ headerText }}
|
|
853
|
-
</div>
|
|
854
|
-
<gl-button
|
|
855
|
-
v-if="showResetButton"
|
|
856
|
-
category="tertiary"
|
|
857
|
-
class="!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset"
|
|
858
|
-
size="small"
|
|
859
|
-
data-testid="listbox-reset-button"
|
|
860
|
-
@click="onResetButtonClicked"
|
|
953
|
+
v-if="headerText"
|
|
954
|
+
class="gl-flex gl-min-h-8 gl-items-center !gl-p-4"
|
|
955
|
+
:class="$options.HEADER_ITEMS_BORDER_CLASSES"
|
|
861
956
|
>
|
|
862
|
-
{{ resetButtonLabel }}
|
|
863
|
-
</gl-button>
|
|
864
|
-
<gl-button
|
|
865
|
-
v-if="showSelectAllButton"
|
|
866
|
-
category="tertiary"
|
|
867
|
-
class="!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset"
|
|
868
|
-
size="small"
|
|
869
|
-
data-testid="listbox-select-all-button"
|
|
870
|
-
@click="onSelectAllButtonClicked"
|
|
871
|
-
>
|
|
872
|
-
{{ showSelectAllButtonLabel }}
|
|
873
|
-
</gl-button>
|
|
874
|
-
</div>
|
|
875
|
-
|
|
876
|
-
<div v-if="searchable" :class="$options.HEADER_ITEMS_BORDER_CLASSES">
|
|
877
|
-
<gl-listbox-search-input
|
|
878
|
-
ref="searchBox"
|
|
879
|
-
v-model="searchStr"
|
|
880
|
-
data-testid="listbox-search-input"
|
|
881
|
-
:placeholder="searchPlaceholder"
|
|
882
|
-
:class="{ 'gl-listbox-topmost': !headerText }"
|
|
883
|
-
@input="search"
|
|
884
|
-
@keydown.enter.prevent
|
|
885
|
-
@keydown="onKeydown"
|
|
886
|
-
/>
|
|
887
|
-
<gl-loading-icon
|
|
888
|
-
v-if="searching"
|
|
889
|
-
data-testid="listbox-search-loader"
|
|
890
|
-
size="md"
|
|
891
|
-
class="gl-my-3"
|
|
892
|
-
/>
|
|
893
|
-
</div>
|
|
894
|
-
|
|
895
|
-
<component
|
|
896
|
-
:is="listboxTag"
|
|
897
|
-
v-if="showList"
|
|
898
|
-
:id="listboxId"
|
|
899
|
-
ref="list"
|
|
900
|
-
:aria-labelledby="listAriaLabelledBy || headerId || toggleIdComputed"
|
|
901
|
-
role="listbox"
|
|
902
|
-
class="gl-new-dropdown-contents gl-new-dropdown-contents-with-scrim-overlay"
|
|
903
|
-
:class="listboxClasses"
|
|
904
|
-
tabindex="0"
|
|
905
|
-
@keydown="onKeydown"
|
|
906
|
-
>
|
|
907
|
-
<component :is="itemTag" class="top-scrim-wrapper" aria-hidden="true" data-testid="top-scrim">
|
|
908
957
|
<div
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
<
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
958
|
+
:id="headerId"
|
|
959
|
+
class="gl-grow gl-pr-2 gl-text-sm gl-font-bold gl-text-strong"
|
|
960
|
+
data-testid="listbox-header-text"
|
|
961
|
+
>
|
|
962
|
+
{{ headerText }}
|
|
963
|
+
</div>
|
|
964
|
+
<gl-button
|
|
965
|
+
v-if="showResetButton"
|
|
966
|
+
category="tertiary"
|
|
967
|
+
class="!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset"
|
|
968
|
+
size="small"
|
|
969
|
+
data-testid="listbox-reset-button"
|
|
970
|
+
@click="onResetButtonClicked"
|
|
971
|
+
>
|
|
972
|
+
{{ resetButtonLabel }}
|
|
973
|
+
</gl-button>
|
|
974
|
+
<gl-button
|
|
975
|
+
v-if="showSelectAllButton"
|
|
976
|
+
category="tertiary"
|
|
977
|
+
class="!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-text-sm focus:!gl-focus-inset"
|
|
978
|
+
size="small"
|
|
979
|
+
data-testid="listbox-select-all-button"
|
|
980
|
+
@click="onSelectAllButtonClicked"
|
|
981
|
+
>
|
|
982
|
+
{{ showSelectAllButtonLabel }}
|
|
983
|
+
</gl-button>
|
|
984
|
+
</div>
|
|
932
985
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
986
|
+
<div v-if="searchable" :class="$options.HEADER_ITEMS_BORDER_CLASSES">
|
|
987
|
+
<gl-listbox-search-input
|
|
988
|
+
:id="searchInputId"
|
|
989
|
+
ref="searchBox"
|
|
990
|
+
v-model="searchStr"
|
|
991
|
+
data-testid="listbox-search-input"
|
|
992
|
+
role="combobox"
|
|
993
|
+
:aria-expanded="String(visible)"
|
|
994
|
+
:aria-controls="listboxId"
|
|
995
|
+
:aria-activedescendant="activeItemId"
|
|
996
|
+
aria-haspopup="listbox"
|
|
997
|
+
:placeholder="searchPlaceholder"
|
|
998
|
+
:class="{ 'gl-listbox-topmost': !headerText }"
|
|
999
|
+
@input="search"
|
|
1000
|
+
@keydown.enter.prevent
|
|
1001
|
+
@keydown="onKeydown"
|
|
1002
|
+
/>
|
|
1003
|
+
<gl-loading-icon
|
|
1004
|
+
v-if="searching"
|
|
1005
|
+
data-testid="listbox-search-loader"
|
|
1006
|
+
size="md"
|
|
1007
|
+
class="gl-my-3"
|
|
1008
|
+
/>
|
|
1009
|
+
</div>
|
|
944
1010
|
|
|
1011
|
+
<component
|
|
1012
|
+
:is="listboxTag"
|
|
1013
|
+
v-if="showList"
|
|
1014
|
+
:id="listboxId"
|
|
1015
|
+
ref="list"
|
|
1016
|
+
:aria-busy="isBusy"
|
|
1017
|
+
:aria-labelledby="ariaLabelledByID"
|
|
1018
|
+
:aria-multiselectable="multiple ? 'true' : undefined"
|
|
1019
|
+
role="listbox"
|
|
1020
|
+
class="gl-new-dropdown-contents gl-new-dropdown-contents-with-scrim-overlay"
|
|
1021
|
+
:class="listboxClasses"
|
|
1022
|
+
tabindex="0"
|
|
1023
|
+
@keydown="onKeydown"
|
|
1024
|
+
>
|
|
1025
|
+
<component
|
|
1026
|
+
:is="itemTag"
|
|
1027
|
+
class="top-scrim-wrapper"
|
|
1028
|
+
aria-hidden="true"
|
|
1029
|
+
data-testid="top-scrim"
|
|
1030
|
+
>
|
|
1031
|
+
<div
|
|
1032
|
+
class="top-scrim"
|
|
1033
|
+
:class="{ 'top-scrim-light': !hasHeader, 'top-scrim-dark': hasHeader }"
|
|
1034
|
+
></div>
|
|
1035
|
+
</component>
|
|
1036
|
+
<component :is="itemTag" ref="top-boundary" aria-hidden="true" />
|
|
1037
|
+
<template v-for="(item, index) in items">
|
|
1038
|
+
<template v-if="isOption(item)">
|
|
945
1039
|
<gl-listbox-item
|
|
946
|
-
|
|
947
|
-
:key="listboxItemKey(
|
|
948
|
-
:data-testid="`listbox-item-${
|
|
949
|
-
:is-highlighted="isHighlighted(
|
|
950
|
-
:is-selected="isSelected(
|
|
951
|
-
:is-focused="isFocused(
|
|
1040
|
+
:id="generateItemId(item)"
|
|
1041
|
+
:key="listboxItemKey(item)"
|
|
1042
|
+
:data-testid="`listbox-item-${item.value}`"
|
|
1043
|
+
:is-highlighted="isHighlighted(item)"
|
|
1044
|
+
:is-selected="isSelected(item)"
|
|
1045
|
+
:is-focused="isFocused(item)"
|
|
952
1046
|
:is-check-centered="isCheckCentered"
|
|
953
|
-
|
|
1047
|
+
v-bind="listboxItemMoreItemsAriaAttributes(index)"
|
|
1048
|
+
@select="onSelect(item, $event)"
|
|
954
1049
|
>
|
|
955
1050
|
<!-- @slot Custom template of the listbox item -->
|
|
956
|
-
<slot name="list-item" :item="
|
|
957
|
-
{{
|
|
1051
|
+
<slot name="list-item" :item="item">
|
|
1052
|
+
{{ item.text }}
|
|
958
1053
|
</slot>
|
|
959
1054
|
</gl-listbox-item>
|
|
960
|
-
</
|
|
1055
|
+
</template>
|
|
1056
|
+
|
|
1057
|
+
<template v-else>
|
|
1058
|
+
<gl-listbox-group
|
|
1059
|
+
:key="item.text"
|
|
1060
|
+
:name="item.text"
|
|
1061
|
+
:text-sr-only="item.textSrOnly"
|
|
1062
|
+
:class="groupClasses(index)"
|
|
1063
|
+
>
|
|
1064
|
+
<template v-if="$scopedSlots['group-label']" #group-label>
|
|
1065
|
+
<!-- @slot Custom template for group names -->
|
|
1066
|
+
<slot name="group-label" :group="item"></slot>
|
|
1067
|
+
</template>
|
|
1068
|
+
|
|
1069
|
+
<gl-listbox-item
|
|
1070
|
+
v-for="option in item.options"
|
|
1071
|
+
:id="generateItemId(option)"
|
|
1072
|
+
:key="listboxItemKey(option)"
|
|
1073
|
+
:data-testid="`listbox-item-${option.value}`"
|
|
1074
|
+
:is-highlighted="isHighlighted(option)"
|
|
1075
|
+
:is-selected="isSelected(option)"
|
|
1076
|
+
:is-focused="isFocused(option)"
|
|
1077
|
+
:is-check-centered="isCheckCentered"
|
|
1078
|
+
@select="onSelect(option, $event)"
|
|
1079
|
+
>
|
|
1080
|
+
<!-- @slot Custom template of the listbox item -->
|
|
1081
|
+
<slot name="list-item" :item="option">
|
|
1082
|
+
{{ option.text }}
|
|
1083
|
+
</slot>
|
|
1084
|
+
</gl-listbox-item>
|
|
1085
|
+
</gl-listbox-group>
|
|
1086
|
+
</template>
|
|
961
1087
|
</template>
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1088
|
+
<component :is="itemTag" v-if="infiniteScrollLoading">
|
|
1089
|
+
<gl-loading-icon data-testid="listbox-infinite-scroll-loader" size="md" class="gl-my-3" />
|
|
1090
|
+
</component>
|
|
1091
|
+
<gl-intersection-observer
|
|
1092
|
+
v-if="showIntersectionObserver"
|
|
1093
|
+
@appear="onIntersectionObserverAppear"
|
|
1094
|
+
/>
|
|
1095
|
+
<component :is="itemTag" ref="bottom-boundary" aria-hidden="true" />
|
|
1096
|
+
<component
|
|
1097
|
+
:is="itemTag"
|
|
1098
|
+
class="bottom-scrim-wrapper"
|
|
1099
|
+
aria-hidden="true"
|
|
1100
|
+
data-testid="bottom-scrim"
|
|
1101
|
+
>
|
|
1102
|
+
<div class="bottom-scrim" :class="{ '!gl-rounded-none': hasFooter }"></div>
|
|
1103
|
+
</component>
|
|
965
1104
|
</component>
|
|
966
|
-
<
|
|
967
|
-
v-if="
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
<component
|
|
972
|
-
:is="itemTag"
|
|
973
|
-
class="bottom-scrim-wrapper"
|
|
974
|
-
aria-hidden="true"
|
|
975
|
-
data-testid="bottom-scrim"
|
|
1105
|
+
<span
|
|
1106
|
+
v-if="announceSRSearchResults"
|
|
1107
|
+
data-testid="listbox-number-of-results"
|
|
1108
|
+
class="gl-sr-only"
|
|
1109
|
+
aria-live="assertive"
|
|
976
1110
|
>
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
{{
|
|
989
|
-
</
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1111
|
+
<!-- @slot Text read by screen reader announcing a number of search results -->
|
|
1112
|
+
<slot name="search-summary-sr-only">
|
|
1113
|
+
{{ srOnlyResultsLabel(flattenedOptions.length) }}
|
|
1114
|
+
</slot>
|
|
1115
|
+
</span>
|
|
1116
|
+
<span
|
|
1117
|
+
v-if="isBusy"
|
|
1118
|
+
class="gl-sr-only"
|
|
1119
|
+
aria-live="polite"
|
|
1120
|
+
data-testid="listbox-loading-announcement"
|
|
1121
|
+
>
|
|
1122
|
+
{{ loadingAnnouncementText }}
|
|
1123
|
+
</span>
|
|
1124
|
+
|
|
1125
|
+
<div
|
|
1126
|
+
v-else-if="showNoResultsText"
|
|
1127
|
+
aria-live="assertive"
|
|
1128
|
+
class="gl-py-3 gl-pl-7 gl-pr-5 gl-text-base gl-text-subtle"
|
|
1129
|
+
data-testid="listbox-no-results-text"
|
|
1130
|
+
>
|
|
1131
|
+
{{ noResultsText }}
|
|
1132
|
+
</div>
|
|
1133
|
+
|
|
1134
|
+
<!-- @slot Content to display in dropdown footer -->
|
|
1135
|
+
<slot name="footer"></slot>
|
|
1136
|
+
</template>
|
|
1002
1137
|
</gl-base-dropdown>
|
|
1003
1138
|
</template>
|
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
GlClearIconButton,
|
|
9
9
|
GlIcon,
|
|
10
10
|
},
|
|
11
|
+
inheritAttrs: false,
|
|
11
12
|
model: {
|
|
12
13
|
prop: 'value',
|
|
13
14
|
event: 'input',
|
|
@@ -65,6 +66,7 @@ export default {
|
|
|
65
66
|
class="gl-listbox-search-input"
|
|
66
67
|
:aria-label="placeholder"
|
|
67
68
|
:placeholder="placeholder"
|
|
69
|
+
v-bind="$attrs"
|
|
68
70
|
v-on="inputListeners"
|
|
69
71
|
/>
|
|
70
72
|
<gl-clear-icon-button
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.gl-pagination-item {
|
|
18
|
+
transition: color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
19
|
+
background-color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
20
|
+
border-color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
21
|
+
box-shadow $gl-transition-duration-medium $gl-easing-out-cubic;
|
|
18
22
|
@apply gl-flex;
|
|
19
23
|
@apply gl-justify-center;
|
|
20
24
|
@apply gl-p-3;
|
|
@@ -27,10 +31,6 @@
|
|
|
27
31
|
@apply gl-border-solid;
|
|
28
32
|
@include gl-action-neutral-colors;
|
|
29
33
|
@include gl-prefers-reduced-motion-transition;
|
|
30
|
-
transition: color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
31
|
-
background-color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
32
|
-
border-color $gl-transition-duration-medium $gl-easing-out-cubic,
|
|
33
|
-
box-shadow $gl-transition-duration-medium $gl-easing-out-cubic;
|
|
34
34
|
|
|
35
35
|
&:hover {
|
|
36
36
|
@apply gl-no-underline;
|