@gearbox-protocol/ui-kit 4.0.0-next.16 → 4.0.0-next.17
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/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
- package/dist/cjs/components/base/position-assets/index.cjs +1 -0
- package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
- package/dist/cjs/components/base/values/scalars.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/index.js +112 -108
- package/dist/esm/components/base/info-list/info-list.js +7 -6
- package/dist/esm/components/base/position-assets/constants.js +8 -0
- package/dist/esm/components/base/position-assets/index.js +6 -0
- package/dist/esm/components/base/position-assets/position-assets.js +73 -0
- package/dist/esm/components/base/values/scalars.js +52 -33
- package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
- package/dist/esm/components/index.js +662 -658
- package/dist/esm/components/with-copy/with-copy.js +1 -1
- package/dist/esm/index.js +852 -848
- package/dist/types/components/base/index.d.ts +1 -0
- package/dist/types/components/base/position-assets/constants.d.ts +5 -0
- package/dist/types/components/base/position-assets/index.d.ts +2 -0
- package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
- package/dist/types/components/base/values/scalars.d.ts +4 -0
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ export * from './more-accordion';
|
|
|
16
16
|
export * from './nested-info-stack';
|
|
17
17
|
export * from './page-title';
|
|
18
18
|
export * from './pool-apy-breakdown-card';
|
|
19
|
+
export * from './position-assets';
|
|
19
20
|
export * from './review-button';
|
|
20
21
|
export * from './section-heading';
|
|
21
22
|
export * from './segmented-tabs';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TokenAmount } from '@gearbox-protocol/sdk/model';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { PositionAssetsTest } from './constants';
|
|
4
|
+
export { PositionAssetsTest };
|
|
5
|
+
export interface PositionAssetsProps {
|
|
6
|
+
/** What this side holds. */
|
|
7
|
+
readonly assets?: readonly TokenAmount[];
|
|
8
|
+
/**
|
|
9
|
+
* The list this one is shown against — the other slot of the same row.
|
|
10
|
+
* Never rendered: it only joins the row set and the order, so two lists in
|
|
11
|
+
* `value` and `valueTo` list the same tokens in the same order and their
|
|
12
|
+
* rows line up. Pass each side the other one.
|
|
13
|
+
*/
|
|
14
|
+
readonly against?: readonly TokenAmount[];
|
|
15
|
+
/** Rendered in place of the rows when nothing survives the dust filter. */
|
|
16
|
+
readonly empty?: React.ReactNode;
|
|
17
|
+
readonly testId?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Holdings token by token, most valuable first — the position itself rather
|
|
21
|
+
* than the one number its collateral adds up to. A right-aligned column, so it
|
|
22
|
+
* reads as the value of the `InfoLine` a caller drops it into, in either slot.
|
|
23
|
+
*
|
|
24
|
+
* The rows carry no label of their own, which is why they are not `InfoLine`s:
|
|
25
|
+
* `VerticalIndicator` leaves out its left column entirely when no label is
|
|
26
|
+
* given and never justifies what remains, so a label-less row would sit on the
|
|
27
|
+
* wrong side.
|
|
28
|
+
*
|
|
29
|
+
* Dust is left out: an account carries stray fractions of a cent from
|
|
30
|
+
* rounding, and listing them buries the holdings that matter. A token the
|
|
31
|
+
* oracle cannot price is never dust — an unknown value is not a small one.
|
|
32
|
+
*/
|
|
33
|
+
export declare function PositionAssets({ assets, against, empty, testId, }: PositionAssetsProps): React.ReactElement;
|
|
34
|
+
/** One token as a side lists it. */
|
|
35
|
+
export interface AssetRow {
|
|
36
|
+
readonly token: TokenAmount["token"];
|
|
37
|
+
/** What this side holds — zero for a token only the other side has. */
|
|
38
|
+
readonly value: bigint;
|
|
39
|
+
/**
|
|
40
|
+
* What the token is worth at its richer side, which is what decides both
|
|
41
|
+
* dust and order. `null` when a side the oracle cannot price is involved.
|
|
42
|
+
*/
|
|
43
|
+
readonly worth: number | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* What earns a row, most valuable first — decided across both sides, so the
|
|
47
|
+
* order is a property of the pair rather than of the side that renders it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function visibleAssets(assets: readonly TokenAmount[] | undefined, against?: readonly TokenAmount[]): AssetRow[];
|
|
@@ -36,6 +36,10 @@ export declare function HealthFactorValue({ data, }: {
|
|
|
36
36
|
* A bare `bigint` in token units (simulate previews carry these): the only
|
|
37
37
|
* value component that needs a denomination passed with it, because the SDK
|
|
38
38
|
* hands these out without one.
|
|
39
|
+
*
|
|
40
|
+
* Shown to `formatAssetAmount`'s three decimals, with the exact amount in a
|
|
41
|
+
* tooltip — a metrics row reads better short, and nothing is lost: the figure
|
|
42
|
+
* behind the rounding stays a hover away.
|
|
39
43
|
*/
|
|
40
44
|
export declare function TokenBigint({ data, token, }: {
|
|
41
45
|
readonly data: bigint | undefined;
|