@vaadin/menu-bar 24.0.0-alpha12 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/menu-bar",
3
- "version": "24.0.0-alpha12",
3
+ "version": "24.0.0-alpha13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,22 +37,22 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "24.0.0-alpha12",
41
- "@vaadin/component-base": "24.0.0-alpha12",
42
- "@vaadin/context-menu": "24.0.0-alpha12",
43
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha12",
44
- "@vaadin/vaadin-material-styles": "24.0.0-alpha12",
45
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha12"
40
+ "@vaadin/button": "24.0.0-alpha13",
41
+ "@vaadin/component-base": "24.0.0-alpha13",
42
+ "@vaadin/context-menu": "24.0.0-alpha13",
43
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha13",
44
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha13",
45
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha13"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
49
- "@vaadin/icon": "24.0.0-alpha12",
50
- "@vaadin/testing-helpers": "^0.3.2",
49
+ "@vaadin/icon": "24.0.0-alpha13",
50
+ "@vaadin/testing-helpers": "^0.4.0",
51
51
  "sinon": "^13.0.2"
52
52
  },
53
53
  "web-types": [
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "7e29eee4d522fb7b03ac8e7e385e9057d71c79ce"
57
+ "gitHead": "a423ad309c12b4e4f847737ee9f491f83ea60ff0"
58
58
  }
@@ -17,7 +17,7 @@ registerStyles(
17
17
  margin-inline-end: 0;
18
18
  }
19
19
 
20
- [part='label'] ::slotted(vaadin-context-menu-item) {
20
+ [part='label'] ::slotted(vaadin-menu-bar-item) {
21
21
  position: relative;
22
22
  z-index: 1;
23
23
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
7
+ import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
8
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+
10
+ /**
11
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
12
+ */
13
+ declare class MenuBarItem extends ItemMixin(DirMixin(ThemableMixin(HTMLElement))) {}
14
+
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'vaadin-menu-bar-item': MenuBarItem;
18
+ }
19
+ }
20
+
21
+ export { MenuBarItem };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
+ import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+
11
+ /**
12
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
13
+ *
14
+ * @extends HTMLElement
15
+ * @mixes DirMixin
16
+ * @mixes ItemMixin
17
+ * @mixes ThemableMixin
18
+ * @protected
19
+ */
20
+ class MenuBarItem extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
21
+ static get is() {
22
+ return 'vaadin-menu-bar-item';
23
+ }
24
+
25
+ static get template() {
26
+ return html`
27
+ <style>
28
+ :host {
29
+ display: inline-block;
30
+ }
31
+
32
+ :host([hidden]) {
33
+ display: none !important;
34
+ }
35
+ </style>
36
+ <span part="checkmark" aria-hidden="true"></span>
37
+ <div part="content">
38
+ <slot></slot>
39
+ </div>
40
+ `;
41
+ }
42
+
43
+ /** @protected */
44
+ connectedCallback() {
45
+ super.connectedCallback();
46
+
47
+ // Set role in `connectedCallback()` instead of `ready()`
48
+ // because the role is removed when teleporting to button.
49
+ this.setAttribute('role', 'menuitem');
50
+ }
51
+ }
52
+
53
+ customElements.define(MenuBarItem.is, MenuBarItem);
54
+
55
+ export { MenuBarItem };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
+ import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+
11
+ /**
12
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
13
+ */
14
+ declare class MenuBarListBox extends ListMixin(DirMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {}
15
+
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ 'vaadin-menu-bar-list-box': MenuBarListBox;
19
+ }
20
+ }
21
+
22
+ export { MenuBarListBox };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
+ import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
10
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+
12
+ /**
13
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
14
+ *
15
+ * @extends HTMLElement
16
+ * @mixes ControllerMixin
17
+ * @mixes DirMixin
18
+ * @mixes ListMixin
19
+ * @mixes ThemableMixin
20
+ * @protected
21
+ */
22
+ class MenuBarListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(PolymerElement)))) {
23
+ static get is() {
24
+ return 'vaadin-menu-bar-list-box';
25
+ }
26
+
27
+ static get template() {
28
+ return html`
29
+ <style>
30
+ :host {
31
+ display: flex;
32
+ }
33
+
34
+ :host([hidden]) {
35
+ display: none !important;
36
+ }
37
+
38
+ [part='items'] {
39
+ height: 100%;
40
+ width: 100%;
41
+ overflow-y: auto;
42
+ -webkit-overflow-scrolling: touch;
43
+ }
44
+ </style>
45
+ <div part="items">
46
+ <slot></slot>
47
+ </div>
48
+ `;
49
+ }
50
+
51
+ static get properties() {
52
+ return {
53
+ // We don't need to define this property since super default is vertical,
54
+ // but we don't want it to be modified, or be shown in the API docs.
55
+ /** @private */
56
+ orientation: {
57
+ readOnly: true,
58
+ },
59
+ };
60
+ }
61
+
62
+ /**
63
+ * @return {!HTMLElement}
64
+ * @protected
65
+ * @override
66
+ */
67
+ get _scrollerElement() {
68
+ return this.shadowRoot.querySelector('[part="items"]');
69
+ }
70
+
71
+ /** @protected */
72
+ ready() {
73
+ super.ready();
74
+
75
+ this.setAttribute('role', 'menu');
76
+ }
77
+ }
78
+
79
+ customElements.define(MenuBarListBox.is, MenuBarListBox);
80
+
81
+ export { MenuBarListBox };
@@ -360,17 +360,16 @@ export const MenuBarMixin = (superClass) =>
360
360
 
