@atlaskit/page-layout 1.0.6 → 1.2.0

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 (127) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +3 -3
  3. package/__perf__/utils/perf-example.tsx +27 -18
  4. package/__perf__/utils/product-integration/Create.tsx +5 -1
  5. package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
  6. package/__perf__/utils/product-integration/SampleFooter.tsx +14 -13
  7. package/dist/cjs/common/constants.js +1 -1
  8. package/dist/cjs/common/hooks/index.js +23 -0
  9. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
  10. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
  11. package/dist/cjs/common/utils.js +3 -3
  12. package/dist/cjs/components/index.js +22 -22
  13. package/dist/cjs/components/resize-control/grab-area.js +43 -5
  14. package/dist/cjs/components/resize-control/index.js +24 -22
  15. package/dist/cjs/components/resize-control/resize-button.js +61 -5
  16. package/dist/cjs/components/resize-control/shadow.js +48 -0
  17. package/dist/cjs/components/skip-links/index.js +4 -4
  18. package/dist/cjs/components/skip-links/skip-link-components.js +53 -9
  19. package/dist/cjs/components/slots/banner.js +27 -11
  20. package/dist/cjs/components/slots/content.js +9 -2
  21. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
  22. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
  23. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
  24. package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
  25. package/dist/cjs/components/slots/left-panel.js +26 -11
  26. package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
  27. package/dist/cjs/components/slots/left-sidebar.js +23 -18
  28. package/dist/cjs/components/slots/main.js +53 -6
  29. package/dist/cjs/components/slots/page-layout.js +10 -3
  30. package/dist/cjs/components/slots/right-panel.js +26 -11
  31. package/dist/cjs/components/slots/right-sidebar.js +57 -13
  32. package/dist/cjs/components/slots/top-navigation.js +27 -11
  33. package/dist/cjs/controllers/index.js +14 -14
  34. package/dist/cjs/controllers/sidebar-resize-context.js +8 -5
  35. package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
  36. package/dist/cjs/controllers/skip-link-context.js +1 -1
  37. package/dist/cjs/index.js +34 -34
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/common/hooks/index.js +2 -0
  40. package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
  41. package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
  42. package/dist/es2019/components/resize-control/grab-area.js +46 -4
  43. package/dist/es2019/components/resize-control/index.js +12 -9
  44. package/dist/es2019/components/resize-control/resize-button.js +61 -4
  45. package/dist/es2019/components/resize-control/shadow.js +43 -0
  46. package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
  47. package/dist/es2019/components/slots/banner.js +21 -7
  48. package/dist/es2019/components/slots/content.js +8 -2
  49. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
  50. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
  51. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
  52. package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
  53. package/dist/es2019/components/slots/left-panel.js +20 -7
  54. package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
  55. package/dist/es2019/components/slots/left-sidebar.js +20 -17
  56. package/dist/es2019/components/slots/main.js +46 -6
  57. package/dist/es2019/components/slots/page-layout.js +15 -3
  58. package/dist/es2019/components/slots/right-panel.js +20 -7
  59. package/dist/es2019/components/slots/right-sidebar.js +50 -8
  60. package/dist/es2019/components/slots/top-navigation.js +21 -7
  61. package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
  62. package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
  63. package/dist/es2019/version.json +1 -1
  64. package/dist/esm/common/hooks/index.js +2 -0
  65. package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
  66. package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
  67. package/dist/esm/common/utils.js +2 -2
  68. package/dist/esm/components/resize-control/grab-area.js +44 -5
  69. package/dist/esm/components/resize-control/index.js +25 -22
  70. package/dist/esm/components/resize-control/resize-button.js +59 -5
  71. package/dist/esm/components/resize-control/shadow.js +37 -0
  72. package/dist/esm/components/skip-links/skip-link-components.js +49 -7
  73. package/dist/esm/components/slots/banner.js +27 -12
  74. package/dist/esm/components/slots/content.js +8 -2
  75. package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
  76. package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
  77. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
  78. package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
  79. package/dist/esm/components/slots/left-panel.js +26 -12
  80. package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
  81. package/dist/esm/components/slots/left-sidebar.js +22 -18
  82. package/dist/esm/components/slots/main.js +49 -8
  83. package/dist/esm/components/slots/page-layout.js +12 -3
  84. package/dist/esm/components/slots/right-panel.js +26 -12
  85. package/dist/esm/components/slots/right-sidebar.js +57 -14
  86. package/dist/esm/components/slots/top-navigation.js +27 -12
  87. package/dist/esm/controllers/sidebar-resize-context.js +6 -4
  88. package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
  89. package/dist/esm/version.json +1 -1
  90. package/dist/types/common/hooks/index.d.ts +2 -0
  91. package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
  92. package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
  93. package/dist/types/components/resize-control/index.d.ts +1 -0
  94. package/dist/types/components/resize-control/resize-button.d.ts +1 -0
  95. package/dist/types/components/resize-control/shadow.d.ts +6 -0
  96. package/dist/types/components/slots/banner.d.ts +1 -0
  97. package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
  98. package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
  99. package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
  100. package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
  101. package/dist/types/components/slots/left-panel.d.ts +1 -0
  102. package/dist/types/components/slots/left-sidebar-without-resize.d.ts +1 -0
  103. package/dist/types/components/slots/left-sidebar.d.ts +1 -0
  104. package/dist/types/components/slots/main.d.ts +1 -0
  105. package/dist/types/components/slots/page-layout.d.ts +1 -0
  106. package/dist/types/components/slots/right-panel.d.ts +1 -0
  107. package/dist/types/components/slots/right-sidebar.d.ts +1 -0
  108. package/dist/types/components/slots/slot-dimensions.d.ts +1 -0
  109. package/dist/types/components/slots/top-navigation.d.ts +1 -0
  110. package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
  111. package/package.json +25 -20
  112. package/dist/cjs/components/resize-control/styles.js +0 -156
  113. package/dist/cjs/components/skip-links/styles.js +0 -58
  114. package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
  115. package/dist/cjs/components/slots/styles.js +0 -154
  116. package/dist/es2019/components/resize-control/styles.js +0 -136
  117. package/dist/es2019/components/skip-links/styles.js +0 -41
  118. package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
  119. package/dist/es2019/components/slots/styles.js +0 -130
  120. package/dist/esm/components/resize-control/styles.js +0 -131
  121. package/dist/esm/components/skip-links/styles.js +0 -45
  122. package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
  123. package/dist/esm/components/slots/styles.js +0 -117
  124. package/dist/types/components/resize-control/styles.d.ts +0 -41
  125. package/dist/types/components/skip-links/styles.d.ts +0 -2
  126. package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
  127. package/dist/types/components/slots/styles.d.ts +0 -23
