@elliemae/ds-popperjs 1.55.0-next.9 → 1.55.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/config/useConfiguredDefaultProps.js +3 -1
- package/cjs/config/useConfiguredDefaultProps.js.map +1 -1
- package/cjs/index.js +9 -3
- package/cjs/index.js.map +1 -1
- package/cjs/propTypes.js +2 -1
- package/cjs/propTypes.js.map +1 -1
- package/esm/config/useConfiguredDefaultProps.js +3 -1
- package/esm/config/useConfiguredDefaultProps.js.map +1 -1
- package/esm/index.js +8 -3
- package/esm/index.js.map +1 -1
- package/esm/propTypes.js +2 -1
- package/esm/propTypes.js.map +1 -1
- package/package.json +3 -3
|
@@ -16,6 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
|
|
17
17
|
var noop = function noop() {};
|
|
18
18
|
|
|
19
|
+
var emptyObj = {};
|
|
19
20
|
var useConfiguredDefaultProps = function useConfiguredDefaultProps(_ref) {
|
|
20
21
|
var props = _ref.props,
|
|
21
22
|
arrowElement = _ref.arrowElement;
|
|
@@ -30,7 +31,8 @@ var useConfiguredDefaultProps = function useConfiguredDefaultProps(_ref) {
|
|
|
30
31
|
portalDOMContainer: document.body,
|
|
31
32
|
startPlacementPreference: 'top',
|
|
32
33
|
placementOrderPreference: ['top', 'bottom', 'left', 'right'],
|
|
33
|
-
zIndex: 1
|
|
34
|
+
zIndex: 1,
|
|
35
|
+
extraPopperStyles: emptyObj
|
|
34
36
|
};
|
|
35
37
|
}, []);
|
|
36
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfiguredDefaultProps.js","sources":["../../../src/config/useConfiguredDefaultProps.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\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 withoutPortal: false,\n withoutArrow: false,\n portalDOMContainer: document.body,\n startPlacementPreference: 'top',\n placementOrderPreference: ['top', 'bottom', 'left', 'right'],\n zIndex: 1,\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"],"names":["noop","useConfiguredDefaultProps","props","arrowElement","staticDefaultProps","useMemo","referenceElement","showPopover","closeContextMenu","withoutPortal","withoutArrow","portalDOMContainer","document","body","startPlacementPreference","placementOrderPreference","zIndex","useConfiguredDefaultModifiers","configuredModifiers","modifiers","defaultProps"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM,EAAnB;;IAEaC,yBAAyB,GAAG,SAA5BA,yBAA4B,OAA6B;AAAA,MAA1BC,KAA0B,QAA1BA,KAA0B;AAAA,MAAnBC,YAAmB,QAAnBA,YAAmB;AACpE;AACA,MAAMC,kBAAkB,GAAGC,aAAO,CAChC;AAAA,WAAO;AACLC,MAAAA,gBAAgB,EAAE,IADb;AAELC,MAAAA,WAAW,EAAE,KAFR;AAGLC,MAAAA,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useConfiguredDefaultProps.js","sources":["../../../src/config/useConfiguredDefaultProps.tsx"],"sourcesContent":["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 withoutPortal: false,\n withoutArrow: false,\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"],"names":["noop","emptyObj","useConfiguredDefaultProps","props","arrowElement","staticDefaultProps","useMemo","referenceElement","showPopover","closeContextMenu","withoutPortal","withoutArrow","portalDOMContainer","document","body","startPlacementPreference","placementOrderPreference","zIndex","extraPopperStyles","useConfiguredDefaultModifiers","configuredModifiers","modifiers","defaultProps"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM,EAAnB;;AAEA,IAAMC,QAAQ,GAAG,EAAjB;IAEaC,yBAAyB,GAAG,SAA5BA,yBAA4B,OAA6B;AAAA,MAA1BC,KAA0B,QAA1BA,KAA0B;AAAA,MAAnBC,YAAmB,QAAnBA,YAAmB;AACpE;AACA,MAAMC,kBAAkB,GAAGC,aAAO,CAChC;AAAA,WAAO;AACLC,MAAAA,gBAAgB,EAAE,IADb;AAELC,MAAAA,WAAW,EAAE,KAFR;AAGLC,MAAAA,gBAAgB,EAAET,IAHb;AAILU,MAAAA,aAAa,EAAE,KAJV;AAKLC,MAAAA,YAAY,EAAE,KALT;AAMLC,MAAAA,kBAAkB,EAAEC,QAAQ,CAACC,IANxB;AAOLC,MAAAA,wBAAwB,EAAE,KAPrB;AAQLC,MAAAA,wBAAwB,EAAE,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CARrB;AASLC,MAAAA,MAAM,EAAE,CATH;AAULC,MAAAA,iBAAiB,EAAEjB;AAVd,KAAP;AAAA,GADgC,EAahC,EAbgC,CAAlC;;AAeA,8BAA2CkB,kEAA6B,CAAC;AACvEhB,IAAAA,KAAK,EAALA,KADuE;AAEvEC,IAAAA,YAAY,EAAZA;AAFuE,GAAD,CAAxE;AAAA,MAAmBgB,mBAAnB,yBAAQC,SAAR;;AAKA,MAAMC,YAAY,GAAGhB,aAAO,CAC1B;AAAA,2CAAYD,kBAAZ;AAAgCgB,MAAAA,SAAS,EAAED;AAA3C;AAAA,GAD0B,EAE1B,CAACA,mBAAD,EAAsBf,kBAAtB,CAF0B,CAA5B;AAKA,SAAOiB,YAAP;AACD;;;;"}
|
package/cjs/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var reactDom = require('react-dom');
|
|
7
8
|
var reactDesc = require('react-desc');
|
|
@@ -16,14 +17,18 @@ require('react-popper');
|
|
|
16
17
|
require('./config/useConfiguredMergedProps.js');
|
|
17
18
|
require('@elliemae/ds-props-helpers');
|
|
18
19
|
require('./config/useConfiguredDefaultProps.js');
|
|
19
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
20
20
|
require('./config/useConfiguredDefaultModifiers.js');
|
|
21
21
|
require('./utils/hooks/useOnClickOutside.js');
|
|
22
22
|
|
|
23
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
24
|
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
27
|
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
27
32
|
var DSPopperJS = function DSPopperJS(props) {
|
|
28
33
|
var _useConfigDSPopperjs = config_useConfigDSPopperjs.useConfigDSPopperjs(props),
|
|
29
34
|
_useConfigDSPopperjs$ = _useConfigDSPopperjs.props,
|
|
@@ -32,6 +37,7 @@ var DSPopperJS = function DSPopperJS(props) {
|
|
|
32
37
|
withoutArrow = _useConfigDSPopperjs$.withoutArrow,
|
|
33
38
|
portalDOMContainer = _useConfigDSPopperjs$.portalDOMContainer,
|
|
34
39
|
zIndex = _useConfigDSPopperjs$.zIndex,
|
|
40
|
+
extraPopperStyles = _useConfigDSPopperjs$.extraPopperStyles,
|
|
35
41
|
setPopperElement = _useConfigDSPopperjs.setPopperElement,
|
|
36
42
|
setArrowElement = _useConfigDSPopperjs.setArrowElement,
|
|
37
43
|
popoverHelper = _useConfigDSPopperjs.popoverHelper;
|
|
@@ -42,14 +48,14 @@ var DSPopperJS = function DSPopperJS(props) {
|
|
|
42
48
|
var contentJSX = React.useMemo(function () {
|
|
43
49
|
return /*#__PURE__*/React__default['default'].createElement(PopoverContent.PopoverContent, {
|
|
44
50
|
setPopperElement: setPopperElement,
|
|
45
|
-
popperStyles: styles.popper,
|
|
51
|
+
popperStyles: _objectSpread(_objectSpread({}, styles.popper), extraPopperStyles),
|
|
46
52
|
popperAttributes: attributes.popper,
|
|
47
53
|
setArrowElement: setArrowElement,
|
|
48
54
|
arrowStyle: styles.arrow,
|
|
49
55
|
withoutArrow: withoutArrow,
|
|
50
56
|
zIndex: zIndex
|
|
51
57
|
}, children);
|
|
52
|
-
}, [attributes.popper, children, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
|
|
58
|
+
}, [attributes.popper, children, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
|
|
53
59
|
|
|
54
60
|
if (showPopover) {
|
|
55
61
|
if (withoutPortal === true) return contentJSX;
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["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: { showPopover, withoutPortal, withoutArrow, portalDOMContainer, zIndex },\n setPopperElement,\n setArrowElement,\n popoverHelper,\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}\n popperAttributes={attributes.popper}\n setArrowElement={setArrowElement}\n arrowStyle={styles.arrow}\n withoutArrow={withoutArrow}\n zIndex={zIndex}\n >\n {children}\n </PopoverContent>\n ),\n [attributes.popper
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["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: { showPopover, withoutPortal, withoutArrow, portalDOMContainer, zIndex, extraPopperStyles },\n setPopperElement,\n setArrowElement,\n popoverHelper,\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 zIndex={zIndex}\n >\n {children}\n </PopoverContent>\n ),\n [\n attributes.popper,\n children,\n extraPopperStyles,\n setArrowElement,\n setPopperElement,\n styles.arrow,\n styles.popper,\n withoutArrow,\n zIndex,\n ],\n );\n if (showPopover) {\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"],"names":["DSPopperJS","props","useConfigDSPopperjs","showPopover","withoutPortal","withoutArrow","portalDOMContainer","zIndex","extraPopperStyles","setPopperElement","setArrowElement","popoverHelper","children","styles","attributes","contentJSX","useMemo","React","PopoverContent","popper","arrow","createPortal","propTypes","dspopperjsPropTypes","DSPopperJSWithSchema","describe","description"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQMA,UAAU,GAAG,SAAbA,UAAa,CAACC,KAAD,EAA4C;AAC7D,6BAKIC,8CAAmB,CAACD,KAAD,CALvB;AAAA,mDACEA,KADF;AAAA,MACWE,WADX,yBACWA,WADX;AAAA,MACwBC,aADxB,yBACwBA,aADxB;AAAA,MACuCC,YADvC,yBACuCA,YADvC;AAAA,MACqDC,kBADrD,yBACqDA,kBADrD;AAAA,MACyEC,MADzE,yBACyEA,MADzE;AAAA,MACiFC,iBADjF,yBACiFA,iBADjF;AAAA,MAEEC,gBAFF,wBAEEA,gBAFF;AAAA,MAGEC,eAHF,wBAGEA,eAHF;AAAA,MAIEC,aAJF,wBAIEA,aAJF;;AAMA,MAAQC,QAAR,GAAqBX,KAArB,CAAQW,QAAR;AACA,MAAQC,MAAR,GAA+BF,aAA/B,CAAQE,MAAR;AAAA,MAAgBC,UAAhB,GAA+BH,aAA/B,CAAgBG,UAAhB;AACA,MAAMC,UAAU,GAAGC,aAAO,CACxB;AAAA,wBACEC,wCAACC,6BAAD;AACE,MAAA,gBAAgB,EAAET,gBADpB;AAEE,MAAA,YAAY,kCAAOI,MAAM,CAACM,MAAd,GAAyBX,iBAAzB,CAFd;AAGE,MAAA,gBAAgB,EAAEM,UAAU,CAACK,MAH/B;AAIE,MAAA,eAAe,EAAET,eAJnB;AAKE,MAAA,UAAU,EAAEG,MAAM,CAACO,KALrB;AAME,MAAA,YAAY,EAAEf,YANhB;AAOE,MAAA,MAAM,EAAEE;AAPV,OASGK,QATH,CADF;AAAA,GADwB,EAcxB,CACEE,UAAU,CAACK,MADb,EAEEP,QAFF,EAGEJ,iBAHF,EAIEE,eAJF,EAKED,gBALF,EAMEI,MAAM,CAACO,KANT,EAOEP,MAAM,CAACM,MAPT,EAQEd,YARF,EASEE,MATF,CAdwB,CAA1B;;AA0BA,MAAIJ,WAAJ,EAAiB;AACf,QAAIC,aAAa,KAAK,IAAtB,EAA4B,OAAOW,UAAP;AAC5B,QAAIX,aAAa,KAAK,KAAtB,EAA6B,oBAAOa,+FAAGI,qBAAY,eAACJ,kFAAGF,UAAH,CAAD,EAAoBT,kBAApB,CAAf,CAAP;AAC9B;;AACD,SAAO,IAAP;AACD;;AAEDN,UAAU,CAACsB,SAAX,GAAuBC,6BAAvB;IAEMC,oBAAoB,GAAGC,kBAAQ,CAACzB,UAAD,CAAR,CAAqB0B,WAArB,CAAiC,oDAAjC;AAC7BF,oBAAoB,CAACF,SAArB,GAAiCC,6BAAjC;;;;;;"}
|
package/cjs/propTypes.js
CHANGED
|
@@ -66,7 +66,8 @@ var dspopperjsPropTypes = {
|
|
|
66
66
|
* modifiers array for full-custom popper-js override
|
|
67
67
|
* https://popper.js.org/docs/v2/modifiers/
|
|
68
68
|
*/
|
|
69
|
-
modifiers: reactDesc.PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1)
|
|
69
|
+
modifiers: reactDesc.PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
|
|
70
|
+
extraPopperStyles: reactDesc.PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({})
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
exports.dspopperjsPropTypes = dspopperjsPropTypes;
|
package/cjs/propTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propTypes.js","sources":["../../src/propTypes.tsx"],"sourcesContent":["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 * 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};\n"],"names":["dspopperjsPropTypes","referenceElement","PropTypes","element","description","isRequired","showPopover","bool","closeContextMenu","func","defaultValue","withoutPortal","withoutArrow","boundaryElement","undefined","portalDOMContainer","startPlacementPreference","oneOf","placementOrderPreference","arrayOf","zIndex","number","customOffset","modifiers","array"],"mappings":";;;;;;IAEaA,mBAAmB,GAAG;AACjC;AACF;AACA;AACEC,EAAAA,gBAAgB,EAAEC,mBAAS,CAACC,OAAV,CAAkBC,WAAlB,CAA8B,+BAA9B,EAA+DC,UAJhD;;AAKjC;AACF;AACA;AACEC,EAAAA,WAAW,EAAEJ,mBAAS,CAACK,IAAV,CAAeH,WAAf,CAA2B,2CAA3B,EAAwEC,UARpD;;AASjC;AACF;AACA;AACA;AACEG,EAAAA,gBAAgB,EAAEN,mBAAS,CAACO,IAAV,CACfL,WADe,CAEd,qEACE,0DAHY,EAKfM,YALe,CAKF,UALE,CAbe;;AAmBjC;AACF;AACA;AACEC,EAAAA,aAAa,EAAET,mBAAS,CAACK,IAAV,CACZH,WADY,CACA,wEADA,EAEZM,YAFY,CAEC,IAFD,CAtBkB;;AAyBjC;AACF;AACA;AACEE,EAAAA,YAAY,EAAEV,mBAAS,CAACK,IAAV,CACXH,WADW,CACC,+DADD,EAEXM,YAFW,CAEE,KAFF,CA5BmB;;AA+BjC;AACF;AACA;AACA;AACEG,EAAAA,eAAe,EAAEX,mBAAS,CAACC,OAAV,CACdC,WADc,CAEb,uEACE,4FAHW,EAKdM,YALc,CAKDI,SALC,CAnCgB;;AAyCjC;AACF;AACA;AACEC,EAAAA,kBAAkB,EAAEb,mBAAS,CAACC,OAAV,CACjBC,WADiB,CACL,gGADK,EAEjBM,YAFiB,CAEJI,SAFI,CA5Ca;;AA+CjC;AACF;AACA;AACEE,EAAAA,wBAAwB,EAAEd,mBAAS,CAACe,KAAV,CAAgB,CACxC,WADwC,EAExC,KAFwC,EAGxC,SAHwC,EAIxC,aAJwC,EAKxC,OALwC,EAMxC,WANwC,EAOxC,YAPwC,EAQxC,QARwC,EASxC,cATwC,EAUxC,UAVwC,EAWxC,MAXwC,EAYxC,YAZwC,CAAhB,EAcvBb,WAduB,CAcX,+DAdW,EAevBM,YAfuB,CAeV,OAfU,CAlDO;;AAkEjC;AACF;AACA;AACEQ,EAAAA,wBAAwB,EAAEhB,mBAAS,CAACiB,OAAV,CACxBjB,mBAAS,CAACe,KAAV,CAAgB,CACd,WADc,EAEd,KAFc,EAGd,SAHc,EAId,aAJc,EAKd,OALc,EAMd,WANc,EAOd,YAPc,EAQd,QARc,EASd,cATc,EAUd,UAVc,EAWd,MAXc,EAYd,YAZc,CAAhB,CADwB,EAgBvBb,WAhBuB,CAgBX,yEAhBW,EAiBvBM,YAjBuB,CAiBV,oCAjBU,CArEO;;AAuFjC;AACF;AACA;AACEU,EAAAA,MAAM,EAAElB,mBAAS,CAACmB,MAAV,CAAiBjB,WAAjB,CAA6B,0BAA7B,EAAyDM,YAAzD,CAAsE,CAAtE,CA1FyB;;AA2FjC;AACF;AACA;AACEY,EAAAA,YAAY,EAAEpB,mBAAS,CAACiB,OAAV,CAAkBjB,mBAAS,CAACmB,MAA5B,EAAoCjB,WAApC,CAAgD,wBAAhD,EAA0EM,YAA1E,CAAuF,CAAvF,CA9FmB;;AA+FjC;AACF;AACA;AACA;AACEa,EAAAA,SAAS,EAAErB,mBAAS,CAACsB,KAAV,CACRpB,WADQ,CACI,8FADJ,EAERM,YAFQ,CAEK,CAFL;
|
|
1
|
+
{"version":3,"file":"propTypes.js","sources":["../../src/propTypes.tsx"],"sourcesContent":["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 * 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};\n"],"names":["dspopperjsPropTypes","referenceElement","PropTypes","element","description","isRequired","showPopover","bool","closeContextMenu","func","defaultValue","withoutPortal","withoutArrow","boundaryElement","undefined","portalDOMContainer","startPlacementPreference","oneOf","placementOrderPreference","arrayOf","zIndex","number","customOffset","modifiers","array","extraPopperStyles","object"],"mappings":";;;;;;IAEaA,mBAAmB,GAAG;AACjC;AACF;AACA;AACEC,EAAAA,gBAAgB,EAAEC,mBAAS,CAACC,OAAV,CAAkBC,WAAlB,CAA8B,+BAA9B,EAA+DC,UAJhD;;AAKjC;AACF;AACA;AACEC,EAAAA,WAAW,EAAEJ,mBAAS,CAACK,IAAV,CAAeH,WAAf,CAA2B,2CAA3B,EAAwEC,UARpD;;AASjC;AACF;AACA;AACA;AACEG,EAAAA,gBAAgB,EAAEN,mBAAS,CAACO,IAAV,CACfL,WADe,CAEd,qEACE,0DAHY,EAKfM,YALe,CAKF,UALE,CAbe;;AAmBjC;AACF;AACA;AACEC,EAAAA,aAAa,EAAET,mBAAS,CAACK,IAAV,CACZH,WADY,CACA,wEADA,EAEZM,YAFY,CAEC,IAFD,CAtBkB;;AAyBjC;AACF;AACA;AACEE,EAAAA,YAAY,EAAEV,mBAAS,CAACK,IAAV,CACXH,WADW,CACC,+DADD,EAEXM,YAFW,CAEE,KAFF,CA5BmB;;AA+BjC;AACF;AACA;AACA;AACEG,EAAAA,eAAe,EAAEX,mBAAS,CAACC,OAAV,CACdC,WADc,CAEb,uEACE,4FAHW,EAKdM,YALc,CAKDI,SALC,CAnCgB;;AAyCjC;AACF;AACA;AACEC,EAAAA,kBAAkB,EAAEb,mBAAS,CAACC,OAAV,CACjBC,WADiB,CACL,gGADK,EAEjBM,YAFiB,CAEJI,SAFI,CA5Ca;;AA+CjC;AACF;AACA;AACEE,EAAAA,wBAAwB,EAAEd,mBAAS,CAACe,KAAV,CAAgB,CACxC,WADwC,EAExC,KAFwC,EAGxC,SAHwC,EAIxC,aAJwC,EAKxC,OALwC,EAMxC,WANwC,EAOxC,YAPwC,EAQxC,QARwC,EASxC,cATwC,EAUxC,UAVwC,EAWxC,MAXwC,EAYxC,YAZwC,CAAhB,EAcvBb,WAduB,CAcX,+DAdW,EAevBM,YAfuB,CAeV,OAfU,CAlDO;;AAkEjC;AACF;AACA;AACEQ,EAAAA,wBAAwB,EAAEhB,mBAAS,CAACiB,OAAV,CACxBjB,mBAAS,CAACe,KAAV,CAAgB,CACd,WADc,EAEd,KAFc,EAGd,SAHc,EAId,aAJc,EAKd,OALc,EAMd,WANc,EAOd,YAPc,EAQd,QARc,EASd,cATc,EAUd,UAVc,EAWd,MAXc,EAYd,YAZc,CAAhB,CADwB,EAgBvBb,WAhBuB,CAgBX,yEAhBW,EAiBvBM,YAjBuB,CAiBV,oCAjBU,CArEO;;AAuFjC;AACF;AACA;AACEU,EAAAA,MAAM,EAAElB,mBAAS,CAACmB,MAAV,CAAiBjB,WAAjB,CAA6B,0BAA7B,EAAyDM,YAAzD,CAAsE,CAAtE,CA1FyB;;AA2FjC;AACF;AACA;AACEY,EAAAA,YAAY,EAAEpB,mBAAS,CAACiB,OAAV,CAAkBjB,mBAAS,CAACmB,MAA5B,EAAoCjB,WAApC,CAAgD,wBAAhD,EAA0EM,YAA1E,CAAuF,CAAvF,CA9FmB;;AA+FjC;AACF;AACA;AACA;AACEa,EAAAA,SAAS,EAAErB,mBAAS,CAACsB,KAAV,CACRpB,WADQ,CACI,8FADJ,EAERM,YAFQ,CAEK,CAFL,CAnGsB;AAsGjCe,EAAAA,iBAAiB,EAAEvB,mBAAS,CAACwB,MAAV,CAChBtB,WADgB,CACJ,qDADI,EAEhBM,YAFgB,CAEH,EAFG;AAtGc;;;;"}
|
|
@@ -8,6 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
var noop = function noop() {};
|
|
10
10
|
|
|
11
|
+
var emptyObj = {};
|
|
11
12
|
var useConfiguredDefaultProps = function useConfiguredDefaultProps(_ref) {
|
|
12
13
|
var props = _ref.props,
|
|
13
14
|
arrowElement = _ref.arrowElement;
|
|
@@ -22,7 +23,8 @@ var useConfiguredDefaultProps = function useConfiguredDefaultProps(_ref) {
|
|
|
22
23
|
portalDOMContainer: document.body,
|
|
23
24
|
startPlacementPreference: 'top',
|
|
24
25
|
placementOrderPreference: ['top', 'bottom', 'left', 'right'],
|
|
25
|
-
zIndex: 1
|
|
26
|
+
zIndex: 1,
|
|
27
|
+
extraPopperStyles: emptyObj
|
|
26
28
|
};
|
|
27
29
|
}, []);
|
|
28
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfiguredDefaultProps.js","sources":["../../../src/config/useConfiguredDefaultProps.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\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 withoutPortal: false,\n withoutArrow: false,\n portalDOMContainer: document.body,\n startPlacementPreference: 'top',\n placementOrderPreference: ['top', 'bottom', 'left', 'right'],\n zIndex: 1,\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"],"names":["noop","useConfiguredDefaultProps","props","arrowElement","staticDefaultProps","useMemo","referenceElement","showPopover","closeContextMenu","withoutPortal","withoutArrow","portalDOMContainer","document","body","startPlacementPreference","placementOrderPreference","zIndex","useConfiguredDefaultModifiers","configuredModifiers","modifiers","defaultProps"],"mappings":";;;;;;;;AAIA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM,EAAnB;;IAEaC,yBAAyB,GAAG,SAA5BA,yBAA4B,OAA6B;AAAA,MAA1BC,KAA0B,QAA1BA,KAA0B;AAAA,MAAnBC,YAAmB,QAAnBA,YAAmB;AACpE;AACA,MAAMC,kBAAkB,GAAGC,OAAO,CAChC;AAAA,WAAO;AACLC,MAAAA,gBAAgB,EAAE,IADb;AAELC,MAAAA,WAAW,EAAE,KAFR;AAGLC,MAAAA,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useConfiguredDefaultProps.js","sources":["../../../src/config/useConfiguredDefaultProps.tsx"],"sourcesContent":["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 withoutPortal: false,\n withoutArrow: false,\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"],"names":["noop","emptyObj","useConfiguredDefaultProps","props","arrowElement","staticDefaultProps","useMemo","referenceElement","showPopover","closeContextMenu","withoutPortal","withoutArrow","portalDOMContainer","document","body","startPlacementPreference","placementOrderPreference","zIndex","extraPopperStyles","useConfiguredDefaultModifiers","configuredModifiers","modifiers","defaultProps"],"mappings":";;;;;;;;AAIA,IAAMA,IAAI,GAAG,SAAPA,IAAO,GAAM,EAAnB;;AAEA,IAAMC,QAAQ,GAAG,EAAjB;IAEaC,yBAAyB,GAAG,SAA5BA,yBAA4B,OAA6B;AAAA,MAA1BC,KAA0B,QAA1BA,KAA0B;AAAA,MAAnBC,YAAmB,QAAnBA,YAAmB;AACpE;AACA,MAAMC,kBAAkB,GAAGC,OAAO,CAChC;AAAA,WAAO;AACLC,MAAAA,gBAAgB,EAAE,IADb;AAELC,MAAAA,WAAW,EAAE,KAFR;AAGLC,MAAAA,gBAAgB,EAAET,IAHb;AAILU,MAAAA,aAAa,EAAE,KAJV;AAKLC,MAAAA,YAAY,EAAE,KALT;AAMLC,MAAAA,kBAAkB,EAAEC,QAAQ,CAACC,IANxB;AAOLC,MAAAA,wBAAwB,EAAE,KAPrB;AAQLC,MAAAA,wBAAwB,EAAE,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CARrB;AASLC,MAAAA,MAAM,EAAE,CATH;AAULC,MAAAA,iBAAiB,EAAEjB;AAVd,KAAP;AAAA,GADgC,EAahC,EAbgC,CAAlC;;AAeA,8BAA2CkB,6BAA6B,CAAC;AACvEhB,IAAAA,KAAK,EAALA,KADuE;AAEvEC,IAAAA,YAAY,EAAZA;AAFuE,GAAD,CAAxE;AAAA,MAAmBgB,mBAAnB,yBAAQC,SAAR;;AAKA,MAAMC,YAAY,GAAGhB,OAAO,CAC1B;AAAA,2CAAYD,kBAAZ;AAAgCgB,MAAAA,SAAS,EAAED;AAA3C;AAAA,GAD0B,EAE1B,CAACA,mBAAD,EAAsBf,kBAAtB,CAF0B,CAA5B;AAKA,SAAOiB,YAAP;AACD;;;;"}
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
1
2
|
import React, { useMemo } from 'react';
|
|
2
3
|
import { createPortal } from 'react-dom';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
@@ -12,10 +13,13 @@ import 'react-popper';
|
|
|
12
13
|
import './config/useConfiguredMergedProps.js';
|
|
13
14
|
import '@elliemae/ds-props-helpers';
|
|
14
15
|
import './config/useConfiguredDefaultProps.js';
|
|
15
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
16
16
|
import './config/useConfiguredDefaultModifiers.js';
|
|
17
17
|
import './utils/hooks/useOnClickOutside.js';
|
|
18
18
|
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
+
|
|
19
23
|
var DSPopperJS = function DSPopperJS(props) {
|
|
20
24
|
var _useConfigDSPopperjs = useConfigDSPopperjs(props),
|
|
21
25
|
_useConfigDSPopperjs$ = _useConfigDSPopperjs.props,
|
|
@@ -24,6 +28,7 @@ var DSPopperJS = function DSPopperJS(props) {
|
|
|
24
28
|
withoutArrow = _useConfigDSPopperjs$.withoutArrow,
|
|
25
29
|
portalDOMContainer = _useConfigDSPopperjs$.portalDOMContainer,
|
|
26
30
|
zIndex = _useConfigDSPopperjs$.zIndex,
|
|
31
|
+
extraPopperStyles = _useConfigDSPopperjs$.extraPopperStyles,
|
|
27
32
|
setPopperElement = _useConfigDSPopperjs.setPopperElement,
|
|
28
33
|
setArrowElement = _useConfigDSPopperjs.setArrowElement,
|
|
29
34
|
popoverHelper = _useConfigDSPopperjs.popoverHelper;
|
|
@@ -34,14 +39,14 @@ var DSPopperJS = function DSPopperJS(props) {
|
|
|
34
39
|
var contentJSX = useMemo(function () {
|
|
35
40
|
return /*#__PURE__*/React.createElement(PopoverContent, {
|
|
36
41
|
setPopperElement: setPopperElement,
|
|
37
|
-
popperStyles: styles.popper,
|
|
42
|
+
popperStyles: _objectSpread(_objectSpread({}, styles.popper), extraPopperStyles),
|
|
38
43
|
popperAttributes: attributes.popper,
|
|
39
44
|
setArrowElement: setArrowElement,
|
|
40
45
|
arrowStyle: styles.arrow,
|
|
41
46
|
withoutArrow: withoutArrow,
|
|
42
47
|
zIndex: zIndex
|
|
43
48
|
}, children);
|
|
44
|
-
}, [attributes.popper, children, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
|
|
49
|
+
}, [attributes.popper, children, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
|
|
45
50
|
|
|
46
51
|
if (showPopover) {
|
|
47
52
|
if (withoutPortal === true) return contentJSX;
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["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: { showPopover, withoutPortal, withoutArrow, portalDOMContainer, zIndex },\n setPopperElement,\n setArrowElement,\n popoverHelper,\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}\n popperAttributes={attributes.popper}\n setArrowElement={setArrowElement}\n arrowStyle={styles.arrow}\n withoutArrow={withoutArrow}\n zIndex={zIndex}\n >\n {children}\n </PopoverContent>\n ),\n [attributes.popper
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["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: { showPopover, withoutPortal, withoutArrow, portalDOMContainer, zIndex, extraPopperStyles },\n setPopperElement,\n setArrowElement,\n popoverHelper,\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 zIndex={zIndex}\n >\n {children}\n </PopoverContent>\n ),\n [\n attributes.popper,\n children,\n extraPopperStyles,\n setArrowElement,\n setPopperElement,\n styles.arrow,\n styles.popper,\n withoutArrow,\n zIndex,\n ],\n );\n if (showPopover) {\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"],"names":["DSPopperJS","props","useConfigDSPopperjs","showPopover","withoutPortal","withoutArrow","portalDOMContainer","zIndex","extraPopperStyles","setPopperElement","setArrowElement","popoverHelper","children","styles","attributes","contentJSX","useMemo","popper","arrow","createPortal","propTypes","dspopperjsPropTypes","DSPopperJSWithSchema","describe","description"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAQMA,UAAU,GAAG,SAAbA,UAAa,CAACC,KAAD,EAA4C;AAC7D,6BAKIC,mBAAmB,CAACD,KAAD,CALvB;AAAA,mDACEA,KADF;AAAA,MACWE,WADX,yBACWA,WADX;AAAA,MACwBC,aADxB,yBACwBA,aADxB;AAAA,MACuCC,YADvC,yBACuCA,YADvC;AAAA,MACqDC,kBADrD,yBACqDA,kBADrD;AAAA,MACyEC,MADzE,yBACyEA,MADzE;AAAA,MACiFC,iBADjF,yBACiFA,iBADjF;AAAA,MAEEC,gBAFF,wBAEEA,gBAFF;AAAA,MAGEC,eAHF,wBAGEA,eAHF;AAAA,MAIEC,aAJF,wBAIEA,aAJF;;AAMA,MAAQC,QAAR,GAAqBX,KAArB,CAAQW,QAAR;AACA,MAAQC,MAAR,GAA+BF,aAA/B,CAAQE,MAAR;AAAA,MAAgBC,UAAhB,GAA+BH,aAA/B,CAAgBG,UAAhB;AACA,MAAMC,UAAU,GAAGC,OAAO,CACxB;AAAA,wBACE,oBAAC,cAAD;AACE,MAAA,gBAAgB,EAAEP,gBADpB;AAEE,MAAA,YAAY,kCAAOI,MAAM,CAACI,MAAd,GAAyBT,iBAAzB,CAFd;AAGE,MAAA,gBAAgB,EAAEM,UAAU,CAACG,MAH/B;AAIE,MAAA,eAAe,EAAEP,eAJnB;AAKE,MAAA,UAAU,EAAEG,MAAM,CAACK,KALrB;AAME,MAAA,YAAY,EAAEb,YANhB;AAOE,MAAA,MAAM,EAAEE;AAPV,OASGK,QATH,CADF;AAAA,GADwB,EAcxB,CACEE,UAAU,CAACG,MADb,EAEEL,QAFF,EAGEJ,iBAHF,EAIEE,eAJF,EAKED,gBALF,EAMEI,MAAM,CAACK,KANT,EAOEL,MAAM,CAACI,MAPT,EAQEZ,YARF,EASEE,MATF,CAdwB,CAA1B;;AA0BA,MAAIJ,WAAJ,EAAiB;AACf,QAAIC,aAAa,KAAK,IAAtB,EAA4B,OAAOW,UAAP;AAC5B,QAAIX,aAAa,KAAK,KAAtB,EAA6B,oBAAO,uDAAGe,YAAY,eAAC,0CAAGJ,UAAH,CAAD,EAAoBT,kBAApB,CAAf,CAAP;AAC9B;;AACD,SAAO,IAAP;AACD;;AAEDN,UAAU,CAACoB,SAAX,GAAuBC,mBAAvB;IAEMC,oBAAoB,GAAGC,QAAQ,CAACvB,UAAD,CAAR,CAAqBwB,WAArB,CAAiC,oDAAjC;AAC7BF,oBAAoB,CAACF,SAArB,GAAiCC,mBAAjC;;;;"}
|
package/esm/propTypes.js
CHANGED
|
@@ -62,7 +62,8 @@ var dspopperjsPropTypes = {
|
|
|
62
62
|
* modifiers array for full-custom popper-js override
|
|
63
63
|
* https://popper.js.org/docs/v2/modifiers/
|
|
64
64
|
*/
|
|
65
|
-
modifiers: PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1)
|
|
65
|
+
modifiers: PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
|
|
66
|
+
extraPopperStyles: PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({})
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
export { dspopperjsPropTypes };
|
package/esm/propTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propTypes.js","sources":["../../src/propTypes.tsx"],"sourcesContent":["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 * 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};\n"],"names":["dspopperjsPropTypes","referenceElement","PropTypes","element","description","isRequired","showPopover","bool","closeContextMenu","func","defaultValue","withoutPortal","withoutArrow","boundaryElement","undefined","portalDOMContainer","startPlacementPreference","oneOf","placementOrderPreference","arrayOf","zIndex","number","customOffset","modifiers","array"],"mappings":";;IAEaA,mBAAmB,GAAG;AACjC;AACF;AACA;AACEC,EAAAA,gBAAgB,EAAEC,SAAS,CAACC,OAAV,CAAkBC,WAAlB,CAA8B,+BAA9B,EAA+DC,UAJhD;;AAKjC;AACF;AACA;AACEC,EAAAA,WAAW,EAAEJ,SAAS,CAACK,IAAV,CAAeH,WAAf,CAA2B,2CAA3B,EAAwEC,UARpD;;AASjC;AACF;AACA;AACA;AACEG,EAAAA,gBAAgB,EAAEN,SAAS,CAACO,IAAV,CACfL,WADe,CAEd,qEACE,0DAHY,EAKfM,YALe,CAKF,UALE,CAbe;;AAmBjC;AACF;AACA;AACEC,EAAAA,aAAa,EAAET,SAAS,CAACK,IAAV,CACZH,WADY,CACA,wEADA,EAEZM,YAFY,CAEC,IAFD,CAtBkB;;AAyBjC;AACF;AACA;AACEE,EAAAA,YAAY,EAAEV,SAAS,CAACK,IAAV,CACXH,WADW,CACC,+DADD,EAEXM,YAFW,CAEE,KAFF,CA5BmB;;AA+BjC;AACF;AACA;AACA;AACEG,EAAAA,eAAe,EAAEX,SAAS,CAACC,OAAV,CACdC,WADc,CAEb,uEACE,4FAHW,EAKdM,YALc,CAKDI,SALC,CAnCgB;;AAyCjC;AACF;AACA;AACEC,EAAAA,kBAAkB,EAAEb,SAAS,CAACC,OAAV,CACjBC,WADiB,CACL,gGADK,EAEjBM,YAFiB,CAEJI,SAFI,CA5Ca;;AA+CjC;AACF;AACA;AACEE,EAAAA,wBAAwB,EAAEd,SAAS,CAACe,KAAV,CAAgB,CACxC,WADwC,EAExC,KAFwC,EAGxC,SAHwC,EAIxC,aAJwC,EAKxC,OALwC,EAMxC,WANwC,EAOxC,YAPwC,EAQxC,QARwC,EASxC,cATwC,EAUxC,UAVwC,EAWxC,MAXwC,EAYxC,YAZwC,CAAhB,EAcvBb,WAduB,CAcX,+DAdW,EAevBM,YAfuB,CAeV,OAfU,CAlDO;;AAkEjC;AACF;AACA;AACEQ,EAAAA,wBAAwB,EAAEhB,SAAS,CAACiB,OAAV,CACxBjB,SAAS,CAACe,KAAV,CAAgB,CACd,WADc,EAEd,KAFc,EAGd,SAHc,EAId,aAJc,EAKd,OALc,EAMd,WANc,EAOd,YAPc,EAQd,QARc,EASd,cATc,EAUd,UAVc,EAWd,MAXc,EAYd,YAZc,CAAhB,CADwB,EAgBvBb,WAhBuB,CAgBX,yEAhBW,EAiBvBM,YAjBuB,CAiBV,oCAjBU,CArEO;;AAuFjC;AACF;AACA;AACEU,EAAAA,MAAM,EAAElB,SAAS,CAACmB,MAAV,CAAiBjB,WAAjB,CAA6B,0BAA7B,EAAyDM,YAAzD,CAAsE,CAAtE,CA1FyB;;AA2FjC;AACF;AACA;AACEY,EAAAA,YAAY,EAAEpB,SAAS,CAACiB,OAAV,CAAkBjB,SAAS,CAACmB,MAA5B,EAAoCjB,WAApC,CAAgD,wBAAhD,EAA0EM,YAA1E,CAAuF,CAAvF,CA9FmB;;AA+FjC;AACF;AACA;AACA;AACEa,EAAAA,SAAS,EAAErB,SAAS,CAACsB,KAAV,CACRpB,WADQ,CACI,8FADJ,EAERM,YAFQ,CAEK,CAFL;
|
|
1
|
+
{"version":3,"file":"propTypes.js","sources":["../../src/propTypes.tsx"],"sourcesContent":["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 * 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};\n"],"names":["dspopperjsPropTypes","referenceElement","PropTypes","element","description","isRequired","showPopover","bool","closeContextMenu","func","defaultValue","withoutPortal","withoutArrow","boundaryElement","undefined","portalDOMContainer","startPlacementPreference","oneOf","placementOrderPreference","arrayOf","zIndex","number","customOffset","modifiers","array","extraPopperStyles","object"],"mappings":";;IAEaA,mBAAmB,GAAG;AACjC;AACF;AACA;AACEC,EAAAA,gBAAgB,EAAEC,SAAS,CAACC,OAAV,CAAkBC,WAAlB,CAA8B,+BAA9B,EAA+DC,UAJhD;;AAKjC;AACF;AACA;AACEC,EAAAA,WAAW,EAAEJ,SAAS,CAACK,IAAV,CAAeH,WAAf,CAA2B,2CAA3B,EAAwEC,UARpD;;AASjC;AACF;AACA;AACA;AACEG,EAAAA,gBAAgB,EAAEN,SAAS,CAACO,IAAV,CACfL,WADe,CAEd,qEACE,0DAHY,EAKfM,YALe,CAKF,UALE,CAbe;;AAmBjC;AACF;AACA;AACEC,EAAAA,aAAa,EAAET,SAAS,CAACK,IAAV,CACZH,WADY,CACA,wEADA,EAEZM,YAFY,CAEC,IAFD,CAtBkB;;AAyBjC;AACF;AACA;AACEE,EAAAA,YAAY,EAAEV,SAAS,CAACK,IAAV,CACXH,WADW,CACC,+DADD,EAEXM,YAFW,CAEE,KAFF,CA5BmB;;AA+BjC;AACF;AACA;AACA;AACEG,EAAAA,eAAe,EAAEX,SAAS,CAACC,OAAV,CACdC,WADc,CAEb,uEACE,4FAHW,EAKdM,YALc,CAKDI,SALC,CAnCgB;;AAyCjC;AACF;AACA;AACEC,EAAAA,kBAAkB,EAAEb,SAAS,CAACC,OAAV,CACjBC,WADiB,CACL,gGADK,EAEjBM,YAFiB,CAEJI,SAFI,CA5Ca;;AA+CjC;AACF;AACA;AACEE,EAAAA,wBAAwB,EAAEd,SAAS,CAACe,KAAV,CAAgB,CACxC,WADwC,EAExC,KAFwC,EAGxC,SAHwC,EAIxC,aAJwC,EAKxC,OALwC,EAMxC,WANwC,EAOxC,YAPwC,EAQxC,QARwC,EASxC,cATwC,EAUxC,UAVwC,EAWxC,MAXwC,EAYxC,YAZwC,CAAhB,EAcvBb,WAduB,CAcX,+DAdW,EAevBM,YAfuB,CAeV,OAfU,CAlDO;;AAkEjC;AACF;AACA;AACEQ,EAAAA,wBAAwB,EAAEhB,SAAS,CAACiB,OAAV,CACxBjB,SAAS,CAACe,KAAV,CAAgB,CACd,WADc,EAEd,KAFc,EAGd,SAHc,EAId,aAJc,EAKd,OALc,EAMd,WANc,EAOd,YAPc,EAQd,QARc,EASd,cATc,EAUd,UAVc,EAWd,MAXc,EAYd,YAZc,CAAhB,CADwB,EAgBvBb,WAhBuB,CAgBX,yEAhBW,EAiBvBM,YAjBuB,CAiBV,oCAjBU,CArEO;;AAuFjC;AACF;AACA;AACEU,EAAAA,MAAM,EAAElB,SAAS,CAACmB,MAAV,CAAiBjB,WAAjB,CAA6B,0BAA7B,EAAyDM,YAAzD,CAAsE,CAAtE,CA1FyB;;AA2FjC;AACF;AACA;AACEY,EAAAA,YAAY,EAAEpB,SAAS,CAACiB,OAAV,CAAkBjB,SAAS,CAACmB,MAA5B,EAAoCjB,WAApC,CAAgD,wBAAhD,EAA0EM,YAA1E,CAAuF,CAAvF,CA9FmB;;AA+FjC;AACF;AACA;AACA;AACEa,EAAAA,SAAS,EAAErB,SAAS,CAACsB,KAAV,CACRpB,WADQ,CACI,8FADJ,EAERM,YAFQ,CAEK,CAFL,CAnGsB;AAsGjCe,EAAAA,iBAAiB,EAAEvB,SAAS,CAACwB,MAAV,CAChBtB,WADgB,CACJ,qDADI,EAEhBM,YAFgB,CAEH,EAFG;AAtGc;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-popperjs",
|
|
3
|
-
"version": "1.55.0-
|
|
3
|
+
"version": "1.55.0-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Ellie Mae - Dim Sum - Popper JS wrapper",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"build": "node ../../scripts/build/build.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-props-helpers": "1.55.0-
|
|
20
|
-
"react-
|
|
19
|
+
"@elliemae/ds-props-helpers": "1.55.0-rc.0",
|
|
20
|
+
"react-popper": "2.2.5"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"styled-components": "~5.3.0"
|