@atlaskit/navigation-system 11.7.8 → 11.8.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 +20 -0
- package/constellation/layout/code.mdx +8 -0
- package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +20 -14
- package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +28 -7
- package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/cjs/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/cjs/ui/page-layout/panel-layout-shell.js +11 -8
- package/dist/cjs/ui/page-layout/panel-layout.js +9 -1
- package/dist/cjs/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +19 -14
- package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +26 -7
- package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/es2019/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/es2019/ui/page-layout/panel-layout-shell.js +14 -7
- package/dist/es2019/ui/page-layout/panel-layout.js +7 -1
- package/dist/es2019/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/esm/ui/page-layout/calculate-layout-area-states.js +20 -14
- package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +28 -7
- package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/esm/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/esm/ui/page-layout/panel-layout-shell.js +11 -8
- package/dist/esm/ui/page-layout/panel-layout.js +9 -1
- package/dist/esm/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/types/ui/page-layout/calculate-layout-area-states.d.ts +5 -1
- package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +1 -0
- package/dist/types/ui/page-layout/layout-area-sizing-runtime.d.ts +2 -1
- package/dist/types/ui/page-layout/panel-layout-shell.d.ts +3 -1
- package/dist/types/ui/page-layout/panel-layout.d.ts +8 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 11.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`fe869b1ecb8e1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fe869b1ecb8e1) -
|
|
8
|
+
Add an XL local-panel default of 500px at 1768px and above with chat layout enabled, and an
|
|
9
|
+
xlDefaultPanelWidth override that preserves controlled and saved widths.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 11.7.9
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`7b64c4a16f148`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b64c4a16f148) -
|
|
20
|
+
Prevent controlled PanelLayout widths from briefly reverting to an obsolete width when a resize
|
|
21
|
+
completes. Preserve consumer overrides and existing caller feature gates.
|
|
22
|
+
|
|
3
23
|
## 11.7.8
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -121,6 +121,14 @@ Use `defaultPanelWidth` for an initial width, or pair `panelWidth` with `onPanel
|
|
|
121
121
|
control it. Available space can constrain the rendered width. Use `onResizeEnd` for persistence or
|
|
122
122
|
analytics after a completed resize, and provide localized `panelLabel` and `resizeLabel` values.
|
|
123
123
|
|
|
124
|
+
With chat layout enabled, the local panel defaults to 320px below 64rem (1024px), 400px below
|
|
125
|
+
110.5rem (1768px), and 500px at 110.5rem and above. These are viewport breakpoints; available layout
|
|
126
|
+
space can still compress the panel. Chat retains its 400px desktop default. Use
|
|
127
|
+
`compactDefaultPanelWidth` or `xlDefaultPanelWidth` to override a breakpoint's default. An explicit
|
|
128
|
+
`defaultPanelWidth` supplies all breakpoint defaults unless separately overridden. Defaults are
|
|
129
|
+
captured on mount; controlled and user-resized widths take precedence. `LayoutWithPanel` also
|
|
130
|
+
accepts `xlDefaultPanelWidth`, with saved provider widths taking precedence.
|
|
131
|
+
|
|
124
132
|
`PanelLayout` contains the layout and resizing responsibilities extracted from
|
|
125
133
|
`@atlassian/panel-system`. That package's `LayoutWithPanel` remains an adapter that connects panel
|
|
126
134
|
state and routed content to `PanelLayout`.
|
|
@@ -17,14 +17,18 @@ function clampTargetWidth(_ref) {
|
|
|
17
17
|
max = _ref.max;
|
|
18
18
|
return Math.max(min, Math.min(target, max));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
var _area$compactDefaultW, _area$
|
|
22
|
-
|
|
20
|
+
function getDefaultWidth(area, isCompact, isXlViewport) {
|
|
21
|
+
var _area$compactDefaultW, _area$xlDefaultWidth;
|
|
22
|
+
return isCompact ? (_area$compactDefaultW = area.compactDefaultWidth) !== null && _area$compactDefaultW !== void 0 ? _area$compactDefaultW : area.defaultWidth : isXlViewport ? (_area$xlDefaultWidth = area.xlDefaultWidth) !== null && _area$xlDefaultWidth !== void 0 ? _area$xlDefaultWidth : area.defaultWidth : area.defaultWidth;
|
|
23
|
+
}
|
|
24
|
+
function getTargetWidth(area, isSideNavOverlay, isXlViewport) {
|
|
25
|
+
var _area$liveResize, _ref2, _area$requestedWidth;
|
|
26
|
+
var defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
23
27
|
return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref2 = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
|
|
24
28
|
}
|
|
25
|
-
function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
|
|
26
|
-
var _area$
|
|
27
|
-
var defaultWidth =
|
|
29
|
+
function getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName) {
|
|
30
|
+
var _area$liveResize2, _ref3, _area$requestedWidth2;
|
|
31
|
+
var defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
28
32
|
return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref3 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : areaName === 'panel' ? area.preferredWidth : area.preferredOverlayWidth) !== null && _ref3 !== void 0 ? _ref3 : defaultWidth;
|
|
29
33
|
}
|
|
30
34
|
function calculateLayoutAreaStates(_ref4) {
|
|
@@ -34,6 +38,8 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
34
38
|
layoutWidth = _ref4$layoutWidth === void 0 ? viewportWidth : _ref4$layoutWidth,
|
|
35
39
|
isChatPanelOverlay = _ref4.isChatPanelOverlay,
|
|
36
40
|
isSideNavOverlay = _ref4.isSideNavOverlay,
|
|
41
|
+
_ref4$isXlViewport = _ref4.isXlViewport,
|
|
42
|
+
isXlViewport = _ref4$isXlViewport === void 0 ? false : _ref4$isXlViewport,
|
|
37
43
|
_ref4$occupiedWidth = _ref4.occupiedWidth,
|
|
38
44
|
occupiedWidth = _ref4$occupiedWidth === void 0 ? 0 : _ref4$occupiedWidth,
|
|
39
45
|
mainMinWidthBound = _ref4.mainMinWidth,
|
|
@@ -56,7 +62,7 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
56
62
|
// A growing panel cascades towards inline-start. Chat is on the other side
|
|
57
63
|
// of the local rail, so local growth must reserve its full starting width.
|
|
58
64
|
var shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
|
|
59
|
-
target: getTargetWidth(resizingArea, isSideNavOverlay),
|
|
65
|
+
target: getTargetWidth(resizingArea, isSideNavOverlay, isXlViewport),
|
|
60
66
|
min: (0, _resolveLayoutWidth.resolveLayoutWidth)(resizingArea.minWidth, viewportWidth),
|
|
61
67
|
max: resizingArea.maxWidth !== undefined ? (0, _resolveLayoutWidth.resolveLayoutWidth)(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
|
|
62
68
|
}) > availableWidth - mainMinWidth - sideNavMinWidth - (resizeSession.area === 'panel' ? resizeSession.baselineWidths['chat-panel'] !== undefined ? (_baselineWidths$chat = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths['chat-panel']) !== null && _baselineWidths$chat !== void 0 ? _baselineWidths$chat : chatPanelMinWidth : 0 : resizeSession.baselineWidths.panel !== undefined ? panelMinWidth : 0));
|
|
@@ -99,7 +105,7 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
99
105
|
var min = (0, _resolveLayoutWidth.resolveLayoutWidth)(area.minWidth, viewportWidth);
|
|
100
106
|
var max = area.maxWidth ? (0, _resolveLayoutWidth.resolveLayoutWidth)(area.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY;
|
|
101
107
|
var baselineWidth = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths[areaName];
|
|
102
|
-
var requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay) : getTargetWidth(area, isSideNavOverlay);
|
|
108
|
+
var requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay, isXlViewport) : getTargetWidth(area, isSideNavOverlay, isXlViewport);
|
|
103
109
|
var target = clampTargetWidth({
|
|
104
110
|
target: requestedTarget,
|
|
105
111
|
min: min,
|
|
@@ -163,12 +169,12 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
163
169
|
_iterator2.f();
|
|
164
170
|
}
|
|
165
171
|
if (hasPanelClearance && panel) {
|
|
166
|
-
var
|
|
172
|
+
var _widths$get4, _widths$get5;
|
|
167
173
|
// Opening/viewport fitting gives up SideNav width before Chat. During a
|
|
168
174
|
// panel drag only SideNav yields; Chat retains its starting width.
|
|
169
175
|
var isPanelResize = (resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.area) === 'panel';
|
|
170
|
-
var desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, 'panel'), panel.maxWidth === undefined ? Infinity : (0, _resolveLayoutWidth.resolveLayoutWidth)(panel.maxWidth, viewportWidth)));
|
|
171
|
-
var overlayDefault =
|
|
176
|
+
var desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, isXlViewport, 'panel'), panel.maxWidth === undefined ? Infinity : (0, _resolveLayoutWidth.resolveLayoutWidth)(panel.maxWidth, viewportWidth)));
|
|
177
|
+
var overlayDefault = getDefaultWidth(panel, isSideNavOverlay, isXlViewport);
|
|
172
178
|
var reservedMainWidth = isPanelResize ? Math.max(effectiveMainMinWidth, desiredPanelWidth + 32,
|
|
173
179
|
// Above the default, Main must also fit the panel within its 90% cap.
|
|
174
180
|
desiredPanelWidth > overlayDefault ? desiredPanelWidth / 0.9 : 0) : effectiveMainMinWidth;
|
|
@@ -221,7 +227,7 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
221
227
|
_step4;
|
|
222
228
|
try {
|
|
223
229
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
224
|
-
var _states$_areaName
|
|
230
|
+
var _states$_areaName;
|
|
225
231
|
var _areaName2 = _step4.value;
|
|
226
232
|
var _area = areas[_areaName2];
|
|
227
233
|
if (!(_area !== null && _area !== void 0 && _area.isOpen) || ((_states$_areaName = states[_areaName2]) === null || _states$_areaName === void 0 ? void 0 : _states$_areaName.mode) === 'inline' || _areaName2 === 'side-nav' && shouldCollapseSideNav) {
|
|
@@ -232,11 +238,11 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
232
238
|
// Chat covers Root; SideNav and the local panel overlay Main's grid track.
|
|
233
239
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
234
240
|
var layoutMax = (_areaName2 === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
235
|
-
var defaultWidth =
|
|
241
|
+
var defaultWidth = getDefaultWidth(_area, isSideNavOverlay, isXlViewport);
|
|
236
242
|
var overlayMax = isRefinedLayout && _areaName2 === 'panel' ? hasPanelClearance ? Math.min(availableWidth - sideNavMinWidth - inlineChatPanelWidth - 32, Math.max(defaultWidth, (availableWidth - sideNavMinWidth - inlineChatPanelWidth) * 0.9)) : Math.min(mainAreaWidth, Math.max(defaultWidth, layoutMax)) : isRefinedLayout && _areaName2 === 'chat-panel' ? Math.min(layoutWidth, Math.max(defaultWidth, layoutMax)) : layoutMax;
|
|
237
243
|
var _max = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
238
244
|
var effectiveMin = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? _min2 : Math.min(_min2, _max);
|
|
239
|
-
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, _areaName2);
|
|
245
|
+
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, isXlViewport, _areaName2);
|
|
240
246
|
var _width2 = clampTargetWidth({
|
|
241
247
|
target: _target,
|
|
242
248
|
min: effectiveMin,
|
|
@@ -82,6 +82,7 @@ function LayoutAreaSizingProvider(_ref) {
|
|
|
82
82
|
}, []);
|
|
83
83
|
var mainMinWidth = (0, _react.useRef)(_constants.defaultMainMinWidth);
|
|
84
84
|
var loadRef = (0, _react.useRef)(function () {});
|
|
85
|
+
var viewportWidthAtLoad = (0, _react.useRef)();
|
|
85
86
|
var ready = (0, _react.useRef)(false);
|
|
86
87
|
var waiting = (0, _react.useRef)([]);
|
|
87
88
|
var pending = (0, _react.useRef)([]);
|
|
@@ -107,6 +108,7 @@ function LayoutAreaSizingProvider(_ref) {
|
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
loading = true;
|
|
111
|
+
viewportWidthAtLoad.current = window.innerWidth;
|
|
110
112
|
void Promise.resolve().then(function () {
|
|
111
113
|
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_navigation-layout-sizing" */'./layout-area-sizing-runtime'));
|
|
112
114
|
}).then(function (_ref2) {
|
|
@@ -318,6 +320,7 @@ function LayoutAreaSizingProvider(_ref) {
|
|
|
318
320
|
}, children))), Runtime && /*#__PURE__*/_react.default.createElement(Runtime, {
|
|
319
321
|
layoutRef: layoutRef,
|
|
320
322
|
onReady: onReady,
|
|
321
|
-
onUpdate: onUpdate
|
|
323
|
+
onUpdate: onUpdate,
|
|
324
|
+
viewportWidthAtLoad: viewportWidthAtLoad.current
|
|
322
325
|
}));
|
|
323
326
|
}
|
|
@@ -37,10 +37,12 @@ function useStableAreaState(state) {
|
|
|
37
37
|
}, [mode, width, minWidth]);
|
|
38
38
|
}
|
|
39
39
|
function LayoutAreaSizingRuntime(_ref2) {
|
|
40
|
+
var _areas$panel2;
|
|
40
41
|
var children = _ref2.children,
|
|
41
42
|
layoutRef = _ref2.layoutRef,
|
|
42
43
|
onReady = _ref2.onReady,
|
|
43
|
-
onUpdate = _ref2.onUpdate
|
|
44
|
+
onUpdate = _ref2.onUpdate,
|
|
45
|
+
viewportWidthAtLoad = _ref2.viewportWidthAtLoad;
|
|
44
46
|
var occupiedWidth = (0, _useOccupiedLayoutWidth.useOccupiedLayoutWidth)(layoutRef);
|
|
45
47
|
var _useState = (0, _react.useState)(null),
|
|
46
48
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -60,7 +62,10 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
60
62
|
setResizeSession = _useState8[1];
|
|
61
63
|
var areaStatesRef = _react.default.useRef({});
|
|
62
64
|
var configsRef = _react.default.useRef({});
|
|
63
|
-
|
|
65
|
+
// A viewport change while the chunk loads is already a layout event. Reallocate
|
|
66
|
+
// instead of adopting CSS geometry from the preceding breakpoint (which WebKit
|
|
67
|
+
// can still report during that handoff).
|
|
68
|
+
var _useState9 = (0, _react.useState)(viewportWidthAtLoad !== undefined && viewportWidthAtLoad !== window.innerWidth),
|
|
64
69
|
_useState0 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
65
70
|
hasInteraction = _useState0[0],
|
|
66
71
|
setHasInteraction = _useState0[1];
|
|
@@ -99,6 +104,7 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
99
104
|
// Match the actual rem-based grid breakpoint, including browser font settings.
|
|
100
105
|
var inlineChatQuery = window.matchMedia('(min-width: 40rem)');
|
|
101
106
|
var inlineSideNavQuery = window.matchMedia('(min-width: 64rem)');
|
|
107
|
+
var xlQuery = window.matchMedia('(min-width: 110.5rem)');
|
|
102
108
|
var updateDimensions = function updateDimensions(contentWidth) {
|
|
103
109
|
var _style$width, _style$paddingLeft, _style$paddingRight, _style$borderLeftWidt, _style$borderRightWid, _previous;
|
|
104
110
|
var style = root && contentWidth === undefined ? getComputedStyle(root) : null;
|
|
@@ -113,9 +119,10 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
113
119
|
viewportWidth: window.innerWidth,
|
|
114
120
|
layoutWidth: layoutWidth,
|
|
115
121
|
isChatPanelOverlay: !inlineChatQuery.matches,
|
|
116
|
-
isSideNavOverlay: !inlineSideNavQuery.matches
|
|
122
|
+
isSideNavOverlay: !inlineSideNavQuery.matches,
|
|
123
|
+
isXlViewport: xlQuery.matches
|
|
117
124
|
};
|
|
118
|
-
if (((_previous = previous) === null || _previous === void 0 ? void 0 : _previous.viewportWidth) === next.viewportWidth && previous.layoutWidth === next.layoutWidth && previous.isChatPanelOverlay === next.isChatPanelOverlay && previous.isSideNavOverlay === next.isSideNavOverlay) {
|
|
125
|
+
if (((_previous = previous) === null || _previous === void 0 ? void 0 : _previous.viewportWidth) === next.viewportWidth && previous.layoutWidth === next.layoutWidth && previous.isChatPanelOverlay === next.isChatPanelOverlay && previous.isSideNavOverlay === next.isSideNavOverlay && previous.isXlViewport === next.isXlViewport) {
|
|
119
126
|
return;
|
|
120
127
|
}
|
|
121
128
|
if (previous) {
|
|
@@ -155,7 +162,14 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
155
162
|
return updateDimensions();
|
|
156
163
|
}
|
|
157
164
|
});
|
|
165
|
+
var unbindXlQuery = (0, _bindEventListener.bind)(xlQuery, {
|
|
166
|
+
type: 'change',
|
|
167
|
+
listener: function listener() {
|
|
168
|
+
return updateDimensions();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
158
171
|
return function () {
|
|
172
|
+
unbindXlQuery();
|
|
159
173
|
observer.disconnect();
|
|
160
174
|
unbindResize();
|
|
161
175
|
unbindQuery();
|
|
@@ -164,14 +178,14 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
164
178
|
}, [layoutRef]);
|
|
165
179
|
var registerArea = (0, _react.useCallback)(function (area, config) {
|
|
166
180
|
var previous = configsRef.current[area];
|
|
167
|
-
if (adoptedConstraints.current && (!previous || previous.isOpen !== config.isOpen || previous.requestedWidth !== config.requestedWidth || previous.minWidth !== config.minWidth || previous.maxWidth !== config.maxWidth || previous.defaultWidth !== config.defaultWidth || previous.compactDefaultWidth !== config.compactDefaultWidth)) {
|
|
181
|
+
if (adoptedConstraints.current && (!previous || previous.isOpen !== config.isOpen || previous.requestedWidth !== config.requestedWidth || previous.minWidth !== config.minWidth || previous.maxWidth !== config.maxWidth || previous.defaultWidth !== config.defaultWidth || previous.compactDefaultWidth !== config.compactDefaultWidth || previous.xlDefaultWidth !== config.xlDefaultWidth)) {
|
|
168
182
|
setHasInteraction(true);
|
|
169
183
|
}
|
|
170
184
|
configsRef.current[area] = config;
|
|
171
185
|
setResizeSession(function (current) {
|
|
172
186
|
// A changed layout/configuration needs a fresh allocation. A controlled
|
|
173
187
|
// acknowledgement for the resized area keeps its siblings fixed.
|
|
174
|
-
return previous && (previous.isOpen === config.isOpen || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') && previous.minWidth === config.minWidth && previous.maxWidth === config.maxWidth && previous.defaultWidth === config.defaultWidth && previous.compactDefaultWidth === config.compactDefaultWidth && (previous.requestedWidth === config.requestedWidth || (current === null || current === void 0 ? void 0 : current.area) === area && current.completedWidth === config.requestedWidth || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') ? current : null;
|
|
188
|
+
return previous && (previous.isOpen === config.isOpen || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') && previous.minWidth === config.minWidth && previous.maxWidth === config.maxWidth && previous.defaultWidth === config.defaultWidth && previous.compactDefaultWidth === config.compactDefaultWidth && previous.xlDefaultWidth === config.xlDefaultWidth && (previous.requestedWidth === config.requestedWidth || (current === null || current === void 0 ? void 0 : current.area) === area && current.completedWidth === config.requestedWidth || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') ? current : null;
|
|
175
189
|
});
|
|
176
190
|
setAreas(function (current) {
|
|
177
191
|
var existing = current[area];
|
|
@@ -455,18 +469,25 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
455
469
|
};
|
|
456
470
|
}, [onReady, value]);
|
|
457
471
|
(0, _react.useEffect)(function () {
|
|
472
|
+
var _configsRef$current$p, _areas$panel;
|
|
458
473
|
if (!adoptedConstraints.current && (sideNavState || panelState || chatPanelState)) {
|
|
459
474
|
adoptedConstraints.current = {
|
|
460
475
|
occupiedWidth: occupiedWidth,
|
|
461
476
|
mainMinWidth: mainMinWidth
|
|
462
477
|
};
|
|
463
478
|
}
|
|
479
|
+
// A controlled panel can acknowledge a resize in this same commit. Its
|
|
480
|
+
// registration queues the new allocation before this effect runs; avoid
|
|
481
|
+
// publishing an allocation calculated from the previous requested width.
|
|
482
|
+
if (((_configsRef$current$p = configsRef.current.panel) === null || _configsRef$current$p === void 0 ? void 0 : _configsRef$current$p.requestedWidth) !== ((_areas$panel = areas.panel) === null || _areas$panel === void 0 ? void 0 : _areas$panel.requestedWidth)) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
464
485
|
onUpdate === null || onUpdate === void 0 || onUpdate({
|
|
465
486
|
'side-nav': sideNavState,
|
|
466
487
|
panel: panelState,
|
|
467
488
|
'chat-panel': chatPanelState
|
|
468
489
|
});
|
|
469
|
-
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth]);
|
|
490
|
+
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth, (_areas$panel2 = areas.panel) === null || _areas$panel2 === void 0 ? void 0 : _areas$panel2.requestedWidth]);
|
|
470
491
|
return /*#__PURE__*/_react.default.createElement(_layoutAreaSizingContext.LayoutAreaSizingContext.Provider, {
|
|
471
492
|
value: value
|
|
472
493
|
}, /*#__PURE__*/_react.default.createElement(SideNavStateProvider, {
|
|
@@ -21,9 +21,7 @@
|
|
|
21
21
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
22
22
|
._bfhk1g1j{background-color:var(--p_lclPnlSsrBackground,var(--ds-surface-overlay,#fff))}
|
|
23
23
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
24
|
-
._ifwb1uuk{--p_lclPnlMotionW:var(--p_lclPnlCompactW)}
|
|
25
24
|
._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
|
|
26
25
|
._kqsw1if8{position:sticky}
|
|
27
26
|
._vchhusvi{box-sizing:border-box}
|
|
28
|
-
@media (prefers-reduced-motion:no-preference){.
|
|
29
|
-
@media (min-width:64rem){._1c23i77x{--p_lclPnlMotionW:var(--p_lclPnlTrackW)}}
|
|
27
|
+
@media (prefers-reduced-motion:no-preference){._15et3aws{width:min(90cqw,var(--p_lclPnlSsrPreferredW))}._15etq93i{width:max(var(--p_lclPnlMinW),min(var(--p_lclPnlSsrPreferredW),var(--p_lclPnlMotionMaxW,min(100cqw,var(--n_localPanelOverlayMax,100cqw),max(var(--p_lclPnlSsrDefaultW),90cqw)))))}._k1af14vv{animation:var(--ds-panel-exit-right,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentRight)}._1lh81gzg{grid-area:main}[dir=rtl] ._105aeydr{animation:var(--ds-panel-exit-left,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentLeft)}._15et1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}@starting-style{._12d81gzg{grid-area:main}}._k1af1nn1{animation:var(--ds-panel-enter-right,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentRight)}[dir=rtl] ._105abamb{animation:var(--ds-panel-enter-left,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentLeft)}._10t81q8v{transition-property:grid-area}._xrrp147i{transition-duration:var(--ds-duration-instant,0ms)}._1wsa1ign{transition-delay:var(--ds-duration-short,.15s)}._1vrh1a5r{transition-behavior:allow-discrete}}
|
|
@@ -21,6 +21,8 @@ var _exitingPersistence = _interopRequireDefault(require("@atlaskit/motion/exiti
|
|
|
21
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
22
|
var _constants = require("./constants");
|
|
23
23
|
var _hoistSlotSizesContext = require("./hoist-slot-sizes-context");
|
|
24
|
+
var _layoutOverlayClearance = require("./layout-overlay-clearance");
|
|
25
|
+
var _mainMinWidthContext = require("./main-min-width-context");
|
|
24
26
|
var _panelSplitter = require("./panel-splitter/panel-splitter");
|
|
25
27
|
var _provider = require("./panel-splitter/provider");
|
|
26
28
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -42,7 +44,8 @@ var styles = {
|
|
|
42
44
|
border: "_191wglyw _16qs130s",
|
|
43
45
|
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
44
46
|
entering: "_k1af1nn1 _12d81gzg _10t81q8v _xrrp147i _1wsa1ign _1vrh1a5r _15et1c5w _105abamb",
|
|
45
|
-
motionUnmeasured: "
|
|
47
|
+
motionUnmeasured: "_15et3aws",
|
|
48
|
+
refinedMotionUnmeasured: "_15etq93i",
|
|
46
49
|
exiting: "_k1af14vv _1lh81gzg _15et1c5w _105aeydr",
|
|
47
50
|
contentEntering: "_y44v1mph",
|
|
48
51
|
contentExiting: "_y44vf1qi",
|
|
@@ -85,6 +88,7 @@ function LocalPanelSurface(_ref2) {
|
|
|
85
88
|
onManagedResizeEnd = _ref2.onManagedResizeEnd,
|
|
86
89
|
onWidthChange = _ref2.onWidthChange,
|
|
87
90
|
onResizeEnd = _ref2.onResizeEnd;
|
|
91
|
+
var mainMinWidth = (0, _react.useContext)(_mainMinWidthContext.MainMinWidthContext);
|
|
88
92
|
var ref = (0, _react.useRef)(null);
|
|
89
93
|
var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
|
|
90
94
|
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
@@ -178,8 +182,14 @@ function LocalPanelSurface(_ref2) {
|
|
|
178
182
|
"data-layout-with-panel-slot": "",
|
|
179
183
|
style: (0, _defineProperty2.default)({}, localPanelVar, "".concat(renderedWidth, "px")),
|
|
180
184
|
ref: mergedRef,
|
|
181
|
-
className: (0, _runtime.ax)([isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && styles.motionUnmeasured, styles.panelWrapper, styles.border, !managedSizing && styles.unmeasured, !managedSizing && (0, _fg.fg)('platform-dst-chat-panel-layout') && styles.refinedUnmeasured, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder])
|
|
182
|
-
},
|
|
185
|
+
className: (0, _runtime.ax)([isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && styles.motionUnmeasured, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && (0, _fg.fg)('platform-dst-chat-panel-layout') && styles.refinedMotionUnmeasured, styles.panelWrapper, styles.border, !managedSizing && styles.unmeasured, !managedSizing && (0, _fg.fg)('platform-dst-chat-panel-layout') && styles.refinedUnmeasured, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder])
|
|
186
|
+
}, !managedSizing && (0, _fg.fg)('platform-dst-chat-panel-layout') &&
|
|
187
|
+
/*#__PURE__*/
|
|
188
|
+
// Keep sibling allocation stable until the exiting surface actually unmounts.
|
|
189
|
+
React.createElement(_layoutOverlayClearance.LayoutOverlayClearance, {
|
|
190
|
+
panelMinWidth: minWidth,
|
|
191
|
+
mainMinWidth: mainMinWidth
|
|
192
|
+
}), /*#__PURE__*/React.createElement(_provider.PanelSplitterProvider, {
|
|
183
193
|
panelId: localPanelSplitterId,
|
|
184
194
|
panelRef: ref,
|
|
185
195
|
resizingElementRef: layoutRef,
|
|
@@ -26,4 +26,5 @@
|
|
|
26
26
|
._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
|
|
27
27
|
._yv0ei47z{grid-template-columns:minmax(0,1fr)}
|
|
28
28
|
@media (prefers-reduced-motion:no-preference){._1croukkr{animation-name:k1p4v4gh}._wqfn147i{animation-duration:var(--ds-duration-instant,0ms)}._sl5p1ign{animation-delay:var(--ds-duration-short,.15s)}._dqw8eoah{animation-fill-mode:backwards}@keyframes k1p4v4gh{0%{grid-template-areas:"main";grid-template-columns:minmax(0,1fr);grid-template-rows:1fr}}}
|
|
29
|
-
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
29
|
+
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
30
|
+
@media (min-width:110.5rem){._1qxn1ykh{--p_lclPnlSsrPreferredW:var(--p_lclPnlXlW)}._13bt1t8m{--p_lclPnlSsrDefaultW:var(--p_lclPnlXlDefaultW)}}
|
|
@@ -13,7 +13,6 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
|
-
var _layoutOverlayClearance = require("./layout-overlay-clearance");
|
|
17
16
|
var _mainMinWidthContext = require("./main-min-width-context");
|
|
18
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
18
|
// The grid uses runtime CSS variables and container sizing outside @atlaskit/css's bounded values.
|
|
@@ -31,7 +30,8 @@ var styles = {
|
|
|
31
30
|
layout: "_1reo1wug _18m91wug _1e0c11p5 _7cca15wb _1lmc1m6a _yv0ei47z _2z05hkll _4t3i1osq _1bsb1osq",
|
|
32
31
|
mainContent: "_nd5l1gzg _1reo1wug _18m91wug _1e0c1txw _4t3i1osq _19121cl4",
|
|
33
32
|
panelUplift: "_1reo15vq _18m915vq",
|
|
34
|
-
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6
|
|
33
|
+
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6",
|
|
34
|
+
unmeasuredWidths: "_129o1uuk _cw8k1fc5 _peezi77x _1tg31owj _1qxn1ykh _13bt1t8m",
|
|
35
35
|
managedInline: "_1uwq15vq _82e815vq _f8374a59 _1l7c1wug _vleg1orf",
|
|
36
36
|
managedOverlay: "_1uwq15vq _82e815vq _f8371m6a _vlegi47z _1l7chkll",
|
|
37
37
|
panelClosed: "_f8371m6a _vlegi47z _1l7chkll"
|
|
@@ -45,6 +45,8 @@ function PanelLayoutShell(_ref) {
|
|
|
45
45
|
isPanelOpen = _ref.isPanelOpen,
|
|
46
46
|
panelWidth = _ref.panelWidth,
|
|
47
47
|
compactPanelWidth = _ref.compactPanelWidth,
|
|
48
|
+
xlPanelWidth = _ref.xlPanelWidth,
|
|
49
|
+
xlDefaultPanelWidth = _ref.xlDefaultPanelWidth,
|
|
48
50
|
defaultPanelWidth = _ref.defaultPanelWidth,
|
|
49
51
|
compactDefaultPanelWidth = _ref.compactDefaultPanelWidth,
|
|
50
52
|
_ref$panelMinWidth = _ref.panelMinWidth,
|
|
@@ -62,18 +64,19 @@ function PanelLayoutShell(_ref) {
|
|
|
62
64
|
var inlineQuery = "@container local-panel-layout (min-width: ".concat(mainMinWidth + panelMinWidth, "px)");
|
|
63
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
66
|
className: (0, _runtime.ax)([styles.container])
|
|
65
|
-
}, mode === undefined &&
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
}, mode === undefined && shouldClipOverflow && (0, _fg.fg)('platform-dst-chat-panel-layout') &&
|
|
68
|
+
/*#__PURE__*/
|
|
69
|
+
// Keep the inline motion cap available during exit, after the open-only track rule is removed.
|
|
70
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Instance-scoped query matches the SSR inline allocation, including caller-defined minimums.
|
|
71
|
+
React.createElement("style", null, "".concat(inlineQuery, " {\n\t\t\t\t\t#").concat(id, " { --p_lclPnlMotionMaxW: calc(100cqw - ").concat(mainMinWidth, "px); }\n\t\t\t\t}")), mode === undefined && isPanelOpen &&
|
|
69
72
|
/*#__PURE__*/
|
|
70
73
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Instance-scoped SSR query supports caller-defined minimums; CSS variables are not allowed in query conditions.
|
|
71
74
|
React.createElement("style", null, "".concat(inlineQuery, " {\n\t\t\t\t\t#").concat(id, " {\n\t\t\t\t\t\t--p_lclPnlSsrAreas: var(--p_lclPnlSsrInlineAreas);\n\t\t\t\t\t\t--p_lclPnlSsrColumns: minmax(0, 1fr) min(var(--p_lclPnlSsrPreferredW), calc(100% - ").concat(mainMinWidth, "px));\n\t\t\t\t\t\t--p_lclPnlSsrArea: panel;\n\t\t\t\t\t\t--p_lclPnlSsrWidth: 100%;\n\t\t\t\t\t\t--p_lclPnlSsrBackground: ", "var(--ds-surface, #FFFFFF)", ";\n\t\t\t\t\t\t--p_lclPnlSsrShadow: none;\n\t\t\t\t\t\t--p_lclPnlSsrBorder: ", "var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";\n\t\t\t\t\t}\n\t\t\t\t}")), /*#__PURE__*/React.createElement("div", {
|
|
72
75
|
id: id,
|
|
73
76
|
"data-testid": testId,
|
|
74
77
|
ref: layoutRef,
|
|
75
|
-
style: (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, localPanelTrackWidthVar, "".concat(panelWidth, "px")), localPanelMinWidthVar, "".concat(panelMinWidth, "px")), '--p_lclPnlCompactW', "".concat(compactPanelWidth, "px")), '--p_lclPnlDefaultW', "".concat(defaultPanelWidth, "px")), '--p_lclPnlCompactDefaultW', "".concat(compactDefaultPanelWidth, "px")),
|
|
76
|
-
className: (0, _runtime.ax)([styles.layout, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, shouldClipOverflow && isPanelOpen && (mode === undefined || mode === 'inline') && styles.panelEntering, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
|
|
78
|
+
style: (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, localPanelTrackWidthVar, "".concat(panelWidth, "px")), localPanelMinWidthVar, "".concat(panelMinWidth, "px")), '--p_lclPnlCompactW', "".concat(compactPanelWidth, "px")), '--p_lclPnlXlW', "".concat(xlPanelWidth, "px")), '--p_lclPnlXlDefaultW', "".concat(xlDefaultPanelWidth, "px")), '--p_lclPnlDefaultW', "".concat(defaultPanelWidth, "px")), '--p_lclPnlCompactDefaultW', "".concat(compactDefaultPanelWidth, "px")),
|
|
79
|
+
className: (0, _runtime.ax)([styles.layout, mode === undefined && styles.unmeasuredWidths, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, shouldClipOverflow && isPanelOpen && (mode === undefined || mode === 'inline') && styles.panelEntering, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
|
|
77
80
|
}, /*#__PURE__*/React.createElement("div", {
|
|
78
81
|
className: (0, _runtime.ax)([styles.mainContent])
|
|
79
82
|
}, children), panel));
|
|
@@ -22,7 +22,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
22
22
|
// Development-only ownership checks are scoped to each coordinator, not the whole page.
|
|
23
23
|
var mountedPanelLayouts = new WeakSet();
|
|
24
24
|
function CoordinatedPanelLayout(_ref) {
|
|
25
|
-
var _ref2, _state$width;
|
|
25
|
+
var _ref2, _ref3, _state$width;
|
|
26
26
|
var children = _ref.children,
|
|
27
27
|
panel = _ref.panel,
|
|
28
28
|
isPanelOpen = _ref.isPanelOpen,
|
|
@@ -30,6 +30,7 @@ function CoordinatedPanelLayout(_ref) {
|
|
|
30
30
|
panelWidth = _ref.panelWidth,
|
|
31
31
|
defaultPanelWidth = _ref.defaultPanelWidth,
|
|
32
32
|
compactDefaultPanelWidth = _ref.compactDefaultPanelWidth,
|
|
33
|
+
xlDefaultPanelWidth = _ref.xlDefaultPanelWidth,
|
|
33
34
|
suppliedMinWidth = _ref.panelMinWidth,
|
|
34
35
|
panelMaxWidth = _ref.panelMaxWidth,
|
|
35
36
|
onPanelWidthChange = _ref.onPanelWidthChange,
|
|
@@ -60,6 +61,9 @@ function CoordinatedPanelLayout(_ref) {
|
|
|
60
61
|
var _useState5 = (0, _react.useState)((_ref2 = compactDefaultPanelWidth !== null && compactDefaultPanelWidth !== void 0 ? compactDefaultPanelWidth : defaultPanelWidth) !== null && _ref2 !== void 0 ? _ref2 : (0, _fg.fg)('platform-dst-chat-panel-layout') ? defaults.compactPanelWidth : panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaults.compactPanelWidth),
|
|
61
62
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 1),
|
|
62
63
|
compactWidth = _useState6[0];
|
|
64
|
+
var _useState7 = (0, _react.useState)((0, _fg.fg)('platform-dst-chat-panel-layout') ? (_ref3 = xlDefaultPanelWidth !== null && xlDefaultPanelWidth !== void 0 ? xlDefaultPanelWidth : defaultPanelWidth) !== null && _ref3 !== void 0 ? _ref3 : 500 : defaultWidth),
|
|
65
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 1),
|
|
66
|
+
xlWidth = _useState8[0];
|
|
63
67
|
// Use the controlled request before measurement too, without changing the mount-time default.
|
|
64
68
|
var fallbackWidth = Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaultWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity));
|
|
65
69
|
var _useLayoutAreaSizing = (0, _useLayoutAreaSizing2.useLayoutAreaSizing)({
|
|
@@ -69,6 +73,7 @@ function CoordinatedPanelLayout(_ref) {
|
|
|
69
73
|
requestedWidth: panelWidth,
|
|
70
74
|
defaultWidth: defaultWidth,
|
|
71
75
|
compactDefaultWidth: compactWidth,
|
|
76
|
+
xlDefaultWidth: xlWidth,
|
|
72
77
|
minWidth: panelMinWidth,
|
|
73
78
|
maxWidth: panelMaxWidth
|
|
74
79
|
}
|
|
@@ -115,6 +120,8 @@ function CoordinatedPanelLayout(_ref) {
|
|
|
115
120
|
isPanelOpen: isPanelOpen,
|
|
116
121
|
panelWidth: (_state$width = state === null || state === void 0 ? void 0 : state.width) !== null && _state$width !== void 0 ? _state$width : fallbackWidth,
|
|
117
122
|
defaultPanelWidth: defaultWidth,
|
|
123
|
+
xlDefaultPanelWidth: xlWidth,
|
|
124
|
+
xlPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : xlWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
|
|
118
125
|
compactDefaultPanelWidth: compactWidth,
|
|
119
126
|
compactPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : compactWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
|
|
120
127
|
panelMinWidth: panelMinWidth,
|
|
@@ -150,6 +157,7 @@ function PanelLayout(props) {
|
|
|
150
157
|
panelWidth: props.panelWidth,
|
|
151
158
|
defaultPanelWidth: props.defaultPanelWidth,
|
|
152
159
|
compactDefaultPanelWidth: props.compactDefaultPanelWidth,
|
|
160
|
+
xlDefaultPanelWidth: props.xlDefaultPanelWidth,
|
|
153
161
|
panelMinWidth: props.panelMinWidth,
|
|
154
162
|
panelMaxWidth: props.panelMaxWidth,
|
|
155
163
|
onPanelWidthChange: props.onPanelWidthChange,
|
|
@@ -14,6 +14,7 @@ function useLayoutAreaSizing(_ref) {
|
|
|
14
14
|
var requestedWidth = config.requestedWidth,
|
|
15
15
|
defaultWidth = config.defaultWidth,
|
|
16
16
|
compactDefaultWidth = config.compactDefaultWidth,
|
|
17
|
+
xlDefaultWidth = config.xlDefaultWidth,
|
|
17
18
|
minWidth = config.minWidth,
|
|
18
19
|
maxWidth = config.maxWidth,
|
|
19
20
|
isOpen = config.isOpen,
|
|
@@ -40,12 +41,13 @@ function useLayoutAreaSizing(_ref) {
|
|
|
40
41
|
requestedWidth: requestedWidth,
|
|
41
42
|
defaultWidth: defaultWidth,
|
|
42
43
|
compactDefaultWidth: compactDefaultWidth,
|
|
44
|
+
xlDefaultWidth: xlDefaultWidth,
|
|
43
45
|
minWidth: minWidth,
|
|
44
46
|
maxWidth: maxWidth,
|
|
45
47
|
isOpen: isOpen,
|
|
46
48
|
onRequestClose: requestClose
|
|
47
49
|
});
|
|
48
|
-
}, [area, compactDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
50
|
+
}, [area, compactDefaultWidth, xlDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
49
51
|
(0, _react.useEffect)(function () {
|
|
50
52
|
return function () {
|
|
51
53
|
return unregisterArea === null || unregisterArea === void 0 ? void 0 : unregisterArea(area);
|
|
@@ -7,14 +7,18 @@ function clampTargetWidth({
|
|
|
7
7
|
}) {
|
|
8
8
|
return Math.max(min, Math.min(target, max));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
var _area$compactDefaultW, _area$
|
|
12
|
-
|
|
10
|
+
function getDefaultWidth(area, isCompact, isXlViewport) {
|
|
11
|
+
var _area$compactDefaultW, _area$xlDefaultWidth;
|
|
12
|
+
return isCompact ? (_area$compactDefaultW = area.compactDefaultWidth) !== null && _area$compactDefaultW !== void 0 ? _area$compactDefaultW : area.defaultWidth : isXlViewport ? (_area$xlDefaultWidth = area.xlDefaultWidth) !== null && _area$xlDefaultWidth !== void 0 ? _area$xlDefaultWidth : area.defaultWidth : area.defaultWidth;
|
|
13
|
+
}
|
|
14
|
+
function getTargetWidth(area, isSideNavOverlay, isXlViewport) {
|
|
15
|
+
var _area$liveResize, _ref, _area$requestedWidth;
|
|
16
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
13
17
|
return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredWidth) !== null && _ref !== void 0 ? _ref : defaultWidth;
|
|
14
18
|
}
|
|
15
|
-
function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
|
|
16
|
-
var _area$
|
|
17
|
-
const defaultWidth =
|
|
19
|
+
function getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName) {
|
|
20
|
+
var _area$liveResize2, _ref2, _area$requestedWidth2;
|
|
21
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
18
22
|
return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref2 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : areaName === 'panel' ? area.preferredWidth : area.preferredOverlayWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
|
|
19
23
|
}
|
|
20
24
|
export function calculateLayoutAreaStates({
|
|
@@ -22,6 +26,7 @@ export function calculateLayoutAreaStates({
|
|
|
22
26
|
layoutWidth = viewportWidth,
|
|
23
27
|
isChatPanelOverlay,
|
|
24
28
|
isSideNavOverlay,
|
|
29
|
+
isXlViewport = false,
|
|
25
30
|
occupiedWidth = 0,
|
|
26
31
|
mainMinWidth: mainMinWidthBound,
|
|
27
32
|
areas,
|
|
@@ -45,7 +50,7 @@ export function calculateLayoutAreaStates({
|
|
|
45
50
|
// A growing panel cascades towards inline-start. Chat is on the other side
|
|
46
51
|
// of the local rail, so local growth must reserve its full starting width.
|
|
47
52
|
const shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
|
|
48
|
-
target: getTargetWidth(resizingArea, isSideNavOverlay),
|
|
53
|
+
target: getTargetWidth(resizingArea, isSideNavOverlay, isXlViewport),
|
|
49
54
|
min: resolveLayoutWidth(resizingArea.minWidth, viewportWidth),
|
|
50
55
|
max: resizingArea.maxWidth !== undefined ? resolveLayoutWidth(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
|
|
51
56
|
}) > availableWidth - mainMinWidth - sideNavMinWidth - (resizeSession.area === 'panel' ? resizeSession.baselineWidths['chat-panel'] !== undefined ? (_baselineWidths$chat = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths['chat-panel']) !== null && _baselineWidths$chat !== void 0 ? _baselineWidths$chat : chatPanelMinWidth : 0 : resizeSession.baselineWidths.panel !== undefined ? panelMinWidth : 0));
|
|
@@ -78,7 +83,7 @@ export function calculateLayoutAreaStates({
|
|
|
78
83
|
const min = resolveLayoutWidth(area.minWidth, viewportWidth);
|
|
79
84
|
const max = area.maxWidth ? resolveLayoutWidth(area.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY;
|
|
80
85
|
const baselineWidth = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths[areaName];
|
|
81
|
-
const requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay) : getTargetWidth(area, isSideNavOverlay);
|
|
86
|
+
const requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay, isXlViewport) : getTargetWidth(area, isSideNavOverlay, isXlViewport);
|
|
82
87
|
const target = clampTargetWidth({
|
|
83
88
|
target: requestedTarget,
|
|
84
89
|
min,
|
|
@@ -124,12 +129,12 @@ export function calculateLayoutAreaStates({
|
|
|
124
129
|
overflow -= reduction;
|
|
125
130
|
}
|
|
126
131
|
if (hasPanelClearance && panel) {
|
|
127
|
-
var
|
|
132
|
+
var _widths$get5, _widths$get6;
|
|
128
133
|
// Opening/viewport fitting gives up SideNav width before Chat. During a
|
|
129
134
|
// panel drag only SideNav yields; Chat retains its starting width.
|
|
130
135
|
const isPanelResize = (resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.area) === 'panel';
|
|
131
|
-
const desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
132
|
-
const overlayDefault =
|
|
136
|
+
const desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, isXlViewport, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
137
|
+
const overlayDefault = getDefaultWidth(panel, isSideNavOverlay, isXlViewport);
|
|
133
138
|
const reservedMainWidth = isPanelResize ? Math.max(effectiveMainMinWidth, desiredPanelWidth + 32,
|
|
134
139
|
// Above the default, Main must also fit the panel within its 90% cap.
|
|
135
140
|
desiredPanelWidth > overlayDefault ? desiredPanelWidth / 0.9 : 0) : effectiveMainMinWidth;
|
|
@@ -166,7 +171,7 @@ export function calculateLayoutAreaStates({
|
|
|
166
171
|
const inlineChatPanelWidth = (_states$chatPanel$wi = (_states$chatPanel = states['chat-panel']) === null || _states$chatPanel === void 0 ? void 0 : _states$chatPanel.width) !== null && _states$chatPanel$wi !== void 0 ? _states$chatPanel$wi : 0;
|
|
167
172
|
const mainAreaWidth = Math.max(0, availableWidth - inlineSideNavWidth - inlineChatPanelWidth);
|
|
168
173
|
for (const areaName of ['side-nav', 'panel', 'chat-panel']) {
|
|
169
|
-
var _states$areaName
|
|
174
|
+
var _states$areaName;
|
|
170
175
|
const area = areas[areaName];
|
|
171
176
|
if (!(area !== null && area !== void 0 && area.isOpen) || ((_states$areaName = states[areaName]) === null || _states$areaName === void 0 ? void 0 : _states$areaName.mode) === 'inline' || areaName === 'side-nav' && shouldCollapseSideNav) {
|
|
172
177
|
continue;
|
|
@@ -176,11 +181,11 @@ export function calculateLayoutAreaStates({
|
|
|
176
181
|
// Chat covers Root; SideNav and the local panel overlay Main's grid track.
|
|
177
182
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
178
183
|
const layoutMax = (areaName === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
179
|
-
const defaultWidth =
|
|
184
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
180
185
|
const overlayMax = isRefinedLayout && areaName === 'panel' ? hasPanelClearance ? Math.min(availableWidth - sideNavMinWidth - inlineChatPanelWidth - 32, Math.max(defaultWidth, (availableWidth - sideNavMinWidth - inlineChatPanelWidth) * 0.9)) : Math.min(mainAreaWidth, Math.max(defaultWidth, layoutMax)) : isRefinedLayout && areaName === 'chat-panel' ? Math.min(layoutWidth, Math.max(defaultWidth, layoutMax)) : layoutMax;
|
|
181
186
|
const max = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? Math.max(min, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
182
187
|
const effectiveMin = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? min : Math.min(min, max);
|
|
183
|
-
const target = getOverlayTargetWidth(area, isSideNavOverlay, areaName);
|
|
188
|
+
const target = getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName);
|
|
184
189
|
const width = clampTargetWidth({
|
|
185
190
|
target,
|
|
186
191
|
min: effectiveMin,
|
|
@@ -62,6 +62,7 @@ export function LayoutAreaSizingProvider({
|
|
|
62
62
|
}, []);
|
|
63
63
|
const mainMinWidth = useRef(defaultMainMinWidth);
|
|
64
64
|
const loadRef = useRef(() => {});
|
|
65
|
+
const viewportWidthAtLoad = useRef();
|
|
65
66
|
const ready = useRef(false);
|
|
66
67
|
const waiting = useRef([]);
|
|
67
68
|
const pending = useRef([]);
|
|
@@ -87,6 +88,7 @@ export function LayoutAreaSizingProvider({
|
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
loading = true;
|
|
91
|
+
viewportWidthAtLoad.current = window.innerWidth;
|
|
90
92
|
void import( /* webpackChunkName: "@atlaskit-internal_navigation-layout-sizing" */'./layout-area-sizing-runtime').then(({
|
|
91
93
|
LayoutAreaSizingRuntime
|
|
92
94
|
}) => {
|
|
@@ -221,6 +223,7 @@ export function LayoutAreaSizingProvider({
|
|
|
221
223
|
}, children))), Runtime && /*#__PURE__*/React.createElement(Runtime, {
|
|
222
224
|
layoutRef: layoutRef,
|
|
223
225
|
onReady: onReady,
|
|
224
|
-
onUpdate: onUpdate
|
|
226
|
+
onUpdate: onUpdate,
|
|
227
|
+
viewportWidthAtLoad: viewportWidthAtLoad.current
|
|
225
228
|
}));
|
|
226
229
|
}
|