@atlaskit/page-layout 1.3.7 → 1.3.9

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/common/constants.js +8 -4
  3. package/dist/cjs/common/hooks/index.js +0 -3
  4. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +3 -12
  5. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +3 -12
  6. package/dist/cjs/common/safe-local-storage.js +2 -13
  7. package/dist/cjs/common/utils.js +0 -35
  8. package/dist/cjs/components/index.js +0 -13
  9. package/dist/cjs/components/resize-control/grab-area.js +8 -17
  10. package/dist/cjs/components/resize-control/index.js +33 -84
  11. package/dist/cjs/components/resize-control/resize-button.js +9 -24
  12. package/dist/cjs/components/resize-control/shadow.js +3 -7
  13. package/dist/cjs/components/skip-links/index.js +0 -2
  14. package/dist/cjs/components/skip-links/skip-link-components.js +18 -48
  15. package/dist/cjs/components/skip-links/use-custom-skip-link.js +3 -8
  16. package/dist/cjs/components/slots/banner-slot.js +10 -21
  17. package/dist/cjs/components/slots/content.js +3 -6
  18. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +9 -14
  19. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +10 -22
  20. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +10 -15
  21. package/dist/cjs/components/slots/internal/slot-focus-ring.js +5 -8
  22. package/dist/cjs/components/slots/left-panel.js +9 -20
  23. package/dist/cjs/components/slots/left-sidebar-without-resize.js +6 -18
  24. package/dist/cjs/components/slots/left-sidebar.js +39 -75
  25. package/dist/cjs/components/slots/main.js +9 -23
  26. package/dist/cjs/components/slots/page-layout.js +7 -16
  27. package/dist/cjs/components/slots/right-panel.js +9 -20
  28. package/dist/cjs/components/slots/right-sidebar.js +9 -21
  29. package/dist/cjs/components/slots/slot-dimensions.js +1 -5
  30. package/dist/cjs/components/slots/top-navigation.js +10 -21
  31. package/dist/cjs/controllers/index.js +0 -6
  32. package/dist/cjs/controllers/sidebar-resize-context.js +6 -21
  33. package/dist/cjs/controllers/sidebar-resize-controller.js +34 -50
  34. package/dist/cjs/controllers/skip-link-context.js +2 -12
  35. package/dist/cjs/controllers/skip-link-controller.js +6 -22
  36. package/dist/cjs/controllers/use-page-layout-grid.js +6 -12
  37. package/dist/cjs/controllers/use-update-css-vars.js +0 -3
  38. package/dist/cjs/index.js +0 -3
  39. package/dist/cjs/version.json +1 -1
  40. package/dist/es2019/common/constants.js +8 -4
  41. package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +0 -4
  42. package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +0 -4
  43. package/dist/es2019/common/safe-local-storage.js +2 -12
  44. package/dist/es2019/common/utils.js +4 -20
  45. package/dist/es2019/components/resize-control/grab-area.js +7 -8
  46. package/dist/es2019/components/resize-control/index.js +26 -43
  47. package/dist/es2019/components/resize-control/resize-button.js +7 -11
  48. package/dist/es2019/components/resize-control/shadow.js +3 -3
  49. package/dist/es2019/components/skip-links/skip-link-components.js +16 -31
  50. package/dist/es2019/components/slots/banner-slot.js +1 -3
  51. package/dist/es2019/components/slots/content.js +2 -2
  52. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +5 -5
  53. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +1 -4
  54. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +4 -4
  55. package/dist/es2019/components/slots/internal/slot-focus-ring.js +3 -3
  56. package/dist/es2019/components/slots/left-panel.js +1 -3
  57. package/dist/es2019/components/slots/left-sidebar-without-resize.js +1 -2
  58. package/dist/es2019/components/slots/left-sidebar.js +25 -40
  59. package/dist/es2019/components/slots/main.js +4 -5
  60. package/dist/es2019/components/slots/page-layout.js +1 -3
  61. package/dist/es2019/components/slots/right-panel.js +1 -3
  62. package/dist/es2019/components/slots/right-sidebar.js +3 -5
  63. package/dist/es2019/components/slots/top-navigation.js +1 -3
  64. package/dist/es2019/controllers/sidebar-resize-context.js +7 -5
  65. package/dist/es2019/controllers/sidebar-resize-controller.js +14 -16
  66. package/dist/es2019/controllers/skip-link-context.js +0 -1
  67. package/dist/es2019/controllers/skip-link-controller.js +3 -7
  68. package/dist/es2019/controllers/use-page-layout-grid.js +4 -5
  69. package/dist/es2019/controllers/use-update-css-vars.js +0 -2
  70. package/dist/es2019/version.json +1 -1
  71. package/dist/esm/common/constants.js +8 -4
  72. package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +3 -8
  73. package/dist/esm/common/hooks/use-is-sidebar-dragging.js +3 -8
  74. package/dist/esm/common/safe-local-storage.js +2 -12
  75. package/dist/esm/common/utils.js +0 -22
  76. package/dist/esm/components/resize-control/grab-area.js +9 -14
  77. package/dist/esm/components/resize-control/index.js +33 -72
  78. package/dist/esm/components/resize-control/resize-button.js +10 -15
  79. package/dist/esm/components/resize-control/shadow.js +3 -3
  80. package/dist/esm/components/skip-links/skip-link-components.js +19 -39
  81. package/dist/esm/components/skip-links/use-custom-skip-link.js +2 -4
  82. package/dist/esm/components/slots/banner-slot.js +9 -11
  83. package/dist/esm/components/slots/content.js +3 -3
  84. package/dist/esm/components/slots/internal/left-sidebar-inner.js +9 -9
  85. package/dist/esm/components/slots/internal/left-sidebar-outer.js +9 -12
  86. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +10 -10
  87. package/dist/esm/components/slots/internal/slot-focus-ring.js +5 -5
  88. package/dist/esm/components/slots/left-panel.js +8 -10
  89. package/dist/esm/components/slots/left-sidebar-without-resize.js +7 -9
  90. package/dist/esm/components/slots/left-sidebar.js +40 -65
  91. package/dist/esm/components/slots/main.js +10 -13
  92. package/dist/esm/components/slots/page-layout.js +6 -10
  93. package/dist/esm/components/slots/right-panel.js +8 -10
  94. package/dist/esm/components/slots/right-sidebar.js +10 -12
  95. package/dist/esm/components/slots/slot-dimensions.js +1 -1
  96. package/dist/esm/components/slots/top-navigation.js +9 -11
  97. package/dist/esm/controllers/sidebar-resize-context.js +6 -11
  98. package/dist/esm/controllers/sidebar-resize-controller.js +34 -38
  99. package/dist/esm/controllers/skip-link-context.js +2 -4
  100. package/dist/esm/controllers/skip-link-controller.js +6 -12
  101. package/dist/esm/controllers/use-page-layout-grid.js +6 -8
  102. package/dist/esm/controllers/use-update-css-vars.js +0 -2
  103. package/dist/esm/version.json +1 -1
  104. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  /** @jsx jsx */
