@elliemae/ds-tooltip-v3 3.53.1-rc.0 → 3.54.0-next.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.
Files changed (53) hide show
  1. package/dist/cjs/DSTooltipV3.js +11 -6
  2. package/dist/cjs/DSTooltipV3.js.map +2 -2
  3. package/dist/cjs/TooltipV3DatatestId.js +2 -1
  4. package/dist/cjs/TooltipV3DatatestId.js.map +2 -2
  5. package/dist/cjs/{tests/controlled/ControlledTestRenderer.js → config/useTooltipV3.js} +30 -18
  6. package/dist/cjs/config/useTooltipV3.js.map +7 -0
  7. package/dist/cjs/{tests/uncontrolled/UncontrolledTooltipTestRender.js → config/useValidateProps.js} +10 -13
  8. package/dist/cjs/config/useValidateProps.js.map +7 -0
  9. package/dist/cjs/constants.js +2 -0
  10. package/dist/cjs/constants.js.map +2 -2
  11. package/dist/cjs/react-desc-prop-types.js +14 -10
  12. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  13. package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js +32 -31
  14. package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
  15. package/dist/esm/DSTooltipV3.js +13 -8
  16. package/dist/esm/DSTooltipV3.js.map +2 -2
  17. package/dist/esm/TooltipV3DatatestId.js +2 -1
  18. package/dist/esm/TooltipV3DatatestId.js.map +2 -2
  19. package/dist/esm/config/useTooltipV3.js +31 -0
  20. package/dist/esm/config/useTooltipV3.js.map +7 -0
  21. package/dist/esm/config/useValidateProps.js +10 -0
  22. package/dist/esm/config/useValidateProps.js.map +7 -0
  23. package/dist/esm/constants.js +2 -0
  24. package/dist/esm/constants.js.map +2 -2
  25. package/dist/esm/react-desc-prop-types.js +14 -10
  26. package/dist/esm/react-desc-prop-types.js.map +2 -2
  27. package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js +32 -31
  28. package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
  29. package/dist/types/TooltipV3DatatestId.d.ts +1 -0
  30. package/dist/types/config/useTooltipV3.d.ts +12 -0
  31. package/dist/types/config/useValidateProps.d.ts +3 -0
  32. package/dist/types/constants.d.ts +1 -0
  33. package/dist/types/react-desc-prop-types.d.ts +8 -11
  34. package/dist/types/tests/DSTooltipV3.TextComponentProp.test.d.ts +1 -0
  35. package/dist/types/tests/DSTooltipV3.validatePropIsStable.test.d.ts +1 -0
  36. package/dist/types/tests/DSTooltipv3.showPopover.test.d.ts +1 -0
  37. package/dist/types/tests/custom-text-component/CustomTextTooltipTestRender.d.ts +1 -0
  38. package/dist/types/tests/custom-text-component/DSTooltipV3.custom-text-component.test.playwright.d.ts +1 -0
  39. package/package.json +11 -10
  40. package/dist/cjs/tests/controlled/ControlledTestRenderer.js.map +0 -7
  41. package/dist/cjs/tests/controlled/DSTooltipV3.controlled.test.playwright.js +0 -69
  42. package/dist/cjs/tests/controlled/DSTooltipV3.controlled.test.playwright.js.map +0 -7
  43. package/dist/cjs/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js +0 -69
  44. package/dist/cjs/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js.map +0 -7
  45. package/dist/cjs/tests/uncontrolled/UncontrolledTooltipTestRender.js.map +0 -7
  46. package/dist/esm/tests/controlled/ControlledTestRenderer.js +0 -19
  47. package/dist/esm/tests/controlled/ControlledTestRenderer.js.map +0 -7
  48. package/dist/esm/tests/controlled/DSTooltipV3.controlled.test.playwright.js +0 -46
  49. package/dist/esm/tests/controlled/DSTooltipV3.controlled.test.playwright.js.map +0 -7
  50. package/dist/esm/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js +0 -46
  51. package/dist/esm/tests/uncontrolled/DSTooltipV3.uncontrolled.test.playwright.js.map +0 -7
  52. package/dist/esm/tests/uncontrolled/UncontrolledTooltipTestRender.js +0 -13
  53. package/dist/esm/tests/uncontrolled/UncontrolledTooltipTestRender.js.map +0 -7
@@ -40,9 +40,11 @@ var import_ds_floating_context = require("@elliemae/ds-floating-context");
40
40
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
41
41
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
42
42
  var import_TooltipV3DatatestId = require("./TooltipV3DatatestId.js");
43
- var import_defaultProps = require("./defaultProps.js");
44
43
  var import_styles = require("./styles.js");
