@atlaskit/navigation-system 11.7.1 → 11.7.2

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlassian/navigation-system
2
2
 
3
+ ## 11.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`aa82f87964406`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa82f87964406) -
8
+ Fix desktop SideNav retention, continuous panel-to-chat resizing, compact Chat defaults and
9
+ overlay opening order behind platform-dst-chat-panel-layout.
10
+
3
11
  ## 11.7.1
4
12
 
5
13
  ### Patch Changes
@@ -28,7 +28,7 @@ function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
28
28
  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
29
  }
30
30
  function calculateLayoutAreaStates(_ref4) {
31
- var _ref5, _resizeSession$overla, _resizeSession$overla2, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
31
+ var _ref5, _resizeSession$overla, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
32
32
  var viewportWidth = _ref4.viewportWidth,
33
33
  _ref4$layoutWidth = _ref4.layoutWidth,
34
34
  layoutWidth = _ref4$layoutWidth === void 0 ? viewportWidth : _ref4$layoutWidth,
@@ -55,12 +55,12 @@ function calculateLayoutAreaStates(_ref4) {
55
55
  var layoutModes = (_resizeSession$overla = resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.overlayModes) !== null && _resizeSession$overla !== void 0 ? _resizeSession$overla : initialModes;
56
56
  // A growing panel cascades towards inline-start. Chat is on the other side
57
57
  // of the local rail, so local growth must reserve its full starting width.
58
- var shouldCollapseSideNav = Boolean(resizeSession && resizeSession.area !== 'side-nav' && !(isRefinedLayout && ((_resizeSession$overla2 = resizeSession.overlayModes) === null || _resizeSession$overla2 === void 0 ? void 0 : _resizeSession$overla2.panel) === 'overlay' && resizeSession.area === 'panel') && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
58
+ var shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
59
59
  target: getTargetWidth(resizingArea, isSideNavOverlay),
60
60
  min: (0, _resolveLayoutWidth.resolveLayoutWidth)(resizingArea.minWidth, viewportWidth),
61
61
  max: resizingArea.maxWidth !== undefined ? (0, _resolveLayoutWidth.resolveLayoutWidth)(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
62
62
  }) > 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));
63
- var isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
63
+ var isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (isRefinedLayout ? !isSideNavOverlay : layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
64
64
  var canInlineChat = function canInlineChat() {
65
65
  return Boolean((chatPanel === null || chatPanel === void 0 ? void 0 : chatPanel.isOpen) && (!resizeSession || resizeSession.baselineWidths['chat-panel'] !== undefined) && (layoutModes ? layoutModes['chat-panel'] === 'inline' : !isChatPanelOverlay && availableWidth >= mainMinWidth + chatPanelMinWidth + (isSideNavOpenInline ? sideNavMinWidth : 0)));
66
66
  };
@@ -75,12 +75,6 @@ function calculateLayoutAreaStates(_ref4) {
75
75
  // both siblings reach minimum. Move Chat to overlay, then recheck local.
76
76
  isChatPanelOpenInline = false;
77
77
  isPanelInline = canInlinePanel();
78
- if (!isPanelInline && availableWidth < overlayMainMinWidth + sideNavMinWidth) {
79
- // A constrained Root may not fit even navigation beside local's overlay.
80
- isSideNavOpenInline = false;
81
- isChatPanelOpenInline = canInlineChat();
82
- isPanelInline = canInlinePanel();
83
- }
84
78
  }
85
79
 
86
80
  // The clearance belongs to Main only while local overlays an inline SideNav.
@@ -207,7 +201,7 @@ function calculateLayoutAreaStates(_ref4) {
207
201
  min: min,
208
202
  max: Math.max(min, Math.min(configuredMax, availableWidth - effectiveMainMinWidth - inlineAreas.reduce(function (total, sibling) {
209
203
  var _widths$get9, _minimums$get4;
210
- return sibling === areaName || sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
204
+ return sibling === areaName || !isRefinedLayout && sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
211
205
  }, 0)))
212
206
  }
213
207
  };
