@vaadin/select 24.8.5 → 24.9.0-alpha1
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 +16 -16
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-select-item.js +0 -63
- package/src/vaadin-lit-select-list-box.js +0 -71
- package/src/vaadin-lit-select-overlay.js +0 -53
- package/src/vaadin-lit-select-value-button.js +0 -42
- package/src/vaadin-lit-select.js +0 -109
- package/theme/lumo/vaadin-lit-select.d.ts +0 -7
- package/theme/lumo/vaadin-lit-select.js +0 -7
- package/theme/material/vaadin-lit-select.d.ts +0 -7
- package/theme/material/vaadin-lit-select.js +0 -7
- package/vaadin-lit-select.d.ts +0 -1
- package/vaadin-lit-select.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.9.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,23 +39,23 @@
|
|
|
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.9.0-alpha1",
|
|
43
|
+
"@vaadin/button": "24.9.0-alpha1",
|
|
44
|
+
"@vaadin/component-base": "24.9.0-alpha1",
|
|
45
|
+
"@vaadin/field-base": "24.9.0-alpha1",
|
|
46
|
+
"@vaadin/input-container": "24.9.0-alpha1",
|
|
47
|
+
"@vaadin/item": "24.9.0-alpha1",
|
|
48
|
+
"@vaadin/list-box": "24.9.0-alpha1",
|
|
49
|
+
"@vaadin/lit-renderer": "24.9.0-alpha1",
|
|
50
|
+
"@vaadin/overlay": "24.9.0-alpha1",
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "24.9.0-alpha1",
|
|
52
|
+
"@vaadin/vaadin-material-styles": "24.9.0-alpha1",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "24.9.0-alpha1",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/chai-plugins": "
|
|
58
|
-
"@vaadin/test-runner-commands": "
|
|
57
|
+
"@vaadin/chai-plugins": "24.9.0-alpha1",
|
|
58
|
+
"@vaadin/test-runner-commands": "24.9.0-alpha1",
|
|
59
59
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
60
60
|
"sinon": "^18.0.0"
|
|
61
61
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"web-types.json",
|
|
64
64
|
"web-types.lit.json"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "cc13d59f0e3cd1a3b0c19c1a900a5308446fe7ac"
|
|
67
67
|
}
|
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.9.0-alpha1",
|
|
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`--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.
|
|
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.9.0-alpha1/#/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.9.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.9.0-alpha1/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.9.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "24.
|
|
4
|
+
"version": "24.9.0-alpha1",
|
|
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`--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.
|
|
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.9.0-alpha1/#/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.9.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.9.0-alpha1/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.9.0-alpha1/#/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
|
{
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { itemStyles } from '@vaadin/item/src/vaadin-item-core-styles.js';
|
|
11
|
-
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
12
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
16
|
-
*
|
|
17
|
-
* @extends HTMLElement
|
|
18
|
-
* @mixes DirMixin
|
|
19
|
-
* @mixes ItemMixin
|
|
20
|
-
* @mixes ThemableMixin
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-select-item';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return itemStyles;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static get properties() {
|
|
33
|
-
return {
|
|
34
|
-
/**
|
|
35
|
-
* Use property instead of setting an attribute in `ready()`
|
|
36
|
-
* for cloning the selected item attached to the value button:
|
|
37
|
-
* in this case, `role` attribute is removed synchronously, and
|
|
38
|
-
* using `ready()` would incorrectly restore the attribute.
|
|
39
|
-
*
|
|
40
|
-
* @protected
|
|
41
|
-
*/
|
|
42
|
-
role: {
|
|
43
|
-
type: String,
|
|
44
|
-
value: 'option',
|
|
45
|
-
reflectToAttribute: true,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** @protected */
|
|
51
|
-
render() {
|
|
52
|
-
return html`
|
|
53
|
-
<span part="checkmark" aria-hidden="true"></span>
|
|
54
|
-
<div part="content">
|
|
55
|
-
<slot></slot>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
defineCustomElement(SelectItem);
|
|
62
|
-
|
|
63
|
-
export { SelectItem };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { listBoxStyles } from '@vaadin/list-box/src/vaadin-list-box-core-styles.js';
|
|
12
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
16
|
-
*
|
|
17
|
-
* @extends HTMLElement
|
|
18
|
-
* @mixes DirMixin
|
|
19
|
-
* @mixes ListMixin
|
|
20
|
-
* @mixes ThemableMixin
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
class SelectListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-select-list-box';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return listBoxStyles;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static get properties() {
|
|
33
|
-
return {
|
|
34
|
-
// We don't need to define this property since super default is vertical,
|
|
35
|
-
// but we don't want it to be modified, or be shown in the API docs.
|
|
36
|
-
/** @private */
|
|
37
|
-
orientation: {
|
|
38
|
-
readOnly: true,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @return {!HTMLElement}
|
|
45
|
-
* @protected
|
|
46
|
-
* @override
|
|
47
|
-
*/
|
|
48
|
-
get _scrollerElement() {
|
|
49
|
-
return this.shadowRoot.querySelector('[part="items"]');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** @protected */
|
|
53
|
-
render() {
|
|
54
|
-
return html`
|
|
55
|
-
<div part="items">
|
|
56
|
-
<slot></slot>
|
|
57
|
-
</div>
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** @protected */
|
|
62
|
-
ready() {
|
|
63
|
-
super.ready();
|
|
64
|
-
|
|
65
|
-
this.setAttribute('role', 'listbox');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
defineCustomElement(SelectListBox);
|
|
70
|
-
|
|
71
|
-
export { SelectListBox };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { selectOverlayStyles } from './vaadin-select-overlay-core-styles.js';
|
|
12
|
-
import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
16
|
-
*
|
|
17
|
-
* @extends HTMLElement
|
|
18
|
-
* @mixes SelectOverlayMixin
|
|
19
|
-
* @mixes ThemableMixin
|
|
20
|
-
* @protected
|
|
21
|
-
*/
|
|
22
|
-
class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
23
|
-
static get is() {
|
|
24
|
-
return 'vaadin-select-overlay';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static get styles() {
|
|
28
|
-
return [overlayStyles, selectOverlayStyles];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** @protected */
|
|
32
|
-
render() {
|
|
33
|
-
return html`
|
|
34
|
-
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
35
|
-
<div part="overlay" id="overlay" tabindex="0">
|
|
36
|
-
<div part="content" id="content">
|
|
37
|
-
<slot></slot>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** @protected */
|
|
44
|
-
updated(props) {
|
|
45
|
-
super.updated(props);
|
|
46
|
-
|
|
47
|
-
if (props.has('renderer')) {
|
|
48
|
-
this.requestContentUpdate();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
defineCustomElement(SelectOverlay);
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { valueButton } from './vaadin-select-value-button-core-styles.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
15
|
-
*
|
|
16
|
-
* @extends HTMLElement
|
|
17
|
-
* @mixes ButtonMixin
|
|
18
|
-
* @mixes ThemableMixin
|
|
19
|
-
* @protected
|
|
20
|
-
*/
|
|
21
|
-
class SelectValueButton extends ButtonMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
22
|
-
static get is() {
|
|
23
|
-
return 'vaadin-select-value-button';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static get styles() {
|
|
27
|
-
return valueButton;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** @protected */
|
|
31
|
-
render() {
|
|
32
|
-
return html`
|
|
33
|
-
<div class="vaadin-button-container">
|
|
34
|
-
<span part="label">
|
|
35
|
-
<slot></slot>
|
|
36
|
-
</span>
|
|
37
|
-
</div>
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
defineCustomElement(SelectValueButton);
|
package/src/vaadin-lit-select.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/input-container/src/vaadin-lit-input-container.js';
|
|
7
|
-
import './vaadin-lit-select-item.js';
|
|
8
|
-
import './vaadin-lit-select-list-box.js';
|
|
9
|
-
import './vaadin-lit-select-overlay.js';
|
|
10
|
-
import './vaadin-lit-select-value-button.js';
|
|
11
|
-
import { html, LitElement } from 'lit';
|
|
12
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
13
|
-
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
|
|
14
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
15
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
16
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
17
|
-
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
18
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
19
|
-
import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
20
|
-
import { selectStyles } from './vaadin-select-core-styles.js';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* LitElement based version of `<vaadin-select>` web component.
|
|
24
|
-
*
|
|
25
|
-
* ## Disclaimer
|
|
26
|
-
*
|
|
27
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
28
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
29
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
30
|
-
*
|
|
31
|
-
* @extends HTMLElement
|
|
32
|
-
*/
|
|
33
|
-
class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
34
|
-
static get is() {
|
|
35
|
-
return 'vaadin-select';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static get styles() {
|
|
39
|
-
return [inputFieldShared, screenReaderOnly, selectStyles];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** @protected */
|
|
43
|
-
render() {
|
|
44
|
-
return html`
|
|
45
|
-
<div class="vaadin-select-container">
|
|
46
|
-
<div part="label" @click="${this._onClick}">
|
|
47
|
-
<slot name="label"></slot>
|
|
48
|
-
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<vaadin-input-container
|
|
52
|
-
part="input-field"
|
|
53
|
-
.readonly="${this.readonly}"
|
|
54
|
-
.disabled="${this.disabled}"
|
|
55
|
-
.invalid="${this.invalid}"
|
|
56
|
-
theme="${ifDefined(this._theme)}"
|
|
57
|
-
@click="${this._onClick}"
|
|
58
|
-
>
|
|
59
|
-
<slot name="prefix" slot="prefix"></slot>
|
|
60
|
-
<slot name="value"></slot>
|
|
61
|
-
<div part="toggle-button" slot="suffix" aria-hidden="true" @mousedown="${this._onToggleMouseDown}"></div>
|
|
62
|
-
</vaadin-input-container>
|
|
63
|
-
|
|
64
|
-
<div part="helper-text">
|
|
65
|
-
<slot name="helper"></slot>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div part="error-message">
|
|
69
|
-
<slot name="error-message"></slot>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<vaadin-select-overlay
|
|
74
|
-
id="overlay"
|
|
75
|
-
.owner="${this}"
|
|
76
|
-
.positionTarget="${this._inputContainer}"
|
|
77
|
-
.opened="${this.opened}"
|
|
78
|
-
.withBackdrop="${this._phone}"
|
|
79
|
-
.renderer="${this.renderer || this.__defaultRenderer}"
|
|
80
|
-
?phone="${this._phone}"
|
|
81
|
-
theme="${ifDefined(this._theme)}"
|
|
82
|
-
?no-vertical-overlap="${this.noVerticalOverlap}"
|
|
83
|
-
@opened-changed="${this._onOpenedChanged}"
|
|
84
|
-
@vaadin-overlay-open="${this._onOverlayOpen}"
|
|
85
|
-
></vaadin-select-overlay>
|
|
86
|
-
|
|
87
|
-
<slot name="tooltip"></slot>
|
|
88
|
-
<div class="sr-only">
|
|
89
|
-
<slot name="sr-label"></slot>
|
|
90
|
-
</div>
|
|
91
|
-
`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** @private */
|
|
95
|
-
_onOpenedChanged(event) {
|
|
96
|
-
this.opened = event.detail.value;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** @private */
|
|
100
|
-
_onOverlayOpen() {
|
|
101
|
-
if (this._menuElement) {
|
|
102
|
-
this._menuElement.focus();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
defineCustomElement(Select);
|
|
108
|
-
|
|
109
|
-
export { Select };
|
package/vaadin-lit-select.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-select.js';
|
package/vaadin-lit-select.js
DELETED