@unbxd-ui/unbxd-react-components 0.2.113 → 0.2.115
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.
- package/components/Modal/Modal.js +11 -4
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _excluded = ["isOpen", "onClose"];
|
|
11
|
+
var _excluded = ["isOpen", "onClose", "isConditionalHideEnabled"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -58,6 +58,8 @@ ModalContent.propTypes = {
|
|
|
58
58
|
var Modal = function Modal(props, ref) {
|
|
59
59
|
var isOpen = props.isOpen,
|
|
60
60
|
onClose = props.onClose,
|
|
61
|
+
_props$isConditionalH = props.isConditionalHideEnabled,
|
|
62
|
+
isConditionalHideEnabled = _props$isConditionalH === void 0 ? false : _props$isConditionalH,
|
|
61
63
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
62
64
|
var _useState = (0, _react.useState)(isOpen),
|
|
63
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -68,7 +70,9 @@ var Modal = function Modal(props, ref) {
|
|
|
68
70
|
setIsModalOpen(true);
|
|
69
71
|
};
|
|
70
72
|
var hideModal = function hideModal() {
|
|
71
|
-
|
|
73
|
+
if (!isConditionalHideEnabled) {
|
|
74
|
+
setIsModalOpen(false);
|
|
75
|
+
}
|
|
72
76
|
if (typeof onClose === "function") {
|
|
73
77
|
onClose();
|
|
74
78
|
}
|
|
@@ -103,14 +107,17 @@ Modal.propTypes = {
|
|
|
103
107
|
/** indicates whether to show or hide the modal header */
|
|
104
108
|
showHeader: _propTypes["default"].bool,
|
|
105
109
|
/** callback function that gets called when the modal closes */
|
|
106
|
-
onClose: _propTypes["default"].func
|
|
110
|
+
onClose: _propTypes["default"].func,
|
|
111
|
+
/** indicates whether to close or not the modal */
|
|
112
|
+
isConditionalHideEnabled: _propTypes["default"].bool
|
|
107
113
|
};
|
|
108
114
|
Modal.defaultProps = {
|
|
109
115
|
className: "",
|
|
110
116
|
title: "",
|
|
111
117
|
isOpen: false,
|
|
112
118
|
showClose: true,
|
|
113
|
-
showHeader: true
|
|
119
|
+
showHeader: true,
|
|
120
|
+
isConditionalHideEnabled: false
|
|
114
121
|
};
|
|
115
122
|
Modal.displayName = "Modal";
|
|
116
123
|
var _default = exports["default"] = Modal;
|