@atlaskit/page-layout 1.2.4 → 1.2.7

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 (95) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/__perf__/utils/perf-example.tsx +2 -2
  3. package/__perf__/utils/product-integration/{AtlassianNavigation.tsx → atlassian-navigation.tsx} +4 -4
  4. package/__perf__/utils/product-integration/{Create.tsx → create.tsx} +2 -1
  5. package/__perf__/utils/product-integration/{HelpPopup.tsx → help-popup.tsx} +1 -0
  6. package/__perf__/utils/product-integration/{NotificationsPopup.tsx → notifications-popup.tsx} +0 -0
  7. package/__perf__/utils/product-integration/{ProfilePopup.tsx → profile-popup.tsx} +2 -1
  8. package/__perf__/utils/product-integration/{SampleFooter.tsx → sample-footer.tsx} +1 -0
  9. package/__perf__/utils/product-integration/{SampleHeader.tsx → sample-header.tsx} +2 -0
  10. package/__perf__/utils/product-integration/{SideNavigation.tsx → side-navigation.tsx} +2 -2
  11. package/dist/cjs/common/safe-local-storage.js +1 -0
  12. package/dist/cjs/components/resize-control/grab-area.js +4 -2
  13. package/dist/cjs/components/resize-control/index.js +21 -7
  14. package/dist/cjs/components/resize-control/resize-button.js +4 -2
  15. package/dist/cjs/components/resize-control/shadow.js +2 -1
  16. package/dist/cjs/components/skip-links/skip-link-components.js +4 -2
  17. package/dist/cjs/components/slots/banner.js +8 -0
  18. package/dist/cjs/components/slots/content.js +8 -0
  19. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +2 -1
  20. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +2 -1
  21. package/dist/cjs/components/slots/left-panel.js +8 -0
  22. package/dist/cjs/components/slots/left-sidebar-without-resize.js +9 -0
  23. package/dist/cjs/components/slots/left-sidebar.js +10 -1
  24. package/dist/cjs/components/slots/main.js +8 -0
  25. package/dist/cjs/components/slots/page-layout.js +8 -0
  26. package/dist/cjs/components/slots/right-panel.js +8 -0
  27. package/dist/cjs/components/slots/right-sidebar.js +8 -0
  28. package/dist/cjs/components/slots/top-navigation.js +8 -0
  29. package/dist/cjs/controllers/sidebar-resize-context.js +8 -7
  30. package/dist/cjs/controllers/sidebar-resize-controller.js +7 -4
  31. package/dist/cjs/controllers/skip-link-context.js +6 -3
  32. package/dist/cjs/controllers/skip-link-controller.js +2 -1
  33. package/dist/cjs/version.json +1 -1
  34. package/dist/es2019/common/safe-local-storage.js +1 -0
  35. package/dist/es2019/components/resize-control/grab-area.js +4 -2
  36. package/dist/es2019/components/resize-control/index.js +19 -7
  37. package/dist/es2019/components/resize-control/resize-button.js +4 -2
  38. package/dist/es2019/components/resize-control/shadow.js +2 -1
  39. package/dist/es2019/components/skip-links/skip-link-components.js +6 -2
  40. package/dist/es2019/components/slots/banner.js +8 -0
  41. package/dist/es2019/components/slots/content.js +8 -0
  42. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +2 -1
  43. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +2 -1
  44. package/dist/es2019/components/slots/left-panel.js +8 -0
  45. package/dist/es2019/components/slots/left-sidebar-without-resize.js +8 -0
  46. package/dist/es2019/components/slots/left-sidebar.js +12 -1
  47. package/dist/es2019/components/slots/main.js +8 -0
  48. package/dist/es2019/components/slots/page-layout.js +8 -0
  49. package/dist/es2019/components/slots/right-panel.js +8 -0
  50. package/dist/es2019/components/slots/right-sidebar.js +8 -0
  51. package/dist/es2019/components/slots/top-navigation.js +8 -0
  52. package/dist/es2019/controllers/sidebar-resize-context.js +4 -5
  53. package/dist/es2019/controllers/sidebar-resize-controller.js +5 -3
  54. package/dist/es2019/controllers/skip-link-context.js +2 -3
  55. package/dist/es2019/controllers/skip-link-controller.js +2 -1
  56. package/dist/es2019/version.json +1 -1
  57. package/dist/esm/common/safe-local-storage.js +1 -0
  58. package/dist/esm/components/resize-control/grab-area.js +4 -2
  59. package/dist/esm/components/resize-control/index.js +20 -7
  60. package/dist/esm/components/resize-control/resize-button.js +4 -2
  61. package/dist/esm/components/resize-control/shadow.js +2 -1
  62. package/dist/esm/components/skip-links/skip-link-components.js +6 -2
  63. package/dist/esm/components/slots/banner.js +8 -0
  64. package/dist/esm/components/slots/content.js +8 -0
  65. package/dist/esm/components/slots/internal/left-sidebar-inner.js +2 -1
  66. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +2 -1
  67. package/dist/esm/components/slots/left-panel.js +8 -0
  68. package/dist/esm/components/slots/left-sidebar-without-resize.js +8 -0
  69. package/dist/esm/components/slots/left-sidebar.js +12 -1
  70. package/dist/esm/components/slots/main.js +8 -0
  71. package/dist/esm/components/slots/page-layout.js +8 -0
  72. package/dist/esm/components/slots/right-panel.js +8 -0
  73. package/dist/esm/components/slots/right-sidebar.js +8 -0
  74. package/dist/esm/components/slots/top-navigation.js +8 -0
  75. package/dist/esm/controllers/sidebar-resize-context.js +4 -5
  76. package/dist/esm/controllers/sidebar-resize-controller.js +5 -3
  77. package/dist/esm/controllers/skip-link-context.js +2 -3
  78. package/dist/esm/controllers/skip-link-controller.js +2 -1
  79. package/dist/esm/version.json +1 -1
  80. package/dist/types/common/types.d.ts +61 -21
  81. package/dist/types/common/utils.d.ts +1 -1
  82. package/dist/types/components/slots/banner.d.ts +8 -0
  83. package/dist/types/components/slots/content.d.ts +12 -2
  84. package/dist/types/components/slots/left-panel.d.ts +8 -0
  85. package/dist/types/components/slots/left-sidebar-without-resize.d.ts +8 -0
  86. package/dist/types/components/slots/left-sidebar.d.ts +8 -0
  87. package/dist/types/components/slots/main.d.ts +8 -0
  88. package/dist/types/components/slots/page-layout.d.ts +8 -0
  89. package/dist/types/components/slots/right-panel.d.ts +8 -0
  90. package/dist/types/components/slots/right-sidebar.d.ts +8 -0
  91. package/dist/types/components/slots/top-navigation.d.ts +8 -0
  92. package/dist/types/controllers/sidebar-resize-context.d.ts +1 -1
  93. package/dist/types/controllers/types.d.ts +9 -3
  94. package/package.json +12 -7
  95. package/report.api.md +219 -0
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
4
  import { useCallback, useContext, useMemo, useRef, useState } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
