@telia/teddy 0.7.62 → 0.7.63

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.
@@ -905,7 +905,14 @@ const Desktop = React.forwardRef(() => {
905
905
  return (((_a = link.links) == null ? void 0 : _a.length) || 0) > 0 && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
906
906
  });
907
907
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
908
- const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
908
+ const {
909
+ selectedMenuItem,
910
+ setSelectedMenuItem,
911
+ linkComponent: Link2,
912
+ specifiedLink,
913
+ setSpecifiedLink,
914
+ hideTopMenuList
915
+ } = rootContext;
909
916
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
910
917
  const handleInteractions = (linkName) => {
911
918
  setSpecifiedLink(linkName || "");
@@ -913,7 +920,7 @@ const Desktop = React.forwardRef(() => {
913
920
  };
914
921
  const viewPortHeight = shouldShowViewport ? "333px" : void 0;
915
922
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
916
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
923
+ !hideTopMenuList && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
917
924
  "div",
918
925
  {
919
926
  style: utils_generateStyling_index.mergeStyles({ ["--teddy-top-menu-height"]: topMenuHeight }),
@@ -940,8 +947,8 @@ const Desktop = React.forwardRef(() => {
940
947
  ) }),
941
948
  links.map((link) => {
942
949
  var _a;
943
- return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.List, { value: link.name, children: (_a = link.links) == null ? void 0 : _a.map(
944
- (subLink) => /* @__PURE__ */ jsxRuntime.jsxs(
950
+ return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.List, { value: link.name, children: [
951
+ (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxRuntime.jsxs(
945
952
  NavigationMenu.Item,
946
953
  {
947
954
  value: subLink.name,
@@ -1045,13 +1052,23 @@ const Desktop = React.forwardRef(() => {
1045
1052
  ]
1046
1053
  },
1047
1054
  subLink.name
1048
- )
1049
- ) }, link.name);
1055
+ )),
1056
+ hideTopMenuList && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1057
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { style: { marginLeft: "auto" } }),
1058
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
1059
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
1060
+ ] })
1061
+ ] }, link.name);
1050
1062
  })
1051
1063
  ] });
1052
1064
  });
1053
1065
  Desktop.displayName = "Desktop";
1054
- const HightlightedLinksDesktop = ({ links, listName, colored, setShowMenu }) => {
1066
+ const HightlightedLinksDesktop = ({
1067
+ links,
1068
+ listName,
1069
+ colored,
1070
+ setShowMenu
1071
+ }) => {
1055
1072
  const rootContext = React.useContext(RootContext);
1056
1073
  if (!rootContext) return null;
1057
1074
  const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem } = rootContext;
@@ -1131,7 +1148,7 @@ function Mobile(props) {
1131
1148
  children: [
1132
1149
  /* @__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" }) }) }) }),
1133
1150
  /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, className: styles[`${rootClassName}__top-menu-icons`], children: [
1134
- /* @__PURE__ */ jsxRuntime.jsx(Search, {}),
1151
+ !rootContext.hideTopMenuList && /* @__PURE__ */ jsxRuntime.jsx(Search, {}),
1135
1152
  /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}),
1136
1153
  /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}),
1137
1154
  /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
@@ -1149,7 +1166,7 @@ function Mobile(props) {
1149
1166
  value: rootContext.selectedDomainItem,
1150
1167
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1151
1168
  children: [
1152
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: 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)) }),
1169
+ !rootContext.hideTopMenuList && /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: 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)) }),
1153
1170
  /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: links.map((link) => {
1154
1171
  var _a, _b;
1155
1172
  return /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: link.name, children: [
@@ -1321,6 +1338,7 @@ function Root({
1321
1338
  drawerSize = "md",
1322
1339
  isSimplified,
1323
1340
  customLinks,
1341
+ hideTopMenuList,
1324
1342
  currentPath,
1325
1343
  onSearchInputChange,
1326
1344
  onSearchKeyDown,
@@ -1328,10 +1346,14 @@ function Root({
1328
1346
  onClear,
1329
1347
  ...props
1330
1348
  }) {
1331
- const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath, customLinks));
1349
+ const [selectedMenuItem, setSelectedMenuItem] = React.useState(
1350
+ getInitialMenuItem(currentPath, customLinks)
1351
+ );
1332
1352
  const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath, customLinks));
1333
1353
  const [pathname, setPathname] = React.useState(currentPath || "");
1334
- const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath, customLinks));
1354
+ const [specifiedLink, setSpecifiedLink] = React.useState(
1355
+ getInitialMenuItem(currentPath, customLinks)
1356
+ );
1335
1357
  const classes = clsx([styles[`${rootClassName}`]], className);