361
361
  const isElement = itemComponent instanceof HTMLElement;
362
362
  // Use existing item component, if any
363
- if (isElement && itemComponent.localName === 'vaadin-context-menu-item') {
363
+ if (isElement && itemComponent.localName === 'vaadin-menu-bar-item') {
364
364
  component = itemComponent;
365
365
  } else {
366
- component = document.createElement('vaadin-context-menu-item');
366
+ component = document.createElement('vaadin-menu-bar-item');
367
367
  component.appendChild(isElement ? itemComponent : document.createElement(itemComponent));
368
368
  }
369
369
  if (item.text) {
370
370
  const node = component.firstChild || component;
371
371
  node.textContent = item.text;
372
372
  }
373
- component.setAttribute('theme', 'menu-bar-item');
374
373
  return component;
375
374
  }
376
375
 
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { MenuOverlayMixin } from '@vaadin/context-menu/src/vaadin-menu-overlay-mixin.js';
7
+ import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
8
+
9
+ /**
10
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
11
+ */
12
+ declare class MenuBarOverlay extends MenuOverlayMixin(Overlay) {}
13
+
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'vaadin-menu-bar-overlay': MenuBarOverlay;
17
+ }
18
+ }
19
+
20
+ export { MenuBarOverlay };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { MenuOverlayMixin } from '@vaadin/context-menu/src/vaadin-menu-overlay-mixin.js';
7
+ import { styles } from '@vaadin/context-menu/src/vaadin-menu-overlay-styles.js';
8
+ import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
9
+ import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+
11
+ registerStyles('vaadin-menu-bar-overlay', styles, { moduleId: 'vaadin-menu-bar-overlay-styles' });
12
+
13
+ /**
14
+ * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
15
+ *
16
+ * @extends Overlay
17
+ * @mixes MenuOverlayMixin
18
+ * @private
19
+ */
20
+ class MenuBarOverlay extends MenuOverlayMixin(Overlay) {
21
+ static get is() {
22
+ return 'vaadin-menu-bar-overlay';
23
+ }
24
+ }
25
+
26
+ customElements.define(MenuBarOverlay.is, MenuBarOverlay);
@@ -3,6 +3,10 @@
3
3
  * Copyright (c) 2019 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import './vaadin-menu-bar-item.js';
7
+ import './vaadin-menu-bar-list-box.js';
8
+ import './vaadin-menu-bar-overlay.js';
9
+ import { html } from '@polymer/polymer/lib/utils/html-tag.js';
6
10
  import { ContextMenu } from '@vaadin/context-menu/src/vaadin-context-menu.js';
7
11
 
8
12
  /**
@@ -16,12 +20,47 @@ class MenuBarSubmenu extends ContextMenu {
16
20
  return 'vaadin-menu-bar-submenu';
17
21
  }
18
22
 
23
+ static get template() {
24
+ return html`
25
+ <style>
26
+ :host {
27
+ display: block;
28
+ }
29
+
30
+ :host([hidden]) {
31
+ display: none !important;
32
+ }
33
+ </style>
34
+
35
+ <slot id="slot"></slot>
36
+
37
+ <vaadin-menu-bar-overlay
38
+ id="overlay"
39
+ on-opened-changed="_onOverlayOpened"
40
+ on-vaadin-overlay-open="_onVaadinOverlayOpen"
41
+ with-backdrop="[[_phone]]"
42
+ phone$="[[_phone]]"
43
+ model="[[_context]]"
44
+ theme$="[[_theme]]"
45
+ ></vaadin-menu-bar-overlay>
46
+ `;
47
+ }
48
+
19
49
  constructor() {
20
50
  super();
21
51
 
22
52
  this.openOn = 'opensubmenu';
23
53
  }
24
54
 
55
+ /**
56
+ * Tag name prefix used by overlay, list-box and items.
57
+ * @protected
58
+ * @return {string}
59
+ */
60
+ get _tagNamePrefix() {
61
+ return 'vaadin-menu-bar';
62
+ }
63
+
25
64
  /**
26
65
  * Overriding the observer to not add global "contextmenu" listener.
27
66
  */
