@vaadin/menu-bar 24.3.10 → 24.3.11

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.3.10",
3
+ "version": "24.3.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,20 +37,20 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "~24.3.10",
41
- "@vaadin/button": "~24.3.10",
42
- "@vaadin/component-base": "~24.3.10",
43
- "@vaadin/context-menu": "~24.3.10",
44
- "@vaadin/item": "~24.3.10",
45
- "@vaadin/list-box": "~24.3.10",
46
- "@vaadin/overlay": "~24.3.10",
47
- "@vaadin/vaadin-lumo-styles": "~24.3.10",
48
- "@vaadin/vaadin-material-styles": "~24.3.10",
49
- "@vaadin/vaadin-themable-mixin": "~24.3.10"
40
+ "@vaadin/a11y-base": "~24.3.11",
41
+ "@vaadin/button": "~24.3.11",
42
+ "@vaadin/component-base": "~24.3.11",
43
+ "@vaadin/context-menu": "~24.3.11",
44
+ "@vaadin/item": "~24.3.11",
45
+ "@vaadin/list-box": "~24.3.11",
46
+ "@vaadin/overlay": "~24.3.11",
47
+ "@vaadin/vaadin-lumo-styles": "~24.3.11",
48
+ "@vaadin/vaadin-material-styles": "~24.3.11",
49
+ "@vaadin/vaadin-themable-mixin": "~24.3.11"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
53
- "@vaadin/icon": "~24.3.10",
53
+ "@vaadin/icon": "~24.3.11",
54
54
  "@vaadin/testing-helpers": "^0.6.0",
55
55
  "sinon": "^13.0.2"
56
56
  },
@@ -58,5 +58,5 @@
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "32a4f327e78490074eaefa768f58857b83ca6278"
61
+ "gitHead": "890abeb0937416074456782aa90ed92c1bfe9cac"
62
62
  }
@@ -168,6 +168,7 @@ export const MenuBarMixin = (superClass) =>
168
168
  constructor() {
169
169
  super();
170
170
  this.__boundOnContextMenuKeydown = this.__onContextMenuKeydown.bind(this);
171
+ this.__boundOnTooltipMouseLeave = this.__onTooltipOverlayMouseLeave.bind(this);
171
172
  }
172
173
 
173
174
  /**
@@ -251,7 +252,12 @@ export const MenuBarMixin = (superClass) =>
251
252
  container.addEventListener('click', this.__onButtonClick.bind(this));
252
253
  container.addEventListener('mouseover', (e) => this._onMouseOver(e));
253
254
 
254
- this._container = container;
255
+ // Delay setting container to avoid rendering buttons immediately,
256
+ // which would also trigger detecting overflow and force re-layout
257
+ // See https://github.com/vaadin/web-components/issues/7271
258
+ queueMicrotask(() => {
259
+ this._container = container;
260
+ });
255
261
  }
256
262
 
257
263
  /**
@@ -444,6 +450,10 @@ export const MenuBarMixin = (superClass) =>
444
450
 
445
451
  /** @private */
446
452
  __detectOverflow() {
453
+ if (!this._container) {
454
+ return;
455
+ }
456
+
447
457
  const overflow = this._overflow;
448
458
  const buttons = this._buttons.filter((btn) => btn !== overflow);
449
459
  const oldOverflowCount = this.__getOverflowCount(overflow);
@@ -583,6 +593,11 @@ export const MenuBarMixin = (superClass) =>
583
593
  tooltip.generator = ({ item }) => item && item.tooltip;
584
594
  }
585
595
 
596
+ if (!tooltip._mouseLeaveListenerAdded) {
597
+ tooltip._overlayElement.addEventListener('mouseleave', this.__boundOnTooltipMouseLeave);
598
+ tooltip._mouseLeaveListenerAdded = true;
599
+ }
600
+
586
601
  if (!this._subMenu.opened) {
587
602
  this._tooltipController.setTarget(button);
588
603
  this._tooltipController.setContext({ item: button.item });
@@ -604,6 +619,13 @@ export const MenuBarMixin = (superClass) =>
604
619
  }
605
620
  }
606
621
 
622
+ /** @private */
623
+ __onTooltipOverlayMouseLeave(event) {
624
+ if (event.relatedTarget !== this._tooltipController.target) {
625
+ this._hideTooltip();
626
+ }
627
+ }
628
+
607
629
  /** @protected */
608
630
  _setExpanded(button, expanded) {
609
631
  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.3.10",
4
+ "version": "24.3.11",
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.3.10/#/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.3.10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.10/#/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.3.10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.10/#/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.3.11/#/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.3.11/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.11/#/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.3.11/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.11/#/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.3.10",
4
+ "version": "24.3.11",
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.3.10/#/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.3.10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.10/#/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.3.10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.10/#/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.3.11/#/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.3.11/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.11/#/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.3.11/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.11/#/elements/vaadin-overlay).",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {