@vaadin/item 24.8.4 → 25.0.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 CHANGED
@@ -26,29 +26,6 @@ Once installed, import the component in your application:
26
26
  import '@vaadin/item';
27
27
  ```
28
28
 
29
- ## Themes
30
-
31
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
32
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/item/vaadin-item.js) of the package uses Lumo theme.
33
-
34
- To use the Material theme, import the component from the `theme/material` folder:
35
-
36
- ```js
37
- import '@vaadin/item/theme/material/vaadin-item.js';
38
- ```
39
-
40
- You can also import the Lumo version of the component explicitly:
41
-
42
- ```js
43
- import '@vaadin/item/theme/lumo/vaadin-item.js';
44
- ```
45
-
46
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
47
-
48
- ```js
49
- import '@vaadin/item/src/vaadin-item.js';
50
- ```
51
-
52
29
  ## Contributing
53
30
 
54
31
  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/item",
3
- "version": "24.8.4",
3
+ "version": "25.0.0-alpha10",
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/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -31,28 +33,25 @@
31
33
  "Vaadin",
32
34
  "vaadin-item",
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.4",
41
- "@vaadin/component-base": "~24.8.4",
42
- "@vaadin/vaadin-lumo-styles": "~24.8.4",
43
- "@vaadin/vaadin-material-styles": "~24.8.4",
44
- "@vaadin/vaadin-themable-mixin": "~24.8.4",
40
+ "@vaadin/a11y-base": "25.0.0-alpha10",
41
+ "@vaadin/component-base": "25.0.0-alpha10",
42
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
45
44
  "lit": "^3.0.0"
46
45
  },
47
46
  "devDependencies": {
48
- "@vaadin/chai-plugins": "~24.8.4",
49
- "@vaadin/test-runner-commands": "~24.8.4",
50
- "@vaadin/testing-helpers": "^1.1.0",
47
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
48
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
49
+ "@vaadin/testing-helpers": "^2.0.0",
51
50
  "sinon": "^18.0.0"
52
51
  },
53
52
  "web-types": [
54
53
  "web-types.json",
55
54
  "web-types.lit.json"
56
55
  ],
57
- "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
56
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
58
57
  }
@@ -0,0 +1,57 @@
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 itemStyles = css`
10
+ :host {
11
+ align-items: center;
12
+ border-radius: var(--vaadin-item-border-radius, var(--vaadin-radius-m));
13
+ box-sizing: border-box;
14
+ cursor: var(--vaadin-clickable-cursor);
15
+ display: flex;
16
+ gap: var(--vaadin-item-gap, 0 var(--vaadin-gap-container-inline));
17
+ height: var(--vaadin-item-height, auto);
18
+ padding: var(--vaadin-item-padding, var(--vaadin-padding-container));
19
+ }
20
+
21
+ :host([focused]) {
22
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
23
+ outline-offset: calc(var(--vaadin-focus-ring-width) / -1);
24
+ }
25
+
26
+ :host([disabled]) {
27
+ cursor: var(--vaadin-disabled-cursor);
28
+ opacity: 0.5;
29
+ }
30
+
31
+ :host([hidden]) {
32
+ display: none !important;
33
+ }
34
+
35
+ [part='checkmark'] {
36
+ color: var(--vaadin-item-checkmark-color, inherit);
37
+ display: var(--vaadin-item-checkmark-display, none);
38
+ visibility: hidden;
39
+ }
40
+
41
+ [part='checkmark']::before {
42
+ content: '';
43
+ display: block;
44
+ background: currentColor;
45
+ height: var(--vaadin-icon-size, 1lh);
46
+ mask-image: var(--_vaadin-icon-checkmark);
47
+ width: var(--vaadin-icon-size, 1lh);
48
+ }
49
+
50
+ :host([selected]) [part='checkmark'] {
51
+ visibility: visible;
52
+ }
53
+
54
+ [part='content'] {
55
+ flex: 1;
56
+ }
57
+ `;
@@ -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 itemStyles: CSSResult;
@@ -10,10 +10,8 @@ import { ItemMixin } from './vaadin-item-mixin.js';
10
10
  /**
11
11
  * `<vaadin-item>` is a Web Component providing layout for items in tabs and menus.
12
12
  *
13
- * ```
14
- * <vaadin-item>
15
- * Item content
16
- * </vaadin-item>
13
+ * ```html
14
+ * <vaadin-item>Item content</vaadin-item>
17
15
  * ```
