UNPKG

@atlaskit/atlassian-navigation

Version:

A horizontal navigation component for Atlassian apps.

136 lines (132 loc) 5.75 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.AtlassianNavigation = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _react = _interopRequireDefault(require("react")); var _react2 = require("@emotion/react"); var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context"); var _warnOnce = _interopRequireDefault(require("@atlaskit/ds-lib/warn-once")); var _constants = require("../../common/constants"); var _theme = require("../../theme"); var _PrimaryItemsContainer = require("../PrimaryItemsContainer"); /** * @jsxRuntime classic * @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 var containerStyles = (0, _react2.css)({ display: 'flex', boxSizing: 'border-box', // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766 height: _constants.HORIZONTAL_GLOBAL_NAV_HEIGHT, position: 'relative', alignItems: 'center', justifyContent: 'space-between', flexShrink: 0, borderBlockEnd: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, #0B120E24)"), paddingInlineEnd: "var(--ds-space-150, 12px)", paddingInlineStart: "var(--ds-space-150, 12px)" }); var leftStyles = (0, _react2.css)({ display: 'flex', minWidth: 0, height: 'inherit', alignItems: 'center', flexGrow: 1, // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 '& > *': { flexShrink: 0 } }); var rightStyles = (0, _react2.css)({ display: 'flex', alignItems: 'center', flexShrink: 0, // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 '& > *': { flexShrink: 0, marginInlineEnd: "var(--ds-space-050, 4px)" } }); var noRightMarginStyles = (0, _react2.css)({ marginInlineEnd: 0 }); var analyticsData = { attributes: { navigationLayer: 'global' }, componentName: 'atlassianNavigation' }; /** * __Atlassian navigation__ * * The horizontal navigation component for Atlassian products. * * - [Examples](https://atlassian.design/components/atlassian-navigation/examples) * - [Code](https://atlassian.design/components/atlassian-navigation/examples) * * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead. */ var AtlassianNavigation = exports.AtlassianNavigation = function AtlassianNavigation(props) { if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'CI') { (0, _warnOnce.default)('@atlaskit/atlassian-navigation is deprecated. Use @atlaskit/navigation-system instead.'); } var label = props.label, _props$primaryItems = props.primaryItems, primaryItems = _props$primaryItems === void 0 ? [] : _props$primaryItems, AppSwitcher = props.renderAppSwitcher, create = props.renderCreate, Help = props.renderHelp, Notifications = props.renderNotifications, ProductHome = props.renderProductHome, Profile = props.renderProfile, Search = props.renderSearch, SignIn = props.renderSignIn, Settings = props.renderSettings, _props$moreLabel = props.moreLabel, moreLabel = _props$moreLabel === void 0 ? '…' : _props$moreLabel, _props$theme = props.theme, theme = _props$theme === void 0 ? _theme.defaultTheme : _props$theme, testId = props.testId, _props$isServer = props.isServer, isServer = _props$isServer === void 0 ? false : _props$isServer, _props$isSSRPlacehold = props.isSSRPlaceholderEnabled, isSSRPlaceholderEnabled = _props$isSSRPlacehold === void 0 ? false : _props$isSSRPlacehold; return (0, _react2.jsx)(_theme.ThemeProvider, { value: theme }, (0, _react2.jsx)(_analyticsNamespacedContext.NavigationAnalyticsContext, { data: analyticsData }, (0, _react2.jsx)("header", (0, _extends2.default)({ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 style: theme.mode.navigation, css: containerStyles, "data-testid": testId && "".concat(testId, "-header"), role: "banner", "data-vc": "atlassian-navigation".concat(isServer ? '-ssr' : '') }, isServer && isSSRPlaceholderEnabled && { 'data-ssr-placeholder': 'atlassian-navigation-placeholder' }, !isServer && isSSRPlaceholderEnabled && { 'data-ssr-placeholder-replace': 'atlassian-navigation-placeholder' }), (0, _react2.jsx)("nav", { css: leftStyles, "aria-label": label }, AppSwitcher && (0, _react2.jsx)(AppSwitcher, null), ProductHome && (0, _react2.jsx)(ProductHome, null), (0, _react2.jsx)(_PrimaryItemsContainer.PrimaryItemsContainer, { testId: testId, moreLabel: moreLabel, items: primaryItems, create: create // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides , theme: theme })), (0, _react2.jsx)("div", { css: rightStyles, "data-testid": testId && "".concat(testId, "-secondary-actions") }, Search && (0, _react2.jsx)(Search, null), (0, _react2.jsx)("div", { role: "list", css: [rightStyles, noRightMarginStyles], "data-vc": "atlassian-navigation-secondary-actions" }, Notifications && (0, _react2.jsx)(Notifications, null), Help && (0, _react2.jsx)(Help, null), Settings && (0, _react2.jsx)(Settings, null), SignIn && (0, _react2.jsx)(SignIn, null), Profile && (0, _react2.jsx)(Profile, null)))))); };