@atlaskit/navigation-system 5.19.0 → 5.20.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 +12 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +59 -36
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +25 -3
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.compiled.css +1 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +60 -37
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2e7328e8eff65`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e7328e8eff65) -
|
|
8
|
+
Modifies the side nav resize tooltip to remain locked on the x-axis relative to the resizer,
|
|
9
|
+
behind the `platform_dst_nav4_side_nav_resize_tooltip_feedback` feature gate.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 5.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
._1qu2glyw{outline-style:none}
|
|
15
15
|
._4t3i1osq{height:100%}
|
|
16
16
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
17
|
+
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
17
18
|
._bfhk1j28{background-color:transparent}
|
|
18
19
|
._bfhk1r31{background-color:currentColor}
|
|
19
20
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -13,6 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var React = _react;
|
|
14
14
|
var _runtime = require("@compiled/react/runtime");
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
17
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
19
|
var _bindEventListener = require("bind-event-listener");
|
|
18
20
|
var _reactDom = require("react-dom");
|
|
@@ -20,12 +22,14 @@ var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
|
20
22
|
var _useId = require("@atlaskit/ds-lib/use-id");
|
|
21
23
|
var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
|
|
22
24
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
25
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
26
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
24
27
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
25
28
|
var _blockDraggingToIframes = require("@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes");
|
|
26
29
|
var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
27
30
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
28
31
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
32
|
+
var _TooltipContainer = _interopRequireDefault(require("@atlaskit/tooltip/TooltipContainer"));
|
|
29
33
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
30
34
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
31
35
|
var _context = require("./context");
|
|
@@ -33,6 +37,7 @@ var _convertResizeBoundToPixels = require("./convert-resize-bound-to-pixels");
|
|
|
33
37
|
var _getPercentageWithinPixelBounds = require("./get-percentage-within-pixel-bounds");
|
|
34
38
|
var _getWidth = require("./get-width");
|
|
35
39
|
var _keyboardResizeManager = require("./keyboard-resize-manager");
|
|
40
|
+
var _excluded = ["children", "className"];
|
|
36
41
|
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); }
|
|
37
42
|
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; }
|
|
38
43
|
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; }
|
|
@@ -48,25 +53,43 @@ var grabAreaStyles = {
|
|
|
48
53
|
var lineStyles = {
|
|
49
54
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
50
55
|
};
|
|
56
|
+
var tooltipStyles = {
|
|
57
|
+
root: "_ahbq196n"
|
|
58
|
+
};
|
|
51
59
|
var panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
|
|
52
60
|
function signPanelSplitterDragData(data) {
|
|
53
61
|
return _objectSpread(_objectSpread({}, data), {}, (0, _defineProperty2.default)({}, panelSplitterDragDataSymbol, true));
|
|
54
62
|
}
|
|
63
|
+
var PanelSplitterTooltip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
64
|
+
var children = _ref.children,
|
|
65
|
+
className = _ref.className,
|
|
66
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
67
|
+
return /*#__PURE__*/React.createElement(_TooltipContainer.default, (0, _extends2.default)({}, props, {
|
|
68
|
+
ref: ref
|
|
69
|
+
// Must be statically passed
|
|
70
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
71
|
+
,
|
|
72
|
+
className: (0, _runtime.ax)([tooltipStyles.root, className])
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
74
|
+
}), children);
|
|
75
|
+
});
|
|
76
|
+
|
|
55
77
|
/**
|
|
56
78
|
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
57
79
|
*/
|
|
58
|
-
var MaybeTooltip = function MaybeTooltip(
|
|
59
|
-
var tooltipContent =
|
|
60
|
-
shortcut =
|
|
61
|
-
children =
|
|
80
|
+
var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
81
|
+
var tooltipContent = _ref2.tooltipContent,
|
|
82
|
+
shortcut = _ref2.shortcut,
|
|
83
|
+
children = _ref2.children;
|
|
62
84
|
var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
|
|
63
85
|
if (tooltipContent && isFhsEnabled) {
|
|
64
86
|
return /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
65
87
|
content: tooltipContent,
|
|
66
88
|
shortcut: shortcut,
|
|
67
|
-
position:
|
|
89
|
+
position: (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? 'mouse-y' : 'mouse',
|
|
68
90
|
mousePosition: "right",
|
|
69
|
-
isScreenReaderAnnouncementDisabled: true
|
|
91
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
92
|
+
component: (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? PanelSplitterTooltip : undefined
|
|
70
93
|
}, children);
|
|
71
94
|
}
|
|
72
95
|
return children;
|
|
@@ -79,21 +102,21 @@ function getTextDirection(element) {
|
|
|
79
102
|
direction = _window$getComputedSt.direction;
|
|
80
103
|
return direction === 'rtl' ? 'rtl' : 'ltr';
|
|
81
104
|
}
|
|
82
|
-
var PortaledPanelSplitter = function PortaledPanelSplitter(
|
|
83
|
-
var label =
|
|
84
|
-
onResizeStart =
|
|
85
|
-
onResizeEnd =
|
|
86
|
-
testId =
|
|
87
|
-
panelId =
|
|
88
|
-
panelWidth =
|
|
89
|
-
onCompleteResize =
|
|
90
|
-
getResizeBounds =
|
|
91
|
-
panel =
|
|
92
|
-
portal =
|
|
93
|
-
resizingCssVar =
|
|
94
|
-
position =
|
|
95
|
-
tooltipContent =
|
|
96
|
-
shortcut =
|
|
105
|
+
var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
106
|
+
var label = _ref3.label,
|
|
107
|
+
onResizeStart = _ref3.onResizeStart,
|
|
108
|
+
onResizeEnd = _ref3.onResizeEnd,
|
|
109
|
+
testId = _ref3.testId,
|
|
110
|
+
panelId = _ref3.panelId,
|
|
111
|
+
panelWidth = _ref3.panelWidth,
|
|
112
|
+
onCompleteResize = _ref3.onCompleteResize,
|
|
113
|
+
getResizeBounds = _ref3.getResizeBounds,
|
|
114
|
+
panel = _ref3.panel,
|
|
115
|
+
portal = _ref3.portal,
|
|
116
|
+
resizingCssVar = _ref3.resizingCssVar,
|
|
117
|
+
position = _ref3.position,
|
|
118
|
+
tooltipContent = _ref3.tooltipContent,
|
|
119
|
+
shortcut = _ref3.shortcut;
|
|
97
120
|
var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
|
|
98
121
|
var splitterRef = (0, _react.useRef)(null);
|
|
99
122
|
var labelId = (0, _useId.useId)();
|
|
@@ -131,8 +154,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
131
154
|
element: splitter
|
|
132
155
|
}), (0, _adapter.draggable)({
|
|
133
156
|
element: splitter,
|
|
134
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
135
|
-
var nativeSetDragImage =
|
|
157
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref4) {
|
|
158
|
+
var nativeSetDragImage = _ref4.nativeSetDragImage;
|
|
136
159
|
// We will be moving the line to indicate a drag. We can disable the native drag preview
|
|
137
160
|
(0, _disableNativeDragPreview.disableNativeDragPreview)({
|
|
138
161
|
nativeSetDragImage: nativeSetDragImage
|
|
@@ -159,8 +182,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
159
182
|
direction: getTextDirection(panel)
|
|
160
183
|
});
|
|
161
184
|
},
|
|
162
|
-
onDragStart: function onDragStart(
|
|
163
|
-
var source =
|
|
185
|
+
onDragStart: function onDragStart(_ref5) {
|
|
186
|
+
var source = _ref5.source;
|
|
164
187
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
165
188
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart({
|
|
166
189
|
initialWidth: source.data.initialWidth
|
|
@@ -169,9 +192,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
169
192
|
// Close any open layers when the user starts resizing
|
|
170
193
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
171
194
|
},
|
|
172
|
-
onDrag: function onDrag(
|
|
173
|
-
var location =
|
|
174
|
-
source =
|
|
195
|
+
onDrag: function onDrag(_ref6) {
|
|
196
|
+
var location = _ref6.location,
|
|
197
|
+
source = _ref6.source;
|
|
175
198
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
176
199
|
var _source$data = source.data,
|
|
177
200
|
initialWidth = _source$data.initialWidth,
|
|
@@ -192,8 +215,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
192
215
|
panel.style.setProperty(resizingCssVar, resizingWidth);
|
|
193
216
|
source.data.resizingWidth = resizingWidth;
|
|
194
217
|
},
|
|
195
|
-
onDrop: function onDrop(
|
|
196
|
-
var source =
|
|
218
|
+
onDrop: function onDrop(_ref7) {
|
|
219
|
+
var source = _ref7.source;
|
|
197
220
|
(0, _tinyInvariant.default)(isPanelSplitterDragData(source.data));
|
|
198
221
|
_preventUnhandled.preventUnhandled.stop();
|
|
199
222
|
var finalWidth = (0, _getWidth.getPixelWidth)(panel);
|
|
@@ -346,12 +369,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
346
369
|
* </Aside>
|
|
347
370
|
* ```
|
|
348
371
|
*/
|
|
349
|
-
var PanelSplitter = exports.PanelSplitter = function PanelSplitter(
|
|
350
|
-
var label =
|
|
351
|
-
onResizeStart =
|
|
352
|
-
onResizeEnd =
|
|
353
|
-
testId =
|
|
354
|
-
tooltipContent =
|
|
372
|
+
var PanelSplitter = exports.PanelSplitter = function PanelSplitter(_ref8) {
|
|
373
|
+
var label = _ref8.label,
|
|
374
|
+
onResizeStart = _ref8.onResizeStart,
|
|
375
|
+
onResizeEnd = _ref8.onResizeEnd,
|
|
376
|
+
testId = _ref8.testId,
|
|
377
|
+
tooltipContent = _ref8.tooltipContent;
|
|
355
378
|
var _useState7 = (0, _react.useState)(null),
|
|
356
379
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
357
380
|
panel = _useState8[0],
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
._1qu2glyw{outline-style:none}
|
|
15
15
|
._4t3i1osq{height:100%}
|
|
16
16
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
17
|
+
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
17
18
|
._bfhk1j28{background-color:transparent}
|
|
18
19
|
._bfhk1r31{background-color:currentColor}
|
|
19
20
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
/* panel-splitter.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import "./panel-splitter.compiled.css";
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
7
|
import { bind } from 'bind-event-listener';
|
|
7
8
|
import { createPortal } from 'react-dom';
|
|
8
9
|
import invariant from 'tiny-invariant';
|
|
9
10
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
10
11
|
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
11
12
|
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
14
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
13
15
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
14
16
|
import { blockDraggingToIFrames } from '@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes';
|
|
15
17
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
16
18
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
17
19
|
import Tooltip from '@atlaskit/tooltip';
|
|
20
|
+
import TooltipContainer from '@atlaskit/tooltip/TooltipContainer';
|
|
18
21
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
22
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
20
23
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
@@ -34,6 +37,9 @@ const grabAreaStyles = {
|
|
|
34
37
|
const lineStyles = {
|
|
35
38
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
36
39
|
};
|
|
40
|
+
const tooltipStyles = {
|
|
41
|
+
root: "_ahbq196n"
|
|
42
|
+
};
|
|
37
43
|
const panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
|
|
38
44
|
function signPanelSplitterDragData(data) {
|
|
39
45
|
return {
|
|
@@ -41,6 +47,21 @@ function signPanelSplitterDragData(data) {
|
|
|
41
47
|
[panelSplitterDragDataSymbol]: true
|
|
42
48
|
};
|
|
43
49
|
}
|
|
50
|
+
const PanelSplitterTooltip = /*#__PURE__*/forwardRef(({
|
|
51
|
+
children,
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}, ref) => {
|
|
55
|
+
return /*#__PURE__*/React.createElement(TooltipContainer, _extends({}, props, {
|
|
56
|
+
ref: ref
|
|
57
|
+
// Must be statically passed
|
|
58
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
59
|
+
,
|
|
60
|
+
className: ax([tooltipStyles.root, className])
|
|
61
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
62
|
+
}), children);
|
|
63
|
+
});
|
|
64
|
+
|
|
44
65
|
/**
|
|
45
66
|
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
46
67
|
*/
|
|
@@ -54,9 +75,10 @@ const MaybeTooltip = ({
|
|
|
54
75
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
55
76
|
content: tooltipContent,
|
|
56
77
|
shortcut: shortcut,
|
|
57
|
-
position:
|
|
78
|
+
position: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? 'mouse-y' : 'mouse',
|
|
58
79
|
mousePosition: "right",
|
|
59
|
-
isScreenReaderAnnouncementDisabled: true
|
|
80
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
81
|
+
component: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? PanelSplitterTooltip : undefined
|
|
60
82
|
}, children);
|
|
61
83
|
}
|
|
62
84
|
return children;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
._1qu2glyw{outline-style:none}
|
|
15
15
|
._4t3i1osq{height:100%}
|
|
16
16
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
17
|
+
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
17
18
|
._bfhk1j28{background-color:transparent}
|
|
18
19
|
._bfhk1r31{background-color:currentColor}
|
|
19
20
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
/* panel-splitter.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
var _excluded = ["children", "className"];
|
|
4
7
|
import "./panel-splitter.compiled.css";
|
|
5
8
|
import * as React from 'react';
|
|
6
9
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
10
|
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; }
|
|
8
11
|
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; }
|
|
9
|
-
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
13
|
import { bind } from 'bind-event-listener';
|
|
11
14
|
import { createPortal } from 'react-dom';
|
|
12
15
|
import invariant from 'tiny-invariant';
|
|
13
16
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
14
17
|
import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
|
|
15
18
|
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
19
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
20
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
17
21
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
18
22
|
import { blockDraggingToIFrames } from '@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes';
|
|
19
23
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
20
24
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
21
25
|
import Tooltip from '@atlaskit/tooltip';
|
|
26
|
+
import TooltipContainer from '@atlaskit/tooltip/TooltipContainer';
|
|
22
27
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
23
28
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
24
29
|
import { OnDoubleClickContext, PanelSplitterContext } from './context';
|
|
@@ -38,25 +43,43 @@ var grabAreaStyles = {
|
|
|
38
43
|
var lineStyles = {
|
|
39
44
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
40
45
|
};
|
|
46
|
+
var tooltipStyles = {
|
|
47
|
+
root: "_ahbq196n"
|
|
48
|
+
};
|
|
41
49
|
var panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
|
|
42
50
|
function signPanelSplitterDragData(data) {
|
|
43
51
|
return _objectSpread(_objectSpread({}, data), {}, _defineProperty({}, panelSplitterDragDataSymbol, true));
|
|
44
52
|
}
|
|
53
|
+
var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
54
|
+
var children = _ref.children,
|
|
55
|
+
className = _ref.className,
|
|
56
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
return /*#__PURE__*/React.createElement(TooltipContainer, _extends({}, props, {
|
|
58
|
+
ref: ref
|
|
59
|
+
// Must be statically passed
|
|
60
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
61
|
+
,
|
|
62
|
+
className: ax([tooltipStyles.root, className])
|
|
63
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
64
|
+
}), children);
|
|
65
|
+
});
|
|
66
|
+
|
|
45
67
|
/**
|
|
46
68
|
* A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
|
|
47
69
|
*/
|
|
48
|
-
var MaybeTooltip = function MaybeTooltip(
|
|
49
|
-
var tooltipContent =
|
|
50
|
-
shortcut =
|
|
51
|
-
children =
|
|
70
|
+
var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
71
|
+
var tooltipContent = _ref2.tooltipContent,
|
|
72
|
+
shortcut = _ref2.shortcut,
|
|
73
|
+
children = _ref2.children;
|
|
52
74
|
var isFhsEnabled = useIsFhsEnabled();
|
|
53
75
|
if (tooltipContent && isFhsEnabled) {
|
|
54
76
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
55
77
|
content: tooltipContent,
|
|
56
78
|
shortcut: shortcut,
|
|
57
|
-
position:
|
|
79
|
+
position: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? 'mouse-y' : 'mouse',
|
|
58
80
|
mousePosition: "right",
|
|
59
|
-
isScreenReaderAnnouncementDisabled: true
|
|
81
|
+
isScreenReaderAnnouncementDisabled: true,
|
|
82
|
+
component: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? PanelSplitterTooltip : undefined
|
|
60
83
|
}, children);
|
|
61
84
|
}
|
|
62
85
|
return children;
|
|
@@ -69,21 +92,21 @@ function getTextDirection(element) {
|
|
|
69
92
|
direction = _window$getComputedSt.direction;
|
|
70
93
|
return direction === 'rtl' ? 'rtl' : 'ltr';
|
|
71
94
|
}
|
|
72
|
-
var PortaledPanelSplitter = function PortaledPanelSplitter(
|
|
73
|
-
var label =
|
|
74
|
-
onResizeStart =
|
|
75
|
-
onResizeEnd =
|
|
76
|
-
testId =
|
|
77
|
-
panelId =
|
|
78
|
-
panelWidth =
|
|
79
|
-
onCompleteResize =
|
|
80
|
-
getResizeBounds =
|
|
81
|
-
panel =
|
|
82
|
-
portal =
|
|
83
|
-
resizingCssVar =
|
|
84
|
-
position =
|
|
85
|
-
tooltipContent =
|
|
86
|
-
shortcut =
|
|
95
|
+
var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
96
|
+
var label = _ref3.label,
|
|
97
|
+
onResizeStart = _ref3.onResizeStart,
|
|
98
|
+
onResizeEnd = _ref3.onResizeEnd,
|
|
99
|
+
testId = _ref3.testId,
|
|
100
|
+
panelId = _ref3.panelId,
|
|
101
|
+
panelWidth = _ref3.panelWidth,
|
|
102
|
+
onCompleteResize = _ref3.onCompleteResize,
|
|
103
|
+
getResizeBounds = _ref3.getResizeBounds,
|
|
104
|
+
panel = _ref3.panel,
|
|
105
|
+
portal = _ref3.portal,
|
|
106
|
+
resizingCssVar = _ref3.resizingCssVar,
|
|
107
|
+
position = _ref3.position,
|
|
108
|
+
tooltipContent = _ref3.tooltipContent,
|
|
109
|
+
shortcut = _ref3.shortcut;
|
|
87
110
|
var isFhsEnabled = useIsFhsEnabled();
|
|
88
111
|
var splitterRef = useRef(null);
|
|
89
112
|
var labelId = useId();
|
|
@@ -121,8 +144,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
121
144
|
element: splitter
|
|
122
145
|
}), draggable({
|
|
123
146
|
element: splitter,
|
|
124
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
125
|
-
var nativeSetDragImage =
|
|
147
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref4) {
|
|
148
|
+
var nativeSetDragImage = _ref4.nativeSetDragImage;
|
|
126
149
|
// We will be moving the line to indicate a drag. We can disable the native drag preview
|
|
127
150
|
disableNativeDragPreview({
|
|
128
151
|
nativeSetDragImage: nativeSetDragImage
|
|
@@ -149,8 +172,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
149
172
|
direction: getTextDirection(panel)
|
|
150
173
|
});
|
|
151
174
|
},
|
|
152
|
-
onDragStart: function onDragStart(
|
|
153
|
-
var source =
|
|
175
|
+
onDragStart: function onDragStart(_ref5) {
|
|
176
|
+
var source = _ref5.source;
|
|
154
177
|
invariant(isPanelSplitterDragData(source.data));
|
|
155
178
|
onResizeStart === null || onResizeStart === void 0 || onResizeStart({
|
|
156
179
|
initialWidth: source.data.initialWidth
|
|
@@ -159,9 +182,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
159
182
|
// Close any open layers when the user starts resizing
|
|
160
183
|
openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
|
|
161
184
|
},
|
|
162
|
-
onDrag: function onDrag(
|
|
163
|
-
var location =
|
|
164
|
-
source =
|
|
185
|
+
onDrag: function onDrag(_ref6) {
|
|
186
|
+
var location = _ref6.location,
|
|
187
|
+
source = _ref6.source;
|
|
165
188
|
invariant(isPanelSplitterDragData(source.data));
|
|
166
189
|
var _source$data = source.data,
|
|
167
190
|
initialWidth = _source$data.initialWidth,
|
|
@@ -182,8 +205,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
182
205
|
panel.style.setProperty(resizingCssVar, resizingWidth);
|
|
183
206
|
source.data.resizingWidth = resizingWidth;
|
|
184
207
|
},
|
|
185
|
-
onDrop: function onDrop(
|
|
186
|
-
var source =
|
|
208
|
+
onDrop: function onDrop(_ref7) {
|
|
209
|
+
var source = _ref7.source;
|
|
187
210
|
invariant(isPanelSplitterDragData(source.data));
|
|
188
211
|
preventUnhandled.stop();
|
|
189
212
|
var finalWidth = getPixelWidth(panel);
|
|
@@ -336,12 +359,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
|
|
|
336
359
|
* </Aside>
|
|
337
360
|
* ```
|
|
338
361
|
*/
|
|
339
|
-
export var PanelSplitter = function PanelSplitter(
|
|
340
|
-
var label =
|
|
341
|
-
onResizeStart =
|
|
342
|
-
onResizeEnd =
|
|
343
|
-
testId =
|
|
344
|
-
tooltipContent =
|
|
362
|
+
export var PanelSplitter = function PanelSplitter(_ref8) {
|
|
363
|
+
var label = _ref8.label,
|
|
364
|
+
onResizeStart = _ref8.onResizeStart,
|
|
365
|
+
onResizeEnd = _ref8.onResizeEnd,
|
|
366
|
+
testId = _ref8.testId,
|
|
367
|
+
tooltipContent = _ref8.tooltipContent;
|
|
345
368
|
var _useState7 = useState(null),
|
|
346
369
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
347
370
|
panel = _useState8[0],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20.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",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
83
83
|
"@atlaskit/primitives": "^17.0.0",
|
|
84
84
|
"@atlaskit/tokens": "^9.1.0",
|
|
85
|
-
"@atlaskit/tooltip": "^20.
|
|
85
|
+
"@atlaskit/tooltip": "^20.12.0",
|
|
86
86
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
87
87
|
"@babel/runtime": "^7.0.0",
|
|
88
88
|
"@compiled/react": "^0.18.6",
|