@atlaskit/navigation-system 11.4.3 → 11.6.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 +24 -0
- package/constellation/layout/code.mdx +28 -0
- package/dist/cjs/entry-points/top-nav-items/responsive-button.js +12 -0
- package/dist/cjs/ui/page-layout/top-nav/top-nav-element-context.js +9 -0
- package/dist/cjs/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
- package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +52 -15
- package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.js +4 -2
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
- package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +6 -2
- package/dist/cjs/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
- package/dist/cjs/ui/page-layout/top-nav/top-nav.js +75 -7
- package/dist/cjs/ui/page-layout/top-nav/use-is-compact-top-nav.js +16 -0
- package/dist/cjs/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +77 -0
- package/dist/cjs/ui/page-layout/top-nav/use-top-nav-breakpoints.js +20 -0
- package/dist/cjs/ui/page-layout/top-nav/use-top-nav-end-focus.js +102 -0
- package/dist/cjs/ui/top-nav-items/create-button.js +16 -1
- package/dist/cjs/ui/top-nav-items/custom-title.compiled.css +2 -1
- package/dist/cjs/ui/top-nav-items/custom-title.js +6 -3
- package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
- package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.js +4 -2
- package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
- package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
- package/dist/cjs/ui/top-nav-items/responsive-button.js +38 -0
- package/dist/cjs/ui/top-nav-items/search.compiled.css +34 -2
- package/dist/cjs/ui/top-nav-items/search.js +106 -11
- package/dist/cjs/ui/top-nav-items/themed/icon-button.js +24 -4
- package/dist/cjs/ui/top-nav-items/themed/responsive-icon-button.compiled.css +18 -0
- package/dist/cjs/ui/top-nav-items/themed/responsive-icon-button.js +33 -0
- package/dist/cjs/ui/top-nav-items/themed/themed-icon-button.compiled.css +1 -0
- package/dist/cjs/ui/top-nav-items/themed/themed-icon-button.js +68 -55
- package/dist/cjs/ui/top-nav-items/themed/themed-pressable.compiled.css +1 -1
- package/dist/cjs/ui/top-nav-items/themed/themed-pressable.js +1 -1
- package/dist/es2019/entry-points/top-nav-items/responsive-button.js +1 -0
- package/dist/es2019/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
- package/dist/es2019/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
- package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +53 -14
- package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.js +4 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +6 -2
- package/dist/es2019/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
- package/dist/es2019/ui/page-layout/top-nav/top-nav.js +54 -8
- package/dist/es2019/ui/page-layout/top-nav/use-is-compact-top-nav.js +11 -0
- package/dist/es2019/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +50 -0
- package/dist/es2019/ui/page-layout/top-nav/use-top-nav-breakpoints.js +15 -0
- package/dist/es2019/ui/page-layout/top-nav/use-top-nav-end-focus.js +97 -0
- package/dist/es2019/ui/top-nav-items/create-button.js +16 -1
- package/dist/es2019/ui/top-nav-items/custom-title.compiled.css +2 -1
- package/dist/es2019/ui/top-nav-items/custom-title.js +6 -3
- package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
- package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.js +4 -2
- package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
- package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
- package/dist/es2019/ui/top-nav-items/responsive-button.js +27 -0
- package/dist/es2019/ui/top-nav-items/search.compiled.css +34 -2
- package/dist/es2019/ui/top-nav-items/search.js +105 -10
- package/dist/es2019/ui/top-nav-items/themed/icon-button.js +23 -4
- package/dist/es2019/ui/top-nav-items/themed/responsive-icon-button.compiled.css +18 -0
- package/dist/es2019/ui/top-nav-items/themed/responsive-icon-button.js +26 -0
- package/dist/es2019/ui/top-nav-items/themed/themed-icon-button.compiled.css +1 -0
- package/dist/es2019/ui/top-nav-items/themed/themed-icon-button.js +63 -51
- package/dist/es2019/ui/top-nav-items/themed/themed-pressable.compiled.css +1 -1
- package/dist/es2019/ui/top-nav-items/themed/themed-pressable.js +1 -1
- package/dist/esm/entry-points/top-nav-items/responsive-button.js +1 -0
- package/dist/esm/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
- package/dist/esm/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
- package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +53 -15
- package/dist/esm/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav-middle.js +4 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +6 -2
- package/dist/esm/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
- package/dist/esm/ui/page-layout/top-nav/top-nav.js +75 -8
- package/dist/esm/ui/page-layout/top-nav/use-is-compact-top-nav.js +11 -0
- package/dist/esm/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +70 -0
- package/dist/esm/ui/page-layout/top-nav/use-top-nav-breakpoints.js +15 -0
- package/dist/esm/ui/page-layout/top-nav/use-top-nav-end-focus.js +96 -0
- package/dist/esm/ui/top-nav-items/create-button.js +16 -1
- package/dist/esm/ui/top-nav-items/custom-title.compiled.css +2 -1
- package/dist/esm/ui/top-nav-items/custom-title.js +6 -3
- package/dist/esm/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
- package/dist/esm/ui/top-nav-items/nav-logo/app-logo.js +4 -2
- package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
- package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
- package/dist/esm/ui/top-nav-items/responsive-button.js +29 -0
- package/dist/esm/ui/top-nav-items/search.compiled.css +34 -2
- package/dist/esm/ui/top-nav-items/search.js +107 -11
- package/dist/esm/ui/top-nav-items/themed/icon-button.js +24 -4
- package/dist/esm/ui/top-nav-items/themed/responsive-icon-button.compiled.css +18 -0
- package/dist/esm/ui/top-nav-items/themed/responsive-icon-button.js +26 -0
- package/dist/esm/ui/top-nav-items/themed/themed-icon-button.compiled.css +1 -0
- package/dist/esm/ui/top-nav-items/themed/themed-icon-button.js +68 -55
- package/dist/esm/ui/top-nav-items/themed/themed-pressable.compiled.css +1 -1
- package/dist/esm/ui/top-nav-items/themed/themed-pressable.js +1 -1
- package/dist/types/entry-points/top-nav-items/responsive-button.d.ts +1 -0
- package/dist/types/ui/page-layout/top-nav/top-nav-element-context.d.ts +9 -0
- package/dist/types/ui/page-layout/top-nav/top-nav-end.d.ts +1 -0
- package/dist/types/ui/page-layout/top-nav/use-is-compact-top-nav.d.ts +6 -0
- package/dist/types/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.d.ts +2 -0
- package/dist/types/ui/page-layout/top-nav/use-top-nav-breakpoints.d.ts +11 -0
- package/dist/types/ui/page-layout/top-nav/use-top-nav-end-focus.d.ts +12 -0
- package/dist/types/ui/top-nav-items/create-button.d.ts +2 -0
- package/dist/types/ui/top-nav-items/responsive-button.d.ts +23 -0
- package/dist/types/ui/top-nav-items/themed/icon-button.d.ts +1 -5
- package/dist/types/ui/top-nav-items/themed/responsive-icon-button.d.ts +10 -0
- package/dist/types/ui/top-nav-items/themed/themed-icon-button.d.ts +8 -0
- package/package.json +8 -7
- package/top-nav-items/responsive-button/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 11.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8cded96236762`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8cded96236762) -
|
|
8
|
+
Add `ResponsiveTopNavButton` and make placeholder Create icon-only below 48rem of TopNav container
|
|
9
|
+
width, behind `platform-dst-chat-panel-layout`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 11.5.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`872ac4f53e5e9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/872ac4f53e5e9) -
|
|
20
|
+
Make TopNav layout, Search and action overflow respond to container width, behind
|
|
21
|
+
`platform-dst-chat-panel-layout`.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 11.4.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -17,6 +17,7 @@ props:
|
|
|
17
17
|
- SideNavFooter
|
|
18
18
|
- Main
|
|
19
19
|
- MainStickyHeader
|
|
20
|
+
- PanelLayout
|
|
20
21
|
- Panel
|
|
21
22
|
- PanelSplitter
|
|
22
23
|
- SideNavToggleButton
|
|
@@ -102,6 +103,33 @@ The sticky header of the main layout area.
|
|
|
102
103
|
|
|
103
104
|
<TSMorphProps exportName="MainStickyHeader" packageName="@atlaskit/navigation-system" />
|
|
104
105
|
|
|
106
|
+
### PanelLayout
|
|
107
|
+
|
|
108
|
+
Use `PanelLayout` to render a local panel beside page content inside `Main`. It manages responsive
|
|
109
|
+
inline and overlay positioning, sizing, and pointer and keyboard resizing. The caller supplies the
|
|
110
|
+
panel content and controls whether it is open; no panel-system provider is required.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { PanelLayout } from '@atlaskit/navigation-system/layout/panel-layout';
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Mount one local-panel host per navigation `Root`, including closed `PanelLayout` and
|
|
117
|
+
`LayoutWithPanel` instances. Keep the host mounted and use `isPanelOpen` to open or close it so that
|
|
118
|
+
resized widths are retained. Switch content through the same host using `panel` and `panelKey`.
|
|
119
|
+
|
|
120
|
+
Use `defaultPanelWidth` for an initial width, or pair `panelWidth` with `onPanelWidthChange` to
|
|
121
|
+
control it. Available space can constrain the rendered width. Use `onResizeEnd` for persistence or
|
|
122
|
+
analytics after a completed resize, and provide localized `panelLabel` and `resizeLabel` values.
|
|
123
|
+
|
|
124
|
+
`PanelLayout` contains the layout and resizing responsibilities extracted from
|
|
125
|
+
`@atlassian/panel-system`. That package's `LayoutWithPanel` remains an adapter that connects panel
|
|
126
|
+
state and routed content to `PanelLayout`.
|
|
127
|
+
|
|
128
|
+
The separate [`Panel`](#panel) component is a layout area rendered alongside `Main` under `Root`.
|
|
129
|
+
`PanelLayout` wraps content inside `Main` and includes its own resize control.
|
|
130
|
+
|
|
131
|
+
<TSMorphProps exportName="PanelLayout" packageName="@atlaskit/navigation-system" />
|
|
132
|
+
|
|
105
133
|
### Panel
|
|
106
134
|
|
|
107
135
|
The Panel layout area is rendered to the right (inline end) of the Main area. On small viewports,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ResponsiveTopNavButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _responsiveButton.ResponsiveButton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _responsiveButton = require("../../ui/top-nav-items/responsive-button");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TopNavElementContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
// Null outside a gated TopNav: consumers retain their viewport-based behaviour.
|
|
9
|
+
var TopNavElementContext = exports.TopNavElementContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
._1yt4u2gc{padding:var(--ds-space-100,8px)}
|
|
2
2
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
3
|
-
.
|
|
3
|
+
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
4
|
+
._yyhy11wp{grid-column:3}._10fph9n0{justify-self:end}
|
|
5
|
+
._1bahh9n0{justify-content:end}
|
|
6
|
+
._1bsb14ik{width:var(--n_tnSideWidth,auto)}
|
|
7
|
+
._1e0c1bgi{display:contents}
|
|
8
|
+
._1e0c1cgg{display:var(--n_tnActionsDisplay,none)}
|
|
4
9
|
._1e0c1txw{display:flex}
|
|
5
10
|
._1e0cglyw{display:none}
|
|
11
|
+
._1ul98ox3{min-width:var(--n_tnEndMinWidth,2pc)}
|
|
6
12
|
._1ul9zwfg{min-width:2pc}
|
|
7
13
|
._4cvr1h6o{align-items:center}
|
|
8
|
-
|
|
9
|
-
@media (min-width:
|
|
14
|
+
._vchhusvi{box-sizing:border-box}
|
|
15
|
+
@media (min-width:48rem){._181n1txw{display:flex}._181nz5ha{display:var(--n_tnActionsDisplay,flex)}._1d2y1ris{min-width:max-content}._1d2yioy8{min-width:var(--n_tnEndMinWidth,max-content)}}
|
|
16
|
+
@media (min-width:64rem){._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._ndwch9n0{justify-self:end}._gltexl30{width:var(--n_tnSideWidth,max-content)}._15riwpqv{min-width:var(--n_tnEndMinWidth,330px)}}
|
|
@@ -13,6 +13,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _react2 = require("@compiled/react");
|
|
16
|
+
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
16
17
|
var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
|
|
17
18
|
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
18
19
|
var _openLayerObserverNamespaceProvider = require("@atlaskit/layering/open-layer-observer-namespace-provider");
|
|
@@ -23,13 +24,20 @@ var _list = require("../../../components/list");
|
|
|
23
24
|
var _hasCustomThemeContext = require("../../top-nav-items/themed/has-custom-theme-context");
|
|
24
25
|
var _iconButton = require("../../top-nav-items/themed/icon-button");
|
|
25
26
|
var _constants = require("../constants");
|
|
27
|
+
var _useTopNavBreakpoints = require("./use-top-nav-breakpoints");
|
|
28
|
+
var _useTopNavEndFocus2 = require("./use-top-nav-end-focus");
|
|
26
29
|
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); }
|
|
30
|
+
// Compiled supports the inherited container-layout widths outside @atlaskit/css's bounded values.
|
|
27
31
|
var containerStyles = {
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
focusScope: "_1e0c1bgi",
|
|
33
|
+
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg",
|
|
34
|
+
withPersistentItems: "_zulpu2gc _4cvr1h6o",
|
|
35
|
+
container: "_1bsb14ik _1ul98ox3 _vchhusvi _10fph9n0 _1d2yioy8 _gltexl30 _15riwpqv",
|
|
36
|
+
viewport: "_1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0"
|
|
30
37
|
};
|
|
31
38
|
var listStyles = {
|
|
32
39
|
root: "_zulp1b66 _4cvr1h6o _1e0c1txw",
|
|
40
|
+
container: "_1e0c1cgg _181nz5ha",
|
|
33
41
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
34
42
|
popupContainer: "_1yt4u2gc"
|
|
35
43
|
};
|
|
@@ -43,12 +51,15 @@ var listStyles = {
|
|
|
43
51
|
* This is to prevent the actions from overflowing the top navigation.
|
|
44
52
|
*/
|
|
45
53
|
function TopNavEnd(_ref) {
|
|
54
|
+
var _breakpoints$belowSm;
|
|
46
55
|
var children = _ref.children,
|
|
47
56
|
persistentItems = _ref.persistentItems,
|
|
48
57
|
_ref$label = _ref.label,
|
|
49
58
|
label = _ref$label === void 0 ? 'Actions' : _ref$label,
|
|
50
59
|
_ref$showMoreButtonLa = _ref.showMoreButtonLabel,
|
|
51
60
|
showMoreButtonLabel = _ref$showMoreButtonLa === void 0 ? 'Show more' : _ref$showMoreButtonLa;
|
|
61
|
+
var breakpoints = (0, _useTopNavBreakpoints.useTopNavBreakpoints)();
|
|
62
|
+
var hasContainerBreakpoints = breakpoints != null;
|
|
52
63
|
var hasPersistentItems = (0, _fg.fg)('platform-dst-chat-panel-layout') && persistentItems != null;
|
|
53
64
|
var _useState = (0, _react.useState)(false),
|
|
54
65
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -57,21 +68,40 @@ function TopNavEnd(_ref) {
|
|
|
57
68
|
// Always setting to `false` for the initial render (will flip in an effect for mobile)
|
|
58
69
|
var _useState3 = (0, _react.useState)(false),
|
|
59
70
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
isMobileViewport = _useState4[0],
|
|
72
|
+
setIsMobileViewport = _useState4[1];
|
|
62
73
|
// Note: `query` is a stable value between renders
|
|
63
74
|
var query = (0, _useMediaQuery.UNSAFE_useMediaQuery)('below.sm', function onChange(event) {
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
75
|
+
setIsMobileViewport(event.matches);
|
|
76
|
+
// Container mode closes only when the effective layout changes below.
|
|
77
|
+
// Keep the existing viewport behavior outside the rollout / provider.
|
|
78
|
+
if ((0, _fg.fg)('platform-dst-chat-panel-layout')) {
|
|
79
|
+
if (!hasContainerBreakpoints) {
|
|
80
|
+
setIsOpen(false);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
setIsOpen(false);
|
|
84
|
+
}
|
|
68
85
|
});
|
|
69
86
|
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
70
87
|
var _query$matches;
|
|
71
88
|
// The default is `false`, and desktop will remain as `false` (no re-render).
|
|
72
89
|
// Mobile will flip from `false` to `true`.
|
|
73
|
-
|
|
90
|
+
setIsMobileViewport((_query$matches = query === null || query === void 0 ? void 0 : query.matches) !== null && _query$matches !== void 0 ? _query$matches : false);
|
|
74
91
|
}, [query]);
|
|
92
|
+
var isMobile = (_breakpoints$belowSm = breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.belowSm) !== null && _breakpoints$belowSm !== void 0 ? _breakpoints$belowSm : isMobileViewport;
|
|
93
|
+
var _useTopNavEndFocus = (0, _useTopNavEndFocus2.useTopNavEndFocus)({
|
|
94
|
+
isMobile: isMobile,
|
|
95
|
+
enabled: (0, _fg.fg)('platform-dst-chat-panel-layout')
|
|
96
|
+
}),
|
|
97
|
+
actionsRef = _useTopNavEndFocus.actionsRef,
|
|
98
|
+
triggerRef = _useTopNavEndFocus.triggerRef,
|
|
99
|
+
onFocusCapture = _useTopNavEndFocus.onFocusCapture;
|
|
100
|
+
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
101
|
+
if ((0, _fg.fg)('platform-dst-chat-panel-layout') && hasContainerBreakpoints) {
|
|
102
|
+
setIsOpen(false);
|
|
103
|
+
}
|
|
104
|
+
}, [isMobile, hasContainerBreakpoints]);
|
|
75
105
|
|
|
76
106
|
// The shared provider also covers the mobile overflow popup itself. Keep the
|
|
77
107
|
// previous content-only namespace coverage when the layout gate is disabled.
|
|
@@ -79,10 +109,7 @@ function TopNavEnd(_ref) {
|
|
|
79
109
|
var actions = (0, _fg.fg)('platform-dst-chat-panel-layout') || (0, _fg.fg)('platform-dst-top-layer') ? children : /*#__PURE__*/_react.default.createElement(_openLayerObserverNamespaceProvider.OpenLayerObserverNamespaceProvider, {
|
|
80
110
|
namespace: _constants.openLayerObserverTopNavEndNamespace
|
|
81
111
|
}, children);
|
|
82
|
-
var
|
|
83
|
-
"aria-label": label,
|
|
84
|
-
className: (0, _runtime.ax)([containerStyles.root, hasPersistentItems && containerStyles.withPersistentItems])
|
|
85
|
-
}, isMobile ? /*#__PURE__*/_react.default.createElement(_popup.Popup, {
|
|
112
|
+
var regularActions = isMobile ? /*#__PURE__*/_react.default.createElement(_popup.Popup, {
|
|
86
113
|
isOpen: isOpen,
|
|
87
114
|
onClose: function onClose() {
|
|
88
115
|
return setIsOpen(false);
|
|
@@ -97,11 +124,13 @@ function TopNavEnd(_ref) {
|
|
|
97
124
|
return /*#__PURE__*/_react.default.createElement(_hasCustomThemeContext.HasCustomThemeContext.Provider, {
|
|
98
125
|
value: false
|
|
99
126
|
}, /*#__PURE__*/_react.default.createElement(_list.List, {
|
|
127
|
+
ref: actionsRef,
|
|
100
128
|
xcss: (0, _react2.cx)(listStyles.root, listStyles.popupContainer)
|
|
101
129
|
}, actions));
|
|
102
130
|
},
|
|
103
131
|
trigger: function trigger(triggerProps) {
|
|
104
132
|
return /*#__PURE__*/_react.default.createElement(_iconButton.IconButton, (0, _extends2.default)({}, triggerProps, {
|
|
133
|
+
ref: (0, _fg.fg)('platform-dst-chat-panel-layout') ? (0, _mergeRefs.default)([triggerProps.ref, triggerRef]) : triggerProps.ref,
|
|
105
134
|
label: showMoreButtonLabel,
|
|
106
135
|
isSelected: isOpen,
|
|
107
136
|
onClick: function onClick() {
|
|
@@ -112,8 +141,16 @@ function TopNavEnd(_ref) {
|
|
|
112
141
|
}));
|
|
113
142
|
}
|
|
114
143
|
}) : /*#__PURE__*/_react.default.createElement(_list.List, {
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
ref: actionsRef,
|
|
145
|
+
xcss: (0, _react2.cx)(listStyles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? listStyles.container : listStyles.hideOnSmallViewport)
|
|
146
|
+
}, actions);
|
|
147
|
+
var content = /*#__PURE__*/_react.default.createElement("nav", {
|
|
148
|
+
"aria-label": label,
|
|
149
|
+
className: (0, _runtime.ax)([containerStyles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? containerStyles.container : containerStyles.viewport, hasPersistentItems && containerStyles.withPersistentItems])
|
|
150
|
+
}, (0, _fg.fg)('platform-dst-chat-panel-layout') ? /*#__PURE__*/_react.default.createElement("div", {
|
|
151
|
+
onFocusCapture: onFocusCapture,
|
|
152
|
+
className: (0, _runtime.ax)([containerStyles.focusScope])
|
|
153
|
+
}, regularActions) : regularActions, hasPersistentItems && persistentItems);
|
|
117
154
|
return (0, _fg.fg)('platform-dst-chat-panel-layout') && !(0, _fg.fg)('platform-dst-top-layer') ? /*#__PURE__*/_react.default.createElement(_openLayerObserverNamespaceProvider.OpenLayerObserverNamespaceProvider, {
|
|
118
155
|
namespace: _constants.openLayerObserverTopNavEndNamespace
|
|
119
156
|
}, content) : content;
|
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
._yyhycs5v{grid-column:2}._1bahh9n0{justify-content:end}
|
|
3
3
|
._1bsb1osq{width:100%}
|
|
4
4
|
._1e0c1txw{display:flex}
|
|
5
|
+
._1e0cqgwa{display:var(--n_tnMiddleDisplay,flex)}
|
|
6
|
+
._1eji1ris{grid-auto-columns:max-content}
|
|
5
7
|
._4cvr1h6o{align-items:center}
|
|
6
|
-
|
|
8
|
+
._6a6zh9n0{justify-items:end}
|
|
9
|
+
._wij21bp4{grid-auto-flow:column}
|
|
10
|
+
._yv0e15b0{grid-template-columns:minmax(min-content,780px)}
|
|
11
|
+
@media (min-width:48rem){._181n11p5{display:grid}._1j8b15b0{grid-template-columns:minmax(min-content,780px)}._lagd1bp4{grid-auto-flow:column}._1t4c1ris{grid-auto-columns:max-content}._12e8h9n0{justify-items:end}._181n1pe1{display:var(--n_tnMiddleDisplay,grid)}}
|
|
@@ -13,7 +13,9 @@ var _openLayerObserverNamespaceProvider = require("@atlaskit/layering/open-layer
|
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
var _constants = require("../constants");
|
|
15
15
|
var styles = {
|
|
16
|
-
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0
|
|
16
|
+
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0",
|
|
17
|
+
container: "_1e0cqgwa _yv0e15b0 _wij21bp4 _1eji1ris _6a6zh9n0 _181n1pe1",
|
|
18
|
+
viewport: "_181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0"
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -27,7 +29,7 @@ var styles = {
|
|
|
27
29
|
function TopNavMiddle(_ref) {
|
|
28
30
|
var children = _ref.children;
|
|
29
31
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
-
className: (0, _runtime.ax)([styles.root])
|
|
32
|
+
className: (0, _runtime.ax)([styles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? styles.container : styles.viewport])
|
|
31
33
|
}, (0, _fg.fg)('platform-dst-top-layer') ? children : /*#__PURE__*/_react.default.createElement(_openLayerObserverNamespaceProvider.OpenLayerObserverNamespaceProvider, {
|
|
32
34
|
namespace: _constants.openLayerObserverTopNavMiddleNamespace
|
|
33
35
|
}, children));
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
2
|
-
._yyhykb7n{grid-column:1}.
|
|
2
|
+
._yyhykb7n{grid-column:1}._1bsb14ik{width:var(--n_tnSideWidth,auto)}
|
|
3
|
+
._1e0c1txw{display:flex}
|
|
4
|
+
._1ul91wqq{min-width:var(--n_tnStartMinWidth,0)}
|
|
3
5
|
._4cvr1h6o{align-items:center}
|
|
4
6
|
._4t3i1osq{height:100%}
|
|
5
|
-
|
|
7
|
+
._vchhusvi{box-sizing:border-box}
|
|
8
|
+
@media (min-width:64rem){._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._gltexl30{width:var(--n_tnSideWidth,max-content)}._15ritp0n{min-width:var(--n_tnStartMinWidth,330px)}}
|
|
@@ -9,13 +9,17 @@ exports.TopNavStart = TopNavStart;
|
|
|
9
9
|
require("./top-nav-start.compiled.css");
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
13
|
var _topNavStartAttachRef = require("../../../context/top-nav-start/top-nav-start-attach-ref");
|
|
13
14
|
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); }
|
|
14
15
|
/**
|
|
15
16
|
* Styles for the TopNavStart element.
|
|
16
17
|
*/
|
|
18
|
+
|
|
17
19
|
var innerStyles = {
|
|
18
|
-
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw
|
|
20
|
+
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw",
|
|
21
|
+
container: "_1bsb14ik _1ul91wqq _vchhusvi _gltexl30 _15ritp0n",
|
|
22
|
+
viewport: "_glte1ris _15rip2n4 _1gs5usvi"
|
|
19
23
|
};
|
|
20
24
|
/**
|
|
21
25
|
* __TopNavStart__
|
|
@@ -37,6 +41,6 @@ function TopNavStart(_ref) {
|
|
|
37
41
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
38
42
|
ref: elementRef,
|
|
39
43
|
"data-testid": testId,
|
|
40
|
-
className: (0, _runtime.ax)([innerStyles.root])
|
|
44
|
+
className: (0, _runtime.ax)([innerStyles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? innerStyles.container : innerStyles.viewport])
|
|
41
45
|
}, sideNavToggleButton, children);
|
|
42
46
|
}
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
._nd5l8cbt{grid-area:top-bar}
|
|
2
2
|
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
3
|
+
._18zridpf{padding-inline:0}
|
|
3
4
|
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
4
|
-
._179ria51{border-block-end:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}.
|
|
5
|
+
._179ria51{border-block-end:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._121jglyw{--n_tnLogoDisplay:none}
|
|
6
|
+
._152t1nws{inset-block-start:var(--n_bnrM,0)}
|
|
7
|
+
._17hf1ris{--n_tnStartMinWidth:max-content}
|
|
8
|
+
._17sxglyw{--n_tnActionsDisplay:none}
|
|
9
|
+
._1bsb1j6v{width:1rem}
|
|
5
10
|
._1e0c11p5{display:grid}
|
|
11
|
+
._1e0c1ule{display:block}
|
|
12
|
+
._1f38jrq2{container-name:navigation-top-nav}
|
|
13
|
+
._1gd11txw{--n_tnSearchIconDisplay:flex}
|
|
14
|
+
._1oae1txw{--n_tnMiddleDisplay:flex}
|
|
6
15
|
._1pbyegat{z-index:4}
|
|
16
|
+
._1ul9idpf{min-width:0}
|
|
17
|
+
._1v3t1vi7{--n_tnEndMinWidth:32px}
|
|
18
|
+
._3um015vq{visibility:hidden}
|
|
19
|
+
._40201vi7{--n_tnSearchWidth:32px}
|
|
7
20
|
._4cvr1h6o{align-items:center}
|
|
21
|
+
._4gtwglyw{--n_tnSearchDisplay:none}
|
|
8
22
|
._4t3i1dgc{height:var(--n_tNvM)}
|
|
23
|
+
._4t3i1osq{height:100%}
|
|
24
|
+
._4t3iidpf{height:0}
|
|
25
|
+
._7cca15wb{container-type:inline-size}
|
|
26
|
+
._andq1wug{--n_tnSideWidth:auto}
|
|
9
27
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
10
28
|
._d6vu1bgi >span[data-ep-placeholder-id=top_navigation_skeleton]{display:contents}
|
|
29
|
+
._dv901txw{--n_tnIconDisplay:flex}
|
|
11
30
|
._kqsw1if8{position:sticky}
|
|
31
|
+
._kqswstnw{position:absolute}
|
|
32
|
+
._lcxvglyw{pointer-events:none}
|
|
12
33
|
._vchhusvi{box-sizing:border-box}
|
|
34
|
+
._yv0e14iv{grid-template-columns:auto minmax(0,1fr) auto}
|
|
13
35
|
._yv0e1mfv{grid-template-columns:auto 1fr auto}
|
|
36
|
+
@container navigation-top-nav (min-width: 30rem){._1vdu11p5{--n_tnSearchDisplay:grid}._tyr51osq{--n_tnSearchWidth:100%}._t7c0glyw{--n_tnSearchIconDisplay:none}}
|
|
37
|
+
@container navigation-top-nav (min-width: 48rem){._f4az18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}._1nd111p5{--n_tnMiddleDisplay:grid}._1py31ris{--n_tnEndMinWidth:max-content}._orr21txw{--n_tnActionsDisplay:flex}}
|
|
38
|
+
@container navigation-top-nav (min-width: 64rem){._gaza1ris{--n_tnSideWidth:max-content}._e5ixp2n4{--n_tnStartMinWidth:330px}._8hhxp2n4{--n_tnEndMinWidth:330px}._pdk61txw{--n_tnLogoDisplay:flex}._1x9fglyw{--n_tnIconDisplay:none}}
|
|
14
39
|
@media (min-width:48rem){._1j8b18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* top-nav.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
@@ -10,6 +11,7 @@ require("./top-nav.compiled.css");
|
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var React = _react;
|
|
12
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
15
|
var _componentWithFg = require("@atlaskit/platform-feature-flags-react/component-with-fg");
|
|
14
16
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
17
|
var _useSkipLinkInternal = require("../../../context/skip-links/use-skip-link-internal");
|
|
@@ -22,6 +24,8 @@ var _dangerouslyHoistCssVarToDocumentRoot = require("../dangerously-hoist-css-va
|
|
|
22
24
|
var _hoistCssVarToLocalGrid = require("../hoist-css-var-to-local-grid");
|
|
23
25
|
var _hoistSlotSizesContext = require("../hoist-slot-sizes-context");
|
|
24
26
|
var _useLayoutId = require("../use-layout-id");
|
|
27
|
+
var _topNavElementContext = require("./top-nav-element-context");
|
|
28
|
+
var _useMeasuredTopNavBreakpoints = require("./use-measured-top-nav-breakpoints");
|
|
25
29
|
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); }
|
|
26
30
|
/**
|
|
27
31
|
* Styles for the container for the top nav items.
|
|
@@ -32,7 +36,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
32
36
|
* - The background sits below the expanded side nav
|
|
33
37
|
*/
|
|
34
38
|
var styles = {
|
|
35
|
-
|
|
39
|
+
remProbe: "_kqswstnw _3um015vq _lcxvglyw _1bsb1j6v _4t3iidpf",
|
|
40
|
+
root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi",
|
|
41
|
+
viewportLayout: "_1j8b18ax",
|
|
42
|
+
container: "_18zridpf _1f38jrq2 _7cca15wb _1ul9idpf _1e0c1ule",
|
|
43
|
+
containerLayout: "_zulpu2gc _18zrutpp _1e0c11p5 _yv0e14iv _4cvr1h6o _vchhusvi _4t3i1osq _1ul9idpf _1oae1txw _andq1wug _17hf1ris _1v3t1vi7 _121jglyw _dv901txw _17sxglyw _4gtwglyw _40201vi7 _1gd11txw _d6vu1bgi _1vdu11p5 _tyr51osq _t7c0glyw _f4az18ax _1nd111p5 _1py31ris _orr21txw _gaza1ris _e5ixp2n4 _8hhxp2n4 _pdk61txw _1x9fglyw"
|
|
36
44
|
};
|
|
37
45
|
/**
|
|
38
46
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
@@ -46,6 +54,27 @@ function TopNavOld(_ref) {
|
|
|
46
54
|
testId = _ref.testId,
|
|
47
55
|
providedId = _ref.id,
|
|
48
56
|
customThemeConfig = _ref.customTheme;
|
|
57
|
+
var _useState = (0, _react.useState)(null),
|
|
58
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
59
|
+
topNavElement = _useState2[0],
|
|
60
|
+
setTopNavElement = _useState2[1];
|
|
61
|
+
var _useState3 = (0, _react.useState)(null),
|
|
62
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
63
|
+
remProbe = _useState4[0],
|
|
64
|
+
setRemProbe = _useState4[1];
|
|
65
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
66
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
67
|
+
var topNavRef = (0, _react.useCallback)(function (element) {
|
|
68
|
+
(0, _react.startTransition)(function () {
|
|
69
|
+
return setTopNavElement(element);
|
|
70
|
+
});
|
|
71
|
+
}, []);
|
|
72
|
+
var remProbeRef = (0, _react.useCallback)(function (element) {
|
|
73
|
+
(0, _react.startTransition)(function () {
|
|
74
|
+
return setRemProbe(element);
|
|
75
|
+
});
|
|
76
|
+
}, []);
|
|
77
|
+
var breakpoints = (0, _useMeasuredTopNavBreakpoints.useMeasuredTopNavBreakpoints)(topNavElement, remProbe);
|
|
49
78
|
var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
|
|
50
79
|
var id = (0, _useLayoutId.useLayoutId)({
|
|
51
80
|
providedId: providedId
|
|
@@ -60,14 +89,19 @@ function TopNavOld(_ref) {
|
|
|
60
89
|
return /*#__PURE__*/React.createElement(_hasCustomThemeContext.HasCustomThemeContext.Provider, {
|
|
61
90
|
value: customTheme.isEnabled
|
|
62
91
|
}, /*#__PURE__*/React.createElement("header", {
|
|
92
|
+
ref: (0, _fg.fg)('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
63
93
|
id: id,
|
|
64
94
|
"data-layout-slot": true,
|
|
65
|
-
className: (0, _runtime.ax)([styles.root, xcss]),
|
|
95
|
+
className: (0, _runtime.ax)([styles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
66
96
|
"data-testid": testId
|
|
67
97
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
68
98
|
,
|
|
69
99
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
70
|
-
}, /*#__PURE__*/React.createElement(
|
|
100
|
+
}, (0, _fg.fg)('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
ref: remProbeRef,
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
className: (0, _runtime.ax)([styles.remProbe])
|
|
104
|
+
}), /*#__PURE__*/React.createElement(_hoistCssVarToLocalGrid.HoistCssVarToLocalGrid, {
|
|
71
105
|
variableName: _constants.topNavMountedVar,
|
|
72
106
|
value: height
|
|
73
107
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -80,7 +114,11 @@ function TopNavOld(_ref) {
|
|
|
80
114
|
value: height
|
|
81
115
|
})
|
|
82
116
|
// ------ END UNSAFE STYLES ------
|
|
83
|
-
,
|
|
117
|
+
, (0, _fg.fg)('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(_topNavElementContext.TopNavElementContext.Provider, {
|
|
118
|
+
value: breakpoints
|
|
119
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: (0, _runtime.ax)([styles.containerLayout])
|
|
121
|
+
}, children)) : children));
|
|
84
122
|
}
|
|
85
123
|
|
|
86
124
|
/**
|
|
@@ -95,6 +133,27 @@ function TopNavNew(_ref2) {
|
|
|
95
133
|
testId = _ref2.testId,
|
|
96
134
|
providedId = _ref2.id,
|
|
97
135
|
customThemeConfig = _ref2.customTheme;
|
|
136
|
+
var _useState5 = (0, _react.useState)(null),
|
|
137
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
138
|
+
topNavElement = _useState6[0],
|
|
139
|
+
setTopNavElement = _useState6[1];
|
|
140
|
+
var _useState7 = (0, _react.useState)(null),
|
|
141
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
142
|
+
remProbe = _useState8[0],
|
|
143
|
+
setRemProbe = _useState8[1];
|
|
144
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
145
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
146
|
+
var topNavRef = (0, _react.useCallback)(function (element) {
|
|
147
|
+
(0, _react.startTransition)(function () {
|
|
148
|
+
return setTopNavElement(element);
|
|
149
|
+
});
|
|
150
|
+
}, []);
|
|
151
|
+
var remProbeRef = (0, _react.useCallback)(function (element) {
|
|
152
|
+
(0, _react.startTransition)(function () {
|
|
153
|
+
return setRemProbe(element);
|
|
154
|
+
});
|
|
155
|
+
}, []);
|
|
156
|
+
var breakpoints = (0, _useMeasuredTopNavBreakpoints.useMeasuredTopNavBreakpoints)(topNavElement, remProbe);
|
|
98
157
|
var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
|
|
99
158
|
var id = (0, _useLayoutId.useLayoutId)({
|
|
100
159
|
providedId: providedId
|
|
@@ -112,14 +171,19 @@ function TopNavNew(_ref2) {
|
|
|
112
171
|
}, /*#__PURE__*/React.createElement(_hasDefaultBackgroundColorContext.HasDefaultBackgroundColorContext.Provider, {
|
|
113
172
|
value: hasDefaultBackground
|
|
114
173
|
}, /*#__PURE__*/React.createElement("header", {
|
|
174
|
+
ref: (0, _fg.fg)('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
115
175
|
id: id,
|
|
116
176
|
"data-layout-slot": true,
|
|
117
|
-
className: (0, _runtime.ax)([styles.root, xcss]),
|
|
177
|
+
className: (0, _runtime.ax)([styles.root, (0, _fg.fg)('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
118
178
|
"data-testid": testId
|
|
119
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
120
180
|
,
|
|
121
181
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
122
|
-
}, /*#__PURE__*/React.createElement(
|
|
182
|
+
}, (0, _fg.fg)('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
183
|
+
ref: remProbeRef,
|
|
184
|
+
"aria-hidden": "true",
|
|
185
|
+
className: (0, _runtime.ax)([styles.remProbe])
|
|
186
|
+
}), /*#__PURE__*/React.createElement(_hoistCssVarToLocalGrid.HoistCssVarToLocalGrid, {
|
|
123
187
|
variableName: _constants.topNavMountedVar,
|
|
124
188
|
value: height
|
|
125
189
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -132,7 +196,11 @@ function TopNavNew(_ref2) {
|
|
|
132
196
|
value: height
|
|
133
197
|
})
|
|
134
198
|
// ------ END UNSAFE STYLES ------
|
|
135
|
-
,
|
|
199
|
+
, (0, _fg.fg)('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(_topNavElementContext.TopNavElementContext.Provider, {
|
|
200
|
+
value: breakpoints
|
|
201
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: (0, _runtime.ax)([styles.containerLayout])
|
|
203
|
+
}, children)) : children)));
|
|
136
204
|
}
|
|
137
205
|
|
|
138
206
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useIsCompactTopNav = useIsCompactTopNav;
|
|
7
|
+
var _useTopNavBreakpoints = require("./use-top-nav-breakpoints");
|
|
8
|
+
/**
|
|
9
|
+
* Use the enclosing TopNav's border-box width, matching its 48rem sm breakpoint.
|
|
10
|
+
* Until that width is measured, use an icon-only fallback: the server cannot know
|
|
11
|
+
* the container width, and text buttons can overlap at narrow widths.
|
|
12
|
+
*/
|
|
13
|
+
function useIsCompactTopNav() {
|
|
14
|
+
var breakpoints = (0, _useTopNavBreakpoints.useTopNavBreakpoints)();
|
|
15
|
+
return breakpoints ? !breakpoints.hasMeasured || breakpoints.belowSm : false;
|
|
16
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useMeasuredTopNavBreakpoints = useMeasuredTopNavBreakpoints;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
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; }
|
|
14
|
+
function useMeasuredTopNavBreakpoints(topNav, remProbe) {
|
|
15
|
+
var _useState = (0, _react.useState)({
|
|
16
|
+
belowSm: false,
|
|
17
|
+
hasMeasured: false
|
|
18
|
+
}),
|
|
19
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
|
+
breakpoints = _useState2[0],
|
|
21
|
+
setBreakpoints = _useState2[1];
|
|
22
|
+
(0, _useLayoutEffect.useLayoutEffect)(function () {
|
|
23
|
+
var view = topNav === null || topNav === void 0 ? void 0 : topNav.ownerDocument.defaultView;
|
|
24
|
+
if (!topNav || !view) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
var updateWidth = function updateWidth(width) {
|
|
28
|
+
var rootFontSize = parseFloat(view.getComputedStyle(topNav.ownerDocument.documentElement).fontSize) || 16;
|
|
29
|
+
var belowSm = width < 48 * rootFontSize;
|
|
30
|
+
// Navigation can still be hydrating inside Suspense. An urgent context
|
|
31
|
+
// update would discard its server DOM and show the loading fallback.
|
|
32
|
+
(0, _react.startTransition)(function () {
|
|
33
|
+
setBreakpoints(function (previous) {
|
|
34
|
+
return previous.hasMeasured && previous.belowSm === belowSm ? previous : {
|
|
35
|
+
belowSm: belowSm,
|
|
36
|
+
hasMeasured: true
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var width = topNav.getBoundingClientRect().width;
|
|
42
|
+
updateWidth(width);
|
|
43
|
+
if (!view.ResizeObserver) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var observer = new view.ResizeObserver(function (entries) {
|
|
47
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
48
|
+
_step;
|
|
49
|
+
try {
|
|
50
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
|
+
var entry = _step.value;
|
|
52
|
+
if (entry.target === topNav) {
|
|
53
|
+
var _entry$borderBoxSize$, _entry$borderBoxSize;
|
|
54
|
+
width = (_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$ : topNav.getBoundingClientRect().width;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// The rem probe resizes when the root font changes, even if the header
|
|
58
|
+
// stays the same pixel width. Reevaluate against the last measured width.
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_iterator.e(err);
|
|
61
|
+
} finally {
|
|
62
|
+
_iterator.f();
|
|
63
|
+
}
|
|
64
|
+
updateWidth(width);
|
|
65
|
+
});
|
|
66
|
+
observer.observe(topNav, {
|
|
67
|
+
box: 'border-box'
|
|
68
|
+
});
|
|
69
|
+
if (remProbe) {
|
|
70
|
+
observer.observe(remProbe);
|
|
71
|
+
}
|
|
72
|
+
return function () {
|
|
73
|
+
return observer.disconnect();
|
|
74
|
+
};
|
|
75
|
+
}, [topNav, remProbe]);
|
|
76
|
+
return breakpoints;
|
|
77
|
+
}
|