@atlaskit/page-layout 1.3.8 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/common/constants.js +8 -4
  3. package/dist/cjs/common/hooks/index.js +0 -3
  4. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +3 -12
  5. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +3 -12
  6. package/dist/cjs/common/safe-local-storage.js +2 -13
  7. package/dist/cjs/common/utils.js +0 -35
  8. package/dist/cjs/components/index.js +0 -13
  9. package/dist/cjs/components/resize-control/grab-area.js +8 -17
  10. package/dist/cjs/components/resize-control/index.js +33 -84
  11. package/dist/cjs/components/resize-control/resize-button.js +9 -24
  12. package/dist/cjs/components/resize-control/shadow.js +3 -7
  13. package/dist/cjs/components/skip-links/index.js +0 -2
  14. package/dist/cjs/components/skip-links/skip-link-components.js +18 -48
  15. package/dist/cjs/components/skip-links/use-custom-skip-link.js +3 -8
  16. package/dist/cjs/components/slots/banner-slot.js +10 -21
  17. package/dist/cjs/components/slots/content.js +3 -6
  18. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +9 -14
  19. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +10 -22
  20. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +10 -15
  21. package/dist/cjs/components/slots/internal/slot-focus-ring.js +5 -8
  22. package/dist/cjs/components/slots/left-panel.js +9 -20
  23. package/dist/cjs/components/slots/left-sidebar-without-resize.js +6 -18
  24. package/dist/cjs/components/slots/left-sidebar.js +39 -75
  25. package/dist/cjs/components/slots/main.js +9 -23
  26. package/dist/cjs/components/slots/page-layout.js +7 -16
  27. package/dist/cjs/components/slots/right-panel.js +9 -20
  28. package/dist/cjs/components/slots/right-sidebar.js +9 -21
  29. package/dist/cjs/components/slots/slot-dimensions.js +1 -5
  30. package/dist/cjs/components/slots/top-navigation.js +10 -21
  31. package/dist/cjs/controllers/index.js +0 -6
  32. package/dist/cjs/controllers/sidebar-resize-context.js +6 -21
  33. package/dist/cjs/controllers/sidebar-resize-controller.js +34 -50
  34. package/dist/cjs/controllers/skip-link-context.js +2 -12
  35. package/dist/cjs/controllers/skip-link-controller.js +6 -22
  36. package/dist/cjs/controllers/use-page-layout-grid.js +6 -12
  37. package/dist/cjs/controllers/use-update-css-vars.js +0 -3
  38. package/dist/cjs/index.js +0 -3
  39. package/dist/cjs/version.json +1 -1
  40. package/dist/es2019/common/constants.js +8 -4
  41. package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +0 -4
  42. package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +0 -4
  43. package/dist/es2019/common/safe-local-storage.js +2 -12
  44. package/dist/es2019/common/utils.js +4 -20
  45. package/dist/es2019/components/resize-control/grab-area.js +7 -8
  46. package/dist/es2019/components/resize-control/index.js +26 -43
  47. package/dist/es2019/components/resize-control/resize-button.js +7 -11
  48. package/dist/es2019/components/resize-control/shadow.js +3 -3
  49. package/dist/es2019/components/skip-links/skip-link-components.js +16 -31
  50. package/dist/es2019/components/slots/banner-slot.js +1 -3
  51. package/dist/es2019/components/slots/content.js +2 -2
  52. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +5 -5
  53. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +1 -4
  54. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +4 -4
  55. package/dist/es2019/components/slots/internal/slot-focus-ring.js +3 -3
  56. package/dist/es2019/components/slots/left-panel.js +1 -3
  57. package/dist/es2019/components/slots/left-sidebar-without-resize.js +1 -2
  58. package/dist/es2019/components/slots/left-sidebar.js +25 -40
  59. package/dist/es2019/components/slots/main.js +4 -5
  60. package/dist/es2019/components/slots/page-layout.js +1 -3
  61. package/dist/es2019/components/slots/right-panel.js +1 -3
  62. package/dist/es2019/components/slots/right-sidebar.js +3 -5
  63. package/dist/es2019/components/slots/top-navigation.js +1 -3
  64. package/dist/es2019/controllers/sidebar-resize-context.js +7 -5
  65. package/dist/es2019/controllers/sidebar-resize-controller.js +14 -16
  66. package/dist/es2019/controllers/skip-link-context.js +0 -1
  67. package/dist/es2019/controllers/skip-link-controller.js +3 -7
  68. package/dist/es2019/controllers/use-page-layout-grid.js +4 -5
  69. package/dist/es2019/controllers/use-update-css-vars.js +0 -2
  70. package/dist/es2019/version.json +1 -1
  71. package/dist/esm/common/constants.js +8 -4
  72. package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +3 -8
  73. package/dist/esm/common/hooks/use-is-sidebar-dragging.js +3 -8
  74. package/dist/esm/common/safe-local-storage.js +2 -12
  75. package/dist/esm/common/utils.js +0 -22
  76. package/dist/esm/components/resize-control/grab-area.js +9 -14
  77. package/dist/esm/components/resize-control/index.js +33 -72
  78. package/dist/esm/components/resize-control/resize-button.js +10 -15
  79. package/dist/esm/components/resize-control/shadow.js +3 -3
  80. package/dist/esm/components/skip-links/skip-link-components.js +19 -39
  81. package/dist/esm/components/skip-links/use-custom-skip-link.js +2 -4
  82. package/dist/esm/components/slots/banner-slot.js +9 -11
  83. package/dist/esm/components/slots/content.js +3 -3
  84. package/dist/esm/components/slots/internal/left-sidebar-inner.js +9 -9
  85. package/dist/esm/components/slots/internal/left-sidebar-outer.js +9 -12
  86. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +10 -10
  87. package/dist/esm/components/slots/internal/slot-focus-ring.js +5 -5
  88. package/dist/esm/components/slots/left-panel.js +8 -10
  89. package/dist/esm/components/slots/left-sidebar-without-resize.js +7 -9
  90. package/dist/esm/components/slots/left-sidebar.js +40 -65
  91. package/dist/esm/components/slots/main.js +10 -13
  92. package/dist/esm/components/slots/page-layout.js +6 -10
  93. package/dist/esm/components/slots/right-panel.js +8 -10
  94. package/dist/esm/components/slots/right-sidebar.js +10 -12
  95. package/dist/esm/components/slots/slot-dimensions.js +1 -1
  96. package/dist/esm/components/slots/top-navigation.js +9 -11
  97. package/dist/esm/controllers/sidebar-resize-context.js +6 -11
  98. package/dist/esm/controllers/sidebar-resize-controller.js +34 -38
  99. package/dist/esm/controllers/skip-link-context.js +2 -4
  100. package/dist/esm/controllers/skip-link-controller.js +6 -12
  101. package/dist/esm/controllers/use-page-layout-grid.js +6 -8
  102. package/dist/esm/controllers/use-update-css-vars.js +0 -2
  103. package/dist/esm/version.json +1 -1
  104. package/dist/types/common/types.d.ts +4 -4
  105. package/dist/types/controllers/skip-link-controller.d.ts +4 -2
  106. package/package.json +10 -9
