@telia/teddy 0.0.42 → 0.0.44
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.
|
@@ -256,7 +256,7 @@ const Desktop = React.forwardRef(() => {
|
|
|
256
256
|
setHideMenu(false);
|
|
257
257
|
}
|
|
258
258
|
const { setSelectedMenuItem, linkComponent: Link } = rootContext;
|
|
259
|
-
const currentLocation = rootContext.pathname
|
|
259
|
+
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
260
260
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
261
261
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
262
262
|
"div",
|
|
@@ -489,7 +489,7 @@ function Root({
|
|
|
489
489
|
}) {
|
|
490
490
|
const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
|
|
491
491
|
const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
|
|
492
|
-
const [pathname, setPathname] = React.useState("");
|
|
492
|
+
const [pathname, setPathname] = React.useState(currentPath || "");
|
|
493
493
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
494
494
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
495
|
RootContext.Provider,
|
|
@@ -539,30 +539,34 @@ function Root({
|
|
|
539
539
|
);
|
|
540
540
|
}
|
|
541
541
|
Root.displayName = "Root";
|
|
542
|
-
function getInitialDomain(
|
|
543
|
-
if (!
|
|
542
|
+
function getInitialDomain(currentPath) {
|
|
543
|
+
if (!currentPath)
|
|
544
544
|
return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
|
|
545
|
-
const locationArray =
|
|
545
|
+
const locationArray = currentPath ? currentPath.split("/") : [];
|
|
546
546
|
const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
|
|
547
547
|
const initDomain = domainPartOfLocation === components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.link ? components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.name : domainPartOfLocation === components_navigationMenu_globalNavigation_utils.MDU_LINKS.link ? components_navigationMenu_globalNavigation_utils.MDU_LINKS.name : components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
|
|
548
548
|
return initDomain;
|
|
549
549
|
}
|
|
550
|
-
function getInitialMenuItem(
|
|
550
|
+
function getInitialMenuItem(currentPath) {
|
|
551
551
|
var _a, _b, _c;
|
|
552
|
-
if (!
|
|
552
|
+
if (!currentPath)
|
|
553
553
|
return;
|
|
554
|
-
const locationArray =
|
|
555
|
-
const initialDomain = getInitialDomain(
|
|
554
|
+
const locationArray = currentPath ? currentPath.split("/") : [];
|
|
555
|
+
const initialDomain = getInitialDomain(currentPath);
|
|
556
556
|
if (initialDomain === "Bedrift") {
|
|
557
557
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
558
|
-
return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find(
|
|
558
|
+
return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find(
|
|
559
|
+
(link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || link.links.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)
|
|
560
|
+
)) == null ? void 0 : _a.name;
|
|
559
561
|
}
|
|
560
562
|
if (initialDomain === "Borettslag") {
|
|
561
563
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
562
564
|
return (_b = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _b.name;
|
|
563
565
|
}
|
|
564
566
|
const mainMenuPartOfLocation = locationArray[1];
|
|
565
|
-
return (_c = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links.find((link) =>
|
|
567
|
+
return (_c = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links.find((link) => {
|
|
568
|
+
return link.link === `/${mainMenuPartOfLocation}/` || link.links.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`);
|
|
569
|
+
})) == null ? void 0 : _c.name;
|
|
566
570
|
}
|
|
567
571
|
Root.displayName = "GlobalNavigation";
|
|
568
572
|
const GlobalNavigation = Root;
|
|
@@ -254,7 +254,7 @@ const Desktop = React__default.forwardRef(() => {
|
|
|
254
254
|
setHideMenu(false);
|
|
255
255
|
}
|
|
256
256
|
const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
|
|
257
|
-
const currentLocation = rootContext.pathname
|
|
257
|
+
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
258
258
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
259
259
|
/* @__PURE__ */ jsx(
|
|
260
260
|
"div",
|
|
@@ -487,7 +487,7 @@ function Root({
|
|
|
487
487
|
}) {
|
|
488
488
|
const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
|
|
489
489
|
const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath));
|
|
490
|
-
const [pathname, setPathname] = React__default.useState("");
|
|
490
|
+
const [pathname, setPathname] = React__default.useState(currentPath || "");
|
|
491
491
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
492
492
|
return /* @__PURE__ */ jsx(
|
|
493
493
|
RootContext.Provider,
|
|
@@ -537,30 +537,34 @@ function Root({
|
|
|
537
537
|
);
|
|
538
538
|
}
|
|
539
539
|
Root.displayName = "Root";
|
|
540
|
-
function getInitialDomain(
|
|
541
|
-
if (!
|
|
540
|
+
function getInitialDomain(currentPath) {
|
|
541
|
+
if (!currentPath)
|
|
542
542
|
return PRIVATE_LINKS.name;
|
|
543
|
-
const locationArray =
|
|
543
|
+
const locationArray = currentPath ? currentPath.split("/") : [];
|
|
544
544
|
const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
|
|
545
545
|
const initDomain = domainPartOfLocation === BUSINESS_LINKS.link ? BUSINESS_LINKS.name : domainPartOfLocation === MDU_LINKS.link ? MDU_LINKS.name : PRIVATE_LINKS.name;
|
|
546
546
|
return initDomain;
|
|
547
547
|
}
|
|
548
|
-
function getInitialMenuItem(
|
|
548
|
+
function getInitialMenuItem(currentPath) {
|
|
549
549
|
var _a, _b, _c;
|
|
550
|
-
if (!
|
|
550
|
+
if (!currentPath)
|
|
551
551
|
return;
|
|
552
|
-
const locationArray =
|
|
553
|
-
const initialDomain = getInitialDomain(
|
|
552
|
+
const locationArray = currentPath ? currentPath.split("/") : [];
|
|
553
|
+
const initialDomain = getInitialDomain(currentPath);
|
|
554
554
|
if (initialDomain === "Bedrift") {
|
|
555
555
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
556
|
-
return (_a = BUSINESS_LINKS.links.find(
|
|
556
|
+
return (_a = BUSINESS_LINKS.links.find(
|
|
557
|
+
(link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || link.links.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)
|
|
558
|
+
)) == null ? void 0 : _a.name;
|
|
557
559
|
}
|
|
558
560
|
if (initialDomain === "Borettslag") {
|
|
559
561
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
560
562
|
return (_b = MDU_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _b.name;
|
|
561
563
|
}
|
|
562
564
|
const mainMenuPartOfLocation = locationArray[1];
|
|
563
|
-
return (_c = PRIVATE_LINKS.links.find((link) =>
|
|
565
|
+
return (_c = PRIVATE_LINKS.links.find((link) => {
|
|
566
|
+
return link.link === `/${mainMenuPartOfLocation}/` || link.links.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`);
|
|
567
|
+
})) == null ? void 0 : _c.name;
|
|
564
568
|
}
|
|
565
569
|
Root.displayName = "GlobalNavigation";
|
|
566
570
|
const GlobalNavigation = Root;
|