@vaadin/combo-box 24.0.0-alpha8 → 24.0.0-alpha9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "24.0.0-alpha8",
3
+ "version": "24.0.0-alpha9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,20 +38,20 @@
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/component-base": "24.0.0-alpha8",
42
- "@vaadin/field-base": "24.0.0-alpha8",
43
- "@vaadin/input-container": "24.0.0-alpha8",
44
- "@vaadin/item": "24.0.0-alpha8",
45
- "@vaadin/lit-renderer": "24.0.0-alpha8",
46
- "@vaadin/overlay": "24.0.0-alpha8",
47
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha8",
48
- "@vaadin/vaadin-material-styles": "24.0.0-alpha8",
49
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha8"
41
+ "@vaadin/component-base": "24.0.0-alpha9",
42
+ "@vaadin/field-base": "24.0.0-alpha9",
43
+ "@vaadin/input-container": "24.0.0-alpha9",
44
+ "@vaadin/item": "24.0.0-alpha9",
45
+ "@vaadin/lit-renderer": "24.0.0-alpha9",
46
+ "@vaadin/overlay": "24.0.0-alpha9",
47
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha9",
48
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha9",
49
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha9"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
53
53
  "@vaadin/testing-helpers": "^0.3.2",
54
- "@vaadin/text-field": "24.0.0-alpha8",
54
+ "@vaadin/text-field": "24.0.0-alpha9",
55
55
  "lit": "^2.0.0",
56
56
  "sinon": "^13.0.2"
57
57
  },
@@ -59,5 +59,5 @@
59
59
  "web-types.json",
60
60
  "web-types.lit.json"
61
61
  ],
62
- "gitHead": "476752249bb12295c500980d98a3256ad3b22b73"
62
+ "gitHead": "cc3f747164041566b300bde4b105d2475649e93f"
63
63
  }
@@ -6,6 +6,7 @@
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
8
8
  import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
9
+ import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
9
10
  import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
10
11
  import type { ComboBox } from './vaadin-combo-box.js';
11
12
 
@@ -28,6 +29,7 @@ export declare function ComboBoxMixin<TItem, T extends Constructor<HTMLElement>>
28
29
  Constructor<DisabledMixinClass> &
29
30
  Constructor<InputMixinClass> &
30
31
  Constructor<KeyboardMixinClass> &
32
+ Constructor<OverlayClassMixinClass> &
31
33
  T;
32
34
 
