@transferwise/components 46.0.0 → 46.0.1
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
|
@@ -8048,20 +8048,26 @@ class MoneyInput extends React.Component {
|
|
|
8048
8048
|
maxLengthOverride
|
|
8049
8049
|
} = this.props;
|
|
8050
8050
|
const selectOptions = this.getSelectOptions();
|
|
8051
|
-
const
|
|
8051
|
+
const getFirstSelectItem = () => {
|
|
8052
8052
|
if (selectOptions.length !== 0) {
|
|
8053
|
-
const
|
|
8054
|
-
if (
|
|
8055
|
-
return
|
|
8053
|
+
const firstItem = selectOptions[0];
|
|
8054
|
+
if (firstItem.type === 'option') {
|
|
8055
|
+
return {
|
|
8056
|
+
hasOneCurrency: selectOptions.length === 1,
|
|
8057
|
+
currency: firstItem.value.currency
|
|
8058
|
+
};
|
|
8056
8059
|
}
|
|
8057
|
-
if (
|
|
8058
|
-
return
|
|
8060
|
+
if (firstItem.type === 'group') {
|
|
8061
|
+
return {
|
|
8062
|
+
hasOneCurrency: firstItem.options.length === 1,
|
|
8063
|
+
currency: firstItem.options[0].value.currency
|
|
8064
|
+
};
|
|
8059
8065
|
}
|
|
8060
8066
|
}
|
|
8061
8067
|
return null;
|
|
8062
8068
|
};
|
|
8063
|
-
const
|
|
8064
|
-
const isFixedCurrency = !this.state.searchQuery && (
|
|
8069
|
+
const firstSelectItem = getFirstSelectItem();
|
|
8070
|
+
const isFixedCurrency = !this.state.searchQuery && (firstSelectItem?.hasOneCurrency && firstSelectItem?.currency === selectedCurrency.currency || !onCurrencyChange);
|
|
8065
8071
|
const disabled = !this.props.onAmountChange;
|
|
8066
8072
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8067
8073
|
className: classNames__default.default(this.style('tw-money-input'), this.style('input-group'), this.style(`input-group-${size}`)),
|