@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.
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.cjs +2 -3
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.js +2 -3
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.cjs +3 -2
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.d.ts +1 -8
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.js +4 -3
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.d.ts +2 -5
- package/dist/components/navigation-menu/global-navigation/utils.cjs +32 -271
- package/dist/components/navigation-menu/global-navigation/utils.d.ts +20 -417
- package/dist/components/navigation-menu/global-navigation/utils.js +32 -271
- package/dist/components/radio-card-group/radio-card-group-item-title.cjs +313 -267
- package/dist/components/radio-card-group/radio-card-group-item-title.js +314 -268
- package/dist/style.css +202 -143
- package/package.json +1 -1
|
@@ -43,8 +43,8 @@ const components_flex_flex = require("../flex/flex.cjs");
|
|
|
43
43
|
require("../card/index.cjs");
|
|
44
44
|
const components_grid_grid = require("../grid/grid.cjs");
|
|
45
45
|
require("../toggle/toggle.cjs");
|
|
46
|
-
require("../accordion/index.cjs");
|
|
47
|
-
require("../link/link.cjs");
|
|
46
|
+
const components_accordion_index = require("../accordion/index.cjs");
|
|
47
|
+
const components_link_link = require("../link/link.cjs");
|
|
48
48
|
require("../badge/badge.cjs");
|
|
49
49
|
require("../badge/alert-badge.cjs");
|
|
50
50
|
const components_badge_counterBadge = require("../badge/counter-badge.cjs");
|
|
@@ -65,6 +65,7 @@ const components_radioCardGroup_radioCardGroupIndicator = require("./radio-card-
|
|
|
65
65
|
const components_radioCardGroup_radioCardGroupItemBody = require("./radio-card-group-item-body.cjs");
|
|
66
66
|
const RadioGroupPrimitive = require("@radix-ui/react-radio-group");
|
|
67
67
|
const utils_useSize = require("../../utils/useSize.cjs");
|
|
68
|
+
const utils_useCallbackRef = require("../../utils/useCallbackRef.cjs");
|
|
68
69
|
function _interopNamespaceDefault(e) {
|
|
69
70
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
70
71
|
if (e) {
|
|
@@ -281,22 +282,34 @@ const Close = React.forwardRef(
|
|
|
281
282
|
);
|
|
282
283
|
Close.displayName = "Dialog.Close";
|
|
283
284
|
const Modal = Object.assign(Root$2, { Trigger: Trigger$1, Content: Content$1, Title, Overlay, Description, Close, Image, Group });
|
|
285
|
+
const scaleIn = "_scaleIn_11898_1";
|
|
286
|
+
const scaleOut = "_scaleOut_11898_1";
|
|
287
|
+
const enterFromRight = "_enterFromRight_11898_1";
|
|
288
|
+
const enterFromLeft = "_enterFromLeft_11898_1";
|
|
289
|
+
const exitToRight = "_exitToRight_11898_1";
|
|
290
|
+
const exitToLeft = "_exitToLeft_11898_1";
|
|
284
291
|
const styles$1 = {
|
|
285
|
-
"teddy-navigation-menu": "_teddy-navigation-
|
|
286
|
-
"teddy-navigation-menu__viewport": "_teddy-navigation-
|
|
287
|
-
"teddy-navigation-menu__separator": "_teddy-navigation-
|
|
288
|
-
"teddy-navigation-menu__list": "_teddy-navigation-
|
|
289
|
-
"teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-
|
|
290
|
-
"teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-
|
|
291
|
-
"teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--
|
|
292
|
-
"teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--
|
|
293
|
-
"teddy-navigation-menu__content": "_teddy-navigation-
|
|
294
|
-
"teddy-navigation-menu__trigger": "_teddy-navigation-
|
|
295
|
-
"teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--
|
|
296
|
-
"teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--
|
|
297
|
-
"teddy-navigation-menu__link": "_teddy-navigation-
|
|
298
|
-
"teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--
|
|
299
|
-
"teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--
|
|
292
|
+
"teddy-navigation-menu": "_teddy-navigation-menu_11898_1",
|
|
293
|
+
"teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_11898_34",
|
|
294
|
+
"teddy-navigation-menu__separator": "_teddy-navigation-menu__separator_11898_37",
|
|
295
|
+
"teddy-navigation-menu__list": "_teddy-navigation-menu__list_11898_40",
|
|
296
|
+
"teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_11898_66",
|
|
297
|
+
"teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_11898_87",
|
|
298
|
+
"teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_11898_106",
|
|
299
|
+
"teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_11898_112",
|
|
300
|
+
"teddy-navigation-menu__content": "_teddy-navigation-menu__content_11898_187",
|
|
301
|
+
"teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_11898_227",
|
|
302
|
+
"teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_11898_247",
|
|
303
|
+
"teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_11898_253",
|
|
304
|
+
"teddy-navigation-menu__link": "_teddy-navigation-menu__link_11898_321",
|
|
305
|
+
"teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_11898_341",
|
|
306
|
+
"teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_11898_347",
|
|
307
|
+
scaleIn,
|
|
308
|
+
scaleOut,
|
|
309
|
+
enterFromRight,
|
|
310
|
+
enterFromLeft,
|
|
311
|
+
exitToRight,
|
|
312
|
+
exitToLeft
|
|
300
313
|
};
|
|
301
314
|
const rootClassName$1 = "teddy-navigation-menu";
|
|
302
315
|
const NavigationMenuContext = React.createContext({
|
|
@@ -542,6 +555,9 @@ const Trigger = React.forwardRef(
|
|
|
542
555
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
543
556
|
NavigationMenuPrimitive__namespace.Trigger,
|
|
544
557
|
{
|
|
558
|
+
onPointerEnter: (e) => e.preventDefault(),
|
|
559
|
+
onPointerMove: (e) => e.preventDefault(),
|
|
560
|
+
onPointerLeave: (e) => e.preventDefault(),
|
|
545
561
|
...props,
|
|
546
562
|
ref,
|
|
547
563
|
"data-active": active ? "true" : void 0,
|
|
@@ -562,6 +578,8 @@ const Content = React.forwardRef(
|
|
|
562
578
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
563
579
|
NavigationMenuPrimitive__namespace.Content,
|
|
564
580
|
{
|
|
581
|
+
onPointerEnter: (e) => e.preventDefault(),
|
|
582
|
+
onPointerLeave: (e) => e.preventDefault(),
|
|
565
583
|
...props,
|
|
566
584
|
ref: forwardRef,
|
|
567
585
|
className: classes
|
|
@@ -681,23 +699,20 @@ const NavigationMenu = Object.assign(Root$1, {
|
|
|
681
699
|
TopMenuTrigger
|
|
682
700
|
});
|
|
683
701
|
const styles = {
|
|
684
|
-
"teddy-global-navigation": "_teddy-global-
|
|
685
|
-
"teddy-global-navigation__mobile": "_teddy-global-
|
|
686
|
-
"teddy-global-
|
|
687
|
-
"teddy-global-
|
|
688
|
-
"teddy-global-navigation__link": "_teddy-global-
|
|
689
|
-
"teddy-global-
|
|
690
|
-
"teddy-global-
|
|
691
|
-
"teddy-global-
|
|
692
|
-
"teddy-global-
|
|
693
|
-
"
|
|
694
|
-
"teddy-global-
|
|
695
|
-
"teddy-global-
|
|
696
|
-
"teddy-global-
|
|
697
|
-
"teddy-global-
|
|
698
|
-
"close-viewport": "_close-viewport_16lml_1",
|
|
699
|
-
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_16lml_99",
|
|
700
|
-
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_16lml_102"
|
|
702
|
+
"teddy-global-navigation": "_teddy-global-navigation_2fdb8_1",
|
|
703
|
+
"teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_2fdb8_6",
|
|
704
|
+
"teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_2fdb8_9",
|
|
705
|
+
"teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_2fdb8_6",
|
|
706
|
+
"teddy-global-navigation__link": "_teddy-global-navigation__link_2fdb8_26",
|
|
707
|
+
"teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_2fdb8_29",
|
|
708
|
+
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_2fdb8_32",
|
|
709
|
+
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_2fdb8_36",
|
|
710
|
+
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_2fdb8_43",
|
|
711
|
+
"close-viewport": "_close-viewport_2fdb8_1",
|
|
712
|
+
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_2fdb8_54",
|
|
713
|
+
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_2fdb8_57",
|
|
714
|
+
"teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_2fdb8_74",
|
|
715
|
+
"teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_2fdb8_90"
|
|
701
716
|
};
|
|
702
717
|
function MyPages(props) {
|
|
703
718
|
var _a, _b;
|
|
@@ -799,7 +814,6 @@ const SearchField = React.forwardRef(
|
|
|
799
814
|
SearchField.displayName = "SearchField";
|
|
800
815
|
function Search(props) {
|
|
801
816
|
const rootContext = React.useContext(RootContext);
|
|
802
|
-
const additionalSearchContent = rootContext == null ? void 0 : rootContext.additionalSearchContent;
|
|
803
817
|
const searchFieldRef = React.useRef(null);
|
|
804
818
|
return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
|
|
805
819
|
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
@@ -819,7 +833,6 @@ function Search(props) {
|
|
|
819
833
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
820
834
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
|
|
821
835
|
/* @__PURE__ */ jsxRuntime.jsx(SearchField, { ref: searchFieldRef }),
|
|
822
|
-
additionalSearchContent ? additionalSearchContent : null,
|
|
823
836
|
/* @__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" }) }) })
|
|
824
837
|
]
|
|
825
838
|
}
|
|
@@ -854,44 +867,97 @@ const ShoppingCart = React.forwardRef(() => {
|
|
|
854
867
|
] });
|
|
855
868
|
});
|
|
856
869
|
ShoppingCart.displayName = "ShoppingCart";
|
|
870
|
+
const scrollDistanceDownThreshold = 200;
|
|
871
|
+
const scrollDistanceUpThreshold = 50;
|
|
872
|
+
const ANIMATION_DURATION = 300;
|
|
857
873
|
const Desktop = React.forwardRef(() => {
|
|
858
874
|
const rootContext = React.useContext(RootContext);
|
|
859
|
-
const [
|
|
875
|
+
const [hideMenu, setHideMenu] = React.useState(null);
|
|
876
|
+
const lastScrollDirection = React.useRef();
|
|
877
|
+
const scrollStartPos = React.useRef(0);
|
|
878
|
+
const lastScrollPos = React.useRef(0);
|
|
860
879
|
const topMenuRef = React.useRef(null);
|
|
880
|
+
const viewPortRef = React.useRef(null);
|
|
861
881
|
const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
|
|
862
|
-
(link) =>
|
|
863
|
-
const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
|
|
864
|
-
return link.links.length && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
|
|
865
|
-
}
|
|
882
|
+
(link) => !!components_navigationMenu_globalNavigation_utils.getActiveSubLink((rootContext == null ? void 0 : rootContext.pathname) || "", link.links) || link.links.length && link.link === (rootContext == null ? void 0 : rootContext.pathname)
|
|
866
883
|
);
|
|
884
|
+
const viewPortSize = utils_useSize.useSize(viewPortRef.current);
|
|
867
885
|
const topMenuSize = utils_useSize.useSize(topMenuRef.current);
|
|
868
886
|
const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
|
|
887
|
+
const viewPortHeight = shouldShowViewport ? "47px" : void 0;
|
|
888
|
+
const animationTimer = React.useRef(0);
|
|
889
|
+
const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
|
|
890
|
+
const timerRef = React.useRef(void 0);
|
|
891
|
+
React.useEffect(() => {
|
|
892
|
+
timerRef.current = setTimeout(() => {
|
|
893
|
+
setAllowAnimationOfHeight(true);
|
|
894
|
+
}, 500);
|
|
895
|
+
return () => {
|
|
896
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
897
|
+
};
|
|
898
|
+
}, []);
|
|
899
|
+
const handleScroll = () => {
|
|
900
|
+
let compensateHight = 0;
|
|
901
|
+
if (animationTimer.current > 0) {
|
|
902
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
903
|
+
if (animationTimer.current + ANIMATION_DURATION > currentTime) {
|
|
904
|
+
compensateHight = ((topMenuSize == null ? void 0 : topMenuSize.height) || 0) + ((viewPortSize == null ? void 0 : viewPortSize.height) || 0);
|
|
905
|
+
} else {
|
|
906
|
+
animationTimer.current = 0;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const scrollY = window.scrollY;
|
|
910
|
+
const scrollDirection = scrollY > lastScrollPos.current ? "down" : "up";
|
|
911
|
+
const scrollDistance = Math.abs(scrollStartPos.current - scrollY);
|
|
912
|
+
if (scrollDirection !== lastScrollDirection.current) {
|
|
913
|
+
scrollStartPos.current = scrollY;
|
|
914
|
+
}
|
|
915
|
+
if (!hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "down" && scrollDistance > scrollDistanceDownThreshold + compensateHight) {
|
|
916
|
+
setHideMenu(true);
|
|
917
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
918
|
+
animationTimer.current = currentTime;
|
|
919
|
+
}
|
|
920
|
+
if (hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "up" && scrollDistance > scrollDistanceUpThreshold + compensateHight || scrollY === 0) {
|
|
921
|
+
setHideMenu(false);
|
|
922
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
923
|
+
animationTimer.current = currentTime;
|
|
924
|
+
}
|
|
925
|
+
lastScrollDirection.current = scrollDirection;
|
|
926
|
+
lastScrollPos.current = scrollY;
|
|
927
|
+
};
|
|
928
|
+
const throttledScrollHandler = useDebounceCallback(handleScroll, 5);
|
|
929
|
+
React.useEffect(() => {
|
|
930
|
+
window.addEventListener("scroll", throttledScrollHandler);
|
|
931
|
+
return () => {
|
|
932
|
+
window.removeEventListener("scroll", throttledScrollHandler);
|
|
933
|
+
};
|
|
934
|
+
}, [throttledScrollHandler]);
|
|
869
935
|
if (!rootContext)
|
|
870
936
|
return null;
|
|
871
|
-
|
|
937
|
+
function resetAndShowMenu() {
|
|
938
|
+
lastScrollDirection.current = null;
|
|
939
|
+
scrollStartPos.current = window.scrollY;
|
|
940
|
+
lastScrollPos.current = window.scrollY;
|
|
941
|
+
setHideMenu(false);
|
|
942
|
+
}
|
|
943
|
+
const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
|
|
872
944
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
873
|
-
const handleInteractions = (linkName) => {
|
|
874
|
-
setSpecifiedLink(linkName || "");
|
|
875
|
-
setSelectedMenuItem(linkName || "", true);
|
|
876
|
-
};
|
|
877
|
-
const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
|
|
878
945
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
879
946
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
880
947
|
"div",
|
|
881
948
|
{
|
|
882
949
|
style: utils_generateStyling_index.mergeStyles(
|
|
883
|
-
{ ["--teddy-top-menu-height"]: topMenuHeight }
|
|
950
|
+
{ ["--teddy-top-menu-height"]: topMenuHeight },
|
|
951
|
+
allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
|
|
884
952
|
),
|
|
885
953
|
className: styles[`${rootClassName}__top-menu-wrapper`],
|
|
886
|
-
|
|
954
|
+
"data-state": hideMenu ? "closed" : "open",
|
|
955
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
887
956
|
NavigationMenu.TopMenuTrigger,
|
|
888
957
|
{
|
|
889
958
|
value: link.name,
|
|
890
959
|
asChild: true,
|
|
891
|
-
onClick: () =>
|
|
892
|
-
rootContext.setPathname(link.link);
|
|
893
|
-
setSpecifiedLink("");
|
|
894
|
-
},
|
|
960
|
+
onClick: () => rootContext.setPathname(link.link),
|
|
895
961
|
children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name })
|
|
896
962
|
}
|
|
897
963
|
) }, link.name)) })
|
|
@@ -899,125 +965,104 @@ const Desktop = React.forwardRef(() => {
|
|
|
899
965
|
) }),
|
|
900
966
|
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
901
967
|
var _a;
|
|
902
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
value:
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
-
NavigationMenu.Trigger,
|
|
941
|
-
{
|
|
942
|
-
asChild: true,
|
|
943
|
-
active: currentLocation === subLink.link,
|
|
944
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), children: subLink.name })
|
|
945
|
-
}
|
|
946
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
-
NavigationMenu.Link,
|
|
948
|
-
{
|
|
949
|
-
asChild: true,
|
|
950
|
-
active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
|
|
951
|
-
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { onMouseEnter: () => handleInteractions(subLink.name), onClick: () => handleInteractions(subLink.name), href: subLink.link, children: subLink.name })
|
|
952
|
-
}
|
|
953
|
-
),
|
|
954
|
-
typeof window !== "undefined" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
955
|
-
"div",
|
|
956
|
-
{
|
|
957
|
-
style: utils_generateStyling_index.mergeStyles(
|
|
958
|
-
{ ["--teddy-viewport-wrapper-height"]: viewPortHeight }
|
|
959
|
-
),
|
|
960
|
-
className: styles[`${rootClassName}__viewport-wrapper`],
|
|
961
|
-
"data-state": showMenu ? "open" : "closed",
|
|
962
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
963
|
-
((_b = subLink.links) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", pt: "400", pl: "150", pb: "250", children: /* @__PURE__ */ jsxRuntime.jsx(HightlightedLinksDesktop, { listName: subLink.name, setShowMenu, links: subLink.links }) }),
|
|
964
|
-
((_c = subLink.highlightedLinks) == null ? void 0 : _c.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", pt: "400", pl: "400", pr: "400", pb: "250", className: styles[`${rootClassName}__colored-box`], children: /* @__PURE__ */ jsxRuntime.jsx(HightlightedLinksDesktop, { listName: "Nyttige snarveier", setShowMenu, links: subLink.highlightedLinks }) })
|
|
965
|
-
] }) })
|
|
966
|
-
}
|
|
967
|
-
)
|
|
968
|
-
]
|
|
969
|
-
},
|
|
970
|
-
subLink.name
|
|
971
|
-
);
|
|
968
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
|
|
969
|
+
(_a = link.links) == null ? void 0 : _a.map((subLink) => {
|
|
970
|
+
var _a2, _b;
|
|
971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.Item, { value: subLink.name, children: [
|
|
972
|
+
subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
973
|
+
"img",
|
|
974
|
+
{
|
|
975
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
976
|
+
draggable: "false",
|
|
977
|
+
alt: "Telia logo"
|
|
978
|
+
}
|
|
979
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
980
|
+
"img",
|
|
981
|
+
{
|
|
982
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
983
|
+
draggable: "false",
|
|
984
|
+
alt: "Telia logo"
|
|
985
|
+
}
|
|
986
|
+
) }) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
987
|
+
NavigationMenu.Trigger,
|
|
988
|
+
{
|
|
989
|
+
asChild: true,
|
|
990
|
+
active: currentLocation === subLink.link,
|
|
991
|
+
onClick: () => {
|
|
992
|
+
rootContext.setPathname(subLink.link);
|
|
993
|
+
},
|
|
994
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
995
|
+
}
|
|
996
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
997
|
+
NavigationMenu.Link,
|
|
998
|
+
{
|
|
999
|
+
asChild: true,
|
|
1000
|
+
active: currentLocation === subLink.link,
|
|
1001
|
+
onClick: () => {
|
|
1002
|
+
rootContext.setPathname(subLink.link);
|
|
1003
|
+
},
|
|
1004
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
972
1005
|
}
|
|
973
1006
|
),
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1007
|
+
/* @__PURE__ */ jsxRuntime.jsx(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(
|
|
1008
|
+
NavigationMenu.Link,
|
|
1009
|
+
{
|
|
1010
|
+
asChild: true,
|
|
1011
|
+
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
|
|
1012
|
+
onClick: () => {
|
|
1013
|
+
rootContext.setPathname(subSubLink.link);
|
|
1014
|
+
},
|
|
1015
|
+
variant: "small",
|
|
1016
|
+
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", align: "center", gap: "25", children: [
|
|
1017
|
+
subSubLink.name,
|
|
1018
|
+
"icon" in subSubLink && /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon })
|
|
1019
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", align: "center", gap: "25", children: [
|
|
1020
|
+
subSubLink.name,
|
|
1021
|
+
"icon" in subSubLink && /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon })
|
|
1022
|
+
] }) })
|
|
1023
|
+
}
|
|
1024
|
+
) }, subSubLink.name)) }) })
|
|
1025
|
+
] }, subLink.name);
|
|
1026
|
+
}),
|
|
1027
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
|
|
1031
|
+
] }, link.name);
|
|
1032
|
+
}),
|
|
1033
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Separator, {}),
|
|
1034
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
"div",
|
|
1036
|
+
{
|
|
1037
|
+
style: utils_generateStyling_index.mergeStyles(
|
|
1038
|
+
{ ["--teddy-viewport-wrapper-height"]: viewPortHeight },
|
|
1039
|
+
allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
|
|
1040
|
+
),
|
|
1041
|
+
className: styles[`${rootClassName}__viewport-wrapper`],
|
|
1042
|
+
"data-state": hideMenu === null ? "" : hideMenu ? "closed" : "open",
|
|
1043
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1044
|
+
NavigationMenu.Viewport,
|
|
1045
|
+
{
|
|
1046
|
+
onFocus: resetAndShowMenu,
|
|
1047
|
+
ref: viewPortRef,
|
|
1048
|
+
className: styles[`${rootClassName}__viewport`]
|
|
1049
|
+
}
|
|
1050
|
+
)
|
|
1051
|
+
}
|
|
1052
|
+
)
|
|
983
1053
|
] });
|
|
984
1054
|
});
|
|
985
1055
|
Desktop.displayName = "Desktop";
|
|
986
|
-
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
(subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
996
|
-
NavigationMenu.Link,
|
|
997
|
-
{
|
|
998
|
-
asChild: true,
|
|
999
|
-
variant: "small",
|
|
1000
|
-
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, links || []) === subSubLink.link,
|
|
1001
|
-
onClick: () => {
|
|
1002
|
-
rootContext.setPathname(subSubLink.link);
|
|
1003
|
-
setSpecifiedLink("");
|
|
1004
|
-
setSelectedMenuItem("", true);
|
|
1005
|
-
setShowMenu(false);
|
|
1006
|
-
},
|
|
1007
|
-
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", align: "center", children: [
|
|
1008
|
-
subSubLink.name,
|
|
1009
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1010
|
-
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", align: "center", children: [
|
|
1011
|
-
subSubLink.name,
|
|
1012
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1013
|
-
] }) })
|
|
1014
|
-
}
|
|
1015
|
-
) }, subSubLink.name)
|
|
1016
|
-
) })
|
|
1017
|
-
] });
|
|
1018
|
-
};
|
|
1056
|
+
function useDebounceCallback(callback, delay) {
|
|
1057
|
+
const handleCallback = utils_useCallbackRef.useCallbackRef(callback);
|
|
1058
|
+
const debounceTimerRef = React.useRef(0);
|
|
1059
|
+
React.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
|
|
1060
|
+
return React.useCallback(() => {
|
|
1061
|
+
window.clearTimeout(debounceTimerRef.current);
|
|
1062
|
+
debounceTimerRef.current = window.setTimeout(handleCallback, delay);
|
|
1063
|
+
}, [handleCallback, delay]);
|
|
1064
|
+
}
|
|
1019
1065
|
function Mobile(props) {
|
|
1020
|
-
const [specifiedLink, setSpecifiedLink] = React.useState("");
|
|
1021
1066
|
const rootContext = React.useContext(RootContext);
|
|
1022
1067
|
const drawerRef = React.useRef(null);
|
|
1023
1068
|
if (!rootContext)
|
|
@@ -1025,11 +1070,10 @@ function Mobile(props) {
|
|
|
1025
1070
|
const { linkComponent: NavLink } = rootContext;
|
|
1026
1071
|
const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
|
|
1027
1072
|
const linkClasses = clsx([styles[`${rootClassName}__link`]]);
|
|
1028
|
-
const
|
|
1029
|
-
return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200",
|
|
1073
|
+
const currentLocation = rootContext.pathname;
|
|
1074
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", children: [
|
|
1030
1075
|
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { flexShrink: "0", children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: rootContext.appKey === "open-pages" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: "/", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: "/", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) }) }),
|
|
1031
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" },
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.jsx(Search, {}),
|
|
1076
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: [
|
|
1033
1077
|
/* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}),
|
|
1034
1078
|
/* @__PURE__ */ jsxRuntime.jsx(MyPages, {}),
|
|
1035
1079
|
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
|
|
@@ -1039,98 +1083,109 @@ function Mobile(props) {
|
|
|
1039
1083
|
] }) }) }),
|
|
1040
1084
|
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { gap: "400", size: rootContext.drawerSize, children: [
|
|
1041
1085
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { ref: drawerRef, slot: "floating", "aria-label": "Lukk" }),
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1086
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Meny" }),
|
|
1087
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchField, {}),
|
|
1088
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1089
|
+
components_tabs_index.Tabs,
|
|
1090
|
+
{
|
|
1091
|
+
value: rootContext.selectedDomainItem,
|
|
1092
|
+
onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
|
|
1093
|
+
children: [
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
|
|
1095
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
1096
|
+
var _a;
|
|
1097
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1098
|
+
components_accordion_index.Accordion,
|
|
1099
|
+
{
|
|
1100
|
+
type: "single",
|
|
1101
|
+
collapsible: true,
|
|
1102
|
+
value: rootContext.selectedMenuItem,
|
|
1103
|
+
onValueChange: (v) => rootContext.setSelectedMenuItem(v, true),
|
|
1104
|
+
children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
|
|
1105
|
+
(subLink) => {
|
|
1106
|
+
var _a2;
|
|
1107
|
+
return subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Item, { value: subLink.name, children: [
|
|
1108
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Header, { className: styles[`${rootClassName}__mobile-header`], children: [
|
|
1109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1110
|
+
components_link_link.Link,
|
|
1111
|
+
{
|
|
1112
|
+
className: linkClasses,
|
|
1113
|
+
variant: "standalone",
|
|
1114
|
+
asChild: true,
|
|
1115
|
+
onClick: () => {
|
|
1116
|
+
var _a3;
|
|
1117
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
1118
|
+
rootContext.setSelectedMenuItem(subLink.name);
|
|
1119
|
+
rootContext.setPathname(subLink.link);
|
|
1120
|
+
},
|
|
1121
|
+
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 })
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Trigger, { className: styles[`${rootClassName}__mobile-trigger`], children: /* @__PURE__ */ jsxRuntime.jsxs(components_visuallyHidden_visuallyHidden.VisuallyHidden, { children: [
|
|
1125
|
+
subLink.name,
|
|
1126
|
+
" linker"
|
|
1127
|
+
] }) })
|
|
1128
|
+
] }),
|
|
1129
|
+
/* @__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(
|
|
1130
|
+
NavigationMenu.Link,
|
|
1131
|
+
{
|
|
1132
|
+
asChild: true,
|
|
1133
|
+
variant: "small",
|
|
1134
|
+
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
|
|
1135
|
+
onClick: () => {
|
|
1136
|
+
var _a3;
|
|
1137
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
1138
|
+
rootContext.setPathname(subSubLink.link);
|
|
1139
|
+
},
|
|
1140
|
+
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: "icon" in subSubLink ? "25" : "100", align: "center", children: [
|
|
1141
|
+
subSubLink.name,
|
|
1142
|
+
"icon" in subSubLink ? /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1143
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
|
|
1144
|
+
subSubLink.name,
|
|
1145
|
+
"icon" in subSubLink ? /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1146
|
+
] }) })
|
|
1147
|
+
}
|
|
1148
|
+
) }, subSubLink.name)) }) })
|
|
1149
|
+
] }, subLink.name) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__accordion-look`], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
+
components_link_link.Link,
|
|
1151
|
+
{
|
|
1152
|
+
className: clsx([
|
|
1153
|
+
linkClasses,
|
|
1154
|
+
styles[`${rootClassName}__mobile-link--accordion-look`]
|
|
1155
|
+
]),
|
|
1156
|
+
variant: "standalone",
|
|
1157
|
+
asChild: true,
|
|
1158
|
+
onClick: () => {
|
|
1159
|
+
var _a3;
|
|
1160
|
+
(_a3 = drawerRef.current) == null ? void 0 : _a3.click();
|
|
1161
|
+
rootContext.setSelectedMenuItem(subLink.name);
|
|
1162
|
+
rootContext.setPathname(subLink.link);
|
|
1163
|
+
},
|
|
1164
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsxs(NavLink, { href: subLink.link, children: [
|
|
1165
|
+
subLink.name,
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1167
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("a", { href: subLink.link, children: [
|
|
1168
|
+
subLink.name,
|
|
1169
|
+
" ",
|
|
1170
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1171
|
+
] })
|
|
1172
|
+
}
|
|
1173
|
+
) }, subLink.name);
|
|
1174
|
+
}
|
|
1175
|
+
)
|
|
1176
|
+
}
|
|
1177
|
+
) }, link.name);
|
|
1178
|
+
}) })
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
/* @__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" }) }) })
|
|
1098
1183
|
] })
|
|
1099
1184
|
] })
|
|
1100
1185
|
] })
|
|
1101
1186
|
] }) });
|
|
1102
1187
|
}
|
|
1103
1188
|
Mobile.displayName = "Mobile";
|
|
1104
|
-
const HighlightedLinks = ({ listTitle, links, item, drawerRef }) => {
|
|
1105
|
-
const rootContext = React.useContext(RootContext);
|
|
1106
|
-
if (!rootContext)
|
|
1107
|
-
return null;
|
|
1108
|
-
const { linkComponent: NavLink } = rootContext;
|
|
1109
|
-
const currentLocation = rootContext.pathname;
|
|
1110
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1111
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listTitle }),
|
|
1112
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { gap: "10", pl: "25", children: links == null ? void 0 : links.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
-
NavigationMenu.Link,
|
|
1114
|
-
{
|
|
1115
|
-
asChild: true,
|
|
1116
|
-
variant: "small",
|
|
1117
|
-
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, item.links || []) === subSubLink.link,
|
|
1118
|
-
onClick: () => {
|
|
1119
|
-
var _a;
|
|
1120
|
-
(_a = drawerRef == null ? void 0 : drawerRef.current) == null ? void 0 : _a.click();
|
|
1121
|
-
rootContext.setPathname(subSubLink.link);
|
|
1122
|
-
},
|
|
1123
|
-
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: "icon" in subSubLink ? "25" : "100", align: "center", children: [
|
|
1124
|
-
subSubLink.name,
|
|
1125
|
-
subSubLink.icon ? /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1126
|
-
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "icon" in subSubLink ? "25" : "100", align: "center", children: [
|
|
1127
|
-
subSubLink.name,
|
|
1128
|
-
subSubLink.icon ? /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: subSubLink.icon }) : /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1129
|
-
] }) })
|
|
1130
|
-
}
|
|
1131
|
-
) }, subSubLink.name)) })
|
|
1132
|
-
] });
|
|
1133
|
-
};
|
|
1134
1189
|
const DesktopSimplified = React.forwardRef(() => {
|
|
1135
1190
|
const rootContext = React.useContext(RootContext);
|
|
1136
1191
|
if (!rootContext)
|
|
@@ -1186,7 +1241,6 @@ function Root({
|
|
|
1186
1241
|
shoppingCart,
|
|
1187
1242
|
shoppingCartNumberOfItems,
|
|
1188
1243
|
onSearchSubmit,
|
|
1189
|
-
additionalSearchContent,
|
|
1190
1244
|
isCartOpen,
|
|
1191
1245
|
onCartOpenChange,
|
|
1192
1246
|
drawerSize = "md",
|
|
@@ -1197,11 +1251,7 @@ function Root({
|
|
|
1197
1251
|
const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
|
|
1198
1252
|
const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
|
|
1199
1253
|
const [pathname, setPathname] = React.useState(currentPath || "");
|
|
1200
|
-
const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath));
|
|
1201
1254
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
1202
|
-
React.useEffect(() => {
|
|
1203
|
-
setPathname(currentPath || "");
|
|
1204
|
-
}, [currentPath]);
|
|
1205
1255
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1206
1256
|
RootContext.Provider,
|
|
1207
1257
|
{
|
|
@@ -1231,12 +1281,9 @@ function Root({
|
|
|
1231
1281
|
shoppingCart,
|
|
1232
1282
|
shoppingCartNumberOfItems,
|
|
1233
1283
|
onSearchSubmit,
|
|
1234
|
-
additionalSearchContent,
|
|
1235
1284
|
isCartOpen,
|
|
1236
1285
|
onCartOpenChange,
|
|
1237
|
-
drawerSize
|
|
1238
|
-
specifiedLink,
|
|
1239
|
-
setSpecifiedLink
|
|
1286
|
+
drawerSize
|
|
1240
1287
|
},
|
|
1241
1288
|
children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1242
1289
|
NavigationMenu,
|
|
@@ -1295,7 +1342,7 @@ function getInitialMenuItem(currentPath) {
|
|
|
1295
1342
|
const mainMenuPartOfLocation = locationArray[1];
|
|
1296
1343
|
return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
|
|
1297
1344
|
var _a2;
|
|
1298
|
-
return link.
|
|
1345
|
+
return link.link === `/${mainMenuPartOfLocation}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
|
|
1299
1346
|
})) == null ? void 0 : _f.name;
|
|
1300
1347
|
}
|
|
1301
1348
|
Root.displayName = "GlobalNavigation";
|
|
@@ -1304,7 +1351,6 @@ exports.Content = Content$2;
|
|
|
1304
1351
|
exports.Desktop = Desktop;
|
|
1305
1352
|
exports.DesktopSimplified = DesktopSimplified;
|
|
1306
1353
|
exports.GlobalNavigation = GlobalNavigation;
|
|
1307
|
-
exports.HighlightedLinks = HighlightedLinks;
|
|
1308
1354
|
exports.Item = Item$1;
|
|
1309
1355
|
exports.ItemContext = ItemContext;
|
|
1310
1356
|
exports.Mobile = Mobile;
|