@vaadin/combo-box 25.0.0-alpha1 → 25.0.0-alpha11

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 (30) hide show
  1. package/package.json +14 -15
  2. package/src/styles/vaadin-combo-box-base-styles.d.ts +8 -0
  3. package/src/styles/vaadin-combo-box-base-styles.js +17 -0
  4. package/src/styles/vaadin-combo-box-overlay-base-styles.js +46 -0
  5. package/src/styles/vaadin-combo-box-scroller-base-styles.js +29 -0
  6. package/src/vaadin-combo-box-base-mixin.d.ts +56 -0
  7. package/src/vaadin-combo-box-base-mixin.js +776 -0
  8. package/src/vaadin-combo-box-data-provider-mixin.js +17 -32
  9. package/src/vaadin-combo-box-item-mixin.js +6 -1
  10. package/src/vaadin-combo-box-item.js +7 -11
  11. package/src/vaadin-combo-box-items-mixin.d.ts +53 -0
  12. package/src/vaadin-combo-box-items-mixin.js +275 -0
  13. package/src/vaadin-combo-box-mixin.d.ts +3 -72
  14. package/src/vaadin-combo-box-mixin.js +84 -898
  15. package/src/vaadin-combo-box-overlay-mixin.js +1 -22
  16. package/src/vaadin-combo-box-overlay.js +5 -16
  17. package/src/vaadin-combo-box-scroller.js +3 -24
  18. package/src/vaadin-combo-box.d.ts +10 -8
  19. package/src/vaadin-combo-box.js +44 -19
  20. package/vaadin-combo-box.js +1 -1
  21. package/web-types.json +51 -51
  22. package/web-types.lit.json +17 -17
  23. package/theme/lumo/vaadin-combo-box-item-styles.d.ts +0 -5
  24. package/theme/lumo/vaadin-combo-box-item-styles.js +0 -25
  25. package/theme/lumo/vaadin-combo-box-overlay-styles.d.ts +0 -6
  26. package/theme/lumo/vaadin-combo-box-overlay-styles.js +0 -60
  27. package/theme/lumo/vaadin-combo-box-styles.d.ts +0 -2
  28. package/theme/lumo/vaadin-combo-box-styles.js +0 -12
  29. package/theme/lumo/vaadin-combo-box.d.ts +0 -4
  30. package/theme/lumo/vaadin-combo-box.js +0 -4
@@ -22,18 +22,6 @@ export const ComboBoxOverlayMixin = (superClass) =>
22
22
  this.requiredVerticalSpace = 200;
23
23
  }
24
24
 
25
- /** @protected */
26
- connectedCallback() {
27
- super.connectedCallback();
28
-
29
- const comboBox = this._comboBox;
30
-
31
- const hostDir = comboBox && comboBox.getAttribute('dir');
32
- if (hostDir) {
33
- this.setAttribute('dir', hostDir);
34
- }
35
- }
36
-
37
25
  /**
38
26
  * Override method inherited from `Overlay`
39
27
  * to not close on position target click.
@@ -63,16 +51,7 @@ export const ComboBoxOverlayMixin = (superClass) =>
63
51
 
64
52
  /** @protected */
65
53
  _updateOverlayWidth() {
66
- const propPrefix = this.localName;
67
- this.style.setProperty(`--_${propPrefix}-default-width`, `${this.positionTarget.offsetWidth}px`);
68
-
69
- const customWidth = getComputedStyle(this._comboBox).getPropertyValue(`--${propPrefix}-width`);
70
-
71
- if (customWidth === '') {
72
- this.style.removeProperty(`--${propPrefix}-width`);
73
- } else {
74
- this.style.setProperty(`--${propPrefix}-width`, customWidth);
75
- }
54
+ this.style.setProperty(`--_${this.localName}-default-width`, `${this.positionTarget.offsetWidth}px`);
76
55
  }
77
56
 
78
57
  /** @private */