5
4
  import { useEffect } from 'react';
6
5
  import { css, jsx } from '@emotion/react';
@@ -19,6 +18,7 @@ var fixedStyles = css({
19
18
  right: 0,
20
19
  bottom: 0
21
20
  });
21
+
22
22
  /**
23
23
  * __Right panel__
24
24
  *
@@ -27,16 +27,15 @@ var fixedStyles = css({
27
27
  * - [Examples](https://atlassian.design/components/page-layout/examples)
28
28
  * - [Code](https://atlassian.design/components/page-layout/code)
29
29
  */
30
-
31
30
  var RightPanel = function RightPanel(props) {
32
31
  var children = props.children,
33
- isFixed = props.isFixed,
34
- _props$width = props.width,
35
- width = _props$width === void 0 ? DEFAULT_RIGHT_PANEL_WIDTH : _props$width,
36
- shouldPersistWidth = props.shouldPersistWidth,
37
- testId = props.testId,
38
- id = props.id,
39
- skipLinkTitle = props.skipLinkTitle;
32
+ isFixed = props.isFixed,
33
+ _props$width = props.width,
34
+ width = _props$width === void 0 ? DEFAULT_RIGHT_PANEL_WIDTH : _props$width,
35
+ shouldPersistWidth = props.shouldPersistWidth,
36
+ testId = props.testId,
37
+ id = props.id,
38
+ skipLinkTitle = props.skipLinkTitle;
40
39
  var rightPanelWidth = resolveDimension(VAR_RIGHT_PANEL_WIDTH, width, shouldPersistWidth);
41
40
  useEffect(function () {
42
41
  publishGridState(_defineProperty({}, VAR_RIGHT_PANEL_WIDTH, rightPanelWidth));
@@ -58,5 +57,4 @@ var RightPanel = function RightPanel(props) {
58
57
  }), children);
59
58
  });
