@momentum-design/components 0.129.10 → 0.129.11

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.
@@ -3,10 +3,18 @@ import type { CSSResult } from 'lit';
3
3
  import Popover from '../popover/popover.component';
4
4
  import type { TooltipType } from './tooltip.types';
5
5
  /**
6
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
7
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
8
+ *
9
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
10
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
11
+ *
6
12
  * A tooltip is triggered by mouse hover or by keyboard focus
7
13
  * and will disappear upon mouse exit or focus change.
8
14
  *
9
- * Note: Tooltips cannot contain content that can be focused or interacted with.
15
+ * Note:
16
+ * - Tooltips cannot contain content that can be focused or interacted with.
17
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
10
18
  *
11
19
  * @tagname mdc-tooltip
12
20
  *
@@ -11,14 +11,22 @@ import { property } from 'lit/decorators.js';
11
11
  import { v4 as uuidv4 } from 'uuid';
12
12
  import { ROLE } from '../../utils/roles';
13
13
  import Popover from '../popover/popover.component';
14
- import { POPOVER_PLACEMENT } from '../popover/popover.constants';
14
+ import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT } from '../popover/popover.constants';
15
15
  import { DEFAULTS, TOOLTIP_TYPES } from './tooltip.constants';
16
16
  import styles from './tooltip.styles';
17
17
  /**
18
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
19
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
20
+ *
21
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
22
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
23
+ *
18
24
  * A tooltip is triggered by mouse hover or by keyboard focus
19
25
  * and will disappear upon mouse exit or focus change.
20
26
  *
21
- * Note: Tooltips cannot contain content that can be focused or interacted with.
27
+ * Note:
28
+ * - Tooltips cannot contain content that can be focused or interacted with.
29
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
22
30
  *
23
31
  * @tagname mdc-tooltip
24
32
  *
@@ -47,24 +55,27 @@ class Tooltip extends Popover {
47
55
  }
48
56
  connectedCallback() {
49
57
  super.connectedCallback();
50
- this.backdrop = false;
58
+ this.role = ROLE.TOOLTIP;
59
+ // We don't want the tooltip to be visible for screen readers as they are not focusable
60
+ this.ariaHidden = DEFAULTS.ARIA_HIDDEN;
61
+ // Tooltip defaults
62
+ this.backdrop = DEFAULTS.BACKDROP;
51
63
  this.delay = this.delay || DEFAULTS.DELAY;
52
- this.focusTrap = false;
53
- this.hideOnBlur = true;
54
- this.hideOnEscape = true;
55
- this.interactive = false;
64
+ this.disableAriaExpanded = DEFAULTS.DISABLE_ARIA_EXPANDED;
65
+ this.hideOnBlur = DEFAULTS.HIDE_ON_BLUR;
66
+ this.hideOnEscape = DEFAULTS.HIDE_ON_ESCAPE;
56
67
  this.offset = this.offset || DEFAULTS.OFFSET;
57
68
  this.placement = this.placement || DEFAULTS.PLACEMENT;
58
- this.role = ROLE.TOOLTIP;
59
- this.trigger = 'mouseenter focusin';
60
- this.preventScroll = false;
61
- this.disableFlip = false;
62
- this.preventScroll = false;
63
- this.closeButton = false;
64
- this.hideOnOutsideClick = false;
65
- this.focusBackToTrigger = false;
66
- this.size = false;
67
- this.disableAriaExpanded = true;
69
+ this.trigger = DEFAULTS.TRIGGER;
70
+ // Popover defaults
71
+ this.closeButton = POPOVER_DEFAULTS.CLOSE_BUTTON;
72
+ this.disableFlip = POPOVER_DEFAULTS.DISABLE_FLIP;
73
+ this.focusBackToTrigger = POPOVER_DEFAULTS.FOCUS_BACK;
74
+ this.focusTrap = POPOVER_DEFAULTS.FOCUS_TRAP;
75
+ this.hideOnOutsideClick = POPOVER_DEFAULTS.HIDE_ON_CLICK_OUTSIDE;
76
+ this.interactive = POPOVER_DEFAULTS.INTERACTIVE;
77
+ this.preventScroll = POPOVER_DEFAULTS.PREVENT_SCROLL;
78
+ this.size = POPOVER_DEFAULTS.SIZE;
68
79
  }
69
80
  /**
70
81
  * Sets the type attribute for the tooltip component.
@@ -5,8 +5,13 @@ declare const TOOLTIP_TYPES: {
5
5
  readonly NONE: "none";
6
6
  };
7
7
  declare const DEFAULTS: {
8
+ readonly ARIA_HIDDEN: "true";
8
9
  readonly BACKDROP: false;
9
10
  readonly DELAY: "0,0";
11
+ readonly DISABLE_ARIA_EXPANDED: true;
12
+ readonly HIDE_ON_BLUR: true;
13
+ readonly HIDE_ON_ESCAPE: true;
14
+ readonly TRIGGER: "mouseenter focusin";
10
15
  readonly OFFSET: 4;
11
16
  readonly PLACEMENT: "top";
12
17
  readonly SHOW_ARROW: true;
@@ -1,5 +1,5 @@
1
1
  import utils from '../../utils/tag-name';
2
- import { POPOVER_PLACEMENT } from '../popover/popover.constants';
2
+ import { POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
3
3
  const TAG_NAME = utils.constructTagName('tooltip');
4
4
  const TOOLTIP_TYPES = {
5
5
  DESCRIPTION: 'description',
@@ -7,8 +7,13 @@ const TOOLTIP_TYPES = {
7
7
  NONE: 'none',
8
8
  };
9
9
  const DEFAULTS = {
10
+ ARIA_HIDDEN: 'true',
10
11
  BACKDROP: false,
11
12
  DELAY: '0,0',
13
+ DISABLE_ARIA_EXPANDED: true,
14
+ HIDE_ON_BLUR: true,
15
+ HIDE_ON_ESCAPE: true,
16
+ TRIGGER: `${TRIGGER.MOUSEENTER} ${TRIGGER.FOCUSIN}`,
12
17
  OFFSET: 4,
13
18
  PLACEMENT: POPOVER_PLACEMENT.TOP,
14
19
  SHOW_ARROW: true,
@@ -153,8 +153,8 @@
153
153
  "attribute": "disabled",
154
154
  "reflects": true,
155
155
  "inheritedFrom": {
156
- "name": "AccordionButton",
157
- "module": "components/accordionbutton/accordionbutton.component.js"
156
+ "name": "DisabledMixin",
157
+ "module": "utils/mixins/DisabledMixin.js"
158
158
  }
159
159
  },
160
160
  {
@@ -412,8 +412,8 @@
412
412
  "default": "undefined",
413
413
  "fieldName": "disabled",
414
414
  "inheritedFrom": {
415
- "name": "AccordionButton",
416
- "module": "src/components/accordionbutton/accordionbutton.component.ts"
415
+ "name": "DisabledMixin",
416
+ "module": "src/utils/mixins/DisabledMixin.ts"
417
417
  }
418
418
  },
419
419
  {
@@ -51347,7 +51347,7 @@
51347
51347
  "declarations": [
51348
51348
  {
51349
51349
  "kind": "class",
51350
- "description": "A tooltip is triggered by mouse hover or by keyboard focus\nand will disappear upon mouse exit or focus change.\n\nNote: Tooltips cannot contain content that can be focused or interacted with.",
51350
+ "description": "A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>\nTooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.\n\nBecause of this, tooltips cannot contain content that can be focused or interacted with.\nWhen a tooltip must contain a focusable element like a link or button, use a toggle tip instead.\n\nA tooltip is triggered by mouse hover or by keyboard focus\nand will disappear upon mouse exit or focus change.\n\nNote:\n - Tooltips cannot contain content that can be focused or interacted with.\n - Tooltips will contain the default `aria-hidden=\"true\"` so that VO will never focus the tooltip.",
51351
51351
  "name": "Tooltip",
51352
51352
  "cssProperties": [
51353
51353
  {
@@ -53377,7 +53377,7 @@
53377
53377
  "module": "/src/components/popover/popover.component"
53378
53378
  },
53379
53379
  "tagName": "mdc-tooltip",
53380
- "jsDoc": "/**\n * A tooltip is triggered by mouse hover or by keyboard focus\n * and will disappear upon mouse exit or focus change.\n *\n * Note: Tooltips cannot contain content that can be focused or interacted with.\n *\n * @tagname mdc-tooltip\n *\n * @event shown - (React: onShown) This event is dispatched when the tooltip is shown\n * @event hidden - (React: onHidden) This event is dispatched when the tooltip is hidden\n * @event created - (React: onCreated) This event is dispatched when the tooltip is created (added to the DOM)\n * @event destroyed - (React: onDestroyed) This event is dispatched when the tooltip is destroyed (removed from the DOM)\n *\n * @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.\n * @cssproperty --mdc-tooltip-padding - The padding of the tooltip.\n * @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.\n * @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.\n *\n */",
53380
+ "jsDoc": "/**\n * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>\n * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.\n *\n * Because of this, tooltips cannot contain content that can be focused or interacted with.\n * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.\n *\n * A tooltip is triggered by mouse hover or by keyboard focus\n * and will disappear upon mouse exit or focus change.\n *\n * Note:\n * - Tooltips cannot contain content that can be focused or interacted with.\n * - Tooltips will contain the default `aria-hidden=\"true\"` so that VO will never focus the tooltip.\n *\n * @tagname mdc-tooltip\n *\n * @event shown - (React: onShown) This event is dispatched when the tooltip is shown\n * @event hidden - (React: onHidden) This event is dispatched when the tooltip is hidden\n * @event created - (React: onCreated) This event is dispatched when the tooltip is created (added to the DOM)\n * @event destroyed - (React: onDestroyed) This event is dispatched when the tooltip is destroyed (removed from the DOM)\n *\n * @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.\n * @cssproperty --mdc-tooltip-padding - The padding of the tooltip.\n * @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.\n * @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.\n *\n */",
53381
53381
  "customElement": true,
