orcs-design-system 3.1.15 → 3.1.17

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.
@@ -66,11 +66,7 @@ var Item = styled("span").withConfig({
66
66
  bg: themeGet("colors.primaryLight")(props)
67
67
  },
68
68
  secondary: {
69
- color: themeGet("colors.secondaryDarker")(props),
70
- bg: themeGet("colors.secondaryLightest")(props)
71
- },
72
- secondaryPending: {
73
- color: themeGet("colors.secondary")(props),
69
+ color: themeGet("colors.secondaryDarkest")(props),
74
70
  bg: themeGet("colors.secondaryEvenLighter")(props)
75
71
  }
76
72
  }
@@ -56,7 +56,7 @@ var NotificationWrapper = styled("div").withConfig({
56
56
  },
57
57
  warning: {
58
58
  bg: themeGet("colors.warningLight")(props),
59
- color: themeGet("colors.black70")(props)
59
+ color: themeGet("colors.black80")(props)
60
60
  },
61
61
  "default": {}
62
62
  }
@@ -71,7 +71,7 @@ var NotificationWrapper = styled("div").withConfig({
71
71
  },
72
72
  warning: {
73
73
  bg: themeGet("colors.warningLight"),
74
- color: themeGet("colors.black70")
74
+ color: themeGet("colors.black80")
75
75
  },
76
76
  "default": {
77
77
  bg: themeGet("colors.primaryDark")
@@ -114,7 +114,7 @@ var NotificationIcon = styled(Icon).withConfig({
114
114
  componentId: "sc-1p26rkq-3"
115
115
  })(function (props) {
116
116
  return css({
117
- color: props.colour === "warning" ? themeGet("colors.black70")(props) : themeGet("colors.white")(props),
117
+ color: props.colour === "warning" ? themeGet("colors.black80")(props) : themeGet("colors.white")(props),
118
118
  fontSize: themeGet("fontSizes.2")(props),
119
119
  mr: "s"
120
120
  });
@@ -190,7 +190,7 @@ export default function Notification(_ref) {
190
190
  }, /*#__PURE__*/React.createElement(Icon, {
191
191
  icon: ["fas", "times"],
192
192
  size: "lg",
193
- color: colour === "warning" ? "black70" : "white"
193
+ color: colour === "warning" ? "black80" : "white"
194
194
  })));
195
195
  return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
196
196
  theme: theme
@@ -0,0 +1,301 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ 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; }
4
+ 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; }
5
+ import React from "react";
6
+ import styled from "styled-components";
7
+ import { css } from "@styled-system/css";
8
+ import { themeGet } from "@styled-system/theme-get";
9
+ import PropTypes from "prop-types";
10
+ import Icon from "../Icon";
11
+ import Popover from "../Popover";
12
+ var SideNavItemLink = styled("div").withConfig({
13
+ displayName: "NavItem__SideNavItemLink",
14
+ componentId: "sc-hkm2u8-0"
15
+ })(function (props) {
16
+ return css({
17
+ "& > a": {
18
+ cursor: "pointer",
19
+ padding: "s",
20
+ textDecoration: "none",
21
+ borderRadius: themeGet("radii.2")(props),
22
+ width: "100%",
23
+ path: {
24
+ transition: themeGet("transition.transitionDefault")(props),
25
+ fill: themeGet("colors.greyDarker")(props)
26
+ },
27
+ fontFamily: themeGet("fonts.main")(props),
28
+ position: "relative",
29
+ display: "flex",
30
+ alignItems: "center",
31
+ justifyContent: "center",
32
+ // width: "100%",
33
+ transition: themeGet("transition.transitionDefault")(props),
34
+ bg: "transparent",
35
+ fontSize: "1.4rem",
36
+ fontWeight: themeGet("fontWeights.1")(props),
37
+ "&:hover, &:focus": {
38
+ path: {
39
+ fill: themeGet("colors.primary")(props)
40
+ }
41
+ },
42
+ "@media screen and (max-width: 900px)": {
43
+ width: "auto"
44
+ },
45
+ "&:focus": {
46
+ outline: "0",
47
+ color: themeGet("colors.primary")(props),
48
+ path: {
49
+ fill: themeGet("colors.primary")(props)
50
+ }
51
+ }
52
+ }
53
+ });
54
+ }, function (props) {
55
+ return props.active && css({
56
+ "& > a": {
57
+ bg: themeGet("colors.primary")(props),
58
+ path: {
59
+ fill: themeGet("colors.white")(props)
60
+ },
61
+ "&:hover, &:focus": {
62
+ path: {
63
+ fill: themeGet("colors.white")(props)
64
+ }
65
+ },
66
+ "&:focus": {
67
+ path: {
68
+ fill: themeGet("colors.white")(props)
69
+ }
70
+ }
71
+ }
72
+ });
73
+ });
74
+ var BadgeNumber = styled("div").withConfig({
75
+ displayName: "NavItem__BadgeNumber",
76
+ componentId: "sc-hkm2u8-1"
77
+ })(function (props) {
78
+ return css({
79
+ position: "absolute",
80
+ height: "16px",
81
+ width: "16px",
82
+ bg: themeGet("colors.danger")(props),
83
+ fontSize: "1rem",
84
+ fontWeight: themeGet("fontWeights.2")(props),
85
+ color: themeGet("colors.white")(props),
86
+ borderRadius: "50%",
87
+ top: "0",
88
+ right: "0",
89
+ display: "flex",
90
+ alignItems: "center",
91
+ justifyContent: "center"
92
+ });
93
+ });
94
+ var BadgeDot = styled("div").withConfig({
95
+ displayName: "NavItem__BadgeDot",
96
+ componentId: "sc-hkm2u8-2"
97
+ })(function (props) {
98
+ return css({
99
+ position: "absolute",
100
+ height: "8px",
101
+ width: "8px",
102
+ bg: themeGet("colors.primary")(props),
103
+ borderRadius: "50%",
104
+ top: "2px",
105
+ right: "0"
106
+ });
107
+ });
108
+ var SideNavItemPopover = styled(Popover).withConfig({
109
+ displayName: "NavItem__SideNavItemPopover",
110
+ componentId: "sc-hkm2u8-3"
111
+ })(function (props) {
112
+ return css({
113
+ width: "100%",
114
+ marginBottom: props.bottomAligned ? "0" : "s",
115
+ marginTop: props.bottomAligned ? "s" : "0",
116
+ "&:hover,&:focus-within": {
117
+ "& .popoverText": {
118
+ opacity: "1",
119
+ zIndex: "100",
120
+ visibility: "visible",
121
+ pointerEvents: "auto",
122
+ display: "initial"
123
+ }
124
+ },
125
+ "&:focus-within": {
126
+ "& .popoverText": {
127
+ opacity: props.active ? "0" : "1",
128
+ zIndex: props.active ? "-100" : "100",
129
+ visibility: props.active ? "hidden" : "visible",
130
+ pointerEvents: props.active ? "none" : "auto",
131
+ display: props.active ? "none" : "initial"
132
+ }
133
+ },
134
+ "@media screen and (max-width: 900px)": {
135
+ width: "auto",
136
+ marginBottom: "0",
137
+ marginTop: "0",
138
+ "&:hover,&:focus-within": {
139
+ "& .popoverText": {
140
+ opacity: "0",
141
+ zIndex: "-100",
142
+ visibility: "hidden",
143
+ pointerEvents: "none",
144
+ justifyContent: "space-around",
145
+ display: "none"
146
+ }
147
+ }
148
+ }
149
+ });
150
+ });
151
+ var SideNavItem = styled("button").withConfig({
152
+ displayName: "NavItem__SideNavItem",
153
+ componentId: "sc-hkm2u8-4"
154
+ })(function (props) {
155
+ return css({
156
+ fontFamily: themeGet("fonts.main")(props),
157
+ position: "relative",
158
+ display: "flex",
159
+ alignItems: "center",
160
+ justifyContent: "center",
161
+ width: "100%",
162
+ borderRadius: themeGet("radii.2")(props),
163
+ transition: themeGet("transition.transitionDefault")(props),
164
+ bg: "transparent",
165
+ cursor: "pointer",
166
+ border: "none",
167
+ padding: "s",
168
+ fontSize: "1.4rem",
169
+ fontWeight: themeGet("fontWeights.1")(props),
170
+ color: themeGet("colors.greyDarker")(props),
171
+ path: {
172
+ transition: themeGet("transition.transitionDefault")(props),
173
+ fill: themeGet("colors.greyDarker")(props)
174
+ },
175
+ "&:hover, &:focus": {
176
+ outline: "0",
177
+ color: themeGet("colors.primary")(props),
178
+ path: {
179
+ fill: themeGet("colors.primary")(props)
180
+ }
181
+ },
182
+ "@media screen and (max-width: 900px)": {
183
+ width: "auto"
184
+ }
185
+ });
186
+ }, function (props) {
187
+ return props.active && css({
188
+ bg: themeGet("colors.primary")(props),
189
+ path: {
190
+ fill: themeGet("colors.white")(props)
191
+ },
192
+ "&:hover, &:focus": {
193
+ path: {
194
+ fill: themeGet("colors.white")(props)
195
+ }
196
+ }
197
+ });
198
+ });
199
+ var NavItem = function NavItem(_ref) {
200
+ var item = _ref.item,
201
+ Component = _ref.Component,
202
+ activeItem = _ref.activeItem,
203
+ handleItemClick = _ref.handleItemClick,
204
+ navItemRefs = _ref.navItemRefs;
205
+ // Use the ternary operator to render the appropriate component based on actionType
206
+ var accessibilityProps = _objectSpread(_objectSpread({}, item.actionType === "component" && {
207
+ "aria-expanded": item.index === activeItem ? "true" : "false"
208
+ }), {}, {
209
+ "aria-label": item.name
210
+ });
211
+ return item.actionType === "link" ? /*#__PURE__*/React.createElement(SideNavItemPopover, {
212
+ text: item.name,
213
+ textAlign: "center",
214
+ width: "124px",
215
+ active: item.index === activeItem,
216
+ bottomAligned: item.bottomAligned
217
+ }, /*#__PURE__*/React.createElement(SideNavItemLink, {
218
+ key: item.index,
219
+ active: item.index === activeItem,
220
+ bottomAligned: item.bottomAligned,
221
+ onClick: function onClick() {
222
+ return handleItemClick(item);
223
+ },
224
+ ref: function ref(el) {
225
+ return navItemRefs.current[item.index] = el;
226
+ }
227
+ }, /*#__PURE__*/React.createElement(Component, {
228
+ item: item
229
+ }, /*#__PURE__*/React.createElement(Icon, {
230
+ 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({
238
+ key: item.index,
239
+ active: item.index === activeItem,
240
+ onClick: function onClick() {
241
+ return handleItemClick(item);
242
+ },
243
+ bottomAligned: item.bottomAligned
244
+ }, accessibilityProps, {
245
+ ref: function ref(el) {
246
+ return navItemRefs.current[item.index] = el;
247
+ }
248
+ }), item.badgeNumber && /*#__PURE__*/React.createElement(BadgeNumber, null, item.badgeNumber), item.badgeDot && /*#__PURE__*/React.createElement(BadgeDot, null), /*#__PURE__*/React.createElement(Icon, {
249
+ icon: ["far", item.iconName]
250
+ })));
251
+ };
252
+ NavItem.propTypes = {
253
+ item: PropTypes.object,
254
+ Component: PropTypes.elementType,
255
+ activeItem: PropTypes.string,
256
+ handleItemClick: PropTypes.func,
257
+ navItemRefs: PropTypes.object
258
+ };
259
+ NavItem.__docgenInfo = {
260
+ "description": "",
261
+ "methods": [],
262
+ "displayName": "NavItem",
263
+ "props": {
264
+ "item": {
265
+ "description": "",
266
+ "type": {
267
+ "name": "object"
268
+ },
269
+ "required": false
270
+ },
271
+ "Component": {
272
+ "description": "",
273
+ "type": {
274
+ "name": "elementType"
275
+ },
276
+ "required": false
277
+ },
278
+ "activeItem": {
279
+ "description": "",
280
+ "type": {
281
+ "name": "string"
282
+ },
283
+ "required": false
284
+ },
285
+ "handleItemClick": {
286
+ "description": "",
287
+ "type": {
288
+ "name": "func"
289
+ },
290
+ "required": false
291
+ },
292
+ "navItemRefs": {
293
+ "description": "",
294
+ "type": {
295
+ "name": "object"
296
+ },
297
+ "required": false
298
+ }
299
+ }
300
+ };
301
+ export default NavItem;
@@ -4,6 +4,7 @@ import SideNav from ".";
4
4
  import { BrowserRouter as Router, Route, Link } from "react-router-dom";
5
5
  import { H5, P } from "../Typography";
6
6
  import Box from "../Box";
7
+ import Button from "../Button";
7
8
  export default {
8
9
  title: "Components/SideNav",
9
10
  decorators: [function (storyFn) {
@@ -53,7 +54,12 @@ var Announcements = function Announcements() {
53
54
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(H5, {
54
55
  fontWeight: "bold",
55
56
  mb: "r"
56
- }, "Announcements"), /*#__PURE__*/React.createElement(P, null, "Announcements content"));
57
+ }, "Announcements"), /*#__PURE__*/React.createElement(P, {
58
+ mb: "r"
59
+ }, "Announcements content"), /*#__PURE__*/React.createElement(Button, {
60
+ small: true,
61
+ variant: "ghost"
62
+ }, "Read more"));
57
63
  };
58
64
  var items = [{
59
65
  iconName: "user",
@@ -111,7 +117,6 @@ var items = [{
111
117
  }
112
118
  // Add more items as needed...
113
119
  ];
114
-
115
120
  export var sidebarNavigation = function sidebarNavigation() {
116
121
  return /*#__PURE__*/React.createElement(Router, null, /*#__PURE__*/React.createElement(Route, {
117
122
  exact: true,
@@ -1,9 +1,8 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _extends from "@babel/runtime/helpers/extends";
3
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
3
  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
4
  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
- import React, { useState, useEffect } from "react";
5
+ import React, { useRef, useState, useEffect } from "react";
7
6
  import styled from "styled-components";
8
7
  import { css } from "@styled-system/css";
9
8
  import { themeGet } from "@styled-system/theme-get";
@@ -12,6 +11,7 @@ import Icon from "../Icon";
12
11
  import Popover from "../Popover";
13
12
  import Divider from "../Divider";
14
13
  import Box from "../Box";
14
+ import NavItem from "./NavItem";
15
15
  var SideNavWrapper = styled("div").withConfig({
16
16
  displayName: "SideNav__SideNavWrapper",
17
17
  componentId: "sc-1heo0i9-0"
@@ -59,11 +59,6 @@ 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
- // },
67
62
  "@media screen and (max-width: 900px)": {
68
63
  height: themeGet("appScale.navBarSize")(props),
69
64
  flexDirection: "row",
@@ -78,15 +73,16 @@ var PanelControlTooltip = styled(Popover).withConfig({
78
73
  componentId: "sc-1heo0i9-2"
79
74
  })(function (props) {
80
75
  return css({
81
- alignSelf: props.showItemNames ? "flex-end" : "center",
76
+ alignSelf: "center",
82
77
  position: props.hideExpandedControl ? "absolute" : "relative",
83
78
  right: props.hideExpandedControl ? "r" : "initial",
79
+ top: "r",
84
80
  display: props.hideExpandedControl ? "block" : "none !important",
85
81
  borderTop: props.hideExpandedControl ? "none" : "solid 1px",
86
82
  borderTopColor: themeGet("colors.greyLighter")(props),
87
83
  paddingTop: props.hideExpandedControl ? "0" : "r",
88
84
  width: props.hideExpandedControl ? "auto" : "100%",
89
- justifyContent: props.showItemNames ? "flex-end" : "center",
85
+ justifyContent: "center",
90
86
  "&:focus": {
91
87
  outline: "0"
92
88
  },
@@ -116,194 +112,9 @@ var PanelControl = styled("button").withConfig({
116
112
  border: "none"
117
113
  });
118
114
  });
119
- var SideNavItemPopover = styled(Popover).withConfig({
120
- displayName: "SideNav__SideNavItemPopover",
121
- componentId: "sc-1heo0i9-4"
122
- })(function (props) {
123
- return css({
124
- width: "100%",
125
- marginBottom: props.bottomAligned ? "0" : "s",
126
- marginTop: props.bottomAligned ? "s" : "0",
127
- "&:hover,&:focus-within": {
128
- "& .popoverText": {
129
- opacity: props.showItemNames ? "0" : "1",
130
- zIndex: props.showItemNames ? "-100" : "100",
131
- visibility: props.showItemNames ? "hidden" : "visible",
132
- pointerEvents: props.showItemNames ? "none" : "auto",
133
- display: props.showItemNames ? "none" : "initial"
134
- }
135
- },
136
- "&:focus-within": {
137
- "& .popoverText": {
138
- opacity: props.active ? "0" : "1",
139
- zIndex: props.active ? "-100" : "100",
140
- visibility: props.active ? "hidden" : "visible",
141
- pointerEvents: props.active ? "none" : "auto",
142
- display: props.active ? "none" : "initial"
143
- }
144
- },
145
- "@media screen and (max-width: 900px)": {
146
- width: "auto",
147
- marginBottom: "0",
148
- marginTop: "0",
149
- "&:hover,&:focus-within": {
150
- "& .popoverText": {
151
- opacity: "0",
152
- zIndex: "-100",
153
- visibility: "hidden",
154
- pointerEvents: "none",
155
- justifyContent: "space-around",
156
- display: "none"
157
- }
158
- // "&:hover, &:focus": {
159
- // "& .sideNavItemName": {
160
- // display: "none"
161
- // }
162
- // }
163
- }
164
- }
165
- });
166
- });
167
-
168
- var SideNavItem = styled("button").withConfig({
169
- displayName: "SideNav__SideNavItem",
170
- componentId: "sc-1heo0i9-5"
171
- })(function (props) {
172
- return css({
173
- fontFamily: themeGet("fonts.main")(props),
174
- position: "relative",
175
- display: "flex",
176
- alignItems: "center",
177
- justifyContent: "center",
178
- width: "100%",
179
- borderRadius: themeGet("radii.2")(props),
180
- transition: themeGet("transition.transitionDefault")(props),
181
- bg: "transparent",
182
- cursor: "pointer",
183
- border: "none",
184
- padding: "s",
185
- // marginBottom: props.bottomAligned ? "0" : "s",
186
- // marginTop: props.bottomAligned ? "s" : "0",
187
- fontSize: "1.4rem",
188
- fontWeight: themeGet("fontWeights.1")(props),
189
- color: themeGet("colors.greyDarker")(props),
190
- path: {
191
- transition: themeGet("transition.transitionDefault")(props),
192
- fill: themeGet("colors.greyDarker")(props)
193
- },
194
- "&:hover, &:focus": {
195
- outline: "0",
196
- color: themeGet("colors.primary")(props),
197
- path: {
198
- fill: themeGet("colors.primary")(props)
199
- },
200
- "& .sideNavItemName": {
201
- color: themeGet("colors.primary")(props)
202
- }
203
- // "& .sideNavItemName": {
204
- // color: themeGet("colors.primary")(props)
205
- // }
206
- },
207
-
208
- "@media screen and (max-width: 900px)": {
209
- width: "auto"
210
- }
211
- });
212
- }, function (props) {
213
- return props.active && css({
214
- bg: themeGet("colors.primary")(props),
215
- path: {
216
- fill: themeGet("colors.white")(props)
217
- },
218
- // "& .sideNavItemName": {
219
- // color: themeGet("colors.white")(props)
220
- // },
221
- "&:hover, &:focus": {
222
- path: {
223
- fill: themeGet("colors.white")(props)
224
- },
225
- "& .sideNavItemName": {
226
- color: themeGet("colors.white")(props)
227
- }
228
- // "& .sideNavItemName": {
229
- // color: themeGet("colors.white")(props)
230
- // }
231
- }
232
- });
233
- });
234
-
235
- var SideNavItemLink = styled("div").withConfig({
236
- displayName: "SideNav__SideNavItemLink",
237
- componentId: "sc-1heo0i9-6"
238
- })(function (props) {
239
- return css({
240
- "& > a": {
241
- cursor: "pointer",
242
- padding: "s",
243
- textDecoration: "none",
244
- borderRadius: themeGet("radii.2")(props),
245
- width: "100%",
246
- path: {
247
- transition: themeGet("transition.transitionDefault")(props),
248
- fill: themeGet("colors.greyDarker")(props)
249
- },
250
- fontFamily: themeGet("fonts.main")(props),
251
- position: "relative",
252
- display: "flex",
253
- alignItems: "center",
254
- justifyContent: "center",
255
- // width: "100%",
256
- transition: themeGet("transition.transitionDefault")(props),
257
- bg: "transparent",
258
- fontSize: "1.4rem",
259
- fontWeight: themeGet("fontWeights.1")(props),
260
- "&:hover, &:focus": {
261
- "& .sideNavItemName": {
262
- color: themeGet("colors.primary")(props)
263
- },
264
- path: {
265
- fill: themeGet("colors.primary")(props)
266
- }
267
- },
268
- "@media screen and (max-width: 900px)": {
269
- width: "auto"
270
- },
271
- "&:focus": {
272
- outline: "0",
273
- color: themeGet("colors.primary")(props),
274
- path: {
275
- fill: themeGet("colors.primary")(props)
276
- }
277
- }
278
- }
279
- });
280
- }, function (props) {
281
- return props.active && css({
282
- "& > a": {
283
- bg: themeGet("colors.primary")(props),
284
- path: {
285
- fill: themeGet("colors.white")(props)
286
- },
287
- "&:hover, &:focus": {
288
- path: {
289
- fill: themeGet("colors.white")(props)
290
- }
291
- // "& .sideNavItemName": {
292
- // color: themeGet("colors.white")(props)
293
- // }
294
- },
295
-
296
- "&:focus": {
297
- path: {
298
- fill: themeGet("colors.white")(props)
299
- }
300
- }
301
- }
302
- });
303
- });
304
115
  var BottomAlignedNavItems = styled("div").withConfig({
305
116
  displayName: "SideNav__BottomAlignedNavItems",
306
- componentId: "sc-1heo0i9-7"
117
+ componentId: "sc-1heo0i9-4"
307
118
  })(function () {
308
119
  return css({
309
120
  marginTop: "auto",
@@ -317,58 +128,9 @@ var BottomAlignedNavItems = styled("div").withConfig({
317
128
  }
318
129
  });
319
130
  });
320
- var BadgeNumber = styled("div").withConfig({
321
- displayName: "SideNav__BadgeNumber",
322
- componentId: "sc-1heo0i9-8"
323
- })(function (props) {
324
- return css({
325
- position: "absolute",
326
- height: "16px",
327
- width: "16px",
328
- bg: themeGet("colors.danger")(props),
329
- fontSize: "1rem",
330
- fontWeight: themeGet("fontWeights.2")(props),
331
- color: themeGet("colors.white")(props),
332
- borderRadius: "50%",
333
- top: "0",
334
- right: "0",
335
- display: "flex",
336
- alignItems: "center",
337
- justifyContent: "center"
338
- });
339
- });
340
- var BadgeDot = styled("div").withConfig({
341
- displayName: "SideNav__BadgeDot",
342
- componentId: "sc-1heo0i9-9"
343
- })(function (props) {
344
- return css({
345
- position: "absolute",
346
- height: "8px",
347
- width: "8px",
348
- bg: themeGet("colors.primary")(props),
349
- borderRadius: "50%",
350
- top: "2px",
351
- right: "0"
352
- });
353
- });
354
-
355
- // const SideNavItemName = styled("div")((props) =>
356
- // css({
357
- // lineHeight: "0",
358
- // marginLeft: themeGet("space.r")(props),
359
- // fontSize: themeGet("fontSizes.1")(props),
360
- // whiteSpace: "nowrap",
361
- // textDecoration: "none",
362
- // color: themeGet("colors.greyDarker")(props),
363
- // "&:hover, &:focus": {
364
- // color: themeGet("colors.primary")(props)
365
- // }
366
- // })
367
- // );
368
-
369
131
  var SideNavExpanded = styled("div").withConfig({
370
132
  displayName: "SideNav__SideNavExpanded",
371
- componentId: "sc-1heo0i9-10"
133
+ componentId: "sc-1heo0i9-5"
372
134
  })(function (props) {
373
135
  return css({
374
136
  position: "relative",
@@ -379,6 +141,9 @@ var SideNavExpanded = styled("div").withConfig({
379
141
  overflowY: "auto",
380
142
  padding: "r",
381
143
  borderLeft: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
144
+ "&:focus": {
145
+ outline: "0"
146
+ },
382
147
  "@media screen and (max-width: 900px)": {
383
148
  width: "100%",
384
149
  minWidth: "initial",
@@ -389,56 +154,9 @@ var SideNavExpanded = styled("div").withConfig({
389
154
  }
390
155
  });
391
156
  });
392
- var NavItem = function NavItem(_ref) {
393
- var item = _ref.item,
394
- Component = _ref.Component,
395
- activeItem = _ref.activeItem,
396
- handleItemClick = _ref.handleItemClick;
397
- // Use the ternary operator to render the appropriate component based on actionType
398
- var accessibilityProps = _objectSpread(_objectSpread({}, item.actionType === "component" && {
399
- "aria-expanded": item.index === activeItem ? "true" : "false"
400
- }), {}, {
401
- "aria-label": item.name
402
- });
403
- return item.actionType === "link" ? /*#__PURE__*/React.createElement(SideNavItemPopover, {
404
- text: item.name,
405
- textAlign: "center",
406
- width: "124px",
407
- active: item.index === activeItem,
408
- bottomAligned: item.bottomAligned
409
- // showItemNames={showItemNames}
410
- }, /*#__PURE__*/React.createElement(SideNavItemLink, {
411
- key: item.index,
412
- active: item.index === activeItem,
413
- bottomAligned: item.bottomAligned,
414
- onClick: function onClick() {
415
- return handleItemClick(item);
416
- }
417
- }, /*#__PURE__*/React.createElement(Component, {
418
- item: item
419
- }, /*#__PURE__*/React.createElement(Icon, {
420
- icon: ["far", item.iconName]
421
- })))) : /*#__PURE__*/React.createElement(SideNavItemPopover, {
422
- text: item.name,
423
- textAlign: "center",
424
- width: "124px",
425
- active: item.index === activeItem,
426
- bottomAligned: item.bottomAligned
427
- // showItemNames={showItemNames}
428
- }, /*#__PURE__*/React.createElement(SideNavItem, _extends({
429
- key: item.index,
430
- active: item.index === activeItem,
431
- onClick: function onClick() {
432
- return handleItemClick(item);
433
- },
434
- bottomAligned: item.bottomAligned
435
- }, accessibilityProps), item.badgeNumber && /*#__PURE__*/React.createElement(BadgeNumber, null, item.badgeNumber), item.badgeDot && /*#__PURE__*/React.createElement(BadgeDot, null), /*#__PURE__*/React.createElement(Icon, {
436
- icon: ["far", item.iconName]
437
- })));
438
- };
439
- var SideNav = function SideNav(_ref2) {
440
- var items = _ref2.items,
441
- sideNavHeight = _ref2.sideNavHeight;
157
+ var SideNav = function SideNav(_ref) {
158
+ var items = _ref.items,
159
+ sideNavHeight = _ref.sideNavHeight;
442
160
  var _useState = useState(null),
443
161
  _useState2 = _slicedToArray(_useState, 2),
444
162
  expandedItem = _useState2[0],
@@ -447,6 +165,10 @@ var SideNav = function SideNav(_ref2) {
447
165
  _useState4 = _slicedToArray(_useState3, 2),
448
166
  activeItem = _useState4[0],
449
167
  setActiveItem = _useState4[1];
168
+
169
+ // Initialize a ref for SideNavExpanded
170
+ var expandedRef = useRef(null);
171
+ var navItemRefs = useRef({});
450
172
  var handleItemClick = function handleItemClick(item) {
451
173
  var itemIndex = item.index,
452
174
  actionType = item.actionType,
@@ -457,6 +179,7 @@ var SideNav = function SideNav(_ref2) {
457
179
  } else {
458
180
  setExpandedItem(itemIndex === expandedItem ? null : itemIndex);
459
181
  onButtonClick && onButtonClick(item);
182
+ itemIndex === expandedItem && navItemRefs.current && navItemRefs.current[itemIndex] && navItemRefs.current[itemIndex].focus();
460
183
  }
461
184
  setActiveItem(itemIndex === activeItem ? null : itemIndex);
462
185
  };
@@ -499,12 +222,15 @@ var SideNav = function SideNav(_ref2) {
499
222
  };
500
223
  });
501
224
 
502
- // Toggle nav item names on click of panel control button
503
- // const [showItemNames, setShowItemNames] = useState(false);
504
- // const toggleItemNames = () => {
505
- // setShowItemNames((prevState) => !prevState);
506
- // };
507
-
225
+ // Use a useEffect to focus on the expanded item
226
+ useEffect(function () {
227
+ if (expandedItem !== null && expandedRef.current) {
228
+ expandedRef.current.focus();
229
+ }
230
+ }, [expandedItem]);
231
+ var handleBlur = function handleBlur(item) {
232
+ handleItemClick(item);
233
+ };
508
234
  return /*#__PURE__*/React.createElement(SideNavWrapper, {
509
235
  sideNavHeight: sideNavHeight
510
236
  }, /*#__PURE__*/React.createElement(SideNavItems, null, topAlignedItems.map(function (item) {
@@ -515,11 +241,10 @@ var SideNav = function SideNav(_ref2) {
515
241
  return /*#__PURE__*/React.createElement(NavItem, {
516
242
  key: item.index,
517
243
  item: item,
518
- Component: Component
519
- // showItemNames={showItemNames}
520
- ,
244
+ Component: Component,
521
245
  activeItem: activeItem,
522
- handleItemClick: handleItemClick
246
+ handleItemClick: handleItemClick,
247
+ navItemRefs: navItemRefs
523
248
  });
524
249
  }), pageSpecificItems.length > 0 &&
525
250
  /*#__PURE__*/
@@ -539,11 +264,10 @@ var SideNav = function SideNav(_ref2) {
539
264
  return /*#__PURE__*/React.createElement(NavItem, {
540
265
  key: item.index,
541
266
  item: item,
542
- Component: Component
543
- // showItemNames={showItemNames}
544
- ,
267
+ Component: Component,
545
268
  activeItem: activeItem,
546
- handleItemClick: handleItemClick
269
+ handleItemClick: handleItemClick,
270
+ navItemRefs: navItemRefs
547
271
  });
548
272
  })), bottomAlignedItems.length > 0 && (
549
273
  // Render the special-container only if there are bottom-aligned items
@@ -555,11 +279,10 @@ var SideNav = function SideNav(_ref2) {
555
279
  return /*#__PURE__*/React.createElement(NavItem, {
556
280
  key: item.index,
557
281
  item: item,
558
- Component: Component
559
- // showItemNames={showItemNames}
560
- ,
282
+ Component: Component,
561
283
  activeItem: activeItem,
562
- handleItemClick: handleItemClick
284
+ handleItemClick: handleItemClick,
285
+ navItemRefs: navItemRefs
563
286
  });
564
287
  })) : bottomAlignedItems.map(function (item) {
565
288
  if (item.hide) {
@@ -569,17 +292,18 @@ var SideNav = function SideNav(_ref2) {
569
292
  return /*#__PURE__*/React.createElement(NavItem, {
570
293
  key: item.index,
571
294
  item: item,
572
- Component: Component
573
- // showItemNames={showItemNames}
574
- ,
295
+ Component: Component,
575
296
  activeItem: activeItem,
576
- handleItemClick: handleItemClick
297
+ handleItemClick: handleItemClick,
298
+ navItemRefs: navItemRefs
577
299
  });
578
300
  }))), expandedItem !== null && allItems[expandedItem] && allItems[expandedItem].component ? /*#__PURE__*/React.createElement(SideNavExpanded, {
301
+ ref: expandedRef,
302
+ tabIndex: "0",
579
303
  sideNavHeight: sideNavHeight,
580
304
  active: expandedItem === activeItem,
581
305
  large: allItems[expandedItem] && allItems[expandedItem].large
582
- }, /*#__PURE__*/React.createElement(PanelControlTooltip, {
306
+ }, allItems[expandedItem].component(), /*#__PURE__*/React.createElement(PanelControlTooltip, {
583
307
  width: "80px",
584
308
  textAlign: "center",
585
309
  hideExpandedControl: true,
@@ -589,21 +313,16 @@ var SideNav = function SideNav(_ref2) {
589
313
  onClick: function onClick() {
590
314
  return handleItemClick(allItems[expandedItem]);
591
315
  },
592
- "aria-label": "toggle panel"
316
+ "aria-label": "toggle panel",
317
+ onBlur: function onBlur() {
318
+ return handleBlur(allItems[expandedItem]);
319
+ }
593
320
  }, isGreaterThan900 === true ? /*#__PURE__*/React.createElement(Icon, {
594
321
  icon: ["fas", "chevron-left"]
595
322
  }) : /*#__PURE__*/React.createElement(Icon, {
596
323
  icon: ["fas", "chevron-down"]
597
- }))), allItems[expandedItem].component()) : null);
598
- };
599
- NavItem.propTypes = {
600
- item: PropTypes.object,
601
- Component: PropTypes.elementType,
602
- activeItem: PropTypes.string,
603
- handleItemClick: PropTypes.func
604
- // showItemNames: PropTypes.bool
324
+ })))) : null);
605
325
  };
606
-
607
326
  SideNav.propTypes = {
608
327
  sideNavHeight: PropTypes.string.isRequired,
609
328
  // Used to specify the height of the sideNav
@@ -619,10 +338,8 @@ SideNav.propTypes = {
619
338
  link: PropTypes.string,
620
339
  onClick: PropTypes.func
621
340
  })).isRequired,
622
- LinkComponent: PropTypes.elementType // React Router Link component
341
+ LinkComponent: PropTypes.elementType
623
342
  };
624
-
625
- /** @component */
626
343
  SideNav.__docgenInfo = {
627
344
  "description": "",
628
345
  "methods": [],
@@ -41,7 +41,7 @@ var TagValue = styled.button.attrs(function (props) {
41
41
  }, function (props) {
42
42
  return props.disabled ? themeGet("colors.greyLighter")(props) : props.selected && props.highlighted ? themeGet("colors.warningLight")(props) : props.selected ? themeGet("colors.primary")(props) : themeGet("colors.white")(props);
43
43
  }, function (props) {
44
- return props.disabled ? themeGet("colors.greyDarker")(props) : props.selected && props.highlighted ? themeGet("colors.black70")(props) : props.selected ? themeGet("colors.white")(props) : themeGet("colors.primary")(props);
44
+ return props.disabled ? themeGet("colors.greyDarker")(props) : props.selected && props.highlighted ? themeGet("colors.black80")(props) : props.selected ? themeGet("colors.white")(props) : themeGet("colors.primary")(props);
45
45
  }, function (props) {
46
46
  return props.disabled ? css([""]) : css(["&:hover,&:focus{outline:0;border:", ";color:", ";background-color:", ";div{color:", ";}div[class*=\"TagType\"]{background-color:", ";}}"], function (props) {
47
47
  return props.selected && props.highlighted ? "solid 1px ".concat(themeGet("colors.warningLighter")(props)) : "solid 1px ".concat(themeGet("colors.primaryDark")(props));
@@ -103,7 +103,7 @@ var TagType = styled.div.withConfig({
103
103
  }, function (props) {
104
104
  return props.disabled ? themeGet("colors.grey")(props) : props.selected && props.highlighted ? themeGet("colors.warningLighter")(props) : props.selected ? "rgba(0,0,0,0.25)" : themeGet("colors.primaryLightest")(props);
105
105
  }, function (props) {
106
- return props.disabled ? themeGet("colors.white")(props) : props.selected && props.highlighted ? themeGet("colors.warningDarkest")(props) : props.selected ? themeGet("colors.white")(props) : themeGet("colors.primaryDark")(props);
106
+ return props.disabled ? themeGet("colors.white")(props) : props.selected && props.highlighted ? themeGet("colors.black70")(props) : props.selected ? themeGet("colors.white")(props) : themeGet("colors.primaryDark")(props);
107
107
  });
108
108
  var TagAvatar = styled(Avatar).withConfig({
109
109
  displayName: "Tag__TagAvatar",
@@ -117,7 +117,7 @@ var TagAvatar = styled(Avatar).withConfig({
117
117
  }, function (props) {
118
118
  return props.small ? themeGet("tagScale.tagAvatarFontSizeSmall") : themeGet("tagScale.tagAvatarFontSizeDefault");
119
119
  }, function (props) {
120
- return props.disabled ? themeGet("colors.grey")(props) : props.selected && props.highlighted ? themeGet("colors.warningDarkest")(props) : props.selected ? "rgba(0,0,0,0.25)" : themeGet("colors.primaryLightest")(props);
120
+ return props.disabled ? themeGet("colors.grey")(props) : props.selected && props.highlighted ? themeGet("colors.black70")(props) : props.selected ? "rgba(0,0,0,0.25)" : themeGet("colors.primaryLightest")(props);
121
121
  }, function (props) {
122
122
  return props.disabled ? themeGet("colors.white")(props) : props.selected && props.highlighted ? themeGet("colors.white")(props) : props.selected ? themeGet("colors.white")(props) : themeGet("colors.primaryDark")(props);
123
123
  });
@@ -45,7 +45,7 @@ var primary = "#007ac4"; // Potential new colour: #2a5ec1. Base primary brand co
45
45
  var secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
46
46
  //const tertiary = "#FF9E44"; // A tertiary colour for limited use. Not sure if needed.
47
47
  var success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
48
- var successDesaturated = desaturate(0.1, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
48
+ var successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
49
49
  var warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
50
50
  var warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
51
51
  var danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
@@ -155,7 +155,7 @@ export var colors = {
155
155
  warningLightest: lighten(0.4, warning),
156
156
  warningDark: darken(0.1, warningSaturated),
157
157
  warningDarker: darken(0.2, warningSaturated),
158
- warningDarkest: darken(0.3, warningSaturated),
158
+ warningDarkest: darken(0.4, warningSaturated),
159
159
  warning10: rgba(warning, 0.1),
160
160
  warning20: rgba(warning, 0.2),
161
161
  warning30: rgba(warning, 0.3),
package/es/systemtheme.js CHANGED
@@ -44,7 +44,7 @@ var primary = "#007BC7"; // Potential new colour: #2a5ec1. Base primary brand co
44
44
  var secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
45
45
  //const tertiary = "#FF9E44"; // A tertiary colour for limited use. Not sure if needed.
46
46
  var success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
47
- var successDesaturated = desaturate(0.1, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
47
+ var successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
48
48
  var warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
49
49
  var warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
50
50
  var danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
@@ -154,7 +154,7 @@ export var colors = {
154
154
  warningLightest: lighten(0.4, warningSaturated),
155
155
  warningDark: darken(0.1, warningSaturated),
156
156
  warningDarker: darken(0.2, warningSaturated),
157
- warningDarkest: darken(0.3, warningSaturated),
157
+ warningDarkest: darken(0.4, warningSaturated),
158
158
  warning10: rgba(warning, 0.1),
159
159
  warning20: rgba(warning, 0.2),
160
160
  warning30: rgba(warning, 0.3),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
4
4
  "engines": {
5
5
  "node": "18.17.1"
6
6
  },
@@ -78,25 +78,25 @@
78
78
  "@fortawesome/react-fontawesome": "^0.1.14",
79
79
  "@mdx-js/loader": "^2.3.0",
80
80
  "@mdx-js/react": "^2.3.0",
81
- "@storybook/addon-a11y": "^7.5.0",
82
- "@storybook/addon-actions": "^7.3.2",
83
- "@storybook/addon-docs": "^7.3.2",
81
+ "@storybook/addon-a11y": "^7.6.7",
82
+ "@storybook/addon-actions": "^7.6.7",
83
+ "@storybook/addon-docs": "^7.6.7",
84
84
  "@storybook/addon-knobs": "^7.0.2",
85
- "@storybook/addon-links": "^7.3.2",
86
- "@storybook/addon-mdx-gfm": "^7.3.2",
87
- "@storybook/addon-storyshots": "^7.3.2",
88
- "@storybook/addon-toolbars": "^7.3.2",
89
- "@storybook/addon-viewport": "^7.3.2",
90
- "@storybook/addons": "^7.3.2",
91
- "@storybook/api": "^7.3.2",
92
- "@storybook/blocks": "^7.3.2",
93
- "@storybook/components": "^7.3.2",
94
- "@storybook/core-events": "^7.3.2",
95
- "@storybook/manager-api": "^7.3.2",
85
+ "@storybook/addon-links": "^7.6.7",
86
+ "@storybook/addon-mdx-gfm": "^7.6.7",
87
+ "@storybook/addon-storyshots": "^7.6.7",
88
+ "@storybook/addon-toolbars": "^7.6.7",
89
+ "@storybook/addon-viewport": "^7.6.7",
90
+ "@storybook/addons": "^7.6.7",
91
+ "@storybook/api": "^7.6.7",
92
+ "@storybook/blocks": "^7.6.7",
93
+ "@storybook/components": "^7.6.7",
94
+ "@storybook/core-events": "^7.6.7",
95
+ "@storybook/manager-api": "^7.6.7",
96
96
  "@storybook/mdx1-csf": "^1.0.0",
97
- "@storybook/preset-create-react-app": "^7.3.2",
98
- "@storybook/react": "^7.3.2",
99
- "@storybook/react-webpack5": "^7.3.2",
97
+ "@storybook/preset-create-react-app": "^7.6.7",
98
+ "@storybook/react": "^7.6.7",
99
+ "@storybook/react-webpack5": "^7.6.7",
100
100
  "@storybook/storybook-deployer": "2.8.16",
101
101
  "@testing-library/jest-dom": "^5.11.6",
102
102
  "@testing-library/react": "^11.2.2",
@@ -127,7 +127,7 @@
127
127
  "prettier": "^2.2.1",
128
128
  "react": "^18.2.0",
129
129
  "react-dom": "^18.2.0",
130
- "storybook": "^7.3.2",
130
+ "storybook": "^7.6.7",
131
131
  "style-loader": "^2.0.0",
132
132
  "styled-components": "^5.2.1",
133
133
  "webpack": "^5.88.2",
@@ -141,7 +141,8 @@
141
141
  "remark-parse": "10.0.2",
142
142
  "react": "^18.2.0",
143
143
  "react-dom": "^18.2.0",
144
- "eslint-plugin-testing-library": "^5.11.1"
144
+ "eslint-plugin-testing-library": "^5.11.1",
145
+ "typescript": "5.2.2"
145
146
  },
146
147
  "browserslist": {
147
148
  "development": [