@momentum-design/components 0.84.3 → 0.84.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 (182) hide show
  1. package/README.md +8 -3
  2. package/dist/browser/index.js +2233 -2291
  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.js +28 -29
  54. package/dist/components/dialog/dialog.styles.js +10 -12
  55. package/dist/components/divider/divider.component.js +6 -8
  56. package/dist/components/divider/divider.constants.d.ts +1 -1
  57. package/dist/components/divider/divider.constants.js +1 -1
  58. package/dist/components/divider/divider.styles.js +5 -20
  59. package/dist/components/filterchip/filterchip.styles.js +4 -2
  60. package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
  61. package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
  62. package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
  63. package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
  64. package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
  65. package/dist/components/icon/icon.component.js +7 -7
  66. package/dist/components/icon/icon.utils.d.ts +1 -1
  67. package/dist/components/icon/icon.utils.js +7 -7
  68. package/dist/components/iconprovider/iconprovider.component.js +7 -7
  69. package/dist/components/input/input.component.d.ts +5 -5
  70. package/dist/components/input/input.component.js +64 -62
  71. package/dist/components/input/input.styles.js +128 -117
  72. package/dist/components/inputchip/inputchip.component.js +14 -19
  73. package/dist/components/inputchip/inputchip.styles.js +5 -3
  74. package/dist/components/link/link.component.d.ts +1 -1
  75. package/dist/components/link/link.component.js +4 -8
  76. package/dist/components/link/link.constants.d.ts +1 -1
  77. package/dist/components/link/link.constants.js +1 -1
  78. package/dist/components/link/link.styles.js +12 -12
  79. package/dist/components/linksimple/linksimple.component.js +2 -4
  80. package/dist/components/linksimple/linksimple.styles.js +59 -57
  81. package/dist/components/list/list.component.js +12 -9
  82. package/dist/components/listitem/listitem.component.js +15 -11
  83. package/dist/components/listitem/listitem.styles.js +11 -6
  84. package/dist/components/marker/marker.component.js +1 -1
  85. package/dist/components/marker/marker.styles.js +2 -2
  86. package/dist/components/menubar/menubar.component.d.ts +19 -19
  87. package/dist/components/menubar/menubar.component.js +19 -19
  88. package/dist/components/menuitem/menuitem.component.js +15 -15
  89. package/dist/components/menuitem/menuitem.styles.js +3 -2
  90. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
  91. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
  92. package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
  93. package/dist/components/menupopover/menupopover.component.js +11 -11
  94. package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
  95. package/dist/components/menupopover/menupopover.utils.js +3 -8
  96. package/dist/components/navitem/navitem.component.js +11 -19
  97. package/dist/components/navitem/navitem.styles.js +147 -143
  98. package/dist/components/navitemlist/navitemlist.component.js +2 -2
  99. package/dist/components/optgroup/optgroup.component.js +12 -9
  100. package/dist/components/option/option.component.js +11 -11
  101. package/dist/components/option/option.styles.js +1 -1
  102. package/dist/components/popover/popover.component.js +4 -4
  103. package/dist/components/popover/popover.stack.js +1 -1
  104. package/dist/components/popover/popover.styles.js +0 -1
  105. package/dist/components/popover/popover.utils.js +3 -4
  106. package/dist/components/presence/presence.component.d.ts +4 -4
  107. package/dist/components/presence/presence.component.js +4 -4
  108. package/dist/components/progressbar/progressbar.component.js +3 -4
  109. package/dist/components/progressbar/progressbar.styles.js +77 -71
  110. package/dist/components/progressspinner/progressspiner.utils.js +4 -4
  111. package/dist/components/progressspinner/progressspinner.component.js +38 -37
  112. package/dist/components/progressspinner/progressspinner.styles.js +1 -1
  113. package/dist/components/radio/radio.component.d.ts +41 -41
  114. package/dist/components/radio/radio.component.js +84 -83
  115. package/dist/components/radio/radio.styles.js +77 -75
  116. package/dist/components/radiogroup/radiogroup.component.js +1 -1
  117. package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
  118. package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
  119. package/dist/components/searchfield/searchfield.component.js +23 -17
  120. package/dist/components/searchfield/searchfield.styles.js +11 -13
  121. package/dist/components/select/select.component.js +20 -23
  122. package/dist/components/select/select.styles.js +9 -9
  123. package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
  124. package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
  125. package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
  126. package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
  127. package/dist/components/skeleton/skeleton.component.js +1 -4
  128. package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
  129. package/dist/components/skeleton/skeleton.constants.js +1 -1
  130. package/dist/components/skeleton/skeleton.styles.js +4 -4
  131. package/dist/components/spinner/spinner.component.d.ts +7 -7
  132. package/dist/components/spinner/spinner.component.js +9 -9
  133. package/dist/components/spinner/spinner.styles.js +58 -53
  134. package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
  135. package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
  136. package/dist/components/staticradio/staticradio.component.d.ts +8 -8
  137. package/dist/components/staticradio/staticradio.component.js +10 -11
  138. package/dist/components/staticradio/staticradio.styles.js +77 -75
  139. package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
  140. package/dist/components/statictoggle/statictoggle.component.js +3 -3
  141. package/dist/components/statictoggle/statictoggle.styles.js +71 -68
  142. package/dist/components/tab/tab.component.d.ts +1 -1
  143. package/dist/components/tab/tab.component.js +2 -2
  144. package/dist/components/tab/tab.styles.js +247 -245
  145. package/dist/components/tablist/tablist.component.js +11 -15
  146. package/dist/components/tablist/tablist.styles.js +27 -25
  147. package/dist/components/tablist/tablist.types.d.ts +1 -1
  148. package/dist/components/tablist/tablist.utils.js +4 -4
  149. package/dist/components/text/fonts.styles.js +49 -49
  150. package/dist/components/text/text.component.js +21 -11
  151. package/dist/components/text/text.types.d.ts +1 -1
  152. package/dist/components/textarea/textarea.component.d.ts +31 -31
  153. package/dist/components/textarea/textarea.component.js +54 -61
  154. package/dist/components/textarea/textarea.styles.js +123 -122
  155. package/dist/components/themeprovider/themeprovider.component.js +1 -1
  156. package/dist/components/themeprovider/themeprovider.styles.js +4 -4
  157. package/dist/components/toggle/toggle.component.d.ts +35 -35
  158. package/dist/components/toggle/toggle.component.js +62 -63
  159. package/dist/components/toggle/toggle.styles.js +77 -69
  160. package/dist/components/toggletip/toggletip.component.d.ts +7 -7
  161. package/dist/components/toggletip/toggletip.component.js +3 -2
  162. package/dist/components/tooltip/tooltip.component.js +1 -1
  163. package/dist/components/tooltip/tooltip.styles.js +0 -1
  164. package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
  165. package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
  166. package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
  167. package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
  168. package/dist/custom-elements.json +514 -514
  169. package/dist/index.js +1 -0
  170. package/dist/models/component/index.d.ts +1 -1
  171. package/dist/models/index.d.ts +2 -2
  172. package/dist/models/index.js +1 -1
  173. package/dist/react/index.d.ts +4 -4
  174. package/dist/react/index.js +4 -4
  175. package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
  176. package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
  177. package/dist/utils/mixins/FocusTrapMixin.js +12 -12
  178. package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
  179. package/dist/utils/mixins/MenuMixin.js +23 -23
  180. package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
  181. package/dist/utils/styles/index.js +12 -12
  182. package/package.json +1 -1
