@vaadin/combo-box 25.3.0-alpha10 → 25.3.0-alpha12

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.
@@ -453,6 +453,16 @@
453
453
  "description": "",
454
454
  "name": "ComboBoxItemsMixin",
455
455
  "members": [
456
+ {
457
+ "kind": "field",
458
+ "name": "autoFocusPartialMatch",
459
+ "privacy": "public",
460
+ "type": {
461
+ "text": "string"
462
+ },
463
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
464
+ "attribute": "auto-focus-partial-match"
465
+ },
456
466
  {
457
467
  "kind": "field",
458
468
  "name": "autoOpenDisabled",
@@ -612,6 +622,14 @@
612
622
  }
613
623
  ],
614
624
  "attributes": [
625
+ {
626
+ "name": "auto-focus-partial-match",
627
+ "type": {
628
+ "text": "string"
629
+ },
630
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
631
+ "fieldName": "autoFocusPartialMatch"
632
+ },
615
633
  {
616
634
  "name": "auto-open-disabled",
617
635
  "type": {
@@ -740,6 +758,20 @@
740
758
  "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.",
741
759
  "attribute": "allow-custom-value"
742
760
  },
761
+ {
762
+ "kind": "field",
763
+ "name": "autoFocusPartialMatch",
764
+ "privacy": "public",
765
+ "type": {
766
+ "text": "string"
767
+ },
768
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
769
+ "attribute": "auto-focus-partial-match",
770
+ "inheritedFrom": {
771
+ "name": "ComboBoxItemsMixin",
772
+ "module": "src/vaadin-combo-box-items-mixin.js"
773
+ }
774
+ },
743
775
  {
744
776
  "kind": "field",
745
777
  "name": "autoOpenDisabled",
@@ -1091,6 +1123,18 @@
1091
1123
  "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.",
1092
1124
  "fieldName": "allowCustomValue"
1093
1125
  },
1126
+ {
1127
+ "name": "auto-focus-partial-match",
1128
+ "type": {
1129
+ "text": "string"
1130
+ },
1131
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
1132
+ "fieldName": "autoFocusPartialMatch",
1133
+ "inheritedFrom": {
1134
+ "name": "ComboBoxItemsMixin",
1135
+ "module": "src/vaadin-combo-box-items-mixin.js"
1136
+ }
1137
+ },
1094
1138
  {
1095
1139
  "name": "auto-open-disabled",
1096
1140
  "type": {
@@ -1807,6 +1851,20 @@
1807
1851
  "package": "@vaadin/a11y-base/src/delegate-focus-mixin.js"
1808
1852
  }
1809
1853
  },
1854
+ {
1855
+ "kind": "field",
1856
+ "name": "autoFocusPartialMatch",
1857
+ "privacy": "public",
1858
+ "type": {
1859
+ "text": "string"
1860
+ },
1861
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
1862
+ "attribute": "auto-focus-partial-match",
1863
+ "inheritedFrom": {
1864
+ "name": "ComboBoxItemsMixin",
1865
+ "module": "src/vaadin-combo-box-items-mixin.js"
1866
+ }
1867
+ },
1810
1868
  {
1811
1869
  "kind": "field",
1812
1870
  "name": "autoOpenDisabled",
@@ -2473,6 +2531,18 @@
2473
2531
  "package": "@vaadin/field-base/src/input-control-mixin.js"
2474
2532
  }
2475
2533
  },
2534
+ {
2535
+ "name": "auto-focus-partial-match",
2536
+ "type": {
2537
+ "text": "string"
2538
+ },
2539
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
2540
+ "fieldName": "autoFocusPartialMatch",
2541
+ "inheritedFrom": {
2542
+ "name": "ComboBoxItemsMixin",
2543
+ "module": "src/vaadin-combo-box-items-mixin.js"
2544
+ }
2545
+ },
2476
2546
  {
2477
2547
  "name": "auto-open-disabled",
2478
2548
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "25.3.0-alpha10",
3
+ "version": "25.3.0-alpha12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,22 +36,22 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@vaadin/a11y-base": "25.3.0-alpha10",
40
- "@vaadin/component-base": "25.3.0-alpha10",
41
- "@vaadin/field-base": "25.3.0-alpha10",
42
- "@vaadin/input-container": "25.3.0-alpha10",
43
- "@vaadin/item": "25.3.0-alpha10",
44
- "@vaadin/lit-renderer": "25.3.0-alpha10",
45
- "@vaadin/overlay": "25.3.0-alpha10",
46
- "@vaadin/vaadin-themable-mixin": "25.3.0-alpha10",
39
+ "@vaadin/a11y-base": "25.3.0-alpha12",
40
+ "@vaadin/component-base": "25.3.0-alpha12",
41
+ "@vaadin/field-base": "25.3.0-alpha12",
42
+ "@vaadin/input-container": "25.3.0-alpha12",
43
+ "@vaadin/item": "25.3.0-alpha12",
44
+ "@vaadin/lit-renderer": "25.3.0-alpha12",
45
+ "@vaadin/overlay": "25.3.0-alpha12",
46
+ "@vaadin/vaadin-themable-mixin": "25.3.0-alpha12",
47
47
  "lit": "^3.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@vaadin/aura": "25.3.0-alpha10",
51
- "@vaadin/chai-plugins": "25.3.0-alpha10",
52
- "@vaadin/test-runner-commands": "25.3.0-alpha10",
50
+ "@vaadin/aura": "25.3.0-alpha12",
51
+ "@vaadin/chai-plugins": "25.3.0-alpha12",
52
+ "@vaadin/test-runner-commands": "25.3.0-alpha12",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.3.0-alpha10",
54
+ "@vaadin/vaadin-lumo-styles": "25.3.0-alpha12",
55
55
  "sinon": "^22.0.0"
56
56
  },
57
57
  "customElements": "custom-elements.json",
@@ -59,5 +59,5 @@
59
59
  "web-types.json",
60
60
  "web-types.lit.json"
61
61
  ],
