UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

76 lines (75 loc) 3.27 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _propTypes = require("prop-types"); var _react = _interopRequireDefault(require("react")); var _classnames = _interopRequireDefault(require("classnames")); var _Notification = require("../Notification"); var _namespace = require("../../globals/namespace"); var _excluded = ["onCloseButtonClick", "iconDescription", "className", "caption", "subtitle", "title", "hideCloseButton", "statusIconDescription"]; /** * @file Stacked notification. * @copyright IBM Security 2019, 2021 */ var namespace = (0, _namespace.getComponentNamespace)('stacked-notification'); var StackedNotification = function StackedNotification(_ref) { var onCloseButtonClick = _ref.onCloseButtonClick, iconDescription = _ref.iconDescription, className = _ref.className, caption = _ref.caption, subtitle = _ref.subtitle, title = _ref.title, hideCloseButton = _ref.hideCloseButton, statusIconDescription = _ref.statusIconDescription, other = (0, _objectWithoutProperties2.default)(_ref, _excluded); var classes = (0, _classnames.default)(namespace, className); return /*#__PURE__*/_react.default.createElement(_Notification.ToastNotification, (0, _extends2.default)({ className: classes, kind: "info", notificationType: "toast", title: title, subtitle: subtitle, caption: caption, iconDescription: iconDescription, onClick: onCloseButtonClick, hideCloseButton: hideCloseButton, statusIconDescription: statusIconDescription }, other)); }; StackedNotification.propTypes = { /* Specify the caption. */ caption: _propTypes.node, /* Pass in the children that will be rendered within the notification. */ children: _propTypes.node, /* Specify an optional className to be applied to the notification wrapper. */ className: _propTypes.string, /* Specify whether the close button should be disabled. */ hideCloseButton: _propTypes.bool, /* Provide a description for "close" icon that can be read by screen readers. */ iconDescription: _propTypes.string.isRequired, /* Provide a function that is called when menu is closed. */ onCloseButtonClick: _propTypes.func, /* By default, this value is "alert". You can provide an alternate role if it makes sense for accessibility. */ role: _propTypes.string, /* Provide a description for "status" icon that can be read by screen readers. */ statusIconDescription: _propTypes.string, /* Specify the sub-title. */ subtitle: _propTypes.node.isRequired, /* Specify the title. */ title: _propTypes.string.isRequired }; StackedNotification.defaultProps = { caption: 'provide a caption', children: undefined, className: null, role: 'alert', onCloseButtonClick: function onCloseButtonClick() {}, hideCloseButton: false, statusIconDescription: 'provide a description for the status icon' }; var _default = exports.default = StackedNotification;