@momentum-design/components 0.76.4 → 0.76.5
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/dist/browser/index.js +23 -23
- package/dist/browser/index.js.map +3 -3
- package/dist/components/menubar/menubar.component.d.ts +0 -1
- package/dist/components/menubar/menubar.component.js +0 -4
- package/dist/components/menupopover/menupopover.component.js +3 -2
- package/dist/components/popover/popover.component.js +3 -5
- package/dist/custom-elements.json +24 -119
- package/dist/utils/mixins/MenuMixin.d.ts +0 -2
- package/dist/utils/mixins/MenuMixin.js +8 -16
- package/package.json +1 -1
@@ -24,7 +24,6 @@ declare const MenuBar_base: import("../../utils/mixins/index.types").Constructor
|
|
24
24
|
declare class MenuBar extends MenuBar_base {
|
25
25
|
constructor();
|
26
26
|
connectedCallback(): void;
|
27
|
-
firstUpdated(): void;
|
28
27
|
update(changedProperties: PropertyValues): void;
|
29
28
|
render(): import("lit-html").TemplateResult<1>;
|
30
29
|
static styles: Array<CSSResult>;
|
@@ -33,10 +33,6 @@ class MenuBar extends MenuMixin(Component) {
|
|
33
33
|
super.connectedCallback();
|
34
34
|
this.role = ROLE.MENUBAR;
|
35
35
|
}
|
36
|
-
firstUpdated() {
|
37
|
-
// For the first, we set the first element only as active.
|
38
|
-
this.resetTabIndexAndSetActiveTabIndex(0);
|
39
|
-
}
|
40
36
|
update(changedProperties) {
|
41
37
|
super.update(changedProperties);
|
42
38
|
if (changedProperties.has('ariaOrientation')) {
|
@@ -43,9 +43,10 @@ class MenuPopover extends MenuMixin(Popover) {
|
|
43
43
|
this.ariaOrientation = ORIENTATION.VERTICAL;
|
44
44
|
}
|
45
45
|
async firstUpdated(changedProperties) {
|
46
|
-
var _a, _b;
|
46
|
+
var _a, _b, _c;
|
47
47
|
await super.firstUpdated(changedProperties);
|
48
|
-
|
48
|
+
(_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', ROLE.MENU);
|
49
|
+
if (((_c = (_b = this.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === MENU_POPOVER) {
|
49
50
|
this.interactive = true;
|
50
51
|
this.placement = POPOVER_PLACEMENT.RIGHT_START;
|
51
52
|
}
|
@@ -496,11 +496,9 @@ class Popover extends FocusTrapMixin(Component) {
|
|
496
496
|
if (!this.disableAriaExpanded) {
|
497
497
|
this.triggerElement.removeAttribute('aria-expanded');
|
498
498
|
}
|
499
|
-
if
|
500
|
-
|
501
|
-
|
502
|
-
this.triggerElement.removeAttribute('aria-haspopup');
|
503
|
-
}
|
499
|
+
// Remove aria-haspopup if the popover is not interactive
|
500
|
+
if (!this.interactive) {
|
501
|
+
this.triggerElement.removeAttribute('aria-haspopup');
|
504
502
|
}
|
505
503
|
if (this.focusBackToTrigger) {
|
506
504
|
(_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.focus();
|
@@ -15132,41 +15132,20 @@
|
|
15132
15132
|
"module": "utils/mixins/MenuMixin.js"
|
15133
15133
|
}
|
15134
15134
|
},
|
15135
|
-
{
|
15136
|
-
"kind": "method",
|
15137
|
-
"name": "setTabIndexOnMouseClick",
|
15138
|
-
"privacy": "protected",
|
15139
|
-
"return": {
|
15140
|
-
"type": {
|
15141
|
-
"text": "void"
|
15142
|
-
}
|
15143
|
-
},
|
15144
|
-
"parameters": [
|
15145
|
-
{
|
15146
|
-
"name": "event",
|
15147
|
-
"type": {
|
15148
|
-
"text": "MouseEvent"
|
15149
|
-
},
|
15150
|
-
"description": "The mouse click event."
|
15151
|
-
}
|
15152
|
-
],
|
15153
|
-
"description": "Handles the mouse click event on the menu items.\nResets all the menu items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when clicking on the menu items.",
|
15154
|
-
"inheritedFrom": {
|
15155
|
-
"name": "MenuMixin",
|
15156
|
-
"module": "utils/mixins/MenuMixin.js"
|
15157
|
-
}
|
15158
|
-
},
|
15159
15135
|
{
|
15160
15136
|
"kind": "method",
|
15161
15137
|
"name": "resetTabIndexAndSetActiveTabIndex",
|
15162
|
-
"privacy": "
|
15138
|
+
"privacy": "private",
|
15163
15139
|
"parameters": [
|
15164
15140
|
{
|
15165
|
-
"name": "
|
15141
|
+
"name": "menuItems",
|
15166
15142
|
"type": {
|
15167
|
-
"text": "
|
15168
|
-
}
|
15169
|
-
|
15143
|
+
"text": "Array<HTMLElement>"
|
15144
|
+
}
|
15145
|
+
},
|
15146
|
+
{
|
15147
|
+
"description": "The index of the new active element in the list.",
|
15148
|
+
"name": "newIndex"
|
15170
15149
|
}
|
15171
15150
|
],
|
15172
15151
|
"description": "Resets all list items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when navigating the list via keyboard.",
|
@@ -18028,41 +18007,20 @@
|
|
18028
18007
|
"module": "utils/mixins/MenuMixin.js"
|
18029
18008
|
}
|
18030
18009
|
},
|
18031
|
-
{
|
18032
|
-
"kind": "method",
|
18033
|
-
"name": "setTabIndexOnMouseClick",
|
18034
|
-
"privacy": "protected",
|
18035
|
-
"return": {
|
18036
|
-
"type": {
|
18037
|
-
"text": "void"
|
18038
|
-
}
|
18039
|
-
},
|
18040
|
-
"parameters": [
|
18041
|
-
{
|
18042
|
-
"name": "event",
|
18043
|
-
"type": {
|
18044
|
-
"text": "MouseEvent"
|
18045
|
-
},
|
18046
|
-
"description": "The mouse click event."
|
18047
|
-
}
|
18048
|
-
],
|
18049
|
-
"description": "Handles the mouse click event on the menu items.\nResets all the menu items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when clicking on the menu items.",
|
18050
|
-
"inheritedFrom": {
|
18051
|
-
"name": "MenuMixin",
|
18052
|
-
"module": "utils/mixins/MenuMixin.js"
|
18053
|
-
}
|
18054
|
-
},
|
18055
18010
|
{
|
18056
18011
|
"kind": "method",
|
18057
18012
|
"name": "resetTabIndexAndSetActiveTabIndex",
|
18058
|
-
"privacy": "
|
18013
|
+
"privacy": "private",
|
18059
18014
|
"parameters": [
|
18060
18015
|
{
|
18061
|
-
"name": "
|
18016
|
+
"name": "menuItems",
|
18062
18017
|
"type": {
|
18063
|
-
"text": "
|
18064
|
-
}
|
18065
|
-
|
18018
|
+
"text": "Array<HTMLElement>"
|
18019
|
+
}
|
18020
|
+
},
|
18021
|
+
{
|
18022
|
+
"description": "The index of the new active element in the list.",
|
18023
|
+
"name": "newIndex"
|
18066
18024
|
}
|
18067
18025
|
],
|
18068
18026
|
"description": "Resets all list items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when navigating the list via keyboard.",
|
@@ -35042,42 +35000,6 @@
|
|
35042
35000
|
}
|
35043
35001
|
]
|
35044
35002
|
},
|
35045
|
-
{
|
35046
|
-
"kind": "method",
|
35047
|
-
"name": "resetTabIndexAndSetActiveTabIndex",
|
35048
|
-
"privacy": "protected",
|
35049
|
-
"return": {
|
35050
|
-
"type": {
|
35051
|
-
"text": "void"
|
35052
|
-
}
|
35053
|
-
},
|
35054
|
-
"parameters": [
|
35055
|
-
{
|
35056
|
-
"name": "newIndex",
|
35057
|
-
"type": {
|
35058
|
-
"text": "number"
|
35059
|
-
}
|
35060
|
-
}
|
35061
|
-
]
|
35062
|
-
},
|
35063
|
-
{
|
35064
|
-
"kind": "method",
|
35065
|
-
"name": "setTabIndexOnMouseClick",
|
35066
|
-
"privacy": "protected",
|
35067
|
-
"return": {
|
35068
|
-
"type": {
|
35069
|
-
"text": "void"
|
35070
|
-
}
|
35071
|
-
},
|
35072
|
-
"parameters": [
|
35073
|
-
{
|
35074
|
-
"name": "event",
|
35075
|
-
"type": {
|
35076
|
-
"text": "MouseEvent"
|
35077
|
-
}
|
35078
|
-
}
|
35079
|
-
]
|
35080
|
-
},
|
35081
35003
|
{
|
35082
35004
|
"kind": "method",
|
35083
35005
|
"name": "updatePopoverPlacementBasedOnOrientation",
|
@@ -35517,37 +35439,20 @@
|
|
35517
35439
|
],
|
35518
35440
|
"description": "Checks if the given menu item is a valid menu item."
|
35519
35441
|
},
|
35520
|
-
{
|
35521
|
-
"kind": "method",
|
35522
|
-
"name": "setTabIndexOnMouseClick",
|
35523
|
-
"privacy": "protected",
|
35524
|
-
"return": {
|
35525
|
-
"type": {
|
35526
|
-
"text": "void"
|
35527
|
-
}
|
35528
|
-
},
|
35529
|
-
"parameters": [
|
35530
|
-
{
|
35531
|
-
"name": "event",
|
35532
|
-
"type": {
|
35533
|
-
"text": "MouseEvent"
|
35534
|
-
},
|
35535
|
-
"description": "The mouse click event."
|
35536
|
-
}
|
35537
|
-
],
|
35538
|
-
"description": "Handles the mouse click event on the menu items.\nResets all the menu items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when clicking on the menu items."
|
35539
|
-
},
|
35540
35442
|
{
|
35541
35443
|
"kind": "method",
|
35542
35444
|
"name": "resetTabIndexAndSetActiveTabIndex",
|
35543
|
-
"privacy": "
|
35445
|
+
"privacy": "private",
|
35544
35446
|
"parameters": [
|
35545
35447
|
{
|
35546
|
-
"name": "
|
35448
|
+
"name": "menuItems",
|
35547
35449
|
"type": {
|
35548
|
-
"text": "
|
35549
|
-
}
|
35550
|
-
|
35450
|
+
"text": "Array<HTMLElement>"
|
35451
|
+
}
|
35452
|
+
},
|
35453
|
+
{
|
35454
|
+
"description": "The index of the new active element in the list.",
|
35455
|
+
"name": "newIndex"
|
35551
35456
|
}
|
35552
35457
|
],
|
35553
35458
|
"description": "Resets all list items tabindex to -1 and sets the tabindex of the\nelement at the given index to 0, effectively setting the active\nelement. This is used when navigating the list via keyboard."
|
@@ -5,8 +5,6 @@ export declare class MenuMixinInterface {
|
|
5
5
|
ariaOrientation: Orientation;
|
6
6
|
protected handleKeyDown(event: KeyboardEvent): void;
|
7
7
|
protected handleMouseClick(event: MouseEvent): void;
|
8
|
-
protected resetTabIndexAndSetActiveTabIndex(newIndex: number): void;
|
9
|
-
protected setTabIndexOnMouseClick(event: MouseEvent): void;
|
10
8
|
protected updatePopoverPlacementBasedOnOrientation(): void;
|
11
9
|
}
|
12
10
|
export declare const MenuMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<MenuMixinInterface> & T;
|
@@ -47,6 +47,7 @@ export const MenuMixin = (superClass) => {
|
|
47
47
|
firstUpdated(changedProperties) {
|
48
48
|
super.firstUpdated(changedProperties);
|
49
49
|
this.setMenuBarPopoverValue(false);
|
50
|
+
this.resetTabIndexAndSetActiveTabIndex(this.menuItems);
|
50
51
|
}
|
51
52
|
/**
|
52
53
|
* Sets the value of the data-menu-popover-open attribute on the menu element.
|
@@ -202,6 +203,10 @@ export const MenuMixin = (superClass) => {
|
|
202
203
|
if (this.isValidPopover(menu === null || menu === void 0 ? void 0 : menu.tagName)) {
|
203
204
|
menu === null || menu === void 0 ? void 0 : menu.toggleAttribute('visible');
|
204
205
|
}
|
206
|
+
if (menu === null || menu === void 0 ? void 0 : menu.children) {
|
207
|
+
const menuChildren = Array.from(menu.children).filter((child) => this.isValidMenuItem(child));
|
208
|
+
this.resetTabIndexAndSetActiveTabIndex(menuChildren);
|
209
|
+
}
|
205
210
|
if (menu === null || menu === void 0 ? void 0 : menu.parentElement) {
|
206
211
|
this.hideAllPopovers(menu.parentElement);
|
207
212
|
}
|
@@ -300,19 +305,6 @@ export const MenuMixin = (superClass) => {
|
|
300
305
|
return [MENUITEM_TAGNAME, MENUITEMCHECKBOX_TAGNAME, MENUITEMRADIO_TAGNAME]
|
301
306
|
.includes((_a = menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
302
307
|
}
|
303
|
-
/**
|
304
|
-
* Handles the mouse click event on the menu items.
|
305
|
-
* Resets all the menu items tabindex to -1 and sets the tabindex of the
|
306
|
-
* element at the given index to 0, effectively setting the active
|
307
|
-
* element. This is used when clicking on the menu items.
|
308
|
-
* @param event - The mouse click event.
|
309
|
-
*/
|
310
|
-
setTabIndexOnMouseClick(event) {
|
311
|
-
var _a;
|
312
|
-
const newIndex = this.getCurrentIndex(event.target);
|
313
|
-
this.resetTabIndexAndSetActiveTabIndex(newIndex);
|
314
|
-
(_a = this.menuItems[newIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
315
|
-
}
|
316
308
|
/**
|
317
309
|
* Resets all list items tabindex to -1 and sets the tabindex of the
|
318
310
|
* element at the given index to 0, effectively setting the active
|
@@ -320,9 +312,9 @@ export const MenuMixin = (superClass) => {
|
|
320
312
|
*
|
321
313
|
* @param newIndex - The index of the new active element in the list.
|
322
314
|
*/
|
323
|
-
resetTabIndexAndSetActiveTabIndex(
|
324
|
-
|
325
|
-
const newTabindex =
|
315
|
+
resetTabIndexAndSetActiveTabIndex(menuItems) {
|
316
|
+
menuItems.forEach((node, index) => {
|
317
|
+
const newTabindex = index === 0 ? '0' : '-1';
|
326
318
|
node === null || node === void 0 ? void 0 : node.setAttribute('tabindex', newTabindex);
|
327
319
|
});
|
328
320
|
}
|
package/package.json
CHANGED