@vaadin/menu-bar 25.2.0-alpha10 → 25.2.0-alpha12

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.
@@ -163,14 +163,6 @@
163
163
  "name": "I18nMixin",
164
164
  "package": "@vaadin/component-base/src/i18n-mixin.js"
165
165
  },
166
- {
167
- "name": "DisabledMixin",
168
- "package": "@vaadin/a11y-base/src/disabled-mixin.js"
169
- },
170
- {
171
- "name": "FocusMixin",
172
- "package": "@vaadin/a11y-base/src/focus-mixin.js"
173
- },
174
166
  {
175
167
  "name": "KeyboardDirectionMixin",
176
168
  "package": "@vaadin/a11y-base/src/keyboard-direction-mixin.js"
@@ -178,6 +170,14 @@
178
170
  {
179
171
  "name": "ResizeMixin",
180
172
  "package": "@vaadin/component-base/src/resize-mixin.js"
173
+ },
174
+ {
175
+ "name": "FocusMixin",
176
+ "package": "@vaadin/a11y-base/src/focus-mixin.js"
177
+ },
178
+ {
179
+ "name": "DisabledMixin",
180
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
181
181
  }
182
182
  ],
183
183
  "parameters": [
@@ -207,6 +207,14 @@
207
207
  "description": "Controller for the tooltip slotted into `<vaadin-menu-bar>`. Extends\n`ContextMenuTooltipController` to also support menu-bar buttons as\ntargets, in addition to sub-menu items.",
208
208
  "name": "MenuBarTooltipController",
209
209
  "members": [
210
+ {
211
+ "kind": "method",
212
+ "name": "bringToFront",
213
+ "inheritedFrom": {
214
+ "name": "ContextMenuTooltipController",
215
+ "package": "@vaadin/context-menu/src/vaadin-context-menu-tooltip-controller.js"
216
+ }
217
+ },
210
218
  {
211
219
  "kind": "method",
212
220
  "name": "close",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/menu-bar",
3
- "version": "25.2.0-alpha10",
3
+ "version": "25.2.0-alpha12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,23 +35,23 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.2.0-alpha10",
39
- "@vaadin/button": "25.2.0-alpha10",
40
- "@vaadin/component-base": "25.2.0-alpha10",
41
- "@vaadin/context-menu": "25.2.0-alpha10",
42
- "@vaadin/item": "25.2.0-alpha10",
43
- "@vaadin/list-box": "25.2.0-alpha10",
44
- "@vaadin/overlay": "25.2.0-alpha10",
45
- "@vaadin/vaadin-themable-mixin": "25.2.0-alpha10",
38
+ "@vaadin/a11y-base": "25.2.0-alpha12",
39
+ "@vaadin/button": "25.2.0-alpha12",
40
+ "@vaadin/component-base": "25.2.0-alpha12",
41
+ "@vaadin/context-menu": "25.2.0-alpha12",
42
+ "@vaadin/item": "25.2.0-alpha12",
43
+ "@vaadin/list-box": "25.2.0-alpha12",
44
+ "@vaadin/overlay": "25.2.0-alpha12",
45
+ "@vaadin/vaadin-themable-mixin": "25.2.0-alpha12",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/aura": "25.2.0-alpha10",
50
- "@vaadin/chai-plugins": "25.2.0-alpha10",
51
- "@vaadin/icon": "25.2.0-alpha10",
52
- "@vaadin/test-runner-commands": "25.2.0-alpha10",
49
+ "@vaadin/aura": "25.2.0-alpha12",
50
+ "@vaadin/chai-plugins": "25.2.0-alpha12",
51
+ "@vaadin/icon": "25.2.0-alpha12",
52
+ "@vaadin/test-runner-commands": "25.2.0-alpha12",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.2.0-alpha10",
54
+ "@vaadin/vaadin-lumo-styles": "25.2.0-alpha12",
55
55
  "sinon": "^21.0.2"
56
56
  },
57
57
  "customElements": "custom-elements.json",
@@ -59,5 +59,5 @@
59
59
  "web-types.json",
60
60
  "web-types.lit.json"
61
61
  ],
62
- "gitHead": "1303b6a3eeecb44a9d26f2b53cb56d9e906febdf"
62
+ "gitHead": "ae1e4373aec3653d63a45b6be18eee36f4b245a1"
63
63
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2019 - 2026 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 { menuOverlayStyles } from '@vaadin/context-menu/src/styles/vaadin-menu-overlay-base-styles.js';
@@ -17,9 +17,6 @@ import { menuBarItemStyles } from './styles/vaadin-menu-bar-item-base-styles.js'
17
17
  *
18
18
  * @customElement vaadin-menu-bar-item
19
19
  * @extends HTMLElement
20
- * @mixes DirMixin
21
- * @mixes ItemMixin
22
- * @mixes ThemableMixin
23
20
  * @protected
24
21
  */
25
22
  class MenuBarItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
@@ -17,9 +17,6 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
17
17
  *
18
18
  * @customElement vaadin-menu-bar-list-box
19
19
  * @extends HTMLElement
20
- * @mixes DirMixin
21
- * @mixes ListMixin
22
- * @mixes ThemableMixin
23
20
  * @protected
24
21
  */
25
22
  class MenuBarListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
@@ -56,17 +56,8 @@ const DEFAULT_I18N = {
56
56
  moreOptions: 'More options',
57
57
  };
58
58
 
59
- /**
60
- * @polymerMixin
61
- * @mixes DisabledMixin
62
- * @mixes FocusMixin
63
- * @mixes I18nMixin
64
- * @mixes KeyboardDirectionMixin
65
- * @mixes ResizeMixin
66
- */
67
59
  export const MenuBarMixin = (superClass) =>
68
60
  class MenuBarMixinClass extends I18nMixin(
69
- DEFAULT_I18N,
70
61
  KeyboardDirectionMixin(ResizeMixin(FocusMixin(DisabledMixin(superClass)))),
71
62
  ) {
72
63
  static get properties() {
@@ -205,6 +196,10 @@ export const MenuBarMixin = (superClass) =>
205
196
  };
206
197
  }
207
198
 
199
+ static get defaultI18n() {
200
+ return DEFAULT_I18N;
201
+ }
202
+
208
203
  /**
209
204
  * The object used to localize this component. To change the default
210
205
  * localization, replace this with an object that provides all properties, or
@@ -707,7 +702,7 @@ export const MenuBarMixin = (superClass) =>
707
702
 
708
703
  if (wasExpanded && button.item && button.item.children) {
709
704
  this.__openSubMenu(button, true, { keepFocus: true });
710
- } else {
705
+ } else if (!this._subMenu.opened) {
711
706
  this._tooltipController.open({ trigger: 'focus' });
712
707
  }
713
708
  }
@@ -761,7 +756,7 @@ export const MenuBarMixin = (superClass) =>
761
756
  this._setTabindex(btn, btn === target);
762
757
  });
763
758
 
764
- if (isKeyboardActive()) {
759
+ if (!this._subMenu.opened && isKeyboardActive()) {
765
760
  this._tooltipController.open({ trigger: 'focus' });
766
761
  }
767
762
  } else {
@@ -18,10 +18,6 @@ import { menuBarOverlayStyles } from './styles/vaadin-menu-bar-overlay-base-styl
18
18
  *
19
19
  * @customElement vaadin-menu-bar-overlay
20
20
  * @extends HTMLElement
21
- * @mixes DirMixin
22
- * @mixes MenuOverlayMixin
23
- * @mixes OverlayMixin
24
- * @mixes ThemableMixin
25
21
  * @protected
26
22
  */
27
23
  export class MenuBarOverlay extends MenuOverlayMixin(
@@ -18,8 +18,6 @@ import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-p
18
18
  *
19
19
  * @customElement vaadin-menu-bar-submenu
20
20
  * @extends HTMLElement
21
- * @mixes ContextMenuMixin
22
- * @mixes ThemePropertyMixin
23
21
  * @protected
24
22
  */
25
23
  class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(LitElement))) {
@@ -56,13 +54,14 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
56
54
  }