@@ -1,38 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _react = require("react");
13
-
14
10
  var _react2 = require("@emotion/react");
15
-
16
11
  var _constants = require("../../common/constants");
17
-
18
12
  var _utils = require("../../common/utils");
19
-
20
13
  var _controllers = require("../../controllers");
21
-
22
14
  var _resizeControl = _interopRequireDefault(require("../resize-control"));
23
-
24
15
  var _leftSidebarInner = _interopRequireDefault(require("./internal/left-sidebar-inner"));
25
-
26
16
  var _leftSidebarOuter = _interopRequireDefault(require("./internal/left-sidebar-outer"));
27
-
28
17
  var _resizableChildrenWrapper = _interopRequireDefault(require("./internal/resizable-children-wrapper"));
29
-
30
18
  var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
31
-
32
19
  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; }
33
-
34
20
  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) { (0, _defineProperty2.default)(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; }
35
-
36
21
  /**
37
22
  * __Left sidebar__
38
23
  *
@@ -43,42 +28,42 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
43
28
  */
44
29
  var LeftSidebar = function LeftSidebar(props) {
45
30
  var children = props.children,
46
- width = props.width,
47
- _props$isFixed = props.isFixed,
48
- isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
49
- resizeButtonLabel = props.resizeButtonLabel,
50
- resizeGrabAreaLabel = props.resizeGrabAreaLabel,
51
- overrides = props.overrides,
52
- onExpand = props.onExpand,
53
- onCollapse = props.onCollapse,
54
- onResizeStart = props.onResizeStart,
55
- onResizeEnd = props.onResizeEnd,
56
- onFlyoutExpand = props.onFlyoutExpand,
57
- onFlyoutCollapse = props.onFlyoutCollapse,
58
- testId = props.testId,
59
- id = props.id,
60
- skipLinkTitle = props.skipLinkTitle,
61
- collapsedState = props.collapsedState;
31
+ width = props.width,
32
+ _props$isFixed = props.isFixed,
33
+ isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
34
+ resizeButtonLabel = props.resizeButtonLabel,
35
+ resizeGrabAreaLabel = props.resizeGrabAreaLabel,
36
+ overrides = props.overrides,
37
+ onExpand = props.onExpand,
38
+ onCollapse = props.onCollapse,
39
+ onResizeStart = props.onResizeStart,
40
+ onResizeEnd = props.onResizeEnd,
41
+ onFlyoutExpand = props.onFlyoutExpand,
42
+ onFlyoutCollapse = props.onFlyoutCollapse,
43
+ testId = props.testId,
44
+ id = props.id,
45
+ skipLinkTitle = props.skipLinkTitle,
46
+ collapsedState = props.collapsedState;
62
47
  var flyoutTimerRef = (0, _react.useRef)();
63
48
  var mouseOverEventRef = (0, _react.useRef)();
64
49
  var leftSideBarRef = (0, _react.useRef)(null);
65
-
66
50
  var _useContext = (0, _react.useContext)(_controllers.SidebarResizeContext),
67
- leftSidebarState = _useContext.leftSidebarState,
68
- setLeftSidebarState = _useContext.setLeftSidebarState;
69
-
51
+ leftSidebarState = _useContext.leftSidebarState,
52
+ setLeftSidebarState = _useContext.setLeftSidebarState;
70
53
  var isFlyoutOpen = leftSidebarState.isFlyoutOpen,
71
- isResizing = leftSidebarState.isResizing,
72
- flyoutLockCount = leftSidebarState.flyoutLockCount,
73
- isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed,
74
- leftSidebarWidth = leftSidebarState.leftSidebarWidth,
75
- lastLeftSidebarWidth = leftSidebarState.lastLeftSidebarWidth;
54
+ isResizing = leftSidebarState.isResizing,
55
+ flyoutLockCount = leftSidebarState.flyoutLockCount,
56
+ isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed,
57
+ leftSidebarWidth = leftSidebarState.leftSidebarWidth,
58
+ lastLeftSidebarWidth = leftSidebarState.lastLeftSidebarWidth;
76
59
  var isLocked = flyoutLockCount > 0;
77
60
  var isLockedRef = (0, _react.useRef)(isLocked);
78
61
  var mouseXRef = (0, _react.useRef)(0);
79
62
  var handlerRef = (0, _react.useRef)(null);
80
63
  (0, _react.useEffect)(function () {
81
- isLockedRef.current = isLocked; // I tried a one-time `mousemove` handler that gets attached
64
+ isLockedRef.current = isLocked;
65
+
66
+ // I tried a one-time `mousemove` handler that gets attached
82
67
  // when the lock releases. This is not robust because
83
68
  // the mouse can stay still after release (e.g. using keyboard)
84
69
  // and the sidebar will erroneously stay open.
@@ -89,52 +74,43 @@ var LeftSidebar = function LeftSidebar(props) {
89
74
  handlerRef.current = function (event) {
90
75
  mouseXRef.current = event.clientX;
91
76
  };
92
-
93
77
  document.addEventListener('mousemove', handlerRef.current);
94
78
  }
95
-
96
79
  if (!isLocked && handlerRef.current) {
97
80
  if (mouseXRef.current >= lastLeftSidebarWidth) {
98
81
  setLeftSidebarState(_objectSpread(_objectSpread({}, leftSidebarState), {}, {
99
82
  isFlyoutOpen: false
100
83
  }));
101
84
  }
102
-
103
85
  document.removeEventListener('mousemove', handlerRef.current);
104
86
  handlerRef.current = null;
105
87
  }
106
-
107
88
  return function () {
108
89
  if (handlerRef.current) {
109
90
  document.removeEventListener('mousemove', handlerRef.current);
110
91
  }
111
92
  };
112
93
  }, [isLocked, lastLeftSidebarWidth, leftSidebarState, setLeftSidebarState]);
113
-
114
94
  var _width = Math.max(width || 0, _constants.DEFAULT_LEFT_SIDEBAR_WIDTH);
115
-
116
95
  var collapsedStateOverrideOpen = collapsedState === 'expanded';
117
96
  var leftSidebarWidthOnMount;
118
-
119
97
  if (collapsedStateOverrideOpen) {
120
98
  leftSidebarWidthOnMount = (0, _utils.resolveDimension)(_constants.VAR_LEFT_SIDEBAR_FLYOUT, _width, !width);
121
99
  } else if (isLeftSidebarCollapsed || collapsedState === 'collapsed') {
122
100
  leftSidebarWidthOnMount = _constants.COLLAPSED_LEFT_SIDEBAR_WIDTH;
123
101
  } else {
124
102
  leftSidebarWidthOnMount = (0, _utils.resolveDimension)(_constants.VAR_LEFT_SIDEBAR_WIDTH, _width, !width || !collapsedStateOverrideOpen && (0, _utils.getGridStateFromStorage)('isLeftSidebarCollapsed'));
125
- } // Update state from cache on mount
126
-
103
+ }
127
104
 
105
+ // Update state from cache on mount
128
106
  (0, _react.useEffect)(function () {
129
107
  var cachedCollapsedState = !collapsedStateOverrideOpen && (collapsedState === 'collapsed' || (0, _utils.getGridStateFromStorage)('isLeftSidebarCollapsed') || false);
130
108
  var cachedGridState = (0, _utils.getGridStateFromStorage)('gridState') || {};
131
109
  var leftSidebarWidth = !width && cachedGridState[_constants.VAR_LEFT_SIDEBAR_FLYOUT] ? Math.max(cachedGridState[_constants.VAR_LEFT_SIDEBAR_FLYOUT], _constants.DEFAULT_LEFT_SIDEBAR_WIDTH) : _width;
132
110
  var lastLeftSidebarWidth = !width && cachedGridState[_constants.VAR_LEFT_SIDEBAR_FLYOUT] ? Math.max(cachedGridState[_constants.VAR_LEFT_SIDEBAR_FLYOUT], _constants.DEFAULT_LEFT_SIDEBAR_WIDTH) : _width;
133
-
134
111
  if (cachedCollapsedState) {
135
112
  leftSidebarWidth = _constants.COLLAPSED_LEFT_SIDEBAR_WIDTH;
136
113
  }
137
-
138
114
  setLeftSidebarState({
139
115
  isFlyoutOpen: false,
140
116
  isResizing: isResizing,
@@ -143,46 +119,40 @@ var LeftSidebar = function LeftSidebar(props) {
143
119
  lastLeftSidebarWidth: lastLeftSidebarWidth,
144
120
  flyoutLockCount: 0,
145
121
  isFixed: isFixed
146
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
147
- }, []); // Every time other than mount,
148
- // update the local storage and css variables.
122
+ });
123
+ // eslint-disable-next-line react-hooks/exhaustive-deps
124
+ }, []);
149
125
 
