@atlaskit/navigation-system 10.7.1 → 10.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 10.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5dd6269af3c70`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5dd6269af3c70) -
|
|
8
|
+
Add an opt-in `maxWidth` to the `Panel` layout slot and preview panel `Panel` config, letting a
|
|
9
|
+
single consumer request a wider resize bound (e.g. `70vw`) than the default cap of half the
|
|
10
|
+
viewport width. Defaults are unchanged, so all existing consumers remain capped at the default.
|
|
11
|
+
|
|
12
|
+
**`@atlaskit/navigation-system`** — the `Panel` layout slot accepts a `maxWidth` (`vw`/`px`),
|
|
13
|
+
applied to both the rendered width and the resize bounds (mouse and keyboard):
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Panel } from '@atlaskit/navigation-system/layout/panel';
|
|
17
|
+
|
|
18
|
+
<Panel defaultWidth={600} maxWidth="70vw">
|
|
19
|
+
{/* ...panel content... */}
|
|
20
|
+
</Panel>;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**`@atlassian/preview-panels-api`** — the opened panel config takes the same `maxWidth`:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { usePreviewPanelsActions } from '@atlassian/preview-panels-api';
|
|
27
|
+
|
|
28
|
+
const { open } = usePreviewPanelsActions();
|
|
29
|
+
|
|
30
|
+
open({
|
|
31
|
+
panel: {
|
|
32
|
+
id: 'issue-123',
|
|
33
|
+
type: 'issue',
|
|
34
|
+
product: 'jira',
|
|
35
|
+
content: () => <IssuePreview />,
|
|
36
|
+
maxWidth: '70vw',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**`@atlassian/preview-panel-global-objects`** — `useGlobalObjectPreviewPanels` accepts a
|
|
42
|
+
`maxWidth` option that it forwards onto the panel it opens, so global-object preview panels
|
|
43
|
+
(Confluence page, goals, teams, CMDB object, etc.) share the same wider bound. Omitting it keeps
|
|
44
|
+
the default cap:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const previewPanels = useGlobalObjectPreviewPanels('jira', cloudId, { maxWidth: '70vw' });
|
|
48
|
+
```
|
|
49
|
+
|
|
3
50
|
## 10.7.1
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -67,7 +67,8 @@ function Panel(_ref) {
|
|
|
67
67
|
providedId = _ref.id,
|
|
68
68
|
xcss = _ref.xcss,
|
|
69
69
|
_ref$hasBorder = _ref.hasBorder,
|
|
70
|
-
hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder
|
|
70
|
+
hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder,
|
|
71
|
+
maxWidth = _ref.maxWidth;
|
|
71
72
|
var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
|
|
72
73
|
var id = (0, _useLayoutId.useLayoutId)({
|
|
73
74
|
providedId: providedId
|
|
@@ -166,20 +167,23 @@ function Panel(_ref) {
|
|
|
166
167
|
var _sideNavRef$current$o, _sideNavRef$current;
|
|
167
168
|
var sideNavWidth = (_sideNavRef$current$o = (_sideNavRef$current = sideNavRef.current) === null || _sideNavRef$current === void 0 ? void 0 : _sideNavRef$current.offsetWidth) !== null && _sideNavRef$current$o !== void 0 ? _sideNavRef$current$o : 0;
|
|
168
169
|
/**
|
|
169
|
-
*
|
|
170
|
+
* By default the panel should not resize larger than the page content, equivalent to the `Main` + `Aside` slots.
|
|
170
171
|
*
|
|
171
172
|
* This maximum width is equivalent to half the viewport width, after removing the sidebar width.
|
|
173
|
+
*
|
|
174
|
+
* Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
172
175
|
*/
|
|
173
|
-
var
|
|
176
|
+
var defaultMaxWidth = "".concat(Math.round((window.innerWidth - sideNavWidth) / 2), "px");
|
|
174
177
|
return {
|
|
175
178
|
min: "".concat(minWidth, "px"),
|
|
176
|
-
max:
|
|
179
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : defaultMaxWidth
|
|
177
180
|
};
|
|
178
|
-
}, [minWidth, sideNavRef]);
|
|
181
|
+
}, [maxWidth, minWidth, sideNavRef]);
|
|
179
182
|
var panelWidthSlotBounds = {
|
|
180
183
|
min: "".concat(minWidth, "px"),
|
|
181
184
|
// `sideNavLiveWidthVar` is not defined if the `SideNav` is not mounted, so we fallback to `0px`.
|
|
182
|
-
|
|
185
|
+
// Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
186
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : "round(nearest, calc((100vw - var(".concat(_constants.sideNavLiveWidthVar, ", 0px)) / 2), 1px)")
|
|
183
187
|
};
|
|
184
188
|
var panelVariableWidth = "clamp(".concat(panelWidthSlotBounds.min, ", ").concat(width, "px, ").concat(panelWidthSlotBounds.max, ")");
|
|
185
189
|
(0, _useResizingWidthCssVarOnRootElement.useResizingWidthCssVarOnRootElement)({
|
|
@@ -52,7 +52,8 @@ export function Panel({
|
|
|
52
52
|
testId,
|
|
53
53
|
id: providedId,
|
|
54
54
|
xcss,
|
|
55
|
-
hasBorder = true
|
|
55
|
+
hasBorder = true,
|
|
56
|
+
maxWidth
|
|
56
57
|
}) {
|
|
57
58
|
const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
58
59
|
const id = useLayoutId({
|
|
@@ -148,20 +149,23 @@ export function Panel({
|
|
|
148
149
|
var _sideNavRef$current$o, _sideNavRef$current;
|
|
149
150
|
const sideNavWidth = (_sideNavRef$current$o = (_sideNavRef$current = sideNavRef.current) === null || _sideNavRef$current === void 0 ? void 0 : _sideNavRef$current.offsetWidth) !== null && _sideNavRef$current$o !== void 0 ? _sideNavRef$current$o : 0;
|
|
150
151
|
/**
|
|
151
|
-
*
|
|
152
|
+
* By default the panel should not resize larger than the page content, equivalent to the `Main` + `Aside` slots.
|
|
152
153
|
*
|
|
153
154
|
* This maximum width is equivalent to half the viewport width, after removing the sidebar width.
|
|
155
|
+
*
|
|
156
|
+
* Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
154
157
|
*/
|
|
155
|
-
const
|
|
158
|
+
const defaultMaxWidth = `${Math.round((window.innerWidth - sideNavWidth) / 2)}px`;
|
|
156
159
|
return {
|
|
157
160
|
min: `${minWidth}px`,
|
|
158
|
-
max:
|
|
161
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : defaultMaxWidth
|
|
159
162
|
};
|
|
160
|
-
}, [minWidth, sideNavRef]);
|
|
163
|
+
}, [maxWidth, minWidth, sideNavRef]);
|
|
161
164
|
const panelWidthSlotBounds = {
|
|
162
165
|
min: `${minWidth}px`,
|
|
163
166
|
// `sideNavLiveWidthVar` is not defined if the `SideNav` is not mounted, so we fallback to `0px`.
|
|
164
|
-
|
|
167
|
+
// Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
168
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : `round(nearest, calc((100vw - var(${sideNavLiveWidthVar}, 0px)) / 2), 1px)`
|
|
165
169
|
};
|
|
166
170
|
const panelVariableWidth = `clamp(${panelWidthSlotBounds.min}, ${width}px, ${panelWidthSlotBounds.max})`;
|
|
167
171
|
useResizingWidthCssVarOnRootElement({
|
|
@@ -58,7 +58,8 @@ export function Panel(_ref) {
|
|
|
58
58
|
providedId = _ref.id,
|
|
59
59
|
xcss = _ref.xcss,
|
|
60
60
|
_ref$hasBorder = _ref.hasBorder,
|
|
61
|
-
hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder
|
|
61
|
+
hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder,
|
|
62
|
+
maxWidth = _ref.maxWidth;
|
|
62
63
|
var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
63
64
|
var id = useLayoutId({
|
|
64
65
|
providedId: providedId
|
|
@@ -157,20 +158,23 @@ export function Panel(_ref) {
|
|
|
157
158
|
var _sideNavRef$current$o, _sideNavRef$current;
|
|
158
159
|
var sideNavWidth = (_sideNavRef$current$o = (_sideNavRef$current = sideNavRef.current) === null || _sideNavRef$current === void 0 ? void 0 : _sideNavRef$current.offsetWidth) !== null && _sideNavRef$current$o !== void 0 ? _sideNavRef$current$o : 0;
|
|
159
160
|
/**
|
|
160
|
-
*
|
|
161
|
+
* By default the panel should not resize larger than the page content, equivalent to the `Main` + `Aside` slots.
|
|
161
162
|
*
|
|
162
163
|
* This maximum width is equivalent to half the viewport width, after removing the sidebar width.
|
|
164
|
+
*
|
|
165
|
+
* Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
163
166
|
*/
|
|
164
|
-
var
|
|
167
|
+
var defaultMaxWidth = "".concat(Math.round((window.innerWidth - sideNavWidth) / 2), "px");
|
|
165
168
|
return {
|
|
166
169
|
min: "".concat(minWidth, "px"),
|
|
167
|
-
max:
|
|
170
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : defaultMaxWidth
|
|
168
171
|
};
|
|
169
|
-
}, [minWidth, sideNavRef]);
|
|
172
|
+
}, [maxWidth, minWidth, sideNavRef]);
|
|
170
173
|
var panelWidthSlotBounds = {
|
|
171
174
|
min: "".concat(minWidth, "px"),
|
|
172
175
|
// `sideNavLiveWidthVar` is not defined if the `SideNav` is not mounted, so we fallback to `0px`.
|
|
173
|
-
|
|
176
|
+
// Consumers can opt in to a larger maximum via the `maxWidth` prop.
|
|
177
|
+
max: maxWidth !== null && maxWidth !== void 0 ? maxWidth : "round(nearest, calc((100vw - var(".concat(sideNavLiveWidthVar, ", 0px)) / 2), 1px)")
|
|
174
178
|
};
|
|
175
179
|
var panelVariableWidth = "clamp(".concat(panelWidthSlotBounds.min, ", ").concat(width, "px, ").concat(panelWidthSlotBounds.max, ")");
|
|
176
180
|
useResizingWidthCssVarOnRootElement({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrictXCSSProp } from '@atlaskit/css';
|
|
2
|
+
import type { ResizeBound } from './panel-splitter/types';
|
|
2
3
|
import type { CommonSlotProps } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* The Panel layout area is rendered to the right (inline end) of the Main area, or the Aside area if it is present.
|
|
@@ -7,7 +8,7 @@ import type { CommonSlotProps } from './types';
|
|
|
7
8
|
*
|
|
8
9
|
* You can optionally render a `PanelSplitter` as a child to make the panel area resizable.
|
|
9
10
|
*/
|
|
10
|
-
export declare function Panel({ children, defaultWidth: defaultWidthProp, label, skipLinkLabel, testId, id: providedId, xcss, hasBorder, }: CommonSlotProps & {
|
|
11
|
+
export declare function Panel({ children, defaultWidth: defaultWidthProp, label, skipLinkLabel, testId, id: providedId, xcss, hasBorder, maxWidth, }: CommonSlotProps & {
|
|
11
12
|
/**
|
|
12
13
|
* The content of the layout area.
|
|
13
14
|
*/
|
|
@@ -25,6 +26,18 @@ export declare function Panel({ children, defaultWidth: defaultWidthProp, label,
|
|
|
25
26
|
* in which case `400px` will be used as the minimum resizing width instead.
|
|
26
27
|
*/
|
|
27
28
|
defaultWidth?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Opt-in override for the maximum width the panel can be resized to, applied to both the rendered
|
|
31
|
+
* width and the resize bounds (mouse and keyboard).
|
|
32
|
+
*
|
|
33
|
+
* When omitted, the panel defaults to half the viewport width (after removing the sidebar width),
|
|
34
|
+
* which keeps it from growing larger than the page content. Provide a `vw` or `px` value (e.g.
|
|
35
|
+
* `'70vw'`) to allow a wider panel.
|
|
36
|
+
*
|
|
37
|
+
* This is currently used by Jira's Issue Navigator native issue preview panel; other consumers
|
|
38
|
+
* should leave it unset to keep the default cap.
|
|
39
|
+
*/
|
|
40
|
+
maxWidth?: ResizeBound;
|
|
28
41
|
/**
|
|
29
42
|
* Bounded style overrides.
|
|
30
43
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.8.0",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"@atlaskit/platform-feature-flags-react": "^1.1.0",
|
|
68
68
|
"@atlaskit/popup": "^5.1.0",
|
|
69
69
|
"@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
|
|
70
|
-
"@atlaskit/primitives": "^22.
|
|
70
|
+
"@atlaskit/primitives": "^22.2.0",
|
|
71
71
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
72
72
|
"@atlaskit/side-nav-items": "^2.3.0",
|
|
73
|
-
"@atlaskit/tokens": "^16.
|
|
73
|
+
"@atlaskit/tokens": "^16.3.0",
|
|
74
74
|
"@atlaskit/tooltip": "^23.1.0",
|
|
75
75
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
76
76
|
"@babel/runtime": "^7.0.0",
|