@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.
Files changed (78) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/constellation/layout/code.mdx +28 -0
  3. package/dist/cjs/ui/page-layout/panel-splitter/get-panel-growth-side.js +19 -0
  4. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
  5. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
  6. package/dist/cjs/ui/page-layout/top-nav/top-nav-element-context.js +9 -0
  7. package/dist/cjs/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  8. package/dist/cjs/ui/page-layout/top-nav/top-nav-end.js +52 -15
  9. package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  10. package/dist/cjs/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  11. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  12. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +6 -2
  13. package/dist/cjs/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  14. package/dist/cjs/ui/page-layout/top-nav/top-nav.js +75 -7
  15. package/dist/cjs/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +75 -0
  16. package/dist/cjs/ui/page-layout/top-nav/use-top-nav-breakpoints.js +19 -0
  17. package/dist/cjs/ui/page-layout/top-nav/use-top-nav-end-focus.js +102 -0
  18. package/dist/cjs/ui/top-nav-items/custom-title.compiled.css +2 -1
  19. package/dist/cjs/ui/top-nav-items/custom-title.js +6 -3
  20. package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  21. package/dist/cjs/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  22. package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  23. package/dist/cjs/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  24. package/dist/cjs/ui/top-nav-items/search.compiled.css +34 -2
  25. package/dist/cjs/ui/top-nav-items/search.js +106 -11
  26. package/dist/es2019/ui/page-layout/panel-splitter/get-panel-growth-side.js +14 -0
  27. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
  28. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +22 -6
  29. package/dist/es2019/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
  30. package/dist/es2019/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  31. package/dist/es2019/ui/page-layout/top-nav/top-nav-end.js +53 -14
  32. package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  33. package/dist/es2019/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  34. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  35. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +6 -2
  36. package/dist/es2019/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  37. package/dist/es2019/ui/page-layout/top-nav/top-nav.js +54 -8
  38. package/dist/es2019/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +48 -0
  39. package/dist/es2019/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
  40. package/dist/es2019/ui/page-layout/top-nav/use-top-nav-end-focus.js +97 -0
  41. package/dist/es2019/ui/top-nav-items/custom-title.compiled.css +2 -1
  42. package/dist/es2019/ui/top-nav-items/custom-title.js +6 -3
  43. package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  44. package/dist/es2019/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  45. package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  46. package/dist/es2019/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  47. package/dist/es2019/ui/top-nav-items/search.compiled.css +34 -2
  48. package/dist/es2019/ui/top-nav-items/search.js +105 -10
  49. package/dist/esm/ui/page-layout/panel-splitter/get-panel-growth-side.js +13 -0
  50. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
  51. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
  52. package/dist/esm/ui/page-layout/top-nav/top-nav-element-context.js +3 -0
  53. package/dist/esm/ui/page-layout/top-nav/top-nav-end.compiled.css +10 -3
  54. package/dist/esm/ui/page-layout/top-nav/top-nav-end.js +53 -15
  55. package/dist/esm/ui/page-layout/top-nav/top-nav-middle.compiled.css +6 -1
  56. package/dist/esm/ui/page-layout/top-nav/top-nav-middle.js +4 -2
  57. package/dist/esm/ui/page-layout/top-nav/top-nav-start.compiled.css +5 -2
  58. package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +6 -2
  59. package/dist/esm/ui/page-layout/top-nav/top-nav.compiled.css +26 -1
  60. package/dist/esm/ui/page-layout/top-nav/top-nav.js +75 -8
  61. package/dist/esm/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.js +68 -0
  62. package/dist/esm/ui/page-layout/top-nav/use-top-nav-breakpoints.js +14 -0
  63. package/dist/esm/ui/page-layout/top-nav/use-top-nav-end-focus.js +96 -0
  64. package/dist/esm/ui/top-nav-items/custom-title.compiled.css +2 -1
  65. package/dist/esm/ui/top-nav-items/custom-title.js +6 -3
  66. package/dist/esm/ui/top-nav-items/nav-logo/app-logo.compiled.css +2 -1
  67. package/dist/esm/ui/top-nav-items/nav-logo/app-logo.js +4 -2
  68. package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.compiled.css +3 -1
  69. package/dist/esm/ui/top-nav-items/nav-logo/custom-logo.js +9 -4
  70. package/dist/esm/ui/top-nav-items/search.compiled.css +34 -2
  71. package/dist/esm/ui/top-nav-items/search.js +107 -11
  72. package/dist/types/ui/page-layout/panel-splitter/get-panel-growth-side.d.ts +10 -0
  73. package/dist/types/ui/page-layout/top-nav/top-nav-element-context.d.ts +5 -0
  74. package/dist/types/ui/page-layout/top-nav/top-nav-end.d.ts +1 -0
  75. package/dist/types/ui/page-layout/top-nav/use-measured-top-nav-breakpoints.d.ts +2 -0
  76. package/dist/types/ui/page-layout/top-nav/use-top-nav-breakpoints.d.ts +10 -0
  77. package/dist/types/ui/page-layout/top-nav/use-top-nav-end-focus.d.ts +12 -0
  78. package/package.json +10 -10
