@atlaskit/side-navigation 1.3.0 → 1.3.1
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/components/LoadingItems/index.js +13 -9
- package/dist/cjs/components/NavigationFooter/index.js +5 -5
- package/dist/cjs/components/NavigationHeader/index.js +8 -7
- package/dist/cjs/components/NestableNavigationContent/index.js +15 -13
- package/dist/cjs/components/NestingItem/index.js +9 -7
- package/dist/cjs/components/SideNavigation/index.js +13 -12
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/LoadingItems/index.js +14 -10
- package/dist/es2019/components/NavigationFooter/index.js +6 -6
- package/dist/es2019/components/NavigationHeader/index.js +9 -8
- package/dist/es2019/components/NestableNavigationContent/index.js +16 -14
- package/dist/es2019/components/NestingItem/index.js +10 -9
- package/dist/es2019/components/SideNavigation/index.js +14 -13
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/LoadingItems/index.js +14 -10
- package/dist/esm/components/NavigationFooter/index.js +6 -6
- package/dist/esm/components/NavigationHeader/index.js +9 -8
- package/dist/esm/components/NestableNavigationContent/index.js +16 -14
- package/dist/esm/components/NestingItem/index.js +10 -9
- package/dist/esm/components/SideNavigation/index.js +14 -13
- package/dist/esm/version.json +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5f36f2ce46d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f36f2ce46d) - Adds a defensive `css()` function wrapping to many of the style calls in the side-navigation package. This is expected to help fix an issue with certain styles in side navigation not appearing if consumed when different versions of `@emotion` are present on the page.
|
|
8
|
+
|
|
3
9
|
## 1.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -16,12 +16,23 @@ var _motion = require("@atlaskit/motion");
|
|
|
16
16
|
var _context = require("../NestableNavigationContent/context");
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
|
-
|
|
19
|
+
var baseMotionStyles = (0, _react.css)({
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
zIndex: 1,
|
|
22
|
+
top: 0,
|
|
23
|
+
right: 0,
|
|
24
|
+
left: 0
|
|
25
|
+
});
|
|
26
|
+
var enteringStyles = (0, _react.css)({
|
|
27
|
+
position: 'static',
|
|
28
|
+
zIndex: 2
|
|
29
|
+
});
|
|
20
30
|
/**
|
|
21
31
|
* __Loading items__
|
|
22
32
|
*
|
|
23
33
|
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
24
34
|
*/
|
|
35
|
+
|
|
25
36
|
var LoadingItems = function LoadingItems(_ref) {
|
|
26
37
|
var children = _ref.children,
|
|
27
38
|
isLoading = _ref.isLoading,
|
|
@@ -41,14 +52,7 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
41
52
|
}, function (motion, state) {
|
|
42
53
|
return (0, _react.jsx)("span", (0, _extends2.default)({}, motion, {
|
|
43
54
|
"data-testid": testId && "".concat(testId, "--").concat(state),
|
|
44
|
-
css:
|
|
45
|
-
// Used to have the exiting section appear above the entering one.
|
|
46
|
-
position: state === 'entering' ? undefined : 'absolute',
|
|
47
|
-
zIndex: state === 'entering' ? 2 : 1,
|
|
48
|
-
top: 0,
|
|
49
|
-
left: 0,
|
|
50
|
-
right: 0
|
|
51
|
-
}
|
|
55
|
+
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
52
56
|
}), isLoading ? fallback : children);
|
|
53
57
|
}));
|
|
54
58
|
};
|
|
@@ -10,11 +10,11 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _constants = require("@atlaskit/theme/constants");
|
|
11
11
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
|
-
var
|
|
14
|
-
position: 'relative',
|
|
13
|
+
var footerStyles = (0, _react.css)({
|
|
15
14
|
padding: (0, _constants.gridSize)(),
|
|
16
|
-
paddingBottom: (0, _constants.gridSize)() * 1.75
|
|
17
|
-
|
|
15
|
+
paddingBottom: (0, _constants.gridSize)() * 1.75,
|
|
16
|
+
position: 'relative'
|
|
17
|
+
});
|
|
18
18
|
/**
|
|
19
19
|
* __Navigation footer__
|
|
20
20
|
*
|
|
@@ -27,7 +27,7 @@ var footerCSS = {
|
|
|
27
27
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
28
28
|
var children = _ref.children;
|
|
29
29
|
return (0, _react.jsx)("div", {
|
|
30
|
-
css:
|
|
30
|
+
css: footerStyles
|
|
31
31
|
}, children);
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -10,7 +10,12 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _constants = require("@atlaskit/theme/constants");
|
|
11
11
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
|
-
|
|
13
|
+
var navigationHeaderStyles = (0, _react.css)({
|
|
14
|
+
paddingTop: (0, _constants.gridSize)() * 3,
|
|
15
|
+
paddingRight: (0, _constants.gridSize)(),
|
|
16
|
+
paddingBottom: (0, _constants.gridSize)(),
|
|
17
|
+
paddingLeft: (0, _constants.gridSize)()
|
|
18
|
+
});
|
|
14
19
|
/**
|
|
15
20
|
* __Navigation header__
|
|
16
21
|
*
|
|
@@ -19,16 +24,12 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
19
24
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
20
25
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
21
26
|
*/
|
|
27
|
+
|
|
22
28
|
var NavigationHeader = function NavigationHeader(props) {
|
|
23
29
|
var children = props.children;
|
|
24
30
|
return (0, _react.jsx)("div", {
|
|
25
31
|
"data-navheader": true,
|
|
26
|
-
css:
|
|
27
|
-
paddingTop: (0, _constants.gridSize)() * 3,
|
|
28
|
-
paddingBottom: (0, _constants.gridSize)(),
|
|
29
|
-
paddingLeft: (0, _constants.gridSize)(),
|
|
30
|
-
paddingRight: (0, _constants.gridSize)()
|
|
31
|
-
}
|
|
32
|
+
css: navigationHeaderStyles
|
|
32
33
|
}, children);
|
|
33
34
|
};
|
|
34
35
|
|
|
@@ -29,7 +29,18 @@ var _nestingMotion = require("./nesting-motion");
|
|
|
29
29
|
// Named so ERT doesn't pick up the override name as a type.
|
|
30
30
|
var ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
31
31
|
exports.ROOT_ID = ROOT_ID;
|
|
32
|
-
|
|
32
|
+
var nestableNavigationContentStyles = (0, _react2.css)({
|
|
33
|
+
height: '100%',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
outline: 'none'
|
|
36
|
+
});
|
|
37
|
+
var nestingRootStyles = (0, _react2.css)({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: '100%',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
flexDirection: 'column'
|
|
43
|
+
});
|
|
33
44
|
/**
|
|
34
45
|
* __Nestable navigation content__
|
|
35
46
|
*
|
|
@@ -38,6 +49,7 @@ exports.ROOT_ID = ROOT_ID;
|
|
|
38
49
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#nested-navigation)
|
|
39
50
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
40
51
|
*/
|
|
52
|
+
|
|
41
53
|
var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
42
54
|
var containerRef = (0, _react.useRef)(null);
|
|
43
55
|
var children = props.children,
|
|
@@ -151,11 +163,7 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
151
163
|
|
|
152
164
|
return (0, _react2.jsx)("div", {
|
|
153
165
|
"data-testid": testId,
|
|
154
|
-
css:
|
|
155
|
-
position: 'relative',
|
|
156
|
-
height: '100%',
|
|
157
|
-
outline: 'none'
|
|
158
|
-
},
|
|
166
|
+
css: nestableNavigationContentStyles,
|
|
159
167
|
ref: containerRef,
|
|
160
168
|
tabIndex: -1,
|
|
161
169
|
onClick: manageFocus
|
|
@@ -168,13 +176,7 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
168
176
|
testId: testId && "".concat(testId, "-anim")
|
|
169
177
|
}, function (motion) {
|
|
170
178
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
171
|
-
css:
|
|
172
|
-
position: 'absolute',
|
|
173
|
-
width: '100%',
|
|
174
|
-
height: '100%',
|
|
175
|
-
display: 'flex',
|
|
176
|
-
flexDirection: 'column'
|
|
177
|
-
}
|
|
179
|
+
css: nestingRootStyles
|
|
178
180
|
}, motion), (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
179
181
|
// This provider is inside the NestingMotion to ensure it keeps a stale
|
|
180
182
|
// reference to the previous value.
|
|
@@ -49,11 +49,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
49
49
|
|
|
50
50
|
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; }
|
|
51
51
|
|
|
52
|
+
var nestingItemStyles = (0, _react2.css)({
|
|
53
|
+
marginRight: (0, _constants.gridSize)(),
|
|
54
|
+
marginLeft: (0, _constants.gridSize)(),
|
|
55
|
+
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
56
|
+
paddingTop: (0, _constants.gridSize)() * 0.75,
|
|
57
|
+
paddingBottom: (0, _constants.gridSize)() * 0.75
|
|
58
|
+
});
|
|
52
59
|
/**
|
|
53
60
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
54
61
|
* When not open - it will render itself as an item.
|
|
55
62
|
* When open - it will render its children.
|
|
56
63
|
*/
|
|
64
|
+
|
|
57
65
|
var NestingItem = function NestingItem(props) {
|
|
58
66
|
var children = props.children,
|
|
59
67
|
iconAfter = props.iconAfter,
|
|
@@ -124,13 +132,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
124
132
|
return (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
125
133
|
value: context
|
|
126
134
|
}, stack.length >= 1 && (0, _react2.jsx)("div", {
|
|
127
|
-
css:
|
|
128
|
-
marginLeft: (0, _constants.gridSize)(),
|
|
129
|
-
marginRight: (0, _constants.gridSize)(),
|
|
130
|
-
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
131
|
-
paddingTop: (0, _constants.gridSize)() * 0.75,
|
|
132
|
-
paddingBottom: (0, _constants.gridSize)() * 0.75
|
|
133
|
-
}
|
|
135
|
+
css: nestingItemStyles
|
|
134
136
|
}, backButton), (0, _react2.jsx)(_index.NavigationContent, {
|
|
135
137
|
testId: testId,
|
|
136
138
|
showTopScrollIndicator: stack.length >= 1
|
|
@@ -14,7 +14,17 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
14
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
15
15
|
|
|
16
16
|
/** @jsx jsx */
|
|
17
|
-
|
|
17
|
+
var sideNavStyles = (0, _react2.css)({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
width: '100%',
|
|
20
|
+
minWidth: (0, _constants.gridSize)() * 30,
|
|
21
|
+
height: '100%',
|
|
22
|
+
position: 'relative',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
backgroundColor: "var(--ds-surface, ".concat(_colors.N10, ")"),
|
|
25
|
+
color: "var(--ds-text-subtle, ".concat(_colors.N500, ")"),
|
|
26
|
+
overflow: 'hidden'
|
|
27
|
+
});
|
|
18
28
|
/**
|
|
19
29
|
* __Side navigation__
|
|
20
30
|
*
|
|
@@ -24,6 +34,7 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
24
34
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
25
35
|
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
26
36
|
*/
|
|
37
|
+
|
|
27
38
|
var SideNavigation = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
28
39
|
var children = props.children,
|
|
29
40
|
testId = props.testId,
|
|
@@ -32,17 +43,7 @@ var SideNavigation = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
32
43
|
ref: ref,
|
|
33
44
|
"data-testid": testId,
|
|
34
45
|
"aria-label": label,
|
|
35
|
-
css:
|
|
36
|
-
width: '100%',
|
|
37
|
-
height: '100%',
|
|
38
|
-
color: "var(--ds-text-subtle, ".concat(_colors.N500, ")"),
|
|
39
|
-
minWidth: (0, _constants.gridSize)() * 30,
|
|
40
|
-
backgroundColor: "var(--ds-surface, ".concat(_colors.N10, ")"),
|
|
41
|
-
position: 'relative',
|
|
42
|
-
display: 'flex',
|
|
43
|
-
flexDirection: 'column',
|
|
44
|
-
overflow: 'hidden'
|
|
45
|
-
}
|
|
46
|
+
css: sideNavStyles
|
|
46
47
|
}, children);
|
|
47
48
|
});
|
|
48
49
|
var _default = SideNavigation;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { ExitingPersistence, FadeIn, mediumDurationMs } from '@atlaskit/motion';
|
|
6
6
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
|
-
|
|
7
|
+
const baseMotionStyles = css({
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
zIndex: 1,
|
|
10
|
+
top: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
left: 0
|
|
13
|
+
});
|
|
14
|
+
const enteringStyles = css({
|
|
15
|
+
position: 'static',
|
|
16
|
+
zIndex: 2
|
|
17
|
+
});
|
|
8
18
|
/**
|
|
9
19
|
* __Loading items__
|
|
10
20
|
*
|
|
11
21
|
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
12
22
|
*/
|
|
23
|
+
|
|
13
24
|
const LoadingItems = ({
|
|
14
25
|
children,
|
|
15
26
|
isLoading,
|
|
@@ -29,14 +40,7 @@ const LoadingItems = ({
|
|
|
29
40
|
duration: mediumDurationMs
|
|
30
41
|
}, (motion, state) => jsx("span", _extends({}, motion, {
|
|
31
42
|
"data-testid": testId && `${testId}--${state}`,
|
|
32
|
-
css:
|
|
33
|
-
// Used to have the exiting section appear above the entering one.
|
|
34
|
-
position: state === 'entering' ? undefined : 'absolute',
|
|
35
|
-
zIndex: state === 'entering' ? 2 : 1,
|
|
36
|
-
top: 0,
|
|
37
|
-
left: 0,
|
|
38
|
-
right: 0
|
|
39
|
-
}
|
|
43
|
+
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
40
44
|
}), isLoading ? fallback : children)));
|
|
41
45
|
};
|
|
42
46
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
4
|
-
const
|
|
5
|
-
position: 'relative',
|
|
4
|
+
const footerStyles = css({
|
|
6
5
|
padding: gridSize(),
|
|
7
|
-
paddingBottom: gridSize() * 1.75
|
|
8
|
-
|
|
6
|
+
paddingBottom: gridSize() * 1.75,
|
|
7
|
+
position: 'relative'
|
|
8
|
+
});
|
|
9
9
|
/**
|
|
10
10
|
* __Navigation footer__
|
|
11
11
|
*
|
|
@@ -19,7 +19,7 @@ const NavigationFooter = ({
|
|
|
19
19
|
children
|
|
20
20
|
}) => {
|
|
21
21
|
return jsx("div", {
|
|
22
|
-
css:
|
|
22
|
+
css: footerStyles
|
|
23
23
|
}, children);
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
4
|
-
|
|
4
|
+
const navigationHeaderStyles = css({
|
|
5
|
+
paddingTop: gridSize() * 3,
|
|
6
|
+
paddingRight: gridSize(),
|
|
7
|
+
paddingBottom: gridSize(),
|
|
8
|
+
paddingLeft: gridSize()
|
|
9
|
+
});
|
|
5
10
|
/**
|
|
6
11
|
* __Navigation header__
|
|
7
12
|
*
|
|
@@ -10,18 +15,14 @@ import { gridSize } from '@atlaskit/theme/constants';
|
|
|
10
15
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
11
16
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
12
17
|
*/
|
|
18
|
+
|
|
13
19
|
const NavigationHeader = props => {
|
|
14
20
|
const {
|
|
15
21
|
children
|
|
16
22
|
} = props;
|
|
17
23
|
return jsx("div", {
|
|
18
24
|
"data-navheader": true,
|
|
19
|
-
css:
|
|
20
|
-
paddingTop: gridSize() * 3,
|
|
21
|
-
paddingBottom: gridSize(),
|
|
22
|
-
paddingLeft: gridSize(),
|
|
23
|
-
paddingRight: gridSize()
|
|
24
|
-
}
|
|
25
|
+
css: navigationHeaderStyles
|
|
25
26
|
}, children);
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { ExitingPersistence } from '@atlaskit/motion';
|
|
7
7
|
import { GoBackItem as GoBackButton } from '../Item';
|
|
8
8
|
import { default as NestingItem } from '../NestingItem';
|
|
@@ -10,7 +10,18 @@ import { NestedContext } from './context';
|
|
|
10
10
|
import { NestingMotion } from './nesting-motion'; // Named so ERT doesn't pick up the override name as a type.
|
|
11
11
|
|
|
12
12
|
export const ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
13
|
-
|
|
13
|
+
const nestableNavigationContentStyles = css({
|
|
14
|
+
height: '100%',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
outline: 'none'
|
|
17
|
+
});
|
|
18
|
+
const nestingRootStyles = css({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: '100%',
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
flexDirection: 'column'
|
|
24
|
+
});
|
|
14
25
|
/**
|
|
15
26
|
* __Nestable navigation content__
|
|
16
27
|
*
|
|
@@ -19,6 +30,7 @@ export const ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
|
19
30
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#nested-navigation)
|
|
20
31
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
21
32
|
*/
|
|
33
|
+
|
|
22
34
|
const NestableNavigationContent = props => {
|
|
23
35
|
const containerRef = useRef(null);
|
|
24
36
|
const {
|
|
@@ -120,11 +132,7 @@ const NestableNavigationContent = props => {
|
|
|
120
132
|
|
|
121
133
|
return jsx("div", {
|
|
122
134
|
"data-testid": testId,
|
|
123
|
-
css:
|
|
124
|
-
position: 'relative',
|
|
125
|
-
height: '100%',
|
|
126
|
-
outline: 'none'
|
|
127
|
-
},
|
|
135
|
+
css: nestableNavigationContentStyles,
|
|
128
136
|
ref: containerRef,
|
|
129
137
|
tabIndex: -1,
|
|
130
138
|
onClick: manageFocus
|
|
@@ -136,13 +144,7 @@ const NestableNavigationContent = props => {
|
|
|
136
144
|
exitTo: transition === 'nesting' ? 'left' : 'right',
|
|
137
145
|
testId: testId && `${testId}-anim`
|
|
138
146
|
}, motion => jsx("div", _extends({
|
|
139
|
-
css:
|
|
140
|
-
position: 'absolute',
|
|
141
|
-
width: '100%',
|
|
142
|
-
height: '100%',
|
|
143
|
-
display: 'flex',
|
|
144
|
-
flexDirection: 'column'
|
|
145
|
-
}
|
|
147
|
+
css: nestingRootStyles
|
|
146
148
|
}, motion), jsx(NestedContext.Provider, {
|
|
147
149
|
// This provider is inside the NestingMotion to ensure it keeps a stale
|
|
148
150
|
// reference to the previous value.
|
|
@@ -2,7 +2,7 @@ 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 { jsx } from '@emotion/react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import RightArrow from '@atlaskit/icon/glyph/arrow-right-circle';
|
|
7
7
|
import { N10 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
@@ -11,12 +11,19 @@ import { ButtonItem, CustomItem, NavigationContent } from '../index';
|
|
|
11
11
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
12
12
|
import { NestedContext, useNestedContext } from '../NestableNavigationContent/context';
|
|
13
13
|
import { nestingItemStyle } from './styles';
|
|
14
|
-
|
|
14
|
+
const nestingItemStyles = css({
|
|
15
|
+
marginRight: gridSize(),
|
|
16
|
+
marginLeft: gridSize(),
|
|
17
|
+
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
18
|
+
paddingTop: gridSize() * 0.75,
|
|
19
|
+
paddingBottom: gridSize() * 0.75
|
|
20
|
+
});
|
|
15
21
|
/**
|
|
16
22
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
17
23
|
* When not open - it will render itself as an item.
|
|
18
24
|
* When open - it will render its children.
|
|
19
25
|
*/
|
|
26
|
+
|
|
20
27
|
const NestingItem = props => {
|
|
21
28
|
const {
|
|
22
29
|
children,
|
|
@@ -79,13 +86,7 @@ const NestingItem = props => {
|
|
|
79
86
|
return jsx(NestedContext.Provider, {
|
|
80
87
|
value: context
|
|
81
88
|
}, stack.length >= 1 && jsx("div", {
|
|
82
|
-
css:
|
|
83
|
-
marginLeft: gridSize(),
|
|
84
|
-
marginRight: gridSize(),
|
|
85
|
-
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
86
|
-
paddingTop: gridSize() * 0.75,
|
|
87
|
-
paddingBottom: gridSize() * 0.75
|
|
88
|
-
}
|
|
89
|
+
css: nestingItemStyles
|
|
89
90
|
}, backButton), jsx(NavigationContent, {
|
|
90
91
|
testId: testId,
|
|
91
92
|
showTopScrollIndicator: stack.length >= 1
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N10, N500 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
6
|
-
|
|
6
|
+
const sideNavStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
width: '100%',
|
|
9
|
+
minWidth: gridSize() * 30,
|
|
10
|
+
height: '100%',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
backgroundColor: `var(--ds-surface, ${N10})`,
|
|
14
|
+
color: `var(--ds-text-subtle, ${N500})`,
|
|
15
|
+
overflow: 'hidden'
|
|
16
|
+
});
|
|
7
17
|
/**
|
|
8
18
|
* __Side navigation__
|
|
9
19
|
*
|
|
@@ -13,6 +23,7 @@ import { gridSize } from '@atlaskit/theme/constants';
|
|
|
13
23
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
14
24
|
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
15
25
|
*/
|
|
26
|
+
|
|
16
27
|
const SideNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
28
|
const {
|
|
18
29
|
children,
|
|
@@ -23,17 +34,7 @@ const SideNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23
34
|
ref: ref,
|
|
24
35
|
"data-testid": testId,
|
|
25
36
|
"aria-label": label,
|
|
26
|
-
css:
|
|
27
|
-
width: '100%',
|
|
28
|
-
height: '100%',
|
|
29
|
-
color: `var(--ds-text-subtle, ${N500})`,
|
|
30
|
-
minWidth: gridSize() * 30,
|
|
31
|
-
backgroundColor: `var(--ds-surface, ${N10})`,
|
|
32
|
-
position: 'relative',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
overflow: 'hidden'
|
|
36
|
-
}
|
|
37
|
+
css: sideNavStyles
|
|
37
38
|
}, children);
|
|
38
39
|
});
|
|
39
40
|
export default SideNavigation;
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { ExitingPersistence, FadeIn, mediumDurationMs } from '@atlaskit/motion';
|
|
6
6
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
|
-
|
|
7
|
+
var baseMotionStyles = css({
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
zIndex: 1,
|
|
10
|
+
top: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
left: 0
|
|
13
|
+
});
|
|
14
|
+
var enteringStyles = css({
|
|
15
|
+
position: 'static',
|
|
16
|
+
zIndex: 2
|
|
17
|
+
});
|
|
8
18
|
/**
|
|
9
19
|
* __Loading items__
|
|
10
20
|
*
|
|
11
21
|
* Loading items conditionally render based on the useShouldNestedElementRender() hook.
|
|
12
22
|
*/
|
|
23
|
+
|
|
13
24
|
var LoadingItems = function LoadingItems(_ref) {
|
|
14
25
|
var children = _ref.children,
|
|
15
26
|
isLoading = _ref.isLoading,
|
|
@@ -29,14 +40,7 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
29
40
|
}, function (motion, state) {
|
|
30
41
|
return jsx("span", _extends({}, motion, {
|
|
31
42
|
"data-testid": testId && "".concat(testId, "--").concat(state),
|
|
32
|
-
css:
|
|
33
|
-
// Used to have the exiting section appear above the entering one.
|
|
34
|
-
position: state === 'entering' ? undefined : 'absolute',
|
|
35
|
-
zIndex: state === 'entering' ? 2 : 1,
|
|
36
|
-
top: 0,
|
|
37
|
-
left: 0,
|
|
38
|
-
right: 0
|
|
39
|
-
}
|
|
43
|
+
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
40
44
|
}), isLoading ? fallback : children);
|
|
41
45
|
}));
|
|
42
46
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
4
|
-
var
|
|
5
|
-
position: 'relative',
|
|
4
|
+
var footerStyles = css({
|
|
6
5
|
padding: gridSize(),
|
|
7
|
-
paddingBottom: gridSize() * 1.75
|
|
8
|
-
|
|
6
|
+
paddingBottom: gridSize() * 1.75,
|
|
7
|
+
position: 'relative'
|
|
8
|
+
});
|
|
9
9
|
/**
|
|
10
10
|
* __Navigation footer__
|
|
11
11
|
*
|
|
@@ -18,7 +18,7 @@ var footerCSS = {
|
|
|
18
18
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
19
19
|
var children = _ref.children;
|
|
20
20
|
return jsx("div", {
|
|
21
|
-
css:
|
|
21
|
+
css: footerStyles
|
|
22
22
|
}, children);
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
4
|
-
|
|
4
|
+
var navigationHeaderStyles = css({
|
|
5
|
+
paddingTop: gridSize() * 3,
|
|
6
|
+
paddingRight: gridSize(),
|
|
7
|
+
paddingBottom: gridSize(),
|
|
8
|
+
paddingLeft: gridSize()
|
|
9
|
+
});
|
|
5
10
|
/**
|
|
6
11
|
* __Navigation header__
|
|
7
12
|
*
|
|
@@ -10,16 +15,12 @@ import { gridSize } from '@atlaskit/theme/constants';
|
|
|
10
15
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
11
16
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
12
17
|
*/
|
|
18
|
+
|
|
13
19
|
var NavigationHeader = function NavigationHeader(props) {
|
|
14
20
|
var children = props.children;
|
|
15
21
|
return jsx("div", {
|
|
16
22
|
"data-navheader": true,
|
|
17
|
-
css:
|
|
18
|
-
paddingTop: gridSize() * 3,
|
|
19
|
-
paddingBottom: gridSize(),
|
|
20
|
-
paddingLeft: gridSize(),
|
|
21
|
-
paddingRight: gridSize()
|
|
22
|
-
}
|
|
23
|
+
css: navigationHeaderStyles
|
|
23
24
|
}, children);
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { ExitingPersistence } from '@atlaskit/motion';
|
|
8
8
|
import { GoBackItem as GoBackButton } from '../Item';
|
|
9
9
|
import { default as NestingItem } from '../NestingItem';
|
|
@@ -11,7 +11,18 @@ import { NestedContext } from './context';
|
|
|
11
11
|
import { NestingMotion } from './nesting-motion'; // Named so ERT doesn't pick up the override name as a type.
|
|
12
12
|
|
|
13
13
|
export var ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
14
|
-
|
|
14
|
+
var nestableNavigationContentStyles = css({
|
|
15
|
+
height: '100%',
|
|
16
|
+
position: 'relative',
|
|
17
|
+
outline: 'none'
|
|
18
|
+
});
|
|
19
|
+
var nestingRootStyles = css({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
width: '100%',
|
|
22
|
+
height: '100%',
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
flexDirection: 'column'
|
|
25
|
+
});
|
|
15
26
|
/**
|
|
16
27
|
* __Nestable navigation content__
|
|
17
28
|
*
|
|
@@ -20,6 +31,7 @@ export var ROOT_ID = 'ATLASKIT_NESTED_ROOT';
|
|
|
20
31
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#nested-navigation)
|
|
21
32
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
22
33
|
*/
|
|
34
|
+
|
|
23
35
|
var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
24
36
|
var containerRef = useRef(null);
|
|
25
37
|
var children = props.children,
|
|
@@ -133,11 +145,7 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
133
145
|
|
|
134
146
|
return jsx("div", {
|
|
135
147
|
"data-testid": testId,
|
|
136
|
-
css:
|
|
137
|
-
position: 'relative',
|
|
138
|
-
height: '100%',
|
|
139
|
-
outline: 'none'
|
|
140
|
-
},
|
|
148
|
+
css: nestableNavigationContentStyles,
|
|
141
149
|
ref: containerRef,
|
|
142
150
|
tabIndex: -1,
|
|
143
151
|
onClick: manageFocus
|
|
@@ -150,13 +158,7 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
150
158
|
testId: testId && "".concat(testId, "-anim")
|
|
151
159
|
}, function (motion) {
|
|
152
160
|
return jsx("div", _extends({
|
|
153
|
-
css:
|
|
154
|
-
position: 'absolute',
|
|
155
|
-
width: '100%',
|
|
156
|
-
height: '100%',
|
|
157
|
-
display: 'flex',
|
|
158
|
-
flexDirection: 'column'
|
|
159
|
-
}
|
|
161
|
+
css: nestingRootStyles
|
|
160
162
|
}, motion), jsx(NestedContext.Provider, {
|
|
161
163
|
// This provider is inside the NestingMotion to ensure it keeps a stale
|
|
162
164
|
// reference to the previous value.
|
|
@@ -11,7 +11,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
11
11
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
import React, { Fragment, useCallback, useMemo, useState } from 'react';
|
|
14
|
-
import { jsx } from '@emotion/react';
|
|
14
|
+
import { css, jsx } from '@emotion/react';
|
|
15
15
|
import RightArrow from '@atlaskit/icon/glyph/arrow-right-circle';
|
|
16
16
|
import { N10 } from '@atlaskit/theme/colors';
|
|
17
17
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
@@ -20,12 +20,19 @@ import { ButtonItem, CustomItem, NavigationContent } from '../index';
|
|
|
20
20
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
21
21
|
import { NestedContext, useNestedContext } from '../NestableNavigationContent/context';
|
|
22
22
|
import { nestingItemStyle } from './styles';
|
|
23
|
-
|
|
23
|
+
var nestingItemStyles = css({
|
|
24
|
+
marginRight: gridSize(),
|
|
25
|
+
marginLeft: gridSize(),
|
|
26
|
+
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
27
|
+
paddingTop: gridSize() * 0.75,
|
|
28
|
+
paddingBottom: gridSize() * 0.75
|
|
29
|
+
});
|
|
24
30
|
/**
|
|
25
31
|
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
26
32
|
* When not open - it will render itself as an item.
|
|
27
33
|
* When open - it will render its children.
|
|
28
34
|
*/
|
|
35
|
+
|
|
29
36
|
var NestingItem = function NestingItem(props) {
|
|
30
37
|
var children = props.children,
|
|
31
38
|
iconAfter = props.iconAfter,
|
|
@@ -96,13 +103,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
96
103
|
return jsx(NestedContext.Provider, {
|
|
97
104
|
value: context
|
|
98
105
|
}, stack.length >= 1 && jsx("div", {
|
|
99
|
-
css:
|
|
100
|
-
marginLeft: gridSize(),
|
|
101
|
-
marginRight: gridSize(),
|
|
102
|
-
// This padding bottom needs to match the section margin inside @atlaskit/menu.
|
|
103
|
-
paddingTop: gridSize() * 0.75,
|
|
104
|
-
paddingBottom: gridSize() * 0.75
|
|
105
|
-
}
|
|
106
|
+
css: nestingItemStyles
|
|
106
107
|
}, backButton), jsx(NavigationContent, {
|
|
107
108
|
testId: testId,
|
|
108
109
|
showTopScrollIndicator: stack.length >= 1
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N10, N500 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
6
|
-
|
|
6
|
+
var sideNavStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
width: '100%',
|
|
9
|
+
minWidth: gridSize() * 30,
|
|
10
|
+
height: '100%',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
backgroundColor: "var(--ds-surface, ".concat(N10, ")"),
|
|
14
|
+
color: "var(--ds-text-subtle, ".concat(N500, ")"),
|
|
15
|
+
overflow: 'hidden'
|
|
16
|
+
});
|
|
7
17
|
/**
|
|
8
18
|
* __Side navigation__
|
|
9
19
|
*
|
|
@@ -13,6 +23,7 @@ import { gridSize } from '@atlaskit/theme/constants';
|
|
|
13
23
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
14
24
|
* - [Usage](https://atlassian.design/components/side-navigation/usage)
|
|
15
25
|
*/
|
|
26
|
+
|
|
16
27
|
var SideNavigation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
28
|
var children = props.children,
|
|
18
29
|
testId = props.testId,
|
|
@@ -21,17 +32,7 @@ var SideNavigation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
32
|
ref: ref,
|
|
22
33
|
"data-testid": testId,
|
|
23
34
|
"aria-label": label,
|
|
24
|
-
css:
|
|
25
|
-
width: '100%',
|
|
26
|
-
height: '100%',
|
|
27
|
-
color: "var(--ds-text-subtle, ".concat(N500, ")"),
|
|
28
|
-
minWidth: gridSize() * 30,
|
|
29
|
-
backgroundColor: "var(--ds-surface, ".concat(N10, ")"),
|
|
30
|
-
position: 'relative',
|
|
31
|
-
display: 'flex',
|
|
32
|
-
flexDirection: 'column',
|
|
33
|
-
overflow: 'hidden'
|
|
34
|
-
}
|
|
35
|
+
css: sideNavStyles
|
|
35
36
|
}, children);
|
|
36
37
|
});
|
|
37
38
|
export default SideNavigation;
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/side-navigation",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "A highly composable side navigation component that supports nested views.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
"typesVersions": {
|
|
16
16
|
">=4.0 <4.5": {
|
|
17
17
|
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
18
|
+
"dist/types-ts4.0/*",
|
|
19
|
+
"dist/types-ts4.0/index.d.ts"
|
|
19
20
|
]
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"sideEffects": false,
|
|
23
24
|
"atlaskit:src": "src/index.tsx",
|
|
24
25
|
"atlassian": {
|
|
26
|
+
"disableProductCI": true,
|
|
25
27
|
"team": "Design System Team",
|
|
26
28
|
"deprecatedAutoEntryPoints": true,
|
|
27
29
|
"releaseModel": "scheduled",
|