terra-alert
Advanced tools
Comparing version 4.60.7 to 4.61.0
@@ -5,2 +5,7 @@ # Changelog | ||
## 4.61.0 - (December 7, 2022) | ||
* Changed | ||
* Minor dependency version bump | ||
## 4.60.7 - (July 5, 2022) | ||
@@ -7,0 +12,0 @@ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,65 +8,35 @@ value: true | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _terraResponsiveElement = _interopRequireDefault(require("terra-responsive-element")); | ||
var _terraButton = _interopRequireDefault(require("terra-button")); | ||
var _reactIntl = require("react-intl"); | ||
var _IconAlert = _interopRequireDefault(require("terra-icon/lib/icon/IconAlert")); | ||
var _IconError = _interopRequireDefault(require("terra-icon/lib/icon/IconError")); | ||
var _IconWarning = _interopRequireDefault(require("terra-icon/lib/icon/IconWarning")); | ||
var _IconGapChecking = _interopRequireDefault(require("terra-icon/lib/icon/IconGapChecking")); | ||
var _IconDiamondSymbol = _interopRequireDefault(require("terra-icon/lib/icon/IconDiamondSymbol")); | ||
var _IconInformation = _interopRequireDefault(require("terra-icon/lib/icon/IconInformation")); | ||
var _IconSuccess = _interopRequireDefault(require("terra-icon/lib/icon/IconSuccess")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context")); | ||
var _AlertModule = _interopRequireDefault(require("./Alert.module.scss")); | ||
var _excluded = ["action", "children", "customIcon", "customColorClass", "onDismiss", "intl", "title", "type"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
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; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var cx = _bind.default.bind(_AlertModule.default); | ||
var AlertTypes = { | ||
@@ -90,3 +59,2 @@ ALERT: 'alert', | ||
action: _propTypes.default.element, | ||
/** | ||
@@ -96,3 +64,2 @@ * Child Nodes providing the message content for the alert. Can contain text and HTML. | ||
children: _propTypes.default.node, | ||
/** | ||
@@ -102,3 +69,2 @@ * The icon to be used for an alert of type custom. This will not be used for any other alert types. | ||
customIcon: _propTypes.default.element, | ||
/** | ||
@@ -111,3 +77,2 @@ * Sets an author-defined class, to control the status bar color to be used for an alert of type custom. | ||
customColorClass: _propTypes.default.string, | ||
/** | ||
@@ -117,3 +82,2 @@ * Callback function triggered when Dismiss button is clicked. The presence of this prop will cause the Dismiss button to be included on the alert. | ||
onDismiss: _propTypes.default.func, | ||
/** | ||
@@ -126,3 +90,2 @@ * @private | ||
}).isRequired, | ||
/** | ||
@@ -132,3 +95,2 @@ * The title for the alert which will be bolded. | ||
title: _propTypes.default.string, | ||
/** | ||
@@ -144,3 +106,2 @@ * The type of alert to be rendered. One of `alert`, `error`, `warning`, `unsatisfied`, `unverified`, `advisory`, | ||
}; | ||
var getAlertIcon = function getAlertIcon(type, customIcon) { | ||
@@ -152,3 +113,2 @@ switch (type) { | ||
}, /*#__PURE__*/_react.default.createElement(_IconAlert.default, null)); | ||
case AlertTypes.ERROR: | ||
@@ -158,3 +118,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconError.default, null)); | ||
case AlertTypes.WARNING: | ||
@@ -164,3 +123,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconWarning.default, null)); | ||
case AlertTypes.UNSATISFIED: | ||
@@ -170,3 +128,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconGapChecking.default, null)); | ||
case AlertTypes.UNVERIFIED: | ||
@@ -176,6 +133,4 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconDiamondSymbol.default, null)); | ||
case AlertTypes.ADVISORY: | ||
return null; | ||
case AlertTypes.INFO: | ||
@@ -185,3 +140,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconInformation.default, null)); | ||
case AlertTypes.SUCCESS: | ||
@@ -191,3 +145,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, /*#__PURE__*/_react.default.createElement(_IconSuccess.default, null)); | ||
case AlertTypes.CUSTOM: | ||
@@ -197,3 +150,2 @@ return /*#__PURE__*/_react.default.createElement("span", { | ||
}, customIcon); | ||
default: | ||
@@ -203,21 +155,17 @@ return null; | ||
}; | ||
var Alert = function Alert(_ref) { | ||
var action = _ref.action, | ||
children = _ref.children, | ||
customIcon = _ref.customIcon, | ||
customColorClass = _ref.customColorClass, | ||
onDismiss = _ref.onDismiss, | ||
intl = _ref.intl, | ||
title = _ref.title, | ||
type = _ref.type, | ||
customProps = _objectWithoutProperties(_ref, _excluded); | ||
children = _ref.children, | ||
customIcon = _ref.customIcon, | ||
customColorClass = _ref.customColorClass, | ||
onDismiss = _ref.onDismiss, | ||
intl = _ref.intl, | ||
title = _ref.title, | ||
type = _ref.type, | ||
customProps = _objectWithoutProperties(_ref, _excluded); | ||
var theme = _react.default.useContext(_terraThemeContext.default); | ||
var _useState = (0, _react.useState)(), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
isNarrow = _useState2[0], | ||
setIsNarrow = _useState2[1]; | ||
_useState2 = _slicedToArray(_useState, 2), | ||
isNarrow = _useState2[0], | ||
setIsNarrow = _useState2[1]; | ||
var defaultTitle = type === AlertTypes.CUSTOM ? '' : intl.formatMessage({ | ||
@@ -237,3 +185,2 @@ id: "Terra.alert.".concat(type) | ||
var dismissButton; | ||
if (onDismiss) { | ||
@@ -247,5 +194,3 @@ dismissButton = /*#__PURE__*/_react.default.createElement(_terraButton.default, { | ||
} | ||
var actionsSection; | ||
if (onDismiss || action) { | ||
@@ -259,7 +204,5 @@ var actionsClassName = cx('actions', { | ||
} | ||
var alertSectionClassName = cx('section', { | ||
'section-custom': type === AlertTypes.CUSTOM | ||
}); | ||
var alertMessageContent = /*#__PURE__*/_react.default.createElement("div", { | ||
@@ -270,7 +213,5 @@ className: alertSectionClassName | ||
}, title || defaultTitle), children); | ||
return /*#__PURE__*/_react.default.createElement(_terraResponsiveElement.default, { | ||
onChange: function onChange(value) { | ||
var showNarrowAlert = value === 'tiny'; | ||
if (showNarrowAlert !== isNarrow) { | ||
@@ -288,3 +229,2 @@ setIsNarrow(showNarrowAlert); | ||
}; | ||
Alert.propTypes = propTypes; | ||
@@ -294,5 +234,3 @@ Alert.defaultProps = defaultProps; | ||
Alert.Opts.Types = AlertTypes; | ||
var _default = (0, _reactIntl.injectIntl)(Alert); | ||
exports.default = _default; |
{ | ||
"name": "terra-alert", | ||
"main": "lib/Alert.js", | ||
"version": "4.60.7", | ||
"version": "4.61.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.", | ||
@@ -32,5 +32,5 @@ "repository": { | ||
"prop-types": "^15.5.8", | ||
"terra-button": "^3.61.0", | ||
"terra-icon": "^3.48.0", | ||
"terra-responsive-element": "^5.35.2", | ||
"terra-button": "^3.62.0", | ||
"terra-icon": "^3.49.0", | ||
"terra-responsive-element": "^5.36.0", | ||
"terra-theme-context": "^1.0.0" | ||
@@ -51,3 +51,3 @@ }, | ||
}, | ||
"gitHead": "5d980c62d9a2c86597ccd689865c4090fc26c4b0" | ||
"gitHead": "421b2643a58e6de628aa789a9cdd0778b0a942a2" | ||
} |
@@ -10,3 +10,3 @@ # Terra Alert | ||
- [Getting Started](#getting-started) | ||
- [Documentation](https://engineering.cerner.com/terra-ui/components/terra-alert/alert/alert) | ||
- [Documentation](https://engineering.cerner.com/terra-ui/components/cerner-terra-core-docs/alert/about) | ||
- [LICENSE](#license) | ||
@@ -13,0 +13,0 @@ |
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
81142
734
1
Updatedterra-button@^3.62.0
Updatedterra-icon@^3.49.0