@vaadin/combo-box 24.4.0-dev.223e39f050 → 24.4.0-dev.4b20a0c55.3

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/README.md CHANGED
@@ -5,7 +5,6 @@ A web component for choosing a value from a filterable list of options presented
5
5
  [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/combo-box)
6
6
 
7
7
  [![npm version](https://badgen.net/npm/v/@vaadin/combo-box)](https://www.npmjs.com/package/@vaadin/combo-box)
8
- [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
9
8
 
10
9
  ```html
11
10
  <vaadin-combo-box
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "24.4.0-dev.223e39f050",
3
+ "version": "24.4.0-dev.4b20a0c55.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,21 +38,21 @@
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "24.4.0-dev.223e39f050",
42
- "@vaadin/component-base": "24.4.0-dev.223e39f050",
43
- "@vaadin/field-base": "24.4.0-dev.223e39f050",
44
- "@vaadin/input-container": "24.4.0-dev.223e39f050",
45
- "@vaadin/item": "24.4.0-dev.223e39f050",
46
- "@vaadin/lit-renderer": "24.4.0-dev.223e39f050",
47
- "@vaadin/overlay": "24.4.0-dev.223e39f050",
48
- "@vaadin/vaadin-lumo-styles": "24.4.0-dev.223e39f050",
49
- "@vaadin/vaadin-material-styles": "24.4.0-dev.223e39f050",
50
- "@vaadin/vaadin-themable-mixin": "24.4.0-dev.223e39f050"
41
+ "@vaadin/a11y-base": "24.4.0-dev.4b20a0c55.3",
42
+ "@vaadin/component-base": "24.4.0-dev.4b20a0c55.3",
43
+ "@vaadin/field-base": "24.4.0-dev.4b20a0c55.3",
44
+ "@vaadin/input-container": "24.4.0-dev.4b20a0c55.3",
45
+ "@vaadin/item": "24.4.0-dev.4b20a0c55.3",
46
+ "@vaadin/lit-renderer": "24.4.0-dev.4b20a0c55.3",
47
+ "@vaadin/overlay": "24.4.0-dev.4b20a0c55.3",
48
+ "@vaadin/vaadin-lumo-styles": "24.4.0-dev.4b20a0c55.3",
49
+ "@vaadin/vaadin-material-styles": "24.4.0-dev.4b20a0c55.3",
50
+ "@vaadin/vaadin-themable-mixin": "24.4.0-dev.4b20a0c55.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
54
54
  "@vaadin/testing-helpers": "^0.6.0",
55
- "@vaadin/text-field": "24.4.0-dev.223e39f050",
55
+ "@vaadin/text-field": "24.4.0-dev.4b20a0c55.3",
56
56
  "lit": "^3.0.0",
57
57
  "sinon": "^13.0.2"
58
58
  },
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "5e2e3bfc811c95aed9354235fab93fdbf43eb354"
63
+ "gitHead": "41cf17453d7506fb635c088a0425e20b6e82b89b"
64
64
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DirectiveResult } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { directive } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DataProviderController } from '@vaadin/component-base/src/data-provider-controller/data-provider-controller.js';
@@ -62,6 +62,12 @@ export const ComboBoxDataProviderMixin = (superClass) =>
62
62
  __previousDataProviderFilter: {
63
63
  type: String,
64
64
  },
65
+
66
+ /** @private */
67
+ _hasData: {
68
+ type: Boolean,
69
+ value: false,
70
+ },
65
71
  };
66
72
  }
67
73
 
@@ -92,7 +98,6 @@ export const ComboBoxDataProviderMixin = (superClass) =>
92
98
  super.ready();
93
99
 
94
100
  this._dataProviderController.addEventListener('page-requested', this.__onDataProviderPageRequested.bind(this));
95
- this._dataProviderController.addEventListener('page-received', this.__onDataProviderPageReceived.bind(this));
96
101
  this._dataProviderController.addEventListener('page-loaded', this.__onDataProviderPageLoaded.bind(this));
97
102
 
98
103
  this._scroller.addEventListener('index-requested', (e) => {
@@ -150,7 +155,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
150
155
  return;
151
156
  }
152
157
 
153
- if (opened && !this._dataProviderController.hasData) {
158
+ if (opened && !this._hasData) {
154
159
  this._dataProviderController.loadFirstPage();
155
160
  }
156
161
  }
@@ -170,19 +175,14 @@ export const ComboBoxDataProviderMixin = (superClass) =>
170
175
  }
171
176
 
172
177
  /** @private */
173
- __onDataProviderPageReceived() {
178
+ __onDataProviderPageLoaded() {
179
+ this._hasData = true;
180
+
174
181
  this.requestContentUpdate();
175
- }
176
182
 
177
- /** @private */
178
- __onDataProviderPageLoaded() {
179
183
  if (!this.opened && !this._isInputFocused()) {
180
184
  this._commitValue();
181
185
  }
182
-
183
- if (!this._dataProviderController.isLoading()) {
184
- this.loading = false;
185
- }
186
186
  }
187
187
 
188
188
  /**
@@ -195,6 +195,8 @@ export const ComboBoxDataProviderMixin = (superClass) =>
195
195
 
196
196
  this._dataProviderController.clearCache();
197
197
 
198
+ this._hasData = false;
199
+
198
200
  this.requestContentUpdate();
199
201
 
200
202
  if (this._shouldFetchData()) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DirMixinClass } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { Constructor } from '@open-wc/dedupe-mixin';
7
+ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
8
+ import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
9
+ import type { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
10
+
11
+ export declare function ComboBoxLightMixin<TItem, T extends Constructor<HTMLElement>>(
12
+ base: T,
13
+ ): Constructor<ComboBoxDataProviderMixinClass<TItem>> &
14
+ Constructor<ComboBoxLightMixinClass> &
15
+ Constructor<ComboBoxMixinClass<TItem>> &
16
+ Constructor<ValidateMixinClass> &
17
+ T;
18
+
19
+ export declare class ComboBoxLightMixinClass {
20
+ /**
21
+ * Name of the two-way data-bindable property representing the
22
+ * value of the custom input field.
23
+ * @attr {string} attr-for-value
24
+ */
25
+ attrForValue: string;
26
+ }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
7
+ import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
8
+ import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
9
+ import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
10
+ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
11
+
12
+ /**
13
+ * @polymerMixin
14
+ * @mixes ComboBoxDataProviderMixin
15
+ * @mixes ComboBoxMixin
16
+ * @mixes ValidateMixin
17
+ */
18
+ export const ComboBoxLightMixin = (superClass) =>
19
+ class ComboBoxLightMixinClass extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixin(superClass))) {
20
+ static get properties() {
21
+ return {
22
+ /**
23
+ * Name of the two-way data-bindable property representing the
24
+ * value of the custom input field.
25
+ * @attr {string} attr-for-value
26
+ * @type {string}
27
+ */
28
+ attrForValue: {
29
+ type: String,
30
+ value: 'value',
31
+ },
32
+ };
33
+ }
34
+
35
+ /**
36
+ * Used by `InputControlMixin` as a reference to the clear button element.
37
+ * @protected
38
+ * @return {!HTMLElement}
39
+ */
40
+ get clearElement() {
41
+ return this.querySelector('.clear-button');
42
+ }
43
+
44
+ /**
45
+ * Override this getter from `InputMixin` to allow using
46
+ * an arbitrary property name instead of `value`
47
+ * for accessing the input element's value.
48
+ *
49
+ * @protected
50
+ * @override
51
+ * @return {string}
52
+ */
53
+ get _inputElementValueProperty() {
54
+ return dashToCamelCase(this.attrForValue);
55
+ }
56
+
57
+ /**
58
+ * @protected
59
+ * @override
60
+ * @return {HTMLInputElement | undefined}
61
+ */
62
+ get _nativeInput() {
63
+ const input = this.inputElement;
64
+
65
+ if (input) {
66
+ // Support `<input class="input">`
67
+ if (input instanceof HTMLInputElement) {
68
+ return input;
69
+ }
70
+
71
+ // Support `<input>` in light DOM (e.g. `vaadin-text-field`)
72
+ const slottedInput = input.querySelector('input');
73
+ if (slottedInput) {
74
+ return slottedInput;
75
+ }
76
+
77
+ if (input.shadowRoot) {
78
+ // Support `<input>` in Shadow DOM (e.g. `mwc-textfield`)
79
+ const shadowInput = input.shadowRoot.querySelector('input');
80
+ if (shadowInput) {
81
+ return shadowInput;
82
+ }
83
+ }
84
+ }
85
+
86
+ return undefined;
87
+ }
88
+
89
+ /** @protected */
90
+ ready() {
91
+ super.ready();
92
+
93
+ this._toggleElement = this.querySelector('.toggle-button');
94
+
95
+ // Wait until the slotted input DOM is ready
96
+ afterNextRender(this, () => {
97
+ this._setInputElement(this.querySelector('vaadin-text-field,.input'));
98
+ this._revertInputValue();
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Returns true if the current input value satisfies all constraints (if any).
104
+ * @return {boolean}
105
+ */
106
+ checkValidity() {
107
+ if (this.inputElement && this.inputElement.validate) {
108
+ return this.inputElement.validate();
109
+ }
110
+ return super.checkValidity();
111
+ }
112
+
113
+ /**
114
+ * @protected
115
+ * @override
116
+ */
117
+ _isClearButton(event) {
118
+ return (
119
+ super._isClearButton(event) ||
120
+ (event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
121
+ event.composedPath()[0].getAttribute('part') === 'clear-button'
122
+ );
123
+ }
124
+
125
+ /**
126
+ * @protected
127
+ * @override
128
+ */
129
+ _shouldRemoveFocus(event) {
130
+ const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
131
+ const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
132
+
133
+ // prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
134
+ if (isBlurringControlButtons && isFocusingInputElement) {
135
+ return false;
136
+ }
137
+
138
+ return super._shouldRemoveFocus(event);
139
+ }
140
+ };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
@@ -11,6 +11,7 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
11
11
  import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
12
  import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
13
13
  import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
14
+ import type { ComboBoxLightMixinClass } from './vaadin-combo-box-light-mixin.js';
14
15
  import type { ComboBoxDefaultItem, ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
15
16
  export {
16
17
  ComboBoxDataProvider,
@@ -126,13 +127,6 @@ export interface ComboBoxLightEventMap<TItem> extends HTMLElementEventMap {
126
127
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
127
128
  */
128
129
  declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
129
- /**
130
- * Name of the two-way data-bindable property representing the
131
- * value of the custom input field.
132
- * @attr {string} attr-for-value
133
- */
134
- attrForValue: string;
135
-
136
130
  addEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
137
131
  type: K,
138
132
  listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
@@ -148,6 +142,7 @@ declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
148
142
 
149
143
  interface ComboBoxLight<TItem = ComboBoxDefaultItem>
150
144
  extends ComboBoxDataProviderMixinClass<TItem>,
145
+ ComboBoxLightMixinClass,
151
146
  ComboBoxMixinClass<TItem>,
152
147
  KeyboardMixinClass,
153
148
  InputMixinClass,
@@ -1,19 +1,15 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
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 { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
10
- import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
11
9
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
10
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
- import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
14
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
- import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
16
- import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
12
+ import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
17
13
 
18
14
  /**
19
15
  * `<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing
@@ -63,12 +59,10 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
63
59
  *
64
60
  * @customElement
65
61
  * @extends HTMLElement
66
- * @mixes ComboBoxDataProviderMixin
67
- * @mixes ComboBoxMixin
62
+ * @mixes ComboBoxLightMixin
68
63
  * @mixes ThemableMixin
69
- * @mixes ValidateMixin
70
64
  */
71
- class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixin(ThemableMixin(PolymerElement)))) {
65
+ class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolymerElement)) {
72
66
  static get is() {
73
67
  return 'vaadin-combo-box-light';
74
68
  }
@@ -94,124 +88,6 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixi
94
88
  ></vaadin-combo-box-overlay>
95
89
  `;
96
90
  }
97
-
98
- static get properties() {
99
- return {
100
- /**
101
- * Name of the two-way data-bindable property representing the
102
- * value of the custom input field.
103
- * @attr {string} attr-for-value
104
- * @type {string}
105
- */
106
- attrForValue: {
107
- type: String,
108
- value: 'value',
109
- },
110
- };
111
- }
112
-
113
- /**
114
- * Used by `InputControlMixin` as a reference to the clear button element.
115
- * @protected
116
- * @return {!HTMLElement}
117
- */
118
- get clearElement() {
119
- return this.querySelector('.clear-button');
120
- }
121
-
122
- /**
123
- * Override this getter from `InputMixin` to allow using
124
- * an arbitrary property name instead of `value`
125
- * for accessing the input element's value.
126
- *
127
- * @protected
128
- * @override
129
- * @return {string}
130
- */
131
- get _inputElementValueProperty() {
132
- return dashToCamelCase(this.attrForValue);
133
- }
134
-
135
- /**
136
- * @protected
137
- * @override
138
- * @return {HTMLInputElement | undefined}
139
- */
140
- get _nativeInput() {
141
- const input = this.inputElement;
142
-
143
- if (input) {
144
- // Support `<input class="input">`
145
- if (input instanceof HTMLInputElement) {
146
- return input;
147
- }
148
-
149
- // Support `<input>` in light DOM (e.g. `vaadin-text-field`)
150
- const slottedInput = input.querySelector('input');
151
- if (slottedInput) {
152
- return slottedInput;
153
- }
154
-
155
- if (input.shadowRoot) {
156
- // Support `<input>` in Shadow DOM (e.g. `mwc-textfield`)
157
- const shadowInput = input.shadowRoot.querySelector('input');
158
- if (shadowInput) {
159
- return shadowInput;
160
- }
161
- }
162
- }
163
-
164
- return undefined;
165
- }
166
-
167
- /** @protected */
168
- ready() {
169
- super.ready();
170
-
171
- this._toggleElement = this.querySelector('.toggle-button');
172
-
173
- // Wait until the slotted input DOM is ready
174
- afterNextRender(this, () => {
175
- this._setInputElement(this.querySelector('vaadin-text-field,.input'));
176
- this._revertInputValue();
177
- });
178
- }
179
-
180
- /**
181
- * Returns true if the current input value satisfies all constraints (if any).
182
- * @return {boolean}
183
- */
184
- checkValidity() {
185
- if (this.inputElement && this.inputElement.validate) {
186
- return this.inputElement.validate();
187
- }
188
- return super.checkValidity();
189
- }
190
-
191
- /** @protected */
192
- _isClearButton(event) {
193
- return (
194
- super._isClearButton(event) ||
195
- (event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
196
- event.composedPath()[0].getAttribute('part') === 'clear-button'
197
- );
198
- }
199
-
200
- /**
201
- * @protected
202
- * @override
203
- */
204
- _shouldRemoveFocus(event) {
205
- const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
206
- const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
207
-
208
- // prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
209
- if (isBlurringControlButtons && isFocusingInputElement) {
210
- return false;
211
- }
212
-
213
- return super._shouldRemoveFocus(event);
214
- }
215
91
  }
216
92
 
217
93
  defineCustomElement(ComboBoxLight);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
@@ -542,7 +542,6 @@ export const ComboBoxMixin = (subclass) =>
542
542
  }
543
543
 
544
544
  if (opened) {
545
- this._openedWithFocusRing = this.hasAttribute('focus-ring');
546
545
  // For touch devices, we don't want to popup virtual keyboard
547
546
  // unless input element is explicitly focused by the user.
548
547
  if (!this._isInputFocused() && !isTouch) {
@@ -554,9 +553,6 @@ export const ComboBoxMixin = (subclass) =>
554
553
  this._overlayElement.restoreFocusOnClose = true;
555
554
  } else {
556
555
  this._onClosed();
557
- if (this._openedWithFocusRing && this._isInputFocused()) {
558
- this.setAttribute('focus-ring', '');
559
- }
560
556
  }
561
557
 
562
558
  const input = this._nativeInput;
@@ -772,11 +768,7 @@ export const ComboBoxMixin = (subclass) =>
772
768
  // Do not commit value when custom values are disallowed and input value is not a valid option
773
769
  // also stop propagation of the event, otherwise the user could submit a form while the input
774
770
  // still contains an invalid value
775
- const hasInvalidOption =
776
- this._focusedIndex < 0 &&
777
- this._inputElementValue !== '' &&
778
- this._getItemLabel(this.selectedItem) !== this._inputElementValue;
779
- if (!this.allowCustomValue && hasInvalidOption) {
771
+ if (!this._hasValidInputValue()) {
780
772
  // Do not submit the surrounding form.
781
773
  e.preventDefault();
782
774
  // Do not trigger global listeners
@@ -796,6 +788,18 @@ export const ComboBoxMixin = (subclass) =>
796
788
  this._closeOrCommit();
797
789
  }
798
790
 
791
+ /**
792
+ * @protected
793
+ */
794
+ _hasValidInputValue() {
795
+ const hasInvalidOption =
796
+ this._focusedIndex < 0 &&
797
+ this._inputElementValue !== '' &&
798
+ this._getItemLabel(this.selectedItem) !== this._inputElementValue;
799
+
800
+ return this.allowCustomValue || !hasInvalidOption;
801
+ }
802
+
799
803
  /**
800
804
  * Override an event listener from `KeyboardMixin`.
801
805
  * Do not call `super` in order to override clear
@@ -867,6 +871,15 @@ export const ComboBoxMixin = (subclass) =>
867
871
  this._detectAndDispatchChange();
868
872
  }
869
873
 
874
+ /**
875
+ * Clears the current filter. Should be used instead of setting the property
876
+ * directly in order to allow overriding this in multi-select combo box.
877
+ * @protected
878
+ */
879
+ _clearFilter() {
880
+ this.filter = '';
881
+ }
882
+
870
883
  /**
871
884
  * Reverts back to original value.
872
885
  */
@@ -938,7 +951,7 @@ export const ComboBoxMixin = (subclass) =>
938
951
  this.value = this._getItemValue(itemMatchingInputValue);
939
952
  } else {
940
953
  // Revert the input value
941
- this._inputElementValue = this.selectedItem ? this._getItemLabel(this.selectedItem) : this.value || '';
954
+ this._revertInputValueToValue();
942
955
  }
943
956
  }
944
957
 
@@ -946,7 +959,7 @@ export const ComboBoxMixin = (subclass) =>
946
959
 
947
960
  this._clearSelectionRange();
948
961
 
949
- this.filter = '';
962
+ this._clearFilter();
950
963
  }
951
964
 
952
965
  /**
@@ -1087,7 +1100,7 @@ export const ComboBoxMixin = (subclass) =>
1087
1100
  this.selectedItem = null;
1088
1101
  }
1089
1102
 
1090
- this.filter = '';
1103
+ this._clearFilter();
1091
1104
 
1092
1105
  // In the next _detectAndDispatchChange() call, the change detection should pass
1093
1106
  this._lastCommittedValue = undefined;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { get } from '@vaadin/component-base/src/path-utils.js';
@@ -139,6 +139,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
139
139
  elementsContainer: this,
140
140
  scrollTarget: this,
141
141
  scrollContainer: this.$.selector,
142
+ reorderElements: true,
142
143
  });
143
144
  }
144
145
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ComboBoxScrollerMixin } from './vaadin-combo-box-overlay-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2015 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2015 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
@@ -13,10 +13,8 @@ const comboBoxItem = css`
13
13
  --_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
14
14
  }
15
15
 
16
- @media (any-hover: hover) {
17
- :host([focused]:not([disabled])) {
18
- box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
19
- }
16
+ :host([focused]:not([disabled])) {
17
+ box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
20
18
  }
21
19
  `;
22
20