@vaadin/list-box 24.8.0-alpha9 → 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.
package/README.md CHANGED
@@ -33,29 +33,6 @@ Once installed, import the component in your application:
33
33
  import '@vaadin/list-box';
34
34
  ```
35
35
 
36
- ## Themes
37
-
38
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
39
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/list-box/vaadin-list-box.js) of the package uses Lumo theme.
40
-
41
- To use the Material theme, import the component from the `theme/material` folder:
42
-
43
- ```js
44
- import '@vaadin/list-box/theme/material/vaadin-list-box.js';
45
- ```
46
-
47
- You can also import the Lumo version of the component explicitly:
48
-
49
- ```js
50
- import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
51
- ```
52
-
53
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
54
-
55
- ```js
56
- import '@vaadin/list-box/src/vaadin-list-box.js';
57
- ```
58
-
59
36
  ## Contributing
60
37
 
61
38
  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/list-box",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/*-base-styles.d.ts",
25
+ "!src/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -31,23 +33,20 @@
31
33
  "Vaadin",
32
34
  "vaadin-list-box",
33
35
  "web-components",
34
- "web-component",
35
- "polymer"
36
+ "web-component"
36
37
  ],
37
38
  "dependencies": {
38
39
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.8.0-alpha9",
41
- "@vaadin/component-base": "24.8.0-alpha9",
42
- "@vaadin/item": "24.8.0-alpha9",
43
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
44
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9",
45
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
40
+ "@vaadin/a11y-base": "25.0.0-alpha1",
41
+ "@vaadin/component-base": "25.0.0-alpha1",
42
+ "@vaadin/item": "25.0.0-alpha1",
43
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
44
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
46
45
  "lit": "^3.0.0"
47
46
  },
48
47
  "devDependencies": {
49
- "@vaadin/chai-plugins": "24.8.0-alpha9",
50
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
48
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
49
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
51
50
  "@vaadin/testing-helpers": "^1.1.0",
52
51
  "sinon": "^18.0.0"
53
52
  },
@@ -55,5 +54,5 @@
55
54
  "web-types.json",
56
55
  "web-types.lit.json"
57
56
  ],
58
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
57
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
59
58
  }
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const listBoxStyles: CSSResult;
@@ -0,0 +1,35 @@
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 listBoxStyles = css`
10
+ @layer base {
11
+ :host {
12
+ --vaadin-item-checkmark-display: block;
13
+ display: flex;
14
+ }
15
+
16
+ :host([hidden]) {
17
+ display: none !important;
18
+ }
19
+
20
+ [part='items'] {
21
+ height: 100%;
22
+ overflow-y: auto;
23
+ width: 100%;
24
+ }
25
+
26
+ [part='items'] ::slotted(hr) {
27
+ border-color: var(--vaadin-divider-color, var(--_vaadin-border-color));
28
+ border-width: 0 0 1px;
29
+ margin: 4px 8px;
30
+ margin-inline-start: calc(
31
+ var(--vaadin-icon-size, 1lh) + var(--vaadin-item-gap, var(--_vaadin-gap-container-inline)) + 8px
32
+ );
33
+ }
34
+ }
35
+ `;
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const listBoxStyles: CSSResult;
@@ -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 listBoxStyles = css`
9
+ :host {
10
+ display: flex;
11
+ }
12
+
13
+ :host([hidden]) {
14
+ display: none !important;
15
+ }
16
+
17
+ [part='items'] {
18
+ height: 100%;
19
+ width: 100%;
20
+ overflow-y: auto;
21
+ -webkit-overflow-scrolling: touch;
22
+ }
23
+ `;
@@ -3,7 +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
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
8
  import { MultiSelectListMixin } from './vaadin-multi-select-list-mixin.js';
@@ -59,7 +58,7 @@ export interface ListBoxEventMap extends HTMLElementEventMap, ListBoxCustomEvent
59
58
  * @fires {CustomEvent} selected-changed - Fired when the `selected` property changes.
60
59
  * @fires {CustomEvent} selected-values-changed - Fired when the `selectedValues` property changes.
61
60
  */
62
- declare class ListBox extends MultiSelectListMixin(ThemableMixin(ElementMixin(ControllerMixin(HTMLElement)))) {
61
+ declare class ListBox extends MultiSelectListMixin(ThemableMixin(ElementMixin(HTMLElement))) {
63
62
  focused: Element | null;
64
63
 
65
64
  addEventListener<K extends keyof ListBoxEventMap>(
@@ -3,12 +3,13 @@
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';
7
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
6
+ import { html, LitElement } from 'lit';
8
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
+ import { listBoxStyles } from './vaadin-list-box-core-styles.js';
12
13
  import { MultiSelectListMixin } from './vaadin-multi-select-list-mixin.js';
13
14
 
14
15
  /**
@@ -42,39 +43,16 @@ import { MultiSelectListMixin } from './vaadin-multi-select-list-mixin.js';
42
43
  * @mixes MultiSelectListMixin
43
44
  * @mixes ThemableMixin
44
45
  * @mixes ElementMixin
45
- * @mixes ControllerMixin
46
46
  */
47
- class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
48
- static get template() {
49
- return html`
50
- <style>
51
- :host {
52
- display: flex;
53
- }
54
-
55
- :host([hidden]) {
56
- display: none !important;
57
- }
58
-
59
- [part='items'] {
60
- height: 100%;
61
- width: 100%;
62
- overflow-y: auto;
63
- -webkit-overflow-scrolling: touch;
64
- }
65
- </style>
66
- <div part="items">
67
- <slot></slot>
68
- </div>
69
-
70
- <slot name="tooltip"></slot>
71
- `;
72
- }
73
-
47
+ class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(PolylitMixin(LitElement)))) {
74
48
  static get is() {
75
49
  return 'vaadin-list-box';
76
50
  }
77
51
 
52
+ static get styles() {
53
+ return listBoxStyles;
54
+ }
55
+
78
56
  static get properties() {
79
57
  return {
80
58
  // We don't need to define this property since super default is vertical,
@@ -86,14 +64,15 @@ class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(Controller
86
64
  };
87
65
  }
88
66
 
89
- constructor() {
90
- super();
67
+ /** @protected */
68
+ render() {
69
+ return html`
70
+ <div part="items">
71
+ <slot></slot>
72
+ </div>
91
73
 
