@rango-dev/ui 0.1.10 → 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: {
@@ -3070,7 +3082,7 @@ function TokenList(props) {
3070
3082
  };
3071
3083
  var isSelected = function isSelected(token) {
3072
3084
  if (multiSelect && selectedList) {
3073
- return selectedList === 'all' || selectedList.map(function (item) {
3085
+ return selectedList.map(function (item) {
3074
3086
  return item.symbol + item.address;
3075
3087
  }).indexOf(token.symbol + token.address) > -1;
3076
3088
  }
@@ -3121,15 +3133,12 @@ function TokenList(props) {
3121
3133
  });
3122
3134
  }
3123
3135
 
3124
- var Container$1 = /*#__PURE__*/styled('div', {
3125
- flex: '1'
3126
- });
3127
3136
  var LoaderContainer = /*#__PURE__*/styled('div', {
3128
3137
  display: 'flex',
3129
3138
  justifyContent: 'center',
3130
3139
  width: '100%',
3131
- position: 'absolute',
3132
- top: '50%'
3140
+ paddingTop: '5%',
3141
+ flex: 1
3133
3142
  });
3134
3143
  var filterTokens = function filterTokens(list, searchedFor) {
3135
3144
  return list.filter(function (token) {
@@ -3140,33 +3149,29 @@ function TokenSelector(props) {
3140
3149
  var list = props.list,
3141
3150
  type = props.type,
3142
3151
  selected = props.selected,
3143
- onChange = props.onChange,
3144
3152
  hasHeader = props.hasHeader,
3145
- multiSelect = props.multiSelect,
3146
- selectedList = props.selectedList,
3153
+ onChange = props.onChange,
3147
3154
  onBack = props.onBack,
3148
3155
  loadingStatus = props.loadingStatus;
3149
3156
  return React__default.createElement(SecondaryPage, {
3150
3157
  textField: true,
3151
- textFieldPlaceholder: "Search Blockchain By Name",
3152
- title: "Select " + type + " Token",
3153
3158
  hasHeader: hasHeader,
3154
- onBack: onBack
3159
+ title: "Select " + type + " Token",
3160
+ onBack: onBack,
3161
+ textFieldPlaceholder: "Search Token By Name"
3155
3162
  }, function (searchedFor) {
3156
3163
  var filteredTokens = filterTokens(list, searchedFor);
3157
- return React__default.createElement(Container$1, null, loadingStatus === 'loading' && React__default.createElement(LoaderContainer, null, React__default.createElement(Spinner, {
3164
+ return loadingStatus === 'loading' ? React__default.createElement(LoaderContainer, null, React__default.createElement(Spinner, {
3158
3165
  size: 24
3159
- })), loadingStatus === 'failed' && React__default.createElement(LoadingFailedAlert, null), loadingStatus === 'success' && React__default.createElement(React__default.Fragment, null, filteredTokens.length ? React__default.createElement(TokenList, {
3166
+ })) : loadingStatus === 'failed' ? React__default.createElement(LoadingFailedAlert, null) : filteredTokens.length ? React__default.createElement(TokenList, {
3160
3167
  searchedText: searchedFor,
3161
3168
  list: filteredTokens,
3162
3169
  selected: selected,
3163
- selectedList: selectedList,
3164
- multiSelect: multiSelect,
3165
3170
  onChange: onChange
3166
3171
  }) : React__default.createElement(NotFoundAlert, {
3167
3172
  catergory: "Token",
3168
3173
  searchedFor: searchedFor
3169
- })));
3174
+ });
3170
3175
  });
3171
3176
  }
3172
3177
 
@@ -3323,15 +3328,13 @@ var ModalHeader = /*#__PURE__*/styled('div', {
3323
3328
  position: 'relative',
3324
3329
  marginBottom: '$16'
3325
3330
  });
3326
- var ContentContainer$1 = /*#__PURE__*/styled('div', {});
3327
3331
  function Modal(props) {
3328
3332
  var title = props.title,
3329
3333
  content = props.content,
3330
3334
  open = props.open,
3331
3335
  onClose = props.onClose,
3332
3336
  containerStyle = props.containerStyle,
3333
- action = props.action,
3334
- contentStyle = props.contentStyle;
3337
+ action = props.action;
3335
3338
  var handleBackDropClick = function handleBackDropClick(event) {
3336
3339
  if (event.target === event.currentTarget) onClose();
3337
3340
  };
@@ -3347,9 +3350,7 @@ function Modal(props) {
3347
3350
  }, title), React__default.createElement(Row, null, action, React__default.createElement(CloseIcon, {
3348
3351
  size: 24,
3349
3352
  onClick: onClose
3350
- }))), React__default.createElement(ContentContainer$1, {
3351
- style: contentStyle
3352
- }, content))), document.body));
3353
+ }))), content)), document.body));
3353
3354
  }
