@elliemae/ds-tooltip-v3 3.53.1-rc.0 → 3.54.0-beta.2
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/DSTooltipV3.js +11 -6
- package/dist/cjs/DSTooltipV3.js.map +2 -2
- package/dist/cjs/TooltipV3DatatestId.js +2 -1
- package/dist/cjs/TooltipV3DatatestId.js.map +2 -2
- package/dist/cjs/{tests/controlled/ControlledTestRenderer.js → config/useTooltipV3.js} +30 -18
- package/dist/cjs/config/useTooltipV3.js.map +7 -0
- package/dist/cjs/{tests/uncontrolled/UncontrolledTooltipTestRender.js → config/useValidateProps.js} +10 -13
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/package.json +4 -1
- package/dist/cjs/react-desc-prop-types.js +14 -10
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js +32 -31
- package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
- package/dist/esm/DSTooltipV3.js +13 -8
- package/dist/esm/DSTooltipV3.js.map +2 -2
- package/dist/esm/TooltipV3DatatestId.js +2 -1
- package/dist/esm/TooltipV3DatatestId.js.map +2 -2
- package/dist/esm/config/useTooltipV3.js +31 -0
- package/dist/esm/config/useTooltipV3.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +10 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/package.json +4 -1
- package/dist/esm/react-desc-prop-types.js +14 -10
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js +32 -31
- package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
- package/dist/types/TooltipV3DatatestId.d.ts +1 -0
- package/dist/types/config/useTooltipV3.d.ts +12 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +8 -11
- package/dist/types/tests/DSTooltipV3.TextComponentProp.test.d.ts +1 -0
- package/dist/types/tests/DSTooltipV3.validatePropIsStable.test.d.ts +1 -0
- package/dist/types/tests/DSTooltipv3.showPopover.test.d.ts +1 -0
- package/dist/types/tests/custom-text-component/CustomTextTooltipTestRender.d.ts +1 -0
- package/dist/types/tests/custom-text-component/DSTooltipV3.custom-text-component.test.playwright.d.ts +1 -0
- package/package.json +11 -10
- package/dist/cjs/tests/controlled/ControlledTestRenderer.js.map +0 -7
- package/dist/cjs/tests/controlled/DSTooltipV3.controlled.test.playwright.js +0 -69
- package/dist/cjs/tests/controlled/DSTooltipV3.controlled.test.playwright.js.map +0 -7
- package/dist/cjs/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js +0 -69
- package/dist/cjs/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js.map +0 -7
- package/dist/cjs/tests/uncontrolled/UncontrolledTooltipTestRender.js.map +0 -7
- package/dist/esm/tests/controlled/ControlledTestRenderer.js +0 -19
- package/dist/esm/tests/controlled/ControlledTestRenderer.js.map +0 -7
- package/dist/esm/tests/controlled/DSTooltipV3.controlled.test.playwright.js +0 -46
- package/dist/esm/tests/controlled/DSTooltipV3.controlled.test.playwright.js.map +0 -7
- package/dist/esm/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js +0 -46
- package/dist/esm/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js.map +0 -7
- package/dist/esm/tests/uncontrolled/UncontrolledTooltipTestRender.js +0 -13
- package/dist/esm/tests/uncontrolled/UncontrolledTooltipTestRender.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSTooltipV3.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { useFloatingContext, PopoverArrow, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { useFloatingContext, PopoverArrow, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSTooltipV3PropTypesSchema } from './react-desc-prop-types.js';\nimport { TooltipV3DatatestId } from './TooltipV3DatatestId.js';\nimport {\n StyledTooltipContainer,\n StyledTooltipText,\n StyledMouseOverDetectionBox,\n StyledTriggerWrapper,\n} from './styles.js';\nimport type { DSTooltipV3T } from './react-desc-prop-types.js';\nimport { useTooltipV3 } from './config/useTooltipV3.js';\nimport { DSTooltipV3Name } from './constants.js';\n\nconst DSTooltipV3: React.ComponentType<DSTooltipV3T.Props> = (props) => {\n const { propsWithDefault } = useTooltipV3(props);\n\n const {\n text,\n startPlacementPreference,\n children,\n onOpen,\n onClose,\n id,\n textAlign,\n wrapWords,\n withoutArrow,\n customOffset,\n animationDuration,\n withoutAnimation,\n withoutPortal,\n portalDOMContainer,\n applyTooltipOverflowWrap,\n showPopover,\n Text,\n textProps,\n } = propsWithDefault;\n\n const { handlers, arrowStyles, floatingStyles, isOpen, refs, context } = useFloatingContext({\n placement: startPlacementPreference,\n customOffset,\n onOpen,\n onClose,\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n externallyControlledIsOpen: showPopover,\n });\n\n const isOpenSourceOfTruth = React.useMemo(() => {\n if (showPopover !== undefined) return showPopover;\n return isOpen;\n }, [showPopover, isOpen]);\n\n return (\n <StyledTriggerWrapper\n {...handlers}\n innerRef={refs.setReference}\n data-testid={`${TooltipV3DatatestId.TRIGGER_WRAPPER}${id !== '' ? `_${id}` : ''}`}\n >\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isOpenSourceOfTruth}\n floatingStyles={floatingStyles}\n context={context}\n >\n <StyledTooltipContainer data-testid={TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER}>\n {Text ? (\n <Text {...(textProps ?? {})} />\n ) : (\n <StyledTooltipText\n data-testid={TooltipV3DatatestId.OPINIONATED_TEXT_WRAPPER}\n textAlign={textAlign}\n wrapWords={wrapWords}\n $applyTooltipOverflowWrap={applyTooltipOverflowWrap}\n >\n {text}\n </StyledTooltipText>\n )}\n <StyledMouseOverDetectionBox />\n </StyledTooltipContainer>\n {!withoutArrow ? <PopoverArrow {...arrowStyles} /> : null}\n </FloatingWrapper>\n\n {children}\n </StyledTriggerWrapper>\n );\n};\n\nDSTooltipV3.displayName = DSTooltipV3Name;\nconst DSTooltipV3WithSchema = describe(DSTooltipV3);\nDSTooltipV3WithSchema.propTypes = DSTooltipV3PropTypesSchema;\n\nexport { DSTooltipV3, DSTooltipV3WithSchema };\n\nexport default DSTooltipV3;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqEf,SAEI,KAFJ;AApER,OAAOA,YAAW;AAClB,SAAS,oBAAoB,cAAc,uBAAuB;AAClE,SAAS,gBAAgB;AACzB,SAAS,kCAAkC;AAC3C,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,EAAE,iBAAiB,IAAI,aAAa,KAAK;AAE/C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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_WRAPPER: "ds-tooltip-v3-trigger-wrapper",
|
|
4
|
-
TOOLTIP_TEXT_WRAPPER: "ds-tooltip-v3-tooltip-text-wrapper"
|
|
4
|
+
TOOLTIP_TEXT_WRAPPER: "ds-tooltip-v3-tooltip-text-wrapper",
|
|
5
|
+
OPINIONATED_TEXT_WRAPPER: "ds-tooltip-v3-opinionated-text-wrapper"
|
|
5
6
|
};
|
|
6
7
|
export {
|
|
7
8
|
TooltipV3DatatestId
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/TooltipV3DatatestId.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const TooltipV3DatatestId = {\n TRIGGER_WRAPPER: 'ds-tooltip-v3-trigger-wrapper',\n TOOLTIP_TEXT_WRAPPER: 'ds-tooltip-v3-tooltip-text-wrapper',\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,sBAAsB;AAAA,EACjC,iBAAiB;AAAA,EACjB,sBAAsB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const TooltipV3DatatestId = {\n TRIGGER_WRAPPER: 'ds-tooltip-v3-trigger-wrapper',\n TOOLTIP_TEXT_WRAPPER: 'ds-tooltip-v3-tooltip-text-wrapper',\n OPINIONATED_TEXT_WRAPPER: 'ds-tooltip-v3-opinionated-text-wrapper',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,sBAAsB;AAAA,EACjC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,0BAA0B;AAC5B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { uid } from "uid";
|
|
5
|
+
import { DSTooltipV3PropTypes } from "../react-desc-prop-types.js";
|
|
6
|
+
import { defaultProps } from "../defaultProps.js";
|
|
7
|
+
import { useValidateProps } from "./useValidateProps.js";
|
|
8
|
+
const useTooltipV3 = (propsFromUser) => {
|
|
9
|
+
const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
|
|
10
|
+
useValidateProps(propsWithDefault, DSTooltipV3PropTypes);
|
|
11
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
12
|
+
const instanceUid = React2.useMemo(() => `ds-tooltip-v3-${uid(5)}`, []);
|
|
13
|
+
return React2.useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
propsWithDefault,
|
|
16
|
+
xstyledProps,
|
|
17
|
+
instanceUid
|
|
18
|
+
// ...eventHandlers,
|
|
19
|
+
}),
|
|
20
|
+
[
|
|
21
|
+
propsWithDefault,
|
|
22
|
+
xstyledProps,
|
|
23
|
+
instanceUid
|
|
24
|
+
// eventHandlers,
|
|
25
|
+
]
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
useTooltipV3
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useTooltipV3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTooltipV3.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSTooltipV3T, DSTooltipV3PropTypes } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../defaultProps.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface Tooltipv3CTX {\n propsWithDefault: DSTooltipV3T.InternalProps;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useTooltipV3 = (propsFromUser: DSTooltipV3T.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSTooltipV3T.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSTooltipV3PropTypes);\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const instanceUid = React.useMemo(() => `ds-tooltip-v3-${uid(5)}`, []);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // eventHandlers,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,WAAW;AACpB,SAA4B,4BAA4B;AACxD,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAQ1B,MAAM,eAAe,CAAC,kBAAsC;AAIjE,QAAM,mBAAmB,6BAAyD,eAAe,YAAY;AAC7G,mBAAiB,kBAAkB,oBAAoB;AAIvD,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,cAAcA,OAAM,QAAQ,MAAM,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAMrE,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSTooltipV3Name } from "../constants.js";
|
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSTooltipV3Name);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useValidateProps
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSTooltipV3T } from '../react-desc-prop-types.js';\nimport { DSTooltipV3Name } from '../constants.js';\n\nexport const useValidateProps = (props: DSTooltipV3T.InternalProps, propTypes: ValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSTooltipV3Name);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,uBAAuB;AAEzB,MAAM,mBAAmB,CAAC,OAAmC,cAA4C;AAE9G,iCAA+B,OAAO,WAAW,eAAe;AAClE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/constants.js
CHANGED
|
@@ -14,6 +14,7 @@ const PLACEMENT = [
|
|
|
14
14
|
"left-start"
|
|
15
15
|
];
|
|
16
16
|
const TEXT_ALIGNMENT = ["left", "right", "center", "justify", "initial", "inherit"];
|
|
17
|
+
const DSTooltipV3Name = "DSTooltipV3";
|
|
17
18
|
const tooltipPositions = {
|
|
18
19
|
TOP: "top",
|
|
19
20
|
BOTTOM: "bottom",
|
|
@@ -29,6 +30,7 @@ const tooltipPositions = {
|
|
|
29
30
|
LEFT_END: "left-end"
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
33
|
+
DSTooltipV3Name,
|
|
32
34
|
PLACEMENT,
|
|
33
35
|
TEXT_ALIGNMENT,
|
|
34
36
|
tooltipPositions
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/constants.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const PLACEMENT = [\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n\nexport const TEXT_ALIGNMENT = ['left', 'right', 'center', 'justify', 'initial', 'inherit'];\n\n// many stories where using this from ds-tooltip.\n// we need to preserve this format to avoid breaking changes.\nconst tooltipPositions = {\n TOP: 'top' as const,\n BOTTOM: 'bottom' as const,\n RIGHT: 'right' as const,\n LEFT: 'left' as const,\n TOP_START: 'top-start' as const,\n TOP_END: 'top-end' as const,\n BOTTOM_START: 'bottom-start' as const,\n BOTTOM_END: 'bottom-end' as const,\n RIGHT_START: 'right-start' as const,\n RIGHT_END: 'right-end' as const,\n LEFT_START: 'left-start' as const,\n LEFT_END: 'left-end' as const,\n};\n\nexport { tooltipPositions };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,iBAAiB,CAAC,QAAQ,SAAS,UAAU,WAAW,WAAW,SAAS;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const PLACEMENT = [\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n\nexport const TEXT_ALIGNMENT = ['left', 'right', 'center', 'justify', 'initial', 'inherit'];\n\nexport const DSTooltipV3Name = 'DSTooltipV3';\n\n// many stories where using this from ds-tooltip.\n// we need to preserve this format to avoid breaking changes.\nconst tooltipPositions = {\n TOP: 'top' as const,\n BOTTOM: 'bottom' as const,\n RIGHT: 'right' as const,\n LEFT: 'left' as const,\n TOP_START: 'top-start' as const,\n TOP_END: 'top-end' as const,\n BOTTOM_START: 'bottom-start' as const,\n BOTTOM_END: 'bottom-end' as const,\n RIGHT_START: 'right-start' as const,\n RIGHT_END: 'right-end' as const,\n LEFT_START: 'left-start' as const,\n LEFT_END: 'left-end' as const,\n};\n\nexport { tooltipPositions };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,iBAAiB,CAAC,QAAQ,SAAS,UAAU,WAAW,WAAW,SAAS;AAElF,MAAM,kBAAkB;AAI/B,MAAM,mBAAmB;AAAA,EACvB,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AACZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PropTypes } from "@elliemae/ds-props-helpers";
|
|
3
3
|
import { PLACEMENT, TEXT_ALIGNMENT } from "./constants.js";
|
|
4
|
-
const
|
|
5
|
-
text: PropTypes.string.description(
|
|
4
|
+
const DSTooltipV3PropTypes = {
|
|
5
|
+
text: PropTypes.string.description(
|
|
6
|
+
"Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence."
|
|
7
|
+
).isRequiredIf((props) => !props.Text),
|
|
6
8
|
textAlign: PropTypes.oneOf(TEXT_ALIGNMENT).description("Tooltip text alignment").defaultValue("left"),
|
|
7
9
|
applyTooltipOverflowWrap: PropTypes.bool.description(
|
|
8
10
|
"when a tooltip is present, the tooltip text may be too long to fit in the pill. If true, the tooltip will wrap to the next line using overflow-wrap"
|
|
@@ -11,23 +13,25 @@ const propTypes = {
|
|
|
11
13
|
children: PropTypes.node.description("Element to tie the tooltip to, must be a single node").isRequired,
|
|
12
14
|
withoutPortal: PropTypes.bool.description("Whether or not the tooltip content should appear in a DOM portal or not").defaultValue(true),
|
|
13
15
|
withoutArrow: PropTypes.bool.description("Whether or not the tooltip should use the arrow").defaultValue(false),
|
|
14
|
-
boundaryElement: PropTypes.element.description(
|
|
15
|
-
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
16
|
-
).defaultValue(void 0),
|
|
17
16
|
withoutAnimation: PropTypes.bool.description("Whether or not the popper context menu should be animated").defaultValue(false),
|
|
18
17
|
animationDuration: PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
|
|
19
18
|
portalDOMContainer: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
|
|
20
19
|
startPlacementPreference: PropTypes.oneOf(PLACEMENT).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
21
|
-
placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(PLACEMENT)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
22
|
-
zIndex: PropTypes.number.description("popperjs content z-index").defaultValue(1),
|
|
23
20
|
customOffset: PropTypes.arrayOf(PropTypes.number).description("placement offset array").defaultValue([0, 14]),
|
|
24
|
-
modifiers: PropTypes.array.description("modifiers array for full-custom tooltip-js override, https://popper.js.org/docs/v2/modifiers/").defaultValue(1),
|
|
25
21
|
id: PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
|
|
26
22
|
onOpen: PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
|
|
27
23
|
onClose: PropTypes.func.description("Optional callback to be invoked when the tooltip closes").defaultValue("() => {}"),
|
|
28
|
-
showPopover: PropTypes.bool.description("Whether or not the tooltip should be always shown")
|
|
24
|
+
showPopover: PropTypes.bool.description("Whether or not the tooltip should be always shown"),
|
|
25
|
+
Text: PropTypes.func.description(
|
|
26
|
+
"Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence."
|
|
27
|
+
).isRequiredIf((props) => !props.text),
|
|
28
|
+
textProps: PropTypes.object.description(
|
|
29
|
+
"Props to be passed to the custom Text component, if provided, used mainly to avoiding inline components definition to improve performance"
|
|
30
|
+
)
|
|
29
31
|
};
|
|
32
|
+
const DSTooltipV3PropTypesSchema = DSTooltipV3PropTypes;
|
|
30
33
|
export {
|
|
31
|
-
|
|
34
|
+
DSTooltipV3PropTypes,
|
|
35
|
+
DSTooltipV3PropTypesSchema
|
|
32
36
|
};
|
|
33
37
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { PLACEMENT, TEXT_ALIGNMENT } from './constants.js';\n\nexport declare namespace DSTooltipV3T {\n export type Placement =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';\n\n export interface DefaultProps {\n onOpen: () => void;\n onClose: () => void;\n id: string;\n textAlign: TextAlignment;\n wrapWords: boolean;\n startPlacementPreference: Placement;\n applyTooltipOverflowWrap: boolean;\n customOffset?: [number, number];\n }\n\n export interface OptionalProps {\n withoutPortal?: boolean;\n withoutArrow?: boolean;\n withoutAnimation?: boolean;\n animationDuration?: number;\n portalDOMContainer?: HTMLElement;\n showPopover?: boolean;\n Text?: React.ComponentType<Record<string, unknown>>;\n textProps?: Record<string, unknown>;\n text?: string;\n }\n\n export interface RequiredProps {\n children: React.ReactNode;\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 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\nexport const DSTooltipV3PropTypes: DSPropTypesSchema<DSTooltipV3T.Props> = {\n text: PropTypes.string\n .description(\n 'Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.Text),\n textAlign: PropTypes.oneOf(TEXT_ALIGNMENT as unknown as unknown[])\n .description('Tooltip text alignment')\n .defaultValue('left'),\n applyTooltipOverflowWrap: PropTypes.bool\n .description(\n 'when a tooltip is present, the tooltip text may be too long to fit in the pill. If true, the tooltip will wrap to the next line using overflow-wrap',\n )\n .defaultValue(false),\n wrapWords: PropTypes.bool\n .description('Break words into a new line. Useful when words exceed tooltip max-lenght.')\n .defaultValue(false),\n children: PropTypes.node.description('Element to tie the tooltip to, must be a single node').isRequired,\n withoutPortal: PropTypes.bool\n .description('Whether or not the tooltip content should appear in a DOM portal or not')\n .defaultValue(true),\n withoutArrow: PropTypes.bool.description('Whether or not the tooltip should use the arrow').defaultValue(false),\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n portalDOMContainer: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([null])])\n .description('When using portal, the container in which to append the DOM content, defaults to document body')\n .defaultValue(undefined),\n startPlacementPreference: PropTypes.oneOf(PLACEMENT)\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue([0, 14]),\n id: PropTypes.string.description('Optional id appended to data-testid').defaultValue(''),\n onOpen: PropTypes.func.description('Optional callback to be invoked when the tooltip opens').defaultValue('() => {}'),\n onClose: PropTypes.func\n .description('Optional callback to be invoked when the tooltip closes')\n .defaultValue('() => {}'),\n showPopover: PropTypes.bool.description('Whether or not the tooltip should be always shown'),\n Text: PropTypes.func\n .description(\n 'Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.text),\n textProps: PropTypes.object.description(\n 'Props to be passed to the custom Text component, if provided, used mainly to avoiding inline components definition to improve performance',\n ),\n};\n\nexport const DSTooltipV3PropTypesSchema = DSTooltipV3Prop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YAAY,yDAAyD,EACrE,aAAa,UAAU;AAAA,EAC1B,aAAa,UAAU,KAAK,YAAY,mDAAmD;AAAA,EAC3F,MAAM,UAAU,KACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,UAAU,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DSTooltipV3 } from "../index.js";
|
|
4
|
-
const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
|
|
5
4
|
const mockCustomOffset = [0, 0];
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
5
|
+
const testRequiredProps = {};
|
|
6
|
+
const TextComponentThatReceivesProps = (props) => {
|
|
7
|
+
const { title, description } = props;
|
|
8
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
9
|
+
title,
|
|
10
|
+
" - ",
|
|
11
|
+
description
|
|
12
|
+
] });
|
|
9
13
|
};
|
|
14
|
+
const FixedTextComponent = (props) => /* @__PURE__ */ jsx("span", { children: " hello world! " });
|
|
10
15
|
const testOptionalProps = {
|
|
11
|
-
zIndex: 1,
|
|
12
|
-
ariaLabel: "",
|
|
13
16
|
withoutPortal: false,
|
|
14
17
|
withoutArrow: false,
|
|
15
18
|
withoutAnimation: false,
|
|
16
|
-
boundaryElement: void 0,
|
|
17
19
|
animationDuration: 1e3,
|
|
18
20
|
portalDOMContainer: void 0,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
showPopover: true,
|
|
22
|
+
Text: TextComponentThatReceivesProps,
|
|
23
|
+
textProps: {
|
|
24
|
+
title: "Custom Tooltip Title",
|
|
25
|
+
description: "Custom Tooltip Description"
|
|
26
|
+
}
|
|
22
27
|
};
|
|
23
28
|
const testPartialDefaults = {
|
|
24
29
|
id: "",
|
|
@@ -69,20 +74,28 @@ const testExplicitDefinition = {
|
|
|
69
74
|
wrapWords: false,
|
|
70
75
|
applyTooltipOverflowWrap: false,
|
|
71
76
|
text: "",
|
|
72
|
-
zIndex: 1,
|
|
73
|
-
ariaLabel: "",
|
|
74
77
|
withoutPortal: false,
|
|
75
78
|
withoutArrow: false,
|
|
76
79
|
withoutAnimation: false,
|
|
77
|
-
boundaryElement: void 0,
|
|
78
80
|
animationDuration: 1e3,
|
|
79
81
|
portalDOMContainer: void 0,
|
|
80
82
|
startPlacementPreference: "bottom",
|
|
81
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
82
83
|
customOffset: mockCustomOffset,
|
|
83
|
-
modifiers: mockModifiers,
|
|
84
84
|
showPopover: true
|
|
85
85
|
};
|
|
86
|
+
const testExplicitDefinitionWithBoth = {
|
|
87
|
+
...testExplicitDefinition,
|
|
88
|
+
text: "String does not takes precedence",
|
|
89
|
+
Text: FixedTextComponent
|
|
90
|
+
};
|
|
91
|
+
const testExplicitDefinitionWithOnlyTextComponent = {
|
|
92
|
+
...testExplicitDefinition,
|
|
93
|
+
Text: FixedTextComponent
|
|
94
|
+
};
|
|
95
|
+
const testExplicitDefinitionWithOnlyTextString = {
|
|
96
|
+
...testExplicitDefinition,
|
|
97
|
+
text: "String Tooltip"
|
|
98
|
+
};
|
|
86
99
|
const testInferedTypeCompatibility = {
|
|
87
100
|
id: "id",
|
|
88
101
|
onOpen: () => {
|
|
@@ -93,18 +106,13 @@ const testInferedTypeCompatibility = {
|
|
|
93
106
|
wrapWords: false,
|
|
94
107
|
applyTooltipOverflowWrap: false,
|
|
95
108
|
text: "",
|
|
96
|
-
zIndex: 1,
|
|
97
|
-
ariaLabel: "",
|
|
98
109
|
withoutPortal: false,
|
|
99
110
|
withoutArrow: false,
|
|
100
111
|
withoutAnimation: false,
|
|
101
|
-
boundaryElement: void 0,
|
|
102
112
|
animationDuration: 1e3,
|
|
103
113
|
portalDOMContainer: void 0,
|
|
104
114
|
startPlacementPreference: "bottom",
|
|
105
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
106
115
|
customOffset: mockCustomOffset,
|
|
107
|
-
modifiers: mockModifiers,
|
|
108
116
|
showPopover: true
|
|
109
117
|
};
|
|
110
118
|
const testDefinitionAsConst = {
|
|
@@ -116,18 +124,13 @@ const testDefinitionAsConst = {
|
|
|
116
124
|
textAlign: "center",
|
|
117
125
|
wrapWords: false,
|
|
118
126
|
text: "",
|
|
119
|
-
zIndex: 1,
|
|
120
|
-
ariaLabel: "",
|
|
121
127
|
withoutPortal: false,
|
|
122
128
|
withoutArrow: false,
|
|
123
129
|
withoutAnimation: false,
|
|
124
|
-
boundaryElement: void 0,
|
|
125
130
|
animationDuration: 1e3,
|
|
126
131
|
portalDOMContainer: void 0,
|
|
127
132
|
startPlacementPreference: "bottom",
|
|
128
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
129
133
|
customOffset: mockCustomOffset,
|
|
130
|
-
modifiers: mockModifiers,
|
|
131
134
|
showPopover: true
|
|
132
135
|
};
|
|
133
136
|
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -145,21 +148,19 @@ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
|
145
148
|
textAlign: "center",
|
|
146
149
|
wrapWords: false,
|
|
147
150
|
text: "",
|
|
148
|
-
zIndex: 1,
|
|
149
|
-
ariaLabel: "",
|
|
150
151
|
withoutPortal: false,
|
|
151
152
|
withoutArrow: false,
|
|
152
153
|
withoutAnimation: false,
|
|
153
|
-
boundaryElement: void 0,
|
|
154
154
|
animationDuration: 1e3,
|
|
155
155
|
portalDOMContainer: void 0,
|
|
156
156
|
startPlacementPreference: "bottom",
|
|
157
|
-
placementOrderPreference: ["bottom-start", "bottom", "bottom-end"],
|
|
158
157
|
customOffset: [0, 0],
|
|
159
|
-
modifiers: [],
|
|
160
158
|
showPopover: true,
|
|
161
159
|
children: /* @__PURE__ */ jsx("div", {})
|
|
162
160
|
}
|
|
163
|
-
)
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithBoth, children: /* @__PURE__ */ jsx("div", { children: "Hover me (Text Component takes precedence)" }) }),
|
|
163
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextComponent, children: /* @__PURE__ */ jsx("div", { children: "Hover me (only Text Component)" }) }),
|
|
164
|
+
/* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextString, children: /* @__PURE__ */ jsx("div", { children: "Hover me (only text string)" }) })
|
|
164
165
|
] });
|
|
165
166
|
//# sourceMappingURL=typescript-tooltip-v3-valid.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-tooltip-v3-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\n\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {};\n\nconst TextComponentThatReceivesProps: Required<DSTooltipV3T.Props>['Text'] = (props) => {\n const { title, description } = props as unknown as {\n title: string;\n description: string;\n };\n return (\n <span>\n {title} - {description}\n </span>\n );\n};\nconst FixedTextComponent: Required<DSTooltipV3T.Props>['Text'] = (props) => <span> hello world! </span>;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n showPopover: true,\n Text: TextComponentThatReceivesProps,\n textProps: {\n title: 'Custom Tooltip Title',\n description: 'Custom Tooltip Description',\n },\n};\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 id: '',\n onOpen: () => {},\n onClose: () => {},\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testProps: Omit<ComponentPropsForApp, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n startPlacementPreference: 'bottom',\n applyTooltipOverflowWrap: false,\n customOffset: mockCustomOffset,\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testInternalProps: Omit<ComponentPropsInternals, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testExplicitDefinition: Omit<ComponentPropsForApp, 'children'> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n};\n\nconst testExplicitDefinitionWithBoth: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String does not takes precedence',\n Text: FixedTextComponent,\n};\n\nconst testExplicitDefinitionWithOnlyTextComponent: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n Text: FixedTextComponent,\n};\nconst testExplicitDefinitionWithOnlyTextString: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String Tooltip',\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 id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSTooltipV3 {...testExplicitDefinition}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testInferedTypeCompatibility}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testDefinitionAsConst}>\n <div></div>\n </DSTooltipV3>\n {/* works with inline values */}\n <DSTooltipV3\n id=\"id\"\n onOpen={() => {}}\n onClose={() => {}}\n textAlign=\"center\"\n wrapWords={false}\n text=\"\"\n withoutPortal={false}\n withoutArrow={false}\n withoutAnimation={false}\n animationDuration={1000}\n portalDOMContainer={undefined}\n startPlacementPreference=\"bottom\"\n customOffset={[0, 0]}\n showPopover\n >\n <div />\n </DSTooltipV3>\n\n {/* with both text and Text, Text takes precedence */}\n <DSTooltipV3 {...testExplicitDefinitionWithBoth}>\n <div>Hover me (Text Component takes precedence)</div>\n </DSTooltipV3>\n\n {/* with only Text Component */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextComponent}>\n <div>Hover me (only Text Component)</div>\n </DSTooltipV3>\n\n {/* with only Text String */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextString}>\n <div>Hover me (only text string)</div>\n </DSTooltipV3>\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACsBnB,SA0IF,UArI0E,KALxE;AApBJ,SAAS,mBAAmB;AAU5B,MAAM,mBAA8D,CAAC,GAAG,CAAC;AAEzE,MAAM,oBAAmE,CAAC;AAE1E,MAAM,iCAAuE,CAAC,UAAU;AACtF,QAAM,EAAE,OAAO,YAAY,IAAI;AAI/B,SACE,qBAAC,UACE;AAAA;AAAA,IAAM;AAAA,IAAI;AAAA,KACb;AAEJ;AACA,MAAM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,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,0BAAyB;AAAA,MACzB,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,aAAW;AAAA,MAEX,8BAAC,SAAI;AAAA;AAAA,EACP;AAAA,EAGA,oBAAC,eAAa,GAAG,gCACf,8BAAC,SAAI,wDAA0C,GACjD;AAAA,EAGA,oBAAC,eAAa,GAAG,6CACf,8BAAC,SAAI,4CAA8B,GACrC;AAAA,EAGA,oBAAC,eAAa,GAAG,0CACf,8BAAC,SAAI,yCAA2B,GAClC;AAAA,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useGetXstyledProps } from '@elliemae/ds-props-helpers';
|
|
2
|
+
import { type DSTooltipV3T } from '../react-desc-prop-types.js';
|
|
3
|
+
export interface Tooltipv3CTX {
|
|
4
|
+
propsWithDefault: DSTooltipV3T.InternalProps;
|
|
5
|
+
xstyledProps: ReturnType<typeof useGetXstyledProps>;
|
|
6
|
+
instanceUid: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const useTooltipV3: (propsFromUser: DSTooltipV3T.Props) => {
|
|
9
|
+
propsWithDefault: DSTooltipV3T.InternalProps;
|
|
10
|
+
xstyledProps: import("@elliemae/ds-props-helpers").XstyledProps;
|
|
11
|
+
instanceUid: string;
|
|
12
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { GlobalAttributesT } from '@elliemae/ds-props-helpers';
|
|
1
|
+
import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';
|
|
3
2
|
export declare namespace DSTooltipV3T {
|
|
4
3
|
type Placement = 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
|
|
5
4
|
type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';
|
|
@@ -14,25 +13,23 @@ export declare namespace DSTooltipV3T {
|
|
|
14
13
|
customOffset?: [number, number];
|
|
15
14
|
}
|
|
16
15
|
interface OptionalProps {
|
|
17
|
-
zIndex?: number;
|
|
18
|
-
ariaLabel?: string;
|
|
19
16
|
withoutPortal?: boolean;
|
|
20
17
|
withoutArrow?: boolean;
|
|
21
18
|
withoutAnimation?: boolean;
|
|
22
|
-
boundaryElement?: HTMLElement;
|
|
23
19
|
animationDuration?: number;
|
|
24
20
|
portalDOMContainer?: HTMLElement;
|
|
25
|
-
placementOrderPreference?: Placement[];
|
|
26
|
-
modifiers?: Record<string, unknown>[];
|
|
27
21
|
showPopover?: boolean;
|
|
22
|
+
Text?: React.ComponentType<Record<string, unknown>>;
|
|
23
|
+
textProps?: Record<string, unknown>;
|
|
24
|
+
text?: string;
|
|
28
25
|
}
|
|
29
26
|
interface RequiredProps {
|
|
30
27
|
children: React.ReactNode;
|
|
31
|
-
text: string;
|
|
32
28
|
}
|
|
33
|
-
interface InternalProps extends DefaultProps, OptionalProps,
|
|
29
|
+
interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {
|
|
34
30
|
}
|
|
35
|
-
interface Props extends Partial<DefaultProps>, OptionalProps,
|
|
31
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
export declare const
|
|
34
|
+
export declare const DSTooltipV3PropTypes: DSPropTypesSchema<DSTooltipV3T.Props>;
|
|
35
|
+
export declare const DSTooltipV3PropTypesSchema: ValidationMap<DSTooltipV3T.Props>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CustomTextTooltipTestRender: import("react").FunctionComponent<import("react").JSX.IntrinsicAttributes>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-tooltip-v3",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tooltip V3",
|
|
6
6
|
"files": [
|
|
@@ -36,20 +36,21 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-button": "3.
|
|
40
|
-
"@elliemae/ds-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
39
|
+
"@elliemae/ds-button": "3.54.0-beta.2",
|
|
40
|
+
"@elliemae/ds-shared": "3.54.0-beta.2",
|
|
41
|
+
"@elliemae/ds-system": "3.54.0-beta.2",
|
|
42
|
+
"@elliemae/ds-floating-context": "3.54.0-beta.2",
|
|
43
|
+
"@elliemae/ds-props-helpers": "3.54.0-beta.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@elliemae/pui-cli": "9.0.0-next.
|
|
46
|
+
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
47
47
|
"jest": "~29.7.0",
|
|
48
48
|
"react": "^18.3.1",
|
|
49
49
|
"react-dom": "^18.3.1",
|
|
50
50
|
"styled-components": "~5.3.9",
|
|
51
|
-
"@elliemae/ds-grid": "3.
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
51
|
+
"@elliemae/ds-grid": "3.54.0-beta.2",
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.54.0-beta.2",
|
|
53
|
+
"@elliemae/ds-test-utils": "3.54.0-beta.2"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"react": "^18.3.1",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
},
|
|
63
64
|
"scripts": {
|
|
64
65
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
65
|
-
"test": "
|
|
66
|
+
"test": "[ -n \"$CI\" ] || playwright test -c ./playwright.config.mjs && pui-cli test --passWithNoTests --coverage=\"false\"",
|
|
66
67
|
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
67
68
|
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
68
69
|
"dts": "node ../../../scripts/dts.mjs",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/tests/controlled/ControlledTestRenderer.jsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { Grid } from '@elliemae/ds-grid';\nimport { themeProviderHOC } from '@elliemae/ds-system';\nimport React from 'react';\nimport { DSTooltipV3 } from '../../DSTooltipV3';\n\nexport const ControlledTestRenderer = themeProviderHOC(() => {\n const [showPopover, setShowPopover] = React.useState(false);\n const handleOnOpen = React.useCallback(() => setShowPopover(true), []);\n const handleOnClose = React.useCallback(() => setShowPopover(false), []);\n return (\n <main>\n <Grid justifyContent=\"center\" alignItems=\"center\" style={{ height: '100%' }}>\n <DSTooltipV3 text=\"tooltip\" showPopover={showPopover} onOpen={handleOnOpen} onClose={handleOnClose}>\n <button type=\"button\" data-testid=\"test-button\">\n test\n </button>\n {/* we use html button to avoid dependency with ds-button-v2 package */}\n </DSTooltipV3>\n </Grid>\n <button type=\"button\" data-testid=\"test-button2\">\n test 2\n </button>\n {/* we use html button to avoid dependency with ds-button-v2 package */}\n </main>\n );\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADUnB;AAVJ,qBAAqB;AACrB,uBAAiC;AACjC,mBAAkB;AAClB,yBAA4B;AAErB,MAAM,6BAAyB,mCAAiB,MAAM;AAC3D,QAAM,CAAC,aAAa,cAAc,IAAI,aAAAA,QAAM,SAAS,KAAK;AAC1D,QAAM,eAAe,aAAAA,QAAM,YAAY,MAAM,eAAe,IAAI,GAAG,CAAC,CAAC;AACrE,QAAM,gBAAgB,aAAAA,QAAM,YAAY,MAAM,eAAe,KAAK,GAAG,CAAC,CAAC;AACvE,SACE,6CAAC,UACC;AAAA,gDAAC,uBAAK,gBAAe,UAAS,YAAW,UAAS,OAAO,EAAE,QAAQ,OAAO,GACxE,sDAAC,kCAAY,MAAK,WAAU,aAA0B,QAAQ,cAAc,SAAS,eACnF,sDAAC,YAAO,MAAK,UAAS,eAAY,eAAc,kBAEhD,GAEF,GACF;AAAA,IACA,4CAAC,YAAO,MAAK,UAAS,eAAY,gBAAe,oBAEjD;AAAA,KAEF;AAEJ,CAAC;",
|
|
6
|
-
"names": ["React"]
|
|
7
|
-
}
|