@transferwise/components 46.0.0 → 46.0.2

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.
@@ -8014,20 +8014,26 @@ class MoneyInput extends Component {
8014
8014
  maxLengthOverride
8015
8015
  } = this.props;
8016
8016
  const selectOptions = this.getSelectOptions();
8017
- const getFirstOption = () => {
8017
+ const getFirstSelectItem = () => {
8018
8018
  if (selectOptions.length !== 0) {
8019
- const firstOption = selectOptions[0];
8020
- if (firstOption.type === 'option') {
8021
- return firstOption.value;
8019
+ const firstItem = selectOptions[0];
8020
+ if (firstItem.type === 'option') {
8021
+ return {
8022
+ hasOneCurrency: selectOptions.length === 1,
8023
+ currency: firstItem.value.currency
8024
+ };
8022
8025
  }
8023
- if (firstOption.type === 'group' && firstOption.options.length !== 0) {
8024
- return firstOption.options[0].value;
8026
+ if (firstItem.type === 'group') {
8027
+ return {
8028
+ hasOneCurrency: firstItem.options.length === 1,
8029
+ currency: firstItem.options[0].value.currency
8030
+ };
8025
8031
  }
8026
8032
  }
8027
8033
  return null;
8028
8034
  };
8029
- const firstOption = getFirstOption();
8030
- const isFixedCurrency = !this.state.searchQuery && (selectOptions.length === 1 && firstOption.currency === selectedCurrency.currency || !onCurrencyChange);
8035
+ const firstSelectItem = getFirstSelectItem();
8036
+ const isFixedCurrency = !this.state.searchQuery && (firstSelectItem?.hasOneCurrency && firstSelectItem?.currency === selectedCurrency.currency || !onCurrencyChange);
8031
8037
  const disabled = !this.props.onAmountChange;
8032
8038
  return /*#__PURE__*/jsxs("div", {
8033
8039
  className: classNames(this.style('tw-money-input'), this.style('input-group'), this.style(`input-group-${size}`)),
@@ -8069,7 +8075,7 @@ class MoneyInput extends Component {
8069
8075
  compareValues: "currency",
8070
8076
  renderValue: (currency, withinTrigger) => {
8071
8077
  return /*#__PURE__*/jsx(SelectInputOptionContent, {
8072
- title: currency.label,
8078
+ title: withinTrigger ? currency.currency.toUpperCase() : currency.label,
8073
8079
  note: withinTrigger ? undefined : currency.note,
8074
8080
  icon: /*#__PURE__*/jsx(Flag, {
8075
8081
  code: currency.currency,