@shoplflow/base 0.24.32 → 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
@@ -2913,9 +2915,10 @@ var InputButton = React2.forwardRef(
2913
2915
  "onClear",
2914
2916
  "width"
2915
2917
  ]);
2916
- const [text, setText] = React2.useState("");
2918
+ var _a2, _b2;
2919
+ const [text, setText] = React2.useState((_a2 = value != null ? value : defaultValue) != null ? _a2 : "");
2917
2920
  const [isHovered, setIsHovered] = React2.useState(false);
2918
- const prevValue = React2.useRef(value);
2921
+ const prevValue = React2.useRef((_b2 = value != null ? value : defaultValue) != null ? _b2 : "");
2919
2922
  const convertToString = React2.useCallback((value2) => {
2920
2923
  if (typeof value2 !== "number") {
2921
2924
  return typeof value2 === "string" ? value2 : value2.join("");
@@ -2942,24 +2945,21 @@ var InputButton = React2.forwardRef(
2942
2945
  setIsHovered(false);
2943
2946
  };
2944
2947
  React2.useEffect(() => {
2945
- if (defaultValue) {
2946
- const convertString = convertToString(defaultValue);
2947
- setText(convertString);
2948
+ if (prevValue.current === value) {
2949
+ return;
2948
2950
  }
2949
- }, [convertToString, defaultValue]);
2950
- React2.useEffect(() => {
2951
- if (!(value === void 0 || value === null)) {
2952
- if (prevValue.current === value) {
2953
- return;
2954
- }
2951
+ if (value || value === "") {
2955
2952
  const convertString = convertToString(value);
2956
2953
  setText(convertString);
2957
2954
  prevValue.current = convertString;
2958
2955
  }
2959
2956
  }, [convertToString, value]);
2960
2957
  React2.useEffect(() => {
2961
- onChange && onChange(convertToString(value != null ? value : ""));
2962
- }, [convertToString, onChange, value]);
2958
+ if (prevValue.current === value) {
2959
+ return;
2960
+ }
2961
+ onChange && onChange(convertToString(text));
2962
+ }, [convertToString, onChange, value, text]);
2963
2963
  return /* @__PURE__ */ jsxRuntime.jsx(
2964
2964
  InputWrapper,
2965
2965
  {
@@ -2973,7 +2973,7 @@ var InputButton = React2.forwardRef(
2973
2973
  maxHeight: "40px",
2974
2974
  width,
2975
2975
  children: /* @__PURE__ */ jsxRuntime.jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2976
- /* @__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)),
2977
2977
  /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2978
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" }) }),
2979
2979
  rightSource