@@ -3,27 +3,17 @@
3
3
  * Copyright (c) 2015 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
10
11
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
11
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
12
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
12
13
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { comboBoxOverlayStyles } from './styles/vaadin-combo-box-overlay-base-styles.js';
13
15
  import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
14
16
 
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
17
  /**
28
18
  * An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
29
19
  *
@@ -36,7 +26,7 @@ const comboBoxOverlayStyles = css`
36
26
  * @private
37
27
  */
38
28
  export class ComboBoxOverlay extends ComboBoxOverlayMixin(
39
- OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
29
+ OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
40
30
  ) {
41
31
  static get is() {
42
32
  return 'vaadin-combo-box-overlay';
@@ -49,7 +39,6 @@ export class ComboBoxOverlay extends ComboBoxOverlayMixin(
49
39
  /** @protected */
50
40
  render() {
51
41
  return html`
52
- <div id="backdrop" part="backdrop" hidden></div>
53
42
  <div part="overlay" id="overlay">
54
43
  <div part="loader"></div>
55
44
  <div part="content" id="content"><slot></slot></div>
@@ -3,9 +3,10 @@
3
3
  * Copyright (c) 2015 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
+ import { comboBoxScrollerStyles } from './styles/vaadin-combo-box-scroller-base-styles.js';
9
10
  import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
10
11
 
11
12
  /**
@@ -22,29 +23,7 @@ export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElem
22
23
  }
23
24
 
24
25
  static get styles() {
25
- return css`
26
- :host {
27
- display: block;
28
- min-height: 1px;
29
- overflow: auto;
30
-
31
- /* Fixes item background from getting on top of scrollbars on Safari */
32
- transform: translate3d(0, 0, 0);
33
-
34
- /* Enable momentum scrolling on iOS */
35
- -webkit-overflow-scrolling: touch;
36
-
37
- /* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
38
- box-shadow: 0 0 0 white;
39
- }
40
-
41
- #selector {
42
- border-width: var(--_vaadin-combo-box-items-container-border-width);
43
- border-style: var(--_vaadin-combo-box-items-container-border-style);
44
- border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
45
- position: relative;
46
- }
47
- `;
26
+ return comboBoxScrollerStyles;
48
27
  }
49
28
 
50
29
  /** @protected */
@@ -20,7 +20,9 @@ import type { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js'
20
20
  import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
21
21
  import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
22
22
  import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
23
+ import type { ComboBoxBaseMixinClass } from './vaadin-combo-box-base-mixin.js';
23
24
  import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
25
+ import type { ComboBoxItemsMixinClass } from './vaadin-combo-box-items-mixin.js';
24
26
  import type { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
25
27
  import type { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
26
28
 
@@ -179,9 +181,12 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
179
181
  *
180
182
  * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
181
183
  *
182
- * Part name | Description
183
- * ----------------|----------------
184
- * `toggle-button` | The toggle button
184
+ * Part name | Description
185
+ * -----------------|------------------
186
+ * `toggle-button` | The toggle button
187
+ * `overlay` | The overlay container
188
+ * `content` | The overlay content
189
+ * `loader` | The loading indicator shown while loading items
185
190
  *
186
191
  * In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
187
192
  *
@@ -195,12 +200,7 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
195
200
  * In addition to `<vaadin-combo-box>` itself, the following internal
196
201
  * components are themable:
197
202
  *
198
- * - `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
199
203
  * - `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
200
- * - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
201
- *
202
- * Note: the `theme` attribute value set on `<vaadin-combo-box>` is
203
- * propagated to the internal components listed above.
204
204
  *
205
205
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
206
206
  *
@@ -229,7 +229,9 @@ declare class ComboBox<TItem = ComboBoxDefaultItem> extends HTMLElement {
229
229
 
230
230
  interface ComboBox<TItem = ComboBoxDefaultItem>
231
231
  extends ComboBoxDataProviderMixinClass<TItem>,
232
+ ComboBoxItemsMixinClass<TItem>,
232
233
  ComboBoxMixinClass<TItem>,
234
+ ComboBoxBaseMixinClass,
233
235
  ValidateMixinClass,
234
236
  PatternMixinClass,
235
237
  LabelMixinClass,
@@ -7,7 +7,7 @@ import '@vaadin/input-container/src/vaadin-input-container.js';
7
7
  import './vaadin-combo-box-item.js';
8
8
  import './vaadin-combo-box-overlay.js';
9
9
  import './vaadin-combo-box-scroller.js';
10
- import { css, html, LitElement } from 'lit';
10
+ import { html, LitElement } from 'lit';
11
11
  import { ifDefined } from 'lit/directives/if-defined.js';
12
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
@@ -18,7 +18,9 @@ import { InputController } from '@vaadin/field-base/src/input-controller.js';
18
18
  import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
19
19
  import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
20
20
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
21
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
21
22
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
23
+ import { comboBoxStyles } from './styles/vaadin-combo-box-base-styles.js';
22
24
  import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
23
25
  import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
24
26
 
@@ -110,9 +112,12 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
110
112
  *
111
113
  * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
112
114
  *
113
- * Part name | Description
114
- * ----------------|----------------
115
- * `toggle-button` | The toggle button
115
+ * Part name | Description
116
+ * -----------------|------------------
117
+ * `toggle-button` | The toggle button
118
+ * `overlay` | The overlay container
119
+ * `content` | The overlay content
120
+ * `loader` | The loading indicator shown while loading items
116
121
  *
117
122
  * In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
118
123
  *
@@ -126,12 +131,7 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
126
131
  * In addition to `<vaadin-combo-box>` itself, the following internal
127
132
  * components are themable:
128
133
  *
129
- * - `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
130
134
  * - `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
131
- * - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
132
- *
133
- * Note: the `theme` attribute value set on `<vaadin-combo-box>` is
134
- * propagated to the internal components listed above.
135
135
  *
136
136
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
137
137
  *
@@ -154,21 +154,16 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
154
154
  * @mixes ComboBoxMixin
155
155
  */
156
156
  class ComboBox extends ComboBoxDataProviderMixin(
157
- ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))))),
157
+ ComboBoxMixin(
158
+ PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement)))))),
159
+ ),
158
160
  ) {
159
161
  static get is() {
160
162
  return 'vaadin-combo-box';
161
163
  }
162
164
 
163
165
  static get styles() {
164
- return [
165
- inputFieldShared,
166
- css`
167
- :host([opened]) {
168
- pointer-events: auto;
169
- }
170
- `,
171
- ];
166
+ return [inputFieldShared, comboBoxStyles];
172
167
  }
173
168
 
174
169
  static get properties() {
@@ -224,12 +219,17 @@ class ComboBox extends ComboBoxDataProviderMixin(
224
219
 
225
220
  <vaadin-combo-box-overlay
226
221
  id="overlay"
222
+ exportparts="overlay, content, loader"
223
+ .owner="${this}"
224
+ .dir="${this.dir}"
227
225
  .opened="${this._overlayOpened}"
228
226
  ?loading="${this.loading}"
229
227
  theme="${ifDefined(this._theme)}"
230
228
  .positionTarget="${this._positionTarget}"
231
229
  no-vertical-overlap
232
- ></vaadin-combo-box-overlay>
230
+ >
231
+ <slot name="overlay"></slot>
232
+ </vaadin-combo-box-overlay>
233
233
 
234
234
  <slot name="tooltip"></slot>
235
235
  `;
@@ -259,6 +259,15 @@ class ComboBox extends ComboBoxDataProviderMixin(
259
259
  this._toggleElement = this.$.toggleButton;
260
260
  }
261
261
 
262
+ /** @protected */
263
+ updated(props) {
264
+ super.updated(props);
265
+
266
+ if (props.has('dataProvider') || props.has('value')) {
267
+ this._warnDataProviderValue(this.dataProvider, this.value);
268
+ }
269
+ }
270
+
262
271
  /**
263
272
  * Override the method from `InputControlMixin`
264
273
  * to stop event propagation to prevent `ComboBoxMixin`
@@ -285,6 +294,22 @@ class ComboBox extends ComboBoxDataProviderMixin(
285
294
  super._onHostClick(event);
286
295
  }
287
296
  }
297
+
298
+ /** @private */
299
+ _warnDataProviderValue(dataProvider, value) {
300
+ if (dataProvider && value !== '' && (this.selectedItem === undefined || this.selectedItem === null)) {
301
+ const valueIndex = this.__getItemIndexByValue(this.filteredItems, value);
302
+ if (valueIndex < 0 || !this._getItemLabel(this.filteredItems[valueIndex])) {
303
+ console.warn(
304
+ 'Warning: unable to determine the label for the provided `value`. ' +
305
+ 'Nothing to display in the text field. This usually happens when ' +
306
+ 'setting an initial `value` before any items are returned from ' +
307
+ 'the `dataProvider` callback. Consider setting `selectedItem` ' +
308
+ 'instead of `value`',
309
+ );
310
+ }
311
+ }
312
+ }
288
313
  }
289
314
 
290
315
  defineCustomElement(ComboBox);
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-combo-box.js';
1
+ import './src/vaadin-combo-box.js';
2
2
  export * from './src/vaadin-combo-box.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-combo-box",
11
- "description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-combo-box#property-items) property on the element.\n\n```html\n<vaadin-combo-box id=\"combo-box\"></vaadin-combo-box>\n```\n```js\ndocument.querySelector('#combo-box').items = ['apple', 'orange', 'banana'];\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Item rendering\n\nTo customize the content of the `<vaadin-combo-box-item>` elements placed in the dropdown, use\n[`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-combo-box#property-renderer) property which accepts a function.\nThe renderer function is called with `root`, `comboBox`, and `model` as arguments.\n\nGenerate DOM content by using `model` object properties if needed, and append it to the `root`\nelement. The `comboBox` reference is provided to access the combo-box element state. Do not\nset combo-box properties in a `renderer` function.\n\n```js\nconst comboBox = document.querySelector('#combo-box');\ncomboBox.items = [{'label': 'Hydrogen', 'value': 'H'}];\ncomboBox.renderer = (root, comboBox, model) => {\n const item = model.item;\n root.innerHTML = `${model.index}: ${item.label} <b>${item.value}</b>`;\n};\n```\n\nRenderer is called on the opening of the combo-box and each time the related model is updated.\nBefore creating new content, it is recommended to check if there is already an existing DOM\nelement in `root` from a previous renderer call for reusing it. Even though combo-box uses\ninfinite scrolling, reducing DOM operations might improve performance.\n\nThe following properties are available in the `model` argument:\n\nProperty | Type | Description\n-----------|------------------|-------------\n`index` | Number | Index of the item in the `items` array\n`item` | String or Object | The item reference\n`selected` | Boolean | True when item is selected\n`focused` | Boolean | True when item is focused\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively use the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```js\ncomboBox.dataProvider = async (params, callback) => {\n const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';\n const { filter, page, pageSize } = params;\n const index = page * pageSize;\n\n const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);\n if (res.ok) {\n const { result, size } = await res.json();\n callback(result, size);\n }\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-combo-box>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-combo-box#property-items) property on the element.\n\n```html\n<vaadin-combo-box id=\"combo-box\"></vaadin-combo-box>\n```\n```js\ndocument.querySelector('#combo-box').items = ['apple', 'orange', 'banana'];\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Item rendering\n\nTo customize the content of the `<vaadin-combo-box-item>` elements placed in the dropdown, use\n[`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-combo-box#property-renderer) property which accepts a function.\nThe renderer function is called with `root`, `comboBox`, and `model` as arguments.\n\nGenerate DOM content by using `model` object properties if needed, and append it to the `root`\nelement. The `comboBox` reference is provided to access the combo-box element state. Do not\nset combo-box properties in a `renderer` function.\n\n```js\nconst comboBox = document.querySelector('#combo-box');\ncomboBox.items = [{'label': 'Hydrogen', 'value': 'H'}];\ncomboBox.renderer = (root, comboBox, model) => {\n const item = model.item;\n root.innerHTML = `${model.index}: ${item.label} <b>${item.value}</b>`;\n};\n```\n\nRenderer is called on the opening of the combo-box and each time the related model is updated.\nBefore creating new content, it is recommended to check if there is already an existing DOM\nelement in `root` from a previous renderer call for reusing it. Even though combo-box uses\ninfinite scrolling, reducing DOM operations might improve performance.\n\nThe following properties are available in the `model` argument:\n\nProperty | Type | Description\n-----------|------------------|-------------\n`index` | Number | Index of the item in the `items` array\n`item` | String or Object | The item reference\n`selected` | Boolean | True when item is selected\n`focused` | Boolean | True when item is focused\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively use the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```js\ncomboBox.dataProvider = async (params, callback) => {\n const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';\n const { filter, page, pageSize } = params;\n const index = page * pageSize;\n\n const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);\n if (res.ok) {\n const { result, size } = await res.json();\n callback(result, size);\n }\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n-----------------|------------------\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n`loader` | The loading indicator shown while loading items\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -268,26 +268,26 @@
268
268
  }
269
269
  },
270
270
  {
271
- "name": "allow-custom-value",
272
- "description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
271
+ "name": "filter",
272
+ "description": "Filtering string the user has typed into the input field.",
273
273
  "value": {
274
274
  "type": [
275
- "boolean"
275
+ "string"
276
276
  ]
277
277
  }
278
278
  },
279
279
  {
280
- "name": "loading",
281
- "description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
280
+ "name": "item-label-path",
281
+ "description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
282
282
  "value": {
283
283
  "type": [
284
- "boolean"
284
+ "string"
285
285
  ]
286
286
  }
287
287
  },
288
288
  {
289
- "name": "filter",
290
- "description": "Filtering string the user has typed into the input field.",
289
+ "name": "item-value-path",
290
+ "description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
291
291
  "value": {
292
292
  "type": [
293
293
  "string"
@@ -295,20 +295,20 @@
295
295
  }
296
296
  },
297
297
  {
298
- "name": "item-label-path",
299
- "description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
298
+ "name": "allow-custom-value",
299
+ "description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
300
300
  "value": {
301
301
  "type": [
302
- "string"
302
+ "boolean"
303
303
  ]
304
304
  }
305
305
  },
306
306
  {
307
- "name": "item-value-path",
308
- "description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
307
+ "name": "loading",
308
+ "description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
309
309
  "value": {
310
310
  "type": [
311
- "string"
311
+ "boolean"
312
312
  ]
313
313
  }
314
314
  },
@@ -605,18 +605,19 @@
605
605
  }
606
606
  },
