@elliemae/ds-popperjs 2.3.1 → 3.0.0-alpha.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 (77) hide show
  1. package/dist/cjs/PopoverArrow.js +91 -0
  2. package/dist/cjs/PopoverArrow.js.map +7 -0
  3. package/dist/cjs/PopoverContent.js +89 -0
  4. package/dist/cjs/PopoverContent.js.map +7 -0
  5. package/dist/cjs/config/useConfigDSPopperjs.js +69 -0
  6. package/dist/cjs/config/useConfigDSPopperjs.js.map +7 -0
  7. package/dist/cjs/config/useConfiguredDefaultModifiers.js +89 -0
  8. package/dist/cjs/config/useConfiguredDefaultModifiers.js.map +7 -0
  9. package/dist/cjs/config/useConfiguredDefaultProps.js +79 -0
  10. package/dist/cjs/config/useConfiguredDefaultProps.js.map +7 -0
  11. package/dist/cjs/config/useConfiguredMergedProps.js +40 -0
  12. package/dist/cjs/config/useConfiguredMergedProps.js.map +7 -0
  13. package/dist/cjs/index.d.js +27 -0
  14. package/dist/cjs/index.d.js.map +7 -0
  15. package/dist/cjs/index.js +115 -0
  16. package/dist/cjs/index.js.map +7 -0
  17. package/dist/cjs/propTypes.js +80 -0
  18. package/dist/cjs/propTypes.js.map +7 -0
  19. package/dist/cjs/styled.js +71 -0
  20. package/dist/cjs/styled.js.map +7 -0
  21. package/dist/cjs/utils/hooks/useOnClickOutside.js +51 -0
  22. package/dist/cjs/utils/hooks/useOnClickOutside.js.map +7 -0
  23. package/dist/esm/PopoverArrow.js +62 -0
  24. package/dist/esm/PopoverArrow.js.map +7 -0
  25. package/dist/esm/PopoverContent.js +62 -0
  26. package/dist/esm/PopoverContent.js.map +7 -0
  27. package/dist/esm/config/useConfigDSPopperjs.js +40 -0
  28. package/dist/esm/config/useConfigDSPopperjs.js.map +7 -0
  29. package/dist/esm/config/useConfiguredDefaultModifiers.js +60 -0
  30. package/dist/esm/config/useConfiguredDefaultModifiers.js.map +7 -0
  31. package/dist/esm/config/useConfiguredDefaultProps.js +52 -0
  32. package/dist/esm/config/useConfiguredDefaultProps.js.map +7 -0
  33. package/dist/esm/config/useConfiguredMergedProps.js +11 -0
  34. package/dist/esm/config/useConfiguredMergedProps.js.map +7 -0
  35. package/dist/esm/index.d.js +2 -0
  36. package/dist/esm/index.d.js.map +7 -0
  37. package/dist/esm/index.js +88 -0
  38. package/dist/esm/index.js.map +7 -0
  39. package/dist/esm/propTypes.js +51 -0
  40. package/dist/esm/propTypes.js.map +7 -0
  41. package/dist/esm/styled.js +42 -0
  42. package/dist/esm/styled.js.map +7 -0
  43. package/dist/esm/utils/hooks/useOnClickOutside.js +22 -0
  44. package/dist/esm/utils/hooks/useOnClickOutside.js.map +7 -0
  45. package/package.json +44 -35
  46. package/cjs/PopoverArrow.js +0 -54
  47. package/cjs/PopoverContent.js +0 -71
  48. package/cjs/config/useConfigDSPopperjs.js +0 -60
  49. package/cjs/config/useConfiguredDefaultModifiers.js +0 -70
  50. package/cjs/config/useConfiguredDefaultProps.js +0 -58
  51. package/cjs/config/useConfiguredMergedProps.js +0 -20
  52. package/cjs/index.d.js +0 -2
  53. package/cjs/index.js +0 -85
  54. package/cjs/propTypes.js +0 -85
  55. package/cjs/styled.js +0 -37
  56. package/cjs/utils/hooks/useOnClickOutside.js +0 -29
  57. package/esm/PopoverArrow.js +0 -45
  58. package/esm/PopoverContent.js +0 -62
  59. package/esm/config/useConfigDSPopperjs.js +0 -56
  60. package/esm/config/useConfiguredDefaultModifiers.js +0 -66
  61. package/esm/config/useConfiguredDefaultProps.js +0 -50
  62. package/esm/config/useConfiguredMergedProps.js +0 -16
  63. package/esm/index.d.js +0 -1
  64. package/esm/index.js +0 -74
  65. package/esm/propTypes.js +0 -81
  66. package/esm/styled.js +0 -27
  67. package/esm/utils/hooks/useOnClickOutside.js +0 -25
  68. package/types/PopoverArrow.d.ts +0 -8
  69. package/types/PopoverContent.d.ts +0 -3
  70. package/types/config/useConfigDSPopperjs.d.ts +0 -2
  71. package/types/config/useConfiguredDefaultModifiers.d.ts +0 -6
  72. package/types/config/useConfiguredDefaultProps.d.ts +0 -19
  73. package/types/config/useConfiguredMergedProps.d.ts +0 -19
  74. package/types/index.d.ts +0 -58
  75. package/types/propTypes.d.ts +0 -95
  76. package/types/styled.d.ts +0 -11
  77. package/types/utils/hooks/useOnClickOutside.d.ts +0 -4
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredDefaultModifiers.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\n\nexport const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {\n // we destructure explicit app definitions before merge\n const {\n boundaryElement: explicitAppBoundaryElement,\n withoutArrow: explicitAppWithoutArrow = false,\n placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],\n customOffset: explictAppOffset = undefined,\n } = props;\n // to build default modifiers on top of it\n const defaultModifiers = useMemo(() => {\n const mod = [];\n mod.push({ name: 'hide', enabled: true });\n mod.push({\n name: 'flip',\n options: {\n fallbackPlacements: explicitPlacementOrderPreference,\n },\n });\n // we apply an offset if the app defines one or if the app wants the arrow\n if (!explicitAppWithoutArrow || explictAppOffset) {\n const defaultOffset = explictAppOffset || [0, 14];\n mod.push({\n name: 'offset',\n enabled: true,\n options: {\n offset: defaultOffset,\n },\n });\n }\n // the app can opt for a \"no arrow\" implementation (we do so in datatable/calendar etc...)\n if (!explicitAppWithoutArrow)\n mod.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n padding: 18,\n },\n });\n\n // the app can define an explicit element to act as a boundary instead of popperjs default one\n if (explicitAppBoundaryElement)\n mod.push({\n name: 'preventOverflow',\n options: {\n boundary: explicitAppBoundaryElement,\n },\n });\n return mod;\n }, [\n arrowElement,\n explicitAppBoundaryElement,\n explicitAppWithoutArrow,\n explicitPlacementOrderPreference,\n explictAppOffset,\n ]);\n // if the app pass custom modifier, we don't use \"default modifiers\"\n const { modifiers: explicitAppModifiers = defaultModifiers } = props;\n\n return useMemo(\n () => ({\n modifiers: explicitAppModifiers,\n }),\n [explicitAppModifiers],\n );\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,gCAAgC,CAAC,EAAE,OAAO,mBAAmB;AAExE,QAAM;AAAA,IACJ,iBAAiB;AAAA,IACjB,cAAc,0BAA0B;AAAA,IACxC,0BAA0B,mCAAmC,CAAC,OAAO,UAAU,QAAQ;AAAA,IACvF,cAAc,mBAAmB;AAAA,MAC/B;AAEJ,QAAM,mBAAmB,QAAQ,MAAM;AACrC,UAAM,MAAM;AACZ,QAAI,KAAK,EAAE,MAAM,QAAQ,SAAS;AAClC,QAAI,KAAK;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,QACP,oBAAoB;AAAA;AAAA;AAIxB,QAAI,CAAC,2BAA2B,kBAAkB;AAChD,YAAM,gBAAgB,oBAAoB,CAAC,GAAG;AAC9C,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,QAAQ;AAAA;AAAA;AAAA;AAKd,QAAI,CAAC;AACH,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,SAAS;AAAA,UACT,SAAS;AAAA;AAAA;AAKf,QAAI;AACF,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,UAAU;AAAA;AAAA;AAGhB,WAAO;AAAA,KACN;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,QAAM,EAAE,WAAW,uBAAuB,qBAAqB;AAE/D,SAAO,QACL,MAAO;AAAA,IACL,WAAW;AAAA,MAEb,CAAC;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,52 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { useMemo } from "react";
22
+ import { useConfiguredDefaultModifiers } from "./useConfiguredDefaultModifiers";
23
+ const noop = () => {
24
+ };
25
+ const emptyObj = {};
26
+ const useConfiguredDefaultProps = ({ props, arrowElement }) => {
27
+ const staticDefaultProps = useMemo(() => ({
28
+ referenceElement: null,
29
+ showPopover: false,
30
+ closeContextMenu: noop,
31
+ onClickOutside: noop,
32
+ withoutPortal: false,
33
+ withoutArrow: false,
34
+ withoutAnimation: false,
35
+ animationDuration: 100,
36
+ portalDOMContainer: document.body,
37
+ startPlacementPreference: "top",
38
+ placementOrderPreference: ["top", "bottom", "left", "right"],
39
+ zIndex: 1,
40
+ extraPopperStyles: emptyObj
41
+ }), []);
42
+ const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({
43
+ props,
44
+ arrowElement
45
+ });
46
+ const defaultProps = useMemo(() => __spreadProps(__spreadValues({}, staticDefaultProps), { modifiers: configuredModifiers }), [configuredModifiers, staticDefaultProps]);
47
+ return defaultProps;
48
+ };
49
+ export {
50
+ useConfiguredDefaultProps
51
+ };
52
+ //# sourceMappingURL=useConfiguredDefaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredDefaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\n\nconst emptyObj = {};\n\nexport const useConfiguredDefaultProps = ({ props, arrowElement }) => {\n // don't move this out of the hook or `document.body` will explode\n const staticDefaultProps = useMemo(\n () => ({\n referenceElement: null,\n showPopover: false,\n closeContextMenu: noop,\n onClickOutside: noop,\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 100,\n portalDOMContainer: document.body,\n startPlacementPreference: 'top',\n placementOrderPreference: ['top', 'bottom', 'left', 'right'],\n zIndex: 1,\n extraPopperStyles: emptyObj,\n }),\n [],\n );\n const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({\n props,\n arrowElement,\n });\n\n const defaultProps = useMemo(\n () => ({ ...staticDefaultProps, modifiers: configuredModifiers }),\n [configuredModifiers, staticDefaultProps],\n );\n\n return defaultProps;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AAGA,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,WAAW;AAEV,MAAM,4BAA4B,CAAC,EAAE,OAAO,mBAAmB;AAEpE,QAAM,qBAAqB,QACzB,MAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,oBAAoB,SAAS;AAAA,IAC7B,0BAA0B;AAAA,IAC1B,0BAA0B,CAAC,OAAO,UAAU,QAAQ;AAAA,IACpD,QAAQ;AAAA,IACR,mBAAmB;AAAA,MAErB;AAEF,QAAM,EAAE,WAAW,wBAAwB,8BAA8B;AAAA,IACvE;AAAA,IACA;AAAA;AAGF,QAAM,eAAe,QACnB,MAAO,iCAAK,qBAAL,EAAyB,WAAW,wBAC3C,CAAC,qBAAqB;AAGxB,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
3
+ import { useConfiguredDefaultProps } from "./useConfiguredDefaultProps";
4
+ const useConfiguredMergedProps = ({ props, arrowElement }) => {
5
+ const defaultProps = useConfiguredDefaultProps({ props, arrowElement });
6
+ return useMemoMergePropsWithDefault(props, defaultProps);
7
+ };
8
+ export {
9
+ useConfiguredMergedProps
10
+ };
11
+ //# sourceMappingURL=useConfiguredMergedProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredMergedProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useConfiguredDefaultProps } from './useConfiguredDefaultProps';\n\nexport const useConfiguredMergedProps = ({ props, arrowElement }) => {\n const defaultProps = useConfiguredDefaultProps({ props, arrowElement });\n\n return useMemoMergePropsWithDefault(props, defaultProps);\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEO,MAAM,2BAA2B,CAAC,EAAE,OAAO,mBAAmB;AACnE,QAAM,eAAe,0BAA0B,EAAE,OAAO;AAExD,SAAO,6BAA6B,OAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,88 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import * as React from "react";
18
+ import React2, { useMemo } from "react";
19
+ import { createPortal } from "react-dom";
20
+ import { describe } from "react-desc";
21
+ import { dspopperjsPropTypes } from "./propTypes";
22
+ import { PopoverContent } from "./PopoverContent";
23
+ import { useConfigDSPopperjs } from "./config/useConfigDSPopperjs";
24
+ const DSPopperJS = (props) => {
25
+ const {
26
+ props: {
27
+ showPopover,
28
+ withoutAnimation,
29
+ animationDuration,
30
+ withoutPortal,
31
+ withoutArrow,
32
+ portalDOMContainer,
33
+ zIndex,
34
+ extraPopperStyles
35
+ },
36
+ setPopperElement,
37
+ setArrowElement,
38
+ setIsAnimating,
39
+ popoverHelper,
40
+ isAnimating
41
+ } = useConfigDSPopperjs(props);
42
+ const { children } = props;
43
+ const { styles, attributes } = popoverHelper;
44
+ const contentJSX = useMemo(() => /* @__PURE__ */ React2.createElement(PopoverContent, {
45
+ setPopperElement,
46
+ popperStyles: __spreadValues(__spreadValues({}, styles.popper), extraPopperStyles),
47
+ popperAttributes: attributes.popper,
48
+ setArrowElement,
49
+ arrowStyle: styles.arrow,
50
+ withoutArrow,
51
+ withoutAnimation,
52
+ animationDuration,
53
+ zIndex,
54
+ showPopover,
55
+ setIsAnimating
56
+ }, children), [
57
+ attributes.popper,
58
+ children,
59
+ setIsAnimating,
60
+ showPopover,
61
+ extraPopperStyles,
62
+ setArrowElement,
63
+ setPopperElement,
64
+ styles.arrow,
65
+ styles.popper,
66
+ withoutArrow,
67
+ withoutAnimation,
68
+ animationDuration,
69
+ zIndex
70
+ ]);
71
+ if (showPopover || isAnimating) {
72
+ if (withoutPortal === true)
73
+ return contentJSX;
74
+ if (withoutPortal === false)
75
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, contentJSX), portalDOMContainer));
76
+ }
77
+ return null;
78
+ };
79
+ DSPopperJS.propTypes = dspopperjsPropTypes;
80
+ const DSPopperJSWithSchema = describe(DSPopperJS).description("A dimsum custom styling wrapper on top of popperjs");
81
+ DSPopperJSWithSchema.propTypes = dspopperjsPropTypes;
82
+ var src_default = DSPopperJS;
83
+ export {
84
+ DSPopperJS,
85
+ DSPopperJSWithSchema,
86
+ src_default as default
87
+ };
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe } from 'react-desc';\nimport { dspopperjsPropTypes } from './propTypes';\nimport { PopoverContent } from './PopoverContent';\nimport { useConfigDSPopperjs } from './config/useConfigDSPopperjs';\nimport type { DSDSPopperjsPropsT } from './index.d';\n\nconst DSPopperJS = (props: DSDSPopperjsPropsT): JSX.Element => {\n const {\n props: {\n showPopover,\n withoutAnimation,\n animationDuration,\n withoutPortal,\n withoutArrow,\n portalDOMContainer,\n zIndex,\n extraPopperStyles,\n },\n setPopperElement,\n setArrowElement,\n setIsAnimating,\n popoverHelper,\n isAnimating,\n } = useConfigDSPopperjs(props);\n const { children } = props;\n const { styles, attributes } = popoverHelper;\n const contentJSX = useMemo(\n () => (\n <PopoverContent\n setPopperElement={setPopperElement}\n popperStyles={{ ...styles.popper, ...extraPopperStyles }}\n popperAttributes={attributes.popper}\n setArrowElement={setArrowElement}\n arrowStyle={styles.arrow}\n withoutArrow={withoutArrow}\n withoutAnimation={withoutAnimation}\n animationDuration={animationDuration}\n zIndex={zIndex}\n showPopover={showPopover}\n setIsAnimating={setIsAnimating}\n >\n {children}\n </PopoverContent>\n ),\n [\n attributes.popper,\n children,\n setIsAnimating,\n showPopover,\n extraPopperStyles,\n setArrowElement,\n setPopperElement,\n styles.arrow,\n styles.popper,\n withoutArrow,\n withoutAnimation,\n animationDuration,\n zIndex,\n ],\n );\n if (showPopover || isAnimating) {\n if (withoutPortal === true) return contentJSX;\n if (withoutPortal === false) return <>{createPortal(<>{contentJSX}</>, portalDOMContainer)}</>;\n }\n return null;\n};\n\nDSPopperJS.propTypes = dspopperjsPropTypes;\n\nconst DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');\nDSPopperJSWithSchema.propTypes = dspopperjsPropTypes;\n\nexport { DSPopperJS, DSPopperJSWithSchema };\nexport default DSPopperJS;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,aAAa,CAAC,UAA2C;AAC7D,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,oBAAoB;AACxB,QAAM,EAAE,aAAa;AACrB,QAAM,EAAE,QAAQ,eAAe;AAC/B,QAAM,aAAa,QACjB,MACE,qCAAC,gBAAD;AAAA,IACE;AAAA,IACA,cAAc,kCAAK,OAAO,SAAW;AAAA,IACrC,kBAAkB,WAAW;AAAA,IAC7B;AAAA,IACA,YAAY,OAAO;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KAEC,WAGL;AAAA,IACE,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGJ,MAAI,eAAe,aAAa;AAC9B,QAAI,kBAAkB;AAAM,aAAO;AACnC,QAAI,kBAAkB;AAAO,aAAO,4DAAG,aAAa,4DAAG,aAAgB;AAAA;AAEzE,SAAO;AAAA;AAGT,WAAW,YAAY;AAEvB,MAAM,uBAAuB,SAAS,YAAY,YAAY;AAC9D,qBAAqB,YAAY;AAGjC,IAAO,cAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "react-desc";
3
+ const dspopperjsPropTypes = {
4
+ referenceElement: PropTypes.element.description("popperjs DOM referenceElement").isRequired,
5
+ showPopover: PropTypes.bool.description("whether or not to show the popper content").isRequired,
6
+ closeContextMenu: PropTypes.func.description('Callback to close the context menu, used for "on click outside", if not provided click outside will not trigger anything').defaultValue("() => {}"),
7
+ withoutPortal: PropTypes.bool.description("Whether or not the popper content should appear in a DOM portal or not").defaultValue(true),
8
+ withoutArrow: PropTypes.bool.description("Whether or not the popper context menu should print the arrow").defaultValue(false),
9
+ withoutAnimation: PropTypes.bool.description("Whether or not the popper context menu should be animated").defaultValue(false),
10
+ animationDuration: PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
11
+ boundaryElement: PropTypes.element.description('Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off').defaultValue(void 0),
12
+ portalDOMContainer: PropTypes.element.description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
13
+ startPlacementPreference: PropTypes.oneOf([
14
+ "top-start",
15
+ "top",
16
+ "top-end",
17
+ "right-start",
18
+ "right",
19
+ "right-end",
20
+ "bottom-end",
21
+ "bottom",
22
+ "bottom-start",
23
+ "left-end",
24
+ "left",
25
+ "left-start"
26
+ ]).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
27
+ placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf([
28
+ "top-start",
29
+ "top",
30
+ "top-end",
31
+ "right-start",
32
+ "right",
33
+ "right-end",
34
+ "bottom-end",
35
+ "bottom",
36
+ "bottom-start",
37
+ "left-end",
38
+ "left",
39
+ "left-start"
40
+ ])).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
41
+ zIndex: PropTypes.number.description("popperjs content z-index").defaultValue(1),
42
+ customOffset: PropTypes.arrayOf(PropTypes.number).description("placement offset array").defaultValue(1),
43
+ modifiers: PropTypes.array.description("modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/").defaultValue(1),
44
+ extraPopperStyles: PropTypes.object.description("Extra object styles to attach to the popper element").defaultValue({}),
45
+ onClickOutside: PropTypes.func.description("Callback triggered when clicking outside the popper").defaultValue(() => null),
46
+ children: PropTypes.node.description("The content of the popper").defaultValue(void 0)
47
+ };
48
+ export {
49
+ dspopperjsPropTypes
50
+ };
51
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\n\nexport const dspopperjsPropTypes = {\n /**\n * React ref to popperjs referenceElement\n */\n referenceElement: PropTypes.element.description('popperjs DOM referenceElement').isRequired,\n /**\n * Wheter or not to show the popper content\n */\n showPopover: PropTypes.bool.description('whether or not to show the popper content').isRequired,\n /**\n * Callback to close the context menu, used for \"on click outside\",\n * if not provided click outside will not trigger anything\n */\n closeContextMenu: PropTypes.func\n .description(\n 'Callback to close the context menu, used for \"on click outside\",' +\n ' if not provided click outside will not trigger anything',\n )\n .defaultValue('() => {}'),\n /**\n * Wheter or not the popper content should appear in a DOM portal or not\n */\n withoutPortal: PropTypes.bool\n .description('Whether or not the popper content should appear in a DOM portal or not')\n .defaultValue(true),\n /**\n * Wheter or not the popper context menu should print the arrow\n */\n withoutArrow: PropTypes.bool\n .description('Whether or not the popper context menu should print the arrow')\n .defaultValue(false),\n /**\n * Whether or not the popper context menu should be animated\n */\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n /**\n * Popper context menus Animation duration in ms\n */\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n /**\n * Bounding element to calculate upon, defaults to it is \"clippingParents\",\n * which are the scrolling containers that may cause the element to be partially or fully cut off.\n */\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 /**\n * When using portal, the container in which to append the DOM content, defaults to document body\n */\n portalDOMContainer: PropTypes.element\n .description('When using portal, the container in which to append the DOM content, defaults to document body')\n .defaultValue(undefined),\n /**\n * start placement preferences, as per popperjs placement option\n */\n startPlacementPreference: PropTypes.oneOf([\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 .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n /**\n * Array of placement preferences, as per popperjs \"flip\" placement option\n */\n placementOrderPreference: PropTypes.arrayOf(\n PropTypes.oneOf([\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 )\n .description('Array of placement preferences, as per popperjs \"flip\" placement option')\n .defaultValue(\"['top', 'bottom', 'left', 'right']\"),\n /**\n * popperjs content z-index\n */\n zIndex: PropTypes.number.description('popperjs content z-index').defaultValue(1),\n /**\n * placement offset array\n */\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue(1),\n /**\n * modifiers array for full-custom popper-js override\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers: PropTypes.array\n .description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/')\n .defaultValue(1),\n extraPopperStyles: PropTypes.object\n .description('Extra object styles to attach to the popper element')\n .defaultValue({}),\n onClickOutside: PropTypes.func\n .description('Callback triggered when clicking outside the popper')\n .defaultValue(() => null),\n children: PropTypes.node.description('The content of the popper').defaultValue(undefined),\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,sBAAsB;AAAA,EAIjC,kBAAkB,UAAU,QAAQ,YAAY,iCAAiC;AAAA,EAIjF,aAAa,UAAU,KAAK,YAAY,6CAA6C;AAAA,EAKrF,kBAAkB,UAAU,KACzB,YACC,4HAGD,aAAa;AAAA,EAIhB,eAAe,UAAU,KACtB,YAAY,0EACZ,aAAa;AAAA,EAIhB,cAAc,UAAU,KACrB,YAAY,iEACZ,aAAa;AAAA,EAIhB,kBAAkB,UAAU,KACzB,YAAY,6DACZ,aAAa;AAAA,EAIhB,mBAAmB,UAAU,OAAO,YAAY,iDAAiD,aAAa;AAAA,EAK9G,iBAAiB,UAAU,QACxB,YACC,gKAGD,aAAa;AAAA,EAIhB,oBAAoB,UAAU,QAC3B,YAAY,kGACZ,aAAa;AAAA,EAIhB,0BAA0B,UAAU,MAAM;AAAA,IACxC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KAEC,YAAY,iEACZ,aAAa;AAAA,EAIhB,0BAA0B,UAAU,QAClC,UAAU,MAAM;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAGD,YAAY,2EACZ,aAAa;AAAA,EAIhB,QAAQ,UAAU,OAAO,YAAY,4BAA4B,aAAa;AAAA,EAI9E,cAAc,UAAU,QAAQ,UAAU,QAAQ,YAAY,0BAA0B,aAAa;AAAA,EAKrG,WAAW,UAAU,MAClB,YAAY,gGACZ,aAAa;AAAA,EAChB,mBAAmB,UAAU,OAC1B,YAAY,uDACZ,aAAa;AAAA,EAChB,gBAAgB,UAAU,KACvB,YAAY,uDACZ,aAAa,MAAM;AAAA,EACtB,UAAU,UAAU,KAAK,YAAY,6BAA6B,aAAa;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ import styled from "styled-components";
3
+ import { kfrm, css } from "@elliemae/ds-system";
4
+ const showAnimation = kfrm`
5
+ from {
6
+ opacity: 0;
7
+ transform: scale(0.8);
8
+ }
9
+
10
+ to {
11
+ opacity: 1;
12
+ transform: scale(1);
13
+ visibility: visible;
14
+ }
15
+ `;
16
+ const hideAnimation = kfrm`
17
+ from {
18
+ opacity: 1;
19
+ transform: scale(1);
20
+ }
21
+
22
+ to {
23
+ opacity: 0;
24
+ transform: scale(0.8);
25
+ visibility: hidden;
26
+ }
27
+ `;
28
+ const StyledPopoverContentWrapper = styled.div`
29
+ z-index: ${({ zIndex }) => zIndex};
30
+ `;
31
+ const StyledAnimatedPopper = styled.div`
32
+ box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 2px 4px rgba(16, 22, 26, 0.2), 0 8px 24px rgba(16, 22, 26, 0.2);
33
+
34
+ ${({ showPopover, animationDuration, withoutAnimation }) => !withoutAnimation && css`
35
+ animation: ${showPopover ? showAnimation : hideAnimation} ${animationDuration}ms ease-in;
36
+ `}
37
+ `;
38
+ export {
39
+ StyledAnimatedPopper,
40
+ StyledPopoverContentWrapper
41
+ };
42
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport { kfrm, css } from '@elliemae/ds-system';\n\ninterface StyledContentWrapperPropsT {\n zIndex: number;\n}\n\ninterface StyledAnimatedPopperPropsT {\n showPopover: boolean;\n animationDuration: number;\n withoutAnimation: boolean;\n}\n\nconst showAnimation = kfrm`\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n visibility: visible;\n }\n`;\n\nconst hideAnimation = kfrm`\n from {\n opacity: 1;\n transform: scale(1);\n }\n\n to {\n opacity: 0;\n transform: scale(0.8);\n visibility: hidden;\n }\n`;\n\nexport const StyledPopoverContentWrapper = styled.div<StyledContentWrapperPropsT>`\n z-index: ${({ zIndex }) => zIndex};\n`;\n\nexport const StyledAnimatedPopper = styled.div<StyledAnimatedPopperPropsT>`\n box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 2px 4px rgba(16, 22, 26, 0.2), 0 8px 24px rgba(16, 22, 26, 0.2);\n\n ${({ showPopover, animationDuration, withoutAnimation }) =>\n !withoutAnimation &&\n css`\n animation: ${showPopover ? showAnimation : hideAnimation} ${animationDuration}ms ease-in;\n `}\n`;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAYA,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAatB,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaf,MAAM,8BAA8B,OAAO;AAAA,aACrC,CAAC,EAAE,aAAa;AAAA;AAGtB,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA,IAGvC,CAAC,EAAE,aAAa,mBAAmB,uBACnC,CAAC,oBACD;AAAA,mBACe,cAAc,gBAAgB,iBAAiB;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { useEffect } from "react";
3
+ function useOnClickOutside(ref, cb) {
4
+ useEffect(() => {
5
+ const listener = (event) => {
6
+ if (!ref || ref?.contains?.(event.target)) {
7
+ return;
8
+ }
9
+ cb(event);
10
+ };
11
+ document.addEventListener("mousedown", listener);
12
+ document.addEventListener("touchstart", listener);
13
+ return () => {
14
+ document.removeEventListener("mousedown", listener);
15
+ document.removeEventListener("touchstart", listener);
16
+ };
17
+ }, [ref, cb]);
18
+ }
19
+ export {
20
+ useOnClickOutside
21
+ };
22
+ //# sourceMappingURL=useOnClickOutside.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/utils/hooks/useOnClickOutside.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect } from 'react';\n\ntype defaultCbt = (e: React.MouseEvent) => void;\nexport function useOnClickOutside<T extends Node, cbT extends defaultCbt>(ref: T, cb: cbT): void {\n useEffect(() => {\n const listener = (event) => {\n // Do nothing if clicking ref's element or descendent elements\n if (!ref || ref?.contains?.(event.target)) {\n return;\n }\n cb(event);\n };\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, cb]);\n}\n"],
5
+ "mappings": "AAAA;ACAA;AAGO,2BAAmE,KAAQ,IAAe;AAC/F,YAAU,MAAM;AACd,UAAM,WAAW,CAAC,UAAU;AAE1B,UAAI,CAAC,OAAO,KAAK,WAAW,MAAM,SAAS;AACzC;AAAA;AAEF,SAAG;AAAA;AAEL,aAAS,iBAAiB,aAAa;AACvC,aAAS,iBAAiB,cAAc;AACxC,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa;AAC1C,eAAS,oBAAoB,cAAc;AAAA;AAAA,KAE5C,CAAC,KAAK;AAAA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,51 +1,54 @@
1
1
  {
2
2
  "name": "@elliemae/ds-popperjs",
3
- "version": "2.3.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Popper JS Wrapper",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
13
16
  },
14
17
  "./utils/hooks/useOnClickOutside": {
15
- "import": "./esm/utils/hooks/useOnClickOutside.js",
16
- "require": "./cjs/utils/hooks/useOnClickOutside.js"
18
+ "import": "./dist/esm/utils/hooks/useOnClickOutside.js",
19
+ "require": "./dist/cjs/utils/hooks/useOnClickOutside.js"
17
20
  },
18
21
  "./styled": {
19
- "import": "./esm/styled.js",
20
- "require": "./cjs/styled.js"
22
+ "import": "./dist/esm/styled.js",
23
+ "require": "./dist/cjs/styled.js"
21
24
  },
22
25
  "./propTypes": {
23
- "import": "./esm/propTypes.js",
24
- "require": "./cjs/propTypes.js"
26
+ "import": "./dist/esm/propTypes.js",
27
+ "require": "./dist/cjs/propTypes.js"
25
28
  },
26
29
  "./PopoverContent": {
27
- "import": "./esm/PopoverContent.js",
28
- "require": "./cjs/PopoverContent.js"
30
+ "import": "./dist/esm/PopoverContent.js",
31
+ "require": "./dist/cjs/PopoverContent.js"
29
32
  },
30
33
  "./PopoverArrow": {
31
- "import": "./esm/PopoverArrow.js",
32
- "require": "./cjs/PopoverArrow.js"
34
+ "import": "./dist/esm/PopoverArrow.js",
35
+ "require": "./dist/cjs/PopoverArrow.js"
33
36
  },
34
37
  "./config/useConfiguredMergedProps": {
35
- "import": "./esm/config/useConfiguredMergedProps.js",
36
- "require": "./cjs/config/useConfiguredMergedProps.js"
38
+ "import": "./dist/esm/config/useConfiguredMergedProps.js",
39
+ "require": "./dist/cjs/config/useConfiguredMergedProps.js"
37
40
  },
38
41
  "./config/useConfiguredDefaultProps": {
39
- "import": "./esm/config/useConfiguredDefaultProps.js",
40
- "require": "./cjs/config/useConfiguredDefaultProps.js"
42
+ "import": "./dist/esm/config/useConfiguredDefaultProps.js",
43
+ "require": "./dist/cjs/config/useConfiguredDefaultProps.js"
41
44
  },
42
45
  "./config/useConfiguredDefaultModifiers": {
43
- "import": "./esm/config/useConfiguredDefaultModifiers.js",
44
- "require": "./cjs/config/useConfiguredDefaultModifiers.js"
46
+ "import": "./dist/esm/config/useConfiguredDefaultModifiers.js",
47
+ "require": "./dist/cjs/config/useConfiguredDefaultModifiers.js"
45
48
  },
46
49
  "./config/useConfigDSPopperjs": {
47
- "import": "./esm/config/useConfigDSPopperjs.js",
48
- "require": "./cjs/config/useConfigDSPopperjs.js"
50
+ "import": "./dist/esm/config/useConfigDSPopperjs.js",
51
+ "require": "./dist/cjs/config/useConfigDSPopperjs.js"
49
52
  }
50
53
  },
51
54
  "sideEffects": [
@@ -57,19 +60,19 @@
57
60
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
58
61
  },
59
62
  "engines": {
60
- "npm": ">=7",
61
- "node": ">=14"
63
+ "pnpm": ">=6",
64
+ "node": ">=16"
62
65
  },
63
66
  "author": "ICE MT",
64
- "scripts": {
65
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
66
- "prebuild": "exit 0",
67
- "predev": "exit 0",
68
- "build": "node ../../scripts/build/build.js"
67
+ "jestSonar": {
68
+ "sonar56x": true,
69
+ "reportPath": "reports",
70
+ "reportFile": "tests.xml",
71
+ "indent": 4
69
72
  },
70
73
  "dependencies": {
71
- "@elliemae/ds-props-helpers": "2.3.1",
72
- "@elliemae/ds-system": "2.3.1",
74
+ "@elliemae/ds-props-helpers": "3.0.0-alpha.3",
75
+ "@elliemae/ds-system": "3.0.0-alpha.3",
73
76
  "react-desc": "~4.1.3",
74
77
  "react-popper": "~2.2.5"
75
78
  },
@@ -83,7 +86,13 @@
83
86
  },
84
87
  "publishConfig": {
85
88
  "access": "public",
86
- "directory": "dist",
87
- "generateSubmodules": true
89
+ "typeSafety": false
90
+ },
91
+ "scripts": {
92
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
93
+ "test": "node ../../scripts/testing/test.mjs",
94
+ "lint": "node ../../scripts/lint.mjs",
95
+ "dts": "node ../../scripts/dts.mjs",
96
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
88
97
  }
89
98
  }
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('react');
7
- var styled = require('styled-components');
8
- var jsxRuntime = require('react/jsx-runtime');
9
-
10
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
-
12
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
13
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
14
-
15
- var _svg;
16
- const arrowWidth = 18;
17
- const arrowHeight = 18;
18
- const StyledArrow = /*#__PURE__*/styled__default["default"].div.withConfig({
19
- componentId: "sc-olcdf1-0"
20
- })(["position:absolute;width:", "px;height:", "px;pointer-events:none;background-color:transparent;& .stroke{fill:", ";fill-opacity:0.4;}& .fill{fill:", ";}&[data-placement^='top']{svg{transform:rotateZ(180deg);}bottom:-", "px;}&[data-placement^='right']{svg{transform:rotateZ(-90deg);}left:-", "px;}&[data-placement^='bottom']{top:-", "px;}&[data-placement^='left']{svg{transform:rotateZ(90deg);}right:-", "px;}margin-left:", ";margin-top:", ";"], arrowWidth, arrowHeight, _ref => {
21
- let {
22
- theme
23
- } = _ref;
24
- return theme.colors.neutral['500'];
25
- }, _ref2 => {
26
- let {
27
- theme
28
- } = _ref2;
29
- return theme.colors.neutral['000'];
30
- }, arrowHeight, arrowWidth, arrowHeight, arrowWidth, props => props['data-placement'].startsWith('top') || props['data-placement'].startsWith('bottom') ? "-".concat(arrowWidth / 2, "px;") : '0;', props => props['data-placement'].startsWith('left') || props['data-placement'].startsWith('right') ? "-".concat(arrowHeight / 2, "px;") : '0;');
31
- const PopoverArrow = _ref3 => {
32
- let {
33
- placement,
34
- style,
35
- arrowElementRef
36
- } = _ref3;
37
- return /*#__PURE__*/jsxRuntime.jsx(StyledArrow, {
38
- "data-placement": placement,
39
- style: style,
40
- ref: arrowElementRef,
41
- "data-testid": "ds-tooltip-arrow",
42
- children: _svg || (_svg = /*#__PURE__*/_jsx__default["default"]("svg", {
43
- viewBox: "0 0 30 30"
44
- }, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
45
- className: "stroke",
46
- d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
47
- }), /*#__PURE__*/_jsx__default["default"]("path", {
48
- className: "fill",
49
- d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
50
- })))
51
- }, "popper-arrow");
52
- };
53
-
54
- exports.PopoverArrow = PopoverArrow;
@@ -1,71 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
- var _jsx = require('@babel/runtime/helpers/jsx');
12
- var react = require('react');
13
- var PopoverArrow = require('./PopoverArrow.js');
14
- var styled = require('./styled.js');
15
- var jsxRuntime = require('react/jsx-runtime');
16
-
17
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
-
19
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
20
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
- const PopoverContent = _ref => {
26
- let {
27
- setPopperElement,
28
- popperStyles,
29
- popperAttributes,
30
- children,
31
- showPopover,
32
- setArrowElement,
33
- setIsAnimating,
34
- arrowStyle,
35
- withoutArrow,
36
- withoutAnimation,
37
- animationDuration,
38
- zIndex
39
- } = _ref;
40
- const checkAnimationStatus = react.useCallback(() => {
41
- if (!showPopover && !withoutAnimation) {
42
- setIsAnimating(false);
43
- }
44
- }, [showPopover, withoutAnimation, setIsAnimating]);
45
- const popperContent = react.useMemo(() => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
46
- children: [children, withoutArrow === false ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
47
- children: [/*#__PURE__*/_jsx__default["default"](PopoverArrow.PopoverArrow, {
48
- arrowElementRef: setArrowElement,
49
- style: arrowStyle,
50
- placement: popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'
51
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
52
- ref: setArrowElement,
53
- style: arrowStyle
54
- })]
55
- }) : null]
56
- }), [children, withoutArrow, arrowStyle, popperAttributes, setArrowElement]);
57
- return /*#__PURE__*/jsxRuntime.jsx(styled.StyledPopoverContentWrapper, _objectSpread(_objectSpread({
58
- zIndex: zIndex,
59
- ref: setPopperElement,
60
- style: popperStyles
61
- }, popperAttributes), {}, {
62
- children: /*#__PURE__*/_jsx__default["default"](styled.StyledAnimatedPopper, {
63
- showPopover: showPopover,
64
- animationDuration: animationDuration,
65
- withoutAnimation: withoutAnimation,
66
- onAnimationEnd: checkAnimationStatus
67
- }, void 0, popperContent)
68
- }));
69
- };
70
-
71
- exports.PopoverContent = PopoverContent;