@boomerang-io/carbon-addons-boomerang-react 4.6.5-beta.13 → 4.6.5-beta.15
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/cjs/components/Header/Header.js +14 -7
- package/dist/cjs/components/UIShell/UIShell.js +1 -0
- package/dist/esm/components/Header/Header.js +15 -8
- package/dist/esm/components/UIShell/UIShell.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/scss/components/Header/_header.scss +6 -4
|
@@ -55,6 +55,16 @@ const MenuAriaLabelRecord = {
|
|
|
55
55
|
};
|
|
56
56
|
const headerButtonClassNames = "cds--btn--icon-only cds--header__action cds--btn cds--btn--primary cds--btn--icon-only cds--btn cds--btn--primary";
|
|
57
57
|
function Header(props) {
|
|
58
|
+
const currentURL = window.location.href;
|
|
59
|
+
currentURL.startsWith("uki");
|
|
60
|
+
currentURL.startsWith("remea");
|
|
61
|
+
const isCanadaInstance = currentURL.startsWith("canada");
|
|
62
|
+
currentURL.startsWith("us");
|
|
63
|
+
currentURL.startsWith("au");
|
|
64
|
+
currentURL.startsWith("japan");
|
|
65
|
+
currentURL.startsWith("serviceessentials");
|
|
66
|
+
console.log("currentURL", currentURL);
|
|
67
|
+
console.log("isCanadaInstance", isCanadaInstance);
|
|
58
68
|
const { productName, baseEnvUrl, baseServicesUrl, carbonTheme = "g10", className, navLinks, prefixName = "", rightPanel, skipToContentProps, templateMeteringEvent, triggerEvent, userTeams, } = props;
|
|
59
69
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
60
70
|
React__default.default.createElement(react.Theme, { theme: carbonTheme },
|
|
@@ -66,9 +76,7 @@ function Header(props) {
|
|
|
66
76
|
? navLinks.map((link) => (React__default.default.createElement(react.HeaderMenuItem, { "aria-label": `Link for ${link.name}`, "data-testid": "header-menu-link", href: link.url, isCurrentPage: window?.location?.href && link.url ? window.location.href.startsWith(link.url) : false, key: link.name, target: link.isExternal ? "_blank" : undefined, rel: link.isExternal ? "noopener noreferrer" : undefined }, link.name)))
|
|
67
77
|
: null),
|
|
68
78
|
React__default.default.createElement(react.HeaderGlobalBar, null,
|
|
69
|
-
React__default.default.createElement(InstanceSwitcherMenu, { enabled:
|
|
70
|
-
// enabled={Array.isArray(props.instanceSwitcherMenuItems) && props.instanceSwitcherMenuItems.length > 0}
|
|
71
|
-
menuItems: props.instanceSwitcherMenuItems }),
|
|
79
|
+
React__default.default.createElement(InstanceSwitcherMenu, { enabled: Boolean(props.instanceSwitcherEnabled), menuItems: props.instanceSwitcherMenuItems }),
|
|
72
80
|
React__default.default.createElement(RequestsMenu, { baseEnvUrl: baseEnvUrl, enabled: Boolean(props.requestSummary), summary: props.requestSummary }),
|
|
73
81
|
React__default.default.createElement(NotificationsMenu, { baseEnvUrl: baseEnvUrl, baseServicesUrl: baseServicesUrl, enabled: Boolean(props.enableNotifications), countEnabled: Boolean(props.enableNotificationsCount) }),
|
|
74
82
|
React__default.default.createElement(SupportMenu, { enabled: Array.isArray(props.supportMenuItems) && props.supportMenuItems.length > 0, menuItems: props.supportMenuItems }),
|
|
@@ -82,12 +90,11 @@ function InstanceSwitcherMenu(props) {
|
|
|
82
90
|
if (!props.enabled) {
|
|
83
91
|
return null;
|
|
84
92
|
}
|
|
85
|
-
return (React__default.default.createElement("div", { style: { position: "relative" }, ref: ref },
|
|
93
|
+
return (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-header-instance-switcher`, style: { position: "relative" }, ref: ref },
|
|
86
94
|
React__default.default.createElement("button", { "aria-controls": MenuListId.instanceSwitcher, "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": MenuAriaLabelRecord.instanceSwitcher, className: headerButtonClassNames, "data-testid": "header-instanceSwitcher-link", id: MenuButtonId.InstanceSwitcher, onClick: toggleActive },
|
|
87
|
-
React__default.default.createElement(icons.
|
|
95
|
+
React__default.default.createElement(icons.Wikis, { size: 20 })),
|
|
88
96
|
isOpen ? (React__default.default.createElement(HeaderMenu.default, { "aria-labelledby": MenuButtonId.InstanceSwitcher, id: MenuListId.instanceSwitcher },
|
|
89
|
-
React__default.default.createElement(react.HeaderMenuItem, { key: "Global", text: "Global", type: "link", kind: "app", href: "https://servicesessentials.ibm.com/launchpad", target: "_self" },
|
|
90
|
-
React__default.default.createElement("div", null, "Global")),
|
|
97
|
+
React__default.default.createElement(react.HeaderMenuItem, { key: "Global", text: "Global", type: "link", kind: "app", href: "https://servicesessentials.ibm.com/launchpad", target: "_self" }, "Global"),
|
|
91
98
|
React__default.default.createElement(react.HeaderMenuItem, { key: "Australlia", text: "Australlia", type: "link", kind: "app", href: "https://au.ica.ibm.com", target: "_self" }, "Australlia"),
|
|
92
99
|
React__default.default.createElement(react.HeaderMenuItem, { key: "Canada", text: "Australlia", type: "link", kind: "app", href: "https://canada.ica.ibm.com", target: "_self" }, "Canada"))) : null));
|
|
93
100
|
}
|
|
@@ -40,6 +40,7 @@ function UIShell({ baseEnvUrl, carbonTheme = "g10", config, leftPanel, platformN
|
|
|
40
40
|
* Check feature enablement via explicit feature flags
|
|
41
41
|
*/
|
|
42
42
|
const isAppSwitcherEnabled = Boolean(features?.["appSwitcher.enabled"]);
|
|
43
|
+
Boolean(features?.["instanceSwitcherEnabled"]);
|
|
43
44
|
const isFeedbackEnabled = Boolean(features?.["feedback.enabled"]);
|
|
44
45
|
const isNotificationsEnabled = Boolean(features?.["notifications.enabled"]);
|
|
45
46
|
const isNotificationsCountEnabled = Boolean(features?.["notificationsCount.enabled"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Theme, Header as Header$1, SkipToContent, HeaderName, HeaderNavigation, HeaderMenuItem, HeaderGlobalBar, HeaderPanel, HeaderMenuButton, SideNav, SideNavItems, SideNavLink } from '@carbon/react';
|
|
3
|
-
import {
|
|
3
|
+
import { Wikis, Collaborate, NotificationNew, Notification, Help, UserAvatar, Close, Switcher, OpenPanelFilledRight } from '@carbon/react/icons';
|
|
4
4
|
import HeaderAppSwitcher from './HeaderAppSwitcher.js';
|
|
5
5
|
import HeaderMenu from './HeaderMenu.js';
|
|
6
6
|
import NotificationsContainer from '../Notifications/NotificationsContainer.js';
|
|
@@ -47,6 +47,16 @@ const MenuAriaLabelRecord = {
|
|
|
47
47
|
};
|
|
48
48
|
const headerButtonClassNames = "cds--btn--icon-only cds--header__action cds--btn cds--btn--primary cds--btn--icon-only cds--btn cds--btn--primary";
|
|
49
49
|
function Header(props) {
|
|
50
|
+
const currentURL = window.location.href;
|
|
51
|
+
currentURL.startsWith("uki");
|
|
52
|
+
currentURL.startsWith("remea");
|
|
53
|
+
const isCanadaInstance = currentURL.startsWith("canada");
|
|
54
|
+
currentURL.startsWith("us");
|
|
55
|
+
currentURL.startsWith("au");
|
|
56
|
+
currentURL.startsWith("japan");
|
|
57
|
+
currentURL.startsWith("serviceessentials");
|
|
58
|
+
console.log("currentURL", currentURL);
|
|
59
|
+
console.log("isCanadaInstance", isCanadaInstance);
|
|
50
60
|
const { productName, baseEnvUrl, baseServicesUrl, carbonTheme = "g10", className, navLinks, prefixName = "", rightPanel, skipToContentProps, templateMeteringEvent, triggerEvent, userTeams, } = props;
|
|
51
61
|
return (React.createElement(React.Fragment, null,
|
|
52
62
|
React.createElement(Theme, { theme: carbonTheme },
|
|
@@ -58,9 +68,7 @@ function Header(props) {
|
|
|
58
68
|
? navLinks.map((link) => (React.createElement(HeaderMenuItem, { "aria-label": `Link for ${link.name}`, "data-testid": "header-menu-link", href: link.url, isCurrentPage: window?.location?.href && link.url ? window.location.href.startsWith(link.url) : false, key: link.name, target: link.isExternal ? "_blank" : undefined, rel: link.isExternal ? "noopener noreferrer" : undefined }, link.name)))
|
|
59
69
|
: null),
|
|
60
70
|
React.createElement(HeaderGlobalBar, null,
|
|
61
|
-
React.createElement(InstanceSwitcherMenu, { enabled:
|
|
62
|
-
// enabled={Array.isArray(props.instanceSwitcherMenuItems) && props.instanceSwitcherMenuItems.length > 0}
|
|
63
|
-
menuItems: props.instanceSwitcherMenuItems }),
|
|
71
|
+
React.createElement(InstanceSwitcherMenu, { enabled: Boolean(props.instanceSwitcherEnabled), menuItems: props.instanceSwitcherMenuItems }),
|
|
64
72
|
React.createElement(RequestsMenu, { baseEnvUrl: baseEnvUrl, enabled: Boolean(props.requestSummary), summary: props.requestSummary }),
|
|
65
73
|
React.createElement(NotificationsMenu, { baseEnvUrl: baseEnvUrl, baseServicesUrl: baseServicesUrl, enabled: Boolean(props.enableNotifications), countEnabled: Boolean(props.enableNotificationsCount) }),
|
|
66
74
|
React.createElement(SupportMenu, { enabled: Array.isArray(props.supportMenuItems) && props.supportMenuItems.length > 0, menuItems: props.supportMenuItems }),
|
|
@@ -74,12 +82,11 @@ function InstanceSwitcherMenu(props) {
|
|
|
74
82
|
if (!props.enabled) {
|
|
75
83
|
return null;
|
|
76
84
|
}
|
|
77
|
-
return (React.createElement("div", { style: { position: "relative" }, ref: ref },
|
|
85
|
+
return (React.createElement("div", { className: `${prefix}--bmrg-header-instance-switcher`, style: { position: "relative" }, ref: ref },
|
|
78
86
|
React.createElement("button", { "aria-controls": MenuListId.instanceSwitcher, "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": MenuAriaLabelRecord.instanceSwitcher, className: headerButtonClassNames, "data-testid": "header-instanceSwitcher-link", id: MenuButtonId.InstanceSwitcher, onClick: toggleActive },
|
|
79
|
-
React.createElement(
|
|
87
|
+
React.createElement(Wikis, { size: 20 })),
|
|
80
88
|
isOpen ? (React.createElement(HeaderMenu, { "aria-labelledby": MenuButtonId.InstanceSwitcher, id: MenuListId.instanceSwitcher },
|
|
81
|
-
React.createElement(HeaderMenuItem, { key: "Global", text: "Global", type: "link", kind: "app", href: "https://servicesessentials.ibm.com/launchpad", target: "_self" },
|
|
82
|
-
React.createElement("div", null, "Global")),
|
|
89
|
+
React.createElement(HeaderMenuItem, { key: "Global", text: "Global", type: "link", kind: "app", href: "https://servicesessentials.ibm.com/launchpad", target: "_self" }, "Global"),
|
|
83
90
|
React.createElement(HeaderMenuItem, { key: "Australlia", text: "Australlia", type: "link", kind: "app", href: "https://au.ica.ibm.com", target: "_self" }, "Australlia"),
|
|
84
91
|
React.createElement(HeaderMenuItem, { key: "Canada", text: "Australlia", type: "link", kind: "app", href: "https://canada.ica.ibm.com", target: "_self" }, "Canada"))) : null));
|
|
85
92
|
}
|
|
@@ -32,6 +32,7 @@ function UIShell({ baseEnvUrl, carbonTheme = "g10", config, leftPanel, platformN
|
|
|
32
32
|
* Check feature enablement via explicit feature flags
|
|
33
33
|
*/
|
|
34
34
|
const isAppSwitcherEnabled = Boolean(features?.["appSwitcher.enabled"]);
|
|
35
|
+
Boolean(features?.["instanceSwitcherEnabled"]);
|
|
35
36
|
const isFeedbackEnabled = Boolean(features?.["feedback.enabled"]);
|
|
36
37
|
const isNotificationsEnabled = Boolean(features?.["notifications.enabled"]);
|
|
37
38
|
const isNotificationsCountEnabled = Boolean(features?.["notificationsCount.enabled"]);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -349,6 +349,7 @@ type Props$G = {
|
|
|
349
349
|
carbonTheme?: "white" | "g10" | "g90" | "g100";
|
|
350
350
|
className?: string;
|
|
351
351
|
enableAppSwitcher?: boolean;
|
|
352
|
+
instanceSwitcherEnabled?: boolean;
|
|
352
353
|
enableNotifications?: boolean;
|
|
353
354
|
enableNotificationsCount?: boolean;
|
|
354
355
|
leftPanel?: (args: {
|
|
@@ -1354,6 +1355,7 @@ type Props = {
|
|
|
1354
1355
|
baseEnvUrl?: string;
|
|
1355
1356
|
config?: {
|
|
1356
1357
|
features?: {
|
|
1358
|
+
"instanceSwitcherEnabled"?: boolean;
|
|
1357
1359
|
"appSwitcher.enabled"?: boolean;
|
|
1358
1360
|
"consent.enabled"?: boolean;
|
|
1359
1361
|
"docs.enabled"?: boolean;
|
package/package.json
CHANGED
|
@@ -115,7 +115,11 @@ IBM Confidential
|
|
|
115
115
|
align-items: center;
|
|
116
116
|
font-size: 10px;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
.#{$prefix}--bmrg-header-instance-switcher .cds--bmrg-header-drop-down a.cds--header__menu-item
|
|
119
|
+
{
|
|
120
|
+
padding: 10px 15px !important;
|
|
121
|
+
border-bottom: 1px solid lightgrey !important;
|
|
122
|
+
}
|
|
119
123
|
// span, p, a, div {
|
|
120
124
|
// color: shell.$bmrg-theme-primary;
|
|
121
125
|
// &:hover {
|
|
@@ -142,10 +146,8 @@ a.#{$prefix}--header__menu-item {
|
|
|
142
146
|
color: shell.$bmrg-theme-primary !important;
|
|
143
147
|
background-color: shell.$bmrg-theme-active !important;
|
|
144
148
|
}
|
|
145
|
-
|
|
146
|
-
border-bottom: 1px solid lightgrey !important;
|
|
149
|
+
|
|
147
150
|
}
|
|
148
|
-
|
|
149
151
|
a.#{$prefix}--side-nav__link {
|
|
150
152
|
color: shell.$bmrg-theme-secondary;
|
|
151
153
|
&--current {
|