@vaadin/combo-box 24.5.0-alpha1 → 24.5.0-alpha10

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
@@ -64,7 +64,7 @@ import '@vaadin/combo-box/src/vaadin-combo-box.js';
64
64
 
65
65
  ## Contributing
66
66
 
67
- Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
67
+ Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
68
68
 
69
69
  ## License
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "24.5.0-alpha1",
3
+ "version": "24.5.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,27 +40,27 @@
40
40
  "dependencies": {
41
41
  "@open-wc/dedupe-mixin": "^1.3.0",
42
42
  "@polymer/polymer": "^3.0.0",
43
- "@vaadin/a11y-base": "24.5.0-alpha1",
44
- "@vaadin/component-base": "24.5.0-alpha1",
45
- "@vaadin/field-base": "24.5.0-alpha1",
46
- "@vaadin/input-container": "24.5.0-alpha1",
47
- "@vaadin/item": "24.5.0-alpha1",
48
- "@vaadin/lit-renderer": "24.5.0-alpha1",
49
- "@vaadin/overlay": "24.5.0-alpha1",
50
- "@vaadin/vaadin-lumo-styles": "24.5.0-alpha1",
51
- "@vaadin/vaadin-material-styles": "24.5.0-alpha1",
52
- "@vaadin/vaadin-themable-mixin": "24.5.0-alpha1"
43
+ "@vaadin/a11y-base": "24.5.0-alpha10",
44
+ "@vaadin/component-base": "24.5.0-alpha10",
45
+ "@vaadin/field-base": "24.5.0-alpha10",
46
+ "@vaadin/input-container": "24.5.0-alpha10",
47
+ "@vaadin/item": "24.5.0-alpha10",
48
+ "@vaadin/lit-renderer": "24.5.0-alpha10",
49
+ "@vaadin/overlay": "24.5.0-alpha10",
50
+ "@vaadin/vaadin-lumo-styles": "24.5.0-alpha10",
51
+ "@vaadin/vaadin-material-styles": "24.5.0-alpha10",
52
+ "@vaadin/vaadin-themable-mixin": "24.5.0-alpha10"
53
53
  },
54
54
  "devDependencies": {
55
- "@esm-bundle/chai": "^4.3.4",
56
- "@vaadin/testing-helpers": "^0.6.0",
57
- "@vaadin/text-field": "24.5.0-alpha1",
55
+ "@vaadin/chai-plugins": "24.5.0-alpha10",
56
+ "@vaadin/testing-helpers": "^1.0.0",
57
+ "@vaadin/text-field": "24.5.0-alpha10",
58
58
  "lit": "^3.0.0",
59
- "sinon": "^13.0.2"
59
+ "sinon": "^18.0.0"
60
60
  },
61
61
  "web-types": [
62
62
  "web-types.json",
63
63
  "web-types.lit.json"
64
64
  ],
65
- "gitHead": "57806caac5468532a3b4e3dbdda730cd0fca193a"
65
+ "gitHead": "6f9c37308031af872a98017bfab4de89aeacda51"
66
66
  }
@@ -3,6 +3,7 @@
3
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
+ import { DataProviderController } from '@vaadin/component-base/src/data-provider-controller/data-provider-controller.js';
6
7
  import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
7
8
 
8
9
  /**
@@ -55,15 +56,9 @@ export const ComboBoxDataProviderMixin = (superClass) =>
55
56
  },
56
57
 
57
58
  /** @private */
58
- _pendingRequests: {
59
- value: () => {
60
- return {};
61
- },
62
- },
63
-
64
- /** @private */
65
- __placeHolder: {
66
- value: new ComboBoxPlaceholder(),
59
+ __dataProviderInitialized: {
60
+ type: Boolean,
61
+ value: false,
67
62
  },
68
63
 
69
64
  /** @private */
@@ -81,6 +76,23 @@ export const ComboBoxDataProviderMixin = (superClass) =>
81
76
  ];
82
77
  }
83
78
 
79
+ constructor() {
80
+ super();
81
+
82
+ /**
83
+ * @type {DataProviderController}
84
+ * @private
85
+ */
86
+ this.__dataProviderController = new DataProviderController(this, {
87
+ placeholder: new ComboBoxPlaceholder(),
88
+ isPlaceholder: (item) => item instanceof ComboBoxPlaceholder,
89
+ dataProviderParams: () => ({ filter: this.filter }),
90
+ });
91
+
92
+ this.__dataProviderController.addEventListener('page-requested', this.__onDataProviderPageRequested.bind(this));
93
+ this.__dataProviderController.addEventListener('page-loaded', this.__onDataProviderPageLoaded.bind(this));
94
+ }
95
+
84
96
  /** @protected */
