@atlaskit/navigation-system 11.7.9 → 11.8.1
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 +37 -0
- package/constellation/layout/code.mdx +8 -0
- package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +20 -14
- package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +19 -6
- package/dist/cjs/ui/page-layout/layout-overlay-clearance.js +11 -2
- package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +3 -6
- package/dist/cjs/ui/page-layout/local-panel-surface.js +21 -14
- package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +4 -2
- package/dist/cjs/ui/page-layout/panel-layout-shell.js +18 -16
- package/dist/cjs/ui/page-layout/panel-layout.js +10 -2
- package/dist/cjs/ui/page-layout/panel.compiled.css +1 -1
- package/dist/cjs/ui/page-layout/panel.js +6 -3
- package/dist/cjs/ui/page-layout/side-nav/side-nav.compiled.css +7 -6
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +8 -7
- package/dist/cjs/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/cjs/ui/page-layout/use-panel-content-enter.js +27 -0
- package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +19 -14
- package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +17 -6
- package/dist/es2019/ui/page-layout/layout-overlay-clearance.js +9 -1
- package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +3 -6
- package/dist/es2019/ui/page-layout/local-panel-surface.js +21 -14
- package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +4 -2
- package/dist/es2019/ui/page-layout/panel-layout-shell.js +20 -14
- package/dist/es2019/ui/page-layout/panel-layout.js +8 -2
- package/dist/es2019/ui/page-layout/panel.compiled.css +1 -1
- package/dist/es2019/ui/page-layout/panel.js +6 -3
- package/dist/es2019/ui/page-layout/side-nav/side-nav.compiled.css +7 -6
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +9 -8
- package/dist/es2019/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/es2019/ui/page-layout/use-panel-content-enter.js +16 -0
- package/dist/esm/ui/page-layout/calculate-layout-area-states.js +20 -14
- package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +4 -1
- package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +19 -6
- package/dist/esm/ui/page-layout/layout-overlay-clearance.js +9 -1
- package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +3 -6
- package/dist/esm/ui/page-layout/local-panel-surface.js +21 -14
- package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +4 -2
- package/dist/esm/ui/page-layout/panel-layout-shell.js +18 -16
- package/dist/esm/ui/page-layout/panel-layout.js +10 -2
- package/dist/esm/ui/page-layout/panel.compiled.css +1 -1
- package/dist/esm/ui/page-layout/panel.js +6 -3
- package/dist/esm/ui/page-layout/side-nav/side-nav.compiled.css +7 -6
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +8 -7
- package/dist/esm/ui/page-layout/use-layout-area-sizing.js +3 -1
- package/dist/esm/ui/page-layout/use-panel-content-enter.js +20 -0
- package/dist/types/ui/page-layout/calculate-layout-area-states.d.ts +5 -1
- package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +1 -0
- package/dist/types/ui/page-layout/layout-area-sizing-runtime.d.ts +2 -1
- package/dist/types/ui/page-layout/layout-overlay-clearance.d.ts +1 -1
- package/dist/types/ui/page-layout/panel-layout-shell.d.ts +5 -3
- package/dist/types/ui/page-layout/panel-layout.d.ts +8 -1
- package/dist/types/ui/page-layout/use-panel-content-enter.d.ts +5 -0
- package/package.json +11 -7
|
@@ -25,6 +25,7 @@ var _hoistSlotSizesContext = require("./hoist-slot-sizes-context");
|
|
|
25
25
|
var _provider = require("./panel-splitter/provider");
|
|
26
26
|
var _useSideNavRef = require("./side-nav/use-side-nav-ref");
|
|
27
27
|
var _useLayoutId = require("./use-layout-id");
|
|
28
|
+
var _usePanelContentEnter = require("./use-panel-content-enter");
|
|
28
29
|
var _useResizingWidthCssVarOnRootElement = require("./use-resizing-width-css-var-on-root-element");
|
|
29
30
|
var _useSafeDefaultWidth = require("./use-safe-default-width");
|
|
30
31
|
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); }
|
|
@@ -44,9 +45,10 @@ var styles = {
|
|
|
44
45
|
border: "_191wglyw _16qs130s _1w6eia51 _scbpglyw",
|
|
45
46
|
scrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
46
47
|
hidden: "_1e0cglyw",
|
|
47
|
-
entering: "
|
|
48
|
-
exiting: "
|
|
48
|
+
entering: "_k1afx3bs _10t81ia4 _xrrp147i _1wsa1ja5 _1vrh1a5r _1kmh1n9t _105az3zp",
|
|
49
|
+
exiting: "_k1afry0p _bq641n9t _105a97o5",
|
|
49
50
|
contentEntering: "_y44v1mph",
|
|
51
|
+
contentEnteringOnOpen: "_k1afi8w4",
|
|
50
52
|
contentExiting: "_y44vf1qi",
|
|
51
53
|
contentChangeContainer: "_4t3i1osq"
|
|
52
54
|
};
|
|
@@ -114,6 +116,7 @@ function Panel(_ref2) {
|
|
|
114
116
|
state = _useMotion2.state,
|
|
115
117
|
motionRef = _useMotion2.ref,
|
|
116
118
|
reanimate = _useMotion2.reanimate;
|
|
119
|
+
var shouldAnimateContentEnter = (0, _usePanelContentEnter.usePanelContentEnter)(state);
|
|
117
120
|
|
|
118
121
|
/**
|
|
119
122
|
* Don't show the skip link if the slot has 0 width.
|
|
@@ -244,7 +247,7 @@ function Panel(_ref2) {
|
|
|
244
247
|
resizingCssVar: panelSplitterResizingVar,
|
|
245
248
|
position: "start"
|
|
246
249
|
}, /*#__PURE__*/React.createElement("div", {
|
|
247
|
-
className: (0, _runtime.ax)([styles.scrollContainer, isMotionUpliftEnabled &&
|
|
250
|
+
className: (0, _runtime.ax)([styles.scrollContainer, isMotionUpliftEnabled && shouldAnimateContentEnter && styles.contentEnteringOnOpen, isMotionUpliftEnabled && state === 'exiting' && styles.contentExiting])
|
|
248
251
|
}, isContentMotionEnabled ? /*#__PURE__*/React.createElement(_exitingPersistence.default, {
|
|
249
252
|
exitThenEnter: contentKey !== undefined
|
|
250
253
|
}, /*#__PURE__*/React.createElement(PanelContentMotion, {
|
|
@@ -6,20 +6,21 @@
|
|
|
6
6
|
._1bsbhc79{width:var(--n_snvRsz,var(--n_sNvw))}
|
|
7
7
|
._1e0c1txw{display:flex}
|
|
8
8
|
._1e0cglyw{display:none}
|
|
9
|
-
.
|
|
9
|
+
._1p2s1v7a{--exit-animation:var(--ds-sidenav-exit-left,200ms cubic-bezier(0.25,1,0.5,1) SlideOut100PercentLeft)}
|
|
10
10
|
._1pbycs5v{z-index:2}
|
|
11
11
|
._2lx21bp4{flex-direction:column}
|
|
12
12
|
._4t3i1osq{height:100%}
|
|
13
13
|
._4t3ieqxy{height:calc(100vh - var(--n_bnrM, 0px) - var(--n_tNvM, 0px))}
|
|
14
14
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
15
|
-
.
|
|
15
|
+
._cjprbksg{--enter-animation:var(--ds-sidenav-enter-left,200ms cubic-bezier(0.16,1,0.3,1) SlideIn100PercentLeft)}
|
|
16
16
|
._kqsw1if8{position:sticky}
|
|
17
17
|
._vchhusvi{box-sizing:border-box}
|
|
18
|
-
[dir=rtl] .
|
|
19
|
-
[dir=rtl] .
|
|
20
|
-
@media (prefers-reduced-motion:no-preference){._10t81t0s{transition-property:display}._1vrh1a5r{transition-behavior:allow-discrete}._xrrpi9qs{transition-duration:var(--ds-duration-medium,.2s)}
|
|
18
|
+
[dir=rtl] ._1jq4125i{--enter-animation:var(--ds-sidenav-enter-right,200ms cubic-bezier(0.16,1,0.3,1) SlideIn100PercentRight)}
|
|
19
|
+
[dir=rtl] ._2qe01hl6{--exit-animation:var(--ds-sidenav-exit-right,200ms cubic-bezier(0.25,1,0.5,1) SlideOut100PercentRight)}
|
|
20
|
+
@media (prefers-reduced-motion:no-preference){._10t81t0s{transition-property:display}._1vrh1a5r{transition-behavior:allow-discrete}._xrrpi9qs{transition-duration:var(--ds-duration-medium,.2s)}}
|
|
21
21
|
@media (min-width:48rem){._14b5hc79{width:var(--n_snvRsz,var(--n_sNvw))}}
|
|
22
22
|
@media (min-width:64rem){._cpcf1gzg._cpcf1gzg{grid-area:main}._6kttglyw._6kttglyw{border-inline-end:none}._w8v11bhr._w8v11bhr{background-color:var(--ds-surface-overlay,#fff)}._1jug130s._1jug130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}._dm2518uv{display:initial}._dm25glyw{display:none}._qiln1gzg{grid-area:main}._p5clglyw{border-inline-end:none}._4ap31bhr{background-color:var(--ds-surface-overlay,#fff)}._scbp130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}._qilnk0mc{grid-area:side-nav}._p5clia51{border-inline-end:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._scbpglyw{box-shadow:none}}
|
|
23
|
-
@media (prefers-reduced-motion:no-preference) and (min-width:64rem){._1sg81gzg{grid-area:main}._n2infm5y{animation:var(--exit-animation)}._17ly1wzp{transition-property:grid-area,display}._hjoi1wsm{transition-duration:var(--ds-duration-instant,0ms),var(--ds-duration-medium,.2s)}.
|
|
23
|
+
@media (prefers-reduced-motion:no-preference) and (min-width:64rem){._1sg81gzg{grid-area:main}._n2infm5y{animation:var(--exit-animation)}._17ly1wzp{transition-property:grid-area,display}._hjoi1wsm{transition-duration:var(--ds-duration-instant,0ms),var(--ds-duration-medium,.2s)}._1wxo147i{transition-delay:var(--ds-duration-instant,0ms)}@starting-style{._1xpz1gzg{grid-area:main}}._1sg8k0mc{grid-area:side-nav}._n2in10ed{animation:var(--enter-animation)}._17ly1q8v{transition-property:grid-area}._hjoi147i{transition-duration:var(--ds-duration-instant,0ms)}._1wxo1ja5{transition-delay:60ms}}
|
|
24
24
|
@media not (min-width:64rem){._89fi1b6c{grid-area:main/aside/aside/aside}}
|
|
25
|
+
@media (prefers-reduced-motion:no-preference) and (width < 64rem){._nobw10ed{animation:var(--enter-animation)}._ycjn1gzg{grid-area:main}._nobwfm5y{animation:var(--exit-animation)}}
|
|
25
26
|
@supports not (-moz-appearance:none){@media (prefers-reduced-motion:no-preference){._139f8iot{transition-property:transform,display}._1tpvfnf5{transition-duration:.2s}._sylc1a5r{transition-behavior:allow-discrete}._1uwsjq3t{transform:translateX(-100%)}}@media (prefers-reduced-motion:no-preference){@starting-style{._oyeijq3t{transform:translateX(-100%)}}._139f8iot{transition-property:transform,display}._1tpvfnf5{transition-duration:.2s}._sylc1a5r{transition-behavior:allow-discrete}}@media (prefers-reduced-motion:no-preference){._4xci10ed{animation:var(--enter-animation)}._1tpv1mzy{transition-duration:var(--ds-duration-long,.25s)}._sylc1a5r{transition-behavior:allow-discrete}}@media (prefers-reduced-motion:no-preference){._4xcifm5y{animation:var(--exit-animation)}._1tpvi9qs{transition-duration:var(--ds-duration-medium,.2s)}._sylc1a5r{transition-behavior:allow-discrete}}}
|
|
@@ -131,20 +131,20 @@ var styles = {
|
|
|
131
131
|
* with `@starting-style` used by `styles`.
|
|
132
132
|
*
|
|
133
133
|
* ⚠️ The `transition-duration` values below need to stay in sync with the duration baked into the tokens
|
|
134
|
-
* (`motion.sidenav.enter.*`
|
|
134
|
+
* (`motion.sidenav.enter.*` and `motion.sidenav.exit.*` are both 200ms). The `display` property is
|
|
135
135
|
* transitioned (with `allow-discrete`) so the element stays rendered for the length of the exit animation —
|
|
136
136
|
* if the transition is shorter than the animation, `display: none` applies early and the exit animation
|
|
137
137
|
* never runs.
|
|
138
138
|
*/
|
|
139
139
|
var motionUpliftStyles = {
|
|
140
|
-
animationRTLSupport: "
|
|
140
|
+
animationRTLSupport: "_cjprbksg _1p2s1v7a _1jq4125i _2qe01hl6",
|
|
141
141
|
animationBaseStyles: "_10t81t0s _1vrh1a5r _xrrpi9qs",
|
|
142
|
-
expandAnimationMobile: "
|
|
143
|
-
collapseAnimationMobile: "
|
|
142
|
+
expandAnimationMobile: "_nobw10ed",
|
|
143
|
+
collapseAnimationMobile: "_ycjn1gzg _nobwfm5y",
|
|
144
144
|
flyoutOpen: "_qiln1gzg _p5clglyw _4ap31bhr _scbp130s _4xci10ed _1tpv1mzy _sylc1a5r",
|
|
145
145
|
flyoutAnimateClosed: "_1e0cglyw _qiln1gzg _4xcifm5y _1tpvi9qs _sylc1a5r",
|
|
146
|
-
expandAnimationDesktop: "_1sg8k0mc _n2in10ed _1xpz1gzg _17ly1q8v _hjoi147i
|
|
147
|
-
collapseAnimationDesktop: "_1sg81gzg _n2infm5y _17ly1wzp _hjoi1wsm
|
|
146
|
+
expandAnimationDesktop: "_1sg8k0mc _n2in10ed _1xpz1gzg _17ly1q8v _hjoi147i _1wxo1ja5",
|
|
147
|
+
collapseAnimationDesktop: "_1sg81gzg _n2infm5y _17ly1wzp _hjoi1wsm _1wxo147i"
|
|
148
148
|
};
|
|
149
149
|
var fallbackDefaultWidth = 320;
|
|
150
150
|
var onPeekStartDelayMs = exports.onPeekStartDelayMs = 500;
|
|
@@ -1006,8 +1006,9 @@ function SideNavInternal(_ref4) {
|
|
|
1006
1006
|
}), isChatPanelLayoutEnabled &&
|
|
1007
1007
|
/*#__PURE__*/
|
|
1008
1008
|
// CSS reserves only the nav minimum for chat's fit decision, before effects or lazy loading.
|
|
1009
|
+
// Motion owns grid-area so this ID selector cannot override the entrance or exit snap.
|
|
1009
1010
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
|
|
1010
|
-
_react.default.createElement("style", null, "\n#".concat(_root.gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(_root.gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(_root.gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: main / aside / aside / aside; width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n #").concat(_root.gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { grid-area: side-nav; width: max(").concat(minWidth, ", min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px)))); }") : '', "\n}\n")), /*#__PURE__*/_react.default.createElement(_dangerouslyHoistCssVarToDocumentRoot.DangerouslyHoistCssVarToDocumentRoot, {
|
|
1011
|
+
_react.default.createElement("style", null, "\n#".concat(_root.gridRootFitId, " { --n_clearanceNavMin: 0px; --n_clearanceNavTarget: ").concat(clampedWidth, "; }\n#").concat(_root.gridRootChatFitId, " { --n_fitNav: 0px; }\n@media (min-width: 64rem) {\n #").concat(_root.gridRootFitId, " { --n_clearanceNavMin: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n}\n").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { ").concat(isMotionUpliftEnabled ? '' : 'grid-area: main / aside / aside / aside;', " width: min(90%, ").concat(clampedWidth, "); }") : '', "\n@media (min-width: 64rem) {\n #").concat(_root.gridRootChatFitId, " { --n_fitNav: ").concat(isExpandedOnDesktop ? minWidth : '0px', "; }\n ").concat(shouldApplyUnmanagedSizing ? "#".concat(_root.gridRootId, " nav[data-layout-slot] { ").concat(isMotionUpliftEnabled ? '' : 'grid-area: side-nav;', " width: max(").concat(minWidth, ", min(").concat(clampedWidth, ", calc(100cqw + var(--n_fitNav) - var(--n_chatTrack, 0px)))); }") : '', "\n}\n")), /*#__PURE__*/_react.default.createElement(_dangerouslyHoistCssVarToDocumentRoot.DangerouslyHoistCssVarToDocumentRoot, {
|
|
1011
1012
|
variableName: _constants.sideNavLiveWidthVar,
|
|
1012
1013
|
value: "0px",
|
|
1013
1014
|
mediaQuery: '@media (min-width: 64rem)',
|
|
@@ -14,6 +14,7 @@ function useLayoutAreaSizing(_ref) {
|
|
|
14
14
|
var requestedWidth = config.requestedWidth,
|
|
15
15
|
defaultWidth = config.defaultWidth,
|
|
16
16
|
compactDefaultWidth = config.compactDefaultWidth,
|
|
17
|
+
xlDefaultWidth = config.xlDefaultWidth,
|
|
17
18
|
minWidth = config.minWidth,
|
|
18
19
|
maxWidth = config.maxWidth,
|
|
19
20
|
isOpen = config.isOpen,
|
|
@@ -40,12 +41,13 @@ function useLayoutAreaSizing(_ref) {
|
|
|
40
41
|
requestedWidth: requestedWidth,
|
|
41
42
|
defaultWidth: defaultWidth,
|
|
42
43
|
compactDefaultWidth: compactDefaultWidth,
|
|
44
|
+
xlDefaultWidth: xlDefaultWidth,
|
|
43
45
|
minWidth: minWidth,
|
|
44
46
|
maxWidth: maxWidth,
|
|
45
47
|
isOpen: isOpen,
|
|
46
48
|
onRequestClose: requestClose
|
|
47
49
|
});
|
|
48
|
-
}, [area, compactDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
50
|
+
}, [area, compactDefaultWidth, xlDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
49
51
|
(0, _react.useEffect)(function () {
|
|
50
52
|
return function () {
|
|
51
53
|
return unregisterArea === null || unregisterArea === void 0 ? void 0 : unregisterArea(area);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.usePanelContentEnter = usePanelContentEnter;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
/**
|
|
11
|
+
* Keep the delayed content fade attached after the shorter panel slide finishes.
|
|
12
|
+
*/
|
|
13
|
+
function usePanelContentEnter(state) {
|
|
14
|
+
var _useState = (0, _react.useState)(state === 'entering'),
|
|
15
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
16
|
+
hasEntered = _useState2[0],
|
|
17
|
+
setHasEntered = _useState2[1];
|
|
18
|
+
(0, _react.useEffect)(function () {
|
|
19
|
+
if (state !== 'visible') {
|
|
20
|
+
setHasEntered(state === 'entering');
|
|
21
|
+
}
|
|
22
|
+
}, [state]);
|
|
23
|
+
|
|
24
|
+
// Exit/hidden removes the animation so reopening starts a fresh fade. A panel
|
|
25
|
+
// initially mounted as visible should not gain an entrance animation.
|
|
26
|
+
return state === 'entering' || state === 'visible' && hasEntered;
|
|
27
|
+
}
|
|
@@ -7,14 +7,18 @@ function clampTargetWidth({
|
|
|
7
7
|
}) {
|
|
8
8
|
return Math.max(min, Math.min(target, max));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
var _area$compactDefaultW, _area$
|
|
12
|
-
|
|
10
|
+
function getDefaultWidth(area, isCompact, isXlViewport) {
|
|
11
|
+
var _area$compactDefaultW, _area$xlDefaultWidth;
|
|
12
|
+
return isCompact ? (_area$compactDefaultW = area.compactDefaultWidth) !== null && _area$compactDefaultW !== void 0 ? _area$compactDefaultW : area.defaultWidth : isXlViewport ? (_area$xlDefaultWidth = area.xlDefaultWidth) !== null && _area$xlDefaultWidth !== void 0 ? _area$xlDefaultWidth : area.defaultWidth : area.defaultWidth;
|
|
13
|
+
}
|
|
14
|
+
function getTargetWidth(area, isSideNavOverlay, isXlViewport) {
|
|
15
|
+
var _area$liveResize, _ref, _area$requestedWidth;
|
|
16
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
13
17
|
return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredWidth) !== null && _ref !== void 0 ? _ref : defaultWidth;
|
|
14
18
|
}
|
|
15
|
-
function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
|
|
16
|
-
var _area$
|
|
17
|
-
const defaultWidth =
|
|
19
|
+
function getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName) {
|
|
20
|
+
var _area$liveResize2, _ref2, _area$requestedWidth2;
|
|
21
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
18
22
|
return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref2 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : areaName === 'panel' ? area.preferredWidth : area.preferredOverlayWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
|
|
19
23
|
}
|
|
20
24
|
export function calculateLayoutAreaStates({
|
|
@@ -22,6 +26,7 @@ export function calculateLayoutAreaStates({
|
|
|
22
26
|
layoutWidth = viewportWidth,
|
|
23
27
|
isChatPanelOverlay,
|
|
24
28
|
isSideNavOverlay,
|
|
29
|
+
isXlViewport = false,
|
|
25
30
|
occupiedWidth = 0,
|
|
26
31
|
mainMinWidth: mainMinWidthBound,
|
|
27
32
|
areas,
|
|
@@ -45,7 +50,7 @@ export function calculateLayoutAreaStates({
|
|
|
45
50
|
// A growing panel cascades towards inline-start. Chat is on the other side
|
|
46
51
|
// of the local rail, so local growth must reserve its full starting width.
|
|
47
52
|
const shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
|
|
48
|
-
target: getTargetWidth(resizingArea, isSideNavOverlay),
|
|
53
|
+
target: getTargetWidth(resizingArea, isSideNavOverlay, isXlViewport),
|
|
49
54
|
min: resolveLayoutWidth(resizingArea.minWidth, viewportWidth),
|
|
50
55
|
max: resizingArea.maxWidth !== undefined ? resolveLayoutWidth(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
|
|
51
56
|
}) > availableWidth - mainMinWidth - sideNavMinWidth - (resizeSession.area === 'panel' ? resizeSession.baselineWidths['chat-panel'] !== undefined ? (_baselineWidths$chat = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths['chat-panel']) !== null && _baselineWidths$chat !== void 0 ? _baselineWidths$chat : chatPanelMinWidth : 0 : resizeSession.baselineWidths.panel !== undefined ? panelMinWidth : 0));
|
|
@@ -78,7 +83,7 @@ export function calculateLayoutAreaStates({
|
|
|
78
83
|
const min = resolveLayoutWidth(area.minWidth, viewportWidth);
|
|
79
84
|
const max = area.maxWidth ? resolveLayoutWidth(area.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY;
|
|
80
85
|
const baselineWidth = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths[areaName];
|
|
81
|
-
const requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay) : getTargetWidth(area, isSideNavOverlay);
|
|
86
|
+
const requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay, isXlViewport) : getTargetWidth(area, isSideNavOverlay, isXlViewport);
|
|
82
87
|
const target = clampTargetWidth({
|
|
83
88
|
target: requestedTarget,
|
|
84
89
|
min,
|
|
@@ -124,12 +129,12 @@ export function calculateLayoutAreaStates({
|
|
|
124
129
|
overflow -= reduction;
|
|
125
130
|
}
|
|
126
131
|
if (hasPanelClearance && panel) {
|
|
127
|
-
var
|
|
132
|
+
var _widths$get5, _widths$get6;
|
|
128
133
|
// Opening/viewport fitting gives up SideNav width before Chat. During a
|
|
129
134
|
// panel drag only SideNav yields; Chat retains its starting width.
|
|
130
135
|
const isPanelResize = (resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.area) === 'panel';
|
|
131
|
-
const desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
132
|
-
const overlayDefault =
|
|
136
|
+
const desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, isXlViewport, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
137
|
+
const overlayDefault = getDefaultWidth(panel, isSideNavOverlay, isXlViewport);
|
|
133
138
|
const reservedMainWidth = isPanelResize ? Math.max(effectiveMainMinWidth, desiredPanelWidth + 32,
|
|
134
139
|
// Above the default, Main must also fit the panel within its 90% cap.
|
|
135
140
|
desiredPanelWidth > overlayDefault ? desiredPanelWidth / 0.9 : 0) : effectiveMainMinWidth;
|
|
@@ -166,7 +171,7 @@ export function calculateLayoutAreaStates({
|
|
|
166
171
|
const inlineChatPanelWidth = (_states$chatPanel$wi = (_states$chatPanel = states['chat-panel']) === null || _states$chatPanel === void 0 ? void 0 : _states$chatPanel.width) !== null && _states$chatPanel$wi !== void 0 ? _states$chatPanel$wi : 0;
|
|
167
172
|
const mainAreaWidth = Math.max(0, availableWidth - inlineSideNavWidth - inlineChatPanelWidth);
|
|
168
173
|
for (const areaName of ['side-nav', 'panel', 'chat-panel']) {
|
|
169
|
-
var _states$areaName
|
|
174
|
+
var _states$areaName;
|
|
170
175
|
const area = areas[areaName];
|
|
171
176
|
if (!(area !== null && area !== void 0 && area.isOpen) || ((_states$areaName = states[areaName]) === null || _states$areaName === void 0 ? void 0 : _states$areaName.mode) === 'inline' || areaName === 'side-nav' && shouldCollapseSideNav) {
|
|
172
177
|
continue;
|
|
@@ -176,11 +181,11 @@ export function calculateLayoutAreaStates({
|
|
|
176
181
|
// Chat covers Root; SideNav and the local panel overlay Main's grid track.
|
|
177
182
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
178
183
|
const layoutMax = (areaName === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
179
|
-
const defaultWidth =
|
|
184
|
+
const defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
180
185
|
const overlayMax = isRefinedLayout && areaName === 'panel' ? hasPanelClearance ? Math.min(availableWidth - sideNavMinWidth - inlineChatPanelWidth - 32, Math.max(defaultWidth, (availableWidth - sideNavMinWidth - inlineChatPanelWidth) * 0.9)) : Math.min(mainAreaWidth, Math.max(defaultWidth, layoutMax)) : isRefinedLayout && areaName === 'chat-panel' ? Math.min(layoutWidth, Math.max(defaultWidth, layoutMax)) : layoutMax;
|
|
181
186
|
const max = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? Math.max(min, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
182
187
|
const effectiveMin = isRefinedLayout && (areaName === 'panel' || areaName === 'chat-panel') ? min : Math.min(min, max);
|
|
183
|
-
const target = getOverlayTargetWidth(area, isSideNavOverlay, areaName);
|
|
188
|
+
const target = getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName);
|
|
184
189
|
const width = clampTargetWidth({
|
|
185
190
|
target,
|
|
186
191
|
min: effectiveMin,
|
|
@@ -62,6 +62,7 @@ export function LayoutAreaSizingProvider({
|
|
|
62
62
|
}, []);
|
|
63
63
|
const mainMinWidth = useRef(defaultMainMinWidth);
|
|
64
64
|
const loadRef = useRef(() => {});
|
|
65
|
+
const viewportWidthAtLoad = useRef();
|
|
65
66
|
const ready = useRef(false);
|
|
66
67
|
const waiting = useRef([]);
|
|
67
68
|
const pending = useRef([]);
|
|
@@ -87,6 +88,7 @@ export function LayoutAreaSizingProvider({
|
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
loading = true;
|
|
91
|
+
viewportWidthAtLoad.current = window.innerWidth;
|
|
90
92
|
void import( /* webpackChunkName: "@atlaskit-internal_navigation-layout-sizing" */'./layout-area-sizing-runtime').then(({
|
|
91
93
|
LayoutAreaSizingRuntime
|
|
92
94
|
}) => {
|
|
@@ -221,6 +223,7 @@ export function LayoutAreaSizingProvider({
|
|
|
221
223
|
}, children))), Runtime && /*#__PURE__*/React.createElement(Runtime, {
|
|
222
224
|
layoutRef: layoutRef,
|
|
223
225
|
onReady: onReady,
|
|
224
|
-
onUpdate: onUpdate
|
|
226
|
+
onUpdate: onUpdate,
|
|
227
|
+
viewportWidthAtLoad: viewportWidthAtLoad.current
|
|
225
228
|
}));
|
|
226
229
|
}
|
|
@@ -23,7 +23,8 @@ export function LayoutAreaSizingRuntime({
|
|
|
23
23
|
children,
|
|
24
24
|
layoutRef,
|
|
25
25
|
onReady,
|
|
26
|
-
onUpdate
|
|
26
|
+
onUpdate,
|
|
27
|
+
viewportWidthAtLoad
|
|
27
28
|
}) {
|
|
28
29
|
var _areas$panel2;
|
|
29
30
|
const occupiedWidth = useOccupiedLayoutWidth(layoutRef);
|
|
@@ -33,7 +34,10 @@ export function LayoutAreaSizingRuntime({
|
|
|
33
34
|
const [resizeSession, setResizeSession] = useState(null);
|
|
34
35
|
const areaStatesRef = React.useRef({});
|
|
35
36
|
const configsRef = React.useRef({});
|
|
36
|
-
|
|
37
|
+
// A viewport change while the chunk loads is already a layout event. Reallocate
|
|
38
|
+
// instead of adopting CSS geometry from the preceding breakpoint (which WebKit
|
|
39
|
+
// can still report during that handoff).
|
|
40
|
+
const [hasInteraction, setHasInteraction] = useState(viewportWidthAtLoad !== undefined && viewportWidthAtLoad !== window.innerWidth);
|
|
37
41
|
const adoptedConstraints = React.useRef(null);
|
|
38
42
|
// Preserve the CSS handoff only while its available space is unchanged.
|
|
39
43
|
const isPreservingInitialLayout = !hasInteraction && (!adoptedConstraints.current || adoptedConstraints.current.occupiedWidth === occupiedWidth && adoptedConstraints.current.mainMinWidth === mainMinWidth);
|
|
@@ -66,6 +70,7 @@ export function LayoutAreaSizingRuntime({
|
|
|
66
70
|
// Match the actual rem-based grid breakpoint, including browser font settings.
|
|
67
71
|
const inlineChatQuery = window.matchMedia('(min-width: 40rem)');
|
|
68
72
|
const inlineSideNavQuery = window.matchMedia('(min-width: 64rem)');
|
|
73
|
+
const xlQuery = window.matchMedia('(min-width: 110.5rem)');
|
|
69
74
|
const updateDimensions = contentWidth => {
|
|
70
75
|
var _style$width, _style$paddingLeft, _style$paddingRight, _style$borderLeftWidt, _style$borderRightWid, _previous;
|
|
71
76
|
const style = root && contentWidth === undefined ? getComputedStyle(root) : null;
|
|
@@ -80,9 +85,10 @@ export function LayoutAreaSizingRuntime({
|
|
|
80
85
|
viewportWidth: window.innerWidth,
|
|
81
86
|
layoutWidth,
|
|
82
87
|
isChatPanelOverlay: !inlineChatQuery.matches,
|
|
83
|
-
isSideNavOverlay: !inlineSideNavQuery.matches
|
|
88
|
+
isSideNavOverlay: !inlineSideNavQuery.matches,
|
|
89
|
+
isXlViewport: xlQuery.matches
|
|
84
90
|
};
|
|
85
|
-
if (((_previous = previous) === null || _previous === void 0 ? void 0 : _previous.viewportWidth) === next.viewportWidth && previous.layoutWidth === next.layoutWidth && previous.isChatPanelOverlay === next.isChatPanelOverlay && previous.isSideNavOverlay === next.isSideNavOverlay) {
|
|
91
|
+
if (((_previous = previous) === null || _previous === void 0 ? void 0 : _previous.viewportWidth) === next.viewportWidth && previous.layoutWidth === next.layoutWidth && previous.isChatPanelOverlay === next.isChatPanelOverlay && previous.isSideNavOverlay === next.isSideNavOverlay && previous.isXlViewport === next.isXlViewport) {
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
94
|
if (previous) {
|
|
@@ -114,7 +120,12 @@ export function LayoutAreaSizingRuntime({
|
|
|
114
120
|
type: 'change',
|
|
115
121
|
listener: () => updateDimensions()
|
|
116
122
|
});
|
|
123
|
+
const unbindXlQuery = bind(xlQuery, {
|
|
124
|
+
type: 'change',
|
|
125
|
+
listener: () => updateDimensions()
|
|
126
|
+
});
|
|
117
127
|
return () => {
|
|
128
|
+
unbindXlQuery();
|
|
118
129
|
observer.disconnect();
|
|
119
130
|
unbindResize();
|
|
120
131
|
unbindQuery();
|
|
@@ -123,14 +134,14 @@ export function LayoutAreaSizingRuntime({
|
|
|
123
134
|
}, [layoutRef]);
|
|
124
135
|
const registerArea = useCallback((area, config) => {
|
|
125
136
|
const previous = configsRef.current[area];
|
|
126
|
-
if (adoptedConstraints.current && (!previous || previous.isOpen !== config.isOpen || previous.requestedWidth !== config.requestedWidth || previous.minWidth !== config.minWidth || previous.maxWidth !== config.maxWidth || previous.defaultWidth !== config.defaultWidth || previous.compactDefaultWidth !== config.compactDefaultWidth)) {
|
|
137
|
+
if (adoptedConstraints.current && (!previous || previous.isOpen !== config.isOpen || previous.requestedWidth !== config.requestedWidth || previous.minWidth !== config.minWidth || previous.maxWidth !== config.maxWidth || previous.defaultWidth !== config.defaultWidth || previous.compactDefaultWidth !== config.compactDefaultWidth || previous.xlDefaultWidth !== config.xlDefaultWidth)) {
|
|
127
138
|
setHasInteraction(true);
|
|
128
139
|
}
|
|
129
140
|
configsRef.current[area] = config;
|
|
130
141
|
setResizeSession(current => {
|
|
131
142
|
// A changed layout/configuration needs a fresh allocation. A controlled
|
|
132
143
|
// acknowledgement for the resized area keeps its siblings fixed.
|
|
133
|
-
return previous && (previous.isOpen === config.isOpen || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') && previous.minWidth === config.minWidth && previous.maxWidth === config.maxWidth && previous.defaultWidth === config.defaultWidth && previous.compactDefaultWidth === config.compactDefaultWidth && (previous.requestedWidth === config.requestedWidth || (current === null || current === void 0 ? void 0 : current.area) === area && current.completedWidth === config.requestedWidth || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') ? current : null;
|
|
144
|
+
return previous && (previous.isOpen === config.isOpen || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') && previous.minWidth === config.minWidth && previous.maxWidth === config.maxWidth && previous.defaultWidth === config.defaultWidth && previous.compactDefaultWidth === config.compactDefaultWidth && previous.xlDefaultWidth === config.xlDefaultWidth && (previous.requestedWidth === config.requestedWidth || (current === null || current === void 0 ? void 0 : current.area) === area && current.completedWidth === config.requestedWidth || area === 'side-nav' && !config.isOpen && (current === null || current === void 0 ? void 0 : current.area) !== 'side-nav') ? current : null;
|
|
134
145
|
});
|
|
135
146
|
setAreas(current => {
|
|
136
147
|
const existing = current[area];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { layoutAreaStateContexts } from './layout-area-state-contexts';
|
|
2
3
|
import { gridRootChatFitId, gridRootId } from './root';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -10,6 +11,13 @@ export function LayoutOverlayClearance({
|
|
|
10
11
|
panelMinWidth,
|
|
11
12
|
mainMinWidth
|
|
12
13
|
}) {
|
|
14
|
+
const sideNavSizing = useContext(layoutAreaStateContexts['side-nav']);
|
|
15
|
+
const chatSizing = useContext(layoutAreaStateContexts['chat-panel']);
|
|
16
|
+
// A newly opened local panel can be unmeasured for one render after its siblings have
|
|
17
|
+
// joined the resize coordinator. Its CSS fallback must not overwrite their managed widths.
|
|
18
|
+
if (sideNavSizing || chatSizing) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
13
21
|
const navMin = 'var(--n_clearanceNavMin, 0px)';
|
|
14
22
|
const navTarget = 'var(--n_clearanceNavTarget, 0px)';
|
|
15
23
|
const chatMinimum = 'var(--n_clearanceChatMin, 0px)';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.
|
|
1
|
+
._nd5l108g{grid-area:var(--p_lclPnlEnterArea,var(--p_lclPnlSsrArea,main))}
|
|
2
|
+
._nd5l12pz{grid-area:var(--p_lclPnlEnterArea,panel)}
|
|
2
3
|
._nd5l1gzg{grid-area:main}
|
|
3
|
-
._nd5l32aw{grid-area:var(--p_lclPnlSsrArea,main)}
|
|
4
4
|
._y44v1mph{animation:var(--ds-panel-content-enter,.15s cubic-bezier(.4,1,.6,1) FadeIn0to100)}
|
|
5
5
|
._y44vf1qi{animation:var(--ds-panel-content-exit,50ms cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
|
|
6
6
|
._191wbqna{border-inline-start:var(--p_lclPnlSsrBorder,none)}
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
22
22
|
._bfhk1g1j{background-color:var(--p_lclPnlSsrBackground,var(--ds-surface-overlay,#fff))}
|
|
23
23
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
24
|
-
._ifwb1uuk{--p_lclPnlMotionW:var(--p_lclPnlCompactW)}
|
|
25
|
-
._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
|
|
26
24
|
._kqsw1if8{position:sticky}
|
|
27
25
|
._vchhusvi{box-sizing:border-box}
|
|
28
|
-
@media (prefers-reduced-motion:no-preference){.
|
|
29
|
-
@media (min-width:64rem){._1c23i77x{--p_lclPnlMotionW:var(--p_lclPnlTrackW)}}
|
|
26
|
+
@media (prefers-reduced-motion:no-preference){._15et3aws{width:min(90cqw,var(--p_lclPnlSsrPreferredW))}._15etq93i{width:max(var(--p_lclPnlMinW),min(var(--p_lclPnlSsrPreferredW),var(--p_lclPnlMotionMaxW,min(100cqw,var(--n_localPanelOverlayMax,100cqw),max(var(--p_lclPnlSsrDefaultW),90cqw)))))}._k1afi8w4{animation:var(--ds-panel-content-open,.15s cubic-bezier(.16,1,.3,1) FadeIn0to100 .1s)}._k1afry0p{animation:var(--ds-panel-exit-right,.2s cubic-bezier(.25,1,.5,1) SlideOut100PercentRight)}._1lh81gzg{grid-area:main}[dir=rtl] ._105a97o5{animation:var(--ds-panel-exit-left,.2s cubic-bezier(.25,1,.5,1) SlideOut100PercentLeft)}._15et1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}._k1afx3bs{animation:var(--ds-panel-enter-right,.2s cubic-bezier(.16,1,.3,1) SlideIn100PercentRight)}[dir=rtl] ._105az3zp{animation:var(--ds-panel-enter-left,.2s cubic-bezier(.16,1,.3,1) SlideIn100PercentLeft)}}
|
|
@@ -11,35 +11,34 @@ import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
12
|
import { localPanelWidthVar } from './constants';
|
|
13
13
|
import { DangerouslyHoistSlotSizes } from './hoist-slot-sizes-context';
|
|
14
|
+
import { LayoutOverlayClearance } from './layout-overlay-clearance';
|
|
15
|
+
import { MainMinWidthContext } from './main-min-width-context';
|
|
14
16
|
import { PanelSplitter } from './panel-splitter/panel-splitter';
|
|
15
17
|
import { PanelSplitterProvider } from './panel-splitter/provider';
|
|
18
|
+
import { usePanelContentEnter } from './use-panel-content-enter';
|
|
16
19
|
const localPanelVar = '--p_lclPnlW';
|
|
17
20
|
const panelSplitterResizingVar = '--p_lclPnlRsz';
|
|
18
21
|
const localPanelSplitterId = Symbol('LocalPanel PanelSplitter');
|
|
19
22
|
|
|
20
23
|
// Compiled preserves the existing container-relative widths and discrete motion styles.
|
|
21
|
-
/* eslint-disable @compiled/shorthand-property-sorting -- Content motion overrides only the animation delay. */
|
|
22
24
|
const styles = {
|
|
23
25
|
panelWrapper: "_nd5l1gzg _kqsw1if8 _bfhk1bhr _vchhusvi _4t3ieqxy _152tidpf _10fph9n0 _1bsb13q4",
|
|
24
|
-
managedInline: "
|
|
26
|
+
managedInline: "_nd5l12pz _bfhkvuon _152tidpf _1bsb1c5w",
|
|
25
27
|
refinedUnmeasured: "_1bsb123g",
|
|
26
|
-
unmeasured: "
|
|
28
|
+
unmeasured: "_nd5l108g _191wbqna _1bsb1cku _bfhk1g1j _16qs1dhr",
|
|
27
29
|
managedOverlay: "_nd5l1gzg _bfhk1bhr _1bsb1c5w",
|
|
28
30
|
panelScrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
29
31
|
border: "_191wglyw _16qs130s",
|
|
30
32
|
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
31
|
-
entering: "
|
|
32
|
-
motionUnmeasured: "
|
|
33
|
-
|
|
33
|
+
entering: "_k1afx3bs _15et1c5w _105az3zp",
|
|
34
|
+
motionUnmeasured: "_15et3aws",
|
|
35
|
+
refinedMotionUnmeasured: "_15etq93i",
|
|
36
|
+
exiting: "_k1afry0p _1lh81gzg _15et1c5w _105a97o5",
|
|
34
37
|
contentEntering: "_y44v1mph",
|
|
38
|
+
contentEnteringOnOpen: "_k1afi8w4",
|
|
35
39
|
contentExiting: "_y44vf1qi",
|
|
36
40
|
contentChangeContainer: "_4t3i1osq"
|
|
37
41
|
};
|
|
38
|
-
const contentEnteringDelayStyles = {
|
|
39
|
-
root: "_ju25dn4k"
|
|
40
|
-
};
|
|
41
|
-
/* eslint-enable @compiled/shorthand-property-sorting */
|
|
42
|
-
|
|
43
42
|
const PanelContentMotion = ({
|
|
44
43
|
children
|
|
45
44
|
}) => {
|
|
@@ -75,6 +74,7 @@ export function LocalPanelSurface({
|
|
|
75
74
|
onResizeEnd
|
|
76
75
|
}) {
|
|
77
76
|
var _managedSizing$mode, _managedSizing$width;
|
|
77
|
+
const mainMinWidth = useContext(MainMinWidthContext);
|
|
78
78
|
const ref = useRef(null);
|
|
79
79
|
const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
80
80
|
useLayoutEffect(() => {
|
|
@@ -114,6 +114,7 @@ export function LocalPanelSurface({
|
|
|
114
114
|
state,
|
|
115
115
|
ref: motionRef
|
|
116
116
|
} = useMotion();
|
|
117
|
+
const shouldAnimateContentEnter = usePanelContentEnter(state);
|
|
117
118
|
const isMotionUpliftEnabled = fg('platform-dst-motion-uplift-panel');
|
|
118
119
|
const isContentMotionEnabled = fg('platform-dst-motion-uplift-panel-content');
|
|
119
120
|
const mergedRef = useMemo(() => isMotionUpliftEnabled ? mergeRefs([ref, motionRef]) : ref, [isMotionUpliftEnabled, motionRef]);
|
|
@@ -165,8 +166,14 @@ export function LocalPanelSurface({
|
|
|
165
166
|
[localPanelVar]: `${renderedWidth}px`
|
|
166
167
|
},
|
|
167
168
|
ref: mergedRef,
|
|
168
|
-
className: ax([
|
|
169
|
-
},
|
|
169
|
+
className: ax([styles.panelWrapper, styles.border, !managedSizing && styles.unmeasured, !managedSizing && fg('platform-dst-chat-panel-layout') && styles.refinedUnmeasured, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInline, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'overlay' && styles.managedOverlay, (managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) === 'inline' && styles.managedInlineBorder, isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && styles.motionUnmeasured, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && fg('platform-dst-chat-panel-layout') && styles.refinedMotionUnmeasured])
|
|
170
|
+
}, !managedSizing && fg('platform-dst-chat-panel-layout') &&
|
|
171
|
+
/*#__PURE__*/
|
|
172
|
+
// Keep sibling allocation stable until the exiting surface actually unmounts.
|
|
173
|
+
React.createElement(LayoutOverlayClearance, {
|
|
174
|
+
panelMinWidth: minWidth,
|
|
175
|
+
mainMinWidth: mainMinWidth
|
|
176
|
+
}), /*#__PURE__*/React.createElement(PanelSplitterProvider, {
|
|
170
177
|
panelId: localPanelSplitterId,
|
|
171
178
|
panelRef: ref,
|
|
172
179
|
resizingElementRef: layoutRef,
|
|
@@ -182,7 +189,7 @@ export function LocalPanelSurface({
|
|
|
182
189
|
}, /*#__PURE__*/React.createElement("div", {
|
|
183
190
|
ref: scrollRef,
|
|
184
191
|
"data-testid": testId && `${testId}--scroll-container`,
|
|
185
|
-
className: ax([styles.panelScrollContainer, state === 'entering' && styles.contentEntering, isMotionUpliftEnabled &&
|
|
192
|
+
className: ax([styles.panelScrollContainer, !isMotionUpliftEnabled && state === 'entering' && styles.contentEntering, isMotionUpliftEnabled && shouldAnimateContentEnter && styles.contentEnteringOnOpen, state === 'exiting' && styles.contentExiting])
|
|
186
193
|
}, isContentMotionEnabled && contentKey !== undefined ? /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
187
194
|
exitThenEnter: true
|
|
188
195
|
}, /*#__PURE__*/React.createElement(PanelContentMotion, {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
._4t3i1osq{height:100%}
|
|
18
18
|
._7cca15wb{container-type:inline-size}
|
|
19
19
|
._82e815vq._82e815vq{overflow-y:hidden}
|
|
20
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
20
21
|
._cw8k1fc5{--p_lclPnlSsrDefaultW:var(--p_lclPnlCompactDefaultW)}
|
|
21
22
|
._evra4a59{--p_lclPnlSsrInlineAreas:"main panel"}
|
|
22
23
|
._f8371m6a._f8371m6a{grid-template-areas:"main"}
|
|
@@ -25,5 +26,6 @@
|
|
|
25
26
|
._vlegi47z._vlegi47z{grid-template-columns:minmax(0,1fr)}
|
|
26
27
|
._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
|
|
27
28
|
._yv0ei47z{grid-template-columns:minmax(0,1fr)}
|
|
28
|
-
@media (prefers-reduced-motion:no-preference){.
|
|
29
|
-
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
29
|
+
@media (prefers-reduced-motion:no-preference){._1cro60m4{animation-name:k1jtk5cx}._wqfno73m{animation-duration:calc(var(--ds-duration-medium, .2s)*.3)}@keyframes k1jtk5cx{0%{grid-template-areas:"main";grid-template-columns:minmax(0,1fr);grid-template-rows:1fr;--p_lclPnlEnterArea:main}to{grid-template-areas:"main";grid-template-columns:minmax(0,1fr);grid-template-rows:1fr;--p_lclPnlEnterArea:main}}}
|
|
30
|
+
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
31
|
+
@media (min-width:110.5rem){._1qxn1ykh{--p_lclPnlSsrPreferredW:var(--p_lclPnlXlW)}._13bt1t8m{--p_lclPnlSsrDefaultW:var(--p_lclPnlXlDefaultW)}}
|
|
@@ -4,7 +4,6 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useContext, useId } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
|
-
import { LayoutOverlayClearance } from './layout-overlay-clearance';
|
|
8
7
|
import { MainMinWidthContext } from './main-min-width-context';
|
|
9
8
|
|
|
10
9
|
// The grid uses runtime CSS variables and container sizing outside @atlaskit/css's bounded values.
|
|
@@ -12,19 +11,19 @@ const localPanelTrackWidthVar = '--p_lclPnlTrackW';
|
|
|
12
11
|
const localPanelResizingVar = '--p_lclPnlRsz';
|
|
13
12
|
const localPanelMinWidthVar = '--p_lclPnlMinW';
|
|
14
13
|
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
const holdClosedGrid = null;
|
|
14
|
+
// One CSS animation holds both the grid and its surface placement until the layout snap.
|
|
15
|
+
// Identical keyframes keep the layout static; normal styles take over at 60ms.
|
|
16
|
+
const holdPanelTrack = null;
|
|
19
17
|
const styles = {
|
|
20
|
-
panelEntering: "_1cro1qv1 _wqfn147i _sl5p1ign _dqw8eoah",
|
|
21
18
|
container: "_1f38177r _7cca15wb _4t3i1osq _1bsb1osq",
|
|
22
19
|
layout: "_1reo1wug _18m91wug _1e0c11p5 _7cca15wb _1lmc1m6a _yv0ei47z _2z05hkll _4t3i1osq _1bsb1osq",
|
|
23
20
|
mainContent: "_nd5l1gzg _1reo1wug _18m91wug _1e0c1txw _4t3i1osq _19121cl4",
|
|
24
|
-
panelUplift: "_1reo15vq _18m915vq",
|
|
25
|
-
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6
|
|
21
|
+
panelUplift: "_1reo15vq _18m915vq _bfhkvuon",
|
|
22
|
+
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6",
|
|
23
|
+
unmeasuredWidths: "_129o1uuk _cw8k1fc5 _peezi77x _1tg31owj _1qxn1ykh _13bt1t8m",
|
|
26
24
|
managedInline: "_1uwq15vq _82e815vq _f8374a59 _1l7c1wug _vleg1orf",
|
|
27
25
|
managedOverlay: "_1uwq15vq _82e815vq _f8371m6a _vlegi47z _1l7chkll",
|
|
26
|
+
entering: "_1cro60m4 _wqfno73m",
|
|
28
27
|
panelClosed: "_f8371m6a _vlegi47z _1l7chkll"
|
|
29
28
|
};
|
|
30
29
|
/**
|
|
@@ -36,12 +35,14 @@ export function PanelLayoutShell({
|
|
|
36
35
|
isPanelOpen,
|
|
37
36
|
panelWidth,
|
|
38
37
|
compactPanelWidth,
|
|
38
|
+
xlPanelWidth,
|
|
39
|
+
xlDefaultPanelWidth,
|
|
39
40
|
defaultPanelWidth,
|
|
40
41
|
compactDefaultPanelWidth,
|
|
41
42
|
panelMinWidth = 320,
|
|
42
43
|
mode,
|
|
43
44
|
layoutRef,
|
|
44
|
-
|
|
45
|
+
isMotionEnabled = false,
|
|
45
46
|
testId
|
|
46
47
|
}) {
|
|
47
48
|
const mainMinWidth = useContext(MainMinWidthContext);
|
|
@@ -52,10 +53,13 @@ export function PanelLayoutShell({
|
|
|
52
53
|
const inlineQuery = `@container local-panel-layout (min-width: ${mainMinWidth + panelMinWidth}px)`;
|
|
53
54
|
return /*#__PURE__*/React.createElement("div", {
|
|
54
55
|
className: ax([styles.container])
|
|
55
|
-
}, mode === undefined &&
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
}, mode === undefined && isMotionEnabled && fg('platform-dst-chat-panel-layout') &&
|
|
57
|
+
/*#__PURE__*/
|
|
58
|
+
// Keep the inline motion cap available during exit, after the open-only track rule is removed.
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Instance-scoped query matches the SSR inline allocation, including caller-defined minimums.
|
|
60
|
+
React.createElement("style", null, `${inlineQuery} {
|
|
61
|
+
#${id} { --p_lclPnlMotionMaxW: calc(100cqw - ${mainMinWidth}px); }
|
|
62
|
+
}`), mode === undefined && isPanelOpen &&
|
|
59
63
|
/*#__PURE__*/
|
|
60
64
|
// 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.
|
|
61
65
|
React.createElement("style", null, `${inlineQuery} {
|
|
@@ -79,12 +83,14 @@ export function PanelLayoutShell({
|
|
|
79
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
80
84
|
[localPanelMinWidthVar]: `${panelMinWidth}px`,
|
|
81
85
|
'--p_lclPnlCompactW': `${compactPanelWidth}px`,
|
|
86
|
+
'--p_lclPnlXlW': `${xlPanelWidth}px`,
|
|
87
|
+
'--p_lclPnlXlDefaultW': `${xlDefaultPanelWidth}px`,
|
|
82
88
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
83
89
|
'--p_lclPnlDefaultW': `${defaultPanelWidth}px`,
|
|
84
90
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
85
91
|
'--p_lclPnlCompactDefaultW': `${compactDefaultPanelWidth}px`
|
|
86
92
|
},
|
|
87
|
-
className: ax([styles.layout, mode === undefined && isPanelOpen && styles.unmeasured,
|
|
93
|
+
className: ax([styles.layout, mode === undefined && styles.unmeasuredWidths, mode === undefined && isPanelOpen && styles.unmeasured, isMotionEnabled && styles.panelUplift, mode === 'inline' && styles.managedInline, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed, isPanelOpen && isMotionEnabled && styles.entering])
|
|
88
94
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
95
|
className: ax([styles.mainContent])
|
|
90
96
|
}, children), panel));
|