+ import { bindAll } from 'bind-event-listener';
6
7
  import rafSchd from 'raf-schd';
7
8
  import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_BUTTON_SELECTOR, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
8
9
  import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
@@ -49,6 +50,7 @@ const ResizeControl = ({
49
50
  const offset = useRef(0);
50
51
  const keyboardEventTimeout = useRef();
51
52
  const [isGrabAreaFocused, setIsGrabAreaFocused] = useState(false);
53
+ const unbindEvents = useRef(null);
52
54
 
53
55
  const toggleSideBar = e => {
54
56
  if (isResizing) {
@@ -75,8 +77,13 @@ const ResizeControl = ({
75
77
  }
76
78
 
77
79
  offset.current = event.clientX - leftSidebarState[VAR_LEFT_SIDEBAR_WIDTH] - getLeftPanelWidth();
78
- document.addEventListener('mousemove', onMouseMove);
79
- document.addEventListener('mouseup', onMouseUp);
80
+ unbindEvents.current = bindAll(document, [{
81
+ type: 'mousemove',
82
+ listener: onMouseMove
83
+ }, {
84
+ type: 'mouseup',
85
+ listener: onMouseUp
86
+ }]);
80
87
  document.documentElement.setAttribute(IS_SIDEBAR_DRAGGING, 'true');
81
88
  const newLeftbarState = { ...leftSidebarState,
82
89
  isResizing: true
@@ -86,9 +93,11 @@ const ResizeControl = ({
86
93
  };
87
94
 
88
95
  const cancelDrag = shouldCollapse => {
96
+ var _unbindEvents$current;
97
+
89
98
  onMouseMove.cancel();
90
- document.removeEventListener('mousemove', onMouseMove);
91
- document.removeEventListener('mouseup', onMouseUp);
99
+ (_unbindEvents$current = unbindEvents.current) === null || _unbindEvents$current === void 0 ? void 0 : _unbindEvents$current.call(unbindEvents);
100
+ unbindEvents.current = null;
92
101
  document.documentElement.removeAttribute(IS_SIDEBAR_DRAGGING);
93
102
  offset.current = 0;
94
103
  collapseLeftSidebar(undefined, true);
@@ -113,10 +122,12 @@ const ResizeControl = ({
113
122
  });
114
123
 
115
124
  const cleanupAfterResize = () => {
125
+ var _unbindEvents$current2;
126
+
116
127
  x.current = 0;
117
128
  offset.current = 0;
118
- document.removeEventListener('mousemove', onMouseMove);
119
- document.removeEventListener('mouseup', onMouseUp);
129
+ (_unbindEvents$current2 = unbindEvents.current) === null || _unbindEvents$current2 === void 0 ? void 0 : _unbindEvents$current2.call(unbindEvents);
130
+ unbindEvents.current = null;
120
131
  };
121
132
 
122
133
  let updatedLeftSidebarState = {};
@@ -263,6 +274,7 @@ const ResizeControl = ({
263
274
  testId: testId && `${testId}-resize-button`
264
275
  }));
265
276
  /* eslint-enable jsx-a11y/role-supports-aria-props */
266
- };
277
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
278
+
267
279
 
268
280
  export default ResizeControl;
@@ -83,11 +83,13 @@ const ResizeButton = ({
83
83
  "data-testid": testId // Prevents focus staying attached to the button
84
84
  // when pressed
85
85
  ,
86
- onMouseDown: preventDefault
86
+ onMouseDown: preventDefault // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
87
+
87
88
  }, props), jsx(ChevronRight, {
88
89
  label: ""
89
90
  }), jsx("div", {
90
91
  css: increaseHitAreaStyles
91
- }));
92
+ })); // eslint-disable-next-line @repo/internal/react/require-jsdoc
93
+
92
94
 
93
95
  export default ResizeButton;
@@ -38,6 +38,7 @@ const Shadow = ({
38
38
  "data-testid": testId,
39
39
  css: [shadowStyles, isDragging && draggingStyles]
40
40
  });
41
- };
41
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
42
+
42
43
 
43
44
  export default Shadow;
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
+
1
3
  /** @jsx jsx */
2
4
  import { css, jsx } from '@emotion/core';
3
5
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
@@ -48,7 +50,8 @@ const assignIndex = (num, arr) => {
48
50
  }
49
51
 
50
52
  return assignIndex(num + 1, arr);
51
- };
53
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
54
+
52
55
 
