@atlaskit/navigation-system 11.4.3 → 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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/layout/code.mdx +28 -0
  3. package/dist/cjs/ui/page-layout/top-nav/top-nav-element-context.js +9 -0
  4. package/dist/cjs/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  5. package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +52 -15
  6. package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  7. package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  8. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  9. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +6 -2
  10. package/dist/cjs/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  11. package/dist/cjs/ui/page-layout/top-nav/top-nav.js +75 -7
  12. package/dist/cjs/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +75 -0
  13. package/dist/cjs/ui/page-layout/top-nav/use-top-nav-breakpoints.js +19 -0
  14. package/dist/cjs/ui/page-layout/top-nav/use-top-nav-end-focus.js +102 -0
  15. package/dist/cjs/ui/top-nav-items/custom-title.compiled.css +2 -1
  16. package/dist/cjs/ui/top-nav-items/custom-title.js +6 -3
  17. package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  18. package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  19. package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  20. package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  21. package/dist/cjs/ui/top-nav-items/search.compiled.css +34 -2
  22. package/dist/cjs/ui/top-nav-items/search.js +106 -11
  23. package/dist/es2019/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
  24. package/dist/es2019/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  25. package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +53 -14
  26. package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  27. package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  28. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  29. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +6 -2
  30. package/dist/es2019/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  31. package/dist/es2019/ui/page-layout/top-nav/top-nav.js +54 -8
  32. package/dist/es2019/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +48 -0
  33. package/dist/es2019/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
  34. package/dist/es2019/ui/page-layout/top-nav/use-top-nav-end-focus.js +97 -0
  35. package/dist/es2019/ui/top-nav-items/custom-title.compiled.css +2 -1
  36. package/dist/es2019/ui/top-nav-items/custom-title.js +6 -3
  37. package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  38. package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  39. package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  40. package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  41. package/dist/es2019/ui/top-nav-items/search.compiled.css +34 -2
  42. package/dist/es2019/ui/top-nav-items/search.js +105 -10
  43. package/dist/esm/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
  44. package/dist/esm/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  45. package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +53 -15
  46. package/dist/esm/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  47. package/dist/esm/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  48. package/dist/esm/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  49. package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +6 -2
  50. package/dist/esm/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  51. package/dist/esm/ui/page-layout/top-nav/top-nav.js +75 -8
  52. package/dist/esm/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +68 -0
  53. package/dist/esm/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
  54. package/dist/esm/ui/page-layout/top-nav/use-top-nav-end-focus.js +96 -0
  55. package/dist/esm/ui/top-nav-items/custom-title.compiled.css +2 -1
  56. package/dist/esm/ui/top-nav-items/custom-title.js +6 -3
  57. package/dist/esm/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  58. package/dist/esm/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  59. package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  60. package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  61. package/dist/esm/ui/top-nav-items/search.compiled.css +34 -2
  62. package/dist/esm/ui/top-nav-items/search.js +107 -11
  63. package/dist/types/ui/page-layout/top-nav/top-nav-element-context.d.ts +5 -0
  64. package/dist/types/ui/page-layout/top-nav/top-nav-end.d.ts +1 -0
  65. package/dist/types/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.d.ts +2 -0
  66. package/dist/types/ui/page-layout/top-nav/use-top-nav-breakpoints.d.ts +10 -0
  67. package/dist/types/ui/page-layout/top-nav/use-top-nav-end-focus.d.ts +12 -0
  68. package/package.json +6 -6
@@ -2,24 +2,94 @@
2
2
  import "./search.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { Fragment } from 'react';
5
+
6
+ // Container widths and custom-theme colors need the unbounded Compiled style types.
7
+ import { cx } from '@compiled/react';
5
8
  import SearchIcon from '@atlaskit/icon/core/search';
6
9
  import { fg } from '@atlaskit/platform-feature-flags/fg';
7
10
  import { Pressable } from '@atlaskit/primitives/compiled/pressable';
8
11
  import { Show } from '@atlaskit/primitives/compiled/show';
9
12
  import { Text } from '@atlaskit/primitives/compiled/text';
13
+ import Tooltip from '@atlaskit/tooltip/Tooltip';
14
+ import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
15
+ import { useHasCustomTheme } from './themed/has-custom-theme-context';
10
16
  import { IconButton } from './themed/icon-button';
11
17
  const styles = {
12
- root: "_2rko1qi0 _v564k6bl _1rjcze3t _18zr12x7 _yv0e1mfv _4cvr1h6o _bfhk1j9a _vchhusvi _80om1kdv _1e0cglyw _4t3izwfg _p12f1kvu _1bsb1osq _irr3l4ek _1ggl5xtf _1di6r01l _114b11p5",
18
+ root: "_2rko1qi0 _v564k6bl _1rjcze3t _18zr12x7 _yv0e1mfv _4cvr1h6o _bfhk1j9a _vchhusvi _80om1kdv _4t3izwfg _p12f1kvu _1bsb1osq _irr3l4ek _1ggl5xtf _1di6r01l",
19
+ viewport: "_1e0cglyw _114b11p5",
20
+ containerBorder: "_189ee4h9 _1dqonqa1 _1h6drsbi",
21
+ containerBorderFinesse: "_1h6d12f6",
22
+ containerText: "_1reo15vq _18m915vq _yyhycs5v _1ul9idpf _1bto1l2s _o5721q9c",
13
23
  buttonText: "_yyhyjvu9 _1ii7kb7n",
14
24
  iconBefore: "_yyhykb7n _1ii7kb7n _1e0c1txw",
15
25
  elemAfter: "_yyhy11wp _1ii7kb7n _1e0c1txw"
16
26
  };
27
+ const containerStyles = {
28
+ container: "_bfhk11rw _1e0c9sqe _yv0e14iv _1ul9idpf _irr311rw _1di611rw _114b1mwp",
29
+ containerButton: "_2rko1qi0 _1rjcze3t _18zrze3t _1e0c1txw _bfhk1j28 _4t3izwfg _p12f1kvu _1ul9idpf _1bsb5ymi _syaz1kw7 _b4h01j9a _j1r711j1 _3vbcl4ek _ml493uto _1glhr01l _9gm9sn0f _g711exps",
30
+ containerIcon: "_2rko1qi0 _v564k6bl _1e0cfswt _4cvr1h6o _1bah1h6o _1bsbzwfg _4t3izwfg _syaz1q3r _bfhksikg _irr3sikg _1ggl5xtf _1di6sikg _114b17i4",
31
+ customThemeIcon: "_syaz1kw7"
32
+ };
17
33
  /**
18
- * __Search__
19
- *
20
- * The search element for the top navigation.
34
+ * Keep a single focus target through CSS presentation changes, including before hydration.
35
+ * Only the visual contents switch; no measurement or focus handoff is needed.
21
36
  */