@@ -20,7 +20,7 @@ export interface MenuBarItem {
20
20
  tooltip?: string;
21
21
  /**
22
22
  * The component to represent the button content.
23
- * Either a tagName or an element instance. Defaults to "vaadin-context-menu-item".
23
+ * Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
24
24
  */
25
25
  component?: HTMLElement | string;
26
26
  /**
@@ -101,9 +101,9 @@ export interface MenuBarEventMap extends HTMLElementEventMap, MenuBarCustomEvent
101
101
  * components are themable:
102
102
  *
103
103
  * - `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
104
- * - `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
105
- * - `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
106
- * - `<vaadin-context-menu-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
104
+ * - `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
105
+ * - `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
106
+ * - `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
107
107
  *
108
108
  * @fires {CustomEvent} item-selected - Fired when a submenu item or menu bar button without children is clicked.
109
109
  */
@@ -52,9 +52,9 @@ import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
52
52
  * components are themable:
53
53
  *
54
54
  * - `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
55
- * - `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
56
- * - `<vaadin-context-menu-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
57
- * - `<vaadin-context-menu-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
55
+ * - `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
56
+ * - `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
57
+ * - `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
58
58
  *
59
59
  * @fires {CustomEvent<boolean>} item-selected - Fired when a submenu item or menu bar button without children is clicked.
60
60
  *
@@ -108,7 +108,7 @@ class MenuBar extends MenuBarMixin(DisabledMixin(ElementMixin(ThemableMixin(Poly
108
108
  * @property {string} tooltip - Text to be set as the menu button's tooltip.
109
109
  * Requires a `<vaadin-tooltip slot="tooltip">` element to be added inside the `<vaadin-menu-bar>`.
110
110
  * @property {union: string | object} component - The component to represent the button content.
111
- * Either a tagName or an element instance. Defaults to "vaadin-context-menu-item".
111
+ * Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
112
112
  * @property {boolean} disabled - If true, the button is disabled and cannot be activated.
113
113
  * @property {union: string | string[]} theme - Theme(s) to be set as the theme attribute of the button, overriding any theme set on the menu bar.
114
114
  * @property {SubMenuItem[]} children - Array of submenu items.
@@ -119,7 +119,7 @@ class MenuBar extends MenuBarMixin(DisabledMixin(ElementMixin(ThemableMixin(Poly
119
119
  * @type {object}
120
120
  * @property {string} text - Text to be set as the menu item component's textContent.
121
121
  * @property {union: string | object} component - The component to represent the item.
122
- * Either a tagName or an element instance. Defaults to "vaadin-context-menu-item".
122
+ * Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
123
123
  * @property {boolean} disabled - If true, the item is disabled and cannot be selected.
124
124
  * @property {boolean} checked - If true, the item shows a checkmark next to it.
125
125
  * @property {SubMenuItem[]} children - Array of child submenu items.
@@ -13,7 +13,7 @@ const menuBarButton = css`
13
13
  }
14
14
 
15
15
  /* NOTE(web-padawan): avoid using shorthand padding property for IE11 */
