@telia/teddy 0.1.35 → 0.1.37
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-root.d.ts +0 -2
- package/dist/components/radio-card-group/radio-card-group-item-title.cjs +104 -109
- package/dist/components/radio-card-group/radio-card-group-item-title.js +104 -109
- package/dist/style.css +28 -28
- package/package.json +1 -1
|
@@ -29,8 +29,6 @@ type RootContext = {
|
|
|
29
29
|
setPathname: (v: string) => void;
|
|
30
30
|
specifiedLink?: string;
|
|
31
31
|
setSpecifiedLink: (v: string) => void;
|
|
32
|
-
showMenu?: boolean | null;
|
|
33
|
-
setShowMenu: (v: boolean) => void;
|
|
34
32
|
} & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize'>;
|
|
35
33
|
export declare const RootContext: React.Context<RootContext | null>;
|
|
36
34
|
export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, currentPath, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -681,23 +681,23 @@ const NavigationMenu = Object.assign(Root$1, {
|
|
|
681
681
|
TopMenuTrigger
|
|
682
682
|
});
|
|
683
683
|
const styles = {
|
|
684
|
-
"teddy-global-navigation": "_teddy-global-
|
|
685
|
-
"teddy-global-navigation__mobile": "_teddy-global-
|
|
686
|
-
"teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-
|
|
687
|
-
"teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-
|
|
688
|
-
"teddy-global-navigation__link": "_teddy-global-
|
|
689
|
-
"teddy-global-navigation__header": "_teddy-global-
|
|
690
|
-
"teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-
|
|
691
|
-
"teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--
|
|
692
|
-
"teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--
|
|
693
|
-
"teddy-global-navigation__list": "_teddy-global-
|
|
694
|
-
"teddy-global-navigation__viewport": "_teddy-global-
|
|
695
|
-
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-
|
|
696
|
-
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-
|
|
697
|
-
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-
|
|
698
|
-
"close-viewport": "_close-
|
|
699
|
-
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-
|
|
700
|
-
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-
|
|
684
|
+
"teddy-global-navigation": "_teddy-global-navigation_16lml_1",
|
|
685
|
+
"teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_16lml_6",
|
|
686
|
+
"teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-wrapper_16lml_26",
|
|
687
|
+
"teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-icons_16lml_31",
|
|
688
|
+
"teddy-global-navigation__link": "_teddy-global-navigation__link_16lml_35",
|
|
689
|
+
"teddy-global-navigation__header": "_teddy-global-navigation__header_16lml_48",
|
|
690
|
+
"teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-box_16lml_51",
|
|
691
|
+
"teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--mobile_16lml_54",
|
|
692
|
+
"teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--mobile_16lml_58",
|
|
693
|
+
"teddy-global-navigation__list": "_teddy-global-navigation__list_16lml_64",
|
|
694
|
+
"teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_16lml_69",
|
|
695
|
+
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_16lml_72",
|
|
696
|
+
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_16lml_76",
|
|
697
|
+
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_16lml_83",
|
|
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"
|
|
701
701
|
};
|
|
702
702
|
function MyPages(props) {
|
|
703
703
|
var _a, _b;
|
|
@@ -856,11 +856,8 @@ const ShoppingCart = React.forwardRef(() => {
|
|
|
856
856
|
ShoppingCart.displayName = "ShoppingCart";
|
|
857
857
|
const Desktop = React.forwardRef(() => {
|
|
858
858
|
const rootContext = React.useContext(RootContext);
|
|
859
|
-
const
|
|
860
|
-
const scrollStartPos = React.useRef(0);
|
|
861
|
-
const lastScrollPos = React.useRef(0);
|
|
859
|
+
const [showMenu, setShowMenu] = React.useState(false);
|
|
862
860
|
const topMenuRef = React.useRef(null);
|
|
863
|
-
const viewPortRef = React.useRef(null);
|
|
864
861
|
const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
|
|
865
862
|
(link) => {
|
|
866
863
|
const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
|
|
@@ -871,12 +868,7 @@ const Desktop = React.forwardRef(() => {
|
|
|
871
868
|
const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
|
|
872
869
|
if (!rootContext)
|
|
873
870
|
return null;
|
|
874
|
-
|
|
875
|
-
lastScrollDirection.current = null;
|
|
876
|
-
scrollStartPos.current = window.scrollY;
|
|
877
|
-
lastScrollPos.current = window.scrollY;
|
|
878
|
-
}
|
|
879
|
-
const { showMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
871
|
+
const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
880
872
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
881
873
|
const handleInteractions = (linkName) => {
|
|
882
874
|
setSpecifiedLink(linkName || "");
|
|
@@ -891,7 +883,7 @@ const Desktop = React.forwardRef(() => {
|
|
|
891
883
|
{ ["--teddy-top-menu-height"]: topMenuHeight }
|
|
892
884
|
),
|
|
893
885
|
className: styles[`${rootClassName}__top-menu-wrapper`],
|
|
894
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuList, {
|
|
886
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuList, { ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
895
887
|
NavigationMenu.TopMenuTrigger,
|
|
896
888
|
{
|
|
897
889
|
value: link.name,
|
|
@@ -907,87 +899,95 @@ const Desktop = React.forwardRef(() => {
|
|
|
907
899
|
) }),
|
|
908
900
|
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
|
|
909
901
|
var _a;
|
|
910
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
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
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
902
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
903
|
+
NavigationMenu.List,
|
|
904
|
+
{
|
|
905
|
+
value: link.name,
|
|
906
|
+
children: [
|
|
907
|
+
(_a = link.links) == null ? void 0 : _a.map(
|
|
908
|
+
(subLink) => {
|
|
909
|
+
var _a2, _b, _c;
|
|
910
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
911
|
+
NavigationMenu.Item,
|
|
912
|
+
{
|
|
913
|
+
value: subLink.name,
|
|
914
|
+
onMouseEnter: () => setShowMenu(true),
|
|
915
|
+
onMouseLeave: () => setShowMenu(false),
|
|
916
|
+
children: [
|
|
917
|
+
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: () => handleInteractions(), onClick: () => handleInteractions(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
918
|
+
"img",
|
|
919
|
+
{
|
|
920
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
921
|
+
draggable: "false",
|
|
922
|
+
alt: "Telia logo"
|
|
923
|
+
}
|
|
924
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
925
|
+
"a",
|
|
926
|
+
{
|
|
927
|
+
href: subLink.link,
|
|
928
|
+
onMouseEnter: () => handleInteractions(),
|
|
929
|
+
onClick: () => handleInteractions(),
|
|
930
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
931
|
+
"img",
|
|
932
|
+
{
|
|
933
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
934
|
+
draggable: "false",
|
|
935
|
+
alt: "Telia logo"
|
|
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
|
+
);
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
|
|
978
|
+
]
|
|
979
|
+
},
|
|
980
|
+
link.name
|
|
981
|
+
);
|
|
982
|
+
})
|
|
983
983
|
] });
|
|
984
984
|
});
|
|
985
985
|
Desktop.displayName = "Desktop";
|
|
986
|
-
const HightlightedLinksDesktop = ({ links, listName }) => {
|
|
986
|
+
const HightlightedLinksDesktop = ({ links, listName, setShowMenu }) => {
|
|
987
987
|
const rootContext = React.useContext(RootContext);
|
|
988
988
|
if (!rootContext)
|
|
989
989
|
return null;
|
|
990
|
-
const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem
|
|
990
|
+
const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem } = rootContext;
|
|
991
991
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
992
992
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
993
993
|
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listName }),
|
|
@@ -1198,7 +1198,6 @@ function Root({
|
|
|
1198
1198
|
const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
|
|
1199
1199
|
const [pathname, setPathname] = React.useState(currentPath || "");
|
|
1200
1200
|
const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath));
|
|
1201
|
-
const [showMenu, setShowMenu] = React.useState(false);
|
|
1202
1201
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
1203
1202
|
React.useEffect(() => {
|
|
1204
1203
|
setPathname(currentPath || "");
|
|
@@ -1237,9 +1236,7 @@ function Root({
|
|
|
1237
1236
|
onCartOpenChange,
|
|
1238
1237
|
drawerSize,
|
|
1239
1238
|
specifiedLink,
|
|
1240
|
-
setSpecifiedLink
|
|
1241
|
-
showMenu,
|
|
1242
|
-
setShowMenu
|
|
1239
|
+
setSpecifiedLink
|
|
1243
1240
|
},
|
|
1244
1241
|
children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1245
1242
|
NavigationMenu,
|
|
@@ -1252,8 +1249,6 @@ function Root({
|
|
|
1252
1249
|
return;
|
|
1253
1250
|
setSelectedMenuItem(v);
|
|
1254
1251
|
},
|
|
1255
|
-
onMouseEnter: () => setShowMenu(true),
|
|
1256
|
-
onMouseLeave: () => setShowMenu(false),
|
|
1257
1252
|
children: [
|
|
1258
1253
|
/* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: [
|
|
1259
1254
|
isSimplified && /* @__PURE__ */ jsxRuntime.jsx(DesktopSimplified, {}),
|
|
@@ -660,23 +660,23 @@ const NavigationMenu = Object.assign(Root$1, {
|
|
|
660
660
|
TopMenuTrigger
|
|
661
661
|
});
|
|
662
662
|
const styles = {
|
|
663
|
-
"teddy-global-navigation": "_teddy-global-
|
|
664
|
-
"teddy-global-navigation__mobile": "_teddy-global-
|
|
665
|
-
"teddy-global-navigation__top-icon-wrapper": "_teddy-global-navigation__top-icon-
|
|
666
|
-
"teddy-global-navigation__top-menu-icons": "_teddy-global-navigation__top-menu-
|
|
667
|
-
"teddy-global-navigation__link": "_teddy-global-
|
|
668
|
-
"teddy-global-navigation__header": "_teddy-global-
|
|
669
|
-
"teddy-global-navigation__colored-box": "_teddy-global-navigation__colored-
|
|
670
|
-
"teddy-global-navigation__colored-box--mobile": "_teddy-global-navigation__colored-box--
|
|
671
|
-
"teddy-global-navigation__sublink-button--mobile": "_teddy-global-navigation__sublink-button--
|
|
672
|
-
"teddy-global-navigation__list": "_teddy-global-
|
|
673
|
-
"teddy-global-navigation__viewport": "_teddy-global-
|
|
674
|
-
"teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-
|
|
675
|
-
"teddy-global-navigation__item-count": "_teddy-global-navigation__item-
|
|
676
|
-
"teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-
|
|
677
|
-
"close-viewport": "_close-
|
|
678
|
-
"teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-
|
|
679
|
-
"teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-
|
|
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"
|
|
680
680
|
};
|
|
681
681
|
function MyPages(props) {
|
|
682
682
|
var _a, _b;
|
|
@@ -835,11 +835,8 @@ const ShoppingCart = React__default.forwardRef(() => {
|
|
|
835
835
|
ShoppingCart.displayName = "ShoppingCart";
|
|
836
836
|
const Desktop = React__default.forwardRef(() => {
|
|
837
837
|
const rootContext = React__default.useContext(RootContext);
|
|
838
|
-
const
|
|
839
|
-
const scrollStartPos = React__default.useRef(0);
|
|
840
|
-
const lastScrollPos = React__default.useRef(0);
|
|
838
|
+
const [showMenu, setShowMenu] = React__default.useState(false);
|
|
841
839
|
const topMenuRef = React__default.useRef(null);
|
|
842
|
-
const viewPortRef = React__default.useRef(null);
|
|
843
840
|
const shouldShowViewport = [...PRIVATE_LINKS.links, ...BUSINESS_LINKS.links, ...MDU_LINKS.links].some(
|
|
844
841
|
(link) => {
|
|
845
842
|
const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
|
|
@@ -850,12 +847,7 @@ const Desktop = React__default.forwardRef(() => {
|
|
|
850
847
|
const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
|
|
851
848
|
if (!rootContext)
|
|
852
849
|
return null;
|
|
853
|
-
|
|
854
|
-
lastScrollDirection.current = null;
|
|
855
|
-
scrollStartPos.current = window.scrollY;
|
|
856
|
-
lastScrollPos.current = window.scrollY;
|
|
857
|
-
}
|
|
858
|
-
const { showMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
850
|
+
const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
|
|
859
851
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
860
852
|
const handleInteractions = (linkName) => {
|
|
861
853
|
setSpecifiedLink(linkName || "");
|
|
@@ -870,7 +862,7 @@ const Desktop = React__default.forwardRef(() => {
|
|
|
870
862
|
{ ["--teddy-top-menu-height"]: topMenuHeight }
|
|
871
863
|
),
|
|
872
864
|
className: styles[`${rootClassName}__top-menu-wrapper`],
|
|
873
|
-
children: /* @__PURE__ */ jsx(NavigationMenu.TopMenuList, {
|
|
865
|
+
children: /* @__PURE__ */ jsx(NavigationMenu.TopMenuList, { ref: topMenuRef, children: LINKS.map((link) => /* @__PURE__ */ jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsx(
|
|
874
866
|
NavigationMenu.TopMenuTrigger,
|
|
875
867
|
{
|
|
876
868
|
value: link.name,
|
|
@@ -886,87 +878,95 @@ const Desktop = React__default.forwardRef(() => {
|
|
|
886
878
|
) }),
|
|
887
879
|
LINKS.map((link) => {
|
|
888
880
|
var _a;
|
|
889
|
-
return /* @__PURE__ */ jsxs(
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
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
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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
|
+
);
|
|
951
|
+
}
|
|
952
|
+
),
|
|
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
|
+
})
|
|
962
962
|
] });
|
|
963
963
|
});
|
|
964
964
|
Desktop.displayName = "Desktop";
|
|
965
|
-
const HightlightedLinksDesktop = ({ links, listName }) => {
|
|
965
|
+
const HightlightedLinksDesktop = ({ links, listName, setShowMenu }) => {
|
|
966
966
|
const rootContext = React__default.useContext(RootContext);
|
|
967
967
|
if (!rootContext)
|
|
968
968
|
return null;
|
|
969
|
-
const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem
|
|
969
|
+
const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem } = rootContext;
|
|
970
970
|
const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
|
|
971
971
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
972
972
|
/* @__PURE__ */ jsx(Heading, { pl: "100", pb: "100", variant: "title-200", as: "h2", children: listName }),
|
|
@@ -1177,7 +1177,6 @@ function Root({
|
|
|
1177
1177
|
const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath));
|
|
1178
1178
|
const [pathname, setPathname] = React__default.useState(currentPath || "");
|
|
1179
1179
|
const [specifiedLink, setSpecifiedLink] = React__default.useState(getInitialMenuItem(currentPath));
|
|
1180
|
-
const [showMenu, setShowMenu] = React__default.useState(false);
|
|
1181
1180
|
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
1182
1181
|
useEffect(() => {
|
|
1183
1182
|
setPathname(currentPath || "");
|
|
@@ -1216,9 +1215,7 @@ function Root({
|
|
|
1216
1215
|
onCartOpenChange,
|
|
1217
1216
|
drawerSize,
|
|
1218
1217
|
specifiedLink,
|
|
1219
|
-
setSpecifiedLink
|
|
1220
|
-
showMenu,
|
|
1221
|
-
setShowMenu
|
|
1218
|
+
setSpecifiedLink
|
|
1222
1219
|
},
|
|
1223
1220
|
children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
|
|
1224
1221
|
NavigationMenu,
|
|
@@ -1231,8 +1228,6 @@ function Root({
|
|
|
1231
1228
|
return;
|
|
1232
1229
|
setSelectedMenuItem(v);
|
|
1233
1230
|
},
|
|
1234
|
-
onMouseEnter: () => setShowMenu(true),
|
|
1235
|
-
onMouseLeave: () => setShowMenu(false),
|
|
1236
1231
|
children: [
|
|
1237
1232
|
/* @__PURE__ */ jsxs(Box, { display: { sm: "none", lg: "block" }, children: [
|
|
1238
1233
|
isSimplified && /* @__PURE__ */ jsx(DesktopSimplified, {}),
|
package/dist/style.css
CHANGED
|
@@ -5117,41 +5117,41 @@
|
|
|
5117
5117
|
height: var(--radix-navigation-menu-viewport-height);
|
|
5118
5118
|
transform-origin: top left;
|
|
5119
5119
|
overflow: clip;
|
|
5120
|
-
}._teddy-global-
|
|
5120
|
+
}._teddy-global-navigation_16lml_1 {
|
|
5121
5121
|
position: sticky;
|
|
5122
5122
|
inset: 0 0 auto 0;
|
|
5123
5123
|
z-index: 39;
|
|
5124
5124
|
}
|
|
5125
|
-
._teddy-global-
|
|
5125
|
+
._teddy-global-navigation__mobile_16lml_6 {
|
|
5126
5126
|
padding: var(--teddy-spacing-25) var(--teddy-spacing-200);
|
|
5127
5127
|
border-bottom: var(--teddy-border-width-sm) solid var(--teddy-color-border-weak);
|
|
5128
5128
|
}
|
|
5129
5129
|
@media screen and (max-width: 335px) {
|
|
5130
|
-
._teddy-global-
|
|
5130
|
+
._teddy-global-navigation__mobile_16lml_6 {
|
|
5131
5131
|
padding: var(--teddy-spacing-25) 0;
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
|
-
._teddy-global-
|
|
5134
|
+
._teddy-global-navigation__mobile_16lml_6::before {
|
|
5135
5135
|
content: "";
|
|
5136
5136
|
display: block;
|
|
5137
5137
|
width: var(--width-for-centering-element);
|
|
5138
5138
|
}
|
|
5139
|
-
._teddy-global-
|
|
5139
|
+
._teddy-global-navigation__mobile_16lml_6::after {
|
|
5140
5140
|
content: "";
|
|
5141
5141
|
display: block;
|
|
5142
5142
|
width: var(--width-for-centering-element);
|
|
5143
5143
|
}
|
|
5144
5144
|
@media screen and (max-width: 335px) {
|
|
5145
|
-
._teddy-global-navigation__top-icon-
|
|
5145
|
+
._teddy-global-navigation__top-icon-wrapper_16lml_26 {
|
|
5146
5146
|
gap: 0;
|
|
5147
5147
|
}
|
|
5148
5148
|
}
|
|
5149
5149
|
@media screen and (max-width: 335px) {
|
|
5150
|
-
._teddy-global-navigation__top-menu-
|
|
5150
|
+
._teddy-global-navigation__top-menu-icons_16lml_31 {
|
|
5151
5151
|
gap: 0;
|
|
5152
5152
|
}
|
|
5153
5153
|
}
|
|
5154
|
-
._teddy-global-
|
|
5154
|
+
._teddy-global-navigation__link_16lml_35 {
|
|
5155
5155
|
text-decoration: none;
|
|
5156
5156
|
display: flex;
|
|
5157
5157
|
justify-content: space-between;
|
|
@@ -5161,81 +5161,81 @@
|
|
|
5161
5161
|
font-weight: var(--teddy-typography-weight-bold);
|
|
5162
5162
|
font-size: var(--teddy-typography-scale-400);
|
|
5163
5163
|
}
|
|
5164
|
-
._teddy-global-
|
|
5164
|
+
._teddy-global-navigation__link_16lml_35:hover {
|
|
5165
5165
|
background-color: var(--teddy-color-background-interactive-transparent-hover);
|
|
5166
5166
|
}
|
|
5167
|
-
._teddy-global-
|
|
5167
|
+
._teddy-global-navigation__header_16lml_48 {
|
|
5168
5168
|
color: var(--teddy-color-text-interactive-primary);
|
|
5169
5169
|
}
|
|
5170
|
-
._teddy-global-navigation__colored-
|
|
5170
|
+
._teddy-global-navigation__colored-box_16lml_51 {
|
|
5171
5171
|
background-color: var(--teddy-color-background-secondary);
|
|
5172
5172
|
}
|
|
5173
|
-
._teddy-global-navigation__colored-box--
|
|
5173
|
+
._teddy-global-navigation__colored-box--mobile_16lml_54 {
|
|
5174
5174
|
margin: 0 -1.5rem;
|
|
5175
5175
|
background-color: var(--teddy-color-background-secondary);
|
|
5176
5176
|
}
|
|
5177
|
-
._teddy-global-navigation__sublink-button--
|
|
5177
|
+
._teddy-global-navigation__sublink-button--mobile_16lml_58 {
|
|
5178
5178
|
background-color: transparent;
|
|
5179
5179
|
padding: 0;
|
|
5180
5180
|
color: var(--teddy-color-text-interactive-primary);
|
|
5181
5181
|
border-radius: unset;
|
|
5182
5182
|
}
|
|
5183
|
-
._teddy-global-
|
|
5183
|
+
._teddy-global-navigation__list_16lml_64 {
|
|
5184
5184
|
column-count: 2;
|
|
5185
5185
|
max-height: 13rem;
|
|
5186
5186
|
column-gap: var(--teddy-spacing-300);
|
|
5187
5187
|
}
|
|
5188
|
-
._teddy-global-
|
|
5188
|
+
._teddy-global-navigation__viewport_16lml_69._teddy-global-navigation__viewport_16lml_69 {
|
|
5189
5189
|
height: var(--teddy-viewport-wrapper-height);
|
|
5190
5190
|
}
|
|
5191
|
-
._teddy-global-navigation__item-
|
|
5191
|
+
._teddy-global-navigation__item-wrapper_16lml_72 {
|
|
5192
5192
|
position: relative;
|
|
5193
5193
|
display: flex;
|
|
5194
5194
|
}
|
|
5195
|
-
._teddy-global-navigation__item-
|
|
5195
|
+
._teddy-global-navigation__item-count_16lml_76 {
|
|
5196
5196
|
display: flex;
|
|
5197
5197
|
justify-content: center;
|
|
5198
5198
|
align-items: center;
|
|
5199
5199
|
position: absolute;
|
|
5200
5200
|
transform: translate(calc(var(--teddy-spacing-150) + var(--teddy-spacing-25)), calc(-1 * var(--teddy-spacing-100) + var(--teddy-spacing-10)));
|
|
5201
5201
|
}
|
|
5202
|
-
._teddy-global-navigation__viewport-
|
|
5202
|
+
._teddy-global-navigation__viewport-wrapper_16lml_83 {
|
|
5203
5203
|
position: absolute;
|
|
5204
|
-
top: 112px;
|
|
5205
5204
|
left: 0;
|
|
5206
5205
|
width: 100%;
|
|
5207
5206
|
overflow: hidden;
|
|
5208
5207
|
transition: max-height var(--teddy-motion-duration-controlled, 0) ease;
|
|
5209
5208
|
box-shadow: var(--teddy-shadow-md);
|
|
5209
|
+
background-color: var(--teddy-color-background-primary);
|
|
5210
5210
|
}
|
|
5211
|
-
._teddy-global-navigation__viewport-
|
|
5211
|
+
._teddy-global-navigation__viewport-wrapper_16lml_83[data-state=open] {
|
|
5212
5212
|
max-height: var(--teddy-viewport-wrapper-height);
|
|
5213
5213
|
}
|
|
5214
|
-
._teddy-global-navigation__viewport-
|
|
5214
|
+
._teddy-global-navigation__viewport-wrapper_16lml_83[data-state=closed] {
|
|
5215
5215
|
max-height: 0;
|
|
5216
|
-
animation: _close-
|
|
5216
|
+
animation: _close-viewport_16lml_1 var(--teddy-motion-duration-controlled, 0) ease;
|
|
5217
5217
|
}
|
|
5218
|
-
._teddy-global-navigation__top-menu-
|
|
5218
|
+
._teddy-global-navigation__top-menu-color_16lml_99 {
|
|
5219
5219
|
background-color: var(--teddy-color-background-secondary);
|
|
5220
5220
|
}
|
|
5221
|
-
._teddy-global-navigation__top-menu-
|
|
5221
|
+
._teddy-global-navigation__top-menu-wrapper_16lml_102 {
|
|
5222
5222
|
overflow: hidden;
|
|
5223
5223
|
max-width: 84rem;
|
|
5224
5224
|
transition: max-height var(--teddy-motion-duration-controlled, 0) ease;
|
|
5225
5225
|
margin: 0 var(--teddy-spacing-600);
|
|
5226
5226
|
}
|
|
5227
5227
|
@media (min-width: 1440px) {
|
|
5228
|
-
._teddy-global-navigation__top-menu-
|
|
5228
|
+
._teddy-global-navigation__top-menu-wrapper_16lml_102 {
|
|
5229
5229
|
margin: 0 auto;
|
|
5230
5230
|
}
|
|
5231
5231
|
}
|
|
5232
|
-
._teddy-global-navigation__top-menu-
|
|
5232
|
+
._teddy-global-navigation__top-menu-wrapper_16lml_102[data-state=open] {
|
|
5233
5233
|
max-height: var(--teddy-top-menu-height, 47px);
|
|
5234
5234
|
}
|
|
5235
|
-
._teddy-global-navigation__top-menu-
|
|
5235
|
+
._teddy-global-navigation__top-menu-wrapper_16lml_102[data-state=closed] {
|
|
5236
5236
|
max-height: 0;
|
|
5237
5237
|
}
|
|
5238
|
-
@keyframes _close-
|
|
5238
|
+
@keyframes _close-viewport_16lml_1 {
|
|
5239
5239
|
0% {
|
|
5240
5240
|
max-height: var(--teddy-viewport-wrapper-height);
|
|
5241
5241
|
}
|