@vaadin/menu-bar 25.4.0-alpha1 → 25.4.0-dev.55bb86e155
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/vaadin-menu-bar-mixin.js +73 -35
- 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.55bb86e155",
|
|
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.55bb86e155",
|
|
39
|
+
"@vaadin/button": "25.4.0-dev.55bb86e155",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-dev.55bb86e155",
|
|
41
|
+
"@vaadin/context-menu": "25.4.0-dev.55bb86e155",
|
|
42
|
+
"@vaadin/item": "25.4.0-dev.55bb86e155",
|
|
43
|
+
"@vaadin/list-box": "25.4.0-dev.55bb86e155",
|
|
44
|
+
"@vaadin/overlay": "25.4.0-dev.55bb86e155",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-dev.55bb86e155",
|
|
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.55bb86e155",
|
|
50
|
+
"@vaadin/chai-plugins": "25.4.0-dev.55bb86e155",
|
|
51
|
+
"@vaadin/icon": "25.4.0-dev.55bb86e155",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.4.0-dev.55bb86e155",
|
|
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.55bb86e155",
|
|
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": "5db8e58fb088121b067290b0ed90d12d7d4084f2"
|
|
63
63
|
}
|
|
@@ -474,6 +474,20 @@ export const MenuBarMixin = (superClass) =>
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
+
/**
|
|
478
|
+
* Restores all buttons, the overflow button and the state attributes, so that
|
|
479
|
+
* the measurement does not use the button margins of the previous state.
|
|
480
|
+
*
|
|
481
|
+
* @param {!Array<!HTMLElement>} buttons
|
|
482
|
+
* @private
|
|
483
|
+
*/
|
|
484
|
+
__restoreState(buttons) {
|
|
485
|
+
this.__restoreButtons(buttons);
|
|
486
|
+
this.__updateOverflow([]);
|
|
487
|
+
this.toggleAttribute('has-single-button', buttons.length === 1);
|
|
488
|
+
this.__updateVisibleAttributes(buttons);
|
|
489
|
+
}
|
|
490
|
+
|
|
477
491
|
/** @private */
|
|
478
492
|
__restoreItem(button, item) {
|
|
479
493
|
button.appendChild(item);
|
|
@@ -487,6 +501,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
487
501
|
__updateOverflow(items) {
|
|
488
502
|
this._overflow.item = { children: items };
|
|
489
503
|
this._hasOverflow = items.length > 0;
|
|
504
|
+
this.toggleAttribute('has-overflow', this._hasOverflow);
|
|
490
505
|
}
|
|
491
506
|
|
|
492
507
|
/**
|
|
@@ -502,6 +517,17 @@ export const MenuBarMixin = (superClass) =>
|
|
|
502
517
|
return this.__isRTL ? -left : right;
|
|
503
518
|
}
|
|
504
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Whether the element ends past the container, with the tolerance for fractional widths.
|
|
522
|
+
*
|
|
523
|
+
* @param {!HTMLElement} el
|
|
524
|
+
* @return {boolean}
|
|
525
|
+
* @private
|
|
526
|
+
*/
|
|
527
|
+
__isPastContainerEnd(el) {
|
|
528
|
+
return this.__getInlineEnd(el) > this.__getInlineEnd(this._container) + OVERFLOW_TOLERANCE;
|
|
529
|
+
}
|
|
530
|
+
|
|
505
531
|
/**
|
|
506
532
|
* Positions of the buttons, read in one batch before any of them is hidden.
|
|
507
533
|
* Mirrored in RTL so that a larger value is always further along the inline axis.
|
|
@@ -511,6 +537,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
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
|
|
514
541
|
*/
|
|
515
542
|
|
|
516
543
|
/**
|
|
@@ -530,6 +557,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
530
557
|
// `auto` resolves to 0 while the content overflows.
|
|
531
558
|
margins: buttons.map((btn) => parseFloat(getComputedStyle(btn).marginInlineStart) || 0),
|
|
532
559
|
overflowExtent: this.__getInlineEnd(overflow) - ends.at(-1),
|
|
560
|
+
containerWidth: this._container.getBoundingClientRect().width,
|
|
533
561
|
};
|
|
534
562
|
}
|
|
535
563
|
|
|
@@ -540,11 +568,10 @@ export const MenuBarMixin = (superClass) =>
|
|
|
540
568
|
*
|
|
541
569
|
* @param {!Array<!HTMLElement>} buttons
|
|
542
570
|
* @param {!MenuBarOverflowLayout} layout
|
|
543
|
-
* @param {number} containerWidth
|
|
544
571
|
* @return {!Array<!HTMLElement>} buttons to collapse, in DOM order
|
|
545
572
|
* @private
|
|
546
573
|
*/
|
|
547
|
-
|
|
574
|
+
__getButtonsToCollapse(buttons, { starts, ends, margins, overflowExtent, containerWidth }) {
|
|
548
575
|
let lo = 0;
|
|
549
576
|
let hi = buttons.length - 1;
|
|
550
577
|
|
|
@@ -560,39 +587,47 @@ export const MenuBarMixin = (superClass) =>
|
|
|
560
587
|
return buttons.filter((_, i) => i < lo || i > hi);
|
|
561
588
|
}
|
|
562
589
|
|
|
563
|
-
/**
|
|
590
|
+
/**
|
|
591
|
+
* Hides the buttons that do not fit next to the overflow button.
|
|
592
|
+
*
|
|
593
|
+
* @param {!Array<!HTMLElement>} buttons
|
|
594
|
+
* @param {!MenuBarOverflowLayout} layout
|
|
595
|
+
* @return {!Array<!HTMLElement>} hidden buttons, in DOM order
|
|
596
|
+
* @private
|
|
597
|
+
*/
|
|
598
|
+
__collapseButtons(buttons, layout) {
|
|
599
|
+
const collapsed = this.__getButtonsToCollapse(buttons, layout);
|
|
600
|
+
// Read button widths once outside of the loop to avoid repetitive layout
|
|
601
|
+
const widths = collapsed.map((btn) => getComputedStyle(btn).width);
|
|
602
|
+
|
|
603
|
+
// Write the DOM state
|
|
604
|
+
collapsed.forEach((btn, i) => {
|
|
605
|
+
btn.style.width = widths[i];
|
|
606
|
+
btn.style.visibility = 'hidden';
|
|
607
|
+
btn.style.position = 'absolute';
|
|
608
|
+
});
|
|
609
|
+
return collapsed;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Shows the overflow button and collapses buttons into it when the last button
|
|
614
|
+
* does not fit in the container.
|
|
615
|
+
*
|
|
616
|
+
* @param {!Array<!HTMLElement>} buttons
|
|
617
|
+
* @param {!HTMLElement} overflow
|
|
618
|
+
* @private
|
|
619
|
+
*/
|
|
564
620
|
__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
621
|
const lastButton = buttons.at(-1);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
// Prevent the container from shrinking while buttons are being hidden.
|
|
572
|
-
// The host has min-width: 0 so it can shrink inside flex/grid layouts.
|
|
573
|
-
// Without this lock, hiding a button reduces the host width, which
|
|
574
|
-
// shrinks the container (width: 100%), shifting all button positions
|
|
575
|
-
// and causing a cascading collapse where every button appears to overflow.
|
|
576
|
-
container.style.minWidth = `${width}px`;
|
|
577
|
-
this._hasOverflow = true;
|
|
578
|
-
|
|
579
|
-
// Read the layout once the overflow button is in flow
|
|
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));
|
|
593
|
-
|
|
594
|
-
container.style.minWidth = '';
|
|
622
|
+
if (!lastButton || !this.__isPastContainerEnd(lastButton)) {
|
|
623
|
+
return;
|
|
595
624
|
}
|
|
625
|
+
this._hasOverflow = true;
|
|
626
|
+
|
|
627
|
+
// Read the layout once the overflow button is in flow
|
|
628
|
+
const layout = this.__measureButtons(buttons, overflow);
|
|
629
|
+
const collapsed = this.__collapseButtons(buttons, layout);
|
|
630
|
+
this.__updateOverflow(collapsed.map((btn) => btn.item));
|
|
596
631
|
}
|
|
597
632
|
|
|
598
633
|
/** @private */
|
|
@@ -608,9 +643,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
608
643
|
const buttons = this._buttons.filter((btn) => btn !== overflow);
|
|
609
644
|
const oldOverflowCount = this.__getOverflowCount(overflow);
|
|
610
645
|
|
|
611
|
-
|
|
612
|
-
this.__restoreButtons(buttons);
|
|
613
|
-
this.__updateOverflow([]);
|
|
646
|
+
this.__restoreState(buttons);
|
|
614
647
|
|
|
615
648
|
// Hide any overflowing buttons and put them in the 'overflow' button
|
|
616
649
|
this.__setOverflowItems(buttons, overflow);
|
|
@@ -639,6 +672,11 @@ export const MenuBarMixin = (superClass) =>
|
|
|
639
672
|
this._setTabindex(visibleButtons[visibleButtons.length - 1], true);
|
|
640
673
|
}
|
|
641
674
|
|
|
675
|
+
this.__updateVisibleAttributes(visibleButtons);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** @private */
|
|
679
|
+
__updateVisibleAttributes(visibleButtons) {
|
|
642
680
|
visibleButtons.forEach((btn, index) => {
|
|
643
681
|
btn.toggleAttribute('first-visible', index === 0);
|
|
644
682
|
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.55bb86e155",
|
|
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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155",
|
|
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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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.55bb86e155/#/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
|
{
|