@momentum-design/components 0.106.4 → 0.106.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 (36) hide show
  1. package/dist/browser/index.js +208 -208
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/listitem/index.d.ts +0 -1
  4. package/dist/components/listitem/index.js +0 -1
  5. package/dist/components/listitem/listitem.component.d.ts +8 -31
  6. package/dist/components/listitem/listitem.component.js +17 -80
  7. package/dist/components/listitem/listitem.constants.d.ts +0 -1
  8. package/dist/components/listitem/listitem.constants.js +0 -2
  9. package/dist/components/menuitem/index.d.ts +0 -1
  10. package/dist/components/menuitem/index.js +0 -1
  11. package/dist/components/menuitem/menuitem.component.d.ts +3 -1
  12. package/dist/components/menuitem/menuitem.component.js +3 -1
  13. package/dist/components/navmenuitem/navmenuitem.component.d.ts +9 -0
  14. package/dist/components/navmenuitem/navmenuitem.component.js +45 -1
  15. package/dist/components/option/index.d.ts +0 -1
  16. package/dist/components/option/index.js +0 -1
  17. package/dist/components/option/option.component.d.ts +3 -3
  18. package/dist/components/option/option.component.js +3 -3
  19. package/dist/components/select/select.component.d.ts +2 -2
  20. package/dist/components/select/select.component.js +2 -2
  21. package/dist/custom-elements.json +462 -903
  22. package/dist/react/index.d.ts +2 -2
  23. package/dist/react/index.js +2 -2
  24. package/dist/react/listitem/index.d.ts +2 -5
  25. package/dist/react/listitem/index.js +2 -5
  26. package/dist/react/menuitem/index.d.ts +3 -1
  27. package/dist/react/menuitem/index.js +3 -1
  28. package/dist/react/navmenuitem/index.d.ts +2 -0
  29. package/dist/react/navmenuitem/index.js +2 -0
  30. package/dist/react/option/index.d.ts +3 -3
  31. package/dist/react/option/index.js +3 -3
  32. package/dist/react/select/index.d.ts +2 -2
  33. package/dist/react/select/index.js +2 -2
  34. package/package.json +1 -1
  35. package/dist/components/listitem/listitem.utils.d.ts +0 -3
  36. package/dist/components/listitem/listitem.utils.js +0 -4
@@ -1,5 +1,4 @@
1
1
  import '../text';
2
- import '../tooltip';
3
2
  import ListItem from './listitem.component';
