@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,sCAmIC;CACF"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.0.0",
3
+ "version": "46.0.1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -254,24 +254,34 @@ class MoneyInput extends Component {
254
254
  this.props;
255
255
  const selectOptions = this.getSelectOptions();
256
256
 
257
- const getFirstOption = () => {
257
+ const getFirstSelectItem = () => {
258
258
  if (selectOptions.length !== 0) {
259
- const firstOption = selectOptions[0];
260
- if (firstOption.type === 'option') {
261
- return firstOption.value;
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
- if (firstOption.type === 'group' && firstOption.options.length !== 0) {
264
- return firstOption.options[0].value;
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 firstOption = getFirstOption();
279
+ const firstSelectItem = getFirstSelectItem();
271
280
 
272
281
  const isFixedCurrency =
273
282
  !this.state.searchQuery &&
274
- ((selectOptions.length === 1 && firstOption.currency === selectedCurrency.currency) ||
283
+ ((firstSelectItem?.hasOneCurrency &&
284
+ firstSelectItem?.currency === selectedCurrency.currency) ||
275
285
  !onCurrencyChange);
276
286
 
277
287
  const disabled = !this.props.onAmountChange;