@elliemae/ds-truncated-tooltip-text 2.3.0-alpha.9 → 2.3.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSTruncatedTooltipText.js +112 -0
- package/cjs/SimpleTruncatedTooltipText.js +148 -0
- package/cjs/TooltipTextProvider.js +78 -0
- package/cjs/index.js +21 -0
- package/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +9 -0
- package/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +78 -0
- package/cjs/truncateTextWithTooltip/defaultProps.js +9 -0
- package/cjs/truncateTextWithTooltip/index.js +12 -0
- package/cjs/truncateTextWithTooltip/propTypes.js +13 -0
- package/cjs/truncateTextWithTooltip/styles.js +20 -0
- package/esm/DSTruncatedTooltipText.js +100 -0
- package/esm/SimpleTruncatedTooltipText.js +136 -0
- package/esm/TooltipTextProvider.js +64 -0
- package/esm/index.js +5 -0
- package/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +5 -0
- package/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +69 -0
- package/esm/truncateTextWithTooltip/defaultProps.js +5 -0
- package/esm/truncateTextWithTooltip/index.js +2 -0
- package/esm/truncateTextWithTooltip/propTypes.js +9 -0
- package/esm/truncateTextWithTooltip/styles.js +12 -0
- package/package.json +50 -32
- package/{dist/types → types}/DSTruncatedTooltipText.d.ts +0 -0
- package/{dist/types → types}/SimpleTruncatedTooltipText.d.ts +0 -0
- package/{dist/types → types}/TooltipTextProvider.d.ts +0 -0
- package/types/index.d.ts +5 -0
- package/types/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.d.ts +3 -0
- package/types/truncateTextWithTooltip/DSTruncateTextWithTooltip.d.ts +5 -0
- package/types/truncateTextWithTooltip/defaultProps.d.ts +2 -0
- package/types/truncateTextWithTooltip/index.d.ts +2 -0
- package/types/truncateTextWithTooltip/propTypes.d.ts +14 -0
- package/types/truncateTextWithTooltip/styles.d.ts +1 -0
- package/dist/cjs/DSTruncateTextWithTooltip.js +0 -86
- package/dist/cjs/DSTruncateTextWithTooltip.js.map +0 -7
- package/dist/cjs/DSTruncatedTooltipText.js +0 -119
- package/dist/cjs/DSTruncatedTooltipText.js.map +0 -7
- package/dist/cjs/SimpleTruncatedTooltipText.js +0 -137
- package/dist/cjs/SimpleTruncatedTooltipText.js.map +0 -7
- package/dist/cjs/TooltipTextProvider.js +0 -74
- package/dist/cjs/TooltipTextProvider.js.map +0 -7
- package/dist/cjs/index.js +0 -45
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/DSTruncateTextWithTooltip.js +0 -57
- package/dist/esm/DSTruncateTextWithTooltip.js.map +0 -7
- package/dist/esm/DSTruncatedTooltipText.js +0 -90
- package/dist/esm/DSTruncatedTooltipText.js.map +0 -7
- package/dist/esm/SimpleTruncatedTooltipText.js +0 -108
- package/dist/esm/SimpleTruncatedTooltipText.js.map +0 -7
- package/dist/esm/TooltipTextProvider.js +0 -45
- package/dist/esm/TooltipTextProvider.js.map +0 -7
- package/dist/esm/index.js +0 -16
- package/dist/esm/index.js.map +0 -7
- package/dist/types/DSTruncateTextWithTooltip.d.ts +0 -8
- package/dist/types/index.d.ts +0 -4
|
@@ -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,yBAAyB,iBAAiB,wBAAwB;AACpE,kBAAY,EAAE,OAAO,WAAW;AAAA;AAAA,KAGpC,CAAC,aAAa;AAGhB,QAAM,mBAAmB,YAAY,MAAM;AACzC;AACA,gBAAY,EAAE,WAAW;AAAA,KACxB,CAAC,aAAa;AAEjB,QAAM,WAAW,QAAQ,MAAM;AAC7B,QAAI,CAAC;AAAa,aAAO;AACzB,WAAO;AAAA,MACL,cAAc;AAAA,MACd,cAAc;AAAA;AAAA,KAEf,CAAC,aAAa,kBAAkB;AAEnC,QAAM,cAAc,QAClB,MACE,4DACG,aAAa,UACZ,qCAAC,WAAD;AAAA,IACE,YAAW;AAAA,IACX,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC;AAAA,IACA,SAAS,aAAa;AAAA,IACtB,aAAa,aAAa;AAAA,IAC1B,SAAS,aAAa;AAAA,IACtB,WAAS;AAAA,OAET,OAGR,CAAC,cAAc,WAAW;AAE5B,QAAM,WAAW,QACf,MACE,4DACE,qCAAC,MAAD;AAAA,OACO,kBAAkB,KAAK;AAAA,OACvB,eAAe,KAAK;AAAA,OACpB,YAAY,KAAK;AAAA,IACtB,eAAa;AAAA,KAEZ,SAIP,CAAC,gBAAgB,aAAa,UAAU;AAG1C,QAAM,iCAAiC,QACrC,MACE,4DACG,UACA,cAGL,CAAC,UAAU;AAGb,SAAO;AAAA;AAGT,2BAA2B,YAAY;AAAA,EACrC,gBAAgB,UAAU;AAAA,EAC1B,gBAAgB,UAAU;AAAA,EAC1B,aAAa,UAAU;AAAA,EAEvB,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU;AAAA,EAE1E,WAAW,UAAU,MAAM;AAAA,IACzB,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,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
|
package/dist/esm/index.js.map
DELETED
|
@@ -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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface PropsT {
|
|
3
|
-
text: string;
|
|
4
|
-
tooltipProps?: Record<string, unknown>;
|
|
5
|
-
}
|
|
6
|
-
export declare const DSTruncateTextWithTooltipDatatestId = "DS-TruncateTextWithTooltip";
|
|
7
|
-
export declare const DSTruncateTextWithTooltip: ({ text, tooltipProps }: PropsT) => JSX.Element;
|
|
8
|
-
export {};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';
|
|
2
|
-
export { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';
|
|
3
|
-
export { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';
|
|
4
|
-
export { DSTruncateTextWithTooltipDatatestId, DSTruncateTextWithTooltip } from './DSTruncateTextWithTooltip';
|