@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
|
@@ -150,31 +150,35 @@ var NestableNavigationContent = function NestableNavigationContent(props) {
|
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
return
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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 {
|
|
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
|
-
|
|
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(
|
|
112
|
-
|
|
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(
|
|
125
|
-
"data-custom-icon": true
|
|
126
|
-
|
|
127
|
-
"
|
|
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,
|
|
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(
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Section as MenuSection } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
4
|
+
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
5
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
6
|
// Type needed on props to extract types with extract react types.
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ var Section = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
27
27
|
,
|
|
28
28
|
overrides: {
|
|
29
29
|
HeadingItem: {
|
|
30
|
-
cssFn:
|
|
30
|
+
cssFn: sectionHeaderSpacingStyles
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}));
|
|
@@ -1,7 +1,13 @@
|
|
|
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 { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
4
|
-
import {
|
|
10
|
+
import { sectionHeaderSpacingStyles } from '../../common/styles';
|
|
5
11
|
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -22,10 +28,7 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(props) {
|
|
|
22
28
|
return /*#__PURE__*/React.createElement(MenuSkeletonHeadingItem // eslint-disable-next-line @atlaskit/design-system/no-deprecated-apis, @repo/internal/react/no-unsafe-overrides
|
|
23
29
|
, _extends({
|
|
24
30
|
cssFn: function cssFn() {
|
|
25
|
-
return {
|
|
26
|
-
paddingLeft: ITEM_SIDE_PADDING,
|
|
27
|
-
paddingRight: ITEM_SIDE_PADDING
|
|
28
|
-
};
|
|
31
|
+
return _objectSpread({}, sectionHeaderSpacingStyles());
|
|
29
32
|
} // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
30
33
|
|
|
31
34
|
}, 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
|
-
|
|
5
|
+
var sidebarMinWidth = '240px';
|
|
6
6
|
var sideNavStyles = css({
|
|
7
7
|
display: 'flex',
|
|
8
8
|
width: '100%',
|
|
9
|
-
minWidth:
|
|
9
|
+
minWidth: sidebarMinWidth,
|
|
10
10
|
height: '100%',
|
|
11
11
|
position: 'relative',
|
|
12
12
|
flexDirection: 'column',
|
|
@@ -28,11 +28,13 @@ var SideNavigation = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
28
28
|
var children = props.children,
|
|
29
29
|
testId = props.testId,
|
|
30
30
|
label = props.label;
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
32
|
+
jsx("nav", {
|
|
33
|
+
ref: ref,
|
|
34
|
+
"data-testid": testId,
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
css: sideNavStyles
|
|
37
|
+
}, children)
|
|
38
|
+
);
|
|
37
39
|
});
|
|
38
40
|
export default SideNavigation;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CSSFn, StatelessCSSFn } from '@atlaskit/menu';
|
|
2
|
-
export declare const ITEM_SIDE_PADDING: number;
|
|
3
2
|
/**
|
|
4
3
|
* Allows chaining of style functions on top of base style functions
|
|
5
4
|
* @param baseStyle the base custom cssFn
|
|
@@ -9,4 +8,4 @@ export declare const ITEM_SIDE_PADDING: number;
|
|
|
9
8
|
*/
|
|
10
9
|
export declare const overrideStyleFunction: <TState>(baseStyle: CSSFn<TState>, newStyle?: CSSFn<TState> | undefined) => CSSFn<TState>;
|
|
11
10
|
export declare const baseSideNavItemStyle: CSSFn;
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const sectionHeaderSpacingStyles: StatelessCSSFn;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { HeaderProps } from '../Header';
|
|
3
|
-
export type {
|
|
2
|
+
import { HeaderProps as FooterProps } from '../Header';
|
|
3
|
+
export type { FooterProps };
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* __Footer__
|
|
6
6
|
*
|
|
7
7
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
|
|
8
8
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
9
9
|
*/
|
|
10
|
-
declare const Footer: (props:
|
|
10
|
+
declare const Footer: (props: FooterProps) => JSX.Element;
|
|
11
11
|
export default Footer;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CSSFn, CustomItemComponentProps } from '@atlaskit/menu';
|
|
3
|
+
/**
|
|
4
|
+
* __Container__
|
|
5
|
+
*
|
|
6
|
+
* A container for Header and Footer that safely handles props to the child component
|
|
7
|
+
*/
|
|
8
|
+
export declare const Container: React.FC<CustomItemComponentProps>;
|
|
3
9
|
export interface HeaderProps {
|
|
4
10
|
/**
|
|
5
11
|
* A function that can be used to override the styles of the component.
|
|
@@ -4,7 +4,7 @@ export type { SkeletonItemProps } from '@atlaskit/menu';
|
|
|
4
4
|
/**
|
|
5
5
|
* __Skeleton item__
|
|
6
6
|
*
|
|
7
|
-
* A skeleton item can be used to reduce the perceived
|
|
7
|
+
* A skeleton item can be used to reduce the perceived loading time.
|
|
8
8
|
*
|
|
9
9
|
* - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
|
|
10
10
|
* - [Code](https://atlassian.design/components/side-navigation/code)
|
|
@@ -76,12 +76,12 @@ export declare const innerContainerCSS: (opts: StyleOpts) => {
|
|
|
76
76
|
};
|
|
77
77
|
export declare const containerCSS: (opts: StyleOpts) => {
|
|
78
78
|
readonly marginTop: 0 | 2;
|
|
79
|
-
readonly marginLeft:
|
|
80
|
-
readonly marginRight:
|
|
79
|
+
readonly marginLeft: "var(--ds-scale-100)";
|
|
80
|
+
readonly marginRight: "var(--ds-scale-100)";
|
|
81
81
|
readonly position: "relative";
|
|
82
82
|
readonly '& [data-ds--menu--heading-item]': {
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
83
|
+
readonly marginBottom: "var(--ds-scale-075)";
|
|
84
|
+
readonly marginTop: "var(--ds-scale-200)";
|
|
85
85
|
};
|
|
86
86
|
readonly '& [data-ds--menu--skeleton-heading-item]': {
|
|
87
87
|
readonly marginTop: number;
|
package/docs/00-intro.tsx
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/side-navigation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "A highly composable side navigation component that supports nested views.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@atlaskit/ds-explorations": "^1.1.0",
|
|
28
29
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
29
30
|
"@atlaskit/icon": "^21.11.0",
|
|
30
31
|
"@atlaskit/menu": "^1.4.0",
|
|
31
32
|
"@atlaskit/motion": "^1.3.0",
|
|
32
33
|
"@atlaskit/theme": "^12.2.0",
|
|
33
|
-
"@atlaskit/tokens": "^0.
|
|
34
|
+
"@atlaskit/tokens": "^0.13.0",
|
|
34
35
|
"@babel/runtime": "^7.0.0",
|
|
35
36
|
"@emotion/react": "^11.7.1"
|
|
36
37
|
},
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"@atlaskit/logo": "^13.10.0",
|
|
45
46
|
"@atlaskit/onboarding": "^10.6.0",
|
|
46
47
|
"@atlaskit/section-message": "^6.3.0",
|
|
47
|
-
"@atlaskit/select": "^16.
|
|
48
|
+
"@atlaskit/select": "^16.1.0",
|
|
48
49
|
"@atlaskit/visual-regression": "*",
|
|
49
50
|
"@atlaskit/webdriver-runner": "*",
|
|
50
51
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -65,7 +66,13 @@
|
|
|
65
66
|
"@repo/internal": {
|
|
66
67
|
"design-system": "v1",
|
|
67
68
|
"dom-events": "use-bind-event-listener",
|
|
68
|
-
"ui-components":
|
|
69
|
+
"ui-components": [
|
|
70
|
+
"primitives",
|
|
71
|
+
"lite-mode"
|
|
72
|
+
],
|
|
73
|
+
"design-tokens": [
|
|
74
|
+
"spacing"
|
|
75
|
+
],
|
|
69
76
|
"analytics": "analytics-next",
|
|
70
77
|
"theming": "tokens",
|
|
71
78
|
"deprecation": "no-deprecated-imports"
|
package/report.api.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- API Report Version: 2.
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/side-navigation"
|
|
4
4
|
|
|
@@ -159,6 +159,7 @@ export interface NestableNavigationContentProps {
|
|
|
159
159
|
children: JSX.Element | JSX.Element[];
|
|
160
160
|
initialStack?: string[];
|
|
161
161
|
onChange?: (stack: string[]) => void;
|
|
162
|
+
onUnknownNest?: (stack: string[]) => void;
|
|
162
163
|
// @deprecated
|
|
163
164
|
overrides?: {
|
|
164
165
|
GoBackItem?: {
|