@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.
@@ -11,6 +11,7 @@ export interface PopoverProps {
11
11
  * `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
12
12
  */
13
13
  preferredPlacement?: PopoverPreferredPlacement;
14
+ onClose?: (...args: any[])=>any;
14
15
  title?: React.ReactNode;
15
16
  }
16
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.js"],"names":[],"mappings":";AAUA;;;;;;gCA2CC"}
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.js"],"names":[],"mappings":";AAUA;;;;;;;gCA8CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-e2c4313",
3
+ "version": "0.0.0-experimental-cbb427b",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -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 onClose = () => setOpen(false);
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={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