@vaadin/item 25.0.0-alpha2 → 25.0.0-alpha21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/item",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/*-base-styles.d.ts",
25
- "!src/*-base-styles.js",
26
- "theme",
27
24
  "vaadin-*.d.ts",
28
25
  "vaadin-*.js",
29
26
  "web-types.json",
@@ -37,21 +34,21 @@
37
34
  ],
38
35
  "dependencies": {
39
36
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha2",
41
- "@vaadin/component-base": "25.0.0-alpha2",
42
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
43
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
37
+ "@vaadin/a11y-base": "25.0.0-alpha21",
38
+ "@vaadin/component-base": "25.0.0-alpha21",
39
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha21",
44
40
  "lit": "^3.0.0"
45
41
  },
46
42
  "devDependencies": {
47
- "@vaadin/chai-plugins": "25.0.0-alpha2",
48
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
43
+ "@vaadin/chai-plugins": "25.0.0-alpha21",
44
+ "@vaadin/test-runner-commands": "25.0.0-alpha21",
49
45
  "@vaadin/testing-helpers": "^2.0.0",
50
- "sinon": "^18.0.0"
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha21",
47
+ "sinon": "^21.0.0"
51
48
  },
52
49
  "web-types": [
53
50
  "web-types.json",
54
51
  "web-types.lit.json"
55
52
  ],
56
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
53
+ "gitHead": "8fb9e9710c01449edf623a1aaac4655cdc11a933"
57
54
  }
@@ -0,0 +1,63 @@
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/styles/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-s));
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: var(--_vaadin-icon-checkmark) 50% / var(--vaadin-icon-visual-size, 100%) no-repeat;
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
+
58
+ @media (forced-colors: active) {
59
+ [part='checkmark']::before {
60
+ background: CanvasText;
61
+ }
62
+ }
63
+ `;
@@ -83,22 +83,20 @@ export const ItemMixin = (superClass) =>
83
83
  }
84
84
 
85
85
  /**
86
- * Override native `focus` to set focused attribute
87
- * when focusing the item programmatically.
86
+ * @param {FocusOptions=} options
88
87
  * @protected
89
88
  * @override
90
89
  */
91
- focus() {
90
+ focus(options) {
92
91
  if (this.disabled) {
93
92
  return;
94
93
  }
95
94
 
96
- super.focus();
97
- this._setFocused(true);
95
+ super.focus(options);
98
96
  }
99
97
 
100
98
  /**
101
- * @param {KeyboardEvent | MouseEvent} _event
99
+ * @param {KeyboardEvent | MouseEvent} event
102
100
  * @protected
103
101
  * @override
104
102
  */
@@ -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
@@ -7,17 +7,16 @@ 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
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
10
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { itemStyles } from './vaadin-item-core-styles.js';
12
+ import { itemStyles } from './styles/vaadin-item-base-styles.js';
12
13
  import { ItemMixin } from './vaadin-item-mixin.js';
13
14
 
14
15
  /**
15
16
  * `<vaadin-item>` is a Web Component providing layout for items in tabs and menus.
16
17
  *
17
- * ```
18
- * <vaadin-item>
19
- * Item content
20
- * </vaadin-item>
18
+ * ```html
19
+ * <vaadin-item>Item content</vaadin-item>
21
20
  * ```
22
21
  *
23
22
  * ### Selectable
@@ -55,7 +54,7 @@ import { ItemMixin } from './vaadin-item-mixin.js';
55
54
  * @mixes ThemableMixin
56
55
  * @mixes DirMixin
57
56
  */
58
- class Item extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
57
+ class Item extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
59
58
  static get is() {
60
59
  return 'vaadin-item';
61
60
  }
