@vaadin/menu-bar 25.2.7 → 25.3.0-alpha10

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.
@@ -413,34 +413,6 @@
413
413
  }
414
414
  }
415
415
  ],
416
- "mixins": [
417
- {
418
- "name": "MenuBarMixin",
419
- "module": "src/vaadin-menu-bar-mixin.js"
420
- },
421
- {
422
- "name": "ElementMixin",
423
- "package": "@vaadin/component-base/src/element-mixin.js"
424
- },
425
- {
426
- "name": "ThemableMixin",
427
- "package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
428
- },
429
- {
430
- "name": "PolylitMixin",
431
- "package": "@vaadin/component-base/src/polylit-mixin.js"
432
- },
433
- {
434
- "name": "LumoInjectionMixin",
435
- "package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
436
- }
437
- ],
438
- "superclass": {
439
- "name": "LitElement",
440
- "package": "lit"
441
- },
442
- "tagName": "vaadin-menu-bar",
443
- "customElement": true,
444
416
  "attributes": [
445
417
  {
446
418
  "name": "disabled",
@@ -501,8 +473,43 @@
501
473
  "name": "MenuBarMixin",
502
474
  "module": "src/vaadin-menu-bar-mixin.js"
503
475
  }
476
+ },
477
+ {
478
+ "type": {
479
+ "text": "string"
480
+ },
481
+ "description": "The theme variants to apply to the component.",
482
+ "name": "theme"
504
483
  }
505
- ]
484
+ ],
485
+ "mixins": [
486
+ {
487
+ "name": "MenuBarMixin",
488
+ "module": "src/vaadin-menu-bar-mixin.js"
489
+ },
490
+ {
491
+ "name": "ElementMixin",
492
+ "package": "@vaadin/component-base/src/element-mixin.js"
493
+ },
494
+ {
495
+ "name": "ThemableMixin",
496
+ "package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
497
+ },
498
+ {
499
+ "name": "PolylitMixin",
500
+ "package": "@vaadin/component-base/src/polylit-mixin.js"
501
+ },
502
+ {
503
+ "name": "LumoInjectionMixin",
504
+ "package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
505
+ }
506
+ ],
507
+ "superclass": {
508
+ "name": "LitElement",
509
+ "package": "lit"
510
+ },
511
+ "tagName": "vaadin-menu-bar",
512
+ "customElement": true
506
513
  }
507
514
  ],
508
515
  "exports": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/menu-bar",
3
- "version": "25.2.7",
3
+ "version": "25.3.0-alpha10",
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.7",
39
- "@vaadin/button": "~25.2.7",
40
- "@vaadin/component-base": "~25.2.7",
41
- "@vaadin/context-menu": "~25.2.7",
42
- "@vaadin/item": "~25.2.7",
43
- "@vaadin/list-box": "~25.2.7",
44
- "@vaadin/overlay": "~25.2.7",
45
- "@vaadin/vaadin-themable-mixin": "~25.2.7",
38
+ "@vaadin/a11y-base": "25.3.0-alpha10",
39
+ "@vaadin/button": "25.3.0-alpha10",
40
+ "@vaadin/component-base": "25.3.0-alpha10",
41
+ "@vaadin/context-menu": "25.3.0-alpha10",
42
+ "@vaadin/item": "25.3.0-alpha10",
43
+ "@vaadin/list-box": "25.3.0-alpha10",
44
+ "@vaadin/overlay": "25.3.0-alpha10",
45
+ "@vaadin/vaadin-themable-mixin": "25.3.0-alpha10",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/aura": "~25.2.7",
50
- "@vaadin/chai-plugins": "~25.2.7",
51
- "@vaadin/icon": "~25.2.7",
52
- "@vaadin/test-runner-commands": "~25.2.7",
49
+ "@vaadin/aura": "25.3.0-alpha10",
50
+ "@vaadin/chai-plugins": "25.3.0-alpha10",
51
+ "@vaadin/icon": "25.3.0-alpha10",
52
+ "@vaadin/test-runner-commands": "25.3.0-alpha10",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "~25.2.7",
54
+ "@vaadin/vaadin-lumo-styles": "25.3.0-alpha10",
55
55
  "sinon": "^22.0.0"
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": "14be1af674f3968cce68c6eb4742340694c4a949"
62
+ "gitHead": "f2833abdf9b613fa0d0ed216830e3f4de87b7dac"
63
63
  }
@@ -15,6 +15,7 @@ import { menuBarItemStyles } from './styles/vaadin-menu-bar-item-base-styles.js'
15
15
  /**
16
16
  * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
17
17
  *
18
+ * @attr {string} theme - The theme variants to apply to the component.
18
19
  * @customElement vaadin-menu-bar-item
19
20
  * @extends HTMLElement
20
21
  * @protected
@@ -15,6 +15,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
15
15
  /**
16
16
  * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
17
17
  *
18
+ * @attr {string} theme - The theme variants to apply to the component.
18
19
  * @customElement vaadin-menu-bar-list-box
19
20
  * @extends HTMLElement
20
21
  * @protected
@@ -12,6 +12,7 @@ import { isElementFocused, isElementHidden, isKeyboardActive } from '@vaadin/a11
12
12
  import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
13
13
  import { microTask } from '@vaadin/component-base/src/async.js';
14
14
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
15
+ import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
15
16
  import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
16
17
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
17
18
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
@@ -404,13 +405,8 @@ export const MenuBarMixin = (superClass) =>
404
405
 
405
406
  /** @private */
