@atlaskit/navigation-system 11.3.4 → 11.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +20 -0
  3. package/constellation/layout/code.mdx +1 -1
  4. package/constellation/layout/examples.mdx +4 -16
  5. package/constellation/layout/images/layout-anatomy-dark.png +0 -0
  6. package/constellation/layout/images/layout-anatomy-light.png +0 -0
  7. package/constellation/layout/images/layout-do-dark.png +0 -0
  8. package/constellation/layout/images/layout-do-light.png +0 -0
  9. package/constellation/layout/images/layout-dont-dark.png +0 -0
  10. package/constellation/layout/images/layout-dont-light.png +0 -0
  11. package/constellation/layout/images/layout-example-dark.png +0 -0
  12. package/constellation/layout/images/layout-example-light.png +0 -0
  13. package/constellation/layout/images/layout-example-sideNav-dark.png +0 -0
  14. package/constellation/layout/images/layout-example-sideNav-light.png +0 -0
  15. package/constellation/layout/images/layout-example-topNav-1-dark.png +0 -0
  16. package/constellation/layout/images/layout-example-topNav-1-light.png +0 -0
  17. package/constellation/layout/usage.mdx +1 -2
  18. package/constellation/top-nav-items/examples.mdx +7 -13
  19. package/dist/cjs/entry-points/layout/panel-layout.js +19 -0
  20. package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +4 -4
  21. package/dist/cjs/ui/page-layout/chat-panel.js +1 -1
  22. package/dist/cjs/ui/page-layout/constants.js +15 -1
  23. package/dist/cjs/ui/page-layout/get-panel-layout-defaults.js +22 -0
  24. package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +2 -1
  25. package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +5 -4
  26. package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +26 -0
  27. package/dist/cjs/ui/page-layout/local-panel-surface.js +206 -0
  28. package/dist/cjs/ui/page-layout/main/main.js +5 -2
  29. package/dist/cjs/ui/page-layout/main-min-width-context.js +10 -0
  30. package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  31. package/dist/cjs/ui/page-layout/panel-layout-shell.js +67 -0
  32. package/dist/cjs/ui/page-layout/panel-layout.js +162 -0
  33. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
  34. package/dist/cjs/ui/page-layout/side-nav/side-nav.js +1 -1
  35. package/dist/es2019/entry-points/layout/panel-layout.js +2 -0
  36. package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +4 -4
  37. package/dist/es2019/ui/page-layout/chat-panel.js +2 -2
  38. package/dist/es2019/ui/page-layout/constants.js +14 -0
  39. package/dist/es2019/ui/page-layout/get-panel-layout-defaults.js +16 -0
  40. package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +2 -1
  41. package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +4 -3
  42. package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +26 -0
  43. package/dist/es2019/ui/page-layout/local-panel-surface.js +193 -0
  44. package/dist/es2019/ui/page-layout/main/main.js +6 -3
  45. package/dist/es2019/ui/page-layout/main-min-width-context.js +5 -0
  46. package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  47. package/dist/es2019/ui/page-layout/panel-layout-shell.js +74 -0
  48. package/dist/es2019/ui/page-layout/panel-layout.js +147 -0
  49. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
  50. package/dist/es2019/ui/page-layout/side-nav/side-nav.js +2 -2
  51. package/dist/esm/entry-points/layout/panel-layout.js +2 -0
  52. package/dist/esm/ui/page-layout/calculate-layout-area-states.js +4 -4
  53. package/dist/esm/ui/page-layout/chat-panel.js +2 -2
  54. package/dist/esm/ui/page-layout/constants.js +14 -0
  55. package/dist/esm/ui/page-layout/get-panel-layout-defaults.js +16 -0
  56. package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +2 -1
  57. package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +4 -3
  58. package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +26 -0
  59. package/dist/esm/ui/page-layout/local-panel-surface.js +197 -0
  60. package/dist/esm/ui/page-layout/main/main.js +6 -3
  61. package/dist/esm/ui/page-layout/main-min-width-context.js +5 -0
  62. package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  63. package/dist/esm/ui/page-layout/panel-layout-shell.js +59 -0
  64. package/dist/esm/ui/page-layout/panel-layout.js +154 -0
  65. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
  66. package/dist/esm/ui/page-layout/side-nav/side-nav.js +2 -2
  67. package/dist/types/entry-points/layout/panel-layout.d.ts +3 -0
  68. package/dist/types/ui/page-layout/constants.d.ts +12 -0
  69. package/dist/types/ui/page-layout/get-panel-layout-defaults.d.ts +10 -0
  70. package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +5 -1
  71. package/dist/types/ui/page-layout/local-panel-surface.d.ts +32 -0
  72. package/dist/types/ui/page-layout/main-min-width-context.d.ts +2 -0
  73. package/dist/types/ui/page-layout/panel-layout-shell.d.ts +47 -0
  74. package/dist/types/ui/page-layout/panel-layout.d.ts +74 -0
  75. package/layout/panel-layout/package.json +10 -0
  76. package/package.json +4 -4
  77. package/constellation/layout/images/layout-example-topNav-2-dark.png +0 -3
  78. package/constellation/layout/images/layout-example-topNav-2-light.png +0 -3
