terra-alert
Advanced tools
Comparing version 4.47.0 to 4.48.0
@@ -5,2 +5,11 @@ # Changelog | ||
## 4.48.0 - (January 5, 2021) | ||
* Changed | ||
* Updated to be compatible with `react-intl` v2-v5 | ||
* Removed usage of `FormattedMessage` in favor of `injectIntl` | ||
* Fixed | ||
* Fixed broken links in documentation. | ||
## 4.47.0 - (December 8, 2020) | ||
@@ -7,0 +16,0 @@ |
@@ -112,2 +112,10 @@ "use strict"; | ||
/** | ||
* @private | ||
* intl object programmatically imported through injectIntl from react-intl. | ||
* */ | ||
intl: _propTypes.default.shape({ | ||
formatMessage: _propTypes.default.func | ||
}).isRequired, | ||
/** | ||
* The title for the alert which will be bolded. | ||
@@ -184,5 +192,6 @@ */ | ||
onDismiss = _ref.onDismiss, | ||
intl = _ref.intl, | ||
title = _ref.title, | ||
type = _ref.type, | ||
customProps = _objectWithoutProperties(_ref, ["action", "children", "customIcon", "customColorClass", "onDismiss", "title", "type"]); | ||
customProps = _objectWithoutProperties(_ref, ["action", "children", "customIcon", "customColorClass", "onDismiss", "intl", "title", "type"]); | ||
@@ -196,3 +205,3 @@ var theme = _react.default.useContext(_terraThemeContext.default); | ||
var defaultTitle = type === AlertTypes.CUSTOM ? '' : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, { | ||
var defaultTitle = type === AlertTypes.CUSTOM ? '' : intl.formatMessage({ | ||
id: "Terra.alert.".concat(type) | ||
@@ -213,9 +222,7 @@ }); | ||
if (onDismiss) { | ||
dismissButton = /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, { | ||
id: "Terra.alert.dismiss" | ||
}, function (buttonText) { | ||
return /*#__PURE__*/_react.default.createElement(_terraButton.default, { | ||
text: buttonText, | ||
onClick: onDismiss | ||
}); | ||
dismissButton = /*#__PURE__*/_react.default.createElement(_terraButton.default, { | ||
text: intl.formatMessage({ | ||
id: 'Terra.alert.dismiss' | ||
}), | ||
onClick: onDismiss | ||
}); | ||
@@ -266,3 +273,5 @@ } | ||
Alert.Opts.Types = AlertTypes; | ||
var _default = Alert; | ||
var _default = (0, _reactIntl.injectIntl)(Alert); | ||
exports.default = _default; |
{ | ||
"name": "terra-alert", | ||
"main": "lib/Alert.js", | ||
"version": "4.47.0", | ||
"version": "4.48.0", | ||
"description": "The Terra Alert component is a notification banner that can be rendered in your application when there is information that you want to bring to the user's attention. The Alert component supports a number of built-in notification types that render with pre-defined colors and icons that help the user understand the severity and meaning of the notification. A custom notification type is also supported that allows your application to customize an alert that may not fit into the pre-defined types.", | ||
@@ -27,3 +27,3 @@ "repository": { | ||
"react-dom": "^16.8.5", | ||
"react-intl": "^2.8.0" | ||
"react-intl": ">=2.8.0 <6.0.0" | ||
}, | ||
@@ -33,7 +33,7 @@ "dependencies": { | ||
"prop-types": "^15.5.8", | ||
"terra-button": "^3.51.0", | ||
"terra-icon": "^3.39.0", | ||
"terra-responsive-element": "^5.27.0", | ||
"terra-button": "^3.52.0", | ||
"terra-icon": "^3.40.0", | ||
"terra-responsive-element": "^5.28.0", | ||
"terra-theme-context": "^1.0.0", | ||
"terra-toggle": "^3.42.0" | ||
"terra-toggle": "^3.43.0" | ||
}, | ||
@@ -53,3 +53,3 @@ "scripts": { | ||
}, | ||
"gitHead": "a831aafb7547ff092f55bb322c2800129e51fdf9" | ||
"gitHead": "ded4e20a75b7e1fc40d9298b6d619fdea043815f" | ||
} |
@@ -5,3 +5,3 @@ import React, { useState } from 'react'; | ||
import Button from 'terra-button'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { injectIntl } from 'react-intl'; | ||
import IconAlert from 'terra-icon/lib/icon/IconAlert'; | ||
@@ -60,2 +60,7 @@ import IconError from 'terra-icon/lib/icon/IconError'; | ||
/** | ||
* @private | ||
* intl object programmatically imported through injectIntl from react-intl. | ||
* */ | ||
intl: PropTypes.shape({ formatMessage: PropTypes.func }).isRequired, | ||
/** | ||
* The title for the alert which will be bolded. | ||
@@ -117,2 +122,3 @@ */ | ||
onDismiss, | ||
intl, | ||
title, | ||
@@ -125,3 +131,3 @@ type, | ||
const defaultTitle = type === AlertTypes.CUSTOM ? '' : <FormattedMessage id={`Terra.alert.${type}`} />; | ||
const defaultTitle = type === AlertTypes.CUSTOM ? '' : intl.formatMessage({ id: `Terra.alert.${type}` }); | ||
const alertClassNames = classNames( | ||
@@ -147,9 +153,3 @@ cx( | ||
if (onDismiss) { | ||
dismissButton = ( | ||
<FormattedMessage id="Terra.alert.dismiss"> | ||
{buttonText => ( | ||
<Button text={buttonText} onClick={onDismiss} /> | ||
)} | ||
</FormattedMessage> | ||
); | ||
dismissButton = <Button text={intl.formatMessage({ id: 'Terra.alert.dismiss' })} onClick={onDismiss} />; | ||
} | ||
@@ -202,2 +202,2 @@ | ||
export default Alert; | ||
export default injectIntl(Alert); |
@@ -125,4 +125,4 @@ import React from 'react'; | ||
const wrapper = shallowWithIntl(<Alert type="success" />); | ||
const headerContainer = wrapper.dive(); | ||
const headerContainer = wrapper.dive().dive(); | ||
expect(headerContainer).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
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
162432
1826
+ Added@formatjs/ecma402-abstract@1.11.4(transitive)
+ Added@formatjs/fast-memoize@1.2.1(transitive)
+ Added@formatjs/icu-messageformat-parser@2.1.0(transitive)
+ Added@formatjs/icu-skeleton-parser@1.3.6(transitive)
+ Added@formatjs/intl@2.2.1(transitive)
+ Added@formatjs/intl-displaynames@5.4.3(transitive)
+ Added@formatjs/intl-listformat@6.5.3(transitive)
+ Added@formatjs/intl-localematcher@0.2.25(transitive)
+ Added@types/hoist-non-react-statics@3.3.5(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@18.3.12(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedintl-messageformat@9.13.0(transitive)
+ Addedreact-intl@5.25.1(transitive)
+ Addedtslib@2.8.1(transitive)
- Removedintl-format-cache@2.2.9(transitive)
- Removedintl-messageformat@2.2.0(transitive)
- Removedintl-messageformat-parser@1.4.0(transitive)
- Removedintl-relativeformat@2.2.0(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedreact-intl@2.9.0(transitive)
Updatedterra-button@^3.52.0
Updatedterra-icon@^3.40.0
Updatedterra-toggle@^3.43.0