126
+ // Every time other than mount,
127
+ // update the local storage and css variables.
150
128
  var notFirstRun = (0, _react.useRef)(false);
151
129
  (0, _react.useEffect)(function () {
152
130
  if (notFirstRun.current) {
153
131
  var _publishGridState;
154
-
155
132
  (0, _controllers.publishGridState)((_publishGridState = {}, (0, _defineProperty2.default)(_publishGridState, _constants.VAR_LEFT_SIDEBAR_WIDTH, leftSidebarWidth || leftSidebarWidthOnMount), (0, _defineProperty2.default)(_publishGridState, _constants.VAR_LEFT_SIDEBAR_FLYOUT, lastLeftSidebarWidth), _publishGridState));
156
133
  (0, _utils.mergeGridStateIntoStorage)('isLeftSidebarCollapsed', isLeftSidebarCollapsed);
157
134
  }
158
-
159
135
  if (!notFirstRun.current) {
160
136
  notFirstRun.current = true;
161
137
  }
162
-
163
138
  return function () {
164
139
  removeMouseOverListener();
165
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
140
+ };
141
+ // eslint-disable-next-line react-hooks/exhaustive-deps
166
142
  }, [isLeftSidebarCollapsed, leftSidebarWidth, id]);
167
-
168
143
  var onMouseOver = function onMouseOver(event) {
169
144
  var isMouseOnResizeButton = event.target.matches("[".concat(_constants.RESIZE_BUTTON_SELECTOR, "]")) || event.target.matches("[".concat(_constants.RESIZE_BUTTON_SELECTOR, "] *"));
170
-
171
145
  if (isFlyoutOpen || isMouseOnResizeButton || !isLeftSidebarCollapsed) {
172
146
  return;
173
147
  }
174
-
175
148
  event.persist();
176
149
  flyoutTimerRef.current && clearTimeout(flyoutTimerRef.current);
177
-
178
150
  if (!mouseOverEventRef.current) {
179
151
  mouseOverEventRef.current = function (event) {
180
152
  var leftSidebar = leftSideBarRef.current;
181
-
182
153
  if (leftSidebar === null || isLockedRef.current) {
183
154
  return;
184
155
  }
185
-
186
156
  if (!leftSidebar.contains(event.target)) {
187
157
  flyoutTimerRef.current && clearTimeout(flyoutTimerRef.current);
188
158
  onFlyoutCollapse && onFlyoutCollapse();
@@ -195,7 +165,6 @@ var LeftSidebar = function LeftSidebar(props) {
195
165
  }
196
166
  };
197
167
  }
198
-
199
168
  document.addEventListener('mouseover', mouseOverEventRef.current, {
200
169
  capture: true,
201
170
  passive: true
@@ -209,23 +178,18 @@ var LeftSidebar = function LeftSidebar(props) {
209
178
  onFlyoutExpand && onFlyoutExpand();
210
179
  }, _constants.FLYOUT_DELAY);
211
180
  };
212
-
213
181
  var removeMouseOverListener = function removeMouseOverListener() {
214
182
  mouseOverEventRef.current && document.removeEventListener('mouseover', mouseOverEventRef.current, {
215
183
  capture: true,
216
184
  passive: true
217
185
  });
218
186
  };
219
-
220
187
  (0, _controllers.useSkipLink)(id, skipLinkTitle);
221
-
222
188
  var onMouseLeave = function onMouseLeave(event) {
223
189
  var isMouseOnResizeButton = event.target.matches("[".concat(_constants.RESIZE_BUTTON_SELECTOR, "]")) || event.target.matches("[".concat(_constants.RESIZE_BUTTON_SELECTOR, "] *"));
224
-
225
190
  if (isMouseOnResizeButton || !isLeftSidebarCollapsed || flyoutLockCount > 0) {
226
191
  return;
227
192
  }
228
-
229
193
  onFlyoutCollapse && onFlyoutCollapse();
230
194
  setTimeout(function () {
231
195
  setLeftSidebarState(function (current) {
@@ -235,8 +199,8 @@ var LeftSidebar = function LeftSidebar(props) {
235
199
  });
236
200
  }, _constants.FLYOUT_DELAY);
237
201
  };
238
-
239
- return (// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
202
+ return (
203
+ // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
240
204
  (0, _react2.jsx)(_leftSidebarOuter.default, {
241
205
  ref: leftSideBarRef,
242
206
  testId: testId,
@@ -258,7 +222,8 @@ var LeftSidebar = function LeftSidebar(props) {
258
222
  }, children), (0, _react2.jsx)(_resizeControl.default, {
259
223
  testId: testId,
260
224
  resizeGrabAreaLabel: resizeGrabAreaLabel,
261
- resizeButtonLabel: resizeButtonLabel // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
225
+ resizeButtonLabel: resizeButtonLabel
226
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
262
227
  ,
263
228
  overrides: overrides,
264
229
  onCollapse: onCollapse,
@@ -270,6 +235,5 @@ var LeftSidebar = function LeftSidebar(props) {
270
235
  })))
271
236
  );
272
237
  };
273
-
274
238
  var _default = LeftSidebar;
275
239
  exports.default = _default;
@@ -1,33 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _react = require("react");
13
-
14
10
  var _react2 = require("@emotion/react");
15
-
16
11
  var _accessibility = require("@atlaskit/motion/accessibility");
17
-
18
12
  var _curves = require("@atlaskit/motion/curves");
19
-
20
13
  var _constants = require("../../common/constants");
21
-
22
14
  var _hooks = require("../../common/hooks");
23
-
24
15
  var _utils = require("../../common/utils");
25
-
26
16
  var _controllers = require("../../controllers");
27
-
28
17
  var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
29
-
30
18
  /** @jsx jsx */
19
+
31
20
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
32
21
  var prefersReducedMotionStyles = (0, _react2.css)((0, _accessibility.prefersReducedMotion)());
33
22
  var mainStyles = (0, _react2.css)({
@@ -43,16 +32,17 @@ var draggingStyles = (0, _react2.css)({
43
32
  // Make sure drag to resize remains snappy.
44
33
  transition: 'none'
45
34
  });
35
+
46
36
  /**
47
37
  * Adds a negative left margin to main,
48
38
  * which transitions at the same speed as the left sidebar's width increase.
49
39
  * This give an illusion that the flyout is appearing on top of the main content,
50
40
  * while main remains in place.
51
41
  */
52
-
53
42
  var flyoutStyles = (0, _react2.css)({
54
43
  marginLeft: "calc(-1 * var(--".concat(_constants.VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(_constants.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(_constants.COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
55
44
  });
45
+
56
46
  /**
57
47
  * __Main__
58
48
  *
@@ -61,20 +51,17 @@ var flyoutStyles = (0, _react2.css)({
61
51
  * - [Examples](https://atlassian.design/components/page-layout/examples)
62
52
  * - [Code](https://atlassian.design/components/page-layout/code)
63
53
  */
64
-
65
54
  var Main = function Main(props) {
66
55
  var children = props.children,
67
- testId = props.testId,
68
- id = props.id,
69
- skipLinkTitle = props.skipLinkTitle;
56
+ testId = props.testId,
57
+ id = props.id,
58
+ skipLinkTitle = props.skipLinkTitle;
70
59
  (0, _controllers.useSkipLink)(id, skipLinkTitle);
71
60
  var isDragging = (0, _hooks.useIsSidebarDragging)();
72
-
73
61
  var _useContext = (0, _react.useContext)(_controllers.SidebarResizeContext),
74
- _useContext$leftSideb = _useContext.leftSidebarState,
75
- isFlyoutOpen = _useContext$leftSideb.isFlyoutOpen,
76
- isFixed = _useContext$leftSideb.isFixed;
77
-
62
+ _useContext$leftSideb = _useContext.leftSidebarState,
63
+ isFlyoutOpen = _useContext$leftSideb.isFlyoutOpen,
64
+ isFixed = _useContext$leftSideb.isFixed;
78
65
  return (0, _react2.jsx)(_slotFocusRing.default, null, function (_ref) {
79
66
  var className = _ref.className;
80
67
  return (0, _react2.jsx)("div", (0, _extends2.default)({
@@ -85,6 +72,5 @@ var Main = function Main(props) {
85
72
  }, (0, _utils.getPageLayoutSlotSelector)('main')), children);
86
73
  });
87
74
  };
88
-
89
75
  var _default = Main;
90
76
  exports.default = _default;
@@ -1,27 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _react = require("react");
15
-
16
11
  var _react2 = require("@emotion/react");
17
-
18
12
  var _constants = require("../../common/constants");
19
-
20
13
  var _controllers = require("../../controllers");
21
-
22
14
  var _skipLinks = require("../skip-links");
23
-
24
15
  /** @jsx jsx */
16
+
25
17
  var pageLayoutSelector = (0, _defineProperty2.default)({}, _constants.PAGE_LAYOUT_CONTAINER_SELECTOR, true);
26
18
  var gridTemplateAreas = "\n \"".concat(_constants.LEFT_PANEL, " ").concat(_constants.BANNER, " ").concat(_constants.RIGHT_PANEL, "\"\n \"").concat(_constants.LEFT_PANEL, " ").concat(_constants.TOP_NAVIGATION, " ").concat(_constants.RIGHT_PANEL, "\"\n \"").concat(_constants.LEFT_PANEL, " ").concat(_constants.CONTENT, " ").concat(_constants.RIGHT_PANEL, "\"\n ");
27
19
  var gridStyles = (0, _react2.css)({
@@ -32,6 +24,7 @@ var gridStyles = (0, _react2.css)({
32
24
  gridTemplateRows: "".concat(_constants.BANNER_HEIGHT, " ").concat(_constants.TOP_NAVIGATION_HEIGHT, " auto"),
33
25
  outline: 'none'
34
26
  });
27
+
35
28
  /**
36
29
  * __Page layout__
37
30
  *
@@ -40,14 +33,13 @@ var gridStyles = (0, _react2.css)({
40
33
  * - [Examples](https://atlassian.design/components/page-layout/examples)
41
34
  * - [Code](https://atlassian.design/components/page-layout/code)
42
35
  */
43
-
44
36
  var PageLayout = function PageLayout(_ref) {
45
37
  var _ref$skipLinksLabel = _ref.skipLinksLabel,
46
- skipLinksLabel = _ref$skipLinksLabel === void 0 ? _constants.DEFAULT_I18N_PROPS_SKIP_LINKS : _ref$skipLinksLabel,
47
- children = _ref.children,
48
- testId = _ref.testId,
49
- onLeftSidebarExpand = _ref.onLeftSidebarExpand,
50
- onLeftSidebarCollapse = _ref.onLeftSidebarCollapse;
38
+ skipLinksLabel = _ref$skipLinksLabel === void 0 ? _constants.DEFAULT_I18N_PROPS_SKIP_LINKS : _ref$skipLinksLabel,
39
+ children = _ref.children,
40
+ testId = _ref.testId,
41
+ onLeftSidebarExpand = _ref.onLeftSidebarExpand,
42
+ onLeftSidebarCollapse = _ref.onLeftSidebarCollapse;
51
43
  return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_controllers.SkipLinksController, null, (0, _react2.jsx)(_skipLinks.SkipLinkWrapper, {
52
44
  skipLinksLabel: skipLinksLabel
53
45
  }), (0, _react2.jsx)("div", (0, _extends2.default)({}, pageLayoutSelector, {
@@ -59,6 +51,5 @@ var PageLayout = function PageLayout(_ref) {
59
51
  onLeftSidebarExpand: onLeftSidebarExpand
60
52
  }, children))));
61
53
  };
62
-
63
54
  var _default = PageLayout;
64
55
  exports.default = _default;
@@ -1,31 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _react = require("react");
15
-
16
11
  var _react2 = require("@emotion/react");
17
-
18
12
  var _constants = require("../../common/constants");
19
-
20
13
  var _utils = require("../../common/utils");
21
-
22
14
  var _controllers = require("../../controllers");
23
-
24
15
  var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
25
-
26
16
  var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
27
-
28
17
  /** @jsx jsx */
18
+
29
19
  var baseStyles = (0, _react2.css)({
30
20
  gridArea: _constants.RIGHT_PANEL
31
21
  });
@@ -36,6 +26,7 @@ var fixedStyles = (0, _react2.css)({
36
26
  right: 0,
37
27
  bottom: 0
38
28
  });
29
+
39
30
  /**
40
31
  * __Right panel__
41
32
  *
@@ -44,16 +35,15 @@ var fixedStyles = (0, _react2.css)({
44
35
  * - [Examples](https://atlassian.design/components/page-layout/examples)
45
36
  * - [Code](https://atlassian.design/components/page-layout/code)
46
37
  */
47
-
48
38
  var RightPanel = function RightPanel(props) {
49
39
  var children = props.children,
50
- isFixed = props.isFixed,
51
- _props$width = props.width,
52
- width = _props$width === void 0 ? _constants.DEFAULT_RIGHT_PANEL_WIDTH : _props$width,
53
- shouldPersistWidth = props.shouldPersistWidth,
54
- testId = props.testId,
55
- id = props.id,
56
- skipLinkTitle = props.skipLinkTitle;
40
+ isFixed = props.isFixed,
41
+ _props$width = props.width,
42
+ width = _props$width === void 0 ? _constants.DEFAULT_RIGHT_PANEL_WIDTH : _props$width,
43
+ shouldPersistWidth = props.shouldPersistWidth,
44
+ testId = props.testId,
45
+ id = props.id,
46
+ skipLinkTitle = props.skipLinkTitle;
57
47
  var rightPanelWidth = (0, _utils.resolveDimension)(_constants.VAR_RIGHT_PANEL_WIDTH, width, shouldPersistWidth);
58
48
  (0, _react.useEffect)(function () {
59
49
  (0, _controllers.publishGridState)((0, _defineProperty2.default)({}, _constants.VAR_RIGHT_PANEL_WIDTH, rightPanelWidth));
@@ -75,6 +65,5 @@ var RightPanel = function RightPanel(props) {
75
65
  }), children);
76
66
  });
77
67
  };
78
-
79
68
  var _default = RightPanel;
80
69
  exports.default = _default;
@@ -1,30 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _react = require("react");
15
-
16
11
  var _react2 = require("@emotion/react");
17
-
18
12
  var _constants = require("../../common/constants");
19
-
20
13
  var _utils = require("../../common/utils");
21
-
22
14
  var _controllers = require("../../controllers");
23
-
24
15
  var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
25
-
26
16
  var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
27
-
28
17
  /** @jsx jsx */
29
18
 
30
19
  /**
@@ -50,12 +39,12 @@ var staticInnerStyles = (0, _react2.css)({
50
39
  var outerStyles = (0, _react2.css)({
51
40
  width: _constants.RIGHT_SIDEBAR_WIDTH
52
41
  });
42
+
53
43
  /**
54
44
  * In fixed mode this element's child is taken out of the document flow.
55
45
  * It doesn't take up the width as expected,
56
46
  * so the pseudo element forces it to take up the necessary width.
57
47
  */
58
-
59
48
  var fixedOuterStyles = (0, _react2.css)({
60
49
  '&::after': {
61
50
  display: 'inline-block',
@@ -63,6 +52,7 @@ var fixedOuterStyles = (0, _react2.css)({
63
52
  content: "''"
64
53
  }
65
54
  });
55
+
66
56
  /**
67
57
  * __Right sidebar__
68
58
  *
@@ -71,16 +61,15 @@ var fixedOuterStyles = (0, _react2.css)({
71
61
  * - [Examples](https://atlassian.design/components/page-layout/examples)
72
62
  * - [Code](https://atlassian.design/components/page-layout/code)
73
63
  */
74
-
75
64
  var RightSidebar = function RightSidebar(props) {
76
65
  var children = props.children,
77
- _props$width = props.width,
78
- width = _props$width === void 0 ? _constants.DEFAULT_RIGHT_SIDEBAR_WIDTH : _props$width,
79
- isFixed = props.isFixed,
80
- shouldPersistWidth = props.shouldPersistWidth,
81
- testId = props.testId,
82
- id = props.id,
83
- skipLinkTitle = props.skipLinkTitle;
66
+ _props$width = props.width,
67
+ width = _props$width === void 0 ? _constants.DEFAULT_RIGHT_SIDEBAR_WIDTH : _props$width,
68
+ isFixed = props.isFixed,
69
+ shouldPersistWidth = props.shouldPersistWidth,
70
+ testId = props.testId,
71
+ id = props.id,
72
+ skipLinkTitle = props.skipLinkTitle;
84
73
  var rightSidebarWidth = (0, _utils.resolveDimension)(_constants.VAR_RIGHT_SIDEBAR_WIDTH, width, shouldPersistWidth);
85
74
  (0, _react.useEffect)(function () {
86
75
  (0, _controllers.publishGridState)((0, _defineProperty2.default)({}, _constants.VAR_RIGHT_SIDEBAR_WIDTH, rightSidebarWidth));
@@ -106,6 +95,5 @@ var RightSidebar = function RightSidebar(props) {
106
95
  }, children));
107
96
  });
108
97
  };
109
-
110
98
  var _default = RightSidebar;
111
99
  exports.default = _default;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _default = function _default(_ref) {
13
10
  var variableName = _ref.variableName,
14
- value = _ref.value;
11
+ value = _ref.value;
15
12
  return /*#__PURE__*/_react.default.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"));
16
13
  };
17
-
18
14
  exports.default = _default;
@@ -1,31 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _react = require("react");
15
-
16
11
  var _react2 = require("@emotion/react");
17
-
18
12
  var _constants = require("../../common/constants");
19
-
20
13
  var _utils = require("../../common/utils");
21
-
22
14
  var _controllers = require("../../controllers");
23
-
24
15
  var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
25
-
26
16
  var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
27
-
28
17
  /** @jsx jsx */
18
+
29
19
  var topNavigationStyles = (0, _react2.css)({
30
20
  height: _constants.TOP_NAVIGATION_HEIGHT,
31
21
  gridArea: _constants.TOP_NAVIGATION
@@ -37,6 +27,7 @@ var fixedStyles = (0, _react2.css)({
37
27
  right: _constants.RIGHT_PANEL_WIDTH,
38
28
  left: _constants.LEFT_PANEL_WIDTH
39
29
  });
30
+
40
31
  /**
41
32
  * __Top navigation__
42
33
  *
@@ -45,17 +36,16 @@ var fixedStyles = (0, _react2.css)({
45
36
  * - [Examples](https://atlassian.design/components/page-layout/examples)
46
37
  * - [Code](https://atlassian.design/components/page-layout/code)
47
38
  */
48
-
49
39
  var TopNavigation = function TopNavigation(props) {
50
40
  var children = props.children,
51
- _props$height = props.height,
52
- height = _props$height === void 0 ? _constants.DEFAULT_TOP_NAVIGATION_HEIGHT : _props$height,
53
- _props$isFixed = props.isFixed,
54
- isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
55
- shouldPersistHeight = props.shouldPersistHeight,
56
- testId = props.testId,
57
- id = props.id,
58
- skipLinkTitle = props.skipLinkTitle;
41
+ _props$height = props.height,
42
+ height = _props$height === void 0 ? _constants.DEFAULT_TOP_NAVIGATION_HEIGHT : _props$height,
43
+ _props$isFixed = props.isFixed,
44
+ isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
45
+ shouldPersistHeight = props.shouldPersistHeight,
46
+ testId = props.testId,
47
+ id = props.id,
48
+ skipLinkTitle = props.skipLinkTitle;
59
49
  var topNavigationHeight = (0, _utils.resolveDimension)(_constants.VAR_TOP_NAVIGATION_HEIGHT, height, shouldPersistHeight);
60
50
  (0, _react.useEffect)(function () {
61
51
  (0, _controllers.publishGridState)((0, _defineProperty2.default)({}, _constants.VAR_TOP_NAVIGATION_HEIGHT, topNavigationHeight));
@@ -77,6 +67,5 @@ var TopNavigation = function TopNavigation(props) {
77
67
  }), children);
78
68
  });
79
69
  };
80
-
81
70
  var _default = TopNavigation;
82
71
  exports.default = _default;