@atlaskit/side-nav-items 1.13.3 → 1.13.5
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 +14 -0
- package/dist/cjs/entry-points/drag-and-drop/drag-handle.js +8 -1
- package/dist/cjs/ui/menu-item/drag-handle/drag-handle-new.compiled.css +9 -0
- package/dist/cjs/ui/menu-item/drag-handle/drag-handle-new.js +28 -0
- package/dist/cjs/ui/menu-item/drag-handle/drag-handle.js +3 -1
- package/dist/cjs/ui/menu-item/drag-handle/lazy-drag-handle.js +5 -1
- package/dist/cjs/ui/menu-item/menu-item.js +6 -1
- package/dist/es2019/entry-points/drag-and-drop/drag-handle.js +6 -1
- package/dist/es2019/ui/menu-item/drag-handle/drag-handle-new.compiled.css +9 -0
- package/dist/es2019/ui/menu-item/drag-handle/drag-handle-new.js +19 -0
- package/dist/es2019/ui/menu-item/drag-handle/drag-handle.js +3 -0
- package/dist/es2019/ui/menu-item/drag-handle/lazy-drag-handle.js +5 -1
- package/dist/es2019/ui/menu-item/menu-item.js +6 -1
- package/dist/esm/entry-points/drag-and-drop/drag-handle.js +6 -1
- package/dist/esm/ui/menu-item/drag-handle/drag-handle-new.compiled.css +9 -0
- package/dist/esm/ui/menu-item/drag-handle/drag-handle-new.js +19 -0
- package/dist/esm/ui/menu-item/drag-handle/drag-handle.js +3 -0
- package/dist/esm/ui/menu-item/drag-handle/lazy-drag-handle.js +5 -1
- package/dist/esm/ui/menu-item/menu-item.js +6 -1
- package/dist/types/entry-points/drag-and-drop/drag-handle.d.ts +1 -0
- package/dist/types/ui/menu-item/drag-handle/drag-handle-new.d.ts +6 -0
- package/dist/types/ui/menu-item/drag-handle/drag-handle.d.ts +1 -0
- package/dist/types/ui/menu-item/drag-handle/lazy-drag-handle.d.ts +4 -1
- package/dist/types-ts4.5/entry-points/drag-and-drop/drag-handle.d.ts +1 -0
- package/dist/types-ts4.5/ui/menu-item/drag-handle/drag-handle-new.d.ts +6 -0
- package/dist/types-ts4.5/ui/menu-item/drag-handle/drag-handle.d.ts +1 -0
- package/dist/types-ts4.5/ui/menu-item/drag-handle/lazy-drag-handle.d.ts +4 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/side-nav-items
|
|
2
2
|
|
|
3
|
+
## 1.13.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.13.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c8202594b3c09`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c8202594b3c09) -
|
|
14
|
+
Preparing to deprecate LazyDragHandle in favour of inline this code, to avoid React hydration
|
|
15
|
+
complications
|
|
16
|
+
|
|
3
17
|
## 1.13.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "DragHandle", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _dragHandleNew.DragHandleNew;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "LazyDragHandle", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
9
15
|
return _lazyDragHandle.LazyDragHandle;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
|
-
var _lazyDragHandle = require("../../ui/menu-item/drag-handle/lazy-drag-handle");
|
|
18
|
+
var _lazyDragHandle = require("../../ui/menu-item/drag-handle/lazy-drag-handle");
|
|
19
|
+
var _dragHandleNew = require("../../ui/menu-item/drag-handle/drag-handle-new");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._152tidpf{inset-block-start:0}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
3
|
+
._1e02idpf{inset-inline-start:0}
|
|
4
|
+
._1e0c1i3c{display:var(--drag-handle-display,none)}
|
|
5
|
+
._2lx21bp4{flex-direction:column}
|
|
6
|
+
._ahbqxmi2{margin-inline-start:var(--ds-space-negative-150,-9pt)}
|
|
7
|
+
._kqswstnw{position:absolute}
|
|
8
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
9
|
+
._u7coidpf{inset-block-end:0}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* drag-handle-new.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.DragHandleNew = DragHandleNew;
|
|
10
|
+
require("./drag-handle-new.compiled.css");
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
13
|
+
var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical"));
|
|
14
|
+
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); }
|
|
15
|
+
var styles = {
|
|
16
|
+
root: "_syazazsu _1e0c1i3c _2lx21bp4 _1bah1h6o _kqswstnw _152tidpf _u7coidpf _1e02idpf _ahbqxmi2"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
20
|
+
function DragHandleNew() {
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: (0, _runtime.ax)([styles.root])
|
|
24
|
+
}, /*#__PURE__*/React.createElement(_dragHandleVertical.default, {
|
|
25
|
+
label: "",
|
|
26
|
+
size: "small"
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
@@ -6,7 +6,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.default = DragHandle;
|
|
9
|
+
exports.default = exports.DragHandle = DragHandle;
|
|
10
10
|
require("./drag-handle.compiled.css");
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
@@ -17,6 +17,8 @@ var styles = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// Using default export to play well with React.lazy
|
|
20
|
+
|
|
21
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
20
22
|
function DragHandle() {
|
|
21
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
24
|
"aria-hidden": "true",
|
|
@@ -9,10 +9,11 @@ exports.LazyDragHandle = LazyDragHandle;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
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); }
|
|
12
|
+
// Remove LazyDragHandle when "navx-4718-inline-drag-handle" is cleaned up.
|
|
12
13
|
/**
|
|
13
14
|
* A wrapper around `React.lazy` that defers rendering until after the component has mounted.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
+
* We think this avoids hydration errors because:
|
|
16
17
|
* - On the server: `Component` is `null`, so nothing is rendered.
|
|
17
18
|
* - On the first client render (hydration): `Component` is still `null`, matching the server HTML.
|
|
18
19
|
* - After mount: `useEffect` fires, sets the lazy component, and triggers a re-render
|
|
@@ -24,6 +25,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
24
25
|
*
|
|
25
26
|
* By deferring to after mount, both server and initial client render agree on `null`,
|
|
26
27
|
* and the lazy import + Suspense only kicks in after hydration is complete.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
* @deprecated - use DragHandle instead.
|
|
27
31
|
*/
|
|
28
32
|
function LazyDragHandle() {
|
|
29
33
|
var _useState = (0, _react.useState)(null),
|
|
@@ -17,9 +17,11 @@ var _avatar = require("@atlaskit/avatar");
|
|
|
17
17
|
var _forwardRefWithGeneric = _interopRequireDefault(require("@atlaskit/ds-lib/forward-ref-with-generic"));
|
|
18
18
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
20
21
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
22
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
22
23
|
var _constants = require("./constants");
|
|
24
|
+
var _dragHandleNew = require("./drag-handle/drag-handle-new");
|
|
23
25
|
var _lazyDragHandle = require("./drag-handle/lazy-drag-handle");
|
|
24
26
|
var _expandableMenuItemContext = require("./expandable-menu-item/expandable-menu-item-context");
|
|
25
27
|
var _flyoutMenuItemContext = require("./flyout-menu-item/flyout-menu-item-context");
|
|
@@ -303,7 +305,7 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref2, forwardedRef) {
|
|
|
303
305
|
size: "small",
|
|
304
306
|
maxLines: 1,
|
|
305
307
|
ref: descriptionRef
|
|
306
|
-
}, description)), hasDragIndicator ? /*#__PURE__*/_react.default.createElement(
|
|
308
|
+
}, description)), hasDragIndicator ? /*#__PURE__*/_react.default.createElement(TemporaryDragHandle, null) : null, dropIndicator);
|
|
307
309
|
|
|
308
310
|
/**
|
|
309
311
|
* If the [expandable] menu item is expanded, show hover actions even when *not* hovered.
|
|
@@ -396,6 +398,9 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref2, forwardedRef) {
|
|
|
396
398
|
}, actions)));
|
|
397
399
|
};
|
|
398
400
|
|
|
401
|
+
// Remove this when FG is cleaned up
|
|
402
|
+
var TemporaryDragHandle = (0, _platformFeatureFlagsReact.componentWithFG)('navx-4718-inline-drag-handle', _dragHandleNew.DragHandleNew, _lazyDragHandle.LazyDragHandle);
|
|
403
|
+
|
|
399
404
|
/**
|
|
400
405
|
* __MenuItemBase__
|
|
401
406
|
*
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// Remove LazyDragHandle when "navx-4718-inline-drag-handle" is cleaned up.
|
|
2
|
+
export { LazyDragHandle } from '../../ui/menu-item/drag-handle/lazy-drag-handle';
|
|
3
|
+
|
|
4
|
+
// By exporting DragHandle, we are effectively breaking the bundling that the lazy-drag-handle was using.
|
|
5
|
+
// We can't use importCond in platform packages, so we don't have a choice.
|
|
6
|
+
export { DragHandleNew as DragHandle } from '../../ui/menu-item/drag-handle/drag-handle-new';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._152tidpf{inset-block-start:0}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
3
|
+
._1e02idpf{inset-inline-start:0}
|
|
4
|
+
._1e0c1i3c{display:var(--drag-handle-display,none)}
|
|
5
|
+
._2lx21bp4{flex-direction:column}
|
|
6
|
+
._ahbqxmi2{margin-inline-start:var(--ds-space-negative-150,-9pt)}
|
|
7
|
+
._kqswstnw{position:absolute}
|
|
8
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
9
|
+
._u7coidpf{inset-block-end:0}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* drag-handle-new.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import "./drag-handle-new.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
6
|
+
const styles = {
|
|
7
|
+
root: "_syazazsu _1e0c1i3c _2lx21bp4 _1bah1h6o _kqswstnw _152tidpf _u7coidpf _1e02idpf _ahbqxmi2"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
11
|
+
export function DragHandleNew() {
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
className: ax([styles.root])
|
|
15
|
+
}, /*#__PURE__*/React.createElement(DragHandleVerticalIcon, {
|
|
16
|
+
label: "",
|
|
17
|
+
size: "small"
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
@@ -8,6 +8,9 @@ const styles = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Using default export to play well with React.lazy
|
|
11
|
+
export { DragHandle };
|
|
12
|
+
|
|
13
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
11
14
|
export default function DragHandle() {
|
|
12
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
16
|
"aria-hidden": "true",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { lazy, Suspense, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
+
// Remove LazyDragHandle when "navx-4718-inline-drag-handle" is cleaned up.
|
|
3
4
|
/**
|
|
4
5
|
* A wrapper around `React.lazy` that defers rendering until after the component has mounted.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* We think this avoids hydration errors because:
|
|
7
8
|
* - On the server: `Component` is `null`, so nothing is rendered.
|
|
8
9
|
* - On the first client render (hydration): `Component` is still `null`, matching the server HTML.
|
|
9
10
|
* - After mount: `useEffect` fires, sets the lazy component, and triggers a re-render
|
|
@@ -15,6 +16,9 @@ import React, { lazy, Suspense, useEffect, useState } from 'react';
|
|
|
15
16
|
*
|
|
16
17
|
* By deferring to after mount, both server and initial client render agree on `null`,
|
|
17
18
|
* and the lazy import + Suspense only kicks in after hydration is complete.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
* @deprecated - use DragHandle instead.
|
|
18
22
|
*/
|
|
19
23
|
export function LazyDragHandle() {
|
|
20
24
|
const [Component, setComponent] = useState(null);
|
|
@@ -8,9 +8,11 @@ import { AvatarContext } from '@atlaskit/avatar';
|
|
|
8
8
|
import forwardRefWithGeneric from '@atlaskit/ds-lib/forward-ref-with-generic';
|
|
9
9
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
11
12
|
import { Anchor, Pressable, Text } from '@atlaskit/primitives/compiled';
|
|
12
13
|
import Tooltip from '@atlaskit/tooltip';
|
|
13
14
|
import { expandableMenuItemIndentation } from './constants';
|
|
15
|
+
import { DragHandleNew } from './drag-handle/drag-handle-new';
|
|
14
16
|
import { LazyDragHandle } from './drag-handle/lazy-drag-handle';
|
|
15
17
|
import { useLevel } from './expandable-menu-item/expandable-menu-item-context';
|
|
16
18
|
import { useFlyoutMenuOpen, useSetFlyoutMenuOpen } from './flyout-menu-item/flyout-menu-item-context';
|
|
@@ -293,7 +295,7 @@ const MenuItemBaseNoRef = ({
|
|
|
293
295
|
size: "small",
|
|
294
296
|
maxLines: 1,
|
|
295
297
|
ref: descriptionRef
|
|
296
|
-
}, description)), hasDragIndicator ? /*#__PURE__*/React.createElement(
|
|
298
|
+
}, description)), hasDragIndicator ? /*#__PURE__*/React.createElement(TemporaryDragHandle, null) : null, dropIndicator);
|
|
297
299
|
|
|
298
300
|
/**
|
|
299
301
|
* If the [expandable] menu item is expanded, show hover actions even when *not* hovered.
|
|
@@ -385,6 +387,9 @@ const MenuItemBaseNoRef = ({
|
|
|
385
387
|
}, actions)));
|
|
386
388
|
};
|
|
387
389
|
|
|
390
|
+
// Remove this when FG is cleaned up
|
|
391
|
+
const TemporaryDragHandle = componentWithFG('navx-4718-inline-drag-handle', DragHandleNew, LazyDragHandle);
|
|
392
|
+
|
|
388
393
|
/**
|
|
389
394
|
* __MenuItemBase__
|
|
390
395
|
*
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// Remove LazyDragHandle when "navx-4718-inline-drag-handle" is cleaned up.
|
|
2
|
+
export { LazyDragHandle } from '../../ui/menu-item/drag-handle/lazy-drag-handle';
|
|
3
|
+
|
|
4
|
+
// By exporting DragHandle, we are effectively breaking the bundling that the lazy-drag-handle was using.
|
|
5
|
+
// We can't use importCond in platform packages, so we don't have a choice.
|
|
6
|
+
export { DragHandleNew as DragHandle } from '../../ui/menu-item/drag-handle/drag-handle-new';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._152tidpf{inset-block-start:0}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
3
|
+
._1e02idpf{inset-inline-start:0}
|
|
4
|
+
._1e0c1i3c{display:var(--drag-handle-display,none)}
|
|
5
|
+
._2lx21bp4{flex-direction:column}
|
|
6
|
+
._ahbqxmi2{margin-inline-start:var(--ds-space-negative-150,-9pt)}
|
|
7
|
+
._kqswstnw{position:absolute}
|
|
8
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
9
|
+
._u7coidpf{inset-block-end:0}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* drag-handle-new.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import "./drag-handle-new.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
6
|
+
var styles = {
|
|
7
|
+
root: "_syazazsu _1e0c1i3c _2lx21bp4 _1bah1h6o _kqswstnw _152tidpf _u7coidpf _1e02idpf _ahbqxmi2"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
11
|
+
export function DragHandleNew() {
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
className: ax([styles.root])
|
|
15
|
+
}, /*#__PURE__*/React.createElement(DragHandleVerticalIcon, {
|
|
16
|
+
label: "",
|
|
17
|
+
size: "small"
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
@@ -8,6 +8,9 @@ var styles = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Using default export to play well with React.lazy
|
|
11
|
+
export { DragHandle };
|
|
12
|
+
|
|
13
|
+
// Remove the "default" when "navx-4718-inline-drag-handle" is cleaned up
|
|
11
14
|
export default function DragHandle() {
|
|
12
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
16
|
"aria-hidden": "true",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { lazy, Suspense, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
|
+
// Remove LazyDragHandle when "navx-4718-inline-drag-handle" is cleaned up.
|
|
4
5
|
/**
|
|
5
6
|
* A wrapper around `React.lazy` that defers rendering until after the component has mounted.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* We think this avoids hydration errors because:
|
|
8
9
|
* - On the server: `Component` is `null`, so nothing is rendered.
|
|
9
10
|
* - On the first client render (hydration): `Component` is still `null`, matching the server HTML.
|
|
10
11
|
* - After mount: `useEffect` fires, sets the lazy component, and triggers a re-render
|
|
@@ -16,6 +17,9 @@ import React, { lazy, Suspense, useEffect, useState } from 'react';
|
|
|
16
17
|
*
|
|
17
18
|
* By deferring to after mount, both server and initial client render agree on `null`,
|
|
18
19
|
* and the lazy import + Suspense only kicks in after hydration is complete.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
* @deprecated - use DragHandle instead.
|
|
19
23
|
*/
|
|
20
24
|
export function LazyDragHandle() {
|
|
21
25
|
var _useState = useState(null),
|
|
@@ -11,9 +11,11 @@ import { AvatarContext } from '@atlaskit/avatar';
|
|
|
11
11
|
import forwardRefWithGeneric from '@atlaskit/ds-lib/forward-ref-with-generic';
|
|
12
12
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
14
15
|
import { Anchor, Pressable, Text } from '@atlaskit/primitives/compiled';
|
|
15
16
|
import Tooltip from '@atlaskit/tooltip';
|
|
16
17
|
import { expandableMenuItemIndentation } from './constants';
|
|
18
|
+
import { DragHandleNew } from './drag-handle/drag-handle-new';
|
|
17
19
|
import { LazyDragHandle } from './drag-handle/lazy-drag-handle';
|
|
18
20
|
import { useLevel } from './expandable-menu-item/expandable-menu-item-context';
|
|
19
21
|
import { useFlyoutMenuOpen, useSetFlyoutMenuOpen } from './flyout-menu-item/flyout-menu-item-context';
|
|
@@ -294,7 +296,7 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref2, forwardedRef) {
|
|
|
294
296
|
size: "small",
|
|
295
297
|
maxLines: 1,
|
|
296
298
|
ref: descriptionRef
|
|
297
|
-
}, description)), hasDragIndicator ? /*#__PURE__*/React.createElement(
|
|
299
|
+
}, description)), hasDragIndicator ? /*#__PURE__*/React.createElement(TemporaryDragHandle, null) : null, dropIndicator);
|
|
298
300
|
|
|
299
301
|
/**
|
|
300
302
|
* If the [expandable] menu item is expanded, show hover actions even when *not* hovered.
|
|
@@ -387,6 +389,9 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref2, forwardedRef) {
|
|
|
387
389
|
}, actions)));
|
|
388
390
|
};
|
|
389
391
|
|
|
392
|
+
// Remove this when FG is cleaned up
|
|
393
|
+
var TemporaryDragHandle = componentWithFG('navx-4718-inline-drag-handle', DragHandleNew, LazyDragHandle);
|
|
394
|
+
|
|
390
395
|
/**
|
|
391
396
|
* __MenuItemBase__
|
|
392
397
|
*
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* A wrapper around `React.lazy` that defers rendering until after the component has mounted.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* We think this avoids hydration errors because:
|
|
6
6
|
* - On the server: `Component` is `null`, so nothing is rendered.
|
|
7
7
|
* - On the first client render (hydration): `Component` is still `null`, matching the server HTML.
|
|
8
8
|
* - After mount: `useEffect` fires, sets the lazy component, and triggers a re-render
|
|
@@ -14,5 +14,8 @@ import React from 'react';
|
|
|
14
14
|
*
|
|
15
15
|
* By deferring to after mount, both server and initial client render agree on `null`,
|
|
16
16
|
* and the lazy import + Suspense only kicks in after hydration is complete.
|
|
17
|
+
*
|
|
18
|
+
* @private
|
|
19
|
+
* @deprecated - use DragHandle instead.
|
|
17
20
|
*/
|
|
18
21
|
export declare function LazyDragHandle(): React.JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* A wrapper around `React.lazy` that defers rendering until after the component has mounted.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* We think this avoids hydration errors because:
|
|
6
6
|
* - On the server: `Component` is `null`, so nothing is rendered.
|
|
7
7
|
* - On the first client render (hydration): `Component` is still `null`, matching the server HTML.
|
|
8
8
|
* - After mount: `useEffect` fires, sets the lazy component, and triggers a re-render
|
|
@@ -14,5 +14,8 @@ import React from 'react';
|
|
|
14
14
|
*
|
|
15
15
|
* By deferring to after mount, both server and initial client render agree on `null`,
|
|
16
16
|
* and the lazy import + Suspense only kicks in after hydration is complete.
|
|
17
|
+
*
|
|
18
|
+
* @private
|
|
19
|
+
* @deprecated - use DragHandle instead.
|
|
17
20
|
*/
|
|
18
21
|
export declare function LazyDragHandle(): React.JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/side-nav-items",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.5",
|
|
4
4
|
"description": "Menu items and elements for the side nav area.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,20 +37,21 @@
|
|
|
37
37
|
"atlaskit:src": "src/index.ts",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
40
|
-
"@atlaskit/avatar": "^25.
|
|
40
|
+
"@atlaskit/avatar": "^25.14.0",
|
|
41
41
|
"@atlaskit/button": "^23.11.0",
|
|
42
42
|
"@atlaskit/css": "^0.19.0",
|
|
43
43
|
"@atlaskit/ds-lib": "^7.0.0",
|
|
44
44
|
"@atlaskit/heading": "^5.4.0",
|
|
45
|
-
"@atlaskit/icon": "^34.
|
|
45
|
+
"@atlaskit/icon": "^34.3.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
|
-
"@atlaskit/
|
|
47
|
+
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
48
|
+
"@atlaskit/popup": "^4.17.0",
|
|
48
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.8.0",
|
|
49
50
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
50
51
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
51
52
|
"@atlaskit/primitives": "^19.0.0",
|
|
52
53
|
"@atlaskit/tokens": "^13.0.0",
|
|
53
|
-
"@atlaskit/tooltip": "^
|
|
54
|
+
"@atlaskit/tooltip": "^22.0.0",
|
|
54
55
|
"@babel/runtime": "^7.0.0",
|
|
55
56
|
"@compiled/react": "^0.20.0",
|
|
56
57
|
"tiny-invariant": "^1.2.0"
|
|
@@ -64,8 +65,8 @@
|
|
|
64
65
|
"@af/integration-testing": "workspace:^",
|
|
65
66
|
"@af/visual-regression": "workspace:^",
|
|
66
67
|
"@atlaskit/app-provider": "^4.3.0",
|
|
67
|
-
"@atlaskit/lozenge": "^13.
|
|
68
|
-
"@atlaskit/navigation-system": "^
|
|
68
|
+
"@atlaskit/lozenge": "^13.8.0",
|
|
69
|
+
"@atlaskit/navigation-system": "^9.1.0",
|
|
69
70
|
"@atlaskit/ssr": "workspace:^",
|
|
70
71
|
"@atlassian/a11y-jest-testing": "^0.11.0",
|
|
71
72
|
"@atlassian/a11y-playwright-testing": "^0.9.0",
|