@vaadin/menu-bar 24.8.0-alpha9 → 25.0.0-alpha2
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/README.md +0 -23
- package/package.json +16 -19
- package/src/vaadin-menu-bar-button.js +19 -16
- package/src/vaadin-menu-bar-item.js +17 -12
- package/src/vaadin-menu-bar-list-box.d.ts +1 -2
- package/src/vaadin-menu-bar-list-box.js +27 -23
- package/src/vaadin-menu-bar-mixin.d.ts +2 -5
- package/src/vaadin-menu-bar-mixin.js +143 -153
- package/src/vaadin-menu-bar-overlay.js +11 -9
- package/src/vaadin-menu-bar-submenu.js +18 -21
- package/src/vaadin-menu-bar.js +28 -24
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-menu-bar-button.js +0 -67
- package/src/vaadin-lit-menu-bar-item.js +0 -62
- package/src/vaadin-lit-menu-bar-list-box.js +0 -87
- package/src/vaadin-lit-menu-bar-overlay.js +0 -49
- package/src/vaadin-lit-menu-bar-submenu.js +0 -57
- package/src/vaadin-lit-menu-bar.js +0 -83
- package/theme/lumo/vaadin-lit-menu-bar.d.ts +0 -6
- package/theme/lumo/vaadin-lit-menu-bar.js +0 -6
- package/theme/material/vaadin-lit-menu-bar.d.ts +0 -6
- package/theme/material/vaadin-lit-menu-bar.js +0 -6
- package/theme/material/vaadin-menu-bar-button-styles.d.ts +0 -1
- package/theme/material/vaadin-menu-bar-button-styles.js +0 -111
- package/theme/material/vaadin-menu-bar-button.d.ts +0 -2
- package/theme/material/vaadin-menu-bar-button.js +0 -2
- package/theme/material/vaadin-menu-bar-item-styles.d.ts +0 -1
- package/theme/material/vaadin-menu-bar-item-styles.js +0 -23
- package/theme/material/vaadin-menu-bar-list-box-styles.d.ts +0 -1
- package/theme/material/vaadin-menu-bar-list-box-styles.js +0 -5
- package/theme/material/vaadin-menu-bar-overlay-styles.d.ts +0 -1
- package/theme/material/vaadin-menu-bar-overlay-styles.js +0 -13
- package/theme/material/vaadin-menu-bar-styles.d.ts +0 -1
- package/theme/material/vaadin-menu-bar-styles.js +0 -21
- package/theme/material/vaadin-menu-bar.d.ts +0 -6
- package/theme/material/vaadin-menu-bar.js +0 -6
- package/vaadin-lit-menu-bar.d.ts +0 -1
- package/vaadin-lit-menu-bar.js +0 -2
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": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
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/
|
|
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/25.0.0-alpha2/#/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/25.0.0-alpha2/#/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-alpha2/#/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-alpha2/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\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.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
|
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
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/
|
|
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/25.0.0-alpha2/#/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/25.0.0-alpha2/#/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-alpha2/#/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-alpha2/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\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.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { Button } from '@vaadin/button/src/vaadin-lit-button.js';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
12
|
-
*
|
|
13
|
-
* @customElement
|
|
14
|
-
* @extends Button
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
class MenuBarButton extends Button {
|
|
18
|
-
static get is() {
|
|
19
|
-
return 'vaadin-menu-bar-button';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static get styles() {
|
|
23
|
-
return [
|
|
24
|
-
super.styles,
|
|
25
|
-
css`
|
|
26
|
-
:host {
|
|
27
|
-
flex-shrink: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
:host([slot='overflow']) {
|
|
31
|
-
margin-inline-end: 0;
|
|
32
|
-
}
|
|
33
|
-
`,
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Override method inherited from `ButtonMixin` to set a flag based on whether the key
|
|
39
|
-
* is Enter and Space. Unlike mouse click, these keys should also focus the first item.
|
|
40
|
-
* This flag is used in menu bar to identify the action that triggered the click.
|
|
41
|
-
*
|
|
42
|
-
* @param {KeyboardEvent} event
|
|
43
|
-
* @protected
|
|
44
|
-
* @override
|
|
45
|
-
*/
|
|
46
|
-
_onKeyDown(event) {
|
|
47
|
-
this.__triggeredWithActiveKeys = this._activeKeys.includes(event.key);
|
|
48
|
-
super._onKeyDown(event);
|
|
49
|
-
this.__triggeredWithActiveKeys = null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Override method inherited from `ButtonMixin` to allow keyboard navigation with
|
|
54
|
-
* arrow keys in the menu bar when the button is focusable in the disabled state.
|
|
55
|
-
*
|
|
56
|
-
* @override
|
|
57
|
-
*/
|
|
58
|
-
__shouldSuppressInteractionEvent(event) {
|
|
59
|
-
if (event.type === 'keydown' && ['ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return super.__shouldSuppressInteractionEvent(event);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
defineCustomElement(MenuBarButton);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { css, html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
15
|
-
*
|
|
16
|
-
* @customElement
|
|
17
|
-
* @extends HTMLElement
|
|
18
|
-
* @mixes DirMixin
|
|
19
|
-
* @mixes ItemMixin
|
|
20
|
-
* @mixes ThemableMixin
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
class MenuBarItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-menu-bar-item';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return css`
|
|
30
|
-
:host {
|
|
31
|
-
display: inline-block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([hidden]) {
|
|
35
|
-
display: none !important;
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** @protected */
|
|
41
|
-
render() {
|
|
42
|
-
return html`
|
|
43
|
-
<span part="checkmark" aria-hidden="true"></span>
|
|
44
|
-
<div part="content">
|
|
45
|
-
<slot></slot>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** @protected */
|
|
51
|
-
connectedCallback() {
|
|
52
|
-
super.connectedCallback();
|
|
53
|
-
|
|
54
|
-
// Set role in `connectedCallback()` instead of `ready()`
|
|
55
|
-
// because the role is removed when teleporting to button.
|
|
56
|
-
this.setAttribute('role', 'menuitem');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
defineCustomElement(MenuBarItem);
|
|
61
|
-
|
|
62
|
-
export { MenuBarItem };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { css, html, LitElement } from 'lit';
|
|
7
|
-
import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
15
|
-
*
|
|
16
|
-
* @customElement
|
|
17
|
-
* @extends HTMLElement
|
|
18
|
-
* @mixes DirMixin
|
|
19
|
-
* @mixes ListMixin
|
|
20
|
-
* @mixes ThemableMixin
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
class MenuBarListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-menu-bar-list-box';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return css`
|
|
30
|
-
:host {
|
|
31
|
-
display: flex;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([hidden]) {
|
|
35
|
-
display: none !important;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[part='items'] {
|
|
39
|
-
height: 100%;
|
|
40
|
-
width: 100%;
|
|
41
|
-
overflow-y: auto;
|
|
42
|
-
-webkit-overflow-scrolling: touch;
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static get properties() {
|
|
48
|
-
return {
|
|
49
|
-
// We don't need to define this property since super default is vertical,
|
|
50
|
-
// but we don't want it to be modified, or be shown in the API docs.
|
|
51
|
-
/** @private */
|
|
52
|
-
orientation: {
|
|
53
|
-
type: String,
|
|
54
|
-
readOnly: true,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @return {!HTMLElement}
|
|
61
|
-
* @protected
|
|
62
|
-
* @override
|
|
63
|
-
*/
|
|
64
|
-
get _scrollerElement() {
|
|
65
|
-
return this.shadowRoot.querySelector('[part="items"]');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** @protected */
|
|
69
|
-
render() {
|
|
70
|
-
return html`
|
|
71
|
-
<div part="items">
|
|
72
|
-
<slot></slot>
|
|
73
|
-
</div>
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** @protected */
|
|
78
|
-
ready() {
|
|
79
|
-
super.ready();
|
|
80
|
-
|
|
81
|
-
this.setAttribute('role', 'menu');
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
defineCustomElement(MenuBarListBox);
|
|
86
|
-
|
|
87
|
-
export { MenuBarListBox };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { MenuOverlayMixin } from '@vaadin/context-menu/src/vaadin-menu-overlay-mixin.js';
|
|
11
|
-
import { styles } from '@vaadin/context-menu/src/vaadin-menu-overlay-styles.js';
|
|
12
|
-
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
13
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
14
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
18
|
-
*
|
|
19
|
-
* @customElement
|
|
20
|
-
* @extends HTMLElement
|
|
21
|
-
* @mixes DirMixin
|
|
22
|
-
* @mixes MenuOverlayMixin
|
|
23
|
-
* @mixes OverlayMixin
|
|
24
|
-
* @mixes ThemableMixin
|
|
25
|
-
* @protected
|
|
26
|
-
*/
|
|
27
|
-
export class MenuBarOverlay extends MenuOverlayMixin(OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement))))) {
|
|
28
|
-
static get is() {
|
|
29
|
-
return 'vaadin-menu-bar-overlay';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static get styles() {
|
|
33
|
-
return [overlayStyles, styles];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** @protected */
|
|
37
|
-
render() {
|
|
38
|
-
return html`
|
|
39
|
-
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
40
|
-
<div part="overlay" id="overlay" tabindex="0">
|
|
41
|
-
<div part="content" id="content">
|
|
42
|
-
<slot></slot>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
defineCustomElement(MenuBarOverlay);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-menu-bar-item.js';
|
|
7
|
-
import './vaadin-lit-menu-bar-list-box.js';
|
|
8
|
-
import './vaadin-lit-menu-bar-overlay.js';
|
|
9
|
-
import { css, html, LitElement } from 'lit';
|
|
10
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
13
|
-
import { SubMenuMixin } from './vaadin-menu-bar-submenu-mixin.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
17
|
-
*
|
|
18
|
-
* @customElement
|
|
19
|
-
* @extends HTMLElement
|
|
20
|
-
* @mixes SubMenuMixin
|
|
21
|
-
* @mixes ThemePropertyMixin
|
|
22
|
-
* @protected
|
|
23
|
-
*/
|
|
24
|
-
class MenuBarSubmenu extends SubMenuMixin(ThemePropertyMixin(PolylitMixin(LitElement))) {
|
|
25
|
-
static get is() {
|
|
26
|
-
return 'vaadin-menu-bar-submenu';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return css`
|
|
31
|
-
:host {
|
|
32
|
-
display: block;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
:host([hidden]) {
|
|
36
|
-
display: none !important;
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @protected */
|
|
42
|
-
render() {
|
|
43
|
-
return html`<slot id="slot"></slot>`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @protected
|
|
48
|
-
* @override
|
|
49
|
-
*/
|
|
50
|
-
createRenderRoot() {
|
|
51
|
-
const root = super.createRenderRoot();
|
|
52
|
-
root.appendChild(this._overlayElement);
|
|
53
|
-
return root;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
defineCustomElement(MenuBarSubmenu);
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-menu-bar-submenu.js';
|
|
7
|
-
import './vaadin-lit-menu-bar-button.js';
|
|
8
|
-
import { css, html, LitElement } from 'lit';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
13
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
-
import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* LitElement based version of `<vaadin-menu-bar>` web component.
|
|
18
|
-
*
|
|
19
|
-
* ## Disclaimer
|
|
20
|
-
*
|
|
21
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
22
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
23
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
24
|
-
*/
|
|
25
|
-
class MenuBar extends MenuBarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-menu-bar';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return css`
|
|
32
|
-
:host {
|
|
33
|
-
display: block;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:host([hidden]) {
|
|
37
|
-
display: none !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[part='container'] {
|
|
41
|
-
position: relative;
|
|
42
|
-
display: flex;
|
|
43
|
-
width: 100%;
|
|
44
|
-
flex-wrap: nowrap;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** @protected */
|
|
51
|
-
render() {
|
|
52
|
-
return html`
|
|
53
|
-
<div part="container">
|
|
54
|
-
<slot></slot>
|
|
55
|
-
<slot name="overflow"></slot>
|
|
56
|
-
</div>
|
|
57
|
-
<vaadin-menu-bar-submenu is-root .overlayClass="${this.overlayClass}"></vaadin-menu-bar-submenu>
|
|
58
|
-
|
|
59
|
-
<slot name="tooltip"></slot>
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** @protected */
|
|
64
|
-
ready() {
|
|
65
|
-
super.ready();
|
|
66
|
-
|
|
67
|
-
this._tooltipController = new TooltipController(this);
|
|
68
|
-
this._tooltipController.setManual(true);
|
|
69
|
-
this.addController(this._tooltipController);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Fired when either a submenu item or menu bar button without nested children is clicked.
|
|
74
|
-
*
|
|
75
|
-
* @event item-selected
|
|
76
|
-
* @param {Object} detail
|
|
77
|
-
* @param {Object} detail.value the selected menu bar item
|
|
78
|
-
*/
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
defineCustomElement(MenuBar);
|
|
82
|
-
|
|
83
|
-
export { MenuBar };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import './vaadin-menu-bar-button-styles.js';
|
|
2
|
-
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
-
import './vaadin-menu-bar-list-box-styles.js';
|
|
4
|
-
import './vaadin-menu-bar-overlay-styles.js';
|
|
5
|
-
import './vaadin-menu-bar-styles.js';
|
|
6
|
-
import '../../src/vaadin-lit-menu-bar.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import './vaadin-menu-bar-button-styles.js';
|
|
2
|
-
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
-
import './vaadin-menu-bar-list-box-styles.js';
|
|
4
|
-
import './vaadin-menu-bar-overlay-styles.js';
|
|
5
|
-
import './vaadin-menu-bar-styles.js';
|
|
6
|
-
import '../../src/vaadin-lit-menu-bar.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import './vaadin-menu-bar-button-styles.js';
|
|
2
|
-
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
-
import './vaadin-menu-bar-list-box-styles.js';
|
|
4
|
-
import './vaadin-menu-bar-overlay-styles.js';
|
|
5
|
-
import './vaadin-menu-bar-styles.js';
|
|
6
|
-
import '../../src/vaadin-lit-menu-bar.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import './vaadin-menu-bar-button-styles.js';
|
|
2
|
-
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
-
import './vaadin-menu-bar-list-box-styles.js';
|
|
4
|
-
import './vaadin-menu-bar-overlay-styles.js';
|
|
5
|
-
import './vaadin-menu-bar-styles.js';
|
|
6
|
-
import '../../src/vaadin-lit-menu-bar.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { button } from '@vaadin/button/theme/material/vaadin-button-styles';
|
|
2
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
|
-
|
|
4
|
-
const menuBarButton = css`
|
|
5
|
-
[part='label'] {
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
[part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
10
|
-
line-height: 20px;
|
|
11
|
-
background-color: transparent;
|
|
12
|
-
margin: -8px;
|
|
13
|
-
padding: 8px;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:host([theme~='outlined']),
|
|
18
|
-
:host([theme~='contained']) {
|
|
19
|
-
border-radius: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
:host([theme~='contained']) ::slotted(vaadin-menu-bar-item),
|
|
23
|
-
:host([theme~='outlined']) ::slotted(vaadin-menu-bar-item) {
|
|
24
|
-
margin: -8px -16px;
|
|
25
|
-
padding: 8px 16px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:host([expanded])::before {
|
|
29
|
-
opacity: 0.08;
|
|
30
|
-
transition: opacity 0.4s;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:host([expanded])::after {
|
|
34
|
-
transform: translate(-50%, -50%) scale(0.0000001); /* animation works weirdly with scale(0) */
|
|
35
|
-
opacity: 0.1;
|
|
36
|
-
transition: 0s;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:host([theme~='contained'][expanded]) {
|
|
40
|
-
box-shadow: var(--material-shadow-elevation-8dp);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host(:hover:not([expanded]))::after {
|
|
44
|
-
transform: translate(-50%, -50%) scale(1);
|
|
45
|
-
opacity: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([theme~='contained']:not([dir='rtl'])) {
|
|
49
|
-
margin-right: 1px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([first-visible]) {
|
|
53
|
-
border-radius: 4px 0 0 4px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
:host([last-visible]),
|
|
57
|
-
:host([slot='overflow']) {
|
|
58
|
-
border-radius: 0 4px 4px 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
:host([slot='overflow']) {
|
|
62
|
-
padding-right: 8px;
|
|
63
|
-
padding-left: 8px;
|
|
64
|
-
min-width: 36px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:host([slot='overflow']) ::slotted(*) {
|
|
68
|
-
font-size: 24px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host([theme~='outlined']:not([dir='rtl'])) {
|
|
72
|
-
margin-right: -1px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
:host([theme~='outlined']:not([dir='rtl'])[last-visible]),
|
|
76
|
-
:host([theme~='outlined']:not([dir='rtl'])[slot='overflow']) {
|
|
77
|
-
margin-right: 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:host([theme~='text']),
|
|
81
|
-
:host(:not([theme])) {
|
|
82
|
-
border-radius: 4px;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/* RTL styles */
|
|
86
|
-
:host([dir='rtl'][first-visible]) {
|
|
87
|
-
border-radius: 0 4px 4px 0;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:host([dir='rtl'][last-visible]),
|
|
91
|
-
:host([dir='rtl'][slot='overflow']) {
|
|
92
|
-
border-radius: 4px 0 0 4px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([dir='rtl'][theme~='contained']) {
|
|
96
|
-
margin-left: 1px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
:host([dir='rtl'][theme~='outlined']) {
|
|
100
|
-
margin-left: -1px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
:host([theme~='outlined'][dir='rtl'][last-visible]),
|
|
104
|
-
:host([theme~='outlined'][dir='rtl'][slot='overflow']) {
|
|
105
|
-
margin-left: 0;
|
|
106
|
-
}
|
|
107
|
-
`;
|
|
108
|
-
|
|
109
|
-
registerStyles('vaadin-menu-bar-button', [button, menuBarButton], {
|
|
110
|
-
moduleId: 'material-menu-bar-button',
|
|
111
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
2
|
-
import { contextMenuItem } from '@vaadin/context-menu/theme/material/vaadin-context-menu-item-styles.js';
|
|
3
|
-
import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
const menuBarItem = css`
|
|
7
|
-
[part='content'] {
|
|
8
|
-
display: flex;
|
|
9
|
-
/* tweak to inherit centering from menu bar button */
|
|
10
|
-
align-items: inherit;
|
|
11
|
-
justify-content: inherit;
|
|
12
|
-
font-size: var(--material-button-font-size);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
16
|
-
display: inline-block;
|
|
17
|
-
width: 18px;
|
|
18
|
-
height: 18px;
|
|
19
|
-
box-sizing: border-box !important;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
registerStyles('vaadin-menu-bar-item', [item, contextMenuItem, menuBarItem], { moduleId: 'material-menu-bar-item' });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { contextMenuListBox } from '@vaadin/context-menu/theme/material/vaadin-context-menu-list-box-styles.js';
|
|
2
|
-
import { listBox } from '@vaadin/list-box/theme/material/vaadin-list-box-styles.js';
|
|
3
|
-
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
registerStyles('vaadin-menu-bar-list-box', [listBox, contextMenuListBox], { moduleId: 'material-menu-bar-list-box' });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { contextMenuOverlay } from '@vaadin/context-menu/theme/material/vaadin-context-menu-overlay-styles.js';
|
|
2
|
-
import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
const menuBarOverlay = css`
|
|
6
|
-
:host(:first-of-type) {
|
|
7
|
-
padding-top: 5px;
|
|
8
|
-
}
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
registerStyles('vaadin-menu-bar-overlay', [menuOverlay, contextMenuOverlay, menuBarOverlay], {
|
|
12
|
-
moduleId: 'material-menu-bar-overlay',
|
|
13
|
-
});
|