62
- "gitHead": "f2833abdf9b613fa0d0ed216830e3f4de87b7dac"
62
+ "gitHead": "0f0337783efe38332f5dc6a8968f207d2982de4b"
63
63
  }
@@ -24,6 +24,11 @@ export const ComboBoxFocusIndexMixin = (superClass) =>
24
24
  return;
25
25
  }
26
26
 
27
+ // Ignore while a filter is active, keep the dropdown at the first match.
28
+ if (this.filter) {
29
+ return;
30
+ }
31
+
27
32
  // Defer until the dropdown is open and the items array has been
28
33
  // populated. `_onOpened` and `__onDataProviderPageLoaded` re-fire
29
34
  // the queued call once those conditions hold.
@@ -6,11 +6,33 @@
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { ComboBoxBaseMixinClass } from './vaadin-combo-box-base-mixin.js';
8
8
 
9
+ export type ComboBoxAutoFocusPartialMatch = 'first-match' | 'none' | 'only-match';
10
+
9
11
  export declare function ComboBoxItemsMixin<TItem, T extends Constructor<HTMLElement>>(
10
12
  base: T,
11
13
  ): Constructor<ComboBoxBaseMixinClass> & Constructor<ComboBoxItemsMixinClass<TItem>> & T;
12
14
 
