@vaadin/combo-box 22.0.4 → 22.0.5

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": "@vaadin/combo-box",
3
- "version": "22.0.4",
3
+ "version": "22.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,25 +32,24 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@open-wc/dedupe-mixin": "^1.3.0",
35
- "@polymer/iron-resizable-behavior": "^3.0.0",
36
35
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "^22.0.4",
38
- "@vaadin/field-base": "^22.0.4",
39
- "@vaadin/input-container": "^22.0.4",
40
- "@vaadin/item": "^22.0.4",
41
- "@vaadin/vaadin-lumo-styles": "^22.0.4",
42
- "@vaadin/vaadin-material-styles": "^22.0.4",
43
- "@vaadin/vaadin-overlay": "^22.0.4",
44
- "@vaadin/vaadin-themable-mixin": "^22.0.4"
36
+ "@vaadin/component-base": "^22.0.5",
37
+ "@vaadin/field-base": "^22.0.5",
38
+ "@vaadin/input-container": "^22.0.5",
39
+ "@vaadin/item": "^22.0.5",
40
+ "@vaadin/vaadin-lumo-styles": "^22.0.5",
41
+ "@vaadin/vaadin-material-styles": "^22.0.5",
42
+ "@vaadin/vaadin-overlay": "^22.0.5",
43
+ "@vaadin/vaadin-themable-mixin": "^22.0.5"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@esm-bundle/chai": "^4.3.4",
48
- "@vaadin/dialog": "^22.0.4",
49
- "@vaadin/polymer-legacy-adapter": "^22.0.4",
47
+ "@vaadin/dialog": "^22.0.5",
48
+ "@vaadin/polymer-legacy-adapter": "^22.0.5",
50
49
  "@vaadin/testing-helpers": "^0.3.2",
51
- "@vaadin/text-field": "^22.0.4",
50
+ "@vaadin/text-field": "^22.0.5",
52
51
  "lit": "^2.0.0",
53
52
  "sinon": "^9.2.0"
54
53
  },
55
- "gitHead": "55891f68d4da41e846e06dfe51dceba1665e41ce"
54
+ "gitHead": "3e1990867670f3de2dec6fa1200d945623b2710c"
56
55
  }
@@ -6,8 +6,6 @@
6
6
  import './vaadin-combo-box-item.js';
7
7
  import './vaadin-combo-box-overlay.js';
8
8
  import './vaadin-combo-box-scroller.js';
9
- import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
10
- import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
11
9
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
10
 
13
11
  /**
@@ -16,7 +14,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
16
14
  * @extends HTMLElement
17
15
  * @private
18
16
  */
19
- export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, PolymerElement) {
17
+ export class ComboBoxDropdown extends PolymerElement {
20
18
  static get is() {
21
19
  return 'vaadin-combo-box-dropdown';
22
20
  }
@@ -171,14 +169,6 @@ export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, Poly
171
169
  this._overlayOpened = false;
172
170
  }
173
171
 
174
- notifyResize() {
175
- super.notifyResize();
176
-
177
- if (this.positionTarget && this.opened) {
178
- this._setOverlayWidth();
179
- }
180
- }
181
-
182
172
  _fireTouchAction(sourceEvent) {
183
173
  this.dispatchEvent(
184
174
  new CustomEvent('vaadin-overlay-touch-action', {
@@ -413,6 +413,16 @@ export const ComboBoxMixin = (subclass) =>
413
413
  }
414
414
  }
415
415
 
416
+ /**
417
+ * @param {Event} event
418
+ * @protected
419
+ */
420
+ _onHostClick(_event) {
421
+ if (!this.autoOpenDisabled) {
422
+ this.open();
423
+ }
424
+ }
425
+
416
426
  /** @private */
417
427
  _onClick(e) {
418
428
  this._closeOnBlurIsPrevented = true;
@@ -427,8 +437,8 @@ export const ComboBoxMixin = (subclass) =>
427
437
  } else {
428
438
  this.open();
429
439
  }
430
- } else if (!this.autoOpenDisabled) {
431
- this.open();
440
+ } else {
441
+ this._onHostClick(e);
432
442
  }
433
443
 
434
444
  this._closeOnBlurIsPrevented = false;
@@ -650,8 +660,6 @@ export const ComboBoxMixin = (subclass) =>
650
660
 
651
661
  /** @private */
652
662
  _onOpened() {
653
- setTimeout(() => this._resizeDropdown(), 1);
654
-
655
663
  // Defer scroll position adjustment to improve performance.
656
664
  requestAnimationFrame(() => {
657
665
  this.$.dropdown.adjustScrollPosition();
@@ -832,11 +840,6 @@ export const ComboBoxMixin = (subclass) =>
832
840
  }
833
841
  }
834
842
 
835
- /** @private */
836
- _resizeDropdown() {
837
- this.$.dropdown.notifyResize();
838
- }
839
-
840
843
  /** @private */
841
844
  _selectedItemChanged(selectedItem) {
842
845
  if (selectedItem === null || selectedItem === undefined) {
@@ -291,6 +291,19 @@ class ComboBox extends ComboBoxDataProviderMixin(
291
291
 
292
292
  this._handleClearButtonClick(event);
293
293
  }
294
+
295
+ /**
296
+ * @param {Event} event
297
+ * @protected
298
+ */
299
+ _onHostClick(event) {
300
+ const path = event.composedPath();
301
+
302
+ // Open dropdown only when clicking on the label or input field
303
+ if (path.includes(this._labelNode) || path.includes(this._positionTarget)) {
304
+ super._onHostClick(event);
305
+ }
306
+ }
294
307
  }
295
308
 
296
309
  customElements.define(ComboBox.is, ComboBox);