16
- [part='label'] ::slotted(vaadin-context-menu-item) {
16
+ [part='label'] ::slotted(vaadin-menu-bar-item) {
17
17
  justify-content: center;
18
18
  background-color: transparent;
19
19
  height: var(--lumo-button-size);
@@ -22,14 +22,14 @@ const menuBarButton = css`
22
22
  padding-right: calc(var(--lumo-size-m) / 3 + var(--lumo-border-radius-m) / 2);
23
23
  }
24
24
 
25
- :host([theme~='small']) [part='label'] ::slotted(vaadin-context-menu-item) {
25
+ :host([theme~='small']) [part='label'] ::slotted(vaadin-menu-bar-item) {
26
26
  min-height: var(--lumo-size-s);
27
27
  margin: 0 calc((var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2) * -1);
28
28
  padding-left: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
29
29
  padding-right: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
30
30
  }
31
31
 
32
- :host([theme~='tertiary']) [part='label'] ::slotted(vaadin-context-menu-item) {
32
+ :host([theme~='tertiary']) [part='label'] ::slotted(vaadin-menu-bar-item) {
33
33
  margin: 0 calc((var(--lumo-button-size) / 6) * -1);
34
34
  padding-left: calc(var(--lumo-button-size) / 6);
35
35
  padding-right: calc(var(--lumo-button-size) / 6);
@@ -41,7 +41,7 @@ const menuBarButton = css`
41
41
  margin-right: calc(var(--lumo-space-xs) / 2);
42
42
  }
43
43
 
44
- :host([theme~='tertiary-inline']) [part='label'] ::slotted(vaadin-context-menu-item) {
44
+ :host([theme~='tertiary-inline']) [part='label'] ::slotted(vaadin-menu-bar-item) {
45
45
  margin: 0;
46
46
  padding: 0;
47
47
  }
@@ -1,27 +1,27 @@
1
1
  import '@vaadin/vaadin-lumo-styles/sizing.js';
2
2
  import '@vaadin/vaadin-lumo-styles/spacing.js';
3
+ import { contextMenuItem } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-item-styles.js';
4
+ import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
3
5
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
6
 
5
- registerStyles(
6
- 'vaadin-context-menu-item',
7
- css`
8
- :host([theme='menu-bar-item']) [part='content'] {
9
- display: flex;
10
- /* tweak to inherit centering from menu bar button */
11
- align-items: inherit;
12
- justify-content: inherit;
13
- }
7
+ const menuBarItem = css`
8
+ [part='content'] {
9
+ display: flex;
10
+ /* tweak to inherit centering from menu bar button */
11
+ align-items: inherit;
12
+ justify-content: inherit;
13
+ }
14
14
 
15
- :host([theme='menu-bar-item']) [part='content'] ::slotted(vaadin-icon) {
16
- display: inline-block;
17
- width: var(--lumo-icon-size-m);
18
- height: var(--lumo-icon-size-m);
19
- }
15
+ [part='content'] ::slotted(vaadin-icon) {
16
+ display: inline-block;
17
+ width: var(--lumo-icon-size-m);
18
+ height: var(--lumo-icon-size-m);
19
+ }
20
20
 
21
- :host([theme='menu-bar-item']) [part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
22
- padding: var(--lumo-space-xs);
23
- box-sizing: border-box !important;
24
- }
25
- `,
26
- { moduleId: 'lumo-menu-bar-item' },
27
- );
21
+ [part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
22
+ padding: var(--lumo-space-xs);
23
+ box-sizing: border-box !important;
24
+ }
25
+ `;
26
+
27
+ registerStyles('vaadin-menu-bar-item', [item, contextMenuItem, menuBarItem], { moduleId: 'lumo-menu-bar-item' });
@@ -0,0 +1,5 @@
1
+ import { contextMenuListBox } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-list-box-styles.js';
2
+ import { listBox } from '@vaadin/list-box/theme/lumo/vaadin-list-box-styles.js';
3
+ import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
+
5
+ registerStyles('vaadin-menu-bar-list-box', [listBox, contextMenuListBox], { moduleId: 'lumo-menu-bar-list-box' });
@@ -1,11 +1,13 @@
1
+ import { contextMenuOverlay } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-overlay-styles.js';
2
+ import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
1
3
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
4
 
3
- registerStyles(
4
- 'vaadin-context-menu-overlay',
5
- css`
6
- :host(:first-of-type) {
7
- padding-top: var(--lumo-space-xs);
8
- }
9
- `,
10
- { moduleId: 'lumo-menu-bar-overlay' },
11
- );
5
+ const menuBarOverlay = css`
6
+ :host(:first-of-type) {
7
+ padding-top: var(--lumo-space-xs);
8
+ }
9
+ `;
10
+
11
+ registerStyles('vaadin-menu-bar-overlay', [menuOverlay, contextMenuOverlay, menuBarOverlay], {
12
+ moduleId: 'lumo-menu-bar-overlay',
13
+ });
@@ -1,6 +1,7 @@
1
1
  import './vaadin-menu-bar-button.js';
2
2
  import './vaadin-menu-bar-item-styles.js';
3
+ import './vaadin-menu-bar-list-box-styles.js';
3
4
  import './vaadin-menu-bar-overlay-styles.js';
4
5
  import './vaadin-menu-bar-styles.js';
5
- import '@vaadin/context-menu/theme/lumo/vaadin-context-menu.js';
6
+ import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
6
7
  import '../../src/vaadin-menu-bar.js';
@@ -6,7 +6,7 @@ const menuBarButton = css`
6
6
  width: 100%;
7
7
  }
8
8
 
9
- [part='label'] ::slotted(vaadin-context-menu-item) {
9
+ [part='label'] ::slotted(vaadin-menu-bar-item) {
10
10
  line-height: 20px;
11
11
  background-color: transparent;
12
12
  margin: -8px;
@@ -19,8 +19,8 @@ const menuBarButton = css`
19
19
  border-radius: 0;
20
20
  }
21
21
 
22
- :host([theme~='contained']) ::slotted(vaadin-context-menu-item),
23
- :host([theme~='outlined']) ::slotted(vaadin-context-menu-item) {
22
+ :host([theme~='contained']) ::slotted(vaadin-menu-bar-item),
23
+ :host([theme~='outlined']) ::slotted(vaadin-menu-bar-item) {
24
24
  margin: -8px -16px;
25
25
  padding: 8px 16px;
26
26
  }
@@ -1,23 +1,23 @@
1
1
  import '@vaadin/vaadin-material-styles/typography.js';
2
+ import { contextMenuItem } from '@vaadin/context-menu/theme/material/vaadin-context-menu-item-styles.js';
3
+ import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
2
4
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
5
 
4
- registerStyles(
5
- 'vaadin-context-menu-item',
6
- css`
7
- :host([theme='menu-bar-item']) [part='content'] {
8
- display: flex;
9
- /* tweak to inherit centering from menu bar button */
10
- align-items: inherit;
11
- justify-content: inherit;
12
- font-size: var(--material-button-font-size);
13
- }
6
+ const menuBarItem = css`
7
+ [part='content'] {
8
+ display: flex;
9
+ /* tweak to inherit centering from menu bar button */
10
+ align-items: inherit;
11
+ justify-content: inherit;
12
+ font-size: var(--material-button-font-size);
13
+ }
14
14
 
15
- :host([theme='menu-bar-item']) [part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
16
- display: inline-block;
17
- width: 18px;
18
- height: 18px;
19
- box-sizing: border-box !important;
20
- }
21
- `,
22
- { moduleId: 'material-menu-bar-item' },
23
- );
15
+ [part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
16
+ display: inline-block;
17
+ width: 18px;
18
+ height: 18px;
19
+ box-sizing: border-box !important;
20
+ }
21
+ `;
22
+
23
+ registerStyles('vaadin-menu-bar-item', [item, contextMenuItem, menuBarItem], { moduleId: 'material-menu-bar-item' });
@@ -0,0 +1,5 @@
1
+ import { contextMenuListBox } from '@vaadin/context-menu/theme/material/vaadin-context-menu-list-box-styles.js';
2
+ import { listBox } from '@vaadin/list-box/theme/material/vaadin-list-box-styles.js';
3
+ import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
+
5
+ registerStyles('vaadin-menu-bar-list-box', [listBox, contextMenuListBox], { moduleId: 'material-menu-bar-list-box' });
@@ -1,11 +1,13 @@
1
+ import { contextMenuOverlay } from '@vaadin/context-menu/theme/material/vaadin-context-menu-overlay-styles.js';
2
+ import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
1
3
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
4
 
3
- registerStyles(
4
- 'vaadin-context-menu-overlay',
5
- css`
6
- :host(:first-of-type) {
7
- padding-top: 5px;
8
- }
9
- `,
10
- { moduleId: 'material-menu-bar-overlay' },
11
- );
5
+ const menuBarOverlay = css`
6
+ :host(:first-of-type) {
7
+ padding-top: 5px;
8
+ }
9
+ `;
10
+
11
+ registerStyles('vaadin-menu-bar-overlay', [menuOverlay, contextMenuOverlay, menuBarOverlay], {
12
+ moduleId: 'material-menu-bar-overlay',
13
+ });
@@ -1,6 +1,7 @@
1
1
  import './vaadin-menu-bar-button.js';
2
2
  import './vaadin-menu-bar-item-styles.js';
3
+ import './vaadin-menu-bar-list-box-styles.js';
3
4
  import './vaadin-menu-bar-styles.js';
4
5
  import './vaadin-menu-bar-overlay-styles.js';
5
- import '@vaadin/context-menu/theme/material/vaadin-context-menu.js';
6
+ import '@vaadin/overlay/theme/material/vaadin-overlay.js';
6
7
  import '../../src/vaadin-menu-bar.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/menu-bar",
4
- "version": "24.0.0-alpha12",
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-menu-bar",
11
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-context-menu-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-overlay).",
11
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-item).\n- `<vaadin-menu-bar-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- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-overlay).",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/menu-bar",
4
- "version": "24.0.0-alpha12",
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-menu-bar",
19
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-context-menu-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-overlay).",
19
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-item).\n- `<vaadin-menu-bar-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- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha13/#/elements/vaadin-overlay).",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {