@elliemae/ds-popperjs 1.57.0 → 2.0.0-alpha.11
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 +25 -32
- package/cjs/PopoverContent.js +38 -32
- package/cjs/config/useConfigDSPopperjs.js +30 -53
- package/cjs/config/useConfiguredDefaultModifiers.js +20 -22
- package/cjs/config/useConfiguredDefaultProps.js +30 -36
- package/cjs/config/useConfiguredMergedProps.js +8 -11
- package/cjs/index.d.js +0 -1
- package/cjs/index.js +43 -46
- package/cjs/propTypes.js +1 -2
- package/cjs/utils/hooks/useOnClickOutside.js +4 -5
- package/esm/PopoverArrow.js +24 -31
- package/esm/PopoverContent.js +36 -30
- package/esm/config/useConfigDSPopperjs.js +27 -46
- package/esm/config/useConfiguredDefaultModifiers.js +19 -21
- package/esm/config/useConfiguredDefaultProps.js +27 -33
- package/esm/config/useConfiguredMergedProps.js +7 -10
- package/esm/index.d.js +0 -1
- package/esm/index.js +39 -42
- package/esm/propTypes.js +1 -2
- package/esm/utils/hooks/useOnClickOutside.js +3 -4
- package/package.json +60 -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 +16 -0
- package/types/config/useConfiguredMergedProps.d.ts +16 -0
- package/types/index.d.ts +23 -0
- package/types/propTypes.d.ts +54 -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/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/utils/hooks/useOnClickOutside.js.map +0 -1
- package/propTypes/package.json +0 -10
- package/utils/hooks/useOnClickOutside/package.json +0 -10
package/esm/PopoverArrow.js
CHANGED
|
@@ -1,41 +1,34 @@
|
|
|
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
|
-
var StyledArrow = /*#__PURE__*/styled.div.withConfig({
|
|
6
|
+
var _svg;
|
|
7
|
+
const StyledArrow = /*#__PURE__*/styled.div.withConfig({
|
|
7
8
|
componentId: "sc-olcdf1-0"
|
|
8
|
-
})(["position:absolute;width:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(StyledArrow, {
|
|
24
|
-
key: "popper-arrow",
|
|
25
|
-
"data-placement": placement,
|
|
26
|
-
style: style,
|
|
27
|
-
ref: arrowElementRef,
|
|
28
|
-
"data-testid": "ds-tooltip-arrow"
|
|
29
|
-
}, /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
})(["position:absolute;width:18px;height:18px;pointer-events:none;background-color:transparent;& .stroke{fill:", ";fill-opacity:0.4;}& .fill{fill:", ";}&[data-placement^='top']{svg{transform:rotateZ(180deg);}bottom:-18px;}&[data-placement^='right']{svg{transform:rotateZ(-90deg);}left:-18px;}&[data-placement^='bottom']{top:-18px;}&[data-placement^='left']{svg{transform:rotateZ(90deg);}right:-18px;}"], ({
|
|
10
|
+
theme
|
|
11
|
+
}) => theme.colors.neutral['500'], ({
|
|
12
|
+
theme
|
|
13
|
+
}) => theme.colors.neutral['000']);
|
|
14
|
+
const PopoverArrow = ({
|
|
15
|
+
placement,
|
|
16
|
+
style,
|
|
17
|
+
arrowElementRef
|
|
18
|
+
}) => /*#__PURE__*/jsx(StyledArrow, {
|
|
19
|
+
"data-placement": placement,
|
|
20
|
+
style: style,
|
|
21
|
+
ref: arrowElementRef,
|
|
22
|
+
"data-testid": "ds-tooltip-arrow",
|
|
23
|
+
children: _svg || (_svg = /*#__PURE__*/_jsx("svg", {
|
|
30
24
|
viewBox: "0 0 30 30"
|
|
31
|
-
}, /*#__PURE__*/
|
|
25
|
+
}, void 0, /*#__PURE__*/_jsx("path", {
|
|
32
26
|
className: "stroke",
|
|
33
27
|
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"
|
|
34
|
-
}), /*#__PURE__*/
|
|
28
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
35
29
|
className: "fill",
|
|
36
30
|
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"
|
|
37
|
-
})))
|
|
38
|
-
};
|
|
31
|
+
})))
|
|
32
|
+
}, "popper-arrow");
|
|
39
33
|
|
|
40
34
|
export { PopoverArrow };
|
|
41
|
-
//# sourceMappingURL=PopoverArrow.js.map
|
package/esm/PopoverContent.js
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'react';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
5
|
import { PopoverArrow } from './PopoverArrow.js';
|
|
6
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
7
|
|
|
6
|
-
var
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
const StyledPopoverContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
7
12
|
componentId: "sc-1gxm7np-0"
|
|
8
|
-
})(["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);z-index:", ";"],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
13
|
+
})(["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);z-index:", ";"], ({
|
|
14
|
+
zIndex
|
|
15
|
+
}) => zIndex);
|
|
16
|
+
const PopoverContent = ({
|
|
17
|
+
setPopperElement,
|
|
18
|
+
popperStyles,
|
|
19
|
+
popperAttributes,
|
|
20
|
+
children,
|
|
21
|
+
setArrowElement,
|
|
22
|
+
arrowStyle,
|
|
23
|
+
withoutArrow,
|
|
24
|
+
zIndex
|
|
25
|
+
}) => /*#__PURE__*/jsxs(StyledPopoverContentWrapper, _objectSpread(_objectSpread({
|
|
26
|
+
zIndex: zIndex,
|
|
27
|
+
ref: setPopperElement,
|
|
28
|
+
style: popperStyles
|
|
29
|
+
}, popperAttributes), {}, {
|
|
30
|
+
children: [children, withoutArrow === false ? /*#__PURE__*/jsxs(Fragment, {
|
|
31
|
+
children: [/*#__PURE__*/_jsx(PopoverArrow, {
|
|
32
|
+
arrowElementRef: setArrowElement,
|
|
33
|
+
style: arrowStyle,
|
|
34
|
+
placement: popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'
|
|
35
|
+
}), /*#__PURE__*/jsx("div", {
|
|
36
|
+
ref: setArrowElement,
|
|
37
|
+
style: arrowStyle
|
|
38
|
+
})]
|
|
39
|
+
}) : null]
|
|
40
|
+
}));
|
|
34
41
|
|
|
35
42
|
export { PopoverContent };
|
|
36
|
-
//# sourceMappingURL=PopoverContent.js.map
|
|
@@ -1,59 +1,40 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState, useMemo } 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
|
-
setPopperElement = _useState2[1];
|
|
16
|
-
|
|
17
|
-
var _useState3 = useState(null),
|
|
18
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
19
|
-
arrowElement = _useState4[0],
|
|
20
|
-
setArrowElement = _useState4[1];
|
|
21
|
-
|
|
22
|
-
var props = useConfiguredMergedProps({
|
|
7
|
+
const useConfigDSPopperjs = appProps => {
|
|
8
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
9
|
+
const [arrowElement, setArrowElement] = useState(null);
|
|
10
|
+
const props = useConfiguredMergedProps({
|
|
23
11
|
props: appProps,
|
|
24
|
-
arrowElement
|
|
12
|
+
arrowElement
|
|
25
13
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
useOnClickOutside(popperElement, function (e) {
|
|
14
|
+
const {
|
|
15
|
+
referenceElement,
|
|
16
|
+
closeContextMenu,
|
|
17
|
+
modifiers,
|
|
18
|
+
startPlacementPreference
|
|
19
|
+
} = props;
|
|
20
|
+
const popperExtraOpts = useMemo(() => ({
|
|
21
|
+
placement: startPlacementPreference,
|
|
22
|
+
modifiers
|
|
23
|
+
}), [modifiers, startPlacementPreference]);
|
|
24
|
+
const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);
|
|
25
|
+
useOnClickOutside(popperElement, e => {
|
|
39
26
|
var _referenceElement$con;
|
|
40
27
|
|
|
41
|
-
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)))
|
|
42
|
-
closeContextMenu();
|
|
43
|
-
onClickOutside(e);
|
|
44
|
-
}
|
|
28
|
+
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))) closeContextMenu();
|
|
45
29
|
});
|
|
46
|
-
return useMemo(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
}, [arrowElement, popoverHelper, popperElement, props]);
|
|
30
|
+
return useMemo(() => ({
|
|
31
|
+
props,
|
|
32
|
+
popperElement,
|
|
33
|
+
setPopperElement,
|
|
34
|
+
arrowElement,
|
|
35
|
+
setArrowElement,
|
|
36
|
+
popoverHelper
|
|
37
|
+
}), [arrowElement, popoverHelper, popperElement, props]);
|
|
56
38
|
};
|
|
57
39
|
|
|
58
40
|
export { useConfigDSPopperjs };
|
|
59
|
-
//# sourceMappingURL=useConfigDSPopperjs.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const useConfiguredDefaultModifiers = ({
|
|
4
|
+
props,
|
|
5
|
+
arrowElement
|
|
6
|
+
}) => {
|
|
6
7
|
// 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
|
|
8
|
+
const {
|
|
9
|
+
boundaryElement: explicitAppBoundaryElement,
|
|
10
|
+
withoutArrow: explicitAppWithoutArrow = false,
|
|
11
|
+
placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],
|
|
12
|
+
customOffset: explictAppOffset = undefined
|
|
13
|
+
} = props; // to build default modifiers on top of it
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const defaultModifiers = useMemo(() => {
|
|
16
|
+
const mod = [];
|
|
17
17
|
mod.push({
|
|
18
18
|
name: 'hide',
|
|
19
19
|
enabled: true
|
|
@@ -26,7 +26,7 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
26
26
|
}); // we apply an offset if the app defines one or if the app wants the arrow
|
|
27
27
|
|
|
28
28
|
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
29
|
-
|
|
29
|
+
const defaultOffset = explictAppOffset || [0, 14];
|
|
30
30
|
mod.push({
|
|
31
31
|
name: 'offset',
|
|
32
32
|
enabled: true,
|
|
@@ -54,14 +54,12 @@ var useConfiguredDefaultModifiers = function useConfiguredDefaultModifiers(_ref)
|
|
|
54
54
|
return mod;
|
|
55
55
|
}, [arrowElement, explicitAppBoundaryElement, explicitAppWithoutArrow, explicitPlacementOrderPreference, explictAppOffset]); // if the app pass custom modifier, we don't use "default modifiers"
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [explicitAppModifiers]);
|
|
57
|
+
const {
|
|
58
|
+
modifiers: explicitAppModifiers = defaultModifiers
|
|
59
|
+
} = props;
|
|
60
|
+
return useMemo(() => ({
|
|
61
|
+
modifiers: explicitAppModifiers
|
|
62
|
+
}), [explicitAppModifiers]);
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
export { useConfiguredDefaultModifiers };
|
|
67
|
-
//# sourceMappingURL=useConfiguredDefaultModifiers.js.map
|
|
@@ -6,42 +6,36 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const noop = () => {};
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const emptyObj = {};
|
|
12
|
+
const useConfiguredDefaultProps = ({
|
|
13
|
+
props,
|
|
14
|
+
arrowElement
|
|
15
|
+
}) => {
|
|
15
16
|
// don't move this out of the hook or `document.body` will explode
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var defaultProps = useMemo(function () {
|
|
39
|
-
return _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
|
|
40
|
-
modifiers: configuredModifiers
|
|
41
|
-
});
|
|
42
|
-
}, [configuredModifiers, staticDefaultProps]);
|
|
17
|
+
const staticDefaultProps = useMemo(() => ({
|
|
18
|
+
referenceElement: null,
|
|
19
|
+
showPopover: false,
|
|
20
|
+
closeContextMenu: noop,
|
|
21
|
+
withoutPortal: false,
|
|
22
|
+
withoutArrow: false,
|
|
23
|
+
portalDOMContainer: document.body,
|
|
24
|
+
startPlacementPreference: 'top',
|
|
25
|
+
placementOrderPreference: ['top', 'bottom', 'left', 'right'],
|
|
26
|
+
zIndex: 1,
|
|
27
|
+
extraPopperStyles: emptyObj
|
|
28
|
+
}), []);
|
|
29
|
+
const {
|
|
30
|
+
modifiers: configuredModifiers
|
|
31
|
+
} = useConfiguredDefaultModifiers({
|
|
32
|
+
props,
|
|
33
|
+
arrowElement
|
|
34
|
+
});
|
|
35
|
+
const defaultProps = useMemo(() => _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
|
|
36
|
+
modifiers: configuredModifiers
|
|
37
|
+
}), [configuredModifiers, staticDefaultProps]);
|
|
43
38
|
return defaultProps;
|
|
44
39
|
};
|
|
45
40
|
|
|
46
41
|
export { useConfiguredDefaultProps };
|
|
47
|
-
//# sourceMappingURL=useConfiguredDefaultProps.js.map
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
|
|
2
2
|
import { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';
|
|
3
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import 'react';
|
|
5
|
-
import './useConfiguredDefaultModifiers.js';
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const useConfiguredMergedProps = ({
|
|
5
|
+
props,
|
|
6
|
+
arrowElement
|
|
7
|
+
}) => {
|
|
8
|
+
const defaultProps = useConfiguredDefaultProps({
|
|
9
|
+
props,
|
|
10
|
+
arrowElement
|
|
13
11
|
});
|
|
14
12
|
return useMemoMergePropsWithDefault(props, defaultProps);
|
|
15
13
|
};
|
|
16
14
|
|
|
17
15
|
export { useConfiguredMergedProps };
|
|
18
|
-
//# sourceMappingURL=useConfiguredMergedProps.js.map
|
package/esm/index.d.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -1,64 +1,61 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
1
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
3
|
+
import { useMemo } from 'react';
|
|
3
4
|
import { createPortal } from 'react-dom';
|
|
4
5
|
import { describe } from 'react-desc';
|
|
5
6
|
import { dspopperjsPropTypes } from './propTypes.js';
|
|
6
7
|
import { PopoverContent } from './PopoverContent.js';
|
|
7
8
|
import { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';
|
|
8
|
-
import '
|
|
9
|
-
import 'styled-components';
|
|
10
|
-
import './PopoverArrow.js';
|
|
11
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
12
|
-
import 'react-popper';
|
|
13
|
-
import './config/useConfiguredMergedProps.js';
|
|
14
|
-
import '@elliemae/ds-props-helpers';
|
|
15
|
-
import './config/useConfiguredDefaultProps.js';
|
|
16
|
-
import './config/useConfiguredDefaultModifiers.js';
|
|
17
|
-
import './utils/hooks/useOnClickOutside.js';
|
|
9
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
18
10
|
|
|
19
11
|
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
12
|
|
|
21
13
|
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
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
showPopover
|
|
27
|
-
withoutPortal
|
|
28
|
-
withoutArrow
|
|
29
|
-
portalDOMContainer
|
|
30
|
-
zIndex
|
|
31
|
-
extraPopperStyles
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
15
|
+
const DSPopperJS = props => {
|
|
16
|
+
const {
|
|
17
|
+
props: {
|
|
18
|
+
showPopover,
|
|
19
|
+
withoutPortal,
|
|
20
|
+
withoutArrow,
|
|
21
|
+
portalDOMContainer,
|
|
22
|
+
zIndex,
|
|
23
|
+
extraPopperStyles
|
|
24
|
+
},
|
|
25
|
+
setPopperElement,
|
|
26
|
+
setArrowElement,
|
|
27
|
+
popoverHelper
|
|
28
|
+
} = useConfigDSPopperjs(props);
|
|
29
|
+
const {
|
|
30
|
+
children
|
|
31
|
+
} = props;
|
|
32
|
+
const {
|
|
33
|
+
styles,
|
|
34
|
+
attributes
|
|
35
|
+
} = popoverHelper;
|
|
36
|
+
const contentJSX = useMemo(() => /*#__PURE__*/_jsx(PopoverContent, {
|
|
37
|
+
setPopperElement: setPopperElement,
|
|
38
|
+
popperStyles: _objectSpread(_objectSpread({}, styles.popper), extraPopperStyles),
|
|
39
|
+
popperAttributes: attributes.popper,
|
|
40
|
+
setArrowElement: setArrowElement,
|
|
41
|
+
arrowStyle: styles.arrow,
|
|
42
|
+
withoutArrow: withoutArrow,
|
|
43
|
+
zIndex: zIndex
|
|
44
|
+
}, void 0, children), [attributes.popper, children, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
|
|
50
45
|
|
|
51
46
|
if (showPopover) {
|
|
52
47
|
if (withoutPortal === true) return contentJSX;
|
|
53
|
-
if (withoutPortal === false) return /*#__PURE__*/
|
|
48
|
+
if (withoutPortal === false) return /*#__PURE__*/jsx(Fragment, {
|
|
49
|
+
children: /*#__PURE__*/createPortal( /*#__PURE__*/jsx(Fragment, {
|
|
50
|
+
children: contentJSX
|
|
51
|
+
}), portalDOMContainer)
|
|
52
|
+
});
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
return null;
|
|
57
56
|
};
|
|
58
57
|
|
|
59
|
-
DSPopperJS.
|
|
60
|
-
var DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
|
|
58
|
+
const DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
|
|
61
59
|
DSPopperJSWithSchema.propTypes = dspopperjsPropTypes;
|
|
62
60
|
|
|
63
61
|
export { DSPopperJS, DSPopperJSWithSchema, DSPopperJS as default };
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
package/esm/propTypes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const dspopperjsPropTypes = {
|
|
4
4
|
/**
|
|
5
5
|
* React ref to popperjs referenceElement
|
|
6
6
|
*/
|
|
@@ -67,4 +67,3 @@ var dspopperjsPropTypes = {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
export { dspopperjsPropTypes };
|
|
70
|
-
//# sourceMappingURL=propTypes.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
function useOnClickOutside(ref, cb) {
|
|
4
|
-
useEffect(
|
|
5
|
-
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const listener = event => {
|
|
6
6
|
var _ref$contains;
|
|
7
7
|
|
|
8
8
|
// Do nothing if clicking ref's element or descendent elements
|
|
@@ -15,7 +15,7 @@ function useOnClickOutside(ref, cb) {
|
|
|
15
15
|
|
|
16
16
|
document.addEventListener('mousedown', listener);
|
|
17
17
|
document.addEventListener('touchstart', listener);
|
|
18
|
-
return
|
|
18
|
+
return () => {
|
|
19
19
|
document.removeEventListener('mousedown', listener);
|
|
20
20
|
document.removeEventListener('touchstart', listener);
|
|
21
21
|
};
|
|
@@ -23,4 +23,3 @@ function useOnClickOutside(ref, cb) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { useOnClickOutside };
|
|
26
|
-
//# sourceMappingURL=useOnClickOutside.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-popperjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.11",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"module": "esm/index.js",
|
|
7
|
-
"main": "cjs/index.js",
|
|
5
|
+
"description": "ICE MT - Dimsum - Popper JS Wrapper",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./utils/hooks/useOnClickOutside": {
|
|
15
|
+
"import": "./esm/utils/hooks/useOnClickOutside.js",
|
|
16
|
+
"require": "./cjs/utils/hooks/useOnClickOutside.js"
|
|
17
|
+
},
|
|
18
|
+
"./propTypes": {
|
|
19
|
+
"import": "./esm/propTypes.js",
|
|
20
|
+
"require": "./cjs/propTypes.js"
|
|
21
|
+
},
|
|
22
|
+
"./PopoverContent": {
|
|
23
|
+
"import": "./esm/PopoverContent.js",
|
|
24
|
+
"require": "./cjs/PopoverContent.js"
|
|
25
|
+
},
|
|
26
|
+
"./PopoverArrow": {
|
|
27
|
+
"import": "./esm/PopoverArrow.js",
|
|
28
|
+
"require": "./cjs/PopoverArrow.js"
|
|
29
|
+
},
|
|
30
|
+
"./config/useConfiguredMergedProps": {
|
|
31
|
+
"import": "./esm/config/useConfiguredMergedProps.js",
|
|
32
|
+
"require": "./cjs/config/useConfiguredMergedProps.js"
|
|
33
|
+
},
|
|
34
|
+
"./config/useConfiguredDefaultProps": {
|
|
35
|
+
"import": "./esm/config/useConfiguredDefaultProps.js",
|
|
36
|
+
"require": "./cjs/config/useConfiguredDefaultProps.js"
|
|
37
|
+
},
|
|
38
|
+
"./config/useConfiguredDefaultModifiers": {
|
|
39
|
+
"import": "./esm/config/useConfiguredDefaultModifiers.js",
|
|
40
|
+
"require": "./cjs/config/useConfiguredDefaultModifiers.js"
|
|
41
|
+
},
|
|
42
|
+
"./config/useConfigDSPopperjs": {
|
|
43
|
+
"import": "./esm/config/useConfigDSPopperjs.js",
|
|
44
|
+
"require": "./cjs/config/useConfigDSPopperjs.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
8
47
|
"sideEffects": [
|
|
9
48
|
"*.css",
|
|
10
49
|
"*.scss"
|
|
11
50
|
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"npm": ">=7",
|
|
57
|
+
"node": ">=14"
|
|
58
|
+
},
|
|
59
|
+
"author": "ICE MT",
|
|
12
60
|
"scripts": {
|
|
13
61
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
62
|
"prebuild": "exit 0",
|
|
@@ -16,19 +64,20 @@
|
|
|
16
64
|
"build": "node ../../scripts/build/build.js"
|
|
17
65
|
},
|
|
18
66
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-props-helpers": "
|
|
20
|
-
"react-
|
|
67
|
+
"@elliemae/ds-props-helpers": "2.0.0-alpha.11",
|
|
68
|
+
"react-desc": "~4.1.3"
|
|
21
69
|
},
|
|
22
70
|
"devDependencies": {
|
|
23
|
-
"styled-components": "~5.3.
|
|
71
|
+
"styled-components": "~5.3.1"
|
|
24
72
|
},
|
|
25
73
|
"peerDependencies": {
|
|
26
|
-
"react": "^17.0.
|
|
27
|
-
"react-dom": "^17.0.
|
|
28
|
-
"styled-components": "^5.3.
|
|
74
|
+
"react": "^17.0.2",
|
|
75
|
+
"react-dom": "^17.0.2",
|
|
76
|
+
"styled-components": "^5.3.1"
|
|
29
77
|
},
|
|
30
78
|
"publishConfig": {
|
|
31
79
|
"access": "public",
|
|
32
|
-
"directory": "dist"
|
|
80
|
+
"directory": "dist",
|
|
81
|
+
"generateSubmodules": true
|
|
33
82
|
}
|
|
34
83
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PopoverArrowT {
|
|
3
|
+
placement: string;
|
|
4
|
+
style: React.CSSProperties;
|
|
5
|
+
arrowElementRef: React.Dispatch<React.SetStateAction<HTMLDivElement>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const PopoverArrow: ({ placement, style, arrowElementRef }: PopoverArrowT) => React.ReactElement;
|
|
8
|
+
export {};
|