@momentum-design/components 0.84.3 → 0.84.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.
Files changed (185) hide show
  1. package/README.md +8 -3
  2. package/dist/browser/index.js +2241 -2299
  3. package/dist/browser/index.js.map +4 -4
  4. package/dist/components/alertchip/alertchip.component.d.ts +1 -1
  5. package/dist/components/alertchip/alertchip.component.js +2 -2
  6. package/dist/components/alertchip/alertchip.styles.js +22 -23
  7. package/dist/components/alertchip/alertchip.types.d.ts +1 -1
  8. package/dist/components/animation/animation.component.js +1 -1
  9. package/dist/components/animation/animation.styles.js +8 -5
  10. package/dist/components/appheader/appheader.component.js +12 -13
  11. package/dist/components/appheader/appheader.styles.js +0 -1
  12. package/dist/components/avatar/avatar.component.js +3 -16
  13. package/dist/components/avatar/avatar.constants.d.ts +1 -1
  14. package/dist/components/avatar/avatar.constants.js +1 -1
  15. package/dist/components/avatar/avatar.styles.js +129 -122
  16. package/dist/components/avatar/avatar.types.d.ts +1 -1
  17. package/dist/components/avatar/avatar.utils.d.ts +1 -1
  18. package/dist/components/avatar/avatar.utils.js +1 -1
  19. package/dist/components/avatarbutton/avatarbutton.component.d.ts +2 -2
  20. package/dist/components/avatarbutton/avatarbutton.component.js +2 -2
  21. package/dist/components/avatarbutton/avatarbutton.styles.js +34 -30
  22. package/dist/components/badge/badge.styles.js +9 -7
  23. package/dist/components/brandvisual/brandvisual.component.js +4 -4
  24. package/dist/components/bullet/bullet.component.d.ts +1 -1
  25. package/dist/components/bullet/bullet.component.js +2 -2
  26. package/dist/components/bullet/bullet.styles.js +3 -3
  27. package/dist/components/button/button.component.js +10 -4
  28. package/dist/components/button/button.utils.js +1 -1
  29. package/dist/components/buttongroup/buttongroup.component.js +1 -1
  30. package/dist/components/buttongroup/buttongroup.styles.js +68 -68
  31. package/dist/components/buttonlink/buttonlink.component.d.ts +5 -5
  32. package/dist/components/buttonlink/buttonlink.component.js +9 -9
  33. package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
  34. package/dist/components/buttonsimple/buttonsimple.constants.d.ts +1 -1
  35. package/dist/components/buttonsimple/buttonsimple.constants.js +1 -1
  36. package/dist/components/buttonsimple/buttonsimple.styles.js +62 -57
  37. package/dist/components/card/card.component.d.ts +6 -6
  38. package/dist/components/card/card.component.js +15 -16
  39. package/dist/components/card/card.styles.js +24 -22
  40. package/dist/components/cardbutton/cardbutton.component.js +9 -12
  41. package/dist/components/cardbutton/cardbutton.styles.js +1 -1
  42. package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +6 -6
  43. package/dist/components/cardcheckbox/cardcheckbox.component.js +30 -29
  44. package/dist/components/cardcheckbox/cardcheckbox.styles.js +10 -10
  45. package/dist/components/cardradio/cardradio.component.d.ts +12 -12
  46. package/dist/components/cardradio/cardradio.component.js +27 -30
  47. package/dist/components/cardradio/cardradio.styles.js +8 -8
  48. package/dist/components/checkbox/checkbox.component.js +7 -9
  49. package/dist/components/checkbox/checkbox.styles.js +62 -60
  50. package/dist/components/chip/chip.component.d.ts +1 -1
  51. package/dist/components/chip/chip.component.js +6 -11
  52. package/dist/components/chip/chip.styles.js +4 -2
  53. package/dist/components/dialog/dialog.component.d.ts +7 -2
  54. package/dist/components/dialog/dialog.component.js +43 -33
  55. package/dist/components/dialog/dialog.constants.d.ts +1 -0
  56. package/dist/components/dialog/dialog.constants.js +1 -0
  57. package/dist/components/dialog/dialog.styles.js +10 -12
  58. package/dist/components/divider/divider.component.js +6 -8
  59. package/dist/components/divider/divider.constants.d.ts +1 -1
  60. package/dist/components/divider/divider.constants.js +1 -1
  61. package/dist/components/divider/divider.styles.js +5 -20
  62. package/dist/components/filterchip/filterchip.styles.js +4 -2
  63. package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
  64. package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
  65. package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
  66. package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
  67. package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
  68. package/dist/components/icon/icon.component.js +7 -7
  69. package/dist/components/icon/icon.utils.d.ts +1 -1
  70. package/dist/components/icon/icon.utils.js +7 -7
  71. package/dist/components/iconprovider/iconprovider.component.js +7 -7
  72. package/dist/components/input/input.component.d.ts +5 -5
  73. package/dist/components/input/input.component.js +64 -62
  74. package/dist/components/input/input.styles.js +128 -117
  75. package/dist/components/inputchip/inputchip.component.js +14 -19
  76. package/dist/components/inputchip/inputchip.styles.js +5 -3
  77. package/dist/components/link/link.component.d.ts +1 -1
  78. package/dist/components/link/link.component.js +4 -8
  79. package/dist/components/link/link.constants.d.ts +1 -1
  80. package/dist/components/link/link.constants.js +1 -1
  81. package/dist/components/link/link.styles.js +12 -12
  82. package/dist/components/linksimple/linksimple.component.js +2 -4
  83. package/dist/components/linksimple/linksimple.styles.js +59 -57
  84. package/dist/components/list/list.component.js +12 -9
  85. package/dist/components/listitem/listitem.component.js +15 -11
  86. package/dist/components/listitem/listitem.styles.js +11 -6
  87. package/dist/components/marker/marker.component.js +1 -1
  88. package/dist/components/marker/marker.styles.js +2 -2
  89. package/dist/components/menubar/menubar.component.d.ts +19 -19
  90. package/dist/components/menubar/menubar.component.js +19 -19
  91. package/dist/components/menuitem/menuitem.component.js +15 -15
  92. package/dist/components/menuitem/menuitem.styles.js +3 -2
  93. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
  94. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
  95. package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
  96. package/dist/components/menupopover/menupopover.component.js +11 -11
  97. package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
  98. package/dist/components/menupopover/menupopover.utils.js +3 -8
  99. package/dist/components/navitem/navitem.component.js +11 -19
  100. package/dist/components/navitem/navitem.styles.js +147 -143
  101. package/dist/components/navitemlist/navitemlist.component.js +2 -2
  102. package/dist/components/optgroup/optgroup.component.js +12 -9
  103. package/dist/components/option/option.component.js +11 -11
  104. package/dist/components/option/option.styles.js +1 -1
  105. package/dist/components/popover/popover.component.js +4 -4
  106. package/dist/components/popover/popover.stack.js +1 -1
  107. package/dist/components/popover/popover.styles.js +0 -1
  108. package/dist/components/popover/popover.utils.js +3 -4
  109. package/dist/components/presence/presence.component.d.ts +4 -4
  110. package/dist/components/presence/presence.component.js +4 -4
  111. package/dist/components/progressbar/progressbar.component.js +3 -4
  112. package/dist/components/progressbar/progressbar.styles.js +77 -71
  113. package/dist/components/progressspinner/progressspiner.utils.js +4 -4
  114. package/dist/components/progressspinner/progressspinner.component.js +38 -37
  115. package/dist/components/progressspinner/progressspinner.styles.js +1 -1
  116. package/dist/components/radio/radio.component.d.ts +41 -41
  117. package/dist/components/radio/radio.component.js +84 -83
  118. package/dist/components/radio/radio.styles.js +77 -75
  119. package/dist/components/radiogroup/radiogroup.component.js +1 -1
  120. package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
  121. package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
  122. package/dist/components/searchfield/searchfield.component.js +23 -17
  123. package/dist/components/searchfield/searchfield.styles.js +11 -13
  124. package/dist/components/select/select.component.js +20 -23
  125. package/dist/components/select/select.styles.js +9 -9
  126. package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
  127. package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
  128. package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
  129. package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
  130. package/dist/components/skeleton/skeleton.component.js +1 -4
  131. package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
  132. package/dist/components/skeleton/skeleton.constants.js +1 -1
  133. package/dist/components/skeleton/skeleton.styles.js +4 -4
  134. package/dist/components/spinner/spinner.component.d.ts +7 -7
  135. package/dist/components/spinner/spinner.component.js +9 -9
  136. package/dist/components/spinner/spinner.styles.js +58 -53
  137. package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
  138. package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
  139. package/dist/components/staticradio/staticradio.component.d.ts +8 -8
  140. package/dist/components/staticradio/staticradio.component.js +10 -11
  141. package/dist/components/staticradio/staticradio.styles.js +77 -75
  142. package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
  143. package/dist/components/statictoggle/statictoggle.component.js +3 -3
  144. package/dist/components/statictoggle/statictoggle.styles.js +71 -68
  145. package/dist/components/tab/tab.component.d.ts +1 -1
  146. package/dist/components/tab/tab.component.js +2 -2
  147. package/dist/components/tab/tab.styles.js +247 -245
  148. package/dist/components/tablist/tablist.component.js +11 -15
  149. package/dist/components/tablist/tablist.styles.js +27 -25
  150. package/dist/components/tablist/tablist.types.d.ts +1 -1
  151. package/dist/components/tablist/tablist.utils.js +4 -4
  152. package/dist/components/text/fonts.styles.js +49 -49
  153. package/dist/components/text/text.component.js +21 -11
  154. package/dist/components/text/text.types.d.ts +1 -1
  155. package/dist/components/textarea/textarea.component.d.ts +31 -31
  156. package/dist/components/textarea/textarea.component.js +54 -61
  157. package/dist/components/textarea/textarea.styles.js +123 -122
  158. package/dist/components/themeprovider/themeprovider.component.js +1 -1
  159. package/dist/components/themeprovider/themeprovider.styles.js +4 -4
  160. package/dist/components/toggle/toggle.component.d.ts +35 -35
  161. package/dist/components/toggle/toggle.component.js +62 -63
  162. package/dist/components/toggle/toggle.styles.js +77 -69
  163. package/dist/components/toggletip/toggletip.component.d.ts +7 -7
  164. package/dist/components/toggletip/toggletip.component.js +3 -2
  165. package/dist/components/tooltip/tooltip.component.js +1 -1
  166. package/dist/components/tooltip/tooltip.styles.js +0 -1
  167. package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
  168. package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
  169. package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
  170. package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
  171. package/dist/custom-elements.json +239 -228
  172. package/dist/index.js +1 -0
  173. package/dist/models/component/index.d.ts +1 -1
  174. package/dist/models/index.d.ts +2 -2
  175. package/dist/models/index.js +1 -1
  176. package/dist/react/index.d.ts +3 -3
  177. package/dist/react/index.js +3 -3
  178. package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
  179. package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
  180. package/dist/utils/mixins/FocusTrapMixin.js +15 -12
  181. package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
  182. package/dist/utils/mixins/MenuMixin.js +23 -23
  183. package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
  184. package/dist/utils/styles/index.js +12 -12
  185. package/package.json +1 -1
