@gitlab/ui 90.1.0 → 90.2.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/base_dropdown/base_dropdown.js +6 -17
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +1 -13
- package/dist/components/base/new_dropdowns/listbox/listbox.js +1 -13
- package/dist/config.js +2 -22
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +5 -21
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +0 -13
- package/src/components/base/new_dropdowns/listbox/listbox.vue +0 -13
- package/src/config.js +1 -21
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown_deprecated_wrapper.js +0 -47
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown_improved_wrapper.js +0 -47
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown_deprecated_wrapper.vue +0 -14
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown_improved_wrapper.vue +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [90.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v90.1.0...v90.2.0) (2024-08-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **BaseDropdown:** Listen on click and focusin to close dropdown ([d89d99d](https://gitlab.com/gitlab-org/gitlab-ui/commit/d89d99d5dbeeae4dd7287625b059ad6726610204))
|
|
7
|
+
|
|
1
8
|
# [90.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v90.0.0...v90.1.0) (2024-08-22)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -3,10 +3,9 @@ import { offset, autoPlacement, shift, size, autoUpdate, computePosition } from
|
|
|
3
3
|
import { buttonCategoryOptions, dropdownVariantOptions, buttonSizeOptions, dropdownPlacements, dropdownAllowedAutoPlacements } from '../../../../utils/constants';
|
|
4
4
|
import { POSITION_ABSOLUTE, POSITION_FIXED, GL_DROPDOWN_CONTENTS_CLASS, GL_DROPDOWN_BEFORE_CLOSE, GL_DROPDOWN_SHOWN, GL_DROPDOWN_HIDDEN, ENTER, SPACE, ARROW_DOWN, GL_DROPDOWN_FOCUS_CONTENT } from '../constants';
|
|
5
5
|
import { logWarning, isElementFocusable, isElementTabbable } from '../../../../utils/utils';
|
|
6
|
+
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
6
7
|
import GlButton from '../../button/button';
|
|
7
8
|
import GlIcon from '../../icon/icon';
|
|
8
|
-
import BaseDropdownDeprecatedWrapper from './base_dropdown_deprecated_wrapper';
|
|
9
|
-
import BaseDropdownImprovedWrapper from './base_dropdown_improved_wrapper';
|
|
10
9
|
import { DEFAULT_OFFSET, FIXED_WIDTH_CLASS } from './constants';
|
|
11
10
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
12
11
|
|
|
@@ -16,9 +15,10 @@ var script = {
|
|
|
16
15
|
BASE_DROPDOWN_CLASS,
|
|
17
16
|
components: {
|
|
18
17
|
GlButton,
|
|
19
|
-
GlIcon
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
GlIcon
|
|
19
|
+
},
|
|
20
|
+
directives: {
|
|
21
|
+
Outside: OutsideDirective
|
|
22
22
|
},
|
|
23
23
|
props: {
|
|
24
24
|
toggleText: {
|
|
@@ -141,14 +141,6 @@ var script = {
|
|
|
141
141
|
required: false,
|
|
142
142
|
default: POSITION_ABSOLUTE,
|
|
143
143
|
validator: strategy => [POSITION_ABSOLUTE, POSITION_FIXED].includes(strategy)
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* Whether to use the deprecated or improved wrapper
|
|
147
|
-
*/
|
|
148
|
-
improvedHideHeuristics: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
required: false,
|
|
151
|
-
default: false
|
|
152
144
|
}
|
|
153
145
|
},
|
|
154
146
|
data() {
|
|
@@ -159,9 +151,6 @@ var script = {
|
|
|
159
151
|
};
|
|
160
152
|
},
|
|
161
153
|
computed: {
|
|
162
|
-
wrapperComponent() {
|
|
163
|
-
return this.improvedHideHeuristics ? BaseDropdownImprovedWrapper : BaseDropdownDeprecatedWrapper;
|
|
164
|
-
},
|
|
165
154
|
hasNoVisibleToggleText() {
|
|
166
155
|
var _this$toggleText;
|
|
167
156
|
return !((_this$toggleText = this.toggleText) !== null && _this$toggleText !== void 0 && _this$toggleText.length) || this.textSrOnly;
|
|
@@ -442,7 +431,7 @@ var script = {
|
|
|
442
431
|
const __vue_script__ = script;
|
|
443
432
|
|
|
444
433
|
/* template */
|
|
445
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.
|
|
434
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"outside",rawName:"v-outside.click.focusin",value:(_vm.close),expression:"close",modifiers:{"click":true,"focusin":true}}],class:[_vm.$options.BASE_DROPDOWN_CLASS, { '!gl-block': _vm.block }]},[_c(_vm.toggleComponent,_vm._g(_vm._b({ref:"toggle",tag:"component",attrs:{"id":_vm.toggleId,"data-testid":"base-dropdown-toggle"},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.close.apply(null, arguments)}}},'component',_vm.toggleAttributes,false),_vm.toggleListeners),[_vm._t("toggle",function(){return [_c('span',{staticClass:"gl-new-dropdown-button-text",class:{ 'gl-sr-only': _vm.textSrOnly }},[_vm._v("\n "+_vm._s(_vm.toggleText)+"\n ")]),_vm._v(" "),(!_vm.noCaret)?_c('gl-icon',{staticClass:"gl-button-icon gl-new-dropdown-chevron",attrs:{"name":"chevron-down"}}):_vm._e()]})],2),_vm._v(" "),_c('div',{ref:"content",staticClass:"gl-new-dropdown-panel",class:_vm.panelClasses,attrs:{"id":_vm.baseDropdownId,"data-testid":"base-dropdown-menu"},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.closeAndFocus.apply(null, arguments)}}},[_c('div',{staticClass:"gl-new-dropdown-inner"},[_vm._t("default")],2)])],1)};
|
|
446
435
|
var __vue_staticRenderFns__ = [];
|
|
447
436
|
|
|
448
437
|
/* style */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import clamp from 'lodash/clamp';
|
|
2
2
|
import uniqueId from 'lodash/uniqueId';
|
|
3
3
|
import { stopEvent, filterVisible } from '../../../../utils/utils';
|
|
4
|
-
import { glDropdownConfig } from '../../../../config';
|
|
5
4
|
import { GL_DROPDOWN_SHOWN, GL_DROPDOWN_HIDDEN, GL_DROPDOWN_BEFORE_CLOSE, GL_DROPDOWN_FOCUS_CONTENT, POSITION_ABSOLUTE, POSITION_FIXED, HOME, END, ARROW_UP, ARROW_DOWN, ENTER, SPACE, GL_DROPDOWN_CONTENTS_CLASS } from '../constants';
|
|
6
5
|
import { buttonCategoryOptions, dropdownVariantOptions, buttonSizeOptions, dropdownPlacements } from '../../../../utils/constants';
|
|
7
6
|
import GlBaseDropdown, { BASE_DROPDOWN_CLASS } from '../base_dropdown/base_dropdown';
|
|
@@ -208,17 +207,6 @@ var script = {
|
|
|
208
207
|
type: Boolean,
|
|
209
208
|
required: false,
|
|
210
209
|
default: false
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* Whether to use an improved hide
|
|
214
|
-
* functionality for the dropdown.
|
|
215
|
-
*/
|
|
216
|
-
improvedHideHeuristics: {
|
|
217
|
-
type: Boolean,
|
|
218
|
-
required: false,
|
|
219
|
-
default() {
|
|
220
|
-
return Boolean(glDropdownConfig.useImprovedHideHeuristics);
|
|
221
|
-
}
|
|
222
210
|
}
|
|
223
211
|
},
|
|
224
212
|
data() {
|
|
@@ -352,7 +340,7 @@ var script = {
|
|
|
352
340
|
const __vue_script__ = script;
|
|
353
341
|
|
|
354
342
|
/* template */
|
|
355
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",staticClass:"gl-disclosure-dropdown",attrs:{"aria-labelledby":_vm.toggleAriaLabelledBy,"toggle-id":_vm.toggleId,"toggle-text":_vm.toggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"block":_vm.block,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy
|
|
343
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",staticClass:"gl-disclosure-dropdown",attrs:{"aria-labelledby":_vm.toggleAriaLabelledBy,"toggle-id":_vm.toggleId,"toggle-text":_vm.toggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"block":_vm.block,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide,_vm.$options.events.GL_DROPDOWN_BEFORE_CLOSE,_vm.onBeforeClose,_vm.$options.events.GL_DROPDOWN_FOCUS_CONTENT,_vm.onKeydown]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(){return [_vm._t("toggle")]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._t("header"),_vm._v(" "),_c(_vm.disclosureTag,{ref:"content",tag:"component",class:_vm.$options.GL_DROPDOWN_CONTENTS_CLASS,attrs:{"id":_vm.disclosureId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.toggleId,"data-testid":"disclosure-content","tabindex":"-1"},on:{"keydown":_vm.onKeydown,"click":_vm.handleAutoClose}},[_vm._t("default",function(){return [_vm._l((_vm.items),function(item,index){return [(_vm.isItem(item))?[_c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"item":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([('list-item' in _vm.$scopedSlots)?{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":item})]},proxy:true}:null],null,true)})]:[_c('gl-disclosure-dropdown-group',{key:item.name,attrs:{"bordered":index !== 0,"group":item},on:{"action":_vm.handleAction},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.$scopedSlots['list-item'])?_vm._l((item.items),function(groupItem){return _c('gl-disclosure-dropdown-item',{key:_vm.uniqueItemId(),attrs:{"item":groupItem},on:{"action":_vm.handleAction},scopedSlots:_vm._u([{key:"list-item",fn:function(){return [_vm._t("list-item",null,{"item":groupItem})]},proxy:true}],null,true)})}):_vm._e()],2)]]})]})],2),_vm._v(" "),_vm._t("footer")],2)};
|
|
356
344
|
var __vue_staticRenderFns__ = [];
|
|
357
345
|
|
|
358
346
|
/* style */
|
|
@@ -2,7 +2,6 @@ import clamp from 'lodash/clamp';
|
|
|
2
2
|
import uniqueId from 'lodash/uniqueId';
|
|
3
3
|
import isNil from 'lodash/isNil';
|
|
4
4
|
import { stopEvent } from '../../../../utils/utils';
|
|
5
|
-
import { glDropdownConfig } from '../../../../config';
|
|
6
5
|
import { GL_DROPDOWN_SHOWN, GL_DROPDOWN_HIDDEN, POSITION_ABSOLUTE, POSITION_FIXED, GL_DROPDOWN_CONTENTS_CLASS, HOME, END, ARROW_UP, ARROW_DOWN } from '../constants';
|
|
7
6
|
import { buttonCategoryOptions, dropdownVariantOptions, buttonSizeOptions, dropdownPlacements } from '../../../../utils/constants';
|
|
8
7
|
import GlButton from '../../button/button';
|
|
@@ -329,17 +328,6 @@ var script = {
|
|
|
329
328
|
type: Function,
|
|
330
329
|
required: false,
|
|
331
330
|
default: translatePlural('GlCollapsibleListbox.srOnlyResultsLabel', '%d result', '%d results')
|
|
332
|
-
},
|
|
333
|
-
/**
|
|
334
|
-
* Whether to use an improved hide
|
|
335
|
-
* functionality for the dropdown.
|
|
336
|
-
*/
|
|
337
|
-
improvedHideHeuristics: {
|
|
338
|
-
type: Boolean,
|
|
339
|
-
required: false,
|
|
340
|
-
default() {
|
|
341
|
-
return Boolean(glDropdownConfig.useImprovedHideHeuristics);
|
|
342
|
-
}
|
|
343
331
|
}
|
|
344
332
|
},
|
|
345
333
|
data() {
|
|
@@ -737,7 +725,7 @@ var script = {
|
|
|
737
725
|
const __vue_script__ = script;
|
|
738
726
|
|
|
739
727
|
/* template */
|
|
740
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","aria-labelledby":_vm.toggleAriaLabelledBy,"block":_vm.block,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleButtonClasses,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy
|
|
728
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","aria-labelledby":_vm.toggleAriaLabelledBy,"block":_vm.block,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleButtonClasses,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"placement":_vm.placement,"offset":_vm.dropdownOffset,"fluid-width":_vm.fluidWidth,"positioning-strategy":_vm.positioningStrategy},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(){return [_vm._t("toggle")]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.headerText)?_c('div',{staticClass:"gl-flex gl-min-h-8 gl-items-center !gl-p-4",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-grow gl-pr-2 gl-text-sm gl-font-bold",attrs:{"id":_vm.headerId,"data-testid":"listbox-header-text"}},[_vm._v("\n "+_vm._s(_vm.headerText)+"\n ")]),_vm._v(" "),(_vm.showResetButton)?_c('gl-button',{staticClass:"!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-py-2 !gl-text-sm focus:!gl-shadow-inner-2-blue-400",attrs:{"category":"tertiary","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.showSelectAllButton)?_c('gl-button',{staticClass:"!gl-m-0 !gl-w-auto gl-max-w-1/2 gl-flex-shrink-0 gl-text-ellipsis !gl-px-2 !gl-py-2 !gl-text-sm focus:!gl-shadow-inner-2-blue-400",attrs:{"category":"tertiary","data-testid":"listbox-select-all-button"},on:{"click":_vm.onSelectAllButtonClicked}},[_vm._v("\n "+_vm._s(_vm.showSelectAllButtonLabel)+"\n ")]):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.searchable)?_c('div',{class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('gl-listbox-search-input',{ref:"searchBox",class:{ 'gl-listbox-topmost': !_vm.headerText },attrs:{"data-testid":"listbox-search-input","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }$event.preventDefault();},_vm.onKeydown]},model:{value:(_vm.searchStr),callback:function ($$v) {_vm.searchStr=$$v;},expression:"searchStr"}}),_vm._v(" "),(_vm.searching)?_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-search-loader","size":"md"}}):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.showList)?_c(_vm.listboxTag,{ref:"list",tag:"component",staticClass:"gl-new-dropdown-contents gl-new-dropdown-contents-with-scrim-overlay",class:_vm.listboxClasses,attrs:{"id":_vm.listboxId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.headerId || _vm.toggleId,"role":"listbox","tabindex":"0"},on:{"keydown":_vm.onKeydown}},[_c(_vm.itemTag,{tag:"component",staticClass:"top-scrim-wrapper",attrs:{"aria-hidden":"true","data-testid":"top-scrim"}},[_c('div',{staticClass:"top-scrim",class:{ 'top-scrim-light': !_vm.hasHeader, 'top-scrim-dark': _vm.hasHeader }})]),_vm._v(" "),_c(_vm.itemTag,{ref:"top-boundary",tag:"component",attrs:{"aria-hidden":"true"}}),_vm._v(" "),_vm._l((_vm.items),function(item,index){return [(_vm.isOption(item))?[_c('gl-listbox-item',_vm._b({key:item.value,attrs:{"data-testid":("listbox-item-" + (item.value)),"is-selected":_vm.isSelected(item),"is-focused":_vm.isFocused(item),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(item, $event)}}},'gl-listbox-item',_vm.listboxItemMoreItemsAriaAttributes(index),false),[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(item.text)+"\n ")]},{"item":item})],2)]:[_c('gl-listbox-group',{key:item.text,class:_vm.groupClasses(index),attrs:{"name":item.text,"text-sr-only":item.textSrOnly},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((item.options),function(option){return _c('gl-listbox-item',{key:option.value,attrs:{"data-testid":("listbox-item-" + (option.value)),"is-selected":_vm.isSelected(option),"is-focused":_vm.isFocused(option),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(option, $event)}}},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(option.text)+"\n ")]},{"item":option})],2)})],2)]]}),_vm._v(" "),(_vm.infiniteScrollLoading)?_c(_vm.itemTag,{tag:"component"},[_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-infinite-scroll-loader","size":"md"}})],1):_vm._e(),_vm._v(" "),(_vm.showIntersectionObserver)?_c('gl-intersection-observer',{on:{"appear":_vm.onIntersectionObserverAppear}}):_vm._e(),_vm._v(" "),_c(_vm.itemTag,{ref:"bottom-boundary",tag:"component",attrs:{"aria-hidden":"true"}}),_vm._v(" "),_c(_vm.itemTag,{tag:"component",staticClass:"bottom-scrim-wrapper",attrs:{"aria-hidden":"true","data-testid":"bottom-scrim"}},[_c('div',{staticClass:"bottom-scrim",class:{ '!gl-rounded-none': _vm.hasFooter }})])],2):_vm._e(),_vm._v(" "),(_vm.announceSRSearchResults)?_c('span',{staticClass:"gl-sr-only",attrs:{"data-testid":"listbox-number-of-results","aria-live":"assertive"}},[_vm._t("search-summary-sr-only",function(){return [_vm._v("\n "+_vm._s(_vm.srOnlyResultsLabel(_vm.flattenedOptions.length))+"\n ")]})],2):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-py-3 gl-pl-7 gl-pr-5 gl-text-base gl-text-gray-600",attrs:{"aria-live":"assertive","data-testid":"listbox-no-results-text"}},[_vm._v("\n "+_vm._s(_vm.noResultsText)+"\n ")]):_vm._e(),_vm._v(" "),_vm._t("footer")],2)};
|
|
741
729
|
var __vue_staticRenderFns__ = [];
|
|
742
730
|
|
|
743
731
|
/* style */
|
package/dist/config.js
CHANGED
|
@@ -32,7 +32,6 @@ try {
|
|
|
32
32
|
// localStorage doesn't exist (or the value is not properly formatted)
|
|
33
33
|
}
|
|
34
34
|
const i18n = translationKeys;
|
|
35
|
-
const glDropdownConfig = {};
|
|
36
35
|
let configured = false;
|
|
37
36
|
|
|
38
37
|
/**
|
|
@@ -41,12 +40,10 @@ let configured = false;
|
|
|
41
40
|
* @typedef {object} GitLabUIConfiguration
|
|
42
41
|
* @template TValue=string
|
|
43
42
|
* @property {undefined | Object} translations Generic translations for component labels to fall back to.
|
|
44
|
-
* @property {boolean} [useImprovedHideHeuristics] Temporary flag to enable improved hide heuristics for dropdowns.
|
|
45
43
|
*/
|
|
46
44
|
const setConfigs = function () {
|
|
47
45
|
let {
|
|
48
|
-
translations
|
|
49
|
-
useImprovedHideHeuristics
|
|
46
|
+
translations
|
|
50
47
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
48
|
if (configured) {
|
|
52
49
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -78,24 +75,7 @@ const setConfigs = function () {
|
|
|
78
75
|
}
|
|
79
76
|
Object.assign(i18n, translations);
|
|
80
77
|
}
|
|
81
|
-
|
|
82
|
-
// Temporary flag to enable the improved hide heuristics feature.
|
|
83
|
-
// This flag allows the feature to be opt-in during the rollout phase,
|
|
84
|
-
// giving us the flexibility to test and validate its impact on user experience.
|
|
85
|
-
|
|
86
|
-
// The global variable `useImprovedHideHeuristics` is set to a boolean value
|
|
87
|
-
// to indicate whether the improved hide heuristics should be used.
|
|
88
|
-
|
|
89
|
-
// Future Plan:
|
|
90
|
-
// Once the improved hide heuristics feature is validated and stable,
|
|
91
|
-
// we will remove this temporary flag and make the feature the default behavior.
|
|
92
|
-
// At that point, there will be no need for opt-in or opt-out mechanisms for this feature.
|
|
93
|
-
if (typeof useImprovedHideHeuristics === 'boolean') {
|
|
94
|
-
Object.assign(glDropdownConfig, {
|
|
95
|
-
useImprovedHideHeuristics
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
78
|
};
|
|
99
79
|
|
|
100
80
|
export default setConfigs;
|
|
101
|
-
export {
|
|
81
|
+
export { i18n };
|
package/package.json
CHANGED
|
@@ -21,10 +21,9 @@ import {
|
|
|
21
21
|
POSITION_FIXED,
|
|
22
22
|
} from '../constants';
|
|
23
23
|
import { logWarning, isElementTabbable, isElementFocusable } from '../../../../utils/utils';
|
|
24
|
+
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
24
25
|
import GlButton from '../../button/button.vue';
|
|
25
26
|
import GlIcon from '../../icon/icon.vue';
|
|
26
|
-
import BaseDropdownDeprecatedWrapper from './base_dropdown_deprecated_wrapper.vue';
|
|
27
|
-
import BaseDropdownImprovedWrapper from './base_dropdown_improved_wrapper.vue';
|
|
28
27
|
import { DEFAULT_OFFSET, FIXED_WIDTH_CLASS } from './constants';
|
|
29
28
|
|
|
30
29
|
export const BASE_DROPDOWN_CLASS = 'gl-new-dropdown';
|
|
@@ -35,9 +34,8 @@ export default {
|
|
|
35
34
|
components: {
|
|
36
35
|
GlButton,
|
|
37
36
|
GlIcon,
|
|
38
|
-
BaseDropdownDeprecatedWrapper,
|
|
39
|
-
BaseDropdownImprovedWrapper,
|
|
40
37
|
},
|
|
38
|
+
directives: { Outside: OutsideDirective },
|
|
41
39
|
props: {
|
|
42
40
|
toggleText: {
|
|
43
41
|
type: String,
|
|
@@ -161,14 +159,6 @@ export default {
|
|
|
161
159
|
default: POSITION_ABSOLUTE,
|
|
162
160
|
validator: (strategy) => [POSITION_ABSOLUTE, POSITION_FIXED].includes(strategy),
|
|
163
161
|
},
|
|
164
|
-
/**
|
|
165
|
-
* Whether to use the deprecated or improved wrapper
|
|
166
|
-
*/
|
|
167
|
-
improvedHideHeuristics: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
required: false,
|
|
170
|
-
default: false,
|
|
171
|
-
},
|
|
172
162
|
},
|
|
173
163
|
data() {
|
|
174
164
|
return {
|
|
@@ -178,11 +168,6 @@ export default {
|
|
|
178
168
|
};
|
|
179
169
|
},
|
|
180
170
|
computed: {
|
|
181
|
-
wrapperComponent() {
|
|
182
|
-
return this.improvedHideHeuristics
|
|
183
|
-
? BaseDropdownImprovedWrapper
|
|
184
|
-
: BaseDropdownDeprecatedWrapper;
|
|
185
|
-
},
|
|
186
171
|
hasNoVisibleToggleText() {
|
|
187
172
|
return !this.toggleText?.length || this.textSrOnly;
|
|
188
173
|
},
|
|
@@ -476,10 +461,9 @@ export default {
|
|
|
476
461
|
</script>
|
|
477
462
|
|
|
478
463
|
<template>
|
|
479
|
-
<
|
|
480
|
-
|
|
464
|
+
<div
|
|
465
|
+
v-outside.click.focusin="close"
|
|
481
466
|
:class="[$options.BASE_DROPDOWN_CLASS, { '!gl-block': block }]"
|
|
482
|
-
@close="close"
|
|
483
467
|
>
|
|
484
468
|
<component
|
|
485
469
|
:is="toggleComponent"
|
|
@@ -515,5 +499,5 @@ export default {
|
|
|
515
499
|
<slot></slot>
|
|
516
500
|
</div>
|
|
517
501
|
</div>
|
|
518
|
-
</
|
|
502
|
+
</div>
|
|
519
503
|
</template>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import clamp from 'lodash/clamp';
|
|
4
4
|
import uniqueId from 'lodash/uniqueId';
|
|
5
5
|
import { stopEvent, filterVisible } from '../../../../utils/utils';
|
|
6
|
-
import { glDropdownConfig } from '../../../../config';
|
|
7
6
|
import {
|
|
8
7
|
GL_DROPDOWN_SHOWN,
|
|
9
8
|
GL_DROPDOWN_HIDDEN,
|
|
@@ -229,17 +228,6 @@ export default {
|
|
|
229
228
|
required: false,
|
|
230
229
|
default: false,
|
|
231
230
|
},
|
|
232
|
-
/**
|
|
233
|
-
* Whether to use an improved hide
|
|
234
|
-
* functionality for the dropdown.
|
|
235
|
-
*/
|
|
236
|
-
improvedHideHeuristics: {
|
|
237
|
-
type: Boolean,
|
|
238
|
-
required: false,
|
|
239
|
-
default() {
|
|
240
|
-
return Boolean(glDropdownConfig.useImprovedHideHeuristics);
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
231
|
},
|
|
244
232
|
data() {
|
|
245
233
|
return {
|
|
@@ -394,7 +382,6 @@ export default {
|
|
|
394
382
|
:offset="dropdownOffset"
|
|
395
383
|
:fluid-width="fluidWidth"
|
|
396
384
|
:positioning-strategy="positioningStrategy"
|
|
397
|
-
:improved-hide-heuristics="improvedHideHeuristics"
|
|
398
385
|
class="gl-disclosure-dropdown"
|
|
399
386
|
@[$options.events.GL_DROPDOWN_SHOWN]="onShow"
|
|
400
387
|
@[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
|
|
@@ -4,7 +4,6 @@ import clamp from 'lodash/clamp';
|
|
|
4
4
|
import uniqueId from 'lodash/uniqueId';
|
|
5
5
|
import isNil from 'lodash/isNil';
|
|
6
6
|
import { stopEvent } from '../../../../utils/utils';
|
|
7
|
-
import { glDropdownConfig } from '../../../../config';
|
|
8
7
|
import {
|
|
9
8
|
GL_DROPDOWN_SHOWN,
|
|
10
9
|
GL_DROPDOWN_HIDDEN,
|
|
@@ -350,17 +349,6 @@ export default {
|
|
|
350
349
|
'%d results'
|
|
351
350
|
),
|
|
352
351
|
},
|
|
353
|
-
/**
|
|
354
|
-
* Whether to use an improved hide
|
|
355
|
-
* functionality for the dropdown.
|
|
356
|
-
*/
|
|
357
|
-
improvedHideHeuristics: {
|
|
358
|
-
type: Boolean,
|
|
359
|
-
required: false,
|
|
360
|
-
default() {
|
|
361
|
-
return Boolean(glDropdownConfig.useImprovedHideHeuristics);
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
352
|
},
|
|
365
353
|
data() {
|
|
366
354
|
return {
|
|
@@ -782,7 +770,6 @@ export default {
|
|
|
782
770
|
:offset="dropdownOffset"
|
|
783
771
|
:fluid-width="fluidWidth"
|
|
784
772
|
:positioning-strategy="positioningStrategy"
|
|
785
|
-
:improved-hide-heuristics="improvedHideHeuristics"
|
|
786
773
|
@[$options.events.GL_DROPDOWN_SHOWN]="onShow"
|
|
787
774
|
@[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
|
|
788
775
|
>
|
package/src/config.js
CHANGED
|
@@ -35,8 +35,6 @@ try {
|
|
|
35
35
|
|
|
36
36
|
export const i18n = translationKeys;
|
|
37
37
|
|
|
38
|
-
export const glDropdownConfig = {};
|
|
39
|
-
|
|
40
38
|
let configured = false;
|
|
41
39
|
|
|
42
40
|
/**
|
|
@@ -45,9 +43,8 @@ let configured = false;
|
|
|
45
43
|
* @typedef {object} GitLabUIConfiguration
|
|
46
44
|
* @template TValue=string
|
|
47
45
|
* @property {undefined | Object} translations Generic translations for component labels to fall back to.
|
|
48
|
-
* @property {boolean} [useImprovedHideHeuristics] Temporary flag to enable improved hide heuristics for dropdowns.
|
|
49
46
|
*/
|
|
50
|
-
const setConfigs = ({ translations
|
|
47
|
+
const setConfigs = ({ translations } = {}) => {
|
|
51
48
|
if (configured) {
|
|
52
49
|
if (process.env.NODE_ENV === 'development') {
|
|
53
50
|
throw new Error('GitLab UI can only be configured once!');
|
|
@@ -84,23 +81,6 @@ const setConfigs = ({ translations, useImprovedHideHeuristics } = {}) => {
|
|
|
84
81
|
|
|
85
82
|
Object.assign(i18n, translations);
|
|
86
83
|
}
|
|
87
|
-
|
|
88
|
-
// Temporary flag to enable the improved hide heuristics feature.
|
|
89
|
-
// This flag allows the feature to be opt-in during the rollout phase,
|
|
90
|
-
// giving us the flexibility to test and validate its impact on user experience.
|
|
91
|
-
|
|
92
|
-
// The global variable `useImprovedHideHeuristics` is set to a boolean value
|
|
93
|
-
// to indicate whether the improved hide heuristics should be used.
|
|
94
|
-
|
|
95
|
-
// Future Plan:
|
|
96
|
-
// Once the improved hide heuristics feature is validated and stable,
|
|
97
|
-
// we will remove this temporary flag and make the feature the default behavior.
|
|
98
|
-
// At that point, there will be no need for opt-in or opt-out mechanisms for this feature.
|
|
99
|
-
if (typeof useImprovedHideHeuristics === 'boolean') {
|
|
100
|
-
Object.assign(glDropdownConfig, {
|
|
101
|
-
useImprovedHideHeuristics,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
84
|
};
|
|
105
85
|
|
|
106
86
|
export default setConfigs;
|
package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown_deprecated_wrapper.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
var script = {
|
|
5
|
-
name: 'BaseDropdownDeprecatedWrapper',
|
|
6
|
-
directives: {
|
|
7
|
-
Outside: OutsideDirective
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/* script */
|
|
12
|
-
const __vue_script__ = script;
|
|
13
|
-
|
|
14
|
-
/* template */
|
|
15
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"outside",rawName:"v-outside",value:(function (event) { return _vm.$emit('close', event); }),expression:"(event) => $emit('close', event)"}]},[_vm._t("default")],2)};
|
|
16
|
-
var __vue_staticRenderFns__ = [];
|
|
17
|
-
|
|
18
|
-
/* style */
|
|
19
|
-
const __vue_inject_styles__ = undefined;
|
|
20
|
-
/* scoped */
|
|
21
|
-
const __vue_scope_id__ = undefined;
|
|
22
|
-
/* module identifier */
|
|
23
|
-
const __vue_module_identifier__ = undefined;
|
|
24
|
-
/* functional template */
|
|
25
|
-
const __vue_is_functional_template__ = false;
|
|
26
|
-
/* style inject */
|
|
27
|
-
|
|
28
|
-
/* style inject SSR */
|
|
29
|
-
|
|
30
|
-
/* style inject shadow dom */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const __vue_component__ = __vue_normalize__(
|
|
35
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
36
|
-
__vue_inject_styles__,
|
|
37
|
-
__vue_script__,
|
|
38
|
-
__vue_scope_id__,
|
|
39
|
-
__vue_is_functional_template__,
|
|
40
|
-
__vue_module_identifier__,
|
|
41
|
-
false,
|
|
42
|
-
undefined,
|
|
43
|
-
undefined,
|
|
44
|
-
undefined
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export default __vue_component__;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
var script = {
|
|
5
|
-
name: 'BaseDropdownImprovedWrapper',
|
|
6
|
-
directives: {
|
|
7
|
-
Outside: OutsideDirective
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/* script */
|
|
12
|
-
const __vue_script__ = script;
|
|
13
|
-
|
|
14
|
-
/* template */
|
|
15
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"outside",rawName:"v-outside.click.focusin",value:(function (event) { return _vm.$emit('close', event); }),expression:"(event) => $emit('close', event)",modifiers:{"click":true,"focusin":true}}]},[_vm._t("default")],2)};
|
|
16
|
-
var __vue_staticRenderFns__ = [];
|
|
17
|
-
|
|
18
|
-
/* style */
|
|
19
|
-
const __vue_inject_styles__ = undefined;
|
|
20
|
-
/* scoped */
|
|
21
|
-
const __vue_scope_id__ = undefined;
|
|
22
|
-
/* module identifier */
|
|
23
|
-
const __vue_module_identifier__ = undefined;
|
|
24
|
-
/* functional template */
|
|
25
|
-
const __vue_is_functional_template__ = false;
|
|
26
|
-
/* style inject */
|
|
27
|
-
|
|
28
|
-
/* style inject SSR */
|
|
29
|
-
|
|
30
|
-
/* style inject shadow dom */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const __vue_component__ = __vue_normalize__(
|
|
35
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
36
|
-
__vue_inject_styles__,
|
|
37
|
-
__vue_script__,
|
|
38
|
-
__vue_scope_id__,
|
|
39
|
-
__vue_is_functional_template__,
|
|
40
|
-
__vue_module_identifier__,
|
|
41
|
-
false,
|
|
42
|
-
undefined,
|
|
43
|
-
undefined,
|
|
44
|
-
undefined
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export default __vue_component__;
|
package/src/components/base/new_dropdowns/base_dropdown/base_dropdown_deprecated_wrapper.vue
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'BaseDropdownDeprecatedWrapper',
|
|
6
|
-
directives: { Outside: OutsideDirective },
|
|
7
|
-
};
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div v-outside="(event) => $emit('close', event)">
|
|
12
|
-
<slot></slot>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'BaseDropdownImprovedWrapper',
|
|
6
|
-
directives: { Outside: OutsideDirective },
|
|
7
|
-
};
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div v-outside.click.focusin="(event) => $emit('close', event)">
|
|
12
|
-
<slot></slot>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|