orcs-design-system 3.1.36 → 3.1.37

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.
@@ -6,7 +6,10 @@ import styled, { ThemeProvider } from "styled-components";
6
6
  import PropTypes from "prop-types";
7
7
  import { space, layout, color } from "styled-system";
8
8
  import { themeGet } from "@styled-system/theme-get";
9
+ import shouldForwardProp from "@styled-system/should-forward-prop";
9
10
  var Item = styled.div.withConfig({
11
+ shouldForwardProp: shouldForwardProp
12
+ }).withConfig({
10
13
  displayName: "Divider__Item",
11
14
  componentId: "sc-106mlj-0"
12
15
  })(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, function (props) {
@@ -113,6 +113,9 @@ var SideNavItemPopover = styled(Popover).withConfig({
113
113
  width: "100%",
114
114
  marginBottom: props.bottomAligned ? "0" : "s",
115
115
  marginTop: props.bottomAligned ? "s" : "0",
116
+ ":nth-child(1 of .bottom-aligned) ": {
117
+ marginTop: props.bottomAligned && "auto"
118
+ },
116
119
  "&:hover,&:focus-within": {
117
120
  "& .popoverText": {
118
121
  opacity: "1",
@@ -208,13 +211,14 @@ var NavItem = function NavItem(_ref) {
208
211
  }), {}, {
209
212
  "aria-label": item.name
210
213
  });
211
- return item.actionType === "link" ? /*#__PURE__*/React.createElement(SideNavItemPopover, {
214
+ return /*#__PURE__*/React.createElement(SideNavItemPopover, {
215
+ className: item.bottomAligned && "bottom-aligned",
212
216
  text: item.name,
213
217
  textAlign: "center",
214
218
  width: "124px",
215
219
  active: item.index === activeItem,
216
220
  bottomAligned: item.bottomAligned
217
- }, /*#__PURE__*/React.createElement(SideNavItemLink, {
221
+ }, item.actionType === "link" ? /*#__PURE__*/React.createElement(SideNavItemLink, {
218
222
  key: item.index,
219
223
  active: item.index === activeItem,
220
224
  bottomAligned: item.bottomAligned,
@@ -228,13 +232,7 @@ var NavItem = function NavItem(_ref) {
228
232
  item: item
229
233
  }, /*#__PURE__*/React.createElement(Icon, {
230
234
  icon: ["far", item.iconName]
231
- })))) : /*#__PURE__*/React.createElement(SideNavItemPopover, {
232
- text: item.name,
233
- textAlign: "center",
234
- width: "124px",
235
- active: item.index === activeItem,
236
- bottomAligned: item.bottomAligned
237
- }, /*#__PURE__*/React.createElement(SideNavItem, _extends({
235
+ }))) : /*#__PURE__*/React.createElement(SideNavItem, _extends({
238
236
  key: item.index,
239
237
  active: item.index === activeItem,
240
238
  onClick: function onClick() {
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -10,7 +11,6 @@ import PropTypes from "prop-types";
10
11
  import Icon from "../Icon";
11
12
  import Popover from "../Popover";
12
13
  import Divider from "../Divider";
13
- import Box from "../Box";
14
14
  import NavItem from "./NavItem";
15
15
  var SideNavWrapper = styled("div").withConfig({
16
16
  displayName: "SideNav__SideNavWrapper",
@@ -112,25 +112,9 @@ var PanelControl = styled("button").withConfig({
112
112
  border: "none"
113
113
  });
114
114
  });
115
- var BottomAlignedNavItems = styled("div").withConfig({
116
- displayName: "SideNav__BottomAlignedNavItems",
117
- componentId: "sc-1heo0i9-4"
118
- })(function () {
119
- return css({
120
- marginTop: "auto",
121
- display: "flex",
122
- flexDirection: "column",
123
- alignItems: "center",
124
- justifyContent: "flex-start",
125
- width: "100%",
126
- "@media screen and (max-width: 900px)": {
127
- width: "auto"
128
- }
129
- });
130
- });
131
115
  var SideNavExpanded = styled("div").withConfig({
132
116
  displayName: "SideNav__SideNavExpanded",
133
- componentId: "sc-1heo0i9-5"
117
+ componentId: "sc-1heo0i9-4"
134
118
  })(function (props) {
135
119
  return css({
136
120
  position: "relative",
@@ -181,7 +165,9 @@ var SideNav = function SideNav(_ref) {
181
165
  onButtonClick && onButtonClick(item);
182
166
  itemIndex === expandedItem && navItemRefs.current && navItemRefs.current[itemIndex] && navItemRefs.current[itemIndex].focus();
183
167
  }
184
- setActiveItem(itemIndex === activeItem ? null : itemIndex);
168
+ if (actionType !== "button") {
169
+ setActiveItem(itemIndex === activeItem ? null : itemIndex);
170
+ }
185
171
  };
186
172
 
187
173
  // Split items into two arrays based on the bottomAligned prop
@@ -231,14 +217,13 @@ var SideNav = function SideNav(_ref) {
231
217
  var handleBlur = function handleBlur(item) {
232
218
  handleItemClick(item);
233
219
  };
234
- return /*#__PURE__*/React.createElement(SideNavWrapper, {
235
- sideNavHeight: sideNavHeight
236
- }, /*#__PURE__*/React.createElement(SideNavItems, null, topAlignedItems.map(function (item) {
220
+ var orderedItems = [].concat(_toConsumableArray(topAlignedItems), _toConsumableArray(pageSpecificItems), _toConsumableArray(bottomAlignedItems));
221
+ var renderItem = function renderItem(item, index) {
237
222
  if (item.hide) {
238
223
  return null;
239
224
  }
240
225
  var Component = item.component;
241
- return /*#__PURE__*/React.createElement(NavItem, {
226
+ var Item = /*#__PURE__*/React.createElement(NavItem, {
242
227
  key: item.index,
243
228
  item: item,
244
229
  Component: Component,
@@ -246,58 +231,19 @@ var SideNav = function SideNav(_ref) {
246
231
  handleItemClick: handleItemClick,
247
232
  navItemRefs: navItemRefs
248
233
  });
249
- }), pageSpecificItems.length > 0 &&
250
- /*#__PURE__*/
251
- // Render the special-container only if there are bottom-aligned items
252
- React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
253
- width: "100%",
254
- display: ["none", "none", "none", "block"]
255
- }, /*#__PURE__*/React.createElement(Divider, {
256
- light: true,
257
- mt: "s",
258
- mb: "r"
259
- })), pageSpecificItems.map(function (item) {
260
- if (item.hide) {
261
- return null;
234
+ if (item.pageSpecific && !orderedItems[index - 1].pageSpecific) {
235
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
236
+ light: true,
237
+ mt: "s",
238
+ mb: "r",
239
+ display: ["none", "none", "none", "block"]
240
+ }), Item);
262
241
  }
263
- var Component = item.component;
264
- return /*#__PURE__*/React.createElement(NavItem, {
265
- key: item.index,
266
- item: item,
267
- Component: Component,
268
- activeItem: activeItem,
269
- handleItemClick: handleItemClick,
270
- navItemRefs: navItemRefs
271
- });
272
- })), bottomAlignedItems.length > 0 && (
273
- // Render the special-container only if there are bottom-aligned items
274
- isGreaterThan900 ? /*#__PURE__*/React.createElement(BottomAlignedNavItems, null, bottomAlignedItems.map(function (item) {
275
- if (item.hide) {
276
- return null;
277
- }
278
- var Component = item.component;
279
- return /*#__PURE__*/React.createElement(NavItem, {
280
- key: item.index,
281
- item: item,
282
- Component: Component,
283
- activeItem: activeItem,
284
- handleItemClick: handleItemClick,
285
- navItemRefs: navItemRefs
286
- });
287
- })) : bottomAlignedItems.map(function (item) {
288
- if (item.hide) {
289
- return null;
290
- }
291
- var Component = item.component;
292
- return /*#__PURE__*/React.createElement(NavItem, {
293
- key: item.index,
294
- item: item,
295
- Component: Component,
296
- activeItem: activeItem,
297
- handleItemClick: handleItemClick,
298
- navItemRefs: navItemRefs
299
- });
300
- }))), expandedItem !== null && allItems[expandedItem] && allItems[expandedItem].component ? /*#__PURE__*/React.createElement(SideNavExpanded, {
242
+ return Item;
243
+ };
244
+ return /*#__PURE__*/React.createElement(SideNavWrapper, {
245
+ sideNavHeight: sideNavHeight
246
+ }, /*#__PURE__*/React.createElement(SideNavItems, null, orderedItems.map(renderItem)), expandedItem !== null && allItems[expandedItem] && allItems[expandedItem].component ? /*#__PURE__*/React.createElement(SideNavExpanded, {
301
247
  ref: expandedRef,
302
248
  tabIndex: "0",
303
249
  sideNavHeight: sideNavHeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.1.36",
3
+ "version": "3.1.37",
4
4
  "engines": {
5
5
  "node": "18.17.1"
6
6
  },