@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.
- package/CHANGELOG.md +14 -0
- package/__perf__/utils/product-integration/sample-footer.tsx +2 -2
- package/__perf__/utils/product-integration/sample-header.tsx +1 -3
- package/dist/cjs/common/constants.js +5 -1
- package/dist/cjs/components/resize-control/index.js +16 -24
- package/dist/cjs/components/resize-control/resize-button.js +10 -4
- package/dist/cjs/components/skip-links/skip-link-components.js +1 -1
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +29 -2
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +40 -7
- package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +1 -1
- package/dist/cjs/components/slots/left-sidebar.js +137 -39
- package/dist/cjs/components/slots/main.js +1 -1
- package/dist/cjs/components/slots/page-layout.js +10 -1
- package/dist/cjs/components/slots/slot-dimensions.js +5 -2
- package/dist/cjs/controllers/sidebar-resize-context.js +2 -1
- package/dist/cjs/controllers/sidebar-resize-controller.js +96 -35
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/components/resize-control/index.js +15 -23
- package/dist/es2019/components/resize-control/resize-button.js +13 -4
- package/dist/es2019/components/skip-links/skip-link-components.js +1 -1
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +34 -3
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +51 -8
- package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +1 -1
- package/dist/es2019/components/slots/left-sidebar.js +142 -42
- package/dist/es2019/components/slots/main.js +1 -1
- package/dist/es2019/components/slots/page-layout.js +17 -1
- package/dist/es2019/components/slots/slot-dimensions.js +5 -2
- package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
- package/dist/es2019/controllers/sidebar-resize-controller.js +96 -38
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/components/resize-control/index.js +15 -23
- package/dist/esm/components/resize-control/resize-button.js +10 -4
- package/dist/esm/components/skip-links/skip-link-components.js +1 -1
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +29 -3
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +42 -9
- package/dist/esm/components/slots/internal/resizable-children-wrapper.js +1 -1
- package/dist/esm/components/slots/left-sidebar.js +140 -42
- package/dist/esm/components/slots/main.js +1 -1
- package/dist/esm/components/slots/page-layout.js +10 -1
- package/dist/esm/components/slots/slot-dimensions.js +5 -2
- package/dist/esm/controllers/sidebar-resize-context.js +2 -1
- package/dist/esm/controllers/sidebar-resize-controller.js +96 -35
- package/dist/esm/version.json +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/components/resize-control/types.d.ts +0 -2
- package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +1 -1
- package/dist/types/components/slots/left-sidebar.d.ts +6 -0
- package/dist/types/components/slots/slot-dimensions.d.ts +2 -1
- package/dist/types/controllers/sidebar-resize-context.d.ts +10 -0
- package/dist/types-ts4.5/common/constants.d.ts +2 -0
- package/dist/types-ts4.5/components/resize-control/types.d.ts +0 -2
- package/dist/types-ts4.5/components/slots/internal/left-sidebar-outer.d.ts +1 -1
- package/dist/types-ts4.5/components/slots/left-sidebar.d.ts +6 -0
- package/dist/types-ts4.5/components/slots/slot-dimensions.d.ts +2 -1
- package/dist/types-ts4.5/controllers/sidebar-resize-context.d.ts +10 -0
- package/package.json +12 -6
- package/report.api.md +7 -6
- package/tmp/api-report-tmp.d.ts +174 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/page-layout
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7be6f82bb0d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7be6f82bb0d) - [ux] Behind tested behind a feature flag, we're testing new mobile functionality to keep our left sidebar in a "flyout" mode in mobile so navigation or content sits ontop of the main page content rather than crushing it.
|
|
8
|
+
|
|
9
|
+
This is designed to be SSR-compatible as it's primarily CSS-based with some user-event driven logic around mobile breakpoints that should not be inmpacted by SSR rendering (and should return the default desktop experience if such a state is achieved).
|
|
10
|
+
|
|
11
|
+
## 1.6.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`e7ea6832ad2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7ea6832ad2) - Bans the use of React.FC/React.FunctionComponent type in ADS components as part of the React 18 migration work. The change is internal only and should not introduce any changes for the component consumers.
|
|
16
|
+
|
|
3
17
|
## 1.6.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
3
|
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ import { Footer } from '@atlaskit/side-navigation';
|
|
|
8
8
|
import { B400, N200 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { token } from '@atlaskit/tokens';
|
|
10
10
|
|
|
11
|
-
const Container
|
|
11
|
+
const Container = (props: CustomItemComponentProps) => {
|
|
12
12
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
13
13
|
return <div {...props} />;
|
|
14
14
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
2
|
import { jsx } from '@emotion/react';
|
|
5
3
|
|
|
6
4
|
import Icon from '@atlaskit/icon';
|
|
7
5
|
import { CustomItemComponentProps } from '@atlaskit/menu';
|
|
8
6
|
import { Header } from '@atlaskit/side-navigation';
|
|
9
7
|
|
|
10
|
-
const Container
|
|
8
|
+
const Container = (props: CustomItemComponentProps) => {
|
|
11
9
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
12
10
|
return <div {...props} />;
|
|
13
11
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VAR_TOP_NAVIGATION_HEIGHT = exports.VAR_RIGHT_SIDEBAR_WIDTH = exports.VAR_RIGHT_PANEL_WIDTH = exports.VAR_LEFT_SIDEBAR_WIDTH = exports.VAR_LEFT_SIDEBAR_FLYOUT = exports.VAR_LEFT_PANEL_WIDTH = exports.VAR_BANNER_HEIGHT = exports.TRANSITION_DURATION = exports.TOP_NAVIGATION_HEIGHT = exports.TOP_NAVIGATION = exports.RIGHT_SIDEBAR_WIDTH = exports.RIGHT_SIDEBAR = exports.RIGHT_PANEL_WIDTH = exports.RIGHT_PANEL = exports.RESIZE_CONTROL_SELECTOR = exports.RESIZE_BUTTON_SELECTOR = exports.PAGE_LAYOUT_SLOT_SELECTOR = exports.PAGE_LAYOUT_LS_KEY = exports.PAGE_LAYOUT_CONTAINER_SELECTOR = exports.MIN_LEFT_SIDEBAR_WIDTH = exports.MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = exports.MAIN = exports.LEFT_SIDEBAR_WIDTH = exports.LEFT_SIDEBAR_FLYOUT_WIDTH = exports.LEFT_SIDEBAR_EXPANDED_WIDTH = exports.LEFT_SIDEBAR = exports.LEFT_PANEL_WIDTH = exports.LEFT_PANEL = exports.IS_SIDEBAR_DRAGGING = exports.IS_SIDEBAR_COLLAPSING = exports.IS_FLYOUT_OPEN = exports.GRAB_AREA_SELECTOR = exports.GRAB_AREA_LINE_SELECTOR = exports.FLYOUT_DELAY = exports.DIMENSIONS = exports.DEFAULT_TOP_NAVIGATION_HEIGHT = exports.DEFAULT_RIGHT_SIDEBAR_WIDTH = exports.DEFAULT_RIGHT_PANEL_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = exports.DEFAULT_LEFT_PANEL_WIDTH = exports.DEFAULT_I18N_PROPS_SKIP_LINKS = exports.DEFAULT_BANNER_HEIGHT = exports.CONTENT = exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = exports.BANNER_HEIGHT = exports.BANNER = void 0;
|
|
6
|
+
exports.VAR_TOP_NAVIGATION_HEIGHT = exports.VAR_RIGHT_SIDEBAR_WIDTH = exports.VAR_RIGHT_PANEL_WIDTH = exports.VAR_LEFT_SIDEBAR_WIDTH = exports.VAR_LEFT_SIDEBAR_FLYOUT = exports.VAR_LEFT_PANEL_WIDTH = exports.VAR_BANNER_HEIGHT = exports.TRANSITION_DURATION = exports.TOP_NAVIGATION_HEIGHT = exports.TOP_NAVIGATION = exports.RIGHT_SIDEBAR_WIDTH = exports.RIGHT_SIDEBAR = exports.RIGHT_PANEL_WIDTH = exports.RIGHT_PANEL = exports.RESIZE_CONTROL_SELECTOR = exports.RESIZE_BUTTON_SELECTOR = exports.PAGE_LAYOUT_SLOT_SELECTOR = exports.PAGE_LAYOUT_LS_KEY = exports.PAGE_LAYOUT_CONTAINER_SELECTOR = exports.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH = exports.MIN_LEFT_SIDEBAR_WIDTH = exports.MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = exports.MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH = exports.MAIN = exports.LEFT_SIDEBAR_WIDTH = exports.LEFT_SIDEBAR_FLYOUT_WIDTH = exports.LEFT_SIDEBAR_EXPANDED_WIDTH = exports.LEFT_SIDEBAR = exports.LEFT_PANEL_WIDTH = exports.LEFT_PANEL = exports.IS_SIDEBAR_DRAGGING = exports.IS_SIDEBAR_COLLAPSING = exports.IS_FLYOUT_OPEN = exports.GRAB_AREA_SELECTOR = exports.GRAB_AREA_LINE_SELECTOR = exports.FLYOUT_DELAY = exports.DIMENSIONS = exports.DEFAULT_TOP_NAVIGATION_HEIGHT = exports.DEFAULT_RIGHT_SIDEBAR_WIDTH = exports.DEFAULT_RIGHT_PANEL_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = exports.DEFAULT_LEFT_PANEL_WIDTH = exports.DEFAULT_I18N_PROPS_SKIP_LINKS = exports.DEFAULT_BANNER_HEIGHT = exports.CONTENT = exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = exports.BANNER_HEIGHT = exports.BANNER = void 0;
|
|
7
7
|
// dimension vars
|
|
8
8
|
var VAR_LEFT_PANEL_WIDTH = 'leftPanelWidth';
|
|
9
9
|
exports.VAR_LEFT_PANEL_WIDTH = VAR_LEFT_PANEL_WIDTH;
|
|
@@ -57,12 +57,16 @@ var DEFAULT_LEFT_PANEL_WIDTH = 368;
|
|
|
57
57
|
exports.DEFAULT_LEFT_PANEL_WIDTH = DEFAULT_LEFT_PANEL_WIDTH;
|
|
58
58
|
var COLLAPSED_LEFT_SIDEBAR_WIDTH = 20;
|
|
59
59
|
exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = COLLAPSED_LEFT_SIDEBAR_WIDTH;
|
|
60
|
+
var MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH = 16;
|
|
61
|
+
exports.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH = MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH;
|
|
60
62
|
var MIN_LEFT_SIDEBAR_WIDTH = 80;
|
|
61
63
|
exports.MIN_LEFT_SIDEBAR_WIDTH = MIN_LEFT_SIDEBAR_WIDTH;
|
|
62
64
|
var DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = 240;
|
|
63
65
|
exports.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH;
|
|
64
66
|
var MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = 200;
|
|
65
67
|
exports.MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = MIN_LEFT_SIDEBAR_DRAG_THRESHOLD;
|
|
68
|
+
var MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH = 350;
|
|
69
|
+
exports.MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH = MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH;
|
|
66
70
|
var TRANSITION_DURATION = 300;
|
|
67
71
|
exports.TRANSITION_DURATION = TRANSITION_DURATION;
|
|
68
72
|
var FLYOUT_DELAY = 200;
|
|
@@ -12,11 +12,13 @@ var _react = require("react");
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _bindEventListener = require("bind-event-listener");
|
|
14
14
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
15
17
|
var _constants = require("../../common/constants");
|
|
16
18
|
var _utils = require("../../common/utils");
|
|
17
19
|
var _sidebarResizeContext = require("../../controllers/sidebar-resize-context");
|
|
18
20
|
var _grabArea = _interopRequireDefault(require("./grab-area"));
|
|
19
|
-
var
|
|
21
|
+
var _resizeButton = _interopRequireDefault(require("./resize-button"));
|
|
20
22
|
var _shadow = _interopRequireDefault(require("./shadow"));
|
|
21
23
|
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; }
|
|
22
24
|
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; } /** @jsx jsx */ /* import useUpdateCssVar from '../../controllers/use-update-css-vars'; */
|
|
@@ -69,12 +71,11 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
69
71
|
onResizeStart = _ref.onResizeStart,
|
|
70
72
|
onResizeEnd = _ref.onResizeEnd;
|
|
71
73
|
var _useContext = (0, _react.useContext)(_sidebarResizeContext.SidebarResizeContext),
|
|
72
|
-
|
|
74
|
+
toggleLeftSidebar = _useContext.toggleLeftSidebar,
|
|
73
75
|
collapseLeftSidebar = _useContext.collapseLeftSidebar,
|
|
74
76
|
leftSidebarState = _useContext.leftSidebarState,
|
|
75
77
|
setLeftSidebarState = _useContext.setLeftSidebarState;
|
|
76
|
-
var isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed
|
|
77
|
-
isResizing = leftSidebarState.isResizing;
|
|
78
|
+
var isLeftSidebarCollapsed = leftSidebarState.isLeftSidebarCollapsed;
|
|
78
79
|
var sidebarWidth = (0, _react.useRef)(leftSidebarState[_constants.VAR_LEFT_SIDEBAR_WIDTH]);
|
|
79
80
|
// Distance of mouse from left sidebar onMouseDown
|
|
80
81
|
var offset = (0, _react.useRef)(0);
|
|
@@ -84,6 +85,9 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
84
85
|
isGrabAreaFocused = _useState2[0],
|
|
85
86
|
setIsGrabAreaFocused = _useState2[1];
|
|
86
87
|
var unbindEvents = (0, _react.useRef)(null);
|
|
88
|
+
var mobileMediaQuery = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
|
|
89
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- With the feature flag, this does not apply as it should be static.
|
|
90
|
+
(0, _responsive.UNSAFE_useMediaQuery)('below.md') : null;
|
|
87
91
|
|
|
88
92
|
// Used in some cases to ensure function references don't have to change
|
|
89
93
|
// TODO: more functions could use `stableSidebarState` rather than `leftSidebarState`
|
|
@@ -91,23 +95,11 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
91
95
|
(0, _react.useEffect)(function () {
|
|
92
96
|
stableSidebarState.current = leftSidebarState;
|
|
93
97
|
}, [leftSidebarState]);
|
|
94
|
-
var toggleSideBar = function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
expandLeftSidebar();
|
|
100
|
-
} else {
|
|
101
|
-
collapseLeftSidebar();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Bring focus to the resize button if the grab area is
|
|
105
|
-
// "clicked" using enter/space on keyboard.
|
|
106
|
-
if (e && e.nativeEvent.detail === 0) {
|
|
107
|
-
var _resizeButton = document.querySelector("[".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"));
|
|
108
|
-
_resizeButton && _resizeButton.focus();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
98
|
+
var toggleSideBar = (0, _react.useCallback)(function (event) {
|
|
99
|
+
// don't cascade down to the LeftSidebarOuter
|
|
100
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
101
|
+
toggleLeftSidebar();
|
|
102
|
+
}, [toggleLeftSidebar]);
|
|
111
103
|
var onMouseDown = function onMouseDown(event) {
|
|
112
104
|
if (isLeftSidebarCollapsed) {
|
|
113
105
|
return;
|
|
@@ -339,7 +331,7 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
339
331
|
css: [resizeControlStyles, (isGrabAreaFocused || isLeftSidebarCollapsed) && showResizeButtonStyles]
|
|
340
332
|
}), (0, _react2.jsx)(_shadow.default, {
|
|
341
333
|
testId: testId && "".concat(testId, "-shadow")
|
|
342
|
-
}), (0, _react2.jsx)(_grabArea.default, {
|
|
334
|
+
}), !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) && (0, _react2.jsx)(_grabArea.default, {
|
|
343
335
|
role: "separator",
|
|
344
336
|
"aria-label": resizeGrabAreaLabel,
|
|
345
337
|
"aria-valuenow": leftSidebarPercentageExpanded,
|
|
@@ -353,8 +345,8 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
353
345
|
testId: testId && "".concat(testId, "-grab-area"),
|
|
354
346
|
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
355
347
|
disabled: isLeftSidebarCollapsed
|
|
356
|
-
}), resizeButton.render(
|
|
357
|
-
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
348
|
+
}), resizeButton.render(_resizeButton.default, {
|
|
349
|
+
isLeftSidebarCollapsed: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? !leftSidebarState.isFlyoutOpen : isLeftSidebarCollapsed,
|
|
358
350
|
label: resizeButtonLabel,
|
|
359
351
|
onClick: toggleSideBar,
|
|
360
352
|
testId: testId && "".concat(testId, "-resize-button")
|
|
@@ -12,6 +12,8 @@ var _react = require("@emotion/react");
|
|
|
12
12
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-right"));
|
|
13
13
|
var _curves = require("@atlaskit/motion/curves");
|
|
14
14
|
var _durations = require("@atlaskit/motion/durations");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
15
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
16
18
|
var _constants = require("../../common/constants");
|
|
17
19
|
var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
|
|
@@ -23,10 +25,15 @@ var increaseHitAreaStyles = (0, _react.css)({
|
|
|
23
25
|
bottom: "calc(-1 * ".concat("var(--ds-space-100, 8px)", ")"),
|
|
24
26
|
left: "calc(-1 * ".concat("var(--ds-space-100, 8px)", ")")
|
|
25
27
|
});
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
30
|
+
var mobileStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.md, {
|
|
31
|
+
opacity: 1
|
|
32
|
+
})) : undefined;
|
|
26
33
|
var resizeIconButtonStyles = (0, _react.css)({
|
|
27
34
|
width: 24,
|
|
28
35
|
height: 24,
|
|
29
|
-
padding: 0,
|
|
36
|
+
padding: "var(--ds-space-0, 0px)",
|
|
30
37
|
position: 'absolute',
|
|
31
38
|
top: "var(--ds-space-400, 32px)",
|
|
32
39
|
left: 0,
|
|
@@ -79,10 +86,9 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
79
86
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
80
87
|
"aria-label": label,
|
|
81
88
|
type: "button",
|
|
82
|
-
css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
89
|
+
css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
83
90
|
"data-testid": testId
|
|
84
|
-
// Prevents focus staying attached to the button
|
|
85
|
-
// when pressed
|
|
91
|
+
// Prevents focus staying attached to the button when pressed
|
|
86
92
|
,
|
|
87
93
|
onMouseDown: preventDefault
|
|
88
94
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -14,7 +14,7 @@ var _constants = require("../../common/constants");
|
|
|
14
14
|
var _controllers = require("../../controllers");
|
|
15
15
|
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; }
|
|
16
16
|
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; } /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */ /** @jsx jsx */
|
|
17
|
-
// eslint-disable-next-line @
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
18
18
|
var prefersReducedMotionStyles = (0, _react.css)((0, _motion.prefersReducedMotion)());
|
|
19
19
|
var skipLinkStyles = (0, _react.css)({
|
|
20
20
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _react = require("@emotion/react");
|
|
8
10
|
var _motion = require("@atlaskit/motion");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
9
13
|
var _constants = require("../../../common/constants");
|
|
10
14
|
var _hooks = require("../../../common/hooks");
|
|
11
15
|
/** @jsx jsx */
|
|
12
16
|
|
|
13
|
-
// eslint-disable-next-line @
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
14
18
|
var prefersReducedMotionStyles = (0, _react.css)((0, _motion.prefersReducedMotion)());
|
|
15
19
|
|
|
20
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
21
|
+
var mobileStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.md, {
|
|
22
|
+
width: "".concat(_constants.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, "px"),
|
|
23
|
+
position: 'fixed',
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
25
|
+
top: "calc(".concat(_constants.BANNER_HEIGHT, " + ").concat(_constants.TOP_NAVIGATION_HEIGHT, ")"),
|
|
26
|
+
bottom: 0,
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
28
|
+
left: "".concat(_constants.LEFT_PANEL_WIDTH),
|
|
29
|
+
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s")
|
|
30
|
+
})) : undefined;
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
33
|
+
var mobileInnerFlyoutStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.md, {
|
|
34
|
+
width: "min(90vw, ".concat(_constants.MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH, "px)"),
|
|
35
|
+
maxWidth: _constants.MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH,
|
|
36
|
+
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s, box-shadow ").concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s")
|
|
37
|
+
})) : undefined;
|
|
38
|
+
|
|
16
39
|
/**
|
|
17
40
|
* This inner wrapper is required to allow the sidebar to be `position: fixed`.
|
|
18
41
|
*
|
|
@@ -54,7 +77,11 @@ var LeftSidebarInner = function LeftSidebarInner(_ref) {
|
|
|
54
77
|
isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen;
|
|
55
78
|
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
56
79
|
return (0, _react.jsx)("div", {
|
|
57
|
-
css: [
|
|
80
|
+
css: [
|
|
81
|
+
// mobile breakpoint styles
|
|
82
|
+
mobileStyles, isFlyoutOpen && mobileInnerFlyoutStyles,
|
|
83
|
+
// generic styles
|
|
84
|
+
!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
58
85
|
}, children);
|
|
59
86
|
};
|
|
60
87
|
|
|
@@ -6,20 +6,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _react = require("react");
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
11
12
|
var _motion = require("@atlaskit/motion");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
12
15
|
var _constants = require("../../../common/constants");
|
|
13
16
|
var _hooks = require("../../../common/hooks");
|
|
14
17
|
var _utils = require("../../../common/utils");
|
|
18
|
+
var _controllers = require("../../../controllers");
|
|
15
19
|
var _slotFocusRing = _interopRequireDefault(require("./slot-focus-ring"));
|
|
16
20
|
/** @jsx jsx */
|
|
17
21
|
|
|
18
|
-
// eslint-disable-next-line @
|
|
22
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
19
23
|
var prefersReducedMotionStyles = (0, _react2.css)((0, _motion.prefersReducedMotion)());
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
26
|
+
var mobileStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react2.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.md, {
|
|
27
|
+
width: _constants.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH,
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
opacity: 1,
|
|
30
|
+
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s"),
|
|
31
|
+
'&::after': {
|
|
32
|
+
display: 'inline-block',
|
|
33
|
+
maxWidth: _constants.MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH,
|
|
34
|
+
content: "''"
|
|
35
|
+
}
|
|
36
|
+
})) : undefined;
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
39
|
+
var mobileFlyoutStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react2.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.md, {
|
|
40
|
+
cursor: 'revert'
|
|
41
|
+
})) : undefined;
|
|
20
42
|
var outerStyles = (0, _react2.css)({
|
|
21
43
|
width: _constants.LEFT_SIDEBAR_WIDTH,
|
|
22
|
-
marginLeft: 0,
|
|
44
|
+
marginLeft: "var(--ds-space-0, 0px)",
|
|
23
45
|
position: 'relative',
|
|
24
46
|
zIndex: 1,
|
|
25
47
|
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s"),
|
|
@@ -56,30 +78,41 @@ var LeftSidebarOuter = function LeftSidebarOuter(_ref, ref) {
|
|
|
56
78
|
var children = _ref.children,
|
|
57
79
|
_ref$isFixed = _ref.isFixed,
|
|
58
80
|
isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
|
|
59
|
-
_ref$isFlyoutOpen = _ref.isFlyoutOpen,
|
|
60
|
-
isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen,
|
|
61
81
|
testId = _ref.testId,
|
|
62
82
|
onMouseLeave = _ref.onMouseLeave,
|
|
63
83
|
onMouseOver = _ref.onMouseOver,
|
|
84
|
+
onClick = _ref.onClick,
|
|
64
85
|
id = _ref.id;
|
|
65
86
|
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
87
|
+
var _useContext = (0, _react.useContext)(_controllers.SidebarResizeContext),
|
|
88
|
+
isFlyoutOpen = _useContext.leftSidebarState.isFlyoutOpen;
|
|
66
89
|
return (0, _react2.jsx)(_slotFocusRing.default, {
|
|
67
90
|
isSidebar: true
|
|
68
91
|
}, function (_ref2) {
|
|
69
92
|
var className = _ref2.className;
|
|
70
93
|
return (
|
|
71
94
|
/**
|
|
72
|
-
*
|
|
95
|
+
* On desktop, the `onMouseOver|onMouseLeave` handlers controls the temporary flyout behavior.
|
|
96
|
+
* This is an intentionally mouse-only experience, it may even be disruptive with keyboard navigation.
|
|
97
|
+
*
|
|
98
|
+
* On mobile, the `onClick` handler controls the toggled flyout behaviour.
|
|
99
|
+
* This is not intended to be how you use this with a keyboard, there is a ResizeButton for this intentionally instead.
|
|
73
100
|
*/
|
|
74
101
|
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
75
102
|
(0, _react2.jsx)("div", (0, _extends2.default)({
|
|
76
|
-
css: [
|
|
103
|
+
css: [
|
|
104
|
+
// mobile breakpoint styles
|
|
105
|
+
mobileStyles, isFlyoutOpen && mobileFlyoutStyles,
|
|
106
|
+
// generic styles
|
|
107
|
+
outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
|
|
77
108
|
className: className,
|
|
78
109
|
"data-testid": testId,
|
|
79
110
|
id: id,
|
|
80
111
|
onMouseOver: onMouseOver,
|
|
81
112
|
onMouseLeave: onMouseLeave,
|
|
82
|
-
|
|
113
|
+
onClick: onClick,
|
|
114
|
+
ref: ref,
|
|
115
|
+
"aria-hidden": "true"
|
|
83
116
|
}, selector), children)
|
|
84
117
|
);
|
|
85
118
|
});
|
|
@@ -10,7 +10,7 @@ var _constants = require("../../../common/constants");
|
|
|
10
10
|
var _hooks = require("../../../common/hooks");
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line @
|
|
13
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
14
14
|
var prefersReducedMotionStyles = (0, _react.css)((0, _motion.prefersReducedMotion)());
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -8,6 +8,11 @@ exports.default = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
|
+
var _useCloseOnEscapePress = _interopRequireDefault(require("@atlaskit/ds-lib/use-close-on-escape-press"));
|
|
12
|
+
var _motion = require("@atlaskit/motion");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _responsive = require("@atlaskit/primitives/responsive");
|
|
15
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
16
|
var _constants = require("../../common/constants");
|
|
12
17
|
var _utils = require("../../common/utils");
|
|
13
18
|
var _controllers = require("../../controllers");
|
|
@@ -18,11 +23,32 @@ var _resizableChildrenWrapper = _interopRequireDefault(require("./internal/resiz
|
|
|
18
23
|
var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
|
|
19
24
|
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; }
|
|
20
25
|
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; } /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */ /** @jsx jsx */
|
|
26
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
27
|
+
var openBackdropStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react2.css)({
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%',
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
background: "var(--ds-blanket, ".concat(_colors.N100A, ")"),
|
|
32
|
+
opacity: 1
|
|
33
|
+
}) : undefined;
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
36
|
+
var hiddenBackdropStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ? (0, _react2.css)({
|
|
37
|
+
opacity: 0,
|
|
38
|
+
transition: "opacity ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s")
|
|
39
|
+
}) : undefined;
|
|
40
|
+
|
|
21
41
|
/**
|
|
22
42
|
* __Left sidebar__
|
|
23
43
|
*
|
|
24
44
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
25
45
|
*
|
|
46
|
+
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
47
|
+
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
48
|
+
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
49
|
+
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
50
|
+
* resizing between mobile and desktop.
|
|
51
|
+
*
|
|
26
52
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
27
53
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
28
54
|
*/
|
|
@@ -78,9 +104,11 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
78
104
|
}
|
|
79
105
|
if (!isLocked && handlerRef.current) {
|
|
80
106
|
if (mouseXRef.current >= lastLeftSidebarWidth) {
|
|
81
|
-
setLeftSidebarState(
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
setLeftSidebarState(function (current) {
|
|
108
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
109
|
+
isFlyoutOpen: false
|
|
110
|
+
});
|
|
111
|
+
});
|
|
84
112
|
}
|
|
85
113
|
document.removeEventListener('mousemove', handlerRef.current);
|
|
86
114
|
handlerRef.current = null;
|
|
@@ -90,7 +118,7 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
90
118
|
document.removeEventListener('mousemove', handlerRef.current);
|
|
91
119
|
}
|
|
92
120
|
};
|
|
93
|
-
}, [isLocked, lastLeftSidebarWidth,
|
|
121
|
+
}, [isLocked, lastLeftSidebarWidth, setLeftSidebarState]);
|
|
94
122
|
var _width = Math.max(width || 0, _constants.DEFAULT_LEFT_SIDEBAR_WIDTH);
|
|
95
123
|
var collapsedStateOverrideOpen = collapsedState === 'expanded';
|
|
96
124
|
var leftSidebarWidthOnMount;
|
|
@@ -199,41 +227,111 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
199
227
|
});
|
|
200
228
|
}, _constants.FLYOUT_DELAY);
|
|
201
229
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})
|
|
236
|
-
);
|
|
230
|
+
var mobileMediaQuery = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
|
|
231
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
|
|
232
|
+
(0, _responsive.UNSAFE_useMediaQuery)('below.md') : null;
|
|
233
|
+
var openMobileFlyout = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
|
|
234
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
|
|
235
|
+
(0, _react.useCallback)(function () {
|
|
236
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
setLeftSidebarState(function (current) {
|
|
240
|
+
if (current.isFlyoutOpen) {
|
|
241
|
+
return current;
|
|
242
|
+
}
|
|
243
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand();
|
|
244
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
245
|
+
isFlyoutOpen: true
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
}, [setLeftSidebarState, onExpand, mobileMediaQuery]) : undefined;
|
|
249
|
+
var closeMobileFlyout = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') ?
|
|
250
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
|
|
251
|
+
(0, _react.useCallback)(function () {
|
|
252
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
setLeftSidebarState(function (current) {
|
|
256
|
+
if (!current.isFlyoutOpen) {
|
|
257
|
+
return current;
|
|
258
|
+
}
|
|
259
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse();
|
|
260
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
261
|
+
isFlyoutOpen: false
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}, [setLeftSidebarState, onCollapse, mobileMediaQuery]) : undefined;
|
|
265
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g')) {
|
|
266
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
|
|
267
|
+
(0, _responsive.UNSAFE_useMediaQuery)('below.md', function (event) {
|
|
268
|
+
setLeftSidebarState(function (current) {
|
|
269
|
+
if (event.matches && !current.isLeftSidebarCollapsed) {
|
|
270
|
+
// Sidebar was previously open when resizing downwards, convert the sidebar being open to a flyout being open
|
|
271
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
272
|
+
isResizing: false,
|
|
273
|
+
isLeftSidebarCollapsed: true,
|
|
274
|
+
leftSidebarWidth: _constants.COLLAPSED_LEFT_SIDEBAR_WIDTH,
|
|
275
|
+
lastLeftSidebarWidth: current.leftSidebarWidth,
|
|
276
|
+
isFlyoutOpen: true
|
|
277
|
+
});
|
|
278
|
+
} else if (!event.matches && current.isFlyoutOpen) {
|
|
279
|
+
// The user is resizing "upwards", eg. going from mobile to desktop.
|
|
280
|
+
// Flyout was previously open, let's keep it open by moving to the un-collapsed sidebar instead
|
|
281
|
+
|
|
282
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
283
|
+
isResizing: false,
|
|
284
|
+
isLeftSidebarCollapsed: false,
|
|
285
|
+
leftSidebarWidth: Math.max(current.lastLeftSidebarWidth, _constants.DEFAULT_LEFT_SIDEBAR_WIDTH),
|
|
286
|
+
isFlyoutOpen: false
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
return current;
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// Close the flyout when the "escape" key is pressed.
|
|
294
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Does not apply to being feature flagged.
|
|
295
|
+
(0, _useCloseOnEscapePress.default)({
|
|
296
|
+
onClose: closeMobileFlyout,
|
|
297
|
+
isDisabled: !isFlyoutOpen
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return (0, _react2.jsx)(_react.Fragment, null, (mobileMediaQuery === null || mobileMediaQuery === void 0 ? void 0 : mobileMediaQuery.matches) && (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && (0, _react2.jsx)("div", {
|
|
301
|
+
"aria-hidden": "true",
|
|
302
|
+
css: [hiddenBackdropStyles, isFlyoutOpen && openBackdropStyles],
|
|
303
|
+
onClick: closeMobileFlyout
|
|
304
|
+
}), (0, _react2.jsx)(_leftSidebarOuter.default, {
|
|
305
|
+
ref: leftSideBarRef,
|
|
306
|
+
testId: testId,
|
|
307
|
+
onMouseOver: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseOver : undefined,
|
|
308
|
+
onMouseLeave: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseLeave : undefined,
|
|
309
|
+
onClick: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? openMobileFlyout : undefined,
|
|
310
|
+
id: id,
|
|
311
|
+
isFixed: isFixed
|
|
312
|
+
}, (0, _react2.jsx)(_slotDimensions.default, {
|
|
313
|
+
variableName: _constants.VAR_LEFT_SIDEBAR_WIDTH,
|
|
314
|
+
value: notFirstRun.current ? leftSidebarWidth : leftSidebarWidthOnMount,
|
|
315
|
+
mobileValue: _constants.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH
|
|
316
|
+
}), (0, _react2.jsx)(_leftSidebarInner.default, {
|
|
317
|
+
isFixed: isFixed,
|
|
318
|
+
isFlyoutOpen: isFlyoutOpen
|
|
319
|
+
}, (0, _react2.jsx)(_resizableChildrenWrapper.default, {
|
|
320
|
+
isFlyoutOpen: isFlyoutOpen,
|
|
321
|
+
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
322
|
+
hasCollapsedState: !notFirstRun.current && collapsedState === 'collapsed'
|
|
323
|
+
}, children), (0, _react2.jsx)(_resizeControl.default, {
|
|
324
|
+
testId: testId,
|
|
325
|
+
resizeGrabAreaLabel: resizeGrabAreaLabel,
|
|
326
|
+
resizeButtonLabel: resizeButtonLabel
|
|
327
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
328
|
+
,
|
|
329
|
+
overrides: overrides,
|
|
330
|
+
onCollapse: onCollapse,
|
|
331
|
+
onExpand: onExpand,
|
|
332
|
+
onResizeStart: onResizeStart,
|
|
333
|
+
onResizeEnd: onResizeEnd
|
|
334
|
+
}))));
|
|
237
335
|
};
|
|
238
336
|
var _default = LeftSidebar;
|
|
239
337
|
exports.default = _default;
|
|
@@ -17,7 +17,7 @@ var _controllers = require("../../controllers");
|
|
|
17
17
|
var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
|
|
18
18
|
/** @jsx jsx */
|
|
19
19
|
|
|
20
|
-
// eslint-disable-next-line @
|
|
20
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
21
21
|
var prefersReducedMotionStyles = (0, _react2.css)((0, _accessibility.prefersReducedMotion)());
|
|
22
22
|
var mainStyles = (0, _react2.css)({
|
|
23
23
|
minWidth: 0,
|