44
+ var import_useTooltipV3 = require("./config/useTooltipV3.js");
45
+ var import_constants = require("./constants.js");
45
46
  const DSTooltipV3 = (props) => {
47
+ const { propsWithDefault } = (0, import_useTooltipV3.useTooltipV3)(props);
46
48
  const {
47
49
  text,
48
50
  startPlacementPreference,
@@ -59,8 +61,10 @@ const DSTooltipV3 = (props) => {
59
61
  withoutPortal,
60
62
  portalDOMContainer,
61
63
  applyTooltipOverflowWrap,
62
- showPopover
63
- } = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
64
+ showPopover,
65
+ Text,
66
+ textProps
67
+ } = propsWithDefault;
64
68
  const { handlers, arrowStyles, floatingStyles, isOpen, refs, context } = (0, import_ds_floating_context.useFloatingContext)({
65
69
  placement: startPlacementPreference,
66
70
  customOffset,
@@ -92,9 +96,10 @@ const DSTooltipV3 = (props) => {
92
96
  context,
93
97
  children: [
94
98
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledTooltipContainer, { "data-testid": import_TooltipV3DatatestId.TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER, children: [
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
+ Text ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { ...textProps ?? {} }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
100
  import_styles.StyledTooltipText,
97
101
  {
102
+ "data-testid": import_TooltipV3DatatestId.TooltipV3DatatestId.OPINIONATED_TEXT_WRAPPER,
98
103
  textAlign,
99
104
  wrapWords,
100
105
  $applyTooltipOverflowWrap: applyTooltipOverflowWrap,
@@ -112,8 +117,8 @@ const DSTooltipV3 = (props) => {
112
117
  }
113
118
  );
114
119
  };
115
- DSTooltipV3.displayName = "DSTooltipV3";
120
+ DSTooltipV3.displayName = import_constants.DSTooltipV3Name;
116
121
  const DSTooltipV3WithSchema = (0, import_ds_props_helpers.describe)(DSTooltipV3);
117
- DSTooltipV3WithSchema.propTypes = import_react_desc_prop_types.propTypes;
122
+ DSTooltipV3WithSchema.propTypes = import_react_desc_prop_types.DSTooltipV3PropTypesSchema;
118
123
  var DSTooltipV3_default = DSTooltipV3;
119
124
  //# sourceMappingURL=DSTooltipV3.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSTooltipV3.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { useFloatingContext, PopoverArrow, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { useMemoMergePropsWithDefault, describe } from '@elliemae/ds-props-helpers';\nimport { propTypes } from './react-desc-prop-types.js';\nimport { TooltipV3DatatestId } from './TooltipV3DatatestId.js';\nimport { defaultProps } from './defaultProps.js';\nimport {\n StyledTooltipContainer,\n StyledTooltipText,\n StyledMouseOverDetectionBox,\n StyledTriggerWrapper,\n} from './styles.js';\nimport type { DSTooltipV3T } from './react-desc-prop-types.js';\n\nconst DSTooltipV3: React.ComponentType<DSTooltipV3T.Props> = (props) => {\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 } = useMemoMergePropsWithDefault<DSTooltipV3T.InternalProps>(props, defaultProps);\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 <StyledTooltipText\n textAlign={textAlign}\n wrapWords={wrapWords}\n $applyTooltipOverflowWrap={applyTooltipOverflowWrap}\n >\n {text}\n </StyledTooltipText>\n <StyledMouseOverDetectionBox />\n </StyledTooltipContainer>\n {!withoutArrow ? <PopoverArrow {...arrowStyles} /> : null}\n </FloatingWrapper>\n\n {children}\n </StyledTriggerWrapper>\n );\n};\n\nDSTooltipV3.displayName = 'DSTooltipV3';\nconst DSTooltipV3WithSchema = describe(DSTooltipV3);\nDSTooltipV3WithSchema.propTypes = propTypes;\n\nexport { DSTooltipV3, DSTooltipV3WithSchema };\n\nexport default DSTooltipV3;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgEf;AA/DR,mBAAkB;AAClB,iCAAkE;AAClE,8BAAuD;AACvD,mCAA0B;AAC1B,iCAAoC;AACpC,0BAA6B;AAC7B,oBAKO;AAGP,MAAM,cAAuD,CAAC,UAAU;AACtE,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,EACF,QAAI,sDAAyD,OAAO,gCAAY;AAEhF,QAAM,EAAE,UAAU,aAAa,gBAAgB,QAAQ,MAAM,QAAQ,QAAI,+CAAmB;AAAA,IAC1F,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,4BAA4B;AAAA,EAC9B,CAAC;AAED,QAAM,sBAAsB,aAAAA,QAAM,QAAQ,MAAM;AAC9C,QAAI,gBAAgB,OAAW,QAAO;AACtC,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,MAAM,CAAC;AAExB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,KAAK;AAAA,MACf,eAAa,GAAG,+CAAoB,eAAe,GAAG,OAAO,KAAK,IAAI,EAAE,KAAK,EAAE;AAAA,MAE/E;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ;AAAA,YACR;AAAA,YACA;AAAA,YAEA;AAAA,2DAAC,wCAAuB,eAAa,+CAAoB,sBACvD;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACC;AAAA,oBACA;AAAA,oBACA,2BAA2B;AAAA,oBAE1B;AAAA;AAAA,gBACH;AAAA,gBACA,4CAAC,6CAA4B;AAAA,iBAC/B;AAAA,cACC,CAAC,eAAe,4CAAC,2CAAc,GAAG,aAAa,IAAK;AAAA;AAAA;AAAA,QACvD;AAAA,QAEC;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqEf;AApER,mBAAkB;AAClB,iCAAkE;AAClE,8BAAyB;AACzB,mCAA2C;AAC3C,iCAAoC;AACpC,oBAKO;AAEP,0BAA6B;AAC7B,uBAAgC;AAEhC,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,EAAE,iBAAiB,QAAI,kCAAa,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;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,UAAU,aAAa,gBAAgB,QAAQ,MAAM,QAAQ,QAAI,+CAAmB;AAAA,IAC1F,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,4BAA4B;AAAA,EAC9B,CAAC;AAED,QAAM,sBAAsB,aAAAA,QAAM,QAAQ,MAAM;AAC9C,QAAI,gBAAgB,OAAW,QAAO;AACtC,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,MAAM,CAAC;AAExB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,KAAK;AAAA,MACf,eAAa,GAAG,+CAAoB,eAAe,GAAG,OAAO,KAAK,IAAI,EAAE,KAAK,EAAE;AAAA,MAE/E;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ;AAAA,YACR;AAAA,YACA;AAAA,YAEA;AAAA,2DAAC,wCAAuB,eAAa,+CAAoB,sBACtD;AAAA,uBACC,4CAAC,QAAM,GAAI,aAAa,CAAC,GAAI,IAE7B;AAAA,kBAAC;AAAA;AAAA,oBACC,eAAa,+CAAoB;AAAA,oBACjC;AAAA,oBACA;AAAA,oBACA,2BAA2B;AAAA,oBAE1B;AAAA;AAAA,gBACH;AAAA,gBAEF,4CAAC,6CAA4B;AAAA,iBAC/B;AAAA,cACC,CAAC,eAAe,4CAAC,2CAAc,GAAG,aAAa,IAAK;AAAA;AAAA;AAAA,QACvD;AAAA,QAEC;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
6
6
  "names": ["React"]
7
7
  }
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(TooltipV3DatatestId_exports);
34
34
  var React = __toESM(require("react"));
35
35
  const TooltipV3DatatestId = {
36
36
  TRIGGER_WRAPPER: "ds-tooltip-v3-trigger-wrapper",
37
- TOOLTIP_TEXT_WRAPPER: "ds-tooltip-v3-tooltip-text-wrapper"
37
+ TOOLTIP_TEXT_WRAPPER: "ds-tooltip-v3-tooltip-text-wrapper",
38
+ OPINIONATED_TEXT_WRAPPER: "ds-tooltip-v3-opinionated-text-wrapper"
38
39
  };
39
40
  //# sourceMappingURL=TooltipV3DatatestId.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/TooltipV3DatatestId.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export const TooltipV3DatatestId = {\n TRIGGER_WRAPPER: 'ds-tooltip-v3-trigger-wrapper',\n TOOLTIP_TEXT_WRAPPER: 'ds-tooltip-v3-tooltip-text-wrapper',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,sBAAsB;AAAA,EACjC,iBAAiB;AAAA,EACjB,sBAAsB;AACxB;",
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,sBAAsB;AAAA,EACjC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,0BAA0B;AAC5B;",
6
6
  "names": []
7
7
  }
@@ -26,24 +26,36 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var ControlledTestRenderer_exports = {};
30
- __export(ControlledTestRenderer_exports, {
31
- ControlledTestRenderer: () => ControlledTestRenderer
29
+ var useTooltipV3_exports = {};
30
+ __export(useTooltipV3_exports, {
31
+ useTooltipV3: () => useTooltipV3
32
32
  });
33
- module.exports = __toCommonJS(ControlledTestRenderer_exports);
33
+ module.exports = __toCommonJS(useTooltipV3_exports);
34
34
  var React = __toESM(require("react"));
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_ds_grid = require("@elliemae/ds-grid");
37
- var import_ds_system = require("@elliemae/ds-system");
38
35
  var import_react = __toESM(require("react"));
39
- var import_DSTooltipV3 = require("../../DSTooltipV3");
40
- const ControlledTestRenderer = (0, import_ds_system.themeProviderHOC)(() => {
41
- const [showPopover, setShowPopover] = import_react.default.useState(false);
42
- const handleOnOpen = import_react.default.useCallback(() => setShowPopover(true), []);
43
- const handleOnClose = import_react.default.useCallback(() => setShowPopover(false), []);
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { children: [
45
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { justifyContent: "center", alignItems: "center", style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSTooltipV3.DSTooltipV3, { text: "tooltip", showPopover, onOpen: handleOnOpen, onClose: handleOnClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "data-testid": "test-button", children: "test" }) }) }),
46
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "data-testid": "test-button2", children: "test 2" })
47
- ] });
48
- });
49
- //# sourceMappingURL=ControlledTestRenderer.js.map
36
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
+ var import_uid = require("uid");
38
+ var import_react_desc_prop_types = require("../react-desc-prop-types.js");
39
+ var import_defaultProps = require("../defaultProps.js");
40
+ var import_useValidateProps = require("./useValidateProps.js");
41
+ const useTooltipV3 = (propsFromUser) => {
42
+ const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(propsFromUser, import_defaultProps.defaultProps);
43
+ (0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSTooltipV3PropTypes);
44
+ const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
45
+ const instanceUid = import_react.default.useMemo(() => `ds-tooltip-v3-${(0, import_uid.uid)(5)}`, []);
46
+ return import_react.default.useMemo(
47
+ () => ({
48
+ propsWithDefault,
49
+ xstyledProps,
50
+ instanceUid
51
+ // ...eventHandlers,
52
+ }),
53
+ [
54
+ propsWithDefault,
55
+ xstyledProps,
56
+ instanceUid
57
+ // eventHandlers,
58
+ ]
59
+ );
60
+ };
61
+ //# sourceMappingURL=useTooltipV3.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useTooltipV3.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAiE;AACjE,iBAAoB;AACpB,mCAAwD;AACxD,0BAA6B;AAC7B,8BAAiC;AAQ1B,MAAM,eAAe,CAAC,kBAAsC;AAIjE,QAAM,uBAAmB,sDAAyD,eAAe,gCAAY;AAC7G,gDAAiB,kBAAkB,iDAAoB;AAIvD,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,qBAAiB,gBAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAMrE,SAAO,aAAAA,QAAM;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
+ }
@@ -26,18 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var UncontrolledTooltipTestRender_exports = {};
30
- __export(UncontrolledTooltipTestRender_exports, {
31
- UncontrolledTooltipTestRender: () => UncontrolledTooltipTestRender
29
+ var useValidateProps_exports = {};
30
+ __export(useValidateProps_exports, {
31
+ useValidateProps: () => useValidateProps
32
32
  });
33
- module.exports = __toCommonJS(UncontrolledTooltipTestRender_exports);
33
+ module.exports = __toCommonJS(useValidateProps_exports);
34
34
  var React = __toESM(require("react"));
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_ds_grid = require("@elliemae/ds-grid");
37
- var import_ds_system = require("@elliemae/ds-system");
38
- var import_DSTooltipV3 = require("../../DSTooltipV3");
39
- const UncontrolledTooltipTestRender = (0, import_ds_system.themeProviderHOC)(() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { children: [
40
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { justifyContent: "center", alignItems: "center", style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSTooltipV3.DSTooltipV3, { text: "tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "data-testid": "test-button", children: "test" }) }) }),
41
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "data-testid": "test-button2", children: "test 2" })
42
- ] }));
43
- //# sourceMappingURL=UncontrolledTooltipTestRender.js.map
35
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
+ var import_constants = require("../constants.js");
37
+ const useValidateProps = (props, propTypes) => {
38
+ (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSTooltipV3Name);
39
+ };
40
+ //# sourceMappingURL=useValidateProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAG/C,uBAAgC;AAEzB,MAAM,mBAAmB,CAAC,OAAmC,cAA4C;AAE9G,8DAA+B,OAAO,WAAW,gCAAe;AAClE;",
6
+ "names": []
7
+ }
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var constants_exports = {};
30
30
  __export(constants_exports, {
31
+ DSTooltipV3Name: () => DSTooltipV3Name,
31
32
  PLACEMENT: () => PLACEMENT,
32
33
  TEXT_ALIGNMENT: () => TEXT_ALIGNMENT,
33
34
  tooltipPositions: () => tooltipPositions
@@ -49,6 +50,7 @@ const PLACEMENT = [
49
50
  "left-start"
50
51
  ];
51
52
  const TEXT_ALIGNMENT = ["left", "right", "center", "justify", "initial", "inherit"];
53
+ const DSTooltipV3Name = "DSTooltipV3";
52
54
  const tooltipPositions = {
53
55
  TOP: "top",
54
56
  BOTTOM: "bottom",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,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;AAIzF,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;",
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,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
  }
@@ -28,14 +28,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var react_desc_prop_types_exports = {};
30
30
  __export(react_desc_prop_types_exports, {
31
- propTypes: () => propTypes
31
+ DSTooltipV3PropTypes: () => DSTooltipV3PropTypes,
32
+ DSTooltipV3PropTypesSchema: () => DSTooltipV3PropTypesSchema
32
33
  });
33
34
  module.exports = __toCommonJS(react_desc_prop_types_exports);
34
35
  var React = __toESM(require("react"));
35
36
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
37
  var import_constants = require("./constants.js");
37
- const propTypes = {
38
- text: import_ds_props_helpers.PropTypes.string.description("Tooltip text to be displayed on hover/focus").isRequired,
38
+ const DSTooltipV3PropTypes = {
39
+ text: import_ds_props_helpers.PropTypes.string.description(
40
+ "Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence."
41
+ ).isRequiredIf((props) => !props.Text),
39
42
  textAlign: import_ds_props_helpers.PropTypes.oneOf(import_constants.TEXT_ALIGNMENT).description("Tooltip text alignment").defaultValue("left"),
40
43
  applyTooltipOverflowWrap: import_ds_props_helpers.PropTypes.bool.description(
41
44
  "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"
@@ -44,20 +47,21 @@ const propTypes = {
44
47
  children: import_ds_props_helpers.PropTypes.node.description("Element to tie the tooltip to, must be a single node").isRequired,
45
48
  withoutPortal: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip content should appear in a DOM portal or not").defaultValue(true),
46
49
  withoutArrow: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip should use the arrow").defaultValue(false),
47
- boundaryElement: import_ds_props_helpers.PropTypes.element.description(
48
- 'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
49
- ).defaultValue(void 0),
50
50
  withoutAnimation: import_ds_props_helpers.PropTypes.bool.description("Whether or not the popper context menu should be animated").defaultValue(false),
51
51
  animationDuration: import_ds_props_helpers.PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
52
52
  portalDOMContainer: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.node, import_ds_props_helpers.PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
53
53
  startPlacementPreference: import_ds_props_helpers.PropTypes.oneOf(import_constants.PLACEMENT).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
54
- placementOrderPreference: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.oneOf(import_constants.PLACEMENT)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
55
- zIndex: import_ds_props_helpers.PropTypes.number.description("popperjs content z-index").defaultValue(1),
56
54
  customOffset: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("placement offset array").defaultValue([0, 14]),
57
- modifiers: import_ds_props_helpers.PropTypes.array.description("modifiers array for full-custom tooltip-js override, https://popper.js.org/docs/v2/modifiers/").defaultValue(1),
58
55
  id: import_ds_props_helpers.PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
59
56
  onOpen: import_ds_props_helpers.PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
60
57
  onClose: import_ds_props_helpers.PropTypes.func.description("Optional callback to be invoked when the tooltip closes").defaultValue("() => {}"),
61
- showPopover: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip should be always shown")
58
+ showPopover: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip should be always shown"),
59
+ Text: import_ds_props_helpers.PropTypes.func.description(
60
+ "Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence."
61
+ ).isRequiredIf((props) => !props.text),
62
+ textProps: import_ds_props_helpers.PropTypes.object.description(
63
+ "Props to be passed to the custom Text component, if provided, used mainly to avoiding inline components definition to improve performance"
64
+ )
62
65
  };
66
+ const DSTooltipV3PropTypesSchema = DSTooltipV3PropTypes;
63
67
  //# sourceMappingURL=react-desc-prop-types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport type { GlobalAttributesT } 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 zIndex?: number;\n ariaLabel?: string;\n withoutPortal?: boolean;\n withoutArrow?: boolean;\n withoutAnimation?: boolean;\n boundaryElement?: HTMLElement;\n animationDuration?: number;\n portalDOMContainer?: HTMLElement;\n placementOrderPreference?: Placement[];\n modifiers?: Record<string, unknown>[];\n showPopover?: boolean;\n }\n\n export interface RequiredProps {\n children: React.ReactNode;\n text: string;\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 propTypes = {\n text: PropTypes.string.description('Tooltip text to be displayed on hover/focus').isRequired,\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 boundaryElement: PropTypes.element\n .description(\n 'Bounding element to calculate upon, defaults to \"clippingParents\",' +\n 'which are the scrolling containers that may cause element to be partially or fully cut off',\n )\n .defaultValue(undefined),\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 placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(PLACEMENT))\n .description('Array of placement preferences, as per popperjs \"flip\" placement option')\n .defaultValue(\"['top', 'bottom', 'left', 'right']\"),\n zIndex: PropTypes.number.description('popperjs content z-index').defaultValue(1),\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue([0, 14]),\n modifiers: PropTypes.array\n .description('modifiers array for full-custom tooltip-js override, https://popper.js.org/docs/v2/modifiers/')\n .defaultValue(1),\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} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;AAC1B,uBAA0C;AA8DnC,MAAM,YAAY;AAAA,EACvB,MAAM,kCAAU,OAAO,YAAY,6CAA6C,EAAE;AAAA,EAClF,WAAW,kCAAU,MAAM,+BAAsC,EAC9D,YAAY,wBAAwB,EACpC,aAAa,MAAM;AAAA,EACtB,0BAA0B,kCAAU,KACjC;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,WAAW,kCAAU,KAClB,YAAY,2EAA2E,EACvF,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KAAK,YAAY,sDAAsD,EAAE;AAAA,EAC7F,eAAe,kCAAU,KACtB,YAAY,yEAAyE,EACrF,aAAa,IAAI;AAAA,EACpB,cAAc,kCAAU,KAAK,YAAY,iDAAiD,EAAE,aAAa,KAAK;AAAA,EAC9G,iBAAiB,kCAAU,QACxB;AAAA,IACC;AAAA,EAEF,EACC,aAAa,MAAS;AAAA,EACzB,kBAAkB,kCAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA,EACrB,mBAAmB,kCAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA,EACjH,oBAAoB,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC9E,YAAY,gGAAgG,EAC5G,aAAa,MAAS;AAAA,EACzB,0BAA0B,kCAAU,MAAM,0BAAS,EAChD,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA,EACvB,0BAA0B,kCAAU,QAAQ,kCAAU,MAAM,0BAAS,CAAC,EACnE,YAAY,yEAAyE,EACrF,aAAa,oCAAoC;AAAA,EACpD,QAAQ,kCAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,CAAC;AAAA,EAC/E,cAAc,kCAAU,QAAQ,kCAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;AAAA,EAC5G,WAAW,kCAAU,MAClB,YAAY,+FAA+F,EAC3G,aAAa,CAAC;AAAA,EACjB,IAAI,kCAAU,OAAO,YAAY,qCAAqC,EAAE,aAAa,EAAE;AAAA,EACvF,QAAQ,kCAAU,KAAK,YAAY,wDAAwD,EAAE,aAAa,UAAU;AAAA,EACpH,SAAS,kCAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,UAAU;AAAA,EAC1B,aAAa,kCAAU,KAAK,YAAY,mDAAmD;AAC7F;",
4
+ "sourcesContent": ["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 = DSTooltipV3PropTypes as unknown as ValidationMap<DSTooltipV3T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAC1B,uBAA0C;AA2DnC,MAAM,uBAA8D;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,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,kCAAU,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B;",
6
6
  "names": []
7
7
  }
@@ -24,24 +24,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  var React = __toESM(require("react"));
25
25
  var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import__ = require("../index.js");
27
- const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
28
27
  const mockCustomOffset = [0, 0];
29
- const mockModifiers = [{}];
30
- const testRequiredProps = {
31
- text: ""
28
+ const testRequiredProps = {};
29
+ const TextComponentThatReceivesProps = (props) => {
30
+ const { title, description } = props;
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
32
+ title,
33
+ " - ",
34
+ description
35
+ ] });
32
36
  };
37
+ const FixedTextComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: " hello world! " });
33
38
  const testOptionalProps = {
34
- zIndex: 1,
35
- ariaLabel: "",
36
39
  withoutPortal: false,
37
40
  withoutArrow: false,
38
41
  withoutAnimation: false,
39
- boundaryElement: void 0,
40
42
  animationDuration: 1e3,
41
43
  portalDOMContainer: void 0,
42
- placementOrderPreference: mockPlacementOrderPreference,
43
- modifiers: mockModifiers,
44
- showPopover: true
44
+ showPopover: true,
45
+ Text: TextComponentThatReceivesProps,
46
+ textProps: {
47
+ title: "Custom Tooltip Title",
48
+ description: "Custom Tooltip Description"
49
+ }
45
50
  };
46
51
  const testPartialDefaults = {
47
52
  id: "",
@@ -92,20 +97,28 @@ const testExplicitDefinition = {
92
97
  wrapWords: false,
93
98
  applyTooltipOverflowWrap: false,
94
99
  text: "",
95
- zIndex: 1,
96
- ariaLabel: "",
97
100
  withoutPortal: false,
98
101
  withoutArrow: false,
99
102
  withoutAnimation: false,
100
- boundaryElement: void 0,
101
103
  animationDuration: 1e3,
102
104
  portalDOMContainer: void 0,
103
105
  startPlacementPreference: "bottom",
104
- placementOrderPreference: mockPlacementOrderPreference,
105
106
  customOffset: mockCustomOffset,
106
- modifiers: mockModifiers,
107
107
  showPopover: true
108
108
  };
109
+ const testExplicitDefinitionWithBoth = {
110
+ ...testExplicitDefinition,
111
+ text: "String does not takes precedence",
112
+ Text: FixedTextComponent
113
+ };
114
+ const testExplicitDefinitionWithOnlyTextComponent = {
115
+ ...testExplicitDefinition,
116
+ Text: FixedTextComponent
117
+ };
118
+ const testExplicitDefinitionWithOnlyTextString = {
119
+ ...testExplicitDefinition,
120
+ text: "String Tooltip"
121
+ };
109
122
  const testInferedTypeCompatibility = {
110
123
  id: "id",
111
124
  onOpen: () => {
@@ -116,18 +129,13 @@ const testInferedTypeCompatibility = {
116
129
  wrapWords: false,
117
130
  applyTooltipOverflowWrap: false,
118
131
  text: "",
119
- zIndex: 1,
120
- ariaLabel: "",
121
132
  withoutPortal: false,
122
133
  withoutArrow: false,
123
134
  withoutAnimation: false,
124
- boundaryElement: void 0,
125
135
  animationDuration: 1e3,
126
136
  portalDOMContainer: void 0,
127
137
  startPlacementPreference: "bottom",
128
- placementOrderPreference: mockPlacementOrderPreference,
129
138
  customOffset: mockCustomOffset,
130
- modifiers: mockModifiers,
131
139
  showPopover: true
132
140
  };
133
141
  const testDefinitionAsConst = {
@@ -139,18 +147,13 @@ const testDefinitionAsConst = {
139
147
  textAlign: "center",
140
148
  wrapWords: false,
141
149
  text: "",
142
- zIndex: 1,
143
- ariaLabel: "",
144
150
  withoutPortal: false,
145
151
  withoutArrow: false,
146
152
  withoutAnimation: false,
147
- boundaryElement: void 0,
148
153
  animationDuration: 1e3,
149
154
  portalDOMContainer: void 0,
150
155
  startPlacementPreference: "bottom",
151
- placementOrderPreference: mockPlacementOrderPreference,
152
156
  customOffset: mockCustomOffset,
153
- modifiers: mockModifiers,
154
157
  showPopover: true
155
158
  };
156
159
  const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
@@ -168,21 +171,19 @@ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)
168
171
  textAlign: "center",
169
172
  wrapWords: false,
170
173
  text: "",
171
- zIndex: 1,
172
- ariaLabel: "",
173
174
  withoutPortal: false,
174
175
  withoutArrow: false,
175
176
  withoutAnimation: false,
176
- boundaryElement: void 0,
177
177
  animationDuration: 1e3,
178
178
  portalDOMContainer: void 0,
179
179
  startPlacementPreference: "bottom",
180
- placementOrderPreference: ["bottom-start", "bottom", "bottom-end"],
181
180
  customOffset: [0, 0],
182
- modifiers: [],
183
181
  showPopover: true,
184
182
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
185
183
  }
186
- )
184
+ ),
185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithBoth, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (Text Component takes precedence)" }) }),
186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextComponent, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (only Text Component)" }) }),
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextString, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (only text string)" }) })
187
188
  ] });