1336
1358
  React.useEffect(() => {
1337
1359
  setPathname(currentPath || "");
@@ -1372,7 +1394,8 @@ function Root({
1372
1394
  onSearchKeyDown,
1373
1395
  searchValue,
1374
1396
  onClear,
1375
- customLinks
1397
+ customLinks,
1398
+ hideTopMenuList
1376
1399
  },
1377
1400
  children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1378
1401
  NavigationMenu,
@@ -884,7 +884,14 @@ const Desktop = React__default.forwardRef(() => {
884
884
  return (((_a = link.links) == null ? void 0 : _a.length) || 0) > 0 && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
885
885
  });
886
886
  const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
887
- const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
887
+ const {
888
+ selectedMenuItem,
889
+ setSelectedMenuItem,
890
+ linkComponent: Link2,
891
+ specifiedLink,
892
+ setSpecifiedLink,
893
+ hideTopMenuList
894
+ } = rootContext;
888
895
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
889
896
  const handleInteractions = (linkName) => {
890
897
  setSpecifiedLink(linkName || "");
@@ -892,7 +899,7 @@ const Desktop = React__default.forwardRef(() => {
892
899
  };
893
900
  const viewPortHeight = shouldShowViewport ? "333px" : void 0;
894
901
  return /* @__PURE__ */ jsxs(Fragment, { children: [
895
- /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
902
+ !hideTopMenuList && /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
896
903
  "div",
897
904
  {
898
905
  style: mergeStyles({ ["--teddy-top-menu-height"]: topMenuHeight }),
@@ -919,8 +926,8 @@ const Desktop = React__default.forwardRef(() => {
919
926
  ) }),
920
927
  links.map((link) => {
921
928
  var _a;
922
- return /* @__PURE__ */ jsx(NavigationMenu.List, { value: link.name, children: (_a = link.links) == null ? void 0 : _a.map(
923
- (subLink) => /* @__PURE__ */ jsxs(
929
+ return /* @__PURE__ */ jsxs(NavigationMenu.List, { value: link.name, children: [
930
+ (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxs(
924
931
  NavigationMenu.Item,
925
932
  {
926
933
  value: subLink.name,
@@ -1024,13 +1031,23 @@ const Desktop = React__default.forwardRef(() => {
1024
1031
  ]
1025
1032
  },
1026
1033
  subLink.name
1027
- )
1028
- ) }, link.name);
1034
+ )),
1035
+ hideTopMenuList && /* @__PURE__ */ jsxs(Fragment, { children: [
1036
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { style: { marginLeft: "auto" } }),
1037
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(ShoppingCart, {}) }),
1038
+ /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsx(MyPages, {}) })
1039
+ ] })
1040
+ ] }, link.name);
1029
1041
  })
1030
1042
  ] });
1031
1043
  });
1032
1044
  Desktop.displayName = "Desktop";