@@ -13,6 +13,7 @@ var _runtime = require("@compiled/react/runtime");
13
13
  var _fg = require("@atlaskit/platform-feature-flags/fg");
14
14
  var _useSkipLink = require("../../../context/skip-links/use-skip-link");
15
15
  var _constants = require("../constants");
16
+ var _mainMinWidthContext = require("../main-min-width-context");
16
17
  var _root = require("../root");
17
18
  var _useLayoutId = require("../use-layout-id");
18
19
  var _useLayoutMainSizing = require("../use-layout-main-sizing");
@@ -34,7 +35,7 @@ function Main(_ref) {
34
35
  testId = _ref.testId,
35
36
  providedId = _ref.id,
36
37
  _ref$minWidth = _ref.minWidth,
37
- minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth;
38
+ minWidth = _ref$minWidth === void 0 ? _constants.defaultMainMinWidth : _ref$minWidth;
38
39
  var id = (0, _useLayoutId.useLayoutId)({
39
40
  providedId: providedId
40
41
  });
@@ -49,5 +50,7 @@ function Main(_ref) {
49
50
  className: (0, _runtime.ax)([mainElementStyles.root, xcss]),
50
51
  role: "main",
51
52
  "data-testid": testId
52
- }, children));
53
+ }, /*#__PURE__*/React.createElement(_mainMinWidthContext.MainMinWidthContext.Provider, {
54
+ value: (0, _fg.fg)('platform-dst-chat-panel-layout') ? minWidth : _constants.defaultMainMinWidth
55
+ }, children)));
53
56
  }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MainMinWidthContext = void 0;
