@elliemae/ds-truncated-tooltip-text 3.0.0-next.2 → 3.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cjs/DSTruncatedTooltipText.js +145 -0
  2. package/dist/cjs/DSTruncatedTooltipText.js.map +7 -0
  3. package/dist/cjs/SimpleTruncatedTooltipText.js +151 -0
  4. package/dist/cjs/SimpleTruncatedTooltipText.js.map +7 -0
  5. package/dist/cjs/TooltipTextProvider.js +106 -0
  6. package/dist/cjs/TooltipTextProvider.js.map +7 -0
  7. package/dist/cjs/index.js +46 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +37 -0
  10. package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
  11. package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +95 -0
  12. package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
  13. package/dist/cjs/truncateTextWithTooltip/defaultProps.js +37 -0
  14. package/dist/cjs/truncateTextWithTooltip/defaultProps.js.map +7 -0
  15. package/dist/cjs/truncateTextWithTooltip/index.js +29 -0
  16. package/dist/cjs/truncateTextWithTooltip/index.js.map +7 -0
  17. package/dist/cjs/truncateTextWithTooltip/propTypes.js +39 -0
  18. package/dist/cjs/truncateTextWithTooltip/propTypes.js.map +7 -0
  19. package/dist/cjs/truncateTextWithTooltip/styles.js +47 -0
  20. package/dist/cjs/truncateTextWithTooltip/styles.js.map +7 -0
  21. package/dist/esm/DSTruncatedTooltipText.js +118 -0
  22. package/dist/esm/DSTruncatedTooltipText.js.map +7 -0
  23. package/dist/esm/SimpleTruncatedTooltipText.js +124 -0
  24. package/dist/esm/SimpleTruncatedTooltipText.js.map +7 -0
  25. package/dist/esm/TooltipTextProvider.js +79 -0
  26. package/dist/esm/TooltipTextProvider.js.map +7 -0
  27. package/dist/esm/index.js +17 -0
  28. package/dist/esm/index.js.map +7 -0
  29. package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +8 -0
  30. package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
  31. package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +68 -0
  32. package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
  33. package/dist/esm/truncateTextWithTooltip/defaultProps.js +8 -0
  34. package/dist/esm/truncateTextWithTooltip/defaultProps.js.map +7 -0
  35. package/dist/esm/truncateTextWithTooltip/index.js +4 -0
  36. package/dist/esm/truncateTextWithTooltip/index.js.map +7 -0
  37. package/dist/esm/truncateTextWithTooltip/propTypes.js +10 -0
  38. package/dist/esm/truncateTextWithTooltip/propTypes.js.map +7 -0
  39. package/dist/esm/truncateTextWithTooltip/styles.js +18 -0
  40. package/dist/esm/truncateTextWithTooltip/styles.js.map +7 -0
  41. package/package.json +37 -27
  42. package/cjs/DSTruncateTextWithTooltip.js +0 -75
  43. package/cjs/DSTruncatedTooltipText.js +0 -112
  44. package/cjs/SimpleTruncatedTooltipText.js +0 -148
  45. package/cjs/TooltipTextProvider.js +0 -78
  46. package/cjs/index.js +0 -19
  47. package/esm/DSTruncateTextWithTooltip.js +0 -65
  48. package/esm/DSTruncatedTooltipText.js +0 -100
  49. package/esm/SimpleTruncatedTooltipText.js +0 -136
  50. package/esm/TooltipTextProvider.js +0 -64
  51. package/esm/index.js +0 -4
  52. package/types/DSTruncateTextWithTooltip.d.ts +0 -8
  53. package/types/DSTruncatedTooltipText.d.ts +0 -64
  54. package/types/SimpleTruncatedTooltipText.d.ts +0 -29
  55. package/types/TooltipTextProvider.d.ts +0 -14
  56. package/types/index.d.ts +0 -5