@@ -12,9 +12,9 @@ import { property } from 'lit/decorators.js';
12
12
  import { ROLE } from '../../utils/roles';
13
13
  import ListItem from '../listitem/listitem.component';
14
14
  import { LISTITEM_VARIANTS } from '../listitem/listitem.constants';
15
+ import { KEYS } from '../../utils/keys';
15
16
  import { ARROW_ICONS, ARROW_DIRECTIONS, ARROW_POSITIONS } from './menuitem.constants';
16
17
  import styles from './menuitem.styles';
17
- import { KEYS } from '../../utils/keys';
18
18
  /**
19
19
  * menuitem component is inherited by listitem component with the role set `menuitem`.<br/>
20
20
  * A menu item can contain an icon on the leading or trailing side.
@@ -75,14 +75,14 @@ class MenuItem extends ListItem {
75
75
  * based on `arrowPosition` and `arrowDirection`.
76
76
  */
77
77
  renderTrailingControls() {
78
- const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.NEGATIVE
79
- ? ARROW_ICONS.LEFT
80
- : ARROW_ICONS.RIGHT;
78
+ const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.NEGATIVE ? ARROW_ICONS.LEFT : ARROW_ICONS.RIGHT;
81
79
  return html `
82
- <slot name="trailing-controls"
83
- @click=${this.stopEventPropagation}
84
- @keyup=${this.stopEventPropagation}
85
- @keydown=${this.stopEventPropagation}></slot>
80
+ <slot
81
+ name="trailing-controls"
82
+ @click=${this.stopEventPropagation}
83
+ @keyup=${this.stopEventPropagation}
84
+ @keydown=${this.stopEventPropagation}
85
+ ></slot>
86
86
  ${this.arrowPosition === ARROW_POSITIONS.TRAILING
87
87
  ? html `<mdc-icon name="${arrowIcon}" length-unit="rem" part="trailing-arrow"></mdc-icon>`
88
88
  : nothing}
@@ -93,14 +93,14 @@ class MenuItem extends ListItem {
93
93
  * based on `arrowPosition` and `arrowDirection`.
94
94
  */
95
95
  renderLeadingControls() {
96
- const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.POSITIVE
97
- ? ARROW_ICONS.RIGHT
98
- : ARROW_ICONS.LEFT;
96
+ const arrowIcon = this.arrowDirection === ARROW_DIRECTIONS.POSITIVE ? ARROW_ICONS.RIGHT : ARROW_ICONS.LEFT;
99
97
  return html `
100
- <slot name="leading-controls"
101
- @click=${this.stopEventPropagation}
102
- @keyup=${this.stopEventPropagation}
103
- @keydown=${this.stopEventPropagation}></slot>
98
+ <slot
99
+ name="leading-controls"
100
+ @click=${this.stopEventPropagation}
101
+ @keyup=${this.stopEventPropagation}
102
+ @keydown=${this.stopEventPropagation}
103
+ ></slot>
104
104
  ${this.arrowPosition === ARROW_POSITIONS.LEADING
105
105
  ? html `<mdc-icon name="${arrowIcon}" length-unit="rem" part="leading-arrow"></mdc-icon>`
106
106
  : nothing}
@@ -2,9 +2,10 @@ import { css } from 'lit';
2
2
  const styles = css `
3
3
  :host(:dir(rtl))::part(trailing-arrow),
4
4
  :host(:dir(rtl))::part(leading-arrow) {
5
- transform: rotate(180deg);
5
+ transform: rotate(180deg);
6
6
  }
7
- :host::part(trailing-arrow), :host::part(leading-arrow) {
7
+ :host::part(trailing-arrow),
8
+ :host::part(leading-arrow) {
8
9
  --mdc-icon-size: 1.25rem;
9
10
  }
10
11
  `;
@@ -1,7 +1,7 @@
1
1
  import type { CSSResult, TemplateResult } from 'lit';
2
2
  import MenuItem from '../menuitem/menuitem.component';
3
- import type { Indicator } from './menuitemcheckbox.types';
4
3
  import type { AriaCheckedStates } from '../menusection/menusection.types';
4
+ import type { Indicator } from './menuitemcheckbox.types';
5
5
  /**
6
6
  * A menuitemcheckbox component is a checkable menuitem.
7
7
  * There should be no focusable descendants inside this menuitemcheckbox component.
@@ -13,8 +13,8 @@ import { ROLE } from '../../utils/roles';
13
13
  import MenuItem from '../menuitem/menuitem.component';
14
14
  import { TYPE } from '../text/text.constants';
15
15
  import { TOGGLE_SIZE } from '../toggle/toggle.constants';
16
- import { DEFAULTS, INDICATOR } from './menuitemcheckbox.constants';
17
16
  import { ARIA_CHECKED_STATES } from '../menusection/menusection.constants';
17
+ import { DEFAULTS, INDICATOR } from './menuitemcheckbox.constants';
18
18
  import styles from './menuitemcheckbox.styles';
19
19
  /**
20
20
  * A menuitemcheckbox component is a checkable menuitem.
@@ -93,7 +93,7 @@ class MenuItemCheckbox extends MenuItem {
93
93
  ?checked="${this.ariaChecked === ARIA_CHECKED_STATES.TRUE}"
94
94
  ?disabled="${this.disabled}"
95
95
  ></mdc-staticcheckbox>
96
- `;
96
+ `;
97
97
  }
98
98
  /**
99
99
  * Returns a static toggle element if the indicator is set to toggle.
@@ -126,13 +126,7 @@ class MenuItemCheckbox extends MenuItem {
126
126
  if (this.indicator !== INDICATOR.CHECKMARK || this.ariaChecked === ARIA_CHECKED_STATES.FALSE) {
127
127
  return nothing;
128
128
  }
129
- return html `
130
- <mdc-icon
131
- slot="trailing-controls"
132
- name="check-bold"
133
- part="checkmark-icon"
134
- ></mdc-icon>
135
- `;
129
+ return html ` <mdc-icon slot="trailing-controls" name="check-bold" part="checkmark-icon"></mdc-icon> `;
136
130
  }
137
131
  render() {
138
132
  return html `
@@ -151,8 +145,7 @@ class MenuItemCheckbox extends MenuItem {
151
145
  ${this.getText('trailing-text-subline', TYPE.BODY_SMALL_REGULAR, this.sublineText)}
152
146
  </div>
153
147
  <slot name="trailing-controls"></slot>
154
- ${this.staticToggle()}
155
- ${this.getCheckmarkIcon()}
148
+ ${this.staticToggle()} ${this.getCheckmarkIcon()}
156
149
  </div>
157
150
  `;
158
151
  }
@@ -58,7 +58,7 @@ class MenuItemRadio extends MenuItem {
58
58
  const container = this.closest(`${MENUSECTION_TAGNAME}, ${MENUPOPOVER_TAGNAME}`);
59
59
  if (container) {
60
60
  const radios = Array.from(container.querySelectorAll(this.tagName));
61
- radios.forEach((item) => {
61
+ radios.forEach(item => {
62
62
  const radio = item;
63
63
  if (radio.name === this.name) {
64
64
  radio.ariaChecked = ARIA_CHECKED_STATES.FALSE;
@@ -14,10 +14,10 @@ import { TAG_NAME as MENUSECTION_TAGNAME } from '../menusection/menusection.cons
14
14
  import { ORIENTATION } from '../menubar/menubar.constants';
15
15
  import Popover from '../popover/popover.component';
16
16
  import { COLOR } from '../popover/popover.constants';
17
+ import { popoverStack } from '../popover/popover.stack';
17
18
  import { DEFAULTS, TAG_NAME as MENU_POPOVER } from './menupopover.constants';
18
19
  import styles from './menupopover.styles';
19
20
  import { isActiveMenuItem, isValidMenuItem, isValidPopover } from './menupopover.utils';
20
- import { popoverStack } from '../popover/popover.stack';
21
21
  /**
22
22
  * A popover menu component that displays a list of menu items in a floating container.
23
23
  * It's designed to work in conjunction with `mdc-menubar` and `mdc-menuitem` to create
@@ -84,15 +84,15 @@ class MenuPopover extends Popover {
84
84
  var _a;
85
85
  const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
86
86
  const allAssignedElements = ((slot === null || slot === void 0 ? void 0 : slot.assignedElements({ flatten: true })) || []);
87
- return allAssignedElements.map((node) => {
87
+ return allAssignedElements
88
+ .map(node => {
88
89
  if (node.tagName.toLowerCase() === MENUSECTION_TAGNAME) {
89
- return Array.from(node.children)
90
- .filter((child) => isValidMenuItem(child));
90
+ return Array.from(node.children).filter(child => isValidMenuItem(child));
91
91
  }
92
92
  return isValidMenuItem(node) ? node : [];
93
93
  })
94
94
  .flat()
95
- .filter((node) => !!node && !node.hasAttribute('disabled'));
95
+ .filter(node => !!node && !node.hasAttribute('disabled'));
96
96
  }
97
97
  connectedCallback() {
98
98
  super.connectedCallback();
@@ -115,7 +115,7 @@ class MenuPopover extends Popover {
115
115
  await super.firstUpdated(changedProperties);
116
116
  // Reset all tabindex to -1 and set the tabindex of the first menu item to 0
117
117
  if (this.menuItems.length > 0) {
118
- this.menuItems.forEach((menuitem) => menuitem.setAttribute('tabindex', '-1'));
118
+ this.menuItems.forEach(menuitem => menuitem.setAttribute('tabindex', '-1'));
119
119
  this.menuItems[0].setAttribute('tabindex', '0');
120
120
  }
121
121
  (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', ROLE.MENU);
@@ -126,7 +126,7 @@ class MenuPopover extends Popover {
126
126
  * @returns - The index of the current menu item in the `menuItems` array.
127
127
  */
128
128
  getCurrentIndex(target) {
129
- return this.menuItems.findIndex((node) => node === target);
129
+ return this.menuItems.findIndex(node => node === target);
130
130
  }
131
131
  /**
132
132
  * Resets the tabindex of the currently focused menu item and sets focus to a new menu item.
@@ -176,8 +176,8 @@ class MenuPopover extends Popover {
176
176
  handleMouseClick(event) {
177
177
  const target = event.target;
178
178
  const triggerId = target.getAttribute('id');
179
- if (isActiveMenuItem(target) // menuitemcheckbox and menuitemradio are not supposed to close the popover
180
- && !this.hasSubmenuWithTriggerId(triggerId)) {
179
+ if (isActiveMenuItem(target) && // menuitemcheckbox and menuitemradio are not supposed to close the popover
180
+ !this.hasSubmenuWithTriggerId(triggerId)) {
181
181
  this.closeAllMenuPopovers();
182
182
  }
183
183
  }
@@ -229,13 +229,13 @@ class MenuPopover extends Popover {
229
229
  }
230
230
  case KEYS.ARROW_DOWN: {
231
231
  // Move focus to the next menu item
232
- const newIndex = (currentIndex + 1) === this.menuItems.length ? 0 : (currentIndex + 1);
232
+ const newIndex = currentIndex + 1 === this.menuItems.length ? 0 : currentIndex + 1;
233
233
  this.resetTabIndexAndSetFocus(newIndex, currentIndex);
234
234
  break;
235
235
  }
236
236
  case KEYS.ARROW_UP: {
237
237
  // Move focus to the prev menu item
238
- const newIndex = (currentIndex - 1) === -1 ? (this.menuItems.length - 1) : (currentIndex - 1);
238
+ const newIndex = currentIndex - 1 === -1 ? this.menuItems.length - 1 : currentIndex - 1;
239
239
  this.resetTabIndexAndSetFocus(newIndex, currentIndex);
240
240
  break;
241
241
  }
@@ -6,4 +6,4 @@
6
6
  declare const isValidMenuItem: (menuItem: Element | null) => boolean;
7
7
  declare const isValidPopover: (menuItem: Element | null) => boolean;
8
8
  declare const isActiveMenuItem: (menuItem: Element | null) => boolean;
9
- export { isValidMenuItem, isValidPopover, isActiveMenuItem, };
9
+ export { isValidMenuItem, isValidPopover, isActiveMenuItem };
@@ -9,13 +9,8 @@ import { TAG_NAME as MENUPOPOVER_TAGNAME } from './menupopover.constants';
9
9
  */
10
10
  const isValidMenuItem = (menuItem) => {
11
11
  var _a, _b;
12
- return [MENUITEM_TAGNAME, MENUITEMCHECKBOX_TAGNAME, MENUITEMRADIO_TAGNAME]
13
- .includes((_b = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a));
12
+ return [MENUITEM_TAGNAME, MENUITEMCHECKBOX_TAGNAME, MENUITEMRADIO_TAGNAME].includes((_b = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a));
14
13
  };
15
14
  const isValidPopover = (menuItem) => { var _a; return ((_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === MENUPOPOVER_TAGNAME; };
16
- const isActiveMenuItem = (menuItem) => {
17
- var _a, _b;
18
- return ((_b = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a)) === MENUITEM_TAGNAME
19
- && !menuItem.hasAttribute('disabled');
20
- };
21
- export { isValidMenuItem, isValidPopover, isActiveMenuItem, };
15
+ const isActiveMenuItem = (menuItem) => { var _a, _b; return ((_b = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a)) === MENUITEM_TAGNAME && !menuItem.hasAttribute('disabled'); };
16
+ export { isValidMenuItem, isValidPopover, isActiveMenuItem };
@@ -10,8 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { html, nothing } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
- import styles from './navitem.styles';
14
- import { DEFAULTS, ALLOWED_BADGE_TYPES, ICON_NAME } from './navitem.constants';
15
13
  import providerUtils from '../../utils/provider';
16
14
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
17
15
  import { TAG_NAME as MENUPOPOVER_TAGNAME } from '../menupopover/menupopover.constants';
@@ -19,6 +17,8 @@ import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
19
17
  import MenuItem from '../menuitem/menuitem.component';
20
18
  import { getIconNameWithoutStyle } from '../button/button.utils';
21
19
  import SideNavigation from '../sidenavigation/sidenavigation.component';
20
+ import { DEFAULTS, ALLOWED_BADGE_TYPES, ICON_NAME } from './navitem.constants';
21
+ import styles from './navitem.styles';
22
22
  /**
23
23
  * `mdc-navitem` is a menuitem styled to work as a navigation tab.
24
24
  * It supports a leading icon, optional badge and dynamic text rendering.
@@ -166,7 +166,8 @@ class NavItem extends IconNameMixin(MenuItem) {
166
166
  <mdc-text
167
167
  type=${this.active ? TYPE.BODY_MIDSIZE_BOLD : TYPE.BODY_MIDSIZE_MEDIUM}
168
168
  tagname=${VALID_TEXT_TAGS.SPAN}
169
- part="text-container">
169
+ part="text-container"
170
+ >
170
171
  ${label}
171
172
  </mdc-text>
172
173
  `;
@@ -174,12 +175,7 @@ class NavItem extends IconNameMixin(MenuItem) {
174
175
  renderArrowIcon(showLabel) {
175
176
  const arrowClass = showLabel ? '' : 'arrow';
176
177
  return html `
177
- <mdc-icon
178
- name=${ICON_NAME.RIGHT_ARROW}
179
- length-unit="rem"
180
- part="trailing-arrow"
181
- class="${arrowClass}">
182
- </mdc-icon>
178
+ <mdc-icon name=${ICON_NAME.RIGHT_ARROW} length-unit="rem" part="trailing-arrow" class="${arrowClass}"> </mdc-icon>
183
179
  `;
184
180
  }
185
181
  renderBadge(showLabel) {
@@ -189,11 +185,12 @@ class NavItem extends IconNameMixin(MenuItem) {
189
185
  return nothing;
190
186
  }
191
187
  return html `
192
- <mdc-badge
188
+ <mdc-badge
193
189
  class="${badgeClass}"
194
- type="${ifDefined(this.badgeType)}"
195
- counter="${ifDefined(this.counter)}"
196
- max-counter="${this.maxCounter}">
190
+ type="${ifDefined(this.badgeType)}"
191
+ counter="${ifDefined(this.counter)}"
192
+ max-counter="${this.maxCounter}"
193
+ >
197
194
  </mdc-badge>
198
195
  `;
199
196
  }
@@ -202,12 +199,7 @@ class NavItem extends IconNameMixin(MenuItem) {
202
199
  const context = (_a = this.sideNavigationContext) === null || _a === void 0 ? void 0 : _a.value;
203
200
  return html `
204
201
  <div part="icon-container">
205
- <mdc-icon
206
- name="${this.iconName}"
207
- size="1.5"
208
- length-unit="rem"
209
- part="icon"
210
- ></mdc-icon>
202
+ <mdc-icon name="${this.iconName}" size="1.5" length-unit="rem" part="icon"></mdc-icon>
211
203
  ${!this.showLabel ? this.renderBadge(this.showLabel) : nothing}
212
204
  </div>
213
205
  ${this.showLabel ? html `${this.renderTextLabel(this.label)}${this.renderBadge(this.showLabel)}` : nothing}
@@ -1,146 +1,150 @@
1
1
  import { css } from 'lit';
2
2
  import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
3
- const styles = [hostFitContentStyles, css `
4
- :host {
5
- --mdc-navitem-color: var(--mds-color-theme-text-primary-normal);
6
- --mdc-navitem-disabled-color: var(--mds-color-theme-text-primary-disabled);
7
- --mdc-navitem-border-color: var(--mds-color-theme-outline-button-normal);
8
- --mdc-navitem-expanded-width: 12.75rem;
9
-
10
- /* Background color when in default (normal) or active state */
11
- --mdc-navitem-rest-active-background-color: var(--mds-color-theme-button-secondary-active-normal);
12
- --mdc-navitem-hover-background-color: var(--mds-color-theme-button-secondary-hover);
13
- --mdc-navitem-hover-active-background-color: var(--mds-color-theme-button-secondary-active-hover);
14
- --mdc-navitem-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
15
- --mdc-navitem-pressed-active-background-color: var(--mds-color-theme-button-secondary-active-pressed);
16
- --mdc-navitem-disabled-background-color: var(--mds-color-theme-button-secondary-disabled);
17
- --mdc-navitem-disabled-active-background-color: var(--mds-color-theme-button-secondary-active-disabled);
18
-
19
- position: relative;
20
- display: flex;
21
- align-items: center;
22
- gap: 0.5rem;
23
- padding: 0.5rem;
24
- color: var(--mdc-navitem-color);
25
- border-color: var(--mdc-navitem-border-color);
26
- border-radius: 1.25rem;
27
- cursor: pointer;
28
- }
29
-
30
- :host(:dir(ltr)) {
31
- margin-left: 1rem;
32
- }
33
-
34
- :host(:dir(rtl)) {
35
- margin-right: 1rem;
36
- }
37
-
38
- :host([show-label]) {
39
- width: var(--mdc-navitem-expanded-width);
40
- }
41
-
42
- :host([active]) {
43
- background-color: var(--mdc-navitem-rest-active-background-color);
44
- }
45
-
46
- :host([disabled]) {
47
- color: var(--mdc-navitem-disabled-color);
48
- background-color: var(--mdc-navitem-disabled-background-color);
49
- pointer-events: none;
50
- }
51
-
52
- :host([active][disabled]) {
53
- background-color: var(--mdc-navitem-disabled-active-background-color);
54
- color: var(--mdc-navitem-disabled-color);
55
- }
56
-
57
- :host(:hover) {
58
- background-color: var(--mdc-navitem-hover-background-color);
59
- }
60
-
61
- :host(:hover[active]) {
62
- background-color: var(--mdc-navitem-hover-active-background-color);
63
- }
64
-
65
- :host(:active) {
66
- background-color: var(--mdc-navitem-pressed-background-color);
67
- }
68
-
69
- :host(:active[active]) {
70
- background-color: var(--mdc-navitem-pressed-active-background-color);
71
- }
72
-
73
- :host::before {
74
- content: '';
75
- display: block;
76
- position: absolute;
77
- background-color: var(--mdc-navitem-color);
78
- width: 0.25rem;
79
- height: 1rem;
80
- pointer-events: none;
81
- visibility: hidden;
82
- }
83
-
84
- :host(:dir(ltr))::before {
85
- left: -1rem;
86
- border-radius: 0 0.25rem 0.25rem 0;
87
- }
88
-
89
- :host(:dir(rtl))::before {
90
- right: -1rem;
91
- border-radius: 0.25rem 0 0 0.25rem;
92
- }
93
-
94
- :host([active])::before {
95
- visibility: visible;
96
- }
97
-
98
- :host([disabled])::before {
99
- background-color: var(--mdc-navitem-disabled-color);
100
- }
101
-
102
- :host::part(text-container) {
103
- width: 100%;
104
- overflow: hidden;
105
- text-overflow: ellipsis;
106
- white-space: nowrap;
107
- }
108
-
109
- :host::part(icon-container) {
110
- position: relative;
111
- }
112
-
113
- :host(:dir(ltr)) .badge {
114
- position: absolute;
115
- right: -0.375rem;
116
- top: -0.375rem;
117
- }
118
-
119
- :host(:dir(rtl)) .badge {
120
- position: absolute;
121
- left: -0.375rem;
122
- top: -0.375rem;
123
- }
124
-
125
- :host(:not([show-label]))::part(trailing-arrow) {
126
- --mdc-icon-size: 0.75rem;
127
- }
128
-
129
- :host([show-label])::part(trailing-arrow) {
130
- --mdc-icon-size: 1rem;
131
- flex-shrink: 0;
132
- }
133
-
134
- :host(:dir(ltr)) .arrow {
135
- position: absolute;
136
- right: -0.75rem;
137
- top: 0.875rem;
138
- }
139
-
140
- :host(:dir(rtl)) .arrow {
141
- position: absolute;
142
- left: -0.75rem;
143
- top: 0.875rem;
144
- }
145
- `, ...hostFocusRingStyles()];
3
+ const styles = [
4
+ hostFitContentStyles,
5
+ css `
6
+ :host {
7
+ --mdc-navitem-color: var(--mds-color-theme-text-primary-normal);
8
+ --mdc-navitem-disabled-color: var(--mds-color-theme-text-primary-disabled);
9
+ --mdc-navitem-border-color: var(--mds-color-theme-outline-button-normal);
10
+ --mdc-navitem-expanded-width: 12.75rem;
11
+
12
+ /* Background color when in default (normal) or active state */
13
+ --mdc-navitem-rest-active-background-color: var(--mds-color-theme-button-secondary-active-normal);
14
+ --mdc-navitem-hover-background-color: var(--mds-color-theme-button-secondary-hover);
15
+ --mdc-navitem-hover-active-background-color: var(--mds-color-theme-button-secondary-active-hover);
16
+ --mdc-navitem-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
17
+ --mdc-navitem-pressed-active-background-color: var(--mds-color-theme-button-secondary-active-pressed);
18
+ --mdc-navitem-disabled-background-color: var(--mds-color-theme-button-secondary-disabled);
19
+ --mdc-navitem-disabled-active-background-color: var(--mds-color-theme-button-secondary-active-disabled);
20
+
21
+ position: relative;
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 0.5rem;
25
+ padding: 0.5rem;
26
+ color: var(--mdc-navitem-color);
27
+ border-color: var(--mdc-navitem-border-color);
28
+ border-radius: 1.25rem;
29
+ cursor: pointer;
30
+ }
31
+
32
+ :host(:dir(ltr)) {
33
+ margin-left: 1rem;
34
+ }
35
+
36
+ :host(:dir(rtl)) {
37
+ margin-right: 1rem;
38
+ }
39
+
40
+ :host([show-label]) {
41
+ width: var(--mdc-navitem-expanded-width);
42
+ }
43
+
44
+ :host([active]) {
45
+ background-color: var(--mdc-navitem-rest-active-background-color);
46
+ }
47
+
48
+ :host([disabled]) {
49
+ color: var(--mdc-navitem-disabled-color);
50
+ background-color: var(--mdc-navitem-disabled-background-color);
51
+ pointer-events: none;
52
+ }
53
+
54
+ :host([active][disabled]) {
55
+ background-color: var(--mdc-navitem-disabled-active-background-color);
56
+ color: var(--mdc-navitem-disabled-color);
57
+ }
58
+
59
+ :host(:hover) {
60
+ background-color: var(--mdc-navitem-hover-background-color);
61
+ }
62
+
63
+ :host(:hover[active]) {
64
+ background-color: var(--mdc-navitem-hover-active-background-color);
65
+ }
66
+
67
+ :host(:active) {
68
+ background-color: var(--mdc-navitem-pressed-background-color);
69
+ }
70
+
71
+ :host(:active[active]) {
72
+ background-color: var(--mdc-navitem-pressed-active-background-color);
73
+ }
74
+
75
+ :host::before {
76
+ content: '';
77
+ display: block;
78
+ position: absolute;
79
+ background-color: var(--mdc-navitem-color);
80
+ width: 0.25rem;
81
+ height: 1rem;
82
+ pointer-events: none;
83
+ visibility: hidden;
84
+ }
85
+
86
+ :host(:dir(ltr))::before {
87
+ left: -1rem;
88
+ border-radius: 0 0.25rem 0.25rem 0;
89
+ }
90
+
91
+ :host(:dir(rtl))::before {
92
+ right: -1rem;
93
+ border-radius: 0.25rem 0 0 0.25rem;
94
+ }
95
+
96
+ :host([active])::before {
97
+ visibility: visible;
98
+ }
99
+
100
+ :host([disabled])::before {
101
+ background-color: var(--mdc-navitem-disabled-color);
102
+ }
103
+
104
+ :host::part(text-container) {
105
+ width: 100%;
106
+ overflow: hidden;
107
+ text-overflow: ellipsis;
108
+ white-space: nowrap;
109
+ }
110
+
111
+ :host::part(icon-container) {
112
+ position: relative;
113
+ }
114
+
115
+ :host(:dir(ltr)) .badge {
116
+ position: absolute;
117
+ right: -0.375rem;
118
+ top: -0.375rem;
119
+ }
120
+
121
+ :host(:dir(rtl)) .badge {
122
+ position: absolute;
123
+ left: -0.375rem;
124
+ top: -0.375rem;
125
+ }
126
+
127
+ :host(:not([show-label]))::part(trailing-arrow) {
128
+ --mdc-icon-size: 0.75rem;
129
+ }
130
+
131
+ :host([show-label])::part(trailing-arrow) {
132
+ --mdc-icon-size: 1rem;
133
+ flex-shrink: 0;
134
+ }
135
+
136
+ :host(:dir(ltr)) .arrow {
137
+ position: absolute;
138
+ right: -0.75rem;
139
+ top: 0.875rem;
140
+ }
141
+
142
+ :host(:dir(rtl)) .arrow {
143
+ position: absolute;
144
+ left: -0.75rem;
145
+ top: 0.875rem;
146
+ }
147
+ `,
148
+ ...hostFocusRingStyles(),
149
+ ];
146
150
  export default styles;
@@ -8,13 +8,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { property } from 'lit/decorators.js';
11
- import styles from './navitemlist.styles';
12
11
  import MenuBar from '../menubar/menubar.component';
13
12
  import { MenuMixin } from '../../utils/mixins/MenuMixin';
14
13
  import { ORIENTATION } from '../menubar/menubar.constants';
15
14
  import providerUtils from '../../utils/provider';
16
15
  import { TAG_NAME as NAVITEM_TAGNAME } from '../navitem/navitem.constants';
17
16
  import SideNavigation from '../sidenavigation/sidenavigation.component';
17
+ import styles from './navitemlist.styles';
18
18
  /**
19
19
  * `mdc-navitemlist` is a container component used to group multiple mdc-navitem elements into a navigation list.
20
20
  * It provides the structural foundation for organizing vertical nav items and
@@ -54,7 +54,7 @@ class NavItemList extends MenuMixin(MenuBar) {
54
54
  *
55
55
  * @internal
56
56
  */
57
- this.findNav = (navs, navId) => navs.find((nav) => nav.navId === navId);
57
+ this.findNav = (navs, navId) => navs.find(nav => nav.navId === navId);
58
58
  }
59
59
  connectedCallback() {
60
60
  super.connectedCallback();