4
3
  declare global {
5
4
  interface HTMLElementTagNameMap {
@@ -1,5 +1,4 @@
1
1
  import '../text';
2
- import '../tooltip';
3
2
  import ListItem from './listitem.component';
4
3
  import { TAG_NAME } from './listitem.constants';
5
4
  ListItem.register(TAG_NAME);
@@ -1,6 +1,5 @@
1
1
  import { CSSResult, PropertyValues, TemplateResult } from 'lit';
2
2
  import { Component } from '../../models';
3
- import type { PopoverPlacement } from '../popover/popover.types';
4
3
  import type { TextType } from '../text/text.types';
5
4
  import { ListItemVariants } from './listitem.types';
6
5
  declare const ListItem_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/lifecycle/LifeCycleMixin").LifeCycleMixinInterface> & typeof Component;
@@ -15,15 +14,12 @@ declare const ListItem_base: import("../../utils/mixins/index.types").Constructo
15
14
  * Based on the leading/trailing slot, the position of the controls and text can be adjusted. <br/>
16
15
  * Please use mdc-list as a parent element even when there is only listitem for a11y purpose.
17
16
  *
18
- * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the listitem.
19
- * The placement of the tooltip can be adjusted using the tooltip-placement attribute.
20
- * This will be helpful when the listitem text is truncated or
21
- * when you want to display additional information about the listitem.
17
+ * **Note**: If a listitem contains a long text, it is recommended to create a tooltip for the listitem that displays the full text on hover.
18
+ * Consumers need to add a unique ID to this listitem and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the listitem using the `triggerID` attribute.
22
19
  *
23
20
  * @tagname mdc-listitem
24
21
  *
25
22
  * @dependency mdc-text
26
- * @dependency mdc-tooltip
27
23
  *
28
24
  * @slot leading-controls - slot for list item controls to appear of leading end.
29
25
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -105,18 +101,14 @@ declare class ListItem extends ListItem_base {
105
101
  * @default undefined
106
102
  */
107
103
  softDisabled?: boolean;
108
- /**
109
- * The tooltip text is displayed on hover of the list item.
110
- */
111
- tooltipText?: string;
112
- /**
113
- * The tooltip placement of the list item. If the tooltip text is present,
114
- * then this tooltip placement will be applied.
115
- * @default 'top'
116
- */
117
- tooltipPlacement: PopoverPlacement;
118
104
  constructor();
119
105
  connectedCallback(): void;
106
+ /**
107
+ * Handles the click event on the list item.
108
+ * Prevents click when listitem is disabled
109
+ * @param event - The mouse event triggered when the list item is clicked.
110
+ */
111
+ private handleClick;
120
112
  /**
121
113
  * Fires the click event when the enter or space key is pressed down.
122
114
  * This behavior is similar to a button click and key interaction.
@@ -127,21 +119,6 @@ declare class ListItem extends ListItem_base {
127
119
  * Triggers a click event on the list item.
128
120
  */
129
121
  protected triggerClickEvent(): void;
130
- /**
131
- * Handles the click event on the list item.
132
- * If the tooltip is open, it has to be closed first.
133
- */
134
- private handleClick;
135
- /**
136
- * Display a tooltip for the listitem.
137
- * Create the tooltip programmatically after the nearest parent element.
138
- */
139
- private displayTooltipForLongText;
140
- /**
141
- * Removes the dynamically created tooltip for long text label on focus or mouse leave.
142
- * This is triggered on focusout and mouseout events.
143
- */
144
- private hideTooltipOnLeave;
145
122
  /**
146
123
  * Generates a template for a text slot with the specified content.
147
124
  *
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  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
- import { nothing, html } from 'lit';
10
+ import { html, nothing } from 'lit';
11
11
  import { property, queryAssignedElements } from 'lit/decorators.js';
12
12
  import { Component } from '../../models';
13
13
  import { KEYS } from '../../utils/keys';
@@ -15,12 +15,10 @@ import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
15
15
  import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
16
16
  import { ROLE } from '../../utils/roles';
17
17
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
18
- import { TAG_NAME as TOOLTIP_TAG_NAME } from '../tooltip/tooltip.constants';
19
18
  import { LifeCycleMixin } from '../../utils/mixins/lifecycle/LifeCycleMixin';
20
19
  import { DEFAULTS } from './listitem.constants';
21
- import styles from './listitem.styles';
22
- import { generateListItemId, generateTooltipId } from './listitem.utils';
23
20
  import { ListItemEventManager } from './listitem.events';
21
+ import styles from './listitem.styles';
24
22
  /**
25
23
  * mdc-listitem component is used to display a label with different types of controls.
26
24
  * There can be three types of controls, a radio button, a checkbox on the
@@ -32,15 +30,12 @@ import { ListItemEventManager } from './listitem.events';
32
30
  * Based on the leading/trailing slot, the position of the controls and text can be adjusted. <br/>
33
31
  * Please use mdc-list as a parent element even when there is only listitem for a11y purpose.
34
32
  *
35
- * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the listitem.
36
- * The placement of the tooltip can be adjusted using the tooltip-placement attribute.
37
- * This will be helpful when the listitem text is truncated or
38
- * when you want to display additional information about the listitem.
33
+ * **Note**: If a listitem contains a long text, it is recommended to create a tooltip for the listitem that displays the full text on hover.
34
+ * Consumers need to add a unique ID to this listitem and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the listitem using the `triggerID` attribute.
39
35
  *
40
36
  * @tagname mdc-listitem
41
37
  *
42
38
  * @dependency mdc-text
43
- * @dependency mdc-tooltip
44
39
  *
45
40
  * @slot leading-controls - slot for list item controls to appear of leading end.
46
41
  * @slot leading-text-primary-label - slot for list item primary label.
@@ -84,24 +79,25 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
84
79
  * @default 'full-width'
85
80
  */
86
81
  this.variant = DEFAULTS.VARIANT;
87
- /**
88
- * The tooltip placement of the list item. If the tooltip text is present,
89
- * then this tooltip placement will be applied.
90
- * @default 'top'
91
- */
92
- this.tooltipPlacement = DEFAULTS.TOOLTIP_PLACEMENT;
93
82
  this.addEventListener('keydown', this.handleKeyDown.bind(this));
94
- this.addEventListener('focusin', this.displayTooltipForLongText.bind(this));
95
- this.addEventListener('mouseenter', this.displayTooltipForLongText.bind(this));
96
- this.addEventListener('focusout', this.hideTooltipOnLeave.bind(this));
97
- this.addEventListener('mouseout', this.hideTooltipOnLeave.bind(this));
98
83
  this.addEventListener('click', this.handleClick.bind(this));
99
84
  }
100
85
  connectedCallback() {
101
86
  super.connectedCallback();
102
87
  this.role = this.role || ROLE.LISTITEM;
103
- // Add a unique id to the listitem if it does not have one.
104
- this.id = this.id || generateListItemId();
88
+ }
89
+ /**
90
+ * Handles the click event on the list item.
91
+ * Prevents click when listitem is disabled
92
+ * @param event - The mouse event triggered when the list item is clicked.
93
+ */
94
+ handleClick(event) {
95
+ if (this.disabled) {
96
+ // when disabled, prevent the click event from propagating
97
+ // and from firing on the host (immediate)
98
+ event.stopImmediatePropagation();
99
+ event.preventDefault();
100
+ }
105
101
  }
106
102
  /**
107
103
  * Fires the click event when the enter or space key is pressed down.
@@ -125,57 +121,6 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
125
121
  });
126
122
  this.dispatchEvent(clickEvent);
127
123
  }
128
- /**
129
- * Handles the click event on the list item.
130
- * If the tooltip is open, it has to be closed first.
131
- */
132
- handleClick(event) {
133
- if (this.disabled) {
134
- // when disabled, prevent the click event from propagating
135
- // and from firing on the host (immediate)
136
- event.stopImmediatePropagation();
137
- event.preventDefault();
138
- return;
139
- }
140
- // If the tooltip is open, it has to be closed first.
141
- this.hideTooltipOnLeave();
142
- }
143
- /**
144
- * Display a tooltip for the listitem.
145
- * Create the tooltip programmatically after the nearest parent element.
146
- */
147
- displayTooltipForLongText() {
148
- var _a, _b;
149
- if (!this.tooltipText) {
150
- return;
151
- }
152
- // Remove any existing tooltip.
153
- this.hideTooltipOnLeave();
154
- // Create tooltip for the listitem element.
155
- const tooltip = document.createElement(TOOLTIP_TAG_NAME);
156
- tooltip.id = generateTooltipId();
157
- tooltip.textContent = this.tooltipText;
158
- tooltip.setAttribute('triggerid', this.id);
159
- tooltip.setAttribute('placement', this.tooltipPlacement);
160
- tooltip.setAttribute('visible', '');
161
- tooltip.setAttribute('show-arrow', '');
162
- // Set the slot attribute if the parent element has a slot.
163
- if ((_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('slot')) {
164
- tooltip.setAttribute('slot', this.parentElement.getAttribute('slot') || '');
165
- }
166
- // Attach the tooltip programmatically after the nearest parent element.
167
- (_b = this.parentElement) === null || _b === void 0 ? void 0 : _b.after(tooltip);
168
- }
169
- /**
170
- * Removes the dynamically created tooltip for long text label on focus or mouse leave.
171
- * This is triggered on focusout and mouseout events.
172
- */
173
- hideTooltipOnLeave() {
174
- const existingTooltip = document.querySelector(`${TOOLTIP_TAG_NAME}[triggerid="${this.id}"]`);
175
- if (existingTooltip) {
176
- existingTooltip.remove();
177
- }
178
- }
179
124
  /**
180
125
  * Generates a template for a text slot with the specified content.
181
126
  *
@@ -320,12 +265,4 @@ __decorate([
320
265
  property({ type: Boolean, reflect: true, attribute: 'soft-disabled' }),
321
266
  __metadata("design:type", Boolean)
322
267
  ], ListItem.prototype, "softDisabled", void 0);
323
- __decorate([
324
- property({ type: String, reflect: true, attribute: 'tooltip-text' }),
325
- __metadata("design:type", String)
326
- ], ListItem.prototype, "tooltipText", void 0);
327
- __decorate([
328
- property({ type: String, reflect: true, attribute: 'tooltip-placement' }),
329
- __metadata("design:type", String)
330
- ], ListItem.prototype, "tooltipPlacement", void 0);
331
268
  export default ListItem;
@@ -6,6 +6,5 @@ declare const LISTITEM_VARIANTS: {
6
6
  };
7
7
  declare const DEFAULTS: {
8
8
  readonly VARIANT: "full-width";
9
- readonly TOOLTIP_PLACEMENT: "top";
10
9
  };
11
10
  export { DEFAULTS, TAG_NAME, LISTITEM_VARIANTS };
@@ -1,5 +1,4 @@
1
1
  import utils from '../../utils/tag-name';
2
- import { POPOVER_PLACEMENT } from '../popover/popover.constants';
3
2
  const TAG_NAME = utils.constructTagName('listitem');
4
3
  const LISTITEM_VARIANTS = {
5
4
  FULL_WIDTH: 'full-width',
@@ -8,6 +7,5 @@ const LISTITEM_VARIANTS = {
8
7
  };
9
8
  const DEFAULTS = {
10
9
  VARIANT: LISTITEM_VARIANTS.FULL_WIDTH,
11
- TOOLTIP_PLACEMENT: POPOVER_PLACEMENT.TOP,
12
10
  };
13
11
  export { DEFAULTS, TAG_NAME, LISTITEM_VARIANTS };
@@ -1,6 +1,5 @@
1
1
  import '../icon';
2
2
  import '../text';
3
- import '../tooltip';
4
3
  import MenuItem from './menuitem.component';
5
4
  declare global {
6
5
  interface HTMLElementTagNameMap {
@@ -1,6 +1,5 @@
1
1
  import '../icon';
2
2
  import '../text';
3
- import '../tooltip';
4
3
  import MenuItem from './menuitem.component';
5
4
  import { TAG_NAME } from './menuitem.constants';
6
5
  MenuItem.register(TAG_NAME);
@@ -13,9 +13,11 @@ import type { ArrowPositions, ArrowDirections } from './menuitem.types';
13
13
  *
14
14
  * Menu item has `name` and `value` attribute that can be used to identify the menu item when it is selected.
15
15
  *
16
+ * **Note**: If a menuitem contains a long text, it is recommended to create a tooltip for the menuitem that displays the full text on hover.
17
+ * Consumers need to add a unique ID to this menuitem and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the menuitem using the `triggerID` attribute.
18
+ *
16
19
  * @dependency mdc-text
17
20
  * @dependency mdc-icon
18
- * @dependency mdc-tooltip
19
21
  *
20
22
  * @tagname mdc-menuitem
21
23
  *
@@ -27,9 +27,11 @@ import styles from './menuitem.styles';
27
27
  *
28
28
  * Menu item has `name` and `value` attribute that can be used to identify the menu item when it is selected.
29
29
  *
30
+ * **Note**: If a menuitem contains a long text, it is recommended to create a tooltip for the menuitem that displays the full text on hover.
31
+ * Consumers need to add a unique ID to this menuitem and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the menuitem using the `triggerID` attribute.
32
+ *
30
33
  * @dependency mdc-text
31
34
  * @dependency mdc-icon
32
- * @dependency mdc-tooltip
33
35
  *
34
36
  * @tagname mdc-menuitem
35
37
  *
@@ -10,6 +10,8 @@ declare const NavMenuItem_base: import("../../utils/mixins/index.types").Constru
10
10
  * component. Its structure, spacing, and interactions are designed to align with
11
11
  * the visual and functional requirements of side navigation layouts.
12
12
  *
13
+ * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the navmenuitem. This tooltip is useful when an active navmenuitem is present within a submenu of the sidenavigation component.
14
+ *
13
15
  * @tagname mdc-navmenuitem
14
16
  *
15
17
  * @dependency mdc-icon
@@ -82,6 +84,10 @@ declare class NavMenuItem extends NavMenuItem_base {
82
84
  * The active button styling will still be applied regardless of this setting.
83
85
  */
84
86
  disableAriaCurrent?: boolean;
87
+ /**
88
+ * The tooltip text is displayed on hover of the list item.
89
+ */
90
+ tooltipText?: string;
85
91
  /**
86
92
  * @internal
87
93
  */
@@ -92,7 +98,10 @@ declare class NavMenuItem extends NavMenuItem_base {
92
98
  private readonly sideNavigationContext;
93
99
  constructor();
94
100
  connectedCallback(): void;
101
+ disconnectedCallback(): void;
95
102
  protected updated(): void;
103
+ private removeTooltip;
104
+ private renderDynamicTooltip;
96
105
  /**
97
106
  * Check whether the navmenuitem is inside a nested nav structure.
98
107
  * Returns `true` if there is a parent `mdc-menupopover`
@@ -10,6 +10,7 @@ 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 { v4 } from 'uuid';
13
14
  import providerUtils from '../../utils/provider';
14
15
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
15
16
  import { TAG_NAME as MENUPOPOVER_TAGNAME } from '../menupopover/menupopover.constants';
@@ -17,6 +18,7 @@ import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
17
18
  import MenuItem from '../menuitem/menuitem.component';
18
19
  import { getIconNameWithoutStyle } from '../button/button.utils';
19
20
  import SideNavigation from '../sidenavigation/sidenavigation.component';
21
+ import { TAG_NAME as TOOLTIP_TAG_NAME } from '../tooltip/tooltip.constants';
20
22
  import { DEFAULTS, ALLOWED_BADGE_TYPES, ICON_NAME } from './navmenuitem.constants';
21
23
  import styles from './navmenuitem.styles';
22
24
  /**
@@ -27,6 +29,8 @@ import styles from './navmenuitem.styles';
27
29
  * component. Its structure, spacing, and interactions are designed to align with
28
30
  * the visual and functional requirements of side navigation layouts.
29
31
  *
32
+ * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the navmenuitem. This tooltip is useful when an active navmenuitem is present within a submenu of the sidenavigation component.
33
+ *
30
34
  * @tagname mdc-navmenuitem
31
35
  *
32
36
  * @dependency mdc-icon
@@ -82,17 +86,24 @@ class NavMenuItem extends IconNameMixin(MenuItem) {
82
86
  this.dispatchEvent(event);
83
87
  };
84
88
  this.addEventListener('click', this.handleClickEvent.bind(this));
89
+ this.addEventListener('focusin', this.renderDynamicTooltip.bind(this));
90
+ this.addEventListener('mouseenter', this.renderDynamicTooltip.bind(this));
91
+ this.addEventListener('focusout', this.removeTooltip.bind(this));
92
+ this.addEventListener('mouseout', this.removeTooltip.bind(this));
85
93
  }
86
94
  connectedCallback() {
87
95
  super.connectedCallback();
88
96
  this.variant = undefined;
89
- this.tooltipPlacement = undefined;
90
97
  if (!this.navId && this.onerror) {
91
98
  this.onerror('[mdc-navmenuitem] navId is required and was not provided.');
92
99
  }
93
100
  // Set in-menupopover attribute if nested
94
101
  this.toggleAttribute('in-menupopover', this.isNested());
95
102
  }
103
+ disconnectedCallback() {
104
+ super.disconnectedCallback();
105
+ this.removeTooltip();
106
+ }
96
107
  updated() {
97
108
  var _a, _b;
98
109
  const context = (_a = this.sideNavigationContext) === null || _a === void 0 ? void 0 : _a.value;
@@ -110,6 +121,35 @@ class NavMenuItem extends IconNameMixin(MenuItem) {
110
121
  this.setAttribute('aria-label', label);
111
122
  }
112
123
  }
124
+ removeTooltip() {
125
+ // Remove any existing tooltip.
126
+ const existingTooltip = document.querySelector(`${TOOLTIP_TAG_NAME}[triggerid="${this.id}"]`);
127
+ if (existingTooltip) {
128
+ existingTooltip.remove();
129
+ }
130
+ }
131
+ renderDynamicTooltip() {
132
+ if (!this.tooltipText) {
133
+ return;
134
+ }
135
+ if (!this.id) {
136
+ this.id = `mdc-navmenuitem-${v4()}`;
137
+ }
138
+ this.removeTooltip();
139
+ // Create tooltip for the listitem element.
140
+ const tooltip = document.createElement(TOOLTIP_TAG_NAME);
141
+ tooltip.id = `mdc-navmenuitem-tooltip-${v4()}`;
142
+ tooltip.textContent = this.tooltipText;
143
+ tooltip.setAttribute('triggerid', this.id);
144
+ tooltip.setAttribute('visible', '');
145
+ tooltip.setAttribute('show-arrow', '');
146
+ // Set the slot attribute if the parent element has a slot.
147
+ if (this.hasAttribute('slot')) {
148
+ tooltip.setAttribute('slot', this.getAttribute('slot') || '');
149
+ }
150
+ // Attach the tooltip programmatically after the nearest parent element.
151
+ this.after(tooltip);
152
+ }
113
153
  /**
114
154
  * Check whether the navmenuitem is inside a nested nav structure.
115
155
  * Returns `true` if there is a parent `mdc-menupopover`
@@ -238,4 +278,8 @@ __decorate([
238
278
  property({ type: Boolean, reflect: true, attribute: 'disable-aria-current' }),
239
279
  __metadata("design:type", Boolean)
240
280
  ], NavMenuItem.prototype, "disableAriaCurrent", void 0);
281
+ __decorate([
282
+ property({ type: String, reflect: true, attribute: 'tooltip-text' }),
283
+ __metadata("design:type", String)
284
+ ], NavMenuItem.prototype, "tooltipText", void 0);
241
285
  export default NavMenuItem;
@@ -1,6 +1,5 @@
1
1
  import '../icon';
2
2
  import '../text';
3
- import '../tooltip';
4
3
  import Option from './option.component';
5
4
  declare global {
6
5
  interface HTMLElementTagNameMap {
@@ -1,6 +1,5 @@
1
1
  import '../icon';
2
2
  import '../text';
3
- import '../tooltip';
4
3
  import Option from './option.component';
5
4
  import { TAG_NAME } from './option.constants';
6
5
  Option.register(TAG_NAME);
@@ -13,12 +13,12 @@ declare const Option_base: import("../../utils/mixins/index.types").Constructor<
13
13
  * on the right side of the option to indicate that it is selected.
14
14
  *
15
15
  * The `prefixIcon` property can be used to display an icon on the left side of the option label.
16
- * We can show a tooltip by setting `tooltip-text` attribute. This will be displayed on hover or focus of the option.
17
- * The tooltip will be helpful for a long label text which is truncated with ellipsis.
16
+ *
17
+ * **Note**: If an option contains a long text, it is recommended to create a tooltip for the option that displays the full text on hover.
18
+ * Consumers need to add a unique ID to this option and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the option using the `triggerID` attribute.
18
19
  *
19
20
  * @dependency mdc-icon
20
21
  * @dependency mdc-text
21
- * @dependency mdc-tooltip
22
22
  *
23
23
  * @tagname mdc-option
24
24
  *
@@ -27,12 +27,12 @@ import styles from './option.styles';
27
27
  * on the right side of the option to indicate that it is selected.
28
28
  *
29
29
  * The `prefixIcon` property can be used to display an icon on the left side of the option label.
30
- * We can show a tooltip by setting `tooltip-text` attribute. This will be displayed on hover or focus of the option.
31
- * The tooltip will be helpful for a long label text which is truncated with ellipsis.
30
+ *
31
+ * **Note**: If an option contains a long text, it is recommended to create a tooltip for the option that displays the full text on hover.
32
+ * Consumers need to add a unique ID to this option and use that ID in the tooltip's `triggerID` attribute. We are not creating the tooltip automatically, consumers need to add `<mdc-tooltip>` element manually and associate it with the option using the `triggerID` attribute.
32
33
  *
33
34
  * @dependency mdc-icon
34
35
  * @dependency mdc-text
35
- * @dependency mdc-tooltip
36
36
  *
37
37
  * @tagname mdc-option
38
38
  *
@@ -8,8 +8,6 @@ declare const Select_base: import("../../utils/mixins/index.types").Constructor<
8
8
  /**
9
9
  * The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
10
10
  * It is designed to work with `mdc-option` for individual options and `mdc-optgroup` for grouping related options.
11
- * The component ensures accessibility and usability while handling various use cases,
12
- * including long text truncation with tooltip support.
13
11
  *
14
12
  * Every mdc-option should have a `value` attribute set to ensure proper form submission.
15
13
  *
@@ -17,6 +15,8 @@ declare const Select_base: import("../../utils/mixins/index.types").Constructor<
17
15
  *
18
16
  * **Note:** Make sure to add `mdc-selectlistbox` as a child of `mdc-select` and wrap options/optgroup in it to ensure proper accessibility functionality. Read more about it in SelectListBox documentation.
19
17
  *
18
+ * If you need to use `mdc-tooltip` with any options, make sure to place the tooltip component outside the `mdc-select` element.
19
+ *
20
20
  * @dependency mdc-button
21
21
  * @dependency mdc-icon
22
22
  * @dependency mdc-popover
@@ -25,8 +25,6 @@ import styles from './select.styles';
25
25
  /**
26
26
  * The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
27
27
  * It is designed to work with `mdc-option` for individual options and `mdc-optgroup` for grouping related options.
28
- * The component ensures accessibility and usability while handling various use cases,
29
- * including long text truncation with tooltip support.
30
28
  *
31
29
  * Every mdc-option should have a `value` attribute set to ensure proper form submission.
32
30
  *
@@ -34,6 +32,8 @@ import styles from './select.styles';
34
32
  *
35
33
  * **Note:** Make sure to add `mdc-selectlistbox` as a child of `mdc-select` and wrap options/optgroup in it to ensure proper accessibility functionality. Read more about it in SelectListBox documentation.
36
34
  *
35
+ * If you need to use `mdc-tooltip` with any options, make sure to place the tooltip component outside the `mdc-select` element.
36
+ *
37
37
  * @dependency mdc-button
38
38
  * @dependency mdc-icon
39
39
  * @dependency mdc-popover