60
59
  };
61
-
62
60
  export default RightPanel;
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  /** @jsx jsx */
5
4
  import { useEffect } from 'react';
6
5
  import { css, jsx } from '@emotion/react';
@@ -9,13 +8,13 @@ import { getPageLayoutSlotSelector, resolveDimension } from '../../common/utils'
9
8
  import { publishGridState, useSkipLink } from '../../controllers';
10
9
  import SlotFocusRing from './internal/slot-focus-ring';
11
10
  import SlotDimensions from './slot-dimensions';
11
+
12
12
  /**
13
13
  * This inner wrapper is required to allow the sidebar to be `position: fixed`.
14
14
  *
15
15
  * If we were to apply `position: fixed` to the outer wrapper, it will be popped
16
16
  * out of its flex container and Main would stretch to occupy all the space.
17
17
  */
18
-
19
18
  var fixedInnerStyles = css({
20
19
  /**
21
20
  * This width on the inner wrapper is required when it is using fixed
@@ -33,12 +32,12 @@ var staticInnerStyles = css({
33
32
  var outerStyles = css({
34
33
  width: RIGHT_SIDEBAR_WIDTH
35
34
  });
35
+
36
36
  /**
37
37
  * In fixed mode this element's child is taken out of the document flow.
38
38
  * It doesn't take up the width as expected,
39
39
  * so the pseudo element forces it to take up the necessary width.
40
40
  */
41
-
42
41
  var fixedOuterStyles = css({
43
42
  '&::after': {
44
43
  display: 'inline-block',
@@ -46,6 +45,7 @@ var fixedOuterStyles = css({
46
45
  content: "''"
47
46
  }
48
47
  });
48
+
49
49
  /**
50
50
  * __Right sidebar__
51
51
  *
@@ -54,16 +54,15 @@ var fixedOuterStyles = css({
54
54
  * - [Examples](https://atlassian.design/components/page-layout/examples)
55
55
  * - [Code](https://atlassian.design/components/page-layout/code)
56
56
  */
57
-
58
57
  var RightSidebar = function RightSidebar(props) {
59
58
  var children = props.children,
60
- _props$width = props.width,
61
- width = _props$width === void 0 ? DEFAULT_RIGHT_SIDEBAR_WIDTH : _props$width,
62
- isFixed = props.isFixed,
63
- shouldPersistWidth = props.shouldPersistWidth,
64
- testId = props.testId,
65
- id = props.id,
66
- skipLinkTitle = props.skipLinkTitle;
59
+ _props$width = props.width,
60
+ width = _props$width === void 0 ? DEFAULT_RIGHT_SIDEBAR_WIDTH : _props$width,
61
+ isFixed = props.isFixed,
62
+ shouldPersistWidth = props.shouldPersistWidth,
63
+ testId = props.testId,
64
+ id = props.id,
65
+ skipLinkTitle = props.skipLinkTitle;
67
66
  var rightSidebarWidth = resolveDimension(VAR_RIGHT_SIDEBAR_WIDTH, width, shouldPersistWidth);
68
67
  useEffect(function () {
69
68
  publishGridState(_defineProperty({}, VAR_RIGHT_SIDEBAR_WIDTH, rightSidebarWidth));
@@ -89,5 +88,4 @@ var RightSidebar = function RightSidebar(props) {
89
88
  }, children));
90
89
  });
91
90
  };
92
-
93
91
  export default RightSidebar;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export default (function (_ref) {
3
3
  var variableName = _ref.variableName,
4
- value = _ref.value;
4
+ value = _ref.value;
5
5
  return /*#__PURE__*/React.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"));
6
6
  });
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  /** @jsx jsx */
5
4
  import { useEffect } from 'react';
6
5
  import { css, jsx } from '@emotion/react';
@@ -20,6 +19,7 @@ var fixedStyles = css({
20
19
  right: RIGHT_PANEL_WIDTH,
21
20
  left: LEFT_PANEL_WIDTH
22
21
  });
22
+
23
23
  /**
24
24
  * __Top navigation__
25
25
  *
@@ -28,17 +28,16 @@ var fixedStyles = css({
28
28
  * - [Examples](https://atlassian.design/components/page-layout/examples)
29
29
  * - [Code](https://atlassian.design/components/page-layout/code)
30
30
  */
31
-
32
31
  var TopNavigation = function TopNavigation(props) {
33
32
  var children = props.children,
34
- _props$height = props.height,
35
- height = _props$height === void 0 ? DEFAULT_TOP_NAVIGATION_HEIGHT : _props$height,
36
- _props$isFixed = props.isFixed,
37
- isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
38
- shouldPersistHeight = props.shouldPersistHeight,
39
- testId = props.testId,
40
- id = props.id,
41
- skipLinkTitle = props.skipLinkTitle;
33
+ _props$height = props.height,
34
+ height = _props$height === void 0 ? DEFAULT_TOP_NAVIGATION_HEIGHT : _props$height,
35
+ _props$isFixed = props.isFixed,
36
+ isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
37
+ shouldPersistHeight = props.shouldPersistHeight,
38
+ testId = props.testId,
39
+ id = props.id,
40
+ skipLinkTitle = props.skipLinkTitle;
42
41
  var topNavigationHeight = resolveDimension(VAR_TOP_NAVIGATION_HEIGHT, height, shouldPersistHeight);
43
42
  useEffect(function () {
44
43
  publishGridState(_defineProperty({}, VAR_TOP_NAVIGATION_HEIGHT, topNavigationHeight));
@@ -60,5 +59,4 @@ var TopNavigation = function TopNavigation(props) {
60
59
  }), children);
61
60
  });
62
61
  };
