@vaadin/select 24.8.0-alpha8 → 25.0.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.
Files changed (33) hide show
  1. package/README.md +0 -29
  2. package/package.json +18 -19
  3. package/src/{vaadin-lit-select-item.d.ts → vaadin-select-base-styles.d.ts} +3 -1
  4. package/src/vaadin-select-base-styles.js +36 -0
  5. package/src/{vaadin-lit-select.d.ts → vaadin-select-core-styles.d.ts} +3 -1
  6. package/src/{vaadin-lit-select-list-box.d.ts → vaadin-select-core-styles.js} +11 -1
  7. package/src/vaadin-select-item.js +28 -19
  8. package/src/vaadin-select-list-box.d.ts +1 -2
  9. package/src/vaadin-select-list-box.js +15 -26
  10. package/src/vaadin-select-overlay-base-styles.js +23 -0
  11. package/src/vaadin-select-overlay-core-styles.js +23 -0
  12. package/src/vaadin-select-overlay.js +21 -26
  13. package/src/vaadin-select-value-button-base-styles.js +32 -0
  14. package/src/vaadin-select-value-button.js +11 -7
  15. package/src/vaadin-select.js +34 -72
  16. package/web-types.json +2 -2
  17. package/web-types.lit.json +2 -2
  18. package/src/vaadin-lit-select-item.js +0 -70
  19. package/src/vaadin-lit-select-list-box.js +0 -85
  20. package/src/vaadin-lit-select-overlay.js +0 -70
  21. package/src/vaadin-lit-select-value-button.js +0 -42
  22. package/src/vaadin-lit-select.js +0 -122
  23. package/theme/lumo/vaadin-lit-select.d.ts +0 -7
  24. package/theme/lumo/vaadin-lit-select.js +0 -7
  25. package/theme/material/vaadin-lit-select.d.ts +0 -7
  26. package/theme/material/vaadin-lit-select.js +0 -7
  27. package/theme/material/vaadin-select-styles.d.ts +0 -7
  28. package/theme/material/vaadin-select-styles.js +0 -77
  29. package/theme/material/vaadin-select.d.ts +0 -7
  30. package/theme/material/vaadin-select.js +0 -7
  31. package/vaadin-lit-select.d.ts +0 -1
  32. package/vaadin-lit-select.js +0 -2
  33. /package/src/{vaadin-select-value-button-styles.js → vaadin-select-value-button-core-styles.js} +0 -0
package/README.md CHANGED
@@ -39,35 +39,6 @@ Install the component:
39
39
  npm i @vaadin/select
