Skip to content

Commit

Permalink
Merge pull request #66 from chenjiahan/bump_react_0906
Browse files Browse the repository at this point in the history
feat: bump react peer deps to v17, release 2.0.0
  • Loading branch information
chenjiahan authored Sep 6, 2022
2 parents daaa8cb + 67cfd2d commit 757c549
Show file tree
Hide file tree
Showing 9 changed files with 5,455 additions and 60 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
node_modules
example/dist
.DS_Store
yarn.lock
*.log
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ A React modal with animations.
## Installation

```bash
# React 17 or 18
npm i rodal --save

# React 15 or 16, install rodal v1
npm i rodal@1 --save
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module.exports = function(api) {
],
'@babel/preset-react'
],
plugins: ['@babel/plugin-proposal-class-properties']
plugins: [['@babel/plugin-proposal-class-properties', { loose: true }]]
};
};
25 changes: 12 additions & 13 deletions docs/dist/bundle.js

Large diffs are not rendered by default.

33 changes: 13 additions & 20 deletions lib/rodal.esm.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

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; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

/* ===============================
* Rodal v1.8.2 https://chenjiahan.github.com/rodal
* Rodal v2.0.0 https://chenjiahan.github.com/rodal
* =============================== */
import React from 'react';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -65,21 +61,20 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
}

_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;

_defineProperty(_assertThisInitialized(_this), "state", {
_this.state = {
isShow: false,
animationType: 'leave'
});
};

_defineProperty(_assertThisInitialized(_this), "onKeyUp", function (event) {
_this.onKeyUp = function (event) {
if (!_this.props.closeOnEsc || event.keyCode !== 27) {
return;
}

_this.props.onClose(event);
});
};

_defineProperty(_assertThisInitialized(_this), "animationEnd", function (event) {
_this.animationEnd = function (event) {
var animationType = _this.state.animationType;
var _this$props = _this.props,
closeOnEsc = _this$props.closeOnEsc,
Expand All @@ -96,7 +91,7 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
if (event.target === _this.el && onAnimationEnd) {
onAnimationEnd();
}
});
};

return _this;
}
Expand Down Expand Up @@ -175,7 +170,7 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
return Rodal;
}(React.Component);

_defineProperty(Rodal, "propTypes", {
Rodal.propTypes = {
width: PropTypes.number,
height: PropTypes.number,
measure: PropTypes.string,
Expand All @@ -194,9 +189,8 @@ _defineProperty(Rodal, "propTypes", {
onClose: PropTypes.func.isRequired,
onAnimationEnd: PropTypes.func,
id: PropTypes.string
});

_defineProperty(Rodal, "defaultProps", {
};
Rodal.defaultProps = {
width: 400,
height: 240,
measure: 'px',
Expand All @@ -212,6 +206,5 @@ _defineProperty(Rodal, "defaultProps", {
className: '',
customStyles: {},
customMaskStyles: {}
});

};
export default Rodal;
31 changes: 12 additions & 19 deletions lib/rodal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ var _classnames = _interopRequireDefault(require("classnames"));

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

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

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; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

// env
var IN_BROWSER = typeof window !== 'undefined';
Expand Down Expand Up @@ -72,21 +68,20 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
}

_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;

_defineProperty(_assertThisInitialized(_this), "state", {
_this.state = {
isShow: false,
animationType: 'leave'
});
};

_defineProperty(_assertThisInitialized(_this), "onKeyUp", function (event) {
_this.onKeyUp = function (event) {
if (!_this.props.closeOnEsc || event.keyCode !== 27) {
return;
}

_this.props.onClose(event);
});
};

_defineProperty(_assertThisInitialized(_this), "animationEnd", function (event) {
_this.animationEnd = function (event) {
var animationType = _this.state.animationType;
var _this$props = _this.props,
closeOnEsc = _this$props.closeOnEsc,
Expand All @@ -103,7 +98,7 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
if (event.target === _this.el && onAnimationEnd) {
onAnimationEnd();
}
});
};

return _this;
}
Expand Down Expand Up @@ -182,7 +177,7 @@ var Rodal = /*#__PURE__*/function (_React$Component) {
return Rodal;
}(_react["default"].Component);

_defineProperty(Rodal, "propTypes", {
Rodal.propTypes = {
width: _propTypes["default"].number,
height: _propTypes["default"].number,
measure: _propTypes["default"].string,
Expand All @@ -201,9 +196,8 @@ _defineProperty(Rodal, "propTypes", {
onClose: _propTypes["default"].func.isRequired,
onAnimationEnd: _propTypes["default"].func,
id: _propTypes["default"].string
});

_defineProperty(Rodal, "defaultProps", {
};
Rodal.defaultProps = {
width: 400,
height: 240,
measure: 'px',
Expand All @@ -219,7 +213,6 @@ _defineProperty(Rodal, "defaultProps", {
className: '',
customStyles: {},
customMaskStyles: {}
});

};
var _default = Rodal;
exports["default"] = _default;
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "rodal",
"version": "1.8.3",
"version": "2.0.0",
"description": "A React modal with animations.",
"main": "lib/rodal.js",
"module": "lib/rodal.esm.js",
"dependencies": {
"prop-types": "^15.6.0",
"classnames": "^2.2.6"
},
"devDependencies": {
Expand All @@ -17,16 +18,15 @@
"css-loader": "^3.4.2",
"postcss-loader": "^3.0.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"style-loader": "^1.1.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.2"
},
"peerDependencies": {
"prop-types": "^15.6.0",
"react": ">= ^16.0.0"
"react": ">= ^17.0.0"
},
"scripts": {
"dev": "node_modules/.bin/webpack-dev-server",
Expand Down
2 changes: 1 addition & 1 deletion src/rodal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===============================
* Rodal v1.8.2 https://chenjiahan.github.com/rodal
* Rodal v2.0.0 https://github.com/chenjiahan/rodal
* =============================== */

import React from 'react';
Expand Down
Loading

0 comments on commit 757c549

Please sign in to comment.