@elliemae/ds-truncated-tooltip-text 3.16.0-next.1 → 3.16.0-next.3
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 +7 -7
- package/dist/cjs/DSTruncatedTooltipText.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +4 -4
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/propTypes.js +3 -3
- package/dist/cjs/truncateTextWithTooltip/propTypes.js.map +2 -2
- package/dist/esm/DSTruncatedTooltipText.js +1 -1
- package/dist/esm/DSTruncatedTooltipText.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +1 -1
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/propTypes.js +1 -1
- package/dist/esm/truncateTextWithTooltip/propTypes.js.map +2 -2
- package/dist/types/DSTruncatedTooltipText.d.ts +6 -6
- package/dist/types/truncateTextWithTooltip/DSTruncateTextWithTooltip.d.ts +1 -1
- package/dist/types/truncateTextWithTooltip/propTypes.d.ts +2 -2
- package/package.json +8 -7
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(DSTruncatedTooltipText_exports);
|
|
32
32
|
var React = __toESM(require("react"));
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
34
34
|
var import_react = require("react");
|
35
|
-
var
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
36
36
|
var import_ds_system = require("@elliemae/ds-system");
|
37
37
|
var import_ds_popper = require("@elliemae/ds-popper");
|
38
38
|
var import_TooltipTextProvider = require("./TooltipTextProvider");
|
@@ -81,11 +81,11 @@ DSTruncatedTooltipText.defaultProps = {
|
|
81
81
|
zIndex: 110
|
82
82
|
};
|
83
83
|
const truncatedTooltipTextProps = {
|
84
|
-
containerProps:
|
85
|
-
value:
|
84
|
+
containerProps: import_ds_props_helpers.PropTypes.object.description("Set of Properties attached to the main container"),
|
85
|
+
value: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.string, import_ds_props_helpers.PropTypes.number]).description(
|
86
86
|
"Text that when truncated will trigger the tooltip interaction"
|
87
87
|
),
|
88
|
-
tooltipPlacement:
|
88
|
+
tooltipPlacement: import_ds_props_helpers.PropTypes.oneOf([
|
89
89
|
import_ds_popper.PopperPositions.AUTO_START,
|
90
90
|
import_ds_popper.PopperPositions.AUTO_END,
|
91
91
|
import_ds_popper.PopperPositions.AUTO,
|
@@ -102,8 +102,8 @@ const truncatedTooltipTextProps = {
|
|
102
102
|
import_ds_popper.PopperPositions.LEFT,
|
103
103
|
import_ds_popper.PopperPositions.LEFT_END
|
104
104
|
]).description("Position of the tooltip"),
|
105
|
-
tooltipDelay:
|
106
|
-
zIndex:
|
105
|
+
tooltipDelay: import_ds_props_helpers.PropTypes.number.description("Delay to show the tooltip"),
|
106
|
+
zIndex: import_ds_props_helpers.PropTypes.number.description("override default zIndex").defaultValue(110)
|
107
107
|
};
|
108
108
|
DSTruncatedTooltipText.defaultProps = {
|
109
109
|
containerProps: {},
|
@@ -113,7 +113,7 @@ DSTruncatedTooltipText.defaultProps = {
|
|
113
113
|
};
|
114
114
|
DSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;
|
115
115
|
DSTruncatedTooltipText.displayName = "DSTruncatedTooltipText";
|
116
|
-
const TruncatedTooltipTextWithSchema = (0,
|
116
|
+
const TruncatedTooltipTextWithSchema = (0, import_ds_props_helpers.describe)(DSTruncatedTooltipText);
|
117
117
|
TruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;
|
118
118
|
var DSTruncatedTooltipText_default = DSTruncatedTooltipText;
|
119
119
|
//# sourceMappingURL=DSTruncatedTooltipText.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/DSTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["import React, { useContext, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmDnB;AAnDJ,mBAA6C;AAC7C,
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport { PopperPositions as positions } from '@elliemae/ds-popper';\nimport { TruncatedTooltipContext } from './TooltipTextProvider';\n\nconst isEllipsisActive = ({ offsetWidth, scrollWidth }) => 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 = 3000, // https://jira.elliemae.io/browse/PUI-1755 https://jira.elliemae.io/browse/PUI-8732\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 ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};\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('Set of Properties attached to the main container'),\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.description('override default zIndex').defaultValue(110),\n};\n\nDSTruncatedTooltipText.defaultProps = {\n containerProps: {},\n value: '',\n tooltipPlacement: undefined,\n tooltipDelay: undefined,\n};\n\nDSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;\nDSTruncatedTooltipText.displayName = 'DSTruncatedTooltipText';\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;AAAA;ACAA,YAAuB;ADmDnB;AAnDJ,mBAA6C;AAC7C,8BAAoC;AACpC,uBAAuB;AACvB,uBAA6C;AAC7C,iCAAwC;AAExC,MAAM,mBAAmB,CAAC,EAAE,aAAa,YAAY,MAAM,cAAc;AAGzE,MAAM,OAAO,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,yBAAyB,CAAC;AAAA,EAC9B,iBAAiB,CAAC;AAAA,EAClB,QAAQ;AAAA,EACR,SAAS;AAAA,KACN;AACL,MAAM;AACJ,QAAM,qBAAiB,yBAAW,kDAAuB;AACzD,8BAAU,MAAM;AACd,QAAI,UAAU;AAAgB,qBAAe,UAAU,MAAM;AAAA,EAC/D,GAAG,CAAC,MAAM,CAAC;AAEX,MAAI,CAAC;AAAgB,WAAO;AAE5B,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,QAAM,mBAAmB,CAAC,MAAM;AAC9B,UAAM,EAAE,OAAO,IAAI;AACnB,QAAI,UAAU,iBAAiB,QAAQ,OAAO,sBAAsB,CAAC,GAAG;AACtE;AAAA,QACE;AAAA,UACE;AAAA,UACA,WAAW;AAAA,QACb;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAAmB,CAAC,MAAM;AAC9B,gBAAY,EAAE,WAAW,EAAE,OAAO,CAAC;AAAA,EACrC;AAEA,QAAM,WAAW,cAAc,EAAE,cAAc,kBAAkB,cAAc,iBAAiB,IAAI,CAAC;AACrG,SACE,4CAAC,QAAM,GAAG,gBAAiB,GAAG,gBAAiB,GAAG,UAC/C,iBACH;AAEJ;AAEA,uBAAuB,eAAe;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,4BAA4B;AAAA,EAChC,gBAAgB,kCAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,OAAO,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,IAC/D;AAAA,EACF;AAAA,EACA,kBAAkB,kCAAU,MAAM;AAAA,IAChC,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,IACV,iBAAAA,gBAAU;AAAA,EACZ,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACxC,cAAc,kCAAU,OAAO,YAAY,2BAA2B;AAAA,EACtE,QAAQ,kCAAU,OAAO,YAAY,yBAAyB,EAAE,aAAa,GAAG;AAClF;AAEA,uBAAuB,eAAe;AAAA,EACpC,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAEA,uBAAuB,YAAY;AACnC,uBAAuB,cAAc;AACrC,MAAM,qCAAiC,kCAAS,sBAAsB;AACtE,+BAA+B,YAAY;AAG3C,IAAO,iCAAQ;",
|
6
6
|
"names": ["positions"]
|
7
7
|
}
|
@@ -32,14 +32,14 @@ var React = __toESM(require("react"));
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
33
33
|
var import_react = require("react");
|
34
34
|
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
35
|
-
var
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
36
36
|
var import_defaultProps = require("./defaultProps");
|
37
37
|
var import_DSTruncateTextWIthTooltipDatatestid = require("./DSTruncateTextWIthTooltipDatatestid");
|
38
38
|
var import_propTypes = require("./propTypes");
|
39
39
|
var import_styles = require("./styles");
|
40
40
|
const DSTruncateTextWithTooltip = (props) => {
|
41
|
-
const propsWithDefault = (0,
|
42
|
-
(0,
|
41
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
|
42
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_propTypes.propTypes, "DSTruncateTextWithTooltip");
|
43
43
|
const { text, tooltipProps } = propsWithDefault;
|
44
44
|
const [textWrapperEl, setTextWrapperEl] = (0, import_react.useState)(null);
|
45
45
|
const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
|
@@ -68,6 +68,6 @@ const DSTruncateTextWithTooltip = (props) => {
|
|
68
68
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip.DSTooltipV3, { text, ...tooltipProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Text, { ref: setTextWrapperEl, tabIndex: 0, "data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT, children: text }) });
|
69
69
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Text, { ref: setTextWrapperEl, "data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT, children: text });
|
70
70
|
};
|
71
|
-
const DSTruncateTextWithTooltipWithSchema = (0,
|
71
|
+
const DSTruncateTextWithTooltipWithSchema = (0, import_ds_props_helpers.describe)(DSTruncateTextWithTooltip);
|
72
72
|
DSTruncateTextWithTooltipWithSchema.propTypes = import_propTypes.propTypes;
|
73
73
|
//# sourceMappingURL=DSTruncateTextWithTooltip.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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-
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8Cf;AA9CR,mBAAoD;AACpD,wBAA4B;AAC5B,
|
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, 'DSTruncateTextWithTooltip');\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;AAAA;ACAA,YAAuB;AD8Cf;AA9CR,mBAAoD;AACpD,wBAA4B;AAC5B,8BAAuF;AACvF,0BAA6B;AAC7B,iDAAoD;AACpD,uBAA0B;AAC1B,oBAAqB;AAGrB,MAAM,4BAA4B,CAAC,UAAyD;AAC1F,QAAM,uBAAmB,sDAA+D,OAAO,gCAAY;AAE3G,8DAA+B,kBAAkB,4BAAW,2BAA2B;AAEvF,QAAM,EAAE,MAAM,aAAa,IAAI;AAE/B,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAiC,IAAI;AAC/E,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAAkB,KAAK;AAEzE,QAAM,qBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,UAAI,QAAQ,QAAQ;AAClB,cAAM,CAAC,gBAAgB,IAAI;AAC3B,cAAM,KAAK,iBAAiB;AAC5B,6BAAqB,IAAI,cAAc,IAAI,WAAW;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,8BAAU,MAAM;AACd,QAAI,eAAe;AACjB,2BAAqB,eAAe,cAAc,eAAe,WAAW;AAC5E,qBAAe,QAAQ,aAAa;AAAA,IACtC;AACA,WAAO,MAAM;AACX,UAAI,eAAe;AACjB,uBAAe,UAAU,aAAa;AAAA,MACxC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,gBAAgB,aAAa,CAAC;AAElC,MAAI;AACF,WACE,4CAAC,iCAAY,MAAa,GAAG,cAC3B,sDAAC,sBAAK,KAAK,kBAAkB,UAAU,GAAG,eAAa,+EAAoC,MACxF,gBACH,GACF;AAGJ,SACE,4CAAC,sBAAK,KAAK,kBAAkB,eAAa,+EAAoC,MAC3E,gBACH;AAEJ;AAEA,MAAM,0CAAsC,kCAA2C,yBAAyB;AAEhH,oCAAoC,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -28,10 +28,10 @@ __export(propTypes_exports, {
|
|
28
28
|
});
|
29
29
|
module.exports = __toCommonJS(propTypes_exports);
|
30
30
|
var React = __toESM(require("react"));
|
31
|
-
var
|
31
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
32
32
|
const propTypes = {
|
33
|
-
text:
|
34
|
-
tooltipProps:
|
33
|
+
text: import_ds_props_helpers.PropTypes.string.description("Text to show.").isRequired,
|
34
|
+
tooltipProps: import_ds_props_helpers.PropTypes.object.description(
|
35
35
|
"This component uses DSTooltip component, you can set properties directly to this component with this property."
|
36
36
|
).defaultValue({})
|
37
37
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/truncateTextWithTooltip/propTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable max-len */\nimport { PropTypes } from '@elliemae/ds-
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
4
|
+
"sourcesContent": ["/* eslint-disable max-len */\n\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;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;AAcnB,MAAM,YAAY;AAAA,EACvB,MAAM,kCAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACpD,cAAc,kCAAU,OACrB;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,CAAC;AACpB;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from "react";
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
3
3
|
import { useContext, useEffect } from "react";
|
4
|
-
import { describe, PropTypes } from "@elliemae/ds-
|
4
|
+
import { describe, PropTypes } from "@elliemae/ds-props-helpers";
|
5
5
|
import { styled } from "@elliemae/ds-system";
|
6
6
|
import { PopperPositions as positions } from "@elliemae/ds-popper";
|
7
7
|
import { TruncatedTooltipContext } from "./TooltipTextProvider";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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 '@elliemae/ds-
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport { PopperPositions as positions } from '@elliemae/ds-popper';\nimport { TruncatedTooltipContext } from './TooltipTextProvider';\n\nconst isEllipsisActive = ({ offsetWidth, scrollWidth }) => 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 = 3000, // https://jira.elliemae.io/browse/PUI-1755 https://jira.elliemae.io/browse/PUI-8732\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 ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave } : {};\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('Set of Properties attached to the main container'),\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.description('override default zIndex').defaultValue(110),\n};\n\nDSTruncatedTooltipText.defaultProps = {\n containerProps: {},\n value: '',\n tooltipPlacement: undefined,\n tooltipDelay: undefined,\n};\n\nDSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;\nDSTruncatedTooltipText.displayName = 'DSTruncatedTooltipText';\nconst TruncatedTooltipTextWithSchema = describe(DSTruncatedTooltipText);\nTruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;\n\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema };\nexport default DSTruncatedTooltipText;\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACmDnB;AAnDJ,SAAgB,YAAY,iBAAiB;AAC7C,SAAS,UAAU,iBAAiB;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB,iBAAiB;AAC7C,SAAS,+BAA+B;AAExC,MAAM,mBAAmB,CAAC,EAAE,aAAa,YAAY,MAAM,cAAc;AAGzE,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,yBAAyB,CAAC;AAAA,EAC9B,iBAAiB,CAAC;AAAA,EAClB,QAAQ;AAAA,EACR,SAAS;AAAA,KACN;AACL,MAAM;AACJ,QAAM,iBAAiB,WAAW,uBAAuB;AACzD,YAAU,MAAM;AACd,QAAI,UAAU;AAAgB,qBAAe,UAAU,MAAM;AAAA,EAC/D,GAAG,CAAC,MAAM,CAAC;AAEX,MAAI,CAAC;AAAgB,WAAO;AAE5B,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,QAAM,mBAAmB,CAAC,MAAM;AAC9B,UAAM,EAAE,OAAO,IAAI;AACnB,QAAI,UAAU,iBAAiB,QAAQ,OAAO,sBAAsB,CAAC,GAAG;AACtE;AAAA,QACE;AAAA,UACE;AAAA,UACA,WAAW;AAAA,QACb;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAAmB,CAAC,MAAM;AAC9B,gBAAY,EAAE,WAAW,EAAE,OAAO,CAAC;AAAA,EACrC;AAEA,QAAM,WAAW,cAAc,EAAE,cAAc,kBAAkB,cAAc,iBAAiB,IAAI,CAAC;AACrG,SACE,oBAAC,QAAM,GAAG,gBAAiB,GAAG,gBAAiB,GAAG,UAC/C,iBACH;AAEJ;AAEA,uBAAuB,eAAe;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,4BAA4B;AAAA,EAChC,gBAAgB,UAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE;AAAA,IAC/D;AAAA,EACF;AAAA,EACA,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,EACZ,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACxC,cAAc,UAAU,OAAO,YAAY,2BAA2B;AAAA,EACtE,QAAQ,UAAU,OAAO,YAAY,yBAAyB,EAAE,aAAa,GAAG;AAClF;AAEA,uBAAuB,eAAe;AAAA,EACpC,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAEA,uBAAuB,YAAY;AACnC,uBAAuB,cAAc;AACrC,MAAM,iCAAiC,SAAS,sBAAsB;AACtE,+BAA+B,YAAY;AAG3C,IAAO,iCAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
3
3
|
import { useState, useMemo, useEffect } from "react";
|
4
4
|
import { DSTooltipV3 } from "@elliemae/ds-tooltip";
|
5
|
-
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from "@elliemae/ds-
|
5
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from "@elliemae/ds-props-helpers";
|
6
6
|
import { defaultProps } from "./defaultProps";
|
7
7
|
import { DSTruncateTextWithTooltipDatatestid } from "./DSTruncateTextWIthTooltipDatatestid";
|
8
8
|
import { propTypes } from "./propTypes";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/DSTruncateTextWithTooltip.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useMemo, useEffect } from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from '@elliemae/ds-
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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, 'DSTruncateTextWithTooltip');\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"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;AC8Cf;AA9CR,SAAgB,UAAU,SAAS,iBAAiB;AACpD,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B,gCAAgC,gBAAgB;AACvF,SAAS,oBAAoB;AAC7B,SAAS,2CAA2C;AACpD,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAGrB,MAAM,4BAA4B,CAAC,UAAyD;AAC1F,QAAM,mBAAmB,6BAA+D,OAAO,YAAY;AAE3G,iCAA+B,kBAAkB,WAAW,2BAA2B;AAEvF,QAAM,EAAE,MAAM,aAAa,IAAI;AAE/B,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiC,IAAI;AAC/E,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAkB,KAAK;AAEzE,QAAM,iBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,UAAI,QAAQ,QAAQ;AAClB,cAAM,CAAC,gBAAgB,IAAI;AAC3B,cAAM,KAAK,iBAAiB;AAC5B,6BAAqB,IAAI,cAAc,IAAI,WAAW;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,YAAU,MAAM;AACd,QAAI,eAAe;AACjB,2BAAqB,eAAe,cAAc,eAAe,WAAW;AAC5E,qBAAe,QAAQ,aAAa;AAAA,IACtC;AACA,WAAO,MAAM;AACX,UAAI,eAAe;AACjB,uBAAe,UAAU,aAAa;AAAA,MACxC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,gBAAgB,aAAa,CAAC;AAElC,MAAI;AACF,WACE,oBAAC,eAAY,MAAa,GAAG,cAC3B,8BAAC,QAAK,KAAK,kBAAkB,UAAU,GAAG,eAAa,oCAAoC,MACxF,gBACH,GACF;AAGJ,SACE,oBAAC,QAAK,KAAK,kBAAkB,eAAa,oCAAoC,MAC3E,gBACH;AAEJ;AAEA,MAAM,sCAAsC,SAA2C,yBAAyB;AAEhH,oCAAoC,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
import { PropTypes } from "@elliemae/ds-
|
2
|
+
import { PropTypes } from "@elliemae/ds-props-helpers";
|
3
3
|
const propTypes = {
|
4
4
|
text: PropTypes.string.description("Text to show.").isRequired,
|
5
5
|
tooltipProps: PropTypes.object.description(
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/propTypes.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport { PropTypes } from '@elliemae/ds-
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\n\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"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AAcnB,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACpD,cAAc,UAAU,OACrB;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,CAAC;AACpB;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -19,15 +19,15 @@ declare const DSTruncatedTooltipText: {
|
|
19
19
|
zIndex?: undefined;
|
20
20
|
};
|
21
21
|
propTypes: {
|
22
|
-
containerProps: import("@elliemae/ds-
|
23
|
-
value: import("@elliemae/ds-
|
24
|
-
tooltipPlacement: import("@elliemae/ds-
|
25
|
-
tooltipDelay: import("@elliemae/ds-
|
26
|
-
zIndex: import("@elliemae/ds-
|
22
|
+
containerProps: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
23
|
+
value: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
24
|
+
tooltipPlacement: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
25
|
+
tooltipDelay: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
26
|
+
zIndex: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
27
27
|
};
|
28
28
|
displayName: string;
|
29
29
|
};
|
30
|
-
declare const TruncatedTooltipTextWithSchema: import("@elliemae/ds-
|
30
|
+
declare const TruncatedTooltipTextWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").DocumentedReactComponent<{
|
31
31
|
[x: string]: any;
|
32
32
|
containerProps?: {} | undefined;
|
33
33
|
value?: string | undefined;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { DSTruncateTextWithTooltipT } from './propTypes';
|
2
2
|
declare const DSTruncateTextWithTooltip: (props: DSTruncateTextWithTooltipT.Props) => JSX.Element;
|
3
|
-
declare const DSTruncateTextWithTooltipWithSchema: import("@elliemae/ds-
|
3
|
+
declare const DSTruncateTextWithTooltipWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").DocumentedReactComponent<DSTruncateTextWithTooltipT.Props>;
|
4
4
|
export { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema };
|
@@ -9,6 +9,6 @@ export declare namespace DSTruncateTextWithTooltipT {
|
|
9
9
|
}
|
10
10
|
}
|
11
11
|
export declare const propTypes: {
|
12
|
-
text: import("@elliemae/ds-
|
13
|
-
tooltipProps: import("@elliemae/ds-
|
12
|
+
text: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
13
|
+
tooltipProps: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
14
14
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-truncated-tooltip-text",
|
3
|
-
"version": "3.16.0-next.
|
3
|
+
"version": "3.16.0-next.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Truncated Tooltip Text",
|
6
6
|
"files": [
|
@@ -52,11 +52,12 @@
|
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
54
|
"prop-types": "~15.8.1",
|
55
|
-
"@elliemae/ds-popper": "3.16.0-next.
|
56
|
-
"@elliemae/ds-popover": "3.16.0-next.
|
57
|
-
"@elliemae/ds-system": "3.16.0-next.
|
58
|
-
"@elliemae/ds-tooltip": "3.16.0-next.
|
59
|
-
"@elliemae/ds-utilities": "3.16.0-next.
|
55
|
+
"@elliemae/ds-popper": "3.16.0-next.3",
|
56
|
+
"@elliemae/ds-popover": "3.16.0-next.3",
|
57
|
+
"@elliemae/ds-system": "3.16.0-next.3",
|
58
|
+
"@elliemae/ds-tooltip": "3.16.0-next.3",
|
59
|
+
"@elliemae/ds-utilities": "3.16.0-next.3",
|
60
|
+
"@elliemae/ds-props-helpers": "3.16.0-next.3"
|
60
61
|
},
|
61
62
|
"devDependencies": {
|
62
63
|
"styled-components": "~5.3.6"
|
@@ -77,7 +78,7 @@
|
|
77
78
|
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../.eslintrc.js' src/",
|
78
79
|
"dts": "node ../../scripts/dts.mjs",
|
79
80
|
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
80
|
-
"dev:build": "pnpm --filter {.}... build
|
81
|
+
"dev:build": "pnpm --filter {.}... build",
|
81
82
|
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
82
83
|
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
83
84
|
}
|