63
-
64
62
  export default TopNavigation;
@@ -1,11 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["setLeftSidebarState"];
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import { createContext, useContext, useEffect } from 'react';
10
7
  import noop from '@atlaskit/ds-lib/noop';
11
8
  var leftSidebarState = {
@@ -16,8 +13,8 @@ var leftSidebarState = {
16
13
  lastLeftSidebarWidth: 0,
17
14
  flyoutLockCount: 0,
18
15
  isFixed: true
19
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
20
-
16
+ };
17
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
21
18
  export var SidebarResizeContext = /*#__PURE__*/createContext({
22
19
  isLeftSidebarCollapsed: false,
23
20
  expandLeftSidebar: noop,
@@ -27,11 +24,11 @@ export var SidebarResizeContext = /*#__PURE__*/createContext({
27
24
  });
28
25
  export var usePageLayoutResize = function usePageLayoutResize() {
29
26
  var _useContext = useContext(SidebarResizeContext),
30
- setLeftSidebarState = _useContext.setLeftSidebarState,
31
- context = _objectWithoutProperties(_useContext, _excluded);
32
-
27
+ setLeftSidebarState = _useContext.setLeftSidebarState,
28
+ context = _objectWithoutProperties(_useContext, _excluded);
33
29
  return context;
34
30
  };
31
+
35
32
  /**
36
33
  * _**WARNING:**_ This hook is intended as a temporary solution and
37
34
  * is likely to be removed in a future version of page-layout.
@@ -49,11 +46,9 @@ export var usePageLayoutResize = function usePageLayoutResize() {
49
46
  * you are rendering. This way the left sidebar will be locked for
50
47
  * as long as the popup is open.
51
48
  */
52
-
53
49
  export var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
54
50
  var _useContext2 = useContext(SidebarResizeContext),
55
- setLeftSidebarState = _useContext2.setLeftSidebarState;
56
-
51
+ setLeftSidebarState = _useContext2.setLeftSidebarState;
57
52
  useEffect(function () {
58
53
  setLeftSidebarState(function (current) {
59
54
  return _objectSpread(_objectSpread({}, current), {}, {
@@ -5,50 +5,47 @@ import { isReducedMotion } from '@atlaskit/motion';
5
5
  import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, GRAB_AREA_SELECTOR, IS_SIDEBAR_COLLAPSING } from '../common/constants';
6
6
  import { getPageLayoutSlotCSSSelector } from '../common/utils';
7
7
  import { SidebarResizeContext } from './sidebar-resize-context';
8
-
9
8
  var handleDataAttributesAndCb = function handleDataAttributesAndCb() {
10
9
  var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;
11
10
  var isLeftSidebarCollapsed = arguments.length > 1 ? arguments[1] : undefined;
12
11
  var leftSidebarState = arguments.length > 2 ? arguments[2] : undefined;
13
12
  document.documentElement.removeAttribute(IS_SIDEBAR_COLLAPSING);
14
13
  callback(leftSidebarState);
15
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
16
-
14
+ };
17
15
 
16
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
18
17
  export var SidebarResizeController = function SidebarResizeController(_ref) {
19
18
  var children = _ref.children,
20
- onExpand = _ref.onLeftSidebarExpand,
21
- onCollapse = _ref.onLeftSidebarCollapse;
22
-
19
+ onExpand = _ref.onLeftSidebarExpand,
20
+ onCollapse = _ref.onLeftSidebarCollapse;
23
21
  var _useState = useState({
24
- isFlyoutOpen: false,
25
- isResizing: false,
26
- isLeftSidebarCollapsed: false,
27
- leftSidebarWidth: 0,
28
- lastLeftSidebarWidth: 0,
29
- flyoutLockCount: 0,
30
- isFixed: true
31
- }),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- leftSidebarState = _useState2[0],
34
- setLeftSidebarState = _useState2[1];
35
-
22
+ isFlyoutOpen: false,
23
+ isResizing: false,
24
+ isLeftSidebarCollapsed: false,
25
+ leftSidebarWidth: 0,
26
+ lastLeftSidebarWidth: 0,
27
+ flyoutLockCount: 0,
28
+ isFixed: true
29
+ }),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ leftSidebarState = _useState2[0],
32
+ setLeftSidebarState = _useState2[1];
36
33
  var isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed;
37
34
  var leftSidebarSelector = getPageLayoutSlotCSSSelector('left-sidebar');
38
35
  var transitionEventHandler = useCallback(function (event) {
39
36
  if (event.propertyName === 'width' && event.target && event.target.matches(leftSidebarSelector)) {
40
37
  var $leftSidebarResizeController = document.querySelector("[".concat(GRAB_AREA_SELECTOR, "]"));
41
38
  var isCollapsed = !!$leftSidebarResizeController && $leftSidebarResizeController.hasAttribute('disabled');
42
- handleDataAttributesAndCb(isCollapsed ? onCollapse : onExpand, isCollapsed, leftSidebarState); // Make sure multiple event handlers do not get attached
43
- // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
39
+ handleDataAttributesAndCb(isCollapsed ? onCollapse : onExpand, isCollapsed, leftSidebarState);
44
40
 
41
+ // Make sure multiple event handlers do not get attached
42
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
45
43
  document.querySelector(leftSidebarSelector).removeEventListener('transitionend', transitionEventHandler);
46
- } // eslint-disable-next-line react-hooks/exhaustive-deps
47
-
44
+ }
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
48
46
  }, []);
49
47
  useEffect(function () {
50
48
  var $leftSidebar = document.querySelector(leftSidebarSelector);
51
-
52
49
  if ($leftSidebar && !isReducedMotion()) {
53
50
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
54
51
  $leftSidebar.addEventListener('transitionend', transitionEventHandler);
@@ -56,14 +53,12 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
56
53
  }, [isLeftSidebarCollapsed, leftSidebarSelector, leftSidebarState, onCollapse, onExpand, transitionEventHandler]);
57
54
  var expandLeftSidebar = useCallback(function () {
58
55
  var lastLeftSidebarWidth = leftSidebarState.lastLeftSidebarWidth,
59
- isResizing = leftSidebarState.isResizing,
60
- flyoutLockCount = leftSidebarState.flyoutLockCount,
61
- isFixed = leftSidebarState.isFixed;
62
-
56
+ isResizing = leftSidebarState.isResizing,
57
+ flyoutLockCount = leftSidebarState.flyoutLockCount,
58
+ isFixed = leftSidebarState.isFixed;
63
59
  if (isResizing) {
64
60
  return;
65
61
  }
66
-
67
62
  var width = Math.max(lastLeftSidebarWidth, DEFAULT_LEFT_SIDEBAR_WIDTH);
68
63
  var updatedLeftSidebarState = {
69
64
  isLeftSidebarCollapsed: false,
@@ -74,25 +69,25 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
74
69
  flyoutLockCount: flyoutLockCount,
75
70
  isFixed: isFixed
76
71
  };
77
- setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
72
+ setLeftSidebarState(updatedLeftSidebarState);
78
73
 
74
+ // onTransitionEnd isn't triggered when a user prefers reduced motion
79
75
  if (isReducedMotion()) {
80
76
  handleDataAttributesAndCb(onExpand, false, updatedLeftSidebarState);
81
77
  }
82
78
  }, [leftSidebarState, onExpand]);
83
79
  var collapseLeftSidebar = useCallback(function (event, collapseWithoutTransition) {
84
80
  var leftSidebarWidth = leftSidebarState.leftSidebarWidth,
85
- isResizing = leftSidebarState.isResizing,
86
- flyoutLockCount = leftSidebarState.flyoutLockCount,
87
- isFixed = leftSidebarState.isFixed,
88
- isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed;
89
-
81
+ isResizing = leftSidebarState.isResizing,
82
+ flyoutLockCount = leftSidebarState.flyoutLockCount,
83
+ isFixed = leftSidebarState.isFixed,
84
+ isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed;
90
85
  if (isResizing || isLeftSidebarCollapsed) {
91
86
  return;
92
- } // data-attribute is used as a CSS selector to sync the hiding/showing
93
- // of the nav contents with expand/collapse animation
94
-
87
+ }
95
88
 
89
+ // data-attribute is used as a CSS selector to sync the hiding/showing
90
+ // of the nav contents with expand/collapse animation
96
91
  document.documentElement.setAttribute(IS_SIDEBAR_COLLAPSING, 'true');
97
92
  var updatedLeftSidebarState = {
98
93
  isLeftSidebarCollapsed: true,
@@ -103,8 +98,9 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
103
98
  flyoutLockCount: flyoutLockCount,
104
99
  isFixed: isFixed
105
100
  };
106
- setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
101
+ setLeftSidebarState(updatedLeftSidebarState);
107
102
 
103
+ // onTransitionEnd isn't triggered when a user prefers reduced motion
108
104
  if (collapseWithoutTransition || isReducedMotion()) {
109
105
  handleDataAttributesAndCb(onCollapse, true, updatedLeftSidebarState);
110
106
  }
@@ -11,9 +11,8 @@ export var useSkipLinks = function useSkipLinks() {
11
11
  };
12
12
  export var useSkipLink = function useSkipLink(id, skipLinkTitle) {
13
13
  var _useSkipLinks = useSkipLinks(),
14
- registerSkipLink = _useSkipLinks.registerSkipLink,
15
- unregisterSkipLink = _useSkipLinks.unregisterSkipLink;
16
-
14
+ registerSkipLink = _useSkipLinks.registerSkipLink,
15
+ unregisterSkipLink = _useSkipLinks.unregisterSkipLink;
17
16
  useEffect(function () {
18
17
  if (id && skipLinkTitle) {
19
18
  registerSkipLink({
@@ -21,7 +20,6 @@ export var useSkipLink = function useSkipLink(id, skipLinkTitle) {
21
20
  skipLinkTitle: skipLinkTitle
22
21
  });
23
22
  }
24
-
25
23
  return function () {
26
24
  unregisterSkipLink(id);
27
25
  };
@@ -3,22 +3,20 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { useRef, useState } from 'react';
4
4
  import { PAGE_LAYOUT_SLOT_SELECTOR } from '../common/constants';
5
5
  import { SkipLinksContext } from './skip-link-context';
6
-
7
6
  var byDOMOrder = function byDOMOrder(a, b) {
8
7
  var _a$listIndex, _b$listIndex;
9
-
10
8
  var elems = Array.from(document.querySelectorAll("[".concat(PAGE_LAYOUT_SLOT_SELECTOR, "]")));
11
9
  var elemA = document.getElementById(a.id);
12
10
  var elemB = document.getElementById(b.id);
13
11
  var indexA = (_a$listIndex = a.listIndex) !== null && _a$listIndex !== void 0 ? _a$listIndex : elems.indexOf(elemA);
14
12
  var indexB = (_b$listIndex = b.listIndex) !== null && _b$listIndex !== void 0 ? _b$listIndex : elems.indexOf(elemB);
13
+
15
14
  /**
16
15
  * If they are tied it is because one (or both) is
17
16
  * a custom skiplink with a set index.
18
17
  *
19
18
  * Give the custom skiplink priority.
20
19
  */
21
-
22
20
  if (indexA === indexB) {
23
21
  if (a.listIndex !== undefined) {
24
22
  return -1;
@@ -26,19 +24,16 @@ var byDOMOrder = function byDOMOrder(a, b) {
26
24
  return 1;
27
25
  }
28
26
  }
29
-
30
27
  return indexA - indexB;
31
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
32
-
28
+ };
33
29
 
30
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
34
31
  export var SkipLinksController = function SkipLinksController(_ref) {
35
32
  var children = _ref.children;
36
-
37
33
  var _useState = useState([]),
38
- _useState2 = _slicedToArray(_useState, 2),
39
- links = _useState2[0],
40
- setLinks = _useState2[1];
41
-
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ links = _useState2[0],
36
+ setLinks = _useState2[1];
42
37
  var registerSkipLink = useRef(function (skipLinkData) {
43
38
  // Don't add duplicate SkipLinks
44
39
  setLinks(function (oldLinks) {
@@ -48,7 +43,6 @@ export var SkipLinksController = function SkipLinksController(_ref) {
48
43
  })) {
49
44
  return oldLinks;
50
45
  }
51
-
52
46
  return [].concat(_toConsumableArray(oldLinks), [skipLinkData]).sort(byDOMOrder);
53
47
  });
54
48
  });
@@ -1,25 +1,23 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import { mergeGridStateIntoStorage, removeFromGridStateInStorage } from '../common/utils';
4
-
5
4
  var publishGridState = function publishGridState(gridState) {
6
5
  Object.entries(gridState).forEach(function (_ref) {
7
6
  var _ref2 = _slicedToArray(_ref, 2),
8
- slotName = _ref2[0],
9
- value = _ref2[1];
10
-
7
+ slotName = _ref2[0],
8
+ value = _ref2[1];
11
9
  if (!value) {
12
10
  document.documentElement.style.removeProperty("--".concat(slotName));
13
11
  removeFromGridStateInStorage('gridState', slotName);
14
12
  return;
15
- } //Update the css variable
13
+ }
16
14
 
15
+ //Update the css variable
16
+ document.documentElement.style.setProperty("--".concat(slotName), "".concat(value, "px"));
17
17
 
18
- document.documentElement.style.setProperty("--".concat(slotName), "".concat(value, "px")); // also update state in local storage so that
18
+ // also update state in local storage so that
19
19
  // it persists across page refresh, across tabs etc
20
-
21
20
  mergeGridStateIntoStorage('gridState', _defineProperty({}, slotName, value));
22
21
  });
23
22
  };
24
-
25
23
  export default publishGridState;
@@ -1,5 +1,4 @@
1
1
  import { useEffect } from 'react';
2
-
3
2
  function useUpdateCssVar(cssVar, value) {
4
3
  useEffect(function () {
5
4
  document.documentElement.style.setProperty("--".concat(cssVar), "".concat(value, "px"));
@@ -8,5 +7,4 @@ function useUpdateCssVar(cssVar, value) {
8
7
  };
9
8
  }, [cssVar, value]);
10
9
  }
11
-
12
10
  export default useUpdateCssVar;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "A collection of components which let you compose an application's page layout.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/icon": "^21.11.0",
31
31
  "@atlaskit/motion": "^1.3.0",
32
32
  "@atlaskit/theme": "^12.2.0",
33
- "@atlaskit/tokens": "^0.13.0",
33
+ "@atlaskit/tokens": "^1.0.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "@emotion/react": "^11.7.1",
36
36
  "bind-event-listener": "^2.1.1",