@elliemae/ds-popperjs 2.2.0-alpha.4 → 3.0.0-next.2

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.
Files changed (45) hide show
  1. package/cjs/PopoverArrow.js +51 -88
  2. package/cjs/PopoverContent.js +65 -70
  3. package/cjs/config/useConfigDSPopperjs.js +42 -51
  4. package/cjs/config/useConfiguredDefaultModifiers.js +50 -69
  5. package/cjs/config/useConfiguredDefaultProps.js +40 -44
  6. package/cjs/config/useConfiguredMergedProps.js +19 -39
  7. package/cjs/index.d.js +2 -27
  8. package/cjs/index.js +63 -79
  9. package/cjs/propTypes.js +83 -78
  10. package/cjs/styled.js +34 -68
  11. package/cjs/utils/hooks/useOnClickOutside.js +20 -42
  12. package/esm/PopoverArrow.js +42 -59
  13. package/esm/PopoverContent.js +55 -40
  14. package/esm/config/useConfigDSPopperjs.js +32 -16
  15. package/esm/config/useConfiguredDefaultModifiers.js +44 -38
  16. package/esm/config/useConfiguredDefaultProps.js +31 -14
  17. package/esm/config/useConfiguredMergedProps.js +14 -9
  18. package/esm/index.d.js +1 -2
  19. package/esm/index.js +50 -48
  20. package/esm/propTypes.js +79 -49
  21. package/esm/styled.js +25 -40
  22. package/esm/utils/hooks/useOnClickOutside.js +15 -12
  23. package/package.json +3 -3
  24. package/cjs/PopoverArrow.js.map +0 -7
  25. package/cjs/PopoverContent.js.map +0 -7
  26. package/cjs/config/useConfigDSPopperjs.js.map +0 -7
  27. package/cjs/config/useConfiguredDefaultModifiers.js.map +0 -7
  28. package/cjs/config/useConfiguredDefaultProps.js.map +0 -7
  29. package/cjs/config/useConfiguredMergedProps.js.map +0 -7
  30. package/cjs/index.d.js.map +0 -7
  31. package/cjs/index.js.map +0 -7
  32. package/cjs/propTypes.js.map +0 -7
  33. package/cjs/styled.js.map +0 -7
  34. package/cjs/utils/hooks/useOnClickOutside.js.map +0 -7
  35. package/esm/PopoverArrow.js.map +0 -7
  36. package/esm/PopoverContent.js.map +0 -7
  37. package/esm/config/useConfigDSPopperjs.js.map +0 -7
  38. package/esm/config/useConfiguredDefaultModifiers.js.map +0 -7
  39. package/esm/config/useConfiguredDefaultProps.js.map +0 -7
  40. package/esm/config/useConfiguredMergedProps.js.map +0 -7
  41. package/esm/index.d.js.map +0 -7
  42. package/esm/index.js.map +0 -7
  43. package/esm/propTypes.js.map +0 -7
  44. package/esm/styled.js.map +0 -7
  45. package/esm/utils/hooks/useOnClickOutside.js.map +0 -7
@@ -1,62 +1,45 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import styled from "styled-components";
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
3
+ import styled from 'styled-components';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var _svg;
4
7
  const arrowWidth = 18;
5
8
  const arrowHeight = 18;
6
- const StyledArrow = styled.div`
7
- position: absolute;
8
- width: ${arrowWidth}px;
9
- height: ${arrowHeight}px;
10
- pointer-events: none;
11
- background-color: transparent;
12
- & .stroke {
13
- fill: ${({ theme }) => theme.colors.neutral["500"]};
14
- fill-opacity: 0.4;
15
- }
16
- & .fill {
17
- fill: ${({ theme }) => theme.colors.neutral["000"]};
18
- }
19
-
20
- &[data-placement^='top'] {
21
- svg {
22
- transform: rotateZ(180deg);
23
- }
24
- bottom: -${arrowHeight}px;
25
- }
26
- &[data-placement^='right'] {
27
- svg {
28
- transform: rotateZ(-90deg);
29
- }
30
- left: -${arrowWidth}px;
31
- }
32
- &[data-placement^='bottom'] {
33
- top: -${arrowHeight}px;
34
- }
35
- &[data-placement^='left'] {
36
- svg {
37
- transform: rotateZ(90deg);
38
- }
39
- right: -${arrowWidth}px;
40
- }
41
- margin-left: ${(props) => props["data-placement"].startsWith("top") || props["data-placement"].startsWith("bottom") ? `-${arrowWidth / 2}px;` : "0;"};
42
- margin-top: ${(props) => props["data-placement"].startsWith("left") || props["data-placement"].startsWith("right") ? `-${arrowHeight / 2}px;` : "0;"};
43
- `;
44
- const PopoverArrow = ({ placement, style, arrowElementRef }) => /* @__PURE__ */ React2.createElement(StyledArrow, {
45
- key: "popper-arrow",
46
- "data-placement": placement,
47
- style,
48
- ref: arrowElementRef,
49
- "data-testid": "ds-tooltip-arrow"
50
- }, /* @__PURE__ */ React2.createElement("svg", {
51
- viewBox: "0 0 30 30"
52
- }, /* @__PURE__ */ React2.createElement("path", {
53
- className: "stroke",
54
- 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\n C26.7,29,24.6,28.1,23.7,27.1z"
55
- }), /* @__PURE__ */ React2.createElement("path", {
56
- className: "fill",
57
- 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"
58
- })));
59
- export {
60
- PopoverArrow
9
+ const StyledArrow = /*#__PURE__*/styled.div.withConfig({
10
+ componentId: "sc-olcdf1-0"
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");
61
43
  };
62
- //# sourceMappingURL=PopoverArrow.js.map
44
+
45
+ export { PopoverArrow };
@@ -1,47 +1,62 @@
1
- import * as React from "react";
2
- import React2, { useCallback, useMemo } from "react";
3
- import { PopoverArrow } from "./PopoverArrow";
4
- import { StyledPopoverContentWrapper, StyledAnimatedPopper } from "./styled";
5
- const PopoverContent = ({
6
- setPopperElement,
7
- popperStyles,
8
- popperAttributes,
9
- children,
10
- showPopover,
11
- setArrowElement,
12
- setIsAnimating,
13
- arrowStyle,
14
- withoutArrow,
15
- withoutAnimation,
16
- animationDuration,
17
- zIndex
18
- }) => {
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
6
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
8
+ import { useCallback, useMemo } from 'react';
9
+ import { PopoverArrow } from './PopoverArrow.js';
10
+ import { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';
11
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
12
+
13
+ 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; }
14
+
15
+ 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; }
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;
19
31
  const checkAnimationStatus = useCallback(() => {
20
32
  if (!showPopover && !withoutAnimation) {
21
33
  setIsAnimating(false);
22
34
  }
23
35
  }, [showPopover, withoutAnimation, setIsAnimating]);
24
- const popperContent = useMemo(() => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children, withoutArrow === false ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PopoverArrow, {
25
- arrowElementRef: setArrowElement,
26
- style: arrowStyle,
27
- placement: popperAttributes ? popperAttributes["data-popper-placement"] : "bottom"
28
- }), /* @__PURE__ */ React2.createElement("div", {
29
- ref: setArrowElement,
30
- style: arrowStyle
31
- })) : null), [children, withoutArrow, arrowStyle, popperAttributes, setArrowElement]);
32
- return /* @__PURE__ */ React2.createElement(StyledPopoverContentWrapper, {
33
- zIndex,
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,
34
50
  ref: setPopperElement,
35
- style: popperStyles,
36
- ...popperAttributes
37
- }, /* @__PURE__ */ React2.createElement(StyledAnimatedPopper, {
38
- showPopover,
39
- animationDuration,
40
- withoutAnimation,
41
- onAnimationEnd: checkAnimationStatus
42
- }, popperContent));
43
- };
44
- export {
45
- PopoverContent
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
+ }));
46
60
  };
47
- //# sourceMappingURL=PopoverContent.js.map
61
+
62
+ export { PopoverContent };
@@ -1,24 +1,42 @@
1
- import * as React from "react";
2
- import { useMemo, useState, useEffect } from "react";
3
- import { usePopper } from "react-popper";
4
- import { useConfiguredMergedProps } from "./useConfiguredMergedProps";
5
- import { useOnClickOutside } from "../utils/hooks/useOnClickOutside";
6
- const useConfigDSPopperjs = (appProps) => {
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import { useState, useMemo, useEffect } from 'react';
3
+ import { usePopper } from 'react-popper';
4
+ import { useConfiguredMergedProps } from './useConfiguredMergedProps.js';
5
+ import { useOnClickOutside } from '../utils/hooks/useOnClickOutside.js';
6
+
7
+ const useConfigDSPopperjs = appProps => {
7
8
  const [popperElement, setPopperElement] = useState(null);
8
9
  const [arrowElement, setArrowElement] = useState(null);
9
10
  const [isAnimating, setIsAnimating] = useState(false);
10
- const props = useConfiguredMergedProps({ props: appProps, arrowElement });
11
- const { referenceElement, closeContextMenu, onClickOutside, modifiers, startPlacementPreference } = props;
12
- const popperExtraOpts = useMemo(() => ({ placement: startPlacementPreference, modifiers }), [modifiers, startPlacementPreference]);
11
+ const props = useConfiguredMergedProps({
12
+ props: appProps,
13
+ arrowElement
14
+ });
15
+ const {
16
+ referenceElement,
17
+ closeContextMenu,
18
+ onClickOutside,
19
+ modifiers,
20
+ startPlacementPreference
21
+ } = props;
22
+ const popperExtraOpts = useMemo(() => ({
23
+ placement: startPlacementPreference,
24
+ modifiers
25
+ }), [modifiers, startPlacementPreference]);
13
26
  const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);
14
- const { showPopover, withoutAnimation } = props;
27
+ const {
28
+ showPopover,
29
+ withoutAnimation
30
+ } = props;
15
31
  useEffect(() => {
16
32
  if (showPopover && !withoutAnimation) {
17
33
  setIsAnimating(true);
18
34
  }
19
35
  }, [showPopover, withoutAnimation]);
20
- useOnClickOutside(popperElement, (e) => {
21
- if (!referenceElement?.contains?.(e?.target)) {
36
+ useOnClickOutside(popperElement, e => {
37
+ var _referenceElement$con;
38
+
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))) {
22
40
  onClickOutside(e);
23
41
  closeContextMenu();
24
42
  }
@@ -34,7 +52,5 @@ const useConfigDSPopperjs = (appProps) => {
34
52
  setIsAnimating
35
53
  }), [arrowElement, popoverHelper, popperElement, isAnimating, props]);
36
54
  };
