@elliemae/ds-popperjs 1.59.8 → 2.0.0-alpha.12
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/PopoverArrow.js +35 -31
- package/cjs/PopoverContent.js +51 -39
- package/cjs/config/useConfigDSPopperjs.js +40 -61
- package/cjs/config/useConfiguredDefaultModifiers.js +21 -22
- package/cjs/config/useConfiguredDefaultProps.js +39 -38
- package/cjs/config/useConfiguredMergedProps.js +9 -11
- package/cjs/index.d.js +0 -1
- package/cjs/index.js +56 -57
- package/cjs/propTypes.js +4 -3
- package/cjs/styled.js +15 -12
- package/cjs/utils/hooks/useOnClickOutside.js +4 -5
- package/esm/PopoverArrow.js +34 -30
- package/esm/PopoverContent.js +49 -37
- package/esm/config/useConfigDSPopperjs.js +36 -53
- package/esm/config/useConfiguredDefaultModifiers.js +20 -21
- package/esm/config/useConfiguredDefaultProps.js +36 -35
- package/esm/config/useConfiguredMergedProps.js +8 -10
- package/esm/index.d.js +0 -1
- package/esm/index.js +52 -53
- package/esm/propTypes.js +4 -3
- package/esm/styled.js +14 -11
- package/esm/utils/hooks/useOnClickOutside.js +3 -4
- package/package.json +66 -11
- package/types/PopoverArrow.d.ts +8 -0
- package/types/PopoverContent.d.ts +3 -0
- package/types/config/useConfigDSPopperjs.d.ts +2 -0
- package/types/config/useConfiguredDefaultModifiers.d.ts +6 -0
- package/types/config/useConfiguredDefaultProps.d.ts +19 -0
- package/types/config/useConfiguredMergedProps.d.ts +19 -0
- package/types/index.d.ts +58 -0
- package/types/propTypes.d.ts +95 -0
- package/types/styled.d.ts +11 -0
- package/types/utils/hooks/useOnClickOutside.d.ts +4 -0
- package/PopoverArrow/package.json +0 -10
- package/PopoverContent/package.json +0 -10
- package/cjs/PopoverArrow.js.map +0 -1
- package/cjs/PopoverContent.js.map +0 -1
- package/cjs/config/useConfigDSPopperjs.js.map +0 -1
- package/cjs/config/useConfiguredDefaultModifiers.js.map +0 -1
- package/cjs/config/useConfiguredDefaultProps.js.map +0 -1
- package/cjs/config/useConfiguredMergedProps.js.map +0 -1
- package/cjs/index.d.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/propTypes.js.map +0 -1
- package/cjs/styled.js.map +0 -1
- package/cjs/utils/hooks/useOnClickOutside.js.map +0 -1
- package/config/useConfigDSPopperjs/package.json +0 -10
- package/config/useConfiguredDefaultModifiers/package.json +0 -10
- package/config/useConfiguredDefaultProps/package.json +0 -10
- package/config/useConfiguredMergedProps/package.json +0 -10
- package/esm/PopoverArrow.js.map +0 -1
- package/esm/PopoverContent.js.map +0 -1
- package/esm/config/useConfigDSPopperjs.js.map +0 -1
- package/esm/config/useConfiguredDefaultModifiers.js.map +0 -1
- package/esm/config/useConfiguredDefaultProps.js.map +0 -1
- package/esm/config/useConfiguredMergedProps.js.map +0 -1
- package/esm/index.d.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/propTypes.js.map +0 -1
- package/esm/styled.js.map +0 -1
- package/esm/utils/hooks/useOnClickOutside.js.map +0 -1
- package/propTypes/package.json +0 -10
- package/styled/package.json +0 -10
- package/utils/hooks/useOnClickOutside/package.json +0 -10
package/cjs/index.js
CHANGED
|
@@ -2,85 +2,84 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
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 _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var
|
|
12
|
+
var react = require('react');
|
|
7
13
|
var reactDom = require('react-dom');
|
|
8
14
|
var reactDesc = require('react-desc');
|
|
9
15
|
var propTypes = require('./propTypes.js');
|
|
10
16
|
var PopoverContent = require('./PopoverContent.js');
|
|
11
|
-
var
|
|
12
|
-
require('
|
|
13
|
-
require('./PopoverArrow.js');
|
|
14
|
-
require('styled-components');
|
|
15
|
-
require('./styled.js');
|
|
16
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
17
|
-
require('@elliemae/ds-system');
|
|
18
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
19
|
-
require('react-popper');
|
|
20
|
-
require('./config/useConfiguredMergedProps.js');
|
|
21
|
-
require('@elliemae/ds-props-helpers');
|
|
22
|
-
require('./config/useConfiguredDefaultProps.js');
|
|
23
|
-
require('./config/useConfiguredDefaultModifiers.js');
|
|
24
|
-
require('./utils/hooks/useOnClickOutside.js');
|
|
17
|
+
var useConfigDSPopperjs = require('./config/useConfigDSPopperjs.js');
|
|
18
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
25
19
|
|
|
26
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
27
21
|
|
|
22
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
28
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
29
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
24
|
|
|
31
25
|
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; }
|
|
32
26
|
|
|
33
|
-
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[
|
|
27
|
+
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; }
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
showPopover
|
|
39
|
-
withoutAnimation
|
|
40
|
-
animationDuration
|
|
41
|
-
withoutPortal
|
|
42
|
-
withoutArrow
|
|
43
|
-
portalDOMContainer
|
|
44
|
-
zIndex
|
|
45
|
-
extraPopperStyles
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
29
|
+
const DSPopperJS = props => {
|
|
30
|
+
const {
|
|
31
|
+
props: {
|
|
32
|
+
showPopover,
|
|
33
|
+
withoutAnimation,
|
|
34
|
+
animationDuration,
|
|
35
|
+
withoutPortal,
|
|
36
|
+
withoutArrow,
|
|
37
|
+
portalDOMContainer,
|
|
38
|
+
zIndex,
|
|
39
|
+
extraPopperStyles
|
|
40
|
+
},
|
|
41
|
+
setPopperElement,
|
|
42
|
+
setArrowElement,
|
|
43
|
+
setIsAnimating,
|
|
44
|
+
popoverHelper,
|
|
45
|
+
isAnimating
|
|
46
|
+
} = useConfigDSPopperjs.useConfigDSPopperjs(props);
|
|
47
|
+
const {
|
|
48
|
+
children
|
|
49
|
+
} = props;
|
|
50
|
+
const {
|
|
51
|
+
styles,
|
|
52
|
+
attributes
|
|
53
|
+
} = popoverHelper;
|
|
54
|
+
const contentJSX = react.useMemo(() => /*#__PURE__*/_jsx__default["default"](PopoverContent.PopoverContent, {
|
|
55
|
+
setPopperElement: setPopperElement,
|
|
56
|
+
popperStyles: _objectSpread(_objectSpread({}, styles.popper), extraPopperStyles),
|
|
57
|
+
popperAttributes: attributes.popper,
|
|
58
|
+
setArrowElement: setArrowElement,
|
|
59
|
+
arrowStyle: styles.arrow,
|
|
60
|
+
withoutArrow: withoutArrow,
|
|
61
|
+
withoutAnimation: withoutAnimation,
|
|
62
|
+
animationDuration: animationDuration,
|
|
63
|
+
zIndex: zIndex,
|
|
64
|
+
showPopover: showPopover,
|
|
65
|
+
setIsAnimating: setIsAnimating
|
|
66
|
+
}, void 0, children), [attributes.popper, children, setIsAnimating, showPopover, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, withoutAnimation, animationDuration, zIndex]);
|
|
70
67
|
|
|
71
68
|
if (showPopover || isAnimating) {
|
|
72
69
|
if (withoutPortal === true) return contentJSX;
|
|
73
|
-
if (withoutPortal === false) return /*#__PURE__*/
|
|
70
|
+
if (withoutPortal === false) return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
71
|
+
children: /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
72
|
+
children: contentJSX
|
|
73
|
+
}), portalDOMContainer)
|
|
74
|
+
});
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
return null;
|
|
77
78
|
};
|
|
78
79
|
|
|
79
|
-
DSPopperJS.
|
|
80
|
-
var DSPopperJSWithSchema = reactDesc.describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
|
|
80
|
+
const DSPopperJSWithSchema = reactDesc.describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
|
|
81
81
|
DSPopperJSWithSchema.propTypes = propTypes.dspopperjsPropTypes;
|
|
82
82
|
|
|
83
83
|
exports.DSPopperJS = DSPopperJS;
|
|
84
84
|
exports.DSPopperJSWithSchema = DSPopperJSWithSchema;
|
|
85
|
-
exports[
|
|
86
|
-
//# sourceMappingURL=index.js.map
|
|
85
|
+
exports["default"] = DSPopperJS;
|
package/cjs/propTypes.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const dspopperjsPropTypes = {
|
|
8
8
|
/**
|
|
9
9
|
* React ref to popperjs referenceElement
|
|
10
10
|
*/
|
|
@@ -77,8 +77,9 @@ var dspopperjsPropTypes = {
|
|
|
77
77
|
* https://popper.js.org/docs/v2/modifiers/
|
|
78
78
|
*/
|
|
79
79
|
modifiers: reactDesc.PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
|
|
80
|
-
extraPopperStyles: reactDesc.PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({})
|
|
80
|
+
extraPopperStyles: reactDesc.PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({}),
|
|
81
|
+
onClickOutside: reactDesc.PropTypes.func.description('Callback triggered when clicking outside the popper').defaultValue(() => null),
|
|
82
|
+
children: reactDesc.PropTypes.node.description('The content of the popper').defaultValue(undefined)
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
exports.dspopperjsPropTypes = dspopperjsPropTypes;
|
|
84
|
-
//# sourceMappingURL=propTypes.js.map
|
package/cjs/styled.js
CHANGED
|
@@ -12,23 +12,26 @@ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_tagged
|
|
|
12
12
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
13
|
|
|
14
14
|
var _templateObject, _templateObject2, _templateObject3;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const showAnimation = dsSystem.kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
16
|
+
const hideAnimation = dsSystem.kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
17
|
+
const StyledPopoverContentWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
18
18
|
componentId: "sc-1giz5kx-0"
|
|
19
|
-
})(["z-index:", ";"],
|
|
20
|
-
|
|
19
|
+
})(["z-index:", ";"], _ref => {
|
|
20
|
+
let {
|
|
21
|
+
zIndex
|
|
22
|
+
} = _ref;
|
|
21
23
|
return zIndex;
|
|
22
24
|
});
|
|
23
|
-
|
|
25
|
+
const StyledAnimatedPopper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
24
26
|
componentId: "sc-1giz5kx-1"
|
|
25
|
-
})(["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);", ""],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
})(["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);", ""], _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
showPopover,
|
|
30
|
+
animationDuration,
|
|
31
|
+
withoutAnimation
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return !withoutAnimation && dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n animation: ", " ", "ms ease-in;\n "])), showPopover ? showAnimation : hideAnimation, animationDuration);
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
exports.StyledAnimatedPopper = StyledAnimatedPopper;
|
|
33
37
|
exports.StyledPopoverContentWrapper = StyledPopoverContentWrapper;
|
|
34
|
-
//# sourceMappingURL=styled.js.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var react = require('react');
|
|
6
6
|
|
|
7
7
|
function useOnClickOutside(ref, cb) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
react.useEffect(() => {
|
|
9
|
+
const listener = event => {
|
|
10
10
|
var _ref$contains;
|
|
11
11
|
|
|
12
12
|
// Do nothing if clicking ref's element or descendent elements
|
|
@@ -19,7 +19,7 @@ function useOnClickOutside(ref, cb) {
|
|
|
19
19
|
|
|
20
20
|
document.addEventListener('mousedown', listener);
|
|
21
21
|
document.addEventListener('touchstart', listener);
|
|
22
|
-
return
|
|
22
|
+
return () => {
|
|
23
23
|
document.removeEventListener('mousedown', listener);
|
|
24
24
|
document.removeEventListener('touchstart', listener);
|
|
25
25
|
};
|
|
@@ -27,4 +27,3 @@ function useOnClickOutside(ref, cb) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
exports.useOnClickOutside = useOnClickOutside;
|
|
30
|
-
//# sourceMappingURL=useOnClickOutside.js.map
|
package/esm/PopoverArrow.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
5
|
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
var _svg;
|
|
7
|
+
const arrowWidth = 18;
|
|
8
|
+
const arrowHeight = 18;
|
|
9
|
+
const StyledArrow = /*#__PURE__*/styled.div.withConfig({
|
|
7
10
|
componentId: "sc-olcdf1-0"
|
|
8
|
-
})(["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,
|
|
9
|
-
|
|
11
|
+
})(["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 => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
10
15
|
return theme.colors.neutral['500'];
|
|
11
|
-
},
|
|
12
|
-
|
|
16
|
+
}, _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
theme
|
|
19
|
+
} = _ref2;
|
|
13
20
|
return theme.colors.neutral['000'];
|
|
14
|
-
}, arrowHeight, arrowWidth, arrowHeight, arrowWidth,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
arrowElementRef = _ref3.arrowElementRef;
|
|
23
|
-
return /*#__PURE__*/React.createElement(StyledArrow, {
|
|
24
|
-
key: "popper-arrow",
|
|
21
|
+
}, 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;');
|
|
22
|
+
const PopoverArrow = _ref3 => {
|
|
23
|
+
let {
|
|
24
|
+
placement,
|
|
25
|
+
style,
|
|
26
|
+
arrowElementRef
|
|
27
|
+
} = _ref3;
|
|
28
|
+
return /*#__PURE__*/jsx(StyledArrow, {
|
|
25
29
|
"data-placement": placement,
|
|
26
30
|
style: style,
|
|
27
31
|
ref: arrowElementRef,
|
|
28
|
-
"data-testid": "ds-tooltip-arrow"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
"data-testid": "ds-tooltip-arrow",
|
|
33
|
+
children: _svg || (_svg = /*#__PURE__*/_jsx("svg", {
|
|
34
|
+
viewBox: "0 0 30 30"
|
|
35
|
+
}, void 0, /*#__PURE__*/_jsx("path", {
|
|
36
|
+
className: "stroke",
|
|
37
|
+
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"
|
|
38
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
39
|
+
className: "fill",
|
|
40
|
+
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"
|
|
41
|
+
})))
|
|
42
|
+
}, "popper-arrow");
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
export { PopoverArrow };
|
|
41
|
-
//# sourceMappingURL=PopoverArrow.js.map
|
package/esm/PopoverContent.js
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import { useCallback, useMemo } from 'react';
|
|
3
9
|
import { PopoverArrow } from './PopoverArrow.js';
|
|
4
10
|
import { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';
|
|
5
|
-
import '
|
|
6
|
-
import '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
7
|
-
import '@elliemae/ds-system';
|
|
11
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
12
|
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
const PopoverContent = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
setPopperElement,
|
|
19
|
+
popperStyles,
|
|
20
|
+
popperAttributes,
|
|
21
|
+
children,
|
|
22
|
+
showPopover,
|
|
23
|
+
setArrowElement,
|
|
24
|
+
setIsAnimating,
|
|
25
|
+
arrowStyle,
|
|
26
|
+
withoutArrow,
|
|
27
|
+
withoutAnimation,
|
|
28
|
+
animationDuration,
|
|
29
|
+
zIndex
|
|
30
|
+
} = _ref;
|
|
31
|
+
const checkAnimationStatus = useCallback(() => {
|
|
23
32
|
if (!showPopover && !withoutAnimation) {
|
|
24
33
|
setIsAnimating(false);
|
|
25
34
|
}
|
|
26
35
|
}, [showPopover, withoutAnimation, setIsAnimating]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const popperContent = useMemo(() => /*#__PURE__*/jsxs(Fragment, {
|
|
37
|
+
children: [children, withoutArrow === false ? /*#__PURE__*/jsxs(Fragment, {
|
|
38
|
+
children: [/*#__PURE__*/_jsx(PopoverArrow, {
|
|
39
|
+
arrowElementRef: setArrowElement,
|
|
40
|
+
style: arrowStyle,
|
|
41
|
+
placement: popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'
|
|
42
|
+
}), /*#__PURE__*/jsx("div", {
|
|
43
|
+
ref: setArrowElement,
|
|
44
|
+
style: arrowStyle
|
|
45
|
+
})]
|
|
46
|
+
}) : null]
|
|
47
|
+
}), [children, withoutArrow, arrowStyle, popperAttributes, setArrowElement]);
|
|
48
|
+
return /*#__PURE__*/jsx(StyledPopoverContentWrapper, _objectSpread(_objectSpread({
|
|
38
49
|
zIndex: zIndex,
|
|
39
50
|
ref: setPopperElement,
|
|
40
51
|
style: popperStyles
|
|
41
|
-
}, popperAttributes),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
}, popperAttributes), {}, {
|
|
53
|
+
children: /*#__PURE__*/_jsx(StyledAnimatedPopper, {
|
|
54
|
+
showPopover: showPopover,
|
|
55
|
+
animationDuration: animationDuration,
|
|
56
|
+
withoutAnimation: withoutAnimation,
|
|
57
|
+
onAnimationEnd: checkAnimationStatus
|
|
58
|
+
}, void 0, popperContent)
|
|
59
|
+
}));
|
|
47
60
|
};
|
|
48
61
|
|
|
49
62
|
export { PopoverContent };
|
|
50
|
-
//# sourceMappingURL=PopoverContent.js.map
|
|
@@ -1,73 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState, useMemo, useEffect } from 'react';
|
|
3
3
|
import { usePopper } from 'react-popper';
|
|
4
4
|
import { useConfiguredMergedProps } from './useConfiguredMergedProps.js';
|
|
5
5
|
import { useOnClickOutside } from '../utils/hooks/useOnClickOutside.js';
|
|
6
|
-
import '@elliemae/ds-props-helpers';
|
|
7
|
-
import './useConfiguredDefaultProps.js';
|
|
8
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
9
|
-
import './useConfiguredDefaultModifiers.js';
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _useState3 = useState(null),
|
|
18
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
19
|
-
arrowElement = _useState4[0],
|
|
20
|
-
setArrowElement = _useState4[1];
|
|
21
|
-
|
|
22
|
-
var _useState5 = useState(false),
|
|
23
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
-
isAnimating = _useState6[0],
|
|
25
|
-
setIsAnimating = _useState6[1];
|
|
26
|
-
|
|
27
|
-
var props = useConfiguredMergedProps({
|
|
7
|
+
const useConfigDSPopperjs = appProps => {
|
|
8
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
9
|
+
const [arrowElement, setArrowElement] = useState(null);
|
|
10
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
11
|
+
const props = useConfiguredMergedProps({
|
|
28
12
|
props: appProps,
|
|
29
|
-
arrowElement
|
|
13
|
+
arrowElement
|
|
30
14
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, [modifiers, startPlacementPreference]);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
const {
|
|
16
|
+
referenceElement,
|
|
17
|
+
closeContextMenu,
|
|
18
|
+
onClickOutside,
|
|
19
|
+
modifiers,
|
|
20
|
+
startPlacementPreference
|
|
21
|
+
} = props;
|
|
22
|
+
const popperExtraOpts = useMemo(() => ({
|
|
23
|
+
placement: startPlacementPreference,
|
|
24
|
+
modifiers
|
|
25
|
+
}), [modifiers, startPlacementPreference]);
|
|
26
|
+
const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);
|
|
27
|
+
const {
|
|
28
|
+
showPopover,
|
|
29
|
+
withoutAnimation
|
|
30
|
+
} = props;
|
|
31
|
+
useEffect(() => {
|
|
46
32
|
if (showPopover && !withoutAnimation) {
|
|
47
33
|
setIsAnimating(true);
|
|
48
34
|
}
|
|
49
35
|
}, [showPopover, withoutAnimation]);
|
|
50
|
-
useOnClickOutside(popperElement,
|
|
36
|
+
useOnClickOutside(popperElement, e => {
|
|
51
37
|
var _referenceElement$con;
|
|
52
38
|
|
|
53
39
|
if (!(referenceElement !== null && referenceElement !== void 0 && (_referenceElement$con = referenceElement.contains) !== null && _referenceElement$con !== void 0 && _referenceElement$con.call(referenceElement, e === null || e === void 0 ? void 0 : e.target))) {
|
|
54
|
-
closeContextMenu();
|
|
55
40
|
onClickOutside(e);
|
|
41
|
+
closeContextMenu();
|
|
56
42
|
}
|
|
57
43
|
});
|
|
58
|
-
return useMemo(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
}, [arrowElement, popoverHelper, popperElement, isAnimating, props]);
|
|
44
|
+
return useMemo(() => ({
|
|
45
|
+
props,
|
|
46
|
+
popperElement,
|
|
47
|
+
setPopperElement,
|
|
48
|
+
arrowElement,
|
|
49
|
+
setArrowElement,
|
|
50
|
+
popoverHelper,
|
|
51
|
+
isAnimating,
|
|
52
|
+
setIsAnimating
|
|
53
|
+
}), [arrowElement, popoverHelper, popperElement, isAnimating, props]);
|
|
70
54
|
};
|
|
71
55
|
|
|
72
56
|
export { useConfigDSPopperjs };
|
|
73
|
-
//# sourceMappingURL=useConfigDSPopperjs.js.map
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const useConfiguredDefaultModifiers = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
props,
|
|
6
|
+
arrowElement
|
|
7
|
+
} = _ref;
|
|
6
8
|
// we destructure explicit app definitions before merge
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
explictAppOffset = _props$customOffset === void 0 ? undefined : _props$customOffset; // to build default modifiers on top of it
|
|
9
|
+
const {
|
|
10
|
+
boundaryElement: explicitAppBoundaryElement,
|
|
11
|
+
withoutArrow: explicitAppWithoutArrow = false,
|
|
12
|
+
placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],
|
|
13
|
+
customOffset: explictAppOffset = undefined
|
|
14
|
+
} = props; // to build default modifiers on top of it
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const defaultModifiers = useMemo(() => {
|
|
17
|
+
const mod = [];
|
|
17
18
|
mod.push({
|
|
18
19
|
name: 'hide',
|
|
19
20
|
enabled: true
|
|
@@ -26,7 +27,7 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
26
27
|
}); // we apply an offset if the app defines one or if the app wants the arrow
|
|
27
28
|
|
|
28
29
|
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
29
|
-
|
|
30
|
+
const defaultOffset = explictAppOffset || [0, 14];
|
|
30
31
|
mod.push({
|
|
31
32
|
name: 'offset',
|
|
32
33
|
enabled: true,
|
|
@@ -54,14 +55,12 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
54
55
|
return mod;
|
|
55
56
|
}, [arrowElement, explicitAppBoundaryElement, explicitAppWithoutArrow, explicitPlacementOrderPreference, explictAppOffset]); // if the app pass custom modifier, we don't use "default modifiers"
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [explicitAppModifiers]);
|
|
58
|
+
const {
|
|
59
|
+
modifiers: explicitAppModifiers = defaultModifiers
|
|
60
|
+
} = props;
|
|
61
|
+
return useMemo(() => ({
|
|
62
|
+
modifiers: explicitAppModifiers
|
|
63
|
+
}), [explicitAppModifiers]);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
export { useConfiguredDefaultModifiers };
|
|
67
|
-
//# sourceMappingURL=useConfiguredDefaultModifiers.js.map
|