@vaadin/menu-bar 24.4.0-alpha20 → 24.4.0-alpha22

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.4.0-alpha20",
3
+ "version": "24.4.0-alpha22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,21 +39,21 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/a11y-base": "24.4.0-alpha20",
43
- "@vaadin/button": "24.4.0-alpha20",
44
- "@vaadin/component-base": "24.4.0-alpha20",
45
- "@vaadin/context-menu": "24.4.0-alpha20",
46
- "@vaadin/item": "24.4.0-alpha20",
47
- "@vaadin/list-box": "24.4.0-alpha20",
48
- "@vaadin/overlay": "24.4.0-alpha20",
49
- "@vaadin/vaadin-lumo-styles": "24.4.0-alpha20",
50
- "@vaadin/vaadin-material-styles": "24.4.0-alpha20",
51
- "@vaadin/vaadin-themable-mixin": "24.4.0-alpha20",
42
+ "@vaadin/a11y-base": "24.4.0-alpha22",
43
+ "@vaadin/button": "24.4.0-alpha22",
44
+ "@vaadin/component-base": "24.4.0-alpha22",
45
+ "@vaadin/context-menu": "24.4.0-alpha22",
46
+ "@vaadin/item": "24.4.0-alpha22",
47
+ "@vaadin/list-box": "24.4.0-alpha22",
48
+ "@vaadin/overlay": "24.4.0-alpha22",
49
+ "@vaadin/vaadin-lumo-styles": "24.4.0-alpha22",
50
+ "@vaadin/vaadin-material-styles": "24.4.0-alpha22",
51
+ "@vaadin/vaadin-themable-mixin": "24.4.0-alpha22",
52
52
  "lit": "^3.0.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@esm-bundle/chai": "^4.3.4",
56
- "@vaadin/icon": "24.4.0-alpha20",
56
+ "@vaadin/icon": "24.4.0-alpha22",
57
57
  "@vaadin/testing-helpers": "^0.6.0",
58
58
  "sinon": "^13.0.2"
59
59
  },
@@ -61,5 +61,5 @@
61
61
  "web-types.json",
62
62
  "web-types.lit.json"
63
63
  ],
64
- "gitHead": "9d2eacc494eb27658ba9298be6656815912637be"
64
+ "gitHead": "8e5223bcb61a5561fd984db5d11b31a73ec98eaa"
65
65
  }
@@ -179,6 +179,7 @@ export const MenuBarMixin = (superClass) =>
179
179
  constructor() {
180
180
  super();
181
181
  this.__boundOnContextMenuKeydown = this.__onContextMenuKeydown.bind(this);
182
+ this.__boundOnTooltipMouseLeave = this.__onTooltipOverlayMouseLeave.bind(this);
182
183
  }
183
184
 
184
185
  /**
@@ -262,7 +263,12 @@ export const MenuBarMixin = (superClass) =>
262
263
  container.addEventListener('click', this.__onButtonClick.bind(this));
263
264
  container.addEventListener('mouseover', (e) => this._onMouseOver(e));
264
265
 
265
- this._container = container;
266
+ // Delay setting container to avoid rendering buttons immediately,
267
+ // which would also trigger detecting overflow and force re-layout
268
+ // See https://github.com/vaadin/web-components/issues/7271
269
+ queueMicrotask(() => {
270
+ this._container = container;
271
+ });
266
272
  }
267
273
 
268
274
  /**
@@ -468,6 +474,10 @@ export const MenuBarMixin = (superClass) =>
468
474
 
469
475
  /** @private */
470
476
  __detectOverflow() {
477
+ if (!this._container) {
478
+ return;
479
+ }
480
+
471
481
  const overflow = this._overflow;
472
482
  const buttons = this._buttons.filter((btn) => btn !== overflow);
473
483
  const oldOverflowCount = this.__getOverflowCount(overflow);
@@ -615,6 +625,11 @@ export const MenuBarMixin = (superClass) =>
615
625
  tooltip.generator = ({ item }) => item && item.tooltip;
616
626
  }
617
627
 
628
+ if (!tooltip._mouseLeaveListenerAdded) {
629
+ tooltip._overlayElement.addEventListener('mouseleave', this.__boundOnTooltipMouseLeave);
630
+ tooltip._mouseLeaveListenerAdded = true;
631
+ }
632
+
618
633
  if (!this._subMenu.opened) {
619
634
  this._tooltipController.setTarget(button);
620
635
  this._tooltipController.setContext({ item: button.item });
@@ -636,6 +651,13 @@ export const MenuBarMixin = (superClass) =>
636
651
  }
637
652
  }
638
653
 
654
+ /** @private */
655
+ __onTooltipOverlayMouseLeave(event) {
656
+ if (event.relatedTarget !== this._tooltipController.target) {
657
+ this._hideTooltip();
658
+ }
659
+ }
660
+
639
661
  /** @protected */
640
662
  _setExpanded(button, expanded) {
641
663
  button.toggleAttribute('expanded', expanded);
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.4.0-alpha20",
4
+ "version": "24.4.0-alpha22",
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.4.0-alpha20/#/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/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.4.0-alpha20/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha20/#/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.4.0-alpha20/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha20/#/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.4.0-alpha22/#/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/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.4.0-alpha22/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha22/#/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.4.0-alpha22/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha22/#/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.4.0-alpha20",
4
+ "version": "24.4.0-alpha22",
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.4.0-alpha20/#/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/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.4.0-alpha20/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha20/#/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.4.0-alpha20/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha20/#/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.4.0-alpha22/#/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/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.4.0-alpha22/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha22/#/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.4.0-alpha22/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha22/#/elements/vaadin-overlay).",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {