@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.js CHANGED
@@ -826,7 +826,7 @@ function Title({
826
826
  }
827
827
 
828
828
  function logActionRequired(message) {
829
- if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
829
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {
830
830
  // eslint-disable-next-line no-console
831
831
  console.warn(message);
832
832
  }
@@ -8847,6 +8847,12 @@ const PhoneNumberInput = ({
8847
8847
  return explodeNumberModel(cleanValue);
8848
8848
  });
8849
8849
  const [broadcastedValue, setBroadcastedValue] = React.useState(null);
8850
+ const [suffixDirty, setSuffixDirty] = React.useState(false);
8851
+ React.useEffect(() => {
8852
+ if (internalValue.suffix) {
8853
+ setSuffixDirty(true);
8854
+ }
8855
+ }, [internalValue.suffix]);
8850
8856
  const countriesByPrefix = React.useMemo(() => groupCountriesByPrefix(sortArrayByProperty(excludeCountries(countries, disabledCountries), 'iso3')), [disabledCountries]);
8851
8857
  const onSuffixChange = event => {
8852
8858
  const suffix = event.target.value;
@@ -8910,6 +8916,11 @@ const PhoneNumberInput = ({
8910
8916
  format: country?.phoneFormat
8911
8917
  }));
8912
8918
  },
8919
+ onClose: () => {
8920
+ if (suffixDirty) {
8921
+ onBlur?.();
8922
+ }
8923
+ },
8913
8924
  ...selectProps
8914
8925
  })
8915
8926
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -8929,7 +8940,7 @@ const PhoneNumberInput = ({
8929
8940
  onChange: onSuffixChange,
8930
8941
  onPaste: onPaste,
8931
8942
  onFocus: onFocus,
8932
- onBlur: onBlur
8943
+ onBlur: () => onBlur?.()
8933
8944
  })
8934
8945
  })
8935
8946
  })]