@atlaskit/side-navigation 1.2.15 → 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 +16 -0
- package/dist/cjs/components/LoadingItems/index.js +16 -12
- package/dist/cjs/components/NavigationContent/index.js +4 -4
- package/dist/cjs/components/NavigationFooter/index.js +7 -7
- package/dist/cjs/components/NavigationHeader/index.js +10 -9
- package/dist/cjs/components/NestableNavigationContent/index.js +22 -20
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +2 -2
- package/dist/cjs/components/NestingItem/index.js +18 -16
- package/dist/cjs/components/SideNavigation/index.js +15 -14
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/LoadingItems/index.js +14 -10
- package/dist/es2019/components/NavigationContent/index.js +1 -1
- 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/NestableNavigationContent/nesting-motion.js +1 -1
- 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/NavigationContent/index.js +1 -1
- 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/NestableNavigationContent/nesting-motion.js +1 -1
- 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/dist/types/components/NavigationFooter/index.d.ts +2 -1
- package/dist/types/components/NavigationHeader/index.d.ts +3 -1
- package/dist/types/components/NestableNavigationContent/index.d.ts +2 -1
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +2 -1
- package/dist/types-ts4.0/components/NavigationFooter/index.d.ts +2 -1
- package/dist/types-ts4.0/components/NavigationHeader/index.d.ts +3 -1
- package/dist/types-ts4.0/components/NestableNavigationContent/index.d.ts +2 -1
- package/dist/types-ts4.0/components/NestableNavigationContent/nesting-motion.d.ts +2 -1
- package/package.json +9 -7
- package/report.api.md +163 -43
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`02e2f7aacef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02e2f7aacef) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 1.2.15
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,19 +9,30 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _motion = require("@atlaskit/motion");
|
|
15
15
|
|
|
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,
|
|
@@ -35,20 +46,13 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
35
46
|
return children;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
return (0,
|
|
49
|
+
return (0, _react.jsx)(_motion.ExitingPersistence, null, (0, _react.jsx)(_motion.FadeIn, {
|
|
39
50
|
key: "loading-section-".concat(isLoading),
|
|
40
51
|
duration: _motion.mediumDurationMs
|
|
41
52
|
}, function (motion, state) {
|
|
42
|
-
return (0,
|
|
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
|
};
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _useScrollbarWidth = _interopRequireDefault(require("@atlaskit/ds-lib/use-scrollbar-width"));
|
|
15
15
|
|
|
@@ -40,18 +40,18 @@ var NavigationContent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
|
|
|
40
40
|
return children;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return (0,
|
|
43
|
+
return (0, _react2.jsx)("div", {
|
|
44
44
|
ref: ref,
|
|
45
45
|
css: (0, _styles.outerContainerCSS)({
|
|
46
46
|
showTopScrollIndicator: showTopScrollIndicator,
|
|
47
47
|
scrollbarWidth: scrollbar.width
|
|
48
48
|
})
|
|
49
|
-
}, (0,
|
|
49
|
+
}, (0, _react2.jsx)("div", {
|
|
50
50
|
ref: scrollbar.ref,
|
|
51
51
|
css: (0, _styles.innerContainerCSS)({
|
|
52
52
|
showTopScrollIndicator: showTopScrollIndicator
|
|
53
53
|
})
|
|
54
|
-
}, (0,
|
|
54
|
+
}, (0, _react2.jsx)("div", {
|
|
55
55
|
css: (0, _styles.containerCSS)({
|
|
56
56
|
showTopScrollIndicator: showTopScrollIndicator
|
|
57
57
|
})
|
|
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
9
|
|
|
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
|
*
|
|
@@ -26,8 +26,8 @@ var footerCSS = {
|
|
|
26
26
|
|
|
27
27
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
28
28
|
var children = _ref.children;
|
|
29
|
-
return (0,
|
|
30
|
-
css:
|
|
29
|
+
return (0, _react.jsx)("div", {
|
|
30
|
+
css: footerStyles
|
|
31
31
|
}, children);
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -5,12 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
9
|
|
|
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
|
-
return (0,
|
|
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
|
|
|
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
17
|
|
|
18
18
|
var _motion = require("@atlaskit/motion");
|
|
19
19
|
|
|
@@ -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,
|
|
@@ -62,7 +74,7 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
62
74
|
|
|
63
75
|
var backTestId = testId && "".concat(testId, "--go-back-item");
|
|
64
76
|
var renderGoBackItem = overrides && overrides.GoBackItem && overrides.GoBackItem.render ? overrides.GoBackItem.render : function (props) {
|
|
65
|
-
return (0,
|
|
77
|
+
return (0, _react2.jsx)(_Item.GoBackItem, props, "Go back");
|
|
66
78
|
};
|
|
67
79
|
var onNestHandler = (0, _react.useCallback)(function (layerId) {
|
|
68
80
|
onChange && onChange(committedStack.concat(layerId));
|
|
@@ -149,17 +161,13 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
149
161
|
}
|
|
150
162
|
};
|
|
151
163
|
|
|
152
|
-
return (0,
|
|
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
|
|
162
|
-
}, (0,
|
|
170
|
+
}, (0, _react2.jsx)(_motion.ExitingPersistence, null, (0, _react2.jsx)(_nestingMotion.NestingMotion // Key is needed to have a unique react instance per stack name.
|
|
163
171
|
// This enables us to easily animate it in & out with exiting persistence.
|
|
164
172
|
, {
|
|
165
173
|
key: currentStackId,
|
|
@@ -167,19 +175,13 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
167
175
|
exitTo: transition === 'nesting' ? 'left' : 'right',
|
|
168
176
|
testId: testId && "".concat(testId, "-anim")
|
|
169
177
|
}, function (motion) {
|
|
170
|
-
return (0,
|
|
171
|
-
css:
|
|
172
|
-
|
|
173
|
-
width: '100%',
|
|
174
|
-
height: '100%',
|
|
175
|
-
display: 'flex',
|
|
176
|
-
flexDirection: 'column'
|
|
177
|
-
}
|
|
178
|
-
}, motion), (0, _core.jsx)(_context.NestedContext.Provider, {
|
|
178
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
179
|
+
css: nestingRootStyles
|
|
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.
|
|
181
183
|
value: context
|
|
182
|
-
}, (0,
|
|
184
|
+
}, (0, _react2.jsx)(_NestingItem.default, {
|
|
183
185
|
title: "",
|
|
184
186
|
id: ROOT_ID
|
|
185
187
|
}, children)));
|
|
@@ -9,7 +9,7 @@ exports.NestingMotion = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _motion = require("@atlaskit/motion");
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ var NestingMotion = function NestingMotion(props) {
|
|
|
25
25
|
enterFrom = props.enterFrom,
|
|
26
26
|
exitTo = props.exitTo,
|
|
27
27
|
testId = props.testId;
|
|
28
|
-
return (0,
|
|
28
|
+
return (0, _react.jsx)(_motion.SlideIn, {
|
|
29
29
|
exitTo: exitTo,
|
|
30
30
|
enterFrom: enterFrom,
|
|
31
31
|
animationTimingFunction: function animationTimingFunction(_) {
|
|
@@ -21,7 +21,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _react2 = require("@emotion/react");
|
|
25
25
|
|
|
26
26
|
var _arrowRightCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-right-circle"));
|
|
27
27
|
|
|
@@ -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,
|
|
@@ -121,17 +129,11 @@ var NestingItem = function NestingItem(props) {
|
|
|
121
129
|
}, [isInteracted, onClick, onNest, id]);
|
|
122
130
|
|
|
123
131
|
if (currentStackId === id) {
|
|
124
|
-
return (0,
|
|
132
|
+
return (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
125
133
|
value: context
|
|
126
|
-
}, stack.length >= 1 && (0,
|
|
127
|
-
css:
|
|
128
|
-
|
|
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
|
-
}
|
|
134
|
-
}, backButton), (0, _core.jsx)(_index.NavigationContent, {
|
|
134
|
+
}, stack.length >= 1 && (0, _react2.jsx)("div", {
|
|
135
|
+
css: nestingItemStyles
|
|
136
|
+
}, backButton), (0, _react2.jsx)(_index.NavigationContent, {
|
|
135
137
|
testId: testId,
|
|
136
138
|
showTopScrollIndicator: stack.length >= 1
|
|
137
139
|
}, children));
|
|
@@ -142,11 +144,11 @@ var NestingItem = function NestingItem(props) {
|
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
var componentProps = _objectSpread(_objectSpread({
|
|
145
|
-
iconAfter: (0,
|
|
147
|
+
iconAfter: (0, _react2.jsx)(_react.Fragment, null, iconAfter ? (0, _react2.jsx)("span", {
|
|
146
148
|
"data-custom-icon": true
|
|
147
|
-
}, iconAfter) : null, (0,
|
|
149
|
+
}, iconAfter) : null, (0, _react2.jsx)("span", {
|
|
148
150
|
"data-right-arrow": true
|
|
149
|
-
}, (0,
|
|
151
|
+
}, (0, _react2.jsx)(_arrowRightCircle.default, {
|
|
150
152
|
testId: testId && "".concat(testId, "--item--right-arrow"),
|
|
151
153
|
secondaryColor: "var(--ds-surface, ".concat(_colors.N10, ")"),
|
|
152
154
|
label: ""
|
|
@@ -160,13 +162,13 @@ var NestingItem = function NestingItem(props) {
|
|
|
160
162
|
});
|
|
161
163
|
|
|
162
164
|
if (component) {
|
|
163
|
-
return (0,
|
|
165
|
+
return (0, _react2.jsx)(_index.CustomItem, (0, _extends2.default)({}, componentProps, {
|
|
164
166
|
//@ts-expect-error TODO Fix legit TypeScript 3.9.6 improved inference error
|
|
165
167
|
component: component
|
|
166
168
|
}));
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
return (0,
|
|
171
|
+
return (0, _react2.jsx)(_index.ButtonItem, componentProps);
|
|
170
172
|
};
|
|
171
173
|
|
|
172
174
|
var _default = NestingItem;
|
|
@@ -7,14 +7,24 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
11
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
|
|
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,25 +34,16 @@ 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,
|
|
30
41
|
label = props.label;
|
|
31
|
-
return (0,
|
|
42
|
+
return (0, _react2.jsx)("nav", {
|
|
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/
|
|
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,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
4
|
import useScrollbarWidth from '@atlaskit/ds-lib/use-scrollbar-width';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
import { containerCSS, innerContainerCSS, outerContainerCSS } from './styles';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/
|
|
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/
|
|
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/
|
|
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/
|
|
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
|