@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.
@@ -1,2 +1,3 @@
1
- export declare const containsText: (text: string, searchText: string) => boolean;
2
- export declare const getConciseAddress: (address: string | null, maxChars?: number, ellipsisLength?: number) => string | null;
1
+ export declare function containsText(text: string, searchText: string): boolean;
2
+ export declare function getConciseAddress(address: string | null, maxChars?: number, ellipsisLength?: number): string | null;
3
+ export declare function limitDecimalPlaces(numberString: string, maxDecimalPlaces?: number): string;
@@ -2735,10 +2735,10 @@ function SecondaryPage(props) {
2735
2735
  })), props.textField && (props.children == null ? void 0 : props.children(searchedFor)), !props.textField && props.children), Footer);
2736
2736
  }
2737
2737
 
2738
- var containsText = function containsText(text, searchText) {
2738
+ function containsText(text, searchText) {
2739
2739
  return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
2740
- };
2741
- var getConciseAddress = function getConciseAddress(address, maxChars, ellipsisLength) {
2740
+ }
2741
+ function getConciseAddress(address, maxChars, ellipsisLength) {
2742
2742
  if (maxChars === void 0) {
2743
2743
  maxChars = 8;
2744
2744
  }
@@ -2750,7 +2750,19 @@ var getConciseAddress = function getConciseAddress(address, maxChars, ellipsisLe
2750
2750
  var start = Math.ceil((address.length - maxChars) / 2);
2751
2751
  var end = address.length - maxChars;
2752
2752
  return "" + address.substr(start, maxChars) + '.'.repeat(ellipsisLength) + address.substr(end);
2753
- };
2753
+ }
2754
+ function limitDecimalPlaces(numberString, maxDecimalPlaces) {
2755
+ if (maxDecimalPlaces === void 0) {
2756
+ maxDecimalPlaces = 4;
2757
+ }
2758
+ var number = parseFloat(numberString);
2759
+ if (isNaN(number)) return numberString; // Return the original string if it's not a valid number
2760
+ else {
2761
+ var multiplier = Math.pow(10, maxDecimalPlaces);
2762
+ var roundedNumber = Math.round(number * multiplier) / multiplier;
2763
+ return roundedNumber.toString();
2764
+ }
2765
+ }
2754
2766
 
2755
2767
  var SpacerContainer = /*#__PURE__*/styled('div', {
2756
2768
  variants: {
@@ -4057,6 +4069,7 @@ function SwapContainer(props) {
4057
4069
  var TokenContainer = /*#__PURE__*/styled('div', {
4058
4070
  display: 'flex',
4059
4071
  alignItems: 'center',
4072
+ width: '160px',
4060
4073
  '& .amount': {
4061
4074
  fontWeight: 'bold'
4062
4075
  }
@@ -4154,7 +4167,7 @@ function SwapDetail(_ref) {
4154
4167
  logo: firstStep.fromBlockchainLogo || '',
4155
4168
  name: firstStep.fromBlockchain
4156
4169
  },
4157
- amount: swap.inputAmount
4170
+ amount: limitDecimalPlaces(swap.inputAmount)
4158
4171
  }
4159
4172
  }), React__default.createElement(Spacer, {
4160
4173
  size: 12
@@ -4173,7 +4186,7 @@ function SwapDetail(_ref) {
4173
4186
  logo: lastStep.toBlockchainLogo,
4174
4187
  name: lastStep.toBlockchain
4175
4188
  },
4176
- amount: lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || ''
4189
+ amount: limitDecimalPlaces(lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || '')
4177
4190
  }
4178
4191
  })), React__default.createElement("div", {
4179
4192
  className: "status"