@gitlab/ui 111.2.0 → 111.3.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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [111.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.2.0...v111.3.0) (2025-03-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlCollapsibleListbox:** Add toggleId prop ([e3d6ed2](https://gitlab.com/gitlab-org/gitlab-ui/commit/e3d6ed2b4d8f04c3256c914a232226daa67b2839))
|
|
7
|
+
|
|
1
8
|
# [111.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v111.1.1...v111.2.0) (2025-03-14)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -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 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "111.
|
|
3
|
+
"version": "111.3.0",
|
|
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",
|
|
@@ -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"
|