@elliemae/ds-popperjs 2.0.0-next.9 → 2.0.0-rc.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.
@@ -13,31 +13,42 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
13
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
14
14
 
15
15
  var _svg;
16
+ const arrowWidth = 18;
17
+ const arrowHeight = 18;
16
18
  const StyledArrow = /*#__PURE__*/styled__default["default"].div.withConfig({
17
19
  componentId: "sc-olcdf1-0"
18
- })(["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;}"], ({
19
- theme
20
- }) => theme.colors.neutral['500'], ({
21
- theme
22
- }) => theme.colors.neutral['000']);
23
- const PopoverArrow = ({
24
- placement,
25
- style,
26
- arrowElementRef
27
- }) => /*#__PURE__*/jsxRuntime.jsx(StyledArrow, {
28
- "data-placement": placement,
29
- style: style,
30
- ref: arrowElementRef,
31
- "data-testid": "ds-tooltip-arrow",
32
- children: _svg || (_svg = /*#__PURE__*/_jsx__default["default"]("svg", {
33
- viewBox: "0 0 30 30"
34
- }, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
35
- className: "stroke",
36
- 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"
37
- }), /*#__PURE__*/_jsx__default["default"]("path", {
38
- className: "fill",
39
- 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"
40
- })))
41
- }, "popper-arrow");
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;
24
+ return theme.colors.neutral['500'];
25
+ }, _ref2 => {
26
+ let {
27
+ theme
28
+ } = _ref2;
29
+ return theme.colors.neutral['000'];
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, {
38
+ "data-placement": placement,
39
+ style: style,
40
+ ref: arrowElementRef,
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");
52
+ };
42
53
 
43
54
  exports.PopoverArrow = PopoverArrow;
@@ -2,51 +2,70 @@
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
11
  var _jsx = require('@babel/runtime/helpers/jsx');
7
- require('react');
8
- var styled = require('styled-components');
12
+ var react = require('react');
9
13
  var PopoverArrow = require('./PopoverArrow.js');
14
+ var styled = require('./styled.js');
10
15
  var jsxRuntime = require('react/jsx-runtime');
11
16
 
12
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
18
 
14
19
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
15
20
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
16
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
17
21
 
18
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; }
19
23
 
20
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; }
21
- const StyledPopoverContentWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
22
- componentId: "sc-1gxm7np-0"
23
- })(["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:", ";"], ({
24
- zIndex
25
- }) => zIndex);
26
- const PopoverContent = ({
27
- setPopperElement,
28
- popperStyles,
29
- popperAttributes,
30
- children,
31
- setArrowElement,
32
- arrowStyle,
33
- withoutArrow,
34
- zIndex
35
- }) => /*#__PURE__*/jsxRuntime.jsxs(StyledPopoverContentWrapper, _objectSpread(_objectSpread({
36
- zIndex: zIndex,
37
- ref: setPopperElement,
38
- style: popperStyles
39
- }, popperAttributes), {}, {
40
- children: [children, withoutArrow === false ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
41
- children: [/*#__PURE__*/_jsx__default["default"](PopoverArrow.PopoverArrow, {
42
- arrowElementRef: setArrowElement,
43
- style: arrowStyle,
44
- placement: popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'
45
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
46
- ref: setArrowElement,
47
- style: arrowStyle
48
- })]
49
- }) : null]
50
- }));
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(() => {
41
+ if (!showPopover && !withoutAnimation) {
42
+ setIsAnimating(false);
43
+ }
44
+ }, [showPopover, withoutAnimation, setIsAnimating]);
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({
58
+ zIndex: zIndex,
59
+ ref: setPopperElement,
60
+ style: popperStyles
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
+ }));
69
+ };
51
70
 
52
71
  exports.PopoverContent = PopoverContent;
