@vaadin/combo-box 25.3.0-alpha9 → 25.3.0-beta2

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.
@@ -582,6 +582,16 @@
582
582
  "module": "src/vaadin-combo-box-base-mixin.js"
583
583
  }
584
584
  },
585
+ {
586
+ "kind": "field",
587
+ "name": "partialMatchMode",
588
+ "privacy": "public",
589
+ "type": {
590
+ "text": "string"
591
+ },
592
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
593
+ "attribute": "partial-match-mode"
594
+ },
585
595
  {
586
596
  "kind": "field",
587
597
  "name": "readonly",
@@ -672,6 +682,14 @@
672
682
  "module": "src/vaadin-combo-box-base-mixin.js"
673
683
  }
674
684
  },
685
+ {
686
+ "name": "partial-match-mode",
687
+ "type": {
688
+ "text": "string"
689
+ },
690
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
691
+ "fieldName": "partialMatchMode"
692
+ },
675
693
  {
676
694
  "name": "readonly",
677
695
  "type": {
@@ -970,6 +988,20 @@
970
988
  "module": "src/vaadin-combo-box-base-mixin.js"
971
989
  }
972
990
  },
991
+ {
992
+ "kind": "field",
993
+ "name": "partialMatchMode",
994
+ "privacy": "public",
995
+ "type": {
996
+ "text": "string"
997
+ },
998
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
999
+ "attribute": "partial-match-mode",
1000
+ "inheritedFrom": {
1001
+ "name": "ComboBoxItemsMixin",
1002
+ "module": "src/vaadin-combo-box-items-mixin.js"
1003
+ }
1004
+ },
973
1005
  {
974
1006
  "kind": "field",
975
1007
  "name": "readonly",
@@ -1203,6 +1235,18 @@
1203
1235
  "module": "src/vaadin-combo-box-base-mixin.js"
1204
1236
  }
1205
1237
  },
