terra-base
Advanced tools
Comparing version 3.22.3 to 3.23.0
@@ -7,2 +7,7 @@ Changelog | ||
3.23.0 - (September 25, 2018) | ||
------------------ | ||
### Added | ||
* Added `strictMode` prop | ||
3.22.3 - (September 13, 2018) | ||
@@ -9,0 +14,0 @@ ------------------ |
@@ -53,2 +53,6 @@ 'use strict'; | ||
/** | ||
* Activates [React Strict Mode](https://reactjs.org/docs/strict-mode.html) for descendants | ||
*/ | ||
strictMode: _propTypes2.default.bool, | ||
/** | ||
* The component(s) that will be wrapped by `<Base />` ONLY | ||
@@ -63,3 +67,4 @@ * in the event that translations have not been loaded yet. | ||
var defaultProps = { | ||
customMessages: {} | ||
customMessages: {}, | ||
strictMode: false | ||
}; | ||
@@ -114,6 +119,12 @@ | ||
customMessages = _props.customMessages, | ||
strictMode = _props.strictMode, | ||
translationsLoadingPlaceholder = _props.translationsLoadingPlaceholder, | ||
customProps = _objectWithoutProperties(_props, ['children', 'locale', 'customMessages', 'translationsLoadingPlaceholder']); | ||
customProps = _objectWithoutProperties(_props, ['children', 'locale', 'customMessages', 'strictMode', 'translationsLoadingPlaceholder']); | ||
var messages = _extends({}, this.state.messages, customMessages); | ||
var renderChildren = strictMode ? _react2.default.createElement( | ||
_react2.default.StrictMode, | ||
null, | ||
children | ||
) : children; | ||
@@ -124,3 +135,3 @@ if (locale === undefined) { | ||
customProps, | ||
children | ||
renderChildren | ||
); | ||
@@ -137,3 +148,3 @@ } | ||
_extends({}, customProps, { locale: this.state.locale, messages: messages }), | ||
children | ||
renderChildren | ||
); | ||
@@ -140,0 +151,0 @@ } |
{ | ||
"name": "terra-base", | ||
"main": "lib/Base.js", | ||
"version": "3.22.3", | ||
"version": "3.23.0", | ||
"description": "The base component sets minimal global styles for an application.", | ||
@@ -30,4 +30,4 @@ "repository": { | ||
"prop-types": "^15.5.8", | ||
"terra-doc-template": "^1.15.1", | ||
"terra-i18n": "^2.21.3" | ||
"terra-doc-template": "^1.16.0", | ||
"terra-i18n": "^2.22.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
@@ -27,2 +27,6 @@ import React from 'react'; | ||
/** | ||
* Activates [React Strict Mode](https://reactjs.org/docs/strict-mode.html) for descendants | ||
*/ | ||
strictMode: PropTypes.bool, | ||
/** | ||
* The component(s) that will be wrapped by `<Base />` ONLY | ||
@@ -38,2 +42,3 @@ * in the event that translations have not been loaded yet. | ||
customMessages: {}, | ||
strictMode: false, | ||
}; | ||
@@ -78,2 +83,3 @@ | ||
customMessages, | ||
strictMode, | ||
translationsLoadingPlaceholder, | ||
@@ -84,5 +90,9 @@ ...customProps | ||
const messages = Object.assign({}, this.state.messages, customMessages); | ||
const renderChildren = strictMode ? (<React.StrictMode>{children}</React.StrictMode>) : children; | ||
if (locale === undefined) { | ||
return (<div {...customProps}>{children}</div>); | ||
return ( | ||
<div {...customProps}> | ||
{renderChildren} | ||
</div>); | ||
} | ||
@@ -93,3 +103,3 @@ | ||
<I18nProvider {...customProps} locale={this.state.locale} messages={messages}> | ||
{children} | ||
{renderChildren} | ||
</I18nProvider> | ||
@@ -96,0 +106,0 @@ ); |
@@ -22,2 +22,8 @@ import React from 'react'; | ||
// Snapshot Tests | ||
it('should render with stict mode when strict mode enabled', () => { | ||
const base = shallow(<Base strictMode>String</Base>); | ||
expect(base).toMatchSnapshot(); | ||
}); | ||
it('throws error for missing required locale', () => { | ||
@@ -24,0 +30,0 @@ const messages = { Terra: 'Terra' }; |
@@ -1,2 +0,2 @@ | ||
/* global Terra, $, before, browser */ | ||
/* global $ */ | ||
@@ -3,0 +3,0 @@ describe('Base', () => { |
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
58521
924
Updatedterra-doc-template@^1.16.0
Updatedterra-i18n@^2.22.0