@telia/teddy 0.1.22 → 0.1.24
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 +0 -2
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.js +0 -2
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.d.ts +5 -3
- package/dist/components/navigation-menu/global-navigation/utils.cjs +10 -10
- package/dist/components/navigation-menu/global-navigation/utils.d.ts +18 -18
- package/dist/components/navigation-menu/global-navigation/utils.js +10 -10
- package/dist/components/radio-card-group/radio-card-group-item-title.cjs +124 -152
- package/dist/components/radio-card-group/radio-card-group-item-title.js +124 -152
- package/dist/style.css +116 -111
- package/package.json +1 -1
|
@@ -65,7 +65,6 @@ 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");
|
|
69
68
|
function _interopNamespaceDefault(e) {
|
|
70
69
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
71
70
|
if (e) {
|
|
@@ -282,28 +281,28 @@ const Close = React.forwardRef(
|
|
|
282
281
|
);
|
|
283
282
|
Close.displayName = "Dialog.Close";
|
|
284
283
|
const Modal = Object.assign(Root$2, { Trigger: Trigger$1, Content: Content$1, Title, Overlay, Description, Close, Image, Group });
|
|
285
|
-
const scaleIn = "
|
|
286
|
-
const scaleOut = "
|
|
287
|
-
const enterFromRight = "
|
|
288
|
-
const enterFromLeft = "
|
|
289
|
-
const exitToRight = "
|
|
290
|
-
const exitToLeft = "
|
|
284
|
+
const scaleIn = "_scaleIn_19565_1";
|
|
285
|
+
const scaleOut = "_scaleOut_19565_1";
|
|
286
|
+
const enterFromRight = "_enterFromRight_19565_1";
|
|
287
|
+
const enterFromLeft = "_enterFromLeft_19565_1";
|
|
288
|
+
const exitToRight = "_exitToRight_19565_1";
|
|
289
|
+
const exitToLeft = "_exitToLeft_19565_1";
|
|
291
290
|
const styles$1 = {
|
|
292
|
-
"teddy-navigation-menu": "_teddy-navigation-
|
|
293
|
-
"teddy-navigation-menu__viewport": "_teddy-navigation-
|
|
294
|
-
"teddy-navigation-menu__separator": "_teddy-navigation-
|
|
295
|
-
"teddy-navigation-menu__list": "_teddy-navigation-
|
|
296
|
-
"teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-
|
|
297
|
-
"teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-
|
|
298
|
-
"teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--
|
|
299
|
-
"teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--
|
|
300
|
-
"teddy-navigation-menu__content": "_teddy-navigation-
|
|
301
|
-
"teddy-navigation-menu__trigger": "_teddy-navigation-
|
|
302
|
-
"teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--
|
|
303
|
-
"teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--
|
|
304
|
-
"teddy-navigation-menu__link": "_teddy-navigation-
|
|
305
|
-
"teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--
|
|
306
|
-
"teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--
|
|
291
|
+
"teddy-navigation-menu": "_teddy-navigation-menu_19565_1",
|
|
292
|
+
"teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_19565_34",
|
|
293
|
+
"teddy-navigation-menu__separator": "_teddy-navigation-menu__separator_19565_37",
|
|
294
|
+
"teddy-navigation-menu__list": "_teddy-navigation-menu__list_19565_40",
|
|
295
|
+
"teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_19565_66",
|
|
296
|
+
"teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_19565_87",
|
|
297
|
+
"teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_19565_106",
|
|
298
|
+
"teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_19565_112",
|
|
299
|
+
"teddy-navigation-menu__content": "_teddy-navigation-menu__content_19565_187",
|
|
300
|
+
"teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_19565_228",
|
|
301
|
+
"teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_19565_248",
|
|
302
|
+
"teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_19565_254",
|
|
303
|
+
"teddy-navigation-menu__link": "_teddy-navigation-menu__link_19565_322",
|
|
304
|
+
"teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_19565_342",
|
|
305
|
+
"teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_19565_348",
|
|
307
306
|
scaleIn,
|
|
308
307
|
scaleOut,
|
|
309
308
|
enterFromRight,
|
|
@@ -699,27 +698,27 @@ const NavigationMenu = Object.assign(Root$1, {
|
|
|
699
698
|
TopMenuTrigger
|
|
700
699
|
});
|
|
701
700
|
const styles = {
|
|
702
|
-
"teddy-global-navigation": "_teddy-global-
|
|
703
|
-
"teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-
|
|
704
|
-
"teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-
|
|
705
|
-
"teddy-global-navigation__mobile": "_teddy-global-
|
|
706
|
-
"teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-
|
|
707
|
-
"teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-
|
|
708
|
-
"teddy-global-navigation__link": "_teddy-global-
|
|
709
|
-
"teddy-global-navigation__header": "_teddy-global-
|
|
710
|
-
"teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-
|
|
711
|
-
"teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--
|
|
712
|
-
"teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--
|
|
713
|
-
"teddy-global-navigation__list": "_teddy-global-
|
|
714
|
-
"teddy-global-navigation__viewport": "_teddy-global-
|
|
715
|
-
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-
|
|
716
|
-
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-
|
|
717
|
-
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-
|
|
718
|
-
"close-viewport": "_close-
|
|
719
|
-
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-
|
|
720
|
-
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-
|
|
721
|
-
"teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-
|
|
722
|
-
"teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-
|
|
701
|
+
"teddy-global-navigation": "_teddy-global-navigation_1kpy3_1",
|
|
702
|
+
"teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_1kpy3_6",
|
|
703
|
+
"teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_1kpy3_9",
|
|
704
|
+
"teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_1kpy3_6",
|
|
705
|
+
"teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-wrapper_1kpy3_32",
|
|
706
|
+
"teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-icons_1kpy3_37",
|
|
707
|
+
"teddy-global-navigation__link": "_teddy-global-navigation__link_1kpy3_41",
|
|
708
|
+
"teddy-global-navigation__header": "_teddy-global-navigation__header_1kpy3_51",
|
|
709
|
+
"teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-box_1kpy3_54",
|
|
710
|
+
"teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--mobile_1kpy3_57",
|
|
711
|
+
"teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--mobile_1kpy3_61",
|
|
712
|
+
"teddy-global-navigation__list": "_teddy-global-navigation__list_1kpy3_67",
|
|
713
|
+
"teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_1kpy3_72",
|
|
714
|
+
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_1kpy3_75",
|
|
715
|
+
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_1kpy3_79",
|
|
716
|
+
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_1kpy3_86",
|
|
717
|
+
"close-viewport": "_close-viewport_1kpy3_1",
|
|
718
|
+
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_1kpy3_102",
|
|
719
|
+
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_1kpy3_105",
|
|
720
|
+
"teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_1kpy3_122",
|
|
721
|
+
"teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_1kpy3_138"
|
|
723
722
|
};
|
|
724
723
|
function MyPages(props) {
|
|
725
724
|
var _a, _b;
|
|
@@ -821,6 +820,7 @@ const SearchField = React.forwardRef(
|
|
|
821
820
|
SearchField.displayName = "SearchField";
|
|
822
821
|
function Search(props) {
|
|
823
822
|
const rootContext = React.useContext(RootContext);
|
|
823
|
+
const additionalSearchContent = rootContext == null ? void 0 : rootContext.additionalSearchContent;
|
|
824
824
|
const searchFieldRef = React.useRef(null);
|
|
825
825
|
return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
|
|
826
826
|
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
@@ -840,6 +840,7 @@ function Search(props) {
|
|
|
840
840
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
841
841
|
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
|
|
842
842
|
/* @__PURE__ */ jsxRuntime.jsx(SearchField, { ref: searchFieldRef }),
|
|
843
|
+
additionalSearchContent ? additionalSearchContent : null,
|
|
843
844
|
/* @__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" }) }) })
|
|
844
845
|
]
|
|
845
846
|
}
|
|
@@ -874,91 +875,41 @@ const ShoppingCart = React.forwardRef(() => {
|
|
|
874
875
|
] });
|
|
875
876
|
});
|
|
876
877
|
ShoppingCart.displayName = "ShoppingCart";
|
|
877
|
-
const scrollDistanceDownThreshold = 200;
|
|
878
|
-
const scrollDistanceUpThreshold = 50;
|
|
879
|
-
const ANIMATION_DURATION = 300;
|
|
880
878
|
const Desktop = React.forwardRef(() => {
|
|
881
879
|
const rootContext = React.useContext(RootContext);
|
|
882
|
-
const [hideMenu, setHideMenu] = React.useState(null);
|
|
883
880
|
const lastScrollDirection = React.useRef();
|
|
884
881
|
const scrollStartPos = React.useRef(0);
|
|
885
882
|
const lastScrollPos = React.useRef(0);
|
|
886
883
|
const topMenuRef = React.useRef(null);
|
|
887
884
|
const viewPortRef = React.useRef(null);
|
|
888
885
|
const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
|
|
889
|
-
(link) =>
|
|
886
|
+
(link) => {
|
|
887
|
+
const highlightedLinkSelected = [...link.highlightedLinks].some((highlightedLink) => highlightedLink.link === (rootContext == null ? void 0 : rootContext.pathname));
|
|
888
|
+
const linkSelected = [...link.links].some((subLink) => subLink.link === (rootContext == null ? void 0 : rootContext.pathname));
|
|
889
|
+
const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
|
|
890
|
+
return linkSelected || highlightedLinkSelected || link.links.length && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
|
|
891
|
+
}
|
|
890
892
|
);
|
|
891
|
-
const viewPortSize = utils_useSize.useSize(viewPortRef.current);
|
|
892
893
|
const topMenuSize = utils_useSize.useSize(topMenuRef.current);
|
|
893
894
|
const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
|
|
894
895
|
const viewPortHeight = shouldShowViewport ? "288px" : void 0;
|
|
895
|
-
const animationTimer = React.useRef(0);
|
|
896
|
-
const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
|
|
897
|
-
const timerRef = React.useRef(void 0);
|
|
898
|
-
React.useEffect(() => {
|
|
899
|
-
timerRef.current = setTimeout(() => {
|
|
900
|
-
setAllowAnimationOfHeight(true);
|
|
901
|
-
}, 500);
|
|
902
|
-
return () => {
|
|
903
|
-
timerRef.current && clearTimeout(timerRef.current);
|
|
904
|
-
};
|
|
905
|
-
}, []);
|
|
906
|
-
const handleScroll = () => {
|
|
907
|
-
let compensateHight = 0;
|
|
908
|
-
if (animationTimer.current > 0) {
|
|
909
|
-
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
910
|
-
if (animationTimer.current + ANIMATION_DURATION > currentTime) {
|
|
911
|
-
compensateHight = ((topMenuSize == null ? void 0 : topMenuSize.height) || 0) + ((viewPortSize == null ? void 0 : viewPortSize.height) || 0);
|
|
912
|
-
} else {
|
|
913
|
-
animationTimer.current = 0;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
const scrollY = window.scrollY;
|
|
917
|
-
const scrollDirection = scrollY > lastScrollPos.current ? "down" : "up";
|
|
918
|
-
const scrollDistance = Math.abs(scrollStartPos.current - scrollY);
|
|
919
|
-
if (scrollDirection !== lastScrollDirection.current) {
|
|
920
|
-
scrollStartPos.current = scrollY;
|
|
921
|
-
}
|
|
922
|
-
if (!hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "down" && scrollDistance > scrollDistanceDownThreshold + compensateHight) {
|
|
923
|
-
setHideMenu(true);
|
|
924
|
-
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
925
|
-
animationTimer.current = currentTime;
|
|
926
|
-
}
|
|
927
|
-
if (hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "up" && scrollDistance > scrollDistanceUpThreshold + compensateHight || scrollY === 0) {
|
|
928
|
-
setHideMenu(false);
|
|
929
|
-
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
930
|
-
animationTimer.current = currentTime;
|
|
931
|
-
}
|
|
932
|
-
lastScrollDirection.current = scrollDirection;
|
|
933
|
-
lastScrollPos.current = scrollY;
|
|
934
|
-
};
|
|
935
|
-
const throttledScrollHandler = useDebounceCallback(handleScroll, 5);
|
|
936
|
-
React.useEffect(() => {
|
|
937
|
-
window.addEventListener("scroll", throttledScrollHandler);
|
|
938
|
-
return () => {
|
|
939
|
-
window.removeEventListener("scroll", throttledScrollHandler);
|
|
940
|
-
};
|
|
941
|
-
}, [throttledScrollHandler]);
|
|
942
896
|
if (!rootContext)
|
|
943
897
|
return null;
|
|
944
898
|
function resetAndShowMenu() {
|
|
945
899
|
lastScrollDirection.current = null;
|
|
946
900
|
scrollStartPos.current = window.scrollY;
|
|
947
901
|
lastScrollPos.current = window.scrollY;
|
|
948
|
-
setHideMenu(false);
|
|
949
902
|
}
|
|
950
|
-
const { setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
903
|
+
const { hideMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
951
904
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
952
905
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
953
906
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
954
907
|
"div",
|
|
955
908
|
{
|
|
956
909
|
style: utils_generateStyling_index.mergeStyles(
|
|
957
|
-
{ ["--teddy-top-menu-height"]: topMenuHeight }
|
|
958
|
-
allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
|
|
910
|
+
{ ["--teddy-top-menu-height"]: topMenuHeight }
|
|
959
911
|
),
|
|
960
912
|
className: styles[`${rootClassName}__top-menu-wrapper`],
|
|
961
|
-
"data-state": hideMenu ? "closed" : "open",
|
|
962
913
|
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(
|
|
963
914
|
NavigationMenu.TopMenuTrigger,
|
|
964
915
|
{
|
|
@@ -980,46 +931,67 @@ const Desktop = React.forwardRef(() => {
|
|
|
980
931
|
(subLink) => {
|
|
981
932
|
var _a2, _b, _c;
|
|
982
933
|
return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.Item, { value: subLink.name, children: [
|
|
983
|
-
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,
|
|
934
|
+
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, onMouseEnter: () => {
|
|
935
|
+
setSelectedMenuItem("", true);
|
|
936
|
+
setSpecifiedLink("");
|
|
937
|
+
}, onClick: () => {
|
|
938
|
+
setSelectedMenuItem("", true);
|
|
939
|
+
setSpecifiedLink("");
|
|
940
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
984
941
|
"img",
|
|
985
942
|
{
|
|
986
943
|
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
987
944
|
draggable: "false",
|
|
988
945
|
alt: "Telia logo"
|
|
989
946
|
}
|
|
990
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
991
|
-
"
|
|
947
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
948
|
+
"a",
|
|
992
949
|
{
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
950
|
+
href: subLink.link,
|
|
951
|
+
onMouseEnter: () => {
|
|
952
|
+
setSelectedMenuItem("", true);
|
|
953
|
+
setSpecifiedLink("");
|
|
954
|
+
},
|
|
955
|
+
onClick: () => {
|
|
956
|
+
setSelectedMenuItem("", true);
|
|
957
|
+
setSpecifiedLink("");
|
|
958
|
+
},
|
|
959
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
960
|
+
"img",
|
|
961
|
+
{
|
|
962
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
963
|
+
draggable: "false",
|
|
964
|
+
alt: "Telia logo"
|
|
965
|
+
}
|
|
966
|
+
)
|
|
996
967
|
}
|
|
997
|
-
) })
|
|
968
|
+
) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
998
969
|
NavigationMenu.Trigger,
|
|
999
970
|
{
|
|
1000
971
|
asChild: true,
|
|
1001
972
|
active: currentLocation === subLink.link,
|
|
1002
|
-
|
|
973
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { onMouseEnter: () => {
|
|
1003
974
|
setSpecifiedLink(subLink.name);
|
|
1004
975
|
setSelectedMenuItem(subLink.name, true);
|
|
1005
|
-
},
|
|
1006
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: subLink.name })
|
|
976
|
+
}, children: subLink.name })
|
|
1007
977
|
}
|
|
1008
978
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
979
|
NavigationMenu.Link,
|
|
1010
980
|
{
|
|
1011
981
|
asChild: true,
|
|
1012
|
-
active: currentLocation === subLink.link,
|
|
1013
|
-
|
|
982
|
+
active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
|
|
983
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { onMouseEnter: () => {
|
|
1014
984
|
setSpecifiedLink(subLink.name);
|
|
1015
|
-
setSelectedMenuItem(subLink.name);
|
|
1016
|
-
},
|
|
1017
|
-
|
|
985
|
+
setSelectedMenuItem(subLink.name, true);
|
|
986
|
+
}, href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { onMouseEnter: () => {
|
|
987
|
+
setSpecifiedLink(subLink.name);
|
|
988
|
+
setSelectedMenuItem(subLink.name, true);
|
|
989
|
+
}, href: subLink.link, children: subLink.name })
|
|
1018
990
|
}
|
|
1019
991
|
),
|
|
1020
992
|
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1021
|
-
((_b = subLink.links) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", pt: "400", pl: "150", children: /* @__PURE__ */ jsxRuntime.jsx(HightlightedLinksDesktop, { listName: subLink.name,
|
|
1022
|
-
((_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: "
|
|
993
|
+
((_b = subLink.links) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", pt: "400", pl: "150", children: /* @__PURE__ */ jsxRuntime.jsx(HightlightedLinksDesktop, { listName: subLink.name, links: subLink.links }) }),
|
|
994
|
+
((_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", links: subLink.highlightedLinks }) })
|
|
1023
995
|
] }) })
|
|
1024
996
|
] }, subLink.name);
|
|
1025
997
|
}
|
|
@@ -1030,13 +1002,11 @@ const Desktop = React.forwardRef(() => {
|
|
|
1030
1002
|
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
|
|
1031
1003
|
] }, link.name);
|
|
1032
1004
|
}),
|
|
1033
|
-
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Separator, {}),
|
|
1034
1005
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
1006
|
"div",
|
|
1036
1007
|
{
|
|
1037
1008
|
style: utils_generateStyling_index.mergeStyles(
|
|
1038
|
-
{ ["--teddy-viewport-wrapper-height"]: viewPortHeight }
|
|
1039
|
-
allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
|
|
1009
|
+
{ ["--teddy-viewport-wrapper-height"]: viewPortHeight }
|
|
1040
1010
|
),
|
|
1041
1011
|
className: styles[`${rootClassName}__viewport-wrapper`],
|
|
1042
1012
|
"data-state": hideMenu === null ? "" : hideMenu ? "closed" : "open",
|
|
@@ -1053,16 +1023,7 @@ const Desktop = React.forwardRef(() => {
|
|
|
1053
1023
|
] });
|
|
1054
1024
|
});
|
|
1055
1025
|
Desktop.displayName = "Desktop";
|
|
1056
|
-
|
|
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
|
-
}
|
|
1065
|
-
const HightlightedLinksDesktop = ({ subLink, links, listName }) => {
|
|
1026
|
+
const HightlightedLinksDesktop = ({ links, listName }) => {
|
|
1066
1027
|
const rootContext = React.useContext(RootContext);
|
|
1067
1028
|
if (!rootContext)
|
|
1068
1029
|
return null;
|
|
@@ -1070,24 +1031,26 @@ const HightlightedLinksDesktop = ({ subLink, links, listName }) => {
|
|
|
1070
1031
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
1071
1032
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1072
1033
|
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listName }),
|
|
1073
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { className: styles[`${rootClassName}__list`], gap: "10", pl: "25", children: links == null ? void 0 : links.map(
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
subSubLink.
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
subSubLink.
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1034
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { className: styles[`${rootClassName}__list`], gap: "10", pl: "25", children: links == null ? void 0 : links.map(
|
|
1035
|
+
(subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
|
+
NavigationMenu.Link,
|
|
1037
|
+
{
|
|
1038
|
+
asChild: true,
|
|
1039
|
+
variant: "small",
|
|
1040
|
+
active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, links || []) === subSubLink.link,
|
|
1041
|
+
onClick: () => {
|
|
1042
|
+
rootContext.setPathname(subSubLink.link);
|
|
1043
|
+
},
|
|
1044
|
+
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: [
|
|
1045
|
+
subSubLink.name,
|
|
1046
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1047
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", align: "center", children: [
|
|
1048
|
+
subSubLink.name,
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
1050
|
+
] }) })
|
|
1051
|
+
}
|
|
1052
|
+
) }, subSubLink.name)
|
|
1053
|
+
) })
|
|
1091
1054
|
] });
|
|
1092
1055
|
};
|
|
1093
1056
|
function Mobile(props) {
|
|
@@ -1261,6 +1224,7 @@ function Root({
|
|
|
1261
1224
|
shoppingCart,
|
|
1262
1225
|
shoppingCartNumberOfItems,
|
|
1263
1226
|
onSearchSubmit,
|
|
1227
|
+
additionalSearchContent,
|
|
1264
1228
|
isCartOpen,
|
|
1265
1229
|
onCartOpenChange,
|
|
1266
1230
|
drawerSize = "md",
|
|
@@ -1271,8 +1235,12 @@ function Root({
|
|
|
1271
1235
|
const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
|
|
1272
1236
|
const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
|
|
1273
1237
|
const [pathname, setPathname] = React.useState(currentPath || "");
|
|
1274
|
-
const [specifiedLink, setSpecifiedLink] = React.useState(
|
|
1238
|
+
const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath));
|
|
1239
|
+
const [hideMenu, setHideMenu] = React.useState(null);
|
|
1275
1240
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
1241
|
+
React.useEffect(() => {
|
|
1242
|
+
setPathname(currentPath || "");
|
|
1243
|
+
}, [currentPath]);
|
|
1276
1244
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1277
1245
|
RootContext.Provider,
|
|
1278
1246
|
{
|
|
@@ -1302,11 +1270,13 @@ function Root({
|
|
|
1302
1270
|
shoppingCart,
|
|
1303
1271
|
shoppingCartNumberOfItems,
|
|
1304
1272
|
onSearchSubmit,
|
|
1273
|
+
additionalSearchContent,
|
|
1305
1274
|
isCartOpen,
|
|
1306
1275
|
onCartOpenChange,
|
|
1307
1276
|
drawerSize,
|
|
1308
1277
|
specifiedLink,
|
|
1309
|
-
setSpecifiedLink
|
|
1278
|
+
setSpecifiedLink,
|
|
1279
|
+
hideMenu
|
|
1310
1280
|
},
|
|
1311
1281
|
children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1312
1282
|
NavigationMenu,
|
|
@@ -1319,6 +1289,8 @@ function Root({
|
|
|
1319
1289
|
return;
|
|
1320
1290
|
setSelectedMenuItem(v);
|
|
1321
1291
|
},
|
|
1292
|
+
onMouseEnter: () => setHideMenu(false),
|
|
1293
|
+
onMouseLeave: () => setHideMenu(true),
|
|
1322
1294
|
children: [
|
|
1323
1295
|
/* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: [
|
|
1324
1296
|
isSimplified && /* @__PURE__ */ jsxRuntime.jsx(DesktopSimplified, {}),
|
|
@@ -1365,7 +1337,7 @@ function getInitialMenuItem(currentPath) {
|
|
|
1365
1337
|
const mainMenuPartOfLocation = locationArray[1];
|
|
1366
1338
|
return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
|
|
1367
1339
|
var _a2;
|
|
1368
|
-
return link.
|
|
1340
|
+
return link.name.toLowerCase() === mainMenuPartOfLocation || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
|
|
1369
1341
|
})) == null ? void 0 : _f.name;
|
|
1370
1342
|
}
|
|
1371
1343
|
Root.displayName = "GlobalNavigation";
|