@telia/teddy 0.0.48 → 0.0.50
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/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +211 -153
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +212 -154
- package/dist/components/navigation-menu/global-navigation/utils.cjs +17 -3
- package/dist/components/navigation-menu/global-navigation/utils.d.ts +64 -54
- package/dist/components/navigation-menu/global-navigation/utils.js +18 -4
- package/dist/components/navigation-menu/navigation-menu.cjs +24 -24
- package/dist/components/navigation-menu/navigation-menu.js +24 -24
- package/dist/style.css +490 -479
- package/package.json +1 -1
|
@@ -29,17 +29,19 @@ const components_visuallyHidden_visuallyHidden = require("../../visually-hidden/
|
|
|
29
29
|
const components_link_link = require("../../link/link.cjs");
|
|
30
30
|
const components_list_index = require("../../list/index.cjs");
|
|
31
31
|
const styles = {
|
|
32
|
-
"teddy-global-navigation": "_teddy-global-
|
|
33
|
-
"teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-
|
|
34
|
-
"teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-
|
|
35
|
-
"teddy-global-navigation__mobile": "_teddy-global-
|
|
36
|
-
"teddy-global-navigation__link": "_teddy-global-
|
|
37
|
-
"teddy-global-navigation__viewport": "_teddy-global-
|
|
38
|
-
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-
|
|
39
|
-
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-
|
|
40
|
-
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-
|
|
41
|
-
"close-viewport": "_close-
|
|
42
|
-
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-
|
|
32
|
+
"teddy-global-navigation": "_teddy-global-navigation_1yaoy_1",
|
|
33
|
+
"teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_1yaoy_6",
|
|
34
|
+
"teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_1yaoy_9",
|
|
35
|
+
"teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_1yaoy_6",
|
|
36
|
+
"teddy-global-navigation__link": "_teddy-global-navigation__link_1yaoy_26",
|
|
37
|
+
"teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_1yaoy_29",
|
|
38
|
+
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_1yaoy_32",
|
|
39
|
+
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_1yaoy_36",
|
|
40
|
+
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_1yaoy_43",
|
|
41
|
+
"close-viewport": "_close-viewport_1yaoy_1",
|
|
42
|
+
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_1yaoy_54",
|
|
43
|
+
"teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_1yaoy_64",
|
|
44
|
+
"teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_1yaoy_80"
|
|
43
45
|
};
|
|
44
46
|
function MyPages(props) {
|
|
45
47
|
var _a, _b;
|
|
@@ -56,7 +58,7 @@ function MyPages(props) {
|
|
|
56
58
|
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { asChild: true, size: rootContext == null ? void 0 : rootContext.drawerSize, children: [
|
|
57
59
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
58
60
|
isLoggedIn ? /* @__PURE__ */ jsxRuntime.jsx(LoggedInContent, {}) : /* @__PURE__ */ jsxRuntime.jsx(LoggedOutContent, {}),
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", children: "Lukk" }) }) })
|
|
60
62
|
] })
|
|
61
63
|
] });
|
|
62
64
|
}
|
|
@@ -82,6 +84,7 @@ function LoggedOutContent() {
|
|
|
82
84
|
] });
|
|
83
85
|
}
|
|
84
86
|
function LoggedInContent() {
|
|
87
|
+
var _a;
|
|
85
88
|
const rootContext = React.useContext(RootContext);
|
|
86
89
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
87
90
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Dine sider" }),
|
|
@@ -93,7 +96,7 @@ function LoggedInContent() {
|
|
|
93
96
|
/* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
|
|
94
97
|
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
|
|
95
98
|
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Privat" }),
|
|
96
|
-
components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
|
|
99
|
+
(_a = components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links) == null ? void 0 : _a.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
|
|
97
100
|
] }),
|
|
98
101
|
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
|
|
99
102
|
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedrift" }),
|
|
@@ -159,7 +162,7 @@ function Search(props) {
|
|
|
159
162
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
160
163
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
|
|
161
164
|
/* @__PURE__ */ jsxRuntime.jsx(SearchField, { ref: searchFieldRef }),
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", children: "Lukk" }) }) })
|
|
163
166
|
]
|
|
164
167
|
}
|
|
165
168
|
)
|
|
@@ -188,7 +191,7 @@ const ShoppingCart = React.forwardRef(() => {
|
|
|
188
191
|
titleSuffix
|
|
189
192
|
] }),
|
|
190
193
|
shoppingCartContent ? shoppingCartContent : null,
|
|
191
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
194
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", children: "Lukk" }) }) })
|
|
192
195
|
] })
|
|
193
196
|
] });
|
|
194
197
|
});
|
|
@@ -204,10 +207,13 @@ const Desktop = React.forwardRef(() => {
|
|
|
204
207
|
const lastScrollPos = React.useRef(0);
|
|
205
208
|
const topMenuRef = React.useRef(null);
|
|
206
209
|
const viewPortRef = React.useRef(null);
|
|
210
|
+
const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
|
|
211
|
+
(link) => link.links.some((subLink) => subLink.link === (rootContext == null ? void 0 : rootContext.pathname)) || link.links.length && link.link === (rootContext == null ? void 0 : rootContext.pathname)
|
|
212
|
+
);
|
|
207
213
|
const viewPortSize = utils_useSize.useSize(viewPortRef.current);
|
|
208
214
|
const topMenuSize = utils_useSize.useSize(topMenuRef.current);
|
|
209
215
|
const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
|
|
210
|
-
const viewPortHeight =
|
|
216
|
+
const viewPortHeight = shouldShowViewport ? "47px" : void 0;
|
|
211
217
|
const animationTimer = React.useRef(0);
|
|
212
218
|
const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
|
|
213
219
|
const timerRef = React.useRef(void 0);
|
|
@@ -275,64 +281,78 @@ const Desktop = React.forwardRef(() => {
|
|
|
275
281
|
),
|
|
276
282
|
className: styles[`${rootClassName}__top-menu-wrapper`],
|
|
277
283
|
"data-state": hideMenu ? "closed" : "open",
|
|
278
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
279
|
-
|
|
280
|
-
),
|
|
281
|
-
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
|
|
282
|
-
link.links.map((subLink) => /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: [
|
|
283
|
-
subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
284
|
-
"img",
|
|
285
|
-
{
|
|
286
|
-
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
287
|
-
draggable: "false",
|
|
288
|
-
alt: "Telia logo"
|
|
289
|
-
}
|
|
290
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
-
"img",
|
|
292
|
-
{
|
|
293
|
-
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
294
|
-
draggable: "false",
|
|
295
|
-
alt: "Telia logo"
|
|
296
|
-
}
|
|
297
|
-
) }) }) : subLink.links.length ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
298
|
-
components_navigationMenu_navigationMenu.NavigationMenu.Trigger,
|
|
299
|
-
{
|
|
300
|
-
asChild: true,
|
|
301
|
-
active: currentLocation === subLink.link,
|
|
302
|
-
onClick: () => {
|
|
303
|
-
rootContext.setPathname(subLink.link);
|
|
304
|
-
},
|
|
305
|
-
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
306
|
-
}
|
|
307
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
-
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
309
|
-
{
|
|
310
|
-
asChild: true,
|
|
311
|
-
active: currentLocation === subLink.link,
|
|
312
|
-
onClick: () => {
|
|
313
|
-
rootContext.setPathname(subLink.link);
|
|
314
|
-
},
|
|
315
|
-
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: subLink.links.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
319
|
-
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
284
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
285
|
+
components_navigationMenu_navigationMenu.NavigationMenu.TopMenuTrigger,
|
|
320
286
|
{
|
|
287
|
+
value: link.name,
|
|
321
288
|
asChild: true,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
rootContext.setPathname(subSubLink.link);
|
|
325
|
-
},
|
|
326
|
-
variant: "small",
|
|
327
|
-
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subSubLink.link, children: subSubLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: subSubLink.name })
|
|
289
|
+
onClick: () => rootContext.setPathname(link.link),
|
|
290
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: link.link, children: link.name })
|
|
328
291
|
}
|
|
329
|
-
) },
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
/* @__PURE__ */ jsxRuntime.
|
|
335
|
-
|
|
292
|
+
) }, link.name)) })
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
296
|
+
var _a;
|
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
|
|
298
|
+
(_a = link.links) == null ? void 0 : _a.map((subLink) => {
|
|
299
|
+
var _a2, _b;
|
|
300
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: [
|
|
301
|
+
subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
302
|
+
"img",
|
|
303
|
+
{
|
|
304
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
305
|
+
draggable: "false",
|
|
306
|
+
alt: "Telia logo"
|
|
307
|
+
}
|
|
308
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
+
"img",
|
|
310
|
+
{
|
|
311
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
312
|
+
draggable: "false",
|
|
313
|
+
alt: "Telia logo"
|
|
314
|
+
}
|
|
315
|
+
) }) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Trigger,
|
|
317
|
+
{
|
|
318
|
+
asChild: true,
|
|
319
|
+
active: currentLocation === subLink.link,
|
|
320
|
+
onClick: () => {
|
|
321
|
+
rootContext.setPathname(subLink.link);
|
|
322
|
+
},
|
|
323
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
324
|
+
}
|
|
325
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
326
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
327
|
+
{
|
|
328
|
+
asChild: true,
|
|
329
|
+
active: currentLocation === subLink.link,
|
|
330
|
+
onClick: () => {
|
|
331
|
+
rootContext.setPathname(subLink.link);
|
|
332
|
+
},
|
|
333
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: (_b = subLink.links) == null ? void 0 : _b.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
338
|
+
{
|
|
339
|
+
asChild: true,
|
|
340
|
+
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
|
|
341
|
+
onClick: () => {
|
|
342
|
+
rootContext.setPathname(subSubLink.link);
|
|
343
|
+
},
|
|
344
|
+
variant: "small",
|
|
345
|
+
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subSubLink.link, children: subSubLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: subSubLink.name })
|
|
346
|
+
}
|
|
347
|
+
) }, subSubLink.name)) }) })
|
|
348
|
+
] }, subLink.name);
|
|
349
|
+
}),
|
|
350
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
|
|
351
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
|
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
|
|
353
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
|
|
354
|
+
] }, link.name);
|
|
355
|
+
}),
|
|
336
356
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
337
357
|
"div",
|
|
338
358
|
{
|
|
@@ -389,63 +409,94 @@ function Mobile(props) {
|
|
|
389
409
|
/* @__PURE__ */ jsxRuntime.jsx(SearchField, {}),
|
|
390
410
|
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { value: rootContext.selectedDomainItem, onValueChange: rootContext.setSelectedDomainItem, children: [
|
|
391
411
|
/* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: link.name, children: link.name }, link.name)) }),
|
|
392
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) =>
|
|
393
|
-
|
|
394
|
-
{
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
412
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
413
|
+
var _a;
|
|
414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
components_accordion_index.Accordion,
|
|
416
|
+
{
|
|
417
|
+
type: "single",
|
|
418
|
+
collapsible: true,
|
|
419
|
+
value: rootContext.selectedMenuItem,
|
|
420
|
+
onValueChange: rootContext.setSelectedMenuItem,
|
|
421
|
+
children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
|
|
422
|
+
(subLink) => {
|
|
423
|
+
var _a2;
|
|
424
|
+
return subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Item, { value: subLink.name, children: [
|
|
425
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Header, { className: styles[`${rootClassName}__mobile-header`], children: [
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
+
components_link_link.Link,
|
|
428
|
+
{
|
|
429
|
+
className: linkClasses,
|
|
430
|
+
variant: "standalone",
|
|
431
|
+
asChild: true,
|
|
432
|
+
onClick: () => {
|
|
433
|
+
var _a3;
|
|
434
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
435
|
+
rootContext.setSelectedMenuItem(subLink.name);
|
|
436
|
+
rootContext.setPathname(subLink.link);
|
|
437
|
+
},
|
|
438
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
439
|
+
}
|
|
440
|
+
),
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Trigger, { className: styles[`${rootClassName}__mobile-trigger`], children: /* @__PURE__ */ jsxRuntime.jsxs(components_visuallyHidden_visuallyHidden.VisuallyHidden, { children: [
|
|
442
|
+
subLink.name,
|
|
443
|
+
" linker"
|
|
444
|
+
] }) })
|
|
445
|
+
] }),
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { gap: "10", pl: "25", children: (_a2 = subLink.links) == null ? void 0 : _a2.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
448
|
+
{
|
|
449
|
+
asChild: true,
|
|
450
|
+
variant: "small",
|
|
451
|
+
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
|
|
452
|
+
onClick: () => {
|
|
453
|
+
var _a3;
|
|
454
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
455
|
+
rootContext.setPathname(subSubLink.link);
|
|
456
|
+
},
|
|
457
|
+
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
|
|
458
|
+
subSubLink.name,
|
|
459
|
+
" ",
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
461
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
|
|
462
|
+
subSubLink.name,
|
|
463
|
+
" ",
|
|
464
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
465
|
+
] }) })
|
|
466
|
+
}
|
|
467
|
+
) }, subSubLink.name)) }) })
|
|
468
|
+
] }, subLink.name) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__accordion-look`], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
469
|
+
components_link_link.Link,
|
|
470
|
+
{
|
|
471
|
+
className: clsx([
|
|
472
|
+
linkClasses,
|
|
473
|
+
styles[`${rootClassName}__mobile-link--accordion-look`]
|
|
474
|
+
]),
|
|
475
|
+
variant: "standalone",
|
|
476
|
+
asChild: true,
|
|
477
|
+
onClick: () => {
|
|
478
|
+
var _a3;
|
|
479
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
480
|
+
rootContext.setSelectedMenuItem(subLink.name);
|
|
481
|
+
rootContext.setPathname(subLink.link);
|
|
482
|
+
},
|
|
483
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsxs(NavLink, { href: subLink.link, children: [
|
|
484
|
+
subLink.name,
|
|
485
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
486
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("a", { href: subLink.link, children: [
|
|
487
|
+
subLink.name,
|
|
488
|
+
" ",
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
490
|
+
] })
|
|
491
|
+
}
|
|
492
|
+
) }, subLink.name);
|
|
442
493
|
}
|
|
443
|
-
)
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
494
|
+
)
|
|
495
|
+
}
|
|
496
|
+
) }, link.name);
|
|
497
|
+
}) })
|
|
447
498
|
] }),
|
|
448
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", children: "Lukk" }) }) })
|
|
449
500
|
] })
|
|
450
501
|
] })
|
|
451
502
|
] })
|
|
@@ -458,25 +509,28 @@ const DesktopSimplified = React.forwardRef(() => {
|
|
|
458
509
|
return null;
|
|
459
510
|
const { setSelectedMenuItem, linkComponent: Link } = rootContext;
|
|
460
511
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
461
|
-
components_navigationMenu_globalNavigation_utils.LINKS.map((link) =>
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
{
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
512
|
+
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
513
|
+
var _a;
|
|
514
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { value: link.name, children: [
|
|
515
|
+
(_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: subLink.name === "Logo" && /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
+
"img",
|
|
517
|
+
{
|
|
518
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
519
|
+
draggable: "false",
|
|
520
|
+
alt: "Telia logo"
|
|
521
|
+
}
|
|
522
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
523
|
+
"img",
|
|
524
|
+
{
|
|
525
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
526
|
+
draggable: "false",
|
|
527
|
+
alt: "Telia logo"
|
|
528
|
+
}
|
|
529
|
+
) }) }) }, subLink.name)),
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) })
|
|
532
|
+
] }, link.name);
|
|
533
|
+
}),
|
|
480
534
|
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Viewport, { className: styles[`${rootClassName}__viewport`] })
|
|
481
535
|
] });
|
|
482
536
|
});
|
|
@@ -572,25 +626,29 @@ function getInitialDomain(currentPath) {
|
|
|
572
626
|
return initDomain;
|
|
573
627
|
}
|
|
574
628
|
function getInitialMenuItem(currentPath) {
|
|
575
|
-
var _a, _b, _c;
|
|
629
|
+
var _a, _b, _c, _d, _e, _f;
|
|
576
630
|
if (!currentPath)
|
|
577
631
|
return;
|
|
578
632
|
const locationArray = currentPath ? currentPath.split("/") : [];
|
|
579
633
|
const initialDomain = getInitialDomain(currentPath);
|
|
580
634
|
if (initialDomain === "Bedrift") {
|
|
581
635
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
582
|
-
return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find(
|
|
583
|
-
(link) =>
|
|
584
|
-
|
|
636
|
+
return (_b = (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links) == null ? void 0 : _a.find(
|
|
637
|
+
(link) => {
|
|
638
|
+
var _a2;
|
|
639
|
+
return link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`));
|
|
640
|
+
}
|
|
641
|
+
)) == null ? void 0 : _b.name;
|
|
585
642
|
}
|
|
586
643
|
if (initialDomain === "Borettslag") {
|
|
587
644
|
const mainMenuPartOfLocation2 = locationArray[2];
|
|
588
|
-
return (
|
|
645
|
+
return (_d = (_c = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
|
|
589
646
|
}
|
|
590
647
|
const mainMenuPartOfLocation = locationArray[1];
|
|
591
|
-
return (
|
|
592
|
-
|
|
593
|
-
|
|
648
|
+
return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
|
|
649
|
+
var _a2;
|
|
650
|
+
return link.link === `/${mainMenuPartOfLocation}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
|
|
651
|
+
})) == null ? void 0 : _f.name;
|
|
594
652
|
}
|
|
595
653
|
Root.displayName = "GlobalNavigation";
|
|
596
654
|
const GlobalNavigation = Root;
|