@chainberry/ui-components 1.0.29 → 1.0.30

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/index.d.ts CHANGED
@@ -627,6 +627,19 @@ export declare function CurrencyNetwork({ code, network, codeSrc, networkSrc, si
627
627
  className?: string;
628
628
  }): JSX.Element;
629
629
 
630
+ /** Which balance a row action was chosen on: the currency, plus the network
631
+ when it came from an expanded network row rather than the rolled-up
632
+ currency row. Enough for the host app to open a flow with the coin (and,
633
+ where it knows it, the network) already picked. */
634
+ export declare type CurrencyRowTarget = {
635
+ /** currency code, e.g. "USDT" */
636
+ code: string;
637
+ /** network code of the sub-row, e.g. "TRX" — absent on the currency row */
638
+ network?: string;
639
+ /** display name of that network, e.g. "Tron (TRC-20)" */
640
+ networkName?: string;
641
+ };
642
+
630
643
  declare const DAILY_BALANCES: DailyBalance[];
631
644
 
632
645
  /** One day in the daily-balances ledger. `null` figures render as an em dash. */
@@ -2396,17 +2409,32 @@ declare const WALLET_TIERS: {
2396
2409
 
2397
2410
  export declare type WalletActionId = "withdraw" | "deposit" | "convert";
2398
2411
 
2399
- export declare function WalletBalancesTable({ balances, actionsVariant, className, }: {
2412
+ export declare function WalletBalancesTable({ balances, actionsVariant, onRowAction, rowActions, actionLabels, className, }: {
2400
2413
  balances: CurrencyBalance[];
2401
2414
  actionsVariant?: "icons" | "menu";
2415
+ /** Fired when a row's action is chosen. Without it the menu still renders
2416
+ but does nothing — pass `rowActions={[]}` to drop it entirely. */
2417
+ onRowAction?: (action: WalletActionId, target: CurrencyRowTarget) => void;
2418
+ /** Which actions each row offers, in order. Defaults to all three; `[]`
2419
+ renders no actions column content (read-only view). */
2420
+ rowActions?: WalletActionId[];
2421
+ /** Translated action labels; unset keys fall back to English. */
2422
+ actionLabels?: Partial<Record<WalletActionId, string>>;
2402
2423
  className?: string;
2403
2424
  }): JSX.Element;
2404
2425
 
2405
- export declare function WalletBalancesTableV2({ balances, actionsVariant, tierLabels, className, }: {
2426
+ export declare function WalletBalancesTableV2({ balances, actionsVariant, tierLabels, onRowAction, rowActions, actionLabels, className, }: {
2406
2427
  balances: CurrencyBalance[];
2407
2428
  actionsVariant?: "icons" | "menu";
2408
2429
  /** Translated tier column headers; unset keys fall back to English. */
2409
2430
  tierLabels?: Partial<Record<WalletTier, string>>;
2431
+ /** Fired when a row's action is chosen — see WalletBalancesTable. */
2432
+ onRowAction?: (action: WalletActionId, target: CurrencyRowTarget) => void;
2433
+ /** Which actions each row offers, in order. Defaults to all three; `[]`
2434
+ renders no actions column content (read-only view). */
2435
+ rowActions?: WalletActionId[];
2436
+ /** Translated action labels; unset keys fall back to English. */
2437
+ actionLabels?: Partial<Record<WalletActionId, string>>;
2410
2438
  className?: string;
2411
2439
  }): JSX.Element;
2412
2440
 
package/dist/index.mjs CHANGED
@@ -163866,37 +163866,37 @@ function N9({ money: e, code: t, strong: n = !1, large: r = !1, muted: i = !1, a
163866
163866
  })
163867
163867
  });
163868
163868
  }
163869
- function HWe({ balances: e, actionsVariant: t = "menu", className: r }) {
163870
- let { setExtension: i, stickyTop: a } = y7(), s = u(null), [c, l] = d(/* @__PURE__ */ new Set()), f = (e) => l((t) => {
163869
+ function HWe({ balances: e, actionsVariant: t = "menu", onRowAction: r, rowActions: i, actionLabels: a, className: s }) {
163870
+ let { setExtension: c, stickyTop: l } = y7(), f = u(null), [p, m] = d(/* @__PURE__ */ new Set()), h = (e) => m((t) => {
163871
163871
  let n = new Set(t);
163872
163872
  return n.has(e) ? n.delete(e) : n.add(e), n;
163873
163873
  });
163874
163874
  o(() => {
163875
- let e = s.current;
163875
+ let e = f.current;
163876
163876
  if (!e) return;
163877
163877
  let t = e.closest("main"), n = new IntersectionObserver(([t]) => {
163878
- let n = !t.isIntersecting && t.boundingClientRect.top <= a, r = e.nextElementSibling?.querySelector("thead");
163879
- i(n ? r?.offsetHeight ?? 0 : 0);
163878
+ let n = !t.isIntersecting && t.boundingClientRect.top <= l, r = e.nextElementSibling?.querySelector("thead");
163879
+ c(n ? r?.offsetHeight ?? 0 : 0);
163880
163880
  }, {
163881
163881
  root: t,
163882
- rootMargin: `-${a}px 0px 0px 0px`,
163882
+ rootMargin: `-${l}px 0px 0px 0px`,
163883
163883
  threshold: 0
163884
163884
  });
163885
163885
  return n.observe(e), () => {
163886
- n.disconnect(), i(0);
163886
+ n.disconnect(), c(0);
163887
163887
  };
163888
- }, [i, a]);
163889
- let p = e.map(VWe);
163888
+ }, [c, l]);
163889
+ let y = e.map(VWe);
163890
163890
  return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
163891
- ref: s,
163891
+ ref: f,
163892
163892
  "aria-hidden": !0,
163893
163893
  className: "h-px"
163894
163894
  }), /* @__PURE__ */ v(t7, {
163895
163895
  containerClassName: "overflow-x-visible",
163896
- className: P("mt-0.5 table-fixed border-separate border-spacing-0", r),
163896
+ className: P("mt-0.5 table-fixed border-separate border-spacing-0", s),
163897
163897
  children: [/* @__PURE__ */ _(n7, {
163898
- className: P("sticky z-30", a === 0 && "bg-white/85 dark:bg-background/85 backdrop-blur-md"),
163899
- style: { top: a },
163898
+ className: P("sticky z-30", l === 0 && "bg-white/85 dark:bg-background/85 backdrop-blur-md"),
163899
+ style: { top: l },
163900
163900
  children: /* @__PURE__ */ v(H, {
163901
163901
  className: "hover:bg-transparent",
163902
163902
  children: [
@@ -163919,24 +163919,24 @@ function HWe({ balances: e, actionsVariant: t = "menu", className: r }) {
163919
163919
  /* @__PURE__ */ _(U, { className: "w-20 border-b-2 border-cb-line py-2 pr-4" })
163920
163920
  ]
163921
163921
  })
163922
- }), /* @__PURE__ */ _(r7, { children: p.map((e) => {
163923
- let r = e.networkCount > 1, i = r && c.has(e.code);
163922
+ }), /* @__PURE__ */ _(r7, { children: y.map((e) => {
163923
+ let o = e.networkCount > 1, s = o && p.has(e.code);
163924
163924
  return /* @__PURE__ */ v(n, { children: [/* @__PURE__ */ v(H, {
163925
- className: P(r && "cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-800/40", !r && "hover:bg-transparent"),
163926
- "aria-expanded": r ? i : void 0,
163927
- onClick: r ? () => f(e.code) : void 0,
163925
+ className: P(o && "cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-800/40", !o && "hover:bg-transparent"),
163926
+ "aria-expanded": o ? s : void 0,
163927
+ onClick: o ? () => h(e.code) : void 0,
163928
163928
  children: [
163929
163929
  /* @__PURE__ */ _(W, {
163930
163930
  className: "border-b border-cb-line py-2.5 pl-4 align-top",
163931
163931
  children: /* @__PURE__ */ v("div", {
163932
163932
  className: "flex items-center gap-3",
163933
163933
  children: [
163934
- r ? /* @__PURE__ */ _(S, {
163934
+ o ? /* @__PURE__ */ _(S, {
163935
163935
  icon: L,
163936
163936
  size: 16,
163937
163937
  strokeWidth: 2,
163938
163938
  "aria-hidden": !0,
163939
- className: P("shrink-0 text-muted-foreground transition-transform", !i && "-rotate-90")
163939
+ className: P("shrink-0 text-muted-foreground transition-transform", !s && "-rotate-90")
163940
163940
  }) : /* @__PURE__ */ _("span", {
163941
163941
  "aria-hidden": !0,
163942
163942
  className: "size-4 shrink-0"
@@ -163993,12 +163993,15 @@ function HWe({ balances: e, actionsVariant: t = "menu", className: r }) {
163993
163993
  onClick: (e) => e.stopPropagation(),
163994
163994
  children: /* @__PURE__ */ _(D9, {
163995
163995
  variant: t,
163996
- label: `${e.code} actions`
163996
+ label: `${e.code} actions`,
163997
+ actions: i,
163998
+ labels: a,
163999
+ onAction: (t) => r?.(t, { code: e.code })
163997
164000
  })
163998
164001
  })
163999
164002
  })
164000
164003
  ]
164001
- }), i && e.networks.map((n) => /* @__PURE__ */ v(H, {
164004
+ }), s && e.networks.map((n) => /* @__PURE__ */ v(H, {
164002
164005
  className: "bg-slate-50/60 hover:bg-slate-100/60 dark:bg-slate-800/20 dark:hover:bg-slate-800/40",
164003
164006
  children: [
164004
164007
  /* @__PURE__ */ _(W, {
@@ -164054,7 +164057,14 @@ function HWe({ balances: e, actionsVariant: t = "menu", className: r }) {
164054
164057
  className: "flex items-center justify-end",
164055
164058
  children: /* @__PURE__ */ _(D9, {
164056
164059
  variant: t,
164057
- label: `${e.code} ${n.networkName} actions`
164060
+ label: `${e.code} ${n.networkName} actions`,
164061
+ actions: i,
164062
+ labels: a,
164063
+ onAction: (t) => r?.(t, {
164064
+ code: e.code,
164065
+ network: n.network,
164066
+ networkName: n.networkName
164067
+ })
164058
164068
  })
164059
164069
  })
164060
164070
  })
@@ -164174,40 +164184,40 @@ function z9({ money: e, code: t, strong: n = !1, large: r = !1, muted: i = !1, a
164174
164184
  })
164175
164185
  });
164176
164186
  }
164177
- function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className: i }) {
164178
- let a = {
164187
+ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, onRowAction: i, rowActions: a, actionLabels: s, className: c }) {
164188
+ let l = {
164179
164189
  ...WWe,
164180
164190
  ...r
164181
- }, { setExtension: s, stickyTop: c } = y7(), l = u(null), [f, p] = d(/* @__PURE__ */ new Set()), m = (e) => p((t) => {
164191
+ }, { setExtension: f, stickyTop: p } = y7(), m = u(null), [h, y] = d(/* @__PURE__ */ new Set()), b = (e) => y((t) => {
164182
164192
  let n = new Set(t);
164183
164193
  return n.has(e) ? n.delete(e) : n.add(e), n;
164184
164194
  });
164185
164195
  o(() => {
164186
- let e = l.current;
164196
+ let e = m.current;
164187
164197
  if (!e) return;
164188
164198
  let t = e.closest("main"), n = new IntersectionObserver(([t]) => {
164189
- let n = !t.isIntersecting && t.boundingClientRect.top <= c, r = e.nextElementSibling?.querySelector("thead");
164190
- s(n ? r?.offsetHeight ?? 0 : 0);
164199
+ let n = !t.isIntersecting && t.boundingClientRect.top <= p, r = e.nextElementSibling?.querySelector("thead");
164200
+ f(n ? r?.offsetHeight ?? 0 : 0);
164191
164201
  }, {
164192
164202
  root: t,
164193
- rootMargin: `-${c}px 0px 0px 0px`,
164203
+ rootMargin: `-${p}px 0px 0px 0px`,
164194
164204
  threshold: 0
164195
164205
  });
164196
164206
  return n.observe(e), () => {
164197
- n.disconnect(), s(0);
164207
+ n.disconnect(), f(0);
164198
164208
  };
164199
- }, [s, c]);
164200
- let h = e.map(YWe);
164209
+ }, [f, p]);
164210
+ let x = e.map(YWe);
164201
164211
  return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
164202
- ref: l,
164212
+ ref: m,
164203
164213
  "aria-hidden": !0,
164204
164214
  className: "h-px"
164205
164215
  }), /* @__PURE__ */ v(t7, {
164206
164216
  containerClassName: "overflow-x-visible",
164207
- className: P("mt-0.5 table-fixed border-separate border-spacing-0", i),
164217
+ className: P("mt-0.5 table-fixed border-separate border-spacing-0", c),
164208
164218
  children: [/* @__PURE__ */ _(n7, {
164209
- className: P("sticky z-30", c === 0 && "bg-white/85 dark:bg-background/85 backdrop-blur-md"),
164210
- style: { top: c },
164219
+ className: P("sticky z-30", p === 0 && "bg-white/85 dark:bg-background/85 backdrop-blur-md"),
164220
+ style: { top: p },
164211
164221
  children: /* @__PURE__ */ v(H, {
164212
164222
  className: "hover:bg-transparent",
164213
164223
  children: [
@@ -164217,7 +164227,7 @@ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className
164217
164227
  }),
164218
164228
  P9.map((e) => /* @__PURE__ */ _(U, {
164219
164229
  className: "w-[13%] border-b-2 border-cb-line py-2 pl-4",
164220
- children: a[e]
164230
+ children: l[e]
164221
164231
  }, e)),
164222
164232
  /* @__PURE__ */ _(U, {
164223
164233
  className: "border-b-2 border-cb-line py-2 pr-4 text-right",
@@ -164226,12 +164236,12 @@ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className
164226
164236
  /* @__PURE__ */ _(U, { className: "w-16 border-b-2 border-cb-line py-2 pr-4" })
164227
164237
  ]
164228
164238
  })
164229
- }), /* @__PURE__ */ _(r7, { children: h.map((e) => {
164230
- let r = e.networkCount > 1, i = r && f.has(e.code);
164239
+ }), /* @__PURE__ */ _(r7, { children: x.map((e) => {
164240
+ let r = e.networkCount > 1, o = r && h.has(e.code);
164231
164241
  return /* @__PURE__ */ v(n, { children: [/* @__PURE__ */ v(H, {
164232
164242
  className: P(r && "cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-800/40", !r && "hover:bg-transparent"),
164233
- "aria-expanded": r ? i : void 0,
164234
- onClick: r ? () => m(e.code) : void 0,
164243
+ "aria-expanded": r ? o : void 0,
164244
+ onClick: r ? () => b(e.code) : void 0,
164235
164245
  children: [
164236
164246
  /* @__PURE__ */ _(W, {
164237
164247
  className: "border-b border-cb-line py-2.5 pl-4 align-top",
@@ -164243,7 +164253,7 @@ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className
164243
164253
  size: 16,
164244
164254
  strokeWidth: 2,
164245
164255
  "aria-hidden": !0,
164246
- className: P("shrink-0 text-muted-foreground transition-transform", !i && "-rotate-90")
164256
+ className: P("shrink-0 text-muted-foreground transition-transform", !o && "-rotate-90")
164247
164257
  }) : /* @__PURE__ */ _("span", {
164248
164258
  "aria-hidden": !0,
164249
164259
  className: "size-4 shrink-0"
@@ -164290,12 +164300,15 @@ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className
164290
164300
  onClick: (e) => e.stopPropagation(),
164291
164301
  children: /* @__PURE__ */ _(D9, {
164292
164302
  variant: t,
164293
- label: `${e.code} actions`
164303
+ label: `${e.code} actions`,
164304
+ actions: a,
164305
+ labels: s,
164306
+ onAction: (t) => i?.(t, { code: e.code })
164294
164307
  })
164295
164308
  })
164296
164309
  })
164297
164310
  ]
164298
- }), i && e.networks.map((n) => /* @__PURE__ */ v(H, {
164311
+ }), o && e.networks.map((n) => /* @__PURE__ */ v(H, {
164299
164312
  className: "bg-slate-50/60 hover:bg-slate-100/60 dark:bg-slate-800/20 dark:hover:bg-slate-800/40",
164300
164313
  children: [
164301
164314
  /* @__PURE__ */ _(W, {
@@ -164342,7 +164355,14 @@ function XWe({ balances: e, actionsVariant: t = "menu", tierLabels: r, className
164342
164355
  className: "flex items-center justify-end",
164343
164356
  children: /* @__PURE__ */ _(D9, {
164344
164357
  variant: t,
164345
- label: `${e.code} ${n.networkName} actions`
164358
+ label: `${e.code} ${n.networkName} actions`,
164359
+ actions: a,
164360
+ labels: s,
164361
+ onAction: (t) => i?.(t, {
164362
+ code: e.code,
164363
+ network: n.network,
164364
+ networkName: n.networkName
164365
+ })
164346
164366
  })
164347
164367
  })
164348
164368
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainberry/ui-components",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "Chainberry navigation UI components — React + Tailwind. Canonical source lives in ../../react-app/src/components; this package re-exports, builds, and publishes them.",
5
5
  "license": "ISC",
6
6
  "type": "module",