@momentum-design/components 0.74.2 → 0.74.4

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.
Files changed (60) hide show
  1. package/dist/browser/index.js +396 -366
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/animation/animation.component.js +1 -1
  4. package/dist/components/listitem/listitem.component.d.ts +5 -0
  5. package/dist/components/listitem/listitem.component.js +25 -2
  6. package/dist/components/menu/index.d.ts +8 -0
  7. package/dist/components/menu/index.js +5 -0
  8. package/dist/components/menu/menu.component.d.ts +19 -0
  9. package/dist/components/menu/menu.component.js +35 -0
  10. package/dist/components/menu/menu.constants.d.ts +2 -0
  11. package/dist/components/menu/menu.constants.js +3 -0
  12. package/dist/components/menubar/index.d.ts +7 -0
  13. package/dist/components/menubar/index.js +4 -0
  14. package/dist/components/menubar/menubar.component.d.ts +32 -0
  15. package/dist/components/menubar/menubar.component.js +51 -0
  16. package/dist/components/menubar/menubar.constants.d.ts +6 -0
  17. package/dist/components/menubar/menubar.constants.js +7 -0
  18. package/dist/components/menubar/menubar.styles.d.ts +2 -0
  19. package/dist/components/menubar/menubar.styles.js +15 -0
  20. package/dist/components/menubar/menubar.types.d.ts +4 -0
  21. package/dist/components/menubar/menubar.types.js +1 -0
  22. package/dist/components/menuitem/index.d.ts +1 -0
  23. package/dist/components/menuitem/index.js +1 -0
  24. package/dist/components/menuitem/menuitem.component.d.ts +27 -0
  25. package/dist/components/menuitem/menuitem.component.js +54 -1
  26. package/dist/components/menuitem/menuitem.constants.d.ts +13 -1
  27. package/dist/components/menuitem/menuitem.constants.js +13 -1
  28. package/dist/components/menuitem/menuitem.styles.d.ts +2 -0
  29. package/dist/components/menuitem/menuitem.styles.js +11 -0
  30. package/dist/components/menuitem/menuitem.types.d.ts +5 -1
  31. package/dist/components/menupopover/index.d.ts +7 -0
  32. package/dist/components/menupopover/index.js +4 -0
  33. package/dist/components/menupopover/menupopover.component.d.ts +30 -0
  34. package/dist/components/menupopover/menupopover.component.js +56 -0
  35. package/dist/components/menupopover/menupopover.constants.d.ts +2 -0
  36. package/dist/components/menupopover/menupopover.constants.js +3 -0
  37. package/dist/components/menupopover/menupopover.styles.d.ts +2 -0
  38. package/dist/components/menupopover/menupopover.styles.js +7 -0
  39. package/dist/components/menusection/menusection.component.d.ts +0 -9
  40. package/dist/components/menusection/menusection.component.js +0 -19
  41. package/dist/custom-elements.json +13767 -9589
  42. package/dist/index.d.ts +8 -5
  43. package/dist/index.js +8 -5
  44. package/dist/react/index.d.ts +4 -1
  45. package/dist/react/index.js +4 -1
  46. package/dist/react/listitem/index.d.ts +1 -0
  47. package/dist/react/listitem/index.js +1 -0
  48. package/dist/react/menu/index.d.ts +13 -0
  49. package/dist/react/menu/index.js +22 -0
  50. package/dist/react/menubar/index.d.ts +23 -0
  51. package/dist/react/menubar/index.js +32 -0
  52. package/dist/react/menuitem/index.d.ts +2 -0
  53. package/dist/react/menuitem/index.js +2 -0
  54. package/dist/react/menupopover/index.d.ts +29 -0
  55. package/dist/react/menupopover/index.js +37 -0
  56. package/dist/utils/keys.d.ts +2 -0
  57. package/dist/utils/keys.js +2 -0
  58. package/dist/utils/mixins/MenuMixin.d.ts +12 -0
  59. package/dist/utils/mixins/MenuMixin.js +474 -0
  60. package/package.json +1 -1
@@ -11,7 +11,7 @@ import { html } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
12
  import { createRef, ref } from 'lit/directives/ref.js';
13
13
  import lottie from 'lottie-web/build/player/lottie_light';
14
- import animationManifest from '@momentum-design/animations/dist/manifest.js';
14
+ import animationManifest from '@momentum-design/animations/dist/manifest';
15
15
  import styles from './animation.styles';