@@ -11,6 +11,7 @@ var useOnClickOutside = require('../utils/hooks/useOnClickOutside.js');
11
11
  const useConfigDSPopperjs = appProps => {
12
12
  const [popperElement, setPopperElement] = react.useState(null);
13
13
  const [arrowElement, setArrowElement] = react.useState(null);
14
+ const [isAnimating, setIsAnimating] = react.useState(false);
14
15
  const props = useConfiguredMergedProps.useConfiguredMergedProps({
15
16
  props: appProps,
16
17
  arrowElement
@@ -18,6 +19,7 @@ const useConfigDSPopperjs = appProps => {
18
19
  const {
19
20
  referenceElement,
20
21
  closeContextMenu,
22
+ onClickOutside,
21
23
  modifiers,
22
24
  startPlacementPreference
23
25
  } = props;
@@ -26,10 +28,22 @@ const useConfigDSPopperjs = appProps => {
26
28
  modifiers
27
29
  }), [modifiers, startPlacementPreference]);
28
30
  const popoverHelper = reactPopper.usePopper(referenceElement, popperElement, popperExtraOpts);
31
+ const {
32
+ showPopover,
33
+ withoutAnimation
34
+ } = props;
35
+ react.useEffect(() => {
36
+ if (showPopover && !withoutAnimation) {
37
+ setIsAnimating(true);
38
+ }
39
+ }, [showPopover, withoutAnimation]);
29
40
  useOnClickOutside.useOnClickOutside(popperElement, e => {
30
41
  var _referenceElement$con;
31
42
 
32
- 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();
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))) {
44
+ onClickOutside(e);
45
+ closeContextMenu();
46
+ }
33
47
  });
34
48
  return react.useMemo(() => ({
35
49
  props,
@@ -37,8 +51,10 @@ const useConfigDSPopperjs = appProps => {
37
51
  setPopperElement,
38
52
  arrowElement,
39
53
  setArrowElement,
40
- popoverHelper
41
- }), [arrowElement, popoverHelper, popperElement, props]);
54
+ popoverHelper,
55
+ isAnimating,
56
+ setIsAnimating
57
+ }), [arrowElement, popoverHelper, popperElement, isAnimating, props]);
42
58
  };
43
59
 
44
60
  exports.useConfigDSPopperjs = useConfigDSPopperjs;
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
 