40
40
  ```
41
41
 
42
- Once installed, import the component in your application:
43
-
44
- ```js
45
- import '@vaadin/select';
46
- ```
47
-
48
- ## Themes
49
-
50
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
51
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/select/vaadin-select.js) of the package uses the Lumo theme.
52
-
53
- To use the Material theme, import the component from the `theme/material` folder:
54
-
55
- ```js
56
- import '@vaadin/select/theme/material/vaadin-select.js';
57
- ```
58
-
59
- You can also import the Lumo version of the component explicitly:
60
-
61
- ```js
62
- import '@vaadin/select/theme/lumo/vaadin-select.js';
63
- ```
64
-
65
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
66
-
67
- ```js
68
- import '@vaadin/select/src/vaadin-select.js';
69
- ```
70
-
71
42
  ## Contributing
72
43
 
73
44
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/select",
3
- "version": "24.8.0-alpha8",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,6 +23,8 @@
23
23
  "lit.d.ts",
24
24
  "lit.js",
25
25
  "src",
26
+ "!src/*-base-styles.d.ts",
27
+ "!src/*-base-styles.js",
26
28
  "theme",
27
29
  "vaadin-*.d.ts",
28
30
  "vaadin-*.js",
@@ -33,29 +35,26 @@
33
35
  "Vaadin",
34
36
  "vaadin-select",
35
37
  "web-components",
36
- "web-component",
37
- "polymer"
38
+ "web-component"
38
39
  ],
39
40
  "dependencies": {
40
41
  "@open-wc/dedupe-mixin": "^1.3.0",
41
- "@polymer/polymer": "^3.2.0",
42
- "@vaadin/a11y-base": "24.8.0-alpha8",
43
- "@vaadin/button": "24.8.0-alpha8",
44
- "@vaadin/component-base": "24.8.0-alpha8",
45
- "@vaadin/field-base": "24.8.0-alpha8",
46
- "@vaadin/input-container": "24.8.0-alpha8",
47
- "@vaadin/item": "24.8.0-alpha8",
48
- "@vaadin/list-box": "24.8.0-alpha8",
49
- "@vaadin/lit-renderer": "24.8.0-alpha8",
50
- "@vaadin/overlay": "24.8.0-alpha8",
51
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
52
- "@vaadin/vaadin-material-styles": "24.8.0-alpha8",
53
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
42
+ "@vaadin/a11y-base": "25.0.0-alpha1",
43
+ "@vaadin/button": "25.0.0-alpha1",
44
+ "@vaadin/component-base": "25.0.0-alpha1",
45
+ "@vaadin/field-base": "25.0.0-alpha1",
46
+ "@vaadin/input-container": "25.0.0-alpha1",
47
+ "@vaadin/item": "25.0.0-alpha1",
48
+ "@vaadin/list-box": "25.0.0-alpha1",
49
+ "@vaadin/lit-renderer": "25.0.0-alpha1",
50
+ "@vaadin/overlay": "25.0.0-alpha1",
51
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
52
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
54
53
  "lit": "^3.0.0"
55
54
  },
56
55
  "devDependencies": {
57
- "@vaadin/chai-plugins": "24.8.0-alpha8",
58
- "@vaadin/test-runner-commands": "24.8.0-alpha8",
56
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
57
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
59
58
  "@vaadin/testing-helpers": "^1.1.0",
60
59
  "sinon": "^18.0.0"
61
60
  },
@@ -63,5 +62,5 @@
63
62
  "web-types.json",
64
63
  "web-types.lit.json"
65
64
  ],
66
- "gitHead": "d914bb8f669d7e3d1981feb8eac05688ab9870b4"
65
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
67
66
  }
@@ -3,4 +3,6 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- export * from './vaadin-select-item.js';
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const selectStyles: CSSResult;
@@ -0,0 +1,36 @@
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/component-base/src/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const selectStyles = css`
10
+ @layer base {
11
+ :host {
12
+ position: relative;
13
+ }
14
+
15
+ ::slotted([slot='value']) {
16
+ flex: 1;
17
+ }
18
+
19
+ :host(:not([focus-ring])) [part='input-field'] {
20
+ outline: none;
21
+ }
22
+
23
+ :host([readonly]:not([focus-ring])) [part='input-field'] {
24
+ --vaadin-input-field-border-color: inherit;
25
+ }
26
+
27
+ [part='input-field'],
28
+ :host(:not([readonly])) ::slotted([slot='value']) {
29
+ cursor: var(--vaadin-clickable-cursor);
30
+ }
31
+
32
+ [part='toggle-button']::before {
33
+ mask-image: var(--_vaadin-icon-chevron-down);
34
+ }
35
+ }
36
+ `;
@@ -3,4 +3,6 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- export * from './vaadin-select.js';
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const selectStyles: CSSResult;
@@ -3,4 +3,14 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- export * from './vaadin-select-list-box.js';
6
+ import { css } from 'lit';
7
+
8
+ export const selectStyles = css`
9
+ :host {
10
+ position: relative;
11
+ }
12
+
13
+ ::slotted([slot='value']) {
14
+ flex-grow: 1;
15
+ }
16
+ `;
@@ -3,9 +3,11 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
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';
9
11
  import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
10
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
13
 
@@ -19,35 +21,42 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
19
21
  * @mixes ThemableMixin
20
22
  * @protected
21
23
  */
22
- class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
24
+ class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
23
25
  static get is() {
24
26
  return 'vaadin-select-item';
25
27
  }
26
28
 
27
- static get template() {
28
- return html`
29
- <style>
30
- :host {
31
- display: inline-block;
32
- }
29
+ static get styles() {
30
+ return itemStyles;
31
+ }
33
32
 
