@gearbox-protocol/ui-kit 4.0.0-next.61 → 4.0.0-next.63

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.
@@ -2,28 +2,30 @@ import { cn as o, cn as t } from "./cn.js";
2
2
  import { APPROXIMATE_SYMBOL as m, formatTimestamp as a, shortenHash as f } from "./format.js";
3
3
  import { formatLeverage as x } from "./format-leverage.js";
4
4
  import { formatMoney as s, percentageTemplate as T } from "./format-money.js";
5
- import { slippageTemplate as l } from "./format-slippage.js";
5
+ import { formatUsdPrice as l } from "./format-price.js";
6
+ import { slippageTemplate as P } from "./format-slippage.js";
6
7
  import { leveragePresets as I } from "./leverage-presets.js";
7
- import { bnToLiquidationPriceView as d, parseInputToBN as h } from "./parse-input-to-bn.js";
8
- import { shortenString as w } from "./shorten-string.js";
9
- import { tokenTemplateString as M } from "./templates.js";
10
- import { openInNewWindow as S } from "./window.js";
11
- import { Z_INDEX as A } from "./z-index.js";
8
+ import { bnToLiquidationPriceView as u, parseInputToBN as w } from "./parse-input-to-bn.js";
9
+ import { shortenString as M } from "./shorten-string.js";
10
+ import { tokenTemplateString as S } from "./templates.js";
11
+ import { openInNewWindow as A } from "./window.js";
12
+ import { Z_INDEX as E } from "./z-index.js";
12
13
  export {
13
14
  m as APPROXIMATE_SYMBOL,
14
- A as Z_INDEX,
15
- d as bnToLiquidationPriceView,
15
+ E as Z_INDEX,
16
+ u as bnToLiquidationPriceView,
16
17
  o as cn,
17
18
  t as default,
18
19
  x as formatLeverage,
19
20
  s as formatMoney,
20
21
  a as formatTimestamp,
22
+ l as formatUsdPrice,
21
23
  I as leveragePresets,
22
- S as openInNewWindow,
23
- h as parseInputToBN,
24
+ A as openInNewWindow,
25
+ w as parseInputToBN,
24
26
  T as percentageTemplate,
25
27
  f as shortenHash,
26
- w as shortenString,
27
- l as slippageTemplate,
28
- M as tokenTemplateString
28
+ M as shortenString,
29
+ P as slippageTemplate,
30
+ S as tokenTemplateString
29
31
  };
@@ -3,6 +3,12 @@ import type * as React from "react";
3
3
  export interface LinkProps extends BaseLinkProps {
4
4
  /** When true, opens in new tab and shows external icon after content */
5
5
  external?: boolean;
6
+ /**
7
+ * An icon before the text — a token logo, most often. Rendered inside the
8
+ * anchor so it stays part of the click target, but outside `.content-wrap`
9
+ * so the underline stops at the words, exactly as the external icon does.
10
+ */
11
+ leadingIcon?: React.ReactNode;
6
12
  }
7
13
  /**
8
14
  * Link — wraps BaseLink with ContentWrap and optional IconWrap (external icon).
@@ -12,9 +18,10 @@ export interface LinkProps extends BaseLinkProps {
12
18
  * ```tsx
13
19
  * <Link href="/page">Internal</Link>
14
20
  * <Link href="https://example.com" external>External</Link>
21
+ * <Link href="/token" leadingIcon={<TokenIcon token={t} size={16} />}>wstETH</Link>
15
22
  * ```
16
23
  */
17
- export declare function Link({ className, children, href, target, variant, size, color, external, asChild, ...rest }: React.PropsWithChildren<LinkProps>): React.ReactElement;
24
+ export declare function Link({ className, children, href, target, variant, size, color, external, asChild, leadingIcon, ...rest }: React.PropsWithChildren<LinkProps>): React.ReactElement;
18
25
  export declare namespace Link {
19
26
  var displayName: string;
20
27
  }
@@ -128,58 +128,6 @@ interface GridTableRowProps extends GridProps {
128
128
  */
129
129
  rel?: string;
130
130
  }
131
- /**
132
- * GridTableRow — row component of a GridTable.
133
- *
134
- * @usage
135
- * Use GridTableRow to create table rows in grid tables:
136
- * data rows, table entries with hover effects and borders.
137
- *
138
- * Props:
139
- * - `cols` — number of columns or custom grid template.
140
- * - `gap` — gap between cells (defaults to 0).
141
- * - `last` — whether this is the last row (removes bottom border).
142
- * - `height` — custom height for the row (string or number in pixels).
143
- * - `hideValue` — whether to hide value cells (for loading states).
144
- * - `onRowClick` — click handler for the row (makes entire row clickable).
145
- * - `href` — URL for the row link (renders as `<a>`, supports native link behavior).
146
- * - `target` — link target (e.g., "_blank"). Only used with `href`.
147
- * - `rel` — link rel attribute. Only used with `href`.
148
- *
149
- * Note: Automatically applies bottom border, hover effects, and selected state styling to all child elements.
150
- *
151
- * @example
152
- * ```tsx
153
- * <GridTableRow>
154
- * <GridTableCell>Data</GridTableCell>
155
- * </GridTableRow>
156
- *
157
- * // Last row (no bottom border)
158
- * <GridTableRow last>
159
- * <GridTableCell>Last row</GridTableCell>
160
- * </GridTableRow>
161
- *
162
- * // Custom height
163
- * <GridTableRow height="50px">
164
- * <GridTableCell>Tall row</GridTableCell>
165
- * </GridTableRow>
166
- *
167
- * // Clickable row
168
- * <GridTableRow onRowClick={() => navigate('/details/123')}>
169
- * <GridTableCell>Clickable row</GridTableCell>
170
- * </GridTableRow>
171
- *
172
- * // Link row (native <a> element)
173
- * <GridTableRow href="/pools/0x1234">
174
- * <GridTableCell>Linked row</GridTableCell>
175
- * </GridTableRow>
176
- *
177
- * // External link row
178
- * <GridTableRow href="https://etherscan.io" target="_blank">
179
- * <GridTableCell>External link row</GridTableCell>
180
- * </GridTableRow>
181
- * ```
182
- */
183
131
  declare const GridTableRow: React.ForwardRefExoticComponent<GridTableRowProps & React.RefAttributes<HTMLDivElement | HTMLAnchorElement>>;
184
132
  declare const gridTableHeadVariants: (props?: ({
185
133
  size?: "default" | "sm" | "lg" | null | undefined;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A price as a table shows it: no `K`/`M` abbreviation, and precision that
3
+ * follows magnitude — cents below a thousand, whole units at or above it.
4
+ *
5
+ * `formatMoney` cannot do this: it routes through the SDK's `formatBN`, which
6
+ * abbreviates unconditionally and has no switch.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * formatUsdPrice(4.2055) // "$4.21"
11
+ * formatUsdPrice(3412.5) // "$3,413"
12
+ * ```
13
+ */
14
+ export declare function formatUsdPrice(value: number): string;
@@ -3,6 +3,7 @@ export { cn as default } from './cn';
3
3
  export * from './format';
4
4
  export * from './format-leverage';
5
5
  export * from './format-money';
6
+ export * from './format-price';
6
7
  export * from './format-slippage';
7
8
  export * from './leverage-presets';
8
9
  export * from './parse-input-to-bn';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.61",
3
+ "version": "4.0.0-next.63",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",