orcs-design-system 3.3.39 → 3.3.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/es/components/Divider/index.js +1 -1
  2. package/es/components/Icon/index.js +45 -27
  3. package/es/components/Popover/index.js +9 -1
  4. package/es/components/SideNavV2/NavItem.js +231 -0
  5. package/es/components/SideNavV2/SideNav.js +295 -0
  6. package/es/components/SideNavV2/SideNavV2.stories.js +382 -0
  7. package/es/components/SideNavV2/__tests__/resize.test.js +129 -0
  8. package/es/components/SideNavV2/__tests__/sections.test.js +333 -0
  9. package/es/components/SideNavV2/components/BaseSection.js +178 -0
  10. package/es/components/SideNavV2/components/CurrentViewSectionPortalTarget.js +35 -0
  11. package/es/components/SideNavV2/components/ExpandedPanel.js +161 -0
  12. package/es/components/SideNavV2/components/ItemSection.js +156 -0
  13. package/es/components/SideNavV2/components/PanelControl.js +128 -0
  14. package/es/components/SideNavV2/components/RenderCurrentViewSection.js +39 -0
  15. package/es/components/SideNavV2/components/index.js +4 -0
  16. package/es/components/SideNavV2/constants/sideNav.js +21 -0
  17. package/es/components/SideNavV2/context/SideNavStateProvider.js +57 -0
  18. package/es/components/SideNavV2/hooks/index.js +3 -0
  19. package/es/components/SideNavV2/hooks/useResize.js +70 -0
  20. package/es/components/SideNavV2/hooks/useResponsive.js +32 -0
  21. package/es/components/SideNavV2/hooks/useSideNavState.js +88 -0
  22. package/es/components/SideNavV2/index.js +3 -0
  23. package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +124 -0
  24. package/es/components/SideNavV2/sections/SideNavPinnedSection.js +125 -0
  25. package/es/components/SideNavV2/sections/SideNavTeamsSection.js +91 -0
  26. package/es/components/SideNavV2/styles/SideNavV2.styles.js +156 -0
  27. package/es/components/SideNavV2/types/sideNav.js +53 -0
  28. package/es/components/SideNavV2/utils/index.js +2 -0
  29. package/es/components/SideNavV2/utils/itemUtils.js +51 -0
  30. package/es/components/SideNavV2/utils/resizeUtils.js +57 -0
  31. package/es/components/StatusDot/StatusDot.stories.js +59 -72
  32. package/es/components/StatusDot/index.js +14 -5
  33. package/es/components.test.js +4 -0
  34. package/es/index.js +1 -0
  35. 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
- })(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, 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));
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,
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
3
  import PropTypes from "prop-types";
4
- import styled, { ThemeProvider } from "styled-components";
5
- import { css } from "@styled-system/css";
4
+ import styled, { css, ThemeProvider } from "styled-components";
6
5
  import { space, color, typography, compose } from "styled-system";
7
6
 
8
7
  /**
@@ -16,16 +15,18 @@ import { space, color, typography, compose } from "styled-system";
16
15
  *
17
16
  * To get started you can import the icons into Font Awesome library. Alternatively if you want to use their full icon set you need to purchase a PRO plan from Font awesome, and can install the full pro icon packages in your app. See the readme here for more details on how to use and install PRO: <https://github.com/orchestrated-io/orcs-design-system>
18
17
  */
19
- import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
19
  const IconStyles = compose(space, color, typography);
