@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,50 @@
|
|
|
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
|
+
hasMeasured: false
|
|
7
|
+
});
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
|
+
const view = topNav === null || topNav === void 0 ? void 0 : topNav.ownerDocument.defaultView;
|
|
10
|
+
if (!topNav || !view) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const updateWidth = width => {
|
|
14
|
+
const rootFontSize = parseFloat(view.getComputedStyle(topNav.ownerDocument.documentElement).fontSize) || 16;
|
|
15
|
+
const belowSm = width < 48 * rootFontSize;
|
|
16
|
+
// Navigation can still be hydrating inside Suspense. An urgent context
|
|
17
|
+
// update would discard its server DOM and show the loading fallback.
|
|
18
|
+
startTransition(() => {
|
|
19
|
+
setBreakpoints(previous => previous.hasMeasured && previous.belowSm === belowSm ? previous : {
|
|
20
|
+
belowSm,
|
|
21
|
+
hasMeasured: true
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
let width = topNav.getBoundingClientRect().width;
|
|
26
|
+
updateWidth(width);
|
|
27
|
+
if (!view.ResizeObserver) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const observer = new view.ResizeObserver(entries => {
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
if (entry.target === topNav) {
|
|
33
|
+
var _entry$borderBoxSize$, _entry$borderBoxSize, _entry$borderBoxSize$2;
|
|
34
|
+
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;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// The rem probe resizes when the root font changes, even if the header
|
|
38
|
+
// stays the same pixel width. Reevaluate against the last measured width.
|
|
39
|
+
updateWidth(width);
|
|
40
|
+
});
|
|
41
|
+
observer.observe(topNav, {
|
|
42
|
+
box: 'border-box'
|
|
43
|
+
});
|
|
44
|
+
if (remProbe) {
|
|
45
|
+
observer.observe(remProbe);
|
|
46
|
+
}
|
|
47
|
+
return () => observer.disconnect();
|
|
48
|
+
}, [topNav, remProbe]);
|
|
49
|
+
return breakpoints;
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 have no measured width. Each consumer chooses its
|
|
9
|
+
* fallback until measurement is published in a transition, allowing suspended
|
|
10
|
+
* navigation to finish hydrating without losing its server DOM. All consumers
|
|
11
|
+
* share one observer on TopNav.
|
|
12
|
+
*/
|
|
13
|
+
export function useTopNavBreakpoints() {
|
|
14
|
+
return useContext(TopNavElementContext);
|
|
15
|
+
}
|
|
@@ -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,17 +1,32 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import AddIcon from '@atlaskit/icon/core/add';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
|
+
import { ResponsiveButton } from './responsive-button';
|
|
3
5
|
import { Button } from './themed/button';
|
|
6
|
+
import { IconButton } from './themed/icon-button';
|
|
4
7
|
/**
|
|
5
8
|
* __Create button__
|
|
6
9
|
*
|
|
7
10
|
* The create button for the top navigation.
|
|
11
|
+
* With platform-dst-chat-panel-layout enabled, shows only its icon below the
|
|
12
|
+
* enclosing TopNav's 48rem breakpoint. Children remain its accessible label.
|
|
8
13
|
*/
|
|
9
14
|
export const CreateButton = /*#__PURE__*/forwardRef(({
|
|
10
15
|
children,
|
|
11
16
|
onClick,
|
|
12
17
|
testId,
|
|
13
18
|
interactionName
|
|
14
|
-
}, ref) => /*#__PURE__*/React.createElement(
|
|
19
|
+
}, ref) => fg('platform-dst-chat-panel-layout') ? /*#__PURE__*/React.createElement(ResponsiveButton, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
appearance: "primary",
|
|
22
|
+
iconButton: IconButton,
|
|
23
|
+
isTooltipDisabled: false,
|
|
24
|
+
icon: AddIcon,
|
|
25
|
+
label: children,
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
testId: testId,
|
|
28
|
+
interactionName: interactionName
|
|
29
|
+
}) : /*#__PURE__*/React.createElement(Button, {
|
|
15
30
|
ref: ref,
|
|
16
31
|
appearance: "primary",
|
|
17
32
|
iconBefore: AddIcon,
|
|
@@ -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
|
|
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
|
|
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
|
|
21
|
+
root: "_1e0c1txw _p12f1tcg _vchh1ntv",
|
|
22
|
+
container: "_1e0coqrb _dm2517mw",
|
|
23
|
+
viewport: "_10y4glyw"
|
|
21
24
|
};
|
|
22
25
|
const logoContainerStyles = {
|
|
23
|
-
root: "_1e0cglyw _p12fnklw _vchh1ntv
|
|
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
|
})));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { useIsCompactTopNav } from '../page-layout/top-nav/use-is-compact-top-nav';
|
|
4
|
+
/**
|
|
5
|
+
* An explicit responsive action: icon-only at xs/xxs, icon and label at sm and above.
|
|
6
|
+
* TopNav provides container measurements behind platform-dst-chat-panel-layout.
|
|
7
|
+
* Server markup uses an accessible icon-only fallback until client measurement.
|
|
8
|
+
* With the gate off or outside TopNav, it uses text. The button element is preserved.
|
|
9
|
+
*/
|
|
10
|
+
export const ResponsiveButton = /*#__PURE__*/forwardRef(({
|
|
11
|
+
iconButton: IconButtonComponent,
|
|
12
|
+
icon,
|
|
13
|
+
label,
|
|
14
|
+
tooltip,
|
|
15
|
+
isTooltipDisabled = false,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const isCompact = useIsCompactTopNav();
|
|
19
|
+
return /*#__PURE__*/React.createElement(IconButtonComponent, _extends({}, props, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
icon: icon,
|
|
22
|
+
label: label,
|
|
23
|
+
shouldShowLabel: !isCompact,
|
|
24
|
+
isTooltipDisabled: isTooltipDisabled,
|
|
25
|
+
tooltip: tooltip
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
@@ -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))}.
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
},
|
|
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
|
};
|
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import AkIconButton from '@atlaskit/button/icon/button';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
5
|
import { useHasCustomTheme } from './has-custom-theme-context';
|
|
6
|
+
import { ResponsiveIconButton } from './responsive-icon-button';
|
|
5
7
|
import { ThemedIconButton } from './themed-icon-button';
|
|
6
|
-
export const IconButton = /*#__PURE__*/forwardRef((
|
|
8
|
+
export const IconButton = /*#__PURE__*/forwardRef(({
|
|
9
|
+
isTooltipDisabled,
|
|
10
|
+
shouldShowLabel,
|
|
11
|
+
...props
|
|
12
|
+
}, ref) => {
|
|
7
13
|
const hasCustomTheme = useHasCustomTheme();
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
if (shouldShowLabel !== undefined) {
|
|
15
|
+
return /*#__PURE__*/React.createElement(ResponsiveIconButton, _extends({}, props, {
|
|
16
|
+
ref: ref,
|
|
17
|
+
shouldShowLabel: shouldShowLabel,
|
|
18
|
+
isTooltipDisabled: isTooltipDisabled
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
// Preserve legacy custom-theme behavior outside the chat-panel rollout.
|
|
22
|
+
return hasCustomTheme ? /*#__PURE__*/React.createElement(ThemedIconButton, _extends({
|
|
10
23
|
ref: ref
|
|
11
|
-
}, props
|
|
24
|
+
}, props, {
|
|
25
|
+
isTooltipDisabled: fg('platform-dst-chat-panel-layout') ? isTooltipDisabled : undefined
|
|
26
|
+
})) : /*#__PURE__*/React.createElement(AkIconButton, _extends({
|
|
27
|
+
ref: ref
|
|
28
|
+
}, props, {
|
|
29
|
+
isTooltipDisabled: isTooltipDisabled
|
|
30
|
+
}));
|
|
12
31
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
._11f215s3{--ds-top-bar-button-selected-background:var(--ds-background-selected,#e9f2fe)}
|
|
2
|
+
._17r4187o{--ds-top-bar-button-disabled-background:var(--ds-background-disabled,#0515240f)}
|
|
3
|
+
._17r41j28{--ds-top-bar-button-disabled-background:transparent}
|
|
4
|
+
._1a59g6ey{--ds-top-bar-button-primary-background-pressed:var(--ds-background-brand-bold-pressed,#144794)}
|
|
5
|
+
._1b56sm61{--ds-top-bar-button-background:var(--ds-background-neutral-subtle,#00000000)}
|
|
6
|
+
._1fcq1l7x{--ds-top-bar-button-border:var(--ds-border,#0b120e24)}
|
|
7
|
+
._1ir41856{--ds-top-bar-button-primary-background:var(--ds-background-brand-bold,#1868db)}
|
|
8
|
+
._1jdn1gmx{--ds-top-bar-button-disabled-text:var(--ds-text-disabled,#080f214a)}
|
|
9
|
+
._1lx4fcek{--ds-top-bar-button-background-pressed:var(--ds-background-neutral-subtle-pressed,#0b120e24)}
|
|
10
|
+
._1ugg6x5g{--ds-top-bar-button-selected-text:var(--ds-text-selected,#1868db)}
|
|
11
|
+
._1uufq98m{--ds-top-bar-button-selected-border:var(--ds-border-selected,#1868db)}
|
|
12
|
+
._1wknufnl{--ds-top-bar-button-selected-background-hovered:var(--ds-background-selected-hovered,#cfe1fd)}
|
|
13
|
+
._1wn615cr{--ds-top-bar-button-primary-text:var(--ds-text-inverse,#fff)}
|
|
14
|
+
._1y6knozp{--ds-top-bar-button-selected-background-pressed:var(--ds-background-selected-pressed,#8fb8f6)}
|
|
15
|
+
._3zkhhf2y{--ds-top-bar-button-primary-background-hovered:var(--ds-background-brand-bold-hovered,#1558bc)}
|
|
16
|
+
._rrxibk0g{--ds-top-bar-button-disabled-border:var(--ds-border-disabled,#0515240f)}
|
|
17
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
18
|
+
._y05i1dpa{--ds-top-bar-button-background-hovered:var(--ds-background-neutral-subtle-hovered,#0515240f)}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* responsive-icon-button.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./responsive-icon-button.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
|
+
|
|
7
|
+
// Custom properties adapt the existing themed control to the default ADS palette.
|
|
8
|
+
|
|
9
|
+
import { useHasCustomTheme } from './has-custom-theme-context';
|
|
10
|
+
import { ThemedIconButton } from './themed-icon-button';
|
|
11
|
+
const styles = {
|
|
12
|
+
defaultTheme: "_syazazsu _1b56sm61 _y05i1dpa _1lx4fcek _1fcq1l7x _1wn615cr _1ir41856 _3zkhhf2y _1a59g6ey _1ugg6x5g _11f215s3 _1wknufnl _1y6knozp _1uufq98m _1jdn1gmx _17r4187o",
|
|
13
|
+
neutralDisabled: "_17r41j28 _rrxibk0g"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Keep one control mounted, including its tooltip, while its label and shape change.
|
|
18
|
+
*/
|
|
19
|
+
export const ResponsiveIconButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
20
|
+
const hasCustomTheme = useHasCustomTheme();
|
|
21
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
22
|
+
className: ax([!hasCustomTheme && styles.defaultTheme, !hasCustomTheme && props.appearance !== 'primary' && styles.neutralDisabled])
|
|
23
|
+
}, /*#__PURE__*/React.createElement(ThemedIconButton, _extends({}, props, {
|
|
24
|
+
ref: ref
|
|
25
|
+
})));
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
|