@atlaskit/navigation-system 11.3.3 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +20 -0
- package/constellation/layout/code.mdx +1 -1
- package/constellation/layout/examples.mdx +4 -16
- package/constellation/layout/images/layout-anatomy-dark.png +0 -0
- package/constellation/layout/images/layout-anatomy-light.png +0 -0
- package/constellation/layout/images/layout-do-dark.png +0 -0
- package/constellation/layout/images/layout-do-light.png +0 -0
- package/constellation/layout/images/layout-dont-dark.png +0 -0
- package/constellation/layout/images/layout-dont-light.png +0 -0
- package/constellation/layout/images/layout-example-dark.png +0 -0
- package/constellation/layout/images/layout-example-light.png +0 -0
- package/constellation/layout/images/layout-example-sideNav-dark.png +0 -0
- package/constellation/layout/images/layout-example-sideNav-light.png +0 -0
- package/constellation/layout/images/layout-example-topNav-1-dark.png +0 -0
- package/constellation/layout/images/layout-example-topNav-1-light.png +0 -0
- package/constellation/layout/usage.mdx +1 -2
- package/constellation/top-nav-items/examples.mdx +7 -13
- package/dist/cjs/entry-points/layout/panel-layout.js +19 -0
- package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/cjs/ui/page-layout/chat-panel.js +1 -1
- package/dist/cjs/ui/page-layout/constants.js +15 -1
- package/dist/cjs/ui/page-layout/get-panel-layout-defaults.js +22 -0
- package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +5 -4
- package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/cjs/ui/page-layout/local-panel-surface.js +206 -0
- package/dist/cjs/ui/page-layout/main/main.js +5 -2
- package/dist/cjs/ui/page-layout/main-min-width-context.js +10 -0
- package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/cjs/ui/page-layout/panel-layout-shell.js +67 -0
- package/dist/cjs/ui/page-layout/panel-layout.js +162 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +12 -5
- package/dist/cjs/ui/page-layout/root.js +3 -1
- package/dist/cjs/ui/page-layout/side-nav/bind-open-layer-change.js +56 -0
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +167 -57
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +8 -1
- package/dist/cjs/ui/page-layout/side-nav/use-side-nav-toggle-keyboard-shortcut.js +15 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +3 -2
- package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.js +2 -1
- package/dist/es2019/entry-points/layout/panel-layout.js +2 -0
- package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/es2019/ui/page-layout/chat-panel.js +2 -2
- package/dist/es2019/ui/page-layout/constants.js +14 -0
- package/dist/es2019/ui/page-layout/get-panel-layout-defaults.js +16 -0
- package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +4 -3
- package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/es2019/ui/page-layout/local-panel-surface.js +193 -0
- package/dist/es2019/ui/page-layout/main/main.js +6 -3
- package/dist/es2019/ui/page-layout/main-min-width-context.js +5 -0
- package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/es2019/ui/page-layout/panel-layout-shell.js +74 -0
- package/dist/es2019/ui/page-layout/panel-layout.js +147 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +12 -5
- package/dist/es2019/ui/page-layout/root.js +3 -1
- package/dist/es2019/ui/page-layout/side-nav/bind-open-layer-change.js +51 -0
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +123 -10
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +8 -1
- package/dist/es2019/ui/page-layout/side-nav/use-side-nav-toggle-keyboard-shortcut.js +15 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +3 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.js +2 -1
- package/dist/esm/entry-points/layout/panel-layout.js +2 -0
- package/dist/esm/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/esm/ui/page-layout/chat-panel.js +2 -2
- package/dist/esm/ui/page-layout/constants.js +14 -0
- package/dist/esm/ui/page-layout/get-panel-layout-defaults.js +16 -0
- package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +4 -3
- package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/esm/ui/page-layout/local-panel-surface.js +197 -0
- package/dist/esm/ui/page-layout/main/main.js +6 -3
- package/dist/esm/ui/page-layout/main-min-width-context.js +5 -0
- package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/esm/ui/page-layout/panel-layout-shell.js +59 -0
- package/dist/esm/ui/page-layout/panel-layout.js +154 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +12 -5
- package/dist/esm/ui/page-layout/root.js +3 -1
- package/dist/esm/ui/page-layout/side-nav/bind-open-layer-change.js +50 -0
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +168 -58
- package/dist/esm/ui/page-layout/side-nav/toggle-button.js +8 -1
- package/dist/esm/ui/page-layout/side-nav/use-side-nav-toggle-keyboard-shortcut.js +15 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +3 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav-middle.js +2 -1
- package/dist/types/entry-points/layout/panel-layout.d.ts +3 -0
- package/dist/types/ui/page-layout/constants.d.ts +12 -0
- package/dist/types/ui/page-layout/get-panel-layout-defaults.d.ts +10 -0
- package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +5 -1
- package/dist/types/ui/page-layout/local-panel-surface.d.ts +32 -0
- package/dist/types/ui/page-layout/main-min-width-context.d.ts +2 -0
- package/dist/types/ui/page-layout/panel-layout-shell.d.ts +47 -0
- package/dist/types/ui/page-layout/panel-layout.d.ts +74 -0
- package/dist/types/ui/page-layout/side-nav/bind-open-layer-change.d.ts +17 -0
- package/layout/panel-layout/package.json +10 -0
- package/package.json +6 -6
- package/constellation/layout/images/layout-example-topNav-2-dark.png +0 -0
- package/constellation/layout/images/layout-example-topNav-2-light.png +0 -0
|
@@ -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 ?
|
|
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
|
-
},
|
|
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
|
+
}
|
|
@@ -31,6 +31,7 @@ var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/utils
|
|
|
31
31
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/utils/prevent-unhandled");
|
|
32
32
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
33
33
|
var _TooltipContainer = _interopRequireDefault(require("@atlaskit/tooltip/TooltipContainer"));
|
|
34
|
+
var _requestClosePopovers = require("@atlaskit/top-layer/page-surface/request-close-popovers");
|
|
34
35
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
35
36
|
var _constants = require("../constants");
|
|
36
37
|
var _convertResizeBoundToPixels = require("./convert-resize-bound-to-pixels");
|
|
@@ -177,7 +178,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
177
178
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
178
179
|
rangeInputBounds = _useState4[0],
|
|
179
180
|
setRangeInputBounds = _useState4[1];
|
|
180
|
-
var openLayerObserver = (0, _useOpenLayerObserver.useOpenLayerObserver)(
|
|
181
|
+
var openLayerObserver = (0, _useOpenLayerObserver.useOpenLayerObserver)({
|
|
182
|
+
isEnabled: !(0, _fg.fg)('platform-dst-top-layer')
|
|
183
|
+
});
|
|
181
184
|
|
|
182
185
|
/**
|
|
183
186
|
* This is a temporary workaround to enable the `SideNavPanelSplitter` component
|
|
@@ -191,7 +194,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
191
194
|
var initialClientXRef = (0, _react.useRef)(null);
|
|
192
195
|
// Live allocation changes panelWidth on every frame. Only the legacy path should
|
|
193
196
|
// rebind the drag listeners when this value changes.
|
|
194
|
-
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;
|
|
195
198
|
(0, _react.useEffect)(function () {
|
|
196
199
|
var splitter = splitterRef.current;
|
|
197
200
|
(0, _tinyInvariant.default)(splitter, 'Splitter ref must be set');
|
|
@@ -268,6 +271,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
268
271
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart(resizeStartData);
|
|
269
272
|
|
|
270
273
|
// Close any open layers when the user starts resizing
|
|
274
|
+
// Not gated. Top-layer tooltips (`platform-dst-top-layer-tooltip`) are not known to the observer.
|
|
275
|
+
(0, _requestClosePopovers.requestClosePopovers)();
|
|
271
276
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
272
277
|
},
|
|
273
278
|
onDrag: function onDrag(_ref6) {
|
|
@@ -298,7 +303,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
298
303
|
position: position
|
|
299
304
|
});
|
|
300
305
|
var resizingWidth = "clamp(".concat(resizeBounds.min, ", ").concat(targetWidth, "px, ").concat(resizeBounds.max, ")");
|
|
301
|
-
if (
|
|
306
|
+
if (onResizeInternal) {
|
|
302
307
|
// The allocator needs below-minimum requests for the local-to-chat cascade.
|
|
303
308
|
var currentBounds = getResizeBounds();
|
|
304
309
|
var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : (0, _convertResizeBoundToPixels.convertResizeBoundToPixels)(currentBounds.max)));
|
|
@@ -354,7 +359,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
354
359
|
}
|
|
355
360
|
finalWidth = (0, _getPixelWidth.getPixelWidth)(panel); // Persist the final preferred width before removing the imperative drag
|
|
356
361
|
// variable, so the rendered width is continuous across pointer release.
|
|
357
|
-
if ((0, _fg.fg)('platform-dst-chat-panel-layout')) {
|
|
362
|
+
if ((0, _fg.fg)('platform-dst-chat-panel-layout') || onResizeInternal) {
|
|
358
363
|
(0, _reactDom.flushSync)(function () {
|
|
359
364
|
return onCompleteResize(finalWidth);
|
|
360
365
|
});
|
|
@@ -383,6 +388,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
383
388
|
onResizeStart: function onResizeStart() {
|
|
384
389
|
var _onResizeStartStableR;
|
|
385
390
|
// Close any open layers when the user starts resizing with keyboard
|
|
391
|
+
// Not gated. Top-layer tooltips (`platform-dst-top-layer-tooltip`) are not known to the observer.
|
|
392
|
+
(0, _requestClosePopovers.requestClosePopovers)();
|
|
386
393
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
387
394
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
388
395
|
args[_key] = arguments[_key];
|
|
@@ -409,7 +416,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
409
416
|
return _regenerator.default.wrap(function (_context2) {
|
|
410
417
|
while (1) switch (_context2.prev = _context2.next) {
|
|
411
418
|
case 0:
|
|
412
|
-
isManagedResize =
|
|
419
|
+
isManagedResize = onResizeInternal;
|
|
413
420
|
sequence = focusSequence.current;
|
|
414
421
|
value = isManagedResize ? parseFloat(event.currentTarget.value) : parseInt(event.currentTarget.value);
|
|
415
422
|
if (!prepareResize) {
|
|
@@ -77,6 +77,8 @@ function Root(_ref2) {
|
|
|
77
77
|
var isChatPanelLayoutEnabled = (0, _fg.fg)('platform-dst-chat-panel-layout');
|
|
78
78
|
var LayoutProvider = isChatPanelLayoutEnabled ? _layoutAreaSizingProvider.LayoutAreaSizingProvider : _react.default.Fragment;
|
|
79
79
|
var WidthContainer = isChatPanelLayoutEnabled ? LayoutFitContainers : _react.default.Fragment;
|
|
80
|
+
// Top-layer surfaces are found through the DOM, so the observer is only needed when the gate is off.
|
|
81
|
+
var LayerObserverProvider = (0, _fg.fg)('platform-dst-top-layer') ? _react.default.Fragment : _openLayerObserver.OpenLayerObserver;
|
|
80
82
|
(0, _react.useEffect)(function () {
|
|
81
83
|
if (process.env.NODE_ENV !== 'production') {
|
|
82
84
|
var IGNORED_ELEMENTS = ['SCRIPT', 'STYLE'];
|
|
@@ -99,7 +101,7 @@ function Root(_ref2) {
|
|
|
99
101
|
isSideNavShortcutEnabled: isSideNavShortcutEnabled
|
|
100
102
|
}, /*#__PURE__*/_react.default.createElement(_topNavStartContextProvider.TopNavStartProvider, null, /*#__PURE__*/_react.default.createElement(LayoutProvider, isChatPanelLayoutEnabled ? {
|
|
101
103
|
layoutRef: ref
|
|
102
|
-
} : {}, /*#__PURE__*/_react.default.createElement(
|
|
104
|
+
} : {}, /*#__PURE__*/_react.default.createElement(LayerObserverProvider, null, /*#__PURE__*/_react.default.createElement(_hoistSlotSizesContext.DangerouslyHoistSlotSizes.Provider, {
|
|
103
105
|
value: UNSAFE_dangerouslyHoistSlotSizes
|
|
104
106
|
}, /*#__PURE__*/_react.default.createElement(_skipLinksProvider.SkipLinksProvider, {
|
|
105
107
|
label: skipLinksLabel,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bindOpenLayerChange = bindOpenLayerChange;
|
|
7
|
+
var _bindEventListener = require("bind-event-listener");
|
|
8
|
+
/**
|
|
9
|
+
* Calls `onChange` after any popover or dialog inside `within` opens or closes.
|
|
10
|
+
* Read the new state with `hasOpenDialogOrPopover`.
|
|
11
|
+
*
|
|
12
|
+
* `beforetoggle`, `toggle` and `close` do not bubble, so they are observed in the capture phase.
|
|
13
|
+
*
|
|
14
|
+
* `toggle` and `close` are queued tasks. When a surface closes because it unmounts,
|
|
15
|
+
* they fire after the element has left the DOM, so they never reach `within`.
|
|
16
|
+
* `beforetoggle` fires synchronously while the element is still inside `within`,
|
|
17
|
+
* so it also schedules `onChange` in a microtask, after the state has changed.
|
|
18
|
+
*/
|
|
19
|
+
function bindOpenLayerChange(_ref) {
|
|
20
|
+
var within = _ref.within,
|
|
21
|
+
onChange = _ref.onChange;
|
|
22
|
+
var isBound = true;
|
|
23
|
+
function listener() {
|
|
24
|
+
onChange();
|
|
25
|
+
}
|
|
26
|
+
function deferredListener() {
|
|
27
|
+
queueMicrotask(function () {
|
|
28
|
+
if (isBound) {
|
|
29
|
+
onChange();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
var unbind = (0, _bindEventListener.bindAll)(within, [{
|
|
34
|
+
type: 'beforetoggle',
|
|
35
|
+
listener: deferredListener,
|
|
36
|
+
options: {
|
|
37
|
+
capture: true
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
type: 'toggle',
|
|
41
|
+
listener: listener,
|
|
42
|
+
options: {
|
|
43
|
+
capture: true
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
type: 'close',
|
|
47
|
+
listener: listener,
|
|
48
|
+
options: {
|
|
49
|
+
capture: true
|
|
50
|
+
}
|
|
51
|
+
}]);
|
|
52
|
+
return function cleanup() {
|
|
53
|
+
isBound = false;
|
|
54
|
+
unbind();
|
|
55
|
+
};
|
|
56
|
+
}
|