16
16
  import { Component } from '../../models';
17
17
  import { DEFAULTS } from './animation.constants';
@@ -24,6 +24,7 @@ declare const ListItem_base: import("../../utils/mixins/index.types").Constructo
24
24
  * @tagname mdc-listitem
25
25
  *
26
26
  * @dependency mdc-text
27
+ * @dependency mdc-tooltip
27
28
  *
28
29
  * @slot leading-controls - slot for list item controls to appear of leading end.
29
30
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -96,6 +97,8 @@ declare class ListItem extends ListItem_base {
96
97
  tooltipPlacement: PopoverPlacement;
97
98
  constructor();
98
99
  connectedCallback(): void;
100
+ private handleKeyDown;
101
+ private triggerClickEvent;
99
102
  private handleClick;
100
103
  /**
101
104
  * Display a tooltip for the listitem.
@@ -123,6 +126,8 @@ declare class ListItem extends ListItem_base {
123
126
  */
124
127
  private disableSlottedChildren;
125
128
  update(changedProperties: PropertyValues): void;
129
+ protected renderTrailingControls(): TemplateResult<1>;
130
+ protected renderLeadingControls(): TemplateResult<1>;
126
131
  render(): TemplateResult<1>;
127
132
  static styles: Array<CSSResult>;
128
133
  }
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { html, nothing } from 'lit';
11
11
  import { property, queryAssignedElements } from 'lit/decorators.js';
12
12
  import { Component } from '../../models';
13
+ import { KEYS } from '../../utils/keys';
13
14
  import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
14
15
  import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
15
16
  import { ROLE } from '../../utils/roles';
@@ -36,6 +37,7 @@ import styles from './listitem.styles';
36
37
  * @tagname mdc-listitem
37
38
  *
38
39
  * @dependency mdc-text
40
+ * @dependency mdc-tooltip
39
41
  *
40
42
  * @slot leading-controls - slot for list item controls to appear of leading end.
41
43
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -75,6 +77,7 @@ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
75
77
  * @default 'top'
76
78
  */
77
79
  this.tooltipPlacement = DEFAULTS.TOOLTIP_PLACEMENT;
80
+ this.addEventListener('keydown', this.handleKeyDown);
78
81
  this.addEventListener('focusin', this.displayTooltipForLongText);
79
82
  this.addEventListener('mouseover', this.displayTooltipForLongText);
80
83
  this.addEventListener('focusout', this.hideTooltipOnLeave);
@@ -85,6 +88,20 @@ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
85
88
  super.connectedCallback();
86
89
  this.role = this.role || ROLE.LISTITEM;
87
90
  }
91
+ handleKeyDown(event) {
92
+ if (event.key === KEYS.ENTER || event.key === KEYS.SPACE) {
93
+ this.triggerClickEvent();
94
+ event.preventDefault();
95
+ }
96
+ }
97
+ triggerClickEvent() {
98
+ const clickEvent = new MouseEvent('click', {
99
+ bubbles: true,
100
+ cancelable: true,
101
+ view: window,
102
+ });
103
+ this.dispatchEvent(clickEvent);
104
+ }
88
105
  handleClick() {
89
106
  // If the tooltip is open, it has to be closed first.
90
107
  this.hideTooltipOnLeave();
@@ -161,10 +178,16 @@ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
161
178
  this.setAttribute('aria-disabled', `${this.disabled}`);
162
179
  }
163
180
  }
181
+ renderTrailingControls() {
182
+ return html `<slot name="trailing-controls"></slot>`;
183
+ }
184
+ renderLeadingControls() {
185
+ return html `<slot name="leading-controls"></slot>`;
186
+ }
164
187
  render() {
165
188
  return html `
166
189
  <div part="leading">
167
- <slot name="leading-controls"></slot>
190
+ ${this.renderLeadingControls()}
168
191
  <div part="leading-text">
169
192
  ${this.getText('leading-text-primary-label', TYPE.BODY_MIDSIZE_REGULAR, this.label)}
170
193
  ${this.getText('leading-text-secondary-label', TYPE.BODY_SMALL_REGULAR, this.secondaryLabel)}
@@ -176,7 +199,7 @@ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
176
199
  ${this.getText('trailing-text-side-header', TYPE.BODY_MIDSIZE_REGULAR, this.sideHeaderText)}
177
200
  ${this.getText('trailing-text-subline', TYPE.BODY_SMALL_REGULAR, this.sublineText)}
178
201
  </div>
179
- <slot name="trailing-controls"></slot>
202
+ ${this.renderTrailingControls()}
180
203
  </div>
181
204
  `;
182
205
  }
