@gearbox-protocol/ui-kit 4.0.0-next.64 → 4.0.0-next.65
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/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
- package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/utils/format-leverage.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/leverage-presets.cjs +1 -1
- package/dist/esm/components/base/leverage-input/leverage-input.js +31 -31
- package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +6 -6
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +30 -30
- package/dist/esm/index.js +189 -188
- package/dist/esm/locale/en.json.js +1 -1
- package/dist/esm/utils/format-leverage.js +8 -3
- package/dist/esm/utils/index.js +18 -17
- package/dist/esm/utils/leverage-presets.js +4 -6
- package/dist/types/components/base/leverage-input/leverage-input.d.ts +2 -2
- package/dist/types/locale/en.json.d.ts +1 -1
- package/dist/types/utils/format-leverage.d.ts +9 -1
- package/dist/types/utils/leverage-presets.d.ts +3 -1
- package/package.json +1 -1
- package/dist/cjs/components/base/leverage-preset-chips/format-chip-leverage.cjs +0 -1
- package/dist/esm/components/base/leverage-preset-chips/format-chip-leverage.js +0 -6
- package/dist/types/components/base/leverage-preset-chips/format-chip-leverage.d.ts +0 -5
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
function r(
|
|
2
|
-
return (Math.round(
|
|
1
|
+
function r(t) {
|
|
2
|
+
return (Math.round(t * 10) / 10).toFixed(1);
|
|
3
|
+
}
|
|
4
|
+
function n(t) {
|
|
5
|
+
const e = Math.round(t * 100);
|
|
6
|
+
return (e / 100).toFixed(e % 10 === 0 ? 1 : 2);
|
|
3
7
|
}
|
|
4
8
|
export {
|
|
5
|
-
r as formatLeverage
|
|
9
|
+
r as formatLeverage,
|
|
10
|
+
n as formatLeverageExact
|
|
6
11
|
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { cn as o, cn as t } from "./cn.js";
|
|
2
|
-
import { APPROXIMATE_SYMBOL as
|
|
3
|
-
import { formatLeverage as x } from "./format-leverage.js";
|
|
4
|
-
import { formatMoney as
|
|
2
|
+
import { APPROXIMATE_SYMBOL as p, formatTimestamp as a, shortenHash as f } from "./format.js";
|
|
3
|
+
import { formatLeverage as x, formatLeverageExact as i } from "./format-leverage.js";
|
|
4
|
+
import { formatMoney as g, percentageTemplate as T } from "./format-money.js";
|
|
5
5
|
import { formatUsdPrice as l } from "./format-price.js";
|
|
6
|
-
import { slippageTemplate as
|
|
7
|
-
import { leveragePresets as
|
|
8
|
-
import { bnToLiquidationPriceView as u, parseInputToBN as
|
|
9
|
-
import { shortenString as
|
|
10
|
-
import { tokenTemplateString as
|
|
6
|
+
import { slippageTemplate as d } from "./format-slippage.js";
|
|
7
|
+
import { leveragePresets as L } from "./leverage-presets.js";
|
|
8
|
+
import { bnToLiquidationPriceView as u, parseInputToBN as v } from "./parse-input-to-bn.js";
|
|
9
|
+
import { shortenString as E } from "./shorten-string.js";
|
|
10
|
+
import { tokenTemplateString as N } from "./templates.js";
|
|
11
11
|
import { openInNewWindow as A } from "./window.js";
|
|
12
|
-
import { Z_INDEX as
|
|
12
|
+
import { Z_INDEX as O } from "./z-index.js";
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
p as APPROXIMATE_SYMBOL,
|
|
15
|
+
O as Z_INDEX,
|
|
16
16
|
u as bnToLiquidationPriceView,
|
|
17
17
|
o as cn,
|
|
18
18
|
t as default,
|
|
19
19
|
x as formatLeverage,
|
|
20
|
-
|
|
20
|
+
i as formatLeverageExact,
|
|
21
|
+
g as formatMoney,
|
|
21
22
|
a as formatTimestamp,
|
|
22
23
|
l as formatUsdPrice,
|
|
23
|
-
|
|
24
|
+
L as leveragePresets,
|
|
24
25
|
A as openInNewWindow,
|
|
25
|
-
|
|
26
|
+
v as parseInputToBN,
|
|
26
27
|
T as percentageTemplate,
|
|
27
28
|
f as shortenHash,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
E as shortenString,
|
|
30
|
+
d as slippageTemplate,
|
|
31
|
+
N as tokenTemplateString
|
|
31
32
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
return [
|
|
4
|
-
.../* @__PURE__ */ new Set([n(1 + 0.3 * (e - 1)), n(1 + 0.7 * (e - 1)), e])
|
|
5
|
-
];
|
|
1
|
+
function r(e) {
|
|
2
|
+
const t = (n) => Math.min(Math.round((1 + n * (e - 1)) * 2) / 2, e);
|
|
3
|
+
return [.../* @__PURE__ */ new Set([t(0.3), t(0.7), e])];
|
|
6
4
|
}
|
|
7
5
|
export {
|
|
8
|
-
|
|
6
|
+
r as leveragePresets
|
|
9
7
|
};
|
|
@@ -16,7 +16,6 @@ export interface LeverageInputProps {
|
|
|
16
16
|
readonly onChange: (value: Leverage) => void;
|
|
17
17
|
readonly max: Leverage;
|
|
18
18
|
readonly min?: Leverage;
|
|
19
|
-
readonly step?: number;
|
|
20
19
|
/** Label above the slider; defaults to the "Leverage" locale string. */
|
|
21
20
|
readonly title?: TitleText;
|
|
22
21
|
/** Muted note rendered right after the label. */
|
|
@@ -37,7 +36,8 @@ export interface LeverageInputProps {
|
|
|
37
36
|
type TitleSize = "sm" | "default" | "md" | "lg";
|
|
38
37
|
/**
|
|
39
38
|
* Target leverage of a position, bounded by what the strategy allows.
|
|
40
|
-
* Title row carries an inline-editable value (`N.
|
|
39
|
+
* Title row carries an inline-editable value (`N.Nx`, hundredths kept where the
|
|
40
|
+
* value has them) and an optional reset;
|
|
41
41
|
* the slider below can show risk bands via `colorIntervals`.
|
|
42
42
|
*/
|
|
43
43
|
export declare function LeverageInput({ value, onChange, max, min, title, hint, reset, colorIntervals, colorIntervalLabel, size, }: LeverageInputProps): React.ReactElement;
|
|
@@ -30,7 +30,7 @@ declare const _default: {
|
|
|
30
30
|
"components.apyParts.totalAPY": "Overall APY",
|
|
31
31
|
|
|
32
32
|
"components.yieldBreakdown.titleNetAtLeverage": "Net APY at {leverage}× Leverage",
|
|
33
|
-
"components.yieldBreakdown.titleNetAtLeverage7d": "Net APY at {leverage}× Leverage
|
|
33
|
+
"components.yieldBreakdown.titleNetAtLeverage7d": "Net APY (7d) at {leverage}× Leverage",
|
|
34
34
|
"components.yieldBreakdown.titleNet": "Net APY",
|
|
35
35
|
"components.yieldBreakdown.titleNet7d": "Net APY (7d)",
|
|
36
36
|
"components.yieldBreakdown.collateralApy": "Collateral APY",
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Display leverage with
|
|
2
|
+
* Display leverage with one decimal place, e.g. `5.8` for `5.7857…`.
|
|
3
3
|
* The suffix (`x`) / prefix (`×`) stays at the call site.
|
|
4
4
|
*/
|
|
5
5
|
export declare function formatLeverage(value: number): string;
|
|
6
|
+
/**
|
|
7
|
+
* Leverage keeping the hundredths a value actually carries: `9` → `9.0`,
|
|
8
|
+
* `9.57` → `9.57`. For the slider, whose track ends on an exact `maxLeverage`,
|
|
9
|
+
* and for its edit field, whose text is parsed back into the target: the
|
|
10
|
+
* protocol's own resolution is 0.01, so `formatLeverage` there would silently
|
|
11
|
+
* move the position.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatLeverageExact(value: number): string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Leverage chips beside the strategy yield chart: 30% and 70% of the
|
|
3
|
-
* (1 → max) span, rounded to 0.5, plus max itself.
|
|
3
|
+
* (1 → max) span, rounded to 0.5, plus max itself. The 0.5 rounding can
|
|
4
|
+
* overshoot a fractional `max` (1.4 would yield a 1.5 chip), so each step is
|
|
5
|
+
* capped — the dialogs seed their initial leverage from this list.
|
|
4
6
|
*/
|
|
5
7
|
export declare function leveragePresets(max: number): number[];
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return e.toFixed(2).replace(/\.?0+$/,"")}exports.formatChipLeverage=r;
|