92
- /**
93
- * @type {Element | null}
94
- * @protected
95
- */
96
- this.focused;
74
+ <slot name="tooltip"></slot>
75
+ `;
97
76
  }
98
77
 
99
78
  /**
@@ -111,19 +90,9 @@ class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(Controller
111
90
 
112
91
  this.setAttribute('role', 'listbox');
113
92
 
114
- setTimeout(this._checkImport.bind(this), 2000);
115
-
116
93
  this._tooltipController = new TooltipController(this);
117
94
  this.addController(this._tooltipController);
118
95
  }
119
-
120
- /** @private */
121
- _checkImport() {
122
- const item = this.querySelector('vaadin-item');
123
- if (item && !(item instanceof PolymerElement)) {
124
- console.warn(`Make sure you have imported the vaadin-item element.`);
125
- }
126
- }
127
96
  }
128
97
 
129
98
  defineCustomElement(ListBox);
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/list-box",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/list-box",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1 +0,0 @@
1
- export * from './vaadin-list-box.js';
@@ -1,91 +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 { css, html, LitElement } from 'lit';
7
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
- import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { MultiSelectListMixin } from './vaadin-multi-select-list-mixin.js';
13
-
14
- /**
15
- * LitElement based version of `<vaadin-list-box>` web component.
16
- *
17
- * ## Disclaimer
18
- *
19
- * This component is an experiment and not yet a part of Vaadin platform.
20
- * There is no ETA regarding specific Vaadin version where it'll land.
21
- * Feel free to try this code in your apps as per Apache 2.0 license.
22
- */
23
- class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(PolylitMixin(LitElement)))) {
24
- static get is() {
25
- return 'vaadin-list-box';
26
- }
27
-
28
- static get styles() {
29
- return css`
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
- `;
45
- }
46
-
47
- static get properties() {
48
- return {
49
- // We don't need to define this property since super default is vertical,
50
- // but we don't want it to be modified, or be shown in the API docs.
51
- /** @private */
52
- orientation: {
53
- readOnly: true,
54
- },
55
- };
56
- }
57
-
58
- /** @protected */
59
- render() {
60
- return html`
61
- <div part="items">
62
- <slot></slot>
63
- </div>
64
-
65
- <slot name="tooltip"></slot>
66
- `;
67
- }
68
-
69
- /**
70
- * @return {!HTMLElement}
71
- * @protected
72
- * @override
73
- */
74
- get _scrollerElement() {
75
- return this.shadowRoot.querySelector('[part="items"]');
76
- }
77
-
78
- /** @protected */
79
- ready() {
80
- super.ready();
81
-
82
- this.setAttribute('role', 'listbox');
83
-
84
- this._tooltipController = new TooltipController(this);
85
- this.addController(this._tooltipController);
86
- }
87
- }
88
-
89
- defineCustomElement(ListBox);
90
-
91
- export { ListBox };
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-lit-list-box.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-lit-list-box.js';
@@ -1,4 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/font-icons.js';
2
- import '@vaadin/vaadin-material-styles/color.js';
3
- declare const listBox: import("lit").CSSResult;
4
- export { listBox };
@@ -1,27 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/font-icons.js';
2
- import '@vaadin/vaadin-material-styles/color.js';
3
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
-
5
- const listBox = css`
6
- :host {
7
- -webkit-tap-highlight-color: transparent;
8
- --_material-item-selected-icon-display: block;
9
- }
10
-
11
- [part='items'] ::slotted(*) {
12
- cursor: default;
13
- }
14
-
15
- /* Dividers */
16
- [part='items'] ::slotted(hr) {
17
- height: 1px;
18
- border: 0;
19
- padding: 0;
20
- margin: 8px 0;
21
- background-color: var(--material-divider-color);
22
- }
23
- `;
24
-
25
- registerStyles('vaadin-list-box', listBox, { moduleId: 'material-list-box' });
26
-
27
- export { listBox };
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-list-box.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-list-box.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-lit-list-box.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-list-box-styles.js';
2
- import '../../src/vaadin-lit-list-box.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-list-box.js';
@@ -1,2 +0,0 @@
1
- import './theme/lumo/vaadin-lit-list-box.js';
2
- export * from './src/vaadin-lit-list-box.js';