@atlaskit/navigation-system 5.17.0 → 5.18.1
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 +21 -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.compiled.css +1 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +18 -11
- 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.compiled.css +1 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +7 -5
- 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.compiled.css +1 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +13 -5
- 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.compiled.css +1 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +8 -6
- 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.compiled.css +1 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +18 -11
- 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.compiled.css +1 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +8 -6
- 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 -7
|
@@ -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,9 +14,9 @@ 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
|
-
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris
|
|
18
|
-
jiraProductLogoUpdate: "_15rip2n4",
|
|
19
|
+
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0",
|
|
19
20
|
fullHeightSidebar: "_y4tiutpp _lcxv1wug",
|
|
20
21
|
fullHeightSidebarWithLayeringFixes: "_y4tiutpp"
|
|
21
22
|
};
|
|
@@ -24,6 +25,13 @@ const listStyles = {
|
|
|
24
25
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
25
26
|
popupContainer: "_1yt4u2gc"
|
|
26
27
|
};
|
|
28
|
+
function OpenLayerObserverNamespaceProviderBehindFG({
|
|
29
|
+
children
|
|
30
|
+
}) {
|
|
31
|
+
return fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
32
|
+
namespace: openLayerObserverTopNavEndNamespace
|
|
33
|
+
}, children) : children;
|
|
34
|
+
}
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* __TopNavEnd__
|
|
@@ -57,7 +65,7 @@ export function TopNavEnd({
|
|
|
57
65
|
}, [query]);
|
|
58
66
|
return /*#__PURE__*/React.createElement("nav", {
|
|
59
67
|
"aria-label": label,
|
|
60
|
-
className: ax([containerStyles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebar, isFhsEnabled && fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebarWithLayeringFixes
|
|
68
|
+
className: ax([containerStyles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebar, isFhsEnabled && fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebarWithLayeringFixes])
|
|
61
69
|
}, isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
62
70
|
isOpen: isOpen,
|
|
63
71
|
onClose: () => setIsOpen(false),
|
|
@@ -67,7 +75,7 @@ export function TopNavEnd({
|
|
|
67
75
|
value: false
|
|
68
76
|
}, /*#__PURE__*/React.createElement(List, {
|
|
69
77
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
70
|
-
}, children)),
|
|
78
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children))),
|
|
71
79
|
trigger: triggerProps => /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
72
80
|
label: showMoreButtonLabel,
|
|
73
81
|
isSelected: isOpen,
|
|
@@ -77,5 +85,5 @@ export function TopNavEnd({
|
|
|
77
85
|
}))
|
|
78
86
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
79
87
|
xcss: cx(listStyles.root, listStyles.hideOnSmallViewport)
|
|
80
|
-
}, children));
|
|
88
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
81
89
|
}
|
|
@@ -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
|
}
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
._vchhusvi{box-sizing:border-box}
|
|
14
14
|
[dir=rtl] ._65m41mrw{--animation-direction:-1}
|
|
15
15
|
@media (prefers-reduced-motion:no-preference){._10t81e03{transition-property:transform}._10t81rjc{transition-property:transform,opacity}._1xq51ytf{transition-timing-function:ease-in-out}._1xq55ucs{transition-timing-function:ease}._mjvc1efy{transform:translateX(calc(100%*var(--animation-direction)))}._bgpzidpf{opacity:0}._mjvc1p9u{transform:translateX(calc(-100%*var(--animation-direction)))}._mjvco0k7{transform:translateX(calc((-2rem + var(--ds-space-050, 4px)*-1)*var(--animation-direction)))}._mjvcyrjp{transform:translateX(calc((2rem + var(--ds-space-050, 4px))*var(--animation-direction)))}._mjvcz12g{transform:translateX(0)}._xrrpfnf5{transition-duration:.2s}._bgpzkb7n{opacity:1}}
|
|
16
|
-
@media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}
|
|
16
|
+
@media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}@supports (scroll-timeline-axis:block){html:not(:has([data-private-side-nav-header])) ._1kilgc9s{animation-timeline:--sNcst}html:not(:has([data-private-side-nav-header])) ._1m3lsjnm{animation-name:k1rswljm}html:not(:has([data-private-side-nav-header])) ._12g81hrf{animation-fill-mode:both}}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmpxbi{padding-inline-end:var(--ds-space-200,1pc)}@supports (scroll-timeline-axis:block){@keyframes k1rswljm{0%{box-shadow:inset 0 -1px 0 0 transparent}0.1%{box-shadow:inset 0 -1px 0 0 var(--ds-border,#0b120e24)}to{box-shadow:inset 0 -1px 0 0 var(--ds-border,#0b120e24)}}}}
|
|
17
17
|
@media (prefers-reduced-motion:no-preference) and (min-width:64rem){._n8qabrmi:after{transition-property:opacity}._wc72fnf5:after{transition-duration:.2s}._j3mr1v42:after{transition-timing-function:ease-in}}
|
|
@@ -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
|
|
|
@@ -30,8 +31,7 @@ const flexGap = "var(--ds-space-050, 4px)";
|
|
|
30
31
|
* which re-enables pointer events.
|
|
31
32
|
*/
|
|
32
33
|
const innerStyles = {
|
|
33
|
-
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris
|
|
34
|
-
jiraProductLogoUpdate: "_15rip2n4",
|
|
34
|
+
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris _15rip2n4 _1gs5usvi",
|
|
35
35
|
fullHeightSidebar: "_lcxv1wug",
|
|
36
36
|
fullHeightSidebarExpanded: "_15rin7od _glte1osq"
|
|
37
37
|
};
|
|
@@ -109,7 +109,7 @@ const TopNavStartInnerOld = /*#__PURE__*/forwardRef(function TopNavStartInner({
|
|
|
109
109
|
return /*#__PURE__*/React.createElement("div", {
|
|
110
110
|
ref: ref,
|
|
111
111
|
"data-testid": testId,
|
|
112
|
-
className: ax([innerStyles.root
|
|
112
|
+
className: ax([innerStyles.root])
|
|
113
113
|
}, children);
|
|
114
114
|
});
|
|
115
115
|
const TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS({
|
|
@@ -146,8 +146,10 @@ const TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS
|
|
|
146
146
|
}, /*#__PURE__*/React.createElement("div", {
|
|
147
147
|
ref: ref,
|
|
148
148
|
"data-testid": testId,
|
|
149
|
-
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar,
|
|
150
|
-
},
|
|
149
|
+
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar, isExpandedOnDesktop && innerStyles.fullHeightSidebarExpanded])
|
|
150
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
151
|
+
namespace: openLayerObserverTopNavStartNamespace
|
|
152
|
+
}, children) : children));
|
|
151
153
|
});
|
|
152
154
|
|
|
153
155
|
/**
|
|
@@ -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 = {
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
._lcxv1wug{pointer-events:auto}
|
|
10
10
|
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
11
11
|
@media (min-width:48rem){._181n1txw{display:flex}._1d2y1ris{min-width:max-content}}
|
|
12
|
-
@media (min-width:64rem){.
|
|
12
|
+
@media (min-width:64rem){._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._ndwch9n0{justify-self:end}}
|
|
@@ -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,9 +15,9 @@ 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
|
-
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris
|
|
19
|
-
jiraProductLogoUpdate: "_15rip2n4",
|
|
20
|
+
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0",
|
|
20
21
|
fullHeightSidebar: "_y4tiutpp _lcxv1wug",
|
|
21
22
|
fullHeightSidebarWithLayeringFixes: "_y4tiutpp"
|
|
22
23
|
};
|
|
@@ -25,6 +26,12 @@ var listStyles = {
|
|
|
25
26
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
26
27
|
popupContainer: "_1yt4u2gc"
|
|
27
28
|
};
|
|
29
|
+
function OpenLayerObserverNamespaceProviderBehindFG(_ref) {
|
|
30
|
+
var children = _ref.children;
|
|
31
|
+
return fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
32
|
+
namespace: openLayerObserverTopNavEndNamespace
|
|
33
|
+
}, children) : children;
|
|
34
|
+
}
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
* __TopNavEnd__
|
|
@@ -34,12 +41,12 @@ var listStyles = {
|
|
|
34
41
|
* On small viewports, the children will be placed inside a popup, and a button will be rendered to open the popup.
|
|
35
42
|
* This is to prevent the actions from overflowing the top navigation.
|
|
36
43
|
*/
|
|
37
|
-
export function TopNavEnd(
|
|
38
|
-
var children =
|
|
39
|
-
|
|
40
|
-
label =
|
|
41
|
-
|
|
42
|
-
showMoreButtonLabel =
|
|
44
|
+
export function TopNavEnd(_ref2) {
|
|
45
|
+
var children = _ref2.children,
|
|
46
|
+
_ref2$label = _ref2.label,
|
|
47
|
+
label = _ref2$label === void 0 ? 'Actions' : _ref2$label,
|
|
48
|
+
_ref2$showMoreButtonL = _ref2.showMoreButtonLabel,
|
|
49
|
+
showMoreButtonLabel = _ref2$showMoreButtonL === void 0 ? 'Show more' : _ref2$showMoreButtonL;
|
|
43
50
|
var isFhsEnabled = useIsFhsEnabled();
|
|
44
51
|
var _useState = useState(false),
|
|
45
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -65,7 +72,7 @@ export function TopNavEnd(_ref) {
|
|
|
65
72
|
}, [query]);
|
|
66
73
|
return /*#__PURE__*/React.createElement("nav", {
|
|
67
74
|
"aria-label": label,
|
|
68
|
-
className: ax([containerStyles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebar, isFhsEnabled && fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebarWithLayeringFixes
|
|
75
|
+
className: ax([containerStyles.root, isFhsEnabled && !fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebar, isFhsEnabled && fg('platform-dst-side-nav-layering-fixes') && containerStyles.fullHeightSidebarWithLayeringFixes])
|
|
69
76
|
}, isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
70
77
|
isOpen: isOpen,
|
|
71
78
|
onClose: function onClose() {
|
|
@@ -78,7 +85,7 @@ export function TopNavEnd(_ref) {
|
|
|
78
85
|
value: false
|
|
79
86
|
}, /*#__PURE__*/React.createElement(List, {
|
|
80
87
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
81
|
-
}, children));
|
|
88
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
82
89
|
},
|
|
83
90
|
trigger: function trigger(triggerProps) {
|
|
84
91
|
return /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
@@ -93,5 +100,5 @@ export function TopNavEnd(_ref) {
|
|
|
93
100
|
}
|
|
94
101
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
95
102
|
xcss: cx(listStyles.root, listStyles.hideOnSmallViewport)
|
|
96
|
-
}, children));
|
|
103
|
+
}, /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProviderBehindFG, null, children)));
|
|
97
104
|
}
|
|
@@ -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
|
}
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
._vchhusvi{box-sizing:border-box}
|
|
14
14
|
[dir=rtl] ._65m41mrw{--animation-direction:-1}
|
|
15
15
|
@media (prefers-reduced-motion:no-preference){._10t81e03{transition-property:transform}._10t81rjc{transition-property:transform,opacity}._1xq51ytf{transition-timing-function:ease-in-out}._1xq55ucs{transition-timing-function:ease}._mjvc1efy{transform:translateX(calc(100%*var(--animation-direction)))}._bgpzidpf{opacity:0}._mjvc1p9u{transform:translateX(calc(-100%*var(--animation-direction)))}._mjvco0k7{transform:translateX(calc((-2rem + var(--ds-space-050, 4px)*-1)*var(--animation-direction)))}._mjvcyrjp{transform:translateX(calc((2rem + var(--ds-space-050, 4px))*var(--animation-direction)))}._mjvcz12g{transform:translateX(0)}._xrrpfnf5{transition-duration:.2s}._bgpzkb7n{opacity:1}}
|
|
16
|
-
@media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}
|
|
16
|
+
@media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}@supports (scroll-timeline-axis:block){html:not(:has([data-private-side-nav-header])) ._1kilgc9s{animation-timeline:--sNcst}html:not(:has([data-private-side-nav-header])) ._1m3l1ybg{animation-name:khj1qz3}html:not(:has([data-private-side-nav-header])) ._12g81hrf{animation-fill-mode:both}}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmpxbi{padding-inline-end:var(--ds-space-200,1pc)}@supports (scroll-timeline-axis:block){@keyframes khj1qz3{0%{box-shadow:inset 0 -1px 0 0 transparent}0.1%{box-shadow:inset 0 -1px 0 0 var(--ds-border,#0b120e24)}to{box-shadow:inset 0 -1px 0 0 var(--ds-border,#0b120e24)}}}}
|
|
17
17
|
@media (prefers-reduced-motion:no-preference) and (min-width:64rem){._n8qabrmi:after{transition-property:opacity}._wc72fnf5:after{transition-duration:.2s}._j3mr1v42:after{transition-timing-function:ease-in}}
|
|
@@ -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
|
|
|
@@ -31,8 +32,7 @@ var flexGap = "var(--ds-space-050, 4px)";
|
|
|
31
32
|
* which re-enables pointer events.
|
|
32
33
|
*/
|
|
33
34
|
var innerStyles = {
|
|
34
|
-
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris
|
|
35
|
-
jiraProductLogoUpdate: "_15rip2n4",
|
|
35
|
+
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris _15rip2n4 _1gs5usvi",
|
|
36
36
|
fullHeightSidebar: "_lcxv1wug",
|
|
37
37
|
fullHeightSidebarExpanded: "_15rin7od _glte1osq"
|
|
38
38
|
};
|
|
@@ -109,7 +109,7 @@ var TopNavStartInnerOld = /*#__PURE__*/forwardRef(function TopNavStartInner(_ref
|
|
|
109
109
|
return /*#__PURE__*/React.createElement("div", {
|
|
110
110
|
ref: ref,
|
|
111
111
|
"data-testid": testId,
|
|
112
|
-
className: ax([innerStyles.root
|
|
112
|
+
className: ax([innerStyles.root])
|
|
113
113
|
}, children);
|
|
114
114
|
});
|
|
115
115
|
var TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS(_ref2, ref) {
|
|
@@ -144,8 +144,10 @@ var TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS(_
|
|
|
144
144
|
}, /*#__PURE__*/React.createElement("div", {
|
|
145
145
|
ref: ref,
|
|
146
146
|
"data-testid": testId,
|
|
147
|
-
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar,
|
|
148
|
-
},
|
|
147
|
+
className: ax([innerStyles.root, !fg('platform-dst-side-nav-layering-fixes') && innerStyles.fullHeightSidebar, isExpandedOnDesktop && innerStyles.fullHeightSidebarExpanded])
|
|
148
|
+
}, fg('platform-dst-side-nav-layering-fixes') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
149
|
+
namespace: openLayerObserverTopNavStartNamespace
|
|
150
|
+
}, children) : children));
|
|
149
151
|
});
|
|
150
152
|
|
|
151
153
|
/**
|
|
@@ -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
|
}
|