@elliemae/ds-truncated-tooltip-text 3.0.0-next.0 → 3.0.0-next.4
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 +145 -0
- package/dist/cjs/DSTruncatedTooltipText.js.map +7 -0
- package/dist/cjs/SimpleTruncatedTooltipText.js +151 -0
- package/dist/cjs/SimpleTruncatedTooltipText.js.map +7 -0
- package/dist/cjs/TooltipTextProvider.js +106 -0
- package/dist/cjs/TooltipTextProvider.js.map +7 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +37 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +95 -0
- 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 +118 -0
- package/dist/esm/DSTruncatedTooltipText.js.map +7 -0
- package/dist/esm/SimpleTruncatedTooltipText.js +124 -0
- package/dist/esm/SimpleTruncatedTooltipText.js.map +7 -0
- package/dist/esm/TooltipTextProvider.js +79 -0
- package/dist/esm/TooltipTextProvider.js.map +7 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +7 -0
- 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 +37 -27
- package/cjs/DSTruncateTextWithTooltip.js +0 -75
- package/cjs/DSTruncatedTooltipText.js +0 -112
- package/cjs/SimpleTruncatedTooltipText.js +0 -148
- package/cjs/TooltipTextProvider.js +0 -78
- package/cjs/index.js +0 -19
- package/esm/DSTruncateTextWithTooltip.js +0 -65
- package/esm/DSTruncatedTooltipText.js +0 -100
- package/esm/SimpleTruncatedTooltipText.js +0 -136
- package/esm/TooltipTextProvider.js +0 -64
- package/esm/index.js +0 -4
- package/types/DSTruncateTextWithTooltip.d.ts +0 -8
- package/types/DSTruncatedTooltipText.d.ts +0 -64
- package/types/SimpleTruncatedTooltipText.d.ts +0 -29
- package/types/TooltipTextProvider.d.ts +0 -14
- package/types/index.d.ts +0 -5
@@ -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
|
+
}
|
@@ -0,0 +1,47 @@
|
|
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 styles_exports = {};
|
29
|
+
__export(styles_exports, {
|
30
|
+
Text: () => Text
|
31
|
+
});
|
32
|
+
var React = __toESM(require("react"));
|
33
|
+
var import_styled_components = __toESM(require("styled-components"));
|
34
|
+
const Text = import_styled_components.default.span`
|
35
|
+
text-overflow: ellipsis;
|
36
|
+
white-space: nowrap;
|
37
|
+
overflow: hidden;
|
38
|
+
display: inline-block;
|
39
|
+
max-width: 100%;
|
40
|
+
&:focus {
|
41
|
+
border: none;
|
42
|
+
outline: none;
|
43
|
+
background: ${({ theme }) => theme.colors.brand[200]};
|
44
|
+
}
|
45
|
+
`;
|
46
|
+
module.exports = __toCommonJS(styles_exports);
|
47
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/truncateTextWithTooltip/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
+
"sourcesContent": ["import styled from 'styled-components';\n\n// reduce the possibility of error showing the tooltip(text-overflow: ellipsis) https://jira.elliemae.io/browse/PUI-1755\nexport const Text = styled.span`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n &:focus {\n border: none;\n outline: none;\n background: ${({ theme }) => theme.colors.brand[200]};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAmB;AAGZ,MAAM,OAAO,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAST,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
+
var __spreadValues = (a, b) => {
|
7
|
+
for (var prop in b || (b = {}))
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
10
|
+
if (__getOwnPropSymbols)
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
+
if (__propIsEnum.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
}
|
15
|
+
return a;
|
16
|
+
};
|
17
|
+
var __objRest = (source, exclude) => {
|
18
|
+
var target = {};
|
19
|
+
for (var prop in source)
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
21
|
+
target[prop] = source[prop];
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
25
|
+
target[prop] = source[prop];
|
26
|
+
}
|
27
|
+
return target;
|
28
|
+
};
|
29
|
+
import * as React from "react";
|
30
|
+
import React2, { useContext, useEffect } from "react";
|
31
|
+
import { describe, PropTypes } from "react-desc";
|
32
|
+
import styled from "styled-components";
|
33
|
+
import { PopperPositions as positions } from "@elliemae/ds-popper";
|
34
|
+
import { TruncatedTooltipContext } from "./TooltipTextProvider";
|
35
|
+
const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
|
36
|
+
const Text = styled.span`
|
37
|
+
text-overflow: ellipsis;
|
38
|
+
white-space: nowrap;
|
39
|
+
overflow: hidden;
|
40
|
+
display: inline-block;
|
41
|
+
max-width: 100%;
|
42
|
+
`;
|
43
|
+
const DSTruncatedTooltipText = (_a) => {
|
44
|
+
var _b = _a, {
|
45
|
+
containerProps = {},
|
46
|
+
value = "",
|
47
|
+
zIndex = 110
|
48
|
+
} = _b, otherTextProps = __objRest(_b, [
|
49
|
+
"containerProps",
|
50
|
+
"value",
|
51
|
+
"zIndex"
|
52
|
+
]);
|
53
|
+
const tooltipContext = useContext(TruncatedTooltipContext);
|
54
|
+
useEffect(() => {
|
55
|
+
if (zIndex && tooltipContext)
|
56
|
+
tooltipContext.setZIndex(zIndex);
|
57
|
+
}, [zIndex]);
|
58
|
+
if (!tooltipContext)
|
59
|
+
return value;
|
60
|
+
const { showTooltip, hideTooltip } = tooltipContext;
|
61
|
+
const handleMouseEnter = (e) => {
|
62
|
+
const { target } = e;
|
63
|
+
if (target && isEllipsisActive(target, target.getBoundingClientRect())) {
|
64
|
+
showTooltip({
|
65
|
+
value,
|
66
|
+
reference: target
|
67
|
+
}, e);
|
68
|
+
}
|
69
|
+
};
|
70
|
+
const handleMouseLeave = (e) => {
|
71
|
+
hideTooltip({ reference: e.target });
|
72
|
+
};
|
73
|
+
const handlers = showTooltip ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};
|
74
|
+
return /* @__PURE__ */ React2.createElement(Text, __spreadValues(__spreadValues(__spreadValues({}, containerProps), otherTextProps), handlers), value);
|
75
|
+
};
|
76
|
+
DSTruncatedTooltipText.defaultProps = {
|
77
|
+
value: "",
|
78
|
+
zIndex: 110
|
79
|
+
};
|
80
|
+
const truncatedTooltipTextProps = {
|
81
|
+
containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
|
82
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Text that when truncated will trigger the tooltip interaction"),
|
83
|
+
tooltipPlacement: PropTypes.oneOf([
|
84
|
+
positions.AUTO_START,
|
85
|
+
positions.AUTO_END,
|
86
|
+
positions.AUTO,
|
87
|
+
positions.TOP_START,
|
88
|
+
positions.TOP,
|
89
|
+
positions.TOP_END,
|
90
|
+
positions.RIGHT_START,
|
91
|
+
positions.RIGHT,
|
92
|
+
positions.RIGHT_END,
|
93
|
+
positions.BOTTOM_START,
|
94
|
+
positions.BOTTOM,
|
95
|
+
positions.BOTTOM_END,
|
96
|
+
positions.LEFT_START,
|
97
|
+
positions.LEFT,
|
98
|
+
positions.LEFT_END
|
99
|
+
]).description("Position of the tooltip"),
|
100
|
+
tooltipDelay: PropTypes.number.description("Delay to show the tooltip"),
|
101
|
+
zIndex: PropTypes.number.description("override default zIndex").defaultValue(110)
|
102
|
+
};
|
103
|
+
DSTruncatedTooltipText.defaultProps = {
|
104
|
+
containerProps: {},
|
105
|
+
value: "",
|
106
|
+
tooltipPlacement: void 0,
|
107
|
+
tooltipDelay: void 0
|
108
|
+
};
|
109
|
+
DSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;
|
110
|
+
const TruncatedTooltipTextWithSchema = describe(DSTruncatedTooltipText);
|
111
|
+
TruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;
|
112
|
+
var DSTruncatedTooltipText_default = DSTruncatedTooltipText;
|
113
|
+
export {
|
114
|
+
DSTruncatedTooltipText,
|
115
|
+
TruncatedTooltipTextWithSchema,
|
116
|
+
DSTruncatedTooltipText_default as default
|
117
|
+
};
|
118
|
+
//# sourceMappingURL=DSTruncatedTooltipText.js.map
|
@@ -0,0 +1,7 @@
|
|
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,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,WAAW;AAClC,YAAU,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,qCAAC,MAAD,iDAAU,iBAAoB,iBAAoB,WAC/C;AAAA;AAKP,uBAAuB,eAAe;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA;AAGV,MAAM,4BAA4B;AAAA,EAChC,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAEF,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAC/D;AAAA,EAEF,kBAAkB,UAAU,MAAM;AAAA,IAChC,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,KACT,YAAY;AAAA,EACf,cAAc,UAAU,OAAO,YAAY;AAAA,EAC3C,QAAQ,UAAU,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,SAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,iCAAQ;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
import * as React from "react";
|
21
|
+
import React2, { useCallback, useMemo, useState } from "react";
|
22
|
+
import { useCancellableDelayedCallback } from "@elliemae/ds-utilities";
|
23
|
+
import PropTypes from "prop-types";
|
24
|
+
import styled from "styled-components";
|
25
|
+
import { DSPopover, PopperPositions as positions } from "@elliemae/ds-popover";
|
26
|
+
const dsTestId = "DS-SimpleTruncateText";
|
27
|
+
const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
|
28
|
+
const initialTooltipState = (value = "", options = {}) => ({
|
29
|
+
reference: null,
|
30
|
+
visible: false,
|
31
|
+
value,
|
32
|
+
options
|
33
|
+
});
|
34
|
+
const Text = styled.span`
|
35
|
+
text-overflow: ellipsis;
|
36
|
+
white-space: nowrap;
|
37
|
+
overflow: hidden;
|
38
|
+
display: inline-block;
|
39
|
+
max-width: 100%;
|
40
|
+
`;
|
41
|
+
const SimpleTruncatedTooltipText = (props) => {
|
42
|
+
const { containerProps, tooltipDelay, placement, value, zIndex, tooltipOptions, textOptions } = props;
|
43
|
+
const [tooltipState, setTooltipState] = useState(initialTooltipState(value, tooltipOptions));
|
44
|
+
const show = useCallback((newState) => {
|
45
|
+
setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: true }));
|
46
|
+
}, [tooltipState]);
|
47
|
+
const hideTooltip = useCallback((newState) => {
|
48
|
+
setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: false }));
|
49
|
+
}, [tooltipState]);
|
50
|
+
const [showTooltip, cancelShowTooltip] = useCancellableDelayedCallback(show, tooltipDelay);
|
51
|
+
const handleMouseEnter = useCallback((e) => {
|
52
|
+
const { target } = e;
|
53
|
+
const SimpleTruncatedTextEl = target.closest(`[data-testid="${dsTestId}"]`);
|
54
|
+
if (SimpleTruncatedTextEl && isEllipsisActive(SimpleTruncatedTextEl)) {
|
55
|
+
showTooltip({ value, reference: SimpleTruncatedTextEl });
|
56
|
+
}
|
57
|
+
}, [showTooltip, value]);
|
58
|
+
const handleMouseLeave = useCallback(() => {
|
59
|
+
cancelShowTooltip();
|
60
|
+
hideTooltip({ reference: null });
|
61
|
+
}, [hideTooltip, cancelShowTooltip]);
|
62
|
+
const handlers = useMemo(() => {
|
63
|
+
if (!showTooltip)
|
64
|
+
return {};
|
65
|
+
return {
|
66
|
+
onMouseEnter: handleMouseEnter,
|
67
|
+
onMouseLeave: handleMouseLeave
|
68
|
+
};
|
69
|
+
}, [showTooltip, handleMouseEnter, handleMouseLeave]);
|
70
|
+
const PurePopover = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, tooltipState.visible ? /* @__PURE__ */ React2.createElement(DSPopover, {
|
71
|
+
boundaries: "window",
|
72
|
+
style: { pointerEvents: "none", zIndex },
|
73
|
+
placement,
|
74
|
+
content: tooltipState.value,
|
75
|
+
referenceEl: tooltipState.reference,
|
76
|
+
visible: tooltipState.visible,
|
77
|
+
showArrow: true
|
78
|
+
}) : null), [tooltipState, placement, zIndex]);
|
79
|
+
const PureText = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Text, __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, containerProps && __spreadValues({}, containerProps)), textOptions && __spreadValues({}, textOptions)), handlers && __spreadValues({}, handlers)), {
|
80
|
+
"data-testid": dsTestId
|
81
|
+
}), value)), [containerProps, textOptions, handlers, value]);
|
82
|
+
const PureSimpleTruncatedTooltipText = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, PureText, PurePopover), [PureText, PurePopover]);
|
83
|
+
return PureSimpleTruncatedTooltipText;
|
84
|
+
};
|
85
|
+
SimpleTruncatedTooltipText.propTypes = {
|
86
|
+
containerProps: PropTypes.object,
|
87
|
+
tooltipOptions: PropTypes.object,
|
88
|
+
textOptions: PropTypes.object,
|
89
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
|
90
|
+
placement: PropTypes.oneOf([
|
91
|
+
positions.AUTO_START,
|
92
|
+
positions.AUTO_END,
|
93
|
+
positions.AUTO,
|
94
|
+
positions.TOP_START,
|
95
|
+
positions.TOP,
|
96
|
+
positions.TOP_END,
|
97
|
+
positions.RIGHT_START,
|
98
|
+
positions.RIGHT,
|
99
|
+
positions.RIGHT_END,
|
100
|
+
positions.BOTTOM_START,
|
101
|
+
positions.BOTTOM,
|
102
|
+
positions.BOTTOM_END,
|
103
|
+
positions.LEFT_START,
|
104
|
+
positions.LEFT,
|
105
|
+
positions.LEFT_END
|
106
|
+
]),
|
107
|
+
tooltipDelay: PropTypes.number,
|
108
|
+
zIndex: PropTypes.number
|
109
|
+
};
|
110
|
+
SimpleTruncatedTooltipText.defaultProps = {
|
111
|
+
containerProps: {},
|
112
|
+
tooltipOptions: {},
|
113
|
+
textOptions: {},
|
114
|
+
value: "",
|
115
|
+
placement: positions.TOP,
|
116
|
+
tooltipDelay: 200,
|
117
|
+
zIndex: 110
|
118
|
+
};
|
119
|
+
var SimpleTruncatedTooltipText_default = SimpleTruncatedTooltipText;
|
120
|
+
export {
|
121
|
+
SimpleTruncatedTooltipText,
|
122
|
+
SimpleTruncatedTooltipText_default as default
|
123
|
+
};
|
124
|
+
//# sourceMappingURL=SimpleTruncatedTooltipText.js.map
|
@@ -0,0 +1,7 @@
|
|
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": "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",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
var __objRest = (source, exclude) => {
|
21
|
+
var target = {};
|
22
|
+
for (var prop in source)
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
24
|
+
target[prop] = source[prop];
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
28
|
+
target[prop] = source[prop];
|
29
|
+
}
|
30
|
+
return target;
|
31
|
+
};
|
32
|
+
import * as React from "react";
|
33
|
+
import React2, { useMemo, useState } from "react";
|
34
|
+
import { DSPopover, usePopoverProviderState } from "@elliemae/ds-popover";
|
35
|
+
const TruncatedTooltipContext = React2.createContext();
|
36
|
+
const { Provider } = TruncatedTooltipContext;
|
37
|
+
function TooltipTextProvider(_a) {
|
38
|
+
var _b = _a, {
|
39
|
+
children,
|
40
|
+
tooltipDelay = 200,
|
41
|
+
placement = "top"
|
42
|
+
} = _b, tooltipOptions = __objRest(_b, [
|
43
|
+
"children",
|
44
|
+
"tooltipDelay",
|
45
|
+
"placement"
|
46
|
+
]);
|
47
|
+
const {
|
48
|
+
show: showTooltip,
|
49
|
+
hide: hideTooltip,
|
50
|
+
state: tooltipState
|
51
|
+
} = usePopoverProviderState({ delay: tooltipDelay });
|
52
|
+
const [zIndex, setZIndex] = useState(110);
|
53
|
+
const value = useMemo(() => ({
|
54
|
+
showTooltip,
|
55
|
+
hideTooltip,
|
56
|
+
setZIndex
|
57
|
+
}), []);
|
58
|
+
return /* @__PURE__ */ React2.createElement(Provider, {
|
59
|
+
value
|
60
|
+
}, children, tooltipState.visible ? /* @__PURE__ */ React2.createElement(DSPopover, __spreadProps(__spreadValues(__spreadValues({
|
61
|
+
boundaries: "window",
|
62
|
+
placement,
|
63
|
+
showArrow: true
|
64
|
+
}, tooltipOptions), tooltipState.options || {}), {
|
65
|
+
content: tooltipState.value,
|
66
|
+
referenceEl: tooltipState.reference,
|
67
|
+
style: { pointerEvents: "none", zIndex },
|
68
|
+
visible: tooltipState.visible
|
69
|
+
})) : null);
|
70
|
+
}
|
71
|
+
TooltipTextProvider.propTypes = {};
|
72
|
+
TooltipTextProvider.defaultProps = {};
|
73
|
+
var TooltipTextProvider_default = TooltipTextProvider;
|
74
|
+
export {
|
75
|
+
TooltipTextProvider,
|
76
|
+
TruncatedTooltipContext,
|
77
|
+
TooltipTextProvider_default as default
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=TooltipTextProvider.js.map
|
@@ -0,0 +1,7 @@
|
|
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,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,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,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
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,16 @@
|
|
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 "./truncateTextWithTooltip";
|
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
|
@@ -0,0 +1,7 @@
|
|
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 './truncateTextWithTooltip';\n"],
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSTruncateTextWithTooltipDatatestid = {\n TEXT: 'ds-truncatetextwithtooltip-text',\n};\n"],
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,sCAAsC;AAAA,EACjD,MAAM;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|