1238
+ {
1239
+ "name": "partial-match-mode",
1240
+ "type": {
1241
+ "text": "string"
1242
+ },
1243
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
1244
+ "fieldName": "partialMatchMode",
1245
+ "inheritedFrom": {
1246
+ "name": "ComboBoxItemsMixin",
1247
+ "module": "src/vaadin-combo-box-items-mixin.js"
1248
+ }
1249
+ },
1206
1250
  {
1207
1251
  "name": "readonly",
1208
1252
  "type": {
@@ -1720,7 +1764,7 @@
1720
1764
  "declarations": [
1721
1765
  {
1722
1766
  "kind": "class",
1723
- "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`](#/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\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`](#/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`](#/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>`](#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
1767
+ "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`](#/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\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`](#/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`](#/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 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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\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>`](#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
1724
1768
  "name": "ComboBox",
1725
1769
  "members": [
1726
1770
  {
@@ -2174,6 +2218,20 @@
2174
2218
  "module": "src/vaadin-combo-box-data-provider-mixin.js"
2175
2219
  }
2176
2220
  },
2221
+ {
2222
+ "kind": "field",
2223
+ "name": "partialMatchMode",
2224
+ "privacy": "public",
2225
+ "type": {
2226
+ "text": "string"
2227
+ },
2228
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
2229
+ "attribute": "partial-match-mode",
2230
+ "inheritedFrom": {
2231
+ "name": "ComboBoxItemsMixin",
2232
+ "module": "src/vaadin-combo-box-items-mixin.js"
2233
+ }
2234
+ },
2177
2235
  {
2178
2236
  "kind": "field",
2179
2237
  "name": "pattern",
@@ -2701,6 +2759,18 @@
2701
2759
  "module": "src/vaadin-combo-box-data-provider-mixin.js"
2702
2760
  }
2703
2761
  },
2762
+ {
2763
+ "name": "partial-match-mode",
2764
+ "type": {
2765
+ "text": "string"
2766
+ },
2767
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
2768
+ "fieldName": "partialMatchMode",
2769
+ "inheritedFrom": {
2770
+ "name": "ComboBoxItemsMixin",
2771
+ "module": "src/vaadin-combo-box-items-mixin.js"
2772
+ }
2773
+ },
2704
2774
  {
2705
2775
  "name": "pattern",
2706
2776
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "25.3.0-alpha9",
3
+ "version": "25.3.0-beta2",
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-alpha9",
40
- "@vaadin/component-base": "25.3.0-alpha9",
41
- "@vaadin/field-base": "25.3.0-alpha9",
42
- "@vaadin/input-container": "25.3.0-alpha9",
43
- "@vaadin/item": "25.3.0-alpha9",
44
- "@vaadin/lit-renderer": "25.3.0-alpha9",
45
- "@vaadin/overlay": "25.3.0-alpha9",
46
- "@vaadin/vaadin-themable-mixin": "25.3.0-alpha9",
39
+ "@vaadin/a11y-base": "25.3.0-beta2",
40
+ "@vaadin/component-base": "25.3.0-beta2",
41
+ "@vaadin/field-base": "25.3.0-beta2",
42
+ "@vaadin/input-container": "25.3.0-beta2",
43
+ "@vaadin/item": "25.3.0-beta2",
44
+ "@vaadin/lit-renderer": "25.3.0-beta2",
45
+ "@vaadin/overlay": "25.3.0-beta2",
46
+ "@vaadin/vaadin-themable-mixin": "25.3.0-beta2",
47
47
  "lit": "^3.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@vaadin/aura": "25.3.0-alpha9",
51
- "@vaadin/chai-plugins": "25.3.0-alpha9",
52
- "@vaadin/test-runner-commands": "25.3.0-alpha9",
50
+ "@vaadin/aura": "25.3.0-beta2",
51
+ "@vaadin/chai-plugins": "25.3.0-beta2",
52
+ "@vaadin/test-runner-commands": "25.3.0-beta2",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.3.0-alpha9",
54
+ "@vaadin/vaadin-lumo-styles": "25.3.0-beta2",
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": "cb915ebde095ec5b94a87af93dd4530f51984c52"
62
+ "gitHead": "d97ccbec217b60c39f3c8b2dd52473c79a48c8c1"
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.
@@ -125,10 +125,10 @@ export const ComboBoxItemMixin = (superClass) =>
125
125
  // When clearing the rendered content, this part needs to be manually disposed of.
126
126
  // Otherwise, using a Lit-based renderer on the same node will throw an exception or render nothing afterward.
127
127
  delete this._$litPart$;
128
+ this._oldRenderer = renderer;
128
129
  }
129
130
 
130
131
  if (renderer) {
131
- this._oldRenderer = renderer;
132
132
  this.requestContentUpdate();
133
133
  }
134
134
  }
@@ -6,6 +6,8 @@
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 ComboBoxPartialMatchMode = '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;
@@ -57,4 +59,30 @@ export declare class ComboBoxItemsMixinClass<TItem> {
57
59
  * @attr {string} item-value-path
58
60
  */
59
61
  itemValuePath: string;
62
+
63
+ /**
64
+ * Controls which item is automatically set to be selected, for
65
+ * example on Enter, when the typed filter only partially matches
66
+ * its label. The item that will be selected is highlighted in the
67
+ * dropdown while typing:
68
+ *
69
+ * - `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.
70
+ * - `first-match`: the first item in the filtered results is automatically set to be selected.
71
+ * - `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.
72
+ *
73
+ * In general, an exact match is always set to be selected and takes
74
+ * precedence over partial matches, regardless of the mode.
75
+ *
76
+ * A partial match is only applied while the dropdown is open. For
77
+ * example, when auto-open is disabled with `autoOpenDisabled`, typing
78
+ * does not highlight a match or set it to be selected until the
79
+ * dropdown is opened.
80
+ *
81
+ * This feature cannot be used together with custom values, because a
82
+ * partial match is also a valid custom value. A partial match is not
83
+ * applied when custom values are allowed with `allowCustomValue`.
84
+ *
85
+ * @attr {none|first-match|only-match} partial-match-mode
86
+ */
87
+ partialMatchMode: ComboBoxPartialMatchMode;
60
88
  }
@@ -111,6 +111,35 @@ export const ComboBoxItemsMixin = (superClass) =>
111
111
  value: 'value',
112
112
  sync: true,
113
113
  },
114
+
115
+ /**
116
+ * Controls which item is automatically set to be selected, for
117
+ * example on Enter, when the typed filter only partially matches
118
+ * its label. The item that will be selected is highlighted in the
119
+ * dropdown while typing:
120
+ *
121
+ * - `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.
122
+ * - `first-match`: the first item in the filtered results is automatically set to be selected.
123
+ * - `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.
124
+ *
125
+ * In general, an exact match is always set to be selected and takes
126
+ * precedence over partial matches, regardless of the mode.
127
+ *
128
+ * A partial match is only applied while the dropdown is open. For
129
+ * example, when auto-open is disabled with `autoOpenDisabled`, typing
130
+ * does not highlight a match or set it to be selected until the
131
+ * dropdown is opened.
132
+ *
133
+ * This feature cannot be used together with custom values, because a
134
+ * partial match is also a valid custom value. A partial match is not
135
+ * applied when custom values are allowed with `allowCustomValue`.
136
+ *
137
+ * @attr {none|first-match|only-match} partial-match-mode
138
+ */
139
+ partialMatchMode: {
140
+ type: String,
141
+ value: 'none',
142
+ },
114
143
  };
