@gitlab/ui 48.3.0 → 48.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
+ ## [48.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.3.0...v48.3.1) (2022-10-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **OutsideDirective:** enable event capture ([c32381a](https://gitlab.com/gitlab-org/gitlab-ui/commit/c32381a3048895e747cc905df468319d8eff7a30))
7
+
1
8
  # [48.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.2.0...v48.3.0) (2022-10-24)
2
9
 
3
10
 
@@ -40,7 +40,9 @@ const startListening = () => {
40
40
  return;
41
41
  }
42
42
 
43
- document.addEventListener('click', globalListener);
43
+ document.addEventListener('click', globalListener, {
44
+ capture: true
45
+ });
44
46
  listening = true;
45
47
  };
46
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "48.3.0",
3
+ "version": "48.3.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -249,7 +249,6 @@ const makeGroupedExample = (changes) => {
249
249
  openListbox(this);
250
250
  }
251
251
  },
252
- template: template(''),
253
252
  ...changes,
254
253
  });
255
254
 
@@ -259,7 +258,53 @@ const makeGroupedExample = (changes) => {
259
258
  return story;
260
259
  };
261
260
 
262
- export const Groups = makeGroupedExample();
261
+ export const Groups = makeGroupedExample({
262
+ template: template('', {
263
+ bindingOverrides: {
264
+ ':toggle-text': 'customToggleText',
265
+ ':items': 'computedItems',
266
+ },
267
+ }),
268
+ data() {
269
+ return {
270
+ selected: ['v1.0'],
271
+ };
272
+ },
273
+ computed: {
274
+ customToggleText() {
275
+ return this.selected.length ? `${this.selected.length} refs selected` : 'Select refs';
276
+ },
277
+ computedItems() {
278
+ const isSelected = (option) => this.selected.includes(option.value);
279
+ const notSelected = (option) => !isSelected(option);
280
+
281
+ const selectedBranches = mockGroups[0].options.filter(isSelected);
282
+ const availableBranches = mockGroups[0].options.filter(notSelected);
283
+ const selectedTags = mockGroups[1].options.filter(isSelected);
284
+ const availableTags = mockGroups[1].options.filter(notSelected);
285
+
286
+ return [
287
+ {
288
+ text: 'Selected branches',
289
+ options: selectedBranches,
290
+ },
291
+ {
292
+ text: 'Selected tags',
293
+ options: selectedTags,
294
+ },
295
+ {
296
+ text: 'Branches',
297
+ options: availableBranches,
298
+ },
299
+ {
300
+ text: 'Tags',
301
+ options: availableTags,
302
+ },
303
+ ].filter((group) => group.options.length);
304
+ },
305
+ },
306
+ });
307
+ Groups.args = generateProps({ multiple: true });
263
308
 
264
309
  export const CustomGroupsAndItems = makeGroupedExample({
265
310
  template: template(`
@@ -37,7 +37,7 @@ const startListening = () => {
37
37
  return;
38
38
  }
39
39
 
40
- document.addEventListener('click', globalListener);
40
+ document.addEventListener('click', globalListener, { capture: true });
41
41
  listening = true;
42
42
  };
43
43
 
@@ -129,7 +129,9 @@ describe('outside directive', () => {
129
129
  it('attaches the global listener on first initialisation', async () => {
130
130
  await createComponent();
131
131
 
132
- expect(document.addEventListener.mock.calls).toEqual([['click', expect.any(Function)]]);
132
+ expect(document.addEventListener.mock.calls).toEqual([
133
+ ['click', expect.any(Function), { capture: true }],
134
+ ]);
133
135
  });
134
136
 
135
137
  it('detaches the global listener when last binding is removed', async () => {
@@ -150,7 +152,9 @@ describe('outside directive', () => {
150
152
  `,
151
153
  });
152
154
 
153
- expect(document.addEventListener.mock.calls).toEqual([['click', expect.any(Function)]]);
155
+ expect(document.addEventListener.mock.calls).toEqual([
156
+ ['click', expect.any(Function), { capture: true }],
157
+ ]);
154
158
  });
155
159
 
156
160
  it('only unbinds once there are no instances', async () => {