@@ -3,12 +3,23 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
 
4
4
  /** @jsx jsx */
5
5
  import { useEffect } from 'react';
6
- import { jsx } from '@emotion/core';
7
- import { DEFAULT_TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT } from '../../common/constants';
6
+ import { css, jsx } from '@emotion/core';
7
+ import { BANNER_HEIGHT, DEFAULT_TOP_NAVIGATION_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT } from '../../common/constants';
8
8
  import { getPageLayoutSlotSelector, resolveDimension } from '../../common/utils';
9
9
  import { publishGridState, useSkipLink } from '../../controllers';
10
+ import SlotFocusRing from './internal/slot-focus-ring';
10
11
  import SlotDimensions from './slot-dimensions';
11
- import { topNavigationStyles } from './styles';
12
+ var topNavigationStyles = css({
13
+ height: TOP_NAVIGATION_HEIGHT,
14
+ gridArea: TOP_NAVIGATION
15
+ });
16
+ var fixedStyles = css({
17
+ position: 'fixed',
18
+ zIndex: 2,
19
+ top: BANNER_HEIGHT,
20
+ right: RIGHT_PANEL_WIDTH,
21
+ left: LEFT_PANEL_WIDTH
22
+ });
12
23
 
13
24
  var TopNavigation = function TopNavigation(props) {
14
25
  var children = props.children,
@@ -25,17 +36,21 @@ var TopNavigation = function TopNavigation(props) {
25
36
  publishGridState(_defineProperty({}, VAR_TOP_NAVIGATION_HEIGHT, topNavigationHeight));
26
37
  return function () {
27
38
  publishGridState(_defineProperty({}, VAR_TOP_NAVIGATION_HEIGHT, 0));
28
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ };
29
40
  }, [topNavigationHeight]);
30
41
  useSkipLink(id, skipLinkTitle);
