@loomhq/lens 10.32.4 → 10.32.7

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.
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { CSSTransitionGroup } from 'react-transition-group';
13
12
  import React from 'react';
14
13
  import { getColorValue } from '../../utilities';
15
14
  import styled from '@emotion/styled';
15
+ import { useTransition } from 'transition-hook';
16
16
  const duration = 300;
17
17
  const BackdropWrapper = styled.div `
18
18
  position: fixed;
@@ -22,28 +22,17 @@ const BackdropWrapper = styled.div `
22
22
  height: 100vh;
23
23
  background: ${props => getColorValue(props.backgroundColor)};
24
24
  z-index: ${props => props.zIndex};
25
-
26
- &.Backdrop-enter {
27
- opacity: 0.01;
28
- }
29
- &.Backdrop-enter.Backdrop-enter-active {
30
- opacity: 1;
31
- transition: opacity ${duration}ms;
32
- }
33
- &.Backdrop-leave {
34
- opacity: 1;
35
- }
36
- &.Backdrop-leave.Backdrop-leave-active {
37
- opacity: 0.01;
38
- transition: opacity ${duration}ms;
39
- }
40
25
  `;
41
26
  const ChildrenWrapper = styled.div `
42
27
  height: 100%;
43
28
  `;
44
29
  const Backdrop = (_a) => {
45
30
  var { children, isOpen, zIndex = 1000, backgroundColor = 'backdrop' } = _a, props = __rest(_a, ["children", "isOpen", "zIndex", "backgroundColor"]);
46
- return (React.createElement(CSSTransitionGroup, { transitionName: "Backdrop", transitionEnterTimeout: duration, transitionLeaveTimeout: duration }, isOpen && (React.createElement(BackdropWrapper, Object.assign({ backgroundColor: backgroundColor, zIndex: zIndex }, props),
31
+ const { stage, shouldMount } = useTransition(isOpen, duration);
32
+ return (React.createElement(React.Fragment, null, shouldMount && (React.createElement(BackdropWrapper, Object.assign({ backgroundColor: backgroundColor, zIndex: zIndex, style: {
33
+ transition: `opacity ${duration}ms`,
34
+ opacity: stage === 'enter' ? 1 : 0,
35
+ } }, props),
47
36
  React.createElement(ChildrenWrapper, null, children)))));
48
37
  };
49
38
  export default Backdrop;
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { getRadius, getShadow, getSize, getColorValue } from '../../utilities';
12
+ import { getColorValue, getRadius, getShadow, getSize } from '../../utilities';
13
13
  import Backdrop from '../backdrop/backdrop';
14
14
  import Container from '../container/container';
15
15
  import IconButton from '../icon-button/icon-button';
@@ -31,16 +31,20 @@ const placements = {
31
31
  };
32
32
  const Wrapper = styled.div `
33
33
  position: relative;
34
+ width: fit-content;
35
+ z-index: 1;
36
+ // transform forces the popover to calculate the position from the trigger instead of the viewport
37
+ transform: translate(0);
34
38
  `;
35
39
  const ContentWrapper = styled.div `
36
40
  ${props => props.zIndex && `z-index: ${props.zIndex}`};
37
41
  `;
38
42
  const Popover = (_a) => {
39
- var { children, content, offset = 1, boundaryOffset = 1, isOpen, zIndex = 1100, placement = 'topCenter', rootId, boundaryElement = 'body', transitionDuration = 0, transitionDelay = 0 } = _a, props = __rest(_a, ["children", "content", "offset", "boundaryOffset", "isOpen", "zIndex", "placement", "rootId", "boundaryElement", "transitionDuration", "transitionDelay"]);
43
+ var { children, content, offset = 1, boundaryOffset = 1, isOpen, zIndex = 500, placement = 'topCenter', rootId, boundaryElement = 'body', transitionDuration = 0, transitionDelay = 0 } = _a, props = __rest(_a, ["children", "content", "offset", "boundaryOffset", "isOpen", "zIndex", "placement", "rootId", "boundaryElement", "transitionDuration", "transitionDelay"]);
40
44
  const unitOffset = offset * unit;
41
45
  const unitBoundaryOffset = boundaryOffset * unit;
42
46
  const [bodyElement, setBodyElement] = useState(null);
43
- const { stage } = useTransition(isOpen, transitionDuration);
47
+ const { stage, shouldMount } = useTransition(isOpen, transitionDuration + transitionDelay);
44
48
  useEffect(() => {
45
49
  setBodyElement(document === null || document === void 0 ? void 0 : document.querySelector('body'));
46
50
  }, []);
@@ -83,7 +87,7 @@ const Popover = (_a) => {
83
87
  parent.removeEventListener('resize', update);
84
88
  });
85
89
  };
86
- }, [refs.reference, refs.floating, update, isOpen]);
90
+ }, [refs.reference, refs.floating, update, isOpen, shouldMount]);
87
91
  const [rootNode, setRootNode] = useState(null);
88
92
  useEffect(() => {
89
93
  if (rootId) {
@@ -103,7 +107,7 @@ const Popover = (_a) => {
103
107
  };
104
108
  return (React.createElement(Wrapper, Object.assign({ ref: reference }, props),
105
109
  children,
106
- isOpen && (React.createElement(React.Fragment, null,
110
+ shouldMount && (React.createElement(React.Fragment, null,
107
111
  !rootNode && (React.createElement(ContentWrapper, Object.assign({}, contentProps), content)),
108
112
  rootNode &&
109
113
  ReactDOM.createPortal(React.createElement(ContentWrapper, Object.assign({}, contentProps), content), rootNode)))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.32.4",
3
+ "version": "10.32.7",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",
@@ -27,7 +27,6 @@
27
27
  "lodash": "^4.17.21",
28
28
  "react-color": "^2.19.3",
29
29
  "react-laag": "^2.0.3",
30
- "react-transition-group": "^1.2.0",
31
30
  "resize-observer-polyfill": "^1.5.1",
32
31
  "transition-hook": "^1.5.1"
33
32
  },