@transferwise/components 0.0.0-experimental-ac06ea4 → 0.0.0-experimental-3cd48a3

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/build/index.mjs CHANGED
@@ -796,7 +796,7 @@ function Title({
796
796
  }
797
797
 
798
798
  function logActionRequired(message) {
799
- if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
799
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {
800
800
  // eslint-disable-next-line no-console
801
801
  console.warn(message);
802
802
  }
@@ -8817,6 +8817,12 @@ const PhoneNumberInput = ({
8817
8817
  return explodeNumberModel(cleanValue);
8818
8818
  });
8819
8819
  const [broadcastedValue, setBroadcastedValue] = useState(null);
8820
+ const [suffixDirty, setSuffixDirty] = useState(false);
8821
+ useEffect(() => {
8822
+ if (internalValue.suffix) {
8823
+ setSuffixDirty(true);
8824
+ }
8825
+ }, [internalValue.suffix]);
8820
8826
  const countriesByPrefix = useMemo(() => groupCountriesByPrefix(sortArrayByProperty(excludeCountries(countries, disabledCountries), 'iso3')), [disabledCountries]);
8821
8827
  const onSuffixChange = event => {
8822
8828
  const suffix = event.target.value;
@@ -8880,6 +8886,11 @@ const PhoneNumberInput = ({
8880
8886
  format: country?.phoneFormat
8881
8887
  }));
8882
8888
  },
8889
+ onClose: () => {
8890
+ if (suffixDirty) {
8891
+ onBlur?.();
8892
+ }
8893
+ },
8883
8894
  ...selectProps
8884
8895
  })
8885
8896
  }), /*#__PURE__*/jsx("div", {
@@ -8899,7 +8910,7 @@ const PhoneNumberInput = ({
8899
8910
  onChange: onSuffixChange,
8900
8911
  onPaste: onPaste,
8901
8912
  onFocus: onFocus,
8902
- onBlur: onBlur
8913
+ onBlur: () => onBlur?.()
8903
8914
  })
8904
8915
  })
8905
8916
  })]