@atlaskit/navigation-system 5.0.1 → 5.0.2
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 +8 -0
- 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/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/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/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bb5f1424b34de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb5f1424b34de) -
|
|
8
|
+
[ux] Fixes the scrolled indicator in SideNavContent to set initial state for SSR'd scroll
|
|
9
|
+
position. Behind the `navx-full-height-sidebar` gate.
|
|
10
|
+
|
|
3
11
|
## 5.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
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",
|
|
@@ -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",
|