@atlaskit/navigation-system 11.3.4 → 11.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +20 -0
  3. package/constellation/layout/code.mdx +1 -1
  4. package/constellation/layout/examples.mdx +4 -16
  5. package/constellation/layout/images/layout-anatomy-dark.png +0 -0
  6. package/constellation/layout/images/layout-anatomy-light.png +0 -0
  7. package/constellation/layout/images/layout-do-dark.png +0 -0
  8. package/constellation/layout/images/layout-do-light.png +0 -0
  9. package/constellation/layout/images/layout-dont-dark.png +0 -0
  10. package/constellation/layout/images/layout-dont-light.png +0 -0
  11. package/constellation/layout/images/layout-example-dark.png +0 -0
  12. package/constellation/layout/images/layout-example-light.png +0 -0
  13. package/constellation/layout/images/layout-example-sideNav-dark.png +0 -0
  14. package/constellation/layout/images/layout-example-sideNav-light.png +0 -0
  15. package/constellation/layout/images/layout-example-topNav-1-dark.png +0 -0
  16. package/constellation/layout/images/layout-example-topNav-1-light.png +0 -0
  17. package/constellation/layout/usage.mdx +1 -2
  18. package/constellation/top-nav-items/examples.mdx +7 -13
  19. package/dist/cjs/entry-points/layout/panel-layout.js +19 -0
  20. package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +4 -4
  21. package/dist/cjs/ui/page-layout/chat-panel.js +1 -1
  22. package/dist/cjs/ui/page-layout/constants.js +15 -1
  23. package/dist/cjs/ui/page-layout/get-panel-layout-defaults.js +22 -0
  24. package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +52 -28
  25. package/dist/cjs/ui/page-layout/layout-area-sizing-runtime.js +5 -4
  26. package/dist/cjs/ui/page-layout/local-panel-surface.compiled.css +26 -0
  27. package/dist/cjs/ui/page-layout/local-panel-surface.js +206 -0
  28. package/dist/cjs/ui/page-layout/main/main.js +5 -2
  29. package/dist/cjs/ui/page-layout/main-min-width-context.js +10 -0
  30. package/dist/cjs/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  31. package/dist/cjs/ui/page-layout/panel-layout-shell.js +67 -0
  32. package/dist/cjs/ui/page-layout/panel-layout.js +162 -0
  33. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +15 -6
  34. package/dist/cjs/ui/page-layout/side-nav/side-nav.js +1 -1
  35. package/dist/cjs/ui/top-nav-items/icon-renderer.js +1 -1
  36. package/dist/es2019/entry-points/layout/panel-layout.js +2 -0
  37. package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +4 -4
  38. package/dist/es2019/ui/page-layout/chat-panel.js +2 -2
  39. package/dist/es2019/ui/page-layout/constants.js +14 -0
  40. package/dist/es2019/ui/page-layout/get-panel-layout-defaults.js +16 -0
  41. package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +19 -4
  42. package/dist/es2019/ui/page-layout/layout-area-sizing-runtime.js +4 -3
  43. package/dist/es2019/ui/page-layout/local-panel-surface.compiled.css +26 -0
  44. package/dist/es2019/ui/page-layout/local-panel-surface.js +193 -0
  45. package/dist/es2019/ui/page-layout/main/main.js +6 -3
  46. package/dist/es2019/ui/page-layout/main-min-width-context.js +5 -0
  47. package/dist/es2019/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  48. package/dist/es2019/ui/page-layout/panel-layout-shell.js +74 -0
  49. package/dist/es2019/ui/page-layout/panel-layout.js +147 -0
  50. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +15 -6
  51. package/dist/es2019/ui/page-layout/side-nav/side-nav.js +2 -2
  52. package/dist/es2019/ui/top-nav-items/icon-renderer.js +1 -1
  53. package/dist/esm/entry-points/layout/panel-layout.js +2 -0
  54. package/dist/esm/ui/page-layout/calculate-layout-area-states.js +4 -4
  55. package/dist/esm/ui/page-layout/chat-panel.js +2 -2
  56. package/dist/esm/ui/page-layout/constants.js +14 -0
  57. package/dist/esm/ui/page-layout/get-panel-layout-defaults.js +16 -0
  58. package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +52 -28
  59. package/dist/esm/ui/page-layout/layout-area-sizing-runtime.js +4 -3
  60. package/dist/esm/ui/page-layout/local-panel-surface.compiled.css +26 -0
  61. package/dist/esm/ui/page-layout/local-panel-surface.js +197 -0
  62. package/dist/esm/ui/page-layout/main/main.js +6 -3
  63. package/dist/esm/ui/page-layout/main-min-width-context.js +5 -0
  64. package/dist/esm/ui/page-layout/panel-layout-shell.compiled.css +27 -0
  65. package/dist/esm/ui/page-layout/panel-layout-shell.js +59 -0
  66. package/dist/esm/ui/page-layout/panel-layout.js +154 -0
  67. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +15 -6
  68. package/dist/esm/ui/page-layout/side-nav/side-nav.js +2 -2
  69. package/dist/esm/ui/top-nav-items/icon-renderer.js +1 -1
  70. package/dist/types/entry-points/layout/panel-layout.d.ts +3 -0
  71. package/dist/types/ui/page-layout/constants.d.ts +12 -0
  72. package/dist/types/ui/page-layout/get-panel-layout-defaults.d.ts +10 -0
  73. package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +9 -1
  74. package/dist/types/ui/page-layout/local-panel-surface.d.ts +32 -0
  75. package/dist/types/ui/page-layout/main-min-width-context.d.ts +2 -0
  76. package/dist/types/ui/page-layout/panel-layout-shell.d.ts +47 -0
  77. package/dist/types/ui/page-layout/panel-layout.d.ts +74 -0
  78. package/layout/panel-layout/package.json +10 -0
  79. package/package.json +7 -7
  80. package/constellation/layout/images/layout-example-topNav-2-dark.png +0 -3
  81. package/constellation/layout/images/layout-example-topNav-2-light.png +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlassian/navigation-system