188
189
  //# 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 mockPlacementOrderPreference: DSTooltipV3T.Placement[] = ['bottom-start', 'bottom', 'bottom-end'];\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\nconst mockModifiers: DSTooltipV3T.OptionalProps['modifiers'] = [{}];\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {\n text: '',\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n zIndex: 1,\n ariaLabel: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n boundaryElement: undefined,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n placementOrderPreference: mockPlacementOrderPreference,\n modifiers: mockModifiers,\n showPopover: true,\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 zIndex: 1,\n ariaLabel: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n boundaryElement: undefined,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n placementOrderPreference: mockPlacementOrderPreference,\n customOffset: mockCustomOffset,\n modifiers: mockModifiers,\n showPopover: true,\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 zIndex: 1,\n ariaLabel: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n boundaryElement: undefined,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n placementOrderPreference: mockPlacementOrderPreference,\n customOffset: mockCustomOffset,\n modifiers: mockModifiers,\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 zIndex: 1,\n ariaLabel: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n boundaryElement: undefined,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n placementOrderPreference: mockPlacementOrderPreference,\n customOffset: mockCustomOffset,\n modifiers: mockModifiers,\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 zIndex={1}\n ariaLabel=\"\"\n withoutPortal={false}\n withoutArrow={false}\n withoutAnimation={false}\n boundaryElement={undefined}\n animationDuration={1000}\n portalDOMContainer={undefined}\n startPlacementPreference=\"bottom\"\n placementOrderPreference={['bottom-start', 'bottom', 'bottom-end']}\n customOffset={[0, 0]}\n modifiers={[]}\n showPopover\n >\n <div />\n </DSTooltipV3>\n </>\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACuJrB;AAtJF,eAA4B;AAU5B,MAAM,+BAAyD,CAAC,gBAAgB,UAAU,YAAY;AACtG,MAAM,mBAA8D,CAAC,GAAG,CAAC;AACzE,MAAM,gBAAyD,CAAC,CAAC,CAAC;AAGlE,MAAM,oBAAmE;AAAA,EACvE,MAAM;AACR;AAEA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,eAAe;AAAA,EACf,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,WAAW;AAAA,EACX,aAAa;AACf;AAIA,MAAM,sBAA2D;AAAA,EAC/D,IAAI;AAAA,EACJ,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,SAAS,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AAAA,MACZ,aAAW;AAAA,MAEX,sDAAC,SAAI;AAAA;AAAA,EACP;AAAA,GACF;",
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,YAAuB;ACsBnB;AApBJ,eAA4B;AAU5B,MAAM,mBAA8D,C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f,sDAAC,SAAI,GACP;AAAA,EAEA;AAAA,IAAC;AAAA;AAAA,MACC,IAAG;AAAA,MACH,QAAQ,MAAM;AAAA,MAAC;AAAA,MACf,SAAS,MAAM;AAAA,MAAC;AAAA,MAChB,WAAU;AAAA,MACV,WAAW;AAAA,MACX,MAAK;AAAA,MACL,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,sDAAC,SAAI;AAAA;AAAA,EACP;AAAA,EAGA,4CAAC,wBAAa,GAAG,gCACf,sDAAC,SAAI,wDAA0C,GACjD;AAAA,EAGA,4CAAC,wBAAa,GAAG,6CACf,sDAAC,SAAI,4CAA8B,GACrC;AAAA,EAGA,4CAAC,wBAAa,GAAG,0CACf,sDAAC,SAAI,yCAA2B,GAClC;AAAA,GACF;",
6
6
  "names": []
