@atlaskit/page-layout 1.6.4 → 1.7.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 (60) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/__perf__/utils/product-integration/sample-footer.tsx +2 -2
  3. package/__perf__/utils/product-integration/sample-header.tsx +1 -3
  4. package/dist/cjs/common/constants.js +5 -1
  5. package/dist/cjs/components/resize-control/index.js +16 -24
  6. package/dist/cjs/components/resize-control/resize-button.js +10 -4
  7. package/dist/cjs/components/skip-links/skip-link-components.js +1 -1
  8. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +29 -2
  9. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +40 -7
  10. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +1 -1
  11. package/dist/cjs/components/slots/left-sidebar.js +137 -39
  12. package/dist/cjs/components/slots/main.js +1 -1
  13. package/dist/cjs/components/slots/page-layout.js +10 -1
  14. package/dist/cjs/components/slots/slot-dimensions.js +5 -2
  15. package/dist/cjs/controllers/sidebar-resize-context.js +2 -1
  16. package/dist/cjs/controllers/sidebar-resize-controller.js +96 -35
  17. package/dist/cjs/version.json +1 -1
  18. package/dist/es2019/common/constants.js +2 -0
  19. package/dist/es2019/components/resize-control/index.js +15 -23
  20. package/dist/es2019/components/resize-control/resize-button.js +13 -4
  21. package/dist/es2019/components/skip-links/skip-link-components.js +1 -1
  22. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +34 -3
  23. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +51 -8
  24. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +1 -1
  25. package/dist/es2019/components/slots/left-sidebar.js +142 -42
  26. package/dist/es2019/components/slots/main.js +1 -1
  27. package/dist/es2019/components/slots/page-layout.js +17 -1
  28. package/dist/es2019/components/slots/slot-dimensions.js +5 -2
  29. package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
  30. package/dist/es2019/controllers/sidebar-resize-controller.js +96 -38
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/common/constants.js +2 -0
  33. package/dist/esm/components/resize-control/index.js +15 -23
  34. package/dist/esm/components/resize-control/resize-button.js +10 -4
  35. package/dist/esm/components/skip-links/skip-link-components.js +1 -1
  36. package/dist/esm/components/slots/internal/left-sidebar-inner.js +29 -3
  37. package/dist/esm/components/slots/internal/left-sidebar-outer.js +42 -9
  38. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +1 -1
  39. package/dist/esm/components/slots/left-sidebar.js +140 -42
  40. package/dist/esm/components/slots/main.js +1 -1
  41. package/dist/esm/components/slots/page-layout.js +10 -1
  42. package/dist/esm/components/slots/slot-dimensions.js +5 -2
  43. package/dist/esm/controllers/sidebar-resize-context.js +2 -1
  44. package/dist/esm/controllers/sidebar-resize-controller.js +96 -35
  45. package/dist/esm/version.json +1 -1
  46. package/dist/types/common/constants.d.ts +2 -0
  47. package/dist/types/components/resize-control/types.d.ts +0 -2
  48. package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +1 -1
  49. package/dist/types/components/slots/left-sidebar.d.ts +6 -0
  50. package/dist/types/components/slots/slot-dimensions.d.ts +2 -1
  51. package/dist/types/controllers/sidebar-resize-context.d.ts +10 -0
  52. package/dist/types-ts4.5/common/constants.d.ts +2 -0
  53. package/dist/types-ts4.5/components/resize-control/types.d.ts +0 -2
  54. package/dist/types-ts4.5/components/slots/internal/left-sidebar-outer.d.ts +1 -1
  55. package/dist/types-ts4.5/components/slots/left-sidebar.d.ts +6 -0
  56. package/dist/types-ts4.5/components/slots/slot-dimensions.d.ts +2 -1
  57. package/dist/types-ts4.5/controllers/sidebar-resize-context.d.ts +10 -0
  58. package/package.json +12 -6
  59. package/report.api.md +7 -6
  60. package/tmp/api-report-tmp.d.ts +174 -0
@@ -8,6 +8,8 @@ import { css, jsx } from '@emotion/react';
8
8
  import ChevronRight from '@atlaskit/icon/glyph/chevron-right';
9
9
  import { easeOut } from '@atlaskit/motion/curves';
10
10
  import { mediumDurationMs, smallDurationMs } from '@atlaskit/motion/durations';
11
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
+ import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
11
13
  import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
12
14
  import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
