orcs-design-system 3.2.4 → 3.2.6

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 (96) hide show
  1. package/es/GlobalStyles.js +1 -31
  2. package/es/SystemThemeProvider.js +11 -5
  3. package/es/assets/Colour/Colour.stories.js +211 -0
  4. package/es/assets/Colour/index.js +3 -3
  5. package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
  6. package/es/components/ActionsMenu/index.js +144 -229
  7. package/es/components/Avatar/Avatar.stories.js +212 -196
  8. package/es/components/Avatar/index.js +280 -307
  9. package/es/components/Badge/Badge.stories.js +71 -46
  10. package/es/components/Badge/index.js +71 -74
  11. package/es/components/Box/Box.stories.js +51 -35
  12. package/es/components/Box/index.js +33 -34
  13. package/es/components/Button/Button.stories.js +161 -145
  14. package/es/components/Button/ButtonLink.stories.js +152 -139
  15. package/es/components/Button/index.js +79 -99
  16. package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
  17. package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
  18. package/es/components/ButtonGroup/index.js +103 -99
  19. package/es/components/Card/Card.stories.js +94 -62
  20. package/es/components/Card/index.js +50 -71
  21. package/es/components/Checkbox/Checkbox.stories.js +37 -43
  22. package/es/components/Checkbox/index.js +61 -76
  23. package/es/components/DatePicker/DatePicker.stories.js +86 -118
  24. package/es/components/DatePicker/index.js +71 -187
  25. package/es/components/Divider/Divider.stories.js +39 -42
  26. package/es/components/Divider/index.js +21 -27
  27. package/es/components/Expandable/Expandable.stories.js +46 -36
  28. package/es/components/Expandable/index.js +55 -82
  29. package/es/components/Flex/Flex.stories.js +19 -5
  30. package/es/components/Flex/FlexItem.stories.js +10 -9
  31. package/es/components/Flex/index.js +34 -27
  32. package/es/components/Grid/Grid.stories.js +129 -55
  33. package/es/components/Grid/index.js +25 -24
  34. package/es/components/Header/Header.stories.js +101 -92
  35. package/es/components/Header/index.js +433 -436
  36. package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
  37. package/es/components/HeaderSimple/index.js +73 -68
  38. package/es/components/Icon/Icon.stories.js +58 -57
  39. package/es/components/Icon/index.js +48 -46
  40. package/es/components/Loading/Loading.stories.js +32 -39
  41. package/es/components/Loading/index.js +44 -51
  42. package/es/components/Modal/Modal.stories.js +172 -153
  43. package/es/components/Modal/index.js +126 -134
  44. package/es/components/Notification/Notification.stories.js +59 -58
  45. package/es/components/Notification/index.js +123 -133
  46. package/es/components/Popover/Popover.stories.js +134 -102
  47. package/es/components/Popover/index.js +65 -111
  48. package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
  49. package/es/components/ProgressBar/index.js +29 -34
  50. package/es/components/RadioButton/RadioButton.stories.js +32 -37
  51. package/es/components/RadioButton/index.js +170 -184
  52. package/es/components/Range/Range.stories.js +19 -19
  53. package/es/components/Range/index.js +35 -45
  54. package/es/components/Select/Select.stories.js +107 -128
  55. package/es/components/Select/index.js +324 -336
  56. package/es/components/SideNav/NavItem.js +112 -122
  57. package/es/components/SideNav/SideNav.stories.js +84 -57
  58. package/es/components/SideNav/index.js +161 -185
  59. package/es/components/Sidebar/Sidebar.stories.js +50 -33
  60. package/es/components/Sidebar/index.js +152 -155
  61. package/es/components/Spacer/Spacer.stories.js +35 -32
  62. package/es/components/Spacer/index.js +20 -20
  63. package/es/components/StatusDot/StatusDot.stories.js +103 -90
  64. package/es/components/StatusDot/index.js +36 -38
  65. package/es/components/StyledLink/StyledLink.stories.js +68 -69
  66. package/es/components/StyledLink/index.js +47 -48
  67. package/es/components/Table/Table.stories.js +118 -112
  68. package/es/components/Table/getExpandColumnConfig.js +67 -62
  69. package/es/components/Table/index.js +24 -27
  70. package/es/components/Table/muiStyleOverrides.js +10 -8
  71. package/es/components/Tabs/Tab.stories.js +55 -38
  72. package/es/components/Tabs/TabsContainer.stories.js +30 -22
  73. package/es/components/Tabs/index.js +95 -92
  74. package/es/components/Tag/Tag.stories.js +250 -220
  75. package/es/components/Tag/index.js +118 -190
  76. package/es/components/TextArea/TextArea.stories.js +76 -89
  77. package/es/components/TextArea/index.js +117 -115
  78. package/es/components/TextInput/TextInput.stories.js +41 -61
  79. package/es/components/TextInput/index.js +127 -171
  80. package/es/components/Toggle/Toggle.stories.js +63 -62
  81. package/es/components/Toggle/index.js +43 -77
  82. package/es/components/TreeNav/TreeNav.stories.js +7 -8
  83. package/es/components/TreeNav/index.js +72 -69
  84. package/es/components/Typography/Typography.stories.js +174 -0
  85. package/es/components/Typography/index.js +252 -308
  86. package/es/components.test.js +1 -1
  87. package/es/hooks/isVisible.js +6 -10
  88. package/es/hooks/keepInView.js +27 -32
  89. package/es/hooks/keypress.js +14 -14
  90. package/es/hooks/useInputFocus.js +5 -5
  91. package/es/hooks/usePrevious.js +3 -3
  92. package/es/systemThemeCollapsed.js +53 -53
  93. package/es/systemtheme.js +53 -53
  94. package/es/utils/selectUtil.js +1 -1
  95. package/es/utils/selectUtil.test.js +6 -6
  96. package/package.json +29 -38
