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.
- package/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- 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
|
-
|
|
16
|
-
|
|
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
|
-
})(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
const SideNavItems = styled("div").withConfig({
|
|
49
44
|
displayName: "SideNav__SideNavItems",
|
|
50
45
|
componentId: "sc-1heo0i9-1"
|
|
51
|
-
})(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
const PanelControlTooltip = styled(Popover).withConfig({
|
|
71
65
|
displayName: "SideNav__PanelControlTooltip",
|
|
72
66
|
componentId: "sc-1heo0i9-2"
|
|
73
|
-
})(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
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
|
-
}
|
|
83
|
+
},
|
|
84
|
+
"& .popoverText": {
|
|
91
85
|
marginTop: props.hideExpandedControl ? "0" : "s"
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
const PanelControl = styled("button").withConfig({
|
|
95
89
|
displayName: "SideNav__PanelControl",
|
|
96
90
|
componentId: "sc-1heo0i9-3"
|
|
97
|
-
})(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
})(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
193
|
-
return setTimeout(handleResize, 300);
|
|
194
|
-
}; // Wrap in a function
|
|
172
|
+
const debounceResize = () => setTimeout(handleResize, 300); // Wrap in a function
|
|
195
173
|
|
|
196
|
-
useEffect(
|
|
197
|
-
return
|
|
198
|
-
return clearTimeout(handleResize);
|
|
199
|
-
};
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
return () => clearTimeout(handleResize);
|
|
200
176
|
}, []);
|
|
201
|
-
useEffect(
|
|
177
|
+
useEffect(() => {
|
|
202
178
|
window.addEventListener("resize", debounceResize);
|
|
203
|
-
return
|
|
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(
|
|
183
|
+
useEffect(() => {
|
|
210
184
|
if (expandedItem !== null && expandedRef.current) {
|
|
211
185
|
expandedRef.current.focus();
|
|
212
186
|
}
|
|
213
187
|
}, [expandedItem]);
|
|
214
|
-
|
|
188
|
+
const handleBlur = item => {
|
|
215
189
|
handleItemClick(item);
|
|
216
190
|
};
|
|
217
|
-
|
|
218
|
-
|
|
191
|
+
const orderedItems = [...topAlignedItems, ...pageSpecificItems, ...bottomAlignedItems];
|
|
192
|
+
const renderItem = (item, index) => {
|
|
219
193
|
if (item.hide) {
|
|
220
194
|
return null;
|
|
221
195
|
}
|
|
222
|
-
|
|
223
|
-
|
|
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__*/
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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__*/
|
|
242
|
-
sideNavHeight: sideNavHeight
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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": "",
|