115
144
  }
116
145
 
@@ -161,6 +190,22 @@ export const ComboBoxItemsMixin = (superClass) =>
161
190
  this.setProperties(props);
162
191
  }
163
192
 
193
+ /**
194
+ * Override method from `ComboBoxBaseMixin` to focus the item matching
195
+ * the filter when the dropdown is opened after typing, which is possible
196
+ * when `autoOpenDisabled` is enabled.
197
+ *
198
+ * @protected
199
+ * @override
200
+ */
201
+ _onOpened() {
202
+ super._onOpened();
203
+
204
+ if (this.filter && this._focusedIndex === -1) {
205
+ this._focusedIndex = this.__getItemIndexByFilter(this._dropdownItems);
206
+ }
207
+ }
208
+
164
209
  /**
165
210
  * Override method from `ComboBoxBaseMixin` to handle item label path.
166
211
  * @protected
@@ -282,4 +327,25 @@ export const ComboBoxItemsMixin = (superClass) =>
282
327
  return this._getItemLabel(item).toString().toLowerCase() === label.toString().toLowerCase();
283
328
  });
284
329
  }
330
+
331
+ /** @private */
332
+ __getItemIndexByFilter(items) {
333
+ // An item whose label matches the filter exactly takes precedence.
334
+ const exactMatchIndex = this.__getItemIndexByLabel(items, this.filter);
335
+ if (exactMatchIndex > -1) {
336
+ return exactMatchIndex;
337
+ }
338
+
339
+ if (!this.opened || !items || items.length === 0 || !this.filter || this.allowCustomValue) {
340
+ return -1;
341
+ }
342
+
343
+ if (this.partialMatchMode === 'first-match' || (this.partialMatchMode === 'only-match' && items.length === 1)) {
344
+ // Skip an item that is not yet loaded. Once the item is loaded,
345
+ // the focused index is updated again.
346
+ return items[0] instanceof ComboBoxPlaceholder ? -1 : 0;
347
+ }
348
+
349
+ return -1;
350
+ }
285
351
  };
@@ -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
 
@@ -8,16 +8,22 @@ import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin
8
8
 
9
9
  export const ComboBoxOverlayMixin = (superClass) =>
