orcs-design-system 3.0.1 → 3.0.3

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.
@@ -117,6 +117,7 @@ export var tooltipWithLinkExample = function tooltipWithLinkExample() {
117
117
  small: true,
118
118
  target: "_blank"
119
119
  }, "link to TeamForm")),
120
+ arialLabel: "Link to TeamForm",
120
121
  direction: "right",
121
122
  variant: "tooltip",
122
123
  enableSelectAll: false
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "direction", "width", "textAlign", "text", "inlineBlock", "theme", "variant", "enableSelectAll"];
5
- import React, { useState } from "react";
4
+ var _excluded = ["children", "direction", "width", "textAlign", "text", "inlineBlock", "theme", "variant", "enableSelectAll", "tabIndex"];
5
+ import React, { useId, useMemo, useState } from "react";
6
6
  import PropTypes from "prop-types";
7
7
  import styled, { css, ThemeProvider } from "styled-components";
8
8
  import { space, layout } from "styled-system";
@@ -10,16 +10,17 @@ import { keys } from "lodash";
10
10
  import Icon from "../Icon";
11
11
  import { themeGet } from "@styled-system/theme-get";
12
12
  import { useKeepInView, directions } from "../../hooks/keepInView";
13
+ import useIsVisible from "../../hooks/isVisible";
13
14
  var Container = styled.div.withConfig({
14
15
  displayName: "Popover__Container",
15
16
  componentId: "sc-1bwoak-0"
16
17
  })(["", " ", " display:", ";position:relative;&:hover,&:focus-within{.popoverText{opacity:1;z-index:100;visibility:visible;pointer-events:auto;}}"], space, layout, function (props) {
17
18
  return props.inlineBlock ? "inline-block !important" : "block !important";
18
19
  });
