@vaadin/select 24.4.6 → 24.5.0-alpha10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +17 -17
- package/src/vaadin-lit-select-overlay.js +7 -19
- package/src/vaadin-lit-select.js +1 -0
- package/src/vaadin-select-base-mixin.d.ts +8 -0
- package/src/vaadin-select-base-mixin.js +11 -0
- package/src/vaadin-select-overlay-mixin.js +47 -0
- package/src/vaadin-select-overlay.js +7 -14
- package/src/vaadin-select.js +2 -0
- package/theme/lumo/vaadin-select-styles.js +8 -4
- package/theme/material/vaadin-select-styles.js +1 -7
- package/web-types.json +24 -2
- package/web-types.lit.json +9 -2
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ import '@vaadin/select/src/vaadin-select.js';
|
|
|
70
70
|
|
|
71
71
|
## Contributing
|
|
72
72
|
|
|
73
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/contributing
|
|
73
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
74
74
|
|
|
75
75
|
## License
|
|
76
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.5.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,28 +39,28 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
41
|
"@polymer/polymer": "^3.2.0",
|
|
42
|
-
"@vaadin/a11y-base": "
|
|
43
|
-
"@vaadin/button": "
|
|
44
|
-
"@vaadin/component-base": "
|
|
45
|
-
"@vaadin/field-base": "
|
|
46
|
-
"@vaadin/input-container": "
|
|
47
|
-
"@vaadin/item": "
|
|
48
|
-
"@vaadin/list-box": "
|
|
49
|
-
"@vaadin/lit-renderer": "
|
|
50
|
-
"@vaadin/overlay": "
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
52
|
-
"@vaadin/vaadin-material-styles": "
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
42
|
+
"@vaadin/a11y-base": "24.5.0-alpha10",
|
|
43
|
+
"@vaadin/button": "24.5.0-alpha10",
|
|
44
|
+
"@vaadin/component-base": "24.5.0-alpha10",
|
|
45
|
+
"@vaadin/field-base": "24.5.0-alpha10",
|
|
46
|
+
"@vaadin/input-container": "24.5.0-alpha10",
|
|
47
|
+
"@vaadin/item": "24.5.0-alpha10",
|
|
48
|
+
"@vaadin/list-box": "24.5.0-alpha10",
|
|
49
|
+
"@vaadin/lit-renderer": "24.5.0-alpha10",
|
|
50
|
+
"@vaadin/overlay": "24.5.0-alpha10",
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "24.5.0-alpha10",
|
|
52
|
+
"@vaadin/vaadin-material-styles": "24.5.0-alpha10",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "24.5.0-alpha10",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@vaadin/testing-helpers": "^0.
|
|
59
|
-
"sinon": "^
|
|
57
|
+
"@vaadin/chai-plugins": "24.5.0-alpha10",
|
|
58
|
+
"@vaadin/testing-helpers": "^1.0.0",
|
|
59
|
+
"sinon": "^18.0.0"
|
|
60
60
|
},
|
|
61
61
|
"web-types": [
|
|
62
62
|
"web-types.json",
|
|
63
63
|
"web-types.lit.json"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "6f9c37308031af872a98017bfab4de89aeacda51"
|
|
66
66
|
}
|
|
@@ -5,24 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
8
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
|
-
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
12
9
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
13
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
+
import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
17
15
|
*
|
|
18
16
|
* @extends HTMLElement
|
|
19
|
-
* @mixes
|
|
20
|
-
* @mixes OverlayMixin
|
|
21
|
-
* @mixes DirMixin
|
|
17
|
+
* @mixes SelectOverlayMixin
|
|
22
18
|
* @mixes ThemableMixin
|
|
23
19
|
* @protected
|
|
24
20
|
*/
|
|
25
|
-
class SelectOverlay extends
|
|
21
|
+
class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
26
22
|
static get is() {
|
|
27
23
|
return 'vaadin-select-overlay';
|
|
28
24
|
}
|
|
@@ -36,6 +32,10 @@ class SelectOverlay extends PositionMixin(OverlayMixin(ThemableMixin(DirMixin(Po
|
|
|
36
32
|
justify-content: flex-start;
|
|
37
33
|
}
|
|
38
34
|
|
|
35
|
+
:host(:not([phone])) [part='overlay'] {
|
|
36
|
+
min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
39
|
@media (forced-colors: active) {
|
|
40
40
|
[part='overlay'] {
|
|
41
41
|
outline: 3px solid;
|
|
@@ -57,13 +57,6 @@ class SelectOverlay extends PositionMixin(OverlayMixin(ThemableMixin(DirMixin(Po
|
|
|
57
57
|
`;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/** @protected */
|
|
61
|
-
ready() {
|
|
62
|
-
super.ready();
|
|
63
|
-
|
|
64
|
-
this.restoreFocusOnClose = true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
60
|
/** @protected */
|
|
68
61
|
updated(props) {
|
|
69
62
|
super.updated(props);
|
|
@@ -82,11 +75,6 @@ class SelectOverlay extends PositionMixin(OverlayMixin(ThemableMixin(DirMixin(Po
|
|
|
82
75
|
this.owner._assignMenuElement(menuElement);
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
|
-
|
|
86
|
-
/** @protected */
|
|
87
|
-
_getMenuElement() {
|
|
88
|
-
return Array.from(this.children).find((el) => el.localName !== 'style');
|
|
89
|
-
}
|
|
90
78
|
}
|
|
91
79
|
|
|
92
80
|
defineCustomElement(SelectOverlay);
|
package/src/vaadin-lit-select.js
CHANGED
|
@@ -90,6 +90,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
|
|
|
90
90
|
.renderer="${this.renderer || this.__defaultRenderer}"
|
|
91
91
|
?phone="${this._phone}"
|
|
92
92
|
theme="${this._theme}"
|
|
93
|
+
?no-vertical-overlap="${this.noVerticalOverlap}"
|
|
93
94
|
@opened-changed="${this._onOpenedChanged}"
|
|
94
95
|
@vaadin-overlay-open="${this._onOverlayOpen}"
|
|
95
96
|
></vaadin-select-overlay>
|
|
@@ -102,6 +102,14 @@ export declare class SelectBaseMixinClass {
|
|
|
102
102
|
*/
|
|
103
103
|
readonly: boolean;
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Defines whether the overlay should overlap the target element
|
|
107
|
+
* in the y-axis, or be positioned right above/below it.
|
|
108
|
+
*
|
|
109
|
+
* @attr {boolean} no-vertical-overlap
|
|
110
|
+
*/
|
|
111
|
+
noVerticalOverlap: boolean;
|
|
112
|
+
|
|
105
113
|
/**
|
|
106
114
|
* Requests an update for the content of the select.
|
|
107
115
|
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
@@ -127,6 +127,17 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
127
127
|
reflectToAttribute: true,
|
|
128
128
|
},
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Defines whether the overlay should overlap the target element
|
|
132
|
+
* in the y-axis, or be positioned right above/below it.
|
|
133
|
+
*
|
|
134
|
+
* @attr {boolean} no-vertical-overlap
|
|
135
|
+
*/
|
|
136
|
+
noVerticalOverlap: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
value: false,
|
|
139
|
+
},
|
|
140
|
+
|
|
130
141
|
/** @private */
|
|
131
142
|
_phone: Boolean,
|
|
132
143
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2024 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 { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
8
|
+
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @polymerMixin
|
|
12
|
+
* @mixes DirMixin
|
|
13
|
+
* @mixes OverlayMixin
|
|
14
|
+
* @mixes PositionMixin
|
|
15
|
+
*/
|
|
16
|
+
export const SelectOverlayMixin = (superClass) =>
|
|
17
|
+
class SelectOverlayMixin extends PositionMixin(OverlayMixin(DirMixin(superClass))) {
|
|
18
|
+
static get observers() {
|
|
19
|
+
return ['_updateOverlayWidth(opened, owner)'];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @protected */
|
|
23
|
+
ready() {
|
|
24
|
+
super.ready();
|
|
25
|
+
|
|
26
|
+
this.restoreFocusOnClose = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @protected */
|
|
30
|
+
_getMenuElement() {
|
|
31
|
+
return Array.from(this.children).find((el) => el.localName !== 'style');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @private */
|
|
35
|
+
_updateOverlayWidth(opened, owner) {
|
|
36
|
+
if (opened && owner) {
|
|
37
|
+
const widthProperty = '--vaadin-select-overlay-width';
|
|
38
|
+
const customWidth = getComputedStyle(owner).getPropertyValue(widthProperty);
|
|
39
|
+
|
|
40
|
+
if (customWidth === '') {
|
|
41
|
+
this.style.removeProperty(widthProperty);
|
|
42
|
+
} else {
|
|
43
|
+
this.style.setProperty(widthProperty, customWidth);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
10
|
-
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
11
8
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
12
9
|
import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
|
|
13
11
|
|
|
14
12
|
const selectOverlayStyles = css`
|
|
15
13
|
:host {
|
|
@@ -17,6 +15,10 @@ const selectOverlayStyles = css`
|
|
|
17
15
|
justify-content: flex-start;
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
:host(:not([phone])) [part='overlay'] {
|
|
19
|
+
min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
|
|
20
|
+
}
|
|
21
|
+
|
|
20
22
|
@media (forced-colors: active) {
|
|
21
23
|
[part='overlay'] {
|
|
22
24
|
outline: 3px solid;
|
|
@@ -33,13 +35,11 @@ registerStyles('vaadin-select-overlay', [overlayStyles, selectOverlayStyles], {
|
|
|
33
35
|
*
|
|
34
36
|
* @customElement
|
|
35
37
|
* @extends HTMLElement
|
|
36
|
-
* @mixes
|
|
37
|
-
* @mixes OverlayMixin
|
|
38
|
-
* @mixes PositionMixin
|
|
38
|
+
* @mixes SelectOverlayMixin
|
|
39
39
|
* @mixes ThemableMixin
|
|
40
40
|
* @private
|
|
41
41
|
*/
|
|
42
|
-
export class SelectOverlay extends
|
|
42
|
+
export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolymerElement)) {
|
|
43
43
|
static get is() {
|
|
44
44
|
return 'vaadin-select-overlay';
|
|
45
45
|
}
|
|
@@ -59,8 +59,6 @@ export class SelectOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableM
|
|
|
59
59
|
ready() {
|
|
60
60
|
super.ready();
|
|
61
61
|
|
|
62
|
-
this.restoreFocusOnClose = true;
|
|
63
|
-
|
|
64
62
|
// When setting `opened` as an attribute, the overlay is already teleported to body
|
|
65
63
|
// by the time when `ready()` callback of the `vaadin-select` is executed by Polymer,
|
|
66
64
|
// so querySelector() would return null. So we use this workaround to set properties.
|
|
@@ -77,11 +75,6 @@ export class SelectOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableM
|
|
|
77
75
|
this.owner._assignMenuElement(menuElement);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
/** @protected */
|
|
82
|
-
_getMenuElement() {
|
|
83
|
-
return Array.from(this.children).find((el) => el.localName !== 'style');
|
|
84
|
-
}
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
defineCustomElement(SelectOverlay);
|
package/src/vaadin-select.js
CHANGED
|
@@ -86,6 +86,7 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer, screenReaderO
|
|
|
86
86
|
* -----------------------------------|------------------------------|----------------------------------
|
|
87
87
|
* `--vaadin-field-default-width` | Default width of the field | :host | `12em`
|
|
88
88
|
* `--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |
|
|
89
|
+
* `--vaadin-select-overlay-width` | Width of the overlay | `vaadin-select-overlay` |
|
|
89
90
|
*
|
|
90
91
|
* `<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
|
|
91
92
|
* See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
|
|
@@ -184,6 +185,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolymerElement))
|
|
|
184
185
|
with-backdrop="[[_phone]]"
|
|
185
186
|
phone$="[[_phone]]"
|
|
186
187
|
theme$="[[_theme]]"
|
|
188
|
+
no-vertical-overlap$="[[noVerticalOverlap]]"
|
|
187
189
|
on-vaadin-overlay-open="_onOverlayOpen"
|
|
188
190
|
></vaadin-select-overlay>
|
|
189
191
|
|
|
@@ -94,10 +94,6 @@ const selectOverlay = css`
|
|
|
94
94
|
--_lumo-item-selected-icon-display: block;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
[part~='overlay'] {
|
|
98
|
-
min-width: var(--vaadin-select-text-field-width);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
97
|
/* Small viewport adjustment */
|
|
102
98
|
:host([phone]) {
|
|
103
99
|
/* stylelint-disable declaration-block-no-redundant-longhand-properties */
|
|
@@ -110,6 +106,14 @@ const selectOverlay = css`
|
|
|
110
106
|
justify-content: flex-end;
|
|
111
107
|
}
|
|
112
108
|
|
|
109
|
+
:host([no-vertical-overlap][top-aligned]) [part='overlay'] {
|
|
110
|
+
margin-block-start: var(--lumo-space-xs);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([no-vertical-overlap][bottom-aligned]) [part='overlay'] {
|
|
114
|
+
margin-block-end: var(--lumo-space-xs);
|
|
115
|
+
}
|
|
116
|
+
|
|
113
117
|
:host([theme~='align-left']) {
|
|
114
118
|
text-align: left;
|
|
115
119
|
}
|
|
@@ -75,10 +75,4 @@ registerStyles(
|
|
|
75
75
|
{ moduleId: 'material-select-value-button' },
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
[part='overlay'] {
|
|
80
|
-
min-width: var(--vaadin-select-text-field-width);
|
|
81
|
-
}
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
registerStyles('vaadin-select-overlay', [menuOverlay, selectOverlay], { moduleId: 'material-select-overlay' });
|
|
78
|
+
registerStyles('vaadin-select-overlay', [menuOverlay], { moduleId: 'material-select-overlay' });
|
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.
|
|
4
|
+
"version": "24.5.0-alpha10",
|
|
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-----------------------------------|------------------------------|----------------------------------\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.
|
|
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-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\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/24.5.0-alpha10/#/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.5.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/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",
|
|
@@ -169,6 +169,17 @@
|
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
|
+
{
|
|
173
|
+
"name": "no-vertical-overlap",
|
|
174
|
+
"description": "Defines whether the overlay should overlap the target element\nin the y-axis, or be positioned right above/below it.",
|
|
175
|
+
"value": {
|
|
176
|
+
"type": [
|
|
177
|
+
"boolean",
|
|
178
|
+
"null",
|
|
179
|
+
"undefined"
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
},
|
|
172
183
|
{
|
|
173
184
|
"name": "theme",
|
|
174
185
|
"description": "The theme variants to apply to the component.",
|
|
@@ -360,6 +371,17 @@
|
|
|
360
371
|
"boolean"
|
|
361
372
|
]
|
|
362
373
|
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"name": "noVerticalOverlap",
|
|
377
|
+
"description": "Defines whether the overlay should overlap the target element\nin the y-axis, or be positioned right above/below it.",
|
|
378
|
+
"value": {
|
|
379
|
+
"type": [
|
|
380
|
+
"boolean",
|
|
381
|
+
"null",
|
|
382
|
+
"undefined"
|
|
383
|
+
]
|
|
384
|
+
}
|
|
363
385
|
}
|
|
364
386
|
],
|
|
365
387
|
"events": [
|
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.
|
|
4
|
+
"version": "24.5.0-alpha10",
|
|
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-----------------------------------|------------------------------|----------------------------------\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.
|
|
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-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\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/24.5.0-alpha10/#/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.5.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha10/#/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
|
{
|
|
@@ -61,6 +61,13 @@
|
|
|
61
61
|
"kind": "expression"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"name": "?noVerticalOverlap",
|
|
66
|
+
"description": "Defines whether the overlay should overlap the target element\nin the y-axis, or be positioned right above/below it.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
64
71
|
{
|
|
65
72
|
"name": ".label",
|
|
66
73
|
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|