7
+ var _react = require("react");
8
+ var _constants = require("./constants");
9
+ // Available during SSR, before Main registers with the measured sizing coordinator.
10
+ var MainMinWidthContext = exports.MainMinWidthContext = /*#__PURE__*/(0, _react.createContext)(_constants.defaultMainMinWidth);
@@ -0,0 +1,27 @@
1
+ ._nd5l1gzg{grid-area:main}._129o1uuk{--p_lclPnlSsrPreferredW:var(--p_lclPnlCompactW)}
2
+ ._18m915vq{overflow-y:hidden}
3
+ ._18m91wug{overflow-y:auto}
4
+ ._19121cl4{isolation:isolate}
5
+ ._1bsb1osq{width:100%}
6
+ ._1e0c11p5{display:grid}
7
+ ._1e0c1txw{display:flex}
8
+ ._1f38177r{container-name:local-panel-layout}
9
+ ._1l7c1wug._1l7c1wug{grid-template-rows:auto}
10
+ ._1l7chkll._1l7chkll{grid-template-rows:1fr}
11
+ ._1lmc1m6a{grid-template-areas:"main"}
12
+ ._1lmcc53r{grid-template-areas:var(--p_lclPnlSsrAreas,"main")}
13
+ ._1reo15vq{overflow-x:hidden}
14
+ ._1reo1wug{overflow-x:auto}
15
+ ._1uwq15vq._1uwq15vq{overflow-x:hidden}
16
+ ._2z05hkll{grid-template-rows:1fr}
17
+ ._4t3i1osq{height:100%}
18
+ ._7cca15wb{container-type:inline-size}
19
+ ._82e815vq._82e815vq{overflow-y:hidden}
20
+ ._evra4a59{--p_lclPnlSsrInlineAreas:"main panel"}
21
+ ._f8371m6a._f8371m6a{grid-template-areas:"main"}
22
+ ._f8374a59._f8374a59{grid-template-areas:"main panel"}
23
+ ._vleg1orf._vleg1orf{grid-template-columns:minmax(var(--n_mainMinW,20pc),1fr) clamp(var(--p_lclPnlMinW),var(--p_lclPnlRsz,var(--p_lclPnlTrackW)),calc(100% - var(--n_mainMinW, 20pc)))}
24
+ ._vlegi47z._vlegi47z{grid-template-columns:minmax(0,1fr)}
25
+ ._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
26
+ ._yv0ei47z{grid-template-columns:minmax(0,1fr)}
27
+ @media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}}
@@ -0,0 +1,67 @@
1
+ /* panel-layout-shell.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.PanelLayoutShell = PanelLayoutShell;
10
+ require("./panel-layout-shell.compiled.css");
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
13
+ var _runtime = require("@compiled/react/runtime");
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _mainMinWidthContext = require("./main-min-width-context");
16
+ 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); }
17
+ // The grid uses runtime CSS variables and container sizing outside @atlaskit/css's bounded values.
18
+ var localPanelTrackWidthVar = '--p_lclPnlTrackW';
19
+ var localPanelResizingVar = '--p_lclPnlRsz';
20
+ var localPanelMinWidthVar = '--p_lclPnlMinW';
21
+ var styles = {
22
+ container: "_1f38177r _7cca15wb _4t3i1osq _1bsb1osq",
23
+ layout: "_1reo1wug _18m91wug _1e0c11p5 _7cca15wb _1lmc1m6a _yv0ei47z _2z05hkll _4t3i1osq _1bsb1osq",
24
+ mainContent: "_nd5l1gzg _1reo1wug _18m91wug _1e0c1txw _4t3i1osq _19121cl4",
25
+ panelUplift: "_1reo15vq _18m915vq",
26
+ unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6 _129o1uuk _peezi77x",
27
+ managedInline: "_1uwq15vq _82e815vq _f8374a59 _1l7c1wug _vleg1orf",
28
+ managedOverlay: "_1uwq15vq _82e815vq _f8371m6a _vlegi47z _1l7chkll",
29
+ panelClosed: "_f8371m6a _vlegi47z _1l7chkll"
30
+ };
31
+ /**
32
+ * Grid and scrolling for Main and its local panel. Use inside navigation's Root and Main.
33
+ */
34
+ function PanelLayoutShell(_ref) {
35
+ var children = _ref.children,
36
+ panel = _ref.panel,
37
+ isPanelOpen = _ref.isPanelOpen,
38
+ panelWidth = _ref.panelWidth,
39
+ compactPanelWidth = _ref.compactPanelWidth,
40
+ _ref$panelMinWidth = _ref.panelMinWidth,
41
+ panelMinWidth = _ref$panelMinWidth === void 0 ? 320 : _ref$panelMinWidth,
42
+ mode = _ref.mode,
43
+ layoutRef = _ref.layoutRef,
44
+ _ref$shouldClipOverfl = _ref.shouldClipOverflow,
45
+ shouldClipOverflow = _ref$shouldClipOverfl === void 0 ? false : _ref$shouldClipOverfl,
46
+ testId = _ref.testId;
47
+ var mainMinWidth = (0, _react.useContext)(_mainMinWidthContext.MainMinWidthContext);
48
+ var id = "local-panel-".concat((0, _react.useId)().replace(/[^a-zA-Z0-9_-]/g, '_'));
49
+ // CSS query conditions cannot read custom properties. Only the numeric minimums and
50
+ // instance selector are generated here; this rule is removed after the first measurement,
51
+ // so live resizing never rewrites stylesheet text. The named container is local to this shell.
52
+ var inlineQuery = "@container local-panel-layout (min-width: ".concat(mainMinWidth + panelMinWidth, "px)");
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: (0, _runtime.ax)([styles.container])
55
+ }, mode === undefined && isPanelOpen &&
56
+ /*#__PURE__*/
57
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Instance-scoped SSR query supports caller-defined minimums; CSS variables are not allowed in query conditions.
58
+ React.createElement("style", null, "".concat(inlineQuery, " {\n\t\t\t\t\t#").concat(id, " {\n\t\t\t\t\t\t--p_lclPnlSsrAreas: var(--p_lclPnlSsrInlineAreas);\n\t\t\t\t\t\t--p_lclPnlSsrColumns: minmax(0, 1fr) min(var(--p_lclPnlSsrPreferredW), calc(100% - ").concat(mainMinWidth, "px));\n\t\t\t\t\t\t--p_lclPnlSsrArea: panel;\n\t\t\t\t\t\t--p_lclPnlSsrWidth: 100%;\n\t\t\t\t\t\t--p_lclPnlSsrBackground: ", "var(--ds-surface, #FFFFFF)", ";\n\t\t\t\t\t\t--p_lclPnlSsrShadow: none;\n\t\t\t\t\t\t--p_lclPnlSsrBorder: ", "var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";\n\t\t\t\t\t}\n\t\t\t\t}")), /*#__PURE__*/React.createElement("div", {
59
+ id: id,
60
+ "data-testid": testId,
61
+ ref: layoutRef,
62
+ style: (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, localPanelTrackWidthVar, "".concat(panelWidth, "px")), localPanelMinWidthVar, "".concat(panelMinWidth, "px")), '--p_lclPnlCompactW', "".concat(compactPanelWidth, "px")),
63
+ className: (0, _runtime.ax)([styles.layout, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
64
+ }, /*#__PURE__*/React.createElement("div", {
65
+ className: (0, _runtime.ax)([styles.mainContent])
66
+ }, children), panel));
67
+ }
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.PanelLayout = PanelLayout;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
12
+ var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
13
+ var _exitingPersistence = _interopRequireDefault(require("@atlaskit/motion/exiting-persistence"));
14
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
15
+ var _getPanelLayoutDefaults = require("./get-panel-layout-defaults");
16
+ var _layoutAreaSizingContext = require("./layout-area-sizing-context");
17
+ var _layoutAreaSizingProvider = require("./layout-area-sizing-provider");
18
+ var _localPanelSurface = require("./local-panel-surface");
19
+ var _panelLayoutShell = require("./panel-layout-shell");
20
+ var _useLayoutAreaSizing2 = require("./use-layout-area-sizing");
21
+ 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); }
22
+ // Development-only ownership checks are scoped to each coordinator, not the whole page.
23
+ var mountedPanelLayouts = new WeakSet();
24
+ function CoordinatedPanelLayout(_ref) {
25
+ var _ref2, _ref3, _ref4, _state$width;
26
+ var children = _ref.children,
27
+ panel = _ref.panel,
28
+ isPanelOpen = _ref.isPanelOpen,
29
+ panelKey = _ref.panelKey,
30
+ panelWidth = _ref.panelWidth,
31
+ defaultPanelWidth = _ref.defaultPanelWidth,
32
+ compactDefaultPanelWidth = _ref.compactDefaultPanelWidth,
33
+ suppliedMinWidth = _ref.panelMinWidth,
34
+ panelMaxWidth = _ref.panelMaxWidth,
35
+ onPanelWidthChange = _ref.onPanelWidthChange,
36
+ onResizeEnd = _ref.onResizeEnd,
37
+ _ref$panelLabel = _ref.panelLabel,
38
+ panelLabel = _ref$panelLabel === void 0 ? 'Panel' : _ref$panelLabel,
39
+ _ref$resizeLabel = _ref.resizeLabel,
40
+ resizeLabel = _ref$resizeLabel === void 0 ? 'Resize panel' : _ref$resizeLabel,
41
+ testId = _ref.testId,
42
+ layoutRef = _ref.layoutRef;
43
+ var _useState = (0, _react.useState)(_getPanelLayoutDefaults.getPanelLayoutDefaults),
44
+ _useState2 = (0, _slicedToArray2.default)(_useState, 1),
45
+ defaults = _useState2[0];
46
+ var panelMinWidth = suppliedMinWidth !== null && suppliedMinWidth !== void 0 ? suppliedMinWidth : defaults.panelMinWidth;
47
+ var coordinator = (0, _react.useContext)(_layoutAreaSizingContext.LayoutAreaSizingContext);
48
+ (0, _react.useEffect)(function () {
49
+ if (process.env.NODE_ENV !== 'production' && coordinator) {
50
+ (0, _tinyInvariant.default)(!mountedPanelLayouts.has(coordinator), 'Only one PanelLayout may be mounted per navigation Root/sizing coordinator, including closed hosts and LayoutWithPanel. Reuse the host to switch panel content.');
51
+ mountedPanelLayouts.add(coordinator);
52
+ return function () {
53
+ mountedPanelLayouts.delete(coordinator);
54
+ };
55
+ }
56
+ }, [coordinator]);
57
+ var _useState3 = (0, _react.useState)((_ref2 = defaultPanelWidth !== null && defaultPanelWidth !== void 0 ? defaultPanelWidth : panelWidth) !== null && _ref2 !== void 0 ? _ref2 : defaults.panelWidth),
58
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
59
+ defaultWidth = _useState4[0];
60
+ var _useState5 = (0, _react.useState)((_ref3 = (_ref4 = compactDefaultPanelWidth !== null && compactDefaultPanelWidth !== void 0 ? compactDefaultPanelWidth : defaultPanelWidth) !== null && _ref4 !== void 0 ? _ref4 : panelWidth) !== null && _ref3 !== void 0 ? _ref3 : defaults.compactPanelWidth),
61
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 1),
62
+ compactWidth = _useState6[0];
63
+ // Use the controlled request before measurement too, without changing the mount-time default.
64
+ var fallbackWidth = Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaultWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity));
65
+ var _useLayoutAreaSizing = (0, _useLayoutAreaSizing2.useLayoutAreaSizing)({
66
+ area: 'panel',
67
+ config: {
68
+ isOpen: isPanelOpen,
69
+ requestedWidth: panelWidth,
70
+ defaultWidth: defaultWidth,
71
+ compactDefaultWidth: compactWidth,
72
+ minWidth: panelMinWidth,
73
+ maxWidth: panelMaxWidth
74
+ }
75
+ }),
76
+ state = _useLayoutAreaSizing.state,
77
+ prepareResize = _useLayoutAreaSizing.prepareResize,
78
+ getResizeBounds = _useLayoutAreaSizing.getResizeBounds,
79
+ startResize = _useLayoutAreaSizing.startResize,
80
+ resize = _useLayoutAreaSizing.resize,
81
+ completeResize = _useLayoutAreaSizing.completeResize;
82
+ // Host callback identity is unrelated to sizing. Keep drag bindings stable while
83
+ // still delivering completions to the latest product-owned state and analytics.
84
+ var onWidthChangeRef = (0, _useStableRef.default)(onPanelWidthChange);
85
+ var onResizeEndRef = (0, _useStableRef.default)(onResizeEnd);
86
+ var handleWidthChange = (0, _react.useCallback)(function (width) {
87
+ var _onWidthChangeRef$cur;
88
+ return (_onWidthChangeRef$cur = onWidthChangeRef.current) === null || _onWidthChangeRef$cur === void 0 ? void 0 : _onWidthChangeRef$cur.call(onWidthChangeRef, width);
89
+ }, [onWidthChangeRef]);
90
+ var handleResizeEnd = (0, _react.useCallback)(function (event) {
91
+ var _onResizeEndRef$curre;
92
+ return (_onResizeEndRef$curre = onResizeEndRef.current) === null || _onResizeEndRef$curre === void 0 ? void 0 : _onResizeEndRef$curre.call(onResizeEndRef, event);
93
+ }, [onResizeEndRef]);
94
+ var isMotionEnabled = (0, _fg.fg)('platform-dst-motion-uplift-panel');
95
+ var surface = isPanelOpen && /*#__PURE__*/_react.default.createElement(_localPanelSurface.LocalPanelSurface, {
96
+ key: "local-panel",
97
+ contentKey: panelKey,
98
+ defaultWidth: fallbackWidth,
99
+ minWidth: panelMinWidth,
100
+ maxWidth: panelMaxWidth,
101
+ layoutRef: layoutRef,
102
+ managedSizing: state,
103
+ getManagedResizeBounds: getResizeBounds,
104
+ prepareResize: prepareResize,
105
+ onManagedResizeStart: startResize,
106
+ onManagedResize: resize,
107
+ onManagedResizeEnd: completeResize,
108
+ onWidthChange: handleWidthChange,
109
+ onResizeEnd: handleResizeEnd,
110
+ label: panelLabel,
111
+ resizeLabel: resizeLabel,
112
+ testId: testId && "".concat(testId, "--panel-slot")
113
+ }, panel);
114
+ return /*#__PURE__*/_react.default.createElement(_panelLayoutShell.PanelLayoutShell, {
115
+ isPanelOpen: isPanelOpen,
116
+ panelWidth: (_state$width = state === null || state === void 0 ? void 0 : state.width) !== null && _state$width !== void 0 ? _state$width : fallbackWidth,
117
+ compactPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : compactWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
118
+ panelMinWidth: panelMinWidth,
119
+ mode: state === null || state === void 0 ? void 0 : state.mode,
120
+ layoutRef: layoutRef,
121
+ shouldClipOverflow: isMotionEnabled,
122
+ testId: testId,
123
+ panel: isMotionEnabled ? /*#__PURE__*/_react.default.createElement(_exitingPersistence.default, null, surface) : surface
124
+ }, children);
125
+ }
126
+
127
+ /**
128
+ * A coordinated local panel with caller-owned content and state. Keep this host mounted
129
+ * while closed to retain resized widths. Unmount it to reset its width preferences.
130
+ *
131
+ * Mount only one local-panel host per navigation Root/sizing coordinator, including
132
+ * closed hosts and panel-system's LayoutWithPanel. Switch content through the same host;
133
+ * separate Roots may each own a local panel.
134
+ *
135
+ * With chat layout enabled it shares Root's sizing coordinator. Otherwise it measures
136
+ * its own Main region, leaving existing navigation/chat behavior unchanged.
137
+ * Local-panel placement and resize constraints use this layout in both cases; disabling
138
+ * the chat-layout gate does not restore the previous panel-system layout engine.
139
+ */
140
+ function PanelLayout(props) {
141
+ var parentSizing = (0, _react.useContext)(_layoutAreaSizingContext.LayoutAreaSizingContext);
142
+ var layoutRef = (0, _react.useRef)(null);
143
+ var content = /*#__PURE__*/_react.default.createElement(CoordinatedPanelLayout, {
144
+ layoutRef: layoutRef,
145
+ panel: props.panel,
146
+ isPanelOpen: props.isPanelOpen,
147
+ panelKey: props.panelKey,
148
+ panelWidth: props.panelWidth,
149
+ defaultPanelWidth: props.defaultPanelWidth,
150
+ compactDefaultPanelWidth: props.compactDefaultPanelWidth,
151
+ panelMinWidth: props.panelMinWidth,
152
+ panelMaxWidth: props.panelMaxWidth,
153
+ onPanelWidthChange: props.onPanelWidthChange,
154
+ onResizeEnd: props.onResizeEnd,
155
+ panelLabel: props.panelLabel,
156
+ resizeLabel: props.resizeLabel,
157
+ testId: props.testId
158
+ }, props.children);
159
+ return parentSizing ? content : /*#__PURE__*/_react.default.createElement(_layoutAreaSizingProvider.LayoutAreaSizingProvider, {
160
+ layoutRef: layoutRef
161
+ }, content);
162
+ }
@@ -194,7 +194,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
194
194
  var initialClientXRef = (0, _react.useRef)(null);
195
195
  // Live allocation changes panelWidth on every frame. Only the legacy path should
196
196
  // rebind the drag listeners when this value changes.
197
- var legacyPanelWidth = (0, _fg.fg)('platform-dst-chat-panel-layout') ? undefined : panelWidth;
197
+ var legacyPanelWidth = (0, _fg.fg)('platform-dst-chat-panel-layout') || onResizeInternal ? undefined : panelWidth;
198
198
  (0, _react.useEffect)(function () {
199
199
  var splitter = splitterRef.current;
200
200
  (0, _tinyInvariant.default)(splitter, 'Splitter ref must be set');
@@ -303,7 +303,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
303
303
  position: position
304
304
  });
305
305
  var resizingWidth = "clamp(".concat(resizeBounds.min, ", ").concat(targetWidth, "px, ").concat(resizeBounds.max, ")");
306
- if ((0, _fg.fg)('platform-dst-chat-panel-layout') && onResizeInternal) {
306
+ if (onResizeInternal) {
307
307
  // The allocator needs below-minimum requests for the local-to-chat cascade.
308
308
  var currentBounds = getResizeBounds();
309
309
  var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : (0, _convertResizeBoundToPixels.convertResizeBoundToPixels)(currentBounds.max)));
@@ -359,7 +359,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
359
359
  }