19
- var TooltipControl = styled.div.withConfig({
20
+ var TooltipControl = styled.button.withConfig({
20
21
  displayName: "Popover__TooltipControl",
21
22
  componentId: "sc-1bwoak-1"
22
- })(["cursor:help;transition:", ";&:hover,&:focus{outline:0;color:", ";}"], function (props) {
23
+ })(["border:none;background:none;padding:0;cursor:help;font-size:1em;transition:", ";&:hover,&:focus{outline:0;color:", ";}"], function (props) {
23
24
  return themeGet("transition.transitionDefault")(props);
24
25
  }, function (props) {
25
26
  return themeGet("colors.primary")(props);
@@ -79,11 +80,18 @@ export default function Popover(_ref2) {
79
80
  variant = _ref2.variant,
80
81
  _ref2$enableSelectAll = _ref2.enableSelectAll,
81
82
  enableSelectAll = _ref2$enableSelectAll === void 0 ? true : _ref2$enableSelectAll,
83
+ _ref2$tabIndex = _ref2.tabIndex,
84
+ tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex,
82
85
  props = _objectWithoutProperties(_ref2, _excluded);
83
86
  var _useState = useState(direction),
84
87
  _useState2 = _slicedToArray(_useState, 2),
85
88
  inViewDirection = _useState2[0],
86
89
  setInViewDirection = _useState2[1];
90
+ var _useIsVisible = useIsVisible(),
91
+ _useIsVisible2 = _slicedToArray(_useIsVisible, 2),
92
+ isActive = _useIsVisible2[0],
93
+ tooltip = _useIsVisible2[1];
94
+ var toolTipId = useId();
87
95
  var _useKeepInView = useKeepInView({
88
96
  direction: direction,
89
97
  callback: setInViewDirection
@@ -91,6 +99,13 @@ export default function Popover(_ref2) {
91
99
  _useKeepInView2 = _slicedToArray(_useKeepInView, 2),
92
100
  ref = _useKeepInView2[0],
93
101
  setIsShown = _useKeepInView2[1];
102
+ var ariaLabel = useMemo(function () {
103
+ if (props.ariaLabel) {
104
+ return props.ariaLabel;
105
+ } else if (typeof text === "string") {
106
+ return text;
107
+ }
108
+ }, [props.ariaLabel, text]);
94
109
  var component = /*#__PURE__*/React.createElement(Container, _extends({
95
110
  inlineBlock: inlineBlock
96
111
  }, props, {
@@ -100,19 +115,27 @@ export default function Popover(_ref2) {
100
115
  onMouseLeave: function onMouseLeave() {
101
116
  return setIsShown(false);
102
117
  }
103
- }), !!text && /*#__PURE__*/React.createElement(Text, {
118
+ }), variant === "tooltip" && /*#__PURE__*/React.createElement(TooltipControl, {
119
+ tabIndex: tabIndex,
120
+ "aria-label": ariaLabel,
121
+ "aria-expanded": "".concat(isActive),
122
+ "aria-describedby": toolTipId
123
+ }, /*#__PURE__*/React.createElement(Icon, {
124
+ transform: "grow-4",
125
+ icon: ["fas", "question-circle"]
126
+ })), !!text && /*#__PURE__*/React.createElement(Text, {
104
127
  ref: ref,
128
+ role: "list",
105
129
  className: "popoverText",
106
130
  textAlign: textAlign,
107
131
  direction: inViewDirection,
108
132
  width: width,
109
133
  enableSelectAll: enableSelectAll
110
- }, text), variant === "tooltip" && /*#__PURE__*/React.createElement(TooltipControl, {
111
- tabIndex: "0"
112
- }, /*#__PURE__*/React.createElement(Icon, {
113
- transform: "grow-4",
114
- icon: ["fas", "question-circle"]
115
- })), children);
134
+ }, /*#__PURE__*/React.createElement("span", {
135
+ id: toolTipId,
136
+ role: "listitem",
137
+ ref: tooltip
138
+ }, text)), children);
116
139
  return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
117
140
  theme: theme
118
141
  }, component) : component;
@@ -135,7 +158,11 @@ Popover.propTypes = {
135
158
  /** Specifies the system design theme. */
136
159
  theme: PropTypes.object,
137
160
  /** Specifies whether enable select all behaviour */
138
- enableSelectAll: PropTypes.bool
161
+ enableSelectAll: PropTypes.bool,
162
+ /** Provide an aria-label if text is not a string */
163
+ ariaLabel: PropTypes.string,
164
+ /** Provide a tab index for accessibilty, defaults to 0 */
165
+ tabIndex: PropTypes.number
139
166
  };
140
167
  Popover.__docgenInfo = {
141
168
  "description": "This popover component is intended to be used to supplement buttons (or other elements) that require some helper text. It supports customisation of direction and width. This is so that you can ensure that the popover doesn't run off the screen, and that the width suits the amount of text in the popover.\n\nIf you don't specify a width, 200px is the default, but as a general guide try and keep widths somewhere between 150-250 if you are modifying. Make sure if setting width you include the unit you want it to use, e.g. pixels, %.",
@@ -153,6 +180,17 @@ Popover.__docgenInfo = {
153
180
  "required": false,
154
181
  "description": "Specifies whether enable select all behaviour"
155
182
  },
183
+ "tabIndex": {
184
+ "defaultValue": {
185
+ "value": "0",
186
+ "computed": false
187
+ },
188
+ "type": {
189
+ "name": "number"
190
+ },
191
+ "required": false,
192
+ "description": "Provide a tab index for accessibilty, defaults to 0"
193
+ },
156
194
  "children": {
157
195
  "type": {
158
196
  "name": "element"
@@ -224,6 +262,13 @@ Popover.__docgenInfo = {
224
262
  },
225
263
  "required": false,
226
264
  "description": "Specifies the system design theme."
265
+ },
266
+ "ariaLabel": {
267
+ "type": {
268
+ "name": "string"
269
+ },
270
+ "required": false,
271
+ "description": "Provide an aria-label if text is not a string"
227
272
  }
228
273
  }
229
274
  };
@@ -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
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  var _excluded = ["numberProps"];
5
5
  import React, { useMemo } from "react";
6
- import NumberFormat from "react-number-format";
6
+ import { NumericFormat } from "react-number-format";
7
7
  import PropTypes from "prop-types";
8
8
  import styled, { css } from "styled-components";
9
9
  import { space, layout, compose } from "styled-system";
@@ -82,7 +82,7 @@ var Input = styled("input").attrs(function (props) {
82
82
  displayName: "TextInput__Input",
83
83
  componentId: "shde0o-1"
84
84
  })(["", ""], InputStyle);
85
- var NumberInput = styled(NumberFormat).attrs(function (props) {
85
+ var NumberInput = styled(NumericFormat).attrs(function (props) {
86
86
  return {
87
87
  "data-testid": props["data-testid"] ? props["data-testid"] : null
88
88
  };
@@ -0,0 +1,22 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect, useRef, useState } from "react";
3
+ export default function useIsVisible() {
4
+ var _useState = useState(false),
5
+ _useState2 = _slicedToArray(_useState, 2),
6
+ isVisible = _useState2[0],
7
+ setIsVisible = _useState2[1];
8
+ var ref = useRef();
9
+ useEffect(function () {
10
+ if (!ref.current) return;
11
+ var interval = window.setInterval(function () {
12
+ var currentIsVisible = window.getComputedStyle(ref.current).visibility === "visible";
13
+ if (isVisible !== currentIsVisible) {
14
+ setIsVisible(currentIsVisible);
15
+ }
16
+ }, 250);
17
+ return function () {
18
+ clearInterval(interval);
19
+ };
20
+ }, [ref, isVisible]);
21
+ return [isVisible, ref];
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
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",
@@ -54,7 +53,7 @@
54
53
  "react-docgen": "^5.3.0",
55
54
  "react-intersection-observer": "^9.4.3",
56
55
  "react-moment-proptypes": "^1.8.1",
57
- "react-number-format": "^4.4.1",
56
+ "react-number-format": "^5.3.0",
58
57
  "react-router": "^5.2.0",
59
58
  "react-router-dom": "^5.2.0",
60
59
  "react-select": "^5.7.4",
@@ -75,33 +74,33 @@
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
- "@storybook/addon-a11y": "^7.2.1",
81
- "@storybook/addon-actions": "^7.2.1",
82
- "@storybook/addon-docs": "^7.2.1",
77
+ "@storybook/addon-a11y": "^7.3.2",
78
+ "@storybook/addon-actions": "^7.3.2",
79
+ "@storybook/addon-docs": "^7.3.2",
83
80
  "@storybook/addon-knobs": "^7.0.2",
84
- "@storybook/addon-links": "^7.2.1",
85
- "@storybook/addon-mdx-gfm": "^7.2.1",
86
- "@storybook/addon-storyshots": "^7.2.1",
87
- "@storybook/addon-toolbars": "^7.2.1",
88
- "@storybook/addon-viewport": "^7.2.1",
89
- "@storybook/addons": "^7.2.1",
90
- "@storybook/api": "^7.2.1",
91
- "@storybook/blocks": "^7.2.1",
92
- "@storybook/components": "^7.2.1",
81
+ "@storybook/addon-links": "^7.3.2",
82
+ "@storybook/addon-mdx-gfm": "^7.3.2",
83
+ "@storybook/addon-storyshots": "^7.3.2",
84
+ "@storybook/addon-toolbars": "^7.3.2",
85
+ "@storybook/addon-viewport": "^7.3.2",
86
+ "@storybook/addons": "^7.3.2",
87
+ "@storybook/api": "^7.3.2",
88
+ "@storybook/blocks": "^7.3.2",
89
+ "@storybook/components": "^7.3.2",
90
+ "@storybook/core-events": "^7.3.2",
91
+ "@storybook/manager-api": "^7.3.2",
93
92
  "@storybook/mdx1-csf": "^1.0.0",
94
- "@storybook/preset-create-react-app": "^7.2.1",
95
- "@storybook/react": "^7.2.1",
96
- "@storybook/react-webpack5": "^7.2.1",
97
- "@storybook/storybook-deployer": "^2.8.16",
93
+ "@storybook/preset-create-react-app": "^7.3.2",
94
+ "@storybook/react": "^7.3.2",
95
+ "@storybook/react-webpack5": "^7.3.2",
96
+ "@storybook/storybook-deployer": "2.8.16",
98
97
  "@testing-library/jest-dom": "^5.11.6",
99
98
  "@testing-library/react": "^11.2.2",
100
99
  "@types/jest": "^26.0.19",
101
100
  "@types/styled-components": "^5.1.7",
102
101
  "audit-ci": "^6.1.2",
103
102
  "babel-core": "^7.0.0-bridge.0",
104
- "babel-eslint": "^8.2.5",
103
+ "babel-eslint": "^10.0.0",
105
104
  "babel-loader": "^8.1.0",
106
105
  "babel-plugin-react-docgen": "^4.1.0",
107
106
  "babel-plugin-styled-components": "^1.10.7",
@@ -120,11 +119,11 @@
120
119
  "identity-obj-proxy": "^3.0.0",
121
120
  "jest": "^26.6.3",
122
121
  "npm-run-all": "^4.1.5",
123
- "playroom": "^0.27.7",
122
+ "playroom": "^0.32.1",
124
123
  "prettier": "^2.2.1",
125
124
  "react": "^18.2.0",
126
125
  "react-dom": "^18.2.0",
127
- "storybook": "^7.2.1",
126
+ "storybook": "^7.3.2",
128
127
  "style-loader": "^2.0.0",
129
128
  "styled-components": "^5.2.1",
130
129
  "webpack": "^5.88.2",
@@ -135,6 +134,12 @@
135
134
  "react-dom": "^18.2.0",
136
135
  "styled-components": "^5.2.1"
137
136
  },
137
+ "overrides": {
138
+ "nth-check": "2.1.0",
139
+ "parse-url": "8.1.0",
140
+ "react-scripts": "5.0.1",
141
+ "remark-parse": "10.0.2"
142
+ },
138
143
  "browserslist": {
139
144
  "development": [
140
145
  "last 2 chrome versions",