57
55
 
58
56
  /** @protected */
59
- ready() {
60
- super.ready();
61
-
62
- // The slotted `<vaadin-tooltip>` lives on the parent `<vaadin-menu-bar>`.
63
- // Its tooltip controller instance is shared across sub-menus to reuse
64
- // the same tooltip element for items at every nesting level.
57
+ firstUpdated(props) {
58
+ // Tooltip lives on the parent `<vaadin-menu-bar>`. Reuse its controller
59
+ // so the same tooltip element serves items at every nesting level.
60
+ // Assigned before `super.firstUpdated()` so `ContextMenuMixin` skips
61
+ // creating its own controller (we don't render a tooltip slot).
65
62
  this._tooltipController = this.parentElement._tooltipController;
63
+
64
+ super.firstUpdated(props);
66
65
  }
67
66
 
68
67
  /**
@@ -96,19 +95,25 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
96
95
  <slot name="overlay"></slot>
97
96
  <slot name="submenu" slot="submenu"></slot>
98
97
  </vaadin-menu-bar-overlay>
99
-
100
- <slot name="tooltip"></slot>
101
98
  `;
102
99
  }
103
100
 
104
101
  /**
105
- * Overriding the observer to not add global "contextmenu" listener.
102
+ * Overriding the observer to not toggle user-select on the host.
106
103
  * @override
107
104
  */
108
105
  _openedChanged() {
109
106
  // Do nothing
110
107
  }
111
108
 
109
+ /**
110
+ * Overriding the handler to not react to global "contextmenu" events.
111
+ * @override
112
+ */
113
+ __onGlobalContextMenu() {
114
+ // Do nothing
115
+ }
116
+
112
117
  /**
113
118
  * Overriding the public method to reset expanded button state.
114
119
  */
@@ -69,9 +69,6 @@ import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
69
69
  *
70
70
  * @customElement vaadin-menu-bar
71
71
  * @extends HTMLElement
72
- * @mixes ElementMixin
73
- * @mixes MenuBarMixin
74
- * @mixes ThemableMixin
75
72
  */
76
73
  class MenuBar extends MenuBarMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
77
74
  static get is() {
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": "25.2.0-alpha10",
4
+ "version": "25.2.0-alpha12",
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```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\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/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/25.2.0-alpha10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
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```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\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/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/25.2.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
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": "25.2.0-alpha10",
4
+ "version": "25.2.0-alpha12",
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```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\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/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/25.2.0-alpha10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
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```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\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/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/25.2.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha12/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {