@gitlab/ui 65.1.0 → 65.1.2

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
+ ## [65.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v65.1.1...v65.1.2) (2023-08-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlDisclosureDropdown:** sets alignment to fix right placement ([02c966a](https://gitlab.com/gitlab-org/gitlab-ui/commit/02c966aa2d990a514134e376f33ee47864f6cc76)), closes [#L69-L70](https://gitlab.com/gitlab-org/gitlab-ui/issues/L69-L70)
7
+
8
+ ## [65.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v65.1.0...v65.1.1) (2023-08-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **GlCollpasibleListbox:** correctly handle Home and End ([596127d](https://gitlab.com/gitlab-org/gitlab-ui/commit/596127d79c05f190746109ec9776ee7460672237))
14
+
1
15
  # [65.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v65.0.1...v65.1.0) (2023-08-09)
2
16
 
3
17
 
@@ -230,10 +230,13 @@ var script = {
230
230
  return this.positioningStrategy === POSITION_FIXED;
231
231
  },
232
232
  floatingUIConfig() {
233
+ const placement = dropdownPlacements[this.placement];
234
+ const [, alignment] = placement.split('-');
233
235
  return {
234
- placement: dropdownPlacements[this.placement],
236
+ placement,
235
237
  strategy: this.positioningStrategy,
236
238
  middleware: [offset(this.offset), autoPlacement({
239
+ alignment,
237
240
  allowedPlacements: dropdownAllowedAutoPlacements[this.placement]
238
241
  }), size({
239
242
  apply: _ref => {
@@ -34,7 +34,6 @@ var script = {
34
34
  href: item.href,
35
35
  ...item.extraAttrs
36
36
  },
37
- wrapperClass: item.wrapperClass,
38
37
  listeners: {
39
38
  click: this.action
40
39
  }
@@ -51,8 +50,7 @@ var script = {
51
50
  item === null || item === void 0 ? void 0 : (_item$action = item.action) === null || _item$action === void 0 ? void 0 : _item$action.call(undefined, item);
52
51
  this.action();
53
52
  }
54
- },
55
- wrapperClass: item === null || item === void 0 ? void 0 : item.wrapperClass
53
+ }
56
54
  };
57
55
  },
58
56
  listIndex() {
@@ -63,6 +61,10 @@ var script = {
63
61
  var _this$item3, _this$item3$extraAttr;
64
62
  return (_this$item3 = this.item) !== null && _this$item3 !== void 0 && (_this$item3$extraAttr = _this$item3.extraAttrs) !== null && _this$item3$extraAttr !== void 0 && _this$item3$extraAttr.disabled ? null : -1;
65
63
  },
64
+ wrapperClass() {
65
+ var _this$item$wrapperCla, _this$item4;
66
+ return (_this$item$wrapperCla = (_this$item4 = this.item) === null || _this$item4 === void 0 ? void 0 : _this$item4.wrapperClass) !== null && _this$item$wrapperCla !== void 0 ? _this$item$wrapperCla : '';
67
+ },
66
68
  wrapperListeners() {
67
69
  const listeners = {
68
70
  keydown: this.onKeydown
@@ -105,7 +107,7 @@ var script = {
105
107
  const __vue_script__ = script;
106
108
 
107
109
  /* template */
108
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('li',_vm._g({class:[_vm.$options.ITEM_CLASS, _vm.itemComponent.wrapperClass],attrs:{"tabindex":_vm.listIndex,"data-testid":"disclosure-dropdown-item"}},_vm.wrapperListeners),[_vm._t("default",function(){return [_c(_vm.itemComponent.is,_vm._g(_vm._b({ref:"item",tag:"component",staticClass:"gl-new-dropdown-item-content",attrs:{"tabindex":_vm.componentIndex}},'component',_vm.itemComponent.attrs,false),_vm.itemComponent.listeners),[_c('span',{staticClass:"gl-new-dropdown-item-text-wrapper"},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(_vm.item.text)+"\n ")]})],2)])]})],2)};
110
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('li',_vm._g({class:[_vm.$options.ITEM_CLASS, _vm.wrapperClass],attrs:{"tabindex":_vm.listIndex,"data-testid":"disclosure-dropdown-item"}},_vm.wrapperListeners),[_vm._t("default",function(){return [_c(_vm.itemComponent.is,_vm._g(_vm._b({ref:"item",tag:"component",staticClass:"gl-new-dropdown-item-content",attrs:{"tabindex":_vm.componentIndex}},'component',_vm.itemComponent.attrs,false),_vm.itemComponent.listeners),[_c('span',{staticClass:"gl-new-dropdown-item-text-wrapper"},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(_vm.item.text)+"\n ")]})],2)])]})],2)};
109
111
  var __vue_staticRenderFns__ = [];
110
112
 
111
113
  /* style */
