@atlaskit/side-navigation 1.5.0 → 1.5.2
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 +13 -0
- package/dist/cjs/common/styles.js +7 -19
- package/dist/cjs/components/Footer/index.js +11 -19
- package/dist/cjs/components/Header/index.js +15 -33
- package/dist/cjs/components/Item/button-item.js +6 -20
- package/dist/cjs/components/Item/custom-item.js +8 -21
- package/dist/cjs/components/Item/go-back-item.js +13 -28
- package/dist/cjs/components/Item/index.js +0 -6
- package/dist/cjs/components/Item/link-item.js +6 -20
- package/dist/cjs/components/Item/skeleton-item.js +8 -20
- package/dist/cjs/components/LoadingItems/index.js +8 -16
- package/dist/cjs/components/NavigationContent/index.js +3 -15
- package/dist/cjs/components/NavigationContent/styles.js +9 -24
- package/dist/cjs/components/NavigationFooter/index.js +2 -7
- package/dist/cjs/components/NavigationHeader/index.js +2 -7
- package/dist/cjs/components/NestableNavigationContent/context.js +1 -13
- package/dist/cjs/components/NestableNavigationContent/index.js +30 -51
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +3 -11
- package/dist/cjs/components/NestingItem/hack-for-ert.js +0 -1
- package/dist/cjs/components/NestingItem/index.js +25 -61
- package/dist/cjs/components/NestingItem/styles.js +0 -8
- package/dist/cjs/components/Section/heading-item.js +3 -12
- package/dist/cjs/components/Section/index.js +0 -4
- package/dist/cjs/components/Section/section.js +3 -15
- package/dist/cjs/components/Section/skeleton-heading-item.js +5 -17
- package/dist/cjs/components/SideNavigation/index.js +6 -8
- package/dist/cjs/components/index.js +0 -12
- package/dist/cjs/components/utils/hooks.js +2 -10
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/styles.js +7 -6
- package/dist/es2019/components/Footer/index.js +7 -8
- package/dist/es2019/components/Header/index.js +5 -6
- package/dist/es2019/components/Item/button-item.js +4 -6
- package/dist/es2019/components/Item/custom-item.js +7 -8
- package/dist/es2019/components/Item/go-back-item.js +2 -3
- package/dist/es2019/components/Item/link-item.js +4 -6
- package/dist/es2019/components/Item/skeleton-item.js +9 -11
- package/dist/es2019/components/LoadingItems/index.js +3 -6
- package/dist/es2019/components/NavigationContent/index.js +0 -4
- package/dist/es2019/components/NavigationContent/styles.js +9 -10
- package/dist/es2019/components/NavigationFooter/index.js +3 -4
- package/dist/es2019/components/NavigationHeader/index.js +2 -4
- package/dist/es2019/components/NestableNavigationContent/context.js +1 -8
- package/dist/es2019/components/NestableNavigationContent/index.js +17 -22
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +1 -1
- package/dist/es2019/components/NestingItem/index.js +7 -17
- package/dist/es2019/components/NestingItem/styles.js +2 -1
- package/dist/es2019/components/Section/heading-item.js +2 -5
- package/dist/es2019/components/Section/section.js +2 -4
- package/dist/es2019/components/Section/skeleton-heading-item.js +6 -8
- package/dist/es2019/components/SideNavigation/index.js +3 -2
- package/dist/es2019/components/utils/hooks.js +2 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/styles.js +7 -10
- package/dist/esm/components/Footer/index.js +11 -12
- package/dist/esm/components/Header/index.js +16 -20
- package/dist/esm/components/Item/button-item.js +6 -9
- package/dist/esm/components/Item/custom-item.js +9 -11
- package/dist/esm/components/Item/go-back-item.js +13 -16
- package/dist/esm/components/Item/link-item.js +6 -9
- package/dist/esm/components/Item/skeleton-item.js +8 -14
- package/dist/esm/components/LoadingItems/index.js +7 -11
- package/dist/esm/components/NavigationContent/index.js +3 -9
- package/dist/esm/components/NavigationContent/styles.js +9 -13
- package/dist/esm/components/NavigationFooter/index.js +3 -4
- package/dist/esm/components/NavigationHeader/index.js +2 -4
- package/dist/esm/components/NestableNavigationContent/context.js +1 -8
- package/dist/esm/components/NestableNavigationContent/index.js +30 -41
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +4 -7
- package/dist/esm/components/NestingItem/index.js +25 -41
- package/dist/esm/components/NestingItem/styles.js +0 -4
- package/dist/esm/components/Section/heading-item.js +3 -6
- package/dist/esm/components/Section/section.js +3 -5
- package/dist/esm/components/Section/skeleton-heading-item.js +5 -11
- package/dist/esm/components/SideNavigation/index.js +5 -4
- package/dist/esm/components/utils/hooks.js +2 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/components/NavigationContent/styles.d.ts +4 -4
- package/package.json +2 -2
- package/report.api.md +13 -0
|
@@ -1,56 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
-
|
|
18
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
|
|
20
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
|
|
24
15
|
var _react2 = require("@emotion/react");
|
|
25
|
-
|
|
26
16
|
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
27
|
-
|
|
28
17
|
var _arrowRightCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-right-circle"));
|
|
29
|
-
|
|
30
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
31
|
-
|
|
32
19
|
var _styles = require("../../common/styles");
|
|
33
|
-
|
|
34
20
|
var _index = require("../index");
|
|
35
|
-
|
|
36
21
|
var _NestableNavigationContent = require("../NestableNavigationContent");
|
|
37
|
-
|
|
38
22
|
var _context = require("../NestableNavigationContent/context");
|
|
39
|
-
|
|
40
23
|
var _hooks = require("../utils/hooks");
|
|
41
|
-
|
|
42
24
|
var _styles2 = require("./styles");
|
|
43
|
-
|
|
44
25
|
var _excluded = ["children", "iconAfter", "title", "onClick", "cssFn", "isSelected", "id", "component", "testId"];
|
|
45
|
-
|
|
46
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
|
-
|
|
48
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
-
|
|
50
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
51
|
-
|
|
52
29
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
|
-
|
|
54
30
|
/**
|
|
55
31
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
56
32
|
* When not open - it will render itself as an item.
|
|
@@ -58,31 +34,27 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
58
34
|
*/
|
|
59
35
|
var NestingItem = function NestingItem(props) {
|
|
60
36
|
var children = props.children,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
37
|
+
iconAfter = props.iconAfter,
|
|
38
|
+
title = props.title,
|
|
39
|
+
onClick = props.onClick,
|
|
40
|
+
cssFn = props.cssFn,
|
|
41
|
+
isSelected = props.isSelected,
|
|
42
|
+
id = props.id,
|
|
43
|
+
component = props.component,
|
|
44
|
+
testId = props.testId,
|
|
45
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
71
46
|
var _useNestedContext = (0, _context.useNestedContext)(),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
currentStackId = _useNestedContext.currentStackId,
|
|
48
|
+
onNest = _useNestedContext.onNest,
|
|
49
|
+
onUnNest = _useNestedContext.onUnNest,
|
|
50
|
+
contextualBackButton = _useNestedContext.backButton,
|
|
51
|
+
stack = _useNestedContext.stack,
|
|
52
|
+
childIds = _useNestedContext.childIds;
|
|
79
53
|
var mergedStyles = (0, _styles.overrideStyleFunction)(_styles2.nestingItemStyle, cssFn);
|
|
80
|
-
|
|
81
54
|
var _useState = (0, _react.useState)(false),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
55
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
56
|
+
isInteracted = _useState2[0],
|
|
57
|
+
setIsInteracted = _useState2[1];
|
|
86
58
|
var backButton = props.overrides && props.overrides.GoBackItem && props.overrides.GoBackItem.render && props.overrides.GoBackItem.render({
|
|
87
59
|
onClick: onUnNest,
|
|
88
60
|
testId: testId && "".concat(testId, "--go-back-item")
|
|
@@ -97,54 +69,49 @@ var NestingItem = function NestingItem(props) {
|
|
|
97
69
|
parentId: id,
|
|
98
70
|
childIds: childIds
|
|
99
71
|
};
|
|
100
|
-
},
|
|
72
|
+
},
|
|
73
|
+
// childIds shouldn't change as it's a ref
|
|
101
74
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
102
75
|
[onNest, onUnNest, backButton, stack, id, currentStackId]);
|
|
103
76
|
(0, _hooks.useChildIdsEffect)(childIds, id);
|
|
104
|
-
|
|
105
77
|
var isNormalClick = function isNormalClick(e) {
|
|
106
78
|
return !(e.button || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
107
79
|
};
|
|
80
|
+
|
|
108
81
|
/**
|
|
109
82
|
* We want both the on nest handler and the onclick handler to be called.
|
|
110
83
|
* We create a wrapper function to call both.
|
|
111
84
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
85
|
var onClickHandler = (0, _react.useCallback)(function (e) {
|
|
115
86
|
if (isInteracted) {
|
|
116
87
|
// We return early if this has been interacted with because its assumed
|
|
117
88
|
// this will be already exiting - so we don't want to double up the click.
|
|
118
89
|
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
90
|
+
}
|
|
121
91
|
|
|
92
|
+
// Avoid a nesting transition if a modifier key is detected during click.
|
|
122
93
|
if (isNormalClick(e)) {
|
|
123
94
|
setIsInteracted(true);
|
|
124
95
|
onNest(id);
|
|
125
96
|
}
|
|
126
|
-
|
|
127
97
|
onClick && onClick(e);
|
|
128
98
|
}, [isInteracted, onClick, onNest, id]);
|
|
129
|
-
|
|
130
99
|
if (currentStackId === id) {
|
|
131
100
|
return (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
132
101
|
value: context
|
|
133
102
|
}, stack.length >= 1 && (0, _react2.jsx)(_box.default, {
|
|
134
103
|
as: "div",
|
|
135
104
|
display: "block",
|
|
136
|
-
paddingBlock: "
|
|
137
|
-
paddingInline: "
|
|
105
|
+
paddingBlock: "space.075",
|
|
106
|
+
paddingInline: "space.100"
|
|
138
107
|
}, backButton), (0, _react2.jsx)(_index.NavigationContent, {
|
|
139
108
|
testId: testId,
|
|
140
109
|
showTopScrollIndicator: stack.length >= 1
|
|
141
110
|
}, children));
|
|
142
111
|
}
|
|
143
|
-
|
|
144
112
|
if ([_NestableNavigationContent.ROOT_ID].concat((0, _toConsumableArray2.default)(stack)).includes(id)) {
|
|
145
113
|
return children;
|
|
146
114
|
}
|
|
147
|
-
|
|
148
115
|
var componentProps = _objectSpread(_objectSpread({
|
|
149
116
|
iconAfter: (0, _react2.jsx)(_react.Fragment, null, iconAfter ? (0, _react2.jsx)(_box.default, {
|
|
150
117
|
"data-custom-icon": true,
|
|
@@ -166,16 +133,13 @@ var NestingItem = function NestingItem(props) {
|
|
|
166
133
|
children: title,
|
|
167
134
|
cssFn: mergedStyles
|
|
168
135
|
});
|
|
169
|
-
|
|
170
136
|
if (component) {
|
|
171
137
|
return (0, _react2.jsx)(_index.CustomItem, (0, _extends2.default)({}, componentProps, {
|
|
172
138
|
//@ts-expect-error TODO Fix legit TypeScript 3.9.6 improved inference error
|
|
173
139
|
component: component
|
|
174
140
|
}));
|
|
175
141
|
}
|
|
176
|
-
|
|
177
142
|
return (0, _react2.jsx)(_index.ButtonItem, componentProps);
|
|
178
143
|
};
|
|
179
|
-
|
|
180
144
|
var _default = NestingItem;
|
|
181
145
|
exports.default = _default;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.nestingItemStyle = exports.enabledCSS = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _enabledCSS, _disabledCSS;
|
|
13
|
-
|
|
14
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
|
|
18
12
|
// exposed for testing purposes
|
|
19
13
|
var enabledCSS = (_enabledCSS = {}, (0, _defineProperty2.default)(_enabledCSS, '&:hover [data-custom-icon]', {
|
|
20
14
|
display: 'none'
|
|
@@ -39,9 +33,7 @@ var disabledCSS = (_disabledCSS = {}, (0, _defineProperty2.default)(_disabledCSS
|
|
|
39
33
|
}), (0, _defineProperty2.default)(_disabledCSS, '& [data-right-arrow]', {
|
|
40
34
|
display: 'none'
|
|
41
35
|
}), _disabledCSS);
|
|
42
|
-
|
|
43
36
|
var nestingItemStyle = function nestingItemStyle(state) {
|
|
44
37
|
return _objectSpread({}, state.isDisabled ? disabledCSS : enabledCSS);
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
exports.nestingItemStyle = nestingItemStyle;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _menu = require("@atlaskit/menu");
|
|
15
|
-
|
|
16
11
|
var _styles = require("../../common/styles");
|
|
17
|
-
|
|
18
12
|
var _context = require("../NestableNavigationContent/context");
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* __Heading item__
|
|
22
15
|
*
|
|
@@ -25,18 +18,16 @@ var _context = require("../NestableNavigationContent/context");
|
|
|
25
18
|
*/
|
|
26
19
|
var HeadingItem = function HeadingItem(props) {
|
|
27
20
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
30
22
|
if (!shouldRender) {
|
|
31
23
|
return null;
|
|
32
24
|
}
|
|
25
|
+
var cssFn = (0, _styles.overrideStyleFunction)(_styles.sectionHeaderSpacingStyles, props.cssFn);
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides, @repo/internal/react/no-unsafe-spread-props
|
|
36
28
|
return /*#__PURE__*/_react.default.createElement(_menu.HeadingItem, (0, _extends2.default)({}, props, {
|
|
37
29
|
cssFn: cssFn
|
|
38
30
|
}));
|
|
39
31
|
};
|
|
40
|
-
|
|
41
32
|
var _default = HeadingItem;
|
|
42
33
|
exports.default = _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -23,9 +22,6 @@ Object.defineProperty(exports, "SkeletonHeadingItem", {
|
|
|
23
22
|
return _skeletonHeadingItem.default;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
|
-
|
|
27
25
|
var _headingItem = _interopRequireDefault(require("./heading-item"));
|
|
28
|
-
|
|
29
26
|
var _section = _interopRequireDefault(require("./section"));
|
|
30
|
-
|
|
31
27
|
var _skeletonHeadingItem = _interopRequireDefault(require("./skeleton-heading-item"));
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _menu = require("@atlaskit/menu");
|
|
17
|
-
|
|
18
12
|
var _styles = require("../../common/styles");
|
|
19
|
-
|
|
20
13
|
var _context = require("../NestableNavigationContent/context");
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
// Type needed on props to extract types with extract react types.
|
|
27
|
-
|
|
28
17
|
/**
|
|
29
18
|
* __Section__
|
|
30
19
|
*
|
|
@@ -36,14 +25,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
36
25
|
*/
|
|
37
26
|
var Section = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
38
27
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
41
29
|
if (!shouldRender) {
|
|
42
30
|
return props.children;
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
return /*#__PURE__*/_react.default.createElement(_menu.Section, (0, _extends2.default)({}, props, {
|
|
46
|
-
ref: ref
|
|
33
|
+
ref: ref
|
|
34
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
47
35
|
,
|
|
48
36
|
overrides: {
|
|
49
37
|
HeadingItem: {
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
var _menu = require("@atlaskit/menu");
|
|
17
|
-
|
|
18
12
|
var _styles = require("../../common/styles");
|
|
19
|
-
|
|
20
13
|
var _context = require("../NestableNavigationContent/context");
|
|
21
|
-
|
|
22
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
* __Skeleton heading item__
|
|
28
18
|
*
|
|
@@ -32,20 +22,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
32
22
|
*/
|
|
33
23
|
var SkeletonHeadingItem = function SkeletonHeadingItem(props) {
|
|
34
24
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
37
26
|
if (!shouldRender) {
|
|
38
27
|
return null;
|
|
39
28
|
}
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonHeadingItem
|
|
30
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
42
31
|
, (0, _extends2.default)({
|
|
43
32
|
cssFn: function cssFn() {
|
|
44
33
|
return _objectSpread({}, (0, _styles.sectionHeaderSpacingStyles)());
|
|
45
|
-
}
|
|
46
|
-
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
47
36
|
}, props));
|
|
48
37
|
};
|
|
49
|
-
|
|
50
38
|
var _default = SkeletonHeadingItem;
|
|
51
39
|
exports.default = _default;
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _react2 = require("@emotion/react");
|
|
11
|
-
|
|
12
9
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
|
-
|
|
14
10
|
/** @jsx jsx */
|
|
11
|
+
|
|
15
12
|
var sidebarMinWidth = '240px';
|
|
16
13
|
var sideNavStyles = (0, _react2.css)({
|
|
17
14
|
display: 'flex',
|
|
@@ -24,6 +21,7 @@ var sideNavStyles = (0, _react2.css)({
|
|
|
24
21
|
color: "var(--ds-text-subtle, ".concat(_colors.N500, ")"),
|
|
25
22
|
overflow: 'hidden'
|
|
26
23
|
});
|
|
24
|
+
|
|
27
25
|
/**
|
|
28
26
|
* __Side navigation__
|
|
29
27
|
*
|
|
@@ -33,12 +31,12 @@ var sideNavStyles = (0, _react2.css)({
|
|
|
33
31
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
34
32
|
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
35
33
|
*/
|
|
36
|
-
|
|
37
34
|
var SideNavigation = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
38
35
|
var children = props.children,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (
|
|
36
|
+
testId = props.testId,
|
|
37
|
+
label = props.label;
|
|
38
|
+
return (
|
|
39
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
42
40
|
(0, _react2.jsx)("nav", {
|
|
43
41
|
ref: ref,
|
|
44
42
|
"data-testid": testId,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -107,25 +106,14 @@ Object.defineProperty(exports, "SkeletonItem", {
|
|
|
107
106
|
return _Item.SkeletonItem;
|
|
108
107
|
}
|
|
109
108
|
});
|
|
110
|
-
|
|
111
109
|
var _SideNavigation = _interopRequireDefault(require("./SideNavigation"));
|
|
112
|
-
|
|
113
110
|
var _Section = require("./Section");
|
|
114
|
-
|
|
115
111
|
var _NestingItem = _interopRequireDefault(require("./NestingItem"));
|
|
116
|
-
|
|
117
112
|
var _NavigationContent = _interopRequireDefault(require("./NavigationContent"));
|
|
118
|
-
|
|
119
113
|
var _Item = require("./Item");
|
|
120
|
-
|
|
121
114
|
var _Footer = _interopRequireDefault(require("./Footer"));
|
|
122
|
-
|
|
123
115
|
var _Header = _interopRequireDefault(require("./Header"));
|
|
124
|
-
|
|
125
116
|
var _NavigationHeader = _interopRequireDefault(require("./NavigationHeader"));
|
|
126
|
-
|
|
127
117
|
var _NavigationFooter = _interopRequireDefault(require("./NavigationFooter"));
|
|
128
|
-
|
|
129
118
|
var _LoadingItems = _interopRequireDefault(require("./LoadingItems"));
|
|
130
|
-
|
|
131
119
|
var _NestableNavigationContent = _interopRequireDefault(require("./NestableNavigationContent"));
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useChildIdsEffect = exports.useChildIds = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _NestableNavigationContent = require("../NestableNavigationContent");
|
|
11
|
-
|
|
12
9
|
var useChildIds = function useChildIds(currentStackId, committedStack, onUnknownNest) {
|
|
13
10
|
var childIdsRef = (0, _react.useRef)(new Set());
|
|
14
11
|
(0, _react.useEffect)(function () {
|
|
@@ -17,32 +14,27 @@ var useChildIds = function useChildIds(currentStackId, committedStack, onUnknown
|
|
|
17
14
|
if (currentStackId === _NestableNavigationContent.ROOT_ID || !childIdsRef.current.size || childIdsRef.current.has(currentStackId) || !onUnknownNest) {
|
|
18
15
|
return;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
onUnknownNest(committedStack || [currentStackId]);
|
|
22
18
|
}, [currentStackId, committedStack, onUnknownNest]);
|
|
23
19
|
return {
|
|
24
20
|
childIdsRef: childIdsRef
|
|
25
21
|
};
|
|
26
22
|
};
|
|
27
|
-
|
|
28
23
|
exports.useChildIds = useChildIds;
|
|
29
|
-
|
|
30
24
|
var useChildIdsEffect = function useChildIdsEffect(childIds, id) {
|
|
31
25
|
(0, _react.useEffect)(function () {
|
|
32
26
|
if (!childIds || !childIds.current) {
|
|
33
27
|
return;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
if (!childIds.current.has(id)) {
|
|
37
30
|
childIds.current.add(id);
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
return function () {
|
|
41
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
34
|
childIds.current.delete(id);
|
|
43
|
-
};
|
|
35
|
+
};
|
|
36
|
+
// childIds shouldn't change as it's a ref
|
|
44
37
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
38
|
}, [id]);
|
|
46
39
|
};
|
|
47
|
-
|
|
48
40
|
exports.useChildIdsEffect = useChildIdsEffect;
|
package/dist/cjs/index.js
CHANGED
|
@@ -123,9 +123,6 @@ Object.defineProperty(exports, "useShouldNestedElementRender", {
|
|
|
123
123
|
return _context.useShouldNestedElementRender;
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
-
|
|
127
126
|
var _components = require("./components");
|
|
128
|
-
|
|
129
127
|
var _context = require("./components/NestableNavigationContent/context");
|
|
130
|
-
|
|
131
128
|
var _constants = require("./common/constants");
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { B400, B50, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
2
|
import { borderRadius as borderRadiusFn } from '@atlaskit/theme/constants';
|
|
3
3
|
const borderRadius = borderRadiusFn();
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* Allows chaining of style functions on top of base style functions
|
|
6
7
|
* @param baseStyle the base custom cssFn
|
|
@@ -8,7 +9,6 @@ const borderRadius = borderRadiusFn();
|
|
|
8
9
|
*
|
|
9
10
|
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
export const overrideStyleFunction = (baseStyle, newStyle = () => ({})) => {
|
|
13
13
|
return state => {
|
|
14
14
|
return [baseStyle(state), newStyle(state)];
|
|
@@ -46,7 +46,7 @@ export const baseSideNavItemStyle = ({
|
|
|
46
46
|
return {
|
|
47
47
|
// This padding is set to ensure that the center of the left icon
|
|
48
48
|
// is approximately center aligned with the horizontal app switcher.
|
|
49
|
-
padding: `${"var(--ds-
|
|
49
|
+
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 10px)"}`,
|
|
50
50
|
borderRadius,
|
|
51
51
|
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
52
52
|
// Menu and side navigation are now color aligned so they do not need this!
|
|
@@ -55,22 +55,23 @@ export const baseSideNavItemStyle = ({
|
|
|
55
55
|
...(!isDisabled && !isSelected && defaultStyles),
|
|
56
56
|
...(!isDisabled && isSelected && selectedStyles),
|
|
57
57
|
// -- END TODO --------------------------------------------------------------
|
|
58
|
+
|
|
58
59
|
['& [data-item-elem-before]']: {
|
|
59
60
|
// TODO: Can this be moved into menu?
|
|
60
61
|
// center align icons with app-switcher regardless of size
|
|
61
62
|
display: 'flex',
|
|
62
|
-
height: "var(--ds-
|
|
63
|
-
width: "var(--ds-
|
|
63
|
+
height: "var(--ds-space-300, 24px)",
|
|
64
|
+
width: "var(--ds-space-300, 24px)",
|
|
64
65
|
alignItems: 'center',
|
|
65
66
|
justifyContent: 'center',
|
|
66
67
|
// this margin could be removed if the respective item had a more
|
|
67
68
|
// compositional API so an Inline could be used to separate elements instead
|
|
68
|
-
marginRight: "var(--ds-
|
|
69
|
+
marginRight: "var(--ds-space-200, 16px)"
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
};
|
|
72
73
|
export const sectionHeaderSpacingStyles = () => {
|
|
73
74
|
return {
|
|
74
|
-
paddingInline: "var(--ds-
|
|
75
|
+
paddingInline: "var(--ds-space-100, 10px)"
|
|
75
76
|
};
|
|
76
77
|
};
|
|
@@ -4,7 +4,6 @@ import { N500 } from '@atlaskit/theme/colors';
|
|
|
4
4
|
import { overrideStyleFunction } from '../../common/styles';
|
|
5
5
|
import { Container } from '../Header';
|
|
6
6
|
import { CustomItem } from '../Item';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* __Footer__
|
|
10
9
|
*
|
|
@@ -20,8 +19,8 @@ const Footer = props => {
|
|
|
20
19
|
alignItems: 'center',
|
|
21
20
|
width: '100%',
|
|
22
21
|
'[data-item-elem-before]': {
|
|
23
|
-
marginRight: "var(--ds-
|
|
24
|
-
marginBottom: "var(--ds-
|
|
22
|
+
marginRight: "var(--ds-space-0, 0px)",
|
|
23
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
25
24
|
display: 'inline-block'
|
|
26
25
|
},
|
|
27
26
|
'[data-item-title]': {
|
|
@@ -31,7 +30,7 @@ const Footer = props => {
|
|
|
31
30
|
'[data-item-description]': {
|
|
32
31
|
textAlign: 'center',
|
|
33
32
|
display: 'inline-block',
|
|
34
|
-
margin: "var(--ds-
|
|
33
|
+
margin: "var(--ds-space-075, 6px)"
|
|
35
34
|
},
|
|
36
35
|
// Will look interactive if the `component` is anything other than a div.
|
|
37
36
|
'div&:hover': {
|
|
@@ -42,8 +41,9 @@ const Footer = props => {
|
|
|
42
41
|
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
43
42
|
color: `var(--ds-text-subtle, ${N500})`
|
|
44
43
|
}
|
|
45
|
-
}), props.cssFn);
|
|
44
|
+
}), props.cssFn);
|
|
46
45
|
|
|
46
|
+
// https://stackoverflow.com/a/39333479
|
|
47
47
|
const safeProps = (({
|
|
48
48
|
iconBefore,
|
|
49
49
|
onClick,
|
|
@@ -57,12 +57,11 @@ const Footer = props => {
|
|
|
57
57
|
children,
|
|
58
58
|
testId
|
|
59
59
|
}))(props);
|
|
60
|
-
|
|
61
60
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, safeProps, {
|
|
62
|
-
component: props.component || Container
|
|
61
|
+
component: props.component || Container
|
|
62
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
63
63
|
,
|
|
64
64
|
cssFn: cssFn
|
|
65
65
|
}));
|
|
66
66
|
};
|
|
67
|
-
|
|
68
67
|
export default Footer;
|