@atlaskit/navigation-system 11.7.4 → 11.7.6
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 +17 -0
- package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +3 -3
- package/dist/cjs/ui/page-layout/chat-panel.compiled.css +1 -0
- package/dist/cjs/ui/page-layout/chat-panel.js +22 -12
- package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +11 -1
- package/dist/cjs/ui/page-layout/panel-splitter/chat-panel-panel-splitter-id.js +7 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +6 -3
- package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +3 -3
- package/dist/es2019/ui/page-layout/chat-panel.compiled.css +1 -0
- package/dist/es2019/ui/page-layout/chat-panel.js +15 -6
- package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +15 -1
- package/dist/es2019/ui/page-layout/panel-splitter/chat-panel-panel-splitter-id.js +1 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +6 -3
- package/dist/esm/ui/page-layout/calculate-layout-area-states.js +3 -3
- package/dist/esm/ui/page-layout/chat-panel.compiled.css +1 -0
- package/dist/esm/ui/page-layout/chat-panel.js +20 -10
- package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +11 -1
- package/dist/esm/ui/page-layout/panel-splitter/chat-panel-panel-splitter-id.js +1 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +6 -3
- package/dist/types/ui/page-layout/chat-panel.d.ts +2 -0
- package/dist/types/ui/page-layout/panel-splitter/chat-panel-panel-splitter-id.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 11.7.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0194dc608ff8e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0194dc608ff8e) -
|
|
8
|
+
Keep the full ChatPanel resize line inside its boundary so adjacent TopNav content cannot obscure
|
|
9
|
+
it. The styling is internal to ChatPanel and does not change the drag target or the public
|
|
10
|
+
splitter API.
|
|
11
|
+
|
|
12
|
+
## 11.7.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`57d9afc065559`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/57d9afc065559) -
|
|
17
|
+
Retain ChatPanel resize preferences across close and reopen, preserve compact overlay minimums,
|
|
18
|
+
and enable local and chat resize handles at small viewports behind platform-dst-chat-panel-layout.
|
|
19
|
+
|
|
3
20
|
## 11.7.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -233,9 +233,9 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
233
233
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
234
234
|
var layoutMax = (_areaName2 === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
235
235
|
var defaultWidth = isSideNavOverlay ? (_area$compactDefaultW3 = _area.compactDefaultWidth) !== null && _area$compactDefaultW3 !== void 0 ? _area$compactDefaultW3 : _area.defaultWidth : _area.defaultWidth;
|
|
236
|
-
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)) : layoutMax;
|
|
237
|
-
var _max = isRefinedLayout && _areaName2 === 'panel' ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
238
|
-
var effectiveMin = isRefinedLayout && _areaName2 === 'panel' ? _min2 : Math.min(_min2, _max);
|
|
236
|
+
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
|
+
var _max = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
238
|
+
var effectiveMin = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? _min2 : Math.min(_min2, _max);
|
|
239
239
|
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, _areaName2);
|
|
240
240
|
var _width2 = clampTargetWidth({
|
|
241
241
|
target: _target,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
18
18
|
._kqsw1if8{position:sticky}
|
|
19
19
|
._p12f1osq{max-width:100%}
|
|
20
|
+
._p12fglyw{max-width:none}
|
|
20
21
|
._qo371wug._qo371wug{z-index:auto}
|
|
21
22
|
._qo37qfx8._qo37qfx8{z-index:5}
|
|
22
23
|
._so1e130s._so1e130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
@@ -17,6 +17,7 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
18
|
var _useSkipLinkInternal = require("../../context/skip-links/use-skip-link-internal");
|
|
19
19
|
var _constants = require("./constants");
|
|
20
|
+
var _chatPanelPanelSplitterId = require("./panel-splitter/chat-panel-panel-splitter-id");
|
|
20
21
|
var _convertResizeBoundToPixels = require("./panel-splitter/convert-resize-bound-to-pixels");
|
|
21
22
|
var _provider = require("./panel-splitter/provider");
|
|
22
23
|
var _resolveLayoutWidth = require("./resolve-layout-width");
|
|
@@ -26,7 +27,6 @@ var _useLayoutId = require("./use-layout-id");
|
|
|
26
27
|
var _useResizingWidthCssVarOnRootElement = require("./use-resizing-width-css-var-on-root-element");
|
|
27
28
|
var _useSafeDefaultWidth = require("./use-safe-default-width");
|
|
28
29
|
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); }
|
|
29
|
-
var chatPanelPanelSplitterId = Symbol('ChatPanel PanelSplitter');
|
|
30
30
|
var panelSplitterResizingVar = '--n_cPnlRsz';
|
|
31
31
|
var chatPanelOverlayWidthVar = '--n_cPnlOverlayW';
|
|
32
32
|
var fallbackDefaultWidth = 400;
|
|
@@ -40,6 +40,7 @@ function getPixelCustomProperty(element, propertyName, fallback) {
|
|
|
40
40
|
}
|
|
41
41
|
var styles = {
|
|
42
42
|
root: "_nd5lquub _10fph9n0 _vchhusvi _p12f1osq _1pbyqfx8 _4t3i56xv _kqsw1if8 _152t1nws _bfhk1bhr _1bsb1ky5 _qhdr1ym0 _m5h51wug _1ttbvuon _1mxh8rg1",
|
|
43
|
+
refinedOverlay: "_p12fglyw",
|
|
43
44
|
managedInline: "_12xt1ym0 _qo371wug _16hgvuon _w1ap8rg1",
|
|
44
45
|
managedOverlay: "_12xtquub _qo37qfx8 _16hg1bhr _w1ap1ky5",
|
|
45
46
|
scrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
@@ -55,6 +56,8 @@ var styles = {
|
|
|
55
56
|
* full-height column in the page layout grid.
|
|
56
57
|
*
|
|
57
58
|
* You can optionally render a `PanelSplitter` as a child to make the chat panel resizable.
|
|
59
|
+
* With chat layout enabled, Root retains separate inline and overlay resize preferences
|
|
60
|
+
* when ChatPanel is closed and remounted during the same layout session.
|
|
58
61
|
*/
|
|
59
62
|
function ChatPanel(_ref) {
|
|
60
63
|
var _managedSizing$mode, _managedSizing$width;
|
|
@@ -102,14 +105,18 @@ function ChatPanel(_ref) {
|
|
|
102
105
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
103
106
|
hasInlinePreference = _useState4[0],
|
|
104
107
|
setHasInlinePreference = _useState4[1];
|
|
105
|
-
var _useState5 = (0, _react.useState)(
|
|
108
|
+
var _useState5 = (0, _react.useState)(false),
|
|
106
109
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var _useState7 = (0, _react.useState)(
|
|
110
|
+
hasOverlayPreference = _useState6[0],
|
|
111
|
+
setHasOverlayPreference = _useState6[1];
|
|
112
|
+
var _useState7 = (0, _react.useState)(compactDefaultWidth),
|
|
110
113
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
overlayWidth = _useState8[0],
|
|
115
|
+
setOverlayWidth = _useState8[1];
|
|
116
|
+
var _useState9 = (0, _react.useState)(false),
|
|
117
|
+
_useState0 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
118
|
+
isInline = _useState0[0],
|
|
119
|
+
setIsInline = _useState0[1];
|
|
113
120
|
var _useLayoutAreaSizing = (0, _useLayoutAreaSizing2.useLayoutAreaSizing)({
|
|
114
121
|
area: 'chat-panel',
|
|
115
122
|
config: {
|
|
@@ -144,7 +151,7 @@ function ChatPanel(_ref) {
|
|
|
144
151
|
(0, _useResizingWidthCssVarOnRootElement.useResizingWidthCssVarOnRootElement)({
|
|
145
152
|
isEnabled: !managedSizing,
|
|
146
153
|
cssVar: panelSplitterResizingVar,
|
|
147
|
-
panelId: chatPanelPanelSplitterId
|
|
154
|
+
panelId: _chatPanelPanelSplitterId.chatPanelPanelSplitterId
|
|
148
155
|
});
|
|
149
156
|
var getResizeBounds = (0, _react.useCallback)(function () {
|
|
150
157
|
var managedBounds = getManagedResizeBounds();
|
|
@@ -183,13 +190,16 @@ function ChatPanel(_ref) {
|
|
|
183
190
|
}, [getManagedResizeBounds, maxWidth, minWidth]);
|
|
184
191
|
var configuredMaxWidth = maxWidth !== null && maxWidth !== void 0 ? maxWidth : '100vw';
|
|
185
192
|
var chatPanelVariableWidth = managedSizing ? "".concat(renderedWidth, "px") : "clamp(".concat(minWidth, ", ").concat(inlineWidth, "px, ").concat(configuredMaxWidth, ")");
|
|
186
|
-
var
|
|
193
|
+
var overlayDefault = "var(--n_chatDefaultW, ".concat(compactDefaultWidth, "px)");
|
|
194
|
+
var overlayMaximum = "max(".concat(minWidth, ", min(").concat(configuredMaxWidth, ", var(--n_layoutW, 100vw), max(").concat(overlayDefault, ", calc(var(--n_layoutW, 100vw) * 0.9))))");
|
|
195
|
+
var chatPanelOverlayVariableWidth = managedSizing ? "".concat(renderedWidth, "px") : (0, _fg.fg)('platform-dst-chat-panel-layout') ? "clamp(".concat(minWidth, ", ").concat(hasOverlayPreference ? "".concat(overlayWidth, "px") : overlayDefault, ", ").concat(overlayMaximum, ")") : "clamp(".concat(minWidth, ", ").concat(overlayWidth, "px, min(90vw, ").concat(configuredMaxWidth, "))");
|
|
187
196
|
var onCompleteResize = (0, _react.useCallback)(function (finalWidth) {
|
|
188
197
|
if (mode === 'inline') {
|
|
189
198
|
setInlineWidth(finalWidth);
|
|
190
199
|
setHasInlinePreference(true);
|
|
191
200
|
} else {
|
|
192
201
|
setOverlayWidth(finalWidth);
|
|
202
|
+
setHasOverlayPreference(true);
|
|
193
203
|
}
|
|
194
204
|
completeResize(mode, finalWidth);
|
|
195
205
|
}, [completeResize, mode]);
|
|
@@ -203,7 +213,7 @@ function ChatPanel(_ref) {
|
|
|
203
213
|
id: id,
|
|
204
214
|
"data-layout-slot": true,
|
|
205
215
|
"aria-label": label,
|
|
206
|
-
className: (0, _runtime.ax)([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
216
|
+
className: (0, _runtime.ax)([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, (0, _fg.fg)('platform-dst-chat-panel-layout') && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.refinedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
207
217
|
style: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.chatPanelVar, chatPanelVariableWidth), chatPanelOverlayWidthVar, chatPanelOverlayVariableWidth),
|
|
208
218
|
"data-testid": testId,
|
|
209
219
|
"data-layout-chat-panel": "",
|
|
@@ -213,8 +223,8 @@ function ChatPanel(_ref) {
|
|
|
213
223
|
// Hoist the committed or actively resizing inline width so SideNav can yield
|
|
214
224
|
// space to ChatPanel without allowing the page layout to overflow.
|
|
215
225
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
|
|
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), "
|
|
217
|
-
panelId: chatPanelPanelSplitterId,
|
|
226
|
+
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_chatDefaultW: ").concat(compactDefaultWidth, "px; --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_chatDefaultW: ").concat(defaultWidth, "px; --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: ").concat((0, _fg.fg)('platform-dst-chat-panel-layout') ? chatPanelOverlayVariableWidth : "min(calc(var(--n_layoutW) * 0.9), ".concat(chatPanelOverlayVariableWidth, ")"), ";\n ").concat((0, _fg.fg)('platform-dst-chat-panel-layout') ? 'max-width: none;' : '', "\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 max-width: 100%;\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, {
|
|
227
|
+
panelId: _chatPanelPanelSplitterId.chatPanelPanelSplitterId,
|
|
218
228
|
panelRef: ref,
|
|
219
229
|
panelWidth: renderedWidth,
|
|
220
230
|
onCompleteResize: onCompleteResize,
|
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _bindEventListener = require("bind-event-listener");
|
|
13
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
14
|
var _calculateLayoutAreaStates = require("./calculate-layout-area-states");
|
|
14
15
|
var _constants = require("./constants");
|
|
15
16
|
var _layoutAreaSizingContext = require("./layout-area-sizing-context");
|
|
@@ -189,8 +190,17 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
189
190
|
if (!current[area]) {
|
|
190
191
|
return current;
|
|
191
192
|
}
|
|
193
|
+
if (area === 'chat-panel' && (0, _fg.fg)('platform-dst-chat-panel-layout')) {
|
|
194
|
+
// Chat's public close contract unmounts the slot. Keep preferences in Root,
|
|
195
|
+
// but release its allocation, in-progress resize and dismissal callback.
|
|
196
|
+
return _objectSpread(_objectSpread({}, current), {}, (0, _defineProperty2.default)({}, area, _objectSpread(_objectSpread({}, current[area]), {}, {
|
|
197
|
+
isOpen: false,
|
|
198
|
+
liveResize: undefined,
|
|
199
|
+
onRequestClose: undefined
|
|
200
|
+
})));
|
|
201
|
+
}
|
|
192
202
|
// Closing uses isOpen: false and retains preferences. Unregistering means
|
|
193
|
-
// the owning component unmounted
|
|
203
|
+
// the owning component unmounted. Only Chat retains preferences across this close path.
|
|
194
204
|
var next = _objectSpread({}, current);
|
|
195
205
|
delete next[area];
|
|
196
206
|
return next;
|
|
@@ -35,6 +35,7 @@ var _requestClosePopovers = require("@atlaskit/top-layer/page-surface/request-cl
|
|
|
35
35
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
36
36
|
var _constants = require("../constants");
|
|
37
37
|
var _layoutAreaSizingContext = require("../layout-area-sizing-context");
|
|
38
|
+
var _chatPanelPanelSplitterId = require("./chat-panel-panel-splitter-id");
|
|
38
39
|
var _convertResizeBoundToPixels = require("./convert-resize-bound-to-pixels");
|
|
39
40
|
var _getPanelGrowthSide = require("./get-panel-growth-side");
|
|
40
41
|
var _getPercentageWithinPixelBounds = require("./get-percentage-within-pixel-bounds");
|
|
@@ -54,6 +55,7 @@ function signPanelSplitterDragData(data) {
|
|
|
54
55
|
}
|
|
55
56
|
var containerStyles = {
|
|
56
57
|
root: "_12ji1r31 _1qu2glyw _12y31o36 _1e0cglyw _kqswstnw _u7coidpf _152tidpf _1pbykb7n _181n1ule",
|
|
58
|
+
visibleOnSmallScreens: "_1e0c1ule",
|
|
57
59
|
positionEnd: "_rjxpftgi",
|
|
58
60
|
positionStart: "_1e02zeo2"
|
|
59
61
|
};
|
|
@@ -62,7 +64,8 @@ var grabAreaStyles = {
|
|
|
62
64
|
rootFinesse: "_vp7g1ihb _30l31ihb _9h8hq98m"
|
|
63
65
|
};
|
|
64
66
|
var lineStyles = {
|
|
65
|
-
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
67
|
+
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z",
|
|
68
|
+
chatPanel: "_1e02rdoj"
|
|
66
69
|
};
|
|
67
70
|
var tooltipStyles = {
|
|
68
71
|
root: "_ahbq196n _1bsb1ris",
|
|
@@ -632,7 +635,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
632
635
|
}, [rangeInputValue, rangeInputBounds]);
|
|
633
636
|
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/React.createElement("div", {
|
|
634
637
|
"data-testid": testId ? "".concat(testId, "-container") : undefined,
|
|
635
|
-
className: (0, _runtime.ax)([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
638
|
+
className: (0, _runtime.ax)([containerStyles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') && onResizeInternal && position === 'start' && containerStyles.visibleOnSmallScreens, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
636
639
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
637
640
|
tooltipContent: tooltipContent,
|
|
638
641
|
shortcut: shortcut,
|
|
@@ -659,7 +662,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
659
662
|
}), /*#__PURE__*/React.createElement("span", {
|
|
660
663
|
id: labelId
|
|
661
664
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
662
|
-
className: (0, _runtime.ax)([lineStyles.root])
|
|
665
|
+
className: (0, _runtime.ax)([lineStyles.root, panelId === _chatPanelPanelSplitterId.chatPanelPanelSplitterId && lineStyles.chatPanel])
|
|
663
666
|
})))), portal);
|
|
664
667
|
};
|
|
665
668
|
/**
|
|
@@ -177,9 +177,9 @@ export function calculateLayoutAreaStates({
|
|
|
177
177
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
178
178
|
const layoutMax = (areaName === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
179
179
|
const defaultWidth = isSideNavOverlay ? (_area$compactDefaultW3 = area.compactDefaultWidth) !== null && _area$compactDefaultW3 !== void 0 ? _area$compactDefaultW3 : area.defaultWidth : area.defaultWidth;
|
|
180
|
-
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)) : layoutMax;
|
|
181
|
-
const max = isRefinedLayout && areaName === 'panel' ? Math.max(min, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
182
|
-
const effectiveMin = isRefinedLayout && areaName === 'panel' ? min : Math.min(min, max);
|
|
180
|
+
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
|
+
const max = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? Math.max(min, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
182
|
+
const effectiveMin = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? min : Math.min(min, max);
|
|
183
183
|
const target = getOverlayTargetWidth(area, isSideNavOverlay, areaName);
|
|
184
184
|
const width = clampTargetWidth({
|
|
185
185
|
target,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
18
18
|
._kqsw1if8{position:sticky}
|
|
19
19
|
._p12f1osq{max-width:100%}
|
|
20
|
+
._p12fglyw{max-width:none}
|
|
20
21
|
._qo371wug._qo371wug{z-index:auto}
|
|
21
22
|
._qo37qfx8._qo37qfx8{z-index:5}
|
|
22
23
|
._so1e130s._so1e130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
@@ -7,6 +7,7 @@ import { bind } from 'bind-event-listener';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import { useSkipLinkInternal } from '../../context/skip-links/use-skip-link-internal';
|
|
9
9
|
import { chatPanelLiveWidthVar, chatPanelVar, defaultMainMinWidth, localSlotLayers, mainMinimumWidthVar } from './constants';
|
|
10
|
+
import { chatPanelPanelSplitterId } from './panel-splitter/chat-panel-panel-splitter-id';
|
|
10
11
|
import { convertResizeBoundToPixels } from './panel-splitter/convert-resize-bound-to-pixels';
|
|
11
12
|
import { PanelSplitterProvider } from './panel-splitter/provider';
|
|
12
13
|
import { resolveLayoutWidth } from './resolve-layout-width';
|
|
@@ -15,7 +16,6 @@ import { useLayoutAreaSizing } from './use-layout-area-sizing';
|
|
|
15
16
|
import { useLayoutId } from './use-layout-id';
|
|
16
17
|
import { useResizingWidthCssVarOnRootElement } from './use-resizing-width-css-var-on-root-element';
|
|
17
18
|
import { useSafeDefaultWidth } from './use-safe-default-width';
|
|
18
|
-
const chatPanelPanelSplitterId = Symbol('ChatPanel PanelSplitter');
|
|
19
19
|
const panelSplitterResizingVar = '--n_cPnlRsz';
|
|
20
20
|
const chatPanelOverlayWidthVar = '--n_cPnlOverlayW';
|
|
21
21
|
const fallbackDefaultWidth = 400;
|
|
@@ -29,6 +29,7 @@ function getPixelCustomProperty(element, propertyName, fallback) {
|
|
|
29
29
|
}
|
|
30
30
|
const styles = {
|
|
31
31
|
root: "_nd5lquub _10fph9n0 _vchhusvi _p12f1osq _1pbyqfx8 _4t3i56xv _kqsw1if8 _152t1nws _bfhk1bhr _1bsb1ky5 _qhdr1ym0 _m5h51wug _1ttbvuon _1mxh8rg1",
|
|
32
|
+
refinedOverlay: "_p12fglyw",
|
|
32
33
|
managedInline: "_12xt1ym0 _qo371wug _16hgvuon _w1ap8rg1",
|
|
33
34
|
managedOverlay: "_12xtquub _qo37qfx8 _16hg1bhr _w1ap1ky5",
|
|
34
35
|
scrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
@@ -44,6 +45,8 @@ const styles = {
|
|
|
44
45
|
* full-height column in the page layout grid.
|
|
45
46
|
*
|
|
46
47
|
* You can optionally render a `PanelSplitter` as a child to make the chat panel resizable.
|
|
48
|
+
* With chat layout enabled, Root retains separate inline and overlay resize preferences
|
|
49
|
+
* when ChatPanel is closed and remounted during the same layout session.
|
|
47
50
|
*/
|
|
48
51
|
export function ChatPanel({
|
|
49
52
|
children,
|
|
@@ -82,6 +85,7 @@ export function ChatPanel({
|
|
|
82
85
|
const ref = useRef(null);
|
|
83
86
|
const [inlineWidth, setInlineWidth] = useState(defaultWidth);
|
|
84
87
|
const [hasInlinePreference, setHasInlinePreference] = useState(false);
|
|
88
|
+
const [hasOverlayPreference, setHasOverlayPreference] = useState(false);
|
|
85
89
|
const [overlayWidth, setOverlayWidth] = useState(compactDefaultWidth);
|
|
86
90
|
const [isInline, setIsInline] = useState(false);
|
|
87
91
|
const {
|
|
@@ -158,13 +162,16 @@ export function ChatPanel({
|
|
|
158
162
|
}, [getManagedResizeBounds, maxWidth, minWidth]);
|
|
159
163
|
const configuredMaxWidth = maxWidth !== null && maxWidth !== void 0 ? maxWidth : '100vw';
|
|
160
164
|
const chatPanelVariableWidth = managedSizing ? `${renderedWidth}px` : `clamp(${minWidth}, ${inlineWidth}px, ${configuredMaxWidth})`;
|
|
161
|
-
const
|
|
165
|
+
const overlayDefault = `var(--n_chatDefaultW, ${compactDefaultWidth}px)`;
|
|
166
|
+
const overlayMaximum = `max(${minWidth}, min(${configuredMaxWidth}, var(--n_layoutW, 100vw), max(${overlayDefault}, calc(var(--n_layoutW, 100vw) * 0.9))))`;
|
|
167
|
+
const chatPanelOverlayVariableWidth = managedSizing ? `${renderedWidth}px` : fg('platform-dst-chat-panel-layout') ? `clamp(${minWidth}, ${hasOverlayPreference ? `${overlayWidth}px` : overlayDefault}, ${overlayMaximum})` : `clamp(${minWidth}, ${overlayWidth}px, min(90vw, ${configuredMaxWidth}))`;
|
|
162
168
|
const onCompleteResize = useCallback(finalWidth => {
|
|
163
169
|
if (mode === 'inline') {
|
|
164
170
|
setInlineWidth(finalWidth);
|
|
165
171
|
setHasInlinePreference(true);
|
|
166
172
|
} else {
|
|
167
173
|
setOverlayWidth(finalWidth);
|
|
174
|
+
setHasOverlayPreference(true);
|
|
168
175
|
}
|
|
169
176
|
completeResize(mode, finalWidth);
|
|
170
177
|
}, [completeResize, mode]);
|
|
@@ -176,7 +183,7 @@ export function ChatPanel({
|
|
|
176
183
|
id: id,
|
|
177
184
|
"data-layout-slot": true,
|
|
178
185
|
"aria-label": label,
|
|
179
|
-
className: ax([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
186
|
+
className: ax([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, fg('platform-dst-chat-panel-layout') && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.refinedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
180
187
|
style: {
|
|
181
188
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Shared layout CSS variable name.
|
|
182
189
|
[chatPanelVar]: chatPanelVariableWidth,
|
|
@@ -194,14 +201,15 @@ export function ChatPanel({
|
|
|
194
201
|
React.createElement("style", null, managedSizing ? `
|
|
195
202
|
#${gridRootId} { --n_chatTrack: ${mode === 'inline' ? `${renderedWidth}px` : '0px'}; ${chatPanelLiveWidthVar}: var(--n_chatTrack); }
|
|
196
203
|
` : `
|
|
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); }
|
|
204
|
+
#${gridRootFitId} { --n_chatDefaultW: ${compactDefaultWidth}px; --n_chatPreferredW: ${fg('platform-dst-chat-panel-layout') && !hasInlinePreference ? `clamp(${minWidth}, ${compactDefaultWidth}px, ${configuredMaxWidth})` : chatPanelVariableWidth}; --n_clearanceChatMin: ${minWidth}; --n_clearanceChatTarget: var(--n_chatPreferredW); }
|
|
198
205
|
@media (min-width: 64rem) {
|
|
199
|
-
#${gridRootFitId} { --n_chatPreferredW: ${chatPanelVariableWidth}; }
|
|
206
|
+
#${gridRootFitId} { --n_chatDefaultW: ${defaultWidth}px; --n_chatPreferredW: ${chatPanelVariableWidth}; }
|
|
200
207
|
}
|
|
201
208
|
#${gridRootId} { --n_chatTrack: 0px; ${chatPanelLiveWidthVar}: 0px; }
|
|
202
209
|
#${gridRootId} [data-layout-chat-panel] {
|
|
203
210
|
grid-area: 2 / 1 / -1 / -1;
|
|
204
|
-
width: min(calc(var(--n_layoutW) * 0.9), ${chatPanelOverlayVariableWidth});
|
|
211
|
+
width: ${fg('platform-dst-chat-panel-layout') ? chatPanelOverlayVariableWidth : `min(calc(var(--n_layoutW) * 0.9), ${chatPanelOverlayVariableWidth})`};
|
|
212
|
+
${fg('platform-dst-chat-panel-layout') ? 'max-width: none;' : ''}
|
|
205
213
|
z-index: ${localSlotLayers.chatPanelOverlay};
|
|
206
214
|
background-color: ${"var(--ds-surface-overlay, #FFFFFF)"};
|
|
207
215
|
${hasBorder ? `box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)"}; border-inline-start: none;` : ''}
|
|
@@ -212,6 +220,7 @@ export function ChatPanel({
|
|
|
212
220
|
#${gridRootId} [data-layout-chat-panel] {
|
|
213
221
|
grid-area: chat-panel;
|
|
214
222
|
width: min(100cqw, var(${panelSplitterResizingVar}, var(--n_chatPreferredW)));
|
|
223
|
+
max-width: 100%;
|
|
215
224
|
z-index: auto;
|
|
216
225
|
background-color: ${"var(--ds-surface, #FFFFFF)"};
|
|
217
226
|
${hasBorder ? `box-shadow: initial; border-inline-start: ${"var(--ds-border-width, 1px)"} solid ${"var(--ds-border, #0B120E24)"};` : ''}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { calculateLayoutAreaStates } from './calculate-layout-area-states';
|
|
4
5
|
import { defaultMainMinWidth } from './constants';
|
|
5
6
|
import { LayoutAreaSizingContext } from './layout-area-sizing-context';
|
|
@@ -152,8 +153,21 @@ export function LayoutAreaSizingRuntime({
|
|
|
152
153
|
if (!current[area]) {
|
|
153
154
|
return current;
|
|
154
155
|
}
|
|
156
|
+
if (area === 'chat-panel' && fg('platform-dst-chat-panel-layout')) {
|
|
157
|
+
// Chat's public close contract unmounts the slot. Keep preferences in Root,
|
|
158
|
+
// but release its allocation, in-progress resize and dismissal callback.
|
|
159
|
+
return {
|
|
160
|
+
...current,
|
|
161
|
+
[area]: {
|
|
162
|
+
...current[area],
|
|
163
|
+
isOpen: false,
|
|
164
|
+
liveResize: undefined,
|
|
165
|
+
onRequestClose: undefined
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
155
169
|
// Closing uses isOpen: false and retains preferences. Unregistering means
|
|
156
|
-
// the owning component unmounted
|
|
170
|
+
// the owning component unmounted. Only Chat retains preferences across this close path.
|
|
157
171
|
const next = {
|
|
158
172
|
...current
|
|
159
173
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const chatPanelPanelSplitterId = Symbol('ChatPanel PanelSplitter');
|
|
@@ -22,6 +22,7 @@ import { requestClosePopovers } from '@atlaskit/top-layer/page-surface/request-c
|
|
|
22
22
|
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
23
23
|
import { contentInsetBlockStart } from '../constants';
|
|
24
24
|
import { LayoutAreaSizingContext } from '../layout-area-sizing-context';
|
|
25
|
+
import { chatPanelPanelSplitterId } from './chat-panel-panel-splitter-id';
|
|
25
26
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
26
27
|
import { getPanelGrowthSide } from './get-panel-growth-side';
|
|
27
28
|
import { getPercentageWithinPixelBounds } from './get-percentage-within-pixel-bounds';
|
|
@@ -40,6 +41,7 @@ function signPanelSplitterDragData(data) {
|
|
|
40
41
|
}
|
|
41
42
|
const containerStyles = {
|
|
42
43
|
root: "_12ji1r31 _1qu2glyw _12y31o36 _1e0cglyw _kqswstnw _u7coidpf _152tidpf _1pbykb7n _181n1ule",
|
|
44
|
+
visibleOnSmallScreens: "_1e0c1ule",
|
|
43
45
|
positionEnd: "_rjxpftgi",
|
|
44
46
|
positionStart: "_1e02zeo2"
|
|
45
47
|
};
|
|
@@ -48,7 +50,8 @@ const grabAreaStyles = {
|
|
|
48
50
|
rootFinesse: "_vp7g1ihb _30l31ihb _9h8hq98m"
|
|
49
51
|
};
|
|
50
52
|
const lineStyles = {
|
|
51
|
-
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
53
|
+
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z",
|
|
54
|
+
chatPanel: "_1e02rdoj"
|
|
52
55
|
};
|
|
53
56
|
const tooltipStyles = {
|
|
54
57
|
root: "_ahbq196n _1bsb1ris",
|
|
@@ -511,7 +514,7 @@ const PortaledPanelSplitter = ({
|
|
|
511
514
|
})}% width`, [rangeInputValue, rangeInputBounds]);
|
|
512
515
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
513
516
|
"data-testid": testId ? `${testId}-container` : undefined,
|
|
514
|
-
className: ax([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
517
|
+
className: ax([containerStyles.root, fg('platform-dst-chat-panel-layout') && onResizeInternal && position === 'start' && containerStyles.visibleOnSmallScreens, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
515
518
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
516
519
|
tooltipContent: tooltipContent,
|
|
517
520
|
shortcut: shortcut,
|
|
@@ -538,7 +541,7 @@ const PortaledPanelSplitter = ({
|
|
|
538
541
|
}), /*#__PURE__*/React.createElement("span", {
|
|
539
542
|
id: labelId
|
|
540
543
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
541
|
-
className: ax([lineStyles.root])
|
|
544
|
+
className: ax([lineStyles.root, panelId === chatPanelPanelSplitterId && lineStyles.chatPanel])
|
|
542
545
|
})))), portal);
|
|
543
546
|
};
|
|
544
547
|
/**
|
|
@@ -226,9 +226,9 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
226
226
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
227
227
|
var layoutMax = (_areaName2 === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
228
228
|
var defaultWidth = isSideNavOverlay ? (_area$compactDefaultW3 = _area.compactDefaultWidth) !== null && _area$compactDefaultW3 !== void 0 ? _area$compactDefaultW3 : _area.defaultWidth : _area.defaultWidth;
|
|
229
|
-
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)) : layoutMax;
|
|
230
|
-
var _max = isRefinedLayout && _areaName2 === 'panel' ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
231
|
-
var effectiveMin = isRefinedLayout && _areaName2 === 'panel' ? _min2 : Math.min(_min2, _max);
|
|
229
|
+
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;
|
|
230
|
+
var _max = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
231
|
+
var effectiveMin = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? _min2 : Math.min(_min2, _max);
|
|
232
232
|
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, _areaName2);
|
|
233
233
|
var _width2 = clampTargetWidth({
|
|
234
234
|
target: _target,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
18
18
|
._kqsw1if8{position:sticky}
|
|
19
19
|
._p12f1osq{max-width:100%}
|
|
20
|
+
._p12fglyw{max-width:none}
|
|
20
21
|
._qo371wug._qo371wug{z-index:auto}
|
|
21
22
|
._qo37qfx8._qo37qfx8{z-index:5}
|
|
22
23
|
._so1e130s._so1e130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
@@ -9,6 +9,7 @@ import { bind } from 'bind-event-listener';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
10
|
import { useSkipLinkInternal } from '../../context/skip-links/use-skip-link-internal';
|
|
11
11
|
import { chatPanelLiveWidthVar, chatPanelVar, defaultMainMinWidth, localSlotLayers, mainMinimumWidthVar } from './constants';
|
|
12
|
+
import { chatPanelPanelSplitterId } from './panel-splitter/chat-panel-panel-splitter-id';
|
|
12
13
|
import { convertResizeBoundToPixels } from './panel-splitter/convert-resize-bound-to-pixels';
|
|
13
14
|
import { PanelSplitterProvider } from './panel-splitter/provider';
|
|
14
15
|
import { resolveLayoutWidth } from './resolve-layout-width';
|
|
@@ -17,7 +18,6 @@ import { useLayoutAreaSizing } from './use-layout-area-sizing';
|
|
|
17
18
|
import { useLayoutId } from './use-layout-id';
|
|
18
19
|
import { useResizingWidthCssVarOnRootElement } from './use-resizing-width-css-var-on-root-element';
|
|
19
20
|
import { useSafeDefaultWidth } from './use-safe-default-width';
|
|
20
|
-
var chatPanelPanelSplitterId = Symbol('ChatPanel PanelSplitter');
|
|
21
21
|
var panelSplitterResizingVar = '--n_cPnlRsz';
|
|
22
22
|
var chatPanelOverlayWidthVar = '--n_cPnlOverlayW';
|
|
23
23
|
var fallbackDefaultWidth = 400;
|
|
@@ -31,6 +31,7 @@ function getPixelCustomProperty(element, propertyName, fallback) {
|
|
|
31
31
|
}
|
|
32
32
|
var styles = {
|
|
33
33
|
root: "_nd5lquub _10fph9n0 _vchhusvi _p12f1osq _1pbyqfx8 _4t3i56xv _kqsw1if8 _152t1nws _bfhk1bhr _1bsb1ky5 _qhdr1ym0 _m5h51wug _1ttbvuon _1mxh8rg1",
|
|
34
|
+
refinedOverlay: "_p12fglyw",
|
|
34
35
|
managedInline: "_12xt1ym0 _qo371wug _16hgvuon _w1ap8rg1",
|
|
35
36
|
managedOverlay: "_12xtquub _qo37qfx8 _16hg1bhr _w1ap1ky5",
|
|
36
37
|
scrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
@@ -46,6 +47,8 @@ var styles = {
|
|
|
46
47
|
* full-height column in the page layout grid.
|
|
47
48
|
*
|
|
48
49
|
* You can optionally render a `PanelSplitter` as a child to make the chat panel resizable.
|
|
50
|
+
* With chat layout enabled, Root retains separate inline and overlay resize preferences
|
|
51
|
+
* when ChatPanel is closed and remounted during the same layout session.
|
|
49
52
|
*/
|
|
50
53
|
export function ChatPanel(_ref) {
|
|
51
54
|
var _managedSizing$mode, _managedSizing$width;
|
|
@@ -93,14 +96,18 @@ export function ChatPanel(_ref) {
|
|
|
93
96
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
97
|
hasInlinePreference = _useState4[0],
|
|
95
98
|
setHasInlinePreference = _useState4[1];
|
|
96
|
-
var _useState5 = useState(
|
|
99
|
+
var _useState5 = useState(false),
|
|
97
100
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var _useState7 = useState(
|
|
101
|
+
hasOverlayPreference = _useState6[0],
|
|
102
|
+
setHasOverlayPreference = _useState6[1];
|
|
103
|
+
var _useState7 = useState(compactDefaultWidth),
|
|
101
104
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
overlayWidth = _useState8[0],
|
|
106
|
+
setOverlayWidth = _useState8[1];
|
|
107
|
+
var _useState9 = useState(false),
|
|
108
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
109
|
+
isInline = _useState0[0],
|
|
110
|
+
setIsInline = _useState0[1];
|
|
104
111
|
var _useLayoutAreaSizing = useLayoutAreaSizing({
|
|
105
112
|
area: 'chat-panel',
|
|
106
113
|
config: {
|
|
@@ -174,13 +181,16 @@ export function ChatPanel(_ref) {
|
|
|
174
181
|
}, [getManagedResizeBounds, maxWidth, minWidth]);
|
|
175
182
|
var configuredMaxWidth = maxWidth !== null && maxWidth !== void 0 ? maxWidth : '100vw';
|
|
176
183
|
var chatPanelVariableWidth = managedSizing ? "".concat(renderedWidth, "px") : "clamp(".concat(minWidth, ", ").concat(inlineWidth, "px, ").concat(configuredMaxWidth, ")");
|
|
177
|
-
var
|
|
184
|
+
var overlayDefault = "var(--n_chatDefaultW, ".concat(compactDefaultWidth, "px)");
|
|
185
|
+
var overlayMaximum = "max(".concat(minWidth, ", min(").concat(configuredMaxWidth, ", var(--n_layoutW, 100vw), max(").concat(overlayDefault, ", calc(var(--n_layoutW, 100vw) * 0.9))))");
|
|
186
|
+
var chatPanelOverlayVariableWidth = managedSizing ? "".concat(renderedWidth, "px") : fg('platform-dst-chat-panel-layout') ? "clamp(".concat(minWidth, ", ").concat(hasOverlayPreference ? "".concat(overlayWidth, "px") : overlayDefault, ", ").concat(overlayMaximum, ")") : "clamp(".concat(minWidth, ", ").concat(overlayWidth, "px, min(90vw, ").concat(configuredMaxWidth, "))");
|
|
178
187
|
var onCompleteResize = useCallback(function (finalWidth) {
|
|
179
188
|
if (mode === 'inline') {
|
|
180
189
|
setInlineWidth(finalWidth);
|
|
181
190
|
setHasInlinePreference(true);
|
|
182
191
|
} else {
|
|
183
192
|
setOverlayWidth(finalWidth);
|
|
193
|
+
setHasOverlayPreference(true);
|
|
184
194
|
}
|
|
185
195
|
completeResize(mode, finalWidth);
|
|
186
196
|
}, [completeResize, mode]);
|
|
@@ -194,7 +204,7 @@ export function ChatPanel(_ref) {
|
|
|
194
204
|
id: id,
|
|
195
205
|
"data-layout-slot": true,
|
|
196
206
|
"aria-label": label,
|
|
197
|
-
className: ax([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
207
|
+
className: ax([styles.root, hasBorder && styles.border, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, fg('platform-dst-chat-panel-layout') && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.refinedOverlay, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, hasBorder && (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlayBorder, xcss]),
|
|
198
208
|
style: _defineProperty(_defineProperty({}, chatPanelVar, chatPanelVariableWidth), chatPanelOverlayWidthVar, chatPanelOverlayVariableWidth),
|
|
199
209
|
"data-testid": testId,
|
|
200
210
|
"data-layout-chat-panel": "",
|
|
@@ -204,7 +214,7 @@ export function ChatPanel(_ref) {
|
|
|
204
214
|
// Hoist the committed or actively resizing inline width so SideNav can yield
|
|
205
215
|
// space to ChatPanel without allowing the page layout to overflow.
|
|
206
216
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
|
|
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), "
|
|
217
|
+
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_chatDefaultW: ").concat(compactDefaultWidth, "px; --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_chatDefaultW: ").concat(defaultWidth, "px; --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: ").concat(fg('platform-dst-chat-panel-layout') ? chatPanelOverlayVariableWidth : "min(calc(var(--n_layoutW) * 0.9), ".concat(chatPanelOverlayVariableWidth, ")"), ";\n ").concat(fg('platform-dst-chat-panel-layout') ? 'max-width: none;' : '', "\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 max-width: 100%;\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, {
|
|
208
218
|
panelId: chatPanelPanelSplitterId,
|
|
209
219
|
panelRef: ref,
|
|
210
220
|
panelWidth: renderedWidth,
|
|
@@ -7,6 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
import { bind } from 'bind-event-listener';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
11
|
import { calculateLayoutAreaStates } from './calculate-layout-area-states';
|
|
11
12
|
import { defaultMainMinWidth } from './constants';
|
|
12
13
|
import { LayoutAreaSizingContext } from './layout-area-sizing-context';
|
|
@@ -180,8 +181,17 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
180
181
|
if (!current[area]) {
|
|
181
182
|
return current;
|
|
182
183
|
}
|
|
184
|
+
if (area === 'chat-panel' && fg('platform-dst-chat-panel-layout')) {
|
|
185
|
+
// Chat's public close contract unmounts the slot. Keep preferences in Root,
|
|
186
|
+
// but release its allocation, in-progress resize and dismissal callback.
|
|
187
|
+
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, area, _objectSpread(_objectSpread({}, current[area]), {}, {
|
|
188
|
+
isOpen: false,
|
|
189
|
+
liveResize: undefined,
|
|
190
|
+
onRequestClose: undefined
|
|
191
|
+
})));
|
|
192
|
+
}
|
|
183
193
|
// Closing uses isOpen: false and retains preferences. Unregistering means
|
|
184
|
-
// the owning component unmounted
|
|
194
|
+
// the owning component unmounted. Only Chat retains preferences across this close path.
|
|
185
195
|
var next = _objectSpread({}, current);
|
|
186
196
|
delete next[area];
|
|
187
197
|
return next;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var chatPanelPanelSplitterId = Symbol('ChatPanel PanelSplitter');
|
|
@@ -30,6 +30,7 @@ import { requestClosePopovers } from '@atlaskit/top-layer/page-surface/request-c
|
|
|
30
30
|
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
31
31
|
import { contentInsetBlockStart } from '../constants';
|
|
32
32
|
import { LayoutAreaSizingContext } from '../layout-area-sizing-context';
|
|
33
|
+
import { chatPanelPanelSplitterId } from './chat-panel-panel-splitter-id';
|
|
33
34
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
34
35
|
import { getPanelGrowthSide } from './get-panel-growth-side';
|
|
35
36
|
import { getPercentageWithinPixelBounds } from './get-percentage-within-pixel-bounds';
|
|
@@ -45,6 +46,7 @@ function signPanelSplitterDragData(data) {
|
|
|
45
46
|
}
|
|
46
47
|
var containerStyles = {
|
|
47
48
|
root: "_12ji1r31 _1qu2glyw _12y31o36 _1e0cglyw _kqswstnw _u7coidpf _152tidpf _1pbykb7n _181n1ule",
|
|
49
|
+
visibleOnSmallScreens: "_1e0c1ule",
|
|
48
50
|
positionEnd: "_rjxpftgi",
|
|
49
51
|
positionStart: "_1e02zeo2"
|
|
50
52
|
};
|
|
@@ -53,7 +55,8 @@ var grabAreaStyles = {
|
|
|
53
55
|
rootFinesse: "_vp7g1ihb _30l31ihb _9h8hq98m"
|
|
54
56
|
};
|
|
55
57
|
var lineStyles = {
|
|
56
|
-
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
58
|
+
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z",
|
|
59
|
+
chatPanel: "_1e02rdoj"
|
|
57
60
|
};
|
|
58
61
|
var tooltipStyles = {
|
|
59
62
|
root: "_ahbq196n _1bsb1ris",
|
|
@@ -623,7 +626,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
623
626
|
}, [rangeInputValue, rangeInputBounds]);
|
|
624
627
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
625
628
|
"data-testid": testId ? "".concat(testId, "-container") : undefined,
|
|
626
|
-
className: ax([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
629
|
+
className: ax([containerStyles.root, fg('platform-dst-chat-panel-layout') && onResizeInternal && position === 'start' && containerStyles.visibleOnSmallScreens, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
627
630
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
628
631
|
tooltipContent: tooltipContent,
|
|
629
632
|
shortcut: shortcut,
|
|
@@ -650,7 +653,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
650
653
|
}), /*#__PURE__*/React.createElement("span", {
|
|
651
654
|
id: labelId
|
|
652
655
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
653
|
-
className: ax([lineStyles.root])
|
|
656
|
+
className: ax([lineStyles.root, panelId === chatPanelPanelSplitterId && lineStyles.chatPanel])
|
|
654
657
|
})))), portal);
|
|
655
658
|
};
|
|
656
659
|
/**
|
|
@@ -8,6 +8,8 @@ import type { CommonSlotProps } from './types';
|
|
|
8
8
|
* full-height column in the page layout grid.
|
|
9
9
|
*
|
|
10
10
|
* You can optionally render a `PanelSplitter` as a child to make the chat panel resizable.
|
|
11
|
+
* With chat layout enabled, Root retains separate inline and overlay resize preferences
|
|
12
|
+
* when ChatPanel is closed and remounted during the same layout session.
|
|
11
13
|
*/
|
|
12
14
|
export declare function ChatPanel({ children, defaultWidth: defaultWidthProp, compactDefaultWidth: compactDefaultWidthProp, minWidth, maxWidth, label, skipLinkLabel, testId, id: providedId, xcss, hasBorder, onClose, }: CommonSlotProps & {
|
|
13
15
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chatPanelPanelSplitterId: symbol;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.6",
|
|
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",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"@atlassian/panel-system": "^2.0.0",
|
|
130
130
|
"@atlassian/react-async": "^0.23.0",
|
|
131
131
|
"@atlassian/react-entrypoint": "^1.1.0",
|
|
132
|
-
"@atlassian/search-dialog": "^10.
|
|
132
|
+
"@atlassian/search-dialog": "^10.34.0",
|
|
133
133
|
"@atlassian/ssr-tests": "workspace:^",
|
|
134
134
|
"@atlassian/test-utils": "^1.1.0",
|
|
135
135
|
"@atlassian/testing-library": "^0.12.0",
|