7
7
  }
@@ -2,17 +2,19 @@ import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import React2 from "react";
4
4
  import { useFloatingContext, PopoverArrow, FloatingWrapper } from "@elliemae/ds-floating-context";
5
- import { useMemoMergePropsWithDefault, describe } from "@elliemae/ds-props-helpers";
6
- import { propTypes } from "./react-desc-prop-types.js";
5
+ import { describe } from "@elliemae/ds-props-helpers";
6
+ import { DSTooltipV3PropTypesSchema } from "./react-desc-prop-types.js";
7
7
  import { TooltipV3DatatestId } from "./TooltipV3DatatestId.js";
8
- import { defaultProps } from "./defaultProps.js";
9
8
  import {
10
9
  StyledTooltipContainer,
11
10
  StyledTooltipText,
12
11
  StyledMouseOverDetectionBox,
13
12
  StyledTriggerWrapper
14
13
  } from "./styles.js";
14
+ import { useTooltipV3 } from "./config/useTooltipV3.js";
15
+ import { DSTooltipV3Name } from "./constants.js";
15
16
  const DSTooltipV3 = (props) => {
17
+ const { propsWithDefault } = useTooltipV3(props);
16
18
  const {
17
19
  text,
18
20
  startPlacementPreference,
@@ -29,8 +31,10 @@ const DSTooltipV3 = (props) => {
29
31
  withoutPortal,
30
32
  portalDOMContainer,
31
33
  applyTooltipOverflowWrap,
32
- showPopover
33
- } = useMemoMergePropsWithDefault(props, defaultProps);
34
+ showPopover,
35
+ Text,
36
+ textProps
37
+ } = propsWithDefault;
34
38
  const { handlers, arrowStyles, floatingStyles, isOpen, refs, context } = useFloatingContext({
35
39
  placement: startPlacementPreference,
36
40
  customOffset,
@@ -62,9 +66,10 @@ const DSTooltipV3 = (props) => {
62
66
  context,
63
67
  children: [
64
68
  /* @__PURE__ */ jsxs(StyledTooltipContainer, { "data-testid": TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER, children: [
65
- /* @__PURE__ */ jsx(
69
+ Text ? /* @__PURE__ */ jsx(Text, { ...textProps ?? {} }) : /* @__PURE__ */ jsx(
66
70
  StyledTooltipText,
67
71
  {
72
+ "data-testid": TooltipV3DatatestId.OPINIONATED_TEXT_WRAPPER,
68
73
  textAlign,
69
74
  wrapWords,
70
75
  $applyTooltipOverflowWrap: applyTooltipOverflowWrap,
@@ -82,9 +87,9 @@ const DSTooltipV3 = (props) => {
82
87
  }
83
88
  );
84
89
  };
85
- DSTooltipV3.displayName = "DSTooltipV3";
90
+ DSTooltipV3.displayName = DSTooltipV3Name;
86
91
  const DSTooltipV3WithSchema = describe(DSTooltipV3);
87
- DSTooltipV3WithSchema.propTypes = propTypes;
92
+ DSTooltipV3WithSchema.propTypes = DSTooltipV3PropTypesSchema;
88
93
  var DSTooltipV3_default = DSTooltipV3;
89
94
  export {
90
95
  DSTooltipV3,