33
35
  export declare class ComboBoxMixinClass<TItem> {
@@ -8,6 +8,7 @@ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'
8
8
  import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
9
9
  import { isElementFocused } from '@vaadin/component-base/src/focus-utils.js';
10
10
  import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
11
+ import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
11
12
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
12
13
  import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
13
14
  import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
@@ -43,10 +44,17 @@ function findItemIndex(items, callback) {
43
44
 
44
45
  /**
45
46
  * @polymerMixin
47
+ * @mixes ControllerMixin
48
+ * @mixes DisabledMixin
49
+ * @mixes InputMixin
50
+ * @mixes KeyboardMixin
51
+ * @mixes OverlayClassMixin
46
52
  * @param {function(new:HTMLElement)} subclass
47
53
  */
48
54
  export const ComboBoxMixin = (subclass) =>
49
- class VaadinComboBoxMixinElement extends ControllerMixin(KeyboardMixin(InputMixin(DisabledMixin(subclass)))) {
55
+ class ComboBoxMixinClass extends OverlayClassMixin(
56
+ ControllerMixin(KeyboardMixin(InputMixin(DisabledMixin(subclass)))),
57
+ ) {
50
58
  static get properties() {
51
59
  return {
52
60
  /**
@@ -339,7 +347,7 @@ export const ComboBoxMixin = (subclass) =>
339
347
 
340
348
  const bringToFrontListener = () => {
341
349
  requestAnimationFrame(() => {
342
- this.$.overlay.bringToFront();
350
+ this._overlayElement.bringToFront();
343
351
  });
344
352
  };
345
353
 
@@ -430,6 +438,8 @@ export const ComboBoxMixin = (subclass) =>
430
438
  overlay.addEventListener('opened-changed', (e) => {
431
439
  this._overlayOpened = e.detail.value;
432
440
  });
441
+
442
+ this._overlayElement = overlay;
433
443
  }
434
444
 
435
445
  /**
@@ -441,7 +451,7 @@ export const ComboBoxMixin = (subclass) =>
441
451
  _initScroller(host) {
442
452
  const scrollerTag = `${this._tagNamePrefix}-scroller`;
443
453
 
444
- const overlay = this.$.overlay;
454
+ const overlay = this._overlayElement;
445
455
 
446
456
  overlay.renderer = (root) => {
447
457
  if (!root.firstChild) {
@@ -547,7 +557,7 @@ export const ComboBoxMixin = (subclass) =>
547
557
  this.focus();
548
558
  }
549
559
 
550
- this.$.overlay.restoreFocusOnClose = true;
560
+ this._overlayElement.restoreFocusOnClose = true;
551
561
  } else {
552
562
  this._onClosed();
553
563
  if (this._openedWithFocusRing && this._isInputFocused()) {
@@ -646,7 +656,7 @@ export const ComboBoxMixin = (subclass) =>
646
656
  super._onKeyDown(e);
647
657
 
648
658
  if (e.key === 'Tab') {
649
- this.$.overlay.restoreFocusOnClose = false;
659
+ this._overlayElement.restoreFocusOnClose = false;
650
660
  } else if (e.key === 'ArrowDown') {
651
661
  this._onArrowDown();
652
662
 
@@ -1271,7 +1281,7 @@ export const ComboBoxMixin = (subclass) =>
1271
1281
  }
1272
1282
 
1273
1283
  // Fixes the problem with `focusout` happening when clicking on the scroll bar on Edge
1274
- if (event.relatedTarget === this.$.overlay) {
1284
+ if (event.relatedTarget === this._overlayElement) {
1275
1285
  event.composedPath()[0].focus();
1276
1286
  return;
1277
1287
  }
@@ -10,6 +10,7 @@ import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mix
10
10
  import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
11
11
  import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
12
12
  import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
13
+ import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
13
14
  import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
14
15
  import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
15
16
  import type { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
@@ -148,21 +149,17 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
148
149
  * needs to be set manually. The total number of items can be returned
149
150
  * in the second argument of the data provider callback:__
150
151
  *
151
- * ```javascript
152
- * comboBox.dataProvider = function(params, callback) {
153
- * var url = 'https://api.example/data' +
154
- * '?page=' + params.page + // the requested page index
155
- * '&per_page=' + params.pageSize; // number of items on the page
156
- * var xhr = new XMLHttpRequest();
157
- * xhr.onload = function() {
158
- * var response = JSON.parse(xhr.responseText);
159
- * callback(
160
- * response.employees, // requested page of items
161
- * response.totalSize // total number of items
162
- * );
163
- * };
164
- * xhr.open('GET', url, true);
165
- * xhr.send();
152
+ * ```js
153
+ * comboBox.dataProvider = async (params, callback) => {
154
+ * const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';
155
+ * const { filter, page, pageSize } = params;
156
+ * const index = page * pageSize;
157
+ *
158
+ * const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);
159
+ * if (res.ok) {
160
+ * const { result, size } = await res.json();
161
+ * callback(result, size);
162
+ * }
166
163
  * };
167
164
  * ```
168
165
  *
@@ -239,6 +236,7 @@ interface ComboBox<TItem = ComboBoxDefaultItem>
239
236
  PatternMixinClass,
240
237
  LabelMixinClass,
241
238
  KeyboardMixinClass,
239
+ OverlayClassMixinClass,
242
240
  InputMixinClass,
243
241
  InputControlMixinClass,
244
242
  InputConstraintsMixinClass,
@@ -80,21 +80,17 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-b
80
80
  * needs to be set manually. The total number of items can be returned
81
81
  * in the second argument of the data provider callback:__
82
82
  *
83
- * ```javascript
84
- * comboBox.dataProvider = function(params, callback) {
85
- * var url = 'https://api.example/data' +
86
- * '?page=' + params.page + // the requested page index
87
- * '&per_page=' + params.pageSize; // number of items on the page
88
- * var xhr = new XMLHttpRequest();
89
- * xhr.onload = function() {
90
- * var response = JSON.parse(xhr.responseText);
91
- * callback(
92
- * response.employees, // requested page of items
93
- * response.totalSize // total number of items
94
- * );
95
- * };
96
- * xhr.open('GET', url, true);
97
- * xhr.send();
83
+ * ```js
84
+ * comboBox.dataProvider = async (params, callback) => {
85
+ * const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';
86
+ * const { filter, page, pageSize } = params;
87
+ * const index = page * pageSize;
88
+ *
89
+ * const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);
90
+ * if (res.ok) {
91
+ * const { result, size } = await res.json();
92
+ * callback(result, size);
93
+ * }
98
94
  * };
99
95
  * ```
100
96
  *
@@ -282,7 +278,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
282
278
  */
283
279
  _shouldRemoveFocus(event) {
284
280
  // Do not blur when focus moves to the overlay
285
- if (event.relatedTarget === this.$.overlay) {
281
+ if (event.relatedTarget === this._overlayElement) {
286
282
  event.composedPath()[0].focus();
287
283
  return false;
288
284
  }
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.0.0-alpha8",
4
+ "version": "24.0.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -29,6 +29,39 @@
29
29
  ]
30
30
  }
31
31
  },
32
+ {
33
+ "name": "disabled",
34
+ "description": "If true, the user cannot interact with this element.",
35
+ "value": {
36
+ "type": [
37
+ "boolean",
38
+ "null",
39
+ "undefined"
40
+ ]
41
+ }
42
+ },
43
+ {
44
+ "name": "value",
45
+ "description": "The value of the field.",
46
+ "value": {
47
+ "type": [
48
+ "string",
49
+ "null",
50
+ "undefined"
51
+ ]
52
+ }
53
+ },
54
+ {
55
+ "name": "overlay-class",
56
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
57
+ "value": {
58
+ "type": [
59
+ "string",
60
+ "null",
61
+ "undefined"
62
+ ]
63
+ }
64
+ },
32
65
  {
33
66
  "name": "opened",
34
67
  "description": "True if the dropdown is open, false otherwise.",
@@ -188,6 +221,39 @@
188
221
  ]
189
222
  }
190
223
  },
224
+ {
225
+ "name": "disabled",
226
+ "description": "If true, the user cannot interact with this element.",
227
+ "value": {
228
+ "type": [
229
+ "boolean",
230
+ "null",
231
+ "undefined"
232
+ ]
233
+ }
234
+ },
235
+ {
236
+ "name": "value",
237
+ "description": "The value of the field.",
238
+ "value": {
239
+ "type": [
240
+ "string",
241
+ "null",
242
+ "undefined"
243
+ ]
244
+ }
245
+ },
246
+ {
247
+ "name": "overlayClass",
248
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
249
+ "value": {
250
+ "type": [
251
+ "string",
252
+ "null",
253
+ "undefined"
254
+ ]
255
+ }
256
+ },
191
257
  {
192
258
  "name": "opened",
193
259
  "description": "True if the dropdown is open, false otherwise.",
@@ -394,7 +460,7 @@
394
460
  },
395
461
  {
396
462
  "name": "vaadin-combo-box",
397
- "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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/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```javascript\ncomboBox.dataProvider = function(params, callback) {\n var url = 'https://api.example/data' +\n '?page=' + params.page + // the requested page index\n '&per_page=' + params.pageSize; // number of items on the page\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n var response = JSON.parse(xhr.responseText);\n callback(\n response.employees, // requested page of items\n response.totalSize // total number of items\n );\n };\n xhr.open('GET', url, true);\n xhr.send();\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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/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/custom-theme/styling-components) documentation.",
463
+ "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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/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/custom-theme/styling-components) documentation.",
398
464
  "attributes": [
399
465
  {
400
466
  "name": "disabled",
@@ -589,6 +655,17 @@
589
655
  ]
590
656
  }
591
657
  },
658
+ {
659
+ "name": "overlay-class",
660
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
661
+ "value": {
662
+ "type": [
663
+ "string",
664
+ "null",
665
+ "undefined"
666
+ ]
667
+ }
668
+ },
592
669
  {
593
670
  "name": "opened",
594
671
  "description": "True if the dropdown is open, false otherwise.",
@@ -882,6 +959,17 @@
882
959
  ]
883
960
  }
884
961
  },
962
+ {
963
+ "name": "overlayClass",
964
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
965
+ "value": {
966
+ "type": [
967
+ "string",
968
+ "null",
969
+ "undefined"
970
+ ]
971
+ }
972
+ },
885
973
  {
886
974
  "name": "opened",
887
975
  "description": "True if the dropdown is open, false otherwise.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "24.0.0-alpha8",
4
+ "version": "24.0.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -19,6 +19,13 @@
19
19
  "description": "`<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing\nonly the dropdown functionality and leaving the input field definition to the user.\n\nThe element has the same API as `<vaadin-combo-box>`.\n\nTo create a custom input field, you need to add a child element which has a two-way\ndata-bindable property representing the input value. The property name is expected\nto be `value` by default. For example, you can use `<vaadin-text-field>` element:\n\n```html\n<vaadin-combo-box-light>\n <vaadin-text-field></vaadin-text-field>\n</vaadin-combo-box-light>\n```\n\nIf you are using custom input field that has other property for value,\nset `class=\"input\"` to enable corresponding logic, and use `attr-for-value`\nattribute to specify which property to use:\n\n```html\n<vaadin-combo-box-light attr-for-value=\"input-value\">\n <custom-input class=\"input\"></custom-input>\n</vaadin-combo-box-light>\n```\n\nYou can also pass custom toggle and clear buttons with corresponding classes:\n\n```html\n<vaadin-combo-box-light>\n <custom-input class=\"input\" attr-for-value=\"input-value\">\n <button slot=\"suffix\" class=\"clear-button\">Clear</button>\n <button slot=\"suffix\" class=\"toggle-button\">Toggle</button>\n </custom-input>\n</vaadin-combo-box-light>\n```",
20
20
  "extension": true,
21
21
  "attributes": [
22
+ {
23
+ "name": "?disabled",
24
+ "description": "If true, the user cannot interact with this element.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
22
29
  {
23
30
  "name": "?opened",
24
31
  "description": "True if the dropdown is open, false otherwise.",
@@ -89,6 +96,20 @@
89
96
  "kind": "expression"
90
97
  }
91
98
  },
99
+ {
100
+ "name": ".value",
101
+ "description": "The value of the field.",
102
+ "value": {
103
+ "kind": "expression"
104
+ }
105
+ },
106
+ {
107
+ "name": ".overlayClass",
108
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
109
+ "value": {
110
+ "kind": "expression"
111
+ }
112
+ },
92
113
  {
93
114
  "name": ".renderer",
94
115
  "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.",
@@ -226,7 +247,7 @@
226
247
  },
227
248
  {
228
249
  "name": "vaadin-combo-box",
229
- "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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/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```javascript\ncomboBox.dataProvider = function(params, callback) {\n var url = 'https://api.example/data' +\n '?page=' + params.page + // the requested page index\n '&per_page=' + params.pageSize; // number of items on the page\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n var response = JSON.parse(xhr.responseText);\n callback(\n response.employees, // requested page of items\n response.totalSize // total number of items\n );\n };\n xhr.open('GET', url, true);\n xhr.send();\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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/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/custom-theme/styling-components) documentation.",
250
+ "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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/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.0.0-alpha9/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/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/custom-theme/styling-components) documentation.",
230
251
  "extension": true,
231
252
  "attributes": [
232
253
  {
@@ -390,6 +411,13 @@
390
411
  "kind": "expression"
391
412
  }
392
413
  },
414
+ {
415
+ "name": ".overlayClass",
416
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
417
+ "value": {
418
+ "kind": "expression"
419
+ }
420
+ },
393
421
  {
394
422
  "name": ".renderer",
395
423
  "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.",