13
15
  export declare class ComboBoxItemsMixinClass<TItem> {
16
+ /**
17
+ * Controls whether an item whose label partially matches the typed
18
+ * filter is automatically focused. The focused item is highlighted
19
+ * in the dropdown while typing and is selected when committing the
20
+ * value, for example on Enter press:
21
+ *
22
+ * - `none` (default): do not focus partial matches.
23
+ * - `first-match`: focus the first item in the filtered results.
24
+ * - `only-match`: focus the item when filtering narrows the results to a single item.
25
+ *
26
+ * An item whose label matches the filter exactly is always focused,
27
+ * regardless of this property. Matching is case-insensitive. A partial
28
+ * match is not focused when `allowCustomValue` is enabled, or while
29
+ * the dropdown is closed. For example, with `autoOpenDisabled`, typing
30
+ * does not focus or select a match until the dropdown is opened.
31
+ *
32
+ * @attr {none|first-match|only-match} auto-focus-partial-match
33
+ */
34
+ autoFocusPartialMatch: ComboBoxAutoFocusPartialMatch;
35
+
14
36
  /**
15
37
  * A full set of items to filter the visible options from.
16
38
  * The items can be of either `String` or `Object` type.
@@ -62,6 +62,29 @@ export const ComboBoxItemsMixin = (superClass) =>
62
62
  sync: true,
63
63
  },
64
64
 
65
+ /**
66
+ * Controls whether an item whose label partially matches the typed
67
+ * filter is automatically focused. The focused item is highlighted
68
+ * in the dropdown while typing and is selected when committing the
69
+ * value, for example on Enter press:
70
+ *
71
+ * - `none` (default): do not focus partial matches.
72
+ * - `first-match`: focus the first item in the filtered results.
73
+ * - `only-match`: focus the item when filtering narrows the results to a single item.
74
+ *
75
+ * An item whose label matches the filter exactly is always focused,
76
+ * regardless of this property. Matching is case-insensitive. A partial
77
+ * match is not focused when `allowCustomValue` is enabled, or while
78
+ * the dropdown is closed. For example, with `autoOpenDisabled`, typing
79
+ * does not focus or select a match until the dropdown is opened.
80
+ *
81
+ * @attr {none|first-match|only-match} auto-focus-partial-match
82
+ */
83
+ autoFocusPartialMatch: {
84
+ type: String,
85
+ value: 'none',
86
+ },
87
+
65
88
  /**
66
89
  * Filtering string the user has typed into the input field.
67
90
  */
@@ -161,6 +184,22 @@ export const ComboBoxItemsMixin = (superClass) =>
161
184
  this.setProperties(props);
162
185
  }
163
186
 
187
+ /**
188
+ * Override method from `ComboBoxBaseMixin` to focus the item matching
189
+ * the filter when the dropdown is opened after typing, which is possible
190
+ * when `autoOpenDisabled` is enabled.
191
+ *
192
+ * @protected
193
+ * @override
194
+ */
195
+ _onOpened() {
196
+ super._onOpened();
197
+
198
+ if (this.filter && this._focusedIndex === -1) {
199
+ this._focusedIndex = this.__getItemIndexByFilter(this._dropdownItems);
200
+ }
201
+ }
202
+
164
203
  /**
165
204
  * Override method from `ComboBoxBaseMixin` to handle item label path.
166
205
  * @protected
@@ -282,4 +321,28 @@ export const ComboBoxItemsMixin = (superClass) =>
282
321
  return this._getItemLabel(item).toString().toLowerCase() === label.toString().toLowerCase();
283
322
  });
284
323
  }
324
+
325
+ /** @private */
326
+ __getItemIndexByFilter(items) {
327
+ // An item whose label matches the filter exactly takes precedence.
328
+ const exactMatchIndex = this.__getItemIndexByLabel(items, this.filter);
329
+ if (exactMatchIndex > -1) {
330
+ return exactMatchIndex;
331
+ }
332
+
333
+ if (!this.opened || !items || items.length === 0 || !this.filter || this.allowCustomValue) {
334
+ return -1;
335
+ }
336
+
337
+ if (
338
+ this.autoFocusPartialMatch === 'first-match' ||
339
+ (this.autoFocusPartialMatch === 'only-match' && items.length === 1)
340
+ ) {
341
+ // Skip an item that is not yet loaded. Once the item is loaded,
342
+ // the focused index is updated again.
343
+ return items[0] instanceof ComboBoxPlaceholder ? -1 : 0;
344
+ }
345
+
346
+ return -1;
347
+ }
285
348
  };