2
2
 
3
+ ## 11.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`55ae4d70ab929`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55ae4d70ab929) -
8
+ Replace panel splitter attribute discovery with direct element registration, preserving deferred
9
+ sizing and resize interactions for navigation and local panels.
10
+ - Updated dependencies
11
+
12
+ ## 11.4.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`87ab1d5ada9d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87ab1d5ada9d4) -
17
+ Move local-panel layout responsibilities from `@atlassian/panel-system` into
18
+ `@atlaskit/navigation-system`, including responsive positioning, sizing and resizing alongside
19
+ Main, SideNav and ChatPanel.
20
+
21
+ Expose `localPanelWidthVar` for positioning external controls beside the rendered local panel in
22
+ inline and overlay modes when Root enables `UNSAFE_dangerouslyHoistSlotSizes`.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 11.3.4
4
29
 
5
30
  ### 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
- <!-- Not using level 4 heading for side nav layout areas as they won't be added to table of contents -->
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. It has a fixed
59
- height of 56px.
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. Appears in the side nav when the side nav is expanded
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 - side nav collapsed"
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
@@ -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. Appears in the side nav when
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 is left-aligned when the side nav is collapsed, and right-aligned when the side
67
- nav is expanded.
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. The app name also 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, or if space is limited when the side nav is
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. It also truncates based on the
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 centre-aligned when the side nav is collapsed, and left-aligned when the side nav
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.preferredInlineWidth) !== null && _ref2 !== void 0 ? _ref2 : 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.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, 320);
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,14 @@ function LayoutAreaSizingProvider(_ref) {
73
74
  listener: dismissOlderOverlay
74
75
  });
75
76
  }, [chatPanelMode, lastOpenedOverlay, sideNavMode]);
76
- var mainMinWidth = (0, _react.useRef)(320);
77
+ var splitters = (0, _react.useRef)(new Set());
78
+ var registerSplitter = (0, _react.useCallback)(function (element) {
79
+ splitters.current.add(element);
80
+ return function () {
81
+ splitters.current.delete(element);
82
+ };
83
+ }, []);
84
+ var mainMinWidth = (0, _react.useRef)(_constants.defaultMainMinWidth);
77
85
  var loadRef = (0, _react.useRef)(function () {});
78
86
  var ready = (0, _react.useRef)(false);
79
87
  var waiting = (0, _react.useRef)([]);
@@ -128,8 +136,23 @@ function LayoutAreaSizingProvider(_ref) {
128
136
  };
129
137
  loadRef.current = load;
130
138
  var loadForSplitter = function loadForSplitter(event) {
131
- if (event.target instanceof Element && event.target.closest('[data-panel-splitter]')) {
132
- load();
139
+ if (!(event.target instanceof Node)) {
140
+ return;
141
+ }
142
+ var _iterator2 = _createForOfIteratorHelper(splitters.current),
143
+ _step2;
144
+ try {
145
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
146
+ var splitter = _step2.value;
147
+ if (splitter.contains(event.target)) {
148
+ load();
149
+ return;
150
+ }
151
+ }
152
+ } catch (err) {
153
+ _iterator2.e(err);
154
+ } finally {
155
+ _iterator2.f();
133
156
  }
134
157
  };
