@atlaskit/navigation-system 5.0.0 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
11
+ ## 5.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`5a651fd4cae29`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a651fd4cae29) -
16
+ Minor change to JSDocs for PanelSplitter.
17
+ - Updated dependencies
18
+
3
19
  ## 5.0.0
4
20
 
5
21
  ### Major Changes
@@ -337,10 +337,10 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
337
337
  *
338
338
  * Example usage in products:
339
339
  * ```tsx
340
- * <SideNav>
341
- * {/* other side nav content *}
340
+ * <Aside>
341
+ * <!-- other side nav content -->
342
342
  * <PanelSplitter label="Resize Side Nav" />
343
- * </SideNav>
343
+ * </Aside>
344
344
  * ```
345
345
  */
346
346
  var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref7) {
@@ -1,10 +1,13 @@
1
- ._16jlkb7n{flex-grow:1}
2
- ._16qs10dg{box-shadow:0 -1px var(--ds-border,#091e4224)}
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
- ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
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
- scrolled: "_16qs10dg"
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, isScrolled && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar') && fullHeightSidebarStyles.scrolled])
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
  }
@@ -316,10 +316,10 @@ const PortaledPanelSplitter = ({
316
316
  *
317
317
  * Example usage in products:
318
318
  * ```tsx
319
- * <SideNav>
320
- * {/* other side nav content *}
319
+ * <Aside>
320
+ * <!-- other side nav content -->
321
321
  * <PanelSplitter label="Resize Side Nav" />
322
- * </SideNav>
322
+ * </Aside>
323
323
  * ```
324
324
  */
325
325
  export const PanelSplitter = ({
@@ -1,10 +1,13 @@
1
- ._16jlkb7n{flex-grow:1}
2
- ._16qs10dg{box-shadow:0 -1px var(--ds-border,#091e4224)}
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
- ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
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, useEffect, useMemo, useRef, useState } from 'react';
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
- scrolled: "_16qs10dg"
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, isScrolled && fg('navx-full-height-sidebar') && fullHeightSidebarStyles.scrolled])
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
  }
@@ -327,10 +327,10 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
327
327
  *
328
328
  * Example usage in products:
329
329
  * ```tsx
330
- * <SideNav>
331
- * {/* other side nav content *}
330
+ * <Aside>
331
+ * <!-- other side nav content -->
332
332
  * <PanelSplitter label="Resize Side Nav" />
333
- * </SideNav>
333
+ * </Aside>
334
334
  * ```
335
335
  */
336
336
  export var PanelSplitter = function PanelSplitter(_ref7) {
@@ -1,10 +1,13 @@
1
- ._16jlkb7n{flex-grow:1}
2
- ._16qs10dg{box-shadow:0 -1px var(--ds-border,#091e4224)}
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
- ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
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, useEffect, useMemo, useRef, useState } from 'react';
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
- scrolled: "_16qs10dg"
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, isScrolled && fg('navx-full-height-sidebar') && fullHeightSidebarStyles.scrolled])
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
  }
@@ -50,10 +50,10 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
50
50
  *
51
51
  * Example usage in products:
52
52
  * ```tsx
53
- * <SideNav>
54
- * {/* other side nav content *}
53
+ * <Aside>
54
+ * <!-- other side nav content -->
55
55
  * <PanelSplitter label="Resize Side Nav" />
56
- * </SideNav>
56
+ * </Aside>
57
57
  * ```
58
58
  */
59
59
  export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, }: PanelSplitterProps) => ReactNode;
@@ -50,10 +50,10 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
50
50
  *
51
51
  * Example usage in products:
52
52
  * ```tsx
53
- * <SideNav>
54
- * {/* other side nav content *}
53
+ * <Aside>
54
+ * <!-- other side nav content -->
55
55
  * <PanelSplitter label="Resize Side Nav" />
56
- * </SideNav>
56
+ * </Aside>
57
57
  * ```
58
58
  */
59
59
  export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, }: PanelSplitterProps) => ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "5.0.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",
@@ -75,13 +75,13 @@
75
75
  "@atlaskit/layering": "^3.2.0",
76
76
  "@atlaskit/logo": "^19.9.0",
77
77
  "@atlaskit/platform-feature-flags": "^1.1.0",
78
- "@atlaskit/popup": "^4.4.0",
78
+ "@atlaskit/popup": "^4.6.0",
79
79
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
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
- "@atlaskit/primitives": "^16.0.0",
83
- "@atlaskit/tokens": "^7.0.0",
84
- "@atlaskit/tooltip": "^20.6.0",
82
+ "@atlaskit/primitives": "^16.1.0",
83
+ "@atlaskit/tokens": "^7.1.0",
84
+ "@atlaskit/tooltip": "^20.7.0",
85
85
  "@atlaskit/visually-hidden": "^3.0.0",
86
86
  "@babel/runtime": "^7.0.0",
87
87
  "@compiled/react": "^0.18.6",