@shoplflow/base 0.24.31 → 0.24.33

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
@@ -1431,6 +1431,8 @@ var Button = React2.forwardRef(
1431
1431
  exports.Text,
1432
1432
  {
1433
1433
  lineClamp,
1434
+ whiteSpace: "nowrap",
1435
+ wordBreak: "keep-all",
1434
1436
  color: styleVar === "PRIMARY" ? "neutral0" : "neutral700",
1435
1437
  typography: sizeVar === "M" ? "body1_400" : "body2_400",
1436
1438
  children
@@ -1726,7 +1728,10 @@ exports.PopperPortal = React2.forwardRef(
1726
1728
  const { floatingStyles, setFloating, isOpen } = usePopper();
1727
1729
  const animation = initialAnimation != null ? initialAnimation : fadeInOut;
1728
1730
  const refs = useMergeRefs(ref, setFloating);
1729
- return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
1731
+ if (!isOpen) {
1732
+ return null;
1733
+ }
1734
+ return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
1730
1735
  framerMotion.motion.div,
1731
1736
  {
1732
1737
  initial: animation.initial,
@@ -2910,9 +2915,10 @@ var InputButton = React2.forwardRef(
2910
2915
  "onClear",
2911
2916
  "width"
2912
2917
  ]);
2913
- const [text, setText] = React2.useState("");
2918
+ var _a2, _b2;
2919
+ const [text, setText] = React2.useState((_a2 = value != null ? value : defaultValue) != null ? _a2 : "");
2914
2920
  const [isHovered, setIsHovered] = React2.useState(false);
2915
- const prevValue = React2.useRef(value);
2921
+ const prevValue = React2.useRef((_b2 = value != null ? value : defaultValue) != null ? _b2 : "");
2916
2922
  const convertToString = React2.useCallback((value2) => {
2917
2923
  if (typeof value2 !== "number") {
2918
2924
  return typeof value2 === "string" ? value2 : value2.join("");
@@ -2939,24 +2945,21 @@ var InputButton = React2.forwardRef(
2939
2945
  setIsHovered(false);
2940
2946
  };
2941
2947
  React2.useEffect(() => {
2942
- if (defaultValue) {
2943
- const convertString = convertToString(defaultValue);
2944
- setText(convertString);
2948
+ if (prevValue.current === value) {
2949
+ return;
2945
2950
  }
2946
- }, [convertToString, defaultValue]);
2947
- React2.useEffect(() => {
2948
- if (!(value === void 0 || value === null)) {
2949
- if (prevValue.current === value) {
2950
- return;
2951
- }
2951
+ if (value || value === "") {
2952
2952
  const convertString = convertToString(value);
2953
2953
  setText(convertString);
2954
2954
  prevValue.current = convertString;
2955
2955
  }
2956
2956
  }, [convertToString, value]);
2957
2957
  React2.useEffect(() => {
2958
- onChange && onChange(convertToString(value != null ? value : ""));
2959
- }, [convertToString, onChange, value]);
2958
+ if (prevValue.current === value) {
2959
+ return;
2960
+ }
2961
+ onChange && onChange(convertToString(text));
2962
+ }, [convertToString, onChange, value, text]);
2960
2963
  return /* @__PURE__ */ jsxRuntime.jsx(
2961
2964
  InputWrapper,
2962
2965
  {
@@ -2970,7 +2973,7 @@ var InputButton = React2.forwardRef(
2970
2973
  maxHeight: "40px",
2971
2974
  width,
2972
2975
  children: /* @__PURE__ */ jsxRuntime.jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2973
- /* @__PURE__ */ jsxRuntime.jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2976
+ /* @__PURE__ */ jsxRuntime.jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", value: text, ref }, rest)),
2974
2977
  /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2975
2978
  text && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
2976
2979
  rightSource