glints-aries 4.1.5 → 4.1.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { MouseEventHandler } from 'react';
|
|
2
2
|
import { ComponentAction } from '../../types/componentAction';
|
|
3
3
|
declare type LeftAndRightComponentModalProps = {
|
|
4
4
|
leftComponent: React.ReactNode;
|
|
@@ -24,7 +24,7 @@ export declare type ModalProps = React.HTMLAttributes<HTMLDivElement> & LeftAndR
|
|
|
24
24
|
showHeaderBorder?: boolean;
|
|
25
25
|
/** Setting this to true will close modal when clicking outside of Modal body */
|
|
26
26
|
closeOnClickOutside?: boolean;
|
|
27
|
-
onClose?:
|
|
27
|
+
onClose?: MouseEventHandler<HTMLDivElement | HTMLButtonElement>;
|
|
28
28
|
onBack?: () => void;
|
|
29
29
|
zIndexOverride?: number;
|
|
30
30
|
/** This prop will add default padding to the header */
|
package/es/@next/Modal/Modal.js
CHANGED
|
@@ -83,16 +83,14 @@ export var Modal = /*#__PURE__*/React.forwardRef(function Modal(_ref, ref) {
|
|
|
83
83
|
as: "div",
|
|
84
84
|
variant: "body1"
|
|
85
85
|
}, children) : children;
|
|
86
|
-
var handleClickOutside = function handleClickOutside() {
|
|
86
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
87
87
|
if (closeOnClickOutside) {
|
|
88
|
-
onClose == null ? void 0 : onClose();
|
|
88
|
+
onClose == null ? void 0 : onClose(event);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StyledModalWrapper, {
|
|
92
92
|
"data-testid": "modal-wrapper",
|
|
93
|
-
onClick:
|
|
94
|
-
return handleClickOutside();
|
|
95
|
-
},
|
|
93
|
+
onClick: handleClickOutside,
|
|
96
94
|
zIndexOverride: zIndexOverride
|
|
97
95
|
}, leftComponent && /*#__PURE__*/React.createElement(StyledModalLeftAndRightComponent, {
|
|
98
96
|
className: "modal-left-component"
|
|
@@ -121,9 +119,7 @@ export var Modal = /*#__PURE__*/React.forwardRef(function Modal(_ref, ref) {
|
|
|
121
119
|
}, headerDescription)), showCloseButton && /*#__PURE__*/React.createElement(StyledButtonContainer, null, /*#__PURE__*/React.createElement(StyledModalCloseButton, {
|
|
122
120
|
"data-testid": "modal-close-btn",
|
|
123
121
|
"data-has-decription": !!headerDescription,
|
|
124
|
-
onClick:
|
|
125
|
-
return onClose == null ? void 0 : onClose();
|
|
126
|
-
}
|
|
122
|
+
onClick: onClose
|
|
127
123
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
128
124
|
name: "ri-close"
|
|
129
125
|
})))), /*#__PURE__*/React.createElement(StyledModalContent, {
|
|
@@ -14,9 +14,9 @@ export var ModalWithProvider = function ModalWithProvider() {
|
|
|
14
14
|
modalProps = _objectWithoutPropertiesLoose(rest, _excluded2);
|
|
15
15
|
return /*#__PURE__*/React.createElement(Modal, _extends({}, modalProps, {
|
|
16
16
|
isOpen: isOpen,
|
|
17
|
-
onClose: function onClose() {
|
|
17
|
+
onClose: function onClose(e) {
|
|
18
18
|
close();
|
|
19
|
-
_onClose == null ? void 0 : _onClose();
|
|
19
|
+
_onClose == null ? void 0 : _onClose(e);
|
|
20
20
|
}
|
|
21
21
|
}));
|
|
22
22
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { MouseEventHandler } from 'react';
|
|
2
2
|
import { ComponentAction } from '../../types/componentAction';
|
|
3
3
|
declare type LeftAndRightComponentModalProps = {
|
|
4
4
|
leftComponent: React.ReactNode;
|
|
@@ -24,7 +24,7 @@ export declare type ModalProps = React.HTMLAttributes<HTMLDivElement> & LeftAndR
|
|
|
24
24
|
showHeaderBorder?: boolean;
|
|
25
25
|
/** Setting this to true will close modal when clicking outside of Modal body */
|
|
26
26
|
closeOnClickOutside?: boolean;
|
|
27
|
-
onClose?:
|
|
27
|
+
onClose?: MouseEventHandler<HTMLDivElement | HTMLButtonElement>;
|
|
28
28
|
onBack?: () => void;
|
|
29
29
|
zIndexOverride?: number;
|
|
30
30
|
/** This prop will add default padding to the header */
|
package/lib/@next/Modal/Modal.js
CHANGED
|
@@ -90,16 +90,14 @@ var Modal = /*#__PURE__*/_react["default"].forwardRef(function Modal(_ref, ref)
|
|
|
90
90
|
as: "div",
|
|
91
91
|
variant: "body1"
|
|
92
92
|
}, children) : children;
|
|
93
|
-
var handleClickOutside = function handleClickOutside() {
|
|
93
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
94
94
|
if (closeOnClickOutside) {
|
|
95
|
-
onClose == null ? void 0 : onClose();
|
|
95
|
+
onClose == null ? void 0 : onClose(event);
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
return /*#__PURE__*/_react["default"].createElement(_Portal.Portal, null, /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalWrapper, {
|
|
99
99
|
"data-testid": "modal-wrapper",
|
|
100
|
-
onClick:
|
|
101
|
-
return handleClickOutside();
|
|
102
|
-
},
|
|
100
|
+
onClick: handleClickOutside,
|
|
103
101
|
zIndexOverride: zIndexOverride
|
|
104
102
|
}, leftComponent && /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalLeftAndRightComponent, {
|
|
105
103
|
className: "modal-left-component"
|
|
@@ -128,9 +126,7 @@ var Modal = /*#__PURE__*/_react["default"].forwardRef(function Modal(_ref, ref)
|
|
|
128
126
|
}, headerDescription)), showCloseButton && /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledButtonContainer, null, /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalCloseButton, {
|
|
129
127
|
"data-testid": "modal-close-btn",
|
|
130
128
|
"data-has-decription": !!headerDescription,
|
|
131
|
-
onClick:
|
|
132
|
-
return onClose == null ? void 0 : onClose();
|
|
133
|
-
}
|
|
129
|
+
onClick: onClose
|
|
134
130
|
}, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
135
131
|
name: "ri-close"
|
|
136
132
|
})))), /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalContent, {
|
|
@@ -19,9 +19,9 @@ var ModalWithProvider = function ModalWithProvider() {
|
|
|
19
19
|
modalProps = (0, _objectWithoutPropertiesLoose2["default"])(rest, _excluded2);
|
|
20
20
|
return /*#__PURE__*/_react["default"].createElement(_Modal.Modal, (0, _extends2["default"])({}, modalProps, {
|
|
21
21
|
isOpen: isOpen,
|
|
22
|
-
onClose: function onClose() {
|
|
22
|
+
onClose: function onClose(e) {
|
|
23
23
|
close();
|
|
24
|
-
_onClose == null ? void 0 : _onClose();
|
|
24
|
+
_onClose == null ? void 0 : _onClose(e);
|
|
25
25
|
}
|
|
26
26
|
}));
|
|
27
27
|
};
|