@vaadin/select 25.3.0-alpha6 → 25.3.0-alpha7
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/custom-elements.json +3 -1
- package/package.json +16 -16
- package/src/vaadin-select-base-mixin.d.ts +2 -0
- package/src/vaadin-select-base-mixin.js +14 -26
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -270,7 +270,8 @@
|
|
|
270
270
|
{
|
|
271
271
|
"kind": "method",
|
|
272
272
|
"name": "requestContentUpdate",
|
|
273
|
-
"description": "Requests an update for the content of the select.\nWhile performing the update, it invokes the renderer passed in the `renderer` property.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested."
|
|
273
|
+
"description": "Requests an update for the content of the select.\nWhile performing the update, it invokes the renderer passed in the `renderer` property.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
|
|
274
|
+
"deprecated": "This method is deprecated and will be removed in Vaadin 26"
|
|
274
275
|
},
|
|
275
276
|
{
|
|
276
277
|
"kind": "field",
|
|
@@ -1586,6 +1587,7 @@
|
|
|
1586
1587
|
"kind": "method",
|
|
1587
1588
|
"name": "requestContentUpdate",
|
|
1588
1589
|
"description": "Requests an update for the content of the select.\nWhile performing the update, it invokes the renderer passed in the `renderer` property.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
|
|
1590
|
+
"deprecated": "This method is deprecated and will be removed in Vaadin 26",
|
|
1589
1591
|
"inheritedFrom": {
|
|
1590
1592
|
"name": "SelectBaseMixin",
|
|
1591
1593
|
"module": "src/vaadin-select-base-mixin.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
41
|
-
"@vaadin/button": "25.3.0-
|
|
42
|
-
"@vaadin/component-base": "25.3.0-
|
|
43
|
-
"@vaadin/field-base": "25.3.0-
|
|
44
|
-
"@vaadin/input-container": "25.3.0-
|
|
45
|
-
"@vaadin/item": "25.3.0-
|
|
46
|
-
"@vaadin/list-box": "25.3.0-
|
|
47
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
48
|
-
"@vaadin/overlay": "25.3.0-
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.3.0-alpha7",
|
|
41
|
+
"@vaadin/button": "25.3.0-alpha7",
|
|
42
|
+
"@vaadin/component-base": "25.3.0-alpha7",
|
|
43
|
+
"@vaadin/field-base": "25.3.0-alpha7",
|
|
44
|
+
"@vaadin/input-container": "25.3.0-alpha7",
|
|
45
|
+
"@vaadin/item": "25.3.0-alpha7",
|
|
46
|
+
"@vaadin/list-box": "25.3.0-alpha7",
|
|
47
|
+
"@vaadin/lit-renderer": "25.3.0-alpha7",
|
|
48
|
+
"@vaadin/overlay": "25.3.0-alpha7",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha7",
|
|
50
50
|
"lit": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@vaadin/aura": "25.3.0-
|
|
54
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
55
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
53
|
+
"@vaadin/aura": "25.3.0-alpha7",
|
|
54
|
+
"@vaadin/chai-plugins": "25.3.0-alpha7",
|
|
55
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha7",
|
|
56
56
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
57
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
57
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha7",
|
|
58
58
|
"sinon": "^22.0.0"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "custom-elements.json",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"web-types.json",
|
|
63
63
|
"web-types.lit.json"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "ae7b9823df5598faebd7a482993029ee489c35ae"
|
|
66
66
|
}
|
|
@@ -112,6 +112,8 @@ export declare class SelectBaseMixinClass {
|
|
|
112
112
|
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
113
113
|
*
|
|
114
114
|
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
115
|
+
*
|
|
116
|
+
* @deprecated This method is deprecated and will be removed in Vaadin 26
|
|
115
117
|
*/
|
|
116
118
|
requestContentUpdate(): void;
|
|
117
119
|
}
|
|
@@ -10,7 +10,6 @@ import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mi
|
|
|
10
10
|
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
|
|
11
11
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
12
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
13
|
-
import { issueWarning } from '@vaadin/component-base/src/warnings.js';
|
|
14
13
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
15
14
|
import { LabelController } from '@vaadin/field-base/src/label-controller.js';
|
|
16
15
|
import { ButtonController } from './button-controller.js';
|
|
@@ -42,7 +41,6 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
42
41
|
*/
|
|
43
42
|
items: {
|
|
44
43
|
type: Array,
|
|
45
|
-
observer: '__itemsChanged',
|
|
46
44
|
},
|
|
47
45
|
|
|
48
46
|
/**
|
|
@@ -212,17 +210,21 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
212
210
|
this.toggleAttribute('phone', this._phone);
|
|
213
211
|
}
|
|
214
212
|
|
|
213
|
+
if (props.has('items') || props.has('renderer') || props.has('__slottedListBox')) {
|
|
214
|
+
if (this.__slottedListBox && (this.items?.length || this.renderer)) {
|
|
215
|
+
throw new Error(
|
|
216
|
+
'A slotted <vaadin-select-list-box> cannot be used together with the "items" or "renderer" property.',
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (props.has('items')) {
|
|
222
|
+
this._overlayElement.requestContentUpdate();
|
|
223
|
+
}
|
|
224
|
+
|
|
215
225
|
if (props.has('__slottedListBox')) {
|
|
216
226
|
const slottedListBox = this.__slottedListBox;
|
|
217
227
|
if (slottedListBox) {
|
|
218
|
-
// Slotted list-box takes precedence over the `renderer` and `items`.
|
|
219
|
-
if (this.items?.length || this.renderer) {
|
|
220
|
-
issueWarning(
|
|
221
|
-
'WARNING: Both a slotted <vaadin-select-list-box> and the "items" / "renderer"' +
|
|
222
|
-
' property are set on <vaadin-select>. The slotted list-box takes precedence.',
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
228
|
this._assignMenuElement(slottedListBox);
|
|
227
229
|
} else if (props.get('__slottedListBox')) {
|
|
228
230
|
this._menuElement = null;
|
|
@@ -237,6 +239,8 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
237
239
|
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
238
240
|
*
|
|
239
241
|
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
242
|
+
*
|
|
243
|
+
* @deprecated This method is deprecated and will be removed in Vaadin 26
|
|
240
244
|
*/
|
|
241
245
|
requestContentUpdate() {
|
|
242
246
|
if (!this._overlayElement) {
|
|
@@ -261,17 +265,6 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
261
265
|
}
|
|
262
266
|
}
|
|
263
267
|
|
|
264
|
-
/**
|
|
265
|
-
* @param {SelectItemData[] | undefined | null} newItems
|
|
266
|
-
* @param {SelectItemData[] | undefined | null} oldItems
|
|
267
|
-
* @private
|
|
268
|
-
*/
|
|
269
|
-
__itemsChanged(newItems, oldItems) {
|
|
270
|
-
if (newItems || oldItems) {
|
|
271
|
-
this.requestContentUpdate();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
268
|
/**
|
|
276
269
|
* Detects a `<vaadin-select-list-box>` slotted directly into the overlay
|
|
277
270
|
* slot (instead of the default one rendered into slotted `div` element).
|
|
@@ -693,11 +686,6 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
693
686
|
* @private
|
|
694
687
|
*/
|
|
695
688
|
__defaultRenderer(root, _select) {
|
|
696
|
-
if (this.__slottedListBox) {
|
|
697
|
-
root.textContent = '';
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
689
|
if (!this.items || this.items.length === 0) {
|
|
702
690
|
root.textContent = '';
|
|
703
691
|
return;
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
"name": "vaadin-select",
|
|
145
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\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-select-overlay-width` | Width of the overlay |\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 toggle button\n`field-button` | Set on the toggle 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`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\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`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`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
145
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\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-select-overlay-width` | Width of the overlay |\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 toggle button\n`field-button` | Set on the toggle 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`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\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`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`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-button).\n- [`<vaadin-select-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-select-list-box) - a list-box element.\n- [`<vaadin-select-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-select-item) - an item element.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
146
146
|
"attributes": [
|
|
147
147
|
{
|
|
148
148
|
"name": "accessible-name",
|
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/select",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "vaadin-select",
|
|
75
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\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-select-overlay-width` | Width of the overlay |\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 toggle button\n`field-button` | Set on the toggle 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`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\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`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`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
75
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\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-select-overlay-width` | Width of the overlay |\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 toggle button\n`field-button` | Set on the toggle 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`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\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`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`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-button).\n- [`<vaadin-select-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-select-list-box) - a list-box element.\n- [`<vaadin-select-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-select-item) - an item element.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
76
76
|
"extension": true,
|
|
77
77
|
"attributes": [
|
|
78
78
|
{
|