@elliemae/ds-tooltip 2.2.0-alpha.3 → 3.0.0-next.0
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/cjs/index.js +23 -41
- package/cjs/v1/DSTooltip.js +105 -108
- package/cjs/v1/TooltipType.js +8 -36
- package/cjs/v2/DSTooltip.js +121 -117
- package/cjs/v2/DSTooltipArrow.js +38 -50
- package/cjs/v2/TooltipType.js +8 -36
- package/cjs/v2/index.d.js +2 -27
- package/cjs/v2/propTypes.js +25 -54
- package/cjs/v2/styles.js +59 -128
- package/cjs/v2/utils/setMultipleRefs.js +21 -41
- package/cjs/v2/utils/tooltipPositions.js +18 -46
- package/cjs/v3/TooltipV3DatatestId.js +8 -36
- package/cjs/v3/config/useWithDefaultProps.js +14 -40
- package/cjs/v3/index.d.js +2 -27
- package/cjs/v3/index.js +103 -90
- package/cjs/v3/propsTypes.js +94 -78
- package/cjs/v3/styleds.js +46 -69
- package/esm/index.js +5 -12
- package/esm/v1/DSTooltip.js +87 -88
- package/esm/v1/TooltipType.js +4 -7
- package/esm/v2/DSTooltip.js +97 -80
- package/esm/v2/DSTooltipArrow.js +30 -21
- package/esm/v2/TooltipType.js +4 -7
- package/esm/v2/index.d.js +1 -2
- package/esm/v2/propTypes.js +21 -25
- package/esm/v2/styles.js +47 -100
- package/esm/v2/utils/setMultipleRefs.js +18 -13
- package/esm/v2/utils/tooltipPositions.js +14 -17
- package/esm/v3/TooltipV3DatatestId.js +4 -7
- package/esm/v3/config/useWithDefaultProps.js +10 -11
- package/esm/v3/index.d.js +1 -2
- package/esm/v3/index.js +79 -54
- package/esm/v3/propsTypes.js +90 -49
- package/esm/v3/styleds.js +36 -41
- package/package.json +10 -10
- package/types/index.d.ts +1 -1
- package/cjs/index.js.map +0 -7
- package/cjs/v1/DSTooltip.js.map +0 -7
- package/cjs/v1/TooltipType.js.map +0 -7
- package/cjs/v2/DSTooltip.js.map +0 -7
- package/cjs/v2/DSTooltipArrow.js.map +0 -7
- package/cjs/v2/TooltipType.js.map +0 -7
- package/cjs/v2/index.d.js.map +0 -7
- package/cjs/v2/propTypes.js.map +0 -7
- package/cjs/v2/styles.js.map +0 -7
- package/cjs/v2/utils/setMultipleRefs.js.map +0 -7
- package/cjs/v2/utils/tooltipPositions.js.map +0 -7
- package/cjs/v3/TooltipV3DatatestId.js.map +0 -7
- package/cjs/v3/config/useWithDefaultProps.js.map +0 -7
- package/cjs/v3/index.d.js.map +0 -7
- package/cjs/v3/index.js.map +0 -7
- package/cjs/v3/propsTypes.js.map +0 -7
- package/cjs/v3/styleds.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/v1/DSTooltip.js.map +0 -7
- package/esm/v1/TooltipType.js.map +0 -7
- package/esm/v2/DSTooltip.js.map +0 -7
- package/esm/v2/DSTooltipArrow.js.map +0 -7
- package/esm/v2/TooltipType.js.map +0 -7
- package/esm/v2/index.d.js.map +0 -7
- package/esm/v2/propTypes.js.map +0 -7
- package/esm/v2/styles.js.map +0 -7
- package/esm/v2/utils/setMultipleRefs.js.map +0 -7
- package/esm/v2/utils/tooltipPositions.js.map +0 -7
- package/esm/v3/TooltipV3DatatestId.js.map +0 -7
- package/esm/v3/config/useWithDefaultProps.js.map +0 -7
- package/esm/v3/index.d.js.map +0 -7
- package/esm/v3/index.js.map +0 -7
- package/esm/v3/propsTypes.js.map +0 -7
- package/esm/v3/styleds.js.map +0 -7
package/esm/v1/DSTooltip.js
CHANGED
|
@@ -1,101 +1,100 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { PropTypes, describe } from 'react-desc';
|
|
11
|
+
import { aggregatedClasses, convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
12
|
+
import { getComponentFromProps } from '@elliemae/ds-utilities';
|
|
13
|
+
import { DEFAULT_DELAY_CLOSE, DEFAULT_DELAY_OPEN } from '@elliemae/ds-shared/constants';
|
|
14
|
+
import DSPopper, { positions, PopperPositions, interactions, PopperInteractions } from '@elliemae/ds-popper';
|
|
15
|
+
import { TooltipType } from './TooltipType.js';
|
|
16
|
+
import { jsx } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
const _excluded = ["containerProps", "innerRef", "placement", "title", "delayClose", "delayOpen", "interactionType", "triggerComponent", "className", "isOpen", "onOpen", "springAnimationComponent", "tooltipType", "showArrow", "zIndex"];
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
const blockName = 'tooltip';
|
|
24
|
+
const TooltipContainer = aggregatedClasses('div')(blockName, false, false, {
|
|
25
|
+
propsToRemoveFromFinalElement: ['isHovered', 'isDragged']
|
|
24
26
|
});
|
|
25
|
-
const TooltipText = aggregatedClasses(
|
|
26
|
-
propsToRemoveFromFinalElement: [
|
|
27
|
+
const TooltipText = aggregatedClasses('span')(blockName, 'text', false, {
|
|
28
|
+
propsToRemoveFromFinalElement: ['isHovered', 'isDragged']
|
|
27
29
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
|
|
31
|
+
const DSTooltip = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
containerProps = {},
|
|
34
|
+
innerRef,
|
|
35
|
+
placement = PopperPositions.TOP,
|
|
36
|
+
title = '',
|
|
37
|
+
delayClose = DEFAULT_DELAY_CLOSE,
|
|
38
|
+
delayOpen = DEFAULT_DELAY_OPEN,
|
|
39
|
+
interactionType = PopperInteractions.HOVER,
|
|
40
|
+
triggerComponent = null,
|
|
41
|
+
className = '',
|
|
42
|
+
isOpen = undefined,
|
|
43
|
+
onOpen = () => null,
|
|
44
|
+
springAnimationComponent = undefined,
|
|
45
|
+
tooltipType = TooltipType.TOOLTIP,
|
|
46
|
+
showArrow = true,
|
|
47
|
+
zIndex
|
|
48
|
+
} = _ref,
|
|
49
|
+
otherTooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
cssClassName: tooltipBlockName
|
|
53
|
+
} = convertPropToCssClassName(blockName);
|
|
47
54
|
let Content = title;
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
|
|
56
|
+
if (typeof title === 'string') {
|
|
57
|
+
Content = /*#__PURE__*/_jsx(TooltipText, {}, void 0, title);
|
|
50
58
|
}
|
|
51
|
-
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/_jsx(DSPopper, {
|
|
52
61
|
blockName: tooltipBlockName,
|
|
53
|
-
contentComponent:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
placement,
|
|
62
|
+
contentComponent: /*#__PURE__*/jsx(TooltipContainer, _objectSpread(_objectSpread(_objectSpread({}, containerProps), otherTooltipProps), {}, {
|
|
63
|
+
className: "tooltip-container--".concat(tooltipType, " ").concat(className),
|
|
64
|
+
innerRef: innerRef,
|
|
65
|
+
children: Content
|
|
66
|
+
})),
|
|
67
|
+
delayClose: delayClose,
|
|
68
|
+
delayOpen: delayOpen,
|
|
69
|
+
interactionType: interactionType,
|
|
70
|
+
isOpen: isOpen,
|
|
71
|
+
onOpen: onOpen,
|
|
72
|
+
placement: placement,
|
|
65
73
|
showArrow: tooltipType === TooltipType.TOOLTIP ? showArrow : false,
|
|
66
|
-
springAnimationComponent,
|
|
74
|
+
springAnimationComponent: springAnimationComponent,
|
|
67
75
|
triggerComponent: getComponentFromProps(triggerComponent),
|
|
68
|
-
zIndex
|
|
76
|
+
zIndex: zIndex
|
|
69
77
|
});
|
|
70
78
|
};
|
|
79
|
+
|
|
71
80
|
const tooltipProps = {
|
|
72
|
-
containerProps: PropTypes.object.description(
|
|
73
|
-
placement: PropTypes.oneOf(positions).description(
|
|
74
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(
|
|
75
|
-
delayClose: PropTypes.string.description(
|
|
76
|
-
delayOpen: PropTypes.string.description(
|
|
77
|
-
interactionType: PropTypes.oneOf(interactions).description(
|
|
78
|
-
triggerComponent: PropTypes.element.description(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
zIndex: PropTypes.number.description("z-index value assigned to the tooltip").defaultValue(void 0),
|
|
88
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Ref to the tooltip container element")
|
|
81
|
+
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
82
|
+
placement: PropTypes.oneOf(positions).description('Tooltip position').defaultValue(PopperPositions.TOP),
|
|
83
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description('Tooltip content').isRequired,
|
|
84
|
+
delayClose: PropTypes.string.description('Delay to close the tooltip').defaultValue(DEFAULT_DELAY_CLOSE),
|
|
85
|
+
delayOpen: PropTypes.string.description('Delay to open the tooltip ').defaultValue(DEFAULT_DELAY_OPEN),
|
|
86
|
+
interactionType: PropTypes.oneOf(interactions).description('A type indicating how to open/close the tooltip').defaultValue(PopperInteractions.HOVER),
|
|
87
|
+
triggerComponent: PropTypes.element.description("The component that will open/close the tooltip. \n Cannot be used with disabled elements. \n https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled").isRequired,
|
|
88
|
+
isOpen: PropTypes.bool.description('Whether the tooltip is visible or not').defaultValue(undefined),
|
|
89
|
+
onOpen: PropTypes.func.description('Handler when the tooltip opens'),
|
|
90
|
+
springAnimationComponent: PropTypes.element.description('Spring animation component'),
|
|
91
|
+
showArrow: PropTypes.bool.description('Whether to show an arrow or not').defaultValue(true),
|
|
92
|
+
className: PropTypes.string.description('css class'),
|
|
93
|
+
tooltipType: PropTypes.oneOf(['tooltip', 'toolbar']).description('Type of tooltip').defaultValue(TooltipType.TOOLTIP),
|
|
94
|
+
zIndex: PropTypes.number.description('z-index value assigned to the tooltip').defaultValue(undefined),
|
|
95
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the tooltip container element')
|
|
89
96
|
};
|
|
90
|
-
DSTooltip.propTypes = tooltipProps;
|
|
91
97
|
const TooltipWithSchema = describe(DSTooltip);
|
|
92
98
|
TooltipWithSchema.propTypes = tooltipProps;
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
DSTooltip,
|
|
96
|
-
TooltipContainer,
|
|
97
|
-
TooltipText,
|
|
98
|
-
TooltipWithSchema,
|
|
99
|
-
DSTooltip_default as default
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=DSTooltip.js.map
|
|
99
|
+
|
|
100
|
+
export { DSTooltip, TooltipContainer, TooltipText, TooltipWithSchema, DSTooltip as default };
|
package/esm/v1/TooltipType.js
CHANGED
package/esm/v2/DSTooltip.js
CHANGED
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
10
|
+
import { describe } from 'react-desc';
|
|
11
|
+
import DSPortal from '@elliemae/ds-portal';
|
|
12
|
+
import { DEFAULT_DELAY_CLOSE, DEFAULT_DELAY_OPEN } from '@elliemae/ds-shared/constants';
|
|
13
|
+
import { usePopper } from 'react-popper';
|
|
14
|
+
import { tooltipPositions } from './utils/tooltipPositions.js';
|
|
15
|
+
import { TooltipType } from './TooltipType.js';
|
|
16
|
+
import { StyledTriggerComponentContainer, StyledTooltipContainer, StyledAnimatedTooltip, StyledTooltipText } from './styles.js';
|
|
17
|
+
import { DSTooltipArrow } from './DSTooltipArrow.js';
|
|
18
|
+
import { tooltipV2Props } from './propTypes.js';
|
|
19
|
+
import { setMultipleRefs } from './utils/setMultipleRefs.js';
|
|
20
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
|
|
26
|
+
const DSTooltipV2 = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
containerProps = {},
|
|
29
|
+
innerRef,
|
|
30
|
+
placement = tooltipPositions.BOTTOM,
|
|
31
|
+
title = '',
|
|
32
|
+
delayClose = DEFAULT_DELAY_CLOSE,
|
|
33
|
+
delayOpen = DEFAULT_DELAY_OPEN,
|
|
34
|
+
triggerComponent = null,
|
|
35
|
+
className = '',
|
|
36
|
+
getIsOpen = () => null,
|
|
37
|
+
onOpen = () => null,
|
|
38
|
+
tooltipType = TooltipType.TOOLTIP,
|
|
39
|
+
showArrow = true,
|
|
40
|
+
offset = [0, 14],
|
|
41
|
+
zIndex = 10,
|
|
42
|
+
extraModifiers = {}
|
|
43
|
+
} = _ref;
|
|
35
44
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
36
45
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
37
46
|
const [referenceElement, setReferenceElement] = useState(triggerComponent);
|
|
@@ -39,20 +48,26 @@ const DSTooltipV2 = ({
|
|
|
39
48
|
const [arrowElement, setArrowElement] = useState(null);
|
|
40
49
|
const timerOpen = useRef(null);
|
|
41
50
|
const timerClosed = useRef(null);
|
|
42
|
-
const {
|
|
51
|
+
const {
|
|
52
|
+
styles,
|
|
53
|
+
attributes
|
|
54
|
+
} = usePopper(referenceElement, popperElement, {
|
|
43
55
|
placement,
|
|
44
|
-
modifiers: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
modifiers: [{
|
|
57
|
+
name: 'hide',
|
|
58
|
+
enabled: true
|
|
59
|
+
}, {
|
|
60
|
+
name: 'offset',
|
|
61
|
+
enabled: true,
|
|
62
|
+
options: {
|
|
63
|
+
offset: tooltipType === TooltipType.TOOLBAR ? [0, 0] : offset
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
name: 'arrow',
|
|
67
|
+
options: {
|
|
68
|
+
element: arrowElement
|
|
69
|
+
}
|
|
70
|
+
}, _objectSpread({}, extraModifiers)]
|
|
56
71
|
});
|
|
57
72
|
const handleShowTooltipOn = useCallback(() => {
|
|
58
73
|
timerOpen.current = setTimeout(() => {
|
|
@@ -69,8 +84,8 @@ const DSTooltipV2 = ({
|
|
|
69
84
|
getIsOpen(false);
|
|
70
85
|
}, delayClose);
|
|
71
86
|
}, [delayClose, getIsOpen]);
|
|
72
|
-
const handleKeyDown = useCallback(
|
|
73
|
-
if (e.key ===
|
|
87
|
+
const handleKeyDown = useCallback(e => {
|
|
88
|
+
if (e.key === 'Escape') {
|
|
74
89
|
e.target.blur();
|
|
75
90
|
}
|
|
76
91
|
}, []);
|
|
@@ -83,37 +98,39 @@ const DSTooltipV2 = ({
|
|
|
83
98
|
clearTimeout(timerClosed.current);
|
|
84
99
|
clearTimeout(timerOpen.current);
|
|
85
100
|
}, []);
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
showTooltip,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
102
|
+
children: [/*#__PURE__*/jsx(StyledTriggerComponentContainer, {
|
|
103
|
+
ref: setReferenceElement,
|
|
104
|
+
onMouseEnter: handleShowTooltipOn,
|
|
105
|
+
onMouseLeave: handleShowTooltipOff,
|
|
106
|
+
onFocus: handleShowTooltipOn,
|
|
107
|
+
onBlur: handleShowTooltipOff,
|
|
108
|
+
onKeyDown: handleKeyDown,
|
|
109
|
+
children: triggerComponent
|
|
110
|
+
}), isAnimating || showTooltip ? /*#__PURE__*/_jsx(DSPortal, {}, void 0, /*#__PURE__*/jsx(StyledTooltipContainer, _objectSpread(_objectSpread(_objectSpread({
|
|
111
|
+
className: className,
|
|
112
|
+
showTooltip: showTooltip,
|
|
113
|
+
tooltipType: tooltipType,
|
|
114
|
+
"data-testid": "ds-tooltip-container",
|
|
115
|
+
ref: ref => setMultipleRefs(setPopperElement, innerRef)(ref),
|
|
116
|
+
style: _objectSpread(_objectSpread({}, styles.popper), {}, {
|
|
117
|
+
zIndex
|
|
118
|
+
})
|
|
119
|
+
}, containerProps), attributes.popper), {}, {
|
|
120
|
+
children: /*#__PURE__*/_jsx(StyledAnimatedTooltip, {
|
|
121
|
+
showTooltip: showTooltip,
|
|
122
|
+
"data-testid": "ds-tooltip",
|
|
123
|
+
onAnimationEnd: checkAnimationStatus
|
|
124
|
+
}, void 0, /*#__PURE__*/_jsx(StyledTooltipText, {}, void 0, title), tooltipType === TooltipType.TOOLTIP && showArrow ? /*#__PURE__*/_jsx(DSTooltipArrow, {
|
|
125
|
+
arrowElementRef: setArrowElement,
|
|
126
|
+
style: styles.arrow,
|
|
127
|
+
placement: attributes.popper ? attributes.popper['data-popper-placement'] : 'bottom'
|
|
128
|
+
}) : null)
|
|
129
|
+
}))) : null]
|
|
130
|
+
});
|
|
111
131
|
};
|
|
112
|
-
|
|
132
|
+
|
|
113
133
|
const TooltipV2WithSchema = describe(DSTooltipV2);
|
|
114
134
|
TooltipV2WithSchema.propTypes = tooltipV2Props;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
TooltipV2WithSchema
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=DSTooltip.js.map
|
|
135
|
+
|
|
136
|
+
export { DSTooltipV2, TooltipV2WithSchema };
|
package/esm/v2/DSTooltipArrow.js
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { StyledTooltipArrow } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { StyledTooltipArrow } from './styles.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var _svg;
|
|
7
|
+
|
|
8
|
+
const DSTooltipArrow = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
placement,
|
|
11
|
+
style,
|
|
12
|
+
arrowElementRef
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/jsx(StyledTooltipArrow, {
|
|
15
|
+
"data-placement": placement,
|
|
16
|
+
style: style,
|
|
17
|
+
ref: arrowElementRef,
|
|
18
|
+
"data-testid": "ds-tooltip-arrow",
|
|
19
|
+
children: _svg || (_svg = /*#__PURE__*/_jsx("svg", {
|
|
20
|
+
viewBox: "0 0 30 30"
|
|
21
|
+
}, void 0, /*#__PURE__*/_jsx("path", {
|
|
22
|
+
className: "stroke",
|
|
23
|
+
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
|
24
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
25
|
+
className: "fill",
|
|
26
|
+
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
|
27
|
+
})))
|
|
28
|
+
}, "popper-arrow");
|
|
21
29
|
};
|
|
22
|
-
|
|
30
|
+
|
|
31
|
+
export { DSTooltipArrow };
|
package/esm/v2/TooltipType.js
CHANGED
package/esm/v2/index.d.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.d.js.map
|
|
1
|
+
|
package/esm/v2/propTypes.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { DEFAULT_DELAY_CLOSE, DEFAULT_DELAY_OPEN } from '@elliemae/ds-shared/constants';
|
|
3
|
+
import { TooltipType } from './TooltipType.js';
|
|
4
|
+
import { tooltipPositions } from './utils/tooltipPositions.js';
|
|
5
|
+
|
|
6
6
|
const tooltipV2Props = {
|
|
7
|
-
containerProps: PropTypes.object.description(
|
|
8
|
-
placement: PropTypes.oneOf(Object.values(tooltipPositions)).description(
|
|
9
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description(
|
|
10
|
-
delayClose: PropTypes.number.description(
|
|
11
|
-
delayOpen: PropTypes.number.description(
|
|
12
|
-
triggerComponent: PropTypes.element.description(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Ref to the tooltip container element"),
|
|
22
|
-
offset: PropTypes.arrayOf(PropTypes.number).description("Custom Offset for the tooltip [x, y]")
|
|
7
|
+
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
8
|
+
placement: PropTypes.oneOf(Object.values(tooltipPositions)).description('Tooltip position').defaultValue(tooltipPositions.TOP),
|
|
9
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description('Tooltip content').isRequired,
|
|
10
|
+
delayClose: PropTypes.number.description('Delay to close the tooltip').defaultValue(DEFAULT_DELAY_CLOSE),
|
|
11
|
+
delayOpen: PropTypes.number.description('Delay to open the tooltip ').defaultValue(DEFAULT_DELAY_OPEN),
|
|
12
|
+
triggerComponent: PropTypes.element.description("The component that will open/close the tooltip. \n Cannot be used with disabled elements. \n https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled").isRequired,
|
|
13
|
+
getIsOpen: PropTypes.func.description('Whether the tooltip is visible or not'),
|
|
14
|
+
onOpen: PropTypes.func.description('Callback when the tooltip opens'),
|
|
15
|
+
showArrow: PropTypes.bool.description('Whether to show an arrow or not').defaultValue(true),
|
|
16
|
+
className: PropTypes.string.description('css class'),
|
|
17
|
+
tooltipType: PropTypes.oneOf(['tooltip', 'toolbar']).description('Type of tooltip').defaultValue(TooltipType.TOOLTIP),
|
|
18
|
+
zIndex: PropTypes.number.description('z-index value assigned to the tooltip').defaultValue(undefined),
|
|
19
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the tooltip container element'),
|
|
20
|
+
offset: PropTypes.arrayOf(PropTypes.number).description('Custom Offset for the tooltip [x, y]')
|
|
23
21
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=propTypes.js.map
|
|
22
|
+
|
|
23
|
+
export { tooltipV2Props };
|