@vaadin/context-menu 24.0.0-alpha11 → 24.0.0-alpha13

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.
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
7
+
8
+ /**
9
+ * @polymerMixin
10
+ */
11
+ export const MenuOverlayMixin = (superClass) =>
12
+ class MenuOverlayMixin extends PositionMixin(superClass) {
13
+ static get properties() {
14
+ return {
15
+ /**
16
+ * @protected
17
+ */
18
+ parentOverlay: {
19
+ type: Object,
20
+ readOnly: true,
21
+ },
22
+ };
23
+ }
24
+
25
+ static get observers() {
26
+ return ['_themeChanged(_theme)'];
27
+ }
28
+
29
+ /** @protected */
30
+ ready() {
31
+ super.ready();
32
+
33
+ this.addEventListener('keydown', (e) => {
34
+ if (!e.defaultPrevented && e.composedPath()[0] === this.$.overlay && [38, 40].indexOf(e.keyCode) > -1) {
35
+ const child = this.getFirstChild();
36
+ if (child && Array.isArray(child.items) && child.items.length) {
37
+ e.preventDefault();
38
+ if (e.keyCode === 38) {
39
+ child.items[child.items.length - 1].focus();
40
+ } else {
41
+ child.focus();
42
+ }
43
+ }
44
+ }
45
+ });
46
+ }
47
+
48
+ /**
49
+ * Returns the first element in the overlay content.
50
+ *
51
+ * @returns {HTMLElement}
52
+ */
53
+ getFirstChild() {
54
+ return this.querySelector(':not(style):not(slot)');
55
+ }
56
+
57
+ /** @private */
58
+ _themeChanged() {
59
+ this.close();
60
+ }
61
+
62
+ /**
63
+ * Returns the adjusted boundaries of the overlay.
64
+ *
65
+ * @returns {object}
66
+ */
67
+ getBoundaries() {
68
+ // Measure actual overlay and content sizes
69
+ const overlayRect = this.getBoundingClientRect();
70
+ const contentRect = this.$.overlay.getBoundingClientRect();
71
+
72
+ // Maximum x and y values are imposed by content size and overlay limits.
73
+ let yMax = overlayRect.bottom - contentRect.height;
74
+
75
+ // Adjust constraints to ensure bottom-aligned applies to sub-menu.
76
+ const parent = this.parentOverlay;
77
+ if (parent && parent.hasAttribute('bottom-aligned')) {
78
+ const parentStyle = getComputedStyle(parent);
79
+ yMax = yMax - parseFloat(parentStyle.bottom) - parseFloat(parentStyle.height);
80
+ }
81
+
82
+ return {
83
+ xMax: overlayRect.right - contentRect.width,
84
+ xMin: overlayRect.left + contentRect.width,
85
+ yMax,
86
+ };
87
+ }
88
+
89
+ /**
90
+ * @protected
91
+ * @override
92
+ */
93
+ _updatePosition() {
94
+ super._updatePosition();
95
+
96
+ if (this.positionTarget && this.parentOverlay) {
97
+ // This overlay is positioned by a parent menu item,
98
+ // adjust the position by the overlay content paddings
99
+ const content = this.$.content;
100
+ const style = getComputedStyle(content);
101
+
102
+ // Horizontal adjustment
103
+ const isLeftAligned = !!this.style.left;
104
+ if (isLeftAligned) {
105
+ this.style.left = `${parseFloat(this.style.left) + parseFloat(style.paddingLeft)}px`;
106
+ } else {
107
+ this.style.right = `${parseFloat(this.style.right) + parseFloat(style.paddingRight)}px`;
108
+ }
109
+
110
+ // Vertical adjustment
111
+ const isBottomAligned = !!this.style.bottom;
112
+ if (isBottomAligned) {
113
+ this.style.bottom = `${parseFloat(this.style.bottom) - parseFloat(style.paddingBottom)}px`;
114
+ } else {
115
+ this.style.top = `${parseFloat(this.style.top) - parseFloat(style.paddingTop)}px`;
116
+ }
117
+ }
118
+ }
119
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 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 styles: CSSResult;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
+
8
+ export const styles = css`
9
+ :host {
10
+ align-items: flex-start;
11
+ justify-content: flex-start;
12
+ }
13
+
14
+ :host([right-aligned]),
15
+ :host([end-aligned]) {
16
+ align-items: flex-end;
17
+ }
18
+
19
+ :host([bottom-aligned]) {
20
+ justify-content: flex-end;
21
+ }
22
+
23
+ [part='overlay'] {
24
+ background-color: #fff;
25
+ }
26
+ `;
@@ -0,0 +1,46 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
3
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
4
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
5
+ import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
6
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
+
8
+ const contextMenuItem = css`
9
+ /* :hover needed to workaround https://github.com/vaadin/web-components/issues/3133 */
10
+ :host(:hover) {
11
+ user-select: none;
12
+ -ms-user-select: none;
13
+ -webkit-user-select: none;
14
+ }
15
+
16
+ :host([role='menuitem'][menu-item-checked]) [part='checkmark']::before {
17
+ opacity: 1;
18
+ }
19
+
20
+ :host([aria-haspopup='true'])::after {
21
+ font-family: lumo-icons;
22
+ font-size: var(--lumo-icon-size-xs);
23
+ content: var(--lumo-icons-angle-right);
24
+ color: var(--lumo-tertiary-text-color);
25
+ }
26
+
27
+ :host(:not([dir='rtl'])[aria-haspopup='true'])::after {
28
+ margin-right: calc(var(--lumo-space-m) * -1);
29
+ padding-left: var(--lumo-space-m);
30
+ }
31
+
32
+ :host([expanded]) {
33
+ background-color: var(--lumo-primary-color-10pct);
34
+ }
35
+
36
+ /* RTL styles */
37
+ :host([dir='rtl'][aria-haspopup='true'])::after {
38
+ content: var(--lumo-icons-angle-left);
39
+ margin-left: calc(var(--lumo-space-m) * -1);
40
+ padding-right: var(--lumo-space-m);
41
+ }
42
+ `;
43
+
44
+ registerStyles('vaadin-context-menu-item', [item, contextMenuItem], { moduleId: 'lumo-context-menu-item' });
45
+
46
+ export { contextMenuItem };
@@ -0,0 +1,47 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
3
+ import '@vaadin/vaadin-lumo-styles/style.js';
4
+ import { listBox } from '@vaadin/list-box/theme/lumo/vaadin-list-box-styles.js';
5
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6
+
7
+ const contextMenuListBox = css`
8
+ :host {
9
+ --_lumo-list-box-item-selected-icon-display: block;
10
+ }
11
+
12
+ /* Normal item */
13
+ [part='items'] ::slotted([role='menuitem']) {
14
+ -webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
15
+ cursor: default;
16
+ outline: none;
17
+ border-radius: var(--lumo-border-radius-m);
18
+ padding-left: calc(var(--lumo-border-radius-m) / 4);
19
+ padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
20
+ }
21
+
22
+ /* Hovered item */
23
+ /* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
24
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
25
+ [part='items'] ::slotted([role='menuitem'][expanded]:not([disabled])) {
26
+ background-color: var(--lumo-primary-color-10pct);
27
+ }
28
+
29
+ /* RTL styles */
30
+ :host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
31
+ padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
32
+ padding-right: calc(var(--lumo-border-radius-m) / 4);
33
+ }
34
+
35
+ /* Focused item */
36
+ @media (pointer: coarse) {
37
+ [part='items'] ::slotted([role='menuitem']:hover:not([expanded]):not([disabled])) {
38
+ background-color: transparent;
39
+ }
40
+ }
41
+ `;
42
+
43
+ registerStyles('vaadin-context-menu-list-box', [listBox, contextMenuListBox], {
44
+ moduleId: 'lumo-context-menu-list-box',
45
+ });
46
+
47
+ export { contextMenuListBox };
@@ -0,0 +1,33 @@
1
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
2
+ import '@vaadin/vaadin-lumo-styles/style.js';
3
+ import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
4
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
+
6
+ const contextMenuOverlay = css`
7
+ :host([phone]) {
8
+ top: 0 !important;
9
+ right: 0 !important;
10
+ bottom: var(--vaadin-overlay-viewport-bottom) !important;
11
+ left: 0 !important;
12
+ align-items: stretch;
13
+ justify-content: flex-end;
14
+ }
15
+
16
+ /* TODO These style overrides should not be needed.
17
+ We should instead offer a way to have non-selectable items inside the context menu. */
18
+
19
+ :host {
20
+ --_lumo-list-box-item-selected-icon-display: none;
21
+ --_lumo-list-box-item-padding-left: calc(var(--lumo-space-m) + var(--lumo-border-radius-m) / 4);
22
+ }
23
+
24
+ [part='overlay'] {
25
+ outline: none;
26
+ }
27
+ `;
28
+
29
+ registerStyles('vaadin-context-menu-overlay', [menuOverlay, contextMenuOverlay], {
30
+ moduleId: 'lumo-context-menu-overlay',
31
+ });
32
+
33
+ export { contextMenuOverlay };
@@ -1,5 +1,5 @@
1
- import './vaadin-context-menu-styles.js';
2
- import '@vaadin/item/theme/lumo/vaadin-item.js';
3
- import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
1
+ import './vaadin-context-menu-item-styles.js';
2
+ import './vaadin-context-menu-list-box-styles.js';
3
+ import './vaadin-context-menu-overlay-styles.js';
4
4
  import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
5
5
  import '../../src/vaadin-context-menu.js';
@@ -0,0 +1,36 @@
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 { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
5
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6
+
7
+ const contextMenuItem = css`
8
+ :host([aria-haspopup='true'])::after {
9
+ font-family: material-icons;
10
+ font-size: var(--material-icon-font-size);
11
+ }
12
+
13
+ :host(:not([dir='rtl'])[aria-haspopup='true'])::after {
14
+ content: var(--material-icons-chevron-right);
15
+ padding-left: 9px;
16
+ margin-right: -9px;
17
+ }
18
+
19
+ :host([dir='rtl'][aria-haspopup='true'])::after {
20
+ content: var(--material-icons-chevron-left);
21
+ padding-right: 9px;
22
+ margin-left: -9px;
23
+ }
24
+
25
+ :host([menu-item-checked]) [part='checkmark']::before {
26
+ content: var(--material-icons-check);
27
+ }
28
+
29
+ :host([expanded]) {
30
+ background-color: var(--material-secondary-background-color);
31
+ }
32
+ `;
33
+
34
+ registerStyles('vaadin-context-menu-item', [item, contextMenuItem], { moduleId: 'material-context-menu-item' });
35
+
36
+ export { contextMenuItem };
@@ -0,0 +1,38 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/typography.js';
3
+ import { listBox } from '@vaadin/list-box/theme/material/vaadin-list-box-styles.js';
4
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
+
6
+ const contextMenuListBox = css`
7
+ [part='items'] ::slotted([role='menuitem']) {
8
+ min-height: 36px;
9
+ padding: 8px 32px 8px 10px;
10
+ font-size: var(--material-small-font-size);
11
+ line-height: 24px;
12
+ }
13
+
14
+ :host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
15
+ padding: 8px 10px 8px 32px;
16
+ }
17
+
18
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])) {
19
+ background-color: var(--material-secondary-background-color);
20
+ }
21
+
22
+ [part='items'] ::slotted([role='menuitem'][focused]:not([disabled])) {
23
+ background-color: var(--material-divider-color);
24
+ }
25
+
26
+ @media (pointer: coarse) {
27
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
28
+ [part='items'] ::slotted([role='menuitem'][focused]:not([disabled])) {
29
+ background-color: transparent;
30
+ }
31
+ }
32
+ `;
33
+
34
+ registerStyles('vaadin-context-menu-list-box', [listBox, contextMenuListBox], {
35
+ moduleId: 'material-context-menu-list-box',
36
+ });
37
+
38
+ export { contextMenuListBox };
@@ -0,0 +1,15 @@
1
+ import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
+
4
+ const contextMenuOverlay = css`
5
+ [part='overlay'] {
6
+ outline: none;
7
+ will-change: transform, opacity;
8
+ }
9
+ `;
10
+
11
+ registerStyles('vaadin-context-menu-overlay', [menuOverlay, contextMenuOverlay], {
12
+ moduleId: 'material-context-menu-overlay',
13
+ });
14
+
15
+ export { contextMenuOverlay };
@@ -1,5 +1,5 @@
1
- import './vaadin-context-menu-styles.js';
2
- import '@vaadin/item/theme/material/vaadin-item.js';
3
- import '@vaadin/list-box/theme/material/vaadin-list-box.js';
1
+ import './vaadin-context-menu-item-styles.js';
2
+ import './vaadin-context-menu-list-box-styles.js';
3
+ import './vaadin-context-menu-overlay-styles.js';
4
4
  import '@vaadin/overlay/theme/material/vaadin-overlay.js';
5
5
  import '../../src/vaadin-context-menu.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/context-menu",
4
- "version": "24.0.0-alpha11",
4
+ "version": "24.0.0-alpha13",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-context-menu",
11
- "description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\n\n```javascript\ncontextMenu.items = [\n {text: 'Menu Item 1', theme: 'primary', children:\n [\n {text: 'Menu Item 1-1', checked: true},\n {text: 'Menu Item 1-2'}\n ]\n },\n {component: 'hr'},\n {text: 'Menu Item 2', children:\n [\n {text: 'Menu Item 2-1'},\n {text: 'Menu Item 2-2', disabled: true}\n ]\n },\n {text: 'Menu Item 3', disabled: true}\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### “vaadin-contextmenu” Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\n`<vaadin-context-menu>` uses `<vaadin-context-menu-overlay>` internal\nthemable component as the actual visible context menu overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-overlay)\ndocumentation for `<vaadin-context-menu-overlay>` stylable parts.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nWhen using `items` API, in addition `<vaadin-context-menu-overlay>`, the following\ninternal components are themable:\n\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-item).\n- `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-list-box).\n\nNote: the `theme` attribute value set on `<vaadin-context-menu>` is\npropagated to the internal components listed above.",
11
+ "description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', children:\n [\n { text: 'Menu Item 1-1', checked: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true }\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### “vaadin-contextmenu” Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\n`<vaadin-context-menu>` uses `<vaadin-context-menu-overlay>` internal\nthemable component as the actual visible context menu overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-overlay)\ndocumentation for `<vaadin-context-menu-overlay>` stylable parts.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nWhen using `items` API, in addition `<vaadin-context-menu-overlay>`, the following\ninternal components are themable:\n\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-item).\n- `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-list-box).\n\nNote: the `theme` attribute value set on `<vaadin-context-menu>` is\npropagated to the internal components listed above.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "overlay-class",
@@ -77,7 +77,7 @@
77
77
  },
78
78
  {
79
79
  "name": "items",
80
- "description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n {text: 'Menu Item 1', theme: 'primary', children:\n [\n {text: 'Menu Item 1-1', checked: true},\n {text: 'Menu Item 1-2'}\n ]\n },\n {component: 'hr'},\n {text: 'Menu Item 2', children:\n [\n {text: 'Menu Item 2-1'},\n {text: 'Menu Item 2-2', disabled: true}\n ]\n },\n {text: 'Menu Item 3', disabled: true}\n];\n```",
80
+ "description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', children:\n [\n { text: 'Menu Item 1-1', checked: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true }\n];\n```",
81
81
  "value": {
82
82
  "type": [
83
83
  "Array.<ContextMenuItem>",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/context-menu",
4
- "version": "24.0.0-alpha11",
4
+ "version": "24.0.0-alpha13",
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-context-menu",
19
- "description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\n\n```javascript\ncontextMenu.items = [\n {text: 'Menu Item 1', theme: 'primary', children:\n [\n {text: 'Menu Item 1-1', checked: true},\n {text: 'Menu Item 1-2'}\n ]\n },\n {component: 'hr'},\n {text: 'Menu Item 2', children:\n [\n {text: 'Menu Item 2-1'},\n {text: 'Menu Item 2-2', disabled: true}\n ]\n },\n {text: 'Menu Item 3', disabled: true}\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### “vaadin-contextmenu” Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\n`<vaadin-context-menu>` uses `<vaadin-context-menu-overlay>` internal\nthemable component as the actual visible context menu overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-overlay)\ndocumentation for `<vaadin-context-menu-overlay>` stylable parts.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nWhen using `items` API, in addition `<vaadin-context-menu-overlay>`, the following\ninternal components are themable:\n\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-item).\n- `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-list-box).\n\nNote: the `theme` attribute value set on `<vaadin-context-menu>` is\npropagated to the internal components listed above.",
19
+ "description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', children:\n [\n { text: 'Menu Item 1-1', checked: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true }\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### “vaadin-contextmenu” Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\n`<vaadin-context-menu>` uses `<vaadin-context-menu-overlay>` internal\nthemable component as the actual visible context menu overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-overlay)\ndocumentation for `<vaadin-context-menu-overlay>` stylable parts.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nWhen using `items` API, in addition `<vaadin-context-menu-overlay>`, the following\ninternal components are themable:\n\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-item).\n- `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-list-box).\n\nNote: the `theme` attribute value set on `<vaadin-context-menu>` is\npropagated to the internal components listed above.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  {
30
30
  "name": ".items",
31
- "description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n {text: 'Menu Item 1', theme: 'primary', children:\n [\n {text: 'Menu Item 1-1', checked: true},\n {text: 'Menu Item 1-2'}\n ]\n },\n {component: 'hr'},\n {text: 'Menu Item 2', children:\n [\n {text: 'Menu Item 2-1'},\n {text: 'Menu Item 2-2', disabled: true}\n ]\n },\n {text: 'Menu Item 3', disabled: true}\n];\n```",
31
+ "description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', children:\n [\n { text: 'Menu Item 1-1', checked: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true }\n];\n```",
32
32
  "value": {
33
33
  "kind": "expression"
34
34
  }
@@ -1,115 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/spacing.js';
2
- import '@vaadin/vaadin-lumo-styles/style.js';
3
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
4
- import '@vaadin/vaadin-lumo-styles/color.js';
5
- import '@vaadin/vaadin-lumo-styles/sizing.js';
6
- import '@vaadin/vaadin-lumo-styles/typography.js';
7
- import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
8
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
-
10
- const contextMenuOverlay = css`
11
- :host([phone]) {
12
- top: 0 !important;
13
- right: 0 !important;
14
- bottom: var(--vaadin-overlay-viewport-bottom) !important;
15
- left: 0 !important;
16
- align-items: stretch;
17
- justify-content: flex-end;
18
- }
19
-
20
- /* TODO These style overrides should not be needed.
21
- We should instead offer a way to have non-selectable items inside the context menu. */
22
-
23
- :host {
24
- --_lumo-list-box-item-selected-icon-display: none;
25
- --_lumo-list-box-item-padding-left: calc(var(--lumo-space-m) + var(--lumo-border-radius-m) / 4);
26
- }
27
-
28
- [part='overlay'] {
29
- outline: none;
30
- }
31
- `;
32
-
33
- registerStyles('vaadin-context-menu-overlay', [menuOverlay, contextMenuOverlay], {
34
- moduleId: 'lumo-context-menu-overlay',
35
- });
36
-
37
- registerStyles(
38
- 'vaadin-context-menu-list-box',
39
- css`
40
- :host {
41
- --_lumo-list-box-item-selected-icon-display: block;
42
- }
43
-
44
- /* Normal item */
45
- [part='items'] ::slotted([role='menuitem']) {
46
- -webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
47
- cursor: default;
48
- outline: none;
49
- border-radius: var(--lumo-border-radius-m);
50
- padding-left: calc(var(--lumo-border-radius-m) / 4);
51
- padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
52
- }
53
-
54
- /* Hovered item */
55
- /* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
56
- [part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
57
- [part='items'] ::slotted([role='menuitem'][expanded]:not([disabled])) {
58
- background-color: var(--lumo-primary-color-10pct);
59
- }
60
-
61
- /* RTL styles */
62
- :host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
63
- padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
64
- padding-right: calc(var(--lumo-border-radius-m) / 4);
65
- }
66
-
67
- /* Focused item */
68
- @media (pointer: coarse) {
69
- [part='items'] ::slotted([role='menuitem']:hover:not([expanded]):not([disabled])) {
70
- background-color: transparent;
71
- }
72
- }
73
- `,
74
- { moduleId: 'lumo-context-menu-list-box' },
75
- );
76
-
77
- registerStyles(
78
- 'vaadin-context-menu-item',
79
- css`
80
- /* :hover needed to workaround https://github.com/vaadin/web-components/issues/3133 */
81
- :host(:hover) {
82
- user-select: none;
83
- -ms-user-select: none;
84
- -webkit-user-select: none;
85
- }
86
-
87
- :host([role='menuitem'][menu-item-checked]) [part='checkmark']::before {
88
- opacity: 1;
89
- }
90
-
91
- :host([aria-haspopup='true'])::after {
92
- font-family: lumo-icons;
93
- font-size: var(--lumo-icon-size-xs);
94
- content: var(--lumo-icons-angle-right);
95
- color: var(--lumo-tertiary-text-color);
96
- }
97
-
98
- :host(:not([dir='rtl'])[aria-haspopup='true'])::after {
99
- margin-right: calc(var(--lumo-space-m) * -1);
100
- padding-left: var(--lumo-space-m);
101
- }
102
-
103
- :host([expanded]) {
104
- background-color: var(--lumo-primary-color-10pct);
105
- }
106
-
107
- /* RTL styles */
108
- :host([dir='rtl'][aria-haspopup='true'])::after {
109
- content: var(--lumo-icons-angle-left);
110
- margin-left: calc(var(--lumo-space-m) * -1);
111
- padding-right: var(--lumo-space-m);
112
- }
113
- `,
114
- { moduleId: 'lumo-context-menu-item' },
115
- );