@atlaskit/side-navigation 11.1.12 → 11.1.13
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 +7 -0
- package/dist/cjs/common/use-child-ids-effect.js +24 -0
- package/dist/cjs/common/use-child-ids.js +23 -0
- package/dist/cjs/components/Footer/index.js +4 -4
- package/dist/cjs/components/Header/header-container.js +53 -0
- package/dist/cjs/components/Header/index.js +5 -48
- package/dist/cjs/components/NestableNavigationContent/index.js +4 -4
- package/dist/cjs/components/NestingItem/index.js +8 -6
- package/dist/cjs/index.js +33 -18
- package/dist/es2019/common/use-child-ids-effect.js +18 -0
- package/dist/es2019/common/use-child-ids.js +17 -0
- package/dist/es2019/components/Footer/index.js +3 -3
- package/dist/es2019/components/Header/header-container.js +44 -0
- package/dist/es2019/components/Header/index.js +3 -44
- package/dist/es2019/components/NestableNavigationContent/index.js +2 -2
- package/dist/es2019/components/NestingItem/index.js +4 -2
- package/dist/es2019/index.js +15 -1
- package/dist/esm/common/use-child-ids-effect.js +18 -0
- package/dist/esm/common/use-child-ids.js +17 -0
- package/dist/esm/components/Footer/index.js +3 -3
- package/dist/esm/components/Header/header-container.js +46 -0
- package/dist/esm/components/Header/index.js +3 -46
- package/dist/esm/components/NestableNavigationContent/index.js +2 -2
- package/dist/esm/components/NestingItem/index.js +4 -2
- package/dist/esm/index.js +15 -1
- package/dist/types/common/use-child-ids-effect.d.ts +3 -0
- package/dist/types/common/use-child-ids.d.ts +5 -0
- package/dist/types/components/Header/header-container.d.ts +8 -0
- package/dist/types/components/Header/index.d.ts +0 -6
- package/dist/types/index.d.ts +30 -2
- package/dist/types-ts4.5/common/use-child-ids-effect.d.ts +3 -0
- package/dist/types-ts4.5/common/use-child-ids.d.ts +5 -0
- package/dist/types-ts4.5/components/Header/header-container.d.ts +8 -0
- package/dist/types-ts4.5/components/Header/index.d.ts +0 -6
- package/dist/types-ts4.5/index.d.ts +30 -2
- package/package.json +1 -1
- package/dist/cjs/components/Item/index.js +0 -41
- package/dist/cjs/components/NestingItem/hack-for-ert.js +0 -8
- package/dist/cjs/components/index.js +0 -119
- package/dist/cjs/components/utils/hooks.js +0 -38
- package/dist/es2019/components/Item/index.js +0 -5
- package/dist/es2019/components/NestingItem/hack-for-ert.js +0 -2
- package/dist/es2019/components/index.js +0 -11
- package/dist/es2019/components/utils/hooks.js +0 -32
- package/dist/esm/components/Item/index.js +0 -5
- package/dist/esm/components/NestingItem/hack-for-ert.js +0 -2
- package/dist/esm/components/index.js +0 -11
- package/dist/esm/components/utils/hooks.js +0 -32
- package/dist/types/components/Item/index.d.ts +0 -10
- package/dist/types/components/NestingItem/hack-for-ert.d.ts +0 -2
- package/dist/types/components/index.d.ts +0 -22
- package/dist/types/components/utils/hooks.d.ts +0 -5
- package/dist/types-ts4.5/components/Item/index.d.ts +0 -10
- package/dist/types-ts4.5/components/NestingItem/hack-for-ert.d.ts +0 -2
- package/dist/types-ts4.5/components/index.d.ts +0 -22
- package/dist/types-ts4.5/components/utils/hooks.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 11.1.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c966e427a25c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c966e427a25c6) -
|
|
8
|
+
Removes internal barrel files and instead imports modules directly.
|
|
9
|
+
|
|
3
10
|
## 11.1.12
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var useChildIdsEffect = function useChildIdsEffect(childIds, id) {
|
|
9
|
+
(0, _react.useEffect)(function () {
|
|
10
|
+
if (!childIds || !childIds.current) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!childIds.current.has(id)) {
|
|
14
|
+
childIds.current.add(id);
|
|
15
|
+
}
|
|
16
|
+
return function () {
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
childIds.current.delete(id);
|
|
19
|
+
};
|
|
20
|
+
// childIds shouldn't change as it's a ref
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
}, [id]);
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = useChildIdsEffect;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _NestableNavigationContent = require("../components/NestableNavigationContent");
|
|
9
|
+
var useChildIds = function useChildIds(currentStackId, committedStack, onUnknownNest) {
|
|
10
|
+
var childIdsRef = (0, _react.useRef)(new Set());
|
|
11
|
+
(0, _react.useEffect)(function () {
|
|
12
|
+
// we are holding navigation item IDs in childIdsRef
|
|
13
|
+
// check if the current displayed nav item (currentStackId) is in childIdsRef. if it's not, this means it's undefined
|
|
14
|
+
if (currentStackId === _NestableNavigationContent.ROOT_ID || !childIdsRef.current.size || childIdsRef.current.has(currentStackId) || !onUnknownNest) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
onUnknownNest(committedStack || [currentStackId]);
|
|
18
|
+
}, [currentStackId, committedStack, onUnknownNest]);
|
|
19
|
+
return {
|
|
20
|
+
childIdsRef: childIdsRef
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = useChildIds;
|
|
@@ -13,8 +13,8 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
14
|
var _warnOnce = _interopRequireDefault(require("@atlaskit/ds-lib/warn-once"));
|
|
15
15
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var _headerContainer = _interopRequireDefault(require("../Header/header-container"));
|
|
17
|
+
var _customItem = _interopRequireDefault(require("../Item/custom-item"));
|
|
18
18
|
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); }
|
|
19
19
|
/* eslint-disable @repo/internal/react/consistent-props-definitions */
|
|
20
20
|
var styles = {
|
|
@@ -43,8 +43,8 @@ var OldFooter = function OldFooter(props) {
|
|
|
43
43
|
testId: testId
|
|
44
44
|
};
|
|
45
45
|
}(props);
|
|
46
|
-
return /*#__PURE__*/React.createElement(
|
|
47
|
-
component: props.component ||
|
|
46
|
+
return /*#__PURE__*/React.createElement(_customItem.default, (0, _extends2.default)({}, safeProps, {
|
|
47
|
+
component: props.component || _headerContainer.default,
|
|
48
48
|
className: (0, _runtime.ax)([styles.oldFooter])
|
|
49
49
|
}));
|
|
50
50
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _excluded = ["children", "data-testid"];
|
|
12
|
+
/**
|
|
13
|
+
* __Container__
|
|
14
|
+
*
|
|
15
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
16
|
+
*/
|
|
17
|
+
var HeaderContainer = function HeaderContainer(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
testId = _ref['data-testid'],
|
|
20
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
21
|
+
// https://stackoverflow.com/a/39333479
|
|
22
|
+
var safeProps = function (_ref2) {
|
|
23
|
+
var className = _ref2.className,
|
|
24
|
+
onClick = _ref2.onClick,
|
|
25
|
+
onMouseDown = _ref2.onMouseDown,
|
|
26
|
+
onDragStart = _ref2.onDragStart,
|
|
27
|
+
draggable = _ref2.draggable,
|
|
28
|
+
ref = _ref2.ref,
|
|
29
|
+
tabIndex = _ref2.tabIndex,
|
|
30
|
+
disabled = _ref2.disabled;
|
|
31
|
+
return {
|
|
32
|
+
className: className,
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
onMouseDown: onMouseDown,
|
|
35
|
+
onDragStart: onDragStart,
|
|
36
|
+
draggable: draggable,
|
|
37
|
+
ref: ref,
|
|
38
|
+
tabIndex: tabIndex,
|
|
39
|
+
disabled: disabled
|
|
40
|
+
};
|
|
41
|
+
}(props);
|
|
42
|
+
return (
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
+
_react.default.createElement("div", (0, _extends2.default)({
|
|
46
|
+
"data-testid": testId,
|
|
47
|
+
style: {
|
|
48
|
+
position: 'relative'
|
|
49
|
+
}
|
|
50
|
+
}, safeProps), children)
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
var _default = exports.default = HeaderContainer;
|
|
@@ -6,60 +6,17 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.default =
|
|
9
|
+
exports.default = void 0;
|
|
10
10
|
require("./index.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var _customItem = _interopRequireDefault(require("../Item/custom-item"));
|
|
15
|
+
var _headerContainer = _interopRequireDefault(require("./header-container"));
|
|
17
16
|
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); }
|
|
18
17
|
var styles = {
|
|
19
18
|
header: "_uizt1wug _vrjt1qyo _1cmdi7uo _11kjsm61 _jl2n73ad _1et6sm61 _1v6ji7uo"
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* __Container__
|
|
24
|
-
*
|
|
25
|
-
* A container for Header and Footer that safely handles props to the child component
|
|
26
|
-
*/
|
|
27
|
-
var Container = exports.Container = function Container(_ref) {
|
|
28
|
-
var children = _ref.children,
|
|
29
|
-
testId = _ref['data-testid'],
|
|
30
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
31
|
-
// https://stackoverflow.com/a/39333479
|
|
32
|
-
var safeProps = function (_ref2) {
|
|
33
|
-
var className = _ref2.className,
|
|
34
|
-
onClick = _ref2.onClick,
|
|
35
|
-
onMouseDown = _ref2.onMouseDown,
|
|
36
|
-
onDragStart = _ref2.onDragStart,
|
|
37
|
-
draggable = _ref2.draggable,
|
|
38
|
-
ref = _ref2.ref,
|
|
39
|
-
tabIndex = _ref2.tabIndex,
|
|
40
|
-
disabled = _ref2.disabled;
|
|
41
|
-
return {
|
|
42
|
-
className: className,
|
|
43
|
-
onClick: onClick,
|
|
44
|
-
onMouseDown: onMouseDown,
|
|
45
|
-
onDragStart: onDragStart,
|
|
46
|
-
draggable: draggable,
|
|
47
|
-
ref: ref,
|
|
48
|
-
tabIndex: tabIndex,
|
|
49
|
-
disabled: disabled
|
|
50
|
-
};
|
|
51
|
-
}(props);
|
|
52
|
-
return (
|
|
53
|
-
/*#__PURE__*/
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
55
|
-
_react.default.createElement("div", (0, _extends2.default)({
|
|
56
|
-
"data-testid": testId,
|
|
57
|
-
style: {
|
|
58
|
-
position: 'relative'
|
|
59
|
-
}
|
|
60
|
-
}, safeProps), children)
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
20
|
/**
|
|
64
21
|
* __Header__
|
|
65
22
|
*
|
|
@@ -67,9 +24,9 @@ var Container = exports.Container = function Container(_ref) {
|
|
|
67
24
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
68
25
|
*/
|
|
69
26
|
var Header = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_customItem.default, (0, _extends2.default)({}, props, {
|
|
71
28
|
ref: ref,
|
|
72
|
-
component: props.component ||
|
|
29
|
+
component: props.component || _headerContainer.default,
|
|
73
30
|
isTitleHeading: true,
|
|
74
31
|
className: (0, _runtime.ax)([styles.header])
|
|
75
32
|
}));
|
|
@@ -14,9 +14,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _motion = require("@atlaskit/motion");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
var
|
|
17
|
+
var _useChildIds2 = _interopRequireDefault(require("../../common/use-child-ids"));
|
|
18
|
+
var _goBackItem = _interopRequireDefault(require("../Item/go-back-item"));
|
|
18
19
|
var _NestingItem = _interopRequireDefault(require("../NestingItem"));
|
|
19
|
-
var _hooks = require("../utils/hooks");
|
|
20
20
|
var _context = require("./context");
|
|
21
21
|
var _nestingMotion = require("./nesting-motion");
|
|
22
22
|
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); }
|
|
@@ -68,9 +68,9 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
68
68
|
setFocusGoBackButton = _useState8[1];
|
|
69
69
|
var shouldFocus = isDefaultFocusControl && (0, _platformFeatureFlags.fg)('platform-side-navigation-keyboard-focus');
|
|
70
70
|
var renderGoBackItem = overrides && overrides.GoBackItem && overrides.GoBackItem.render ? overrides.GoBackItem.render : function (props) {
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_goBackItem.default, props, "Go back");
|
|
72
72
|
};
|
|
73
|
-
var _useChildIds = (0,
|
|
73
|
+
var _useChildIds = (0, _useChildIds2.default)(currentStackId, committedStack, onUnknownNest),
|
|
74
74
|
childIdsRef = _useChildIds.childIdsRef;
|
|
75
75
|
var onNestHandler = (0, _react.useCallback)(function (layerId) {
|
|
76
76
|
onChange && onChange(committedStack.concat(layerId));
|
|
@@ -18,10 +18,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
18
18
|
var _arrowRight = _interopRequireDefault(require("@atlaskit/icon/core/arrow-right"));
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
|
-
var
|
|
21
|
+
var _useChildIdsEffect = _interopRequireDefault(require("../../common/use-child-ids-effect"));
|
|
22
|
+
var _buttonItem = _interopRequireDefault(require("../Item/button-item"));
|
|
23
|
+
var _customItem = _interopRequireDefault(require("../Item/custom-item"));
|
|
24
|
+
var _NavigationContent = _interopRequireDefault(require("../NavigationContent"));
|
|
22
25
|
var _NestableNavigationContent = require("../NestableNavigationContent");
|
|
23
26
|
var _context = require("../NestableNavigationContent/context");
|
|
24
|
-
var _hooks = require("../utils/hooks");
|
|
25
27
|
var _excluded = ["children", "iconAfter", "title", "onClick", "className", "isDisabled", "isSelected", "id", "component", "testId"];
|
|
26
28
|
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); }
|
|
27
29
|
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; }
|
|
@@ -113,7 +115,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
113
115
|
focusGoBackButton: focusGoBackButton
|
|
114
116
|
};
|
|
115
117
|
}, [stack, currentStackId, onNest, onUnNest, backButton, id, childIds, forceShowTopScrollIndicator, activeParentId, goBackButtonRef, isDefaultFocusControl, focusGoBackButton]);
|
|
116
|
-
(0,
|
|
118
|
+
(0, _useChildIdsEffect.default)(childIds, id);
|
|
117
119
|
var isNormalClick = function isNormalClick(e) {
|
|
118
120
|
return !(e.button || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
119
121
|
};
|
|
@@ -143,7 +145,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
143
145
|
}, stack.length >= 1 && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
144
146
|
paddingBlock: "space.075",
|
|
145
147
|
paddingInline: "space.100"
|
|
146
|
-
}, backButton), /*#__PURE__*/_react.default.createElement(
|
|
148
|
+
}, backButton), /*#__PURE__*/_react.default.createElement(_NavigationContent.default, {
|
|
147
149
|
testId: testId,
|
|
148
150
|
showTopScrollIndicator: forceShowTopScrollIndicator || stack.length >= 1
|
|
149
151
|
}, children));
|
|
@@ -173,7 +175,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
173
175
|
children: title
|
|
174
176
|
});
|
|
175
177
|
if (component) {
|
|
176
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
178
|
+
return /*#__PURE__*/_react.default.createElement(_customItem.default, (0, _extends2.default)({
|
|
177
179
|
ref: isForwardRefCheck(component) ? parentItemRef : null
|
|
178
180
|
}, componentProps, {
|
|
179
181
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -183,7 +185,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
183
185
|
component: component
|
|
184
186
|
}));
|
|
185
187
|
}
|
|
186
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
188
|
+
return /*#__PURE__*/_react.default.createElement(_buttonItem.default, (0, _extends2.default)({
|
|
187
189
|
ref: activeParentRef
|
|
188
190
|
}, componentProps, {
|
|
189
191
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,108 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
Object.defineProperty(exports, "ButtonItem", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
get: function get() {
|
|
9
|
-
return
|
|
10
|
+
return _buttonItem.default;
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
13
|
Object.defineProperty(exports, "CustomItem", {
|
|
13
14
|
enumerable: true,
|
|
14
15
|
get: function get() {
|
|
15
|
-
return
|
|
16
|
+
return _customItem.default;
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
Object.defineProperty(exports, "Footer", {
|
|
19
20
|
enumerable: true,
|
|
20
21
|
get: function get() {
|
|
21
|
-
return
|
|
22
|
+
return _Footer.default;
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "GoBackItem", {
|
|
25
26
|
enumerable: true,
|
|
26
27
|
get: function get() {
|
|
27
|
-
return
|
|
28
|
+
return _goBackItem.default;
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
Object.defineProperty(exports, "Header", {
|
|
31
32
|
enumerable: true,
|
|
32
33
|
get: function get() {
|
|
33
|
-
return
|
|
34
|
+
return _Header.default;
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
Object.defineProperty(exports, "HeadingItem", {
|
|
37
38
|
enumerable: true,
|
|
38
39
|
get: function get() {
|
|
39
|
-
return
|
|
40
|
+
return _Section.HeadingItem;
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
43
|
Object.defineProperty(exports, "LinkItem", {
|
|
43
44
|
enumerable: true,
|
|
44
45
|
get: function get() {
|
|
45
|
-
return
|
|
46
|
+
return _linkItem.default;
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
Object.defineProperty(exports, "LoadingItems", {
|
|
49
50
|
enumerable: true,
|
|
50
51
|
get: function get() {
|
|
51
|
-
return
|
|
52
|
+
return _LoadingItems.default;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
Object.defineProperty(exports, "NavigationContent", {
|
|
55
56
|
enumerable: true,
|
|
56
57
|
get: function get() {
|
|
57
|
-
return
|
|
58
|
+
return _NavigationContent.default;
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
Object.defineProperty(exports, "NavigationFooter", {
|
|
61
62
|
enumerable: true,
|
|
62
63
|
get: function get() {
|
|
63
|
-
return
|
|
64
|
+
return _NavigationFooter.default;
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
Object.defineProperty(exports, "NavigationHeader", {
|
|
67
68
|
enumerable: true,
|
|
68
69
|
get: function get() {
|
|
69
|
-
return
|
|
70
|
+
return _NavigationHeader.default;
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
Object.defineProperty(exports, "NestableNavigationContent", {
|
|
73
74
|
enumerable: true,
|
|
74
75
|
get: function get() {
|
|
75
|
-
return
|
|
76
|
+
return _NestableNavigationContent.default;
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
Object.defineProperty(exports, "NestingItem", {
|
|
79
80
|
enumerable: true,
|
|
80
81
|
get: function get() {
|
|
81
|
-
return
|
|
82
|
+
return _NestingItem.default;
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
Object.defineProperty(exports, "Section", {
|
|
85
86
|
enumerable: true,
|
|
86
87
|
get: function get() {
|
|
87
|
-
return
|
|
88
|
+
return _Section.Section;
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
Object.defineProperty(exports, "SideNavigation", {
|
|
91
92
|
enumerable: true,
|
|
92
93
|
get: function get() {
|
|
93
|
-
return
|
|
94
|
+
return _SideNavigation.default;
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
Object.defineProperty(exports, "SkeletonHeadingItem", {
|
|
97
98
|
enumerable: true,
|
|
98
99
|
get: function get() {
|
|
99
|
-
return
|
|
100
|
+
return _Section.SkeletonHeadingItem;
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
Object.defineProperty(exports, "SkeletonItem", {
|
|
103
104
|
enumerable: true,
|
|
104
105
|
get: function get() {
|
|
105
|
-
return
|
|
106
|
+
return _skeletonItem.default;
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
Object.defineProperty(exports, "VAR_SCROLL_INDICATOR_COLOR", {
|
|
@@ -123,6 +124,20 @@ Object.defineProperty(exports, "useShouldNestedElementRender", {
|
|
|
123
124
|
return _context.useShouldNestedElementRender;
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
|
-
var
|
|
127
|
+
var _SideNavigation = _interopRequireDefault(require("./components/SideNavigation"));
|
|
128
|
+
var _Section = require("./components/Section");
|
|
129
|
+
var _NestingItem = _interopRequireDefault(require("./components/NestingItem"));
|
|
130
|
+
var _NavigationContent = _interopRequireDefault(require("./components/NavigationContent"));
|
|
131
|
+
var _buttonItem = _interopRequireDefault(require("./components/Item/button-item"));
|
|
132
|
+
var _goBackItem = _interopRequireDefault(require("./components/Item/go-back-item"));
|
|
133
|
+
var _linkItem = _interopRequireDefault(require("./components/Item/link-item"));
|
|
134
|
+
var _customItem = _interopRequireDefault(require("./components/Item/custom-item"));
|
|
135
|
+
var _skeletonItem = _interopRequireDefault(require("./components/Item/skeleton-item"));
|
|
136
|
+
var _Footer = _interopRequireDefault(require("./components/Footer"));
|
|
137
|
+
var _Header = _interopRequireDefault(require("./components/Header"));
|
|
138
|
+
var _NavigationHeader = _interopRequireDefault(require("./components/NavigationHeader"));
|
|
139
|
+
var _NavigationFooter = _interopRequireDefault(require("./components/NavigationFooter"));
|
|
140
|
+
var _LoadingItems = _interopRequireDefault(require("./components/LoadingItems"));
|
|
141
|
+
var _NestableNavigationContent = _interopRequireDefault(require("./components/NestableNavigationContent"));
|
|
127
142
|
var _context = require("./components/NestableNavigationContent/context");
|
|
128
143
|
var _constants = require("./common/constants");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
const useChildIdsEffect = (childIds, id) => {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
if (!childIds || !childIds.current) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (!childIds.current.has(id)) {
|
|
8
|
+
childIds.current.add(id);
|
|
9
|
+
}
|
|
10
|
+
return () => {
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
childIds.current.delete(id);
|
|
13
|
+
};
|
|
14
|
+
// childIds shouldn't change as it's a ref
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
}, [id]);
|
|
17
|
+
};
|
|
18
|
+
export default useChildIdsEffect;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { ROOT_ID } from '../components/NestableNavigationContent';
|
|
3
|
+
const useChildIds = (currentStackId, committedStack, onUnknownNest) => {
|
|
4
|
+
const childIdsRef = useRef(new Set());
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
// we are holding navigation item IDs in childIdsRef
|
|
7
|
+
// check if the current displayed nav item (currentStackId) is in childIdsRef. if it's not, this means it's undefined
|
|
8
|
+
if (currentStackId === ROOT_ID || !childIdsRef.current.size || childIdsRef.current.has(currentStackId) || !onUnknownNest) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
onUnknownNest(committedStack || [currentStackId]);
|
|
12
|
+
}, [currentStackId, committedStack, onUnknownNest]);
|
|
13
|
+
return {
|
|
14
|
+
childIdsRef
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default useChildIds;
|
|
@@ -7,8 +7,8 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
7
7
|
|
|
8
8
|
import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
9
9
|
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import HeaderContainer from '../Header/header-container';
|
|
11
|
+
import CustomItem from '../Item/custom-item';
|
|
12
12
|
const styles = {
|
|
13
13
|
iconContainer: "_1e0c1o8l _1bsb1k8s _4t3i1k8s",
|
|
14
14
|
oldFooter: "_uizt1wug _1e0c1ule _y3gn1h6o _1tke1tcg _4cvr1h6o _1bsb1osq _vrjtwadc _16vx1h6o _bek6ze3t _rh04u2gc _76zj1o8l _13e21h6o _14bw1o8l _xosk12x7 _wte412x7 _ou5312x7 _1jo512x7 _11kjsm61 _jl2n73ad _1et6sm61 _1v6jazsu"
|
|
@@ -35,7 +35,7 @@ const OldFooter = props => {
|
|
|
35
35
|
testId
|
|
36
36
|
}))(props);
|
|
37
37
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, safeProps, {
|
|
38
|
-
component: props.component ||
|
|
38
|
+
component: props.component || HeaderContainer,
|
|
39
39
|
className: ax([styles.oldFooter])
|
|
40
40
|
}));
|
|
41
41
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* __Container__
|
|
5
|
+
*
|
|
6
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
7
|
+
*/
|
|
8
|
+
const HeaderContainer = ({
|
|
9
|
+
children,
|
|
10
|
+
'data-testid': testId,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
// https://stackoverflow.com/a/39333479
|
|
14
|
+
const safeProps = (({
|
|
15
|
+
className,
|
|
16
|
+
onClick,
|
|
17
|
+
onMouseDown,
|
|
18
|
+
onDragStart,
|
|
19
|
+
draggable,
|
|
20
|
+
ref,
|
|
21
|
+
tabIndex,
|
|
22
|
+
disabled
|
|
23
|
+
}) => ({
|
|
24
|
+
className,
|
|
25
|
+
onClick,
|
|
26
|
+
onMouseDown,
|
|
27
|
+
onDragStart,
|
|
28
|
+
draggable,
|
|
29
|
+
ref,
|
|
30
|
+
tabIndex,
|
|
31
|
+
disabled
|
|
32
|
+
}))(props);
|
|
33
|
+
return (
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
36
|
+
React.createElement("div", _extends({
|
|
37
|
+
"data-testid": testId,
|
|
38
|
+
style: {
|
|
39
|
+
position: 'relative'
|
|
40
|
+
}
|
|
41
|
+
}, safeProps), children)
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export default HeaderContainer;
|
|
@@ -3,52 +3,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./index.compiled.css";
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React, { forwardRef } from 'react';
|
|
6
|
-
import
|
|
6
|
+
import CustomItem from '../Item/custom-item';
|
|
7
|
+
import HeaderContainer from './header-container';
|
|
7
8
|
const styles = {
|
|
8
9
|
header: "_uizt1wug _vrjt1qyo _1cmdi7uo _11kjsm61 _jl2n73ad _1et6sm61 _1v6ji7uo"
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* __Container__
|
|
13
|
-
*
|
|
14
|
-
* A container for Header and Footer that safely handles props to the child component
|
|
15
|
-
*/
|
|
16
|
-
export const Container = ({
|
|
17
|
-
children,
|
|
18
|
-
'data-testid': testId,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
21
|
-
// https://stackoverflow.com/a/39333479
|
|
22
|
-
const safeProps = (({
|
|
23
|
-
className,
|
|
24
|
-
onClick,
|
|
25
|
-
onMouseDown,
|
|
26
|
-
onDragStart,
|
|
27
|
-
draggable,
|
|
28
|
-
ref,
|
|
29
|
-
tabIndex,
|
|
30
|
-
disabled
|
|
31
|
-
}) => ({
|
|
32
|
-
className,
|
|
33
|
-
onClick,
|
|
34
|
-
onMouseDown,
|
|
35
|
-
onDragStart,
|
|
36
|
-
draggable,
|
|
37
|
-
ref,
|
|
38
|
-
tabIndex,
|
|
39
|
-
disabled
|
|
40
|
-
}))(props);
|
|
41
|
-
return (
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
44
|
-
React.createElement("div", _extends({
|
|
45
|
-
"data-testid": testId,
|
|
46
|
-
style: {
|
|
47
|
-
position: 'relative'
|
|
48
|
-
}
|
|
49
|
-
}, safeProps), children)
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
11
|
/**
|
|
53
12
|
* __Header__
|
|
54
13
|
*
|
|
@@ -58,7 +17,7 @@ export const Container = ({
|
|
|
58
17
|
const Header = /*#__PURE__*/forwardRef((props, ref) => {
|
|
59
18
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
60
19
|
ref: ref,
|
|
61
|
-
component: props.component ||
|
|
20
|
+
component: props.component || HeaderContainer,
|
|
62
21
|
isTitleHeading: true,
|
|
63
22
|
className: ax([styles.header])
|
|
64
23
|
}));
|
|
@@ -5,9 +5,9 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { ExitingPersistence } from '@atlaskit/motion';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import
|
|
8
|
+
import useChildIds from '../../common/use-child-ids';
|
|
9
|
+
import GoBackButton from '../Item/go-back-item';
|
|
9
10
|
import { default as NestingItem } from '../NestingItem';
|
|
10
|
-
import { useChildIds } from '../utils/hooks';
|
|
11
11
|
import { NestedContext } from './context';
|
|
12
12
|
import { NestingMotion } from './nesting-motion';
|
|
13
13
|
// Named so ERT doesn't pick up the override name as a type.
|
|
@@ -6,10 +6,12 @@ import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } fr
|
|
|
6
6
|
import ArrowRightIcon from '@atlaskit/icon/core/arrow-right';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
|
-
import
|
|
9
|
+
import useChildIdsEffect from '../../common/use-child-ids-effect';
|
|
10
|
+
import ButtonItem from '../Item/button-item';
|
|
11
|
+
import CustomItem from '../Item/custom-item';
|
|
12
|
+
import NavigationContent from '../NavigationContent';
|
|
10
13
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
11
14
|
import { NestedContext, useNestedContext } from '../NestableNavigationContent/context';
|
|
12
|
-
import { useChildIdsEffect } from '../utils/hooks';
|
|
13
15
|
const styles = {
|
|
14
16
|
iconContainer: "_1e0c1nu9",
|
|
15
17
|
nestingItem: "_udl3glyw _kqsfglyw _udrwglyw _13qvglyw _9mqr1kw7 _povs1kw7 _uv2d1kw7 _atks1kw7",
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { default as SideNavigation } from './components/SideNavigation';
|
|
2
|
+
export { Section, HeadingItem, SkeletonHeadingItem } from './components/Section';
|
|
3
|
+
export { default as NestingItem } from './components/NestingItem';
|
|
4
|
+
export { default as NavigationContent } from './components/NavigationContent';
|
|
5
|
+
export { default as ButtonItem } from './components/Item/button-item';
|
|
6
|
+
export { default as GoBackItem } from './components/Item/go-back-item';
|
|
7
|
+
export { default as LinkItem } from './components/Item/link-item';
|
|
8
|
+
export { default as CustomItem } from './components/Item/custom-item';
|
|
9
|
+
export { default as SkeletonItem } from './components/Item/skeleton-item';
|
|
10
|
+
export { default as Footer } from './components/Footer';
|
|
11
|
+
export { default as Header } from './components/Header';
|
|
12
|
+
export { default as NavigationHeader } from './components/NavigationHeader';
|
|
13
|
+
export { default as NavigationFooter } from './components/NavigationFooter';
|
|
14
|
+
export { default as LoadingItems } from './components/LoadingItems';
|
|
15
|
+
export { default as NestableNavigationContent } from './components/NestableNavigationContent';
|
|
2
16
|
export { useShouldNestedElementRender } from './components/NestableNavigationContent/context';
|
|
3
17
|
export { VAR_SCROLL_INDICATOR_COLOR, VAR_SEPARATOR_COLOR } from './common/constants';
|