@@ -0,0 +1,8 @@
1
+ import '../text';
2
+ import Menu from './menu.component';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ ['mdc-menu']: Menu;
6
+ }
7
+ }
8
+ export default Menu;
@@ -0,0 +1,5 @@
1
+ import '../text';
2
+ import Menu from './menu.component';
3
+ import { TAG_NAME } from './menu.constants';
4
+ Menu.register(TAG_NAME);
5
+ export default Menu;
@@ -0,0 +1,19 @@
1
+ import { CSSResult } from 'lit';
2
+ import List from '../list/list.component';
3
+ /**
4
+ * mdc-menu component is used to display a group of menu items. It is used as a container to wrap menu items.
5
+ * It contains the menu header component.
6
+ *
7
+ * @dependency mdc-text
8
+ *
9
+ * @tagname mdc-menu
10
+ *
11
+ * @slot default - This is a default/unnamed slot
12
+ */
13
+ declare class Menu extends List {
14
+ /** @internal */
15
+ listItems: Array<HTMLElement>;
16
+ connectedCallback(): void;
17
+ static styles: Array<CSSResult>;
18
+ }
19
+ export default Menu;
@@ -0,0 +1,35 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { queryAssignedElements } from 'lit/decorators.js';
11
+ import { ROLE } from '../../utils/roles';
12
+ import List from '../list/list.component';
13
+ import { TAG_NAME as MENUITEM_TAGNAME } from '../menuitem/menuitem.constants';
14
+ /**
15
+ * mdc-menu component is used to display a group of menu items. It is used as a container to wrap menu items.
16
+ * It contains the menu header component.
17
+ *
18
+ * @dependency mdc-text
19
+ *
20
+ * @tagname mdc-menu
21
+ *
22
+ * @slot default - This is a default/unnamed slot
23
+ */
24
+ class Menu extends List {
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ this.dataRole = ROLE.MENU;
28
+ }
29
+ }
30
+ Menu.styles = [...List.styles];
31
+ __decorate([
32
+ queryAssignedElements({ selector: `${MENUITEM_TAGNAME}:not([disabled])` }),
33
+ __metadata("design:type", Array)
34
+ ], Menu.prototype, "listItems", void 0);
35
+ export default Menu;
@@ -0,0 +1,2 @@
1
+ declare const TAG_NAME: "mdc-menu";
2
+ export { TAG_NAME };
@@ -0,0 +1,3 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('menu');
3
+ export { TAG_NAME };
@@ -0,0 +1,7 @@
1
+ import MenuBar from './menubar.component';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ ['mdc-menubar']: MenuBar;
5
+ }
6
+ }
7
+ export default MenuBar;
@@ -0,0 +1,4 @@
1
+ import MenuBar from './menubar.component';
2
+ import { TAG_NAME } from './menubar.constants';
3
+ MenuBar.register(TAG_NAME);
4
+ export default MenuBar;
@@ -0,0 +1,32 @@
1
+ import type { CSSResult, PropertyValues } from 'lit';
2
+ import { Component } from '../../models';
3
+ declare const MenuBar_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/MenuMixin").MenuMixinInterface> & typeof Component;
4
+ /**
5
+ * Menubar is a navigational menu component that provides a horizontal (default) or vertical fixed list of menu items,
6
+ * with support for nested submenus and keyboard navigation. It serves as a container
7
+ * for menu items and manages their interaction patterns, including:
8
+ * - Keyboard navigation (arrow keys, Home, End)
9
+ * - Menu item activation (Enter/Space)
10
+ * - Submenu toggling (Right/Left arrow keys)
11
+ * - Focus management
12
+ * - Support for both horizontal and vertical orientations
13
+ * - Integration with MenuPopover for nested menus
14
+ *
15
+ * A menubar will contain a set of menu items and their associated popovers.
16
+ * Each menu item can have a popover for nested menus.
17
+ *
18
+ * The component automatically handles ARIA attributes and follows WAI-ARIA menu design patterns.
19
+ * It works in conjunction with `mdc-menuitem` and `mdc-menupopover` to create accessible menu structures.
20
+ *
21
+ * @tagname mdc-menubar
22
+ * @slot default - Contains the menu items and their associated popovers
23
+ */
24
+ declare class MenuBar extends MenuBar_base {
25
+ constructor();
26
+ connectedCallback(): void;
27
+ firstUpdated(): void;
28
+ update(changedProperties: PropertyValues): void;
29
+ render(): import("lit-html").TemplateResult<1>;
30
+ static styles: Array<CSSResult>;
31
+ }
32
+ export default MenuBar;
@@ -0,0 +1,51 @@
1
+ import { html } from 'lit';
2
+ import { Component } from '../../models';
3
+ import { MenuMixin } from '../../utils/mixins/MenuMixin';
4
+ import { ROLE } from '../../utils/roles';
5
+ import styles from './menubar.styles';
6
+ /**
7
+ * Menubar is a navigational menu component that provides a horizontal (default) or vertical fixed list of menu items,
8
+ * with support for nested submenus and keyboard navigation. It serves as a container
9
+ * for menu items and manages their interaction patterns, including:
10
+ * - Keyboard navigation (arrow keys, Home, End)
11
+ * - Menu item activation (Enter/Space)
12
+ * - Submenu toggling (Right/Left arrow keys)
13
+ * - Focus management
14
+ * - Support for both horizontal and vertical orientations
15
+ * - Integration with MenuPopover for nested menus
16
+ *
17
+ * A menubar will contain a set of menu items and their associated popovers.
18
+ * Each menu item can have a popover for nested menus.
19
+ *
20
+ * The component automatically handles ARIA attributes and follows WAI-ARIA menu design patterns.
21
+ * It works in conjunction with `mdc-menuitem` and `mdc-menupopover` to create accessible menu structures.
22
+ *
23
+ * @tagname mdc-menubar
24
+ * @slot default - Contains the menu items and their associated popovers
25
+ */
26
+ class MenuBar extends MenuMixin(Component) {
27
+ constructor() {
28
+ super();
29
+ this.addEventListener('keydown', this.handleKeyDown);
30
+ this.addEventListener('click', this.handleMouseClick);
31
+ }
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ this.role = ROLE.MENUBAR;
35
+ }
36
+ firstUpdated() {
37
+ // For the first, we set the first element only as active.
38
+ this.resetTabIndexAndSetActiveTabIndex(0);
39
+ }
40
+ update(changedProperties) {
41
+ super.update(changedProperties);
42
+ if (changedProperties.has('ariaOrientation')) {
43
+ this.updatePopoverPlacementBasedOnOrientation();
44
+ }
45
+ }
46
+ render() {
47
+ return html `<slot></slot>`;
48
+ }
49
+ }
50
+ MenuBar.styles = [...Component.styles, ...styles];
51
+ export default MenuBar;
@@ -0,0 +1,6 @@
1
+ declare const TAG_NAME: "mdc-menubar";
2
+ declare const ORIENTATION: {
3
+ readonly HORIZONTAL: "horizontal";
4
+ readonly VERTICAL: "vertical";
5
+ };
6
+ export { TAG_NAME, ORIENTATION };
@@ -0,0 +1,7 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('menubar');
3
+ const ORIENTATION = {
4
+ HORIZONTAL: 'horizontal',
5
+ VERTICAL: 'vertical',
6
+ };
7
+ export { TAG_NAME, ORIENTATION };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { css } from 'lit';
2
+ const styles = css `
3
+ :host {
4
+ display: flex;
5
+ }
6
+
7
+ :host([aria-orientation='horizontal']) {
8
+ flex-direction: row;
9
+ }
10
+
11
+ :host([aria-orientation='vertical']) {
12
+ flex-direction: column;
13
+ }
14
+ `;
15
+ export default [styles];
@@ -0,0 +1,4 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { ORIENTATION } from './menubar.constants';
3
+ type Orientation = ValueOf<typeof ORIENTATION>;
4
+ export type { Orientation };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import '../icon';
1
2
  import '../text';
