@elliemae/ds-tooltip-v3 3.53.0-alpha.1 → 3.53.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/DSTooltipV3.js +9 -5
  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/config/useTooltipV3.js +61 -0
  6. package/dist/cjs/config/useTooltipV3.js.map +7 -0
  7. package/dist/cjs/config/useValidateProps.js +40 -0
  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 +7 -2
  12. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  13. package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js +20 -5
  14. package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
  15. package/dist/esm/DSTooltipV3.js +10 -6
  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 +7 -2
  26. package/dist/esm/react-desc-prop-types.js.map +2 -2
  27. package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js +20 -5
  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 +2 -1
  34. package/dist/types/tests/DSTooltipV3.TextComponentProp.test.d.ts +1 -0
  35. package/dist/types/tests/DSTooltipv3.showPopover.test.d.ts +1 -0
  36. package/package.json +8 -8
@@ -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,9 @@ 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
+ } = propsWithDefault;
64
67
  const { handlers, arrowStyles, floatingStyles, isOpen, refs, context } = (0, import_ds_floating_context.useFloatingContext)({
65
68
  placement: startPlacementPreference,
66
69
  customOffset,
@@ -92,9 +95,10 @@ const DSTooltipV3 = (props) => {
92
95
  context,
93
96
  children: [
94
97
  /* @__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)(
98
+ Text ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
99
  import_styles.StyledTooltipText,
97
100
  {
101
+ "data-testid": import_TooltipV3DatatestId.TooltipV3DatatestId.OPINIONATED_TEXT_WRAPPER,
98
102
  textAlign,
99
103
  wrapWords,
100
104
  $applyTooltipOverflowWrap: applyTooltipOverflowWrap,
@@ -112,7 +116,7 @@ const DSTooltipV3 = (props) => {
112
116
  }
113
117
  );
114
118
  };
115
- DSTooltipV3.displayName = "DSTooltipV3";
119
+ DSTooltipV3.displayName = import_constants.DSTooltipV3Name;
116
120
  const DSTooltipV3WithSchema = (0, import_ds_props_helpers.describe)(DSTooltipV3);
117
121
  DSTooltipV3WithSchema.propTypes = import_react_desc_prop_types.propTypes;
118
122
  var DSTooltipV3_default = DSTooltipV3;
@@ -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 { propTypes } 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 } = 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 />\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 = 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;ADoEf;AAnER,mBAAkB;AAClB,iCAAkE;AAClE,8BAAyB;AACzB,mCAA0B;AAC1B,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,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,QAAK,IAEN;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
  }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useTooltipV3_exports = {};
30
+ __export(useTooltipV3_exports, {
31
+ useTooltipV3: () => useTooltipV3
32
+ });
33
+ module.exports = __toCommonJS(useTooltipV3_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_react = __toESM(require("react"));
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.propTypes);
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, propTypes } 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, propTypes);\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,mCAA6C;AAC7C,0BAA6B;AAC7B,8BAAiC;AAQ1B,MAAM,eAAe,CAAC,kBAAsC;AAIjE,QAAM,uBAAmB,sDAAyD,eAAe,gCAAY;AAC7G,gDAAiB,kBAAkB,sCAAS;AAI5C,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
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useValidateProps_exports = {};
30
+ __export(useValidateProps_exports, {
31
+ useValidateProps: () => useValidateProps
32
+ });
33
+ module.exports = __toCommonJS(useValidateProps_exports);
34
+ var React = __toESM(require("react"));
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
  }
@@ -35,7 +35,9 @@ var React = __toESM(require("react"));
35
35
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
36
36
  var import_constants = require("./constants.js");
37
37
  const propTypes = {
38
- text: import_ds_props_helpers.PropTypes.string.description("Tooltip text to be displayed on hover/focus").isRequired,
38
+ text: import_ds_props_helpers.PropTypes.string.description(
39
+ "Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence."
40
+ ).isRequiredIf((props) => !props.Text),
39
41
  textAlign: import_ds_props_helpers.PropTypes.oneOf(import_constants.TEXT_ALIGNMENT).description("Tooltip text alignment").defaultValue("left"),
40
42
  applyTooltipOverflowWrap: import_ds_props_helpers.PropTypes.bool.description(
41
43
  "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"
@@ -58,6 +60,9 @@ const propTypes = {
58
60
  id: import_ds_props_helpers.PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
59
61
  onOpen: import_ds_props_helpers.PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
60
62
  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")
63
+ showPopover: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip should be always shown"),
64
+ Text: import_ds_props_helpers.PropTypes.func.description(
65
+ "Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence."
66
+ ).isRequiredIf((props) => !props.text)
62
67
  };
63
68
  //# 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 { 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 Text?: React.ComponentType;\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 propTypes = {\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 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 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} 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;AA+DnC,MAAM,YAAY;AAAA,EACvB,MAAM,kCAAU,OACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,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,kCAA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3F,MAAM,kCAAU,KACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AACjE;",
6
6
  "names": []
7
7
  }
@@ -27,9 +27,7 @@ var import__ = require("../index.js");
27
27
  const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
28
28
  const mockCustomOffset = [0, 0];
29
29
  const mockModifiers = [{}];
30
- const testRequiredProps = {
31
- text: ""
32
- };
30
+ const testRequiredProps = {};
33
31
  const testOptionalProps = {
34
32
  zIndex: 1,
35
33
  ariaLabel: "",
@@ -41,7 +39,8 @@ const testOptionalProps = {
41
39
  portalDOMContainer: void 0,
42
40
  placementOrderPreference: mockPlacementOrderPreference,
43
41
  modifiers: mockModifiers,
44
- showPopover: true
42
+ showPopover: true,
43
+ Text: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Custom Tooltip" })
45
44
  };
46
45
  const testPartialDefaults = {
47
46
  id: "",
@@ -106,6 +105,19 @@ const testExplicitDefinition = {
106
105
  modifiers: mockModifiers,
107
106
  showPopover: true
108
107
  };
108
+ const testExplicitDefinitionWithBoth = {
109
+ ...testExplicitDefinition,
110
+ text: "String does not takes precedence",
111
+ Text: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Should show (Text takes precedence)" })
112
+ };
113
+ const testExplicitDefinitionWithOnlyTextComponent = {
114
+ ...testExplicitDefinition,
115
+ Text: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Plain string as ReactNode" })
116
+ };
117
+ const testExplicitDefinitionWithOnlyTextString = {
118
+ ...testExplicitDefinition,
119
+ text: "String Tooltip"
120
+ };
109
121
  const testInferedTypeCompatibility = {
110
122
  id: "id",
111
123
  onOpen: () => {
@@ -183,6 +195,9 @@ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)
183
195
  showPopover: true,
184
196
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
185
197
  }
186
- )
198
+ ),
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithBoth, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (Text Component takes precedence)" }) }),
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextComponent, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (only Text Component)" }) }),
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextString, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Hover me (only text string)" }) })
187
202
  ] });
188
203
  //# 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,MAAM;AAAA,EAAC;AAClB;AAGA,MAAM,YAAoD;AAAA,EACxD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,IAAI;AAAA,EACJ,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,cAAc;AAChB;AAGA,MAAM,oBAA+D;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BA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oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,cAAc;AAAA,EACd,WAAW;AAAA,EACX,aAAa;AACf;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBACf,sDAAC,SAAI,GACP;AAAA,EACA,4CAAC,wBAAa,GAAG,8BACf,sDAAC,SAAI,GACP;AAAA,EACA,4CAAC,wBAAa,GAAG,uBACf,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,QAAQ;AAAA,MACR,WAAU;AAAA,MACV,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,0BAAyB;AAAA,MACzB,0BAA0B,CAAC,gBAAgB,UAAU,YAAY;AAAA,MACjE,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,WAAW,CAAC;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 mockPlacementOrderPreference: DSTooltipV3T.Placement[] = ['bottom-start', 'bottom', 'bottom-end'];\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\nconst mockModifiers: DSTooltipV3T.OptionalProps['modifiers'] = [{}];\n\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {};\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 Text: () => <span>Custom Tooltip</span>,\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\nconst testExplicitDefinitionWithBoth: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String does not takes precedence',\n Text: () => <span>Should show (Text takes precedence)</span>,\n};\n\nconst testExplicitDefinitionWithOnlyTextComponent: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n Text: () => <span>Plain string as ReactNode</span>,\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 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 {/* 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;AC8BT;AA5Bd,eAA4B;AAU5B,MAAM,+BAAyD,CAAC,gBAAgB,UAAU,YAAY;AACtG,MAAM,mBAA8D,CAAC,GAAG,CAAC;AACzE,MAAM,gBAAyD,CAAC,CAAC,CAAC;AAElE,MAAM,oBAAmE,CAAC;AAE1E,MA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C5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBACf,sDAAC,SAAI,GACP;AAAA,EACA,4CAAC,wBAAa,GAAG,8BACf,sDAAC,SAAI,GACP;AAAA,EACA,4CAAC,wBAAa,GAAG,uBACf,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,QAAQ;AAAA,MACR,WAAU;AAAA,MACV,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,0BAAyB;AAAA,MACzB,0BAA0B,CAAC,gBAAgB,UAAU,YAAY;AAAA,MACjE,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,WAAW,CAAC;AAAA,MACZ,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";
5
+ import { describe } from "@elliemae/ds-props-helpers";
6
6
  import { propTypes } 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,9 @@ const DSTooltipV3 = (props) => {
29
31
  withoutPortal,
30
32
  portalDOMContainer,
31
33
  applyTooltipOverflowWrap,
32
- showPopover
33
- } = useMemoMergePropsWithDefault(props, defaultProps);
34
+ showPopover,
35
+ Text
36
+ } = propsWithDefault;
34
37
  const { handlers, arrowStyles, floatingStyles, isOpen, refs, context } = useFloatingContext({
35
38
  placement: startPlacementPreference,
36
39
  customOffset,
@@ -62,9 +65,10 @@ const DSTooltipV3 = (props) => {
62
65
  context,
63
66
  children: [
64
67
  /* @__PURE__ */ jsxs(StyledTooltipContainer, { "data-testid": TooltipV3DatatestId.TOOLTIP_TEXT_WRAPPER, children: [
65
- /* @__PURE__ */ jsx(
68
+ Text ? /* @__PURE__ */ jsx(Text, {}) : /* @__PURE__ */ jsx(
66
69
  StyledTooltipText,
67
70
  {
71
+ "data-testid": TooltipV3DatatestId.OPINIONATED_TEXT_WRAPPER,
68
72
  textAlign,
69
73
  wrapWords,
70
74
  $applyTooltipOverflowWrap: applyTooltipOverflowWrap,
@@ -82,7 +86,7 @@ const DSTooltipV3 = (props) => {
82
86
  }
83
87
  );
84
88
  };
85
- DSTooltipV3.displayName = "DSTooltipV3";
89
+ DSTooltipV3.displayName = DSTooltipV3Name;
86
90
  const DSTooltipV3WithSchema = describe(DSTooltipV3);
87
91
  DSTooltipV3WithSchema.propTypes = propTypes;
88
92
  var DSTooltipV3_default = DSTooltipV3;
@@ -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 { 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"],
5
- "mappings": "AAAA,YAAY,WAAW;ACgEf,SACE,KADF;AA/DR,OAAOA,YAAW;AAClB,SAAS,oBAAoB,cAAc,uBAAuB;AAClE,SAAS,8BAA8B,gBAAgB;AACvD,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;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,IAAI,6BAAyD,OAAO,YAAY;AAEhF,QAAM,EAAE,UAAU,aAAa,gBAAgB,QAAQ,MAAM,QAAQ,IAAI,mBAAmB;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,sBAAsBA,OAAM,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,oBAAoB,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,mCAAC,0BAAuB,eAAa,oBAAoB,sBACvD;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACC;AAAA,oBACA;AAAA,oBACA,2BAA2B;AAAA,oBAE1B;AAAA;AAAA,gBACH;AAAA,gBACA,oBAAC,+BAA4B;AAAA,iBAC/B;AAAA,cACC,CAAC,eAAe,oBAAC,gBAAc,GAAG,aAAa,IAAK;AAAA;AAAA;AAAA,QACvD;AAAA,QAEC;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
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 { propTypes } 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 } = 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 />\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 = propTypes;\n\nexport { DSTooltipV3, DSTooltipV3WithSchema };\n\nexport default DSTooltipV3;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoEf,SAEI,KAFJ;AAnER,OAAOA,YAAW;AAClB,SAAS,oBAAoB,cAAc,uBAAuB;AAClE,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS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,iBAC/B;AAAA,cACC,CAAC,eAAe,oBAAC,gBAAc,GAAG,aAAa,IAAK;AAAA;AAAA;AAAA,QACvD;AAAA,QAEC;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  const TooltipV3DatatestId = {
3
3
  TRIGGER_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;AACxB;",
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 { propTypes } 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, propTypes);
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, propTypes } 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, propTypes);\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,iBAAiB;AAC7C,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAQ1B,MAAM,eAAe,CAAC,kBAAsC;AAIjE,QAAM,mBAAmB,6BAAyD,eAAe,YAAY;AAC7G,mBAAiB,kBAAkB,SAAS;AAI5C,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
+ }
@@ -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;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": ["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
  }
@@ -2,7 +2,9 @@ import * as React from "react";
2
2
  import { PropTypes } from "@elliemae/ds-props-helpers";
3
3
  import { PLACEMENT, TEXT_ALIGNMENT } from "./constants.js";
4
4
  const propTypes = {
5
- text: PropTypes.string.description("Tooltip text to be displayed on hover/focus").isRequired,
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"
@@ -25,7 +27,10 @@ const propTypes = {
25
27
  id: PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
26
28
  onOpen: PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
27
29
  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")
30
+ showPopover: PropTypes.bool.description("Whether or not the tooltip should be always shown"),
31
+ Text: PropTypes.func.description(
32
+ "Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence."
33
+ ).isRequiredIf((props) => !props.text)
29
34
  };
30
35
  export {
31
36
  propTypes
@@ -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 { 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"],
5
- "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,sBAAsB;AA8DnC,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,OAAO,YAAY,6CAA6C,EAAE;AAAA,EAClF,WAAW,UAAU,MAAM,cAAsC,EAC9D,YAAY,wBAAwB,EACpC,aAAa,MAAM;AAAA,EACtB,0BAA0B,UAAU,KACjC;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,WAAW,UAAU,KAClB,YAAY,2EAA2E,EACvF,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KAAK,YAAY,sDAAsD,EAAE;AAAA,EAC7F,eAAe,UAAU,KACtB,YAAY,yEAAyE,EACrF,aAAa,IAAI;AAAA,EACpB,cAAc,UAAU,KAAK,YAAY,iDAAiD,EAAE,aAAa,KAAK;AAAA,EAC9G,iBAAiB,UAAU,QACxB;AAAA,IACC;AAAA,EAEF,EACC,aAAa,MAAS;AAAA,EACzB,kBAAkB,UAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA,EACrB,mBAAmB,UAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA,EACjH,oBAAoB,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC9E,YAAY,gGAAgG,EAC5G,aAAa,MAAS;AAAA,EACzB,0BAA0B,UAAU,MAAM,SAAS,EAChD,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA,EACvB,0BAA0B,UAAU,QAAQ,UAAU,MAAM,SAAS,CAAC,EACnE,YAAY,yEAAyE,EACrF,aAAa,oCAAoC;AAAA,EACpD,QAAQ,UAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,CAAC;AAAA,EAC/E,cAAc,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;AAAA,EAC5G,WAAW,UAAU,MAClB,YAAY,+FAA+F,EAC3G,aAAa,CAAC;AAAA,EACjB,IAAI,UAAU,OAAO,YAAY,qCAAqC,EAAE,aAAa,EAAE;AAAA,EACvF,QAAQ,UAAU,KAAK,YAAY,wDAAwD,EAAE,aAAa,UAAU;AAAA,EACpH,SAAS,UAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,UAAU;AAAA,EAC1B,aAAa,UAAU,KAAK,YAAY,mDAAmD;AAC7F;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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 Text?: React.ComponentType;\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 propTypes = {\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 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 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} as WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,sBAAsB;AA+DnC,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,OACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,UAAU,MAAM,cAAsC,EAC9D,YAAY,wBAAwB,EACpC,aAAa,MAAM;AAAA,EACtB,0BAA0B,UAAU,KACjC;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,WAAW,UAAU,KAClB,YAAY,2EAA2E,EACvF,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KAAK,YAAY,sDAAsD,EAAE;AAAA,EAC7F,eAAe,UAAU,KACtB,YAAY,yEAAyE,EACrF,aAAa,IAAI;AAAA,EACpB,cAAc,UAAU,KAAK,YAAY,iDAAiD,EAAE,aAAa,KAAK;AAAA,EAC9G,iBAAiB,UAAU,QACxB;AAAA,IACC;AAAA,EAEF,EACC,aAAa,MAAS;AAAA,EACzB,kBAAkB,UAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA,EACrB,mBAAmB,UAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA,EACjH,oBAAoB,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC9E,YAAY,gGAAgG,EAC5G,aAAa,MAAS;AAAA,EACzB,0BAA0B,UAAU,MAAM,SAAS,EAChD,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA,EACvB,0BAA0B,UAAU,QAAQ,UAAU,MAAM,SAAS,CAAC,EACnE,YAAY,yEAAyE,EACrF,aAAa,oCAAoC;AAAA,EACpD,QAAQ,UAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,CAAC;AAAA,EAC/E,cAAc,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;AAAA,EAC5G,WAAW,UAAU,MAClB,YAAY,+FAA+F,EAC3G,aAAa,CAAC;AAAA,EACjB,IAAI,UAAU,OAAO,YAAY,qCAAqC,EAAE,aAAa,EAAE;AAAA,EACvF,QAAQ,UAAU,KAAK,YAAY,wDAAwD,EAAE,aAAa,UAAU;AAAA,EACpH,SAAS,UAAU,KAChB,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;AACjE;",
6
6
  "names": []
7
7
  }
@@ -4,9 +4,7 @@ import { DSTooltipV3 } from "../index.js";
4
4
  const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
5
5
  const mockCustomOffset = [0, 0];
6
6
  const mockModifiers = [{}];
7
- const testRequiredProps = {
8
- text: ""
9
- };
7
+ const testRequiredProps = {};
10
8
  const testOptionalProps = {
11
9
  zIndex: 1,
12
10
  ariaLabel: "",
@@ -18,7 +16,8 @@ const testOptionalProps = {
18
16
  portalDOMContainer: void 0,
19
17
  placementOrderPreference: mockPlacementOrderPreference,
20
18
  modifiers: mockModifiers,
21
- showPopover: true
19
+ showPopover: true,
20
+ Text: () => /* @__PURE__ */ jsx("span", { children: "Custom Tooltip" })
22
21
  };
23
22
  const testPartialDefaults = {
24
23
  id: "",
@@ -83,6 +82,19 @@ const testExplicitDefinition = {
83
82
  modifiers: mockModifiers,
84
83
  showPopover: true
85
84
  };
85
+ const testExplicitDefinitionWithBoth = {
86
+ ...testExplicitDefinition,
87
+ text: "String does not takes precedence",
88
+ Text: () => /* @__PURE__ */ jsx("span", { children: "Should show (Text takes precedence)" })
89
+ };
90
+ const testExplicitDefinitionWithOnlyTextComponent = {
91
+ ...testExplicitDefinition,
92
+ Text: () => /* @__PURE__ */ jsx("span", { children: "Plain string as ReactNode" })
93
+ };
94
+ const testExplicitDefinitionWithOnlyTextString = {
95
+ ...testExplicitDefinition,
96
+ text: "String Tooltip"
97
+ };
86
98
  const testInferedTypeCompatibility = {
87
99
  id: "id",
88
100
  onOpen: () => {
@@ -160,6 +172,9 @@ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
160
172
  showPopover: true,
161
173
  children: /* @__PURE__ */ jsx("div", {})
162
174
  }
163
- )
175
+ ),
176
+ /* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithBoth, children: /* @__PURE__ */ jsx("div", { children: "Hover me (Text Component takes precedence)" }) }),
177
+ /* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextComponent, children: /* @__PURE__ */ jsx("div", { children: "Hover me (only Text Component)" }) }),
178
+ /* @__PURE__ */ jsx(DSTooltipV3, { ...testExplicitDefinitionWithOnlyTextString, children: /* @__PURE__ */ jsx("div", { children: "Hover me (only text string)" }) })
164
179
  ] });
165
180
  //# 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,YAAY,WAAW;ACuJrB,mBAGI,KAHJ;AAtJF,SAAS,mBAAmB;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,MAAM;AAAA,EAAC;AAClB;AAGA,MAAM,YAAoD;AAAA,EACxD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE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B,IAAI;AAAA,EACJ,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,EACN,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,0BAA0B;AAAA,EAC1B,cAAc;AAAA,EACd,WAAW;AAAA,EACX,aAAa;AACf;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,eAAa,GAAG,wBACf,8BAAC,SAAI,GACP;AAAA,EACA,oBAAC,eAAa,GAAG,8BACf,8BAAC,SAAI,GACP;AAAA,EACA,oBAAC,eAAa,GAAG,uBACf,8BAAC,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,QAAQ;AAAA,MACR,WAAU;AAAA,MACV,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,0BAAyB;AAAA,MACzB,0BAA0B,CAAC,gBAAgB,UAAU,YAAY;AAAA,MACjE,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,WAAW,CAAC;AAAA,MACZ,aAAW;AAAA,MAEX,8BAAC,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 mockPlacementOrderPreference: DSTooltipV3T.Placement[] = ['bottom-start', 'bottom', 'bottom-end'];\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\nconst mockModifiers: DSTooltipV3T.OptionalProps['modifiers'] = [{}];\n\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {};\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 Text: () => <span>Custom Tooltip</span>,\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\nconst testExplicitDefinitionWithBoth: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String does not takes precedence',\n Text: () => <span>Should show (Text takes precedence)</span>,\n};\n\nconst testExplicitDefinitionWithOnlyTextComponent: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n Text: () => <span>Plain string as ReactNode</span>,\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 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 {/* 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)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Id: {
