@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
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import AlertChip from './components/alertchip';
2
+ import Animation from './components/animation';
2
3
  import Appheader from './components/appheader';
3
4
  import Avatar from './components/avatar';
4
5
  import AvatarButton from './components/avatarbutton';
@@ -27,7 +28,13 @@ import Linksimple from './components/linksimple';
27
28
  import List from './components/list';
28
29
  import ListItem from './components/listitem';
29
30
  import Marker from './components/marker';
31
+ import Menu from './components/menu';
32
+ import MenuBar from './components/menubar';
30
33
  import MenuItem from './components/menuitem';
34
+ import MenuItemCheckbox from './components/menuitemcheckbox';
35
+ import MenuItemRadio from './components/menuitemradio';
36
+ import MenuSection from './components/menusection';
37
+ import MenuPopover from './components/menupopover';
31
38
  import OptGroup from './components/optgroup';
32
39
  import Option from './components/option';
33
40
  import Popover from './components/popover';
@@ -52,10 +59,6 @@ import Toggle from './components/toggle';
52
59
  import ToggleTip from './components/toggletip';
53
60
  import Tooltip from './components/tooltip';
54
61
  import VirtualizedList from './components/virtualizedlist';
55
- import MenuItemRadio from './components/menuitemradio';
56
- import MenuItemCheckbox from './components/menuitemcheckbox';
57
- import MenuSection from './components/menusection';
58
- import Animation from './components/animation';
59
62
  import type { BadgeType } from './components/badge/badge.types';
60
63
  import type { ButtonColor, ButtonVariant, IconButtonSize, PillButtonSize } from './components/button/button.types';
61
64
  import type { PopoverPlacement } from './components/popover/popover.types';
@@ -63,6 +66,6 @@ import type { SpinnerSize, SpinnerVariant } from './components/spinner/spinner.t
63
66
  import type { TextType } from './components/text/text.types';
64
67
  import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
65
68
  import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
66
- export { AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, MenuSection, };
69
+ export { AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, Menu, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, ToggleTip, Tooltip, MenuSection, VirtualizedList, };
67
70
  export type { TextType, SpinnerSize, SpinnerVariant, PopoverPlacement, BadgeType, IconButtonSize, PillButtonSize, ButtonVariant, ButtonColor, };
68
71
  export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Components Imports
2
2
  import AlertChip from './components/alertchip';
3
+ import Animation from './components/animation';
3
4
  import Appheader from './components/appheader';
4
5
  import Avatar from './components/avatar';
5
6
  import AvatarButton from './components/avatarbutton';
@@ -28,7 +29,13 @@ import Linksimple from './components/linksimple';
28
29
  import List from './components/list';
29
30
  import ListItem from './components/listitem';
30
31
  import Marker from './components/marker';
32
+ import Menu from './components/menu';
33
+ import MenuBar from './components/menubar';
31
34
  import MenuItem from './components/menuitem';
35
+ import MenuItemCheckbox from './components/menuitemcheckbox';
36
+ import MenuItemRadio from './components/menuitemradio';
37
+ import MenuSection from './components/menusection';
38
+ import MenuPopover from './components/menupopover';
32
39
  import OptGroup from './components/optgroup';
33
40
  import Option from './components/option';
34
41
  import Popover from './components/popover';
@@ -53,14 +60,10 @@ import Toggle from './components/toggle';
53
60
  import ToggleTip from './components/toggletip';
54
61
  import Tooltip from './components/tooltip';
55
62
  import VirtualizedList from './components/virtualizedlist';
56
- import MenuItemRadio from './components/menuitemradio';
57
- import MenuItemCheckbox from './components/menuitemcheckbox';
58
- import MenuSection from './components/menusection';
59
- import Animation from './components/animation';
60
63
  import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
61
64
  // Constants / Utils Imports
62
65
  import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
63
66
  // Components Exports
64
- export { AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, MenuSection, };
67
+ export { AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, Menu, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, ToggleTip, Tooltip, MenuSection, VirtualizedList, };
65
68
  // Constants / Utils Exports