2
3
  import '../tooltip';
3
4
  import MenuItem from './menuitem.component';
@@ -1,3 +1,4 @@
1
+ import '../icon';
1
2
  import '../text';
2
3
  import '../tooltip';
3
4
  import MenuItem from './menuitem.component';
@@ -1,5 +1,6 @@
1
1
  import type { CSSResult } from 'lit';
2
2
  import ListItem from '../listitem/listitem.component';
3
+ import type { ArrowPositions, ArrowDirections } from './menuitem.types';
3
4
  /**
4
5
  * menuitem component is inherited by listitem component with the role set `menuitem`.<br/>
5
6
  * A menu item can contain an icon on the leading or trailing side.
@@ -10,6 +11,8 @@ import ListItem from '../listitem/listitem.component';
10
11
  * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
11
12
  *
12
13
  * @dependency mdc-text
14
+ * @dependency mdc-icon
15
+ * @dependency mdc-tooltip
13
16
  *
14
17
  * @tagname mdc-menuitem
15
18
  *
@@ -19,7 +22,31 @@ import ListItem from '../listitem/listitem.component';
19
22
  * @event focus - (React: onFocus) This event is dispatched when the menuitem receives focus.
20
23
  */
21
24
  declare class MenuItem extends ListItem {
25
+ /**
26
+ * Defines where the arrow icon will appear.
27
+ * - `'leading'`: Icon appears on the leading edge (start).
28
+ * - `'trailing'`: Icon appears on the trailing edge (end).
29
+ *
30
+ * If not set, no arrow is displayed.
31
+ */
32
+ arrowPosition?: ArrowPositions;
33
+ /**
34
+ * Defines the direction the arrow icon points.
35
+ * - `'positive'`: Arrow points toward the trailing side.
36
+ * - `'negative'`: Arrow points toward the leading side.
37
+ */
38
+ arrowDirection?: ArrowDirections;
22
39
  connectedCallback(): void;
40
+ /**
41
+ * Renders the trailing controls slot and optionally the trailing arrow icon,
42
+ * based on `arrowPosition` and `arrowDirection`.
43
+ */
44
+ protected renderTrailingControls(): import("lit-html").TemplateResult<1>;
45
+ /**
46
+ * Renders the leading controls slot and optionally the leading arrow icon,
47
+ * based on `arrowPosition` and `arrowDirection`.
48
+ */
49
+ protected renderLeadingControls(): import("lit-html").TemplateResult<1>;
23
50
  static styles: Array<CSSResult>;
24
51
  }