85
97
  ready() {
86
98
  super.ready();
@@ -91,12 +103,15 @@ export const ComboBoxDataProviderMixin = (superClass) =>
91
103
 
92
104
  const index = e.detail.index;
93
105
  if (index !== undefined) {
94
- const page = this._getPageForIndex(index);
95
- if (this._shouldLoadPage(page)) {
96
- this._loadPage(page);
97
- }
106
+ this.__dataProviderController.ensureFlatIndexLoaded(index);
98
107
  }
99
108
  });
109
+
110
+ this.__dataProviderInitialized = true;
111
+
112
+ if (this.dataProvider) {
113
+ this.requestContentUpdate();
114
+ }
100
115
  }
101
116
 
102
117
  /** @private */
@@ -110,7 +125,6 @@ export const ComboBoxDataProviderMixin = (superClass) =>
110
125
  this.__previousDataProviderFilter = filter;
111
126
 
112
127
  this.__keepOverlayOpened = true;
113
- this._pendingRequests = {};
114
128
  this.size = undefined;
115
129
  this.clearCache();
116
130
  this.__keepOverlayOpened = false;
@@ -128,78 +142,35 @@ export const ComboBoxDataProviderMixin = (superClass) =>
128
142
 
129
143
  /** @private */
130
144
  _ensureFirstPage(opened) {
131
- if (!this._shouldFetchData()) {
145
+ if (!this._shouldFetchData() || !opened) {
132
146
  return;
133
147
  }
134
148
 
135
- if (opened && this._shouldLoadPage(0)) {
136
- this._loadPage(0);
137
- }
138
- }
139
-
140
- /** @private */
141
- _shouldLoadPage(page) {
142
- if (this._forceNextRequest) {
149
+ if (this._forceNextRequest || this.size === undefined) {
143
150
  this._forceNextRequest = false;
144
- return true;
145
- }
146
-
147
- const loadedItem = this.filteredItems[page * this.pageSize];
148
- if (loadedItem !== undefined) {
149
- return loadedItem instanceof ComboBoxPlaceholder;
151
+ this.__dataProviderController.loadFirstPage();
152
+ } else if (this.size > 0) {
153
+ this.__dataProviderController.ensureFlatIndexLoaded(0);
150
154
  }
151
- return this.size === undefined;
152
155
  }
153
156
 
154
157
  /** @private */
155
- _loadPage(page) {
156
- // Make sure same page isn't requested multiple times.
157
- if (this._pendingRequests[page] || !this.dataProvider) {
158
- return;
159
- }
160
-
161
- const params = {
162
- page,
163
- pageSize: this.pageSize,
164
- filter: this.filter,
165
- };
166
-
167
- const callback = (items, size) => {
168
- if (this._pendingRequests[page] !== callback) {
169
- return;
170
- }
171
-
172
- const filteredItems = this.filteredItems ? [...this.filteredItems] : [];
173
- filteredItems.splice(params.page * params.pageSize, items.length, ...items);
174
- this.filteredItems = filteredItems;
175
-
176
- if (!this.opened && !this._isInputFocused()) {
177
- this._commitValue();
178
- }
179
-
180
- if (size !== undefined) {
181
- this.size = size;
182
- }
183
-
184
- delete this._pendingRequests[page];
185
-
186
- if (Object.keys(this._pendingRequests).length === 0) {
187
- this.loading = false;
188
- }
189
- };
190
-
191
- this._pendingRequests[page] = callback;
192
- // Set the `loading` flag only after marking the request as pending
193
- // to prevent the same page from getting requested multiple times
194
- // as a result of `__loadingChanged` in the scroller which requests
195
- // a virtualizer update which in turn may trigger a data provider page request.
158
+ __onDataProviderPageRequested() {
196
159
  this.loading = true;
197
- this.dataProvider(params, callback);
198
160
  }
199
161
 
200
162
  /** @private */
201
- _getPageForIndex(index) {
202
- return Math.floor(index / this.pageSize);
163
+ __onDataProviderPageLoaded() {
164
+ // The controller adds new items to the cache through mutation,
165
+ // so we need to create a new array to trigger filteredItems observers.
166
+ const { rootCache } = this.__dataProviderController;
167
+ rootCache.items = [...rootCache.items];
168
+
169
+ this.requestContentUpdate();
170
+
171
+ if (!this.opened && !this._isInputFocused()) {
172
+ this._commitValue();
173
+ }
203
174
  }
204
175
 
205
176
  /**
@@ -210,32 +181,75 @@ export const ComboBoxDataProviderMixin = (superClass) =>
210
181
  return;
211
182
  }
212
183
 
213
- this._pendingRequests = {};
214
- const filteredItems = [];
215
- for (let i = 0; i < (this.size || 0); i++) {
216
- filteredItems.push(this.__placeHolder);
217
- }
218
- this.filteredItems = filteredItems;
184
+ this.__dataProviderController.clearCache();
185
+
186
+ this.requestContentUpdate();
219
187
 
220
188
  if (this._shouldFetchData()) {
221
189
  this._forceNextRequest = false;
222
- this._loadPage(0);
190
+ this.__dataProviderController.loadFirstPage();
223
191
  } else {
224
192
  this._forceNextRequest = true;
225
193
  }
226
194
  }
227
195
 
228
- /** @private */
229
- _sizeChanged(size = 0) {
230
- const filteredItems = (this.filteredItems || []).slice(0, size);
231
- for (let i = 0; i < size; i++) {
232
- filteredItems[i] = filteredItems[i] !== undefined ? filteredItems[i] : this.__placeHolder;
196
+ /**
197
+ * When the size change originates externally, synchronizes the new size with
198
+ * the controller and request a content update to re-render the scroller.
199
+ *
200
+ * @private
201
+ */
202
+ _sizeChanged(size) {
203
+ const { rootCache } = this.__dataProviderController;
204
+ if (rootCache.size !== size) {
205
+ rootCache.size = size;
206
+ // The controller adds new placeholders to the cache through mutation,
207
+ // so we need to create a new array to trigger filteredItems observers.
208
+ rootCache.items = [...rootCache.items];
209
+ this.requestContentUpdate();
210
+ }
211
+ }
212
+
213
+ /**
214
+ * When the items change originates externally, synchronizes the new items with
215
+ * the controller and requests a content update to re-render the scroller.
216
+ *
217
+ * @private
218
+ * @override
219
+ */
220
+ _filteredItemsChanged(items) {
221
+ super._filteredItemsChanged(items);
222
+
223
+ if (this.dataProvider && items) {
224
+ const { rootCache } = this.__dataProviderController;
225
+ if (rootCache.items !== items) {
226
+ rootCache.items = items;
227
+ this.requestContentUpdate();
228
+ }
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Synchronizes the controller's state with the component, which can be
234
+ * out of sync after the controller receives new data from the data provider
235
+ * or if the state in the controller is directly manupulated.
236
+ *
237
+ * @override
238
+ */
239
+ requestContentUpdate() {
240
+ // When the data provider isn't initialized, it means the content update was requested
241
+ // by an observer before the `ready()` callback. In such cases, some properties
242
+ // in the data provider controller might still be uninitialized, so it's not safe
243
+ // to use them to update the component's properties yet. Another content update
244
+ // will be requested in the `ready()` callback.
245
+ if (this.__dataProviderInitialized && this.dataProvider) {
246
+ const { rootCache } = this.__dataProviderController;
247
+ this.size = rootCache.size;
248
+ this.filteredItems = rootCache.items;
249
+ this.loading = this.__dataProviderController.isLoading();
233
250
  }
234
- this.filteredItems = filteredItems;
235
251
 
236
- // Cleans up the redundant pending requests for pages > size
237
- // Refers to https://github.com/vaadin/vaadin-flow-components/issues/229
238
- this._flushPendingRequests(size);
252
+ super.requestContentUpdate();
239
253
  }
240
254
 
241
255
  /** @private */
@@ -244,6 +258,8 @@ export const ComboBoxDataProviderMixin = (superClass) =>
244
258
  this.pageSize = oldPageSize;
245
259
  throw new Error('`pageSize` value must be an integer > 0');
246
260
  }
261
+
262
+ this.__dataProviderController.setPageSize(pageSize);
247
263
  this.clearCache();
248
264
  }
249
265
 
@@ -253,6 +269,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
253
269
  this.dataProvider = oldDataProvider;
254
270
  });
255
271
 
272
+ this.__dataProviderController.setDataProvider(dataProvider);
256
273
  this.clearCache();
257
274
  }
258
275
 
@@ -279,28 +296,4 @@ export const ComboBoxDataProviderMixin = (superClass) =>
279
296
  }
280
297
  }
281
298
  }