607
607
  {
608
- "name": "renderer",
609
- "description": "Custom function for rendering the content of every item.\nReceives three arguments:\n\n- `root` The `<vaadin-combo-box-item>` internal container DOM element.\n- `comboBox` The reference to the `<vaadin-combo-box>` element.\n- `model` The object with the properties related with the rendered\n item, contains:\n - `model.index` The index of the rendered item.\n - `model.item` The item.",
608
+ "name": "items",
609
+ "description": "A full set of items to filter the visible options from.\nThe items can be of either `String` or `Object` type.",
610
610
  "value": {
611
611
  "type": [
612
- "ComboBoxRenderer",
612
+ "Array.<ComboBoxItem",
613
+ "string>",
613
614
  "undefined"
614
615
  ]
615
616
  }
616
617
  },
617
618
  {
618
- "name": "items",
619
- "description": "A full set of items to filter the visible options from.\nThe items can be of either `String` or `Object` type.",
619
+ "name": "filteredItems",
620
+ "description": "A subset of items, filtered based on the user input. Filtered items\ncan be assigned directly to omit the internal filtering functionality.\nThe items can be of either `String` or `Object` type.",
620
621
  "value": {
621
622
  "type": [
622
623
  "Array.<ComboBoxItem",
@@ -626,80 +627,79 @@
626
627
  }
627
628
  },
628
629
  {
629
- "name": "allowCustomValue",
630
- "description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
630
+ "name": "filter",
631
+ "description": "Filtering string the user has typed into the input field.",
631
632
  "value": {
632
633
  "type": [
633
- "boolean"
634
+ "string"
634
635
  ]
635
636
  }
636
637
  },
637
638
  {
638
- "name": "filteredItems",
639
- "description": "A subset of items, filtered based on the user input. Filtered items\ncan be assigned directly to omit the internal filtering functionality.\nThe items can be of either `String` or `Object` type.",
639
+ "name": "itemLabelPath",
640
+ "description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
640
641
  "value": {
641
642
  "type": [
642
- "Array.<ComboBoxItem",
643
- "string>",
644
- "undefined"
643
+ "string"
645
644
  ]
646
645
  }
647
646
  },
648
647
  {
649
- "name": "loading",
650
- "description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
648
+ "name": "itemValuePath",
649
+ "description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
651
650
  "value": {
652
651
  "type": [
653
- "boolean"
652
+ "string"
654
653
  ]
655
654
  }
656
655
  },
657
656
  {
658
- "name": "filter",
659
- "description": "Filtering string the user has typed into the input field.",
657
+ "name": "renderer",
658
+ "description": "Custom function for rendering the content of every item.\nReceives three arguments:\n\n- `root` The `<vaadin-combo-box-item>` internal container DOM element.\n- `comboBox` The reference to the `<vaadin-combo-box>` element.\n- `model` The object with the properties related with the rendered\n item, contains:\n - `model.index` The index of the rendered item.\n - `model.item` The item.",
660
659
  "value": {
661
660
  "type": [
662
- "string"
661
+ "ComboBoxRenderer",
662
+ "undefined"
663
663
  ]
664
664
  }
665
665
  },
666
666
  {
667
- "name": "selectedItem",
668
- "description": "The selected item from the `items` array.",
667
+ "name": "allowCustomValue",
668
+ "description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
669
669
  "value": {
670
670
  "type": [
671
- "ComboBoxItem",
672
- "string",
673
- "undefined"
671
+ "boolean"
674
672
  ]
675
673
  }
676
674
  },
677
675
  {
678
- "name": "itemClassNameGenerator",
679
- "description": "A function used to generate CSS class names for dropdown\nitems based on the item. The return value should be the\ngenerated class name as a string, or multiple class names\nseparated by whitespace characters.",
676
+ "name": "loading",
677
+ "description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
680
678
  "value": {
681
679
  "type": [
682
- "Object",
683
- "null",
684
- "undefined"
680
+ "boolean"
685
681
  ]
686
682
  }
687
683
  },
688
684
  {
689
- "name": "itemLabelPath",
690
- "description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
685
+ "name": "selectedItem",
686
+ "description": "The selected item from the `items` array.",
691
687
  "value": {
692
688
  "type": [
693
- "string"
689
+ "ComboBoxItem",
690
+ "string",
691
+ "undefined"
694
692
  ]
695
693
  }
696
694
  },
697
695
  {
698
- "name": "itemValuePath",
699
- "description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
696
+ "name": "itemClassNameGenerator",
697
+ "description": "A function used to generate CSS class names for dropdown\nitems based on the item. The return value should be the\ngenerated class name as a string, or multiple class names\nseparated by whitespace characters.",
700
698
  "value": {
701
699
  "type": [
702
- "string"
700
+ "Object",
701
+ "null",
702
+ "undefined"
703
703
  ]
704
704
  }
705
705
  },