@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/PopoverArrow.js
CHANGED
|
@@ -2,49 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('react');
|
|
6
7
|
var styled = require('styled-components');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
9
|
|
|
8
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
11
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
14
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var _svg;
|
|
16
|
+
const arrowWidth = 18;
|
|
17
|
+
const arrowHeight = 18;
|
|
18
|
+
const StyledArrow = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
16
19
|
componentId: "sc-olcdf1-0"
|
|
17
|
-
})(["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,
|
|
18
|
-
|
|
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;
|
|
19
24
|
return theme.colors.neutral['500'];
|
|
20
|
-
},
|
|
21
|
-
|
|
25
|
+
}, _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
theme
|
|
28
|
+
} = _ref2;
|
|
22
29
|
return theme.colors.neutral['000'];
|
|
23
|
-
}, arrowHeight, arrowWidth, arrowHeight, arrowWidth,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
arrowElementRef = _ref3.arrowElementRef;
|
|
32
|
-
return /*#__PURE__*/React__default['default'].createElement(StyledArrow, {
|
|
33
|
-
key: "popper-arrow",
|
|
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, {
|
|
34
38
|
"data-placement": placement,
|
|
35
39
|
style: style,
|
|
36
40
|
ref: arrowElementRef,
|
|
37
|
-
"data-testid": "ds-tooltip-arrow"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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");
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
exports.PopoverArrow = PopoverArrow;
|
|
50
|
-
//# sourceMappingURL=PopoverArrow.js.map
|
package/cjs/PopoverContent.js
CHANGED
|
@@ -2,58 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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');
|
|
7
13
|
var PopoverArrow = require('./PopoverArrow.js');
|
|
8
14
|
var styled = require('./styled.js');
|
|
9
|
-
require('
|
|
10
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
11
|
-
require('@elliemae/ds-system');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
16
|
|
|
13
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
18
|
|
|
15
|
-
var
|
|
16
|
-
var
|
|
19
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
21
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
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(() => {
|
|
32
41
|
if (!showPopover && !withoutAnimation) {
|
|
33
42
|
setIsAnimating(false);
|
|
34
43
|
}
|
|
35
44
|
}, [showPopover, withoutAnimation, setIsAnimating]);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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({
|
|
47
58
|
zIndex: zIndex,
|
|
48
59
|
ref: setPopperElement,
|
|
49
60
|
style: popperStyles
|
|
50
|
-
}, popperAttributes),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
}));
|
|
56
69
|
};
|
|
57
70
|
|
|
58
71
|
exports.PopoverContent = PopoverContent;
|
|
59
|
-
//# sourceMappingURL=PopoverContent.js.map
|
|
@@ -2,80 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
var react = require('react');
|
|
7
7
|
var reactPopper = require('react-popper');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
18
|
-
|
|
19
|
-
var useConfigDSPopperjs = function useConfigDSPopperjs(appProps) {
|
|
20
|
-
var _useState = React.useState(null),
|
|
21
|
-
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
22
|
-
popperElement = _useState2[0],
|
|
23
|
-
setPopperElement = _useState2[1];
|
|
24
|
-
|
|
25
|
-
var _useState3 = React.useState(null),
|
|
26
|
-
_useState4 = _slicedToArray__default['default'](_useState3, 2),
|
|
27
|
-
arrowElement = _useState4[0],
|
|
28
|
-
setArrowElement = _useState4[1];
|
|
29
|
-
|
|
30
|
-
var _useState5 = React.useState(false),
|
|
31
|
-
_useState6 = _slicedToArray__default['default'](_useState5, 2),
|
|
32
|
-
isAnimating = _useState6[0],
|
|
33
|
-
setIsAnimating = _useState6[1];
|
|
34
|
-
|
|
35
|
-
var props = config_useConfiguredMergedProps.useConfiguredMergedProps({
|
|
8
|
+
var useConfiguredMergedProps = require('./useConfiguredMergedProps.js');
|
|
9
|
+
var useOnClickOutside = require('../utils/hooks/useOnClickOutside.js');
|
|
10
|
+
|
|
11
|
+
const useConfigDSPopperjs = appProps => {
|
|
12
|
+
const [popperElement, setPopperElement] = react.useState(null);
|
|
13
|
+
const [arrowElement, setArrowElement] = react.useState(null);
|
|
14
|
+
const [isAnimating, setIsAnimating] = react.useState(false);
|
|
15
|
+
const props = useConfiguredMergedProps.useConfiguredMergedProps({
|
|
36
16
|
props: appProps,
|
|
37
|
-
arrowElement
|
|
17
|
+
arrowElement
|
|
38
18
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, [modifiers, startPlacementPreference]);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
19
|
+
const {
|
|
20
|
+
referenceElement,
|
|
21
|
+
closeContextMenu,
|
|
22
|
+
onClickOutside,
|
|
23
|
+
modifiers,
|
|
24
|
+
startPlacementPreference
|
|
25
|
+
} = props;
|
|
26
|
+
const popperExtraOpts = react.useMemo(() => ({
|
|
27
|
+
placement: startPlacementPreference,
|
|
28
|
+
modifiers
|
|
29
|
+
}), [modifiers, startPlacementPreference]);
|
|
30
|
+
const popoverHelper = reactPopper.usePopper(referenceElement, popperElement, popperExtraOpts);
|
|
31
|
+
const {
|
|
32
|
+
showPopover,
|
|
33
|
+
withoutAnimation
|
|
34
|
+
} = props;
|
|
35
|
+
react.useEffect(() => {
|
|
54
36
|
if (showPopover && !withoutAnimation) {
|
|
55
37
|
setIsAnimating(true);
|
|
56
38
|
}
|
|
57
39
|
}, [showPopover, withoutAnimation]);
|
|
58
|
-
|
|
40
|
+
useOnClickOutside.useOnClickOutside(popperElement, e => {
|
|
59
41
|
var _referenceElement$con;
|
|
60
42
|
|
|
61
43
|
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))) {
|
|
62
|
-
closeContextMenu();
|
|
63
44
|
onClickOutside(e);
|
|
45
|
+
closeContextMenu();
|
|
64
46
|
}
|
|
65
47
|
});
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
}, [arrowElement, popoverHelper, popperElement, isAnimating, props]);
|
|
48
|
+
return react.useMemo(() => ({
|
|
49
|
+
props,
|
|
50
|
+
popperElement,
|
|
51
|
+
setPopperElement,
|
|
52
|
+
arrowElement,
|
|
53
|
+
setArrowElement,
|
|
54
|
+
popoverHelper,
|
|
55
|
+
isAnimating,
|
|
56
|
+
setIsAnimating
|
|
57
|
+
}), [arrowElement, popoverHelper, popperElement, isAnimating, props]);
|
|
78
58
|
};
|
|
79
59
|
|
|
80
60
|
exports.useConfigDSPopperjs = useConfigDSPopperjs;
|
|
81
|
-
//# sourceMappingURL=useConfigDSPopperjs.js.map
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var react = require('react');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const useConfiguredDefaultModifiers = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
props,
|
|
10
|
+
arrowElement
|
|
11
|
+
} = _ref;
|
|
10
12
|
// we destructure explicit app definitions before merge
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
explictAppOffset = _props$customOffset === void 0 ? undefined : _props$customOffset; // to build default modifiers on top of it
|
|
13
|
+
const {
|
|
14
|
+
boundaryElement: explicitAppBoundaryElement,
|
|
15
|
+
withoutArrow: explicitAppWithoutArrow = false,
|
|
16
|
+
placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],
|
|
17
|
+
customOffset: explictAppOffset = undefined
|
|
18
|
+
} = props; // to build default modifiers on top of it
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const defaultModifiers = react.useMemo(() => {
|
|
21
|
+
const mod = [];
|
|
21
22
|
mod.push({
|
|
22
23
|
name: 'hide',
|
|
23
24
|
enabled: true
|
|
@@ -30,7 +31,7 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
30
31
|
}); // we apply an offset if the app defines one or if the app wants the arrow
|
|
31
32
|
|
|
32
33
|
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
33
|
-
|
|
34
|
+
const defaultOffset = explictAppOffset || [0, 14];
|
|
34
35
|
mod.push({
|
|
35
36
|
name: 'offset',
|
|
36
37
|
enabled: true,
|
|
@@ -58,14 +59,12 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
58
59
|
return mod;
|
|
59
60
|
}, [arrowElement, explicitAppBoundaryElement, explicitAppWithoutArrow, explicitPlacementOrderPreference, explictAppOffset]); // if the app pass custom modifier, we don't use "default modifiers"
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, [explicitAppModifiers]);
|
|
62
|
+
const {
|
|
63
|
+
modifiers: explicitAppModifiers = defaultModifiers
|
|
64
|
+
} = props;
|
|
65
|
+
return react.useMemo(() => ({
|
|
66
|
+
modifiers: explicitAppModifiers
|
|
67
|
+
}), [explicitAppModifiers]);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
exports.useConfiguredDefaultModifiers = useConfiguredDefaultModifiers;
|
|
71
|
-
//# sourceMappingURL=useConfiguredDefaultModifiers.js.map
|
|
@@ -2,9 +2,14 @@
|
|
|
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');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
11
|
+
var react = require('react');
|
|
12
|
+
var useConfiguredDefaultModifiers = require('./useConfiguredDefaultModifiers.js');
|
|
8
13
|
|
|
9
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
15
|
|
|
@@ -12,46 +17,42 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
12
17
|
|
|
13
18
|
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
19
|
|
|
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__default[
|
|
20
|
+
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; }
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
const noop = () => {};
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const emptyObj = {};
|
|
25
|
+
const useConfiguredDefaultProps = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
props,
|
|
28
|
+
arrowElement
|
|
29
|
+
} = _ref;
|
|
23
30
|
// don't move this out of the hook or `document.body` will explode
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var defaultProps = React.useMemo(function () {
|
|
49
|
-
return _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
|
|
50
|
-
modifiers: configuredModifiers
|
|
51
|
-
});
|
|
52
|
-
}, [configuredModifiers, staticDefaultProps]);
|
|
31
|
+
const staticDefaultProps = react.useMemo(() => ({
|
|
32
|
+
referenceElement: null,
|
|
33
|
+
showPopover: false,
|
|
34
|
+
closeContextMenu: noop,
|
|
35
|
+
onClickOutside: noop,
|
|
36
|
+
withoutPortal: false,
|
|
37
|
+
withoutArrow: false,
|
|
38
|
+
withoutAnimation: false,
|
|
39
|
+
animationDuration: 100,
|
|
40
|
+
portalDOMContainer: document.body,
|
|
41
|
+
startPlacementPreference: 'top',
|
|
42
|
+
placementOrderPreference: ['top', 'bottom', 'left', 'right'],
|
|
43
|
+
zIndex: 1,
|
|
44
|
+
extraPopperStyles: emptyObj
|
|
45
|
+
}), []);
|
|
46
|
+
const {
|
|
47
|
+
modifiers: configuredModifiers
|
|
48
|
+
} = useConfiguredDefaultModifiers.useConfiguredDefaultModifiers({
|
|
49
|
+
props,
|
|
50
|
+
arrowElement
|
|
51
|
+
});
|
|
52
|
+
const defaultProps = react.useMemo(() => _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
|
|
53
|
+
modifiers: configuredModifiers
|
|
54
|
+
}), [configuredModifiers, staticDefaultProps]);
|
|
53
55
|
return defaultProps;
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
exports.useConfiguredDefaultProps = useConfiguredDefaultProps;
|
|
57
|
-
//# sourceMappingURL=useConfiguredDefaultProps.js.map
|
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
6
|
-
var
|
|
7
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
8
|
-
require('react');
|
|
9
|
-
require('./useConfiguredDefaultModifiers.js');
|
|
6
|
+
var useConfiguredDefaultProps = require('./useConfiguredDefaultProps.js');
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const useConfiguredMergedProps = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
props,
|
|
11
|
+
arrowElement
|
|
12
|
+
} = _ref;
|
|
13
|
+
const defaultProps = useConfiguredDefaultProps.useConfiguredDefaultProps({
|
|
14
|
+
props,
|
|
15
|
+
arrowElement
|
|
17
16
|
});
|
|
18
17
|
return dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultProps);
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
exports.useConfiguredMergedProps = useConfiguredMergedProps;
|
|
22
|
-
//# sourceMappingURL=useConfiguredMergedProps.js.map
|
package/cjs/index.d.js
CHANGED