@atlaskit/side-navigation 1.4.2 → 1.5.0
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 +20 -0
- package/dist/cjs/common/styles.js +11 -16
- package/dist/cjs/components/Footer/index.js +27 -15
- package/dist/cjs/components/Header/index.js +57 -18
- package/dist/cjs/components/Item/skeleton-item.js +13 -7
- package/dist/cjs/components/LoadingItems/index.js +6 -4
- package/dist/cjs/components/NavigationContent/index.js +8 -3
- package/dist/cjs/components/NavigationContent/styles.js +9 -11
- package/dist/cjs/components/NavigationFooter/index.js +11 -9
- package/dist/cjs/components/NavigationHeader/index.js +10 -10
- package/dist/cjs/components/NestableNavigationContent/index.js +29 -25
- package/dist/cjs/components/NestingItem/index.js +15 -16
- package/dist/cjs/components/Section/heading-item.js +1 -1
- package/dist/cjs/components/Section/section.js +1 -1
- package/dist/cjs/components/Section/skeleton-heading-item.js +7 -4
- package/dist/cjs/components/SideNavigation/index.js +10 -9
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/styles.js +11 -14
- package/dist/es2019/components/Footer/index.js +24 -14
- package/dist/es2019/components/Header/index.js +41 -5
- package/dist/es2019/components/Item/skeleton-item.js +7 -7
- package/dist/es2019/components/LoadingItems/index.js +2 -1
- package/dist/es2019/components/NavigationContent/index.js +8 -3
- package/dist/es2019/components/NavigationContent/styles.js +9 -11
- package/dist/es2019/components/NavigationFooter/index.js +10 -10
- package/dist/es2019/components/NavigationHeader/index.js +9 -11
- package/dist/es2019/components/NestableNavigationContent/index.js +26 -23
- package/dist/es2019/components/NestingItem/index.js +16 -16
- package/dist/es2019/components/Section/heading-item.js +2 -2
- package/dist/es2019/components/Section/section.js +2 -2
- package/dist/es2019/components/Section/skeleton-heading-item.js +2 -4
- package/dist/es2019/components/SideNavigation/index.js +10 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/styles.js +11 -14
- package/dist/esm/components/Footer/index.js +25 -14
- package/dist/esm/components/Header/index.js +54 -16
- package/dist/esm/components/Item/skeleton-item.js +14 -8
- package/dist/esm/components/LoadingItems/index.js +6 -4
- package/dist/esm/components/NavigationContent/index.js +8 -3
- package/dist/esm/components/NavigationContent/styles.js +9 -11
- package/dist/esm/components/NavigationFooter/index.js +10 -10
- package/dist/esm/components/NavigationHeader/index.js +9 -11
- package/dist/esm/components/NestableNavigationContent/index.js +29 -25
- package/dist/esm/components/NestingItem/index.js +16 -16
- package/dist/esm/components/Section/heading-item.js +2 -2
- package/dist/esm/components/Section/section.js +2 -2
- package/dist/esm/components/Section/skeleton-heading-item.js +8 -5
- package/dist/esm/components/SideNavigation/index.js +10 -8
- package/dist/esm/version.json +1 -1
- package/dist/types/common/styles.d.ts +1 -2
- package/dist/types/components/Footer/index.d.ts +4 -4
- package/dist/types/components/Header/index.d.ts +6 -0
- package/dist/types/components/Item/skeleton-item.d.ts +1 -1
- package/dist/types/components/NavigationContent/styles.d.ts +4 -4
- package/docs/00-intro.tsx +1 -0
- package/package.json +11 -4
- package/report.api.md +2 -1
|
@@ -2,29 +2,22 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { Fragment, useCallback, useMemo, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
6
7
|
import RightArrow from '@atlaskit/icon/glyph/arrow-right-circle';
|
|
7
8
|
import { N10 } from '@atlaskit/theme/colors';
|
|
8
|
-
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
9
|
import { overrideStyleFunction } from '../../common/styles';
|
|
10
10
|
import { ButtonItem, CustomItem, NavigationContent } from '../index';
|
|
11
11
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
12
12
|
import { NestedContext, useNestedContext } from '../NestableNavigationContent/context';
|
|
13
13
|
import { useChildIdsEffect } from '../utils/hooks';
|
|
14
14
|
import { nestingItemStyle } from './styles';
|
|
15
|
-
|
|
16
|
-
marginRight: gridSize(),
|
|
17
|
-
marginLeft: gridSize(),
|
|
18
|
-
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
19
|
-
paddingTop: gridSize() * 0.75,
|
|
20
|
-
paddingBottom: gridSize() * 0.75
|
|
21
|
-
});
|
|
15
|
+
|
|
22
16
|
/**
|
|
23
17
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
24
18
|
* When not open - it will render itself as an item.
|
|
25
19
|
* When open - it will render its children.
|
|
26
20
|
*/
|
|
27
|
-
|
|
28
21
|
const NestingItem = props => {
|
|
29
22
|
const {
|
|
30
23
|
children,
|
|
@@ -91,8 +84,11 @@ const NestingItem = props => {
|
|
|
91
84
|
if (currentStackId === id) {
|
|
92
85
|
return jsx(NestedContext.Provider, {
|
|
93
86
|
value: context
|
|
94
|
-
}, stack.length >= 1 && jsx(
|
|
95
|
-
|
|
87
|
+
}, stack.length >= 1 && jsx(Box, {
|
|
88
|
+
as: "div",
|
|
89
|
+
display: "block",
|
|
90
|
+
paddingBlock: "scale.075",
|
|
91
|
+
paddingInline: "scale.100"
|
|
96
92
|
}, backButton), jsx(NavigationContent, {
|
|
97
93
|
testId: testId,
|
|
98
94
|
showTopScrollIndicator: stack.length >= 1
|
|
@@ -104,10 +100,14 @@ const NestingItem = props => {
|
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
const componentProps = {
|
|
107
|
-
iconAfter: jsx(Fragment, null, iconAfter ? jsx(
|
|
108
|
-
"data-custom-icon": true
|
|
109
|
-
|
|
110
|
-
"
|
|
103
|
+
iconAfter: jsx(Fragment, null, iconAfter ? jsx(Box, {
|
|
104
|
+
"data-custom-icon": true,
|
|
105
|
+
display: "inline",
|
|
106
|
+
as: "span"
|
|
107
|
+
}, iconAfter) : null, jsx(Box, {
|
|
108
|
+
"data-right-arrow": true,
|
|
109
|
+
display: "inline",
|
|
110
|
+
as: "span"
|
|
111
111
|
}, jsx(RightArrow, {
|
|
112
112
|
testId: testId && `${testId}--item--right-arrow`,
|
|
113
113
|
secondaryColor: `var(--ds-surface, ${N10})`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HeadingItem as MenuHeadingItem } from '@atlaskit/menu';
|
|
4
|
-
import { overrideStyleFunction,
|
|
4
|
+
import { overrideStyleFunction, sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -19,7 +19,7 @@ const HeadingItem = props => {
|
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const cssFn = overrideStyleFunction(
|
|
22
|
+
const cssFn = overrideStyleFunction(sectionHeaderSpacingStyles, 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
|
|
23
23
|
|
|
24
24
|
return /*#__PURE__*/React.createElement(MenuHeadingItem, _extends({}, props, {
|
|
25
25
|
cssFn: cssFn
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Section as MenuSection } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
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
7
|
|
|
@@ -28,7 +28,7 @@ const Section = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28
28
|
,
|
|
29
29
|
overrides: {
|
|
30
30
|
HeadingItem: {
|
|
31
|
-
cssFn:
|
|
31
|
+
cssFn: sectionHeaderSpacingStyles
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
4
|
+
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -22,9 +22,7 @@ const SkeletonHeadingItem = props => {
|
|
|
22
22
|
|
|
23
23
|
return /*#__PURE__*/React.createElement(MenuSkeletonHeadingItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
24
24
|
, _extends({
|
|
25
|
-
cssFn: () => ({
|
|
26
|
-
paddingLeft: ITEM_SIDE_PADDING,
|
|
27
|
-
paddingRight: ITEM_SIDE_PADDING
|
|
25
|
+
cssFn: () => ({ ...sectionHeaderSpacingStyles()
|
|
28
26
|
}) // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
29
27
|
|
|
30
28
|
}, props));
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N10, N500 } from '@atlaskit/theme/colors';
|
|
5
|
-
|
|
5
|
+
const sidebarMinWidth = '240px';
|
|
6
6
|
const sideNavStyles = css({
|
|
7
7
|
display: 'flex',
|
|
8
8
|
width: '100%',
|
|
9
|
-
minWidth:
|
|
9
|
+
minWidth: sidebarMinWidth,
|
|
10
10
|
height: '100%',
|
|
11
11
|
position: 'relative',
|
|
12
12
|
flexDirection: 'column',
|
|
@@ -30,11 +30,13 @@ const SideNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
30
30
|
testId,
|
|
31
31
|
label
|
|
32
32
|
} = props;
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
34
|
+
jsx("nav", {
|
|
35
|
+
ref: ref,
|
|
36
|
+
"data-testid": testId,
|
|
37
|
+
"aria-label": label,
|
|
38
|
+
css: sideNavStyles
|
|
39
|
+
}, children)
|
|
40
|
+
);
|
|
39
41
|
});
|
|
40
42
|
export default SideNavigation;
|
package/dist/es2019/version.json
CHANGED
|
@@ -4,13 +4,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
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
6
|
|
|
7
|
-
import { B400, B50,
|
|
8
|
-
import { borderRadius as borderRadiusFn
|
|
9
|
-
var gridSize = gridSizeFn();
|
|
7
|
+
import { B400, B50, N30, N500 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { borderRadius as borderRadiusFn } from '@atlaskit/theme/constants';
|
|
10
9
|
var borderRadius = borderRadiusFn();
|
|
11
|
-
var itemIconSize = gridSize * 3;
|
|
12
|
-
var leftIconRightSpacing = gridSize * 2;
|
|
13
|
-
export var ITEM_SIDE_PADDING = gridSize * 1.25;
|
|
14
10
|
/**
|
|
15
11
|
* Allows chaining of style functions on top of base style functions
|
|
16
12
|
* @param baseStyle the base custom cssFn
|
|
@@ -58,26 +54,27 @@ export var baseSideNavItemStyle = function baseSideNavItemStyle(_ref) {
|
|
|
58
54
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
59
55
|
// This padding is set to ensure that the center of the left icon
|
|
60
56
|
// is approximately center aligned with the horizontal app switcher.
|
|
61
|
-
padding: "".concat(
|
|
57
|
+
padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 10px)"),
|
|
62
58
|
borderRadius: borderRadius,
|
|
63
59
|
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
64
60
|
// Menu and side navigation are now color aligned so they do not need this!
|
|
65
61
|
// See: https://product-fabric.atlassian.net/browse/DSP-1684
|
|
66
|
-
backgroundColor: "var(--ds-
|
|
62
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)"
|
|
67
63
|
}, !isDisabled && !isSelected && defaultStyles), !isDisabled && isSelected && selectedStyles), {}, _defineProperty({}, '& [data-item-elem-before]', {
|
|
68
64
|
// TODO: Can this be moved into menu?
|
|
69
65
|
// center align icons with app-switcher regardless of size
|
|
70
66
|
display: 'flex',
|
|
71
|
-
height:
|
|
72
|
-
width:
|
|
67
|
+
height: "var(--ds-scale-300, 24px)",
|
|
68
|
+
width: "var(--ds-scale-300, 24px)",
|
|
73
69
|
alignItems: 'center',
|
|
74
70
|
justifyContent: 'center',
|
|
75
|
-
|
|
71
|
+
// this margin could be removed if the respective item had a more
|
|
72
|
+
// compositional API so an Inline could be used to separate elements instead
|
|
73
|
+
marginRight: "var(--ds-scale-200, 16px)"
|
|
76
74
|
}));
|
|
77
75
|
};
|
|
78
|
-
export var
|
|
76
|
+
export var sectionHeaderSpacingStyles = function sectionHeaderSpacingStyles() {
|
|
79
77
|
return {
|
|
80
|
-
|
|
81
|
-
paddingRight: "".concat(ITEM_SIDE_PADDING, "px")
|
|
78
|
+
paddingInline: "var(--ds-scale-100, 10px)"
|
|
82
79
|
};
|
|
83
80
|
};
|
|
@@ -2,15 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { N500 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { overrideStyleFunction } from '../../common/styles';
|
|
5
|
+
import { Container } from '../Header';
|
|
5
6
|
import { CustomItem } from '../Item';
|
|
6
7
|
|
|
7
|
-
var Container = function Container(props) {
|
|
8
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
9
|
-
return /*#__PURE__*/React.createElement("div", props);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
8
|
/**
|
|
13
|
-
*
|
|
9
|
+
* __Footer__
|
|
14
10
|
*
|
|
15
11
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
16
12
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -25,8 +21,8 @@ var Footer = function Footer(props) {
|
|
|
25
21
|
alignItems: 'center',
|
|
26
22
|
width: '100%',
|
|
27
23
|
'[data-item-elem-before]': {
|
|
28
|
-
marginRight: 0,
|
|
29
|
-
marginBottom:
|
|
24
|
+
marginRight: "var(--ds-scale-0, 0px)",
|
|
25
|
+
marginBottom: "var(--ds-scale-100, 8px)",
|
|
30
26
|
display: 'inline-block'
|
|
31
27
|
},
|
|
32
28
|
'[data-item-title]': {
|
|
@@ -36,21 +32,36 @@ var Footer = function Footer(props) {
|
|
|
36
32
|
'[data-item-description]': {
|
|
37
33
|
textAlign: 'center',
|
|
38
34
|
display: 'inline-block',
|
|
39
|
-
margin:
|
|
35
|
+
margin: "var(--ds-scale-075, 6px)"
|
|
40
36
|
},
|
|
41
37
|
// Will look interactive if the `component` is anything other than a div.
|
|
42
38
|
'div&:hover': {
|
|
43
|
-
backgroundColor:
|
|
39
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
44
40
|
cursor: 'default'
|
|
45
41
|
},
|
|
46
42
|
'div&:active': {
|
|
47
|
-
backgroundColor:
|
|
43
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
48
44
|
color: "var(--ds-text-subtle, ".concat(N500, ")")
|
|
49
45
|
}
|
|
50
46
|
};
|
|
51
|
-
}, props.cssFn);
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
}, props.cssFn); // https://stackoverflow.com/a/39333479
|
|
48
|
+
|
|
49
|
+
var safeProps = function (_ref) {
|
|
50
|
+
var iconBefore = _ref.iconBefore,
|
|
51
|
+
onClick = _ref.onClick,
|
|
52
|
+
description = _ref.description,
|
|
53
|
+
children = _ref.children,
|
|
54
|
+
testId = _ref.testId;
|
|
55
|
+
return {
|
|
56
|
+
iconBefore: iconBefore,
|
|
57
|
+
onClick: onClick,
|
|
58
|
+
description: description,
|
|
59
|
+
children: children,
|
|
60
|
+
testId: testId
|
|
61
|
+
};
|
|
62
|
+
}(props);
|
|
63
|
+
|
|
64
|
+
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, safeProps, {
|
|
54
65
|
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
55
66
|
,
|
|
56
67
|
cssFn: cssFn
|
|
@@ -1,16 +1,54 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
var _excluded = ["children"],
|
|
5
|
+
_excluded2 = ["children"];
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @repo/internal/react/use-primitives */
|
|
5
8
|
import React, { forwardRef } from 'react';
|
|
9
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
6
10
|
import { N500 } from '@atlaskit/theme/colors';
|
|
7
11
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
8
12
|
import { overrideStyleFunction } from '../../common/styles';
|
|
9
13
|
import { CustomItem } from '../Item';
|
|
14
|
+
/**
|
|
15
|
+
* __Container__
|
|
16
|
+
*
|
|
17
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export var Container = function Container(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
|
|
24
|
+
// https://stackoverflow.com/a/39333479
|
|
25
|
+
var safeProps = function (_ref2) {
|
|
26
|
+
var className = _ref2.className,
|
|
27
|
+
testId = _ref2['data-testid'],
|
|
28
|
+
onClick = _ref2.onClick,
|
|
29
|
+
onMouseDown = _ref2.onMouseDown,
|
|
30
|
+
onDragStart = _ref2.onDragStart,
|
|
31
|
+
draggable = _ref2.draggable,
|
|
32
|
+
ref = _ref2.ref,
|
|
33
|
+
tabIndex = _ref2.tabIndex,
|
|
34
|
+
disabled = _ref2.disabled;
|
|
35
|
+
return {
|
|
36
|
+
className: className,
|
|
37
|
+
testId: testId,
|
|
38
|
+
onClick: onClick,
|
|
39
|
+
onMouseDown: onMouseDown,
|
|
40
|
+
onDragStart: onDragStart,
|
|
41
|
+
draggable: draggable,
|
|
42
|
+
ref: ref,
|
|
43
|
+
tabIndex: tabIndex,
|
|
44
|
+
disabled: disabled
|
|
45
|
+
};
|
|
46
|
+
}(props);
|
|
10
47
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
48
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
49
|
+
as: "div",
|
|
50
|
+
display: "block"
|
|
51
|
+
}, safeProps), children);
|
|
14
52
|
};
|
|
15
53
|
|
|
16
54
|
/**
|
|
@@ -21,22 +59,22 @@ var Container = function Container(props) {
|
|
|
21
59
|
*/
|
|
22
60
|
var Header = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
61
|
var cssFn = overrideStyleFunction(function () {
|
|
24
|
-
var
|
|
62
|
+
var _ref3;
|
|
25
63
|
|
|
26
|
-
return
|
|
64
|
+
return _ref3 = {
|
|
27
65
|
userSelect: 'auto'
|
|
28
|
-
}, _defineProperty(
|
|
66
|
+
}, _defineProperty(_ref3, '[data-item-title]', {
|
|
29
67
|
fontSize: headingSizes.h400.size,
|
|
30
68
|
letterSpacing: '-0.003em',
|
|
31
69
|
fontWeight: 600,
|
|
32
70
|
color: "var(--ds-text, ".concat(N500, ")")
|
|
33
|
-
}), _defineProperty(
|
|
34
|
-
backgroundColor:
|
|
71
|
+
}), _defineProperty(_ref3, 'div&:hover', {
|
|
72
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
35
73
|
cursor: 'default'
|
|
36
|
-
}), _defineProperty(
|
|
37
|
-
backgroundColor:
|
|
74
|
+
}), _defineProperty(_ref3, 'div&:active', {
|
|
75
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
38
76
|
color: "var(--ds-text, ".concat(N500, ")")
|
|
39
|
-
}),
|
|
77
|
+
}), _ref3;
|
|
40
78
|
}, props.cssFn);
|
|
41
79
|
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
42
80
|
ref: ref,
|
|
@@ -46,9 +84,9 @@ var Header = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
46
84
|
,
|
|
47
85
|
overrides: {
|
|
48
86
|
Title: {
|
|
49
|
-
render: function render(_,
|
|
50
|
-
var children =
|
|
51
|
-
props = _objectWithoutProperties(
|
|
87
|
+
render: function render(_, _ref4) {
|
|
88
|
+
var children = _ref4.children,
|
|
89
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
52
90
|
|
|
53
91
|
return /*#__PURE__*/React.createElement("h2", props, children);
|
|
54
92
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
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
|
+
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
|
+
|
|
2
8
|
import React from 'react';
|
|
3
9
|
import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
10
|
+
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
11
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* __Skeleton item__
|
|
9
15
|
*
|
|
10
|
-
* A skeleton item can be used to reduce the perceived
|
|
16
|
+
* A skeleton item can be used to reduce the perceived loading time.
|
|
11
17
|
*
|
|
12
18
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
13
19
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -23,14 +29,14 @@ var SkeletonItem = function SkeletonItem(props) {
|
|
|
23
29
|
return /*#__PURE__*/React.createElement(SkelItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
24
30
|
, _extends({
|
|
25
31
|
cssFn: function cssFn() {
|
|
26
|
-
return {
|
|
27
|
-
|
|
28
|
-
paddingRight: ITEM_SIDE_PADDING,
|
|
32
|
+
return _objectSpread(_objectSpread({}, sectionHeaderSpacingStyles()), {}, {
|
|
33
|
+
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
29
34
|
'&&::before': {
|
|
30
|
-
|
|
31
|
-
marginRight:
|
|
35
|
+
height: "var(--ds-scale-300, 20px)",
|
|
36
|
+
marginRight: "var(--ds-scale-200, 18px)",
|
|
37
|
+
width: "var(--ds-scale-300, 20px)"
|
|
32
38
|
}
|
|
33
|
-
};
|
|
39
|
+
});
|
|
34
40
|
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
35
41
|
|
|
36
42
|
}, props));
|
|
@@ -38,10 +38,12 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
38
38
|
key: "loading-section-".concat(isLoading),
|
|
39
39
|
duration: mediumDurationMs
|
|
40
40
|
}, function (motion, state) {
|
|
41
|
-
return
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
42
|
+
jsx("span", _extends({}, motion, {
|
|
43
|
+
"data-testid": testId && "".concat(testId, "--").concat(state),
|
|
44
|
+
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
45
|
+
}), isLoading ? fallback : children)
|
|
46
|
+
);
|
|
45
47
|
}));
|
|
46
48
|
};
|
|
47
49
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/use-primitives */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { forwardRef } from 'react';
|
|
3
5
|
import { jsx } from '@emotion/react';
|
|
@@ -15,7 +17,8 @@ import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
|
15
17
|
*/
|
|
16
18
|
var NavigationContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
19
|
var showTopScrollIndicator = props.showTopScrollIndicator,
|
|
18
|
-
children = props.children
|
|
20
|
+
children = props.children,
|
|
21
|
+
testId = props.testId;
|
|
19
22
|
|
|
20
23
|
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
21
24
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -26,12 +29,14 @@ var NavigationContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
26
29
|
return children;
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
var typedRef = ref;
|
|
29
33
|
return jsx("div", {
|
|
30
|
-
ref:
|
|
34
|
+
ref: typedRef,
|
|
31
35
|
css: outerContainerCSS({
|
|
32
36
|
showTopScrollIndicator: showTopScrollIndicator,
|
|
33
37
|
scrollbarWidth: scrollbar.width
|
|
34
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
"data-testid": testId
|
|
35
40
|
}, jsx("div", {
|
|
36
41
|
ref: scrollbar.ref,
|
|
37
42
|
css: innerContainerCSS({
|
|
@@ -13,17 +13,15 @@ var scrollIndicatorZIndex = 1;
|
|
|
13
13
|
var scrollIndicatorHeight = 2;
|
|
14
14
|
var scrollIndicatorBorderRadius = 1;
|
|
15
15
|
var containerPadding = gridSize();
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
17
|
+
var skeletonHeadingHeight = containerPadding;
|
|
18
|
+
var skeletonHeadingMarginOffset = 3; // Skeleton content is slightly shorter than the real content.
|
|
18
19
|
// Because of that we slightly increase the top margin to offset this so the
|
|
19
20
|
// containing size both real and skeleton always equal approx 30px.
|
|
20
21
|
|
|
21
|
-
var
|
|
22
|
-
var skeletonHeadingHeight = containerPadding;
|
|
23
|
-
var skeletonHeadingMarginOffset = 3;
|
|
24
|
-
var skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset; // We want to move the entire body up by 3px without affecting the height of the skeleton container.
|
|
22
|
+
var skeletonHeadingTopMargin = containerPadding * 2.5 + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset; // We want to move the entire body up by 3px without affecting the height of the skeleton container.
|
|
25
23
|
|
|
26
|
-
var skeletonHeadingBottomMargin =
|
|
24
|
+
var skeletonHeadingBottomMargin = containerPadding * 0.75 + skeletonHeadingMarginOffset;
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* This outer container css contains the "real" scroll indicators which are
|
|
@@ -113,13 +111,13 @@ export var containerCSS = function containerCSS(opts) {
|
|
|
113
111
|
// so the spacing between matches what it would be if the indicator was a "block" element.
|
|
114
112
|
// We use margin here so any child absolutely positioned elements are positioned correctly.
|
|
115
113
|
marginTop: opts.showTopScrollIndicator ? scrollIndicatorHeight : 0,
|
|
116
|
-
marginLeft:
|
|
117
|
-
marginRight:
|
|
114
|
+
marginLeft: "var(--ds-scale-100, 8px)",
|
|
115
|
+
marginRight: "var(--ds-scale-100, 8px)",
|
|
118
116
|
// Enables child absolutely positioned elements to be positioned relative to this element.
|
|
119
117
|
position: 'relative',
|
|
120
118
|
'& [data-ds--menu--heading-item]': {
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
marginBottom: "var(--ds-scale-075, 6px)",
|
|
120
|
+
marginTop: "var(--ds-scale-200, 20px)"
|
|
123
121
|
},
|
|
124
122
|
'& [data-ds--menu--skeleton-heading-item]': {
|
|
125
123
|
marginTop: skeletonHeadingTopMargin,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
padding: gridSize(),
|
|
6
|
-
paddingBottom: gridSize() * 1.75,
|
|
7
|
-
position: 'relative'
|
|
8
|
-
});
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
4
|
+
|
|
9
5
|
/**
|
|
10
6
|
* __Navigation footer__
|
|
11
7
|
*
|
|
@@ -14,11 +10,15 @@ var footerStyles = css({
|
|
|
14
10
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
15
11
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
13
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
19
14
|
var children = _ref.children;
|
|
20
|
-
return jsx(
|
|
21
|
-
|
|
15
|
+
return jsx(Box, {
|
|
16
|
+
display: "block",
|
|
17
|
+
position: "relative",
|
|
18
|
+
padding: "scale.100",
|
|
19
|
+
UNSAFE_style: {
|
|
20
|
+
paddingBottom: "var(--ds-scale-200, 14px)"
|
|
21
|
+
}
|
|
22
22
|
}, children);
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
paddingTop: gridSize() * 3,
|
|
6
|
-
paddingRight: gridSize(),
|
|
7
|
-
paddingBottom: gridSize(),
|
|
8
|
-
paddingLeft: gridSize()
|
|
9
|
-
});
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
4
|
+
|
|
10
5
|
/**
|
|
11
6
|
* __Navigation header__
|
|
12
7
|
*
|
|
@@ -15,12 +10,15 @@ var navigationHeaderStyles = css({
|
|
|
15
10
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
16
11
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
17
12
|
*/
|
|
18
|
-
|
|
19
13
|
var NavigationHeader = function NavigationHeader(props) {
|
|
20
14
|
var children = props.children;
|
|
21
|
-
return jsx(
|
|
15
|
+
return jsx(Box, {
|
|
16
|
+
display: "block",
|
|
22
17
|
"data-navheader": true,
|
|
23
|
-
|
|
18
|
+
padding: "scale.100",
|
|
19
|
+
UNSAFE_style: {
|
|
20
|
+
paddingTop: "var(--ds-scale-300, 24px)"
|
|
21
|
+
}
|
|
24
22
|
}, children);
|
|
25
23
|
};
|
|
26
24
|
|