@atlaskit/page-layout 2.1.4 → 3.1.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 +18 -0
- package/dist/cjs/components/resize-control/index.js +3 -7
- package/dist/cjs/components/resize-control/resize-button.js +1 -2
- package/dist/cjs/components/skip-links/types.js +1 -5
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +2 -5
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +2 -3
- package/dist/cjs/components/slots/left-sidebar.js +7 -20
- package/dist/cjs/components/slots/page-layout.js +1 -2
- package/dist/cjs/components/slots/slot-dimensions.js +1 -2
- package/dist/cjs/controllers/index.js +6 -0
- package/dist/cjs/controllers/sidebar-resize-context.js +12 -1
- package/dist/cjs/controllers/sidebar-resize-controller.js +5 -6
- package/dist/cjs/controllers/skip-link-controller.js +2 -2
- package/dist/cjs/controllers/types.js +1 -5
- package/dist/cjs/index.js +6 -0
- package/dist/es2019/components/resize-control/index.js +3 -7
- package/dist/es2019/components/resize-control/resize-button.js +1 -2
- package/dist/es2019/components/skip-links/types.js +0 -1
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +2 -5
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +2 -3
- package/dist/es2019/components/slots/left-sidebar.js +7 -20
- package/dist/es2019/components/slots/page-layout.js +1 -2
- package/dist/es2019/components/slots/slot-dimensions.js +1 -2
- package/dist/es2019/controllers/index.js +1 -1
- package/dist/es2019/controllers/sidebar-resize-context.js +12 -0
- package/dist/es2019/controllers/sidebar-resize-controller.js +3 -4
- package/dist/es2019/controllers/types.js +0 -1
- package/dist/es2019/index.js +1 -1
- package/dist/esm/components/resize-control/index.js +3 -7
- package/dist/esm/components/resize-control/resize-button.js +1 -2
- package/dist/esm/components/skip-links/types.js +0 -1
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +2 -5
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +2 -3
- package/dist/esm/components/slots/left-sidebar.js +7 -20
- package/dist/esm/components/slots/page-layout.js +1 -2
- package/dist/esm/components/slots/slot-dimensions.js +1 -2
- package/dist/esm/controllers/index.js +1 -1
- package/dist/esm/controllers/sidebar-resize-context.js +11 -0
- package/dist/esm/controllers/sidebar-resize-controller.js +3 -4
- package/dist/esm/controllers/types.js +0 -1
- package/dist/esm/index.js +1 -1
- package/dist/types/components/slots/left-sidebar.d.ts +0 -1
- package/dist/types/controllers/index.d.ts +1 -1
- package/dist/types/controllers/sidebar-resize-context.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/slots/left-sidebar.d.ts +0 -1
- package/dist/types-ts4.5/controllers/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/sidebar-resize-context.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/page-layout
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#81736](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81736) [`5ce631eec537`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ce631eec537) - Added `UNSAFE_useSetLeftSidebarState` to support an internal redesign. `UNSAFE_useSetLeftSidebarState` returns noop and will be removed in the next major release.
|
|
8
|
+
|
|
9
|
+
## 3.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#80897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80897) [`8ce3bb563079`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ce3bb563079) - [ux] If you view a product in a small window or at higher zoom levels, the sidebar now changes sizes to keep all controls in view. In these smaller windows, the sidebar no longer opens on hover to avoid accidental opening.
|
|
14
|
+
|
|
15
|
+
The sidebar is unchanged in views wider than 768 pixels.
|
|
16
|
+
|
|
17
|
+
When viewing a product in a window narrower than 768px or zoomed in at 200%, you'll notice that hovering your cursor over the sidebar no longer expands the sidebar.
|
|
18
|
+
|
|
19
|
+
To open the sidebar, select the expand sidebar button ( > icon). Select the button again to collapse the sidebar. You can also select the edge of the sidebar itself to expand and collapse it.
|
|
20
|
+
|
|
3
21
|
## 2.1.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -12,7 +12,6 @@ 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
15
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
17
16
|
var _constants = require("../../common/constants");
|
|
18
17
|
var _utils = require("../../common/utils");
|
|
@@ -59,7 +58,6 @@ var globalResizingStyles = (0, _react2.css)({
|
|
|
59
58
|
// However, to minimize risk we are just disabling `pointer-events` on iframes
|
|
60
59
|
// as that change is actually needed to fix resizing with iframes
|
|
61
60
|
});
|
|
62
|
-
|
|
63
61
|
var ResizeControl = function ResizeControl(_ref) {
|
|
64
62
|
var testId = _ref.testId,
|
|
65
63
|
overrides = _ref.overrides,
|
|
@@ -332,10 +330,8 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
332
330
|
}), (0, _react2.jsx)(_shadow.default, {
|
|
333
331
|
testId: testId && "".concat(testId, "-shadow")
|
|
334
332
|
}),
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
// With the feature flag, only show the GrabArea if we're not on the mobile viewport
|
|
338
|
-
(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) && (0, _react2.jsx)(_grabArea.default, {
|
|
333
|
+
// Only show the GrabArea if we're not on the mobile viewport
|
|
334
|
+
!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) && (0, _react2.jsx)(_grabArea.default, {
|
|
339
335
|
isDisabled: isLeftSidebarCollapsed,
|
|
340
336
|
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
341
337
|
label: resizeGrabAreaLabel,
|
|
@@ -347,7 +343,7 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
347
343
|
onMouseDown: onMouseDown,
|
|
348
344
|
testId: testId && "".concat(testId, "-grab-area")
|
|
349
345
|
}), resizeButton.render(_resizeButton.default, {
|
|
350
|
-
isLeftSidebarCollapsed:
|
|
346
|
+
isLeftSidebarCollapsed: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? !leftSidebarState.isFlyoutOpen : isLeftSidebarCollapsed,
|
|
351
347
|
label: resizeButtonLabel,
|
|
352
348
|
onClick: toggleSideBar,
|
|
353
349
|
testId: testId && "".concat(testId, "-resize-button")
|
|
@@ -12,7 +12,6 @@ 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
15
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
17
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
18
17
|
var _constants = require("../../common/constants");
|
|
@@ -79,7 +78,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
79
78
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
80
79
|
"aria-label": label,
|
|
81
80
|
type: "button",
|
|
82
|
-
css: [resizeIconButtonStyles,
|
|
81
|
+
css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
83
82
|
"data-testid": testId
|
|
84
83
|
// Prevents focus staying attached to the button when pressed
|
|
85
84
|
,
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _motion = require("@atlaskit/motion");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
13
12
|
var _constants = require("../../../common/constants");
|
|
14
13
|
var _hooks = require("../../../common/hooks");
|
|
@@ -16,8 +15,6 @@ var _hooks = require("../../../common/hooks");
|
|
|
16
15
|
|
|
17
16
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
18
17
|
var prefersReducedMotionStyles = (0, _react.css)((0, _motion.prefersReducedMotion)());
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
21
18
|
var mobileStyles = (0, _react.css)((0, _defineProperty2.default)({}, _responsive.UNSAFE_media.below.sm, {
|
|
22
19
|
width: "".concat(_constants.MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, "px"),
|
|
23
20
|
position: 'fixed',
|
|
@@ -72,8 +69,8 @@ var LeftSidebarInner = function LeftSidebarInner(_ref) {
|
|
|
72
69
|
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
73
70
|
return (0, _react.jsx)("div", {
|
|
74
71
|
css: [
|
|
75
|
-
//
|
|
76
|
-
|
|
72
|
+
// mobile viewport styles
|
|
73
|
+
mobileStyles, isFlyoutOpen && mobileInnerFlyoutStyles,
|
|
77
74
|
// generic styles
|
|
78
75
|
!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
79
76
|
}, children);
|
|
@@ -10,7 +10,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _motion = require("@atlaskit/motion");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
15
14
|
var _constants = require("../../../common/constants");
|
|
16
15
|
var _hooks = require("../../../common/hooks");
|
|
@@ -97,8 +96,8 @@ var LeftSidebarOuter = function LeftSidebarOuter(_ref, ref) {
|
|
|
97
96
|
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
98
97
|
(0, _react2.jsx)("div", (0, _extends2.default)({
|
|
99
98
|
css: [
|
|
100
|
-
//
|
|
101
|
-
|
|
99
|
+
// mobile viewport styles
|
|
100
|
+
mobileStyles, isFlyoutOpen && mobileFlyoutStyles,
|
|
102
101
|
// generic styles
|
|
103
102
|
outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
|
|
104
103
|
className: className,
|
|
@@ -10,7 +10,6 @@ var _react = require("react");
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _useCloseOnEscapePress = _interopRequireDefault(require("@atlaskit/ds-lib/use-close-on-escape-press"));
|
|
12
12
|
var _motion = require("@atlaskit/motion");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
15
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
16
15
|
var _constants = require("../../common/constants");
|
|
@@ -40,7 +39,6 @@ var hiddenBackdropStyles = (0, _react2.css)({
|
|
|
40
39
|
*
|
|
41
40
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
42
41
|
*
|
|
43
|
-
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
44
42
|
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
45
43
|
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
46
44
|
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
@@ -224,11 +222,8 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
224
222
|
}, _constants.FLYOUT_DELAY);
|
|
225
223
|
};
|
|
226
224
|
var mobileMediaQuery = (0, _responsive.UNSAFE_useMediaQuery)('below.sm');
|
|
227
|
-
|
|
228
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
229
225
|
var openMobileFlyout = (0, _react.useCallback)(function () {
|
|
230
|
-
if (!(
|
|
231
|
-
// Only do this for our feature flag and for mobile viewports
|
|
226
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
232
227
|
return;
|
|
233
228
|
}
|
|
234
229
|
setLeftSidebarState(function (current) {
|
|
@@ -240,10 +235,8 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
240
235
|
});
|
|
241
236
|
});
|
|
242
237
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
243
|
-
|
|
244
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
245
238
|
var closeMobileFlyout = (0, _react.useCallback)(function () {
|
|
246
|
-
if (!(
|
|
239
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
247
240
|
return;
|
|
248
241
|
}
|
|
249
242
|
setLeftSidebarState(function (current) {
|
|
@@ -255,12 +248,7 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
255
248
|
});
|
|
256
249
|
});
|
|
257
250
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
258
|
-
|
|
259
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
260
251
|
(0, _responsive.UNSAFE_useMediaQuery)('below.sm', function (event) {
|
|
261
|
-
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g')) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
252
|
setLeftSidebarState(function (current) {
|
|
265
253
|
if (event.matches && !current.isLeftSidebarCollapsed) {
|
|
266
254
|
// Sidebar was previously open when resizing downwards, convert the sidebar being open to a flyout being open
|
|
@@ -287,12 +275,11 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
287
275
|
});
|
|
288
276
|
|
|
289
277
|
// Close the flyout when the "escape" key is pressed.
|
|
290
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone as `closeMobileFlyout` only does something with the feature flag.
|
|
291
278
|
(0, _useCloseOnEscapePress.default)({
|
|
292
279
|
onClose: closeMobileFlyout,
|
|
293
|
-
isDisabled: !
|
|
280
|
+
isDisabled: !isFlyoutOpen
|
|
294
281
|
});
|
|
295
|
-
return (0, _react2.jsx)(_react.Fragment, null, (
|
|
282
|
+
return (0, _react2.jsx)(_react.Fragment, null, (mobileMediaQuery === null || mobileMediaQuery === void 0 ? void 0 : mobileMediaQuery.matches) &&
|
|
296
283
|
/**
|
|
297
284
|
* On desktop, the `onClick` handlers controls the temporary flyout behavior.
|
|
298
285
|
* This is an intentionally mouse-only experience, it may even be disruptive with keyboard navigation.
|
|
@@ -307,9 +294,9 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
307
294
|
}), (0, _react2.jsx)(_leftSidebarOuter.default, {
|
|
308
295
|
ref: leftSideBarRef,
|
|
309
296
|
testId: testId,
|
|
310
|
-
onMouseOver: !(
|
|
311
|
-
onMouseLeave: !(
|
|
312
|
-
onClick:
|
|
297
|
+
onMouseOver: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseOver : undefined,
|
|
298
|
+
onMouseLeave: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseLeave : undefined,
|
|
299
|
+
onClick: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? openMobileFlyout : undefined,
|
|
313
300
|
id: id,
|
|
314
301
|
isFixed: isFixed
|
|
315
302
|
}, (0, _react2.jsx)(_slotDimensions.default, {
|
|
@@ -9,7 +9,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
14
13
|
var _constants = require("../../common/constants");
|
|
15
14
|
var _controllers = require("../../controllers");
|
|
@@ -51,7 +50,7 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
51
50
|
skipLinksLabel: skipLinksLabel
|
|
52
51
|
}), (0, _react2.jsx)("div", (0, _extends2.default)({}, pageLayoutSelector, {
|
|
53
52
|
"data-testid": testId,
|
|
54
|
-
css: [gridStyles,
|
|
53
|
+
css: [gridStyles, gridStylesMobileStyles],
|
|
55
54
|
tabIndex: -1
|
|
56
55
|
}), (0, _react2.jsx)(_controllers.SidebarResizeController, {
|
|
57
56
|
onLeftSidebarCollapse: onLeftSidebarCollapse,
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
11
10
|
var _default = exports.default = function _default(_ref) {
|
|
12
11
|
var variableName = _ref.variableName,
|
|
13
12
|
value = _ref.value,
|
|
14
13
|
mobileValue = _ref.mobileValue;
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"),
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"), mobileValue && "".concat(_responsive.UNSAFE_media.below.sm, " { :root{--").concat(variableName, ":").concat(mobileValue, "px;} }"));
|
|
16
15
|
};
|
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "SkipLinksController", {
|
|
|
22
22
|
return _skipLinkController.SkipLinksController;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "UNSAFE_useSetLeftSidebarState", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _sidebarResizeContext.UNSAFE_useSetLeftSidebarState;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(exports, "publishGridState", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
get: function get() {
|
|
@@ -4,11 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.usePageLayoutResize = exports.useLeftSidebarFlyoutLock = exports.SidebarResizeContext = void 0;
|
|
7
|
+
exports.usePageLayoutResize = exports.useLeftSidebarFlyoutLock = exports.UNSAFE_useSetLeftSidebarState = exports.SidebarResizeContext = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _excluded = ["setLeftSidebarState"];
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -21,6 +22,7 @@ var leftSidebarState = {
|
|
|
21
22
|
flyoutLockCount: 0,
|
|
22
23
|
isFixed: true
|
|
23
24
|
};
|
|
25
|
+
|
|
24
26
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
27
|
var SidebarResizeContext = exports.SidebarResizeContext = /*#__PURE__*/(0, _react.createContext)({
|
|
26
28
|
isLeftSidebarCollapsed: false,
|
|
@@ -71,4 +73,13 @@ var useLeftSidebarFlyoutLock = exports.useLeftSidebarFlyoutLock = function useLe
|
|
|
71
73
|
});
|
|
72
74
|
};
|
|
73
75
|
}, [setLeftSidebarState]);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Returns noop. Added to support an internal redesign, `UNSAFE_useSetLeftSidebarState` will be removed in the next major release.
|
|
80
|
+
*/
|
|
81
|
+
var UNSAFE_useSetLeftSidebarState = exports.UNSAFE_useSetLeftSidebarState = function UNSAFE_useSetLeftSidebarState() {
|
|
82
|
+
var _useContext3 = (0, _react.useContext)(SidebarResizeContext),
|
|
83
|
+
setLeftSidebarState = _useContext3.setLeftSidebarState;
|
|
84
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.atlassian.griffin-navigation-redesign') ? setLeftSidebarState : _noop.default;
|
|
74
85
|
};
|
|
@@ -11,13 +11,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
12
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
13
13
|
var _motion = require("@atlaskit/motion");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
16
15
|
var _constants = require("../common/constants");
|
|
17
16
|
var _utils = require("../common/utils");
|
|
18
17
|
var _sidebarResizeContext = require("./sidebar-resize-context");
|
|
19
|
-
function _getRequireWildcardCache(
|
|
20
|
-
function _interopRequireWildcard(
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
20
|
var handleDataAttributesAndCb = function handleDataAttributesAndCb() {
|
|
22
21
|
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _noop.default;
|
|
23
22
|
var leftSidebarState = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -64,7 +63,7 @@ var SidebarResizeController = exports.SidebarResizeController = function Sidebar
|
|
|
64
63
|
}, [onExpand, onCollapse]);
|
|
65
64
|
var transition = (0, _react.useRef)(null);
|
|
66
65
|
var mobileMediaQuery = (0, _responsive.UNSAFE_useMediaQuery)('below.sm');
|
|
67
|
-
var isOpen =
|
|
66
|
+
var isOpen = mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? isFlyoutOpen : !isLeftSidebarCollapsed;
|
|
68
67
|
var expandLeftSidebar = (0, _react.useCallback)(function () {
|
|
69
68
|
var _transition$current2, _transition$current3;
|
|
70
69
|
if (isOpen) {
|
|
@@ -73,7 +72,7 @@ var SidebarResizeController = exports.SidebarResizeController = function Sidebar
|
|
|
73
72
|
|
|
74
73
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
75
74
|
// We don't expand at mobile widths; instead we use a flyout which is treated the same otherwise
|
|
76
|
-
if (
|
|
75
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
77
76
|
var _transition$current;
|
|
78
77
|
var flyoutOpenSidebarState = {
|
|
79
78
|
isResizing: false,
|
|
@@ -149,7 +148,7 @@ var SidebarResizeController = exports.SidebarResizeController = function Sidebar
|
|
|
149
148
|
|
|
150
149
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
151
150
|
// We don't collapse at mobile widths; instead we close the flyout.
|
|
152
|
-
if (
|
|
151
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
153
152
|
var _transition$current5;
|
|
154
153
|
var flyoutCloseSidebarState = {
|
|
155
154
|
isResizing: false,
|
|
@@ -11,8 +11,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _constants = require("../common/constants");
|
|
13
13
|
var _skipLinkContext = require("./skip-link-context");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
var byDOMOrder = function byDOMOrder(a, b) {
|
|
17
17
|
var _a$listIndex, _b$listIndex;
|
|
18
18
|
var elems = Array.from(document.querySelectorAll("[".concat(_constants.PAGE_LAYOUT_SLOT_SELECTOR, "]")));
|
package/dist/cjs/index.js
CHANGED
|
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "TopNavigation", {
|
|
|
99
99
|
return _components.TopNavigation;
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "UNSAFE_useSetLeftSidebarState", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _controllers.UNSAFE_useSetLeftSidebarState;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
102
108
|
Object.defineProperty(exports, "useCustomSkipLink", {
|
|
103
109
|
enumerable: true,
|
|
104
110
|
get: function get() {
|
|
@@ -4,7 +4,6 @@ import { Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState
|
|
|
4
4
|
import { css, Global, jsx } from '@emotion/react';
|
|
5
5
|
import { bindAll } from 'bind-event-listener';
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
9
8
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
10
9
|
import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
|
|
@@ -53,7 +52,6 @@ const globalResizingStyles = css({
|
|
|
53
52
|
// However, to minimize risk we are just disabling `pointer-events` on iframes
|
|
54
53
|
// as that change is actually needed to fix resizing with iframes
|
|
55
54
|
});
|
|
56
|
-
|
|
57
55
|
const ResizeControl = ({
|
|
58
56
|
testId,
|
|
59
57
|
overrides,
|
|
@@ -332,10 +330,8 @@ const ResizeControl = ({
|
|
|
332
330
|
}), jsx(Shadow, {
|
|
333
331
|
testId: testId && `${testId}-shadow`
|
|
334
332
|
}),
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
// With the feature flag, only show the GrabArea if we're not on the mobile viewport
|
|
338
|
-
getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) && jsx(GrabArea, {
|
|
333
|
+
// Only show the GrabArea if we're not on the mobile viewport
|
|
334
|
+
!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) && jsx(GrabArea, {
|
|
339
335
|
isDisabled: isLeftSidebarCollapsed,
|
|
340
336
|
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
341
337
|
label: resizeGrabAreaLabel,
|
|
@@ -347,7 +343,7 @@ const ResizeControl = ({
|
|
|
347
343
|
onMouseDown: onMouseDown,
|
|
348
344
|
testId: testId && `${testId}-grab-area`
|
|
349
345
|
}), resizeButton.render(ResizeButton, {
|
|
350
|
-
isLeftSidebarCollapsed:
|
|
346
|
+
isLeftSidebarCollapsed: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? !leftSidebarState.isFlyoutOpen : isLeftSidebarCollapsed,
|
|
351
347
|
label: resizeButtonLabel,
|
|
352
348
|
onClick: toggleSideBar,
|
|
353
349
|
testId: testId && `${testId}-resize-button`
|
|
@@ -5,7 +5,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import ChevronRight from '@atlaskit/icon/glyph/chevron-right';
|
|
6
6
|
import { easeOut } from '@atlaskit/motion/curves';
|
|
7
7
|
import { mediumDurationMs, smallDurationMs } from '@atlaskit/motion/durations';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
10
9
|
import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
|
|
11
10
|
import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
|
|
@@ -77,7 +76,7 @@ const ResizeButton = ({
|
|
|
77
76
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
78
77
|
"aria-label": label,
|
|
79
78
|
type: "button",
|
|
80
|
-
css: [resizeIconButtonStyles,
|
|
79
|
+
css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
81
80
|
"data-testid": testId
|
|
82
81
|
// Prevents focus staying attached to the button when pressed
|
|
83
82
|
,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
7
6
|
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';
|
|
8
7
|
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
9
8
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
10
9
|
const prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
13
10
|
const mobileStyles = css({
|
|
14
11
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
15
12
|
[UNSAFE_media.below.sm]: {
|
|
@@ -69,8 +66,8 @@ const LeftSidebarInner = ({
|
|
|
69
66
|
const isDragging = useIsSidebarDragging();
|
|
70
67
|
return jsx("div", {
|
|
71
68
|
css: [
|
|
72
|
-
//
|
|
73
|
-
|
|
69
|
+
// mobile viewport styles
|
|
70
|
+
mobileStyles, isFlyoutOpen && mobileInnerFlyoutStyles,
|
|
74
71
|
// generic styles
|
|
75
72
|
!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
76
73
|
}, children);
|
|
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import { forwardRef, useContext } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
8
7
|
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';
|
|
9
8
|
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
@@ -98,8 +97,8 @@ const LeftSidebarOuter = ({
|
|
|
98
97
|
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
99
98
|
jsx("div", _extends({
|
|
100
99
|
css: [
|
|
101
|
-
//
|
|
102
|
-
|
|
100
|
+
// mobile viewport styles
|
|
101
|
+
mobileStyles, isFlyoutOpen && mobileFlyoutStyles,
|
|
103
102
|
// generic styles
|
|
104
103
|
outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
|
|
105
104
|
className: className,
|
|
@@ -4,7 +4,6 @@ import { Fragment, useCallback, useContext, useEffect, useRef } from 'react';
|
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import useCloseOnEscapePress from '@atlaskit/ds-lib/use-close-on-escape-press';
|
|
6
6
|
import { easeOut } from '@atlaskit/motion';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
9
8
|
import { N100A } from '@atlaskit/theme/colors';
|
|
10
9
|
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';
|
|
@@ -32,7 +31,6 @@ const hiddenBackdropStyles = css({
|
|
|
32
31
|
*
|
|
33
32
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
34
33
|
*
|
|
35
|
-
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
36
34
|
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
37
35
|
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
38
36
|
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
@@ -218,11 +216,8 @@ const LeftSidebar = props => {
|
|
|
218
216
|
}, FLYOUT_DELAY);
|
|
219
217
|
};
|
|
220
218
|
const mobileMediaQuery = useMediaQuery('below.sm');
|
|
221
|
-
|
|
222
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
223
219
|
const openMobileFlyout = useCallback(() => {
|
|
224
|
-
if (!
|
|
225
|
-
// Only do this for our feature flag and for mobile viewports
|
|
220
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
226
221
|
return;
|
|
227
222
|
}
|
|
228
223
|
setLeftSidebarState(current => {
|
|
@@ -235,10 +230,8 @@ const LeftSidebar = props => {
|
|
|
235
230
|
};
|
|
236
231
|
});
|
|
237
232
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
238
|
-
|
|
239
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
240
233
|
const closeMobileFlyout = useCallback(() => {
|
|
241
|
-
if (!
|
|
234
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
242
235
|
return;
|
|
243
236
|
}
|
|
244
237
|
setLeftSidebarState(current => {
|
|
@@ -251,12 +244,7 @@ const LeftSidebar = props => {
|
|
|
251
244
|
};
|
|
252
245
|
});
|
|
253
246
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
254
|
-
|
|
255
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
256
247
|
useMediaQuery('below.sm', event => {
|
|
257
|
-
if (!getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g')) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
248
|
setLeftSidebarState(current => {
|
|
261
249
|
if (event.matches && !current.isLeftSidebarCollapsed) {
|
|
262
250
|
// Sidebar was previously open when resizing downwards, convert the sidebar being open to a flyout being open
|
|
@@ -285,12 +273,11 @@ const LeftSidebar = props => {
|
|
|
285
273
|
});
|
|
286
274
|
|
|
287
275
|
// Close the flyout when the "escape" key is pressed.
|
|
288
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone as `closeMobileFlyout` only does something with the feature flag.
|
|
289
276
|
useCloseOnEscapePress({
|
|
290
277
|
onClose: closeMobileFlyout,
|
|
291
|
-
isDisabled: !
|
|
278
|
+
isDisabled: !isFlyoutOpen
|
|
292
279
|
});
|
|
293
|
-
return jsx(Fragment, null,
|
|
280
|
+
return jsx(Fragment, null, (mobileMediaQuery === null || mobileMediaQuery === void 0 ? void 0 : mobileMediaQuery.matches) &&
|
|
294
281
|
/**
|
|
295
282
|
* On desktop, the `onClick` handlers controls the temporary flyout behavior.
|
|
296
283
|
* This is an intentionally mouse-only experience, it may even be disruptive with keyboard navigation.
|
|
@@ -305,9 +292,9 @@ const LeftSidebar = props => {
|
|
|
305
292
|
}), jsx(LeftSidebarOuter, {
|
|
306
293
|
ref: leftSideBarRef,
|
|
307
294
|
testId: testId,
|
|
308
|
-
onMouseOver: !(
|
|
309
|
-
onMouseLeave: !(
|
|
310
|
-
onClick:
|
|
295
|
+
onMouseOver: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseOver : undefined,
|
|
296
|
+
onMouseLeave: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseLeave : undefined,
|
|
297
|
+
onClick: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? openMobileFlyout : undefined,
|
|
311
298
|
id: id,
|
|
312
299
|
isFixed: isFixed
|
|
313
300
|
}, jsx(SlotDimensions, {
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
7
6
|
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';
|
|
8
7
|
import { SidebarResizeController, SkipLinksController } from '../../controllers';
|
|
@@ -55,7 +54,7 @@ const PageLayout = ({
|
|
|
55
54
|
skipLinksLabel: skipLinksLabel
|
|
56
55
|
}), jsx("div", _extends({}, pageLayoutSelector, {
|
|
57
56
|
"data-testid": testId,
|
|
58
|
-
css: [gridStyles,
|
|
57
|
+
css: [gridStyles, gridStylesMobileStyles],
|
|
59
58
|
tabIndex: -1
|
|
60
59
|
}), jsx(SidebarResizeController, {
|
|
61
60
|
onLeftSidebarCollapse: onLeftSidebarCollapse,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
4
3
|
export default (({
|
|
5
4
|
variableName,
|
|
6
5
|
value,
|
|
7
6
|
mobileValue
|
|
8
|
-
}) => /*#__PURE__*/React.createElement("style", null, `:root{--${variableName}:${value}px;}`,
|
|
7
|
+
}) => /*#__PURE__*/React.createElement("style", null, `:root{--${variableName}:${value}px;}`, mobileValue && `${UNSAFE_media.below.sm} { :root{--${variableName}:${mobileValue}px;} }`));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as publishGridState } from './use-page-layout-grid';
|
|
2
|
-
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock } from './sidebar-resize-context';
|
|
2
|
+
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState } from './sidebar-resize-context';
|
|
3
3
|
export { SidebarResizeController } from './sidebar-resize-controller';
|
|
4
4
|
export { useSkipLinks, useSkipLink } from './skip-link-context';
|
|
5
5
|
export { SkipLinksController } from './skip-link-controller';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect } from 'react';
|
|
2
2
|
import noop from '@atlaskit/ds-lib/noop';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
const leftSidebarState = {
|
|
4
5
|
isFlyoutOpen: false,
|
|
5
6
|
isResizing: false,
|
|
@@ -9,6 +10,7 @@ const leftSidebarState = {
|
|
|
9
10
|
flyoutLockCount: 0,
|
|
10
11
|
isFixed: true
|
|
11
12
|
};
|
|
13
|
+
|
|
12
14
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
13
15
|
export const SidebarResizeContext = /*#__PURE__*/createContext({
|
|
14
16
|
isLeftSidebarCollapsed: false,
|
|
@@ -59,4 +61,14 @@ export const useLeftSidebarFlyoutLock = () => {
|
|
|
59
61
|
}));
|
|
60
62
|
};
|
|
61
63
|
}, [setLeftSidebarState]);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Returns noop. Added to support an internal redesign, `UNSAFE_useSetLeftSidebarState` will be removed in the next major release.
|
|
68
|
+
*/
|
|
69
|
+
export const UNSAFE_useSetLeftSidebarState = () => {
|
|
70
|
+
const {
|
|
71
|
+
setLeftSidebarState
|
|
72
|
+
} = useContext(SidebarResizeContext);
|
|
73
|
+
return getBooleanFF('platform.atlassian.griffin-navigation-redesign') ? setLeftSidebarState : noop;
|
|
62
74
|
};
|
|
@@ -2,7 +2,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
4
|
import { isReducedMotion } from '@atlaskit/motion';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
7
6
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_COLLAPSING } from '../common/constants';
|
|
8
7
|
import { getPageLayoutSlotCSSSelector } from '../common/utils';
|
|
@@ -51,7 +50,7 @@ export const SidebarResizeController = ({
|
|
|
51
50
|
}, [onExpand, onCollapse]);
|
|
52
51
|
const transition = useRef(null);
|
|
53
52
|
const mobileMediaQuery = useMediaQuery('below.sm');
|
|
54
|
-
const isOpen =
|
|
53
|
+
const isOpen = mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? isFlyoutOpen : !isLeftSidebarCollapsed;
|
|
55
54
|
const expandLeftSidebar = useCallback(() => {
|
|
56
55
|
var _transition$current2, _transition$current3;
|
|
57
56
|
if (isOpen) {
|
|
@@ -60,7 +59,7 @@ export const SidebarResizeController = ({
|
|
|
60
59
|
|
|
61
60
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
62
61
|
// We don't expand at mobile widths; instead we use a flyout which is treated the same otherwise
|
|
63
|
-
if (
|
|
62
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
64
63
|
var _transition$current;
|
|
65
64
|
const flyoutOpenSidebarState = {
|
|
66
65
|
isResizing: false,
|
|
@@ -136,7 +135,7 @@ export const SidebarResizeController = ({
|
|
|
136
135
|
|
|
137
136
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
138
137
|
// We don't collapse at mobile widths; instead we close the flyout.
|
|
139
|
-
if (
|
|
138
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
140
139
|
var _transition$current5;
|
|
141
140
|
const flyoutCloseSidebarState = {
|
|
142
141
|
isResizing: false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { PageLayout, Main, Content, RightSidebar, LeftSidebar, LeftSidebarWithoutResize, RightPanel, LeftPanel, Banner, TopNavigation, useCustomSkipLink } from './components';
|
|
2
2
|
export { LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, BANNER_HEIGHT, TOP_NAVIGATION_HEIGHT, LEFT_SIDEBAR_WIDTH, RIGHT_SIDEBAR_WIDTH } from './common/constants';
|
|
3
|
-
export { usePageLayoutResize, useLeftSidebarFlyoutLock } from './controllers';
|
|
3
|
+
export { usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState } from './controllers';
|
|
@@ -8,7 +8,6 @@ import { Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState
|
|
|
8
8
|
import { css, Global, jsx } from '@emotion/react';
|
|
9
9
|
import { bindAll } from 'bind-event-listener';
|
|
10
10
|
import rafSchd from 'raf-schd';
|
|
11
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
13
12
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
14
13
|
import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
|
|
@@ -55,7 +54,6 @@ var globalResizingStyles = css({
|
|
|
55
54
|
// However, to minimize risk we are just disabling `pointer-events` on iframes
|
|
56
55
|
// as that change is actually needed to fix resizing with iframes
|
|
57
56
|
});
|
|
58
|
-
|
|
59
57
|
var ResizeControl = function ResizeControl(_ref) {
|
|
60
58
|
var testId = _ref.testId,
|
|
61
59
|
overrides = _ref.overrides,
|
|
@@ -328,10 +326,8 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
328
326
|
}), jsx(Shadow, {
|
|
329
327
|
testId: testId && "".concat(testId, "-shadow")
|
|
330
328
|
}),
|
|
331
|
-
//
|
|
332
|
-
|
|
333
|
-
// With the feature flag, only show the GrabArea if we're not on the mobile viewport
|
|
334
|
-
getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) && jsx(GrabArea, {
|
|
329
|
+
// Only show the GrabArea if we're not on the mobile viewport
|
|
330
|
+
!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) && jsx(GrabArea, {
|
|
335
331
|
isDisabled: isLeftSidebarCollapsed,
|
|
336
332
|
isLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
|
337
333
|
label: resizeGrabAreaLabel,
|
|
@@ -343,7 +339,7 @@ var ResizeControl = function ResizeControl(_ref) {
|
|
|
343
339
|
onMouseDown: onMouseDown,
|
|
344
340
|
testId: testId && "".concat(testId, "-grab-area")
|
|
345
341
|
}), resizeButton.render(ResizeButton, {
|
|
346
|
-
isLeftSidebarCollapsed:
|
|
342
|
+
isLeftSidebarCollapsed: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? !leftSidebarState.isFlyoutOpen : isLeftSidebarCollapsed,
|
|
347
343
|
label: resizeButtonLabel,
|
|
348
344
|
onClick: toggleSideBar,
|
|
349
345
|
testId: testId && "".concat(testId, "-resize-button")
|
|
@@ -8,7 +8,6 @@ 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
11
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
13
12
|
import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
|
|
14
13
|
import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
|
|
@@ -73,7 +72,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
73
72
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
74
73
|
"aria-label": label,
|
|
75
74
|
type: "button",
|
|
76
|
-
css: [resizeIconButtonStyles,
|
|
75
|
+
css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
77
76
|
"data-testid": testId
|
|
78
77
|
// Prevents focus staying attached to the button when pressed
|
|
79
78
|
,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -3,14 +3,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
8
7
|
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';
|
|
9
8
|
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
10
9
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
11
10
|
var prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- With a feature flag, this does not apply
|
|
14
11
|
var mobileStyles = css(_defineProperty({}, UNSAFE_media.below.sm, {
|
|
15
12
|
width: "".concat(MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, "px"),
|
|
16
13
|
position: 'fixed',
|
|
@@ -65,8 +62,8 @@ var LeftSidebarInner = function LeftSidebarInner(_ref) {
|
|
|
65
62
|
var isDragging = useIsSidebarDragging();
|
|
66
63
|
return jsx("div", {
|
|
67
64
|
css: [
|
|
68
|
-
//
|
|
69
|
-
|
|
65
|
+
// mobile viewport styles
|
|
66
|
+
mobileStyles, isFlyoutOpen && mobileInnerFlyoutStyles,
|
|
70
67
|
// generic styles
|
|
71
68
|
!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
72
69
|
}, children);
|
|
@@ -4,7 +4,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
import { forwardRef, useContext } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
9
8
|
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';
|
|
10
9
|
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
@@ -89,8 +88,8 @@ var LeftSidebarOuter = function LeftSidebarOuter(_ref, ref) {
|
|
|
89
88
|
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
90
89
|
jsx("div", _extends({
|
|
91
90
|
css: [
|
|
92
|
-
//
|
|
93
|
-
|
|
91
|
+
// mobile viewport styles
|
|
92
|
+
mobileStyles, isFlyoutOpen && mobileFlyoutStyles,
|
|
94
93
|
// generic styles
|
|
95
94
|
outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
|
|
96
95
|
className: className,
|
|
@@ -7,7 +7,6 @@ import { Fragment, useCallback, useContext, useEffect, useRef } from 'react';
|
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import useCloseOnEscapePress from '@atlaskit/ds-lib/use-close-on-escape-press';
|
|
9
9
|
import { easeOut } from '@atlaskit/motion';
|
|
10
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
12
11
|
import { N100A } from '@atlaskit/theme/colors';
|
|
13
12
|
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';
|
|
@@ -35,7 +34,6 @@ var hiddenBackdropStyles = css({
|
|
|
35
34
|
*
|
|
36
35
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
37
36
|
*
|
|
38
|
-
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
39
37
|
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
40
38
|
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
41
39
|
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
@@ -219,11 +217,8 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
219
217
|
}, FLYOUT_DELAY);
|
|
220
218
|
};
|
|
221
219
|
var mobileMediaQuery = useMediaQuery('below.sm');
|
|
222
|
-
|
|
223
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
224
220
|
var openMobileFlyout = useCallback(function () {
|
|
225
|
-
if (!
|
|
226
|
-
// Only do this for our feature flag and for mobile viewports
|
|
221
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
227
222
|
return;
|
|
228
223
|
}
|
|
229
224
|
setLeftSidebarState(function (current) {
|
|
@@ -235,10 +230,8 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
235
230
|
});
|
|
236
231
|
});
|
|
237
232
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
238
|
-
|
|
239
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
240
233
|
var closeMobileFlyout = useCallback(function () {
|
|
241
|
-
if (!
|
|
234
|
+
if (!(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches)) {
|
|
242
235
|
return;
|
|
243
236
|
}
|
|
244
237
|
setLeftSidebarState(function (current) {
|
|
@@ -250,12 +243,7 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
250
243
|
});
|
|
251
244
|
});
|
|
252
245
|
}, [setLeftSidebarState, mobileMediaQuery]);
|
|
253
|
-
|
|
254
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
|
|
255
246
|
useMediaQuery('below.sm', function (event) {
|
|
256
|
-
if (!getBooleanFF('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g')) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
247
|
setLeftSidebarState(function (current) {
|
|
260
248
|
if (event.matches && !current.isLeftSidebarCollapsed) {
|
|
261
249
|
// Sidebar was previously open when resizing downwards, convert the sidebar being open to a flyout being open
|
|
@@ -282,12 +270,11 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
282
270
|
});
|
|
283
271
|
|
|
284
272
|
// Close the flyout when the "escape" key is pressed.
|
|
285
|
-
// CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone as `closeMobileFlyout` only does something with the feature flag.
|
|
286
273
|
useCloseOnEscapePress({
|
|
287
274
|
onClose: closeMobileFlyout,
|
|
288
|
-
isDisabled: !
|
|
275
|
+
isDisabled: !isFlyoutOpen
|
|
289
276
|
});
|
|
290
|
-
return jsx(Fragment, null,
|
|
277
|
+
return jsx(Fragment, null, (mobileMediaQuery === null || mobileMediaQuery === void 0 ? void 0 : mobileMediaQuery.matches) &&
|
|
291
278
|
/**
|
|
292
279
|
* On desktop, the `onClick` handlers controls the temporary flyout behavior.
|
|
293
280
|
* This is an intentionally mouse-only experience, it may even be disruptive with keyboard navigation.
|
|
@@ -302,9 +289,9 @@ var LeftSidebar = function LeftSidebar(props) {
|
|
|
302
289
|
}), jsx(LeftSidebarOuter, {
|
|
303
290
|
ref: leftSideBarRef,
|
|
304
291
|
testId: testId,
|
|
305
|
-
onMouseOver: !(
|
|
306
|
-
onMouseLeave: !(
|
|
307
|
-
onClick:
|
|
292
|
+
onMouseOver: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseOver : undefined,
|
|
293
|
+
onMouseLeave: !(mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) ? onMouseLeave : undefined,
|
|
294
|
+
onClick: mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? openMobileFlyout : undefined,
|
|
308
295
|
id: id,
|
|
309
296
|
isFixed: isFixed
|
|
310
297
|
}, jsx(SlotDimensions, {
|
|
@@ -3,7 +3,6 @@ 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
6
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
8
7
|
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';
|
|
9
8
|
import { SidebarResizeController, SkipLinksController } from '../../controllers';
|
|
@@ -43,7 +42,7 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
43
42
|
skipLinksLabel: skipLinksLabel
|
|
44
43
|
}), jsx("div", _extends({}, pageLayoutSelector, {
|
|
45
44
|
"data-testid": testId,
|
|
46
|
-
css: [gridStyles,
|
|
45
|
+
css: [gridStyles, gridStylesMobileStyles],
|
|
47
46
|
tabIndex: -1
|
|
48
47
|
}), jsx(SidebarResizeController, {
|
|
49
48
|
onLeftSidebarCollapse: onLeftSidebarCollapse,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
4
3
|
export default (function (_ref) {
|
|
5
4
|
var variableName = _ref.variableName,
|
|
6
5
|
value = _ref.value,
|
|
7
6
|
mobileValue = _ref.mobileValue;
|
|
8
|
-
return /*#__PURE__*/React.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"),
|
|
7
|
+
return /*#__PURE__*/React.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"), mobileValue && "".concat(UNSAFE_media.below.sm, " { :root{--").concat(variableName, ":").concat(mobileValue, "px;} }"));
|
|
9
8
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as publishGridState } from './use-page-layout-grid';
|
|
2
|
-
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock } from './sidebar-resize-context';
|
|
2
|
+
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState } from './sidebar-resize-context';
|
|
3
3
|
export { SidebarResizeController } from './sidebar-resize-controller';
|
|
4
4
|
export { useSkipLinks, useSkipLink } from './skip-link-context';
|
|
5
5
|
export { SkipLinksController } from './skip-link-controller';
|
|
@@ -5,6 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { createContext, useContext, useEffect } from 'react';
|
|
7
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
var leftSidebarState = {
|
|
9
10
|
isFlyoutOpen: false,
|
|
10
11
|
isResizing: false,
|
|
@@ -14,6 +15,7 @@ var leftSidebarState = {
|
|
|
14
15
|
flyoutLockCount: 0,
|
|
15
16
|
isFixed: true
|
|
16
17
|
};
|
|
18
|
+
|
|
17
19
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
18
20
|
export var SidebarResizeContext = /*#__PURE__*/createContext({
|
|
19
21
|
isLeftSidebarCollapsed: false,
|
|
@@ -64,4 +66,13 @@ export var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
|
|
|
64
66
|
});
|
|
65
67
|
};
|
|
66
68
|
}, [setLeftSidebarState]);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Returns noop. Added to support an internal redesign, `UNSAFE_useSetLeftSidebarState` will be removed in the next major release.
|
|
73
|
+
*/
|
|
74
|
+
export var UNSAFE_useSetLeftSidebarState = function UNSAFE_useSetLeftSidebarState() {
|
|
75
|
+
var _useContext3 = useContext(SidebarResizeContext),
|
|
76
|
+
setLeftSidebarState = _useContext3.setLeftSidebarState;
|
|
77
|
+
return getBooleanFF('platform.atlassian.griffin-navigation-redesign') ? setLeftSidebarState : noop;
|
|
67
78
|
};
|
|
@@ -3,7 +3,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { isReducedMotion } from '@atlaskit/motion';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
8
7
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_COLLAPSING } from '../common/constants';
|
|
9
8
|
import { getPageLayoutSlotCSSSelector } from '../common/utils';
|
|
@@ -54,7 +53,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
54
53
|
}, [onExpand, onCollapse]);
|
|
55
54
|
var transition = useRef(null);
|
|
56
55
|
var mobileMediaQuery = useMediaQuery('below.sm');
|
|
57
|
-
var isOpen =
|
|
56
|
+
var isOpen = mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches ? isFlyoutOpen : !isLeftSidebarCollapsed;
|
|
58
57
|
var expandLeftSidebar = useCallback(function () {
|
|
59
58
|
var _transition$current2, _transition$current3;
|
|
60
59
|
if (isOpen) {
|
|
@@ -63,7 +62,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
63
62
|
|
|
64
63
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
65
64
|
// We don't expand at mobile widths; instead we use a flyout which is treated the same otherwise
|
|
66
|
-
if (
|
|
65
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
67
66
|
var _transition$current;
|
|
68
67
|
var flyoutOpenSidebarState = {
|
|
69
68
|
isResizing: false,
|
|
@@ -139,7 +138,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
139
138
|
|
|
140
139
|
// If the user is at a mobile viewport when this runs, we handle it differently
|
|
141
140
|
// We don't collapse at mobile widths; instead we close the flyout.
|
|
142
|
-
if (
|
|
141
|
+
if (mobileMediaQuery !== null && mobileMediaQuery !== void 0 && mobileMediaQuery.matches) {
|
|
143
142
|
var _transition$current5;
|
|
144
143
|
var flyoutCloseSidebarState = {
|
|
145
144
|
isResizing: false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { PageLayout, Main, Content, RightSidebar, LeftSidebar, LeftSidebarWithoutResize, RightPanel, LeftPanel, Banner, TopNavigation, useCustomSkipLink } from './components';
|
|
2
2
|
export { LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, BANNER_HEIGHT, TOP_NAVIGATION_HEIGHT, LEFT_SIDEBAR_WIDTH, RIGHT_SIDEBAR_WIDTH } from './common/constants';
|
|
3
|
-
export { usePageLayoutResize, useLeftSidebarFlyoutLock } from './controllers';
|
|
3
|
+
export { usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState } from './controllers';
|
|
@@ -5,7 +5,6 @@ import { LeftSidebarProps } from '../../common/types';
|
|
|
5
5
|
*
|
|
6
6
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
7
7
|
*
|
|
8
|
-
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
9
8
|
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
10
9
|
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
11
10
|
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { SkipLinkData } from './types';
|
|
2
2
|
export { default as publishGridState } from './use-page-layout-grid';
|
|
3
|
-
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, } from './sidebar-resize-context';
|
|
3
|
+
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState, } from './sidebar-resize-context';
|
|
4
4
|
export { SidebarResizeController } from './sidebar-resize-controller';
|
|
5
5
|
export { useSkipLinks, useSkipLink } from './skip-link-context';
|
|
6
6
|
export { SkipLinksController } from './skip-link-controller';
|
|
@@ -50,3 +50,7 @@ export declare const usePageLayoutResize: () => {
|
|
|
50
50
|
* as long as the popup is open.
|
|
51
51
|
*/
|
|
52
52
|
export declare const useLeftSidebarFlyoutLock: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Returns noop. Added to support an internal redesign, `UNSAFE_useSetLeftSidebarState` will be removed in the next major release.
|
|
55
|
+
*/
|
|
56
|
+
export declare const UNSAFE_useSetLeftSidebarState: () => SidebarResizeContextValue['setLeftSidebarState'];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PageLayout, Main, Content, RightSidebar, LeftSidebar, LeftSidebarWithoutResize, RightPanel, LeftPanel, Banner, TopNavigation, useCustomSkipLink, } from './components';
|
|
2
2
|
export { LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, BANNER_HEIGHT, TOP_NAVIGATION_HEIGHT, LEFT_SIDEBAR_WIDTH, RIGHT_SIDEBAR_WIDTH, } from './common/constants';
|
|
3
|
-
export { usePageLayoutResize, useLeftSidebarFlyoutLock } from './controllers';
|
|
3
|
+
export { usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState, } from './controllers';
|
|
4
4
|
export type { SlotHeightProps, SlotWidthProps, Dimensions, LeftSidebarState, } from './common/types';
|
|
@@ -5,7 +5,6 @@ import { LeftSidebarProps } from '../../common/types';
|
|
|
5
5
|
*
|
|
6
6
|
* Provides a slot for a left sidebar within the PageLayout.
|
|
7
7
|
*
|
|
8
|
-
* [Behind a feature-flag 'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g']:
|
|
9
8
|
* On smaller viewports, the left sidebar can no longer be expanded. Instead, expanding it will
|
|
10
9
|
* put it into our "flyout mode" to lay overtop (which in desktop is explicitly a hover state).
|
|
11
10
|
* This ensures the contents behind do not reflow oddly and allows for a better experience
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { SkipLinkData } from './types';
|
|
2
2
|
export { default as publishGridState } from './use-page-layout-grid';
|
|
3
|
-
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, } from './sidebar-resize-context';
|
|
3
|
+
export { SidebarResizeContext, usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState, } from './sidebar-resize-context';
|
|
4
4
|
export { SidebarResizeController } from './sidebar-resize-controller';
|
|
5
5
|
export { useSkipLinks, useSkipLink } from './skip-link-context';
|
|
6
6
|
export { SkipLinksController } from './skip-link-controller';
|
|
@@ -50,3 +50,7 @@ export declare const usePageLayoutResize: () => {
|
|
|
50
50
|
* as long as the popup is open.
|
|
51
51
|
*/
|
|
52
52
|
export declare const useLeftSidebarFlyoutLock: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Returns noop. Added to support an internal redesign, `UNSAFE_useSetLeftSidebarState` will be removed in the next major release.
|
|
55
|
+
*/
|
|
56
|
+
export declare const UNSAFE_useSetLeftSidebarState: () => SidebarResizeContextValue['setLeftSidebarState'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PageLayout, Main, Content, RightSidebar, LeftSidebar, LeftSidebarWithoutResize, RightPanel, LeftPanel, Banner, TopNavigation, useCustomSkipLink, } from './components';
|
|
2
2
|
export { LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, BANNER_HEIGHT, TOP_NAVIGATION_HEIGHT, LEFT_SIDEBAR_WIDTH, RIGHT_SIDEBAR_WIDTH, } from './common/constants';
|
|
3
|
-
export { usePageLayoutResize, useLeftSidebarFlyoutLock } from './controllers';
|
|
3
|
+
export { usePageLayoutResize, useLeftSidebarFlyoutLock, UNSAFE_useSetLeftSidebarState, } from './controllers';
|
|
4
4
|
export type { SlotHeightProps, SlotWidthProps, Dimensions, LeftSidebarState, } from './common/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/page-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A collection of components which let you compose an application's page layout.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@atlaskit/icon": "^22.1.0",
|
|
43
43
|
"@atlaskit/motion": "^1.5.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
45
|
-
"@atlaskit/primitives": "^4.
|
|
45
|
+
"@atlaskit/primitives": "^4.1.0",
|
|
46
46
|
"@atlaskit/theme": "^12.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.41.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
50
|
"bind-event-listener": "^2.1.1",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@af/accessibility-testing": "*",
|
|
59
59
|
"@af/integration-testing": "*",
|
|
60
|
-
"@atlaskit/atlassian-navigation": "^3.
|
|
60
|
+
"@atlaskit/atlassian-navigation": "^3.3.0",
|
|
61
61
|
"@atlaskit/atlassian-notifications": "^0.4.0",
|
|
62
|
-
"@atlaskit/drawer": "^7.
|
|
62
|
+
"@atlaskit/drawer": "^7.7.0",
|
|
63
63
|
"@atlaskit/logo": "^13.15.0",
|
|
64
64
|
"@atlaskit/menu": "^2.1.0",
|
|
65
65
|
"@atlaskit/notification-indicator": "^9.2.0",
|
|
@@ -113,10 +113,10 @@
|
|
|
113
113
|
},
|
|
114
114
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
115
115
|
"platform-feature-flags": {
|
|
116
|
-
"platform.design-system-team.
|
|
116
|
+
"platform.design-system-team.page-layout-resize-button-fix_u0qxv": {
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
-
"platform.
|
|
119
|
+
"platform.atlassian.griffin-navigation-redesign": {
|
|
120
120
|
"type": "boolean"
|
|
121
121
|
}
|
|
122
122
|
}
|