@elliemae/ds-truncated-tooltip-text 3.16.0-next.2 → 3.16.0-next.20
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 +13 -8
- package/dist/cjs/DSTruncatedTooltipText.js.map +2 -2
- package/dist/cjs/SimpleTruncatedTooltipText.js +8 -0
- package/dist/cjs/SimpleTruncatedTooltipText.js.map +1 -1
- package/dist/cjs/TooltipTextProvider.js +4 -0
- package/dist/cjs/TooltipTextProvider.js.map +1 -1
- package/dist/cjs/index.js +8 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +4 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +1 -1
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +12 -8
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/defaultProps.js +4 -0
- package/dist/cjs/truncateTextWithTooltip/defaultProps.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/index.js +6 -2
- package/dist/cjs/truncateTextWithTooltip/index.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/propTypes.js +7 -3
- package/dist/cjs/truncateTextWithTooltip/propTypes.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/styles.js +4 -0
- package/dist/cjs/truncateTextWithTooltip/styles.js.map +1 -1
- package/dist/esm/DSTruncatedTooltipText.js +3 -2
- package/dist/esm/DSTruncatedTooltipText.js.map +2 -2
- package/dist/esm/SimpleTruncatedTooltipText.js +4 -0
- package/dist/esm/SimpleTruncatedTooltipText.js.map +1 -1
- package/dist/esm/TooltipTextProvider.js.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +5 -5
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/defaultProps.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/index.js +2 -2
- package/dist/esm/truncateTextWithTooltip/index.js.map +1 -1
- package/dist/esm/truncateTextWithTooltip/propTypes.js +1 -1
- package/dist/esm/truncateTextWithTooltip/propTypes.js.map +2 -2
- package/dist/esm/truncateTextWithTooltip/styles.js.map +1 -1
- package/dist/types/DSTruncatedTooltipText.d.ts +7 -6
- package/dist/types/SimpleTruncatedTooltipText.d.ts +1 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/truncateTextWithTooltip/DSTruncateTextWithTooltip.d.ts +3 -2
- package/dist/types/truncateTextWithTooltip/defaultProps.d.ts +1 -1
- package/dist/types/truncateTextWithTooltip/index.d.ts +2 -2
- package/dist/types/truncateTextWithTooltip/propTypes.d.ts +2 -2
- package/dist/types/truncateTextWithTooltip/styles.d.ts +1 -0
- package/package.json +9 -8
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -32,10 +36,10 @@ module.exports = __toCommonJS(DSTruncatedTooltipText_exports);
|
|
32
36
|
var React = __toESM(require("react"));
|
33
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
34
38
|
var import_react = require("react");
|
35
|
-
var
|
39
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
36
40
|
var import_ds_system = require("@elliemae/ds-system");
|
37
41
|
var import_ds_popper = require("@elliemae/ds-popper");
|
38
|
-
var import_TooltipTextProvider = require("./TooltipTextProvider");
|
42
|
+
var import_TooltipTextProvider = require("./TooltipTextProvider.js");
|
39
43
|
const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
|
40
44
|
const Text = import_ds_system.styled.span`
|
41
45
|
text-overflow: ellipsis;
|
@@ -48,6 +52,7 @@ const DSTruncatedTooltipText = ({
|
|
48
52
|
containerProps = {},
|
49
53
|
value = "",
|
50
54
|
zIndex = 3e3,
|
55
|
+
// https://jira.elliemae.io/browse/PUI-1755 https://jira.elliemae.io/browse/PUI-8732
|
51
56
|
...otherTextProps
|
52
57
|
}) => {
|
53
58
|
const tooltipContext = (0, import_react.useContext)(import_TooltipTextProvider.TruncatedTooltipContext);
|
@@ -81,11 +86,11 @@ DSTruncatedTooltipText.defaultProps = {
|
|
81
86
|
zIndex: 110
|
82
87
|
};
|
83
88
|
const truncatedTooltipTextProps = {
|
84
|
-
containerProps:
|
85
|
-
value:
|
89
|
+
containerProps: import_ds_props_helpers.PropTypes.object.description("Set of Properties attached to the main container"),
|
90
|
+
value: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.string, import_ds_props_helpers.PropTypes.number]).description(
|
86
91
|
"Text that when truncated will trigger the tooltip interaction"
|
87
92
|
),
|
88
|
-
tooltipPlacement:
|
93
|
+
tooltipPlacement: import_ds_props_helpers.PropTypes.oneOf([
|
89
94
|
import_ds_popper.PopperPositions.AUTO_START,
|
90
95
|
import_ds_popper.PopperPositions.AUTO_END,
|
91
96
|
import_ds_popper.PopperPositions.AUTO,
|
@@ -102,8 +107,8 @@ const truncatedTooltipTextProps = {
|
|
102
107
|
import_ds_popper.PopperPositions.LEFT,
|
103
108
|
import_ds_popper.PopperPositions.LEFT_END
|
104
109
|
]).description("Position of the tooltip"),
|
105
|
-
tooltipDelay:
|
106
|
-
zIndex:
|
110
|
+
tooltipDelay: import_ds_props_helpers.PropTypes.number.description("Delay to show the tooltip"),
|
111
|
+
zIndex: import_ds_props_helpers.PropTypes.number.description("override default zIndex").defaultValue(110)
|
107
112
|
};
|
108
113
|
DSTruncatedTooltipText.defaultProps = {
|
109
114
|
containerProps: {},
|
@@ -113,7 +118,7 @@ DSTruncatedTooltipText.defaultProps = {
|
|
113
118
|
};
|
114
119
|
DSTruncatedTooltipText.propTypes = truncatedTooltipTextProps;
|
115
120
|
DSTruncatedTooltipText.displayName = "DSTruncatedTooltipText";
|
116
|
-
const TruncatedTooltipTextWithSchema = (0,
|
121
|
+
const TruncatedTooltipTextWithSchema = (0, import_ds_props_helpers.describe)(DSTruncatedTooltipText);
|
117
122
|
TruncatedTooltipTextWithSchema.propTypes = truncatedTooltipTextProps;
|
118
123
|
var DSTruncatedTooltipText_default = DSTruncatedTooltipText;
|
119
124
|
//# 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": "
|
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.js';\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;AAAA,EACT,GAAG;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,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
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -130,7 +134,9 @@ SimpleTruncatedTooltipText.propTypes = {
|
|
130
134
|
containerProps: import_prop_types.default.object,
|
131
135
|
tooltipOptions: import_prop_types.default.object,
|
132
136
|
textOptions: import_prop_types.default.object,
|
137
|
+
/** Text that when truncated will trigger the tooltip interaction */
|
133
138
|
value: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number, import_prop_types.default.node]),
|
139
|
+
/** Position of the tooltip */
|
134
140
|
placement: import_prop_types.default.oneOf([
|
135
141
|
import_ds_popover.PopperPositions.AUTO_START,
|
136
142
|
import_ds_popover.PopperPositions.AUTO_END,
|
@@ -148,7 +154,9 @@ SimpleTruncatedTooltipText.propTypes = {
|
|
148
154
|
import_ds_popover.PopperPositions.LEFT,
|
149
155
|
import_ds_popover.PopperPositions.LEFT_END
|
150
156
|
]),
|
157
|
+
/** Delay to show the tooltip */
|
151
158
|
tooltipDelay: import_prop_types.default.number,
|
159
|
+
/** override default zIndex */
|
152
160
|
zIndex: import_prop_types.default.number
|
153
161
|
};
|
154
162
|
SimpleTruncatedTooltipText.defaultProps = {
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/SimpleTruncatedTooltipText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useCallback, useContext, useMemo, useState } from 'react';\nimport { useCancellableDelayedCallback } from '@elliemae/ds-utilities';\nimport PropTypes from 'prop-types';\nimport { styled, ThemeContext } from '@elliemae/ds-system';\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 // 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 theme = useContext(ThemeContext);\n\n const PurePopover = useMemo(\n () => (\n <>\n {tooltipState.visible ? (\n <DSPopover\n boundaries=\"window\"\n style={{ pointerEvents: 'none', zIndex: zIndex ?? theme.zIndex.tooltip }}\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};\n\nexport { SimpleTruncatedTooltipText };\nexport default SimpleTruncatedTooltipText;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8EjB;AA7EN,mBAAkE;AAClE,0BAA8C;AAC9C,wBAAsB;AACtB,uBAAqC;AACrC,wBAAwD;AAExD,MAAM,WAAW;AAEjB,MAAM,mBAAmB,CAAC,EAAE,aAAa,YAAY,MAAM,cAAc;AAEzE,MAAM,sBAAsB,CAAC,QAAQ,IAAI,UAAU,CAAC,OAAO;AAAA,EACzD,WAAW;AAAA,EACX,SAAS;AAAA,EACT;AAAA,EACA;AACF;AAEA,MAAM,OAAO,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,6BAA6B,CAAC,UAAU;AAC5C,QAAM,EAAE,gBAAgB,cAAc,WAAW,OAAO,QAAQ,gBAAgB,YAAY,IAAI;AAEhG,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,oBAAoB,OAAO,cAAc,CAAC;AAC3F,QAAM,WAAO;AAAA,IACX,CAAC,aAAa;AACZ,sBAAgB,EAAE,GAAG,cAAc,GAAG,UAAU,SAAS,KAAK,CAAC;AAAA,IACjE;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,kBAAc;AAAA,IAClB,CAAC,aAAa;AACZ,sBAAgB,EAAE,GAAG,cAAc,GAAG,UAAU,SAAS,MAAM,CAAC;AAAA,IAClE;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,CAAC,aAAa,iBAAiB,QAAI,mDAA8B,MAAM,YAAY;AAEzF,QAAM,uBAAmB;AAAA,IACvB,CAAC,MAAM;AACL,YAAM,EAAE,OAAO,IAAI;AAOnB,Y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A;AAAA,OACH;AAAA,IAEF,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA,SAAO;AACT;AAEA,2BAA2B,YAAY;AAAA,EACrC,gBAAgB,kBAAAA,QAAU;AAAA,EAC1B,gBAAgB,kBAAAA,QAAU;AAAA,EAC1B,aAAa,kBAAAA,QAAU;AAAA;AAAA,EAEvB,OAAO,kBAAAA,QAAU,UAAU,CAAC,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,IAAI,CAAC;AAAA;AAAA,EAE/E,WAAW,kBAAAA,QAAU,MAAM;AAAA,IACzB,kBAAAC,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,IACV,kBAAAA,gBAAU;AAAA,EACZ,CAAC;AAAA;AAAA,EAED,cAAc,kBAAAD,QAAU;AAAA;AAAA,EAExB,QAAQ,kBAAAA,QAAU;AACpB;AAEA,2BAA2B,eAAe;AAAA,EACxC,gBAAgB,CAAC;AAAA,EACjB,gBAAgB,CAAC;AAAA,EACjB,aAAa,CAAC;AAAA,EACd,OAAO;AAAA,EACP,WAAW,kBAAAC,gBAAU;AAAA,EACrB,cAAc;AAChB;AAGA,IAAO,qCAAQ;",
|
6
6
|
"names": ["PropTypes", "positions"]
|
7
7
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/TooltipTextProvider.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useMemo, useState } from 'react';\nimport { DSPopover, usePopoverProviderState } from '@elliemae/ds-popover';\n\nconst TruncatedTooltipContext = React.createContext();\n\nconst { Provider } = TruncatedTooltipContext;\n\nconst TooltipTextProvider = ({ children, tooltipDelay = 200, placement = 'top', ...tooltipOptions }) => {\n const {\n show: showTooltip,\n hide: hideTooltip,\n state: tooltipState,\n } = usePopoverProviderState({ delay: tooltipDelay });\n const [zIndex, setZIndex] = useState(110);\n\n const value = useMemo(\n () => ({\n showTooltip,\n hideTooltip,\n setZIndex,\n }),\n [],\n );\n\n return (\n <Provider value={value}>\n {children}\n {tooltipState.visible ? (\n <DSPopover\n boundaries=\"window\"\n placement={placement}\n showArrow\n {...tooltipOptions}\n {...(tooltipState.options || {})}\n content={tooltipState.value}\n referenceEl={tooltipState.reference}\n style={{ pointerEvents: 'none', zIndex }}\n visible={tooltipState.visible}\n />\n ) : null}\n </Provider>\n );\n};\n\nTooltipTextProvider.propTypes = {};\nTooltipTextProvider.defaultProps = {};\n\nexport { TooltipTextProvider, TruncatedTooltipContext };\nexport default TooltipTextProvider;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0BnB;AAzBJ,mBAAyC;AACzC,wBAAmD;AAEnD,MAAM,0BAA0B,aAAAA,QAAM,cAAc;AAEpD,MAAM,EAAE,SAAS,IAAI;AAErB,MAAM,sBAAsB,CAAC,EAAE,UAAU,eAAe,KAAK,YAAY,OAAO,GAAG,eAAe,MAAM;AACtG,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,EACT,QAAI,2CAAwB,EAAE,OAAO,aAAa,CAAC;AACnD,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,GAAG;AAExC,QAAM,YAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AAEA,SACE,6CAAC,YAAS,OACP;AAAA;AAAA,IACA,aAAa,UACZ;AAAA,MAAC;AAAA;AAAA,QACC,YAAW;AAAA,QACX;AAAA,QACA,WAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAI,aAAa,WAAW,CAAC;AAAA,QAC9B,SAAS,aAAa;AAAA,QACtB,aAAa,aAAa;AAAA,QAC1B,OAAO,EAAE,eAAe,QAAQ,OAAO;AAAA,QACvC,SAAS,aAAa;AAAA;AAAA,IACxB,IACE;AAAA,KACN;AAEJ;AAEA,oBAAoB,YAAY,CAAC;AACjC,oBAAoB,eAAe,CAAC;AAGpC,IAAO,8BAAQ;",
|
6
6
|
"names": ["React"]
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -36,8 +40,8 @@ __export(src_exports, {
|
|
36
40
|
});
|
37
41
|
module.exports = __toCommonJS(src_exports);
|
38
42
|
var React = __toESM(require("react"));
|
39
|
-
var import_TooltipTextProvider = require("./TooltipTextProvider");
|
40
|
-
var import_SimpleTruncatedTooltipText = require("./SimpleTruncatedTooltipText");
|
41
|
-
var import_DSTruncatedTooltipText = __toESM(require("./DSTruncatedTooltipText"));
|
42
|
-
var import_truncateTextWithTooltip = require("./truncateTextWithTooltip");
|
43
|
+
var import_TooltipTextProvider = require("./TooltipTextProvider.js");
|
44
|
+
var import_SimpleTruncatedTooltipText = require("./SimpleTruncatedTooltipText.js");
|
45
|
+
var import_DSTruncatedTooltipText = __toESM(require("./DSTruncatedTooltipText.js"));
|
46
|
+
var import_truncateTextWithTooltip = require("./truncateTextWithTooltip/index.js");
|
43
47
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';\nexport {\n DSTruncateTextWithTooltipDatatestid,\n DSTruncateTextWithTooltip,\n DSTruncateTextWithTooltipWithSchema,\n} from './truncateTextWithTooltip';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
4
|
+
"sourcesContent": ["export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider.js';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText.js';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText.js';\nexport {\n DSTruncateTextWithTooltipDatatestid,\n DSTruncateTextWithTooltip,\n DSTruncateTextWithTooltipWithSchema,\n} from './truncateTextWithTooltip/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAA6D;AAC7D,wCAA2C;AAC3C,oCAAgF;AAChF,qCAIO;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["export const DSTruncateTextWithTooltipDatatestid = {\n TEXT: 'ds-truncatetextwithtooltip-text',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,sCAAsC;AAAA,EACjD,MAAM;AACR;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -32,14 +36,14 @@ var React = __toESM(require("react"));
|
|
32
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
33
37
|
var import_react = require("react");
|
34
38
|
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
35
|
-
var
|
36
|
-
var import_defaultProps = require("./defaultProps");
|
37
|
-
var import_DSTruncateTextWIthTooltipDatatestid = require("./DSTruncateTextWIthTooltipDatatestid");
|
38
|
-
var import_propTypes = require("./propTypes");
|
39
|
-
var import_styles = require("./styles");
|
39
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
40
|
+
var import_defaultProps = require("./defaultProps.js");
|
41
|
+
var import_DSTruncateTextWIthTooltipDatatestid = require("./DSTruncateTextWIthTooltipDatatestid.js");
|
42
|
+
var import_propTypes = require("./propTypes.js");
|
43
|
+
var import_styles = require("./styles.js");
|
40
44
|
const DSTruncateTextWithTooltip = (props) => {
|
41
|
-
const propsWithDefault = (0,
|
42
|
-
(0,
|
45
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
|
46
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_propTypes.propTypes, "DSTruncateTextWithTooltip");
|
43
47
|
const { text, tooltipProps } = propsWithDefault;
|
44
48
|
const [textWrapperEl, setTextWrapperEl] = (0, import_react.useState)(null);
|
45
49
|
const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
|
@@ -68,6 +72,6 @@ const DSTruncateTextWithTooltip = (props) => {
|
|
68
72
|
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
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Text, { ref: setTextWrapperEl, "data-testid": import_DSTruncateTextWIthTooltipDatatestid.DSTruncateTextWithTooltipDatatestid.TEXT, children: text });
|
70
74
|
};
|
71
|
-
const DSTruncateTextWithTooltipWithSchema = (0,
|
75
|
+
const DSTruncateTextWithTooltipWithSchema = (0, import_ds_props_helpers.describe)(DSTruncateTextWithTooltip);
|
72
76
|
DSTruncateTextWithTooltipWithSchema.propTypes = import_propTypes.propTypes;
|
73
77
|
//# 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": "
|
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.js';\nimport { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid.js';\nimport { propTypes } from './propTypes.js';\nimport { Text } from './styles.js';\nimport type { DSTruncateTextWithTooltipT } from './propTypes.js';\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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,oCAAoC,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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": "
|
4
|
+
"sourcesContent": ["import type { DSTruncateTextWithTooltipT } from './propTypes.js';\n\nexport const defaultProps: DSTruncateTextWithTooltipT.DefaultProps = {\n tooltipProps: {},\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,eAAwD;AAAA,EACnE,cAAc,CAAC;AACjB;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
15
15
|
};
|
16
16
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
17
17
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
18
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
19
23
|
mod
|
20
24
|
));
|
@@ -22,6 +26,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
22
26
|
var truncateTextWithTooltip_exports = {};
|
23
27
|
module.exports = __toCommonJS(truncateTextWithTooltip_exports);
|
24
28
|
var React = __toESM(require("react"));
|
25
|
-
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWithTooltip"), module.exports);
|
26
|
-
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWIthTooltipDatatestid"), module.exports);
|
29
|
+
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWithTooltip.js"), module.exports);
|
30
|
+
__reExport(truncateTextWithTooltip_exports, require("./DSTruncateTextWIthTooltipDatatestid.js"), module.exports);
|
27
31
|
//# sourceMappingURL=index.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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": "
|
4
|
+
"sourcesContent": ["export * from './DSTruncateTextWithTooltip.js';\nexport * from './DSTruncateTextWIthTooltipDatatestid.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,4CAAc,2CAAd;AACA,4CAAc,qDADd;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -28,10 +32,10 @@ __export(propTypes_exports, {
|
|
28
32
|
});
|
29
33
|
module.exports = __toCommonJS(propTypes_exports);
|
30
34
|
var React = __toESM(require("react"));
|
31
|
-
var
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
32
36
|
const propTypes = {
|
33
|
-
text:
|
34
|
-
tooltipProps:
|
37
|
+
text: import_ds_props_helpers.PropTypes.string.description("Text to show.").isRequired,
|
38
|
+
tooltipProps: import_ds_props_helpers.PropTypes.object.description(
|
35
39
|
"This component uses DSTooltip component, you can set properties directly to this component with this property."
|
36
40
|
).defaultValue({})
|
37
41
|
};
|
@@ -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": "
|
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
|
}
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/truncateTextWithTooltip/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
4
|
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\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": "
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAGhB,MAAM,OAAO,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAST,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,10 +1,10 @@
|
|
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
|
-
import { TruncatedTooltipContext } from "./TooltipTextProvider";
|
7
|
+
import { TruncatedTooltipContext } from "./TooltipTextProvider.js";
|
8
8
|
const isEllipsisActive = ({ offsetWidth, scrollWidth }) => offsetWidth < scrollWidth;
|
9
9
|
const Text = styled.span`
|
10
10
|
text-overflow: ellipsis;
|
@@ -17,6 +17,7 @@ const DSTruncatedTooltipText = ({
|
|
17
17
|
containerProps = {},
|
18
18
|
value = "",
|
19
19
|
zIndex = 3e3,
|
20
|
+
// https://jira.elliemae.io/browse/PUI-1755 https://jira.elliemae.io/browse/PUI-8732
|
20
21
|
...otherTextProps
|
21
22
|
}) => {
|
22
23
|
const tooltipContext = useContext(TruncatedTooltipContext);
|
@@ -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-
|
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,
|
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.js';\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
|
+
"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,E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V,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
|
}
|
@@ -100,7 +100,9 @@ SimpleTruncatedTooltipText.propTypes = {
|
|
100
100
|
containerProps: PropTypes.object,
|
101
101
|
tooltipOptions: PropTypes.object,
|
102
102
|
textOptions: PropTypes.object,
|
103
|
+
/** Text that when truncated will trigger the tooltip interaction */
|
103
104
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
|
105
|
+
/** Position of the tooltip */
|
104
106
|
placement: PropTypes.oneOf([
|
105
107
|
positions.AUTO_START,
|
106
108
|
positions.AUTO_END,
|
@@ -118,7 +120,9 @@ SimpleTruncatedTooltipText.propTypes = {
|
|
118
120
|
positions.LEFT,
|
119
121
|
positions.LEFT_END
|
120
122
|
]),
|
123
|
+
/** Delay to show the tooltip */
|
121
124
|
tooltipDelay: PropTypes.number,
|
125
|
+
/** override default zIndex */
|
122
126
|
zIndex: PropTypes.number
|
123
127
|
};
|
124
128
|
SimpleTruncatedTooltipText.defaultProps = {
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/SimpleTruncatedTooltipText.tsx"],
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useCallback, useContext, useMemo, useState } from 'react';\nimport { useCancellableDelayedCallback } from '@elliemae/ds-utilities';\nimport PropTypes from 'prop-types';\nimport { styled, ThemeContext } from '@elliemae/ds-system';\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 // 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 theme = useContext(ThemeContext);\n\n const PurePopover = useMemo(\n () => (\n <>\n {tooltipState.visible ? (\n <DSPopover\n boundaries=\"window\"\n style={{ pointerEvents: 'none', zIndex: zIndex ?? theme.zIndex.tooltip }}\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};\n\nexport { SimpleTruncatedTooltipText };\nexport default SimpleTruncatedTooltipText;\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AC8EjB,mBAEI,KAgCJ,YAlCA;AA7EN,SAAgB,aAAa,YAAY,SAAS,gBAAgB;AAClE,SAAS,qCAAqC;AAC9C,OAAO,eAAe;AACtB,SAAS,QAAQ,oBAAoB;AACrC,SAAS,WAAW,mBAAmB,iBAAiB;AAExD,MAAM,WAAW;AAEjB,MAAM,mBAAmB,CAAC,EAAE,aAAa,YAAY,MAAM,cAAc;AAEzE,MAAM,sBAAsB,CAAC,QAAQ,IAAI,UAAU,CAAC,OAAO;AAAA,EACzD,WAAW;AAAA,EACX,SAAS;AAAA,EACT;AAAA,EACA;AACF;AAEA,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,MAAM,6BAA6B,CAAC,UAAU;AAC5C,QAAM,EAAE,gBAAgB,cAAc,WAAW,OAAO,QAAQ,gBAAgB,YAAY,IAAI;AAEhG,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,oBAAoB,OAAO,cAAc,CAAC;AAC3F,QAAM,OAAO;AAAA,IACX,CAAC,aAAa;AACZ,sBAAgB,EAAE,GAAG,cAAc,GAAG,UAAU,SAAS,KAAK,CAAC;AAAA,IACjE;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,cAAc;AAAA,IAClB,CAAC,aAAa;AACZ,sBAAgB,EAAE,GAAG,cAAc,GAAG,UAAU,SAAS,MAAM,CAAC;AAAA,IAClE;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,CA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A,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,EACZ,CAAC;AAAA;AAAA,EAED,cAAc,UAAU;AAAA;AAAA,EAExB,QAAQ,UAAU;AACpB;AAEA,2BAA2B,eAAe;AAAA,EACxC,gBAAgB,CAAC;AAAA,EACjB,gBAAgB,CAAC;AAAA,EACjB,aAAa,CAAC;AAAA,EACd,OAAO;AAAA,EACP,WAAW,UAAU;AAAA,EACrB,cAAc;AAChB;AAGA,IAAO,qCAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/TooltipTextProvider.tsx"],
|
4
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\nconst TooltipTextProvider = ({ children, tooltipDelay = 200, placement = 'top', ...tooltipOptions }) => {\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"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m/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
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";
|
2
|
+
import { TooltipTextProvider, TruncatedTooltipContext } from "./TooltipTextProvider.js";
|
3
|
+
import { SimpleTruncatedTooltipText } from "./SimpleTruncatedTooltipText.js";
|
4
|
+
import { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default as default2 } from "./DSTruncatedTooltipText.js";
|
5
5
|
import {
|
6
6
|
DSTruncateTextWithTooltipDatatestid,
|
7
7
|
DSTruncateTextWithTooltip,
|
8
8
|
DSTruncateTextWithTooltipWithSchema
|
9
|
-
} from "./truncateTextWithTooltip";
|
9
|
+
} from "./truncateTextWithTooltip/index.js";
|
10
10
|
export {
|
11
11
|
DSTruncateTextWithTooltip,
|
12
12
|
DSTruncateTextWithTooltipDatatestid,
|
package/dist/esm/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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 {\n DSTruncateTextWithTooltipDatatestid,\n DSTruncateTextWithTooltip,\n DSTruncateTextWithTooltipWithSchema,\n} from './truncateTextWithTooltip';\n"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider.js';\nexport { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText.js';\nexport { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText.js';\nexport {\n DSTruncateTextWithTooltipDatatestid,\n DSTruncateTextWithTooltip,\n DSTruncateTextWithTooltipWithSchema,\n} from './truncateTextWithTooltip/index.js';\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB,+BAA+B;AAC7D,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB,gCAAgC,WAAAA,gBAAe;AAChF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
6
6
|
"names": ["default"]
|
7
7
|
}
|
@@ -2,11 +2,11 @@ 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-
|
6
|
-
import { defaultProps } from "./defaultProps";
|
7
|
-
import { DSTruncateTextWithTooltipDatatestid } from "./DSTruncateTextWIthTooltipDatatestid";
|
8
|
-
import { propTypes } from "./propTypes";
|
9
|
-
import { Text } from "./styles";
|
5
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from "@elliemae/ds-props-helpers";
|
6
|
+
import { defaultProps } from "./defaultProps.js";
|
7
|
+
import { DSTruncateTextWithTooltipDatatestid } from "./DSTruncateTextWIthTooltipDatatestid.js";
|
8
|
+
import { propTypes } from "./propTypes.js";
|
9
|
+
import { Text } from "./styles.js";
|
10
10
|
const DSTruncateTextWithTooltip = (props) => {
|
11
11
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
12
12
|
useValidateTypescriptPropTypes(propsWithDefault, propTypes, "DSTruncateTextWithTooltip");
|
@@ -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.js';\nimport { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid.js';\nimport { propTypes } from './propTypes.js';\nimport { Text } from './styles.js';\nimport type { DSTruncateTextWithTooltipT } from './propTypes.js';\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,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/defaultProps.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSTruncateTextWithTooltipT } from './propTypes';\n\nexport const defaultProps: DSTruncateTextWithTooltipT.DefaultProps = {\n tooltipProps: {},\n};\n"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSTruncateTextWithTooltipT } from './propTypes.js';\n\nexport const defaultProps: DSTruncateTextWithTooltipT.DefaultProps = {\n tooltipProps: {},\n};\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACEhB,MAAM,eAAwD;AAAA,EACnE,cAAc,CAAC;AACjB;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
export * from "./DSTruncateTextWithTooltip";
|
3
|
-
export * from "./DSTruncateTextWIthTooltipDatatestid";
|
2
|
+
export * from "./DSTruncateTextWithTooltip.js";
|
3
|
+
export * from "./DSTruncateTextWIthTooltipDatatestid.js";
|
4
4
|
//# sourceMappingURL=index.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/index.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSTruncateTextWithTooltip';\nexport * from './DSTruncateTextWIthTooltipDatatestid';\n"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSTruncateTextWithTooltip.js';\nexport * from './DSTruncateTextWIthTooltipDatatestid.js';\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;",
|
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
|
}
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/styles.tsx"],
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\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"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAGhB,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAST,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;",
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAGhB,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAST,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
declare const DSTruncatedTooltipText: {
|
2
3
|
({ containerProps, value, zIndex, ...otherTextProps }: {
|
3
4
|
[x: string]: any;
|
@@ -19,15 +20,15 @@ declare const DSTruncatedTooltipText: {
|
|
19
20
|
zIndex?: undefined;
|
20
21
|
};
|
21
22
|
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-
|
23
|
+
containerProps: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
24
|
+
value: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
25
|
+
tooltipPlacement: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
26
|
+
tooltipDelay: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
27
|
+
zIndex: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
27
28
|
};
|
28
29
|
displayName: string;
|
29
30
|
};
|
30
|
-
declare const TruncatedTooltipTextWithSchema: import("@elliemae/ds-
|
31
|
+
declare const TruncatedTooltipTextWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<{
|
31
32
|
[x: string]: any;
|
32
33
|
containerProps?: {} | undefined;
|
33
34
|
value?: string | undefined;
|
package/dist/types/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider';
|
2
|
-
export { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText';
|
3
|
-
export { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText';
|
4
|
-
export { DSTruncateTextWithTooltipDatatestid, DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema, } from './truncateTextWithTooltip';
|
1
|
+
export { TooltipTextProvider, TruncatedTooltipContext } from './TooltipTextProvider.js';
|
2
|
+
export { SimpleTruncatedTooltipText } from './SimpleTruncatedTooltipText.js';
|
3
|
+
export { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema, default } from './DSTruncatedTooltipText.js';
|
4
|
+
export { DSTruncateTextWithTooltipDatatestid, DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema, } from './truncateTextWithTooltip/index.js';
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { DSTruncateTextWithTooltipT } from './propTypes.js';
|
2
3
|
declare const DSTruncateTextWithTooltip: (props: DSTruncateTextWithTooltipT.Props) => JSX.Element;
|
3
|
-
declare const DSTruncateTextWithTooltipWithSchema: import("@elliemae/ds-
|
4
|
+
declare const DSTruncateTextWithTooltipWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSTruncateTextWithTooltipT.Props>;
|
4
5
|
export { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import type { DSTruncateTextWithTooltipT } from './propTypes';
|
1
|
+
import type { DSTruncateTextWithTooltipT } from './propTypes.js';
|
2
2
|
export declare const defaultProps: DSTruncateTextWithTooltipT.DefaultProps;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './DSTruncateTextWithTooltip';
|
2
|
-
export * from './DSTruncateTextWIthTooltipDatatestid';
|
1
|
+
export * from './DSTruncateTextWithTooltip.js';
|
2
|
+
export * from './DSTruncateTextWIthTooltipDatatestid.js';
|
@@ -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.20",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Truncated Tooltip Text",
|
6
6
|
"files": [
|
@@ -52,14 +52,15 @@
|
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
54
|
"prop-types": "~15.8.1",
|
55
|
-
"@elliemae/ds-popover": "3.16.0-next.
|
56
|
-
"@elliemae/ds-popper": "3.16.0-next.
|
57
|
-
"@elliemae/ds-
|
58
|
-
"@elliemae/ds-
|
59
|
-
"@elliemae/ds-
|
55
|
+
"@elliemae/ds-popover": "3.16.0-next.20",
|
56
|
+
"@elliemae/ds-popper": "3.16.0-next.20",
|
57
|
+
"@elliemae/ds-props-helpers": "3.16.0-next.20",
|
58
|
+
"@elliemae/ds-system": "3.16.0-next.20",
|
59
|
+
"@elliemae/ds-tooltip": "3.16.0-next.20",
|
60
|
+
"@elliemae/ds-utilities": "3.16.0-next.20"
|
60
61
|
},
|
61
62
|
"devDependencies": {
|
62
|
-
"styled-components": "~5.3.
|
63
|
+
"styled-components": "~5.3.9"
|
63
64
|
},
|
64
65
|
"peerDependencies": {
|
65
66
|
"react": "^17.0.2",
|
@@ -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
|
}
|