@rango-dev/ui 0.1.11-next.2 → 0.1.11-next.3

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/dist/ui.esm.js CHANGED
@@ -2728,10 +2728,10 @@ function SecondaryPage(props) {
2728
2728
  })), props.textField && (props.children == null ? void 0 : props.children(searchedFor)), !props.textField && props.children), Footer);
2729
2729
  }
2730
2730
 
2731
- var containsText = function containsText(text, searchText) {
2731
+ function containsText(text, searchText) {
2732
2732
  return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
2733
- };
2734
- var getConciseAddress = function getConciseAddress(address, maxChars, ellipsisLength) {
2733
+ }
2734
+ function getConciseAddress(address, maxChars, ellipsisLength) {
2735
2735
  if (maxChars === void 0) {
2736
2736
  maxChars = 8;
2737
2737
  }
@@ -2743,7 +2743,19 @@ var getConciseAddress = function getConciseAddress(address, maxChars, ellipsisLe
2743
2743
  var start = Math.ceil((address.length - maxChars) / 2);
2744
2744
  var end = address.length - maxChars;
2745
2745
  return "" + address.substr(start, maxChars) + '.'.repeat(ellipsisLength) + address.substr(end);
2746
- };
2746
+ }
2747
+ function limitDecimalPlaces(numberString, maxDecimalPlaces) {
2748
+ if (maxDecimalPlaces === void 0) {
2749
+ maxDecimalPlaces = 4;
2750
+ }
2751
+ var number = parseFloat(numberString);
2752
+ if (isNaN(number)) return numberString; // Return the original string if it's not a valid number
2753
+ else {
2754
+ var multiplier = Math.pow(10, maxDecimalPlaces);
2755
+ var roundedNumber = Math.round(number * multiplier) / multiplier;
2756
+ return roundedNumber.toString();
2757
+ }
2758
+ }
2747
2759
 
2748
2760
  var SpacerContainer = /*#__PURE__*/styled('div', {
2749
2761
  variants: {
@@ -4051,6 +4063,7 @@ function SwapContainer(props) {
4051
4063
  var TokenContainer = /*#__PURE__*/styled('div', {
4052
4064
  display: 'flex',
4053
4065
  alignItems: 'center',
4066
+ width: '160px',
4054
4067
  '& .amount': {
4055
4068
  fontWeight: 'bold'
4056
4069
  }
@@ -4148,7 +4161,7 @@ function SwapDetail(_ref) {
4148
4161
  logo: firstStep.fromBlockchainLogo || '',
4149
4162
  name: firstStep.fromBlockchain
4150
4163
  },
4151
- amount: swap.inputAmount
4164
+ amount: limitDecimalPlaces(swap.inputAmount)
4152
4165
  }
4153
4166
  }), React__default.createElement(Spacer, {
4154
4167
  size: 12
@@ -4167,7 +4180,7 @@ function SwapDetail(_ref) {
4167
4180
  logo: lastStep.toBlockchainLogo,
4168
4181
  name: lastStep.toBlockchain
4169
4182
  },
4170
- amount: lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || ''
4183
+ amount: limitDecimalPlaces(lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || '')
4171
4184
  }
4172
4185
  })), React__default.createElement("div", {
4173
4186
  className: "status"