@gitlab/ui 111.2.0 → 111.3.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/badge/badge.js +6 -5
- package/dist/components/base/link/link.js +5 -2
- package/dist/components/base/new_dropdowns/listbox/listbox.js +12 -2
- package/dist/components/base/token_selector/token_selector.js +1 -1
- package/dist/utils/constants.js +11 -5
- package/package.json +3 -3
- package/src/components/base/badge/badge.vue +9 -5
- package/src/components/base/link/link.vue +11 -2
- package/src/components/base/new_dropdowns/listbox/listbox.md +21 -0
- package/src/components/base/new_dropdowns/listbox/listbox.vue +13 -3
- package/src/components/base/token_selector/token_selector.vue +0 -1
- package/src/utils/constants.js +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [111.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.3.0...v111.3.1) (2025-03-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlTokenSelector:** Remove text intput `aria-label` attr ([85d1e7e](https://gitlab.com/gitlab-org/gitlab-ui/commit/85d1e7e4f5ed0393d498096962c671a05669122d))
|
|
7
|
+
|
|
8
|
+
# [111.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.2.0...v111.3.0) (2025-03-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlCollapsibleListbox:** Add toggleId prop ([e3d6ed2](https://gitlab.com/gitlab-org/gitlab-ui/commit/e3d6ed2b4d8f04c3256c914a232226daa67b2839))
|
|
14
|
+
|
|
1
15
|
# [111.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.1.1...v111.2.0) (2025-03-14)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { badgeVariantOptions, badgeIconSizeOptions } from '../../../utils/constants';
|
|
1
|
+
import GlLink from '../link/link';
|
|
2
|
+
import { badgeVariantOptions, badgeIconSizeOptions, linkVariantUnstyled } from '../../../utils/constants';
|
|
3
3
|
import GlIcon from '../icon/icon';
|
|
4
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ const variantClass = {
|
|
|
16
16
|
var script = {
|
|
17
17
|
name: 'GlBadge',
|
|
18
18
|
components: {
|
|
19
|
-
|
|
19
|
+
GlLink,
|
|
20
20
|
GlIcon
|
|
21
21
|
},
|
|
22
22
|
props: {
|
|
@@ -129,7 +129,7 @@ var script = {
|
|
|
129
129
|
return Boolean(this.href);
|
|
130
130
|
},
|
|
131
131
|
computedTag() {
|
|
132
|
-
return this.isLink ?
|
|
132
|
+
return this.isLink ? GlLink : this.tag;
|
|
133
133
|
},
|
|
134
134
|
computedProps() {
|
|
135
135
|
if (!this.isLink) return {};
|
|
@@ -145,7 +145,8 @@ var script = {
|
|
|
145
145
|
rel,
|
|
146
146
|
target,
|
|
147
147
|
active,
|
|
148
|
-
disabled
|
|
148
|
+
disabled,
|
|
149
|
+
variant: linkVariantUnstyled
|
|
149
150
|
};
|
|
150
151
|
},
|
|
151
152
|
classes() {
|
|
@@ -10,7 +10,7 @@ import { isEvent } from '../../../vendor/bootstrap-vue/src/utils/inspect';
|
|
|
10
10
|
import { stringifyQueryObj } from '../../../vendor/bootstrap-vue/src/utils/router';
|
|
11
11
|
import { safeVueInstance } from '../../../vendor/bootstrap-vue/src/utils/safe-vue-instance';
|
|
12
12
|
import { attemptFocus, attemptBlur } from '../../../vendor/bootstrap-vue/src/utils/dom';
|
|
13
|
-
import { linkVariantOptions, isVue3 } from '../../../utils/constants';
|
|
13
|
+
import { linkVariantOptions, isVue3, linkVariantInline, linkVariantUnstyled } from '../../../utils/constants';
|
|
14
14
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
15
15
|
|
|
16
16
|
//
|
|
@@ -161,7 +161,7 @@ var script = {
|
|
|
161
161
|
return this.tag === VUE_ROUTER_LINK_TAG && isVue3;
|
|
162
162
|
},
|
|
163
163
|
isInlineAndHasExternalIcon() {
|
|
164
|
-
return this.showExternalIcon && this.variant ===
|
|
164
|
+
return this.showExternalIcon && this.variant === linkVariantInline && this.href && isExternalURL(this.target, this.href);
|
|
165
165
|
},
|
|
166
166
|
computedHref() {
|
|
167
167
|
const fallback = '#';
|
|
@@ -219,6 +219,9 @@ var script = {
|
|
|
219
219
|
return listenersWithoutClick;
|
|
220
220
|
},
|
|
221
221
|
computedClass() {
|
|
222
|
+
if (this.variant === linkVariantUnstyled) {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
222
225
|
return ['gl-link', linkVariantOptions[this.variant], {
|
|
223
226
|
disabled: this.disabled,
|
|
224
227
|
active: this.active,
|
|
@@ -175,6 +175,14 @@ var script = {
|
|
|
175
175
|
required: false,
|
|
176
176
|
default: false
|
|
177
177
|
},
|
|
178
|
+
/**
|
|
179
|
+
* The `id` attribute value for the toggle button
|
|
180
|
+
*/
|
|
181
|
+
toggleId: {
|
|
182
|
+
type: String,
|
|
183
|
+
required: false,
|
|
184
|
+
default: null
|
|
185
|
+
},
|
|
178
186
|
/**
|
|
179
187
|
* The `aria-labelledby` attribute value for the toggle button
|
|
180
188
|
* Provide the string of ids seperated by space
|
|
@@ -333,7 +341,6 @@ var script = {
|
|
|
333
341
|
data() {
|
|
334
342
|
return {
|
|
335
343
|
selectedValues: [],
|
|
336
|
-
toggleId: uniqueId('dropdown-toggle-btn-'),
|
|
337
344
|
listboxId: uniqueId('listbox-'),
|
|
338
345
|
nextFocusedItemIndex: null,
|
|
339
346
|
searchStr: '',
|
|
@@ -342,6 +349,9 @@ var script = {
|
|
|
342
349
|
};
|
|
343
350
|
},
|
|
344
351
|
computed: {
|
|
352
|
+
toggleIdComputed() {
|
|
353
|
+
return this.toggleId || uniqueId('dropdown-toggle-btn-');
|
|
354
|
+
},
|
|
345
355
|
listboxTag() {
|
|
346
356
|
if (!this.hasItems || isOption(this.items[0])) return 'ul';
|
|
347
357
|
return 'div';
|
|
@@ -757,7 +767,7 @@ var script = {
|
|
|
757
767
|
const __vue_script__ = script;
|
|
758
768
|
|
|
759
769
|
/* template */
|
|
760
|
-
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.
|
|
770
|
+
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.toggleIdComputed,"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 gl-text-strong",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-text-sm focus:!gl-focus-inset",attrs:{"category":"tertiary","size":"small","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-text-sm focus:!gl-focus-inset",attrs:{"category":"tertiary","size":"small","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.toggleIdComputed,"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-highlighted":_vm.isHighlighted(item),"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-highlighted":_vm.isHighlighted(option),"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-subtle",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)};
|
|
761
771
|
var __vue_staticRenderFns__ = [];
|
|
762
772
|
|
|
763
773
|
/* style */
|
|
@@ -380,7 +380,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
380
380
|
_vm.containerClass,
|
|
381
381
|
_vm.stateClass ],on:{"click":_vm.handleContainerClick}},[(_vm.showEmptyPlaceholder)?_vm._t("empty-placeholder"):_vm._e(),_vm._v(" "),_c('gl-token-container',{attrs:{"tokens":_vm.selectedTokens,"state":_vm.state,"register-focus-on-token":_vm.registerFocusOnToken,"view-only":_vm.viewOnly,"show-clear-all-button":_vm.showClearAllButton},on:{"token-remove":_vm.removeToken,"cancel-focus":_vm.cancelTokenFocus,"clear-all":_vm.clearAll},scopedSlots:_vm._u([{key:"token-content",fn:function(ref){
|
|
382
382
|
var token = ref.token;
|
|
383
|
-
return [_vm._t("token-content",null,{"token":token})]}},{key:"text-input",fn:function(){return [_c('input',_vm._b({ref:"textInput",staticClass:"gl-token-selector-input gl-h-auto gl-w-4/10 gl-grow gl-border-none gl-bg-transparent gl-px-1 gl-font-regular gl-text-base gl-leading-normal gl-text-default gl-outline-none",attrs:{"type":"text","
|
|
383
|
+
return [_vm._t("token-content",null,{"token":token})]}},{key:"text-input",fn:function(){return [_c('input',_vm._b({ref:"textInput",staticClass:"gl-token-selector-input gl-h-auto gl-w-4/10 gl-grow gl-border-none gl-bg-transparent gl-px-1 gl-font-regular gl-text-base gl-leading-normal gl-text-default gl-outline-none",attrs:{"type":"text","autocomplete":_vm.autocomplete,"aria-labelledby":_vm.ariaLabelledby,"placeholder":_vm.placeholder,"disabled":_vm.viewOnly},domProps:{"value":_vm.inputText},on:{"input":function($event){_vm.inputText = $event.target.value;},"focus":_vm.handleFocus,"blur":_vm.handleBlur,"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.handleEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }return _vm.handleEscape.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"delete",[8,46],$event.key,["Backspace","Delete","Del"])){ return null; }return _vm.handleBackspace.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"up",38,$event.key,["Up","ArrowUp"])){ return null; }$event.preventDefault();return _vm.dropdownEventHandlers.handleUpArrow.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"down",40,$event.key,["Down","ArrowDown"])){ return null; }$event.preventDefault();return _vm.dropdownEventHandlers.handleDownArrow.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"home",undefined,$event.key,undefined)){ return null; }return _vm.dropdownEventHandlers.handleHomeKey.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"end",undefined,$event.key,undefined)){ return null; }return _vm.dropdownEventHandlers.handleEndKey.apply(null, arguments)},function($event){$event.stopPropagation();return _vm.$emit('keydown', $event)}],"click":_vm.handleInputClick}},'input',_vm.textInputAttrs,false))]},proxy:true}],null,true)})],2),_vm._v(" "),_c('gl-token-selector-dropdown',{attrs:{"menu-class":_vm.menuClass,"show":_vm.dropdownIsOpen,"loading":_vm.loading,"dropdown-items":_vm.filteredDropdownItems,"selected-tokens":_vm.selectedTokens,"input-text":_vm.inputText,"user-defined-token-can-be-added":_vm.userDefinedTokenCanBeAdded,"component-id":_vm.$options.componentId,"register-dropdown-event-handlers":_vm.registerDropdownEventHandlers,"register-reset-focused-dropdown-item":_vm.registerResetFocusedDropdownItem},on:{"dropdown-item-click":_vm.addToken,"show":_vm.openDropdown},scopedSlots:_vm._u([{key:"loading-content",fn:function(){return [_vm._t("loading-content")]},proxy:true},{key:"user-defined-token-content",fn:function(){return [_vm._t("user-defined-token-content",null,{"inputText":_vm.inputText})]},proxy:true},{key:"no-results-content",fn:function(){return [_vm._t("no-results-content")]},proxy:true},{key:"dropdown-item-content",fn:function(ref){
|
|
384
384
|
var dropdownItem = ref.dropdownItem;
|
|
385
385
|
return [_vm._t("dropdown-item-content",null,{"dropdownItem":dropdownItem})]}},{key:"dropdown-footer",fn:function(){return [_vm._t("dropdown-footer")]},proxy:true}],null,true),model:{value:(_vm.focusedDropdownItem),callback:function ($$v) {_vm.focusedDropdownItem=$$v;},expression:"focusedDropdownItem"}})],1)};
|
|
386
386
|
var __vue_staticRenderFns__ = [];
|
package/dist/utils/constants.js
CHANGED
|
@@ -172,11 +172,17 @@ const animatedIconVariantOptions = {
|
|
|
172
172
|
danger: 'gl-animated-icon-danger',
|
|
173
173
|
success: 'gl-animated-icon-success'
|
|
174
174
|
};
|
|
175
|
+
const linkVariantInline = 'inline';
|
|
176
|
+
const linkVariantMeta = 'meta';
|
|
177
|
+
const linkVariantMention = 'mention';
|
|
178
|
+
const linkVariantMentionCurrent = 'mentionCurrent';
|
|
179
|
+
const linkVariantUnstyled = 'unstyled';
|
|
175
180
|
const linkVariantOptions = {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
[linkVariantInline]: 'gl-link-inline',
|
|
182
|
+
[linkVariantMeta]: 'gl-link-meta',
|
|
183
|
+
[linkVariantMention]: 'gl-link-mention',
|
|
184
|
+
[linkVariantMentionCurrent]: 'gl-link-mention-current',
|
|
185
|
+
[linkVariantUnstyled]: ''
|
|
180
186
|
};
|
|
181
187
|
const triggerVariantOptions = {
|
|
182
188
|
click: 'click',
|
|
@@ -319,4 +325,4 @@ const loadingIconVariants = {
|
|
|
319
325
|
};
|
|
320
326
|
const isVue3 = Boolean(Vue.Fragment);
|
|
321
327
|
|
|
322
|
-
export { COMMA, CONTRAST_LEVELS, HEX_REGEX, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, animatedIconVariantOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, breadCrumbSizeOptions, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerWidthOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownItemVariantOptions, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputWidths, formStateOptions, iconSizeOptions, iconVariantOptions, isVue3, keyboard, labelColorOptions, linkVariantOptions, loadingIconSizes, loadingIconVariants, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, progressBarVariantOptions, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, viewModeOptions };
|
|
328
|
+
export { COMMA, CONTRAST_LEVELS, HEX_REGEX, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, animatedIconVariantOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, breadCrumbSizeOptions, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerWidthOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownItemVariantOptions, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputWidths, formStateOptions, iconSizeOptions, iconVariantOptions, isVue3, keyboard, labelColorOptions, linkVariantInline, linkVariantMention, linkVariantMentionCurrent, linkVariantMeta, linkVariantOptions, linkVariantUnstyled, loadingIconSizes, loadingIconVariants, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, progressBarVariantOptions, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, viewModeOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "111.
|
|
3
|
+
"version": "111.3.1",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"jackspeak": "2.1.1"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@babel/core": "^7.26.
|
|
102
|
+
"@babel/core": "^7.26.10",
|
|
103
103
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
104
104
|
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
105
105
|
"@babel/preset-env": "^7.26.9",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"axe-playwright": "^2.1.0",
|
|
143
143
|
"babel-jest": "29.0.1",
|
|
144
144
|
"babel-loader": "^8.0.5",
|
|
145
|
-
"cypress": "14.
|
|
145
|
+
"cypress": "14.2.0",
|
|
146
146
|
"cypress-real-events": "^1.11.0",
|
|
147
147
|
"dompurify": "^3.1.2",
|
|
148
148
|
"emoji-regex": "^10.0.0",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<script>
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import GlLink from '../link/link.vue';
|
|
4
|
+
import {
|
|
5
|
+
badgeVariantOptions,
|
|
6
|
+
badgeIconSizeOptions,
|
|
7
|
+
linkVariantUnstyled,
|
|
8
|
+
} from '../../../utils/constants';
|
|
5
9
|
import GlIcon from '../icon/icon.vue';
|
|
6
10
|
|
|
7
11
|
const variantClass = {
|
|
@@ -17,7 +21,7 @@ const variantClass = {
|
|
|
17
21
|
export default {
|
|
18
22
|
name: 'GlBadge',
|
|
19
23
|
components: {
|
|
20
|
-
|
|
24
|
+
GlLink,
|
|
21
25
|
GlIcon,
|
|
22
26
|
},
|
|
23
27
|
props: {
|
|
@@ -131,13 +135,13 @@ export default {
|
|
|
131
135
|
return Boolean(this.href);
|
|
132
136
|
},
|
|
133
137
|
computedTag() {
|
|
134
|
-
return this.isLink ?
|
|
138
|
+
return this.isLink ? GlLink : this.tag;
|
|
135
139
|
},
|
|
136
140
|
computedProps() {
|
|
137
141
|
if (!this.isLink) return {};
|
|
138
142
|
|
|
139
143
|
const { href, rel, target, active, disabled } = this;
|
|
140
|
-
return { href, rel, target, active, disabled };
|
|
144
|
+
return { href, rel, target, active, disabled, variant: linkVariantUnstyled };
|
|
141
145
|
},
|
|
142
146
|
classes() {
|
|
143
147
|
return [
|
|
@@ -12,7 +12,12 @@ import { isEvent } from '../../../vendor/bootstrap-vue/src/utils/inspect';
|
|
|
12
12
|
import { stringifyQueryObj } from '../../../vendor/bootstrap-vue/src/utils/router';
|
|
13
13
|
import { safeVueInstance } from '../../../vendor/bootstrap-vue/src/utils/safe-vue-instance';
|
|
14
14
|
import { attemptFocus, attemptBlur } from '../../../vendor/bootstrap-vue/src/utils/dom';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
linkVariantOptions,
|
|
17
|
+
linkVariantInline,
|
|
18
|
+
linkVariantUnstyled,
|
|
19
|
+
isVue3,
|
|
20
|
+
} from '../../../utils/constants';
|
|
16
21
|
|
|
17
22
|
const ANCHOR_TAG = 'a';
|
|
18
23
|
const NUXT_LINK_TAG = 'nuxt-link';
|
|
@@ -166,7 +171,7 @@ export default {
|
|
|
166
171
|
isInlineAndHasExternalIcon() {
|
|
167
172
|
return (
|
|
168
173
|
this.showExternalIcon &&
|
|
169
|
-
this.variant ===
|
|
174
|
+
this.variant === linkVariantInline &&
|
|
170
175
|
this.href &&
|
|
171
176
|
isExternalURL(this.target, this.href)
|
|
172
177
|
);
|
|
@@ -221,6 +226,10 @@ export default {
|
|
|
221
226
|
return listenersWithoutClick;
|
|
222
227
|
},
|
|
223
228
|
computedClass() {
|
|
229
|
+
if (this.variant === linkVariantUnstyled) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
|
|
224
233
|
return [
|
|
225
234
|
'gl-link',
|
|
226
235
|
linkVariantOptions[this.variant],
|
|
@@ -27,6 +27,27 @@ Optionally, you can use `no-caret` to remove the caret and `category="tertiary"`
|
|
|
27
27
|
>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Labeling the listbox
|
|
31
|
+
|
|
32
|
+
The `toggleId` prop sets the `id` of the toggle element. This is useful for associating a label
|
|
33
|
+
element with the toggle.
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<gl-form-group label="Department" label-for="department-picker">
|
|
37
|
+
<gl-collapsible-listbox
|
|
38
|
+
toggle-id="department-picker"
|
|
39
|
+
:items="departments"
|
|
40
|
+
/>
|
|
41
|
+
</gl-form-group>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Prefer using `toggleId` over `toggleAriaLabelledBy`, as it is more similar to how
|
|
45
|
+
label elements are associated with other form components.
|
|
46
|
+
|
|
47
|
+
**Note:** Do not use the `toggleId` prop in conjunction with the `toggle` slot.
|
|
48
|
+
Instead, set the `id` directly on the custom toggle element, and pass the same
|
|
49
|
+
value to `GlFormGroup`'s `labelFor` prop.
|
|
50
|
+
|
|
30
51
|
## Opening the listbox
|
|
31
52
|
|
|
32
53
|
Listbox will open on toggle button click (if it was previously closed).
|
|
@@ -202,6 +202,14 @@ export default {
|
|
|
202
202
|
required: false,
|
|
203
203
|
default: false,
|
|
204
204
|
},
|
|
205
|
+
/**
|
|
206
|
+
* The `id` attribute value for the toggle button
|
|
207
|
+
*/
|
|
208
|
+
toggleId: {
|
|
209
|
+
type: String,
|
|
210
|
+
required: false,
|
|
211
|
+
default: null,
|
|
212
|
+
},
|
|
205
213
|
/**
|
|
206
214
|
* The `aria-labelledby` attribute value for the toggle button
|
|
207
215
|
* Provide the string of ids seperated by space
|
|
@@ -364,7 +372,6 @@ export default {
|
|
|
364
372
|
data() {
|
|
365
373
|
return {
|
|
366
374
|
selectedValues: [],
|
|
367
|
-
toggleId: uniqueId('dropdown-toggle-btn-'),
|
|
368
375
|
listboxId: uniqueId('listbox-'),
|
|
369
376
|
nextFocusedItemIndex: null,
|
|
370
377
|
searchStr: '',
|
|
@@ -373,6 +380,9 @@ export default {
|
|
|
373
380
|
};
|
|
374
381
|
},
|
|
375
382
|
computed: {
|
|
383
|
+
toggleIdComputed() {
|
|
384
|
+
return this.toggleId || uniqueId('dropdown-toggle-btn-');
|
|
385
|
+
},
|
|
376
386
|
listboxTag() {
|
|
377
387
|
if (!this.hasItems || isOption(this.items[0])) return 'ul';
|
|
378
388
|
return 'div';
|
|
@@ -797,7 +807,7 @@ export default {
|
|
|
797
807
|
aria-haspopup="listbox"
|
|
798
808
|
:aria-labelledby="toggleAriaLabelledBy"
|
|
799
809
|
:block="block"
|
|
800
|
-
:toggle-id="
|
|
810
|
+
:toggle-id="toggleIdComputed"
|
|
801
811
|
:toggle-text="listboxToggleText"
|
|
802
812
|
:toggle-class="toggleButtonClasses"
|
|
803
813
|
:text-sr-only="textSrOnly"
|
|
@@ -878,7 +888,7 @@ export default {
|
|
|
878
888
|
v-if="showList"
|
|
879
889
|
:id="listboxId"
|
|
880
890
|
ref="list"
|
|
881
|
-
:aria-labelledby="listAriaLabelledBy || headerId ||
|
|
891
|
+
:aria-labelledby="listAriaLabelledBy || headerId || toggleIdComputed"
|
|
882
892
|
role="listbox"
|
|
883
893
|
class="gl-new-dropdown-contents gl-new-dropdown-contents-with-scrim-overlay"
|
|
884
894
|
:class="listboxClasses"
|
|
@@ -427,7 +427,6 @@ export default {
|
|
|
427
427
|
<input
|
|
428
428
|
ref="textInput"
|
|
429
429
|
type="text"
|
|
430
|
-
aria-label="token selector"
|
|
431
430
|
class="gl-token-selector-input gl-h-auto gl-w-4/10 gl-grow gl-border-none gl-bg-transparent gl-px-1 gl-font-regular gl-text-base gl-leading-normal gl-text-default gl-outline-none"
|
|
432
431
|
:value="inputText"
|
|
433
432
|
:autocomplete="autocomplete"
|
package/src/utils/constants.js
CHANGED
|
@@ -204,11 +204,18 @@ export const animatedIconVariantOptions = {
|
|
|
204
204
|
success: 'gl-animated-icon-success',
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
export const linkVariantInline = 'inline';
|
|
208
|
+
export const linkVariantMeta = 'meta';
|
|
209
|
+
export const linkVariantMention = 'mention';
|
|
210
|
+
export const linkVariantMentionCurrent = 'mentionCurrent';
|
|
211
|
+
export const linkVariantUnstyled = 'unstyled';
|
|
212
|
+
|
|
207
213
|
export const linkVariantOptions = {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
214
|
+
[linkVariantInline]: 'gl-link-inline',
|
|
215
|
+
[linkVariantMeta]: 'gl-link-meta',
|
|
216
|
+
[linkVariantMention]: 'gl-link-mention',
|
|
217
|
+
[linkVariantMentionCurrent]: 'gl-link-mention-current',
|
|
218
|
+
[linkVariantUnstyled]: '',
|
|
212
219
|
};
|
|
213
220
|
|
|
214
221
|
export const triggerVariantOptions = {
|