@shoplflow/base 0.24.16 → 0.24.18

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/index.cjs CHANGED
@@ -942,6 +942,15 @@ var ModalProvider = ({ children }) => {
942
942
  document.body.style.cssText = "overflow:unset";
943
943
  };
944
944
  }, [openedModals.length]);
945
+ React2.useEffect(() => {
946
+ const closeAllModals = () => {
947
+ setOpenedModals([]);
948
+ };
949
+ window.addEventListener("popstate", closeAllModals);
950
+ return () => {
951
+ window.removeEventListener("popstate", closeAllModals);
952
+ };
953
+ }, []);
945
954
  return /* @__PURE__ */ jsxRuntime.jsx(exports.ModalContext.Provider, { value: openedModals, children: /* @__PURE__ */ jsxRuntime.jsx(exports.ModalHandlerContext.Provider, { value: dispatch, children }) });
946
955
  };
947
956
  var ModalProvider_default = ModalProvider;
@@ -2847,6 +2856,7 @@ var InputButton = React2.forwardRef(
2847
2856
  var _b = _a, { value, defaultValue, onChange, onClick, isSelected, disabled = false, rightSource, onClear, width } = _b, rest = __objRest(_b, ["value", "defaultValue", "onChange", "onClick", "isSelected", "disabled", "rightSource", "onClear", "width"]);
2848
2857
  const [text, setText] = React2.useState("");
2849
2858
  const [isHovered, setIsHovered] = React2.useState(false);
2859
+ const prevValue = React2.useRef(value);
2850
2860
  const convertToString = React2.useCallback((value2) => {
2851
2861
  if (typeof value2 !== "number") {
2852
2862
  return typeof value2 === "string" ? value2 : value2.join("");
@@ -2879,9 +2889,13 @@ var InputButton = React2.forwardRef(
2879
2889
  }
2880
2890
  }, [convertToString, defaultValue]);
2881
2891
  React2.useEffect(() => {
2882
- if (value) {
2892
+ if (!(value === void 0 || value === null)) {
2893
+ if (prevValue.current === value) {
2894
+ return;
2895
+ }
2883
2896
  const convertString = convertToString(value);
2884
2897
  setText(convertString);
2898
+ prevValue.current = convertString;
2885
2899
  }
2886
2900
  }, [convertToString, value]);
2887
2901
  React2.useEffect(() => {