31
- return jsx("div", _extends({
32
- css: topNavigationStyles(isFixed),
33
- "data-testid": testId,
34
- id: id
35
- }, getPageLayoutSlotSelector('top-navigation')), jsx(SlotDimensions, {
36
- variableName: VAR_TOP_NAVIGATION_HEIGHT,
37
- value: topNavigationHeight
38
- }), children);
42
+ return jsx(SlotFocusRing, null, function (_ref) {
43
+ var className = _ref.className;
44
+ return jsx("div", _extends({
45
+ css: [topNavigationStyles, isFixed && fixedStyles],
46
+ className: className,
47
+ "data-testid": testId,
48
+ id: id
49
+ }, getPageLayoutSlotSelector('top-navigation')), jsx(SlotDimensions, {
50
+ variableName: VAR_TOP_NAVIGATION_HEIGHT,
51
+ value: topNavigationHeight
52
+ }), children);
53
+ });
39
54
  };
40
55
 
41
56
  export default TopNavigation;
@@ -1,9 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["setLeftSidebarState"];
3
4
 
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+ 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; }
5
6
 
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
+ 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
8
 
8
9
  import { createContext, useContext, useEffect } from 'react';
9
10
 
@@ -15,7 +16,8 @@ var leftSidebarState = {
15
16
  isLeftSidebarCollapsed: false,
16
17
  leftSidebarWidth: 0,
17
18
  lastLeftSidebarWidth: 0,
18
- flyoutLockCount: 0
19
+ flyoutLockCount: 0,
20
+ isFixed: true
19
21
  };
