@vaadin/combo-box 24.4.0-dev.b3e1d14600 → 24.4.0-rc1

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.
Files changed (49) hide show
  1. package/README.md +0 -1
  2. package/package.json +16 -14
  3. package/src/lit/renderer-directives.d.ts +1 -1
  4. package/src/lit/renderer-directives.js +1 -1
  5. package/src/vaadin-combo-box-data-provider-mixin.d.ts +1 -1
  6. package/src/vaadin-combo-box-data-provider-mixin.js +118 -120
  7. package/src/vaadin-combo-box-item-mixin.d.ts +1 -1
  8. package/src/vaadin-combo-box-item-mixin.js +2 -2
  9. package/src/vaadin-combo-box-item.d.ts +1 -1
  10. package/src/vaadin-combo-box-item.js +1 -1
  11. package/src/vaadin-combo-box-light-mixin.d.ts +26 -0
  12. package/src/vaadin-combo-box-light-mixin.js +140 -0
  13. package/src/vaadin-combo-box-light.d.ts +3 -8
  14. package/src/vaadin-combo-box-light.js +4 -128
  15. package/src/vaadin-combo-box-mixin.d.ts +1 -1
  16. package/src/vaadin-combo-box-mixin.js +89 -32
  17. package/src/vaadin-combo-box-overlay-mixin.d.ts +1 -1
  18. package/src/vaadin-combo-box-overlay-mixin.js +1 -1
  19. package/src/vaadin-combo-box-overlay.d.ts +1 -1
  20. package/src/vaadin-combo-box-overlay.js +1 -1
  21. package/src/vaadin-combo-box-placeholder.js +1 -1
  22. package/src/vaadin-combo-box-scroller-mixin.d.ts +1 -1
  23. package/src/vaadin-combo-box-scroller-mixin.js +41 -16
  24. package/src/vaadin-combo-box-scroller.d.ts +1 -1
  25. package/src/vaadin-combo-box-scroller.js +1 -1
  26. package/src/vaadin-combo-box.d.ts +1 -1
  27. package/src/vaadin-combo-box.js +1 -1
  28. package/src/vaadin-lit-combo-box-item.js +50 -0
  29. package/src/vaadin-lit-combo-box-light.js +58 -0
  30. package/src/vaadin-lit-combo-box-overlay.js +76 -0
  31. package/src/vaadin-lit-combo-box-scroller.js +59 -0
  32. package/src/vaadin-lit-combo-box.js +170 -0
  33. package/theme/lumo/vaadin-combo-box-item-styles.d.ts +5 -0
  34. package/theme/lumo/vaadin-combo-box-item-styles.js +2 -4
  35. package/theme/lumo/vaadin-combo-box-light.d.ts +3 -0
  36. package/theme/lumo/vaadin-combo-box-overlay-styles.d.ts +6 -0
  37. package/theme/lumo/vaadin-combo-box-styles.d.ts +2 -0
  38. package/theme/lumo/vaadin-combo-box.d.ts +4 -0
  39. package/theme/lumo/vaadin-lit-combo-box-light.d.ts +3 -0
  40. package/theme/lumo/vaadin-lit-combo-box-light.js +3 -0
  41. package/theme/lumo/vaadin-lit-combo-box.d.ts +4 -0
  42. package/theme/lumo/vaadin-lit-combo-box.js +4 -0
  43. package/theme/material/vaadin-combo-box-item-styles.d.ts +5 -0
  44. package/theme/material/vaadin-combo-box-light.d.ts +3 -0
  45. package/theme/material/vaadin-combo-box-overlay-styles.d.ts +4 -0
  46. package/theme/material/vaadin-combo-box-styles.d.ts +3 -0
  47. package/theme/material/vaadin-combo-box.d.ts +4 -0
  48. package/web-types.json +1188 -0
  49. package/web-types.lit.json +573 -0
@@ -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';
@@ -21,6 +21,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
21
21
  */
22
22
  items: {
23
23
  type: Array,
24
+ sync: true,
24
25
  observer: '__itemsChanged',
25
26
  },
26
27
 
@@ -30,6 +31,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
30
31
  */
31
32
  focusedIndex: {
32
33
  type: Number,
34
+ sync: true,
33
35
  observer: '__focusedIndexChanged',
34
36
  },
35
37
 
@@ -38,6 +40,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
38
40
  */
39
41
  loading: {
40
42
  type: Boolean,
43
+ sync: true,
41
44
  observer: '__loadingChanged',
42
45
  },
