Skip to content

Commit 8eca41a

Browse files
authored
Create a new dist version 0.0.11 (#29)
Collecting: - Fix [Modal] on navigation back (#28) - Fix [Modal] remove create portal (#27)
1 parent a1b0d4d commit 8eca41a

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

commit_message

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

3-
Create a new dist version 0.0.10
3+
Create a new dist version 0.0.11
44

55
Collecting:
6-
- Impl [Form] new Textarea component (#24)
7-
- Fix [Models] Issue with input validation (#25)
6+
- Fix [Modal] on navigation back (#28)
7+
- Fix [Modal] remove create portal (#27)

dist/components/Backdrop/Backdrop.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
99

1010
var _propTypes = _interopRequireDefault(require("prop-types"));
1111

12-
var _reactDom = require("react-dom");
13-
1412
var _reactTransitionGroup = require("react-transition-group");
1513

1614
require("./Backdrop.scss");
@@ -24,7 +22,7 @@ var Backdrop = function Backdrop(_ref) {
2422
duration = _ref$duration === void 0 ? 300 : _ref$duration,
2523
show = _ref.show,
2624
onClose = _ref.onClose;
27-
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
25+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
2826
in: show,
2927
timeout: duration,
3028
classNames: "backdrop-transition",
@@ -34,7 +32,7 @@ var Backdrop = function Backdrop(_ref) {
3432
className: "backdrop",
3533
onClick: onClose
3634
})
37-
}), document.getElementById('overlay_container'));
35+
});
3836
};
3937

4038
Backdrop.defaultProps = {

dist/components/Modal/Modal.js

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"use strict";
22

3+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4+
35
Object.defineProperty(exports, "__esModule", {
46
value: true
57
});
68
exports.default = void 0;
79

8-
var _react = _interopRequireDefault(require("react"));
10+
var _react = _interopRequireWildcard(require("react"));
911

1012
var _propTypes = _interopRequireDefault(require("prop-types"));
1113

12-
var _reactDom = require("react-dom");
13-
1414
var _reactTransitionGroup = require("react-transition-group");
1515

1616
var _classnames = _interopRequireDefault(require("classnames"));
@@ -31,21 +31,46 @@ var _jsxRuntime = require("react/jsx-runtime");
3131

3232
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3333

34-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
34+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35+
36+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37+
38+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
39+
40+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
41+
42+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3543

36-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
44+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3745

38-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
46+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3947

40-
var JSX_MODAL = function JSX_MODAL(_ref) {
48+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49+
50+
var Modal = function Modal(_ref) {
4151
var actions = _ref.actions,
4252
children = _ref.children,
4353
className = _ref.className,
54+
location = _ref.location,
4455
onClose = _ref.onClose,
4556
size = _ref.size,
4657
show = _ref.show,
4758
title = _ref.title;
59+
60+
var _useState = (0, _react.useState)(location),
61+
_useState2 = _slicedToArray(_useState, 2),
62+
currentLocation = _useState2[0],
63+
setCurrentLocation = _useState2[1];
64+
4865
var modalClassNames = (0, _classnames.default)('modal', className, size && "modal-".concat(size));
66+
(0, _react.useEffect)(function () {
67+
setCurrentLocation(location);
68+
return function () {
69+
if (location !== currentLocation) {
70+
onClose();
71+
}
72+
};
73+
}, [currentLocation, location, onClose]);
4974
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
5075
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
5176
onClose: onClose,
@@ -94,10 +119,6 @@ var JSX_MODAL = function JSX_MODAL(_ref) {
94119
});
95120
};
96121

97-
var Modal = function Modal(props) {
98-
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(JSX_MODAL, _objectSpread({}, props)), document.getElementById('overlay_container'));
99-
};
100-
101122
Modal.defaultProps = {
102123
actions: [],
103124
show: false,
@@ -107,6 +128,7 @@ Modal.defaultProps = {
107128
Modal.propTypes = {
108129
actions: _propTypes.default.array,
109130
children: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.object, _propTypes.default.node, _propTypes.default.string]).isRequired,
131+
location: _propTypes.default.string.isRequired,
110132
onClose: _propTypes.default.func.isRequired,
111133
show: _propTypes.default.bool.isRequired,
112134
size: _types.MODAL_SIZES,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iguazio.dashboard-react-controls",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

0 commit comments

Comments
 (0)