@atlaskit/navigation-system 11.0.0 → 11.1.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/entry-points/layout/chat-panel.js +12 -0
  3. package/dist/cjs/entry-points/layout/layout-sizing.js +44 -0
  4. package/dist/cjs/ui/page-layout/calculate-layout-area-states.js +179 -0
  5. package/dist/cjs/ui/page-layout/chat-panel.compiled.css +27 -0
  6. package/dist/cjs/ui/page-layout/chat-panel.js +216 -0
  7. package/dist/cjs/ui/page-layout/constants.js +6 -1
  8. package/dist/cjs/ui/page-layout/layout-area-sizing-context.js +13 -0
  9. package/dist/cjs/ui/page-layout/layout-area-sizing-provider.js +304 -0
  10. package/dist/cjs/ui/page-layout/layout-area-state-contexts.js +13 -0
  11. package/dist/cjs/ui/page-layout/main/main.js +11 -2
  12. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +73 -7
  13. package/dist/cjs/ui/page-layout/panel-splitter/provider.js +7 -1
  14. package/dist/cjs/ui/page-layout/resolve-layout-width.js +13 -0
  15. package/dist/cjs/ui/page-layout/ribbon.js +1 -0
  16. package/dist/cjs/ui/page-layout/root.compiled.css +4 -2
  17. package/dist/cjs/ui/page-layout/root.js +10 -4
  18. package/dist/cjs/ui/page-layout/side-nav/side-nav.compiled.css +2 -1
  19. package/dist/cjs/ui/page-layout/side-nav/side-nav.js +152 -14
  20. package/dist/cjs/ui/page-layout/use-layout-area-sizing.js +73 -0
  21. package/dist/cjs/ui/page-layout/use-layout-main-sizing.js +15 -0
  22. package/dist/cjs/ui/page-layout/use-occupied-layout-width.js +111 -0
  23. package/dist/es2019/entry-points/layout/chat-panel.js +1 -0
  24. package/dist/es2019/entry-points/layout/layout-sizing.js +3 -0
  25. package/dist/es2019/ui/page-layout/calculate-layout-area-states.js +128 -0
  26. package/dist/es2019/ui/page-layout/chat-panel.compiled.css +27 -0
  27. package/dist/es2019/ui/page-layout/chat-panel.js +199 -0
  28. package/dist/es2019/ui/page-layout/constants.js +5 -0
  29. package/dist/es2019/ui/page-layout/layout-area-sizing-context.js +8 -0
  30. package/dist/es2019/ui/page-layout/layout-area-sizing-provider.js +279 -0
  31. package/dist/es2019/ui/page-layout/layout-area-state-contexts.js +7 -0
  32. package/dist/es2019/ui/page-layout/main/main.js +10 -2
  33. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +68 -8
  34. package/dist/es2019/ui/page-layout/panel-splitter/provider.js +7 -1
  35. package/dist/es2019/ui/page-layout/resolve-layout-width.js +7 -0
  36. package/dist/es2019/ui/page-layout/ribbon.js +1 -0
  37. package/dist/es2019/ui/page-layout/root.compiled.css +4 -2
  38. package/dist/es2019/ui/page-layout/root.js +10 -4
  39. package/dist/es2019/ui/page-layout/side-nav/side-nav.compiled.css +2 -1
  40. package/dist/es2019/ui/page-layout/side-nav/side-nav.js +142 -14
  41. package/dist/es2019/ui/page-layout/use-layout-area-sizing.js +58 -0
  42. package/dist/es2019/ui/page-layout/use-layout-main-sizing.js +7 -0
  43. package/dist/es2019/ui/page-layout/use-occupied-layout-width.js +67 -0
  44. package/dist/esm/entry-points/layout/chat-panel.js +1 -0
  45. package/dist/esm/entry-points/layout/layout-sizing.js +3 -0
  46. package/dist/esm/ui/page-layout/calculate-layout-area-states.js +173 -0
  47. package/dist/esm/ui/page-layout/chat-panel.compiled.css +27 -0
  48. package/dist/esm/ui/page-layout/chat-panel.js +207 -0
  49. package/dist/esm/ui/page-layout/constants.js +5 -0
  50. package/dist/esm/ui/page-layout/layout-area-sizing-context.js +8 -0
  51. package/dist/esm/ui/page-layout/layout-area-sizing-provider.js +295 -0
  52. package/dist/esm/ui/page-layout/layout-area-state-contexts.js +7 -0
  53. package/dist/esm/ui/page-layout/main/main.js +11 -2
  54. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +74 -8
  55. package/dist/esm/ui/page-layout/panel-splitter/provider.js +7 -1
  56. package/dist/esm/ui/page-layout/resolve-layout-width.js +7 -0
  57. package/dist/esm/ui/page-layout/ribbon.js +1 -0
  58. package/dist/esm/ui/page-layout/root.compiled.css +4 -2
  59. package/dist/esm/ui/page-layout/root.js +10 -4
  60. package/dist/esm/ui/page-layout/side-nav/side-nav.compiled.css +2 -1
  61. package/dist/esm/ui/page-layout/side-nav/side-nav.js +153 -15
  62. package/dist/esm/ui/page-layout/use-layout-area-sizing.js +67 -0
  63. package/dist/esm/ui/page-layout/use-layout-main-sizing.js +9 -0
  64. package/dist/esm/ui/page-layout/use-occupied-layout-width.js +105 -0
  65. package/dist/types/entry-points/layout/chat-panel.d.ts +1 -0
  66. package/dist/types/entry-points/layout/layout-sizing.d.ts +4 -0
  67. package/dist/types/ui/page-layout/calculate-layout-area-states.d.ts +20 -0
  68. package/dist/types/ui/page-layout/chat-panel.d.ts +48 -0
  69. package/dist/types/ui/page-layout/constants.d.ts +4 -0
  70. package/dist/types/ui/page-layout/layout-area-sizing-context.d.ts +55 -0
  71. package/dist/types/ui/page-layout/layout-area-sizing-provider.d.ts +5 -0
  72. package/dist/types/ui/page-layout/layout-area-state-contexts.d.ts +3 -0
  73. package/dist/types/ui/page-layout/main/main.d.ts +5 -1
  74. package/dist/types/ui/page-layout/panel-splitter/panel-splitter-context.d.ts +15 -1
  75. package/dist/types/ui/page-layout/panel-splitter/provider.d.ts +1 -1
  76. package/dist/types/ui/page-layout/resolve-layout-width.d.ts +2 -0
  77. package/dist/types/ui/page-layout/side-nav/side-nav.d.ts +11 -2
  78. package/dist/types/ui/page-layout/use-layout-area-sizing.d.ts +12 -0
  79. package/dist/types/ui/page-layout/use-layout-main-sizing.d.ts +2 -0
  80. package/dist/types/ui/page-layout/use-occupied-layout-width.d.ts +8 -0
  81. package/layout/chat-panel/package.json +10 -0
  82. package/layout/layout-sizing/package.json +10 -0
  83. package/package.json +11 -3