@@ -1,8 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
1
  import React, { useRef, useState, useEffect } from "react";
7
2
  import styled from "styled-components";
8
3
  import { css } from "@styled-system/css";
@@ -12,25 +7,25 @@ import Icon from "../Icon";
12
7
  import Popover from "../Popover";
13
8
  import Divider from "../Divider";
14
9
  import NavItem from "./NavItem";
15
- var SMALL_SCREEN_BREAKPOINT = 900;
16
- var SideNavWrapper = styled("div").withConfig({
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const SMALL_SCREEN_BREAKPOINT = 900;
12
+ const SideNavWrapper = styled("div").withConfig({
17
13
  displayName: "SideNav__SideNavWrapper",
18
14
  componentId: "sc-1heo0i9-0"
19
- })(function (props) {
20
- return css(_defineProperty({
21
- bg: themeGet("colors.white")(props),
22
- color: themeGet("colors.greyDarkest")(props),
23
- minHeight: props.sideNavHeight,
24
- height: props.sideNavHeight,
25
- maxWidth: "max-content",
26
- fontFamily: themeGet("fonts.main")(props),
27
- borderRadius: themeGet("radii.2")(props),
28
- border: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
29
- boxShadow: themeGet("shadows.boxDefault")(props),
30
- display: "flex",
31
- alignItems: "stretch",
32
- alignContent: "stretch"
33
- }, "@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)"), {
15
+ })(props => css({
16
+ bg: themeGet("colors.white")(props),
17
+ color: themeGet("colors.greyDarkest")(props),
18
+ minHeight: props.sideNavHeight,
19
+ height: props.sideNavHeight,
20
+ maxWidth: "max-content",
21
+ fontFamily: themeGet("fonts.main")(props),
22
+ borderRadius: themeGet("radii.2")(props),
23
+ border: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
24
+ boxShadow: themeGet("shadows.boxDefault")(props),
25
+ display: "flex",
26
+ alignItems: "stretch",
27
+ alignContent: "stretch",
28
+ ["@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)")]: {
34
29
  borderRadius: "0",
35
30
  width: "100%",
36
31
  height: "auto",
@@ -43,120 +38,115 @@ var SideNavWrapper = styled("div").withConfig({
43
38
  left: "0",
44
39
  zIndex: "6",
45
40
  flexDirection: "column-reverse"
46
- }));
47
- });
48
- var SideNavItems = styled("div").withConfig({
41
+ }
42
+ }));
43
+ const SideNavItems = styled("div").withConfig({
49
44
  displayName: "SideNav__SideNavItems",
50
45
  componentId: "sc-1heo0i9-1"
51
- })(function (props) {
52
- return css(_defineProperty({
53
- minWidth: themeGet("appScale.navBarSize")(props),
54
- minHeight: "inherit",
55
- height: "100%",
56
- display: "flex",
57
- flexDirection: "column",
58
- padding: "r",
59
- alignItems: "center",
60
- justifyContent: "flex-start",
61
- textAlign: "center",
62
- position: "relative"
63
- }, "@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)"), {
46
+ })(props => css({
47
+ minWidth: themeGet("appScale.navBarSize")(props),
48
+ minHeight: "inherit",
49
+ height: "100%",
50
+ display: "flex",
51
+ flexDirection: "column",
52
+ padding: "r",
53
+ alignItems: "center",
54
+ justifyContent: "flex-start",
55
+ textAlign: "center",
56
+ position: "relative",
57
+ ["@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)")]: {
64
58
  height: "calc(".concat(themeGet("space.r")(props), " * 2 + 30px)"),
65
59
  flexDirection: "row",
66
60
  justifyContent: "space-around",
67
61
  alignItems: "center"
68
- }));
69
- });
70
- var PanelControlTooltip = styled(Popover).withConfig({
62
+ }
63
+ }));
64
+ const PanelControlTooltip = styled(Popover).withConfig({
71
65
  displayName: "SideNav__PanelControlTooltip",
72
66
  componentId: "sc-1heo0i9-2"
73
- })(function (props) {
74
- return css(_defineProperty(_defineProperty({
75
- alignSelf: "center",
76
- position: props.hideExpandedControl ? "absolute" : "relative",
77
- right: props.hideExpandedControl ? "r" : "initial",
78
- top: "r",
79
- display: props.hideExpandedControl ? "block" : "none !important",
80
- borderTop: props.hideExpandedControl ? "none" : "solid 1px",
81
- borderTopColor: themeGet("colors.greyLighter")(props),
82
- paddingTop: props.hideExpandedControl ? "0" : "r",
83
- width: props.hideExpandedControl ? "auto" : "100%",
84
- justifyContent: "center",
85
- "&:focus": {
86
- outline: "0"
87
- }
88
- }, "@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)"), {
67
+ })(props => css({
68
+ alignSelf: "center",
69
+ position: props.hideExpandedControl ? "absolute" : "relative",
70
+ right: props.hideExpandedControl ? "r" : "initial",
71
+ top: "r",
72
+ display: props.hideExpandedControl ? "block" : "none !important",
73
+ borderTop: props.hideExpandedControl ? "none" : "solid 1px",
74
+ borderTopColor: themeGet("colors.greyLighter")(props),
75
+ paddingTop: props.hideExpandedControl ? "0" : "r",
76
+ width: props.hideExpandedControl ? "auto" : "100%",
77
+ justifyContent: "center",
78
+ "&:focus": {
79
+ outline: "0"
80
+ },
81
+ ["@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)")]: {
89
82
  border: "none"
90
- }), "& .popoverText", {
83
+ },
84
+ "& .popoverText": {
91
85
  marginTop: props.hideExpandedControl ? "0" : "s"
92
- }));
93
- });
94
- var PanelControl = styled("button").withConfig({
86
+ }
87
+ }));
88
+ const PanelControl = styled("button").withConfig({
95
89
  displayName: "SideNav__PanelControl",
96
90
  componentId: "sc-1heo0i9-3"
97
- })(function (props) {
98
- return css({
99
- borderRadius: "50%",
100
- width: "20px",
101
- height: "20px",
102
- background: themeGet("colors.greyLighter")(props),
103
- color: themeGet("colors.greyDarker")(props),
104
- fontSize: "1.2rem",
105
- display: "flex",
106
- alignItems: "center",
107
- justifyContent: "center",
108
- cursor: "pointer",
109
- border: "none"
110
- });
111
- });
112
- var SideNavExpanded = styled("div").withConfig({
91
+ })(props => css({
92
+ borderRadius: "50%",
93
+ width: "20px",
94
+ height: "20px",
95
+ background: themeGet("colors.greyLighter")(props),
96
+ color: themeGet("colors.greyDarker")(props),
97
+ fontSize: "1.2rem",
98
+ display: "flex",
99
+ alignItems: "center",
100
+ justifyContent: "center",
101
+ cursor: "pointer",
102
+ border: "none"
103
+ }));
104
+ const SideNavExpanded = styled("div").withConfig({
113
105
  displayName: "SideNav__SideNavExpanded",
114
106
  componentId: "sc-1heo0i9-4"
115
- })(function (props) {
116
- return css(_defineProperty({
117
- position: "relative",
118
- display: props.active ? "block" : "none",
119
- minWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
120
- maxWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
121
- height: "inherit",
122
- overflowY: "auto",
123
- padding: "r",
124
- borderLeft: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
125
- "&:focus": {
126
- outline: "0"
127
- }
128
- }, "@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)"), {
107
+ })(props => css({
108
+ position: "relative",
109
+ display: props.active ? "block" : "none",
110
+ minWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
111
+ maxWidth: props.large ? "calc(" + themeGet("appScale.sidebarMaxWidthLarge")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")" : "calc(" + themeGet("appScale.sidebarMaxWidth")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")",
112
+ height: "inherit",
113
+ overflowY: "auto",
114
+ padding: "r",
115
+ borderLeft: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
116
+ "&:focus": {
117
+ outline: "0"
118
+ },
119
+ ["@media screen and (max-width: ".concat(SMALL_SCREEN_BREAKPOINT, "px)")]: {
129
120
  width: "100%",
130
121
  minWidth: "initial",
131
122
  maxWidth: "initial",
132
123
  borderLeft: "none",
133
124
  borderBottom: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
134
125
  height: "calc(" + themeGet("appScale.sidebarMobileHeight")(props) + " - " + themeGet("appScale.navBarSize")(props) + ")"
135
- }));
136
- });
137
- var SideNav = function SideNav(_ref) {
138
- var items = _ref.items,
139
- sideNavHeight = _ref.sideNavHeight;
140
- var _useState = useState(null),
141
- _useState2 = _slicedToArray(_useState, 2),
142
- expandedItem = _useState2[0],
143
- setExpandedItem = _useState2[1];
126
+ }
127
+ }));
128
+ const SideNav = _ref => {
129
+ let {
130
+ items,
131
+ sideNavHeight
132
+ } = _ref;
133
+ const [expandedItem, setExpandedItem] = useState(null);
144
134
 
145
135
  // Initialize a ref for SideNavExpanded
146
- var expandedRef = useRef(null);
147
- var navItemRefs = useRef({});
148
- var firstExpandedItemByDefault = items.findIndex(function (item) {
149
- return item.isExpandedByDefault && !item.hide;
150
- });
151
- useEffect(function () {
136
+ const expandedRef = useRef(null);
137
+ const navItemRefs = useRef({});
138
+ const firstExpandedItemByDefault = items.findIndex(item => item.isExpandedByDefault && !item.hide);
139
+ useEffect(() => {
152
140
  if (firstExpandedItemByDefault >= 0) {
153
141
  setExpandedItem(firstExpandedItemByDefault);
154
142
  }
155
143
  }, [firstExpandedItemByDefault]);
156
- var handleItemClick = function handleItemClick(item) {
157
- var itemIndex = item.index,
158
- actionType = item.actionType,
159
- onButtonClick = item.onClick;
144
+ const handleItemClick = item => {
145
+ const {
146
+ index: itemIndex,
147
+ actionType,
148
+ onClick: onButtonClick
149
+ } = item;
160
150
  if (actionType === "link" || actionType === "button") {
161
151
  setExpandedItem(null);
162
152
  onButtonClick && onButtonClick(item);
@@ -167,107 +157,93 @@ var SideNav = function SideNav(_ref) {
167
157
  };
168
158
 
169
159
  // Split items into two arrays based on the bottomAligned prop
170
- var allItems = items.map(function (item, index) {
171
- return _objectSpread(_objectSpread({}, item), {}, {
172
- index: index
173
- });
174
- });
175
- var topAlignedItems = allItems.filter(function (item) {
176
- return !item.bottomAligned && !item.pageSpecific;
177
- });
178
- var pageSpecificItems = allItems.filter(function (item) {
179
- return !item.bottomAligned && item.pageSpecific;
180
- });
181
- var bottomAlignedItems = allItems.filter(function (item) {
182
- return item.bottomAligned;
183
- });
184
- var _useState3 = useState(window.innerWidth),
185
- _useState4 = _slicedToArray(_useState3, 2),
186
- windowWidth = _useState4[0],
187
- setWindowWidth = _useState4[1];
188
- var isSmallScreen = windowWidth < SMALL_SCREEN_BREAKPOINT;
189
- var handleResize = function handleResize() {
160
+ const allItems = items.map((item, index) => ({
161
+ ...item,
162
+ index
163
+ }));
164
+ const topAlignedItems = allItems.filter(item => !item.bottomAligned && !item.pageSpecific);
165
+ const pageSpecificItems = allItems.filter(item => !item.bottomAligned && item.pageSpecific);
166
+ const bottomAlignedItems = allItems.filter(item => item.bottomAligned);
167
+ const [windowWidth, setWindowWidth] = useState(window.innerWidth);
168
+ const isSmallScreen = windowWidth < SMALL_SCREEN_BREAKPOINT;
169
+ const handleResize = () => {
190
170
  setWindowWidth(window.innerWidth);
191
171
  };
192
- var debounceResize = function debounceResize() {
193
- return setTimeout(handleResize, 300);
194
- }; // Wrap in a function
172
+ const debounceResize = () => setTimeout(handleResize, 300); // Wrap in a function
195
173
 
196
- useEffect(function () {
197
- return function () {
198
- return clearTimeout(handleResize);
199
- };
174
+ useEffect(() => {
175
+ return () => clearTimeout(handleResize);
200
176
  }, []);
201
- useEffect(function () {
177
+ useEffect(() => {
202
178
  window.addEventListener("resize", debounceResize);
203
- return function () {
204
- return window.removeEventListener("resize", debounceResize);
205
- };
179
+ return () => window.removeEventListener("resize", debounceResize);
206
180
  });
207
181
 
208
182
  // Use a useEffect to focus on the expanded item
209
- useEffect(function () {
183
+ useEffect(() => {
210
184
  if (expandedItem !== null && expandedRef.current) {
211
185
  expandedRef.current.focus();
212
186
  }
213
187
  }, [expandedItem]);
214
- var handleBlur = function handleBlur(item) {
188
+ const handleBlur = item => {
215
189
  handleItemClick(item);
216
190
  };
217
- var orderedItems = [].concat(_toConsumableArray(topAlignedItems), _toConsumableArray(pageSpecificItems), _toConsumableArray(bottomAlignedItems));
218
- var renderItem = function renderItem(item, index) {
191
+ const orderedItems = [...topAlignedItems, ...pageSpecificItems, ...bottomAlignedItems];
192
+ const renderItem = (item, index) => {
219
193
  if (item.hide) {
220
194
  return null;
221
195
  }
222
- var Component = item.component;
223
- var Item = /*#__PURE__*/React.createElement(NavItem, {
224
- key: item.index,
196
+ const Component = item.component;
197
+ const Item = /*#__PURE__*/_jsx(NavItem, {
225
198
  item: item,
226
199
  Component: Component,
227
200
  isActive: item.actionType === "link" ? item.isActive : expandedItem == item.index,
228
201
  handleItemClick: handleItemClick,
229
202
  navItemRefs: navItemRefs
230
- });
203
+ }, item.index);
231
204
  if (item.pageSpecific && !orderedItems[index - 1].pageSpecific) {
232
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
233
- light: true,
234
- mt: "s",
235
- mb: "r",
236
- display: ["none", "none", "none", "block"]
237
- }), Item);
205
+ return /*#__PURE__*/_jsxs(_Fragment, {
206
+ children: [/*#__PURE__*/_jsx(Divider, {
207
+ light: true,
208
+ mt: "s",
209
+ mb: "r",
210
+ display: ["none", "none", "none", "block"]
211
+ }), Item]
212
+ });
238
213
  }
239
214
  return Item;
240
215
  };
241
- return /*#__PURE__*/React.createElement(SideNavWrapper, {
242
- sideNavHeight: sideNavHeight
243
- }, /*#__PURE__*/React.createElement(SideNavItems, null, orderedItems.map(renderItem)), allItems.map(function (item, index) {
244
- if (item.actionType !== "component") return null;
245
- if (index !== expandedItem || item.hide) return null;
246
- return /*#__PURE__*/React.createElement(SideNavExpanded, {
247
- key: item.name,
248
- ref: expandedRef,
249
- tabIndex: "0",
250
- sideNavHeight: sideNavHeight,
251
- active: expandedItem,
252
- large: item.large
253
- }, item.component(), /*#__PURE__*/React.createElement(PanelControlTooltip, {
254
- width: "80px",
255
- textAlign: "center",
256
- hideExpandedControl: true,
257
- direction: "left",
258
- text: "Hide panel"
259
- }, /*#__PURE__*/React.createElement(PanelControl, {
260
- onClick: function onClick() {
261
- return handleItemClick(item);
262
- },
263
- "aria-label": "toggle panel",
264
- onBlur: function onBlur() {
265
- return handleBlur(item);
266
- }
267
- }, /*#__PURE__*/React.createElement(Icon, {
268
- icon: ["fas", isSmallScreen ? "chevron-down" : "chevron-left"]
269
- }))));
270
- }));
216
+ return /*#__PURE__*/_jsxs(SideNavWrapper, {
217
+ sideNavHeight: sideNavHeight,
218
+ children: [/*#__PURE__*/_jsx(SideNavItems, {
219
+ children: orderedItems.map(renderItem)
220
+ }), allItems.map((item, index) => {
221
+ if (item.actionType !== "component") return null;
222
+ if (index !== expandedItem || item.hide) return null;
223
+ return /*#__PURE__*/_jsxs(SideNavExpanded, {
224
+ ref: expandedRef,
225
+ tabIndex: "0",
226
+ sideNavHeight: sideNavHeight,
227
+ active: expandedItem,
228
+ large: item.large,
229
+ children: [item.component(), /*#__PURE__*/_jsx(PanelControlTooltip, {
230
+ width: "80px",
231
+ textAlign: "center",
232
+ hideExpandedControl: true,
233
+ direction: "left",
234
+ text: "Hide panel",
235
+ children: /*#__PURE__*/_jsx(PanelControl, {
236
+ onClick: () => handleItemClick(item),
237
+ "aria-label": "toggle panel",
238
+ onBlur: () => handleBlur(item),
239
+ children: /*#__PURE__*/_jsx(Icon, {
240
+ icon: ["fas", isSmallScreen ? "chevron-down" : "chevron-left"]
241
+ })
242
+ })
243
+ })]
244
+ }, item.name);
245
+ })]
246
+ });
271
247
  };
272
248
  SideNav.propTypes = {
273
249
  sideNavHeight: PropTypes.string.isRequired,
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import Sidebar, { SidebarTabs, SidebarTab, SidebarPanels, SidebarPanel, SidebarClose } from ".";
3
3
  import Icon from "../Icon";
4
4
  import Box from "../Box";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/Sidebar",
7
8
  component: Sidebar,
@@ -12,39 +13,55 @@ export default {
12
13
  SidebarPanel: SidebarPanel
13
14
  }
14
15
  };
15
- export var defaultSidebar = function defaultSidebar() {
16
- return /*#__PURE__*/React.createElement(Sidebar, null, /*#__PURE__*/React.createElement(SidebarTabs, null, /*#__PURE__*/React.createElement(SidebarTab, {
17
- active: true,
18
- badge: "3",
19
- ariaLabel: "Messages"
20
- }, /*#__PURE__*/React.createElement(Icon, {
21
- icon: ["fas", "filter"],
22
- size: "lg"
23
- })), /*#__PURE__*/React.createElement(SidebarTab, {
24
- ariaLabel: "Preferences"
25
- }, /*#__PURE__*/React.createElement(Icon, {
26
- icon: ["fas", "cog"],
27
- size: "lg"
28
- })), /*#__PURE__*/React.createElement(SidebarTab, {
29
- bottomAligned: true,
30
- ariaLabel: "Info"
31
- }, /*#__PURE__*/React.createElement(Icon, {
32
- icon: ["fas", "info-circle"],
33
- size: "lg"
34
- }))), /*#__PURE__*/React.createElement(SidebarPanels, null, /*#__PURE__*/React.createElement(SidebarClose, {
35
- title: "Close Sidebar"
36
- }, /*#__PURE__*/React.createElement(Icon, {
37
- icon: ["fas", "angle-left"]
38
- })), /*#__PURE__*/React.createElement(SidebarPanel, {
39
- active: true
40
- }, /*#__PURE__*/React.createElement(Box, {
41
- p: "r"
42
- }, "Sidebar content tab one blah blah lorem ipsum dolor sit amet.")), /*#__PURE__*/React.createElement(SidebarPanel, null, /*#__PURE__*/React.createElement(Box, {
43
- p: "r"
44
- }, "Sidebar content tab two blah blah lorem ipsum dolor sit amet.")), /*#__PURE__*/React.createElement(SidebarPanel, null, /*#__PURE__*/React.createElement(Box, {
45
- p: "r"
46
- }, "Information about company and app (app version etc.) goes here."))));
47
- };
16
+ export const defaultSidebar = () => /*#__PURE__*/_jsxs(Sidebar, {
17
+ children: [/*#__PURE__*/_jsxs(SidebarTabs, {
18
+ children: [/*#__PURE__*/_jsx(SidebarTab, {
19
+ active: true,
20
+ badge: "3",
21
+ ariaLabel: "Messages",
22
+ children: /*#__PURE__*/_jsx(Icon, {
23
+ icon: ["fas", "filter"],
24
+ size: "lg"
25
+ })
26
+ }), /*#__PURE__*/_jsx(SidebarTab, {
27
+ ariaLabel: "Preferences",
28
+ children: /*#__PURE__*/_jsx(Icon, {
29
+ icon: ["fas", "cog"],
30
+ size: "lg"
31
+ })
32
+ }), /*#__PURE__*/_jsx(SidebarTab, {
33
+ bottomAligned: true,
34
+ ariaLabel: "Info",
35
+ children: /*#__PURE__*/_jsx(Icon, {
36
+ icon: ["fas", "info-circle"],
37
+ size: "lg"
38
+ })
39
+ })]
40
+ }), /*#__PURE__*/_jsxs(SidebarPanels, {
41
+ children: [/*#__PURE__*/_jsx(SidebarClose, {
42
+ title: "Close Sidebar",
43
+ children: /*#__PURE__*/_jsx(Icon, {
44
+ icon: ["fas", "angle-left"]
45
+ })
46
+ }), /*#__PURE__*/_jsx(SidebarPanel, {
47
+ active: true,
48
+ children: /*#__PURE__*/_jsx(Box, {
49
+ p: "r",
50
+ children: "Sidebar content tab one blah blah lorem ipsum dolor sit amet."
51
+ })
52
+ }), /*#__PURE__*/_jsx(SidebarPanel, {
53
+ children: /*#__PURE__*/_jsx(Box, {
54
+ p: "r",
55
+ children: "Sidebar content tab two blah blah lorem ipsum dolor sit amet."
56
+ })
57
+ }), /*#__PURE__*/_jsx(SidebarPanel, {
58
+ children: /*#__PURE__*/_jsx(Box, {
59
+ p: "r",
60
+ children: "Information about company and app (app version etc.) goes here."
61
+ })
62
+ })]
63
+ })]
64
+ });
48
65
  defaultSidebar.storyName = "Default";
49
66
  defaultSidebar.__docgenInfo = {
50
67
  "description": "",