@elliemae/ds-tooltip 2.2.0-alpha.1 → 2.2.0-alpha.2

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 +41 -23
  2. package/cjs/index.js.map +7 -0
  3. package/cjs/v1/DSTooltip.js +108 -105
  4. package/cjs/v1/DSTooltip.js.map +7 -0
  5. package/cjs/v1/TooltipType.js +36 -8
  6. package/cjs/v1/TooltipType.js.map +7 -0
  7. package/cjs/v2/DSTooltip.js +117 -121
  8. package/cjs/v2/DSTooltip.js.map +7 -0
  9. package/cjs/v2/DSTooltipArrow.js +50 -38
  10. package/cjs/v2/DSTooltipArrow.js.map +7 -0
  11. package/cjs/v2/TooltipType.js +36 -8
  12. package/cjs/v2/TooltipType.js.map +7 -0
  13. package/cjs/v2/index.d.js +27 -2
  14. package/cjs/v2/index.d.js.map +7 -0
  15. package/cjs/v2/propTypes.js +54 -25
  16. package/cjs/v2/propTypes.js.map +7 -0
  17. package/cjs/v2/styles.js +128 -59
  18. package/cjs/v2/styles.js.map +7 -0
  19. package/cjs/v2/utils/setMultipleRefs.js +41 -21
  20. package/cjs/v2/utils/setMultipleRefs.js.map +7 -0
  21. package/cjs/v2/utils/tooltipPositions.js +46 -18
  22. package/cjs/v2/utils/tooltipPositions.js.map +7 -0
  23. package/cjs/v3/TooltipV3DatatestId.js +36 -8
  24. package/cjs/v3/TooltipV3DatatestId.js.map +7 -0
  25. package/cjs/v3/config/useWithDefaultProps.js +40 -14
  26. package/cjs/v3/config/useWithDefaultProps.js.map +7 -0
  27. package/cjs/v3/index.d.js +27 -2
  28. package/cjs/v3/index.d.js.map +7 -0
  29. package/cjs/v3/index.js +90 -103
  30. package/cjs/v3/index.js.map +7 -0
  31. package/cjs/v3/propsTypes.js +78 -94
  32. package/cjs/v3/propsTypes.js.map +7 -0
  33. package/cjs/v3/styleds.js +69 -46
  34. package/cjs/v3/styleds.js.map +7 -0
  35. package/esm/index.js +12 -5
  36. package/esm/index.js.map +7 -0
  37. package/esm/v1/DSTooltip.js +88 -87
  38. package/esm/v1/DSTooltip.js.map +7 -0
  39. package/esm/v1/TooltipType.js +7 -4
  40. package/esm/v1/TooltipType.js.map +7 -0
  41. package/esm/v2/DSTooltip.js +80 -97
  42. package/esm/v2/DSTooltip.js.map +7 -0
  43. package/esm/v2/DSTooltipArrow.js +21 -30
  44. package/esm/v2/DSTooltipArrow.js.map +7 -0
  45. package/esm/v2/TooltipType.js +7 -4
  46. package/esm/v2/TooltipType.js.map +7 -0
  47. package/esm/v2/index.d.js +2 -1
  48. package/esm/v2/index.d.js.map +7 -0
  49. package/esm/v2/propTypes.js +25 -21
  50. package/esm/v2/propTypes.js.map +7 -0
  51. package/esm/v2/styles.js +100 -47
  52. package/esm/v2/styles.js.map +7 -0
  53. package/esm/v2/utils/setMultipleRefs.js +13 -18
  54. package/esm/v2/utils/setMultipleRefs.js.map +7 -0
  55. package/esm/v2/utils/tooltipPositions.js +17 -14
  56. package/esm/v2/utils/tooltipPositions.js.map +7 -0
  57. package/esm/v3/TooltipV3DatatestId.js +7 -4
  58. package/esm/v3/TooltipV3DatatestId.js.map +7 -0
  59. package/esm/v3/config/useWithDefaultProps.js +11 -10
  60. package/esm/v3/config/useWithDefaultProps.js.map +7 -0
  61. package/esm/v3/index.d.js +2 -1
  62. package/esm/v3/index.d.js.map +7 -0
  63. package/esm/v3/index.js +54 -79
  64. package/esm/v3/index.js.map +7 -0
  65. package/esm/v3/propsTypes.js +49 -90
  66. package/esm/v3/propsTypes.js.map +7 -0
  67. package/esm/v3/styleds.js +41 -36
  68. package/esm/v3/styleds.js.map +7 -0
  69. package/package.json +10 -10
  70. package/types/index.d.ts +1 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v2/propTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { DEFAULT_DELAY_OPEN, DEFAULT_DELAY_CLOSE } from '@elliemae/ds-shared/constants';\nimport { TooltipType } from './TooltipType';\nimport { tooltipPositions } from './utils/tooltipPositions';\n\nconst tooltipV2Props = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n placement: PropTypes.oneOf(Object.values(tooltipPositions))\n .description('Tooltip position')\n .defaultValue(tooltipPositions.TOP),\n title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description('Tooltip content').isRequired,\n delayClose: PropTypes.number.description('Delay to close the tooltip').defaultValue(DEFAULT_DELAY_CLOSE),\n delayOpen: PropTypes.number.description('Delay to open the tooltip ').defaultValue(DEFAULT_DELAY_OPEN),\n triggerComponent: PropTypes.element.description(\n `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`,\n ).isRequired,\n getIsOpen: PropTypes.func.description('Whether the tooltip is visible or not'),\n onOpen: PropTypes.func.description('Callback when the tooltip opens'),\n showArrow: PropTypes.bool.description('Whether to show an arrow or not').defaultValue(true),\n className: PropTypes.string.description('css class'),\n tooltipType: PropTypes.oneOf(['tooltip', 'toolbar']).description('Type of tooltip').defaultValue(TooltipType.TOOLTIP),\n zIndex: PropTypes.number.description('z-index value assigned to the tooltip').defaultValue(undefined),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the tooltip container element'),\n offset: PropTypes.arrayOf(PropTypes.number).description('Custom Offset for the tooltip [x, y]'),\n};\n\nexport { tooltipV2Props };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,iBAAiB;AAAA,EACrB,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAC7C,WAAW,UAAU,MAAM,OAAO,OAAO,mBACtC,YAAY,oBACZ,aAAa,iBAAiB;AAAA,EACjC,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,UAAU,YAAY,mBAAmB;AAAA,EACjG,YAAY,UAAU,OAAO,YAAY,8BAA8B,aAAa;AAAA,EACpF,WAAW,UAAU,OAAO,YAAY,8BAA8B,aAAa;AAAA,EACnF,kBAAkB,UAAU,QAAQ,YAClC;AAAA;AAAA,8EAGA;AAAA,EACF,WAAW,UAAU,KAAK,YAAY;AAAA,EACtC,QAAQ,UAAU,KAAK,YAAY;AAAA,EACnC,WAAW,UAAU,KAAK,YAAY,mCAAmC,aAAa;AAAA,EACtF,WAAW,UAAU,OAAO,YAAY;AAAA,EACxC,aAAa,UAAU,MAAM,CAAC,WAAW,YAAY,YAAY,mBAAmB,aAAa,YAAY;AAAA,EAC7G,QAAQ,UAAU,OAAO,YAAY,yCAAyC,aAAa;AAAA,EAC3F,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,SAAS,YAAY;AAAA,EAC9E,QAAQ,UAAU,QAAQ,UAAU,QAAQ,YAAY;AAAA;",
