@elliemae/ds-truncated-tooltip-text 2.3.0-alpha.8 → 2.3.0-next.10

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 (51) hide show
  1. package/cjs/DSTruncatedTooltipText.js +112 -0
  2. package/cjs/SimpleTruncatedTooltipText.js +148 -0
  3. package/cjs/TooltipTextProvider.js +78 -0
  4. package/cjs/index.js +21 -0
  5. package/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +9 -0
  6. package/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +78 -0
  7. package/cjs/truncateTextWithTooltip/defaultProps.js +9 -0
  8. package/cjs/truncateTextWithTooltip/index.js +12 -0
  9. package/cjs/truncateTextWithTooltip/propTypes.js +13 -0
  10. package/cjs/truncateTextWithTooltip/styles.js +20 -0
  11. package/esm/DSTruncatedTooltipText.js +100 -0
  12. package/esm/SimpleTruncatedTooltipText.js +136 -0
  13. package/esm/TooltipTextProvider.js +64 -0
  14. package/esm/index.js +5 -0
  15. package/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +5 -0
  16. package/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +69 -0
  17. package/esm/truncateTextWithTooltip/defaultProps.js +5 -0
  18. package/esm/truncateTextWithTooltip/index.js +2 -0
  19. package/esm/truncateTextWithTooltip/propTypes.js +9 -0
  20. package/esm/truncateTextWithTooltip/styles.js +12 -0
  21. package/package.json +50 -32
  22. package/types/DSTruncatedTooltipText.d.ts +59 -0
  23. package/types/SimpleTruncatedTooltipText.d.ts +29 -0
  24. package/types/TooltipTextProvider.d.ts +14 -0
  25. package/types/index.d.ts +5 -0
  26. package/types/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.d.ts +3 -0
  27. package/types/truncateTextWithTooltip/DSTruncateTextWithTooltip.d.ts +5 -0
  28. package/types/truncateTextWithTooltip/defaultProps.d.ts +2 -0
  29. package/types/truncateTextWithTooltip/index.d.ts +2 -0
  30. package/types/truncateTextWithTooltip/propTypes.d.ts +14 -0
  31. package/types/truncateTextWithTooltip/styles.d.ts +1 -0
  32. package/dist/cjs/DSTruncateTextWithTooltip.js +0 -86
  33. package/dist/cjs/DSTruncateTextWithTooltip.js.map +0 -7
  34. package/dist/cjs/DSTruncatedTooltipText.js +0 -119
  35. package/dist/cjs/DSTruncatedTooltipText.js.map +0 -7
  36. package/dist/cjs/SimpleTruncatedTooltipText.js +0 -137
  37. package/dist/cjs/SimpleTruncatedTooltipText.js.map +0 -7
  38. package/dist/cjs/TooltipTextProvider.js +0 -74
  39. package/dist/cjs/TooltipTextProvider.js.map +0 -7
  40. package/dist/cjs/index.js +0 -45
  41. package/dist/cjs/index.js.map +0 -7
  42. package/dist/esm/DSTruncateTextWithTooltip.js +0 -57
  43. package/dist/esm/DSTruncateTextWithTooltip.js.map +0 -7
  44. package/dist/esm/DSTruncatedTooltipText.js +0 -90
  45. package/dist/esm/DSTruncatedTooltipText.js.map +0 -7
  46. package/dist/esm/SimpleTruncatedTooltipText.js +0 -108
  47. package/dist/esm/SimpleTruncatedTooltipText.js.map +0 -7
  48. package/dist/esm/TooltipTextProvider.js +0 -45
  49. package/dist/esm/TooltipTextProvider.js.map +0 -7
  50. package/dist/esm/index.js +0 -16
  51. package/dist/esm/index.js.map +0 -7