66
69
  export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
@@ -1,6 +1,6 @@
1
- export { default as Appheader } from './appheader';
2
1
  export { default as AlertChip } from './alertchip';
3
2
  export { default as Animation } from './animation';
3
+ export { default as Appheader } from './appheader';
4
4
  export { default as Avatar } from './avatar';
5
5
  export { default as AvatarButton } from './avatarbutton';
6
6
  export { default as Badge } from './badge';
@@ -30,9 +30,12 @@ export { default as Linksimple } from './linksimple';
30
30
  export { default as List } from './list';
31
31
  export { default as ListItem } from './listitem';
32
32
  export { default as Marker } from './marker';
33
+ export { default as Menu } from './menu';
34
+ export { default as MenuBar } from './menubar';
33
35
  export { default as MenuItem } from './menuitem';
34
36
  export { default as MenuItemCheckbox } from './menuitemcheckbox';
35
37
  export { default as MenuItemRadio } from './menuitemradio';
38
+ export { default as MenuPopover } from './menupopover';
36
39
  export { default as MenuSection } from './menusection';
37
40
  export { default as OptGroup } from './optgroup';
38
41
  export { default as Option } from './option';
@@ -1,6 +1,6 @@
1
- export { default as Appheader } from './appheader';
2
1
  export { default as AlertChip } from './alertchip';
3
2
  export { default as Animation } from './animation';
3
+ export { default as Appheader } from './appheader';
4
4
  export { default as Avatar } from './avatar';
5
5
  export { default as AvatarButton } from './avatarbutton';
6
6
  export { default as Badge } from './badge';
@@ -30,9 +30,12 @@ export { default as Linksimple } from './linksimple';
30
30
  export { default as List } from './list';
31
31
  export { default as ListItem } from './listitem';
32
32
  export { default as Marker } from './marker';
33
+ export { default as Menu } from './menu';
34
+ export { default as MenuBar } from './menubar';
33
35
  export { default as MenuItem } from './menuitem';
34
36
  export { default as MenuItemCheckbox } from './menuitemcheckbox';
35
37
  export { default as MenuItemRadio } from './menuitemradio';
38
+ export { default as MenuPopover } from './menupopover';
36
39
  export { default as MenuSection } from './menusection';
37
40
  export { default as OptGroup } from './optgroup';
38
41
  export { default as Option } from './option';
@@ -19,6 +19,7 @@ import Component from '../../components/listitem';
19
19
  * @tagname mdc-listitem
20
20
  *
21
21
  * @dependency mdc-text
22
+ * @dependency mdc-tooltip
22
23
  *
23
24
  * @slot leading-controls - slot for list item controls to appear of leading end.
24
25
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -21,6 +21,7 @@ import { TAG_NAME } from '../../components/listitem/listitem.constants';
21
21
  * @tagname mdc-listitem
22
22
  *
23
23
  * @dependency mdc-text
24
+ * @dependency mdc-tooltip
24
25
  *
25
26
  * @slot leading-controls - slot for list item controls to appear of leading end.
