@loomhq/lens 10.32.3 → 10.32.6

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';
@@ -15,7 +15,6 @@ import ReactDOM from 'react-dom';
15
15
  import styled from '@emotion/styled';
16
16
  import { unit } from '../../variables';
17
17
  import { useTransition } from 'transition-hook';
18
- const duration = 200;
19
18
  const placements = {
20
19
  topLeft: 'top-start',
21
20
  topCenter: 'top',
@@ -32,16 +31,17 @@ const placements = {
32
31
  };
33
32
  const Wrapper = styled.div `
34
33
  position: relative;
34
+ width: fit-content;
35
35
  `;
36
36
  const ContentWrapper = styled.div `
37
37
  ${props => props.zIndex && `z-index: ${props.zIndex}`};
38
38
  `;
39
39
  const Popover = (_a) => {
40
- 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"]);
40
+ 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"]);
41
41
  const unitOffset = offset * unit;
42
42
  const unitBoundaryOffset = boundaryOffset * unit;
43
43
  const [bodyElement, setBodyElement] = useState(null);
44
- const { stage, shouldMount } = useTransition(isOpen, transitionDuration);
44
+ const { stage, shouldMount } = useTransition(isOpen, transitionDuration + transitionDelay);
45
45
  useEffect(() => {
46
46
  setBodyElement(document === null || document === void 0 ? void 0 : document.querySelector('body'));
47
47
  }, []);
@@ -84,7 +84,7 @@ const Popover = (_a) => {
84
84
  parent.removeEventListener('resize', update);
85
85
  });
86
86
  };
87
- }, [refs.reference, refs.floating, update, isOpen]);
87
+ }, [refs.reference, refs.floating, update, isOpen, shouldMount]);
88
88
  const [rootNode, setRootNode] = useState(null);
89
89
  useEffect(() => {
90
90
  if (rootId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.32.3",
3
+ "version": "10.32.6",
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
  },