@telia/teddy 0.2.0 → 0.2.1

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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import React__default, { useEffect } from "react";
3
3
  import clsx from "clsx";
4
- import { MY_PAGE_LINKS, LOGGED_IN_LINKS_BUSINESS, PRIVATE_LINKS, BUSINESS_LINKS, MDU_LINKS, LINKS, getActiveSubLink } from "../navigation-menu/global-navigation/utils.js";
4
+ import { MY_PAGE_LINKS, LOGGED_IN_LINKS_BUSINESS, PRIVATE_LINKS, BUSINESS_LINKS, MDU_LINKS, getActiveSubLink, LINKS } from "../navigation-menu/global-navigation/utils.js";
5
5
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
6
6
  import { useComposedRefs, composeRefs } from "../../utils/composeRefs.js";
7
7
  import { VisuallyHidden } from "../visually-hidden/visually-hidden.js";
@@ -41,8 +41,8 @@ import { Flex } from "../flex/flex.js";
41
41
  import "../card/index.js";
42
42
  import { Grid } from "../grid/grid.js";
43
43
  import "../toggle/toggle.js";
44
- import "../accordion/index.js";
45
- import "../link/link.js";
44
+ import { Accordion } from "../accordion/index.js";
45
+ import { Link as Link$1 } from "../link/link.js";
46
46
  import "../badge/badge.js";
47
47
  import "../badge/alert-badge.js";
48
48
  import { CounterBadge } from "../badge/counter-badge.js";
@@ -63,6 +63,7 @@ import { Indicator as Indicator$1 } from "./radio-card-group-indicator.js";
63
63
  import { Body } from "./radio-card-group-item-body.js";
64
64
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
65
65
  import { useSize } from "../../utils/useSize.js";