26
27
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -0,0 +1,13 @@
1
+ import Component from '../../components/menu';
2
+ /**
3
+ * mdc-menu component is used to display a group of menu items. It is used as a container to wrap menu items.
4
+ * It contains the menu header component.
5
+ *
6
+ * @dependency mdc-text
7
+ *
8
+ * @tagname mdc-menu
9
+ *
10
+ * @slot default - This is a default/unnamed slot
11
+ */
12
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
13
+ export default reactWrapper;
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/menu';
4
+ import { TAG_NAME } from '../../components/menu/menu.constants';
5
+ /**
6
+ * mdc-menu component is used to display a group of menu items. It is used as a container to wrap menu items.
7
+ * It contains the menu header component.
8
+ *
9
+ * @dependency mdc-text
10
+ *
11
+ * @tagname mdc-menu
12
+ *
13
+ * @slot default - This is a default/unnamed slot
14
+ */
15
+ const reactWrapper = createComponent({
16
+ tagName: TAG_NAME,
17
+ elementClass: Component,
18
+ react: React,
19
+ events: {},
20
+ displayName: 'Menu',
21
+ });
22
+ export default reactWrapper;
@@ -0,0 +1,23 @@
1
+ import Component from '../../components/menubar';
2
+ /**
3
+ * Menubar is a navigational menu component that provides a horizontal (default) or vertical fixed list of menu items,
4
+ * with support for nested submenus and keyboard navigation. It serves as a container
5
+ * for menu items and manages their interaction patterns, including:
6
+ * - Keyboard navigation (arrow keys, Home, End)
7
+ * - Menu item activation (Enter/Space)
8
+ * - Submenu toggling (Right/Left arrow keys)
9
+ * - Focus management
10
+ * - Support for both horizontal and vertical orientations
11
+ * - Integration with MenuPopover for nested menus
12
+ *
13
+ * A menubar will contain a set of menu items and their associated popovers.
14
+ * Each menu item can have a popover for nested menus.
15
+ *
16
+ * The component automatically handles ARIA attributes and follows WAI-ARIA menu design patterns.
17
+ * It works in conjunction with `mdc-menuitem` and `mdc-menupopover` to create accessible menu structures.
18
+ *
19
+ * @tagname mdc-menubar
20
+ * @slot default - Contains the menu items and their associated popovers
21
+ */
22
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
23
+ export default reactWrapper;
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/menubar';
4
+ import { TAG_NAME } from '../../components/menubar/menubar.constants';
5
+ /**
6
+ * Menubar is a navigational menu component that provides a horizontal (default) or vertical fixed list of menu items,
7
+ * with support for nested submenus and keyboard navigation. It serves as a container
8
+ * for menu items and manages their interaction patterns, including:
9
+ * - Keyboard navigation (arrow keys, Home, End)
10
+ * - Menu item activation (Enter/Space)
11
+ * - Submenu toggling (Right/Left arrow keys)
12
+ * - Focus management
13
+ * - Support for both horizontal and vertical orientations
14
+ * - Integration with MenuPopover for nested menus
15
+ *
16
+ * A menubar will contain a set of menu items and their associated popovers.
17
+ * Each menu item can have a popover for nested menus.
18
+ *
19
+ * The component automatically handles ARIA attributes and follows WAI-ARIA menu design patterns.
20
+ * It works in conjunction with `mdc-menuitem` and `mdc-menupopover` to create accessible menu structures.
21
+ *
22
+ * @tagname mdc-menubar
23
+ * @slot default - Contains the menu items and their associated popovers
24
+ */
25
+ const reactWrapper = createComponent({
26
+ tagName: TAG_NAME,
27
+ elementClass: Component,
28
+ react: React,
29
+ events: {},
30
+ displayName: 'MenuBar',
31
+ });
32
+ export default reactWrapper;
@@ -10,6 +10,8 @@ import Component from '../../components/menuitem';
10
10
  * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
11
11
  *
12
12
  * @dependency mdc-text
13
+ * @dependency mdc-icon
14
+ * @dependency mdc-tooltip
13
15
  *
14
16
  * @tagname mdc-menuitem
15
17
  *
@@ -12,6 +12,8 @@ import { TAG_NAME } from '../../components/menuitem/menuitem.constants';
12
12
  * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
13
13
  *
14
14
  * @dependency mdc-text
15
+ * @dependency mdc-icon
16
+ * @dependency mdc-tooltip
15
17
  *
16
18
  * @tagname mdc-menuitem
17
19
  *