@@ -98,14 +98,18 @@ function ChatPanel(_ref) {
98
98
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
99
99
  inlineWidth = _useState2[0],
100
100
  setInlineWidth = _useState2[1];
101
- var _useState3 = (0, _react.useState)(compactDefaultWidth),
101
+ var _useState3 = (0, _react.useState)(false),
102
102
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
103
- overlayWidth = _useState4[0],
104
- setOverlayWidth = _useState4[1];
105
- var _useState5 = (0, _react.useState)(false),
103
+ hasInlinePreference = _useState4[0],
104
+ setHasInlinePreference = _useState4[1];
105
+ var _useState5 = (0, _react.useState)(compactDefaultWidth),
106
106
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
107
- isInline = _useState6[0],
108
- setIsInline = _useState6[1];
107
+ overlayWidth = _useState6[0],
108
+ setOverlayWidth = _useState6[1];
109
+ var _useState7 = (0, _react.useState)(false),
110
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
111
+ isInline = _useState8[0],
112
+ setIsInline = _useState8[1];
109
113
  var _useLayoutAreaSizing = (0, _useLayoutAreaSizing2.useLayoutAreaSizing)({
110
114
  area: 'chat-panel',
111
115
  config: {
@@ -183,6 +187,7 @@ function ChatPanel(_ref) {
183
187
  var onCompleteResize = (0, _react.useCallback)(function (finalWidth) {
184
188
  if (mode === 'inline') {
185
189
  setInlineWidth(finalWidth);
190
+ setHasInlinePreference(true);
186
191
  } else {
187
192
  setOverlayWidth(finalWidth);
188
193
  }
@@ -208,7 +213,7 @@ function ChatPanel(_ref) {
208
213
  // Hoist the committed or actively resizing inline width so SideNav can yield
209
214
  // space to ChatPanel without allowing the page layout to overflow.
210
215
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
211
- React.createElement("style", null, managedSizing ? "\n#".concat(_root.gridRootId, " { --n_chatTrack: ").concat(mode === 'inline' ? "".concat(renderedWidth, "px") : '0px', "; ").concat(_constants.chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n") : "\n#".concat(_root.gridRootFitId, " { --n_clearanceChatMin: ").concat(minWidth, "; --n_clearanceChatTarget: ").concat(chatPanelVariableWidth, "; }\n#").concat(_root.gridRootId, " { --n_chatTrack: 0px; ").concat(_constants.chatPanelLiveWidthVar, ": 0px; }\n#").concat(_root.gridRootId, " [data-layout-chat-panel] {\n grid-area: 2 / 1 / -1 / -1;\n width: min(calc(var(--n_layoutW) * 0.9), ").concat(chatPanelOverlayVariableWidth, ");\n z-index: ").concat(_constants.localSlotLayers.chatPanelOverlay, ";\n background-color: ", "var(--ds-surface-overlay, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: ".concat("var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-start: none;") : '', "\n}\n@media (min-width: 40rem) {\n @container navigation-chat-space (min-width: ").concat(minWidth, ") {\n #").concat(_root.gridRootId, " { --n_chatTrack: min(100cqw, var(").concat(panelSplitterResizingVar, ", ").concat(chatPanelVariableWidth, ")); ").concat(_constants.chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n #").concat(_root.gridRootId, " [data-layout-chat-panel] {\n grid-area: chat-panel;\n width: min(100cqw, var(").concat(panelSplitterResizingVar, ", ").concat(chatPanelVariableWidth, "));\n z-index: auto;\n background-color: ", "var(--ds-surface, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: initial; border-inline-start: ".concat("var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";") : '', "\n }\n }\n}\n")), /*#__PURE__*/React.createElement(_provider.PanelSplitterProvider, {
216
+ React.createElement("style", null, managedSizing ? "\n#".concat(_root.gridRootId, " { --n_chatTrack: ").concat(mode === 'inline' ? "".concat(renderedWidth, "px") : '0px', "; ").concat(_constants.chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n") : "\n#".concat(_root.gridRootFitId, " { --n_chatPreferredW: ").concat((0, _fg.fg)('platform-dst-chat-panel-layout') && !hasInlinePreference ? "clamp(".concat(minWidth, ", ").concat(compactDefaultWidth, "px, ").concat(configuredMaxWidth, ")") : chatPanelVariableWidth, "; --n_clearanceChatMin: ").concat(minWidth, "; --n_clearanceChatTarget: var(--n_chatPreferredW); }\n@media (min-width: 64rem) {\n #").concat(_root.gridRootFitId, " { --n_chatPreferredW: ").concat(chatPanelVariableWidth, "; }\n}\n#").concat(_root.gridRootId, " { --n_chatTrack: 0px; ").concat(_constants.chatPanelLiveWidthVar, ": 0px; }\n#").concat(_root.gridRootId, " [data-layout-chat-panel] {\n grid-area: 2 / 1 / -1 / -1;\n width: min(calc(var(--n_layoutW) * 0.9), ").concat(chatPanelOverlayVariableWidth, ");\n z-index: ").concat(_constants.localSlotLayers.chatPanelOverlay, ";\n background-color: ", "var(--ds-surface-overlay, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: ".concat("var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-start: none;") : '', "\n}\n@media (min-width: 40rem) {\n @container navigation-chat-space (min-width: ").concat(minWidth, ") {\n #").concat(_root.gridRootId, " { --n_chatTrack: min(100cqw, var(").concat(panelSplitterResizingVar, ", var(--n_chatPreferredW))); ").concat(_constants.chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n #").concat(_root.gridRootId, " [data-layout-chat-panel] {\n grid-area: chat-panel;\n width: min(100cqw, var(").concat(panelSplitterResizingVar, ", var(--n_chatPreferredW)));\n z-index: auto;\n background-color: ", "var(--ds-surface, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: initial; border-inline-start: ".concat("var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";") : '', "\n }\n }\n}\n")), /*#__PURE__*/React.createElement(_provider.PanelSplitterProvider, {
212
217
  panelId: chatPanelPanelSplitterId,
213
218
  panelRef: ref,
214
219
  panelWidth: renderedWidth,
@@ -37,27 +37,26 @@ function LayoutAreaSizingProvider(_ref) {
37
37
  setStates = _useState4[1];
38
38
  var actions = (0, _react.useRef)(null);
39
39
  var configs = (0, _react.useRef)({});
40
- var _useState5 = (0, _react.useState)(null),
40
+ var lastOpenedOverlay = (0, _react.useRef)(null);
41
+ var _useState5 = (0, _react.useState)(0),
41
42
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
42
- lastOpenedOverlay = _useState6[0],
43
- setLastOpenedOverlay = _useState6[1];
44
- var _useState7 = (0, _react.useState)(0),
45
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
46
- configRevision = _useState8[0],
47
- setConfigRevision = _useState8[1];
43
+ configRevision = _useState6[0],
44
+ setConfigRevision = _useState6[1];
48
45
  var cssModes = (0, _useCssLayoutAreaStates.useCssLayoutAreaStates)(layoutRef, configRevision, Runtime === null);
49
46
  var sideNavMode = (_states$sideNav$mode = (_states$sideNav = states['side-nav']) === null || _states$sideNav === void 0 ? void 0 : _states$sideNav.mode) !== null && _states$sideNav$mode !== void 0 ? _states$sideNav$mode : cssModes['side-nav'];
50
47
  var chatPanelMode = (_states$chatPanel$mo = (_states$chatPanel = states['chat-panel']) === null || _states$chatPanel === void 0 ? void 0 : _states$chatPanel.mode) !== null && _states$chatPanel$mo !== void 0 ? _states$chatPanel$mo : cssModes['chat-panel'];
51
48
 
52
49
  // Overlay dismissal is available before the sizing chunk loads. Keep the open
53
50
  // order here too: replaying registrations into the runtime loses that order.
51
+ // Read the order from the same registration snapshot as configs, even when a
52
+ // child registers a newly opened overlay before this commit's effect runs.
54
53
  (0, _react.useEffect)(function () {
55
54
  var inlineChatQuery = window.matchMedia('(min-width: 40rem)');
56
55
  var dismissOlderOverlay = function dismissOlderOverlay() {
57
56
  var _olderOverlay$onReque;
58
57
  var sideNav = configs.current['side-nav'];
59
58
  var chatPanel = configs.current['chat-panel'];
60
- if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay) {
59
+ if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay.current) {
61
60
  return;
62
61
  }
63
62
  // Before allocation, CSS puts both areas in overlay below 40rem. Once
@@ -65,7 +64,7 @@ function LayoutAreaSizingProvider(_ref) {
65
64
  if (inlineChatQuery.matches && (sideNavMode !== 'overlay' || chatPanelMode !== 'overlay')) {
66
65
  return;
67
66
  }
68
- var olderOverlay = lastOpenedOverlay === 'side-nav' ? chatPanel : sideNav;
67
+ var olderOverlay = lastOpenedOverlay.current === 'side-nav' ? chatPanel : sideNav;
69
68
  (_olderOverlay$onReque = olderOverlay.onRequestClose) === null || _olderOverlay$onReque === void 0 || _olderOverlay$onReque.call(olderOverlay);
70
69
  };
71
70
  dismissOlderOverlay();
@@ -73,7 +72,7 @@ function LayoutAreaSizingProvider(_ref) {
73
72
  type: 'change',
74
73
  listener: dismissOlderOverlay
75
74
  });
76
- }, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
75
+ }, [chatPanelMode, configRevision, sideNavMode]);
77
76
  var splitters = (0, _react.useRef)(new Set());
78
77
  var registerSplitter = (0, _react.useCallback)(function (element) {
79
78
  splitters.current.add(element);
@@ -258,7 +257,7 @@ function LayoutAreaSizingProvider(_ref) {
258
257
  registerArea: function registerArea(area, config) {
259
258
  var _configs$current$area, _actions$current;
260
259
  if (area !== 'panel' && config.isOpen && !((_configs$current$area = configs.current[area]) !== null && _configs$current$area !== void 0 && _configs$current$area.isOpen)) {
261
- setLastOpenedOverlay(area);
260
+ lastOpenedOverlay.current = area;
262
261
  }
263
262
  configs.current[area] = config;
264
263
  setConfigRevision(function (revision) {
@@ -48,7 +48,7 @@ function LayoutOverlayClearance(_ref) {
48
48
  var withChat = "".concat(root, ":has(> [data-layout-chat-panel])");
49
49
  // React 18 escapes comparison operators in style children during SSR. The
50
50
  // stylesheet contains only internal selectors/tokens and numeric width props.
51
- var css = "@media (min-width: 64rem) {\n@container navigation-panel-nav-space (width < ".concat(extra + 1, "px) {\n").concat(fit, " { --n_fitNav: 0px; }\n").concat(root, " > nav[data-layout-slot] { grid-area: main; width: min(90%, ").concat(navTarget, "); background-color: ", "var(--ds-surface-overlay, #FFFFFF)", "; box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-end: none; }\n}\n@container navigation-panel-nav-space (width >= ").concat(extra + 1, "px) {\n @container navigation-panel-chat-space (width < ").concat(panelMinWidth + 1, "px) {\n ").concat(fit, " { --n_fitNav: calc(").concat(navMin, " + ").concat(extra, "px); }\n }\n}\n").concat(rule(false, withoutChat), "\n").concat(inlineRule(false, withoutChat), "\n@container navigation-panel-chat-space (width < ").concat(extra + 1, "px) {\n").concat(rule(false, withChat), "\n").concat(inlineRule(false, withChat), "\n}\n").concat(rule(true, withChat), "\n").concat(inlineRule(true, withChat), "\n").concat(inlineWithoutNav("#".concat(_root.gridRootId, ":not(:has(> nav[data-layout-side-nav-open]))")), "\n}\n@media (min-width: 40rem) and (width < 64rem) {\n").concat(inlineWithoutNav("#".concat(_root.gridRootId, ":has(> [data-layout-chat-panel])")), "\n}");
51
+ var css = "@media (min-width: 64rem) {\n@container navigation-panel-nav-space (width < ".concat(extra + 1, "px) {\n").concat(root, " > nav[data-layout-slot] { width: ").concat(navMin, "; }\n}\n@container navigation-panel-nav-space (width >= ").concat(extra + 1, "px) {\n @container navigation-panel-chat-space (width < ").concat(panelMinWidth + 1, "px) {\n ").concat(fit, " { --n_fitNav: calc(").concat(navMin, " + ").concat(extra, "px); }\n }\n}\n").concat(rule(false, withoutChat), "\n").concat(inlineRule(false, withoutChat), "\n@container navigation-panel-chat-space (width < ").concat(extra + 1, "px) {\n").concat(rule(false, withChat), "\n").concat(inlineRule(false, withChat), "\n}\n").concat(rule(true, withChat), "\n").concat(inlineRule(true, withChat), "\n").concat(inlineWithoutNav("#".concat(_root.gridRootId, ":not(:has(> nav[data-layout-side-nav-open]))")), "\n}\n@media (min-width: 40rem) and (width < 64rem) {\n").concat(inlineWithoutNav("#".concat(_root.gridRootId, ":has(> [data-layout-chat-panel])")), "\n}");
52
52
  return (
53
53
  /*#__PURE__*/
54
54
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, react/no-danger -- Root-scoped, internally generated CSS must retain query operators during SSR.
@@ -332,7 +332,10 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
332
332
  if (onResizeInternal) {
333
333
  // The allocator needs below-minimum requests for the local-to-chat cascade.
334
334
  var currentBounds = getResizeBounds();
335
- var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : (0, _convertResizeBoundToPixels.convertResizeBoundToPixels)(currentBounds.max)));
335
+ var width = Math.max(
336
+ // A negative local request represents drag distance passed on to Chat.
337
+ // The allocator clamps actual panel widths to their minimums.
338
+ prepareResize ? Number.NEGATIVE_INFINITY : 0, Math.min(targetWidth, prepareResize ? window.innerWidth : (0, _convertResizeBoundToPixels.convertResizeBoundToPixels)(currentBounds.max)));
336
339
  if (width !== lastManagedResizeWidth) {
337
340
  lastManagedResizeWidth = width;
338
341
  onResizeInternal(width);
@@ -1007,7 +1007,7 @@ function SideNavInternal(_ref4) {
1007
1007
  /*#__PURE__*/
1008
1008
  // CSS reserves only the nav minimum for chat's fit decision, before effects or lazy loading.
1009
1009
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
1010
- _react.default.createElement("style", null, "\n#".concat(_root.gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(_root.gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(_root.gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n @container navigation-main-space (min-width: ").concat(minWidth, ") {\n #").concat(_root.gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: side-nav; width: min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px))); }") : '', "\n }\n}\n")), /*#__PURE__*/_react.default.createElement(_dangerouslyHoistCssVarToDocumentRoot.DangerouslyHoistCssVarToDocumentRoot, {
1010
+ _react.default.createElement("style", null, "\n#".concat(_root.gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(_root.gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(_root.gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n #").concat(_root.gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: side-nav; width: max(").concat(minWidth, ", min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px)))); }") : '', "\n}\n")), /*#__PURE__*/_react.default.createElement(_dangerouslyHoistCssVarToDocumentRoot.DangerouslyHoistCssVarToDocumentRoot, {
1011
1011
  variableName: _constants.sideNavLiveWidthVar,
1012
1012
  value: "0px",
1013
1013
  mediaQuery: '@media (min-width: 64rem)',
@@ -28,7 +28,7 @@ export function calculateLayoutAreaStates({
28
28
  resizeSession,
29
29
  initialModes
30
30
  }) {
31
- var _ref3, _resizeSession$overla, _resizeSession$overla2, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
31
+ var _ref3, _resizeSession$overla, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
32
32
  const mainMinWidth = resolveLayoutWidth(mainMinWidthBound, viewportWidth);
33
33
  const isRefinedLayout = fg('platform-dst-chat-panel-layout');
34
34
  const availableWidth = Math.max(0, layoutWidth - occupiedWidth);
@@ -44,12 +44,12 @@ export function calculateLayoutAreaStates({
44
44
  const layoutModes = (_resizeSession$overla = resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.overlayModes) !== null && _resizeSession$overla !== void 0 ? _resizeSession$overla : initialModes;
45
45
  // A growing panel cascades towards inline-start. Chat is on the other side
46
46
  // of the local rail, so local growth must reserve its full starting width.
47
- const shouldCollapseSideNav = Boolean(resizeSession && resizeSession.area !== 'side-nav' && !(isRefinedLayout && ((_resizeSession$overla2 = resizeSession.overlayModes) === null || _resizeSession$overla2 === void 0 ? void 0 : _resizeSession$overla2.panel) === 'overlay' && resizeSession.area === 'panel') && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
47
+ const shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
48
48
  target: getTargetWidth(resizingArea, isSideNavOverlay),
49
49
  min: resolveLayoutWidth(resizingArea.minWidth, viewportWidth),
50
50
  max: resizingArea.maxWidth !== undefined ? resolveLayoutWidth(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
51
51
  }) > 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));
52
- let isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
52
+ const isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (isRefinedLayout ? !isSideNavOverlay : layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
53
53
  const canInlineChat = () => Boolean((chatPanel === null || chatPanel === void 0 ? void 0 : chatPanel.isOpen) && (!resizeSession || resizeSession.baselineWidths['chat-panel'] !== undefined) && (layoutModes ? layoutModes['chat-panel'] === 'inline' : !isChatPanelOverlay && availableWidth >= mainMinWidth + chatPanelMinWidth + (isSideNavOpenInline ? sideNavMinWidth : 0)));
54
54
  let isChatPanelOpenInline = canInlineChat();
55
55
  const canInlinePanel = () => Boolean((panel === null || panel === void 0 ? void 0 : panel.isOpen) && (!resizeSession || resizeSession.baselineWidths.panel !== undefined) && (layoutModes ? layoutModes.panel === 'inline' : availableWidth >= mainMinWidth + panelMinWidth + (isChatPanelOpenInline ? chatPanelMinWidth : 0) + (isSideNavOpenInline ? sideNavMinWidth : 0)));
@@ -60,12 +60,6 @@ export function calculateLayoutAreaStates({
60
60
  // both siblings reach minimum. Move Chat to overlay, then recheck local.
61
61
  isChatPanelOpenInline = false;
62
62
  isPanelInline = canInlinePanel();
63
- if (!isPanelInline && availableWidth < overlayMainMinWidth + sideNavMinWidth) {
64
- // A constrained Root may not fit even navigation beside local's overlay.
65
- isSideNavOpenInline = false;
66
- isChatPanelOpenInline = canInlineChat();
67
- isPanelInline = canInlinePanel();
68
- }
69
63
  }
70
64
 
71
65
  // The clearance belongs to Main only while local overlays an inline SideNav.
@@ -163,7 +157,7 @@ export function calculateLayoutAreaStates({
163
157
  min,
164
158
  max: Math.max(min, Math.min(configuredMax, availableWidth - effectiveMainMinWidth - inlineAreas.reduce((total, sibling) => {
165
159
  var _widths$get9, _minimums$get4;
166
- return sibling === areaName || sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
160
+ return sibling === areaName || !isRefinedLayout && sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
167
161
  }, 0)))
168
162
  }
169
163
  };
@@ -81,6 +81,7 @@ export function ChatPanel({
81
81
  });
82
82
  const ref = useRef(null);
83
83
  const [inlineWidth, setInlineWidth] = useState(defaultWidth);
84
+ const [hasInlinePreference, setHasInlinePreference] = useState(false);
84
85
  const [overlayWidth, setOverlayWidth] = useState(compactDefaultWidth);
85
86
  const [isInline, setIsInline] = useState(false);
86
87
  const {
@@ -161,6 +162,7 @@ export function ChatPanel({
161
162
  const onCompleteResize = useCallback(finalWidth => {
162
163
  if (mode === 'inline') {
163
164
  setInlineWidth(finalWidth);
165
+ setHasInlinePreference(true);
164
166
  } else {
165
167
  setOverlayWidth(finalWidth);
166
168
  }
@@ -192,7 +194,10 @@ export function ChatPanel({
192
194
  React.createElement("style", null, managedSizing ? `
193
195
  #${gridRootId} { --n_chatTrack: ${mode === 'inline' ? `${renderedWidth}px` : '0px'}; ${chatPanelLiveWidthVar}: var(--n_chatTrack); }
194
196
  ` : `
195
- #${gridRootFitId} { --n_clearanceChatMin: ${minWidth}; --n_clearanceChatTarget: ${chatPanelVariableWidth}; }
197
+ #${gridRootFitId} { --n_chatPreferredW: ${fg('platform-dst-chat-panel-layout') && !hasInlinePreference ? `clamp(${minWidth}, ${compactDefaultWidth}px, ${configuredMaxWidth})` : chatPanelVariableWidth}; --n_clearanceChatMin: ${minWidth}; --n_clearanceChatTarget: var(--n_chatPreferredW); }
198
+ @media (min-width: 64rem) {
199
+ #${gridRootFitId} { --n_chatPreferredW: ${chatPanelVariableWidth}; }
200
+ }
196
201
  #${gridRootId} { --n_chatTrack: 0px; ${chatPanelLiveWidthVar}: 0px; }
197
202
  #${gridRootId} [data-layout-chat-panel] {
198
203
  grid-area: 2 / 1 / -1 / -1;
@@ -203,10 +208,10 @@ export function ChatPanel({
203
208
  }
204
209
  @media (min-width: 40rem) {
205
210
  @container navigation-chat-space (min-width: ${minWidth}) {
206
- #${gridRootId} { --n_chatTrack: min(100cqw, var(${panelSplitterResizingVar}, ${chatPanelVariableWidth})); ${chatPanelLiveWidthVar}: var(--n_chatTrack); }
211
+ #${gridRootId} { --n_chatTrack: min(100cqw, var(${panelSplitterResizingVar}, var(--n_chatPreferredW))); ${chatPanelLiveWidthVar}: var(--n_chatTrack); }
207
212
  #${gridRootId} [data-layout-chat-panel] {
208
213
  grid-area: chat-panel;
209
- width: min(100cqw, var(${panelSplitterResizingVar}, ${chatPanelVariableWidth}));
214
+ width: min(100cqw, var(${panelSplitterResizingVar}, var(--n_chatPreferredW)));
210
215
  z-index: auto;
211
216
  background-color: ${"var(--ds-surface, #FFFFFF)"};
212
217
  ${hasBorder ? `box-shadow: initial; border-inline-start: ${"var(--ds-border-width, 1px)"} solid ${"var(--ds-border, #0B120E24)"};` : ''}
@@ -20,7 +20,7 @@ export function LayoutAreaSizingProvider({
20
20
  const [states, setStates] = useState({});
21
21
  const actions = useRef(null);
22
22
  const configs = useRef({});
23
- const [lastOpenedOverlay, setLastOpenedOverlay] = useState(null);
23
+ const lastOpenedOverlay = useRef(null);
24
24
  const [configRevision, setConfigRevision] = useState(0);
25
25
  const cssModes = useCssLayoutAreaStates(layoutRef, configRevision, Runtime === null);
26
26
  const sideNavMode = (_states$sideNav$mode = (_states$sideNav = states['side-nav']) === null || _states$sideNav === void 0 ? void 0 : _states$sideNav.mode) !== null && _states$sideNav$mode !== void 0 ? _states$sideNav$mode : cssModes['side-nav'];
@@ -28,13 +28,15 @@ export function LayoutAreaSizingProvider({
28
28
 
29
29
  // Overlay dismissal is available before the sizing chunk loads. Keep the open
30
30
  // order here too: replaying registrations into the runtime loses that order.
31
+ // Read the order from the same registration snapshot as configs, even when a
32
+ // child registers a newly opened overlay before this commit's effect runs.
31
33
  useEffect(() => {
32
34
  const inlineChatQuery = window.matchMedia('(min-width: 40rem)');
33
35
  const dismissOlderOverlay = () => {
34
36
  var _olderOverlay$onReque;
35
37
  const sideNav = configs.current['side-nav'];
36
38
  const chatPanel = configs.current['chat-panel'];
37
- if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay) {
39
+ if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay.current) {
38
40
  return;
39
41
  }
40
42
  // Before allocation, CSS puts both areas in overlay below 40rem. Once
@@ -42,7 +44,7 @@ export function LayoutAreaSizingProvider({
42
44
  if (inlineChatQuery.matches && (sideNavMode !== 'overlay' || chatPanelMode !== 'overlay')) {
43
45
  return;
44
46
  }
45
- const olderOverlay = lastOpenedOverlay === 'side-nav' ? chatPanel : sideNav;
47
+ const olderOverlay = lastOpenedOverlay.current === 'side-nav' ? chatPanel : sideNav;
46
48
  (_olderOverlay$onReque = olderOverlay.onRequestClose) === null || _olderOverlay$onReque === void 0 ? void 0 : _olderOverlay$onReque.call(olderOverlay);
47
49
  };
48
50
  dismissOlderOverlay();
@@ -50,7 +52,7 @@ export function LayoutAreaSizingProvider({
50
52
  type: 'change',
51
53
  listener: dismissOlderOverlay
52
54
  });
53
- }, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
55
+ }, [chatPanelMode, configRevision, sideNavMode]);
54
56
  const splitters = useRef(new Set());
55
57
  const registerSplitter = useCallback(element => {
56
58
  splitters.current.add(element);
@@ -177,7 +179,7 @@ export function LayoutAreaSizingProvider({
177
179
  registerArea: (area, config) => {
178
180
  var _configs$current$area, _actions$current;
179
181
  if (area !== 'panel' && config.isOpen && !((_configs$current$area = configs.current[area]) !== null && _configs$current$area !== void 0 && _configs$current$area.isOpen)) {
180
- setLastOpenedOverlay(area);
182
+ lastOpenedOverlay.current = area;
181
183
  }
182
184
  configs.current[area] = config;
183
185
  setConfigRevision(revision => revision + 1);
@@ -55,8 +55,7 @@ ${selector} > [data-layout-chat-panel] { width: var(--n_chatTrack); }
55
55
  // stylesheet contains only internal selectors/tokens and numeric width props.
56
56
  const css = `@media (min-width: 64rem) {
57
57
  @container navigation-panel-nav-space (width < ${extra + 1}px) {
58
- ${fit} { --n_fitNav: 0px; }
59
- ${root} > nav[data-layout-slot] { grid-area: main; width: min(90%, ${navTarget}); background-color: ${"var(--ds-surface-overlay, #FFFFFF)"}; box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)"}; border-inline-end: none; }
58
+ ${root} > nav[data-layout-slot] { width: ${navMin}; }
60
59
  }
61
60
  @container navigation-panel-nav-space (width >= ${extra + 1}px) {
62
61
  @container navigation-panel-chat-space (width < ${panelMinWidth + 1}px) {
@@ -314,7 +314,10 @@ const PortaledPanelSplitter = ({
314
314
  if (onResizeInternal) {
315
315
  // The allocator needs below-minimum requests for the local-to-chat cascade.
316
316
  const currentBounds = getResizeBounds();
317
- const width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
317
+ const width = Math.max(
318
+ // A negative local request represents drag distance passed on to Chat.
319
+ // The allocator clamps actual panel widths to their minimums.
320
+ prepareResize ? Number.NEGATIVE_INFINITY : 0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
318
321
  if (width !== lastManagedResizeWidth) {
319
322
  lastManagedResizeWidth = width;
320
323
  onResizeInternal(width);
@@ -1000,10 +1000,8 @@ function SideNavInternal({
1000
1000
  }
1001
1001
  ${shouldApplyUnmanagedSizing ? `#${gridRootId} nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ${clampedWidth}); }` : ''}
1002
1002
  @media (min-width: 64rem) {
1003
- @container navigation-main-space (min-width: ${minWidth}) {
1004
1003
  #${gridRootChatFitId} { --n_fitNav: ${isExpandedOnDesktop ? minWidth : '0px'}; }
1005
- ${shouldApplyUnmanagedSizing ? `#${gridRootId} nav[data-layout-slot] { grid-area: side-nav; width: min(${clampedWidth}, calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px))); }` : ''}
1006
- }
1004
+ ${shouldApplyUnmanagedSizing ? `#${gridRootId} nav[data-layout-slot] { grid-area: side-nav; width: max(${minWidth}, min(${clampedWidth}, calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px)))); }` : ''}
1007
1005
  }
1008
1006
  `), /*#__PURE__*/React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
1009
1007
  variableName: sideNavLiveWidthVar,
@@ -21,7 +21,7 @@ function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
21
21
  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;
22
22
  }
23
23
  export function calculateLayoutAreaStates(_ref4) {
24
- var _ref5, _resizeSession$overla, _resizeSession$overla2, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
24
+ var _ref5, _resizeSession$overla, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
25
25
  var viewportWidth = _ref4.viewportWidth,
26
26
  _ref4$layoutWidth = _ref4.layoutWidth,
27
27
  layoutWidth = _ref4$layoutWidth === void 0 ? viewportWidth : _ref4$layoutWidth,
@@ -48,12 +48,12 @@ export function calculateLayoutAreaStates(_ref4) {
48
48
  var layoutModes = (_resizeSession$overla = resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.overlayModes) !== null && _resizeSession$overla !== void 0 ? _resizeSession$overla : initialModes;
49
49
  // A growing panel cascades towards inline-start. Chat is on the other side
50
50
  // of the local rail, so local growth must reserve its full starting width.
51
- var shouldCollapseSideNav = Boolean(resizeSession && resizeSession.area !== 'side-nav' && !(isRefinedLayout && ((_resizeSession$overla2 = resizeSession.overlayModes) === null || _resizeSession$overla2 === void 0 ? void 0 : _resizeSession$overla2.panel) === 'overlay' && resizeSession.area === 'panel') && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
51
+ var shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
52
52
  target: getTargetWidth(resizingArea, isSideNavOverlay),
53
53
  min: resolveLayoutWidth(resizingArea.minWidth, viewportWidth),
54
54
  max: resizingArea.maxWidth !== undefined ? resolveLayoutWidth(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
55
55
  }) > 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));
56
- var isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
56
+ var isSideNavOpenInline = Boolean((sideNav === null || sideNav === void 0 ? void 0 : sideNav.isOpen) && !shouldCollapseSideNav && (isRefinedLayout ? !isSideNavOverlay : layoutModes ? layoutModes['side-nav'] === 'inline' : !isSideNavOverlay && availableWidth >= mainMinWidth + sideNavMinWidth));
57
57
  var canInlineChat = function canInlineChat() {
58
58
  return Boolean((chatPanel === null || chatPanel === void 0 ? void 0 : chatPanel.isOpen) && (!resizeSession || resizeSession.baselineWidths['chat-panel'] !== undefined) && (layoutModes ? layoutModes['chat-panel'] === 'inline' : !isChatPanelOverlay && availableWidth >= mainMinWidth + chatPanelMinWidth + (isSideNavOpenInline ? sideNavMinWidth : 0)));
59
59
  };
@@ -68,12 +68,6 @@ export function calculateLayoutAreaStates(_ref4) {
68
68
  // both siblings reach minimum. Move Chat to overlay, then recheck local.
69
69
  isChatPanelOpenInline = false;
70
70
  isPanelInline = canInlinePanel();
71
- if (!isPanelInline && availableWidth < overlayMainMinWidth + sideNavMinWidth) {
72
- // A constrained Root may not fit even navigation beside local's overlay.
73
- isSideNavOpenInline = false;
74
- isChatPanelOpenInline = canInlineChat();
75
- isPanelInline = canInlinePanel();
76
- }
77
71
  }
78
72
 
79
73
  // The clearance belongs to Main only while local overlays an inline SideNav.
@@ -200,7 +194,7 @@ export function calculateLayoutAreaStates(_ref4) {
200
194
  min: min,
201
195
  max: Math.max(min, Math.min(configuredMax, availableWidth - effectiveMainMinWidth - inlineAreas.reduce(function (total, sibling) {
202
196
  var _widths$get9, _minimums$get4;
203
- return sibling === areaName || sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
197
+ return sibling === areaName || !isRefinedLayout && sibling === 'side-nav' && areaName !== 'side-nav' ? total : total + (areaName === 'panel' && sibling === 'chat-panel' ? (_widths$get9 = widths.get(sibling)) !== null && _widths$get9 !== void 0 ? _widths$get9 : 0 : (_minimums$get4 = minimums.get(sibling)) !== null && _minimums$get4 !== void 0 ? _minimums$get4 : 0);
204
198
  }, 0)))
205
199
  }
206
200
  };
@@ -89,14 +89,18 @@ export function ChatPanel(_ref) {
89
89
  _useState2 = _slicedToArray(_useState, 2),
90
90
  inlineWidth = _useState2[0],
91
91
  setInlineWidth = _useState2[1];
92
- var _useState3 = useState(compactDefaultWidth),
92
+ var _useState3 = useState(false),
93
93
  _useState4 = _slicedToArray(_useState3, 2),
94
- overlayWidth = _useState4[0],
95
- setOverlayWidth = _useState4[1];
96
- var _useState5 = useState(false),
94
+ hasInlinePreference = _useState4[0],
95
+ setHasInlinePreference = _useState4[1];
96
+ var _useState5 = useState(compactDefaultWidth),
97
97
  _useState6 = _slicedToArray(_useState5, 2),
98
- isInline = _useState6[0],
99
- setIsInline = _useState6[1];
98
+ overlayWidth = _useState6[0],
99
+ setOverlayWidth = _useState6[1];
100
+ var _useState7 = useState(false),
101
+ _useState8 = _slicedToArray(_useState7, 2),
102
+ isInline = _useState8[0],
103
+ setIsInline = _useState8[1];
100
104
  var _useLayoutAreaSizing = useLayoutAreaSizing({
101
105
  area: 'chat-panel',
102
106
  config: {
@@ -174,6 +178,7 @@ export function ChatPanel(_ref) {
174
178
  var onCompleteResize = useCallback(function (finalWidth) {
175
179
  if (mode === 'inline') {
176
180
  setInlineWidth(finalWidth);
181
+ setHasInlinePreference(true);
177
182
  } else {
178
183
  setOverlayWidth(finalWidth);
179
184
  }
@@ -199,7 +204,7 @@ export function ChatPanel(_ref) {
199
204
  // Hoist the committed or actively resizing inline width so SideNav can yield
200
205
  // space to ChatPanel without allowing the page layout to overflow.
201
206
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
202
- React.createElement("style", null, managedSizing ? "\n#".concat(gridRootId, " { --n_chatTrack: ").concat(mode === 'inline' ? "".concat(renderedWidth, "px") : '0px', "; ").concat(chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n") : "\n#".concat(gridRootFitId, " { --n_clearanceChatMin: ").concat(minWidth, "; --n_clearanceChatTarget: ").concat(chatPanelVariableWidth, "; }\n#").concat(gridRootId, " { --n_chatTrack: 0px; ").concat(chatPanelLiveWidthVar, ": 0px; }\n#").concat(gridRootId, " [data-layout-chat-panel] {\n grid-area: 2 / 1 / -1 / -1;\n width: min(calc(var(--n_layoutW) * 0.9), ").concat(chatPanelOverlayVariableWidth, ");\n z-index: ").concat(localSlotLayers.chatPanelOverlay, ";\n background-color: ", "var(--ds-surface-overlay, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: ".concat("var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-start: none;") : '', "\n}\n@media (min-width: 40rem) {\n @container navigation-chat-space (min-width: ").concat(minWidth, ") {\n #").concat(gridRootId, " { --n_chatTrack: min(100cqw, var(").concat(panelSplitterResizingVar, ", ").concat(chatPanelVariableWidth, ")); ").concat(chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n #").concat(gridRootId, " [data-layout-chat-panel] {\n grid-area: chat-panel;\n width: min(100cqw, var(").concat(panelSplitterResizingVar, ", ").concat(chatPanelVariableWidth, "));\n z-index: auto;\n background-color: ", "var(--ds-surface, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: initial; border-inline-start: ".concat("var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";") : '', "\n }\n }\n}\n")), /*#__PURE__*/React.createElement(PanelSplitterProvider, {
207
+ React.createElement("style", null, managedSizing ? "\n#".concat(gridRootId, " { --n_chatTrack: ").concat(mode === 'inline' ? "".concat(renderedWidth, "px") : '0px', "; ").concat(chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n") : "\n#".concat(gridRootFitId, " { --n_chatPreferredW: ").concat(fg('platform-dst-chat-panel-layout') && !hasInlinePreference ? "clamp(".concat(minWidth, ", ").concat(compactDefaultWidth, "px, ").concat(configuredMaxWidth, ")") : chatPanelVariableWidth, "; --n_clearanceChatMin: ").concat(minWidth, "; --n_clearanceChatTarget: var(--n_chatPreferredW); }\n@media (min-width: 64rem) {\n #").concat(gridRootFitId, " { --n_chatPreferredW: ").concat(chatPanelVariableWidth, "; }\n}\n#").concat(gridRootId, " { --n_chatTrack: 0px; ").concat(chatPanelLiveWidthVar, ": 0px; }\n#").concat(gridRootId, " [data-layout-chat-panel] {\n grid-area: 2 / 1 / -1 / -1;\n width: min(calc(var(--n_layoutW) * 0.9), ").concat(chatPanelOverlayVariableWidth, ");\n z-index: ").concat(localSlotLayers.chatPanelOverlay, ";\n background-color: ", "var(--ds-surface-overlay, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: ".concat("var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-start: none;") : '', "\n}\n@media (min-width: 40rem) {\n @container navigation-chat-space (min-width: ").concat(minWidth, ") {\n #").concat(gridRootId, " { --n_chatTrack: min(100cqw, var(").concat(panelSplitterResizingVar, ", var(--n_chatPreferredW))); ").concat(chatPanelLiveWidthVar, ": var(--n_chatTrack); }\n #").concat(gridRootId, " [data-layout-chat-panel] {\n grid-area: chat-panel;\n width: min(100cqw, var(").concat(panelSplitterResizingVar, ", var(--n_chatPreferredW)));\n z-index: auto;\n background-color: ", "var(--ds-surface, #FFFFFF)", ";\n ").concat(hasBorder ? "box-shadow: initial; border-inline-start: ".concat("var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";") : '', "\n }\n }\n}\n")), /*#__PURE__*/React.createElement(PanelSplitterProvider, {
203
208
  panelId: chatPanelPanelSplitterId,
204
209
  panelRef: ref,
205
210
  panelWidth: renderedWidth,
@@ -29,27 +29,26 @@ export function LayoutAreaSizingProvider(_ref) {
29
29
  setStates = _useState4[1];
30
30
  var actions = useRef(null);
31
31
  var configs = useRef({});
32
- var _useState5 = useState(null),
32
+ var lastOpenedOverlay = useRef(null);
33
+ var _useState5 = useState(0),
33
34
  _useState6 = _slicedToArray(_useState5, 2),
34
- lastOpenedOverlay = _useState6[0],
35
- setLastOpenedOverlay = _useState6[1];
36
- var _useState7 = useState(0),
37
- _useState8 = _slicedToArray(_useState7, 2),
38
- configRevision = _useState8[0],
39
- setConfigRevision = _useState8[1];
35
+ configRevision = _useState6[0],
36
+ setConfigRevision = _useState6[1];
40
37
  var cssModes = useCssLayoutAreaStates(layoutRef, configRevision, Runtime === null);
41
38
  var sideNavMode = (_states$sideNav$mode = (_states$sideNav = states['side-nav']) === null || _states$sideNav === void 0 ? void 0 : _states$sideNav.mode) !== null && _states$sideNav$mode !== void 0 ? _states$sideNav$mode : cssModes['side-nav'];
42
39
  var chatPanelMode = (_states$chatPanel$mo = (_states$chatPanel = states['chat-panel']) === null || _states$chatPanel === void 0 ? void 0 : _states$chatPanel.mode) !== null && _states$chatPanel$mo !== void 0 ? _states$chatPanel$mo : cssModes['chat-panel'];
43
40
 
44
41
  // Overlay dismissal is available before the sizing chunk loads. Keep the open
45
42
  // order here too: replaying registrations into the runtime loses that order.
43
+ // Read the order from the same registration snapshot as configs, even when a
44
+ // child registers a newly opened overlay before this commit's effect runs.
46
45
  useEffect(function () {
47
46
  var inlineChatQuery = window.matchMedia('(min-width: 40rem)');
48
47
  var dismissOlderOverlay = function dismissOlderOverlay() {
49
48
  var _olderOverlay$onReque;
50
49
  var sideNav = configs.current['side-nav'];
51
50
  var chatPanel = configs.current['chat-panel'];
52
- if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay) {
51
+ if (!(sideNav !== null && sideNav !== void 0 && sideNav.isOpen) || !(chatPanel !== null && chatPanel !== void 0 && chatPanel.isOpen) || !lastOpenedOverlay.current) {
53
52
  return;
54
53
  }
55
54
  // Before allocation, CSS puts both areas in overlay below 40rem. Once
@@ -57,7 +56,7 @@ export function LayoutAreaSizingProvider(_ref) {
57
56
  if (inlineChatQuery.matches && (sideNavMode !== 'overlay' || chatPanelMode !== 'overlay')) {
58
57
  return;
59
58
  }
60
- var olderOverlay = lastOpenedOverlay === 'side-nav' ? chatPanel : sideNav;
59
+ var olderOverlay = lastOpenedOverlay.current === 'side-nav' ? chatPanel : sideNav;
61
60
  (_olderOverlay$onReque = olderOverlay.onRequestClose) === null || _olderOverlay$onReque === void 0 || _olderOverlay$onReque.call(olderOverlay);
62
61
  };
63
62
  dismissOlderOverlay();
@@ -65,7 +64,7 @@ export function LayoutAreaSizingProvider(_ref) {
65
64
  type: 'change',
66
65
  listener: dismissOlderOverlay
67
66
  });
68
- }, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
67
+ }, [chatPanelMode, configRevision, sideNavMode]);
69
68
  var splitters = useRef(new Set());
70
69
  var registerSplitter = useCallback(function (element) {
71
70
  splitters.current.add(element);
@@ -248,7 +247,7 @@ export function LayoutAreaSizingProvider(_ref) {
248
247
  registerArea: function registerArea(area, config) {
249
248
  var _configs$current$area, _actions$current;
250
249
  if (area !== 'panel' && config.isOpen && !((_configs$current$area = configs.current[area]) !== null && _configs$current$area !== void 0 && _configs$current$area.isOpen)) {
251
- setLastOpenedOverlay(area);
250
+ lastOpenedOverlay.current = area;
252
251
  }
253
252
  configs.current[area] = config;
254
253
  setConfigRevision(function (revision) {
@@ -42,7 +42,7 @@ export function LayoutOverlayClearance(_ref) {
42
42
  var withChat = "".concat(root, ":has(> [data-layout-chat-panel])");
43
43
  // React 18 escapes comparison operators in style children during SSR. The
44
44
  // stylesheet contains only internal selectors/tokens and numeric width props.
45
- var css = "@media (min-width: 64rem) {\n@container navigation-panel-nav-space (width < ".concat(extra + 1, "px) {\n").concat(fit, " { --n_fitNav: 0px; }\n").concat(root, " > nav[data-layout-slot] { grid-area: main; width: min(90%, ").concat(navTarget, "); background-color: ", "var(--ds-surface-overlay, #FFFFFF)", "; box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", "; border-inline-end: none; }\n}\n@container navigation-panel-nav-space (width >= ").concat(extra + 1, "px) {\n @container navigation-panel-chat-space (width < ").concat(panelMinWidth + 1, "px) {\n ").concat(fit, " { --n_fitNav: calc(").concat(navMin, " + ").concat(extra, "px); }\n }\n}\n").concat(rule(false, withoutChat), "\n").concat(inlineRule(false, withoutChat), "\n@container navigation-panel-chat-space (width < ").concat(extra + 1, "px) {\n").concat(rule(false, withChat), "\n").concat(inlineRule(false, withChat), "\n}\n").concat(rule(true, withChat), "\n").concat(inlineRule(true, withChat), "\n").concat(inlineWithoutNav("#".concat(gridRootId, ":not(:has(> nav[data-layout-side-nav-open]))")), "\n}\n@media (min-width: 40rem) and (width < 64rem) {\n").concat(inlineWithoutNav("#".concat(gridRootId, ":has(> [data-layout-chat-panel])")), "\n}");
45
+ var css = "@media (min-width: 64rem) {\n@container navigation-panel-nav-space (width < ".concat(extra + 1, "px) {\n").concat(root, " > nav[data-layout-slot] { width: ").concat(navMin, "; }\n}\n@container navigation-panel-nav-space (width >= ").concat(extra + 1, "px) {\n @container navigation-panel-chat-space (width < ").concat(panelMinWidth + 1, "px) {\n ").concat(fit, " { --n_fitNav: calc(").concat(navMin, " + ").concat(extra, "px); }\n }\n}\n").concat(rule(false, withoutChat), "\n").concat(inlineRule(false, withoutChat), "\n@container navigation-panel-chat-space (width < ").concat(extra + 1, "px) {\n").concat(rule(false, withChat), "\n").concat(inlineRule(false, withChat), "\n}\n").concat(rule(true, withChat), "\n").concat(inlineRule(true, withChat), "\n").concat(inlineWithoutNav("#".concat(gridRootId, ":not(:has(> nav[data-layout-side-nav-open]))")), "\n}\n@media (min-width: 40rem) and (width < 64rem) {\n").concat(inlineWithoutNav("#".concat(gridRootId, ":has(> [data-layout-chat-panel])")), "\n}");
46
46
  return (
47
47
  /*#__PURE__*/
48
48
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, react/no-danger -- Root-scoped, internally generated CSS must retain query operators during SSR.
@@ -323,7 +323,10 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
323
323
  if (onResizeInternal) {
324
324
  // The allocator needs below-minimum requests for the local-to-chat cascade.
325
325
  var currentBounds = getResizeBounds();
326
- var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
326
+ var width = Math.max(
327
+ // A negative local request represents drag distance passed on to Chat.
328
+ // The allocator clamps actual panel widths to their minimums.
329
+ prepareResize ? Number.NEGATIVE_INFINITY : 0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
327
330
  if (width !== lastManagedResizeWidth) {
328
331
  lastManagedResizeWidth = width;
329
332
  onResizeInternal(width);
@@ -999,7 +999,7 @@ function SideNavInternal(_ref4) {
999
999
  /*#__PURE__*/
1000
1000
  // CSS reserves only the nav minimum for chat's fit decision, before effects or lazy loading.
1001
1001
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
1002
- React.createElement("style", null, "\n#".concat(gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(gridRootId, " nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n @container navigation-main-space (min-width: ").concat(minWidth, ") {\n #").concat(gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(gridRootId, " nav[data-layout-slot] { grid-area: side-nav; width: min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px))); }") : '', "\n }\n}\n")), /*#__PURE__*/React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
1002
+ React.createElement("style", null, "\n#".concat(gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(gridRootId, " nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n #").concat(gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(gridRootId, " nav[data-layout-slot] { grid-area: side-nav; width: max(").concat(minWidth, ", min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px)))); }") : '', "\n}\n")), /*#__PURE__*/React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
1003
1003
  variableName: sideNavLiveWidthVar,
1004
1004
  value: "0px",
1005
1005
  mediaQuery: '@media (min-width: 64rem)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "11.7.1",
3
+ "version": "11.7.2",
4
4
  "description": "The latest navigation system for Atlassian apps.",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
6
6
  "license": "Apache-2.0",
@@ -74,7 +74,7 @@
74
74
  "@atlaskit/primitives": "^22.7.0",
75
75
  "@atlaskit/react-compiler-gating": "^0.2.0",
76
76
  "@atlaskit/side-nav-items": "^2.6.0",
77
- "@atlaskit/tokens": "^20.10.0",
77
+ "@atlaskit/tokens": "^20.11.0",
78
78
  "@atlaskit/tooltip": "^24.4.0",
79
79
  "@atlaskit/top-layer": "^7.1.0",
80
80
  "@atlaskit/visually-hidden": "^4.4.0",