orcs-design-system 3.0.2 → 3.0.4

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.
@@ -3,8 +3,14 @@ import PropTypes from "prop-types";
3
3
  import SideNav from ".";
4
4
  import { BrowserRouter as Router, Route, Link } from "react-router-dom";
5
5
  import { H5, P } from "../Typography";
6
+ import Box from "../Box";
6
7
  export default {
7
8
  title: "Components/SideNav",
9
+ decorators: [function (storyFn) {
10
+ return /*#__PURE__*/React.createElement(Box, {
11
+ minHeight: "450px"
12
+ }, storyFn());
13
+ }],
8
14
  component: SideNav
9
15
  };
10
16
  var LinkComponent = function LinkComponent(_ref) {
@@ -20,7 +20,7 @@ var SideNavWrapper = styled("div").withConfig({
20
20
  bg: themeGet("colors.white")(props),
21
21
  color: themeGet("colors.greyDarkest")(props),
22
22
  minHeight: props.sideNavHeight,
23
- height: "100%",
23
+ height: props.sideNavHeight,
24
24
  maxWidth: "max-content",
25
25
  fontFamily: themeGet("fonts.main")(props),
26
26
  borderRadius: themeGet("radii.2")(props),
@@ -59,6 +59,11 @@ var SideNavItems = styled("div").withConfig({
59
59
  alignItems: "center",
60
60
  justifyContent: "flex-start",
61
61
  textAlign: "center",
62
+ // "&:hover, &:focus": {
63
+ // "& .sideNavItemName": {
64
+ // display: "block"
65
+ // }
66
+ // },
62
67
  "@media screen and (max-width: 900px)": {
63
68
  height: themeGet("appScale.navBarSize")(props),
64
69
  flexDirection: "row",
@@ -147,12 +152,19 @@ var SideNavItemPopover = styled(Popover).withConfig({
147
152
  zIndex: "-100",
148
153
  visibility: "hidden",
149
154
  pointerEvents: "none",
155
+ justifyContent: "space-around",
150
156
  display: "none"
151
157
  }
158
+ // "&:hover, &:focus": {
159
+ // "& .sideNavItemName": {
160
+ // display: "none"
161
+ // }
162
+ // }
152
163
  }
153
164
  }
154
165
  });
155
166
  });
167
+
156
168
  var SideNavItem = styled("button").attrs(function (props) {
157
169
  return {
158
170
  className: props.badge ? "Sidebar__Badge" : ""
@@ -174,6 +186,8 @@ var SideNavItem = styled("button").attrs(function (props) {
174
186
  cursor: "pointer",
175
187
  border: "none",
176
188
  padding: "s",
189
+ // marginBottom: props.bottomAligned ? "0" : "s",
190
+ // marginTop: props.bottomAligned ? "s" : "0",
177
191
  fontSize: "1.4rem",
178
192
  fontWeight: themeGet("fontWeights.1")(props),
179
193
  color: themeGet("colors.greyDarker")(props),
@@ -190,7 +204,11 @@ var SideNavItem = styled("button").attrs(function (props) {
190
204
  "& .sideNavItemName": {
191
205
  color: themeGet("colors.primary")(props)
192
206
  }
207
+ // "& .sideNavItemName": {
208
+ // color: themeGet("colors.primary")(props)
209
+ // }
193
210
  },
211
+
194
212
  "@media screen and (max-width: 900px)": {
195
213
  width: "auto"
196
214
  }
@@ -201,9 +219,9 @@ var SideNavItem = styled("button").attrs(function (props) {
201
219
  path: {
202
220
  fill: themeGet("colors.white")(props)
203
221
  },
204
- "& .sideNavItemName": {
205
- color: themeGet("colors.white")(props)
206
- },
222
+ // "& .sideNavItemName": {
223
+ // color: themeGet("colors.white")(props)
224
+ // },
207
225
  "&:hover, &:focus": {
208
226
  path: {
209
227
  fill: themeGet("colors.white")(props)
@@ -211,9 +229,13 @@ var SideNavItem = styled("button").attrs(function (props) {
211
229
  "& .sideNavItemName": {
212
230
  color: themeGet("colors.white")(props)
213
231
  }
232
+ // "& .sideNavItemName": {
233
+ // color: themeGet("colors.white")(props)
234
+ // }
214
235
  }
215
236
  });
216
237
  });
238
+
217
239
  var SideNavItemLink = styled("div").attrs(function (props) {
218
240
  return {
219
241
  className: props.badge ? "Sidebar__Badge" : ""
@@ -223,38 +245,34 @@ var SideNavItemLink = styled("div").attrs(function (props) {
223
245
  componentId: "sc-1heo0i9-6"
224
246
  })(function (props) {
225
247
  return css({
226
- cursor: "pointer",
227
- padding: "s",
228
- textDecoration: "none",
229
- borderRadius: themeGet("radii.2")(props),
230
- width: "100%",
231
- path: {
232
- transition: themeGet("transition.transitionDefault")(props),
233
- fill: themeGet("colors.greyDarker")(props)
234
- },
235
- "&:hover, &:focus": {
236
- "& .sideNavItemName": {
237
- color: themeGet("colors.primary")(props)
238
- },
239
- path: {
240
- fill: themeGet("colors.primary")(props)
241
- }
242
- },
243
- "@media screen and (max-width: 900px)": {
244
- width: "auto"
245
- },
246
248
  "& > a": {
247
- fontFamily: themeGet("fonts.main")(props),
249
+ cursor: "pointer",
250
+ padding: "s",
248
251
  textDecoration: "none",
252
+ borderRadius: themeGet("radii.2")(props),
253
+ width: "100%",
254
+ path: {
255
+ transition: themeGet("transition.transitionDefault")(props),
256
+ fill: themeGet("colors.greyDarker")(props)
257
+ },
258
+ fontFamily: themeGet("fonts.main")(props),
249
259
  position: "relative",
250
260
  display: "flex",
251
261
  alignItems: "center",
252
262
  justifyContent: "center",
253
- width: "100%",
263
+ // width: "100%",
254
264
  transition: themeGet("transition.transitionDefault")(props),
255
265
  bg: "transparent",
256
266
  fontSize: "1.4rem",
257
267
  fontWeight: themeGet("fontWeights.1")(props),
268
+ "&:hover, &:focus": {
269
+ "& .sideNavItemName": {
270
+ color: themeGet("colors.primary")(props)
271
+ },
272
+ path: {
273
+ fill: themeGet("colors.primary")(props)
274
+ }
275
+ },
258
276
  "@media screen and (max-width: 900px)": {
259
277
  width: "auto"
260
278
  },
@@ -269,19 +287,24 @@ var SideNavItemLink = styled("div").attrs(function (props) {
269
287
  });
270
288
  }, function (props) {
271
289
  return props.active && css({
272
- bg: themeGet("colors.primary")(props),
273
- path: {
274
- fill: themeGet("colors.white")(props)
275
- },
276
- "& .sideNavItemName": {
277
- color: themeGet("colors.white")(props)
278
- },
279
- "&:hover, &:focus": {
290
+ "& > a": {
291
+ bg: themeGet("colors.primary")(props),
280
292
  path: {
281
293
  fill: themeGet("colors.white")(props)
282
294
  },
283
- "& .sideNavItemName": {
284
- color: themeGet("colors.white")(props)
295
+ "&:hover, &:focus": {
296
+ path: {
297
+ fill: themeGet("colors.white")(props)
298
+ }
299
+ // "& .sideNavItemName": {
300
+ // color: themeGet("colors.white")(props)
301
+ // }
302
+ },
303
+
304
+ "&:focus": {
305
+ path: {
306
+ fill: themeGet("colors.white")(props)
307
+ }
285
308
  }
286
309
  }
287
310
  });
@@ -322,32 +345,31 @@ var BadgeNumber = styled("div").withConfig({
322
345
  justifyContent: "center"
323
346
  });
324
347
  });
325
- var SideNavItemName = styled("div").withConfig({
326
- displayName: "SideNav__SideNavItemName",
327
- componentId: "sc-1heo0i9-9"
328
- })(function (props) {
329
- return css({
330
- lineHeight: "0",
331
- marginLeft: themeGet("space.r")(props),
332
- fontSize: themeGet("fontSizes.1")(props),
333
- whiteSpace: "nowrap",
334
- textDecoration: "none",
335
- color: themeGet("colors.greyDarker")(props),
336
- "&:hover, &:focus": {
337
- color: themeGet("colors.primary")(props)
338
- }
339
- });
340
- });
348
+
349
+ // const SideNavItemName = styled("div")((props) =>
350
+ // css({
351
+ // lineHeight: "0",
352
+ // marginLeft: themeGet("space.r")(props),
353
+ // fontSize: themeGet("fontSizes.1")(props),
354
+ // whiteSpace: "nowrap",
355
+ // textDecoration: "none",
356
+ // color: themeGet("colors.greyDarker")(props),
357
+ // "&:hover, &:focus": {
358
+ // color: themeGet("colors.primary")(props)
359
+ // }
360
+ // })
361
+ // );
362
+
341
363
  var SideNavExpanded = styled("div").withConfig({
342
364
  displayName: "SideNav__SideNavExpanded",
343
- componentId: "sc-1heo0i9-10"
365
+ componentId: "sc-1heo0i9-9"
344
366
  })(function (props) {
345
367
  return css({
346
368
  position: "relative",
347
369
  display: props.active ? "block" : "none",
348
370
  minWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
349
371
  maxWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
350
- height: props.sideNavHeight,
372
+ height: "inherit",
351
373
  overflowY: "auto",
352
374
  padding: "r",
353
375
  borderLeft: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
@@ -365,8 +387,7 @@ var NavItem = function NavItem(_ref) {
365
387
  var item = _ref.item,
366
388
  Component = _ref.Component,
367
389
  activeItem = _ref.activeItem,
368
- handleItemClick = _ref.handleItemClick,
369
- showItemNames = _ref.showItemNames;
390
+ handleItemClick = _ref.handleItemClick;
370
391
  // Use the ternary operator to render the appropriate component based on actionType
371
392
  var accessibilityProps = _objectSpread(_objectSpread({}, item.actionType === "component" && {
372
393
  "aria-expanded": item.index === activeItem ? "true" : "false"
@@ -378,37 +399,36 @@ var NavItem = function NavItem(_ref) {
378
399
  textAlign: "center",
379
400
  width: "100px",
380
401
  active: item.index === activeItem,
381
- bottomAligned: item.bottomAligned,
382
- showItemNames: showItemNames
402
+ bottomAligned: item.bottomAligned
403
+ // showItemNames={showItemNames}
383
404
  }, /*#__PURE__*/React.createElement(SideNavItemLink, {
384
405
  key: item.index,
385
406
  active: item.index === activeItem,
386
- bottomAligned: item.bottomAligned
407
+ bottomAligned: item.bottomAligned,
408
+ onClick: function onClick() {
409
+ return handleItemClick(item);
410
+ }
387
411
  }, /*#__PURE__*/React.createElement(Component, {
388
412
  item: item
389
413
  }, /*#__PURE__*/React.createElement(Icon, {
390
414
  icon: ["far", item.iconName]
391
- }), showItemNames && /*#__PURE__*/React.createElement(SideNavItemName, {
392
- className: "sideNavItemName"
393
- }, item.name)))) : /*#__PURE__*/React.createElement(SideNavItemPopover, {
415
+ })))) : /*#__PURE__*/React.createElement(SideNavItemPopover, {
394
416
  text: item.name,
395
417
  textAlign: "center",
396
418
  width: "100px",
397
419
  active: item.index === activeItem,
398
- bottomAligned: item.bottomAligned,
399
- showItemNames: showItemNames
420
+ bottomAligned: item.bottomAligned
421
+ // showItemNames={showItemNames}
400
422
  }, /*#__PURE__*/React.createElement(SideNavItem, _extends({
401
423
  key: item.index,
402
424
  active: item.index === activeItem,
403
425
  onClick: function onClick() {
404
- return handleItemClick(item.index, item.actionType, item.onClick);
426
+ return handleItemClick(item);
405
427
  },
406
428
  bottomAligned: item.bottomAligned
407
429
  }, accessibilityProps), item.badgeNumber && /*#__PURE__*/React.createElement(BadgeNumber, null, item.badgeNumber), /*#__PURE__*/React.createElement(Icon, {
408
430
  icon: ["far", item.iconName]
409
- }), showItemNames && /*#__PURE__*/React.createElement(SideNavItemName, {
410
- className: "sideNavItemName"
411
- }, item.name)));
431
+ })));
412
432
  };
413
433
  var SideNav = function SideNav(_ref2) {
414
434
  var items = _ref2.items,
@@ -421,12 +441,16 @@ var SideNav = function SideNav(_ref2) {
421
441
  _useState4 = _slicedToArray(_useState3, 2),
422
442
  activeItem = _useState4[0],
423
443
  setActiveItem = _useState4[1];
424
- var handleItemClick = function handleItemClick(itemIndex, actionType, onButtonClick) {
444
+ var handleItemClick = function handleItemClick(item) {
445
+ var itemIndex = item.index,
446
+ actionType = item.actionType,
447
+ onButtonClick = item.onClick;
425
448
  if (actionType === "link" || actionType === "button") {
426
449
  setExpandedItem(null);
427
- onButtonClick && onButtonClick();
450
+ onButtonClick && onButtonClick(item);
428
451
  } else {
429
452
  setExpandedItem(itemIndex === expandedItem ? null : itemIndex);
453
+ onButtonClick && onButtonClick(item);
430
454
  }
431
455
  setActiveItem(itemIndex === activeItem ? null : itemIndex);
432
456
  };
@@ -470,15 +494,11 @@ var SideNav = function SideNav(_ref2) {
470
494
  });
471
495
 
472
496
  // Toggle nav item names on click of panel control button
473
- var _useState7 = useState(false),
474
- _useState8 = _slicedToArray(_useState7, 2),
475
- showItemNames = _useState8[0],
476
- setShowItemNames = _useState8[1];
477
- var toggleItemNames = function toggleItemNames() {
478
- setShowItemNames(function (prevState) {
479
- return !prevState;
480
- });
481
- };
497
+ // const [showItemNames, setShowItemNames] = useState(false);
498
+ // const toggleItemNames = () => {
499
+ // setShowItemNames((prevState) => !prevState);
500
+ // };
501
+
482
502
  return /*#__PURE__*/React.createElement(SideNavWrapper, {
483
503
  sideNavHeight: sideNavHeight
484
504
  }, /*#__PURE__*/React.createElement(SideNavItems, null, topAlignedItems.map(function (item) {
@@ -486,8 +506,9 @@ var SideNav = function SideNav(_ref2) {
486
506
  return /*#__PURE__*/React.createElement(NavItem, {
487
507
  key: item.index,
488
508
  item: item,
489
- Component: Component,
490
- showItemNames: showItemNames,
509
+ Component: Component
510
+ // showItemNames={showItemNames}
511
+ ,
491
512
  activeItem: activeItem,
492
513
  handleItemClick: handleItemClick
493
514
  });
@@ -506,43 +527,33 @@ var SideNav = function SideNav(_ref2) {
506
527
  return /*#__PURE__*/React.createElement(NavItem, {
507
528
  key: item.index,
508
529
  item: item,
509
- Component: Component,
510
- showItemNames: showItemNames,
530
+ Component: Component
531
+ // showItemNames={showItemNames}
532
+ ,
511
533
  activeItem: activeItem,
512
534
  handleItemClick: handleItemClick
513
535
  });
514
536
  })), bottomAlignedItems.length > 0 && (
515
537
  // Render the special-container only if there are bottom-aligned items
516
- isGreaterThan900 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BottomAlignedNavItems, null, bottomAlignedItems.map(function (item) {
538
+ isGreaterThan900 ? /*#__PURE__*/React.createElement(BottomAlignedNavItems, null, bottomAlignedItems.map(function (item) {
517
539
  var Component = item.component;
518
540
  return /*#__PURE__*/React.createElement(NavItem, {
519
541
  key: item.index,
520
542
  item: item,
521
- Component: Component,
522
- showItemNames: showItemNames,
543
+ Component: Component
544
+ // showItemNames={showItemNames}
545
+ ,
523
546
  activeItem: activeItem,
524
547
  handleItemClick: handleItemClick
525
548
  });
526
- })), /*#__PURE__*/React.createElement(PanelControlTooltip, {
527
- width: "180px",
528
- textAlign: "center",
529
- mt: "r",
530
- showItemNames: showItemNames,
531
- text: showItemNames === true ? "Hide navigation item names" : "Show navigation item names"
532
- }, /*#__PURE__*/React.createElement(PanelControl, {
533
- onClick: toggleItemNames,
534
- "aria-label": "toggle navigation item names"
535
- }, showItemNames === true ? /*#__PURE__*/React.createElement(Icon, {
536
- icon: ["fas", "chevron-left"]
537
- }) : /*#__PURE__*/React.createElement(Icon, {
538
- icon: ["fas", "chevron-right"]
539
- })))) : bottomAlignedItems.map(function (item) {
549
+ })) : bottomAlignedItems.map(function (item) {
540
550
  var Component = item.component;
541
551
  return /*#__PURE__*/React.createElement(NavItem, {
542
552
  key: item.index,
543
553
  item: item,
544
- Component: Component,
545
- showItemNames: showItemNames,
554
+ Component: Component
555
+ // showItemNames={showItemNames}
556
+ ,
546
557
  activeItem: activeItem,
547
558
  handleItemClick: handleItemClick
548
559
  });
@@ -558,7 +569,7 @@ var SideNav = function SideNav(_ref2) {
558
569
  text: "Hide panel"
559
570
  }, /*#__PURE__*/React.createElement(PanelControl, {
560
571
  onClick: function onClick() {
561
- return handleItemClick(allItems[expandedItem].index, allItems[expandedItem].actionType, allItems[expandedItem].onClick);
572
+ return handleItemClick(allItems[expandedItem]);
562
573
  },
563
574
  "aria-label": "toggle panel"
564
575
  }, isGreaterThan900 === true ? /*#__PURE__*/React.createElement(Icon, {
@@ -571,9 +582,10 @@ NavItem.propTypes = {
571
582
  item: PropTypes.object,
572
583
  Component: PropTypes.elementType,
573
584
  activeItem: PropTypes.string,
574
- handleItemClick: PropTypes.func,
575
- showItemNames: PropTypes.bool
585
+ handleItemClick: PropTypes.func
586
+ // showItemNames: PropTypes.bool
576
587
  };
588
+
577
589
  SideNav.propTypes = {
578
590
  sideNavHeight: PropTypes.string.isRequired,
579
591
  // Used to specify the height of the sideNav
@@ -9,9 +9,11 @@ export default function useIsVisible() {
9
9
  useEffect(function () {
10
10
  if (!ref.current) return;
11
11
  var interval = window.setInterval(function () {
12
- var currentIsVisible = window.getComputedStyle(ref.current).visibility === "visible";
13
- if (isVisible !== currentIsVisible) {
14
- setIsVisible(currentIsVisible);
12
+ if (ref.current) {
13
+ var currentIsVisible = window.getComputedStyle(ref.current).visibility === "visible";
14
+ if (isVisible !== currentIsVisible) {
15
+ setIsVisible(currentIsVisible);
16
+ }
15
17
  }
16
18
  }, 250);
17
19
  return function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Orchestrated's Design System, aka: ORCS",
5
5
  "keywords": [
6
6
  "design",
@@ -34,11 +34,10 @@
34
34
  "deploy-stack": "serverless deploy",
35
35
  "deploy-client": "serverless client deploy --no-confirm",
36
36
  "storybook": "storybook dev -s ./lib/assets",
37
- "build-storybook": "storybook build -s .storybook/static",
37
+ "build-storybook": "storybook build -s .storybook/static -o .build_storybook",
38
38
  "deploy-storybook": "storybook-to-ghpages",
39
39
  "playroom": "playroom start",
40
- "build-playroom": "playroom build",
41
- "percy:storybook": "storybook build -o .build_storybook && percy storybook .build_storybook --config .percy.yaml"
40
+ "build-playroom": "playroom build"
42
41
  },
43
42
  "dependencies": {
44
43
  "@styled-system/css": "^5.1.5",
@@ -50,6 +49,7 @@
50
49
  "prop-types": "^15.6.2",
51
50
  "react-app-polyfill": "^2.0.0",
52
51
  "react-cool-onclickoutside": "^1.5.9",
52
+ "react-dates": "^21.8.0",
53
53
  "react-docgen": "^5.3.0",
54
54
  "react-intersection-observer": "^9.4.3",
55
55
  "react-moment-proptypes": "^1.8.1",
@@ -58,8 +58,7 @@
58
58
  "react-router-dom": "^5.2.0",
59
59
  "react-select": "^5.7.4",
60
60
  "react-test-renderer": "^18.2.0",
61
- "styled-system": "^5.1.5",
62
- "react-dates": "^21.8.0"
61
+ "styled-system": "^5.1.5"
63
62
  },
64
63
  "devDependencies": {
65
64
  "@babel/cli": "^7.12.10",
@@ -75,8 +74,6 @@
75
74
  "@fortawesome/react-fontawesome": "^0.1.14",
76
75
  "@mdx-js/loader": "^2.3.0",
77
76
  "@mdx-js/react": "^2.3.0",
78
- "@percy/cli": "^1.26.3",
79
- "@percy/storybook": "^4.3.6",
80
77
  "@storybook/addon-a11y": "^7.3.2",
81
78
  "@storybook/addon-actions": "^7.3.2",
82
79
  "@storybook/addon-docs": "^7.3.2",