@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
@@ -22,7 +22,8 @@ export const SidebarResizeController = ({
22
22
  isLeftSidebarCollapsed: false,
23
23
  leftSidebarWidth: 0,
24
24
  lastLeftSidebarWidth: 0,
25
- flyoutLockCount: 0
25
+ flyoutLockCount: 0,
26
+ isFixed: true
26
27
  });
27
28
  const {
28
29
  isLeftSidebarCollapsed
@@ -49,7 +50,8 @@ export const SidebarResizeController = ({
49
50
  const {
50
51
  lastLeftSidebarWidth,
51
52
  isResizing,
52
- flyoutLockCount
53
+ flyoutLockCount,
54
+ isFixed
53
55
  } = leftSidebarState;
54
56
 
55
57
  if (isResizing) {
@@ -63,7 +65,8 @@ export const SidebarResizeController = ({
63
65
  leftSidebarWidth: width,
64
66
  lastLeftSidebarWidth,
65
67
  isResizing,
66
- flyoutLockCount
68
+ flyoutLockCount,
69
+ isFixed
67
70
  };
68
71
  setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
69
72
 
@@ -75,7 +78,8 @@ export const SidebarResizeController = ({
75
78
  const {
76
79
  leftSidebarWidth,
77
80
  isResizing,
78
- flyoutLockCount
81
+ flyoutLockCount,
82
+ isFixed
79
83
  } = leftSidebarState;
80
84
 
81
85
  if (isResizing) {
@@ -91,7 +95,8 @@ export const SidebarResizeController = ({
91
95
  leftSidebarWidth: COLLAPSED_LEFT_SIDEBAR_WIDTH,
92
96
  lastLeftSidebarWidth: leftSidebarWidth,
93
97
  isResizing,
94
- flyoutLockCount
98
+ flyoutLockCount,
99
+ isFixed
95
100
  };
96
101
  setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
97
102
 
@@ -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,34 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect, useState } from 'react';
3
+ import { IS_SIDEBAR_COLLAPSING } from '../constants';
4
+
5
+ var getIsCollapsing = function getIsCollapsing() {
6
+ // SSR bail-out because document is undefined on the server
7
+ if (typeof document === 'undefined') {
8
+ return false;
9
+ }
10
+
11
+ return document.documentElement.getAttribute(IS_SIDEBAR_COLLAPSING) === 'true';
12
+ };
13
+
14
+ var useIsSidebarCollapsing = function useIsSidebarCollapsing() {
15
+ var _useState = useState(getIsCollapsing),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ isCollapsing = _useState2[0],
18
+ setIsCollapsing = _useState2[1];
19
+
20
+ useEffect(function () {
21
+ var observer = new MutationObserver(function () {
22
+ setIsCollapsing(getIsCollapsing);
23
+ });
24
+ observer.observe(document.documentElement, {
25
+ attributeFilter: [IS_SIDEBAR_COLLAPSING]
26
+ });
27
+ return function () {
28
+ observer.disconnect();
29
+ };
30
+ }, []);
31
+ return isCollapsing;
32
+ };
33
+
34
+ export default useIsSidebarCollapsing;
@@ -0,0 +1,34 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect, useState } from 'react';
3
+ import { IS_SIDEBAR_DRAGGING } from '../constants';
4
+
5
+ var getIsDragging = function getIsDragging() {
6
+ // SSR bail-out because document is undefined on the server
7
+ if (typeof document === 'undefined') {
8
+ return false;
9
+ }
10
+
11
+ return document.documentElement.getAttribute(IS_SIDEBAR_DRAGGING) === 'true';
12
+ };
13
+
14
+ var useIsSidebarDragging = function useIsSidebarDragging() {
15
+ var _useState = useState(getIsDragging),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ isDragging = _useState2[0],
18
+ setIsDragging = _useState2[1];
19
+
20
+ useEffect(function () {
21
+ var observer = new MutationObserver(function () {
22
+ setIsDragging(getIsDragging);
23
+ });
24
+ observer.observe(document.documentElement, {
25
+ attributeFilter: [IS_SIDEBAR_DRAGGING]
26
+ });
27
+ return function () {
28
+ observer.disconnect();
29
+ };
30
+ }, []);
31
+ return isDragging;
32
+ };
33
+
34
+ export default useIsSidebarDragging;
@@ -1,9 +1,9 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
 
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; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
 
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; }
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
8
  import { DEFAULT_LEFT_SIDEBAR_WIDTH, DIMENSIONS, LEFT_PANEL_WIDTH, PAGE_LAYOUT_LS_KEY, PAGE_LAYOUT_SLOT_SELECTOR } from './constants';
9
9
  import safeLocalStorage from './safe-local-storage';
@@ -1,11 +1,50 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["testId", "isLeftSidebarCollapsed"];
4
5
 
5
6
  /** @jsx jsx */
6
- import { jsx } from '@emotion/core';
7
+ import { css, jsx } from '@emotion/core';
8
+ import { B100, B200 } from '@atlaskit/theme/colors';
7
9
  import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
8
- import { grabAreaCSS, lineCSS } from './styles';
10
+
11
+ /**
12
+ * Determines the color of the grab line.
13
+ *
14
+ * Used on internal leaf node, so naming collisions won't matter.
15
+ */
16
+ var varLineColor = '--ds-line';
17
+ var grabAreaStyles = css({
18
+ width: 24,
19
+ height: '100%',
20
+ padding: 0,
21
+ backgroundColor: 'transparent',
22
+ border: 0,
23
+ cursor: 'ew-resize',
24
+ '&::-moz-focus-inner': {
25
+ border: 0
26
+ },
27
+ ':focus': {
28
+ outline: 0
29
+ },
30
+ ':enabled': {
31
+ ':hover': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B100, ")")),
32
+ ':active, :focus': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B200, ")"))
33
+ }
34
+ });
35
+ var grabAreaCollapsedStyles = css({
36
+ padding: 0,
37
+ backgroundColor: 'transparent',
38
+ border: 0,
39
+ cursor: 'default'
40
+ });
41
+ var lineStyles = css({
42
+ display: 'block',
43
+ width: 2,
44
+ height: '100%',
45
+ backgroundColor: "var(".concat(varLineColor, ")"),
46
+ transition: 'background-color 200ms'
47
+ });
9
48
 
10
49
  var grabAreaLineSelector = _defineProperty({}, GRAB_AREA_LINE_SELECTOR, true);
11
50
 
@@ -15,14 +54,14 @@ var grabAreaSelector = _defineProperty({}, GRAB_AREA_SELECTOR, true); // TODO: C
15
54
  var GrabArea = function GrabArea(_ref) {
16
55
  var testId = _ref.testId,
17
56
  isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
18
- rest = _objectWithoutProperties(_ref, ["testId", "isLeftSidebarCollapsed"]);
57
+ rest = _objectWithoutProperties(_ref, _excluded);
19
58
 
20
59
  return jsx("button", _extends({}, grabAreaSelector, {
21
60
  "data-testid": testId,
22
61
  type: "button",
23
- css: grabAreaCSS(isLeftSidebarCollapsed)
62
+ css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
24
63
  }, rest), jsx("span", _extends({
25
- css: lineCSS(isLeftSidebarCollapsed)
64
+ css: lineStyles
26
65
  }, grabAreaLineSelector)));
27
66
  };
28
67
 
@@ -2,13 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
 
5
- 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; }
6
6
 
7
- 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; }
8
8
 
