@vaadin/menu-bar 25.4.0-alpha1 → 25.4.0-dev.c9532cd333
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/custom-elements.json +1 -1
- package/package.json +15 -15
- package/src/styles/vaadin-menu-bar-base-styles.js +6 -0
- package/src/vaadin-menu-bar-mixin.js +98 -37
- package/src/vaadin-menu-bar.d.ts +1 -0
- package/src/vaadin-menu-bar.js +1 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
"declarations": [
|
|
304
304
|
{
|
|
305
305
|
"kind": "class",
|
|
306
|
-
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:---------------------------|\n| `--vaadin-menu-bar-gap` |\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>`](#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
|
|
306
|
+
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-overflow` | Set when one or more buttons are collapsed into the overflow sub-menu\n`has-single-button` | Set when there is only one button visible\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:---------------------------|\n| `--vaadin-menu-bar-gap` |\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>`](#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
|
|
307
307
|
"name": "MenuBar",
|
|
308
308
|
"members": [
|
|
309
309
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/menu-bar",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-dev.c9532cd333",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,23 +35,23 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/button": "25.4.0-
|
|
40
|
-
"@vaadin/component-base": "25.4.0-
|
|
41
|
-
"@vaadin/context-menu": "25.4.0-
|
|
42
|
-
"@vaadin/item": "25.4.0-
|
|
43
|
-
"@vaadin/list-box": "25.4.0-
|
|
44
|
-
"@vaadin/overlay": "25.4.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-dev.c9532cd333",
|
|
39
|
+
"@vaadin/button": "25.4.0-dev.c9532cd333",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-dev.c9532cd333",
|
|
41
|
+
"@vaadin/context-menu": "25.4.0-dev.c9532cd333",
|
|
42
|
+
"@vaadin/item": "25.4.0-dev.c9532cd333",
|
|
43
|
+
"@vaadin/list-box": "25.4.0-dev.c9532cd333",
|
|
44
|
+
"@vaadin/overlay": "25.4.0-dev.c9532cd333",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-dev.c9532cd333",
|
|
46
46
|
"lit": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vaadin/aura": "25.4.0-
|
|
50
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
51
|
-
"@vaadin/icon": "25.4.0-
|
|
52
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
49
|
+
"@vaadin/aura": "25.4.0-dev.c9532cd333",
|
|
50
|
+
"@vaadin/chai-plugins": "25.4.0-dev.c9532cd333",
|
|
51
|
+
"@vaadin/icon": "25.4.0-dev.c9532cd333",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.4.0-dev.c9532cd333",
|
|
53
53
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-dev.c9532cd333",
|
|
55
55
|
"sinon": "^22.0.0"
|
|
56
56
|
},
|
|
57
57
|
"customElements": "custom-elements.json",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1fbf460cf3602f011721b6ed7d98961d1c1bf85e"
|
|
63
63
|
}
|
|
@@ -15,6 +15,12 @@ export const menuBarStyles = css`
|
|
|
15
15
|
display: none !important;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/* Keep the width measured with all buttons in flow while the host is frozen */
|
|
19
|
+
:host([overflow-frozen]) {
|
|
20
|
+
contain: inline-size !important;
|
|
21
|
+
contain-intrinsic-inline-size: var(--_vaadin-menu-bar-content-width);
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
[part='container'] {
|
|
19
25
|
display: flex;
|
|
20
26
|
flex-wrap: nowrap;
|
|
@@ -464,7 +464,6 @@ export const MenuBarMixin = (superClass) =>
|
|
|
464
464
|
buttons.forEach((button) => {
|
|
465
465
|
button.style.visibility = '';
|
|
466
466
|
button.style.position = '';
|
|
467
|
-
button.style.width = '';
|
|
468
467
|
|
|
469
468
|
// Teleport item component back from "overflow" sub-menu
|
|
470
469
|
const item = button.item?.component;
|
|
@@ -474,6 +473,20 @@ export const MenuBarMixin = (superClass) =>
|
|
|
474
473
|
});
|
|
475
474
|
}
|
|
476
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Restores all buttons, the overflow button and the state attributes, so that
|
|
478
|
+
* the measurement does not use the button margins of the previous state.
|
|
479
|
+
*
|
|
480
|
+
* @param {!Array<!HTMLElement>} buttons
|
|
481
|
+
* @private
|
|
482
|
+
*/
|
|
483
|
+
__restoreState(buttons) {
|
|
484
|
+
this.__restoreButtons(buttons);
|
|
485
|
+
this.__updateOverflow([]);
|
|
486
|
+
this.toggleAttribute('has-single-button', buttons.length === 1);
|
|
487
|
+
this.__updateVisibleAttributes(buttons);
|
|
488
|
+
}
|
|
489
|
+
|
|
477
490
|
/** @private */
|
|
478
491
|
__restoreItem(button, item) {
|
|
479
492
|
button.appendChild(item);
|
|
@@ -487,6 +500,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
487
500
|
__updateOverflow(items) {
|
|
488
501
|
this._overflow.item = { children: items };
|
|
489
502
|
this._hasOverflow = items.length > 0;
|
|
503
|
+
this.toggleAttribute('has-overflow', this._hasOverflow);
|
|
490
504
|
}
|
|
491
505
|
|
|
492
506
|
/**
|
|
@@ -503,14 +517,28 @@ export const MenuBarMixin = (superClass) =>
|
|
|
503
517
|
}
|
|
504
518
|
|
|
505
519
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
520
|
+
* Whether the element ends past the container, with the tolerance for fractional widths.
|
|
521
|
+
*
|
|
522
|
+
* @param {!HTMLElement} el
|
|
523
|
+
* @return {boolean}
|
|
524
|
+
* @private
|
|
525
|
+
*/
|
|
526
|
+
__isPastContainerEnd(el) {
|
|
527
|
+
return this.__getInlineEnd(el) > this.__getInlineEnd(this._container) + OVERFLOW_TOLERANCE;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Layout of the buttons, the overflow button and the container, read in one batch
|
|
532
|
+
* before any button is hidden. Positions are mirrored in RTL so that a larger value
|
|
533
|
+
* is always further along the inline axis.
|
|
508
534
|
*
|
|
509
535
|
* @typedef {object} MenuBarOverflowLayout
|
|
510
536
|
* @property {number[]} starts Inline start of each button
|
|
511
537
|
* @property {number[]} ends Inline end of each button
|
|
512
538
|
* @property {number[]} margins Inline start margin of each button
|
|
513
539
|
* @property {number} overflowExtent Space the overflow button adds after the last button
|
|
540
|
+
* @property {number} containerWidth Width of the container
|
|
541
|
+
* @property {number} contentWidth Width of all buttons and the overflow button in flow
|
|
514
542
|
*/
|
|
515
543
|
|
|
516
544
|
/**
|
|
@@ -519,17 +547,22 @@ export const MenuBarMixin = (superClass) =>
|
|
|
519
547
|
* @return {!MenuBarOverflowLayout}
|
|
520
548
|
* @private
|
|
521
549
|
*/
|
|
522
|
-
|
|
550
|
+
__getOverflowLayout(buttons, overflow) {
|
|
523
551
|
const isRTL = this.__isRTL;
|
|
524
552
|
const rects = buttons.map((btn) => btn.getBoundingClientRect());
|
|
525
553
|
const ends = rects.map(({ left, right }) => (isRTL ? -left : right));
|
|
554
|
+
const overflowEnd = this.__getInlineEnd(overflow);
|
|
555
|
+
const containerRect = this._container.getBoundingClientRect();
|
|
556
|
+
const containerStart = isRTL ? -containerRect.right : containerRect.left;
|
|
526
557
|
|
|
527
558
|
return {
|
|
528
559
|
starts: rects.map(({ left, right }) => (isRTL ? -right : left)),
|
|
529
560
|
ends,
|
|
530
561
|
// `auto` resolves to 0 while the content overflows.
|
|
531
562
|
margins: buttons.map((btn) => parseFloat(getComputedStyle(btn).marginInlineStart) || 0),
|
|
532
|
-
overflowExtent:
|
|
563
|
+
overflowExtent: overflowEnd - ends.at(-1),
|
|
564
|
+
containerWidth: containerRect.width,
|
|
565
|
+
contentWidth: overflowEnd - containerStart,
|
|
533
566
|
};
|
|
534
567
|
}
|
|
535
568
|
|
|
@@ -540,11 +573,10 @@ export const MenuBarMixin = (superClass) =>
|
|
|
540
573
|
*
|
|
541
574
|
* @param {!Array<!HTMLElement>} buttons
|
|
542
575
|
* @param {!MenuBarOverflowLayout} layout
|
|
543
|
-
* @param {number} containerWidth
|
|
544
576
|
* @return {!Array<!HTMLElement>} buttons to collapse, in DOM order
|
|
545
577
|
* @private
|
|
546
578
|
*/
|
|
547
|
-
|
|
579
|
+
__getButtonsToCollapse(buttons, { starts, ends, margins, overflowExtent, containerWidth }) {
|
|
548
580
|
let lo = 0;
|
|
549
581
|
let hi = buttons.length - 1;
|
|
550
582
|
|
|
@@ -560,38 +592,64 @@ export const MenuBarMixin = (superClass) =>
|
|
|
560
592
|
return buttons.filter((_, i) => i < lo || i > hi);
|
|
561
593
|
}
|
|
562
594
|
|
|
595
|
+
/**
|
|
596
|
+
* Keeps the intrinsic width of the host at the given value. A parent sized by content,
|
|
597
|
+
* such as a split layout pane, shrinks the host once the buttons are out of flow. The
|
|
598
|
+
* width the host had with all buttons in flow keeps the collapse that was decided for it.
|
|
599
|
+
* The `overflow-frozen` attribute marks the frozen state for the styles and for the next
|
|
600
|
+
* detection. It is internal and not documented.
|
|
601
|
+
*
|
|
602
|
+
* @param {number} width
|
|
603
|
+
* @private
|
|
604
|
+
*/
|
|
605
|
+
__freezeWidth(width) {
|
|
606
|
+
this.style.setProperty('--_vaadin-menu-bar-content-width', `${width}px`);
|
|
607
|
+
this.setAttribute('overflow-frozen', '');
|
|
608
|
+
}
|
|
609
|
+
|
|
563
610
|
/** @private */
|
|
611
|
+
__unfreezeWidth() {
|
|
612
|
+
this.style.removeProperty('--_vaadin-menu-bar-content-width');
|
|
613
|
+
this.removeAttribute('overflow-frozen');
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Shows the overflow button and collapses buttons into it when the last button
|
|
618
|
+
* does not fit in the container. Freezes the host width when the parent shrinks
|
|
619
|
+
* the host after the collapse. A frozen host stays frozen until all buttons and the
|
|
620
|
+
* overflow button fit, so that its flex basis does not change between detections
|
|
621
|
+
* when another element in the same row depends on it.
|
|
622
|
+
*
|
|
623
|
+
* @param {!Array<!HTMLElement>} buttons
|
|
624
|
+
* @param {!HTMLElement} overflow
|
|
625
|
+
* @private
|
|
626
|
+
*/
|
|
564
627
|
__setOverflowItems(buttons, overflow) {
|
|
565
|
-
const container = this._container;
|
|
566
|
-
// Read before any write, so a menu bar that fits forces no layout
|
|
567
|
-
const width = container.offsetWidth;
|
|
568
628
|
const lastButton = buttons.at(-1);
|
|
629
|
+
// A frozen host is as wide as all buttons plus the overflow button, so the quick
|
|
630
|
+
// check would report a fit one overflow button too early. Measure instead.
|
|
631
|
+
const wasFrozen = this.hasAttribute('overflow-frozen');
|
|
632
|
+
if (!lastButton || (!wasFrozen && !this.__isPastContainerEnd(lastButton))) {
|
|
633
|
+
this.__unfreezeWidth();
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
this._hasOverflow = true;
|
|
569
637
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
const layout = this.__measureButtons(buttons, overflow);
|
|
581
|
-
const containerWidth = container.getBoundingClientRect().width;
|
|
582
|
-
const collapsed = this.__getCollapsedButtons(buttons, layout, containerWidth);
|
|
583
|
-
// Read button widths once outside of the loop to avoid repetitive layout
|
|
584
|
-
const widths = collapsed.map((btn) => getComputedStyle(btn).width);
|
|
585
|
-
|
|
586
|
-
// Write the DOM state
|
|
587
|
-
collapsed.forEach((btn, i) => {
|
|
588
|
-
btn.style.width = widths[i];
|
|
589
|
-
btn.style.visibility = 'hidden';
|
|
590
|
-
btn.style.position = 'absolute';
|
|
591
|
-
});
|
|
592
|
-
this.__updateOverflow(collapsed.map((btn) => btn.item));
|
|
638
|
+
// Read the layout once the overflow button is in flow
|
|
639
|
+
const layout = this.__getOverflowLayout(buttons, overflow);
|
|
640
|
+
const collapsed = this.__getButtonsToCollapse(buttons, layout);
|
|
641
|
+
|
|
642
|
+
// Write the DOM state
|
|
643
|
+
collapsed.forEach((btn) => {
|
|
644
|
+
btn.style.visibility = 'hidden';
|
|
645
|
+
btn.style.position = 'absolute';
|
|
646
|
+
});
|
|
647
|
+
this.__updateOverflow(collapsed.map((btn) => btn.item));
|
|
593
648
|
|
|
594
|
-
|
|
649
|
+
if (collapsed.length === 0) {
|
|
650
|
+
this.__unfreezeWidth();
|
|
651
|
+
} else if (wasFrozen || this.__isPastContainerEnd(overflow)) {
|
|
652
|
+
this.__freezeWidth(layout.contentWidth);
|
|
595
653
|
}
|
|
596
654
|
}
|
|
597
655
|
|
|
@@ -608,9 +666,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
608
666
|
const buttons = this._buttons.filter((btn) => btn !== overflow);
|
|
609
667
|
const oldOverflowCount = this.__getOverflowCount(overflow);
|
|
610
668
|
|
|
611
|
-
|
|
612
|
-
this.__restoreButtons(buttons);
|
|
613
|
-
this.__updateOverflow([]);
|
|
669
|
+
this.__restoreState(buttons);
|
|
614
670
|
|
|
615
671
|
// Hide any overflowing buttons and put them in the 'overflow' button
|
|
616
672
|
this.__setOverflowItems(buttons, overflow);
|
|
@@ -639,6 +695,11 @@ export const MenuBarMixin = (superClass) =>
|
|
|
639
695
|
this._setTabindex(visibleButtons[visibleButtons.length - 1], true);
|
|
640
696
|
}
|
|
641
697
|
|
|
698
|
+
this.__updateVisibleAttributes(visibleButtons);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** @private */
|
|
702
|
+
__updateVisibleAttributes(visibleButtons) {
|
|
642
703
|
visibleButtons.forEach((btn, index) => {
|
|
643
704
|
btn.toggleAttribute('first-visible', index === 0);
|
|
644
705
|
btn.toggleAttribute('last-visible', !this._hasOverflow && index === visibleButtons.length - 1);
|
package/src/vaadin-menu-bar.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export interface MenuBarEventMap<TItem extends MenuBarItem = MenuBarItem>
|
|
|
52
52
|
* Attribute | Description
|
|
53
53
|
* --------------------|----------------------------------
|
|
54
54
|
* `disabled` | Set when the menu bar is disabled
|
|
55
|
+
* `has-overflow` | Set when one or more buttons are collapsed into the overflow sub-menu
|
|
55
56
|
* `has-single-button` | Set when there is only one button visible
|
|
56
57
|
*
|
|
57
58
|
* The following custom CSS properties are available for styling:
|
package/src/vaadin-menu-bar.js
CHANGED
|
@@ -44,6 +44,7 @@ import { MenuBarMixin } from './vaadin-menu-bar-mixin.js';
|
|
|
44
44
|
* Attribute | Description
|
|
45
45
|
* --------------------|----------------------------------
|
|
46
46
|
* `disabled` | Set when the menu bar is disabled
|
|
47
|
+
* `has-overflow` | Set when one or more buttons are collapsed into the overflow sub-menu
|
|
47
48
|
* `has-single-button` | Set when there is only one button visible
|
|
48
49
|
*
|
|
49
50
|
* The following custom CSS properties are available for styling:
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-dev.c9532cd333",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-menu-bar",
|
|
11
|
-
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-
|
|
11
|
+
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-overflow` | Set when one or more buttons are collapsed into the overflow sub-menu\n`has-single-button` | Set when there is only one button visible\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:---------------------------|\n| `--vaadin-menu-bar-gap` |\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.4.0-dev.c9532cd333/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/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.4.0-dev.c9532cd333/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-dev.c9532cd333",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-menu-bar",
|
|
19
|
-
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-
|
|
19
|
+
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```html\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```js\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-overflow` | Set when one or more buttons are collapsed into the overflow sub-menu\n`has-single-button` | Set when there is only one button visible\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:---------------------------|\n| `--vaadin-menu-bar-gap` |\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.4.0-dev.c9532cd333/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/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.4.0-dev.c9532cd333/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-submenu>` - has the same API as [`<vaadin-context-menu>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-dev.c9532cd333/#/elements/vaadin-context-menu).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|