@atlaskit/side-navigation 1.5.1 → 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 +6 -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 +1 -6
- package/dist/cjs/components/NavigationHeader/index.js +1 -6
- 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 +23 -59
- 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 +2 -3
- package/dist/es2019/components/NavigationHeader/index.js +1 -3
- 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 +5 -15
- 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 +2 -3
- package/dist/esm/components/NavigationHeader/index.js +1 -3
- 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 +23 -39
- 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 +1 -1
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { HeadingItem as MenuHeadingItem } from '@atlaskit/menu';
|
|
4
4
|
import { overrideStyleFunction, sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* __Heading item__
|
|
9
8
|
*
|
|
@@ -14,16 +13,14 @@ const HeadingItem = props => {
|
|
|
14
13
|
const {
|
|
15
14
|
shouldRender
|
|
16
15
|
} = useShouldNestedElementRender();
|
|
17
|
-
|
|
18
16
|
if (!shouldRender) {
|
|
19
17
|
return null;
|
|
20
18
|
}
|
|
19
|
+
const cssFn = overrideStyleFunction(sectionHeaderSpacingStyles, props.cssFn);
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides, @repo/internal/react/no-unsafe-spread-props
|
|
24
22
|
return /*#__PURE__*/React.createElement(MenuHeadingItem, _extends({}, props, {
|
|
25
23
|
cssFn: cssFn
|
|
26
24
|
}));
|
|
27
25
|
};
|
|
28
|
-
|
|
29
26
|
export default HeadingItem;
|
|
@@ -4,7 +4,6 @@ import { Section as MenuSection } from '@atlaskit/menu';
|
|
|
4
4
|
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
// Type needed on props to extract types with extract react types.
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* __Section__
|
|
10
9
|
*
|
|
@@ -18,13 +17,12 @@ const Section = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
18
17
|
const {
|
|
19
18
|
shouldRender
|
|
20
19
|
} = useShouldNestedElementRender();
|
|
21
|
-
|
|
22
20
|
if (!shouldRender) {
|
|
23
21
|
return props.children;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
return /*#__PURE__*/React.createElement(MenuSection, _extends({}, props, {
|
|
27
|
-
ref: ref
|
|
24
|
+
ref: ref
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
28
26
|
,
|
|
29
27
|
overrides: {
|
|
30
28
|
HeadingItem: {
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
4
4
|
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* __Skeleton heading item__
|
|
9
8
|
*
|
|
@@ -15,17 +14,16 @@ const SkeletonHeadingItem = props => {
|
|
|
15
14
|
const {
|
|
16
15
|
shouldRender
|
|
17
16
|
} = useShouldNestedElementRender();
|
|
18
|
-
|
|
19
17
|
if (!shouldRender) {
|
|
20
18
|
return null;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return /*#__PURE__*/React.createElement(MenuSkeletonHeadingItem
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
24
22
|
, _extends({
|
|
25
|
-
cssFn: () => ({
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
cssFn: () => ({
|
|
24
|
+
...sectionHeaderSpacingStyles()
|
|
25
|
+
})
|
|
26
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
28
27
|
}, props));
|
|
29
28
|
};
|
|
30
|
-
|
|
31
29
|
export default SkeletonHeadingItem;
|
|
@@ -14,6 +14,7 @@ const sideNavStyles = css({
|
|
|
14
14
|
color: `var(--ds-text-subtle, ${N500})`,
|
|
15
15
|
overflow: 'hidden'
|
|
16
16
|
});
|
|
17
|
+
|
|
17
18
|
/**
|
|
18
19
|
* __Side navigation__
|
|
19
20
|
*
|
|
@@ -23,14 +24,14 @@ const sideNavStyles = css({
|
|
|
23
24
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
24
25
|
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
27
|
const SideNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
28
28
|
const {
|
|
29
29
|
children,
|
|
30
30
|
testId,
|
|
31
31
|
label
|
|
32
32
|
} = props;
|
|
33
|
-
return (
|
|
33
|
+
return (
|
|
34
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
34
35
|
jsx("nav", {
|
|
35
36
|
ref: ref,
|
|
36
37
|
"data-testid": testId,
|
|
@@ -8,7 +8,6 @@ export const useChildIds = (currentStackId, committedStack, onUnknownNest) => {
|
|
|
8
8
|
if (currentStackId === ROOT_ID || !childIdsRef.current.size || childIdsRef.current.has(currentStackId) || !onUnknownNest) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
onUnknownNest(committedStack || [currentStackId]);
|
|
13
12
|
}, [currentStackId, committedStack, onUnknownNest]);
|
|
14
13
|
return {
|
|
@@ -20,15 +19,14 @@ export const useChildIdsEffect = (childIds, id) => {
|
|
|
20
19
|
if (!childIds || !childIds.current) {
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
if (!childIds.current.has(id)) {
|
|
25
23
|
childIds.current.add(id);
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
return () => {
|
|
29
26
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
27
|
childIds.current.delete(id);
|
|
31
|
-
};
|
|
28
|
+
};
|
|
29
|
+
// childIds shouldn't change as it's a ref
|
|
32
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
31
|
}, [id]);
|
|
34
32
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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) { _defineProperty(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; }
|
|
6
|
-
|
|
7
4
|
import { B400, B50, N30, N500 } from '@atlaskit/theme/colors';
|
|
8
5
|
import { borderRadius as borderRadiusFn } from '@atlaskit/theme/constants';
|
|
9
6
|
var borderRadius = borderRadiusFn();
|
|
7
|
+
|
|
10
8
|
/**
|
|
11
9
|
* Allows chaining of style functions on top of base style functions
|
|
12
10
|
* @param baseStyle the base custom cssFn
|
|
@@ -14,7 +12,6 @@ var borderRadius = borderRadiusFn();
|
|
|
14
12
|
*
|
|
15
13
|
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
|
|
16
14
|
*/
|
|
17
|
-
|
|
18
15
|
export var overrideStyleFunction = function overrideStyleFunction(baseStyle) {
|
|
19
16
|
var newStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
20
17
|
return {};
|
|
@@ -50,11 +47,11 @@ var selectedStyles = {
|
|
|
50
47
|
};
|
|
51
48
|
export var baseSideNavItemStyle = function baseSideNavItemStyle(_ref) {
|
|
52
49
|
var isSelected = _ref.isSelected,
|
|
53
|
-
|
|
50
|
+
isDisabled = _ref.isDisabled;
|
|
54
51
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
55
52
|
// This padding is set to ensure that the center of the left icon
|
|
56
53
|
// is approximately center aligned with the horizontal app switcher.
|
|
57
|
-
padding: "var(--ds-
|
|
54
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-100, 10px)"),
|
|
58
55
|
borderRadius: borderRadius,
|
|
59
56
|
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
60
57
|
// Menu and side navigation are now color aligned so they do not need this!
|
|
@@ -64,17 +61,17 @@ export var baseSideNavItemStyle = function baseSideNavItemStyle(_ref) {
|
|
|
64
61
|
// TODO: Can this be moved into menu?
|
|
65
62
|
// center align icons with app-switcher regardless of size
|
|
66
63
|
display: 'flex',
|
|
67
|
-
height: "var(--ds-
|
|
68
|
-
width: "var(--ds-
|
|
64
|
+
height: "var(--ds-space-300, 24px)",
|
|
65
|
+
width: "var(--ds-space-300, 24px)",
|
|
69
66
|
alignItems: 'center',
|
|
70
67
|
justifyContent: 'center',
|
|
71
68
|
// this margin could be removed if the respective item had a more
|
|
72
69
|
// compositional API so an Inline could be used to separate elements instead
|
|
73
|
-
marginRight: "var(--ds-
|
|
70
|
+
marginRight: "var(--ds-space-200, 16px)"
|
|
74
71
|
}));
|
|
75
72
|
};
|
|
76
73
|
export var sectionHeaderSpacingStyles = function sectionHeaderSpacingStyles() {
|
|
77
74
|
return {
|
|
78
|
-
paddingInline: "var(--ds-
|
|
75
|
+
paddingInline: "var(--ds-space-100, 10px)"
|
|
79
76
|
};
|
|
80
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
|
*
|
|
@@ -21,8 +20,8 @@ var Footer = function Footer(props) {
|
|
|
21
20
|
alignItems: 'center',
|
|
22
21
|
width: '100%',
|
|
23
22
|
'[data-item-elem-before]': {
|
|
24
|
-
marginRight: "var(--ds-
|
|
25
|
-
marginBottom: "var(--ds-
|
|
23
|
+
marginRight: "var(--ds-space-0, 0px)",
|
|
24
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
26
25
|
display: 'inline-block'
|
|
27
26
|
},
|
|
28
27
|
'[data-item-title]': {
|
|
@@ -32,7 +31,7 @@ var Footer = function Footer(props) {
|
|
|
32
31
|
'[data-item-description]': {
|
|
33
32
|
textAlign: 'center',
|
|
34
33
|
display: 'inline-block',
|
|
35
|
-
margin: "var(--ds-
|
|
34
|
+
margin: "var(--ds-space-075, 6px)"
|
|
36
35
|
},
|
|
37
36
|
// Will look interactive if the `component` is anything other than a div.
|
|
38
37
|
'div&:hover': {
|
|
@@ -44,14 +43,15 @@ var Footer = function Footer(props) {
|
|
|
44
43
|
color: "var(--ds-text-subtle, ".concat(N500, ")")
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
|
-
}, props.cssFn);
|
|
46
|
+
}, props.cssFn);
|
|
48
47
|
|
|
48
|
+
// https://stackoverflow.com/a/39333479
|
|
49
49
|
var safeProps = function (_ref) {
|
|
50
50
|
var iconBefore = _ref.iconBefore,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
onClick = _ref.onClick,
|
|
52
|
+
description = _ref.description,
|
|
53
|
+
children = _ref.children,
|
|
54
|
+
testId = _ref.testId;
|
|
55
55
|
return {
|
|
56
56
|
iconBefore: iconBefore,
|
|
57
57
|
onClick: onClick,
|
|
@@ -60,12 +60,11 @@ var Footer = function Footer(props) {
|
|
|
60
60
|
testId: testId
|
|
61
61
|
};
|
|
62
62
|
}(props);
|
|
63
|
-
|
|
64
63
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, safeProps, {
|
|
65
|
-
component: props.component || Container
|
|
64
|
+
component: props.component || Container
|
|
65
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
66
66
|
,
|
|
67
67
|
cssFn: cssFn
|
|
68
68
|
}));
|
|
69
69
|
};
|
|
70
|
-
|
|
71
70
|
export default Footer;
|
|
@@ -2,8 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["children"],
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
_excluded2 = ["children"];
|
|
7
6
|
/* eslint-disable @repo/internal/react/use-primitives */
|
|
8
7
|
import React, { forwardRef } from 'react';
|
|
9
8
|
import Box from '@atlaskit/ds-explorations/box';
|
|
@@ -11,27 +10,26 @@ import { N500 } from '@atlaskit/theme/colors';
|
|
|
11
10
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
12
11
|
import { overrideStyleFunction } from '../../common/styles';
|
|
13
12
|
import { CustomItem } from '../Item';
|
|
13
|
+
|
|
14
14
|
/**
|
|
15
15
|
* __Container__
|
|
16
16
|
*
|
|
17
17
|
* A container for Header and Footer that safely handles props to the child component
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
19
|
export var Container = function Container(_ref) {
|
|
21
20
|
var children = _ref.children,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
22
|
// https://stackoverflow.com/a/39333479
|
|
25
23
|
var safeProps = function (_ref2) {
|
|
26
24
|
var className = _ref2.className,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
testId = _ref2['data-testid'],
|
|
26
|
+
onClick = _ref2.onClick,
|
|
27
|
+
onMouseDown = _ref2.onMouseDown,
|
|
28
|
+
onDragStart = _ref2.onDragStart,
|
|
29
|
+
draggable = _ref2.draggable,
|
|
30
|
+
ref = _ref2.ref,
|
|
31
|
+
tabIndex = _ref2.tabIndex,
|
|
32
|
+
disabled = _ref2.disabled;
|
|
35
33
|
return {
|
|
36
34
|
className: className,
|
|
37
35
|
testId: testId,
|
|
@@ -44,13 +42,11 @@ export var Container = function Container(_ref) {
|
|
|
44
42
|
disabled: disabled
|
|
45
43
|
};
|
|
46
44
|
}(props);
|
|
47
|
-
|
|
48
45
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
49
46
|
as: "div",
|
|
50
47
|
display: "block"
|
|
51
48
|
}, safeProps), children);
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
/**
|
|
55
51
|
* __Header__
|
|
56
52
|
*
|
|
@@ -60,7 +56,6 @@ export var Container = function Container(_ref) {
|
|
|
60
56
|
var Header = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
61
57
|
var cssFn = overrideStyleFunction(function () {
|
|
62
58
|
var _ref3;
|
|
63
|
-
|
|
64
59
|
return _ref3 = {
|
|
65
60
|
userSelect: 'auto'
|
|
66
61
|
}, _defineProperty(_ref3, '[data-item-title]', {
|
|
@@ -78,16 +73,17 @@ var Header = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
78
73
|
}, props.cssFn);
|
|
79
74
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
80
75
|
ref: ref,
|
|
81
|
-
component: props.component || Container
|
|
76
|
+
component: props.component || Container
|
|
77
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
82
78
|
,
|
|
83
|
-
cssFn: cssFn
|
|
79
|
+
cssFn: cssFn
|
|
80
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
84
81
|
,
|
|
85
82
|
overrides: {
|
|
86
83
|
Title: {
|
|
87
84
|
render: function render(_, _ref4) {
|
|
88
85
|
var children = _ref4.children,
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
91
87
|
return /*#__PURE__*/React.createElement("h2", props, children);
|
|
92
88
|
}
|
|
93
89
|
}
|
|
@@ -5,7 +5,6 @@ import React, { forwardRef } from 'react';
|
|
|
5
5
|
import { ButtonItem as Button } from '@atlaskit/menu';
|
|
6
6
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
7
7
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* __Button item__
|
|
11
10
|
*
|
|
@@ -15,20 +14,18 @@ import { useShouldNestedElementRender } from '../NestableNavigationContent/conte
|
|
|
15
14
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#button-item)
|
|
16
15
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
17
16
|
*/
|
|
18
|
-
var ButtonItem = /*#__PURE__*/forwardRef(
|
|
17
|
+
var ButtonItem = /*#__PURE__*/forwardRef(
|
|
18
|
+
// Type needed on props to extract types with extract react types.
|
|
19
19
|
function (_ref, ref) {
|
|
20
20
|
var cssFn = _ref.cssFn,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
22
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
26
24
|
if (!shouldRender) {
|
|
27
25
|
return null;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
32
29
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
33
30
|
ref: ref,
|
|
34
31
|
cssFn: cssOverride
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["cssFn"];
|
|
4
|
-
|
|
5
4
|
/* eslint-disable @repo/internal/react/no-unsafe-overrides */
|
|
6
5
|
import React, { forwardRef } from 'react';
|
|
7
6
|
import { CustomItem as Custom } from '@atlaskit/menu';
|
|
8
7
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
9
8
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* Used to support any custom items needed by products alongside the Header and Footer patterns.
|
|
13
11
|
* Specific implementation of headers and footers are provided in the examples folder.
|
|
14
12
|
*/
|
|
15
|
-
var CustomItem = /*#__PURE__*/forwardRef(
|
|
13
|
+
var CustomItem = /*#__PURE__*/forwardRef(
|
|
14
|
+
// Type needed on props to extract types with extract react types.
|
|
16
15
|
function (_ref, ref) {
|
|
17
16
|
var cssFn = _ref.cssFn,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
18
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
23
20
|
if (!shouldRender) {
|
|
24
21
|
return null;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis
|
|
29
25
|
return /*#__PURE__*/React.createElement(Custom, _extends({
|
|
30
26
|
ref: ref,
|
|
31
27
|
cssFn: cssOverride
|
|
32
28
|
}, rest));
|
|
33
|
-
}
|
|
29
|
+
}
|
|
30
|
+
// Dirty hack to get generics working with forward ref [2/2]
|
|
34
31
|
);
|
|
32
|
+
|
|
35
33
|
export default CustomItem;
|
|
@@ -6,7 +6,6 @@ import React, { forwardRef, useCallback, useState } from 'react';
|
|
|
6
6
|
import LeftArrow from '@atlaskit/icon/glyph/arrow-left-circle';
|
|
7
7
|
import { N10 } from '@atlaskit/theme/colors';
|
|
8
8
|
import ButtonItem from './button-item';
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* __Go back item__
|
|
12
11
|
*
|
|
@@ -18,30 +17,28 @@ import ButtonItem from './button-item';
|
|
|
18
17
|
*/
|
|
19
18
|
var GoBackItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
19
|
var cssFn = _ref.cssFn,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
_ref$iconBefore = _ref.iconBefore,
|
|
21
|
+
iconBefore = _ref$iconBefore === void 0 ? /*#__PURE__*/React.createElement(LeftArrow, {
|
|
22
|
+
secondaryColor: "var(--ds-surface, ".concat(N10, ")"),
|
|
23
|
+
label: ""
|
|
24
|
+
}) : _ref$iconBefore,
|
|
25
|
+
onClick = _ref.onClick,
|
|
26
|
+
isSelected = _ref.isSelected,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
28
|
var _useState = useState(false),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
isInteracted = _useState2[0],
|
|
31
|
+
setIsInteracted = _useState2[1];
|
|
35
32
|
var onClickHandler = useCallback(function (e) {
|
|
36
33
|
if (isInteracted) {
|
|
37
34
|
return;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
setIsInteracted(true);
|
|
41
37
|
onClick && onClick(e);
|
|
42
38
|
}, [onClick, isInteracted]);
|
|
43
39
|
return /*#__PURE__*/React.createElement(ButtonItem, _extends({
|
|
44
|
-
isSelected: isSelected || isInteracted
|
|
40
|
+
isSelected: isSelected || isInteracted
|
|
41
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
45
42
|
,
|
|
46
43
|
cssFn: cssFn,
|
|
47
44
|
iconBefore: iconBefore,
|
|
@@ -5,7 +5,6 @@ import React, { forwardRef } from 'react';
|
|
|
5
5
|
import { LinkItem as Link } from '@atlaskit/menu';
|
|
6
6
|
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
7
7
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* __Link item__
|
|
11
10
|
*
|
|
@@ -17,20 +16,18 @@ import { useShouldNestedElementRender } from '../NestableNavigationContent/conte
|
|
|
17
16
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#link-item)
|
|
18
17
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
19
18
|
*/
|
|
20
|
-
var LinkItem = /*#__PURE__*/forwardRef(
|
|
19
|
+
var LinkItem = /*#__PURE__*/forwardRef(
|
|
20
|
+
// Type needed on props to extract types with extract react types.
|
|
21
21
|
function (_ref, ref) {
|
|
22
22
|
var cssFn = _ref.cssFn,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
24
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
28
26
|
if (!shouldRender) {
|
|
29
27
|
return null;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
30
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
34
31
|
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
35
32
|
ref: ref,
|
|
36
33
|
cssFn: cssOverride
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
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; }
|
|
5
|
-
|
|
6
4
|
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) { _defineProperty(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; }
|
|
7
|
-
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
10
7
|
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
11
8
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
12
|
-
|
|
13
9
|
/**
|
|
14
10
|
* __Skeleton item__
|
|
15
11
|
*
|
|
@@ -20,26 +16,24 @@ import { useShouldNestedElementRender } from '../NestableNavigationContent/conte
|
|
|
20
16
|
*/
|
|
21
17
|
var SkeletonItem = function SkeletonItem(props) {
|
|
22
18
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
25
20
|
if (!shouldRender) {
|
|
26
21
|
return null;
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
return /*#__PURE__*/React.createElement(SkelItem
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
30
25
|
, _extends({
|
|
31
26
|
cssFn: function cssFn() {
|
|
32
27
|
return _objectSpread(_objectSpread({}, sectionHeaderSpacingStyles()), {}, {
|
|
33
28
|
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
34
29
|
'&&::before': {
|
|
35
|
-
height: "var(--ds-
|
|
36
|
-
marginRight: "var(--ds-
|
|
37
|
-
width: "var(--ds-
|
|
30
|
+
height: "var(--ds-space-300, 20px)",
|
|
31
|
+
marginRight: "var(--ds-space-200, 18px)",
|
|
32
|
+
width: "var(--ds-space-300, 20px)"
|
|
38
33
|
}
|
|
39
34
|
});
|
|
40
|
-
}
|
|
41
|
-
|
|
35
|
+
}
|
|
36
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
42
37
|
}, props));
|
|
43
38
|
};
|
|
44
|
-
|
|
45
39
|
export default SkeletonItem;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { css, jsx } from '@emotion/react';
|
|
5
4
|
import { ExitingPersistence, FadeIn, mediumDurationMs } from '@atlaskit/motion';
|
|
@@ -15,30 +14,28 @@ var enteringStyles = css({
|
|
|
15
14
|
position: 'static',
|
|
16
15
|
zIndex: 2
|
|
17
16
|
});
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* __Loading items__
|
|
20
20
|
*
|
|
21
21
|
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
23
|
var LoadingItems = function LoadingItems(_ref) {
|
|
25
24
|
var children = _ref.children,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
isLoading = _ref.isLoading,
|
|
26
|
+
fallback = _ref.fallback,
|
|
27
|
+
testId = _ref.testId;
|
|
30
28
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
33
30
|
if (!shouldRender) {
|
|
34
31
|
return children;
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
return jsx(ExitingPersistence, null, jsx(FadeIn, {
|
|
38
34
|
key: "loading-section-".concat(isLoading),
|
|
39
35
|
duration: mediumDurationMs
|
|
40
36
|
}, function (motion, state) {
|
|
41
|
-
return (
|
|
37
|
+
return (
|
|
38
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
42
39
|
jsx("span", _extends({}, motion, {
|
|
43
40
|
"data-testid": testId && "".concat(testId, "--").concat(state),
|
|
44
41
|
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
@@ -46,5 +43,4 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
46
43
|
);
|
|
47
44
|
}));
|
|
48
45
|
};
|
|
49
|
-
|
|
50
46
|
export default LoadingItems;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/use-primitives */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { forwardRef } from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
6
5
|
import useScrollbarWidth from '@atlaskit/ds-lib/use-scrollbar-width';
|
|
7
6
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
8
7
|
import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* __Navigation content__
|
|
12
10
|
*
|
|
@@ -17,18 +15,14 @@ import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
|
17
15
|
*/
|
|
18
16
|
var NavigationContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
17
|
var showTopScrollIndicator = props.showTopScrollIndicator,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
children = props.children,
|
|
19
|
+
testId = props.testId;
|
|
23
20
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
26
22
|
var scrollbar = useScrollbarWidth();
|
|
27
|
-
|
|
28
23
|
if (!shouldRender) {
|
|
29
24
|
return children;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
var typedRef = ref;
|
|
33
27
|
return jsx("div", {
|
|
34
28
|
ref: typedRef,
|