@vaadin/menu-bar 25.4.0-dev.55bb86e155 → 25.4.0-rc1
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 +11 -47
- package/package.json +15 -15
- package/src/styles/vaadin-menu-bar-base-styles.js +6 -0
- package/src/vaadin-menu-bar-mixin.js +50 -27
- package/web-types.json +3 -3
- package/web-types.lit.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -48,16 +48,11 @@
|
|
|
48
48
|
{
|
|
49
49
|
"kind": "field",
|
|
50
50
|
"name": "i18n",
|
|
51
|
-
"
|
|
51
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n```js\n{\n moreOptions: 'More options'\n}\n```",
|
|
52
52
|
"type": {
|
|
53
|
-
"text": "
|
|
53
|
+
"text": "MenuBarI18n | undefined"
|
|
54
54
|
},
|
|
55
|
-
"
|
|
56
|
-
"attribute": "i18n",
|
|
57
|
-
"inheritedFrom": {
|
|
58
|
-
"name": "I18nMixin",
|
|
59
|
-
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
60
|
-
}
|
|
55
|
+
"privacy": "public"
|
|
61
56
|
},
|
|
62
57
|
{
|
|
63
58
|
"kind": "field",
|
|
@@ -66,8 +61,7 @@
|
|
|
66
61
|
"type": {
|
|
67
62
|
"text": "!Array<!MenuBarItem>"
|
|
68
63
|
},
|
|
69
|
-
"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```\n\n#### Disabled items\n\nWhen disabled, menu bar items are rendered as \"dimmed\".\n\nBy default, disabled items are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can be\naddressed by enabling several feature flags, which makes disabled items\nfocusable and hoverable, while still preventing them from being activated:\n\n```js\n// Allow focus and hover interactions with disabled menu bar root items (buttons)\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n\n// Allow focus and hover interactions with disabled menu bar sub-menu items\nwindow.Vaadin.featureFlags.accessibleDisabledMenuItems = true;\n```\n\nBoth flags must be set before any menu bar is attached to the DOM.\n\n#### Item tooltips\n\nButtons and sub-menu items can have tooltips that are shown on\nhover and keyboard focus. To enable them, add a slotted\n`<vaadin-tooltip>` element and set the `tooltip` property on\neach item that should have one:\n\n```html\n<vaadin-menu-bar>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-menu-bar>\n```"
|
|
70
|
-
"attribute": "items"
|
|
64
|
+
"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```\n\n#### Disabled items\n\nWhen disabled, menu bar items are rendered as \"dimmed\".\n\nBy default, disabled items are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can be\naddressed by enabling several feature flags, which makes disabled items\nfocusable and hoverable, while still preventing them from being activated:\n\n```js\n// Allow focus and hover interactions with disabled menu bar root items (buttons)\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n\n// Allow focus and hover interactions with disabled menu bar sub-menu items\nwindow.Vaadin.featureFlags.accessibleDisabledMenuItems = true;\n```\n\nBoth flags must be set before any menu bar is attached to the DOM.\n\n#### Item tooltips\n\nButtons and sub-menu items can have tooltips that are shown on\nhover and keyboard focus. To enable them, add a slotted\n`<vaadin-tooltip>` element and set the `tooltip` property on\neach item that should have one:\n\n```html\n<vaadin-menu-bar>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-menu-bar>\n```"
|
|
71
65
|
},
|
|
72
66
|
{
|
|
73
67
|
"kind": "field",
|
|
@@ -121,18 +115,6 @@
|
|
|
121
115
|
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
122
116
|
}
|
|
123
117
|
},
|
|
124
|
-
{
|
|
125
|
-
"name": "i18n",
|
|
126
|
-
"type": {
|
|
127
|
-
"text": "Object | undefined"
|
|
128
|
-
},
|
|
129
|
-
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
130
|
-
"fieldName": "i18n",
|
|
131
|
-
"inheritedFrom": {
|
|
132
|
-
"name": "I18nMixin",
|
|
133
|
-
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
118
|
{
|
|
137
119
|
"name": "open-on-hover",
|
|
138
120
|
"type": {
|
|
@@ -332,15 +314,14 @@
|
|
|
332
314
|
{
|
|
333
315
|
"kind": "field",
|
|
334
316
|
"name": "i18n",
|
|
335
|
-
"
|
|
317
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n```js\n{\n moreOptions: 'More options'\n}\n```",
|
|
336
318
|
"type": {
|
|
337
|
-
"text": "
|
|
319
|
+
"text": "MenuBarI18n | undefined"
|
|
338
320
|
},
|
|
339
|
-
"
|
|
340
|
-
"attribute": "i18n",
|
|
321
|
+
"privacy": "public",
|
|
341
322
|
"inheritedFrom": {
|
|
342
|
-
"name": "
|
|
343
|
-
"
|
|
323
|
+
"name": "MenuBarMixin",
|
|
324
|
+
"module": "src/vaadin-menu-bar-mixin.js"
|
|
344
325
|
}
|
|
345
326
|
},
|
|
346
327
|
{
|
|
@@ -351,7 +332,6 @@
|
|
|
351
332
|
"text": "!Array<!MenuBarItem>"
|
|
352
333
|
},
|
|
353
334
|
"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```\n\n#### Disabled items\n\nWhen disabled, menu bar items are rendered as \"dimmed\".\n\nBy default, disabled items are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can be\naddressed by enabling several feature flags, which makes disabled items\nfocusable and hoverable, while still preventing them from being activated:\n\n```js\n// Allow focus and hover interactions with disabled menu bar root items (buttons)\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n\n// Allow focus and hover interactions with disabled menu bar sub-menu items\nwindow.Vaadin.featureFlags.accessibleDisabledMenuItems = true;\n```\n\nBoth flags must be set before any menu bar is attached to the DOM.\n\n#### Item tooltips\n\nButtons and sub-menu items can have tooltips that are shown on\nhover and keyboard focus. To enable them, add a slotted\n`<vaadin-tooltip>` element and set the `tooltip` property on\neach item that should have one:\n\n```html\n<vaadin-menu-bar>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-menu-bar>\n```",
|
|
354
|
-
"attribute": "items",
|
|
355
335
|
"inheritedFrom": {
|
|
356
336
|
"name": "MenuBarMixin",
|
|
357
337
|
"module": "src/vaadin-menu-bar-mixin.js"
|
|
@@ -402,15 +382,11 @@
|
|
|
402
382
|
],
|
|
403
383
|
"events": [
|
|
404
384
|
{
|
|
405
|
-
"name": "item-selected",
|
|
406
385
|
"type": {
|
|
407
|
-
"text": "CustomEvent"
|
|
386
|
+
"text": "CustomEvent<boolean>"
|
|
408
387
|
},
|
|
409
388
|
"description": "Fired when a submenu item or menu bar button without children is clicked.",
|
|
410
|
-
"
|
|
411
|
-
"name": "MenuBarMixin",
|
|
412
|
-
"module": "src/vaadin-menu-bar-mixin.js"
|
|
413
|
-
}
|
|
389
|
+
"name": "item-selected"
|
|
414
390
|
}
|
|
415
391
|
],
|
|
416
392
|
"attributes": [
|
|
@@ -426,18 +402,6 @@
|
|
|
426
402
|
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
427
403
|
}
|
|
428
404
|
},
|
|
429
|
-
{
|
|
430
|
-
"name": "i18n",
|
|
431
|
-
"type": {
|
|
432
|
-
"text": "Object | undefined"
|
|
433
|
-
},
|
|
434
|
-
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
435
|
-
"fieldName": "i18n",
|
|
436
|
-
"inheritedFrom": {
|
|
437
|
-
"name": "I18nMixin",
|
|
438
|
-
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
405
|
{
|
|
442
406
|
"name": "open-on-hover",
|
|
443
407
|
"type": {
|
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-rc1",
|
|
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-rc1",
|
|
39
|
+
"@vaadin/button": "25.4.0-rc1",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-rc1",
|
|
41
|
+
"@vaadin/context-menu": "25.4.0-rc1",
|
|
42
|
+
"@vaadin/item": "25.4.0-rc1",
|
|
43
|
+
"@vaadin/list-box": "25.4.0-rc1",
|
|
44
|
+
"@vaadin/overlay": "25.4.0-rc1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-rc1",
|
|
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-rc1",
|
|
50
|
+
"@vaadin/chai-plugins": "25.4.0-rc1",
|
|
51
|
+
"@vaadin/icon": "25.4.0-rc1",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.4.0-rc1",
|
|
53
53
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-rc1",
|
|
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": "abe6d2338024cb71110c7df9bd5d97c0d110a135"
|
|
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;
|
|
@@ -529,8 +528,9 @@ export const MenuBarMixin = (superClass) =>
|
|
|
529
528
|
}
|
|
530
529
|
|
|
531
530
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
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.
|
|
534
534
|
*
|
|
535
535
|
* @typedef {object} MenuBarOverflowLayout
|
|
536
536
|
* @property {number[]} starts Inline start of each button
|
|
@@ -538,6 +538,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
538
538
|
* @property {number[]} margins Inline start margin of each button
|
|
539
539
|
* @property {number} overflowExtent Space the overflow button adds after the last button
|
|
540
540
|
* @property {number} containerWidth Width of the container
|
|
541
|
+
* @property {number} contentWidth Width of all buttons and the overflow button in flow
|
|
541
542
|
*/
|
|
542
543
|
|
|
543
544
|
/**
|
|
@@ -546,18 +547,22 @@ export const MenuBarMixin = (superClass) =>
|
|
|
546
547
|
* @return {!MenuBarOverflowLayout}
|
|
547
548
|
* @private
|
|
548
549
|
*/
|
|
549
|
-
|
|
550
|
+
__getOverflowLayout(buttons, overflow) {
|
|
550
551
|
const isRTL = this.__isRTL;
|
|
551
552
|
const rects = buttons.map((btn) => btn.getBoundingClientRect());
|
|
552
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;
|
|
553
557
|
|
|
554
558
|
return {
|
|
555
559
|
starts: rects.map(({ left, right }) => (isRTL ? -right : left)),
|
|
556
560
|
ends,
|
|
557
561
|
// `auto` resolves to 0 while the content overflows.
|
|
558
562
|
margins: buttons.map((btn) => parseFloat(getComputedStyle(btn).marginInlineStart) || 0),
|
|
559
|
-
overflowExtent:
|
|
560
|
-
containerWidth:
|
|
563
|
+
overflowExtent: overflowEnd - ends.at(-1),
|
|
564
|
+
containerWidth: containerRect.width,
|
|
565
|
+
contentWidth: overflowEnd - containerStart,
|
|
561
566
|
};
|
|
562
567
|
}
|
|
563
568
|
|
|
@@ -588,30 +593,32 @@ export const MenuBarMixin = (superClass) =>
|
|
|
588
593
|
}
|
|
589
594
|
|
|
590
595
|
/**
|
|
591
|
-
*
|
|
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.
|
|
592
601
|
*
|
|
593
|
-
* @param {
|
|
594
|
-
* @param {!MenuBarOverflowLayout} layout
|
|
595
|
-
* @return {!Array<!HTMLElement>} hidden buttons, in DOM order
|
|
602
|
+
* @param {number} width
|
|
596
603
|
* @private
|
|
597
604
|
*/
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
605
|
+
__freezeWidth(width) {
|
|
606
|
+
this.style.setProperty('--_vaadin-menu-bar-content-width', `${width}px`);
|
|
607
|
+
this.setAttribute('overflow-frozen', '');
|
|
608
|
+
}
|
|
602
609
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
btn.style.position = 'absolute';
|
|
608
|
-
});
|
|
609
|
-
return collapsed;
|
|
610
|
+
/** @private */
|
|
611
|
+
__unfreezeWidth() {
|
|
612
|
+
this.style.removeProperty('--_vaadin-menu-bar-content-width');
|
|
613
|
+
this.removeAttribute('overflow-frozen');
|
|
610
614
|
}
|
|
611
615
|
|
|
612
616
|
/**
|
|
613
617
|
* Shows the overflow button and collapses buttons into it when the last button
|
|
614
|
-
* does not fit in the container.
|
|
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.
|
|
615
622
|
*
|
|
616
623
|
* @param {!Array<!HTMLElement>} buttons
|
|
617
624
|
* @param {!HTMLElement} overflow
|
|
@@ -619,15 +626,31 @@ export const MenuBarMixin = (superClass) =>
|
|
|
619
626
|
*/
|
|
620
627
|
__setOverflowItems(buttons, overflow) {
|
|
621
628
|
const lastButton = buttons.at(-1);
|
|
622
|
-
|
|
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();
|
|
623
634
|
return;
|
|
624
635
|
}
|
|
625
636
|
this._hasOverflow = true;
|
|
626
637
|
|
|
627
638
|
// Read the layout once the overflow button is in flow
|
|
628
|
-
const layout = this.
|
|
629
|
-
const collapsed = this.
|
|
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
|
+
});
|
|
630
647
|
this.__updateOverflow(collapsed.map((btn) => btn.item));
|
|
648
|
+
|
|
649
|
+
if (collapsed.length === 0) {
|
|
650
|
+
this.__unfreezeWidth();
|
|
651
|
+
} else if (wasFrozen || this.__isPastContainerEnd(overflow)) {
|
|
652
|
+
this.__freezeWidth(layout.contentWidth);
|
|
653
|
+
}
|
|
631
654
|
}
|
|
632
655
|
|
|
633
656
|
/** @private */
|
|
@@ -669,7 +692,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
669
692
|
} else if (!visibleButtons.some((btn) => btn.getAttribute('tabindex') === '0')) {
|
|
670
693
|
// Ensure there is at least one button with tabindex set to 0
|
|
671
694
|
// so that menu-bar is not skipped when navigating with Tab
|
|
672
|
-
this._setTabindex(visibleButtons
|
|
695
|
+
this._setTabindex(visibleButtons.at(-1), true);
|
|
673
696
|
}
|
|
674
697
|
|
|
675
698
|
this.__updateVisibleAttributes(visibleButtons);
|
|
@@ -1101,7 +1124,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
1101
1124
|
/** @private */
|
|
1102
1125
|
_focusLastItem() {
|
|
1103
1126
|
const list = this._subMenu._menuListBox;
|
|
1104
|
-
const item = list.items
|
|
1127
|
+
const item = list.items.at(-1);
|
|
1105
1128
|
if (item) {
|
|
1106
1129
|
item.focus();
|
|
1107
1130
|
}
|
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-rc1",
|
|
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-rc1/#/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-rc1/#/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-rc1/#/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-rc1/#/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-rc1/#/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",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n```js\n{\n moreOptions: 'More options'\n}\n```",
|
|
73
73
|
"value": {
|
|
74
74
|
"type": [
|
|
75
|
-
"
|
|
75
|
+
"MenuBarI18n",
|
|
76
76
|
"undefined"
|
|
77
77
|
]
|
|
78
78
|
}
|
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-rc1",
|
|
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-rc1/#/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-rc1/#/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-rc1/#/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-rc1/#/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-rc1/#/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
|
{
|