25
52
  export default MenuItem;
@@ -1,6 +1,19 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { html, nothing } from 'lit';
11
+ import { property } from 'lit/decorators.js';
1
12
  import { ROLE } from '../../utils/roles';
2
13
  import ListItem from '../listitem/listitem.component';
3
14
  import { LISTITEM_VARIANTS } from '../listitem/listitem.constants';
15
+ import { ARROW_ICONS, ARROW_DIRECTIONS, ARROW_POSITIONS } from './menuitem.constants';
16
+ import styles from './menuitem.styles';
4
17
  /**
5
18
  * menuitem component is inherited by listitem component with the role set `menuitem`.<br/>
6
19
  * A menu item can contain an icon on the leading or trailing side.
@@ -11,6 +24,8 @@ import { LISTITEM_VARIANTS } from '../listitem/listitem.constants';
11
24
  * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
12
25
  *
13
26
  * @dependency mdc-text
27
+ * @dependency mdc-icon
28
+ * @dependency mdc-tooltip
14
29
  *
15
30
  * @tagname mdc-menuitem
16
31
  *
@@ -25,6 +40,44 @@ class MenuItem extends ListItem {
25
40
  this.role = ROLE.MENUITEM;
26
41
  this.variant = LISTITEM_VARIANTS.INSET_RECTANGLE;
27
42
  }
43
+ /**
44
+ * Renders the trailing controls slot and optionally the trailing arrow icon,
45
+ * based on `arrowPosition` and `arrowDirection`.
46
+ */
47
+ renderTrailingControls() {
48
+ const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.NEGATIVE
49
+ ? ARROW_ICONS.LEFT
50
+ : ARROW_ICONS.RIGHT;
51
+ return html `
52
+ <slot name="trailing-controls"></slot>
53
+ ${this.arrowPosition === ARROW_POSITIONS.TRAILING
54
+ ? html `<mdc-icon name="${arrowIcon}" length-unit="rem" part="trailing-arrow"></mdc-icon>`
55
+ : nothing}
56
+ `;
57
+ }
58
+ /**
59
+ * Renders the leading controls slot and optionally the leading arrow icon,
60
+ * based on `arrowPosition` and `arrowDirection`.
61
+ */
62
+ renderLeadingControls() {
63
+ const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.POSITIVE
64
+ ? ARROW_ICONS.RIGHT
65
+ : ARROW_ICONS.LEFT;
66
+ return html `
67
+ <slot name="leading-controls"></slot>
68
+ ${this.arrowPosition === ARROW_POSITIONS.LEADING
69
+ ? html `<mdc-icon name="${arrowIcon}" length-unit="rem" part="leading-arrow"></mdc-icon>`
70
+ : nothing}
71
+ `;
72
+ }
28
73
  }