66
+ import { useCallbackRef } from "../../utils/useCallbackRef.js";
66
67
  const Title$1 = React__default.forwardRef(
67
68
  ({ className, children, asChild, ...props }, forwardRef) => {
68
69
  const classes = clsx([styles$3[`${rootClassName$3}__title`]], className);
@@ -260,22 +261,34 @@ const Close = React__default.forwardRef(
260
261
  );
261
262
  Close.displayName = "Dialog.Close";
262
263
  const Modal = Object.assign(Root$2, { Trigger: Trigger$1, Content: Content$1, Title, Overlay, Description, Close, Image, Group });
264
+ const scaleIn = "_scaleIn_11898_1";
265
+ const scaleOut = "_scaleOut_11898_1";
266
+ const enterFromRight = "_enterFromRight_11898_1";
267
+ const enterFromLeft = "_enterFromLeft_11898_1";
268
+ const exitToRight = "_exitToRight_11898_1";
269
+ const exitToLeft = "_exitToLeft_11898_1";
263
270
  const styles$1 = {
264
- "teddy-navigation-menu": "_teddy-navigation-menu_6p30v_1",
265
- "teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_6p30v_34",
266
- "teddy-navigation-menu__separator": "_teddy-navigation-menu__separator_6p30v_37",
267
- "teddy-navigation-menu__list": "_teddy-navigation-menu__list_6p30v_40",
268
- "teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_6p30v_66",
269
- "teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_6p30v_87",
270
- "teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_6p30v_106",
271
- "teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_6p30v_112",
272
- "teddy-navigation-menu__content": "_teddy-navigation-menu__content_6p30v_187",
273
- "teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_6p30v_219",
274
- "teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_6p30v_239",
275
- "teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_6p30v_245",
276
- "teddy-navigation-menu__link": "_teddy-navigation-menu__link_6p30v_313",
277
- "teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_6p30v_333",
278
- "teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_6p30v_339"
271
+ "teddy-navigation-menu": "_teddy-navigation-menu_11898_1",
272
+ "teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_11898_34",
273
+ "teddy-navigation-menu__separator": "_teddy-navigation-menu__separator_11898_37",
274
+ "teddy-navigation-menu__list": "_teddy-navigation-menu__list_11898_40",
275
+ "teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_11898_66",
276
+ "teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_11898_87",
277
+ "teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_11898_106",
278
+ "teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_11898_112",
279
+ "teddy-navigation-menu__content": "_teddy-navigation-menu__content_11898_187",
280
+ "teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_11898_227",
281
+ "teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_11898_247",
282
+ "teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_11898_253",
283
+ "teddy-navigation-menu__link": "_teddy-navigation-menu__link_11898_321",
284
+ "teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_11898_341",
285
+ "teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_11898_347",
286
+ scaleIn,
287
+ scaleOut,
288
+ enterFromRight,
289
+ enterFromLeft,
290
+ exitToRight,
291
+ exitToLeft
279
292
  };
280
293
  const rootClassName$1 = "teddy-navigation-menu";
281
294
  const NavigationMenuContext = React__default.createContext({
@@ -521,6 +534,9 @@ const Trigger = React__default.forwardRef(
521
534
  return /* @__PURE__ */ jsx(
522
535
  NavigationMenuPrimitive.Trigger,
523
536
  {
537
+ onPointerEnter: (e) => e.preventDefault(),
538
+ onPointerMove: (e) => e.preventDefault(),
539
+ onPointerLeave: (e) => e.preventDefault(),
524
540
  ...props,
525
541
  ref,
526
542
  "data-active": active ? "true" : void 0,
@@ -541,6 +557,8 @@ const Content = React__default.forwardRef(
541
557
  return /* @__PURE__ */ jsx(
542
558
  NavigationMenuPrimitive.Content,
543
559
  {
560
+ onPointerEnter: (e) => e.preventDefault(),
561
+ onPointerLeave: (e) => e.preventDefault(),
544
562
  ...props,
545
563
  ref: forwardRef,
546
564
  className: classes
@@ -660,23 +678,20 @@ const NavigationMenu = Object.assign(Root$1, {
660
678
  TopMenuTrigger
661
679
  });
662
680
  const styles = {
663
- "teddy-global-navigation": "_teddy-global-navigation_16lml_1",
664
- "teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_16lml_6",
665
- "teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-wrapper_16lml_26",
666
- "teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-icons_16lml_31",
667
- "teddy-global-navigation__link": "_teddy-global-navigation__link_16lml_35",
668
- "teddy-global-navigation__header": "_teddy-global-navigation__header_16lml_48",
669
- "teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-box_16lml_51",
670
- "teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--mobile_16lml_54",
671
- "teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--mobile_16lml_58",
672
- "teddy-global-navigation__list": "_teddy-global-navigation__list_16lml_64",
673
- "teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_16lml_69",
674
- "teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_16lml_72",
675
- "teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_16lml_76",
676
- "teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_16lml_83",
677
- "close-viewport": "_close-viewport_16lml_1",
678
- "teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_16lml_99",
679
- "teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_16lml_102"
681
+ "teddy-global-navigation": "_teddy-global-navigation_2fdb8_1",
682
+ "teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_2fdb8_6",
683
+ "teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_2fdb8_9",
684
+ "teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_2fdb8_6",
685
+ "teddy-global-navigation__link": "_teddy-global-navigation__link_2fdb8_26",
686
+ "teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_2fdb8_29",
687
+ "teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_2fdb8_32",
688
+ "teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_2fdb8_36",
689
+ "teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_2fdb8_43",
690
+ "close-viewport": "_close-viewport_2fdb8_1",
691
+ "teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_2fdb8_54",
692
+ "teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_2fdb8_57",
693
+ "teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_2fdb8_74",
694
+ "teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_2fdb8_90"
680
695
  };
681
696
  function MyPages(props) {
682
697
  var _a, _b;
@@ -778,7 +793,6 @@ const SearchField = React__default.forwardRef(
778
793
  SearchField.displayName = "SearchField";
779
794
  function Search(props) {
780
795
  const rootContext = React__default.useContext(RootContext);
781
- const additionalSearchContent = rootContext == null ? void 0 : rootContext.additionalSearchContent;
782
796
  const searchFieldRef = React__default.useRef(null);
783
797
  return /* @__PURE__ */ jsxs(Drawer, { ...props, children: [
784
798
  /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsx(Drawer.Trigger, { children: /* @__PURE__ */ jsxs("button", { children: [
@@ -798,7 +812,6 @@ function Search(props) {
798
812
  /* @__PURE__ */ jsx(Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
799
813
  /* @__PURE__ */ jsx(Drawer.Title, { children: "Hva leter du etter?" }),
800
814
  /* @__PURE__ */ jsx(SearchField, { ref: searchFieldRef }),
801
- additionalSearchContent ? additionalSearchContent : null,
802
815
  /* @__PURE__ */ jsx(Drawer.Footer, { children: /* @__PURE__ */ jsx(Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: "Lukk" }) }) })
803
816
  ]
804
817
  }
@@ -833,44 +846,97 @@ const ShoppingCart = React__default.forwardRef(() => {
833
846
  ] });
834
847
  });
835
848
  ShoppingCart.displayName = "ShoppingCart";
849
+ const scrollDistanceDownThreshold = 200;
850
+ const scrollDistanceUpThreshold = 50;
851
+ const ANIMATION_DURATION = 300;
836
852
  const Desktop = React__default.forwardRef(() => {
837
853
  const rootContext = React__default.useContext(RootContext);
838
- const [showMenu, setShowMenu] = React__default.useState(false);
854
+ const [hideMenu, setHideMenu] = React__default.useState(null);
855
+ const lastScrollDirection = React__default.useRef();
856
+ const scrollStartPos = React__default.useRef(0);
857
+ const lastScrollPos = React__default.useRef(0);
839
858
  const topMenuRef = React__default.useRef(null);
859
+ const viewPortRef = React__default.useRef(null);
840
860
  const shouldShowViewport = [...PRIVATE_LINKS.links, ...BUSINESS_LINKS.links, ...MDU_LINKS.links].some(
841
- (link) => {
842
- const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
843
- return link.links.length && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
844
- }
861
+ (link) => !!getActiveSubLink((rootContext == null ? void 0 : rootContext.pathname) || "", link.links) || link.links.length && link.link === (rootContext == null ? void 0 : rootContext.pathname)
845
862
  );
863
+ const viewPortSize = useSize(viewPortRef.current);
846
864
  const topMenuSize = useSize(topMenuRef.current);
847
865
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
866
+ const viewPortHeight = shouldShowViewport ? "47px" : void 0;
867
+ const animationTimer = React__default.useRef(0);
868
+ const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React__default.useState(false);
869
+ const timerRef = React__default.useRef(void 0);
870
+ React__default.useEffect(() => {
871
+ timerRef.current = setTimeout(() => {
872
+ setAllowAnimationOfHeight(true);
873
+ }, 500);
874
+ return () => {
875
+ timerRef.current && clearTimeout(timerRef.current);
876
+ };
877
+ }, []);
878
+ const handleScroll = () => {
879
+ let compensateHight = 0;
880
+ if (animationTimer.current > 0) {
881
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
882
+ if (animationTimer.current + ANIMATION_DURATION > currentTime) {
883
+ compensateHight = ((topMenuSize == null ? void 0 : topMenuSize.height) || 0) + ((viewPortSize == null ? void 0 : viewPortSize.height) || 0);
884
+ } else {
885
+ animationTimer.current = 0;
886
+ }
887
+ }
888
+ const scrollY = window.scrollY;
889
+ const scrollDirection = scrollY > lastScrollPos.current ? "down" : "up";
890
+ const scrollDistance = Math.abs(scrollStartPos.current - scrollY);
891
+ if (scrollDirection !== lastScrollDirection.current) {
892
+ scrollStartPos.current = scrollY;
893
+ }
894
+ if (!hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "down" && scrollDistance > scrollDistanceDownThreshold + compensateHight) {
895
+ setHideMenu(true);
896
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
897
+ animationTimer.current = currentTime;
898
+ }
899
+ if (hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "up" && scrollDistance > scrollDistanceUpThreshold + compensateHight || scrollY === 0) {
900
+ setHideMenu(false);
901
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
902
+ animationTimer.current = currentTime;
903
+ }
904
+ lastScrollDirection.current = scrollDirection;
905
+ lastScrollPos.current = scrollY;
906
+ };
907
+ const throttledScrollHandler = useDebounceCallback(handleScroll, 5);
908
+ React__default.useEffect(() => {
909
+ window.addEventListener("scroll", throttledScrollHandler);
910
+ return () => {
911
+ window.removeEventListener("scroll", throttledScrollHandler);
912
+ };
913
+ }, [throttledScrollHandler]);
848
914
  if (!rootContext)
849
915
  return null;
850
- const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
916
+ function resetAndShowMenu() {
917
+ lastScrollDirection.current = null;
918
+ scrollStartPos.current = window.scrollY;
919
+ lastScrollPos.current = window.scrollY;
920
+ setHideMenu(false);
921
+ }
922
+ const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
851
923
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
852
- const handleInteractions = (linkName) => {
853
- setSpecifiedLink(linkName || "");
854
- setSelectedMenuItem(linkName || "", true);
855
- };
856
- const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
857
924
  return /* @__PURE__ */ jsxs(Fragment, { children: [
858
925
  /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
859
926
  "div",
860
927
  {
861
928
  style: mergeStyles(
862
- { ["--teddy-top-menu-height"]: topMenuHeight }
929
+ { ["--teddy-top-menu-height"]: topMenuHeight },
930
+ allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: teddyMotionDuration300 } : {}
863
931
  ),
864
932
  className: styles[`${rootClassName}__top-menu-wrapper`],
865
- children: /* @__PURE__ */ jsx(NavigationMenu.TopMenuList, { ref: topMenuRef, children: LINKS.map((link) => /* @__PURE__ */ jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsx(
933
+ "data-state": hideMenu ? "closed" : "open",
934
+ children: /* @__PURE__ */ jsx(NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: LINKS.map((link) => /* @__PURE__ */ jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsx(
866
935
  NavigationMenu.TopMenuTrigger,
867
936
  {
868
937
  value: link.name,
869
938
  asChild: true,
870
- onClick: () => {
871
- rootContext.setPathname(link.link);
872
- setSpecifiedLink("");
873
- },
939
+ onClick: () => rootContext.setPathname(link.link),
874
940
  children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name })
875
941
  }
876
942
  ) }, link.name)) })
@@ -878,125 +944,104 @@ const Desktop = React__default.forwardRef(() => {
878
944
  ) }),
879
945
  LINKS.map((link) => {
880
946
  var _a;
881
- return /* @__PURE__ */ jsxs(
882
- NavigationMenu.List,
883
- {
884
- value: link.name,
885
- children: [
886
- (_a = link.links) == null ? void 0 : _a.map(
887
- (subLink) => {
888
- var _a2, _b, _c;
889
- return /* @__PURE__ */ jsxs(
890
- NavigationMenu.Item,
891
- {
892
- value: subLink.name,
893
- onMouseEnter: () => setShowMenu(true),
894
- onMouseLeave: () => setShowMenu(false),
895
- children: [
896
- subLink.name === "Logo" ? /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subLink.link, onMouseEnter: () => handleInteractions(), onClick: () => handleInteractions(), children: /* @__PURE__ */ jsx(
897
- "img",
898
- {
899
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
900
- draggable: "false",
901
- alt: "Telia logo"
902
- }
903
- ) }) : /* @__PURE__ */ jsx(
904
- "a",
905
- {
906
- href: subLink.link,
907
- onMouseEnter: () => handleInteractions(),
908
- onClick: () => handleInteractions(),
909
- children: /* @__PURE__ */ jsx(
910
- "img",
911
- {
912
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
913
- draggable: "false",
914
- alt: "Telia logo"
915
- }
916
- )
917
- }
918
- ) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsx(
919
- NavigationMenu.Trigger,
920
- {
921
- asChild: true,
922
- active: currentLocation === subLink.link,
923
- children: /* @__PURE__ */ jsx(Button, { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), children: subLink.name })
924
- }
925
- ) : /* @__PURE__ */ jsx(
926
- NavigationMenu.Link,
927
- {
928
- asChild: true,
929
- active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
930
- children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsx("a", { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), href: subLink.link, children: subLink.name })
931
- }
932
- ),
933
- typeof window !== "undefined" && /* @__PURE__ */ jsx(
934
- "div",
935
- {
936
- style: mergeStyles(
937
- { ["--teddy-viewport-wrapper-height"]: viewPortHeight }
938
- ),
939
- className: styles[`${rootClassName}__viewport-wrapper`],
940
- "data-state": showMenu ? "open" : "closed",
941
- children: /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
942
- ((_b = subLink.links) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Flex, { direction: "column", pt: "400", pl: "150", pb: "250", children: /* @__PURE__ */ jsx(HightlightedLinksDesktop, { listName: subLink.name, setShowMenu, links: subLink.links }) }),
943
- ((_c = subLink.highlightedLinks) == null ? void 0 : _c.length) > 0 && /* @__PURE__ */ jsx(Flex, { direction: "column", pt: "400", pl: "400", pr: "400", pb: "250", className: styles[`${rootClassName}__colored-box`], children: /* @__PURE__ */ jsx(HightlightedLinksDesktop, { listName: "Nyttige snarveier", setShowMenu, links: subLink.highlightedLinks }) })
944
- ] }) })
945
- }
946
- )
947
- ]
948
- },
949
- subLink.name
950
- );
947
+ return /* @__PURE__ */ jsxs(NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
948
+ (_a = link.links) == null ? void 0 : _a.map((subLink) => {
949
+ var _a2, _b;
950
+ return /* @__PURE__ */ jsxs(NavigationMenu.Item, { value: subLink.name, children: [
951
+ subLink.name === "Logo" ? /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsx(
952
+ "img",
953
+ {
954
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
955
+ draggable: "false",
956
+ alt: "Telia logo"
957
+ }
958
+ ) }) : /* @__PURE__ */ jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsx(
959
+ "img",
960
+ {
961
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
962
+ draggable: "false",
963
+ alt: "Telia logo"
964
+ }
965
+ ) }) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsx(
966
+ NavigationMenu.Trigger,
967
+ {
968
+ asChild: true,
969
+ active: currentLocation === subLink.link,
970
+ onClick: () => {
971
+ rootContext.setPathname(subLink.link);
972
+ },
973
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsx("a", { href: subLink.link, children: subLink.name })
974
+ }
975
+ ) : /* @__PURE__ */ jsx(
976
+ NavigationMenu.Link,
977
+ {
978
+ asChild: true,
979
+ active: currentLocation === subLink.link,
980
+ onClick: () => {
981
+ rootContext.setPathname(subLink.link);
982
+ },
983
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsx("a", { href: subLink.link, children: subLink.name })
951
984
  }
952
985
  ),
953
- /* @__PURE__ */ jsx(Box, { ml: "auto" }),
954
- /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(ShoppingCart, {}) }),
955
- /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(Search, {}) }),
956
- /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(MyPages, {}) })
957
- ]
958
- },
959
- link.name
960
- );
961
- })
986
+ /* @__PURE__ */ jsx(NavigationMenu.Content, { children: /* @__PURE__ */ jsx("ul", { children: (_b = subLink.links) == null ? void 0 : _b.map((subSubLink) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
987
+ NavigationMenu.Link,
988
+ {
989
+ asChild: true,
990
+ active: getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
991
+ onClick: () => {
992
+ rootContext.setPathname(subSubLink.link);
993
+ },
994
+ variant: "small",
995
+ children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", align: "center", gap: "25", children: [
996
+ subSubLink.name,
997
+ "icon" in subSubLink && /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon })
998
+ ] }) }) : /* @__PURE__ */ jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", align: "center", gap: "25", children: [
999
+ subSubLink.name,
1000
+ "icon" in subSubLink && /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon })
1001
+ ] }) })
1002
+ }
1003
+ ) }, subSubLink.name)) }) })
1004
+ ] }, subLink.name);
1005
+ }),
1006
+ /* @__PURE__ */ jsx(Box, { ml: "auto" }),
1007
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(ShoppingCart, {}) }),
1008
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(Search, {}) }),
1009
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(MyPages, {}) })
1010
+ ] }, link.name);
1011
+ }),
1012
+ /* @__PURE__ */ jsx(NavigationMenu.Separator, {}),
1013
+ /* @__PURE__ */ jsx(
1014
+ "div",
1015
+ {
1016
+ style: mergeStyles(
1017
+ { ["--teddy-viewport-wrapper-height"]: viewPortHeight },
1018
+ allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: teddyMotionDuration300 } : {}
1019
+ ),
1020
+ className: styles[`${rootClassName}__viewport-wrapper`],
1021
+ "data-state": hideMenu === null ? "" : hideMenu ? "closed" : "open",
1022
+ children: /* @__PURE__ */ jsx(
1023
+ NavigationMenu.Viewport,
1024
+ {
1025
+ onFocus: resetAndShowMenu,
1026
+ ref: viewPortRef,
1027
+ className: styles[`${rootClassName}__viewport`]
1028
+ }
1029
+ )
1030
+ }
1031
+ )
962
1032
  ] });
