@atlaskit/navigation-system 11.4.2 → 11.5.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 +22 -0
- package/constellation/layout/code.mdx +28 -0
- package/dist/cjs/ui/page-layout/panel-splitter/get-panel-growth-side.js +19 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
- 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-measured-top-nav-breakpoints.js +75 -0
- package/dist/cjs/ui/page-layout/top-nav/use-top-nav-breakpoints.js +19 -0
- package/dist/cjs/ui/page-layout/top-nav/use-top-nav-end-focus.js +102 -0
- 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/search.compiled.css +34 -2
- package/dist/cjs/ui/top-nav-items/search.js +106 -11
- package/dist/es2019/ui/page-layout/panel-splitter/get-panel-growth-side.js +14 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +22 -6
- 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-measured-top-nav-breakpoints.js +48 -0
- package/dist/es2019/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
- package/dist/es2019/ui/page-layout/top-nav/use-top-nav-end-focus.js +97 -0
- 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/search.compiled.css +34 -2
- package/dist/es2019/ui/top-nav-items/search.js +105 -10
- package/dist/esm/ui/page-layout/panel-splitter/get-panel-growth-side.js +13 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
- 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-measured-top-nav-breakpoints.js +68 -0
- package/dist/esm/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
- package/dist/esm/ui/page-layout/top-nav/use-top-nav-end-focus.js +96 -0
- 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/search.compiled.css +34 -2
- package/dist/esm/ui/top-nav-items/search.js +107 -11
- package/dist/types/ui/page-layout/panel-splitter/get-panel-growth-side.d.ts +10 -0
- package/dist/types/ui/page-layout/top-nav/top-nav-element-context.d.ts +5 -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-measured-top-nav-breakpoints.d.ts +2 -0
- package/dist/types/ui/page-layout/top-nav/use-top-nav-breakpoints.d.ts +10 -0
- package/dist/types/ui/page-layout/top-nav/use-top-nav-end-focus.d.ts +12 -0
- package/package.json +10 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12l2196n{margin-inline-end:var(--ds-space-negative-075,-6px)}
|
|
2
3
|
._12y31o36{outline-width:medium}
|
|
3
4
|
._152tidpf{inset-block-start:0}
|
|
4
5
|
._1bsb1l7b{width:3px}
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
._6fl41ytf{transition-timing-function:ease-in-out}
|
|
18
19
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
19
20
|
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
21
|
+
._ahbqze3t{margin-inline-start:var(--ds-space-0,0)}
|
|
20
22
|
._bfhk1j28{background-color:transparent}
|
|
21
23
|
._bfhk1r31{background-color:currentColor}
|
|
22
24
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -31,6 +31,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
|
31
31
|
import { contentInsetBlockStart } from '../constants';
|
|
32
32
|
import { LayoutAreaSizingContext } from '../layout-area-sizing-context';
|
|
33
33
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
34
|
+
import { getPanelGrowthSide } from './get-panel-growth-side';
|
|
34
35
|
import { getPercentageWithinPixelBounds } from './get-percentage-within-pixel-bounds';
|
|
35
36
|
import { getPixelWidth } from './get-pixel-width';
|
|
36
37
|
import { getWidthFromDragLocation } from './get-width-from-drag-location';
|
|
@@ -55,7 +56,8 @@ var lineStyles = {
|
|
|
55
56
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
56
57
|
};
|
|
57
58
|
var tooltipStyles = {
|
|
58
|
-
root: "_ahbq196n _1bsb1ris"
|
|
59
|
+
root: "_ahbq196n _1bsb1ris",
|
|
60
|
+
placedLeft: "_ahbqze3t _12l2196n"
|
|
59
61
|
};
|
|
60
62
|
var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
61
63
|
var children = _ref.children,
|
|
@@ -93,7 +95,7 @@ var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
93
95
|
// Must be statically passed
|
|
94
96
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
95
97
|
,
|
|
96
|
-
className: ax([tooltipStyles.root, className])
|
|
98
|
+
className: ax([tooltipStyles.root, props.placement === 'left' && tooltipStyles.placedLeft, className])
|
|
97
99
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
98
100
|
,
|
|
99
101
|
|
|
@@ -108,6 +110,7 @@ var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
108
110
|
var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
109
111
|
var tooltipContent = _ref2.tooltipContent,
|
|
110
112
|
shortcut = _ref2.shortcut,
|
|
113
|
+
mousePosition = _ref2.mousePosition,
|
|
111
114
|
children = _ref2.children,
|
|
112
115
|
testId = _ref2.testId;
|
|
113
116
|
if (tooltipContent) {
|
|
@@ -116,7 +119,7 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
116
119
|
content: tooltipContent,
|
|
117
120
|
shortcut: shortcut,
|
|
118
121
|
position: "mouse-y",
|
|
119
|
-
mousePosition:
|
|
122
|
+
mousePosition: mousePosition,
|
|
120
123
|
isScreenReaderAnnouncementDisabled: true,
|
|
121
124
|
component: PanelSplitterTooltip,
|
|
122
125
|
shouldAlwaysFadeIn: true,
|
|
@@ -125,6 +128,13 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
125
128
|
}
|
|
126
129
|
return children;
|
|
127
130
|
};
|
|
131
|
+
|
|
132
|
+
// Browsers increase an RTL range input's value on ArrowLeft, so the arrow key pointing towards the
|
|
133
|
+
// panel's growth side widens it.
|
|
134
|
+
var rangeInputDirs = {
|
|
135
|
+
left: 'rtl',
|
|
136
|
+
right: 'ltr'
|
|
137
|
+
};
|
|
128
138
|
function getTextDirection(element) {
|
|
129
139
|
var _window$getComputedSt = window.getComputedStyle(element),
|
|
130
140
|
direction = _window$getComputedSt.direction;
|
|
@@ -160,6 +170,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
160
170
|
unregisterSplitter.current = element && prepareResize ? registerSplitter === null || registerSplitter === void 0 ? void 0 : registerSplitter(element) : undefined;
|
|
161
171
|
}, [prepareResize, registerSplitter]);
|
|
162
172
|
var labelId = useId();
|
|
173
|
+
var panelGrowthSide = useMemo(function () {
|
|
174
|
+
return fg('platform-dst-panel-splitter-resize-direction') ? getPanelGrowthSide({
|
|
175
|
+
position: position,
|
|
176
|
+
textDirection: getTextDirection(panel)
|
|
177
|
+
}) : undefined;
|
|
178
|
+
}, [position, panel]);
|
|
163
179
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
164
180
|
var _useState = useState(panelWidth),
|
|
165
181
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -413,7 +429,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
413
429
|
var pendingKeyboardWidth = useRef(null);
|
|
414
430
|
var handleSliderInputChange = useCallback( /*#__PURE__*/function () {
|
|
415
431
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event, pendingKey) {
|
|
416
|
-
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current,
|
|
432
|
+
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current, doesArrowRightIncrease, increase, step, _t2, _t3;
|
|
417
433
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
418
434
|
while (1) switch (_context2.prev = _context2.next) {
|
|
419
435
|
case 0:
|
|
@@ -457,8 +473,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
457
473
|
// Native range inputs would apply these keys to the placeholder bounds.
|
|
458
474
|
// Preserve the intent until the chunk provides the real bounds instead.
|
|
459
475
|
current = (_pendingKeyboardWidth = pendingKeyboardWidth.current) !== null && _pendingKeyboardWidth !== void 0 ? _pendingKeyboardWidth : getPixelWidth(panel);
|
|
460
|
-
|
|
461
|
-
increase = pendingKey === 'ArrowUp' || pendingKey === (
|
|
476
|
+
doesArrowRightIncrease = panelGrowthSide ? panelGrowthSide === 'right' : getTextDirection(panel) === 'ltr';
|
|
477
|
+
increase = pendingKey === 'ArrowUp' || pendingKey === (doesArrowRightIncrease ? 'ArrowRight' : 'ArrowLeft') || pendingKey === 'PageUp';
|
|
462
478
|
step = pendingKey.startsWith('Page') ? Math.max(20, (max - min) / 10) : 20;
|
|
463
479
|
value = pendingKey === 'End' ? max : pendingKey === 'Home' ? min : current + (increase ? step : -step);
|
|
464
480
|
}
|
|
@@ -489,7 +505,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
489
505
|
return function (_x, _x2) {
|
|
490
506
|
return _ref8.apply(this, arguments);
|
|
491
507
|
};
|
|
492
|
-
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize]);
|
|
508
|
+
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize, panelGrowthSide]);
|
|
493
509
|
var handleSliderKeyDown = useCallback(function (event) {
|
|
494
510
|
if (prepareResize && !keyboardBoundsReady.current && ['Home', 'End', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown'].includes(event.key)) {
|
|
495
511
|
event.preventDefault();
|
|
@@ -601,6 +617,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
601
617
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
602
618
|
tooltipContent: tooltipContent,
|
|
603
619
|
shortcut: shortcut,
|
|
620
|
+
mousePosition: panelGrowthSide !== null && panelGrowthSide !== void 0 ? panelGrowthSide : 'right',
|
|
604
621
|
testId: testId ? "".concat(testId, "-tooltip") : undefined
|
|
605
622
|
}, /*#__PURE__*/React.createElement("div", {
|
|
606
623
|
ref: setSplitterRef,
|
|
@@ -609,6 +626,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
609
626
|
className: ax([grabAreaStyles.root, fg('platform-dst-tokens-finesse') && grabAreaStyles.rootFinesse])
|
|
610
627
|
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, /*#__PURE__*/React.createElement("input", {
|
|
611
628
|
type: "range",
|
|
629
|
+
dir: panelGrowthSide ? rangeInputDirs[panelGrowthSide] : undefined,
|
|
612
630
|
value: rangeInputValue,
|
|
613
631
|
step: 20,
|
|
614
632
|
min: rangeInputBounds.min,
|
|
@@ -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)}}
|
|
@@ -4,7 +4,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import "./top-nav-end.compiled.css";
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
|
+
|
|
8
|
+
// Compiled supports the inherited container-layout widths outside @atlaskit/css's bounded values.
|
|
7
9
|
import { cx } from '@compiled/react';
|
|
10
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
8
11
|
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
9
12
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
10
13
|
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/open-layer-observer-namespace-provider';
|
|
@@ -15,12 +18,18 @@ import { List } from '../../../components/list';
|
|
|
15
18
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
16
19
|
import { IconButton } from '../../top-nav-items/themed/icon-button';
|
|
17
20
|
import { openLayerObserverTopNavEndNamespace } from '../constants';
|
|
21
|
+
import { useTopNavBreakpoints } from './use-top-nav-breakpoints';
|
|
22
|
+
import { useTopNavEndFocus } from './use-top-nav-end-focus';
|
|
18
23
|
var containerStyles = {
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
focusScope: "_1e0c1bgi",
|
|
25
|
+
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg",
|
|
26
|
+
withPersistentItems: "_zulpu2gc _4cvr1h6o",
|
|
27
|
+
container: "_1bsb14ik _1ul98ox3 _vchhusvi _10fph9n0 _1d2yioy8 _gltexl30 _15riwpqv",
|
|
28
|
+
viewport: "_1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0"
|
|
21
29
|
};
|
|
22
30
|
var listStyles = {
|
|
23
31
|
root: "_zulp1b66 _4cvr1h6o _1e0c1txw",
|
|
32
|
+
container: "_1e0c1cgg _181nz5ha",
|
|
24
33
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
25
34
|
popupContainer: "_1yt4u2gc"
|
|
26
35
|
};
|
|
@@ -34,12 +43,15 @@ var listStyles = {
|
|
|
34
43
|
* This is to prevent the actions from overflowing the top navigation.
|
|
35
44
|
*/
|
|
36
45
|
export function TopNavEnd(_ref) {
|
|
46
|
+
var _breakpoints$belowSm;
|
|
37
47
|
var children = _ref.children,
|
|
38
48
|
persistentItems = _ref.persistentItems,
|
|
39
49
|
_ref$label = _ref.label,
|
|
40
50
|
label = _ref$label === void 0 ? 'Actions' : _ref$label,
|
|
41
51
|
_ref$showMoreButtonLa = _ref.showMoreButtonLabel,
|
|
42
52
|
showMoreButtonLabel = _ref$showMoreButtonLa === void 0 ? 'Show more' : _ref$showMoreButtonLa;
|
|
53
|
+
var breakpoints = useTopNavBreakpoints();
|
|
54
|
+
var hasContainerBreakpoints = breakpoints != null;
|
|
43
55
|
var hasPersistentItems = fg('platform-dst-chat-panel-layout') && persistentItems != null;
|
|
44
56
|
var _useState = useState(false),
|
|
45
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -48,21 +60,40 @@ export function TopNavEnd(_ref) {
|
|
|
48
60
|
// Always setting to `false` for the initial render (will flip in an effect for mobile)
|
|
49
61
|
var _useState3 = useState(false),
|
|
50
62
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
isMobileViewport = _useState4[0],
|
|
64
|
+
setIsMobileViewport = _useState4[1];
|
|
53
65
|
// Note: `query` is a stable value between renders
|
|
54
66
|
var query = useMediaQuery('below.sm', function onChange(event) {
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
67
|
+
setIsMobileViewport(event.matches);
|
|
68
|
+
// Container mode closes only when the effective layout changes below.
|
|
69
|
+
// Keep the existing viewport behavior outside the rollout / provider.
|
|
70
|
+
if (fg('platform-dst-chat-panel-layout')) {
|
|
71
|
+
if (!hasContainerBreakpoints) {
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
setIsOpen(false);
|
|
76
|
+
}
|
|
59
77
|
});
|
|
60
78
|
useLayoutEffect(function () {
|
|
61
79
|
var _query$matches;
|
|
62
80
|
// The default is `false`, and desktop will remain as `false` (no re-render).
|
|
63
81
|
// Mobile will flip from `false` to `true`.
|
|
64
|
-
|
|
82
|
+
setIsMobileViewport((_query$matches = query === null || query === void 0 ? void 0 : query.matches) !== null && _query$matches !== void 0 ? _query$matches : false);
|
|
65
83
|
}, [query]);
|
|
84
|
+
var isMobile = (_breakpoints$belowSm = breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.belowSm) !== null && _breakpoints$belowSm !== void 0 ? _breakpoints$belowSm : isMobileViewport;
|
|
85
|
+
var _useTopNavEndFocus = useTopNavEndFocus({
|
|
86
|
+
isMobile: isMobile,
|
|
87
|
+
enabled: fg('platform-dst-chat-panel-layout')
|
|
88
|
+
}),
|
|
89
|
+
actionsRef = _useTopNavEndFocus.actionsRef,
|
|
90
|
+
triggerRef = _useTopNavEndFocus.triggerRef,
|
|
91
|
+
onFocusCapture = _useTopNavEndFocus.onFocusCapture;
|
|
92
|
+
useLayoutEffect(function () {
|
|
93
|
+
if (fg('platform-dst-chat-panel-layout') && hasContainerBreakpoints) {
|
|
94
|
+
setIsOpen(false);
|
|
95
|
+
}
|
|
96
|
+
}, [isMobile, hasContainerBreakpoints]);
|
|
66
97
|
|
|
67
98
|
// The shared provider also covers the mobile overflow popup itself. Keep the
|
|
68
99
|
// previous content-only namespace coverage when the layout gate is disabled.
|
|
@@ -70,10 +101,7 @@ export function TopNavEnd(_ref) {
|
|
|
70
101
|
var actions = fg('platform-dst-chat-panel-layout') || fg('platform-dst-top-layer') ? children : /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
71
102
|
namespace: openLayerObserverTopNavEndNamespace
|
|
72
103
|
}, children);
|
|
73
|
-
var
|
|
74
|
-
"aria-label": label,
|
|
75
|
-
className: ax([containerStyles.root, hasPersistentItems && containerStyles.withPersistentItems])
|
|
76
|
-
}, isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
104
|
+
var regularActions = isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
77
105
|
isOpen: isOpen,
|
|
78
106
|
onClose: function onClose() {
|
|
79
107
|
return setIsOpen(false);
|
|
@@ -88,11 +116,13 @@ export function TopNavEnd(_ref) {
|
|
|
88
116
|
return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
89
117
|
value: false
|
|
90
118
|
}, /*#__PURE__*/React.createElement(List, {
|
|
119
|
+
ref: actionsRef,
|
|
91
120
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
92
121
|
}, actions));
|
|
93
122
|
},
|
|
94
123
|
trigger: function trigger(triggerProps) {
|
|
95
124
|
return /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
125
|
+
ref: fg('platform-dst-chat-panel-layout') ? mergeRefs([triggerProps.ref, triggerRef]) : triggerProps.ref,
|
|
96
126
|
label: showMoreButtonLabel,
|
|
97
127
|
isSelected: isOpen,
|
|
98
128
|
onClick: function onClick() {
|
|
@@ -103,8 +133,16 @@ export function TopNavEnd(_ref) {
|
|
|
103
133
|
}));
|
|
104
134
|
}
|
|
105
135
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
ref: actionsRef,
|
|
137
|
+
xcss: cx(listStyles.root, fg('platform-dst-chat-panel-layout') ? listStyles.container : listStyles.hideOnSmallViewport)
|
|
138
|
+
}, actions);
|
|
139
|
+
var content = /*#__PURE__*/React.createElement("nav", {
|
|
140
|
+
"aria-label": label,
|
|
141
|
+
className: ax([containerStyles.root, fg('platform-dst-chat-panel-layout') ? containerStyles.container : containerStyles.viewport, hasPersistentItems && containerStyles.withPersistentItems])
|
|
142
|
+
}, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
onFocusCapture: onFocusCapture,
|
|
144
|
+
className: ax([containerStyles.focusScope])
|
|
145
|
+
}, regularActions) : regularActions, hasPersistentItems && persistentItems);
|
|
108
146
|
return fg('platform-dst-chat-panel-layout') && !fg('platform-dst-top-layer') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
109
147
|
namespace: openLayerObserverTopNavEndNamespace
|
|
110
148
|
}, 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)}}
|
|
@@ -6,7 +6,9 @@ import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/open-laye
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
import { openLayerObserverTopNavMiddleNamespace } from '../constants';
|
|
8
8
|
var styles = {
|
|
9
|
-
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0
|
|
9
|
+
root: "_zulpu2gc _yyhycs5v _1bsb1osq _4cvr1h6o _1e0c1txw _1bahh9n0",
|
|
10
|
+
container: "_1e0cqgwa _yv0e15b0 _wij21bp4 _1eji1ris _6a6zh9n0 _181n1pe1",
|
|
11
|
+
viewport: "_181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0"
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -20,7 +22,7 @@ var styles = {
|
|
|
20
22
|
export function TopNavMiddle(_ref) {
|
|
21
23
|
var children = _ref.children;
|
|
22
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
className: ax([styles.root])
|
|
25
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewport])
|
|
24
26
|
}, fg('platform-dst-top-layer') ? children : /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
25
27
|
namespace: openLayerObserverTopNavMiddleNamespace
|
|
26
28
|
}, 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)}}
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import "./top-nav-start.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
6
|
import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-attach-ref';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Styles for the TopNavStart element.
|
|
9
10
|
*/
|
|
11
|
+
|
|
10
12
|
var innerStyles = {
|
|
11
|
-
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw
|
|
13
|
+
root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw",
|
|
14
|
+
container: "_1bsb14ik _1ul91wqq _vchhusvi _gltexl30 _15ritp0n",
|
|
15
|
+
viewport: "_glte1ris _15rip2n4 _1gs5usvi"
|
|
12
16
|
};
|
|
13
17
|
/**
|
|
14
18
|
* __TopNavStart__
|
|
@@ -30,6 +34,6 @@ export function TopNavStart(_ref) {
|
|
|
30
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
31
35
|
ref: elementRef,
|
|
32
36
|
"data-testid": testId,
|
|
33
|
-
className: ax([innerStyles.root])
|
|
37
|
+
className: ax([innerStyles.root, fg('platform-dst-chat-panel-layout') ? innerStyles.container : innerStyles.viewport])
|
|
34
38
|
}, sideNavToggleButton, children);
|
|
35
39
|
}
|
|
@@ -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,8 +1,9 @@
|
|
|
1
1
|
/* top-nav.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import "./top-nav.compiled.css";
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useContext } from 'react';
|
|
6
|
+
import { startTransition, useCallback, useContext, useState } from 'react';
|
|
6
7
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react/component-with-fg';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
9
|
import { useSkipLinkInternal } from '../../../context/skip-links/use-skip-link-internal';
|
|
@@ -15,6 +16,8 @@ import { DangerouslyHoistCssVarToDocumentRoot } from '../dangerously-hoist-css-v
|
|
|
15
16
|
import { HoistCssVarToLocalGrid } from '../hoist-css-var-to-local-grid';
|
|
16
17
|
import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
|
|
17
18
|
import { useLayoutId } from '../use-layout-id';
|
|
19
|
+
import { TopNavElementContext } from './top-nav-element-context';
|
|
20
|
+
import { useMeasuredTopNavBreakpoints } from './use-measured-top-nav-breakpoints';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Styles for the container for the top nav items.
|
|
@@ -25,7 +28,11 @@ import { useLayoutId } from '../use-layout-id';
|
|
|
25
28
|
* - The background sits below the expanded side nav
|
|
26
29
|
*/
|
|
27
30
|
var styles = {
|
|
28
|
-
|
|
31
|
+
remProbe: "_kqswstnw _3um015vq _lcxvglyw _1bsb1j6v _4t3iidpf",
|
|
32
|
+
root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi",
|
|
33
|
+
viewportLayout: "_1j8b18ax",
|
|
34
|
+
container: "_18zridpf _1f38jrq2 _7cca15wb _1ul9idpf _1e0c1ule",
|
|
35
|
+
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"
|
|
29
36
|
};
|
|
30
37
|
/**
|
|
31
38
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
@@ -39,6 +46,27 @@ function TopNavOld(_ref) {
|
|
|
39
46
|
testId = _ref.testId,
|
|
40
47
|
providedId = _ref.id,
|
|
41
48
|
customThemeConfig = _ref.customTheme;
|
|
49
|
+
var _useState = useState(null),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
topNavElement = _useState2[0],
|
|
52
|
+
setTopNavElement = _useState2[1];
|
|
53
|
+
var _useState3 = useState(null),
|
|
54
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
+
remProbe = _useState4[0],
|
|
56
|
+
setRemProbe = _useState4[1];
|
|
57
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
58
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
59
|
+
var topNavRef = useCallback(function (element) {
|
|
60
|
+
startTransition(function () {
|
|
61
|
+
return setTopNavElement(element);
|
|
62
|
+
});
|
|
63
|
+
}, []);
|
|
64
|
+
var remProbeRef = useCallback(function (element) {
|
|
65
|
+
startTransition(function () {
|
|
66
|
+
return setRemProbe(element);
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
var breakpoints = useMeasuredTopNavBreakpoints(topNavElement, remProbe);
|
|
42
70
|
var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
43
71
|
var id = useLayoutId({
|
|
44
72
|
providedId: providedId
|
|
@@ -53,14 +81,19 @@ function TopNavOld(_ref) {
|
|
|
53
81
|
return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
54
82
|
value: customTheme.isEnabled
|
|
55
83
|
}, /*#__PURE__*/React.createElement("header", {
|
|
84
|
+
ref: fg('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
56
85
|
id: id,
|
|
57
86
|
"data-layout-slot": true,
|
|
58
|
-
className: ax([styles.root, xcss]),
|
|
87
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
59
88
|
"data-testid": testId
|
|
60
89
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
61
90
|
,
|
|
62
91
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
63
|
-
}, /*#__PURE__*/React.createElement(
|
|
92
|
+
}, fg('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
93
|
+
ref: remProbeRef,
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
className: ax([styles.remProbe])
|
|
96
|
+
}), /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
|
|
64
97
|
variableName: topNavMountedVar,
|
|
65
98
|
value: height
|
|
66
99
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -73,7 +106,11 @@ function TopNavOld(_ref) {
|
|
|
73
106
|
value: height
|
|
74
107
|
})
|
|
75
108
|
// ------ END UNSAFE STYLES ------
|
|
76
|
-
,
|
|
109
|
+
, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(TopNavElementContext.Provider, {
|
|
110
|
+
value: breakpoints
|
|
111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: ax([styles.containerLayout])
|
|
113
|
+
}, children)) : children));
|
|
77
114
|
}
|
|
78
115
|
|
|
79
116
|
/**
|
|
@@ -88,6 +125,27 @@ function TopNavNew(_ref2) {
|
|
|
88
125
|
testId = _ref2.testId,
|
|
89
126
|
providedId = _ref2.id,
|
|
90
127
|
customThemeConfig = _ref2.customTheme;
|
|
128
|
+
var _useState5 = useState(null),
|
|
129
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
130
|
+
topNavElement = _useState6[0],
|
|
131
|
+
setTopNavElement = _useState6[1];
|
|
132
|
+
var _useState7 = useState(null),
|
|
133
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
134
|
+
remProbe = _useState8[0],
|
|
135
|
+
setRemProbe = _useState8[1];
|
|
136
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
137
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
138
|
+
var topNavRef = useCallback(function (element) {
|
|
139
|
+
startTransition(function () {
|
|
140
|
+
return setTopNavElement(element);
|
|
141
|
+
});
|
|
142
|
+
}, []);
|
|
143
|
+
var remProbeRef = useCallback(function (element) {
|
|
144
|
+
startTransition(function () {
|
|
145
|
+
return setRemProbe(element);
|
|
146
|
+
});
|
|
147
|
+
}, []);
|
|
148
|
+
var breakpoints = useMeasuredTopNavBreakpoints(topNavElement, remProbe);
|
|
91
149
|
var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
92
150
|
var id = useLayoutId({
|
|
93
151
|
providedId: providedId
|
|
@@ -105,14 +163,19 @@ function TopNavNew(_ref2) {
|
|
|
105
163
|
}, /*#__PURE__*/React.createElement(HasDefaultBackgroundColorContext.Provider, {
|
|
106
164
|
value: hasDefaultBackground
|
|
107
165
|
}, /*#__PURE__*/React.createElement("header", {
|
|
166
|
+
ref: fg('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
108
167
|
id: id,
|
|
109
168
|
"data-layout-slot": true,
|
|
110
|
-
className: ax([styles.root, xcss]),
|
|
169
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
111
170
|
"data-testid": testId
|
|
112
171
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
113
172
|
,
|
|
114
173
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
115
|
-
}, /*#__PURE__*/React.createElement(
|
|
174
|
+
}, fg('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
175
|
+
ref: remProbeRef,
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
className: ax([styles.remProbe])
|
|
178
|
+
}), /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
|
|
116
179
|
variableName: topNavMountedVar,
|
|
117
180
|
value: height
|
|
118
181
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -125,7 +188,11 @@ function TopNavNew(_ref2) {
|
|
|
125
188
|
value: height
|
|
126
189
|
})
|
|
127
190
|
// ------ END UNSAFE STYLES ------
|
|
128
|
-
,
|
|
191
|
+
, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(TopNavElementContext.Provider, {
|
|
192
|
+
value: breakpoints
|
|
193
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
className: ax([styles.containerLayout])
|
|
195
|
+
}, children)) : children)));
|
|
129
196
|
}
|
|
130
197
|
|
|
131
198
|
/**
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
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; } } }; }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
import { startTransition, useState } from 'react';
|
|
6
|
+
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
7
|
+
export function useMeasuredTopNavBreakpoints(topNav, remProbe) {
|
|
8
|
+
var _useState = useState({
|
|
9
|
+
belowSm: false
|
|
10
|
+
}),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
breakpoints = _useState2[0],
|
|
13
|
+
setBreakpoints = _useState2[1];
|
|
14
|
+
useLayoutEffect(function () {
|
|
15
|
+
var view = topNav === null || topNav === void 0 ? void 0 : topNav.ownerDocument.defaultView;
|
|
16
|
+
if (!topNav || !view) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var updateWidth = function updateWidth(width) {
|
|
20
|
+
var rootFontSize = parseFloat(view.getComputedStyle(topNav.ownerDocument.documentElement).fontSize) || 16;
|
|
21
|
+
var belowSm = width < 48 * rootFontSize;
|
|
22
|
+
// Navigation can still be hydrating inside Suspense. An urgent context
|
|
23
|
+
// update would discard its server DOM and show the loading fallback.
|
|
24
|
+
startTransition(function () {
|
|
25
|
+
setBreakpoints(function (previous) {
|
|
26
|
+
return previous.belowSm === belowSm ? previous : {
|
|
27
|
+
belowSm: belowSm
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var width = topNav.getBoundingClientRect().width;
|
|
33
|
+
updateWidth(width);
|
|
34
|
+
if (!view.ResizeObserver) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var observer = new view.ResizeObserver(function (entries) {
|
|
38
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
39
|
+
_step;
|
|
40
|
+
try {
|
|
41
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
42
|
+
var entry = _step.value;
|
|
43
|
+
if (entry.target === topNav) {
|
|
44
|
+
var _entry$borderBoxSize$, _entry$borderBoxSize;
|
|
45
|
+
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;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// The rem probe resizes when the root font changes, even if the header
|
|
49
|
+
// stays the same pixel width. Reevaluate against the last measured width.
|
|
50
|
+
} catch (err) {
|
|
51
|
+
_iterator.e(err);
|
|
52
|
+
} finally {
|
|
53
|
+
_iterator.f();
|
|
54
|
+
}
|
|
55
|
+
updateWidth(width);
|
|
56
|
+
});
|
|
57
|
+
observer.observe(topNav, {
|
|
58
|
+
box: 'border-box'
|
|
59
|
+
});
|
|
60
|
+
if (remProbe) {
|
|
61
|
+
observer.observe(remProbe);
|
|
62
|
+
}
|
|
63
|
+
return function () {
|
|
64
|
+
return observer.disconnect();
|
|
65
|
+
};
|
|
66
|
+
}, [topNav, remProbe]);
|
|
67
|
+
return breakpoints;
|
|
68
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { TopNavElementContext } from './top-nav-element-context';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Private breakpoint state for React rendering (overflow and responsive buttons).
|
|
6
|
+
* Presentation is handled by TopNav container queries, independently of this hook.
|
|
7
|
+
* Returns null outside TopNav or when platform-dst-chat-panel-layout is disabled.
|
|
8
|
+
* SSR and initial hydration use the expanded presentation. Measurements are published
|
|
9
|
+
* in a transition so suspended navigation can finish hydrating without losing its
|
|
10
|
+
* server DOM. All consumers share one observer on TopNav.
|
|
11
|
+
*/
|
|
12
|
+
export function useTopNavBreakpoints() {
|
|
13
|
+
return useContext(TopNavElementContext);
|
|
14
|
+
}
|