@vaadin/list-box 22.0.0-alpha9 → 22.0.0

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
@@ -1,61 +1,61 @@
1
- # <vaadin-list-box>
1
+ # @vaadin/list-box
2
2
 
3
- [Live Demo ↗](https://vaadin.com/components/vaadin-list-box/html-examples)
4
- |
5
- [API documentation ↗](https://vaadin.com/components/vaadin-list-box/html-api)
3
+ A web component for selecting one or more values from a scrollable list of items.
6
4
 
7
- [<vaadin-list-box>](https://vaadin.com/components/vaadin-list-box) is a Web Component providing reusable list boxes, part of the [Vaadin components](https://vaadin.com/components).
5
+ [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/list-box)
8
6
 
9
7
  [![npm version](https://badgen.net/npm/v/@vaadin/list-box)](https://www.npmjs.com/package/@vaadin/list-box)
10
- [![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/vaadinvaadin-list-box)
11
8
  [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
12
9
 
13
10
  ```html
14
11
  <vaadin-list-box selected="2">
15
- <b>Select an Item</b>
16
- <vaadin-item>Item one</vaadin-item>
17
- <vaadin-item>Item two</vaadin-item>
12
+ <b>Select an list-box</b>
13
+ <vaadin-list-box>list-box one</vaadin-list-box>
14
+ <vaadin-list-box>list-box two</vaadin-list-box>
18
15
  <hr />
19
- <vaadin-item>Item three</vaadin-item>
20
- <vaadin-item>Item four</vaadin-item>
16
+ <vaadin-list-box>list-box three</vaadin-list-box>
17
+ <vaadin-list-box>list-box four</vaadin-list-box>
21
18
  </vaadin-list-box>
22
19
  ```
23
20
 
24
- [<img src="https://raw.githubusercontent.com/vaadin/vaadin-list-box/master/screenshot.png" width="150" alt="Screenshot of vaadin-list-box">](https://vaadin.com/components/vaadin-list-box)
21
+ [<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/list-box/screenshot.png" width="150" alt="Screenshot of vaadin-list-box">](https://vaadin.com/docs/latest/ds/components/list-box)
25
22
 
26
23
  ## Installation
27
24
 
28
- Install `vaadin-list-box`:
25
+ Install the component:
29
26
 
30
27
  ```sh
31
- npm i @vaadin/list-box --save
28
+ npm i @vaadin/list-box
32
29
  ```
33
30
 
34
- Once installed, import it in your application:
31
+ Once installed, import the component in your application:
35
32
 
36
33
  ```js
37
- import '@vaadin/list-box/vaadin-list-box.js';
34
+ import '@vaadin/list-box';
38
35
  ```
39
36
 
40
- ## Getting started
37
+ ## Themes
41
38
 
42
- Vaadin components use the Lumo theme by default.
39
+ Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
40
+ The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/list-box/vaadin-list-box.js) of the package uses Lumo theme.
43
41
 
44
- To use the Material theme, import the correspondent file from the `theme/material` folder.
42
+ To use the Material theme, import the component from the `theme/material` folder:
45
43
 
46
- ## Entry points
47
-
48
- - The component with the Lumo theme:
49
-
50
- `theme/lumo/vaadin-list-box.js`
44
+ ```js
45
+ import '@vaadin/list-box/theme/material/vaadin-list-box.js';
46
+ ```
51
47
 
52
- - The component with the Material theme:
48
+ You can also import the Lumo version of the component explicitly:
53
49
 
54
- `theme/material/vaadin-list-box.js`
50
+ ```js
51
+ import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
52
+ ```
55
53
 
56
- - Alias for `theme/lumo/vaadin-list-box.js`:
54
+ Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
57
55
 
58
- `vaadin-list-box.js`
56
+ ```js
57
+ import '@vaadin/list-box/src/vaadin-list-box.js';
58
+ ```
59
59
 
60
60
  ## Contributing
61
61
 
@@ -65,4 +65,5 @@ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/
65
65
 
66
66
  Apache License 2.0
67
67
 
68
- Vaadin collects development time usage statistics to improve this product. For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
68
+ Vaadin collects usage statistics at development time to improve this product.
69
+ For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/list-box",
3
- "version": "22.0.0-alpha9",
3
+ "version": "22.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,17 +33,17 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "22.0.0-alpha9",
37
- "@vaadin/item": "22.0.0-alpha9",
38
- "@vaadin/vaadin-list-mixin": "22.0.0-alpha9",
39
- "@vaadin/vaadin-lumo-styles": "22.0.0-alpha9",
40
- "@vaadin/vaadin-material-styles": "22.0.0-alpha9",
41
- "@vaadin/vaadin-themable-mixin": "22.0.0-alpha9"
36
+ "@vaadin/component-base": "^22.0.0",
37
+ "@vaadin/item": "^22.0.0",
38
+ "@vaadin/vaadin-list-mixin": "^22.0.0",
39
+ "@vaadin/vaadin-lumo-styles": "^22.0.0",
40
+ "@vaadin/vaadin-material-styles": "^22.0.0",
41
+ "@vaadin/vaadin-themable-mixin": "^22.0.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@esm-bundle/chai": "^4.3.4",
45
- "@vaadin/testing-helpers": "^0.3.0",
45
+ "@vaadin/testing-helpers": "^0.3.2",
46
46
  "sinon": "^9.2.1"
47
47
  },
48
- "gitHead": "6e8c899dc65918f97e3c0acb2076122c4b2ef274"
48
+ "gitHead": "b668e9b1a975227fbe34beb70d1cd5b03dce2348"
49
49
  }
@@ -4,8 +4,8 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
7
  import { MultiSelectListMixin } from '@vaadin/vaadin-list-mixin/vaadin-multi-select-list-mixin.js';
8
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
9
 
10
10
  /**
11
11
  * Fired when the `items` property changes.
@@ -61,8 +61,6 @@ export interface ListBoxEventMap extends HTMLElementEventMap, ListBoxCustomEvent
61
61
  declare class ListBox extends MultiSelectListMixin(ThemableMixin(ElementMixin(HTMLElement))) {
62
62
  focused: Element | null;
63
63
 
64
- readonly _scrollerElement: HTMLElement;
65
-
66
64
  addEventListener<K extends keyof ListBoxEventMap>(
67
65
  type: K,
68
66
  listener: (this: ListBox, ev: ListBoxEventMap[K]) => void,
@@ -3,10 +3,10 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
6
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
8
  import { MultiSelectListMixin } from '@vaadin/vaadin-list-mixin/vaadin-multi-select-list-mixin.js';
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
10
 
11
11
  /**
12
12
  * `<vaadin-list-box>` is a Web Component for creating menus.
@@ -1,7 +1,7 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-lumo-styles/color.js';
3
2
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
3
  import '@vaadin/vaadin-lumo-styles/style.js';
4
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
5
 
6
6
  registerStyles(
7
7
  'vaadin-list-box',
@@ -11,46 +11,6 @@ registerStyles(
11
11
  --_lumo-item-selected-icon-display: var(--_lumo-list-box-item-selected-icon-display, block);
12
12
  }
13
13
 
14
- /* Normal item */
15
- [part='items'] ::slotted(vaadin-item) {
16
- -webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
17
- cursor: var(--lumo-clickable-cursor);
18
- outline: none;
19
- border-radius: var(--lumo-border-radius-m);
20
- padding-left: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
21
- padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
22
- }
23
-
24
- [part='items'] ::slotted(vaadin-item[disabled]) {
25
- cursor: default;
26
- }
27
-
28
- /* Workaround to display checkmark in IE11 when list-box is not used in dropdown-menu */
29
- [part='items'] ::slotted(vaadin-item)::before {
30
- display: var(--_lumo-item-selected-icon-display);
31
- }
32
-
33
- /* Hovered item */
34
- /* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
35
- [part='items'] ::slotted(vaadin-item:hover:not([disabled])) {
36
- background-color: var(--lumo-primary-color-10pct);
37
- }
38
-
39
- /* Focused item */
40
- [part='items'] ::slotted([focus-ring]:not([disabled])) {
41
- box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
42
- }
43
-
44
- @media (pointer: coarse) {
45
- [part='items'] ::slotted(vaadin-item:hover:not([disabled])) {
46
- background-color: transparent;
47
- }
48
-
49
- [part='items'] ::slotted([focus-ring]:not([disabled])) {
50
- box-shadow: none;
51
- }
52
- }
53
-
54
14
  /* Dividers */
55
15
  [part='items'] ::slotted(hr) {
56
16
  height: 1px;
@@ -59,12 +19,6 @@ registerStyles(
59
19
  margin: var(--lumo-space-s) var(--lumo-border-radius-m);
60
20
  background-color: var(--lumo-contrast-10pct);
61
21
  }
62
-
63
- /* RTL specific styles */
64
- :host([dir='rtl']) [part='items'] ::slotted(vaadin-item) {
65
- padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
66
- padding-right: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
67
- }
68
22
  `,
69
23
  { moduleId: 'lumo-list-box' }
70
24
  );
@@ -1,6 +1,6 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-material-styles/font-icons.js';
3
2
  import '@vaadin/vaadin-material-styles/color.js';
3
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
4
 
5
5
  registerStyles(
6
6
  'vaadin-list-box',
@@ -14,28 +14,6 @@ registerStyles(
14
14
  cursor: default;
15
15
  }
16
16
 
17
- [part='items'] ::slotted(vaadin-item) {
18
- min-height: 36px;
19
- padding: 8px 32px 8px 10px;
20
- font-size: var(--material-small-font-size);
21
- line-height: 24px;
22
- }
23
-
24
- [part='items'] ::slotted(vaadin-item:hover:not([disabled])) {
25
- background-color: var(--material-secondary-background-color);
26
- }
27
-
28
- [part='items'] ::slotted(vaadin-item[focused]:not([disabled])) {
29
- background-color: var(--material-divider-color);
30
- }
31
-
32
- @media (pointer: coarse) {
33
- [part='items'] ::slotted(vaadin-item:hover:not([disabled])),
34
- [part='items'] ::slotted(vaadin-item[focused]:not([disabled])) {
35
- background-color: transparent;
36
- }
37
- }
38
-
39
17
  /* Dividers */
40
18
  [part='items'] ::slotted(hr) {
41
19
  height: 1px;
@@ -44,11 +22,6 @@ registerStyles(
44
22
  margin: 8px 0;
45
23
  background-color: var(--material-divider-color);
46
24
  }
47
-
48
- /* RTL specific styles */
49
- :host([dir='rtl']) [part='items'] ::slotted(vaadin-item) {
50
- padding: 8px 10px 8px 32px;
51
- }
52
25
  `,
53
26
  { moduleId: 'material-list-box' }
54
27
  );