13
15
  var increaseHitAreaStyles = css({
@@ -17,10 +19,15 @@ var increaseHitAreaStyles = css({
17
19
  bottom: "calc(-1 * ".concat("var(--ds-space-100, 8px)", ")"),
18
20
  left: "calc(-1 * ".concat("var(--ds-space-100, 8px)", ")")
19
21
  });
22
+
23
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
24
+ var mobileStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
25
+ opacity: 1
26
+ })) : undefined;
20
27
  var resizeIconButtonStyles = css({
21
28
  width: 24,
22
29
  height: 24,
23
- padding: 0,
30
+ padding: "var(--ds-space-0, 0px)",
24
31
  position: 'absolute',
25
32
  top: "var(--ds-space-400, 32px)",
26
33
  left: 0,
@@ -73,10 +80,9 @@ var ResizeButton = function ResizeButton(_ref) {
73
80
  "aria-expanded": !isLeftSidebarCollapsed,
74
81
  "aria-label": label,
75
82
  type: "button",
76
- css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
83
+ css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
77
84
  "data-testid": testId
78
- // Prevents focus staying attached to the button
79
- // when pressed
85
+ // Prevents focus staying attached to the button when pressed
80
86
  ,
81
87
  onMouseDown: preventDefault
82
88
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -10,7 +10,7 @@ import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
10
10
  import { N30A, N60A } from '@atlaskit/theme/colors';
11
11
  import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
12
12
  import { useSkipLinks } from '../../controllers';
13
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
13
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
14
14
  var prefersReducedMotionStyles = css(prefersReducedMotion());
15
15
  var skipLinkStyles = css({
16
16
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
@@ -1,12 +1,34 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  /** @jsx jsx */
2
3
 
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
5
- import { BANNER_HEIGHT, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../../common/constants';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
8
+ import { BANNER_HEIGHT, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH, MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../../common/constants';
6
9
  import { useIsSidebarDragging } from '../../../common/hooks';
7
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
10
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
8
11
  var prefersReducedMotionStyles = css(prefersReducedMotion());
9
12
 
13
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
14
+ var mobileStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
15
+ width: "".concat(MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, "px"),
16
+ position: 'fixed',
17
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
18
+ top: "calc(".concat(BANNER_HEIGHT, " + ").concat(TOP_NAVIGATION_HEIGHT, ")"),
19
+ bottom: 0,
20
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
21
+ left: "".concat(LEFT_PANEL_WIDTH),
22
+ transition: "width ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s")
23
+ })) : undefined;
24
+
25
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
26
+ var mobileInnerFlyoutStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
27
+ width: "min(90vw, ".concat(MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH, "px)"),
28
+ maxWidth: MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH,
29
+ transition: "width ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s, box-shadow ").concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s")
30
+ })) : undefined;
31
+
10
32
  /**
11
33
  * This inner wrapper is required to allow the sidebar to be `position: fixed`.
12
34
  *
@@ -48,7 +70,11 @@ var LeftSidebarInner = function LeftSidebarInner(_ref) {
48
70
  isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen;
49
71
  var isDragging = useIsSidebarDragging();
50
72
  return jsx("div", {
51
- css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
73
+ css: [
74
+ // mobile breakpoint styles
75
+ mobileStyles, isFlyoutOpen && mobileInnerFlyoutStyles,
76
+ // generic styles
77
+ !isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
52
78
  }, children);
53
79
  };
54
80
 
@@ -1,17 +1,39 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  /** @jsx jsx */
3
- import { forwardRef } from 'react';
4
+ import { forwardRef, useContext } from 'react';
4
5
  import { css, jsx } from '@emotion/react';
5
6
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
6
- import { COLLAPSED_LEFT_SIDEBAR_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, TRANSITION_DURATION } from '../../../common/constants';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
9
+ import { COLLAPSED_LEFT_SIDEBAR_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH, MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, TRANSITION_DURATION } from '../../../common/constants';
7
10
  import { useIsSidebarDragging } from '../../../common/hooks';
8
11
  import { getPageLayoutSlotSelector } from '../../../common/utils';
12
+ import { SidebarResizeContext } from '../../../controllers';
9
13
  import SlotFocusRing from './slot-focus-ring';
10
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
14
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
11
15
  var prefersReducedMotionStyles = css(prefersReducedMotion());