3354
3355
 
3355
3356
  var WalletState;
@@ -3727,7 +3728,7 @@ var SolidCircle = /*#__PURE__*/styled('div', {
3727
3728
  }
3728
3729
  }
3729
3730
  });
3730
- var Container$2 = /*#__PURE__*/styled('div', {
3731
+ var Container$1 = /*#__PURE__*/styled('div', {
3731
3732
  border: '1.5px solid',
3732
3733
  borderRadius: '$5',
3733
3734
  padding: '$12',
@@ -3774,7 +3775,7 @@ function SelectableWalletList(_ref) {
3774
3775
  }, [list]);
3775
3776
  return React__default.createElement(Row$1, null, list.map(function (w, index) {
3776
3777
  var checked = active === w.walletType;
3777
- return React__default.createElement(Container$2, {
3778
+ return React__default.createElement(Container$1, {
3778
3779
  checked: checked,
3779
3780
  onClick: onClick.bind(null, w),
3780
3781
  key: index
@@ -3827,7 +3828,7 @@ var StyledItem = /*#__PURE__*/styled(Item, {
3827
3828
  borderColor: '$neutrals600'
3828
3829
  }
3829
3830
  });
3830
- var Container$3 = /*#__PURE__*/styled('div', {
3831
+ var Container$2 = /*#__PURE__*/styled('div', {
3831
3832
  display: 'flex'
3832
3833
  });
3833
3834
  var StyledIndicator = /*#__PURE__*/styled(Indicator$1, {
@@ -3857,7 +3858,7 @@ function Radio(props) {
3857
3858
  _props$direction = props.direction,
3858
3859
  direction = _props$direction === void 0 ? 'vertical' : _props$direction,
3859
3860
  style = props.style;
3860
- return React__default.createElement(Container$3, null, React__default.createElement(StyledRoot, {
3861
+ return React__default.createElement(Container$2, null, React__default.createElement(StyledRoot, {
3861
3862
  onValueChange: onChange,
3862
3863
  value: value,
3863
3864
  direction: direction,
@@ -4062,6 +4063,7 @@ function SwapContainer(props) {
4062
4063
  var TokenContainer = /*#__PURE__*/styled('div', {
4063
4064
  display: 'flex',
4064
4065
  alignItems: 'center',
4066
+ width: '160px',
4065
4067
  '& .amount': {
4066
4068
  fontWeight: 'bold'
4067
4069
  }
@@ -4104,7 +4106,7 @@ function Token(props) {
4104
4106
  }), props.data.token.symbol);
4105
4107
  }
4106
4108
 
4107
- var Container$4 = /*#__PURE__*/styled('div', {
4109
+ var Container$3 = /*#__PURE__*/styled('div', {
4108
4110
  position: 'relative',
4109
4111
  display: 'flex',
4110
4112
  justifyContent: 'space-between',
@@ -4144,7 +4146,7 @@ function SwapDetail(_ref) {
4144
4146
  size: "free",
4145
4147
  fullWidth: true,
4146
4148
  onClick: onClick.bind(null, swap.requestId)
4147
- }, React__default.createElement(Container$4, {
4149
+ }, React__default.createElement(Container$3, {
4148
4150
  className: "" + status
4149
4151
  }, React__default.createElement("div", {
4150
4152
  className: "info"
@@ -4156,10 +4158,10 @@ function SwapDetail(_ref) {
4156
4158
  },
4157
4159
  blockchain: {
4158
4160
  // @ts-ignore
4159
- logo: firstStep.fromBlockchainLogo,
4161
+ logo: firstStep.fromBlockchainLogo || '',
4160
4162
  name: firstStep.fromBlockchain
4161
4163
  },
4162
- amount: swap.inputAmount
4164
+ amount: limitDecimalPlaces(swap.inputAmount)
4163
4165
  }
4164
4166
  }), React__default.createElement(Spacer, {
4165
4167
  size: 12
@@ -4178,7 +4180,7 @@ function SwapDetail(_ref) {
4178
4180
  logo: lastStep.toBlockchainLogo,
4179
4181
  name: lastStep.toBlockchain
4180
4182
  },
4181
- amount: lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || ''
4183
+ amount: limitDecimalPlaces(lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable || '')
4182
4184
  }
4183
4185
  })), React__default.createElement("div", {
4184
4186
  className: "status"
@@ -4188,7 +4190,7 @@ function SwapDetail(_ref) {
4188
4190
  }) : status)));
4189
4191
  }
4190
4192
 
4191
- var Container$5 = /*#__PURE__*/styled('div', {
4193
+ var Container$4 = /*#__PURE__*/styled('div', {
4192
4194
  position: 'relative'
4193
4195
  });
4194
4196
  var Color = /*#__PURE__*/styled('div', {
@@ -4238,7 +4240,7 @@ function ColorPicker(_ref) {
4238
4240
  var _useState = useState(false),
4239
4241
  displayColorPicker = _useState[0],
4240
4242
  setDisplayColorPicker = _useState[1];
4241
- return React__default.createElement(Container$5, null, React__default.createElement(Label$3, {
4243
+ return React__default.createElement(Container$4, null, React__default.createElement(Label$3, {
4242
4244
  className: "_text"
4243
4245
  }, label), React__default.createElement(Button, {
4244
4246
  variant: "outlined",
@@ -4377,7 +4379,7 @@ var AlertContainer = /*#__PURE__*/styled('div', {
4377
4379
  var ConfirmButton = /*#__PURE__*/styled(Button, {
4378
4380
  marginTop: '$16'
4379
4381
  });
4380
- var Container$6 = /*#__PURE__*/styled('div', {
4382
+ var Container$5 = /*#__PURE__*/styled('div', {
4381
4383
  paddingBottom: '$24',
4382
4384
  '.title': {
4383
4385
  paddingBottom: '$8',
@@ -4447,7 +4449,7 @@ function ConfirmSwap(props) {
4447
4449
  var list = selectableWallets.filter(function (w) {
4448
4450
  return wallet === w.chain;
4449
4451
  });
4450
- return React__default.createElement(Container$6, {
4452
+ return React__default.createElement(Container$5, {
4451
4453
  key: index
4452
4454
  }, React__default.createElement("div", {
4453
4455
  className: "title"
@@ -4478,7 +4480,7 @@ var Group = /*#__PURE__*/styled('div', {
4478
4480
  textTransform: 'uppercase'
4479
4481
  }
4480
4482
  });
4481
- var Container$7 = /*#__PURE__*/styled('div', {
4483
+ var Container$6 = /*#__PURE__*/styled('div', {
4482
4484
  overflowY: 'auto'
4483
4485
  });
4484
4486
  var filteredHistory = function filteredHistory(list, searchedFor) {
@@ -4532,7 +4534,7 @@ function History(_ref) {
4532
4534
  title: "Swaps"
4533
4535
  }, function (searchedFor) {
4534
4536
  var filterSwaps = filteredHistory(list, searchedFor);
4535
- return React__default.createElement(Container$7, null, filterSwaps.length ? React__default.createElement(SwapsGroup, {
4537
+ return React__default.createElement(Container$6, null, filterSwaps.length ? React__default.createElement(SwapsGroup, {
4536
4538
  list: filterSwaps,
4537
4539
  onSwapClick: onSwapClick,
4538
4540
  groupBy: groupBy
@@ -4780,14 +4782,13 @@ function SwapHistory(props) {
4780
4782
  logo: step.fromLogo,
4781
4783
  symbol: step.fromSymbol,
4782
4784
  // @ts-ignore
4783
- chainLogo: step.fromBlockchainLogo,
4785
+ chainLogo: step.fromBlockchainLogo || '',
4784
4786
  blockchain: step.fromBlockchain,
4785
4787
  amount: pendingSwap.inputAmount
4786
- }), React__default.createElement(Dot$1, null)), React__default.createElement(Line$1, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1
4787
- // @ts-ignore
4788
- , {
4788
+ }), React__default.createElement(Dot$1, null)), React__default.createElement(Line$1, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4789
+ src:
4789
4790
  // @ts-ignore
4790
- src: step.swapperLogo,
4791
+ step.swapperLogo || '',
4791
4792
  alt: step.swapperId
4792
4793
  }), React__default.createElement("div", null, React__default.createElement(Typography, {
4793
4794
  ml: 4,
@@ -4824,7 +4825,7 @@ function SwapHistory(props) {
4824
4825
  logo: step.toLogo,
4825
4826
  symbol: step.toSymbol,
4826
4827
  // @ts-ignore
4827
- chainLogo: step.toBlockchainLogo,
4828
+ chainLogo: step.toBlockchainLogo || '',
4828
4829
  blockchain: step.toBlockchain,
4829
4830
  amount: step.outputAmount || ''
4830
4831
  }));