@gitlab/ui 66.3.0 → 66.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.3.0",
3
+ "version": "66.4.0",
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",
@@ -121,7 +121,7 @@
121
121
  "babel-loader": "^8.0.5",
122
122
  "babel-plugin-require-context-hook": "^1.0.0",
123
123
  "bootstrap": "4.6.2",
124
- "cypress": "12.17.4",
124
+ "cypress": "13.1.0",
125
125
  "dompurify": "^3.0.0",
126
126
  "emoji-regex": "^10.0.0",
127
127
  "eslint": "8.48.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',
@@ -6847,6 +6847,12 @@
6847
6847
  margin-top: #{$gl-spacing-scale-3} !important;
6848
6848
  }
6849
6849
  }
6850
+ .gl-gap-1 {
6851
+ gap: $gl-spacing-scale-1;
6852
+ }
6853
+ .gl-gap-1\! {
6854
+ gap: $gl-spacing-scale-1 !important;
6855
+ }
6850
6856
  .gl-gap-2 {
6851
6857
  gap: $gl-spacing-scale-2;
6852
6858
  }
@@ -868,6 +868,10 @@
868
868
  }
869
869
  }
870
870
 
871
+ @mixin gl-gap-1 {
872
+ gap: $gl-spacing-scale-1;
873
+ }
874
+
871
875
  @mixin gl-gap-2 {
872
876
  gap: $gl-spacing-scale-2;
873
877
  }