@telia/teddy 0.1.30 → 0.1.32

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,7 @@ 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;
413
+ const isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
414
414
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
415
415
  /* @__PURE__ */ jsxRuntime.jsx(
416
416
  Comp,
@@ -854,6 +854,14 @@ const ShoppingCart = React.forwardRef(() => {
854
854
  ] });
855
855
  });
856
856
  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
+ };
857
865
  const Desktop = React.forwardRef(() => {
858
866
  const rootContext = React.useContext(RootContext);
859
867
  const lastScrollDirection = React.useRef();
@@ -883,6 +891,7 @@ const Desktop = React.forwardRef(() => {
883
891
  setSelectedMenuItem(linkName || "", true);
884
892
  };
885
893
  const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
894
+ const initialLoadingState = getInitialLoadingState();
886
895
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
887
896
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
888
897
  "div",
@@ -975,6 +984,7 @@ const Desktop = React.forwardRef(() => {
975
984
  {
976
985
  onFocus: resetAndShowMenu,
977
986
  ref: viewPortRef,
987
+ ...initialLoadingState !== null ? { "data-state": initialLoadingState } : {},
978
988
  className: styles[`${rootClassName}__viewport`]
979
989
  }
980
990
  )
@@ -389,7 +389,7 @@ 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;
392
+ const isOpen = context.selectedTopMenu === props.value && props.value !== null && props.value !== "" && typeof props.value !== "undefined";
393
393
  return /* @__PURE__ */ jsxs(Fragment, { children: [
394
394
  /* @__PURE__ */ jsx(
395
395
  Comp,
@@ -833,6 +833,14 @@ const ShoppingCart = React__default.forwardRef(() => {
833
833
  ] });
834
834
  });
835
835
  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
+ };
836
844
  const Desktop = React__default.forwardRef(() => {
837
845
  const rootContext = React__default.useContext(RootContext);
838
846
  const lastScrollDirection = React__default.useRef();
@@ -862,6 +870,7 @@ const Desktop = React__default.forwardRef(() => {
862
870
  setSelectedMenuItem(linkName || "", true);
863
871
  };
864
872
  const viewPortHeight = showMenu && shouldShowViewport ? "293px" : void 0;
873
+ const initialLoadingState = getInitialLoadingState();
865
874
  return /* @__PURE__ */ jsxs(Fragment, { children: [
866
875
  /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsx(
867
876
  "div",
@@ -954,6 +963,7 @@ const Desktop = React__default.forwardRef(() => {
954
963
  {
955
964
  onFocus: resetAndShowMenu,
956
965
  ref: viewPortRef,
966
+ ...initialLoadingState !== null ? { "data-state": initialLoadingState } : {},
957
967
  className: styles[`${rootClassName}__viewport`]
958
968
  }
959
969
  )
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.1.30",
23
+ "version": "0.1.32",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"