20
22
  export var SidebarResizeContext = /*#__PURE__*/createContext({
21
23
  isLeftSidebarCollapsed: false,
@@ -27,7 +29,7 @@ export var SidebarResizeContext = /*#__PURE__*/createContext({
27
29
  export var usePageLayoutResize = function usePageLayoutResize() {
28
30
  var _useContext = useContext(SidebarResizeContext),
29
31
  setLeftSidebarState = _useContext.setLeftSidebarState,
30
- context = _objectWithoutProperties(_useContext, ["setLeftSidebarState"]);
32
+ context = _objectWithoutProperties(_useContext, _excluded);
31
33
 
32
34
  return context;
33
35
  };
@@ -26,7 +26,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
26
26
  isLeftSidebarCollapsed: false,
27
27
  leftSidebarWidth: 0,
28
28
  lastLeftSidebarWidth: 0,
29
- flyoutLockCount: 0
29
+ flyoutLockCount: 0,
30
+ isFixed: true
30
31
  }),
31
32
  _useState2 = _slicedToArray(_useState, 2),
32
33
  leftSidebarState = _useState2[0],
@@ -54,7 +55,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
54
55
  var expandLeftSidebar = useCallback(function () {
55
56
  var lastLeftSidebarWidth = leftSidebarState.lastLeftSidebarWidth,
56
57
  isResizing = leftSidebarState.isResizing,
57
- flyoutLockCount = leftSidebarState.flyoutLockCount;
58
+ flyoutLockCount = leftSidebarState.flyoutLockCount,
59
+ isFixed = leftSidebarState.isFixed;
58
60
 
59
61
  if (isResizing) {
60
62
  return;
@@ -67,7 +69,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
67
69
  leftSidebarWidth: width,
68
70
  lastLeftSidebarWidth: lastLeftSidebarWidth,
69
71
  isResizing: isResizing,
70
- flyoutLockCount: flyoutLockCount
72
+ flyoutLockCount: flyoutLockCount,
73
+ isFixed: isFixed
71
74
  };
72
75
  setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
73
76
 
@@ -78,7 +81,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
78
81
  var collapseLeftSidebar = useCallback(function (event, collapseWithoutTransition) {
79
82
  var leftSidebarWidth = leftSidebarState.leftSidebarWidth,
80
83
  isResizing = leftSidebarState.isResizing,
81
- flyoutLockCount = leftSidebarState.flyoutLockCount;
84
+ flyoutLockCount = leftSidebarState.flyoutLockCount,
85
+ isFixed = leftSidebarState.isFixed;
82
86
 
83
87
  if (isResizing) {
84
88
  return;
@@ -93,7 +97,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
93
97
  leftSidebarWidth: COLLAPSED_LEFT_SIDEBAR_WIDTH,
94
98
  lastLeftSidebarWidth: leftSidebarWidth,
95
99
  isResizing: isResizing,
96
- flyoutLockCount: flyoutLockCount
100
+ flyoutLockCount: flyoutLockCount,
101
+ isFixed: isFixed
97
102
  };
98
103
  setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
99
104
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.0.6",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,2 @@
1
+ export { default as useIsSidebarCollapsing } from './use-is-sidebar-collapsing';
2
+ export { default as useIsSidebarDragging } from './use-is-sidebar-dragging';
@@ -0,0 +1,2 @@
1
+ declare const useIsSidebarCollapsing: () => boolean;
2
+ export default useIsSidebarCollapsing;
@@ -0,0 +1,2 @@
1
+ declare const useIsSidebarDragging: () => boolean;
2
+ export default useIsSidebarDragging;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ResizeControlProps } from './types';
2
3
  declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => JSX.Element;
3
4
  export default ResizeControl;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ResizeButtonProps } from './types';
2
3
  declare const ResizeButton: ({ isLeftSidebarCollapsed, label, testId, ...props }: ResizeButtonProps) => JSX.Element;
3
4
  export default ResizeButton;
@@ -0,0 +1,6 @@
1
+ /** @jsx jsx */
2
+ /// <reference types="react" />
3
+ declare const Shadow: ({ testId }: {
4
+ testId?: string | undefined;
5
+ }) => JSX.Element;
6
+ export default Shadow;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotHeightProps } from '../../common/types';
2
3
  declare const Banner: (props: SlotHeightProps) => JSX.Element;
3
4
  export default Banner;
@@ -0,0 +1,9 @@
1
+ /** @jsx jsx */
2
+ import type { ReactNode } from 'react';
3
+ declare type LeftSidebarInnerProps = {
4
+ children: ReactNode;
5
+ isFixed?: boolean;
6
+ isFlyoutOpen?: boolean;
7
+ };
8
+ declare const LeftSidebarInner: ({ children, isFixed, isFlyoutOpen, }: LeftSidebarInnerProps) => JSX.Element;
9
+ export default LeftSidebarInner;
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import { MouseEventHandler, ReactNode } from 'react';
3
+ declare type LeftSidebarOuterProps = {
4
+ children: ReactNode;
5
+ isFixed?: boolean;
6
+ isFlyoutOpen?: boolean;
7
+ testId?: string;
8
+ id?: string;
9
+ onMouseOver?: MouseEventHandler;
10
+ onMouseLeave?: MouseEventHandler;
11
+ };
12
+ declare const _default: import("react").ForwardRefExoticComponent<LeftSidebarOuterProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export default _default;
@@ -0,0 +1,10 @@
1
+ /** @jsx jsx */
2
+ import type { ReactNode } from 'react';
3
+ declare type ResizableChildrenWrapperProps = {
4
+ children: ReactNode;
5
+ isFlyoutOpen?: boolean;
6
+ isLeftSidebarCollapsed?: boolean;
7
+ hasCollapsedState?: boolean;
8
+ };
9
+ declare const ResizableChildrenWrapper: ({ children, isLeftSidebarCollapsed, hasCollapsedState, isFlyoutOpen, }: ResizableChildrenWrapperProps) => JSX.Element;
10
+ export default ResizableChildrenWrapper;
@@ -0,0 +1,19 @@
1
+ /** @jsx jsx */
2
+ import type { ReactNode } from 'react';
3
+ declare type SlotFocusRingProps = {
4
+ children: (props: {
5
+ className: string;
6
+ }) => ReactNode;
7
+ isSidebar?: boolean;
8
+ };
9
+ /**
10
+ * We don't use `@atlaskit/focus-ring` here,
11
+ * because we need inset focus styles and:
12
+ *
13
+ * 1. If we set them directly to the layout element,
14
+ * then any child element's background will cover the shadow.
15
+ * 2. We cannot wrap `children` in `FocusRing`,
16
+ * because there's no guarantee the passed child takes `className`.
17
+ */
18
+ declare const SlotFocusRing: ({ children, isSidebar }: SlotFocusRingProps) => JSX.Element;
19
+ export default SlotFocusRing;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotWidthProps } from '../../common/types';
2
3
  declare const LeftPanel: (props: SlotWidthProps) => JSX.Element;
3
4
  export default LeftPanel;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotWidthProps } from '../../common/types';
2
3
  declare const LeftSidebarWithoutResize: (props: SlotWidthProps) => JSX.Element;
3
4
  export default LeftSidebarWithoutResize;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { LeftSidebarProps } from '../../common/types';
2
3
  declare const LeftSidebar: (props: LeftSidebarProps) => JSX.Element;
3
4
  export default LeftSidebar;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotWidthProps } from '../../common/types';