@@ -0,0 +1,145 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
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
+ };
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
+ };
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __reExport = (target, module2, copyDefault, desc) => {
39
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
40
+ for (let key of __getOwnPropNames(module2))
41
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
42
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
43
+ }
44
+ return target;
45
+ };
46
+ var __toESM = (module2, isNodeMode) => {
47
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
48
+ };
49
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
50
+ return (module2, temp) => {
51
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
52
+ };
53
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
54
+ var DSTruncatedTooltipText_exports = {};
55
+ __export(DSTruncatedTooltipText_exports, {
56
+ DSTruncatedTooltipText: () => DSTruncatedTooltipText,
57
+ TruncatedTooltipTextWithSchema: () => TruncatedTooltipTextWithSchema,
58
+ default: () => DSTruncatedTooltipText_default
59
+ });
60
+ var React = __toESM(require("react"));
61
+ var import_react = __toESM(require("react"));
62
+ var import_react_desc = require("react-desc");
63
+ var import_styled_components = __toESM(require("styled-components"));
64
+ var import_ds_popper = require("@elliemae/ds-popper");
65
+ var import_TooltipTextProvider = require("./TooltipTextProvider");
66
+ const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
67
+ const Text = import_styled_components.default.span`
68
+ text-overflow: ellipsis;
69
+ white-space: nowrap;
70
+ overflow: hidden;
71
+ display: inline-block;
72
+ max-width: 100%;
73
+ `;
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
+ ]);
84
+ const tooltipContext = (0, import_react.useContext)(import_TooltipTextProvider.TruncatedTooltipContext);
85
+ (0, import_react.useEffect)(() => {
86
+ if (zIndex && tooltipContext)
87
+ tooltipContext.setZIndex(zIndex);
88
+ }, [zIndex]);
89
+ if (!tooltipContext)
90
+ return value;
91
+ const { showTooltip, hideTooltip } = tooltipContext;
92
+ const handleMouseEnter = (e) => {
93
+ const { target } = e;
94
+ if (target && isEllipsisActive(target, target.getBoundingClientRect())) {
95
+ showTooltip({
96
+ value,
97
+ reference: target
98
+ }, e);
99
+ }
100
+ };
101
+ const handleMouseLeave = (e) => {
102
+ hideTooltip({ reference: e.target });
103
+ };
104
+ const handlers = showTooltip ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};
105
+ return /* @__PURE__ */ import_react.default.createElement(Text, __spreadValues(__spreadValues(__spreadValues({}, containerProps), otherTextProps), handlers), value);
106
+ };
107
+ DSTruncatedTooltipText.defaultProps = {
108
+ value: "",
109
+ zIndex: 110
110
+ };
111
+ const truncatedTooltipTextProps = {
112
+ containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container"),
113
+ value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("Text that when truncated will trigger the tooltip interaction"),
114
+ tooltipPlacement: import_react_desc.PropTypes.oneOf([
115
+ import_ds_popper.PopperPositions.AUTO_START,
116
+ import_ds_popper.PopperPositions.AUTO_END,
117
+ import_ds_popper.PopperPositions.AUTO,
118
+ import_ds_popper.PopperPositions.TOP_START,
119
+ import_ds_popper.PopperPositions.TOP,
120
+ import_ds_popper.PopperPositions.TOP_END,
121
+ import_ds_popper.PopperPositions.RIGHT_START,
122
+ import_ds_popper.PopperPositions.RIGHT,
123
+ import_ds_popper.PopperPositions.RIGHT_END,
124
+ import_ds_popper.PopperPositions.BOTTOM_START,
125
+ import_ds_popper.PopperPositions.BOTTOM,
126
+ import_ds_popper.PopperPositions.BOTTOM_END,
127
+ import_ds_popper.PopperPositions.LEFT_START,
128
+ import_ds_popper.PopperPositions.LEFT,
129
+ import_ds_popper.PopperPositions.LEFT_END
130
+ ]).description("Position of the tooltip"),
131
+ tooltipDelay: import_react_desc.PropTypes.number.description("Delay to show the tooltip"),
132
+ zIndex: import_react_desc.PropTypes.number.description("override default zIndex").defaultValue(110)
133
+ };
134
+ DSTruncatedTooltipText.defaultProps = {
135
+ containerProps: {},
136
+ value: "",
137
+ tooltipPlacement: void 0,
138
+ tooltipDelay: void 0
139
+ };
140
+ DSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;
141
+ const TruncatedTooltipTextWithSchema = (0, import_react_desc.describe)(DSTruncatedTooltipText);
142
+ TruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;
143
+ var DSTruncatedTooltipText_default = DSTruncatedTooltipText;
144
+ module.exports = __toCommonJS(DSTruncatedTooltipText_exports);
145
+ //# sourceMappingURL=DSTruncatedTooltipText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+ "names": []
7
+ }
@@ -0,0 +1,151 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
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));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __reExport = (target, module2, copyDefault, desc) => {
30
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
31
+ for (let key of __getOwnPropNames(module2))
32
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
33
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
34
+ }
35
+ return target;
36
+ };
37
+ var __toESM = (module2, isNodeMode) => {
38
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
39
+ };
40
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
41
+ return (module2, temp) => {
42
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
43
+ };
44
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
45
+ var SimpleTruncatedTooltipText_exports = {};
46
+ __export(SimpleTruncatedTooltipText_exports, {
47
+ SimpleTruncatedTooltipText: () => SimpleTruncatedTooltipText,
48
+ default: () => SimpleTruncatedTooltipText_default
49
+ });
50
+ var React = __toESM(require("react"));
51
+ var import_react = __toESM(require("react"));
52
+ var import_ds_utilities = require("@elliemae/ds-utilities");
53
+ var import_prop_types = __toESM(require("prop-types"));
54
+ var import_styled_components = __toESM(require("styled-components"));
55
+ var import_ds_popover = require("@elliemae/ds-popover");
56
+ const dsTestId = "DS-SimpleTruncateText";
57
+ const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
58
+ const initialTooltipState = (value = "", options = {}) => ({
59
+ reference: null,
60
+ visible: false,
61
+ value,
62
+ options
63
+ });
64
+ const Text = import_styled_components.default.span`
65
+ text-overflow: ellipsis;
66
+ white-space: nowrap;
67
+ overflow: hidden;
68
+ display: inline-block;
69
+ max-width: 100%;
70
+ `;
71
+ const SimpleTruncatedTooltipText = (props) => {
72
+ const { containerProps, tooltipDelay, placement, value, zIndex, tooltipOptions, textOptions } = props;
73
+ const [tooltipState, setTooltipState] = (0, import_react.useState)(initialTooltipState(value, tooltipOptions));
74
+ const show = (0, import_react.useCallback)((newState) => {
75
+ setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: true }));
76
+ }, [tooltipState]);
77
+ const hideTooltip = (0, import_react.useCallback)((newState) => {
78
+ setTooltipState(__spreadProps(__spreadValues(__spreadValues({}, tooltipState), newState), { visible: false }));
79
+ }, [tooltipState]);
80
+ const [showTooltip, cancelShowTooltip] = (0, import_ds_utilities.useCancellableDelayedCallback)(show, tooltipDelay);
81
+ const handleMouseEnter = (0, import_react.useCallback)((e) => {
82
+ const { target } = e;
83
+ const SimpleTruncatedTextEl = target.closest(`[data-testid="${dsTestId}"]`);
84
+ if (SimpleTruncatedTextEl && isEllipsisActive(SimpleTruncatedTextEl)) {
85
+ showTooltip({ value, reference: SimpleTruncatedTextEl });
86
+ }
87
+ }, [showTooltip, value]);
88
+ const handleMouseLeave = (0, import_react.useCallback)(() => {
89
+ cancelShowTooltip();
90
+ hideTooltip({ reference: null });
91
+ }, [hideTooltip, cancelShowTooltip]);
92
+ const handlers = (0, import_react.useMemo)(() => {
93
+ if (!showTooltip)
94
+ return {};
95
+ return {
96
+ onMouseEnter: handleMouseEnter,
97
+ onMouseLeave: handleMouseLeave
98
+ };
99
+ }, [showTooltip, handleMouseEnter, handleMouseLeave]);
100
+ const PurePopover = (0, import_react.useMemo)(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, tooltipState.visible ? /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover, {
101
+ boundaries: "window",
102
+ style: { pointerEvents: "none", zIndex },
103
+ placement,
104
+ content: tooltipState.value,
105
+ referenceEl: tooltipState.reference,
106
+ visible: tooltipState.visible,
107
+ showArrow: true
108
+ }) : null), [tooltipState, placement, zIndex]);
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)), {
110
+ "data-testid": dsTestId
111
+ }), value)), [containerProps, textOptions, handlers, value]);
112
+ const PureSimpleTruncatedTooltipText = (0, import_react.useMemo)(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, PureText, PurePopover), [PureText, PurePopover]);
113
+ return PureSimpleTruncatedTooltipText;
114
+ };
115
+ SimpleTruncatedTooltipText.propTypes = {
116
+ containerProps: import_prop_types.default.object,
117
+ tooltipOptions: import_prop_types.default.object,
118
+ textOptions: import_prop_types.default.object,
119
+ value: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number, import_prop_types.default.node]),
120
+ placement: import_prop_types.default.oneOf([
121
+ import_ds_popover.PopperPositions.AUTO_START,
122
+ import_ds_popover.PopperPositions.AUTO_END,
123
+ import_ds_popover.PopperPositions.AUTO,
124
+ import_ds_popover.PopperPositions.TOP_START,
125
+ import_ds_popover.PopperPositions.TOP,
126
+ import_ds_popover.PopperPositions.TOP_END,
127
+ import_ds_popover.PopperPositions.RIGHT_START,
128
+ import_ds_popover.PopperPositions.RIGHT,
129
+ import_ds_popover.PopperPositions.RIGHT_END,
130
+ import_ds_popover.PopperPositions.BOTTOM_START,
131
+ import_ds_popover.PopperPositions.BOTTOM,
132
+ import_ds_popover.PopperPositions.BOTTOM_END,
133
+ import_ds_popover.PopperPositions.LEFT_START,
134
+ import_ds_popover.PopperPositions.LEFT,
135
+ import_ds_popover.PopperPositions.LEFT_END
136
+ ]),
137
+ tooltipDelay: import_prop_types.default.number,
138
+ zIndex: import_prop_types.default.number
139
+ };
140
+ SimpleTruncatedTooltipText.defaultProps = {
141
+ containerProps: {},
142
+ tooltipOptions: {},
143
+ textOptions: {},
144
+ value: "",
145
+ placement: import_ds_popover.PopperPositions.TOP,
146
+ tooltipDelay: 200,
147
+ zIndex: 110
148
+ };
149
+ var SimpleTruncatedTooltipText_default = SimpleTruncatedTooltipText;
150
+ module.exports = __toCommonJS(SimpleTruncatedTooltipText_exports);
151
+ //# sourceMappingURL=SimpleTruncatedTooltipText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SimpleTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAsD;AACtD,0BAA8C;AAC9C,wBAAsB;AACtB,+BAAmB;AACnB,wBAAwD;AAExD,MAAM,WAAW;AAEjB,MAAM,mBAAmB,CAAC,EAAE,aAAa,kBAAkB,cAAc;AAEzE,MAAM,sBAAsB,CAAC,QAAQ,IAAI,UAAU,OAAQ;AAAA,EACzD,WAAW;AAAA,EACX,SAAS;AAAA,EACT;AAAA,EACA;AAAA;AAGF,MAAM,OAAO,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,6BAA6B,CAAC,UAAU;AAC5C,QAAM,EAAE,gBAAgB,cAAc,WAAW,OAAO,QAAQ,gBAAgB,gBAAgB;AAGhG,QAAM,CAAC,cAAc,mBAAmB,2BAAS,oBAAoB,OAAO;AAC5E,QAAM,OAAO,8BACX,CAAC,aAAa;AACZ,oBAAgB,gDAAK,eAAiB,WAAtB,EAAgC,SAAS;AAAA,KAE3D,CAAC;AAEH,QAAM,cAAc,8BAClB,CAAC,aAAa;AACZ,oBAAgB,gDAAK,eAAiB,WAAtB,EAAgC,SAAS;AAAA,KAE3D,CAAC;AAEH,QAAM,CAAC,aAAa,qBAAqB,uDAA8B,MAAM;AAE7E,QAAM,mBAAmB,8BACvB,CAAC,MAAM;AACL,UAAM,EAAE,WAAW;AAOnB,UAAM,wBAAwB,OAAO,QAAQ,iBAAiB;AAC9D,QAAI,yBAAyB,iBAAiB,wBAAwB;AACpE,kBAAY,EAAE,OAAO,WAAW;AAAA;AAAA,KAGpC,CAAC,aAAa;AAGhB,QAAM,mBAAmB,8BAAY,MAAM;AACzC;AACA,gBAAY,EAAE,WAAW;AAAA,KACxB,CAAC,aAAa;AAEjB,QAAM,WAAW,0BAAQ,MAAM;AAC7B,QAAI,CAAC;AAAa,aAAO;AACzB,WAAO;AAAA,MACL,cAAc;AAAA,MACd,cAAc;AAAA;AAAA,KAEf,CAAC,aAAa,kBAAkB;AAEnC,QAAM,cAAc,0BAClB,MACE,wFACG,aAAa,UACZ,mDAAC,6BAAD;AAAA,IACE,YAAW;AAAA,IACX,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC;AAAA,IACA,SAAS,aAAa;AAAA,IACtB,aAAa,aAAa;AAAA,IAC1B,SAAS,aAAa;AAAA,IACtB,WAAS;AAAA,OAET,OAGR,CAAC,cAAc,WAAW;AAE5B,QAAM,WAAW,0BACf,MACE,wFACE,mDAAC,MAAD,+DACO,kBAAkB,mBAAK,kBACvB,eAAe,mBAAK,eACpB,YAAY,mBAAK,YAHxB;AAAA,IAIE,eAAa;AAAA,MAEZ,SAIP,CAAC,gBAAgB,aAAa,UAAU;AAG1C,QAAM,iCAAiC,0BACrC,MACE,wFACG,UACA,cAGL,CAAC,UAAU;AAGb,SAAO;AAAA;AAGT,2BAA2B,YAAY;AAAA,EACrC,gBAAgB,0BAAU;AAAA,EAC1B,gBAAgB,0BAAU;AAAA,EAC1B,aAAa,0BAAU;AAAA,EAEvB,OAAO,0BAAU,UAAU,CAAC,0BAAU,QAAQ,0BAAU,QAAQ,0BAAU;AAAA,EAE1E,WAAW,0BAAU,MAAM;AAAA,IACzB,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA,IACV,kCAAU;AAAA;AAAA,EAGZ,cAAc,0BAAU;AAAA,EAExB,QAAQ,0BAAU;AAAA;AAGpB,2BAA2B,eAAe;AAAA,EACxC,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,OAAO;AAAA,EACP,WAAW,kCAAU;AAAA,EACrB,cAAc;AAAA,EACd,QAAQ;AAAA;AAIV,IAAO,qCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,106 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
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));
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
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __reExport = (target, module2, copyDefault, desc) => {
42
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
43
+ for (let key of __getOwnPropNames(module2))
44
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
45
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
46
+ }
47
+ return target;
48
+ };
49
+ var __toESM = (module2, isNodeMode) => {
50
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
51
+ };
52
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
53
+ return (module2, temp) => {
54
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
55
+ };
56
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
57
+ var TooltipTextProvider_exports = {};
58
+ __export(TooltipTextProvider_exports, {
59
+ TooltipTextProvider: () => TooltipTextProvider,
60
+ TruncatedTooltipContext: () => TruncatedTooltipContext,
61
+ default: () => TooltipTextProvider_default
62
+ });
63
+ var React = __toESM(require("react"));
64
+ var import_react = __toESM(require("react"));
65
+ var import_ds_popover = require("@elliemae/ds-popover");
66
+ const TruncatedTooltipContext = import_react.default.createContext();
67
+ const { Provider } = TruncatedTooltipContext;
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
+ ]);
78
+ const {
79
+ show: showTooltip,
80
+ hide: hideTooltip,
81
+ state: tooltipState
82
+ } = (0, import_ds_popover.usePopoverProviderState)({ delay: tooltipDelay });
83
+ const [zIndex, setZIndex] = (0, import_react.useState)(110);
84
+ const value = (0, import_react.useMemo)(() => ({
85
+ showTooltip,
86
+ hideTooltip,
87
+ setZIndex
88
+ }), []);
89
+ return /* @__PURE__ */ import_react.default.createElement(Provider, {
90
+ value
91
+ }, children, tooltipState.visible ? /* @__PURE__ */ import_react.default.createElement(import_ds_popover.DSPopover, __spreadProps(__spreadValues(__spreadValues({
92
+ boundaries: "window",
93
+ placement,
94
+ showArrow: true
95
+ }, tooltipOptions), tooltipState.options || {}), {
96
+ content: tooltipState.value,
97
+ referenceEl: tooltipState.reference,
98
+ style: { pointerEvents: "none", zIndex },
99
+ visible: tooltipState.visible
100
+ })) : null);
101
+ }
102
+ TooltipTextProvider.propTypes = {};
103
+ TooltipTextProvider.defaultProps = {};
104
+ var TooltipTextProvider_default = TooltipTextProvider;
105
+ module.exports = __toCommonJS(TooltipTextProvider_exports);
106
+ //# sourceMappingURL=TooltipTextProvider.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/TooltipTextProvider.tsx", "../../../../scripts/build/transpile/react-shim.js"],
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+ "names": []
7
+ }
@@ -0,0 +1,46 @@
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 src_exports = {};
29
+ __export(src_exports, {
30
+ DSTruncateTextWithTooltip: () => import_truncateTextWithTooltip.DSTruncateTextWithTooltip,
31
+ DSTruncateTextWithTooltipDatatestid: () => import_truncateTextWithTooltip.DSTruncateTextWithTooltipDatatestid,
32
+ DSTruncateTextWithTooltipWithSchema: () => import_truncateTextWithTooltip.DSTruncateTextWithTooltipWithSchema,
33
+ DSTruncatedTooltipText: () => import_DSTruncatedTooltipText.DSTruncatedTooltipText,
34
+ SimpleTruncatedTooltipText: () => import_SimpleTruncatedTooltipText.SimpleTruncatedTooltipText,
35
+ TooltipTextProvider: () => import_TooltipTextProvider.TooltipTextProvider,
36
+ TruncatedTooltipContext: () => import_TooltipTextProvider.TruncatedTooltipContext,
37
+ TruncatedTooltipTextWithSchema: () => import_DSTruncatedTooltipText.TruncatedTooltipTextWithSchema,
38
+ default: () => import_DSTruncatedTooltipText.default
39
+ });
40
+ var React = __toESM(require("react"));
41
+ var import_TooltipTextProvider = require("./TooltipTextProvider");
42
+ var import_SimpleTruncatedTooltipText = require("./SimpleTruncatedTooltipText");
43
+ var import_DSTruncatedTooltipText = __toESM(require("./DSTruncatedTooltipText"));
44
+ var import_truncateTextWithTooltip = require("./truncateTextWithTooltip");
45
+ module.exports = __toCommonJS(src_exports);
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 { DSTruncateTextWithTooltipDatatestid, DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema } from './truncateTextWithTooltip';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAA6D;AAC7D,wCAA2C;AAC3C,oCAAgF;AAChF,qCAAoH;",
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 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
+ }
@@ -0,0 +1,95 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
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
+ };
21
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+ var __reExport = (target, module2, copyDefault, desc) => {
27
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
28
+ for (let key of __getOwnPropNames(module2))
29
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
30
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
31
+ }
32
+ return target;
33
+ };
34
+ var __toESM = (module2, isNodeMode) => {
35
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
36
+ };
37
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
38
+ return (module2, temp) => {
39
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
40
+ };
41
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
42
+ var DSTruncateTextWithTooltip_exports = {};
43
+ __export(DSTruncateTextWithTooltip_exports, {
44
+ DSTruncateTextWithTooltip: () => DSTruncateTextWithTooltip,
45
+ DSTruncateTextWithTooltipWithSchema: () => DSTruncateTextWithTooltipWithSchema
46
+ });
47
+ var React = __toESM(require("react"));
48
+ var import_react = __toESM(require("react"));
49
+ var import_ds_tooltip = require("@elliemae/ds-tooltip");
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);
60
+ const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
61
+ const resizeObserver = (0, import_react.useMemo)(() => new ResizeObserver((entries) => {
62
+ if (entries.length) {
63
+ const [textWrapperEntry] = entries;
64
+ const el = textWrapperEntry.target;
65
+ setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);
66
+ }
67
+ }), []);
68
+ (0, import_react.useEffect)(() => {
69
+ if (textWrapperEl) {
70
+ setIsShowingEllipsis(textWrapperEl?.scrollWidth > textWrapperEl?.clientWidth);
71
+ resizeObserver.observe(textWrapperEl);
72
+ }
73
+ return () => {
74
+ if (textWrapperEl) {
75
+ resizeObserver.unobserve(textWrapperEl);
76
+ }
77
+ };
78
+ }, [resizeObserver, textWrapperEl]);
79
+ if (isShowingEllipsis)
80
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, __spreadValues({
81
+ text
82
+ }, tooltipProps), /* @__PURE__ */ import_react.default.createElement(import_styles.Text, {
83
+ ref: setTextWrapperEl,
84
+ tabIndex: 0,
85
+ "data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT
86
+ }, text));
87
+ return /* @__PURE__ */ import_react.default.createElement(import_styles.Text, {
88
+ ref: setTextWrapperEl,
89
+ "data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT
90
+ }, text);
91
+ };
92
+ const DSTruncateTextWithTooltipWithSchema = (0, import_ds_props_helpers.describe)(DSTruncateTextWithTooltip);
93
+ DSTruncateTextWithTooltipWithSchema.propTypes = import_propTypes.propTypes;
94
+ module.exports = __toCommonJS(DSTruncateTextWithTooltip_exports);
95
+ //# sourceMappingURL=DSTruncateTextWithTooltip.js.map