@@ -0,0 +1,29 @@
1
+ import { type EventName } from '@lit/react';
2
+ import Component from '../../components/menupopover';
3
+ /**
4
+ * A popover menu component that displays a list of menu items in a floating container.
5
+ * It's designed to work in conjunction with `mdc-menubar` and `mdc-menuitem` to create
6
+ * accessible, nested menu structures with the following features:
7
+ * - Appears adjacent to the triggering menu item
8
+ * - Supports keyboard navigation (arrow keys, Home, End)
9
+ * - Manages focus trapping when open
10
+ * - Closes on Escape key or outside click
11
+ * - Supports both mouse and keyboard interactions
12
+ * - Automatically handles ARIA attributes for accessibility
13
+ *
14
+ * The component extends `mdc-popover` and adds menu-specific behaviors and styling.
15
+ * When nested within another `mdc-menupopover`, it automatically adjusts its behavior
16
+ * to work as a submenu (right-aligned, shows on hover).
17
+ *
18
+ * The orientation of the menu popover is always set to `vertical`.
19
+ *
20
+ * @tagname mdc-menupopover
21
+ * @slot default - Contains the menu items to be displayed in the popover
22
+ */
23
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
24
+ onShown: EventName<Event>;
25
+ onHidden: EventName<Event>;
26
+ onCreated: EventName<Event>;
27
+ onDestroyed: EventName<Event>;
28
+ }>;
29
+ export default reactWrapper;
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/menupopover';
4
+ import { TAG_NAME } from '../../components/menupopover/menupopover.constants';
5
+ /**
6
+ * A popover menu component that displays a list of menu items in a floating container.
7
+ * It's designed to work in conjunction with `mdc-menubar` and `mdc-menuitem` to create
8
+ * accessible, nested menu structures with the following features:
9
+ * - Appears adjacent to the triggering menu item
10
+ * - Supports keyboard navigation (arrow keys, Home, End)
11
+ * - Manages focus trapping when open
12
+ * - Closes on Escape key or outside click
13
+ * - Supports both mouse and keyboard interactions
14
+ * - Automatically handles ARIA attributes for accessibility
15
+ *
16
+ * The component extends `mdc-popover` and adds menu-specific behaviors and styling.
17
+ * When nested within another `mdc-menupopover`, it automatically adjusts its behavior
18
+ * to work as a submenu (right-aligned, shows on hover).
19
+ *
20
+ * The orientation of the menu popover is always set to `vertical`.
21
+ *
22
+ * @tagname mdc-menupopover
23
+ * @slot default - Contains the menu items to be displayed in the popover
24
+ */
25
+ const reactWrapper = createComponent({
26
+ tagName: TAG_NAME,
27
+ elementClass: Component,
28
+ react: React,
29
+ events: {
30
+ onShown: 'shown',
31
+ onHidden: 'hidden',
32
+ onCreated: 'created',
33
+ onDestroyed: 'destroyed',
34
+ },
35
+ displayName: 'MenuPopover',
36
+ });
37
+ export default reactWrapper;
@@ -1,5 +1,7 @@
1
1
  declare const KEYS: {
2
2
  readonly ARROW_DOWN: "ArrowDown";
3
+ readonly ARROW_LEFT: "ArrowLeft";
4
+ readonly ARROW_RIGHT: "ArrowRight";
3
5
  readonly ARROW_UP: "ArrowUp";
4
6
  readonly END: "End";
5
7
  readonly ENTER: "Enter";
@@ -1,5 +1,7 @@
1
1
  const KEYS = {
2
2
  ARROW_DOWN: 'ArrowDown',
3
+ ARROW_LEFT: 'ArrowLeft',
4
+ ARROW_RIGHT: 'ArrowRight',
3
5
  ARROW_UP: 'ArrowUp',
4
6
  END: 'End',
5
7
  ENTER: 'Enter',
@@ -0,0 +1,12 @@
1
+ import { LitElement } from 'lit';
2
+ import type { Orientation } from '../../components/menubar/menubar.types';
3
+ import type { Constructor } from './index.types';
4
+ export declare class MenuMixinInterface {
5
+ ariaOrientation: Orientation;
6
+ protected handleKeyDown(event: KeyboardEvent): void;
7
+ protected handleMouseClick(event: MouseEvent): void;
8
+ protected resetTabIndexAndSetActiveTabIndex(newIndex: number): void;
9
+ protected setTabIndexOnMouseClick(event: MouseEvent): void;
10
+ protected updatePopoverPlacementBasedOnOrientation(): void;
11
+ }
12
+ export declare const MenuMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<MenuMixinInterface> & T;