@equinor/cpl-top-bar-react 0.4.0 → 0.5.0
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/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +143 -98
- package/dist/index.mjs +142 -98
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,12 @@ interface FeedbackLinkProps {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function FeedbackLink({ link, subject, body }: FeedbackLinkProps): react_jsx_runtime.JSX.Element;
|
|
18
18
|
|
|
19
|
+
type MenuHeaderProps = {
|
|
20
|
+
appName: string;
|
|
21
|
+
icon: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
declare function MenuHeader({ appName, icon }: MenuHeaderProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
19
25
|
type AppUrls = {
|
|
20
26
|
[appName: string]: {
|
|
21
27
|
dev: string;
|
|
@@ -47,8 +53,12 @@ type SideMenuProps = {
|
|
|
47
53
|
otherMenuItems?: MenuItems[];
|
|
48
54
|
logoElement?: JSX.Element;
|
|
49
55
|
versionInfo?: React__default.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* supports next/link and react-router-dom, will default to using a regular anchor-element if not provided
|
|
58
|
+
*/
|
|
59
|
+
linkComponent?: React__default.ElementType;
|
|
50
60
|
};
|
|
51
|
-
declare function SideMenu({ isOpen, onToggle, mainMenuItems, logoElement, versionInfo, currentEnvironment, titleOtherMenuItems, otherMenuItems, appUrls, }: SideMenuProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
declare function SideMenu({ isOpen, onToggle, mainMenuItems, logoElement, versionInfo, currentEnvironment, titleOtherMenuItems, otherMenuItems, appUrls, linkComponent, }: SideMenuProps): react_jsx_runtime.JSX.Element;
|
|
52
62
|
|
|
53
63
|
interface TopBarProps {
|
|
54
64
|
appName: string;
|
|
@@ -82,4 +92,4 @@ interface UserMenuProps {
|
|
|
82
92
|
}
|
|
83
93
|
declare function UserMenu({ user, logout, settingsLink, children }: UserMenuProps): react_jsx_runtime.JSX.Element;
|
|
84
94
|
|
|
85
|
-
export { FeedbackLink, SideMenu, StyledLink, TopBar, UserMenu };
|
|
95
|
+
export { type AppUrls, FeedbackLink, MenuHeader, SideMenu, StyledLink, TopBar, UserMenu };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ interface FeedbackLinkProps {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function FeedbackLink({ link, subject, body }: FeedbackLinkProps): react_jsx_runtime.JSX.Element;
|
|
18
18
|
|
|
19
|
+
type MenuHeaderProps = {
|
|
20
|
+
appName: string;
|
|
21
|
+
icon: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
declare function MenuHeader({ appName, icon }: MenuHeaderProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
19
25
|
type AppUrls = {
|
|
20
26
|
[appName: string]: {
|
|
21
27
|
dev: string;
|
|
@@ -47,8 +53,12 @@ type SideMenuProps = {
|
|
|
47
53
|
otherMenuItems?: MenuItems[];
|
|
48
54
|
logoElement?: JSX.Element;
|
|
49
55
|
versionInfo?: React__default.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* supports next/link and react-router-dom, will default to using a regular anchor-element if not provided
|
|
58
|
+
*/
|
|
59
|
+
linkComponent?: React__default.ElementType;
|
|
50
60
|
};
|
|
51
|
-
declare function SideMenu({ isOpen, onToggle, mainMenuItems, logoElement, versionInfo, currentEnvironment, titleOtherMenuItems, otherMenuItems, appUrls, }: SideMenuProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
declare function SideMenu({ isOpen, onToggle, mainMenuItems, logoElement, versionInfo, currentEnvironment, titleOtherMenuItems, otherMenuItems, appUrls, linkComponent, }: SideMenuProps): react_jsx_runtime.JSX.Element;
|
|
52
62
|
|
|
53
63
|
interface TopBarProps {
|
|
54
64
|
appName: string;
|
|
@@ -82,4 +92,4 @@ interface UserMenuProps {
|
|
|
82
92
|
}
|
|
83
93
|
declare function UserMenu({ user, logout, settingsLink, children }: UserMenuProps): react_jsx_runtime.JSX.Element;
|
|
84
94
|
|
|
85
|
-
export { FeedbackLink, SideMenu, StyledLink, TopBar, UserMenu };
|
|
95
|
+
export { type AppUrls, FeedbackLink, MenuHeader, SideMenu, StyledLink, TopBar, UserMenu };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
FeedbackLink: () => FeedbackLink,
|
|
34
|
+
MenuHeader: () => MenuHeader,
|
|
34
35
|
SideMenu: () => SideMenu,
|
|
35
36
|
StyledLink: () => StyledLink,
|
|
36
37
|
TopBar: () => TopBar,
|
|
@@ -135,24 +136,49 @@ function FeedbackLink({ link, subject, body }) {
|
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// src/SideMenu/components/MenuHeader.tsx
|
|
140
|
+
var import_eds_tokens2 = require("@equinor/eds-tokens");
|
|
141
|
+
var import_styled_components2 = require("styled-components");
|
|
142
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
143
|
+
function MenuHeader({ appName, icon }) {
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LogoWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(LogoStyle, { children: [
|
|
145
|
+
icon,
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: appName })
|
|
147
|
+
] }) });
|
|
148
|
+
}
|
|
149
|
+
var LogoWrapper = import_styled_components2.styled.div`
|
|
150
|
+
padding: 0 ${import_eds_tokens2.tokens.spacings.comfortable.medium} ${import_eds_tokens2.tokens.spacings.comfortable.small}
|
|
151
|
+
${import_eds_tokens2.tokens.spacings.comfortable.medium};
|
|
152
|
+
text-align: center;
|
|
153
|
+
font-weight: 500;
|
|
154
|
+
`;
|
|
155
|
+
var LogoStyle = import_styled_components2.styled.div`
|
|
156
|
+
align-items: center;
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
gap: ${import_eds_tokens2.tokens.spacings.comfortable.small};
|
|
160
|
+
justify-content: center;
|
|
161
|
+
text-align: center;
|
|
162
|
+
`;
|
|
163
|
+
|
|
138
164
|
// src/SideMenu/SideMenu.tsx
|
|
139
165
|
var import_eds_core_react5 = require("@equinor/eds-core-react");
|
|
140
166
|
var import_eds_icons4 = require("@equinor/eds-icons");
|
|
141
|
-
var
|
|
167
|
+
var import_eds_tokens5 = require("@equinor/eds-tokens");
|
|
142
168
|
var import_react = require("react");
|
|
143
|
-
var
|
|
169
|
+
var import_styled_components5 = __toESM(require("styled-components"));
|
|
144
170
|
|
|
145
171
|
// src/SideMenu/components/MenuList.tsx
|
|
146
172
|
var import_eds_core_react4 = require("@equinor/eds-core-react");
|
|
147
|
-
var
|
|
148
|
-
var
|
|
173
|
+
var import_eds_tokens4 = require("@equinor/eds-tokens");
|
|
174
|
+
var import_styled_components4 = require("styled-components");
|
|
149
175
|
|
|
150
176
|
// src/SideMenu/components/MenuLink.tsx
|
|
151
177
|
var import_eds_core_react3 = require("@equinor/eds-core-react");
|
|
152
178
|
var import_eds_icons3 = require("@equinor/eds-icons");
|
|
153
|
-
var
|
|
179
|
+
var import_eds_tokens3 = require("@equinor/eds-tokens");
|
|
154
180
|
var import_navigation = require("next/navigation");
|
|
155
|
-
var
|
|
181
|
+
var import_styled_components3 = require("styled-components");
|
|
156
182
|
|
|
157
183
|
// src/SideMenu/useAppUrlByNameAndEnvironment.ts
|
|
158
184
|
function useAppUrlByNameAndEnvironment(appName, currentEnvironment, appUrls) {
|
|
@@ -166,7 +192,7 @@ function useAppUrlByNameAndEnvironment(appName, currentEnvironment, appUrls) {
|
|
|
166
192
|
}
|
|
167
193
|
|
|
168
194
|
// src/SideMenu/components/MenuLink.tsx
|
|
169
|
-
var
|
|
195
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
170
196
|
function MenuLink({
|
|
171
197
|
item,
|
|
172
198
|
environment,
|
|
@@ -178,15 +204,15 @@ function MenuLink({
|
|
|
178
204
|
const url = (_b = item == null ? void 0 : item.url) != null ? _b : urlByNameAndEnvironment;
|
|
179
205
|
const pathName = (0, import_navigation.usePathname)();
|
|
180
206
|
let isActive = !item.external && pathName == item.url;
|
|
181
|
-
const linkContent = /* @__PURE__ */ (0,
|
|
207
|
+
const linkContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
182
208
|
item.name,
|
|
183
|
-
item.external && /* @__PURE__ */ (0,
|
|
209
|
+
item.external && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_eds_core_react3.Icon, { data: import_eds_icons3.external_link, size: 16 })
|
|
184
210
|
] });
|
|
185
211
|
if (item.external) {
|
|
186
|
-
return /* @__PURE__ */ (0,
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledLink2, { href: url, target: "_blank", rel: "noopener noreferrer", children: linkContent });
|
|
187
213
|
}
|
|
188
214
|
if (LinkComponent) {
|
|
189
|
-
return /* @__PURE__ */ (0,
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
190
216
|
StyledLink2,
|
|
191
217
|
{
|
|
192
218
|
as: LinkComponent,
|
|
@@ -198,16 +224,17 @@ function MenuLink({
|
|
|
198
224
|
);
|
|
199
225
|
}
|
|
200
226
|
isActive = typeof window !== "undefined" ? window.location.pathname === item.url : false;
|
|
201
|
-
return /* @__PURE__ */ (0,
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledLink2, { href: url, $active: isActive, children: linkContent });
|
|
202
228
|
}
|
|
203
|
-
var StyledLink2 =
|
|
229
|
+
var StyledLink2 = import_styled_components3.styled.a`
|
|
204
230
|
text-decoration: none;
|
|
205
231
|
padding: 12px 16px 12px 19px;
|
|
206
232
|
display: inline-block;
|
|
207
233
|
width: 100%;
|
|
208
|
-
color: ${
|
|
209
|
-
background-color: ${({ $active }) => $active ?
|
|
234
|
+
color: ${import_eds_tokens3.tokens.colors.interactive.secondary__resting.rgba};
|
|
235
|
+
background-color: ${({ $active }) => $active ? import_eds_tokens3.tokens.colors.interactive.primary__selected_highlight.rgba : "transparent"};
|
|
210
236
|
font-weight: ${({ $active }) => $active ? 700 : 400};
|
|
237
|
+
font-size: 0.875rem;
|
|
211
238
|
|
|
212
239
|
&:hover {
|
|
213
240
|
//TODO: check hover color for dark theme with designer when back
|
|
@@ -217,50 +244,69 @@ var StyledLink2 = import_styled_components2.styled.a`
|
|
|
217
244
|
&:focus-visible {
|
|
218
245
|
outline-offset: -2px;
|
|
219
246
|
}
|
|
247
|
+
|
|
248
|
+
span {
|
|
249
|
+
align-items: center;
|
|
250
|
+
display: flex;
|
|
251
|
+
gap: 1rem;
|
|
252
|
+
justify-content: space-between;
|
|
253
|
+
font-size: 0.875rem;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
span svg {
|
|
257
|
+
opacity: 60%;
|
|
258
|
+
}
|
|
220
259
|
`;
|
|
221
260
|
|
|
222
261
|
// src/SideMenu/components/MenuList.tsx
|
|
223
|
-
var
|
|
224
|
-
function MenuList({
|
|
225
|
-
|
|
262
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
263
|
+
function MenuList({
|
|
264
|
+
items,
|
|
265
|
+
currentEnvironment,
|
|
266
|
+
appUrls,
|
|
267
|
+
onToggleMenuGroup,
|
|
268
|
+
linkComponent
|
|
269
|
+
}) {
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: items.map((menuItem) => {
|
|
226
271
|
if (isMenuItemGroup(menuItem)) {
|
|
227
|
-
return /* @__PURE__ */ (0,
|
|
228
|
-
/* @__PURE__ */ (0,
|
|
229
|
-
/* @__PURE__ */ (0,
|
|
272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react4.Accordion, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AccordionItem, { isExpanded: menuItem.isExpanded, children: [
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react4.Accordion.Header, { onToggle: onToggleMenuGroup, children: menuItem.title }),
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react4.Accordion.Panel, { "aria-label": `Links for ${menuItem.title}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: menuItem.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
230
275
|
MenuLink,
|
|
231
276
|
{
|
|
232
277
|
item,
|
|
233
278
|
environment: currentEnvironment,
|
|
234
|
-
appUrls
|
|
279
|
+
appUrls,
|
|
280
|
+
linkComponent
|
|
235
281
|
}
|
|
236
282
|
) }, menuItem.title + "-" + item.name)) }) })
|
|
237
283
|
] }, menuItem.title) }, menuItem.title) }, menuItem.title);
|
|
238
284
|
} else {
|
|
239
|
-
return /* @__PURE__ */ (0,
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
286
|
+
MenuLink,
|
|
287
|
+
{
|
|
288
|
+
item: menuItem,
|
|
289
|
+
environment: currentEnvironment,
|
|
290
|
+
appUrls,
|
|
291
|
+
linkComponent
|
|
292
|
+
}
|
|
293
|
+
) }, menuItem.name);
|
|
240
294
|
}
|
|
241
295
|
}) });
|
|
242
296
|
}
|
|
243
297
|
function isMenuItemGroup(item) {
|
|
244
298
|
return typeof item === "object" && "title" in item && "items" in item;
|
|
245
299
|
}
|
|
246
|
-
var AccordionItem = (0,
|
|
300
|
+
var AccordionItem = (0, import_styled_components4.styled)(import_eds_core_react4.Accordion.Item)`
|
|
247
301
|
a {
|
|
248
302
|
display: block;
|
|
249
|
-
padding: 12px ${
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
a span {
|
|
253
|
-
align-items: center;
|
|
254
|
-
display: flex;
|
|
255
|
-
gap: 1rem;
|
|
256
|
-
justify-content: space-between;
|
|
257
|
-
font-size: 0.875rem;
|
|
303
|
+
padding: 12px ${import_eds_tokens4.tokens.spacings.comfortable.medium} 12px ${import_eds_tokens4.tokens.spacings.comfortable.x_large};
|
|
258
304
|
}
|
|
259
305
|
|
|
260
306
|
h2 {
|
|
261
307
|
background: transparent;
|
|
262
308
|
border: 0;
|
|
263
|
-
color: ${
|
|
309
|
+
color: ${import_eds_tokens4.tokens.colors.interactive.secondary__resting.rgba};
|
|
264
310
|
}
|
|
265
311
|
|
|
266
312
|
h2 + div {
|
|
@@ -273,13 +319,13 @@ var AccordionItem = (0, import_styled_components3.styled)(import_eds_core_react4
|
|
|
273
319
|
h2 button svg {
|
|
274
320
|
width: 14px;
|
|
275
321
|
height: 14px;
|
|
276
|
-
margin-right: ${
|
|
322
|
+
margin-right: ${import_eds_tokens4.tokens.spacings.comfortable.x_small};
|
|
277
323
|
transform: rotate(-90deg);
|
|
278
|
-
fill: ${
|
|
324
|
+
fill: ${import_eds_tokens4.tokens.colors.interactive.secondary__resting.rgba};
|
|
279
325
|
}
|
|
280
326
|
|
|
281
327
|
h2 button span {
|
|
282
|
-
color: ${
|
|
328
|
+
color: ${import_eds_tokens4.tokens.colors.interactive.secondary__resting.rgba};
|
|
283
329
|
font-weight: 700;
|
|
284
330
|
font-size: 0.875rem;
|
|
285
331
|
}
|
|
@@ -288,10 +334,6 @@ var AccordionItem = (0, import_styled_components3.styled)(import_eds_core_react4
|
|
|
288
334
|
transform: rotate(180deg);
|
|
289
335
|
}
|
|
290
336
|
|
|
291
|
-
li a svg {
|
|
292
|
-
opacity: 60%;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
337
|
h2 button:hover,
|
|
296
338
|
li a:hover {
|
|
297
339
|
background-color: var(--cpl-sidebar-hover-color);
|
|
@@ -303,7 +345,7 @@ var AccordionItem = (0, import_styled_components3.styled)(import_eds_core_react4
|
|
|
303
345
|
`;
|
|
304
346
|
|
|
305
347
|
// src/SideMenu/SideMenu.tsx
|
|
306
|
-
var
|
|
348
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
307
349
|
function SideMenu({
|
|
308
350
|
isOpen,
|
|
309
351
|
onToggle,
|
|
@@ -313,7 +355,8 @@ function SideMenu({
|
|
|
313
355
|
currentEnvironment,
|
|
314
356
|
titleOtherMenuItems,
|
|
315
357
|
otherMenuItems,
|
|
316
|
-
appUrls
|
|
358
|
+
appUrls,
|
|
359
|
+
linkComponent
|
|
317
360
|
}) {
|
|
318
361
|
var _a;
|
|
319
362
|
const width = "268px";
|
|
@@ -347,46 +390,47 @@ function SideMenu({
|
|
|
347
390
|
return () => element.removeEventListener("scroll", handleScroll);
|
|
348
391
|
}
|
|
349
392
|
}, [handleScroll]);
|
|
350
|
-
return /* @__PURE__ */ (0,
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
352
|
-
/* @__PURE__ */ (0,
|
|
393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Sidebar, { $isOpen: isOpen, $width: isOpen ? width : "", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(InnerWrapper, { ref: containerRef, $width: width, children: [
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StickyCloseButton, { $showBorder: hasOverflow && scrolledDown, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
353
396
|
import_eds_core_react5.Button,
|
|
354
397
|
{
|
|
355
398
|
variant: "ghost_icon",
|
|
356
399
|
color: "secondary",
|
|
357
400
|
"aria-label": "Toggle side menu",
|
|
358
401
|
onClick: () => onToggle(!isOpen),
|
|
359
|
-
children: /* @__PURE__ */ (0,
|
|
402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react5.Icon, { data: import_eds_icons4.collapse, size: 24 })
|
|
360
403
|
}
|
|
361
404
|
) }),
|
|
362
405
|
logoElement,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
364
|
-
/* @__PURE__ */ (0,
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("nav", { children: [
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
365
408
|
MenuList,
|
|
366
409
|
{
|
|
367
410
|
items: mainMenuItems,
|
|
368
411
|
currentEnvironment,
|
|
369
412
|
appUrls,
|
|
370
|
-
onToggleMenuGroup: checkOverflow
|
|
413
|
+
onToggleMenuGroup: checkOverflow,
|
|
414
|
+
linkComponent
|
|
371
415
|
}
|
|
372
416
|
),
|
|
373
|
-
otherMenuItems && otherMenuItems.length > 0 && /* @__PURE__ */ (0,
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
376
|
-
/* @__PURE__ */ (0,
|
|
417
|
+
otherMenuItems && otherMenuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledDivider, {}),
|
|
419
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
377
421
|
import_eds_core_react5.Typography,
|
|
378
422
|
{
|
|
379
423
|
variant: "label",
|
|
380
424
|
group: "navigation",
|
|
381
425
|
as: "h2",
|
|
382
426
|
style: {
|
|
383
|
-
color:
|
|
427
|
+
color: import_eds_tokens5.tokens.colors.interactive.secondary__resting.rgba,
|
|
384
428
|
padding: "12px 19px 4px 19px"
|
|
385
429
|
},
|
|
386
430
|
children: (_a = titleOtherMenuItems == null ? void 0 : titleOtherMenuItems.toUpperCase()) != null ? _a : "OTHER SOLUTIONS"
|
|
387
431
|
}
|
|
388
432
|
),
|
|
389
|
-
/* @__PURE__ */ (0,
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
390
434
|
MenuList,
|
|
391
435
|
{
|
|
392
436
|
items: otherMenuItems,
|
|
@@ -398,17 +442,17 @@ function SideMenu({
|
|
|
398
442
|
] })
|
|
399
443
|
] })
|
|
400
444
|
] }),
|
|
401
|
-
/* @__PURE__ */ (0,
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledDivider, {})
|
|
402
446
|
] }),
|
|
403
447
|
versionInfo
|
|
404
448
|
] }) });
|
|
405
449
|
}
|
|
406
|
-
var StyledDivider = (0,
|
|
450
|
+
var StyledDivider = (0, import_styled_components5.default)(import_eds_core_react5.Divider)`
|
|
407
451
|
background-color: var(--cpl-divider-color);
|
|
408
452
|
margin: 8px 0;
|
|
409
453
|
`;
|
|
410
|
-
var Sidebar =
|
|
411
|
-
width: ${(props) => props.$isOpen ? props
|
|
454
|
+
var Sidebar = import_styled_components5.default.div`
|
|
455
|
+
width: ${(props) => props.$isOpen ? props.$width : "0px"};
|
|
412
456
|
opacity: ${(props) => props.$isOpen ? 1 : 0};
|
|
413
457
|
transition:
|
|
414
458
|
width 0.5s,
|
|
@@ -430,12 +474,12 @@ var Sidebar = import_styled_components4.default.div`
|
|
|
430
474
|
box-sizing: border-box;
|
|
431
475
|
}
|
|
432
476
|
`;
|
|
433
|
-
var InnerWrapper =
|
|
477
|
+
var InnerWrapper = import_styled_components5.default.div`
|
|
434
478
|
overflow: auto;
|
|
435
479
|
background: var(--cpl-ui-background-temporary-nav);
|
|
436
480
|
padding: 0;
|
|
437
481
|
height: 100%;
|
|
438
|
-
width: ${(props) => props
|
|
482
|
+
width: ${(props) => props.$width};
|
|
439
483
|
position: fixed;
|
|
440
484
|
display: flex;
|
|
441
485
|
flex-direction: column;
|
|
@@ -443,13 +487,13 @@ var InnerWrapper = import_styled_components4.default.div`
|
|
|
443
487
|
border-right: 1px solid var(--cpl-sidebar-border-color);
|
|
444
488
|
border-bottom: 1px solid var(--cpl-sidebar-border-color);
|
|
445
489
|
`;
|
|
446
|
-
var StickyCloseButton =
|
|
490
|
+
var StickyCloseButton = import_styled_components5.default.div`
|
|
447
491
|
z-index: 10;
|
|
448
492
|
position: sticky;
|
|
449
493
|
top: 0;
|
|
450
494
|
display: flex;
|
|
451
495
|
justify-content: flex-end;
|
|
452
|
-
padding: ${
|
|
496
|
+
padding: ${import_eds_tokens5.tokens.spacings.comfortable.xx_small};
|
|
453
497
|
background-color: var(--cpl-ui-background-temporary-nav);
|
|
454
498
|
border-bottom: ${({ $showBorder }) => $showBorder ? "1px solid var(--cpl-divider-color)" : "0"};
|
|
455
499
|
`;
|
|
@@ -457,10 +501,10 @@ var StickyCloseButton = import_styled_components4.default.div`
|
|
|
457
501
|
// src/UserMenu/UserMenu.tsx
|
|
458
502
|
var import_eds_core_react6 = require("@equinor/eds-core-react");
|
|
459
503
|
var import_eds_icons5 = require("@equinor/eds-icons");
|
|
460
|
-
var
|
|
504
|
+
var import_eds_tokens6 = require("@equinor/eds-tokens");
|
|
461
505
|
var import_react2 = require("react");
|
|
462
|
-
var
|
|
463
|
-
var
|
|
506
|
+
var import_styled_components6 = __toESM(require("styled-components"));
|
|
507
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
464
508
|
function UserMenu({ user, logout, settingsLink, children }) {
|
|
465
509
|
var _a, _b, _c, _d, _e;
|
|
466
510
|
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
@@ -473,20 +517,20 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
473
517
|
};
|
|
474
518
|
const LogOutMenuItem = () => {
|
|
475
519
|
if (typeof logout === "string") {
|
|
476
|
-
return /* @__PURE__ */ (0,
|
|
477
|
-
/* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_eds_core_react6.Menu.Item, { as: "a", href: logout, className: "menu-item", id: "logout-button", children: [
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons5.log_out }),
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Log out" })
|
|
479
523
|
] });
|
|
480
524
|
} else {
|
|
481
|
-
return /* @__PURE__ */ (0,
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
483
|
-
/* @__PURE__ */ (0,
|
|
525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_eds_core_react6.Menu.Item, { as: "button", onClick: logout, className: "menu-item", id: "logout-button", children: [
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons5.log_out }),
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Log out" })
|
|
484
528
|
] });
|
|
485
529
|
}
|
|
486
530
|
};
|
|
487
531
|
const firstLetter = (_c = (_b = (_a = user == null ? void 0 : user.email) == null ? void 0 : _a[0]) == null ? void 0 : _b.toUpperCase()) != null ? _c : "-";
|
|
488
|
-
return /* @__PURE__ */ (0,
|
|
489
|
-
/* @__PURE__ */ (0,
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
490
534
|
StyledUserButton,
|
|
491
535
|
{
|
|
492
536
|
id: "user-button",
|
|
@@ -499,7 +543,7 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
499
543
|
children: firstLetter
|
|
500
544
|
}
|
|
501
545
|
),
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
503
547
|
MenuWrapper,
|
|
504
548
|
{
|
|
505
549
|
id: "user-menu",
|
|
@@ -509,16 +553,16 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
509
553
|
anchorEl,
|
|
510
554
|
style: { padding: 0, paddingBottom: 2 },
|
|
511
555
|
children: [
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
513
|
-
/* @__PURE__ */ (0,
|
|
514
|
-
isOpen && /* @__PURE__ */ (0,
|
|
515
|
-
/* @__PURE__ */ (0,
|
|
516
|
-
/* @__PURE__ */ (0,
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(IconAndTextWrapper, { children: [
|
|
557
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LetterCircle, { children: firstLetter }),
|
|
558
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { fontWeight: "bold", lineHeight: 0.9, marginBottom: 2 }, children: (_d = user == null ? void 0 : user.name) != null ? _d : "-" }),
|
|
560
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: (_e = user == null ? void 0 : user.email) != null ? _e : "-" })
|
|
517
561
|
] })
|
|
518
562
|
] }),
|
|
519
|
-
settingsLink && /* @__PURE__ */ (0,
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
521
|
-
/* @__PURE__ */ (0,
|
|
563
|
+
settingsLink && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_eds_core_react6.Menu.Item, { as: "a", href: settingsLink, className: "menu-item", children: [
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons5.settings }),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Settings" })
|
|
522
566
|
] }),
|
|
523
567
|
LogOutMenuItem(),
|
|
524
568
|
children
|
|
@@ -527,25 +571,25 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
527
571
|
)
|
|
528
572
|
] });
|
|
529
573
|
}
|
|
530
|
-
var MenuWrapper = (0,
|
|
531
|
-
border-radius: ${
|
|
532
|
-
margin-top: ${
|
|
533
|
-
margin-bottom: -${
|
|
534
|
-
padding-bottom: ${
|
|
574
|
+
var MenuWrapper = (0, import_styled_components6.default)(import_eds_core_react6.Menu)`
|
|
575
|
+
border-radius: ${import_eds_tokens6.tokens.shape.corners.borderRadius};
|
|
576
|
+
margin-top: ${import_eds_tokens6.tokens.spacings.comfortable.small};
|
|
577
|
+
margin-bottom: -${import_eds_tokens6.tokens.spacings.comfortable.small};
|
|
578
|
+
padding-bottom: ${import_eds_tokens6.tokens.spacings.comfortable.small};
|
|
535
579
|
padding-left: 0;
|
|
536
580
|
padding-right: 0;
|
|
537
|
-
padding-top: ${
|
|
581
|
+
padding-top: ${import_eds_tokens6.tokens.spacings.comfortable.small};
|
|
538
582
|
width: 315px;
|
|
539
583
|
|
|
540
584
|
background: var(--cpl-ui-background-temporary-nav, #fff);
|
|
541
|
-
color: ${
|
|
585
|
+
color: ${import_eds_tokens6.tokens.colors.text.static_icons__default.rgba};
|
|
542
586
|
|
|
543
587
|
.menu-item {
|
|
544
588
|
align-items: center;
|
|
545
589
|
display: flex;
|
|
546
|
-
gap: ${
|
|
590
|
+
gap: ${import_eds_tokens6.tokens.spacings.comfortable.medium};
|
|
547
591
|
opacity: 0.85;
|
|
548
|
-
padding: ${
|
|
592
|
+
padding: ${import_eds_tokens6.tokens.spacings.comfortable.small} ${import_eds_tokens6.tokens.spacings.comfortable.large};
|
|
549
593
|
|
|
550
594
|
svg {
|
|
551
595
|
opacity: 0.7;
|
|
@@ -560,7 +604,7 @@ var MenuWrapper = (0, import_styled_components5.default)(import_eds_core_react6.
|
|
|
560
604
|
}
|
|
561
605
|
}
|
|
562
606
|
`;
|
|
563
|
-
var LetterCircle =
|
|
607
|
+
var LetterCircle = import_styled_components6.default.span`
|
|
564
608
|
align-items: center;
|
|
565
609
|
border-radius: 1000px;
|
|
566
610
|
display: flex;
|
|
@@ -569,16 +613,16 @@ var LetterCircle = import_styled_components5.default.span`
|
|
|
569
613
|
height: 32px;
|
|
570
614
|
justify-content: center;
|
|
571
615
|
width: 32px;
|
|
572
|
-
background-color: ${
|
|
573
|
-
color: ${
|
|
616
|
+
background-color: ${import_eds_tokens6.tokens.colors.interactive.primary__resting.rgba};
|
|
617
|
+
color: ${import_eds_tokens6.tokens.colors.text.static_icons__primary_white.rgba};
|
|
574
618
|
`;
|
|
575
|
-
var StyledUserButton = (0,
|
|
619
|
+
var StyledUserButton = (0, import_styled_components6.default)(import_eds_core_react6.Button)`
|
|
576
620
|
margin-left: 12px;
|
|
577
621
|
font-weight: bold;
|
|
578
622
|
width: 32px;
|
|
579
623
|
height: 32px;
|
|
580
624
|
`;
|
|
581
|
-
var IconAndTextWrapper = (0,
|
|
625
|
+
var IconAndTextWrapper = (0, import_styled_components6.default)(import_eds_core_react6.Menu.Item)`
|
|
582
626
|
display: flex;
|
|
583
627
|
gap: 12px;
|
|
584
628
|
padding: 12px 20px;
|
|
@@ -594,6 +638,7 @@ var IconAndTextWrapper = (0, import_styled_components5.default)(import_eds_core_
|
|
|
594
638
|
// Annotate the CommonJS export names for ESM import in node:
|
|
595
639
|
0 && (module.exports = {
|
|
596
640
|
FeedbackLink,
|
|
641
|
+
MenuHeader,
|
|
597
642
|
SideMenu,
|
|
598
643
|
StyledLink,
|
|
599
644
|
TopBar,
|
package/dist/index.mjs
CHANGED
|
@@ -95,24 +95,49 @@ function FeedbackLink({ link, subject, body }) {
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// src/SideMenu/components/MenuHeader.tsx
|
|
99
|
+
import { tokens as tokens2 } from "@equinor/eds-tokens";
|
|
100
|
+
import { styled as styled2 } from "styled-components";
|
|
101
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
102
|
+
function MenuHeader({ appName, icon }) {
|
|
103
|
+
return /* @__PURE__ */ jsx3(LogoWrapper, { children: /* @__PURE__ */ jsxs3(LogoStyle, { children: [
|
|
104
|
+
icon,
|
|
105
|
+
/* @__PURE__ */ jsx3("span", { children: appName })
|
|
106
|
+
] }) });
|
|
107
|
+
}
|
|
108
|
+
var LogoWrapper = styled2.div`
|
|
109
|
+
padding: 0 ${tokens2.spacings.comfortable.medium} ${tokens2.spacings.comfortable.small}
|
|
110
|
+
${tokens2.spacings.comfortable.medium};
|
|
111
|
+
text-align: center;
|
|
112
|
+
font-weight: 500;
|
|
113
|
+
`;
|
|
114
|
+
var LogoStyle = styled2.div`
|
|
115
|
+
align-items: center;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: ${tokens2.spacings.comfortable.small};
|
|
119
|
+
justify-content: center;
|
|
120
|
+
text-align: center;
|
|
121
|
+
`;
|
|
122
|
+
|
|
98
123
|
// src/SideMenu/SideMenu.tsx
|
|
99
124
|
import { Button as Button2, Divider, Icon as Icon4, Typography as Typography2 } from "@equinor/eds-core-react";
|
|
100
125
|
import { collapse } from "@equinor/eds-icons";
|
|
101
|
-
import { tokens as
|
|
126
|
+
import { tokens as tokens5 } from "@equinor/eds-tokens";
|
|
102
127
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
103
|
-
import
|
|
128
|
+
import styled5 from "styled-components";
|
|
104
129
|
|
|
105
130
|
// src/SideMenu/components/MenuList.tsx
|
|
106
131
|
import { Accordion } from "@equinor/eds-core-react";
|
|
107
|
-
import { tokens as
|
|
108
|
-
import { styled as
|
|
132
|
+
import { tokens as tokens4 } from "@equinor/eds-tokens";
|
|
133
|
+
import { styled as styled4 } from "styled-components";
|
|
109
134
|
|
|
110
135
|
// src/SideMenu/components/MenuLink.tsx
|
|
111
136
|
import { Icon as Icon3 } from "@equinor/eds-core-react";
|
|
112
137
|
import { external_link as external_link2 } from "@equinor/eds-icons";
|
|
113
|
-
import { tokens as
|
|
138
|
+
import { tokens as tokens3 } from "@equinor/eds-tokens";
|
|
114
139
|
import { usePathname } from "next/navigation";
|
|
115
|
-
import { styled as
|
|
140
|
+
import { styled as styled3 } from "styled-components";
|
|
116
141
|
|
|
117
142
|
// src/SideMenu/useAppUrlByNameAndEnvironment.ts
|
|
118
143
|
function useAppUrlByNameAndEnvironment(appName, currentEnvironment, appUrls) {
|
|
@@ -126,7 +151,7 @@ function useAppUrlByNameAndEnvironment(appName, currentEnvironment, appUrls) {
|
|
|
126
151
|
}
|
|
127
152
|
|
|
128
153
|
// src/SideMenu/components/MenuLink.tsx
|
|
129
|
-
import { jsx as
|
|
154
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
130
155
|
function MenuLink({
|
|
131
156
|
item,
|
|
132
157
|
environment,
|
|
@@ -138,15 +163,15 @@ function MenuLink({
|
|
|
138
163
|
const url = (_b = item == null ? void 0 : item.url) != null ? _b : urlByNameAndEnvironment;
|
|
139
164
|
const pathName = usePathname();
|
|
140
165
|
let isActive = !item.external && pathName == item.url;
|
|
141
|
-
const linkContent = /* @__PURE__ */
|
|
166
|
+
const linkContent = /* @__PURE__ */ jsxs4("span", { children: [
|
|
142
167
|
item.name,
|
|
143
|
-
item.external && /* @__PURE__ */
|
|
168
|
+
item.external && /* @__PURE__ */ jsx4(Icon3, { data: external_link2, size: 16 })
|
|
144
169
|
] });
|
|
145
170
|
if (item.external) {
|
|
146
|
-
return /* @__PURE__ */
|
|
171
|
+
return /* @__PURE__ */ jsx4(StyledLink2, { href: url, target: "_blank", rel: "noopener noreferrer", children: linkContent });
|
|
147
172
|
}
|
|
148
173
|
if (LinkComponent) {
|
|
149
|
-
return /* @__PURE__ */
|
|
174
|
+
return /* @__PURE__ */ jsx4(
|
|
150
175
|
StyledLink2,
|
|
151
176
|
{
|
|
152
177
|
as: LinkComponent,
|
|
@@ -158,16 +183,17 @@ function MenuLink({
|
|
|
158
183
|
);
|
|
159
184
|
}
|
|
160
185
|
isActive = typeof window !== "undefined" ? window.location.pathname === item.url : false;
|
|
161
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ jsx4(StyledLink2, { href: url, $active: isActive, children: linkContent });
|
|
162
187
|
}
|
|
163
|
-
var StyledLink2 =
|
|
188
|
+
var StyledLink2 = styled3.a`
|
|
164
189
|
text-decoration: none;
|
|
165
190
|
padding: 12px 16px 12px 19px;
|
|
166
191
|
display: inline-block;
|
|
167
192
|
width: 100%;
|
|
168
|
-
color: ${
|
|
169
|
-
background-color: ${({ $active }) => $active ?
|
|
193
|
+
color: ${tokens3.colors.interactive.secondary__resting.rgba};
|
|
194
|
+
background-color: ${({ $active }) => $active ? tokens3.colors.interactive.primary__selected_highlight.rgba : "transparent"};
|
|
170
195
|
font-weight: ${({ $active }) => $active ? 700 : 400};
|
|
196
|
+
font-size: 0.875rem;
|
|
171
197
|
|
|
172
198
|
&:hover {
|
|
173
199
|
//TODO: check hover color for dark theme with designer when back
|
|
@@ -177,50 +203,69 @@ var StyledLink2 = styled2.a`
|
|
|
177
203
|
&:focus-visible {
|
|
178
204
|
outline-offset: -2px;
|
|
179
205
|
}
|
|
206
|
+
|
|
207
|
+
span {
|
|
208
|
+
align-items: center;
|
|
209
|
+
display: flex;
|
|
210
|
+
gap: 1rem;
|
|
211
|
+
justify-content: space-between;
|
|
212
|
+
font-size: 0.875rem;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
span svg {
|
|
216
|
+
opacity: 60%;
|
|
217
|
+
}
|
|
180
218
|
`;
|
|
181
219
|
|
|
182
220
|
// src/SideMenu/components/MenuList.tsx
|
|
183
|
-
import { jsx as
|
|
184
|
-
function MenuList({
|
|
185
|
-
|
|
221
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
222
|
+
function MenuList({
|
|
223
|
+
items,
|
|
224
|
+
currentEnvironment,
|
|
225
|
+
appUrls,
|
|
226
|
+
onToggleMenuGroup,
|
|
227
|
+
linkComponent
|
|
228
|
+
}) {
|
|
229
|
+
return /* @__PURE__ */ jsx5("ul", { children: items.map((menuItem) => {
|
|
186
230
|
if (isMenuItemGroup(menuItem)) {
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(Accordion, { children: /* @__PURE__ */ jsxs5(AccordionItem, { isExpanded: menuItem.isExpanded, children: [
|
|
232
|
+
/* @__PURE__ */ jsx5(Accordion.Header, { onToggle: onToggleMenuGroup, children: menuItem.title }),
|
|
233
|
+
/* @__PURE__ */ jsx5(Accordion.Panel, { "aria-label": `Links for ${menuItem.title}`, children: /* @__PURE__ */ jsx5("ul", { children: menuItem.items.map((item) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
190
234
|
MenuLink,
|
|
191
235
|
{
|
|
192
236
|
item,
|
|
193
237
|
environment: currentEnvironment,
|
|
194
|
-
appUrls
|
|
238
|
+
appUrls,
|
|
239
|
+
linkComponent
|
|
195
240
|
}
|
|
196
241
|
) }, menuItem.title + "-" + item.name)) }) })
|
|
197
242
|
] }, menuItem.title) }, menuItem.title) }, menuItem.title);
|
|
198
243
|
} else {
|
|
199
|
-
return /* @__PURE__ */
|
|
244
|
+
return /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
245
|
+
MenuLink,
|
|
246
|
+
{
|
|
247
|
+
item: menuItem,
|
|
248
|
+
environment: currentEnvironment,
|
|
249
|
+
appUrls,
|
|
250
|
+
linkComponent
|
|
251
|
+
}
|
|
252
|
+
) }, menuItem.name);
|
|
200
253
|
}
|
|
201
254
|
}) });
|
|
202
255
|
}
|
|
203
256
|
function isMenuItemGroup(item) {
|
|
204
257
|
return typeof item === "object" && "title" in item && "items" in item;
|
|
205
258
|
}
|
|
206
|
-
var AccordionItem =
|
|
259
|
+
var AccordionItem = styled4(Accordion.Item)`
|
|
207
260
|
a {
|
|
208
261
|
display: block;
|
|
209
|
-
padding: 12px ${
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
a span {
|
|
213
|
-
align-items: center;
|
|
214
|
-
display: flex;
|
|
215
|
-
gap: 1rem;
|
|
216
|
-
justify-content: space-between;
|
|
217
|
-
font-size: 0.875rem;
|
|
262
|
+
padding: 12px ${tokens4.spacings.comfortable.medium} 12px ${tokens4.spacings.comfortable.x_large};
|
|
218
263
|
}
|
|
219
264
|
|
|
220
265
|
h2 {
|
|
221
266
|
background: transparent;
|
|
222
267
|
border: 0;
|
|
223
|
-
color: ${
|
|
268
|
+
color: ${tokens4.colors.interactive.secondary__resting.rgba};
|
|
224
269
|
}
|
|
225
270
|
|
|
226
271
|
h2 + div {
|
|
@@ -233,13 +278,13 @@ var AccordionItem = styled3(Accordion.Item)`
|
|
|
233
278
|
h2 button svg {
|
|
234
279
|
width: 14px;
|
|
235
280
|
height: 14px;
|
|
236
|
-
margin-right: ${
|
|
281
|
+
margin-right: ${tokens4.spacings.comfortable.x_small};
|
|
237
282
|
transform: rotate(-90deg);
|
|
238
|
-
fill: ${
|
|
283
|
+
fill: ${tokens4.colors.interactive.secondary__resting.rgba};
|
|
239
284
|
}
|
|
240
285
|
|
|
241
286
|
h2 button span {
|
|
242
|
-
color: ${
|
|
287
|
+
color: ${tokens4.colors.interactive.secondary__resting.rgba};
|
|
243
288
|
font-weight: 700;
|
|
244
289
|
font-size: 0.875rem;
|
|
245
290
|
}
|
|
@@ -248,10 +293,6 @@ var AccordionItem = styled3(Accordion.Item)`
|
|
|
248
293
|
transform: rotate(180deg);
|
|
249
294
|
}
|
|
250
295
|
|
|
251
|
-
li a svg {
|
|
252
|
-
opacity: 60%;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
296
|
h2 button:hover,
|
|
256
297
|
li a:hover {
|
|
257
298
|
background-color: var(--cpl-sidebar-hover-color);
|
|
@@ -263,7 +304,7 @@ var AccordionItem = styled3(Accordion.Item)`
|
|
|
263
304
|
`;
|
|
264
305
|
|
|
265
306
|
// src/SideMenu/SideMenu.tsx
|
|
266
|
-
import { Fragment, jsx as
|
|
307
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
267
308
|
function SideMenu({
|
|
268
309
|
isOpen,
|
|
269
310
|
onToggle,
|
|
@@ -273,7 +314,8 @@ function SideMenu({
|
|
|
273
314
|
currentEnvironment,
|
|
274
315
|
titleOtherMenuItems,
|
|
275
316
|
otherMenuItems,
|
|
276
|
-
appUrls
|
|
317
|
+
appUrls,
|
|
318
|
+
linkComponent
|
|
277
319
|
}) {
|
|
278
320
|
var _a;
|
|
279
321
|
const width = "268px";
|
|
@@ -307,46 +349,47 @@ function SideMenu({
|
|
|
307
349
|
return () => element.removeEventListener("scroll", handleScroll);
|
|
308
350
|
}
|
|
309
351
|
}, [handleScroll]);
|
|
310
|
-
return /* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ jsx6(Sidebar, { $isOpen: isOpen, $width: isOpen ? width : "", children: /* @__PURE__ */ jsxs6(InnerWrapper, { ref: containerRef, $width: width, children: [
|
|
353
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
354
|
+
/* @__PURE__ */ jsx6(StickyCloseButton, { $showBorder: hasOverflow && scrolledDown, children: /* @__PURE__ */ jsx6(
|
|
313
355
|
Button2,
|
|
314
356
|
{
|
|
315
357
|
variant: "ghost_icon",
|
|
316
358
|
color: "secondary",
|
|
317
359
|
"aria-label": "Toggle side menu",
|
|
318
360
|
onClick: () => onToggle(!isOpen),
|
|
319
|
-
children: /* @__PURE__ */
|
|
361
|
+
children: /* @__PURE__ */ jsx6(Icon4, { data: collapse, size: 24 })
|
|
320
362
|
}
|
|
321
363
|
) }),
|
|
322
364
|
logoElement,
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ jsxs6("nav", { children: [
|
|
366
|
+
/* @__PURE__ */ jsx6(
|
|
325
367
|
MenuList,
|
|
326
368
|
{
|
|
327
369
|
items: mainMenuItems,
|
|
328
370
|
currentEnvironment,
|
|
329
371
|
appUrls,
|
|
330
|
-
onToggleMenuGroup: checkOverflow
|
|
372
|
+
onToggleMenuGroup: checkOverflow,
|
|
373
|
+
linkComponent
|
|
331
374
|
}
|
|
332
375
|
),
|
|
333
|
-
otherMenuItems && otherMenuItems.length > 0 && /* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
376
|
+
otherMenuItems && otherMenuItems.length > 0 && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
377
|
+
/* @__PURE__ */ jsx6(StyledDivider, {}),
|
|
378
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
379
|
+
/* @__PURE__ */ jsx6(
|
|
337
380
|
Typography2,
|
|
338
381
|
{
|
|
339
382
|
variant: "label",
|
|
340
383
|
group: "navigation",
|
|
341
384
|
as: "h2",
|
|
342
385
|
style: {
|
|
343
|
-
color:
|
|
386
|
+
color: tokens5.colors.interactive.secondary__resting.rgba,
|
|
344
387
|
padding: "12px 19px 4px 19px"
|
|
345
388
|
},
|
|
346
389
|
children: (_a = titleOtherMenuItems == null ? void 0 : titleOtherMenuItems.toUpperCase()) != null ? _a : "OTHER SOLUTIONS"
|
|
347
390
|
}
|
|
348
391
|
),
|
|
349
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ jsx6(
|
|
350
393
|
MenuList,
|
|
351
394
|
{
|
|
352
395
|
items: otherMenuItems,
|
|
@@ -358,17 +401,17 @@ function SideMenu({
|
|
|
358
401
|
] })
|
|
359
402
|
] })
|
|
360
403
|
] }),
|
|
361
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ jsx6(StyledDivider, {})
|
|
362
405
|
] }),
|
|
363
406
|
versionInfo
|
|
364
407
|
] }) });
|
|
365
408
|
}
|
|
366
|
-
var StyledDivider =
|
|
409
|
+
var StyledDivider = styled5(Divider)`
|
|
367
410
|
background-color: var(--cpl-divider-color);
|
|
368
411
|
margin: 8px 0;
|
|
369
412
|
`;
|
|
370
|
-
var Sidebar =
|
|
371
|
-
width: ${(props) => props.$isOpen ? props
|
|
413
|
+
var Sidebar = styled5.div`
|
|
414
|
+
width: ${(props) => props.$isOpen ? props.$width : "0px"};
|
|
372
415
|
opacity: ${(props) => props.$isOpen ? 1 : 0};
|
|
373
416
|
transition:
|
|
374
417
|
width 0.5s,
|
|
@@ -390,12 +433,12 @@ var Sidebar = styled4.div`
|
|
|
390
433
|
box-sizing: border-box;
|
|
391
434
|
}
|
|
392
435
|
`;
|
|
393
|
-
var InnerWrapper =
|
|
436
|
+
var InnerWrapper = styled5.div`
|
|
394
437
|
overflow: auto;
|
|
395
438
|
background: var(--cpl-ui-background-temporary-nav);
|
|
396
439
|
padding: 0;
|
|
397
440
|
height: 100%;
|
|
398
|
-
width: ${(props) => props
|
|
441
|
+
width: ${(props) => props.$width};
|
|
399
442
|
position: fixed;
|
|
400
443
|
display: flex;
|
|
401
444
|
flex-direction: column;
|
|
@@ -403,13 +446,13 @@ var InnerWrapper = styled4.div`
|
|
|
403
446
|
border-right: 1px solid var(--cpl-sidebar-border-color);
|
|
404
447
|
border-bottom: 1px solid var(--cpl-sidebar-border-color);
|
|
405
448
|
`;
|
|
406
|
-
var StickyCloseButton =
|
|
449
|
+
var StickyCloseButton = styled5.div`
|
|
407
450
|
z-index: 10;
|
|
408
451
|
position: sticky;
|
|
409
452
|
top: 0;
|
|
410
453
|
display: flex;
|
|
411
454
|
justify-content: flex-end;
|
|
412
|
-
padding: ${
|
|
455
|
+
padding: ${tokens5.spacings.comfortable.xx_small};
|
|
413
456
|
background-color: var(--cpl-ui-background-temporary-nav);
|
|
414
457
|
border-bottom: ${({ $showBorder }) => $showBorder ? "1px solid var(--cpl-divider-color)" : "0"};
|
|
415
458
|
`;
|
|
@@ -417,10 +460,10 @@ var StickyCloseButton = styled4.div`
|
|
|
417
460
|
// src/UserMenu/UserMenu.tsx
|
|
418
461
|
import { Button as Button3, Icon as Icon5, Menu } from "@equinor/eds-core-react";
|
|
419
462
|
import { log_out, settings } from "@equinor/eds-icons";
|
|
420
|
-
import { tokens as
|
|
463
|
+
import { tokens as tokens6 } from "@equinor/eds-tokens";
|
|
421
464
|
import { useState as useState2 } from "react";
|
|
422
|
-
import
|
|
423
|
-
import { Fragment as Fragment2, jsx as
|
|
465
|
+
import styled6 from "styled-components";
|
|
466
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
424
467
|
function UserMenu({ user, logout, settingsLink, children }) {
|
|
425
468
|
var _a, _b, _c, _d, _e;
|
|
426
469
|
const [isOpen, setIsOpen] = useState2(false);
|
|
@@ -433,20 +476,20 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
433
476
|
};
|
|
434
477
|
const LogOutMenuItem = () => {
|
|
435
478
|
if (typeof logout === "string") {
|
|
436
|
-
return /* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ jsxs7(Menu.Item, { as: "a", href: logout, className: "menu-item", id: "logout-button", children: [
|
|
480
|
+
/* @__PURE__ */ jsx7(Icon5, { data: log_out }),
|
|
481
|
+
/* @__PURE__ */ jsx7("span", { children: "Log out" })
|
|
439
482
|
] });
|
|
440
483
|
} else {
|
|
441
|
-
return /* @__PURE__ */
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ jsxs7(Menu.Item, { as: "button", onClick: logout, className: "menu-item", id: "logout-button", children: [
|
|
485
|
+
/* @__PURE__ */ jsx7(Icon5, { data: log_out }),
|
|
486
|
+
/* @__PURE__ */ jsx7("span", { children: "Log out" })
|
|
444
487
|
] });
|
|
445
488
|
}
|
|
446
489
|
};
|
|
447
490
|
const firstLetter = (_c = (_b = (_a = user == null ? void 0 : user.email) == null ? void 0 : _a[0]) == null ? void 0 : _b.toUpperCase()) != null ? _c : "-";
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
492
|
+
/* @__PURE__ */ jsx7(
|
|
450
493
|
StyledUserButton,
|
|
451
494
|
{
|
|
452
495
|
id: "user-button",
|
|
@@ -459,7 +502,7 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
459
502
|
children: firstLetter
|
|
460
503
|
}
|
|
461
504
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ jsxs7(
|
|
463
506
|
MenuWrapper,
|
|
464
507
|
{
|
|
465
508
|
id: "user-menu",
|
|
@@ -469,16 +512,16 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
469
512
|
anchorEl,
|
|
470
513
|
style: { padding: 0, paddingBottom: 2 },
|
|
471
514
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
isOpen && /* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ jsxs7(IconAndTextWrapper, { children: [
|
|
516
|
+
/* @__PURE__ */ jsx7(LetterCircle, { children: firstLetter }),
|
|
517
|
+
isOpen && /* @__PURE__ */ jsxs7("div", { children: [
|
|
518
|
+
/* @__PURE__ */ jsx7("div", { style: { fontWeight: "bold", lineHeight: 0.9, marginBottom: 2 }, children: (_d = user == null ? void 0 : user.name) != null ? _d : "-" }),
|
|
519
|
+
/* @__PURE__ */ jsx7("div", { children: (_e = user == null ? void 0 : user.email) != null ? _e : "-" })
|
|
477
520
|
] })
|
|
478
521
|
] }),
|
|
479
|
-
settingsLink && /* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */
|
|
522
|
+
settingsLink && /* @__PURE__ */ jsxs7(Menu.Item, { as: "a", href: settingsLink, className: "menu-item", children: [
|
|
523
|
+
/* @__PURE__ */ jsx7(Icon5, { data: settings }),
|
|
524
|
+
/* @__PURE__ */ jsx7("span", { children: "Settings" })
|
|
482
525
|
] }),
|
|
483
526
|
LogOutMenuItem(),
|
|
484
527
|
children
|
|
@@ -487,25 +530,25 @@ function UserMenu({ user, logout, settingsLink, children }) {
|
|
|
487
530
|
)
|
|
488
531
|
] });
|
|
489
532
|
}
|
|
490
|
-
var MenuWrapper =
|
|
491
|
-
border-radius: ${
|
|
492
|
-
margin-top: ${
|
|
493
|
-
margin-bottom: -${
|
|
494
|
-
padding-bottom: ${
|
|
533
|
+
var MenuWrapper = styled6(Menu)`
|
|
534
|
+
border-radius: ${tokens6.shape.corners.borderRadius};
|
|
535
|
+
margin-top: ${tokens6.spacings.comfortable.small};
|
|
536
|
+
margin-bottom: -${tokens6.spacings.comfortable.small};
|
|
537
|
+
padding-bottom: ${tokens6.spacings.comfortable.small};
|
|
495
538
|
padding-left: 0;
|
|
496
539
|
padding-right: 0;
|
|
497
|
-
padding-top: ${
|
|
540
|
+
padding-top: ${tokens6.spacings.comfortable.small};
|
|
498
541
|
width: 315px;
|
|
499
542
|
|
|
500
543
|
background: var(--cpl-ui-background-temporary-nav, #fff);
|
|
501
|
-
color: ${
|
|
544
|
+
color: ${tokens6.colors.text.static_icons__default.rgba};
|
|
502
545
|
|
|
503
546
|
.menu-item {
|
|
504
547
|
align-items: center;
|
|
505
548
|
display: flex;
|
|
506
|
-
gap: ${
|
|
549
|
+
gap: ${tokens6.spacings.comfortable.medium};
|
|
507
550
|
opacity: 0.85;
|
|
508
|
-
padding: ${
|
|
551
|
+
padding: ${tokens6.spacings.comfortable.small} ${tokens6.spacings.comfortable.large};
|
|
509
552
|
|
|
510
553
|
svg {
|
|
511
554
|
opacity: 0.7;
|
|
@@ -520,7 +563,7 @@ var MenuWrapper = styled5(Menu)`
|
|
|
520
563
|
}
|
|
521
564
|
}
|
|
522
565
|
`;
|
|
523
|
-
var LetterCircle =
|
|
566
|
+
var LetterCircle = styled6.span`
|
|
524
567
|
align-items: center;
|
|
525
568
|
border-radius: 1000px;
|
|
526
569
|
display: flex;
|
|
@@ -529,16 +572,16 @@ var LetterCircle = styled5.span`
|
|
|
529
572
|
height: 32px;
|
|
530
573
|
justify-content: center;
|
|
531
574
|
width: 32px;
|
|
532
|
-
background-color: ${
|
|
533
|
-
color: ${
|
|
575
|
+
background-color: ${tokens6.colors.interactive.primary__resting.rgba};
|
|
576
|
+
color: ${tokens6.colors.text.static_icons__primary_white.rgba};
|
|
534
577
|
`;
|
|
535
|
-
var StyledUserButton =
|
|
578
|
+
var StyledUserButton = styled6(Button3)`
|
|
536
579
|
margin-left: 12px;
|
|
537
580
|
font-weight: bold;
|
|
538
581
|
width: 32px;
|
|
539
582
|
height: 32px;
|
|
540
583
|
`;
|
|
541
|
-
var IconAndTextWrapper =
|
|
584
|
+
var IconAndTextWrapper = styled6(Menu.Item)`
|
|
542
585
|
display: flex;
|
|
543
586
|
gap: 12px;
|
|
544
587
|
padding: 12px 20px;
|
|
@@ -553,6 +596,7 @@ var IconAndTextWrapper = styled5(Menu.Item)`
|
|
|
553
596
|
`;
|
|
554
597
|
export {
|
|
555
598
|
FeedbackLink,
|
|
599
|
+
MenuHeader,
|
|
556
600
|
SideMenu,
|
|
557
601
|
StyledLink,
|
|
558
602
|
TopBar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/cpl-top-bar-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@equinor/eds-icons": "^0.21.0",
|
|
13
13
|
"@equinor/eds-tokens": "^0.9.2",
|
|
14
|
-
"@equinor/cpl-env-meta-bar-react": "0.1.
|
|
14
|
+
"@equinor/cpl-env-meta-bar-react": "0.1.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@equinor/eds-core-react": "^0.42.5",
|