@atlaskit/navigation-system 5.0.1 → 5.1.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 +40 -0
- package/constellation/layout/examples.mdx +8 -7
- package/dist/cjs/entry-points/layout/side-nav.js +8 -1
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +4 -3
- package/dist/cjs/ui/page-layout/side-nav/side-nav-content.compiled.css +6 -3
- package/dist/cjs/ui/page-layout/side-nav/side-nav-content.js +14 -37
- package/dist/es2019/entry-points/layout/side-nav.js +2 -1
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +4 -3
- package/dist/es2019/ui/page-layout/side-nav/side-nav-content.compiled.css +6 -3
- package/dist/es2019/ui/page-layout/side-nav/side-nav-content.js +15 -34
- package/dist/esm/entry-points/layout/side-nav.js +2 -1
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +4 -3
- package/dist/esm/ui/page-layout/side-nav/side-nav-content.compiled.css +6 -3
- package/dist/esm/ui/page-layout/side-nav/side-nav-content.js +15 -38
- package/dist/types/entry-points/layout/side-nav.d.ts +1 -0
- package/dist/types/ui/page-layout/panel-splitter/panel-splitter.d.ts +4 -3
- package/dist/types-ts4.5/entry-points/layout/side-nav.d.ts +1 -0
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/panel-splitter.d.ts +4 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`03b6f055c6340`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/03b6f055c6340) -
|
|
8
|
+
The `SideNavPanelSplitter` component is now exported from
|
|
9
|
+
`@atlaskit/navigation-system/layout/side-nav`. It should be used within the `SideNav` layout area.
|
|
10
|
+
|
|
11
|
+
It supports double clicking to collapse the side nav. You can conditionally disable this through
|
|
12
|
+
the `shouldCollapseOnDoubleClick` prop. It is enabled by default.
|
|
13
|
+
|
|
14
|
+
It also supports displaying a tooltip when hovered, through the `tooltipContent` prop. This should
|
|
15
|
+
be used to explain the double click to collapse interaction. The recommended tooltip content is
|
|
16
|
+
"Double click to collapse".
|
|
17
|
+
|
|
18
|
+
A tooltip will only be displayed if the `shouldCollapseOnDoubleClick` prop is `true`, or not
|
|
19
|
+
provided (as it defaults to `true`), and if the `tooltipContent` prop is provided.
|
|
20
|
+
|
|
21
|
+
If the `isSideNavShortcutEnabled` prop is enabled on `<Root />`, the built-in keyboard shortcut
|
|
22
|
+
will be displayed with the tooltip.
|
|
23
|
+
|
|
24
|
+
Example usage:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { SideNav, SideNavPanelSplitter } from '@atlaskit/navigation-system/layout/side-nav';
|
|
28
|
+
|
|
29
|
+
// In component:
|
|
30
|
+
<SideNav>
|
|
31
|
+
<SideNavPanelSplitter label="Double click to collapse" />
|
|
32
|
+
</SideNav>;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 5.0.2
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- [`bb5f1424b34de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb5f1424b34de) -
|
|
40
|
+
[ux] Fixes the scrolled indicator in SideNavContent to set initial state for SSR'd scroll
|
|
41
|
+
position. Behind the `navx-full-height-sidebar` gate.
|
|
42
|
+
|
|
3
43
|
## 5.0.1
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
|
@@ -125,13 +125,14 @@ See the [interactive example (Atlassians only)](https://go.atlassian.com/nav4-in
|
|
|
125
125
|
|
|
126
126
|
#### Side nav resizing
|
|
127
127
|
|
|
128
|
-
- You can optionally render a
|
|
129
|
-
resizable. It is resized using the drag handle. When hovering on the drag handle the
|
|
130
|
-
changes to a resize pointer.
|
|
128
|
+
- You can optionally render a [side nav panel splitter](#resizable-areas) as a child to make the
|
|
129
|
+
side nav resizable. It is resized using the drag handle. When hovering on the drag handle the
|
|
130
|
+
mouse pointer changes to a resize pointer.
|
|
131
131
|
- The side nav can be resized to a minimum width of 240px, and a maximum width equal to 50% of the
|
|
132
132
|
total viewport width. It retains this resized width even after collapsing, reopening, or
|
|
133
133
|
refreshing the page. When resizing, any open layer components (e.g. popups, dropdowns, selects,
|
|
134
134
|
tooltips) will be closed.
|
|
135
|
+
- The side nav panel splitter can be also double clicked to collapse the side nav.
|
|
135
136
|
|
|
136
137
|
See the [interactive example (Atlassians only)](https://go.atlassian.com/nav4-interactive-example).
|
|
137
138
|
|
|
@@ -230,13 +231,13 @@ See the [interactive example (Atlassians only)](https://go.atlassian.com/nav4-in
|
|
|
230
231
|
|
|
231
232
|
## Resizable areas
|
|
232
233
|
|
|
233
|
-
Render `PanelSplitter` in a layout area to make it resizable.
|
|
234
|
+
Render a `PanelSplitter` in a layout area to make it resizable.
|
|
234
235
|
|
|
235
236
|
Resizing is supported for the following areas:
|
|
236
237
|
|
|
237
|
-
- [SideNav](/components/navigation-system/layout/examples#side-nav)
|
|
238
|
-
- [Aside](/components/navigation-system/layout/examples#aside)
|
|
239
|
-
- [Panel](/components/navigation-system/layout/examples#panel)
|
|
238
|
+
- [SideNav](/components/navigation-system/layout/examples#side-nav) - use `SideNavPanelSplitter`
|
|
239
|
+
- [Aside](/components/navigation-system/layout/examples#aside) - use `PanelSplitter`
|
|
240
|
+
- [Panel](/components/navigation-system/layout/examples#panel) - use `PanelSplitter`
|
|
240
241
|
|
|
241
242
|
See the [interactive example (Atlassians only)](https://go.atlassian.com/nav4-interactive-example).
|
|
242
243
|
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "SideNavHeader", {
|
|
|
27
27
|
return _sideNavHeader.SideNavHeader;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "SideNavPanelSplitter", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _sideNavPanelSplitter.SideNavPanelSplitter;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "SideNavToggleButton", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
@@ -51,4 +57,5 @@ var _sideNavContent = require("../../ui/page-layout/side-nav/side-nav-content");
|
|
|
51
57
|
var _sideNavFooter = require("../../ui/page-layout/side-nav/side-nav-footer");
|
|
52
58
|
var _toggleButton = require("../../ui/page-layout/side-nav/toggle-button");
|
|
53
59
|
var _useToggleSideNav = require("../../ui/page-layout/side-nav/use-toggle-side-nav");
|
|
54
|
-
var _useExpandSideNav = require("../../ui/page-layout/side-nav/use-expand-side-nav");
|
|
60
|
+
var _useExpandSideNav = require("../../ui/page-layout/side-nav/use-expand-side-nav");
|
|
61
|
+
var _sideNavPanelSplitter = require("../../ui/page-layout/panel-splitter/side-nav-panel-splitter");
|
|
@@ -332,10 +332,11 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
332
332
|
* _PanelSplitter_
|
|
333
333
|
*
|
|
334
334
|
* A component that allows the user to resize a layout area.
|
|
335
|
-
* It can be used within layout areas like `
|
|
336
|
-
*
|
|
335
|
+
* It can be used within layout areas like `Panel`, and `Aside`.
|
|
336
|
+
* For the `SideNav`, use the `SideNavPanelSplitter` component instead, as it provides additional functionality
|
|
337
|
+
* such as double clicking to collapse the side nav.
|
|
337
338
|
*
|
|
338
|
-
* Example usage
|
|
339
|
+
* Example usage:
|
|
339
340
|
* ```tsx
|
|
340
341
|
* <Aside>
|
|
341
342
|
* <!-- other side nav content -->
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
.
|
|
1
|
+
|
|
2
|
+
._1un9baqb{scroll-timeline:--sNcst block}._16jlkb7n{flex-grow:1}
|
|
3
3
|
._18m91wug{overflow-y:auto}
|
|
4
4
|
._1o9zkb7n{flex-shrink:1}
|
|
5
5
|
._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
|
|
6
6
|
._1reo1wug{overflow-x:auto}
|
|
7
|
+
._21o1gc9s{animation-timeline:--sNcst}
|
|
7
8
|
._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
|
|
8
9
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
9
10
|
._i0dlf1ug{flex-basis:0%}
|
|
10
|
-
.
|
|
11
|
+
._j7hq1ysc{animation-name:kewh7qa}
|
|
12
|
+
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
13
|
+
@keyframes kewh7qa{0%{box-shadow:none}0.1%{box-shadow:0 -1px var(--ds-border,#091e4224)}to{box-shadow:0 -1px var(--ds-border,#091e4224)}}
|
|
@@ -9,10 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.SideNavContent = void 0;
|
|
10
10
|
require("./side-nav-content.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
-
var _bindEventListener = require("bind-event-listener");
|
|
15
|
-
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
16
13
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
17
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -29,8 +26,20 @@ var styles = {
|
|
|
29
26
|
scrollContainer: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo1wug _18m91wug",
|
|
30
27
|
paddingContainer: "_1q51utpp _y4tiutpp _85i5utpp _bozgutpp"
|
|
31
28
|
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Using CSS scroll-driven animations to apply a scrolled indicator border.
|
|
32
|
+
*
|
|
33
|
+
* This approach is better for SSR, as some apps like Confluence will apply the
|
|
34
|
+
* initial scroll position of the side nav content using JS before hydration.
|
|
35
|
+
*
|
|
36
|
+
* If we applied the border through React state it would only appear after hydration,
|
|
37
|
+
* whereas this CSS approach should show even before hydration.
|
|
38
|
+
*/
|
|
39
|
+
var scrolledBorder = null;
|
|
40
|
+
var scrollTimelineVar = '--sNcst';
|
|
32
41
|
var fullHeightSidebarStyles = {
|
|
33
|
-
|
|
42
|
+
scrollContainer: "_1un9baqb _21o1gc9s _j7hq1ysc"
|
|
34
43
|
};
|
|
35
44
|
function _SideNavContent(_ref, forwardedRef) {
|
|
36
45
|
var children = _ref.children,
|
|
@@ -39,43 +48,11 @@ function _SideNavContent(_ref, forwardedRef) {
|
|
|
39
48
|
var mergedRef = (0, _react.useMemo)(function () {
|
|
40
49
|
return (0, _mergeRefs.default)([internalRef, forwardedRef]);
|
|
41
50
|
}, [forwardedRef]);
|
|
42
|
-
var isScrolled = useIsScrolled(internalRef);
|
|
43
51
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
52
|
ref: (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') ? mergedRef : forwardedRef,
|
|
45
53
|
"data-testid": testId,
|
|
46
|
-
className: (0, _runtime.ax)([styles.scrollContainer,
|
|
54
|
+
className: (0, _runtime.ax)([styles.scrollContainer, (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && fullHeightSidebarStyles.scrollContainer])
|
|
47
55
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
48
56
|
className: (0, _runtime.ax)([styles.paddingContainer])
|
|
49
57
|
}, children));
|
|
50
|
-
}
|
|
51
|
-
function useIsScrolled(ref) {
|
|
52
|
-
var _useState = (0, _react.useState)(false),
|
|
53
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
54
|
-
isScrolled = _useState2[0],
|
|
55
|
-
setIsScrolled = _useState2[1];
|
|
56
|
-
(0, _react.useEffect)(function () {
|
|
57
|
-
if (!(0, _platformFeatureFlags.fg)('navx-full-height-sidebar')) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (!ref.current) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
var scrollContainer = ref.current;
|
|
64
|
-
|
|
65
|
-
// Listener is throttled to requestAnimationFrame()
|
|
66
|
-
var listener = (0, _rafSchd.default)(function () {
|
|
67
|
-
setIsScrolled(scrollContainer.scrollTop > 0);
|
|
68
|
-
});
|
|
69
|
-
return (0, _bindEventListener.bind)(scrollContainer, {
|
|
70
|
-
type: 'scroll',
|
|
71
|
-
options: {
|
|
72
|
-
// Passive means we cannot call event.preventDefault()
|
|
73
|
-
// It allows the browser to optimize scrolling performance:
|
|
74
|
-
// https://developer.chrome.com/docs/lighthouse/best-practices/uses-passive-event-listeners
|
|
75
|
-
passive: true
|
|
76
|
-
},
|
|
77
|
-
listener: listener
|
|
78
|
-
});
|
|
79
|
-
}, [ref]);
|
|
80
|
-
return isScrolled;
|
|
81
58
|
}
|
|
@@ -4,4 +4,5 @@ export { SideNavContent } from '../../ui/page-layout/side-nav/side-nav-content';
|
|
|
4
4
|
export { SideNavFooter } from '../../ui/page-layout/side-nav/side-nav-footer';
|
|
5
5
|
export { SideNavToggleButton } from '../../ui/page-layout/side-nav/toggle-button';
|
|
6
6
|
export { useToggleSideNav } from '../../ui/page-layout/side-nav/use-toggle-side-nav';
|
|
7
|
-
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
7
|
+
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
8
|
+
export { SideNavPanelSplitter } from '../../ui/page-layout/panel-splitter/side-nav-panel-splitter';
|
|
@@ -311,10 +311,11 @@ const PortaledPanelSplitter = ({
|
|
|
311
311
|
* _PanelSplitter_
|
|
312
312
|
*
|
|
313
313
|
* A component that allows the user to resize a layout area.
|
|
314
|
-
* It can be used within layout areas like `
|
|
315
|
-
*
|
|
314
|
+
* It can be used within layout areas like `Panel`, and `Aside`.
|
|
315
|
+
* For the `SideNav`, use the `SideNavPanelSplitter` component instead, as it provides additional functionality
|
|
316
|
+
* such as double clicking to collapse the side nav.
|
|
316
317
|
*
|
|
317
|
-
* Example usage
|
|
318
|
+
* Example usage:
|
|
318
319
|
* ```tsx
|
|
319
320
|
* <Aside>
|
|
320
321
|
* <!-- other side nav content -->
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
.
|
|
1
|
+
|
|
2
|
+
._1un9baqb{scroll-timeline:--sNcst block}._16jlkb7n{flex-grow:1}
|
|
3
3
|
._18m91wug{overflow-y:auto}
|
|
4
4
|
._1o9zkb7n{flex-shrink:1}
|
|
5
5
|
._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
|
|
6
6
|
._1reo1wug{overflow-x:auto}
|
|
7
|
+
._21o1gc9s{animation-timeline:--sNcst}
|
|
7
8
|
._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
|
|
8
9
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
9
10
|
._i0dlf1ug{flex-basis:0%}
|
|
10
|
-
.
|
|
11
|
+
._j7hq98ya{animation-name:k1v0uu2e}
|
|
12
|
+
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
13
|
+
@keyframes k1v0uu2e{0%{box-shadow:none}0.1%{box-shadow:0 -1px var(--ds-border,#091e4224)}to{box-shadow:0 -1px var(--ds-border,#091e4224)}}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/* side-nav-content.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./side-nav-content.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { forwardRef,
|
|
5
|
-
import { bind } from 'bind-event-listener';
|
|
6
|
-
import rafSchd from 'raf-schd';
|
|
4
|
+
import React, { forwardRef, useMemo, useRef } from 'react';
|
|
7
5
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
8
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
7
|
/**
|
|
@@ -19,8 +17,20 @@ const styles = {
|
|
|
19
17
|
scrollContainer: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo1wug _18m91wug",
|
|
20
18
|
paddingContainer: "_1q51utpp _y4tiutpp _85i5utpp _bozgutpp"
|
|
21
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Using CSS scroll-driven animations to apply a scrolled indicator border.
|
|
23
|
+
*
|
|
24
|
+
* This approach is better for SSR, as some apps like Confluence will apply the
|
|
25
|
+
* initial scroll position of the side nav content using JS before hydration.
|
|
26
|
+
*
|
|
27
|
+
* If we applied the border through React state it would only appear after hydration,
|
|
28
|
+
* whereas this CSS approach should show even before hydration.
|
|
29
|
+
*/
|
|
30
|
+
const scrolledBorder = null;
|
|
31
|
+
const scrollTimelineVar = '--sNcst';
|
|
22
32
|
const fullHeightSidebarStyles = {
|
|
23
|
-
|
|
33
|
+
scrollContainer: "_1un9baqb _21o1gc9s _j7hq98ya"
|
|
24
34
|
};
|
|
25
35
|
function _SideNavContent({
|
|
26
36
|
children,
|
|
@@ -28,40 +38,11 @@ function _SideNavContent({
|
|
|
28
38
|
}, forwardedRef) {
|
|
29
39
|
const internalRef = useRef(null);
|
|
30
40
|
const mergedRef = useMemo(() => mergeRefs([internalRef, forwardedRef]), [forwardedRef]);
|
|
31
|
-
const isScrolled = useIsScrolled(internalRef);
|
|
32
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
42
|
ref: fg('navx-full-height-sidebar') ? mergedRef : forwardedRef,
|
|
34
43
|
"data-testid": testId,
|
|
35
|
-
className: ax([styles.scrollContainer,
|
|
44
|
+
className: ax([styles.scrollContainer, fg('navx-full-height-sidebar') && fullHeightSidebarStyles.scrollContainer])
|
|
36
45
|
}, /*#__PURE__*/React.createElement("div", {
|
|
37
46
|
className: ax([styles.paddingContainer])
|
|
38
47
|
}, children));
|
|
39
|
-
}
|
|
40
|
-
function useIsScrolled(ref) {
|
|
41
|
-
const [isScrolled, setIsScrolled] = useState(false);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!fg('navx-full-height-sidebar')) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!ref.current) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const scrollContainer = ref.current;
|
|
50
|
-
|
|
51
|
-
// Listener is throttled to requestAnimationFrame()
|
|
52
|
-
const listener = rafSchd(() => {
|
|
53
|
-
setIsScrolled(scrollContainer.scrollTop > 0);
|
|
54
|
-
});
|
|
55
|
-
return bind(scrollContainer, {
|
|
56
|
-
type: 'scroll',
|
|
57
|
-
options: {
|
|
58
|
-
// Passive means we cannot call event.preventDefault()
|
|
59
|
-
// It allows the browser to optimize scrolling performance:
|
|
60
|
-
// https://developer.chrome.com/docs/lighthouse/best-practices/uses-passive-event-listeners
|
|
61
|
-
passive: true
|
|
62
|
-
},
|
|
63
|
-
listener
|
|
64
|
-
});
|
|
65
|
-
}, [ref]);
|
|
66
|
-
return isScrolled;
|
|
67
48
|
}
|
|
@@ -4,4 +4,5 @@ export { SideNavContent } from '../../ui/page-layout/side-nav/side-nav-content';
|
|
|
4
4
|
export { SideNavFooter } from '../../ui/page-layout/side-nav/side-nav-footer';
|
|
5
5
|
export { SideNavToggleButton } from '../../ui/page-layout/side-nav/toggle-button';
|
|
6
6
|
export { useToggleSideNav } from '../../ui/page-layout/side-nav/use-toggle-side-nav';
|
|
7
|
-
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
7
|
+
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
8
|
+
export { SideNavPanelSplitter } from '../../ui/page-layout/panel-splitter/side-nav-panel-splitter';
|
|
@@ -322,10 +322,11 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
322
322
|
* _PanelSplitter_
|
|
323
323
|
*
|
|
324
324
|
* A component that allows the user to resize a layout area.
|
|
325
|
-
* It can be used within layout areas like `
|
|
326
|
-
*
|
|
325
|
+
* It can be used within layout areas like `Panel`, and `Aside`.
|
|
326
|
+
* For the `SideNav`, use the `SideNavPanelSplitter` component instead, as it provides additional functionality
|
|
327
|
+
* such as double clicking to collapse the side nav.
|
|
327
328
|
*
|
|
328
|
-
* Example usage
|
|
329
|
+
* Example usage:
|
|
329
330
|
* ```tsx
|
|
330
331
|
* <Aside>
|
|
331
332
|
* <!-- other side nav content -->
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
.
|
|
1
|
+
|
|
2
|
+
._1un9baqb{scroll-timeline:--sNcst block}._16jlkb7n{flex-grow:1}
|
|
3
3
|
._18m91wug{overflow-y:auto}
|
|
4
4
|
._1o9zkb7n{flex-shrink:1}
|
|
5
5
|
._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
|
|
6
6
|
._1reo1wug{overflow-x:auto}
|
|
7
|
+
._21o1gc9s{animation-timeline:--sNcst}
|
|
7
8
|
._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
|
|
8
9
|
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
9
10
|
._i0dlf1ug{flex-basis:0%}
|
|
10
|
-
.
|
|
11
|
+
._j7hq1ysc{animation-name:kewh7qa}
|
|
12
|
+
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
13
|
+
@keyframes kewh7qa{0%{box-shadow:none}0.1%{box-shadow:0 -1px var(--ds-border,#091e4224)}to{box-shadow:0 -1px var(--ds-border,#091e4224)}}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/* side-nav-content.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import "./side-nav-content.compiled.css";
|
|
4
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import React, { forwardRef,
|
|
6
|
-
import { bind } from 'bind-event-listener';
|
|
7
|
-
import rafSchd from 'raf-schd';
|
|
4
|
+
import React, { forwardRef, useMemo, useRef } from 'react';
|
|
8
5
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
9
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
7
|
/**
|
|
@@ -20,8 +17,20 @@ var styles = {
|
|
|
20
17
|
scrollContainer: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo1wug _18m91wug",
|
|
21
18
|
paddingContainer: "_1q51utpp _y4tiutpp _85i5utpp _bozgutpp"
|
|
22
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Using CSS scroll-driven animations to apply a scrolled indicator border.
|
|
23
|
+
*
|
|
24
|
+
* This approach is better for SSR, as some apps like Confluence will apply the
|
|
25
|
+
* initial scroll position of the side nav content using JS before hydration.
|
|
26
|
+
*
|
|
27
|
+
* If we applied the border through React state it would only appear after hydration,
|
|
28
|
+
* whereas this CSS approach should show even before hydration.
|
|
29
|
+
*/
|
|
30
|
+
var scrolledBorder = null;
|
|
31
|
+
var scrollTimelineVar = '--sNcst';
|
|
23
32
|
var fullHeightSidebarStyles = {
|
|
24
|
-
|
|
33
|
+
scrollContainer: "_1un9baqb _21o1gc9s _j7hq1ysc"
|
|
25
34
|
};
|
|
26
35
|
function _SideNavContent(_ref, forwardedRef) {
|
|
27
36
|
var children = _ref.children,
|
|
@@ -30,43 +39,11 @@ function _SideNavContent(_ref, forwardedRef) {
|
|
|
30
39
|
var mergedRef = useMemo(function () {
|
|
31
40
|
return mergeRefs([internalRef, forwardedRef]);
|
|
32
41
|
}, [forwardedRef]);
|
|
33
|
-
var isScrolled = useIsScrolled(internalRef);
|
|
34
42
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
43
|
ref: fg('navx-full-height-sidebar') ? mergedRef : forwardedRef,
|
|
36
44
|
"data-testid": testId,
|
|
37
|
-
className: ax([styles.scrollContainer,
|
|
45
|
+
className: ax([styles.scrollContainer, fg('navx-full-height-sidebar') && fullHeightSidebarStyles.scrollContainer])
|
|
38
46
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
47
|
className: ax([styles.paddingContainer])
|
|
40
48
|
}, children));
|
|
41
|
-
}
|
|
42
|
-
function useIsScrolled(ref) {
|
|
43
|
-
var _useState = useState(false),
|
|
44
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
-
isScrolled = _useState2[0],
|
|
46
|
-
setIsScrolled = _useState2[1];
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
if (!fg('navx-full-height-sidebar')) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (!ref.current) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
var scrollContainer = ref.current;
|
|
55
|
-
|
|
56
|
-
// Listener is throttled to requestAnimationFrame()
|
|
57
|
-
var listener = rafSchd(function () {
|
|
58
|
-
setIsScrolled(scrollContainer.scrollTop > 0);
|
|
59
|
-
});
|
|
60
|
-
return bind(scrollContainer, {
|
|
61
|
-
type: 'scroll',
|
|
62
|
-
options: {
|
|
63
|
-
// Passive means we cannot call event.preventDefault()
|
|
64
|
-
// It allows the browser to optimize scrolling performance:
|
|
65
|
-
// https://developer.chrome.com/docs/lighthouse/best-practices/uses-passive-event-listeners
|
|
66
|
-
passive: true
|
|
67
|
-
},
|
|
68
|
-
listener: listener
|
|
69
|
-
});
|
|
70
|
-
}, [ref]);
|
|
71
|
-
return isScrolled;
|
|
72
49
|
}
|
|
@@ -5,3 +5,4 @@ export { SideNavFooter } from '../../ui/page-layout/side-nav/side-nav-footer';
|
|
|
5
5
|
export { SideNavToggleButton } from '../../ui/page-layout/side-nav/toggle-button';
|
|
6
6
|
export { useToggleSideNav } from '../../ui/page-layout/side-nav/use-toggle-side-nav';
|
|
7
7
|
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
8
|
+
export { SideNavPanelSplitter } from '../../ui/page-layout/panel-splitter/side-nav-panel-splitter';
|
|
@@ -45,10 +45,11 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
45
45
|
* _PanelSplitter_
|
|
46
46
|
*
|
|
47
47
|
* A component that allows the user to resize a layout area.
|
|
48
|
-
* It can be used within layout areas like `
|
|
49
|
-
*
|
|
48
|
+
* It can be used within layout areas like `Panel`, and `Aside`.
|
|
49
|
+
* For the `SideNav`, use the `SideNavPanelSplitter` component instead, as it provides additional functionality
|
|
50
|
+
* such as double clicking to collapse the side nav.
|
|
50
51
|
*
|
|
51
|
-
* Example usage
|
|
52
|
+
* Example usage:
|
|
52
53
|
* ```tsx
|
|
53
54
|
* <Aside>
|
|
54
55
|
* <!-- other side nav content -->
|
|
@@ -5,3 +5,4 @@ export { SideNavFooter } from '../../ui/page-layout/side-nav/side-nav-footer';
|
|
|
5
5
|
export { SideNavToggleButton } from '../../ui/page-layout/side-nav/toggle-button';
|
|
6
6
|
export { useToggleSideNav } from '../../ui/page-layout/side-nav/use-toggle-side-nav';
|
|
7
7
|
export { useExpandSideNav } from '../../ui/page-layout/side-nav/use-expand-side-nav';
|
|
8
|
+
export { SideNavPanelSplitter } from '../../ui/page-layout/panel-splitter/side-nav-panel-splitter';
|
|
@@ -45,10 +45,11 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
45
45
|
* _PanelSplitter_
|
|
46
46
|
*
|
|
47
47
|
* A component that allows the user to resize a layout area.
|
|
48
|
-
* It can be used within layout areas like `
|
|
49
|
-
*
|
|
48
|
+
* It can be used within layout areas like `Panel`, and `Aside`.
|
|
49
|
+
* For the `SideNav`, use the `SideNavPanelSplitter` component instead, as it provides additional functionality
|
|
50
|
+
* such as double clicking to collapse the side nav.
|
|
50
51
|
*
|
|
51
|
-
* Example usage
|
|
52
|
+
* Example usage:
|
|
52
53
|
* ```tsx
|
|
53
54
|
* <Aside>
|
|
54
55
|
* <!-- other side nav content -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/avatar": "^25.5.0",
|
|
71
71
|
"@atlaskit/button": "^23.5.0",
|
|
72
72
|
"@atlaskit/css": "^0.15.0",
|
|
73
|
-
"@atlaskit/ds-lib": "^5.
|
|
73
|
+
"@atlaskit/ds-lib": "^5.2.0",
|
|
74
74
|
"@atlaskit/icon": "^28.5.0",
|
|
75
75
|
"@atlaskit/layering": "^3.2.0",
|
|
76
76
|
"@atlaskit/logo": "^19.9.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
81
81
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
82
82
|
"@atlaskit/primitives": "^16.1.0",
|
|
83
|
-
"@atlaskit/tokens": "^7.
|
|
83
|
+
"@atlaskit/tokens": "^7.1.0",
|
|
84
84
|
"@atlaskit/tooltip": "^20.7.0",
|
|
85
85
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
86
86
|
"@babel/runtime": "^7.0.0",
|