2
3
  declare const Main: (props: SlotWidthProps) => JSX.Element;
3
4
  export default Main;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { PageLayoutProps } from '../../common/types';
2
3
  declare const PageLayout: ({ skipLinksLabel, children, testId, onLeftSidebarExpand, onLeftSidebarCollapse, }: PageLayoutProps) => JSX.Element;
3
4
  export default PageLayout;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotWidthProps } from '../../common/types';
2
3
  declare const RightPanel: (props: SlotWidthProps) => JSX.Element;
3
4
  export default RightPanel;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotWidthProps } from '../../common/types';
2
3
  declare const RightSidebar: (props: SlotWidthProps) => JSX.Element;
3
4
  export default RightSidebar;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface SlotDimensionsProps {
2
3
  variableName: string;
3
4
  value?: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SlotHeightProps } from '../../common/types';
2
3
  declare const TopNavigation: (props: SlotHeightProps) => JSX.Element;
3
4
  export default TopNavigation;
@@ -6,6 +6,7 @@ export declare type LeftSidebarState = {
6
6
  leftSidebarWidth: number;
7
7
  lastLeftSidebarWidth: number;
8
8
  flyoutLockCount: number;
9
+ isFixed: boolean;
9
10
  };
10
11
  export declare type SidebarResizeContextValue = {
11
12
  isLeftSidebarCollapsed: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.0.6",
4
- "description": "A collection of components which let you compose an application's page layout",
3
+ "version": "1.2.0",
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/"
7
7
  },
@@ -17,40 +17,40 @@
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
19
  "deprecatedAutoEntryPoints": true,
20
- "inPublicMirror": true,
21
20
  "releaseModel": "scheduled",
22
21
  "website": {
23
- "name": "Page Layout"
22
+ "name": "Page layout"
24
23
  }
25
24
  },
25
+ "homepage": "https://atlassian.design/components/page-layout/",
26
26
  "dependencies": {
27
- "@atlaskit/icon": "^21.9.0",
27
+ "@atlaskit/icon": "^21.10.0",
28
28
  "@atlaskit/motion": "^1.0.0",
29
- "@atlaskit/theme": "^12.0.0",
29
+ "@atlaskit/theme": "^12.1.0",
30
+ "@atlaskit/tokens": "^0.8.0",
30
31
  "@babel/runtime": "^7.0.0",
31
32
  "@emotion/core": "^10.0.9",
32
- "raf-schd": "^2.1.0"
33
+ "raf-schd": "^4.0.3"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "react": "^16.8.0",
36
37
  "react-dom": "^16.8.0"
37
38
  },
38
39
  "devDependencies": {
39
- "@atlaskit/atlassian-navigation": "^1.1.0",
40
+ "@atlaskit/atlassian-navigation": "^2.1.0",
40
41
  "@atlaskit/atlassian-notifications": "^0.3.0",
41
- "@atlaskit/build-utils": "*",
42
- "@atlaskit/button": "^16.0.0",
42
+ "@atlaskit/button": "^16.2.0",
43
43
  "@atlaskit/docs": "*",
44
- "@atlaskit/drawer": "^7.0.0",
44
+ "@atlaskit/drawer": "^7.1.0",
45
45
  "@atlaskit/icon": "*",
46
46
  "@atlaskit/logo": "^13.0.0",
47
- "@atlaskit/menu": "^1.0.0",
48
- "@atlaskit/notification-indicator": "^8.0.0",
49
- "@atlaskit/notification-log-client": "^5.0.0",
50
- "@atlaskit/onboarding": "^10.2.0",
51
- "@atlaskit/popup": "^1.1.0",
47
+ "@atlaskit/menu": "^1.3.0",
48
+ "@atlaskit/notification-indicator": "^9.0.0",
49
+ "@atlaskit/notification-log-client": "^6.0.0",
50
+ "@atlaskit/onboarding": "^10.3.0",
51
+ "@atlaskit/popup": "^1.3.0",
52
52
  "@atlaskit/section-message": "^6.0.0",
53
- "@atlaskit/side-navigation": "^1.0.0",
53
+ "@atlaskit/side-navigation": "^1.2.0",
54
54
  "@atlaskit/ssr": "*",
55
55
  "@atlaskit/tooltip": "*",
56
56
  "@atlaskit/visual-regression": "*",
@@ -58,6 +58,8 @@
58
58
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
59
59
  "@testing-library/dom": "^7.7.3",
60
60
  "@testing-library/react": "^8.0.1",
61
+ "@testing-library/react-hooks": "^1.0.4",
62
+ "@types/raf-schd": "^4.0.1",
61
63
  "jest-emotion": "^10.0.32",
62
64
  "raf-stub": "^2.0.1",
63
65
  "storybook-addon-performance": "^0.16.0",
@@ -80,10 +82,13 @@
80
82
  "analytics-next"
81
83
  ],