@@ -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();
@@ -29,7 +29,7 @@ import styles from './optgroup.styles';
29
29
  */
30
30
  class OptGroup extends DataAriaLabelMixin(DisabledMixin(Component)) {
31
31
  setDisabledForAllOptions() {
32
- this.options.forEach((element) => {
32
+ this.options.forEach(element => {
33
33
  if (this.disabled) {
34
34
  element.setAttribute('disabled', '');
35
35
  }
@@ -46,14 +46,17 @@ class OptGroup extends DataAriaLabelMixin(DisabledMixin(Component)) {
46
46
  }
47
47
  render() {
48
48
  var _a;
49
- const headerText = this.label ? html `
50
- <mdc-text
51
- id="${HEADER_ID}"
52
- part="header-text"
53
- type="${TYPE.BODY_MIDSIZE_BOLD}"
54
- tagname="${VALID_TEXT_TAGS.SPAN}"
55
- >${this.label}</mdc-text>
56
- ` : nothing;
49
+ const headerText = this.label
50
+ ? html `
51
+ <mdc-text
52
+ id="${HEADER_ID}"
53
+ part="header-text"
54
+ type="${TYPE.BODY_MIDSIZE_BOLD}"
55
+ tagname="${VALID_TEXT_TAGS.SPAN}"
56
+ >${this.label}</mdc-text
57
+ >
58
+ `
59
+ : nothing;
57
60
  return html `
58
61
  <div
59
62
  role="${ROLE.GROUP}"
@@ -78,22 +78,22 @@ class Option extends FormInternalsMixin(ListItem) {
78
78
  }
79
79
  }
80
80
  render() {
81
- const prefixIconContent = this.prefixIcon ? html `
82
- <div part="leading-icon">
83
- <mdc-icon length-unit="rem" slot="leading-controls" name="${ifDefined(this.prefixIcon)}"></mdc-icon>
84
- </div>
85
- ` : nothing;
86
- const selectedIcon = this.selected ? html `
87
- <mdc-icon length-unit="rem" slot="trailing-controls" name="${SELECTED_ICON_NAME}"></mdc-icon>
88
- ` : nothing;
81
+ const prefixIconContent = this.prefixIcon
82
+ ? html `
83
+ <div part="leading-icon">
84
+ <mdc-icon length-unit="rem" slot="leading-controls" name="${ifDefined(this.prefixIcon)}"></mdc-icon>
85
+ </div>
86
+ `
87
+ : nothing;
88
+ const selectedIcon = this.selected
89
+ ? html ` <mdc-icon length-unit="rem" slot="trailing-controls" name="${SELECTED_ICON_NAME}"></mdc-icon> `
90
+ : nothing;
89
91
  return html `
90
92
  ${prefixIconContent}
91
93
  <div part="leading-text">
92
94
  ${this.getText('leading-text-primary-label', TYPE.BODY_MIDSIZE_REGULAR, this.label)}
93
95
  </div>
94
- <div part="trailing">
95
- ${selectedIcon}
96
- </div>
96
+ <div part="trailing">${selectedIcon}</div>
97
97
  <slot part="default-slot" @slotchange="${this.handleDefaultSlotChange}"></slot>
98
98
  `;
99
99
  }
@@ -11,7 +11,7 @@ const styles = css `
11
11
  height: 2.25rem;
12
12
  }
13
13
  :host::part(default-slot) {
14
- display: none;
14
+ display: none;
15
15
  }
16
16
  :host::part(leading-icon),
17
17
  :host::part(trailing) {
@@ -469,7 +469,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
469
469
  }
470
470
  if (changedProperties.has('trigger')) {
471
471
  const triggers = this.trigger.split(' ');
472
- const validTriggers = triggers.filter((trigger) => Object.values(TRIGGER).includes(trigger));
472
+ const validTriggers = triggers.filter(trigger => Object.values(TRIGGER).includes(trigger));
473
473
  this.setAttribute('trigger', validTriggers.length > 0 ? this.trigger : DEFAULTS.TRIGGER);
474
474
  this.removeEventListeners();
475
475
  this.setupTriggerListener();
@@ -483,9 +483,9 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
483
483
  if (changedProperties.has('append-to')) {
484
484
  this.utils.setupAppendTo();
485
485
  }
486
- if (changedProperties.has('interactive')
487
- || changedProperties.has('aria-label')
488
- || changedProperties.has('aria-labelledby')) {
486
+ if (changedProperties.has('interactive') ||
487
+ changedProperties.has('aria-label') ||
488
+ changedProperties.has('aria-labelledby')) {
489
489
  this.utils.setupAccessibility();
490
490
  }
491
491
  if (changedProperties.has('disableAriaExpanded')) {
@@ -43,7 +43,7 @@ class PopoverStack {
43
43
  * @param popover - Popover instance
44
44
  */
45
45
  remove(popover) {
46
- this.stack = this.stack.filter((item) => item !== popover);
46
+ this.stack = this.stack.filter(item => item !== popover);
47
47
  }
48
48
  /**
49
49
  * Clears the stack
@@ -37,7 +37,6 @@ const styles = css `
37
37
  }
38
38
 
39
39
  :host([color='contrast']) {
40
-
41
40
  .popover-arrow {
42
41
  background-color: var(--mdc-popover-inverted-background-color);
43
42
  border-color: var(--mdc-popover-inverted-border-color);
@@ -13,7 +13,7 @@ export class PopoverUtils {
13
13
  */
14
14
  setupDelay() {
15
15
  try {
16
- const [openDelay, closeDelay] = this.popover.delay.split(',').map((delay) => {
16
+ const [openDelay, closeDelay] = this.popover.delay.split(',').map(delay => {
17
17
  const parsed = parseInt(delay, 10);
18
18
  if (Number.isNaN(parsed) || parsed < 0) {
19
19
  throw new Error(`Invalid delay value: ${delay}`);
@@ -98,9 +98,8 @@ export class PopoverUtils {
98
98
  }
99
99
  if (this.popover.interactive) {
100
100
  if (!this.popover.ariaLabel) {
101
- this.popover.ariaLabel = ((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel)
102
- || ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent)
103
- || '';
101
+ this.popover.ariaLabel =
102
+ ((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel) || ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent) || '';
104
103
  }
105
104
  if (!this.popover.ariaLabelledby) {
106
105
  this.popover.ariaLabelledby = ((_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.id) || '';