@gearbox-protocol/ui-kit 4.0.0-next.3 → 4.0.0-next.5

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.
Files changed (232) hide show
  1. package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
  2. package/dist/cjs/components/badge/badge.cjs +1 -1
  3. package/dist/cjs/components/badge/chip.cjs +1 -0
  4. package/dist/cjs/components/badge/index.cjs +1 -1
  5. package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
  6. package/dist/cjs/components/base/chart-with-side-card/chart-with-side-card.cjs +1 -1
  7. package/dist/cjs/components/base/detailed-page-title/detailed-page-title.cjs +1 -1
  8. package/dist/cjs/components/base/health-factor-block/health-factor-block.cjs +1 -1
  9. package/dist/cjs/components/base/history-chart/history-chart.cjs +1 -1
  10. package/dist/cjs/components/base/index.cjs +1 -1
  11. package/dist/cjs/components/base/info-list/index.cjs +1 -1
  12. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  13. package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
  14. package/dist/cjs/components/base/leverage-preset-chips/constants.cjs +1 -0
  15. package/dist/cjs/components/base/leverage-preset-chips/index.cjs +1 -0
  16. package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -0
  17. package/dist/cjs/components/base/liquidation-price-block/liquidation-price-block.cjs +1 -1
  18. package/dist/cjs/components/base/manage-pane/constants.cjs +1 -1
  19. package/dist/cjs/components/base/manage-pane/manage-pane.cjs +1 -1
  20. package/dist/cjs/components/base/page-title/index.cjs +1 -1
  21. package/dist/cjs/components/base/page-title/page-title.cjs +1 -1
  22. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  23. package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
  24. package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
  25. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  26. package/dist/cjs/components/base/time-to-liquidation-block/time-to-liquidation-block.cjs +1 -1
  27. package/dist/cjs/components/base/title-meta/constants.cjs +1 -1
  28. package/dist/cjs/components/base/title-meta/title-meta.cjs +1 -1
  29. package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
  30. package/dist/cjs/components/base/values/constants.cjs +1 -1
  31. package/dist/cjs/components/base/values/index.cjs +1 -1
  32. package/dist/cjs/components/base/values/points-value.cjs +1 -0
  33. package/dist/cjs/components/base/values/position-status-badge.cjs +1 -0
  34. package/dist/cjs/components/base/values/position-type-badge.cjs +1 -1
  35. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  36. package/dist/cjs/components/base-table/base-table-line.cjs +1 -0
  37. package/dist/cjs/components/base-table/base-table.cjs +1 -0
  38. package/dist/cjs/components/base-table/constants.cjs +1 -0
  39. package/dist/cjs/components/base-table/index.cjs +1 -0
  40. package/dist/cjs/components/base-table/types.cjs +1 -0
  41. package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
  42. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  43. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  44. package/dist/cjs/components/collateral-allocation-tooltip/allocation-wheel.cjs +1 -0
  45. package/dist/cjs/components/collateral-allocation-tooltip/collateral-allocation-tooltip.cjs +1 -0
  46. package/dist/cjs/components/collateral-allocation-tooltip/constants.cjs +1 -0
  47. package/dist/cjs/components/collateral-allocation-tooltip/index.cjs +1 -0
  48. package/dist/cjs/components/composites/index.cjs +1 -1
  49. package/dist/cjs/components/composites/pool-assets-table/constants.cjs +1 -0
  50. package/dist/cjs/components/composites/pool-assets-table/index.cjs +1 -1
  51. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
  52. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  53. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
  54. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +1 -1
  55. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  56. package/dist/cjs/components/filter/filter-chip.cjs +1 -1
  57. package/dist/cjs/components/graph/default-config.cjs +1 -1
  58. package/dist/cjs/components/graph/graph-view.cjs +1 -1
  59. package/dist/cjs/components/graph/graph.cjs +1 -1
  60. package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -0
  61. package/dist/cjs/components/hf-indicator/index.cjs +1 -0
  62. package/dist/cjs/components/index.cjs +1 -1
  63. package/dist/cjs/components/infinite-scroll/index.cjs +1 -0
  64. package/dist/cjs/components/infinite-scroll/infinite-scroll-wrapper.cjs +1 -0
  65. package/dist/cjs/components/name-cell/index.cjs +1 -0
  66. package/dist/cjs/components/name-cell/name-cell.cjs +1 -0
  67. package/dist/cjs/components/network-icon/index.cjs +1 -1
  68. package/dist/cjs/components/network-icon/network-indicator.cjs +1 -0
  69. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  70. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  71. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  72. package/dist/cjs/configs/tailwind-preset.cjs +1 -1
  73. package/dist/cjs/hooks/index.cjs +1 -1
  74. package/dist/cjs/hooks/use-observed-width-key.cjs +1 -0
  75. package/dist/cjs/index.cjs +1 -1
  76. package/dist/cjs/locale/en.json.cjs +1 -1
  77. package/dist/cjs/utils/format-leverage.cjs +1 -0
  78. package/dist/cjs/utils/format-money.cjs +1 -1
  79. package/dist/cjs/utils/index.cjs +1 -1
  80. package/dist/cjs/utils/leverage-presets.cjs +1 -0
  81. package/dist/esm/components/assets-list-cell/assets-list-cell.js +161 -159
  82. package/dist/esm/components/badge/badge.js +14 -8
  83. package/dist/esm/components/badge/chip.js +47 -0
  84. package/dist/esm/components/badge/index.js +8 -3
  85. package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +4 -2
  86. package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
  87. package/dist/esm/components/base/detailed-page-title/detailed-page-title.js +26 -27
  88. package/dist/esm/components/base/health-factor-block/health-factor-block.js +25 -25
  89. package/dist/esm/components/base/history-chart/history-chart.js +86 -46
  90. package/dist/esm/components/base/index.js +148 -138
  91. package/dist/esm/components/base/info-list/index.js +5 -4
  92. package/dist/esm/components/base/info-list/info-list.js +51 -27
  93. package/dist/esm/components/base/leverage-input/leverage-input.js +18 -20
  94. package/dist/esm/components/base/leverage-preset-chips/constants.js +7 -0
  95. package/dist/esm/components/base/leverage-preset-chips/index.js +6 -0
  96. package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +39 -0
  97. package/dist/esm/components/base/liquidation-price-block/liquidation-price-block.js +33 -28
  98. package/dist/esm/components/base/manage-pane/constants.js +3 -2
  99. package/dist/esm/components/base/manage-pane/manage-pane.js +154 -113
  100. package/dist/esm/components/base/page-title/index.js +5 -4
  101. package/dist/esm/components/base/page-title/page-title.js +31 -23
  102. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +23 -30
  103. package/dist/esm/components/base/stat-badge/stat-badge.js +18 -9
  104. package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +3 -2
  105. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +194 -31
  106. package/dist/esm/components/base/time-to-liquidation-block/time-to-liquidation-block.js +31 -31
  107. package/dist/esm/components/base/title-meta/constants.js +1 -0
  108. package/dist/esm/components/base/title-meta/title-meta.js +53 -33
  109. package/dist/esm/components/base/token-amount/token-amount.js +17 -16
  110. package/dist/esm/components/base/values/constants.js +1 -0
  111. package/dist/esm/components/base/values/index.js +20 -16
  112. package/dist/esm/components/base/values/points-value.js +30 -0
  113. package/dist/esm/components/base/values/position-status-badge.js +26 -0
  114. package/dist/esm/components/base/values/position-type-badge.js +7 -6
  115. package/dist/esm/components/base/values/scalars.js +18 -17
  116. package/dist/esm/components/base-table/base-table-line.js +117 -0
  117. package/dist/esm/components/base-table/base-table.js +110 -0
  118. package/dist/esm/components/base-table/constants.js +12 -0
  119. package/dist/esm/components/base-table/index.js +9 -0
  120. package/dist/esm/components/base-table/types.js +1 -0
  121. package/dist/esm/components/block-sync-pill/block-sync-pill.js +24 -20
  122. package/dist/esm/components/checkbox/checkbox-labeled.js +22 -18
  123. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +22 -18
  124. package/dist/esm/components/collateral-allocation-tooltip/allocation-wheel.js +71 -0
  125. package/dist/esm/components/collateral-allocation-tooltip/collateral-allocation-tooltip.js +102 -0
  126. package/dist/esm/components/collateral-allocation-tooltip/constants.js +12 -0
  127. package/dist/esm/components/collateral-allocation-tooltip/index.js +9 -0
  128. package/dist/esm/components/composites/index.js +46 -44
  129. package/dist/esm/components/composites/pool-assets-table/constants.js +9 -0
  130. package/dist/esm/components/composites/pool-assets-table/index.js +8 -6
  131. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +52 -30
  132. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +109 -76
  133. package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +44 -26
  134. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +31 -27
  135. package/dist/esm/components/compound-apy/compound-apy.js +85 -80
  136. package/dist/esm/components/filter/filter-chip.js +1 -0
  137. package/dist/esm/components/graph/default-config.js +20 -18
  138. package/dist/esm/components/graph/graph-view.js +72 -88
  139. package/dist/esm/components/graph/graph.js +459 -458
  140. package/dist/esm/components/hf-indicator/hf-indicator.js +33 -0
  141. package/dist/esm/components/hf-indicator/index.js +4 -0
  142. package/dist/esm/components/index.js +734 -697
  143. package/dist/esm/components/infinite-scroll/index.js +4 -0
  144. package/dist/esm/components/infinite-scroll/infinite-scroll-wrapper.js +30 -0
  145. package/dist/esm/components/name-cell/index.js +4 -0
  146. package/dist/esm/components/name-cell/name-cell.js +35 -0
  147. package/dist/esm/components/network-icon/index.js +4 -2
  148. package/dist/esm/components/network-icon/network-indicator.js +82 -0
  149. package/dist/esm/components/trading-view/trading-view.js +193 -155
  150. package/dist/esm/components/with-copy/with-copy.js +22 -18
  151. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +112 -169
  152. package/dist/esm/configs/tailwind-preset.js +13 -1
  153. package/dist/esm/hooks/index.js +20 -18
  154. package/dist/esm/hooks/use-observed-width-key.js +24 -0
  155. package/dist/esm/index.js +888 -841
  156. package/dist/esm/locale/en.json.js +21 -18
  157. package/dist/esm/utils/format-leverage.js +6 -0
  158. package/dist/esm/utils/format-money.js +59 -41
  159. package/dist/esm/utils/index.js +91 -85
  160. package/dist/esm/utils/leverage-presets.js +13 -0
  161. package/dist/globals.css +1 -1
  162. package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +3 -0
  163. package/dist/types/components/badge/badge.d.ts +2 -1
  164. package/dist/types/components/badge/chip.d.ts +22 -0
  165. package/dist/types/components/badge/index.d.ts +1 -0
  166. package/dist/types/components/base/detailed-page-title/detailed-page-title.d.ts +1 -3
  167. package/dist/types/components/base/health-factor-block/health-factor-block.d.ts +6 -6
  168. package/dist/types/components/base/history-chart/history-chart.d.ts +13 -3
  169. package/dist/types/components/base/index.d.ts +1 -0
  170. package/dist/types/components/base/info-list/info-list.d.ts +7 -0
  171. package/dist/types/components/base/leverage-input/leverage-input.d.ts +1 -1
  172. package/dist/types/components/base/leverage-preset-chips/constants.d.ts +4 -0
  173. package/dist/types/components/base/leverage-preset-chips/index.d.ts +2 -0
  174. package/dist/types/components/base/leverage-preset-chips/leverage-preset-chips.d.ts +13 -0
  175. package/dist/types/components/base/liquidation-params-table/liquidation-params-table.d.ts +2 -2
  176. package/dist/types/components/base/liquidation-price-block/liquidation-price-block.d.ts +6 -4
  177. package/dist/types/components/base/manage-pane/constants.d.ts +1 -0
  178. package/dist/types/components/base/manage-pane/manage-pane.d.ts +3 -1
  179. package/dist/types/components/base/page-title/page-title.d.ts +12 -6
  180. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -5
  181. package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +1 -0
  182. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -4
  183. package/dist/types/components/base/time-to-liquidation-block/time-to-liquidation-block.d.ts +5 -6
  184. package/dist/types/components/base/title-meta/constants.d.ts +1 -0
  185. package/dist/types/components/base/title-meta/title-meta.d.ts +9 -1
  186. package/dist/types/components/base/token-amount/token-amount.d.ts +8 -2
  187. package/dist/types/components/base/values/constants.d.ts +1 -0
  188. package/dist/types/components/base/values/index.d.ts +2 -0
  189. package/dist/types/components/base/values/points-value.d.ts +11 -0
  190. package/dist/types/components/base/values/position-short-label.d.ts +1 -1
  191. package/dist/types/components/base/values/position-status-badge.d.ts +7 -0
  192. package/dist/types/components/base/values/position-type-badge.d.ts +1 -1
  193. package/dist/types/components/base-table/base-table-line.d.ts +21 -0
  194. package/dist/types/components/base-table/base-table.d.ts +19 -0
  195. package/dist/types/components/base-table/constants.d.ts +8 -0
  196. package/dist/types/components/base-table/index.d.ts +3 -0
  197. package/dist/types/components/base-table/types.d.ts +37 -0
  198. package/dist/types/components/collateral-allocation-tooltip/allocation-wheel.d.ts +10 -0
  199. package/dist/types/components/collateral-allocation-tooltip/collateral-allocation-tooltip.d.ts +23 -0
  200. package/dist/types/components/collateral-allocation-tooltip/constants.d.ts +8 -0
  201. package/dist/types/components/collateral-allocation-tooltip/index.d.ts +3 -0
  202. package/dist/types/components/composites/pool-assets-table/constants.d.ts +6 -0
  203. package/dist/types/components/composites/pool-assets-table/index.d.ts +1 -0
  204. package/dist/types/components/composites/pool-assets-table/pool-assets-table-head.d.ts +1 -2
  205. package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +8 -8
  206. package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +7 -20
  207. package/dist/types/components/composites/pool-assets-table/types.d.ts +4 -12
  208. package/dist/types/components/graph/graph-view.d.ts +1 -1
  209. package/dist/types/components/graph/graph.d.ts +4 -0
  210. package/dist/types/components/hf-indicator/hf-indicator.d.ts +8 -0
  211. package/dist/types/components/hf-indicator/index.d.ts +1 -0
  212. package/dist/types/components/index.d.ts +5 -0
  213. package/dist/types/components/infinite-scroll/index.d.ts +1 -0
  214. package/dist/types/components/infinite-scroll/infinite-scroll-wrapper.d.ts +11 -0
  215. package/dist/types/components/name-cell/index.d.ts +1 -0
  216. package/dist/types/components/name-cell/name-cell.d.ts +13 -0
  217. package/dist/types/components/network-icon/index.d.ts +1 -0
  218. package/dist/types/components/network-icon/network-indicator.d.ts +23 -0
  219. package/dist/types/components/trading-view/trading-view.d.ts +10 -3
  220. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +6 -8
  221. package/dist/types/configs/tailwind-preset.d.ts +12 -0
  222. package/dist/types/hooks/index.d.ts +1 -0
  223. package/dist/types/hooks/use-observed-width-key.d.ts +8 -0
  224. package/dist/types/index.d.ts +6 -1
  225. package/dist/types/locale/en.json.d.ts +23 -18
  226. package/dist/types/utils/format-leverage.d.ts +5 -0
  227. package/dist/types/utils/format-money.d.ts +11 -5
  228. package/dist/types/utils/index.d.ts +3 -1
  229. package/dist/types/utils/leverage-presets.d.ts +7 -0
  230. package/package.json +1 -1
  231. package/src/styles/base.css +30 -0
  232. package/src/styles/theme.css +16 -0
