@atlaskit/navigation-system 2.7.0 → 2.8.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 +12 -0
- package/dist/cjs/ui/page-layout/side-nav/toggle-button-context.js +7 -2
- package/dist/cjs/ui/page-layout/side-nav/toggle-button-provider.js +13 -1
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.compiled.css +2 -1
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +18 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -2
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +45 -5
- package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -0
- package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.js +10 -6
- package/dist/es2019/ui/page-layout/side-nav/toggle-button-context.js +6 -1
- package/dist/es2019/ui/page-layout/side-nav/toggle-button-provider.js +14 -1
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.compiled.css +2 -1
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +19 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +41 -6
- package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -0
- package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.js +10 -6
- package/dist/esm/ui/page-layout/side-nav/toggle-button-context.js +6 -1
- package/dist/esm/ui/page-layout/side-nav/toggle-button-provider.js +13 -1
- package/dist/esm/ui/page-layout/side-nav/toggle-button.compiled.css +2 -1
- package/dist/esm/ui/page-layout/side-nav/toggle-button.js +19 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +45 -6
- package/dist/esm/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -0
- package/dist/esm/ui/top-nav-items/nav-logo/app-logo.js +10 -6
- package/dist/types/ui/page-layout/side-nav/toggle-button-context.d.ts +4 -0
- package/dist/types/ui/page-layout/side-nav/toggle-button-provider.d.ts +8 -0
- package/dist/types/ui/page-layout/top-nav/top-nav-start.d.ts +12 -1
- package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button-context.d.ts +4 -0
- package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button-provider.d.ts +8 -0
- package/dist/types-ts4.5/ui/page-layout/top-nav/top-nav-start.d.ts +12 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 2.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a515e172559b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a515e172559b8) -
|
|
8
|
+
Adds `sideNavToggleButton` slot to `TopNavStart` to be used instead of rendering
|
|
9
|
+
`<SideNavToggleButton>` as a child. When `navx-full-height-sidebar` is enabled, the slot is used
|
|
10
|
+
to move the button between start and end positions based on sidebar collapse state.
|
|
11
|
+
- [`a515e172559b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a515e172559b8) -
|
|
12
|
+
App logo text will now truncate if there is no available space, when `navx-full-height-sidebar` is
|
|
13
|
+
enabled.
|
|
14
|
+
|
|
3
15
|
## 2.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.SideNavToggleButtonElement = exports.SideNavToggleButtonAttachRef = void 0;
|
|
7
|
+
exports.SideNavToggleButtonSlotContext = exports.SideNavToggleButtonElement = exports.SideNavToggleButtonAttachRef = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
10
10
|
/**
|
|
@@ -23,4 +23,9 @@ var SideNavToggleButtonElement = exports.SideNavToggleButtonElement = /*#__PURE_
|
|
|
23
23
|
* A callback ref is needed because the side nav can be mounted before the elements in the top bar (e.g. if the element
|
|
24
24
|
* is lazy loaded, which happens in Jira and Confluence), which would prevent the event listeners from being set up.
|
|
25
25
|
*/
|
|
26
|
-
var SideNavToggleButtonAttachRef = exports.SideNavToggleButtonAttachRef = /*#__PURE__*/(0, _react.createContext)(_noop.default);
|
|
26
|
+
var SideNavToggleButtonAttachRef = exports.SideNavToggleButtonAttachRef = /*#__PURE__*/(0, _react.createContext)(_noop.default);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Used to check if the SideNavToggleButton is rendered inside of its slot in `TopNavStart`.
|
|
30
|
+
*/
|
|
31
|
+
var SideNavToggleButtonSlotContext = exports.SideNavToggleButtonSlotContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SideNavToggleButtonProvider = void 0;
|
|
8
|
+
exports.SideNavToggleButtonSlotProvider = exports.SideNavToggleButtonProvider = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _toggleButtonContext = require("./toggle-button-context");
|
|
@@ -34,4 +34,16 @@ var SideNavToggleButtonProvider = exports.SideNavToggleButtonProvider = function
|
|
|
34
34
|
}, /*#__PURE__*/_react.default.createElement(_toggleButtonContext.SideNavToggleButtonAttachRef.Provider, {
|
|
35
35
|
value: setElement
|
|
36
36
|
}, children));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Provider for the side nav toggle button slot.
|
|
41
|
+
*
|
|
42
|
+
* This allows us to determine if the toggle button is rendered inside or outside of its slot.
|
|
43
|
+
*/
|
|
44
|
+
var SideNavToggleButtonSlotProvider = exports.SideNavToggleButtonSlotProvider = function SideNavToggleButtonSlotProvider(_ref2) {
|
|
45
|
+
var children = _ref2.children;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_toggleButtonContext.SideNavToggleButtonSlotContext.Provider, {
|
|
47
|
+
value: true
|
|
48
|
+
}, children);
|
|
37
49
|
};
|
|
@@ -29,6 +29,12 @@ var toggleButtonTooltipOptions = {
|
|
|
29
29
|
// For duplicate "mouseenter" issue when changing icons (see below)
|
|
30
30
|
var silentIconStyles = null;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Wrapper styles to align the toggle button to the end of `TopNavStart`
|
|
34
|
+
* when FHS is expanded.
|
|
35
|
+
*/
|
|
36
|
+
var fullHeightSidebarExpandedWrapperStyles = null;
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* __SideNavToggleButton__
|
|
34
40
|
*
|
|
@@ -102,7 +108,7 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
102
108
|
className: (0, _runtime.ax)(["_1e0c1bgi _lcxvglyw"])
|
|
103
109
|
}, isSideNavExpanded ? /*#__PURE__*/_react.default.createElement(_sidebarCollapse.default, props) : /*#__PURE__*/_react.default.createElement(_sidebarExpand.default, props));
|
|
104
110
|
};
|
|
105
|
-
|
|
111
|
+
var iconButton = /*#__PURE__*/_react.default.createElement(_migration.IconButton, {
|
|
106
112
|
appearance: "subtle",
|
|
107
113
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
108
114
|
icon: icon,
|
|
@@ -113,4 +119,15 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
113
119
|
ref: (0, _platformFeatureFlags.fg)('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
114
120
|
tooltip: toggleButtonTooltipOptions
|
|
115
121
|
});
|
|
122
|
+
var isInsideSlot = (0, _react.useContext)(_toggleButtonContext.SideNavToggleButtonSlotContext);
|
|
123
|
+
|
|
124
|
+
// Checking `isInsideSlot` in case an app isn't using the slot
|
|
125
|
+
// We don't want to break existing non-slot usage with the left margin
|
|
126
|
+
// This check can be removed in the future, after slot is required for a while.
|
|
127
|
+
if (isInsideSlot && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar')) {
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
+
className: (0, _runtime.ax)([isSideNavExpandedOnDesktop && "_3l1a1wug"])
|
|
130
|
+
}, iconButton);
|
|
131
|
+
}
|
|
132
|
+
return iconButton;
|
|
116
133
|
};
|
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
._4t3i1osq{height:100%}
|
|
6
6
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
7
7
|
._lcxv1wug{pointer-events:auto}
|
|
8
|
-
.
|
|
9
|
-
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
8
|
+
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1osq{width:100%}._10jxnau3{max-width:calc(100% - var(--ds-space-200, 1pc))}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* top-nav-start.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
@@ -8,17 +9,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
9
|
exports.TopNavStart = TopNavStart;
|
|
9
10
|
require("./top-nav-start.compiled.css");
|
|
10
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
16
|
var _topNavStartContext = require("../../../context/top-nav-start/top-nav-start-context");
|
|
17
|
+
var _toggleButtonProvider = require("../side-nav/toggle-button-provider");
|
|
14
18
|
var _useSideNavVisibility2 = require("../side-nav/use-side-nav-visibility");
|
|
15
19
|
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); }
|
|
16
20
|
var styles = {
|
|
17
21
|
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris _15ri1mjv _1gs5usvi",
|
|
18
|
-
fullHeightSidebar: "
|
|
19
|
-
fullHeightSidebarExpanded: "_15rin7od"
|
|
22
|
+
fullHeightSidebar: "_bozgutpp _lcxv1wug",
|
|
23
|
+
fullHeightSidebarExpanded: "_15rin7od _glte1osq _10jxnau3"
|
|
20
24
|
};
|
|
21
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The consistent key used for the side nav toggle button to ensure it does not get remounted
|
|
28
|
+
* when it is reordered.
|
|
29
|
+
*
|
|
30
|
+
* This ensures we get focus restoration for free.
|
|
31
|
+
*/
|
|
32
|
+
var sideNavToggleButtonKey = 'side-nav-toggle-button';
|
|
33
|
+
|
|
22
34
|
/**
|
|
23
35
|
* __TopNavStart__
|
|
24
36
|
*
|
|
@@ -26,7 +38,8 @@ var styles = {
|
|
|
26
38
|
*/
|
|
27
39
|
function TopNavStart(_ref) {
|
|
28
40
|
var children = _ref.children,
|
|
29
|
-
testId = _ref.testId
|
|
41
|
+
testId = _ref.testId,
|
|
42
|
+
sideNavToggleButton = _ref.sideNavToggleButton;
|
|
30
43
|
var ref = (0, _react.useContext)(_topNavStartContext.TopNavStartAttachRef);
|
|
31
44
|
var elementRef = (0, _react.useRef)(null);
|
|
32
45
|
(0, _react.useEffect)(function () {
|
|
@@ -35,14 +48,41 @@ function TopNavStart(_ref) {
|
|
|
35
48
|
}
|
|
36
49
|
}, [elementRef, ref]);
|
|
37
50
|
|
|
38
|
-
//
|
|
51
|
+
// This needs the real `defaultCollapsed` state or will not SSR properly
|
|
52
|
+
// TODO: lift `defaultCollapsed` state to `Root` (DSP-23683)
|
|
53
|
+
// then context value will be correct in SSR / from initial render
|
|
39
54
|
var _useSideNavVisibility = (0, _useSideNavVisibility2.useSideNavVisibility)({
|
|
40
55
|
defaultCollapsed: true
|
|
41
56
|
}),
|
|
42
57
|
isExpandedOnDesktop = _useSideNavVisibility.isExpandedOnDesktop;
|
|
58
|
+
|
|
59
|
+
// For SSR assume desktop
|
|
60
|
+
var _useState = (0, _react.useState)(true),
|
|
61
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
62
|
+
isDesktop = _useState2[0],
|
|
63
|
+
setIsDesktop = _useState2[1];
|
|
64
|
+
// Set state to real value on client
|
|
65
|
+
// This could result in some visible shift on mobile when hydrating SSR
|
|
66
|
+
// TODO: review and improve SSR behavior as necessary (DSP-23817)
|
|
67
|
+
(0, _react.useLayoutEffect)(function () {
|
|
68
|
+
// Checking this to avoid breaking tests when `matchMedia` is not mocked
|
|
69
|
+
// Ideally we wouldn't cater to test environments, but this avoids introducing unnecessary friction
|
|
70
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
71
|
+
setIsDesktop(window.matchMedia('(min-width: 64rem)').matches);
|
|
72
|
+
}
|
|
73
|
+
}, []);
|
|
74
|
+
(0, _compiled.UNSAFE_useMediaQuery)('above.md', function (event) {
|
|
75
|
+
setIsDesktop(event.matches);
|
|
76
|
+
});
|
|
43
77
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
78
|
ref: (0, _platformFeatureFlags.fg)('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
45
79
|
"data-testid": testId,
|
|
46
80
|
className: (0, _runtime.ax)([styles.root, (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && styles.fullHeightSidebar, isExpandedOnDesktop && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && styles.fullHeightSidebarExpanded])
|
|
47
|
-
},
|
|
81
|
+
}, !(0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && /*#__PURE__*/_react.default.createElement(_toggleButtonProvider.SideNavToggleButtonSlotProvider, {
|
|
82
|
+
key: sideNavToggleButtonKey
|
|
83
|
+
}, sideNavToggleButton), sideNavToggleButton && (!isDesktop || !isExpandedOnDesktop) && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && /*#__PURE__*/_react.default.createElement(_toggleButtonProvider.SideNavToggleButtonSlotProvider, {
|
|
84
|
+
key: sideNavToggleButtonKey
|
|
85
|
+
}, sideNavToggleButton), children, sideNavToggleButton && isDesktop && isExpandedOnDesktop && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && /*#__PURE__*/_react.default.createElement(_toggleButtonProvider.SideNavToggleButtonSlotProvider, {
|
|
86
|
+
key: sideNavToggleButtonKey
|
|
87
|
+
}, sideNavToggleButton));
|
|
48
88
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
._1e0c1txw{display:flex}
|
|
6
6
|
._1e0cglyw{display:none}
|
|
7
7
|
._1o9zidpf{flex-shrink:0}
|
|
8
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
9
|
._1reo15vq{overflow-x:hidden}
|
|
9
10
|
._1toh1r31._1toh1r31{text-decoration-color:currentColor}
|
|
10
11
|
._1w901kw7._1w901kw7{color:inherit}
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
._5jyqglyw._5jyqglyw{text-decoration-line:none}
|
|
14
15
|
._ahbq1b66{margin-inline-start:var(--ds-space-050,4px)}
|
|
15
16
|
._mrqmnqa1._mrqmnqa1{text-decoration-style:solid}
|
|
17
|
+
._p12f1osq{max-width:100%}
|
|
16
18
|
._p12f1tcg{max-width:24px}
|
|
17
19
|
._p12fnklw{max-width:20pc}
|
|
18
20
|
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
@@ -11,6 +11,7 @@ require("./app-logo.compiled.css");
|
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _react2 = require("@compiled/react");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
15
16
|
var _primitives = require("@atlaskit/primitives");
|
|
16
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
@@ -24,13 +25,16 @@ var Text = (0, _platformFeatureFlagsReact.componentWithFG)('jfp-magma-hydration-
|
|
|
24
25
|
var anchorStyles = {
|
|
25
26
|
root: "_2rko19bv _1e0c1txw _4cvr1h6o _4t3izwfg _1o9zidpf _ahbq1b66 _1toh1r31 _5jyqglyw _mrqmnqa1 _1w901kw7",
|
|
26
27
|
interactionStates: "_irr3166n _1di61wwy",
|
|
27
|
-
interactionStatesCustomTheming: "_irr31rps _1di6yhlj"
|
|
28
|
+
interactionStatesCustomTheming: "_irr31rps _1di6yhlj",
|
|
29
|
+
fullHeightSidebar: "_1reo15vq _18m915vq _1o9zkb7n"
|
|
28
30
|
};
|
|
29
31
|
var logoWrapperStyles = {
|
|
30
|
-
root: "_18zr1b66"
|
|
32
|
+
root: "_18zr1b66",
|
|
33
|
+
fullHeightSidebar: "_p12f1osq"
|
|
31
34
|
};
|
|
32
35
|
var iconContainerStyles = {
|
|
33
|
-
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg"
|
|
36
|
+
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg",
|
|
37
|
+
fullHeightSidebar: "_1o9zidpf"
|
|
34
38
|
};
|
|
35
39
|
var logoTextStyles = {
|
|
36
40
|
root: "_1bsb1ris _p12fnklw _uiztglyw _y4tiv77o _1e0cglyw _10y418uv"
|
|
@@ -72,14 +76,14 @@ var AppLogo = exports.AppLogo = function AppLogo(_ref) {
|
|
|
72
76
|
// @ts-expect-error - non-standard values for `borderRadius` and the custom theming interaction states
|
|
73
77
|
// eslint-disable-next-line @compiled/no-suppress-xcss
|
|
74
78
|
,
|
|
75
|
-
xcss: (0, _react2.cx)(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates),
|
|
79
|
+
xcss: (0, _react2.cx)(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates, (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && anchorStyles.fullHeightSidebar),
|
|
76
80
|
onClick: onClick
|
|
77
81
|
}, /*#__PURE__*/_react.default.createElement(Inline, {
|
|
78
82
|
space: "space.075",
|
|
79
83
|
alignBlock: "center",
|
|
80
|
-
xcss: logoWrapperStyles.root
|
|
84
|
+
xcss: (0, _react2.cx)(logoWrapperStyles.root, (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && logoWrapperStyles.fullHeightSidebar)
|
|
81
85
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
-
className: (0, _runtime.ax)([iconContainerStyles.root])
|
|
86
|
+
className: (0, _runtime.ax)([iconContainerStyles.root, (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && iconContainerStyles.fullHeightSidebar])
|
|
83
87
|
}, /*#__PURE__*/_react.default.createElement(_logoRenderer.LogoRenderer
|
|
84
88
|
// Top nav always uses the new logo design
|
|
85
89
|
, {
|
|
@@ -16,4 +16,9 @@ export const SideNavToggleButtonElement = /*#__PURE__*/createContext(null);
|
|
|
16
16
|
* A callback ref is needed because the side nav can be mounted before the elements in the top bar (e.g. if the element
|
|
17
17
|
* is lazy loaded, which happens in Jira and Confluence), which would prevent the event listeners from being set up.
|
|
18
18
|
*/
|
|
19
|
-
export const SideNavToggleButtonAttachRef = /*#__PURE__*/createContext(__noop);
|
|
19
|
+
export const SideNavToggleButtonAttachRef = /*#__PURE__*/createContext(__noop);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Used to check if the SideNavToggleButton is rendered inside of its slot in `TopNavStart`.
|
|
23
|
+
*/
|
|
24
|
+
export const SideNavToggleButtonSlotContext = /*#__PURE__*/createContext(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { SideNavToggleButtonAttachRef, SideNavToggleButtonElement } from './toggle-button-context';
|
|
2
|
+
import { SideNavToggleButtonAttachRef, SideNavToggleButtonElement, SideNavToggleButtonSlotContext } from './toggle-button-context';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Provider for the side nav toggle button contexts.
|
|
@@ -23,4 +23,17 @@ export const SideNavToggleButtonProvider = ({
|
|
|
23
23
|
}, /*#__PURE__*/React.createElement(SideNavToggleButtonAttachRef.Provider, {
|
|
24
24
|
value: setElement
|
|
25
25
|
}, children));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Provider for the side nav toggle button slot.
|
|
30
|
+
*
|
|
31
|
+
* This allows us to determine if the toggle button is rendered inside or outside of its slot.
|
|
32
|
+
*/
|
|
33
|
+
export const SideNavToggleButtonSlotProvider = ({
|
|
34
|
+
children
|
|
35
|
+
}) => {
|
|
36
|
+
return /*#__PURE__*/React.createElement(SideNavToggleButtonSlotContext.Provider, {
|
|
37
|
+
value: true
|
|
38
|
+
}, children);
|
|
26
39
|
};
|
|
@@ -7,7 +7,7 @@ import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
|
7
7
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
10
|
-
import { SideNavToggleButtonAttachRef } from './toggle-button-context';
|
|
10
|
+
import { SideNavToggleButtonAttachRef, SideNavToggleButtonSlotContext } from './toggle-button-context';
|
|
11
11
|
import { useSideNavVisibility } from './use-side-nav-visibility';
|
|
12
12
|
import { useToggleSideNav } from './use-toggle-side-nav';
|
|
13
13
|
const toggleButtonTooltipOptions = {
|
|
@@ -19,6 +19,12 @@ const toggleButtonTooltipOptions = {
|
|
|
19
19
|
// For duplicate "mouseenter" issue when changing icons (see below)
|
|
20
20
|
const silentIconStyles = null;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Wrapper styles to align the toggle button to the end of `TopNavStart`
|
|
24
|
+
* when FHS is expanded.
|
|
25
|
+
*/
|
|
26
|
+
const fullHeightSidebarExpandedWrapperStyles = null;
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* __SideNavToggleButton__
|
|
24
30
|
*
|
|
@@ -89,7 +95,7 @@ export const SideNavToggleButton = ({
|
|
|
89
95
|
const icon = props => /*#__PURE__*/React.createElement("span", {
|
|
90
96
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
91
97
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
92
|
-
|
|
98
|
+
const iconButton = /*#__PURE__*/React.createElement(IconButton, {
|
|
93
99
|
appearance: "subtle",
|
|
94
100
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
95
101
|
icon: icon,
|
|
@@ -100,4 +106,15 @@ export const SideNavToggleButton = ({
|
|
|
100
106
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
101
107
|
tooltip: toggleButtonTooltipOptions
|
|
102
108
|
});
|
|
109
|
+
const isInsideSlot = useContext(SideNavToggleButtonSlotContext);
|
|
110
|
+
|
|
111
|
+
// Checking `isInsideSlot` in case an app isn't using the slot
|
|
112
|
+
// We don't want to break existing non-slot usage with the left margin
|
|
113
|
+
// This check can be removed in the future, after slot is required for a while.
|
|
114
|
+
if (isInsideSlot && fg('navx-full-height-sidebar')) {
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: ax([isSideNavExpandedOnDesktop && "_3l1a1wug"])
|
|
117
|
+
}, iconButton);
|
|
118
|
+
}
|
|
119
|
+
return iconButton;
|
|
103
120
|
};
|
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
._4t3i1osq{height:100%}
|
|
6
6
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
7
7
|
._lcxv1wug{pointer-events:auto}
|
|
8
|
-
.
|
|
9
|
-
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
8
|
+
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1osq{width:100%}._10jxnau3{max-width:calc(100% - var(--ds-space-200, 1pc))}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
/* top-nav-start.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./top-nav-start.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useContext, useEffect, useRef } from 'react';
|
|
4
|
+
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
6
7
|
import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
|
|
8
|
+
import { SideNavToggleButtonSlotProvider } from '../side-nav/toggle-button-provider';
|
|
7
9
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
8
10
|
const styles = {
|
|
9
11
|
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris _15ri1mjv _1gs5usvi",
|
|
10
|
-
fullHeightSidebar: "
|
|
11
|
-
fullHeightSidebarExpanded: "_15rin7od"
|
|
12
|
+
fullHeightSidebar: "_bozgutpp _lcxv1wug",
|
|
13
|
+
fullHeightSidebarExpanded: "_15rin7od _glte1osq _10jxnau3"
|
|
12
14
|
};
|
|
13
15
|
|
|
16
|
+
/**
|
|
17
|
+
* The consistent key used for the side nav toggle button to ensure it does not get remounted
|
|
18
|
+
* when it is reordered.
|
|
19
|
+
*
|
|
20
|
+
* This ensures we get focus restoration for free.
|
|
21
|
+
*/
|
|
22
|
+
const sideNavToggleButtonKey = 'side-nav-toggle-button';
|
|
23
|
+
|
|
14
24
|
/**
|
|
15
25
|
* __TopNavStart__
|
|
16
26
|
*
|
|
@@ -18,7 +28,8 @@ const styles = {
|
|
|
18
28
|
*/
|
|
19
29
|
export function TopNavStart({
|
|
20
30
|
children,
|
|
21
|
-
testId
|
|
31
|
+
testId,
|
|
32
|
+
sideNavToggleButton
|
|
22
33
|
}) {
|
|
23
34
|
const ref = useContext(TopNavStartAttachRef);
|
|
24
35
|
const elementRef = useRef(null);
|
|
@@ -28,15 +39,39 @@ export function TopNavStart({
|
|
|
28
39
|
}
|
|
29
40
|
}, [elementRef, ref]);
|
|
30
41
|
|
|
31
|
-
//
|
|
42
|
+
// This needs the real `defaultCollapsed` state or will not SSR properly
|
|
43
|
+
// TODO: lift `defaultCollapsed` state to `Root` (DSP-23683)
|
|
44
|
+
// then context value will be correct in SSR / from initial render
|
|
32
45
|
const {
|
|
33
46
|
isExpandedOnDesktop
|
|
34
47
|
} = useSideNavVisibility({
|
|
35
48
|
defaultCollapsed: true
|
|
36
49
|
});
|
|
50
|
+
|
|
51
|
+
// For SSR assume desktop
|
|
52
|
+
const [isDesktop, setIsDesktop] = useState(true);
|
|
53
|
+
// Set state to real value on client
|
|
54
|
+
// This could result in some visible shift on mobile when hydrating SSR
|
|
55
|
+
// TODO: review and improve SSR behavior as necessary (DSP-23817)
|
|
56
|
+
useLayoutEffect(() => {
|
|
57
|
+
// Checking this to avoid breaking tests when `matchMedia` is not mocked
|
|
58
|
+
// Ideally we wouldn't cater to test environments, but this avoids introducing unnecessary friction
|
|
59
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
60
|
+
setIsDesktop(window.matchMedia('(min-width: 64rem)').matches);
|
|
61
|
+
}
|
|
62
|
+
}, []);
|
|
63
|
+
UNSAFE_useMediaQuery('above.md', event => {
|
|
64
|
+
setIsDesktop(event.matches);
|
|
65
|
+
});
|
|
37
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
67
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
39
68
|
"data-testid": testId,
|
|
40
69
|
className: ax([styles.root, fg('navx-full-height-sidebar') && styles.fullHeightSidebar, isExpandedOnDesktop && fg('navx-full-height-sidebar') && styles.fullHeightSidebarExpanded])
|
|
41
|
-
},
|
|
70
|
+
}, !fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
71
|
+
key: sideNavToggleButtonKey
|
|
72
|
+
}, sideNavToggleButton), sideNavToggleButton && (!isDesktop || !isExpandedOnDesktop) && fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
73
|
+
key: sideNavToggleButtonKey
|
|
74
|
+
}, sideNavToggleButton), children, sideNavToggleButton && isDesktop && isExpandedOnDesktop && fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
75
|
+
key: sideNavToggleButtonKey
|
|
76
|
+
}, sideNavToggleButton));
|
|
42
77
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
._1e0c1txw{display:flex}
|
|
6
6
|
._1e0cglyw{display:none}
|
|
7
7
|
._1o9zidpf{flex-shrink:0}
|
|
8
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
9
|
._1reo15vq{overflow-x:hidden}
|
|
9
10
|
._1toh1r31._1toh1r31{text-decoration-color:currentColor}
|
|
10
11
|
._1w901kw7._1w901kw7{color:inherit}
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
._5jyqglyw._5jyqglyw{text-decoration-line:none}
|
|
14
15
|
._ahbq1b66{margin-inline-start:var(--ds-space-050,4px)}
|
|
15
16
|
._mrqmnqa1._mrqmnqa1{text-decoration-style:solid}
|
|
17
|
+
._p12f1osq{max-width:100%}
|
|
16
18
|
._p12f1tcg{max-width:24px}
|
|
17
19
|
._p12fnklw{max-width:20pc}
|
|
18
20
|
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
@@ -3,6 +3,7 @@ import "./app-logo.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useRef } from 'react';
|
|
5
5
|
import { cx } from '@compiled/react';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
7
8
|
import { Anchor as AnchorLegacy, Inline as InlineLegacy, Text as TextLegacy
|
|
8
9
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
@@ -17,13 +18,16 @@ const Text = componentWithFG('jfp-magma-hydration-harmonise-applogo-classname',
|
|
|
17
18
|
const anchorStyles = {
|
|
18
19
|
root: "_2rko19bv _1e0c1txw _4cvr1h6o _4t3izwfg _1o9zidpf _ahbq1b66 _1toh1r31 _5jyqglyw _mrqmnqa1 _1w901kw7",
|
|
19
20
|
interactionStates: "_irr3166n _1di61wwy",
|
|
20
|
-
interactionStatesCustomTheming: "_irr31rps _1di6yhlj"
|
|
21
|
+
interactionStatesCustomTheming: "_irr31rps _1di6yhlj",
|
|
22
|
+
fullHeightSidebar: "_1reo15vq _18m915vq _1o9zkb7n"
|
|
21
23
|
};
|
|
22
24
|
const logoWrapperStyles = {
|
|
23
|
-
root: "_18zr1b66"
|
|
25
|
+
root: "_18zr1b66",
|
|
26
|
+
fullHeightSidebar: "_p12f1osq"
|
|
24
27
|
};
|
|
25
28
|
const iconContainerStyles = {
|
|
26
|
-
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg"
|
|
29
|
+
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg",
|
|
30
|
+
fullHeightSidebar: "_1o9zidpf"
|
|
27
31
|
};
|
|
28
32
|
const logoTextStyles = {
|
|
29
33
|
root: "_1bsb1ris _p12fnklw _uiztglyw _y4tiv77o _1e0cglyw _10y418uv"
|
|
@@ -66,14 +70,14 @@ export const AppLogo = ({
|
|
|
66
70
|
// @ts-expect-error - non-standard values for `borderRadius` and the custom theming interaction states
|
|
67
71
|
// eslint-disable-next-line @compiled/no-suppress-xcss
|
|
68
72
|
,
|
|
69
|
-
xcss: cx(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates),
|
|
73
|
+
xcss: cx(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates, fg('navx-full-height-sidebar') && anchorStyles.fullHeightSidebar),
|
|
70
74
|
onClick: onClick
|
|
71
75
|
}, /*#__PURE__*/React.createElement(Inline, {
|
|
72
76
|
space: "space.075",
|
|
73
77
|
alignBlock: "center",
|
|
74
|
-
xcss: logoWrapperStyles.root
|
|
78
|
+
xcss: cx(logoWrapperStyles.root, fg('navx-full-height-sidebar') && logoWrapperStyles.fullHeightSidebar)
|
|
75
79
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: ax([iconContainerStyles.root])
|
|
80
|
+
className: ax([iconContainerStyles.root, fg('navx-full-height-sidebar') && iconContainerStyles.fullHeightSidebar])
|
|
77
81
|
}, /*#__PURE__*/React.createElement(LogoRenderer
|
|
78
82
|
// Top nav always uses the new logo design
|
|
79
83
|
, {
|
|
@@ -16,4 +16,9 @@ export var SideNavToggleButtonElement = /*#__PURE__*/createContext(null);
|
|
|
16
16
|
* A callback ref is needed because the side nav can be mounted before the elements in the top bar (e.g. if the element
|
|
17
17
|
* is lazy loaded, which happens in Jira and Confluence), which would prevent the event listeners from being set up.
|
|
18
18
|
*/
|
|
19
|
-
export var SideNavToggleButtonAttachRef = /*#__PURE__*/createContext(__noop);
|
|
19
|
+
export var SideNavToggleButtonAttachRef = /*#__PURE__*/createContext(__noop);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Used to check if the SideNavToggleButton is rendered inside of its slot in `TopNavStart`.
|
|
23
|
+
*/
|
|
24
|
+
export var SideNavToggleButtonSlotContext = /*#__PURE__*/createContext(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { SideNavToggleButtonAttachRef, SideNavToggleButtonElement } from './toggle-button-context';
|
|
3
|
+
import { SideNavToggleButtonAttachRef, SideNavToggleButtonElement, SideNavToggleButtonSlotContext } from './toggle-button-context';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provider for the side nav toggle button contexts.
|
|
@@ -26,4 +26,16 @@ export var SideNavToggleButtonProvider = function SideNavToggleButtonProvider(_r
|
|
|
26
26
|
}, /*#__PURE__*/React.createElement(SideNavToggleButtonAttachRef.Provider, {
|
|
27
27
|
value: setElement
|
|
28
28
|
}, children));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Provider for the side nav toggle button slot.
|
|
33
|
+
*
|
|
34
|
+
* This allows us to determine if the toggle button is rendered inside or outside of its slot.
|
|
35
|
+
*/
|
|
36
|
+
export var SideNavToggleButtonSlotProvider = function SideNavToggleButtonSlotProvider(_ref2) {
|
|
37
|
+
var children = _ref2.children;
|
|
38
|
+
return /*#__PURE__*/React.createElement(SideNavToggleButtonSlotContext.Provider, {
|
|
39
|
+
value: true
|
|
40
|
+
}, children);
|
|
29
41
|
};
|
|
@@ -8,7 +8,7 @@ import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
|
8
8
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
11
|
-
import { SideNavToggleButtonAttachRef } from './toggle-button-context';
|
|
11
|
+
import { SideNavToggleButtonAttachRef, SideNavToggleButtonSlotContext } from './toggle-button-context';
|
|
12
12
|
import { useSideNavVisibility } from './use-side-nav-visibility';
|
|
13
13
|
import { useToggleSideNav } from './use-toggle-side-nav';
|
|
14
14
|
var toggleButtonTooltipOptions = {
|
|
@@ -20,6 +20,12 @@ var toggleButtonTooltipOptions = {
|
|
|
20
20
|
// For duplicate "mouseenter" issue when changing icons (see below)
|
|
21
21
|
var silentIconStyles = null;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Wrapper styles to align the toggle button to the end of `TopNavStart`
|
|
25
|
+
* when FHS is expanded.
|
|
26
|
+
*/
|
|
27
|
+
var fullHeightSidebarExpandedWrapperStyles = null;
|
|
28
|
+
|
|
23
29
|
/**
|
|
24
30
|
* __SideNavToggleButton__
|
|
25
31
|
*
|
|
@@ -93,7 +99,7 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
93
99
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
94
100
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
95
101
|
};
|
|
96
|
-
|
|
102
|
+
var iconButton = /*#__PURE__*/React.createElement(IconButton, {
|
|
97
103
|
appearance: "subtle",
|
|
98
104
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
99
105
|
icon: icon,
|
|
@@ -104,4 +110,15 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
104
110
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
105
111
|
tooltip: toggleButtonTooltipOptions
|
|
106
112
|
});
|
|
113
|
+
var isInsideSlot = useContext(SideNavToggleButtonSlotContext);
|
|
114
|
+
|
|
115
|
+
// Checking `isInsideSlot` in case an app isn't using the slot
|
|
116
|
+
// We don't want to break existing non-slot usage with the left margin
|
|
117
|
+
// This check can be removed in the future, after slot is required for a while.
|
|
118
|
+
if (isInsideSlot && fg('navx-full-height-sidebar')) {
|
|
119
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: ax([isSideNavExpandedOnDesktop && "_3l1a1wug"])
|
|
121
|
+
}, iconButton);
|
|
122
|
+
}
|
|
123
|
+
return iconButton;
|
|
107
124
|
};
|
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
._4t3i1osq{height:100%}
|
|
6
6
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
7
7
|
._lcxv1wug{pointer-events:auto}
|
|
8
|
-
.
|
|
9
|
-
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
8
|
+
@media (min-width:64rem){._15rin7od{min-width:unset}._glte1osq{width:100%}._10jxnau3{max-width:calc(100% - var(--ds-space-200, 1pc))}._glte1ris{width:max-content}._15ri1mjv{min-width:300px}._1gs5usvi{box-sizing:border-box}}
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/* top-nav-start.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import "./top-nav-start.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useContext, useEffect, useRef } from 'react';
|
|
5
|
+
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
6
8
|
import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
|
|
9
|
+
import { SideNavToggleButtonSlotProvider } from '../side-nav/toggle-button-provider';
|
|
7
10
|
import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
|
|
8
11
|
var styles = {
|
|
9
12
|
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw _glte1ris _15ri1mjv _1gs5usvi",
|
|
10
|
-
fullHeightSidebar: "
|
|
11
|
-
fullHeightSidebarExpanded: "_15rin7od"
|
|
13
|
+
fullHeightSidebar: "_bozgutpp _lcxv1wug",
|
|
14
|
+
fullHeightSidebarExpanded: "_15rin7od _glte1osq _10jxnau3"
|
|
12
15
|
};
|
|
13
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The consistent key used for the side nav toggle button to ensure it does not get remounted
|
|
19
|
+
* when it is reordered.
|
|
20
|
+
*
|
|
21
|
+
* This ensures we get focus restoration for free.
|
|
22
|
+
*/
|
|
23
|
+
var sideNavToggleButtonKey = 'side-nav-toggle-button';
|
|
24
|
+
|
|
14
25
|
/**
|
|
15
26
|
* __TopNavStart__
|
|
16
27
|
*
|
|
@@ -18,7 +29,8 @@ var styles = {
|
|
|
18
29
|
*/
|
|
19
30
|
export function TopNavStart(_ref) {
|
|
20
31
|
var children = _ref.children,
|
|
21
|
-
testId = _ref.testId
|
|
32
|
+
testId = _ref.testId,
|
|
33
|
+
sideNavToggleButton = _ref.sideNavToggleButton;
|
|
22
34
|
var ref = useContext(TopNavStartAttachRef);
|
|
23
35
|
var elementRef = useRef(null);
|
|
24
36
|
useEffect(function () {
|
|
@@ -27,14 +39,41 @@ export function TopNavStart(_ref) {
|
|
|
27
39
|
}
|
|
28
40
|
}, [elementRef, ref]);
|
|
29
41
|
|
|
30
|
-
//
|
|
42
|
+
// This needs the real `defaultCollapsed` state or will not SSR properly
|
|
43
|
+
// TODO: lift `defaultCollapsed` state to `Root` (DSP-23683)
|
|
44
|
+
// then context value will be correct in SSR / from initial render
|
|
31
45
|
var _useSideNavVisibility = useSideNavVisibility({
|
|
32
46
|
defaultCollapsed: true
|
|
33
47
|
}),
|
|
34
48
|
isExpandedOnDesktop = _useSideNavVisibility.isExpandedOnDesktop;
|
|
49
|
+
|
|
50
|
+
// For SSR assume desktop
|
|
51
|
+
var _useState = useState(true),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
isDesktop = _useState2[0],
|
|
54
|
+
setIsDesktop = _useState2[1];
|
|
55
|
+
// Set state to real value on client
|
|
56
|
+
// This could result in some visible shift on mobile when hydrating SSR
|
|
57
|
+
// TODO: review and improve SSR behavior as necessary (DSP-23817)
|
|
58
|
+
useLayoutEffect(function () {
|
|
59
|
+
// Checking this to avoid breaking tests when `matchMedia` is not mocked
|
|
60
|
+
// Ideally we wouldn't cater to test environments, but this avoids introducing unnecessary friction
|
|
61
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
62
|
+
setIsDesktop(window.matchMedia('(min-width: 64rem)').matches);
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
UNSAFE_useMediaQuery('above.md', function (event) {
|
|
66
|
+
setIsDesktop(event.matches);
|
|
67
|
+
});
|
|
35
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
69
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
37
70
|
"data-testid": testId,
|
|
38
71
|
className: ax([styles.root, fg('navx-full-height-sidebar') && styles.fullHeightSidebar, isExpandedOnDesktop && fg('navx-full-height-sidebar') && styles.fullHeightSidebarExpanded])
|
|
39
|
-
},
|
|
72
|
+
}, !fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
73
|
+
key: sideNavToggleButtonKey
|
|
74
|
+
}, sideNavToggleButton), sideNavToggleButton && (!isDesktop || !isExpandedOnDesktop) && fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
75
|
+
key: sideNavToggleButtonKey
|
|
76
|
+
}, sideNavToggleButton), children, sideNavToggleButton && isDesktop && isExpandedOnDesktop && fg('navx-full-height-sidebar') && /*#__PURE__*/React.createElement(SideNavToggleButtonSlotProvider, {
|
|
77
|
+
key: sideNavToggleButtonKey
|
|
78
|
+
}, sideNavToggleButton));
|
|
40
79
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
._1e0c1txw{display:flex}
|
|
6
6
|
._1e0cglyw{display:none}
|
|
7
7
|
._1o9zidpf{flex-shrink:0}
|
|
8
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
9
|
._1reo15vq{overflow-x:hidden}
|
|
9
10
|
._1toh1r31._1toh1r31{text-decoration-color:currentColor}
|
|
10
11
|
._1w901kw7._1w901kw7{color:inherit}
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
._5jyqglyw._5jyqglyw{text-decoration-line:none}
|
|
14
15
|
._ahbq1b66{margin-inline-start:var(--ds-space-050,4px)}
|
|
15
16
|
._mrqmnqa1._mrqmnqa1{text-decoration-style:solid}
|
|
17
|
+
._p12f1osq{max-width:100%}
|
|
16
18
|
._p12f1tcg{max-width:24px}
|
|
17
19
|
._p12fnklw{max-width:20pc}
|
|
18
20
|
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
@@ -3,6 +3,7 @@ import "./app-logo.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useRef } from 'react';
|
|
5
5
|
import { cx } from '@compiled/react';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
7
8
|
import { Anchor as AnchorLegacy, Inline as InlineLegacy, Text as TextLegacy
|
|
8
9
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
@@ -17,13 +18,16 @@ var Text = componentWithFG('jfp-magma-hydration-harmonise-applogo-classname', Te
|
|
|
17
18
|
var anchorStyles = {
|
|
18
19
|
root: "_2rko19bv _1e0c1txw _4cvr1h6o _4t3izwfg _1o9zidpf _ahbq1b66 _1toh1r31 _5jyqglyw _mrqmnqa1 _1w901kw7",
|
|
19
20
|
interactionStates: "_irr3166n _1di61wwy",
|
|
20
|
-
interactionStatesCustomTheming: "_irr31rps _1di6yhlj"
|
|
21
|
+
interactionStatesCustomTheming: "_irr31rps _1di6yhlj",
|
|
22
|
+
fullHeightSidebar: "_1reo15vq _18m915vq _1o9zkb7n"
|
|
21
23
|
};
|
|
22
24
|
var logoWrapperStyles = {
|
|
23
|
-
root: "_18zr1b66"
|
|
25
|
+
root: "_18zr1b66",
|
|
26
|
+
fullHeightSidebar: "_p12f1osq"
|
|
24
27
|
};
|
|
25
28
|
var iconContainerStyles = {
|
|
26
|
-
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg"
|
|
29
|
+
root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg",
|
|
30
|
+
fullHeightSidebar: "_1o9zidpf"
|
|
27
31
|
};
|
|
28
32
|
var logoTextStyles = {
|
|
29
33
|
root: "_1bsb1ris _p12fnklw _uiztglyw _y4tiv77o _1e0cglyw _10y418uv"
|
|
@@ -65,14 +69,14 @@ export var AppLogo = function AppLogo(_ref) {
|
|
|
65
69
|
// @ts-expect-error - non-standard values for `borderRadius` and the custom theming interaction states
|
|
66
70
|
// eslint-disable-next-line @compiled/no-suppress-xcss
|
|
67
71
|
,
|
|
68
|
-
xcss: cx(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates),
|
|
72
|
+
xcss: cx(anchorStyles.root, hasCustomTheme ? anchorStyles.interactionStatesCustomTheming : anchorStyles.interactionStates, fg('navx-full-height-sidebar') && anchorStyles.fullHeightSidebar),
|
|
69
73
|
onClick: onClick
|
|
70
74
|
}, /*#__PURE__*/React.createElement(Inline, {
|
|
71
75
|
space: "space.075",
|
|
72
76
|
alignBlock: "center",
|
|
73
|
-
xcss: logoWrapperStyles.root
|
|
77
|
+
xcss: cx(logoWrapperStyles.root, fg('navx-full-height-sidebar') && logoWrapperStyles.fullHeightSidebar)
|
|
74
78
|
}, /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
className: ax([iconContainerStyles.root])
|
|
79
|
+
className: ax([iconContainerStyles.root, fg('navx-full-height-sidebar') && iconContainerStyles.fullHeightSidebar])
|
|
76
80
|
}, /*#__PURE__*/React.createElement(LogoRenderer
|
|
77
81
|
// Top nav always uses the new logo design
|
|
78
82
|
, {
|
|
@@ -14,3 +14,7 @@ export declare const SideNavToggleButtonElement: import("react").Context<HTMLBut
|
|
|
14
14
|
* is lazy loaded, which happens in Jira and Confluence), which would prevent the event listeners from being set up.
|
|
15
15
|
*/
|
|
16
16
|
export declare const SideNavToggleButtonAttachRef: import("react").Context<(newVal: HTMLButtonElement | null) => void>;
|
|
17
|
+
/**
|
|
18
|
+
* Used to check if the SideNavToggleButton is rendered inside of its slot in `TopNavStart`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SideNavToggleButtonSlotContext: import("react").Context<boolean>;
|
|
@@ -15,3 +15,11 @@ import React from 'react';
|
|
|
15
15
|
export declare const SideNavToggleButtonProvider: ({ children }: {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
}) => React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Provider for the side nav toggle button slot.
|
|
20
|
+
*
|
|
21
|
+
* This allows us to determine if the toggle button is rendered inside or outside of its slot.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SideNavToggleButtonSlotProvider: ({ children }: {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}) => React.JSX.Element;
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* Wrapper for the top navigation actions on the inline-start (left) side of the top navigation.
|
|
10
10
|
*/
|
|
11
|
-
export declare function TopNavStart({ children, testId, }: {
|
|
11
|
+
export declare function TopNavStart({ children, testId, sideNavToggleButton, }: {
|
|
12
12
|
/**
|
|
13
13
|
* The content of the layout area.
|
|
14
14
|
*
|
|
@@ -19,4 +19,15 @@ export declare function TopNavStart({ children, testId, }: {
|
|
|
19
19
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
20
20
|
*/
|
|
21
21
|
testId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Slot for the side nav toggle button.
|
|
24
|
+
*
|
|
25
|
+
* You should only render `<SideNavToggleButton>` inside this slot, not as a child.
|
|
26
|
+
*
|
|
27
|
+
* After `platform_dst_nav4_full_height_sidebar_api_changes` rolls out,
|
|
28
|
+
* this prop will become required.
|
|
29
|
+
*
|
|
30
|
+
* Consumers that do not need a toggle button can explicitly pass `null`.
|
|
31
|
+
*/
|
|
32
|
+
sideNavToggleButton?: React.ReactNode;
|
|
22
33
|
}): JSX.Element;
|
|
@@ -14,3 +14,7 @@ export declare const SideNavToggleButtonElement: import("react").Context<HTMLBut
|
|
|
14
14
|
* is lazy loaded, which happens in Jira and Confluence), which would prevent the event listeners from being set up.
|
|
15
15
|
*/
|
|
16
16
|
export declare const SideNavToggleButtonAttachRef: import("react").Context<(newVal: HTMLButtonElement | null) => void>;
|
|
17
|
+
/**
|
|
18
|
+
* Used to check if the SideNavToggleButton is rendered inside of its slot in `TopNavStart`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SideNavToggleButtonSlotContext: import("react").Context<boolean>;
|
|
@@ -15,3 +15,11 @@ import React from 'react';
|
|
|
15
15
|
export declare const SideNavToggleButtonProvider: ({ children }: {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
}) => React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Provider for the side nav toggle button slot.
|
|
20
|
+
*
|
|
21
|
+
* This allows us to determine if the toggle button is rendered inside or outside of its slot.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SideNavToggleButtonSlotProvider: ({ children }: {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}) => React.JSX.Element;
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* Wrapper for the top navigation actions on the inline-start (left) side of the top navigation.
|
|
10
10
|
*/
|
|
11
|
-
export declare function TopNavStart({ children, testId, }: {
|
|
11
|
+
export declare function TopNavStart({ children, testId, sideNavToggleButton, }: {
|
|
12
12
|
/**
|
|
13
13
|
* The content of the layout area.
|
|
14
14
|
*
|
|
@@ -19,4 +19,15 @@ export declare function TopNavStart({ children, testId, }: {
|
|
|
19
19
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
20
20
|
*/
|
|
21
21
|
testId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Slot for the side nav toggle button.
|
|
24
|
+
*
|
|
25
|
+
* You should only render `<SideNavToggleButton>` inside this slot, not as a child.
|
|
26
|
+
*
|
|
27
|
+
* After `platform_dst_nav4_full_height_sidebar_api_changes` rolls out,
|
|
28
|
+
* this prop will become required.
|
|
29
|
+
*
|
|
30
|
+
* Consumers that do not need a toggle button can explicitly pass `null`.
|
|
31
|
+
*/
|
|
32
|
+
sideNavToggleButton?: React.ReactNode;
|
|
22
33
|
}): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.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",
|
|
@@ -186,6 +186,9 @@
|
|
|
186
186
|
"navx-full-height-sidebar": {
|
|
187
187
|
"type": "boolean"
|
|
188
188
|
},
|
|
189
|
+
"platform_dst_nav4_full_height_sidebar_api_changes": {
|
|
190
|
+
"type": "boolean"
|
|
191
|
+
},
|
|
189
192
|
"platform_dst_nav4_menu_section_heading_a11y": {
|
|
190
193
|
"type": "boolean"
|
|
191
194
|
},
|