@elliemae/ds-truncated-tooltip-text 3.32.2-next.1 → 3.33.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSTruncatedTooltipText.js +124 -0
- package/dist/cjs/DSTruncatedTooltipText.js.map +7 -0
- package/dist/cjs/SimpleTruncatedTooltipText.js +171 -0
- package/dist/cjs/SimpleTruncatedTooltipText.js.map +7 -0
- package/dist/cjs/TooltipTextProvider.js +78 -0
- package/dist/cjs/TooltipTextProvider.js.map +7 -0
- package/dist/cjs/index.js +13 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +38 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +80 -0
- package/dist/cjs/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/index.js +43 -0
- package/dist/cjs/truncateTextWithTooltip/index.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/react-desc-prop-types.js +48 -0
- package/dist/cjs/truncateTextWithTooltip/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/styles.js +48 -0
- package/dist/cjs/truncateTextWithTooltip/styles.js.map +7 -0
- package/dist/cjs/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.js +72 -0
- package/dist/cjs/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.js.map +7 -0
- package/dist/esm/DSTruncatedTooltipText.js +94 -0
- package/dist/esm/DSTruncatedTooltipText.js.map +7 -0
- package/dist/esm/SimpleTruncatedTooltipText.js +141 -0
- package/dist/esm/SimpleTruncatedTooltipText.js.map +7 -0
- package/dist/esm/TooltipTextProvider.js +48 -0
- package/dist/esm/TooltipTextProvider.js.map +7 -0
- package/dist/esm/index.js +16 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js +8 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js +53 -0
- package/dist/esm/truncateTextWithTooltip/DSTruncateTextWithTooltip.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/index.js +17 -0
- package/dist/esm/truncateTextWithTooltip/index.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/react-desc-prop-types.js +18 -0
- package/dist/esm/truncateTextWithTooltip/react-desc-prop-types.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/styles.js +18 -0
- package/dist/esm/truncateTextWithTooltip/styles.js.map +7 -0
- package/dist/esm/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.js +49 -0
- package/dist/esm/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.js.map +7 -0
- package/dist/types/DSTruncatedTooltipText.d.ts +37 -0
- package/dist/types/SimpleTruncatedTooltipText.d.ts +36 -0
- package/dist/types/TooltipTextProvider.d.ts +14 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.d.ts +3 -0
- package/dist/types/truncateTextWithTooltip/DSTruncateTextWithTooltip.d.ts +4 -0
- package/dist/types/truncateTextWithTooltip/index.d.ts +3 -0
- package/dist/types/truncateTextWithTooltip/react-desc-prop-types.d.ts +19 -0
- package/dist/types/truncateTextWithTooltip/styles.d.ts +1 -0
- package/dist/types/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.d.ts +1 -0
- package/package.json +9 -3
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/DSTruncateTextWIthTooltipDatatestid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSTruncateTextWithTooltipDatatestid = {\n TEXT: 'ds-truncatetextwithtooltip-text',\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,sCAAsC;AAAA,EACjD,MAAM;AACR;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
3
|
+
import { useState, useMemo, useEffect } from "react";
|
4
|
+
import { DSTooltipV3 } from "@elliemae/ds-tooltip";
|
5
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, describe } from "@elliemae/ds-props-helpers";
|
6
|
+
import { DSTruncateTextWithTooltipDatatestid } from "./DSTruncateTextWIthTooltipDatatestid.js";
|
7
|
+
import { Text } from "./styles.js";
|
8
|
+
import {
|
9
|
+
DSTruncateTextWithTooltipPropTypesSchema,
|
10
|
+
defaultProps
|
11
|
+
} from "./react-desc-prop-types.js";
|
12
|
+
const DSTruncateTextWithTooltip = (props) => {
|
13
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
14
|
+
useValidateTypescriptPropTypes(
|
15
|
+
propsWithDefault,
|
16
|
+
DSTruncateTextWithTooltipPropTypesSchema,
|
17
|
+
"DSTruncateTextWithTooltip"
|
18
|
+
);
|
19
|
+
const { text, tooltipProps } = propsWithDefault;
|
20
|
+
const [textWrapperEl, setTextWrapperEl] = useState(null);
|
21
|
+
const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);
|
22
|
+
const resizeObserver = useMemo(
|
23
|
+
() => new ResizeObserver((entries) => {
|
24
|
+
if (entries.length) {
|
25
|
+
const [textWrapperEntry] = entries;
|
26
|
+
const el = textWrapperEntry.target;
|
27
|
+
setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);
|
28
|
+
}
|
29
|
+
}),
|
30
|
+
[]
|
31
|
+
);
|
32
|
+
useEffect(() => {
|
33
|
+
if (textWrapperEl) {
|
34
|
+
setIsShowingEllipsis(textWrapperEl?.scrollWidth > textWrapperEl?.clientWidth);
|
35
|
+
resizeObserver.observe(textWrapperEl);
|
36
|
+
}
|
37
|
+
return () => {
|
38
|
+
if (textWrapperEl) {
|
39
|
+
resizeObserver.unobserve(textWrapperEl);
|
40
|
+
}
|
41
|
+
};
|
42
|
+
}, [resizeObserver, textWrapperEl]);
|
43
|
+
if (isShowingEllipsis)
|
44
|
+
return /* @__PURE__ */ jsx(DSTooltipV3, { text, ...tooltipProps, children: /* @__PURE__ */ jsx(Text, { ref: setTextWrapperEl, tabIndex: 0, "data-testid": DSTruncateTextWithTooltipDatatestid.TEXT, children: text }) });
|
45
|
+
return /* @__PURE__ */ jsx(Text, { ref: setTextWrapperEl, "data-testid": DSTruncateTextWithTooltipDatatestid.TEXT, children: text });
|
46
|
+
};
|
47
|
+
const DSTruncateTextWithTooltipWithSchema = describe(DSTruncateTextWithTooltip);
|
48
|
+
DSTruncateTextWithTooltipWithSchema.propTypes = DSTruncateTextWithTooltipPropTypesSchema;
|
49
|
+
export {
|
50
|
+
DSTruncateTextWithTooltip,
|
51
|
+
DSTruncateTextWithTooltipWithSchema
|
52
|
+
};
|
53
|
+
//# sourceMappingURL=DSTruncateTextWithTooltip.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 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-props-helpers';\nimport { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid.js';\nimport { Text } from './styles.js';\nimport {\n type DSTruncateTextWithTooltipT,\n DSTruncateTextWithTooltipPropTypesSchema,\n defaultProps,\n} from './react-desc-prop-types.js';\n\nconst DSTruncateTextWithTooltip = (props: DSTruncateTextWithTooltipT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSTruncateTextWithTooltipT.InternalProps>(props, defaultProps);\n\n useValidateTypescriptPropTypes(\n propsWithDefault,\n DSTruncateTextWithTooltipPropTypesSchema,\n 'DSTruncateTextWithTooltip',\n );\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(DSTruncateTextWithTooltip);\n\nDSTruncateTextWithTooltipWithSchema.propTypes = DSTruncateTextWithTooltipPropTypesSchema;\n\nexport { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema };\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoDf;AApDR,SAAgB,UAAU,SAAS,iBAAiB;AACpD,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B,gCAAgC,gBAAgB;AACvF,SAAS,2CAA2C;AACpD,SAAS,YAAY;AACrB;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAEP,MAAM,4BAA4B,CAAC,UAAyD;AAC1F,QAAM,mBAAmB,6BAAuE,OAAO,YAAY;AAEnH;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,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,SAAS,yBAAyB;AAE9E,oCAAoC,YAAY;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema } from "./DSTruncateTextWithTooltip.js";
|
3
|
+
import { DSTruncateTextWithTooltipDatatestid } from "./DSTruncateTextWIthTooltipDatatestid.js";
|
4
|
+
import {
|
5
|
+
defaultProps,
|
6
|
+
DSTruncateTextWithTooltipPropTypes,
|
7
|
+
DSTruncateTextWithTooltipPropTypesSchema
|
8
|
+
} from "./react-desc-prop-types.js";
|
9
|
+
export {
|
10
|
+
DSTruncateTextWithTooltip,
|
11
|
+
DSTruncateTextWithTooltipDatatestid,
|
12
|
+
DSTruncateTextWithTooltipPropTypes,
|
13
|
+
DSTruncateTextWithTooltipPropTypesSchema,
|
14
|
+
DSTruncateTextWithTooltipWithSchema,
|
15
|
+
defaultProps
|
16
|
+
};
|
17
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/index.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema } from './DSTruncateTextWithTooltip.js';\nexport { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid.js';\nexport {\n type DSTruncateTextWithTooltipT,\n defaultProps,\n DSTruncateTextWithTooltipPropTypes,\n DSTruncateTextWithTooltipPropTypesSchema,\n} from './react-desc-prop-types.js';\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,2BAA2B,2CAA2C;AAC/E,SAAS,2CAA2C;AACpD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { PropTypes } from "@elliemae/ds-props-helpers";
|
3
|
+
const defaultProps = {
|
4
|
+
tooltipProps: {}
|
5
|
+
};
|
6
|
+
const DSTruncateTextWithTooltipPropTypes = {
|
7
|
+
text: PropTypes.string.description("Text to show.").isRequired,
|
8
|
+
tooltipProps: PropTypes.object.description(
|
9
|
+
"This component uses DSTooltip component, you can set properties directly to this component with this property."
|
10
|
+
).defaultValue({})
|
11
|
+
};
|
12
|
+
const DSTruncateTextWithTooltipPropTypesSchema = DSTruncateTextWithTooltipPropTypes;
|
13
|
+
export {
|
14
|
+
DSTruncateTextWithTooltipPropTypes,
|
15
|
+
DSTruncateTextWithTooltipPropTypesSchema,
|
16
|
+
defaultProps
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/react-desc-prop-types.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { WeakValidationMap } from 'react';\nimport type { DSPropTypesSchema } from '@elliemae/ds-utilities';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n// import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSTruncateTextWithTooltipT {\n export interface DefaultProps {\n tooltipProps: Record<string, unknown>;\n }\n export interface OptionalProps {}\n export interface RequiredProps {\n text: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSTruncateTextWithTooltipT.DefaultProps = {\n tooltipProps: {},\n};\n\nexport const DSTruncateTextWithTooltipPropTypes: DSPropTypesSchema<DSTruncateTextWithTooltipT.Props> = {\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\nexport const DSTruncateTextWithTooltipPropTypesSchema =\n DSTruncateTextWithTooltipPropTypes as unknown as WeakValidationMap<DSTruncateTextWithTooltipT.Props>;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,iBAAiB;AA2BnB,MAAM,eAAwD;AAAA,EACnE,cAAc,CAAC;AACjB;AAEO,MAAM,qCAA0F;AAAA,EACrG,MAAM,UAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACpD,cAAc,UAAU,OACrB;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,CAAC;AACpB;AAEO,MAAM,2CACX;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { styled } from "@elliemae/ds-system";
|
3
|
+
const Text = styled.span`
|
4
|
+
text-overflow: ellipsis;
|
5
|
+
white-space: nowrap;
|
6
|
+
overflow: hidden;
|
7
|
+
display: inline-block;
|
8
|
+
max-width: 100%;
|
9
|
+
&:focus {
|
10
|
+
border: none;
|
11
|
+
outline: none;
|
12
|
+
background: ${({ theme }) => theme.colors.brand[200]};
|
13
|
+
}
|
14
|
+
`;
|
15
|
+
export {
|
16
|
+
Text
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/truncateTextWithTooltip/styles.tsx"],
|
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,GAAG;AAAA;AAAA;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { DSTruncateTextWithTooltip } from "../index.js";
|
4
|
+
const testRequiredProps = {
|
5
|
+
text: "This is defined as just as string so this is fine for testing"
|
6
|
+
};
|
7
|
+
const testOptionalProps = {};
|
8
|
+
const testPartialDefaults = {
|
9
|
+
tooltipProps: {}
|
10
|
+
};
|
11
|
+
const testProps = {
|
12
|
+
...testRequiredProps,
|
13
|
+
...testOptionalProps,
|
14
|
+
...testPartialDefaults
|
15
|
+
};
|
16
|
+
const testPropsAsSyntax = {
|
17
|
+
...testRequiredProps,
|
18
|
+
...testOptionalProps,
|
19
|
+
...testPartialDefaults
|
20
|
+
};
|
21
|
+
const testCompleteDefaults = {
|
22
|
+
tooltipProps: {}
|
23
|
+
};
|
24
|
+
const testInternalProps = {
|
25
|
+
...testRequiredProps,
|
26
|
+
...testOptionalProps,
|
27
|
+
...testCompleteDefaults
|
28
|
+
};
|
29
|
+
const testInternalPropsAsSyntax = {
|
30
|
+
...testRequiredProps,
|
31
|
+
...testOptionalProps,
|
32
|
+
...testCompleteDefaults
|
33
|
+
};
|
34
|
+
const testExplicitDefinition = {
|
35
|
+
text: "This is defined as just as string so this is fine for testing"
|
36
|
+
};
|
37
|
+
const testInferedTypeCompatibility = {
|
38
|
+
text: "This is defined as just as string so this is fine for testing"
|
39
|
+
};
|
40
|
+
const testDefinitionAsConst = {
|
41
|
+
text: "This is defined as just as string so this is fine for testing"
|
42
|
+
};
|
43
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
44
|
+
/* @__PURE__ */ jsx(DSTruncateTextWithTooltip, { ...testExplicitDefinition }),
|
45
|
+
/* @__PURE__ */ jsx(DSTruncateTextWithTooltip, { ...testInferedTypeCompatibility }),
|
46
|
+
/* @__PURE__ */ jsx(DSTruncateTextWithTooltip, { ...testDefinitionAsConst }),
|
47
|
+
/* @__PURE__ */ jsx(DSTruncateTextWithTooltip, { text: "System Message" })
|
48
|
+
] });
|
49
|
+
//# sourceMappingURL=typescript-truncate-text-with-tooltip-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/truncateTextWithTooltip/typescript-testing/typescript-truncate-text-with-tooltip-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTruncateTextWithTooltip } from '../index.js';\nimport type { DSTruncateTextWithTooltipT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTruncateTextWithTooltipT.Props;\ntype ComponentPropsInternals = DSTruncateTextWithTooltipT.InternalProps;\ntype ComponentPropsDefaultProps = DSTruncateTextWithTooltipT.DefaultProps;\ntype ComponentPropsOptionalProps = DSTruncateTextWithTooltipT.OptionalProps;\ntype ComponentPropsRequiredProps = DSTruncateTextWithTooltipT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n text: 'This is defined as just as string so this is fine for testing',\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n tooltipProps: {},\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n tooltipProps: {},\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n text: 'This is defined as just as string so this is fine for testing',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n text: 'This is defined as just as string so this is fine for testing',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n text: 'This is defined as just as string so this is fine for testing',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSTruncateTextWithTooltip {...testExplicitDefinition} />\n <DSTruncateTextWithTooltip {...testInferedTypeCompatibility} />\n <DSTruncateTextWithTooltip {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSTruncateTextWithTooltip text=\"System Message\" />\n </>\n);\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6DrB,mBAEE,KAFF;AA5DF,SAAS,iCAAiC;AAU1C,MAAM,oBAAiD;AAAA,EACrD,MAAM;AACR;AACA,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,cAAc,CAAC;AACjB;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,cAAc,CAAC;AACjB;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM;AACR;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM;AACR;AAEA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AACR;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,6BAA2B,GAAG,wBAAwB;AAAA,EACvD,oBAAC,6BAA2B,GAAG,8BAA8B;AAAA,EAC7D,oBAAC,6BAA2B,GAAG,uBAAuB;AAAA,EAEtD,oBAAC,6BAA0B,MAAK,kBAAiB;AAAA,GACnD;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
declare const DSTruncatedTooltipText: {
|
2
|
+
({ containerProps, value, zIndex, ...otherTextProps }: {
|
3
|
+
[x: string]: any;
|
4
|
+
containerProps?: {} | undefined;
|
5
|
+
value?: string | undefined;
|
6
|
+
zIndex?: number | undefined;
|
7
|
+
}): string | import("react/jsx-runtime.js").JSX.Element;
|
8
|
+
defaultProps: {
|
9
|
+
value: string;
|
10
|
+
zIndex: number;
|
11
|
+
containerProps?: undefined;
|
12
|
+
tooltipPlacement?: undefined;
|
13
|
+
tooltipDelay?: undefined;
|
14
|
+
} | {
|
15
|
+
containerProps: {};
|
16
|
+
value: string;
|
17
|
+
tooltipPlacement: undefined;
|
18
|
+
tooltipDelay: undefined;
|
19
|
+
zIndex?: undefined;
|
20
|
+
};
|
21
|
+
propTypes: {
|
22
|
+
containerProps: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
23
|
+
value: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
24
|
+
tooltipPlacement: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
25
|
+
tooltipDelay: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
26
|
+
zIndex: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
27
|
+
};
|
28
|
+
displayName: string;
|
29
|
+
};
|
30
|
+
declare const TruncatedTooltipTextWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<{
|
31
|
+
[x: string]: any;
|
32
|
+
containerProps?: {} | undefined;
|
33
|
+
value?: string | undefined;
|
34
|
+
zIndex?: number | undefined;
|
35
|
+
}>;
|
36
|
+
export { DSTruncatedTooltipText, TruncatedTooltipTextWithSchema };
|
37
|
+
export default DSTruncatedTooltipText;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import PropTypes from 'prop-types';
|
2
|
+
interface SimpleTruncatedTooltipTextProps {
|
3
|
+
containerProps?: Record<string, unknown>;
|
4
|
+
tooltipDelay?: number;
|
5
|
+
placement?: string;
|
6
|
+
value?: string | JSX.Element;
|
7
|
+
zIndex?: number;
|
8
|
+
tooltipOptions?: Record<string, unknown>;
|
9
|
+
textOptions?: Record<string, unknown>;
|
10
|
+
}
|
11
|
+
declare const SimpleTruncatedTooltipText: {
|
12
|
+
(props: SimpleTruncatedTooltipTextProps): import("react/jsx-runtime").JSX.Element;
|
13
|
+
propTypes: {
|
14
|
+
containerProps: PropTypes.Requireable<object>;
|
15
|
+
tooltipOptions: PropTypes.Requireable<object>;
|
16
|
+
textOptions: PropTypes.Requireable<object>;
|
17
|
+
/** Text that when truncated will trigger the tooltip interaction */
|
18
|
+
value: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
19
|
+
/** Position of the tooltip */
|
20
|
+
placement: PropTypes.Requireable<string>;
|
21
|
+
/** Delay to show the tooltip */
|
22
|
+
tooltipDelay: PropTypes.Requireable<number>;
|
23
|
+
/** override default zIndex */
|
24
|
+
zIndex: PropTypes.Requireable<number>;
|
25
|
+
};
|
26
|
+
defaultProps: {
|
27
|
+
containerProps: {};
|
28
|
+
tooltipOptions: {};
|
29
|
+
textOptions: {};
|
30
|
+
value: string;
|
31
|
+
placement: string;
|
32
|
+
tooltipDelay: number;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export { SimpleTruncatedTooltipText };
|
36
|
+
export default SimpleTruncatedTooltipText;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const TruncatedTooltipContext: React.Context<unknown>;
|
3
|
+
declare const TooltipTextProvider: {
|
4
|
+
({ children, tooltipDelay, placement, ...tooltipOptions }: {
|
5
|
+
[x: string]: any;
|
6
|
+
children: any;
|
7
|
+
tooltipDelay?: number | undefined;
|
8
|
+
placement?: string | undefined;
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
10
|
+
propTypes: {};
|
11
|
+
defaultProps: {};
|
12
|
+
};
|
13
|
+
export { TooltipTextProvider, TruncatedTooltipContext };
|
14
|
+
export default TooltipTextProvider;
|
package/dist/types/index.d.ts
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
export
|
2
|
-
export {
|
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';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { type DSTruncateTextWithTooltipT } from './react-desc-prop-types.js';
|
2
|
+
declare const DSTruncateTextWithTooltip: (props: DSTruncateTextWithTooltipT.Props) => JSX.Element;
|
3
|
+
declare const DSTruncateTextWithTooltipWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSTruncateTextWithTooltipT.Props>;
|
4
|
+
export { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema };
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export { DSTruncateTextWithTooltip, DSTruncateTextWithTooltipWithSchema } from './DSTruncateTextWithTooltip.js';
|
2
|
+
export { DSTruncateTextWithTooltipDatatestid } from './DSTruncateTextWIthTooltipDatatestid.js';
|
3
|
+
export { type DSTruncateTextWithTooltipT, defaultProps, DSTruncateTextWithTooltipPropTypes, DSTruncateTextWithTooltipPropTypesSchema, } from './react-desc-prop-types.js';
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { WeakValidationMap } from 'react';
|
2
|
+
import type { DSPropTypesSchema } from '@elliemae/ds-utilities';
|
3
|
+
export declare namespace DSTruncateTextWithTooltipT {
|
4
|
+
interface DefaultProps {
|
5
|
+
tooltipProps: Record<string, unknown>;
|
6
|
+
}
|
7
|
+
interface OptionalProps {
|
8
|
+
}
|
9
|
+
interface RequiredProps {
|
10
|
+
text: string;
|
11
|
+
}
|
12
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
|
13
|
+
}
|
14
|
+
interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {
|
15
|
+
}
|
16
|
+
}
|
17
|
+
export declare const defaultProps: DSTruncateTextWithTooltipT.DefaultProps;
|
18
|
+
export declare const DSTruncateTextWithTooltipPropTypes: DSPropTypesSchema<DSTruncateTextWithTooltipT.Props>;
|
19
|
+
export declare const DSTruncateTextWithTooltipPropTypesSchema: WeakValidationMap<DSTruncateTextWithTooltipT.Props>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const Text: import("styled-components").StyledComponent<"span", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"span">, never>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-truncated-tooltip-text",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.33.0-next.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Truncated Tooltip Text",
|
6
6
|
"files": [
|
@@ -35,12 +35,18 @@
|
|
35
35
|
"indent": 4
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"
|
38
|
+
"prop-types": "~15.8.1",
|
39
|
+
"@elliemae/ds-popper": "3.33.0-next.1",
|
40
|
+
"@elliemae/ds-tooltip": "3.33.0-next.1",
|
41
|
+
"@elliemae/ds-props-helpers": "3.33.0-next.1",
|
42
|
+
"@elliemae/ds-system": "3.33.0-next.1",
|
43
|
+
"@elliemae/ds-utilities": "3.33.0-next.1",
|
44
|
+
"@elliemae/ds-popover": "3.33.0-next.1"
|
39
45
|
},
|
40
46
|
"devDependencies": {
|
41
47
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
42
48
|
"styled-components": "~5.3.9",
|
43
|
-
"@elliemae/ds-monorepo-devops": "3.
|
49
|
+
"@elliemae/ds-monorepo-devops": "3.33.0-next.1"
|
44
50
|
},
|
45
51
|
"peerDependencies": {
|
46
52
|
"react": "^17.0.2",
|