7
- const useConfiguredDefaultModifiers = ({
8
- props,
9
- arrowElement
10
- }) => {
7
+ const useConfiguredDefaultModifiers = _ref => {
8
+ let {
9
+ props,
10
+ arrowElement
11
+ } = _ref;
11
12
  // we destructure explicit app definitions before merge
12
13
  const {
13
14
  boundaryElement: explicitAppBoundaryElement,
@@ -2,6 +2,11 @@
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
11
  var react = require('react');
7
12
  var useConfiguredDefaultModifiers = require('./useConfiguredDefaultModifiers.js');
@@ -17,17 +22,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
22
  const noop = () => {};
18
23
 
19
24
  const emptyObj = {};
20
- const useConfiguredDefaultProps = ({
21
- props,
22
- arrowElement
23
- }) => {
25
+ const useConfiguredDefaultProps = _ref => {
26
+ let {
27
+ props,
28
+ arrowElement
29
+ } = _ref;
24
30
  // don't move this out of the hook or `document.body` will explode
25
31
  const staticDefaultProps = react.useMemo(() => ({
26
32
  referenceElement: null,
27
33
  showPopover: false,
28
34
  closeContextMenu: noop,
35
+ onClickOutside: noop,
29
36
  withoutPortal: false,
30
37
  withoutArrow: false,
38
+ withoutAnimation: false,
39
+ animationDuration: 100,
31
40
  portalDOMContainer: document.body,
32
41
  startPlacementPreference: 'top',
33
42
  placementOrderPreference: ['top', 'bottom', 'left', 'right'],
@@ -5,10 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
6
  var useConfiguredDefaultProps = require('./useConfiguredDefaultProps.js');
7
7
 
8
- const useConfiguredMergedProps = ({
9
- props,
10
- arrowElement
11
- }) => {
8
+ const useConfiguredMergedProps = _ref => {
9
+ let {
10
+ props,
11
+ arrowElement
12
+ } = _ref;
12
13
  const defaultProps = useConfiguredDefaultProps.useConfiguredDefaultProps({
13
14
  props,
14
15
  arrowElement
package/cjs/index.js CHANGED
@@ -2,6 +2,11 @@
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 _jsx = require('@babel/runtime/helpers/jsx');
6
11
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
12
  var react = require('react');
@@ -25,6 +30,8 @@ const DSPopperJS = props => {
25
30
  const {
26
31
  props: {
27
32
  showPopover,
33
+ withoutAnimation,
34
+ animationDuration,
28
35
  withoutPortal,
29
36
  withoutArrow,
30
37
  portalDOMContainer,
@@ -33,7 +40,9 @@ const DSPopperJS = props => {
33
40
  },
34
41
  setPopperElement,
35
42
  setArrowElement,
36
- popoverHelper
43
+ setIsAnimating,
44
+ popoverHelper,
45
+ isAnimating
37
46
  } = useConfigDSPopperjs.useConfigDSPopperjs(props);
38
47
  const {
39
48
  children
@@ -49,10 +58,14 @@ const DSPopperJS = props => {
49
58
  setArrowElement: setArrowElement,
50
59
  arrowStyle: styles.arrow,
51
60
  withoutArrow: withoutArrow,
52
- zIndex: zIndex
53
- }, void 0, children), [attributes.popper, children, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
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]);
54
67
 
55
- if (showPopover) {
68
+ if (showPopover || isAnimating) {
56
69
  if (withoutPortal === true) return contentJSX;
57
70
  if (withoutPortal === false) return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
58
71
  children: /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
package/cjs/propTypes.js CHANGED
@@ -31,6 +31,16 @@ const dspopperjsPropTypes = {
31
31
  */
32
32
  withoutArrow: reactDesc.PropTypes.bool.description('Whether or not the popper context menu should print the arrow').defaultValue(false),
33
33
 
34
+ /**
35
+ * Whether or not the popper context menu should be animated
36
+ */
37
+ withoutAnimation: reactDesc.PropTypes.bool.description('Whether or not the popper context menu should be animated').defaultValue(false),
38
+
39
+ /**
40
+ * Popper context menus Animation duration in ms
41
+ */
42
+ animationDuration: reactDesc.PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),
43
+
34
44
  /**
35
45
  * Bounding element to calculate upon, defaults to it is "clippingParents",
36
46
  * which are the scrolling containers that may cause the element to be partially or fully cut off.
@@ -67,7 +77,9 @@ const dspopperjsPropTypes = {
67
77
  * https://popper.js.org/docs/v2/modifiers/
68
78
  */
69
79
  modifiers: reactDesc.PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
70
- extraPopperStyles: reactDesc.PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({})
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)
71
83
  };
72
84
 
73
85
  exports.dspopperjsPropTypes = dspopperjsPropTypes;
package/cjs/styled.js ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
+ var styled = require('styled-components');
7
+ var dsSystem = require('@elliemae/ds-system');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
12
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
13
+
14
+ var _templateObject, _templateObject2, _templateObject3;
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
+ componentId: "sc-1giz5kx-0"
19
+ })(["z-index:", ";"], _ref => {
20
+ let {
21
+ zIndex
22
+ } = _ref;
23
+ return zIndex;
24
+ });
25
+ const StyledAnimatedPopper = /*#__PURE__*/styled__default["default"].div.withConfig({
26
+ componentId: "sc-1giz5kx-1"
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);
34
+ });
35
+
36
+ exports.StyledAnimatedPopper = StyledAnimatedPopper;
37
+ exports.StyledPopoverContentWrapper = StyledPopoverContentWrapper;
@@ -4,31 +4,42 @@ import styled from 'styled-components';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  var _svg;
7
+ const arrowWidth = 18;
8
+ const arrowHeight = 18;
7
9
  const StyledArrow = /*#__PURE__*/styled.div.withConfig({
8
10
  componentId: "sc-olcdf1-0"
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", {
24
- viewBox: "0 0 30 30"
25
- }, void 0, /*#__PURE__*/_jsx("path", {
26
- className: "stroke",
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"
28
- }), /*#__PURE__*/_jsx("path", {
29
- className: "fill",
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"
31
- })))
32
- }, "popper-arrow");
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;
15
+ return theme.colors.neutral['500'];
16
+ }, _ref2 => {
17
+ let {
18
+ theme
19
+ } = _ref2;
20
+ return theme.colors.neutral['000'];
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, {
29
+ "data-placement": placement,
30
+ style: style,
31
+ ref: arrowElementRef,
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");
43
+ };
33
44
 
34
45
  export { PopoverArrow };
@@ -1,42 +1,62 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
3
- import 'react';
4
- import styled from 'styled-components';
8
+ import { useCallback, useMemo } from 'react';
5
9
  import { PopoverArrow } from './PopoverArrow.js';
10
+ import { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';
6
11
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
12
 
8
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; }
9
14
 
10
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; }
11
- const StyledPopoverContentWrapper = /*#__PURE__*/styled.div.withConfig({
12
- componentId: "sc-1gxm7np-0"
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
- }));
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(() => {
32
+ if (!showPopover && !withoutAnimation) {
33
+ setIsAnimating(false);
34
+ }
35
+ }, [showPopover, withoutAnimation, setIsAnimating]);
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({
49
+ zIndex: zIndex,
50
+ ref: setPopperElement,
51
+ style: popperStyles
52
+ }, popperAttributes), {}, {
53
+ children: /*#__PURE__*/_jsx(StyledAnimatedPopper, {
54
+ showPopover: showPopover,
55
+ animationDuration: animationDuration,
56
+ withoutAnimation: withoutAnimation,
57
+ onAnimationEnd: checkAnimationStatus
58
+ }, void 0, popperContent)
59
+ }));
60
+ };
41
61
 
42
62
  export { PopoverContent };
@@ -1,5 +1,5 @@
1
1
  import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useMemo } from 'react';
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';
@@ -7,6 +7,7 @@ import { useOnClickOutside } from '../utils/hooks/useOnClickOutside.js';
7
7
  const useConfigDSPopperjs = appProps => {
8
8
  const [popperElement, setPopperElement] = useState(null);
9
9
  const [arrowElement, setArrowElement] = useState(null);
10
+ const [isAnimating, setIsAnimating] = useState(false);
10
11
  const props = useConfiguredMergedProps({
11
12
  props: appProps,
12
13
  arrowElement
@@ -14,6 +15,7 @@ const useConfigDSPopperjs = appProps => {
14
15
  const {
15
16
  referenceElement,
16
17
  closeContextMenu,
18
+ onClickOutside,
17
19
  modifiers,
18
20
  startPlacementPreference
19
21
  } = props;
@@ -22,10 +24,22 @@ const useConfigDSPopperjs = appProps => {
22
24
  modifiers
23
25
  }), [modifiers, startPlacementPreference]);
24
26
  const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);
27
+ const {
28
+ showPopover,
29
+ withoutAnimation
30
+ } = props;
31
+ useEffect(() => {
32
+ if (showPopover && !withoutAnimation) {
33
+ setIsAnimating(true);
34
+ }
35
+ }, [showPopover, withoutAnimation]);
25
36
  useOnClickOutside(popperElement, e => {
26
37
  var _referenceElement$con;
27
38
 
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();
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))) {
40
+ onClickOutside(e);
41
+ closeContextMenu();
42
+ }
29
43
  });