29
- MenuItem.styles = [...ListItem.styles];
74
+ MenuItem.styles = [...ListItem.styles, ...styles];
75
+ __decorate([
76
+ property({ type: String, reflect: true, attribute: 'arrow-position' }),
77
+ __metadata("design:type", String)
78
+ ], MenuItem.prototype, "arrowPosition", void 0);
79
+ __decorate([
80
+ property({ type: String, reflect: true, attribute: 'arrow-direction' }),
81
+ __metadata("design:type", String)
82
+ ], MenuItem.prototype, "arrowDirection", void 0);
30
83
  export default MenuItem;
@@ -1,2 +1,14 @@
1
1
  declare const TAG_NAME: "mdc-menuitem";
2
- export { TAG_NAME };
2
+ declare const ARROW_ICONS: {
3
+ readonly LEFT: "arrow-left-bold";
4
+ readonly RIGHT: "arrow-right-bold";
5
+ };
6
+ declare const ARROW_DIRECTIONS: {
7
+ readonly POSITIVE: "positive";
8
+ readonly NEGATIVE: "negative";
9
+ };
10
+ declare const ARROW_POSITIONS: {
11
+ readonly LEADING: "leading";
12
+ readonly TRAILING: "trailing";
13
+ };
14
+ export { TAG_NAME, ARROW_ICONS, ARROW_DIRECTIONS, ARROW_POSITIONS };
@@ -1,3 +1,15 @@
1
1
  import utils from '../../utils/tag-name';
2
2
  const TAG_NAME = utils.constructTagName('menuitem');
3
- export { TAG_NAME };
3
+ const ARROW_ICONS = {
4
+ LEFT: 'arrow-left-bold',
5
+ RIGHT: 'arrow-right-bold',
6
+ };
7
+ const ARROW_DIRECTIONS = {
8
+ POSITIVE: 'positive',
9
+ NEGATIVE: 'negative',
10
+ };
11
+ const ARROW_POSITIONS = {
12
+ LEADING: 'leading',
13
+ TRAILING: 'trailing',
14
+ };
15
+ export { TAG_NAME, ARROW_ICONS, ARROW_DIRECTIONS, ARROW_POSITIONS };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { css } from 'lit';
2
+ const styles = css `
3
+ :host(:dir(rtl))::part(trailing-arrow),
4
+ :host(:dir(rtl))::part(leading-arrow) {
5
+ transform: rotate(180deg);
6
+ }
7
+ :host::part(trailing-arrow), :host::part(leading-arrow) {
8
+ --mdc-icon-size: 1.25rem;
9
+ }
10
+ `;
11
+ export default [styles];
@@ -1,6 +1,10 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { ARROW_POSITIONS, ARROW_DIRECTIONS } from './menuitem.constants';
1
3
  interface Events {
2
4
  onChangeEvent: Event;
3
5
  onClickEvent: MouseEvent;
4
6
  onFocusEvent: FocusEvent;
5
7
  }
