@atlaskit/side-navigation 1.2.12 → 1.2.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/codemods/{0.8.0-change-css-fn-prop.ts → 0.8.0-change-css-fn-prop.tsx} +0 -0
- package/codemods/__tests__/{0.8.0-change-css-fn-prop.ts → 0.8.0-change-css-fn-prop.tsx} +0 -0
- package/codemods/helpers/{generic.ts → generic.tsx} +0 -0
- package/dist/cjs/components/Footer/index.js +11 -2
- package/dist/cjs/components/Header/index.js +11 -2
- package/dist/cjs/components/Item/button-item.js +10 -1
- package/dist/cjs/components/Item/go-back-item.js +11 -1
- package/dist/cjs/components/Item/link-item.js +12 -1
- package/dist/cjs/components/Item/skeleton-item.js +11 -2
- package/dist/cjs/components/LoadingItems/index.js +6 -0
- package/dist/cjs/components/NavigationContent/index.js +9 -0
- package/dist/cjs/components/NavigationFooter/index.js +8 -0
- package/dist/cjs/components/NavigationHeader/index.js +9 -0
- package/dist/cjs/components/NestableNavigationContent/context.js +3 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +8 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +3 -0
- package/dist/cjs/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/cjs/components/Section/heading-item.js +7 -1
- package/dist/cjs/components/Section/section.js +11 -1
- package/dist/cjs/components/Section/skeleton-heading-item.js +10 -2
- package/dist/cjs/components/SideNavigation/index.js +10 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Footer/index.js +11 -2
- package/dist/es2019/components/Header/index.js +11 -2
- package/dist/es2019/components/Item/button-item.js +11 -1
- package/dist/es2019/components/Item/custom-item.js +2 -0
- package/dist/es2019/components/Item/go-back-item.js +12 -1
- package/dist/es2019/components/Item/link-item.js +13 -1
- package/dist/es2019/components/Item/skeleton-item.js +11 -2
- package/dist/es2019/components/LoadingItems/index.js +5 -0
- package/dist/es2019/components/NavigationContent/index.js +9 -0
- package/dist/es2019/components/NavigationFooter/index.js +8 -0
- package/dist/es2019/components/NavigationHeader/index.js +8 -0
- package/dist/es2019/components/NestableNavigationContent/context.js +4 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +8 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/es2019/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/es2019/components/Section/heading-item.js +7 -1
- package/dist/es2019/components/Section/section.js +11 -1
- package/dist/es2019/components/Section/skeleton-heading-item.js +10 -2
- package/dist/es2019/components/SideNavigation/index.js +10 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Footer/index.js +11 -2
- package/dist/esm/components/Header/index.js +11 -2
- package/dist/esm/components/Item/button-item.js +11 -1
- package/dist/esm/components/Item/custom-item.js +2 -0
- package/dist/esm/components/Item/go-back-item.js +12 -1
- package/dist/esm/components/Item/link-item.js +13 -1
- package/dist/esm/components/Item/skeleton-item.js +11 -2
- package/dist/esm/components/LoadingItems/index.js +5 -0
- package/dist/esm/components/NavigationContent/index.js +9 -0
- package/dist/esm/components/NavigationFooter/index.js +8 -0
- package/dist/esm/components/NavigationHeader/index.js +8 -0
- package/dist/esm/components/NestableNavigationContent/context.js +4 -0
- package/dist/esm/components/NestableNavigationContent/index.js +8 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/esm/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/esm/components/Section/heading-item.js +7 -1
- package/dist/esm/components/Section/section.js +11 -1
- package/dist/esm/components/Section/skeleton-heading-item.js +10 -2
- package/dist/esm/components/SideNavigation/index.js +10 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Footer/index.d.ts +6 -0
- package/dist/types/components/Header/index.d.ts +9 -3
- package/dist/types/components/Item/button-item.d.ts +9 -0
- package/dist/types/components/Item/custom-item.d.ts +2 -2
- package/dist/types/components/Item/go-back-item.d.ts +9 -0
- package/dist/types/components/Item/link-item.d.ts +11 -0
- package/dist/types/components/Item/skeleton-item.d.ts +8 -0
- package/dist/types/components/LoadingItems/index.d.ts +6 -1
- package/dist/types/components/NavigationContent/index.d.ts +8 -0
- package/dist/types/components/NavigationFooter/index.d.ts +8 -0
- package/dist/types/components/NavigationHeader/index.d.ts +8 -0
- package/dist/types/components/NestableNavigationContent/context.d.ts +3 -0
- package/dist/types/components/NestableNavigationContent/index.d.ts +12 -4
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
- package/dist/types/components/NestingItem/index.d.ts +1 -1
- package/dist/types/components/Section/heading-item.d.ts +6 -0
- package/dist/types/components/Section/section.d.ts +9 -0
- package/dist/types/components/Section/skeleton-heading-item.d.ts +7 -0
- package/dist/types/components/SideNavigation/index.d.ts +9 -0
- package/docs/00-intro.tsx +10 -65
- package/package.json +8 -7
- package/report.api.md +419 -0
- package/docs/01-side-navigation.tsx +0 -33
- package/docs/02-navigation-header.tsx +0 -39
- package/docs/03-navigation-content.tsx +0 -40
- package/docs/04-nestable-navigation-content.tsx +0 -95
- package/docs/05-navigation-footer.tsx +0 -38
- package/docs/99-loading-states.tsx +0 -95
- package/docs/button-item.tsx +0 -38
- package/docs/custom-item.tsx +0 -45
- package/docs/go-back-item.tsx +0 -31
- package/docs/heading-item.tsx +0 -30
- package/docs/link-item.tsx +0 -39
- package/docs/nesting-item.tsx +0 -52
- package/docs/section.tsx +0 -40
- package/docs/skeleton-heading-item.tsx +0 -30
- package/docs/skeleton-item.tsx +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 1.2.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b2767947029`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b2767947029) - Internal code change turning on new linting rules.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 1.2.12
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -18,9 +18,16 @@ var _styles = require("../../common/styles");
|
|
|
18
18
|
var _Item = require("../Item");
|
|
19
19
|
|
|
20
20
|
var Container = function Container(props) {
|
|
21
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement("div", props);
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* __Header__
|
|
27
|
+
*
|
|
28
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
29
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
30
|
+
*/
|
|
24
31
|
var Footer = function Footer(props) {
|
|
25
32
|
var cssFn = (0, _styles.overrideStyleFunction)(function () {
|
|
26
33
|
return {
|
|
@@ -55,8 +62,10 @@ var Footer = function Footer(props) {
|
|
|
55
62
|
}
|
|
56
63
|
};
|
|
57
64
|
}, props.cssFn);
|
|
58
|
-
return /*#__PURE__*/_react.default.createElement(_Item.CustomItem
|
|
59
|
-
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(_Item.CustomItem // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
66
|
+
, (0, _extends2.default)({}, props, {
|
|
67
|
+
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
68
|
+
,
|
|
60
69
|
cssFn: cssFn
|
|
61
70
|
}));
|
|
62
71
|
};
|
|
@@ -32,9 +32,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
32
32
|
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; }
|
|
33
33
|
|
|
34
34
|
var Container = function Container(props) {
|
|
35
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement("div", props);
|
|
36
37
|
};
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* __Header__
|
|
41
|
+
*
|
|
42
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
43
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
44
|
+
*/
|
|
38
45
|
var Header = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
39
46
|
var cssFn = (0, _styles.overrideStyleFunction)(function () {
|
|
40
47
|
var _ref;
|
|
@@ -56,8 +63,10 @@ var Header = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
56
63
|
}, props.cssFn);
|
|
57
64
|
return /*#__PURE__*/_react.default.createElement(_Item.CustomItem, (0, _extends2.default)({}, props, {
|
|
58
65
|
ref: ref,
|
|
59
|
-
component: props.component || Container
|
|
60
|
-
|
|
66
|
+
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
67
|
+
,
|
|
68
|
+
cssFn: cssFn // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
69
|
+
,
|
|
61
70
|
overrides: {
|
|
62
71
|
Title: {
|
|
63
72
|
render: function render(_, _ref2) {
|
|
@@ -27,6 +27,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* __Button item__
|
|
32
|
+
*
|
|
33
|
+
* A button item renders an item wrapped in a button tag, used primarily when an
|
|
34
|
+
* action does something other than changing routes.
|
|
35
|
+
*
|
|
36
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#button-item)
|
|
37
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
38
|
+
*/
|
|
30
39
|
var ButtonItem = /*#__PURE__*/(0, _react.forwardRef)( // Type needed on props to extract types with extract react types.
|
|
31
40
|
function (_ref, ref) {
|
|
32
41
|
var cssFn = _ref.cssFn,
|
|
@@ -39,7 +48,7 @@ function (_ref, ref) {
|
|
|
39
48
|
return null;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
var cssOverride = (0, _styles.overrideStyleFunction)(_styles.baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
51
|
+
var cssOverride = (0, _styles.overrideStyleFunction)(_styles.baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
43
52
|
|
|
44
53
|
return /*#__PURE__*/_react.default.createElement(_menu.ButtonItem, (0, _extends2.default)({
|
|
45
54
|
ref: ref,
|
|
@@ -29,6 +29,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* __Go back item__
|
|
34
|
+
*
|
|
35
|
+
* A go back item is used to provide a customized "go back" button in nested
|
|
36
|
+
* navigations.
|
|
37
|
+
*
|
|
38
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#go-back-item)
|
|
39
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
40
|
+
*/
|
|
32
41
|
var GoBackItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
33
42
|
var cssFn = _ref.cssFn,
|
|
34
43
|
_ref$iconBefore = _ref.iconBefore,
|
|
@@ -54,7 +63,8 @@ var GoBackItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
54
63
|
onClick && onClick(e);
|
|
55
64
|
}, [onClick, isInteracted]);
|
|
56
65
|
return /*#__PURE__*/_react.default.createElement(_buttonItem.default, (0, _extends2.default)({
|
|
57
|
-
isSelected: isSelected || isInteracted
|
|
66
|
+
isSelected: isSelected || isInteracted // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
67
|
+
,
|
|
58
68
|
cssFn: cssFn,
|
|
59
69
|
iconBefore: iconBefore,
|
|
60
70
|
onClick: onClickHandler,
|
|
@@ -27,6 +27,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* __Link item__
|
|
32
|
+
*
|
|
33
|
+
* Renders an item wrapped in an anchor tag, useful when you have an item that
|
|
34
|
+
* should change routes using native browser navigation. For SPA transitions use
|
|
35
|
+
* a [custom item](https://atlassian.design/components/side-navigation/examples#custom-item)
|
|
36
|
+
* with the respective router logic.
|
|
37
|
+
*
|
|
38
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#link-item)
|
|
39
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
40
|
+
*/
|
|
30
41
|
var LinkItem = /*#__PURE__*/(0, _react.forwardRef)( // Type needed on props to extract types with extract react types.
|
|
31
42
|
function (_ref, ref) {
|
|
32
43
|
var cssFn = _ref.cssFn,
|
|
@@ -39,7 +50,7 @@ function (_ref, ref) {
|
|
|
39
50
|
return null;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
var cssOverride = (0, _styles.overrideStyleFunction)(_styles.baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
53
|
+
var cssOverride = (0, _styles.overrideStyleFunction)(_styles.baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
43
54
|
|
|
44
55
|
return /*#__PURE__*/_react.default.createElement(_menu.LinkItem, (0, _extends2.default)({
|
|
45
56
|
ref: ref,
|
|
@@ -17,6 +17,14 @@ var _styles = require("../../common/styles");
|
|
|
17
17
|
|
|
18
18
|
var _context = require("../NestableNavigationContent/context");
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* __Skeleton item__
|
|
22
|
+
*
|
|
23
|
+
* A skeleton item can be used to reduce the perceived laoding time.
|
|
24
|
+
*
|
|
25
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
26
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
27
|
+
*/
|
|
20
28
|
var SkeletonItem = function SkeletonItem(props) {
|
|
21
29
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
22
30
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -25,7 +33,7 @@ var SkeletonItem = function SkeletonItem(props) {
|
|
|
25
33
|
return null;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
29
37
|
, (0, _extends2.default)({
|
|
30
38
|
cssFn: function cssFn() {
|
|
31
39
|
return {
|
|
@@ -36,7 +44,8 @@ var SkeletonItem = function SkeletonItem(props) {
|
|
|
36
44
|
marginRight: 18
|
|
37
45
|
}
|
|
38
46
|
};
|
|
39
|
-
}
|
|
47
|
+
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
48
|
+
|
|
40
49
|
}, props));
|
|
41
50
|
};
|
|
42
51
|
|
|
@@ -16,6 +16,12 @@ var _motion = require("@atlaskit/motion");
|
|
|
16
16
|
var _context = require("../NestableNavigationContent/context");
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* __Loading items__
|
|
22
|
+
*
|
|
23
|
+
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
24
|
+
*/
|
|
19
25
|
var LoadingItems = function LoadingItems(_ref) {
|
|
20
26
|
var children = _ref.children,
|
|
21
27
|
isLoading = _ref.isLoading,
|
|
@@ -18,6 +18,15 @@ var _context = require("../NestableNavigationContent/context");
|
|
|
18
18
|
var _styles = require("./styles");
|
|
19
19
|
|
|
20
20
|
/** @jsx jsx */
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* __Navigation content__
|
|
24
|
+
*
|
|
25
|
+
* A navigation content is used as the container for navigation items.
|
|
26
|
+
*
|
|
27
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#content)
|
|
28
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
29
|
+
*/
|
|
21
30
|
var NavigationContent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
22
31
|
var showTopScrollIndicator = props.showTopScrollIndicator,
|
|
23
32
|
children = props.children;
|
|
@@ -15,6 +15,14 @@ var footerCSS = {
|
|
|
15
15
|
padding: (0, _constants.gridSize)(),
|
|
16
16
|
paddingBottom: (0, _constants.gridSize)() * 1.75
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* __Navigation footer__
|
|
20
|
+
*
|
|
21
|
+
* Allows for customisation of the footer.
|
|
22
|
+
*
|
|
23
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
24
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
25
|
+
*/
|
|
18
26
|
|
|
19
27
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
20
28
|
var children = _ref.children;
|
|
@@ -10,6 +10,15 @@ var _core = require("@emotion/core");
|
|
|
10
10
|
var _constants = require("@atlaskit/theme/constants");
|
|
11
11
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* __Navigation header__
|
|
16
|
+
*
|
|
17
|
+
* Allows for customisation of the header.
|
|
18
|
+
*
|
|
19
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
20
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
21
|
+
*/
|
|
13
22
|
var NavigationHeader = function NavigationHeader(props) {
|
|
14
23
|
var children = props.children;
|
|
15
24
|
return (0, _core.jsx)("div", {
|
|
@@ -7,6 +7,9 @@ exports.useShouldNestedElementRender = exports.useNestedContext = exports.Nested
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
var NestedContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
11
14
|
exports.NestedContext = NestedContext;
|
|
12
15
|
|
|
@@ -30,6 +30,14 @@ var _nestingMotion = require("./nesting-motion");
|
|
|
30
30
|
var ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
31
31
|
exports.ROOT_ID = ROOT_ID;
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* __Nestable navigation content__
|
|
35
|
+
*
|
|
36
|
+
* The container for navigation items with nested views
|
|
37
|
+
*
|
|
38
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#nested-navigation)
|
|
39
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
40
|
+
*/
|
|
33
41
|
var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
34
42
|
var containerRef = (0, _react.useRef)(null);
|
|
35
43
|
var children = props.children,
|
|
@@ -17,6 +17,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
|
|
18
18
|
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; }
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
20
23
|
var NestingMotion = function NestingMotion(props) {
|
|
21
24
|
var children = props.children,
|
|
22
25
|
enterFrom = props.enterFrom,
|
|
@@ -17,6 +17,12 @@ var _styles = require("../../common/styles");
|
|
|
17
17
|
|
|
18
18
|
var _context = require("../NestableNavigationContent/context");
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* __Heading item__
|
|
22
|
+
*
|
|
23
|
+
* Available for advanced use cases, for most situations providing a title to Section should be enough.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
20
26
|
var HeadingItem = function HeadingItem(props) {
|
|
21
27
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
22
28
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -25,7 +31,7 @@ var HeadingItem = function HeadingItem(props) {
|
|
|
25
31
|
return null;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
var cssFn = (0, _styles.overrideStyleFunction)(_styles.sectionHeaderStyle, props.cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
34
|
+
var cssFn = (0, _styles.overrideStyleFunction)(_styles.sectionHeaderStyle, props.cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides, @repo/internal/react/no-unsafe-spread-props
|
|
29
35
|
|
|
30
36
|
return /*#__PURE__*/_react.default.createElement(_menu.HeadingItem, (0, _extends2.default)({}, props, {
|
|
31
37
|
cssFn: cssFn
|
|
@@ -24,6 +24,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
24
24
|
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
25
|
|
|
26
26
|
// Type needed on props to extract types with extract react types.
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* __Section__
|
|
30
|
+
*
|
|
31
|
+
* Used to separate items into sections. Using the title prop makes a section
|
|
32
|
+
* implicitly group the items for screen readers with no additional work required.
|
|
33
|
+
*
|
|
34
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#section)
|
|
35
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
36
|
+
*/
|
|
27
37
|
var Section = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
28
38
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
29
39
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -33,7 +43,7 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
return /*#__PURE__*/_react.default.createElement(_menu.Section, (0, _extends2.default)({}, props, {
|
|
36
|
-
ref: ref // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
46
|
+
ref: ref // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
37
47
|
,
|
|
38
48
|
overrides: {
|
|
39
49
|
HeadingItem: {
|
|
@@ -17,6 +17,13 @@ var _styles = require("../../common/styles");
|
|
|
17
17
|
|
|
18
18
|
var _context = require("../NestableNavigationContent/context");
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* __Skeleton heading item__
|
|
22
|
+
*
|
|
23
|
+
* A skeleton heading item for use in managing loading states.
|
|
24
|
+
*
|
|
25
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
26
|
+
*/
|
|
20
27
|
var SkeletonHeadingItem = function SkeletonHeadingItem(props) {
|
|
21
28
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
22
29
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -25,14 +32,15 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(props) {
|
|
|
25
32
|
return null;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonHeadingItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonHeadingItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
29
36
|
, (0, _extends2.default)({
|
|
30
37
|
cssFn: function cssFn() {
|
|
31
38
|
return {
|
|
32
39
|
paddingLeft: _styles.ITEM_SIDE_PADDING,
|
|
33
40
|
paddingRight: _styles.ITEM_SIDE_PADDING
|
|
34
41
|
};
|
|
35
|
-
}
|
|
42
|
+
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
43
|
+
|
|
36
44
|
}, props));
|
|
37
45
|
};
|
|
38
46
|
|
|
@@ -14,6 +14,16 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
14
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
15
15
|
|
|
16
16
|
/** @jsx jsx */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* __Side navigation__
|
|
20
|
+
*
|
|
21
|
+
* A highly composable side navigation component that supports nested views.
|
|
22
|
+
*
|
|
23
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples)
|
|
24
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
25
|
+
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
26
|
+
*/
|
|
17
27
|
var SideNavigation = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
18
28
|
var children = props.children,
|
|
19
29
|
testId = props.testId,
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,9 +5,16 @@ import { overrideStyleFunction } from '../../common/styles';
|
|
|
5
5
|
import { CustomItem } from '../Item';
|
|
6
6
|
|
|
7
7
|
const Container = props => {
|
|
8
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
8
9
|
return /*#__PURE__*/React.createElement("div", props);
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* __Header__
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
16
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
17
|
+
*/
|
|
11
18
|
const Footer = props => {
|
|
12
19
|
const cssFn = overrideStyleFunction(() => ({
|
|
13
20
|
userSelect: 'auto',
|
|
@@ -40,8 +47,10 @@ const Footer = props => {
|
|
|
40
47
|
color: `var(--ds-text-subtle, ${N500})`
|
|
41
48
|
}
|
|
42
49
|
}), props.cssFn);
|
|
43
|
-
return /*#__PURE__*/React.createElement(CustomItem
|
|
44
|
-
|
|
50
|
+
return /*#__PURE__*/React.createElement(CustomItem // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
51
|
+
, _extends({}, props, {
|
|
52
|
+
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
53
|
+
,
|
|
45
54
|
cssFn: cssFn
|
|
46
55
|
}));
|
|
47
56
|
};
|
|
@@ -6,9 +6,16 @@ import { overrideStyleFunction } from '../../common/styles';
|
|
|
6
6
|
import { CustomItem } from '../Item';
|
|
7
7
|
|
|
8
8
|
const Container = props => {
|
|
9
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
9
10
|
return /*#__PURE__*/React.createElement("div", props);
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* __Header__
|
|
15
|
+
*
|
|
16
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
17
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
18
|
+
*/
|
|
12
19
|
const Header = /*#__PURE__*/forwardRef((props, ref) => {
|
|
13
20
|
const cssFn = overrideStyleFunction(() => ({
|
|
14
21
|
userSelect: 'auto',
|
|
@@ -30,8 +37,10 @@ const Header = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
30
37
|
}), props.cssFn);
|
|
31
38
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
32
39
|
ref: ref,
|
|
33
|
-
component: props.component || Container
|
|
34
|
-
|
|
40
|
+
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
41
|
+
,
|
|
42
|
+
cssFn: cssFn // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
43
|
+
,
|
|
35
44
|
overrides: {
|
|
36
45
|
Title: {
|
|
37
46
|
render: (_, {
|
|
@@ -3,6 +3,16 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { ButtonItem as Button } from '@atlaskit/menu';
|
|
4
4
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* __Button item__
|
|
9
|
+
*
|
|
10
|
+
* A button item renders an item wrapped in a button tag, used primarily when an
|
|
11
|
+
* action does something other than changing routes.
|
|
12
|
+
*
|
|
13
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#button-item)
|
|
14
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
15
|
+
*/
|
|
6
16
|
const ButtonItem = /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
7
17
|
({
|
|
8
18
|
cssFn,
|
|
@@ -16,7 +26,7 @@ const ButtonItem = /*#__PURE__*/forwardRef( // Type needed on props to extract t
|
|
|
16
26
|
return null;
|
|
17
27
|
}
|
|
18
28
|
|
|
19
|
-
const cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
29
|
+
const cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
20
30
|
|
|
21
31
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
22
32
|
ref: ref,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @repo/internal/react/no-unsafe-overrides */
|
|
2
4
|
import React, { forwardRef } from 'react';
|
|
3
5
|
import { CustomItem as Custom } from '@atlaskit/menu';
|
|
4
6
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
@@ -3,6 +3,16 @@ import React, { forwardRef, useCallback, useState } from 'react';
|
|
|
3
3
|
import LeftArrow from '@atlaskit/icon/glyph/arrow-left-circle';
|
|
4
4
|
import { N10 } from '@atlaskit/theme/colors';
|
|
5
5
|
import ButtonItem from './button-item';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* __Go back item__
|
|
9
|
+
*
|
|
10
|
+
* A go back item is used to provide a customized "go back" button in nested
|
|
11
|
+
* navigations.
|
|
12
|
+
*
|
|
13
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#go-back-item)
|
|
14
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
15
|
+
*/
|
|
6
16
|
const GoBackItem = /*#__PURE__*/forwardRef(({
|
|
7
17
|
cssFn,
|
|
8
18
|
iconBefore = /*#__PURE__*/React.createElement(LeftArrow, {
|
|
@@ -23,7 +33,8 @@ const GoBackItem = /*#__PURE__*/forwardRef(({
|
|
|
23
33
|
onClick && onClick(e);
|
|
24
34
|
}, [onClick, isInteracted]);
|
|
25
35
|
return /*#__PURE__*/React.createElement(ButtonItem, _extends({
|
|
26
|
-
isSelected: isSelected || isInteracted
|
|
36
|
+
isSelected: isSelected || isInteracted // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
37
|
+
,
|
|
27
38
|
cssFn: cssFn,
|
|
28
39
|
iconBefore: iconBefore,
|
|
29
40
|
onClick: onClickHandler,
|
|
@@ -3,6 +3,18 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { LinkItem as Link } from '@atlaskit/menu';
|
|
4
4
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* __Link item__
|
|
9
|
+
*
|
|
10
|
+
* Renders an item wrapped in an anchor tag, useful when you have an item that
|
|
11
|
+
* should change routes using native browser navigation. For SPA transitions use
|
|
12
|
+
* a [custom item](https://atlassian.design/components/side-navigation/examples#custom-item)
|
|
13
|
+
* with the respective router logic.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#link-item)
|
|
16
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
17
|
+
*/
|
|
6
18
|
const LinkItem = /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
7
19
|
({
|
|
8
20
|
cssFn,
|
|
@@ -16,7 +28,7 @@ const LinkItem = /*#__PURE__*/forwardRef( // Type needed on props to extract typ
|
|
|
16
28
|
return null;
|
|
17
29
|
}
|
|
18
30
|
|
|
19
|
-
const cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
31
|
+
const cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn); // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
20
32
|
|
|
21
33
|
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
22
34
|
ref: ref,
|
|
@@ -4,6 +4,14 @@ import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
|
4
4
|
import { ITEM_SIDE_PADDING } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* __Skeleton item__
|
|
9
|
+
*
|
|
10
|
+
* A skeleton item can be used to reduce the perceived laoding time.
|
|
11
|
+
*
|
|
12
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
13
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
14
|
+
*/
|
|
7
15
|
const SkeletonItem = props => {
|
|
8
16
|
const {
|
|
9
17
|
shouldRender
|
|
@@ -13,7 +21,7 @@ const SkeletonItem = props => {
|
|
|
13
21
|
return null;
|
|
14
22
|
}
|
|
15
23
|
|
|
16
|
-
return /*#__PURE__*/React.createElement(SkelItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
24
|
+
return /*#__PURE__*/React.createElement(SkelItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
17
25
|
, _extends({
|
|
18
26
|
cssFn: () => ({
|
|
19
27
|
paddingLeft: ITEM_SIDE_PADDING,
|
|
@@ -22,7 +30,8 @@ const SkeletonItem = props => {
|
|
|
22
30
|
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
23
31
|
marginRight: 18
|
|
24
32
|
}
|
|
25
|
-
})
|
|
33
|
+
}) // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
34
|
+
|
|
26
35
|
}, props));
|
|
27
36
|
};
|
|
28
37
|
|
|
@@ -5,6 +5,11 @@ import { jsx } from '@emotion/core';
|
|
|
5
5
|
import { ExitingPersistence, FadeIn, mediumDurationMs } from '@atlaskit/motion';
|
|
6
6
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* __Loading items__
|
|
10
|
+
*
|
|
11
|
+
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
12
|
+
*/
|
|
8
13
|
const LoadingItems = ({
|
|
9
14
|
children,
|
|
10
15
|
isLoading,
|
|
@@ -4,6 +4,15 @@ import { jsx } from '@emotion/core';
|
|
|
4
4
|
import useScrollbarWidth from '@atlaskit/ds-lib/use-scrollbar-width';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* __Navigation content__
|
|
10
|
+
*
|
|
11
|
+
* A navigation content is used as the container for navigation items.
|
|
12
|
+
*
|
|
13
|
+
* - [Examples](https://atlassian.design/components/side-navigation/examples#content)
|
|
14
|
+
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
15
|
+
*/
|
|
7
16
|
const NavigationContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
17
|
const {
|
|
9
18
|
showTopScrollIndicator,
|