orcs-design-system 3.3.47 → 3.3.49
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/README.md +5 -52
- package/es/components/SideNavV2/NavItem.js +100 -6
- package/es/components/SideNavV2/SideNav.js +80 -45
- package/es/components/SideNavV2/SideNavV2.stories.js +16 -20
- package/es/components/SideNavV2/__tests__/interaction-scenarios.test.js +344 -0
- package/es/components/SideNavV2/__tests__/resize.test.js +8 -3
- package/es/components/SideNavV2/__tests__/sections.test.js +22 -36
- package/es/components/SideNavV2/components/CurrentViewSectionPortalTarget.js +3 -1
- package/es/components/SideNavV2/components/ExpandedPanel.js +42 -39
- package/es/components/SideNavV2/components/ItemSection.js +45 -2
- package/es/components/SideNavV2/components/PanelControl.js +10 -211
- package/es/components/SideNavV2/constants/sideNav.js +6 -1
- package/es/components/SideNavV2/context/SideNavStateProvider.js +32 -3
- package/es/components/SideNavV2/hooks/useResize.js +21 -6
- package/es/components/SideNavV2/hooks/useResponsive.js +25 -5
- package/es/components/SideNavV2/hooks/useSideNavState.js +161 -62
- package/es/components/SideNavV2/index.js +1 -0
- package/es/components/SideNavV2/sections/SideNavTeamsSection.js +1 -1
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +192 -18
- package/es/components/SideNavV2/utils/itemUtils.js +43 -4
- package/es/components/SideNavV2/utils/resizeUtils.js +86 -27
- package/es/components/Tag/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,15 +36,7 @@ A new browser window will open with a random localhost port. ORCS runs [Storyboo
|
|
|
36
36
|
|
|
37
37
|
All library components and files are located in `/lib`. Static files are located in `/assets`.
|
|
38
38
|
|
|
39
|
-
### Viewing changes in
|
|
40
|
-
|
|
41
|
-
As an alternative to `npm link` you can run `npm run dist` and then copy the `es` folder directly into TD or PM:
|
|
42
|
-
|
|
43
|
-
`cp -R es/ ../../../team-directory/node_modules/orcs-design-system/`
|
|
44
|
-
|
|
45
|
-
**_This has now been been made easier with using Nodemon and a custom script. Read on for how to set this up._**
|
|
46
|
-
|
|
47
|
-
### Working with orcs locally (hot reloading).
|
|
39
|
+
### Viewing local orcs changes in other projects (with hot reloading)
|
|
48
40
|
|
|
49
41
|
1. `cp .env.example .env`
|
|
50
42
|
2. OPTIONAL: Update `WORKING_DIR` in `.env` if orcs resides in a different working directory to your project. Else-wise Orcs will assume the project is one level up from itself.
|
|
@@ -63,39 +55,6 @@ snapshot: {
|
|
|
63
55
|
|
|
64
56
|
Now you can make any changes in orcs and it will build and then copy the es from the build into your project's node_modules. Run `npm install` in your project dir if you want to revert to the npm installation.
|
|
65
57
|
|
|
66
|
-
### Symlinking with `npm link`
|
|
67
|
-
|
|
68
|
-
##### We haven't had much success with this recently
|
|
69
|
-
|
|
70
|
-
If you need to do `npm link` in your local environment you might encounter the following issues:
|
|
71
|
-
|
|
72
|
-
- https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
|
|
73
|
-
- https://github.com/styled-components/styled-components/issues/2379
|
|
74
|
-
|
|
75
|
-
Both react and styled-components cause duplicate instance issue after npm link, to fix that we need to ensure both app project and lib project are sharing the same instance of them.
|
|
76
|
-
|
|
77
|
-
In `orcs-design-system` folder:
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
npm link {PATH_APP_REPO}/node_modules/react
|
|
81
|
-
npm link {PATH_APP_REPO}/node_modules/styled-components
|
|
82
|
-
npm link
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
In `{PATH_APP_REPO}`:
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
npm i orcs-design-system
|
|
89
|
-
npm link orcs-design-system
|
|
90
|
-
npm start
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Testing
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
npm run test
|
|
97
|
-
```
|
|
98
|
-
|
|
99
58
|
### Publishing changes
|
|
100
59
|
|
|
101
60
|
In order to publish a new version, you will have to patch and push your changes.
|
|
@@ -105,11 +64,11 @@ After your changes have been merged to master, from your master branch:
|
|
|
105
64
|
npm version patch
|
|
106
65
|
```
|
|
107
66
|
|
|
108
|
-
|
|
67
|
+
This will bump version patch number and make a commit to current branch.
|
|
109
68
|
|
|
110
69
|
### Deploying to GitHub Pages
|
|
111
70
|
|
|
112
|
-
ORCS automatically deploys to GitHub Pages when a new version is published. To manually deploy:
|
|
71
|
+
ORCS automatically deploys to GitHub Pages when a new version is published and merged to master. To manually deploy:
|
|
113
72
|
|
|
114
73
|
```
|
|
115
74
|
npm run deploy-storybook
|
|
@@ -138,17 +97,11 @@ import { Box } from "orcs-design-system"
|
|
|
138
97
|
|
|
139
98
|
The [ORCS Storybook](https://orchestrated-io.github.io/orcs-design-system) contains documentation for each component, including code examples and props tables.
|
|
140
99
|
|
|
141
|
-
For components with subcomponents, each subcomponent must be imported. For example, to use `Tabs`:
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
import { TabsContainer, Tab } from "orcs-design-system"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
100
|
### Using Styled System props
|
|
148
101
|
|
|
149
|
-
The design system components are built with [Styled System](https://styled-system
|
|
102
|
+
The design system components are built with [Styled System](https://github.com/styled-system/styled-system) props. Generally, components can access the `space` and `layout` prop categories, with additional prop categories on a per-component basis. Check the _Properties_ section in a component's documentation to see what props it can use. Custom props will be listed in the props table.
|
|
150
103
|
|
|
151
|
-
As a guide to using these props, see the [Styled System reference table](https://styled-system
|
|
104
|
+
As a guide to using these props, see the [Styled System reference table](https://github.com/styled-system/styled-system/blob/master/docs/table.md).
|
|
152
105
|
|
|
153
106
|
The design system's theme scales are contained in [systemtheme](https://github.com/orchestrated-io/orcs-design-system/blob/master/packages/orcs-design-system/lib/systemtheme.js).
|
|
154
107
|
|
|
@@ -66,6 +66,27 @@ const SideNavItemWrapper = styled.div.withConfig({
|
|
|
66
66
|
marginTop: props.bottomAligned && "auto"
|
|
67
67
|
}
|
|
68
68
|
}));
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* NavItem - A navigation item component for the SideNavV2
|
|
72
|
+
*
|
|
73
|
+
* Renders either a button or link-based navigation item with support for:
|
|
74
|
+
* - Icons with optional badges
|
|
75
|
+
* - Expandable/collapsible states
|
|
76
|
+
* - Active state styling
|
|
77
|
+
* - Responsive behavior
|
|
78
|
+
* - Accessibility features
|
|
79
|
+
*
|
|
80
|
+
* @param {Object} props - Component props
|
|
81
|
+
* @param {Object} props.item - Navigation item data
|
|
82
|
+
* @param {React.ElementType} [props.Component] - Component to render for link items
|
|
83
|
+
* @param {boolean} props.isActive - Whether the item is currently active
|
|
84
|
+
* @param {Function} props.handleItemClick - Click handler function
|
|
85
|
+
* @param {Object} props.navItemRefs - Ref object for managing item references
|
|
86
|
+
* @param {boolean} props.isSmallScreen - Whether currently on a small screen
|
|
87
|
+
* @param {boolean} props.isExpanded - Whether the navigation is expanded
|
|
88
|
+
* @returns {JSX.Element} Rendered navigation item
|
|
89
|
+
*/
|
|
69
90
|
const NavItem = _ref => {
|
|
70
91
|
let {
|
|
71
92
|
item,
|
|
@@ -136,25 +157,98 @@ const NavItem = _ref => {
|
|
|
136
157
|
});
|
|
137
158
|
};
|
|
138
159
|
NavItem.propTypes = {
|
|
139
|
-
item: PropTypes.
|
|
160
|
+
item: PropTypes.shape({
|
|
161
|
+
index: PropTypes.number,
|
|
162
|
+
iconName: PropTypes.string.isRequired,
|
|
163
|
+
name: PropTypes.string.isRequired,
|
|
164
|
+
actionType: PropTypes.oneOf(["component", "link", "button"]).isRequired,
|
|
165
|
+
bottomAligned: PropTypes.bool,
|
|
166
|
+
hide: PropTypes.bool,
|
|
167
|
+
component: PropTypes.elementType,
|
|
168
|
+
onClick: PropTypes.func,
|
|
169
|
+
isActive: PropTypes.bool,
|
|
170
|
+
badgeNumber: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
171
|
+
badgeDot: PropTypes.bool
|
|
172
|
+
}).isRequired,
|
|
140
173
|
Component: PropTypes.elementType,
|
|
141
174
|
isActive: PropTypes.bool,
|
|
142
|
-
handleItemClick: PropTypes.func,
|
|
175
|
+
handleItemClick: PropTypes.func.isRequired,
|
|
143
176
|
navItemRefs: PropTypes.object,
|
|
144
177
|
isSmallScreen: PropTypes.bool,
|
|
145
178
|
isExpanded: PropTypes.bool
|
|
146
179
|
};
|
|
147
180
|
NavItem.__docgenInfo = {
|
|
148
|
-
"description": "",
|
|
181
|
+
"description": "NavItem - A navigation item component for the SideNavV2\n\nRenders either a button or link-based navigation item with support for:\n- Icons with optional badges\n- Expandable/collapsible states\n- Active state styling\n- Responsive behavior\n- Accessibility features\n\n@param {Object} props - Component props\n@param {Object} props.item - Navigation item data\n@param {React.ElementType} [props.Component] - Component to render for link items\n@param {boolean} props.isActive - Whether the item is currently active\n@param {Function} props.handleItemClick - Click handler function\n@param {Object} props.navItemRefs - Ref object for managing item references\n@param {boolean} props.isSmallScreen - Whether currently on a small screen\n@param {boolean} props.isExpanded - Whether the navigation is expanded\n@returns {JSX.Element} Rendered navigation item",
|
|
149
182
|
"methods": [],
|
|
150
183
|
"displayName": "NavItem",
|
|
151
184
|
"props": {
|
|
152
185
|
"item": {
|
|
153
186
|
"description": "",
|
|
154
187
|
"type": {
|
|
155
|
-
"name": "
|
|
188
|
+
"name": "shape",
|
|
189
|
+
"value": {
|
|
190
|
+
"index": {
|
|
191
|
+
"name": "number",
|
|
192
|
+
"required": false
|
|
193
|
+
},
|
|
194
|
+
"iconName": {
|
|
195
|
+
"name": "string",
|
|
196
|
+
"required": true
|
|
197
|
+
},
|
|
198
|
+
"name": {
|
|
199
|
+
"name": "string",
|
|
200
|
+
"required": true
|
|
201
|
+
},
|
|
202
|
+
"actionType": {
|
|
203
|
+
"name": "enum",
|
|
204
|
+
"value": [{
|
|
205
|
+
"value": "\"component\"",
|
|
206
|
+
"computed": false
|
|
207
|
+
}, {
|
|
208
|
+
"value": "\"link\"",
|
|
209
|
+
"computed": false
|
|
210
|
+
}, {
|
|
211
|
+
"value": "\"button\"",
|
|
212
|
+
"computed": false
|
|
213
|
+
}],
|
|
214
|
+
"required": true
|
|
215
|
+
},
|
|
216
|
+
"bottomAligned": {
|
|
217
|
+
"name": "bool",
|
|
218
|
+
"required": false
|
|
219
|
+
},
|
|
220
|
+
"hide": {
|
|
221
|
+
"name": "bool",
|
|
222
|
+
"required": false
|
|
223
|
+
},
|
|
224
|
+
"component": {
|
|
225
|
+
"name": "elementType",
|
|
226
|
+
"required": false
|
|
227
|
+
},
|
|
228
|
+
"onClick": {
|
|
229
|
+
"name": "func",
|
|
230
|
+
"required": false
|
|
231
|
+
},
|
|
232
|
+
"isActive": {
|
|
233
|
+
"name": "bool",
|
|
234
|
+
"required": false
|
|
235
|
+
},
|
|
236
|
+
"badgeNumber": {
|
|
237
|
+
"name": "union",
|
|
238
|
+
"value": [{
|
|
239
|
+
"name": "string"
|
|
240
|
+
}, {
|
|
241
|
+
"name": "number"
|
|
242
|
+
}],
|
|
243
|
+
"required": false
|
|
244
|
+
},
|
|
245
|
+
"badgeDot": {
|
|
246
|
+
"name": "bool",
|
|
247
|
+
"required": false
|
|
248
|
+
}
|
|
249
|
+
}
|
|
156
250
|
},
|
|
157
|
-
"required":
|
|
251
|
+
"required": true
|
|
158
252
|
},
|
|
159
253
|
"Component": {
|
|
160
254
|
"description": "",
|
|
@@ -175,7 +269,7 @@ NavItem.__docgenInfo = {
|
|
|
175
269
|
"type": {
|
|
176
270
|
"name": "func"
|
|
177
271
|
},
|
|
178
|
-
"required":
|
|
272
|
+
"required": true
|
|
179
273
|
},
|
|
180
274
|
"navItemRefs": {
|
|
181
275
|
"description": "",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import SideNavTeamsSection from "./sections/SideNavTeamsSection";
|
|
4
4
|
import SideNavPinnedSection from "./sections/SideNavPinnedSection";
|
|
@@ -12,13 +12,31 @@ import useResize from "./hooks/useResize";
|
|
|
12
12
|
import { categorizeItems } from "./utils/itemUtils";
|
|
13
13
|
|
|
14
14
|
// Styled Components
|
|
15
|
-
import { SideNavWrapper, SideNavItems } from "./styles/SideNavV2.styles";
|
|
15
|
+
import { SideNavWrapper, SideNavItems, ToggleHandle, ToggleIcon } from "./styles/SideNavV2.styles";
|
|
16
16
|
|
|
17
17
|
// Components
|
|
18
|
-
import PanelControlComponent from "./components/PanelControl";
|
|
19
18
|
import ExpandedPanel from "./components/ExpandedPanel";
|
|
20
19
|
import ItemSection from "./components/ItemSection";
|
|
21
20
|
import CurrentViewSectionPortalTarget from "./components/CurrentViewSectionPortalTarget";
|
|
21
|
+
import Icon from "../Icon";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* SideNavV2 - A responsive side navigation component with expandable panels
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - Responsive design that adapts to mobile and desktop
|
|
28
|
+
* - Expandable panels with resizable functionality
|
|
29
|
+
* - Hover-based auto-expansion (when enabled)
|
|
30
|
+
* - Team and pinned item sections
|
|
31
|
+
* - Current view section portal integration
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} props - Component props
|
|
34
|
+
* @param {Array} props.items - Navigation items to display
|
|
35
|
+
* @param {string} props.sideNavHeight - Height of the side navigation
|
|
36
|
+
* @param {Array} [props.yourTeams] - Teams to display in the teams section
|
|
37
|
+
* @param {Array} [props.pinnedItems] - Pinned items to display
|
|
38
|
+
* @returns {JSX.Element} Rendered side navigation
|
|
39
|
+
*/
|
|
22
40
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
41
|
const SideNavV2 = _ref => {
|
|
24
42
|
let {
|
|
@@ -34,45 +52,44 @@ const SideNavV2 = _ref => {
|
|
|
34
52
|
expandedRef,
|
|
35
53
|
navItemRefs,
|
|
36
54
|
wrapperRef,
|
|
37
|
-
isLocked,
|
|
38
55
|
handleItemClick,
|
|
39
|
-
handleBlur,
|
|
40
56
|
handleWidthChange,
|
|
41
|
-
|
|
57
|
+
handleExpandToggle,
|
|
58
|
+
isLocked,
|
|
59
|
+
wasExpandedByHover,
|
|
60
|
+
hasBeenManuallyCollapsed
|
|
42
61
|
} = useSideNavState(items);
|
|
43
62
|
const {
|
|
44
63
|
isSmallScreen
|
|
45
64
|
} = useResponsive();
|
|
46
65
|
|
|
47
|
-
//
|
|
48
|
-
const currentItem = expandedItem !== null ? items[expandedItem] : null;
|
|
66
|
+
// Memoize expensive calculations to prevent unnecessary re-renders
|
|
67
|
+
const currentItem = useMemo(() => expandedItem !== null ? items[expandedItem] : null, [expandedItem, items]);
|
|
49
68
|
const {
|
|
50
69
|
handleResizeStart
|
|
51
70
|
} = useResize(expandedRef, isSmallScreen, expandedItem, handleWidthChange, currentItem);
|
|
52
71
|
|
|
53
|
-
//
|
|
72
|
+
// Memoize categorized items to prevent recalculation on every render
|
|
73
|
+
const categorizedItems = useMemo(() => categorizeItems(items), [items]);
|
|
54
74
|
const {
|
|
55
75
|
topAlignedItems,
|
|
56
76
|
pageSpecificItems,
|
|
57
77
|
bottomAlignedItems,
|
|
58
78
|
allItems
|
|
59
|
-
} =
|
|
79
|
+
} = categorizedItems;
|
|
80
|
+
|
|
81
|
+
// Determine toggle button icon
|
|
82
|
+
// Show "Keep open" state when expanded by hover OR when collapsed and hover behavior is enabled
|
|
83
|
+
const shouldShowKeepOpen = useMemo(() => wasExpandedByHover && !isLocked || !isExpanded && hasBeenManuallyCollapsed, [wasExpandedByHover, isLocked, isExpanded, hasBeenManuallyCollapsed]);
|
|
84
|
+
const toggleIcon = useMemo(() => shouldShowKeepOpen ? "chevron-right" : "chevron-left", [shouldShowKeepOpen]);
|
|
60
85
|
return /*#__PURE__*/_jsxs(SideNavWrapper, {
|
|
61
86
|
ref: wrapperRef,
|
|
62
87
|
sideNavHeight: sideNavHeight,
|
|
88
|
+
"data-testid": "side-nav-wrapper",
|
|
63
89
|
children: [/*#__PURE__*/_jsxs(SideNavItems, {
|
|
64
90
|
isExpanded: isExpanded,
|
|
65
91
|
"data-testid": "side-nav-items",
|
|
66
|
-
children: [
|
|
67
|
-
isExpanded: isExpanded,
|
|
68
|
-
isLocked: isLocked,
|
|
69
|
-
onClick: handleLockToggle,
|
|
70
|
-
ariaLabel: isLocked ? "unlock navigation" : isExpanded ? "lock navigation" : "open navigation",
|
|
71
|
-
mt: "10px",
|
|
72
|
-
mb: "4px",
|
|
73
|
-
tooltipText: isLocked ? "Collapse" : isExpanded ? "Keep open" : "Expand navigation",
|
|
74
|
-
mode: "lock"
|
|
75
|
-
}), /*#__PURE__*/_jsx(ItemSection, {
|
|
92
|
+
children: [/*#__PURE__*/_jsx(ItemSection, {
|
|
76
93
|
items: topAlignedItems,
|
|
77
94
|
isExpanded: isExpanded,
|
|
78
95
|
isSmallScreen: isSmallScreen,
|
|
@@ -102,6 +119,19 @@ const SideNavV2 = _ref => {
|
|
|
102
119
|
navItemRefs: navItemRefs,
|
|
103
120
|
showDivider: true
|
|
104
121
|
})]
|
|
122
|
+
}), !isSmallScreen && /*#__PURE__*/_jsx(ToggleHandle, {
|
|
123
|
+
onClick: handleExpandToggle,
|
|
124
|
+
isLocked: shouldShowKeepOpen,
|
|
125
|
+
"data-testid": "toggle-handle",
|
|
126
|
+
isExpanded: isExpanded,
|
|
127
|
+
children: /*#__PURE__*/_jsx(ToggleIcon, {
|
|
128
|
+
className: "toggle-icon",
|
|
129
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
130
|
+
icon: ["fas", toggleIcon],
|
|
131
|
+
size: "xs",
|
|
132
|
+
fontSize: "12px"
|
|
133
|
+
})
|
|
134
|
+
})
|
|
105
135
|
}), allItems.map((item, index) => {
|
|
106
136
|
if (item.actionType !== "component") return null;
|
|
107
137
|
if (index !== expandedItem || item.hide) return null;
|
|
@@ -110,35 +140,33 @@ const SideNavV2 = _ref => {
|
|
|
110
140
|
expandedItem: expandedItem,
|
|
111
141
|
isExpanded: isExpanded,
|
|
112
142
|
expandedWidth: expandedWidth,
|
|
113
|
-
sideNavHeight: sideNavHeight,
|
|
114
143
|
isSmallScreen: isSmallScreen,
|
|
115
144
|
expandedRef: expandedRef,
|
|
116
145
|
onResizeStart: handleResizeStart,
|
|
117
|
-
onItemClick: handleItemClick
|
|
118
|
-
onBlur: handleBlur
|
|
146
|
+
onItemClick: handleItemClick
|
|
119
147
|
}, item.name);
|
|
120
148
|
})]
|
|
121
149
|
});
|
|
122
150
|
};
|
|
123
151
|
SideNavV2.propTypes = {
|
|
124
152
|
sideNavHeight: PropTypes.string.isRequired,
|
|
125
|
-
initiallyExpandedItemIndex: PropTypes.number,
|
|
126
153
|
items: PropTypes.arrayOf(PropTypes.shape({
|
|
127
154
|
iconName: PropTypes.string.isRequired,
|
|
128
155
|
name: PropTypes.string.isRequired,
|
|
129
|
-
badgeNumber: PropTypes.string,
|
|
156
|
+
badgeNumber: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
130
157
|
badgeDot: PropTypes.bool,
|
|
131
158
|
hide: PropTypes.bool,
|
|
132
159
|
large: PropTypes.bool,
|
|
133
160
|
bottomAligned: PropTypes.bool,
|
|
161
|
+
pageSpecific: PropTypes.bool,
|
|
162
|
+
isExpandedByDefault: PropTypes.bool,
|
|
163
|
+
isActive: PropTypes.bool,
|
|
134
164
|
actionType: PropTypes.oneOf(["component", "link", "button"]).isRequired,
|
|
135
165
|
component: PropTypes.elementType,
|
|
136
166
|
link: PropTypes.string,
|
|
137
|
-
onClick: PropTypes.func
|
|
167
|
+
onClick: PropTypes.func,
|
|
168
|
+
index: PropTypes.number
|
|
138
169
|
})).isRequired,
|
|
139
|
-
LinkComponent: PropTypes.elementType,
|
|
140
|
-
// viewing prop is now optional since it can come from context
|
|
141
|
-
|
|
142
170
|
yourTeams: PropTypes.arrayOf(PropTypes.shape({
|
|
143
171
|
avatar: PropTypes.string,
|
|
144
172
|
name: PropTypes.string.isRequired,
|
|
@@ -153,7 +181,7 @@ SideNavV2.propTypes = {
|
|
|
153
181
|
}))
|
|
154
182
|
};
|
|
155
183
|
SideNavV2.__docgenInfo = {
|
|
156
|
-
"description": "",
|
|
184
|
+
"description": "SideNavV2 - A responsive side navigation component with expandable panels\n\nFeatures:\n- Responsive design that adapts to mobile and desktop\n- Expandable panels with resizable functionality\n- Hover-based auto-expansion (when enabled)\n- Team and pinned item sections\n- Current view section portal integration\n\n@param {Object} props - Component props\n@param {Array} props.items - Navigation items to display\n@param {string} props.sideNavHeight - Height of the side navigation\n@param {Array} [props.yourTeams] - Teams to display in the teams section\n@param {Array} [props.pinnedItems] - Pinned items to display\n@returns {JSX.Element} Rendered side navigation",
|
|
157
185
|
"methods": [],
|
|
158
186
|
"displayName": "SideNavV2",
|
|
159
187
|
"props": {
|
|
@@ -164,13 +192,6 @@ SideNavV2.__docgenInfo = {
|
|
|
164
192
|
},
|
|
165
193
|
"required": true
|
|
166
194
|
},
|
|
167
|
-
"initiallyExpandedItemIndex": {
|
|
168
|
-
"description": "",
|
|
169
|
-
"type": {
|
|
170
|
-
"name": "number"
|
|
171
|
-
},
|
|
172
|
-
"required": false
|
|
173
|
-
},
|
|
174
195
|
"items": {
|
|
175
196
|
"description": "",
|
|
176
197
|
"type": {
|
|
@@ -187,7 +208,12 @@ SideNavV2.__docgenInfo = {
|
|
|
187
208
|
"required": true
|
|
188
209
|
},
|
|
189
210
|
"badgeNumber": {
|
|
190
|
-
"name": "
|
|
211
|
+
"name": "union",
|
|
212
|
+
"value": [{
|
|
213
|
+
"name": "string"
|
|
214
|
+
}, {
|
|
215
|
+
"name": "number"
|
|
216
|
+
}],
|
|
191
217
|
"required": false
|
|
192
218
|
},
|
|
193
219
|
"badgeDot": {
|
|
@@ -206,6 +232,18 @@ SideNavV2.__docgenInfo = {
|
|
|
206
232
|
"name": "bool",
|
|
207
233
|
"required": false
|
|
208
234
|
},
|
|
235
|
+
"pageSpecific": {
|
|
236
|
+
"name": "bool",
|
|
237
|
+
"required": false
|
|
238
|
+
},
|
|
239
|
+
"isExpandedByDefault": {
|
|
240
|
+
"name": "bool",
|
|
241
|
+
"required": false
|
|
242
|
+
},
|
|
243
|
+
"isActive": {
|
|
244
|
+
"name": "bool",
|
|
245
|
+
"required": false
|
|
246
|
+
},
|
|
209
247
|
"actionType": {
|
|
210
248
|
"name": "enum",
|
|
211
249
|
"value": [{
|
|
@@ -231,19 +269,16 @@ SideNavV2.__docgenInfo = {
|
|
|
231
269
|
"onClick": {
|
|
232
270
|
"name": "func",
|
|
233
271
|
"required": false
|
|
272
|
+
},
|
|
273
|
+
"index": {
|
|
274
|
+
"name": "number",
|
|
275
|
+
"required": false
|
|
234
276
|
}
|
|
235
277
|
}
|
|
236
278
|
}
|
|
237
279
|
},
|
|
238
280
|
"required": true
|
|
239
281
|
},
|
|
240
|
-
"LinkComponent": {
|
|
241
|
-
"description": "",
|
|
242
|
-
"type": {
|
|
243
|
-
"name": "elementType"
|
|
244
|
-
},
|
|
245
|
-
"required": false
|
|
246
|
-
},
|
|
247
282
|
"yourTeams": {
|
|
248
283
|
"description": "",
|
|
249
284
|
"type": {
|
|
@@ -10,7 +10,6 @@ import { library } from "@fortawesome/fontawesome-svg-core";
|
|
|
10
10
|
import Flex from "../Flex";
|
|
11
11
|
import Spacer from "../Spacer/index";
|
|
12
12
|
import Card from "../Card/index";
|
|
13
|
-
import Badge from "../Badge/index";
|
|
14
13
|
import RenderCurrentViewSection from "./components/RenderCurrentViewSection";
|
|
15
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
15
|
library.add(far);
|
|
@@ -79,7 +78,7 @@ const getViewingState = teamId => {
|
|
|
79
78
|
avatar: teams[teamId].avatar,
|
|
80
79
|
shape: teams[teamId].shape,
|
|
81
80
|
// badge: teams[teamId].type && (
|
|
82
|
-
// <Badge variant="success">{teams[teamId].type}</Badge>
|
|
81
|
+
// <Badge variant="success">{teams[teamId].type}</Badge> // Badge is optional
|
|
83
82
|
// ),
|
|
84
83
|
subNav: [{
|
|
85
84
|
name: "Overview",
|
|
@@ -111,10 +110,7 @@ const getViewingState = teamId => {
|
|
|
111
110
|
const getPeopleState = personId => {
|
|
112
111
|
return {
|
|
113
112
|
name: "James Merrit",
|
|
114
|
-
badge:
|
|
115
|
-
variant: "success",
|
|
116
|
-
children: "Engineer"
|
|
117
|
-
}),
|
|
113
|
+
// badge: <Badge variant="success">Engineer</Badge>, // Badge is optional
|
|
118
114
|
avatar: "https://randomuser.me/api/portraits/men/24.jpg",
|
|
119
115
|
shape: "circle",
|
|
120
116
|
subNav: [{
|
|
@@ -250,10 +246,10 @@ const SideBarWithConfig = () => {
|
|
|
250
246
|
component: makePanelComponent("Filter"),
|
|
251
247
|
actionType: "component",
|
|
252
248
|
// Use 'component' for a component
|
|
253
|
-
pageSpecific:
|
|
249
|
+
pageSpecific: true,
|
|
250
|
+
isExpandedByDefault: matchPath(location.pathname, {
|
|
254
251
|
path: "/search"
|
|
255
|
-
})
|
|
256
|
-
isExpandedByDefault: true
|
|
252
|
+
})
|
|
257
253
|
}, {
|
|
258
254
|
iconName: "sun",
|
|
259
255
|
name: "People",
|
|
@@ -264,10 +260,10 @@ const SideBarWithConfig = () => {
|
|
|
264
260
|
component: makePanelComponent("People"),
|
|
265
261
|
actionType: "component",
|
|
266
262
|
// Use 'component' for a component
|
|
267
|
-
pageSpecific:
|
|
263
|
+
pageSpecific: true,
|
|
264
|
+
isExpandedByDefault: matchPath(location.pathname, {
|
|
268
265
|
path: "/profile"
|
|
269
|
-
})
|
|
270
|
-
isExpandedByDefault: true
|
|
266
|
+
})
|
|
271
267
|
}, {
|
|
272
268
|
iconName: "bell",
|
|
273
269
|
name: "Notifications",
|
|
@@ -287,7 +283,7 @@ const SideBarWithConfig = () => {
|
|
|
287
283
|
to: `/teams/${team}/overview`,
|
|
288
284
|
children: team
|
|
289
285
|
}, team)), /*#__PURE__*/_jsx(P, {
|
|
290
|
-
children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi
|
|
286
|
+
children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestias non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
|
|
291
287
|
})]
|
|
292
288
|
})),
|
|
293
289
|
actionType: "component" // Use 'component' for a component
|
|
@@ -299,13 +295,6 @@ const SideBarWithConfig = () => {
|
|
|
299
295
|
bottomAligned: true,
|
|
300
296
|
component: makePanelComponent("Settings"),
|
|
301
297
|
actionType: "component" // Use 'component' for a component
|
|
302
|
-
}, {
|
|
303
|
-
iconName: "calendar-alt",
|
|
304
|
-
name: "Calendar",
|
|
305
|
-
pageSpecific: true,
|
|
306
|
-
// Specify pageSpecific if you want this item to appear below a divider line separating common nav items from page/route specific items
|
|
307
|
-
component: makePanelComponent("Calendar"),
|
|
308
|
-
actionType: "component" // Use 'component' for a component
|
|
309
298
|
}, {
|
|
310
299
|
iconName: "star",
|
|
311
300
|
name: "Announcements",
|
|
@@ -349,6 +338,13 @@ const SideBarWithConfig = () => {
|
|
|
349
338
|
children: "Profile route"
|
|
350
339
|
})
|
|
351
340
|
})
|
|
341
|
+
}), /*#__PURE__*/_jsx(Route, {
|
|
342
|
+
path: "/search",
|
|
343
|
+
children: /*#__PURE__*/_jsx(PageCard, {
|
|
344
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
345
|
+
children: "Search route"
|
|
346
|
+
})
|
|
347
|
+
})
|
|
352
348
|
}), /*#__PURE__*/_jsx(Route, {
|
|
353
349
|
path: "/teams/:teamId",
|
|
354
350
|
children: /*#__PURE__*/_jsx(PageCard, {
|