@telia/teddy 0.1.32 → 0.1.34

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.
@@ -410,7 +410,10 @@ const TopMenuTrigger = React.forwardRef(
410
410
  const context = React.useContext(NavigationMenuContext);
411
411
  const innerRef = React.useRef(null);
412
412
  const ref = utils_composeRefs.useComposedRefs(innerRef, forwardRef);
413
- const isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
413
+ let isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
414
+ if (typeof window === "undefined") {
415
+ isOpen = false;
416
+ }
414
417
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
415
418
  /* @__PURE__ */ jsxRuntime.jsx(
416
419
  Comp,
@@ -539,6 +542,9 @@ const Trigger = React.forwardRef(
539
542
  );
540
543
  const innerRef = React.useRef(null);
541
544
  const ref = utils_composeRefs.useComposedRefs(forwardRef, innerRef);
545
+ if (typeof window === "undefined") {
546
+ active = false;
547
+ }
542
548
  return /* @__PURE__ */ jsxRuntime.jsx(
543
549
  NavigationMenuPrimitive__namespace.Trigger,
544
550
  {
@@ -854,14 +860,6 @@ const ShoppingCart = React.forwardRef(() => {
854
860
  ] });
855
861
  });
856
862
  ShoppingCart.displayName = "ShoppingCart";
857
- let hasUsedInitialLoadingState = false;
858
- const getInitialLoadingState = () => {
859
- if (hasUsedInitialLoadingState) {
860
- return null;
861
- }
862
- hasUsedInitialLoadingState = true;
863
- return typeof window === "undefined" ? "open" : "closed";
864
- };
865
863
  const Desktop = React.forwardRef(() => {
866
864
  const rootContext = React.useContext(RootContext);
867
865
  const lastScrollDirection = React.useRef();
@@ -891,7 +889,6 @@ const Desktop = React.forwardRef(() => {
891
889
  setSelectedMenuItem(linkName || "", true);
892
890
  };
893
891
  const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
894
- const initialLoadingState = getInitialLoadingState();
895
892
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
896
893
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
897
894
  "div",
@@ -958,7 +955,7 @@ const Desktop = React.forwardRef(() => {
958
955
  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 })
959
956
  }
960
957
  ),
961
- /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
958
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && typeof window !== "undefined" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
962
959
  ((_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 }) }),
963
960
  ((_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 }) })
964
961
  ] }) })
@@ -984,7 +981,7 @@ const Desktop = React.forwardRef(() => {
984
981
  {
985
982
  onFocus: resetAndShowMenu,
986
983
  ref: viewPortRef,
987
- ...initialLoadingState !== null ? { "data-state": initialLoadingState } : {},
984
+ ...typeof window === "undefined" ? { "data-state": "closed" } : {},
988
985
  className: styles[`${rootClassName}__viewport`]
989
986
  }
990
987
  )
@@ -389,7 +389,10 @@ const TopMenuTrigger = React__default.forwardRef(
389
389
  const context = React__default.useContext(NavigationMenuContext);
390
390
  const innerRef = React__default.useRef(null);
391
391
  const ref = useComposedRefs(innerRef, forwardRef);
392
- const isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
392
+ let isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
393
+ if (typeof window === "undefined") {
394
+ isOpen = false;
395
+ }
393
396
  return /* @__PURE__ */ jsxs(Fragment, { children: [
394
397
  /* @__PURE__ */ jsx(
395
398
  Comp,
@@ -518,6 +521,9 @@ const Trigger = React__default.forwardRef(
518
521
  );
519
522
  const innerRef = React__default.useRef(null);
520
523
  const ref = useComposedRefs(forwardRef, innerRef);
524
+ if (typeof window === "undefined") {
525
+ active = false;
526
+ }
521
527
  return /* @__PURE__ */ jsx(
522
528
  NavigationMenuPrimitive.Trigger,
523
529
  {
@@ -833,14 +839,6 @@ const ShoppingCart = React__default.forwardRef(() => {
833
839
  ] });
834
840
  });
835
841
  ShoppingCart.displayName = "ShoppingCart";
836
- let hasUsedInitialLoadingState = false;
837
- const getInitialLoadingState = () => {
838
- if (hasUsedInitialLoadingState) {
839
- return null;
840
- }
841
- hasUsedInitialLoadingState = true;
842
- return typeof window === "undefined" ? "open" : "closed";
843
- };
844
842
  const Desktop = React__default.forwardRef(() => {
845
843
  const rootContext = React__default.useContext(RootContext);
846
844
  const lastScrollDirection = React__default.useRef();
@@ -870,7 +868,6 @@ const Desktop = React__default.forwardRef(() => {
870
868
  setSelectedMenuItem(linkName || "", true);
871
869
  };
872
870
  const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
873
- const initialLoadingState = getInitialLoadingState();
874
871
  return /* @__PURE__ */ jsxs(Fragment, { children: [
875
872
  /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
876
873
  "div",
@@ -937,7 +934,7 @@ const Desktop = React__default.forwardRef(() => {
937
934
  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 })
938
935
  }
939
936
  ),
940
- /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
937
+ /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && typeof window !== "undefined" && /* @__PURE__ */ jsxs(Fragment, { children: [
941
938
  ((_b = subLink.links) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Flex, { direction: "column", pt: "400", pl: "150", children: /* @__PURE__ */ jsx(HightlightedLinksDesktop, { listName: subLink.name, links: subLink.links }) }),
942
939
  ((_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", links: subLink.highlightedLinks }) })
943
940
  ] }) })
@@ -963,7 +960,7 @@ const Desktop = React__default.forwardRef(() => {
963
960
  {
964
961
  onFocus: resetAndShowMenu,
965
962
  ref: viewPortRef,
966
- ...initialLoadingState !== null ? { "data-state": initialLoadingState } : {},
963
+ ...typeof window === "undefined" ? { "data-state": "closed" } : {},
967
964
  className: styles[`${rootClassName}__viewport`]
968
965
  }
969
966
  )
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.1.32",
23
+ "version": "0.1.34",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"