terra-abstract-modal
Advanced tools
Comparing version 3.24.0 to 3.25.0
@@ -7,2 +7,7 @@ Changelog | ||
3.25.0 - (May 19, 2020) | ||
------------------ | ||
### Changed | ||
* Apply themes by context and directly include packaged themes. | ||
3.24.0 - (April 28, 2020) | ||
@@ -9,0 +14,0 @@ ------------------ |
@@ -22,4 +22,8 @@ "use strict"; | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context")); | ||
var _terraVisuallyHiddenText = _interopRequireDefault(require("terra-visually-hidden-text")); | ||
@@ -129,5 +133,7 @@ | ||
var modalClassName = cx(['abstract-modal', { | ||
var theme = _react.default.useContext(_terraThemeContext.default); | ||
var modalClassName = (0, _classnames.default)(cx('abstract-modal', { | ||
'is-fullscreen': isFullscreen | ||
}, "layer-".concat(zIndexLayer), classNameModal]); // Delete the closePortal prop that comes from react-portal. | ||
}, "layer-".concat(zIndexLayer), theme.className), classNameModal); // Delete the closePortal prop that comes from react-portal. | ||
@@ -134,0 +140,0 @@ delete customProps.closePortal; |
@@ -18,4 +18,8 @@ "use strict"; | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
@@ -47,4 +51,8 @@ | ||
customProps = (0, _objectWithoutProperties2.default)(props, ["zIndex"]); | ||
var theme = _react.default.useContext(_terraThemeContext.default); | ||
var overlayClassName = (0, _classnames.default)(cx('overlay', "layer-".concat(zIndex), theme.className), customProps.className); | ||
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, customProps, { | ||
className: cx(['overlay', "layer-".concat(zIndex), customProps.className]) | ||
className: overlayClassName | ||
})); | ||
@@ -51,0 +59,0 @@ }; |
@@ -34,3 +34,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -37,0 +37,0 @@ 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; } } |
@@ -32,3 +32,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -35,0 +35,0 @@ 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; } } |
@@ -30,3 +30,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -33,0 +33,0 @@ 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; } } |
@@ -32,3 +32,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -35,0 +35,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
@@ -28,3 +28,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
@@ -31,0 +31,0 @@ 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; } } |
{ | ||
"name": "terra-abstract-modal", | ||
"main": "lib/AbstractModal.js", | ||
"version": "3.24.0", | ||
"version": "3.25.0", | ||
"description": "The abstract modal is a structural component that provides the ability to display portal'd content in a layer above the app.", | ||
@@ -36,2 +36,3 @@ "repository": { | ||
"react-portal": "^4.1.2", | ||
"terra-theme-context": "^1.0.0", | ||
"terra-visually-hidden-text": "^2.0.0", | ||
@@ -56,3 +57,3 @@ "wicg-inert": "^3.0.0" | ||
}, | ||
"gitHead": "4e00d010848a84a8d9196943e2e3c02ad45ba6cf" | ||
"gitHead": "7b325dc434494e40a30ae75ba2be3bde52e17dac" | ||
} |
import React, { forwardRef, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import classNames from 'classnames/bind'; | ||
import classNames from 'classnames'; | ||
import classNamesBind from 'classnames/bind'; | ||
import ThemeContext from 'terra-theme-context'; | ||
import VisuallyHiddenText from 'terra-visually-hidden-text'; | ||
@@ -10,3 +12,3 @@ import ModalOverlay from './_ModalOverlay'; | ||
const cx = classNames.bind(styles); | ||
const cx = classNamesBind.bind(styles); | ||
@@ -103,9 +105,10 @@ const zIndexes = ['6000', '7000', '8000', '9000']; | ||
} | ||
const modalClassName = cx([ | ||
const theme = React.useContext(ThemeContext); | ||
const modalClassName = classNames(cx( | ||
'abstract-modal', | ||
{ 'is-fullscreen': isFullscreen }, | ||
`layer-${zIndexLayer}`, | ||
classNameModal, | ||
]); | ||
theme.className, | ||
), | ||
classNameModal); | ||
@@ -112,0 +115,0 @@ // Delete the closePortal prop that comes from react-portal. |
import React, { useEffect } from 'react'; | ||
import classNames from 'classnames/bind'; | ||
import classNames from 'classnames'; | ||
import classNamesBind from 'classnames/bind'; | ||
import ThemeContext from 'terra-theme-context'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './ModalOverlay.module.scss'; | ||
const cx = classNames.bind(styles); | ||
const cx = classNamesBind.bind(styles); | ||
@@ -30,4 +32,13 @@ const zIndexes = ['6000', '7000', '8000', '9000']; | ||
const { zIndex, ...customProps } = props; | ||
const theme = React.useContext(ThemeContext); | ||
const overlayClassName = classNames( | ||
cx( | ||
'overlay', | ||
`layer-${zIndex}`, | ||
theme.className, | ||
), | ||
customProps.className, | ||
); | ||
return <div {...customProps} className={cx(['overlay', `layer-${zIndex}`, customProps.className])} />; | ||
return <div {...customProps} className={overlayClassName} />; | ||
}; | ||
@@ -34,0 +45,0 @@ |
@@ -99,1 +99,10 @@ import React from 'react'; | ||
}); | ||
it('correctly applies the theme context className', () => { | ||
jest.spyOn(React, 'useContext') | ||
.mockReturnValue({ | ||
className: 'orion-fusion-theme', | ||
}); | ||
const wrapper = mountWithIntl(<AbstractModalExample />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160025
80
2513
11
+ Addedterra-theme-context@^1.0.0
+ Addedterra-theme-context@1.11.0(transitive)