@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.js CHANGED
@@ -1406,6 +1406,8 @@ var Button = forwardRef(
1406
1406
  Text_default,
1407
1407
  {
1408
1408
  lineClamp,
1409
+ whiteSpace: "nowrap",
1410
+ wordBreak: "keep-all",
1409
1411
  color: styleVar === "PRIMARY" ? "neutral0" : "neutral700",
1410
1412
  typography: sizeVar === "M" ? "body1_400" : "body2_400",
1411
1413
  children
@@ -2888,9 +2890,10 @@ var InputButton = forwardRef(
2888
2890
  "onClear",
2889
2891
  "width"
2890
2892
  ]);
2891
- const [text, setText] = useState("");
2893
+ var _a2, _b2;
2894
+ const [text, setText] = useState((_a2 = value != null ? value : defaultValue) != null ? _a2 : "");
2892
2895
  const [isHovered, setIsHovered] = useState(false);
2893
- const prevValue = useRef(value);
2896
+ const prevValue = useRef((_b2 = value != null ? value : defaultValue) != null ? _b2 : "");
2894
2897
  const convertToString = useCallback((value2) => {
2895
2898
  if (typeof value2 !== "number") {
2896
2899
  return typeof value2 === "string" ? value2 : value2.join("");
@@ -2917,24 +2920,21 @@ var InputButton = forwardRef(
2917
2920
  setIsHovered(false);
2918
2921
  };
2919
2922
  useEffect(() => {
2920
- if (defaultValue) {
2921
- const convertString = convertToString(defaultValue);
2922
- setText(convertString);
2923
+ if (prevValue.current === value) {
2924
+ return;
2923
2925
  }
2924
- }, [convertToString, defaultValue]);
2925
- useEffect(() => {
2926
- if (!(value === void 0 || value === null)) {
2927
- if (prevValue.current === value) {
2928
- return;
2929
- }
2926
+ if (value || value === "") {
2930
2927
  const convertString = convertToString(value);
2931
2928
  setText(convertString);
2932
2929
  prevValue.current = convertString;
2933
2930
  }
2934
2931
  }, [convertToString, value]);
2935
2932
  useEffect(() => {
2936
- onChange && onChange(convertToString(value != null ? value : ""));
2937
- }, [convertToString, onChange, value]);
2933
+ if (prevValue.current === value) {
2934
+ return;
2935
+ }
2936
+ onChange && onChange(convertToString(text));
2937
+ }, [convertToString, onChange, value, text]);
2938
2938
  return /* @__PURE__ */ jsx(
2939
2939
  InputWrapper,
2940
2940
  {
@@ -2948,7 +2948,7 @@ var InputButton = forwardRef(
2948
2948
  maxHeight: "40px",
2949
2949
  width,
2950
2950
  children: /* @__PURE__ */ jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2951
- /* @__PURE__ */ jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2951
+ /* @__PURE__ */ jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", value: text, ref }, rest)),
2952
2952
  /* @__PURE__ */ jsxs(Stack_default.Horizontal, { align: "center", children: [
2953
2953
  text && /* @__PURE__ */ jsx(IconButton_default, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsx(Icon_default, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
2954
2954
  rightSource