37
- export {
38
- useConfigDSPopperjs
39
- };
40
- //# sourceMappingURL=useConfigDSPopperjs.js.map
55
+
56
+ export { useConfigDSPopperjs };
@@ -1,60 +1,66 @@
1
- import * as React from "react";
2
- import { useMemo } from "react";
3
- const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {
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
4
9
  const {
5
10
  boundaryElement: explicitAppBoundaryElement,
6
11
  withoutArrow: explicitAppWithoutArrow = false,
7
- placementOrderPreference: explicitPlacementOrderPreference = ["top", "bottom", "left", "right"],
8
- customOffset: explictAppOffset = void 0
9
- } = props;
12
+ placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],
13
+ customOffset: explictAppOffset = undefined
14
+ } = props; // to build default modifiers on top of it
15
+
10
16
  const defaultModifiers = useMemo(() => {
11
17
  const mod = [];
12
- mod.push({ name: "hide", enabled: true });
13
18
  mod.push({
14
- name: "flip",
19
+ name: 'hide',
20
+ enabled: true
21
+ });
22
+ mod.push({
23
+ name: 'flip',
15
24
  options: {
16
25
  fallbackPlacements: explicitPlacementOrderPreference
17
26
  }
18
- });
27
+ }); // we apply an offset if the app defines one or if the app wants the arrow
28
+
19
29
  if (!explicitAppWithoutArrow || explictAppOffset) {
20
30
  const defaultOffset = explictAppOffset || [0, 14];
21
31
  mod.push({
22
- name: "offset",
32
+ name: 'offset',
23
33
  enabled: true,
24
34
  options: {
25
35
  offset: defaultOffset
26
36
  }
27
37
  });
28
- }
29
- if (!explicitAppWithoutArrow)
30
- mod.push({
31
- name: "arrow",
32
- options: {
33
- element: arrowElement,
34
- padding: 18
35
- }
36
- });
37
- if (explicitAppBoundaryElement)
38
- mod.push({
39
- name: "preventOverflow",
40
- options: {
41
- boundary: explicitAppBoundaryElement
42
- }
43
- });
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
+ });
44
55
  return mod;
45
- }, [
46
- arrowElement,
47
- explicitAppBoundaryElement,
48
- explicitAppWithoutArrow,
49
- explicitPlacementOrderPreference,
50
- explictAppOffset
51
- ]);
52
- const { modifiers: explicitAppModifiers = defaultModifiers } = props;
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;
53
61
  return useMemo(() => ({
54
62
  modifiers: explicitAppModifiers
55
63
  }), [explicitAppModifiers]);
56
64
  };
57
- export {
58
- useConfiguredDefaultModifiers
59
- };
60
- //# sourceMappingURL=useConfiguredDefaultModifiers.js.map
65
+
66
+ export { useConfiguredDefaultModifiers };
@@ -1,10 +1,25 @@
1
- import * as React from "react";
2
- import { useMemo } from "react";
3
- import { useConfiguredDefaultModifiers } from "./useConfiguredDefaultModifiers";
4
- const noop = () => {
5
- };
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
+
6
16
  const emptyObj = {};