@@ -545,8 +545,14 @@ var script = {
545
545
  let stop = true;
546
546
  const isSearchInput = target.matches(SEARCH_INPUT_SELECTOR);
547
547
  if (code === HOME) {
548
+ if (isSearchInput) {
549
+ return;
550
+ }
548
551
  this.focusItem(0, elements);
549
552
  } else if (code === END) {
553
+ if (isSearchInput) {
554
+ return;
555
+ }
550
556
  this.focusItem(elements.length - 1, elements);
551
557
  } else if (code === ARROW_UP) {
552
558
  if (isSearchInput) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 09 Aug 2023 06:12:06 GMT
3
+ * Generated on Fri, 11 Aug 2023 17:26:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 09 Aug 2023 06:12:06 GMT
3
+ * Generated on Fri, 11 Aug 2023 17:26:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 09 Aug 2023 06:12:06 GMT
3
+ * Generated on Fri, 11 Aug 2023 17:26:50 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, 09 Aug 2023 06:12:06 GMT
3
+ * Generated on Fri, 11 Aug 2023 17:26:50 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, 09 Aug 2023 06:12:06 GMT
3
+ // Generated on Fri, 11 Aug 2023 17:26:50 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, 09 Aug 2023 06:12:06 GMT
3
+ // Generated on Fri, 11 Aug 2023 17:26:50 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": "65.1.0",
3
+ "version": "65.1.2",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -123,7 +123,7 @@
123
123
  "emoji-regex": "^10.0.0",
124
124
  "eslint": "8.46.0",
125
125
  "eslint-import-resolver-jest": "3.0.2",
126
- "eslint-plugin-cypress": "2.13.3",
126
+ "eslint-plugin-cypress": "2.13.4",
127
127
  "eslint-plugin-storybook": "0.6.12",
128
128
  "glob": "^7.2.0",
129
129
  "identity-obj-proxy": "^3.0.0",
@@ -108,6 +108,7 @@ describe('base dropdown', () => {
108
108
  middleware: [
109
109
  offset({ mainAxis: DEFAULT_OFFSET }),
110
110
  autoPlacement({
111
+ alignment: 'start',
111
112
  allowedPlacements: ['bottom-start', 'top-start', 'bottom-end', 'top-end'],
112
113
  }),
113
114
  ],
@@ -128,6 +129,7 @@ describe('base dropdown', () => {
128
129
  middleware: [
129
130
  offset({ mainAxis: DEFAULT_OFFSET }),
130
131
  autoPlacement({
132
+ alignment: undefined,
131
133
  allowedPlacements: ['bottom', 'top'],
132
134
  }),
133
135
  ],
@@ -148,6 +150,7 @@ describe('base dropdown', () => {
148
150
  middleware: [
149
151
  offset({ mainAxis: DEFAULT_OFFSET }),
150
152
  autoPlacement({
153
+ alignment: 'end',
151
154
  allowedPlacements: ['bottom-start', 'top-start', 'bottom-end', 'top-end'],
152
155
  }),
153
156
  ],
@@ -243,12 +243,15 @@ export default {
243
243
  return this.positioningStrategy === POSITION_FIXED;
244
244
  },
245
245
  floatingUIConfig() {
246
+ const placement = dropdownPlacements[this.placement];
247
+ const [, alignment] = placement.split('-');
246
248
  return {
247
- placement: dropdownPlacements[this.placement],
249
+ placement,
248
250
  strategy: this.positioningStrategy,
249
251
  middleware: [
250
252
  offset(this.offset),
251
253
  autoPlacement({
254
+ alignment,
252
255
  allowedPlacements: dropdownAllowedAutoPlacements[this.placement],
253
256
  }),
254
257
  size({
@@ -34,7 +34,6 @@ export default {
34
34
  href: item.href,
35
35
  ...item.extraAttrs,
36
36
  },
37
- wrapperClass: item.wrapperClass,
38
37
  listeners: {
39
38
  click: this.action,
40
39
  },
@@ -52,7 +51,6 @@ export default {
52
51
  this.action();
53
52
  },
54
53
  },
55
- wrapperClass: item?.wrapperClass,
56
54
  };
57
55
  },
58
56
  listIndex() {
@@ -61,6 +59,9 @@ export default {
61
59
  componentIndex() {
62
60
  return this.item?.extraAttrs?.disabled ? null : -1;
63
61
  },
62
+ wrapperClass() {
63
+ return this.item?.wrapperClass ?? '';
64
+ },
64
65
  wrapperListeners() {
65
66
  const listeners = {
66
67
  keydown: this.onKeydown,
@@ -100,7 +101,7 @@ export default {
100
101
  <template>
101
102
  <li
102
103
  :tabindex="listIndex"
103
- :class="[$options.ITEM_CLASS, itemComponent.wrapperClass]"
104
+ :class="[$options.ITEM_CLASS, wrapperClass]"
104
105
  data-testid="disclosure-dropdown-item"
105
106
  v-on="wrapperListeners"
106
107
  >
@@ -330,6 +330,14 @@ describe('GlCollapsibleListbox', () => {
330
330
  expect(searchboxInput.element).toHaveFocus();
331
331
  });
332
332
 
333
+ it('should not move focus away from the input on `HOME` and `END`', async () => {
334
+ expect(searchboxInput.element).toHaveFocus();
335
+ await searchboxInput.trigger('keydown', { code: HOME });
336
+ expect(searchboxInput.element).toHaveFocus();
337
+ await searchboxInput.trigger('keydown', { code: END });
338
+ expect(searchboxInput.element).toHaveFocus();
339
+ });
340
+
333
341
  describe('pressing Enter on the input', () => {
334
342
  const keydownSpy = jest.fn();
335
343
 
@@ -565,8 +565,14 @@ export default {
565
565
  const isSearchInput = target.matches(SEARCH_INPUT_SELECTOR);
566
566
 
567
567
  if (code === HOME) {
568
+ if (isSearchInput) {
569
+ return;
570
+ }
568
571
  this.focusItem(0, elements);
569
572
  } else if (code === END) {
573
+ if (isSearchInput) {
574
+ return;
575
+ }
570
576
  this.focusItem(elements.length - 1, elements);
571
577
  } else if (code === ARROW_UP) {
572
578
  if (isSearchInput) {