@@ -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
- root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi _1j8b18ax"
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(HoistCssVarToLocalGrid, {
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
- , children));
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(HoistCssVarToLocalGrid, {
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
- , children)));
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,48 @@
1
+ import { startTransition, useState } from 'react';
2
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
3
+ export function useMeasuredTopNavBreakpoints(topNav, remProbe) {
4
+ const [breakpoints, setBreakpoints] = useState({
5
+ belowSm: false
6
+ });
7
+ useLayoutEffect(() => {
8
+ const view = topNav === null || topNav === void 0 ? void 0 : topNav.ownerDocument.defaultView;
9
+ if (!topNav || !view) {
10
+ return;
11
+ }
12
+ const updateWidth = width => {
13
+ const rootFontSize = parseFloat(view.getComputedStyle(topNav.ownerDocument.documentElement).fontSize) || 16;
14
+ const belowSm = width < 48 * rootFontSize;
15
+ // Navigation can still be hydrating inside Suspense. An urgent context
16
+ // update would discard its server DOM and show the loading fallback.
17
+ startTransition(() => {
18
+ setBreakpoints(previous => previous.belowSm === belowSm ? previous : {
19
+ belowSm
20
+ });
21
+ });
22
+ };
23
+ let width = topNav.getBoundingClientRect().width;
24
+ updateWidth(width);
25
+ if (!view.ResizeObserver) {
26
+ return;
27
+ }
28
+ const observer = new view.ResizeObserver(entries => {
29
+ for (const entry of entries) {
30
+ if (entry.target === topNav) {
31
+ var _entry$borderBoxSize$, _entry$borderBoxSize, _entry$borderBoxSize$2;
32
+ width = (_entry$borderBoxSize$ = (_entry$borderBoxSize = entry.borderBoxSize) === null || _entry$borderBoxSize === void 0 ? void 0 : (_entry$borderBoxSize$2 = _entry$borderBoxSize[0]) === null || _entry$borderBoxSize$2 === void 0 ? void 0 : _entry$borderBoxSize$2.inlineSize) !== null && _entry$borderBoxSize$ !== void 0 ? _entry$borderBoxSize$ : topNav.getBoundingClientRect().width;
33
+ }
34
+ }
35
+ // The rem probe resizes when the root font changes, even if the header
36
+ // stays the same pixel width. Reevaluate against the last measured width.
37
+ updateWidth(width);
38
+ });
39
+ observer.observe(topNav, {
40
+ box: 'border-box'
41
+ });
42
+ if (remProbe) {
43
+ observer.observe(remProbe);
44
+ }
45
+ return () => observer.disconnect();
46
+ }, [topNav, remProbe]);
47
+ return breakpoints;
48
+ }
@@ -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
+ }
@@ -0,0 +1,97 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { bindAll } from 'bind-event-listener';
3
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
4
+ function getActions(list) {
5
+ var _list$querySelectorAl;
6
+ return Array.from((_list$querySelectorAl = list === null || list === void 0 ? void 0 : list.querySelectorAll('button, a[href], input, select, textarea, [tabindex]')) !== null && _list$querySelectorAl !== void 0 ? _list$querySelectorAl : []).filter(element => {
7
+ // In-place and top-layer popups can be DOM descendants of the list.
8
+ // Their controls must not replace the index of the action that opened them.
9
+ const layer = element.closest('[popover], [role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]');
10
+ return element.tabIndex >= 0 && !element.matches(':disabled') && element.getClientRects().length > 0 && !(layer && list !== null && list !== void 0 && list.contains(layer));
11
+ });
12
+ }
13
+
14
+ /**
15
+ * Keeps keyboard position when the regular actions move into or out of overflow.
16
+ */
17
+ export function useTopNavEndFocus({
18
+ isMobile,
19
+ enabled
20
+ }) {
21
+ const actionsRef = useRef(null);
22
+ const triggerRef = useRef(null);
23
+ const focusedElement = useRef(null);
24
+ const actionIndex = useRef(0);
25
+ const previousIsMobile = useRef(isMobile);
26
+
27
+ // React capture follows owned portals as well as DOM descendants. The scope
28
+ // includes the overflow popup's focusable shell, but excludes persistent items.
29
+ const onFocusCapture = useCallback(event => {
30
+ const target = event.target;
31
+ focusedElement.current = target;
32
+ const index = getActions(actionsRef.current).indexOf(target);
33
+ if (index >= 0) {
34
+ actionIndex.current = index;
35
+ }
36
+ }, []);
37
+ useLayoutEffect(() => {
38
+ if (!enabled) {
39
+ return;
40
+ }
41
+ return bindAll(document, [{
42
+ type: 'focusin',
43
+ listener: event => {
44
+ // Owned React focus has already been recorded in capture, including
45
+ // portaled layers. Everything else cancels the pending handoff.
46
+ if (event.target !== focusedElement.current) {
47
+ focusedElement.current = null;
48
+ }
49
+ }
50
+ }, {
51
+ type: 'focusout',
52
+ listener: event => {
53
+ if (!(event instanceof FocusEvent)) {
54
+ return;
55
+ }
56
+ const element = focusedElement.current;
57
+ if (event.target !== element) {
58
+ return;
59
+ }
60
+ if (event.relatedTarget) {
61
+ focusedElement.current = null;
62
+ return;
63
+ }
64
+ // A popup can blur its trigger during unmount, before removing its DOM.
65
+ // Wait until that commit completes to distinguish removal from explicit blur.
66
+ queueMicrotask(() => {
67
+ if (focusedElement.current === element && element !== null && element !== void 0 && element.isConnected && element.getClientRects().length) {
68
+ focusedElement.current = null;
69
+ }
70
+ });
71
+ }
72
+ }]);
73
+ }, [enabled]);
74
+
75
+ // Restore after the removed popup has released its focus trap in passive cleanup.
76
+ useEffect(() => {
77
+ var _actions$actionIndex$;
78
+ const changed = previousIsMobile.current !== isMobile;
79
+ previousIsMobile.current = isMobile;
80
+ if (!enabled || !changed) {
81
+ return;
82
+ }
83
+ const previous = focusedElement.current;
84
+ focusedElement.current = null;
85
+ if (!previous || document.activeElement !== document.body && document.activeElement !== previous) {
86
+ return;
87
+ }
88
+ const actions = getActions(actionsRef.current);
89
+ const replacement = isMobile ? triggerRef.current : (_actions$actionIndex$ = actions[actionIndex.current]) !== null && _actions$actionIndex$ !== void 0 ? _actions$actionIndex$ : actions[0];
90
+ replacement === null || replacement === void 0 ? void 0 : replacement.focus();
91
+ }, [enabled, isMobile]);
92
+ return {
93
+ actionsRef,
94
+ triggerRef,
95
+ onFocusCapture
96
+ };
97
+ }
@@ -1,6 +1,7 @@
1
1
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
2
  ._18m915vq{overflow-y:hidden}
