@atlaskit/side-navigation 11.1.14 → 11.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/components/Item/button-item.js +2 -2
- package/dist/cjs/components/Item/custom-item.js +2 -2
- package/dist/cjs/components/Item/link-item.js +2 -2
- package/dist/cjs/components/Item/skeleton-item.js +2 -2
- package/dist/cjs/components/LoadingItems/index.js +2 -2
- package/dist/cjs/components/NavigationContent/container-css.js +33 -0
- package/dist/cjs/components/NavigationContent/index.js +2 -2
- package/dist/cjs/components/NavigationContent/inner-container-css.js +51 -0
- package/dist/cjs/components/NavigationContent/outer-container-css.js +44 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +2 -2
- package/dist/cjs/components/NestableNavigationContent/nested-context.js +10 -0
- package/dist/cjs/components/NestableNavigationContent/use-nested-context.js +19 -0
- package/dist/cjs/components/NestableNavigationContent/use-should-nested-element-render.js +19 -0
- package/dist/cjs/components/NestingItem/index.js +4 -3
- package/dist/cjs/components/Section/heading-item.js +2 -3
- package/dist/cjs/components/Section/section.js +2 -2
- package/dist/cjs/components/Section/skeleton-heading-item.js +2 -3
- package/dist/cjs/index.js +8 -6
- package/dist/es2019/components/Item/button-item.js +1 -1
- package/dist/es2019/components/Item/custom-item.js +1 -1
- package/dist/es2019/components/Item/go-back-item.js +1 -0
- package/dist/es2019/components/Item/link-item.js +1 -1
- package/dist/es2019/components/Item/skeleton-item.js +2 -1
- package/dist/es2019/components/LoadingItems/index.js +1 -1
- package/dist/es2019/components/NavigationContent/container-css.js +25 -0
- package/dist/es2019/components/NavigationContent/index.js +1 -1
- package/dist/es2019/components/NavigationContent/inner-container-css.js +41 -0
- package/dist/es2019/components/NavigationContent/outer-container-css.js +36 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +1 -1
- package/dist/es2019/components/NestableNavigationContent/nested-context.js +3 -0
- package/dist/es2019/components/NestableNavigationContent/use-nested-context.js +18 -0
- package/dist/es2019/components/NestableNavigationContent/use-should-nested-element-render.js +13 -0
- package/dist/es2019/components/NestingItem/index.js +2 -1
- package/dist/es2019/components/Section/heading-item.js +1 -2
- package/dist/es2019/components/Section/section.js +1 -1
- package/dist/es2019/components/Section/skeleton-heading-item.js +1 -2
- package/dist/es2019/index.js +4 -2
- package/dist/esm/components/Item/button-item.js +1 -1
- package/dist/esm/components/Item/custom-item.js +1 -1
- package/dist/esm/components/Item/go-back-item.js +1 -0
- package/dist/esm/components/Item/link-item.js +1 -1
- package/dist/esm/components/Item/skeleton-item.js +2 -1
- package/dist/esm/components/LoadingItems/index.js +1 -1
- package/dist/esm/components/NavigationContent/container-css.js +27 -0
- package/dist/esm/components/NavigationContent/index.js +1 -1
- package/dist/esm/components/NavigationContent/inner-container-css.js +44 -0
- package/dist/esm/components/NavigationContent/outer-container-css.js +38 -0
- package/dist/esm/components/NestableNavigationContent/index.js +1 -1
- package/dist/esm/components/NestableNavigationContent/nested-context.js +3 -0
- package/dist/esm/components/NestableNavigationContent/use-nested-context.js +13 -0
- package/dist/esm/components/NestableNavigationContent/use-should-nested-element-render.js +13 -0
- package/dist/esm/components/NestingItem/index.js +2 -1
- package/dist/esm/components/Section/heading-item.js +1 -2
- package/dist/esm/components/Section/section.js +1 -1
- package/dist/esm/components/Section/skeleton-heading-item.js +1 -2
- package/dist/esm/index.js +4 -2
- package/dist/types/components/Item/button-item.d.ts +0 -1
- package/dist/types/components/Item/custom-item.d.ts +3 -2
- package/dist/types/components/Item/go-back-item.d.ts +0 -1
- package/dist/types/components/Item/link-item.d.ts +0 -1
- package/dist/types/components/Item/skeleton-item.d.ts +0 -1
- package/dist/types/components/NavigationContent/container-css.d.ts +18 -0
- package/dist/types/components/NavigationContent/inner-container-css.d.ts +34 -0
- package/dist/types/components/NavigationContent/outer-container-css.d.ts +36 -0
- package/dist/types/components/NestableNavigationContent/{context.d.ts → nested-context.d.ts} +0 -15
- package/dist/types/components/NestableNavigationContent/use-nested-context.d.ts +2 -0
- package/dist/types/components/NestableNavigationContent/use-should-nested-element-render.d.ts +3 -0
- package/dist/types/components/Section/heading-item.d.ts +3 -2
- package/dist/types/components/Section/skeleton-heading-item.d.ts +3 -2
- package/dist/types/index.d.ts +12 -8
- package/dist/types-ts4.5/components/Item/button-item.d.ts +0 -1
- package/dist/types-ts4.5/components/Item/custom-item.d.ts +3 -2
- package/dist/types-ts4.5/components/Item/go-back-item.d.ts +0 -1
- package/dist/types-ts4.5/components/Item/link-item.d.ts +0 -1
- package/dist/types-ts4.5/components/Item/skeleton-item.d.ts +0 -1
- package/dist/types-ts4.5/components/NavigationContent/container-css.d.ts +18 -0
- package/dist/types-ts4.5/components/NavigationContent/inner-container-css.d.ts +34 -0
- package/dist/types-ts4.5/components/NavigationContent/outer-container-css.d.ts +36 -0
- package/dist/types-ts4.5/components/NestableNavigationContent/{context.d.ts → nested-context.d.ts} +0 -15
- package/dist/types-ts4.5/components/NestableNavigationContent/use-nested-context.d.ts +2 -0
- package/dist/types-ts4.5/components/NestableNavigationContent/use-should-nested-element-render.d.ts +3 -0
- package/dist/types-ts4.5/components/Section/heading-item.d.ts +3 -2
- package/dist/types-ts4.5/components/Section/skeleton-heading-item.d.ts +3 -2
- package/dist/types-ts4.5/index.d.ts +12 -8
- package/package.json +6 -6
- package/dist/cjs/components/NavigationContent/styles.js +0 -127
- package/dist/cjs/components/NestableNavigationContent/context.js +0 -43
- package/dist/cjs/components/Section/index.js +0 -27
- package/dist/es2019/components/NavigationContent/styles.js +0 -113
- package/dist/es2019/components/NestableNavigationContent/context.js +0 -43
- package/dist/es2019/components/Section/index.js +0 -3
- package/dist/esm/components/NavigationContent/styles.js +0 -120
- package/dist/esm/components/NestableNavigationContent/context.js +0 -38
- package/dist/esm/components/Section/index.js +0 -3
- package/dist/types/components/NavigationContent/styles.d.ts +0 -91
- package/dist/types/components/Section/index.d.ts +0 -6
- package/dist/types-ts4.5/components/NavigationContent/styles.d.ts +0 -91
- package/dist/types-ts4.5/components/Section/index.d.ts +0 -6
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { VAR_SEPARATOR_COLOR } from '../../common/constants';
|
|
2
|
+
const scrollIndicatorZIndex = 1;
|
|
3
|
+
const scrollIndicatorHeight = 2;
|
|
4
|
+
const scrollIndicatorBorderRadius = '1px';
|
|
5
|
+
const containerPadding = 8;
|
|
6
|
+
export const outerContainerCSS = opts => ({
|
|
7
|
+
// Flex is needed to ensure the overflow indicators are positioned correctly.
|
|
8
|
+
display: 'flex',
|
|
9
|
+
height: '100%',
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
'&::before': {
|
|
13
|
+
content: "''",
|
|
14
|
+
display: 'block',
|
|
15
|
+
left: "var(--ds-space-100, 8px)",
|
|
16
|
+
right: containerPadding + opts.scrollbarWidth,
|
|
17
|
+
height: scrollIndicatorHeight,
|
|
18
|
+
borderRadius: `var(--ds-radius-xsmall, ${scrollIndicatorBorderRadius})`,
|
|
19
|
+
backgroundColor: `var(${VAR_SEPARATOR_COLOR}, ${"var(--ds-border, #0B120E24)"})`,
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
zIndex: scrollIndicatorZIndex
|
|
22
|
+
},
|
|
23
|
+
'&::after': {
|
|
24
|
+
content: "''",
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
display: 'block',
|
|
27
|
+
borderRadius: `var(--ds-radius-xsmall, ${scrollIndicatorBorderRadius})`,
|
|
28
|
+
flexShrink: 0,
|
|
29
|
+
height: scrollIndicatorHeight,
|
|
30
|
+
left: "var(--ds-space-100, 8px)",
|
|
31
|
+
right: containerPadding + opts.scrollbarWidth,
|
|
32
|
+
bottom: 0,
|
|
33
|
+
zIndex: scrollIndicatorZIndex,
|
|
34
|
+
backgroundColor: `var(${VAR_SEPARATOR_COLOR}, ${"var(--ds-border, #0B120E24)"})`
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
import useChildIds from '../../common/use-child-ids';
|
|
9
9
|
import GoBackButton from '../Item/go-back-item';
|
|
10
10
|
import { default as NestingItem } from '../NestingItem';
|
|
11
|
-
import { NestedContext } from './context';
|
|
11
|
+
import { NestedContext } from './nested-context';
|
|
12
12
|
import { NestingMotion } from './nesting-motion';
|
|
13
13
|
// Named so ERT doesn't pick up the override name as a type.
|
|
14
14
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { NestedContext } from './nested-context';
|
|
3
|
+
export const useNestedContext = () => {
|
|
4
|
+
const context = useContext(NestedContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
let error = '';
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
error = `
|
|
9
|
+
To use a <NestingItem /> it needs to be a descendant of <NestableNavigationContent>.
|
|
10
|
+
You probably need to replace your <NavigationContent> with <NestableNavigationContent>.
|
|
11
|
+
|
|
12
|
+
import { NestableNavigationContent } from '@atlaskit/side-navigation';
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
throw new Error(error);
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { NestedContext } from './nested-context';
|
|
3
|
+
export const useShouldNestedElementRender = () => {
|
|
4
|
+
const context = useContext(NestedContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
return {
|
|
7
|
+
shouldRender: true
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
shouldRender: context.currentStackId === context.parentId
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -11,7 +11,8 @@ import ButtonItem from '../Item/button-item';
|
|
|
11
11
|
import CustomItem from '../Item/custom-item';
|
|
12
12
|
import NavigationContent from '../NavigationContent';
|
|
13
13
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
14
|
-
import { NestedContext
|
|
14
|
+
import { NestedContext } from '../NestableNavigationContent/nested-context';
|
|
15
|
+
import { useNestedContext } from '../NestableNavigationContent/use-nested-context';
|
|
15
16
|
const styles = {
|
|
16
17
|
iconContainer: "_1e0c1nu9",
|
|
17
18
|
nestingItem: "_udl3glyw _kqsfglyw _udrwglyw _13qvglyw _9mqr1kw7 _povs1kw7 _uv2d1kw7 _atks1kw7",
|
|
@@ -4,11 +4,10 @@ import "./heading-item.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { HeadingItem as MenuHeadingItem } from '@atlaskit/menu';
|
|
7
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
7
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
8
8
|
const styles = {
|
|
9
9
|
headingItem: "_18zru2gc"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* __Heading item__
|
|
14
13
|
*
|
|
@@ -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 { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
4
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
5
5
|
/**
|
|
6
6
|
* __Section__
|
|
7
7
|
*
|
|
@@ -4,11 +4,10 @@ import "./skeleton-heading-item.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
7
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
7
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
8
8
|
const styles = {
|
|
9
9
|
root: "_18zru2gc"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* __Skeleton heading item__
|
|
14
13
|
*
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as SideNavigation } from './components/SideNavigation';
|
|
2
|
-
export {
|
|
2
|
+
export { default as Section } from './components/Section/section';
|
|
3
|
+
export { default as HeadingItem } from './components/Section/heading-item';
|
|
4
|
+
export { default as SkeletonHeadingItem } from './components/Section/skeleton-heading-item';
|
|
3
5
|
export { default as NestingItem } from './components/NestingItem';
|
|
4
6
|
export { default as NavigationContent } from './components/NavigationContent';
|
|
5
7
|
export { default as ButtonItem } from './components/Item/button-item';
|
|
@@ -13,5 +15,5 @@ export { default as NavigationHeader } from './components/NavigationHeader';
|
|
|
13
15
|
export { default as NavigationFooter } from './components/NavigationFooter';
|
|
14
16
|
export { default as LoadingItems } from './components/LoadingItems';
|
|
15
17
|
export { default as NestableNavigationContent } from './components/NestableNavigationContent';
|
|
16
|
-
export { useShouldNestedElementRender } from './components/NestableNavigationContent/
|
|
18
|
+
export { useShouldNestedElementRender } from './components/NestableNavigationContent/use-should-nested-element-render';
|
|
17
19
|
export { VAR_SCROLL_INDICATOR_COLOR, VAR_SEPARATOR_COLOR } from './common/constants';
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
9
|
import { ButtonItem as Button } from '@atlaskit/menu';
|
|
10
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
10
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
11
11
|
var styles = {
|
|
12
12
|
root: "_2rkofajl _1rjcu2gc _18zru2gc _bfhksm61 _1a391k8s _racp1k8s _30l3azsu _irr31dpa _ppn2azsu _183jfcek",
|
|
13
13
|
selectedStyles: "_bfhk15s3 _syaz6x5g _10536x5g _irr3ufnl _30l36x5g _1di6nozp _9h8h6x5g"
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
9
|
import { CustomItem as Custom } from '@atlaskit/menu';
|
|
10
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
10
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
11
11
|
var styles = {
|
|
12
12
|
root: "_2rkofajl _1rjcu2gc _18zru2gc _bfhksm61 _1a391k8s _racp1k8s _30l3azsu _irr31dpa _ppn2azsu _183jfcek",
|
|
13
13
|
selectedStyles: "_bfhk15s3 _syaz6x5g _10536x5g _irr3ufnl _30l36x5g _1di6nozp _9h8h6x5g"
|
|
@@ -5,6 +5,7 @@ var _excluded = ["className", "iconBefore", "onClick", "isSelected"];
|
|
|
5
5
|
import React, { forwardRef, useCallback, useState } from 'react';
|
|
6
6
|
import ArrowLeftIcon from '@atlaskit/icon/core/arrow-left';
|
|
7
7
|
import ButtonItem from './button-item';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* __Go back item__
|
|
10
11
|
*
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
9
|
import { LinkItem as Link } from '@atlaskit/menu';
|
|
10
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
10
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
11
11
|
var styles = {
|
|
12
12
|
root: "_2rkofajl _1rjcu2gc _18zru2gc _bfhksm61 _1a391k8s _racp1k8s _30l3azsu _irr31dpa _ppn2azsu _183jfcek",
|
|
13
13
|
selectedStyles: "_bfhk15s3 _syaz6x5g _10536x5g _irr3ufnl _30l36x5g _1di6nozp _9h8h6x5g"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
4
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
4
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* __Skeleton item__
|
|
7
8
|
*
|
|
@@ -4,7 +4,7 @@ import "./index.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
7
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
7
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
8
8
|
var baseMotionStyles = null;
|
|
9
9
|
var enteringStyles = null;
|
|
10
10
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var containerPadding = 8;
|
|
2
|
+
var scrollIndicatorHeight = 2;
|
|
3
|
+
var itemHeadingContentHeight = 16; // Originally headingSizes.h100.lineHeight from '@atlaskit/theme/typography'
|
|
4
|
+
var skeletonHeadingHeight = containerPadding;
|
|
5
|
+
var skeletonHeadingMarginOffset = 3;
|
|
6
|
+
var skeletonHeadingTopMargin = containerPadding * 2.5 + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
|
|
7
|
+
var skeletonHeadingBottomMargin = containerPadding * 0.75 + skeletonHeadingMarginOffset;
|
|
8
|
+
export var containerCSS = function containerCSS(opts) {
|
|
9
|
+
return {
|
|
10
|
+
// When the scroll indicator is always shown we need to add some padding
|
|
11
|
+
// so the spacing between matches what it would be if the indicator was a "block" element.
|
|
12
|
+
// We use margin here so any child absolutely positioned elements are positioned correctly.
|
|
13
|
+
marginTop: opts.showTopScrollIndicator ? scrollIndicatorHeight : 0,
|
|
14
|
+
marginLeft: "var(--ds-space-100, 8px)",
|
|
15
|
+
marginRight: "var(--ds-space-100, 8px)",
|
|
16
|
+
// Enables child absolutely positioned elements to be positioned relative to this element.
|
|
17
|
+
position: 'relative',
|
|
18
|
+
'& [data-ds--menu--heading-item]': {
|
|
19
|
+
marginBottom: "var(--ds-space-075, 6px)",
|
|
20
|
+
marginTop: "var(--ds-space-200, 16px)"
|
|
21
|
+
},
|
|
22
|
+
'& [data-ds--menu--skeleton-heading-item]': {
|
|
23
|
+
marginTop: skeletonHeadingTopMargin,
|
|
24
|
+
marginBottom: skeletonHeadingBottomMargin
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -3,7 +3,7 @@ import "./index.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import useScrollbarWidth from '@atlaskit/ds-lib/use-scrollbar-width';
|
|
6
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
6
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
7
7
|
var outerContainerCSS = null;
|
|
8
8
|
var innerContainerCSS = {
|
|
9
9
|
basic: "_1reo1wug _18m91wug _1e0c1txw _vchhusvi _1bsb1osq _kqswh2mm _2lx21bp4 _14mjlb4i _1ywu1ule _1qdgyh40 _18poh2mm _1bqqcs5v _tua5idpf _1hfk1q2g _aetrb3bt _3mxo1wug",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { VAR_SCROLL_INDICATOR_COLOR } from '../../common/constants';
|
|
5
|
+
var scrollIndicatorMaskZIndex = 2;
|
|
6
|
+
var scrollIndicatorHeight = 2;
|
|
7
|
+
var scrollIndicatorBorderRadius = '1px';
|
|
8
|
+
export var innerContainerCSS = function innerContainerCSS(opts) {
|
|
9
|
+
return _objectSpread(_objectSpread({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
overflow: 'auto',
|
|
12
|
+
width: '100%',
|
|
13
|
+
position: 'relative',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
flexDirection: 'column'
|
|
16
|
+
}, !opts.showTopScrollIndicator && {
|
|
17
|
+
'&::before': {
|
|
18
|
+
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
|
|
19
|
+
content: "''",
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
height: scrollIndicatorHeight,
|
|
23
|
+
backgroundColor: "var(".concat(VAR_SCROLL_INDICATOR_COLOR, ", ", "var(--ds-surface, #FFFFFF)", ")"),
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
display: 'block',
|
|
26
|
+
zIndex: scrollIndicatorMaskZIndex
|
|
27
|
+
}
|
|
28
|
+
}), {}, {
|
|
29
|
+
// This after pseudo element abuses being a flex child and pushes itself down to the
|
|
30
|
+
// very bottom of the container - doing so ends up "masking" the actual scroll indicator.
|
|
31
|
+
'&::after': {
|
|
32
|
+
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
|
|
33
|
+
content: "''",
|
|
34
|
+
display: 'block',
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
height: scrollIndicatorHeight,
|
|
37
|
+
// This is used to "push" the element to the bottom of the flex container.
|
|
38
|
+
marginTop: 'auto',
|
|
39
|
+
position: 'relative',
|
|
40
|
+
zIndex: scrollIndicatorMaskZIndex,
|
|
41
|
+
backgroundColor: "var(".concat(VAR_SCROLL_INDICATOR_COLOR, ", ", "var(--ds-surface, #FFFFFF)", ")")
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { VAR_SEPARATOR_COLOR } from '../../common/constants';
|
|
2
|
+
var scrollIndicatorZIndex = 1;
|
|
3
|
+
var scrollIndicatorHeight = 2;
|
|
4
|
+
var scrollIndicatorBorderRadius = '1px';
|
|
5
|
+
var containerPadding = 8;
|
|
6
|
+
export var outerContainerCSS = function outerContainerCSS(opts) {
|
|
7
|
+
return {
|
|
8
|
+
// Flex is needed to ensure the overflow indicators are positioned correctly.
|
|
9
|
+
display: 'flex',
|
|
10
|
+
height: '100%',
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
position: 'relative',
|
|
13
|
+
'&::before': {
|
|
14
|
+
content: "''",
|
|
15
|
+
display: 'block',
|
|
16
|
+
left: "var(--ds-space-100, 8px)",
|
|
17
|
+
right: containerPadding + opts.scrollbarWidth,
|
|
18
|
+
height: scrollIndicatorHeight,
|
|
19
|
+
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
|
|
20
|
+
backgroundColor: "var(".concat(VAR_SEPARATOR_COLOR, ", ", "var(--ds-border, #0B120E24)", ")"),
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
zIndex: scrollIndicatorZIndex
|
|
23
|
+
},
|
|
24
|
+
'&::after': {
|
|
25
|
+
content: "''",
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
display: 'block',
|
|
28
|
+
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
|
|
29
|
+
flexShrink: 0,
|
|
30
|
+
height: scrollIndicatorHeight,
|
|
31
|
+
left: "var(--ds-space-100, 8px)",
|
|
32
|
+
right: containerPadding + opts.scrollbarWidth,
|
|
33
|
+
bottom: 0,
|
|
34
|
+
zIndex: scrollIndicatorZIndex,
|
|
35
|
+
backgroundColor: "var(".concat(VAR_SEPARATOR_COLOR, ", ", "var(--ds-border, #0B120E24)", ")")
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -9,7 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
9
9
|
import useChildIds from '../../common/use-child-ids';
|
|
10
10
|
import GoBackButton from '../Item/go-back-item';
|
|
11
11
|
import { default as NestingItem } from '../NestingItem';
|
|
12
|
-
import { NestedContext } from './context';
|
|
12
|
+
import { NestedContext } from './nested-context';
|
|
13
13
|
import { NestingMotion } from './nesting-motion';
|
|
14
14
|
// Named so ERT doesn't pick up the override name as a type.
|
|
15
15
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { NestedContext } from './nested-context';
|
|
3
|
+
export var useNestedContext = function useNestedContext() {
|
|
4
|
+
var context = useContext(NestedContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
var error = '';
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
error = "\nTo use a <NestingItem /> it needs to be a descendant of <NestableNavigationContent>.\nYou probably need to replace your <NavigationContent> with <NestableNavigationContent>.\n\nimport { NestableNavigationContent } from '@atlaskit/side-navigation';\n ";
|
|
9
|
+
}
|
|
10
|
+
throw new Error(error);
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { NestedContext } from './nested-context';
|
|
3
|
+
export var useShouldNestedElementRender = function useShouldNestedElementRender() {
|
|
4
|
+
var context = useContext(NestedContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
return {
|
|
7
|
+
shouldRender: true
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
shouldRender: context.currentStackId === context.parentId
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -18,7 +18,8 @@ import ButtonItem from '../Item/button-item';
|
|
|
18
18
|
import CustomItem from '../Item/custom-item';
|
|
19
19
|
import NavigationContent from '../NavigationContent';
|
|
20
20
|
import { ROOT_ID } from '../NestableNavigationContent';
|
|
21
|
-
import { NestedContext
|
|
21
|
+
import { NestedContext } from '../NestableNavigationContent/nested-context';
|
|
22
|
+
import { useNestedContext } from '../NestableNavigationContent/use-nested-context';
|
|
22
23
|
var styles = {
|
|
23
24
|
iconContainer: "_1e0c1nu9",
|
|
24
25
|
nestingItem: "_udl3glyw _kqsfglyw _udrwglyw _13qvglyw _9mqr1kw7 _povs1kw7 _uv2d1kw7 _atks1kw7",
|
|
@@ -4,11 +4,10 @@ import "./heading-item.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { HeadingItem as MenuHeadingItem } from '@atlaskit/menu';
|
|
7
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
7
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
8
8
|
var styles = {
|
|
9
9
|
headingItem: "_18zru2gc"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* __Heading item__
|
|
14
13
|
*
|
|
@@ -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 { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
4
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
5
5
|
/**
|
|
6
6
|
* __Section__
|
|
7
7
|
*
|
|
@@ -4,11 +4,10 @@ import "./skeleton-heading-item.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
7
|
-
import { useShouldNestedElementRender } from '../NestableNavigationContent/
|
|
7
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render';
|
|
8
8
|
var styles = {
|
|
9
9
|
root: "_18zru2gc"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* __Skeleton heading item__
|
|
14
13
|
*
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as SideNavigation } from './components/SideNavigation';
|
|
2
|
-
export {
|
|
2
|
+
export { default as Section } from './components/Section/section';
|
|
3
|
+
export { default as HeadingItem } from './components/Section/heading-item';
|
|
4
|
+
export { default as SkeletonHeadingItem } from './components/Section/skeleton-heading-item';
|
|
3
5
|
export { default as NestingItem } from './components/NestingItem';
|
|
4
6
|
export { default as NavigationContent } from './components/NavigationContent';
|
|
5
7
|
export { default as ButtonItem } from './components/Item/button-item';
|
|
@@ -13,5 +15,5 @@ export { default as NavigationHeader } from './components/NavigationHeader';
|
|
|
13
15
|
export { default as NavigationFooter } from './components/NavigationFooter';
|
|
14
16
|
export { default as LoadingItems } from './components/LoadingItems';
|
|
15
17
|
export { default as NestableNavigationContent } from './components/NestableNavigationContent';
|
|
16
|
-
export { useShouldNestedElementRender } from './components/NestableNavigationContent/
|
|
18
|
+
export { useShouldNestedElementRender } from './components/NestableNavigationContent/use-should-nested-element-render';
|
|
17
19
|
export { VAR_SCROLL_INDICATOR_COLOR, VAR_SEPARATOR_COLOR } from './common/constants';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export
|
|
1
|
+
import { type CustomItemProps, type CustomItemComponentProps as MenuCustomItemComponentProps } from '@atlaskit/menu';
|
|
2
|
+
export interface CustomItemComponentProps extends MenuCustomItemComponentProps {
|
|
3
|
+
}
|
|
3
4
|
interface CustomItemPropsHack {
|
|
4
5
|
<TComponentProps extends {}>(props: CustomItemProps<TComponentProps> & {
|
|
5
6
|
ref?: any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface StyleOpts {
|
|
2
|
+
showTopScrollIndicator?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const containerCSS: (opts: StyleOpts) => {
|
|
5
|
+
readonly marginTop: 0 | 2;
|
|
6
|
+
readonly marginLeft: "var(--ds-space-100)";
|
|
7
|
+
readonly marginRight: "var(--ds-space-100)";
|
|
8
|
+
readonly position: "relative";
|
|
9
|
+
readonly "& [data-ds--menu--heading-item]": {
|
|
10
|
+
readonly marginBottom: "var(--ds-space-075)";
|
|
11
|
+
readonly marginTop: "var(--ds-space-200)";
|
|
12
|
+
};
|
|
13
|
+
readonly "& [data-ds--menu--skeleton-heading-item]": {
|
|
14
|
+
readonly marginTop: number;
|
|
15
|
+
readonly marginBottom: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface StyleOpts {
|
|
2
|
+
showTopScrollIndicator?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const innerContainerCSS: (opts: StyleOpts) => {
|
|
5
|
+
readonly "&::after": {
|
|
6
|
+
readonly borderRadius: "var(--ds-radius-xsmall)";
|
|
7
|
+
readonly content: "''";
|
|
8
|
+
readonly display: "block";
|
|
9
|
+
readonly flexShrink: 0;
|
|
10
|
+
readonly height: 2;
|
|
11
|
+
readonly marginTop: "auto";
|
|
12
|
+
readonly position: "relative";
|
|
13
|
+
readonly zIndex: 2;
|
|
14
|
+
readonly backgroundColor: "var(--ds-menu-scroll-indicator-color, var(--ds-surface))";
|
|
15
|
+
};
|
|
16
|
+
readonly "&::before"?: {
|
|
17
|
+
readonly borderRadius: "var(--ds-radius-xsmall)";
|
|
18
|
+
readonly content: "''";
|
|
19
|
+
readonly left: 0;
|
|
20
|
+
readonly right: 0;
|
|
21
|
+
readonly height: 2;
|
|
22
|
+
readonly backgroundColor: "var(--ds-menu-scroll-indicator-color, var(--ds-surface))";
|
|
23
|
+
readonly position: "absolute";
|
|
24
|
+
readonly display: "block";
|
|
25
|
+
readonly zIndex: 2;
|
|
26
|
+
} | undefined;
|
|
27
|
+
readonly display: "flex";
|
|
28
|
+
readonly overflow: "auto";
|
|
29
|
+
readonly width: "100%";
|
|
30
|
+
readonly position: "relative";
|
|
31
|
+
readonly boxSizing: "border-box";
|
|
32
|
+
readonly flexDirection: "column";
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface StyleOpts {
|
|
2
|
+
showTopScrollIndicator?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const outerContainerCSS: (opts: StyleOpts & {
|
|
5
|
+
scrollbarWidth: number;
|
|
6
|
+
}) => {
|
|
7
|
+
readonly display: "flex";
|
|
8
|
+
readonly height: "100%";
|
|
9
|
+
readonly overflow: "hidden";
|
|
10
|
+
readonly position: "relative";
|
|
11
|
+
readonly "&::before": {
|
|
12
|
+
readonly content: "''";
|
|
13
|
+
readonly display: "block";
|
|
14
|
+
readonly left: "var(--ds-space-100)";
|
|
15
|
+
readonly right: number;
|
|
16
|
+
readonly height: 2;
|
|
17
|
+
readonly borderRadius: "var(--ds-radius-xsmall)";
|
|
18
|
+
readonly backgroundColor: "var(--ds-menu-seperator-color, var(--ds-border))";
|
|
19
|
+
readonly position: "absolute";
|
|
20
|
+
readonly zIndex: 1;
|
|
21
|
+
};
|
|
22
|
+
readonly "&::after": {
|
|
23
|
+
readonly content: "''";
|
|
24
|
+
readonly position: "absolute";
|
|
25
|
+
readonly display: "block";
|
|
26
|
+
readonly borderRadius: "var(--ds-radius-xsmall)";
|
|
27
|
+
readonly flexShrink: 0;
|
|
28
|
+
readonly height: 2;
|
|
29
|
+
readonly left: "var(--ds-space-100)";
|
|
30
|
+
readonly right: number;
|
|
31
|
+
readonly bottom: 0;
|
|
32
|
+
readonly zIndex: 1;
|
|
33
|
+
readonly backgroundColor: "var(--ds-menu-seperator-color, var(--ds-border))";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/dist/types/components/NestableNavigationContent/{context.d.ts → nested-context.d.ts}
RENAMED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { type MutableRefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
2
|
export interface NestedContextValue {
|
|
6
3
|
currentStackId: string;
|
|
7
4
|
onNest: (id: string) => void;
|
|
@@ -16,16 +13,4 @@ export interface NestedContextValue {
|
|
|
16
13
|
isDefaultFocusControl?: boolean;
|
|
17
14
|
focusGoBackButton?: boolean;
|
|
18
15
|
}
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
16
|
export declare const NestedContext: import('react').Context<NestedContextValue | undefined>;
|
|
23
|
-
export declare const useNestedContext: () => NestedContextValue;
|
|
24
|
-
/**
|
|
25
|
-
* Used by children of the NestableNavigationContent component to see if they should render or not.
|
|
26
|
-
* If `shouldRender` returns `true` - return your nodes.
|
|
27
|
-
* If it returns `false` - either return `null` or `children` if you have children.
|
|
28
|
-
*/
|
|
29
|
-
export declare const useShouldNestedElementRender: () => {
|
|
30
|
-
shouldRender: boolean;
|
|
31
|
-
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type HeadingItemProps } from '@atlaskit/menu';
|
|
6
|
-
export
|
|
5
|
+
import { type HeadingItemProps as MenuHeadingItemProps } from '@atlaskit/menu';
|
|
6
|
+
export interface HeadingItemProps extends MenuHeadingItemProps {
|
|
7
|
+
}
|
|
7
8
|
/**
|
|
8
9
|
* __Heading item__
|
|
9
10
|
*
|