10
10
  class ComboBoxOverlayMixin extends PositionMixin(superClass) {
11
- static get observers() {
12
- return ['_setOverlayWidth(positionTarget, opened)'];
13
- }
14
-
15
11
  constructor() {
16
12
  super();
17
13
 
18
14
  this.requiredVerticalSpace = 200;
19
15
  }
20
16
 
17
+ /** @protected */
18
+ willUpdate(props) {
19
+ super.willUpdate(props);
20
+
21
+ // Update width here so that `PositionMixin` uses correct width in `updated()`.
22
+ if ((props.has('opened') || props.has('positionTarget')) && this.opened && this.positionTarget) {
23
+ this._updateOverlayWidth();
24
+ }
25
+ }
26
+
21
27
  /**
22
28
  * Override method inherited from `Overlay`
23
29
  * to not close on position target click.
@@ -49,13 +55,4 @@ export const ComboBoxOverlayMixin = (superClass) =>
49
55
  _updateOverlayWidth() {
50
56
  this.style.setProperty(`--_${this.localName}-default-width`, `${this.positionTarget.offsetWidth}px`);
51
57
  }
52
-
53
- /** @private */
54
- _setOverlayWidth(positionTarget, opened) {
55
- if (positionTarget && opened) {
56
- this._updateOverlayWidth();
57
-
58
- this._updatePosition();
59
- }
60
- }
61
58
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2015 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ /**
8
+ * Placeholder object class representing items being loaded.
9
+ *
10
+ * @private
11
+ */
12
+ declare class ComboBoxPlaceholder {
13
+ // Nominal brand: keeps structurally similar values from being assignable
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-private-class-members
15
+ private __comboBoxPlaceholder: true;
16
+
17
+ toString(): string;
18
+ }
19
+
20
+ export { ComboBoxPlaceholder };
@@ -30,6 +30,7 @@ export {
30
30
  ComboBoxDataProviderCallback,
31
31
  ComboBoxDataProviderParams,
32
32
  } from './vaadin-combo-box-data-provider-mixin.js';
33
+ export { ComboBoxPartialMatchMode } from './vaadin-combo-box-items-mixin.js';
33
34
  export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
34
35
 
35
36
  /**
@@ -167,14 +168,6 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
167
168
  *
168
169
  * ### Styling
169
170
  *
170
- * The following custom properties are available for styling:
171
- *
172
- * Custom property | Description | Default
173
- * ----------------------------------------|----------------------------|---------
174
- * `--vaadin-field-default-width` | Default width of the field | `12em`
175
- * `--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`
176
- * `--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
177
- *
178
171
  * The following shadow DOM parts are available for styling:
179
172
  *
180
173
  * Part name | Description
@@ -208,6 +201,48 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
208
201
  * `opened` | Set when the overlay is opened
209
202
  * `loading` | Set when loading items from the data provider
210
203
  *
204
+ * The following custom CSS properties are available for styling:
205
+ *
206
+ * Custom CSS property |
207
+ * :--------------------------------------------------|
208
+ * | `--vaadin-combo-box-overlay-max-height` |
209
+ * | `--vaadin-combo-box-overlay-width` |
210
+ * | `--vaadin-field-default-width` |
211
+ * | `--vaadin-input-field-background` |
212
+ * | `--vaadin-input-field-border-color` |
213
+ * | `--vaadin-input-field-border-radius` |
214
+ * | `--vaadin-input-field-border-width` |
215
+ * | `--vaadin-input-field-bottom-end-radius` |
216
+ * | `--vaadin-input-field-bottom-start-radius` |
217
+ * | `--vaadin-input-field-button-text-color` |
218
+ * | `--vaadin-input-field-container-gap` |
219
+ * | `--vaadin-input-field-disabled-background` |
220
+ * | `--vaadin-input-field-disabled-text-color` |
221
+ * | `--vaadin-input-field-error-color` |
222
+ * | `--vaadin-input-field-error-font-size` |
223
+ * | `--vaadin-input-field-error-font-weight` |
224
+ * | `--vaadin-input-field-error-line-height` |
225
+ * | `--vaadin-input-field-gap` |
226
+ * | `--vaadin-input-field-helper-color` |
227
+ * | `--vaadin-input-field-helper-font-size` |
228
+ * | `--vaadin-input-field-helper-font-weight` |
229
+ * | `--vaadin-input-field-helper-line-height` |
230
+ * | `--vaadin-input-field-label-color` |
231
+ * | `--vaadin-input-field-label-font-size` |
232
+ * | `--vaadin-input-field-label-font-weight` |
233
+ * | `--vaadin-input-field-label-line-height` |
234
+ * | `--vaadin-input-field-padding` |
235
+ * | `--vaadin-input-field-placeholder-color` |
236
+ * | `--vaadin-input-field-required-indicator` |
237
+ * | `--vaadin-input-field-required-indicator-color` |
238
+ * | `--vaadin-input-field-top-end-radius` |
239
+ * | `--vaadin-input-field-top-start-radius` |
240
+ * | `--vaadin-input-field-value-color` |
241
+ * | `--vaadin-input-field-value-font-size` |
242
+ * | `--vaadin-input-field-value-font-weight` |
243
+ * | `--vaadin-input-field-value-line-height` |
244
+ * | `--vaadin-item-overlay-padding` |
245
+ *
211
246
  * ### Internal components
212
247
  *
213
248
  * In addition to `<vaadin-combo-box>` itself, the following internal
@@ -100,14 +100,6 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
100
100
  *
101
101
  * ### Styling
102
102
  *
103
- * The following custom properties are available for styling:
104
- *
105
- * Custom property | Description | Default
106
- * ----------------------------------------|----------------------------|---------
107
- * `--vaadin-field-default-width` | Default width of the field | `12em`
108
- * `--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`
109
- * `--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
110
- *
111
103
  * The following shadow DOM parts are available for styling:
112
104
  *
113
105
  * Part name | Description
@@ -141,6 +133,48 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
141
133
  * `opened` | Set when the overlay is opened
142
134
  * `loading` | Set when loading items from the data provider
143
135
  *
136
+ * The following custom CSS properties are available for styling:
137
+ *
138
+ * Custom CSS property |
139
+ * :--------------------------------------------------|
140
+ * | `--vaadin-combo-box-overlay-max-height` |
141
+ * | `--vaadin-combo-box-overlay-width` |
142
+ * | `--vaadin-field-default-width` |
143
+ * | `--vaadin-input-field-background` |
144
+ * | `--vaadin-input-field-border-color` |
145
+ * | `--vaadin-input-field-border-radius` |
146
+ * | `--vaadin-input-field-border-width` |
147
+ * | `--vaadin-input-field-bottom-end-radius` |
148
+ * | `--vaadin-input-field-bottom-start-radius` |
149
+ * | `--vaadin-input-field-button-text-color` |
150
+ * | `--vaadin-input-field-container-gap` |
151
+ * | `--vaadin-input-field-disabled-background` |
152
+ * | `--vaadin-input-field-disabled-text-color` |
153
+ * | `--vaadin-input-field-error-color` |
154
+ * | `--vaadin-input-field-error-font-size` |
155
+ * | `--vaadin-input-field-error-font-weight` |
156
+ * | `--vaadin-input-field-error-line-height` |
157
+ * | `--vaadin-input-field-gap` |
158
+ * | `--vaadin-input-field-helper-color` |
159
+ * | `--vaadin-input-field-helper-font-size` |
160
+ * | `--vaadin-input-field-helper-font-weight` |
161
+ * | `--vaadin-input-field-helper-line-height` |
162
+ * | `--vaadin-input-field-label-color` |
163
+ * | `--vaadin-input-field-label-font-size` |
164
+ * | `--vaadin-input-field-label-font-weight` |
165
+ * | `--vaadin-input-field-label-line-height` |
166
+ * | `--vaadin-input-field-padding` |
167
+ * | `--vaadin-input-field-placeholder-color` |
168
+ * | `--vaadin-input-field-required-indicator` |
169
+ * | `--vaadin-input-field-required-indicator-color` |
170
+ * | `--vaadin-input-field-top-end-radius` |
171
+ * | `--vaadin-input-field-top-start-radius` |
172
+ * | `--vaadin-input-field-value-color` |
173
+ * | `--vaadin-input-field-value-font-size` |
174
+ * | `--vaadin-input-field-value-font-weight` |
175
+ * | `--vaadin-input-field-value-line-height` |
176
+ * | `--vaadin-item-overlay-padding` |
177
+ *
144
178
  * ### Internal components
145
179
  *
146
180
  * In addition to `<vaadin-combo-box>` itself, the following internal
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-alpha9",
4
+ "version": "25.3.0-beta2",
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-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/25.3.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/25.3.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\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-alpha9/#/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-beta2/#/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-beta2/#/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-beta2/#/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 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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\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-beta2/#/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",
@@ -217,6 +217,15 @@
217
217
  ]
218
218
  }
219
219
  },
220
+ {
221
+ "name": "partial-match-mode",
222
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
223
+ "value": {
224
+ "type": [
225
+ "string"
226
+ ]
227
+ }
228
+ },
220
229
  {
221
230
  "name": "pattern",
222
231
  "description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
@@ -549,6 +558,15 @@
549
558
  ]
550
559
  }
551
560
  },
561
+ {
562
+ "name": "partialMatchMode",
563
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
564
+ "value": {
565
+ "type": [
566
+ "string"
567
+ ]
568
+ }
569
+ },
552
570
  {
553
571
  "name": "pattern",
554
572
  "description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
@@ -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-alpha9",
4
+ "version": "25.3.0-beta2",
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-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/25.3.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/25.3.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\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-alpha9/#/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-beta2/#/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-beta2/#/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-beta2/#/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 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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\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-beta2/#/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
  {
@@ -215,6 +215,13 @@
215
215
  "kind": "expression"
216
216
  }
217
217
  },
218
+ {
219
+ "name": ".partialMatchMode",
220
+ "description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
221
+ "value": {
222
+ "kind": "expression"
223
+ }
224
+ },
218
225
  {
219
226
  "name": ".pattern",
220
227
  "description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",