@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 11.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`87ab1d5ada9d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87ab1d5ada9d4) -
|
|
8
|
+
Move local-panel layout responsibilities from `@atlassian/panel-system` into
|
|
9
|
+
`@atlaskit/navigation-system`, including responsive positioning, sizing and resizing alongside
|
|
10
|
+
Main, SideNav and ChatPanel.
|
|
11
|
+
|
|
12
|
+
Expose `localPanelWidthVar` for positioning external controls beside the rendered local panel in
|
|
13
|
+
inline and overlay modes when Root enables `UNSAFE_dangerouslyHoistSlotSizes`.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 11.3.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -24,3 +24,23 @@ yarn add @atlaskit/navigation-system
|
|
|
24
24
|
|
|
25
25
|
Detailed docs and example usage can be found
|
|
26
26
|
[here](https://atlassian.design/components/navigation-system/).
|
|
27
|
+
|
|
28
|
+
### Positioning controls beside a local panel
|
|
29
|
+
|
|
30
|
+
For global controls outside the layout, the primary `Root` can opt into
|
|
31
|
+
`UNSAFE_dangerouslyHoistSlotSizes`. Its `PanelLayout` then publishes its rendered border-box width
|
|
32
|
+
on the document element, using `localPanelWidthVar` from
|
|
33
|
+
`@atlaskit/navigation-system/layout/panel-layout`:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import type { localPanelWidthVar } from '@atlaskit/navigation-system/layout/panel-layout';
|
|
37
|
+
|
|
38
|
+
// A type-checked literal keeps static styles compatible with Compiled.
|
|
39
|
+
style={{ right: `calc(var(${'--n_localPanelWidth' satisfies typeof localPanelWidthVar}, 0px) + 24px)` }}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The value follows both inline and overlay widths, including CSS constraints before the deferred
|
|
43
|
+
resize coordinator activates. It is removed when the panel surface unmounts; use the `0px` fallback
|
|
44
|
+
when closed or before hydration. Only one primary Root should enable global size hoisting. This
|
|
45
|
+
variable is for positioning external controls, not for sizing the panel or persisting a preferred
|
|
46
|
+
width. The legacy Panel's `--rightPanelWidth` contract is unchanged.
|
|
@@ -70,7 +70,7 @@ screen.
|
|
|
70
70
|
|
|
71
71
|
<TSMorphProps exportName="SideNav" packageName="@atlaskit/navigation-system" />
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
{/* Not using level 4 heading for side nav layout areas as they won't be added to table of contents */}
|
|
74
74
|
|
|
75
75
|
### SideNavHeader
|
|
76
76
|
|
|
@@ -12,8 +12,6 @@ import layoutExampleSideNavLight from './images/layout-example-sideNav-light.png
|
|
|
12
12
|
import layoutExampleSideNavDark from './images/layout-example-sideNav-dark.png';
|
|
13
13
|
import layoutExampleTopNav1Light from './images/layout-example-topNav-1-light.png';
|
|
14
14
|
import layoutExampleTopNav1Dark from './images/layout-example-topNav-1-dark.png';
|
|
15
|
-
import layoutExampleTopNav2Light from './images/layout-example-topNav-2-light.png';
|
|
16
|
-
import layoutExampleTopNav2Dark from './images/layout-example-topNav-2-dark.png';
|
|
17
15
|
|
|
18
16
|
import SectionMessage from '@atlaskit/section-message';
|
|
19
17
|
|
|
@@ -30,9 +28,6 @@ The full page layout with all areas rendered has the structure depicted below, o
|
|
|
30
28
|
alt="Example of the navigation system layout areas"
|
|
31
29
|
/>
|
|
32
30
|
|
|
33
|
-
The top nav overlaps the side nav when it is expanded to give the appearance of a full height side
|
|
34
|
-
nav.
|
|
35
|
-
|
|
36
31
|
When composing your page layout ensure that:
|
|
37
32
|
|
|
38
33
|
- The `Root` element wraps your entire view
|
|
@@ -55,8 +50,8 @@ the top of the screen.
|
|
|
55
50
|
|
|
56
51
|
Use the top nav area to render [top nav items](/components/navigation-system/top-nav-items).
|
|
57
52
|
|
|
58
|
-
- It will display at the top of the screen, below the banner if one is present.
|
|
59
|
-
|
|
53
|
+
- It will display at the top of the screen, below the banner if one is present. Its default height
|
|
54
|
+
is 48px, or 56px with the updated app switcher. Use the `height` prop to override it.
|
|
60
55
|
- Use the [top nav slots](#top-nav-slots) to position actions within top nav.
|
|
61
56
|
- The top nav is responsive, with the [top nav items](/components/navigation-system/top-nav-items)
|
|
62
57
|
changing according to the viewport size.
|
|
@@ -68,21 +63,14 @@ Use the top nav area to render [top nav items](/components/navigation-system/top
|
|
|
68
63
|
The top nav has three layout components that you must use to position
|
|
69
64
|
[top nav items](/components/navigation-system/top-nav-items) within the top nav flexbox.
|
|
70
65
|
|
|
71
|
-
- `TopNavStart`: Area for left-aligned items.
|
|
72
|
-
to give the appearance of a full height sidebar.
|
|
66
|
+
- `TopNavStart`: Area for left-aligned items.
|
|
73
67
|
- `TopNavMiddle`: Area for centre-aligned items.
|
|
74
68
|
- `TopNavEnd`: Area for right-aligned items.
|
|
75
69
|
|
|
76
70
|
<Image
|
|
77
71
|
src={layoutExampleTopNav1Light}
|
|
78
72
|
srcDark={layoutExampleTopNav1Dark}
|
|
79
|
-
alt="Example of the top nav slots
|
|
80
|
-
/>
|
|
81
|
-
|
|
82
|
-
<Image
|
|
83
|
-
src={layoutExampleTopNav2Light}
|
|
84
|
-
srcDark={layoutExampleTopNav2Dark}
|
|
85
|
-
alt="Example of the top nav slots - side nav opened"
|
|
73
|
+
alt="Example of the top nav slots"
|
|
86
74
|
/>
|
|
87
75
|
|
|
88
76
|
#### Top nav custom theming
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -40,8 +40,7 @@ When applying components to the navigational areas,
|
|
|
40
40
|
<a href="/components/navigation-system/top-nav-items">top nav items</a>.
|
|
41
41
|
<ol type="a">
|
|
42
42
|
<li>
|
|
43
|
-
<strong>Top nav start:</strong> Area for left-aligned actions.
|
|
44
|
-
the side nav is expanded.
|
|
43
|
+
<strong>Top nav start:</strong> Area for left-aligned actions.
|
|
45
44
|
</li>
|
|
46
45
|
<li>
|
|
47
46
|
<strong>Top nav middle:</strong> Area for centre-aligned actions.
|
|
@@ -30,7 +30,7 @@ For other components that can be used within the top nav, see
|
|
|
30
30
|
## Start items
|
|
31
31
|
|
|
32
32
|
These actions go in the [top nav start](/components/navigation-system/layout/examples#top-nav-slots)
|
|
33
|
-
area.
|
|
33
|
+
area. They are left-aligned in the following order:
|
|
34
34
|
|
|
35
35
|
- Side nav toggle button: Opens and closes the
|
|
36
36
|
[side nav](/components/navigation-system/layout/examples#side-nav).
|
|
@@ -63,8 +63,8 @@ not via `children`.
|
|
|
63
63
|
|
|
64
64
|
- When the keyboard shortcut is enabled, the toggle button’s tooltip will automatically show Ctrl+[
|
|
65
65
|
as the shortcut.
|
|
66
|
-
- The toggle button
|
|
67
|
-
|
|
66
|
+
- The toggle button appears before the app switcher and logo, whether the side nav is collapsed or
|
|
67
|
+
expanded.
|
|
68
68
|
|
|
69
69
|
<Example Component={TopNavStartToggleExample} />
|
|
70
70
|
|
|
@@ -72,8 +72,7 @@ not via `children`.
|
|
|
72
72
|
|
|
73
73
|
App logo displays an app [logo icon](/components/logo) and name.
|
|
74
74
|
|
|
75
|
-
- It has a maximum width of 320px, after which the app name truncates.
|
|
76
|
-
based on the available space when the side nav is resized.
|
|
75
|
+
- It has a maximum width of 320px, after which the app name truncates.
|
|
77
76
|
- At `s` breakpoints and below (less that 1024px), the app name is not shown.
|
|
78
77
|
|
|
79
78
|
See the [responsive section](#responsive) for more information.
|
|
@@ -92,8 +91,7 @@ hidden with the app name at `s` breakpoints and below (less than 1024px).
|
|
|
92
91
|
|
|
93
92
|
Custom logo provides a container for custom logo images with the following constraints:
|
|
94
93
|
|
|
95
|
-
- Maximum width: 320px. If the image is wider than this,
|
|
96
|
-
resized, the logo will scale down to fit.
|
|
94
|
+
- Maximum width: 320px. If the image is wider than this, the logo will scale down to fit.
|
|
97
95
|
- Maximum height: 24px. If the image is shorter than this, the logo will scale up to fit.
|
|
98
96
|
|
|
99
97
|
Do not provide explicit width and height values on the image, otherwise it will not respect the
|
|
@@ -111,8 +109,7 @@ See the [responsive section](#responsive) for more information.
|
|
|
111
109
|
Optional text used for app customisation by customers.
|
|
112
110
|
|
|
113
111
|
- When present, it appears to the right of the logo.
|
|
114
|
-
- It has a maximum width of 200px, after which the text truncates.
|
|
115
|
-
available space when the side nav is resized.
|
|
112
|
+
- It has a maximum width of 200px, after which the text truncates.
|
|
116
113
|
- At `s` breakpoints and below (less than 1024px), the custom title is not displayed.
|
|
117
114
|
|
|
118
115
|
<Example Component={CustomTitleExample} />
|
|
@@ -124,10 +121,7 @@ These actions go in the
|
|
|
124
121
|
|
|
125
122
|
- They should consist of a search component and a create component, in that order to maintain the
|
|
126
123
|
correct layout behaviour.
|
|
127
|
-
- The actions are
|
|
128
|
-
is expanded.
|
|
129
|
-
- At `xl` breakpoints (1768px or greater), the middle items are centred in the viewport when the
|
|
130
|
-
side nav is expanded, but are pushed out by the side nav to avoid overlapping.
|
|
124
|
+
- The actions are center-aligned.
|
|
131
125
|
- We have provided placeholder components. See
|
|
132
126
|
[navigation resources (Atlassians only)](https://hello.atlassian.net/wiki/x/rBE7MAE) for
|
|
133
127
|
recommended platform components.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "PanelLayout", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _panelLayout.PanelLayout;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "localPanelWidthVar", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _constants.localPanelWidthVar;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _panelLayout = require("../../ui/page-layout/panel-layout");
|
|
19
|
+
var _constants = require("../../ui/page-layout/constants");
|
|
@@ -19,12 +19,12 @@ function clampTargetWidth(_ref) {
|
|
|
19
19
|
function getTargetWidth(area, isSideNavOverlay) {
|
|
20
20
|
var _area$compactDefaultW, _area$liveResize, _ref2, _area$requestedWidth;
|
|
21
21
|
var defaultWidth = isSideNavOverlay ? (_area$compactDefaultW = area.compactDefaultWidth) !== null && _area$compactDefaultW !== void 0 ? _area$compactDefaultW : area.defaultWidth : area.defaultWidth;
|
|
22
|
-
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.
|
|
22
|
+
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;
|
|
23
23
|
}
|
|
24
|
-
function getOverlayTargetWidth(area, isSideNavOverlay) {
|
|
24
|
+
function getOverlayTargetWidth(area, isSideNavOverlay, areaName) {
|
|
25
25
|
var _area$compactDefaultW2, _area$liveResize2, _ref3, _area$requestedWidth2;
|
|
26
26
|
var defaultWidth = isSideNavOverlay ? (_area$compactDefaultW2 = area.compactDefaultWidth) !== null && _area$compactDefaultW2 !== void 0 ? _area$compactDefaultW2 : area.defaultWidth : area.defaultWidth;
|
|
27
|
-
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 : area.preferredOverlayWidth) !== null && _ref3 !== void 0 ? _ref3 : defaultWidth;
|
|
27
|
+
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;
|
|
28
28
|
}
|
|
29
29
|
function calculateLayoutAreaStates(_ref4) {
|
|
30
30
|
var _ref5, _resizeSession$overla, _baselineWidths$chat, _panel$liveResize, _states$sideNav$widt, _states$sideNav, _states$chatPanel$wi, _states$chatPanel;
|
|
@@ -193,7 +193,7 @@ function calculateLayoutAreaStates(_ref4) {
|
|
|
193
193
|
var layoutMax = (_areaName2 === 'chat-panel' ? layoutWidth : mainAreaWidth) * 0.9;
|
|
194
194
|
var _max = Math.max(0, Math.min(configuredMax, layoutMax));
|
|
195
195
|
var effectiveMin = Math.min(_min2, _max);
|
|
196
|
-
var _target = getOverlayTargetWidth(_area, isSideNavOverlay);
|
|
196
|
+
var _target = getOverlayTargetWidth(_area, isSideNavOverlay, _areaName2);
|
|
197
197
|
var _width = clampTargetWidth({
|
|
198
198
|
target: _target,
|
|
199
199
|
min: effectiveMin,
|
|
@@ -161,7 +161,7 @@ function ChatPanel(_ref) {
|
|
|
161
161
|
var localPanel = main.querySelector('[data-layout-with-panel-slot]');
|
|
162
162
|
var isLocalPanelInline = localPanel && getComputedStyle(localPanel).gridArea === 'panel';
|
|
163
163
|
var localPanelWidth = isLocalPanelInline ? localPanel.getBoundingClientRect().width : 0;
|
|
164
|
-
var mainMinimumWidth = getPixelCustomProperty(main, _constants.mainMinimumWidthVar,
|
|
164
|
+
var mainMinimumWidth = getPixelCustomProperty(main, _constants.mainMinimumWidthVar, _constants.defaultMainMinWidth);
|
|
165
165
|
var mainContentWidth = mainWidth - localPanelWidth;
|
|
166
166
|
var availableWidth = Math.max(0, mainContentWidth - mainMinimumWidth);
|
|
167
167
|
var availableInlineWidth = Math.floor(chatPanelWidth + availableWidth);
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.topNavMountedVar = exports.sideNavVar = exports.sideNavPanelSplitterId = exports.sideNavLiveWidthVar = exports.ribbonVar = exports.panelVar = exports.panelPanelSplitterId = exports.openLayerObserverTopNavMiddleNamespace = exports.openLayerObserverTopNavEndNamespace = exports.openLayerObserverSideNavNamespace = exports.mainMinimumWidthVar = exports.localSlotLayers = exports.contentInsetBlockStart = exports.contentHeightWhenFixed = exports.chatPanelVar = exports.chatPanelLiveWidthVar = exports.bannerMountedVar = exports.asideVar = exports.asidePanelSplitterId = exports.UNSAFE_topNavVar = exports.UNSAFE_sideNavLayoutVar = exports.UNSAFE_ribbonVar = exports.UNSAFE_panelLayoutVar = exports.UNSAFE_bannerVar = exports.UNSAFE_asideLayoutVar = exports.UNSAFE_MAIN_INLINE_START_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_INLINE_END_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_BLOCK_START_FOR_LEGACY_PAGES_ONLY = void 0;
|
|
6
|
+
exports.topNavMountedVar = exports.sideNavVar = exports.sideNavPanelSplitterId = exports.sideNavLiveWidthVar = exports.ribbonVar = exports.panelVar = exports.panelPanelSplitterId = exports.openLayerObserverTopNavMiddleNamespace = exports.openLayerObserverTopNavEndNamespace = exports.openLayerObserverSideNavNamespace = exports.mainMinimumWidthVar = exports.localSlotLayers = exports.localPanelWidthVar = exports.defaultMainMinWidth = exports.contentInsetBlockStart = exports.contentHeightWhenFixed = exports.chatPanelVar = exports.chatPanelLiveWidthVar = exports.bannerMountedVar = exports.asideVar = exports.asidePanelSplitterId = exports.UNSAFE_topNavVar = exports.UNSAFE_sideNavLayoutVar = exports.UNSAFE_ribbonVar = exports.UNSAFE_panelLayoutVar = exports.UNSAFE_bannerVar = exports.UNSAFE_asideLayoutVar = exports.UNSAFE_MAIN_INLINE_START_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_INLINE_END_FOR_LEGACY_PAGES_ONLY = exports.UNSAFE_MAIN_BLOCK_START_FOR_LEGACY_PAGES_ONLY = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* These variables are shared across the different page layout slots.
|
|
9
9
|
* This violates the [UI styling standard](https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-imported-style-values/usage).
|
|
10
10
|
* 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.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Default minimum width of Main, in pixels, before a custom minimum is registered.
|
|
15
|
+
*/
|
|
16
|
+
var defaultMainMinWidth = exports.defaultMainMinWidth = 320;
|
|
17
|
+
|
|
13
18
|
// These are "compressed" to discourage usage.
|
|
14
19
|
var sideNavVar = exports.sideNavVar = '--n_sNvw';
|
|
15
20
|
var asideVar = exports.asideVar = '--n_asDw';
|
|
@@ -21,6 +26,15 @@ var bannerMountedVar = exports.bannerMountedVar = '--n_bnrM';
|
|
|
21
26
|
var topNavMountedVar = exports.topNavMountedVar = '--n_tNvM';
|
|
22
27
|
var ribbonVar = exports.ribbonVar = '--n_rbnW';
|
|
23
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Rendered border-box width of the local PanelLayout surface, in both inline and overlay modes.
|
|
31
|
+
* Published on document.documentElement after mounting when Root opts into
|
|
32
|
+
* UNSAFE_dangerouslyHoistSlotSizes. Only the primary Root should opt in.
|
|
33
|
+
* Use `var(${localPanelWidthVar}, 0px)` for external controls, not for width persistence
|
|
34
|
+
* or sizing the panel itself. The property is removed when the surface unmounts.
|
|
35
|
+
*/
|
|
36
|
+
var localPanelWidthVar = exports.localPanelWidthVar = '--n_localPanelWidth';
|
|
37
|
+
|
|
24
38
|
/**
|
|
25
39
|
* Captures the current width of the side navigation, at all times, including during resizing.
|
|
26
40
|
*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPanelLayoutDefaults = getPanelLayoutDefaults;
|
|
7
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
+
var DEFAULT_PANEL_WIDTH = 365;
|
|
9
|
+
var DEFAULT_PANEL_WIDTH_WITH_CHAT_PANEL_LAYOUT = 400;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Local-panel defaults in pixels, used only when no explicit preference exists.
|
|
13
|
+
* Keep the existing desktop width until chat layout rolls out. Compact sizing is independent.
|
|
14
|
+
* These are requested defaults, not measurements of an open panel.
|
|
15
|
+
*/
|
|
16
|
+
function getPanelLayoutDefaults() {
|
|
17
|
+
return {
|
|
18
|
+
panelWidth: (0, _fg.fg)('platform-dst-chat-panel-layout') ? DEFAULT_PANEL_WIDTH_WITH_CHAT_PANEL_LAYOUT : DEFAULT_PANEL_WIDTH,
|
|
19
|
+
compactPanelWidth: 320,
|
|
20
|
+
panelMinWidth: 320
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -9,6 +9,7 @@ exports.LayoutAreaSizingProvider = LayoutAreaSizingProvider;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
|
+
var _constants = require("./constants");
|
|
12
13
|
var _layoutAreaSizingContext = require("./layout-area-sizing-context");
|
|
13
14
|
var _layoutAreaStateContexts = require("./layout-area-state-contexts");
|
|
14
15
|
var _useCssLayoutAreaStates = require("./use-css-layout-area-states");
|
|
@@ -73,7 +74,7 @@ function LayoutAreaSizingProvider(_ref) {
|
|
|
73
74
|
listener: dismissOlderOverlay
|
|
74
75
|
});
|
|
75
76
|
}, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
|
|
76
|
-
var mainMinWidth = (0, _react.useRef)(
|
|
77
|
+
var mainMinWidth = (0, _react.useRef)(_constants.defaultMainMinWidth);
|
|
77
78
|
var loadRef = (0, _react.useRef)(function () {});
|
|
78
79
|
var ready = (0, _react.useRef)(false);
|
|
79
80
|
var waiting = (0, _react.useRef)([]);
|
|
@@ -11,6 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _bindEventListener = require("bind-event-listener");
|
|
13
13
|
var _calculateLayoutAreaStates = require("./calculate-layout-area-states");
|
|
14
|
+
var _constants = require("./constants");
|
|
14
15
|
var _layoutAreaSizingContext = require("./layout-area-sizing-context");
|
|
15
16
|
var _layoutAreaStateContexts = require("./layout-area-state-contexts");
|
|
16
17
|
var _resolveLayoutWidth = require("./resolve-layout-width");
|
|
@@ -21,7 +22,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
21
22
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
23
|
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; }
|
|
23
24
|
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) { (0, _defineProperty2.default)(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; }
|
|
24
|
-
var defaultMainMinWidth = 320;
|
|
25
25
|
function useStableAreaState(state) {
|
|
26
26
|
var _ref = state !== null && state !== void 0 ? state : {},
|
|
27
27
|
mode = _ref.mode,
|
|
@@ -45,7 +45,7 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
45
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
46
|
dimensions = _useState2[0],
|
|
47
47
|
setDimensions = _useState2[1];
|
|
48
|
-
var _useState3 = (0, _react.useState)(defaultMainMinWidth),
|
|
48
|
+
var _useState3 = (0, _react.useState)(_constants.defaultMainMinWidth),
|
|
49
49
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
50
50
|
mainMinWidth = _useState4[0],
|
|
51
51
|
setMainMinWidth = _useState4[1];
|
|
@@ -313,7 +313,7 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
313
313
|
if (!existing) {
|
|
314
314
|
return current;
|
|
315
315
|
}
|
|
316
|
-
if (mode === 'overlay') {
|
|
316
|
+
if (mode === 'overlay' && area !== 'panel') {
|
|
317
317
|
return _objectSpread(_objectSpread({}, current), {}, (0, _defineProperty2.default)({}, area, _objectSpread(_objectSpread({}, existing), {}, {
|
|
318
318
|
liveResize: undefined,
|
|
319
319
|
preferredOverlayWidth: width
|
|
@@ -321,7 +321,8 @@ function LayoutAreaSizingRuntime(_ref2) {
|
|
|
321
321
|
}
|
|
322
322
|
return _objectSpread(_objectSpread({}, current), {}, (0, _defineProperty2.default)({}, area, _objectSpread(_objectSpread({}, existing), {}, {
|
|
323
323
|
liveResize: undefined,
|
|
324
|
-
|
|
324
|
+
// Local panels have one preference, regardless of the resized mode.
|
|
325
|
+
preferredWidth: width
|
|
325
326
|
})));
|
|
326
327
|
});
|
|
327
328
|
}, [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,206 @@
|
|
|
1
|
+
/* local-panel-surface.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.LocalPanelSurface = LocalPanelSurface;
|
|
10
|
+
require("./local-panel-surface.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
17
|
+
var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
|
|
18
|
+
var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
|
|
19
|
+
var _useMotion3 = require("@atlaskit/motion/entering/use-motion");
|
|
20
|
+
var _exitingPersistence = _interopRequireDefault(require("@atlaskit/motion/exiting-persistence"));
|
|
21
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
|
+
var _constants = require("./constants");
|
|
23
|
+
var _hoistSlotSizesContext = require("./hoist-slot-sizes-context");
|
|
24
|
+
var _panelSplitter = require("./panel-splitter/panel-splitter");
|
|
25
|
+
var _provider = require("./panel-splitter/provider");
|
|
26
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
27
|
+
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; }
|
|
28
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
29
|
+
var localPanelVar = '--p_lclPnlW';
|
|
30
|
+
var panelSplitterResizingVar = '--p_lclPnlRsz';
|
|
31
|
+
var localPanelSplitterId = Symbol('LocalPanel PanelSplitter');
|
|
32
|
+
|
|
33
|
+
// Compiled preserves the existing container-relative widths and discrete motion styles.
|
|
34
|
+
/* eslint-disable @compiled/shorthand-property-sorting -- Content motion overrides only the animation delay. */
|
|
35
|
+
var styles = {
|
|
36
|
+
panelWrapper: "_nd5l1gzg _kqsw1if8 _bfhk1bhr _vchhusvi _4t3ieqxy _152tidpf _10fph9n0 _1bsb13q4",
|
|
37
|
+
managedInline: "_nd5l1c6w _bfhkvuon _152tidpf _1bsb1c5w",
|
|
38
|
+
unmeasured: "_nd5l32aw _191wbqna _1bsb1cku _bfhk1g1j _16qs1dhr",
|
|
39
|
+
managedOverlay: "_nd5l1gzg _bfhk1bhr _1bsb1c5w",
|
|
40
|
+
panelScrollContainer: "_1reo1wug _18m91wug _4t3i1osq",
|
|
41
|
+
border: "_191wglyw _16qs130s",
|
|
42
|
+
managedInlineBorder: "_191wia51 _16qsglyw",
|
|
43
|
+
entering: "_k1af1nn1 _10t81ia4 _xrrp147i _1wsa1ign _1vrh1a5r _1kmh1n9t _105abamb",
|
|
44
|
+
exiting: "_k1af14vv _bq641n9t _105aeydr",
|
|
45
|
+
contentEntering: "_y44v1mph",
|
|
46
|
+
contentExiting: "_y44vf1qi",
|
|
47
|
+
contentChangeContainer: "_4t3i1osq"
|
|
48
|
+
};
|
|
49
|
+
var contentEnteringDelayStyles = {
|
|
50
|
+
root: "_ju25dn4k"
|
|
51
|
+
};
|
|
52
|
+
/* eslint-enable @compiled/shorthand-property-sorting */
|
|
53
|
+
|
|
54
|
+
var PanelContentMotion = function PanelContentMotion(_ref) {
|
|
55
|
+
var children = _ref.children;
|
|
56
|
+
var _useMotion = (0, _useMotion3.useMotion)(),
|
|
57
|
+
state = _useMotion.state,
|
|
58
|
+
ref = _useMotion.ref;
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: ref,
|
|
61
|
+
className: (0, _runtime.ax)([styles.contentChangeContainer, state === 'entering' && styles.contentEntering, state === 'exiting' && styles.contentExiting])
|
|
62
|
+
}, children);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Internal surface for PanelLayout. The host supplies content; navigation owns its geometry.
|
|
66
|
+
*/
|
|
67
|
+
function LocalPanelSurface(_ref2) {
|
|
68
|
+
var _managedSizing$mode, _managedSizing$width;
|
|
69
|
+
var children = _ref2.children,
|
|
70
|
+
contentKey = _ref2.contentKey,
|
|
71
|
+
label = _ref2.label,
|
|
72
|
+
resizeLabel = _ref2.resizeLabel,
|
|
73
|
+
defaultWidth = _ref2.defaultWidth,
|
|
74
|
+
minWidth = _ref2.minWidth,
|
|
75
|
+
maxWidth = _ref2.maxWidth,
|
|
76
|
+
testId = _ref2.testId,
|
|
77
|
+
layoutRef = _ref2.layoutRef,
|
|
78
|
+
managedSizing = _ref2.managedSizing,
|
|
79
|
+
getManagedResizeBounds = _ref2.getManagedResizeBounds,
|
|
80
|
+
prepareResize = _ref2.prepareResize,
|
|
81
|
+
onManagedResizeStart = _ref2.onManagedResizeStart,
|
|
82
|
+
onManagedResize = _ref2.onManagedResize,
|
|
83
|
+
onManagedResizeEnd = _ref2.onManagedResizeEnd,
|
|
84
|
+
onWidthChange = _ref2.onWidthChange,
|
|
85
|
+
onResizeEnd = _ref2.onResizeEnd;
|
|
86
|
+
var ref = (0, _react.useRef)(null);
|
|
87
|
+
var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
|
|
88
|
+
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
89
|
+
var panel = ref.current;
|
|
90
|
+
if (!dangerouslyHoistSlotSizes || !panel) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// Container-relative CSS owns the initial width, before the sizing runtime loads.
|
|
94
|
+
// Publish geometry directly for external controls; never feed it into saved preferences.
|
|
95
|
+
var previousWidth;
|
|
96
|
+
var publishWidth = function publishWidth(width) {
|
|
97
|
+
if (width !== previousWidth) {
|
|
98
|
+
previousWidth = width;
|
|
99
|
+
panel.ownerDocument.documentElement.style.setProperty(_constants.localPanelWidthVar, "".concat(width, "px"));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
publishWidth(panel.getBoundingClientRect().width);
|
|
103
|
+
var observer = new ResizeObserver(function (_ref3) {
|
|
104
|
+
var _entry$borderBoxSize$, _entry$borderBoxSize;
|
|
105
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
106
|
+
entry = _ref4[0];
|
|
107
|
+
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);
|
|
108
|
+
});
|
|
109
|
+
observer.observe(panel, {
|
|
110
|
+
box: 'border-box'
|
|
111
|
+
});
|
|
112
|
+
return function () {
|
|
113
|
+
observer.disconnect();
|
|
114
|
+
panel.ownerDocument.documentElement.style.removeProperty(_constants.localPanelWidthVar);
|
|
115
|
+
};
|
|
116
|
+
}, [dangerouslyHoistSlotSizes]);
|
|
117
|
+
var scrollRef = (0, _react.useRef)(null);
|
|
118
|
+
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
119
|
+
if (scrollRef.current) {
|
|
120
|
+
scrollRef.current.scrollTop = 0;
|
|
121
|
+
}
|
|
122
|
+
}, [contentKey]);
|
|
123
|
+
var _useMotion2 = (0, _useMotion3.useMotion)(),
|
|
124
|
+
state = _useMotion2.state,
|
|
125
|
+
motionRef = _useMotion2.ref;
|
|
126
|
+
var isMotionUpliftEnabled = (0, _fg.fg)('platform-dst-motion-uplift-panel');
|
|
127
|
+
var isContentMotionEnabled = (0, _fg.fg)('platform-dst-motion-uplift-panel-content');
|
|
128
|
+
var mergedRef = (0, _react.useMemo)(function () {
|
|
129
|
+
return isMotionUpliftEnabled ? (0, _mergeRefs.default)([ref, motionRef]) : ref;
|
|
130
|
+
}, [isMotionUpliftEnabled, motionRef]);
|
|
131
|
+
var mode = (_managedSizing$mode = managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode) !== null && _managedSizing$mode !== void 0 ? _managedSizing$mode : 'overlay';
|
|
132
|
+
var managedMode = (0, _useStableRef.default)(managedSizing === null || managedSizing === void 0 ? void 0 : managedSizing.mode);
|
|
133
|
+
// Resize preparation can load the coordinator after the interaction starts.
|
|
134
|
+
// Read its latest mode instead of the pre-load callback's captured fallback.
|
|
135
|
+
var getMode = (0, _react.useCallback)(function () {
|
|
136
|
+
if (managedMode.current) {
|
|
137
|
+
return managedMode.current;
|
|
138
|
+
}
|
|
139
|
+
return ref.current && getComputedStyle(ref.current).gridArea.split('/')[0].trim() === 'panel' ? 'inline' : 'overlay';
|
|
140
|
+
}, [managedMode]);
|
|
141
|
+
var dragMode = (0, _react.useRef)('overlay');
|
|
142
|
+
var completedResizeModeRef = (0, _react.useRef)(mode);
|
|
143
|
+
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));
|
|
144
|
+
// Before the first measurement, CSS caps the surface to its containing region.
|
|
145
|
+
// Resize preparation waits for the coordinator to resolve the same bounds for both inputs.
|
|
146
|
+
var getResizeBounds = (0, _react.useCallback)(function () {
|
|
147
|
+
var _getManagedResizeBoun;
|
|
148
|
+
return (_getManagedResizeBoun = getManagedResizeBounds()) !== null && _getManagedResizeBoun !== void 0 ? _getManagedResizeBoun : {
|
|
149
|
+
min: '0px',
|
|
150
|
+
max: '0px'
|
|
151
|
+
};
|
|
152
|
+
}, [getManagedResizeBounds]);
|
|
153
|
+
var onCompleteResize = (0, _react.useCallback)(function (width) {
|
|
154
|
+
// Keyboard analytics are debounced; retain the mode that produced this width,
|
|
155
|
+
// rather than the layout mode when the delayed callback eventually runs.
|
|
156
|
+
var mode = getMode();
|
|
157
|
+
completedResizeModeRef.current = mode;
|
|
158
|
+
onManagedResizeEnd(mode, width);
|
|
159
|
+
onWidthChange(width);
|
|
160
|
+
}, [getMode, onManagedResizeEnd, onWidthChange]);
|
|
161
|
+
var onResizeStartInternal = (0, _react.useCallback)(function () {
|
|
162
|
+
dragMode.current = getMode();
|
|
163
|
+
onManagedResizeStart(dragMode.current);
|
|
164
|
+
}, [getMode, onManagedResizeStart]);
|
|
165
|
+
var onResizeInternal = (0, _react.useCallback)(function (width) {
|
|
166
|
+
return onManagedResize(dragMode.current, width);
|
|
167
|
+
}, [onManagedResize]);
|
|
168
|
+
var handleResizeEnd = (0, _react.useCallback)(function (event) {
|
|
169
|
+
return onResizeEnd(_objectSpread(_objectSpread({}, event), {}, {
|
|
170
|
+
mode: completedResizeModeRef.current
|
|
171
|
+
}));
|
|
172
|
+
}, [onResizeEnd]);
|
|
173
|
+
return /*#__PURE__*/React.createElement("section", {
|
|
174
|
+
"aria-label": label,
|
|
175
|
+
"data-testid": testId,
|
|
176
|
+
"data-layout-with-panel-slot": "",
|
|
177
|
+
style: (0, _defineProperty2.default)({}, localPanelVar, "".concat(renderedWidth, "px")),
|
|
178
|
+
ref: mergedRef,
|
|
179
|
+
className: (0, _runtime.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])
|
|
180
|
+
}, /*#__PURE__*/React.createElement(_provider.PanelSplitterProvider, {
|
|
181
|
+
panelId: localPanelSplitterId,
|
|
182
|
+
panelRef: ref,
|
|
183
|
+
resizingElementRef: layoutRef,
|
|
184
|
+
panelWidth: renderedWidth,
|
|
185
|
+
onCompleteResize: onCompleteResize,
|
|
186
|
+
prepareResize: prepareResize,
|
|
187
|
+
onResizeStartInternal: onResizeStartInternal,
|
|
188
|
+
onResizeInternal: onResizeInternal,
|
|
189
|
+
getResizeBounds: getResizeBounds,
|
|
190
|
+
isEnabled: managedSizing !== undefined || prepareResize !== undefined,
|
|
191
|
+
resizingCssVar: panelSplitterResizingVar,
|
|
192
|
+
position: "start"
|
|
193
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
ref: scrollRef,
|
|
195
|
+
"data-testid": testId && "".concat(testId, "--scroll-container"),
|
|
196
|
+
className: (0, _runtime.ax)([styles.panelScrollContainer, state === 'entering' && styles.contentEntering, isMotionUpliftEnabled && state === 'entering' && contentEnteringDelayStyles.root, state === 'exiting' && styles.contentExiting])
|
|
197
|
+
}, isContentMotionEnabled && contentKey !== undefined ? /*#__PURE__*/React.createElement(_exitingPersistence.default, {
|
|
198
|
+
exitThenEnter: true
|
|
199
|
+
}, /*#__PURE__*/React.createElement(PanelContentMotion, {
|
|
200
|
+
key: contentKey
|
|
201
|
+
}, children)) : children, /*#__PURE__*/React.createElement(_panelSplitter.PanelSplitter, {
|
|
202
|
+
label: resizeLabel,
|
|
203
|
+
testId: testId && "".concat(testId, "--splitter"),
|
|
204
|
+
onResizeEnd: handleResizeEnd
|
|
205
|
+
}))));
|
|
206
|
+
}
|