963
1033
  });
964
1034
  Desktop.displayName = "Desktop";
965
- const HightlightedLinksDesktop = ({ links, listName, setShowMenu }) => {
966
- const rootContext = React__default.useContext(RootContext);
967
- if (!rootContext)
968
- return null;
969
- const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem } = rootContext;
970
- const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
971
- return /* @__PURE__ */ jsxs(Fragment, { children: [
972
- /* @__PURE__ */ jsx(Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listName }),
973
- /* @__PURE__ */ jsx(List$1, { className: styles[`${rootClassName}__list`], gap: "10", pl: "25", children: links == null ? void 0 : links.map(
974
- (subSubLink) => /* @__PURE__ */ jsx(List$1.Item, { children: /* @__PURE__ */ jsx(
975
- NavigationMenu.Link,
976
- {
977
- asChild: true,
978
- variant: "small",
979
- active: getActiveSubLink(currentLocation, links || []) === subSubLink.link,
980
- onClick: () => {
981
- rootContext.setPathname(subSubLink.link);
982
- setSpecifiedLink("");
983
- setSelectedMenuItem("", true);
984
- setShowMenu(false);
985
- },
986
- children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "100", align: "center", children: [
987
- subSubLink.name,
988
- /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
989
- ] }) }) : /* @__PURE__ */ jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "100", align: "center", children: [
990
- subSubLink.name,
991
- /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
992
- ] }) })
993
- }
994
- ) }, subSubLink.name)
995
- ) })
996
- ] });
997
- };
1035
+ function useDebounceCallback(callback, delay) {
1036
+ const handleCallback = useCallbackRef(callback);
1037
+ const debounceTimerRef = React__default.useRef(0);
1038
+ React__default.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
1039
+ return React__default.useCallback(() => {
1040
+ window.clearTimeout(debounceTimerRef.current);
1041
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
1042
+ }, [handleCallback, delay]);
1043
+ }
998
1044
  function Mobile(props) {
999
- const [specifiedLink, setSpecifiedLink] = React__default.useState("");
1000
1045
  const rootContext = React__default.useContext(RootContext);
1001
1046
  const drawerRef = React__default.useRef(null);
1002
1047
  if (!rootContext)
@@ -1004,11 +1049,10 @@ function Mobile(props) {
1004
1049
  const { linkComponent: NavLink } = rootContext;
1005
1050
  const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
1006
1051
  const linkClasses = clsx([styles[`${rootClassName}__link`]]);
1007
- const headerClasses = clsx([styles[`${rootClassName}__header`]]);
1008
- return /* @__PURE__ */ jsx(Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxs(Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", className: styles[`${rootClassName}__top-icon-wrapper`], children: [
1052
+ const currentLocation = rootContext.pathname;
1053
+ return /* @__PURE__ */ jsx(Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxs(Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", children: [
1009
1054
  /* @__PURE__ */ jsx(Box, { flexShrink: "0", children: /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: rootContext.appKey === "open-pages" ? /* @__PURE__ */ jsx(NavLink, { href: "/", children: /* @__PURE__ */ jsx(Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) : /* @__PURE__ */ jsx("a", { href: "/", children: /* @__PURE__ */ jsx(Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) }) }),
1010
- /* @__PURE__ */ jsxs(Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, className: styles[`${rootClassName}__top-menu-icons`], children: [
1011
- /* @__PURE__ */ jsx(Search, {}),
1055
+ /* @__PURE__ */ jsxs(Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: [
1012
1056
  /* @__PURE__ */ jsx(ShoppingCart, {}),
1013
1057
  /* @__PURE__ */ jsx(MyPages, {}),
1014
1058
  /* @__PURE__ */ jsxs(Drawer, { children: [
@@ -1018,98 +1062,109 @@ function Mobile(props) {
1018
1062
  ] }) }) }),
1019
1063
  /* @__PURE__ */ jsxs(Drawer.Content, { gap: "400", size: rootContext.drawerSize, children: [
1020
1064
  /* @__PURE__ */ jsx(Drawer.Close, { ref: drawerRef, slot: "floating", "aria-label": "Lukk" }),
1021
- !specifiedLink ? /* @__PURE__ */ jsxs(Fragment, { children: [
1022
- /* @__PURE__ */ jsx(Drawer.Title, { children: "Meny" }),
1023
- /* @__PURE__ */ jsxs(
1024
- Tabs,
1025
- {
1026
- value: rootContext.selectedDomainItem,
1027
- onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1028
- children: [
1029
- /* @__PURE__ */ jsx(Tabs.List, { children: LINKS.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1030
- /* @__PURE__ */ jsx(Fragment, { children: LINKS.map((link) => {
1031
- var _a, _b;
1032
- return /* @__PURE__ */ jsxs(Tabs.Content, { value: link.name, children: [
1033
- /* @__PURE__ */ jsx(Box, { mt: "400", children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1034
- (subLink) => subLink.links.length > 0 ? /* @__PURE__ */ jsxs(Box, { onClick: () => setSpecifiedLink(subLink.name), className: linkClasses, children: [
1035
- /* @__PURE__ */ jsx(Heading, { asChild: true, variant: "title-300", children: /* @__PURE__ */ jsx(Button, { className: styles[`${rootClassName}__sublink-button--mobile`], children: subLink.name }) }),
1036
- /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "md" })
1037
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxs(NavLink, { href: subLink.link, className: linkClasses, children: [
1038
- /* @__PURE__ */ jsx(Heading, { variant: "title-300", as: "h2", className: headerClasses, children: subLink.name }),
1039
- /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "md" })
1040
- ] }) : /* @__PURE__ */ jsxs("a", { href: subLink.link, className: linkClasses, children: [
1041
- /* @__PURE__ */ jsx(Heading, { variant: "title-300", as: "h2", children: subLink.name }),
1042
- /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "md" })
1043
- ] }) })
1044
- ) }),
1045
- ((_b = link.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(HighlightedLinks, { item: link, links: link.highlightedLinks, drawerRef, listTitle: "Nyttige snarveier" }) }) })
1046
- ] }, link.name);
1047
- }) })
1048
- ]
1049
- }
1050
- )
1051
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1052
- /* @__PURE__ */ jsx(Drawer.Title, { children: /* @__PURE__ */ jsxs(
1053
- Button,
1054
- {
1055
- size: "sm",
1056
- variant: "secondary",
1057
- onClick: () => setSpecifiedLink(""),
1058
- children: [
1059
- /* @__PURE__ */ jsx(Icon, { name: "arrow-left" }),
1060
- "Tilbake"
1061
- ]
1062
- }
1063
- ) }),
1064
- /* @__PURE__ */ jsx(Box, { mt: "100", children: LINKS.map(
1065
- (link) => {
1066
- var _a;
1067
- return (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map((subLink) => {
1068
- var _a2;
1069
- return subLink.links.length > 0 && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
1070
- /* @__PURE__ */ jsx(HighlightedLinks, { item: subLink, listTitle: subLink.name, links: subLink.links, drawerRef }),
1071
- ((_a2 = subLink.highlightedLinks) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(HighlightedLinks, { item: subLink, listTitle: "Nyttige snarveier", links: subLink.highlightedLinks, drawerRef }) }) })
1072
- ] });
1073
- });
1074
- }
1075
- ) })
1076
- ] })
1065
+ /* @__PURE__ */ jsx(Drawer.Title, { children: "Meny" }),
1066
+ /* @__PURE__ */ jsx(SearchField, {}),
1067
+ /* @__PURE__ */ jsxs(
1068
+ Tabs,
1069
+ {
1070
+ value: rootContext.selectedDomainItem,
1071
+ onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1072
+ children: [
1073
+ /* @__PURE__ */ jsx(Tabs.List, { children: LINKS.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1074
+ /* @__PURE__ */ jsx(Box, { mt: "400", children: LINKS.map((link) => {
1075
+ var _a;
1076
+ return /* @__PURE__ */ jsx(Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsx(
1077
+ Accordion,
1078
+ {
1079
+ type: "single",
1080
+ collapsible: true,
1081
+ value: rootContext.selectedMenuItem,
1082
+ onValueChange: (v) => rootContext.setSelectedMenuItem(v, true),
1083
+ children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1084
+ (subLink) => {
1085
+ var _a2;
1086
+ return subLink.links.length > 0 ? /* @__PURE__ */ jsxs(Accordion.Item, { value: subLink.name, children: [
1087
+ /* @__PURE__ */ jsxs(Accordion.Header, { className: styles[`${rootClassName}__mobile-header`], children: [
1088
+ /* @__PURE__ */ jsx(
1089
+ Link$1,
1090
+ {
1091
+ className: linkClasses,
1092
+ variant: "standalone",
1093
+ asChild: true,
1094
+ onClick: () => {
1095
+ var _a3;
1096
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1097
+ rootContext.setSelectedMenuItem(subLink.name);
1098
+ rootContext.setPathname(subLink.link);
1099
+ },
1100
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsx("a", { href: subLink.link, children: subLink.name })
1101
+ }
1102
+ ),
1103
+ /* @__PURE__ */ jsx(Accordion.Trigger, { className: styles[`${rootClassName}__mobile-trigger`], children: /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
1104
+ subLink.name,
1105
+ " linker"
1106
+ ] }) })
1107
+ ] }),
1108
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(List$1, { gap: "10", pl: "25", children: (_a2 = subLink.links) == null ? void 0 : _a2.map((subSubLink) => /* @__PURE__ */ jsx(List$1.Item, { children: /* @__PURE__ */ jsx(
1109
+ NavigationMenu.Link,
1110
+ {
1111
+ asChild: true,
1112
+ variant: "small",
1113
+ active: getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
1114
+ onClick: () => {
1115
+ var _a3;
1116
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1117
+ rootContext.setPathname(subSubLink.link);
1118
+ },
1119
+ children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
1120
+ subSubLink.name,
1121
+ "icon" in subSubLink ? /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1122
+ ] }) }) : /* @__PURE__ */ jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
1123
+ subSubLink.name,
1124
+ "icon" in subSubLink ? /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1125
+ ] }) })
1126
+ }
1127
+ ) }, subSubLink.name)) }) })
1128
+ ] }, subLink.name) : /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__accordion-look`], children: /* @__PURE__ */ jsx(
1129
+ Link$1,
1130
+ {
1131
+ className: clsx([
1132
+ linkClasses,
1133
+ styles[`${rootClassName}__mobile-link--accordion-look`]
1134
+ ]),
1135
+ variant: "standalone",
1136
+ asChild: true,
1137
+ onClick: () => {
1138
+ var _a3;
1139
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1140
+ rootContext.setSelectedMenuItem(subLink.name);
1141
+ rootContext.setPathname(subLink.link);
1142
+ },
1143
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxs(NavLink, { href: subLink.link, children: [
1144
+ subLink.name,
1145
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1146
+ ] }) : /* @__PURE__ */ jsxs("a", { href: subLink.link, children: [
1147
+ subLink.name,
1148
+ " ",
1149
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1150
+ ] })
1151
+ }
1152
+ ) }, subLink.name);
1153
+ }
1154
+ )
1155
+ }
1156
+ ) }, link.name);
1157
+ }) })
1158
+ ]
1159
+ }
1160
+ ),
1161
+ /* @__PURE__ */ jsx(Drawer.Footer, { children: /* @__PURE__ */ jsx(Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: "Lukk" }) }) })
1077
1162
  ] })
1078
1163
  ] })
1079
1164
  ] })
1080
1165
  ] }) });
1081
1166
  }
1082
1167
  Mobile.displayName = "Mobile";
1083
- const HighlightedLinks = ({ listTitle, links, item, drawerRef }) => {
1084
- const rootContext = React__default.useContext(RootContext);
1085
- if (!rootContext)
1086
- return null;
1087
- const { linkComponent: NavLink } = rootContext;
1088
- const currentLocation = rootContext.pathname;
1089
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1090
- /* @__PURE__ */ jsx(Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listTitle }),
1091
- /* @__PURE__ */ jsx(List$1, { gap: "10", pl: "25", children: links == null ? void 0 : links.map((subSubLink) => /* @__PURE__ */ jsx(List$1.Item, { children: /* @__PURE__ */ jsx(
1092
- NavigationMenu.Link,
1093
- {
1094
- asChild: true,
1095
- variant: "small",
1096
- active: getActiveSubLink(currentLocation, item.links || []) === subSubLink.link,
1097
- onClick: () => {
1098
- var _a;
1099
- (_a = drawerRef == null ? void 0 : drawerRef.current) == null ? void 0 : _a.click();
1100
- rootContext.setPathname(subSubLink.link);
1101
- },
1102
- children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
1103
- subSubLink.name,
1104
- subSubLink.icon ? /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1105
- ] }) }) : /* @__PURE__ */ jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
1106
- subSubLink.name,
1107
- subSubLink.icon ? /* @__PURE__ */ jsx(Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
1108
- ] }) })
1109
- }
1110
- ) }, subSubLink.name)) })
1111
- ] });
1112
- };
1113
1168
  const DesktopSimplified = React__default.forwardRef(() => {
1114
1169
  const rootContext = React__default.useContext(RootContext);
1115
1170
  if (!rootContext)
@@ -1165,7 +1220,6 @@ function Root({
1165
1220
  shoppingCart,
1166
1221
  shoppingCartNumberOfItems,
1167
1222
  onSearchSubmit,
1168
- additionalSearchContent,
1169
1223
  isCartOpen,
1170
1224
  onCartOpenChange,
1171
1225
  drawerSize = "md",
@@ -1176,11 +1230,7 @@ function Root({
1176
1230
  const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
1177
1231
  const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath));
1178
1232
  const [pathname, setPathname] = React__default.useState(currentPath || "");
1179
- const [specifiedLink, setSpecifiedLink] = React__default.useState(getInitialMenuItem(currentPath));
1180
1233
  const classes = clsx([styles[`${rootClassName}`]], className);
1181
- useEffect(() => {
1182
- setPathname(currentPath || "");
1183
- }, [currentPath]);
1184
1234
  return /* @__PURE__ */ jsx(
1185
1235
  RootContext.Provider,
1186
1236
  {
@@ -1210,12 +1260,9 @@ function Root({
1210
1260
  shoppingCart,
1211
1261
  shoppingCartNumberOfItems,
1212
1262
  onSearchSubmit,
1213
- additionalSearchContent,
1214
1263
  isCartOpen,
1215
1264
  onCartOpenChange,
1216
- drawerSize,
1217
- specifiedLink,
1218
- setSpecifiedLink
1265
+ drawerSize
1219
1266
  },
1220
1267
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1221
1268
  NavigationMenu,
@@ -1274,7 +1321,7 @@ function getInitialMenuItem(currentPath) {
1274
1321
  const mainMenuPartOfLocation = locationArray[1];
1275
1322
  return (_f = (_e = PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
1276
1323
  var _a2;
1277
- return link.name.toLowerCase() === mainMenuPartOfLocation || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
1324
+ return link.link === `/${mainMenuPartOfLocation}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
1278
1325
  })) == null ? void 0 : _f.name;
1279
1326
  }
1280
1327
  Root.displayName = "GlobalNavigation";
@@ -1283,7 +1330,6 @@ export {
1283
1330
  Content$2 as C,
1284
1331
  Desktop as D,
1285
1332
  GlobalNavigation as G,
1286
- HighlightedLinks as H,
1287
1333
  ItemContext as I,
1288
1334
  Modal as M,
1289
1335
  NavigationMenu as N,