Socket
Socket
Sign inDemoInstall

react-aria-modal

Package Overview
Dependencies
12
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.2 to 5.0.0

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## 5.0.0
- Remove `react-displace` package from dependencies
- Update `focus-trap-react` package to `v10.1.4`
- Add support for React 18
## 4.0.2

@@ -7,0 +13,0 @@

71

dist/react-aria-modal.js

@@ -29,6 +29,6 @@ "use strict";

var ReactDOM = require('react-dom');
var FocusTrap = require('focus-trap-react');
var displace = require('react-displace');
var noScroll = require('no-scroll');

@@ -300,2 +300,69 @@

function displace(WrappedComponent, options) {
if (!global.document) {
return function EmptyDisplace() {
return null;
};
}
options = options || {};
var Displaced = /*#__PURE__*/function (_React$Component2) {
_inherits(Displaced, _React$Component2);
var _super2 = _createSuper(Displaced);
function Displaced(props) {
var _this4;
_classCallCheck(this, Displaced);
_this4 = _super2.call(this, props);
_this4.state = {
container: null
};
return _this4;
}
_createClass(Displaced, [{
key: "componentDidMount",
value: function componentDidMount() {
var container;
if (options.renderTo) {
container = typeof options.renderTo === 'string' ? document.querySelector(options.renderTo) : options.renderTo;
} else {
container = document.createElement('div');
document.body.appendChild(container);
}
this.setState({
container: container
});
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (!options.renderTo) {
this.state.container.parentNode.removeChild(this.state.container);
}
}
}, {
key: "render",
value: function render() {
if (this.state.container === null || !this.props.mounted) return null;
return ReactDOM.createPortal(React.createElement(WrappedComponent, this.props, this.props.children), this.state.container);
}
}]);
return Displaced;
}(React.Component);
_defineProperty(Displaced, "defaultProps", {
mounted: true
});
return Displaced;
}
var DisplacedModal = displace(Modal);

@@ -302,0 +369,0 @@

14

package.json
{
"name": "react-aria-modal",
"version": "4.0.2",
"version": "5.0.0",
"description": "A fully accessible and flexible React modal built according WAI-ARIA Authoring Practices",

@@ -34,8 +34,8 @@ "main": "dist/react-aria-modal.js",

"dependencies": {
"focus-trap-react": "^8.1.0",
"no-scroll": "^2.1.1",
"react-displace": "^2.3.0"
"focus-trap-react": "^10.1.4",
"no-scroll": "^2.1.1"
},
"peerDependencies": {
"react": ">= 15.0.0 < 18.0.0"
"react": ">=16.3.0",
"react-dom": ">=16.3.0"
},

@@ -54,4 +54,4 @@ "devDependencies": {

"prettier": "1.16.4",
"react": "^16.8.2",
"react-dom": "^16.8.2"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},

@@ -58,0 +58,0 @@ "babel": {

const React = require('react');
const ReactDOM = require('react-dom');
const FocusTrap = require('focus-trap-react');
const displace = require('react-displace');
const noScroll = require('no-scroll');

@@ -257,2 +257,56 @@

function displace(WrappedComponent, options) {
if (!global.document) {
return function EmptyDisplace() {
return null;
};
}
options = options || {};
class Displaced extends React.Component {
static defaultProps = {
mounted: true
};
constructor(props) {
super(props);
this.state = {
container: null,
};
}
componentDidMount() {
let container;
if (options.renderTo) {
container = typeof options.renderTo === 'string' ? document.querySelector(options.renderTo) : options.renderTo;
} else {
container = document.createElement('div');
document.body.appendChild(container);
}
this.setState({ container });
}
componentWillUnmount() {
if (!options.renderTo) {
this.state.container.parentNode.removeChild(this.state.container);
}
}
render() {
if (this.state.container === null || !this.props.mounted) return null;
return ReactDOM.createPortal(
React.createElement(WrappedComponent, this.props, this.props.children),
this.state.container,
);
}
}
return Displaced;
}
const DisplacedModal = displace(Modal);

@@ -259,0 +313,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc