@loomhq/lens 10.30.0 → 10.31.0
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.
|
@@ -14,6 +14,8 @@ import React, { useEffect, useState } from 'react';
|
|
|
14
14
|
import ReactDOM from 'react-dom';
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
16
|
import { unit } from '../../variables';
|
|
17
|
+
import { CSSTransitionGroup } from 'react-transition-group';
|
|
18
|
+
const duration = 200;
|
|
17
19
|
const placements = {
|
|
18
20
|
topLeft: 'top-start',
|
|
19
21
|
topCenter: 'top',
|
|
@@ -30,6 +32,24 @@ const placements = {
|
|
|
30
32
|
};
|
|
31
33
|
const Wrapper = styled.div `
|
|
32
34
|
position: relative;
|
|
35
|
+
|
|
36
|
+
.Popover-enter {
|
|
37
|
+
opacity: 0.01;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Popover-enter.Popover-enter-active {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transition: opacity ${duration}ms;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.Popover-leave {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.Popover-leave.Popover-leave-active {
|
|
50
|
+
opacity: 0.01;
|
|
51
|
+
transition: opacity ${duration}ms;
|
|
52
|
+
}
|
|
33
53
|
`;
|
|
34
54
|
const ContentWrapper = styled.div `
|
|
35
55
|
${props => props.zIndex && `z-index: ${props.zIndex}`};
|
|
@@ -86,9 +106,9 @@ const Popover = (_a) => {
|
|
|
86
106
|
};
|
|
87
107
|
return (React.createElement(Wrapper, null,
|
|
88
108
|
React.createElement("div", Object.assign({ ref: reference }, props), children),
|
|
89
|
-
isOpen && (React.createElement(React.Fragment, null,
|
|
109
|
+
React.createElement(CSSTransitionGroup, { transitionName: "Popover", transitionEnterTimeout: duration, transitionLeaveTimeout: duration }, isOpen && (React.createElement(React.Fragment, null,
|
|
90
110
|
!rootNode && (React.createElement(ContentWrapper, Object.assign({}, contentProps), content)),
|
|
91
111
|
rootNode &&
|
|
92
|
-
ReactDOM.createPortal(React.createElement(ContentWrapper, Object.assign({}, contentProps), content), rootNode)))));
|
|
112
|
+
ReactDOM.createPortal(React.createElement(ContentWrapper, Object.assign({}, contentProps), content), rootNode))))));
|
|
93
113
|
};
|
|
94
114
|
export default Popover;
|