@vaadin/menu-bar 24.3.2 → 24.4.0-dev.223e39f050
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 +13 -13
- package/src/vaadin-menu-bar-submenu.js +24 -4
- package/web-types.json +0 -123
- package/web-types.lit.json +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/menu-bar",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.4.0-dev.223e39f050",
|
|
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": "
|
|
41
|
-
"@vaadin/button": "
|
|
42
|
-
"@vaadin/component-base": "
|
|
43
|
-
"@vaadin/context-menu": "
|
|
44
|
-
"@vaadin/item": "
|
|
45
|
-
"@vaadin/list-box": "
|
|
46
|
-
"@vaadin/overlay": "
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
48
|
-
"@vaadin/vaadin-material-styles": "
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
40
|
+
"@vaadin/a11y-base": "24.4.0-dev.223e39f050",
|
|
41
|
+
"@vaadin/button": "24.4.0-dev.223e39f050",
|
|
42
|
+
"@vaadin/component-base": "24.4.0-dev.223e39f050",
|
|
43
|
+
"@vaadin/context-menu": "24.4.0-dev.223e39f050",
|
|
44
|
+
"@vaadin/item": "24.4.0-dev.223e39f050",
|
|
45
|
+
"@vaadin/list-box": "24.4.0-dev.223e39f050",
|
|
46
|
+
"@vaadin/overlay": "24.4.0-dev.223e39f050",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-dev.223e39f050",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "24.4.0-dev.223e39f050",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-dev.223e39f050"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@esm-bundle/chai": "^4.3.4",
|
|
53
|
-
"@vaadin/icon": "
|
|
53
|
+
"@vaadin/icon": "24.4.0-dev.223e39f050",
|
|
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": "
|
|
61
|
+
"gitHead": "5e2e3bfc811c95aed9354235fab93fdbf43eb354"
|
|
62
62
|
}
|
|
@@ -6,18 +6,25 @@
|
|
|
6
6
|
import './vaadin-menu-bar-item.js';
|
|
7
7
|
import './vaadin-menu-bar-list-box.js';
|
|
8
8
|
import './vaadin-menu-bar-overlay.js';
|
|
9
|
-
import { html } from '@polymer/polymer/
|
|
9
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
10
11
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
|
-
import {
|
|
12
|
+
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
13
|
+
import { ContextMenuMixin } from '@vaadin/context-menu/src/vaadin-context-menu-mixin.js';
|
|
14
|
+
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
15
18
|
*
|
|
16
19
|
* @customElement
|
|
17
|
-
* @extends
|
|
20
|
+
* @extends HTMLElement
|
|
21
|
+
* @mixes ContextMenuMixin
|
|
22
|
+
* @mixes ControllerMixin
|
|
23
|
+
* @mixes OverlayClassMixin
|
|
24
|
+
* @mixes ThemePropertyMixin
|
|
18
25
|
* @protected
|
|
19
26
|
*/
|
|
20
|
-
class MenuBarSubmenu extends
|
|
27
|
+
class MenuBarSubmenu extends ContextMenuMixin(OverlayClassMixin(ControllerMixin(ThemePropertyMixin(PolymerElement)))) {
|
|
21
28
|
static get is() {
|
|
22
29
|
return 'vaadin-menu-bar-submenu';
|
|
23
30
|
}
|
|
@@ -53,6 +60,19 @@ class MenuBarSubmenu extends ContextMenu {
|
|
|
53
60
|
return 'vaadin-menu-bar';
|
|
54
61
|
}
|
|
55
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @param {DocumentFragment} dom
|
|
65
|
+
* @return {ShadowRoot}
|
|
66
|
+
* @protected
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
_attachDom(dom) {
|
|
70
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
71
|
+
root.appendChild(dom);
|
|
72
|
+
root.appendChild(this._overlayElement);
|
|
73
|
+
return root;
|
|
74
|
+
}
|
|
75
|
+
|
|
56
76
|
/**
|
|
57
77
|
* Overriding the observer to not add global "contextmenu" listener.
|
|
58
78
|
*/
|
package/web-types.json
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "24.3.2",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"contributions": {
|
|
7
|
-
"html": {
|
|
8
|
-
"elements": [
|
|
9
|
-
{
|
|
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.2/#/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.2/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.2/#/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.2/#/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.2/#/elements/vaadin-overlay).",
|
|
12
|
-
"attributes": [
|
|
13
|
-
{
|
|
14
|
-
"name": "disabled",
|
|
15
|
-
"description": "If true, the user cannot interact with this element.",
|
|
16
|
-
"value": {
|
|
17
|
-
"type": [
|
|
18
|
-
"boolean",
|
|
19
|
-
"null",
|
|
20
|
-
"undefined"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "overlay-class",
|
|
26
|
-
"description": "A space-delimited list of CSS class names\nto set on each sub-menu overlay element.",
|
|
27
|
-
"value": {
|
|
28
|
-
"type": [
|
|
29
|
-
"string",
|
|
30
|
-
"null",
|
|
31
|
-
"undefined"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "open-on-hover",
|
|
37
|
-
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
38
|
-
"value": {
|
|
39
|
-
"type": [
|
|
40
|
-
"boolean",
|
|
41
|
-
"null",
|
|
42
|
-
"undefined"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"name": "theme",
|
|
48
|
-
"description": "The theme variants to apply to the component.",
|
|
49
|
-
"value": {
|
|
50
|
-
"type": [
|
|
51
|
-
"string",
|
|
52
|
-
"null",
|
|
53
|
-
"undefined"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"js": {
|
|
59
|
-
"properties": [
|
|
60
|
-
{
|
|
61
|
-
"name": "disabled",
|
|
62
|
-
"description": "If true, the user cannot interact with this element.",
|
|
63
|
-
"value": {
|
|
64
|
-
"type": [
|
|
65
|
-
"boolean",
|
|
66
|
-
"null",
|
|
67
|
-
"undefined"
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"name": "items",
|
|
73
|
-
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```",
|
|
74
|
-
"value": {
|
|
75
|
-
"type": [
|
|
76
|
-
"Array.<MenuBarItem>"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"name": "i18n",
|
|
82
|
-
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nTo update individual properties, extend the existing i18n object like so:\n```\nmenuBar.i18n = {\n ...menuBar.i18n,\n moreOptions: 'More options'\n}\n```\n\nThe object has the following JSON structure and default values:\n```\n{\n moreOptions: 'More options'\n}\n```",
|
|
83
|
-
"value": {
|
|
84
|
-
"type": [
|
|
85
|
-
"MenuBarI18n"
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "overlayClass",
|
|
91
|
-
"description": "A space-delimited list of CSS class names\nto set on each sub-menu overlay element.",
|
|
92
|
-
"value": {
|
|
93
|
-
"type": [
|
|
94
|
-
"string",
|
|
95
|
-
"null",
|
|
96
|
-
"undefined"
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"name": "openOnHover",
|
|
102
|
-
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
103
|
-
"value": {
|
|
104
|
-
"type": [
|
|
105
|
-
"boolean",
|
|
106
|
-
"null",
|
|
107
|
-
"undefined"
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"events": [
|
|
113
|
-
{
|
|
114
|
-
"name": "item-selected",
|
|
115
|
-
"description": "Fired when either a submenu item or menu bar button without nested children is clicked."
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
package/web-types.lit.json
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "24.3.2",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"framework": "lit",
|
|
7
|
-
"framework-config": {
|
|
8
|
-
"enable-when": {
|
|
9
|
-
"node-packages": [
|
|
10
|
-
"lit"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"contributions": {
|
|
15
|
-
"html": {
|
|
16
|
-
"elements": [
|
|
17
|
-
{
|
|
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.2/#/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.2/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.3.2/#/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.2/#/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.2/#/elements/vaadin-overlay).",
|
|
20
|
-
"extension": true,
|
|
21
|
-
"attributes": [
|
|
22
|
-
{
|
|
23
|
-
"name": "?disabled",
|
|
24
|
-
"description": "If true, the user cannot interact with this element.",
|
|
25
|
-
"value": {
|
|
26
|
-
"kind": "expression"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "?openOnHover",
|
|
31
|
-
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
32
|
-
"value": {
|
|
33
|
-
"kind": "expression"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": ".items",
|
|
38
|
-
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```",
|
|
39
|
-
"value": {
|
|
40
|
-
"kind": "expression"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": ".i18n",
|
|
45
|
-
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nTo update individual properties, extend the existing i18n object like so:\n```\nmenuBar.i18n = {\n ...menuBar.i18n,\n moreOptions: 'More options'\n}\n```\n\nThe object has the following JSON structure and default values:\n```\n{\n moreOptions: 'More options'\n}\n```",
|
|
46
|
-
"value": {
|
|
47
|
-
"kind": "expression"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": ".overlayClass",
|
|
52
|
-
"description": "A space-delimited list of CSS class names\nto set on each sub-menu overlay element.",
|
|
53
|
-
"value": {
|
|
54
|
-
"kind": "expression"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "@item-selected",
|
|
59
|
-
"description": "Fired when either a submenu item or menu bar button without nested children is clicked.",
|
|
60
|
-
"value": {
|
|
61
|
-
"kind": "expression"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|