53
56
  export const SkipLinkWrapper = ({
54
57
  skipLinksLabel
@@ -142,7 +145,8 @@ const focusTargetRef = href => event => {
142
145
  }
143
146
 
144
147
  return false;
145
- };
148
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
149
+
146
150
 
147
151
  export const SkipLink = ({
148
152
  href,
@@ -19,6 +19,14 @@ const bannerFixedStyles = css({
19
19
  right: RIGHT_PANEL_WIDTH,
20
20
  left: LEFT_PANEL_WIDTH
21
21
  });
22
+ /**
23
+ * __Banner__
24
+ *
25
+ * Provides a slot for a Banner within the PageLayout.
26
+ *
27
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
28
+ * - [Code](https://atlassian.design/components/page-layout/code)
29
+ */
22
30
 
23
31
  const Banner = props => {
24
32
  const {
@@ -7,6 +7,14 @@ const contentStyles = css({
7
7
  position: 'relative',
8
8
  gridArea: CONTENT
9
9
  });
10
+ /**
11
+ * __Content__
12
+ *
13
+ * Provides a slot for your application content within the PageLayout.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
16
+ * - [Code](https://atlassian.design/components/page-layout/code)
17
+ */
10
18
 
11
19
  const Content = props => {
12
20
  const {
@@ -47,6 +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
- };
50
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
51
+
51
52
 
52
53
  export default LeftSidebarInner;
@@ -44,6 +44,7 @@ const ResizableChildrenWrapper = ({
44
44
  }, jsx("div", {
45
45
  css: fixedChildrenWrapperStyles
46
46
  }, children));
47
- };
47
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
48
+
48
49
 
49
50
  export default ResizableChildrenWrapper;
@@ -18,6 +18,14 @@ const leftPanelFixedStyles = css({
18
18
  bottom: 0,
19
19
  left: 0
20
20
  });
21
+ /**
22
+ * __Left panel__
23
+ *
24
+ * Provides a slot for a left panel within the PageLayout.
25
+ *
26
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
27
+ * - [Code](https://atlassian.design/components/page-layout/code)
28
+ */
21
29
 
22
30
  const LeftPanel = props => {
23
31
  const {
@@ -7,6 +7,14 @@ 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
+ /**
11
+ * __Left sidebar without resize__
12
+ *
13
+ * Provides a slot for a left sidebar without resize within the PageLayout.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
16
+ * - [Code](https://atlassian.design/components/page-layout/code)
17
+ */
10
18
 
11
19
  const LeftSidebarWithoutResize = props => {
12
20
  const {
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
+
1
3
  /** @jsx jsx */
2
4
  import { useContext, useEffect, useRef } from 'react';
3
5
  import { jsx } from '@emotion/core';
@@ -9,6 +11,14 @@ import LeftSidebarInner from './internal/left-sidebar-inner';
9
11
  import LeftSidebarOuter from './internal/left-sidebar-outer';
10
12
  import ResizableChildrenWrapper from './internal/resizable-children-wrapper';
11
13
  import SlotDimensions from './slot-dimensions';
14
+ /**
15
+ * __Left sidebar__
16
+ *
17
+ * Provides a slot for a left sidebar within the PageLayout.
18
+ *
19
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
20
+ * - [Code](https://atlassian.design/components/page-layout/code)
21
+ */
12
22
 
13
23
  const LeftSidebar = props => {
14
24
  const {
@@ -224,7 +234,8 @@ const LeftSidebar = props => {
224
234
  }, children), jsx(ResizeControl, {
225
235
  testId: testId,
226
236
  resizeGrabAreaLabel: resizeGrabAreaLabel,
227
- resizeButtonLabel: resizeButtonLabel,
237
+ resizeButtonLabel: resizeButtonLabel // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
238
+ ,
228
239
  overrides: overrides,
229
240
  onCollapse: onCollapse,
230
241
  onExpand: onExpand,
@@ -35,6 +35,14 @@ const draggingStyles = css({
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
+ /**
39
+ * __Main__
40
+ *
41
+ * Provides a slot for main content within the PageLayout.
42
+ *
43
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
44
+ * - [Code](https://atlassian.design/components/page-layout/code)
45
+ */
38
46
 
39
47
  const Main = props => {
40
48
  const {
@@ -22,6 +22,14 @@ const gridStyles = css({
22
22
  gridTemplateRows: `${BANNER_HEIGHT} ${TOP_NAVIGATION_HEIGHT} auto`,
23
23
  outline: 'none'
24
24
  });
25
+ /**
26
+ * __Page layout__
27
+ *
28
+ * A collection of components which let you compose an application's page layout.
29
+ *
30
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
31
+ * - [Code](https://atlassian.design/components/page-layout/code)
32
+ */
25
33
 
26
34
  const PageLayout = ({
27
35
  skipLinksLabel = DEFAULT_I18N_PROPS_SKIP_LINKS,
@@ -18,6 +18,14 @@ const fixedStyles = css({
18
18
  right: 0,
19
19
  bottom: 0
20
20
  });
21
+ /**
22
+ * __Right panel__
23
+ *
24
+ * Provides a slot for a right panel within the PageLayout.
25
+ *
26
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
27
+ * - [Code](https://atlassian.design/components/page-layout/code)
28
+ */
21
29
 
22
30
  const RightPanel = props => {
23
31
  const {
@@ -45,6 +45,14 @@ const fixedOuterStyles = css({
45
45
  content: "''"
46
46
  }
47
47
  });
48
+ /**
49
+ * __Right sidebar__
50
+ *
51
+ * Provides a slot for a right sidebar within the PageLayout.
52
+ *
53
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
54
+ * - [Code](https://atlassian.design/components/page-layout/code)
55
+ */
48
56
 
49
57
  const RightSidebar = props => {
50
58
  const {
@@ -19,6 +19,14 @@ const fixedStyles = css({
19
19
  right: RIGHT_PANEL_WIDTH,
20
20
  left: LEFT_PANEL_WIDTH
21
21
  });
22
+ /**
23
+ * __Top navigation__
24
+ *
25
+ * Provides a slot for top navigation within the PageLayout.
26
+ *
27
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
28
+ * - [Code](https://atlassian.design/components/page-layout/code)
29
+ */
22
30
 
23
31
  const TopNavigation = props => {
24
32
  const {
@@ -1,7 +1,5 @@
1
1
  import { createContext, useContext, useEffect } from 'react';
2
-
3
- const noop = () => {};
4
-
2
+ import noop from '@atlaskit/ds-lib/noop';
5
3
  const leftSidebarState = {
6
4
  isFlyoutOpen: false,
7
5
  isResizing: false,
@@ -10,7 +8,8 @@ const leftSidebarState = {
10
8
  lastLeftSidebarWidth: 0,
11
9
  flyoutLockCount: 0,
12
10
  isFixed: true
13
- };
11
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
12
+
14
13
  export const SidebarResizeContext = /*#__PURE__*/createContext({
15
14
  isLeftSidebarCollapsed: false,
16
15
  expandLeftSidebar: noop,
@@ -26,7 +25,7 @@ export const usePageLayoutResize = () => {
26
25
  return context;
27
26
  };
28
27
  /**
29
- * **WARNING:** This hook is intended as a temporary solution and
28
+ * _**WARNING:**_ This hook is intended as a temporary solution and
30
29
  * is likely to be removed in a future version of page-layout.
31
30
  *
32
31
  * ---
@@ -1,15 +1,15 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import noop from '@atlaskit/ds-lib/noop';
2
3
  import { isReducedMotion } from '@atlaskit/motion';
3
4
  import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, GRAB_AREA_SELECTOR, IS_SIDEBAR_COLLAPSING } from '../common/constants';
4
5
  import { getPageLayoutSlotCSSSelector } from '../common/utils';
5
6
  import { SidebarResizeContext } from './sidebar-resize-context';
6
7
 
7
- const noop = () => {};
8
-
9
8
  const handleDataAttributesAndCb = (callback = noop, isLeftSidebarCollapsed, leftSidebarState) => {
10
9
  document.documentElement.removeAttribute(IS_SIDEBAR_COLLAPSING);
11
10
  callback(leftSidebarState);
12
- };
11
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
12
+
13
13
 
14
14
  export const SidebarResizeController = ({
15
15
  children,
@@ -34,6 +34,7 @@ export const SidebarResizeController = ({
34
34
  const $leftSidebarResizeController = document.querySelector(`[${GRAB_AREA_SELECTOR}]`);
35
35
  const isCollapsed = !!$leftSidebarResizeController && $leftSidebarResizeController.hasAttribute('disabled');
36
36
  handleDataAttributesAndCb(isCollapsed ? onCollapse : onExpand, isCollapsed, leftSidebarState); // Make sure multiple event handlers do not get attached
37
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
37
38
 
38
39
  document.querySelector(leftSidebarSelector).removeEventListener('transitionend', transitionEventHandler);
39
40
  } // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -43,6 +44,7 @@ export const SidebarResizeController = ({
43
44
  const $leftSidebar = document.querySelector(leftSidebarSelector);
44
45
 
45
46
  if ($leftSidebar && !isReducedMotion()) {
47
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
46
48
  $leftSidebar.addEventListener('transitionend', transitionEventHandler);
47
49
  }
48
50
  }, [isLeftSidebarCollapsed, leftSidebarSelector, leftSidebarState, onCollapse, onExpand, transitionEventHandler]);
@@ -1,7 +1,6 @@
1
1
  import { createContext, useContext, useEffect } from 'react';
2
-
3
- const noop = () => {};
4
-
2
+ import noop from '@atlaskit/ds-lib/noop';
3
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
5
4
  export const SkipLinksContext = /*#__PURE__*/createContext({
6
5
  skipLinksData: [],
7
6
  registerSkipLink: noop,
@@ -26,7 +26,8 @@ const byDOMOrder = (a, b) => {
26
26
  }
27
27
 
28
28
  return indexA - indexB;
29
- };
29
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
30
+
30
31
 
31
32
  export const SkipLinksController = ({
32
33
  children
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.2.4",
3
+ "version": "1.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -4,6 +4,7 @@
4
4
  var isLocalStorageSupported = function isLocalStorageSupported() {
5
5
  try {
6
6
  // use an random key to test
7
+ // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
7
8
  var testKey = "__test_".concat(Date.now(), "__");
8
9
  localStorage.setItem(testKey, testKey);
9
10
  localStorage.removeItem(testKey);
@@ -59,10 +59,12 @@ var GrabArea = function GrabArea(_ref) {
59
59
  return jsx("button", _extends({}, grabAreaSelector, {
60
60
  "data-testid": testId,
61
61
  type: "button",
62
- css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
62
+ css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles] // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
63
+
63
64
  }, rest), jsx("span", _extends({
64
65
  css: lineStyles
65
66
  }, grabAreaLineSelector)));
66
- };
67
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
68
+
67
69
 
68
70
  export default GrabArea;
@@ -9,6 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
9
  /** @jsx jsx */
10
10
  import { useCallback, useContext, useMemo, useRef, useState } from 'react';
11
11
  import { css, jsx } from '@emotion/core';
12
+ import { bindAll } from 'bind-event-listener';
12
13
  import rafSchd from 'raf-schd';
13
14
  import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_BUTTON_SELECTOR, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
14
15
  import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
@@ -60,6 +61,8 @@ var ResizeControl = function ResizeControl(_ref) {
60
61
  isGrabAreaFocused = _useState2[0],
61
62
  setIsGrabAreaFocused = _useState2[1];
62
63
 
64
+ var unbindEvents = useRef(null);
65
+
63
66
  var toggleSideBar = function toggleSideBar(e) {
64
67
  if (isResizing) {
65
68
  return;
@@ -86,8 +89,13 @@ var ResizeControl = function ResizeControl(_ref) {
86
89
  }
87
90
 
88
91
  offset.current = event.clientX - leftSidebarState[VAR_LEFT_SIDEBAR_WIDTH] - getLeftPanelWidth();
89
- document.addEventListener('mousemove', onMouseMove);
90
- document.addEventListener('mouseup', onMouseUp);
92
+ unbindEvents.current = bindAll(document, [{
93
+ type: 'mousemove',
94
+ listener: onMouseMove
95
+ }, {
96
+ type: 'mouseup',
97
+ listener: onMouseUp
98
+ }]);
91
99
  document.documentElement.setAttribute(IS_SIDEBAR_DRAGGING, 'true');
92
100
 
93
101
  var newLeftbarState = _objectSpread(_objectSpread({}, leftSidebarState), {}, {
@@ -99,9 +107,11 @@ var ResizeControl = function ResizeControl(_ref) {
99
107
  };
100
108
 
101
109
  var cancelDrag = function cancelDrag(shouldCollapse) {
110
+ var _unbindEvents$current;
111
+
102
112
  onMouseMove.cancel();
103
- document.removeEventListener('mousemove', onMouseMove);
104
- document.removeEventListener('mouseup', onMouseUp);
113
+ (_unbindEvents$current = unbindEvents.current) === null || _unbindEvents$current === void 0 ? void 0 : _unbindEvents$current.call(unbindEvents);
114
+ unbindEvents.current = null;
105
115
  document.documentElement.removeAttribute(IS_SIDEBAR_DRAGGING);
106
116
  offset.current = 0;
107
117
  collapseLeftSidebar(undefined, true);
@@ -124,10 +134,12 @@ var ResizeControl = function ResizeControl(_ref) {
124
134
  });
125
135
 
126
136
  var cleanupAfterResize = function cleanupAfterResize() {
137
+ var _unbindEvents$current2;
138
+
127
139
  x.current = 0;
128
140
  offset.current = 0;
129
- document.removeEventListener('mousemove', onMouseMove);
130
- document.removeEventListener('mouseup', onMouseUp);
141
+ (_unbindEvents$current2 = unbindEvents.current) === null || _unbindEvents$current2 === void 0 ? void 0 : _unbindEvents$current2.call(unbindEvents);
142
+ unbindEvents.current = null;
131
143
  };
132
144
 
133
145
  var updatedLeftSidebarState = {};
@@ -274,6 +286,7 @@ var ResizeControl = function ResizeControl(_ref) {
274
286
  testId: testId && "".concat(testId, "-resize-button")
275
287
  }));
276
288
  /* eslint-enable jsx-a11y/role-supports-aria-props */
277
- };
289
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
290
+
278
291
 
279
292
  export default ResizeControl;
@@ -83,12 +83,14 @@ var ResizeButton = function ResizeButton(_ref) {
83
83
  "data-testid": testId // Prevents focus staying attached to the button
84
84
  // when pressed
85
85
  ,
86
- onMouseDown: preventDefault
86
+ onMouseDown: preventDefault // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
87
+
87
88
  }, props), jsx(ChevronRight, {
88
89
  label: ""
89
90
  }), jsx("div", {
90
91
  css: increaseHitAreaStyles
91
92
  }));
92
- };
93
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
94
+
93
95
 
94
96
  export default ResizeButton;
@@ -32,6 +32,7 @@ var Shadow = function Shadow(_ref) {
32
32
  "data-testid": testId,
33
33
  css: [shadowStyles, isDragging && draggingStyles]
34
34
  });
35
- };
35
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
36
+
36
37
 
37
38
  export default Shadow;
@@ -5,6 +5,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
 
6
6
  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; }
7
7
 
8
+ /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
9
+
8
10
  /** @jsx jsx */
9
11
  import { css, jsx } from '@emotion/core';
10
12
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
@@ -55,7 +57,8 @@ var assignIndex = function assignIndex(num, arr) {
55
57
  }
56
58
 
57
59
  return assignIndex(num + 1, arr);
58
- };
60
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
61
+
59
62
 
60
63
  export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
61
64
  var skipLinksLabel = _ref.skipLinksLabel;
@@ -163,7 +166,8 @@ var focusTargetRef = function focusTargetRef(href) {
163
166
 
164
167
  return false;
165
168
  };
166
- };
169
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
170
+
167
171
 
168
172
  export var SkipLink = function SkipLink(_ref3) {
169
173
  var href = _ref3.href,
@@ -20,6 +20,14 @@ var bannerFixedStyles = css({
20
20
  right: RIGHT_PANEL_WIDTH,
21
21
  left: LEFT_PANEL_WIDTH
22
22
  });
23
+ /**
24
+ * __Banner__
25
+ *
26
+ * Provides a slot for a Banner within the PageLayout.
27
+ *
28
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
29
+ * - [Code](https://atlassian.design/components/page-layout/code)
30
+ */
23
31
 
24
32
  var Banner = function Banner(props) {
25
33
  var children = props.children,
@@ -7,6 +7,14 @@ var contentStyles = css({
7
7
  position: 'relative',
8
8
  gridArea: CONTENT
9
9
  });
10
+ /**
11
+ * __Content__
12
+ *
13
+ * Provides a slot for your application content within the PageLayout.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
16
+ * - [Code](https://atlassian.design/components/page-layout/code)
17
+ */
10
18
 
11
19
  var Content = function Content(props) {
12
20
  var children = props.children,
@@ -48,6 +48,7 @@ var LeftSidebarInner = function LeftSidebarInner(_ref) {
48
48
  return jsx("div", {
49
49
  css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
50
50
  }, children);
51
- };
51
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
52
+
52
53
 
53
54
  export default LeftSidebarInner;
@@ -46,6 +46,7 @@ var ResizableChildrenWrapper = function ResizableChildrenWrapper(_ref) {
46
46
  }, jsx("div", {
47
47
  css: fixedChildrenWrapperStyles
48
48
  }, children));
49
- };
49
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
50
+
50
51
 
51
52
  export default ResizableChildrenWrapper;
@@ -19,6 +19,14 @@ var leftPanelFixedStyles = css({
19
19
  bottom: 0,
20
20
  left: 0
21
21
  });
22
+ /**
23
+ * __Left panel__
24
+ *
25
+ * Provides a slot for a left panel within the PageLayout.
26
+ *
27
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
28
+ * - [Code](https://atlassian.design/components/page-layout/code)
29
+ */
22
30
 
23
31
  var LeftPanel = function LeftPanel(props) {
24
32
  var children = props.children,
@@ -9,6 +9,14 @@ import { publishGridState, useSkipLink } from '../../controllers';
9
9
  import LeftSidebarInner from './internal/left-sidebar-inner';
10
10
  import LeftSidebarOuter from './internal/left-sidebar-outer';
11
11
  import SlotDimensions from './slot-dimensions';
12
+ /**
13
+ * __Left sidebar without resize__
14
+ *
15
+ * Provides a slot for a left sidebar without resize within the PageLayout.
16
+ *
17
+ * - [Examples](https://atlassian.design/components/page-layout/examples)
18
+ * - [Code](https://atlassian.design/components/page-layout/code)
19
+ */
12
20
 
13
21
  var LeftSidebarWithoutResize = function LeftSidebarWithoutResize(props) {
14
22
  var children = props.children,