kaleido-ui 0.2.2 → 0.2.5
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/README.md +80 -18
- package/dist/icon-AvUL0Cws.d.cts +135 -0
- package/dist/icon-AvUL0Cws.d.ts +135 -0
- package/dist/native/index.cjs +0 -126
- package/dist/native/index.js +0 -126
- package/dist/web/assets/kaleidoswap-brand.js +11 -0
- package/dist/web/assets/protocol-icons.js +7 -0
- package/dist/web/chunk-25RRZDZ2.js +269 -0
- package/dist/web/chunk-2Q5SSNFO.js +63 -0
- package/dist/web/chunk-2VKFRAX3.js +39 -0
- package/dist/web/chunk-3CHDKHXW.js +150 -0
- package/dist/web/chunk-4BTXTIE6.js +126 -0
- package/dist/web/chunk-4L55ANVR.js +330 -0
- package/dist/web/chunk-4UMKXXAK.js +33 -0
- package/dist/web/chunk-536NL4X2.js +89 -0
- package/dist/web/chunk-563GMWFT.js +32 -0
- package/dist/web/chunk-5GBURTY4.js +33 -0
- package/dist/web/chunk-5INE4WNW.js +291 -0
- package/dist/web/chunk-5MM5YGGG.js +43 -0
- package/dist/web/chunk-5NCVH6N5.js +81 -0
- package/dist/web/chunk-5V2KMO56.js +55 -0
- package/dist/web/chunk-5WBAFYPH.js +62 -0
- package/dist/web/chunk-6PNGSAJB.js +55 -0
- package/dist/web/chunk-7L35JISL.js +106 -0
- package/dist/web/chunk-7L7DQFHJ.js +85 -0
- package/dist/web/chunk-7OE6AXLY.js +27 -0
- package/dist/web/chunk-7Y7FEBKK.js +85 -0
- package/dist/web/chunk-A6MSV4MA.js +83 -0
- package/dist/web/chunk-A7MPRLJL.js +169 -0
- package/dist/web/chunk-AMIAAHZM.js +232 -0
- package/dist/web/chunk-ASHU5XNR.js +21 -0
- package/dist/web/chunk-AU5ZGWGA.js +247 -0
- package/dist/web/chunk-AVJ56TMD.js +107 -0
- package/dist/web/chunk-AWKCO62W.js +191 -0
- package/dist/web/chunk-BGUBHWIO.js +41 -0
- package/dist/web/chunk-BYHIH2LP.js +56 -0
- package/dist/web/chunk-CBE7BT3M.js +87 -0
- package/dist/web/chunk-CJATW6EO.js +108 -0
- package/dist/web/chunk-CPIM2QKZ.js +666 -0
- package/dist/web/chunk-CRMLYZIX.js +35 -0
- package/dist/web/chunk-CXLGQSHM.js +417 -0
- package/dist/web/chunk-CXMCWSWC.js +20 -0
- package/dist/web/chunk-CXPYTWEC.js +43 -0
- package/dist/web/chunk-CZGN7SQH.js +41 -0
- package/dist/web/chunk-CZPNI33A.js +31 -0
- package/dist/web/chunk-D2ZG6TZM.js +96 -0
- package/dist/web/chunk-D5CPIS6B.js +169 -0
- package/dist/web/chunk-DCUAE6PX.js +202 -0
- package/dist/web/chunk-DUAFJ3CX.js +179 -0
- package/dist/web/chunk-DV66AZXI.js +368 -0
- package/dist/web/chunk-DY72P3EE.js +86 -0
- package/dist/web/chunk-DZMOH67F.js +43 -0
- package/dist/web/chunk-EBQ35SOM.js +177 -0
- package/dist/web/chunk-EXWE5KM6.js +48 -0
- package/dist/web/chunk-F2LIZX5K.js +140 -0
- package/dist/web/chunk-FSQV54O4.js +61 -0
- package/dist/web/chunk-G26YNXL3.js +82 -0
- package/dist/web/chunk-G2MJL3VP.js +54 -0
- package/dist/web/chunk-G2ZYNR3W.js +28 -0
- package/dist/web/chunk-GEXPB5CG.js +63 -0
- package/dist/web/chunk-GX5URFML.js +375 -0
- package/dist/web/chunk-GZZ5KVON.js +70 -0
- package/dist/web/chunk-H3GYLFHP.js +30 -0
- package/dist/web/chunk-HKF7IPXV.js +146 -0
- package/dist/web/chunk-HKIYPISK.js +175 -0
- package/dist/web/chunk-HLPL5AHD.js +54 -0
- package/dist/web/chunk-HO65ENYH.js +99 -0
- package/dist/web/chunk-HP25HN7Q.js +69 -0
- package/dist/web/chunk-HVKSBEZN.js +98 -0
- package/dist/web/chunk-HWKXZNBN.js +74 -0
- package/dist/web/chunk-HY3VMT27.js +64 -0
- package/dist/web/chunk-I2N3HZ4M.js +60 -0
- package/dist/web/chunk-I7KNV2UC.js +109 -0
- package/dist/web/chunk-INKE5FS6.js +128 -0
- package/dist/web/chunk-IWDBETXQ.js +254 -0
- package/dist/web/chunk-IZCLPO4E.js +42 -0
- package/dist/web/chunk-JY3H7ZAI.js +41 -0
- package/dist/web/chunk-JYM5NHBA.js +80 -0
- package/dist/web/chunk-K7JVP24O.js +89 -0
- package/dist/web/chunk-KDNYIMGR.js +197 -0
- package/dist/web/chunk-KMQN66HU.js +27 -0
- package/dist/web/chunk-LOGZGZWN.js +1 -0
- package/dist/web/chunk-LPDB7EHH.js +65 -0
- package/dist/web/chunk-LSY4DY2I.js +72 -0
- package/dist/web/chunk-LYLWGJ4R.js +66 -0
- package/dist/web/chunk-MKMZH4XD.js +98 -0
- package/dist/web/chunk-MTQ22SKE.js +39 -0
- package/dist/web/chunk-MTQOAMDW.js +8 -0
- package/dist/web/chunk-NEXA6VGG.js +91 -0
- package/dist/web/chunk-NHOCTXPF.js +151 -0
- package/dist/web/chunk-NNGVB3US.js +176 -0
- package/dist/web/chunk-NXPVF5WX.js +74 -0
- package/dist/web/chunk-O2TTO5FS.js +24 -0
- package/dist/web/chunk-O4IIYGDL.js +70 -0
- package/dist/web/chunk-OI7WX7NE.js +17 -0
- package/dist/web/chunk-OWSKP527.js +80 -0
- package/dist/web/chunk-OX3J3FYX.js +64 -0
- package/dist/web/chunk-OZXDXNMR.js +110 -0
- package/dist/web/chunk-PIXLIWSO.js +62 -0
- package/dist/web/chunk-PMGIJMRO.js +207 -0
- package/dist/web/chunk-Q2IXLUSM.js +56 -0
- package/dist/web/chunk-QGWVZ5NG.js +73 -0
- package/dist/web/chunk-QLUUM53Z.js +90 -0
- package/dist/web/chunk-QRFFLA3N.js +84 -0
- package/dist/web/chunk-QTZT7QMI.js +83 -0
- package/dist/web/chunk-QXZ2WY3B.js +38 -0
- package/dist/web/chunk-R2MV4S4U.js +50 -0
- package/dist/web/chunk-RA5YGBRB.js +106 -0
- package/dist/web/chunk-RIOY4LFJ.js +141 -0
- package/dist/web/chunk-RULT57JR.js +85 -0
- package/dist/web/chunk-RWJHJMVJ.js +67 -0
- package/dist/web/chunk-RXXYUYBP.js +25 -0
- package/dist/web/chunk-SGXLWU4V.js +96 -0
- package/dist/web/chunk-SIE2FP2T.js +62 -0
- package/dist/web/chunk-STMNX3QT.js +109 -0
- package/dist/web/chunk-SUOATMIA.js +113 -0
- package/dist/web/chunk-SVYDLG2C.js +558 -0
- package/dist/web/chunk-T2NBG4KF.js +276 -0
- package/dist/web/chunk-T7CEJV6P.js +66 -0
- package/dist/web/chunk-TAA6PO5V.js +63 -0
- package/dist/web/chunk-TI7NWMEQ.js +34 -0
- package/dist/web/chunk-TJGHAD5O.js +40 -0
- package/dist/web/chunk-TKRMGN7J.js +8 -0
- package/dist/web/chunk-TS4UYWJJ.js +105 -0
- package/dist/web/chunk-TY6SGZC7.js +94 -0
- package/dist/web/chunk-U2UWLSDG.js +86 -0
- package/dist/web/chunk-UHXOPILM.js +101 -0
- package/dist/web/chunk-UXLWWQ4J.js +20 -0
- package/dist/web/chunk-UZ4LWR4X.js +26 -0
- package/dist/web/chunk-V3UI2XX7.js +444 -0
- package/dist/web/chunk-VAMCLWLF.js +403 -0
- package/dist/web/chunk-VLZMX43R.js +45 -0
- package/dist/web/chunk-VM6AGMYO.js +46 -0
- package/dist/web/chunk-VNL2QI5B.js +43 -0
- package/dist/web/chunk-VYQHGSK6.js +244 -0
- package/dist/web/chunk-W4E2N3UN.js +58 -0
- package/dist/web/chunk-W4G74KFZ.js +362 -0
- package/dist/web/chunk-WBW5E6LC.js +101 -0
- package/dist/web/chunk-WEPSTI3Z.js +83 -0
- package/dist/web/chunk-WOAWUXER.js +139 -0
- package/dist/web/chunk-X2RA4EG3.js +86 -0
- package/dist/web/chunk-X3MYWPNO.js +230 -0
- package/dist/web/chunk-XDSOOOYL.js +35 -0
- package/dist/web/chunk-XIMTRQZ3.js +220 -0
- package/dist/web/chunk-XMUXOKIP.js +159 -0
- package/dist/web/chunk-XXH4TYKZ.js +276 -0
- package/dist/web/chunk-XYNURYMC.js +129 -0
- package/dist/web/chunk-XZQUQOR3.js +48 -0
- package/dist/web/chunk-Y2W5YG6Y.js +57 -0
- package/dist/web/chunk-YFYAMVTL.js +383 -0
- package/dist/web/chunk-YLP46BJK.js +50 -0
- package/dist/web/chunk-YMM73FLL.js +84 -0
- package/dist/web/chunk-YQDCU7ZL.js +49 -0
- package/dist/web/chunk-YQQ7GDLZ.js +30 -0
- package/dist/web/chunk-YRRZ22OK.js +139 -0
- package/dist/web/chunk-YXVOFEDT.js +85 -0
- package/dist/web/chunk-Z3H2FQVX.js +120 -0
- package/dist/web/chunk-ZDCKYQKS.js +108 -0
- package/dist/web/chunk-ZR32WYJA.js +55 -0
- package/dist/web/chunk-ZTVV4KBT.js +28 -0
- package/dist/web/components/account-capabilities-card.js +21 -0
- package/dist/web/components/account-menu.js +18 -0
- package/dist/web/components/account-settings-shared.js +50 -0
- package/dist/web/components/account-status-tabs.js +20 -0
- package/dist/web/components/action-tile.js +8 -0
- package/dist/web/components/activity-detail-row.js +22 -0
- package/dist/web/components/activity-filter-bar.js +22 -0
- package/dist/web/components/activity-list.js +23 -0
- package/dist/web/components/activity-network-filters.js +19 -0
- package/dist/web/components/activity-row.js +15 -0
- package/dist/web/components/activity-type-tabs.js +17 -0
- package/dist/web/components/alert-banner.js +13 -0
- package/dist/web/components/amount.js +8 -0
- package/dist/web/components/app-icon.js +15 -0
- package/dist/web/components/asset-card.js +21 -0
- package/dist/web/components/asset-icon.js +10 -0
- package/dist/web/components/asset-selector.js +24 -0
- package/dist/web/components/balance-breakdown.js +18 -0
- package/dist/web/components/basic-collapsible.js +11 -0
- package/dist/web/components/bottom-nav.js +13 -0
- package/dist/web/components/bottom-sheet.js +15 -0
- package/dist/web/components/btc-unified-receive.js +28 -0
- package/dist/web/components/charts/bar-chart.js +24 -0
- package/dist/web/components/charts/bar-list.js +24 -0
- package/dist/web/components/charts/core.js +63 -0
- package/dist/web/components/charts/donut-chart.js +26 -0
- package/dist/web/components/charts/index.js +72 -0
- package/dist/web/components/charts/line-chart.js +26 -0
- package/dist/web/components/charts/meter.js +24 -0
- package/dist/web/components/charts/mixed-chart.js +24 -0
- package/dist/web/components/charts/scatter-chart.js +24 -0
- package/dist/web/components/charts/sparkline.js +8 -0
- package/dist/web/components/choice-group.js +11 -0
- package/dist/web/components/code-block.js +21 -0
- package/dist/web/components/confirm-dialog.js +15 -0
- package/dist/web/components/copy-button.js +21 -0
- package/dist/web/components/copyable.js +20 -0
- package/dist/web/components/date-range-filter.js +16 -0
- package/dist/web/components/deposit-asset-selection.js +24 -0
- package/dist/web/components/deposit-generated-view.js +23 -0
- package/dist/web/components/deposit-invoice-generation.js +35 -0
- package/dist/web/components/deposit-network-default-modal.js +13 -0
- package/dist/web/components/deposit-pre-generation.js +17 -0
- package/dist/web/components/deposit-success-screen.js +20 -0
- package/dist/web/components/deposit-ui-shared.js +28 -0
- package/dist/web/components/disclosure-card.js +11 -0
- package/dist/web/components/dotted-leader.js +8 -0
- package/dist/web/components/empty-state.js +8 -0
- package/dist/web/components/environment-indicator.js +9 -0
- package/dist/web/components/error-boundary.js +10 -0
- package/dist/web/components/event-timeline.js +8 -0
- package/dist/web/components/extension-page-frame.js +15 -0
- package/dist/web/components/filter-bar.js +15 -0
- package/dist/web/components/filter-chip-group.js +8 -0
- package/dist/web/components/filter-dropdown.js +12 -0
- package/dist/web/components/floating-notice.js +12 -0
- package/dist/web/components/form-field.js +10 -0
- package/dist/web/components/halo-backdrop.js +8 -0
- package/dist/web/components/info-chip.js +24 -0
- package/dist/web/components/info-panel.js +13 -0
- package/dist/web/components/inline-selector.js +11 -0
- package/dist/web/components/instants-statement.js +20 -0
- package/dist/web/components/kaleidoscope-hero-animation.js +11 -0
- package/dist/web/components/kaleidoswap-logo.js +12 -0
- package/dist/web/components/list-field.js +14 -0
- package/dist/web/components/list-summary.js +8 -0
- package/dist/web/components/metric-card.js +14 -0
- package/dist/web/components/mobile-hero-animation.js +8 -0
- package/dist/web/components/network-badge.js +14 -0
- package/dist/web/components/network-icon.js +21 -0
- package/dist/web/components/network-status-chip.js +11 -0
- package/dist/web/components/notice-bar.js +8 -0
- package/dist/web/components/one-time-secret-dialog.js +18 -0
- package/dist/web/components/option-selector.js +12 -0
- package/dist/web/components/page-header.js +12 -0
- package/dist/web/components/page-shell.js +18 -0
- package/dist/web/components/pager.js +11 -0
- package/dist/web/components/period-select.js +20 -0
- package/dist/web/components/qr-code.js +10 -0
- package/dist/web/components/query-state.js +19 -0
- package/dist/web/components/read-status.js +15 -0
- package/dist/web/components/record-list.js +17 -0
- package/dist/web/components/recovery-phrase-card.js +20 -0
- package/dist/web/components/restricted.js +9 -0
- package/dist/web/components/secret-reveal-card.js +20 -0
- package/dist/web/components/section-header.js +9 -0
- package/dist/web/components/section-label.js +8 -0
- package/dist/web/components/selectable-card.js +8 -0
- package/dist/web/components/setting-item.js +13 -0
- package/dist/web/components/settings-section-card.js +11 -0
- package/dist/web/components/settings-selector-row.js +8 -0
- package/dist/web/components/settings-tile.js +21 -0
- package/dist/web/components/skeleton.js +10 -0
- package/dist/web/components/status-badge.js +13 -0
- package/dist/web/components/status-icon-badge.js +15 -0
- package/dist/web/components/stepper-number-input.js +10 -0
- package/dist/web/components/summary-rows.js +9 -0
- package/dist/web/components/swap-badge.js +11 -0
- package/dist/web/components/swap-input-card.js +28 -0
- package/dist/web/components/swap-step-list.js +10 -0
- package/dist/web/components/switch-row.js +9 -0
- package/dist/web/components/theme-toggle.js +12 -0
- package/dist/web/components/transaction-card.js +14 -0
- package/dist/web/components/trend-chart.js +28 -0
- package/dist/web/components/value-list.js +20 -0
- package/dist/web/components/wallet-asset-list.js +22 -0
- package/dist/web/components/withdraw-amount-input.js +13 -0
- package/dist/web/components/withdraw-confirmation.js +17 -0
- package/dist/web/components/withdraw-destination-input.js +14 -0
- package/dist/web/components/withdraw-invoice-info.js +10 -0
- package/dist/web/components/withdraw-route-selector.js +9 -0
- package/dist/web/components/withdraw-success.js +12 -0
- package/dist/web/hooks/use-asset-icon.js +11 -0
- package/dist/web/hooks/use-copy-to-clipboard.js +7 -0
- package/dist/web/hooks/use-media-query.js +9 -0
- package/dist/web/hooks/use-theme-mode.js +9 -0
- package/dist/web/hooks/use-toast.js +11 -0
- package/dist/web/icons/filled.js +15 -0
- package/dist/web/icons/index.js +13 -0
- package/dist/web/icons/outlined.js +221 -0
- package/dist/web/icons/public.js +248 -0
- package/dist/web/icons.cjs +776 -0
- package/dist/web/icons.d.cts +123 -0
- package/dist/web/icons.d.ts +123 -0
- package/dist/web/index.cjs +2573 -2507
- package/dist/web/index.d.cts +32 -110
- package/dist/web/index.d.ts +32 -110
- package/dist/web/index.js +592 -14464
- package/dist/web/primitives/avatar.js +10 -0
- package/dist/web/primitives/button.js +10 -0
- package/dist/web/primitives/card.js +20 -0
- package/dist/web/primitives/collapsible.js +16 -0
- package/dist/web/primitives/dialog.js +30 -0
- package/dist/web/primitives/dot-pagination.js +8 -0
- package/dist/web/primitives/drawer.js +43 -0
- package/dist/web/primitives/dropdown-menu.js +28 -0
- package/dist/web/primitives/glyph-button.js +10 -0
- package/dist/web/primitives/icon-button.js +15 -0
- package/dist/web/primitives/icon-glyph.js +8 -0
- package/dist/web/primitives/icon.js +16 -0
- package/dist/web/primitives/input.js +9 -0
- package/dist/web/primitives/label.js +9 -0
- package/dist/web/primitives/menu-search.js +20 -0
- package/dist/web/primitives/number-input.js +11 -0
- package/dist/web/primitives/popover.js +18 -0
- package/dist/web/primitives/scroll-area.js +12 -0
- package/dist/web/primitives/select.js +27 -0
- package/dist/web/primitives/switch.js +8 -0
- package/dist/web/primitives/table.js +27 -0
- package/dist/web/primitives/tabs.js +14 -0
- package/dist/web/primitives/toast.js +24 -0
- package/dist/web/primitives/toaster.js +15 -0
- package/dist/web/primitives/tooltip.js +10 -0
- package/dist/web/utils/amount-display.js +13 -0
- package/dist/web/utils/cn.js +7 -0
- package/dist/web/utils/field-styles.js +7 -0
- package/dist/web/utils/type-roles.js +7 -0
- package/package.json +9 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartFrame,
|
|
4
|
+
ChartLegend,
|
|
5
|
+
chartSeriesLimit,
|
|
6
|
+
defaultChartFormat,
|
|
7
|
+
nextActiveIndex,
|
|
8
|
+
plotClass,
|
|
9
|
+
seriesColor,
|
|
10
|
+
useSeriesVisibility
|
|
11
|
+
} from "./chunk-CXLGQSHM.js";
|
|
12
|
+
|
|
13
|
+
// src/web/components/charts/donut-chart.tsx
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var OTHER_ID = "__other";
|
|
17
|
+
function foldSegments(segments) {
|
|
18
|
+
const positive = segments.filter((s) => s.value > 0);
|
|
19
|
+
if (positive.length <= chartSeriesLimit) return positive;
|
|
20
|
+
const sorted = [...positive].sort((a, b) => b.value - a.value);
|
|
21
|
+
const kept = sorted.slice(0, chartSeriesLimit - 1);
|
|
22
|
+
const rest = sorted.slice(chartSeriesLimit - 1).reduce((sum, s) => sum + s.value, 0);
|
|
23
|
+
const keptIds = new Set(kept.map((s) => s.id));
|
|
24
|
+
return [...positive.filter((s) => keptIds.has(s.id)), { id: OTHER_ID, label: "Other", value: rest }];
|
|
25
|
+
}
|
|
26
|
+
var polar = (cx, cy, r, angle) => [
|
|
27
|
+
cx + r * Math.sin(angle),
|
|
28
|
+
cy - r * Math.cos(angle)
|
|
29
|
+
];
|
|
30
|
+
function arcPath(cx, cy, outer, inner, start, end) {
|
|
31
|
+
const large = end - start > Math.PI ? 1 : 0;
|
|
32
|
+
const [x0, y0] = polar(cx, cy, outer, start);
|
|
33
|
+
const [x1, y1] = polar(cx, cy, outer, end);
|
|
34
|
+
const [x2, y2] = polar(cx, cy, inner, end);
|
|
35
|
+
const [x3, y3] = polar(cx, cy, inner, start);
|
|
36
|
+
return `M${x0},${y0}A${outer},${outer} 0 ${large} 1 ${x1},${y1}L${x2},${y2}A${inner},${inner} 0 ${large} 0 ${x3},${y3}Z`;
|
|
37
|
+
}
|
|
38
|
+
function DonutChart({
|
|
39
|
+
segments,
|
|
40
|
+
label,
|
|
41
|
+
formatValue = defaultChartFormat,
|
|
42
|
+
totalLabel = "Total",
|
|
43
|
+
size = 200,
|
|
44
|
+
empty,
|
|
45
|
+
className,
|
|
46
|
+
...head
|
|
47
|
+
}) {
|
|
48
|
+
const [active, setActive] = useState(null);
|
|
49
|
+
const allParts = foldSegments(segments);
|
|
50
|
+
const visibility = useSeriesVisibility(allParts.map((part) => part.id));
|
|
51
|
+
const parts = allParts.filter((part) => visibility.isVisible(part.id));
|
|
52
|
+
const total = parts.reduce((sum, s) => sum + s.value, 0);
|
|
53
|
+
if (parts.length === 0 || total <= 0) return /* @__PURE__ */ jsx(Fragment, { children: empty ?? null });
|
|
54
|
+
const cx = size / 2;
|
|
55
|
+
const cy = size / 2;
|
|
56
|
+
const outer = size / 2 - 2;
|
|
57
|
+
const inner = outer * 0.64;
|
|
58
|
+
const gap = parts.length > 1 ? 2 / outer : 0;
|
|
59
|
+
let angle = 0;
|
|
60
|
+
const arcs = parts.map((part) => {
|
|
61
|
+
const sweep = part.value / total * Math.PI * 2;
|
|
62
|
+
const start = angle + gap / 2;
|
|
63
|
+
const end = angle + sweep - gap / 2;
|
|
64
|
+
angle += sweep;
|
|
65
|
+
return { part, start, end: Math.max(start + 1e-3, end) };
|
|
66
|
+
});
|
|
67
|
+
const colorOfPart = (part) => part.id === OTHER_ID ? "var(--muted-foreground)" : seriesColor(allParts.indexOf(part));
|
|
68
|
+
const colorOf = (index) => colorOfPart(parts[index]);
|
|
69
|
+
const share = (value) => `${Math.round(value / total * 1e3) / 10}%`;
|
|
70
|
+
const activePart = active === null ? null : parts[active];
|
|
71
|
+
const onKeyDown = (event) => {
|
|
72
|
+
if (nextActiveIndex(event.key, active, parts.length) === void 0) return;
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
setActive((current) => {
|
|
75
|
+
const next = nextActiveIndex(event.key, current, parts.length);
|
|
76
|
+
return next === void 0 ? current : next;
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
ChartFrame,
|
|
81
|
+
{
|
|
82
|
+
...head,
|
|
83
|
+
label,
|
|
84
|
+
className,
|
|
85
|
+
legend: /* @__PURE__ */ jsx(
|
|
86
|
+
ChartLegend,
|
|
87
|
+
{
|
|
88
|
+
items: allParts.map((part) => ({
|
|
89
|
+
id: part.id,
|
|
90
|
+
label: visibility.isVisible(part.id) ? `${part.label} \xB7 ${share(part.value)}` : part.label,
|
|
91
|
+
color: colorOfPart(part)
|
|
92
|
+
})),
|
|
93
|
+
...visibility.legend
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
table: {
|
|
97
|
+
columns: ["Part", "Value", "Share"],
|
|
98
|
+
rows: [
|
|
99
|
+
...parts.map((part) => [part.label, formatValue(part.value), share(part.value)]),
|
|
100
|
+
[totalLabel, formatValue(total), "100%"]
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
announcement: activePart ? `${activePart.label}: ${formatValue(activePart.value)}, ${share(activePart.value)}` : void 0,
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
role: "group",
|
|
108
|
+
"aria-roledescription": "chart",
|
|
109
|
+
"aria-label": `${label}: ${parts.length} parts. Arrow keys move between them.`,
|
|
110
|
+
tabIndex: 0,
|
|
111
|
+
onKeyDown,
|
|
112
|
+
onBlur: () => setActive(null),
|
|
113
|
+
onPointerLeave: () => setActive(null),
|
|
114
|
+
className: `${plotClass} flex justify-center py-4`,
|
|
115
|
+
children: /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, "aria-hidden": "true", className: "block max-w-full", children: [
|
|
116
|
+
arcs.map(({ part, start, end }, index) => /* @__PURE__ */ jsx(
|
|
117
|
+
"path",
|
|
118
|
+
{
|
|
119
|
+
"data-segment": part.id,
|
|
120
|
+
d: arcPath(cx, cy, active === index ? outer + 1 : outer, inner, start, end),
|
|
121
|
+
fill: colorOf(index),
|
|
122
|
+
opacity: active !== null && active !== index ? 0.55 : 1,
|
|
123
|
+
onPointerEnter: () => setActive(index)
|
|
124
|
+
},
|
|
125
|
+
part.id
|
|
126
|
+
)),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
"text",
|
|
129
|
+
{
|
|
130
|
+
x: cx,
|
|
131
|
+
y: cy - 4,
|
|
132
|
+
textAnchor: "middle",
|
|
133
|
+
fontSize: 20,
|
|
134
|
+
fontWeight: 700,
|
|
135
|
+
fill: "var(--foreground)",
|
|
136
|
+
children: formatValue(activePart ? activePart.value : total)
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsx("text", { x: cx, y: cy + 16, textAnchor: "middle", fontSize: 11, fill: "var(--muted-foreground)", children: activePart ? `${activePart.label} \xB7 ${share(activePart.value)}` : totalLabel })
|
|
140
|
+
] })
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
foldSegments,
|
|
149
|
+
DonutChart
|
|
150
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
formatDisplayAmountText
|
|
4
|
+
} from "./chunk-VM6AGMYO.js";
|
|
5
|
+
import {
|
|
6
|
+
StatusBadge
|
|
7
|
+
} from "./chunk-LPDB7EHH.js";
|
|
8
|
+
import {
|
|
9
|
+
AssetIcon
|
|
10
|
+
} from "./chunk-SGXLWU4V.js";
|
|
11
|
+
import {
|
|
12
|
+
NetworkBadge
|
|
13
|
+
} from "./chunk-EBQ35SOM.js";
|
|
14
|
+
import {
|
|
15
|
+
eyebrow
|
|
16
|
+
} from "./chunk-MTQOAMDW.js";
|
|
17
|
+
import {
|
|
18
|
+
cn
|
|
19
|
+
} from "./chunk-PMGIJMRO.js";
|
|
20
|
+
|
|
21
|
+
// src/web/components/asset-card.tsx
|
|
22
|
+
import { useState } from "react";
|
|
23
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
function AssetCard({
|
|
25
|
+
ticker,
|
|
26
|
+
name,
|
|
27
|
+
displayBalance,
|
|
28
|
+
networks = [],
|
|
29
|
+
logoUri,
|
|
30
|
+
balanceVisible = true,
|
|
31
|
+
accentColor,
|
|
32
|
+
status,
|
|
33
|
+
isYielding,
|
|
34
|
+
onClick,
|
|
35
|
+
className
|
|
36
|
+
}) {
|
|
37
|
+
const shown = balanceVisible ? displayBalance : "\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
38
|
+
const displayShown = balanceVisible ? formatDisplayAmountText(displayBalance) : shown;
|
|
39
|
+
const [hovered, setHovered] = useState(false);
|
|
40
|
+
const showYield = isYielding ?? ["USDB"].includes(ticker.toUpperCase());
|
|
41
|
+
const gradientStyle = accentColor ? {
|
|
42
|
+
background: `linear-gradient(135deg, var(--card) 35%, ${accentColor}${hovered ? "33" : "1f"} 78%, ${accentColor}${hovered ? "55" : "3d"} 100%)`,
|
|
43
|
+
transition: "background 0.3s ease"
|
|
44
|
+
} : void 0;
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: cn(
|
|
49
|
+
"p-4 rounded-card transition-all duration-200 shadow-card-secondary relative overflow-hidden group",
|
|
50
|
+
!accentColor && "bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card",
|
|
51
|
+
onClick && "cursor-pointer hover:shadow-card-secondary hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.98]",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
style: gradientStyle,
|
|
55
|
+
onClick,
|
|
56
|
+
onMouseEnter: () => setHovered(true),
|
|
57
|
+
onMouseLeave: () => setHovered(false),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-secondary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" }),
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-10 flex min-w-0 items-center justify-between gap-3", children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
AssetIcon,
|
|
64
|
+
{
|
|
65
|
+
ticker,
|
|
66
|
+
logoUri,
|
|
67
|
+
size: 44,
|
|
68
|
+
className: "group-hover:scale-105 transition-transform"
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
"span",
|
|
74
|
+
{
|
|
75
|
+
className: cn(
|
|
76
|
+
"max-w-full truncate font-bold text-body leading-tight tracking-wide text-foreground",
|
|
77
|
+
onClick && "transition-colors"
|
|
78
|
+
),
|
|
79
|
+
title: name,
|
|
80
|
+
children: name
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-nowrap gap-1 mt-1", children: networks.map((network) => /* @__PURE__ */ jsx(NetworkBadge, { network, size: "sm" }, network)) })
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-[45%] flex-col items-end text-right", children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
"p",
|
|
89
|
+
{
|
|
90
|
+
className: "max-w-full truncate font-bold text-subhead tabular-nums tracking-tight text-foreground transition-colors group-hover:opacity-90",
|
|
91
|
+
title: shown,
|
|
92
|
+
children: displayShown
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-0.5 flex min-h-6 items-center justify-end gap-1", children: [
|
|
96
|
+
status && /* @__PURE__ */ jsx(StatusBadge, { status }),
|
|
97
|
+
status && ticker && /* @__PURE__ */ jsx("span", { className: "text-tiny text-muted-foreground", children: "\xB7" }),
|
|
98
|
+
showYield && /* @__PURE__ */ jsx("div", { title: "Yield Generating Asset", className: "text-success-fg/90 flex items-center justify-center bg-success/10 rounded-full p-0.5", children: /* @__PURE__ */ jsxs(
|
|
99
|
+
"svg",
|
|
100
|
+
{
|
|
101
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102
|
+
viewBox: "0 0 24 24",
|
|
103
|
+
fill: "none",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: "2",
|
|
106
|
+
strokeLinecap: "round",
|
|
107
|
+
strokeLinejoin: "round",
|
|
108
|
+
className: "w-3 h-3",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx("path", { d: "M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z" }),
|
|
111
|
+
/* @__PURE__ */ jsx("path", { d: "M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12" })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
) }),
|
|
115
|
+
/* @__PURE__ */ jsx("p", { className: cn("truncate text-muted-foreground", eyebrow), children: ticker })
|
|
116
|
+
] })
|
|
117
|
+
] })
|
|
118
|
+
] })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
AssetCard
|
|
126
|
+
};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
DotPagination
|
|
4
|
+
} from "./chunk-6PNGSAJB.js";
|
|
5
|
+
import {
|
|
6
|
+
BottomSheet
|
|
7
|
+
} from "./chunk-JYM5NHBA.js";
|
|
8
|
+
import {
|
|
9
|
+
AssetIcon
|
|
10
|
+
} from "./chunk-SGXLWU4V.js";
|
|
11
|
+
import {
|
|
12
|
+
ScrollArea
|
|
13
|
+
} from "./chunk-DCUAE6PX.js";
|
|
14
|
+
import {
|
|
15
|
+
NetworkBadge
|
|
16
|
+
} from "./chunk-EBQ35SOM.js";
|
|
17
|
+
import {
|
|
18
|
+
eyebrow
|
|
19
|
+
} from "./chunk-MTQOAMDW.js";
|
|
20
|
+
import {
|
|
21
|
+
LiquidNetworkIcon
|
|
22
|
+
} from "./chunk-WBW5E6LC.js";
|
|
23
|
+
import {
|
|
24
|
+
GlyphButton
|
|
25
|
+
} from "./chunk-JY3H7ZAI.js";
|
|
26
|
+
import {
|
|
27
|
+
IconGlyph
|
|
28
|
+
} from "./chunk-YQQ7GDLZ.js";
|
|
29
|
+
import {
|
|
30
|
+
cn
|
|
31
|
+
} from "./chunk-PMGIJMRO.js";
|
|
32
|
+
import {
|
|
33
|
+
Add,
|
|
34
|
+
ArrowBack,
|
|
35
|
+
ArrowForward,
|
|
36
|
+
ExpandLess,
|
|
37
|
+
ExpandMore,
|
|
38
|
+
Search,
|
|
39
|
+
SwapCalls
|
|
40
|
+
} from "./chunk-XXH4TYKZ.js";
|
|
41
|
+
|
|
42
|
+
// src/web/components/deposit-asset-selection.tsx
|
|
43
|
+
import { useEffect, useState } from "react";
|
|
44
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
45
|
+
var ADD_ASSET_SUBTITLE = {
|
|
46
|
+
RGB: "RGB asset on Bitcoin",
|
|
47
|
+
SPARK: "Spark-native asset",
|
|
48
|
+
ARKADE: "Arkade-native asset",
|
|
49
|
+
LIQUID: "L-BTC or Liquid asset"
|
|
50
|
+
};
|
|
51
|
+
var PROTOCOL_BADGE = {
|
|
52
|
+
RGB: { label: "RGB", className: "bg-network-rgb-chip text-network-rgb-fg" },
|
|
53
|
+
SPARK: { label: "Spark", className: "bg-network-spark-chip text-network-spark-fg" },
|
|
54
|
+
ARKADE: { label: "Arkade", className: "bg-network-arkade-chip text-network-arkade-fg" },
|
|
55
|
+
LIQUID: { label: "Liquid", className: "bg-network-liquid-chip text-network-liquid-fg" }
|
|
56
|
+
};
|
|
57
|
+
function formatAssetBalance(asset) {
|
|
58
|
+
const raw = asset.balance ?? 0;
|
|
59
|
+
if (raw === 0) return "0";
|
|
60
|
+
const precision = asset.precision ?? 0;
|
|
61
|
+
const value = raw / Math.pow(10, precision);
|
|
62
|
+
return value.toLocaleString("en-US", {
|
|
63
|
+
minimumFractionDigits: 0,
|
|
64
|
+
maximumFractionDigits: Math.min(precision, 8)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function DepositAssetSelection({
|
|
68
|
+
setCurrentView,
|
|
69
|
+
isNewAsset,
|
|
70
|
+
newAssetAccount,
|
|
71
|
+
newAssetId,
|
|
72
|
+
setNewAssetId,
|
|
73
|
+
searchQuery,
|
|
74
|
+
setSearchQuery,
|
|
75
|
+
filteredAssets,
|
|
76
|
+
onSelectAsset,
|
|
77
|
+
handleAddNewAsset,
|
|
78
|
+
handleContinueToGenerate,
|
|
79
|
+
isRgbConnected,
|
|
80
|
+
isSparkConnected,
|
|
81
|
+
isArkadeConnected,
|
|
82
|
+
isLiquidConnected = false
|
|
83
|
+
}) {
|
|
84
|
+
const btcAsset = filteredAssets.find((asset) => asset.ticker === "BTC");
|
|
85
|
+
const ownedAssets = filteredAssets.filter((asset) => asset.ticker !== "BTC").slice().sort((a, b) => (b.balance ?? 0) - (a.balance ?? 0));
|
|
86
|
+
const ownedAssetsCount = ownedAssets.length;
|
|
87
|
+
const noResults = filteredAssets.length === 0 && !!searchQuery;
|
|
88
|
+
const isSearching = !!searchQuery;
|
|
89
|
+
const [assetsExpanded, setAssetsExpanded] = useState(false);
|
|
90
|
+
const [showAddAssetModal, setShowAddAssetModal] = useState(false);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (isSearching) setAssetsExpanded(true);
|
|
93
|
+
}, [isSearching]);
|
|
94
|
+
const showOwnedAssets = isSearching ? true : assetsExpanded;
|
|
95
|
+
const newAssetOptions = [
|
|
96
|
+
{
|
|
97
|
+
account: "RGB",
|
|
98
|
+
title: "New RGB Asset",
|
|
99
|
+
ticker: "RGB",
|
|
100
|
+
enabled: isRgbConnected,
|
|
101
|
+
idleClass: "bg-primary/10 hover:bg-primary/20",
|
|
102
|
+
activeClass: "bg-primary/25",
|
|
103
|
+
titleHoverClass: "group-hover:text-brand"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
account: "SPARK",
|
|
107
|
+
title: "New Spark Asset",
|
|
108
|
+
ticker: "SPARK",
|
|
109
|
+
enabled: isSparkConnected,
|
|
110
|
+
idleClass: "bg-info/10 hover:bg-info/20",
|
|
111
|
+
activeClass: "bg-info/25",
|
|
112
|
+
titleHoverClass: "group-hover:text-info-fg"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
account: "ARKADE",
|
|
116
|
+
title: "New Arkade Asset",
|
|
117
|
+
ticker: "ARKADE",
|
|
118
|
+
enabled: isArkadeConnected,
|
|
119
|
+
idleClass: "bg-network-arkade/10 hover:bg-network-arkade/20",
|
|
120
|
+
activeClass: "bg-network-arkade/25",
|
|
121
|
+
titleHoverClass: "group-hover:text-network-arkade-fg"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
account: "LIQUID",
|
|
125
|
+
title: "New Liquid Asset",
|
|
126
|
+
ticker: "LIQUID",
|
|
127
|
+
enabled: isLiquidConnected,
|
|
128
|
+
idleClass: "bg-network-liquid/10 hover:bg-network-liquid/20",
|
|
129
|
+
activeClass: "bg-network-liquid/25",
|
|
130
|
+
titleHoverClass: "group-hover:text-network-liquid-fg"
|
|
131
|
+
}
|
|
132
|
+
].filter((option) => option.enabled);
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex h-screen flex-col overflow-hidden bg-background bg-page-radial pt-16 font-display text-foreground", children: [
|
|
134
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-4 top-4 z-30", children: /* @__PURE__ */ jsx(GlyphButton, { icon: ArrowBack, label: "Go back", size: "lg", onClick: () => setCurrentView("dashboard") }) }),
|
|
135
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-5 pb-3 pt-4", children: /* @__PURE__ */ jsx(
|
|
136
|
+
DotPagination,
|
|
137
|
+
{
|
|
138
|
+
count: 2,
|
|
139
|
+
index: 0,
|
|
140
|
+
ariaLabel: "Deposit step 1 of 2: select asset"
|
|
141
|
+
}
|
|
142
|
+
) }),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-5 pb-3", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
IconGlyph,
|
|
146
|
+
{
|
|
147
|
+
glyph: Search,
|
|
148
|
+
size: "sm",
|
|
149
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-secondary-content"
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
"input",
|
|
154
|
+
{
|
|
155
|
+
autoFocus: true,
|
|
156
|
+
"data-testid": "deposit-asset-search",
|
|
157
|
+
className: "w-full rounded-xl bg-card/55 bg-gradient-card ring-1 ring-inset ring-secondary/15 hover:ring-secondary/35 py-2.5 pl-10 pr-4 text-caption text-foreground shadow-inner outline-none transition-all placeholder:text-muted-foreground focus:ring-primary/50 focus:bg-foreground/8 focus:shadow-glow-primary-soft",
|
|
158
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
159
|
+
placeholder: "Search assets...",
|
|
160
|
+
type: "text",
|
|
161
|
+
value: searchQuery
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }) }),
|
|
165
|
+
/* @__PURE__ */ jsxs(ScrollArea, { className: "min-h-0 flex-1", viewportClassName: "space-y-1.5 px-5 pb-3", children: [
|
|
166
|
+
btcAsset && /* @__PURE__ */ jsxs(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
"data-testid": "deposit-asset-btc",
|
|
171
|
+
className: "group flex w-full min-w-0 items-center gap-3 overflow-hidden rounded-2xl bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card px-4 py-3 text-body shadow-card transition-all duration-200 hover-gradient-violet hover:shadow-card-hover",
|
|
172
|
+
onClick: () => onSelectAsset(btcAsset),
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: "BTC", size: 40, className: "flex-shrink-0" }),
|
|
175
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 text-left", children: [
|
|
176
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold tracking-wide text-foreground transition-colors group-hover:text-secondary-content", children: "Bitcoin" }),
|
|
177
|
+
/* @__PURE__ */ jsx("div", { className: "mt-0.5 text-caption text-foreground/55", children: "Choose destination account next" })
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden min-w-0 max-w-[42%] flex-shrink flex-wrap justify-end gap-1 min-[380px]:flex", children: [
|
|
180
|
+
/* @__PURE__ */ jsx(NetworkBadge, { network: "L1", size: "sm" }),
|
|
181
|
+
/* @__PURE__ */ jsx(NetworkBadge, { network: "LN", size: "sm" }),
|
|
182
|
+
isSparkConnected && /* @__PURE__ */ jsx(NetworkBadge, { network: "Spark", size: "sm" }),
|
|
183
|
+
isArkadeConnected && /* @__PURE__ */ jsx(NetworkBadge, { network: "Arkade", size: "sm" }),
|
|
184
|
+
isLiquidConnected && /* @__PURE__ */ jsx(NetworkBadge, { network: "Liquid", size: "sm" })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: ArrowForward, className: "flex-shrink-0 text-icon-md text-foreground/20 transition-colors group-hover:text-secondary-content" })
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
noResults ? /* @__PURE__ */ jsxs("div", { className: "py-8 text-center text-caption text-foreground/55", children: [
|
|
191
|
+
'No assets match "',
|
|
192
|
+
searchQuery,
|
|
193
|
+
'"'
|
|
194
|
+
] }) : ownedAssetsCount > 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 pt-1", children: [
|
|
195
|
+
/* @__PURE__ */ jsxs(
|
|
196
|
+
"button",
|
|
197
|
+
{
|
|
198
|
+
type: "button",
|
|
199
|
+
"data-testid": "deposit-toggle-owned-assets",
|
|
200
|
+
onClick: () => !isSearching && setAssetsExpanded((value) => !value),
|
|
201
|
+
disabled: isSearching,
|
|
202
|
+
className: cn(
|
|
203
|
+
"flex w-full items-center gap-2 rounded-2xl px-4 py-2.5 transition-all",
|
|
204
|
+
showOwnedAssets ? "bg-gradient-active ring-1 ring-inset ring-primary/40" : "bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card shadow-raised hover-gradient-violet",
|
|
205
|
+
isSearching && "cursor-default"
|
|
206
|
+
),
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground", eyebrow), children: "Your assets" }),
|
|
209
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex size-5 items-center justify-center rounded-full bg-secondary bg-gradient-violet text-tiny font-bold text-white shadow-button-violet", children: ownedAssetsCount }),
|
|
210
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
211
|
+
!isSearching && /* @__PURE__ */ jsx(IconGlyph, { glyph: showOwnedAssets ? ExpandLess : ExpandMore, size: "md", className: "text-secondary-content" })
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
showOwnedAssets && /* @__PURE__ */ jsx("div", { className: "space-y-1.5 duration-200 animate-in fade-in slide-in-from-top-1", children: ownedAssets.map((asset) => {
|
|
216
|
+
const protocolBadge = asset.accountId ? PROTOCOL_BADGE[asset.accountId] : null;
|
|
217
|
+
const balance = asset.balance ?? 0;
|
|
218
|
+
return /* @__PURE__ */ jsxs(
|
|
219
|
+
"button",
|
|
220
|
+
{
|
|
221
|
+
type: "button",
|
|
222
|
+
"data-testid": `deposit-asset-${asset.asset_id}`,
|
|
223
|
+
className: "group flex w-full min-w-0 items-center gap-3 overflow-hidden rounded-2xl bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card px-4 py-3 text-body shadow-card transition-all duration-200 hover-gradient-violet hover:shadow-card-hover",
|
|
224
|
+
onClick: () => onSelectAsset(asset),
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: asset.ticker, size: 40, className: "flex-shrink-0" }),
|
|
227
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 text-left", children: [
|
|
228
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
229
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-bold tracking-wide text-foreground transition-colors group-hover:text-secondary-content", children: asset.ticker }),
|
|
230
|
+
protocolBadge && /* @__PURE__ */ jsx(
|
|
231
|
+
"span",
|
|
232
|
+
{
|
|
233
|
+
className: cn(
|
|
234
|
+
"shrink-0 rounded-full px-1.5 py-0.5",
|
|
235
|
+
eyebrow,
|
|
236
|
+
protocolBadge.className
|
|
237
|
+
),
|
|
238
|
+
children: protocolBadge.label
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate text-caption text-foreground/55", children: asset.name ?? "Asset" })
|
|
243
|
+
] }),
|
|
244
|
+
balance > 0 && /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-right", children: [
|
|
245
|
+
/* @__PURE__ */ jsx("div", { className: "text-caption font-bold tabular-nums text-foreground", children: formatAssetBalance(asset) }),
|
|
246
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-0.5 text-foreground/55", eyebrow), children: asset.ticker })
|
|
247
|
+
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: ArrowForward, className: "flex-shrink-0 text-icon-sm text-foreground/20 transition-colors group-hover:text-secondary-content" })
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
asset.asset_id
|
|
252
|
+
);
|
|
253
|
+
}) })
|
|
254
|
+
] }) : null,
|
|
255
|
+
!searchQuery && /* @__PURE__ */ jsx("div", { className: "pb-1 pt-2", children: /* @__PURE__ */ jsxs(
|
|
256
|
+
"button",
|
|
257
|
+
{
|
|
258
|
+
type: "button",
|
|
259
|
+
onClick: () => setCurrentView("bridge"),
|
|
260
|
+
className: "group flex w-full items-center gap-3 rounded-2xl bg-gradient-to-r from-secondary/20 to-primary/10 p-3 shadow-card transition-all duration-200 hover:from-secondary/30 hover:to-primary/15 hover:shadow-card-hover",
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-secondary bg-gradient-violet text-white shadow-button-violet", children: /* @__PURE__ */ jsx(IconGlyph, { glyph: SwapCalls, className: "text-icon-lg" }) }),
|
|
263
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 text-left", children: [
|
|
264
|
+
/* @__PURE__ */ jsx("p", { className: "text-body font-semibold text-foreground transition-colors group-hover:text-secondary-content", children: "Bridge from another chain" }),
|
|
265
|
+
/* @__PURE__ */ jsx("p", { className: "text-xxs leading-tight text-foreground/55", children: "USDC, USDT, ETH, SOL via Flashnet" })
|
|
266
|
+
] }),
|
|
267
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: ArrowForward, className: "text-icon-lg text-foreground/55 transition-colors group-hover:text-secondary-content" })
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
) }),
|
|
271
|
+
!searchQuery && newAssetOptions.length > 0 && /* @__PURE__ */ jsx("div", { className: "pb-1 pt-2", children: /* @__PURE__ */ jsxs(
|
|
272
|
+
"button",
|
|
273
|
+
{
|
|
274
|
+
type: "button",
|
|
275
|
+
"data-testid": "deposit-add-asset",
|
|
276
|
+
onClick: () => setShowAddAssetModal(true),
|
|
277
|
+
className: "group flex w-full items-center gap-3 rounded-2xl bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card p-3 shadow-card transition-all duration-200 hover-gradient-violet hover:shadow-card-hover",
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-secondary/15 text-secondary-content", children: /* @__PURE__ */ jsx(IconGlyph, { glyph: Add, size: "md" }) }),
|
|
280
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 text-left", children: [
|
|
281
|
+
/* @__PURE__ */ jsx("p", { className: "text-body font-semibold text-foreground transition-colors group-hover:text-secondary-content", children: "Add an asset" }),
|
|
282
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xxs leading-tight text-foreground/55", children: [
|
|
283
|
+
"Receive a new ",
|
|
284
|
+
newAssetOptions.map((o) => o.ticker).join(", "),
|
|
285
|
+
" asset"
|
|
286
|
+
] })
|
|
287
|
+
] }),
|
|
288
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: ArrowForward, className: "text-icon-lg text-foreground/55 transition-colors group-hover:text-secondary-content" })
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
) })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
BottomSheet,
|
|
295
|
+
{
|
|
296
|
+
open: showAddAssetModal,
|
|
297
|
+
title: "Add an asset",
|
|
298
|
+
onClose: () => setShowAddAssetModal(false),
|
|
299
|
+
children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: newAssetOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
"data-testid": `deposit-new-asset-${option.account.toLowerCase()}`,
|
|
304
|
+
className: cn(
|
|
305
|
+
"group flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left shadow-raised transition-all hover:shadow-card-hover",
|
|
306
|
+
option.idleClass
|
|
307
|
+
),
|
|
308
|
+
onClick: () => {
|
|
309
|
+
setShowAddAssetModal(false);
|
|
310
|
+
handleAddNewAsset(option.account);
|
|
311
|
+
},
|
|
312
|
+
children: [
|
|
313
|
+
option.account === "LIQUID" ? /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-network-liquid/10", children: /* @__PURE__ */ jsx(LiquidNetworkIcon, { className: "size-5" }) }) : /* @__PURE__ */ jsx(AssetIcon, { ticker: option.ticker, size: 36, className: "flex-shrink-0" }),
|
|
314
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
315
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-body font-bold tracking-wide text-foreground", option.titleHoverClass), children: option.title }),
|
|
316
|
+
/* @__PURE__ */ jsx("div", { className: "mt-0.5 text-xxs text-foreground/55", children: ADD_ASSET_SUBTITLE[option.account] })
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: Add, size: "sm", className: "text-foreground/55 transition-colors group-hover:text-foreground/60" })
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
option.account
|
|
322
|
+
)) })
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
] });
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export {
|
|
329
|
+
DepositAssetSelection
|
|
330
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Label
|
|
4
|
+
} from "./chunk-H3GYLFHP.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-PMGIJMRO.js";
|
|
8
|
+
|
|
9
|
+
// src/web/components/form-field.tsx
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
function FormField({ label, children, id: idProp, hint, error, className }) {
|
|
13
|
+
const generated = React.useId();
|
|
14
|
+
const id = idProp ?? children.props.id ?? `field-${generated.replace(/:/g, "")}`;
|
|
15
|
+
const hintId = hint ? `${id}-hint` : void 0;
|
|
16
|
+
const errorId = error ? `${id}-error` : void 0;
|
|
17
|
+
const describedBy = [children.props["aria-describedby"], hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
18
|
+
const control = React.cloneElement(children, {
|
|
19
|
+
id,
|
|
20
|
+
"aria-describedby": describedBy,
|
|
21
|
+
...error ? { "aria-invalid": true } : {}
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "form-field", className: cn("flex flex-col gap-2", className), children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: id, children: label }),
|
|
25
|
+
control,
|
|
26
|
+
hint && /* @__PURE__ */ jsx("p", { id: hintId, className: "m-0 text-caption text-muted-foreground", children: hint }),
|
|
27
|
+
error && /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "m-0 text-caption text-danger-fg", children: error })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
FormField
|
|
33
|
+
};
|