react-aria-modal
Advanced tools
Comparing version 4.0.0 to 4.0.1
# Changelog | ||
## HEAD | ||
## 4.0.1 | ||
- Move `componentWillMount` content to `constructor` to avoid deprecation message. | ||
- Update `@babel/preset-env` to `v7.15.0` to remove `browserslist` update message. | ||
- Update `focus-trap-react` package to `v8.1.0`. | ||
## 4.0.0 | ||
@@ -4,0 +12,0 @@ |
@@ -11,12 +11,42 @@ "use strict"; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper2(Derived) { | ||
function isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
return function () { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (isNativeReflectConstruct()) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
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; } | ||
@@ -37,5 +67,5 @@ | ||
function Modal() { | ||
var _getPrototypeOf2; | ||
var _super = _createSuper2(Modal); | ||
function Modal(props) { | ||
var _this; | ||
@@ -45,8 +75,4 @@ | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call(this, props); | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Modal)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "getApplicationNode", function () { | ||
@@ -76,2 +102,6 @@ if (_this.props.getApplicationNode) return _this.props.getApplicationNode(); | ||
if (!props.titleText && !props.titleId) { | ||
throw new Error('react-aria-modal instances should have a `titleText` or `titleId`'); | ||
} | ||
return _this; | ||
@@ -81,9 +111,2 @@ } | ||
_createClass(Modal, [{ | ||
key: "componentWillMount", | ||
value: function componentWillMount() { | ||
if (!this.props.titleText && !this.props.titleId) { | ||
throw new Error('react-aria-modal instances should have a `titleText` or `titleId`'); | ||
} | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
@@ -241,5 +264,5 @@ value: function componentDidMount() { | ||
if (props.dialogStyle) { | ||
for (var _key2 in props.dialogStyle) { | ||
if (!props.dialogStyle.hasOwnProperty(_key2)) continue; | ||
dialogStyle[_key2] = props.dialogStyle[_key2]; | ||
for (var _key in props.dialogStyle) { | ||
if (!props.dialogStyle.hasOwnProperty(_key)) continue; | ||
dialogStyle[_key] = props.dialogStyle[_key]; | ||
} | ||
@@ -270,5 +293,5 @@ } | ||
for (var _key3 in props) { | ||
if (/^(data-|aria-)/.test(_key3)) { | ||
dialogProps[_key3] = props[_key3]; | ||
for (var _key2 in props) { | ||
if (/^(data-|aria-)/.test(_key2)) { | ||
dialogProps[_key2] = props[_key2]; | ||
} | ||
@@ -275,0 +298,0 @@ } |
{ | ||
"name": "react-aria-modal", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "A fully accessible and flexible React modal built according WAI-ARIA Authoring Practices", | ||
@@ -34,3 +34,3 @@ "main": "dist/react-aria-modal.js", | ||
"dependencies": { | ||
"focus-trap-react": "^6.0.0", | ||
"focus-trap-react": "^8.1.0", | ||
"no-scroll": "^2.1.1", | ||
@@ -46,3 +46,3 @@ "react-displace": "^2.3.0" | ||
"@babel/plugin-proposal-class-properties": "^7.3.3", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/preset-env": "^7.15.0", | ||
"@babel/preset-react": "^7.0.0", | ||
@@ -49,0 +49,0 @@ "babel-eslint": "^10.0.1", |
# react-aria-modal | ||
--- | ||
**SEEKING CO-MAINTAINERS!** Continued development of this project is going to require the work of one or more dedicated co-maintainers (or forkers). If you're interested, please comment in [this issue](https://github.com/davidtheclark/react-aria-modal/issues/90). | ||
--- | ||
A fully accessible and flexible React modal built according [WAI-ARIA Authoring Practices](http://www.w3.org/TR/wai-aria-practices/#dialog_modal). | ||
@@ -159,3 +166,3 @@ | ||
This function handles the state change of *exiting* (or deactivating) the modal. | ||
This function handles the state change of *exiting* (or deactivating) the modal. | ||
It will be invoked when the user clicks outside the modal (if `underlayClickExits={true}`, as is the default) or hits Escape (if `escapeExits={true}`, as is the default), and it receives the event that triggered it as its only argument. | ||
@@ -348,4 +355,6 @@ | ||
If `true`, the modal dialog's [focus trap](https://github.com/davidtheclark/focus-trap) will be paused. | ||
You'll want to use this prop if you have another nested focus trap *inside* the modal. | ||
You won't typically need to use this prop. | ||
It used to be that the typical reason for pausing a focus trap was to enable *nested* focus traps; but as of [focus-trap v4](https://github.com/davidtheclark/focus-trap/blob/master/CHANGELOG.md#400), the pausing and unpausing of hierachical traps is handled automatically. | ||
### focusTrapOptions | ||
@@ -362,3 +371,3 @@ | ||
If `true`, the modal dialog will prevent any scrolling behind the modal window. | ||
If `true`, the modal dialog will prevent any scrolling behind the modal window. | ||
@@ -365,0 +374,0 @@ ## AriaModal.renderTo(HTMLElement | string) |
@@ -18,4 +18,5 @@ const React = require('react'); | ||
componentWillMount() { | ||
if (!this.props.titleText && !this.props.titleId) { | ||
constructor(props) { | ||
super(props); | ||
if (!props.titleText && !props.titleId) { | ||
throw new Error( | ||
@@ -22,0 +23,0 @@ 'react-aria-modal instances should have a `titleText` or `titleId`' |
43097
495
422
+ Addedfocus-trap@6.9.4(transitive)
+ Addedfocus-trap-react@8.11.3(transitive)
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedtabbable@5.3.3(transitive)
- Removedfocus-trap@4.0.2(transitive)
- Removedfocus-trap-react@6.0.0(transitive)
- Removedtabbable@3.1.2(transitive)
- Removedxtend@4.0.2(transitive)
Updatedfocus-trap-react@^8.1.0