@atlaskit/navigation-system 11.7.8 → 11.8.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 +20 -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 +28 -7
- package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/cjs/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/cjs/ui/page-layout/panel-layout-shell.js +11 -8
- package/dist/cjs/ui/page-layout/panel-layout.js +9 -1
- package/dist/cjs/ui/page-layout/use-layout-area-sizing.js +3 -1
- 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 +26 -7
- package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/es2019/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/es2019/ui/page-layout/panel-layout-shell.js +14 -7
- package/dist/es2019/ui/page-layout/panel-layout.js +7 -1
- package/dist/es2019/ui/page-layout/use-layout-area-sizing.js +3 -1
- 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 +28 -7
- package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +1 -3
- package/dist/esm/ui/page-layout/local-panel-surface.js +13 -3
- package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +2 -1
- package/dist/esm/ui/page-layout/panel-layout-shell.js +11 -8
- package/dist/esm/ui/page-layout/panel-layout.js +9 -1
- package/dist/esm/ui/page-layout/use-layout-area-sizing.js +3 -1
- 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/panel-layout-shell.d.ts +3 -1
- package/dist/types/ui/page-layout/panel-layout.d.ts +8 -1
- package/package.json +6 -6
|
@@ -23,8 +23,10 @@ export function LayoutAreaSizingRuntime({
|
|
|
23
23
|
children,
|
|
24
24
|
layoutRef,
|
|
25
25
|
onReady,
|
|
26
|
-
onUpdate
|
|
26
|
+
onUpdate,
|
|
27
|
+
viewportWidthAtLoad
|
|
27
28
|
}) {
|
|
29
|
+
var _areas$panel2;
|
|
28
30
|
const occupiedWidth = useOccupiedLayoutWidth(layoutRef);
|
|
29
31
|
const [dimensions, setDimensions] = useState(null);
|
|
30
32
|
const [mainMinWidth, setMainMinWidth] = useState(defaultMainMinWidth);
|
|
@@ -32,7 +34,10 @@ export function LayoutAreaSizingRuntime({
|
|
|
32
34
|
const [resizeSession, setResizeSession] = useState(null);
|
|
33
35
|
const areaStatesRef = React.useRef({});
|
|
34
36
|
const configsRef = React.useRef({});
|
|
35
|
-
|
|
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);
|
|
36
41
|
const adoptedConstraints = React.useRef(null);
|
|
37
42
|
// Preserve the CSS handoff only while its available space is unchanged.
|
|
38
43
|
const isPreservingInitialLayout = !hasInteraction && (!adoptedConstraints.current || adoptedConstraints.current.occupiedWidth === occupiedWidth && adoptedConstraints.current.mainMinWidth === mainMinWidth);
|
|
@@ -65,6 +70,7 @@ export function LayoutAreaSizingRuntime({
|
|
|
65
70
|
// Match the actual rem-based grid breakpoint, including browser font settings.
|
|
66
71
|
const inlineChatQuery = window.matchMedia('(min-width: 40rem)');
|
|
67
72
|
const inlineSideNavQuery = window.matchMedia('(min-width: 64rem)');
|
|
73
|
+
const xlQuery = window.matchMedia('(min-width: 110.5rem)');
|
|
68
74
|
const updateDimensions = contentWidth => {
|
|
69
75
|
var _style$width, _style$paddingLeft, _style$paddingRight, _style$borderLeftWidt, _style$borderRightWid, _previous;
|
|
70
76
|
const style = root && contentWidth === undefined ? getComputedStyle(root) : null;
|
|
@@ -79,9 +85,10 @@ export function LayoutAreaSizingRuntime({
|
|
|
79
85
|
viewportWidth: window.innerWidth,
|
|
80
86
|
layoutWidth,
|
|
81
87
|
isChatPanelOverlay: !inlineChatQuery.matches,
|
|
82
|
-
isSideNavOverlay: !inlineSideNavQuery.matches
|
|
88
|
+
isSideNavOverlay: !inlineSideNavQuery.matches,
|
|
89
|
+
isXlViewport: xlQuery.matches
|
|
83
90
|
};
|
|
84
|
-
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) {
|
|
85
92
|
return;
|
|
86
93
|
}
|
|
87
94
|
if (previous) {
|
|
@@ -113,7 +120,12 @@ export function LayoutAreaSizingRuntime({
|
|
|
113
120
|
type: 'change',
|
|
114
121
|
listener: () => updateDimensions()
|
|
115
122
|
});
|
|
123
|
+
const unbindXlQuery = bind(xlQuery, {
|
|
124
|
+
type: 'change',
|
|
125
|
+
listener: () => updateDimensions()
|
|
126
|
+
});
|
|
116
127
|
return () => {
|
|
128
|
+
unbindXlQuery();
|
|
117
129
|
observer.disconnect();
|
|
118
130
|
unbindResize();
|
|
119
131
|
unbindQuery();
|
|
@@ -122,14 +134,14 @@ export function LayoutAreaSizingRuntime({
|
|
|
122
134
|
}, [layoutRef]);
|
|
123
135
|
const registerArea = useCallback((area, config) => {
|
|
124
136
|
const previous = configsRef.current[area];
|
|
125
|
-
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)) {
|
|
126
138
|
setHasInteraction(true);
|
|
127
139
|
}
|
|
128
140
|
configsRef.current[area] = config;
|
|
129
141
|
setResizeSession(current => {
|
|
130
142
|
// A changed layout/configuration needs a fresh allocation. A controlled
|
|
131
143
|
// acknowledgement for the resized area keeps its siblings fixed.
|
|
132
|
-
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;
|
|
133
145
|
});
|
|
134
146
|
setAreas(current => {
|
|
135
147
|
const existing = current[area];
|
|
@@ -410,18 +422,25 @@ export function LayoutAreaSizingRuntime({
|
|
|
410
422
|
return () => onReady === null || onReady === void 0 ? void 0 : onReady(null);
|
|
411
423
|
}, [onReady, value]);
|
|
412
424
|
useEffect(() => {
|
|
425
|
+
var _configsRef$current$p, _areas$panel;
|
|
413
426
|
if (!adoptedConstraints.current && (sideNavState || panelState || chatPanelState)) {
|
|
414
427
|
adoptedConstraints.current = {
|
|
415
428
|
occupiedWidth,
|
|
416
429
|
mainMinWidth
|
|
417
430
|
};
|
|
418
431
|
}
|
|
432
|
+
// A controlled panel can acknowledge a resize in this same commit. Its
|
|
433
|
+
// registration queues the new allocation before this effect runs; avoid
|
|
434
|
+
// publishing an allocation calculated from the previous requested width.
|
|
435
|
+
if (((_configsRef$current$p = configsRef.current.panel) === null || _configsRef$current$p === void 0 ? void 0 : _configsRef$current$p.requestedWidth) !== ((_areas$panel = areas.panel) === null || _areas$panel === void 0 ? void 0 : _areas$panel.requestedWidth)) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
419
438
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate({
|
|
420
439
|
'side-nav': sideNavState,
|
|
421
440
|
panel: panelState,
|
|
422
441
|
'chat-panel': chatPanelState
|
|
423
442
|
});
|
|
424
|
-
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth]);
|
|
443
|
+
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth, (_areas$panel2 = areas.panel) === null || _areas$panel2 === void 0 ? void 0 : _areas$panel2.requestedWidth]);
|
|
425
444
|
return /*#__PURE__*/React.createElement(LayoutAreaSizingContext.Provider, {
|
|
426
445
|
value: value
|
|
427
446
|
}, /*#__PURE__*/React.createElement(SideNavStateProvider, {
|
|
@@ -21,9 +21,7 @@
|
|
|
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
24
|
._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
|
|
26
25
|
._kqsw1if8{position:sticky}
|
|
27
26
|
._vchhusvi{box-sizing:border-box}
|
|
28
|
-
@media (prefers-reduced-motion:no-preference){.
|
|
29
|
-
@media (min-width:64rem){._1c23i77x{--p_lclPnlMotionW:var(--p_lclPnlTrackW)}}
|
|
27
|
+
@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)))))}._k1af14vv{animation:var(--ds-panel-exit-right,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentRight)}._1lh81gzg{grid-area:main}[dir=rtl] ._105aeydr{animation:var(--ds-panel-exit-left,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentLeft)}._15et1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}@starting-style{._12d81gzg{grid-area:main}}._k1af1nn1{animation:var(--ds-panel-enter-right,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentRight)}[dir=rtl] ._105abamb{animation:var(--ds-panel-enter-left,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentLeft)}._10t81q8v{transition-property:grid-area}._xrrp147i{transition-duration:var(--ds-duration-instant,0ms)}._1wsa1ign{transition-delay:var(--ds-duration-short,.15s)}._1vrh1a5r{transition-behavior:allow-discrete}}
|
|
@@ -11,6 +11,8 @@ 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';
|
|
16
18
|
const localPanelVar = '--p_lclPnlW';
|
|
@@ -29,7 +31,8 @@ const styles = {
|
|
|
29
31
|
border: "_191wglyw _16qs130s",
|
|
30
32
|
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
31
33
|
entering: "_k1af1nn1 _12d81gzg _10t81q8v _xrrp147i _1wsa1ign _1vrh1a5r _15et1c5w _105abamb",
|
|
32
|
-
motionUnmeasured: "
|
|
34
|
+
motionUnmeasured: "_15et3aws",
|
|
35
|
+
refinedMotionUnmeasured: "_15etq93i",
|
|
33
36
|
exiting: "_k1af14vv _1lh81gzg _15et1c5w _105aeydr",
|
|
34
37
|
contentEntering: "_y44v1mph",
|
|
35
38
|
contentExiting: "_y44vf1qi",
|
|
@@ -75,6 +78,7 @@ export function LocalPanelSurface({
|
|
|
75
78
|
onResizeEnd
|
|
76
79
|
}) {
|
|
77
80
|
var _managedSizing$mode, _managedSizing$width;
|
|
81
|
+
const mainMinWidth = useContext(MainMinWidthContext);
|
|
78
82
|
const ref = useRef(null);
|
|
79
83
|
const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
80
84
|
useLayoutEffect(() => {
|
|
@@ -165,8 +169,14 @@ export function LocalPanelSurface({
|
|
|
165
169
|
[localPanelVar]: `${renderedWidth}px`
|
|
166
170
|
},
|
|
167
171
|
ref: mergedRef,
|
|
168
|
-
className: ax([isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && styles.motionUnmeasured, 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])
|
|
169
|
-
},
|
|
172
|
+
className: ax([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, 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])
|
|
173
|
+
}, !managedSizing && fg('platform-dst-chat-panel-layout') &&
|
|
174
|
+
/*#__PURE__*/
|
|
175
|
+
// Keep sibling allocation stable until the exiting surface actually unmounts.
|
|
176
|
+
React.createElement(LayoutOverlayClearance, {
|
|
177
|
+
panelMinWidth: minWidth,
|
|
178
|
+
mainMinWidth: mainMinWidth
|
|
179
|
+
}), /*#__PURE__*/React.createElement(PanelSplitterProvider, {
|
|
170
180
|
panelId: localPanelSplitterId,
|
|
171
181
|
panelRef: ref,
|
|
172
182
|
resizingElementRef: layoutRef,
|
|
@@ -26,4 +26,5 @@
|
|
|
26
26
|
._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
|
|
27
27
|
._yv0ei47z{grid-template-columns:minmax(0,1fr)}
|
|
28
28
|
@media (prefers-reduced-motion:no-preference){._1cro1qv1{animation-name:kv5tn2k}._wqfn147i{animation-duration:var(--ds-duration-instant,0ms)}._sl5p1ign{animation-delay:var(--ds-duration-short,.15s)}._dqw8eoah{animation-fill-mode:backwards}@keyframes kv5tn2k{0%{grid-template-areas:"main";grid-template-columns:minmax(0,1fr);grid-template-rows:1fr}}}
|
|
29
|
-
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
29
|
+
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
30
|
+
@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.
|
|
@@ -22,7 +21,8 @@ const styles = {
|
|
|
22
21
|
layout: "_1reo1wug _18m91wug _1e0c11p5 _7cca15wb _1lmc1m6a _yv0ei47z _2z05hkll _4t3i1osq _1bsb1osq",
|
|
23
22
|
mainContent: "_nd5l1gzg _1reo1wug _18m91wug _1e0c1txw _4t3i1osq _19121cl4",
|
|
24
23
|
panelUplift: "_1reo15vq _18m915vq",
|
|
25
|
-
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6
|
|
24
|
+
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6",
|
|
25
|
+
unmeasuredWidths: "_129o1uuk _cw8k1fc5 _peezi77x _1tg31owj _1qxn1ykh _13bt1t8m",
|
|
26
26
|
managedInline: "_1uwq15vq _82e815vq _f8374a59 _1l7c1wug _vleg1orf",
|
|
27
27
|
managedOverlay: "_1uwq15vq _82e815vq _f8371m6a _vlegi47z _1l7chkll",
|
|
28
28
|
panelClosed: "_f8371m6a _vlegi47z _1l7chkll"
|
|
@@ -36,6 +36,8 @@ export function PanelLayoutShell({
|
|
|
36
36
|
isPanelOpen,
|
|
37
37
|
panelWidth,
|
|
38
38
|
compactPanelWidth,
|
|
39
|
+
xlPanelWidth,
|
|
40
|
+
xlDefaultPanelWidth,
|
|
39
41
|
defaultPanelWidth,
|
|
40
42
|
compactDefaultPanelWidth,
|
|
41
43
|
panelMinWidth = 320,
|
|
@@ -52,10 +54,13 @@ export function PanelLayoutShell({
|
|
|
52
54
|
const inlineQuery = `@container local-panel-layout (min-width: ${mainMinWidth + panelMinWidth}px)`;
|
|
53
55
|
return /*#__PURE__*/React.createElement("div", {
|
|
54
56
|
className: ax([styles.container])
|
|
55
|
-
}, mode === undefined &&
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
}, mode === undefined && shouldClipOverflow && fg('platform-dst-chat-panel-layout') &&
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
// Keep the inline motion cap available during exit, after the open-only track rule is removed.
|
|
60
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Instance-scoped query matches the SSR inline allocation, including caller-defined minimums.
|
|
61
|
+
React.createElement("style", null, `${inlineQuery} {
|
|
62
|
+
#${id} { --p_lclPnlMotionMaxW: calc(100cqw - ${mainMinWidth}px); }
|
|
63
|
+
}`), mode === undefined && isPanelOpen &&
|
|
59
64
|
/*#__PURE__*/
|
|
60
65
|
// 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
66
|
React.createElement("style", null, `${inlineQuery} {
|
|
@@ -79,12 +84,14 @@ export function PanelLayoutShell({
|
|
|
79
84
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
80
85
|
[localPanelMinWidthVar]: `${panelMinWidth}px`,
|
|
81
86
|
'--p_lclPnlCompactW': `${compactPanelWidth}px`,
|
|
87
|
+
'--p_lclPnlXlW': `${xlPanelWidth}px`,
|
|
88
|
+
'--p_lclPnlXlDefaultW': `${xlDefaultPanelWidth}px`,
|
|
82
89
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
83
90
|
'--p_lclPnlDefaultW': `${defaultPanelWidth}px`,
|
|
84
91
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
85
92
|
'--p_lclPnlCompactDefaultW': `${compactDefaultPanelWidth}px`
|
|
86
93
|
},
|
|
87
|
-
className: ax([styles.layout, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, shouldClipOverflow && isPanelOpen && (mode === undefined || mode === 'inline') && styles.panelEntering, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
|
|
94
|
+
className: ax([styles.layout, mode === undefined && styles.unmeasuredWidths, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, shouldClipOverflow && isPanelOpen && (mode === undefined || mode === 'inline') && styles.panelEntering, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
|
|
88
95
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
96
|
className: ax([styles.mainContent])
|
|
90
97
|
}, children), panel));
|
|
@@ -20,6 +20,7 @@ function CoordinatedPanelLayout({
|
|
|
20
20
|
panelWidth,
|
|
21
21
|
defaultPanelWidth,
|
|
22
22
|
compactDefaultPanelWidth,
|
|
23
|
+
xlDefaultPanelWidth,
|
|
23
24
|
panelMinWidth: suppliedMinWidth,
|
|
24
25
|
panelMaxWidth,
|
|
25
26
|
onPanelWidthChange,
|
|
@@ -29,7 +30,7 @@ function CoordinatedPanelLayout({
|
|
|
29
30
|
testId,
|
|
30
31
|
layoutRef
|
|
31
32
|
}) {
|
|
32
|
-
var _ref, _state$width;
|
|
33
|
+
var _ref, _ref2, _state$width;
|
|
33
34
|
const [defaults] = useState(getPanelLayoutDefaults);
|
|
34
35
|
const panelMinWidth = suppliedMinWidth !== null && suppliedMinWidth !== void 0 ? suppliedMinWidth : defaults.panelMinWidth;
|
|
35
36
|
const coordinator = useContext(LayoutAreaSizingContext);
|
|
@@ -44,6 +45,7 @@ function CoordinatedPanelLayout({
|
|
|
44
45
|
}, [coordinator]);
|
|
45
46
|
const [defaultWidth] = useState(defaultPanelWidth !== null && defaultPanelWidth !== void 0 ? defaultPanelWidth : fg('platform-dst-chat-panel-layout') ? defaults.panelWidth : panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaults.panelWidth);
|
|
46
47
|
const [compactWidth] = useState((_ref = compactDefaultPanelWidth !== null && compactDefaultPanelWidth !== void 0 ? compactDefaultPanelWidth : defaultPanelWidth) !== null && _ref !== void 0 ? _ref : fg('platform-dst-chat-panel-layout') ? defaults.compactPanelWidth : panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaults.compactPanelWidth);
|
|
48
|
+
const [xlWidth] = useState(fg('platform-dst-chat-panel-layout') ? (_ref2 = xlDefaultPanelWidth !== null && xlDefaultPanelWidth !== void 0 ? xlDefaultPanelWidth : defaultPanelWidth) !== null && _ref2 !== void 0 ? _ref2 : 500 : defaultWidth);
|
|
47
49
|
// Use the controlled request before measurement too, without changing the mount-time default.
|
|
48
50
|
const fallbackWidth = Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaultWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity));
|
|
49
51
|
const {
|
|
@@ -60,6 +62,7 @@ function CoordinatedPanelLayout({
|
|
|
60
62
|
requestedWidth: panelWidth,
|
|
61
63
|
defaultWidth,
|
|
62
64
|
compactDefaultWidth: compactWidth,
|
|
65
|
+
xlDefaultWidth: xlWidth,
|
|
63
66
|
minWidth: panelMinWidth,
|
|
64
67
|
maxWidth: panelMaxWidth
|
|
65
68
|
}
|
|
@@ -100,6 +103,8 @@ function CoordinatedPanelLayout({
|
|
|
100
103
|
isPanelOpen: isPanelOpen,
|
|
101
104
|
panelWidth: (_state$width = state === null || state === void 0 ? void 0 : state.width) !== null && _state$width !== void 0 ? _state$width : fallbackWidth,
|
|
102
105
|
defaultPanelWidth: defaultWidth,
|
|
106
|
+
xlDefaultPanelWidth: xlWidth,
|
|
107
|
+
xlPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : xlWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
|
|
103
108
|
compactDefaultPanelWidth: compactWidth,
|
|
104
109
|
compactPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : compactWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
|
|
105
110
|
panelMinWidth: panelMinWidth,
|
|
@@ -135,6 +140,7 @@ export function PanelLayout(props) {
|
|
|
135
140
|
panelWidth: props.panelWidth,
|
|
136
141
|
defaultPanelWidth: props.defaultPanelWidth,
|
|
137
142
|
compactDefaultPanelWidth: props.compactDefaultPanelWidth,
|
|
143
|
+
xlDefaultPanelWidth: props.xlDefaultPanelWidth,
|
|
138
144
|
panelMinWidth: props.panelMinWidth,
|
|
139
145
|
panelMaxWidth: props.panelMaxWidth,
|
|
140
146
|
onPanelWidthChange: props.onPanelWidthChange,
|
|
@@ -10,6 +10,7 @@ export function useLayoutAreaSizing({
|
|
|
10
10
|
requestedWidth,
|
|
11
11
|
defaultWidth,
|
|
12
12
|
compactDefaultWidth,
|
|
13
|
+
xlDefaultWidth,
|
|
13
14
|
minWidth,
|
|
14
15
|
maxWidth,
|
|
15
16
|
isOpen,
|
|
@@ -37,12 +38,13 @@ export function useLayoutAreaSizing({
|
|
|
37
38
|
requestedWidth,
|
|
38
39
|
defaultWidth,
|
|
39
40
|
compactDefaultWidth,
|
|
41
|
+
xlDefaultWidth,
|
|
40
42
|
minWidth,
|
|
41
43
|
maxWidth,
|
|
42
44
|
isOpen,
|
|
43
45
|
onRequestClose: requestClose
|
|
44
46
|
});
|
|
45
|
-
}, [area, compactDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
47
|
+
}, [area, compactDefaultWidth, xlDefaultWidth, defaultWidth, isOpen, maxWidth, minWidth, registerArea, requestClose, requestedWidth]);
|
|
46
48
|
useEffect(() => () => unregisterArea === null || unregisterArea === void 0 ? void 0 : unregisterArea(area), [area, unregisterArea]);
|
|
47
49
|
const startResize = useCallback(mode => startAreaResize === null || startAreaResize === void 0 ? void 0 : startAreaResize(area, mode), [area, startAreaResize]);
|
|
48
50
|
const resize = useCallback((mode, width) => resizeArea === null || resizeArea === void 0 ? void 0 : resizeArea(area, mode, width), [area, resizeArea]);
|
|
@@ -10,14 +10,18 @@ function clampTargetWidth(_ref) {
|
|
|
10
10
|
max = _ref.max;
|
|
11
11
|
return Math.max(min, Math.min(target, max));
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
var _area$compactDefaultW, _area$
|
|
15
|
-
|
|
13
|
+
function getDefaultWidth(area, isCompact, isXlViewport) {
|
|
14
|
+
var _area$compactDefaultW, _area$xlDefaultWidth;
|
|
15
|
+
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;
|
|
16
|
+
}
|
|
17
|
+
function getTargetWidth(area, isSideNavOverlay, isXlViewport) {
|
|
18
|
+
var _area$liveResize, _ref2, _area$requestedWidth;
|
|
19
|
+
var defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
16
20
|
return ((_area$liveResize = area.liveResize) === null || _area$liveResize === void 0 ? void 0 : _area$liveResize.mode) === 'inline' ? area.liveResize.width : (_ref2 = (_area$requestedWidth = area.requestedWidth) !== null && _area$requestedWidth !== void 0 ? _area$requestedWidth : area.preferredWidth) !== null && _ref2 !== void 0 ? _ref2 : defaultWidth;
|
|
17
21
|
}
|
|
18
|
-
function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
|
|
19
|
-
var _area$
|
|
20
|
-
var defaultWidth =
|
|
22
|
+
function getOverlayTargetWidth(area, isSideNavOverlay, isXlViewport, areaName) {
|
|
23
|
+
var _area$liveResize2, _ref3, _area$requestedWidth2;
|
|
24
|
+
var defaultWidth = getDefaultWidth(area, isSideNavOverlay, isXlViewport);
|
|
21
25
|
return ((_area$liveResize2 = area.liveResize) === null || _area$liveResize2 === void 0 ? void 0 : _area$liveResize2.mode) === 'overlay' ? area.liveResize.width : (_ref3 = (_area$requestedWidth2 = area.requestedWidth) !== null && _area$requestedWidth2 !== void 0 ? _area$requestedWidth2 : areaName === 'panel' ? area.preferredWidth : area.preferredOverlayWidth) !== null && _ref3 !== void 0 ? _ref3 : defaultWidth;
|
|
22
26
|
}
|
|
23
27
|
export function calculateLayoutAreaStates(_ref4) {
|
|
@@ -27,6 +31,8 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
27
31
|
layoutWidth = _ref4$layoutWidth === void 0 ? viewportWidth : _ref4$layoutWidth,
|
|
28
32
|
isChatPanelOverlay = _ref4.isChatPanelOverlay,
|
|
29
33
|
isSideNavOverlay = _ref4.isSideNavOverlay,
|
|
34
|
+
_ref4$isXlViewport = _ref4.isXlViewport,
|
|
35
|
+
isXlViewport = _ref4$isXlViewport === void 0 ? false : _ref4$isXlViewport,
|
|
30
36
|
_ref4$occupiedWidth = _ref4.occupiedWidth,
|
|
31
37
|
occupiedWidth = _ref4$occupiedWidth === void 0 ? 0 : _ref4$occupiedWidth,
|
|
32
38
|
mainMinWidthBound = _ref4.mainMinWidth,
|
|
@@ -49,7 +55,7 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
49
55
|
// A growing panel cascades towards inline-start. Chat is on the other side
|
|
50
56
|
// of the local rail, so local growth must reserve its full starting width.
|
|
51
57
|
var shouldCollapseSideNav = Boolean(!isRefinedLayout && resizeSession && resizeSession.area !== 'side-nav' && resizeSession.baselineWidths['side-nav'] !== undefined && resizeSession.baselineWidths[resizeSession.area] !== undefined && resizingArea && !isSideNavOverlay && clampTargetWidth({
|
|
52
|
-
target: getTargetWidth(resizingArea, isSideNavOverlay),
|
|
58
|
+
target: getTargetWidth(resizingArea, isSideNavOverlay, isXlViewport),
|
|
53
59
|
min: resolveLayoutWidth(resizingArea.minWidth, viewportWidth),
|
|
54
60
|
max: resizingArea.maxWidth !== undefined ? resolveLayoutWidth(resizingArea.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY
|
|
55
61
|
}) > 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));
|
|
@@ -92,7 +98,7 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
92
98
|
var min = resolveLayoutWidth(area.minWidth, viewportWidth);
|
|
93
99
|
var max = area.maxWidth ? resolveLayoutWidth(area.maxWidth, viewportWidth) : Number.POSITIVE_INFINITY;
|
|
94
100
|
var baselineWidth = baselineWidths === null || baselineWidths === void 0 ? void 0 : baselineWidths[areaName];
|
|
95
|
-
var requestedTarget = resizeSession && areaName !== resizeSession.area ? shouldCollapseSideNav && resizeSession.area === 'chat-panel' ? min : baselineWidth !== null && baselineWidth !== void 0 ? baselineWidth : getTargetWidth(area, isSideNavOverlay) : getTargetWidth(area, isSideNavOverlay);
|
|
101
|
+
var 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);
|
|
96
102
|
var target = clampTargetWidth({
|
|
97
103
|
target: requestedTarget,
|
|
98
104
|
min: min,
|
|
@@ -156,12 +162,12 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
156
162
|
_iterator2.f();
|
|
157
163
|
}
|
|
158
164
|
if (hasPanelClearance && panel) {
|
|
159
|
-
var
|
|
165
|
+
var _widths$get4, _widths$get5;
|
|
160
166
|
// Opening/viewport fitting gives up SideNav width before Chat. During a
|
|
161
167
|
// panel drag only SideNav yields; Chat retains its starting width.
|
|
162
168
|
var isPanelResize = (resizeSession === null || resizeSession === void 0 ? void 0 : resizeSession.area) === 'panel';
|
|
163
|
-
var desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
164
|
-
var overlayDefault =
|
|
169
|
+
var desiredPanelWidth = Math.max(panelMinWidth, Math.min(getOverlayTargetWidth(panel, isSideNavOverlay, isXlViewport, 'panel'), panel.maxWidth === undefined ? Infinity : resolveLayoutWidth(panel.maxWidth, viewportWidth)));
|
|
170
|
+
var overlayDefault = getDefaultWidth(panel, isSideNavOverlay, isXlViewport);
|
|
165
171
|
var reservedMainWidth = isPanelResize ? Math.max(effectiveMainMinWidth, desiredPanelWidth + 32,
|
|
166
172
|
// Above the default, Main must also fit the panel within its 90% cap.
|
|
167
173
|
desiredPanelWidth > overlayDefault ? desiredPanelWidth / 0.9 : 0) : effectiveMainMinWidth;
|
|
@@ -214,7 +220,7 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
214
220
|
_step4;
|
|
215
221
|
try {
|
|
216
222
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
217
|
-
var _states$_areaName
|
|
223
|
+
var _states$_areaName;
|
|
218
224
|
var _areaName2 = _step4.value;
|
|
219
225
|
var _area = areas[_areaName2];
|
|
220
226
|
if (!(_area !== null && _area !== void 0 && _area.isOpen) || ((_states$_areaName = states[_areaName2]) === null || _states$_areaName === void 0 ? void 0 : _states$_areaName.mode) === 'inline' || _areaName2 === 'side-nav' && shouldCollapseSideNav) {
|
|
@@ -225,11 +231,11 @@ export function calculateLayoutAreaStates(_ref4) {
|
|
|
225
231
|
// Chat covers Root; SideNav and the local panel overlay Main's grid track.
|
|
226
232
|
// Occupied tracks and inline chat are not part of that covered region.
|
|
227
233
|
var layoutMax = (_areaName2 === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
228
|
-
var defaultWidth =
|
|
234
|
+
var defaultWidth = getDefaultWidth(_area, isSideNavOverlay, isXlViewport);
|
|
229
235
|
var overlayMax = isRefinedLayout && _areaName2 === 'panel' ? hasPanelClearance ? Math.min(availableWidth - sideNavMinWidth - inlineChatPanelWidth - 32, Math.max(defaultWidth, (availableWidth - sideNavMinWidth - inlineChatPanelWidth) * 0.9)) : Math.min(mainAreaWidth, Math.max(defaultWidth, layoutMax)) : isRefinedLayout && _areaName2 === 'chat-panel' ? Math.min(layoutWidth, Math.max(defaultWidth, layoutMax)) : layoutMax;
|
|
230
236
|
var _max = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? Math.max(_min2, Math.min(configuredMax, overlayMax)) : Math.max(0, Math.min(configuredMax, overlayMax));
|
|
231
237
|
var effectiveMin = isRefinedLayout && (_areaName2 === 'panel' || _areaName2 === 'chat-panel') ? _min2 : Math.min(_min2, _max);
|
|
232
|
-
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, _areaName2);
|
|
238
|
+
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, isXlViewport, _areaName2);
|
|
233
239
|
var _width2 = clampTargetWidth({
|
|
234
240
|
target: _target,
|
|
235
241
|
min: effectiveMin,
|
|
@@ -74,6 +74,7 @@ export function LayoutAreaSizingProvider(_ref) {
|
|
|
74
74
|
}, []);
|
|
75
75
|
var mainMinWidth = useRef(defaultMainMinWidth);
|
|
76
76
|
var loadRef = useRef(function () {});
|
|
77
|
+
var viewportWidthAtLoad = useRef();
|
|
77
78
|
var ready = useRef(false);
|
|
78
79
|
var waiting = useRef([]);
|
|
79
80
|
var pending = useRef([]);
|
|
@@ -99,6 +100,7 @@ export function LayoutAreaSizingProvider(_ref) {
|
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
loading = true;
|
|
103
|
+
viewportWidthAtLoad.current = window.innerWidth;
|
|
102
104
|
void import( /* webpackChunkName: "@atlaskit-internal_navigation-layout-sizing" */'./layout-area-sizing-runtime').then(function (_ref2) {
|
|
103
105
|
var LayoutAreaSizingRuntime = _ref2.LayoutAreaSizingRuntime;
|
|
104
106
|
if (!cancelled) {
|
|
@@ -308,6 +310,7 @@ export function LayoutAreaSizingProvider(_ref) {
|
|
|
308
310
|
}, children))), Runtime && /*#__PURE__*/React.createElement(Runtime, {
|
|
309
311
|
layoutRef: layoutRef,
|
|
310
312
|
onReady: onReady,
|
|
311
|
-
onUpdate: onUpdate
|
|
313
|
+
onUpdate: onUpdate,
|
|
314
|
+
viewportWidthAtLoad: viewportWidthAtLoad.current
|
|
312
315
|
}));
|
|
313
316
|
}
|
|
@@ -28,10 +28,12 @@ function useStableAreaState(state) {
|
|
|
28
28
|
}, [mode, width, minWidth]);
|
|
29
29
|
}
|
|
30
30
|
export function LayoutAreaSizingRuntime(_ref2) {
|
|
31
|
+
var _areas$panel2;
|
|
31
32
|
var children = _ref2.children,
|
|
32
33
|
layoutRef = _ref2.layoutRef,
|
|
33
34
|
onReady = _ref2.onReady,
|
|
34
|
-
onUpdate = _ref2.onUpdate
|
|
35
|
+
onUpdate = _ref2.onUpdate,
|
|
36
|
+
viewportWidthAtLoad = _ref2.viewportWidthAtLoad;
|
|
35
37
|
var occupiedWidth = useOccupiedLayoutWidth(layoutRef);
|
|
36
38
|
var _useState = useState(null),
|
|
37
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51,7 +53,10 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
51
53
|
setResizeSession = _useState8[1];
|
|
52
54
|
var areaStatesRef = React.useRef({});
|
|
53
55
|
var configsRef = React.useRef({});
|
|
54
|
-
|
|
56
|
+
// A viewport change while the chunk loads is already a layout event. Reallocate
|
|
57
|
+
// instead of adopting CSS geometry from the preceding breakpoint (which WebKit
|
|
58
|
+
// can still report during that handoff).
|
|
59
|
+
var _useState9 = useState(viewportWidthAtLoad !== undefined && viewportWidthAtLoad !== window.innerWidth),
|
|
55
60
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
56
61
|
hasInteraction = _useState0[0],
|
|
57
62
|
setHasInteraction = _useState0[1];
|
|
@@ -90,6 +95,7 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
90
95
|
// Match the actual rem-based grid breakpoint, including browser font settings.
|
|
91
96
|
var inlineChatQuery = window.matchMedia('(min-width: 40rem)');
|
|
92
97
|
var inlineSideNavQuery = window.matchMedia('(min-width: 64rem)');
|
|
98
|
+
var xlQuery = window.matchMedia('(min-width: 110.5rem)');
|
|
93
99
|
var updateDimensions = function updateDimensions(contentWidth) {
|
|
94
100
|
var _style$width, _style$paddingLeft, _style$paddingRight, _style$borderLeftWidt, _style$borderRightWid, _previous;
|
|
95
101
|
var style = root && contentWidth === undefined ? getComputedStyle(root) : null;
|
|
@@ -104,9 +110,10 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
104
110
|
viewportWidth: window.innerWidth,
|
|
105
111
|
layoutWidth: layoutWidth,
|
|
106
112
|
isChatPanelOverlay: !inlineChatQuery.matches,
|
|
107
|
-
isSideNavOverlay: !inlineSideNavQuery.matches
|
|
113
|
+
isSideNavOverlay: !inlineSideNavQuery.matches,
|
|
114
|
+
isXlViewport: xlQuery.matches
|
|
108
115
|
};
|
|
109
|
-
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) {
|
|
116
|
+
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) {
|
|
110
117
|
return;
|
|
111
118
|
}
|
|
112
119
|
if (previous) {
|
|
@@ -146,7 +153,14 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
146
153
|
return updateDimensions();
|
|
147
154
|
}
|
|
148
155
|
});
|
|
156
|
+
var unbindXlQuery = bind(xlQuery, {
|
|
157
|
+
type: 'change',
|
|
158
|
+
listener: function listener() {
|
|
159
|
+
return updateDimensions();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
149
162
|
return function () {
|
|
163
|
+
unbindXlQuery();
|
|
150
164
|
observer.disconnect();
|
|
151
165
|
unbindResize();
|
|
152
166
|
unbindQuery();
|
|
@@ -155,14 +169,14 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
155
169
|
}, [layoutRef]);
|
|
156
170
|
var registerArea = useCallback(function (area, config) {
|
|
157
171
|
var previous = configsRef.current[area];
|
|
158
|
-
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)) {
|
|
172
|
+
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)) {
|
|
159
173
|
setHasInteraction(true);
|
|
160
174
|
}
|
|
161
175
|
configsRef.current[area] = config;
|
|
162
176
|
setResizeSession(function (current) {
|
|
163
177
|
// A changed layout/configuration needs a fresh allocation. A controlled
|
|
164
178
|
// acknowledgement for the resized area keeps its siblings fixed.
|
|
165
|
-
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;
|
|
179
|
+
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;
|
|
166
180
|
});
|
|
167
181
|
setAreas(function (current) {
|
|
168
182
|
var existing = current[area];
|
|
@@ -446,18 +460,25 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
446
460
|
};
|
|
447
461
|
}, [onReady, value]);
|
|
448
462
|
useEffect(function () {
|
|
463
|
+
var _configsRef$current$p, _areas$panel;
|
|
449
464
|
if (!adoptedConstraints.current && (sideNavState || panelState || chatPanelState)) {
|
|
450
465
|
adoptedConstraints.current = {
|
|
451
466
|
occupiedWidth: occupiedWidth,
|
|
452
467
|
mainMinWidth: mainMinWidth
|
|
453
468
|
};
|
|
454
469
|
}
|
|
470
|
+
// A controlled panel can acknowledge a resize in this same commit. Its
|
|
471
|
+
// registration queues the new allocation before this effect runs; avoid
|
|
472
|
+
// publishing an allocation calculated from the previous requested width.
|
|
473
|
+
if (((_configsRef$current$p = configsRef.current.panel) === null || _configsRef$current$p === void 0 ? void 0 : _configsRef$current$p.requestedWidth) !== ((_areas$panel = areas.panel) === null || _areas$panel === void 0 ? void 0 : _areas$panel.requestedWidth)) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
455
476
|
onUpdate === null || onUpdate === void 0 || onUpdate({
|
|
456
477
|
'side-nav': sideNavState,
|
|
457
478
|
panel: panelState,
|
|
458
479
|
'chat-panel': chatPanelState
|
|
459
480
|
});
|
|
460
|
-
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth]);
|
|
481
|
+
}, [onUpdate, sideNavState, panelState, chatPanelState, occupiedWidth, mainMinWidth, (_areas$panel2 = areas.panel) === null || _areas$panel2 === void 0 ? void 0 : _areas$panel2.requestedWidth]);
|
|
461
482
|
return /*#__PURE__*/React.createElement(LayoutAreaSizingContext.Provider, {
|
|
462
483
|
value: value
|
|
463
484
|
}, /*#__PURE__*/React.createElement(SideNavStateProvider, {
|
|
@@ -21,9 +21,7 @@
|
|
|
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
24
|
._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
|
|
26
25
|
._kqsw1if8{position:sticky}
|
|
27
26
|
._vchhusvi{box-sizing:border-box}
|
|
28
|
-
@media (prefers-reduced-motion:no-preference){.
|
|
29
|
-
@media (min-width:64rem){._1c23i77x{--p_lclPnlMotionW:var(--p_lclPnlTrackW)}}
|
|
27
|
+
@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)))))}._k1af14vv{animation:var(--ds-panel-exit-right,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentRight)}._1lh81gzg{grid-area:main}[dir=rtl] ._105aeydr{animation:var(--ds-panel-exit-left,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentLeft)}._15et1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}@starting-style{._12d81gzg{grid-area:main}}._k1af1nn1{animation:var(--ds-panel-enter-right,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentRight)}[dir=rtl] ._105abamb{animation:var(--ds-panel-enter-left,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentLeft)}._10t81q8v{transition-property:grid-area}._xrrp147i{transition-duration:var(--ds-duration-instant,0ms)}._1wsa1ign{transition-delay:var(--ds-duration-short,.15s)}._1vrh1a5r{transition-behavior:allow-discrete}}
|
|
@@ -15,6 +15,8 @@ import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
16
|
import { localPanelWidthVar } from './constants';
|
|
17
17
|
import { DangerouslyHoistSlotSizes } from './hoist-slot-sizes-context';
|
|
18
|
+
import { LayoutOverlayClearance } from './layout-overlay-clearance';
|
|
19
|
+
import { MainMinWidthContext } from './main-min-width-context';
|
|
18
20
|
import { PanelSplitter } from './panel-splitter/panel-splitter';
|
|
19
21
|
import { PanelSplitterProvider } from './panel-splitter/provider';
|
|
20
22
|
var localPanelVar = '--p_lclPnlW';
|
|
@@ -33,7 +35,8 @@ var styles = {
|
|
|
33
35
|
border: "_191wglyw _16qs130s",
|
|
34
36
|
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
35
37
|
entering: "_k1af1nn1 _12d81gzg _10t81q8v _xrrp147i _1wsa1ign _1vrh1a5r _15et1c5w _105abamb",
|
|
36
|
-
motionUnmeasured: "
|
|
38
|
+
motionUnmeasured: "_15et3aws",
|
|
39
|
+
refinedMotionUnmeasured: "_15etq93i",
|
|
37
40
|
exiting: "_k1af14vv _1lh81gzg _15et1c5w _105aeydr",
|
|
38
41
|
contentEntering: "_y44v1mph",
|
|
39
42
|
contentExiting: "_y44vf1qi",
|
|
@@ -76,6 +79,7 @@ export function LocalPanelSurface(_ref2) {
|
|
|
76
79
|
onManagedResizeEnd = _ref2.onManagedResizeEnd,
|
|
77
80
|
onWidthChange = _ref2.onWidthChange,
|
|
78
81
|
onResizeEnd = _ref2.onResizeEnd;
|
|
82
|
+
var mainMinWidth = useContext(MainMinWidthContext);
|
|
79
83
|
var ref = useRef(null);
|
|
80
84
|
var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
81
85
|
useLayoutEffect(function () {
|
|
@@ -169,8 +173,14 @@ export function LocalPanelSurface(_ref2) {
|
|
|
169
173
|
"data-layout-with-panel-slot": "",
|
|
170
174
|
style: _defineProperty({}, localPanelVar, "".concat(renderedWidth, "px")),
|
|
171
175
|
ref: mergedRef,
|
|
172
|
-
className: ax([isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, isMotionUpliftEnabled && (state === 'entering' || state === 'exiting') && !managedSizing && styles.motionUnmeasured, 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])
|
|
173
|
-
},
|
|
176
|
+
className: ax([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, 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])
|
|
177
|
+
}, !managedSizing && fg('platform-dst-chat-panel-layout') &&
|
|
178
|
+
/*#__PURE__*/
|
|
179
|
+
// Keep sibling allocation stable until the exiting surface actually unmounts.
|
|
180
|
+
React.createElement(LayoutOverlayClearance, {
|
|
181
|
+
panelMinWidth: minWidth,
|
|
182
|
+
mainMinWidth: mainMinWidth
|
|
183
|
+
}), /*#__PURE__*/React.createElement(PanelSplitterProvider, {
|
|
174
184
|
panelId: localPanelSplitterId,
|
|
175
185
|
panelRef: ref,
|
|
176
186
|
resizingElementRef: layoutRef,
|
|
@@ -26,4 +26,5 @@
|
|
|
26
26
|
._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
|
|
27
27
|
._yv0ei47z{grid-template-columns:minmax(0,1fr)}
|
|
28
28
|
@media (prefers-reduced-motion:no-preference){._1croukkr{animation-name:k1p4v4gh}._wqfn147i{animation-duration:var(--ds-duration-instant,0ms)}._sl5p1ign{animation-delay:var(--ds-duration-short,.15s)}._dqw8eoah{animation-fill-mode:backwards}@keyframes k1p4v4gh{0%{grid-template-areas:"main";grid-template-columns:minmax(0,1fr);grid-template-rows:1fr}}}
|
|
29
|
-
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
29
|
+
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}._1tg31owj{--p_lclPnlSsrDefaultW:var(--p_lclPnlDefaultW)}}
|
|
30
|
+
@media (min-width:110.5rem){._1qxn1ykh{--p_lclPnlSsrPreferredW:var(--p_lclPnlXlW)}._13bt1t8m{--p_lclPnlSsrDefaultW:var(--p_lclPnlXlDefaultW)}}
|