@atlaskit/side-navigation 1.1.2
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 +517 -0
- package/LICENSE +13 -0
- package/README.md +16 -0
- package/build/tsconfig.json +17 -0
- package/codemods/0.8.0-change-css-fn-prop.ts +184 -0
- package/codemods/__tests__/0.8.0-change-css-fn-prop.ts +360 -0
- package/codemods/helpers/generic.ts +674 -0
- package/dist/cjs/common/constants.js +10 -0
- package/dist/cjs/common/styles.js +104 -0
- package/dist/cjs/components/Footer/index.js +67 -0
- package/dist/cjs/components/Header/index.js +73 -0
- package/dist/cjs/components/Item/button-item.js +47 -0
- package/dist/cjs/components/Item/custom-item.js +52 -0
- package/dist/cjs/components/Item/go-back-item.js +65 -0
- package/dist/cjs/components/Item/index.js +47 -0
- package/dist/cjs/components/Item/link-item.js +47 -0
- package/dist/cjs/components/Item/skeleton-item.js +43 -0
- package/dist/cjs/components/LoadingItems/index.js +51 -0
- package/dist/cjs/components/NavigationContent/index.js +52 -0
- package/dist/cjs/components/NavigationContent/styles.js +152 -0
- package/dist/cjs/components/NavigationFooter/index.js +27 -0
- package/dist/cjs/components/NavigationHeader/index.js +27 -0
- package/dist/cjs/components/NestableNavigationContent/context.js +51 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +182 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +40 -0
- package/dist/cjs/components/NestingItem/hack-for-ert.js +8 -0
- package/dist/cjs/components/NestingItem/index.js +173 -0
- package/dist/cjs/components/NestingItem/styles.js +47 -0
- package/dist/cjs/components/Section/heading-item.js +35 -0
- package/dist/cjs/components/Section/index.js +31 -0
- package/dist/cjs/components/Section/section.js +45 -0
- package/dist/cjs/components/Section/skeleton-heading-item.js +39 -0
- package/dist/cjs/components/SideNavigation/index.js +41 -0
- package/dist/cjs/components/index.js +131 -0
- package/dist/cjs/index.js +131 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/common/styles.js +78 -0
- package/dist/es2019/components/Footer/index.js +52 -0
- package/dist/es2019/components/Header/index.js +46 -0
- package/dist/es2019/components/Item/button-item.js +25 -0
- package/dist/es2019/components/Item/custom-item.js +31 -0
- package/dist/es2019/components/Item/go-back-item.js +34 -0
- package/dist/es2019/components/Item/index.js +5 -0
- package/dist/es2019/components/Item/link-item.js +25 -0
- package/dist/es2019/components/Item/skeleton-item.js +28 -0
- package/dist/es2019/components/LoadingItems/index.js +38 -0
- package/dist/es2019/components/NavigationContent/index.js +38 -0
- package/dist/es2019/components/NavigationContent/styles.js +120 -0
- package/dist/es2019/components/NavigationFooter/index.js +18 -0
- package/dist/es2019/components/NavigationHeader/index.js +20 -0
- package/dist/es2019/components/NestableNavigationContent/context.js +41 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +148 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +21 -0
- package/dist/es2019/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/es2019/components/NestingItem/index.js +128 -0
- package/dist/es2019/components/NestingItem/styles.js +39 -0
- package/dist/es2019/components/Section/heading-item.js +22 -0
- package/dist/es2019/components/Section/index.js +3 -0
- package/dist/es2019/components/Section/section.js +25 -0
- package/dist/es2019/components/Section/skeleton-heading-item.js +24 -0
- package/dist/es2019/components/SideNavigation/index.js +30 -0
- package/dist/es2019/components/index.js +11 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/common/styles.js +82 -0
- package/dist/esm/components/Footer/index.js +51 -0
- package/dist/esm/components/Header/index.js +50 -0
- package/dist/esm/components/Item/button-item.js +25 -0
- package/dist/esm/components/Item/custom-item.js +31 -0
- package/dist/esm/components/Item/go-back-item.js +41 -0
- package/dist/esm/components/Item/index.js +5 -0
- package/dist/esm/components/Item/link-item.js +25 -0
- package/dist/esm/components/Item/skeleton-item.js +29 -0
- package/dist/esm/components/LoadingItems/index.js +39 -0
- package/dist/esm/components/NavigationContent/index.js +37 -0
- package/dist/esm/components/NavigationContent/styles.js +130 -0
- package/dist/esm/components/NavigationFooter/index.js +17 -0
- package/dist/esm/components/NavigationHeader/index.js +18 -0
- package/dist/esm/components/NestableNavigationContent/context.js +36 -0
- package/dist/esm/components/NestableNavigationContent/index.js +163 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +28 -0
- package/dist/esm/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/esm/components/NestingItem/index.js +144 -0
- package/dist/esm/components/NestingItem/styles.js +34 -0
- package/dist/esm/components/Section/heading-item.js +21 -0
- package/dist/esm/components/Section/index.js +3 -0
- package/dist/esm/components/Section/section.js +24 -0
- package/dist/esm/components/Section/skeleton-heading-item.js +25 -0
- package/dist/esm/components/SideNavigation/index.js +28 -0
- package/dist/esm/components/index.js +11 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/styles.d.ts +10 -0
- package/dist/types/components/Footer/index.d.ts +4 -0
- package/dist/types/components/Header/index.d.ts +43 -0
- package/dist/types/components/Item/button-item.d.ts +5 -0
- package/dist/types/components/Item/custom-item.d.ts +13 -0
- package/dist/types/components/Item/go-back-item.d.ts +5 -0
- package/dist/types/components/Item/index.d.ts +10 -0
- package/dist/types/components/Item/link-item.d.ts +5 -0
- package/dist/types/components/Item/skeleton-item.d.ts +4 -0
- package/dist/types/components/LoadingItems/index.d.ts +30 -0
- package/dist/types/components/NavigationContent/index.d.ts +17 -0
- package/dist/types/components/NavigationContent/styles.d.ts +91 -0
- package/dist/types/components/NavigationFooter/index.d.ts +7 -0
- package/dist/types/components/NavigationHeader/index.d.ts +5 -0
- package/dist/types/components/NestableNavigationContent/context.d.ts +20 -0
- package/dist/types/components/NestableNavigationContent/index.d.ts +58 -0
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +18 -0
- package/dist/types/components/NestingItem/hack-for-ert.d.ts +2 -0
- package/dist/types/components/NestingItem/index.d.ts +91 -0
- package/dist/types/components/NestingItem/styles.d.ts +28 -0
- package/dist/types/components/Section/heading-item.d.ts +4 -0
- package/dist/types/components/Section/index.d.ts +6 -0
- package/dist/types/components/Section/section.d.ts +25 -0
- package/dist/types/components/Section/skeleton-heading-item.d.ts +4 -0
- package/dist/types/components/SideNavigation/index.d.ts +23 -0
- package/dist/types/components/index.d.ts +22 -0
- package/dist/types/index.d.ts +4 -0
- package/docs/00-intro.tsx +70 -0
- package/docs/01-side-navigation.tsx +33 -0
- package/docs/02-navigation-header.tsx +39 -0
- package/docs/03-navigation-content.tsx +40 -0
- package/docs/04-nestable-navigation-content.tsx +95 -0
- package/docs/05-navigation-footer.tsx +38 -0
- package/docs/99-loading-states.tsx +95 -0
- package/docs/button-item.tsx +38 -0
- package/docs/custom-item.tsx +45 -0
- package/docs/go-back-item.tsx +31 -0
- package/docs/heading-item.tsx +30 -0
- package/docs/link-item.tsx +39 -0
- package/docs/nesting-item.tsx +52 -0
- package/docs/section.tsx +40 -0
- package/docs/skeleton-heading-item.tsx +30 -0
- package/docs/skeleton-item.tsx +30 -0
- package/package.json +71 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { Section as MenuSection } from '@atlaskit/menu';
|
|
4
|
+
import { sectionHeaderStyle } from '../../common/styles';
|
|
5
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
+
// Type needed on props to extract types with extract react types.
|
|
7
|
+
const Section = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
|
+
const {
|
|
9
|
+
shouldRender
|
|
10
|
+
} = useShouldNestedElementRender();
|
|
11
|
+
|
|
12
|
+
if (!shouldRender) {
|
|
13
|
+
return props.children;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return /*#__PURE__*/React.createElement(MenuSection, _extends({}, props, {
|
|
17
|
+
ref: ref,
|
|
18
|
+
overrides: {
|
|
19
|
+
HeadingItem: {
|
|
20
|
+
cssFn: sectionHeaderStyle
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
25
|
+
export default Section;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SkeletonHeadingItem as MenuSkeletonHeadingItem } from '@atlaskit/menu';
|
|
4
|
+
import { ITEM_SIDE_PADDING } from '../../common/styles';
|
|
5
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
+
|
|
7
|
+
const SkeletonHeadingItem = props => {
|
|
8
|
+
const {
|
|
9
|
+
shouldRender
|
|
10
|
+
} = useShouldNestedElementRender();
|
|
11
|
+
|
|
12
|
+
if (!shouldRender) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return /*#__PURE__*/React.createElement(MenuSkeletonHeadingItem, _extends({
|
|
17
|
+
cssFn: () => ({
|
|
18
|
+
paddingLeft: ITEM_SIDE_PADDING,
|
|
19
|
+
paddingRight: ITEM_SIDE_PADDING
|
|
20
|
+
})
|
|
21
|
+
}, props));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default SkeletonHeadingItem;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
4
|
+
import { N10, N500 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
const SideNavigation = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
testId,
|
|
11
|
+
label
|
|
12
|
+
} = props;
|
|
13
|
+
return jsx("nav", {
|
|
14
|
+
ref: ref,
|
|
15
|
+
"data-testid": testId,
|
|
16
|
+
"aria-label": label,
|
|
17
|
+
css: {
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: '100%',
|
|
20
|
+
color: token('color.text.mediumEmphasis', N500),
|
|
21
|
+
minWidth: gridSize() * 30,
|
|
22
|
+
backgroundColor: token('color.background.default', N10),
|
|
23
|
+
position: 'relative',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
overflow: 'hidden'
|
|
27
|
+
}
|
|
28
|
+
}, children);
|
|
29
|
+
});
|
|
30
|
+
export default SideNavigation;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as SideNavigation } from './SideNavigation';
|
|
2
|
+
export { Section, HeadingItem, SkeletonHeadingItem } from './Section';
|
|
3
|
+
export { default as NestingItem } from './NestingItem';
|
|
4
|
+
export { default as NavigationContent } from './NavigationContent';
|
|
5
|
+
export { ButtonItem, GoBackItem, LinkItem, CustomItem, SkeletonItem } from './Item';
|
|
6
|
+
export { default as Footer } from './Footer';
|
|
7
|
+
export { default as Header } from './Header';
|
|
8
|
+
export { default as NavigationHeader } from './NavigationHeader';
|
|
9
|
+
export { default as NavigationFooter } from './NavigationFooter';
|
|
10
|
+
export { default as LoadingItems } from './LoadingItems';
|
|
11
|
+
export { default as NestableNavigationContent } from './NestableNavigationContent';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { SideNavigation, Header, NavigationHeader, NavigationContent, Section, HeadingItem, SkeletonHeadingItem, NestableNavigationContent, NestingItem, ButtonItem, LinkItem, GoBackItem, CustomItem, SkeletonItem, Footer, NavigationFooter, LoadingItems } from './components';
|
|
2
|
+
export { useShouldNestedElementRender } from './components/NestableNavigationContent/context';
|
|
3
|
+
export { VAR_SCROLL_INDICATOR_COLOR, VAR_SEPARATOR_COLOR } from './common/constants';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
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
|
+
import { token } from '@atlaskit/tokens';
|
|
10
|
+
var gridSize = gridSizeFn();
|
|
11
|
+
var borderRadius = borderRadiusFn();
|
|
12
|
+
var itemIconSize = gridSize * 3;
|
|
13
|
+
var leftIconRightSpacing = gridSize * 2;
|
|
14
|
+
export var ITEM_SIDE_PADDING = gridSize * 1.25;
|
|
15
|
+
/**
|
|
16
|
+
* Allows chaining of style functions on top of base style functions
|
|
17
|
+
* @param baseStyle the base custom cssFn
|
|
18
|
+
* @param newStyle a new cssFn to be applied after the base style
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export var overrideStyleFunction = function overrideStyleFunction(baseStyle) {
|
|
22
|
+
var newStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
23
|
+
return {};
|
|
24
|
+
};
|
|
25
|
+
return function (state) {
|
|
26
|
+
return [baseStyle(state), newStyle(state)];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
var defaultStyles = {
|
|
30
|
+
'&:hover': {
|
|
31
|
+
color: token('color.text.mediumEmphasis', N500),
|
|
32
|
+
backgroundColor: token('color.background.transparentNeutral.hover', N30)
|
|
33
|
+
},
|
|
34
|
+
'&:active': {
|
|
35
|
+
color: token('color.text.mediumEmphasis', B400),
|
|
36
|
+
backgroundColor: token('color.background.transparentNeutral.pressed', B50)
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var selectedStyles = {
|
|
40
|
+
backgroundColor: token('color.background.selected.resting', N30),
|
|
41
|
+
color: token('color.text.selected', B400),
|
|
42
|
+
':visited': {
|
|
43
|
+
color: token('color.text.selected', B400)
|
|
44
|
+
},
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: token('color.background.selected.hover', N30),
|
|
47
|
+
color: token('color.text.selected', N500)
|
|
48
|
+
},
|
|
49
|
+
'&:active': {
|
|
50
|
+
backgroundColor: token('color.background.selected.pressed', B50),
|
|
51
|
+
color: token('color.text.selected', B400)
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export var baseSideNavItemStyle = function baseSideNavItemStyle(_ref) {
|
|
55
|
+
var isSelected = _ref.isSelected,
|
|
56
|
+
isDisabled = _ref.isDisabled;
|
|
57
|
+
return _objectSpread(_objectSpread(_objectSpread({
|
|
58
|
+
// This padding is set to ensure that the center of the left icon
|
|
59
|
+
// is approximately center aligned with the horizontal app switcher.
|
|
60
|
+
padding: "".concat(gridSize, "px ").concat(ITEM_SIDE_PADDING, "px"),
|
|
61
|
+
borderRadius: borderRadius,
|
|
62
|
+
// -- TODO: DELETE THESE COLOR OVERRIDES WHEN CLEANING UP FALLBACK THEMING --
|
|
63
|
+
// Menu and side navigation are now color aligned so they do not need this!
|
|
64
|
+
// See: https://product-fabric.atlassian.net/browse/DSP-1684
|
|
65
|
+
backgroundColor: token('color.background.default', N10)
|
|
66
|
+
}, !isDisabled && !isSelected && defaultStyles), !isDisabled && isSelected && selectedStyles), {}, _defineProperty({}, '& [data-item-elem-before]', {
|
|
67
|
+
// TODO: Can this be moved into menu?
|
|
68
|
+
// center align icons with app-switcher regardless of size
|
|
69
|
+
display: 'flex',
|
|
70
|
+
height: itemIconSize,
|
|
71
|
+
width: itemIconSize,
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
marginRight: leftIconRightSpacing
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
export var sectionHeaderStyle = function sectionHeaderStyle() {
|
|
78
|
+
return {
|
|
79
|
+
paddingLeft: "".concat(ITEM_SIDE_PADDING, "px"),
|
|
80
|
+
paddingRight: "".concat(ITEM_SIDE_PADDING, "px")
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { overrideStyleFunction } from '../../common/styles';
|
|
7
|
+
import { CustomItem } from '../Item';
|
|
8
|
+
|
|
9
|
+
var Container = function Container(props) {
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", props);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
var Footer = function Footer(props) {
|
|
14
|
+
var cssFn = overrideStyleFunction(function () {
|
|
15
|
+
var _ref;
|
|
16
|
+
|
|
17
|
+
return _ref = {
|
|
18
|
+
userSelect: 'auto',
|
|
19
|
+
div: {
|
|
20
|
+
display: 'block',
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
minHeight: '24px',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
width: '100%'
|
|
25
|
+
}
|
|
26
|
+
}, _defineProperty(_ref, '[data-item-elem-before]', {
|
|
27
|
+
marginRight: 0,
|
|
28
|
+
marginBottom: '8px',
|
|
29
|
+
display: 'inline-block'
|
|
30
|
+
}), _defineProperty(_ref, '[data-item-title]', {
|
|
31
|
+
textAlign: 'center',
|
|
32
|
+
fontSize: 12
|
|
33
|
+
}), _defineProperty(_ref, '[data-item-description]', {
|
|
34
|
+
textAlign: 'center',
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
margin: '6px'
|
|
37
|
+
}), _defineProperty(_ref, 'div&:hover', {
|
|
38
|
+
backgroundColor: 'transparent',
|
|
39
|
+
cursor: 'default'
|
|
40
|
+
}), _defineProperty(_ref, 'div&:active', {
|
|
41
|
+
backgroundColor: 'transparent',
|
|
42
|
+
color: token('color.text.mediumEmphasis', N500)
|
|
43
|
+
}), _ref;
|
|
44
|
+
}, props.cssFn);
|
|
45
|
+
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
46
|
+
component: props.component || Container,
|
|
47
|
+
cssFn: cssFn
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default Footer;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { headingSizes } from '@atlaskit/theme/typography';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
8
|
+
import { overrideStyleFunction } from '../../common/styles';
|
|
9
|
+
import { CustomItem } from '../Item';
|
|
10
|
+
|
|
11
|
+
var Container = function Container(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", props);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var Header = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
16
|
+
var cssFn = overrideStyleFunction(function () {
|
|
17
|
+
var _ref;
|
|
18
|
+
|
|
19
|
+
return _ref = {
|
|
20
|
+
userSelect: 'auto'
|
|
21
|
+
}, _defineProperty(_ref, '[data-item-title]', {
|
|
22
|
+
fontSize: headingSizes.h400.size,
|
|
23
|
+
letterSpacing: '-0.003em',
|
|
24
|
+
fontWeight: 600,
|
|
25
|
+
color: token('color.text.highEmphasis', N500)
|
|
26
|
+
}), _defineProperty(_ref, 'div&:hover', {
|
|
27
|
+
backgroundColor: 'transparent',
|
|
28
|
+
cursor: 'default'
|
|
29
|
+
}), _defineProperty(_ref, 'div&:active', {
|
|
30
|
+
backgroundColor: 'transparent',
|
|
31
|
+
color: token('color.text.highEmphasis', N500)
|
|
32
|
+
}), _ref;
|
|
33
|
+
}, props.cssFn);
|
|
34
|
+
return /*#__PURE__*/React.createElement(CustomItem, _extends({}, props, {
|
|
35
|
+
ref: ref,
|
|
36
|
+
component: props.component || Container,
|
|
37
|
+
cssFn: cssFn,
|
|
38
|
+
overrides: {
|
|
39
|
+
Title: {
|
|
40
|
+
render: function render(_, _ref2) {
|
|
41
|
+
var children = _ref2.children,
|
|
42
|
+
props = _objectWithoutProperties(_ref2, ["children"]);
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/React.createElement("h2", props, children);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
export default Header;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { ButtonItem as Button } from '@atlaskit/menu';
|
|
5
|
+
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
6
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
|
+
var ButtonItem = /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
8
|
+
function (_ref, ref) {
|
|
9
|
+
var cssFn = _ref.cssFn,
|
|
10
|
+
rest = _objectWithoutProperties(_ref, ["cssFn"]);
|
|
11
|
+
|
|
12
|
+
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
13
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
14
|
+
|
|
15
|
+
if (!shouldRender) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
21
|
+
ref: ref,
|
|
22
|
+
cssFn: cssOverride
|
|
23
|
+
}, rest));
|
|
24
|
+
});
|
|
25
|
+
export default ButtonItem;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { CustomItem as Custom } from '@atlaskit/menu';
|
|
5
|
+
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
6
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Used to support any custom items needed by products alongside the Header and Footer patterns.
|
|
10
|
+
* Specific implementation of headers and footers are provided in the examples folder.
|
|
11
|
+
*/
|
|
12
|
+
var CustomItem = /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
13
|
+
function (_ref, ref) {
|
|
14
|
+
var cssFn = _ref.cssFn,
|
|
15
|
+
rest = _objectWithoutProperties(_ref, ["cssFn"]);
|
|
16
|
+
|
|
17
|
+
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
18
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
19
|
+
|
|
20
|
+
if (!shouldRender) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
25
|
+
return /*#__PURE__*/React.createElement(Custom, _extends({
|
|
26
|
+
ref: ref,
|
|
27
|
+
cssFn: cssOverride
|
|
28
|
+
}, rest));
|
|
29
|
+
} // Dirty hack to get generics working with forward ref [2/2]
|
|
30
|
+
);
|
|
31
|
+
export default CustomItem;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
import React, { forwardRef, useCallback, useState } from 'react';
|
|
5
|
+
import LeftArrow from '@atlaskit/icon/glyph/arrow-left-circle';
|
|
6
|
+
import { N10 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
8
|
+
import ButtonItem from './button-item';
|
|
9
|
+
var GoBackItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
|
+
var cssFn = _ref.cssFn,
|
|
11
|
+
_ref$iconBefore = _ref.iconBefore,
|
|
12
|
+
iconBefore = _ref$iconBefore === void 0 ? /*#__PURE__*/React.createElement(LeftArrow, {
|
|
13
|
+
secondaryColor: token('color.background.default', N10),
|
|
14
|
+
label: ""
|
|
15
|
+
}) : _ref$iconBefore,
|
|
16
|
+
onClick = _ref.onClick,
|
|
17
|
+
isSelected = _ref.isSelected,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, ["cssFn", "iconBefore", "onClick", "isSelected"]);
|
|
19
|
+
|
|
20
|
+
var _useState = useState(false),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
isInteracted = _useState2[0],
|
|
23
|
+
setIsInteracted = _useState2[1];
|
|
24
|
+
|
|
25
|
+
var onClickHandler = useCallback(function (e) {
|
|
26
|
+
if (isInteracted) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setIsInteracted(true);
|
|
31
|
+
onClick && onClick(e);
|
|
32
|
+
}, [onClick, isInteracted]);
|
|
33
|
+
return /*#__PURE__*/React.createElement(ButtonItem, _extends({
|
|
34
|
+
isSelected: isSelected || isInteracted,
|
|
35
|
+
cssFn: cssFn,
|
|
36
|
+
iconBefore: iconBefore,
|
|
37
|
+
onClick: onClickHandler,
|
|
38
|
+
ref: ref
|
|
39
|
+
}, rest));
|
|
40
|
+
});
|
|
41
|
+
export default GoBackItem;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ButtonItem } from './button-item';
|
|
2
|
+
export { default as CustomItem } from './custom-item';
|
|
3
|
+
export { default as GoBackItem } from './go-back-item';
|
|
4
|
+
export { default as LinkItem } from './link-item';
|
|
5
|
+
export { default as SkeletonItem } from './skeleton-item';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { LinkItem as Link } from '@atlaskit/menu';
|
|
5
|
+
import { baseSideNavItemStyle, overrideStyleFunction } from '../../common/styles';
|
|
6
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
7
|
+
var LinkItem = /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
8
|
+
function (_ref, ref) {
|
|
9
|
+
var cssFn = _ref.cssFn,
|
|
10
|
+
rest = _objectWithoutProperties(_ref, ["cssFn"]);
|
|
11
|
+
|
|
12
|
+
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
13
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
14
|
+
|
|
15
|
+
if (!shouldRender) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var cssOverride = overrideStyleFunction(baseSideNavItemStyle, cssFn);
|
|
20
|
+
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
21
|
+
ref: ref,
|
|
22
|
+
cssFn: cssOverride
|
|
23
|
+
}, rest));
|
|
24
|
+
});
|
|
25
|
+
export default LinkItem;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SkeletonItem as SkelItem } from '@atlaskit/menu';
|
|
4
|
+
import { ITEM_SIDE_PADDING } from '../../common/styles';
|
|
5
|
+
import { useShouldNestedElementRender } from '../NestableNavigationContent/context';
|
|
6
|
+
|
|
7
|
+
var SkeletonItem = function SkeletonItem(props) {
|
|
8
|
+
var _useShouldNestedEleme = useShouldNestedElementRender(),
|
|
9
|
+
shouldRender = _useShouldNestedEleme.shouldRender;
|
|
10
|
+
|
|
11
|
+
if (!shouldRender) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return /*#__PURE__*/React.createElement(SkelItem, _extends({
|
|
16
|
+
cssFn: function cssFn() {
|
|
17
|
+
return {
|
|
18
|
+
paddingLeft: ITEM_SIDE_PADDING,
|
|
19
|
+
paddingRight: ITEM_SIDE_PADDING,
|
|
20
|
+
'&&::before': {
|
|
21
|
+
// This doubles up & to get a higher specificity as well as to not overwite the base styles.
|
|
22
|
+
marginRight: 18
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, props));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default SkeletonItem;
|