@atlaskit/navigation-system 5.17.0 → 5.18.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 +14 -0
- package/dist/cjs/ui/page-layout/constants.js +8 -2
- package/dist/cjs/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +20 -50
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +7 -0
- package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +16 -8
- package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.js +5 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +4 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav.js +14 -33
- package/dist/cjs/ui/page-layout/use-open-layer-count.js +59 -0
- package/dist/es2019/ui/page-layout/constants.js +7 -1
- package/dist/es2019/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +23 -48
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +7 -0
- package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +11 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.js +5 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +5 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav.js +17 -31
- package/dist/es2019/ui/page-layout/use-open-layer-count.js +44 -0
- package/dist/esm/ui/page-layout/constants.js +7 -1
- package/dist/esm/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +23 -52
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +7 -0
- package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +16 -8
- package/dist/esm/ui/page-layout/top-nav/top-nav-middle.js +5 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +5 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav.js +17 -35
- package/dist/esm/ui/page-layout/use-open-layer-count.js +53 -0
- package/dist/types/ui/page-layout/constants.d.ts +3 -1
- package/dist/types/ui/page-layout/use-open-layer-count.d.ts +8 -0
- package/dist/types-ts4.5/ui/page-layout/constants.d.ts +3 -1
- package/dist/types-ts4.5/ui/page-layout/use-open-layer-count.d.ts +8 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`67509a09876ad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/67509a09876ad) -
|
|
8
|
+
The side nav will no longer peek when a popup is open in `TopNavStart`, such as the app switcher.
|
|
9
|
+
|
|
10
|
+
This change is behind the `platform_dst_nav4_side_nav_resize_tooltip_feedback` and
|
|
11
|
+
`platform-dst-side-nav-layering-fixes` feature flags, when full height sidebar is enabled.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 5.17.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.topNavMountedVar = exports.sideNavVar = exports.sideNavPanelSplitterId = exports.sideNavLiveWidthVar = exports.sideNavContentScrollTimelineVar = exports.panelVar = exports.panelPanelSplitterId = exports.
|
|
6
|
+
exports.topNavMountedVar = exports.sideNavVar = exports.sideNavPanelSplitterId = exports.sideNavLiveWidthVar = exports.sideNavContentScrollTimelineVar = exports.panelVar = exports.panelPanelSplitterId = exports.openLayerObserverTopNavStartNamespace = exports.openLayerObserverTopNavMiddleNamespace = exports.openLayerObserverTopNavEndNamespace = exports.openLayerObserverSideNavNamespace = exports.localSlotLayers = exports.contentInsetBlockStart = exports.contentHeightWhenFixed = exports.bannerMountedVar = exports.asideVar = exports.asidePanelSplitterId = exports.UNSAFE_topNavVar = exports.UNSAFE_sideNavLayoutVar = exports.UNSAFE_panelLayoutVar = exports.UNSAFE_bannerVar = exports.UNSAFE_asideLayoutVar = exports.UNSAFE_MAIN_INLINE_START_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_INLINE_END_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_BLOCK_START_FOR_LEGACY_PAGES_ONLY = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* These variables are shared across the different page layout slots.
|
|
9
9
|
* This violates the [UI styling standard](https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-imported-style-values/usage).
|
|
@@ -66,7 +66,13 @@ var localSlotLayers = exports.localSlotLayers = {
|
|
|
66
66
|
panelSmallViewports: 1
|
|
67
67
|
};
|
|
68
68
|
var openLayerObserverSideNavNamespace = exports.openLayerObserverSideNavNamespace = 'side-nav';
|
|
69
|
-
|
|
69
|
+
// We have separate OpenLayerObserver namespaces for each top nav layout area, instead of a single namespace for the entire top nav,
|
|
70
|
+
// as we need to know if there are open layers in TopNavStart specifically to prevent the side nav from peeking.
|
|
71
|
+
// The OpenLayerObserver doesn't support nested namespaces. We could update it, but for now it's simple enough to just have separate
|
|
72
|
+
// namespaces.
|
|
73
|
+
var openLayerObserverTopNavStartNamespace = exports.openLayerObserverTopNavStartNamespace = 'top-nav-start';
|
|
74
|
+
var openLayerObserverTopNavMiddleNamespace = exports.openLayerObserverTopNavMiddleNamespace = 'top-nav-middle';
|
|
75
|
+
var openLayerObserverTopNavEndNamespace = exports.openLayerObserverTopNavEndNamespace = 'top-nav-end';
|
|
70
76
|
|
|
71
77
|
/**
|
|
72
78
|
* CSS scroll timeline variable for the side nav content scroll indicator.
|
|
@@ -6,17 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.SideNavPanelSplitter = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
12
|
-
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
13
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
12
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
15
13
|
var _constants = require("../constants");
|
|
16
14
|
var _useToggleSideNav = require("../side-nav/use-toggle-side-nav");
|
|
15
|
+
var _useOpenLayerCount = require("../use-open-layer-count");
|
|
17
16
|
var _context = require("./context");
|
|
18
17
|
var _panelSplitter = require("./panel-splitter");
|
|
19
18
|
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); }
|
|
19
|
+
/**
|
|
20
|
+
* Namespaces to check for open layers that would interfere with the panel splitter.
|
|
21
|
+
*
|
|
22
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
23
|
+
*/
|
|
24
|
+
var openLayerNamespacesToCheck = [
|
|
25
|
+
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
26
|
+
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
27
|
+
// we check it as well.
|
|
28
|
+
_constants.openLayerObserverSideNavNamespace,
|
|
29
|
+
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
30
|
+
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
31
|
+
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
32
|
+
_constants.openLayerObserverTopNavStartNamespace, _constants.openLayerObserverTopNavMiddleNamespace, _constants.openLayerObserverTopNavEndNamespace];
|
|
20
33
|
/**
|
|
21
34
|
* _SideNavPanelSplitter_
|
|
22
35
|
*
|
|
@@ -48,54 +61,11 @@ var SideNavPanelSplitter = exports.SideNavPanelSplitter = function SideNavPanelS
|
|
|
48
61
|
// The logic and state for disabling the panel splitter when there are open popups
|
|
49
62
|
// in the side nav or top nav is being placed here, instead of in `SideNav`, to prevent
|
|
50
63
|
// re-rendering the side nav anytime the number of open popups changes.
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(0, _react.useEffect)(function () {
|
|
57
|
-
if (!openLayerObserver || !isFhsEnabled || !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes')) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
function checkAndSetState() {
|
|
61
|
-
if (!openLayerObserver) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
66
|
-
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
67
|
-
// we check it as well.
|
|
68
|
-
var openPopupsInSideNav = openLayerObserver.getCount({
|
|
69
|
-
namespace: _constants.openLayerObserverSideNavNamespace,
|
|
70
|
-
type: 'popup'
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
74
|
-
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
75
|
-
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
76
|
-
var openPopupsInTopNav = openLayerObserver.getCount({
|
|
77
|
-
namespace: _constants.openLayerObserverTopNavNamespace,
|
|
78
|
-
type: 'popup'
|
|
79
|
-
});
|
|
80
|
-
setIsEnabled(openPopupsInSideNav + openPopupsInTopNav === 0);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Initial check, in case the app has loaded with an open popup.
|
|
84
|
-
checkAndSetState();
|
|
85
|
-
|
|
86
|
-
// Creating separate listeners for each namespace, to avoid running them when layers in other parts of the app change.
|
|
87
|
-
var cleanupSideNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
88
|
-
namespace: _constants.openLayerObserverSideNavNamespace
|
|
89
|
-
});
|
|
90
|
-
var cleanupTopNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
91
|
-
namespace: _constants.openLayerObserverTopNavNamespace
|
|
92
|
-
});
|
|
93
|
-
return function cleanup() {
|
|
94
|
-
cleanupSideNavListener();
|
|
95
|
-
cleanupTopNavListener();
|
|
96
|
-
};
|
|
97
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
98
|
-
if (!isEnabled && isFhsEnabled && (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes')) {
|
|
64
|
+
var hasOpenLayers = (0, _useOpenLayerCount.useHasOpenLayers)({
|
|
65
|
+
namespaces: openLayerNamespacesToCheck,
|
|
66
|
+
type: 'popup'
|
|
67
|
+
});
|
|
68
|
+
if (hasOpenLayers && isFhsEnabled && (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes')) {
|
|
99
69
|
return null;
|
|
100
70
|
}
|
|
101
71
|
return /*#__PURE__*/_react.default.createElement(_context.OnDoubleClickContext.Provider, {
|
|
@@ -220,6 +220,13 @@ function SideNavInternal(_ref) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
function open() {
|
|
223
|
+
// Prevent the flyout from being opened if there are any open layers in the top nav start
|
|
224
|
+
if (openLayerObserver && openLayerObserver.getCount({
|
|
225
|
+
namespace: 'top-nav-start',
|
|
226
|
+
type: 'popup'
|
|
227
|
+
}) > 0 && (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback')) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
223
230
|
var prevFlyoutState = flyoutStateRef.current;
|
|
224
231
|
tryAbortPendingClose();
|
|
225
232
|
flyoutStateRef.current = {
|
|
@@ -15,6 +15,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _react2 = require("@compiled/react");
|
|
16
16
|
var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
|
|
17
17
|
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
18
|
+
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
18
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
20
21
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
@@ -22,6 +23,7 @@ var _list = require("../../../components/list");
|
|
|
22
23
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
23
24
|
var _hasCustomThemeContext = require("../../top-nav-items/themed/has-custom-theme-context");
|
|
24
25
|
var _migration = require("../../top-nav-items/themed/migration");
|
|
26
|
+
var _constants = require("../constants");
|
|
25
27
|
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); }
|
|
26
28
|
var containerStyles = {
|
|
27
29
|
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15ri1mjv _1gs5usvi _ndwch9n0",
|
|
@@ -34,6 +36,12 @@ var listStyles = {
|
|
|
34
36
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
35
37
|
popupContainer: "_1yt4u2gc"
|
|
36
38
|
};
|
|
39
|
+
function OpenLayerObserverNamespaceProviderBehindFG(_ref) {
|
|
40
|
+
var children = _ref.children;
|
|
41
|
+
return (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/_react.default.createElement(_openLayerObserver.OpenLayerObserverNamespaceProvider, {
|
|
42
|
+
namespace: _constants.openLayerObserverTopNavEndNamespace
|
|
43
|
+
}, children) : children;
|
|
44
|
+
}
|
|
37
45
|
|
|
38
46
|
/**
|
|
39
47
|
* __TopNavEnd__
|
|
@@ -43,12 +51,12 @@ var listStyles = {
|
|
|
43
51
|
* On small viewports, the children will be placed inside a popup, and a button will be rendered to open the popup.
|
|
44
52
|
* This is to prevent the actions from overflowing the top navigation.
|
|
45
53
|
*/
|
|
46
|
-
function TopNavEnd(
|
|
47
|
-
var children =
|
|
48
|
-
|
|
49
|
-
label =
|
|
50
|
-
|
|
51
|
-
showMoreButtonLabel =
|
|
54
|
+
function TopNavEnd(_ref2) {
|
|
55
|
+
var children = _ref2.children,
|
|
56
|
+
_ref2$label = _ref2.label,
|
|
57
|
+
label = _ref2$label === void 0 ? 'Actions' : _ref2$label,
|
|
58
|
+
_ref2$showMoreButtonL = _ref2.showMoreButtonLabel,
|
|
59
|
+
showMoreButtonLabel = _ref2$showMoreButtonL === void 0 ? 'Show more' : _ref2$showMoreButtonL;
|
|
52
60
|
var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
|
|
53
61
|
var _useState = (0, _react.useState)(false),
|
|
54
62
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -87,7 +95,7 @@ function TopNavEnd(_ref) {
|
|
|
87
95
|
value: false
|
|
88
96
|
}, /*#__PURE__*/_react.default.createElement(_list.List, {
|
|
89
97
|
xcss: (0, _react2.cx)(listStyles.root, listStyles.popupContainer)
|
|
90
|
-
}, children));
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
91
99
|
},
|
|
92
100
|
trigger: function trigger(triggerProps) {
|
|
93
101
|
return /*#__PURE__*/_react.default.createElement(_migration.IconButton, (0, _extends2.default)({}, triggerProps, {
|
|
@@ -102,5 +110,5 @@ function TopNavEnd(_ref) {
|
|
|
102
110
|
}
|
|
103
111
|
}) : /*#__PURE__*/_react.default.createElement(_list.List, {
|
|
104
112
|
xcss: (0, _react2.cx)(listStyles.root, listStyles.hideOnSmallViewport)
|
|
105
|
-
}, children));
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
106
114
|
}
|
|
@@ -9,8 +9,10 @@ exports.TopNavMiddle = TopNavMiddle;
|
|
|
9
9
|
require("./top-nav-middle.compiled.css");
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
15
|
+
var _constants = require("../constants");
|
|
14
16
|
var styles = {
|
|
15
17
|
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0 _181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0",
|
|
16
18
|
fullHeightSidebar: "_lcxv1wug"
|
|
@@ -29,5 +31,7 @@ function TopNavMiddle(_ref) {
|
|
|
29
31
|
var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
|
|
30
32
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
33
|
className: (0, _runtime.ax)([styles.root, isFhsEnabled && !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') && styles.fullHeightSidebar])
|
|
32
|
-
},
|
|
34
|
+
}, (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/_react.default.createElement(_openLayerObserver.OpenLayerObserverNamespaceProvider, {
|
|
35
|
+
namespace: _constants.openLayerObserverTopNavMiddleNamespace
|
|
36
|
+
}, children) : children);
|
|
33
37
|
}
|
|
@@ -12,6 +12,7 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
|
|
15
|
+
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
15
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
18
|
var _topNavStartContext = require("../../../context/top-nav-start/top-nav-start-context");
|
|
@@ -153,7 +154,9 @@ var TopNavStartInnerFHS = /*#__PURE__*/(0, _react.forwardRef)(function TopNavSta
|
|
|
153
154
|
ref: ref,
|
|
154
155
|
"data-testid": testId,
|
|
155
156
|
className: (0, _runtime.ax)([innerStyles.root, !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar, (0, _platformFeatureFlags.fg)('team25-eu-jira-logo-updates-csm-jsm') && innerStyles.jiraProductLogoUpdate, isExpandedOnDesktop && innerStyles.fullHeightSidebarExpanded])
|
|
156
|
-
},
|
|
157
|
+
}, (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/_react.default.createElement(_openLayerObserver.OpenLayerObserverNamespaceProvider, {
|
|
158
|
+
namespace: _constants.openLayerObserverTopNavStartNamespace
|
|
159
|
+
}, children) : children));
|
|
157
160
|
});
|
|
158
161
|
|
|
159
162
|
/**
|
|
@@ -11,9 +11,7 @@ require("./top-nav.compiled.css");
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
|
-
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
17
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
16
|
var _skipLinksContext = require("../../../context/skip-links/skip-links-context");
|
|
19
17
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
@@ -24,6 +22,7 @@ var _hoistSlotSizesContext = require("../hoist-slot-sizes-context");
|
|
|
24
22
|
var _hoistUtils = require("../hoist-utils");
|
|
25
23
|
var _idUtils = require("../id-utils");
|
|
26
24
|
var _useSideNavVisibility2 = require("../side-nav/use-side-nav-visibility");
|
|
25
|
+
var _useOpenLayerCount = require("../use-open-layer-count");
|
|
27
26
|
var _excluded = ["backgroundColor"];
|
|
28
27
|
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); }
|
|
29
28
|
/**
|
|
@@ -52,6 +51,14 @@ var backgroundStyles = {
|
|
|
52
51
|
sideNavExpanded: "_hyzqcs5v"
|
|
53
52
|
};
|
|
54
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Namespaces to check for open layers within the top nav.
|
|
56
|
+
* When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
57
|
+
*
|
|
58
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
59
|
+
*/
|
|
60
|
+
var topNavOpenLayerNamespaces = [_constants.openLayerObserverTopNavStartNamespace, _constants.openLayerObserverTopNavMiddleNamespace, _constants.openLayerObserverTopNavEndNamespace];
|
|
61
|
+
|
|
55
62
|
/**
|
|
56
63
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
57
64
|
*/
|
|
@@ -103,34 +110,10 @@ function TopNav(_ref) {
|
|
|
103
110
|
foregroundStyle = _useMemo.foregroundStyle;
|
|
104
111
|
var _useSideNavVisibility = (0, _useSideNavVisibility2.useSideNavVisibility)(),
|
|
105
112
|
isExpandedOnDesktop = _useSideNavVisibility.isExpandedOnDesktop;
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
hasOpenPopup = _useState2[0],
|
|
111
|
-
setHasOpenPopup = _useState2[1];
|
|
112
|
-
(0, _react.useLayoutEffect)(function () {
|
|
113
|
-
if (!openLayerObserver || !isFhsEnabled || !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes')) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
function checkAndSetState() {
|
|
117
|
-
if (!openLayerObserver) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
setHasOpenPopup(openLayerObserver.getCount({
|
|
121
|
-
namespace: _constants.openLayerObserverTopNavNamespace,
|
|
122
|
-
type: 'popup'
|
|
123
|
-
}) > 0);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Initial check
|
|
127
|
-
checkAndSetState();
|
|
128
|
-
|
|
129
|
-
// Check again whenever number of layers in the top nav change
|
|
130
|
-
return openLayerObserver.onChange(checkAndSetState, {
|
|
131
|
-
namespace: _constants.openLayerObserverTopNavNamespace
|
|
132
|
-
});
|
|
133
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
113
|
+
var hasOpenPopup = (0, _useOpenLayerCount.useHasOpenLayers)({
|
|
114
|
+
namespaces: topNavOpenLayerNamespaces,
|
|
115
|
+
type: 'popup'
|
|
116
|
+
});
|
|
134
117
|
return /*#__PURE__*/React.createElement(_hasCustomThemeContext.HasCustomThemeContext.Provider, {
|
|
135
118
|
value: customTheme.isEnabled
|
|
136
119
|
}, isFhsEnabled && !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') && /*#__PURE__*/React.createElement("div", {
|
|
@@ -163,7 +146,5 @@ function TopNav(_ref) {
|
|
|
163
146
|
value: height
|
|
164
147
|
})
|
|
165
148
|
// ------ END UNSAFE STYLES ------
|
|
166
|
-
,
|
|
167
|
-
namespace: _constants.openLayerObserverTopNavNamespace
|
|
168
|
-
}, children) : children));
|
|
149
|
+
, children));
|
|
169
150
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useHasOpenLayers = useHasOpenLayers;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _useIsFhsEnabled = require("../fhs-rollout/use-is-fhs-enabled");
|
|
13
|
+
/**
|
|
14
|
+
* Returns whether there are any open layers across the specified namespaces, optionally filtered by type.
|
|
15
|
+
*/
|
|
16
|
+
function useHasOpenLayers(_ref) {
|
|
17
|
+
var namespaces = _ref.namespaces,
|
|
18
|
+
type = _ref.type;
|
|
19
|
+
var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
|
|
20
|
+
var openLayerObserver = (0, _openLayerObserver.useOpenLayerObserver)();
|
|
21
|
+
// Setting the initial state to false, as it is unlikely that there would be any open layers when the app starts.
|
|
22
|
+
var _useState = (0, _react.useState)(false),
|
|
23
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
24
|
+
hasOpenLayers = _useState2[0],
|
|
25
|
+
setHasOpenLayers = _useState2[1];
|
|
26
|
+
(0, _react.useEffect)(function () {
|
|
27
|
+
if (!openLayerObserver || !isFhsEnabled || !(0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
function updateState() {
|
|
31
|
+
if (!openLayerObserver) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var hasAnyOpenLayers = namespaces.some(function (namespace) {
|
|
35
|
+
return openLayerObserver.getCount({
|
|
36
|
+
namespace: namespace,
|
|
37
|
+
type: type
|
|
38
|
+
}) > 0;
|
|
39
|
+
});
|
|
40
|
+
setHasOpenLayers(hasAnyOpenLayers);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Initial check
|
|
44
|
+
updateState();
|
|
45
|
+
|
|
46
|
+
// Subscribe to each namespace
|
|
47
|
+
var cleanups = namespaces.map(function (namespace) {
|
|
48
|
+
return openLayerObserver.onChange(updateState, {
|
|
49
|
+
namespace: namespace
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return function cleanupHook() {
|
|
53
|
+
cleanups.forEach(function (cleanup) {
|
|
54
|
+
return cleanup();
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}, [isFhsEnabled, openLayerObserver, namespaces, type]);
|
|
58
|
+
return hasOpenLayers;
|
|
59
|
+
}
|
|
@@ -60,7 +60,13 @@ export const localSlotLayers = {
|
|
|
60
60
|
panelSmallViewports: 1
|
|
61
61
|
};
|
|
62
62
|
export const openLayerObserverSideNavNamespace = 'side-nav';
|
|
63
|
-
|
|
63
|
+
// We have separate OpenLayerObserver namespaces for each top nav layout area, instead of a single namespace for the entire top nav,
|
|
64
|
+
// as we need to know if there are open layers in TopNavStart specifically to prevent the side nav from peeking.
|
|
65
|
+
// The OpenLayerObserver doesn't support nested namespaces. We could update it, but for now it's simple enough to just have separate
|
|
66
|
+
// namespaces.
|
|
67
|
+
export const openLayerObserverTopNavStartNamespace = 'top-nav-start';
|
|
68
|
+
export const openLayerObserverTopNavMiddleNamespace = 'top-nav-middle';
|
|
69
|
+
export const openLayerObserverTopNavEndNamespace = 'top-nav-end';
|
|
64
70
|
|
|
65
71
|
/**
|
|
66
72
|
* CSS scroll timeline variable for the side nav content scroll indicator.
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import React, { useContext
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
|
-
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
4
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
6
|
-
import { openLayerObserverSideNavNamespace,
|
|
5
|
+
import { openLayerObserverSideNavNamespace, openLayerObserverTopNavEndNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavStartNamespace, sideNavPanelSplitterId } from '../constants';
|
|
7
6
|
import { useToggleSideNav } from '../side-nav/use-toggle-side-nav';
|
|
7
|
+
import { useHasOpenLayers } from '../use-open-layer-count';
|
|
8
8
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
9
9
|
import { PanelSplitter } from './panel-splitter';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Namespaces to check for open layers that would interfere with the panel splitter.
|
|
13
|
+
*
|
|
14
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
15
|
+
*/
|
|
16
|
+
const openLayerNamespacesToCheck = [
|
|
17
|
+
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
18
|
+
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
19
|
+
// we check it as well.
|
|
20
|
+
openLayerObserverSideNavNamespace,
|
|
21
|
+
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
22
|
+
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
23
|
+
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
24
|
+
openLayerObserverTopNavStartNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavEndNamespace];
|
|
10
25
|
/**
|
|
11
26
|
* _SideNavPanelSplitter_
|
|
12
27
|
*
|
|
@@ -38,51 +53,11 @@ export const SideNavPanelSplitter = ({
|
|
|
38
53
|
// The logic and state for disabling the panel splitter when there are open popups
|
|
39
54
|
// in the side nav or top nav is being placed here, instead of in `SideNav`, to prevent
|
|
40
55
|
// re-rendering the side nav anytime the number of open popups changes.
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
function checkAndSetState() {
|
|
48
|
-
if (!openLayerObserver) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
53
|
-
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
54
|
-
// we check it as well.
|
|
55
|
-
const openPopupsInSideNav = openLayerObserver.getCount({
|
|
56
|
-
namespace: openLayerObserverSideNavNamespace,
|
|
57
|
-
type: 'popup'
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
61
|
-
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
62
|
-
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
63
|
-
const openPopupsInTopNav = openLayerObserver.getCount({
|
|
64
|
-
namespace: openLayerObserverTopNavNamespace,
|
|
65
|
-
type: 'popup'
|
|
66
|
-
});
|
|
67
|
-
setIsEnabled(openPopupsInSideNav + openPopupsInTopNav === 0);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Initial check, in case the app has loaded with an open popup.
|
|
71
|
-
checkAndSetState();
|
|
72
|
-
|
|
73
|
-
// Creating separate listeners for each namespace, to avoid running them when layers in other parts of the app change.
|
|
74
|
-
const cleanupSideNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
75
|
-
namespace: openLayerObserverSideNavNamespace
|
|
76
|
-
});
|
|
77
|
-
const cleanupTopNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
78
|
-
namespace: openLayerObserverTopNavNamespace
|
|
79
|
-
});
|
|
80
|
-
return function cleanup() {
|
|
81
|
-
cleanupSideNavListener();
|
|
82
|
-
cleanupTopNavListener();
|
|
83
|
-
};
|
|
84
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
85
|
-
if (!isEnabled && isFhsEnabled && fg('platform-dst-side-nav-layering-fixes')) {
|
|
56
|
+
const hasOpenLayers = useHasOpenLayers({
|
|
57
|
+
namespaces: openLayerNamespacesToCheck,
|
|
58
|
+
type: 'popup'
|
|
59
|
+
});
|
|
60
|
+
if (hasOpenLayers && isFhsEnabled && fg('platform-dst-side-nav-layering-fixes')) {
|
|
86
61
|
return null;
|
|
87
62
|
}
|
|
88
63
|
return /*#__PURE__*/React.createElement(OnDoubleClickContext.Provider, {
|
|
@@ -199,6 +199,13 @@ function SideNavInternal({
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
function open() {
|
|
202
|
+
// Prevent the flyout from being opened if there are any open layers in the top nav start
|
|
203
|
+
if (openLayerObserver && openLayerObserver.getCount({
|
|
204
|
+
namespace: 'top-nav-start',
|
|
205
|
+
type: 'popup'
|
|
206
|
+
}) > 0 && fg('platform_dst_nav4_side_nav_resize_tooltip_feedback')) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
202
209
|
const prevFlyoutState = flyoutStateRef.current;
|
|
203
210
|
tryAbortPendingClose();
|
|
204
211
|
flyoutStateRef.current = {
|
|
@@ -6,6 +6,7 @@ import React, { useState } from 'react';
|
|
|
6
6
|
import { cx } from '@compiled/react';
|
|
7
7
|
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
8
8
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
9
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import Popup from '@atlaskit/popup';
|
|
11
12
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
@@ -13,6 +14,7 @@ import { List } from '../../../components/list';
|
|
|
13
14
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
14
15
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
15
16
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
17
|
+
import { openLayerObserverTopNavEndNamespace } from '../constants';
|
|
16
18
|
const containerStyles = {
|
|
17
19
|
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15ri1mjv _1gs5usvi _ndwch9n0",
|
|
18
20
|
jiraProductLogoUpdate: "_15rip2n4",
|
|
@@ -24,6 +26,13 @@ const listStyles = {
|
|
|
24
26
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
25
27
|
popupContainer: "_1yt4u2gc"
|
|
26
28
|
};
|
|
29
|
+
function OpenLayerObserverNamespaceProviderBehindFG({
|
|
30
|
+
children
|
|
31
|
+
}) {
|
|
32
|
+
return fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
33
|
+
namespace: openLayerObserverTopNavEndNamespace
|
|
34
|
+
}, children) : children;
|
|
35
|
+
}
|
|
27
36
|
|
|
28
37
|
/**
|
|
29
38
|
* __TopNavEnd__
|
|
@@ -67,7 +76,7 @@ export function TopNavEnd({
|
|
|
67
76
|
value: false
|
|
68
77
|
}, /*#__PURE__*/React.createElement(List, {
|
|
69
78
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
70
|
-
}, children)),
|
|
79
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children))),
|
|
71
80
|
trigger: triggerProps => /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
72
81
|
label: showMoreButtonLabel,
|
|
73
82
|
isSelected: isOpen,
|
|
@@ -77,5 +86,5 @@ export function TopNavEnd({
|
|
|
77
86
|
}))
|
|
78
87
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
79
88
|
xcss: cx(listStyles.root, listStyles.hideOnSmallViewport)
|
|
80
|
-
}, children));
|
|
89
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
81
90
|
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import "./top-nav-middle.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
8
|
+
import { openLayerObserverTopNavMiddleNamespace } from '../constants';
|
|
7
9
|
const styles = {
|
|
8
10
|
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0 _181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0",
|
|
9
11
|
fullHeightSidebar: "_lcxv1wug"
|
|
@@ -23,5 +25,7 @@ export function TopNavMiddle({
|
|
|
23
25
|
const isFhsEnabled = useIsFhsEnabled();
|
|
24
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
27
|
className: ax([styles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && styles.fullHeightSidebar])
|
|
26
|
-
},
|
|
28
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
29
|
+
namespace: openLayerObserverTopNavMiddleNamespace
|
|
30
|
+
}, children) : children);
|
|
27
31
|
}
|
|
@@ -3,11 +3,12 @@ import "./top-nav-start.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { forwardRef, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
6
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
6
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
8
9
|
import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
|
|
9
10
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
10
|
-
import { sideNavContentScrollTimelineVar } from '../constants';
|
|
11
|
+
import { openLayerObserverTopNavStartNamespace, sideNavContentScrollTimelineVar } from '../constants';
|
|
11
12
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
12
13
|
import { SideNavVisibilityState } from '../side-nav/visibility-context';
|
|
13
14
|
|
|
@@ -147,7 +148,9 @@ const TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS
|
|
|
147
148
|
ref: ref,
|
|
148
149
|
"data-testid": testId,
|
|
149
150
|
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar, fg('team25-eu-jira-logo-updates-csm-jsm') && innerStyles.jiraProductLogoUpdate, isExpandedOnDesktop && innerStyles.fullHeightSidebarExpanded])
|
|
150
|
-
},
|
|
151
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
152
|
+
namespace: openLayerObserverTopNavStartNamespace
|
|
153
|
+
}, children) : children));
|
|
151
154
|
});
|
|
152
155
|
|
|
153
156
|
/**
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
import "./top-nav.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useContext,
|
|
6
|
-
import { OpenLayerObserverNamespaceProvider, useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
5
|
+
import { useContext, useMemo } from 'react';
|
|
7
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { useSkipLink } from '../../../context/skip-links/skip-links-context';
|
|
9
8
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
10
9
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
11
10
|
import { useCustomTheme } from '../../top-nav-items/themed/use-custom-theme';
|
|
12
|
-
import { bannerMountedVar, localSlotLayers,
|
|
11
|
+
import { bannerMountedVar, localSlotLayers, openLayerObserverTopNavEndNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavStartNamespace, sideNavLiveWidthVar, topNavMountedVar, UNSAFE_topNavVar } from '../constants';
|
|
13
12
|
import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
|
|
14
13
|
import { DangerouslyHoistCssVarToDocumentRoot, HoistCssVarToLocalGrid } from '../hoist-utils';
|
|
15
14
|
import { useLayoutId } from '../id-utils';
|
|
16
15
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
16
|
+
import { useHasOpenLayers } from '../use-open-layer-count';
|
|
17
|
+
|
|
17
18
|
/**
|
|
18
19
|
* Styles for the container for the top nav items.
|
|
19
20
|
*
|
|
@@ -40,6 +41,14 @@ const backgroundStyles = {
|
|
|
40
41
|
sideNavExpanded: "_hyzqcs5v"
|
|
41
42
|
};
|
|
42
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Namespaces to check for open layers within the top nav.
|
|
46
|
+
* When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
47
|
+
*
|
|
48
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
49
|
+
*/
|
|
50
|
+
const topNavOpenLayerNamespaces = [openLayerObserverTopNavStartNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavEndNamespace];
|
|
51
|
+
|
|
43
52
|
/**
|
|
44
53
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
45
54
|
*/
|
|
@@ -93,31 +102,10 @@ export function TopNav({
|
|
|
93
102
|
const {
|
|
94
103
|
isExpandedOnDesktop
|
|
95
104
|
} = useSideNavVisibility();
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!openLayerObserver || !isFhsEnabled || !fg('platform-dst-side-nav-layering-fixes')) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
function checkAndSetState() {
|
|
104
|
-
if (!openLayerObserver) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
setHasOpenPopup(openLayerObserver.getCount({
|
|
108
|
-
namespace: openLayerObserverTopNavNamespace,
|
|
109
|
-
type: 'popup'
|
|
110
|
-
}) > 0);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Initial check
|
|
114
|
-
checkAndSetState();
|
|
115
|
-
|
|
116
|
-
// Check again whenever number of layers in the top nav change
|
|
117
|
-
return openLayerObserver.onChange(checkAndSetState, {
|
|
118
|
-
namespace: openLayerObserverTopNavNamespace
|
|
119
|
-
});
|
|
120
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
105
|
+
const hasOpenPopup = useHasOpenLayers({
|
|
106
|
+
namespaces: topNavOpenLayerNamespaces,
|
|
107
|
+
type: 'popup'
|
|
108
|
+
});
|
|
121
109
|
return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
122
110
|
value: customTheme.isEnabled
|
|
123
111
|
}, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && /*#__PURE__*/React.createElement("div", {
|
|
@@ -150,7 +138,5 @@ export function TopNav({
|
|
|
150
138
|
value: height
|
|
151
139
|
})
|
|
152
140
|
// ------ END UNSAFE STYLES ------
|
|
153
|
-
,
|
|
154
|
-
namespace: openLayerObserverTopNavNamespace
|
|
155
|
-
}, children) : children));
|
|
141
|
+
, children));
|
|
156
142
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useIsFhsEnabled } from '../fhs-rollout/use-is-fhs-enabled';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns whether there are any open layers across the specified namespaces, optionally filtered by type.
|
|
8
|
+
*/
|
|
9
|
+
export function useHasOpenLayers({
|
|
10
|
+
namespaces,
|
|
11
|
+
type
|
|
12
|
+
}) {
|
|
13
|
+
const isFhsEnabled = useIsFhsEnabled();
|
|
14
|
+
const openLayerObserver = useOpenLayerObserver();
|
|
15
|
+
// Setting the initial state to false, as it is unlikely that there would be any open layers when the app starts.
|
|
16
|
+
const [hasOpenLayers, setHasOpenLayers] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!openLayerObserver || !isFhsEnabled || !fg('platform-dst-side-nav-layering-fixes')) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
function updateState() {
|
|
22
|
+
if (!openLayerObserver) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const hasAnyOpenLayers = namespaces.some(namespace => openLayerObserver.getCount({
|
|
26
|
+
namespace,
|
|
27
|
+
type
|
|
28
|
+
}) > 0);
|
|
29
|
+
setHasOpenLayers(hasAnyOpenLayers);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Initial check
|
|
33
|
+
updateState();
|
|
34
|
+
|
|
35
|
+
// Subscribe to each namespace
|
|
36
|
+
const cleanups = namespaces.map(namespace => openLayerObserver.onChange(updateState, {
|
|
37
|
+
namespace
|
|
38
|
+
}));
|
|
39
|
+
return function cleanupHook() {
|
|
40
|
+
cleanups.forEach(cleanup => cleanup());
|
|
41
|
+
};
|
|
42
|
+
}, [isFhsEnabled, openLayerObserver, namespaces, type]);
|
|
43
|
+
return hasOpenLayers;
|
|
44
|
+
}
|
|
@@ -60,7 +60,13 @@ export var localSlotLayers = {
|
|
|
60
60
|
panelSmallViewports: 1
|
|
61
61
|
};
|
|
62
62
|
export var openLayerObserverSideNavNamespace = 'side-nav';
|
|
63
|
-
|
|
63
|
+
// We have separate OpenLayerObserver namespaces for each top nav layout area, instead of a single namespace for the entire top nav,
|
|
64
|
+
// as we need to know if there are open layers in TopNavStart specifically to prevent the side nav from peeking.
|
|
65
|
+
// The OpenLayerObserver doesn't support nested namespaces. We could update it, but for now it's simple enough to just have separate
|
|
66
|
+
// namespaces.
|
|
67
|
+
export var openLayerObserverTopNavStartNamespace = 'top-nav-start';
|
|
68
|
+
export var openLayerObserverTopNavMiddleNamespace = 'top-nav-middle';
|
|
69
|
+
export var openLayerObserverTopNavEndNamespace = 'top-nav-end';
|
|
64
70
|
|
|
65
71
|
/**
|
|
66
72
|
* CSS scroll timeline variable for the side nav content scroll indicator.
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
3
2
|
import invariant from 'tiny-invariant';
|
|
4
|
-
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
5
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
4
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
7
|
-
import { openLayerObserverSideNavNamespace,
|
|
5
|
+
import { openLayerObserverSideNavNamespace, openLayerObserverTopNavEndNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavStartNamespace, sideNavPanelSplitterId } from '../constants';
|
|
8
6
|
import { useToggleSideNav } from '../side-nav/use-toggle-side-nav';
|
|
7
|
+
import { useHasOpenLayers } from '../use-open-layer-count';
|
|
9
8
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
10
9
|
import { PanelSplitter } from './panel-splitter';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Namespaces to check for open layers that would interfere with the panel splitter.
|
|
13
|
+
*
|
|
14
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
15
|
+
*/
|
|
16
|
+
var openLayerNamespacesToCheck = [
|
|
17
|
+
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
18
|
+
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
19
|
+
// we check it as well.
|
|
20
|
+
openLayerObserverSideNavNamespace,
|
|
21
|
+
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
22
|
+
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
23
|
+
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
24
|
+
openLayerObserverTopNavStartNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavEndNamespace];
|
|
11
25
|
/**
|
|
12
26
|
* _SideNavPanelSplitter_
|
|
13
27
|
*
|
|
@@ -39,54 +53,11 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
|
|
|
39
53
|
// The logic and state for disabling the panel splitter when there are open popups
|
|
40
54
|
// in the side nav or top nav is being placed here, instead of in `SideNav`, to prevent
|
|
41
55
|
// re-rendering the side nav anytime the number of open popups changes.
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
if (!openLayerObserver || !isFhsEnabled || !fg('platform-dst-side-nav-layering-fixes')) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
function checkAndSetState() {
|
|
52
|
-
if (!openLayerObserver) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// We don't technically need to check the side nav for open layers, as they wouldn't overlay the
|
|
57
|
-
// panel splitter, as it sits within the same stacking context as the side nav. For consistency however,
|
|
58
|
-
// we check it as well.
|
|
59
|
-
var openPopupsInSideNav = openLayerObserver.getCount({
|
|
60
|
-
namespace: openLayerObserverSideNavNamespace,
|
|
61
|
-
type: 'popup'
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
65
|
-
// This means the part of the side nav panel splitter that was sitting above the top nav will no longer
|
|
66
|
-
// be interactive (as it is now behind the top nav). So, we need to disable the entire panel splitter.
|
|
67
|
-
var openPopupsInTopNav = openLayerObserver.getCount({
|
|
68
|
-
namespace: openLayerObserverTopNavNamespace,
|
|
69
|
-
type: 'popup'
|
|
70
|
-
});
|
|
71
|
-
setIsEnabled(openPopupsInSideNav + openPopupsInTopNav === 0);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Initial check, in case the app has loaded with an open popup.
|
|
75
|
-
checkAndSetState();
|
|
76
|
-
|
|
77
|
-
// Creating separate listeners for each namespace, to avoid running them when layers in other parts of the app change.
|
|
78
|
-
var cleanupSideNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
79
|
-
namespace: openLayerObserverSideNavNamespace
|
|
80
|
-
});
|
|
81
|
-
var cleanupTopNavListener = openLayerObserver.onChange(checkAndSetState, {
|
|
82
|
-
namespace: openLayerObserverTopNavNamespace
|
|
83
|
-
});
|
|
84
|
-
return function cleanup() {
|
|
85
|
-
cleanupSideNavListener();
|
|
86
|
-
cleanupTopNavListener();
|
|
87
|
-
};
|
|
88
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
89
|
-
if (!isEnabled && isFhsEnabled && fg('platform-dst-side-nav-layering-fixes')) {
|
|
56
|
+
var hasOpenLayers = useHasOpenLayers({
|
|
57
|
+
namespaces: openLayerNamespacesToCheck,
|
|
58
|
+
type: 'popup'
|
|
59
|
+
});
|
|
60
|
+
if (hasOpenLayers && isFhsEnabled && fg('platform-dst-side-nav-layering-fixes')) {
|
|
90
61
|
return null;
|
|
91
62
|
}
|
|
92
63
|
return /*#__PURE__*/React.createElement(OnDoubleClickContext.Provider, {
|
|
@@ -210,6 +210,13 @@ function SideNavInternal(_ref) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
function open() {
|
|
213
|
+
// Prevent the flyout from being opened if there are any open layers in the top nav start
|
|
214
|
+
if (openLayerObserver && openLayerObserver.getCount({
|
|
215
|
+
namespace: 'top-nav-start',
|
|
216
|
+
type: 'popup'
|
|
217
|
+
}) > 0 && fg('platform_dst_nav4_side_nav_resize_tooltip_feedback')) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
213
220
|
var prevFlyoutState = flyoutStateRef.current;
|
|
214
221
|
tryAbortPendingClose();
|
|
215
222
|
flyoutStateRef.current = {
|
|
@@ -7,6 +7,7 @@ import React, { useState } from 'react';
|
|
|
7
7
|
import { cx } from '@compiled/react';
|
|
8
8
|
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
9
9
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
10
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import Popup from '@atlaskit/popup';
|
|
12
13
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
@@ -14,6 +15,7 @@ import { List } from '../../../components/list';
|
|
|
14
15
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
15
16
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
16
17
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
18
|
+
import { openLayerObserverTopNavEndNamespace } from '../constants';
|
|
17
19
|
var containerStyles = {
|
|
18
20
|
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15ri1mjv _1gs5usvi _ndwch9n0",
|
|
19
21
|
jiraProductLogoUpdate: "_15rip2n4",
|
|
@@ -25,6 +27,12 @@ var listStyles = {
|
|
|
25
27
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
26
28
|
popupContainer: "_1yt4u2gc"
|
|
27
29
|
};
|
|
30
|
+
function OpenLayerObserverNamespaceProviderBehindFG(_ref) {
|
|
31
|
+
var children = _ref.children;
|
|
32
|
+
return fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
33
|
+
namespace: openLayerObserverTopNavEndNamespace
|
|
34
|
+
}, children) : children;
|
|
35
|
+
}
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
38
|
* __TopNavEnd__
|
|
@@ -34,12 +42,12 @@ var listStyles = {
|
|
|
34
42
|
* On small viewports, the children will be placed inside a popup, and a button will be rendered to open the popup.
|
|
35
43
|
* This is to prevent the actions from overflowing the top navigation.
|
|
36
44
|
*/
|
|
37
|
-
export function TopNavEnd(
|
|
38
|
-
var children =
|
|
39
|
-
|
|
40
|
-
label =
|
|
41
|
-
|
|
42
|
-
showMoreButtonLabel =
|
|
45
|
+
export function TopNavEnd(_ref2) {
|
|
46
|
+
var children = _ref2.children,
|
|
47
|
+
_ref2$label = _ref2.label,
|
|
48
|
+
label = _ref2$label === void 0 ? 'Actions' : _ref2$label,
|
|
49
|
+
_ref2$showMoreButtonL = _ref2.showMoreButtonLabel,
|
|
50
|
+
showMoreButtonLabel = _ref2$showMoreButtonL === void 0 ? 'Show more' : _ref2$showMoreButtonL;
|
|
43
51
|
var isFhsEnabled = useIsFhsEnabled();
|
|
44
52
|
var _useState = useState(false),
|
|
45
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -78,7 +86,7 @@ export function TopNavEnd(_ref) {
|
|
|
78
86
|
value: false
|
|
79
87
|
}, /*#__PURE__*/React.createElement(List, {
|
|
80
88
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
81
|
-
}, children));
|
|
89
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
82
90
|
},
|
|
83
91
|
trigger: function trigger(triggerProps) {
|
|
84
92
|
return /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
@@ -93,5 +101,5 @@ export function TopNavEnd(_ref) {
|
|
|
93
101
|
}
|
|
94
102
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
95
103
|
xcss: cx(listStyles.root, listStyles.hideOnSmallViewport)
|
|
96
|
-
}, children));
|
|
104
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
97
105
|
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import "./top-nav-middle.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
8
|
+
import { openLayerObserverTopNavMiddleNamespace } from '../constants';
|
|
7
9
|
var styles = {
|
|
8
10
|
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0 _181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0",
|
|
9
11
|
fullHeightSidebar: "_lcxv1wug"
|
|
@@ -22,5 +24,7 @@ export function TopNavMiddle(_ref) {
|
|
|
22
24
|
var isFhsEnabled = useIsFhsEnabled();
|
|
23
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
26
|
className: ax([styles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && styles.fullHeightSidebar])
|
|
25
|
-
},
|
|
27
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
28
|
+
namespace: openLayerObserverTopNavMiddleNamespace
|
|
29
|
+
}, children) : children);
|
|
26
30
|
}
|
|
@@ -4,11 +4,12 @@ import "./top-nav-start.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React, { forwardRef, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
6
6
|
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
7
|
+
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
9
10
|
import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
|
|
10
11
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
11
|
-
import { sideNavContentScrollTimelineVar } from '../constants';
|
|
12
|
+
import { openLayerObserverTopNavStartNamespace, sideNavContentScrollTimelineVar } from '../constants';
|
|
12
13
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
13
14
|
import { SideNavVisibilityState } from '../side-nav/visibility-context';
|
|
14
15
|
|
|
@@ -145,7 +146,9 @@ var TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS(_
|
|
|
145
146
|
ref: ref,
|
|
146
147
|
"data-testid": testId,
|
|
147
148
|
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar, fg('team25-eu-jira-logo-updates-csm-jsm') && innerStyles.jiraProductLogoUpdate, isExpandedOnDesktop && innerStyles.fullHeightSidebarExpanded])
|
|
148
|
-
},
|
|
149
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
150
|
+
namespace: openLayerObserverTopNavStartNamespace
|
|
151
|
+
}, children) : children));
|
|
149
152
|
});
|
|
150
153
|
|
|
151
154
|
/**
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/* top-nav.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
3
|
var _excluded = ["backgroundColor"];
|
|
5
4
|
import "./top-nav.compiled.css";
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
|
-
import { useContext,
|
|
9
|
-
import { OpenLayerObserverNamespaceProvider, useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
7
|
+
import { useContext, useMemo } from 'react';
|
|
10
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { useSkipLink } from '../../../context/skip-links/skip-links-context';
|
|
12
10
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
13
11
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
14
12
|
import { useCustomTheme } from '../../top-nav-items/themed/use-custom-theme';
|
|
15
|
-
import { bannerMountedVar, localSlotLayers,
|
|
13
|
+
import { bannerMountedVar, localSlotLayers, openLayerObserverTopNavEndNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavStartNamespace, sideNavLiveWidthVar, topNavMountedVar, UNSAFE_topNavVar } from '../constants';
|
|
16
14
|
import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
|
|
17
15
|
import { DangerouslyHoistCssVarToDocumentRoot, HoistCssVarToLocalGrid } from '../hoist-utils';
|
|
18
16
|
import { useLayoutId } from '../id-utils';
|
|
19
17
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
18
|
+
import { useHasOpenLayers } from '../use-open-layer-count';
|
|
19
|
+
|
|
20
20
|
/**
|
|
21
21
|
* Styles for the container for the top nav items.
|
|
22
22
|
*
|
|
@@ -43,6 +43,14 @@ var backgroundStyles = {
|
|
|
43
43
|
sideNavExpanded: "_hyzqcs5v"
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Namespaces to check for open layers within the top nav.
|
|
48
|
+
* When there is an open layer in the top nav, the top nav is given a higher z-index than the side nav.
|
|
49
|
+
*
|
|
50
|
+
* Placed outside the component for stability, as the list is used as an effect dependency.
|
|
51
|
+
*/
|
|
52
|
+
var topNavOpenLayerNamespaces = [openLayerObserverTopNavStartNamespace, openLayerObserverTopNavMiddleNamespace, openLayerObserverTopNavEndNamespace];
|
|
53
|
+
|
|
46
54
|
/**
|
|
47
55
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
48
56
|
*/
|
|
@@ -94,34 +102,10 @@ export function TopNav(_ref) {
|
|
|
94
102
|
foregroundStyle = _useMemo.foregroundStyle;
|
|
95
103
|
var _useSideNavVisibility = useSideNavVisibility(),
|
|
96
104
|
isExpandedOnDesktop = _useSideNavVisibility.isExpandedOnDesktop;
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
hasOpenPopup = _useState2[0],
|
|
102
|
-
setHasOpenPopup = _useState2[1];
|
|
103
|
-
useLayoutEffect(function () {
|
|
104
|
-
if (!openLayerObserver || !isFhsEnabled || !fg('platform-dst-side-nav-layering-fixes')) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
function checkAndSetState() {
|
|
108
|
-
if (!openLayerObserver) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
setHasOpenPopup(openLayerObserver.getCount({
|
|
112
|
-
namespace: openLayerObserverTopNavNamespace,
|
|
113
|
-
type: 'popup'
|
|
114
|
-
}) > 0);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Initial check
|
|
118
|
-
checkAndSetState();
|
|
119
|
-
|
|
120
|
-
// Check again whenever number of layers in the top nav change
|
|
121
|
-
return openLayerObserver.onChange(checkAndSetState, {
|
|
122
|
-
namespace: openLayerObserverTopNavNamespace
|
|
123
|
-
});
|
|
124
|
-
}, [isFhsEnabled, openLayerObserver]);
|
|
105
|
+
var hasOpenPopup = useHasOpenLayers({
|
|
106
|
+
namespaces: topNavOpenLayerNamespaces,
|
|
107
|
+
type: 'popup'
|
|
108
|
+
});
|
|
125
109
|
return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
126
110
|
value: customTheme.isEnabled
|
|
127
111
|
}, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && /*#__PURE__*/React.createElement("div", {
|
|
@@ -154,7 +138,5 @@ export function TopNav(_ref) {
|
|
|
154
138
|
value: height
|
|
155
139
|
})
|
|
156
140
|
// ------ END UNSAFE STYLES ------
|
|
157
|
-
,
|
|
158
|
-
namespace: openLayerObserverTopNavNamespace
|
|
159
|
-
}, children) : children));
|
|
141
|
+
, children));
|
|
160
142
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { useIsFhsEnabled } from '../fhs-rollout/use-is-fhs-enabled';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether there are any open layers across the specified namespaces, optionally filtered by type.
|
|
9
|
+
*/
|
|
10
|
+
export function useHasOpenLayers(_ref) {
|
|
11
|
+
var namespaces = _ref.namespaces,
|
|
12
|
+
type = _ref.type;
|
|
13
|
+
var isFhsEnabled = useIsFhsEnabled();
|
|
14
|
+
var openLayerObserver = useOpenLayerObserver();
|
|
15
|
+
// Setting the initial state to false, as it is unlikely that there would be any open layers when the app starts.
|
|
16
|
+
var _useState = useState(false),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
hasOpenLayers = _useState2[0],
|
|
19
|
+
setHasOpenLayers = _useState2[1];
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (!openLayerObserver || !isFhsEnabled || !fg('platform-dst-side-nav-layering-fixes')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
function updateState() {
|
|
25
|
+
if (!openLayerObserver) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var hasAnyOpenLayers = namespaces.some(function (namespace) {
|
|
29
|
+
return openLayerObserver.getCount({
|
|
30
|
+
namespace: namespace,
|
|
31
|
+
type: type
|
|
32
|
+
}) > 0;
|
|
33
|
+
});
|
|
34
|
+
setHasOpenLayers(hasAnyOpenLayers);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Initial check
|
|
38
|
+
updateState();
|
|
39
|
+
|
|
40
|
+
// Subscribe to each namespace
|
|
41
|
+
var cleanups = namespaces.map(function (namespace) {
|
|
42
|
+
return openLayerObserver.onChange(updateState, {
|
|
43
|
+
namespace: namespace
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return function cleanupHook() {
|
|
47
|
+
cleanups.forEach(function (cleanup) {
|
|
48
|
+
return cleanup();
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}, [isFhsEnabled, openLayerObserver, namespaces, type]);
|
|
52
|
+
return hasOpenLayers;
|
|
53
|
+
}
|
|
@@ -42,7 +42,9 @@ export declare const localSlotLayers: {
|
|
|
42
42
|
panelSmallViewports: number;
|
|
43
43
|
};
|
|
44
44
|
export declare const openLayerObserverSideNavNamespace = "side-nav";
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const openLayerObserverTopNavStartNamespace = "top-nav-start";
|
|
46
|
+
export declare const openLayerObserverTopNavMiddleNamespace = "top-nav-middle";
|
|
47
|
+
export declare const openLayerObserverTopNavEndNamespace = "top-nav-end";
|
|
46
48
|
/**
|
|
47
49
|
* CSS scroll timeline variable for the side nav content scroll indicator.
|
|
48
50
|
* The scroll timeline is created in SideNavContent, and then used by TopNavStart to apply the scroll indicator line.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LayerType } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether there are any open layers across the specified namespaces, optionally filtered by type.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useHasOpenLayers({ namespaces, type, }: {
|
|
6
|
+
namespaces: string[];
|
|
7
|
+
type?: LayerType;
|
|
8
|
+
}): boolean;
|
|
@@ -42,7 +42,9 @@ export declare const localSlotLayers: {
|
|
|
42
42
|
panelSmallViewports: number;
|
|
43
43
|
};
|
|
44
44
|
export declare const openLayerObserverSideNavNamespace = "side-nav";
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const openLayerObserverTopNavStartNamespace = "top-nav-start";
|
|
46
|
+
export declare const openLayerObserverTopNavMiddleNamespace = "top-nav-middle";
|
|
47
|
+
export declare const openLayerObserverTopNavEndNamespace = "top-nav-end";
|
|
46
48
|
/**
|
|
47
49
|
* CSS scroll timeline variable for the side nav content scroll indicator.
|
|
48
50
|
* The scroll timeline is created in SideNavContent, and then used by TopNavStart to apply the scroll indicator line.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LayerType } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether there are any open layers across the specified namespaces, optionally filtered by type.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useHasOpenLayers({ namespaces, type, }: {
|
|
6
|
+
namespaces: string[];
|
|
7
|
+
type?: LayerType;
|
|
8
|
+
}): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"@atlaskit/ds-lib": "^5.3.0",
|
|
74
74
|
"@atlaskit/heading": "^5.2.0",
|
|
75
75
|
"@atlaskit/icon": "^29.3.0",
|
|
76
|
-
"@atlaskit/layering": "^3.
|
|
76
|
+
"@atlaskit/layering": "^3.6.0",
|
|
77
77
|
"@atlaskit/logo": "^19.9.0",
|
|
78
78
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
79
|
-
"@atlaskit/popup": "^4.
|
|
79
|
+
"@atlaskit/popup": "^4.12.0",
|
|
80
80
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
81
81
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
82
82
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
83
83
|
"@atlaskit/primitives": "^17.0.0",
|
|
84
|
-
"@atlaskit/tokens": "^9.
|
|
84
|
+
"@atlaskit/tokens": "^9.1.0",
|
|
85
85
|
"@atlaskit/tooltip": "^20.11.0",
|
|
86
86
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
87
87
|
"@babel/runtime": "^7.0.0",
|
|
@@ -148,6 +148,9 @@
|
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
"platform-feature-flags": {
|
|
151
|
+
"platform_dst_nav4_side_nav_resize_tooltip_feedback": {
|
|
152
|
+
"type": "boolean"
|
|
153
|
+
},
|
|
151
154
|
"platform_dst_nav4_fhs_instrumentation_1": {
|
|
152
155
|
"type": "boolean"
|
|
153
156
|
},
|