@atlaskit/page-layout 1.3.8 → 1.3.10

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 (106) hide show
  1. package/CHANGELOG.md +13 -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/dist/types/common/types.d.ts +4 -4
  105. package/dist/types/controllers/skip-link-controller.d.ts +4 -2
  106. package/package.json +10 -9
@@ -1,17 +1,18 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
4
5
  import { BANNER_HEIGHT, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../../common/constants';
5
6
  import { useIsSidebarDragging } from '../../../common/hooks';
6
7
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
7
8
  const prefersReducedMotionStyles = css(prefersReducedMotion());
9
+
8
10
  /**
9
11
  * This inner wrapper is required to allow the sidebar to be `position: fixed`.
10
12
  *
11
13
  * If we were to apply `position: fixed` to the outer wrapper, it will be popped
12
14
  * out of its flex container and Main would stretch to occupy all the space.
13
15
  */
14
-
15
16
  const fixedInnerStyles = css({
16
17
  width: `${LEFT_SIDEBAR_WIDTH}`,
17
18
  position: 'fixed',
@@ -23,12 +24,12 @@ const fixedInnerStyles = css({
23
24
  const fixedInnerFlyoutStyles = css({
24
25
  width: LEFT_SIDEBAR_FLYOUT_WIDTH
25
26
  });
27
+
26
28
  /**
27
29
  * Static in the sense of `position: static`.
28
30
  *
29
31
  * It will expand the page height to fit its content.
30
32
  */
31
-
32
33
  const staticInnerStyles = css({
33
34
  height: '100%'
34
35
  });
@@ -37,7 +38,6 @@ const draggingStyles = css({
37
38
  // Make sure drag to resize does not animate as the user drags
38
39
  transition: 'none'
39
40
  });
40
-
41
41
  const LeftSidebarInner = ({
42
42
  children,
43
43
  isFixed = false,
@@ -47,7 +47,7 @@ const LeftSidebarInner = ({
47
47
  return jsx("div", {
48
48
  css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
49
49
  }, children);
50
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
51
-
50
+ };
52
51
 
52
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
53
53
  export default LeftSidebarInner;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { forwardRef } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -25,12 +24,12 @@ const draggingStyles = css({
25
24
  // Make sure drag to resize does not animate as the user drags
26
25
  transition: 'none'
27
26
  });
27
+
28
28
  /**
29
29
  * In fixed mode this element's child is taken out of the document flow.
30
30
  * It doesn't take up the width as expected,
31
31
  * so the pseudo element forces it to take up the necessary width.
32
32
  */
33
-
34
33
  const fixedStyles = css({
35
34
  '::after': {
36
35
  display: 'inline-block',
@@ -45,7 +44,6 @@ const flyoutFixedStyles = css({
45
44
  width: COLLAPSED_LEFT_SIDEBAR_WIDTH
46
45
  });
47
46
  const selector = getPageLayoutSlotSelector('left-sidebar');
48
-
49
47
  const LeftSidebarOuter = ({
50
48
  children,
51
49
  isFixed = false,
@@ -75,5 +73,4 @@ const LeftSidebarOuter = ({
75
73
  ref: ref
76
74
  }, selector), children));
77
75
  };
78
-
79
76
  export default /*#__PURE__*/forwardRef(LeftSidebarOuter);
@@ -1,17 +1,18 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { prefersReducedMotion } from '@atlaskit/motion';
4
5
  import { TRANSITION_DURATION } from '../../../common/constants';
5
6
  import { useIsSidebarCollapsing } from '../../../common/hooks';
6
7
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
7
8
  const prefersReducedMotionStyles = css(prefersReducedMotion());
9
+
8
10
  /**
9
11
  * The transition duration is intentionally set to 0ms.
10
12
  *
11
13
  * A transition is being used here to delay the setting of
12
14
  * opacity and visibility so that it syncs collapsing sidebar.
13
15
  */
14
-
15
16
  const hideLeftSidebarContentsStyles = css({
16
17
  opacity: 0,
17
18
  transition: `opacity 0ms linear, visibility 0ms linear`,
@@ -29,7 +30,6 @@ const fixedChildrenWrapperStyles = css({
29
30
  minWidth: 240,
30
31
  height: '100%'
31
32
  });
32
-
33
33
  const ResizableChildrenWrapper = ({
34
34
  children,
35
35
  isLeftSidebarCollapsed = false,
@@ -44,7 +44,7 @@ const ResizableChildrenWrapper = ({
44
44
  }, jsx("div", {
45
45
  css: fixedChildrenWrapperStyles
46
46
  }, children));
47
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
48
-
47
+ };
49
48
 
49
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
50
50
  export default ResizableChildrenWrapper;
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { ClassNames, css, jsx } from '@emotion/react';
3
4
  import { B100 } from '@atlaskit/theme/colors';
4
5
  const focusStyles = css({
@@ -11,11 +12,11 @@ const focusStyles = css({
11
12
  }
12
13
  }
13
14
  });
15
+
14
16
  /**
15
17
  * Sidebars have an outer and inner component,
16
18
  * so the nested selector needs to target an extra level deeper.
17
19
  */
18
-
19
20
  const sidebarFocusStyles = css({
20
21
  ':focus': {
21
22
  outline: 'none',
@@ -26,6 +27,7 @@ const sidebarFocusStyles = css({
26
27
  }
27
28
  }
28
29
  });
30
+
29
31
  /**
30
32
  * We don't use `@atlaskit/focus-ring` here,
31
33
  * because we need inset focus styles and:
@@ -35,7 +37,6 @@ const sidebarFocusStyles = css({
35
37
  * 2. We cannot wrap `children` in `FocusRing`,
36
38
  * because there's no guarantee the passed child takes `className`.
37
39
  */
38
-
39
40
  const SlotFocusRing = ({
40
41
  children,
41
42
  isSidebar = false
@@ -46,5 +47,4 @@ const SlotFocusRing = ({
46
47
  className: isSidebar ? css(sidebarFocusStyles) : css(focusStyles)
47
48
  }));
48
49
  };
49
-
50
50
  export default SlotFocusRing;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { useEffect } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -18,6 +17,7 @@ const leftPanelFixedStyles = css({
18
17
  bottom: 0,
19
18
  left: 0
20
19
  });
20
+
21
21
  /**
22
22
  * __Left panel__
23
23
  *
@@ -26,7 +26,6 @@ const leftPanelFixedStyles = css({
26
26
  * - [Examples](https://atlassian.design/components/page-layout/examples)
27
27
  * - [Code](https://atlassian.design/components/page-layout/code)
28
28
  */
29
-
30
29
  const LeftPanel = props => {
31
30
  const {
32
31
  children,
@@ -61,5 +60,4 @@ const LeftPanel = props => {
61
60
  value: leftPanelWidth
62
61
  }), children));
63
62
  };
64
-
65
63
  export default LeftPanel;
@@ -7,6 +7,7 @@ import { publishGridState, useSkipLink } from '../../controllers';
7
7
  import LeftSidebarInner from './internal/left-sidebar-inner';
8
8
  import LeftSidebarOuter from './internal/left-sidebar-outer';
9
9
  import SlotDimensions from './slot-dimensions';
10
+
10
11
  /**
11
12
  * __Left sidebar without resize__
12
13
  *
@@ -15,7 +16,6 @@ import SlotDimensions from './slot-dimensions';
15
16
  * - [Examples](https://atlassian.design/components/page-layout/examples)
16
17
  * - [Code](https://atlassian.design/components/page-layout/code)
17
18
  */
18
-
19
19
  const LeftSidebarWithoutResize = props => {
20
20
  const {
21
21
  children,
@@ -49,5 +49,4 @@ const LeftSidebarWithoutResize = props => {
49
49
  isFixed: isFixed
50
50
  }, children));
51
51
  };
52
-
53
52
  export default LeftSidebarWithoutResize;
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
-
3
2
  /** @jsx jsx */
4
3
  import { useContext, useEffect, useRef } from 'react';
5
4
  import { jsx } from '@emotion/react';
@@ -11,6 +10,7 @@ import LeftSidebarInner from './internal/left-sidebar-inner';
11
10
  import LeftSidebarOuter from './internal/left-sidebar-outer';
12
11
  import ResizableChildrenWrapper from './internal/resizable-children-wrapper';
13
12
  import SlotDimensions from './slot-dimensions';
13
+
14
14
  /**
15
15
  * __Left sidebar__
16
16
  *
@@ -19,7 +19,6 @@ import SlotDimensions from './slot-dimensions';
19
19
  * - [Examples](https://atlassian.design/components/page-layout/examples)
20
20
  * - [Code](https://atlassian.design/components/page-layout/code)
21
21
  */
22
-
23
22
  const LeftSidebar = props => {
24
23
  const {
25
24
  children,
@@ -59,7 +58,9 @@ const LeftSidebar = props => {
59
58
  const mouseXRef = useRef(0);
60
59
  const handlerRef = useRef(null);
61
60
  useEffect(() => {
62
- isLockedRef.current = isLocked; // I tried a one-time `mousemove` handler that gets attached
61
+ isLockedRef.current = isLocked;
62
+
63
+ // I tried a one-time `mousemove` handler that gets attached
63
64
  // when the lock releases. This is not robust because
64
65
  // the mouse can stay still after release (e.g. using keyboard)
65
66
  // and the sidebar will erroneously stay open.
@@ -70,52 +71,44 @@ const LeftSidebar = props => {
70
71
  handlerRef.current = event => {
71
72
  mouseXRef.current = event.clientX;
72
73
  };
73
-
74
74
  document.addEventListener('mousemove', handlerRef.current);
75
75
  }
76
-
77
76
  if (!isLocked && handlerRef.current) {
78
77
  if (mouseXRef.current >= lastLeftSidebarWidth) {
79
- setLeftSidebarState({ ...leftSidebarState,
78
+ setLeftSidebarState({
79
+ ...leftSidebarState,
80
80
  isFlyoutOpen: false
81
81
  });
82
82
  }
83
-
84
83
  document.removeEventListener('mousemove', handlerRef.current);
85
84
  handlerRef.current = null;
86
85
  }
87
-
88
86
  return () => {
89
87
  if (handlerRef.current) {
90
88
  document.removeEventListener('mousemove', handlerRef.current);
91
89
  }
92
90
  };
93
91
  }, [isLocked, lastLeftSidebarWidth, leftSidebarState, setLeftSidebarState]);
94
-
95
92
  const _width = Math.max(width || 0, DEFAULT_LEFT_SIDEBAR_WIDTH);
96
-
97
93
  const collapsedStateOverrideOpen = collapsedState === 'expanded';
98
94
  let leftSidebarWidthOnMount;
99
-
100
95
  if (collapsedStateOverrideOpen) {
101
96
  leftSidebarWidthOnMount = resolveDimension(VAR_LEFT_SIDEBAR_FLYOUT, _width, !width);
102
97
  } else if (isLeftSidebarCollapsed || collapsedState === 'collapsed') {
103
98
  leftSidebarWidthOnMount = COLLAPSED_LEFT_SIDEBAR_WIDTH;
104
99
  } else {
105
100
  leftSidebarWidthOnMount = resolveDimension(VAR_LEFT_SIDEBAR_WIDTH, _width, !width || !collapsedStateOverrideOpen && getGridStateFromStorage('isLeftSidebarCollapsed'));
106
- } // Update state from cache on mount
107
-
101
+ }
108
102
 
103
+ // Update state from cache on mount
109
104
  useEffect(() => {
110
105
  const cachedCollapsedState = !collapsedStateOverrideOpen && (collapsedState === 'collapsed' || getGridStateFromStorage('isLeftSidebarCollapsed') || false);
111
106
  const cachedGridState = getGridStateFromStorage('gridState') || {};
112
107
  let leftSidebarWidth = !width && cachedGridState[VAR_LEFT_SIDEBAR_FLYOUT] ? Math.max(cachedGridState[VAR_LEFT_SIDEBAR_FLYOUT], DEFAULT_LEFT_SIDEBAR_WIDTH) : _width;
113
108
  const lastLeftSidebarWidth = !width && cachedGridState[VAR_LEFT_SIDEBAR_FLYOUT] ? Math.max(cachedGridState[VAR_LEFT_SIDEBAR_FLYOUT], DEFAULT_LEFT_SIDEBAR_WIDTH) : _width;
114
-
115
109
  if (cachedCollapsedState) {
116
110
  leftSidebarWidth = COLLAPSED_LEFT_SIDEBAR_WIDTH;
117
111
  }
118
-
119
112
  setLeftSidebarState({
120
113
  isFlyoutOpen: false,
121
114
  isResizing,
@@ -124,10 +117,12 @@ const LeftSidebar = props => {
124
117
  lastLeftSidebarWidth,
125
118
  flyoutLockCount: 0,
126
119
  isFixed
127
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
128
- }, []); // Every time other than mount,
129
- // update the local storage and css variables.
120
+ });
121
+ // eslint-disable-next-line react-hooks/exhaustive-deps
122
+ }, []);
130
123
 
124
+ // Every time other than mount,
125
+ // update the local storage and css variables.
131
126
  const notFirstRun = useRef(false);
132
127
  useEffect(() => {
133
128
  if (notFirstRun.current) {
@@ -137,82 +132,72 @@ const LeftSidebar = props => {
137
132
  });
138
133
  mergeGridStateIntoStorage('isLeftSidebarCollapsed', isLeftSidebarCollapsed);
139
134
  }
140
-
141
135
  if (!notFirstRun.current) {
142
136
  notFirstRun.current = true;
143
137
  }
144
-
145
138
  return () => {
146
139
  removeMouseOverListener();
147
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
140
+ };
141
+ // eslint-disable-next-line react-hooks/exhaustive-deps
148
142
  }, [isLeftSidebarCollapsed, leftSidebarWidth, id]);
149
-
150
143
  const onMouseOver = event => {
151
144
  const isMouseOnResizeButton = event.target.matches(`[${RESIZE_BUTTON_SELECTOR}]`) || event.target.matches(`[${RESIZE_BUTTON_SELECTOR}] *`);
152
-
153
145
  if (isFlyoutOpen || isMouseOnResizeButton || !isLeftSidebarCollapsed) {
154
146
  return;
155
147
  }
156
-
157
148
  event.persist();
158
149
  flyoutTimerRef.current && clearTimeout(flyoutTimerRef.current);
159
-
160
150
  if (!mouseOverEventRef.current) {
161
151
  mouseOverEventRef.current = event => {
162
152
  const leftSidebar = leftSideBarRef.current;
163
-
164
153
  if (leftSidebar === null || isLockedRef.current) {
165
154
  return;
166
155
  }
167
-
168
156
  if (!leftSidebar.contains(event.target)) {
169
157
  flyoutTimerRef.current && clearTimeout(flyoutTimerRef.current);
170
158
  onFlyoutCollapse && onFlyoutCollapse();
171
- setLeftSidebarState(current => ({ ...current,
159
+ setLeftSidebarState(current => ({
160
+ ...current,
172
161
  isFlyoutOpen: false
173
162
  }));
174
163
  removeMouseOverListener();
175
164
  }
176
165
  };
177
166
  }
178
-
179
167
  document.addEventListener('mouseover', mouseOverEventRef.current, {
180
168
  capture: true,
181
169
  passive: true
182
170
  });
183
171
  flyoutTimerRef.current = setTimeout(() => {
184
- setLeftSidebarState(current => ({ ...current,
172
+ setLeftSidebarState(current => ({
173
+ ...current,
185
174
  isFlyoutOpen: true
186
175
  }));
187
176
  onFlyoutExpand && onFlyoutExpand();
188
177
  }, FLYOUT_DELAY);
189
178
  };
190
-
191
179
  const removeMouseOverListener = () => {
192
180
  mouseOverEventRef.current && document.removeEventListener('mouseover', mouseOverEventRef.current, {
193
181
  capture: true,
194
182
  passive: true
195
183
  });
196
184
  };
197
-
198
185
  useSkipLink(id, skipLinkTitle);
199
-
200
186
  const onMouseLeave = event => {
201
187
  const isMouseOnResizeButton = event.target.matches(`[${RESIZE_BUTTON_SELECTOR}]`) || event.target.matches(`[${RESIZE_BUTTON_SELECTOR}] *`);
202
-
203
188
  if (isMouseOnResizeButton || !isLeftSidebarCollapsed || flyoutLockCount > 0) {
204
189
  return;
205
190
  }
206
-
207
191
  onFlyoutCollapse && onFlyoutCollapse();
208
192
  setTimeout(() => {
209
- setLeftSidebarState(current => ({ ...current,
193
+ setLeftSidebarState(current => ({
194
+ ...current,
210
195
  isFlyoutOpen: false
211
196
  }));
212
197
  }, FLYOUT_DELAY);
213
198
  };
214
-
215
- return (// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
199
+ return (
200
+ // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
216
201
  jsx(LeftSidebarOuter, {
217
202
  ref: leftSideBarRef,
218
203
  testId: testId,
@@ -234,7 +219,8 @@ const LeftSidebar = props => {
234
219
  }, children), jsx(ResizeControl, {
235
220
  testId: testId,
236
221
  resizeGrabAreaLabel: resizeGrabAreaLabel,
237
- resizeButtonLabel: resizeButtonLabel // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
222
+ resizeButtonLabel: resizeButtonLabel
223
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
238
224
  ,
239
225
  overrides: overrides,
240
226
  onCollapse: onCollapse,
@@ -246,5 +232,4 @@ const LeftSidebar = props => {
246
232
  })))
247
233
  );
248
234
  };
249
-
250
235
  export default LeftSidebar;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { useContext } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -9,8 +8,9 @@ import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, TRANSI
9
8
  import { useIsSidebarDragging } from '../../common/hooks';
10
9
  import { getPageLayoutSlotSelector } from '../../common/utils';
11
10
  import { SidebarResizeContext, useSkipLink } from '../../controllers';
12
- import SlotFocusRing from './internal/slot-focus-ring'; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
11
+ import SlotFocusRing from './internal/slot-focus-ring';
13
12
 
13
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
14
14
  const prefersReducedMotionStyles = css(prefersReducedMotion());
15
15
  const mainStyles = css({
16
16
  minWidth: 0,
@@ -25,16 +25,17 @@ const draggingStyles = css({
25
25
  // Make sure drag to resize remains snappy.
26
26
  transition: 'none'
27
27
  });
28
+
28
29
  /**
29
30
  * Adds a negative left margin to main,
30
31
  * which transitions at the same speed as the left sidebar's width increase.
31
32
  * This give an illusion that the flyout is appearing on top of the main content,
32
33
  * while main remains in place.
33
34
  */
34
-
35
35
  const flyoutStyles = css({
36
36
  marginLeft: `calc(-1 * var(--${VAR_LEFT_SIDEBAR_FLYOUT}, ${DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH}px) + ${COLLAPSED_LEFT_SIDEBAR_WIDTH}px)`
37
37
  });
38
+
38
39
  /**
39
40
  * __Main__
40
41
  *
@@ -43,7 +44,6 @@ const flyoutStyles = css({
43
44
  * - [Examples](https://atlassian.design/components/page-layout/examples)
44
45
  * - [Code](https://atlassian.design/components/page-layout/code)
45
46
  */
46
-
47
47
  const Main = props => {
48
48
  const {
49
49
  children,
@@ -68,5 +68,4 @@ const Main = props => {
68
68
  id: id
69
69
  }, getPageLayoutSlotSelector('main')), children));
70
70
  };
71
-
72
71
  export default Main;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { Fragment } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -22,6 +21,7 @@ const gridStyles = css({
22
21
  gridTemplateRows: `${BANNER_HEIGHT} ${TOP_NAVIGATION_HEIGHT} auto`,
23
22
  outline: 'none'
24
23
  });
24
+
25
25
  /**
26
26
  * __Page layout__
27
27
  *
@@ -30,7 +30,6 @@ const gridStyles = css({
30
30
  * - [Examples](https://atlassian.design/components/page-layout/examples)
31
31
  * - [Code](https://atlassian.design/components/page-layout/code)
32
32
  */
33
-
34
33
  const PageLayout = ({
35
34
  skipLinksLabel = DEFAULT_I18N_PROPS_SKIP_LINKS,
36
35
  children,
@@ -49,5 +48,4 @@ const PageLayout = ({
49
48
  onLeftSidebarExpand: onLeftSidebarExpand
50
49
  }, children))));
51
50
  };
52
-
53
51
  export default PageLayout;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { useEffect } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -18,6 +17,7 @@ const fixedStyles = css({
18
17
  right: 0,
19
18
  bottom: 0
20
19
  });
20
+
21
21
  /**
22
22
  * __Right panel__
23
23
  *
@@ -26,7 +26,6 @@ const fixedStyles = css({
26
26
  * - [Examples](https://atlassian.design/components/page-layout/examples)
27
27
  * - [Code](https://atlassian.design/components/page-layout/code)
28
28
  */
29
-
30
29
  const RightPanel = props => {
31
30
  const {
32
31
  children,
@@ -61,5 +60,4 @@ const RightPanel = props => {
61
60
  value: rightPanelWidth
62
61
  }), children));
63
62
  };
64
-
65
63
  export default RightPanel;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { useEffect } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -8,13 +7,13 @@ import { getPageLayoutSlotSelector, resolveDimension } from '../../common/utils'
8
7
  import { publishGridState, useSkipLink } from '../../controllers';
9
8
  import SlotFocusRing from './internal/slot-focus-ring';
10
9
  import SlotDimensions from './slot-dimensions';
10
+
11
11
  /**
12
12
  * This inner wrapper is required to allow the sidebar to be `position: fixed`.
13
13
  *
14
14
  * If we were to apply `position: fixed` to the outer wrapper, it will be popped
15
15
  * out of its flex container and Main would stretch to occupy all the space.
16
16
  */
17
-
18
17
  const fixedInnerStyles = css({
19
18
  /**
20
19
  * This width on the inner wrapper is required when it is using fixed
@@ -32,12 +31,12 @@ const staticInnerStyles = css({
32
31
  const outerStyles = css({
33
32
  width: RIGHT_SIDEBAR_WIDTH
34
33
  });
34
+
35
35
  /**
36
36
  * In fixed mode this element's child is taken out of the document flow.
37
37
  * It doesn't take up the width as expected,
38
38
  * so the pseudo element forces it to take up the necessary width.
39
39
  */
40
-
41
40
  const fixedOuterStyles = css({
42
41
  '&::after': {
43
42
  display: 'inline-block',
@@ -45,6 +44,7 @@ const fixedOuterStyles = css({
45
44
  content: "''"
46
45
  }
47
46
  });
47
+
48
48
  /**
49
49
  * __Right sidebar__
50
50
  *
@@ -53,7 +53,6 @@ const fixedOuterStyles = css({
53
53
  * - [Examples](https://atlassian.design/components/page-layout/examples)
54
54
  * - [Code](https://atlassian.design/components/page-layout/code)
55
55
  */
56
-
57
56
  const RightSidebar = props => {
58
57
  const {
59
58
  children,
@@ -92,5 +91,4 @@ const RightSidebar = props => {
92
91
  css: [isFixed && fixedInnerStyles, !isFixed && staticInnerStyles]
93
92
  }, children)));
94
93
  };
95
-
96
94
  export default RightSidebar;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { useEffect } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -19,6 +18,7 @@ const fixedStyles = css({
19
18
  right: RIGHT_PANEL_WIDTH,
20
19
  left: LEFT_PANEL_WIDTH
21
20
  });
21
+
22
22
  /**
23
23
  * __Top navigation__
24
24
  *
@@ -27,7 +27,6 @@ const 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
  const TopNavigation = props => {
32
31
  const {
33
32
  children,
@@ -62,5 +61,4 @@ const TopNavigation = props => {
62
61
  value: topNavigationHeight
63
62
  }), children));
64
63
  };
65
-
66
64
  export default TopNavigation;
@@ -8,8 +8,8 @@ const leftSidebarState = {
8
8
  lastLeftSidebarWidth: 0,
9
9
  flyoutLockCount: 0,
10
10
  isFixed: true
11
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
12
-
11
+ };
12
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
13
13
  export const SidebarResizeContext = /*#__PURE__*/createContext({
14
14
  isLeftSidebarCollapsed: false,
15
15
  expandLeftSidebar: noop,
@@ -24,6 +24,7 @@ export const usePageLayoutResize = () => {
24
24
  } = useContext(SidebarResizeContext);
25
25
  return context;
26
26
  };
27
+
27
28
  /**
28
29
  * _**WARNING:**_ This hook is intended as a temporary solution and
29
30
  * is likely to be removed in a future version of page-layout.
@@ -41,17 +42,18 @@ export const usePageLayoutResize = () => {
41
42
  * you are rendering. This way the left sidebar will be locked for
42
43
  * as long as the popup is open.
43
44
  */
44
-
45
45
  export const useLeftSidebarFlyoutLock = () => {
46
46
  const {
47
47
  setLeftSidebarState
48
48
  } = useContext(SidebarResizeContext);
49
49
  useEffect(() => {
50
- setLeftSidebarState(current => ({ ...current,
50
+ setLeftSidebarState(current => ({
51
+ ...current,
51
52
  flyoutLockCount: current.flyoutLockCount + 1
52
53
  }));
53
54
  return () => {
54
- setLeftSidebarState(current => ({ ...current,
55
+ setLeftSidebarState(current => ({
56
+ ...current,
55
57
  flyoutLockCount: current.flyoutLockCount - 1
56
58
  }));
57
59
  };