@telia/teddy 0.1.28 → 0.1.30

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.
@@ -29,8 +29,8 @@ type RootContext = {
29
29
  setPathname: (v: string) => void;
30
30
  specifiedLink?: string;
31
31
  setSpecifiedLink: (v: string) => void;
32
- hideMenu?: boolean | null;
33
- setHideMenu: (v: boolean | null) => void;
32
+ showMenu?: boolean | null;
33
+ setShowMenu: (v: boolean) => void;
34
34
  } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize'>;
35
35
  export declare const RootContext: React.Context<RootContext | null>;
36
36
  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;
@@ -62,7 +62,7 @@ const BUSINESS_NET_LINKS = {
62
62
  icon: "doc"
63
63
  };
64
64
  const SMART_CONNECT_LINKS = {
65
- name: "Smart connect",
65
+ name: "Smart Connect",
66
66
  link: "https://teliasmartconnect.com/",
67
67
  appKey: APP_KEYS["open-pages"],
68
68
  links: [],
@@ -66,7 +66,7 @@ export declare const BUSINESS_NET_LINKS: {
66
66
  readonly icon: "doc";
67
67
  };
68
68
  export declare const SMART_CONNECT_LINKS: {
69
- readonly name: "Smart connect";
69
+ readonly name: "Smart Connect";
70
70
  readonly link: "https://teliasmartconnect.com/";
71
71
  readonly appKey: "open-pages";
72
72
  readonly links: [];
@@ -85,7 +85,7 @@ export declare const LOGGED_IN_LINKS_BUSINESS: [{
85
85
  readonly links: [];
86
86
  readonly icon: "end-user";
87
87
  }, {
88
- readonly name: "Smart connect";
88
+ readonly name: "Smart Connect";
89
89
  readonly link: "https://teliasmartconnect.com/";
90
90
  readonly appKey: "open-pages";
91
91
  readonly links: [];
@@ -135,7 +135,7 @@ export declare const LOGGED_IN_LINKS: [{
135
135
  readonly links: [];
136
136
  readonly icon: "end-user";
137
137
  }, {
138
- readonly name: "Smart connect";
138
+ readonly name: "Smart Connect";
139
139
  readonly link: "https://teliasmartconnect.com/";
140
140
  readonly appKey: "open-pages";
141
141
  readonly links: [];
@@ -60,7 +60,7 @@ const BUSINESS_NET_LINKS = {
60
60
  icon: "doc"
61
61
  };
62
62
  const SMART_CONNECT_LINKS = {
63
- name: "Smart connect",
63
+ name: "Smart Connect",
64
64
  link: "https://teliasmartconnect.com/",
65
65
  appKey: APP_KEYS["open-pages"],
66
66
  links: [],
@@ -869,7 +869,6 @@ const Desktop = React.forwardRef(() => {
869
869
  );
870
870
  const topMenuSize = utils_useSize.useSize(topMenuRef.current);
871
871
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
872
- const viewPortHeight = shouldShowViewport ? "293px" : void 0;
873
872
  if (!rootContext)
874
873
  return null;
875
874
  function resetAndShowMenu() {
@@ -877,12 +876,13 @@ const Desktop = React.forwardRef(() => {
877
876
  scrollStartPos.current = window.scrollY;
878
877
  lastScrollPos.current = window.scrollY;
879
878
  }
880
- const { hideMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
879
+ const { showMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
881
880
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
882
881
  const handleInteractions = (linkName) => {
883
882
  setSpecifiedLink(linkName || "");
884
883
  setSelectedMenuItem(linkName || "", true);
885
884
  };
885
+ const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
886
886
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
887
887
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
888
888
  "div",
@@ -969,7 +969,7 @@ const Desktop = React.forwardRef(() => {
969
969
  { ["--teddy-viewport-wrapper-height"]: viewPortHeight }
970
970
  ),
971
971
  className: styles[`${rootClassName}__viewport-wrapper`],
972
- "data-state": hideMenu === null ? "closed" : hideMenu ? "closed" : "open",
972
+ "data-state": showMenu ? "open" : "closed",
973
973
  children: /* @__PURE__ */ jsxRuntime.jsx(
974
974
  NavigationMenu.Viewport,
975
975
  {
@@ -987,7 +987,7 @@ const HightlightedLinksDesktop = ({ links, listName }) => {
987
987
  const rootContext = React.useContext(RootContext);
988
988
  if (!rootContext)
989
989
  return null;
990
- const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem, setHideMenu } = rootContext;
990
+ const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem, setShowMenu } = 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 }),
@@ -1002,7 +1002,7 @@ const HightlightedLinksDesktop = ({ links, listName }) => {
1002
1002
  rootContext.setPathname(subSubLink.link);
1003
1003
  setSpecifiedLink("");
1004
1004
  setSelectedMenuItem("", true);
1005
- setHideMenu(true);
1005
+ setShowMenu(false);
1006
1006
  },
1007
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
1008
  subSubLink.name,
@@ -1198,7 +1198,7 @@ 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 [hideMenu, setHideMenu] = React.useState(null);
1201
+ const [showMenu, setShowMenu] = React.useState(false);
1202
1202
  const classes = clsx([styles[`${rootClassName}`]], className);
1203
1203
  React.useEffect(() => {
1204
1204
  setPathname(currentPath || "");
@@ -1238,8 +1238,8 @@ function Root({
1238
1238
  drawerSize,
1239
1239
  specifiedLink,
1240
1240
  setSpecifiedLink,
1241
- hideMenu,
1242
- setHideMenu
1241
+ showMenu,
1242
+ setShowMenu
1243
1243
  },
1244
1244
  children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1245
1245
  NavigationMenu,
@@ -1252,8 +1252,8 @@ function Root({
1252
1252
  return;
1253
1253
  setSelectedMenuItem(v);
1254
1254
  },
1255
- onMouseEnter: () => setHideMenu(false),
1256
- onMouseLeave: () => setHideMenu(true),
1255
+ onMouseEnter: () => setShowMenu(true),
1256
+ onMouseLeave: () => setShowMenu(false),
1257
1257
  children: [
1258
1258
  /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: [
1259
1259
  isSimplified && /* @__PURE__ */ jsxRuntime.jsx(DesktopSimplified, {}),
@@ -848,7 +848,6 @@ const Desktop = React__default.forwardRef(() => {
848
848
  );
849
849
  const topMenuSize = useSize(topMenuRef.current);
850
850
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
851
- const viewPortHeight = shouldShowViewport ? "293px" : void 0;
852
851
  if (!rootContext)
853
852
  return null;
854
853
  function resetAndShowMenu() {
@@ -856,12 +855,13 @@ const Desktop = React__default.forwardRef(() => {
856
855
  scrollStartPos.current = window.scrollY;
857
856
  lastScrollPos.current = window.scrollY;
858
857
  }
859
- const { hideMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
858
+ const { showMenu, selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
860
859
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
861
860
  const handleInteractions = (linkName) => {
862
861
  setSpecifiedLink(linkName || "");
863
862
  setSelectedMenuItem(linkName || "", true);
864
863
  };
864
+ const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
865
865
  return /* @__PURE__ */ jsxs(Fragment, { children: [
866
866
  /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
867
867
  "div",
@@ -948,7 +948,7 @@ const Desktop = React__default.forwardRef(() => {
948
948
  { ["--teddy-viewport-wrapper-height"]: viewPortHeight }
949
949
  ),
950
950
  className: styles[`${rootClassName}__viewport-wrapper`],
951
- "data-state": hideMenu === null ? "closed" : hideMenu ? "closed" : "open",
951
+ "data-state": showMenu ? "open" : "closed",
952
952
  children: /* @__PURE__ */ jsx(
953
953
  NavigationMenu.Viewport,
954
954
  {
@@ -966,7 +966,7 @@ const HightlightedLinksDesktop = ({ links, listName }) => {
966
966
  const rootContext = React__default.useContext(RootContext);
967
967
  if (!rootContext)
968
968
  return null;
969
- const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem, setHideMenu } = rootContext;
969
+ const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem, setShowMenu } = 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 }),
@@ -981,7 +981,7 @@ const HightlightedLinksDesktop = ({ links, listName }) => {
981
981
  rootContext.setPathname(subSubLink.link);
982
982
  setSpecifiedLink("");
983
983
  setSelectedMenuItem("", true);
984
- setHideMenu(true);
984
+ setShowMenu(false);
985
985
  },
986
986
  children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(Link2, { href: subSubLink.link, children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: "100", align: "center", children: [
987
987
  subSubLink.name,
@@ -1177,7 +1177,7 @@ 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 [hideMenu, setHideMenu] = React__default.useState(null);
1180
+ const [showMenu, setShowMenu] = React__default.useState(false);
1181
1181
  const classes = clsx([styles[`${rootClassName}`]], className);
1182
1182
  useEffect(() => {
1183
1183
  setPathname(currentPath || "");
@@ -1217,8 +1217,8 @@ function Root({
1217
1217
  drawerSize,
1218
1218
  specifiedLink,
1219
1219
  setSpecifiedLink,
1220
- hideMenu,
1221
- setHideMenu
1220
+ showMenu,
1221
+ setShowMenu
1222
1222
  },
1223
1223
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1224
1224
  NavigationMenu,
@@ -1231,8 +1231,8 @@ function Root({
1231
1231
  return;
1232
1232
  setSelectedMenuItem(v);
1233
1233
  },
1234
- onMouseEnter: () => setHideMenu(false),
1235
- onMouseLeave: () => setHideMenu(true),
1234
+ onMouseEnter: () => setShowMenu(true),
1235
+ onMouseLeave: () => setShowMenu(false),
1236
1236
  children: [
1237
1237
  /* @__PURE__ */ jsxs(Box, { display: { sm: "none", lg: "block" }, children: [
1238
1238
  isSimplified && /* @__PURE__ */ jsx(DesktopSimplified, {}),
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.1.28",
23
+ "version": "0.1.30",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"