@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.
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 getFirstOption = () => {
8051
+ const getFirstSelectItem = () => {
8052
8052
  if (selectOptions.length !== 0) {
8053
- const firstOption = selectOptions[0];
8054
- if (firstOption.type === 'option') {
8055
- return firstOption.value;
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 (firstOption.type === 'group' && firstOption.options.length !== 0) {
8058
- return firstOption.options[0].value;
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 firstOption = getFirstOption();
8064
- const isFixedCurrency = !this.state.searchQuery && (selectOptions.length === 1 && firstOption.currency === selectedCurrency.currency || !onCurrencyChange);
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}`)),
@@ -8103,7 +8109,7 @@ class MoneyInput extends React.Component {
8103
8109
  compareValues: "currency",
8104
8110
  renderValue: (currency, withinTrigger) => {
8105
8111
  return /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContent, {
8106
- title: currency.label,
8112
+ title: withinTrigger ? currency.currency.toUpperCase() : currency.label,
8107
8113
  note: withinTrigger ? undefined : currency.note,
8108
8114
  icon: /*#__PURE__*/jsxRuntime.jsx(art.Flag, {
8109
8115
  code: currency.currency,