@gearbox-protocol/ui-kit 4.0.0-next.4 → 4.0.0-next.6

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 (207) 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/history-chart/history-chart.cjs +1 -1
  8. package/dist/cjs/components/base/index.cjs +1 -1
  9. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  10. package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
  11. package/dist/cjs/components/base/leverage-preset-chips/constants.cjs +1 -0
  12. package/dist/cjs/components/base/leverage-preset-chips/index.cjs +1 -0
  13. package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -0
  14. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  15. package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
  16. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  17. package/dist/cjs/components/base/title-meta/constants.cjs +1 -1
  18. package/dist/cjs/components/base/title-meta/title-meta.cjs +1 -1
  19. package/dist/cjs/components/base/values/index.cjs +1 -1
  20. package/dist/cjs/components/base/values/position-status-badge.cjs +1 -0
  21. package/dist/cjs/components/base/values/position-type-badge.cjs +1 -1
  22. package/dist/cjs/components/base-table/base-table-line.cjs +1 -0
  23. package/dist/cjs/components/base-table/base-table.cjs +1 -0
  24. package/dist/cjs/components/base-table/constants.cjs +1 -0
  25. package/dist/cjs/components/base-table/index.cjs +1 -0
  26. package/dist/cjs/components/base-table/types.cjs +1 -0
  27. package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
  28. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  29. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  30. package/dist/cjs/components/collateral-allocation-tooltip/allocation-wheel.cjs +1 -0
  31. package/dist/cjs/components/collateral-allocation-tooltip/collateral-allocation-tooltip.cjs +1 -0
  32. package/dist/cjs/components/collateral-allocation-tooltip/constants.cjs +1 -0
  33. package/dist/cjs/components/collateral-allocation-tooltip/index.cjs +1 -0
  34. package/dist/cjs/components/composites/index.cjs +1 -1
  35. package/dist/cjs/components/composites/pool-assets-table/constants.cjs +1 -0
  36. package/dist/cjs/components/composites/pool-assets-table/index.cjs +1 -1
  37. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
  38. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  39. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
  40. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
  41. package/dist/cjs/components/composites/tx-preview/confirm/dialog/index.cjs +1 -1
  42. package/dist/cjs/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.cjs +1 -0
  43. package/dist/cjs/components/composites/tx-preview/confirm/index.cjs +1 -1
  44. package/dist/cjs/components/composites/tx-preview/index.cjs +1 -1
  45. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  46. package/dist/cjs/components/filter/filter-chip.cjs +1 -1
  47. package/dist/cjs/components/graph/default-config.cjs +1 -1
  48. package/dist/cjs/components/graph/graph-view.cjs +1 -1
  49. package/dist/cjs/components/graph/graph.cjs +1 -1
  50. package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -0
  51. package/dist/cjs/components/hf-indicator/index.cjs +1 -0
  52. package/dist/cjs/components/index.cjs +1 -1
  53. package/dist/cjs/components/infinite-scroll/index.cjs +1 -0
  54. package/dist/cjs/components/infinite-scroll/infinite-scroll-wrapper.cjs +1 -0
  55. package/dist/cjs/components/name-cell/index.cjs +1 -0
  56. package/dist/cjs/components/name-cell/name-cell.cjs +1 -0
  57. package/dist/cjs/components/network-icon/index.cjs +1 -1
  58. package/dist/cjs/components/network-icon/network-indicator.cjs +1 -0
  59. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  60. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  61. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  62. package/dist/cjs/configs/tailwind-preset.cjs +1 -1
  63. package/dist/cjs/hooks/index.cjs +1 -1
  64. package/dist/cjs/hooks/use-observed-width-key.cjs +1 -0
  65. package/dist/cjs/index.cjs +1 -1
  66. package/dist/cjs/locale/en.json.cjs +1 -1
  67. package/dist/cjs/utils/format-money.cjs +1 -1
  68. package/dist/cjs/utils/index.cjs +1 -1
  69. package/dist/cjs/utils/leverage-presets.cjs +1 -0
  70. package/dist/esm/components/assets-list-cell/assets-list-cell.js +161 -159
  71. package/dist/esm/components/badge/badge.js +14 -8
  72. package/dist/esm/components/badge/chip.js +47 -0
  73. package/dist/esm/components/badge/index.js +8 -3
  74. package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
  75. package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
  76. package/dist/esm/components/base/history-chart/history-chart.js +86 -46
  77. package/dist/esm/components/base/index.js +144 -138
  78. package/dist/esm/components/base/info-list/info-list.js +7 -8
  79. package/dist/esm/components/base/leverage-input/leverage-input.js +1 -1
  80. package/dist/esm/components/base/leverage-preset-chips/constants.js +7 -0
  81. package/dist/esm/components/base/leverage-preset-chips/index.js +6 -0
  82. package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +39 -0
  83. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +23 -30
  84. package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +3 -2
  85. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +194 -32
  86. package/dist/esm/components/base/title-meta/constants.js +1 -0
  87. package/dist/esm/components/base/title-meta/title-meta.js +53 -33
  88. package/dist/esm/components/base/values/index.js +16 -14
  89. package/dist/esm/components/base/values/position-status-badge.js +26 -0
  90. package/dist/esm/components/base/values/position-type-badge.js +7 -6
  91. package/dist/esm/components/base-table/base-table-line.js +117 -0
  92. package/dist/esm/components/base-table/base-table.js +110 -0
  93. package/dist/esm/components/base-table/constants.js +12 -0
  94. package/dist/esm/components/base-table/index.js +9 -0
  95. package/dist/esm/components/base-table/types.js +1 -0
  96. package/dist/esm/components/block-sync-pill/block-sync-pill.js +9 -6
  97. package/dist/esm/components/checkbox/checkbox-labeled.js +7 -4
  98. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -4
  99. package/dist/esm/components/collateral-allocation-tooltip/allocation-wheel.js +71 -0
  100. package/dist/esm/components/collateral-allocation-tooltip/collateral-allocation-tooltip.js +102 -0
  101. package/dist/esm/components/collateral-allocation-tooltip/constants.js +12 -0
  102. package/dist/esm/components/collateral-allocation-tooltip/index.js +9 -0
  103. package/dist/esm/components/composites/index.js +31 -31
  104. package/dist/esm/components/composites/pool-assets-table/constants.js +9 -0
  105. package/dist/esm/components/composites/pool-assets-table/index.js +8 -6
  106. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +52 -30
  107. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +108 -76
  108. package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +44 -26
  109. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +109 -52
  110. package/dist/esm/components/composites/tx-preview/confirm/dialog/index.js +8 -10
  111. package/dist/esm/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.js +1 -0
  112. package/dist/esm/components/composites/tx-preview/confirm/index.js +24 -26
  113. package/dist/esm/components/composites/tx-preview/index.js +24 -26
  114. package/dist/esm/components/compound-apy/compound-apy.js +85 -80
  115. package/dist/esm/components/filter/filter-chip.js +1 -0
  116. package/dist/esm/components/graph/default-config.js +20 -18
  117. package/dist/esm/components/graph/graph-view.js +32 -31
  118. package/dist/esm/components/graph/graph.js +459 -458
  119. package/dist/esm/components/hf-indicator/hf-indicator.js +33 -0
  120. package/dist/esm/components/hf-indicator/index.js +4 -0
  121. package/dist/esm/components/index.js +732 -701
  122. package/dist/esm/components/infinite-scroll/index.js +4 -0
  123. package/dist/esm/components/infinite-scroll/infinite-scroll-wrapper.js +30 -0
  124. package/dist/esm/components/name-cell/index.js +4 -0
  125. package/dist/esm/components/name-cell/name-cell.js +35 -0
  126. package/dist/esm/components/network-icon/index.js +4 -2
  127. package/dist/esm/components/network-icon/network-indicator.js +82 -0
  128. package/dist/esm/components/trading-view/trading-view.js +193 -155
  129. package/dist/esm/components/with-copy/with-copy.js +7 -4
  130. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +112 -169
  131. package/dist/esm/configs/tailwind-preset.js +13 -1
  132. package/dist/esm/hooks/index.js +20 -18
  133. package/dist/esm/hooks/use-observed-width-key.js +24 -0
  134. package/dist/esm/index.js +881 -842
  135. package/dist/esm/locale/en.json.js +21 -18
  136. package/dist/esm/utils/format-money.js +59 -41
  137. package/dist/esm/utils/index.js +87 -83
  138. package/dist/esm/utils/leverage-presets.js +13 -0
  139. package/dist/globals.css +1 -1
  140. package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +3 -0
  141. package/dist/types/components/badge/badge.d.ts +2 -1
  142. package/dist/types/components/badge/chip.d.ts +22 -0
  143. package/dist/types/components/badge/index.d.ts +1 -0
  144. package/dist/types/components/base/history-chart/history-chart.d.ts +13 -3
  145. package/dist/types/components/base/index.d.ts +1 -0
  146. package/dist/types/components/base/leverage-input/leverage-input.d.ts +1 -1
  147. package/dist/types/components/base/leverage-preset-chips/constants.d.ts +4 -0
  148. package/dist/types/components/base/leverage-preset-chips/index.d.ts +2 -0
  149. package/dist/types/components/base/leverage-preset-chips/leverage-preset-chips.d.ts +13 -0
  150. package/dist/types/components/base/liquidation-params-table/liquidation-params-table.d.ts +2 -2
  151. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -5
  152. package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +1 -0
  153. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -4
  154. package/dist/types/components/base/title-meta/constants.d.ts +1 -0
  155. package/dist/types/components/base/title-meta/title-meta.d.ts +9 -1
  156. package/dist/types/components/base/values/index.d.ts +1 -0
  157. package/dist/types/components/base/values/position-status-badge.d.ts +7 -0
  158. package/dist/types/components/base/values/position-type-badge.d.ts +1 -1
  159. package/dist/types/components/base-table/base-table-line.d.ts +21 -0
  160. package/dist/types/components/base-table/base-table.d.ts +19 -0
  161. package/dist/types/components/base-table/constants.d.ts +8 -0
  162. package/dist/types/components/base-table/index.d.ts +3 -0
  163. package/dist/types/components/base-table/types.d.ts +37 -0
  164. package/dist/types/components/collateral-allocation-tooltip/allocation-wheel.d.ts +10 -0
  165. package/dist/types/components/collateral-allocation-tooltip/collateral-allocation-tooltip.d.ts +23 -0
  166. package/dist/types/components/collateral-allocation-tooltip/constants.d.ts +8 -0
  167. package/dist/types/components/collateral-allocation-tooltip/index.d.ts +3 -0
  168. package/dist/types/components/composites/pool-assets-table/constants.d.ts +6 -0
  169. package/dist/types/components/composites/pool-assets-table/index.d.ts +1 -0
  170. package/dist/types/components/composites/pool-assets-table/pool-assets-table-head.d.ts +1 -2
  171. package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +8 -8
  172. package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +7 -20
  173. package/dist/types/components/composites/pool-assets-table/types.d.ts +4 -12
  174. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.d.ts +23 -19
  175. package/dist/types/components/composites/tx-preview/confirm/dialog/index.d.ts +2 -2
  176. package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.d.ts +0 -3
  177. package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.d.ts +97 -0
  178. package/dist/types/components/graph/graph-view.d.ts +1 -1
  179. package/dist/types/components/graph/graph.d.ts +4 -0
  180. package/dist/types/components/hf-indicator/hf-indicator.d.ts +8 -0
  181. package/dist/types/components/hf-indicator/index.d.ts +1 -0
  182. package/dist/types/components/index.d.ts +5 -0
  183. package/dist/types/components/infinite-scroll/index.d.ts +1 -0
  184. package/dist/types/components/infinite-scroll/infinite-scroll-wrapper.d.ts +11 -0
  185. package/dist/types/components/name-cell/index.d.ts +1 -0
  186. package/dist/types/components/name-cell/name-cell.d.ts +13 -0
  187. package/dist/types/components/network-icon/index.d.ts +1 -0
  188. package/dist/types/components/network-icon/network-indicator.d.ts +23 -0
  189. package/dist/types/components/trading-view/trading-view.d.ts +10 -3
  190. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +6 -8
  191. package/dist/types/configs/tailwind-preset.d.ts +12 -0
  192. package/dist/types/hooks/index.d.ts +1 -0
  193. package/dist/types/hooks/use-observed-width-key.d.ts +8 -0
  194. package/dist/types/index.d.ts +6 -1
  195. package/dist/types/locale/en.json.d.ts +23 -18
  196. package/dist/types/utils/format-money.d.ts +11 -5
  197. package/dist/types/utils/index.d.ts +2 -1
  198. package/dist/types/utils/leverage-presets.d.ts +7 -0
  199. package/package.json +1 -1
  200. package/src/styles/base.css +30 -0
  201. package/src/styles/theme.css +16 -0
  202. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +0 -1
  203. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.cjs +0 -1
  204. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +0 -177
  205. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.js +0 -54
  206. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.d.ts +0 -17
  207. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.d.ts +0 -16