34
- :host([hidden]) {
35
- display: none !important;
36
- }
37
- </style>
33
+ static get properties() {
34
+ return {
35
+ /**
36
+ * Use property instead of setting an attribute in `ready()`
37
+ * for cloning the selected item attached to the value button:
38
+ * in this case, `role` attribute is removed synchronously, and
39
+ * using `ready()` would incorrectly restore the attribute.
40
+ *
41
+ * @protected
42
+ */
43
+ role: {
44
+ type: String,
45
+ value: 'option',
46
+ reflectToAttribute: true,
47
+ },
48
+ };
49
+ }
50
+
51
+ /** @protected */
52
+ render() {
53
+ return html`
38
54
  <span part="checkmark" aria-hidden="true"></span>
39
55
  <div part="content">
40
56
  <slot></slot>
41
57
  </div>
42
58
  `;
43
59
  }
44
-
45
- /** @protected */
46
- ready() {
47
- super.ready();
48
-
49
- this.setAttribute('role', 'option');
50
- }
51
60
  }
52
61
 
53
62
  defineCustomElement(SelectItem);
@@ -4,14 +4,13 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
7
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
7
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
9
 
11
10
  /**
12
11
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
13
12
  */
14
- declare class SelectListBox extends ListMixin(DirMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {}
13
+ declare class SelectListBox extends ListMixin(DirMixin(ThemableMixin(HTMLElement))) {}
15
14
 
16
15
  declare global {
17
16
  interface HTMLElementTagNameMap {
@@ -3,11 +3,12 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
8
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
9
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
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';
11
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
13
 
13
14
  /**
@@ -15,39 +16,18 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
15
16
  *
16
17
  * @customElement
17
18
  * @extends HTMLElement
18
- * @mixes ControllerMixin
19
19
  * @mixes DirMixin
20
20
  * @mixes ListMixin
21
21
  * @mixes ThemableMixin
22
22
  * @protected
23
23
  */
24
- class SelectListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(PolymerElement)))) {
24
+ class SelectListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
25
25
  static get is() {
26
26
  return 'vaadin-select-list-box';
27
27
  }
28
28
 
29
- static get template() {
30
- return html`
31
- <style>
32
- :host {
33
- display: flex;
34
- }
35
-
36
- :host([hidden]) {
37
- display: none !important;
38
- }
39
-
40
- [part='items'] {
41
- height: 100%;
42
- width: 100%;
43
- overflow-y: auto;
44
- -webkit-overflow-scrolling: touch;
45
- }
46
- </style>
47
- <div part="items">
48
- <slot></slot>
49
- </div>
50
- `;
29
+ static get styles() {
30
+ return listBoxStyles;
51
31
  }
52
32
 
53
33
  static get properties() {
@@ -70,6 +50,15 @@ class SelectListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(Pol
70
50
  return this.shadowRoot.querySelector('[part="items"]');
71
51
  }
72
52
 
53
+ /** @protected */
54
+ render() {
55
+ return html`
56
+ <div part="items">
57
+ <slot></slot>
58
+ </div>
59
+ `;
60
+ }
61
+
73
62
  /** @protected */
74
63
  ready() {
75
64
  super.ready();
@@ -0,0 +1,23 @@
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 { css } from 'lit';
7
+
8
+ export const selectOverlayStyles = css`
9
+ @layer base {
10
+ :host {
11
+ align-items: flex-start;
12
+ justify-content: flex-start;
13
+ }
14
+
15
+ :host(:not([phone])) [part='overlay'] {
16
+ min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
17
+ }
18
+
19
+ [part='content'] {
20
+ padding: var(--vaadin-item-overlay-padding, 4px);
21
+ }
22
+ }
23
+ `;
@@ -0,0 +1,23 @@
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 { css } from 'lit';
7
+
8
+ export const selectOverlayStyles = css`
9
+ :host {
10
+ align-items: flex-start;
11
+ justify-content: flex-start;
12
+ }
13
+
14
+ :host(:not([phone])) [part='overlay'] {
15
+ min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
16
+ }
17
+
18
+ @media (forced-colors: active) {
19
+ [part='overlay'] {
20
+ outline: 3px solid;
21
+ }
22
+ }
23
+ `;
@@ -3,33 +3,14 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
8
9
  import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
9
- import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { selectOverlayStyles } from './vaadin-select-overlay-core-styles.js';
10
12
  import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
11
13
 
12
- const selectOverlayStyles = css`
13
- :host {
14
- align-items: flex-start;
15
- justify-content: flex-start;
16
- }
17
-
18
- :host(:not([phone])) [part='overlay'] {
19
- min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
20
- }
21
-
22
- @media (forced-colors: active) {
23
- [part='overlay'] {
24
- outline: 3px solid;
25
- }
26
- }
27
- `;
28
-
29
- registerStyles('vaadin-select-overlay', [overlayStyles, selectOverlayStyles], {
30
- moduleId: 'vaadin-select-overlay-styles',
31
- });
32
-
33
14
  /**
34
15
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
35
16
  *
@@ -39,14 +20,19 @@ registerStyles('vaadin-select-overlay', [overlayStyles, selectOverlayStyles], {
39
20
  * @mixes ThemableMixin
40
21
  * @private
41
22
  */
42
- export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolymerElement)) {
23
+ export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolylitMixin(LitElement))) {
43
24
  static get is() {
44
25
  return 'vaadin-select-overlay';
45
26
  }
46
27
 
47
- static get template() {
28
+ static get styles() {
29
+ return [overlayStyles, selectOverlayStyles];
30
+ }
31
+
32
+ /** @protected */
33
+ render() {
48
34
  return html`
49
- <div id="backdrop" part="backdrop" hidden$="[[!withBackdrop]]"></div>
35
+ <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
50
36
  <div part="overlay" id="overlay" tabindex="0">
51
37
  <div part="content" id="content">
52
38
  <slot></slot>
@@ -54,6 +40,15 @@ export class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolymerEleme
54
40
  </div>
55
41
  `;
56
42
  }
43
+
44
+ /** @protected */
45
+ updated(props) {
46
+ super.updated(props);
47
+
48
+ if (props.has('renderer')) {
49
+ this.requestContentUpdate();
50
+ }
51
+ }
57
52
  }
58
53
 
59
54
  defineCustomElement(SelectOverlay);
@@ -0,0 +1,32 @@
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 { css } from 'lit';
7
+
8
+ export const valueButton = css`
9
+ @layer base {
10
+ :host {
11
+ min-height: 1lh;
12
+ outline: none;
13
+ overflow: hidden;
14
+ white-space: nowrap;
15
+ width: 100%;
16
+ }
17
+
18
+ ::slotted(*) {
19
+ padding: 0;
20
+ cursor: inherit;
21
+ }
22
+
23
+ .vaadin-button-container,
24
+ [part='label'] {
25
+ display: contents;
26
+ }
27
+
28
+ :host([disabled]) {
29
+ pointer-events: none;
30
+ }
31
+ }
32
+ `;
@@ -3,13 +3,12 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { valueButton } from './vaadin-select-value-button-styles.js';
11
-
12
- registerStyles('vaadin-select-value-button', valueButton, { moduleId: 'vaadin-select-value-button-styles' });
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';
13
12
 
14
13
  /**
15
14
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
@@ -20,12 +19,17 @@ registerStyles('vaadin-select-value-button', valueButton, { moduleId: 'vaadin-se
20
19
  * @mixes ThemableMixin
21
20
  * @protected
22
21
  */
23
- class SelectValueButton extends ButtonMixin(ThemableMixin(PolymerElement)) {
22
+ class SelectValueButton extends ButtonMixin(ThemableMixin(PolylitMixin(LitElement))) {
24
23
  static get is() {
25
24
  return 'vaadin-select-value-button';
26
25
  }
27
26
 
28
- static get template() {
27
+ static get styles() {
28
+ return valueButton;
29
+ }
30
+
31
+ /** @protected */
32
+ render() {
29
33
  return html`
30
34
  <div class="vaadin-button-container">
31
35
  <span part="label">