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

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/context-menu",
3
- "version": "24.0.0-alpha1",
3
+ "version": "24.0.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,14 +39,14 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/component-base": "24.0.0-alpha1",
43
- "@vaadin/item": "24.0.0-alpha1",
44
- "@vaadin/list-box": "24.0.0-alpha1",
45
- "@vaadin/lit-renderer": "24.0.0-alpha1",
46
- "@vaadin/overlay": "24.0.0-alpha1",
47
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha1",
48
- "@vaadin/vaadin-material-styles": "24.0.0-alpha1",
49
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha1"
42
+ "@vaadin/component-base": "24.0.0-alpha11",
43
+ "@vaadin/item": "24.0.0-alpha11",
44
+ "@vaadin/list-box": "24.0.0-alpha11",
45
+ "@vaadin/lit-renderer": "24.0.0-alpha11",
46
+ "@vaadin/overlay": "24.0.0-alpha11",
47
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha11",
48
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha11",
49
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha11"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
@@ -58,5 +58,5 @@
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "427527c27c4b27822d61fd41d38d7b170134770b"
61
+ "gitHead": "641b3d96ceeb3e503a093682ebe686afdd8c3a68"
62
62
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { TemplateResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { directive } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
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 { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
7
8
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
8
9
  import { ContextMenuItem, ItemsMixin } from './vaadin-contextmenu-items-mixin.js';
9
10
 
@@ -16,8 +17,8 @@ export interface ContextMenuRendererContext {
16
17
 
17
18
  export type ContextMenuRenderer = (
18
19
  root: HTMLElement,
19
- contextMenu?: ContextMenu,
20
- context?: ContextMenuRendererContext,
20
+ contextMenu: ContextMenu,
21
+ context: ContextMenuRendererContext,
21
22
  ) => void;
22
23
 
23
24
  /**
@@ -223,7 +224,7 @@ export interface ContextMenuEventMap extends HTMLElementEventMap, ContextMenuCus
223
224
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
224
225
  * @fires {CustomEvent} item-selected - Fired when an item is selected when the context menu is populated using the `items` API.
225
226
  */
226
- declare class ContextMenu extends ElementMixin(ThemePropertyMixin(ItemsMixin(HTMLElement))) {
227
+ declare class ContextMenu extends OverlayClassMixin(ElementMixin(ThemePropertyMixin(ItemsMixin(HTMLElement)))) {
227
228
  /**
228
229
  * CSS selector that can be used to target any child element
229
230
  * of the context menu to listen for `openOn` events.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-contextmenu-event.js';
@@ -11,6 +11,7 @@ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'
11
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
12
  import { addListener, gestures, removeListener } from '@vaadin/component-base/src/gestures.js';
13
13
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
14
+ import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
14
15
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
15
16
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
16
17
  import { ItemsMixin } from './vaadin-contextmenu-items-mixin.js';
@@ -199,10 +200,13 @@ import { ItemsMixin } from './vaadin-contextmenu-items-mixin.js';
199
200
  * @extends HTMLElement
200
201
  * @mixes ElementMixin
201
202
  * @mixes ControllerMixin
203
+ * @mixes OverlayClassMixin
202
204
  * @mixes ThemePropertyMixin
203
205
  * @mixes ItemsMixin
204
206
  */
205
- class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsMixin(PolymerElement)))) {
207
+ class ContextMenu extends OverlayClassMixin(
208
+ ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsMixin(PolymerElement)))),
209
+ ) {
206
210
  static get template() {
207
211
  return html`
208
212
  <style>
@@ -308,12 +312,6 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
308
312
  /** @private */
309
313
  _context: Object,
310
314
 
311
- /** @private */
312
- _boundClose: Object,
313
-
314
- /** @private */
315
- _boundOpen: Object,
316
-
317
315
  /** @private */
318
316
  _phone: {
319
317
  type: Boolean,
@@ -351,6 +349,7 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
351
349
  super();
352
350
  this._boundOpen = this.open.bind(this);
353
351
  this._boundClose = this.close.bind(this);
352
+ this._boundPreventDefault = this._preventDefault.bind(this);
354
353
  this._boundOnGlobalContextMenu = this._onGlobalContextMenu.bind(this);
355
354
  }
356
355
 
@@ -374,6 +373,8 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
374
373
  ready() {
375
374
  super.ready();
376
375
 
376
+ this._overlayElement = this.$.overlay;
377
+
377
378
  this.addController(
378
379
  new MediaQueryController(this._wideMediaQuery, (matches) => {
379
380
  this._wide = matches;
@@ -443,22 +444,19 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
443
444
 
444
445
  /** @private */
445
446
  _closeOnChanged(closeOn, oldCloseOn) {
446
- // Listen on this.$.overlay.root to workaround issue on
447
- // ShadyDOM polyfill: https://github.com/webcomponents/shadydom/issues/159
448
-
449
447
  // Outside click event from overlay
450
448
  const evtOverlay = 'vaadin-overlay-outside-click';
451
449
 
450
+ const overlay = this.$.overlay;
451
+
452
452
  if (oldCloseOn) {
453
- this._unlisten(this.$.overlay, oldCloseOn, this._boundClose);
454
- this._unlisten(this.$.overlay.root, oldCloseOn, this._boundClose);
453
+ this._unlisten(overlay, oldCloseOn, this._boundClose);
455
454
  }
456
455
  if (closeOn) {
457
- this._listen(this.$.overlay, closeOn, this._boundClose);
458
- this._listen(this.$.overlay.root, closeOn, this._boundClose);
459
- this._unlisten(this.$.overlay, evtOverlay, this._preventDefault);
456
+ this._listen(overlay, closeOn, this._boundClose);
457
+ overlay.removeEventListener(evtOverlay, this._boundPreventDefault);
460
458
  } else {
461
- this._listen(this.$.overlay, evtOverlay, this._preventDefault);
459
+ overlay.addEventListener(evtOverlay, this._boundPreventDefault);
462
460
  }
463
461
  }
464
462
 
@@ -488,7 +486,11 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
488
486
  * It is not guaranteed that the update happens immediately (synchronously) after it is requested.
489
487
  */
490
488
  requestContentUpdate() {
491
- this.$.overlay.requestContentUpdate();
489
+ if (!this._overlayElement || !this.renderer) {
490
+ return;
491
+ }
492
+
493
+ this._overlayElement.requestContentUpdate();
492
494
  }
493
495
 
494
496
  /** @private */
@@ -539,7 +541,7 @@ class ContextMenu extends ControllerMixin(ElementMixin(ThemePropertyMixin(ItemsM
539
541
  };
540
542
 
541
543
  if (this._context.target) {
542
- this._preventDefault(e);
544
+ e.preventDefault();
543
545
  e.stopPropagation();
544
546
 
545
547
  // Used in alignment which is delayed until overlay is rendered
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -69,6 +69,4 @@ export declare class ItemsMixinClass {
69
69
  * ```
70
70
  */
71
71
  items: ContextMenuItem[] | undefined;
72
-
73
- protected readonly __isRTL: boolean;
74
72
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
@@ -126,14 +126,6 @@ export const ItemsMixin = (superClass) =>
126
126
  document.documentElement.removeEventListener('click', this.__itemsOutsideClickListener);
127
127
  }
128
128
 
129
- /**
130
- * @return {boolean}
131
- * @protected
132
- */
133
- get __isRTL() {
134
- return this.getAttribute('dir') === 'rtl';
135
- }
136
-
137
129
  /** @protected */
138
130
  __forwardFocus() {
139
131
  const overlay = this.$.overlay;
@@ -152,9 +144,10 @@ export const ItemsMixin = (superClass) =>
152
144
  }
153
145
 
154
146
  /** @private */
155
- __openSubMenu(subMenu, itemElement) {
147
+ __openSubMenu(subMenu, itemElement, overlayClass) {
156
148
  subMenu.items = itemElement._item.children;
157
149
  subMenu.listenOn = itemElement;
150
+ subMenu.overlayClass = overlayClass;
158
151
 
159
152
  const parent = this.$.overlay;
160
153
 
@@ -211,7 +204,6 @@ export const ItemsMixin = (superClass) =>
211
204
 
212
205
  if (component instanceof Item) {
213
206
  component.setAttribute('role', 'menuitem');
214
- component.classList.add('vaadin-menu-item');
215
207
  } else if (component.localName === 'hr') {
216
208
  component.setAttribute('role', 'separator');
217
209
  }
@@ -228,9 +220,7 @@ export const ItemsMixin = (superClass) =>
228
220
  this.__toggleMenuComponentAttribute(component, 'disabled', item.disabled);
229
221
 
230
222
  component.setAttribute('aria-haspopup', 'false');
231
- component.classList.remove('vaadin-context-menu-parent-item');
232
223
  if (item.children && item.children.length) {
233
- component.classList.add('vaadin-context-menu-parent-item');
234
224
  component.setAttribute('aria-haspopup', 'true');
235
225
  component.setAttribute('aria-expanded', 'false');
236
226
  component.removeAttribute('expanded');
@@ -278,7 +268,6 @@ export const ItemsMixin = (superClass) =>
278
268
  if (this._theme) {
279
269
  listBox.setAttribute('theme', this._theme);
280
270
  }
281
- listBox.classList.add('vaadin-menu-list-box');
282
271
  requestAnimationFrame(() => listBox.setAttribute('role', 'menu'));
283
272
 
284
273
  const subMenu = document.createElement(this.constructor.is);
@@ -358,7 +347,10 @@ export const ItemsMixin = (superClass) =>
358
347
  if (itemElement._item.children && itemElement._item.children.length) {
359
348
  itemElement.setAttribute('aria-expanded', 'true');
360
349
  itemElement.setAttribute('expanded', '');
361
- this.__openSubMenu(subMenu, itemElement);
350
+
351
+ // Forward parent overlay class
352
+ const { overlayClass } = menu;
353
+ this.__openSubMenu(subMenu, itemElement, overlayClass);
362
354
  } else {
363
355
  subMenu.listenOn.focus();
364
356
  }
@@ -37,49 +37,36 @@ registerStyles('vaadin-context-menu-overlay', [menuOverlay, contextMenuOverlay],
37
37
  registerStyles(
38
38
  'vaadin-context-menu-list-box',
39
39
  css`
40
- :host(.vaadin-menu-list-box) {
40
+ :host {
41
41
  --_lumo-list-box-item-selected-icon-display: block;
42
42
  }
43
43
 
44
44
  /* Normal item */
45
- [part='items'] ::slotted(.vaadin-menu-item) {
45
+ [part='items'] ::slotted([role='menuitem']) {
46
46
  -webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
47
47
  cursor: default;
48
- }
49
-
50
- [part='items'] ::slotted(.vaadin-menu-item) {
51
48
  outline: none;
52
49
  border-radius: var(--lumo-border-radius-m);
53
- padding-left: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
54
- padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
55
- }
56
-
57
- :host(.vaadin-menu-list-box) [part='items'] ::slotted(.vaadin-menu-item) {
58
50
  padding-left: calc(var(--lumo-border-radius-m) / 4);
59
51
  padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
60
52
  }
61
53
 
62
54
  /* Hovered item */
63
55
  /* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
64
- [part='items'] ::slotted(.vaadin-menu-item:hover:not([disabled])),
65
- [part='items'] ::slotted(.vaadin-menu-item[expanded]:not([disabled])) {
56
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
57
+ [part='items'] ::slotted([role='menuitem'][expanded]:not([disabled])) {
66
58
  background-color: var(--lumo-primary-color-10pct);
67
59
  }
68
60
 
69
61
  /* RTL styles */
70
- :host([dir='rtl'])[part='items'] ::slotted(.vaadin-menu-item) {
71
- padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
72
- padding-right: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
73
- }
74
-
75
- :host([dir='rtl'].vaadin-menu-list-box) [part='items'] ::slotted(.vaadin-menu-item) {
62
+ :host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
76
63
  padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
77
64
  padding-right: calc(var(--lumo-border-radius-m) / 4);
78
65
  }
79
66
 
80
67
  /* Focused item */
81
68
  @media (pointer: coarse) {
82
- [part='items'] ::slotted(.vaadin-menu-item:hover:not([expanded]):not([disabled])) {
69
+ [part='items'] ::slotted([role='menuitem']:hover:not([expanded]):not([disabled])) {
83
70
  background-color: transparent;
84
71
  }
85
72
  }
@@ -97,18 +84,18 @@ registerStyles(
97
84
  -webkit-user-select: none;
98
85
  }
99
86
 
100
- :host(.vaadin-menu-item[menu-item-checked]) [part='checkmark']::before {
87
+ :host([role='menuitem'][menu-item-checked]) [part='checkmark']::before {
101
88
  opacity: 1;
102
89
  }
103
90
 
104
- :host(.vaadin-menu-item.vaadin-context-menu-parent-item)::after {
91
+ :host([aria-haspopup='true'])::after {
105
92
  font-family: lumo-icons;
106
93
  font-size: var(--lumo-icon-size-xs);
107
94
  content: var(--lumo-icons-angle-right);
108
95
  color: var(--lumo-tertiary-text-color);
109
96
  }
110
97
 
111
- :host(:not([dir='rtl']).vaadin-menu-item.vaadin-context-menu-parent-item)::after {
98
+ :host(:not([dir='rtl'])[aria-haspopup='true'])::after {
112
99
  margin-right: calc(var(--lumo-space-m) * -1);
113
100
  padding-left: var(--lumo-space-m);
114
101
  }
@@ -118,7 +105,7 @@ registerStyles(
118
105
  }
119
106
 
120
107
  /* RTL styles */
121
- :host([dir='rtl'].vaadin-menu-item.vaadin-context-menu-parent-item)::after {
108
+ :host([dir='rtl'][aria-haspopup='true'])::after {
122
109
  content: var(--lumo-icons-angle-left);
123
110
  margin-left: calc(var(--lumo-space-m) * -1);
124
111
  padding-right: var(--lumo-space-m);
@@ -18,28 +18,28 @@ registerStyles('vaadin-context-menu-overlay', [menuOverlay, contextMenuOverlay],
18
18
  registerStyles(
19
19
  'vaadin-context-menu-list-box',
20
20
  css`
21
- [part='items'] ::slotted(.vaadin-menu-item:not(hr)) {
21
+ [part='items'] ::slotted([role='menuitem']) {
22
22
  min-height: 36px;
23
23
  padding: 8px 32px 8px 10px;
24
24
  font-size: var(--material-small-font-size);
25
25
  line-height: 24px;
26
26
  }
27
27
 
28
- :host([dir='rtl']) [part='items'] ::slotted(.vaadin-menu-item:not(hr)) {
28
+ :host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
29
29
  padding: 8px 10px 8px 32px;
30
30
  }
31
31
 
32
- [part='items'] ::slotted(.vaadin-menu-item:hover:not([disabled])) {
32
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])) {
33
33
  background-color: var(--material-secondary-background-color);
34
34
  }
35
35
 
36
- [part='items'] ::slotted(.vaadin-menu-item[focused]:not([disabled])) {
36
+ [part='items'] ::slotted([role='menuitem'][focused]:not([disabled])) {
37
37
  background-color: var(--material-divider-color);
38
38
  }
39
39
 
40
40
  @media (pointer: coarse) {
41
- [part='items'] ::slotted(.vaadin-menu-item:hover:not([disabled])),
42
- [part='items'] ::slotted(.vaadin-menu-item[focused]:not([disabled])) {
41
+ [part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
42
+ [part='items'] ::slotted([role='menuitem'][focused]:not([disabled])) {
43
43
  background-color: transparent;
44
44
  }
45
45
  }
@@ -50,28 +50,24 @@ registerStyles(
50
50
  registerStyles(
51
51
  'vaadin-context-menu-item',
52
52
  css`
53
- :host(.vaadin-menu-item.vaadin-context-menu-parent-item)::after {
53
+ :host([aria-haspopup='true'])::after {
54
54
  font-family: material-icons;
55
55
  font-size: var(--material-icon-font-size);
56
56
  }
57
57
 
58
- :host(:not([dir='rtl']).vaadin-menu-item.vaadin-context-menu-parent-item)::after {
58
+ :host(:not([dir='rtl'])[aria-haspopup='true'])::after {
59
59
  content: var(--material-icons-chevron-right);
60
60
  padding-left: 9px;
61
61
  margin-right: -9px;
62
62
  }
63
63
 
64
- :host([dir='rtl'].vaadin-menu-item.vaadin-context-menu-parent-item)::after {
64
+ :host([dir='rtl'][aria-haspopup='true'])::after {
65
65
  content: var(--material-icons-chevron-left);
66
66
  padding-right: 9px;
67
67
  margin-left: -9px;
68
68
  }
69
69
 
70
- :host(.vaadin-menu-item)::before {
71
- display: block;
72
- }
73
-
74
- :host(.vaadin-menu-item[menu-item-checked]) [part='checkmark']::before {
70
+ :host([menu-item-checked]) [part='checkmark']::before {
75
71
  content: var(--material-icons-check);
76
72
  }
77
73
 
package/web-types.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/context-menu",
4
- "version": "24.0.0-alpha1",
4
+ "version": "24.0.0-alpha11",
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-alpha1/#/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-alpha1/#/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-alpha1/#/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-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.",
12
12
  "attributes": [
13
+ {
14
+ "name": "overlay-class",
15
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
16
+ "value": {
17
+ "type": [
18
+ "string",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
13
24
  {
14
25
  "name": "selector",
15
26
  "description": "CSS selector that can be used to target any child element\nof the context menu to listen for `openOn` events.",
@@ -53,6 +64,17 @@
53
64
  ],
54
65
  "js": {
55
66
  "properties": [
67
+ {
68
+ "name": "overlayClass",
69
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
70
+ "value": {
71
+ "type": [
72
+ "string",
73
+ "null",
74
+ "undefined"
75
+ ]
76
+ }
77
+ },
56
78
  {
57
79
  "name": "items",
58
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```",
@@ -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-alpha1",
4
+ "version": "24.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,9 +16,16 @@
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-alpha1/#/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-alpha1/#/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-alpha1/#/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-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.",
20
20
  "extension": true,
21
21
  "attributes": [
22
+ {
23
+ "name": ".overlayClass",
24
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
22
29
  {
23
30
  "name": ".items",
24
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```",