@vaadin/select 24.0.0-alpha9 → 24.0.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-item.d.ts +21 -0
- package/src/vaadin-select-item.js +36 -3
- package/src/vaadin-select-list-box.d.ts +22 -0
- package/src/vaadin-select-list-box.js +62 -3
- package/src/vaadin-select.d.ts +2 -4
- package/src/vaadin-select.js +8 -12
- package/theme/lumo/vaadin-select-styles.js +11 -3
- package/theme/lumo/vaadin-select.js +0 -2
- package/theme/material/vaadin-select-styles.js +13 -0
- package/theme/material/vaadin-select.js +0 -2
- package/web-types.json +4 -4
- package/web-types.lit.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.2.0",
|
|
41
|
-
"@vaadin/button": "24.0.0-
|
|
42
|
-
"@vaadin/component-base": "24.0.0-
|
|
43
|
-
"@vaadin/field-base": "24.0.0-
|
|
44
|
-
"@vaadin/input-container": "24.0.0-
|
|
45
|
-
"@vaadin/item": "24.0.0-
|
|
46
|
-
"@vaadin/list-box": "24.0.0-
|
|
47
|
-
"@vaadin/lit-renderer": "24.0.0-
|
|
48
|
-
"@vaadin/overlay": "24.0.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
41
|
+
"@vaadin/button": "24.0.0-beta2",
|
|
42
|
+
"@vaadin/component-base": "24.0.0-beta2",
|
|
43
|
+
"@vaadin/field-base": "24.0.0-beta2",
|
|
44
|
+
"@vaadin/input-container": "24.0.0-beta2",
|
|
45
|
+
"@vaadin/item": "24.0.0-beta2",
|
|
46
|
+
"@vaadin/list-box": "24.0.0-beta2",
|
|
47
|
+
"@vaadin/lit-renderer": "24.0.0-beta2",
|
|
48
|
+
"@vaadin/overlay": "24.0.0-beta2",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-beta2",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.0.0-beta2",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-beta2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@esm-bundle/chai": "^4.3.4",
|
|
55
|
-
"@vaadin/testing-helpers": "^0.
|
|
55
|
+
"@vaadin/testing-helpers": "^0.4.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": "00086f1f6d487f042f189c9b9ecd7ba736960888"
|
|
64
64
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
7
|
+
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
8
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
12
|
+
*/
|
|
13
|
+
declare class SelectItem extends ItemMixin(DirMixin(ThemableMixin(HTMLElement))) {}
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'vaadin-select-item': SelectItem;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { SelectItem };
|
|
@@ -3,18 +3,51 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
|
+
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
10
13
|
*
|
|
11
|
-
* @extends
|
|
14
|
+
* @extends HTMLElement
|
|
15
|
+
* @mixes DirMixin
|
|
16
|
+
* @mixes ItemMixin
|
|
17
|
+
* @mixes ThemableMixin
|
|
12
18
|
* @protected
|
|
13
19
|
*/
|
|
14
|
-
class SelectItem extends
|
|
20
|
+
class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
|
|
15
21
|
static get is() {
|
|
16
22
|
return 'vaadin-select-item';
|
|
17
23
|
}
|
|
24
|
+
|
|
25
|
+
static get template() {
|
|
26
|
+
return html`
|
|
27
|
+
<style>
|
|
28
|
+
:host {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([hidden]) {
|
|
33
|
+
display: none !important;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
<span part="checkmark" aria-hidden="true"></span>
|
|
37
|
+
<div part="content">
|
|
38
|
+
<slot></slot>
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @protected */
|
|
44
|
+
ready() {
|
|
45
|
+
super.ready();
|
|
46
|
+
|
|
47
|
+
this.setAttribute('role', 'option');
|
|
48
|
+
}
|
|
18
49
|
}
|
|
19
50
|
|
|
20
51
|
customElements.define(SelectItem.is, SelectItem);
|
|
52
|
+
|
|
53
|
+
export { SelectItem };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
|
+
import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
13
|
+
*/
|
|
14
|
+
declare class SelectListBox extends ListMixin(DirMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {}
|
|
15
|
+
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
'vaadin-select-list-box': SelectListBox;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { SelectListBox };
|
|
@@ -3,18 +3,77 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
|
|
10
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
10
14
|
*
|
|
11
|
-
* @extends
|
|
15
|
+
* @extends HTMLElement
|
|
16
|
+
* @mixes ControllerMixin
|
|
17
|
+
* @mixes DirMixin
|
|
18
|
+
* @mixes ListMixin
|
|
19
|
+
* @mixes ThemableMixin
|
|
12
20
|
* @protected
|
|
13
21
|
*/
|
|
14
|
-
class SelectListBox extends
|
|
22
|
+
class SelectListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(PolymerElement)))) {
|
|
15
23
|
static get is() {
|
|
16
24
|
return 'vaadin-select-list-box';
|
|
17
25
|
}
|
|
26
|
+
|
|
27
|
+
static get template() {
|
|
28
|
+
return html`
|
|
29
|
+
<style>
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([hidden]) {
|
|
35
|
+
display: none !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[part='items'] {
|
|
39
|
+
height: 100%;
|
|
40
|
+
width: 100%;
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
-webkit-overflow-scrolling: touch;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
<div part="items">
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static get properties() {
|
|
52
|
+
return {
|
|
53
|
+
// We don't need to define this property since super default is vertical,
|
|
54
|
+
// but we don't want it to be modified, or be shown in the API docs.
|
|
55
|
+
/** @private */
|
|
56
|
+
orientation: {
|
|
57
|
+
readOnly: true,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @return {!HTMLElement}
|
|
64
|
+
* @protected
|
|
65
|
+
* @override
|
|
66
|
+
*/
|
|
67
|
+
get _scrollerElement() {
|
|
68
|
+
return this.shadowRoot.querySelector('[part="items"]');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @protected */
|
|
72
|
+
ready() {
|
|
73
|
+
super.ready();
|
|
74
|
+
|
|
75
|
+
this.setAttribute('role', 'listbox');
|
|
76
|
+
}
|
|
18
77
|
}
|
|
19
78
|
|
|
20
79
|
customElements.define(SelectListBox.is, SelectListBox);
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -216,10 +216,8 @@ declare class Select extends OverlayClassMixin(
|
|
|
216
216
|
renderer: SelectRenderer | undefined;
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* When there’s an item selected, it's the value of that item, otherwise
|
|
222
|
-
* it's an empty string.
|
|
219
|
+
* The `value` property of the selected item, or an empty string
|
|
220
|
+
* if no item is selected.
|
|
223
221
|
* On change or initialization, the component finds the item which matches the
|
|
224
222
|
* value and displays it.
|
|
225
223
|
* If no value is provided to the component, it selects the first item without
|
package/src/vaadin-select.js
CHANGED
|
@@ -247,10 +247,8 @@ class Select extends OverlayClassMixin(
|
|
|
247
247
|
renderer: Function,
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* When there’s an item selected, it's the value of that item, otherwise
|
|
253
|
-
* it's an empty string.
|
|
250
|
+
* The `value` property of the selected item, or an empty string
|
|
251
|
+
* if no item is selected.
|
|
254
252
|
* On change or initialization, the component finds the item which matches the
|
|
255
253
|
* value and displays it.
|
|
256
254
|
* If no value is provided to the component, it selects the first item without
|
|
@@ -447,8 +445,6 @@ class Select extends OverlayClassMixin(
|
|
|
447
445
|
true,
|
|
448
446
|
);
|
|
449
447
|
|
|
450
|
-
menuElement.setAttribute('role', 'listbox');
|
|
451
|
-
|
|
452
448
|
// Store the menu element reference
|
|
453
449
|
this.__lastMenuElement = menuElement;
|
|
454
450
|
}
|
|
@@ -458,7 +454,6 @@ class Select extends OverlayClassMixin(
|
|
|
458
454
|
__initMenuItems(menuElement) {
|
|
459
455
|
if (menuElement.items) {
|
|
460
456
|
this._items = menuElement.items;
|
|
461
|
-
this._items.forEach((item) => item.setAttribute('role', 'option'));
|
|
462
457
|
}
|
|
463
458
|
}
|
|
464
459
|
|
|
@@ -594,8 +589,7 @@ class Select extends OverlayClassMixin(
|
|
|
594
589
|
// Store reference to the original item
|
|
595
590
|
labelItem._sourceItem = selected;
|
|
596
591
|
|
|
597
|
-
this.
|
|
598
|
-
this.focusElement.appendChild(labelItem);
|
|
592
|
+
this.__appendValueItemElement(labelItem, this.focusElement);
|
|
599
593
|
|
|
600
594
|
// Ensure the item gets proper styles
|
|
601
595
|
labelItem.selected = true;
|
|
@@ -621,10 +615,13 @@ class Select extends OverlayClassMixin(
|
|
|
621
615
|
|
|
622
616
|
/**
|
|
623
617
|
* @param {!HTMLElement} itemElement
|
|
618
|
+
* @param {!HTMLElement} parent
|
|
624
619
|
* @private
|
|
625
620
|
*/
|
|
626
|
-
|
|
621
|
+
__appendValueItemElement(itemElement, parent) {
|
|
622
|
+
parent.appendChild(itemElement);
|
|
627
623
|
itemElement.removeAttribute('tabindex');
|
|
624
|
+
itemElement.removeAttribute('aria-selected');
|
|
628
625
|
itemElement.removeAttribute('role');
|
|
629
626
|
itemElement.setAttribute('id', this._itemId);
|
|
630
627
|
}
|
|
@@ -646,8 +643,7 @@ class Select extends OverlayClassMixin(
|
|
|
646
643
|
if (!selected) {
|
|
647
644
|
if (this.placeholder) {
|
|
648
645
|
const item = this.__createItemElement({ label: this.placeholder });
|
|
649
|
-
this.
|
|
650
|
-
valueButton.appendChild(item);
|
|
646
|
+
this.__appendValueItemElement(item, valueButton);
|
|
651
647
|
valueButton.setAttribute('placeholder', '');
|
|
652
648
|
}
|
|
653
649
|
} else {
|
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
7
7
|
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
8
8
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
9
|
+
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
|
|
10
|
+
import { listBox } from '@vaadin/list-box/theme/lumo/vaadin-list-box-styles.js';
|
|
9
11
|
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
10
12
|
import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
11
13
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
14
|
|
|
15
|
+
registerStyles('vaadin-select-item', item, { moduleId: 'lumo-select-item' });
|
|
16
|
+
|
|
17
|
+
registerStyles('vaadin-select-list-box', listBox, { moduleId: 'lumo-select-list-box' });
|
|
18
|
+
|
|
13
19
|
const select = css`
|
|
14
20
|
:host(:not([theme*='align'])) ::slotted([slot='value']) {
|
|
15
21
|
text-align: start;
|
|
@@ -33,9 +39,11 @@ const select = css`
|
|
|
33
39
|
|
|
34
40
|
/* placeholder styles */
|
|
35
41
|
[part='input-field'] ::slotted([slot='value'][placeholder]) {
|
|
36
|
-
color:
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
color: var(--lumo-secondary-text-color);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host(:is([readonly], [disabled])) ::slotted([slot='value'][placeholder]) {
|
|
46
|
+
opacity: 0;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
[part='toggle-button']::before {
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
|
|
7
|
-
import '@vaadin/item/theme/lumo/vaadin-item.js';
|
|
8
|
-
import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
|
|
9
7
|
import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
|
|
10
8
|
import './vaadin-select-styles.js';
|
|
11
9
|
import '../../src/vaadin-select.js';
|
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
7
|
+
import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
|
|
8
|
+
import { listBox } from '@vaadin/list-box/theme/material/vaadin-list-box-styles.js';
|
|
7
9
|
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
|
8
10
|
import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
|
|
9
11
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
12
|
|
|
13
|
+
registerStyles('vaadin-select-item', item, { moduleId: 'material-select-item' });
|
|
14
|
+
|
|
15
|
+
registerStyles('vaadin-select-list-box', listBox, { moduleId: 'material-select-list-box' });
|
|
16
|
+
|
|
11
17
|
const select = css`
|
|
12
18
|
:host {
|
|
13
19
|
display: inline-flex;
|
|
@@ -21,6 +27,13 @@ const select = css`
|
|
|
21
27
|
opacity: 1;
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
:host([has-label]:not([focused]):not([invalid]):not([theme='always-float-label']))
|
|
31
|
+
::slotted([slot='value'][placeholder]) {
|
|
32
|
+
opacity: 0;
|
|
33
|
+
/* Avoid a flash of the placeholder text on init */
|
|
34
|
+
transition: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
:host [part='input-field'] ::slotted([slot='value']) {
|
|
25
38
|
color: var(--material-body-text-color);
|
|
26
39
|
}
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/input-container/theme/material/vaadin-input-container.js';
|
|
7
|
-
import '@vaadin/item/theme/material/vaadin-item.js';
|
|
8
|
-
import '@vaadin/list-box/theme/material/vaadin-list-box.js';
|
|
9
7
|
import '@vaadin/overlay/theme/material/vaadin-overlay.js';
|
|
10
8
|
import './vaadin-select-styles.js';
|
|
11
9
|
import '../../src/vaadin-select.js';
|
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.0.0-
|
|
4
|
+
"version": "24.0.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.0.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.0.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.0.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.0.0-beta2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.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/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "label",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "value",
|
|
112
|
-
"description": "
|
|
112
|
+
"description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
|
|
113
113
|
"value": {
|
|
114
114
|
"type": [
|
|
115
115
|
"string"
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
281
|
"name": "value",
|
|
282
|
-
"description": "
|
|
282
|
+
"description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
|
|
283
283
|
"value": {
|
|
284
284
|
"type": [
|
|
285
285
|
"string"
|
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.0.0-
|
|
4
|
+
"version": "24.0.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.0.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.0.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.0.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.0.0-beta2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.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/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
"name": ".value",
|
|
108
|
-
"description": "
|
|
108
|
+
"description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
|
|
109
109
|
"value": {
|
|
110
110
|
"kind": "expression"
|
|
111
111
|
}
|