orcs-design-system 3.3.39 → 3.3.42
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/es/components/Divider/index.js +1 -1
- package/es/components/Popover/index.js +9 -1
- package/es/components/SideNavV2/NavItem.js +231 -0
- package/es/components/SideNavV2/SideNav.js +297 -0
- package/es/components/SideNavV2/SideNavV2.stories.js +382 -0
- package/es/components/SideNavV2/__tests__/resize.test.js +129 -0
- package/es/components/SideNavV2/__tests__/sections.test.js +361 -0
- package/es/components/SideNavV2/components/BaseSection.js +178 -0
- package/es/components/SideNavV2/components/CurrentViewSectionPortalTarget.js +42 -0
- package/es/components/SideNavV2/components/ExpandedPanel.js +162 -0
- package/es/components/SideNavV2/components/ItemSection.js +156 -0
- package/es/components/SideNavV2/components/PanelControl.js +210 -0
- package/es/components/SideNavV2/components/RenderCurrentViewSection.js +44 -0
- package/es/components/SideNavV2/components/index.js +4 -0
- package/es/components/SideNavV2/constants/sideNav.js +21 -0
- package/es/components/SideNavV2/context/SideNavStateProvider.js +57 -0
- package/es/components/SideNavV2/hooks/index.js +3 -0
- package/es/components/SideNavV2/hooks/useResize.js +70 -0
- package/es/components/SideNavV2/hooks/useResponsive.js +32 -0
- package/es/components/SideNavV2/hooks/useSideNavState.js +88 -0
- package/es/components/SideNavV2/index.js +3 -0
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +128 -0
- package/es/components/SideNavV2/sections/SideNavPinnedSection.js +124 -0
- package/es/components/SideNavV2/sections/SideNavTeamsSection.js +91 -0
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +157 -0
- package/es/components/SideNavV2/types/sideNav.js +53 -0
- package/es/components/SideNavV2/utils/index.js +2 -0
- package/es/components/SideNavV2/utils/itemUtils.js +51 -0
- package/es/components/SideNavV2/utils/resizeUtils.js +57 -0
- package/es/components/StatusDot/StatusDot.stories.js +59 -72
- package/es/components/StatusDot/index.js +14 -5
- package/es/components.test.js +4 -0
- package/es/index.js +1 -0
- package/package.json +6 -2
|
@@ -10,7 +10,7 @@ const Item = styled.div.withConfig({
|
|
|
10
10
|
}).withConfig({
|
|
11
11
|
displayName: "Divider__Item",
|
|
12
12
|
componentId: "sc-106mlj-0"
|
|
13
|
-
})(["", " ", " ", "
|
|
13
|
+
})(["", " ", " ", " width:100%;height:", ";min-height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, props => props.thick ? "3px" : "1px", props => props.thick ? "3px" : "1px", props => props.spanGrid ? "1 / -1" : "auto", props => props.dash && props.thick && props.light ? `dashed 3px ${themeGet("colors.black10")(props)}` : props.dash && props.thick && props.inverted ? `dashed 3px ${themeGet("colors.white20")(props)}` : props.dash && props.inverted ? `dashed 1px ${themeGet("colors.white20")(props)}` : props.dash && props.light ? `dashed 1px ${themeGet("colors.black10")(props)}` : props.dash && props.thick ? `dashed 3px ${themeGet("colors.black20")(props)}` : props.dash ? `dashed 1px ${themeGet("colors.black20")(props)}` : "none", props => props.dash ? "transparent" : props.inverted ? themeGet("colors.white20")(props) : props.light ? themeGet("colors.black10")(props) : themeGet("colors.black20")(props));
|
|
14
14
|
export default function Divider(_ref) {
|
|
15
15
|
let {
|
|
16
16
|
light,
|
|
@@ -20,7 +20,15 @@ const DIRECTIONS_MAP = {
|
|
|
20
20
|
const Container = styled.div.withConfig({
|
|
21
21
|
displayName: "Popover__Container",
|
|
22
22
|
componentId: "sc-1bwoak-0"
|
|
23
|
-
})(["", " ", " display:", ";position:relative;"], space, layout, props =>
|
|
23
|
+
})(["", " ", " display:", ";position:relative;"], space, layout, props => {
|
|
24
|
+
if (props.display) {
|
|
25
|
+
return props.display;
|
|
26
|
+
}
|
|
27
|
+
if (props.inlineBlock) {
|
|
28
|
+
return "inline-block";
|
|
29
|
+
}
|
|
30
|
+
return "block";
|
|
31
|
+
});
|
|
24
32
|
const TooltipControl = styled.div.withConfig({
|
|
25
33
|
displayName: "Popover__TooltipControl",
|
|
26
34
|
componentId: "sc-1bwoak-1"
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { css as styledCss } from "styled-components";
|
|
3
|
+
import { css } from "@styled-system/css";
|
|
4
|
+
import { themeGet } from "@styled-system/theme-get";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import Icon from "../Icon";
|
|
7
|
+
import Popover from "../Popover";
|
|
8
|
+
import { BREAKPOINTS } from "./constants/sideNav";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const sharedNavItemStyles = styledCss(["cursor:pointer;padding:", ";text-decoration:none;border-radius:", ";width:100%;position:relative;border:none;path{transition:", ";fill:", ";}font-family:", ";display:flex;align-items:center;justify-content:center;transition:", ";background-color:transparent;font-size:1.4rem;font-weight:", ";&:hover,&:focus{color:", ";path{fill:", ";}}@media screen and (max-width:", "px){width:auto;max-height:30px;height:30px;}&:focus{outline:0;color:", ";path{fill:", ";}}"], themeGet("space.s"), themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("colors.greyDarker"), themeGet("fonts.main"), themeGet("transition.transitionDefault"), themeGet("fontWeights.1"), themeGet("colors.primary"), themeGet("colors.primary"), BREAKPOINTS.SMALL_SCREEN, themeGet("colors.primary"), themeGet("colors.primary"));
|
|
11
|
+
const expandedNavItemStyles = props => styledCss(["justify-content:flex-start;gap:", ";.nav-item-text{font-size:", ";line-height:1;font-weight:", ";color:", ";white-space:nowrap;text-overflow:ellipsis;}&:hover .nav-item-text,&:focus .nav-item-text{color:", ";}"], themeGet("space.s"), themeGet("fontSizes.1"), themeGet("fontWeights.1"), props.active ? themeGet("colors.greyDarkest") : themeGet("colors.greyDarker"), props.active ? themeGet("colors.greyDarkest") : themeGet("colors.primary"));
|
|
12
|
+
const variantActiveStyles = {
|
|
13
|
+
expandableItem: props => styledCss(["color:", ";path{fill:", ";}:after{height:100%;position:absolute;right:0;transform:", ";content:\"\";border-right:3px solid ", ";z-index:5;}@media screen and (max-width:", "px){:after{border-top:3px solid ", ";border-right:none;top:-16px;right:0;width:100%;}}"], themeGet("colors.greyDarkest"), themeGet("colors.greyDarkest"), props.isExpanded ? "translateX(8px)" : "translateX(10px)", themeGet("colors.primary"), BREAKPOINTS.SMALL_SCREEN, themeGet("colors.primary")),
|
|
14
|
+
default: styledCss(["background-color:", ";path{fill:", ";}&:hover,&:focus{path{fill:", ";}}&:focus{path{fill:", ";}}"], themeGet("colors.primaryLightest"), themeGet("colors.greyDarkest"), themeGet("colors.greyDarkest"), themeGet("colors.greyDarkest"))
|
|
15
|
+
};
|
|
16
|
+
const getActiveStyles = props => {
|
|
17
|
+
if (!props.active) return "";
|
|
18
|
+
if (props["aria-expanded"]) {
|
|
19
|
+
return variantActiveStyles.expandableItem(props);
|
|
20
|
+
}
|
|
21
|
+
return variantActiveStyles.default;
|
|
22
|
+
};
|
|
23
|
+
const SideNavItemLink = styled.div.withConfig({
|
|
24
|
+
displayName: "NavItem__SideNavItemLink",
|
|
25
|
+
componentId: "sc-1qz1q0h-0"
|
|
26
|
+
})(["& > a{", " ", " ", "}"], sharedNavItemStyles, props => props.isExpanded ? expandedNavItemStyles(props) : "", getActiveStyles);
|
|
27
|
+
const SideNavItem = styled("button").withConfig({
|
|
28
|
+
displayName: "NavItem__SideNavItem",
|
|
29
|
+
componentId: "sc-1qz1q0h-1"
|
|
30
|
+
})(["", " ", " ", ""], sharedNavItemStyles, props => props.isExpanded ? expandedNavItemStyles(props) : "", getActiveStyles);
|
|
31
|
+
const BadgeNumber = styled("div").withConfig({
|
|
32
|
+
displayName: "NavItem__BadgeNumber",
|
|
33
|
+
componentId: "sc-1qz1q0h-2"
|
|
34
|
+
})(props => css({
|
|
35
|
+
position: "absolute",
|
|
36
|
+
height: "16px",
|
|
37
|
+
width: "16px",
|
|
38
|
+
bg: themeGet("colors.danger")(props),
|
|
39
|
+
fontSize: "1rem",
|
|
40
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
41
|
+
color: themeGet("colors.white")(props),
|
|
42
|
+
borderRadius: "50%",
|
|
43
|
+
top: props.isExpanded ? "8px" : "0",
|
|
44
|
+
right: "0",
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center"
|
|
48
|
+
}));
|
|
49
|
+
const BadgeDot = styled("div").withConfig({
|
|
50
|
+
displayName: "NavItem__BadgeDot",
|
|
51
|
+
componentId: "sc-1qz1q0h-3"
|
|
52
|
+
})(props => css({
|
|
53
|
+
position: "absolute",
|
|
54
|
+
height: "8px",
|
|
55
|
+
width: "8px",
|
|
56
|
+
bg: themeGet("colors.primary")(props),
|
|
57
|
+
borderRadius: "50%",
|
|
58
|
+
top: props.isExpanded ? "12px" : "2px",
|
|
59
|
+
right: "0"
|
|
60
|
+
}));
|
|
61
|
+
const SideNavItemPopover = styled(Popover).withConfig({
|
|
62
|
+
displayName: "NavItem__SideNavItemPopover",
|
|
63
|
+
componentId: "sc-1qz1q0h-4"
|
|
64
|
+
})(props => css({
|
|
65
|
+
[`@media screen and (min-width: ${BREAKPOINTS.SMALL_SCREEN}px)`]: {
|
|
66
|
+
":nth-child(1 of .bottom-aligned) ": {
|
|
67
|
+
marginTop: props.bottomAligned && "auto"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"&:hover,&:focus-within": {
|
|
71
|
+
"& .popoverText": {
|
|
72
|
+
opacity: "1",
|
|
73
|
+
zIndex: "100",
|
|
74
|
+
visibility: "visible",
|
|
75
|
+
pointerEvents: "auto",
|
|
76
|
+
display: "initial"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"&:focus-within": {
|
|
80
|
+
"& .popoverText": {
|
|
81
|
+
opacity: props.active ? "0" : "1",
|
|
82
|
+
zIndex: props.active ? "-100" : "100",
|
|
83
|
+
visibility: props.active ? "hidden" : "visible",
|
|
84
|
+
pointerEvents: props.active ? "none" : "auto",
|
|
85
|
+
display: props.active ? "none" : "initial"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[`@media screen and (max-width: ${BREAKPOINTS.SMALL_SCREEN}px)`]: {
|
|
89
|
+
width: "auto",
|
|
90
|
+
marginBottom: "0",
|
|
91
|
+
marginTop: "0",
|
|
92
|
+
"&:hover,&:focus-within": {
|
|
93
|
+
"& .popoverText": {
|
|
94
|
+
opacity: "0",
|
|
95
|
+
zIndex: "-100",
|
|
96
|
+
visibility: "hidden",
|
|
97
|
+
pointerEvents: "none",
|
|
98
|
+
justifyContent: "space-around",
|
|
99
|
+
display: "none"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
const NavItem = _ref => {
|
|
105
|
+
let {
|
|
106
|
+
item,
|
|
107
|
+
Component,
|
|
108
|
+
isActive,
|
|
109
|
+
handleItemClick,
|
|
110
|
+
navItemRefs,
|
|
111
|
+
isSmallScreen,
|
|
112
|
+
isExpanded
|
|
113
|
+
} = _ref;
|
|
114
|
+
// Use the ternary operator to render the appropriate component based on actionType
|
|
115
|
+
const accessibilityProps = {
|
|
116
|
+
...(item.actionType === "component" && {
|
|
117
|
+
"aria-expanded": isActive ? "true" : "false"
|
|
118
|
+
}),
|
|
119
|
+
"aria-label": item.name
|
|
120
|
+
};
|
|
121
|
+
return /*#__PURE__*/_jsx(SideNavItemPopover, {
|
|
122
|
+
className: item.bottomAligned && "bottom-aligned",
|
|
123
|
+
text: !isExpanded ? item.name : "",
|
|
124
|
+
direction: isSmallScreen ? "top" : "right",
|
|
125
|
+
textAlign: "center",
|
|
126
|
+
width: "fit-content",
|
|
127
|
+
tabIndex: "-1",
|
|
128
|
+
active: isActive,
|
|
129
|
+
bottomAligned: item.bottomAligned,
|
|
130
|
+
children: item.actionType === "link" ? /*#__PURE__*/_jsx(SideNavItemLink, {
|
|
131
|
+
active: isActive,
|
|
132
|
+
bottomAligned: item.bottomAligned,
|
|
133
|
+
isExpanded: isExpanded,
|
|
134
|
+
onClick: () => handleItemClick(item),
|
|
135
|
+
ref: el => navItemRefs.current[item.index] = el,
|
|
136
|
+
children: /*#__PURE__*/_jsxs(Component, {
|
|
137
|
+
item: item,
|
|
138
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
139
|
+
icon: ["far", item.iconName]
|
|
140
|
+
}), isExpanded && !isSmallScreen && /*#__PURE__*/_jsx("span", {
|
|
141
|
+
className: "nav-item-text",
|
|
142
|
+
children: item.name
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
}, item.index) : /*#__PURE__*/_jsxs(SideNavItem, {
|
|
146
|
+
active: isActive,
|
|
147
|
+
onClick: () => handleItemClick(item),
|
|
148
|
+
bottomAligned: item.bottomAligned,
|
|
149
|
+
isExpanded: isExpanded,
|
|
150
|
+
...accessibilityProps,
|
|
151
|
+
ref: el => navItemRefs.current[item.index] = el,
|
|
152
|
+
children: [item.badgeNumber && /*#__PURE__*/_jsx(BadgeNumber, {
|
|
153
|
+
isExpanded: isExpanded,
|
|
154
|
+
children: item.badgeNumber
|
|
155
|
+
}), item.badgeDot && /*#__PURE__*/_jsx(BadgeDot, {
|
|
156
|
+
isExpanded: isExpanded
|
|
157
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
158
|
+
icon: ["far", item.iconName]
|
|
159
|
+
}), isExpanded && !isSmallScreen && /*#__PURE__*/_jsx("span", {
|
|
160
|
+
className: "nav-item-text",
|
|
161
|
+
children: item.name
|
|
162
|
+
})]
|
|
163
|
+
}, item.index)
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
NavItem.propTypes = {
|
|
167
|
+
item: PropTypes.object,
|
|
168
|
+
Component: PropTypes.elementType,
|
|
169
|
+
isActive: PropTypes.bool,
|
|
170
|
+
handleItemClick: PropTypes.func,
|
|
171
|
+
navItemRefs: PropTypes.object,
|
|
172
|
+
isSmallScreen: PropTypes.bool,
|
|
173
|
+
isExpanded: PropTypes.bool
|
|
174
|
+
};
|
|
175
|
+
NavItem.__docgenInfo = {
|
|
176
|
+
"description": "",
|
|
177
|
+
"methods": [],
|
|
178
|
+
"displayName": "NavItem",
|
|
179
|
+
"props": {
|
|
180
|
+
"item": {
|
|
181
|
+
"description": "",
|
|
182
|
+
"type": {
|
|
183
|
+
"name": "object"
|
|
184
|
+
},
|
|
185
|
+
"required": false
|
|
186
|
+
},
|
|
187
|
+
"Component": {
|
|
188
|
+
"description": "",
|
|
189
|
+
"type": {
|
|
190
|
+
"name": "elementType"
|
|
191
|
+
},
|
|
192
|
+
"required": false
|
|
193
|
+
},
|
|
194
|
+
"isActive": {
|
|
195
|
+
"description": "",
|
|
196
|
+
"type": {
|
|
197
|
+
"name": "bool"
|
|
198
|
+
},
|
|
199
|
+
"required": false
|
|
200
|
+
},
|
|
201
|
+
"handleItemClick": {
|
|
202
|
+
"description": "",
|
|
203
|
+
"type": {
|
|
204
|
+
"name": "func"
|
|
205
|
+
},
|
|
206
|
+
"required": false
|
|
207
|
+
},
|
|
208
|
+
"navItemRefs": {
|
|
209
|
+
"description": "",
|
|
210
|
+
"type": {
|
|
211
|
+
"name": "object"
|
|
212
|
+
},
|
|
213
|
+
"required": false
|
|
214
|
+
},
|
|
215
|
+
"isSmallScreen": {
|
|
216
|
+
"description": "",
|
|
217
|
+
"type": {
|
|
218
|
+
"name": "bool"
|
|
219
|
+
},
|
|
220
|
+
"required": false
|
|
221
|
+
},
|
|
222
|
+
"isExpanded": {
|
|
223
|
+
"description": "",
|
|
224
|
+
"type": {
|
|
225
|
+
"name": "bool"
|
|
226
|
+
},
|
|
227
|
+
"required": false
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
export default NavItem;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import SideNavTeamsSection from "./sections/SideNavTeamsSection";
|
|
4
|
+
import SideNavPinnedSection from "./sections/SideNavPinnedSection";
|
|
5
|
+
|
|
6
|
+
// Hooks
|
|
7
|
+
import useSideNavState from "./hooks/useSideNavState";
|
|
8
|
+
import useResponsive from "./hooks/useResponsive";
|
|
9
|
+
import useResize from "./hooks/useResize";
|
|
10
|
+
|
|
11
|
+
// Utilities
|
|
12
|
+
import { categorizeItems } from "./utils/itemUtils";
|
|
13
|
+
|
|
14
|
+
// Styled Components
|
|
15
|
+
import { SideNavWrapper, SideNavItems } from "./styles/SideNavV2.styles";
|
|
16
|
+
|
|
17
|
+
// Components
|
|
18
|
+
import PanelControlComponent from "./components/PanelControl";
|
|
19
|
+
import ExpandedPanel from "./components/ExpandedPanel";
|
|
20
|
+
import ItemSection from "./components/ItemSection";
|
|
21
|
+
import CurrentViewSectionPortalTarget from "./components/CurrentViewSectionPortalTarget";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const SideNavV2 = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
items,
|
|
26
|
+
sideNavHeight,
|
|
27
|
+
yourTeams,
|
|
28
|
+
pinnedItems
|
|
29
|
+
} = _ref;
|
|
30
|
+
const {
|
|
31
|
+
expandedItem,
|
|
32
|
+
isExpanded,
|
|
33
|
+
expandedWidth,
|
|
34
|
+
expandedRef,
|
|
35
|
+
navItemRefs,
|
|
36
|
+
handleItemClick,
|
|
37
|
+
handleBlur,
|
|
38
|
+
handleExpandToggle,
|
|
39
|
+
handleWidthChange
|
|
40
|
+
} = useSideNavState(items);
|
|
41
|
+
const {
|
|
42
|
+
isSmallScreen
|
|
43
|
+
} = useResponsive();
|
|
44
|
+
const {
|
|
45
|
+
handleResizeStart
|
|
46
|
+
} = useResize(expandedRef, isSmallScreen, expandedItem, handleWidthChange);
|
|
47
|
+
|
|
48
|
+
// Categorize items
|
|
49
|
+
const {
|
|
50
|
+
topAlignedItems,
|
|
51
|
+
pageSpecificItems,
|
|
52
|
+
bottomAlignedItems,
|
|
53
|
+
allItems
|
|
54
|
+
} = categorizeItems(items);
|
|
55
|
+
return /*#__PURE__*/_jsxs(SideNavWrapper, {
|
|
56
|
+
sideNavHeight: sideNavHeight,
|
|
57
|
+
children: [/*#__PURE__*/_jsxs(SideNavItems, {
|
|
58
|
+
isExpanded: isExpanded,
|
|
59
|
+
"data-testid": "side-nav-items",
|
|
60
|
+
children: [!isSmallScreen && /*#__PURE__*/_jsx(PanelControlComponent, {
|
|
61
|
+
isExpanded: isExpanded,
|
|
62
|
+
onClick: handleExpandToggle,
|
|
63
|
+
ariaLabel: "toggle side navigation",
|
|
64
|
+
mt: "10px",
|
|
65
|
+
mb: "4px",
|
|
66
|
+
tooltipText: isExpanded ? "Collapse navigation" : "Expand navigation"
|
|
67
|
+
}), /*#__PURE__*/_jsx(ItemSection, {
|
|
68
|
+
items: topAlignedItems,
|
|
69
|
+
isExpanded: isExpanded,
|
|
70
|
+
isSmallScreen: isSmallScreen,
|
|
71
|
+
expandedItem: expandedItem,
|
|
72
|
+
handleItemClick: handleItemClick,
|
|
73
|
+
navItemRefs: navItemRefs
|
|
74
|
+
}), /*#__PURE__*/_jsx(ItemSection, {
|
|
75
|
+
items: pageSpecificItems,
|
|
76
|
+
isExpanded: isExpanded,
|
|
77
|
+
isSmallScreen: isSmallScreen,
|
|
78
|
+
expandedItem: expandedItem,
|
|
79
|
+
handleItemClick: handleItemClick,
|
|
80
|
+
navItemRefs: navItemRefs,
|
|
81
|
+
showDivider: true
|
|
82
|
+
}), /*#__PURE__*/_jsx(CurrentViewSectionPortalTarget, {}), yourTeams && yourTeams.length > 0 && /*#__PURE__*/_jsx(SideNavTeamsSection, {
|
|
83
|
+
teams: yourTeams,
|
|
84
|
+
isExpanded: isExpanded
|
|
85
|
+
}), pinnedItems && pinnedItems.length > 0 && /*#__PURE__*/_jsx(SideNavPinnedSection, {
|
|
86
|
+
items: pinnedItems,
|
|
87
|
+
isExpanded: isExpanded
|
|
88
|
+
}), /*#__PURE__*/_jsx(ItemSection, {
|
|
89
|
+
items: bottomAlignedItems,
|
|
90
|
+
isExpanded: isExpanded,
|
|
91
|
+
isSmallScreen: isSmallScreen,
|
|
92
|
+
expandedItem: expandedItem,
|
|
93
|
+
handleItemClick: handleItemClick,
|
|
94
|
+
navItemRefs: navItemRefs,
|
|
95
|
+
showDivider: true
|
|
96
|
+
})]
|
|
97
|
+
}), allItems.map((item, index) => {
|
|
98
|
+
if (item.actionType !== "component") return null;
|
|
99
|
+
if (index !== expandedItem || item.hide) return null;
|
|
100
|
+
return /*#__PURE__*/_jsx(ExpandedPanel, {
|
|
101
|
+
item: item,
|
|
102
|
+
expandedItem: expandedItem,
|
|
103
|
+
isExpanded: isExpanded,
|
|
104
|
+
expandedWidth: expandedWidth,
|
|
105
|
+
sideNavHeight: sideNavHeight,
|
|
106
|
+
isSmallScreen: isSmallScreen,
|
|
107
|
+
expandedRef: expandedRef,
|
|
108
|
+
onResizeStart: handleResizeStart,
|
|
109
|
+
onItemClick: handleItemClick,
|
|
110
|
+
onBlur: handleBlur
|
|
111
|
+
}, item.name);
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
SideNavV2.propTypes = {
|
|
116
|
+
sideNavHeight: PropTypes.string.isRequired,
|
|
117
|
+
initiallyExpandedItemIndex: PropTypes.number,
|
|
118
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
119
|
+
iconName: PropTypes.string.isRequired,
|
|
120
|
+
name: PropTypes.string.isRequired,
|
|
121
|
+
badgeNumber: PropTypes.string,
|
|
122
|
+
badgeDot: PropTypes.bool,
|
|
123
|
+
hide: PropTypes.bool,
|
|
124
|
+
large: PropTypes.bool,
|
|
125
|
+
bottomAligned: PropTypes.bool,
|
|
126
|
+
actionType: PropTypes.oneOf(["component", "link", "button"]).isRequired,
|
|
127
|
+
component: PropTypes.elementType,
|
|
128
|
+
link: PropTypes.string,
|
|
129
|
+
onClick: PropTypes.func
|
|
130
|
+
})).isRequired,
|
|
131
|
+
LinkComponent: PropTypes.elementType,
|
|
132
|
+
// viewing prop is now optional since it can come from context
|
|
133
|
+
|
|
134
|
+
yourTeams: PropTypes.arrayOf(PropTypes.shape({
|
|
135
|
+
avatar: PropTypes.string,
|
|
136
|
+
name: PropTypes.string.isRequired,
|
|
137
|
+
link: PropTypes.string.isRequired
|
|
138
|
+
})),
|
|
139
|
+
pinnedItems: PropTypes.arrayOf(PropTypes.shape({
|
|
140
|
+
avatar: PropTypes.string,
|
|
141
|
+
name: PropTypes.string.isRequired,
|
|
142
|
+
link: PropTypes.string.isRequired,
|
|
143
|
+
shape: PropTypes.string,
|
|
144
|
+
onUnpin: PropTypes.func
|
|
145
|
+
}))
|
|
146
|
+
};
|
|
147
|
+
SideNavV2.__docgenInfo = {
|
|
148
|
+
"description": "",
|
|
149
|
+
"methods": [],
|
|
150
|
+
"displayName": "SideNavV2",
|
|
151
|
+
"props": {
|
|
152
|
+
"sideNavHeight": {
|
|
153
|
+
"description": "",
|
|
154
|
+
"type": {
|
|
155
|
+
"name": "string"
|
|
156
|
+
},
|
|
157
|
+
"required": true
|
|
158
|
+
},
|
|
159
|
+
"initiallyExpandedItemIndex": {
|
|
160
|
+
"description": "",
|
|
161
|
+
"type": {
|
|
162
|
+
"name": "number"
|
|
163
|
+
},
|
|
164
|
+
"required": false
|
|
165
|
+
},
|
|
166
|
+
"items": {
|
|
167
|
+
"description": "",
|
|
168
|
+
"type": {
|
|
169
|
+
"name": "arrayOf",
|
|
170
|
+
"value": {
|
|
171
|
+
"name": "shape",
|
|
172
|
+
"value": {
|
|
173
|
+
"iconName": {
|
|
174
|
+
"name": "string",
|
|
175
|
+
"required": true
|
|
176
|
+
},
|
|
177
|
+
"name": {
|
|
178
|
+
"name": "string",
|
|
179
|
+
"required": true
|
|
180
|
+
},
|
|
181
|
+
"badgeNumber": {
|
|
182
|
+
"name": "string",
|
|
183
|
+
"required": false
|
|
184
|
+
},
|
|
185
|
+
"badgeDot": {
|
|
186
|
+
"name": "bool",
|
|
187
|
+
"required": false
|
|
188
|
+
},
|
|
189
|
+
"hide": {
|
|
190
|
+
"name": "bool",
|
|
191
|
+
"required": false
|
|
192
|
+
},
|
|
193
|
+
"large": {
|
|
194
|
+
"name": "bool",
|
|
195
|
+
"required": false
|
|
196
|
+
},
|
|
197
|
+
"bottomAligned": {
|
|
198
|
+
"name": "bool",
|
|
199
|
+
"required": false
|
|
200
|
+
},
|
|
201
|
+
"actionType": {
|
|
202
|
+
"name": "enum",
|
|
203
|
+
"value": [{
|
|
204
|
+
"value": "\"component\"",
|
|
205
|
+
"computed": false
|
|
206
|
+
}, {
|
|
207
|
+
"value": "\"link\"",
|
|
208
|
+
"computed": false
|
|
209
|
+
}, {
|
|
210
|
+
"value": "\"button\"",
|
|
211
|
+
"computed": false
|
|
212
|
+
}],
|
|
213
|
+
"required": true
|
|
214
|
+
},
|
|
215
|
+
"component": {
|
|
216
|
+
"name": "elementType",
|
|
217
|
+
"required": false
|
|
218
|
+
},
|
|
219
|
+
"link": {
|
|
220
|
+
"name": "string",
|
|
221
|
+
"required": false
|
|
222
|
+
},
|
|
223
|
+
"onClick": {
|
|
224
|
+
"name": "func",
|
|
225
|
+
"required": false
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"required": true
|
|
231
|
+
},
|
|
232
|
+
"LinkComponent": {
|
|
233
|
+
"description": "",
|
|
234
|
+
"type": {
|
|
235
|
+
"name": "elementType"
|
|
236
|
+
},
|
|
237
|
+
"required": false
|
|
238
|
+
},
|
|
239
|
+
"yourTeams": {
|
|
240
|
+
"description": "",
|
|
241
|
+
"type": {
|
|
242
|
+
"name": "arrayOf",
|
|
243
|
+
"value": {
|
|
244
|
+
"name": "shape",
|
|
245
|
+
"value": {
|
|
246
|
+
"avatar": {
|
|
247
|
+
"name": "string",
|
|
248
|
+
"required": false
|
|
249
|
+
},
|
|
250
|
+
"name": {
|
|
251
|
+
"name": "string",
|
|
252
|
+
"required": true
|
|
253
|
+
},
|
|
254
|
+
"link": {
|
|
255
|
+
"name": "string",
|
|
256
|
+
"required": true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"required": false
|
|
262
|
+
},
|
|
263
|
+
"pinnedItems": {
|
|
264
|
+
"description": "",
|
|
265
|
+
"type": {
|
|
266
|
+
"name": "arrayOf",
|
|
267
|
+
"value": {
|
|
268
|
+
"name": "shape",
|
|
269
|
+
"value": {
|
|
270
|
+
"avatar": {
|
|
271
|
+
"name": "string",
|
|
272
|
+
"required": false
|
|
273
|
+
},
|
|
274
|
+
"name": {
|
|
275
|
+
"name": "string",
|
|
276
|
+
"required": true
|
|
277
|
+
},
|
|
278
|
+
"link": {
|
|
279
|
+
"name": "string",
|
|
280
|
+
"required": true
|
|
281
|
+
},
|
|
282
|
+
"shape": {
|
|
283
|
+
"name": "string",
|
|
284
|
+
"required": false
|
|
285
|
+
},
|
|
286
|
+
"onUnpin": {
|
|
287
|
+
"name": "func",
|
|
288
|
+
"required": false
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"required": false
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
export default SideNavV2;
|