@momentum-design/components 0.76.3 → 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.
@@ -37,17 +37,17 @@ export { default as MenuItem } from './menuitem';
37
37
  export { default as MenuItemCheckbox } from './menuitemcheckbox';
38
38
  export { default as MenuItemRadio } from './menuitemradio';
39
39
  export { default as MenuPopover } from './menupopover';
40
- export { default as OptGroup } from './optgroup';
41
40
  export { default as MenuSection } from './menusection';
41
+ export { default as OptGroup } from './optgroup';
42
42
  export { default as Option } from './option';
43
43
  export { default as Popover } from './popover';
44
44
  export { default as Presence } from './presence';
45
45
  export { default as Progressbar } from './progressbar';
46
46
  export { default as Progressspinner } from './progressspinner';
47
47
  export { default as Radio } from './radio';
48
+ export { default as RadioGroup } from './radiogroup';
48
49
  export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
49
50
  export { default as Searchfield } from './searchfield';
50
- export { default as RadioGroup } from './radiogroup';
51
51
  export { default as Select } from './select';
52
52
  export { default as Spinner } from './spinner';
53
53
  export { default as StaticCheckbox } from './staticcheckbox';
@@ -37,17 +37,17 @@ export { default as MenuItem } from './menuitem';
37
37
  export { default as MenuItemCheckbox } from './menuitemcheckbox';
38
38
  export { default as MenuItemRadio } from './menuitemradio';
39
39
  export { default as MenuPopover } from './menupopover';
40
- export { default as OptGroup } from './optgroup';
41
40
  export { default as MenuSection } from './menusection';
41
+ export { default as OptGroup } from './optgroup';
42
42
  export { default as Option } from './option';
43
43
  export { default as Popover } from './popover';
44
44
  export { default as Presence } from './presence';
45
45
  export { default as Progressbar } from './progressbar';
46
46
  export { default as Progressspinner } from './progressspinner';
47
47
  export { default as Radio } from './radio';
48
+ export { default as RadioGroup } from './radiogroup';
48
49
  export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
49
50
  export { default as Searchfield } from './searchfield';
50
- export { default as RadioGroup } from './radiogroup';
51
51
  export { default as Select } from './select';
52
52
  export { default as Spinner } from './spinner';
53
53
  export { default as StaticCheckbox } from './staticcheckbox';
@@ -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(newIndex) {
324
- this.menuItems.forEach((node, index) => {
325
- const newTabindex = newIndex === index ? '0' : '-1';
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
@@ -41,5 +41,5 @@
41
41
  "lottie-web": "^5.12.2",
42
42
  "uuid": "^11.0.5"
43
43
  },
44
- "version": "0.76.3"
44
+ "version": "0.76.5"
45
45
  }