@@ -1,90 +0,0 @@
1
- import * as React from "react";
2
- import React2, { useContext, useEffect } from "react";
3
- import { describe, PropTypes } from "react-desc";
4
- import styled from "styled-components";
5
- import { PopperPositions as positions } from "@elliemae/ds-popper";
6
- import { TruncatedTooltipContext } from "./TooltipTextProvider";
7
- const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
8
- const Text = styled.span`
9
- text-overflow: ellipsis;
10
- white-space: nowrap;
11
- overflow: hidden;
12
- display: inline-block;
13
- max-width: 100%;
14
- `;
15
- const DSTruncatedTooltipText = ({
16
- containerProps = {},
17
- value = "",
18
- zIndex = 110,
19
- ...otherTextProps
20
- }) => {
21
- const tooltipContext = useContext(TruncatedTooltipContext);
22
- useEffect(() => {
23
- if (zIndex && tooltipContext)
24
- tooltipContext.setZIndex(zIndex);
25
- }, [zIndex]);
26
- if (!tooltipContext)
27
- return value;
28
- const { showTooltip, hideTooltip } = tooltipContext;
29
- const handleMouseEnter = (e) => {
30
- const { target } = e;
31
- if (target && isEllipsisActive(target, target.getBoundingClientRect())) {
32
- showTooltip({
33
- value,
34
- reference: target
35
- }, e);
36
- }
37
- };
38
- const handleMouseLeave = (e) => {
39
- hideTooltip({ reference: e.target });
40
- };
41
- const handlers = showTooltip ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};
42
- return /* @__PURE__ */ React2.createElement(Text, {
43
- ...containerProps,
44
- ...otherTextProps,
45
- ...handlers
46
- }, value);
47
- };
48
- DSTruncatedTooltipText.defaultProps = {
49
- value: "",
50
- zIndex: 110
51
- };
52
- const truncatedTooltipTextProps = {
53
- containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
54
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Text that when truncated will trigger the tooltip interaction"),
55
- tooltipPlacement: PropTypes.oneOf([
56
- positions.AUTO_START,
57
- positions.AUTO_END,
58
- positions.AUTO,
59
- positions.TOP_START,
60
- positions.TOP,
61
- positions.TOP_END,
62
- positions.RIGHT_START,
63
- positions.RIGHT,
64
- positions.RIGHT_END,
65
- positions.BOTTOM_START,
66
- positions.BOTTOM,
67
- positions.BOTTOM_END,
68
- positions.LEFT_START,
69
- positions.LEFT,
70
- positions.LEFT_END
71
- ]).description("Position of the tooltip"),
72
- tooltipDelay: PropTypes.number.description("Delay to show the tooltip"),
73
- zIndex: PropTypes.number.description("override default zIndex").defaultValue(110)
74
- };
75
- DSTruncatedTooltipText.defaultProps = {
76
- containerProps: {},
77
- value: "",
78
- tooltipPlacement: void 0,
79
- tooltipDelay: void 0
80
- };
81
- DSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;
82
- const TruncatedTooltipTextWithSchema = describe(DSTruncatedTooltipText);
83
- TruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;
84
- var DSTruncatedTooltipText_default = DSTruncatedTooltipText;
85
- export {
86
- DSTruncatedTooltipText,
87
- TruncatedTooltipTextWithSchema,
88
- DSTruncatedTooltipText_default as default
89
- };
90
- //# sourceMappingURL=DSTruncatedTooltipText.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTruncatedTooltipText.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport styled from 'styled-components';\nimport { PopperPositions as positions } from '@elliemae/ds-popper';\nimport { TruncatedTooltipContext } from './TooltipTextProvider';\n\nconst isEllipsisActive = ({ offsetWidth, scrollWidth }) =>\n offsetWidth < scrollWidth;\n\n// reduce the possibility of error showing the tooltip (text-overflow: ellipsis) https://jira.elliemae.io/browse/PUI-1755\nconst Text = styled.span`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\nconst DSTruncatedTooltipText = ({\n containerProps = {},\n value = '',\n zIndex = 110, // https://jira.elliemae.io/browse/PUI-1755\n ...otherTextProps\n}) => {\n const tooltipContext = useContext(TruncatedTooltipContext);\n useEffect(() => {\n if (zIndex && tooltipContext) tooltipContext.setZIndex(zIndex);\n }, [zIndex]);\n\n if (!tooltipContext) return value;\n\n const { showTooltip, hideTooltip } = tooltipContext;\n\n const handleMouseEnter = (e) => {\n const { target } = e;\n if (target && isEllipsisActive(target, target.getBoundingClientRect())) {\n showTooltip(\n {\n value,\n reference: target,\n },\n e,\n );\n }\n };\n\n const handleMouseLeave = (e) => {\n hideTooltip({ reference: e.target });\n };\n\n const handlers = showTooltip\n ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }\n : {};\n return (\n <Text {...containerProps} {...otherTextProps} {...handlers}>\n {value}\n </Text>\n );\n};\n\nDSTruncatedTooltipText.defaultProps = {\n value: '',\n zIndex: 110,\n};\n\nconst truncatedTooltipTextProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'Text that when truncated will trigger the tooltip interaction',\n ),\n tooltipPlacement: PropTypes.oneOf([\n positions.AUTO_START,\n positions.AUTO_END,\n positions.AUTO,\n positions.TOP_START,\n positions.TOP,\n positions.TOP_END,\n positions.RIGHT_START,\n positions.RIGHT,\n positions.RIGHT_END,\n positions.BOTTOM_START,\n positions.BOTTOM,\n positions.BOTTOM_END,\n positions.LEFT_START,\n positions.LEFT,\n positions.LEFT_END,\n ]).description('Position of the tooltip'),\n tooltipDelay: PropTypes.number.description('Delay to show the tooltip'),\n zIndex: PropTypes.number\n .description('override default zIndex')\n .defaultValue(110),\n};\n\nDSTruncatedTooltipText.defaultProps = {\n containerProps: {},\n value: '',\n tooltipPlacement: undefined,\n tooltipDelay: undefined,\n};\n\nDSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;\n\nconst TruncatedTooltipTextWithSchema = describe(DSTruncatedTooltipText);\nTruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;\n\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema };\nexport default DSTruncatedTooltipText;\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB,CAAC,EAAE,aAAa,kBACvC,cAAc;AAGhB,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,yBAAyB,CAAC;AAAA,EAC9B,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,SAAS;AAAA,KACN;AAAA,MACC;AACJ,QAAM,iBAAiB,WAAW;AAClC,YAAU,MAAM;AACd,QAAI,UAAU;AAAgB,qBAAe,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G3C,IAAO,iCAAQ;",
6
- "names": []
7
- }
@@ -1,108 +0,0 @@
1
- import * as React from "react";
2
- import React2, { useCallback, useMemo, useState } from "react";
3
- import { useCancellableDelayedCallback } from "@elliemae/ds-utilities";
4
- import PropTypes from "prop-types";
5
- import styled from "styled-components";
6
- import { DSPopover, PopperPositions as positions } from "@elliemae/ds-popover";
7
- const dsTestId = "DS-SimpleTruncateText";
8
- const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
9
- const initialTooltipState = (value = "", options = {}) => ({
10
- reference: null,
11
- visible: false,
12
- value,
13
- options
14
- });
15
- const Text = styled.span`
16
- text-overflow: ellipsis;
17
- white-space: nowrap;
18
- overflow: hidden;
19
- display: inline-block;
20
- max-width: 100%;
21
- `;
22
- const SimpleTruncatedTooltipText = (props) => {
23
- const { containerProps, tooltipDelay, placement, value, zIndex, tooltipOptions, textOptions } = props;
24
- const [tooltipState, setTooltipState] = useState(initialTooltipState(value, tooltipOptions));
25
- const show = useCallback((newState) => {
26
- setTooltipState({ ...tooltipState, ...newState, visible: true });
27
- }, [tooltipState]);
28
- const hideTooltip = useCallback((newState) => {
29
- setTooltipState({ ...tooltipState, ...newState, visible: false });
30
- }, [tooltipState]);
31
- const [showTooltip, cancelShowTooltip] = useCancellableDelayedCallback(show, tooltipDelay);
32
- const handleMouseEnter = useCallback((e) => {
33
- const { target } = e;
34
- const SimpleTruncatedTextEl = target.closest(`[data-testid="${dsTestId}"]`);
35
- if (SimpleTruncatedTextEl && isEllipsisActive(SimpleTruncatedTextEl)) {
36
- showTooltip({ value, reference: SimpleTruncatedTextEl });
37
- }
38
- }, [showTooltip, value]);
39
- const handleMouseLeave = useCallback(() => {
40
- cancelShowTooltip();
41
- hideTooltip({ reference: null });
42
- }, [hideTooltip, cancelShowTooltip]);
43
- const handlers = useMemo(() => {
44
- if (!showTooltip)
45
- return {};
46
- return {
47
- onMouseEnter: handleMouseEnter,
48
- onMouseLeave: handleMouseLeave
49
- };
50
- }, [showTooltip, handleMouseEnter, handleMouseLeave]);
51
- const PurePopover = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, tooltipState.visible ? /* @__PURE__ */ React2.createElement(DSPopover, {
52
- boundaries: "window",
53
- style: { pointerEvents: "none", zIndex },
54
- placement,
55
- content: tooltipState.value,
56
- referenceEl: tooltipState.reference,
57
- visible: tooltipState.visible,
58
- showArrow: true
59
- }) : null), [tooltipState, placement, zIndex]);
60
- const PureText = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Text, {
61
- ...containerProps && { ...containerProps },
62
- ...textOptions && { ...textOptions },
63
- ...handlers && { ...handlers },
64
- "data-testid": dsTestId
65
- }, value)), [containerProps, textOptions, handlers, value]);
66
- const PureSimpleTruncatedTooltipText = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, PureText, PurePopover), [PureText, PurePopover]);
67
- return PureSimpleTruncatedTooltipText;
68
- };
69
- SimpleTruncatedTooltipText.propTypes = {
70
- containerProps: PropTypes.object,
71
- tooltipOptions: PropTypes.object,
72
- textOptions: PropTypes.object,
73
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
74
- placement: PropTypes.oneOf([
75
- positions.AUTO_START,
76
- positions.AUTO_END,
77
- positions.AUTO,
78
- positions.TOP_START,
79
- positions.TOP,
80
- positions.TOP_END,
81
- positions.RIGHT_START,
82
- positions.RIGHT,
83
- positions.RIGHT_END,
84
- positions.BOTTOM_START,
85
- positions.BOTTOM,
86
- positions.BOTTOM_END,
87
- positions.LEFT_START,
88
- positions.LEFT,
89
- positions.LEFT_END
90
- ]),
91
- tooltipDelay: PropTypes.number,
92
- zIndex: PropTypes.number
93
- };
94
- SimpleTruncatedTooltipText.defaultProps = {
95
- containerProps: {},
96
- tooltipOptions: {},
97
- textOptions: {},
98
- value: "",
99
- placement: positions.TOP,
100
- tooltipDelay: 200,
101
- zIndex: 110
102
- };
103
- var SimpleTruncatedTooltipText_default = SimpleTruncatedTooltipText;
104
- export {
105
- SimpleTruncatedTooltipText,
106
- SimpleTruncatedTooltipText_default as default
107
- };
108
- //# sourceMappingURL=SimpleTruncatedTooltipText.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/SimpleTruncatedTooltipText.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { useCancellableDelayedCallback } from '@elliemae/ds-utilities';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\nimport { DSPopover, PopperPositions as positions } from '@elliemae/ds-popover';\n\nconst dsTestId = 'DS-SimpleTruncateText';\n\nconst isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;\n\nconst initialTooltipState = (value = '', options = {}) => ({\n reference: null,\n visible: false,\n value,\n options,\n});\n// reduce the possibility of error showing the tooltip(text-overflow: ellipsis) https://jira.elliemae.io/browse/PUI-1755\nconst Text = styled.span`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\nconst SimpleTruncatedTooltipText = (props) => {\n const { containerProps, tooltipDelay, placement, value, zIndex, tooltipOptions, textOptions } = props;\n\n // not using \"usePopoverProviderState\" because usePopoverState has memory leak issues\n const [tooltipState, setTooltipState] = useState(initialTooltipState(value, tooltipOptions));\n const show = useCallback(\n (newState) => {\n setTooltipState({ ...tooltipState, ...newState, visible: true });\n },\n [tooltipState],\n );\n const hideTooltip = useCallback(\n (newState) => {\n setTooltipState({ ...tooltipState, ...newState, visible: false });\n },\n [tooltipState],\n );\n const [showTooltip, cancelShowTooltip] = useCancellableDelayedCallback(show, tooltipDelay);\n\n const handleMouseEnter = useCallback(\n (e) => {\n const { target } = e;\n // we search for the closest parent with data-testid matching this component\n // this is required because the target may not be this component itself\n // when the user gives JSX as a value.\n // JSX as a value is required for features like text highlight during research\n // wich would still allow the truncation behaviour (see tree view for example)\n // when the target has the test-id itself target===SimpleTruncatedTextEl\n const SimpleTruncatedTextEl = target.closest(`[data-testid=\"${dsTestId}\"]`);\n if (SimpleTruncatedTextEl && isEllipsisActive(SimpleTruncatedTextEl)) {\n showTooltip({ value, reference: SimpleTruncatedTextEl });\n }\n },\n [showTooltip, value],\n );\n\n const handleMouseLeave = useCallback(() => {\n cancelShowTooltip();\n hideTooltip({ reference: null });\n }, [hideTooltip, cancelShowTooltip]);\n\n const handlers = useMemo(() => {\n if (!showTooltip) return {};\n return {\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n };\n }, [showTooltip, handleMouseEnter, handleMouseLeave]);\n\n const PurePopover = useMemo(\n () => (\n <>\n {tooltipState.visible ? (\n <DSPopover\n boundaries=\"window\"\n style={{ pointerEvents: 'none', zIndex }}\n placement={placement}\n content={tooltipState.value}\n referenceEl={tooltipState.reference}\n visible={tooltipState.visible}\n showArrow\n />\n ) : null}\n </>\n ),\n [tooltipState, placement, zIndex],\n );\n const PureText = useMemo(\n () => (\n <>\n <Text\n {...(containerProps && { ...containerProps })}\n {...(textOptions && { ...textOptions })}\n {...(handlers && { ...handlers })}\n data-testid={dsTestId} // this is used by mouse enter too. required to support value as JSX\n >\n {value}\n </Text>\n </>\n ),\n [containerProps, textOptions, handlers, value],\n );\n\n const PureSimpleTruncatedTooltipText = useMemo(\n () => (\n <>\n {PureText}\n {PurePopover}\n </>\n ),\n [PureText, PurePopover],\n );\n\n return PureSimpleTruncatedTooltipText;\n};\n\nSimpleTruncatedTooltipText.propTypes = {\n containerProps: PropTypes.object,\n tooltipOptions: PropTypes.object,\n textOptions: PropTypes.object,\n /** Text that when truncated will trigger the tooltip interaction */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),\n /** Position of the tooltip */\n placement: PropTypes.oneOf([\n positions.AUTO_START,\n positions.AUTO_END,\n positions.AUTO,\n positions.TOP_START,\n positions.TOP,\n positions.TOP_END,\n positions.RIGHT_START,\n positions.RIGHT,\n positions.RIGHT_END,\n positions.BOTTOM_START,\n positions.BOTTOM,\n positions.BOTTOM_END,\n positions.LEFT_START,\n positions.LEFT,\n positions.LEFT_END,\n ]),\n /** Delay to show the tooltip */\n tooltipDelay: PropTypes.number,\n /** override default zIndex */\n zIndex: PropTypes.number,\n};\n\nSimpleTruncatedTooltipText.defaultProps = {\n containerProps: {},\n tooltipOptions: {},\n textOptions: {},\n value: '',\n placement: positions.TOP,\n tooltipDelay: 200,\n zIndex: 110,\n};\n\nexport { SimpleTruncatedTooltipText };\nexport default SimpleTruncatedTooltipText;\n"],
5
- "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAEA,MAAM,WAAW;AAEjB,MAAM,mBAAmB,CAAC,EAAE,aAAa,kBAAkB,cAAc;AAEzE,MAAM,sBAAsB,CAAC,QAAQ,IAAI,UAAU,OAAQ;AAAA,EACzD,WAAW;AAAA,EACX,SAAS;AAAA,EACT;AAAA,EACA;AAAA;AAGF,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,6BAA6B,CAAC,UAAU;AAC5C,QAAM,EAAE,gBAAgB,cAAc,WAAW,OAAO,QAAQ,gBAAgB,gBAAgB;AAGhG,QAAM,CAAC,cAAc,mBAAmB,SAAS,oBAAoB,OAAO;AAC5E,QAAM,OAAO,YACX,CAAC,aAAa;AACZ,oBAAgB,KAAK,iBAAiB,UAAU,SAAS;AAAA,KAE3D,CAAC;AAEH,QAAM,cAAc,YAClB,CAAC,aAAa;AACZ,oBAAgB,KAAK,iBAAiB,UAAU,SAAS;AAAA,KAE3D,CAAC;AAEH,QAAM,CAAC,aAAa,qBAAqB,8BAA8B,MAAM;AAE7E,QAAM,mBAAmB,YACvB,CAAC,MAAM;AACL,UAAM,EAAE,WAAW;AAOnB,UAAM,wBAAwB,OAAO,QAAQ,iBAAiB;AAC9D,QAAI,yBAA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,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA;AAAA,EAGZ,cAAc,UAAU;AAAA,EAExB,QAAQ,UAAU;AAAA;AAGpB,2BAA2B,eAAe;AAAA,EACxC,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,OAAO;AAAA,EACP,WAAW,UAAU;AAAA,EACrB,cAAc;AAAA,EACd,QAAQ;AAAA;AAIV,IAAO,qCAAQ;",
6
- "names": []
7
- }
@@ -1,45 +0,0 @@
1
- import * as React from "react";
2
- import React2, { useMemo, useState } from "react";
3
- import { DSPopover, usePopoverProviderState } from "@elliemae/ds-popover";
4
- const TruncatedTooltipContext = React2.createContext();
5
- const { Provider } = TruncatedTooltipContext;
6
- function TooltipTextProvider({
7
- children,
8
- tooltipDelay = 200,
9
- placement = "top",
10
- ...tooltipOptions
11
- }) {
12
- const {
13
- show: showTooltip,
14
- hide: hideTooltip,
15
- state: tooltipState
16
- } = usePopoverProviderState({ delay: tooltipDelay });
17
- const [zIndex, setZIndex] = useState(110);
18
- const value = useMemo(() => ({
19
- showTooltip,
20
- hideTooltip,
21
- setZIndex
22
- }), []);
23
- return /* @__PURE__ */ React2.createElement(Provider, {
24
- value
25
- }, children, tooltipState.visible ? /* @__PURE__ */ React2.createElement(DSPopover, {
26
- boundaries: "window",
27
- placement,
28
- showArrow: true,
29
- ...tooltipOptions,
30
- ...tooltipState.options || {},
31
- content: tooltipState.value,
32
- referenceEl: tooltipState.reference,
33
- style: { pointerEvents: "none", zIndex },
34
- visible: tooltipState.visible
35
- }) : null);
36
- }
37
- TooltipTextProvider.propTypes = {};
38
- TooltipTextProvider.defaultProps = {};
39
- var TooltipTextProvider_default = TooltipTextProvider;
40
- export {
41
- TooltipTextProvider,
42
- TruncatedTooltipContext,
43
- TooltipTextProvider_default as default
44
- };
45
- //# sourceMappingURL=TooltipTextProvider.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/TooltipTextProvider.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useMemo, useState } from 'react';\nimport { DSPopover, usePopoverProviderState } from '@elliemae/ds-popover';\n\nconst TruncatedTooltipContext = React.createContext();\n\nconst { Provider } = TruncatedTooltipContext;\n\nfunction TooltipTextProvider({\n children,\n tooltipDelay = 200,\n placement = 'top',\n ...tooltipOptions\n}) {\n const {\n show: showTooltip,\n hide: hideTooltip,\n state: tooltipState,\n } = usePopoverProviderState({ delay: tooltipDelay });\n const [zIndex, setZIndex] = useState(110);\n\n const value = useMemo(\n () => ({\n showTooltip,\n hideTooltip,\n setZIndex,\n }),\n [],\n );\n\n return (\n <Provider value={value}>\n {children}\n {tooltipState.visible ? (\n <DSPopover\n boundaries=\"window\"\n placement={placement}\n showArrow\n {...tooltipOptions}\n {...(tooltipState.options || {})}\n content={tooltipState.value}\n referenceEl={tooltipState.reference}\n style={{ pointerEvents: 'none', zIndex }}\n visible={tooltipState.visible}\n />\n ) : null}\n </Provider>\n );\n}\n\nTooltipTextProvider.propTypes = {};\nTooltipTextProvider.defaultProps = {};\n\nexport { TooltipTextProvider, TruncatedTooltipContext };\nexport default TooltipTextProvider;\n"],
5
- "mappings": "AAAA;ACCA;AACA;AAEA,MAAM,0BAA0B,OAAM;AAEtC,MAAM,EAAE,aAAa;AAErB,6BAA6B;AAAA,EAC3B;AAAA,EACA,eAAe;AAAA,EACf,YAAY;AAAA,KACT;AAAA,GACF;AACD,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,MACL,wBAAwB,EAAE,OAAO;AACrC,QAAM,CAAC,QAAQ,aAAa,SAAS;AAErC,QAAM,QAAQ,QACZ,MAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MAEF;AAGF,SACE,qCAAC,UAAD;AAAA,IAAU;AAAA,KACP,UACA,aAAa,UACZ,qCAAC,WAAD;AAAA,IACE,YAAW;AAAA,IACX;AAAA,IACA,WAAS;AAAA,OACL;AAAA,OACC,aAAa,WAAW;AAAA,IAC7B,SAAS,aAAa;AAAA,IACtB,aAAa,aAAa;AAAA,IAC1B,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC,SAAS,aAAa;AAAA,OAEtB;AAAA;AAKV,oBAAoB,YAAY;AAChC,oBAAoB,eAAe;AAGnC,IAAO,8BAAQ;",
6
- "names": []
7
- }
package/dist/esm/index.js DELETED
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
- import { TooltipTextProvider, TruncatedTooltipContext } from "./TooltipTextProvider";
3
- import { SimpleTruncatedTooltipText } from "./SimpleTruncatedTooltipText";
4
- import { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default as default2 } from "./DSTruncatedTooltipText";
5
- import { DSTruncateTextWithTooltipDatatestId, DSTruncateTextWithTooltip } from "./DSTruncateTextWithTooltip";
6
- export {
7
- DSTruncateTextWithTooltip,
8
- DSTruncateTextWithTooltipDatatestId,
9
- DSTruncatedTooltipText,
10
- SimpleTruncatedTooltipText,
11
- TooltipTextProvider,
12
- TruncatedTooltipContext,
13
- TruncatedTooltipTextWithSchema,
14
- default2 as default
15
- };
16
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';\nexport { DSTruncateTextWithTooltipDatatestId, DSTruncateTextWithTooltip } from './DSTruncateTextWithTooltip';\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;",
6
- "names": []
7
- }