@atlaskit/atlassian-navigation 2.5.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/components/AtlassianNavigation/index.js +11 -1
- package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +2 -2
- package/dist/cjs/components/PrimaryItemsContainerV2/index.js +149 -0
- package/dist/cjs/components/ProductHome/custom-product-home.js +6 -1
- package/dist/cjs/components/ProductHome/product-home.js +7 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/AtlassianNavigation/index.js +11 -1
- package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +3 -3
- package/dist/es2019/components/PrimaryItemsContainerV2/index.js +129 -0
- package/dist/es2019/components/ProductHome/custom-product-home.js +9 -1
- package/dist/es2019/components/ProductHome/product-home.js +10 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/AtlassianNavigation/index.js +11 -1
- package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -3
- package/dist/esm/components/PrimaryItemsContainerV2/index.js +138 -0
- package/dist/esm/components/ProductHome/custom-product-home.js +6 -1
- package/dist/esm/components/ProductHome/product-home.js +7 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/PrimaryItemsContainer/skeleton.d.ts +2 -1
- package/dist/types/components/PrimaryItemsContainerV2/index.d.ts +8 -0
- package/dist/types-ts4.5/components/PrimaryItemsContainer/skeleton.d.ts +2 -1
- package/dist/types-ts4.5/components/PrimaryItemsContainerV2/index.d.ts +8 -0
- package/package.json +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/atlassian-navigation
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e40a555bd64`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e40a555bd64) - [ux] Adds a platform-feature-flagged update to the way the top nav renders primary nav items, moving it from unperformant JS-based calculations to a responsive CSS solution. PFF: "platform.design-system-team.navigation-v2-no-jank_5yhbd"
|
|
8
|
+
|
|
3
9
|
## 2.5.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.AtlassianNavigation = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
10
11
|
var _constants = require("../../common/constants");
|
|
11
12
|
var _theme = require("../../theme");
|
|
12
13
|
var _PrimaryItemsContainer = require("../PrimaryItemsContainer");
|
|
14
|
+
var _PrimaryItemsContainerV = require("../PrimaryItemsContainerV2");
|
|
13
15
|
/** @jsx jsx */
|
|
14
16
|
|
|
15
17
|
var containerStyles = (0, _react.css)({
|
|
@@ -111,7 +113,15 @@ var AtlassianNavigation = function AtlassianNavigation(props) {
|
|
|
111
113
|
}, (0, _react.jsx)("nav", {
|
|
112
114
|
css: leftStyles,
|
|
113
115
|
"aria-label": label
|
|
114
|
-
}, AppSwitcher && (0, _react.jsx)(AppSwitcher, null), ProductHome && (0, _react.jsx)(ProductHome, null), (0, _react.jsx)(
|
|
116
|
+
}, AppSwitcher && (0, _react.jsx)(AppSwitcher, null), ProductHome && (0, _react.jsx)(ProductHome, null), (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? (0, _react.jsx)(_PrimaryItemsContainerV.PrimaryItemsContainer, {
|
|
117
|
+
testId: testId,
|
|
118
|
+
moreLabel: moreLabel,
|
|
119
|
+
items: primaryItems,
|
|
120
|
+
create: create
|
|
121
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
122
|
+
,
|
|
123
|
+
theme: theme
|
|
124
|
+
}) : (0, _react.jsx)(_PrimaryItemsContainer.PrimaryItemsContainer, {
|
|
115
125
|
testId: testId,
|
|
116
126
|
moreLabel: moreLabel,
|
|
117
127
|
items: primaryItems,
|
|
@@ -16,7 +16,7 @@ var primaryButtonSkeletonStyles = (0, _react2.css)({
|
|
|
16
16
|
|
|
17
17
|
// Internal only
|
|
18
18
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
19
|
-
var PrimaryItemsContainerSkeleton = function
|
|
19
|
+
var PrimaryItemsContainerSkeleton = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
20
20
|
var count = _ref.count;
|
|
21
21
|
return (0, _react2.jsx)(_react.Fragment, null, Array.from({
|
|
22
22
|
length: count
|
|
@@ -26,5 +26,5 @@ var PrimaryItemsContainerSkeleton = function PrimaryItemsContainerSkeleton(_ref)
|
|
|
26
26
|
css: primaryButtonSkeletonStyles
|
|
27
27
|
});
|
|
28
28
|
}));
|
|
29
|
-
};
|
|
29
|
+
});
|
|
30
30
|
exports.PrimaryItemsContainerSkeleton = PrimaryItemsContainerSkeleton;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.PrimaryItemsContainer = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
15
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
16
|
+
var _overflow = require("../../controllers/overflow");
|
|
17
|
+
var _PrimaryDropdownButton = require("../PrimaryDropdownButton");
|
|
18
|
+
var _css2;
|
|
19
|
+
/** @jsx jsx */
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
var parentContainerStyles = (0, _react2.css)({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
width: '100%',
|
|
25
|
+
height: '100%'
|
|
26
|
+
});
|
|
27
|
+
var basePrimaryContainerStyles = (0, _react2.css)({
|
|
28
|
+
display: 'none',
|
|
29
|
+
minWidth: 0,
|
|
30
|
+
gap: "var(--ds-space-100, 8px)"
|
|
31
|
+
});
|
|
32
|
+
var smallContainerStyles = (0, _react2.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.sm, {
|
|
33
|
+
display: 'flex'
|
|
34
|
+
}));
|
|
35
|
+
var mediumContainerStyles = (0, _react2.css)((_css2 = {}, (0, _defineProperty2.default)(_css2, _responsive.UNSAFE_media.above.sm, {
|
|
36
|
+
display: 'flex'
|
|
37
|
+
}), (0, _defineProperty2.default)(_css2, _responsive.UNSAFE_media.above.lg, {
|
|
38
|
+
display: 'none'
|
|
39
|
+
}), _css2));
|
|
40
|
+
var largeContainerStyles = (0, _react2.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.above.lg, {
|
|
41
|
+
display: 'flex'
|
|
42
|
+
}));
|
|
43
|
+
var MoreItemsPopup = function MoreItemsPopup(_ref) {
|
|
44
|
+
var moreLabel = _ref.moreLabel,
|
|
45
|
+
testId = _ref.testId,
|
|
46
|
+
items = _ref.items;
|
|
47
|
+
var _useState = (0, _react.useState)(false),
|
|
48
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
49
|
+
isMoreOpen = _useState2[0],
|
|
50
|
+
setIsMoreOpen = _useState2[1];
|
|
51
|
+
var onMoreClose = (0, _react.useCallback)(function () {
|
|
52
|
+
return setIsMoreOpen(false);
|
|
53
|
+
}, []);
|
|
54
|
+
var onMoreClick = (0, _react.useCallback)(function () {
|
|
55
|
+
return setIsMoreOpen(function (current) {
|
|
56
|
+
return !current;
|
|
57
|
+
});
|
|
58
|
+
}, []);
|
|
59
|
+
var openOverflowMenu = (0, _react.useCallback)(function () {
|
|
60
|
+
return setIsMoreOpen(true);
|
|
61
|
+
}, []);
|
|
62
|
+
var trigger = (0, _react.useCallback)(function (triggerProps) {
|
|
63
|
+
return (0, _react2.jsx)(_PrimaryDropdownButton.PrimaryDropdownButton, (0, _extends2.default)({
|
|
64
|
+
onClick: onMoreClick,
|
|
65
|
+
isSelected: isMoreOpen,
|
|
66
|
+
testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
|
|
67
|
+
}, triggerProps), moreLabel);
|
|
68
|
+
}, [moreLabel, onMoreClick, isMoreOpen, testId]);
|
|
69
|
+
var content = (0, _react.useCallback)(function () {
|
|
70
|
+
return (0, _react2.jsx)(_overflow.OverflowProvider, {
|
|
71
|
+
isVisible: false,
|
|
72
|
+
openOverflowMenu: openOverflowMenu,
|
|
73
|
+
closeOverflowMenu: onMoreClose
|
|
74
|
+
}, items);
|
|
75
|
+
}, [items, openOverflowMenu, onMoreClose]);
|
|
76
|
+
return (0, _react2.jsx)(_popup.default, {
|
|
77
|
+
placement: "bottom-start",
|
|
78
|
+
isOpen: isMoreOpen,
|
|
79
|
+
onClose: onMoreClose,
|
|
80
|
+
trigger: trigger,
|
|
81
|
+
content: content,
|
|
82
|
+
testId: testId ? "".concat(testId, "-overflow-menu-popup") : 'overflow-menu-popup'
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Internal only
|
|
87
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
88
|
+
var PrimaryItemsContainer = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
89
|
+
var moreLabel = _ref2.moreLabel,
|
|
90
|
+
items = _ref2.items,
|
|
91
|
+
Create = _ref2.create,
|
|
92
|
+
theme = _ref2.theme,
|
|
93
|
+
testId = _ref2.testId;
|
|
94
|
+
var filteredItems = (0, _react.useMemo)(function () {
|
|
95
|
+
return _react.default.Children.toArray(items).filter(function (item) {
|
|
96
|
+
return !!item;
|
|
97
|
+
});
|
|
98
|
+
}, [items]);
|
|
99
|
+
// NOTE: we could make these max items configurable in the future. For now
|
|
100
|
+
// we are using sensible defaults. Anything over the max gets put in the
|
|
101
|
+
// overflow menu for that screen size.
|
|
102
|
+
// While it may be tempting to use more than 3 items for the medium nav when
|
|
103
|
+
// you see the available space, you need to consider internationalistion.
|
|
104
|
+
// 3 is the safe, defensive choice across many languages and scripts.
|
|
105
|
+
var smallMaxItems = 0;
|
|
106
|
+
var mediumMaxItems = 3;
|
|
107
|
+
var largeMaxItems = 8;
|
|
108
|
+
var navItems = (0, _react.useMemo)(function () {
|
|
109
|
+
return {
|
|
110
|
+
// For small screens, we're currently putting all items in the overflow
|
|
111
|
+
medium: {
|
|
112
|
+
navBarItems: filteredItems.slice(0, mediumMaxItems),
|
|
113
|
+
overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
|
|
114
|
+
},
|
|
115
|
+
large: {
|
|
116
|
+
navBarItems: filteredItems.slice(0, largeMaxItems),
|
|
117
|
+
overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}, [filteredItems]);
|
|
121
|
+
return (0, _react2.jsx)("div", {
|
|
122
|
+
css: parentContainerStyles,
|
|
123
|
+
"data-testid": testId && "".concat(testId, "-primary-actions")
|
|
124
|
+
}, (0, _react2.jsx)("div", {
|
|
125
|
+
css: [basePrimaryContainerStyles, smallContainerStyles]
|
|
126
|
+
}, filteredItems.length > smallMaxItems && (0, _react2.jsx)(MoreItemsPopup
|
|
127
|
+
// NOTE: Would be nice to have a different label for small screens
|
|
128
|
+
// with i18n support (eg. swapping from 'More' to 'Menu' like
|
|
129
|
+
// Atlas does). Instead of opting for adding a new label prop right
|
|
130
|
+
// now I'm holding off until DSTRFC-016 lands.
|
|
131
|
+
, {
|
|
132
|
+
moreLabel: moreLabel,
|
|
133
|
+
items: filteredItems,
|
|
134
|
+
testId: testId
|
|
135
|
+
})), (0, _react2.jsx)("div", {
|
|
136
|
+
css: [basePrimaryContainerStyles, mediumContainerStyles]
|
|
137
|
+
}, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && (0, _react2.jsx)(MoreItemsPopup, {
|
|
138
|
+
moreLabel: moreLabel,
|
|
139
|
+
items: navItems.medium.overflowItems,
|
|
140
|
+
testId: testId
|
|
141
|
+
})), (0, _react2.jsx)("div", {
|
|
142
|
+
css: [basePrimaryContainerStyles, largeContainerStyles]
|
|
143
|
+
}, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && (0, _react2.jsx)(MoreItemsPopup, {
|
|
144
|
+
moreLabel: moreLabel,
|
|
145
|
+
items: navItems.large.overflowItems,
|
|
146
|
+
testId: testId
|
|
147
|
+
})), Create && (0, _react2.jsx)(Create, null));
|
|
148
|
+
});
|
|
149
|
+
exports.PrimaryItemsContainer = PrimaryItemsContainer;
|
|
@@ -10,6 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _constants = require("../../common/constants");
|
|
14
15
|
var _theme = require("../../theme");
|
|
15
16
|
var _utils = require("./utils");
|
|
@@ -89,6 +90,10 @@ var siteTitleStyles = (0, _react2.css)({
|
|
|
89
90
|
alignItems: 'center'
|
|
90
91
|
});
|
|
91
92
|
|
|
93
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
94
|
+
var featureFlaggedHideSiteTitleStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? (0, _react2.css)((0, _defineProperty2.default)({}, "@media (max-width: ".concat(_constants.PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
95
|
+
display: 'none'
|
|
96
|
+
})) : null;
|
|
92
97
|
/**
|
|
93
98
|
* __Custom product home__
|
|
94
99
|
*
|
|
@@ -147,7 +152,7 @@ var CustomProductHome = function CustomProductHome(props) {
|
|
|
147
152
|
style: {
|
|
148
153
|
borderRight: theme.mode.productHome.borderRight
|
|
149
154
|
},
|
|
150
|
-
css: siteTitleStyles,
|
|
155
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
151
156
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
152
157
|
}, siteTitle));
|
|
153
158
|
};
|
|
@@ -10,6 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _constants = require("../../common/constants");
|
|
14
15
|
var _theme = require("../../theme");
|
|
15
16
|
var _utils = require("./utils");
|
|
@@ -103,6 +104,11 @@ var siteTitleStyles = (0, _react2.css)({
|
|
|
103
104
|
alignItems: 'center'
|
|
104
105
|
});
|
|
105
106
|
|
|
107
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
108
|
+
var featureFlaggedHideSiteTitleStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? (0, _react2.css)((0, _defineProperty2.default)({}, "@media (max-width: ".concat(_constants.PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
109
|
+
display: 'none'
|
|
110
|
+
})) : null;
|
|
111
|
+
|
|
106
112
|
/**
|
|
107
113
|
* __Product home__
|
|
108
114
|
*
|
|
@@ -170,7 +176,7 @@ var ProductHome = function ProductHome(_ref) {
|
|
|
170
176
|
style: {
|
|
171
177
|
borderRight: theme.mode.productHome.borderRight
|
|
172
178
|
},
|
|
173
|
-
css: siteTitleStyles,
|
|
179
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
174
180
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
175
181
|
}, siteTitle));
|
|
176
182
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { NavigationAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { N30A, N40A, N900 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
|
|
6
7
|
import { defaultTheme, hexToRGBA, ThemeProvider } from '../../theme';
|
|
7
8
|
import { PrimaryItemsContainer } from '../PrimaryItemsContainer';
|
|
9
|
+
import { PrimaryItemsContainer as PrimaryItemsContainerV2 } from '../PrimaryItemsContainerV2';
|
|
8
10
|
const containerStyles = css({
|
|
9
11
|
display: 'flex',
|
|
10
12
|
boxSizing: 'border-box',
|
|
@@ -103,7 +105,15 @@ export const AtlassianNavigation = props => {
|
|
|
103
105
|
}, jsx("nav", {
|
|
104
106
|
css: leftStyles,
|
|
105
107
|
"aria-label": label
|
|
106
|
-
}, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), jsx(
|
|
108
|
+
}, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? jsx(PrimaryItemsContainerV2, {
|
|
109
|
+
testId: testId,
|
|
110
|
+
moreLabel: moreLabel,
|
|
111
|
+
items: primaryItems,
|
|
112
|
+
create: create
|
|
113
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
114
|
+
,
|
|
115
|
+
theme: theme
|
|
116
|
+
}) : jsx(PrimaryItemsContainer, {
|
|
107
117
|
testId: testId,
|
|
108
118
|
moreLabel: moreLabel,
|
|
109
119
|
items: primaryItems,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Fragment } from 'react';
|
|
2
|
+
import { Fragment, memo } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { PrimaryButtonSkeleton } from '../PrimaryButton/skeleton';
|
|
5
5
|
const primaryButtonSkeletonStyles = css({
|
|
@@ -9,11 +9,11 @@ const primaryButtonSkeletonStyles = css({
|
|
|
9
9
|
|
|
10
10
|
// Internal only
|
|
11
11
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
12
|
-
export const PrimaryItemsContainerSkeleton = ({
|
|
12
|
+
export const PrimaryItemsContainerSkeleton = /*#__PURE__*/memo(({
|
|
13
13
|
count
|
|
14
14
|
}) => jsx(Fragment, null, Array.from({
|
|
15
15
|
length: count
|
|
16
16
|
}, (_, index) => jsx(PrimaryButtonSkeleton, {
|
|
17
17
|
key: index,
|
|
18
18
|
css: primaryButtonSkeletonStyles
|
|
19
|
-
})));
|
|
19
|
+
}))));
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import Popup from '@atlaskit/popup';
|
|
6
|
+
import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
|
|
7
|
+
import { OverflowProvider } from '../../controllers/overflow';
|
|
8
|
+
import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
|
|
9
|
+
const parentContainerStyles = css({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%'
|
|
13
|
+
});
|
|
14
|
+
const basePrimaryContainerStyles = css({
|
|
15
|
+
display: 'none',
|
|
16
|
+
minWidth: 0,
|
|
17
|
+
gap: "var(--ds-space-100, 8px)"
|
|
18
|
+
});
|
|
19
|
+
const smallContainerStyles = css({
|
|
20
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
21
|
+
[media.below.sm]: {
|
|
22
|
+
display: 'flex'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const mediumContainerStyles = css({
|
|
26
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
27
|
+
[media.above.sm]: {
|
|
28
|
+
display: 'flex'
|
|
29
|
+
},
|
|
30
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
31
|
+
[media.above.lg]: {
|
|
32
|
+
display: 'none'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const largeContainerStyles = css({
|
|
36
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
37
|
+
[media.above.lg]: {
|
|
38
|
+
display: 'flex'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const MoreItemsPopup = ({
|
|
42
|
+
moreLabel,
|
|
43
|
+
testId,
|
|
44
|
+
items
|
|
45
|
+
}) => {
|
|
46
|
+
const [isMoreOpen, setIsMoreOpen] = useState(false);
|
|
47
|
+
const onMoreClose = useCallback(() => setIsMoreOpen(false), []);
|
|
48
|
+
const onMoreClick = useCallback(() => setIsMoreOpen(current => !current), []);
|
|
49
|
+
const openOverflowMenu = useCallback(() => setIsMoreOpen(true), []);
|
|
50
|
+
const trigger = useCallback(triggerProps => jsx(PrimaryDropdownButton, _extends({
|
|
51
|
+
onClick: onMoreClick,
|
|
52
|
+
isSelected: isMoreOpen,
|
|
53
|
+
testId: testId ? `${testId}-overflow-menu-trigger` : 'overflow-menu-trigger'
|
|
54
|
+
}, triggerProps), moreLabel), [moreLabel, onMoreClick, isMoreOpen, testId]);
|
|
55
|
+
const content = useCallback(() => jsx(OverflowProvider, {
|
|
56
|
+
isVisible: false,
|
|
57
|
+
openOverflowMenu: openOverflowMenu,
|
|
58
|
+
closeOverflowMenu: onMoreClose
|
|
59
|
+
}, items), [items, openOverflowMenu, onMoreClose]);
|
|
60
|
+
return jsx(Popup, {
|
|
61
|
+
placement: "bottom-start",
|
|
62
|
+
isOpen: isMoreOpen,
|
|
63
|
+
onClose: onMoreClose,
|
|
64
|
+
trigger: trigger,
|
|
65
|
+
content: content,
|
|
66
|
+
testId: testId ? `${testId}-overflow-menu-popup` : 'overflow-menu-popup'
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Internal only
|
|
71
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
72
|
+
export const PrimaryItemsContainer = /*#__PURE__*/memo(({
|
|
73
|
+
moreLabel,
|
|
74
|
+
items,
|
|
75
|
+
create: Create,
|
|
76
|
+
theme,
|
|
77
|
+
testId
|
|
78
|
+
}) => {
|
|
79
|
+
const filteredItems = useMemo(() => React.Children.toArray(items).filter(item => !!item), [items]);
|
|
80
|
+
// NOTE: we could make these max items configurable in the future. For now
|
|
81
|
+
// we are using sensible defaults. Anything over the max gets put in the
|
|
82
|
+
// overflow menu for that screen size.
|
|
83
|
+
// While it may be tempting to use more than 3 items for the medium nav when
|
|
84
|
+
// you see the available space, you need to consider internationalistion.
|
|
85
|
+
// 3 is the safe, defensive choice across many languages and scripts.
|
|
86
|
+
const smallMaxItems = 0;
|
|
87
|
+
const mediumMaxItems = 3;
|
|
88
|
+
const largeMaxItems = 8;
|
|
89
|
+
const navItems = useMemo(() => {
|
|
90
|
+
return {
|
|
91
|
+
// For small screens, we're currently putting all items in the overflow
|
|
92
|
+
medium: {
|
|
93
|
+
navBarItems: filteredItems.slice(0, mediumMaxItems),
|
|
94
|
+
overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
|
|
95
|
+
},
|
|
96
|
+
large: {
|
|
97
|
+
navBarItems: filteredItems.slice(0, largeMaxItems),
|
|
98
|
+
overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}, [filteredItems]);
|
|
102
|
+
return jsx("div", {
|
|
103
|
+
css: parentContainerStyles,
|
|
104
|
+
"data-testid": testId && `${testId}-primary-actions`
|
|
105
|
+
}, jsx("div", {
|
|
106
|
+
css: [basePrimaryContainerStyles, smallContainerStyles]
|
|
107
|
+
}, filteredItems.length > smallMaxItems && jsx(MoreItemsPopup
|
|
108
|
+
// NOTE: Would be nice to have a different label for small screens
|
|
109
|
+
// with i18n support (eg. swapping from 'More' to 'Menu' like
|
|
110
|
+
// Atlas does). Instead of opting for adding a new label prop right
|
|
111
|
+
// now I'm holding off until DSTRFC-016 lands.
|
|
112
|
+
, {
|
|
113
|
+
moreLabel: moreLabel,
|
|
114
|
+
items: filteredItems,
|
|
115
|
+
testId: testId
|
|
116
|
+
})), jsx("div", {
|
|
117
|
+
css: [basePrimaryContainerStyles, mediumContainerStyles]
|
|
118
|
+
}, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
119
|
+
moreLabel: moreLabel,
|
|
120
|
+
items: navItems.medium.overflowItems,
|
|
121
|
+
testId: testId
|
|
122
|
+
})), jsx("div", {
|
|
123
|
+
css: [basePrimaryContainerStyles, largeContainerStyles]
|
|
124
|
+
}, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
125
|
+
moreLabel: moreLabel,
|
|
126
|
+
items: navItems.large.overflowItems,
|
|
127
|
+
testId: testId
|
|
128
|
+
})), Create && jsx(Create, null));
|
|
129
|
+
});
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
6
7
|
import { useTheme } from '../../theme';
|
|
7
8
|
import { getTag } from './utils';
|
|
@@ -86,6 +87,13 @@ const siteTitleStyles = css({
|
|
|
86
87
|
alignItems: 'center'
|
|
87
88
|
});
|
|
88
89
|
|
|
90
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
91
|
+
const featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css({
|
|
92
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
93
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
94
|
+
display: 'none'
|
|
95
|
+
}
|
|
96
|
+
}) : null;
|
|
89
97
|
/**
|
|
90
98
|
* __Custom product home__
|
|
91
99
|
*
|
|
@@ -154,7 +162,7 @@ const CustomProductHome = props => {
|
|
|
154
162
|
style: {
|
|
155
163
|
borderRight: theme.mode.productHome.borderRight
|
|
156
164
|
},
|
|
157
|
-
css: siteTitleStyles,
|
|
165
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
158
166
|
"data-testid": testId && `${testId}-site-title`
|
|
159
167
|
}, siteTitle));
|
|
160
168
|
};
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
6
7
|
import { useTheme } from '../../theme';
|
|
7
8
|
import { getTag } from './utils';
|
|
@@ -100,6 +101,14 @@ const siteTitleStyles = css({
|
|
|
100
101
|
alignItems: 'center'
|
|
101
102
|
});
|
|
102
103
|
|
|
104
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
105
|
+
const featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css({
|
|
106
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
107
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
108
|
+
display: 'none'
|
|
109
|
+
}
|
|
110
|
+
}) : null;
|
|
111
|
+
|
|
103
112
|
/**
|
|
104
113
|
* __Product home__
|
|
105
114
|
*
|
|
@@ -174,7 +183,7 @@ const ProductHome = ({
|
|
|
174
183
|
style: {
|
|
175
184
|
borderRight: theme.mode.productHome.borderRight
|
|
176
185
|
},
|
|
177
|
-
css: siteTitleStyles,
|
|
186
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
178
187
|
"data-testid": testId && `${testId}-site-title`
|
|
179
188
|
}, siteTitle));
|
|
180
189
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { NavigationAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { N30A, N40A, N900 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
|
|
6
7
|
import { defaultTheme, hexToRGBA, ThemeProvider } from '../../theme';
|
|
7
8
|
import { PrimaryItemsContainer } from '../PrimaryItemsContainer';
|
|
9
|
+
import { PrimaryItemsContainer as PrimaryItemsContainerV2 } from '../PrimaryItemsContainerV2';
|
|
8
10
|
var containerStyles = css({
|
|
9
11
|
display: 'flex',
|
|
10
12
|
boxSizing: 'border-box',
|
|
@@ -104,7 +106,15 @@ export var AtlassianNavigation = function AtlassianNavigation(props) {
|
|
|
104
106
|
}, jsx("nav", {
|
|
105
107
|
css: leftStyles,
|
|
106
108
|
"aria-label": label
|
|
107
|
-
}, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), jsx(
|
|
109
|
+
}, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? jsx(PrimaryItemsContainerV2, {
|
|
110
|
+
testId: testId,
|
|
111
|
+
moreLabel: moreLabel,
|
|
112
|
+
items: primaryItems,
|
|
113
|
+
create: create
|
|
114
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
115
|
+
,
|
|
116
|
+
theme: theme
|
|
117
|
+
}) : jsx(PrimaryItemsContainer, {
|
|
108
118
|
testId: testId,
|
|
109
119
|
moreLabel: moreLabel,
|
|
110
120
|
items: primaryItems,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Fragment } from 'react';
|
|
2
|
+
import { Fragment, memo } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { PrimaryButtonSkeleton } from '../PrimaryButton/skeleton';
|
|
5
5
|
var primaryButtonSkeletonStyles = css({
|
|
@@ -9,7 +9,7 @@ var primaryButtonSkeletonStyles = css({
|
|
|
9
9
|
|
|
10
10
|
// Internal only
|
|
11
11
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
12
|
-
export var PrimaryItemsContainerSkeleton = function
|
|
12
|
+
export var PrimaryItemsContainerSkeleton = /*#__PURE__*/memo(function (_ref) {
|
|
13
13
|
var count = _ref.count;
|
|
14
14
|
return jsx(Fragment, null, Array.from({
|
|
15
15
|
length: count
|
|
@@ -19,4 +19,4 @@ export var PrimaryItemsContainerSkeleton = function PrimaryItemsContainerSkeleto
|
|
|
19
19
|
css: primaryButtonSkeletonStyles
|
|
20
20
|
});
|
|
21
21
|
}));
|
|
22
|
-
};
|
|
22
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _css2;
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import Popup from '@atlaskit/popup';
|
|
9
|
+
import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
|
|
10
|
+
import { OverflowProvider } from '../../controllers/overflow';
|
|
11
|
+
import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
|
|
12
|
+
var parentContainerStyles = css({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
width: '100%',
|
|
15
|
+
height: '100%'
|
|
16
|
+
});
|
|
17
|
+
var basePrimaryContainerStyles = css({
|
|
18
|
+
display: 'none',
|
|
19
|
+
minWidth: 0,
|
|
20
|
+
gap: "var(--ds-space-100, 8px)"
|
|
21
|
+
});
|
|
22
|
+
var smallContainerStyles = css(_defineProperty({}, media.below.sm, {
|
|
23
|
+
display: 'flex'
|
|
24
|
+
}));
|
|
25
|
+
var mediumContainerStyles = css((_css2 = {}, _defineProperty(_css2, media.above.sm, {
|
|
26
|
+
display: 'flex'
|
|
27
|
+
}), _defineProperty(_css2, media.above.lg, {
|
|
28
|
+
display: 'none'
|
|
29
|
+
}), _css2));
|
|
30
|
+
var largeContainerStyles = css(_defineProperty({}, media.above.lg, {
|
|
31
|
+
display: 'flex'
|
|
32
|
+
}));
|
|
33
|
+
var MoreItemsPopup = function MoreItemsPopup(_ref) {
|
|
34
|
+
var moreLabel = _ref.moreLabel,
|
|
35
|
+
testId = _ref.testId,
|
|
36
|
+
items = _ref.items;
|
|
37
|
+
var _useState = useState(false),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
isMoreOpen = _useState2[0],
|
|
40
|
+
setIsMoreOpen = _useState2[1];
|
|
41
|
+
var onMoreClose = useCallback(function () {
|
|
42
|
+
return setIsMoreOpen(false);
|
|
43
|
+
}, []);
|
|
44
|
+
var onMoreClick = useCallback(function () {
|
|
45
|
+
return setIsMoreOpen(function (current) {
|
|
46
|
+
return !current;
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
var openOverflowMenu = useCallback(function () {
|
|
50
|
+
return setIsMoreOpen(true);
|
|
51
|
+
}, []);
|
|
52
|
+
var trigger = useCallback(function (triggerProps) {
|
|
53
|
+
return jsx(PrimaryDropdownButton, _extends({
|
|
54
|
+
onClick: onMoreClick,
|
|
55
|
+
isSelected: isMoreOpen,
|
|
56
|
+
testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
|
|
57
|
+
}, triggerProps), moreLabel);
|
|
58
|
+
}, [moreLabel, onMoreClick, isMoreOpen, testId]);
|
|
59
|
+
var content = useCallback(function () {
|
|
60
|
+
return jsx(OverflowProvider, {
|
|
61
|
+
isVisible: false,
|
|
62
|
+
openOverflowMenu: openOverflowMenu,
|
|
63
|
+
closeOverflowMenu: onMoreClose
|
|
64
|
+
}, items);
|
|
65
|
+
}, [items, openOverflowMenu, onMoreClose]);
|
|
66
|
+
return jsx(Popup, {
|
|
67
|
+
placement: "bottom-start",
|
|
68
|
+
isOpen: isMoreOpen,
|
|
69
|
+
onClose: onMoreClose,
|
|
70
|
+
trigger: trigger,
|
|
71
|
+
content: content,
|
|
72
|
+
testId: testId ? "".concat(testId, "-overflow-menu-popup") : 'overflow-menu-popup'
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Internal only
|
|
77
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
78
|
+
export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
|
|
79
|
+
var moreLabel = _ref2.moreLabel,
|
|
80
|
+
items = _ref2.items,
|
|
81
|
+
Create = _ref2.create,
|
|
82
|
+
theme = _ref2.theme,
|
|
83
|
+
testId = _ref2.testId;
|
|
84
|
+
var filteredItems = useMemo(function () {
|
|
85
|
+
return React.Children.toArray(items).filter(function (item) {
|
|
86
|
+
return !!item;
|
|
87
|
+
});
|
|
88
|
+
}, [items]);
|
|
89
|
+
// NOTE: we could make these max items configurable in the future. For now
|
|
90
|
+
// we are using sensible defaults. Anything over the max gets put in the
|
|
91
|
+
// overflow menu for that screen size.
|
|
92
|
+
// While it may be tempting to use more than 3 items for the medium nav when
|
|
93
|
+
// you see the available space, you need to consider internationalistion.
|
|
94
|
+
// 3 is the safe, defensive choice across many languages and scripts.
|
|
95
|
+
var smallMaxItems = 0;
|
|
96
|
+
var mediumMaxItems = 3;
|
|
97
|
+
var largeMaxItems = 8;
|
|
98
|
+
var navItems = useMemo(function () {
|
|
99
|
+
return {
|
|
100
|
+
// For small screens, we're currently putting all items in the overflow
|
|
101
|
+
medium: {
|
|
102
|
+
navBarItems: filteredItems.slice(0, mediumMaxItems),
|
|
103
|
+
overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
|
|
104
|
+
},
|
|
105
|
+
large: {
|
|
106
|
+
navBarItems: filteredItems.slice(0, largeMaxItems),
|
|
107
|
+
overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}, [filteredItems]);
|
|
111
|
+
return jsx("div", {
|
|
112
|
+
css: parentContainerStyles,
|
|
113
|
+
"data-testid": testId && "".concat(testId, "-primary-actions")
|
|
114
|
+
}, jsx("div", {
|
|
115
|
+
css: [basePrimaryContainerStyles, smallContainerStyles]
|
|
116
|
+
}, filteredItems.length > smallMaxItems && jsx(MoreItemsPopup
|
|
117
|
+
// NOTE: Would be nice to have a different label for small screens
|
|
118
|
+
// with i18n support (eg. swapping from 'More' to 'Menu' like
|
|
119
|
+
// Atlas does). Instead of opting for adding a new label prop right
|
|
120
|
+
// now I'm holding off until DSTRFC-016 lands.
|
|
121
|
+
, {
|
|
122
|
+
moreLabel: moreLabel,
|
|
123
|
+
items: filteredItems,
|
|
124
|
+
testId: testId
|
|
125
|
+
})), jsx("div", {
|
|
126
|
+
css: [basePrimaryContainerStyles, mediumContainerStyles]
|
|
127
|
+
}, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
128
|
+
moreLabel: moreLabel,
|
|
129
|
+
items: navItems.medium.overflowItems,
|
|
130
|
+
testId: testId
|
|
131
|
+
})), jsx("div", {
|
|
132
|
+
css: [basePrimaryContainerStyles, largeContainerStyles]
|
|
133
|
+
}, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
134
|
+
moreLabel: moreLabel,
|
|
135
|
+
items: navItems.large.overflowItems,
|
|
136
|
+
testId: testId
|
|
137
|
+
})), Create && jsx(Create, null));
|
|
138
|
+
});
|
|
@@ -6,6 +6,7 @@ var _css3;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { Fragment } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
10
11
|
import { useTheme } from '../../theme';
|
|
11
12
|
import { getTag } from './utils';
|
|
@@ -82,6 +83,10 @@ var siteTitleStyles = css({
|
|
|
82
83
|
alignItems: 'center'
|
|
83
84
|
});
|
|
84
85
|
|
|
86
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
87
|
+
var featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
88
|
+
display: 'none'
|
|
89
|
+
})) : null;
|
|
85
90
|
/**
|
|
86
91
|
* __Custom product home__
|
|
87
92
|
*
|
|
@@ -140,7 +145,7 @@ var CustomProductHome = function CustomProductHome(props) {
|
|
|
140
145
|
style: {
|
|
141
146
|
borderRight: theme.mode.productHome.borderRight
|
|
142
147
|
},
|
|
143
|
-
css: siteTitleStyles,
|
|
148
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
144
149
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
145
150
|
}, siteTitle));
|
|
146
151
|
};
|
|
@@ -6,6 +6,7 @@ var _css;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { Fragment } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
10
11
|
import { useTheme } from '../../theme';
|
|
11
12
|
import { getTag } from './utils';
|
|
@@ -96,6 +97,11 @@ var siteTitleStyles = css({
|
|
|
96
97
|
alignItems: 'center'
|
|
97
98
|
});
|
|
98
99
|
|
|
100
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
101
|
+
var featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
102
|
+
display: 'none'
|
|
103
|
+
})) : null;
|
|
104
|
+
|
|
99
105
|
/**
|
|
100
106
|
* __Product home__
|
|
101
107
|
*
|
|
@@ -163,7 +169,7 @@ var ProductHome = function ProductHome(_ref) {
|
|
|
163
169
|
style: {
|
|
164
170
|
borderRight: theme.mode.productHome.borderRight
|
|
165
171
|
},
|
|
166
|
-
css: siteTitleStyles,
|
|
172
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
167
173
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
168
174
|
}, siteTitle));
|
|
169
175
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { jsx } from '@emotion/react';
|
|
2
3
|
import { PrimaryItemsContainerSkeletonProps } from './types';
|
|
3
|
-
export declare const PrimaryItemsContainerSkeleton: ({ count
|
|
4
|
+
export declare const PrimaryItemsContainerSkeleton: import("react").MemoExoticComponent<({ count }: PrimaryItemsContainerSkeletonProps) => jsx.JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { NavigationTheme } from '../../theme';
|
|
5
|
+
import { PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
|
|
6
|
+
export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
|
|
7
|
+
theme: NavigationTheme;
|
|
8
|
+
}) => jsx.JSX.Element>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { jsx } from '@emotion/react';
|
|
2
3
|
import { PrimaryItemsContainerSkeletonProps } from './types';
|
|
3
|
-
export declare const PrimaryItemsContainerSkeleton: ({ count
|
|
4
|
+
export declare const PrimaryItemsContainerSkeleton: import("react").MemoExoticComponent<({ count }: PrimaryItemsContainerSkeletonProps) => jsx.JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { NavigationTheme } from '../../theme';
|
|
5
|
+
import { PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
|
|
6
|
+
export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
|
|
7
|
+
theme: NavigationTheme;
|
|
8
|
+
}) => jsx.JSX.Element>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/atlassian-navigation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "A horizontal navigation component for Atlassian products.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
38
38
|
"@atlaskit/icon": "^21.12.0",
|
|
39
39
|
"@atlaskit/logo": "*",
|
|
40
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
40
41
|
"@atlaskit/popup": "^1.6.0",
|
|
42
|
+
"@atlaskit/primitives": "^0.9.2",
|
|
41
43
|
"@atlaskit/theme": "^12.5.0",
|
|
42
44
|
"@atlaskit/tokens": "^1.4.0",
|
|
43
45
|
"@atlaskit/tooltip": "^17.8.0",
|
|
@@ -63,6 +65,8 @@
|
|
|
63
65
|
"@atlaskit/spinner": "*",
|
|
64
66
|
"@atlaskit/visual-regression": "*",
|
|
65
67
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
68
|
+
"@atlassian/feature-flags-test-utils": "^0.1.1",
|
|
69
|
+
"@atlassian/gemini-visual-regression": "*",
|
|
66
70
|
"@atlassian/switcher": "*",
|
|
67
71
|
"@atlassian/switcher-test-utils": "*",
|
|
68
72
|
"@testing-library/react": "^12.1.5",
|
|
@@ -70,6 +74,7 @@
|
|
|
70
74
|
"jest-axe": "^4.0.0",
|
|
71
75
|
"jest-emotion": "^10.0.32",
|
|
72
76
|
"react": "^16.8.0",
|
|
77
|
+
"react-dom": "^16.8.0",
|
|
73
78
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
74
79
|
"typescript": "~4.9.5"
|
|
75
80
|
},
|
|
@@ -93,5 +98,10 @@
|
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
100
|
"homepage": "https://atlassian.design/components/atlassian-navigation/",
|
|
96
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
101
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
102
|
+
"platform-feature-flags": {
|
|
103
|
+
"platform.design-system-team.navigation-v2-no-jank_5yhbd": {
|
|
104
|
+
"type": "boolean"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
97
107
|
}
|