tabler-react-2 0.1.132 → 0.1.133-beta.2
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/dist/modal/modal.js +10 -8
- package/docs/src/docs/changelog.mdx +4 -0
- package/package.json +1 -1
package/dist/modal/modal.js
CHANGED
|
@@ -97,7 +97,7 @@ var useModal = exports.useModal = function useModal(options) {
|
|
|
97
97
|
var _modalState$buttons;
|
|
98
98
|
var _useState = (0, _react.useState)({
|
|
99
99
|
open: false,
|
|
100
|
-
resolve:
|
|
100
|
+
resolve: function resolve() {},
|
|
101
101
|
title: options === null || options === void 0 ? void 0 : options.title,
|
|
102
102
|
text: options === null || options === void 0 ? void 0 : options.text,
|
|
103
103
|
buttons: options === null || options === void 0 ? void 0 : options.buttons
|
|
@@ -121,22 +121,24 @@ var useModal = exports.useModal = function useModal(options) {
|
|
|
121
121
|
});
|
|
122
122
|
}, []);
|
|
123
123
|
var handleDecision = function handleDecision(decision) {
|
|
124
|
-
console.log("Recieved decision", decision);
|
|
125
124
|
if (modalState.resolve) {
|
|
126
125
|
modalState.resolve(decision);
|
|
127
|
-
setModalState(function (prevState) {
|
|
128
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
129
|
-
open: false,
|
|
130
|
-
resolve: null
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
126
|
}
|
|
127
|
+
setModalState(function (prevState) {
|
|
128
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
129
|
+
open: false,
|
|
130
|
+
resolve: null
|
|
131
|
+
});
|
|
132
|
+
});
|
|
134
133
|
};
|
|
135
134
|
var update = function update() {
|
|
136
135
|
setModalState(_objectSpread(_objectSpread({}, modalState), {}, {
|
|
137
136
|
text: options.text
|
|
138
137
|
}));
|
|
139
138
|
};
|
|
139
|
+
(0, _react.useEffect)(function () {
|
|
140
|
+
console.log("modalState updated", modalState);
|
|
141
|
+
}, [modalState]);
|
|
140
142
|
var ModalElement = /*#__PURE__*/_react["default"].createElement(Modal, _extends({
|
|
141
143
|
open: modalState.open,
|
|
142
144
|
onClose: function onClose() {
|