@vaadin/combo-box 23.2.0-rc1 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +13 -13
- package/src/vaadin-combo-box-item.js +1 -1
- package/src/vaadin-combo-box.d.ts +1 -1
- package/src/vaadin-combo-box.js +1 -1
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component for choosing a value from a filterable list of options presented in an overlay.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/combo-box)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/combo-box)
|
|
8
8
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -24,7 +24,7 @@ A web component for choosing a value from a filterable list of options presented
|
|
|
24
24
|
</script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/combo-box/screenshot.png" width="208" alt="Screenshot of vaadin-combo-box">](https://vaadin.com/docs/latest/
|
|
27
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/combo-box/screenshot.png" width="208" alt="Screenshot of vaadin-combo-box">](https://vaadin.com/docs/latest/components/combo-box)
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
@@ -42,7 +42,7 @@ import '@vaadin/combo-box';
|
|
|
42
42
|
|
|
43
43
|
## Themes
|
|
44
44
|
|
|
45
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
45
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
46
46
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/combo-box/vaadin-combo-box.js) of the package uses the Lumo theme.
|
|
47
47
|
|
|
48
48
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -65,7 +65,7 @@ import '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
|
65
65
|
|
|
66
66
|
## Contributing
|
|
67
67
|
|
|
68
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
68
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
69
69
|
|
|
70
70
|
## License
|
|
71
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "23.2.0
|
|
3
|
+
"version": "23.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/component-base": "23.2.0
|
|
42
|
-
"@vaadin/field-base": "23.2.0
|
|
43
|
-
"@vaadin/input-container": "23.2.0
|
|
44
|
-
"@vaadin/item": "23.2.0
|
|
45
|
-
"@vaadin/lit-renderer": "23.2.0
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "23.2.0
|
|
47
|
-
"@vaadin/vaadin-material-styles": "23.2.0
|
|
48
|
-
"@vaadin/vaadin-overlay": "23.2.0
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "23.2.0
|
|
41
|
+
"@vaadin/component-base": "^23.2.0",
|
|
42
|
+
"@vaadin/field-base": "^23.2.0",
|
|
43
|
+
"@vaadin/input-container": "^23.2.0",
|
|
44
|
+
"@vaadin/item": "^23.2.0",
|
|
45
|
+
"@vaadin/lit-renderer": "^23.2.0",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "^23.2.0",
|
|
47
|
+
"@vaadin/vaadin-material-styles": "^23.2.0",
|
|
48
|
+
"@vaadin/vaadin-overlay": "^23.2.0",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "^23.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@esm-bundle/chai": "^4.3.4",
|
|
53
|
-
"@vaadin/polymer-legacy-adapter": "23.2.0
|
|
53
|
+
"@vaadin/polymer-legacy-adapter": "^23.2.0",
|
|
54
54
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
55
|
-
"@vaadin/text-field": "23.2.0
|
|
55
|
+
"@vaadin/text-field": "^23.2.0",
|
|
56
56
|
"lit": "^2.0.0",
|
|
57
57
|
"sinon": "^13.0.2"
|
|
58
58
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "8b1f5941f26ac41ca038e75e24c8584e331bc7a8"
|
|
64
64
|
}
|
|
@@ -26,7 +26,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
26
26
|
* `selected` | Set when the item is selected
|
|
27
27
|
* `focused` | Set when the item is focused
|
|
28
28
|
*
|
|
29
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
29
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
30
30
|
*
|
|
31
31
|
* @mixes ThemableMixin
|
|
32
32
|
* @mixes DirMixin
|
|
@@ -207,7 +207,7 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
|
|
|
207
207
|
* Note: the `theme` attribute value set on `<vaadin-combo-box>` is
|
|
208
208
|
* propagated to the internal components listed above.
|
|
209
209
|
*
|
|
210
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
210
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
211
211
|
*
|
|
212
212
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
213
213
|
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -138,7 +138,7 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-b
|
|
|
138
138
|
* Note: the `theme` attribute value set on `<vaadin-combo-box>` is
|
|
139
139
|
* propagated to the internal components listed above.
|
|
140
140
|
*
|
|
141
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
141
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
142
142
|
*
|
|
143
143
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
144
144
|
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/combo-box",
|
|
4
|
-
"version": "23.2.0
|
|
4
|
+
"version": "23.2.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
},
|
|
383
383
|
{
|
|
384
384
|
"name": "vaadin-combo-box",
|
|
385
|
-
"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/23.2.0
|
|
385
|
+
"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/23.2.0/#/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/23.2.0/#/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/23.2.0/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ncomboBox.dataProvider = function(params, callback) {\n var url = 'https://api.example/data' +\n '?page=' + params.page + // the requested page index\n '&per_page=' + params.pageSize; // number of items on the page\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n var response = JSON.parse(xhr.responseText);\n callback(\n response.employees, // requested page of items\n response.totalSize // total number of items\n );\n };\n xhr.open('GET', url, true);\n xhr.send();\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-combo-box-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-combo-box>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
386
386
|
"attributes": [
|
|
387
387
|
{
|
|
388
388
|
"name": "disabled",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/combo-box",
|
|
4
|
-
"version": "23.2.0
|
|
4
|
+
"version": "23.2.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
"name": "vaadin-combo-box",
|
|
208
|
-
"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/23.2.0
|
|
208
|
+
"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/23.2.0/#/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/23.2.0/#/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/23.2.0/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ncomboBox.dataProvider = function(params, callback) {\n var url = 'https://api.example/data' +\n '?page=' + params.page + // the requested page index\n '&per_page=' + params.pageSize; // number of items on the page\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n var response = JSON.parse(xhr.responseText);\n callback(\n response.employees, // requested page of items\n response.totalSize // total number of items\n );\n };\n xhr.open('GET', url, true);\n xhr.send();\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-combo-box-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-combo-box>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
209
209
|
"extension": true,
|
|
210
210
|
"attributes": [
|
|
211
211
|
{
|