16
+
17
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
18
+ var mobileStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
19
+ width: MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH,
20
+ cursor: 'pointer',
21
+ opacity: 1,
22
+ transition: "width ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s"),
23
+ '&::after': {
24
+ display: 'inline-block',
25
+ maxWidth: MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH,
26
+ content: "''"
27
+ }
28
+ })) : undefined;
29
+
30
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
31
+ var mobileFlyoutStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
32
+ cursor: 'revert'
33
+ })) : undefined;
12
34
  var outerStyles = css({
13
35
  width: LEFT_SIDEBAR_WIDTH,
14
- marginLeft: 0,
36
+ marginLeft: "var(--ds-space-0, 0px)",
15
37
  position: 'relative',
16
38
  zIndex: 1,
17
39
  transition: "width ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s"),
@@ -48,30 +70,41 @@ var LeftSidebarOuter = function LeftSidebarOuter(_ref, ref) {
48
70
  var children = _ref.children,
49
71
  _ref$isFixed = _ref.isFixed,
50
72
  isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
51
- _ref$isFlyoutOpen = _ref.isFlyoutOpen,
52
- isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen,
53
73
  testId = _ref.testId,
54
74
  onMouseLeave = _ref.onMouseLeave,
55
75
  onMouseOver = _ref.onMouseOver,
76
+ onClick = _ref.onClick,
56
77
  id = _ref.id;
57
78
  var isDragging = useIsSidebarDragging();
79
+ var _useContext = useContext(SidebarResizeContext),
80
+ isFlyoutOpen = _useContext.leftSidebarState.isFlyoutOpen;
58
81
  return jsx(SlotFocusRing, {
59
82
  isSidebar: true
60
83
  }, function (_ref2) {
61
84
  var className = _ref2.className;
62
85
  return (
63
86
  /**
64
- * The mouse handlers control flyout behavior, a mouse-only experience.
87
+ * On desktop, the `onMouseOver|onMouseLeave` handlers controls the temporary flyout behavior.
88
+ * This is an intentionally mouse-only experience, it may even be disruptive with keyboard navigation.
89
+ *
90
+ * On mobile, the `onClick` handler controls the toggled flyout behaviour.
91
+ * This is not intended to be how you use this with a keyboard, there is a ResizeButton for this intentionally instead.
65
92
  */
66
93
  // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
67
94
  jsx("div", _extends({
68
- css: [outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
95
+ css: [
96
+ // mobile breakpoint styles
97
+ mobileStyles, isFlyoutOpen && mobileFlyoutStyles,
98
+ // generic styles
99
+ outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
69
100
  className: className,
70
101
  "data-testid": testId,
71
102
  id: id,
72
103
  onMouseOver: onMouseOver,
73
104
  onMouseLeave: onMouseLeave,
74
- ref: ref
105
+ onClick: onClick,
106
+ ref: ref,
107
+ "aria-hidden": "true"
75
108
  }, selector), children)
76
109
  );
77
110
  });
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/react';
4
4
  import { prefersReducedMotion } from '@atlaskit/motion';
5
5
  import { TRANSITION_DURATION } from '../../../common/constants';
6
6
  import { useIsSidebarCollapsing } from '../../../common/hooks';
7
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
7
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
8
8
  var prefersReducedMotionStyles = css(prefersReducedMotion());
9
9
 
10
10
  /**
@@ -3,9 +3,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3
3
  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; }
4
4
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
5
5
  /** @jsx jsx */
6
- import { useContext, useEffect, useRef } from 'react';
7
- import { jsx } from '@emotion/react';
8
- import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, FLYOUT_DELAY, RESIZE_BUTTON_SELECTOR, VAR_LEFT_SIDEBAR_FLYOUT, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
6
+ import { Fragment, useCallback, useContext, useEffect, useRef } from 'react';
7
+ import { css, jsx } from '@emotion/react';
8
+ import useCloseOnEscapePress from '@atlaskit/ds-lib/use-close-on-escape-press';
9
+ import { easeOut } from '@atlaskit/motion';
10
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
+ import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
12
+ import { N100A } from '@atlaskit/theme/colors';
13
+ import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, FLYOUT_DELAY, MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, RESIZE_BUTTON_SELECTOR, TRANSITION_DURATION, VAR_LEFT_SIDEBAR_FLYOUT, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
9
14
  import { getGridStateFromStorage, mergeGridStateIntoStorage, resolveDimension } from '../../common/utils';
10
15
  import { publishGridState, SidebarResizeContext, useSkipLink } from '../../controllers';
11
16
  import ResizeControl from '../resize-control';
@@ -14,11 +19,32 @@ import LeftSidebarOuter from './internal/left-sidebar-outer';
14
19
  import ResizableChildrenWrapper from './internal/resizable-children-wrapper';
15
20
  import SlotDimensions from './slot-dimensions';
16
21
 
22
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
23
+ var openBackdropStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css({
24
+ width: '100%',
25
+ height: '100%',
26
+ position: 'absolute',
27
+ background: "var(--ds-blanket, ".concat(N100A, ")"),
28
+ opacity: 1
29
+ }) : undefined;
30
+
31
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
32
+ var hiddenBackdropStyles = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css({
33
+ opacity: 0,
34
+ transition: "opacity ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s")
35
+ }) : undefined;
36
+
17
37
  /**
18
38
  * __Left sidebar__
19
39
  *
20
40
  * Provides a slot for a left sidebar within the PageLayout.
21
41
  *
42
+ * [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
43
+ * On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
44
+ * put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
45
+ * This ensures the contents behind do not reflow oddly and allows for a better experience
46
+ * resizing between mobile and desktop.
47
+ *
22
48
  * - [Examples](https://atlassian.design/components/page-layout/examples)
23
49
  * - [Code](https://atlassian.design/components/page-layout/code)
24
50
  */
@@ -74,9 +100,11 @@ var LeftSidebar = function LeftSidebar(props) {
74
100
  }
75
101
  if (!isLocked && handlerRef.current) {
76
102
  if (mouseXRef.current >= lastLeftSidebarWidth) {
77
- setLeftSidebarState(_objectSpread(_objectSpread({}, leftSidebarState), {}, {
78
- isFlyoutOpen: false
79
- }));
103
+ setLeftSidebarState(function (current) {
104
+ return _objectSpread(_objectSpread({}, current), {}, {
105
+ isFlyoutOpen: false
106
+ });
107
+ });
80
108
  }
81
109
  document.removeEventListener('mousemove', handlerRef.current);
82
110
  handlerRef.current = null;
@@ -86,7 +114,7 @@ var LeftSidebar = function LeftSidebar(props) {
86
114
  document.removeEventListener('mousemove', handlerRef.current);
87
115
  }
88
116
  };
89
- }, [isLocked, lastLeftSidebarWidth, leftSidebarState, setLeftSidebarState]);
117
+ }, [isLocked, lastLeftSidebarWidth, setLeftSidebarState]);
90
118
  var _width = Math.max(width || 0, DEFAULT_LEFT_SIDEBAR_WIDTH);
