@vaadin/combo-box 25.3.0-dev.1fa5a51482 → 25.3.0-rc1

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.
@@ -519,6 +519,16 @@
519
519
  "description": "A subset of items, filtered based on the user input. Filtered items\ncan be assigned directly to omit the internal filtering functionality.\nThe items can be of either `String` or `Object` type.",
520
520
  "attribute": "filtered-items"
521
521
  },
522
+ {
523
+ "kind": "field",
524
+ "name": "itemIdPath",
525
+ "privacy": "public",
526
+ "type": {
527
+ "text": "string"
528
+ },
529
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
530
+ "attribute": "item-id-path"
531
+ },
522
532
  {
523
533
  "kind": "field",
524
534
  "name": "itemLabelGenerator",
@@ -582,6 +592,16 @@
582
592
  "module": "src/vaadin-combo-box-base-mixin.js"
583
593
  }
584
594
  },
595
+ {
596
+ "kind": "field",
597
+ "name": "partialMatchMode",
598
+ "privacy": "public",
599
+ "type": {
600
+ "text": "string"
601
+ },
602
+ "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`.",
603
+ "attribute": "partial-match-mode"
604
+ },
585
605
  {
586
606
  "kind": "field",
587
607
  "name": "readonly",
@@ -596,6 +616,11 @@
596
616
  "module": "src/vaadin-combo-box-base-mixin.js"
597
617
  }
598
618
  },
619
+ {
620
+ "kind": "method",
621
+ "name": "requestContentUpdate",
622
+ "description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested."
623
+ },
599
624
  {
600
625
  "kind": "field",
601
626
  "name": "value",
@@ -644,6 +669,14 @@
644
669
  "description": "Filtering string the user has typed into the input field.",
645
670
  "fieldName": "filter"
646
671
  },
672
+ {
673
+ "name": "item-id-path",
674
+ "type": {
675
+ "text": "string"
676
+ },
677
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
678
+ "fieldName": "itemIdPath"
679
+ },
647
680
  {
648
681
  "name": "item-label-path",
649
682
  "type": {
@@ -672,6 +705,14 @@
672
705
  "module": "src/vaadin-combo-box-base-mixin.js"
673
706
  }
674
707
  },
708
+ {
709
+ "name": "partial-match-mode",
710
+ "type": {
711
+ "text": "string"
712
+ },
713
+ "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`.",
714
+ "fieldName": "partialMatchMode"
715
+ },
675
716
  {
676
717
  "name": "readonly",
677
718
  "type": {
@@ -864,8 +905,12 @@
864
905
  "type": {
865
906
  "text": "string"
866
907
  },
867
- "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin `selectedItem` and `filteredItems` (items given by the\n`dataProvider` callback).",
868
- "attribute": "item-id-path"
908
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
909
+ "attribute": "item-id-path",
910
+ "inheritedFrom": {
911
+ "name": "ComboBoxItemsMixin",
912
+ "module": "src/vaadin-combo-box-items-mixin.js"
913
+ }
869
914
  },
870
915
  {
871
916
  "kind": "field",
@@ -970,6 +1015,20 @@
970
1015
  "module": "src/vaadin-combo-box-base-mixin.js"
971
1016
  }
972
1017
  },
1018
+ {
1019
+ "kind": "field",
1020
+ "name": "partialMatchMode",
1021
+ "privacy": "public",
1022
+ "type": {
1023
+ "text": "string"
1024
+ },
1025
+ "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`.",
1026
+ "attribute": "partial-match-mode",
1027
+ "inheritedFrom": {
1028
+ "name": "ComboBoxItemsMixin",
1029
+ "module": "src/vaadin-combo-box-items-mixin.js"
1030
+ }
1031
+ },
973
1032
  {
974
1033
  "kind": "field",
975
1034
  "name": "readonly",
@@ -997,7 +1056,11 @@
997
1056
  {
998
1057
  "kind": "method",
999
1058
  "name": "requestContentUpdate",
1000
- "description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested."
1059
+ "description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
1060
+ "inheritedFrom": {
1061
+ "name": "ComboBoxItemsMixin",
1062
+ "module": "src/vaadin-combo-box-items-mixin.js"
1063
+ }
1001
1064
  },
1002
1065
  {
1003
1066
  "kind": "field",
@@ -1144,8 +1207,12 @@
1144
1207
  "type": {
1145
1208
  "text": "string"
1146
1209
  },
1147
- "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin `selectedItem` and `filteredItems` (items given by the\n`dataProvider` callback).",
1148
- "fieldName": "itemIdPath"
1210
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
1211
+ "fieldName": "itemIdPath",
1212
+ "inheritedFrom": {
1213
+ "name": "ComboBoxItemsMixin",
1214
+ "module": "src/vaadin-combo-box-items-mixin.js"
1215
+ }
1149
1216
  },
1150
1217
  {
1151
1218
  "name": "item-label-path",
@@ -1203,6 +1270,18 @@
1203
1270
  "module": "src/vaadin-combo-box-base-mixin.js"
1204
1271
  }
1205
1272
  },