30
44
  return useMemo(() => ({
31
45
  props,
@@ -33,8 +47,10 @@ const useConfigDSPopperjs = appProps => {
33
47
  setPopperElement,
34
48
  arrowElement,
35
49
  setArrowElement,
36
- popoverHelper
37
- }), [arrowElement, popoverHelper, popperElement, props]);
50
+ popoverHelper,
51
+ isAnimating,
52
+ setIsAnimating
53
+ }), [arrowElement, popoverHelper, popperElement, isAnimating, props]);
38
54
  };
39
55
 
40
56
  export { useConfigDSPopperjs };
@@ -1,9 +1,10 @@
1
1
  import { useMemo } from 'react';
2
2
 
3
- const useConfiguredDefaultModifiers = ({
4
- props,
5
- arrowElement
6
- }) => {
3
+ const useConfiguredDefaultModifiers = _ref => {
4
+ let {
5
+ props,
6
+ arrowElement
7
+ } = _ref;
7
8
  // we destructure explicit app definitions before merge
8
9
  const {
9
10
  boundaryElement: explicitAppBoundaryElement,
@@ -1,3 +1,8 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import { useMemo } from 'react';
3
8
  import { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';
@@ -9,17 +14,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
14
  const noop = () => {};
10
15
 
11
16
  const emptyObj = {};
12
- const useConfiguredDefaultProps = ({
13
- props,
14
- arrowElement
15
- }) => {
17
+ const useConfiguredDefaultProps = _ref => {
18
+ let {
19
+ props,
20
+ arrowElement
21
+ } = _ref;
16
22
  // don't move this out of the hook or `document.body` will explode
17
23
  const staticDefaultProps = useMemo(() => ({
18
24
  referenceElement: null,
19
25
  showPopover: false,
20
26
  closeContextMenu: noop,
27
+ onClickOutside: noop,
21
28
  withoutPortal: false,
22
29
  withoutArrow: false,
30
+ withoutAnimation: false,
31
+ animationDuration: 100,
23
32
  portalDOMContainer: document.body,
24
33
  startPlacementPreference: 'top',
25
34
  placementOrderPreference: ['top', 'bottom', 'left', 'right'],
@@ -1,10 +1,11 @@
1
1
  import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
2
2
  import { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';
3
3
 
4
- const useConfiguredMergedProps = ({
5
- props,
6
- arrowElement
7
- }) => {
4
+ const useConfiguredMergedProps = _ref => {
5
+ let {
6
+ props,
7
+ arrowElement
8
+ } = _ref;
8
9
  const defaultProps = useConfiguredDefaultProps({
9
10
  props,
10
11
  arrowElement
package/esm/index.js CHANGED
@@ -1,3 +1,8 @@
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';
1
6
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
7
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
8
  import { useMemo } from 'react';
@@ -16,6 +21,8 @@ const DSPopperJS = props => {
16
21
  const {
17
22
  props: {
18
23
  showPopover,
24
+ withoutAnimation,
25
+ animationDuration,
19
26
  withoutPortal,
20
27
  withoutArrow,
21
28
  portalDOMContainer,
@@ -24,7 +31,9 @@ const DSPopperJS = props => {
24
31
  },
25
32
  setPopperElement,
26
33
  setArrowElement,
27
- popoverHelper
34
+ setIsAnimating,
35
+ popoverHelper,
36
+ isAnimating
28
37
  } = useConfigDSPopperjs(props);
29
38
  const {
30
39
  children
@@ -40,10 +49,14 @@ const DSPopperJS = props => {
40
49
  setArrowElement: setArrowElement,
41
50
  arrowStyle: styles.arrow,
42
51
  withoutArrow: withoutArrow,
43
- zIndex: zIndex
44
- }, void 0, children), [attributes.popper, children, extraPopperStyles, setArrowElement, setPopperElement, styles.arrow, styles.popper, withoutArrow, zIndex]);
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]);
45
58
 
46
- if (showPopover) {
59
+ if (showPopover || isAnimating) {
47
60
  if (withoutPortal === true) return contentJSX;
48
61
  if (withoutPortal === false) return /*#__PURE__*/jsx(Fragment, {
49
62
  children: /*#__PURE__*/createPortal( /*#__PURE__*/jsx(Fragment, {
package/esm/propTypes.js CHANGED
@@ -27,6 +27,16 @@ const dspopperjsPropTypes = {
27
27
  */
28
28
  withoutArrow: PropTypes.bool.description('Whether or not the popper context menu should print the arrow').defaultValue(false),
29
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
+
30
40
  /**
31
41
  * Bounding element to calculate upon, defaults to it is "clippingParents",
32
42
  * which are the scrolling containers that may cause the element to be partially or fully cut off.
@@ -63,7 +73,9 @@ const dspopperjsPropTypes = {
63
73
  * https://popper.js.org/docs/v2/modifiers/
64
74
  */
65
75
  modifiers: PropTypes.array.description('modifiers array for full-custom popper-js override, https://popper.js.org/docs/v2/modifiers/').defaultValue(1),
66
- extraPopperStyles: PropTypes.object.description('Extra object styles to attach to the popper element').defaultValue({})
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)
67
79
  };
68
80
 
69
81
  export { dspopperjsPropTypes };
package/esm/styled.js ADDED
@@ -0,0 +1,27 @@
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-popperjs",
3
- "version": "2.0.0-next.9",
3
+ "version": "2.0.0-rc.12",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Popper JS Wrapper",
6
6
  "module": "./esm/index.js",
@@ -15,6 +15,10 @@
15
15
  "import": "./esm/utils/hooks/useOnClickOutside.js",
16
16
  "require": "./cjs/utils/hooks/useOnClickOutside.js"
17
17
  },
18
+ "./styled": {
19
+ "import": "./esm/styled.js",
20
+ "require": "./cjs/styled.js"
21
+ },
18
22
  "./propTypes": {
19
23
  "import": "./esm/propTypes.js",
20
24
  "require": "./cjs/propTypes.js"
@@ -64,16 +68,18 @@
64
68
  "build": "node ../../scripts/build/build.js"
65
69
  },
66
70
  "dependencies": {
67
- "@elliemae/ds-props-helpers": "2.0.0-next.9",
68
- "react-desc": "~4.1.3"
71
+ "@elliemae/ds-props-helpers": "2.0.0-rc.12",
72
+ "@elliemae/ds-system": "2.0.0-rc.12",
73
+ "react-desc": "~4.1.3",
74
+ "react-popper": "~2.2.5"
69
75
  },
70
76
  "devDependencies": {
71
- "styled-components": "~5.3.1"
77
+ "styled-components": "~5.3.3"
72
78
  },
73
79
  "peerDependencies": {
74
80
  "react": "^17.0.2",
75
81
  "react-dom": "^17.0.2",
76
- "styled-components": "^5.3.1"
82
+ "styled-components": "^5.3.3"
77
83
  },
78
84
  "publishConfig": {
79
85
  "access": "public",
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { PopoverContentPropsT } from './index.d';
3
- export declare const PopoverContent: ({ setPopperElement, popperStyles, popperAttributes, children, setArrowElement, arrowStyle, withoutArrow, zIndex, }: PopoverContentPropsT) => JSX.Element;
3
+ export declare const PopoverContent: ({ setPopperElement, popperStyles, popperAttributes, children, showPopover, setArrowElement, setIsAnimating, arrowStyle, withoutArrow, withoutAnimation, animationDuration, zIndex, }: PopoverContentPropsT) => JSX.Element;
@@ -6,8 +6,11 @@ export declare const useConfiguredDefaultProps: ({ props, arrowElement }: {
6
6
  referenceElement: null;
7
7
  showPopover: boolean;
8
8
  closeContextMenu: () => void;
9
+ onClickOutside: () => void;
9
10
  withoutPortal: boolean;
10
11
  withoutArrow: boolean;
12
+ withoutAnimation: boolean;
13
+ animationDuration: number;
11
14
  portalDOMContainer: HTMLElement;
12
15
  startPlacementPreference: string;
13
16
  placementOrderPreference: string[];
@@ -1,16 +1,19 @@
1
1
  export declare const useConfiguredMergedProps: ({ props, arrowElement }: {
2
2
  props: any;
3
3
  arrowElement: any;
4
- }) => Partial<{
4
+ }) => {
5
5
  modifiers: any;
6
6
  referenceElement: null;
7
7
  showPopover: boolean;
8
8
  closeContextMenu: () => void;
9
+ onClickOutside: () => void;
9
10
  withoutPortal: boolean;
10
11
  withoutArrow: boolean;
12
+ withoutAnimation: boolean;
13
+ animationDuration: number;
11
14
  portalDOMContainer: HTMLElement;
12
15
  startPlacementPreference: string;
13
16
  placementOrderPreference: string[];
14
17
  zIndex: number;
15
18
  extraPopperStyles: {};
16
- }>;
19
+ };
package/types/index.d.ts CHANGED
@@ -1,21 +1,56 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  import type { DSDSPopperjsPropsT } from './index.d';
3
4
  declare const DSPopperJS: {
4
5
  (props: DSDSPopperjsPropsT): JSX.Element;
5
6
  propTypes: {
6
- referenceElement: any;
7
- showPopover: any;
8
- closeContextMenu: any;
9
- withoutPortal: any;
10
- withoutArrow: any;
11
- boundaryElement: any;
12
- portalDOMContainer: any;
13
- startPlacementPreference: any;
14
- placementOrderPreference: any;
15
- zIndex: any;
16
- customOffset: any;
17
- modifiers: any;
18
- extraPopperStyles: any;
7
+ referenceElement: import("react-desc").PropTypesDescValidator;
8
+ showPopover: import("react-desc").PropTypesDescValidator;
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
+ };
19
54
  };
20
55
  };
21
56
  declare const DSPopperJSWithSchema: any;
@@ -1,54 +1,95 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
1
2
  export declare const dspopperjsPropTypes: {
2
3
  /**
3
4
  * React ref to popperjs referenceElement
4
5
  */
5
- referenceElement: any;
6
+ referenceElement: import("react-desc").PropTypesDescValidator;
6
7
  /**
7
8
  * Wheter or not to show the popper content
8
9
  */
9
- showPopover: any;
10
+ showPopover: import("react-desc").PropTypesDescValidator;
10
11
  /**
11
12
  * Callback to close the context menu, used for "on click outside",
12
13
  * if not provided click outside will not trigger anything
13
14
  */
14
- closeContextMenu: any;
15
+ closeContextMenu: {
16
+ deprecated: import("react-desc").PropTypesDescValidator;
17
+ };
15
18
  /**
16
19
  * Wheter or not the popper content should appear in a DOM portal or not
17
20
  */
18
- withoutPortal: any;
21
+ withoutPortal: {
22
+ deprecated: import("react-desc").PropTypesDescValidator;
23
+ };
19
24
  /**
20
25
  * Wheter or not the popper context menu should print the arrow
21
26
  */
22
- withoutArrow: any;
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
+ };
23
42
  /**
24
43
  * Bounding element to calculate upon, defaults to it is "clippingParents",
25
44
  * which are the scrolling containers that may cause the element to be partially or fully cut off.
26
45
  */
27
- boundaryElement: any;
46
+ boundaryElement: {
47
+ deprecated: import("react-desc").PropTypesDescValidator;
48
+ };
28
49
  /**
29
50
  * When using portal, the container in which to append the DOM content, defaults to document body
30
51
  */
31
- portalDOMContainer: any;
52
+ portalDOMContainer: {
53
+ deprecated: import("react-desc").PropTypesDescValidator;
54
+ };
32
55
  /**
33
56
  * start placement preferences, as per popperjs placement option
34
57
  */
35
- startPlacementPreference: any;
58
+ startPlacementPreference: {
59
+ deprecated: import("react-desc").PropTypesDescValidator;
60
+ };
36
61
  /**
37
62
  * Array of placement preferences, as per popperjs "flip" placement option
38
63
  */
39
- placementOrderPreference: any;
64
+ placementOrderPreference: {
65
+ deprecated: import("react-desc").PropTypesDescValidator;
66
+ };
40
67
  /**
41
68
  * popperjs content z-index
42
69
  */
43
- zIndex: any;
70
+ zIndex: {
71
+ deprecated: import("react-desc").PropTypesDescValidator;
72
+ };
44
73
  /**
45
74
  * placement offset array
46
75
  */
47
- customOffset: any;
76
+ customOffset: {
77
+ deprecated: import("react-desc").PropTypesDescValidator;
78
+ };
48
79
  /**
49
80
  * modifiers array for full-custom popper-js override
50
81
  * https://popper.js.org/docs/v2/modifiers/
51
82
  */
52
- modifiers: any;
53
- extraPopperStyles: any;
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
+ };
54
95
  };
@@ -0,0 +1,11 @@
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 {};