91
119
  var collapsedStateOverrideOpen = collapsedState === 'expanded';
92
120
  var leftSidebarWidthOnMount;
@@ -195,40 +223,110 @@ var LeftSidebar = function LeftSidebar(props) {
195
223
  });
196
224
  }, FLYOUT_DELAY);
197
225
  };
198
- return (
199
- // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
200
- jsx(LeftSidebarOuter, {
201
- ref: leftSideBarRef,
202
- testId: testId,
203
- onMouseOver: onMouseOver,
204
- onMouseLeave: onMouseLeave,
205
- id: id,
206
- isFixed: isFixed,
207
- isFlyoutOpen: isFlyoutOpen
208
- }, jsx(SlotDimensions, {
209
- variableName: VAR_LEFT_SIDEBAR_WIDTH,
210
- value: notFirstRun.current ? leftSidebarWidth : leftSidebarWidthOnMount
211
- }), jsx(LeftSidebarInner, {
212
- isFixed: isFixed,
213
- isFlyoutOpen: isFlyoutOpen
214
- }, jsx(ResizableChildrenWrapper, {
215
- isFlyoutOpen: isFlyoutOpen,
216
- isLeftSidebarCollapsed: isLeftSidebarCollapsed,
217
- hasCollapsedState: !notFirstRun.current && collapsedState === 'collapsed'
218
- }, children), jsx(ResizeControl, {
219
- testId: testId,
220
- resizeGrabAreaLabel: resizeGrabAreaLabel,
221
- resizeButtonLabel: resizeButtonLabel
222
- // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
223
- ,
224
- overrides: overrides,
225
- onCollapse: onCollapse,
226
- onExpand: onExpand,
227
- onResizeStart: onResizeStart,
228
- onResizeEnd: onResizeEnd,
229
- leftSidebarState: leftSidebarState,
230
- setLeftSidebarState: setLeftSidebarState
231
- })))
232
- );
226
+ var mobileMediaQuery = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
227
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
228
+ useMediaQuery('below.md') : null;
229
+ var openMobileFlyout = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
230
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
231
+ useCallback(function () {
232
+ if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
233
+ return;
234
+ }
235
+ setLeftSidebarState(function (current) {
236
+ if (current.isFlyoutOpen) {
237
+ return current;
238
+ }
239
+ onExpand === null || onExpand === void 0 ? void 0 : onExpand();
240
+ return _objectSpread(_objectSpread({}, current), {}, {
241
+ isFlyoutOpen: true
242
+ });
243
+ });
244
+ }, [setLeftSidebarState, onExpand, mobileMediaQuery]) : undefined;
245
+ var closeMobileFlyout = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
246
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
247
+ useCallback(function () {
248
+ if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
249
+ return;
250
+ }
251
+ setLeftSidebarState(function (current) {
252
+ if (!current.isFlyoutOpen) {
253
+ return current;
254
+ }
255
+ onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse();
256
+ return _objectSpread(_objectSpread({}, current), {}, {
257
+ isFlyoutOpen: false
258
+ });
259
+ });
260
+ }, [setLeftSidebarState, onCollapse, mobileMediaQuery]) : undefined;
261
+ if (getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g')) {
262
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
263
+ useMediaQuery('below.md', function (event) {
264
+ setLeftSidebarState(function (current) {
265
+ if (event.matches && !current.isLeftSidebarCollapsed) {
266
+ // Sidebar was previously open when resizing downwards, convert the sidebar being open to a flyout being open
267
+ return _objectSpread(_objectSpread({}, current), {}, {
268
+ isResizing: false,
269
+ isLeftSidebarCollapsed: true,
270
+ leftSidebarWidth: COLLAPSED_LEFT_SIDEBAR_WIDTH,
271
+ lastLeftSidebarWidth: current.leftSidebarWidth,
272
+ isFlyoutOpen: true
273
+ });
274
+ } else if (!event.matches && current.isFlyoutOpen) {
275
+ // The user is resizing "upwards", eg. going from mobile to desktop.
276
+ // Flyout was previously open, let's keep it open by moving to the un-collapsed sidebar instead
277
+
278
+ return _objectSpread(_objectSpread({}, current), {}, {
279
+ isResizing: false,
280
+ isLeftSidebarCollapsed: false,
281
+ leftSidebarWidth: Math.max(current.lastLeftSidebarWidth, DEFAULT_LEFT_SIDEBAR_WIDTH),
282
+ isFlyoutOpen: false
283
+ });
284
+ }
285
+ return current;
286
+ });
287
+ });
288
+
289
+ // Close the flyout when the "escape" key is pressed.
290
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
291
+ useCloseOnEscapePress({
292
+ onClose: closeMobileFlyout,
293
+ isDisabled: !isFlyoutOpen
294
+ });
295
+ }
296
+ return jsx(Fragment, null, (mobileMediaQuery === null || mobileMediaQuery === void 0 ? void 0 : mobileMediaQuery.matches) && getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && jsx("div", {
297
+ "aria-hidden": "true",
298
+ css: [hiddenBackdropStyles, isFlyoutOpen && openBackdropStyles],
299
+ onClick: closeMobileFlyout
300
+ }), jsx(LeftSidebarOuter, {
301
+ ref: leftSideBarRef,
302
+ testId: testId,
303
+ onMouseOver: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseOver : undefined,
304
+ onMouseLeave: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseLeave : undefined,
305
+ onClick: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? openMobileFlyout : undefined,
306
+ id: id,
307
+ isFixed: isFixed
308
+ }, jsx(SlotDimensions, {
309
+ variableName: VAR_LEFT_SIDEBAR_WIDTH,
310
+ value: notFirstRun.current ? leftSidebarWidth : leftSidebarWidthOnMount,
311
+ mobileValue: MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH
312
+ }), jsx(LeftSidebarInner, {
313
+ isFixed: isFixed,
314
+ isFlyoutOpen: isFlyoutOpen
315
+ }, jsx(ResizableChildrenWrapper, {
316
+ isFlyoutOpen: isFlyoutOpen,
317
+ isLeftSidebarCollapsed: isLeftSidebarCollapsed,
318
+ hasCollapsedState: !notFirstRun.current && collapsedState === 'collapsed'
319
+ }, children), jsx(ResizeControl, {
320
+ testId: testId,
321
+ resizeGrabAreaLabel: resizeGrabAreaLabel,
322
+ resizeButtonLabel: resizeButtonLabel
323
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
324
+ ,
325
+ overrides: overrides,
326
+ onCollapse: onCollapse,
327
+ onExpand: onExpand,
328
+ onResizeStart: onResizeStart,
329
+ onResizeEnd: onResizeEnd
330
+ }))));
233
331
  };