@@ -6,6 +6,8 @@ const e = {
6
6
  "errors.tooManyRequests": "Too many requests",
7
7
  "errors.incorrectAddress": "Incorrect address",
8
8
  "components.errorMessage.oops": "Oops...",
9
+ "components.networkIndicator.title": "Network",
10
+ "components.infiniteScrollWrapper.showMore": "Show more",
9
11
  "components.alertModal.ok": "Ok",
10
12
  "components.footer.privacy": "Privacy Notice",
11
13
  "components.footer.terms": "Terms of Service",
@@ -67,19 +69,18 @@ const e = {
67
69
  "components.apyParts.totalAPY": "Overall APY",
68
70
  "components.apyParts.points": "{symbol} Incentive",
69
71
  "components.apyParts.points.condition.crossDeposit": "For cross-chain deposits made via Omni",
70
- "components.yieldBreakdown.title": "Yield Breakdown",
71
- "components.yieldBreakdown.atLeverage": "at {leverage}× leverage",
72
- "components.yieldBreakdown.baseYield": "Base Yield",
73
- "components.yieldBreakdown.incentiveYield": "Incentive Yield",
72
+ "components.yieldBreakdown.titleNetAtLeverage": "Net APY at {leverage}× Leverage",
73
+ "components.yieldBreakdown.collateralApy": "Collateral APY",
74
+ "components.yieldBreakdown.incentive": "Incentive",
74
75
  "components.yieldBreakdown.borrowRate": "Borrow Rate",
75
- "components.yieldBreakdown.baseRate": "Base Rate",
76
- "components.yieldBreakdown.additionalRate": "Additional Rate",
77
- "components.yieldBreakdown.netYield": "Net Yield",
76
+ "components.yieldBreakdown.programPoints": "{name} Points",
78
77
  "components.yieldBreakdown.points": "Points",
79
78
  "components.openCopyButtons.copy": "Copy to clipboard",
80
- "components.poolAssetsTable.asset": "Asset",
79
+ "components.poolAssetsTable.asset": "Name",
81
80
  "components.poolAssetsTable.rate": "Effective rate",
82
- "components.poolAssetsTable.limits": "Limits Usage",
81
+ "components.poolAssetsTable.exposure": "Exposure",
82
+ "components.poolAssetsTable.cap": "Cap",
83
+ "components.poolAssetsTable.capUtilization": "Cap utilization",
83
84
  "components.poolAssetsTable.usage": "{amount} of {total}",
84
85
  "components.poolAssetsTable.head.name": "Credit Manager",
85
86
  "components.poolAssetsTable.head.currentDebt": "Current Debt",
@@ -162,23 +163,25 @@ const e = {
162
163
  "components.timeToLiquidationBlock.tip": "Time to liquidation estimates how long the account can stay open if prices remain constant and no yield is earned—only accounting for borrow interest accrual.",
163
164
  "components.historyChart.error": "Couldn't load chart data",
164
165
  "components.historyChart.empty": "No data",
165
- "components.positionTypeBadge.pool": "Lender",
166
+ "components.positionTypeBadge.pool": "LP",
166
167
  "components.positionTypeBadge.strategy": "Strategy",
167
168
  "components.positionTypeBadge.liquidation": "Liquidation",
169
+ "components.positionStatusBadge.active": "Active",
170
+ "components.positionStatusBadge.repaid": "Repaid",
168
171
  "components.titleMeta.unknownCurator": "Curator",
169
172
  "components.moreAccordion.more": "More details",
170
173
  "components.moreAccordion.less": "Less details",
171
174
  "components.poolApyBreakdownCard.title": "APY Breakdown",
172
- "components.poolApyBreakdownCard.apy1d": "APY 24H",
173
- "components.poolApyBreakdownCard.apy7d": "APY 7d",
174
- "components.poolApyBreakdownCard.apy30d": "APY 30d",
175
- "components.strategyApyBreakdownCard.title": "APY Breakdown",
176
- "components.strategyApyBreakdownCard.formula": "How strategy APY is calculated: Collateral APY x Leverage - Base borrow rate x (Leverage - 1) - Additional borrow rate x Leverage x 1.05",
175
+ "components.poolApyBreakdownCard.organicApy": "Pool organic APY",
176
+ "components.poolApyBreakdownCard.incentiveApy": "Incentive APY",
177
+ "components.strategyApyBreakdownCard.titleAtLeverage": "APY at {leverage}× Leverage",
177
178
  "components.strategyApyBreakdownCard.collateralApy": "Collateral APY",
178
- "components.strategyApyBreakdownCard.baseBorrowRate": "Base borrow rate",
179
- "components.strategyApyBreakdownCard.additionalBorrowRate": "Additional borrow rate",
179
+ "components.strategyApyBreakdownCard.incentiveApy": "Incentive APY",
180
+ "components.strategyApyBreakdownCard.borrowRate": "Borrow Rate",
181
+ "components.strategyApyBreakdownCard.formula": "{base} × {leverage} Lev.",
182
+ "components.leveragePresetChips.label": "Leverage:",
180
183
  "components.liquidationParamsTable.lt": "Liquidation threshold",
181
- "components.liquidationParamsTable.penalty": "Liquidation penalty",
184
+ "components.liquidationParamsTable.penalty": "Liquidation discount",
182
185
  "components.liquidationParamsTable.premium": "Liquidation premium",
183
186
  "components.liquidationParamsTable.fee": "Liquidation fee",
184
187
  "components.borrowRateBlock.label": "Borrow rate",
@@ -0,0 +1,6 @@
1
+ function r(e) {
2
+ return (Math.round(e * 100) / 100).toFixed(2);
3
+ }
4
+ export {
5
+ r as formatLeverage
6
+ };
@@ -1,32 +1,49 @@
1
- import { formatBN as M, WAD_DECIMALS_POW as $, PERCENTAGE_FACTOR as A } from "@gearbox-protocol/sdk";
2
- import { BigIntMath as g } from "@gearbox-protocol/sdk/common-utils";
1
+ import { formatBN as b, WAD_DECIMALS_POW as g, PERCENTAGE_FACTOR as h } from "@gearbox-protocol/sdk";
2
+ import { BigIntMath as E } from "@gearbox-protocol/sdk/common-utils";
3
3
  import "react";
4
- import { bnToInputView as h } from "./bn-to-input-view.js";
4
+ import { bnToInputView as x } from "./bn-to-input-view.js";
5
5
  import "clsx";
6
6
  import "tailwind-merge";
7
7
  import "sonner";
8
8
  import "react/jsx-runtime";
9
9
  import "luxon";
10
10
  import "./z-index.js";
11
- const _ = 10000000000000000n;
11
+ const A = 10000000000000000n;
12
12
  function F(t) {
13
13
  return BigInt(t.toFixed(18).replace(".", ""));
14
14
  }
15
- function U(t, r) {
16
- const n = typeof t == "number" && t < 0 || typeof t == "bigint" && t < 0n ? "-" : "", s = typeof t == "number" ? F(Math.abs(t)) : g.abs(t), u = s < _ && s > 0n, f = u ? "0.01" : M(s, $, r), o = `${n}$${f}`;
15
+ function V(t, e) {
16
+ const r = typeof t == "number" && t < 0 || typeof t == "bigint" && t < 0n ? "-" : "", f = typeof t == "number" ? F(Math.abs(t)) : E.abs(t), u = f < A && f > 0n, a = u ? "0.01" : b(f, g, e), o = `${r}$${a}`;
17
17
  return u ? `< ${o}` : o;
18
18
  }
19
- const O = 1e4;
20
- function l(t, r, i = !0) {
21
- const n = typeof t == "number" ? t : Number(t);
22
- return Number.isNaN(n) || n === void 0 || n === null ? "0" : n === 0 ? 0 : i && n > O ? n.toExponential(r) : n.toFixed(r);
19
+ const C = 1e3, P = [
20
+ { div: 1e12, suffix: "T" },
21
+ { div: 1e9, suffix: "B" },
22
+ { div: 1e6, suffix: "M" },
23
+ { div: 1e3, suffix: "K" }
24
+ ];
25
+ function _(t) {
26
+ return t.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
23
27
  }
24
- function V(t, r = 2) {
25
- return `${l(t, r)}%`;
28
+ function d(t, e) {
29
+ for (const { div: i, suffix: r } of P)
30
+ if (t >= i)
31
+ return `${_((t / i).toFixed(e))}${r}`;
32
+ return t.toFixed(e);
26
33
  }
27
- function W(t, r = 2) {
28
- const i = Number(t) / Number(A);
29
- return `${l(i, r)}%`;
34
+ function B(t, e = 2) {
35
+ return !Number.isFinite(t) || t === 0 ? "0%" : `${t < 0 ? "-" : ""}${d(Math.abs(t), e)}%`;
36
+ }
37
+ function D(t, e, i = !0) {
38
+ const r = typeof t == "number" ? t : Number(t);
39
+ return Number.isNaN(r) || r === void 0 || r === null ? "0" : r === 0 ? 0 : i && Math.abs(r) >= C ? `${r < 0 ? "-" : ""}${d(Math.abs(r), e)}` : r.toFixed(e);
40
+ }
41
+ function W(t, e = 2) {
42
+ return B(t, e);
43
+ }
44
+ function w(t, e = 2) {
45
+ const i = Number(t) / Number(h);
46
+ return `${D(i, e)}%`;
30
47
  }
31
48
  const c = {
32
49
  minimumFractionDigits: 2,
@@ -36,42 +53,43 @@ const c = {
36
53
  minExponentialThreshold: 1e-4,
37
54
  maxExponentialThreshold: 1e6,
38
55
  locale: "en-US"
39
- }, X = ({
56
+ }, Y = ({
40
57
  amount: t,
41
- format: r = "full",
58
+ format: e = "full",
42
59
  maximumFractionDigits: i = c.maximumFractionDigits,
43
- minimumFractionDigits: n = c.minimumFractionDigits,
44
- decimalPrecision: s = c.decimalPrecision,
60
+ minimumFractionDigits: r = c.minimumFractionDigits,
61
+ decimalPrecision: f = c.decimalPrecision,
45
62
  minDecimalThreshold: u = c.minDecimalThreshold,
46
- minExponentialThreshold: f = c.minExponentialThreshold,
63
+ minExponentialThreshold: a = c.minExponentialThreshold,
47
64
  maxExponentialThreshold: o = c.maxExponentialThreshold,
48
- locale: N = c.locale
65
+ locale: l = c.locale
49
66
  }) => {
50
- const m = typeof t == "bigint" ? Number(h(t, 8)) : t, e = Math.abs(m);
51
- if (r === "short") {
52
- const T = m < 0 ? "-" : "", a = (p, d) => {
53
- const b = p >= 100 ? 0 : i, E = p.toFixed(b).replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
54
- return `${T}${E}${d}`;
67
+ const s = typeof t == "bigint" ? Number(x(t, 8)) : t, n = Math.abs(s);
68
+ if (e === "short") {
69
+ const T = s < 0 ? "-" : "", m = (p, N) => {
70
+ const $ = p >= 100 ? 0 : i, M = p.toFixed($).replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
71
+ return `${T}${M}${N}`;
55
72
  };
56
- if (e >= 1e9 && e <= o)
57
- return a(e / 1e9, "B");
58
- if (e >= 1e6 && e <= o)
59
- return a(e / 1e6, "M");
60
- if (e >= 1e3 && e <= o)
61
- return a(e / 1e3, "K");
62
- if (e > o)
63
- return a(e / o, "M+");
73
+ if (n >= 1e9 && n <= o)
74
+ return m(n / 1e9, "B");
75
+ if (n >= 1e6 && n <= o)
76
+ return m(n / 1e6, "M");
77
+ if (n >= 1e3 && n <= o)
78
+ return m(n / 1e3, "K");
79
+ if (n > o)
80
+ return m(n / o, "M+");
64
81
  }
65
- return e > o && r === "full" ? `${(m / c.maxExponentialThreshold).toFixed(n)}M` : e < f && e > 0 ? m.toFixed(Math.max(10, i)) : e < u && e > 0 ? m.toPrecision(s) : m.toLocaleString(N, {
66
- minimumFractionDigits: n,
82
+ return n > o && e === "full" ? `${(s / c.maxExponentialThreshold).toFixed(r)}M` : n < a && n > 0 ? s.toFixed(Math.max(10, i)) : n < u && n > 0 ? s.toPrecision(f) : s.toLocaleString(l, {
83
+ minimumFractionDigits: r,
67
84
  maximumFractionDigits: i
68
85
  });
69
86
  };
70
87
  export {
71
88
  c as DEFAULT_FORMAT_MONEY_CONSTANTS,
72
- U as formatMoney,
73
- X as formatMoneyAmount,
74
- l as formatPercentAmount,
75
- V as percentTemplate,
76
- W as percentageTemplate
89
+ B as formatCompactPercent,
90
+ V as formatMoney,
91
+ Y as formatMoneyAmount,
92
+ D as formatPercentAmount,
93
+ W as percentTemplate,
94
+ w as percentageTemplate
77
95
  };
@@ -1,107 +1,113 @@
1
1
  import { generateId as r, useFormFieldIds as t } from "./a11y.js";
2
2
  import { pointProgramsOf as m, positiveTokenRewardsOf as n, tokenRewardsOf as i, totalApyOf as p } from "./apy-breakdown.js";
3
3
  import { bnToInputView as l } from "./bn-to-input-view.js";
4
- import { bnToPrettyView as T } from "./bn-to-pretty-view.js";
4
+ import { bnToPrettyView as x } from "./bn-to-pretty-view.js";
5
5
  import { bpsToPercent as c } from "./bps.js";
6
6
  import { cn as S, cn as d } from "./cn.js";
7
- import { generateColorsFromBase as h, getCSSVariable as b, hexToRgba as A, hslToHex as I, resolveCSSColor as N } from "./colors.js";
8
- import { copyToClipboard as P } from "./copy.js";
9
- import { convertPercent as y, formatBytecodeSize as w, formatBytecodeVersion as L, formatTimestamp as C, shortenHash as F, significantTrunc as D } from "./format.js";
7
+ import { generateColorsFromBase as h, getCSSVariable as v, hexToRgba as P, hslToHex as b, resolveCSSColor as A } from "./colors.js";
8
+ import { copyToClipboard as N } from "./copy.js";
9
+ import { convertPercent as L, formatBytecodeSize as y, formatBytecodeVersion as C, formatTimestamp as w, shortenHash as F, significantTrunc as D } from "./format.js";
10
10
  import { formatAssetAmount as V } from "./format-asset-amount.js";
11
- import { formatMoney as M, formatMoneyAmount as R, formatPercentAmount as _, percentTemplate as E, percentageTemplate as H } from "./format-money.js";
12
- import { FORMAT_CONSTANTS as Z, formatNumberWithSuffix as z, formatPrice as U, getAdaptiveDecimals as X, isBelowDisplayThreshold as q, isEffectivelyZero as j, toSignificantDigits as G } from "./format-number.js";
13
- import { slippageTemplate as K } from "./format-slippage.js";
14
- import { allLoaded as Y, loadingProgress as $, round5 as ee } from "./loading.js";
15
- import { decimalsToStep as re, findClosestPoint as te, formatWithDecimals as ae, formatWithoutDecimals as me, splitInterval as ne, validateMinMax as ie } from "./math.js";
16
- import { getNetworkIcon as fe } from "./network-icons.js";
17
- import { bnToLiquidationPriceView as se, isPositiveFloat as Te, parseInputToBN as xe, parseSmallNumber as ce } from "./parse-input-to-bn.js";
18
- import { pluralize as Se, selectPluralString as de } from "./plural.js";
19
- import { getAvailableRanges as he } from "./ranges.js";
20
- import { extractTextFromLabel as Ae, serializeValue as Ie } from "./react.js";
21
- import { searchInString as ke } from "./search.js";
22
- import { createTokenSearchFilter as ve, searchInToken as ye } from "./search-in-token.js";
23
- import { shortSHA as Le } from "./short-sha.js";
24
- import { isLongString as Fe, shortenString as De } from "./shorten-string.js";
25
- import { negativeTokenTemplate as Ve, tokenTemplate as Be, tokenTemplateNumber as Me, tokenTemplateString as Re } from "./templates.js";
26
- import { getTokenIcon as Ee, parseShareTokenUnderlying as He } from "./token-icon-source.js";
27
- import { TTL_CONSTANTS as Ze, getTTLZones as ze, ttlFromTimestamp as Ue, ttlLeft as Xe, ttlLeftHuman as qe } from "./ttl.js";
28
- import { openInNewWindow as Ge } from "./window.js";
29
- import { Z_INDEX as Ke, Z_INDEX_VALUES as Qe } from "./z-index.js";
11
+ import { formatLeverage as M } from "./format-leverage.js";
12
+ import { formatCompactPercent as _, formatMoney as E, formatMoneyAmount as H, formatPercentAmount as W, percentTemplate as Z, percentageTemplate as z } from "./format-money.js";
13
+ import { FORMAT_CONSTANTS as X, formatNumberWithSuffix as q, formatPrice as j, getAdaptiveDecimals as G, isBelowDisplayThreshold as J, isEffectivelyZero as K, toSignificantDigits as Q } from "./format-number.js";
14
+ import { slippageTemplate as $ } from "./format-slippage.js";
15
+ import { formatChipLeverage as oe, leveragePresets as re } from "./leverage-presets.js";
16
+ import { allLoaded as ae, loadingProgress as me, round5 as ne } from "./loading.js";
17
+ import { decimalsToStep as pe, findClosestPoint as fe, formatWithDecimals as le, formatWithoutDecimals as se, splitInterval as xe, validateMinMax as Te } from "./math.js";
18
+ import { getNetworkIcon as ge } from "./network-icons.js";
19
+ import { bnToLiquidationPriceView as de, isPositiveFloat as ue, parseInputToBN as he, parseSmallNumber as ve } from "./parse-input-to-bn.js";
20
+ import { pluralize as be, selectPluralString as Ae } from "./plural.js";
21
+ import { getAvailableRanges as Ne } from "./ranges.js";
22
+ import { extractTextFromLabel as Le, serializeValue as ye } from "./react.js";
23
+ import { searchInString as we } from "./search.js";
24
+ import { createTokenSearchFilter as De, searchInToken as Oe } from "./search-in-token.js";
25
+ import { shortSHA as Be } from "./short-sha.js";
26
+ import { isLongString as Re, shortenString as _e } from "./shorten-string.js";
27
+ import { negativeTokenTemplate as He, tokenTemplate as We, tokenTemplateNumber as Ze, tokenTemplateString as ze } from "./templates.js";
28
+ import { getTokenIcon as Xe, parseShareTokenUnderlying as qe } from "./token-icon-source.js";
29
+ import { TTL_CONSTANTS as Ge, getTTLZones as Je, ttlFromTimestamp as Ke, ttlLeft as Qe, ttlLeftHuman as Ye } from "./ttl.js";
30
+ import { openInNewWindow as eo } from "./window.js";
31
+ import { Z_INDEX as ro, Z_INDEX_VALUES as to } from "./z-index.js";
30
32
  export {
31
- Z as FORMAT_CONSTANTS,
32
- Ze as TTL_CONSTANTS,
33
- Ke as Z_INDEX,
34
- Qe as Z_INDEX_VALUES,
35
- Y as allLoaded,
33
+ X as FORMAT_CONSTANTS,
34
+ Ge as TTL_CONSTANTS,
35
+ ro as Z_INDEX,
36
+ to as Z_INDEX_VALUES,
37
+ ae as allLoaded,
36
38
  l as bnToInputView,
37
- se as bnToLiquidationPriceView,
38
- T as bnToPrettyView,
39
+ de as bnToLiquidationPriceView,
40
+ x as bnToPrettyView,
39
41
  c as bpsToPercent,
40
42
  S as cn,
41
- y as convertPercent,
42
- P as copyToClipboard,
43
- ve as createTokenSearchFilter,
44
- re as decimalsToStep,
43
+ L as convertPercent,
44
+ N as copyToClipboard,
45
+ De as createTokenSearchFilter,
46
+ pe as decimalsToStep,
45
47
  d as default,
46
- Ae as extractTextFromLabel,
47
- te as findClosestPoint,
48
+ Le as extractTextFromLabel,
49
+ fe as findClosestPoint,
48
50
  V as formatAssetAmount,
49
- w as formatBytecodeSize,
50
- L as formatBytecodeVersion,
51
- M as formatMoney,
52
- R as formatMoneyAmount,
53
- z as formatNumberWithSuffix,
54
- _ as formatPercentAmount,
55
- U as formatPrice,
56
- C as formatTimestamp,
57
- ae as formatWithDecimals,
58
- me as formatWithoutDecimals,
51
+ y as formatBytecodeSize,
52
+ C as formatBytecodeVersion,
53
+ oe as formatChipLeverage,
54
+ _ as formatCompactPercent,
55
+ M as formatLeverage,
56
+ E as formatMoney,
57
+ H as formatMoneyAmount,
58
+ q as formatNumberWithSuffix,
59
+ W as formatPercentAmount,
60
+ j as formatPrice,
61
+ w as formatTimestamp,
62
+ le as formatWithDecimals,
63
+ se as formatWithoutDecimals,
59
64
  h as generateColorsFromBase,
60
65
  r as generateId,
61
- X as getAdaptiveDecimals,
62
- he as getAvailableRanges,
63
- b as getCSSVariable,
64
- fe as getNetworkIcon,
65
- ze as getTTLZones,
66
- Ee as getTokenIcon,
67
- A as hexToRgba,
68
- I as hslToHex,
69
- q as isBelowDisplayThreshold,
70
- j as isEffectivelyZero,
71
- Fe as isLongString,
72
- Te as isPositiveFloat,
73
- $ as loadingProgress,
74
- Ve as negativeTokenTemplate,
75
- Ge as openInNewWindow,
76
- xe as parseInputToBN,
77
- He as parseShareTokenUnderlying,
78
- ce as parseSmallNumber,
79
- E as percentTemplate,
80
- H as percentageTemplate,
81
- Se as pluralize,
66
+ G as getAdaptiveDecimals,
67
+ Ne as getAvailableRanges,
68
+ v as getCSSVariable,
69
+ ge as getNetworkIcon,
70
+ Je as getTTLZones,
71
+ Xe as getTokenIcon,
72
+ P as hexToRgba,
73
+ b as hslToHex,
74
+ J as isBelowDisplayThreshold,
75
+ K as isEffectivelyZero,
76
+ Re as isLongString,
77
+ ue as isPositiveFloat,
78
+ re as leveragePresets,
79
+ me as loadingProgress,
80
+ He as negativeTokenTemplate,
81
+ eo as openInNewWindow,
82
+ he as parseInputToBN,
83
+ qe as parseShareTokenUnderlying,
84
+ ve as parseSmallNumber,
85
+ Z as percentTemplate,
86
+ z as percentageTemplate,
87
+ be as pluralize,
82
88
  m as pointProgramsOf,
83
89
  n as positiveTokenRewardsOf,
84
- N as resolveCSSColor,
85
- ee as round5,
86
- ke as searchInString,
87
- ye as searchInToken,
88
- de as selectPluralString,
89
- Ie as serializeValue,
90
- Le as shortSHA,
90
+ A as resolveCSSColor,
91
+ ne as round5,
92
+ we as searchInString,
93
+ Oe as searchInToken,
94
+ Ae as selectPluralString,
95
+ ye as serializeValue,
96
+ Be as shortSHA,
91
97
  F as shortenHash,
92
- De as shortenString,
98
+ _e as shortenString,
93
99
  D as significantTrunc,
94
- K as slippageTemplate,
95
- ne as splitInterval,
96
- G as toSignificantDigits,
100
+ $ as slippageTemplate,
101
+ xe as splitInterval,
102
+ Q as toSignificantDigits,
97
103
  i as tokenRewardsOf,
98
- Be as tokenTemplate,
99
- Me as tokenTemplateNumber,
100
- Re as tokenTemplateString,
104
+ We as tokenTemplate,
105
+ Ze as tokenTemplateNumber,
106
+ ze as tokenTemplateString,
101
107
  p as totalApyOf,
102
- Ue as ttlFromTimestamp,
103
- Xe as ttlLeft,
104
- qe as ttlLeftHuman,
108
+ Ke as ttlFromTimestamp,
109
+ Qe as ttlLeft,
110
+ Ye as ttlLeftHuman,
105
111
  t as useFormFieldIds,
106
- ie as validateMinMax
112
+ Te as validateMinMax
107
113
  };
@@ -0,0 +1,13 @@
1
+ function n(e) {
2
+ const r = (t) => Math.round(t * 2) / 2;
3
+ return [
4
+ .../* @__PURE__ */ new Set([r(1 + 0.3 * (e - 1)), r(1 + 0.7 * (e - 1)), e])
5
+ ];
6
+ }
7
+ function o(e) {
8
+ return e.toFixed(2).replace(/\.?0+$/, "");
9
+ }
10
+ export {
11
+ o as formatChipLeverage,
12
+ n as leveragePresets
13
+ };