@elliemae/ds-popperjs 2.3.1 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/PopoverArrow.js +91 -0
- package/dist/cjs/PopoverArrow.js.map +7 -0
- package/dist/cjs/PopoverContent.js +89 -0
- package/dist/cjs/PopoverContent.js.map +7 -0
- package/dist/cjs/config/useConfigDSPopperjs.js +69 -0
- package/dist/cjs/config/useConfigDSPopperjs.js.map +7 -0
- package/dist/cjs/config/useConfiguredDefaultModifiers.js +89 -0
- package/dist/cjs/config/useConfiguredDefaultModifiers.js.map +7 -0
- package/dist/cjs/config/useConfiguredDefaultProps.js +79 -0
- package/dist/cjs/config/useConfiguredDefaultProps.js.map +7 -0
- package/dist/cjs/config/useConfiguredMergedProps.js +40 -0
- package/dist/cjs/config/useConfiguredMergedProps.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +115 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +80 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/styled.js +71 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/utils/hooks/useOnClickOutside.js +51 -0
- package/dist/cjs/utils/hooks/useOnClickOutside.js.map +7 -0
- package/dist/esm/PopoverArrow.js +62 -0
- package/dist/esm/PopoverArrow.js.map +7 -0
- package/dist/esm/PopoverContent.js +62 -0
- package/dist/esm/PopoverContent.js.map +7 -0
- package/dist/esm/config/useConfigDSPopperjs.js +40 -0
- package/dist/esm/config/useConfigDSPopperjs.js.map +7 -0
- package/dist/esm/config/useConfiguredDefaultModifiers.js +60 -0
- package/dist/esm/config/useConfiguredDefaultModifiers.js.map +7 -0
- package/dist/esm/config/useConfiguredDefaultProps.js +52 -0
- package/dist/esm/config/useConfiguredDefaultProps.js.map +7 -0
- package/dist/esm/config/useConfiguredMergedProps.js +11 -0
- package/dist/esm/config/useConfiguredMergedProps.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +88 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +51 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/styled.js +42 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js +22 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js.map +7 -0
- package/package.json +44 -35
- package/cjs/PopoverArrow.js +0 -54
- package/cjs/PopoverContent.js +0 -71
- package/cjs/config/useConfigDSPopperjs.js +0 -60
- package/cjs/config/useConfiguredDefaultModifiers.js +0 -70
- package/cjs/config/useConfiguredDefaultProps.js +0 -58
- package/cjs/config/useConfiguredMergedProps.js +0 -20
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -85
- package/cjs/propTypes.js +0 -85
- package/cjs/styled.js +0 -37
- package/cjs/utils/hooks/useOnClickOutside.js +0 -29
- package/esm/PopoverArrow.js +0 -45
- package/esm/PopoverContent.js +0 -62
- package/esm/config/useConfigDSPopperjs.js +0 -56
- package/esm/config/useConfiguredDefaultModifiers.js +0 -66
- package/esm/config/useConfiguredDefaultProps.js +0 -50
- package/esm/config/useConfiguredMergedProps.js +0 -16
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -74
- package/esm/propTypes.js +0 -81
- package/esm/styled.js +0 -27
- package/esm/utils/hooks/useOnClickOutside.js +0 -25
- package/types/PopoverArrow.d.ts +0 -8
- package/types/PopoverContent.d.ts +0 -3
- package/types/config/useConfigDSPopperjs.d.ts +0 -2
- package/types/config/useConfiguredDefaultModifiers.d.ts +0 -6
- package/types/config/useConfiguredDefaultProps.d.ts +0 -19
- package/types/config/useConfiguredMergedProps.d.ts +0 -19
- package/types/index.d.ts +0 -58
- package/types/propTypes.d.ts +0 -95
- package/types/styled.d.ts +0 -11
- package/types/utils/hooks/useOnClickOutside.d.ts +0 -4
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
const useConfiguredDefaultModifiers = _ref => {
|
|
4
|
-
let {
|
|
5
|
-
props,
|
|
6
|
-
arrowElement
|
|
7
|
-
} = _ref;
|
|
8
|
-
// we destructure explicit app definitions before merge
|
|
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
|
|
15
|
-
|
|
16
|
-
const defaultModifiers = useMemo(() => {
|
|
17
|
-
const mod = [];
|
|
18
|
-
mod.push({
|
|
19
|
-
name: 'hide',
|
|
20
|
-
enabled: true
|
|
21
|
-
});
|
|
22
|
-
mod.push({
|
|
23
|
-
name: 'flip',
|
|
24
|
-
options: {
|
|
25
|
-
fallbackPlacements: explicitPlacementOrderPreference
|
|
26
|
-
}
|
|
27
|
-
}); // we apply an offset if the app defines one or if the app wants the arrow
|
|
28
|
-
|
|
29
|
-
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
30
|
-
const defaultOffset = explictAppOffset || [0, 14];
|
|
31
|
-
mod.push({
|
|
32
|
-
name: 'offset',
|
|
33
|
-
enabled: true,
|
|
34
|
-
options: {
|
|
35
|
-
offset: defaultOffset
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
} // the app can opt for a "no arrow" implementation (we do so in datatable/calendar etc...)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!explicitAppWithoutArrow) mod.push({
|
|
42
|
-
name: 'arrow',
|
|
43
|
-
options: {
|
|
44
|
-
element: arrowElement,
|
|
45
|
-
padding: 18
|
|
46
|
-
}
|
|
47
|
-
}); // the app can define an explicit element to act as a boundary instead of popperjs default one
|
|
48
|
-
|
|
49
|
-
if (explicitAppBoundaryElement) mod.push({
|
|
50
|
-
name: 'preventOverflow',
|
|
51
|
-
options: {
|
|
52
|
-
boundary: explicitAppBoundaryElement
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return mod;
|
|
56
|
-
}, [arrowElement, explicitAppBoundaryElement, explicitAppWithoutArrow, explicitPlacementOrderPreference, explictAppOffset]); // if the app pass custom modifier, we don't use "default modifiers"
|
|
57
|
-
|
|
58
|
-
const {
|
|
59
|
-
modifiers: explicitAppModifiers = defaultModifiers
|
|
60
|
-
} = props;
|
|
61
|
-
return useMemo(() => ({
|
|
62
|
-
modifiers: explicitAppModifiers
|
|
63
|
-
}), [explicitAppModifiers]);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { useConfiguredDefaultModifiers };
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { useMemo } from 'react';
|
|
8
|
-
import { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';
|
|
9
|
-
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
|
|
14
|
-
const noop = () => {};
|
|
15
|
-
|
|
16
|
-
const emptyObj = {};
|
|
17
|
-
const useConfiguredDefaultProps = _ref => {
|
|
18
|
-
let {
|
|
19
|
-
props,
|
|
20
|
-
arrowElement
|
|
21
|
-
} = _ref;
|
|
22
|
-
// don't move this out of the hook or `document.body` will explode
|
|
23
|
-
const staticDefaultProps = useMemo(() => ({
|
|
24
|
-
referenceElement: null,
|
|
25
|
-
showPopover: false,
|
|
26
|
-
closeContextMenu: noop,
|
|
27
|
-
onClickOutside: noop,
|
|
28
|
-
withoutPortal: false,
|
|
29
|
-
withoutArrow: false,
|
|
30
|
-
withoutAnimation: false,
|
|
31
|
-
animationDuration: 100,
|
|
32
|
-
portalDOMContainer: document.body,
|
|
33
|
-
startPlacementPreference: 'top',
|
|
34
|
-
placementOrderPreference: ['top', 'bottom', 'left', 'right'],
|
|
35
|
-
zIndex: 1,
|
|
36
|
-
extraPopperStyles: emptyObj
|
|
37
|
-
}), []);
|
|
38
|
-
const {
|
|
39
|
-
modifiers: configuredModifiers
|
|
40
|
-
} = useConfiguredDefaultModifiers({
|
|
41
|
-
props,
|
|
42
|
-
arrowElement
|
|
43
|
-
});
|
|
44
|
-
const defaultProps = useMemo(() => _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
|
|
45
|
-
modifiers: configuredModifiers
|
|
46
|
-
}), [configuredModifiers, staticDefaultProps]);
|
|
47
|
-
return defaultProps;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { useConfiguredDefaultProps };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
|
|
2
|
-
import { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';
|
|
3
|
-
|
|
4
|
-
const useConfiguredMergedProps = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
props,
|
|
7
|
-
arrowElement
|
|
8
|
-
} = _ref;
|
|
9
|
-
const defaultProps = useConfiguredDefaultProps({
|
|
10
|
-
props,
|
|
11
|
-
arrowElement
|
|
12
|
-
});
|
|
13
|
-
return useMemoMergePropsWithDefault(props, defaultProps);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { useConfiguredMergedProps };
|
package/esm/index.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/esm/index.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import { useMemo } from 'react';
|
|
9
|
-
import { createPortal } from 'react-dom';
|
|
10
|
-
import { describe } from 'react-desc';
|
|
11
|
-
import { dspopperjsPropTypes } from './propTypes.js';
|
|
12
|
-
import { PopoverContent } from './PopoverContent.js';
|
|
13
|
-
import { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';
|
|
14
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
|
-
const DSPopperJS = props => {
|
|
21
|
-
const {
|
|
22
|
-
props: {
|
|
23
|
-
showPopover,
|
|
24
|
-
withoutAnimation,
|
|
25
|
-
animationDuration,
|
|
26
|
-
withoutPortal,
|
|
27
|
-
withoutArrow,
|
|
28
|
-
portalDOMContainer,
|
|
29
|
-
zIndex,
|
|
30
|
-
extraPopperStyles
|
|
31
|
-
},
|
|
32
|
-
setPopperElement,
|
|
33
|
-
setArrowElement,
|
|
34
|
-
setIsAnimating,
|
|
35
|
-
popoverHelper,
|
|
36
|
-
isAnimating
|
|
37
|
-
} = useConfigDSPopperjs(props);
|
|
38
|
-
const {
|
|
39
|
-
children
|
|
40
|
-
} = props;
|
|
41
|
-
const {
|
|
42
|
-
styles,
|
|
43
|
-
attributes
|
|
44
|
-
} = popoverHelper;
|
|
45
|
-
const contentJSX = useMemo(() => /*#__PURE__*/_jsx(PopoverContent, {
|
|
46
|
-
setPopperElement: setPopperElement,
|
|
47
|
-
popperStyles: _objectSpread(_objectSpread({}, styles.popper), extraPopperStyles),
|
|
48
|
-
popperAttributes: attributes.popper,
|
|
49
|
-
setArrowElement: setArrowElement,
|
|
50
|
-
arrowStyle: styles.arrow,
|
|
51
|
-
withoutArrow: withoutArrow,
|
|
52
|
-
withoutAnimation: withoutAnimation,
|
|
53
|
-
animationDuration: animationDuration,
|
|
54
|
-
zIndex: zIndex,
|
|
55
|
-
showPopover: showPopover,
|
|
56
|
-
setIsAnimating: setIsAnimating
|
|
57
|
-
}, void 0, children), [attributes.popper, children, setIsAnimating, showPopover, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, withoutAnimation, animationDuration, zIndex]);
|
|
58
|
-
|
|
59
|
-
if (showPopover || isAnimating) {
|
|
60
|
-
if (withoutPortal === true) return contentJSX;
|
|
61
|
-
if (withoutPortal === false) return /*#__PURE__*/jsx(Fragment, {
|
|
62
|
-
children: /*#__PURE__*/createPortal( /*#__PURE__*/jsx(Fragment, {
|
|
63
|
-
children: contentJSX
|
|
64
|
-
}), portalDOMContainer)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return null;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
|
|
72
|
-
DSPopperJSWithSchema.propTypes = dspopperjsPropTypes;
|
|
73
|
-
|
|
74
|
-
export { DSPopperJS, DSPopperJSWithSchema, DSPopperJS as default };
|
package/esm/propTypes.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
|
|
3
|
-
const dspopperjsPropTypes = {
|
|
4
|
-
/**
|
|
5
|
-
* React ref to popperjs referenceElement
|
|
6
|
-
*/
|
|
7
|
-
referenceElement: PropTypes.element.description('popperjs DOM referenceElement').isRequired,
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Wheter or not to show the popper content
|
|
11
|
-
*/
|
|
12
|
-
showPopover: PropTypes.bool.description('whether or not to show the popper content').isRequired,
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Callback to close the context menu, used for "on click outside",
|
|
16
|
-
* if not provided click outside will not trigger anything
|
|
17
|
-
*/
|
|
18
|
-
closeContextMenu: PropTypes.func.description('Callback to close the context menu, used for "on click outside",' + ' if not provided click outside will not trigger anything').defaultValue('() => {}'),
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Wheter or not the popper content should appear in a DOM portal or not
|
|
22
|
-
*/
|
|
23
|
-
withoutPortal: PropTypes.bool.description('Whether or not the popper content should appear in a DOM portal or not').defaultValue(true),
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Wheter or not the popper context menu should print the arrow
|
|
27
|
-
*/
|
|
28
|
-
withoutArrow: PropTypes.bool.description('Whether or not the popper context menu should print the arrow').defaultValue(false),
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Whether or not the popper context menu should be animated
|
|
32
|
-
*/
|
|
33
|
-
withoutAnimation: PropTypes.bool.description('Whether or not the popper context menu should be animated').defaultValue(false),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Popper context menus Animation duration in ms
|
|
37
|
-
*/
|
|
38
|
-
animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
42
|
-
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
43
|
-
*/
|
|
44
|
-
boundaryElement: PropTypes.element.description('Bounding element to calculate upon, defaults to "clippingParents",' + 'which are the scrolling containers that may cause element to be partially or fully cut off').defaultValue(undefined),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
48
|
-
*/
|
|
49
|
-
portalDOMContainer: PropTypes.element.description('When using portal, the container in which to append the DOM content, defaults to document body').defaultValue(undefined),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* start placement preferences, as per popperjs placement option
|
|
53
|
-
*/
|
|
54
|
-
startPlacementPreference: PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']).description('start placement preferences, as per popperjs placement option').defaultValue("'top'"),
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Array of placement preferences, as per popperjs "flip" placement option
|
|
58
|
-
*/
|
|
59
|
-
placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'])).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* popperjs content z-index
|
|
63
|
-
*/
|
|
64
|
-
zIndex: PropTypes.number.description('popperjs content z-index').defaultValue(1),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* placement offset array
|
|
68
|
-
*/
|
|
69
|
-
customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue(1),
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* modifiers array for full-custom popper-js override
|
|
73
|
-
* https://popper.js.org/docs/v2/modifiers/
|
|
74
|
-
*/
|
|
75
|
-
modifiers: PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
|
|
76
|
-
extraPopperStyles: PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({}),
|
|
77
|
-
onClickOutside: PropTypes.func.description('Callback triggered when clicking outside the popper').defaultValue(() => null),
|
|
78
|
-
children: PropTypes.node.description('The content of the popper').defaultValue(undefined)
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export { dspopperjsPropTypes };
|
package/esm/styled.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { kfrm, css } from '@elliemae/ds-system';
|
|
4
|
-
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
6
|
-
const showAnimation = kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
7
|
-
const hideAnimation = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])));
|
|
8
|
-
const StyledPopoverContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
9
|
-
componentId: "sc-1giz5kx-0"
|
|
10
|
-
})(["z-index:", ";"], _ref => {
|
|
11
|
-
let {
|
|
12
|
-
zIndex
|
|
13
|
-
} = _ref;
|
|
14
|
-
return zIndex;
|
|
15
|
-
});
|
|
16
|
-
const StyledAnimatedPopper = /*#__PURE__*/styled.div.withConfig({
|
|
17
|
-
componentId: "sc-1giz5kx-1"
|
|
18
|
-
})(["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 => {
|
|
19
|
-
let {
|
|
20
|
-
showPopover,
|
|
21
|
-
animationDuration,
|
|
22
|
-
withoutAnimation
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return !withoutAnimation && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " ", "ms ease-in;\n "])), showPopover ? showAnimation : hideAnimation, animationDuration);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export { StyledAnimatedPopper, StyledPopoverContentWrapper };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
function useOnClickOutside(ref, cb) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const listener = event => {
|
|
6
|
-
var _ref$contains;
|
|
7
|
-
|
|
8
|
-
// Do nothing if clicking ref's element or descendent elements
|
|
9
|
-
if (!ref || ref !== null && ref !== void 0 && (_ref$contains = ref.contains) !== null && _ref$contains !== void 0 && _ref$contains.call(ref, event.target)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
cb(event);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
document.addEventListener('mousedown', listener);
|
|
17
|
-
document.addEventListener('touchstart', listener);
|
|
18
|
-
return () => {
|
|
19
|
-
document.removeEventListener('mousedown', listener);
|
|
20
|
-
document.removeEventListener('touchstart', listener);
|
|
21
|
-
};
|
|
22
|
-
}, [ref, cb]);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { useOnClickOutside };
|
package/types/PopoverArrow.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { PopoverContentPropsT } from './index.d';
|
|
3
|
-
export declare const PopoverContent: ({ setPopperElement, popperStyles, popperAttributes, children, showPopover, setArrowElement, setIsAnimating, arrowStyle, withoutArrow, withoutAnimation, animationDuration, zIndex, }: PopoverContentPropsT) => JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const useConfiguredDefaultProps: ({ props, arrowElement }: {
|
|
2
|
-
props: any;
|
|
3
|
-
arrowElement: any;
|
|
4
|
-
}) => {
|
|
5
|
-
modifiers: any;
|
|
6
|
-
referenceElement: null;
|
|
7
|
-
showPopover: boolean;
|
|
8
|
-
closeContextMenu: () => void;
|
|
9
|
-
onClickOutside: () => void;
|
|
10
|
-
withoutPortal: boolean;
|
|
11
|
-
withoutArrow: boolean;
|
|
12
|
-
withoutAnimation: boolean;
|
|
13
|
-
animationDuration: number;
|
|
14
|
-
portalDOMContainer: HTMLElement;
|
|
15
|
-
startPlacementPreference: string;
|
|
16
|
-
placementOrderPreference: string[];
|
|
17
|
-
zIndex: number;
|
|
18
|
-
extraPopperStyles: {};
|
|
19
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const useConfiguredMergedProps: ({ props, arrowElement }: {
|
|
2
|
-
props: any;
|
|
3
|
-
arrowElement: any;
|
|
4
|
-
}) => {
|
|
5
|
-
modifiers: any;
|
|
6
|
-
referenceElement: null;
|
|
7
|
-
showPopover: boolean;
|
|
8
|
-
closeContextMenu: () => void;
|
|
9
|
-
onClickOutside: () => void;
|
|
10
|
-
withoutPortal: boolean;
|
|
11
|
-
withoutArrow: boolean;
|
|
12
|
-
withoutAnimation: boolean;
|
|
13
|
-
animationDuration: number;
|
|
14
|
-
portalDOMContainer: HTMLElement;
|
|
15
|
-
startPlacementPreference: string;
|
|
16
|
-
placementOrderPreference: string[];
|
|
17
|
-
zIndex: number;
|
|
18
|
-
extraPopperStyles: {};
|
|
19
|
-
};
|
package/types/index.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
import type { DSDSPopperjsPropsT } from './index.d';
|
|
4
|
-
declare const DSPopperJS: {
|
|
5
|
-
(props: DSDSPopperjsPropsT): JSX.Element;
|
|
6
|
-
propTypes: {
|
|
7
|
-
referenceElement: import("react-desc").PropTypesDescValue;
|
|
8
|
-
showPopover: import("react-desc").PropTypesDescValue;
|
|
9
|
-
closeContextMenu: {
|
|
10
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
11
|
-
};
|
|
12
|
-
withoutPortal: {
|
|
13
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
-
};
|
|
15
|
-
withoutArrow: {
|
|
16
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
17
|
-
};
|
|
18
|
-
withoutAnimation: {
|
|
19
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
20
|
-
};
|
|
21
|
-
animationDuration: {
|
|
22
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
-
};
|
|
24
|
-
boundaryElement: {
|
|
25
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
-
};
|
|
27
|
-
portalDOMContainer: {
|
|
28
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
-
};
|
|
30
|
-
startPlacementPreference: {
|
|
31
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
-
};
|
|
33
|
-
placementOrderPreference: {
|
|
34
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
-
};
|
|
36
|
-
zIndex: {
|
|
37
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
38
|
-
};
|
|
39
|
-
customOffset: {
|
|
40
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
41
|
-
};
|
|
42
|
-
modifiers: {
|
|
43
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
44
|
-
};
|
|
45
|
-
extraPopperStyles: {
|
|
46
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
-
};
|
|
48
|
-
onClickOutside: {
|
|
49
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
50
|
-
};
|
|
51
|
-
children: {
|
|
52
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
declare const DSPopperJSWithSchema: any;
|
|
57
|
-
export { DSPopperJS, DSPopperJSWithSchema };
|
|
58
|
-
export default DSPopperJS;
|
package/types/propTypes.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
-
export declare const dspopperjsPropTypes: {
|
|
3
|
-
/**
|
|
4
|
-
* React ref to popperjs referenceElement
|
|
5
|
-
*/
|
|
6
|
-
referenceElement: import("react-desc").PropTypesDescValue;
|
|
7
|
-
/**
|
|
8
|
-
* Wheter or not to show the popper content
|
|
9
|
-
*/
|
|
10
|
-
showPopover: import("react-desc").PropTypesDescValue;
|
|
11
|
-
/**
|
|
12
|
-
* Callback to close the context menu, used for "on click outside",
|
|
13
|
-
* if not provided click outside will not trigger anything
|
|
14
|
-
*/
|
|
15
|
-
closeContextMenu: {
|
|
16
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Wheter or not the popper content should appear in a DOM portal or not
|
|
20
|
-
*/
|
|
21
|
-
withoutPortal: {
|
|
22
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Wheter or not the popper context menu should print the arrow
|
|
26
|
-
*/
|
|
27
|
-
withoutArrow: {
|
|
28
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Whether or not the popper context menu should be animated
|
|
32
|
-
*/
|
|
33
|
-
withoutAnimation: {
|
|
34
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Popper context menus Animation duration in ms
|
|
38
|
-
*/
|
|
39
|
-
animationDuration: {
|
|
40
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
44
|
-
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
45
|
-
*/
|
|
46
|
-
boundaryElement: {
|
|
47
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
51
|
-
*/
|
|
52
|
-
portalDOMContainer: {
|
|
53
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* start placement preferences, as per popperjs placement option
|
|
57
|
-
*/
|
|
58
|
-
startPlacementPreference: {
|
|
59
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Array of placement preferences, as per popperjs "flip" placement option
|
|
63
|
-
*/
|
|
64
|
-
placementOrderPreference: {
|
|
65
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* popperjs content z-index
|
|
69
|
-
*/
|
|
70
|
-
zIndex: {
|
|
71
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* placement offset array
|
|
75
|
-
*/
|
|
76
|
-
customOffset: {
|
|
77
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* modifiers array for full-custom popper-js override
|
|
81
|
-
* https://popper.js.org/docs/v2/modifiers/
|
|
82
|
-
*/
|
|
83
|
-
modifiers: {
|
|
84
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
85
|
-
};
|
|
86
|
-
extraPopperStyles: {
|
|
87
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
88
|
-
};
|
|
89
|
-
onClickOutside: {
|
|
90
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
91
|
-
};
|
|
92
|
-
children: {
|
|
93
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
94
|
-
};
|
|
95
|
-
};
|
package/types/styled.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface StyledContentWrapperPropsT {
|
|
2
|
-
zIndex: number;
|
|
3
|
-
}
|
|
4
|
-
interface StyledAnimatedPopperPropsT {
|
|
5
|
-
showPopover: boolean;
|
|
6
|
-
animationDuration: number;
|
|
7
|
-
withoutAnimation: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const StyledPopoverContentWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledContentWrapperPropsT, never>;
|
|
10
|
-
export declare const StyledAnimatedPopper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledAnimatedPopperPropsT, never>;
|
|
11
|
-
export {};
|