@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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.js"],"names":[],"mappings":";;;;AA+DA;IACE,wBAeC;IAZC,mBAAkD;IAClD;;;;;MAUC;IAGH,uDAaC;IAED,+CAWE;IAEF,oCAIE;IAEF,kCAyBE;IAEF,qCAgBE;IAEF,yBAGE;IAFA,mCAA0B;IAI5B,0BAEE;IAEF;;;;MAME;IAEF,0BAuBC;IAED,kBAsBC;IAED,yCAIE;IAEF,+BAKE;IAEF,+CAQE;IAEF,+BAAqE;IAErE,
|
|
1
|
+
{"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.js"],"names":[],"mappings":";;;;AA+DA;IACE,wBAeC;IAZC,mBAAkD;IAClD;;;;;MAUC;IAGH,uDAaC;IAED,+CAWE;IAEF,oCAIE;IAEF,kCAyBE;IAEF,qCAgBE;IAEF,yBAGE;IAFA,mCAA0B;IAI5B,0BAEE;IAEF;;;;MAME;IAEF,0BAuBC;IAED,kBAsBC;IAED,yCAIE;IAEF,+BAKE;IAEF,+CAQE;IAEF,+BAAqE;IAErE,sCA6IC;CACF"}
|
package/package.json
CHANGED
|
@@ -254,24 +254,34 @@ class MoneyInput extends Component {
|
|
|
254
254
|
this.props;
|
|
255
255
|
const selectOptions = this.getSelectOptions();
|
|
256
256
|
|
|
257
|
-
const
|
|
257
|
+
const getFirstSelectItem = () => {
|
|
258
258
|
if (selectOptions.length !== 0) {
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
const firstItem = selectOptions[0];
|
|
260
|
+
|
|
261
|
+
if (firstItem.type === 'option') {
|
|
262
|
+
return {
|
|
263
|
+
hasOneCurrency: selectOptions.length === 1,
|
|
264
|
+
currency: firstItem.value.currency,
|
|
265
|
+
};
|
|
262
266
|
}
|
|
263
|
-
|
|
264
|
-
|
|
267
|
+
|
|
268
|
+
if (firstItem.type === 'group') {
|
|
269
|
+
return {
|
|
270
|
+
hasOneCurrency: firstItem.options.length === 1,
|
|
271
|
+
currency: firstItem.options[0].value.currency,
|
|
272
|
+
};
|
|
265
273
|
}
|
|
266
274
|
}
|
|
275
|
+
|
|
267
276
|
return null;
|
|
268
277
|
};
|
|
269
278
|
|
|
270
|
-
const
|
|
279
|
+
const firstSelectItem = getFirstSelectItem();
|
|
271
280
|
|
|
272
281
|
const isFixedCurrency =
|
|
273
282
|
!this.state.searchQuery &&
|
|
274
|
-
((
|
|
283
|
+
((firstSelectItem?.hasOneCurrency &&
|
|
284
|
+
firstSelectItem?.currency === selectedCurrency.currency) ||
|
|
275
285
|
!onCurrencyChange);
|
|
276
286
|
|
|
277
287
|
const disabled = !this.props.onAmountChange;
|