@@ -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",
@@ -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
  };
@@ -4,106 +4,110 @@ import { bnToInputView as l } from "./bn-to-input-view.js";
4
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 v } from "./copy.js";
9
- import { convertPercent as y, formatBytecodeSize as L, formatBytecodeVersion as w, 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
11
  import { formatLeverage as M } from "./format-leverage.js";
12
- import { formatMoney as _, formatMoneyAmount as E, formatPercentAmount as H, percentTemplate as W, percentageTemplate as Z } from "./format-money.js";
13
- import { FORMAT_CONSTANTS as U, formatNumberWithSuffix as X, formatPrice as q, getAdaptiveDecimals as j, isBelowDisplayThreshold as G, isEffectivelyZero as J, toSignificantDigits as K } from "./format-number.js";
14
- import { slippageTemplate as Y } from "./format-slippage.js";
15
- import { allLoaded as ee, loadingProgress as oe, round5 as re } from "./loading.js";
16
- import { decimalsToStep as ae, findClosestPoint as me, formatWithDecimals as ne, formatWithoutDecimals as ie, splitInterval as pe, validateMinMax as fe } from "./math.js";
17
- import { getNetworkIcon as se } from "./network-icons.js";
18
- import { bnToLiquidationPriceView as Te, isPositiveFloat as ce, parseInputToBN as ge, parseSmallNumber as Se } from "./parse-input-to-bn.js";
19
- import { pluralize as ue, selectPluralString as he } from "./plural.js";
20
- import { getAvailableRanges as Ae } from "./ranges.js";
21
- import { extractTextFromLabel as Ne, serializeValue as ke } from "./react.js";
22
- import { searchInString as Pe } from "./search.js";
23
- import { createTokenSearchFilter as Le, searchInToken as we } from "./search-in-token.js";
24
- import { shortSHA as Fe } from "./short-sha.js";
25
- import { isLongString as Oe, shortenString as Ve } from "./shorten-string.js";
26
- import { negativeTokenTemplate as Me, tokenTemplate as Re, tokenTemplateNumber as _e, tokenTemplateString as Ee } from "./templates.js";
27
- import { getTokenIcon as We, parseShareTokenUnderlying as Ze } from "./token-icon-source.js";
28
- import { TTL_CONSTANTS as Ue, getTTLZones as Xe, ttlFromTimestamp as qe, ttlLeft as je, ttlLeftHuman as Ge } from "./ttl.js";
29
- import { openInNewWindow as Ke } from "./window.js";
30
- import { Z_INDEX as Ye, Z_INDEX_VALUES as $e } from "./z-index.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";
31
32
  export {
32
- U as FORMAT_CONSTANTS,
33
- Ue as TTL_CONSTANTS,
34
- Ye as Z_INDEX,
35
- $e as Z_INDEX_VALUES,
36
- ee 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,
37
38
  l as bnToInputView,
38
- Te as bnToLiquidationPriceView,
39
+ de as bnToLiquidationPriceView,
39
40
  x as bnToPrettyView,
40
41
  c as bpsToPercent,
41
42
  S as cn,
42
- y as convertPercent,
43
- v as copyToClipboard,
44
- Le as createTokenSearchFilter,
45
- ae as decimalsToStep,
43
+ L as convertPercent,
44
+ N as copyToClipboard,
45
+ De as createTokenSearchFilter,
46
+ pe as decimalsToStep,
46
47
  d as default,
47
- Ne as extractTextFromLabel,
48
- me as findClosestPoint,
48
+ Le as extractTextFromLabel,
49
+ fe as findClosestPoint,
49
50
  V as formatAssetAmount,
50
- L as formatBytecodeSize,
51
- w as formatBytecodeVersion,
51
+ y as formatBytecodeSize,
52
+ C as formatBytecodeVersion,
53
+ oe as formatChipLeverage,
54
+ _ as formatCompactPercent,
52
55
  M as formatLeverage,
53
- _ as formatMoney,
54
- E as formatMoneyAmount,
55
- X as formatNumberWithSuffix,
56
- H as formatPercentAmount,
57
- q as formatPrice,
58
- C as formatTimestamp,
59
- ne as formatWithDecimals,
60
- ie as formatWithoutDecimals,
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,
61
64
  h as generateColorsFromBase,
62
65
  r as generateId,
63
- j as getAdaptiveDecimals,
64
- Ae as getAvailableRanges,
65
- b as getCSSVariable,
66
- se as getNetworkIcon,
67
- Xe as getTTLZones,
68
- We as getTokenIcon,
69
- A as hexToRgba,
70
- I as hslToHex,
71
- G as isBelowDisplayThreshold,
72
- J as isEffectivelyZero,
73
- Oe as isLongString,
74
- ce as isPositiveFloat,
75
- oe as loadingProgress,
76
- Me as negativeTokenTemplate,
77
- Ke as openInNewWindow,
78
- ge as parseInputToBN,
79
- Ze as parseShareTokenUnderlying,
80
- Se as parseSmallNumber,
81
- W as percentTemplate,
82
- Z as percentageTemplate,
83
- ue 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,
84
88
  m as pointProgramsOf,
85
89
  n as positiveTokenRewardsOf,
86
- N as resolveCSSColor,
87
- re as round5,
88
- Pe as searchInString,
89
- we as searchInToken,
90
- he as selectPluralString,
91
- ke as serializeValue,
92
- Fe 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,
93
97
  F as shortenHash,
94
- Ve as shortenString,
98
+ _e as shortenString,
95
99
  D as significantTrunc,
96
- Y as slippageTemplate,
97
- pe as splitInterval,
98
- K as toSignificantDigits,
100
+ $ as slippageTemplate,
101
+ xe as splitInterval,
102
+ Q as toSignificantDigits,
99
103
  i as tokenRewardsOf,
100
- Re as tokenTemplate,
101
- _e as tokenTemplateNumber,
102
- Ee as tokenTemplateString,
104
+ We as tokenTemplate,
105
+ Ze as tokenTemplateNumber,
106
+ ze as tokenTemplateString,
103
107
  p as totalApyOf,
104
- qe as ttlFromTimestamp,
105
- je as ttlLeft,
106
- Ge as ttlLeftHuman,
108
+ Ke as ttlFromTimestamp,
109
+ Qe as ttlLeft,
110
+ Ye as ttlLeftHuman,
107
111
  t as useFormFieldIds,
108
- fe as validateMinMax
112
+ Te as validateMinMax
109
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
+ };