@atlaskit/navigation-system 2.13.0 → 2.14.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 +17 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +57 -29
- package/dist/cjs/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +14 -2
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +33 -4
- package/dist/es2019/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +13 -3
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +57 -29
- package/dist/esm/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
- package/dist/esm/ui/page-layout/side-nav/toggle-button.js +15 -3
- package/dist/types/ui/page-layout/panel-splitter/panel-splitter.d.ts +15 -1
- package/dist/types/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +1 -1
- package/dist/types/ui/page-layout/side-nav/toggle-button.d.ts +7 -1
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/panel-splitter.d.ts +15 -1
- package/dist/types-ts4.5/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +1 -1
- package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button.d.ts +7 -1
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 2.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3ea3fab89f015`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3ea3fab89f015) -
|
|
8
|
+
`SideNavToggleButton` now supports displaying keyboard shortcuts in its tooltip through the
|
|
9
|
+
`shortcut` prop.
|
|
10
|
+
|
|
11
|
+
`PanelSplitter` can now display a tooltip with an optional keyboard shortcut on hover or focus. A
|
|
12
|
+
tooltip will be rendered when either the `tooltipContent` or `shortcut` prop is set.
|
|
13
|
+
|
|
14
|
+
These new props are currently behind the `platform-dst-tooltip-shortcuts` feature flag.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 2.13.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -26,6 +26,7 @@ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
|
26
26
|
var _blockDraggingToIframes = require("@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes");
|
|
27
27
|
var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
28
28
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
29
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
29
30
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
30
31
|
var _context = require("./context");
|
|
31
32
|
var _convertResizeBoundToPixels = require("./convert-resize-bound-to-pixels");
|
|
@@ -51,6 +52,24 @@ var panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
|
|
|
51
52
|
function signPanelSplitterDragData(data) {
|
|
52
53
|
return _objectSpread(_objectSpread({}, data), {}, (0, _defineProperty2.default)({}, panelSplitterDragDataSymbol, true));
|
|
53
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
57
|
+
*/
|
|
58
|
+
var MaybeTooltip = function MaybeTooltip(_ref) {
|
|
59
|
+
var tooltipContent = _ref.tooltipContent,
|
|
60
|
+
shortcut = _ref.shortcut,
|
|
61
|
+
children = _ref.children;
|
|
62
|
+
if ((tooltipContent || shortcut) && (0, _platformFeatureFlags.fg)('platform-dst-tooltip-shortcuts')) {
|
|
63
|
+
return /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
64
|
+
content: tooltipContent,
|
|
65
|
+
shortcut: shortcut,
|
|
66
|
+
position: "mouse",
|
|
67
|
+
mousePosition: "right",
|
|
68
|
+
isScreenReaderAnnouncementDisabled: true
|
|
69
|
+
}, children);
|
|
70
|
+
}
|
|
71
|
+
return children;
|
|
72
|
+
};
|
|
54
73
|
function isPanelSplitterDragData(data) {
|
|
55
74
|
return data[panelSplitterDragDataSymbol] === true;
|
|
56
75
|
}
|
|
@@ -59,19 +78,21 @@ function getTextDirection(element) {
|
|
|
59
78
|
direction = _window$getComputedSt.direction;
|
|
60
79
|
return direction === 'rtl' ? 'rtl' : 'ltr';
|
|
61
80
|
}
|
|
62
|
-
var PortaledPanelSplitter = function PortaledPanelSplitter(
|
|
63
|
-
var label =
|
|
64
|
-
onResizeStart =
|
|
65
|
-
onResizeEnd =
|
|
66
|
-
testId =
|
|
67
|
-
panelId =
|
|
68
|
-
panelWidth =
|
|
69
|
-
onCompleteResize =
|
|
70
|
-
getResizeBounds =
|
|
71
|
-
panel =
|
|
72
|
-
portal =
|
|
73
|
-
resizingCssVar =
|
|
74
|
-
position =
|
|
81
|
+
var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
82
|
+
var label = _ref2.label,
|
|
83
|
+
onResizeStart = _ref2.onResizeStart,
|
|
84
|
+
onResizeEnd = _ref2.onResizeEnd,
|
|
85
|
+
testId = _ref2.testId,
|
|
86
|
+
panelId = _ref2.panelId,
|
|
87
|
+
panelWidth = _ref2.panelWidth,
|
|
88
|
+
onCompleteResize = _ref2.onCompleteResize,
|
|
89
|
+
getResizeBounds = _ref2.getResizeBounds,
|
|
90
|
+
panel = _ref2.panel,
|
|
91
|
+
portal = _ref2.portal,
|
|
92
|
+
resizingCssVar = _ref2.resizingCssVar,
|
|
93
|
+
position = _ref2.position,
|
|
94
|
+
tooltipContent = _ref2.tooltipContent,
|
|
95
|
+
shortcut = _ref2.shortcut;
|
|
75
96
|
var splitterRef = (0, _react.useRef)(null);
|
|
76
97
|
var labelId = (0, _useId.useId)();
|
|
77
98
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
@@ -108,8 +129,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
108
129
|
element: splitter
|
|
109
130
|
}), (0, _adapter.draggable)({
|
|
110
131
|
element: splitter,
|
|
111
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
112
|
-
var nativeSetDragImage =
|
|
132
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref3) {
|
|
133
|
+
var nativeSetDragImage = _ref3.nativeSetDragImage;
|
|
113
134
|
// We will be moving the line to indicate a drag. We can disable the native drag preview
|
|
114
135
|
(0, _disableNativeDragPreview.disableNativeDragPreview)({
|
|
115
136
|
nativeSetDragImage: nativeSetDragImage
|
|
@@ -136,8 +157,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
136
157
|
direction: getTextDirection(panel)
|
|
137
158
|
});
|
|
138
159
|
},
|
|
139
|
-
onDragStart: function onDragStart(
|
|
140
|
-
var source =
|
|
160
|
+
onDragStart: function onDragStart(_ref4) {
|
|
161
|
+
var source = _ref4.source;
|
|
141
162
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
142
163
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart({
|
|
143
164
|
initialWidth: source.data.initialWidth
|
|
@@ -146,9 +167,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
146
167
|
// Close any open layers when the user starts resizing
|
|
147
168
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
148
169
|
},
|
|
149
|
-
onDrag: function onDrag(
|
|
150
|
-
var location =
|
|
151
|
-
source =
|
|
170
|
+
onDrag: function onDrag(_ref5) {
|
|
171
|
+
var location = _ref5.location,
|
|
172
|
+
source = _ref5.source;
|
|
152
173
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
153
174
|
var _source$data = source.data,
|
|
154
175
|
initialWidth = _source$data.initialWidth,
|
|
@@ -169,8 +190,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
169
190
|
panel.style.setProperty(resizingCssVar, resizingWidth);
|
|
170
191
|
source.data.resizingWidth = resizingWidth;
|
|
171
192
|
},
|
|
172
|
-
onDrop: function onDrop(
|
|
173
|
-
var source =
|
|
193
|
+
onDrop: function onDrop(_ref6) {
|
|
194
|
+
var source = _ref6.source;
|
|
174
195
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
175
196
|
_preventUnhandled.preventUnhandled.stop();
|
|
176
197
|
var finalWidth = (0, _getWidth.getPixelWidth)(panel);
|
|
@@ -281,6 +302,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
281
302
|
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/React.createElement("div", {
|
|
282
303
|
"data-testid": testId ? "".concat(testId, "-container") : undefined,
|
|
283
304
|
className: (0, _runtime.ax)([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
305
|
+
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
306
|
+
tooltipContent: tooltipContent,
|
|
307
|
+
shortcut: shortcut
|
|
284
308
|
}, /*#__PURE__*/React.createElement("div", {
|
|
285
309
|
ref: splitterRef,
|
|
286
310
|
"data-testid": testId,
|
|
@@ -301,7 +325,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
301
325
|
id: labelId
|
|
302
326
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
303
327
|
className: (0, _runtime.ax)([lineStyles.root])
|
|
304
|
-
}))), portal);
|
|
328
|
+
})))), portal);
|
|
305
329
|
};
|
|
306
330
|
|
|
307
331
|
/**
|
|
@@ -319,11 +343,13 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
319
343
|
* </SideNav>
|
|
320
344
|
* ```
|
|
321
345
|
*/
|
|
322
|
-
var PanelSplitter = exports.PanelSplitter = function PanelSplitter(
|
|
323
|
-
var label =
|
|
324
|
-
onResizeStart =
|
|
325
|
-
onResizeEnd =
|
|
326
|
-
testId =
|
|
346
|
+
var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref7) {
|
|
347
|
+
var label = _ref7.label,
|
|
348
|
+
onResizeStart = _ref7.onResizeStart,
|
|
349
|
+
onResizeEnd = _ref7.onResizeEnd,
|
|
350
|
+
testId = _ref7.testId,
|
|
351
|
+
tooltipContent = _ref7.tooltipContent,
|
|
352
|
+
shortcut = _ref7.shortcut;
|
|
327
353
|
var _useState7 = (0, _react.useState)(null),
|
|
328
354
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
329
355
|
panel = _useState8[0],
|
|
@@ -437,6 +463,8 @@ var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref6) {
|
|
|
437
463
|
onCompleteResize: onCompleteResize,
|
|
438
464
|
getResizeBounds: getResizeBounds,
|
|
439
465
|
resizingCssVar: resizingCssVar,
|
|
440
|
-
position: position
|
|
466
|
+
position: position,
|
|
467
|
+
tooltipContent: tooltipContent,
|
|
468
|
+
shortcut: shortcut
|
|
441
469
|
});
|
|
442
470
|
};
|
|
@@ -32,7 +32,9 @@ var SideNavPanelSplitter = exports.SideNavPanelSplitter = function SideNavPanelS
|
|
|
32
32
|
onResizeEnd = _ref.onResizeEnd,
|
|
33
33
|
testId = _ref.testId,
|
|
34
34
|
_ref$shouldCollapseOn = _ref.shouldCollapseOnDoubleClick,
|
|
35
|
-
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn
|
|
35
|
+
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn,
|
|
36
|
+
tooltipContent = _ref.tooltipContent,
|
|
37
|
+
shortcut = _ref.shortcut;
|
|
36
38
|
var context = (0, _react.useContext)(_context.PanelSplitterContext);
|
|
37
39
|
(0, _tinyInvariant.default)((context === null || context === void 0 ? void 0 : context.panelId) === _constants.sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
38
40
|
var toggleSideNav = (0, _useToggleSideNav.useToggleSideNav)({
|
|
@@ -44,6 +46,8 @@ var SideNavPanelSplitter = exports.SideNavPanelSplitter = function SideNavPanelS
|
|
|
44
46
|
label: label,
|
|
45
47
|
onResizeStart: onResizeStart,
|
|
46
48
|
onResizeEnd: onResizeEnd,
|
|
47
|
-
testId: testId
|
|
49
|
+
testId: testId,
|
|
50
|
+
tooltipContent: tooltipContent,
|
|
51
|
+
shortcut: shortcut
|
|
48
52
|
}));
|
|
49
53
|
};
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.SideNavToggleButton = void 0;
|
|
10
10
|
require("./toggle-button.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
15
|
var _bindEventListener = require("bind-event-listener");
|
|
@@ -20,6 +21,8 @@ var _toggleButtonContext = require("./toggle-button-context");
|
|
|
20
21
|
var _useSideNavVisibility2 = require("./use-side-nav-visibility");
|
|
21
22
|
var _useToggleSideNav = require("./use-toggle-side-nav");
|
|
22
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
26
|
var toggleButtonTooltipOptions = {
|
|
24
27
|
// We're disabling pointer events on the tooltip to prevent it from blocking mouse events, so that the side nav flyout stays open
|
|
25
28
|
// when moving the mouse from the top bar to the side nav.
|
|
@@ -47,7 +50,8 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
47
50
|
collapseLabel = _ref.collapseLabel,
|
|
48
51
|
testId = _ref.testId,
|
|
49
52
|
interactionName = _ref.interactionName,
|
|
50
|
-
onClick = _ref.onClick
|
|
53
|
+
onClick = _ref.onClick,
|
|
54
|
+
shortcut = _ref.shortcut;
|
|
51
55
|
var _useSideNavVisibility = (0, _useSideNavVisibility2.useSideNavVisibility)({
|
|
52
56
|
defaultCollapsed: defaultCollapsed
|
|
53
57
|
}),
|
|
@@ -111,6 +115,14 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
111
115
|
className: (0, _runtime.ax)(["_1e0c1bgi _lcxvglyw"])
|
|
112
116
|
}, isSideNavExpanded ? /*#__PURE__*/_react.default.createElement(_sidebarCollapse.default, props) : /*#__PURE__*/_react.default.createElement(_sidebarExpand.default, props));
|
|
113
117
|
};
|
|
118
|
+
var tooltipProps = (0, _react.useMemo)(function () {
|
|
119
|
+
if ((0, _platformFeatureFlags.fg)('platform-dst-tooltip-shortcuts')) {
|
|
120
|
+
return _objectSpread(_objectSpread({}, toggleButtonTooltipOptions), {}, {
|
|
121
|
+
shortcut: shortcut
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return toggleButtonTooltipOptions;
|
|
125
|
+
}, [shortcut]);
|
|
114
126
|
var iconButton = /*#__PURE__*/_react.default.createElement(_migration.IconButton, {
|
|
115
127
|
appearance: "subtle",
|
|
116
128
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -120,7 +132,7 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
120
132
|
isTooltipDisabled: false,
|
|
121
133
|
interactionName: interactionName,
|
|
122
134
|
ref: (0, _platformFeatureFlags.fg)('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
123
|
-
tooltip:
|
|
135
|
+
tooltip: tooltipProps
|
|
124
136
|
});
|
|
125
137
|
var isInsideSlot = (0, _react.useContext)(_toggleButtonContext.SideNavToggleButtonSlotContext);
|
|
126
138
|
|
|
@@ -15,6 +15,7 @@ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
|
15
15
|
import { blockDraggingToIFrames } from '@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes';
|
|
16
16
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
17
17
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
18
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
18
19
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
20
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
20
21
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
@@ -40,6 +41,25 @@ function signPanelSplitterDragData(data) {
|
|
|
40
41
|
[panelSplitterDragDataSymbol]: true
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
46
|
+
*/
|
|
47
|
+
const MaybeTooltip = ({
|
|
48
|
+
tooltipContent,
|
|
49
|
+
shortcut,
|
|
50
|
+
children
|
|
51
|
+
}) => {
|
|
52
|
+
if ((tooltipContent || shortcut) && fg('platform-dst-tooltip-shortcuts')) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
|
+
content: tooltipContent,
|
|
55
|
+
shortcut: shortcut,
|
|
56
|
+
position: "mouse",
|
|
57
|
+
mousePosition: "right",
|
|
58
|
+
isScreenReaderAnnouncementDisabled: true
|
|
59
|
+
}, children);
|
|
60
|
+
}
|
|
61
|
+
return children;
|
|
62
|
+
};
|
|
43
63
|
export function isPanelSplitterDragData(data) {
|
|
44
64
|
return data[panelSplitterDragDataSymbol] === true;
|
|
45
65
|
}
|
|
@@ -61,7 +81,9 @@ const PortaledPanelSplitter = ({
|
|
|
61
81
|
panel,
|
|
62
82
|
portal,
|
|
63
83
|
resizingCssVar,
|
|
64
|
-
position
|
|
84
|
+
position,
|
|
85
|
+
tooltipContent,
|
|
86
|
+
shortcut
|
|
65
87
|
}) => {
|
|
66
88
|
const splitterRef = useRef(null);
|
|
67
89
|
const labelId = useId();
|
|
@@ -259,6 +281,9 @@ const PortaledPanelSplitter = ({
|
|
|
259
281
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
260
282
|
"data-testid": testId ? `${testId}-container` : undefined,
|
|
261
283
|
className: ax([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
284
|
+
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
285
|
+
tooltipContent: tooltipContent,
|
|
286
|
+
shortcut: shortcut
|
|
262
287
|
}, /*#__PURE__*/React.createElement("div", {
|
|
263
288
|
ref: splitterRef,
|
|
264
289
|
"data-testid": testId,
|
|
@@ -279,7 +304,7 @@ const PortaledPanelSplitter = ({
|
|
|
279
304
|
id: labelId
|
|
280
305
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
281
306
|
className: ax([lineStyles.root])
|
|
282
|
-
}))), portal);
|
|
307
|
+
})))), portal);
|
|
283
308
|
};
|
|
284
309
|
|
|
285
310
|
/**
|
|
@@ -301,7 +326,9 @@ export const PanelSplitter = ({
|
|
|
301
326
|
label,
|
|
302
327
|
onResizeStart,
|
|
303
328
|
onResizeEnd,
|
|
304
|
-
testId
|
|
329
|
+
testId,
|
|
330
|
+
tooltipContent,
|
|
331
|
+
shortcut
|
|
305
332
|
}) => {
|
|
306
333
|
const [panel, setPanel] = useState(null);
|
|
307
334
|
const [portal, setPortal] = useState(null);
|
|
@@ -412,6 +439,8 @@ export const PanelSplitter = ({
|
|
|
412
439
|
onCompleteResize: onCompleteResize,
|
|
413
440
|
getResizeBounds: getResizeBounds,
|
|
414
441
|
resizingCssVar: resizingCssVar,
|
|
415
|
-
position: position
|
|
442
|
+
position: position,
|
|
443
|
+
tooltipContent: tooltipContent,
|
|
444
|
+
shortcut: shortcut
|
|
416
445
|
});
|
|
417
446
|
};
|
|
@@ -22,7 +22,9 @@ export const SideNavPanelSplitter = ({
|
|
|
22
22
|
onResizeStart,
|
|
23
23
|
onResizeEnd,
|
|
24
24
|
testId,
|
|
25
|
-
shouldCollapseOnDoubleClick = true
|
|
25
|
+
shouldCollapseOnDoubleClick = true,
|
|
26
|
+
tooltipContent,
|
|
27
|
+
shortcut
|
|
26
28
|
}) => {
|
|
27
29
|
const context = useContext(PanelSplitterContext);
|
|
28
30
|
invariant((context === null || context === void 0 ? void 0 : context.panelId) === sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
@@ -35,6 +37,8 @@ export const SideNavPanelSplitter = ({
|
|
|
35
37
|
label: label,
|
|
36
38
|
onResizeStart: onResizeStart,
|
|
37
39
|
onResizeEnd: onResizeEnd,
|
|
38
|
-
testId: testId
|
|
40
|
+
testId: testId,
|
|
41
|
+
tooltipContent: tooltipContent,
|
|
42
|
+
shortcut: shortcut
|
|
39
43
|
}));
|
|
40
44
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* toggle-button.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./toggle-button.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { bind } from 'bind-event-listener';
|
|
6
6
|
import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
7
7
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
@@ -36,7 +36,8 @@ export const SideNavToggleButton = ({
|
|
|
36
36
|
collapseLabel,
|
|
37
37
|
testId,
|
|
38
38
|
interactionName,
|
|
39
|
-
onClick
|
|
39
|
+
onClick,
|
|
40
|
+
shortcut
|
|
40
41
|
}) => {
|
|
41
42
|
const {
|
|
42
43
|
isExpandedOnDesktop: isSideNavExpandedOnDesktop,
|
|
@@ -98,6 +99,15 @@ export const SideNavToggleButton = ({
|
|
|
98
99
|
const icon = props => /*#__PURE__*/React.createElement("span", {
|
|
99
100
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
100
101
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
102
|
+
const tooltipProps = useMemo(() => {
|
|
103
|
+
if (fg('platform-dst-tooltip-shortcuts')) {
|
|
104
|
+
return {
|
|
105
|
+
...toggleButtonTooltipOptions,
|
|
106
|
+
shortcut
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return toggleButtonTooltipOptions;
|
|
110
|
+
}, [shortcut]);
|
|
101
111
|
const iconButton = /*#__PURE__*/React.createElement(IconButton, {
|
|
102
112
|
appearance: "subtle",
|
|
103
113
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -107,7 +117,7 @@ export const SideNavToggleButton = ({
|
|
|
107
117
|
isTooltipDisabled: false,
|
|
108
118
|
interactionName: interactionName,
|
|
109
119
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
110
|
-
tooltip:
|
|
120
|
+
tooltip: tooltipProps
|
|
111
121
|
});
|
|
112
122
|
const isInsideSlot = useContext(SideNavToggleButtonSlotContext);
|
|
113
123
|
|
|
@@ -19,6 +19,7 @@ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
|
19
19
|
import { blockDraggingToIFrames } from '@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes';
|
|
20
20
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
21
21
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
22
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
22
23
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
23
24
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
24
25
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
@@ -41,6 +42,24 @@ var panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
|
|
|
41
42
|
function signPanelSplitterDragData(data) {
|
|
42
43
|
return _objectSpread(_objectSpread({}, data), {}, _defineProperty({}, panelSplitterDragDataSymbol, true));
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
47
|
+
*/
|
|
48
|
+
var MaybeTooltip = function MaybeTooltip(_ref) {
|
|
49
|
+
var tooltipContent = _ref.tooltipContent,
|
|
50
|
+
shortcut = _ref.shortcut,
|
|
51
|
+
children = _ref.children;
|
|
52
|
+
if ((tooltipContent || shortcut) && fg('platform-dst-tooltip-shortcuts')) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
|
+
content: tooltipContent,
|
|
55
|
+
shortcut: shortcut,
|
|
56
|
+
position: "mouse",
|
|
57
|
+
mousePosition: "right",
|
|
58
|
+
isScreenReaderAnnouncementDisabled: true
|
|
59
|
+
}, children);
|
|
60
|
+
}
|
|
61
|
+
return children;
|
|
62
|
+
};
|
|
44
63
|
export function isPanelSplitterDragData(data) {
|
|
45
64
|
return data[panelSplitterDragDataSymbol] === true;
|
|
46
65
|
}
|
|
@@ -49,19 +68,21 @@ function getTextDirection(element) {
|
|
|
49
68
|
direction = _window$getComputedSt.direction;
|
|
50
69
|
return direction === 'rtl' ? 'rtl' : 'ltr';
|
|
51
70
|
}
|
|
52
|
-
var PortaledPanelSplitter = function PortaledPanelSplitter(
|
|
53
|
-
var label =
|
|
54
|
-
onResizeStart =
|
|
55
|
-
onResizeEnd =
|
|
56
|
-
testId =
|
|
57
|
-
panelId =
|
|
58
|
-
panelWidth =
|
|
59
|
-
onCompleteResize =
|
|
60
|
-
getResizeBounds =
|
|
61
|
-
panel =
|
|
62
|
-
portal =
|
|
63
|
-
resizingCssVar =
|
|
64
|
-
position =
|
|
71
|
+
var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
72
|
+
var label = _ref2.label,
|
|
73
|
+
onResizeStart = _ref2.onResizeStart,
|
|
74
|
+
onResizeEnd = _ref2.onResizeEnd,
|
|
75
|
+
testId = _ref2.testId,
|
|
76
|
+
panelId = _ref2.panelId,
|
|
77
|
+
panelWidth = _ref2.panelWidth,
|
|
78
|
+
onCompleteResize = _ref2.onCompleteResize,
|
|
79
|
+
getResizeBounds = _ref2.getResizeBounds,
|
|
80
|
+
panel = _ref2.panel,
|
|
81
|
+
portal = _ref2.portal,
|
|
82
|
+
resizingCssVar = _ref2.resizingCssVar,
|
|
83
|
+
position = _ref2.position,
|
|
84
|
+
tooltipContent = _ref2.tooltipContent,
|
|
85
|
+
shortcut = _ref2.shortcut;
|
|
65
86
|
var splitterRef = useRef(null);
|
|
66
87
|
var labelId = useId();
|
|
67
88
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
@@ -98,8 +119,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
98
119
|
element: splitter
|
|
99
120
|
}), draggable({
|
|
100
121
|
element: splitter,
|
|
101
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
102
|
-
var nativeSetDragImage =
|
|
122
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref3) {
|
|
123
|
+
var nativeSetDragImage = _ref3.nativeSetDragImage;
|
|
103
124
|
// We will be moving the line to indicate a drag. We can disable the native drag preview
|
|
104
125
|
disableNativeDragPreview({
|
|
105
126
|
nativeSetDragImage: nativeSetDragImage
|
|
@@ -126,8 +147,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
126
147
|
direction: getTextDirection(panel)
|
|
127
148
|
});
|
|
128
149
|
},
|
|
129
|
-
onDragStart: function onDragStart(
|
|
130
|
-
var source =
|
|
150
|
+
onDragStart: function onDragStart(_ref4) {
|
|
151
|
+
var source = _ref4.source;
|
|
131
152
|
invariant(isPanelSplitterDragData(source.data));
|
|
132
153
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart({
|
|
133
154
|
initialWidth: source.data.initialWidth
|
|
@@ -136,9 +157,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
136
157
|
// Close any open layers when the user starts resizing
|
|
137
158
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
138
159
|
},
|
|
139
|
-
onDrag: function onDrag(
|
|
140
|
-
var location =
|
|
141
|
-
source =
|
|
160
|
+
onDrag: function onDrag(_ref5) {
|
|
161
|
+
var location = _ref5.location,
|
|
162
|
+
source = _ref5.source;
|
|
142
163
|
invariant(isPanelSplitterDragData(source.data));
|
|
143
164
|
var _source$data = source.data,
|
|
144
165
|
initialWidth = _source$data.initialWidth,
|
|
@@ -159,8 +180,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
159
180
|
panel.style.setProperty(resizingCssVar, resizingWidth);
|
|
160
181
|
source.data.resizingWidth = resizingWidth;
|
|
161
182
|
},
|
|
162
|
-
onDrop: function onDrop(
|
|
163
|
-
var source =
|
|
183
|
+
onDrop: function onDrop(_ref6) {
|
|
184
|
+
var source = _ref6.source;
|
|
164
185
|
invariant(isPanelSplitterDragData(source.data));
|
|
165
186
|
preventUnhandled.stop();
|
|
166
187
|
var finalWidth = getPixelWidth(panel);
|
|
@@ -271,6 +292,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
271
292
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
272
293
|
"data-testid": testId ? "".concat(testId, "-container") : undefined,
|
|
273
294
|
className: ax([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
|
|
295
|
+
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
296
|
+
tooltipContent: tooltipContent,
|
|
297
|
+
shortcut: shortcut
|
|
274
298
|
}, /*#__PURE__*/React.createElement("div", {
|
|
275
299
|
ref: splitterRef,
|
|
276
300
|
"data-testid": testId,
|
|
@@ -291,7 +315,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
291
315
|
id: labelId
|
|
292
316
|
}, label)), /*#__PURE__*/React.createElement("span", {
|
|
293
317
|
className: ax([lineStyles.root])
|
|
294
|
-
}))), portal);
|
|
318
|
+
})))), portal);
|
|
295
319
|
};
|
|
296
320
|
|
|
297
321
|
/**
|
|
@@ -309,11 +333,13 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
|
|
|
309
333
|
* </SideNav>
|
|
310
334
|
* ```
|
|
311
335
|
*/
|
|
312
|
-
export var PanelSplitter = function PanelSplitter(
|
|
313
|
-
var label =
|
|
314
|
-
onResizeStart =
|
|
315
|
-
onResizeEnd =
|
|
316
|
-
testId =
|
|
336
|
+
export var PanelSplitter = function PanelSplitter(_ref7) {
|
|
337
|
+
var label = _ref7.label,
|
|
338
|
+
onResizeStart = _ref7.onResizeStart,
|
|
339
|
+
onResizeEnd = _ref7.onResizeEnd,
|
|
340
|
+
testId = _ref7.testId,
|
|
341
|
+
tooltipContent = _ref7.tooltipContent,
|
|
342
|
+
shortcut = _ref7.shortcut;
|
|
317
343
|
var _useState7 = useState(null),
|
|
318
344
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
319
345
|
panel = _useState8[0],
|
|
@@ -427,6 +453,8 @@ export var PanelSplitter = function PanelSplitter(_ref6) {
|
|
|
427
453
|
onCompleteResize: onCompleteResize,
|
|
428
454
|
getResizeBounds: getResizeBounds,
|
|
429
455
|
resizingCssVar: resizingCssVar,
|
|
430
|
-
position: position
|
|
456
|
+
position: position,
|
|
457
|
+
tooltipContent: tooltipContent,
|
|
458
|
+
shortcut: shortcut
|
|
431
459
|
});
|
|
432
460
|
};
|
|
@@ -23,7 +23,9 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
|
|
|
23
23
|
onResizeEnd = _ref.onResizeEnd,
|
|
24
24
|
testId = _ref.testId,
|
|
25
25
|
_ref$shouldCollapseOn = _ref.shouldCollapseOnDoubleClick,
|
|
26
|
-
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn
|
|
26
|
+
shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn,
|
|
27
|
+
tooltipContent = _ref.tooltipContent,
|
|
28
|
+
shortcut = _ref.shortcut;
|
|
27
29
|
var context = useContext(PanelSplitterContext);
|
|
28
30
|
invariant((context === null || context === void 0 ? void 0 : context.panelId) === sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
|
|
29
31
|
var toggleSideNav = useToggleSideNav({
|
|
@@ -35,6 +37,8 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
|
|
|
35
37
|
label: label,
|
|
36
38
|
onResizeStart: onResizeStart,
|
|
37
39
|
onResizeEnd: onResizeEnd,
|
|
38
|
-
testId: testId
|
|
40
|
+
testId: testId,
|
|
41
|
+
tooltipContent: tooltipContent,
|
|
42
|
+
shortcut: shortcut
|
|
39
43
|
}));
|
|
40
44
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/* toggle-button.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import "./toggle-button.compiled.css";
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
9
|
import { bind } from 'bind-event-listener';
|
|
7
10
|
import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
8
11
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
@@ -38,7 +41,8 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
38
41
|
collapseLabel = _ref.collapseLabel,
|
|
39
42
|
testId = _ref.testId,
|
|
40
43
|
interactionName = _ref.interactionName,
|
|
41
|
-
onClick = _ref.onClick
|
|
44
|
+
onClick = _ref.onClick,
|
|
45
|
+
shortcut = _ref.shortcut;
|
|
42
46
|
var _useSideNavVisibility = useSideNavVisibility({
|
|
43
47
|
defaultCollapsed: defaultCollapsed
|
|
44
48
|
}),
|
|
@@ -102,6 +106,14 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
102
106
|
className: ax(["_1e0c1bgi _lcxvglyw"])
|
|
103
107
|
}, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
|
|
104
108
|
};
|
|
109
|
+
var tooltipProps = useMemo(function () {
|
|
110
|
+
if (fg('platform-dst-tooltip-shortcuts')) {
|
|
111
|
+
return _objectSpread(_objectSpread({}, toggleButtonTooltipOptions), {}, {
|
|
112
|
+
shortcut: shortcut
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return toggleButtonTooltipOptions;
|
|
116
|
+
}, [shortcut]);
|
|
105
117
|
var iconButton = /*#__PURE__*/React.createElement(IconButton, {
|
|
106
118
|
appearance: "subtle",
|
|
107
119
|
label: isSideNavExpanded ? collapseLabel : expandLabel,
|
|
@@ -111,7 +123,7 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
111
123
|
isTooltipDisabled: false,
|
|
112
124
|
interactionName: interactionName,
|
|
113
125
|
ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
|
|
114
|
-
tooltip:
|
|
126
|
+
tooltip: tooltipProps
|
|
115
127
|
});
|
|
116
128
|
var isInsideSlot = useContext(SideNavToggleButtonSlotContext);
|
|
117
129
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
+
import { type TooltipProps } from '@atlaskit/tooltip';
|
|
6
7
|
import type { ResizeBounds, ResizeEndCallback, ResizeStartCallback } from './types';
|
|
7
8
|
export type PanelSplitterProps = {
|
|
8
9
|
/**
|
|
@@ -22,6 +23,19 @@ export type PanelSplitterProps = {
|
|
|
22
23
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
23
24
|
*/
|
|
24
25
|
testId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Displays a tooltip with the provided content.
|
|
28
|
+
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
29
|
+
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
30
|
+
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
31
|
+
*/
|
|
32
|
+
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'];
|
|
25
39
|
};
|
|
26
40
|
type PanelSplitterDragData = {
|
|
27
41
|
panelId: string | symbol | undefined;
|
|
@@ -46,5 +60,5 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
46
60
|
* </SideNav>
|
|
47
61
|
* ```
|
|
48
62
|
*/
|
|
49
|
-
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, }: PanelSplitterProps) => ReactNode;
|
|
63
|
+
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, shortcut, }: PanelSplitterProps) => ReactNode;
|
|
50
64
|
export {};
|
|
@@ -16,5 +16,5 @@ type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
|
16
16
|
* </SideNav>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, }: SideNavPanelSplitterProps) => ReactNode;
|
|
19
|
+
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent, shortcut, }: SideNavPanelSplitterProps) => ReactNode;
|
|
20
20
|
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, shortcut, }: {
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated
|
|
18
18
|
*
|
|
@@ -49,4 +49,10 @@ 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[];
|
|
52
58
|
}) => JSX.Element;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
+
import { type TooltipProps } from '@atlaskit/tooltip';
|
|
6
7
|
import type { ResizeBounds, ResizeEndCallback, ResizeStartCallback } from './types';
|
|
7
8
|
export type PanelSplitterProps = {
|
|
8
9
|
/**
|
|
@@ -22,6 +23,19 @@ export type PanelSplitterProps = {
|
|
|
22
23
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
23
24
|
*/
|
|
24
25
|
testId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Displays a tooltip with the provided content.
|
|
28
|
+
* The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
|
|
29
|
+
* Use the `label` prop to provide accessible information about the panel splitter.
|
|
30
|
+
* Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
|
|
31
|
+
*/
|
|
32
|
+
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'];
|
|
25
39
|
};
|
|
26
40
|
type PanelSplitterDragData = {
|
|
27
41
|
panelId: string | symbol | undefined;
|
|
@@ -46,5 +60,5 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
|
|
|
46
60
|
* </SideNav>
|
|
47
61
|
* ```
|
|
48
62
|
*/
|
|
49
|
-
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, }: PanelSplitterProps) => ReactNode;
|
|
63
|
+
export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, shortcut, }: PanelSplitterProps) => ReactNode;
|
|
50
64
|
export {};
|
|
@@ -16,5 +16,5 @@ type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
|
|
|
16
16
|
* </SideNav>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, }: SideNavPanelSplitterProps) => ReactNode;
|
|
19
|
+
export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent, shortcut, }: SideNavPanelSplitterProps) => ReactNode;
|
|
20
20
|
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, shortcut, }: {
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated
|
|
18
18
|
*
|
|
@@ -49,4 +49,10 @@ 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[];
|
|
52
58
|
}) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
70
|
-
"@atlaskit/avatar": "^25.
|
|
71
|
-
"@atlaskit/button": "^23.
|
|
70
|
+
"@atlaskit/avatar": "^25.3.0",
|
|
71
|
+
"@atlaskit/button": "^23.5.0",
|
|
72
72
|
"@atlaskit/css": "^0.14.0",
|
|
73
73
|
"@atlaskit/ds-lib": "^5.1.0",
|
|
74
74
|
"@atlaskit/icon": "^28.3.0",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
114
114
|
"@atlaskit/select": "^21.3.0",
|
|
115
115
|
"@atlaskit/skeleton": "^2.1.0",
|
|
116
|
-
"@atlaskit/temp-nav-app-icons": "^0.
|
|
116
|
+
"@atlaskit/temp-nav-app-icons": "^0.13.0",
|
|
117
117
|
"@atlaskit/textfield": "^8.0.0",
|
|
118
118
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
119
119
|
"@atlassian/gemini": "^1.20.0",
|
|
@@ -186,6 +186,9 @@
|
|
|
186
186
|
"platform_dst_nav4_menu_section_heading_a11y": {
|
|
187
187
|
"type": "boolean"
|
|
188
188
|
},
|
|
189
|
+
"platform-dst-tooltip-shortcuts": {
|
|
190
|
+
"type": "boolean"
|
|
191
|
+
},
|
|
189
192
|
"platform_dst_nav4_side_nav_click_outside_fix": {
|
|
190
193
|
"type": "boolean"
|
|
191
194
|
},
|