6
+ "names": []
7
+ }
package/esm/v2/styles.js CHANGED
@@ -1,49 +1,102 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
- import styled from 'styled-components';
3
- import { kfrm, css } from '@elliemae/ds-system';
1
+ import * as React from "react";
2
+ import styled from "styled-components";
3
+ import { kfrm, css } from "@elliemae/ds-system";
4
+ const showAnimation = kfrm`
5
+ from {
6
+ opacity: 0;
7
+ transform: scale(0.8);
8
+ }
4
9
 
5
- var _templateObject, _templateObject2, _templateObject3;
6
- const showAnimation = kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n visibility: visible;\n }\n"])));
7
- const hideAnimation = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n opacity: 1;\n transform: scale(1);\n }\n\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n"])));
8
- const StyledTooltipContainer = /*#__PURE__*/styled.div.withConfig({
9
- componentId: "sc-1dtjf9j-0"
10
- })(["&[data-popper-reference-hidden='true']{display:none;pointer-events:none;}"]);
11
- const StyledAnimatedTooltip = /*#__PURE__*/styled.div.withConfig({
12
- componentId: "sc-1dtjf9j-1"
13
- })(["text-align:center;min-width:", ";max-width:250px;min-height:24px;padding:", ";position:relative;background-color:white;border-radius:2px;font-size:13px;color:", ";box-shadow:0 1px 5px 0 rgb(0 0 0 / 13%),0 2px 4px 0 rgb(0 0 0 / 20%);filter:drop-shadow(0 4px 8px rgba(0,0,0,0.2));visibility:", ";", " transition:visibility 0.1s ease-in;"], _ref => {
14
- let {
15
- theme
16
- } = _ref;
17
- return theme.space.l;
18
- }, _ref2 => {
19
- let {
20
- theme
21
- } = _ref2;
22
- return "".concat(theme.space.xxxs, " ").concat(theme.space.xs);
23
- }, _ref3 => {
24
- let {
25
- theme
26
- } = _ref3;
27
- return theme.colors.neutral[600];
28
- }, _ref4 => {
29
- let {
30
- showTooltip
31
- } = _ref4;
32
- return showTooltip ? 'visible' : 'hidden';
33
- }, _ref5 => {
34
- let {
35
- showTooltip
36
- } = _ref5;
37
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " 0.1s ease-in;\n "])), showTooltip ? showAnimation : hideAnimation);
38
- });
39
- const StyledTriggerComponentContainer = /*#__PURE__*/styled.div.withConfig({
40
- componentId: "sc-1dtjf9j-2"
41
- })(["display:inline-block;"]);
42
- const StyledTooltipText = /*#__PURE__*/styled.div.withConfig({
43
- componentId: "sc-1dtjf9j-3"
44
- })(["white-space:normal;word-wrap:break-word;display:inline-block;"]);
45
- const StyledTooltipArrow = /*#__PURE__*/styled.div.withConfig({
46
- componentId: "sc-1dtjf9j-4"
47
- })(["position:absolute;width:18px;height:18px;pointer-events:none;background-color:transparent;& .stroke{fill:white;}& .fill{fill:white;}&[data-placement^='top']{svg{transform:rotateZ(180deg);}top:98%;}&[data-placement^='right']{svg{transform:rotateZ(-90deg);}right:99.5%;}&[data-placement^='bottom']{bottom:97%;}&[data-placement^='left']{svg{transform:rotateZ(90deg);}left:99.5%;}"]);
10
+ to {
11
+ opacity: 1;
12
+ transform: scale(1);
13
+ visibility: visible;
14
+ }
15
+ `;
16
+ const hideAnimation = kfrm`
17
+ 0% {
18
+ opacity: 1;
19
+ transform: scale(1);
20
+ }
48
21
 
49
- export { StyledAnimatedTooltip, StyledTooltipArrow, StyledTooltipContainer, StyledTooltipText, StyledTriggerComponentContainer };
22
+ 100% {
23
+ opacity: 0;
24
+ transform: scale(0.8);
25
+ }
26
+ `;
27
+ const StyledTooltipContainer = styled.div`
28
+ &[data-popper-reference-hidden='true'] {
29
+ display: none;
30
+ pointer-events: none;
31
+ }
32
+ `;
33
+ const StyledAnimatedTooltip = styled.div`
34
+ text-align: center;
35
+ min-width: ${({ theme }) => theme.space.l};
36
+ max-width: 250px;
37
+ min-height: 24px;
38
+ padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
39
+ position: relative;
40
+ background-color: white;
41
+ border-radius: 2px;
42
+ font-size: 13px;
43
+ color: ${({ theme }) => theme.colors.neutral[600]};
44
+ box-shadow: 0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%);
45
+ filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
46
+ visibility: ${({ showTooltip }) => showTooltip ? "visible" : "hidden"};
47
+ ${({ showTooltip }) => css`
48
+ animation: ${showTooltip ? showAnimation : hideAnimation} 0.1s ease-in;
49
+ `}
50
+ transition: visibility 0.1s ease-in;
51
+ `;
52
+ const StyledTriggerComponentContainer = styled.div`
53
+ display: inline-block;
54
+ `;
55
+ const StyledTooltipText = styled.div`
56
+ white-space: normal;
57
+ word-wrap: break-word;
58
+ display: inline-block;
59
+ `;
60
+ const StyledTooltipArrow = styled.div`
61
+ position: absolute;
62
+ width: 18px;
63
+ height: 18px;
64
+ pointer-events: none;
65
+ background-color: transparent;
66
+ & .stroke {
67
+ fill: white;
68
+ }
69
+ & .fill {
70
+ fill: white;
71
+ }
72
+
73
+ &[data-placement^='top'] {
74
+ svg {
75
+ transform: rotateZ(180deg);
76
+ }
77
+ top: 98%;
78
+ }
79
+ &[data-placement^='right'] {
80
+ svg {
81
+ transform: rotateZ(-90deg);
82
+ }
83
+ right: 99.5%;
84
+ }
85
+ &[data-placement^='bottom'] {
86
+ bottom: 97%;
87
+ }
88
+ &[data-placement^='left'] {
89
+ svg {
90
+ transform: rotateZ(90deg);
91
+ }
92
+ left: 99.5%;
93
+ }
94
+ `;
95
+ export {
96
+ StyledAnimatedTooltip,
97
+ StyledTooltipArrow,
98
+ StyledTooltipContainer,
99
+ StyledTooltipText,
100
+ StyledTriggerComponentContainer
101
+ };
102
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v2/styles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport { kfrm, css } from '@elliemae/ds-system';\nimport { TooltipAnimationT, TooltipContainerT } from './index.d';\n\nconst showAnimation = kfrm`\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n visibility: visible;\n }\n`;\n\nconst hideAnimation = kfrm`\n 0% {\n opacity: 1;\n transform: scale(1);\n }\n\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n`;\n\nconst StyledTooltipContainer = styled.div<TooltipContainerT>`\n &[data-popper-reference-hidden='true'] {\n display: none;\n pointer-events: none;\n }\n`;\n\nconst StyledAnimatedTooltip = styled.div<TooltipAnimationT>`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n min-height: 24px;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n box-shadow: 0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%);\n filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));\n visibility: ${({ showTooltip }) => (showTooltip ? 'visible' : 'hidden')};\n ${({ showTooltip }) =>\n css`\n animation: ${showTooltip ? showAnimation : hideAnimation} 0.1s ease-in;\n `}\n transition: visibility 0.1s ease-in;\n`;\n\nconst StyledTriggerComponentContainer = styled.div`\n display: inline-block;\n`;\n\nconst StyledTooltipText = styled.div`\n white-space: normal;\n word-wrap: break-word;\n display: inline-block;\n`;\n\nconst StyledTooltipArrow = styled.div`\n position: absolute;\n width: 18px;\n height: 18px;\n pointer-events: none;\n background-color: transparent;\n & .stroke {\n fill: white;\n }\n & .fill {\n fill: white;\n }\n\n &[data-placement^='top'] {\n svg {\n transform: rotateZ(180deg);\n }\n top: 98%;\n }\n &[data-placement^='right'] {\n svg {\n transform: rotateZ(-90deg);\n }\n right: 99.5%;\n }\n &[data-placement^='bottom'] {\n bottom: 97%;\n }\n &[data-placement^='left'] {\n svg {\n transform: rotateZ(90deg);\n }\n left: 99.5%;\n }\n`;\n\nexport {\n StyledTooltipContainer,\n StyledTriggerComponentContainer,\n StyledTooltipText,\n StyledTooltipArrow,\n StyledAnimatedTooltip,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAGA,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAatB,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYtB,MAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOtC,MAAM,wBAAwB,OAAO;AAAA;AAAA,eAEtB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA;AAAA,aAG7B,CAAC,EAAE,YAAY,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,WAKpD,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,gBAG/B,CAAC,EAAE,kBAAmB,cAAc,YAAY;AAAA,IAC5D,CAAC,EAAE,kBACH;AAAA,mBACe,cAAc,gBAAgB;AAAA;AAAA;AAAA;AAKjD,MAAM,kCAAkC,OAAO;AAAA;AAAA;AAI/C,MAAM,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAAA;AAMjC,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,20 +1,13 @@
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
-
7
- const setMultipleRefs = function () {
8
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
9
- refs[_key] = arguments[_key];
10
- }
11
-
1
+ import * as React from "react";
2
+ const setMultipleRefs = (...refs) => {
12
3
  const filteredRefs = refs.filter(Boolean);
13
- if (!filteredRefs.length) return null;
14
- if (filteredRefs.length === 0) return filteredRefs[0];
15
- return newRef => {
16
- filteredRefs.forEach(refToBeUpdated => {
17
- if (typeof refToBeUpdated === 'function') {
4
+ if (!filteredRefs.length)
5
+ return null;
6
+ if (filteredRefs.length === 0)
7
+ return filteredRefs[0];
8
+ return (newRef) => {
9
+ filteredRefs.forEach((refToBeUpdated) => {
10
+ if (typeof refToBeUpdated === "function") {
18
11
  refToBeUpdated(newRef);
19
12
  } else if (refToBeUpdated) {
20
13
  refToBeUpdated.current = newRef;
@@ -22,5 +15,7 @@ const setMultipleRefs = function () {
22
15
  });
23
16
  };
24
17
  };
25
-
26
- export { setMultipleRefs };
18
+ export {
19
+ setMultipleRefs
20
+ };
21
+ //# sourceMappingURL=setMultipleRefs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/v2/utils/setMultipleRefs.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const setMultipleRefs = (...refs) => {\n const filteredRefs = refs.filter(Boolean);\n if (!filteredRefs.length) return null;\n if (filteredRefs.length === 0) return filteredRefs[0];\n return (newRef) => {\n filteredRefs.forEach((refToBeUpdated) => {\n if (typeof refToBeUpdated === 'function') {\n refToBeUpdated(newRef);\n } else if (refToBeUpdated) {\n refToBeUpdated.current = newRef;\n }\n });\n };\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,kBAAkB,IAAI,SAAS;AAC1C,QAAM,eAAe,KAAK,OAAO;AACjC,MAAI,CAAC,aAAa;AAAQ,WAAO;AACjC,MAAI,aAAa,WAAW;AAAG,WAAO,aAAa;AACnD,SAAO,CAAC,WAAW;AACjB,iBAAa,QAAQ,CAAC,mBAAmB;AACvC,UAAI,OAAO,mBAAmB,YAAY;AACxC,uBAAe;AAAA,iBACN,gBAAgB;AACzB,uBAAe,UAAU;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,16 +1,19 @@
1
+ import * as React from "react";
1
2
  const tooltipPositions = {
2
- TOP: 'top',
3
- BOTTOM: 'bottom',
4
- RIGHT: 'right',
5
- LEFT: 'left',
6
- TOP_START: 'top-start',
7
- TOP_END: 'top-end',
8
- BOTTOM_START: 'bottom-start',
9
- BOTTOM_END: 'bottom-end',
10
- RIGHT_START: 'right-start',
11
- RIGHT_END: 'right-end',
12
- LEFT_START: 'left-start',
13
- LEFT_END: 'left-end'
3
+ TOP: "top",
4
+ BOTTOM: "bottom",
5
+ RIGHT: "right",
6
+ LEFT: "left",
7
+ TOP_START: "top-start",
8
+ TOP_END: "top-end",
9
+ BOTTOM_START: "bottom-start",
10
+ BOTTOM_END: "bottom-end",
11
+ RIGHT_START: "right-start",
12
+ RIGHT_END: "right-end",
13
+ LEFT_START: "left-start",
14
+ LEFT_END: "left-end"
14
15
  };
15
-
16
- export { tooltipPositions };
16
+ export {
17
+ tooltipPositions
18
+ };
19
+ //# sourceMappingURL=tooltipPositions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/v2/utils/tooltipPositions.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "const tooltipPositions = {\n TOP: 'top' as const,\n BOTTOM: 'bottom' as const,\n RIGHT: 'right' as const,\n LEFT: 'left' as const,\n TOP_START: 'top-start' as const,\n TOP_END: 'top-end' as const,\n BOTTOM_START: 'bottom-start' as const,\n BOTTOM_END: 'bottom-end' as const,\n RIGHT_START: 'right-start' as const,\n RIGHT_END: 'right-end' as const,\n LEFT_START: 'left-start' as const,\n LEFT_END: 'left-end' as const,\n};\n\nexport { tooltipPositions };\n"],
5
+ "mappings": "AAAA;ACAA,MAAM,mBAAmB;AAAA,EACvB,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA;",
6
+ "names": []
7
+ }
@@ -1,6 +1,9 @@
1
+ import * as React from "react";
1
2
  const TooltipV3DatatestId = {
2
- TRIGGER_WRAPPER: 'ds-tooltip-v3-trigger-wrapper',
3
- TOOLTIP_TEXT_WRAPPER: 'ds-tooltip-v3-tooltip-text-wrapper'
3
+ TRIGGER_WRAPPER: "ds-tooltip-v3-trigger-wrapper",
4
+ TOOLTIP_TEXT_WRAPPER: "ds-tooltip-v3-tooltip-text-wrapper"
4
5
  };
5
-
6
- export { TooltipV3DatatestId };
6
+ export {
7
+ TooltipV3DatatestId
8
+ };
9
+ //# sourceMappingURL=TooltipV3DatatestId.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v3/TooltipV3DatatestId.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const TooltipV3DatatestId = {\n TRIGGER_WRAPPER: 'ds-tooltip-v3-trigger-wrapper',\n TOOLTIP_TEXT_WRAPPER: 'ds-tooltip-v3-tooltip-text-wrapper',\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,sBAAsB;AAAA,EACjC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA;",
6
+ "names": []
7
+ }
@@ -1,14 +1,15 @@
1
- import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-empty-function
4
- const noop = () => {};
5
-
1
+ import * as React from "react";
2
+ import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
3
+ const noop = () => {
4
+ };
6
5
  const defaultProps = {
7
6
  onOpen: noop,
8
7
  onClose: noop,
9
- id: '',
10
- textAlign: 'left'
8
+ id: "",
9
+ textAlign: "left"
10
+ };
11
+ const useWithDefaultProps = (props) => useMemoMergePropsWithDefault(props, defaultProps);
12
+ export {
13
+ useWithDefaultProps
11
14
  };
12
- const useWithDefaultProps = props => useMemoMergePropsWithDefault(props, defaultProps);
13
-
14
- export { useWithDefaultProps };
15
+ //# sourceMappingURL=useWithDefaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/v3/config/useWithDefaultProps.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport type { TooltipV3PropsT } from '../index.d';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\n\nconst defaultProps = {\n onOpen: noop,\n onClose: noop,\n id: '',\n textAlign: 'left',\n};\n\nexport const useWithDefaultProps = (props: Partial<TooltipV3PropsT>): Partial<TooltipV3PropsT> =>\n useMemoMergePropsWithDefault(props, defaultProps);\n"],
5
+ "mappings": "AAAA;ACAA;AAIA,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,eAAe;AAAA,EACnB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,WAAW;AAAA;AAGN,MAAM,sBAAsB,CAAC,UAClC,6BAA6B,OAAO;",
6
+ "names": []
7
+ }
package/esm/v3/index.d.js CHANGED
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
package/esm/v3/index.js CHANGED
@@ -1,51 +1,27 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _jsx from '@babel/runtime/helpers/esm/jsx';
3
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
- import 'core-js/modules/web.dom-collections.iterator.js';
5
- import 'core-js/modules/esnext.async-iterator.filter.js';
6
- import 'core-js/modules/esnext.iterator.constructor.js';
7
- import 'core-js/modules/esnext.iterator.filter.js';
8
- import 'core-js/modules/esnext.async-iterator.for-each.js';
9
- import 'core-js/modules/esnext.iterator.for-each.js';
10
- import { useState, useCallback, useEffect } from 'react';
11
- import { DSPopperJS } from '@elliemae/ds-popperjs';
12
- import { describe } from 'react-desc';
13
- import { dsTooltipPropTypes } from './propsTypes.js';
14
- import { useWithDefaultProps } from './config/useWithDefaultProps.js';
15
- import { TooltipV3DatatestId } from './TooltipV3DatatestId.js';
16
- import { StyledTriggerWrapper, StyledTooltipContainer, StyledTooltipText, StyledMouseOverDetectionBox } from './styleds.js';
17
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
18
-
19
- var _StyledMouseOverDetec;
20
-
21
- const _excluded = ["text", "children", "onOpen", "onClose", "id", "textAlign"];
22
-
23
- 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; }
24
-
25
- 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; }
26
-
27
- const useGlobalKeyboardListener = func => {
1
+ import * as React from "react";
2
+ import React2, { useState, useCallback, useEffect } from "react";
3
+ import { DSPopperJS } from "@elliemae/ds-popperjs";
4
+ import { describe } from "react-desc";
5
+ import { dsTooltipPropTypes } from "./propsTypes";
6
+ import { useWithDefaultProps } from "./config/useWithDefaultProps";
7
+ import { TooltipV3DatatestId } from "./TooltipV3DatatestId";
8
+ import {
9
+ StyledTooltipContainer,
10
+ StyledTooltipText,
11
+ StyledMouseOverDetectionBox,
12
+ StyledTriggerWrapper
13
+ } from "./styleds";
14
+ const useGlobalKeyboardListener = (func) => {
28
15
  useEffect(() => {
29
- document.addEventListener('keydown', func);
30
- return () => document.removeEventListener('keydown', func);
16
+ document.addEventListener("keydown", func);
17
+ return () => document.removeEventListener("keydown", func);
31
18
  }, [func]);
32
19
  };
33
-
34
- const DSTooltipV3 = props => {
35
- const _useWithDefaultProps = useWithDefaultProps(props),
36
- {
37
- text,
38
- children,
39
- onOpen,
40
- onClose,
41
- id,
42
- textAlign
43
- } = _useWithDefaultProps,
44
- extraPopperJsProps = _objectWithoutProperties(_useWithDefaultProps, _excluded);
45
-
20
+ const DSTooltipV3 = (props) => {
21
+ const { text, children, onOpen, onClose, id, textAlign, ...extraPopperJsProps } = useWithDefaultProps(props);
46
22
  const [isFocused, setIsFocused] = useState(false);
47
23
  const [isHover, setIsHover] = useState(false);
48
- const [latestOpenInteraction, setLatestOpenInteraction] = useState('');
24
+ const [latestOpenInteraction, setLatestOpenInteraction] = useState("");
49
25
  const [referenceElement, setReferenceElement] = useState();
50
26
  const [showPopover, setShowPopover] = useState(false);
51
27
  const showTooltip = useCallback(() => {
@@ -58,59 +34,58 @@ const DSTooltipV3 = props => {
58
34
  }, [onClose]);
59
35
  const onFocus = useCallback(() => {
60
36
  setIsFocused(true);
61
-
62
37
  if (!showPopover) {
63
38
  showTooltip();
64
- setLatestOpenInteraction('onFocus');
39
+ setLatestOpenInteraction("onFocus");
65
40
  }
66
41
  }, [showPopover, showTooltip]);
67
42
  const onBlur = useCallback(() => {
68
43
  setIsFocused(false);
69
- if (!isHover || latestOpenInteraction === 'onFocus') hideTooltip();
44
+ if (!isHover || latestOpenInteraction === "onFocus")
45
+ hideTooltip();
70
46
  }, [hideTooltip, isHover, latestOpenInteraction]);
71
47
  const onMouseEnter = useCallback(() => {
72
48
  setIsHover(true);
73
-
74
49
  if (!showPopover) {
75
50
  showTooltip();
76
- setLatestOpenInteraction('onMouseEnter');
51
+ setLatestOpenInteraction("onMouseEnter");
77
52
  }
78
53
  }, [showPopover, showTooltip]);
79
54
  const onMouseLeave = useCallback(() => {
80
55
  setIsHover(false);
81
- if (!isFocused || latestOpenInteraction === 'onMouseEnter') hideTooltip();
56
+ if (!isFocused || latestOpenInteraction === "onMouseEnter")
57
+ hideTooltip();
82
58
  }, [hideTooltip, isFocused, latestOpenInteraction]);
83
- const handleEscKey = useCallback(_ref => {
84
- let {
85
- key
86
- } = _ref;
87
- if (key === 'Escape') hideTooltip();
59
+ const handleEscKey = useCallback(({ key }) => {
60
+ if (key === "Escape")
61
+ hideTooltip();
88
62
  }, [hideTooltip]);
89
63
  useGlobalKeyboardListener(handleEscKey);
90
- return /*#__PURE__*/jsx(Fragment, {
91
- children: /*#__PURE__*/jsxs(StyledTriggerWrapper, {
92
- onMouseEnter: onMouseEnter,
93
- onMouseLeave: onMouseLeave,
94
- onFocus: onFocus,
95
- onBlur: onBlur,
96
- ref: setReferenceElement,
97
- "data-testid": "".concat(TooltipV3DatatestId.TRIGGER_WRAPPER).concat(id !== '' ? "_".concat(id) : ''),
98
- children: [/*#__PURE__*/jsx(DSPopperJS, _objectSpread(_objectSpread({
99
- referenceElement: referenceElement,
100
- showPopover: showPopover,
101
- withoutPortal: true
102
- }, extraPopperJsProps), {}, {
103
- children: /*#__PURE__*/_jsx("div", {
104
- "data-testid": "".concat(TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER).concat(id !== '' ? "_".concat(id) : '')
105
- }, void 0, /*#__PURE__*/_jsx(StyledTooltipContainer, {}, void 0, /*#__PURE__*/_jsx(StyledTooltipText, {
106
- textAlign: textAlign
107
- }, void 0, text), _StyledMouseOverDetec || (_StyledMouseOverDetec = /*#__PURE__*/_jsx(StyledMouseOverDetectionBox, {}))))
108
- })), children]
109
- })
110
- });
64
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledTriggerWrapper, {
65
+ onMouseEnter,
66
+ onMouseLeave,
67
+ onFocus,
68
+ onBlur,
69
+ ref: setReferenceElement,
70
+ "data-testid": `${TooltipV3DatatestId.TRIGGER_WRAPPER}${id !== "" ? `_${id}` : ""}`
71
+ }, /* @__PURE__ */ React2.createElement(DSPopperJS, {
72
+ referenceElement,
73
+ showPopover,
74
+ withoutPortal: true,
75
+ ...extraPopperJsProps
76
+ }, /* @__PURE__ */ React2.createElement("div", {
77
+ "data-testid": `${TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER}${id !== "" ? `_${id}` : ""}`
78
+ }, /* @__PURE__ */ React2.createElement(StyledTooltipContainer, null, /* @__PURE__ */ React2.createElement(StyledTooltipText, {
79
+ textAlign
80
+ }, text), /* @__PURE__ */ React2.createElement(StyledMouseOverDetectionBox, null)))), children));
111
81
  };
112
-
113
- const DSTooltipV3WithSchema = describe(DSTooltipV3).description('A tooltip component');
82
+ DSTooltipV3.propTypes = dsTooltipPropTypes;
83
+ const DSTooltipV3WithSchema = describe(DSTooltipV3).description("A tooltip component");
114
84
  DSTooltipV3WithSchema.propTypes = dsTooltipPropTypes;
115
-
116
- export { DSTooltipV3, DSTooltipV3WithSchema, DSTooltipV3 as default };
85
+ var v3_default = DSTooltipV3;
86
+ export {
87
+ DSTooltipV3,
88
+ DSTooltipV3WithSchema,
89
+ v3_default as default
90
+ };
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v3/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useState, useCallback, useEffect } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { describe } from 'react-desc';\n\nimport { dsTooltipPropTypes } from './propsTypes';\nimport { useWithDefaultProps } from './config/useWithDefaultProps';\nimport { TooltipV3DatatestId } from './TooltipV3DatatestId';\nimport {\n StyledTooltipContainer,\n StyledTooltipText,\n StyledMouseOverDetectionBox,\n StyledTriggerWrapper,\n} from './styleds';\nimport type { TooltipV3PropsT } from './index.d';\n\nconst useGlobalKeyboardListener = (func) => {\n useEffect(() => {\n document.addEventListener('keydown', func);\n return () => document.removeEventListener('keydown', func);\n }, [func]);\n};\n\nconst DSTooltipV3: React.ComponentType<TooltipV3PropsT> = (props) => {\n const { text, children, onOpen, onClose, id, textAlign, ...extraPopperJsProps } = useWithDefaultProps(props);\n\n const [isFocused, setIsFocused] = useState(false);\n const [isHover, setIsHover] = useState(false);\n const [latestOpenInteraction, setLatestOpenInteraction] = useState('');\n\n const [referenceElement, setReferenceElement] = useState<HTMLSpanElement>();\n const [showPopover, setShowPopover] = useState(false);\n const showTooltip = useCallback(() => {\n setShowPopover(true);\n onOpen();\n }, [onOpen]);\n const hideTooltip = useCallback(() => {\n setShowPopover(false);\n onClose();\n }, [onClose]);\n\n const onFocus = useCallback(() => {\n setIsFocused(true);\n if (!showPopover) {\n showTooltip();\n setLatestOpenInteraction('onFocus');\n }\n }, [showPopover, showTooltip]);\n const onBlur = useCallback(() => {\n setIsFocused(false);\n if (!isHover || latestOpenInteraction === 'onFocus') hideTooltip();\n }, [hideTooltip, isHover, latestOpenInteraction]);\n\n const onMouseEnter = useCallback(() => {\n setIsHover(true);\n if (!showPopover) {\n showTooltip();\n setLatestOpenInteraction('onMouseEnter');\n }\n }, [showPopover, showTooltip]);\n const onMouseLeave = useCallback(() => {\n setIsHover(false);\n if (!isFocused || latestOpenInteraction === 'onMouseEnter') hideTooltip();\n }, [hideTooltip, isFocused, latestOpenInteraction]);\n\n const handleEscKey = useCallback(\n ({ key }) => {\n if (key === 'Escape') hideTooltip();\n },\n [hideTooltip],\n );\n\n useGlobalKeyboardListener(handleEscKey);\n return (\n <>\n {/* The <div> element is catching the \"ESC\" key to close the tooltip, there is no valid aria role for this */}\n {/* eslint-disable-next-line max-len */}\n {/* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <StyledTriggerWrapper\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={setReferenceElement}\n data-testid={`${TooltipV3DatatestId.TRIGGER_WRAPPER}${id !== '' ? `_${id}` : ''}`}\n >\n <DSPopperJS referenceElement={referenceElement} showPopover={showPopover} withoutPortal {...extraPopperJsProps}>\n <div data-testid={`${TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER}${id !== '' ? `_${id}` : ''}`}>\n <StyledTooltipContainer>\n <StyledTooltipText textAlign={textAlign}>{text}</StyledTooltipText>\n <StyledMouseOverDetectionBox />\n </StyledTooltipContainer>\n </div>\n </DSPopperJS>\n\n {children}\n </StyledTriggerWrapper>\n </>\n );\n};\n\nDSTooltipV3.propTypes = dsTooltipPropTypes;\n\nconst DSTooltipV3WithSchema = describe(DSTooltipV3).description('A tooltip component');\nDSTooltipV3WithSchema.propTypes = dsTooltipPropTypes;\n\nexport { DSTooltipV3, DSTooltipV3WithSchema };\nexport default DSTooltipV3;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,MAAM,4BAA4B,CAAC,SAAS;AAC1C,YAAU,MAAM;AACd,aAAS,iBAAiB,WAAW;AACrC,WAAO,MAAM,SAAS,oBAAoB,WAAW;AAAA,KACpD,CAAC;AAAA;AAGN,MAAM,cAAoD,CAAC,UAAU;AACnE,QAAM,EAAE,MAAM,UAAU,QAAQ,SAAS,IAAI,cAAc,uBAAuB,oBAAoB;AAEtG,QAAM,CAAC,WAAW,gBAAgB,SAAS;AAC3C,QAAM,CAAC,SAAS,cAAc,SAAS;AACvC,QAAM,CAAC,uBAAuB,4BAA4B,SAAS;AAEnE,QAAM,CAAC,kBAAkB,uBAAuB;AAChD,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAC/C,QAAM,cAAc,YAAY,MAAM;AACpC,mBAAe;AACf;AAAA,KACC,CAAC;AACJ,QAAM,cAAc,YAAY,MAAM;AACpC,mBAAe;AACf;AAAA,KACC,CAAC;AAEJ,QAAM,UAAU,YAAY,MAAM;AAChC,iBAAa;AACb,QAAI,CAAC,aAAa;AAChB;AACA,+BAAyB;AAAA;AAAA,KAE1B,CAAC,aAAa;AACjB,QAAM,SAAS,YAAY,MAAM;AAC/B,iBAAa;AACb,QAAI,CAAC,WAAW,0BAA0B;AAAW;AAAA,KACpD,CAAC,aAAa,SAAS;AAE1B,QAAM,eAAe,YAAY,MAAM;AACrC,eAAW;AACX,QAAI,CAAC,aAAa;AAChB;AACA,+BAAyB;AAAA;AAAA,KAE1B,CAAC,aAAa;AACjB,QAAM,eAAe,YAAY,MAAM;AACrC,eAAW;AACX,QAAI,CAAC,aAAa,0BAA0B;AAAgB;AAAA,KAC3D,CAAC,aAAa,WAAW;AAE5B,QAAM,eAAe,YACnB,CAAC,EAAE,UAAU;AACX,QAAI,QAAQ;AAAU;AAAA,KAExB,CAAC;AAGH,4BAA0B;AAC1B,SACE,4DAKE,qCAAC,sBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL,eAAa,GAAG,oBAAoB,kBAAkB,OAAO,KAAK,IAAI,OAAO;AAAA,KAE7E,qCAAC,YAAD;AAAA,IAAY;AAAA,IAAoC;AAAA,IAA0B,eAAa;AAAA,OAAK;AAAA,KAC1F,qCAAC,OAAD;AAAA,IAAK,eAAa,GAAG,oBAAoB,uBAAuB,OAAO,KAAK,IAAI,OAAO;AAAA,KACrF,qCAAC,wBAAD,MACE,qCAAC,mBAAD;AAAA,IAAmB;AAAA,KAAuB,OAC1C,qCAAC,6BAAD,UAKL;AAAA;AAMT,YAAY,YAAY;AAExB,MAAM,wBAAwB,SAAS,aAAa,YAAY;AAChE,sBAAsB,YAAY;AAGlC,IAAO,aAAQ;",
6
+ "names": []
7
+ }