1033
- const HightlightedLinksDesktop = ({ links, listName, colored, setShowMenu }) => {
1045
+ const HightlightedLinksDesktop = ({
1046
+ links,
1047
+ listName,
1048
+ colored,
1049
+ setShowMenu
1050
+ }) => {
1034
1051
  const rootContext = React__default.useContext(RootContext);
1035
1052
  if (!rootContext) return null;
1036
1053
  const { linkComponent: Link2, setSpecifiedLink, setSelectedMenuItem } = rootContext;
@@ -1110,7 +1127,7 @@ function Mobile(props) {
1110
1127
  children: [
1111
1128
  /* @__PURE__ */ jsx(Box, { flexShrink: "0", children: /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: rootContext.appKey === "open-pages" ? /* @__PURE__ */ jsx(NavLink, { href: "/", children: /* @__PURE__ */ jsx(Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) : /* @__PURE__ */ jsx("a", { href: "/", children: /* @__PURE__ */ jsx(Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) }) }),
1112
1129
  /* @__PURE__ */ jsxs(Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, className: styles[`${rootClassName}__top-menu-icons`], children: [
1113
- /* @__PURE__ */ jsx(Search, {}),
1130
+ !rootContext.hideTopMenuList && /* @__PURE__ */ jsx(Search, {}),
1114
1131
  /* @__PURE__ */ jsx(ShoppingCart, {}),
1115
1132
  /* @__PURE__ */ jsx(MyPages, {}),
1116
1133
  /* @__PURE__ */ jsxs(Drawer, { children: [
@@ -1128,7 +1145,7 @@ function Mobile(props) {
1128
1145
  value: rootContext.selectedDomainItem,
1129
1146
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1130
1147
  children: [
1131
- /* @__PURE__ */ jsx(Tabs.List, { children: links.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1148
+ !rootContext.hideTopMenuList && /* @__PURE__ */ jsx(Tabs.List, { children: links.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1132
1149
  /* @__PURE__ */ jsx(Fragment, { children: links.map((link) => {
1133
1150
  var _a, _b;
1134
1151
  return /* @__PURE__ */ jsxs(Tabs.Content, { value: link.name, children: [
@@ -1300,6 +1317,7 @@ function Root({
1300
1317
  drawerSize = "md",
1301
1318
  isSimplified,
1302
1319
  customLinks,
1320
+ hideTopMenuList,
1303
1321
  currentPath,
1304
1322
  onSearchInputChange,
1305
1323
  onSearchKeyDown,
@@ -1307,10 +1325,14 @@ function Root({
1307
1325
  onClear,
1308
1326
  ...props
1309
1327
  }) {
1310
- const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath, customLinks));
1328
+ const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(
1329
+ getInitialMenuItem(currentPath, customLinks)
1330
+ );
1311
1331
  const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath, customLinks));
1312
1332
  const [pathname, setPathname] = React__default.useState(currentPath || "");
1313
- const [specifiedLink, setSpecifiedLink] = React__default.useState(getInitialMenuItem(currentPath, customLinks));
1333
+ const [specifiedLink, setSpecifiedLink] = React__default.useState(
1334
+ getInitialMenuItem(currentPath, customLinks)
1335
+ );
1314
1336
  const classes = clsx([styles[`${rootClassName}`]], className);
1315
1337
  useEffect(() => {
1316
1338
  setPathname(currentPath || "");
@@ -1351,7 +1373,8 @@ function Root({
1351
1373
  onSearchKeyDown,
1352
1374
  searchValue,
1353
1375
  onClear,
1354
- customLinks
1376
+ customLinks,
1377
+ hideTopMenuList
1355
1378
  },
1356
1379
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1357
1380
  NavigationMenu,
@@ -20,6 +20,7 @@ export type RootProps = React.ComponentPropsWithoutRef<'div'> & {
20
20
  drawerSize: 'md' | 'lg';
21
21
  isSimplified?: boolean;
22
22
  customLinks?: CustomLinksConfig;
23
+ hideTopMenuList?: boolean;
23
24
  currentPath: string | undefined;
24
25
  onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>, value?: string) => void;
25
26
  onSearchKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
@@ -36,9 +37,10 @@ type RootContext = {
36
37
  specifiedLink?: string;
37
38
  setSpecifiedLink: (v: string) => void;
38
39
  customLinks?: CustomLinksConfig;
40
+ hideTopMenuList?: boolean;
39
41
  } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | 'onSearchInputChange' | 'onSearchKeyDown' | 'searchValue' | 'onClear'>;
40
42
  export declare const RootContext: React.Context<RootContext | null>;
41
- export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, customLinks, currentPath, onSearchInputChange, onSearchKeyDown, searchValue, onClear, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, customLinks, hideTopMenuList, currentPath, onSearchInputChange, onSearchKeyDown, searchValue, onClear, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
42
44
  export declare namespace Root {
43
45
  var displayName: string;
44
46
  }
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=10"
21
21
  },
22
22
  "private": false,
23
- "version": "0.7.62",
23
+ "version": "0.7.63",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"