@vaadin/menu-bar 24.4.0-dev.b3e1d14600 → 24.4.0-rc2
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 -1
- package/package.json +16 -13
- package/src/vaadin-lit-menu-bar-button.js +58 -0
- package/src/vaadin-lit-menu-bar-item.js +62 -0
- package/src/vaadin-lit-menu-bar-list-box.js +87 -0
- package/src/vaadin-lit-menu-bar-overlay.js +65 -0
- package/src/vaadin-lit-menu-bar-submenu.js +93 -0
- package/src/vaadin-lit-menu-bar.js +83 -0
- package/src/vaadin-menu-bar-button.js +14 -1
- package/src/vaadin-menu-bar-item.d.ts +1 -1
- package/src/vaadin-menu-bar-item.js +1 -1
- package/src/vaadin-menu-bar-list-box.d.ts +1 -1
- package/src/vaadin-menu-bar-list-box.js +1 -1
- package/src/vaadin-menu-bar-mixin.d.ts +13 -1
- package/src/vaadin-menu-bar-mixin.js +84 -18
- package/src/vaadin-menu-bar-overlay.d.ts +1 -1
- package/src/vaadin-menu-bar-overlay.js +1 -1
- package/src/vaadin-menu-bar-submenu.js +1 -1
- package/src/vaadin-menu-bar.d.ts +1 -1
- package/src/vaadin-menu-bar.js +1 -1
- package/theme/lumo/vaadin-lit-menu-bar.d.ts +6 -0
- package/theme/lumo/vaadin-lit-menu-bar.js +6 -0
- package/theme/lumo/vaadin-menu-bar-button-styles.d.ts +1 -0
- package/theme/lumo/vaadin-menu-bar-button-styles.js +4 -4
- package/theme/lumo/vaadin-menu-bar-button.d.ts +2 -0
- package/theme/lumo/vaadin-menu-bar-item-styles.d.ts +2 -0
- package/theme/lumo/vaadin-menu-bar-list-box-styles.d.ts +1 -0
- package/theme/lumo/vaadin-menu-bar-overlay-styles.d.ts +1 -0
- package/theme/lumo/vaadin-menu-bar-styles.d.ts +1 -0
- package/theme/lumo/vaadin-menu-bar-styles.js +1 -1
- package/theme/lumo/vaadin-menu-bar.d.ts +6 -0
- package/theme/material/vaadin-lit-menu-bar.d.ts +6 -0
- package/theme/material/vaadin-lit-menu-bar.js +6 -0
- package/theme/material/vaadin-menu-bar-button-styles.d.ts +1 -0
- package/theme/material/vaadin-menu-bar-button-styles.js +6 -6
- package/theme/material/vaadin-menu-bar-button.d.ts +2 -0
- package/theme/material/vaadin-menu-bar-item-styles.d.ts +1 -0
- package/theme/material/vaadin-menu-bar-list-box-styles.d.ts +1 -0
- package/theme/material/vaadin-menu-bar-overlay-styles.d.ts +1 -0
- package/theme/material/vaadin-menu-bar-styles.d.ts +1 -0
- package/theme/material/vaadin-menu-bar-styles.js +1 -1
- package/theme/material/vaadin-menu-bar.d.ts +6 -0
- package/web-types.json +145 -0
- package/web-types.lit.json +76 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2024 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
@@ -135,6 +135,15 @@ export const MenuBarMixin = (superClass) =>
|
|
|
135
135
|
type: Boolean,
|
|
136
136
|
},
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* If true, the buttons will be collapsed into the overflow menu
|
|
140
|
+
* starting from the "start" end of the bar instead of the "end".
|
|
141
|
+
* @attr {boolean} reverse-collapse
|
|
142
|
+
*/
|
|
143
|
+
reverseCollapse: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
},
|
|
146
|
+
|
|
138
147
|
/**
|
|
139
148
|
* @type {boolean}
|
|
140
149
|
* @protected
|
|
@@ -142,6 +151,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
142
151
|
_hasOverflow: {
|
|
143
152
|
type: Boolean,
|
|
144
153
|
value: false,
|
|
154
|
+
sync: true,
|
|
145
155
|
},
|
|
146
156
|
|
|
147
157
|
/** @protected */
|
|
@@ -162,12 +172,14 @@ export const MenuBarMixin = (superClass) =>
|
|
|
162
172
|
'__hasOverflowChanged(_hasOverflow, _overflow)',
|
|
163
173
|
'__i18nChanged(i18n, _overflow)',
|
|
164
174
|
'_menuItemsChanged(items, _overflow, _container)',
|
|
175
|
+
'_reverseCollapseChanged(reverseCollapse, _overflow, _container)',
|
|
165
176
|
];
|
|
166
177
|
}
|
|
167
178
|
|
|
168
179
|
constructor() {
|
|
169
180
|
super();
|
|
170
181
|
this.__boundOnContextMenuKeydown = this.__onContextMenuKeydown.bind(this);
|
|
182
|
+
this.__boundOnTooltipMouseLeave = this.__onTooltipOverlayMouseLeave.bind(this);
|
|
171
183
|
}
|
|
172
184
|
|
|
173
185
|
/**
|
|
@@ -251,7 +263,12 @@ export const MenuBarMixin = (superClass) =>
|
|
|
251
263
|
container.addEventListener('click', this.__onButtonClick.bind(this));
|
|
252
264
|
container.addEventListener('mouseover', (e) => this._onMouseOver(e));
|
|
253
265
|
|
|
254
|
-
|
|
266
|
+
// Delay setting container to avoid rendering buttons immediately,
|
|
267
|
+
// which would also trigger detecting overflow and force re-layout
|
|
268
|
+
// See https://github.com/vaadin/web-components/issues/7271
|
|
269
|
+
queueMicrotask(() => {
|
|
270
|
+
this._container = container;
|
|
271
|
+
});
|
|
255
272
|
}
|
|
256
273
|
|
|
257
274
|
/**
|
|
@@ -320,6 +337,18 @@ export const MenuBarMixin = (superClass) =>
|
|
|
320
337
|
}
|
|
321
338
|
}
|
|
322
339
|
|
|
340
|
+
/**
|
|
341
|
+
* A callback for the 'reverseCollapse' property observer.
|
|
342
|
+
*
|
|
343
|
+
* @param {boolean | null} _reverseCollapse
|
|
344
|
+
* @private
|
|
345
|
+
*/
|
|
346
|
+
_reverseCollapseChanged(_reverseCollapse, overflow, container) {
|
|
347
|
+
if (overflow && container) {
|
|
348
|
+
this.__detectOverflow();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
323
352
|
/** @private */
|
|
324
353
|
__hasOverflowChanged(hasOverflow, overflow) {
|
|
325
354
|
if (overflow) {
|
|
@@ -408,42 +437,47 @@ export const MenuBarMixin = (superClass) =>
|
|
|
408
437
|
this._hasOverflow = true;
|
|
409
438
|
|
|
410
439
|
const isRTL = this.__isRTL;
|
|
411
|
-
const containerLeft = container.
|
|
440
|
+
const containerLeft = container.offsetLeft;
|
|
412
441
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
const
|
|
417
|
-
const btnLeft = btn.getBoundingClientRect().left - containerLeft;
|
|
442
|
+
const remaining = [...buttons];
|
|
443
|
+
while (remaining.length) {
|
|
444
|
+
const lastButton = remaining[remaining.length - 1];
|
|
445
|
+
const btnLeft = lastButton.offsetLeft - containerLeft;
|
|
418
446
|
|
|
419
447
|
// If this button isn't overflowing, then the rest aren't either
|
|
420
448
|
if (
|
|
421
|
-
(!isRTL && btnLeft +
|
|
449
|
+
(!isRTL && btnLeft + lastButton.offsetWidth < container.offsetWidth - overflow.offsetWidth) ||
|
|
422
450
|
(isRTL && btnLeft >= overflow.offsetWidth)
|
|
423
451
|
) {
|
|
424
452
|
break;
|
|
425
453
|
}
|
|
426
454
|
|
|
455
|
+
const btn = this.reverseCollapse ? remaining.shift() : remaining.pop();
|
|
456
|
+
|
|
457
|
+
// Save width for buttons with component
|
|
458
|
+
btn.style.width = getComputedStyle(btn).width;
|
|
427
459
|
btn.disabled = true;
|
|
428
460
|
btn.style.visibility = 'hidden';
|
|
429
461
|
btn.style.position = 'absolute';
|
|
430
|
-
// Save width for buttons with component
|
|
431
|
-
btn.style.width = btnStyle.width;
|
|
432
462
|
}
|
|
433
|
-
|
|
463
|
+
|
|
464
|
+
const items = buttons.filter((b) => !remaining.includes(b)).map((b) => b.item);
|
|
434
465
|
this.__updateOverflow(items);
|
|
435
466
|
|
|
436
|
-
const remaining = buttons.slice(0, i);
|
|
437
467
|
// Ensure there is at least one button with tabindex set to 0
|
|
438
468
|
// so that menu-bar is not skipped when navigating with Tab
|
|
439
|
-
if (
|
|
440
|
-
this._setTabindex(remaining[
|
|
469
|
+
if (remaining.length && !remaining.some((btn) => btn.getAttribute('tabindex') === '0')) {
|
|
470
|
+
this._setTabindex(remaining[remaining.length - 1], true);
|
|
441
471
|
}
|
|
442
472
|
}
|
|
443
473
|
}
|
|
444
474
|
|
|
445
475
|
/** @private */
|
|
446
476
|
__detectOverflow() {
|
|
477
|
+
if (!this._container) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
|
|
447
481
|
const overflow = this._overflow;
|
|
448
482
|
const buttons = this._buttons.filter((btn) => btn !== overflow);
|
|
449
483
|
const oldOverflowCount = this.__getOverflowCount(overflow);
|
|
@@ -461,6 +495,14 @@ export const MenuBarMixin = (superClass) =>
|
|
|
461
495
|
|
|
462
496
|
const isSingleButton = newOverflowCount === buttons.length || (newOverflowCount === 0 && buttons.length === 1);
|
|
463
497
|
this.toggleAttribute('has-single-button', isSingleButton);
|
|
498
|
+
|
|
499
|
+
// Apply first/last visible attributes to the visible buttons
|
|
500
|
+
buttons
|
|
501
|
+
.filter((btn) => btn.style.visibility !== 'hidden')
|
|
502
|
+
.forEach((btn, index, visibleButtons) => {
|
|
503
|
+
btn.toggleAttribute('first-visible', index === 0);
|
|
504
|
+
btn.toggleAttribute('last-visible', !this._hasOverflow && index === visibleButtons.length - 1);
|
|
505
|
+
});
|
|
464
506
|
}
|
|
465
507
|
|
|
466
508
|
/** @protected */
|
|
@@ -583,6 +625,11 @@ export const MenuBarMixin = (superClass) =>
|
|
|
583
625
|
tooltip.generator = ({ item }) => item && item.tooltip;
|
|
584
626
|
}
|
|
585
627
|
|
|
628
|
+
if (!tooltip._mouseLeaveListenerAdded) {
|
|
629
|
+
tooltip._overlayElement.addEventListener('mouseleave', this.__boundOnTooltipMouseLeave);
|
|
630
|
+
tooltip._mouseLeaveListenerAdded = true;
|
|
631
|
+
}
|
|
632
|
+
|
|
586
633
|
if (!this._subMenu.opened) {
|
|
587
634
|
this._tooltipController.setTarget(button);
|
|
588
635
|
this._tooltipController.setContext({ item: button.item });
|
|
@@ -604,6 +651,13 @@ export const MenuBarMixin = (superClass) =>
|
|
|
604
651
|
}
|
|
605
652
|
}
|
|
606
653
|
|
|
654
|
+
/** @private */
|
|
655
|
+
__onTooltipOverlayMouseLeave(event) {
|
|
656
|
+
if (event.relatedTarget !== this._tooltipController.target) {
|
|
657
|
+
this._hideTooltip();
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
607
661
|
/** @protected */
|
|
608
662
|
_setExpanded(button, expanded) {
|
|
609
663
|
button.toggleAttribute('expanded', expanded);
|
|
@@ -799,7 +853,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
799
853
|
e.stopPropagation();
|
|
800
854
|
const button = this._getButtonFromEvent(e);
|
|
801
855
|
if (button) {
|
|
802
|
-
this.__openSubMenu(button,
|
|
856
|
+
this.__openSubMenu(button, button.__triggeredWithActiveKeys);
|
|
803
857
|
}
|
|
804
858
|
}
|
|
805
859
|
|
|
@@ -824,7 +878,9 @@ export const MenuBarMixin = (superClass) =>
|
|
|
824
878
|
subMenu.items = items;
|
|
825
879
|
subMenu.listenOn = button;
|
|
826
880
|
const overlay = subMenu._overlayElement;
|
|
827
|
-
|
|
881
|
+
// Unset old positioning to prevent flashing.
|
|
882
|
+
overlay.removeAttribute('style');
|
|
883
|
+
overlay.positionTarget = undefined;
|
|
828
884
|
overlay.noVerticalOverlap = true;
|
|
829
885
|
|
|
830
886
|
this._expandedButton = button;
|
|
@@ -860,6 +916,9 @@ export const MenuBarMixin = (superClass) =>
|
|
|
860
916
|
overlay.$.overlay.focus();
|
|
861
917
|
}
|
|
862
918
|
|
|
919
|
+
// Delay setting position target until overlay is rendered
|
|
920
|
+
// to correctly measure item content in Lit based version.
|
|
921
|
+
overlay.positionTarget = button;
|
|
863
922
|
overlay._updatePosition();
|
|
864
923
|
},
|
|
865
924
|
{ once: true },
|
|
@@ -908,11 +967,18 @@ export const MenuBarMixin = (superClass) =>
|
|
|
908
967
|
* @param {boolean} restoreFocus
|
|
909
968
|
* @protected
|
|
910
969
|
*/
|
|
911
|
-
_close(restoreFocus) {
|
|
970
|
+
_close(restoreFocus = false) {
|
|
912
971
|
this.style.pointerEvents = '';
|
|
913
972
|
this.__deactivateButton(restoreFocus);
|
|
914
973
|
if (this._subMenu.opened) {
|
|
915
974
|
this._subMenu.close();
|
|
916
975
|
}
|
|
917
976
|
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Closes the current submenu.
|
|
980
|
+
*/
|
|
981
|
+
close() {
|
|
982
|
+
this._close();
|
|
983
|
+
}
|
|
918
984
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2024 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2024 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
package/src/vaadin-menu-bar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2024 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
package/src/vaadin-menu-bar.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -46,14 +46,14 @@ const menuBarButton = css`
|
|
|
46
46
|
padding: 0;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
:host(
|
|
49
|
+
:host([first-visible]) {
|
|
50
50
|
border-radius: var(--lumo-border-radius-m) 0 0 var(--lumo-border-radius-m);
|
|
51
51
|
|
|
52
52
|
/* Needed to retain the focus-ring with border-radius */
|
|
53
53
|
margin-left: calc(var(--lumo-space-xs) / 2);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
:host(
|
|
56
|
+
:host([last-visible]),
|
|
57
57
|
:host([slot='overflow']) {
|
|
58
58
|
border-radius: 0 var(--lumo-border-radius-m) var(--lumo-border-radius-m) 0;
|
|
59
59
|
}
|
|
@@ -86,12 +86,12 @@ const menuBarButton = css`
|
|
|
86
86
|
border-radius: 0;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
:host([dir='rtl']
|
|
89
|
+
:host([dir='rtl'][first-visible]) {
|
|
90
90
|
border-radius: 0 var(--lumo-border-radius-m) var(--lumo-border-radius-m) 0;
|
|
91
91
|
margin-right: calc(var(--lumo-space-xs) / 2);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
:host([dir='rtl']
|
|
94
|
+
:host([dir='rtl'][last-visible]),
|
|
95
95
|
:host([dir='rtl'][slot='overflow']) {
|
|
96
96
|
border-radius: var(--lumo-border-radius-m) 0 0 var(--lumo-border-radius-m);
|
|
97
97
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
@@ -8,7 +8,7 @@ registerStyles(
|
|
|
8
8
|
border-radius: var(--lumo-border-radius-m);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
:host([theme~='end-aligned']) ::slotted(vaadin-menu-bar-button
|
|
11
|
+
:host([theme~='end-aligned']) ::slotted(vaadin-menu-bar-button[first-visible]),
|
|
12
12
|
:host([theme~='end-aligned'][has-single-button]) ::slotted(vaadin-menu-bar-button) {
|
|
13
13
|
margin-inline-start: auto;
|
|
14
14
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -49,11 +49,11 @@ const menuBarButton = css`
|
|
|
49
49
|
margin-right: 1px;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
:host(
|
|
52
|
+
:host([first-visible]) {
|
|
53
53
|
border-radius: 4px 0 0 4px;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
:host(
|
|
56
|
+
:host([last-visible]),
|
|
57
57
|
:host([slot='overflow']) {
|
|
58
58
|
border-radius: 0 4px 4px 0;
|
|
59
59
|
}
|
|
@@ -72,7 +72,7 @@ const menuBarButton = css`
|
|
|
72
72
|
margin-right: -1px;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
:host([theme~='outlined']:not([dir='rtl'])
|
|
75
|
+
:host([theme~='outlined']:not([dir='rtl'])[last-visible]),
|
|
76
76
|
:host([theme~='outlined']:not([dir='rtl'])[slot='overflow']) {
|
|
77
77
|
margin-right: 0;
|
|
78
78
|
}
|
|
@@ -83,11 +83,11 @@ const menuBarButton = css`
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/* RTL styles */
|
|
86
|
-
:host([dir='rtl']
|
|
86
|
+
:host([dir='rtl'][first-visible]) {
|
|
87
87
|
border-radius: 0 4px 4px 0;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
:host([dir='rtl']
|
|
90
|
+
:host([dir='rtl'][last-visible]),
|
|
91
91
|
:host([dir='rtl'][slot='overflow']) {
|
|
92
92
|
border-radius: 4px 0 0 4px;
|
|
93
93
|
}
|
|
@@ -100,7 +100,7 @@ const menuBarButton = css`
|
|
|
100
100
|
margin-left: -1px;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
:host([theme~='outlined'][dir='rtl']
|
|
103
|
+
:host([theme~='outlined'][dir='rtl'][last-visible]),
|
|
104
104
|
:host([theme~='outlined'][dir='rtl'][slot='overflow']) {
|
|
105
105
|
margin-left: 0;
|
|
106
106
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@vaadin/vaadin-material-styles/typography.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,7 @@ registerStyles(
|
|
|
12
12
|
border-radius: 4px;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
:host([theme~='end-aligned']) ::slotted(vaadin-menu-bar-button
|
|
15
|
+
:host([theme~='end-aligned']) ::slotted(vaadin-menu-bar-button[first-visible]),
|
|
16
16
|
:host([theme~='end-aligned'][has-single-button]) ::slotted(vaadin-menu-bar-button) {
|
|
17
17
|
margin-inline-start: auto;
|
|
18
18
|
}
|
package/web-types.json
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/menu-bar",
|
|
4
|
+
"version": "24.4.0-rc2",
|
|
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.4.0-rc2/#/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.4.0-rc2/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-rc2/#/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.4.0-rc2/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-rc2/#/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": "reverse-collapse",
|
|
48
|
+
"description": "If true, the buttons will be collapsed into the overflow menu\nstarting from the \"start\" end of the bar instead of the \"end\".",
|
|
49
|
+
"value": {
|
|
50
|
+
"type": [
|
|
51
|
+
"boolean",
|
|
52
|
+
"null",
|
|
53
|
+
"undefined"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "theme",
|
|
59
|
+
"description": "The theme variants to apply to the component.",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"string",
|
|
63
|
+
"null",
|
|
64
|
+
"undefined"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"js": {
|
|
70
|
+
"properties": [
|
|
71
|
+
{
|
|
72
|
+
"name": "disabled",
|
|
73
|
+
"description": "If true, the user cannot interact with this element.",
|
|
74
|
+
"value": {
|
|
75
|
+
"type": [
|
|
76
|
+
"boolean",
|
|
77
|
+
"null",
|
|
78
|
+
"undefined"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "items",
|
|
84
|
+
"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```",
|
|
85
|
+
"value": {
|
|
86
|
+
"type": [
|
|
87
|
+
"Array.<MenuBarItem>"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "i18n",
|
|
93
|
+
"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```",
|
|
94
|
+
"value": {
|
|
95
|
+
"type": [
|
|
96
|
+
"MenuBarI18n"
|
|
97
|
+
]
|
|
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
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "openOnHover",
|
|
113
|
+
"description": "If true, the submenu will open on hover (mouseover) instead of click.",
|
|
114
|
+
"value": {
|
|
115
|
+
"type": [
|
|
116
|
+
"boolean",
|
|
117
|
+
"null",
|
|
118
|
+
"undefined"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "reverseCollapse",
|
|
124
|
+
"description": "If true, the buttons will be collapsed into the overflow menu\nstarting from the \"start\" end of the bar instead of the \"end\".",
|
|
125
|
+
"value": {
|
|
126
|
+
"type": [
|
|
127
|
+
"boolean",
|
|
128
|
+
"null",
|
|
129
|
+
"undefined"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"events": [
|
|
135
|
+
{
|
|
136
|
+
"name": "item-selected",
|
|
137
|
+
"description": "Fired when either a submenu item or menu bar button without nested children is clicked."
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|