282
-
283
- /**
284
- * This method cleans up the page callbacks which refers to the
285
- * non-existing pages, i.e. which item indexes are greater than the
286
- * changed size.
287
- * This case is basically happens when:
288
- * 1. Users scroll fast to the bottom and combo box generates the
289
- * redundant page request/callback
290
- * 2. Server side uses undefined size lazy loading and suddenly reaches
291
- * the exact size which is on the range edge
292
- * (for default page size = 50, it will be 100, 200, 300, ...).
293
- * @param size the new size of items
294
- * @private
295
- */
296
- _flushPendingRequests(size) {
297
- if (this._pendingRequests) {
298
- const lastPage = Math.ceil(size / this.pageSize);
299
- Object.entries(this._pendingRequests).forEach(([page, callback]) => {
300
- if (parseInt(page) >= lastPage) {
301
- callback([], size);
302
- }
303
- });
304
- }
305
- }
306
299
  };
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
7
  import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
8
- import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js';
8
+ import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
9
9
  import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
10
10
  import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
11
11
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
@@ -512,7 +512,7 @@ export const ComboBoxMixin = (subclass) =>
512
512
  }
513
513
 
514
514
  /** @private */
515
- // eslint-disable-next-line max-params
515
+ // eslint-disable-next-line @typescript-eslint/max-params
516
516
  _updateScroller(
517
517
  scroller,
518
518
  items,
@@ -1358,7 +1358,19 @@ export const ComboBoxMixin = (subclass) =>
1358
1358
  return;
1359
1359
  }