@@ -1,6 +1,6 @@
1
1
  import { type MutableRefObject } from 'react';
2
2
  import type { TooltipProps } from '@atlaskit/tooltip/types';
3
- import { type ResizeBounds } from './types';
3
+ import { type ResizeBounds, type ResizeStartCallback } from './types';
4
4
  export type PanelSplitterContextType = {
5
5
  /**
6
6
  * An optional identifier for the panel splitter, which is attached to the `pragmatic-drag-and-drop` drag data.
@@ -10,6 +10,12 @@ export type PanelSplitterContextType = {
10
10
  * A ref to the page layout element that will be resized by the splitter.
11
11
  */
12
12
  panelRef: MutableRefObject<HTMLDivElement | null>;
13
+ /**
14
+ * An optional additional element that receives the temporary resizing CSS variable.
15
+ *
16
+ * This is useful when an ancestor owns the layout track that contains the resized panel.
17
+ */
18
+ resizingElementRef?: MutableRefObject<HTMLDivElement | null>;
13
19
  /**
14
20
  * The "saved" width of the panel element. Used to calculate the new width of the panel when dragging.
15
21
  */
@@ -18,6 +24,14 @@ export type PanelSplitterContextType = {
18
24
  * Called when the user finishes resizing the panel. It should update the width of the panel element.
19
25
  */
20
26
  onCompleteResize: (newWidth: number) => void;
27
+ /**
28
+ * Called internally when pointer resizing starts, before the first live width is applied.
29
+ */
30
+ onResizeStartInternal?: ResizeStartCallback;
31
+ /**
32
+ * Called with the unconstrained live pointer width while dragging.
33
+ */
34
+ onResizeInternal?: (newWidth: number) => void;
21
35
  /**
22
36
  * The minimum and maximum bounds for resizing the panel.
23
37
  * The bounds can be provided as `px` or `vw` values.
@@ -25,4 +25,4 @@ export type PanelSplitterProviderProps = Omit<PanelSplitterContextType, 'portalR
25
25
  *
26
26
  * Should be used in the layout area components, e.g. SideNav, Aside etc, as opposed to products.
27
27
  */
28
- export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, panelRef, portalRef: providedPortalRef, position, isEnabled, shortcut, children, }: PanelSplitterProviderProps) => React.JSX.Element;
28
+ export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, onResizeStartInternal, onResizeInternal, getResizeBounds, resizingCssVar, panelRef, resizingElementRef, portalRef: providedPortalRef, position, isEnabled, shortcut, children, }: PanelSplitterProviderProps) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { LayoutWidthBound } from './layout-area-sizing-context';
2
+ export declare function resolveLayoutWidth(bound: LayoutWidthBound, viewportWidth: number): number;
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import React from 'react';
6
+ import type { ResizeBound } from '../panel-splitter/types';
6
7
  import type { CommonSlotProps } from '../types';
