@gitlab/ui 52.7.1 → 52.7.3

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,17 @@
1
+ ## [52.7.3](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.7.2...v52.7.3) (2023-01-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlListbox:** move loading icon to list container ([13fca59](https://gitlab.com/gitlab-org/gitlab-ui/commit/13fca596c30888e7bd7a010348c0f08f72d9ef3a))
7
+
8
+ ## [52.7.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.7.1...v52.7.2) (2022-12-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **GlListbox:** remove input debounce ([dfca4ba](https://gitlab.com/gitlab-org/gitlab-ui/commit/dfca4ba4bae31371efc7ab86917cdbe636a5bfab))
14
+
1
15
  ## [52.7.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.7.0...v52.7.1) (2022-12-22)
2
16
 
3
17
 
@@ -524,7 +524,7 @@ var script = {
524
524
  const __vue_script__ = script;
525
525
 
526
526
  /* template */
527
- 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,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"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,"right":_vm.right},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide])},[(_vm.headerText)?_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-p-4! gl-min-h-8",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-flex-grow-1 gl-font-weight-bold gl-font-sm gl-pr-2",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-focus-inset-border-2-blue-400! gl-flex-shrink-0 gl-font-sm! gl-px-2! gl-py-2!",attrs:{"category":"tertiary","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\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",attrs:{"aria-owns":_vm.listboxId,"data-testid":"listbox-search-input","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":_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-dropdown-contents gl-list-style-none gl-pl-0 gl-mb-0",attrs:{"id":"listbox","aria-labelledby":_vm.listAriaLabelledBy || _vm.headerId || _vm.toggleId,"role":"listbox","tabindex":"-1"},on:{"keydown":_vm.onKeydown}},[_vm._l((_vm.items),function(item,index){return [(_vm.isOption(item))?[_c('gl-listbox-item',_vm._b({key:item.value,attrs:{"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},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:{"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.showIntersectionObserver)?_c('gl-intersection-observer',{on:{"appear":_vm.onIntersectionObserverAppear}}):_vm._e()],2):_vm._e(),_vm._v(" "),(_vm.infiniteScrollLoading)?_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-infinite-scroll-loader","size":"md"}}):_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")],2):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-pl-7 gl-pr-5 gl-pt-3 gl-font-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)};
527
+ 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,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"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,"right":_vm.right},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide])},[(_vm.headerText)?_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-p-4! gl-min-h-8",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-flex-grow-1 gl-font-weight-bold gl-font-sm gl-pr-2",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-focus-inset-border-2-blue-400! gl-flex-shrink-0 gl-font-sm! gl-px-2! gl-py-2!",attrs:{"category":"tertiary","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\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",attrs:{"aria-owns":_vm.listboxId,"data-testid":"listbox-search-input","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":_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-dropdown-contents gl-list-style-none gl-pl-0 gl-mb-0",attrs:{"id":"listbox","aria-labelledby":_vm.listAriaLabelledBy || _vm.headerId || _vm.toggleId,"role":"listbox","tabindex":"-1"},on:{"keydown":_vm.onKeydown}},[_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},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.listboxTag === 'ul' ? 'li' : 'div',{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()],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")],2):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-pl-7 gl-pr-5 gl-pt-3 gl-font-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)};
528
528
  var __vue_staticRenderFns__ = [];
529
529
 
530
530
  /* style */
@@ -1,4 +1,3 @@
1
- import debounce from 'lodash/debounce';
2
1
  import GlClearIconButton from '../../../shared_components/clear_icon_button/clear_icon_button';
3
2
  import GlIcon from '../../icon/icon';
4
3
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -37,9 +36,9 @@ var script = {
37
36
  inputListeners() {
38
37
  return {
39
38
  ...this.$listeners,
40
- input: debounce(event => {
39
+ input: event => {
41
40
  this.$emit('input', event.target.value);
42
- }, 200)
41
+ }
43
42
  };
44
43
  }
45
44
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "52.7.1",
3
+ "version": "52.7.3",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "devDependencies": {
84
84
  "@arkweid/lefthook": "0.7.7",
85
- "@babel/core": "^7.20.5",
85
+ "@babel/core": "^7.20.7",
86
86
  "@babel/preset-env": "^7.20.2",
87
87
  "@gitlab/eslint-plugin": "18.1.0",
88
88
  "@gitlab/fonts": "^1.0.1",
@@ -91,14 +91,14 @@
91
91
  "@rollup/plugin-commonjs": "^11.1.0",
92
92
  "@rollup/plugin-node-resolve": "^7.1.3",
93
93
  "@rollup/plugin-replace": "^2.3.2",
94
- "@storybook/addon-a11y": "6.5.14",
95
- "@storybook/addon-docs": "6.5.14",
96
- "@storybook/addon-essentials": "6.5.14",
97
- "@storybook/addon-storyshots": "6.5.14",
98
- "@storybook/addon-storyshots-puppeteer": "6.5.14",
99
- "@storybook/addon-viewport": "6.5.14",
100
- "@storybook/theming": "6.5.14",
101
- "@storybook/vue": "6.5.14",
94
+ "@storybook/addon-a11y": "6.5.15",
95
+ "@storybook/addon-docs": "6.5.15",
96
+ "@storybook/addon-essentials": "6.5.15",
97
+ "@storybook/addon-storyshots": "6.5.15",
98
+ "@storybook/addon-storyshots-puppeteer": "6.5.15",
99
+ "@storybook/addon-viewport": "6.5.15",
100
+ "@storybook/theming": "6.5.15",
101
+ "@storybook/vue": "6.5.15",
102
102
  "@vue/compat": "^3.2.40",
103
103
  "@vue/compiler-sfc": "^3.2.40",
104
104
  "@vue/test-utils": "1.3.0",
@@ -115,7 +115,7 @@
115
115
  "bootstrap-vue-vue3": "npm:bootstrap-vue@2.23.1",
116
116
  "cypress": "^11.2.0",
117
117
  "emoji-regex": "^10.0.0",
118
- "eslint": "8.29.0",
118
+ "eslint": "8.31.0",
119
119
  "eslint-import-resolver-jest": "3.0.2",
120
120
  "eslint-plugin-cypress": "2.12.1",
121
121
  "eslint-plugin-storybook": "0.6.8",
@@ -561,4 +561,31 @@ describe('GlListbox', () => {
561
561
  expect(findIntersectionObserver().exists()).toBe(false);
562
562
  });
563
563
  });
