UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

57 lines (56 loc) • 2.7 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.Notifications = void 0; var _react = _interopRequireWildcard(require("react")); var _notification = _interopRequireDefault(require("@atlaskit/icon/core/notification")); var _badgeContainer = require("../../components/badge-container"); var _endItem = require("./end-item"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var NOTIFICATIONS_BADGE_ID = 'atlassian-navigation-notification-count'; /** * __Notifications__ * * The trigger button for the notifications menu in the top navigation bar. */ var Notifications = exports.Notifications = /*#__PURE__*/(0, _react.forwardRef)(function Notifications(_ref, ref) { var label = _ref.label, onClick = _ref.onClick, onMouseEnter = _ref.onMouseEnter, isSelected = _ref.isSelected, testId = _ref.testId, interactionName = _ref.interactionName, ariaControls = _ref['aria-controls'], ariaExpanded = _ref['aria-expanded'], ariaHasPopup = _ref['aria-haspopup'], isListItem = _ref.isListItem, badge = _ref.badge, shortcut = _ref.shortcut; return /*#__PURE__*/_react.default.createElement(_badgeContainer.BadgeContainer, { id: NOTIFICATIONS_BADGE_ID, badge: badge // We only need to set the list item role on the top level element (BadgeContainer) , isListItem: isListItem }, /*#__PURE__*/_react.default.createElement(_endItem.EndItem, { label: label, onClick: onClick, onMouseEnter: onMouseEnter, isSelected: isSelected, testId: testId, interactionName: interactionName, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-haspopup": ariaHasPopup, ref: ref, icon: _notification.default // We explicitly set the EndItem to not be a list item, // because the BadgeContainer already has a list item role (if `isListItem` is true) , isListItem: false, shortcut: shortcut })); });