2
2
  TRIGGER_WRAPPER: string;
3
3
  TOOLTIP_TEXT_WRAPPER: string;
4
+ OPINIONATED_TEXT_WRAPPER: string;
4
5
  };
@@ -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
+ };
@@ -0,0 +1,3 @@
1
+ import type { ValidationMap } from '@elliemae/ds-props-helpers';
2
+ import { type DSTooltipV3T } from '../react-desc-prop-types.js';
3
+ export declare const useValidateProps: (props: DSTooltipV3T.InternalProps, propTypes: ValidationMap<unknown>) => void;
@@ -1,5 +1,6 @@
1
1
  export declare const PLACEMENT: string[];
2
2
  export declare const TEXT_ALIGNMENT: string[];
3
+ export declare const DSTooltipV3Name = "DSTooltipV3";
3
4
  declare const tooltipPositions: {
4
5
  TOP: "top";
5
6
  BOTTOM: "bottom";
@@ -25,10 +25,11 @@ export declare namespace DSTooltipV3T {
25
25
  placementOrderPreference?: Placement[];
26
26
  modifiers?: Record<string, unknown>[];
27
27
  showPopover?: boolean;
28
+ Text?: React.ComponentType;
29
+ text?: string;
28
30
  }
29
31
  interface RequiredProps {
30
32
  children: React.ReactNode;
31
- text: string;
32
33
  }
33
34
  interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>, RequiredProps {
34
35
  }
@@ -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.53.0-alpha.1",
3
+ "version": "3.53.0-beta.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Tooltip V3",
6
6
  "files": [
@@ -36,11 +36,11 @@
36
36
  "indent": 4
37
37
  },
38
38
  "dependencies": {
39
- "@elliemae/ds-button": "3.53.0-alpha.1",
40
- "@elliemae/ds-floating-context": "3.53.0-alpha.1",
41
- "@elliemae/ds-props-helpers": "3.53.0-alpha.1",
42
- "@elliemae/ds-shared": "3.53.0-alpha.1",
43
- "@elliemae/ds-system": "3.53.0-alpha.1"
39
+ "@elliemae/ds-button": "3.53.0-beta.3",
40
+ "@elliemae/ds-floating-context": "3.53.0-beta.3",
41
+ "@elliemae/ds-props-helpers": "3.53.0-beta.3",
42
+ "@elliemae/ds-system": "3.53.0-beta.3",
43
+ "@elliemae/ds-shared": "3.53.0-beta.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@elliemae/pui-cli": "9.0.0-next.63",
@@ -48,8 +48,8 @@
48
48
  "react": "^18.3.1",
49
49
  "react-dom": "^18.3.1",
50
50
  "styled-components": "~5.3.9",
51
- "@elliemae/ds-monorepo-devops": "3.53.0-alpha.1",
52
- "@elliemae/ds-grid": "3.53.0-alpha.1"
51
+ "@elliemae/ds-grid": "3.53.0-beta.3",
52
+ "@elliemae/ds-monorepo-devops": "3.53.0-beta.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": "^18.3.1",