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,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import React, { useState, useEffect, useRef } from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import styled, { ThemeProvider } from "styled-components";
|
|
@@ -13,36 +12,31 @@ import StyledLink from "../StyledLink/";
|
|
|
13
12
|
import { css } from "@styled-system/css";
|
|
14
13
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
15
14
|
import { themeGet } from "@styled-system/theme-get";
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
const Bar = styled("header").withConfig({
|
|
17
|
+
shouldForwardProp,
|
|
18
18
|
displayName: "Header__Bar",
|
|
19
19
|
componentId: "sc-yf04b-0"
|
|
20
|
-
}).attrs(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
bg: themeGet("colors.black")(props),
|
|
39
|
-
"a[class^='StyledLink'], a[class*=' StyledLink'], div[class^='Badge'], div[class*=' Badge']": {
|
|
40
|
-
display: ["none", "none", "none", "block", "block"]
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}, variant({
|
|
20
|
+
}).attrs(props => ({
|
|
21
|
+
"data-testid": props.dataTestId
|
|
22
|
+
}))(props => ({
|
|
23
|
+
height: themeGet("appScale.navBarSize")(props)
|
|
24
|
+
}), props => css({
|
|
25
|
+
width: "100%",
|
|
26
|
+
zIndex: 12,
|
|
27
|
+
position: "sticky",
|
|
28
|
+
top: "0",
|
|
29
|
+
display: "flex",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
py: 0,
|
|
32
|
+
px: 4,
|
|
33
|
+
bg: themeGet("colors.black")(props),
|
|
34
|
+
"a[class^='StyledLink'], a[class*=' StyledLink'], div[class^='Badge'], div[class*=' Badge']": {
|
|
35
|
+
display: ["none", "none", "none", "block", "block"]
|
|
36
|
+
}
|
|
37
|
+
}), variant({
|
|
44
38
|
variants: {
|
|
45
|
-
|
|
39
|
+
default: {
|
|
46
40
|
width: "5px",
|
|
47
41
|
height: "5px",
|
|
48
42
|
backgroundColor: "#fff",
|
|
@@ -55,7 +49,7 @@ var Bar = styled("header").withConfig({
|
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
}), space);
|
|
58
|
-
|
|
52
|
+
const Switcher = styled("button").withConfig({
|
|
59
53
|
displayName: "Header__Switcher",
|
|
60
54
|
componentId: "sc-yf04b-1"
|
|
61
55
|
})(css({
|
|
@@ -73,7 +67,7 @@ var Switcher = styled("button").withConfig({
|
|
|
73
67
|
backgroundColor: "#0091ea"
|
|
74
68
|
}
|
|
75
69
|
}));
|
|
76
|
-
|
|
70
|
+
const SwitcherTopLeft = styled("div").withConfig({
|
|
77
71
|
displayName: "Header__SwitcherTopLeft",
|
|
78
72
|
componentId: "sc-yf04b-2"
|
|
79
73
|
})(css({
|
|
@@ -82,7 +76,7 @@ var SwitcherTopLeft = styled("div").withConfig({
|
|
|
82
76
|
backgroundColor: "#fff",
|
|
83
77
|
transition: "all 200ms ease-in-out"
|
|
84
78
|
}));
|
|
85
|
-
|
|
79
|
+
const SwitcherTopMiddle = styled("div").withConfig({
|
|
86
80
|
displayName: "Header__SwitcherTopMiddle",
|
|
87
81
|
componentId: "sc-yf04b-3"
|
|
88
82
|
})(css({
|
|
@@ -91,7 +85,7 @@ var SwitcherTopMiddle = styled("div").withConfig({
|
|
|
91
85
|
backgroundColor: "#fff",
|
|
92
86
|
transition: "all 200ms ease-in-out"
|
|
93
87
|
}));
|
|
94
|
-
|
|
88
|
+
const SwitcherTopRight = styled("div").withConfig({
|
|
95
89
|
displayName: "Header__SwitcherTopRight",
|
|
96
90
|
componentId: "sc-yf04b-4"
|
|
97
91
|
})(css({
|
|
@@ -100,7 +94,7 @@ var SwitcherTopRight = styled("div").withConfig({
|
|
|
100
94
|
backgroundColor: "#fff",
|
|
101
95
|
transition: "all 200ms ease-in-out"
|
|
102
96
|
}));
|
|
103
|
-
|
|
97
|
+
const SwitcherMiddleLeft = styled("div").withConfig({
|
|
104
98
|
displayName: "Header__SwitcherMiddleLeft",
|
|
105
99
|
componentId: "sc-yf04b-5"
|
|
106
100
|
})(css({
|
|
@@ -109,7 +103,7 @@ var SwitcherMiddleLeft = styled("div").withConfig({
|
|
|
109
103
|
backgroundColor: "#fff",
|
|
110
104
|
transition: "all 200ms ease-in-out"
|
|
111
105
|
}));
|
|
112
|
-
|
|
106
|
+
const SwitcherMiddleMiddle = styled("div").withConfig({
|
|
113
107
|
displayName: "Header__SwitcherMiddleMiddle",
|
|
114
108
|
componentId: "sc-yf04b-6"
|
|
115
109
|
})(css({
|
|
@@ -118,7 +112,7 @@ var SwitcherMiddleMiddle = styled("div").withConfig({
|
|
|
118
112
|
backgroundColor: "#fff",
|
|
119
113
|
transition: "all 200ms ease-in-out"
|
|
120
114
|
}));
|
|
121
|
-
|
|
115
|
+
const SwitcherMiddleRight = styled("div").withConfig({
|
|
122
116
|
displayName: "Header__SwitcherMiddleRight",
|
|
123
117
|
componentId: "sc-yf04b-7"
|
|
124
118
|
})(css({
|
|
@@ -127,7 +121,7 @@ var SwitcherMiddleRight = styled("div").withConfig({
|
|
|
127
121
|
backgroundColor: "#fff",
|
|
128
122
|
transition: "all 200ms ease-in-out"
|
|
129
123
|
}));
|
|
130
|
-
|
|
124
|
+
const SwitcherBottomLeft = styled("div").withConfig({
|
|
131
125
|
displayName: "Header__SwitcherBottomLeft",
|
|
132
126
|
componentId: "sc-yf04b-8"
|
|
133
127
|
})(css({
|
|
@@ -136,7 +130,7 @@ var SwitcherBottomLeft = styled("div").withConfig({
|
|
|
136
130
|
backgroundColor: "#fff",
|
|
137
131
|
transition: "all 200ms ease-in-out"
|
|
138
132
|
}));
|
|
139
|
-
|
|
133
|
+
const SwitcherBottomMiddle = styled("div").withConfig({
|
|
140
134
|
displayName: "Header__SwitcherBottomMiddle",
|
|
141
135
|
componentId: "sc-yf04b-9"
|
|
142
136
|
})(css({
|
|
@@ -145,7 +139,7 @@ var SwitcherBottomMiddle = styled("div").withConfig({
|
|
|
145
139
|
backgroundColor: "#fff",
|
|
146
140
|
transition: "all 200ms ease-in-out"
|
|
147
141
|
}));
|
|
148
|
-
|
|
142
|
+
const SwitcherBottomRight = styled("div").withConfig({
|
|
149
143
|
displayName: "Header__SwitcherBottomRight",
|
|
150
144
|
componentId: "sc-yf04b-10"
|
|
151
145
|
})(css({
|
|
@@ -154,102 +148,90 @@ var SwitcherBottomRight = styled("div").withConfig({
|
|
|
154
148
|
backgroundColor: "#fff",
|
|
155
149
|
transition: "all 200ms ease-in-out"
|
|
156
150
|
}));
|
|
157
|
-
|
|
151
|
+
const AppsMenu = styled("div").withConfig({
|
|
158
152
|
displayName: "Header__AppsMenu",
|
|
159
153
|
componentId: "sc-yf04b-11"
|
|
160
|
-
})(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
154
|
+
})(props => css({
|
|
155
|
+
backgroundColor: props.lightAppSwitcher ? "white" : "black",
|
|
156
|
+
border: props.lightAppSwitcher ? "solid 1px rgba(0, 0, 0, 0.1)" : "none",
|
|
157
|
+
color: props.lightAppSwitcher ? "black" : "white",
|
|
158
|
+
width: "260px",
|
|
159
|
+
display: "inline-block",
|
|
160
|
+
position: "absolute",
|
|
161
|
+
cursor: "default",
|
|
162
|
+
top: "60px",
|
|
163
|
+
left: "60px",
|
|
164
|
+
padding: "s",
|
|
165
|
+
borderRadius: "6px",
|
|
166
|
+
opacity: "0",
|
|
167
|
+
pointerEvents: "none",
|
|
168
|
+
transform: "translate(-10px, -10px)",
|
|
169
|
+
userSelect: "none",
|
|
170
|
+
zIndex: "-1",
|
|
171
|
+
transition: "all 200ms ease-in-out",
|
|
172
|
+
boxShadow: themeGet("shadows.boxDefault")(props),
|
|
173
|
+
"[class^='StyledLink'], [class*=' StyledLink']": {
|
|
174
|
+
color: props.lightAppSwitcher ? themeGet("colors.black")(props) : themeGet("colors.white")(props),
|
|
175
|
+
display: "block",
|
|
176
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
171
177
|
padding: "s",
|
|
172
|
-
borderRadius: "
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
userSelect: "none",
|
|
177
|
-
zIndex: "-1",
|
|
178
|
-
transition: "all 200ms ease-in-out",
|
|
179
|
-
boxShadow: themeGet("shadows.boxDefault")(props),
|
|
180
|
-
"[class^='StyledLink'], [class*=' StyledLink']": {
|
|
181
|
-
color: props.lightAppSwitcher ? themeGet("colors.black")(props) : themeGet("colors.white")(props),
|
|
182
|
-
display: "block",
|
|
183
|
-
fontWeight: themeGet("fontWeights.2")(props),
|
|
184
|
-
padding: "s",
|
|
185
|
-
borderRadius: themeGet("radii.2")(props),
|
|
186
|
-
"&:hover, &:focus": {
|
|
187
|
-
textDecoration: "none",
|
|
188
|
-
backgroundColor: props.lightAppSwitcher ? themeGet("colors.primaryLightest")(props) : themeGet("colors.primary")(props)
|
|
189
|
-
}
|
|
178
|
+
borderRadius: themeGet("radii.2")(props),
|
|
179
|
+
"&:hover, &:focus": {
|
|
180
|
+
textDecoration: "none",
|
|
181
|
+
backgroundColor: props.lightAppSwitcher ? themeGet("colors.primaryLightest")(props) : themeGet("colors.primary")(props)
|
|
190
182
|
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
var WorkspaceSwitcher = styled("div").withConfig({
|
|
183
|
+
}
|
|
184
|
+
}), props => props.isOpen ? css({
|
|
185
|
+
opacity: "1",
|
|
186
|
+
userSelect: "default",
|
|
187
|
+
zIndex: "2",
|
|
188
|
+
transform: "translate(0, 0)",
|
|
189
|
+
pointerEvents: "auto"
|
|
190
|
+
}) : null);
|
|
191
|
+
const WorkspaceSwitcher = styled("div").withConfig({
|
|
202
192
|
displayName: "Header__WorkspaceSwitcher",
|
|
203
193
|
componentId: "sc-yf04b-12"
|
|
204
|
-
})(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
"
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
var InternalAppSwitcher = styled("div").withConfig({
|
|
194
|
+
})(props => css({
|
|
195
|
+
borderBottom: props.lightAppSwitcher ? "solid 1px rgba(0,0,0,0.1)" : "solid 1px rgba(255,255,255,0.3)",
|
|
196
|
+
paddingBottom: "s",
|
|
197
|
+
"[class^='Small'], [class*=' Small']": {
|
|
198
|
+
display: "block",
|
|
199
|
+
fontWeight: themeGet("fontWeights.1")(props)
|
|
200
|
+
}
|
|
201
|
+
}));
|
|
202
|
+
const InternalAppSwitcher = styled("div").withConfig({
|
|
215
203
|
displayName: "Header__InternalAppSwitcher",
|
|
216
204
|
componentId: "sc-yf04b-13"
|
|
217
|
-
})(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
var ExternalAppSwitcher = styled("div").withConfig({
|
|
205
|
+
})(props => css({
|
|
206
|
+
borderBottom: props.lightAppSwitcher ? "solid 1px rgba(0,0,0,0.1)" : "solid 1px rgba(255,255,255,0.3)",
|
|
207
|
+
paddingBottom: "s",
|
|
208
|
+
marginTop: "s",
|
|
209
|
+
"[class^='Small'], [class*=' Small']": {
|
|
210
|
+
display: "block",
|
|
211
|
+
fontWeight: themeGet("fontWeights.1")(props)
|
|
212
|
+
}
|
|
213
|
+
}));
|
|
214
|
+
const ExternalAppSwitcher = styled("div").withConfig({
|
|
229
215
|
displayName: "Header__ExternalAppSwitcher",
|
|
230
216
|
componentId: "sc-yf04b-14"
|
|
231
|
-
})(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
"
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
240
|
-
var AppName = styled("div").withConfig({
|
|
217
|
+
})(props => css({
|
|
218
|
+
marginTop: "s",
|
|
219
|
+
"[class^='Small'], [class*=' Small']": {
|
|
220
|
+
display: "block",
|
|
221
|
+
fontWeight: themeGet("fontWeights.1")(props)
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
224
|
+
const AppName = styled("div").withConfig({
|
|
241
225
|
displayName: "Header__AppName",
|
|
242
226
|
componentId: "sc-yf04b-15"
|
|
243
|
-
})(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
}, variant({
|
|
227
|
+
})(props => css({
|
|
228
|
+
display: "flex",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
fontSize: themeGet("fontSizes.3")(props),
|
|
231
|
+
color: themeGet("colors.white")(props)
|
|
232
|
+
}), variant({
|
|
251
233
|
variants: {
|
|
252
|
-
|
|
234
|
+
default: {
|
|
253
235
|
width: "5px",
|
|
254
236
|
height: "5px",
|
|
255
237
|
backgroundColor: "#fff",
|
|
@@ -261,12 +243,12 @@ var AppName = styled("div").withConfig({
|
|
|
261
243
|
}
|
|
262
244
|
}
|
|
263
245
|
}), space);
|
|
264
|
-
|
|
246
|
+
const SearchContainer = styled("div").withConfig({
|
|
265
247
|
displayName: "Header__SearchContainer",
|
|
266
248
|
componentId: "sc-yf04b-16"
|
|
267
249
|
})(variant({
|
|
268
250
|
variants: {
|
|
269
|
-
|
|
251
|
+
default: {
|
|
270
252
|
display: "block"
|
|
271
253
|
},
|
|
272
254
|
search: {
|
|
@@ -282,200 +264,186 @@ var SearchContainer = styled("div").withConfig({
|
|
|
282
264
|
}
|
|
283
265
|
}
|
|
284
266
|
}), space, layout);
|
|
285
|
-
|
|
267
|
+
const MobileMenuToggle = styled("button").withConfig({
|
|
286
268
|
displayName: "Header__MobileMenuToggle",
|
|
287
269
|
componentId: "sc-yf04b-17"
|
|
288
|
-
})(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
"
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
bg: themeGet("colors.white")(props)
|
|
304
|
-
}
|
|
270
|
+
})(props => css({
|
|
271
|
+
zIndex: 4,
|
|
272
|
+
cursor: "pointer",
|
|
273
|
+
userSelect: "none",
|
|
274
|
+
background: "none",
|
|
275
|
+
border: "none",
|
|
276
|
+
position: "relative",
|
|
277
|
+
padding: "0 0 7px",
|
|
278
|
+
display: "block",
|
|
279
|
+
"&:hover, &:focus": {
|
|
280
|
+
outline: "0",
|
|
281
|
+
span: {
|
|
282
|
+
bg: themeGet("colors.white")(props),
|
|
283
|
+
"&:before, &:after": {
|
|
284
|
+
bg: themeGet("colors.white")(props)
|
|
305
285
|
}
|
|
306
286
|
}
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
289
|
+
const Hamburger = styled("span").withConfig({
|
|
310
290
|
displayName: "Header__Hamburger",
|
|
311
291
|
componentId: "sc-yf04b-18"
|
|
312
|
-
})(
|
|
313
|
-
|
|
314
|
-
"
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
content: "''",
|
|
318
|
-
display: "inline-block",
|
|
319
|
-
width: "30px",
|
|
320
|
-
height: "4px",
|
|
321
|
-
borderRadius: themeGet("radii.2")(props),
|
|
322
|
-
bg: themeGet("colors.white")(props),
|
|
323
|
-
left: 0,
|
|
324
|
-
transformOrigin: "50% 50%",
|
|
325
|
-
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1), background-color 300ms cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
326
|
-
},
|
|
327
|
-
"::after": {
|
|
328
|
-
position: "absolute",
|
|
329
|
-
top: "calc(8px * -1.25)",
|
|
330
|
-
content: "''",
|
|
331
|
-
display: "inline-block",
|
|
332
|
-
width: "30px",
|
|
333
|
-
height: "4px",
|
|
334
|
-
borderRadius: themeGet("radii.2")(props),
|
|
335
|
-
bg: themeGet("colors.white")(props),
|
|
336
|
-
left: 0,
|
|
337
|
-
transformOrigin: "50% 50%",
|
|
338
|
-
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1), background-color 300ms cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
339
|
-
},
|
|
292
|
+
})(props => css({
|
|
293
|
+
"::before": {
|
|
294
|
+
top: "calc(8px * 1.25)",
|
|
295
|
+
position: "absolute",
|
|
296
|
+
content: "''",
|
|
340
297
|
display: "inline-block",
|
|
341
|
-
cursor: "pointer",
|
|
342
|
-
userSelect: "none",
|
|
343
|
-
transition: themeGet("transition.transitionDefault")(props),
|
|
344
298
|
width: "30px",
|
|
345
299
|
height: "4px",
|
|
346
300
|
borderRadius: themeGet("radii.2")(props),
|
|
347
301
|
bg: themeGet("colors.white")(props),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
302
|
+
left: 0,
|
|
303
|
+
transformOrigin: "50% 50%",
|
|
304
|
+
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1), background-color 300ms cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
305
|
+
},
|
|
306
|
+
"::after": {
|
|
307
|
+
position: "absolute",
|
|
308
|
+
top: "calc(8px * -1.25)",
|
|
309
|
+
content: "''",
|
|
310
|
+
display: "inline-block",
|
|
311
|
+
width: "30px",
|
|
312
|
+
height: "4px",
|
|
313
|
+
borderRadius: themeGet("radii.2")(props),
|
|
314
|
+
bg: themeGet("colors.white")(props),
|
|
315
|
+
left: 0,
|
|
316
|
+
transformOrigin: "50% 50%",
|
|
317
|
+
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1), background-color 300ms cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
318
|
+
},
|
|
319
|
+
display: "inline-block",
|
|
320
|
+
cursor: "pointer",
|
|
321
|
+
userSelect: "none",
|
|
322
|
+
transition: themeGet("transition.transitionDefault")(props),
|
|
323
|
+
width: "30px",
|
|
324
|
+
height: "4px",
|
|
325
|
+
borderRadius: themeGet("radii.2")(props),
|
|
326
|
+
bg: themeGet("colors.white")(props),
|
|
327
|
+
position: "relative"
|
|
328
|
+
}));
|
|
329
|
+
const MobileNavToggle = styled("input").withConfig({
|
|
352
330
|
displayName: "Header__MobileNavToggle",
|
|
353
331
|
componentId: "sc-yf04b-19"
|
|
354
|
-
})(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
332
|
+
})(props => css({
|
|
333
|
+
opacity: "0",
|
|
334
|
+
position: "absolute",
|
|
335
|
+
visibility: "hidden",
|
|
336
|
+
margin: 0,
|
|
337
|
+
zIndex: 0,
|
|
338
|
+
width: 0,
|
|
339
|
+
height: 0,
|
|
340
|
+
overflow: "hidden",
|
|
341
|
+
pointerEvents: "none",
|
|
342
|
+
"~ header, ~ div, ~ main": {
|
|
343
|
+
transition: themeGet("transition.transitionDefault")(props)
|
|
344
|
+
},
|
|
345
|
+
"&:checked": {
|
|
346
|
+
"~ [class^='Header__MobileNavMenu'], ~ [class*=' Header__MobileNavMenu']": {
|
|
347
|
+
transform: "translateX(-" + themeGet("appScale.mobileNavMenuWidth")(props) + ")"
|
|
367
348
|
},
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
"
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
"
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
"
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
"
|
|
392
|
-
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
393
|
-
top: 0,
|
|
394
|
-
width: "24px",
|
|
395
|
-
transform: "rotate3d(0,0,1,-45deg) scale(1.1)"
|
|
396
|
-
}
|
|
349
|
+
"~ main": {
|
|
350
|
+
transform: "translateX(-" + themeGet("appScale.mobileNavMenuWidth")(props) + ")"
|
|
351
|
+
},
|
|
352
|
+
"~ header": {
|
|
353
|
+
transform: "translateX(-" + themeGet("appScale.mobileNavMenuWidth")(props) + ")"
|
|
354
|
+
},
|
|
355
|
+
/* Hamburger */
|
|
356
|
+
"~ [class^='Header__Bar'], ~ [class*=' Header__Bar']": {
|
|
357
|
+
"[class^='Header__Hamburger'], [class*=' Header__Hamburger']": {
|
|
358
|
+
bg: "transparent" /* fade away the middle line */,
|
|
359
|
+
"&:hover,&:focus": {
|
|
360
|
+
bg: "transparent"
|
|
361
|
+
},
|
|
362
|
+
"::before": {
|
|
363
|
+
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
364
|
+
top: 0,
|
|
365
|
+
width: "24px",
|
|
366
|
+
transform: "rotate3d(0,0,1,45deg) scale(1.1)"
|
|
367
|
+
},
|
|
368
|
+
"::after": {
|
|
369
|
+
transition: "top 300ms cubic-bezier(0.165, 0.84, 0.44, 1), transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
370
|
+
top: 0,
|
|
371
|
+
width: "24px",
|
|
372
|
+
transform: "rotate3d(0,0,1,-45deg) scale(1.1)"
|
|
397
373
|
}
|
|
398
|
-
},
|
|
399
|
-
/* Overlay */
|
|
400
|
-
"~ label": {
|
|
401
|
-
zIndex: 5,
|
|
402
|
-
opacity: "1"
|
|
403
374
|
}
|
|
375
|
+
},
|
|
376
|
+
/* Overlay */
|
|
377
|
+
"~ label": {
|
|
378
|
+
zIndex: 5,
|
|
379
|
+
opacity: "1"
|
|
404
380
|
}
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
};
|
|
411
|
-
}).withConfig({
|
|
381
|
+
}
|
|
382
|
+
}));
|
|
383
|
+
const MobileNavMenu = styled("div").attrs(props => ({
|
|
384
|
+
"aria-hidden": "".concat(!props.isOpen)
|
|
385
|
+
})).withConfig({
|
|
412
386
|
displayName: "Header__MobileNavMenu",
|
|
413
387
|
componentId: "sc-yf04b-20"
|
|
414
|
-
})(
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
"
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
"
|
|
433
|
-
|
|
434
|
-
backgroundColor: themeGet("colors.primary")(props)
|
|
435
|
-
}
|
|
388
|
+
})(props => css({
|
|
389
|
+
display: props.isOpen ? "block" : "none",
|
|
390
|
+
position: "fixed",
|
|
391
|
+
overflowY: "auto",
|
|
392
|
+
height: "100vh",
|
|
393
|
+
right: "-" + themeGet("appScale.mobileNavMenuWidth")(props),
|
|
394
|
+
top: 0,
|
|
395
|
+
width: themeGet("appScale.mobileNavMenuWidth")(props),
|
|
396
|
+
bg: themeGet("colors.greyDarkest")(props),
|
|
397
|
+
zIndex: 6,
|
|
398
|
+
transition: themeGet("transition.transitionDefault")(props),
|
|
399
|
+
"[class^='StyledLink'], [class*=' StyledLink']": {
|
|
400
|
+
color: themeGet("colors.white")(props),
|
|
401
|
+
display: "block",
|
|
402
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
403
|
+
padding: "r",
|
|
404
|
+
borderRadius: themeGet("radii.2")(props),
|
|
405
|
+
"&:hover, &:focus": {
|
|
406
|
+
textDecoration: "none",
|
|
407
|
+
backgroundColor: themeGet("colors.primary")(props)
|
|
436
408
|
}
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
|
|
409
|
+
}
|
|
410
|
+
}));
|
|
411
|
+
const Theme = styled("div").withConfig({
|
|
440
412
|
displayName: "Header__Theme",
|
|
441
413
|
componentId: "sc-yf04b-21"
|
|
442
|
-
})(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
"
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
});
|
|
455
|
-
var RightAligned = styled("div").withConfig({
|
|
414
|
+
})(props => css({
|
|
415
|
+
borderTop: "solid 1px rgba(255,255,255,0.3)",
|
|
416
|
+
padding: "r",
|
|
417
|
+
paddingTop: "s",
|
|
418
|
+
marginTop: "s",
|
|
419
|
+
"[class^='Small'], [class*=' Small']": {
|
|
420
|
+
display: "block",
|
|
421
|
+
fontWeight: themeGet("fontWeights.1")(props),
|
|
422
|
+
marginTop: "xs"
|
|
423
|
+
}
|
|
424
|
+
}));
|
|
425
|
+
const RightAligned = styled("div").withConfig({
|
|
456
426
|
displayName: "Header__RightAligned",
|
|
457
427
|
componentId: "sc-yf04b-22"
|
|
458
428
|
})(css({
|
|
459
429
|
marginLeft: "auto",
|
|
460
430
|
marginRight: "r"
|
|
461
431
|
}));
|
|
462
|
-
|
|
432
|
+
const Overlay = styled("label").withConfig({
|
|
463
433
|
displayName: "Header__Overlay",
|
|
464
434
|
componentId: "sc-yf04b-23"
|
|
465
|
-
})(
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
});
|
|
478
|
-
});
|
|
435
|
+
})(props => css({
|
|
436
|
+
position: "fixed",
|
|
437
|
+
top: 0,
|
|
438
|
+
left: 0,
|
|
439
|
+
height: "100vh",
|
|
440
|
+
width: "100%",
|
|
441
|
+
bg: themeGet("colors.black50")(props),
|
|
442
|
+
zIndex: 0,
|
|
443
|
+
opacity: "0",
|
|
444
|
+
overflow: "hidden",
|
|
445
|
+
transition: themeGet("transition.transitionDefault")(props)
|
|
446
|
+
}));
|
|
479
447
|
|
|
480
448
|
/**
|
|
481
449
|
* Header component for global app navigation.
|
|
@@ -483,50 +451,43 @@ var Overlay = styled("label").withConfig({
|
|
|
483
451
|
* At screen sizes less than 1100px the links are instead moved into a mobile menu toggled by a burger icon button to play nice with smaller devices.
|
|
484
452
|
*/
|
|
485
453
|
export default function Header(_ref) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
navToggleId =
|
|
503
|
-
currentWorkspace
|
|
504
|
-
logo
|
|
505
|
-
appSwitcher
|
|
506
|
-
lightAppSwitcher
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
setMobileMenuIsOpen = _useState4[1];
|
|
515
|
-
var switcherRef = useRef();
|
|
516
|
-
var menuRef = useRef();
|
|
517
|
-
var toggleMobileMenu = function toggleMobileMenu() {
|
|
518
|
-
setMobileMenuIsOpen(function (state) {
|
|
519
|
-
return !state;
|
|
520
|
-
});
|
|
454
|
+
let {
|
|
455
|
+
appName,
|
|
456
|
+
userName,
|
|
457
|
+
avatarSource,
|
|
458
|
+
children,
|
|
459
|
+
sideMenuContent,
|
|
460
|
+
internalAppSwitcherContent,
|
|
461
|
+
externalAppSwitcherContent,
|
|
462
|
+
rightAlignedContent,
|
|
463
|
+
logoutFunction,
|
|
464
|
+
searchComponent,
|
|
465
|
+
dataTestId,
|
|
466
|
+
theme,
|
|
467
|
+
variant,
|
|
468
|
+
themeSwitcherContent,
|
|
469
|
+
workspaceSwitcherContent,
|
|
470
|
+
navToggleId = "mobileMenuToggle",
|
|
471
|
+
currentWorkspace,
|
|
472
|
+
logo,
|
|
473
|
+
appSwitcher,
|
|
474
|
+
lightAppSwitcher
|
|
475
|
+
} = _ref;
|
|
476
|
+
const [toggleState, setToggle] = useState(false);
|
|
477
|
+
const [mobileMenuIsOpen, setMobileMenuIsOpen] = useState(false);
|
|
478
|
+
const switcherRef = useRef();
|
|
479
|
+
const menuRef = useRef();
|
|
480
|
+
const toggleMobileMenu = () => {
|
|
481
|
+
setMobileMenuIsOpen(state => !state);
|
|
521
482
|
};
|
|
522
|
-
|
|
483
|
+
const closeMenu = () => {
|
|
523
484
|
setToggle(false);
|
|
524
485
|
};
|
|
525
|
-
useEffect(
|
|
486
|
+
useEffect(() => {
|
|
526
487
|
if (!toggleState) {
|
|
527
488
|
return;
|
|
528
489
|
}
|
|
529
|
-
|
|
490
|
+
const handleClicked = event => {
|
|
530
491
|
// As the event listener is attached in capture phase, need to do this make sure the sate change are after react event cycle.
|
|
531
492
|
if (menuRef.current && !menuRef.current.contains(event.target) && switcherRef.current && !switcherRef.current.contains(event.target)) {
|
|
532
493
|
closeMenu();
|
|
@@ -537,125 +498,161 @@ export default function Header(_ref) {
|
|
|
537
498
|
// If any of the actions are using stopPropagation(), the event will stop in the react mounting root.
|
|
538
499
|
// So use capture phase to detect anything clicked.
|
|
539
500
|
document.addEventListener("click", handleClicked, true);
|
|
540
|
-
return
|
|
501
|
+
return () => {
|
|
541
502
|
// If menu closed, unregister event listener to prevent memory leaks
|
|
542
503
|
document.removeEventListener("click", handleClicked, true);
|
|
543
504
|
};
|
|
544
505
|
}, [toggleState, switcherRef]);
|
|
545
|
-
|
|
506
|
+
const onToggle = e => {
|
|
546
507
|
e.stopPropagation();
|
|
547
508
|
setToggle(!toggleState);
|
|
548
509
|
};
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
510
|
+
const component = /*#__PURE__*/_jsxs(_Fragment, {
|
|
511
|
+
children: [/*#__PURE__*/_jsx(MobileNavToggle, {
|
|
512
|
+
type: "checkbox",
|
|
513
|
+
checked: mobileMenuIsOpen,
|
|
514
|
+
defaultChecked: mobileMenuIsOpen,
|
|
515
|
+
id: navToggleId
|
|
516
|
+
}), /*#__PURE__*/_jsxs(Bar, {
|
|
517
|
+
theme: theme,
|
|
518
|
+
dataTestId: dataTestId,
|
|
519
|
+
variant: variant,
|
|
520
|
+
children: [/*#__PURE__*/_jsxs(Flex, {
|
|
521
|
+
alignItems: "center",
|
|
522
|
+
children: [appSwitcher && /*#__PURE__*/_jsxs(_Fragment, {
|
|
523
|
+
children: [/*#__PURE__*/_jsxs(Switcher, {
|
|
524
|
+
title: "Switch to...",
|
|
525
|
+
onClick: onToggle,
|
|
526
|
+
"aria-role": "navigation",
|
|
527
|
+
"aria-label": "Toggle workspace and app switcher menu",
|
|
528
|
+
ref: switcherRef,
|
|
529
|
+
children: [/*#__PURE__*/_jsx(SwitcherTopLeft, {}), /*#__PURE__*/_jsx(SwitcherTopMiddle, {}), /*#__PURE__*/_jsx(SwitcherTopRight, {}), /*#__PURE__*/_jsx(SwitcherMiddleLeft, {}), /*#__PURE__*/_jsx(SwitcherMiddleMiddle, {}), /*#__PURE__*/_jsx(SwitcherMiddleRight, {}), /*#__PURE__*/_jsx(SwitcherBottomLeft, {}), /*#__PURE__*/_jsx(SwitcherBottomMiddle, {}), /*#__PURE__*/_jsx(SwitcherBottomRight, {})]
|
|
530
|
+
}), /*#__PURE__*/_jsxs(AppsMenu, {
|
|
531
|
+
lightAppSwitcher: lightAppSwitcher,
|
|
532
|
+
isOpen: toggleState,
|
|
533
|
+
ref: menuRef,
|
|
534
|
+
children: [workspaceSwitcherContent && /*#__PURE__*/_jsxs(WorkspaceSwitcher, {
|
|
535
|
+
children: [/*#__PURE__*/_jsx(Small, {
|
|
536
|
+
color: lightAppSwitcher ? "black60" : "white60",
|
|
537
|
+
pb: "s",
|
|
538
|
+
display: "block",
|
|
539
|
+
children: "Change workspace:"
|
|
540
|
+
}), workspaceSwitcherContent]
|
|
541
|
+
}), internalAppSwitcherContent && /*#__PURE__*/_jsxs(InternalAppSwitcher, {
|
|
542
|
+
lightAppSwitcher: lightAppSwitcher,
|
|
543
|
+
children: [/*#__PURE__*/_jsx(Small, {
|
|
544
|
+
color: lightAppSwitcher ? "black60" : "white60",
|
|
545
|
+
pb: "xs",
|
|
546
|
+
display: "block",
|
|
547
|
+
children: "Switch to:"
|
|
548
|
+
}), internalAppSwitcherContent]
|
|
549
|
+
}), externalAppSwitcherContent && /*#__PURE__*/_jsxs(ExternalAppSwitcher, {
|
|
550
|
+
lightAppSwitcher: lightAppSwitcher,
|
|
551
|
+
children: [/*#__PURE__*/_jsx(Small, {
|
|
552
|
+
color: lightAppSwitcher ? "black60" : "white60",
|
|
553
|
+
pb: "xs",
|
|
554
|
+
display: "block",
|
|
555
|
+
children: "External apps:"
|
|
556
|
+
}), externalAppSwitcherContent]
|
|
557
|
+
})]
|
|
558
|
+
})]
|
|
559
|
+
}), logo && /*#__PURE__*/_jsx(FlexItem, {
|
|
560
|
+
children: logo
|
|
561
|
+
}), /*#__PURE__*/_jsxs(Flex, {
|
|
562
|
+
flexDirection: "column",
|
|
563
|
+
justifyContent: "center",
|
|
564
|
+
children: [/*#__PURE__*/_jsx(AppName, {
|
|
565
|
+
variant: variant,
|
|
566
|
+
children: appName
|
|
567
|
+
}), currentWorkspace && /*#__PURE__*/_jsx(Small, {
|
|
568
|
+
color: "white",
|
|
569
|
+
fontSize: "0",
|
|
570
|
+
display: ["none", "none", "none", "block"],
|
|
571
|
+
children: currentWorkspace
|
|
572
|
+
})]
|
|
573
|
+
})]
|
|
574
|
+
}), /*#__PURE__*/_jsx(Spacer, {
|
|
575
|
+
ml: 4,
|
|
576
|
+
children: children
|
|
577
|
+
}), searchComponent && /*#__PURE__*/_jsx(SearchContainer, {
|
|
578
|
+
variant: variant,
|
|
579
|
+
children: searchComponent
|
|
580
|
+
}), /*#__PURE__*/_jsxs(Flex, {
|
|
581
|
+
alignItems: "center",
|
|
582
|
+
ml: "auto",
|
|
583
|
+
children: [rightAlignedContent && /*#__PURE__*/_jsx(RightAligned, {
|
|
584
|
+
children: rightAlignedContent
|
|
585
|
+
}), /*#__PURE__*/_jsx(FlexItem, {
|
|
586
|
+
flex: "1 0 auto",
|
|
587
|
+
mr: "r",
|
|
588
|
+
display: ["none", "none", "none", "none", "flex"],
|
|
589
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
590
|
+
type: "inverted",
|
|
591
|
+
sizing: "small",
|
|
592
|
+
title: userName,
|
|
593
|
+
image: avatarSource,
|
|
594
|
+
theme: theme
|
|
595
|
+
})
|
|
596
|
+
}), /*#__PURE__*/_jsx(MobileMenuToggle, {
|
|
597
|
+
theme: theme,
|
|
598
|
+
onClick: toggleMobileMenu,
|
|
599
|
+
"aria-expanded": "".concat(mobileMenuIsOpen),
|
|
600
|
+
"aria-label": "Menu",
|
|
601
|
+
children: /*#__PURE__*/_jsx(Hamburger, {
|
|
602
|
+
id: "hamburger-menu-icon"
|
|
603
|
+
})
|
|
604
|
+
})]
|
|
605
|
+
})]
|
|
606
|
+
}), /*#__PURE__*/_jsx(MobileNavMenu, {
|
|
607
|
+
isOpen: mobileMenuIsOpen,
|
|
608
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
609
|
+
m: "s",
|
|
610
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
611
|
+
borderBottomWidth: 1,
|
|
612
|
+
borderBottomStyle: "solid",
|
|
613
|
+
borderBottomColor: "white20",
|
|
614
|
+
pt: "s",
|
|
615
|
+
pb: "r",
|
|
616
|
+
mb: "s",
|
|
617
|
+
display: ["block", "block", "block", "block", "none"],
|
|
618
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
619
|
+
type: "inverted",
|
|
620
|
+
sizing: "small",
|
|
621
|
+
title: userName,
|
|
622
|
+
image: avatarSource,
|
|
623
|
+
theme: theme
|
|
624
|
+
})
|
|
625
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
626
|
+
display: ["block", "block", "block", "none", "none"],
|
|
627
|
+
children: children
|
|
628
|
+
}), sideMenuContent, logoutFunction && /*#__PURE__*/_jsxs(StyledLink, {
|
|
629
|
+
id: "logoutButton",
|
|
630
|
+
white: true,
|
|
631
|
+
bold: true,
|
|
632
|
+
onClick: logoutFunction,
|
|
633
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
634
|
+
icon: ["fas", "lock"],
|
|
635
|
+
colour: "white",
|
|
636
|
+
mr: "s"
|
|
637
|
+
}), "Logout"]
|
|
638
|
+
}), themeSwitcherContent && /*#__PURE__*/_jsxs(Theme, {
|
|
639
|
+
children: [/*#__PURE__*/_jsx(Small, {
|
|
640
|
+
color: "white60",
|
|
641
|
+
pt: "s",
|
|
642
|
+
pb: "r",
|
|
643
|
+
display: "block",
|
|
644
|
+
children: "Switch theme:"
|
|
645
|
+
}), themeSwitcherContent]
|
|
646
|
+
})]
|
|
647
|
+
})
|
|
648
|
+
}), /*#__PURE__*/_jsx(Overlay, {
|
|
649
|
+
htmlFor: navToggleId
|
|
650
|
+
})]
|
|
651
|
+
});
|
|
652
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
613
653
|
theme: theme,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
"aria-label": "Menu"
|
|
617
|
-
}, /*#__PURE__*/React.createElement(Hamburger, {
|
|
618
|
-
id: "hamburger-menu-icon"
|
|
619
|
-
})))), /*#__PURE__*/React.createElement(MobileNavMenu, {
|
|
620
|
-
isOpen: mobileMenuIsOpen
|
|
621
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
622
|
-
m: "s"
|
|
623
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
624
|
-
borderBottomWidth: 1,
|
|
625
|
-
borderBottomStyle: "solid",
|
|
626
|
-
borderBottomColor: "white20",
|
|
627
|
-
pt: "s",
|
|
628
|
-
pb: "r",
|
|
629
|
-
mb: "s",
|
|
630
|
-
display: ["block", "block", "block", "block", "none"]
|
|
631
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
632
|
-
type: "inverted",
|
|
633
|
-
sizing: "small",
|
|
634
|
-
title: userName,
|
|
635
|
-
image: avatarSource,
|
|
636
|
-
theme: theme
|
|
637
|
-
})), /*#__PURE__*/React.createElement(Box, {
|
|
638
|
-
display: ["block", "block", "block", "none", "none"]
|
|
639
|
-
}, children), sideMenuContent, logoutFunction && /*#__PURE__*/React.createElement(StyledLink, {
|
|
640
|
-
id: "logoutButton",
|
|
641
|
-
white: true,
|
|
642
|
-
bold: true,
|
|
643
|
-
onClick: logoutFunction
|
|
644
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
645
|
-
icon: ["fas", "lock"],
|
|
646
|
-
colour: "white",
|
|
647
|
-
mr: "s"
|
|
648
|
-
}), "Logout"), themeSwitcherContent && /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(Small, {
|
|
649
|
-
color: "white60",
|
|
650
|
-
pt: "s",
|
|
651
|
-
pb: "r",
|
|
652
|
-
display: "block"
|
|
653
|
-
}, "Switch theme:"), themeSwitcherContent))), /*#__PURE__*/React.createElement(Overlay, {
|
|
654
|
-
htmlFor: navToggleId
|
|
655
|
-
}));
|
|
656
|
-
return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
657
|
-
theme: theme
|
|
658
|
-
}, component) : component;
|
|
654
|
+
children: component
|
|
655
|
+
}) : component;
|
|
659
656
|
}
|
|
660
657
|
Header.propTypes = {
|
|
661
658
|
/** Logo for app. Preferably an svg logo */
|