@@ -281,6 +281,8 @@ export const ComboBoxMixin = (superClass) =>
281
281
  * @override
282
282
  */
283
283
  _onOpened() {
284
+ super._onOpened();
285
+
284
286
  this.dispatchEvent(new CustomEvent('vaadin-combo-box-dropdown-opened', { bubbles: true, composed: true }));
285
287
 
286
288
  // _detectAndDispatchChange() should not consider value changes done before opening
@@ -542,7 +544,7 @@ export const ComboBoxMixin = (superClass) =>
542
544
  } else {
543
545
  // When the user filled in something that is different from the current value = filtering is enabled,
544
546
  // set the focused index to the item that matches the filter query.
545
- this._focusedIndex = this.__getItemIndexByLabel(newItems, this.filter);
547
+ this._focusedIndex = this.__getItemIndexByFilter(newItems);
546
548
  }
547
549
  }
548
550
 
@@ -30,6 +30,7 @@ export {
30
30
  ComboBoxDataProviderCallback,
31
31
  ComboBoxDataProviderParams,
32
32
  } from './vaadin-combo-box-data-provider-mixin.js';
33
+ export { ComboBoxAutoFocusPartialMatch } from './vaadin-combo-box-items-mixin.js';
33
34
  export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
34
35
 
35
36
  /**
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.3.0-alpha10",
4
+ "version": "25.3.0-alpha12",
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.3.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/25.3.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/25.3.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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\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\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\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.3.0-alpha10/#/elements/vaadin-item).\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.3.0-alpha12/#/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.3.0-alpha12/#/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.3.0-alpha12/#/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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\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\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\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.3.0-alpha12/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "accessible-description-ref",
@@ -55,6 +55,15 @@
55
55
  ]
56
56
  }
57
57
  },
58
+ {
59
+ "name": "auto-focus-partial-match",
60
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
61
+ "value": {
62
+ "type": [
63
+ "string"
64
+ ]
65
+ }
66
+ },
58
67
  {
59
68
  "name": "auto-open-disabled",
60
69
  "description": "Set true to prevent the overlay from opening automatically.",
@@ -346,6 +355,15 @@
346
355
  ]
347
356
  }
348
357
  },
358
+ {
359
+ "name": "autoFocusPartialMatch",
360
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
361
+ "value": {
362
+ "type": [
363
+ "string"
364
+ ]
365
+ }
366
+ },
349
367
  {
350
368
  "name": "autoOpenDisabled",
351
369
  "description": "Set true to prevent the overlay from opening automatically.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "25.3.0-alpha10",
4
+ "version": "25.3.0-alpha12",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-combo-box",
19
- "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.3.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/25.3.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/25.3.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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\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\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\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.3.0-alpha10/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "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.3.0-alpha12/#/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.3.0-alpha12/#/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.3.0-alpha12/#/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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\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\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\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.3.0-alpha12/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -61,6 +61,13 @@
61
61
  "kind": "expression"
62
62
  }
63
63
  },
64
+ {
65
+ "name": ".autoFocusPartialMatch",
66
+ "description": "Controls whether an item whose label partially matches the typed\nfilter is automatically focused. The focused item is highlighted\nin the dropdown while typing and is selected when committing the\nvalue, for example on Enter press:\n\n- `none` (default): do not focus partial matches.\n- `first-match`: focus the first item in the filtered results.\n- `only-match`: focus the item when filtering narrows the results to a single item.\n\nAn item whose label matches the filter exactly is always focused,\nregardless of this property. Matching is case-insensitive. A partial\nmatch is not focused when `allowCustomValue` is enabled, or while\nthe dropdown is closed. For example, with `autoOpenDisabled`, typing\ndoes not focus or select a match until the dropdown is opened.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
64
71
  {
65
72
  "name": "?autoOpenDisabled",
66
73
  "description": "Set true to prevent the overlay from opening automatically.",