7
8
  import { type VisibilityCallback } from './use-side-nav-visibility-callbacks';
8
9
  type SideNavProps = CommonSlotProps & {
@@ -39,13 +40,21 @@ type SideNavProps = CommonSlotProps & {
39
40
  /**
40
41
  * The default width of the side nav layout area.
41
42
  *
42
- * It should be an integer between the resize bounds - the minimum is 240px and the maximum is 50% of the viewport width.
43
+ * It should be an integer greater than or equal to the minimum width.
43
44
  *
44
45
  * It is only used when the side nav is first mounted, but you should continuously update your
45
46
  * persisted state using the `onResizeEnd` callback of `PanelSplitter`, to ensure it is up to date
46
47
  * when the app is reloaded.
47
48
  */
48
49
  defaultWidth?: number;
50
+ /**
51
+ * Minimum width used when fitting the side nav inline.
52
+ */
53
+ minWidth?: ResizeBound;
54
+ /**
55
+ * Optional maximum width for both inline and overlay resizing.
56
+ */
57
+ maxWidth?: ResizeBound;
49
58
  /**
50
59
  * Called when the side nav is expanded.
51
60
  */
@@ -86,7 +95,7 @@ export declare const onPeekStartDelayMs = 500;
86
95
  *
87
96
  * You can optionally render a `PanelSplitter` as a child to make the side navigation slot resizable.
88
97
  */
89
- export declare function SideNav({ children, defaultCollapsed, defaultWidth, testId, label, // Default value is defined in `SideNavInternal`
98
+ export declare function SideNav({ children, defaultCollapsed, defaultWidth, minWidth, maxWidth, testId, label, // Default value is defined in `SideNavInternal`
90
99
  skipLinkLabel, // Default value is defined in `SideNavInternal`
91
100
  onExpand, onCollapse, onPeekStart, onPeekEnd, canToggleWithShortcut, id, }: SideNavProps): JSX.Element;
92
101
  export {};
@@ -0,0 +1,12 @@
1
+ import { type LayoutArea, type LayoutAreaConfig, type LayoutAreaMode, type LayoutAreaState } from './layout-area-sizing-context';
2
+ import type { ResizeBounds } from './panel-splitter/types';
3
+ export declare function useLayoutAreaSizing({ area, config, }: {
4
+ area: LayoutArea;
5
+ config: LayoutAreaConfig;
6
+ }): {
7
+ state: LayoutAreaState | undefined;
8
+ getResizeBounds: () => ResizeBounds | undefined;
9
+ startResize: (mode: LayoutAreaMode) => void;
10
+ resize: (mode: LayoutAreaMode, width: number) => void;
11
+ completeResize: (mode: LayoutAreaMode, width: number) => void;
12
+ };
@@ -0,0 +1,2 @@
1
+ import { type LayoutWidthBound } from './layout-area-sizing-context';
2
+ export declare function useLayoutMainSizing(minWidth: LayoutWidthBound): void;
@@ -0,0 +1,8 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Measures the existing Root slots that are not managed by the chat-layout allocator.
4
+ * Only count separate inline columns: Aside stacks below Main on mobile, and the
5
+ * legacy Panel spans other areas while overlaying. Read the grid rather than duplicating
6
+ * its responsive breakpoints. Border boxes include slot borders and live splitter widths.
7
+ */
8
+ export declare function useOccupiedLayoutWidth(layoutRef?: RefObject<HTMLDivElement | null>): number;
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/navigation-system/layout/chat-panel",
3
+ "main": "../../dist/cjs/entry-points/layout/chat-panel.js",
4
+ "module": "../../dist/esm/entry-points/layout/chat-panel.js",
5
+ "module:es2019": "../../dist/es2019/entry-points/layout/chat-panel.js",
6
+ "sideEffects": [
7
+ "*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/entry-points/layout/chat-panel.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/navigation-system/layout/layout-sizing",
3
+ "main": "../../dist/cjs/entry-points/layout/layout-sizing.js",
4
+ "module": "../../dist/esm/entry-points/layout/layout-sizing.js",
5
+ "module:es2019": "../../dist/es2019/entry-points/layout/layout-sizing.js",
6
+ "sideEffects": [
7
+ "*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/entry-points/layout/layout-sizing.d.ts"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "The latest navigation system for Atlassian apps.",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
6
6
  "license": "Apache-2.0",
@@ -69,7 +69,7 @@
69
69
  "@atlaskit/motion": "^9.0.0",
70
70
  "@atlaskit/platform-feature-flags": "^2.2.0",
71
71
  "@atlaskit/platform-feature-flags-react": "^1.2.0",
72
- "@atlaskit/popup": "^8.0.0",
72
+ "@atlaskit/popup": "^8.1.0",
73
73
  "@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
74
74
  "@atlaskit/primitives": "^22.5.0",
75
75
  "@atlaskit/react-compiler-gating": "^0.2.0",
@@ -119,6 +119,9 @@
119
119
  "@atlaskit/top-layer": "^6.0.0",
120
120
  "@atlassian/feature-flags-test-utils": "^1.3.0",
121
121
  "@atlassian/gemini": "^1.54.0",
122
+ "@atlassian/panel-system": "^1.12.0",
123
+ "@atlassian/react-async": "^0.23.0",
124
+ "@atlassian/react-entrypoint": "^1.1.0",
122
125
  "@atlassian/search-dialog": "^10.18.0",
123
126
  "@atlassian/ssr-tests": "workspace:^",
124
127
  "@atlassian/test-utils": "^1.1.0",
@@ -127,9 +130,14 @@
127
130
  "@axe-core/playwright": "^4.11.1",
128
131
  "raf-stub": "^2.0.1",
129
132
  "react": "^18.2.0",
130
- "react-dom": "^18.2.0"
133
+ "react-dom": "^18.2.0",
134
+ "react-relay": "^20.1.1",
135
+ "relay-test-utils": "^20.1.1"
131
136
  },
132
137
  "platform-feature-flags": {
138
+ "platform-dst-chat-panel-layout": {
139
+ "type": "boolean"
140
+ },
133
141
  "platform-dst-tokens-finesse": {
134
142
  "type": "boolean"
135
143
  },