82
84
  "theming": [
83
- "new-theming-api"
85
+ "react-context",
86
+ "tokens"
84
87
  ],
85
- "deprecation": [
86
- "no-deprecated-imports"
88
+ "deprecation": "no-deprecated-imports",
89
+ "styling": [
90
+ "emotion",
91
+ "static"
87
92
  ]
88
93
  }
89
94
  },
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.shadowCSS = exports.increaseHitArea = exports.lineCSS = exports.grabAreaCSS = exports.resizeIconButtonCSS = exports.resizeControlCSS = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _motion = require("@atlaskit/motion");
13
-
14
- var _colors = require("@atlaskit/theme/colors");
15
-
16
- var _constants = require("../../common/constants");
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
-
22
- var resizeControlCSS = function resizeControlCSS(setIsGrabAreaFocused, isLeftSidebarCollapsed) {
23
- var _$concat, _ref;
24
-
25
- return _ref = {
26
- left: '100%',
27
- top: 0,
28
- bottom: 0,
29
- position: 'absolute',
30
- outline: 'none'
31
- }, (0, _defineProperty2.default)(_ref, "[".concat(_constants.GRAB_AREA_SELECTOR, "]:enabled"), (_$concat = {}, (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.GRAB_AREA_LINE_SELECTOR, "]"), {
32
- backgroundColor: _colors.B100
33
- }), (0, _defineProperty2.default)(_$concat, "&:active [".concat(_constants.GRAB_AREA_LINE_SELECTOR, "] , &:focus [").concat(_constants.GRAB_AREA_LINE_SELECTOR, "]"), {
34
- backgroundColor: _colors.B200
35
- }), (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.RESIZE_BUTTON_SELECTOR, "]:not(:focus):not(:hover)"), {
36
- color: _colors.B100
37
- }), (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"), {
38
- opacity: 1
39
- }), _$concat)), (0, _defineProperty2.default)(_ref, "[".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"), {
40
- opacity: setIsGrabAreaFocused || isLeftSidebarCollapsed ? 1 : 0
41
- }), _ref;
42
- };
43
-
44
- exports.resizeControlCSS = resizeControlCSS;
45
-
46
- var resizeIconButtonCSS = function resizeIconButtonCSS(isCollapsed) {
47
- return _objectSpread(_objectSpread({
48
- backgroundColor: _colors.N0,
49
- position: 'absolute',
50
- top: 32,
51
- left: 0,
52
- transform: 'translateX(-50%)',
53
- border: 0,
54
- borderRadius: '50%',
55
- boxShadow: "0 0 0 1px ".concat(_colors.N30A, ", 0 2px 4px 1px ").concat(_colors.N30A),
56
- color: _colors.N200,
57
- cursor: 'pointer',
58
- height: 24,
59
- opacity: 0,
60
- outline: 0,
61
- padding: 0,
62
- transition: "\n background-color ".concat(_motion.smallDurationMs, "ms linear,\n color ").concat(_motion.smallDurationMs, "ms linear,\n opacity ").concat(_motion.mediumDurationMs, "ms ").concat(_motion.easeOut, "\n "),
63
- width: 24,
64
- ':hover': {
65
- backgroundColor: _colors.B100,
66
- color: _colors.N0,
67
- opacity: 1
68
- },
69
- ':active': {
70
- backgroundColor: _colors.B200,
71
- color: _colors.N0,
72
- opacity: 1
73
- },
74
- ':focus': {
75
- backgroundColor: _colors.B200,
76
- color: _colors.N0,
77
- opacity: 1
78
- }
79
- }, !isCollapsed && {
80
- transform: 'rotate(180deg)',
81
- transformOrigin: 7,
82
- opacity: 1
83
- }), {}, (0, _defineProperty2.default)({}, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
84
- opacity: 1
85
- }));
86
- };
87
-
88
- exports.resizeIconButtonCSS = resizeIconButtonCSS;
89
-
90
- var grabAreaCSS = function grabAreaCSS(isLeftSidebarCollapsed) {
91
- var _objectSpread3;
92
-
93
- return _objectSpread((_objectSpread3 = {
94
- cursor: 'ew-resize',
95
- height: '100%',
96
- width: '24px',
97
- padding: 0,
98
- border: 0,
99
- backgroundColor: 'transparent'
100
- }, (0, _defineProperty2.default)(_objectSpread3, '&::-moz-focus-inner', {
101
- border: 0
102
- }), (0, _defineProperty2.default)(_objectSpread3, ':focus', {
103
- outline: 0
104
- }), _objectSpread3), isLeftSidebarCollapsed && {
105
- padding: 0,
106
- border: 0,
107
- backgroundColor: 'transparent',
108
- cursor: 'default'
109
- });
110
- };
111
-
112
- exports.grabAreaCSS = grabAreaCSS;
113
-
114
- var lineCSS = function lineCSS(isLeftSidebarCollapsed) {
115
- return _objectSpread({
116
- display: 'block',
117
- height: '100%',
118
- transition: 'background-color 200ms',
119
- width: 2
120
- }, isLeftSidebarCollapsed && {
121
- '&&': {
122
- backgroundColor: 'transparent'
123
- }
124
- });
125
- };
126
-
127
- exports.lineCSS = lineCSS;
128
- var increaseHitArea = {
129
- position: 'absolute',
130
- left: -8,
131
- right: -12,
132
- bottom: -8,
133
- top: -8
134
- };
135
- exports.increaseHitArea = increaseHitArea;
136
- var colorStops = "\n rgba(0, 0, 0, 0.2) 0px,\n rgba(0, 0, 0, 0.2) 1px,\n rgba(0, 0, 0, 0.1) 1px,\n rgba(0, 0, 0, 0) 100%\n ";
137
- var direction = 'to left';
138
- var transitionDuration = '0.22s';
139
- var shadowCSS = (0, _defineProperty2.default)({
140
- background: "linear-gradient(".concat(direction, ", ").concat(colorStops, ")"),
141
- bottom: 0,
142
- top: 0,
143
- left: -1,
144
- opacity: 0.5,
145
- pointerEvents: 'none',
146
- position: 'absolute',
147
- transitionDuration: transitionDuration,
148
- transitionProperty: 'left, opacity, width',
149
- transitionTimingFunction: _motion.easeOut,
150
- width: 3
151
- }, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
152
- opacity: 0.8,
153
- width: 6,
154
- left: -6
155
- });
156
- exports.shadowCSS = shadowCSS;
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.skipLinkStyles = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _motion = require("@atlaskit/motion");
13
-
14
- var _colors = require("@atlaskit/theme/colors");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- var skipLinkStyles = _objectSpread(_objectSpread({
21
- zIndex: -1,
22
- left: -999999,
23
- position: 'fixed',
24
- opacity: 0,
25
- background: 'white',
26
- border: 'none',
27
- padding: '0.8rem 1rem',
28
- boxShadow: "0 0 0 1px ".concat(_colors.N30A, ", 0 2px 10px ").concat(_colors.N30A, ", 0 0 20px -4px ").concat(_colors.N60A),
29
- borderRadius: '3px',
30
- margin: 10
31
- }, (0, _motion.prefersReducedMotion)()), {}, {
32
- transform: 'translateY(-50%)',
33
- transition: "transform 0.3s ".concat(_motion.easeOut),
34
- ':focus-within': {
35
- transform: 'translateY(0%)',
36
- opacity: 1,
37
- left: 0,
38
-
39
- /* Max z-index is 2147483647. Skip links always be on top,
40
- but giving a few digits extra space just in case there's
41
- a future need. */
42
- zIndex: 2147483640
43
- },
44
- '& > span': {
45
- fontWeight: 'bold'
46
- },
47
- '> ol': {
48
- listStyleType: 'none',
49
- listStylePosition: 'outside',
50
- paddingLeft: 0,
51
- marginTop: '4px',
52
- '> li': {
53
- marginTop: 0
54
- }
55
- }
56
- });
57
-
58
- exports.skipLinkStyles = skipLinkStyles;