@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ThemedIconButton = void 0;
|
|
10
|
+
require("./themed-icon-button.compiled.css");
|
|
10
11
|
var _runtime = require("@compiled/react/runtime");
|
|
11
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -16,66 +17,78 @@ var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
|
16
17
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
17
18
|
var _iconRenderer = _interopRequireDefault(require("../icon-renderer"));
|
|
18
19
|
var _themedPressable = require("./themed-pressable");
|
|
19
|
-
var _excluded = ["icon", "label", "tooltip"];
|
|
20
|
+
var _excluded = ["icon", "label", "tooltip", "isTooltipDisabled", "shouldShowLabel"];
|
|
20
21
|
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); }
|
|
22
|
+
var styles = {
|
|
23
|
+
label: "_k48p1wq8"
|
|
24
|
+
};
|
|
21
25
|
var ThemedIconButton = exports.ThemedIconButton = /*#__PURE__*/(0, _react.forwardRef)(function ThemedIconButton(_ref, ref) {
|
|
22
26
|
var _tooltip$content;
|
|
23
27
|
var Icon = _ref.icon,
|
|
24
28
|
label = _ref.label,
|
|
25
29
|
tooltip = _ref.tooltip,
|
|
30
|
+
isTooltipDisabled = _ref.isTooltipDisabled,
|
|
31
|
+
_ref$shouldShowLabel = _ref.shouldShowLabel,
|
|
32
|
+
shouldShowLabel = _ref$shouldShowLabel === void 0 ? false : _ref$shouldShowLabel,
|
|
26
33
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
34
|
+
return (
|
|
35
|
+
/*#__PURE__*/
|
|
36
|
+
// Keep the trigger mounted when tooltip availability changes so focus is preserved.
|
|
37
|
+
_react.default.createElement(_Tooltip.default, (0, _extends2.default)({}, tooltip, {
|
|
38
|
+
content: isTooltipDisabled || shouldShowLabel ? null : (_tooltip$content = tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) !== null && _tooltip$content !== void 0 ? _tooltip$content : label
|
|
39
|
+
}), function (triggerProps) {
|
|
40
|
+
return (
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
/**
|
|
43
|
+
* The `aria-describedby` from `triggerProps` is intentionally not passed down,
|
|
44
|
+
* because it would cause double announcements with the `VisuallyHidden` label.
|
|
45
|
+
*
|
|
46
|
+
* The `@atlaskit/button` IconButton uses the same approach.
|
|
47
|
+
*/
|
|
48
|
+
_react.default.createElement(_themedPressable.ThemedPressable, (0, _extends2.default)({}, props, {
|
|
49
|
+
shape: shouldShowLabel ? 'default' : 'square',
|
|
50
|
+
ref: (0, _mergeRefs.default)([ref, triggerProps.ref]),
|
|
51
|
+
onClick: function onClick(event, analyticsEvent) {
|
|
52
|
+
var _props$onClick, _triggerProps$onClick;
|
|
53
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event, analyticsEvent);
|
|
54
|
+
triggerProps === null || triggerProps === void 0 || (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 || _triggerProps$onClick.call(triggerProps, event);
|
|
55
|
+
},
|
|
56
|
+
onMouseOver: function onMouseOver(e) {
|
|
57
|
+
var _triggerProps$onMouse, _props$onMouseOver;
|
|
58
|
+
(_triggerProps$onMouse = triggerProps.onMouseOver) === null || _triggerProps$onMouse === void 0 || _triggerProps$onMouse.call(triggerProps, e);
|
|
59
|
+
(_props$onMouseOver = props.onMouseOver) === null || _props$onMouseOver === void 0 || _props$onMouseOver.call(props, e);
|
|
60
|
+
},
|
|
61
|
+
onMouseOut: function onMouseOut(e) {
|
|
62
|
+
var _triggerProps$onMouse2, _props$onMouseOut;
|
|
63
|
+
(_triggerProps$onMouse2 = triggerProps.onMouseOut) === null || _triggerProps$onMouse2 === void 0 || _triggerProps$onMouse2.call(triggerProps, e);
|
|
64
|
+
(_props$onMouseOut = props.onMouseOut) === null || _props$onMouseOut === void 0 || _props$onMouseOut.call(props, e);
|
|
65
|
+
},
|
|
66
|
+
onMouseMove: function onMouseMove(e) {
|
|
67
|
+
var _triggerProps$onMouse3, _props$onMouseMove;
|
|
68
|
+
(_triggerProps$onMouse3 = triggerProps.onMouseMove) === null || _triggerProps$onMouse3 === void 0 || _triggerProps$onMouse3.call(triggerProps, e);
|
|
69
|
+
(_props$onMouseMove = props.onMouseMove) === null || _props$onMouseMove === void 0 || _props$onMouseMove.call(props, e);
|
|
70
|
+
},
|
|
71
|
+
onMouseDown: function onMouseDown(e) {
|
|
72
|
+
var _triggerProps$onMouse4, _props$onMouseDown;
|
|
73
|
+
(_triggerProps$onMouse4 = triggerProps.onMouseDown) === null || _triggerProps$onMouse4 === void 0 || _triggerProps$onMouse4.call(triggerProps, e);
|
|
74
|
+
(_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 || _props$onMouseDown.call(props, e);
|
|
75
|
+
},
|
|
76
|
+
onFocus: function onFocus(e) {
|
|
77
|
+
var _triggerProps$onFocus, _props$onFocus;
|
|
78
|
+
(_triggerProps$onFocus = triggerProps.onFocus) === null || _triggerProps$onFocus === void 0 || _triggerProps$onFocus.call(triggerProps, e);
|
|
79
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, e);
|
|
80
|
+
},
|
|
81
|
+
onBlur: function onBlur(e) {
|
|
82
|
+
var _triggerProps$onBlur, _props$onBlur;
|
|
83
|
+
(_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 || _triggerProps$onBlur.call(triggerProps, e);
|
|
84
|
+
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
85
|
+
}
|
|
86
|
+
}), /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
87
|
+
icon: Icon
|
|
88
|
+
}), shouldShowLabel ? /*#__PURE__*/_react.default.createElement("span", {
|
|
89
|
+
className: (0, _runtime.ax)([styles.label])
|
|
90
|
+
}, label) : /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label))
|
|
91
|
+
);
|
|
92
|
+
})
|
|
93
|
+
);
|
|
81
94
|
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
._1tv3nqa1:after{border-style:solid}
|
|
15
15
|
._39yqe4h9:after{border-width:var(--ds-border-width,1px)}
|
|
16
16
|
._8l3m15jn:after{border-color:var(--ds-top-bar-button-selected-border)}
|
|
17
|
-
.
|
|
17
|
+
._8l3m4il5:after{border-color:var(--ds-top-bar-button-disabled-border,transparent)}
|
|
18
18
|
._8l3maykr:after{border-color:var(--ds-top-bar-button-border)}
|
|
19
19
|
._18postnw:after{position:absolute}
|
|
20
20
|
._1bah1h6o{justify-content:center}
|
|
@@ -21,7 +21,7 @@ var styles = {
|
|
|
21
21
|
root: "_zulp12x7 _11c8fhey _2rko1qi0 _v564k6bl _4bfu1r31 _1hmsglyw _ajmmnqa1 _1rjcze3t _1e0c1txw _4cvr1h6o _1bah1h6o _4t3i5r7u _kqswh2mm _1nrm1r31 _1a3b1r31 _9oik1r31 _c2waglyw _4fprglyw _1bnxglyw _1iohnqa1 _5goinqa1 _jf4cnqa1 _1ggl5xtf",
|
|
22
22
|
border: "_14mj1kw7 _9v7aze3t _1tv3nqa1 _39yqe4h9 _aetrb3bt _18postnw",
|
|
23
23
|
selected: "_11q71qds _syazw5ct _8l3m15jn _f8pjw5ct _1053w5ct _19lcjrv1 _30l3w5ct _j6xtnh62 _9h8hw5ct",
|
|
24
|
-
disabled: "_11q71c9b _syaz1i3i
|
|
24
|
+
disabled: "_11q71c9b _syaz1i3i _8l3m4il5 _f8pj1i3i _10531i3i _19lc1c9b _30l31i3i _j6xt1c9b _9h8h1i3i"
|
|
25
25
|
};
|
|
26
26
|
var shapeStyles = {
|
|
27
27
|
default: "_18zrutpp",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResponsiveButton as ResponsiveTopNavButton } from '../../ui/top-nav-items/responsive-button';
|
|
@@ -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)}}
|
|
@@ -3,7 +3,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./top-nav-end.compiled.css";
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
// Compiled supports the inherited container-layout widths outside @atlaskit/css's bounded values.
|
|
6
8
|
import { cx } from '@compiled/react';
|
|
9
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
7
10
|
import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
|
|
8
11
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
9
12
|
import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/open-layer-observer-namespace-provider';
|
|
@@ -14,12 +17,18 @@ import { List } from '../../../components/list';
|
|
|
14
17
|
import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
|
|
15
18
|
import { IconButton } from '../../top-nav-items/themed/icon-button';
|
|
16
19
|
import { openLayerObserverTopNavEndNamespace } from '../constants';
|
|
20
|
+
import { useTopNavBreakpoints } from './use-top-nav-breakpoints';
|
|
21
|
+
import { useTopNavEndFocus } from './use-top-nav-end-focus';
|
|
17
22
|
const containerStyles = {
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
focusScope: "_1e0c1bgi",
|
|
24
|
+
root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg",
|
|
25
|
+
withPersistentItems: "_zulpu2gc _4cvr1h6o",
|
|
26
|
+
container: "_1bsb14ik _1ul98ox3 _vchhusvi _10fph9n0 _1d2yioy8 _gltexl30 _15riwpqv",
|
|
27
|
+
viewport: "_1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0"
|
|
20
28
|
};
|
|
21
29
|
const listStyles = {
|
|
22
30
|
root: "_zulp1b66 _4cvr1h6o _1e0c1txw",
|
|
31
|
+
container: "_1e0c1cgg _181nz5ha",
|
|
23
32
|
hideOnSmallViewport: "_1e0cglyw _181n1txw",
|
|
24
33
|
popupContainer: "_1yt4u2gc"
|
|
25
34
|
};
|
|
@@ -38,23 +47,46 @@ export function TopNavEnd({
|
|
|
38
47
|
label = 'Actions',
|
|
39
48
|
showMoreButtonLabel = 'Show more'
|
|
40
49
|
}) {
|
|
50
|
+
var _breakpoints$belowSm;
|
|
51
|
+
const breakpoints = useTopNavBreakpoints();
|
|
52
|
+
const hasContainerBreakpoints = breakpoints != null;
|
|
41
53
|
const hasPersistentItems = fg('platform-dst-chat-panel-layout') && persistentItems != null;
|
|
42
54
|
const [isOpen, setIsOpen] = useState(false);
|
|
43
55
|
// Always setting to `false` for the initial render (will flip in an effect for mobile)
|
|
44
|
-
const [
|
|
56
|
+
const [isMobileViewport, setIsMobileViewport] = useState(false);
|
|
45
57
|
// Note: `query` is a stable value between renders
|
|
46
58
|
const query = useMediaQuery('below.sm', function onChange(event) {
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
59
|
+
setIsMobileViewport(event.matches);
|
|
60
|
+
// Container mode closes only when the effective layout changes below.
|
|
61
|
+
// Keep the existing viewport behavior outside the rollout / provider.
|
|
62
|
+
if (fg('platform-dst-chat-panel-layout')) {
|
|
63
|
+
if (!hasContainerBreakpoints) {
|
|
64
|
+
setIsOpen(false);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
setIsOpen(false);
|
|
68
|
+
}
|
|
51
69
|
});
|
|
52
70
|
useLayoutEffect(() => {
|
|
53
71
|
var _query$matches;
|
|
54
72
|
// The default is `false`, and desktop will remain as `false` (no re-render).
|
|
55
73
|
// Mobile will flip from `false` to `true`.
|
|
56
|
-
|
|
74
|
+
setIsMobileViewport((_query$matches = query === null || query === void 0 ? void 0 : query.matches) !== null && _query$matches !== void 0 ? _query$matches : false);
|
|
57
75
|
}, [query]);
|
|
76
|
+
const isMobile = (_breakpoints$belowSm = breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.belowSm) !== null && _breakpoints$belowSm !== void 0 ? _breakpoints$belowSm : isMobileViewport;
|
|
77
|
+
const {
|
|
78
|
+
actionsRef,
|
|
79
|
+
triggerRef,
|
|
80
|
+
onFocusCapture
|
|
81
|
+
} = useTopNavEndFocus({
|
|
82
|
+
isMobile,
|
|
83
|
+
enabled: fg('platform-dst-chat-panel-layout')
|
|
84
|
+
});
|
|
85
|
+
useLayoutEffect(() => {
|
|
86
|
+
if (fg('platform-dst-chat-panel-layout') && hasContainerBreakpoints) {
|
|
87
|
+
setIsOpen(false);
|
|
88
|
+
}
|
|
89
|
+
}, [isMobile, hasContainerBreakpoints]);
|
|
58
90
|
|
|
59
91
|
// The shared provider also covers the mobile overflow popup itself. Keep the
|
|
60
92
|
// previous content-only namespace coverage when the layout gate is disabled.
|
|
@@ -62,10 +94,7 @@ export function TopNavEnd({
|
|
|
62
94
|
const actions = fg('platform-dst-chat-panel-layout') || fg('platform-dst-top-layer') ? children : /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
63
95
|
namespace: openLayerObserverTopNavEndNamespace
|
|
64
96
|
}, children);
|
|
65
|
-
const
|
|
66
|
-
"aria-label": label,
|
|
67
|
-
className: ax([containerStyles.root, hasPersistentItems && containerStyles.withPersistentItems])
|
|
68
|
-
}, isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
97
|
+
const regularActions = isMobile ? /*#__PURE__*/React.createElement(Popup, {
|
|
69
98
|
isOpen: isOpen,
|
|
70
99
|
onClose: () => setIsOpen(false)
|
|
71
100
|
// Top-layer popups need a role to register as a popup with the layer observer.
|
|
@@ -77,9 +106,11 @@ export function TopNavEnd({
|
|
|
77
106
|
content: () => /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
78
107
|
value: false
|
|
79
108
|
}, /*#__PURE__*/React.createElement(List, {
|
|
109
|
+
ref: actionsRef,
|
|
80
110
|
xcss: cx(listStyles.root, listStyles.popupContainer)
|
|
81
111
|
}, actions)),
|
|
82
112
|
trigger: triggerProps => /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
113
|
+
ref: fg('platform-dst-chat-panel-layout') ? mergeRefs([triggerProps.ref, triggerRef]) : triggerProps.ref,
|
|
83
114
|
label: showMoreButtonLabel,
|
|
84
115
|
isSelected: isOpen,
|
|
85
116
|
onClick: () => setIsOpen(!isOpen),
|
|
@@ -87,8 +118,16 @@ export function TopNavEnd({
|
|
|
87
118
|
isTooltipDisabled: false
|
|
88
119
|
}))
|
|
89
120
|
}) : /*#__PURE__*/React.createElement(List, {
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
ref: actionsRef,
|
|
122
|
+
xcss: cx(listStyles.root, fg('platform-dst-chat-panel-layout') ? listStyles.container : listStyles.hideOnSmallViewport)
|
|
123
|
+
}, actions);
|
|
124
|
+
const content = /*#__PURE__*/React.createElement("nav", {
|
|
125
|
+
"aria-label": label,
|
|
126
|
+
className: ax([containerStyles.root, fg('platform-dst-chat-panel-layout') ? containerStyles.container : containerStyles.viewport, hasPersistentItems && containerStyles.withPersistentItems])
|
|
127
|
+
}, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
onFocusCapture: onFocusCapture,
|
|
129
|
+
className: ax([containerStyles.focusScope])
|
|
130
|
+
}, regularActions) : regularActions, hasPersistentItems && persistentItems);
|
|
92
131
|
return fg('platform-dst-chat-panel-layout') && !fg('platform-dst-top-layer') ? /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
93
132
|
namespace: openLayerObserverTopNavEndNamespace
|
|
94
133
|
}, 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
|
const 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
|
/**
|
|
@@ -21,7 +23,7 @@ export function TopNavMiddle({
|
|
|
21
23
|
children
|
|
22
24
|
}) {
|
|
23
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: ax([styles.root])
|
|
26
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewport])
|
|
25
27
|
}, fg('platform-dst-top-layer') ? children : /*#__PURE__*/React.createElement(OpenLayerObserverNamespaceProvider, {
|
|
26
28
|
namespace: openLayerObserverTopNavMiddleNamespace
|
|
27
29
|
}, 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
|
const 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__
|
|
@@ -31,6 +35,6 @@ export function TopNavStart({
|
|
|
31
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
36
|
ref: elementRef,
|
|
33
37
|
"data-testid": testId,
|
|
34
|
-
className: ax([innerStyles.root])
|
|
38
|
+
className: ax([innerStyles.root, fg('platform-dst-chat-panel-layout') ? innerStyles.container : innerStyles.viewport])
|
|
35
39
|
}, sideNavToggleButton, children);
|
|
36
40
|
}
|
|
@@ -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}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./top-nav.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useContext } from 'react';
|
|
5
|
+
import { startTransition, useCallback, useContext, useState } from 'react';
|
|
6
6
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react/component-with-fg';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import { useSkipLinkInternal } from '../../../context/skip-links/use-skip-link-internal';
|
|
@@ -15,6 +15,8 @@ import { DangerouslyHoistCssVarToDocumentRoot } from '../dangerously-hoist-css-v
|
|
|
15
15
|
import { HoistCssVarToLocalGrid } from '../hoist-css-var-to-local-grid';
|
|
16
16
|
import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
|
|
17
17
|
import { useLayoutId } from '../use-layout-id';
|
|
18
|
+
import { TopNavElementContext } from './top-nav-element-context';
|
|
19
|
+
import { useMeasuredTopNavBreakpoints } from './use-measured-top-nav-breakpoints';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Styles for the container for the top nav items.
|
|
@@ -25,7 +27,11 @@ import { useLayoutId } from '../use-layout-id';
|
|
|
25
27
|
* - The background sits below the expanded side nav
|
|
26
28
|
*/
|
|
27
29
|
const styles = {
|
|
28
|
-
|
|
30
|
+
remProbe: "_kqswstnw _3um015vq _lcxvglyw _1bsb1j6v _4t3iidpf",
|
|
31
|
+
root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi",
|
|
32
|
+
viewportLayout: "_1j8b18ax",
|
|
33
|
+
container: "_18zridpf _1f38jrq2 _7cca15wb _1ul9idpf _1e0c1ule",
|
|
34
|
+
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
35
|
};
|
|
30
36
|
/**
|
|
31
37
|
* The top nav layout area. It will display at the top of the screen, below the banner if one is present.
|
|
@@ -39,6 +45,17 @@ function TopNavOld({
|
|
|
39
45
|
id: providedId,
|
|
40
46
|
customTheme: customThemeConfig
|
|
41
47
|
}) {
|
|
48
|
+
const [topNavElement, setTopNavElement] = useState(null);
|
|
49
|
+
const [remProbe, setRemProbe] = useState(null);
|
|
50
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
51
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
52
|
+
const topNavRef = useCallback(element => {
|
|
53
|
+
startTransition(() => setTopNavElement(element));
|
|
54
|
+
}, []);
|
|
55
|
+
const remProbeRef = useCallback(element => {
|
|
56
|
+
startTransition(() => setRemProbe(element));
|
|
57
|
+
}, []);
|
|
58
|
+
const breakpoints = useMeasuredTopNavBreakpoints(topNavElement, remProbe);
|
|
42
59
|
const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
43
60
|
const id = useLayoutId({
|
|
44
61
|
providedId
|
|
@@ -53,14 +70,19 @@ function TopNavOld({
|
|
|
53
70
|
return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
|
|
54
71
|
value: customTheme.isEnabled
|
|
55
72
|
}, /*#__PURE__*/React.createElement("header", {
|
|
73
|
+
ref: fg('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
56
74
|
id: id,
|
|
57
75
|
"data-layout-slot": true,
|
|
58
|
-
className: ax([styles.root, xcss]),
|
|
76
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
59
77
|
"data-testid": testId
|
|
60
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
61
79
|
,
|
|
62
80
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
63
|
-
}, /*#__PURE__*/React.createElement(
|
|
81
|
+
}, fg('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
ref: remProbeRef,
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
className: ax([styles.remProbe])
|
|
85
|
+
}), /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
|
|
64
86
|
variableName: topNavMountedVar,
|
|
65
87
|
value: height
|
|
66
88
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -73,7 +95,11 @@ function TopNavOld({
|
|
|
73
95
|
value: height
|
|
74
96
|
})
|
|
75
97
|
// ------ END UNSAFE STYLES ------
|
|
76
|
-
,
|
|
98
|
+
, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(TopNavElementContext.Provider, {
|
|
99
|
+
value: breakpoints
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: ax([styles.containerLayout])
|
|
102
|
+
}, children)) : children));
|
|
77
103
|
}
|
|
78
104
|
|
|
79
105
|
/**
|
|
@@ -88,6 +114,17 @@ function TopNavNew({
|
|
|
88
114
|
id: providedId,
|
|
89
115
|
customTheme: customThemeConfig
|
|
90
116
|
}) {
|
|
117
|
+
const [topNavElement, setTopNavElement] = useState(null);
|
|
118
|
+
const [remProbe, setRemProbe] = useState(null);
|
|
119
|
+
// Ref registration must also be non-urgent while navigation is hydrating.
|
|
120
|
+
// Otherwise its ancestor update can force a pending Suspense boundary to fall back.
|
|
121
|
+
const topNavRef = useCallback(element => {
|
|
122
|
+
startTransition(() => setTopNavElement(element));
|
|
123
|
+
}, []);
|
|
124
|
+
const remProbeRef = useCallback(element => {
|
|
125
|
+
startTransition(() => setRemProbe(element));
|
|
126
|
+
}, []);
|
|
127
|
+
const breakpoints = useMeasuredTopNavBreakpoints(topNavElement, remProbe);
|
|
91
128
|
const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
|
|
92
129
|
const id = useLayoutId({
|
|
93
130
|
providedId
|
|
@@ -105,14 +142,19 @@ function TopNavNew({
|
|
|
105
142
|
}, /*#__PURE__*/React.createElement(HasDefaultBackgroundColorContext.Provider, {
|
|
106
143
|
value: hasDefaultBackground
|
|
107
144
|
}, /*#__PURE__*/React.createElement("header", {
|
|
145
|
+
ref: fg('platform-dst-chat-panel-layout') ? topNavRef : undefined,
|
|
108
146
|
id: id,
|
|
109
147
|
"data-layout-slot": true,
|
|
110
|
-
className: ax([styles.root, xcss]),
|
|
148
|
+
className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewportLayout, xcss]),
|
|
111
149
|
"data-testid": testId
|
|
112
150
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
113
151
|
,
|
|
114
152
|
style: customTheme.isEnabled ? customTheme.style : undefined
|
|
115
|
-
}, /*#__PURE__*/React.createElement(
|
|
153
|
+
}, fg('platform-dst-chat-panel-layout') && /*#__PURE__*/React.createElement("span", {
|
|
154
|
+
ref: remProbeRef,
|
|
155
|
+
"aria-hidden": "true",
|
|
156
|
+
className: ax([styles.remProbe])
|
|
157
|
+
}), /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
|
|
116
158
|
variableName: topNavMountedVar,
|
|
117
159
|
value: height
|
|
118
160
|
}), dangerouslyHoistSlotSizes &&
|
|
@@ -125,7 +167,11 @@ function TopNavNew({
|
|
|
125
167
|
value: height
|
|
126
168
|
})
|
|
127
169
|
// ------ END UNSAFE STYLES ------
|
|
128
|
-
,
|
|
170
|
+
, fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(TopNavElementContext.Provider, {
|
|
171
|
+
value: breakpoints
|
|
172
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: ax([styles.containerLayout])
|
|
174
|
+
}, children)) : children)));
|
|
129
175
|
}
|
|
130
176
|
|
|
131
177
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useTopNavBreakpoints } from './use-top-nav-breakpoints';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Use the enclosing TopNav's border-box width, matching its 48rem sm breakpoint.
|
|
5
|
+
* Until that width is measured, use an icon-only fallback: the server cannot know
|
|
6
|
+
* the container width, and text buttons can overlap at narrow widths.
|
|
7
|
+
*/
|
|
8
|
+
export function useIsCompactTopNav() {
|
|
9
|
+
const breakpoints = useTopNavBreakpoints();
|
|
10
|
+
return breakpoints ? !breakpoints.hasMeasured || breakpoints.belowSm : false;
|
|
11
|
+
}
|