package/vaadin-item.js CHANGED
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-item.js';
1
+ import './src/vaadin-item.js';
2
2
  export * from './src/vaadin-item.js';
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": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha21",
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": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha21",
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,59 +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/component-base/src/style-props.js';
7
- import { css } from 'lit';
8
-
9
- export const itemStyles = css`
10
- @layer base {
11
- :host {
12
- align-items: center;
13
- border-radius: var(--vaadin-item-border-radius, var(--_vaadin-radius-m));
14
- box-sizing: border-box;
15
- cursor: var(--vaadin-clickable-cursor);
16
- display: flex;
17
- gap: var(--vaadin-item-gap, 0 var(--_vaadin-gap-container-inline));
18
- height: var(--vaadin-item-height, auto);
19
- padding: var(--vaadin-item-padding, var(--_vaadin-padding-container));
20
- }
21
-
22
- :host([focused]) {
23
- outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
24
- outline-offset: calc(var(--vaadin-focus-ring-width) / -1);
25
- }
26
-
27
- :host([disabled]) {
28
- cursor: var(--vaadin-disabled-cursor);
29
- opacity: 0.5;
30
- }
31
-
32
- :host([hidden]) {
33
- display: none !important;
34
- }
35
-
36
- [part='checkmark'] {
37
- color: var(--vaadin-item-checkmark-color, inherit);
38
- display: var(--vaadin-item-checkmark-display, none);
39
- visibility: hidden;
40
- }
41
-
42
- [part='checkmark']::before {
43
- content: '';
44
- display: block;
45
- background: currentColor;
46
- height: var(--vaadin-icon-size, 1lh);
47
- mask-image: var(--_vaadin-icon-checkmark);
48
- width: var(--vaadin-icon-size, 1lh);
49
- }
50
-
51
- :host([selected]) [part='checkmark'] {
52
- visibility: visible;
53
- }
54
-
55
- [part='content'] {
56
- flex: 1;
57
- }
58
- }
59
- `;
@@ -1,8 +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 type { CSSResult } from 'lit';
7
-
8
- export const itemStyles: CSSResult;
@@ -1,16 +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 } from 'lit';
7
-
8
- export const itemStyles = css`
9
- :host {
10
- display: inline-block;
11
- }
12
-
13
- :host([hidden]) {
14
- display: none !important;
15
- }
16
- `;
@@ -1,8 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import '@vaadin/vaadin-lumo-styles/color.js';
6
- import '@vaadin/vaadin-lumo-styles/typography.js';
7
- declare const item: import("lit").CSSResult;
8
- export { item };
@@ -1,97 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import '@vaadin/vaadin-lumo-styles/color.js';
6
- import '@vaadin/vaadin-lumo-styles/typography.js';
7
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
-
9
- const item = css`
10
- :host {
11
- display: flex;
12
- align-items: center;
13
- box-sizing: border-box;
14
- font-family: var(--lumo-font-family);
15
- font-size: var(--lumo-font-size-m);
16
- line-height: var(--lumo-line-height-xs);
17
- padding: 0.5em calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4) 0.5em
18
- var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
19
- min-height: var(--lumo-size-m);
20
- outline: none;
21
- border-radius: var(--lumo-border-radius-m);
22
- cursor: var(--lumo-clickable-cursor);
23
- -webkit-font-smoothing: antialiased;
24
- -moz-osx-font-smoothing: grayscale;
25
- -webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
26
- --_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
27
- --_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
28
- --_selection-color-text: var(--vaadin-selection-color-text, var(--lumo-primary-text-color));
29
- }
30
-
31
- /* Checkmark */
32
- [part='checkmark']::before {
33
- display: var(--_lumo-item-selected-icon-display, none);
34
- content: var(--lumo-icons-checkmark);
35
- font-family: lumo-icons;
36
- font-size: var(--lumo-icon-size-m);
37
- line-height: 1;
38
- font-weight: normal;
39
- width: 1em;
40
- height: 1em;
41
- margin: calc((1 - var(--lumo-line-height-xs)) * var(--lumo-font-size-m) / 2) 0;
42
- color: var(--_selection-color-text);
43
- flex: none;
44
- opacity: 0;
45
- transition:
46
- transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2),
47
- opacity 0.1s;
48
- }
49
-
50
- :host([selected]) [part='checkmark']::before {
51
- opacity: 1;
52
- }
53
-
54
- :host([active]:not([selected])) [part='checkmark']::before {
55
- transform: scale(0.8);
56
- opacity: 0;
57
- transition-duration: 0s;
58
- }
59
-
60
- [part='content'] {
61
- flex: auto;
62
- }
63
-
64
- /* Disabled */
65
- :host([disabled]) {
66
- color: var(--lumo-disabled-text-color);
67
- cursor: default;
68
- pointer-events: none;
69
- }
70
-
71
- /* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
72
- @media (any-hover: hover) {
73
- :host(:hover:not([disabled])) {
74
- background-color: var(--lumo-primary-color-10pct);
75
- }
76
- }
77
-
78
- :host([focus-ring]:not([disabled])) {
79
- box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
80
- }
81
-
82
- /* RTL specific styles */
83
- :host([dir='rtl']) {
84
- padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
85
- padding-right: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
86
- }
87
-
88
- /* Slotted icons */
89
- :host ::slotted(vaadin-icon) {
90
- width: var(--lumo-icon-size-m);
91
- height: var(--lumo-icon-size-m);
92
- }
93
- `;
94
-
95
- registerStyles('vaadin-item', item, { moduleId: 'lumo-item' });
96
-
97
- 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';