53382
53382
  "slots": [
53383
53383
  {
@@ -2,10 +2,18 @@ import { type EventName } from '@lit/react';
2
2
  import Component from '../../components/tooltip';
3
3
  import type { Events as EventsInherited } from '../../components/popover/popover.types';
4
4
  /**
5
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
6
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
7
+ *
8
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
9
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
10
+ *
5
11
  * A tooltip is triggered by mouse hover or by keyboard focus
6
12
  * and will disappear upon mouse exit or focus change.
7
13
  *
8
- * Note: Tooltips cannot contain content that can be focused or interacted with.
14
+ * Note:
15
+ * - Tooltips cannot contain content that can be focused or interacted with.
16
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
9
17
  *
10
18
  * @tagname mdc-tooltip
11
19
  *
@@ -3,10 +3,18 @@ import { createComponent } from '@lit/react';
3
3
  import Component from '../../components/tooltip';
4
4
  import { TAG_NAME } from '../../components/tooltip/tooltip.constants';
5
5
  /**
6
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
7
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
8
+ *
9
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
10
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
11
+ *
6
12
  * A tooltip is triggered by mouse hover or by keyboard focus
7
13
  * and will disappear upon mouse exit or focus change.
8
14
  *
9
- * Note: Tooltips cannot contain content that can be focused or interacted with.
15
+ * Note:
16
+ * - Tooltips cannot contain content that can be focused or interacted with.
17
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
10
18
  *
11
19
  * @tagname mdc-tooltip
12
20
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.129.10",
4
+ "version": "0.129.11",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"