406
407
  _themeChanged(theme) {
407
- if (theme) {
408
- this._overflow.setAttribute('theme', theme);
409
- this._subMenu.setAttribute('theme', theme);
410
- } else {
411
- this._overflow.removeAttribute('theme');
412
- this._subMenu.removeAttribute('theme');
413
- }
408
+ setOrRemoveAttribute(this._overflow, 'theme', theme);
409
+ setOrRemoveAttribute(this._subMenu, 'theme', theme);
414
410
  }
415
411
 
416
412
  /** @private */
@@ -445,11 +441,7 @@ export const MenuBarMixin = (superClass) =>
445
441
  /** @private */
446
442
  __i18nChanged(effectiveI18n) {
447
443
  if (effectiveI18n?.moreOptions !== undefined) {
448
- if (effectiveI18n.moreOptions) {
449
- this._overflow.setAttribute('aria-label', effectiveI18n.moreOptions);
450
- } else {
451
- this._overflow.removeAttribute('aria-label');
452
- }
444
+ setOrRemoveAttribute(this._overflow, 'aria-label', effectiveI18n.moreOptions);
453
445
  }
454
446
  }
455
447
 
@@ -16,11 +16,12 @@ import { menuBarOverlayStyles } from './styles/vaadin-menu-bar-overlay-base-styl
16
16
  /**
17
17
  * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
18
18
  *
19
+ * @attr {string} theme - The theme variants to apply to the component.
19
20
  * @customElement vaadin-menu-bar-overlay
20
21
  * @extends HTMLElement
21
22
  * @protected
22
23
  */
23
- export class MenuBarOverlay extends MenuOverlayMixin(
24
+ class MenuBarOverlay extends MenuOverlayMixin(
24
25
  OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
25
26
  ) {
26
27
  static get is() {
@@ -35,6 +36,25 @@ export class MenuBarOverlay extends MenuOverlayMixin(
35
36
  return { ...super.lumoInjector, includeBaseStyles: true };
36
37
  }
37
38
 
39
+ /**
40
+ * Override method from `MenuOverlayMixin` to prevent closing the menu on
41
+ * a click on the menu-bar button that opened it: the button is the
42
+ * `listenOn` target of the root sub-menu, and the menu-bar click handler
43
+ * closes the menu on that click.
44
+ *
45
+ * @param {Event} event
46
+ * @return {boolean}
47
+ * @protected
48
+ * @override
49
+ */
50
+ _shouldCloseOnOutsideClick(event) {
51
+ if (event.composedPath().includes(this.owner.listenOn)) {
52
+ return false;
53
+ }
54
+
55
+ return super._shouldCloseOnOutsideClick(event);
56
+ }
57
+
38
58
  /** @protected */
39
59
  render() {
40
60
  return html`
@@ -50,3 +70,5 @@ export class MenuBarOverlay extends MenuOverlayMixin(
50
70
  }
51
71
 
52
72
  defineCustomElement(MenuBarOverlay);
73
+
74
+ export { MenuBarOverlay };
@@ -16,6 +16,7 @@ import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-p
16
16
  /**
17
17
  * An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
18
18
  *
19
+ * @attr {string} theme - The theme variants to apply to the component.
19
20
  * @customElement vaadin-menu-bar-submenu
20
21
  * @extends HTMLElement
21
22
  * @protected
@@ -125,23 +126,6 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
125
126
  this.parentElement._close();
126
127
  }
127
128
  }
128
-
129
- /**
130
- * Override method from `ContextMenuMixin` to prevent closing
131
- * sub-menu on the same click event that was used to open it.
132
- *
133
- * @param {Event} event
134
- * @return {boolean}
135
- * @protected
136
- * @override
137
- */
138
- _shouldCloseOnOutsideClick(event) {
139
- if (this.hasAttribute('is-root') && event.composedPath().includes(this.listenOn)) {
140
- return false;
141
- }
142
-
143
- return super._shouldCloseOnOutsideClick(event);
144
- }
145
129
  }
146
130
 
147
131
  defineCustomElement(MenuBarSubmenu);
@@ -67,6 +67,7 @@ import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
67
67
  *
68
68
  * @fires {CustomEvent<boolean>} item-selected - Fired when a submenu item or menu bar button without children is clicked.
69
69
  *
70
+ * @attr {string} theme - The theme variants to apply to the component.
70
71
  * @customElement vaadin-menu-bar
71
72
  * @extends HTMLElement
72
73
  */
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.7",
4
+ "version": "25.3.0-alpha10",
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.7/#/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.7/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.7/#/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.7/#/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.7/#/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.3.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.3.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.3.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.3.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.3.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.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -51,9 +51,7 @@
51
51
  "description": "The theme variants to apply to the component.",
52
52
  "value": {
53
53
  "type": [
54
- "string",
55
- "null",
56
- "undefined"
54
+ "string"
57
55
  ]
58
56
  }
59
57
  }
@@ -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.7",
4
+ "version": "25.3.0-alpha10",
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.7/#/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.7/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.7/#/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.7/#/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.7/#/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.3.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.3.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.3.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.3.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.3.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.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {