@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.
Files changed (70) hide show
  1. package/cjs/index.js +23 -41
  2. package/cjs/v1/DSTooltip.js +105 -108
  3. package/cjs/v1/TooltipType.js +8 -36
  4. package/cjs/v2/DSTooltip.js +121 -117
  5. package/cjs/v2/DSTooltipArrow.js +38 -50
  6. package/cjs/v2/TooltipType.js +8 -36
  7. package/cjs/v2/index.d.js +2 -27
  8. package/cjs/v2/propTypes.js +25 -54
  9. package/cjs/v2/styles.js +59 -128
  10. package/cjs/v2/utils/setMultipleRefs.js +21 -41
  11. package/cjs/v2/utils/tooltipPositions.js +18 -46
  12. package/cjs/v3/TooltipV3DatatestId.js +8 -36
  13. package/cjs/v3/config/useWithDefaultProps.js +14 -40
  14. package/cjs/v3/index.d.js +2 -27
  15. package/cjs/v3/index.js +103 -90
  16. package/cjs/v3/propsTypes.js +94 -78
  17. package/cjs/v3/styleds.js +46 -69
  18. package/esm/index.js +5 -12
  19. package/esm/v1/DSTooltip.js +87 -88
  20. package/esm/v1/TooltipType.js +4 -7
  21. package/esm/v2/DSTooltip.js +97 -80
  22. package/esm/v2/DSTooltipArrow.js +30 -21
  23. package/esm/v2/TooltipType.js +4 -7
  24. package/esm/v2/index.d.js +1 -2
  25. package/esm/v2/propTypes.js +21 -25
  26. package/esm/v2/styles.js +47 -100
  27. package/esm/v2/utils/setMultipleRefs.js +18 -13
  28. package/esm/v2/utils/tooltipPositions.js +14 -17
  29. package/esm/v3/TooltipV3DatatestId.js +4 -7
  30. package/esm/v3/config/useWithDefaultProps.js +10 -11
  31. package/esm/v3/index.d.js +1 -2
  32. package/esm/v3/index.js +79 -54
  33. package/esm/v3/propsTypes.js +90 -49
  34. package/esm/v3/styleds.js +36 -41
  35. package/package.json +10 -10
  36. package/types/index.d.ts +1 -1
  37. package/cjs/index.js.map +0 -7
  38. package/cjs/v1/DSTooltip.js.map +0 -7
  39. package/cjs/v1/TooltipType.js.map +0 -7
  40. package/cjs/v2/DSTooltip.js.map +0 -7
  41. package/cjs/v2/DSTooltipArrow.js.map +0 -7
  42. package/cjs/v2/TooltipType.js.map +0 -7
  43. package/cjs/v2/index.d.js.map +0 -7
  44. package/cjs/v2/propTypes.js.map +0 -7
  45. package/cjs/v2/styles.js.map +0 -7
  46. package/cjs/v2/utils/setMultipleRefs.js.map +0 -7
  47. package/cjs/v2/utils/tooltipPositions.js.map +0 -7
  48. package/cjs/v3/TooltipV3DatatestId.js.map +0 -7
  49. package/cjs/v3/config/useWithDefaultProps.js.map +0 -7
  50. package/cjs/v3/index.d.js.map +0 -7
  51. package/cjs/v3/index.js.map +0 -7
  52. package/cjs/v3/propsTypes.js.map +0 -7
  53. package/cjs/v3/styleds.js.map +0 -7
  54. package/esm/index.js.map +0 -7
  55. package/esm/v1/DSTooltip.js.map +0 -7
  56. package/esm/v1/TooltipType.js.map +0 -7
  57. package/esm/v2/DSTooltip.js.map +0 -7
  58. package/esm/v2/DSTooltipArrow.js.map +0 -7
  59. package/esm/v2/TooltipType.js.map +0 -7
  60. package/esm/v2/index.d.js.map +0 -7
  61. package/esm/v2/propTypes.js.map +0 -7
  62. package/esm/v2/styles.js.map +0 -7
  63. package/esm/v2/utils/setMultipleRefs.js.map +0 -7
  64. package/esm/v2/utils/tooltipPositions.js.map +0 -7
  65. package/esm/v3/TooltipV3DatatestId.js.map +0 -7
  66. package/esm/v3/config/useWithDefaultProps.js.map +0 -7
  67. package/esm/v3/index.d.js.map +0 -7
  68. package/esm/v3/index.js.map +0 -7
  69. package/esm/v3/propsTypes.js.map +0 -7
  70. package/esm/v3/styleds.js.map +0 -7
@@ -1,101 +1,100 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { describe, PropTypes } from "react-desc";
4
- import {
5
- aggregatedClasses,
6
- convertPropToCssClassName
7
- } from "@elliemae/ds-classnames";
8
- import { getComponentFromProps } from "@elliemae/ds-utilities";
9
- import {
10
- DEFAULT_DELAY_OPEN,
11
- DEFAULT_DELAY_CLOSE
12
- } from "@elliemae/ds-shared/constants";
13
- import {
14
- DSPopper,
15
- PopperPositions,
16
- PopperInteractions,
17
- interactions,
18
- positions
19
- } from "@elliemae/ds-popper";
20
- import { TooltipType } from "./TooltipType";
21
- const blockName = "tooltip";
22
- const TooltipContainer = aggregatedClasses("div")(blockName, false, false, {
23
- propsToRemoveFromFinalElement: ["isHovered", "isDragged"]
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("span")(blockName, "text", false, {
26
- propsToRemoveFromFinalElement: ["isHovered", "isDragged"]
27
+ const TooltipText = aggregatedClasses('span')(blockName, 'text', false, {
28
+ propsToRemoveFromFinalElement: ['isHovered', 'isDragged']
27
29
  });
28
- const DSTooltip = ({
29
- containerProps = {},
30
- innerRef,
31
- placement = PopperPositions.TOP,
32
- title = "",
33
- delayClose = DEFAULT_DELAY_CLOSE,
34
- delayOpen = DEFAULT_DELAY_OPEN,
35
- interactionType = PopperInteractions.HOVER,
36
- triggerComponent = null,
37
- className = "",
38
- isOpen = void 0,
39
- onOpen = () => null,
40
- springAnimationComponent = void 0,
41
- tooltipType = TooltipType.TOOLTIP,
42
- showArrow = true,
43
- zIndex,
44
- ...otherTooltipProps
45
- }) => {
46
- const { cssClassName: tooltipBlockName } = convertPropToCssClassName(blockName);
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
- if (typeof title === "string") {
49
- Content = /* @__PURE__ */ React2.createElement(TooltipText, null, title);
55
+
56
+ if (typeof title === 'string') {
57
+ Content = /*#__PURE__*/_jsx(TooltipText, {}, void 0, title);
50
58
  }
51
- return /* @__PURE__ */ React2.createElement(DSPopper, {
59
+
60
+ return /*#__PURE__*/_jsx(DSPopper, {
52
61
  blockName: tooltipBlockName,
53
- contentComponent: /* @__PURE__ */ React2.createElement(TooltipContainer, {
54
- ...containerProps,
55
- ...otherTooltipProps,
56
- className: `tooltip-container--${tooltipType} ${className}`,
57
- innerRef
58
- }, Content),
59
- delayClose,
60
- delayOpen,
61
- interactionType,
62
- isOpen,
63
- onOpen,
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("Set of Properties attached to the main container"),
73
- placement: PropTypes.oneOf(positions).description("Tooltip position").defaultValue(PopperPositions.TOP),
74
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description("Tooltip content").isRequired,
75
- delayClose: PropTypes.string.description("Delay to close the tooltip").defaultValue(DEFAULT_DELAY_CLOSE),
76
- delayOpen: PropTypes.string.description("Delay to open the tooltip ").defaultValue(DEFAULT_DELAY_OPEN),
77
- interactionType: PropTypes.oneOf(interactions).description("A type indicating how to open/close the tooltip").defaultValue(PopperInteractions.HOVER),
78
- triggerComponent: PropTypes.element.description(`The component that will open/close the tooltip.
79
- Cannot be used with disabled elements.
80
- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled`).isRequired,
81
- isOpen: PropTypes.bool.description("Whether the tooltip is visible or not").defaultValue(void 0),
82
- onOpen: PropTypes.func.description("Handler when the tooltip opens"),
83
- springAnimationComponent: PropTypes.element.description("Spring animation component"),
84
- showArrow: PropTypes.bool.description("Whether to show an arrow or not").defaultValue(true),
85
- className: PropTypes.string.description("css class"),
86
- tooltipType: PropTypes.oneOf(["tooltip", "toolbar"]).description("Type of tooltip").defaultValue(TooltipType.TOOLTIP),
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
- var DSTooltip_default = DSTooltip;
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 };
@@ -1,9 +1,6 @@
1
- import * as React from "react";
2
1
  const TooltipType = {
3
- TOOLTIP: "tooltip",
4
- TOOLBAR: "toolbar"
2
+ TOOLTIP: 'tooltip',
3
+ TOOLBAR: 'toolbar'
5
4
  };
6
- export {
7
- TooltipType
8
- };
9
- //# sourceMappingURL=TooltipType.js.map
5
+
6
+ export { TooltipType };
@@ -1,37 +1,46 @@
1
- import * as React from "react";
2
- import React2, { useState, useCallback, useEffect, useRef } from "react";
3
- import { describe } from "react-desc";
4
- import { DSPortal } from "@elliemae/ds-portal";
5
- import { DEFAULT_DELAY_OPEN, DEFAULT_DELAY_CLOSE } from "@elliemae/ds-shared/constants";
6
- import { usePopper } from "react-popper";
7
- import { tooltipPositions } from "./utils/tooltipPositions";
8
- import { TooltipType } from "./TooltipType";
9
- import {
10
- StyledTooltipContainer,
11
- StyledTriggerComponentContainer,
12
- StyledTooltipText,
13
- StyledAnimatedTooltip
14
- } from "./styles";
15
- import { DSTooltipArrow } from "./DSTooltipArrow";
16
- import { tooltipV2Props } from "./propTypes";
17
- import { setMultipleRefs } from "./utils/setMultipleRefs";
18
- const DSTooltipV2 = ({
19
- containerProps = {},
20
- innerRef,
21
- placement = tooltipPositions.BOTTOM,
22
- title = "",
23
- delayClose = DEFAULT_DELAY_CLOSE,
24
- delayOpen = DEFAULT_DELAY_OPEN,
25
- triggerComponent = null,
26
- className = "",
27
- getIsOpen = () => null,
28
- onOpen = () => null,
29
- tooltipType = TooltipType.TOOLTIP,
30
- showArrow = true,
31
- offset = [0, 14],
32
- zIndex = 10,
33
- extraModifiers = {}
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 { styles, attributes } = usePopper(referenceElement, popperElement, {
51
+ const {
52
+ styles,
53
+ attributes
54
+ } = usePopper(referenceElement, popperElement, {
43
55
  placement,
44
- modifiers: [
45
- { name: "hide", enabled: true },
46
- {
47
- name: "offset",
48
- enabled: true,
49
- options: {
50
- offset: tooltipType === TooltipType.TOOLBAR ? [0, 0] : offset
51
- }
52
- },
53
- { name: "arrow", options: { element: arrowElement } },
54
- { ...extraModifiers }
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((e) => {
73
- if (e.key === "Escape") {
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 /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledTriggerComponentContainer, {
87
- ref: setReferenceElement,
88
- onMouseEnter: handleShowTooltipOn,
89
- onMouseLeave: handleShowTooltipOff,
90
- onFocus: handleShowTooltipOn,
91
- onBlur: handleShowTooltipOff,
92
- onKeyDown: handleKeyDown
93
- }, triggerComponent), isAnimating || showTooltip ? /* @__PURE__ */ React2.createElement(DSPortal, null, /* @__PURE__ */ React2.createElement(StyledTooltipContainer, {
94
- className,
95
- showTooltip,
96
- tooltipType,
97
- "data-testid": "ds-tooltip-container",
98
- ref: (ref) => setMultipleRefs(setPopperElement, innerRef)(ref),
99
- style: { ...styles.popper, zIndex },
100
- ...containerProps,
101
- ...attributes.popper
102
- }, /* @__PURE__ */ React2.createElement(StyledAnimatedTooltip, {
103
- showTooltip,
104
- "data-testid": "ds-tooltip",
105
- onAnimationEnd: checkAnimationStatus
106
- }, /* @__PURE__ */ React2.createElement(StyledTooltipText, null, title), tooltipType === TooltipType.TOOLTIP && showArrow ? /* @__PURE__ */ React2.createElement(DSTooltipArrow, {
107
- arrowElementRef: setArrowElement,
108
- style: styles.arrow,
109
- placement: attributes.popper ? attributes.popper["data-popper-placement"] : "bottom"
110
- }) : null))) : null);
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
- DSTooltipV2.propTypes = tooltipV2Props;
132
+
113
133
  const TooltipV2WithSchema = describe(DSTooltipV2);
114
134
  TooltipV2WithSchema.propTypes = tooltipV2Props;
115
- export {
116
- DSTooltipV2,
117
- TooltipV2WithSchema
118
- };
119
- //# sourceMappingURL=DSTooltip.js.map
135
+
136
+ export { DSTooltipV2, TooltipV2WithSchema };
@@ -1,22 +1,31 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { StyledTooltipArrow } from "./styles";
4
- const DSTooltipArrow = ({ placement, style, arrowElementRef }) => /* @__PURE__ */ React2.createElement(StyledTooltipArrow, {
5
- key: "popper-arrow",
6
- "data-placement": placement,
7
- style,
8
- ref: arrowElementRef,
9
- "data-testid": "ds-tooltip-arrow"
10
- }, /* @__PURE__ */ React2.createElement("svg", {
11
- viewBox: "0 0 30 30"
12
- }, /* @__PURE__ */ React2.createElement("path", {
13
- className: "stroke",
14
- 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\n C26.7,29,24.6,28.1,23.7,27.1z"
15
- }), /* @__PURE__ */ React2.createElement("path", {
16
- className: "fill",
17
- 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"
18
- })));
19
- export {
20
- DSTooltipArrow
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
- //# sourceMappingURL=DSTooltipArrow.js.map
30
+
31
+ export { DSTooltipArrow };
@@ -1,9 +1,6 @@
1
- import * as React from "react";
2
1
  const TooltipType = {
3
- TOOLTIP: "tooltip",
4
- TOOLBAR: "toolbar"
2
+ TOOLTIP: 'tooltip',
3
+ TOOLBAR: 'toolbar'
5
4
  };
6
- export {
7
- TooltipType
8
- };
9
- //# sourceMappingURL=TooltipType.js.map
5
+
6
+ export { TooltipType };
package/esm/v2/index.d.js CHANGED
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=index.d.js.map
1
+
@@ -1,27 +1,23 @@
1
- import * as React from "react";
2
- import { PropTypes } from "react-desc";
3
- import { DEFAULT_DELAY_OPEN, DEFAULT_DELAY_CLOSE } from "@elliemae/ds-shared/constants";
4
- import { TooltipType } from "./TooltipType";
5
- import { tooltipPositions } from "./utils/tooltipPositions";
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("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.
13
- Cannot be used with disabled elements.
14
- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled`).isRequired,
15
- getIsOpen: PropTypes.func.description("Whether the tooltip is visible or not"),
16
- onOpen: PropTypes.func.description("Callback when the tooltip opens"),
17
- showArrow: PropTypes.bool.description("Whether to show an arrow or not").defaultValue(true),
18
- className: PropTypes.string.description("css class"),
19
- tooltipType: PropTypes.oneOf(["tooltip", "toolbar"]).description("Type of tooltip").defaultValue(TooltipType.TOOLTIP),
20
- zIndex: PropTypes.number.description("z-index value assigned to the tooltip").defaultValue(void 0),
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
- export {
25
- tooltipV2Props
26
- };
27
- //# sourceMappingURL=propTypes.js.map
22
+
23
+ export { tooltipV2Props };