@elliemae/ds-truncated-tooltip-text 3.0.0-alpha.0 → 3.0.0-alpha.1
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/dist/cjs/DSTruncatedTooltipText.js +37 -11
- package/dist/cjs/DSTruncatedTooltipText.js.map +1 -1
- package/dist/cjs/SimpleTruncatedTooltipText.js +21 -7
- package/dist/cjs/SimpleTruncatedTooltipText.js.map +1 -1
- package/dist/cjs/TooltipTextProvider.js +43 -11
- package/dist/cjs/TooltipTextProvider.js.map +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +37 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
- package/dist/cjs/{DSTruncateTextWithTooltip.js → truncateTextWithTooltip/DSTruncateTextWithTooltip.js} +33 -24
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/defaultProps.js +37 -0
- package/dist/cjs/truncateTextWithTooltip/defaultProps.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/index.js +29 -0
- package/dist/cjs/truncateTextWithTooltip/index.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/propTypes.js +39 -0
- package/dist/cjs/truncateTextWithTooltip/propTypes.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/styles.js +47 -0
- package/dist/cjs/truncateTextWithTooltip/styles.js.map +7 -0
- package/dist/esm/DSTruncatedTooltipText.js +39 -11
- package/dist/esm/DSTruncatedTooltipText.js.map +1 -1
- package/dist/esm/SimpleTruncatedTooltipText.js +23 -7
- package/dist/esm/SimpleTruncatedTooltipText.js.map +1 -1
- package/dist/esm/TooltipTextProvider.js +45 -11
- package/dist/esm/TooltipTextProvider.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +8 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +68 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/defaultProps.js +8 -0
- package/dist/esm/truncateTextWithTooltip/defaultProps.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/index.js +4 -0
- package/dist/esm/truncateTextWithTooltip/index.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/propTypes.js +10 -0
- package/dist/esm/truncateTextWithTooltip/propTypes.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/styles.js +18 -0
- package/dist/esm/truncateTextWithTooltip/styles.js.map +7 -0
- package/package.json +7 -5
- package/dist/cjs/DSTruncateTextWithTooltip.js.map +0 -7
- package/dist/esm/DSTruncateTextWithTooltip.js +0 -57
- package/dist/esm/DSTruncateTextWithTooltip.js.map +0 -7
- package/dist/types/DSTruncateTextWithTooltip.d.ts +0 -8
- package/dist/types/DSTruncatedTooltipText.d.ts +0 -59
- package/dist/types/SimpleTruncatedTooltipText.d.ts +0 -29
- package/dist/types/TooltipTextProvider.d.ts +0 -14
- package/dist/types/index.d.ts +0 -4
@@ -2,9 +2,35 @@ var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
7
21
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
22
|
+
var __objRest = (source, exclude) => {
|
23
|
+
var target = {};
|
24
|
+
for (var prop in source)
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
26
|
+
target[prop] = source[prop];
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
30
|
+
target[prop] = source[prop];
|
31
|
+
}
|
32
|
+
return target;
|
33
|
+
};
|
8
34
|
var __export = (target, all) => {
|
9
35
|
for (var name in all)
|
10
36
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -45,12 +71,16 @@ const Text = import_styled_components.default.span`
|
|
45
71
|
display: inline-block;
|
46
72
|
max-width: 100%;
|
47
73
|
`;
|
48
|
-
const DSTruncatedTooltipText = ({
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
74
|
+
const DSTruncatedTooltipText = (_a) => {
|
75
|
+
var _b = _a, {
|
76
|
+
containerProps = {},
|
77
|
+
value = "",
|
78
|
+
zIndex = 110
|
79
|
+
} = _b, otherTextProps = __objRest(_b, [
|
80
|
+
"containerProps",
|
81
|
+
"value",
|
82
|
+
"zIndex"
|
83
|
+
]);
|
54
84
|
const tooltipContext = (0, import_react.useContext)(import_TooltipTextProvider.TruncatedTooltipContext);
|
55
85
|
(0, import_react.useEffect)(() => {
|
56
86
|
if (zIndex && tooltipContext)
|
@@ -72,11 +102,7 @@ const DSTruncatedTooltipText = ({
|
|
72
102
|
hideTooltip({ reference: e.target });
|
73
103
|
};
|
74
104
|
const handlers = showTooltip ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};
|
75
|
-
return /* @__PURE__ */ import_react.default.createElement(Text, {
|
76
|
-
...containerProps,
|
77
|
-
...otherTextProps,
|
78
|
-
...handlers
|
79
|
-
}, value);
|
105
|
+
return /* @__PURE__ */ import_react.default.createElement(Text, __spreadValues(__spreadValues(__spreadValues({}, containerProps), otherTextProps), handlers), value);
|
80
106
|
};
|
81
107
|
DSTruncatedTooltipText.defaultProps = {
|
82
108
|
value: "",
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/DSTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAC7C,wBAAoC;AACpC,+BAAmB;AACnB,uBAA6C;AAC7C,iCAAwC;AAExC,MAAM,mBAAmB,CAAC,EAAE,aAAa,kBACvC,cAAc;AAGhB,MAAM,OAAO,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,yBAAyB,CAAC,OAK1B;AAL0B,eAC9B;AAAA,qBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,SAAS;AAAA,MAHqB,IAI3B,2BAJ2B,IAI3B;AAAA,IAHH;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,iBAAiB,6BAAW;AAClC,8BAAU,MAAM;AACd,QAAI,UAAU;AAAgB,qBAAe,UAAU;AAAA,KACtD,CAAC;AAEJ,MAAI,CAAC;AAAgB,WAAO;AAE5B,QAAM,EAAE,aAAa,gBAAgB;AAErC,QAAM,mBAAmB,CAAC,MAAM;AAC9B,UAAM,EAAE,WAAW;AACnB,QAAI,UAAU,iBAAiB,QAAQ,OAAO,0BAA0B;AACtE,kBACE;AAAA,QACE;AAAA,QACA,WAAW;AAAA,SAEb;AAAA;AAAA;AAKN,QAAM,mBAAmB,CAAC,MAAM;AAC9B,gBAAY,EAAE,WAAW,EAAE;AAAA;AAG7B,QAAM,WAAW,cACb,EAAE,cAAc,kBAAkB,cAAc,qBAChD;AACJ,SACE,mDAAC,MAAD,iDAAU,iBAAoB,iBAAoB,WAC/C;AAAA;AAKP,uBAAuB,eAAe;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA;AAGV,MAAM,4BAA4B;AAAA,EAChC,gBAAgB,4BAAU,OAAO,YAC/B;AAAA,EAEF,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,SAAS,YAC/D;AAAA,EAEF,kBAAkB,4BAAU,MAAM;AAAA,IAChC,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,IACV,iCAAU;AAAA,KACT,YAAY;AAAA,EACf,cAAc,4BAAU,OAAO,YAAY;AAAA,EAC3C,QAAQ,4BAAU,OACf,YAAY,2BACZ,aAAa;AAAA;AAGlB,uBAAuB,eAAe;AAAA,EACpC,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,cAAc;AAAA;AAGhB,uBAAuB,YAAY;AAEnC,MAAM,iCAAiC,gCAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,iCAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,9 +1,26 @@
|
|
1
1
|
var __create = Object.create;
|
2
2
|
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
+
var __spreadValues = (a, b) => {
|
13
|
+
for (var prop in b || (b = {}))
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
if (__getOwnPropSymbols)
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
+
if (__propIsEnum.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
}
|
21
|
+
return a;
|
22
|
+
};
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
25
|
var __export = (target, all) => {
|
9
26
|
for (var name in all)
|
@@ -55,10 +72,10 @@ const SimpleTruncatedTooltipText = (props) => {
|
|
55
72
|
const { containerProps, tooltipDelay, placement, value, zIndex, tooltipOptions, textOptions } = props;
|
56
73
|
const [tooltipState, setTooltipState] = (0, import_react.useState)(initialTooltipState(value, tooltipOptions));
|
57
74
|
const show = (0, import_react.useCallback)((newState) => {
|
58
|
-
setTooltipState({
|
75
|
+
setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: true }));
|
59
76
|
}, [tooltipState]);
|
60
77
|
const hideTooltip = (0, import_react.useCallback)((newState) => {
|
61
|
-
setTooltipState({
|
78
|
+
setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: false }));
|
62
79
|
}, [tooltipState]);
|
63
80
|
const [showTooltip, cancelShowTooltip] = (0, import_ds_utilities.useCancellableDelayedCallback)(show, tooltipDelay);
|
64
81
|
const handleMouseEnter = (0, import_react.useCallback)((e) => {
|
@@ -89,12 +106,9 @@ const SimpleTruncatedTooltipText = (props) => {
|
|
89
106
|
visible: tooltipState.visible,
|
90
107
|
showArrow: true
|
91
108
|
}) : null), [tooltipState, placement, zIndex]);
|
92
|
-
const PureText = (0, import_react.useMemo)(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, {
|
93
|
-
...containerProps && { ...containerProps },
|
94
|
-
...textOptions && { ...textOptions },
|
95
|
-
...handlers && { ...handlers },
|
109
|
+
const PureText = (0, import_react.useMemo)(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, containerProps && __spreadValues({}, containerProps)), textOptions && __spreadValues({}, textOptions)), handlers && __spreadValues({}, handlers)), {
|
96
110
|
"data-testid": dsTestId
|
97
|
-
}, value)), [containerProps, textOptions, handlers, value]);
|
111
|
+
}), value)), [containerProps, textOptions, handlers, value]);
|
98
112
|
const PureSimpleTruncatedTooltipText = (0, import_react.useMemo)(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, PureText, PurePopover), [PureText, PurePopover]);
|
99
113
|
return PureSimpleTruncatedTooltipText;
|
100
114
|
};
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/SimpleTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": "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",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,10 +1,39 @@
|
|
1
1
|
var __create = Object.create;
|
2
2
|
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
+
var __spreadValues = (a, b) => {
|
13
|
+
for (var prop in b || (b = {}))
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
if (__getOwnPropSymbols)
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
+
if (__propIsEnum.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
}
|
21
|
+
return a;
|
22
|
+
};
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
25
|
+
var __objRest = (source, exclude) => {
|
26
|
+
var target = {};
|
27
|
+
for (var prop in source)
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
29
|
+
target[prop] = source[prop];
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
33
|
+
target[prop] = source[prop];
|
34
|
+
}
|
35
|
+
return target;
|
36
|
+
};
|
8
37
|
var __export = (target, all) => {
|
9
38
|
for (var name in all)
|
10
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -36,12 +65,16 @@ var import_react = __toESM(require("react"));
|
|
36
65
|
var import_ds_popover = require("@elliemae/ds-popover");
|
37
66
|
const TruncatedTooltipContext = import_react.default.createContext();
|
38
67
|
const { Provider } = TruncatedTooltipContext;
|
39
|
-
function TooltipTextProvider({
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
68
|
+
function TooltipTextProvider(_a) {
|
69
|
+
var _b = _a, {
|
70
|
+
children,
|
71
|
+
tooltipDelay = 200,
|
72
|
+
placement = "top"
|
73
|
+
} = _b, tooltipOptions = __objRest(_b, [
|
74
|
+
"children",
|
75
|
+
"tooltipDelay",
|
76
|
+
"placement"
|
77
|
+
]);
|
45
78
|
const {
|
46
79
|
show: showTooltip,
|
47
80
|
hide: hideTooltip,
|
@@ -55,17 +88,16 @@ function TooltipTextProvider({
|
|
55
88
|
}), []);
|
56
89
|
return /* @__PURE__ */ import_react.default.createElement(Provider, {
|
57
90
|
value
|
58
|
-
}, children, tooltipState.visible ? /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover, {
|
91
|
+
}, children, tooltipState.visible ? /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover, __spreadProps(__spreadValues(__spreadValues({
|
59
92
|
boundaries: "window",
|
60
93
|
placement,
|
61
|
-
showArrow: true
|
62
|
-
|
63
|
-
...tooltipState.options || {},
|
94
|
+
showArrow: true
|
95
|
+
}, tooltipOptions), tooltipState.options || {}), {
|
64
96
|
content: tooltipState.value,
|
65
97
|
referenceEl: tooltipState.reference,
|
66
98
|
style: { pointerEvents: "none", zIndex },
|
67
99
|
visible: tooltipState.visible
|
68
|
-
}) : null);
|
100
|
+
})) : null);
|
69
101
|
}
|
70
102
|
TooltipTextProvider.propTypes = {};
|
71
103
|
TooltipTextProvider.defaultProps = {};
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/TooltipTextProvider.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAyC;AACzC,wBAAmD;AAEnD,MAAM,0BAA0B,qBAAM;AAEtC,MAAM,EAAE,aAAa;AAErB,6BAA6B,IAK1B;AAL0B,eAC3B;AAAA;AAAA,IACA,eAAe;AAAA,IACf,YAAY;AAAA,MAHe,IAIxB,2BAJwB,IAIxB;AAAA,IAHH;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,MACL,+CAAwB,EAAE,OAAO;AACrC,QAAM,CAAC,QAAQ,aAAa,2BAAS;AAErC,QAAM,QAAQ,0BACZ,MAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MAEF;AAGF,SACE,mDAAC,UAAD;AAAA,IAAU;AAAA,KACP,UACA,aAAa,UACZ,mDAAC,6BAAD;AAAA,IACE,YAAW;AAAA,IACX;AAAA,IACA,WAAS;AAAA,KACL,iBACC,aAAa,WAAW,KAL/B;AAAA,IAME,SAAS,aAAa;AAAA,IACtB,aAAa,aAAa;AAAA,IAC1B,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC,SAAS,aAAa;AAAA,QAEtB;AAAA;AAKV,oBAAoB,YAAY;AAChC,oBAAoB,eAAe;AAGnC,IAAO,8BAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
@@ -27,8 +27,8 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
27
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
28
28
|
var src_exports = {};
|
29
29
|
__export(src_exports, {
|
30
|
-
DSTruncateTextWithTooltip: () =>
|
31
|
-
|
30
|
+
DSTruncateTextWithTooltip: () => import_truncateTextWithTooltip.DSTruncateTextWithTooltip,
|
31
|
+
DSTruncateTextWithTooltipDatatestid: () => import_truncateTextWithTooltip.DSTruncateTextWithTooltipDatatestid,
|
32
32
|
DSTruncatedTooltipText: () => import_DSTruncatedTooltipText.DSTruncatedTooltipText,
|
33
33
|
SimpleTruncatedTooltipText: () => import_SimpleTruncatedTooltipText.SimpleTruncatedTooltipText,
|
34
34
|
TooltipTextProvider: () => import_TooltipTextProvider.TooltipTextProvider,
|
@@ -40,6 +40,6 @@ var React = __toESM(require("react"));
|
|
40
40
|
var import_TooltipTextProvider = require("./TooltipTextProvider");
|
41
41
|
var import_SimpleTruncatedTooltipText = require("./SimpleTruncatedTooltipText");
|
42
42
|
var import_DSTruncatedTooltipText = __toESM(require("./DSTruncatedTooltipText"));
|
43
|
-
var
|
43
|
+
var import_truncateTextWithTooltip = require("./truncateTextWithTooltip");
|
44
44
|
module.exports = __toCommonJS(src_exports);
|
45
45
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';\nexport {
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAA6D;AAC7D,wCAA2C;AAC3C,oCAAgF;AAChF,
|
4
|
+
"sourcesContent": ["export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';\nexport { DSTruncateTextWithTooltipDatatestid, DSTruncateTextWithTooltip } from './truncateTextWithTooltip';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAA6D;AAC7D,wCAA2C;AAC3C,oCAAgF;AAChF,qCAA+E;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return target;
|
19
|
+
};
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
22
|
+
};
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
24
|
+
return (module2, temp) => {
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
26
|
+
};
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
28
|
+
var DSTruncateTextWIthTooltipDatatestid_exports = {};
|
29
|
+
__export(DSTruncateTextWIthTooltipDatatestid_exports, {
|
30
|
+
DSTruncateTextWithTooltipDatatestid: () => DSTruncateTextWithTooltipDatatestid
|
31
|
+
});
|
32
|
+
var React = __toESM(require("react"));
|
33
|
+
const DSTruncateTextWithTooltipDatatestid = {
|
34
|
+
TEXT: "ds-truncatetextwithtooltip-text"
|
35
|
+
};
|
36
|
+
module.exports = __toCommonJS(DSTruncateTextWIthTooltipDatatestid_exports);
|
37
|
+
//# sourceMappingURL=DSTruncateTextWIthTooltipDatatestid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["export const DSTruncateTextWithTooltipDatatestid = {\n TEXT: 'ds-truncatetextwithtooltip-text',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,sCAAsC;AAAA,EACjD,MAAM;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
7
21
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
22
|
var __export = (target, all) => {
|
9
23
|
for (var name in all)
|
@@ -28,27 +42,21 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
28
42
|
var DSTruncateTextWithTooltip_exports = {};
|
29
43
|
__export(DSTruncateTextWithTooltip_exports, {
|
30
44
|
DSTruncateTextWithTooltip: () => DSTruncateTextWithTooltip,
|
31
|
-
|
45
|
+
DSTruncateTextWithTooltipWithSchema: () => DSTruncateTextWithTooltipWithSchema
|
32
46
|
});
|
33
47
|
var React = __toESM(require("react"));
|
34
48
|
var import_react = __toESM(require("react"));
|
35
49
|
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
36
|
-
var
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
background: ${(props) => props.theme.colors.brand["200"]};
|
47
|
-
}
|
48
|
-
`;
|
49
|
-
const DSTruncateTextWithTooltipDatatestId = "DS-TruncateTextWithTooltip";
|
50
|
-
const DSTruncateTextWithTooltip = ({ text, tooltipProps = {} }) => {
|
51
|
-
const [textWrapperEl, setTextWrapperEl] = (0, import_react.useState)();
|
50
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
51
|
+
var import_defaultProps = require("./defaultProps");
|
52
|
+
var import_DSTruncateTextWIthTooltipDatatestid = require("./DSTruncateTextWIthTooltipDatatestid");
|
53
|
+
var import_propTypes = require("./propTypes");
|
54
|
+
var import_styles = require("./styles");
|
55
|
+
const DSTruncateTextWithTooltip = (props) => {
|
56
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
|
57
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_propTypes.propTypes);
|
58
|
+
const { text, tooltipProps } = propsWithDefault;
|
59
|
+
const [textWrapperEl, setTextWrapperEl] = (0, import_react.useState)(null);
|
52
60
|
const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
|
53
61
|
const resizeObserver = (0, import_react.useMemo)(() => new ResizeObserver((entries) => {
|
54
62
|
if (entries.length) {
|
@@ -69,18 +77,19 @@ const DSTruncateTextWithTooltip = ({ text, tooltipProps = {} }) => {
|
|
69
77
|
};
|
70
78
|
}, [resizeObserver, textWrapperEl]);
|
71
79
|
if (isShowingEllipsis)
|
72
|
-
return /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, {
|
73
|
-
text
|
74
|
-
|
75
|
-
}, /* @__PURE__ */ import_react.default.createElement(Text, {
|
80
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, __spreadValues({
|
81
|
+
text
|
82
|
+
}, tooltipProps), /* @__PURE__ */ import_react.default.createElement(import_styles.Text, {
|
76
83
|
ref: setTextWrapperEl,
|
77
84
|
tabIndex: 0,
|
78
|
-
"data-testid":
|
85
|
+
"data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT
|
79
86
|
}, text));
|
80
|
-
return /* @__PURE__ */ import_react.default.createElement(Text, {
|
87
|
+
return /* @__PURE__ */ import_react.default.createElement(import_styles.Text, {
|
81
88
|
ref: setTextWrapperEl,
|
82
|
-
"data-testid":
|
89
|
+
"data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT
|
83
90
|
}, text);
|
84
91
|
};
|
92
|
+
const DSTruncateTextWithTooltipWithSchema = (0, import_ds_props_helpers.describe)(DSTruncateTextWithTooltip);
|
93
|
+
DSTruncateTextWithTooltipWithSchema.propTypes = import_propTypes.propTypes;
|
85
94
|
module.exports = __toCommonJS(DSTruncateTextWithTooltip_exports);
|
86
95
|
//# sourceMappingURL=DSTruncateTextWithTooltip.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/DSTruncateTextWithTooltip.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import React, { useState, useMemo, useEffect } from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from '@elliemae/ds-props-helpers';\nimport { defaultProps } from './defaultProps';\nimport { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid';\nimport { propTypes } from './propTypes';\nimport { Text } from './styles';\nimport type { DSTruncateTextWithTooltipT } from './propTypes';\n\nconst DSTruncateTextWithTooltip = (props: DSTruncateTextWithTooltipT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSTruncateTextWithTooltipT.Props>(props, defaultProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, propTypes);\n\n const { text, tooltipProps } = propsWithDefault;\n\n const [textWrapperEl, setTextWrapperEl] = useState<HTMLSpanElement | null>(null);\n const [isShowingEllipsis, setIsShowingEllipsis] = useState<boolean>(false);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (entries.length) {\n const [textWrapperEntry] = entries;\n const el = textWrapperEntry.target;\n setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);\n }\n }),\n [],\n );\n\n useEffect(() => {\n if (textWrapperEl) {\n setIsShowingEllipsis(textWrapperEl?.scrollWidth > textWrapperEl?.clientWidth);\n resizeObserver.observe(textWrapperEl);\n }\n return () => {\n if (textWrapperEl) {\n resizeObserver.unobserve(textWrapperEl);\n }\n };\n }, [resizeObserver, textWrapperEl]);\n\n if (isShowingEllipsis)\n return (\n <DSTooltipV3 text={text} {...tooltipProps}>\n <Text ref={setTextWrapperEl} tabIndex={0} data-testid={DSTruncateTextWithTooltipDatatestid.TEXT}>\n {text}\n </Text>\n </DSTooltipV3>\n );\n\n return (\n <Text ref={setTextWrapperEl} data-testid={DSTruncateTextWithTooltipDatatestid.TEXT}>\n {text}\n </Text>\n );\n};\n\nconst DSTruncateTextWithTooltipWithSchema = describe<DSTruncateTextWithTooltipT.Props>(DSTruncateTextWithTooltip);\n\nDSTruncateTextWithTooltipWithSchema.propTypes = propTypes;\n\nexport { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoD;AACpD,wBAA4B;AAC5B,8BAAuF;AACvF,0BAA6B;AAC7B,iDAAoD;AACpD,uBAA0B;AAC1B,oBAAqB;AAGrB,MAAM,4BAA4B,CAAC,UAAyD;AAC1F,QAAM,mBAAmB,0DAA+D,OAAO;AAE/F,8DAA+B,kBAAkB;AAEjD,QAAM,EAAE,MAAM,iBAAiB;AAE/B,QAAM,CAAC,eAAe,oBAAoB,2BAAiC;AAC3E,QAAM,CAAC,mBAAmB,wBAAwB,2BAAkB;AAEpE,QAAM,iBAAiB,0BACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,QAAI,QAAQ,QAAQ;AAClB,YAAM,CAAC,oBAAoB;AAC3B,YAAM,KAAK,iBAAiB;AAC5B,2BAAqB,IAAI,cAAc,IAAI;AAAA;AAAA,MAGjD;AAGF,8BAAU,MAAM;AACd,QAAI,eAAe;AACjB,2BAAqB,eAAe,cAAc,eAAe;AACjE,qBAAe,QAAQ;AAAA;AAEzB,WAAO,MAAM;AACX,UAAI,eAAe;AACjB,uBAAe,UAAU;AAAA;AAAA;AAAA,KAG5B,CAAC,gBAAgB;AAEpB,MAAI;AACF,WACE,mDAAC,+BAAD;AAAA,MAAa;AAAA,OAAgB,eAC3B,mDAAC,oBAAD;AAAA,MAAM,KAAK;AAAA,MAAkB,UAAU;AAAA,MAAG,eAAa,+EAAoC;AAAA,OACxF;AAKT,SACE,mDAAC,oBAAD;AAAA,IAAM,KAAK;AAAA,IAAkB,eAAa,+EAAoC;AAAA,KAC3E;AAAA;AAKP,MAAM,sCAAsC,sCAA2C;AAEvF,oCAAoC,YAAY;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return target;
|
19
|
+
};
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
22
|
+
};
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
24
|
+
return (module2, temp) => {
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
26
|
+
};
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
28
|
+
var defaultProps_exports = {};
|
29
|
+
__export(defaultProps_exports, {
|
30
|
+
defaultProps: () => defaultProps
|
31
|
+
});
|
32
|
+
var React = __toESM(require("react"));
|
33
|
+
const defaultProps = {
|
34
|
+
tooltipProps: {}
|
35
|
+
};
|
36
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
37
|
+
//# sourceMappingURL=defaultProps.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/defaultProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import type { DSTruncateTextWithTooltipT } from './propTypes';\n\nexport const defaultProps: DSTruncateTextWithTooltipT.DefaultProps = {\n tooltipProps: {},\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,eAAwD;AAAA,EACnE,cAAc;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
11
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
13
|
+
}
|
14
|
+
return target;
|
15
|
+
};
|
16
|
+
var __toESM = (module2, isNodeMode) => {
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
18
|
+
};
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
20
|
+
return (module2, temp) => {
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
22
|
+
};
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
24
|
+
var truncateTextWithTooltip_exports = {};
|
25
|
+
var React = __toESM(require("react"));
|
26
|
+
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWithTooltip"));
|
27
|
+
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWIthTooltipDatatestid"));
|
28
|
+
module.exports = __toCommonJS(truncateTextWithTooltip_exports);
|
29
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["export * from './DSTruncateTextWithTooltip';\nexport * from './DSTruncateTextWIthTooltipDatatestid';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;ADAvB,4CAAc;AACd,4CAAc;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return target;
|
19
|
+
};
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
22
|
+
};
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
24
|
+
return (module2, temp) => {
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
26
|
+
};
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
28
|
+
var propTypes_exports = {};
|
29
|
+
__export(propTypes_exports, {
|
30
|
+
propTypes: () => propTypes
|
31
|
+
});
|
32
|
+
var React = __toESM(require("react"));
|
33
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
34
|
+
const propTypes = {
|
35
|
+
text: import_ds_props_helpers.PropTypes.string.description("Text to show.").isRequired,
|
36
|
+
tooltipProps: import_ds_props_helpers.PropTypes.object.description("This component uses DSTooltip component, you can set properties directly to this component with this property.").defaultValue({})
|
37
|
+
};
|
38
|
+
module.exports = __toCommonJS(propTypes_exports);
|
39
|
+
//# sourceMappingURL=propTypes.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/propTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["/* eslint-disable max-len */\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSTruncateTextWithTooltipT {\n export interface PropsRequired {\n text: string;\n }\n\n export interface DefaultProps {\n tooltipProps: Record<string, unknown>;\n }\n\n export interface Props extends DefaultProps, PropsRequired {}\n}\n\nexport const propTypes = {\n text: PropTypes.string.description('Text to show.').isRequired,\n tooltipProps: PropTypes.object\n .description(\n 'This component uses DSTooltip component, you can set properties directly to this component with this property.',\n )\n .defaultValue({}),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAcnB,MAAM,YAAY;AAAA,EACvB,MAAM,kCAAU,OAAO,YAAY,iBAAiB;AAAA,EACpD,cAAc,kCAAU,OACrB,YACC,kHAED,aAAa;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|