234
332
  export default LeftSidebar;
@@ -10,7 +10,7 @@ import { getPageLayoutSlotSelector } from '../../common/utils';
10
10
  import { SidebarResizeContext, useSkipLink } from '../../controllers';
11
11
  import SlotFocusRing from './internal/slot-focus-ring';
12
12
 
13
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
13
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
14
14
  var prefersReducedMotionStyles = css(prefersReducedMotion());
15
15
  var mainStyles = css({
16
16
  minWidth: 0,
@@ -3,10 +3,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  /** @jsx jsx */
4
4
  import { Fragment } from 'react';
5
5
  import { css, jsx } from '@emotion/react';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
6
8
  import { BANNER, BANNER_HEIGHT, CONTENT, DEFAULT_I18N_PROPS_SKIP_LINKS, LEFT_PANEL, LEFT_PANEL_WIDTH, PAGE_LAYOUT_CONTAINER_SELECTOR, RIGHT_PANEL, RIGHT_PANEL_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT } from '../../common/constants';
7
9
  import { SidebarResizeController, SkipLinksController } from '../../controllers';
8
10
  import { SkipLinkWrapper } from '../skip-links';
9
11
  var pageLayoutSelector = _defineProperty({}, PAGE_LAYOUT_CONTAINER_SELECTOR, true);
12
+ var gridTemplateAreasMobile = "\n \"".concat(LEFT_PANEL, " ").concat(BANNER, "\"\n \"").concat(LEFT_PANEL, " ").concat(TOP_NAVIGATION, "\"\n \"").concat(LEFT_PANEL, " ").concat(CONTENT, "\"\n ");
10
13
  var gridTemplateAreas = "\n \"".concat(LEFT_PANEL, " ").concat(BANNER, " ").concat(RIGHT_PANEL, "\"\n \"").concat(LEFT_PANEL, " ").concat(TOP_NAVIGATION, " ").concat(RIGHT_PANEL, "\"\n \"").concat(LEFT_PANEL, " ").concat(CONTENT, " ").concat(RIGHT_PANEL, "\"\n ");
11
14
  var gridStyles = css({
12
15
  display: 'grid',
@@ -17,6 +20,12 @@ var gridStyles = css({
17
20
  outline: 'none'
18
21
  });
19
22
 
23
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
24
+ var gridStylesMobile = getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? css(_defineProperty({}, media.below.md, {
25
+ gridTemplateAreas: gridTemplateAreasMobile,
26
+ gridTemplateColumns: "".concat(LEFT_PANEL_WIDTH, " minmax(0, 1fr)")
27
+ })) : undefined;
28
+
20
29
  /**
21
30
  * __Page layout__
22
31
  *
@@ -36,7 +45,7 @@ var PageLayout = function PageLayout(_ref) {
36
45
  skipLinksLabel: skipLinksLabel
37
46
  }), jsx("div", _extends({}, pageLayoutSelector, {
38
47
  "data-testid": testId,
39
- css: gridStyles,
48
+ css: [gridStyles, gridStylesMobile],
40
49
  tabIndex: -1
41
50
  }), jsx(SidebarResizeController, {
42
51
  onLeftSidebarCollapse: onLeftSidebarCollapse,
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
2
4
  export default (function (_ref) {
3
5
  var variableName = _ref.variableName,
4
- value = _ref.value;
5
- return /*#__PURE__*/React.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"));
6
+ value = _ref.value,
7
+ mobileValue = _ref.mobileValue;
8
+ return /*#__PURE__*/React.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"), getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && mobileValue && "".concat(media.below.md, " { :root{--").concat(variableName, ":").concat(mobileValue, "px;} }"));
6
9
  });
@@ -20,7 +20,8 @@ export var SidebarResizeContext = /*#__PURE__*/createContext({
20
20
  expandLeftSidebar: noop,
21
21
  collapseLeftSidebar: noop,
22
22
  leftSidebarState: leftSidebarState,
23
- setLeftSidebarState: noop
23
+ setLeftSidebarState: noop,
24
+ toggleLeftSidebar: noop
24
25
  });
25
26
  export var usePageLayoutResize = function usePageLayoutResize() {
26
27
  var _useContext = useContext(SidebarResizeContext),