3
3
  ._1bto1l2s{text-overflow:ellipsis}
4
+ ._1e0c1u4u{display:var(--n_tnLogoDisplay,none)}
4
5
  ._1e0cglyw{display:none}
5
6
  ._1reo15vq{overflow-x:hidden}
6
7
  ._bozg1b66{padding-inline-start:var(--ds-space-050,4px)}
@@ -8,4 +9,4 @@
8
9
  ._p12fuuw1{max-width:200px}
9
10
  ._syazazsu{color:var(--ds-text-subtle,#505258)}
10
11
  ._y4tiu2gc{padding-inline-end:var(--ds-space-100,8px)}
11
- @media (min-width:64rem){._10y41txw._10y41txw{display:flex}}
12
+ @media (min-width:64rem){._10y41txw._10y41txw{display:flex}._dm251vcx{display:var(--n_tnLogoDisplay,flex)}}
@@ -3,10 +3,13 @@ import "./custom-title.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { forwardRef } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
7
  import { useHasCustomTheme } from './themed/has-custom-theme-context';
7
8
  const styles = {
8
- root: "_1reo15vq _18m915vq _11c8fhey _o5721q9c _p12fuuw1 _1bto1l2s _bozg1b66 _y4tiu2gc _1e0cglyw _10y41txw",
9
- subtleText: "_syazazsu"
9
+ root: "_1reo15vq _18m915vq _11c8fhey _o5721q9c _p12fuuw1 _1bto1l2s _bozg1b66 _y4tiu2gc _1e0cglyw",
10
+ subtleText: "_syazazsu",
11
+ container: "_1e0c1u4u _dm251vcx",
12
+ viewport: "_10y41txw"
10
13
  };
11
14
  /**
12
15
  * __Custom title__
@@ -22,6 +25,6 @@ export const CustomTitle = /*#__PURE__*/forwardRef(function CustomTitle({
22
25
  return /*#__PURE__*/React.createElement("div", {
23
26
  ref: ref,
24
27
  "data-testid": testId,
25
- className: ax([styles.root, !hasCustomTheme && styles.subtleText])
28
+ className: ax([styles.root, fg('platform-dst-chat-panel-layout') ? styles.container : styles.viewport, !hasCustomTheme && styles.subtleText])
26
29
  }, children);
27
30
  });
@@ -3,6 +3,7 @@
3
3
  ._1bah1h6o{justify-content:center}
4
4
  ._1bsb1ris{width:max-content}
5
5
  ._1e0c1txw{display:flex}
6
+ ._1e0c1u4u{display:var(--n_tnLogoDisplay,none)}
6
7
  ._1e0cglyw{display:none}
7
8
  ._1o9zidpf{flex-shrink:0}
8
9
  ._1pfh1i6y{margin-block-start:var(--ds-space-negative-025,-2px)}
@@ -24,4 +25,4 @@
24
25
  ._irr31rps:hover{background-color:var(--ds-top-bar-button-background-hovered)}
25
26
  ._1di69yc7:active{background-color:var(--ds-background-neutral-subtle-pressed,#0b120e24)!important}
26
27
  ._1di6yhlj:active{background-color:var(--ds-top-bar-button-background-pressed)!important}
27
- @media (min-width:64rem){._10y41txw._10y41txw{display:flex}}
28
+ @media (min-width:64rem){._10y41txw._10y41txw{display:flex}._dm251vcx{display:var(--n_tnLogoDisplay,flex)}}
@@ -22,7 +22,9 @@ const iconContainerStyles = {
22
22
  root: "_1reo15vq _18m915vq _1e0c1txw _p12f1tcg _c71l1tcg"
23
23
  };
24
24
  const logoTextStyles = {
25
- root: "_1bsb1ris _p12fnklw _uiztglyw _y4tiv77o _1e0cglyw _2lx21bp4 _1bah1h6o _10y41txw"
25
+ root: "_1bsb1ris _p12fnklw _uiztglyw _y4tiv77o _1e0cglyw _2lx21bp4 _1bah1h6o",
26
+ container: "_1e0c1u4u _dm251vcx",
27
+ viewport: "_10y41txw"
26
28
  };
27
29
  const secondaryNameStyles = {
28
30
  root: "_1pfh1i6y"
@@ -77,7 +79,7 @@ export const AppLogo = ({
77
79
  }, /*#__PURE__*/React.createElement(LogoRenderer, {
78
80
  logoOrIcon: icon
79
81
  })), /*#__PURE__*/React.createElement("span", {
80
- className: ax([logoTextStyles.root])
82
+ className: ax([logoTextStyles.root, fg('platform-dst-chat-panel-layout') ? logoTextStyles.container : logoTextStyles.viewport])
81
83
  }, /*#__PURE__*/React.createElement(Tooltip, {
82
84
  content: name,
83
85
  position: "bottom",
@@ -2,7 +2,9 @@
2
2
  ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
3
  ._18zr1b66{padding-inline:var(--ds-space-050,4px)}._18m915vq{overflow-y:hidden}
4
4
  ._1e0c1txw{display:flex}
5
+ ._1e0c1u4u{display:var(--n_tnLogoDisplay,none)}
5
6
  ._1e0cglyw{display:none}
7
+ ._1e0coqrb{display:var(--n_tnIconDisplay,flex)}
6
8
  ._1jpx1f51 img{object-fit:contain}
7
9
  ._1reo15vq{overflow-x:hidden}
8
10
  ._4cvr1h6o{align-items:center}
@@ -17,4 +19,4 @@
17
19
  ._irr31rps:hover{background-color:var(--ds-top-bar-button-background-hovered)}
18
20
  ._1di69yc7:active{background-color:var(--ds-background-neutral-subtle-pressed,#0b120e24)!important}
19
21
  ._1di6yhlj:active{background-color:var(--ds-top-bar-button-background-pressed)!important}
20
- @media (min-width:64rem){._10y41txw._10y41txw{display:flex}._10y4glyw._10y4glyw{display:none}}
22
+ @media (min-width:64rem){._10y41txw._10y41txw{display:flex}._10y4glyw._10y4glyw{display:none}._dm2517mw{display:var(--n_tnIconDisplay,none)}._dm251vcx{display:var(--n_tnLogoDisplay,flex)}}
@@ -3,6 +3,7 @@ import "./custom-logo.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useEffect, useRef } from 'react';
5
5
  import { cx } from '@compiled/react';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
7
  import { Anchor } from '@atlaskit/primitives/compiled/anchor';
7
8
  import { useHasCustomTheme } from '../themed/has-custom-theme-context';
8
9
  import { LogoRenderer } from './logo-renderer';
@@ -17,10 +18,14 @@ const sharedIconOrLogoContainerStyles = {
17
18
  root: "_1reo15vq _18m915vq _18zr1b66 _bna71tcg _rtys1kw7 _1jpx1f51"
18
19
  };
19
20
  const iconContainerStyles = {
20
- root: "_1e0c1txw _p12f1tcg _vchh1ntv _10y4glyw"
21
+ root: "_1e0c1txw _p12f1tcg _vchh1ntv",
22
+ container: "_1e0coqrb _dm2517mw",
23
+ viewport: "_10y4glyw"
21
24
  };
22
25
  const logoContainerStyles = {
23
- root: "_1e0cglyw _p12fnklw _vchh1ntv _10y41txw"
26
+ root: "_1e0cglyw _p12fnklw _vchh1ntv",
27
+ container: "_1e0c1u4u _dm251vcx",
28
+ viewport: "_10y41txw"
24
29
  };
25
30
 
26
31
  /**
@@ -80,11 +85,11 @@ export const CustomLogo = ({
80
85
  xcss: cx(anchorStyles.root, anchorStyles.customLogoBorderRadius, anchorStyles.newMargin, hasCustomTheme ? anchorStyles.newInteractionStatesCustomTheming : anchorStyles.newInteractionStates),
81
86
  onClick: onClick
82
87
  }, /*#__PURE__*/React.createElement("div", {
83
- className: ax([sharedIconOrLogoContainerStyles.root, iconContainerStyles.root])
88
+ className: ax([sharedIconOrLogoContainerStyles.root, iconContainerStyles.root, fg('platform-dst-chat-panel-layout') ? iconContainerStyles.container : iconContainerStyles.viewport])
84
89
  }, /*#__PURE__*/React.createElement(LogoRenderer, {
85
90
  logoOrIcon: icon
86
91
  })), /*#__PURE__*/React.createElement("div", {
87
- className: ax([sharedIconOrLogoContainerStyles.root, logoContainerStyles.root])
92
+ className: ax([sharedIconOrLogoContainerStyles.root, logoContainerStyles.root, fg('platform-dst-chat-panel-layout') ? logoContainerStyles.container : logoContainerStyles.viewport])
88
93
  }, /*#__PURE__*/React.createElement(LogoRenderer, {
89
94
  logoOrIcon: logo
90
95
  })));
@@ -1,21 +1,53 @@
1
1
  ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
2
- ._v564k6bl{transition:var(--ds-button-hovered,background-color border-color .15s cubic-bezier(.4,1,.6,1))}._18zr12x7{padding-inline:var(--ds-space-075,6px)}
2
+ ._v564k6bl{transition:var(--ds-button-hovered,background-color border-color .15s cubic-bezier(.4,1,.6,1))}._189ee4h9{border-width:var(--ds-border-width,1px)}
3
+ ._18zr12x7{padding-inline:var(--ds-space-075,6px)}
4
+ ._18zrze3t{padding-inline:var(--ds-space-0,0)}
5
+ ._1dqonqa1{border-style:solid}
6
+ ._1h6d12f6{border-color:var(--ds-border-input-search,#0b120e24)}
7
+ ._1h6drsbi{border-color:var(--ds-border-input,#8c8f97)}
3
8
  ._1ii7kb7n{grid-row:1}
4
9
  ._1rjcze3t{padding-block:var(--ds-space-0,0)}
5
10
  ._yyhy11wp{grid-column:3}
11
+ ._yyhycs5v{grid-column:2}
6
12
  ._yyhyjvu9{grid-column:1/-1}
7
13
  ._yyhykb7n{grid-column:1}
14
+ ._18m915vq{overflow-y:hidden}
15
+ ._1bah1h6o{justify-content:center}
8
16
  ._1bsb1osq{width:100%}
17
+ ._1bsb5ymi{width:var(--n_tnSearchWidth,2pc)}
18
+ ._1bsbzwfg{width:2pc}
19
+ ._1bto1l2s{text-overflow:ellipsis}
9
20
  ._1e0c1txw{display:flex}
21
+ ._1e0c9sqe{display:var(--n_tnSearchDisplay,none)}
22
+ ._1e0cfswt{display:var(--n_tnSearchIconDisplay,flex)}
10
23
  ._1e0cglyw{display:none}
24
+ ._1reo15vq{overflow-x:hidden}
25
+ ._1ul9idpf{min-width:0}
11
26
  ._4cvr1h6o{align-items:center}
12
27
  ._4t3izwfg{height:2pc}
13
28
  ._80om1kdv{cursor:text}
29
+ ._b4h01j9a{--n_tnSearchFieldBackground:var(--ds-background-input,#fff)}
30
+ ._bfhk11rw{background-color:var(--n_tnSearchFieldBackground)}
31
+ ._bfhk1j28{background-color:transparent}
14
32
  ._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
33
+ ._bfhksikg{background-color:var(--n_tnSearchIconBackground)}
34
+ ._j1r711j1{--n_tnSearchIconBackground:var(--ds-top-bar-button-background,var(--ds-background-neutral-subtle,#00000000))}
35
+ ._o5721q9c{white-space:nowrap}
15
36
  ._p12f1kvu{max-width:680px}
37
+ ._syaz1kw7{color:inherit}
38
+ ._syaz1q3r{color:var(--ds-icon,#292a2e)}
16
39
  ._vchhusvi{box-sizing:border-box}
40
+ ._yv0e14iv{grid-template-columns:auto minmax(0,1fr) auto}
17
41
  ._yv0e1mfv{grid-template-columns:auto 1fr auto}
42
+ ._3vbcl4ek:hover{--n_tnSearchFieldBackground:var(--ds-background-input-hovered,#f8f8f8)}
43
+ ._irr311rw:hover{background-color:var(--n_tnSearchFieldBackground)}
18
44
  ._irr3l4ek:hover{background-color:var(--ds-background-input-hovered,#f8f8f8)}
45
+ ._irr3sikg:hover{background-color:var(--n_tnSearchIconBackground)}
46
+ ._ml493uto:hover{--n_tnSearchIconBackground:var(--ds-top-bar-button-background-hovered,var(--ds-background-neutral-subtle-hovered,#0515240f))}
19
47
  ._1ggl5xtf:active{transition:var(--ds-button-pressed,background-color border-color .15s cubic-bezier(.4,1,.6,1))}
48
+ ._1di611rw:active{background-color:var(--n_tnSearchFieldBackground)}
20
49
  ._1di6r01l:active{background-color:var(--ds-background-input-pressed,#fff)}
21
- @media (min-width:30rem){._114b11p5{display:grid}}
50
+ ._1di6sikg:active{background-color:var(--n_tnSearchIconBackground)}
51
+ ._1glhr01l:active{--n_tnSearchFieldBackground:var(--ds-background-input-pressed,#fff)}
52
+ ._9gm9sn0f:active{--n_tnSearchIconBackground:var(--ds-top-bar-button-background-pressed,var(--ds-background-neutral-subtle-pressed,#0b120e24))}
53
+ @media (min-width:30rem){._114b11p5{display:grid}._114b17i4{display:var(--n_tnSearchIconDisplay,none)}._114b1mwp{display:var(--n_tnSearchDisplay,grid)}._g711exps{width:var(--n_tnSearchWidth,100%)}}
@@ -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,13 @@
1
+ /**
2
+ * Returns the physical side the panel grows towards when the splitter is dragged away from it.
3
+ *
4
+ * `position: 'end'` grows towards the inline-end, which is the right in left-to-right languages, and
5
+ * `position: 'start'` grows towards the inline-start.
6
+ */
7
+ export function getPanelGrowthSide(_ref) {
8
+ var position = _ref.position,
9
+ textDirection = _ref.textDirection;
10
+ var isGrowingTowardsInlineEnd = position === 'end';
11
+ var isInlineEndOnTheRight = textDirection === 'ltr';
12
+ return isGrowingTowardsInlineEnd === isInlineEndOnTheRight ? 'right' : 'left';
13
+ }