@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`caa68aad0fd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/caa68aad0fd) - Internal changes around styles:
|
|
8
|
+
|
|
9
|
+
- Application of primitives for more declarative code
|
|
10
|
+
- Application of spacing tokens to internal styles
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`f96f3ebd861`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f96f3ebd861) - [ux] Use color.background.neutral.subtle token to represent transparent background.
|
|
15
|
+
- [`fbe4c12c94b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fbe4c12c94b) - DTR-995 fix move page dialog bg color
|
|
16
|
+
|
|
17
|
+
## 1.4.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.4.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.sectionHeaderSpacingStyles = exports.overrideStyleFunction = exports.baseSideNavItemStyle = void 0;
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
@@ -17,11 +17,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
|
|
18
18
|
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; }
|
|
19
19
|
|
|
20
|
-
var gridSize = (0, _constants.gridSize)();
|
|
21
20
|
var borderRadius = (0, _constants.borderRadius)();
|
|
22
|
-
var itemIconSize = gridSize * 3;
|
|
23
|
-
var leftIconRightSpacing = gridSize * 2;
|
|
24
|
-
var ITEM_SIDE_PADDING = gridSize * 1.25;
|
|
25
21
|
/**
|
|
26
22
|
* Allows chaining of style functions on top of base style functions
|
|
27
23
|
* @param baseStyle the base custom cssFn
|
|
@@ -30,8 +26,6 @@ var ITEM_SIDE_PADDING = gridSize * 1.25;
|
|
|
30
26
|
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
|
|
31
27
|
*/
|
|
32
28
|
|
|
33
|
-
exports.ITEM_SIDE_PADDING = ITEM_SIDE_PADDING;
|
|
34
|
-
|
|
35
29
|
var overrideStyleFunction = function overrideStyleFunction(baseStyle) {
|
|
36
30
|
var newStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
37
31
|
return {};
|
|
@@ -74,31 +68,32 @@ var baseSideNavItemStyle = function baseSideNavItemStyle(_ref) {
|
|
|
74
68
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
75
69
|
// This padding is set to ensure that the center of the left icon
|
|
76
70
|
// is approximately center aligned with the horizontal app switcher.
|
|
77
|
-
padding: "".concat(
|
|
71
|
+
padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 10px)"),
|
|
78
72
|
borderRadius: borderRadius,
|
|
79
73
|
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
80
74
|
// Menu and side navigation are now color aligned so they do not need this!
|
|
81
75
|
// See: https://product-fabric.atlassian.net/browse/DSP-1684
|
|
82
|
-
backgroundColor: "var(--ds-
|
|
76
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)"
|
|
83
77
|
}, !isDisabled && !isSelected && defaultStyles), !isDisabled && isSelected && selectedStyles), {}, (0, _defineProperty2.default)({}, '& [data-item-elem-before]', {
|
|
84
78
|
// TODO: Can this be moved into menu?
|
|
85
79
|
// center align icons with app-switcher regardless of size
|
|
86
80
|
display: 'flex',
|
|
87
|
-
height:
|
|
88
|
-
width:
|
|
81
|
+
height: "var(--ds-scale-300, 24px)",
|
|
82
|
+
width: "var(--ds-scale-300, 24px)",
|
|
89
83
|
alignItems: 'center',
|
|
90
84
|
justifyContent: 'center',
|
|
91
|
-
|
|
85
|
+
// this margin could be removed if the respective item had a more
|
|
86
|
+
// compositional API so an Inline could be used to separate elements instead
|
|
87
|
+
marginRight: "var(--ds-scale-200, 16px)"
|
|
92
88
|
}));
|
|
93
89
|
};
|
|
94
90
|
|
|
95
91
|
exports.baseSideNavItemStyle = baseSideNavItemStyle;
|
|
96
92
|
|
|
97
|
-
var
|
|
93
|
+
var sectionHeaderSpacingStyles = function sectionHeaderSpacingStyles() {
|
|
98
94
|
return {
|
|
99
|
-
|
|
100
|
-
paddingRight: "".concat(ITEM_SIDE_PADDING, "px")
|
|
95
|
+
paddingInline: "var(--ds-scale-100, 10px)"
|
|
101
96
|
};
|
|
102
97
|
};
|
|
103
98
|
|
|
104
|
-
exports.
|
|
99
|
+
exports.sectionHeaderSpacingStyles = sectionHeaderSpacingStyles;
|
|
@@ -15,15 +15,12 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
15
15
|
|
|
16
16
|
var _styles = require("../../common/styles");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _Header = require("../Header");
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement("div", props);
|
|
23
|
-
};
|
|
20
|
+
var _Item = require("../Item");
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
23
|
+
* __Footer__
|
|
27
24
|
*
|
|
28
25
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
29
26
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -38,8 +35,8 @@ var Footer = function Footer(props) {
|
|
|
38
35
|
alignItems: 'center',
|
|
39
36
|
width: '100%',
|
|
40
37
|
'[data-item-elem-before]': {
|
|
41
|
-
marginRight: 0,
|
|
42
|
-
marginBottom:
|
|
38
|
+
marginRight: "var(--ds-scale-0, 0px)",
|
|
39
|
+
marginBottom: "var(--ds-scale-100, 8px)",
|
|
43
40
|
display: 'inline-block'
|
|
44
41
|
},
|
|
45
42
|
'[data-item-title]': {
|
|
@@ -49,22 +46,37 @@ var Footer = function Footer(props) {
|
|
|
49
46
|
'[data-item-description]': {
|
|
50
47
|
textAlign: 'center',
|
|
51
48
|
display: 'inline-block',
|
|
52
|
-
margin:
|
|
49
|
+
margin: "var(--ds-scale-075, 6px)"
|
|
53
50
|
},
|
|
54
51
|
// Will look interactive if the `component` is anything other than a div.
|
|
55
52
|
'div&:hover': {
|
|
56
|
-
backgroundColor:
|
|
53
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
57
54
|
cursor: 'default'
|
|
58
55
|
},
|
|
59
56
|
'div&:active': {
|
|
60
|
-
backgroundColor:
|
|
57
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
61
58
|
color: "var(--ds-text-subtle, ".concat(_colors.N500, ")")
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
|
-
}, props.cssFn);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
}, props.cssFn); // https://stackoverflow.com/a/39333479
|
|
62
|
+
|
|
63
|
+
var safeProps = function (_ref) {
|
|
64
|
+
var iconBefore = _ref.iconBefore,
|
|
65
|
+
onClick = _ref.onClick,
|
|
66
|
+
description = _ref.description,
|
|
67
|
+
children = _ref.children,
|
|
68
|
+
testId = _ref.testId;
|
|
69
|
+
return {
|
|
70
|
+
iconBefore: iconBefore,
|
|
71
|
+
onClick: onClick,
|
|
72
|
+
description: description,
|
|
73
|
+
children: children,
|
|
74
|
+
testId: testId
|
|
75
|
+
};
|
|
76
|
+
}(props);
|
|
77
|
+
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_Item.CustomItem, (0, _extends2.default)({}, safeProps, {
|
|
79
|
+
component: props.component || _Header.Container // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
68
80
|
,
|
|
69
81
|
cssFn: cssFn
|
|
70
82
|
}));
|
|
@@ -7,16 +7,18 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = void 0;
|
|
10
|
+
exports.default = exports.Container = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
|
|
12
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
15
|
|
|
14
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
17
|
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
+
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
21
|
+
|
|
20
22
|
var _colors = require("@atlaskit/theme/colors");
|
|
21
23
|
|
|
22
24
|
var _typography = require("@atlaskit/theme/typography");
|
|
@@ -25,17 +27,54 @@ var _styles = require("../../common/styles");
|
|
|
25
27
|
|
|
26
28
|
var _Item = require("../Item");
|
|
27
29
|
|
|
28
|
-
var _excluded = ["children"]
|
|
30
|
+
var _excluded = ["children"],
|
|
31
|
+
_excluded2 = ["children"];
|
|
29
32
|
|
|
30
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
34
|
|
|
32
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* __Container__
|
|
39
|
+
*
|
|
40
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
41
|
+
*/
|
|
42
|
+
var Container = function Container(_ref) {
|
|
43
|
+
var children = _ref.children,
|
|
44
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
|
+
|
|
46
|
+
// https://stackoverflow.com/a/39333479
|
|
47
|
+
var safeProps = function (_ref2) {
|
|
48
|
+
var className = _ref2.className,
|
|
49
|
+
testId = _ref2['data-testid'],
|
|
50
|
+
onClick = _ref2.onClick,
|
|
51
|
+
onMouseDown = _ref2.onMouseDown,
|
|
52
|
+
onDragStart = _ref2.onDragStart,
|
|
53
|
+
draggable = _ref2.draggable,
|
|
54
|
+
ref = _ref2.ref,
|
|
55
|
+
tabIndex = _ref2.tabIndex,
|
|
56
|
+
disabled = _ref2.disabled;
|
|
57
|
+
return {
|
|
58
|
+
className: className,
|
|
59
|
+
testId: testId,
|
|
60
|
+
onClick: onClick,
|
|
61
|
+
onMouseDown: onMouseDown,
|
|
62
|
+
onDragStart: onDragStart,
|
|
63
|
+
draggable: draggable,
|
|
64
|
+
ref: ref,
|
|
65
|
+
tabIndex: tabIndex,
|
|
66
|
+
disabled: disabled
|
|
67
|
+
};
|
|
68
|
+
}(props);
|
|
69
|
+
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_box.default, (0, _extends2.default)({
|
|
71
|
+
as: "div",
|
|
72
|
+
display: "block"
|
|
73
|
+
}, safeProps), children);
|
|
37
74
|
};
|
|
38
75
|
|
|
76
|
+
exports.Container = Container;
|
|
77
|
+
|
|
39
78
|
/**
|
|
40
79
|
* __Header__
|
|
41
80
|
*
|
|
@@ -44,22 +83,22 @@ var Container = function Container(props) {
|
|
|
44
83
|
*/
|
|
45
84
|
var Header = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
46
85
|
var cssFn = (0, _styles.overrideStyleFunction)(function () {
|
|
47
|
-
var
|
|
86
|
+
var _ref3;
|
|
48
87
|
|
|
49
|
-
return
|
|
88
|
+
return _ref3 = {
|
|
50
89
|
userSelect: 'auto'
|
|
51
|
-
}, (0, _defineProperty2.default)(
|
|
90
|
+
}, (0, _defineProperty2.default)(_ref3, '[data-item-title]', {
|
|
52
91
|
fontSize: _typography.headingSizes.h400.size,
|
|
53
92
|
letterSpacing: '-0.003em',
|
|
54
93
|
fontWeight: 600,
|
|
55
94
|
color: "var(--ds-text, ".concat(_colors.N500, ")")
|
|
56
|
-
}), (0, _defineProperty2.default)(
|
|
57
|
-
backgroundColor:
|
|
95
|
+
}), (0, _defineProperty2.default)(_ref3, 'div&:hover', {
|
|
96
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
58
97
|
cursor: 'default'
|
|
59
|
-
}), (0, _defineProperty2.default)(
|
|
60
|
-
backgroundColor:
|
|
98
|
+
}), (0, _defineProperty2.default)(_ref3, 'div&:active', {
|
|
99
|
+
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
61
100
|
color: "var(--ds-text, ".concat(_colors.N500, ")")
|
|
62
|
-
}),
|
|
101
|
+
}), _ref3;
|
|
63
102
|
}, props.cssFn);
|
|
64
103
|
return /*#__PURE__*/_react.default.createElement(_Item.CustomItem, (0, _extends2.default)({}, props, {
|
|
65
104
|
ref: ref,
|
|
@@ -69,9 +108,9 @@ var Header = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
69
108
|
,
|
|
70
109
|
overrides: {
|
|
71
110
|
Title: {
|
|
72
|
-
render: function render(_,
|
|
73
|
-
var children =
|
|
74
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
111
|
+
render: function render(_, _ref4) {
|
|
112
|
+
var children = _ref4.children,
|
|
113
|
+
props = (0, _objectWithoutProperties2.default)(_ref4, _excluded2);
|
|
75
114
|
return /*#__PURE__*/_react.default.createElement("h2", props, children);
|
|
76
115
|
}
|
|
77
116
|
}
|
|
@@ -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,10 +19,14 @@ 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 item__
|
|
22
28
|
*
|
|
23
|
-
* A skeleton item can be used to reduce the perceived
|
|
29
|
+
* A skeleton item can be used to reduce the perceived loading time.
|
|
24
30
|
*
|
|
25
31
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
26
32
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -36,14 +42,14 @@ var SkeletonItem = function SkeletonItem(props) {
|
|
|
36
42
|
return /*#__PURE__*/_react.default.createElement(_menu.SkeletonItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
37
43
|
, (0, _extends2.default)({
|
|
38
44
|
cssFn: function cssFn() {
|
|
39
|
-
return {
|
|
40
|
-
|
|
41
|
-
paddingRight: _styles.ITEM_SIDE_PADDING,
|
|
45
|
+
return _objectSpread(_objectSpread({}, (0, _styles.sectionHeaderSpacingStyles)()), {}, {
|
|
46
|
+
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
42
47
|
'&&::before': {
|
|
43
|
-
|
|
44
|
-
marginRight:
|
|
48
|
+
height: "var(--ds-scale-300, 20px)",
|
|
49
|
+
marginRight: "var(--ds-scale-200, 18px)",
|
|
50
|
+
width: "var(--ds-scale-300, 20px)"
|
|
45
51
|
}
|
|
46
|
-
};
|
|
52
|
+
});
|
|
47
53
|
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
48
54
|
|
|
49
55
|
}, props));
|
|
@@ -50,10 +50,12 @@ var LoadingItems = function LoadingItems(_ref) {
|
|
|
50
50
|
key: "loading-section-".concat(isLoading),
|
|
51
51
|
duration: _motion.mediumDurationMs
|
|
52
52
|
}, function (motion, state) {
|
|
53
|
-
return (
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
54
|
+
(0, _react.jsx)("span", (0, _extends2.default)({}, motion, {
|
|
55
|
+
"data-testid": testId && "".concat(testId, "--").concat(state),
|
|
56
|
+
css: [baseMotionStyles, state === 'entering' && enteringStyles]
|
|
57
|
+
}), isLoading ? fallback : children)
|
|
58
|
+
);
|
|
57
59
|
}));
|
|
58
60
|
};
|
|
59
61
|
|
|
@@ -17,6 +17,8 @@ var _context = require("../NestableNavigationContent/context");
|
|
|
17
17
|
|
|
18
18
|
var _styles = require("./styles");
|
|
19
19
|
|
|
20
|
+
/* eslint-disable @repo/internal/react/use-primitives */
|
|
21
|
+
|
|
20
22
|
/** @jsx jsx */
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -29,7 +31,8 @@ var _styles = require("./styles");
|
|
|
29
31
|
*/
|
|
30
32
|
var NavigationContent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
31
33
|
var showTopScrollIndicator = props.showTopScrollIndicator,
|
|
32
|
-
children = props.children
|
|
34
|
+
children = props.children,
|
|
35
|
+
testId = props.testId;
|
|
33
36
|
|
|
34
37
|
var _useShouldNestedEleme = (0, _context.useShouldNestedElementRender)(),
|
|
35
38
|
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
@@ -40,12 +43,14 @@ var NavigationContent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
|
|
|
40
43
|
return children;
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
var typedRef = ref;
|
|
43
47
|
return (0, _react2.jsx)("div", {
|
|
44
|
-
ref:
|
|
48
|
+
ref: typedRef,
|
|
45
49
|
css: (0, _styles.outerContainerCSS)({
|
|
46
50
|
showTopScrollIndicator: showTopScrollIndicator,
|
|
47
51
|
scrollbarWidth: scrollbar.width
|
|
48
|
-
})
|
|
52
|
+
}),
|
|
53
|
+
"data-testid": testId
|
|
49
54
|
}, (0, _react2.jsx)("div", {
|
|
50
55
|
ref: scrollbar.ref,
|
|
51
56
|
css: (0, _styles.innerContainerCSS)({
|
|
@@ -26,17 +26,15 @@ var scrollIndicatorZIndex = 1;
|
|
|
26
26
|
var scrollIndicatorHeight = 2;
|
|
27
27
|
var scrollIndicatorBorderRadius = 1;
|
|
28
28
|
var containerPadding = (0, _constants.gridSize)();
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
|
|
30
|
+
var skeletonHeadingHeight = containerPadding;
|
|
31
|
+
var skeletonHeadingMarginOffset = 3; // Skeleton content is slightly shorter than the real content.
|
|
31
32
|
// Because of that we slightly increase the top margin to offset this so the
|
|
32
33
|
// containing size both real and skeleton always equal approx 30px.
|
|
33
34
|
|
|
34
|
-
var
|
|
35
|
-
var skeletonHeadingHeight = containerPadding;
|
|
36
|
-
var skeletonHeadingMarginOffset = 3;
|
|
37
|
-
var skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset; // We want to move the entire body up by 3px without affecting the height of the skeleton container.
|
|
35
|
+
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.
|
|
38
36
|
|
|
39
|
-
var skeletonHeadingBottomMargin =
|
|
37
|
+
var skeletonHeadingBottomMargin = containerPadding * 0.75 + skeletonHeadingMarginOffset;
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
* This outer container css contains the "real" scroll indicators which are
|
|
@@ -132,13 +130,13 @@ var containerCSS = function containerCSS(opts) {
|
|
|
132
130
|
// so the spacing between matches what it would be if the indicator was a "block" element.
|
|
133
131
|
// We use margin here so any child absolutely positioned elements are positioned correctly.
|
|
134
132
|
marginTop: opts.showTopScrollIndicator ? scrollIndicatorHeight : 0,
|
|
135
|
-
marginLeft:
|
|
136
|
-
marginRight:
|
|
133
|
+
marginLeft: "var(--ds-scale-100, 8px)",
|
|
134
|
+
marginRight: "var(--ds-scale-100, 8px)",
|
|
137
135
|
// Enables child absolutely positioned elements to be positioned relative to this element.
|
|
138
136
|
position: 'relative',
|
|
139
137
|
'& [data-ds--menu--heading-item]': {
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
marginBottom: "var(--ds-scale-075, 6px)",
|
|
139
|
+
marginTop: "var(--ds-scale-200, 20px)"
|
|
142
140
|
},
|
|
143
141
|
'& [data-ds--menu--skeleton-heading-item]': {
|
|
144
142
|
marginTop: skeletonHeadingTopMargin,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,14 +9,10 @@ exports.default = void 0;
|
|
|
7
9
|
|
|
8
10
|
var _react = require("@emotion/react");
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
11
13
|
|
|
12
14
|
/** @jsx jsx */
|
|
13
|
-
|
|
14
|
-
padding: (0, _constants.gridSize)(),
|
|
15
|
-
paddingBottom: (0, _constants.gridSize)() * 1.75,
|
|
16
|
-
position: 'relative'
|
|
17
|
-
});
|
|
15
|
+
|
|
18
16
|
/**
|
|
19
17
|
* __Navigation footer__
|
|
20
18
|
*
|
|
@@ -23,11 +21,15 @@ var footerStyles = (0, _react.css)({
|
|
|
23
21
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
24
22
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
25
23
|
*/
|
|
26
|
-
|
|
27
24
|
var NavigationFooter = function NavigationFooter(_ref) {
|
|
28
25
|
var children = _ref.children;
|
|
29
|
-
return (0, _react.jsx)(
|
|
30
|
-
|
|
26
|
+
return (0, _react.jsx)(_box.default, {
|
|
27
|
+
display: "block",
|
|
28
|
+
position: "relative",
|
|
29
|
+
padding: "scale.100",
|
|
30
|
+
UNSAFE_style: {
|
|
31
|
+
paddingBottom: "var(--ds-scale-200, 14px)"
|
|
32
|
+
}
|
|
31
33
|
}, children);
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,15 +9,10 @@ exports.default = void 0;
|
|
|
7
9
|
|
|
8
10
|
var _react = require("@emotion/react");
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
|
|
11
13
|
|
|
12
14
|
/** @jsx jsx */
|
|
13
|
-
|
|
14
|
-
paddingTop: (0, _constants.gridSize)() * 3,
|
|
15
|
-
paddingRight: (0, _constants.gridSize)(),
|
|
16
|
-
paddingBottom: (0, _constants.gridSize)(),
|
|
17
|
-
paddingLeft: (0, _constants.gridSize)()
|
|
18
|
-
});
|
|
15
|
+
|
|
19
16
|
/**
|
|
20
17
|
* __Navigation header__
|
|
21
18
|
*
|
|
@@ -24,12 +21,15 @@ var navigationHeaderStyles = (0, _react.css)({
|
|
|
24
21
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
25
22
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
26
23
|
*/
|
|
27
|
-
|
|
28
24
|
var NavigationHeader = function NavigationHeader(props) {
|
|
29
25
|
var children = props.children;
|
|
30
|
-
return (0, _react.jsx)(
|
|
26
|
+
return (0, _react.jsx)(_box.default, {
|
|
27
|
+
display: "block",
|
|
31
28
|
"data-navheader": true,
|
|
32
|
-
|
|
29
|
+
padding: "scale.100",
|
|
30
|
+
UNSAFE_style: {
|
|
31
|
+
paddingTop: "var(--ds-scale-300, 24px)"
|
|
32
|
+
}
|
|
33
33
|
}, children);
|
|
34
34
|
};
|
|
35
35
|
|
|
@@ -169,31 +169,35 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
return (
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
172
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
173
|
+
(0, _react2.jsx)("div", {
|
|
174
|
+
"data-testid": testId,
|
|
175
|
+
css: nestableNavigationContentStyles,
|
|
176
|
+
ref: containerRef,
|
|
177
|
+
tabIndex: -1,
|
|
178
|
+
onClick: manageFocus
|
|
179
|
+
}, (0, _react2.jsx)(_motion.ExitingPersistence, null, (0, _react2.jsx)(_nestingMotion.NestingMotion // Key is needed to have a unique react instance per stack name.
|
|
180
|
+
// This enables us to easily animate it in & out with exiting persistence.
|
|
181
|
+
, {
|
|
182
|
+
key: currentStackId,
|
|
183
|
+
enterFrom: transition === 'nesting' ? 'right' : 'left',
|
|
184
|
+
exitTo: transition === 'nesting' ? 'left' : 'right',
|
|
185
|
+
testId: testId && "".concat(testId, "-anim")
|
|
186
|
+
}, function (motion) {
|
|
187
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
188
|
+
(0, _react2.jsx)("div", (0, _extends2.default)({
|
|
189
|
+
css: nestingRootStyles
|
|
190
|
+
}, motion), (0, _react2.jsx)(_context.NestedContext.Provider, {
|
|
191
|
+
// This provider is inside the NestingMotion to ensure it keeps a stale
|
|
192
|
+
// reference to the previous value.
|
|
193
|
+
value: context
|
|
194
|
+
}, (0, _react2.jsx)(_NestingItem.default, {
|
|
195
|
+
title: "",
|
|
196
|
+
id: ROOT_ID
|
|
197
|
+
}, children)))
|
|
198
|
+
);
|
|
199
|
+
})))
|
|
200
|
+
);
|
|
197
201
|
};
|
|
198
202
|
|
|
199
203
|
var _default = NestableNavigationContent;
|