564
+
565
+ describe('items test IDs without groups', () => {
566
+ beforeEach(() => {
567
+ buildWrapper({
568
+ items: mockOptions,
569
+ });
570
+ });
571
+
572
+ it.each(mockOptions)('sets the test ID for %s', (option) => {
573
+ expect(wrapper.find(`[data-testid="listbox-item-${option.value}"]`).exists()).toBe(true);
574
+ });
575
+ });
576
+
577
+ describe('items test IDs with groups', () => {
578
+ beforeEach(() => {
579
+ buildWrapper({
580
+ items: mockGroups,
581
+ });
582
+ });
583
+
584
+ it.each([...mockGroups[0].options, ...mockGroups[1].options])(
585
+ 'sets the test ID for %s',
586
+ (option) => {
587
+ expect(wrapper.find(`[data-testid="listbox-item-${option.value}"]`).exists()).toBe(true);
588
+ }
589
+ );
590
+ });
564
591
  });
@@ -614,6 +614,7 @@ export default {
614
614
  <template v-if="isOption(item)">
615
615
  <gl-listbox-item
616
616
  :key="item.value"
617
+ :data-testid="`listbox-item-${item.value}`"
617
618
  :is-selected="isSelected(item)"
618
619
  :is-focused="isFocused(item)"
619
620
  :is-check-centered="isCheckCentered"
@@ -637,6 +638,7 @@ export default {
637
638
  <gl-listbox-item
638
639
  v-for="option in item.options"
639
640
  :key="option.value"
641
+ :data-testid="`listbox-item-${option.value}`"
640
642
  :is-selected="isSelected(option)"
641
643
  :is-focused="isFocused(option)"
642
644
  :is-check-centered="isCheckCentered"
@@ -650,17 +652,14 @@ export default {
650
652
  </gl-listbox-group>
651
653
  </template>
652
654
  </template>
655
+ <component :is="listboxTag === 'ul' ? 'li' : 'div'" v-if="infiniteScrollLoading">
656
+ <gl-loading-icon data-testid="listbox-infinite-scroll-loader" size="md" class="gl-my-3" />
657
+ </component>
653
658
  <gl-intersection-observer
654
659
  v-if="showIntersectionObserver"
655
660
  @appear="onIntersectionObserverAppear"
656
661
  />
657
662
  </component>
658
- <gl-loading-icon
659
- v-if="infiniteScrollLoading"
660
- data-testid="listbox-infinite-scroll-loader"
661
- size="md"
662
- class="gl-my-3"
663
- />
664
663
  <span
665
664
  v-if="announceSRSearchResults"
666
665
  data-testid="listbox-number-of-results"
@@ -53,11 +53,9 @@ describe('listbox search input component', () => {
53
53
  expect(findInput().element.value).toEqual(newSearchValue);
54
54
  });
55
55
 
56
- it(`emits ${modelEvent} event when input value changes`, () => {
56
+ it(`emits ${modelEvent} event when input value changes`, async () => {
57
57
  findInput().setValue(newSearchValue);
58
- jest.advanceTimersByTime(199);
59
- expect(wrapper.emitted('input')).toEqual(undefined);
60
- jest.advanceTimersByTime(1);
58
+ await nextTick();
61
59
  expect(wrapper.emitted('input')).toEqual([[newSearchValue]]);
62
60
  });
63
61
  });
@@ -1,5 +1,4 @@
1
1
  <script>
2
- import debounce from 'lodash/debounce';
3
2
  import GlClearIconButton from '../../../shared_components/clear_icon_button/clear_icon_button.vue';
4
3
  import GlIcon from '../../icon/icon.vue';
5
4
 
@@ -37,9 +36,9 @@ export default {
37
36
  inputListeners() {
38
37
  return {
39
38
  ...this.$listeners,
40
- input: debounce((event) => {
39
+ input: (event) => {
41
40
  this.$emit('input', event.target.value);
42
- }, 200),
41
+ },
43
42
  };
44
43
  },
45
44
  },