@atlaskit/navigation-system 5.18.1 → 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 CHANGED
@@ -1,5 +1,25 @@
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
+
15
+ ## 5.19.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`819adcd884291`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/819adcd884291) -
20
+ Tidy `platform_dst_nav4_side_nav_toggle_ref_fix` feature gate. This addresses a potential issue
21
+ with refs becoming stale.
22
+
3
23
  ## 5.18.1
4
24
 
5
25
  ### Patch 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(_ref) {
59
- var tooltipContent = _ref.tooltipContent,
60
- shortcut = _ref.shortcut,
61
- children = _ref.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: "mouse",
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(_ref2) {
83
- var label = _ref2.label,
84
- onResizeStart = _ref2.onResizeStart,
85
- onResizeEnd = _ref2.onResizeEnd,
86
- testId = _ref2.testId,
87
- panelId = _ref2.panelId,
88
- panelWidth = _ref2.panelWidth,
89
- onCompleteResize = _ref2.onCompleteResize,
90
- getResizeBounds = _ref2.getResizeBounds,
91
- panel = _ref2.panel,
92
- portal = _ref2.portal,
93
- resizingCssVar = _ref2.resizingCssVar,
94
- position = _ref2.position,
95
- tooltipContent = _ref2.tooltipContent,
96
- shortcut = _ref2.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(_ref3) {
135
- var nativeSetDragImage = _ref3.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(_ref4) {
163
- var source = _ref4.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(_ref5) {
173
- var location = _ref5.location,
174
- source = _ref5.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(_ref6) {
196
- var source = _ref6.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(_ref7) {
350
- var label = _ref7.label,
351
- onResizeStart = _ref7.onResizeStart,
352
- onResizeEnd = _ref7.onResizeEnd,
353
- testId = _ref7.testId,
354
- tooltipContent = _ref7.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],
@@ -66,11 +66,9 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
66
66
  isSideNavExpanded = _useState2[0],
67
67
  setIsSideNavExpanded = _useState2[1];
68
68
  var ref = (0, _react.useContext)(_toggleButtonContext.SideNavToggleButtonAttachRef);
69
- var elementRef = (0, _react.useRef)(null);
70
69
 
71
70
  /**
72
- * Attempts to address HOT-121458 by ensuring that the toggle button element
73
- * in context is always up to date.
71
+ * Addresses HOT-121458 by ensuring that the toggle button element in context is always up to date.
74
72
  *
75
73
  * My theory is that something to do with SSR, hydration and suspense was causing the
76
74
  * underlying HTML element to change but without causing the toggle button to remount.
@@ -82,15 +80,8 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
82
80
  element = _useState4[0],
83
81
  setElement = _useState4[1];
84
82
  (0, _react.useEffect)(function () {
85
- if ((0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_toggle_ref_fix')) {
86
- ref(element);
87
- }
83
+ ref(element);
88
84
  }, [element, ref]);
89
- (0, _react.useEffect)(function () {
90
- if (!(0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_toggle_ref_fix')) {
91
- ref(elementRef.current);
92
- }
93
- }, [elementRef, ref]);
94
85
  (0, _react.useEffect)(function () {
95
86
  var _window$matchMedia = window.matchMedia('(min-width: 64rem)'),
96
87
  matches = _window$matchMedia.matches;
@@ -181,7 +172,7 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
181
172
  testId: testId,
182
173
  isTooltipDisabled: false,
183
174
  interactionName: interactionName,
184
- ref: (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_toggle_ref_fix') ? setElement : elementRef,
175
+ ref: setElement,
185
176
  tooltip: tooltipProps
186
177
  });
187
178
  };
@@ -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: "mouse",
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;
@@ -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, useMemo, useRef, useState } from 'react';
4
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
5
5
  import { bind } from 'bind-event-listener';
6
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
7
  import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
@@ -51,11 +51,9 @@ export const SideNavToggleButton = ({
51
51
  // initialized in SSR
52
52
  const [isSideNavExpanded, setIsSideNavExpanded] = useState(sideNavState === null || !fg('platform_dst_nav4_side_nav_default_collapsed_api') ? !defaultCollapsed : isSideNavExpandedOnDesktop);
53
53
  const ref = useContext(SideNavToggleButtonAttachRef);
54
- const elementRef = useRef(null);
55
54
 
56
55
  /**
57
- * Attempts to address HOT-121458 by ensuring that the toggle button element
58
- * in context is always up to date.
56
+ * Addresses HOT-121458 by ensuring that the toggle button element in context is always up to date.
59
57
  *
60
58
  * My theory is that something to do with SSR, hydration and suspense was causing the
61
59
  * underlying HTML element to change but without causing the toggle button to remount.
@@ -64,15 +62,8 @@ export const SideNavToggleButton = ({
64
62
  */
65
63
  const [element, setElement] = useState(null);
66
64
  useEffect(() => {
67
- if (fg('platform_dst_nav4_side_nav_toggle_ref_fix')) {
68
- ref(element);
69
- }
65
+ ref(element);
70
66
  }, [element, ref]);
71
- useEffect(() => {
72
- if (!fg('platform_dst_nav4_side_nav_toggle_ref_fix')) {
73
- ref(elementRef.current);
74
- }
75
- }, [elementRef, ref]);
76
67
  useEffect(() => {
77
68
  const {
78
69
  matches
@@ -164,7 +155,7 @@ export const SideNavToggleButton = ({
164
155
  testId: testId,
165
156
  isTooltipDisabled: false,
166
157
  interactionName: interactionName,
167
- ref: fg('platform_dst_nav4_side_nav_toggle_ref_fix') ? setElement : elementRef,
158
+ ref: setElement,
168
159
  tooltip: tooltipProps
169
160
  });
170
161
  };
@@ -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(_ref) {
49
- var tooltipContent = _ref.tooltipContent,
50
- shortcut = _ref.shortcut,
51
- children = _ref.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: "mouse",
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(_ref2) {
73
- var label = _ref2.label,
74
- onResizeStart = _ref2.onResizeStart,
75
- onResizeEnd = _ref2.onResizeEnd,
76
- testId = _ref2.testId,
77
- panelId = _ref2.panelId,
78
- panelWidth = _ref2.panelWidth,
79
- onCompleteResize = _ref2.onCompleteResize,
80
- getResizeBounds = _ref2.getResizeBounds,
81
- panel = _ref2.panel,
82
- portal = _ref2.portal,
83
- resizingCssVar = _ref2.resizingCssVar,
84
- position = _ref2.position,
85
- tooltipContent = _ref2.tooltipContent,
86
- shortcut = _ref2.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(_ref3) {
125
- var nativeSetDragImage = _ref3.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(_ref4) {
153
- var source = _ref4.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(_ref5) {
163
- var location = _ref5.location,
164
- source = _ref5.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(_ref6) {
186
- var source = _ref6.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(_ref7) {
340
- var label = _ref7.label,
341
- onResizeStart = _ref7.onResizeStart,
342
- onResizeEnd = _ref7.onResizeEnd,
343
- testId = _ref7.testId,
344
- tooltipContent = _ref7.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],
@@ -5,7 +5,7 @@ import "./toggle-button.compiled.css";
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
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
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';
8
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
9
9
  import { bind } from 'bind-event-listener';
10
10
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
11
11
  import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
@@ -57,11 +57,9 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
57
57
  isSideNavExpanded = _useState2[0],
58
58
  setIsSideNavExpanded = _useState2[1];
59
59
  var ref = useContext(SideNavToggleButtonAttachRef);
60
- var elementRef = useRef(null);
61
60
 
62
61
  /**
63
- * Attempts to address HOT-121458 by ensuring that the toggle button element
64
- * in context is always up to date.
62
+ * Addresses HOT-121458 by ensuring that the toggle button element in context is always up to date.
65
63
  *
66
64
  * My theory is that something to do with SSR, hydration and suspense was causing the
67
65
  * underlying HTML element to change but without causing the toggle button to remount.
@@ -73,15 +71,8 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
73
71
  element = _useState4[0],
74
72
  setElement = _useState4[1];
75
73
  useEffect(function () {
76
- if (fg('platform_dst_nav4_side_nav_toggle_ref_fix')) {
77
- ref(element);
78
- }
74
+ ref(element);
79
75
  }, [element, ref]);
80
- useEffect(function () {
81
- if (!fg('platform_dst_nav4_side_nav_toggle_ref_fix')) {
82
- ref(elementRef.current);
83
- }
84
- }, [elementRef, ref]);
85
76
  useEffect(function () {
86
77
  var _window$matchMedia = window.matchMedia('(min-width: 64rem)'),
87
78
  matches = _window$matchMedia.matches;
@@ -172,7 +163,7 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
172
163
  testId: testId,
173
164
  isTooltipDisabled: false,
174
165
  interactionName: interactionName,
175
- ref: fg('platform_dst_nav4_side_nav_toggle_ref_fix') ? setElement : elementRef,
166
+ ref: setElement,
176
167
  tooltip: tooltipProps
177
168
  });
178
169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "5.18.1",
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.11.0",
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",
@@ -116,7 +116,7 @@
116
116
  "@atlaskit/skeleton": "^2.1.0",
117
117
  "@atlaskit/textfield": "^8.2.0",
118
118
  "@atlassian/feature-flags-test-utils": "^1.0.0",
119
- "@atlassian/gemini": "^1.27.0",
119
+ "@atlassian/gemini": "^1.28.0",
120
120
  "@atlassian/search-dialog": "^9.10.0",
121
121
  "@atlassian/ssr-tests": "workspace:^",
122
122
  "@atlassian/test-utils": "^1.0.0",
@@ -157,9 +157,6 @@
157
157
  "platform_dst_nav4_side_nav_default_collapsed_api": {
158
158
  "type": "boolean"
159
159
  },
160
- "platform_dst_nav4_side_nav_toggle_ref_fix": {
161
- "type": "boolean"
162
- },
163
160
  "platform-component-visual-refresh": {
164
161
  "type": "boolean",
165
162
  "referenceOnly": true