7
- const useConfiguredDefaultProps = ({ props, arrowElement }) => {
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
8
23
  const staticDefaultProps = useMemo(() => ({
9
24
  referenceElement: null,
10
25
  showPopover: false,
@@ -15,19 +30,21 @@ const useConfiguredDefaultProps = ({ props, arrowElement }) => {
15
30
  withoutAnimation: false,
16
31
  animationDuration: 100,
17
32
  portalDOMContainer: document.body,
18
- startPlacementPreference: "top",
19
- placementOrderPreference: ["top", "bottom", "left", "right"],
33
+ startPlacementPreference: 'top',
34
+ placementOrderPreference: ['top', 'bottom', 'left', 'right'],
20
35
  zIndex: 1,
21
36
  extraPopperStyles: emptyObj
22
37
  }), []);
23
- const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({
38
+ const {
39
+ modifiers: configuredModifiers
40
+ } = useConfiguredDefaultModifiers({
24
41
  props,
25
42
  arrowElement
26
43
  });
27
- const defaultProps = useMemo(() => ({ ...staticDefaultProps, modifiers: configuredModifiers }), [configuredModifiers, staticDefaultProps]);
44
+ const defaultProps = useMemo(() => _objectSpread(_objectSpread({}, staticDefaultProps), {}, {
45
+ modifiers: configuredModifiers
46
+ }), [configuredModifiers, staticDefaultProps]);
28
47
  return defaultProps;
29
48
  };
30
- export {
31
- useConfiguredDefaultProps
32
- };
33
- //# sourceMappingURL=useConfiguredDefaultProps.js.map
49
+
50
+ export { useConfiguredDefaultProps };
@@ -1,11 +1,16 @@
1
- import * as React from "react";
2
- import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
3
- import { useConfiguredDefaultProps } from "./useConfiguredDefaultProps";
4
- const useConfiguredMergedProps = ({ props, arrowElement }) => {
5
- const defaultProps = useConfiguredDefaultProps({ props, arrowElement });
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
+ });
6
13
  return useMemoMergePropsWithDefault(props, defaultProps);
7
14
  };
8
- export {
9
- useConfiguredMergedProps
10
- };
11
- //# sourceMappingURL=useConfiguredMergedProps.js.map
15
+
16
+ export { useConfiguredMergedProps };
package/esm/index.d.js CHANGED
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=index.d.js.map
1
+
package/esm/index.js CHANGED
@@ -1,11 +1,23 @@
1
- import * as React from "react";
2
- import React2, { useMemo } from "react";
3
- import { createPortal } from "react-dom";
4
- import { describe } from "react-desc";
5
- import { dspopperjsPropTypes } from "./propTypes";
6
- import { PopoverContent } from "./PopoverContent";
7
- import { useConfigDSPopperjs } from "./config/useConfigDSPopperjs";
8
- const DSPopperJS = (props) => {
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 => {
9
21
  const {
10
22
  props: {
11
23
  showPopover,
@@ -23,50 +35,40 @@ const DSPopperJS = (props) => {
23
35
  popoverHelper,
24
36
  isAnimating
25
37
  } = useConfigDSPopperjs(props);
26
- const { children } = props;
27
- const { styles, attributes } = popoverHelper;
28
- const contentJSX = useMemo(() => /* @__PURE__ */ React2.createElement(PopoverContent, {
29
- setPopperElement,
30
- popperStyles: { ...styles.popper, ...extraPopperStyles },
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),
31
48
  popperAttributes: attributes.popper,
32
- setArrowElement,
49
+ setArrowElement: setArrowElement,
33
50
  arrowStyle: styles.arrow,
34
- withoutArrow,
35
- withoutAnimation,
36
- animationDuration,
37
- zIndex,
38
- showPopover,
39
- setIsAnimating
40
- }, children), [
41
- attributes.popper,
42
- children,
43
- setIsAnimating,
44
- showPopover,
45
- extraPopperStyles,
46
- setArrowElement,
47
- setPopperElement,
48
- styles.arrow,
49
- styles.popper,
50
- withoutArrow,
51
- withoutAnimation,
52
- animationDuration,
53
- zIndex
54
- ]);
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
+
55
59
  if (showPopover || isAnimating) {
56
- if (withoutPortal === true)
57
- return contentJSX;
58
- if (withoutPortal === false)
59
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, contentJSX), portalDOMContainer));
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
+ });
60
66
  }
67
+
61
68
  return null;
62
69
  };
63
- DSPopperJS.propTypes = dspopperjsPropTypes;
64
- const DSPopperJSWithSchema = describe(DSPopperJS).description("A dimsum custom styling wrapper on top of popperjs");
70
+
71
+ const DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');
65
72
  DSPopperJSWithSchema.propTypes = dspopperjsPropTypes;
66
- var src_default = DSPopperJS;
67
- export {
68
- DSPopperJS,
69
- DSPopperJSWithSchema,
70
- src_default as default
71
- };
72
- //# sourceMappingURL=index.js.map
73
+
74
+ export { DSPopperJS, DSPopperJSWithSchema, DSPopperJS as default };