1273
+ {
1274
+ "name": "partial-match-mode",
1275
+ "type": {
1276
+ "text": "string"
1277
+ },
1278
+ "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`.",
1279
+ "fieldName": "partialMatchMode",
1280
+ "inheritedFrom": {
1281
+ "name": "ComboBoxItemsMixin",
1282
+ "module": "src/vaadin-combo-box-items-mixin.js"
1283
+ }
1284
+ },
1206
1285
  {
1207
1286
  "name": "readonly",
1208
1287
  "type": {
@@ -1525,16 +1604,6 @@
1525
1604
  "description": "A function used to generate CSS class names for dropdown\nitems based on the item. The return value should be the\ngenerated class name as a string, or multiple class names\nseparated by whitespace characters.",
1526
1605
  "attribute": "item-class-name-generator"
1527
1606
  },
1528
- {
1529
- "kind": "field",
1530
- "name": "itemIdPath",
1531
- "privacy": "public",
1532
- "type": {
1533
- "text": "string"
1534
- },
1535
- "description": "Path for the id of the item, used to detect whether the item is selected.",
1536
- "attribute": "item-id-path"
1537
- },
1538
1607
  {
1539
1608
  "kind": "field",
1540
1609
  "name": "items",
@@ -1655,14 +1724,6 @@
1655
1724
  "description": "Index of an item that has focus outline and is scrolled into view.\nThe actual focus still remains in the input field.",
1656
1725
  "fieldName": "focusedIndex"
1657
1726
  },
1658
- {
1659
- "name": "item-id-path",
1660
- "type": {
1661
- "text": "string"
1662
- },
1663
- "description": "Path for the id of the item, used to detect whether the item is selected.",
1664
- "fieldName": "itemIdPath"
1665
- },
1666
1727
  {
1667
1728
  "name": "items",
1668
1729
  "type": {
@@ -1720,9 +1781,23 @@
1720
1781
  "declarations": [
1721
1782
  {
1722
1783
  "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.",
1784
+ "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
1785
  "name": "ComboBox",
1725
1786
  "members": [
1787
+ {
1788
+ "kind": "field",
1789
+ "name": "accessibleDescriptionRef",
1790
+ "privacy": "public",
1791
+ "type": {
1792
+ "text": "string"
1793
+ },
1794
+ "description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
1795
+ "attribute": "accessible-description-ref",
1796
+ "inheritedFrom": {
1797
+ "name": "FieldMixin",
1798
+ "package": "@vaadin/field-base/src/field-mixin.js"
1799
+ }
1800
+ },
1726
1801
  {
1727
1802
  "kind": "field",
1728
1803
  "name": "accessibleName",
@@ -1730,7 +1805,7 @@
1730
1805
  "type": {
1731
1806
  "text": "string"
1732
1807
  },
1733
- "description": "String used to label the component to screen reader users.",
1808
+ "description": "String used to label the component for screen reader users.",
1734
1809
  "attribute": "accessible-name",
1735
1810
  "inheritedFrom": {
1736
1811
  "name": "FieldMixin",
@@ -1744,7 +1819,7 @@
1744
1819
  "type": {
1745
1820
  "text": "string"
1746
1821
  },
1747
- "description": "Id of the element used as label of the component to screen reader users.",
1822
+ "description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
1748
1823
  "attribute": "accessible-name-ref",
1749
1824
  "inheritedFrom": {
1750
1825
  "name": "FieldMixin",
@@ -2004,11 +2079,11 @@
2004
2079
  "type": {
2005
2080
  "text": "string"
2006
2081
  },
2007
- "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin `selectedItem` and `filteredItems` (items given by the\n`dataProvider` callback).",
2082
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
2008
2083
  "attribute": "item-id-path",
2009
2084
  "inheritedFrom": {
2010
- "name": "ComboBoxMixin",
2011
- "module": "src/vaadin-combo-box-mixin.js"
2085
+ "name": "ComboBoxItemsMixin",
2086
+ "module": "src/vaadin-combo-box-items-mixin.js"
2012
2087
  }
2013
2088
  },
2014
2089
  {
@@ -2160,6 +2235,20 @@
2160
2235
  "module": "src/vaadin-combo-box-data-provider-mixin.js"
2161
2236
  }
2162
2237
  },
2238
+ {
2239
+ "kind": "field",
2240
+ "name": "partialMatchMode",
2241
+ "privacy": "public",
2242
+ "type": {
2243
+ "text": "string"
2244
+ },
2245
+ "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`.",
2246
+ "attribute": "partial-match-mode",
2247
+ "inheritedFrom": {
2248
+ "name": "ComboBoxItemsMixin",
2249
+ "module": "src/vaadin-combo-box-items-mixin.js"
2250
+ }
2251
+ },
2163
2252
  {
2164
2253
  "kind": "field",
2165
2254
  "name": "pattern",
@@ -2221,8 +2310,8 @@
2221
2310
  "name": "requestContentUpdate",
2222
2311
  "description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
2223
2312
  "inheritedFrom": {
2224
- "name": "ComboBoxMixin",
2225
- "module": "src/vaadin-combo-box-mixin.js"
2313
+ "name": "ComboBoxItemsMixin",
2314
+ "module": "src/vaadin-combo-box-items-mixin.js"
2226
2315
  }
2227
2316
  },
2228
2317
  {
@@ -2399,12 +2488,24 @@
2399
2488
  }
2400
2489
  ],
2401
2490
  "attributes": [
2491
+ {
2492
+ "name": "accessible-description-ref",
2493
+ "type": {
2494
+ "text": "string"
2495
+ },
2496
+ "description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
2497
+ "fieldName": "accessibleDescriptionRef",
2498
+ "inheritedFrom": {
2499
+ "name": "FieldMixin",
2500
+ "package": "@vaadin/field-base/src/field-mixin.js"
2501
+ }
2502
+ },
2402
2503
  {
2403
2504
  "name": "accessible-name",
2404
2505
  "type": {
2405
2506
  "text": "string"
2406
2507
  },
2407
- "description": "String used to label the component to screen reader users.",
2508
+ "description": "String used to label the component for screen reader users.",
2408
2509
  "fieldName": "accessibleName",
2409
2510
  "inheritedFrom": {
2410
2511
  "name": "FieldMixin",
@@ -2416,7 +2517,7 @@
2416
2517
  "type": {
2417
2518
  "text": "string"
2418
2519
  },
2419
- "description": "Id of the element used as label of the component to screen reader users.",
2520
+ "description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
2420
2521
  "fieldName": "accessibleNameRef",
2421
2522
  "inheritedFrom": {
2422
2523
  "name": "FieldMixin",
@@ -2572,11 +2673,11 @@
2572
2673
  "type": {
2573
2674
  "text": "string"
2574
2675
  },
2575
- "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin `selectedItem` and `filteredItems` (items given by the\n`dataProvider` callback).",
2676
+ "description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
2576
2677
  "fieldName": "itemIdPath",
2577
2678
  "inheritedFrom": {
2578
- "name": "ComboBoxMixin",
2579
- "module": "src/vaadin-combo-box-mixin.js"
2679
+ "name": "ComboBoxItemsMixin",
2680
+ "module": "src/vaadin-combo-box-items-mixin.js"
2580
2681
  }
2581
2682
  },
2582
2683
  {
@@ -2675,6 +2776,18 @@
2675
2776
  "module": "src/vaadin-combo-box-data-provider-mixin.js"
2676
2777
  }
2677
2778
  },
2779
+ {
2780
+ "name": "partial-match-mode",
2781
+ "type": {
2782
+ "text": "string"
2783
+ },
2784
+ "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`.",
2785
+ "fieldName": "partialMatchMode",
2786
+ "inheritedFrom": {
2787
+ "name": "ComboBoxItemsMixin",
2788
+ "module": "src/vaadin-combo-box-items-mixin.js"
2789
+ }
2790
+ },
2678
2791
  {
2679
2792
  "name": "pattern",
2680
2793
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/combo-box",
3
- "version": "25.3.0-dev.1fa5a51482",
3
+ "version": "25.3.0-rc1",
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-dev.1fa5a51482",
40
- "@vaadin/component-base": "25.3.0-dev.1fa5a51482",
41
- "@vaadin/field-base": "25.3.0-dev.1fa5a51482",
42
- "@vaadin/input-container": "25.3.0-dev.1fa5a51482",
43
- "@vaadin/item": "25.3.0-dev.1fa5a51482",
44
- "@vaadin/lit-renderer": "25.3.0-dev.1fa5a51482",
45
- "@vaadin/overlay": "25.3.0-dev.1fa5a51482",
46
- "@vaadin/vaadin-themable-mixin": "25.3.0-dev.1fa5a51482",
39
+ "@vaadin/a11y-base": "25.3.0-rc1",
40
+ "@vaadin/component-base": "25.3.0-rc1",
41
+ "@vaadin/field-base": "25.3.0-rc1",
42
+ "@vaadin/input-container": "25.3.0-rc1",
43
+ "@vaadin/item": "25.3.0-rc1",
44
+ "@vaadin/lit-renderer": "25.3.0-rc1",
45
+ "@vaadin/overlay": "25.3.0-rc1",
46
+ "@vaadin/vaadin-themable-mixin": "25.3.0-rc1",
47
47
  "lit": "^3.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@vaadin/aura": "25.3.0-dev.1fa5a51482",
51
- "@vaadin/chai-plugins": "25.3.0-dev.1fa5a51482",
52
- "@vaadin/test-runner-commands": "25.3.0-dev.1fa5a51482",
50
+ "@vaadin/aura": "25.3.0-rc1",
51
+ "@vaadin/chai-plugins": "25.3.0-rc1",
52
+ "@vaadin/test-runner-commands": "25.3.0-rc1",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.3.0-dev.1fa5a51482",
54
+ "@vaadin/vaadin-lumo-styles": "25.3.0-rc1",
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": "1cd5964b758ffbce3ddb6248a1997f55f8e0ebf6"
62
+ "gitHead": "d4809590b2f61bd607e376ab3dec84f4bfb059a7"
63
63
  }
@@ -8,8 +8,8 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
8
8
  import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
9
9
  import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
10
10
  import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
11
+ import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
11
12
  import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
12
- import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
13
13
  import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
14
14
 
15
15
  export const ComboBoxBaseMixin = (superClass) =>
@@ -168,8 +168,24 @@ export const ComboBoxBaseMixin = (superClass) =>
168
168
  if (this.clearElement) {
169
169
  this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
170
170
  }
171
+ }
172
+
173
+ /** @protected */
174
+ updated(props) {
175
+ super.updated(props);
171
176
 
172
- this.addController(new VirtualKeyboardController(this));
177
+ // Note: `loading` is only declared by components that support a data provider.
178
+ if (props.has('opened') || props.has('_dropdownItems') || props.has('loading')) {
179
+ // Close the overlay if there are no items to display.
180
+ // See https://github.com/vaadin/vaadin-combo-box/pull/964
181
+ this._overlayOpened = this.opened && (!!this.loading || this._hasDropdownItems);
182
+ }
183
+
184
+ // Update the scroller only once the overlay is actually opened, so that the
185
+ // virtualizer does not measure and render items while the overlay is hidden.
186
+ if (['_overlayOpened', '_dropdownItems', '_focusedIndex', '_theme'].some((prop) => props.has(prop))) {
187
+ this._updateScroller();
188
+ }
173
189
  }
174
190
 
175
191
  /** @protected */
@@ -250,6 +266,29 @@ export const ComboBoxBaseMixin = (superClass) =>
250
266
  this.appendChild(scroller);
251
267
  }
252
268
 
269
+ /**
270
+ * Update the scroller to reflect the dropdown items, the focused item
271
+ * and whether the overlay is opened.
272
+ * @protected
273
+ */
274
+ _updateScroller() {
275
+ const opened = this._overlayOpened;
276
+
277
+ if (opened) {
278
+ this._scroller.style.maxHeight =
279
+ getComputedStyle(this).getPropertyValue(`--${this._tagNamePrefix}-overlay-max-height`) || '65vh';
280
+ }
281
+
282
+ const isClosing = this.hasAttribute('closing');
283
+
284
+ this._scroller.setProperties({
285
+ items: opened || isClosing ? this._dropdownItems : [],
286
+ opened,
287
+ focusedIndex: this._focusedIndex,
288
+ theme: this._theme,
289
+ });
290
+ }
291
+
253
292
  /**
254
293
  * @type {boolean}
255
294
  * @protected
@@ -288,11 +327,7 @@ export const ComboBoxBaseMixin = (superClass) =>
288
327
  }
289
328
 
290
329
  const item = this._getItemElements().find((el) => el.index === index);
291
- if (item) {
292
- input.setAttribute('aria-activedescendant', item.id);
293
- } else {
294
- input.removeAttribute('aria-activedescendant');
295
- }
330
+ setOrRemoveAttribute(input, 'aria-activedescendant', item?.id);
296
331
  }
297
332
 
298
333
  /** @private */
@@ -325,11 +360,7 @@ export const ComboBoxBaseMixin = (superClass) =>
325
360
  if (input) {
326
361
  input.setAttribute('aria-expanded', !!opened);
327
362
 
328
- if (opened) {
329
- input.setAttribute('aria-controls', this._scroller.id);
330
- } else {
331
- input.removeAttribute('aria-controls');
332
- }
363
+ setOrRemoveAttribute(input, 'aria-controls', opened && this._scroller.id);
333
364
  }
334
365
  }
335
366
 
@@ -456,6 +487,18 @@ export const ComboBoxBaseMixin = (superClass) =>
456
487
  return item ? item.toString() : '';
457
488
  }
458
489
 
490
+ /**
491
+ * Returns true when both items refer to the same item.
492
+ * Override to provide logic for item id path.
493
+ * @param {unknown} item
494
+ * @param {unknown} other
495
+ * @return {boolean}
496
+ * @protected
497
+ */
498
+ _isSameItem(item, other) {
499
+ return item === other;
500
+ }
501
+
459
502
  /** @private */
460
503
  _onArrowDown() {
461
504
  if (this.opened) {
@@ -120,10 +120,8 @@ export const ComboBoxDataProviderMixin = (superClass) =>
120
120
  if (this.__previousDataProviderFilter !== filter) {
121
121
  this.__previousDataProviderFilter = filter;
122
122
 
123
- this.__keepOverlayOpened = true;
124
- this.size = undefined;
123
+ this.__dataProviderController.rootCache.size = undefined;
125
124
  this.clearCache();
126
- this.__keepOverlayOpened = false;
127
125
  }
128
126
  }
129
127
 
@@ -152,7 +150,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
152
150
 
153
151
  /** @private */
154
152
  __onDataProviderPageRequested() {
155
- this.loading = true;
153
+ this.__synchronizeControllerState();
156
154
  }
157
155
 
158
156
  /** @private */
@@ -179,14 +177,18 @@ export const ComboBoxDataProviderMixin = (superClass) =>
179
177
 
180
178
  this.__dataProviderController.clearCache();
181
179
 
182
- this.__synchronizeControllerState();
183
-
180
+ // Request the first page before synchronizing the component state.
181
+ // Otherwise the component would observe an intermediate state where
182
+ // the items are empty but no request is pending, which would close
183
+ // the overlay and re-open it right away.
184
184
  if (this._shouldFetchData()) {
185
185
  this._forceNextRequest = false;
186
186
  this.__dataProviderController.loadFirstPage();
187
187
  } else {
188
188
  this._forceNextRequest = true;
189
189
  }
190
+
191
+ this.__synchronizeControllerState();
190
192
  }
191
193
 
192
194
  /**
@@ -240,9 +242,13 @@ export const ComboBoxDataProviderMixin = (superClass) =>
240
242
  // will be requested in the `ready()` callback.
241
243
  if (this.__dataProviderInitialized && this.dataProvider) {
242
244
  const { rootCache } = this.__dataProviderController;
243
- this.size = rootCache.size;
244
- this.filteredItems = rootCache.items;
245
- this.loading = this.__dataProviderController.isLoading();
245
+ // Apply all properties in one update so that observers depending on
246
+ // several of them never see a partially synchronized state.
247
+ this.setProperties({
248
+ size: rootCache.size,
249
+ filteredItems: rootCache.items,
250
+ loading: this.__dataProviderController.isLoading(),
251
+ });
246
252
  }
247
253
  }
248
254
 
@@ -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
  }
@@ -38,9 +38,7 @@ import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
38
38
  * @customElement vaadin-combo-box-item
39
39
  * @private
40
40
  */
41
- export class ComboBoxItem extends ComboBoxItemMixin(
42
- ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
43
- ) {
41
+ class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
44
42
  static get is() {
45
43
  return 'vaadin-combo-box-item';
46
44
  }
@@ -61,3 +59,5 @@ export class ComboBoxItem extends ComboBoxItemMixin(
61
59
  }
62
60
 
63
61
  defineCustomElement(ComboBoxItem);
62
+
63
+ export { ComboBoxItem };