22
- export const Search = ({
37
+ function ContainerSearch({
38
+ label,
39
+ onClick,
40
+ iconBefore: IconBefore = SearchIcon,
41
+ elemAfter,
42
+ interactionName,
43
+ 'aria-haspopup': ariaHaspopup
44
+ }) {
45
+ const hasCustomTheme = useHasCustomTheme();
46
+ const renderButton = triggerProps => /*#__PURE__*/React.createElement(Pressable, {
47
+ ref: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.ref,
48
+ onFocus: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onFocus,
49
+ onBlur: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onBlur,
50
+ onMouseOver: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onMouseOver,
51
+ onMouseOut: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onMouseOut,
52
+ onMouseMove: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onMouseMove,
53
+ onMouseDown: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.onMouseDown,
54
+ onClick: event => {
55
+ var _triggerProps$onClick;
56
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
57
+ triggerProps === null || triggerProps === void 0 ? void 0 : (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 ? void 0 : _triggerProps$onClick.call(triggerProps, event);
58
+ }
59
+ // @ts-expect-error -- The responsive width uses an inherited CSS variable outside bounded xcss values.
60
+ // Styles are co-located above; only the Pressable xcss type is imported.
61
+ // eslint-disable-next-line @compiled/no-suppress-xcss
62
+ ,
63
+ xcss: cx(containerStyles.containerButton),
64
+ interactionName: interactionName,
65
+ "aria-haspopup": ariaHaspopup
66
+ }, /*#__PURE__*/React.createElement("span", {
67
+ className: ax([styles.root, containerStyles.container, styles.containerBorder, fg('platform-dst-tokens-finesse') && styles.containerBorderFinesse])
68
+ }, /*#__PURE__*/React.createElement("span", {
69
+ className: ax([styles.iconBefore])
70
+ }, /*#__PURE__*/React.createElement(IconBefore, {
71
+ color: "var(--ds-icon-subtle, #505258)",
72
+ spacing: "spacious",
73
+ label: ""
74
+ })), /*#__PURE__*/React.createElement("span", {
75
+ className: ax([styles.buttonText, styles.containerText])
76
+ }, /*#__PURE__*/React.createElement(Text, {
77
+ color: "color.text.subtlest"
78
+ }, label)), elemAfter && /*#__PURE__*/React.createElement("span", {
79
+ className: ax([styles.elemAfter])
80
+ }, elemAfter)), /*#__PURE__*/React.createElement("span", {
81
+ className: ax([containerStyles.containerIcon, hasCustomTheme && containerStyles.customThemeIcon])
82
+ }, /*#__PURE__*/React.createElement(SearchIcon, {
83
+ color: "currentColor",
84
+ label: ""
85
+ }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
86
+ // Preserve the custom-theme label tooltip on the stable trigger.
87
+ // As with IconButton, omit aria-describedby to avoid announcing the label twice.
88
+ return hasCustomTheme ? /*#__PURE__*/React.createElement(Tooltip, {
89
+ content: label
90
+ }, renderButton) : renderButton();
91
+ }
92
+ const ViewportSearch = ({
23
93
  label,
24
94
  onClick,
25
95
  iconBefore: IconBefore = SearchIcon,
@@ -27,6 +97,14 @@ export const Search = ({
27
97
  interactionName,
28
98
  'aria-haspopup': ariaHaspopup
29
99
  }) => {
100
+ const iconButton = /*#__PURE__*/React.createElement(IconButton, {
101
+ label: label,
102
+ appearance: "subtle",
103
+ icon: SearchIcon,
104
+ onClick: onClick,
105
+ interactionName: interactionName,
106
+ "aria-haspopup": ariaHaspopup
107
+ });
30
108
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Pressable, {
31
109
  style: {
32
110
  // To win the specificity war against Emotion we move this into inline styles
@@ -36,7 +114,7 @@ export const Search = ({
36
114
  border: `${"var(--ds-border-width, 1px)"} solid ${fg('platform-dst-tokens-finesse') ? "var(--ds-border-input-search, #0B120E24)" : "var(--ds-border-input, #8C8F97)"}`
37
115
  },
38
116
  onClick: onClick,
39
- xcss: styles.root,
117
+ xcss: cx(styles.root, styles.viewport),
40
118
  interactionName: interactionName,
41
119
  "aria-haspopup": ariaHaspopup
42
120
  }, /*#__PURE__*/React.createElement("span", {
@@ -53,12 +131,29 @@ export const Search = ({
53
131
  className: ax([styles.elemAfter])
54
132
  }, elemAfter)), /*#__PURE__*/React.createElement(Show, {
55
133
  below: "xs"
56
- }, /*#__PURE__*/React.createElement(IconButton, {
134
+ }, iconButton));
135
+ };
136
+
137
+ /**
138
+ * __Search__
139
+ *
140
+ * The search element for the top navigation.
141
+ */
142
+ export const Search = ({
143
+ label,
144
+ onClick,
145
+ iconBefore,
146
+ elemAfter,
147
+ interactionName,
148
+ 'aria-haspopup': ariaHaspopup
149
+ }) => {
150
+ const Component = fg('platform-dst-chat-panel-layout') ? ContainerSearch : ViewportSearch;
151
+ return /*#__PURE__*/React.createElement(Component, {
57
152
  label: label,
58
- appearance: "subtle",
59
- icon: SearchIcon,
60
153
  onClick: onClick,
154
+ iconBefore: iconBefore,
155
+ elemAfter: elemAfter,
61
156
  interactionName: interactionName,
62
157
  "aria-haspopup": ariaHaspopup
63
- })));
158
+ });
64
159
  };
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ // Null outside a gated TopNav: consumers retain their viewport-based behaviour.
3
+ export var TopNavElementContext = /*#__PURE__*/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
- ._yyhy11wp{grid-column:3}._1bahh9n0{justify-content:end}
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
- @media (min-width:48rem){._181n1txw{display:flex}._1d2y1ris{min-width:max-content}}
9
- @media (min-width:64rem){._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._ndwch9n0{justify-self:end}}
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
- root: "_yyhy11wp _1e0c1txw _1bahh9n0 _1ul9zwfg _1d2y1ris _glte1ris _15rip2n4 _1gs5usvi _ndwch9n0",
20
- withPersistentItems: "_zulp1b66 _4cvr1h6o"
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
- isMobile = _useState4[0],
52
- setIsMobile = _useState4[1];
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
- setIsMobile(event.matches);
56
- // Any time we shift between mobile and desktop
57
- // We always close the popup
58
- setIsOpen(false);
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
- setIsMobile((_query$matches = query === null || query === void 0 ? void 0 : query.matches) !== null && _query$matches !== void 0 ? _query$matches : false);
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 content = /*#__PURE__*/React.createElement("nav", {
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
- xcss: cx(listStyles.root, listStyles.hideOnSmallViewport)
107
- }, actions), hasPersistentItems && persistentItems);
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
- @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}}
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 _181n11p5 _1j8b15b0 _lagd1bp4 _1t4c1ris _12e8h9n0"
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}._1e0c1txw{display:flex}
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
- @media (min-width:64rem){._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}}
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 _glte1ris _15rip2n4 _1gs5usvi"
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)}._152t1nws{inset-block-start:var(--n_bnrM,0)}
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
- root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi _1j8b18ax"
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(HoistCssVarToLocalGrid, {
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
- , children));
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(HoistCssVarToLocalGrid, {
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
- , children)));
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
  /**