@gitlab/ui 66.3.0 → 66.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [66.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.3.0...v66.3.1) (2023-09-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlCollapsibleListbox:** show/hide select all and reset buttons for groups ([867e9c5](https://gitlab.com/gitlab-org/gitlab-ui/commit/867e9c5948f21a1bfb94502ac56f6248c6ab0b4a))
7
+
1
8
  # [66.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.2.0...v66.3.0) (2023-08-30)
2
9
 
3
10
 
@@ -401,7 +401,7 @@ var script = {
401
401
  return false;
402
402
  }
403
403
  if (this.multiple) {
404
- return this.selected.length === this.items.length;
404
+ return this.selected.length === this.flattenedOptions.length;
405
405
  }
406
406
  return Boolean(this.selected);
407
407
  },
@@ -420,7 +420,7 @@ var script = {
420
420
  if (!this.hasItems) {
421
421
  return false;
422
422
  }
423
- return this.selected.length !== this.items.length;
423
+ return this.selected.length !== this.flattenedOptions.length;
424
424
  },
425
425
  showIntersectionObserver() {
426
426
  return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
@@ -63,6 +63,12 @@ const mockGroups = [{
63
63
  value: 'v2.1'
64
64
  }]
65
65
  }];
66
+ const mockGroupOptionsValues = mockGroups.map(group => group.options).flat().map(_ref2 => {
67
+ let {
68
+ value
69
+ } = _ref2;
70
+ return value;
71
+ });
66
72
  const mockGroupsWithTextSrOnly = [{
67
73
  text: 'Default',
68
74
  options: [{
@@ -109,4 +115,4 @@ const mockUsers = [{
109
115
  icon: 'bin'
110
116
  }];
111
117
 
112
- export { mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockOptionsValues, mockUsers };
118
+ export { mockGroupOptionsValues, mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockOptionsValues, mockUsers };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ * Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ * Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ * Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ * Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ // Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 30 Aug 2023 06:58:09 GMT
3
+ // Generated on Fri, 01 Sep 2023 14:28:31 GMT
4
4
 
5
5
  $brand-gray-05: #2b2838 !default;
6
6
  $brand-gray-04: #45424d !default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.3.0",
3
+ "version": "66.3.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -94,22 +94,22 @@
94
94
  "@gitlab/eslint-plugin": "19.0.0",
95
95
  "@gitlab/fonts": "^1.2.0",
96
96
  "@gitlab/stylelint-config": "5.0.0",
97
- "@gitlab/svgs": "3.60.0",
97
+ "@gitlab/svgs": "3.61.0",
98
98
  "@rollup/plugin-commonjs": "^11.1.0",
99
99
  "@rollup/plugin-node-resolve": "^7.1.3",
100
100
  "@rollup/plugin-replace": "^2.3.2",
101
- "@storybook/addon-a11y": "7.3.2",
102
- "@storybook/addon-docs": "7.3.2",
103
- "@storybook/addon-essentials": "7.3.2",
104
- "@storybook/addon-storyshots": "7.3.2",
105
- "@storybook/addon-storyshots-puppeteer": "7.3.2",
106
- "@storybook/addon-viewport": "7.3.2",
107
- "@storybook/builder-webpack5": "7.3.2",
108
- "@storybook/theming": "7.3.2",
109
- "@storybook/vue": "7.3.2",
110
- "@storybook/vue-webpack5": "7.3.2",
111
- "@storybook/vue3": "7.3.2",
112
- "@storybook/vue3-webpack5": "7.3.2",
101
+ "@storybook/addon-a11y": "7.4.0",
102
+ "@storybook/addon-docs": "7.4.0",
103
+ "@storybook/addon-essentials": "7.4.0",
104
+ "@storybook/addon-storyshots": "7.4.0",
105
+ "@storybook/addon-storyshots-puppeteer": "7.4.0",
106
+ "@storybook/addon-viewport": "7.4.0",
107
+ "@storybook/builder-webpack5": "7.4.0",
108
+ "@storybook/theming": "7.4.0",
109
+ "@storybook/vue": "7.4.0",
110
+ "@storybook/vue-webpack5": "7.4.0",
111
+ "@storybook/vue3": "7.4.0",
112
+ "@storybook/vue3-webpack5": "7.4.0",
113
113
  "@vue/compat": "^3.2.40",
114
114
  "@vue/compiler-sfc": "^3.2.40",
115
115
  "@vue/test-utils": "1.3.0",
@@ -158,7 +158,7 @@
158
158
  "sass-loader": "^10.2.0",
159
159
  "sass-true": "^6.1.0",
160
160
  "start-server-and-test": "^1.10.6",
161
- "storybook": "7.3.2",
161
+ "storybook": "7.4.0",
162
162
  "storybook-dark-mode": "3.0.1",
163
163
  "style-dictionary": "^3.8.0",
164
164
  "stylelint": "15.10.2",
@@ -18,7 +18,13 @@ import GlIntersectionObserver from '../../../utilities/intersection_observer/int
18
18
  import GlCollapsibleListbox, { ITEM_SELECTOR } from './listbox.vue';
19
19
  import GlListboxItem from './listbox_item.vue';
20
20
  import GlListboxGroup from './listbox_group.vue';
21
- import { mockOptions, mockOptionsValues, mockGroups, mockGroupsWithTextSrOnly } from './mock_data';
21
+ import {
22
+ mockOptions,
23
+ mockOptionsValues,
24
+ mockGroups,
25
+ mockGroupOptionsValues,
26
+ mockGroupsWithTextSrOnly,
27
+ } from './mock_data';
22
28
 
23
29
  jest.mock('@floating-ui/dom');
24
30
  autoUpdate.mockImplementation(() => {
@@ -556,6 +562,26 @@ describe('GlCollapsibleListbox', () => {
556
562
  expect(wrapper.emitted('reset')).toHaveLength(1);
557
563
  expect(wrapper.vm.closeAndFocus).not.toHaveBeenCalled();
558
564
  });
565
+
566
+ describe('with groups', () => {
567
+ it.each`
568
+ description | props
569
+ ${'multi-select'} | ${{ multiple: true, selected: mockGroupOptionsValues }}
570
+ ${'single-select'} | ${{ multiple: false, selected: mockGroups[0].options[0].value }}
571
+ `(
572
+ 'shows the button if the label is provided and the selection is complete in $description mode',
573
+ ({ props }) => {
574
+ buildWrapper({
575
+ headerText: 'Select assignee',
576
+ resetButtonLabel: 'Unassign',
577
+ items: mockGroups,
578
+ ...props,
579
+ });
580
+
581
+ expect(findResetButton().exists()).toBe(true);
582
+ }
583
+ );
584
+ });
559
585
  });
560
586
 
561
587
  describe('with select all action', () => {
@@ -663,6 +689,21 @@ describe('GlCollapsibleListbox', () => {
663
689
 
664
690
  expect(wrapper.emitted('select-all')).toHaveLength(1);
665
691
  });
692
+
693
+ describe('with groups', () => {
694
+ it('hides select all button if all items are selected', () => {
695
+ buildWrapper({
696
+ headerText: 'Select assignee',
697
+ resetButtonLabel: 'Unassign',
698
+ showSelectAllButtonLabel: 'Select All',
699
+ selected: mockGroupOptionsValues,
700
+ items: mockGroups,
701
+ multiple: true,
702
+ });
703
+
704
+ expect(findSelectAllButton().exists()).toBe(false);
705
+ });
706
+ });
666
707
  });
667
708
 
668
709
  describe('when `infiniteScroll` prop is `true`', () => {
@@ -412,7 +412,7 @@ export default {
412
412
  }
413
413
 
414
414
  if (this.multiple) {
415
- return this.selected.length === this.items.length;
415
+ return this.selected.length === this.flattenedOptions.length;
416
416
  }
417
417
  return Boolean(this.selected);
418
418
  },
@@ -433,7 +433,7 @@ export default {
433
433
  return false;
434
434
  }
435
435
 
436
- return this.selected.length !== this.items.length;
436
+ return this.selected.length !== this.flattenedOptions.length;
437
437
  },
438
438
  showIntersectionObserver() {
439
439
  return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
@@ -69,6 +69,11 @@ export const mockGroups = [
69
69
  },
70
70
  ];
71
71
 
72
+ export const mockGroupOptionsValues = mockGroups
73
+ .map((group) => group.options)
74
+ .flat()
75
+ .map(({ value }) => value);
76
+
72
77
  export const mockGroupsWithTextSrOnly = [
73
78
  {
74
79
  text: 'Default',