@vaadin/select 24.2.0-alpha9 → 24.2.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.
- package/package.json +14 -14
- package/src/vaadin-select-base-mixin.d.ts +6 -0
- package/src/vaadin-select-base-mixin.js +6 -1
- package/src/vaadin-select-item.js +3 -1
- package/src/vaadin-select-list-box.js +3 -1
- package/src/vaadin-select-overlay.js +3 -1
- package/src/vaadin-select-value-button.js +3 -1
- package/src/vaadin-select.js +7 -1
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "24.2.0-
|
|
3
|
+
"version": "24.2.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
49
49
|
"@polymer/polymer": "^3.2.0",
|
|
50
|
-
"@vaadin/a11y-base": "24.2.0-
|
|
51
|
-
"@vaadin/button": "24.2.0-
|
|
52
|
-
"@vaadin/component-base": "24.2.0-
|
|
53
|
-
"@vaadin/field-base": "24.2.0-
|
|
54
|
-
"@vaadin/input-container": "24.2.0-
|
|
55
|
-
"@vaadin/item": "24.2.0-
|
|
56
|
-
"@vaadin/list-box": "24.2.0-
|
|
57
|
-
"@vaadin/lit-renderer": "24.2.0-
|
|
58
|
-
"@vaadin/overlay": "24.2.0-
|
|
59
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0-
|
|
60
|
-
"@vaadin/vaadin-material-styles": "24.2.0-
|
|
61
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0-
|
|
50
|
+
"@vaadin/a11y-base": "24.2.0-beta2",
|
|
51
|
+
"@vaadin/button": "24.2.0-beta2",
|
|
52
|
+
"@vaadin/component-base": "24.2.0-beta2",
|
|
53
|
+
"@vaadin/field-base": "24.2.0-beta2",
|
|
54
|
+
"@vaadin/input-container": "24.2.0-beta2",
|
|
55
|
+
"@vaadin/item": "24.2.0-beta2",
|
|
56
|
+
"@vaadin/list-box": "24.2.0-beta2",
|
|
57
|
+
"@vaadin/lit-renderer": "24.2.0-beta2",
|
|
58
|
+
"@vaadin/overlay": "24.2.0-beta2",
|
|
59
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-beta2",
|
|
60
|
+
"@vaadin/vaadin-material-styles": "24.2.0-beta2",
|
|
61
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-beta2"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"web-types.json",
|
|
71
71
|
"web-types.lit.json"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "4b852f9a12d4dade7f0fb3c73b7212436cebf310"
|
|
74
74
|
}
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
|
|
8
|
+
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
9
|
+
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
8
10
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
11
|
+
import type { TabindexMixinClass } from '@vaadin/a11y-base/src/tabindex-mixin.js';
|
|
9
12
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
10
13
|
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
11
14
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
@@ -17,11 +20,14 @@ export declare function SelectBaseMixin<T extends Constructor<HTMLElement>>(
|
|
|
17
20
|
base: T,
|
|
18
21
|
): Constructor<DelegateFocusMixinClass> &
|
|
19
22
|
Constructor<DelegateStateMixinClass> &
|
|
23
|
+
Constructor<DisabledMixinClass> &
|
|
20
24
|
Constructor<FieldMixinClass> &
|
|
25
|
+
Constructor<FocusMixinClass> &
|
|
21
26
|
Constructor<KeyboardMixinClass> &
|
|
22
27
|
Constructor<LabelMixinClass> &
|
|
23
28
|
Constructor<OverlayClassMixinClass> &
|
|
24
29
|
Constructor<SelectBaseMixinClass> &
|
|
30
|
+
Constructor<TabindexMixinClass> &
|
|
25
31
|
Constructor<ValidateMixinClass> &
|
|
26
32
|
T;
|
|
27
33
|
|
|
@@ -203,6 +203,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
203
203
|
|
|
204
204
|
this._tooltipController = new TooltipController(this);
|
|
205
205
|
this._tooltipController.setPosition('top');
|
|
206
|
+
this._tooltipController.setAriaTarget(this.focusElement);
|
|
206
207
|
this.addController(this._tooltipController);
|
|
207
208
|
}
|
|
208
209
|
|
|
@@ -388,7 +389,8 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
388
389
|
|
|
389
390
|
// Skip validation when a change event is scheduled, as validation
|
|
390
391
|
// will be triggered by `__dispatchChange()` in that case.
|
|
391
|
-
|
|
392
|
+
// Also, skip validation when closed on Escape or Tab keys.
|
|
393
|
+
if (!this.__dispatchChangePending && !this._keyboardActive) {
|
|
392
394
|
this.validate();
|
|
393
395
|
}
|
|
394
396
|
}
|
|
@@ -460,6 +462,9 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
460
462
|
itemElement.removeAttribute('tabindex');
|
|
461
463
|
itemElement.removeAttribute('aria-selected');
|
|
462
464
|
itemElement.removeAttribute('role');
|
|
465
|
+
itemElement.removeAttribute('focused');
|
|
466
|
+
itemElement.removeAttribute('focus-ring');
|
|
467
|
+
itemElement.removeAttribute('active');
|
|
463
468
|
itemElement.setAttribute('id', this._itemId);
|
|
464
469
|
}
|
|
465
470
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
7
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
9
|
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
9
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -11,6 +12,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
11
12
|
/**
|
|
12
13
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
13
14
|
*
|
|
15
|
+
* @customElement
|
|
14
16
|
* @extends HTMLElement
|
|
15
17
|
* @mixes DirMixin
|
|
16
18
|
* @mixes ItemMixin
|
|
@@ -48,6 +50,6 @@ class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
|
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
defineCustomElement(SelectItem);
|
|
52
54
|
|
|
53
55
|
export { SelectItem };
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
|
|
8
8
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
10
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
14
15
|
*
|
|
16
|
+
* @customElement
|
|
15
17
|
* @extends HTMLElement
|
|
16
18
|
* @mixes ControllerMixin
|
|
17
19
|
* @mixes DirMixin
|
|
@@ -76,4 +78,4 @@ class SelectListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(Pol
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
defineCustomElement(SelectListBox);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
7
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
9
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
9
10
|
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
@@ -30,6 +31,7 @@ registerStyles('vaadin-select-overlay', [overlayStyles, selectOverlayStyles], {
|
|
|
30
31
|
/**
|
|
31
32
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
32
33
|
*
|
|
34
|
+
* @customElement
|
|
33
35
|
* @extends HTMLElement
|
|
34
36
|
* @mixes DirMixin
|
|
35
37
|
* @mixes OverlayMixin
|
|
@@ -69,4 +71,4 @@ export class SelectOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableM
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
defineCustomElement(SelectOverlay);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
8
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
9
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import { valueButton } from './vaadin-select-value-button-styles.js';
|
|
10
11
|
|
|
@@ -13,6 +14,7 @@ registerStyles('vaadin-select-value-button', valueButton, { moduleId: 'vaadin-se
|
|
|
13
14
|
/**
|
|
14
15
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
15
16
|
*
|
|
17
|
+
* @customElement
|
|
16
18
|
* @extends HTMLElement
|
|
17
19
|
* @mixes ButtonMixin
|
|
18
20
|
* @mixes ThemableMixin
|
|
@@ -34,4 +36,4 @@ class SelectValueButton extends ButtonMixin(ThemableMixin(PolymerElement)) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
defineCustomElement(SelectValueButton);
|
package/src/vaadin-select.js
CHANGED
|
@@ -10,6 +10,7 @@ import './vaadin-select-overlay.js';
|
|
|
10
10
|
import './vaadin-select-value-button.js';
|
|
11
11
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
12
|
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
|
|
13
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
14
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
15
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
15
16
|
import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
|
|
@@ -126,6 +127,7 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer, screenReaderO
|
|
|
126
127
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
127
128
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
128
129
|
*
|
|
130
|
+
* @customElement
|
|
129
131
|
* @extends HTMLElement
|
|
130
132
|
* @mixes ElementMixin
|
|
131
133
|
* @mixes SelectBaseMixin
|
|
@@ -139,6 +141,10 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolymerElement))
|
|
|
139
141
|
static get template() {
|
|
140
142
|
return html`
|
|
141
143
|
<style>
|
|
144
|
+
:host {
|
|
145
|
+
position: relative;
|
|
146
|
+
}
|
|
147
|
+
|
|
142
148
|
::slotted([slot='value']) {
|
|
143
149
|
flex-grow: 1;
|
|
144
150
|
}
|
|
@@ -228,6 +234,6 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolymerElement))
|
|
|
228
234
|
*/
|
|
229
235
|
}
|
|
230
236
|
|
|
231
|
-
|
|
237
|
+
defineCustomElement(Select);
|
|
232
238
|
|
|
233
239
|
export { Select };
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "24.2.0-
|
|
4
|
+
"version": "24.2.0-beta2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-select",
|
|
11
|
-
"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' },\n { label: 'Rating: high to low', value: 'rating-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 the renderer callback function.\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* 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### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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/24.2.0-
|
|
11
|
+
"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' },\n { label: 'Rating: high to low', value: 'rating-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 the renderer callback function.\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* 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### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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/24.2.0-beta2/#/elements/vaadin-text-field) for the styling documentation.\n\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 select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"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/select",
|
|
4
|
-
"version": "24.2.0-
|
|
4
|
+
"version": "24.2.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-select",
|
|
19
|
-
"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' },\n { label: 'Rating: high to low', value: 'rating-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 the renderer callback function.\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* 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### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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/24.2.0-
|
|
19
|
+
"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' },\n { label: 'Rating: high to low', value: 'rating-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 the renderer callback function.\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* 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### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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/24.2.0-beta2/#/elements/vaadin-text-field) for the styling documentation.\n\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 select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta2/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|