9
9
  /** @jsx jsx */
10
10
  import { useCallback, useContext, useMemo, useRef, useState } from 'react';
11
- import { jsx } from '@emotion/core';
11
+ import { css, jsx } from '@emotion/core';
12
12
  import rafSchd from 'raf-schd';
13
13
  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
14
  import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
@@ -17,27 +17,30 @@ import { SidebarResizeContext } from '../../controllers/sidebar-resize-context';
17
17
 
18
18
  import GrabArea from './grab-area';
19
19
  import ResizeButton from './resize-button';
20
- import { resizeControlCSS, shadowCSS } from './styles';
20
+ import Shadow from './shadow';
21
21
 
22
22
  var cssSelector = _defineProperty({}, RESIZE_CONTROL_SELECTOR, true);
23
23
 
24
- var Shadow = function Shadow(_ref) {
25
- var testId = _ref.testId;
26
- return jsx("div", {
27
- "data-testid": testId,
28
- css: shadowCSS
29
- });
30
- };
31
-
32
- var ResizeControl = function ResizeControl(_ref2) {
33
- var testId = _ref2.testId,
34
- overrides = _ref2.overrides,
35
- _ref2$resizeButtonLab = _ref2.resizeButtonLabel,
36
- resizeButtonLabel = _ref2$resizeButtonLab === void 0 ? '' : _ref2$resizeButtonLab,
37
- _ref2$resizeGrabAreaL = _ref2.resizeGrabAreaLabel,
38
- resizeGrabAreaLabel = _ref2$resizeGrabAreaL === void 0 ? 'Resize' : _ref2$resizeGrabAreaL,
39
- onResizeStart = _ref2.onResizeStart,
40
- onResizeEnd = _ref2.onResizeEnd;
24
+ var resizeControlStyles = css({
25
+ position: 'absolute',
26
+ top: 0,
27
+ bottom: 0,
28
+ left: '100%',
29
+ outline: 'none'
30
+ });
31
+ var showResizeButtonStyles = css({
32
+ '--ds--resize-button--opacity': 1
33
+ });
34
+
35
+ var ResizeControl = function ResizeControl(_ref) {
36
+ var testId = _ref.testId,
37
+ overrides = _ref.overrides,
38
+ _ref$resizeButtonLabe = _ref.resizeButtonLabel,
39
+ resizeButtonLabel = _ref$resizeButtonLabe === void 0 ? '' : _ref$resizeButtonLabe,
40
+ _ref$resizeGrabAreaLa = _ref.resizeGrabAreaLabel,
41
+ resizeGrabAreaLabel = _ref$resizeGrabAreaLa === void 0 ? 'Resize' : _ref$resizeGrabAreaLa,
42
+ onResizeStart = _ref.onResizeStart,
43
+ onResizeEnd = _ref.onResizeEnd;
41
44
 
42
45
  var _useContext = useContext(SidebarResizeContext),
43
46
  expandLeftSidebar = _useContext.expandLeftSidebar,
@@ -247,7 +250,7 @@ var ResizeControl = function ResizeControl(_ref2) {
247
250
  /* eslint-disable jsx-a11y/role-supports-aria-props */
248
251
 
249
252
  return jsx("div", _extends({}, cssSelector, {
250
- css: resizeControlCSS(isGrabAreaFocused, isLeftSidebarCollapsed)
253
+ css: [resizeControlStyles, (isGrabAreaFocused || isLeftSidebarCollapsed) && showResizeButtonStyles]
251
254
  }), jsx(Shadow, {
252
255
  testId: testId && "".concat(testId, "-shadow")
253
256
  }), jsx(GrabArea, {
@@ -1,12 +1,66 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
4
5
 
5
6
  /** @jsx jsx */
6
- import { jsx } from '@emotion/core';
7
+ import { css, jsx } from '@emotion/core';
7
8
  import ChevronRight from '@atlaskit/icon/glyph/chevron-right';
9
+ import { easeOut } from '@atlaskit/motion/curves';
10
+ import { mediumDurationMs, smallDurationMs } from '@atlaskit/motion/durations';
11
+ import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
8
12
  import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
9
- import { increaseHitArea, resizeIconButtonCSS } from './styles';
13
+ var increaseHitAreaStyles = css({
14
+ position: 'absolute',
15
+ top: -8,
16
+ right: -12,
17
+ bottom: -8,
18
+ left: -8
19
+ });
20
+ var resizeIconButtonStyles = css({
21
+ width: 24,
22
+ height: 24,
23
+ padding: 0,
24
+ position: 'absolute',
25
+ top: 32,
26
+ left: 0,
27
+ backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
28
+ border: 0,
29
+ borderRadius: '50%',
30
+
31
+ /**
32
+ * TODO: https://product-fabric.atlassian.net/browse/DSP-3392
33
+ * This shadow needs further investigation,
34
+ * along with the hover and active background colors.
35
+ */
36
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
37
+ boxShadow: "0 0 0 1px ".concat(N30A, ", 0 2px 4px 1px ").concat(N30A),
38
+ color: "var(--ds-text-subtle, ".concat(N200, ")"),
39
+ cursor: 'pointer',
40
+
41
+ /**
42
+ * The fallback value of 0 ensures that the button is hidden by default,
43
+ * unless some parent (or the button itself) overrides it.
44
+ */
45
+ opacity: "var(--ds--resize-button--opacity,0)",
46
+ outline: 0,
47
+ transform: 'translateX(-50%)',
48
+ transition: "\n background-color ".concat(smallDurationMs, "ms linear,\n color ").concat(smallDurationMs, "ms linear,\n opacity ").concat(mediumDurationMs, "ms ").concat(easeOut, "\n "),
49
+ ':hover': {
50
+ backgroundColor: "var(--ds-background-selected-bold, ".concat(B100, ")"),
51
+ color: "var(--ds-text-inverse, ".concat(N0, ")"),
52
+ opacity: 1
53
+ },
54
+ ':active, :focus': {
55
+ backgroundColor: "var(--ds-background-selected-bold-hovered, ".concat(B200, ")"),
56
+ color: "var(--ds-text-inverse, ".concat(N0, ")"),
57
+ opacity: 1
58
+ }
59
+ });
60
+ var resizeIconButtonExpandedStyles = css({
61
+ transform: 'rotate(180deg)',
62
+ transformOrigin: 7
63
+ });
10
64
 
11
65
  var preventDefault = function preventDefault(event) {
12
66
  return event.preventDefault();
@@ -18,14 +72,14 @@ var ResizeButton = function ResizeButton(_ref) {
18
72
  var isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
19
73
  label = _ref.label,
20
74
  testId = _ref.testId,
21
- props = _objectWithoutProperties(_ref, ["isLeftSidebarCollapsed", "label", "testId"]);
75
+ props = _objectWithoutProperties(_ref, _excluded);
22
76
 
23
77
  return jsx("button", _extends({}, cssSelector, {
24
78
  // DO NOT remove. used as a CSS selector.
25
79
  "aria-expanded": !isLeftSidebarCollapsed,
26
80
  "aria-label": label,
27
81
  type: "button",
28
- css: resizeIconButtonCSS(isLeftSidebarCollapsed),
82
+ css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
29
83
  "data-testid": testId // Prevents focus staying attached to the button
30
84
  // when pressed
31
85
  ,
@@ -33,7 +87,7 @@ var ResizeButton = function ResizeButton(_ref) {
33
87
  }, props), jsx(ChevronRight, {
34
88
  label: ""
35
89
  }), jsx("div", {
36
- css: increaseHitArea
90
+ css: increaseHitAreaStyles
37
91
  }));
38
92
  };
39
93
 
@@ -0,0 +1,37 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/core';
3
+ import { easeOut } from '@atlaskit/motion';
4
+ import { useIsSidebarDragging } from '../../common/hooks';
5
+ 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 ";
6
+ var direction = 'to left';
7
+ var transitionDuration = '0.22s';
8
+ var shadowStyles = css({
9
+ width: 3,
10
+ position: 'absolute',
11
+ top: 0,
12
+ bottom: 0,
13
+ left: -1,
14
+ background: "var(--ds-border, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
15
+ opacity: 0.5,
16
+ pointerEvents: 'none',
17
+ transitionDuration: transitionDuration,
18
+ transitionProperty: 'left, opacity, width',
19
+ transitionTimingFunction: easeOut
20
+ });
21
+ var draggingStyles = css({
22
+ width: 6,
23
+ left: -6,
24
+ background: "var(--ds-background-neutral-subtle, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
25
+ opacity: 0.8
26
+ });
27
+
28
+ var Shadow = function Shadow(_ref) {
29
+ var testId = _ref.testId;
30
+ var isDragging = useIsSidebarDragging();
31
+ return jsx("div", {
32
+ "data-testid": testId,
33
+ css: [shadowStyles, isDragging && draggingStyles]
34
+ });
35
+ };
36
+
37
+ export default Shadow;
@@ -1,15 +1,53 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
 
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; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
 
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; }
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
8
  /** @jsx jsx */
9
- import { jsx } from '@emotion/core';
9
+ import { css, jsx } from '@emotion/core';
10
+ import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
11
+ import { N30A, N60A } from '@atlaskit/theme/colors';
10
12
  import { PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
11
13
  import { useSkipLinks } from '../../controllers';
12
- import { skipLinkStyles } from './styles';
14
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
15
+ var prefersReducedMotionStyles = css(prefersReducedMotion());
16
+ var skipLinkStyles = css({
17
+ margin: 10,
18
+ padding: '0.8rem 1rem',
19
+ position: 'fixed',
20
+ zIndex: -1,
21
+ left: -999999,
22
+ background: "var(--ds-surface-overlay, white)",
23
+ border: 'none',
24
+ borderRadius: 3,
25
+ boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(N30A, ", 0 2px 10px ").concat(N30A, ", 0 0 20px -4px ").concat(N60A), ")"),
26
+ opacity: 0,
27
+
28
+ /* Do the transform when focused */
29
+ transform: 'translateY(-50%)',
30
+ transition: "transform 0.3s ".concat(easeOut),
31
+ ':focus-within': {
32
+ /**
33
+ * Max z-index is 2147483647. Skip links always be on top,
34
+ * but giving a few digits extra space just in case there's a future need.
35
+ */
36
+ zIndex: 2147483640,
37
+ left: 0,
38
+ opacity: 1,
39
+ transform: 'translateY(0%)'
40
+ }
41
+ });
42
+ var skipLinkListStyles = css({
43
+ marginTop: 4,
44
+ paddingLeft: 0,
45
+ listStylePosition: 'outside',
46
+ listStyleType: 'none'
47
+ });
48
+ var skipLinkListItemStyles = css({
49
+ marginTop: 0
50
+ });
13
51
 
14
52
  var assignIndex = function assignIndex(num, arr) {
15
53
  if (!arr.includes(num)) {
@@ -76,9 +114,11 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
76
114
  return jsx("div", {
77
115
  onFocus: attachEscHandler,
78
116
  onBlur: removeEscHandler,
79
- css: skipLinkStyles,
117
+ css: [skipLinkStyles, prefersReducedMotionStyles],
80
118
  "data-skip-link-wrapper": true
81
- }, jsx("h5", null, skipLinksLabel), jsx("ol", null, sortSkipLinks(skipLinksData).map(function (_ref2) {
119
+ }, jsx("h5", null, skipLinksLabel), jsx("ol", {
120
+ css: skipLinkListStyles
121
+ }, sortSkipLinks(skipLinksData).map(function (_ref2) {
82
122
  var id = _ref2.id,
83
123
  skipLinkTitle = _ref2.skipLinkTitle;
84
124
  return jsx(SkipLink, {
@@ -130,7 +170,9 @@ export var SkipLink = function SkipLink(_ref3) {
130
170
  children = _ref3.children,
131
171
  isFocusable = _ref3.isFocusable,
132
172
  title = _ref3.title;
133
- return jsx("li", null, jsx("a", {
173
+ return jsx("li", {
174
+ css: skipLinkListItemStyles
175
+ }, jsx("a", {
134
176
  tabIndex: isFocusable ? 0 : -1,
135
177
  href: href,
136
178
  onClick: focusTargetRef(href),
@@ -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_BANNER_HEIGHT, VAR_BANNER_HEIGHT } from '../../common/constants';
6
+ import { css, jsx } from '@emotion/core';
7
+ import { BANNER, BANNER_HEIGHT, DEFAULT_BANNER_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, VAR_BANNER_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 { bannerStyles } from './styles';
12
+ var bannerStyles = css({
13
+ height: BANNER_HEIGHT,
14
+ gridArea: BANNER
15
+ });
16
+ var bannerFixedStyles = css({
17
+ position: 'fixed',
18
+ zIndex: 2,
19
+ top: 0,
20
+ right: RIGHT_PANEL_WIDTH,
21
+ left: LEFT_PANEL_WIDTH
22
+ });
12
23
 
13
24
  var Banner = function Banner(props) {
14
25
  var children = props.children,
@@ -25,17 +36,21 @@ var Banner = function Banner(props) {
25
36
  publishGridState(_defineProperty({}, VAR_BANNER_HEIGHT, bannerHeight));
26
37
  return function () {
27
38
  publishGridState(_defineProperty({}, VAR_BANNER_HEIGHT, 0));
28
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ };
29
40
  }, [bannerHeight]);
30
41
  useSkipLink(id, skipLinkTitle);
31
- return jsx("div", _extends({
32
- css: bannerStyles(isFixed),
33
- "data-testid": testId,
34
- id: id
35
- }, getPageLayoutSlotSelector('banner')), jsx(SlotDimensions, {
36
- variableName: VAR_BANNER_HEIGHT,
37
- value: bannerHeight
38
- }), children);
42
+ return jsx(SlotFocusRing, null, function (_ref) {
43
+ var className = _ref.className;
44
+ return jsx("div", _extends({
45
+ css: [bannerStyles, isFixed && bannerFixedStyles],
46
+ className: className,
47
+ "data-testid": testId,
48
+ id: id
49
+ }, getPageLayoutSlotSelector('banner')), jsx(SlotDimensions, {
50
+ variableName: VAR_BANNER_HEIGHT,
51
+ value: bannerHeight
52
+ }), children);
53
+ });
39
54
  };
40
55
 
41
56
  export default Banner;
@@ -1,6 +1,12 @@
1
1
  /** @jsx jsx */
2
- import { jsx } from '@emotion/core';
3
- import { contentStyles } from './styles';
2
+ import { css, jsx } from '@emotion/core';
3
+ import { CONTENT } from '../../common/constants';
4
+ var contentStyles = css({
5
+ display: 'flex',
6
+ height: '100%',
7
+ position: 'relative',
8
+ gridArea: CONTENT
9
+ });
4
10
 
5
11
  var Content = function Content(props) {
6
12
  var children = props.children,
@@ -0,0 +1,53 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/core';
3
+ import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
4
+ import { BANNER_HEIGHT, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../../common/constants';
5
+ import { useIsSidebarDragging } from '../../../common/hooks';
6
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
7
+ var prefersReducedMotionStyles = css(prefersReducedMotion());
8
+ /**
9
+ * This inner wrapper is required to allow the sidebar to be `position: fixed`.
10
+ *
11
+ * If we were to apply `position: fixed` to the outer wrapper, it will be popped
12
+ * out of its flex container and Main would stretch to occupy all the space.
13
+ */
14
+
15
+ var fixedInnerStyles = css({
16
+ width: "".concat(LEFT_SIDEBAR_WIDTH),
17
+ position: 'fixed',
18
+ top: "calc(".concat(BANNER_HEIGHT, " + ").concat(TOP_NAVIGATION_HEIGHT, ")"),
19
+ bottom: 0,
20
+ left: "".concat(LEFT_PANEL_WIDTH),
21
+ transition: "width ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s")
22
+ });
23
+ var fixedInnerFlyoutStyles = css({
24
+ width: LEFT_SIDEBAR_FLYOUT_WIDTH
25
+ });
26
+ /**
27
+ * Static in the sense of `position: static`.
28
+ *
29
+ * It will expand the page height to fit its content.
30
+ */
31
+
32
+ var staticInnerStyles = css({
33
+ height: '100%'
34
+ });
35
+ var draggingStyles = css({
36
+ cursor: 'ew-resize',
37
+ // Make sure drag to resize does not animate as the user drags
38
+ transition: 'none'
39
+ });
40
+
41
+ var LeftSidebarInner = function LeftSidebarInner(_ref) {
42
+ var children = _ref.children,
43
+ _ref$isFixed = _ref.isFixed,
44
+ isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
45
+ _ref$isFlyoutOpen = _ref.isFlyoutOpen,
46
+ isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen;
47
+ var isDragging = useIsSidebarDragging();
48
+ return jsx("div", {
49
+ css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
50
+ }, children);
51
+ };
52
+
53
+ export default LeftSidebarInner;