6
- export type { Events };
8
+ type ArrowPositions = ValueOf<typeof ARROW_POSITIONS>;
9
+ type ArrowDirections = ValueOf<typeof ARROW_DIRECTIONS>;
10
+ export type { Events, ArrowPositions, ArrowDirections };
@@ -0,0 +1,7 @@
1
+ import MenuPopover from './menupopover.component';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ ['mdc-menupopover']: MenuPopover;
5
+ }
6
+ }
7
+ export default MenuPopover;
@@ -0,0 +1,4 @@
1
+ import MenuPopover from './menupopover.component';
2
+ import { TAG_NAME } from './menupopover.constants';
3
+ MenuPopover.register(TAG_NAME);
4
+ export default MenuPopover;
@@ -0,0 +1,30 @@
1
+ import { CSSResult, PropertyValues } from 'lit';
2
+ import Popover from '../popover/popover.component';
3
+ declare const MenuPopover_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/MenuMixin").MenuMixinInterface> & typeof Popover;
4
+ /**
5
+ * A popover menu component that displays a list of menu items in a floating container.
6
+ * It's designed to work in conjunction with `mdc-menubar` and `mdc-menuitem` to create
7
+ * accessible, nested menu structures with the following features:
8
+ * - Appears adjacent to the triggering menu item
9
+ * - Supports keyboard navigation (arrow keys, Home, End)
10
+ * - Manages focus trapping when open
11
+ * - Closes on Escape key or outside click
12
+ * - Supports both mouse and keyboard interactions
13
+ * - Automatically handles ARIA attributes for accessibility
14
+ *
15
+ * The component extends `mdc-popover` and adds menu-specific behaviors and styling.
16
+ * When nested within another `mdc-menupopover`, it automatically adjusts its behavior
17
+ * to work as a submenu (right-aligned, shows on hover).
18
+ *
19
+ * The orientation of the menu popover is always set to `vertical`.
20
+ *
21
+ * @tagname mdc-menupopover
22
+ * @slot default - Contains the menu items to be displayed in the popover
23
+ */
24
+ declare class MenuPopover extends MenuPopover_base {
25
+ constructor();
26
+ connectedCallback(): void;
27
+ firstUpdated(changedProperties: PropertyValues): Promise<void>;
28
+ static styles: Array<CSSResult>;
29
+ }
30
+ export default MenuPopover;
@@ -0,0 +1,56 @@
1
+ import { MenuMixin } from '../../utils/mixins/MenuMixin';
2
+ import { ROLE } from '../../utils/roles';
3
+ import { ORIENTATION } from '../menubar/menubar.constants';
4
+ import Popover from '../popover/popover.component';
5
+ import { POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
6
+ import { TAG_NAME as MENU_POPOVER } from './menupopover.constants';
7
+ import styles from './menupopover.styles';
8
+ /**
9
+ * A popover menu component that displays a list of menu items in a floating container.
10
+ * It's designed to work in conjunction with `mdc-menubar` and `mdc-menuitem` to create
11
+ * accessible, nested menu structures with the following features:
12
+ * - Appears adjacent to the triggering menu item
13
+ * - Supports keyboard navigation (arrow keys, Home, End)
14
+ * - Manages focus trapping when open
15
+ * - Closes on Escape key or outside click
16
+ * - Supports both mouse and keyboard interactions
17
+ * - Automatically handles ARIA attributes for accessibility
18
+ *
19
+ * The component extends `mdc-popover` and adds menu-specific behaviors and styling.
20
+ * When nested within another `mdc-menupopover`, it automatically adjusts its behavior
21
+ * to work as a submenu (right-aligned, shows on hover).
22
+ *
23
+ * The orientation of the menu popover is always set to `vertical`.
24
+ *
25
+ * @tagname mdc-menupopover
26
+ * @slot default - Contains the menu items to be displayed in the popover
27
+ */
28
+ class MenuPopover extends MenuMixin(Popover) {
29
+ constructor() {
30
+ super();
31
+ this.addEventListener('keydown', this.handleKeyDown);
32
+ this.addEventListener('click', this.handleMouseClick);
33
+ }
34
+ connectedCallback() {
35
+ super.connectedCallback();
36
+ this.role = ROLE.MENU;
37
+ this.focusTrap = true;
38
+ this.hideOnEscape = true;
39
+ this.hideOnOutsideClick = true;
40
+ this.placement = POPOVER_PLACEMENT.BOTTOM_START;
41
+ this.showArrow = false;
42
+ this.interactive = true;
43
+ this.ariaOrientation = ORIENTATION.VERTICAL;
44
+ }
45
+ async firstUpdated(changedProperties) {
46
+ var _a, _b;
47
+ await super.firstUpdated(changedProperties);
48
+ if (((_b = (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === MENU_POPOVER) {
49
+ this.interactive = true;
50
+ this.placement = POPOVER_PLACEMENT.RIGHT_START;
51
+ this.trigger = TRIGGER.MOUSEENTER;
52
+ }
53
+ }
54
+ }
55
+ MenuPopover.styles = [...Popover.styles, ...styles];
56
+ export default MenuPopover;
@@ -0,0 +1,2 @@
1
+ declare const TAG_NAME: "mdc-menupopover";
2
+ export { TAG_NAME };
@@ -0,0 +1,3 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('menupopover');
3
+ export { TAG_NAME };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;