@vaadin/menu-bar 25.0.0-alpha17 → 25.0.0-alpha18
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 +14 -14
- package/src/vaadin-menu-bar-mixin.js +9 -6
- package/src/vaadin-menu-bar-submenu.js +12 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/menu-bar",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha18",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
37
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
38
|
-
"@vaadin/button": "25.0.0-
|
|
39
|
-
"@vaadin/component-base": "25.0.0-
|
|
40
|
-
"@vaadin/context-menu": "25.0.0-
|
|
41
|
-
"@vaadin/item": "25.0.0-
|
|
42
|
-
"@vaadin/list-box": "25.0.0-
|
|
43
|
-
"@vaadin/overlay": "25.0.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha18",
|
|
38
|
+
"@vaadin/button": "25.0.0-alpha18",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha18",
|
|
40
|
+
"@vaadin/context-menu": "25.0.0-alpha18",
|
|
41
|
+
"@vaadin/item": "25.0.0-alpha18",
|
|
42
|
+
"@vaadin/list-box": "25.0.0-alpha18",
|
|
43
|
+
"@vaadin/overlay": "25.0.0-alpha18",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha18",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
49
|
-
"@vaadin/icon": "25.0.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
48
|
+
"@vaadin/chai-plugins": "25.0.0-alpha18",
|
|
49
|
+
"@vaadin/icon": "25.0.0-alpha18",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha18",
|
|
51
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha18",
|
|
53
53
|
"sinon": "^21.0.0"
|
|
54
54
|
},
|
|
55
55
|
"web-types": [
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "cb5cafb5687a117ebead1b81e2116991cec13abe"
|
|
60
60
|
}
|
|
@@ -414,7 +414,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
414
414
|
__updateSubMenu() {
|
|
415
415
|
const subMenu = this._subMenu;
|
|
416
416
|
if (subMenu && subMenu.opened) {
|
|
417
|
-
const button = subMenu.
|
|
417
|
+
const button = subMenu._positionTarget;
|
|
418
418
|
|
|
419
419
|
// Close sub-menu if the corresponding button is no longer in the DOM,
|
|
420
420
|
// or if the item on it has been changed to no longer have children.
|
|
@@ -698,17 +698,18 @@ export const MenuBarMixin = (superClass) =>
|
|
|
698
698
|
* and open another one for the newly focused button.
|
|
699
699
|
*
|
|
700
700
|
* @param {Element} item
|
|
701
|
+
* @param {FocusOptions=} options
|
|
701
702
|
* @param {boolean} navigating
|
|
702
703
|
* @protected
|
|
703
704
|
* @override
|
|
704
705
|
*/
|
|
705
|
-
_focusItem(item, navigating) {
|
|
706
|
+
_focusItem(item, options, navigating) {
|
|
706
707
|
const wasExpanded = navigating && this.focused === this._expandedButton;
|
|
707
708
|
if (wasExpanded) {
|
|
708
709
|
this._close();
|
|
709
710
|
}
|
|
710
711
|
|
|
711
|
-
super._focusItem(item, navigating);
|
|
712
|
+
super._focusItem(item, options, navigating);
|
|
712
713
|
|
|
713
714
|
this._buttons.forEach((btn) => {
|
|
714
715
|
this._setTabindex(btn, btn === item);
|
|
@@ -949,6 +950,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
949
950
|
|
|
950
951
|
subMenu.items = items;
|
|
951
952
|
subMenu.listenOn = button;
|
|
953
|
+
subMenu._positionTarget = button;
|
|
952
954
|
const overlay = subMenu._overlayElement;
|
|
953
955
|
overlay.noVerticalOverlap = true;
|
|
954
956
|
|
|
@@ -958,7 +960,6 @@ export const MenuBarMixin = (superClass) =>
|
|
|
958
960
|
this._setExpanded(button, true);
|
|
959
961
|
|
|
960
962
|
this.style.pointerEvents = 'auto';
|
|
961
|
-
overlay.positionTarget = button;
|
|
962
963
|
|
|
963
964
|
button.dispatchEvent(
|
|
964
965
|
new CustomEvent('opensubmenu', {
|
|
@@ -976,7 +977,8 @@ export const MenuBarMixin = (superClass) =>
|
|
|
976
977
|
}
|
|
977
978
|
|
|
978
979
|
if (options.keepFocus) {
|
|
979
|
-
|
|
980
|
+
const focusOptions = { focusVisible: isKeyboardActive() };
|
|
981
|
+
this._focusItem(this._expandedButton, focusOptions, false);
|
|
980
982
|
}
|
|
981
983
|
|
|
982
984
|
// Do not focus item when open not from keyboard
|
|
@@ -1020,7 +1022,8 @@ export const MenuBarMixin = (superClass) =>
|
|
|
1020
1022
|
if (button && button.hasAttribute('expanded')) {
|
|
1021
1023
|
this._setExpanded(button, false);
|
|
1022
1024
|
if (restoreFocus) {
|
|
1023
|
-
|
|
1025
|
+
const focusOptions = { focusVisible: isKeyboardActive() };
|
|
1026
|
+
this._focusItem(button, focusOptions, false);
|
|
1024
1027
|
}
|
|
1025
1028
|
this._expandedButton = null;
|
|
1026
1029
|
}
|
|
@@ -39,6 +39,16 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
|
|
|
39
39
|
`;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
static get properties() {
|
|
43
|
+
return {
|
|
44
|
+
isRoot: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
reflectToAttribute: true,
|
|
47
|
+
sync: true,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
constructor() {
|
|
43
53
|
super();
|
|
44
54
|
|
|
@@ -65,6 +75,8 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
|
|
|
65
75
|
.modeless="${this._modeless}"
|
|
66
76
|
.renderer="${this.__itemsRenderer}"
|
|
67
77
|
.withBackdrop="${this._phone}"
|
|
78
|
+
.positionTarget="${this._positionTarget}"
|
|
79
|
+
?no-horizontal-overlap="${!this.isRoot}"
|
|
68
80
|
?phone="${this._phone}"
|
|
69
81
|
theme="${ifDefined(this._theme)}"
|
|
70
82
|
exportparts="backdrop, overlay, content"
|
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.0.0-
|
|
4
|
+
"version": "25.0.0-alpha18",
|
|
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.0.0-
|
|
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.0.0-alpha18/#/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.0.0-alpha18/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha18/#/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.0.0-alpha18/#/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.0.0-alpha18/#/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",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha18",
|
|
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.0.0-
|
|
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.0.0-alpha18/#/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.0.0-alpha18/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha18/#/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.0.0-alpha18/#/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.0.0-alpha18/#/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
|
{
|