43
46
 
@@ -47,6 +50,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
47
50
  */
48
51
  opened: {
49
52
  type: Boolean,
53
+ sync: true,
50
54
  observer: '__openedChanged',
51
55
  },
52
56
 
@@ -55,6 +59,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
55
59
  */
56
60
  selectedItem: {
57
61
  type: Object,
62
+ sync: true,
58
63
  observer: '__selectedItemChanged',
59
64
  },
60
65
 
@@ -84,6 +89,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
84
89
  */
85
90
  renderer: {
86
91
  type: Object,
92
+ sync: true,
87
93
  observer: '__rendererChanged',
88
94
  },
89
95
 
@@ -132,21 +138,21 @@ export const ComboBoxScrollerMixin = (superClass) =>
132
138
  this.addEventListener('click', (e) => e.stopPropagation());
133
139
 
134
140
  this.__patchWheelOverScrolling();
135
-
136
- this.__virtualizer = new Virtualizer({
137
- createElements: this.__createElements.bind(this),
138
- updateElement: this._updateElement.bind(this),
139
- elementsContainer: this,
140
- scrollTarget: this,
141
- scrollContainer: this.$.selector,
142
- });
143
141
  }
144
142
 
145
143
  /**
146
- * Requests an update for the virtualizer to re-render items.
144
+ * Updates the virtualizer's size and items.
147
145
  */
148
146
  requestContentUpdate() {
149
- if (this.__virtualizer) {
147
+ if (!this.__virtualizer) {
148
+ return;
149
+ }
150
+
151
+ if (this.items) {
152
+ this.__virtualizer.size = this.items.length;
153
+ }
154
+
155
+ if (this.opened) {
150
156
  this.__virtualizer.update();
151
157
  }
152
158
  }
@@ -157,7 +163,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
157
163
  * @param {number} index
158
164
  */
159
165
  scrollIntoView(index) {
160
- if (!(this.opened && index >= 0)) {
166
+ if (!this.__virtualizer || !(this.opened && index >= 0)) {
161
167
  return;
162
168
  }
163
169
 
@@ -208,11 +214,21 @@ export const ComboBoxScrollerMixin = (superClass) =>
208
214
  return item === selectedItem;
209
215
  }
210
216
 
217
+ /** @private */
218
+ __initVirtualizer() {
219
+ this.__virtualizer = new Virtualizer({
220
+ createElements: this.__createElements.bind(this),
221
+ updateElement: this._updateElement.bind(this),
222
+ elementsContainer: this,
223
+ scrollTarget: this,
224
+ scrollContainer: this.$.selector,
225
+ reorderElements: true,
226
+ });
227
+ }
228
+
211
229
  /** @private */
212
230
  __itemsChanged(items) {
213
- if (this.__virtualizer && items) {
214
- this.__virtualizer.size = items.length;
215
- this.__virtualizer.flush();
231
+ if (items && this.__virtualizer) {
216
232
  this.requestContentUpdate();
217
233
  }
218
234
  }
@@ -225,6 +241,10 @@ export const ComboBoxScrollerMixin = (superClass) =>
225
241
  /** @private */
226
242
  __openedChanged(opened) {
227
243
  if (opened) {
244
+ if (!this.__virtualizer) {
245
+ this.__initVirtualizer();
246
+ }
247
+
228
248
  this.requestContentUpdate();
229
249
  }
230
250
  }
@@ -285,6 +305,12 @@ export const ComboBoxScrollerMixin = (superClass) =>
285
305
  focused: !this.loading && focusedIndex === index,
286
306
  });
287
307
 
308
+ // NOTE: in PolylitMixin, setProperties() waits for `hasUpdated` to be set.
309
+ // However, this causes issues with virtualizer. So we enforce sync update.
310
+ if (el.performUpdate && !el.hasUpdated) {
311
+ el.performUpdate();
312
+ }
313
+
288
314
  el.id = `${this.__hostTagName}-item-${index}`;
289
315
  el.setAttribute('role', index !== undefined ? 'option' : false);
290
316
  el.setAttribute('aria-selected', selected.toString());
@@ -345,7 +371,6 @@ export const ComboBoxScrollerMixin = (superClass) =>
345
371
  new CustomEvent('index-requested', {
346
372
  detail: {
347
373
  index,
348
- currentScrollerPos: this._oldScrollerPosition,
349
374
  },
350
375
  }),
351
376
  );
@@ -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';
@@ -0,0 +1,50 @@
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 { css, html, LitElement } from 'lit';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
12
+
13
+ /**
14
+ * LitElement based version of `<vaadin-combo-box-item>` web component.
15
+ *
16
+ * ## Disclaimer
17
+ *
18
+ * This component is an experiment not intended for publishing to npm.
19
+ * There is no ETA regarding specific Vaadin version where it'll land.
20
+ * Feel free to try this code in your apps as per Apache 2.0 license.
21
+ */
22
+ export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
23
+ static get is() {
24
+ return 'vaadin-combo-box-item';
25
+ }
26
+
27
+ static get styles() {
28
+ return css`
29
+ :host {
30
+ display: block;
31
+ }
32
+
33
+ :host([hidden]) {
34
+ display: none;
35
+ }
36
+ `;
37
+ }
38
+
39
+ /** @protected */
40
+ render() {
41
+ return html`
42
+ <span part="checkmark" aria-hidden="true"></span>
43
+ <div part="content">
44
+ <slot></slot>
45
+ </div>
46
+ `;
47
+ }
48
+ }
49
+
50
+ defineCustomElement(ComboBoxItem);
@@ -0,0 +1,58 @@
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 './vaadin-lit-combo-box-item.js';
7
+ import './vaadin-lit-combo-box-overlay.js';
8
+ import './vaadin-lit-combo-box-scroller.js';
9
+ import { css, html, LitElement } from 'lit';
10
+ import { ifDefined } from 'lit/directives/if-defined.js';
11
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
12
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
15
+
16
+ /**
17
+ * LitElement based version of `<vaadin-combo-box-light>` web component.
18
+ *
19
+ * ## Disclaimer
20
+ *
21
+ * This component is an experiment not intended for publishing to npm.
22
+ * There is no ETA regarding specific Vaadin version where it'll land.
23
+ * Feel free to try this code in your apps as per Apache 2.0 license.
24
+ */
25
+ class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolylitMixin(LitElement))) {
26
+ static get is() {
27
+ return 'vaadin-combo-box-light';
28
+ }
29
+
30
+ static get styles() {
31
+ return css`
32
+ :host([opened]) {
33
+ pointer-events: auto;
34
+ }
35
+ `;
36
+ }
37
+
38
+ /** @protected */
39
+ render() {
40
+ return html`
41
+ <slot></slot>
42
+
43
+ <vaadin-combo-box-overlay
44
+ id="overlay"
45
+ .opened="${this._overlayOpened}"
46
+ ?loading="${this.loading}"
47
+ theme="${ifDefined(this._theme)}"
48
+ .positionTarget="${this.inputElement}"
49
+ .restoreFocusNode="${this.inputElement}"
50
+ no-vertical-overlap
51
+ ></vaadin-combo-box-overlay>
52
+ `;
53
+ }
54
+ }
55
+
56
+ defineCustomElement(ComboBoxLight);
57
+
58
+ export { ComboBoxLight };
@@ -0,0 +1,76 @@
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 { css, html, LitElement } from 'lit';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
11
+ import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
12
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
+ import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
14
+
15
+ const comboBoxOverlayStyles = css`
16
+ #overlay {
17
+ width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
18
+ }
19
+
20
+ [part='content'] {
21
+ display: flex;
22
+ flex-direction: column;
23
+ height: 100%;
24
+ }
25
+ `;
26
+
27
+ /**
28
+ * An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
29
+ *
30
+ * @extends HTMLElement
31
+ * @mixes ComboBoxOverlayMixin
32
+ * @mixes DirMixin
33
+ * @mixes OverlayMixin
34
+ * @mixes ThemableMixin
35
+ * @private
36
+ */
37
+ export class ComboBoxOverlay extends ComboBoxOverlayMixin(
38
+ OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
39
+ ) {
40
+ static get is() {
41
+ return 'vaadin-combo-box-overlay';
42
+ }
43
+
44
+ static get styles() {
45
+ return [overlayStyles, comboBoxOverlayStyles, comboBoxOverlayStyles];
46
+ }
47
+
48
+ static get properties() {
49
+ return {
50
+ /**
51
+ * When true, the overlay is visible and attached to body.
52
+ * This property config is overridden to set `sync: true`.
53
+ */
54
+ opened: {
55
+ type: Boolean,
56
+ notify: true,
57
+ observer: '_openedChanged',
58
+ reflectToAttribute: true,
59
+ sync: true,
60
+ },
61
+ };
62
+ }
63
+
64
+ /** @protected */
65
+ render() {
66
+ return html`
67
+ <div id="backdrop" part="backdrop" hidden></div>
68
+ <div part="overlay" id="overlay">
69
+ <div part="loader"></div>
70
+ <div part="content" id="content"><slot></slot></div>
71
+ </div>
72
+ `;
73
+ }
74
+ }
75
+
76
+ defineCustomElement(ComboBoxOverlay);
@@ -0,0 +1,59 @@
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 { css, html, LitElement } from 'lit';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
+ import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
10
+
11
+ /**
12
+ * An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
13
+ *
14
+ * @extends HTMLElement
15
+ * @mixes ComboBoxScrollerMixin
16
+ * @private
17
+ */
18
+ export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
19
+ static get is() {
20
+ return 'vaadin-combo-box-scroller';
21
+ }
22
+
23
+ static get styles() {
24
+ return css`
25
+ :host {
26
+ display: block;
27
+ min-height: 1px;
28
+ overflow: auto;
29
+
30
+ /* Fixes item background from getting on top of scrollbars on Safari */
31
+ transform: translate3d(0, 0, 0);
32
+
33
+ /* Enable momentum scrolling on iOS */
34
+ -webkit-overflow-scrolling: touch;
35
+
36
+ /* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
37
+ box-shadow: 0 0 0 white;
38
+ }
39
+
40
+ #selector {
41
+ border-width: var(--_vaadin-combo-box-items-container-border-width);
42
+ border-style: var(--_vaadin-combo-box-items-container-border-style);
43
+ border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
44
+ position: relative;
45
+ }
46
+ `;
47
+ }
48
+
49
+ /** @protected */
50
+ render() {
51
+ return html`
52
+ <div id="selector">
53
+ <slot></slot>
54
+ </div>
55
+ `;
56
+ }
57
+ }
58
+
59
+ defineCustomElement(ComboBoxScroller);
@@ -0,0 +1,170 @@
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 '@vaadin/input-container/src/vaadin-lit-input-container.js';
7
+ import './vaadin-lit-combo-box-item.js';
8
+ import './vaadin-lit-combo-box-overlay.js';
9
+ import './vaadin-lit-combo-box-scroller.js';
10
+ import { css, html, LitElement } from 'lit';
11
+ import { ifDefined } from 'lit/directives/if-defined.js';
12
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
+ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
+ import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
16
+ import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
17
+ import { InputController } from '@vaadin/field-base/src/input-controller.js';
18
+ import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
19
+ import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
20
+ import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
21
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
22
+ import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
23
+ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
24
+
25
+ /**
26
+ * LitElement based version of `<vaadin-combo-box>` web component.
27
+ *
28
+ * ## Disclaimer
29
+ *
30
+ * This component is an experiment not intended for publishing to npm.
31
+ * There is no ETA regarding specific Vaadin version where it'll land.
32
+ * Feel free to try this code in your apps as per Apache 2.0 license.
33
+ */
34
+ class ComboBox extends ComboBoxDataProviderMixin(
35
+ ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))))),
36
+ ) {
37
+ static get is() {
38
+ return 'vaadin-combo-box';
39
+ }
40
+
41
+ static get styles() {
42
+ return [
43
+ inputFieldShared,
44
+ css`
45
+ :host([opened]) {
46
+ pointer-events: auto;
47
+ }
48
+ `,
49
+ ];
50
+ }
51
+
52
+ static get properties() {
53
+ return {
54
+ /**
55
+ * @protected
56
+ */
57
+ _positionTarget: {
58
+ type: Object,
59
+ },
60
+ };
61
+ }
62
+
63
+ /**
64
+ * Used by `InputControlMixin` as a reference to the clear button element.
65
+ * @protected
66
+ * @return {!HTMLElement}
67
+ */
68
+ get clearElement() {
69
+ return this.$.clearButton;
70
+ }
71
+
72
+ /** @protected */
73
+ render() {
74
+ return html`
75
+ <div class="vaadin-combo-box-container">
76
+ <div part="label">
77
+ <slot name="label"></slot>
78
+ <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
79
+ </div>
80
+
81
+ <vaadin-input-container
82
+ part="input-field"
83
+ .readonly="${this.readonly}"
84
+ .disabled="${this.disabled}"
85
+ .invalid="${this.invalid}"
86
+ theme="${ifDefined(this._theme)}"
87
+ >
88
+ <slot name="prefix" slot="prefix"></slot>
89
+ <slot name="input"></slot>
90
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
91
+ <div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
92
+ </vaadin-input-container>
93
+
94
+ <div part="helper-text">
95
+ <slot name="helper"></slot>
96
+ </div>
97
+
98
+ <div part="error-message">
99
+ <slot name="error-message"></slot>
100
+ </div>
101
+ </div>
102
+
103
+ <vaadin-combo-box-overlay
104
+ id="overlay"
105
+ .opened="${this._overlayOpened}"
106
+ ?loading="${this.loading}"
107
+ theme="${ifDefined(this._theme)}"
108
+ .positionTarget="${this._positionTarget}"
109
+ .restoreFocusNode="${this.inputElement}"
110
+ no-vertical-overlap
111
+ ></vaadin-combo-box-overlay>
112
+
113
+ <slot name="tooltip"></slot>
114
+ `;
115
+ }
116
+
117
+ /** @protected */
118
+ ready() {
119
+ super.ready();
120
+
121
+ this.addController(
122
+ new InputController(this, (input) => {
123
+ this._setInputElement(input);
124
+ this._setFocusElement(input);
125
+ this.stateTarget = input;
126
+ this.ariaTarget = input;
127
+ }),
128
+ );
129
+ this.addController(new LabelledInputController(this.inputElement, this._labelController));
130
+
131
+ this._tooltipController = new TooltipController(this);
132
+ this.addController(this._tooltipController);
133
+ this._tooltipController.setPosition('top');
134
+ this._tooltipController.setShouldShow((target) => !target.opened);
135
+
136
+ this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
137
+ this._toggleElement = this.$.toggleButton;
138
+ }
139
+
140
+ /**
141
+ * Override the method from `InputControlMixin`
142
+ * to stop event propagation to prevent `ComboBoxMixin`
143
+ * from handling this click event also on its own.
144
+ *
145
+ * @param {Event} event
146
+ * @protected
147
+ * @override
148
+ */
149
+ _onClearButtonClick(event) {
150
+ event.stopPropagation();
151
+ super._onClearButtonClick(event);
152
+ }
153
+
154
+ /**
155
+ * @param {Event} event
156
+ * @protected
157
+ */
158
+ _onHostClick(event) {
159
+ const path = event.composedPath();
160
+
161
+ // Open dropdown only when clicking on the label or input field
162
+ if (path.includes(this._labelNode) || path.includes(this._positionTarget)) {
163
+ super._onHostClick(event);
164
+ }
165
+ }
166
+ }
167
+
168
+ defineCustomElement(ComboBox);
169
+
170
+ export { ComboBox };
@@ -0,0 +1,5 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
3
+ import '@vaadin/vaadin-lumo-styles/style.js';
4
+ declare const comboBoxItem: import("lit").CSSResult;
5
+ export { comboBoxItem };
@@ -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
 
@@ -0,0 +1,3 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import '../../src/vaadin-combo-box-light.js';
@@ -0,0 +1,6 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
3
+ import '@vaadin/vaadin-lumo-styles/style.js';
4
+ declare const comboBoxOverlay: import("lit").CSSResult;
5
+ declare const comboBoxLoader: import("lit").CSSResult;
6
+ export { comboBoxLoader, comboBoxOverlay };
@@ -0,0 +1,2 @@
1
+ import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
2
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
@@ -0,0 +1,4 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import './vaadin-combo-box-styles.js';
4
+ import '../../src/vaadin-combo-box.js';
@@ -0,0 +1,3 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import '../../src/vaadin-lit-combo-box-light.js';
@@ -0,0 +1,3 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import '../../src/vaadin-lit-combo-box-light.js';
@@ -0,0 +1,4 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import './vaadin-combo-box-styles.js';
4
+ import '../../src/vaadin-lit-combo-box.js';
@@ -0,0 +1,4 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import './vaadin-combo-box-styles.js';
4
+ import '../../src/vaadin-lit-combo-box.js';
@@ -0,0 +1,5 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/font-icons.js';
3
+ import '@vaadin/vaadin-material-styles/typography.js';
4
+ declare const comboBoxItem: import("lit").CSSResult;
5
+ export { comboBoxItem };
@@ -0,0 +1,3 @@
1
+ import './vaadin-combo-box-item-styles.js';
2
+ import './vaadin-combo-box-overlay-styles.js';
3
+ import '../../src/vaadin-combo-box-light.js';