@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
|
@@ -23,12 +23,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
23
23
|
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
25
|
|
|
26
|
+
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
27
|
+
|
|
26
28
|
var _arrowRightCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-right-circle"));
|
|
27
29
|
|
|
28
30
|
var _colors = require("@atlaskit/theme/colors");
|
|
29
31
|
|
|
30
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
31
|
-
|
|
32
32
|
var _styles = require("../../common/styles");
|
|
33
33
|
|
|
34
34
|
var _index = require("../index");
|
|
@@ -51,19 +51,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
51
51
|
|
|
52
52
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
53
|
|
|
54
|
-
var nestingItemStyles = (0, _react2.css)({
|
|
55
|
-
marginRight: (0, _constants.gridSize)(),
|
|
56
|
-
marginLeft: (0, _constants.gridSize)(),
|
|
57
|
-
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
58
|
-
paddingTop: (0, _constants.gridSize)() * 0.75,
|
|
59
|
-
paddingBottom: (0, _constants.gridSize)() * 0.75
|
|
60
|
-
});
|
|
61
54
|
/**
|
|
62
55
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
63
56
|
* When not open - it will render itself as an item.
|
|
64
57
|
* When open - it will render its children.
|
|
65
58
|
*/
|
|
66
|
-
|
|
67
59
|
var NestingItem = function NestingItem(props) {
|
|
68
60
|
var children = props.children,
|
|
69
61
|
iconAfter = props.iconAfter,
|
|
@@ -138,8 +130,11 @@ var NestingItem = function NestingItem(props) {
|
|
|
138
130
|
if (currentStackId === id) {
|
|
139
131
|
return (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
140
132
|
value: context
|
|
141
|
-
}, stack.length >= 1 && (0, _react2.jsx)(
|
|
142
|
-
|
|
133
|
+
}, stack.length >= 1 && (0, _react2.jsx)(_box.default, {
|
|
134
|
+
as: "div",
|
|
135
|
+
display: "block",
|
|
136
|
+
paddingBlock: "scale.075",
|
|
137
|
+
paddingInline: "scale.100"
|
|
143
138
|
}, backButton), (0, _react2.jsx)(_index.NavigationContent, {
|
|
144
139
|
testId: testId,
|
|
145
140
|
showTopScrollIndicator: stack.length >= 1
|
|
@@ -151,10 +146,14 @@ var NestingItem = function NestingItem(props) {
|
|
|
151
146
|
}
|
|
152
147
|
|
|
153
148
|
var componentProps = _objectSpread(_objectSpread({
|
|
154
|
-
iconAfter: (0, _react2.jsx)(_react.Fragment, null, iconAfter ? (0, _react2.jsx)(
|
|
155
|
-
"data-custom-icon": true
|
|
156
|
-
|
|
157
|
-
"
|
|
149
|
+
iconAfter: (0, _react2.jsx)(_react.Fragment, null, iconAfter ? (0, _react2.jsx)(_box.default, {
|
|
150
|
+
"data-custom-icon": true,
|
|
151
|
+
display: "inline",
|
|
152
|
+
as: "span"
|
|
153
|
+
}, iconAfter) : null, (0, _react2.jsx)(_box.default, {
|
|
154
|
+
"data-right-arrow": true,
|
|
155
|
+
display: "inline",
|
|
156
|
+
as: "span"
|
|
158
157
|
}, (0, _react2.jsx)(_arrowRightCircle.default, {
|
|
159
158
|
testId: testId && "".concat(testId, "--item--right-arrow"),
|
|
160
159
|
secondaryColor: "var(--ds-surface, ".concat(_colors.N10, ")"),
|
|
@@ -31,7 +31,7 @@ var HeadingItem = function HeadingItem(props) {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
var cssFn = (0, _styles.overrideStyleFunction)(_styles.
|
|
34
|
+
var cssFn = (0, _styles.overrideStyleFunction)(_styles.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
|
|
35
35
|
|
|
36
36
|
return /*#__PURE__*/_react.default.createElement(_menu.HeadingItem, (0, _extends2.default)({}, props, {
|
|
37
37
|
cssFn: cssFn
|
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
14
16
|
var _menu = require("@atlaskit/menu");
|
|
@@ -17,6 +19,10 @@ var _styles = require("../../common/styles");
|
|
|
17
19
|
|
|
18
20
|
var _context = require("../NestableNavigationContent/context");
|
|
19
21
|
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
27
|
* __Skeleton heading item__
|
|
22
28
|
*
|
|
@@ -35,10 +41,7 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(props) {
|
|
|
35
41
|
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonHeadingItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
36
42
|
, (0, _extends2.default)({
|
|
37
43
|
cssFn: function cssFn() {
|
|
38
|
-
return {
|
|
39
|
-
paddingLeft: _styles.ITEM_SIDE_PADDING,
|
|
40
|
-
paddingRight: _styles.ITEM_SIDE_PADDING
|
|
41
|
-
};
|
|
44
|
+
return _objectSpread({}, (0, _styles.sectionHeaderSpacingStyles)());
|
|
42
45
|
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
43
46
|
|
|
44
47
|
}, props));
|
|
@@ -11,13 +11,12 @@ var _react2 = require("@emotion/react");
|
|
|
11
11
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
|
|
14
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
15
|
-
|
|
16
14
|
/** @jsx jsx */
|
|
15
|
+
var sidebarMinWidth = '240px';
|
|
17
16
|
var sideNavStyles = (0, _react2.css)({
|
|
18
17
|
display: 'flex',
|
|
19
18
|
width: '100%',
|
|
20
|
-
minWidth:
|
|
19
|
+
minWidth: sidebarMinWidth,
|
|
21
20
|
height: '100%',
|
|
22
21
|
position: 'relative',
|
|
23
22
|
flexDirection: 'column',
|
|
@@ -39,12 +38,14 @@ var SideNavigation = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
39
38
|
var children = props.children,
|
|
40
39
|
testId = props.testId,
|
|
41
40
|
label = props.label;
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
42
|
+
(0, _react2.jsx)("nav", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
"data-testid": testId,
|
|
45
|
+
"aria-label": label,
|
|
46
|
+
css: sideNavStyles
|
|
47
|
+
}, children)
|
|
48
|
+
);
|
|
48
49
|
});
|
|
49
50
|
var _default = SideNavigation;
|
|
50
51
|
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { B400, B50,
|
|
2
|
-
import { borderRadius as borderRadiusFn
|
|
3
|
-
const gridSize = gridSizeFn();
|
|
1
|
+
import { B400, B50, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { borderRadius as borderRadiusFn } from '@atlaskit/theme/constants';
|
|
4
3
|
const borderRadius = borderRadiusFn();
|
|
5
|
-
const itemIconSize = gridSize * 3;
|
|
6
|
-
const leftIconRightSpacing = gridSize * 2;
|
|
7
|
-
export const ITEM_SIDE_PADDING = gridSize * 1.25;
|
|
8
4
|
/**
|
|
9
5
|
* Allows chaining of style functions on top of base style functions
|
|
10
6
|
* @param baseStyle the base custom cssFn
|
|
@@ -50,12 +46,12 @@ export const baseSideNavItemStyle = ({
|
|
|
50
46
|
return {
|
|
51
47
|
// This padding is set to ensure that the center of the left icon
|
|
52
48
|
// is approximately center aligned with the horizontal app switcher.
|
|
53
|
-
padding: `${
|
|
49
|
+
padding: `${"var(--ds-scale-100, 8px)"} ${"var(--ds-scale-100, 10px)"}`,
|
|
54
50
|
borderRadius,
|
|
55
51
|
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
56
52
|
// Menu and side navigation are now color aligned so they do not need this!
|
|
57
53
|
// See: https://product-fabric.atlassian.net/browse/DSP-1684
|
|
58
|
-
backgroundColor:
|
|
54
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
59
55
|
...(!isDisabled && !isSelected && defaultStyles),
|
|
60
56
|
...(!isDisabled && isSelected && selectedStyles),
|
|
61
57
|
// -- END TODO --------------------------------------------------------------
|
|
@@ -63,17 +59,18 @@ export const baseSideNavItemStyle = ({
|
|
|
63
59
|
// TODO: Can this be moved into menu?
|
|
64
60
|
// center align icons with app-switcher regardless of size
|
|
65
61
|
display: 'flex',
|
|
66
|
-
height:
|
|
67
|
-
width:
|
|
62
|
+
height: "var(--ds-scale-300, 24px)",
|
|
63
|
+
width: "var(--ds-scale-300, 24px)",
|
|
68
64
|
alignItems: 'center',
|
|
69
65
|
justifyContent: 'center',
|
|
70
|
-
|
|
66
|
+
// this margin could be removed if the respective item had a more
|
|
67
|
+
// compositional API so an Inline could be used to separate elements instead
|
|
68
|
+
marginRight: "var(--ds-scale-200, 16px)"
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
71
|
};
|
|
74
|
-
export const
|
|
72
|
+
export const sectionHeaderSpacingStyles = () => {
|
|
75
73
|
return {
|
|
76
|
-
|
|
77
|
-
paddingRight: `${ITEM_SIDE_PADDING}px`
|
|
74
|
+
paddingInline: "var(--ds-scale-100, 10px)"
|
|
78
75
|
};
|
|
79
76
|
};
|
|
@@ -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
|
-
const 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)
|
|
@@ -24,8 +20,8 @@ const Footer = props => {
|
|
|
24
20
|
alignItems: 'center',
|
|
25
21
|
width: '100%',
|
|
26
22
|
'[data-item-elem-before]': {
|
|
27
|
-
marginRight: 0,
|
|
28
|
-
marginBottom:
|
|
23
|
+
marginRight: "var(--ds-scale-0, 0px)",
|
|
24
|
+
marginBottom: "var(--ds-scale-100, 8px)",
|
|
29
25
|
display: 'inline-block'
|
|
30
26
|
},
|
|
31
27
|
'[data-item-title]': {
|
|
@@ -35,20 +31,34 @@ const Footer = props => {
|
|
|
35
31
|
'[data-item-description]': {
|
|
36
32
|
textAlign: 'center',
|
|
37
33
|
display: 'inline-block',
|
|
38
|
-
margin:
|
|
34
|
+
margin: "var(--ds-scale-075, 6px)"
|
|
39
35
|
},
|
|
40
36
|
// Will look interactive if the `component` is anything other than a div.
|
|
41
37
|
'div&:hover': {
|
|
42
|
-
backgroundColor:
|
|
38
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
43
39
|
cursor: 'default'
|
|
44
40
|
},
|
|
45
41
|
'div&:active': {
|
|
46
|
-
backgroundColor:
|
|
42
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
47
43
|
color: `var(--ds-text-subtle, ${N500})`
|
|
48
44
|
}
|
|
49
|
-
}), props.cssFn);
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
}), props.cssFn); // https://stackoverflow.com/a/39333479
|
|
46
|
+
|
|
47
|
+
const safeProps = (({
|
|
48
|
+
iconBefore,
|
|
49
|
+
onClick,
|
|
50
|
+
description,
|
|
51
|
+
children,
|
|
52
|
+
testId
|
|
53
|
+
}) => ({
|
|
54
|
+
iconBefore,
|
|
55
|
+
onClick,
|
|
56
|
+
description,
|
|
57
|
+
children,
|
|
58
|
+
testId
|
|
59
|
+
}))(props);
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, safeProps, {
|
|
52
62
|
component: props.component || Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
53
63
|
,
|
|
54
64
|
cssFn: cssFn
|
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @repo/internal/react/use-primitives */
|
|
2
4
|
import React, { forwardRef } from 'react';
|
|
5
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
3
6
|
import { N500 } from '@atlaskit/theme/colors';
|
|
4
7
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
5
8
|
import { overrideStyleFunction } from '../../common/styles';
|
|
6
9
|
import { CustomItem } from '../Item';
|
|
10
|
+
/**
|
|
11
|
+
* __Container__
|
|
12
|
+
*
|
|
13
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const Container = ({
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
// https://stackoverflow.com/a/39333479
|
|
21
|
+
const safeProps = (({
|
|
22
|
+
className,
|
|
23
|
+
'data-testid': testId,
|
|
24
|
+
onClick,
|
|
25
|
+
onMouseDown,
|
|
26
|
+
onDragStart,
|
|
27
|
+
draggable,
|
|
28
|
+
ref,
|
|
29
|
+
tabIndex,
|
|
30
|
+
disabled
|
|
31
|
+
}) => ({
|
|
32
|
+
className,
|
|
33
|
+
testId,
|
|
34
|
+
onClick,
|
|
35
|
+
onMouseDown,
|
|
36
|
+
onDragStart,
|
|
37
|
+
draggable,
|
|
38
|
+
ref,
|
|
39
|
+
tabIndex,
|
|
40
|
+
disabled
|
|
41
|
+
}))(props);
|
|
7
42
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
43
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
44
|
+
as: "div",
|
|
45
|
+
display: "block"
|
|
46
|
+
}, safeProps), children);
|
|
11
47
|
};
|
|
12
48
|
|
|
13
49
|
/**
|
|
@@ -27,11 +63,11 @@ const Header = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27
63
|
},
|
|
28
64
|
// Will look interactive if the `component` is anything other than a div.
|
|
29
65
|
'div&:hover': {
|
|
30
|
-
backgroundColor:
|
|
66
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
31
67
|
cursor: 'default'
|
|
32
68
|
},
|
|
33
69
|
'div&:active': {
|
|
34
|
-
backgroundColor:
|
|
70
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
35
71
|
color: `var(--ds-text, ${N500})`
|
|
36
72
|
}
|
|
37
73
|
}), props.cssFn);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
4
|
+
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* __Skeleton item__
|
|
9
9
|
*
|
|
10
|
-
* A skeleton item can be used to reduce the perceived
|
|
10
|
+
* A skeleton item can be used to reduce the perceived loading time.
|
|
11
11
|
*
|
|
12
12
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
13
13
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -23,12 +23,12 @@ const SkeletonItem = props => {
|
|
|
23
23
|
|
|
24
24
|
return /*#__PURE__*/React.createElement(SkelItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
25
25
|
, _extends({
|
|
26
|
-
cssFn: () => ({
|
|
27
|
-
|
|
28
|
-
paddingRight: ITEM_SIDE_PADDING,
|
|
26
|
+
cssFn: () => ({ ...sectionHeaderSpacingStyles(),
|
|
27
|
+
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
29
28
|
'&&::before': {
|
|
30
|
-
|
|
31
|
-
marginRight:
|
|
29
|
+
height: "var(--ds-scale-300, 20px)",
|
|
30
|
+
marginRight: "var(--ds-scale-200, 18px)",
|
|
31
|
+
width: "var(--ds-scale-300, 20px)"
|
|
32
32
|
}
|
|
33
33
|
}) // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
34
34
|
|
|
@@ -38,7 +38,8 @@ const LoadingItems = ({
|
|
|
38
38
|
return jsx(ExitingPersistence, null, jsx(FadeIn, {
|
|
39
39
|
key: `loading-section-${isLoading}`,
|
|
40
40
|
duration: mediumDurationMs
|
|
41
|
-
}, (motion, state) =>
|
|
41
|
+
}, (motion, state) => // eslint-disable-next-line @repo/internal/react/use-primitives
|
|
42
|
+
jsx("span", _extends({}, motion, {
|
|
42
43
|
"data-testid": testId && `${testId}--${state}`,
|
|
43
44
|
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
44
45
|
}), isLoading ? fallback : children)));
|
|
@@ -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';
|
|
@@ -16,7 +18,8 @@ import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
|
16
18
|
const NavigationContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
19
|
const {
|
|
18
20
|
showTopScrollIndicator,
|
|
19
|
-
children
|
|
21
|
+
children,
|
|
22
|
+
testId
|
|
20
23
|
} = props;
|
|
21
24
|
const {
|
|
22
25
|
shouldRender
|
|
@@ -27,12 +30,14 @@ const NavigationContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27
30
|
return children;
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
const typedRef = ref;
|
|
30
34
|
return jsx("div", {
|
|
31
|
-
ref:
|
|
35
|
+
ref: typedRef,
|
|
32
36
|
css: outerContainerCSS({
|
|
33
37
|
showTopScrollIndicator,
|
|
34
38
|
scrollbarWidth: scrollbar.width
|
|
35
|
-
})
|
|
39
|
+
}),
|
|
40
|
+
"data-testid": testId
|
|
36
41
|
}, jsx("div", {
|
|
37
42
|
ref: scrollbar.ref,
|
|
38
43
|
css: innerContainerCSS({
|
|
@@ -7,17 +7,15 @@ const scrollIndicatorZIndex = 1;
|
|
|
7
7
|
const scrollIndicatorHeight = 2;
|
|
8
8
|
const scrollIndicatorBorderRadius = 1;
|
|
9
9
|
const containerPadding = gridSize();
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
11
|
+
const skeletonHeadingHeight = containerPadding;
|
|
12
|
+
const skeletonHeadingMarginOffset = 3; // Skeleton content is slightly shorter than the real content.
|
|
12
13
|
// Because of that we slightly increase the top margin to offset this so the
|
|
13
14
|
// containing size both real and skeleton always equal approx 30px.
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
const skeletonHeadingHeight = containerPadding;
|
|
17
|
-
const skeletonHeadingMarginOffset = 3;
|
|
18
|
-
const skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset; // We want to move the entire body up by 3px without affecting the height of the skeleton container.
|
|
16
|
+
const 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.
|
|
19
17
|
|
|
20
|
-
const skeletonHeadingBottomMargin =
|
|
18
|
+
const skeletonHeadingBottomMargin = containerPadding * 0.75 + skeletonHeadingMarginOffset;
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* This outer container css contains the "real" scroll indicators which are
|
|
@@ -104,13 +102,13 @@ export const containerCSS = opts => ({
|
|
|
104
102
|
// so the spacing between matches what it would be if the indicator was a "block" element.
|
|
105
103
|
// We use margin here so any child absolutely positioned elements are positioned correctly.
|
|
106
104
|
marginTop: opts.showTopScrollIndicator ? scrollIndicatorHeight : 0,
|
|
107
|
-
marginLeft:
|
|
108
|
-
marginRight:
|
|
105
|
+
marginLeft: "var(--ds-scale-100, 8px)",
|
|
106
|
+
marginRight: "var(--ds-scale-100, 8px)",
|
|
109
107
|
// Enables child absolutely positioned elements to be positioned relative to this element.
|
|
110
108
|
position: 'relative',
|
|
111
109
|
'& [data-ds--menu--heading-item]': {
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
marginBottom: "var(--ds-scale-075, 6px)",
|
|
111
|
+
marginTop: "var(--ds-scale-200, 20px)"
|
|
114
112
|
},
|
|
115
113
|
'& [data-ds--menu--skeleton-heading-item]': {
|
|
116
114
|
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,12 +10,16 @@ const 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
|
const NavigationFooter = ({
|
|
19
14
|
children
|
|
20
15
|
}) => {
|
|
21
|
-
return jsx(
|
|
22
|
-
|
|
16
|
+
return jsx(Box, {
|
|
17
|
+
display: "block",
|
|
18
|
+
position: "relative",
|
|
19
|
+
padding: "scale.100",
|
|
20
|
+
UNSAFE_style: {
|
|
21
|
+
paddingBottom: "var(--ds-scale-200, 14px)"
|
|
22
|
+
}
|
|
23
23
|
}, children);
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -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,14 +10,17 @@ const 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
|
const NavigationHeader = props => {
|
|
20
14
|
const {
|
|
21
15
|
children
|
|
22
16
|
} = props;
|
|
23
|
-
return jsx(
|
|
17
|
+
return jsx(Box, {
|
|
18
|
+
display: "block",
|
|
24
19
|
"data-navheader": true,
|
|
25
|
-
|
|
20
|
+
padding: "scale.100",
|
|
21
|
+
UNSAFE_style: {
|
|
22
|
+
paddingTop: "var(--ds-scale-300, 24px)"
|
|
23
|
+
}
|
|
26
24
|
}, children);
|
|
27
25
|
};
|
|
28
26
|
|
|
@@ -136,29 +136,32 @@ const NestableNavigationContent = props => {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
return
|
|
140
|
-
"
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
139
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
140
|
+
jsx("div", {
|
|
141
|
+
"data-testid": testId,
|
|
142
|
+
css: nestableNavigationContentStyles,
|
|
143
|
+
ref: containerRef,
|
|
144
|
+
tabIndex: -1,
|
|
145
|
+
onClick: manageFocus
|
|
146
|
+
}, jsx(ExitingPersistence, null, jsx(NestingMotion // Key is needed to have a unique react instance per stack name.
|
|
147
|
+
// This enables us to easily animate it in & out with exiting persistence.
|
|
148
|
+
, {
|
|
149
|
+
key: currentStackId,
|
|
150
|
+
enterFrom: transition === 'nesting' ? 'right' : 'left',
|
|
151
|
+
exitTo: transition === 'nesting' ? 'left' : 'right',
|
|
152
|
+
testId: testId && `${testId}-anim`
|
|
153
|
+
}, motion => // eslint-disable-next-line @repo/internal/react/use-primitives
|
|
154
|
+
jsx("div", _extends({
|
|
155
|
+
css: nestingRootStyles
|
|
156
|
+
}, motion), jsx(NestedContext.Provider, {
|
|
157
|
+
// This provider is inside the NestingMotion to ensure it keeps a stale
|
|
158
|
+
// reference to the previous value.
|
|
159
|
+
value: context
|
|
160
|
+
}, jsx(NestingItem, {
|
|
161
|
+
title: "",
|
|
162
|
+
id: ROOT_ID
|
|
163
|
+
}, children))))))
|
|
164
|
+
);
|
|
162
165
|
};
|
|
163
166
|
|
|
164
167
|
export default NestableNavigationContent;
|