360
360
  finalWidth = (0, _getPixelWidth.getPixelWidth)(panel); // Persist the final preferred width before removing the imperative drag
361
361
  // variable, so the rendered width is continuous across pointer release.
362
- if ((0, _fg.fg)('platform-dst-chat-panel-layout')) {
362
+ if ((0, _fg.fg)('platform-dst-chat-panel-layout') || onResizeInternal) {
363
363
  (0, _reactDom.flushSync)(function () {
364
364
  return onCompleteResize(finalWidth);
365
365
  });
@@ -416,7 +416,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
416
416
  return _regenerator.default.wrap(function (_context2) {
417
417
  while (1) switch (_context2.prev = _context2.next) {
418
418
  case 0:
419
- isManagedResize = (0, _fg.fg)('platform-dst-chat-panel-layout') && onResizeInternal;
419
+ isManagedResize = onResizeInternal;
420
420
  sequence = focusSequence.current;
421
421
  value = isManagedResize ? parseFloat(event.currentTarget.value) : parseInt(event.currentTarget.value);
422
422
  if (!prepareResize) {
@@ -362,7 +362,7 @@ function SideNavInternal(_ref4) {
362
362
  var isLocalPanelInline = localPanel && getComputedStyle(localPanel).gridArea === 'panel';
363
363
  var localPanelWidth = isLocalPanelInline ? localPanel.getBoundingClientRect().width : 0;
364
364
  var mainContentWidth = mainWidth - localPanelWidth;
365
- var mainMinimumWidth = getPixelCustomProperty(main, _constants.mainMinimumWidthVar, 320);
365
+ var mainMinimumWidth = getPixelCustomProperty(main, _constants.mainMinimumWidthVar, _constants.defaultMainMinWidth);
366
366
  var availableWidth = Math.max(0, mainContentWidth - mainMinimumWidth);
367
367
  var availableInlineWidth = Math.floor(sideNavWidth + availableWidth);
368
368
  var constrainedMaxWidth = maxWidth ? Math.min((0, _convertResizeBoundToPixels.convertResizeBoundToPixels)(maxWidth), availableInlineWidth) : availableInlineWidth;
@@ -0,0 +1,2 @@
1
+ export { PanelLayout } from '../../ui/page-layout/panel-layout';
2
+ export { localPanelWidthVar } from '../../ui/page-layout/constants';
@@ -9,12 +9,12 @@ function clampTargetWidth({
9
9
  function getTargetWidth(area, isSideNavOverlay) {
10
10
  var _area$compactDefaultW, _area$liveResize, _ref, _area$requestedWidth;
11
11
  const defaultWidth = isSideNavOverlay ? (_area$compactDefaultW = area.compactDefaultWidth) !== null && _area$compactDefaultW !== void 0 ? _area$compactDefaultW : area.defaultWidth : area.defaultWidth;
12
- return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredInlineWidth) !== null && _ref !== void 0 ? _ref : defaultWidth;
12
+ return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredWidth) !== null && _ref !== void 0 ? _ref : defaultWidth;
13
13
  }
14
- function getOverlayTargetWidth(area, isSideNavOverlay) {
14
+ function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
15
15
  var _area$compactDefaultW2, _area$liveResize2, _ref2, _area$requestedWidth2;
16
16
  const defaultWidth = isSideNavOverlay ? (_area$compactDefaultW2 = area.compactDefaultWidth) !== null && _area$compactDefaultW2 !== void 0 ? _area$compactDefaultW2 : area.defaultWidth : area.defaultWidth;
17
- return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref2 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : area.preferredOverlayWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
17
+ return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref2 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : areaName === 'panel' ? area.preferredWidth : area.preferredOverlayWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
18
18
  }
19
19
  export function calculateLayoutAreaStates({
20
20
  viewportWidth,
@@ -142,7 +142,7 @@ export function calculateLayoutAreaStates({
142
142
  const layoutMax = (areaName === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
143
143
  const max = Math.max(0, Math.min(configuredMax, layoutMax));
144
144
  const effectiveMin = Math.min(min, max);
145
- const target = getOverlayTargetWidth(area, isSideNavOverlay);
145
+ const target = getOverlayTargetWidth(area, isSideNavOverlay, areaName);
146
146
  const width = clampTargetWidth({
147
147
  target,
148
148
  min: effectiveMin,
@@ -6,7 +6,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
6
6
  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
- import { chatPanelLiveWidthVar, chatPanelVar, localSlotLayers, mainMinimumWidthVar } from './constants';
9
+ import { chatPanelLiveWidthVar, chatPanelVar, defaultMainMinWidth, localSlotLayers, mainMinimumWidthVar } from './constants';
10
10
  import { convertResizeBoundToPixels } from './panel-splitter/convert-resize-bound-to-pixels';
11
11
  import { PanelSplitterProvider } from './panel-splitter/provider';
12
12
  import { resolveLayoutWidth } from './resolve-layout-width';
@@ -139,7 +139,7 @@ export function ChatPanel({
139
139
  const localPanel = main.querySelector('[data-layout-with-panel-slot]');
140
140
  const isLocalPanelInline = localPanel && getComputedStyle(localPanel).gridArea === 'panel';
141
141
  const localPanelWidth = isLocalPanelInline ? localPanel.getBoundingClientRect().width : 0;
142
- const mainMinimumWidth = getPixelCustomProperty(main, mainMinimumWidthVar, 320);
142
+ const mainMinimumWidth = getPixelCustomProperty(main, mainMinimumWidthVar, defaultMainMinWidth);
143
143
  const mainContentWidth = mainWidth - localPanelWidth;
144
144
  const availableWidth = Math.max(0, mainContentWidth - mainMinimumWidth);
145
145
  const availableInlineWidth = Math.floor(chatPanelWidth + availableWidth);
@@ -4,6 +4,11 @@
4
4
  * We have chosen to ignore this rule to prevent duplicating them across the different slots, and to provide a high level view of them and how they relate.
5
5
  */
6
6
 
7
+ /**
8
+ * Default minimum width of Main, in pixels, before a custom minimum is registered.
9
+ */
10
+ export const defaultMainMinWidth = 320;
11
+
7
12
  // These are "compressed" to discourage usage.
8
13
  export const sideNavVar = '--n_sNvw';
9
14
  export const asideVar = '--n_asDw';
@@ -15,6 +20,15 @@ export const bannerMountedVar = '--n_bnrM';
15
20
  export const topNavMountedVar = '--n_tNvM';
16
21
  export const ribbonVar = '--n_rbnW';
17
22
 
23
+ /**
24
+ * Rendered border-box width of the local PanelLayout surface, in both inline and overlay modes.
25
+ * Published on document.documentElement after mounting when Root opts into
26
+ * UNSAFE_dangerouslyHoistSlotSizes. Only the primary Root should opt in.
27
+ * Use `var(${localPanelWidthVar}, 0px)` for external controls, not for width persistence
28
+ * or sizing the panel itself. The property is removed when the surface unmounts.
29
+ */
30
+ export const localPanelWidthVar = '--n_localPanelWidth';
31
+
18
32
  /**
19
33
  * Captures the current width of the side navigation, at all times, including during resizing.
20
34
  *
@@ -0,0 +1,16 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
2
+ const DEFAULT_PANEL_WIDTH = 365;
3
+ const DEFAULT_PANEL_WIDTH_WITH_CHAT_PANEL_LAYOUT = 400;
4
+
5
+ /**
6
+ * Local-panel defaults in pixels, used only when no explicit preference exists.
7
+ * Keep the existing desktop width until chat layout rolls out. Compact sizing is independent.
8
+ * These are requested defaults, not measurements of an open panel.
9
+ */
10
+ export function getPanelLayoutDefaults() {
11
+ return {
12
+ panelWidth: fg('platform-dst-chat-panel-layout') ? DEFAULT_PANEL_WIDTH_WITH_CHAT_PANEL_LAYOUT : DEFAULT_PANEL_WIDTH,
13
+ compactPanelWidth: 320,
14
+ panelMinWidth: 320
15
+ };
16
+ }
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { bind, bindAll } from 'bind-event-listener';
3
+ import { defaultMainMinWidth } from './constants';
3
4
  import { LayoutAreaSizingContext } from './layout-area-sizing-context';
4
5
  import { layoutAreaStateContexts } from './layout-area-state-contexts';
5
6
  import { useCssLayoutAreaStates } from './use-css-layout-area-states';
@@ -50,7 +51,7 @@ export function LayoutAreaSizingProvider({
50
51
  listener: dismissOlderOverlay
51
52
  });
52
53
  }, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
53
- const mainMinWidth = useRef(320);
54
+ const mainMinWidth = useRef(defaultMainMinWidth);
54
55
  const loadRef = useRef(() => {});
55
56
  const ready = useRef(false);
56
57
  const waiting = useRef([]);
@@ -1,11 +1,11 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { bind } from 'bind-event-listener';
3
3
  import { calculateLayoutAreaStates } from './calculate-layout-area-states';
4
+ import { defaultMainMinWidth } from './constants';
4
5
  import { LayoutAreaSizingContext } from './layout-area-sizing-context';
5
6
  import { layoutAreaStateContexts } from './layout-area-state-contexts';
6
7
  import { resolveLayoutWidth } from './resolve-layout-width';
7
8
  import { useOccupiedLayoutWidth } from './use-occupied-layout-width';
8
- const defaultMainMinWidth = 320;
9
9
  function useStableAreaState(state) {
10
10
  const {
11
11
  mode,
@@ -274,7 +274,7 @@ export function LayoutAreaSizingRuntime({
274
274
  if (!existing) {
275
275
  return current;
276
276
  }
277
- if (mode === 'overlay') {
277
+ if (mode === 'overlay' && area !== 'panel') {
278
278
  return {
279
279
  ...current,
280
280
  [area]: {
@@ -289,7 +289,8 @@ export function LayoutAreaSizingRuntime({
289
289
  [area]: {
290
290
  ...existing,
291
291
  liveResize: undefined,
292
- preferredInlineWidth: width
292
+ // Local panels have one preference, regardless of the resized mode.
293
+ preferredWidth: width
293
294
  }
294
295
  };
295
296
  });
@@ -0,0 +1,26 @@
1
+ ._nd5l1c6w{grid-area:panel}
2
+ ._nd5l1gzg{grid-area:main}
3
+ ._nd5l32aw{grid-area:var(--p_lclPnlSsrArea,main)}
4
+ ._y44v1mph{animation:var(--ds-panel-content-enter,.15s cubic-bezier(.4,1,.6,1) FadeIn0to100)}
5
+ ._y44vf1qi{animation:var(--ds-panel-content-exit,50ms cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
6
+ ._191wbqna{border-inline-start:var(--p_lclPnlSsrBorder,none)}
7
+ ._191wglyw{border-inline-start:none}
8
+ ._191wia51{border-inline-start:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._10fph9n0{justify-self:end}
9
+ ._152tidpf{inset-block-start:0}
10
+ ._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
11
+ ._16qs1dhr{box-shadow:var(--p_lclPnlSsrShadow,var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f))}
12
+ ._16qsglyw{box-shadow:none}
13
+ ._18m91wug{overflow-y:auto}
14
+ ._1bsb13q4{width:min(90%,var(--p_lclPnlRsz,var(--p_lclPnlW)))}
15
+ ._1bsb1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}
16
+ ._1bsb1cku{width:var(--p_lclPnlSsrWidth,min(90%,var(--p_lclPnlSsrPreferredW)))}
17
+ ._1reo1wug{overflow-x:auto}
18
+ ._4t3i1osq{height:100%}
19
+ ._4t3ieqxy{height:calc(100vh - var(--n_bnrM, 0px) - var(--n_tNvM, 0px))}
20
+ ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
21
+ ._bfhk1g1j{background-color:var(--p_lclPnlSsrBackground,var(--ds-surface-overlay,#fff))}
22
+ ._bfhkvuon{background-color:var(--ds-surface,#fff)}
23
+ ._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
24
+ ._kqsw1if8{position:sticky}
25
+ ._vchhusvi{box-sizing:border-box}
26
+ @media (prefers-reduced-motion:no-preference){._k1af14vv{animation:var(--ds-panel-exit-right,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentRight)}[dir=rtl] ._105aeydr{animation:var(--ds-panel-exit-left,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentLeft)}._bq641n9t{position:fixed}@starting-style{._1kmh1n9t{position:fixed}}._k1af1nn1{animation:var(--ds-panel-enter-right,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentRight)}._10t81ia4{transition-property:position}._xrrp147i{transition-duration:var(--ds-duration-instant,0ms)}._1wsa1ign{transition-delay:var(--ds-duration-short,.15s)}._1vrh1a5r{transition-behavior:allow-discrete}[dir=rtl] ._105abamb{animation:var(--ds-panel-enter-left,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentLeft)}}