1360
1360
 
1361
- this._closeOrCommit();
1361
+ if (isKeyboardActive()) {
1362
+ // Close on Tab key causing blur. With mouse, close on outside click instead.
1363
+ this._closeOrCommit();
1364
+ return;
1365
+ }
1366
+
1367
+ if (!this.opened) {
1368
+ this._commitValue();
1369
+ } else if (!this._overlayOpened) {
1370
+ // Combo-box is opened, but overlay is not visible -> custom value was entered.
1371
+ // Make sure we close here as there won't be an "outside click" in this case.
1372
+ this.close();
1373
+ }
1362
1374
  }
1363
1375
  }
1364
1376
 
@@ -33,20 +33,9 @@ const comboBoxLoader = css`
33
33
  [part~='loader'] {
34
34
  position: absolute;
35
35
  z-index: 1;
36
- left: var(--lumo-space-s);
37
- right: var(--lumo-space-s);
36
+ inset-inline: var(--lumo-space-s);
38
37
  top: var(--lumo-space-s);
39
- margin-left: auto;
40
- margin-inline-start: auto;
41
- margin-inline-end: 0;
42
- }
43
-
44
- :host([dir='rtl']) [part~='loader'] {
45
- left: auto;
46
- margin-left: 0;
47
- margin-right: auto;
48
- margin-inline-start: 0;
49
- margin-inline-end: auto;
38
+ margin-inline: auto 0;
50
39
  }
51
40
  `;
52
41
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "24.5.0-alpha1",
4
+ "version": "24.5.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -471,7 +471,7 @@
471
471
  },
472
472
  {
473
473
  "name": "vaadin-combo-box",
474
- "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/24.5.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/24.5.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/24.5.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/24.5.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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha1/#/elements/vaadin-combo-box-light) element.\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/24.5.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.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.",
474
+ "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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-combo-box-light) element.\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/24.5.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/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.",
475
475
  "attributes": [
476
476
  {
477
477
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "24.5.0-alpha1",
4
+ "version": "24.5.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -254,7 +254,7 @@
254
254
  },
255
255
  {
256
256
  "name": "vaadin-combo-box",
257
- "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/24.5.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/24.5.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/24.5.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/24.5.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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha1/#/elements/vaadin-combo-box-light) element.\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/24.5.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.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.",
257
+ "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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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/24.5.0-alpha10/#/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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-combo-box-light) element.\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/24.5.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/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.",
258
258
  "extension": true,
259
259
  "attributes": [
260
260
  {