@vaadin/menu-bar 24.0.0-alpha8 → 24.0.0-beta1
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 +10 -10
- package/src/vaadin-menu-bar-button.js +1 -1
- package/src/vaadin-menu-bar-item.d.ts +21 -0
- package/src/vaadin-menu-bar-item.js +55 -0
- package/src/vaadin-menu-bar-list-box.d.ts +22 -0
- package/src/vaadin-menu-bar-list-box.js +81 -0
- package/src/{vaadin-menu-bar-interactions-mixin.d.ts → vaadin-menu-bar-mixin.d.ts} +16 -4
- package/src/{vaadin-menu-bar-interactions-mixin.js → vaadin-menu-bar-mixin.js} +322 -30
- package/src/vaadin-menu-bar-overlay.d.ts +20 -0
- package/src/vaadin-menu-bar-overlay.js +26 -0
- package/src/vaadin-menu-bar-submenu.js +39 -0
- package/src/vaadin-menu-bar.d.ts +14 -7
- package/src/vaadin-menu-bar.js +22 -14
- package/theme/lumo/vaadin-menu-bar-button-styles.js +4 -4
- package/theme/lumo/vaadin-menu-bar-item-styles.js +21 -21
- package/theme/lumo/vaadin-menu-bar-list-box-styles.js +5 -0
- package/theme/lumo/vaadin-menu-bar-overlay-styles.js +11 -9
- package/theme/lumo/vaadin-menu-bar.js +2 -1
- package/theme/material/vaadin-menu-bar-button-styles.js +3 -3
- package/theme/material/vaadin-menu-bar-item-styles.js +19 -19
- package/theme/material/vaadin-menu-bar-list-box-styles.js +5 -0
- package/theme/material/vaadin-menu-bar-overlay-styles.js +11 -9
- package/theme/material/vaadin-menu-bar.js +2 -1
- package/web-types.json +31 -9
- package/web-types.lit.json +13 -6
- package/src/vaadin-menu-bar-buttons-mixin.d.ts +0 -22
- package/src/vaadin-menu-bar-buttons-mixin.js +0 -315
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { MenuOverlayMixin } from '@vaadin/context-menu/src/vaadin-menu-overlay-mixin.js';
|
|
7
|
+
import { styles } from '@vaadin/context-menu/src/vaadin-menu-overlay-styles.js';
|
|
8
|
+
import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
|
|
9
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
|
|
11
|
+
registerStyles('vaadin-menu-bar-overlay', styles, { moduleId: 'vaadin-menu-bar-overlay-styles' });
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An element used internally by `<vaadin-menu-bar>`. Not intended to be used separately.
|
|
15
|
+
*
|
|
16
|
+
* @extends Overlay
|
|
17
|
+
* @mixes MenuOverlayMixin
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
class MenuBarOverlay extends MenuOverlayMixin(Overlay) {
|
|
21
|
+
static get is() {
|
|
22
|
+
return 'vaadin-menu-bar-overlay';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
customElements.define(MenuBarOverlay.is, MenuBarOverlay);
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import './vaadin-menu-bar-item.js';
|
|
7
|
+
import './vaadin-menu-bar-list-box.js';
|
|
8
|
+
import './vaadin-menu-bar-overlay.js';
|
|
9
|
+
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
|
6
10
|
import { ContextMenu } from '@vaadin/context-menu/src/vaadin-context-menu.js';
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -16,12 +20,47 @@ class MenuBarSubmenu extends ContextMenu {
|
|
|
16
20
|
return 'vaadin-menu-bar-submenu';
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
static get template() {
|
|
24
|
+
return html`
|
|
25
|
+
<style>
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([hidden]) {
|
|
31
|
+
display: none !important;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
|
|
35
|
+
<slot id="slot"></slot>
|
|
36
|
+
|
|
37
|
+
<vaadin-menu-bar-overlay
|
|
38
|
+
id="overlay"
|
|
39
|
+
on-opened-changed="_onOverlayOpened"
|
|
40
|
+
on-vaadin-overlay-open="_onVaadinOverlayOpen"
|
|
41
|
+
with-backdrop="[[_phone]]"
|
|
42
|
+
phone$="[[_phone]]"
|
|
43
|
+
model="[[_context]]"
|
|
44
|
+
theme$="[[_theme]]"
|
|
45
|
+
></vaadin-menu-bar-overlay>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
19
49
|
constructor() {
|
|
20
50
|
super();
|
|
21
51
|
|
|
22
52
|
this.openOn = 'opensubmenu';
|
|
23
53
|
}
|
|
24
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Tag name prefix used by overlay, list-box and items.
|
|
57
|
+
* @protected
|
|
58
|
+
* @return {string}
|
|
59
|
+
*/
|
|
60
|
+
get _tagNamePrefix() {
|
|
61
|
+
return 'vaadin-menu-bar';
|
|
62
|
+
}
|
|
63
|
+
|
|
25
64
|
/**
|
|
26
65
|
* Overriding the observer to not add global "contextmenu" listener.
|
|
27
66
|
*/
|
package/src/vaadin-menu-bar.d.ts
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
import {
|
|
10
|
-
import { InteractionsMixin } from './vaadin-menu-bar-interactions-mixin.js';
|
|
9
|
+
import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
|
|
11
10
|
|
|
12
11
|
export interface MenuBarItem {
|
|
13
12
|
/**
|
|
@@ -21,7 +20,7 @@ export interface MenuBarItem {
|
|
|
21
20
|
tooltip?: string;
|
|
22
21
|
/**
|
|
23
22
|
* The component to represent the button content.
|
|
24
|
-
* Either a tagName or an element instance. Defaults to "vaadin-
|
|
23
|
+
* Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
|
|
25
24
|
*/
|
|
26
25
|
component?: HTMLElement | string;
|
|
27
26
|
/**
|
|
@@ -102,13 +101,13 @@ export interface MenuBarEventMap extends HTMLElementEventMap, MenuBarCustomEvent
|
|
|
102
101
|
* components are themable:
|
|
103
102
|
*
|
|
104
103
|
* - `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
|
|
105
|
-
* - `<vaadin-
|
|
106
|
-
* - `<vaadin-
|
|
107
|
-
* - `<vaadin-
|
|
104
|
+
* - `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
|
|
105
|
+
* - `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
|
|
106
|
+
* - `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
|
|
108
107
|
*
|
|
109
108
|
* @fires {CustomEvent} item-selected - Fired when a submenu item or menu bar button without children is clicked.
|
|
110
109
|
*/
|
|
111
|
-
declare class MenuBar extends
|
|
110
|
+
declare class MenuBar extends MenuBarMixin(DisabledMixin(ElementMixin(ThemableMixin(HTMLElement)))) {
|
|
112
111
|
/**
|
|
113
112
|
* Defines a hierarchical structure, where root level items represent menu bar buttons,
|
|
114
113
|
* and `children` property configures a submenu with items to be opened below
|
|
@@ -161,6 +160,14 @@ declare class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(Eleme
|
|
|
161
160
|
*/
|
|
162
161
|
i18n: MenuBarI18n;
|
|
163
162
|
|
|
163
|
+
/**
|
|
164
|
+
* A space-delimited list of CSS class names
|
|
165
|
+
* to set on each sub-menu overlay element.
|
|
166
|
+
*
|
|
167
|
+
* @attr {string} overlay-class
|
|
168
|
+
*/
|
|
169
|
+
overlayClass: string;
|
|
170
|
+
|
|
164
171
|
addEventListener<K extends keyof MenuBarEventMap>(
|
|
165
172
|
type: K,
|
|
166
173
|
listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void,
|
package/src/vaadin-menu-bar.js
CHANGED
|
@@ -10,8 +10,7 @@ import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
11
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import {
|
|
14
|
-
import { InteractionsMixin } from './vaadin-menu-bar-interactions-mixin.js';
|
|
13
|
+
import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* `<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering
|
|
@@ -53,20 +52,19 @@ import { InteractionsMixin } from './vaadin-menu-bar-interactions-mixin.js';
|
|
|
53
52
|
* components are themable:
|
|
54
53
|
*
|
|
55
54
|
* - `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
|
|
56
|
-
* - `<vaadin-
|
|
57
|
-
* - `<vaadin-
|
|
58
|
-
* - `<vaadin-
|
|
55
|
+
* - `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
|
|
56
|
+
* - `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
|
|
57
|
+
* - `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
|
|
59
58
|
*
|
|
60
59
|
* @fires {CustomEvent<boolean>} item-selected - Fired when a submenu item or menu bar button without children is clicked.
|
|
61
60
|
*
|
|
62
61
|
* @extends HTMLElement
|
|
63
|
-
* @mixes ButtonsMixin
|
|
64
|
-
* @mixes InteractionsMixin
|
|
65
62
|
* @mixes DisabledMixin
|
|
66
63
|
* @mixes ElementMixin
|
|
64
|
+
* @mixes MenuBarMixin
|
|
67
65
|
* @mixes ThemableMixin
|
|
68
66
|
*/
|
|
69
|
-
class MenuBar extends
|
|
67
|
+
class MenuBar extends MenuBarMixin(DisabledMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
|
|
70
68
|
static get template() {
|
|
71
69
|
return html`
|
|
72
70
|
<style>
|
|
@@ -91,7 +89,7 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
|
|
|
91
89
|
<slot></slot>
|
|
92
90
|
<slot name="overflow"></slot>
|
|
93
91
|
</div>
|
|
94
|
-
<vaadin-menu-bar-submenu is-root=""></vaadin-menu-bar-submenu>
|
|
92
|
+
<vaadin-menu-bar-submenu is-root overlay-class="[[overlayClass]]"></vaadin-menu-bar-submenu>
|
|
95
93
|
|
|
96
94
|
<slot name="tooltip"></slot>
|
|
97
95
|
`;
|
|
@@ -110,7 +108,7 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
|
|
|
110
108
|
* @property {string} tooltip - Text to be set as the menu button's tooltip.
|
|
111
109
|
* Requires a `<vaadin-tooltip slot="tooltip">` element to be added inside the `<vaadin-menu-bar>`.
|
|
112
110
|
* @property {union: string | object} component - The component to represent the button content.
|
|
113
|
-
* Either a tagName or an element instance. Defaults to "vaadin-
|
|
111
|
+
* Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
|
|
114
112
|
* @property {boolean} disabled - If true, the button is disabled and cannot be activated.
|
|
115
113
|
* @property {union: string | string[]} theme - Theme(s) to be set as the theme attribute of the button, overriding any theme set on the menu bar.
|
|
116
114
|
* @property {SubMenuItem[]} children - Array of submenu items.
|
|
@@ -121,7 +119,7 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
|
|
|
121
119
|
* @type {object}
|
|
122
120
|
* @property {string} text - Text to be set as the menu item component's textContent.
|
|
123
121
|
* @property {union: string | object} component - The component to represent the item.
|
|
124
|
-
* Either a tagName or an element instance. Defaults to "vaadin-
|
|
122
|
+
* Either a tagName or an element instance. Defaults to "vaadin-menu-bar-item".
|
|
125
123
|
* @property {boolean} disabled - If true, the item is disabled and cannot be selected.
|
|
126
124
|
* @property {boolean} checked - If true, the item shows a checkmark next to it.
|
|
127
125
|
* @property {SubMenuItem[]} children - Array of child submenu items.
|
|
@@ -193,11 +191,21 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
|
|
|
193
191
|
};
|
|
194
192
|
},
|
|
195
193
|
},
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A space-delimited list of CSS class names
|
|
197
|
+
* to set on each sub-menu overlay element.
|
|
198
|
+
*
|
|
199
|
+
* @attr {string} overlay-class
|
|
200
|
+
*/
|
|
201
|
+
overlayClass: {
|
|
202
|
+
type: String,
|
|
203
|
+
},
|
|
196
204
|
};
|
|
197
205
|
}
|
|
198
206
|
|
|
199
207
|
static get observers() {
|
|
200
|
-
return ['_themeChanged(_theme, _overflow)'];
|
|
208
|
+
return ['_themeChanged(_theme, _overflow, _container)'];
|
|
201
209
|
}
|
|
202
210
|
|
|
203
211
|
/** @protected */
|
|
@@ -233,8 +241,8 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
|
|
|
233
241
|
* @param {string | null} theme
|
|
234
242
|
* @protected
|
|
235
243
|
*/
|
|
236
|
-
_themeChanged(theme, overflow) {
|
|
237
|
-
if (overflow) {
|
|
244
|
+
_themeChanged(theme, overflow, container) {
|
|
245
|
+
if (overflow && container) {
|
|
238
246
|
this._buttons.forEach((btn) => this._setButtonTheme(btn, theme));
|
|
239
247
|
this.__detectOverflow();
|
|
240
248
|
}
|
|
@@ -13,7 +13,7 @@ const menuBarButton = css`
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/* NOTE(web-padawan): avoid using shorthand padding property for IE11 */
|
|
16
|
-
[part='label'] ::slotted(vaadin-
|
|
16
|
+
[part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
17
17
|
justify-content: center;
|
|
18
18
|
background-color: transparent;
|
|
19
19
|
height: var(--lumo-button-size);
|
|
@@ -22,14 +22,14 @@ const menuBarButton = css`
|
|
|
22
22
|
padding-right: calc(var(--lumo-size-m) / 3 + var(--lumo-border-radius-m) / 2);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
:host([theme~='small']) [part='label'] ::slotted(vaadin-
|
|
25
|
+
:host([theme~='small']) [part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
26
26
|
min-height: var(--lumo-size-s);
|
|
27
27
|
margin: 0 calc((var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2) * -1);
|
|
28
28
|
padding-left: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
|
|
29
29
|
padding-right: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
:host([theme~='tertiary']) [part='label'] ::slotted(vaadin-
|
|
32
|
+
:host([theme~='tertiary']) [part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
33
33
|
margin: 0 calc((var(--lumo-button-size) / 6) * -1);
|
|
34
34
|
padding-left: calc(var(--lumo-button-size) / 6);
|
|
35
35
|
padding-right: calc(var(--lumo-button-size) / 6);
|
|
@@ -41,7 +41,7 @@ const menuBarButton = css`
|
|
|
41
41
|
margin-right: calc(var(--lumo-space-xs) / 2);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
:host([theme~='tertiary-inline']) [part='label'] ::slotted(vaadin-
|
|
44
|
+
:host([theme~='tertiary-inline']) [part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
45
45
|
margin: 0;
|
|
46
46
|
padding: 0;
|
|
47
47
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
2
2
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
+
import { contextMenuItem } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-item-styles.js';
|
|
4
|
+
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
|
|
3
5
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
justify-content: inherit;
|
|
13
|
-
}
|
|
7
|
+
const menuBarItem = css`
|
|
8
|
+
[part='content'] {
|
|
9
|
+
display: flex;
|
|
10
|
+
/* tweak to inherit centering from menu bar button */
|
|
11
|
+
align-items: inherit;
|
|
12
|
+
justify-content: inherit;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
[part='content'] ::slotted(vaadin-icon) {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
width: var(--lumo-icon-size-m);
|
|
18
|
+
height: var(--lumo-icon-size-m);
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
21
|
+
[part='content'] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
22
|
+
padding: var(--lumo-space-xs);
|
|
23
|
+
box-sizing: border-box !important;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
registerStyles('vaadin-menu-bar-item', [item, contextMenuItem, menuBarItem], { moduleId: 'lumo-menu-bar-item' });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { contextMenuListBox } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-list-box-styles.js';
|
|
2
|
+
import { listBox } from '@vaadin/list-box/theme/lumo/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: 'lumo-menu-bar-list-box' });
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { contextMenuOverlay } from '@vaadin/context-menu/theme/lumo/vaadin-context-menu-overlay-styles.js';
|
|
2
|
+
import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
1
3
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
5
|
+
const menuBarOverlay = css`
|
|
6
|
+
:host(:first-of-type) {
|
|
7
|
+
padding-top: var(--lumo-space-xs);
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
registerStyles('vaadin-menu-bar-overlay', [menuOverlay, contextMenuOverlay, menuBarOverlay], {
|
|
12
|
+
moduleId: 'lumo-menu-bar-overlay',
|
|
13
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './vaadin-menu-bar-button.js';
|
|
2
2
|
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
+
import './vaadin-menu-bar-list-box-styles.js';
|
|
3
4
|
import './vaadin-menu-bar-overlay-styles.js';
|
|
4
5
|
import './vaadin-menu-bar-styles.js';
|
|
5
|
-
import '@vaadin/
|
|
6
|
+
import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
|
|
6
7
|
import '../../src/vaadin-menu-bar.js';
|
|
@@ -6,7 +6,7 @@ const menuBarButton = css`
|
|
|
6
6
|
width: 100%;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
[part='label'] ::slotted(vaadin-
|
|
9
|
+
[part='label'] ::slotted(vaadin-menu-bar-item) {
|
|
10
10
|
line-height: 20px;
|
|
11
11
|
background-color: transparent;
|
|
12
12
|
margin: -8px;
|
|
@@ -19,8 +19,8 @@ const menuBarButton = css`
|
|
|
19
19
|
border-radius: 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
:host([theme~='contained']) ::slotted(vaadin-
|
|
23
|
-
:host([theme~='outlined']) ::slotted(vaadin-
|
|
22
|
+
:host([theme~='contained']) ::slotted(vaadin-menu-bar-item),
|
|
23
|
+
:host([theme~='outlined']) ::slotted(vaadin-menu-bar-item) {
|
|
24
24
|
margin: -8px -16px;
|
|
25
25
|
padding: 8px 16px;
|
|
26
26
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
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';
|
|
2
4
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
font-size: var(--material-button-font-size);
|
|
13
|
-
}
|
|
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
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
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' });
|
|
@@ -0,0 +1,5 @@
|
|
|
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,11 +1,13 @@
|
|
|
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';
|
|
1
3
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
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
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './vaadin-menu-bar-button.js';
|
|
2
2
|
import './vaadin-menu-bar-item-styles.js';
|
|
3
|
+
import './vaadin-menu-bar-list-box-styles.js';
|
|
3
4
|
import './vaadin-menu-bar-styles.js';
|
|
4
5
|
import './vaadin-menu-bar-overlay-styles.js';
|
|
5
|
-
import '@vaadin/
|
|
6
|
+
import '@vaadin/overlay/theme/material/vaadin-overlay.js';
|
|
6
7
|
import '../../src/vaadin-menu-bar.js';
|
package/web-types.json
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha12",
|
|
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.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```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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/custom-theme/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.0.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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.0.0-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-overlay).",
|
|
12
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
|
+
},
|
|
13
24
|
{
|
|
14
25
|
"name": "open-on-hover",
|
|
15
26
|
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
@@ -22,11 +33,11 @@
|
|
|
22
33
|
}
|
|
23
34
|
},
|
|
24
35
|
{
|
|
25
|
-
"name": "
|
|
26
|
-
"description": "
|
|
36
|
+
"name": "overlay-class",
|
|
37
|
+
"description": "A space-delimited list of CSS class names\nto set on each sub-menu overlay element.",
|
|
27
38
|
"value": {
|
|
28
39
|
"type": [
|
|
29
|
-
"
|
|
40
|
+
"string",
|
|
30
41
|
"null",
|
|
31
42
|
"undefined"
|
|
32
43
|
]
|
|
@@ -47,8 +58,8 @@
|
|
|
47
58
|
"js": {
|
|
48
59
|
"properties": [
|
|
49
60
|
{
|
|
50
|
-
"name": "
|
|
51
|
-
"description": "If true, the
|
|
61
|
+
"name": "disabled",
|
|
62
|
+
"description": "If true, the user cannot interact with this element.",
|
|
52
63
|
"value": {
|
|
53
64
|
"type": [
|
|
54
65
|
"boolean",
|
|
@@ -58,8 +69,8 @@
|
|
|
58
69
|
}
|
|
59
70
|
},
|
|
60
71
|
{
|
|
61
|
-
"name": "
|
|
62
|
-
"description": "If true, the
|
|
72
|
+
"name": "openOnHover",
|
|
73
|
+
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
63
74
|
"value": {
|
|
64
75
|
"type": [
|
|
65
76
|
"boolean",
|
|
@@ -85,6 +96,17 @@
|
|
|
85
96
|
"MenuBarI18n"
|
|
86
97
|
]
|
|
87
98
|
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "overlayClass",
|
|
102
|
+
"description": "A space-delimited list of CSS class names\nto set on each sub-menu overlay element.",
|
|
103
|
+
"value": {
|
|
104
|
+
"type": [
|
|
105
|
+
"string",
|
|
106
|
+
"null",
|
|
107
|
+
"undefined"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
88
110
|
}
|
|
89
111
|
],
|
|
90
112
|
"events": [
|
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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha12",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,19 +16,19 @@
|
|
|
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.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```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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/custom-theme/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.0.0-alpha12/#/elements/vaadin-button).\n- `<vaadin-context-menu-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/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.0.0-alpha12/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha12/#/elements/vaadin-overlay).",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
23
|
-
"name": "?
|
|
24
|
-
"description": "If true, the
|
|
23
|
+
"name": "?disabled",
|
|
24
|
+
"description": "If true, the user cannot interact with this element.",
|
|
25
25
|
"value": {
|
|
26
26
|
"kind": "expression"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"name": "?
|
|
31
|
-
"description": "If true, the
|
|
30
|
+
"name": "?openOnHover",
|
|
31
|
+
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
@@ -47,6 +47,13 @@
|
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
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
|
+
},
|
|
50
57
|
{
|
|
51
58
|
"name": "@item-selected",
|
|
52
59
|
"description": "Fired when either a submenu item or menu bar button without nested children is clicked.",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
-
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
|
|
9
|
-
|
|
10
|
-
export declare function ButtonsMixin<T extends Constructor<HTMLElement>>(
|
|
11
|
-
base: T,
|
|
12
|
-
): Constructor<ButtonsMixinClass> & Constructor<ControllerMixinClass> & Constructor<ResizeMixinClass> & T;
|
|
13
|
-
|
|
14
|
-
export declare class ButtonsMixinClass {
|
|
15
|
-
protected readonly _buttons: HTMLElement[];
|
|
16
|
-
|
|
17
|
-
protected readonly _container: HTMLElement;
|
|
18
|
-
|
|
19
|
-
protected readonly _overflow: HTMLElement;
|
|
20
|
-
|
|
21
|
-
protected _hasOverflow: boolean;
|
|
22
|
-
}
|