@atlaskit/navigation-system 4.6.0 → 5.0.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 +21 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/cjs/ui/page-layout/panel-splitter/provider.js +4 -2
- package/dist/cjs/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -5
- package/dist/cjs/ui/page-layout/side-nav/side-nav-toggle-tooltip-keyboard-shortcut.js +12 -0
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +6 -1
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +7 -5
- package/dist/cjs/ui/top-nav-items/icon-renderer.js +2 -2
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/es2019/ui/page-layout/panel-splitter/provider.js +4 -2
- package/dist/es2019/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -5
- package/dist/es2019/ui/page-layout/side-nav/side-nav-toggle-tooltip-keyboard-shortcut.js +6 -0
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +6 -1
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +7 -5
- package/dist/es2019/ui/top-nav-items/icon-renderer.js +2 -2
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +4 -4
- package/dist/esm/ui/page-layout/panel-splitter/provider.js +4 -2
- package/dist/esm/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -5
- package/dist/esm/ui/page-layout/side-nav/side-nav-toggle-tooltip-keyboard-shortcut.js +6 -0
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +6 -1
- package/dist/esm/ui/page-layout/side-nav/toggle-button.js +7 -5
- package/dist/esm/ui/top-nav-items/icon-renderer.js +2 -2
- package/dist/types/ui/page-layout/panel-splitter/context.d.ts +7 -0
- package/dist/types/ui/page-layout/panel-splitter/panel-splitter.d.ts +4 -8
- package/dist/types/ui/page-layout/panel-splitter/provider.d.ts +1 -1
- package/dist/types/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +21 -3
- package/dist/types/ui/page-layout/side-nav/side-nav-toggle-tooltip-keyboard-shortcut.d.ts +6 -0
- package/dist/types/ui/page-layout/side-nav/toggle-button.d.ts +1 -7
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/context.d.ts +7 -0
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/panel-splitter.d.ts +4 -8
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/provider.d.ts +1 -1
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +21 -3
- package/dist/types-ts4.5/ui/page-layout/side-nav/side-nav-toggle-tooltip-keyboard-shortcut.d.ts +6 -0
- package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button.d.ts +1 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`ea9dfe33b50c1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ea9dfe33b50c1) -
|
|
8
|
+
Several changes have been made to the tooltip keyboard shortcut functionality:
|
|
9
|
+
- The `shortcut` prop has been removed from `SideNavToggleButton`, `PanelSplitter`, and
|
|
10
|
+
`SideNavPanelSplitter`. The keyboard shortcut used in the tooltips for these components is now
|
|
11
|
+
controlled internally for consistency, and cannot be configured. It is set to `["Ctrl", "["]`.
|
|
12
|
+
The shortcuts will only be displayed in the tooltips for `SideNavToggleButton` and
|
|
13
|
+
`SideNavPanelSplitter` when the `isSideNavShortcutEnabled` prop is enabled on the `Root`
|
|
14
|
+
component. This is behind the `navx-full-height-sidebar` feature flag - previously, the
|
|
15
|
+
`shortcuts` prop (now removed) was behind the `platform-dst-tooltip-shortcuts` feature flag.
|
|
16
|
+
|
|
17
|
+
- The `shortcuts` prop has been added to `PanelSplitterProvider`, so that layout components (e.g.
|
|
18
|
+
`SideNav`) can specify the keyboard shortcuts used for the panel splitters that are rendered
|
|
19
|
+
within them, instead of consumers needing to specify them.
|
|
20
|
+
|
|
21
|
+
- `SideNavPanelSplitter` will now only render a tooltip if `shouldCollapseOnDoubleClick` is true.
|
|
22
|
+
If it is false, the `tooltipContent` prop will be ignored.
|
|
23
|
+
|
|
3
24
|
## 4.6.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -59,7 +59,7 @@ var MaybeTooltip = function MaybeTooltip(_ref) {
|
|
|
59
59
|
var tooltipContent = _ref.tooltipContent,
|
|
60
60
|
shortcut = _ref.shortcut,
|
|
61
61
|
children = _ref.children;
|
|
62
|
-
if (
|
|
62
|
+
if (tooltipContent && (0, _platformFeatureFlags.fg)('navx-full-height-sidebar')) {
|
|
63
63
|
return /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
64
64
|
content: tooltipContent,
|
|
65
65
|
shortcut: shortcut,
|
|
@@ -348,8 +348,7 @@ var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref7) {
|
|
|
348
348
|
onResizeStart = _ref7.onResizeStart,
|
|
349
349
|
onResizeEnd = _ref7.onResizeEnd,
|
|
350
350
|
testId = _ref7.testId,
|
|
351
|
-
tooltipContent = _ref7.tooltipContent
|
|
352
|
-
shortcut = _ref7.shortcut;
|
|
351
|
+
tooltipContent = _ref7.tooltipContent;
|
|
353
352
|
var _useState7 = (0, _react.useState)(null),
|
|
354
353
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
355
354
|
panel = _useState8[0],
|
|
@@ -368,7 +367,8 @@ var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref7) {
|
|
|
368
367
|
onCompleteResize = context.onCompleteResize,
|
|
369
368
|
getResizeBounds = context.getResizeBounds,
|
|
370
369
|
resizingCssVar = context.resizingCssVar,
|
|
371
|
-
position = context.position
|
|
370
|
+
position = context.position,
|
|
371
|
+
shortcut = context.shortcut;
|
|
372
372
|
|
|
373
373
|
/**
|
|
374
374
|
* **Explanation**
|
|
@@ -24,6 +24,7 @@ var PanelSplitterProvider = exports.PanelSplitterProvider = function PanelSplitt
|
|
|
24
24
|
position = _ref$position === void 0 ? 'end' : _ref$position,
|
|
25
25
|
_ref$isEnabled = _ref.isEnabled,
|
|
26
26
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
27
|
+
shortcut = _ref.shortcut,
|
|
27
28
|
children = _ref.children;
|
|
28
29
|
var portalRef = (0, _react.useRef)(null);
|
|
29
30
|
var context = (0, _react.useMemo)(function () {
|
|
@@ -36,9 +37,10 @@ var PanelSplitterProvider = exports.PanelSplitterProvider = function PanelSplitt
|
|
|
36
37
|
position: position,
|
|
37
38
|
panelRef: panelRef,
|
|
38
39
|
isEnabled: isEnabled,
|
|
39
|
-
portalRef: portalRef
|
|
40
|
+
portalRef: portalRef,
|
|
41
|
+
shortcut: shortcut
|
|
40
42
|
};
|
|
41
|
-
}, [panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, position, portalRef, panelRef, isEnabled]);
|
|
43
|
+
}, [panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, position, portalRef, panelRef, isEnabled, shortcut]);
|
|
42
44
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_context.PanelSplitterContext.Provider, {
|
|
43
45
|
value: context
|
|
44
46
|
}, children), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -22,7 +22,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
22
22
|
* Example usage:
|
|
23
23
|
* ```tsx
|
|
24
24
|
* <SideNav>
|
|
25
|
-
* <SideNavPanelSplitter label="
|
|
25
|
+
* <SideNavPanelSplitter label="Double click to collapse" />
|
|
26
26
|
* </SideNav>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
@@ -33,8 +33,7 @@ var SideNavPanelSplitter = exports.SideNavPanelSplitter = function SideNavPanelS
|
|
|
33
33
|
testId = _ref.testId,
|
|
34
34
|
_ref$shouldCollapseOn = _ref.shouldCollapseOnDoubleClick,
|
|
35
35
|
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn,
|
|
36
|
-
tooltipContent = _ref.tooltipContent
|
|
37
|
-
shortcut = _ref.shortcut;
|
|
36
|
+
tooltipContent = _ref.tooltipContent;
|
|
38
37
|
var context = (0, _react.useContext)(_context.PanelSplitterContext);
|
|
39
38
|
(0, _tinyInvariant.default)((context === null || context === void 0 ? void 0 : context.panelId) === _constants.sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
40
39
|
var toggleSideNav = (0, _useToggleSideNav.useToggleSideNav)({
|
|
@@ -47,7 +46,9 @@ var SideNavPanelSplitter = exports.SideNavPanelSplitter = function SideNavPanelS
|
|
|
47
46
|
onResizeStart: onResizeStart,
|
|
48
47
|
onResizeEnd: onResizeEnd,
|
|
49
48
|
testId: testId,
|
|
50
|
-
tooltipContent:
|
|
51
|
-
|
|
49
|
+
tooltipContent:
|
|
50
|
+
// Only displaying the tooltip if double click to collapse is enabled.
|
|
51
|
+
// Otherwise, we would be displaying a tooltip with "Double click to collapse", when it actually won't.
|
|
52
|
+
shouldCollapseOnDoubleClick ? tooltipContent : undefined
|
|
52
53
|
}));
|
|
53
54
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sideNavToggleTooltipKeyboardShortcut = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The keyboard shortcut used in tooltips for indicating how to toggle the side nav.
|
|
9
|
+
*
|
|
10
|
+
* Used in `SideNavToggleButton` and `SideNavPanelSplitter` tooltips.
|
|
11
|
+
*/
|
|
12
|
+
var sideNavToggleTooltipKeyboardShortcut = exports.sideNavToggleTooltipKeyboardShortcut = ['Ctrl', '['];
|
|
@@ -34,6 +34,8 @@ var _useResizingWidthCssVarOnRootElement = require("../use-resizing-width-css-va
|
|
|
34
34
|
var _useSafeDefaultWidth = require("../use-safe-default-width");
|
|
35
35
|
var _elementContext = require("./element-context");
|
|
36
36
|
var _flyoutCloseDelayMs = require("./flyout-close-delay-ms");
|
|
37
|
+
var _isSideNavShortcutEnabledContext = require("./is-side-nav-shortcut-enabled-context");
|
|
38
|
+
var _sideNavToggleTooltipKeyboardShortcut = require("./side-nav-toggle-tooltip-keyboard-shortcut");
|
|
37
39
|
var _toggleButtonContext = require("./toggle-button-context");
|
|
38
40
|
var _useExpandSideNav = require("./use-expand-side-nav");
|
|
39
41
|
var _useSideNavToggleKeyboardShortcut = require("./use-side-nav-toggle-keyboard-shortcut");
|
|
@@ -650,6 +652,8 @@ function SideNavInternal(_ref) {
|
|
|
650
652
|
(0, _useSideNavToggleKeyboardShortcut.useSideNavToggleKeyboardShortcut)({
|
|
651
653
|
canToggleWithShortcut: canToggleWithShortcut
|
|
652
654
|
});
|
|
655
|
+
// Used to conditionally display the keyboard shortcut in the SideNavPanelSplitter tooltip.
|
|
656
|
+
var isShortcutEnabled = (0, _isSideNavShortcutEnabledContext.useIsSideNavShortcutEnabled)();
|
|
653
657
|
(0, _useResizingWidthCssVarOnRootElement.useResizingWidthCssVarOnRootElement)({
|
|
654
658
|
isEnabled: true,
|
|
655
659
|
cssVar: panelSplitterResizingVar,
|
|
@@ -724,7 +728,8 @@ function SideNavInternal(_ref) {
|
|
|
724
728
|
onCompleteResize: setWidth,
|
|
725
729
|
getResizeBounds: getResizeBounds,
|
|
726
730
|
resizingCssVar: panelSplitterResizingVar,
|
|
727
|
-
isEnabled: isExpandedOnDesktop && !isFlyoutVisible
|
|
731
|
+
isEnabled: isExpandedOnDesktop && !isFlyoutVisible,
|
|
732
|
+
shortcut: isShortcutEnabled ? _sideNavToggleTooltipKeyboardShortcut.sideNavToggleTooltipKeyboardShortcut : undefined
|
|
728
733
|
}, /*#__PURE__*/React.createElement("div", {
|
|
729
734
|
className: (0, _runtime.ax)([styles.flexContainer])
|
|
730
735
|
}, children)));
|
|
@@ -17,6 +17,8 @@ var _sidebarCollapse = _interopRequireDefault(require("@atlaskit/icon/core/sideb
|
|
|
17
17
|
var _sidebarExpand = _interopRequireDefault(require("@atlaskit/icon/core/sidebar-expand"));
|
|
18
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
19
|
var _migration = require("../../top-nav-items/themed/migration");
|
|
20
|
+
var _isSideNavShortcutEnabledContext = require("./is-side-nav-shortcut-enabled-context");
|
|
21
|
+
var _sideNavToggleTooltipKeyboardShortcut = require("./side-nav-toggle-tooltip-keyboard-shortcut");
|
|
20
22
|
var _toggleButtonContext = require("./toggle-button-context");
|
|
21
23
|
var _useSideNavVisibility2 = require("./use-side-nav-visibility");
|
|
22
24
|
var _useToggleSideNav = require("./use-toggle-side-nav");
|
|
@@ -45,8 +47,7 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
45
47
|
collapseLabel = _ref.collapseLabel,
|
|
46
48
|
testId = _ref.testId,
|
|
47
49
|
interactionName = _ref.interactionName,
|
|
48
|
-
onClick = _ref.onClick
|
|
49
|
-
shortcut = _ref.shortcut;
|
|
50
|
+
onClick = _ref.onClick;
|
|
50
51
|
var _useSideNavVisibility = (0, _useSideNavVisibility2.useSideNavVisibility)({
|
|
51
52
|
defaultCollapsed: defaultCollapsed
|
|
52
53
|
}),
|
|
@@ -130,14 +131,15 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
130
131
|
className: (0, _runtime.ax)(["_1e0c1bgi _lcxvglyw"])
|
|
131
132
|
}, isSideNavExpanded ? /*#__PURE__*/_react.default.createElement(_sidebarCollapse.default, props) : /*#__PURE__*/_react.default.createElement(_sidebarExpand.default, props));
|
|
132
133
|
};
|
|
134
|
+
var isShortcutEnabled = (0, _isSideNavShortcutEnabledContext.useIsSideNavShortcutEnabled)();
|
|
133
135
|
var tooltipProps = (0, _react.useMemo)(function () {
|
|
134
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
136
|
+
if ((0, _platformFeatureFlags.fg)('navx-full-height-sidebar')) {
|
|
135
137
|
return _objectSpread(_objectSpread({}, toggleButtonTooltipOptions), {}, {
|
|
136
|
-
shortcut:
|
|
138
|
+
shortcut: isShortcutEnabled ? _sideNavToggleTooltipKeyboardShortcut.sideNavToggleTooltipKeyboardShortcut : undefined
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
141
|
return toggleButtonTooltipOptions;
|
|
140
|
-
}, [
|
|
142
|
+
}, [isShortcutEnabled]);
|
|
141
143
|
return /*#__PURE__*/_react.default.createElement(_migration.IconButton, {
|
|
142
144
|
appearance: "subtle",
|
|
143
145
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -20,8 +20,8 @@ function isIconRenderProp(func) {
|
|
|
20
20
|
* __Icon renderer__
|
|
21
21
|
*
|
|
22
22
|
* Used to support render props with icons.
|
|
23
|
-
*
|
|
24
|
-
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
23
|
+
*
|
|
24
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
25
25
|
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
26
26
|
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
27
27
|
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
@@ -49,7 +49,7 @@ const MaybeTooltip = ({
|
|
|
49
49
|
shortcut,
|
|
50
50
|
children
|
|
51
51
|
}) => {
|
|
52
|
-
if (
|
|
52
|
+
if (tooltipContent && fg('navx-full-height-sidebar')) {
|
|
53
53
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
54
|
content: tooltipContent,
|
|
55
55
|
shortcut: shortcut,
|
|
@@ -327,8 +327,7 @@ export const PanelSplitter = ({
|
|
|
327
327
|
onResizeStart,
|
|
328
328
|
onResizeEnd,
|
|
329
329
|
testId,
|
|
330
|
-
tooltipContent
|
|
331
|
-
shortcut
|
|
330
|
+
tooltipContent
|
|
332
331
|
}) => {
|
|
333
332
|
const [panel, setPanel] = useState(null);
|
|
334
333
|
const [portal, setPortal] = useState(null);
|
|
@@ -343,7 +342,8 @@ export const PanelSplitter = ({
|
|
|
343
342
|
onCompleteResize,
|
|
344
343
|
getResizeBounds,
|
|
345
344
|
resizingCssVar,
|
|
346
|
-
position
|
|
345
|
+
position,
|
|
346
|
+
shortcut
|
|
347
347
|
} = context;
|
|
348
348
|
|
|
349
349
|
/**
|
|
@@ -14,6 +14,7 @@ export const PanelSplitterProvider = ({
|
|
|
14
14
|
panelRef,
|
|
15
15
|
position = 'end',
|
|
16
16
|
isEnabled = true,
|
|
17
|
+
shortcut,
|
|
17
18
|
children
|
|
18
19
|
}) => {
|
|
19
20
|
const portalRef = useRef(null);
|
|
@@ -26,8 +27,9 @@ export const PanelSplitterProvider = ({
|
|
|
26
27
|
position,
|
|
27
28
|
panelRef,
|
|
28
29
|
isEnabled,
|
|
29
|
-
portalRef
|
|
30
|
-
|
|
30
|
+
portalRef,
|
|
31
|
+
shortcut
|
|
32
|
+
}), [panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, position, portalRef, panelRef, isEnabled, shortcut]);
|
|
31
33
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(PanelSplitterContext.Provider, {
|
|
32
34
|
value: context
|
|
33
35
|
}, children), /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,7 +13,7 @@ import { PanelSplitter } from './panel-splitter';
|
|
|
13
13
|
* Example usage:
|
|
14
14
|
* ```tsx
|
|
15
15
|
* <SideNav>
|
|
16
|
-
* <SideNavPanelSplitter label="
|
|
16
|
+
* <SideNavPanelSplitter label="Double click to collapse" />
|
|
17
17
|
* </SideNav>
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
@@ -23,8 +23,7 @@ export const SideNavPanelSplitter = ({
|
|
|
23
23
|
onResizeEnd,
|
|
24
24
|
testId,
|
|
25
25
|
shouldCollapseOnDoubleClick = true,
|
|
26
|
-
tooltipContent
|
|
27
|
-
shortcut
|
|
26
|
+
tooltipContent
|
|
28
27
|
}) => {
|
|
29
28
|
const context = useContext(PanelSplitterContext);
|
|
30
29
|
invariant((context === null || context === void 0 ? void 0 : context.panelId) === sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
@@ -38,7 +37,9 @@ export const SideNavPanelSplitter = ({
|
|
|
38
37
|
onResizeStart: onResizeStart,
|
|
39
38
|
onResizeEnd: onResizeEnd,
|
|
40
39
|
testId: testId,
|
|
41
|
-
tooltipContent:
|
|
42
|
-
|
|
40
|
+
tooltipContent:
|
|
41
|
+
// Only displaying the tooltip if double click to collapse is enabled.
|
|
42
|
+
// Otherwise, we would be displaying a tooltip with "Double click to collapse", when it actually won't.
|
|
43
|
+
shouldCollapseOnDoubleClick ? tooltipContent : undefined
|
|
43
44
|
}));
|
|
44
45
|
};
|
|
@@ -23,6 +23,8 @@ import { useResizingWidthCssVarOnRootElement } from '../use-resizing-width-css-v
|
|
|
23
23
|
import { useSafeDefaultWidth } from '../use-safe-default-width';
|
|
24
24
|
import { useSideNavRef } from './element-context';
|
|
25
25
|
import { sideNavFlyoutCloseDelayMs } from './flyout-close-delay-ms';
|
|
26
|
+
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
27
|
+
import { sideNavToggleTooltipKeyboardShortcut } from './side-nav-toggle-tooltip-keyboard-shortcut';
|
|
26
28
|
import { SideNavToggleButtonElement } from './toggle-button-context';
|
|
27
29
|
import { useExpandSideNav } from './use-expand-side-nav';
|
|
28
30
|
import { useSideNavToggleKeyboardShortcut } from './use-side-nav-toggle-keyboard-shortcut';
|
|
@@ -638,6 +640,8 @@ function SideNavInternal({
|
|
|
638
640
|
useSideNavToggleKeyboardShortcut({
|
|
639
641
|
canToggleWithShortcut
|
|
640
642
|
});
|
|
643
|
+
// Used to conditionally display the keyboard shortcut in the SideNavPanelSplitter tooltip.
|
|
644
|
+
const isShortcutEnabled = useIsSideNavShortcutEnabled();
|
|
641
645
|
useResizingWidthCssVarOnRootElement({
|
|
642
646
|
isEnabled: true,
|
|
643
647
|
cssVar: panelSplitterResizingVar,
|
|
@@ -715,7 +719,8 @@ function SideNavInternal({
|
|
|
715
719
|
onCompleteResize: setWidth,
|
|
716
720
|
getResizeBounds: getResizeBounds,
|
|
717
721
|
resizingCssVar: panelSplitterResizingVar,
|
|
718
|
-
isEnabled: isExpandedOnDesktop && !isFlyoutVisible
|
|
722
|
+
isEnabled: isExpandedOnDesktop && !isFlyoutVisible,
|
|
723
|
+
shortcut: isShortcutEnabled ? sideNavToggleTooltipKeyboardShortcut : undefined
|
|
719
724
|
}, /*#__PURE__*/React.createElement("div", {
|
|
720
725
|
className: ax([styles.flexContainer])
|
|
721
726
|
}, children)));
|
|
@@ -7,6 +7,8 @@ import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
|
7
7
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
10
|
+
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
11
|
+
import { sideNavToggleTooltipKeyboardShortcut } from './side-nav-toggle-tooltip-keyboard-shortcut';
|
|
10
12
|
import { SideNavToggleButtonAttachRef } from './toggle-button-context';
|
|
11
13
|
import { useSideNavVisibility } from './use-side-nav-visibility';
|
|
12
14
|
import { useToggleSideNav } from './use-toggle-side-nav';
|
|
@@ -31,8 +33,7 @@ export const SideNavToggleButton = ({
|
|
|
31
33
|
collapseLabel,
|
|
32
34
|
testId,
|
|
33
35
|
interactionName,
|
|
34
|
-
onClick
|
|
35
|
-
shortcut
|
|
36
|
+
onClick
|
|
36
37
|
}) => {
|
|
37
38
|
const {
|
|
38
39
|
isExpandedOnDesktop: isSideNavExpandedOnDesktop,
|
|
@@ -111,15 +112,16 @@ export const SideNavToggleButton = ({
|
|
|
111
112
|
const icon = props => /*#__PURE__*/React.createElement("span", {
|
|
112
113
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
113
114
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
115
|
+
const isShortcutEnabled = useIsSideNavShortcutEnabled();
|
|
114
116
|
const tooltipProps = useMemo(() => {
|
|
115
|
-
if (fg('
|
|
117
|
+
if (fg('navx-full-height-sidebar')) {
|
|
116
118
|
return {
|
|
117
119
|
...toggleButtonTooltipOptions,
|
|
118
|
-
shortcut
|
|
120
|
+
shortcut: isShortcutEnabled ? sideNavToggleTooltipKeyboardShortcut : undefined
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
123
|
return toggleButtonTooltipOptions;
|
|
122
|
-
}, [
|
|
124
|
+
}, [isShortcutEnabled]);
|
|
123
125
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
124
126
|
appearance: "subtle",
|
|
125
127
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -13,8 +13,8 @@ function isIconRenderProp(func) {
|
|
|
13
13
|
* __Icon renderer__
|
|
14
14
|
*
|
|
15
15
|
* Used to support render props with icons.
|
|
16
|
-
*
|
|
17
|
-
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
16
|
+
*
|
|
17
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
18
18
|
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
19
19
|
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
20
20
|
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
@@ -49,7 +49,7 @@ var MaybeTooltip = function MaybeTooltip(_ref) {
|
|
|
49
49
|
var tooltipContent = _ref.tooltipContent,
|
|
50
50
|
shortcut = _ref.shortcut,
|
|
51
51
|
children = _ref.children;
|
|
52
|
-
if (
|
|
52
|
+
if (tooltipContent && fg('navx-full-height-sidebar')) {
|
|
53
53
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
54
|
content: tooltipContent,
|
|
55
55
|
shortcut: shortcut,
|
|
@@ -338,8 +338,7 @@ export var PanelSplitter = function PanelSplitter(_ref7) {
|
|
|
338
338
|
onResizeStart = _ref7.onResizeStart,
|
|
339
339
|
onResizeEnd = _ref7.onResizeEnd,
|
|
340
340
|
testId = _ref7.testId,
|
|
341
|
-
tooltipContent = _ref7.tooltipContent
|
|
342
|
-
shortcut = _ref7.shortcut;
|
|
341
|
+
tooltipContent = _ref7.tooltipContent;
|
|
343
342
|
var _useState7 = useState(null),
|
|
344
343
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
345
344
|
panel = _useState8[0],
|
|
@@ -358,7 +357,8 @@ export var PanelSplitter = function PanelSplitter(_ref7) {
|
|
|
358
357
|
onCompleteResize = context.onCompleteResize,
|
|
359
358
|
getResizeBounds = context.getResizeBounds,
|
|
360
359
|
resizingCssVar = context.resizingCssVar,
|
|
361
|
-
position = context.position
|
|
360
|
+
position = context.position,
|
|
361
|
+
shortcut = context.shortcut;
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
364
|
* **Explanation**
|
|
@@ -16,6 +16,7 @@ export var PanelSplitterProvider = function PanelSplitterProvider(_ref) {
|
|
|
16
16
|
position = _ref$position === void 0 ? 'end' : _ref$position,
|
|
17
17
|
_ref$isEnabled = _ref.isEnabled,
|
|
18
18
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
19
|
+
shortcut = _ref.shortcut,
|
|
19
20
|
children = _ref.children;
|
|
20
21
|
var portalRef = useRef(null);
|
|
21
22
|
var context = useMemo(function () {
|
|
@@ -28,9 +29,10 @@ export var PanelSplitterProvider = function PanelSplitterProvider(_ref) {
|
|
|
28
29
|
position: position,
|
|
29
30
|
panelRef: panelRef,
|
|
30
31
|
isEnabled: isEnabled,
|
|
31
|
-
portalRef: portalRef
|
|
32
|
+
portalRef: portalRef,
|
|
33
|
+
shortcut: shortcut
|
|
32
34
|
};
|
|
33
|
-
}, [panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, position, portalRef, panelRef, isEnabled]);
|
|
35
|
+
}, [panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, position, portalRef, panelRef, isEnabled, shortcut]);
|
|
34
36
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(PanelSplitterContext.Provider, {
|
|
35
37
|
value: context
|
|
36
38
|
}, children), /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,7 +13,7 @@ import { PanelSplitter } from './panel-splitter';
|
|
|
13
13
|
* Example usage:
|
|
14
14
|
* ```tsx
|
|
15
15
|
* <SideNav>
|
|
16
|
-
* <SideNavPanelSplitter label="
|
|
16
|
+
* <SideNavPanelSplitter label="Double click to collapse" />
|
|
17
17
|
* </SideNav>
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
@@ -24,8 +24,7 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
|
|
|
24
24
|
testId = _ref.testId,
|
|
25
25
|
_ref$shouldCollapseOn = _ref.shouldCollapseOnDoubleClick,
|
|
26
26
|
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn,
|
|
27
|
-
tooltipContent = _ref.tooltipContent
|
|
28
|
-
shortcut = _ref.shortcut;
|
|
27
|
+
tooltipContent = _ref.tooltipContent;
|
|
29
28
|
var context = useContext(PanelSplitterContext);
|
|
30
29
|
invariant((context === null || context === void 0 ? void 0 : context.panelId) === sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
31
30
|
var toggleSideNav = useToggleSideNav({
|
|
@@ -38,7 +37,9 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
|
|
|
38
37
|
onResizeStart: onResizeStart,
|
|
39
38
|
onResizeEnd: onResizeEnd,
|
|
40
39
|
testId: testId,
|
|
41
|
-
tooltipContent:
|
|
42
|
-
|
|
40
|
+
tooltipContent:
|
|
41
|
+
// Only displaying the tooltip if double click to collapse is enabled.
|
|
42
|
+
// Otherwise, we would be displaying a tooltip with "Double click to collapse", when it actually won't.
|
|
43
|
+
shouldCollapseOnDoubleClick ? tooltipContent : undefined
|
|
43
44
|
}));
|
|
44
45
|
};
|
|
@@ -27,6 +27,8 @@ import { useResizingWidthCssVarOnRootElement } from '../use-resizing-width-css-v
|
|
|
27
27
|
import { useSafeDefaultWidth } from '../use-safe-default-width';
|
|
28
28
|
import { useSideNavRef } from './element-context';
|
|
29
29
|
import { sideNavFlyoutCloseDelayMs } from './flyout-close-delay-ms';
|
|
30
|
+
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
31
|
+
import { sideNavToggleTooltipKeyboardShortcut } from './side-nav-toggle-tooltip-keyboard-shortcut';
|
|
30
32
|
import { SideNavToggleButtonElement } from './toggle-button-context';
|
|
31
33
|
import { useExpandSideNav } from './use-expand-side-nav';
|
|
32
34
|
import { useSideNavToggleKeyboardShortcut } from './use-side-nav-toggle-keyboard-shortcut';
|
|
@@ -640,6 +642,8 @@ function SideNavInternal(_ref) {
|
|
|
640
642
|
useSideNavToggleKeyboardShortcut({
|
|
641
643
|
canToggleWithShortcut: canToggleWithShortcut
|
|
642
644
|
});
|
|
645
|
+
// Used to conditionally display the keyboard shortcut in the SideNavPanelSplitter tooltip.
|
|
646
|
+
var isShortcutEnabled = useIsSideNavShortcutEnabled();
|
|
643
647
|
useResizingWidthCssVarOnRootElement({
|
|
644
648
|
isEnabled: true,
|
|
645
649
|
cssVar: panelSplitterResizingVar,
|
|
@@ -714,7 +718,8 @@ function SideNavInternal(_ref) {
|
|
|
714
718
|
onCompleteResize: setWidth,
|
|
715
719
|
getResizeBounds: getResizeBounds,
|
|
716
720
|
resizingCssVar: panelSplitterResizingVar,
|
|
717
|
-
isEnabled: isExpandedOnDesktop && !isFlyoutVisible
|
|
721
|
+
isEnabled: isExpandedOnDesktop && !isFlyoutVisible,
|
|
722
|
+
shortcut: isShortcutEnabled ? sideNavToggleTooltipKeyboardShortcut : undefined
|
|
718
723
|
}, /*#__PURE__*/React.createElement("div", {
|
|
719
724
|
className: ax([styles.flexContainer])
|
|
720
725
|
}, children)));
|
|
@@ -11,6 +11,8 @@ import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
|
11
11
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
14
|
+
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
15
|
+
import { sideNavToggleTooltipKeyboardShortcut } from './side-nav-toggle-tooltip-keyboard-shortcut';
|
|
14
16
|
import { SideNavToggleButtonAttachRef } from './toggle-button-context';
|
|
15
17
|
import { useSideNavVisibility } from './use-side-nav-visibility';
|
|
16
18
|
import { useToggleSideNav } from './use-toggle-side-nav';
|
|
@@ -36,8 +38,7 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
36
38
|
collapseLabel = _ref.collapseLabel,
|
|
37
39
|
testId = _ref.testId,
|
|
38
40
|
interactionName = _ref.interactionName,
|
|
39
|
-
onClick = _ref.onClick
|
|
40
|
-
shortcut = _ref.shortcut;
|
|
41
|
+
onClick = _ref.onClick;
|
|
41
42
|
var _useSideNavVisibility = useSideNavVisibility({
|
|
42
43
|
defaultCollapsed: defaultCollapsed
|
|
43
44
|
}),
|
|
@@ -121,14 +122,15 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
121
122
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
122
123
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
123
124
|
};
|
|
125
|
+
var isShortcutEnabled = useIsSideNavShortcutEnabled();
|
|
124
126
|
var tooltipProps = useMemo(function () {
|
|
125
|
-
if (fg('
|
|
127
|
+
if (fg('navx-full-height-sidebar')) {
|
|
126
128
|
return _objectSpread(_objectSpread({}, toggleButtonTooltipOptions), {}, {
|
|
127
|
-
shortcut:
|
|
129
|
+
shortcut: isShortcutEnabled ? sideNavToggleTooltipKeyboardShortcut : undefined
|
|
128
130
|
});
|
|
129
131
|
}
|
|
130
132
|
return toggleButtonTooltipOptions;
|
|
131
|
-
}, [
|
|
133
|
+
}, [isShortcutEnabled]);
|
|
132
134
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
133
135
|
appearance: "subtle",
|
|
134
136
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -13,8 +13,8 @@ function isIconRenderProp(func) {
|
|
|
13
13
|
* __Icon renderer__
|
|
14
14
|
*
|
|
15
15
|
* Used to support render props with icons.
|
|
16
|
-
*
|
|
17
|
-
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
16
|
+
*
|
|
17
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
18
18
|
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
19
19
|
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
20
20
|
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type MutableRefObject } from 'react';
|
|
2
|
+
import type { TooltipProps } from '@atlaskit/tooltip';
|
|
2
3
|
import { type ResizeBounds } from './types';
|
|
3
4
|
export type PanelSplitterContextType = {
|
|
4
5
|
/**
|
|
@@ -47,6 +48,12 @@ export type PanelSplitterContextType = {
|
|
|
47
48
|
* If `false`, the panel splitter will not be rendered.
|
|
48
49
|
*/
|
|
49
50
|
isEnabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The keyboard shortcut to display in the tooltip.
|
|
53
|
+
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
54
|
+
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
55
|
+
*/
|
|
56
|
+
shortcut?: TooltipProps['shortcut'];
|
|
50
57
|
};
|
|
51
58
|
/**
|
|
52
59
|
* Context for the panel splitter. Only internally exported.
|
|
@@ -25,17 +25,13 @@ export type PanelSplitterProps = {
|
|
|
25
25
|
testId?: string;
|
|
26
26
|
/**
|
|
27
27
|
* Displays a tooltip with the provided content.
|
|
28
|
+
*
|
|
28
29
|
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
29
30
|
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
30
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* Only used if the `navx-full-height-sidebar` feature flag is enabled.
|
|
31
33
|
*/
|
|
32
34
|
tooltipContent?: TooltipProps['content'];
|
|
33
|
-
/**
|
|
34
|
-
* The keyboard shortcut to display in the tooltip.
|
|
35
|
-
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
36
|
-
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
37
|
-
*/
|
|
38
|
-
shortcut?: TooltipProps['shortcut'];
|
|
39
35
|
};
|
|
40
36
|
type PanelSplitterDragData = {
|
|
41
37
|
panelId: string | symbol | undefined;
|
|
@@ -60,5 +56,5 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
60
56
|
* </SideNav>
|
|
61
57
|
* ```
|
|
62
58
|
*/
|
|
63
|
-
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent,
|
|
59
|
+
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, }: PanelSplitterProps) => ReactNode;
|
|
64
60
|
export {};
|
|
@@ -9,4 +9,4 @@ export type PanelSplitterProviderProps = Omit<PanelSplitterContextType, 'portalR
|
|
|
9
9
|
*
|
|
10
10
|
* Should be used in the layout area components, e.g. SideNav, Aside etc, as opposed to products.
|
|
11
11
|
*/
|
|
12
|
-
export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, panelRef, position, isEnabled, children, }: PanelSplitterProviderProps) => React.JSX.Element;
|
|
12
|
+
export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, panelRef, position, isEnabled, shortcut, children, }: PanelSplitterProviderProps) => React.JSX.Element;
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type PanelSplitterProps } from './panel-splitter';
|
|
3
|
-
type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
3
|
+
type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick' | 'tooltipContent'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the side nav should collapse on double click.
|
|
6
|
+
*
|
|
7
|
+
* If not provided, it will default to `true`.
|
|
8
|
+
*/
|
|
4
9
|
shouldCollapseOnDoubleClick?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Displays a tooltip with the provided content. It is expected to be a string that explains the double click to collapse interaction.
|
|
12
|
+
*
|
|
13
|
+
* It will only be displayed if the `shouldCollapseOnDoubleClick` prop is `true`, or not provided (as it defaults to `true`).
|
|
14
|
+
*
|
|
15
|
+
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
16
|
+
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
17
|
+
*
|
|
18
|
+
* If the `isSideNavShortcutEnabled` prop is enabled on `<Root />`, the built-in keyboard shortcut will be displayed with the tooltip.
|
|
19
|
+
*
|
|
20
|
+
* Only used if the `navx-full-height-sidebar` feature flag is enabled.
|
|
21
|
+
*/
|
|
22
|
+
tooltipContent?: PanelSplitterProps['tooltipContent'];
|
|
5
23
|
};
|
|
6
24
|
/**
|
|
7
25
|
* _SideNavPanelSplitter_
|
|
@@ -12,9 +30,9 @@ type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
|
12
30
|
* Example usage:
|
|
13
31
|
* ```tsx
|
|
14
32
|
* <SideNav>
|
|
15
|
-
* <SideNavPanelSplitter label="
|
|
33
|
+
* <SideNavPanelSplitter label="Double click to collapse" />
|
|
16
34
|
* </SideNav>
|
|
17
35
|
* ```
|
|
18
36
|
*/
|
|
19
|
-
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent,
|
|
37
|
+
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent, }: SideNavPanelSplitterProps) => ReactNode;
|
|
20
38
|
export {};
|
|
@@ -12,7 +12,7 @@ export type SideNavVisibilityChangeAnalyticsAttributes = {
|
|
|
12
12
|
*
|
|
13
13
|
* Button for toggling the side nav. It should be used in the top bar.
|
|
14
14
|
*/
|
|
15
|
-
export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick,
|
|
15
|
+
export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick, }: {
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated
|
|
18
18
|
*
|
|
@@ -49,10 +49,4 @@ export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, coll
|
|
|
49
49
|
* The callback function that is called when the toggle button is clicked.
|
|
50
50
|
*/
|
|
51
51
|
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent, attributes?: SideNavVisibilityChangeAnalyticsAttributes) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Display a keyboard shortcut in the tooltip.
|
|
54
|
-
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
55
|
-
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
56
|
-
*/
|
|
57
|
-
shortcut?: string[];
|
|
58
52
|
}) => JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type MutableRefObject } from 'react';
|
|
2
|
+
import type { TooltipProps } from '@atlaskit/tooltip';
|
|
2
3
|
import { type ResizeBounds } from './types';
|
|
3
4
|
export type PanelSplitterContextType = {
|
|
4
5
|
/**
|
|
@@ -47,6 +48,12 @@ export type PanelSplitterContextType = {
|
|
|
47
48
|
* If `false`, the panel splitter will not be rendered.
|
|
48
49
|
*/
|
|
49
50
|
isEnabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The keyboard shortcut to display in the tooltip.
|
|
53
|
+
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
54
|
+
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
55
|
+
*/
|
|
56
|
+
shortcut?: TooltipProps['shortcut'];
|
|
50
57
|
};
|
|
51
58
|
/**
|
|
52
59
|
* Context for the panel splitter. Only internally exported.
|
|
@@ -25,17 +25,13 @@ export type PanelSplitterProps = {
|
|
|
25
25
|
testId?: string;
|
|
26
26
|
/**
|
|
27
27
|
* Displays a tooltip with the provided content.
|
|
28
|
+
*
|
|
28
29
|
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
29
30
|
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
30
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* Only used if the `navx-full-height-sidebar` feature flag is enabled.
|
|
31
33
|
*/
|
|
32
34
|
tooltipContent?: TooltipProps['content'];
|
|
33
|
-
/**
|
|
34
|
-
* The keyboard shortcut to display in the tooltip.
|
|
35
|
-
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
36
|
-
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
37
|
-
*/
|
|
38
|
-
shortcut?: TooltipProps['shortcut'];
|
|
39
35
|
};
|
|
40
36
|
type PanelSplitterDragData = {
|
|
41
37
|
panelId: string | symbol | undefined;
|
|
@@ -60,5 +56,5 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
60
56
|
* </SideNav>
|
|
61
57
|
* ```
|
|
62
58
|
*/
|
|
63
|
-
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent,
|
|
59
|
+
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, }: PanelSplitterProps) => ReactNode;
|
|
64
60
|
export {};
|
|
@@ -9,4 +9,4 @@ export type PanelSplitterProviderProps = Omit<PanelSplitterContextType, 'portalR
|
|
|
9
9
|
*
|
|
10
10
|
* Should be used in the layout area components, e.g. SideNav, Aside etc, as opposed to products.
|
|
11
11
|
*/
|
|
12
|
-
export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, panelRef, position, isEnabled, children, }: PanelSplitterProviderProps) => React.JSX.Element;
|
|
12
|
+
export declare const PanelSplitterProvider: ({ panelId, panelWidth, onCompleteResize, getResizeBounds, resizingCssVar, panelRef, position, isEnabled, shortcut, children, }: PanelSplitterProviderProps) => React.JSX.Element;
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type PanelSplitterProps } from './panel-splitter';
|
|
3
|
-
type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
3
|
+
type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick' | 'tooltipContent'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the side nav should collapse on double click.
|
|
6
|
+
*
|
|
7
|
+
* If not provided, it will default to `true`.
|
|
8
|
+
*/
|
|
4
9
|
shouldCollapseOnDoubleClick?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Displays a tooltip with the provided content. It is expected to be a string that explains the double click to collapse interaction.
|
|
12
|
+
*
|
|
13
|
+
* It will only be displayed if the `shouldCollapseOnDoubleClick` prop is `true`, or not provided (as it defaults to `true`).
|
|
14
|
+
*
|
|
15
|
+
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
16
|
+
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
17
|
+
*
|
|
18
|
+
* If the `isSideNavShortcutEnabled` prop is enabled on `<Root />`, the built-in keyboard shortcut will be displayed with the tooltip.
|
|
19
|
+
*
|
|
20
|
+
* Only used if the `navx-full-height-sidebar` feature flag is enabled.
|
|
21
|
+
*/
|
|
22
|
+
tooltipContent?: PanelSplitterProps['tooltipContent'];
|
|
5
23
|
};
|
|
6
24
|
/**
|
|
7
25
|
* _SideNavPanelSplitter_
|
|
@@ -12,9 +30,9 @@ type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
|
12
30
|
* Example usage:
|
|
13
31
|
* ```tsx
|
|
14
32
|
* <SideNav>
|
|
15
|
-
* <SideNavPanelSplitter label="
|
|
33
|
+
* <SideNavPanelSplitter label="Double click to collapse" />
|
|
16
34
|
* </SideNav>
|
|
17
35
|
* ```
|
|
18
36
|
*/
|
|
19
|
-
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent,
|
|
37
|
+
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent, }: SideNavPanelSplitterProps) => ReactNode;
|
|
20
38
|
export {};
|
|
@@ -12,7 +12,7 @@ export type SideNavVisibilityChangeAnalyticsAttributes = {
|
|
|
12
12
|
*
|
|
13
13
|
* Button for toggling the side nav. It should be used in the top bar.
|
|
14
14
|
*/
|
|
15
|
-
export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick,
|
|
15
|
+
export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick, }: {
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated
|
|
18
18
|
*
|
|
@@ -49,10 +49,4 @@ export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, coll
|
|
|
49
49
|
* The callback function that is called when the toggle button is clicked.
|
|
50
50
|
*/
|
|
51
51
|
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent, attributes?: SideNavVisibilityChangeAnalyticsAttributes) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Display a keyboard shortcut in the tooltip.
|
|
54
|
-
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
55
|
-
* Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
|
|
56
|
-
*/
|
|
57
|
-
shortcut?: string[];
|
|
58
52
|
}) => JSX.Element;
|
package/package.json
CHANGED