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