@atlaskit/navigation-system 11.3.4 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +20 -0
- package/constellation/layout/code.mdx +1 -1
- package/constellation/layout/examples.mdx +4 -16
- package/constellation/layout/images/layout-anatomy-dark.png +0 -0
- package/constellation/layout/images/layout-anatomy-light.png +0 -0
- package/constellation/layout/images/layout-do-dark.png +0 -0
- package/constellation/layout/images/layout-do-light.png +0 -0
- package/constellation/layout/images/layout-dont-dark.png +0 -0
- package/constellation/layout/images/layout-dont-light.png +0 -0
- package/constellation/layout/images/layout-example-dark.png +0 -0
- package/constellation/layout/images/layout-example-light.png +0 -0
- package/constellation/layout/images/layout-example-sideNav-dark.png +0 -0
- package/constellation/layout/images/layout-example-sideNav-light.png +0 -0
- package/constellation/layout/images/layout-example-topNav-1-dark.png +0 -0
- package/constellation/layout/images/layout-example-topNav-1-light.png +0 -0
- package/constellation/layout/usage.mdx +1 -2
- package/constellation/top-nav-items/examples.mdx +7 -13
- package/dist/cjs/entry-points/layout/panel-layout.js +19 -0
- package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/cjs/ui/page-layout/chat-panel.js +1 -1
- package/dist/cjs/ui/page-layout/constants.js +15 -1
- package/dist/cjs/ui/page-layout/get-panel-layout-defaults.js +22 -0
- package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +5 -4
- package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/cjs/ui/page-layout/local-panel-surface.js +206 -0
- package/dist/cjs/ui/page-layout/main/main.js +5 -2
- package/dist/cjs/ui/page-layout/main-min-width-context.js +10 -0
- package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/cjs/ui/page-layout/panel-layout-shell.js +67 -0
- package/dist/cjs/ui/page-layout/panel-layout.js +162 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +1 -1
- package/dist/es2019/entry-points/layout/panel-layout.js +2 -0
- package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/es2019/ui/page-layout/chat-panel.js +2 -2
- package/dist/es2019/ui/page-layout/constants.js +14 -0
- package/dist/es2019/ui/page-layout/get-panel-layout-defaults.js +16 -0
- package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +4 -3
- package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/es2019/ui/page-layout/local-panel-surface.js +193 -0
- package/dist/es2019/ui/page-layout/main/main.js +6 -3
- package/dist/es2019/ui/page-layout/main-min-width-context.js +5 -0
- package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/es2019/ui/page-layout/panel-layout-shell.js +74 -0
- package/dist/es2019/ui/page-layout/panel-layout.js +147 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +2 -2
- package/dist/esm/entry-points/layout/panel-layout.js +2 -0
- package/dist/esm/ui/page-layout/calculate-layout-area-states.js +4 -4
- package/dist/esm/ui/page-layout/chat-panel.js +2 -2
- package/dist/esm/ui/page-layout/constants.js +14 -0
- package/dist/esm/ui/page-layout/get-panel-layout-defaults.js +16 -0
- package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +2 -1
- package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +4 -3
- package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +26 -0
- package/dist/esm/ui/page-layout/local-panel-surface.js +197 -0
- package/dist/esm/ui/page-layout/main/main.js +6 -3
- package/dist/esm/ui/page-layout/main-min-width-context.js +5 -0
- package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +27 -0
- package/dist/esm/ui/page-layout/panel-layout-shell.js +59 -0
- package/dist/esm/ui/page-layout/panel-layout.js +154 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +2 -2
- package/dist/types/entry-points/layout/panel-layout.d.ts +3 -0
- package/dist/types/ui/page-layout/constants.d.ts +12 -0
- package/dist/types/ui/page-layout/get-panel-layout-defaults.d.ts +10 -0
- package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +5 -1
- package/dist/types/ui/page-layout/local-panel-surface.d.ts +32 -0
- package/dist/types/ui/page-layout/main-min-width-context.d.ts +2 -0
- package/dist/types/ui/page-layout/panel-layout-shell.d.ts +47 -0
- package/dist/types/ui/page-layout/panel-layout.d.ts +74 -0
- package/layout/panel-layout/package.json +10 -0
- package/package.json +4 -4
- package/constellation/layout/images/layout-example-topNav-2-dark.png +0 -3
- package/constellation/layout/images/layout-example-topNav-2-light.png +0 -3
|
@@ -8,11 +8,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
import { bind } from 'bind-event-listener';
|
|
10
10
|
import { calculateLayoutAreaStates } from './calculate-layout-area-states';
|
|
11
|
+
import { defaultMainMinWidth } from './constants';
|
|
11
12
|
import { LayoutAreaSizingContext } from './layout-area-sizing-context';
|
|
12
13
|
import { layoutAreaStateContexts } from './layout-area-state-contexts';
|
|
13
14
|
import { resolveLayoutWidth } from './resolve-layout-width';
|
|
14
15
|
import { useOccupiedLayoutWidth } from './use-occupied-layout-width';
|
|
15
|
-
var defaultMainMinWidth = 320;
|
|
16
16
|
function useStableAreaState(state) {
|
|
17
17
|
var _ref = state !== null && state !== void 0 ? state : {},
|
|
18
18
|
mode = _ref.mode,
|
|
@@ -304,7 +304,7 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
304
304
|
if (!existing) {
|
|
305
305
|
return current;
|
|
306
306
|
}
|
|
307
|
-
if (mode === 'overlay') {
|
|
307
|
+
if (mode === 'overlay' && area !== 'panel') {
|
|
308
308
|
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, area, _objectSpread(_objectSpread({}, existing), {}, {
|
|
309
309
|
liveResize: undefined,
|
|
310
310
|
preferredOverlayWidth: width
|
|
@@ -312,7 +312,8 @@ export function LayoutAreaSizingRuntime(_ref2) {
|
|
|
312
312
|
}
|
|
313
313
|
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, area, _objectSpread(_objectSpread({}, existing), {}, {
|
|
314
314
|
liveResize: undefined,
|
|
315
|
-
|
|
315
|
+
// Local panels have one preference, regardless of the resized mode.
|
|
316
|
+
preferredWidth: width
|
|
316
317
|
})));
|
|
317
318
|
});
|
|
318
319
|
}, [captureSiblingWidths]);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
._nd5l1c6w{grid-area:panel}
|
|
2
|
+
._nd5l1gzg{grid-area:main}
|
|
3
|
+
._nd5l32aw{grid-area:var(--p_lclPnlSsrArea,main)}
|
|
4
|
+
._y44v1mph{animation:var(--ds-panel-content-enter,.15s cubic-bezier(.4,1,.6,1) FadeIn0to100)}
|
|
5
|
+
._y44vf1qi{animation:var(--ds-panel-content-exit,50ms cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
|
|
6
|
+
._191wbqna{border-inline-start:var(--p_lclPnlSsrBorder,none)}
|
|
7
|
+
._191wglyw{border-inline-start:none}
|
|
8
|
+
._191wia51{border-inline-start:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._10fph9n0{justify-self:end}
|
|
9
|
+
._152tidpf{inset-block-start:0}
|
|
10
|
+
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
11
|
+
._16qs1dhr{box-shadow:var(--p_lclPnlSsrShadow,var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f))}
|
|
12
|
+
._16qsglyw{box-shadow:none}
|
|
13
|
+
._18m91wug{overflow-y:auto}
|
|
14
|
+
._1bsb13q4{width:min(90%,var(--p_lclPnlRsz,var(--p_lclPnlW)))}
|
|
15
|
+
._1bsb1c5w{width:var(--p_lclPnlRsz,var(--p_lclPnlW))}
|
|
16
|
+
._1bsb1cku{width:var(--p_lclPnlSsrWidth,min(90%,var(--p_lclPnlSsrPreferredW)))}
|
|
17
|
+
._1reo1wug{overflow-x:auto}
|
|
18
|
+
._4t3i1osq{height:100%}
|
|
19
|
+
._4t3ieqxy{height:calc(100vh - var(--n_bnrM, 0px) - var(--n_tNvM, 0px))}
|
|
20
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
21
|
+
._bfhk1g1j{background-color:var(--p_lclPnlSsrBackground,var(--ds-surface-overlay,#fff))}
|
|
22
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
23
|
+
._ju25dn4k{animation-delay:var(--ds-duration-xshort,.1s)}
|
|
24
|
+
._kqsw1if8{position:sticky}
|
|
25
|
+
._vchhusvi{box-sizing:border-box}
|
|
26
|
+
@media (prefers-reduced-motion:no-preference){._k1af14vv{animation:var(--ds-panel-exit-right,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentRight)}[dir=rtl] ._105aeydr{animation:var(--ds-panel-exit-left,.2s cubic-bezier(0,.4,0,1) SlideOut100PercentLeft)}._bq641n9t{position:fixed}@starting-style{._1kmh1n9t{position:fixed}}._k1af1nn1{animation:var(--ds-panel-enter-right,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentRight)}._10t81ia4{transition-property:position}._xrrp147i{transition-duration:var(--ds-duration-instant,0ms)}._1wsa1ign{transition-delay:var(--ds-duration-short,.15s)}._1vrh1a5r{transition-behavior:allow-discrete}[dir=rtl] ._105abamb{animation:var(--ds-panel-enter-left,.25s cubic-bezier(0,.4,0,1) SlideIn100PercentLeft)}}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/* local-panel-surface.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./local-panel-surface.compiled.css";
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
import { useCallback, useContext, useMemo, useRef } from 'react';
|
|
10
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
11
|
+
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
12
|
+
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
13
|
+
import { useMotion } from '@atlaskit/motion/entering/use-motion';
|
|
14
|
+
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
|
+
import { localPanelWidthVar } from './constants';
|
|
17
|
+
import { DangerouslyHoistSlotSizes } from './hoist-slot-sizes-context';
|
|
18
|
+
import { PanelSplitter } from './panel-splitter/panel-splitter';
|
|
19
|
+
import { PanelSplitterProvider } from './panel-splitter/provider';
|
|
20
|
+
var localPanelVar = '--p_lclPnlW';
|
|
21
|
+
var panelSplitterResizingVar = '--p_lclPnlRsz';
|
|
22
|
+
var localPanelSplitterId = Symbol('LocalPanel PanelSplitter');
|
|
23
|
+
|
|
24
|
+
// Compiled preserves the existing container-relative widths and discrete motion styles.
|
|
25
|
+
/* eslint-disable @compiled/shorthand-property-sorting -- Content motion overrides only the animation delay. */
|
|
26
|
+
var styles = {
|
|
27
|
+
panelWrapper: "_nd5l1gzg _kqsw1if8 _bfhk1bhr _vchhusvi _4t3ieqxy _152tidpf _10fph9n0 _1bsb13q4",
|
|
28
|
+
managedInline: "_nd5l1c6w _bfhkvuon _152tidpf _1bsb1c5w",
|
|
29
|
+
unmeasured: "_nd5l32aw _191wbqna _1bsb1cku _bfhk1g1j _16qs1dhr",
|
|
30
|
+
managedOverlay: "_nd5l1gzg _bfhk1bhr _1bsb1c5w",
|
|
31
|
+
panelScrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
32
|
+
border: "_191wglyw _16qs130s",
|
|
33
|
+
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
34
|
+
entering: "_k1af1nn1 _10t81ia4 _xrrp147i _1wsa1ign _1vrh1a5r _1kmh1n9t _105abamb",
|
|
35
|
+
exiting: "_k1af14vv _bq641n9t _105aeydr",
|
|
36
|
+
contentEntering: "_y44v1mph",
|
|
37
|
+
contentExiting: "_y44vf1qi",
|
|
38
|
+
contentChangeContainer: "_4t3i1osq"
|
|
39
|
+
};
|
|
40
|
+
var contentEnteringDelayStyles = {
|
|
41
|
+
root: "_ju25dn4k"
|
|
42
|
+
};
|
|
43
|
+
/* eslint-enable @compiled/shorthand-property-sorting */
|
|
44
|
+
|
|
45
|
+
var PanelContentMotion = function PanelContentMotion(_ref) {
|
|
46
|
+
var children = _ref.children;
|
|
47
|
+
var _useMotion = useMotion(),
|
|
48
|
+
state = _useMotion.state,
|
|
49
|
+
ref = _useMotion.ref;
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
ref: ref,
|
|
52
|
+
className: ax([styles.contentChangeContainer, state === 'entering' && styles.contentEntering, state === 'exiting' && styles.contentExiting])
|
|
53
|
+
}, children);
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Internal surface for PanelLayout. The host supplies content; navigation owns its geometry.
|
|
57
|
+
*/
|
|
58
|
+
export function LocalPanelSurface(_ref2) {
|
|
59
|
+
var _managedSizing$mode, _managedSizing$width;
|
|
60
|
+
var children = _ref2.children,
|
|
61
|
+
contentKey = _ref2.contentKey,
|
|
62
|
+
label = _ref2.label,
|
|
63
|
+
resizeLabel = _ref2.resizeLabel,
|
|
64
|
+
defaultWidth = _ref2.defaultWidth,
|
|
65
|
+
minWidth = _ref2.minWidth,
|
|
66
|
+
maxWidth = _ref2.maxWidth,
|
|
67
|
+
testId = _ref2.testId,
|
|
68
|
+
layoutRef = _ref2.layoutRef,
|
|
69
|
+
managedSizing = _ref2.managedSizing,
|
|
70
|
+
getManagedResizeBounds = _ref2.getManagedResizeBounds,
|
|
71
|
+
prepareResize = _ref2.prepareResize,
|
|
72
|
+
onManagedResizeStart = _ref2.onManagedResizeStart,
|
|
73
|
+
onManagedResize = _ref2.onManagedResize,
|
|
74
|
+
onManagedResizeEnd = _ref2.onManagedResizeEnd,
|
|
75
|
+
onWidthChange = _ref2.onWidthChange,
|
|
76
|
+
onResizeEnd = _ref2.onResizeEnd;
|
|
77
|
+
var ref = useRef(null);
|
|
78
|
+
var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
79
|
+
useLayoutEffect(function () {
|
|
80
|
+
var panel = ref.current;
|
|
81
|
+
if (!dangerouslyHoistSlotSizes || !panel) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// Container-relative CSS owns the initial width, before the sizing runtime loads.
|
|
85
|
+
// Publish geometry directly for external controls; never feed it into saved preferences.
|
|
86
|
+
var previousWidth;
|
|
87
|
+
var publishWidth = function publishWidth(width) {
|
|
88
|
+
if (width !== previousWidth) {
|
|
89
|
+
previousWidth = width;
|
|
90
|
+
panel.ownerDocument.documentElement.style.setProperty(localPanelWidthVar, "".concat(width, "px"));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
publishWidth(panel.getBoundingClientRect().width);
|
|
94
|
+
var observer = new ResizeObserver(function (_ref3) {
|
|
95
|
+
var _entry$borderBoxSize$, _entry$borderBoxSize;
|
|
96
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
|
97
|
+
entry = _ref4[0];
|
|
98
|
+
publishWidth((_entry$borderBoxSize$ = (_entry$borderBoxSize = entry.borderBoxSize) === null || _entry$borderBoxSize === void 0 || (_entry$borderBoxSize = _entry$borderBoxSize[0]) === null || _entry$borderBoxSize === void 0 ? void 0 : _entry$borderBoxSize.inlineSize) !== null && _entry$borderBoxSize$ !== void 0 ? _entry$borderBoxSize$ : panel.getBoundingClientRect().width);
|
|
99
|
+
});
|
|
100
|
+
observer.observe(panel, {
|
|
101
|
+
box: 'border-box'
|
|
102
|
+
});
|
|
103
|
+
return function () {
|
|
104
|
+
observer.disconnect();
|
|
105
|
+
panel.ownerDocument.documentElement.style.removeProperty(localPanelWidthVar);
|
|
106
|
+
};
|
|
107
|
+
}, [dangerouslyHoistSlotSizes]);
|
|
108
|
+
var scrollRef = useRef(null);
|
|
109
|
+
useLayoutEffect(function () {
|
|
110
|
+
if (scrollRef.current) {
|
|
111
|
+
scrollRef.current.scrollTop = 0;
|
|
112
|
+
}
|
|
113
|
+
}, [contentKey]);
|
|
114
|
+
var _useMotion2 = useMotion(),
|
|
115
|
+
state = _useMotion2.state,
|
|
116
|
+
motionRef = _useMotion2.ref;
|
|
117
|
+
var isMotionUpliftEnabled = fg('platform-dst-motion-uplift-panel');
|
|
118
|
+
var isContentMotionEnabled = fg('platform-dst-motion-uplift-panel-content');
|
|
119
|
+
var mergedRef = useMemo(function () {
|
|
120
|
+
return isMotionUpliftEnabled ? mergeRefs([ref, motionRef]) : ref;
|
|
121
|
+
}, [isMotionUpliftEnabled, motionRef]);
|
|
122
|
+
var mode = (_managedSizing$mode = managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) !== null && _managedSizing$mode !== void 0 ? _managedSizing$mode : 'overlay';
|
|
123
|
+
var managedMode = useStableRef(managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode);
|
|
124
|
+
// Resize preparation can load the coordinator after the interaction starts.
|
|
125
|
+
// Read its latest mode instead of the pre-load callback's captured fallback.
|
|
126
|
+
var getMode = useCallback(function () {
|
|
127
|
+
if (managedMode.current) {
|
|
128
|
+
return managedMode.current;
|
|
129
|
+
}
|
|
130
|
+
return ref.current && getComputedStyle(ref.current).gridArea.split('/')[0].trim() === 'panel' ? 'inline' : 'overlay';
|
|
131
|
+
}, [managedMode]);
|
|
132
|
+
var dragMode = useRef('overlay');
|
|
133
|
+
var completedResizeModeRef = useRef(mode);
|
|
134
|
+
var renderedWidth = (_managedSizing$width = managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.width) !== null && _managedSizing$width !== void 0 ? _managedSizing$width : Math.max(minWidth, Math.min(defaultWidth, maxWidth !== null && maxWidth !== void 0 ? maxWidth : Infinity));
|
|
135
|
+
// Before the first measurement, CSS caps the surface to its containing region.
|
|
136
|
+
// Resize preparation waits for the coordinator to resolve the same bounds for both inputs.
|
|
137
|
+
var getResizeBounds = useCallback(function () {
|
|
138
|
+
var _getManagedResizeBoun;
|
|
139
|
+
return (_getManagedResizeBoun = getManagedResizeBounds()) !== null && _getManagedResizeBoun !== void 0 ? _getManagedResizeBoun : {
|
|
140
|
+
min: '0px',
|
|
141
|
+
max: '0px'
|
|
142
|
+
};
|
|
143
|
+
}, [getManagedResizeBounds]);
|
|
144
|
+
var onCompleteResize = useCallback(function (width) {
|
|
145
|
+
// Keyboard analytics are debounced; retain the mode that produced this width,
|
|
146
|
+
// rather than the layout mode when the delayed callback eventually runs.
|
|
147
|
+
var mode = getMode();
|
|
148
|
+
completedResizeModeRef.current = mode;
|
|
149
|
+
onManagedResizeEnd(mode, width);
|
|
150
|
+
onWidthChange(width);
|
|
151
|
+
}, [getMode, onManagedResizeEnd, onWidthChange]);
|
|
152
|
+
var onResizeStartInternal = useCallback(function () {
|
|
153
|
+
dragMode.current = getMode();
|
|
154
|
+
onManagedResizeStart(dragMode.current);
|
|
155
|
+
}, [getMode, onManagedResizeStart]);
|
|
156
|
+
var onResizeInternal = useCallback(function (width) {
|
|
157
|
+
return onManagedResize(dragMode.current, width);
|
|
158
|
+
}, [onManagedResize]);
|
|
159
|
+
var handleResizeEnd = useCallback(function (event) {
|
|
160
|
+
return onResizeEnd(_objectSpread(_objectSpread({}, event), {}, {
|
|
161
|
+
mode: completedResizeModeRef.current
|
|
162
|
+
}));
|
|
163
|
+
}, [onResizeEnd]);
|
|
164
|
+
return /*#__PURE__*/React.createElement("section", {
|
|
165
|
+
"aria-label": label,
|
|
166
|
+
"data-testid": testId,
|
|
167
|
+
"data-layout-with-panel-slot": "",
|
|
168
|
+
style: _defineProperty({}, localPanelVar, "".concat(renderedWidth, "px")),
|
|
169
|
+
ref: mergedRef,
|
|
170
|
+
className: ax([isMotionUpliftEnabled && state === 'entering' && styles.entering, isMotionUpliftEnabled && state === 'exiting' && styles.exiting, styles.panelWrapper, styles.border, !managedSizing && styles.unmeasured, (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])
|
|
171
|
+
}, /*#__PURE__*/React.createElement(PanelSplitterProvider, {
|
|
172
|
+
panelId: localPanelSplitterId,
|
|
173
|
+
panelRef: ref,
|
|
174
|
+
resizingElementRef: layoutRef,
|
|
175
|
+
panelWidth: renderedWidth,
|
|
176
|
+
onCompleteResize: onCompleteResize,
|
|
177
|
+
prepareResize: prepareResize,
|
|
178
|
+
onResizeStartInternal: onResizeStartInternal,
|
|
179
|
+
onResizeInternal: onResizeInternal,
|
|
180
|
+
getResizeBounds: getResizeBounds,
|
|
181
|
+
isEnabled: managedSizing !== undefined || prepareResize !== undefined,
|
|
182
|
+
resizingCssVar: panelSplitterResizingVar,
|
|
183
|
+
position: "start"
|
|
184
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
185
|
+
ref: scrollRef,
|
|
186
|
+
"data-testid": testId && "".concat(testId, "--scroll-container"),
|
|
187
|
+
className: ax([styles.panelScrollContainer, state === 'entering' && styles.contentEntering, isMotionUpliftEnabled && state === 'entering' && contentEnteringDelayStyles.root, state === 'exiting' && styles.contentExiting])
|
|
188
|
+
}, isContentMotionEnabled && contentKey !== undefined ? /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
189
|
+
exitThenEnter: true
|
|
190
|
+
}, /*#__PURE__*/React.createElement(PanelContentMotion, {
|
|
191
|
+
key: contentKey
|
|
192
|
+
}, children)) : children, /*#__PURE__*/React.createElement(PanelSplitter, {
|
|
193
|
+
label: resizeLabel,
|
|
194
|
+
testId: testId && "".concat(testId, "--splitter"),
|
|
195
|
+
onResizeEnd: handleResizeEnd
|
|
196
|
+
}))));
|
|
197
|
+
}
|
|
@@ -5,7 +5,8 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import { Fragment } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
import { useSkipLink } from '../../../context/skip-links/use-skip-link';
|
|
8
|
-
import { mainMinimumWidthVar } from '../constants';
|
|
8
|
+
import { defaultMainMinWidth, mainMinimumWidthVar } from '../constants';
|
|
9
|
+
import { MainMinWidthContext } from '../main-min-width-context';
|
|
9
10
|
import { gridRootFitId, gridRootId } from '../root';
|
|
10
11
|
import { useLayoutId } from '../use-layout-id';
|
|
11
12
|
import { useLayoutMainSizing } from '../use-layout-main-sizing';
|
|
@@ -26,7 +27,7 @@ export function Main(_ref) {
|
|
|
26
27
|
testId = _ref.testId,
|
|
27
28
|
providedId = _ref.id,
|
|
28
29
|
_ref$minWidth = _ref.minWidth,
|
|
29
|
-
minWidth = _ref$minWidth === void 0 ?
|
|
30
|
+
minWidth = _ref$minWidth === void 0 ? defaultMainMinWidth : _ref$minWidth;
|
|
30
31
|
var id = useLayoutId({
|
|
31
32
|
providedId: providedId
|
|
32
33
|
});
|
|
@@ -41,5 +42,7 @@ export function Main(_ref) {
|
|
|
41
42
|
className: ax([mainElementStyles.root, xcss]),
|
|
42
43
|
role: "main",
|
|
43
44
|
"data-testid": testId
|
|
44
|
-
},
|
|
45
|
+
}, /*#__PURE__*/React.createElement(MainMinWidthContext.Provider, {
|
|
46
|
+
value: fg('platform-dst-chat-panel-layout') ? minWidth : defaultMainMinWidth
|
|
47
|
+
}, children)));
|
|
45
48
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
._nd5l1gzg{grid-area:main}._129o1uuk{--p_lclPnlSsrPreferredW:var(--p_lclPnlCompactW)}
|
|
2
|
+
._18m915vq{overflow-y:hidden}
|
|
3
|
+
._18m91wug{overflow-y:auto}
|
|
4
|
+
._19121cl4{isolation:isolate}
|
|
5
|
+
._1bsb1osq{width:100%}
|
|
6
|
+
._1e0c11p5{display:grid}
|
|
7
|
+
._1e0c1txw{display:flex}
|
|
8
|
+
._1f38177r{container-name:local-panel-layout}
|
|
9
|
+
._1l7c1wug._1l7c1wug{grid-template-rows:auto}
|
|
10
|
+
._1l7chkll._1l7chkll{grid-template-rows:1fr}
|
|
11
|
+
._1lmc1m6a{grid-template-areas:"main"}
|
|
12
|
+
._1lmcc53r{grid-template-areas:var(--p_lclPnlSsrAreas,"main")}
|
|
13
|
+
._1reo15vq{overflow-x:hidden}
|
|
14
|
+
._1reo1wug{overflow-x:auto}
|
|
15
|
+
._1uwq15vq._1uwq15vq{overflow-x:hidden}
|
|
16
|
+
._2z05hkll{grid-template-rows:1fr}
|
|
17
|
+
._4t3i1osq{height:100%}
|
|
18
|
+
._7cca15wb{container-type:inline-size}
|
|
19
|
+
._82e815vq._82e815vq{overflow-y:hidden}
|
|
20
|
+
._evra4a59{--p_lclPnlSsrInlineAreas:"main panel"}
|
|
21
|
+
._f8371m6a._f8371m6a{grid-template-areas:"main"}
|
|
22
|
+
._f8374a59._f8374a59{grid-template-areas:"main panel"}
|
|
23
|
+
._vleg1orf._vleg1orf{grid-template-columns:minmax(var(--n_mainMinW,20pc),1fr) clamp(var(--p_lclPnlMinW),var(--p_lclPnlRsz,var(--p_lclPnlTrackW)),calc(100% - var(--n_mainMinW, 20pc)))}
|
|
24
|
+
._vlegi47z._vlegi47z{grid-template-columns:minmax(0,1fr)}
|
|
25
|
+
._yv0eggl6{grid-template-columns:var(--p_lclPnlSsrColumns,minmax(0,1fr))}
|
|
26
|
+
._yv0ei47z{grid-template-columns:minmax(0,1fr)}
|
|
27
|
+
@media (min-width:64rem){._peezi77x{--p_lclPnlSsrPreferredW:var(--p_lclPnlTrackW)}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* panel-layout-shell.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import "./panel-layout-shell.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useContext, useId } from 'react';
|
|
7
|
+
import { MainMinWidthContext } from './main-min-width-context';
|
|
8
|
+
|
|
9
|
+
// The grid uses runtime CSS variables and container sizing outside @atlaskit/css's bounded values.
|
|
10
|
+
var localPanelTrackWidthVar = '--p_lclPnlTrackW';
|
|
11
|
+
var localPanelResizingVar = '--p_lclPnlRsz';
|
|
12
|
+
var localPanelMinWidthVar = '--p_lclPnlMinW';
|
|
13
|
+
var styles = {
|
|
14
|
+
container: "_1f38177r _7cca15wb _4t3i1osq _1bsb1osq",
|
|
15
|
+
layout: "_1reo1wug _18m91wug _1e0c11p5 _7cca15wb _1lmc1m6a _yv0ei47z _2z05hkll _4t3i1osq _1bsb1osq",
|
|
16
|
+
mainContent: "_nd5l1gzg _1reo1wug _18m91wug _1e0c1txw _4t3i1osq _19121cl4",
|
|
17
|
+
panelUplift: "_1reo15vq _18m915vq",
|
|
18
|
+
unmeasured: "_evra4a59 _1lmcc53r _yv0eggl6 _129o1uuk _peezi77x",
|
|
19
|
+
managedInline: "_1uwq15vq _82e815vq _f8374a59 _1l7c1wug _vleg1orf",
|
|
20
|
+
managedOverlay: "_1uwq15vq _82e815vq _f8371m6a _vlegi47z _1l7chkll",
|
|
21
|
+
panelClosed: "_f8371m6a _vlegi47z _1l7chkll"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Grid and scrolling for Main and its local panel. Use inside navigation's Root and Main.
|
|
25
|
+
*/
|
|
26
|
+
export function PanelLayoutShell(_ref) {
|
|
27
|
+
var children = _ref.children,
|
|
28
|
+
panel = _ref.panel,
|
|
29
|
+
isPanelOpen = _ref.isPanelOpen,
|
|
30
|
+
panelWidth = _ref.panelWidth,
|
|
31
|
+
compactPanelWidth = _ref.compactPanelWidth,
|
|
32
|
+
_ref$panelMinWidth = _ref.panelMinWidth,
|
|
33
|
+
panelMinWidth = _ref$panelMinWidth === void 0 ? 320 : _ref$panelMinWidth,
|
|
34
|
+
mode = _ref.mode,
|
|
35
|
+
layoutRef = _ref.layoutRef,
|
|
36
|
+
_ref$shouldClipOverfl = _ref.shouldClipOverflow,
|
|
37
|
+
shouldClipOverflow = _ref$shouldClipOverfl === void 0 ? false : _ref$shouldClipOverfl,
|
|
38
|
+
testId = _ref.testId;
|
|
39
|
+
var mainMinWidth = useContext(MainMinWidthContext);
|
|
40
|
+
var id = "local-panel-".concat(useId().replace(/[^a-zA-Z0-9_-]/g, '_'));
|
|
41
|
+
// CSS query conditions cannot read custom properties. Only the numeric minimums and
|
|
42
|
+
// instance selector are generated here; this rule is removed after the first measurement,
|
|
43
|
+
// so live resizing never rewrites stylesheet text. The named container is local to this shell.
|
|
44
|
+
var inlineQuery = "@container local-panel-layout (min-width: ".concat(mainMinWidth + panelMinWidth, "px)");
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: ax([styles.container])
|
|
47
|
+
}, mode === undefined && isPanelOpen &&
|
|
48
|
+
/*#__PURE__*/
|
|
49
|
+
// 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.
|
|
50
|
+
React.createElement("style", null, "".concat(inlineQuery, " {\n\t\t\t\t\t#").concat(id, " {\n\t\t\t\t\t\t--p_lclPnlSsrAreas: var(--p_lclPnlSsrInlineAreas);\n\t\t\t\t\t\t--p_lclPnlSsrColumns: minmax(0, 1fr) min(var(--p_lclPnlSsrPreferredW), calc(100% - ").concat(mainMinWidth, "px));\n\t\t\t\t\t\t--p_lclPnlSsrArea: panel;\n\t\t\t\t\t\t--p_lclPnlSsrWidth: 100%;\n\t\t\t\t\t\t--p_lclPnlSsrBackground: ", "var(--ds-surface, #FFFFFF)", ";\n\t\t\t\t\t\t--p_lclPnlSsrShadow: none;\n\t\t\t\t\t\t--p_lclPnlSsrBorder: ", "var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";\n\t\t\t\t\t}\n\t\t\t\t}")), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
id: id,
|
|
52
|
+
"data-testid": testId,
|
|
53
|
+
ref: layoutRef,
|
|
54
|
+
style: _defineProperty(_defineProperty(_defineProperty({}, localPanelTrackWidthVar, "".concat(panelWidth, "px")), localPanelMinWidthVar, "".concat(panelMinWidth, "px")), '--p_lclPnlCompactW', "".concat(compactPanelWidth, "px")),
|
|
55
|
+
className: ax([styles.layout, mode === undefined && isPanelOpen && styles.unmeasured, shouldClipOverflow && styles.panelUplift, mode === 'inline' && styles.managedInline, mode === 'overlay' && styles.managedOverlay, !isPanelOpen && styles.panelClosed])
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: ax([styles.mainContent])
|
|
58
|
+
}, children), panel));
|
|
59
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import invariant from 'tiny-invariant';
|
|
4
|
+
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
5
|
+
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
|
+
import { getPanelLayoutDefaults } from './get-panel-layout-defaults';
|
|
8
|
+
import { LayoutAreaSizingContext } from './layout-area-sizing-context';
|
|
9
|
+
import { LayoutAreaSizingProvider } from './layout-area-sizing-provider';
|
|
10
|
+
import { LocalPanelSurface } from './local-panel-surface';
|
|
11
|
+
import { PanelLayoutShell } from './panel-layout-shell';
|
|
12
|
+
import { useLayoutAreaSizing } from './use-layout-area-sizing';
|
|
13
|
+
|
|
14
|
+
// Development-only ownership checks are scoped to each coordinator, not the whole page.
|
|
15
|
+
var mountedPanelLayouts = new WeakSet();
|
|
16
|
+
function CoordinatedPanelLayout(_ref) {
|
|
17
|
+
var _ref2, _ref3, _ref4, _state$width;
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
panel = _ref.panel,
|
|
20
|
+
isPanelOpen = _ref.isPanelOpen,
|
|
21
|
+
panelKey = _ref.panelKey,
|
|
22
|
+
panelWidth = _ref.panelWidth,
|
|
23
|
+
defaultPanelWidth = _ref.defaultPanelWidth,
|
|
24
|
+
compactDefaultPanelWidth = _ref.compactDefaultPanelWidth,
|
|
25
|
+
suppliedMinWidth = _ref.panelMinWidth,
|
|
26
|
+
panelMaxWidth = _ref.panelMaxWidth,
|
|
27
|
+
onPanelWidthChange = _ref.onPanelWidthChange,
|
|
28
|
+
onResizeEnd = _ref.onResizeEnd,
|
|
29
|
+
_ref$panelLabel = _ref.panelLabel,
|
|
30
|
+
panelLabel = _ref$panelLabel === void 0 ? 'Panel' : _ref$panelLabel,
|
|
31
|
+
_ref$resizeLabel = _ref.resizeLabel,
|
|
32
|
+
resizeLabel = _ref$resizeLabel === void 0 ? 'Resize panel' : _ref$resizeLabel,
|
|
33
|
+
testId = _ref.testId,
|
|
34
|
+
layoutRef = _ref.layoutRef;
|
|
35
|
+
var _useState = useState(getPanelLayoutDefaults),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
37
|
+
defaults = _useState2[0];
|
|
38
|
+
var panelMinWidth = suppliedMinWidth !== null && suppliedMinWidth !== void 0 ? suppliedMinWidth : defaults.panelMinWidth;
|
|
39
|
+
var coordinator = useContext(LayoutAreaSizingContext);
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production' && coordinator) {
|
|
42
|
+
invariant(!mountedPanelLayouts.has(coordinator), 'Only one PanelLayout may be mounted per navigation Root/sizing coordinator, including closed hosts and LayoutWithPanel. Reuse the host to switch panel content.');
|
|
43
|
+
mountedPanelLayouts.add(coordinator);
|
|
44
|
+
return function () {
|
|
45
|
+
mountedPanelLayouts.delete(coordinator);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}, [coordinator]);
|
|
49
|
+
var _useState3 = useState((_ref2 = defaultPanelWidth !== null && defaultPanelWidth !== void 0 ? defaultPanelWidth : panelWidth) !== null && _ref2 !== void 0 ? _ref2 : defaults.panelWidth),
|
|
50
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
51
|
+
defaultWidth = _useState4[0];
|
|
52
|
+
var _useState5 = useState((_ref3 = (_ref4 = compactDefaultPanelWidth !== null && compactDefaultPanelWidth !== void 0 ? compactDefaultPanelWidth : defaultPanelWidth) !== null && _ref4 !== void 0 ? _ref4 : panelWidth) !== null && _ref3 !== void 0 ? _ref3 : defaults.compactPanelWidth),
|
|
53
|
+
_useState6 = _slicedToArray(_useState5, 1),
|
|
54
|
+
compactWidth = _useState6[0];
|
|
55
|
+
// Use the controlled request before measurement too, without changing the mount-time default.
|
|
56
|
+
var fallbackWidth = Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : defaultWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity));
|
|
57
|
+
var _useLayoutAreaSizing = useLayoutAreaSizing({
|
|
58
|
+
area: 'panel',
|
|
59
|
+
config: {
|
|
60
|
+
isOpen: isPanelOpen,
|
|
61
|
+
requestedWidth: panelWidth,
|
|
62
|
+
defaultWidth: defaultWidth,
|
|
63
|
+
compactDefaultWidth: compactWidth,
|
|
64
|
+
minWidth: panelMinWidth,
|
|
65
|
+
maxWidth: panelMaxWidth
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
state = _useLayoutAreaSizing.state,
|
|
69
|
+
prepareResize = _useLayoutAreaSizing.prepareResize,
|
|
70
|
+
getResizeBounds = _useLayoutAreaSizing.getResizeBounds,
|
|
71
|
+
startResize = _useLayoutAreaSizing.startResize,
|
|
72
|
+
resize = _useLayoutAreaSizing.resize,
|
|
73
|
+
completeResize = _useLayoutAreaSizing.completeResize;
|
|
74
|
+
// Host callback identity is unrelated to sizing. Keep drag bindings stable while
|
|
75
|
+
// still delivering completions to the latest product-owned state and analytics.
|
|
76
|
+
var onWidthChangeRef = useStableRef(onPanelWidthChange);
|
|
77
|
+
var onResizeEndRef = useStableRef(onResizeEnd);
|
|
78
|
+
var handleWidthChange = useCallback(function (width) {
|
|
79
|
+
var _onWidthChangeRef$cur;
|
|
80
|
+
return (_onWidthChangeRef$cur = onWidthChangeRef.current) === null || _onWidthChangeRef$cur === void 0 ? void 0 : _onWidthChangeRef$cur.call(onWidthChangeRef, width);
|
|
81
|
+
}, [onWidthChangeRef]);
|
|
82
|
+
var handleResizeEnd = useCallback(function (event) {
|
|
83
|
+
var _onResizeEndRef$curre;
|
|
84
|
+
return (_onResizeEndRef$curre = onResizeEndRef.current) === null || _onResizeEndRef$curre === void 0 ? void 0 : _onResizeEndRef$curre.call(onResizeEndRef, event);
|
|
85
|
+
}, [onResizeEndRef]);
|
|
86
|
+
var isMotionEnabled = fg('platform-dst-motion-uplift-panel');
|
|
87
|
+
var surface = isPanelOpen && /*#__PURE__*/React.createElement(LocalPanelSurface, {
|
|
88
|
+
key: "local-panel",
|
|
89
|
+
contentKey: panelKey,
|
|
90
|
+
defaultWidth: fallbackWidth,
|
|
91
|
+
minWidth: panelMinWidth,
|
|
92
|
+
maxWidth: panelMaxWidth,
|
|
93
|
+
layoutRef: layoutRef,
|
|
94
|
+
managedSizing: state,
|
|
95
|
+
getManagedResizeBounds: getResizeBounds,
|
|
96
|
+
prepareResize: prepareResize,
|
|
97
|
+
onManagedResizeStart: startResize,
|
|
98
|
+
onManagedResize: resize,
|
|
99
|
+
onManagedResizeEnd: completeResize,
|
|
100
|
+
onWidthChange: handleWidthChange,
|
|
101
|
+
onResizeEnd: handleResizeEnd,
|
|
102
|
+
label: panelLabel,
|
|
103
|
+
resizeLabel: resizeLabel,
|
|
104
|
+
testId: testId && "".concat(testId, "--panel-slot")
|
|
105
|
+
}, panel);
|
|
106
|
+
return /*#__PURE__*/React.createElement(PanelLayoutShell, {
|
|
107
|
+
isPanelOpen: isPanelOpen,
|
|
108
|
+
panelWidth: (_state$width = state === null || state === void 0 ? void 0 : state.width) !== null && _state$width !== void 0 ? _state$width : fallbackWidth,
|
|
109
|
+
compactPanelWidth: Math.max(panelMinWidth, Math.min(panelWidth !== null && panelWidth !== void 0 ? panelWidth : compactWidth, panelMaxWidth !== null && panelMaxWidth !== void 0 ? panelMaxWidth : Infinity)),
|
|
110
|
+
panelMinWidth: panelMinWidth,
|
|
111
|
+
mode: state === null || state === void 0 ? void 0 : state.mode,
|
|
112
|
+
layoutRef: layoutRef,
|
|
113
|
+
shouldClipOverflow: isMotionEnabled,
|
|
114
|
+
testId: testId,
|
|
115
|
+
panel: isMotionEnabled ? /*#__PURE__*/React.createElement(ExitingPersistence, null, surface) : surface
|
|
116
|
+
}, children);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A coordinated local panel with caller-owned content and state. Keep this host mounted
|
|
121
|
+
* while closed to retain resized widths. Unmount it to reset its width preferences.
|
|
122
|
+
*
|
|
123
|
+
* Mount only one local-panel host per navigation Root/sizing coordinator, including
|
|
124
|
+
* closed hosts and panel-system's LayoutWithPanel. Switch content through the same host;
|
|
125
|
+
* separate Roots may each own a local panel.
|
|
126
|
+
*
|
|
127
|
+
* With chat layout enabled it shares Root's sizing coordinator. Otherwise it measures
|
|
128
|
+
* its own Main region, leaving existing navigation/chat behavior unchanged.
|
|
129
|
+
* Local-panel placement and resize constraints use this layout in both cases; disabling
|
|
130
|
+
* the chat-layout gate does not restore the previous panel-system layout engine.
|
|
131
|
+
*/
|
|
132
|
+
export function PanelLayout(props) {
|
|
133
|
+
var parentSizing = useContext(LayoutAreaSizingContext);
|
|
134
|
+
var layoutRef = useRef(null);
|
|
135
|
+
var content = /*#__PURE__*/React.createElement(CoordinatedPanelLayout, {
|
|
136
|
+
layoutRef: layoutRef,
|
|
137
|
+
panel: props.panel,
|
|
138
|
+
isPanelOpen: props.isPanelOpen,
|
|
139
|
+
panelKey: props.panelKey,
|
|
140
|
+
panelWidth: props.panelWidth,
|
|
141
|
+
defaultPanelWidth: props.defaultPanelWidth,
|
|
142
|
+
compactDefaultPanelWidth: props.compactDefaultPanelWidth,
|
|
143
|
+
panelMinWidth: props.panelMinWidth,
|
|
144
|
+
panelMaxWidth: props.panelMaxWidth,
|
|
145
|
+
onPanelWidthChange: props.onPanelWidthChange,
|
|
146
|
+
onResizeEnd: props.onResizeEnd,
|
|
147
|
+
panelLabel: props.panelLabel,
|
|
148
|
+
resizeLabel: props.resizeLabel,
|
|
149
|
+
testId: props.testId
|
|
150
|
+
}, props.children);
|
|
151
|
+
return parentSizing ? content : /*#__PURE__*/React.createElement(LayoutAreaSizingProvider, {
|
|
152
|
+
layoutRef: layoutRef
|
|
153
|
+
}, content);
|
|
154
|
+
}
|
|
@@ -185,7 +185,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
185
185
|
var initialClientXRef = useRef(null);
|
|
186
186
|
// Live allocation changes panelWidth on every frame. Only the legacy path should
|
|
187
187
|
// rebind the drag listeners when this value changes.
|
|
188
|
-
var legacyPanelWidth = fg('platform-dst-chat-panel-layout') ? undefined : panelWidth;
|
|
188
|
+
var legacyPanelWidth = fg('platform-dst-chat-panel-layout') || onResizeInternal ? undefined : panelWidth;
|
|
189
189
|
useEffect(function () {
|
|
190
190
|
var splitter = splitterRef.current;
|
|
191
191
|
invariant(splitter, 'Splitter ref must be set');
|
|
@@ -294,7 +294,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
294
294
|
position: position
|
|
295
295
|
});
|
|
296
296
|
var resizingWidth = "clamp(".concat(resizeBounds.min, ", ").concat(targetWidth, "px, ").concat(resizeBounds.max, ")");
|
|
297
|
-
if (
|
|
297
|
+
if (onResizeInternal) {
|
|
298
298
|
// The allocator needs below-minimum requests for the local-to-chat cascade.
|
|
299
299
|
var currentBounds = getResizeBounds();
|
|
300
300
|
var width = Math.max(0, Math.min(targetWidth, prepareResize ? window.innerWidth : convertResizeBoundToPixels(currentBounds.max)));
|
|
@@ -350,7 +350,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
350
350
|
}
|
|
351
351
|
finalWidth = getPixelWidth(panel); // Persist the final preferred width before removing the imperative drag
|
|
352
352
|
// variable, so the rendered width is continuous across pointer release.
|
|
353
|
-
if (fg('platform-dst-chat-panel-layout')) {
|
|
353
|
+
if (fg('platform-dst-chat-panel-layout') || onResizeInternal) {
|
|
354
354
|
flushSync(function () {
|
|
355
355
|
return onCompleteResize(finalWidth);
|
|
356
356
|
});
|
|
@@ -407,7 +407,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
407
407
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
408
408
|
while (1) switch (_context2.prev = _context2.next) {
|
|
409
409
|
case 0:
|
|
410
|
-
isManagedResize =
|
|
410
|
+
isManagedResize = onResizeInternal;
|
|
411
411
|
sequence = focusSequence.current;
|
|
412
412
|
value = isManagedResize ? parseFloat(event.currentTarget.value) : parseInt(event.currentTarget.value);
|
|
413
413
|
if (!prepareResize) {
|
|
@@ -21,7 +21,7 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/el
|
|
|
21
21
|
import { hasOpenDialogOrPopover } from '@atlaskit/top-layer/page-surface/has-open-dialog-or-popover';
|
|
22
22
|
import { useSkipLinkInternal } from '../../../context/skip-links/use-skip-link-internal';
|
|
23
23
|
import { TopNavStartElement } from '../../../context/top-nav-start/top-nav-start-element';
|
|
24
|
-
import { UNSAFE_sideNavLayoutVar, mainMinimumWidthVar, openLayerObserverSideNavNamespace, sideNavLiveWidthVar, sideNavPanelSplitterId, sideNavVar } from '../constants';
|
|
24
|
+
import { UNSAFE_sideNavLayoutVar, defaultMainMinWidth, mainMinimumWidthVar, openLayerObserverSideNavNamespace, sideNavLiveWidthVar, sideNavPanelSplitterId, sideNavVar } from '../constants';
|
|
25
25
|
import { DangerouslyHoistCssVarToDocumentRoot } from '../dangerously-hoist-css-var-to-document-root';
|
|
26
26
|
import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
|
|
27
27
|
import { convertResizeBoundToPixels } from '../panel-splitter/convert-resize-bound-to-pixels';
|
|
@@ -354,7 +354,7 @@ function SideNavInternal(_ref4) {
|
|
|
354
354
|
var isLocalPanelInline = localPanel && getComputedStyle(localPanel).gridArea === 'panel';
|
|
355
355
|
var localPanelWidth = isLocalPanelInline ? localPanel.getBoundingClientRect().width : 0;
|
|
356
356
|
var mainContentWidth = mainWidth - localPanelWidth;
|
|
357
|
-
var mainMinimumWidth = getPixelCustomProperty(main, mainMinimumWidthVar,
|
|
357
|
+
var mainMinimumWidth = getPixelCustomProperty(main, mainMinimumWidthVar, defaultMainMinWidth);
|
|
358
358
|
var availableWidth = Math.max(0, mainContentWidth - mainMinimumWidth);
|
|
359
359
|
var availableInlineWidth = Math.floor(sideNavWidth + availableWidth);
|
|
360
360
|
var constrainedMaxWidth = maxWidth ? Math.min(convertResizeBoundToPixels(maxWidth), availableInlineWidth) : availableInlineWidth;
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* This violates the [UI styling standard](https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-imported-style-values/usage).
|
|
4
4
|
* We have chosen to ignore this rule to prevent duplicating them across the different slots, and to provide a high level view of them and how they relate.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default minimum width of Main, in pixels, before a custom minimum is registered.
|
|
8
|
+
*/
|
|
9
|
+
export declare const defaultMainMinWidth = 320;
|
|
6
10
|
export declare const sideNavVar = "--n_sNvw";
|
|
7
11
|
export declare const asideVar = "--n_asDw";
|
|
8
12
|
export declare const panelVar = "--n_pnlW";
|
|
@@ -12,6 +16,14 @@ export declare const mainMinimumWidthVar = "--n_mainMinW";
|
|
|
12
16
|
export declare const bannerMountedVar = "--n_bnrM";
|
|
13
17
|
export declare const topNavMountedVar = "--n_tNvM";
|
|
14
18
|
export declare const ribbonVar = "--n_rbnW";
|
|
19
|
+
/**
|
|
20
|
+
* Rendered border-box width of the local PanelLayout surface, in both inline and overlay modes.
|
|
21
|
+
* Published on document.documentElement after mounting when Root opts into
|
|
22
|
+
* UNSAFE_dangerouslyHoistSlotSizes. Only the primary Root should opt in.
|
|
23
|
+
* Use `var(${localPanelWidthVar}, 0px)` for external controls, not for width persistence
|
|
24
|
+
* or sizing the panel itself. The property is removed when the surface unmounts.
|
|
25
|
+
*/
|
|
26
|
+
export declare const localPanelWidthVar = "--n_localPanelWidth";
|
|
15
27
|
/**
|
|
16
28
|
* Captures the current width of the side navigation, at all times, including during resizing.
|
|
17
29
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-panel defaults in pixels, used only when no explicit preference exists.
|
|
3
|
+
* Keep the existing desktop width until chat layout rolls out. Compact sizing is independent.
|
|
4
|
+
* These are requested defaults, not measurements of an open panel.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getPanelLayoutDefaults(): {
|
|
7
|
+
panelWidth: number;
|
|
8
|
+
compactPanelWidth: number;
|
|
9
|
+
panelMinWidth: number;
|
|
10
|
+
};
|
|
@@ -16,7 +16,11 @@ export type LayoutAreaConfig = {
|
|
|
16
16
|
onRequestClose?: () => void;
|
|
17
17
|
};
|
|
18
18
|
export type StoredLayoutArea = LayoutAreaConfig & {
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Local panels share this preference across inline and overlay modes.
|
|
21
|
+
* SideNav and ChatPanel retain separate overlay preferences.
|
|
22
|
+
*/
|
|
23
|
+
preferredWidth?: number;
|
|
20
24
|
preferredOverlayWidth?: number;
|
|
21
25
|
liveResize?: {
|
|
22
26
|
mode: LayoutAreaMode;
|