135
158
  var unbindRoot = (0, _bindEventListener.bindAll)(root, [{
@@ -152,17 +175,17 @@ function LayoutAreaSizingProvider(_ref) {
152
175
  cancelled = true;
153
176
  ready.current = false;
154
177
  pending.current = [];
155
- var _iterator2 = _createForOfIteratorHelper(waitingForRuntime.splice(0)),
156
- _step2;
178
+ var _iterator3 = _createForOfIteratorHelper(waitingForRuntime.splice(0)),
179
+ _step3;
157
180
  try {
158
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
159
- var resolve = _step2.value;
181
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
182
+ var resolve = _step3.value;
160
183
  resolve(false);
161
184
  }
162
185
  } catch (err) {
163
- _iterator2.e(err);
186
+ _iterator3.e(err);
164
187
  } finally {
165
- _iterator2.f();
188
+ _iterator3.f();
166
189
  }
167
190
  loadRef.current = function () {};
168
191
  unbindRoot();
@@ -172,20 +195,20 @@ function LayoutAreaSizingProvider(_ref) {
172
195
  actions.current = runtime;
173
196
  if (runtime) {
174
197
  runtime.setMainMinWidth(mainMinWidth.current);
175
- var _iterator3 = _createForOfIteratorHelper(['side-nav', 'panel', 'chat-panel']),
176
- _step3;
198
+ var _iterator4 = _createForOfIteratorHelper(['side-nav', 'panel', 'chat-panel']),
199
+ _step4;
177
200
  try {
178
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
179
- var area = _step3.value;
201
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
202
+ var area = _step4.value;
180
203
  var config = configs.current[area];
181
204
  if (config) {
182
205
  runtime.registerArea(area, config);
183
206
  }
184
207
  }
185
208
  } catch (err) {
186
- _iterator3.e(err);
209
+ _iterator4.e(err);
187
210
  } finally {
188
- _iterator3.f();
211
+ _iterator4.f();
189
212
  }
190
213
  }
191
214
  }, []);
@@ -194,29 +217,29 @@ function LayoutAreaSizingProvider(_ref) {
194
217
  var runtime = actions.current;
195
218
  if (runtime && Object.values(next).some(Boolean)) {
196
219
  ready.current = true;
197
- var _iterator4 = _createForOfIteratorHelper(pending.current.splice(0)),
198
- _step4;
220
+ var _iterator5 = _createForOfIteratorHelper(pending.current.splice(0)),
221
+ _step5;
199
222
  try {
200
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
201
- var action = _step4.value;
223
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
224
+ var action = _step5.value;
202
225
  action(runtime);
203
226
  }
204
227
  } catch (err) {
205
- _iterator4.e(err);
228
+ _iterator5.e(err);
206
229
  } finally {
207
- _iterator4.f();
230
+ _iterator5.f();
208
231
  }
209
- var _iterator5 = _createForOfIteratorHelper(waiting.current.splice(0)),
210
- _step5;
232
+ var _iterator6 = _createForOfIteratorHelper(waiting.current.splice(0)),
233
+ _step6;
211
234
  try {
212
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
213
- var resolve = _step5.value;
235
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
236
+ var resolve = _step6.value;
214
237
  resolve(true);
215
238
  }
216
239
  } catch (err) {
217
- _iterator5.e(err);
240
+ _iterator6.e(err);
218
241
  } finally {
219
- _iterator5.f();
242
+ _iterator6.f();
220
243
  }
221
244
  }
222
245
  }, []);
@@ -231,6 +254,7 @@ function LayoutAreaSizingProvider(_ref) {
231
254
  var value = (0, _react.useMemo)(function () {
232
255
  return {
233
256
  prepareResize: prepareResize,
257
+ registerSplitter: registerSplitter,
234
258
  registerArea: function registerArea(area, config) {
235
259
  var _configs$current$area, _actions$current;
236
260
  if (area !== 'panel' && config.isOpen && !((_configs$current$area = configs.current[area]) !== null && _configs$current$area !== void 0 && _configs$current$area.isOpen)) {
@@ -280,7 +304,7 @@ function LayoutAreaSizingProvider(_ref) {
280
304
  });
281
305
  }
282
306
  };
283
- }, [dispatch, prepareResize]);
307
+ }, [dispatch, prepareResize, registerSplitter]);
284
308
  var SideNavStateProvider = _layoutAreaStateContexts.layoutAreaStateContexts['side-nav'].Provider;
285
309
  var PanelStateProvider = _layoutAreaStateContexts.layoutAreaStateContexts.panel.Provider;
286
310
  var ChatPanelStateProvider = _layoutAreaStateContexts.layoutAreaStateContexts['chat-panel'].Provider;
@@ -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
- preferredInlineWidth: width
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)}}