@vaadin/select 25.0.0-alpha4 → 25.0.0-alpha6
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 +15 -15
- package/src/styles/vaadin-select-overlay-base-styles.js +1 -1
- package/src/styles/vaadin-select-overlay-core-styles.js +1 -1
- package/src/vaadin-select-base-mixin.js +10 -15
- package/src/vaadin-select-item.js +2 -2
- package/src/vaadin-select-list-box.js +2 -2
- package/src/vaadin-select-overlay-mixin.js +17 -4
- package/src/vaadin-select-overlay.js +2 -2
- package/src/vaadin-select-value-button.js +2 -2
- package/src/vaadin-select.d.ts +1 -2
- package/src/vaadin-select.js +3 -4
- 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": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
43
|
-
"@vaadin/button": "25.0.0-
|
|
44
|
-
"@vaadin/component-base": "25.0.0-
|
|
45
|
-
"@vaadin/field-base": "25.0.0-
|
|
46
|
-
"@vaadin/input-container": "25.0.0-
|
|
47
|
-
"@vaadin/item": "25.0.0-
|
|
48
|
-
"@vaadin/list-box": "25.0.0-
|
|
49
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
50
|
-
"@vaadin/overlay": "25.0.0-
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
42
|
+
"@vaadin/a11y-base": "25.0.0-alpha6",
|
|
43
|
+
"@vaadin/button": "25.0.0-alpha6",
|
|
44
|
+
"@vaadin/component-base": "25.0.0-alpha6",
|
|
45
|
+
"@vaadin/field-base": "25.0.0-alpha6",
|
|
46
|
+
"@vaadin/input-container": "25.0.0-alpha6",
|
|
47
|
+
"@vaadin/item": "25.0.0-alpha6",
|
|
48
|
+
"@vaadin/list-box": "25.0.0-alpha6",
|
|
49
|
+
"@vaadin/lit-renderer": "25.0.0-alpha6",
|
|
50
|
+
"@vaadin/overlay": "25.0.0-alpha6",
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha6",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha6",
|
|
53
53
|
"lit": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
57
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
56
|
+
"@vaadin/chai-plugins": "25.0.0-alpha6",
|
|
57
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha6",
|
|
58
58
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
59
59
|
"sinon": "^18.0.0"
|
|
60
60
|
},
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"web-types.json",
|
|
63
63
|
"web-types.lit.json"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "cd1d084198d2b326c58d44bb39fa4845b71ce551"
|
|
66
66
|
}
|
|
@@ -13,7 +13,7 @@ export const selectOverlayStyles = css`
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
:host(:not([phone])) [part='overlay'] {
|
|
16
|
-
min-width: var(--vaadin-select-overlay-width, var(--
|
|
16
|
+
min-width: var(--vaadin-select-overlay-width, var(--_vaadin-select-overlay-default-width));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
[part='content'] {
|
|
@@ -12,7 +12,7 @@ export const selectOverlayStyles = css`
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
:host(:not([phone])) [part='overlay'] {
|
|
15
|
-
min-width: var(--vaadin-select-overlay-width, var(--
|
|
15
|
+
min-width: var(--vaadin-select-overlay-width, var(--_vaadin-select-overlay-default-width));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@media (forced-colors: active) {
|
|
@@ -63,6 +63,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
63
63
|
type: Boolean,
|
|
64
64
|
value: false,
|
|
65
65
|
notify: true,
|
|
66
|
+
observer: '_openedChanged',
|
|
66
67
|
reflectToAttribute: true,
|
|
67
68
|
sync: true,
|
|
68
69
|
},
|
|
@@ -160,11 +161,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
static get observers() {
|
|
163
|
-
return [
|
|
164
|
-
'_updateAriaExpanded(opened, focusElement)',
|
|
165
|
-
'_updateSelectedItem(value, _items, placeholder)',
|
|
166
|
-
'_openedChanged(opened, _overlayElement)',
|
|
167
|
-
];
|
|
164
|
+
return ['_updateAriaExpanded(opened, focusElement)', '_updateSelectedItem(value, _items, placeholder)'];
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
constructor() {
|
|
@@ -326,6 +323,12 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
326
323
|
// Prevent mousedown event to avoid blur and preserve focused state
|
|
327
324
|
// while opening, and to restore focus-ring attribute on closing.
|
|
328
325
|
event.preventDefault();
|
|
326
|
+
|
|
327
|
+
// Clicking the `vaadin-input-container` focuses the value button
|
|
328
|
+
// but clicking the toggle button does not, so we handle it here.
|
|
329
|
+
if (!this.opened) {
|
|
330
|
+
this.focusElement.focus();
|
|
331
|
+
}
|
|
329
332
|
}
|
|
330
333
|
|
|
331
334
|
/**
|
|
@@ -364,11 +367,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
364
367
|
}
|
|
365
368
|
|
|
366
369
|
/** @private */
|
|
367
|
-
_openedChanged(opened,
|
|
368
|
-
if (!overlayElement) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
|
|
370
|
+
_openedChanged(opened, oldOpened) {
|
|
372
371
|
if (opened) {
|
|
373
372
|
if (this.disabled || this.readonly) {
|
|
374
373
|
// Disallow programmatic opening when disabled or readonly
|
|
@@ -379,8 +378,6 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
379
378
|
// Avoid multiple announcements when a value gets selected from the dropdown
|
|
380
379
|
this._updateAriaLive(false);
|
|
381
380
|
|
|
382
|
-
overlayElement.style.setProperty('--vaadin-select-text-field-width', `${this._inputContainer.offsetWidth}px`);
|
|
383
|
-
|
|
384
381
|
// Preserve focus-ring to restore it later
|
|
385
382
|
const hasFocusRing = this.hasAttribute('focus-ring');
|
|
386
383
|
this._openedWithFocusRing = hasFocusRing;
|
|
@@ -389,7 +386,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
389
386
|
if (hasFocusRing) {
|
|
390
387
|
this.removeAttribute('focus-ring');
|
|
391
388
|
}
|
|
392
|
-
} else if (
|
|
389
|
+
} else if (oldOpened) {
|
|
393
390
|
if (this._openedWithFocusRing) {
|
|
394
391
|
this.setAttribute('focus-ring', '');
|
|
395
392
|
}
|
|
@@ -401,8 +398,6 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
401
398
|
this._requestValidation();
|
|
402
399
|
}
|
|
403
400
|
}
|
|
404
|
-
|
|
405
|
-
this.__oldOpened = opened;
|
|
406
401
|
}
|
|
407
402
|
|
|
408
403
|
/** @private */
|
|
@@ -9,7 +9,7 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
10
|
import { itemStyles } from '@vaadin/item/src/styles/vaadin-item-core-styles.js';
|
|
11
11
|
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
12
|
-
import {
|
|
12
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -22,7 +22,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
22
22
|
* @mixes ThemableMixin
|
|
23
23
|
* @protected
|
|
24
24
|
*/
|
|
25
|
-
class SelectItem extends ItemMixin(ThemableMixin(DirMixin(
|
|
25
|
+
class SelectItem extends ItemMixin(ThemableMixin(DirMixin(LumoInjectionMixin(PolylitMixin(LitElement))))) {
|
|
26
26
|
static get is() {
|
|
27
27
|
return 'vaadin-select-item';
|
|
28
28
|
}
|
|
@@ -9,7 +9,7 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
9
9
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
10
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
11
|
import { listBoxStyles } from '@vaadin/list-box/src/styles/vaadin-list-box-core-styles.js';
|
|
12
|
-
import {
|
|
12
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -22,7 +22,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
22
22
|
* @mixes ThemableMixin
|
|
23
23
|
* @protected
|
|
24
24
|
*/
|
|
25
|
-
class SelectListBox extends ListMixin(ThemableMixin(DirMixin(
|
|
25
|
+
class SelectListBox extends ListMixin(ThemableMixin(DirMixin(LumoInjectionMixin(PolylitMixin(LitElement))))) {
|
|
26
26
|
static get is() {
|
|
27
27
|
return 'vaadin-select-list-box';
|
|
28
28
|
}
|
|
@@ -16,7 +16,7 @@ import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin
|
|
|
16
16
|
export const SelectOverlayMixin = (superClass) =>
|
|
17
17
|
class SelectOverlayMixin extends PositionMixin(OverlayMixin(DirMixin(superClass))) {
|
|
18
18
|
static get observers() {
|
|
19
|
-
return ['_updateOverlayWidth(opened,
|
|
19
|
+
return ['_updateOverlayWidth(opened, positionTarget)'];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/** @protected */
|
|
@@ -38,16 +38,29 @@ export const SelectOverlayMixin = (superClass) =>
|
|
|
38
38
|
return true;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @protected
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
_mouseDownListener(event) {
|
|
46
|
+
super._mouseDownListener(event);
|
|
47
|
+
|
|
48
|
+
// Prevent global mousedown event to avoid losing focus on outside click
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
/** @protected */
|
|
42
53
|
_getMenuElement() {
|
|
43
54
|
return Array.from(this.children).find((el) => el.localName !== 'style');
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
/** @private */
|
|
47
|
-
_updateOverlayWidth(opened,
|
|
48
|
-
if (opened &&
|
|
58
|
+
_updateOverlayWidth(opened, positionTarget) {
|
|
59
|
+
if (opened && positionTarget) {
|
|
60
|
+
this.style.setProperty('--_vaadin-select-overlay-default-width', `${positionTarget.offsetWidth}px`);
|
|
61
|
+
|
|
49
62
|
const widthProperty = '--vaadin-select-overlay-width';
|
|
50
|
-
const customWidth = getComputedStyle(owner).getPropertyValue(widthProperty);
|
|
63
|
+
const customWidth = getComputedStyle(this.owner).getPropertyValue(widthProperty);
|
|
51
64
|
|
|
52
65
|
if (customWidth === '') {
|
|
53
66
|
this.style.removeProperty(widthProperty);
|
|
@@ -7,7 +7,7 @@ import { html, LitElement } from 'lit';
|
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
9
|
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
|
|
10
|
-
import {
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
12
|
import { selectOverlayStyles } from './styles/vaadin-select-overlay-core-styles.js';
|
|
13
13
|
import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
|
|
@@ -21,7 +21,7 @@ import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
|
|
|
21
21
|
* @mixes ThemableMixin
|
|
22
22
|
* @private
|
|
23
23
|
*/
|
|
24
|
-
export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(
|
|
24
|
+
export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement)))) {
|
|
25
25
|
static get is() {
|
|
26
26
|
return 'vaadin-select-overlay';
|
|
27
27
|
}
|
|
@@ -7,7 +7,7 @@ import { html, LitElement } from 'lit';
|
|
|
7
7
|
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
8
8
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import {
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
12
|
import { valueButton } from './styles/vaadin-select-value-button-core-styles.js';
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ import { valueButton } from './styles/vaadin-select-value-button-core-styles.js'
|
|
|
20
20
|
* @mixes ThemableMixin
|
|
21
21
|
* @protected
|
|
22
22
|
*/
|
|
23
|
-
class SelectValueButton extends ButtonMixin(ThemableMixin(
|
|
23
|
+
class SelectValueButton extends ButtonMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement)))) {
|
|
24
24
|
static get is() {
|
|
25
25
|
return 'vaadin-select-value-button';
|
|
26
26
|
}
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -127,9 +127,8 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
|
|
|
127
127
|
* The following custom properties are available for styling:
|
|
128
128
|
*
|
|
129
129
|
* Custom property | Description | Target element | Default
|
|
130
|
-
*
|
|
130
|
+
* -----------------------------------|------------------------------|-------------------------|--------
|
|
131
131
|
* `--vaadin-field-default-width` | Default width of the field | :host | `12em`
|
|
132
|
-
* `--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |
|
|
133
132
|
* `--vaadin-select-overlay-width` | Width of the overlay | `vaadin-select-overlay` |
|
|
134
133
|
*
|
|
135
134
|
* `<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
|
package/src/vaadin-select.js
CHANGED
|
@@ -15,7 +15,7 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
15
15
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
16
16
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
17
17
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
18
|
-
import {
|
|
18
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
19
19
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
20
20
|
import { selectStyles } from './styles/vaadin-select-core-styles.js';
|
|
21
21
|
import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
@@ -81,9 +81,8 @@ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
|
81
81
|
* The following custom properties are available for styling:
|
|
82
82
|
*
|
|
83
83
|
* Custom property | Description | Target element | Default
|
|
84
|
-
*
|
|
84
|
+
* -----------------------------------|------------------------------|-------------------------|--------
|
|
85
85
|
* `--vaadin-field-default-width` | Default width of the field | :host | `12em`
|
|
86
|
-
* `--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |
|
|
87
86
|
* `--vaadin-select-overlay-width` | Width of the overlay | `vaadin-select-overlay` |
|
|
88
87
|
*
|
|
89
88
|
* `<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
|
|
@@ -132,7 +131,7 @@ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
|
132
131
|
* @mixes SelectBaseMixin
|
|
133
132
|
* @mixes ThemableMixin
|
|
134
133
|
*/
|
|
135
|
-
class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(
|
|
134
|
+
class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement))))) {
|
|
136
135
|
static get is() {
|
|
137
136
|
return 'vaadin-select';
|
|
138
137
|
}
|
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": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha6",
|
|
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', 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 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
|
|
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', 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 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-overlay-width` | Width of the overlay | `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/25.0.0-alpha6/#/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/25.0.0-alpha6/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha6/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha6/#/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": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha6",
|
|
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', 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 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
|
|
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', 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 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-overlay-width` | Width of the overlay | `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/25.0.0-alpha6/#/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/25.0.0-alpha6/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha6/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha6/#/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
|
{
|