@momentum-design/components 0.129.9 → 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.
- package/dist/browser/index.js +175 -175
- package/dist/browser/index.js.map +3 -3
- package/dist/components/accordion/accordion.component.d.ts +28 -27
- package/dist/components/accordion/accordion.component.js +24 -25
- package/dist/components/accordionbutton/accordionbutton.component.d.ts +31 -27
- package/dist/components/accordionbutton/accordionbutton.component.js +28 -25
- package/dist/components/accordiongroup/accordiongroup.component.d.ts +21 -22
- package/dist/components/accordiongroup/accordiongroup.component.js +21 -22
- package/dist/components/accordiongroup/accordiongroup.styles.js +5 -5
- package/dist/components/tooltip/tooltip.component.d.ts +9 -1
- package/dist/components/tooltip/tooltip.component.js +28 -17
- package/dist/components/tooltip/tooltip.constants.d.ts +5 -0
- package/dist/components/tooltip/tooltip.constants.js +6 -1
- package/dist/custom-elements.json +57 -57
- package/dist/react/accordion/index.d.ts +24 -25
- package/dist/react/accordion/index.js +24 -25
- package/dist/react/accordionbutton/index.d.ts +20 -21
- package/dist/react/accordionbutton/index.js +20 -21
- package/dist/react/accordiongroup/index.d.ts +11 -19
- package/dist/react/accordiongroup/index.js +11 -19
- package/dist/react/tooltip/index.d.ts +9 -1
- package/dist/react/tooltip/index.js +9 -1
- package/package.json +1 -1
|
@@ -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:
|
|
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.
|
|
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.
|
|
53
|
-
this.hideOnBlur =
|
|
54
|
-
this.hideOnEscape =
|
|
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.
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
this.disableFlip =
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.hideOnOutsideClick =
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
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,
|