18
16
  *
19
17
  * ### Selectable
@@ -3,22 +3,20 @@
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 { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { itemStyles } from './vaadin-item-core-styles.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
+ import { itemStyles } from './styles/vaadin-item-core-styles.js';
11
13
  import { ItemMixin } from './vaadin-item-mixin.js';
12
14
 
13
- registerStyles('vaadin-item', itemStyles, { moduleId: 'vaadin-item-styles' });
14
-
15
15
  /**
16
16
  * `<vaadin-item>` is a Web Component providing layout for items in tabs and menus.
17
17
  *
18
- * ```
19
- * <vaadin-item>
20
- * Item content
21
- * </vaadin-item>
18
+ * ```html
19
+ * <vaadin-item>Item content</vaadin-item>
22
20
  * ```
23
21
  *
24
22
  * ### Selectable
@@ -56,8 +54,17 @@ registerStyles('vaadin-item', itemStyles, { moduleId: 'vaadin-item-styles' });
56
54
  * @mixes ThemableMixin
57
55
  * @mixes DirMixin
58
56
  */
59
- class Item extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
60
- static get template() {
57
+ class Item extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
58
+ static get is() {
59
+ return 'vaadin-item';
60
+ }
61
+
62
+ static get styles() {
63
+ return itemStyles;
64
+ }
65
+
66
+ /** @protected */
67
+ render() {
61
68
  return html`
62
69
  <span part="checkmark" aria-hidden="true"></span>
63
70
  <div part="content">
@@ -66,10 +73,6 @@ class Item extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
66
73
  `;
67
74
  }
68
75
 
69
- static get is() {
70
- return 'vaadin-item';
71
- }
72
-
73
76
  constructor() {
74
77
  super();
75
78
 
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/item",
4
- "version": "24.8.4",
4
+ "version": "25.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-item",
11
- "description": "`<vaadin-item>` is a Web Component providing layout for items in tabs and menus.\n\n```\n <vaadin-item>\n Item content\n </vaadin-item>\n```\n\n### Selectable\n\n`<vaadin-item>` has the `selected` property and the corresponding state attribute.\nCurrently, the component sets the `selected` to false, when `disabled` property is set to true.\nBut other than that, the `<vaadin-item>` does not switch selection by itself.\nIn general, it is the wrapper component, like `<vaadin-list-box>`, which should update\nthe `selected` property on the items, e. g. on mousedown or when Enter / Spacebar is pressed.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-item>` is a Web Component providing layout for items in tabs and menus.\n\n```html\n<vaadin-item>Item content</vaadin-item>\n```\n\n### Selectable\n\n`<vaadin-item>` has the `selected` property and the corresponding state attribute.\nCurrently, the component sets the `selected` to false, when `disabled` property is set to true.\nBut other than that, the `<vaadin-item>` does not switch selection by itself.\nIn general, it is the wrapper component, like `<vaadin-list-box>`, which should update\nthe `selected` property on the items, e. g. on mousedown or when Enter / Spacebar is pressed.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/item",
4
- "version": "24.8.4",
4
+ "version": "25.0.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-item",
19
- "description": "`<vaadin-item>` is a Web Component providing layout for items in tabs and menus.\n\n```\n <vaadin-item>\n Item content\n </vaadin-item>\n```\n\n### Selectable\n\n`<vaadin-item>` has the `selected` property and the corresponding state attribute.\nCurrently, the component sets the `selected` to false, when `disabled` property is set to true.\nBut other than that, the `<vaadin-item>` does not switch selection by itself.\nIn general, it is the wrapper component, like `<vaadin-list-box>`, which should update\nthe `selected` property on the items, e. g. on mousedown or when Enter / Spacebar is pressed.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-item>` is a Web Component providing layout for items in tabs and menus.\n\n```html\n<vaadin-item>Item content</vaadin-item>\n```\n\n### Selectable\n\n`<vaadin-item>` has the `selected` property and the corresponding state attribute.\nCurrently, the component sets the `selected` to false, when `disabled` property is set to true.\nBut other than that, the `<vaadin-item>` does not switch selection by itself.\nIn general, it is the wrapper component, like `<vaadin-list-box>`, which should update\nthe `selected` property on the items, e. g. on mousedown or when Enter / Spacebar is pressed.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -1,52 +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 { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { itemStyles } from './vaadin-item-core-styles.js';
12
- import { ItemMixin } from './vaadin-item-mixin.js';
13
-
14
- /**
15
- * LitElement based version of `<vaadin-item>` 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 Item extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
24
- static get is() {
25
- return 'vaadin-item';
26
- }
27
-
28
- static get styles() {
29
- return itemStyles;
30
- }
31
-
32
- /** @protected */
33
- render() {
34
- return html`
35
- <span part="checkmark" aria-hidden="true"></span>
36
- <div part="content">
37
- <slot></slot>
38
- </div>
39
- `;
40
- }
41
-
42
- /** @protected */
43
- ready() {
44
- super.ready();
45
-
46
- this.setAttribute('role', 'option');
47
- }
48
- }
49
-
50
- defineCustomElement(Item);
51
-
52
- export { Item };
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-lit-item.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-lit-item.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/font-icons.js';
2
- import '@vaadin/vaadin-material-styles/color.js';
3
- import '@vaadin/vaadin-material-styles/typography.js';
4
- declare const item: import("lit").CSSResult;
5
- export { item };
@@ -1,73 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/font-icons.js';
2
- import '@vaadin/vaadin-material-styles/color.js';
3
- import '@vaadin/vaadin-material-styles/typography.js';
4
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
-
6
- const item = css`
7
- :host {
8
- display: flex;
9
- align-items: center;
10
- box-sizing: border-box;
11
- min-height: 36px;
12
- padding: 8px 32px 8px 10px;
13
- overflow: hidden;
14
- font-family: var(--material-font-family);
15
- font-size: var(--material-small-font-size);
16
- line-height: 24px;
17
- }
18
-
19
- /* It's the list-box's responsibility to add the focus style */
20
- :host([focused]) {
21
- outline: none;
22
- }
23
-
24
- /* Checkmark */
25
- [part='checkmark']::before {
26
- display: var(--_material-item-selected-icon-display, none);
27
- content: '';
28
- font-family: material-icons;
29
- font-size: 24px;
30
- line-height: 1;
31
- font-weight: 400;
32
- width: 24px;
33
- text-align: center;
34
- margin-right: 10px;
35
- color: var(--material-secondary-text-color);
36
- flex: none;
37
- }
38
-
39
- :host([selected]) [part='checkmark']::before {
40
- content: var(--material-icons-check);
41
- }
42
-
43
- @media (any-hover: hover) {
44
- :host(:hover:not([disabled])) {
45
- background-color: var(--material-secondary-background-color);
46
- }
47
- }
48
-
49
- :host([focused]:not([disabled])) {
50
- background-color: var(--material-divider-color);
51
- }
52
-
53
- /* Disabled */
54
- :host([disabled]) {
55
- color: var(--material-disabled-text-color);
56
- cursor: default;
57
- pointer-events: none;
58
- }
59
-
60
- /* RTL specific styles */
61
- :host([dir='rtl']) {
62
- padding: 8px 10px 8px 32px;
63
- }
64
-
65
- :host([dir='rtl']) [part='checkmark']::before {
66
- margin-right: 0;
67
- margin-left: 10px;
68
- }
69
- `;
70
-
71
- registerStyles('vaadin-item', item, { moduleId: 'material-item' });
72
-
73
- export { item };
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-item.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-item.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-lit-item.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-item-styles.js';
2
- import '../../src/vaadin-lit-item.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-item.js';
@@ -1,2 +0,0 @@
1
- import './theme/lumo/vaadin-lit-item.js';
2
- export * from './src/vaadin-lit-item.js';