terra-slide-panel
Advanced tools
Comparing version 3.26.0 to 3.27.0
@@ -7,2 +7,7 @@ Changelog | ||
3.27.0 - (June 2, 2020) | ||
------------------ | ||
### Changed | ||
* Apply themes by context and directly include packaged themes. | ||
3.26.0 - (April 28, 2020) | ||
@@ -9,0 +14,0 @@ ------------------ |
@@ -30,7 +30,11 @@ "use strict"; | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context")); | ||
var _SlidePanelModule = _interopRequireDefault(require("./SlidePanel.module.scss")); | ||
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 _createSuperInternal() { 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); }; } | ||
@@ -114,3 +118,3 @@ 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; } } | ||
_this.setPanelNode = _this.setPanelNode.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.mainNode = _react.default.createRef(); | ||
_this.mainNode = /*#__PURE__*/_react.default.createRef(); | ||
return _this; | ||
@@ -148,3 +152,4 @@ } | ||
customProps = (0, _objectWithoutProperties2.default)(_this$props, ["panelAriaLabel", "mainAriaLabel", "mainContent", "panelContent", "panelBehavior", "panelPosition", "panelSize", "isFullscreen", "isOpen", "fill"]); | ||
var slidePanelClassNames = cx(['slide-panel', { | ||
var theme = this.context; | ||
var slidePanelClassNames = (0, _classnames.default)(cx('slide-panel', { | ||
'is-open': isOpen | ||
@@ -155,3 +160,3 @@ }, { | ||
fill: fill | ||
}, customProps.className]); | ||
}, theme.className), customProps.className); | ||
@@ -189,3 +194,4 @@ var panelDiv = /*#__PURE__*/_react.default.createElement("div", { | ||
SlidePanel.defaultProps = defaultProps; | ||
SlidePanel.contextType = _terraThemeContext.default; | ||
var _default = SlidePanel; | ||
exports.default = _default; |
@@ -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 _createSuperInternal() { 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; } } |
@@ -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 _createSuperInternal() { 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; } } |
@@ -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 _createSuperInternal() { 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; } } |
{ | ||
"name": "terra-slide-panel", | ||
"main": "lib/SlidePanel.js", | ||
"version": "3.26.0", | ||
"version": "3.27.0", | ||
"description": "The Terra SlidePanel component is a progressive disclosure mechanism that allows additional content to be shown and hidden in a variety of ways.", | ||
@@ -31,3 +31,4 @@ "repository": { | ||
"classnames": "^2.2.5", | ||
"prop-types": "^15.5.8" | ||
"prop-types": "^15.5.8", | ||
"terra-theme-context": "^1.0.0" | ||
}, | ||
@@ -47,3 +48,3 @@ "scripts": { | ||
}, | ||
"gitHead": "4e00d010848a84a8d9196943e2e3c02ad45ba6cf" | ||
"gitHead": "321e0043c06e708739ea69c2c7ff68a5c14e62b3" | ||
} |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames/bind'; | ||
import classNames from 'classnames'; | ||
import classNamesBind from 'classnames/bind'; | ||
import ThemeContext from 'terra-theme-context'; | ||
import styles from './SlidePanel.module.scss'; | ||
const cx = classNames.bind(styles); | ||
const cx = classNamesBind.bind(styles); | ||
@@ -104,3 +106,6 @@ const SlidePanelPositions = { | ||
} = this.props; | ||
const slidePanelClassNames = cx([ | ||
const theme = this.context; | ||
const slidePanelClassNames = classNames(cx( | ||
'slide-panel', | ||
@@ -110,4 +115,5 @@ { 'is-open': isOpen }, | ||
{ fill }, | ||
customProps.className, | ||
]); | ||
theme.className, | ||
), | ||
customProps.className); | ||
@@ -154,4 +160,5 @@ const panelDiv = ( | ||
SlidePanel.defaultProps = defaultProps; | ||
SlidePanel.contextType = ThemeContext; | ||
export default SlidePanel; | ||
export { SlidePanelPositions }; |
import React from 'react'; | ||
import ThemeContextProvider from 'terra-theme-context/lib/ThemeContextProvider'; | ||
import SlidePanel from '../../src/SlidePanel'; | ||
@@ -120,1 +121,10 @@ | ||
}); | ||
it('correctly applies the theme context className', () => { | ||
const tabs = mount( | ||
<ThemeContextProvider theme={{ className: 'orion-fusion-theme' }}> | ||
<SlidePanel /> | ||
</ThemeContextProvider>, | ||
); | ||
expect(tabs).toMatchSnapshot(); | ||
}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
113871
55
1471
5
1
+ Addedterra-theme-context@^1.0.0
+ Addedterra-theme-context@1.11.0(transitive)