21
20
  const IconWrapper = styled("span").withConfig({
22
21
  displayName: "Icon__IconWrapper",
23
22
  componentId: "sc-xeqnbo-0"
24
- })(css({
25
- lineHeight: "0",
26
- display: "inline-block"
27
- }), IconStyles);
28
- const Icon = /*#__PURE__*/React.forwardRef(function Icon(_ref, ref) {
23
+ })(["display:inline-block;line-height:0;", " ", ""], IconStyles, _ref => {
24
+ let {
25
+ hasSecondaryIcon
26
+ } = _ref;
27
+ return hasSecondaryIcon && css(["position:relative;display:flex;justify-content:center;align-items:center;& svg{position:absolute;}"]);
28
+ });
29
+ const Icon = /*#__PURE__*/React.forwardRef(function Icon(_ref2, ref) {
29
30
  let {
30
31
  border,
31
32
  mask,
@@ -33,6 +34,7 @@ const Icon = /*#__PURE__*/React.forwardRef(function Icon(_ref, ref) {
33
34
  inverse,
34
35
  flip,
35
36
  icon,
37
+ secondaryIcon,
36
38
  listitem,
37
39
  pull,
38
40
  pulse,
@@ -45,28 +47,35 @@ const Icon = /*#__PURE__*/React.forwardRef(function Icon(_ref, ref) {
45
47
  theme,
46
48
  title,
47
49
  ...props
48
- } = _ref;
49
- const component = /*#__PURE__*/_jsx(IconWrapper, {
50
+ } = _ref2;
51
+ const iconProps = {
52
+ border,
53
+ mask,
54
+ fixedWidth,
55
+ inverse,
56
+ flip,
57
+ listitem,
58
+ pull,
59
+ rotation,
60
+ pulse,
61
+ size,
62
+ spin,
63
+ symbol,
64
+ transform,
65
+ title: title && `Icon-${title}`
66
+ };
67
+ const component = /*#__PURE__*/_jsxs(IconWrapper, {
68
+ hasSecondaryIcon: !!secondaryIcon,
50
69
  color: color,
51
70
  ...props,
52
71
  ref: ref,
53
- children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
54
- border: border,
55
- mask: mask,
56
- fixedWidth: fixedWidth,
57
- inverse: inverse,
58
- flip: flip,
59
- listitem: listitem,
60
- pull: pull,
61
- rotation: rotation,
62
- icon: icon,
63
- pulse: pulse,
64
- size: size,
65
- spin: spin,
66
- symbol: symbol,
67
- transform: transform,
68
- title: title && `Icon-${title}`
69
- })
72
+ children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
73
+ ...iconProps,
74
+ icon: icon
75
+ }), secondaryIcon && /*#__PURE__*/_jsx(FontAwesomeIcon, {
76
+ ...iconProps,
77
+ icon: secondaryIcon
78
+ })]
70
79
  });
71
80
  return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
72
81
  theme: theme,
@@ -88,6 +97,8 @@ Icon.propTypes = {
88
97
  flip: PropTypes.oneOf(["horizontal", "vertical", "both"]),
89
98
  /** Set the Font Awesome style/weight, and icon */
90
99
  icon: PropTypes.array,
100
+ /** Set a secondary icon to render alongside the main icon */
101
+ secondaryIcon: PropTypes.array,
91
102
  /** Set icon to render in the style of a list bullet */
92
103
  listitem: PropTypes.bool,
93
104
  /** Pull an icon to float to the left or right of the element's other contents */
@@ -173,6 +184,13 @@ Icon.__docgenInfo = {
173
184
  },
174
185
  "required": false
175
186
  },
187
+ "secondaryIcon": {
188
+ "description": "Set a secondary icon to render alongside the main icon",
189
+ "type": {
190
+ "name": "array"
191
+ },
192
+ "required": false
193
+ },
176
194
  "listitem": {
177
195
  "description": "Set icon to render in the style of a list bullet",
178
196
  "type": {
@@ -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 => props.inlineBlock ? "inline-block !important" : "block !important");
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:1.4rem;font-weight:", ";color:", ";white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}&:hover .nav-item-text,&:focus .nav-item-text{color:", ";}"], themeGet("space.s"), 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,295 @@
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: [/*#__PURE__*/_jsx(PanelControlComponent, {
61
+ isExpanded: isExpanded,
62
+ onClick: handleExpandToggle,
63
+ ariaLabel: "toggle side navigation",
64
+ tooltipText: isExpanded ? "Collapse side navigation" : "Expand side navigation"
65
+ }), /*#__PURE__*/_jsx(ItemSection, {
66
+ items: topAlignedItems,
67
+ isExpanded: isExpanded,
68
+ isSmallScreen: isSmallScreen,
69
+ expandedItem: expandedItem,
70
+ handleItemClick: handleItemClick,
71
+ navItemRefs: navItemRefs
72
+ }), /*#__PURE__*/_jsx(ItemSection, {
73
+ items: pageSpecificItems,
74
+ isExpanded: isExpanded,
75
+ isSmallScreen: isSmallScreen,
76
+ expandedItem: expandedItem,
77
+ handleItemClick: handleItemClick,
78
+ navItemRefs: navItemRefs,
79
+ showDivider: true
80
+ }), /*#__PURE__*/_jsx(CurrentViewSectionPortalTarget, {}), yourTeams && yourTeams.length > 0 && /*#__PURE__*/_jsx(SideNavTeamsSection, {
81
+ teams: yourTeams,
82
+ isExpanded: isExpanded
83
+ }), pinnedItems && pinnedItems.length > 0 && /*#__PURE__*/_jsx(SideNavPinnedSection, {
84
+ items: pinnedItems,
85
+ isExpanded: isExpanded
86
+ }), /*#__PURE__*/_jsx(ItemSection, {
87
+ items: bottomAlignedItems,
88
+ isExpanded: isExpanded,
89
+ isSmallScreen: isSmallScreen,
90
+ expandedItem: expandedItem,
91
+ handleItemClick: handleItemClick,
92
+ navItemRefs: navItemRefs,
93
+ showDivider: true
94
+ })]
95
+ }), allItems.map((item, index) => {
96
+ if (item.actionType !== "component") return null;
97
+ if (index !== expandedItem || item.hide) return null;
98
+ return /*#__PURE__*/_jsx(ExpandedPanel, {
99
+ item: item,
100
+ expandedItem: expandedItem,
101
+ isExpanded: isExpanded,
102
+ expandedWidth: expandedWidth,
103
+ sideNavHeight: sideNavHeight,
104
+ isSmallScreen: isSmallScreen,
105
+ expandedRef: expandedRef,
106
+ onResizeStart: handleResizeStart,
107
+ onItemClick: handleItemClick,
108
+ onBlur: handleBlur
109
+ }, item.name);
110
+ })]
111
+ });
112
+ };
113
+ SideNavV2.propTypes = {
114
+ sideNavHeight: PropTypes.string.isRequired,
115
+ initiallyExpandedItemIndex: PropTypes.number,
116
+ items: PropTypes.arrayOf(PropTypes.shape({
117
+ iconName: PropTypes.string.isRequired,
118
+ name: PropTypes.string.isRequired,
119
+ badgeNumber: PropTypes.string,
120
+ badgeDot: PropTypes.bool,
121
+ hide: PropTypes.bool,
122
+ large: PropTypes.bool,
123
+ bottomAligned: PropTypes.bool,
124
+ actionType: PropTypes.oneOf(["component", "link", "button"]).isRequired,
125
+ component: PropTypes.elementType,
126
+ link: PropTypes.string,
127
+ onClick: PropTypes.func
128
+ })).isRequired,
129
+ LinkComponent: PropTypes.elementType,
130
+ // viewing prop is now optional since it can come from context
131
+
132
+ yourTeams: PropTypes.arrayOf(PropTypes.shape({
133
+ avatar: PropTypes.string,
134
+ name: PropTypes.string.isRequired,
135
+ link: PropTypes.string.isRequired
136
+ })),
137
+ pinnedItems: PropTypes.arrayOf(PropTypes.shape({
138
+ avatar: PropTypes.string,
139
+ name: PropTypes.string.isRequired,
140
+ link: PropTypes.string.isRequired,
141
+ shape: PropTypes.string,
142
+ onUnpin: PropTypes.func
143
+ }))
144
+ };
145
+ SideNavV2.__docgenInfo = {
146
+ "description": "",
147
+ "methods": [],
148
+ "displayName": "SideNavV2",
149
+ "props": {
150
+ "sideNavHeight": {
151
+ "description": "",
152
+ "type": {
153
+ "name": "string"
154
+ },
155
+ "required": true
156
+ },
157
+ "initiallyExpandedItemIndex": {
158
+ "description": "",
159
+ "type": {
160
+ "name": "number"
161
+ },
162
+ "required": false
163
+ },
164
+ "items": {
165
+ "description": "",
166
+ "type": {
167
+ "name": "arrayOf",
168
+ "value": {
169
+ "name": "shape",
170
+ "value": {
171
+ "iconName": {
172
+ "name": "string",
173
+ "required": true
174
+ },
175
+ "name": {
176
+ "name": "string",
177
+ "required": true
178
+ },
179
+ "badgeNumber": {
180
+ "name": "string",
181
+ "required": false
182
+ },
183
+ "badgeDot": {
184
+ "name": "bool",
185
+ "required": false
186
+ },
187
+ "hide": {
188
+ "name": "bool",
189
+ "required": false
190
+ },
191
+ "large": {
192
+ "name": "bool",
193
+ "required": false
194
+ },
195
+ "bottomAligned": {
196
+ "name": "bool",
197
+ "required": false
198
+ },
199
+ "actionType": {
200
+ "name": "enum",
201
+ "value": [{
202
+ "value": "\"component\"",
203
+ "computed": false
204
+ }, {
205
+ "value": "\"link\"",
206
+ "computed": false
207
+ }, {
208
+ "value": "\"button\"",
209
+ "computed": false
210
+ }],
211
+ "required": true
212
+ },
213
+ "component": {
214
+ "name": "elementType",
215
+ "required": false
216
+ },
217
+ "link": {
218
+ "name": "string",
219
+ "required": false
220
+ },
221
+ "onClick": {
222
+ "name": "func",
223
+ "required": false
224
+ }
225
+ }
226
+ }
227
+ },
228
+ "required": true
229
+ },
230
+ "LinkComponent": {
231
+ "description": "",
232
+ "type": {
233
+ "name": "elementType"
234
+ },
235
+ "required": false
236
+ },
237
+ "yourTeams": {
238
+ "description": "",
239
+ "type": {
240
+ "name": "arrayOf",
241
+ "value": {
242
+ "name": "shape",
243
+ "value": {
244
+ "avatar": {
245
+ "name": "string",
246
+ "required": false
247
+ },
248
+ "name": {
249
+ "name": "string",
250
+ "required": true
251
+ },
252
+ "link": {
253
+ "name": "string",
254
+ "required": true
255
+ }
256
+ }
257
+ }
258
+ },
259
+ "required": false
260
+ },
261
+ "pinnedItems": {
262
+ "description": "",
263
+ "type": {
264
+ "name": "arrayOf",
265
+ "value": {
266
+ "name": "shape",
267
+ "value": {
268
+ "avatar": {
269
+ "name": "string",
270
+ "required": false
271
+ },
272
+ "name": {
273
+ "name": "string",
274
+ "required": true
275
+ },
276
+ "link": {
277
+ "name": "string",
278
+ "required": true
279
+ },
280
+ "shape": {
281
+ "name": "string",
282
+ "required": false
283
+ },
284
+ "onUnpin": {
285
+ "name": "func",
286
+ "required": false
287
+ }
288
+ }
289
+ }
290
+ },
291
+ "required": false
292
+ }
293
+ }
294
+ };
295
+ export default SideNavV2;