@transferwise/components 0.0.0-experimental-e2c4313 → 0.0.0-experimental-cbb427b
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.js"],"names":[],"mappings":";AAUA
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.js"],"names":[],"mappings":";AAUA;;;;;;;gCA8CC"}
|
package/package.json
CHANGED
package/src/popover/Popover.js
CHANGED
|
@@ -8,13 +8,16 @@ import ResponsivePanel from '../common/responsivePanel';
|
|
|
8
8
|
import Title from '../title';
|
|
9
9
|
import { logActionRequiredIf } from '../utilities';
|
|
10
10
|
|
|
11
|
-
const Popover = ({ children, className, content, preferredPlacement, title }) => {
|
|
11
|
+
const Popover = ({ children, className, content, preferredPlacement, title, onClose }) => {
|
|
12
12
|
logActionRequired({ preferredPlacement });
|
|
13
13
|
const anchorReference = useRef(null);
|
|
14
14
|
const [open, setOpen] = useState(false);
|
|
15
15
|
const { isModern } = useTheme();
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const handleOnClose = () => {
|
|
18
|
+
setOpen(false);
|
|
19
|
+
onClose?.();
|
|
20
|
+
};
|
|
18
21
|
|
|
19
22
|
return (
|
|
20
23
|
<span className={classnames('np-popover', className)}>
|
|
@@ -34,7 +37,7 @@ const Popover = ({ children, className, content, preferredPlacement, title }) =>
|
|
|
34
37
|
position={deprecatedPlacements[preferredPlacement] || preferredPlacement}
|
|
35
38
|
arrow
|
|
36
39
|
className="np-popover__container"
|
|
37
|
-
onClose={
|
|
40
|
+
onClose={handleOnClose}
|
|
38
41
|
>
|
|
39
42
|
<div
|
|
40
43
|
className={isModern ? 'np-popover__content np-text-default-body' : 'np-popover__content'}
|
|
@@ -84,6 +87,7 @@ Popover.propTypes = {
|
|
|
84
87
|
'bottom-right',
|
|
85
88
|
'bottom-left',
|
|
86
89
|
]),
|
|
90
|
+
onClose: PropTypes.func,
|
|
87
91
|
title: PropTypes.node,
|
|
88
92
|
};
|
|
89
93
|
|