kaleido-ui 0.1.42 → 0.1.43
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/web/index.cjs +145 -50
- package/dist/web/index.d.cts +21 -4
- package/dist/web/index.d.ts +21 -4
- package/dist/web/index.js +144 -50
- package/package.json +1 -1
package/dist/web/index.cjs
CHANGED
|
@@ -154,6 +154,7 @@ __export(web_exports, {
|
|
|
154
154
|
WithdrawSuccess: () => WithdrawSuccess,
|
|
155
155
|
buttonVariants: () => buttonVariants,
|
|
156
156
|
cn: () => cn,
|
|
157
|
+
formatDisplayAmountText: () => formatDisplayAmountText,
|
|
157
158
|
getAccountNetworkLabel: () => getAccountNetworkLabel,
|
|
158
159
|
getAccountNetworkUi: () => getAccountNetworkUi,
|
|
159
160
|
getAccountStatusUi: () => getAccountStatusUi,
|
|
@@ -173,6 +174,29 @@ function cn(...inputs) {
|
|
|
173
174
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
// src/web/utils/amount-display.ts
|
|
178
|
+
var NUMBER_RE = /^(-?\d[\d,]*)(?:\.(\d+))?$/;
|
|
179
|
+
function formatDisplayAmountText(value, options = {}) {
|
|
180
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
181
|
+
const unit = options.unit ?? "token";
|
|
182
|
+
const maxDecimals = unit === "sats" ? 0 : unit === "BTC" ? 8 : unit === "mBTC" ? 5 : options.maxDecimals ?? 6;
|
|
183
|
+
const raw = typeof value === "number" ? String(value) : value.trim();
|
|
184
|
+
const suffixMatch = raw.match(/(\s+[A-Za-z][\w.-]*)$/u);
|
|
185
|
+
const suffix = suffixMatch?.[1] ?? "";
|
|
186
|
+
const numeric = suffix ? raw.slice(0, -suffix.length) : raw;
|
|
187
|
+
const match = numeric.match(NUMBER_RE);
|
|
188
|
+
if (!match) return raw;
|
|
189
|
+
const num = parseFloat(numeric.replace(/,/g, ""));
|
|
190
|
+
if (!Number.isFinite(num)) return raw;
|
|
191
|
+
const factor = Math.pow(10, maxDecimals);
|
|
192
|
+
const rounded = Math.round(num * factor) / factor;
|
|
193
|
+
const formatted = rounded.toLocaleString("en-US", {
|
|
194
|
+
minimumFractionDigits: 0,
|
|
195
|
+
maximumFractionDigits: maxDecimals
|
|
196
|
+
});
|
|
197
|
+
return `${formatted}${suffix}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
176
200
|
// src/web/primitives/button.tsx
|
|
177
201
|
var React = __toESM(require("react"), 1);
|
|
178
202
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
@@ -1778,6 +1802,7 @@ function AssetCard({
|
|
|
1778
1802
|
className
|
|
1779
1803
|
}) {
|
|
1780
1804
|
const shown = balanceVisible ? displayBalance : "\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
1805
|
+
const displayShown = balanceVisible ? formatDisplayAmountText(displayBalance) : shown;
|
|
1781
1806
|
const [hovered, setHovered] = (0, import_react4.useState)(false);
|
|
1782
1807
|
const gradientStyle = accentColor ? { background: `linear-gradient(135deg, var(--card) 30%, ${accentColor}${hovered ? "77" : "55"} 75%, ${accentColor}${hovered ? "dd" : "b3"} 100%)`, transition: "background 0.3s ease" } : void 0;
|
|
1783
1808
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
@@ -1795,8 +1820,8 @@ function AssetCard({
|
|
|
1795
1820
|
onMouseLeave: () => setHovered(false),
|
|
1796
1821
|
children: [
|
|
1797
1822
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "absolute inset-0 bg-gradient-to-br from-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" }),
|
|
1798
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between
|
|
1799
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative z-10 flex min-w-0 items-center justify-between gap-3", children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
1800
1825
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1801
1826
|
AssetIcon,
|
|
1802
1827
|
{
|
|
@@ -1806,23 +1831,31 @@ function AssetCard({
|
|
|
1806
1831
|
className: "group-hover:scale-105 transition-transform"
|
|
1807
1832
|
}
|
|
1808
1833
|
),
|
|
1809
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col", children: [
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
|
|
1810
1835
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1811
1836
|
"span",
|
|
1812
1837
|
{
|
|
1813
1838
|
className: cn(
|
|
1814
|
-
"font-bold text-base leading-tight tracking-wide text-foreground",
|
|
1839
|
+
"max-w-full truncate font-bold text-base leading-tight tracking-wide text-foreground",
|
|
1815
1840
|
onClick && "transition-colors"
|
|
1816
1841
|
),
|
|
1842
|
+
title: name,
|
|
1817
1843
|
children: name
|
|
1818
1844
|
}
|
|
1819
1845
|
),
|
|
1820
1846
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-nowrap gap-1 mt-1", children: networks.map((network) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(NetworkBadge, { network, size: "sm" }, network)) })
|
|
1821
1847
|
] })
|
|
1822
1848
|
] }),
|
|
1823
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "text-right", children: [
|
|
1824
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1825
|
-
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "min-w-0 max-w-[45%] text-right", children: [
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1851
|
+
"p",
|
|
1852
|
+
{
|
|
1853
|
+
className: "max-w-full truncate font-bold text-lg tabular-nums tracking-tight text-foreground transition-colors group-hover:opacity-90",
|
|
1854
|
+
title: shown,
|
|
1855
|
+
children: displayShown
|
|
1856
|
+
}
|
|
1857
|
+
),
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-0.5 truncate text-tiny font-medium uppercase tracking-wide text-muted-foreground", children: ticker })
|
|
1826
1859
|
] })
|
|
1827
1860
|
] })
|
|
1828
1861
|
]
|
|
@@ -2591,7 +2624,7 @@ function InlineSelector({
|
|
|
2591
2624
|
),
|
|
2592
2625
|
children: [
|
|
2593
2626
|
renderPanelHeader?.(renderArgs),
|
|
2594
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-1", children: options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-white/30", children: [
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "max-h-[60vh] space-y-1 overflow-y-auto", children: options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-white/30", children: [
|
|
2595
2628
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "search", size: "md", className: "opacity-40" }),
|
|
2596
2629
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "No results" })
|
|
2597
2630
|
] }) : options.map((option) => {
|
|
@@ -3669,8 +3702,11 @@ function AssetSelector({
|
|
|
3669
3702
|
options,
|
|
3670
3703
|
categories = [],
|
|
3671
3704
|
defaultActiveCategories,
|
|
3705
|
+
networkFilter,
|
|
3706
|
+
venueFilter,
|
|
3672
3707
|
disabled,
|
|
3673
3708
|
disabledTicker,
|
|
3709
|
+
disabledId,
|
|
3674
3710
|
compact,
|
|
3675
3711
|
onOpenPanelHeightChange,
|
|
3676
3712
|
onChange
|
|
@@ -3681,21 +3717,29 @@ function AssetSelector({
|
|
|
3681
3717
|
defaultActiveCategories ?? categories.map((category) => category.id)
|
|
3682
3718
|
);
|
|
3683
3719
|
const selectedKey = selectedId ?? selectedTicker;
|
|
3684
|
-
const selected = options.find((option) =>
|
|
3720
|
+
const selected = options.find((option) => option.id === selectedKey) ?? options.find((option) => option.ticker === selectedTicker);
|
|
3721
|
+
const selectedOptionId = selected?.id ?? selectedKey;
|
|
3685
3722
|
const hasCategoryFilters = categories.length > 0;
|
|
3686
3723
|
const filtered = options.filter((option) => {
|
|
3687
3724
|
const category = option.category ?? null;
|
|
3688
|
-
const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category)
|
|
3689
|
-
|
|
3725
|
+
const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category);
|
|
3726
|
+
const matchesNetwork = !networkFilter || option.network === networkFilter;
|
|
3727
|
+
const matchesVenue = !venueFilter || option.venue === venueFilter;
|
|
3728
|
+
if (!matchesCategory || !matchesNetwork || !matchesVenue) return false;
|
|
3729
|
+
if (!search) return true;
|
|
3690
3730
|
const searchValue = search.toLowerCase();
|
|
3691
|
-
const matchesSearch = option.ticker.toLowerCase().includes(searchValue) || (option.name?.toLowerCase().includes(searchValue) ?? false);
|
|
3692
|
-
return
|
|
3731
|
+
const matchesSearch = option.ticker.toLowerCase().includes(searchValue) || (option.name?.toLowerCase().includes(searchValue) ?? false) || (option.assetId?.toLowerCase().includes(searchValue) ?? false) || (option.network?.toLowerCase().includes(searchValue) ?? false) || (option.category?.toLowerCase().includes(searchValue) ?? false);
|
|
3732
|
+
return matchesSearch;
|
|
3733
|
+
}).sort((a, b) => {
|
|
3734
|
+
if (a.id === selectedOptionId) return -1;
|
|
3735
|
+
if (b.id === selectedOptionId) return 1;
|
|
3736
|
+
return a.ticker.localeCompare(b.ticker);
|
|
3693
3737
|
});
|
|
3694
3738
|
const inlineOptions = filtered.map((option) => ({
|
|
3695
3739
|
...option,
|
|
3696
|
-
id: option.id
|
|
3740
|
+
id: option.id,
|
|
3697
3741
|
label: option.ticker,
|
|
3698
|
-
disabled: option.ticker === disabledTicker
|
|
3742
|
+
disabled: option.id === disabledId || option.ticker === disabledTicker
|
|
3699
3743
|
}));
|
|
3700
3744
|
const categoryLabelById = new Map(categories.map((category) => [category.id, category.label]));
|
|
3701
3745
|
const renderAssetOption = (option, optionSelected, optionDisabled) => {
|
|
@@ -3715,7 +3759,14 @@ function AssetSelector({
|
|
|
3715
3759
|
),
|
|
3716
3760
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-3 text-left", children: [
|
|
3717
3761
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "min-w-0 flex flex-col leading-tight", children: [
|
|
3718
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3762
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3763
|
+
"span",
|
|
3764
|
+
{
|
|
3765
|
+
className: "max-w-full truncate text-base font-bold tracking-wide text-white",
|
|
3766
|
+
title: option.name ?? option.ticker,
|
|
3767
|
+
children: option.name ?? option.ticker
|
|
3768
|
+
}
|
|
3769
|
+
),
|
|
3719
3770
|
option.network && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3720
3771
|
NetworkBadge,
|
|
3721
3772
|
{
|
|
@@ -3728,7 +3779,14 @@ function AssetSelector({
|
|
|
3728
3779
|
] }),
|
|
3729
3780
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [
|
|
3730
3781
|
optionSelected ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "rounded-full border border-primary/25 bg-primary/[0.14] px-2 py-0.5 text-xxs font-bold uppercase tracking-wide text-primary", children: "Current" }) : optionCategoryLabel && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "rounded-full bg-surface-card px-2 py-0.5 text-tiny font-bold uppercase tracking-wide text-text-dimmed shadow-inner", children: optionCategoryLabel }),
|
|
3731
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3783
|
+
"span",
|
|
3784
|
+
{
|
|
3785
|
+
className: "max-w-24 truncate text-tiny font-medium uppercase tracking-wide text-white/35",
|
|
3786
|
+
title: optionDisabled ? "In use" : option.ticker,
|
|
3787
|
+
children: optionDisabled ? "In use" : option.ticker
|
|
3788
|
+
}
|
|
3789
|
+
)
|
|
3732
3790
|
] })
|
|
3733
3791
|
] })
|
|
3734
3792
|
] });
|
|
@@ -3819,6 +3877,18 @@ function AssetSelector({
|
|
|
3819
3877
|
)
|
|
3820
3878
|
] }),
|
|
3821
3879
|
hasCategoryFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3881
|
+
"button",
|
|
3882
|
+
{
|
|
3883
|
+
type: "button",
|
|
3884
|
+
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3885
|
+
className: cn(
|
|
3886
|
+
"rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
|
|
3887
|
+
activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
|
|
3888
|
+
),
|
|
3889
|
+
children: "All"
|
|
3890
|
+
}
|
|
3891
|
+
),
|
|
3822
3892
|
categories.map((category) => {
|
|
3823
3893
|
const isActive = activeCategories.includes(category.id);
|
|
3824
3894
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -3836,28 +3906,19 @@ function AssetSelector({
|
|
|
3836
3906
|
},
|
|
3837
3907
|
category.id
|
|
3838
3908
|
);
|
|
3839
|
-
})
|
|
3840
|
-
activeCategories.length !== categories.length && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3841
|
-
"button",
|
|
3842
|
-
{
|
|
3843
|
-
type: "button",
|
|
3844
|
-
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3845
|
-
className: "ml-auto rounded-full px-2 py-1 text-tiny font-bold uppercase tracking-wide text-white/40 transition-colors hover:text-white/75",
|
|
3846
|
-
children: "All"
|
|
3847
|
-
}
|
|
3848
|
-
)
|
|
3909
|
+
})
|
|
3849
3910
|
] })
|
|
3850
3911
|
] }),
|
|
3851
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ScrollArea, { className: "min-h-0", viewportClassName: "px-2 py-2 pb-6", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-white/30", children: [
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ScrollArea, { className: "min-h-0 flex-1", viewportClassName: "max-h-[56vh] px-2 py-2 pb-6", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-white/30", children: [
|
|
3852
3913
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "search", size: "md", className: "opacity-40" }),
|
|
3853
3914
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
|
|
3854
|
-
"No
|
|
3855
|
-
search ? `
|
|
3915
|
+
"No assets match ",
|
|
3916
|
+
search ? `"${search}"` : "the active filters"
|
|
3856
3917
|
] })
|
|
3857
3918
|
] }) : filtered.map((option) => {
|
|
3858
|
-
const optionKey = option.id
|
|
3859
|
-
const optionSelected = optionKey ===
|
|
3860
|
-
const optionDisabled = option.ticker === disabledTicker;
|
|
3919
|
+
const optionKey = option.id;
|
|
3920
|
+
const optionSelected = optionKey === selectedOptionId;
|
|
3921
|
+
const optionDisabled = option.id === disabledId || option.ticker === disabledTicker;
|
|
3861
3922
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3862
3923
|
"button",
|
|
3863
3924
|
{
|
|
@@ -3890,7 +3951,7 @@ function AssetSelector({
|
|
|
3890
3951
|
InlineSelector,
|
|
3891
3952
|
{
|
|
3892
3953
|
label,
|
|
3893
|
-
value:
|
|
3954
|
+
value: selectedOptionId,
|
|
3894
3955
|
options: inlineOptions,
|
|
3895
3956
|
onChange: (ticker) => {
|
|
3896
3957
|
onChange(ticker);
|
|
@@ -3977,6 +4038,18 @@ function AssetSelector({
|
|
|
3977
4038
|
)
|
|
3978
4039
|
] }),
|
|
3979
4040
|
hasCategoryFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
4041
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4042
|
+
"button",
|
|
4043
|
+
{
|
|
4044
|
+
type: "button",
|
|
4045
|
+
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
4046
|
+
className: cn(
|
|
4047
|
+
"rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
|
|
4048
|
+
activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
|
|
4049
|
+
),
|
|
4050
|
+
children: "All"
|
|
4051
|
+
}
|
|
4052
|
+
),
|
|
3980
4053
|
categories.map((category) => {
|
|
3981
4054
|
const isActive = activeCategories.includes(category.id);
|
|
3982
4055
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -3994,16 +4067,7 @@ function AssetSelector({
|
|
|
3994
4067
|
},
|
|
3995
4068
|
category.id
|
|
3996
4069
|
);
|
|
3997
|
-
})
|
|
3998
|
-
activeCategories.length !== categories.length && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3999
|
-
"button",
|
|
4000
|
-
{
|
|
4001
|
-
type: "button",
|
|
4002
|
-
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
4003
|
-
className: "ml-auto rounded-full px-2 py-1 text-tiny font-bold uppercase tracking-wide text-white/40 transition-colors hover:text-white/75",
|
|
4004
|
-
children: "All"
|
|
4005
|
-
}
|
|
4006
|
-
)
|
|
4070
|
+
})
|
|
4007
4071
|
] })
|
|
4008
4072
|
] })
|
|
4009
4073
|
] }),
|
|
@@ -4020,6 +4084,8 @@ var PERCENTAGES = [25, 50, 75, 100];
|
|
|
4020
4084
|
function SwapInputCard({
|
|
4021
4085
|
fromTicker,
|
|
4022
4086
|
toTicker,
|
|
4087
|
+
fromSelectedId,
|
|
4088
|
+
toSelectedId,
|
|
4023
4089
|
fromInput,
|
|
4024
4090
|
fromOptions,
|
|
4025
4091
|
toOptions,
|
|
@@ -4031,9 +4097,11 @@ function SwapInputCard({
|
|
|
4031
4097
|
selectedPercentage = null,
|
|
4032
4098
|
percentageDisabled = false,
|
|
4033
4099
|
fromUnitLabel,
|
|
4100
|
+
fromDisplayUnit,
|
|
4034
4101
|
fromUnitIsToggle = false,
|
|
4035
4102
|
receiveAmount,
|
|
4036
4103
|
receiveUnitLabel,
|
|
4104
|
+
receiveDisplayUnit,
|
|
4037
4105
|
isLoadingQuote = false,
|
|
4038
4106
|
quoteError,
|
|
4039
4107
|
quoteRateText,
|
|
@@ -4055,6 +4123,15 @@ function SwapInputCard({
|
|
|
4055
4123
|
onFlip,
|
|
4056
4124
|
onSubmit
|
|
4057
4125
|
}) {
|
|
4126
|
+
const availableDisplayText = formatDisplayAmountText(availableText, {
|
|
4127
|
+
unit: fromDisplayUnit
|
|
4128
|
+
});
|
|
4129
|
+
const maxDisplayText = maxText ? formatDisplayAmountText(maxText, {
|
|
4130
|
+
unit: fromDisplayUnit
|
|
4131
|
+
}) : void 0;
|
|
4132
|
+
const receiveDisplayText = receiveAmount ? formatDisplayAmountText(receiveAmount, {
|
|
4133
|
+
unit: receiveDisplayUnit
|
|
4134
|
+
}) : null;
|
|
4058
4135
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
4059
4136
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "relative mb-3 flex flex-col rounded-3xl bg-white/[0.03] shadow-2xl shadow-black/40 backdrop-blur-2xl transition-all duration-300", children: [
|
|
4060
4137
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3.5 pb-4", children: [
|
|
@@ -4085,23 +4162,25 @@ function SwapInputCard({
|
|
|
4085
4162
|
compact: true,
|
|
4086
4163
|
label: "From",
|
|
4087
4164
|
selectedTicker: fromTicker,
|
|
4165
|
+
selectedId: fromSelectedId,
|
|
4088
4166
|
options: fromOptions,
|
|
4089
4167
|
categories,
|
|
4090
4168
|
defaultActiveCategories,
|
|
4091
|
-
|
|
4169
|
+
disabledId: toSelectedId,
|
|
4092
4170
|
onChange: onFromTickerChange
|
|
4093
4171
|
}
|
|
4094
4172
|
),
|
|
4095
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1 text-right", children: [
|
|
4173
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1 overflow-hidden text-right", children: [
|
|
4096
4174
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4097
4175
|
"input",
|
|
4098
4176
|
{
|
|
4099
4177
|
type: "text",
|
|
4100
4178
|
inputMode: "decimal",
|
|
4101
4179
|
value: fromInput,
|
|
4180
|
+
maxLength: 24,
|
|
4102
4181
|
onChange: (event) => onFromInputChange(event.target.value),
|
|
4103
4182
|
placeholder: "0",
|
|
4104
|
-
className: "w-full border-none bg-transparent text-right text-2xl font-bold text-white placeholder:text-white/15 focus:outline-none"
|
|
4183
|
+
className: "w-full min-w-0 border-none bg-transparent text-right text-2xl font-bold tabular-nums text-white placeholder:text-white/15 focus:outline-none"
|
|
4105
4184
|
}
|
|
4106
4185
|
),
|
|
4107
4186
|
fromUnitIsToggle && onToggleFromUnit ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
@@ -4116,7 +4195,14 @@ function SwapInputCard({
|
|
|
4116
4195
|
) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: fromUnitLabel })
|
|
4117
4196
|
] })
|
|
4118
4197
|
] }),
|
|
4119
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mt-2 flex items-center justify-between gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4198
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mt-2 flex items-center justify-between gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4199
|
+
"p",
|
|
4200
|
+
{
|
|
4201
|
+
className: "min-w-0 max-w-full truncate text-xxs font-medium tabular-nums text-white/60",
|
|
4202
|
+
title: showMaxText && maxText ? `Max: ${maxText}` : `Available: ${availableText}`,
|
|
4203
|
+
children: showMaxText && maxDisplayText ? `Max: ${maxDisplayText}` : `Available: ${availableDisplayText}`
|
|
4204
|
+
}
|
|
4205
|
+
) })
|
|
4120
4206
|
] }),
|
|
4121
4207
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "relative mx-6 flex h-px items-center justify-center bg-white/[0.08]", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "absolute flex h-11 w-11 items-center justify-center rounded-full bg-card shadow-lg shadow-black/35", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4122
4208
|
"button",
|
|
@@ -4137,15 +4223,23 @@ function SwapInputCard({
|
|
|
4137
4223
|
compact: true,
|
|
4138
4224
|
label: "To",
|
|
4139
4225
|
selectedTicker: toTicker,
|
|
4226
|
+
selectedId: toSelectedId,
|
|
4140
4227
|
options: toOptions,
|
|
4141
4228
|
categories,
|
|
4142
4229
|
defaultActiveCategories,
|
|
4143
|
-
|
|
4230
|
+
disabledId: fromSelectedId,
|
|
4144
4231
|
onChange: onToTickerChange
|
|
4145
4232
|
}
|
|
4146
4233
|
),
|
|
4147
4234
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1 text-right", children: [
|
|
4148
|
-
isLoadingQuote ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ml-auto h-8 w-28 animate-pulse rounded-lg bg-white/10" }) : receiveAmount ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4235
|
+
isLoadingQuote ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ml-auto h-8 w-28 animate-pulse rounded-lg bg-white/10" }) : receiveAmount ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4236
|
+
"span",
|
|
4237
|
+
{
|
|
4238
|
+
className: "block max-w-full truncate text-2xl font-bold tabular-nums text-primary",
|
|
4239
|
+
title: receiveAmount,
|
|
4240
|
+
children: receiveDisplayText
|
|
4241
|
+
}
|
|
4242
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-2xl font-bold text-white/15", children: "-" }),
|
|
4149
4243
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: receiveUnitLabel || toTicker || "-" })
|
|
4150
4244
|
] })
|
|
4151
4245
|
] })
|
|
@@ -8185,6 +8279,7 @@ function DepositInvoiceGeneration({
|
|
|
8185
8279
|
WithdrawSuccess,
|
|
8186
8280
|
buttonVariants,
|
|
8187
8281
|
cn,
|
|
8282
|
+
formatDisplayAmountText,
|
|
8188
8283
|
getAccountNetworkLabel,
|
|
8189
8284
|
getAccountNetworkUi,
|
|
8190
8285
|
getAccountStatusUi,
|
package/dist/web/index.d.cts
CHANGED
|
@@ -12,6 +12,13 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
|
12
12
|
|
|
13
13
|
declare function cn(...inputs: ClassValue[]): string;
|
|
14
14
|
|
|
15
|
+
type AmountDisplayUnit = 'token' | 'sats' | 'BTC' | 'mBTC';
|
|
16
|
+
interface AmountDisplayOptions {
|
|
17
|
+
unit?: AmountDisplayUnit;
|
|
18
|
+
maxDecimals?: number;
|
|
19
|
+
}
|
|
20
|
+
declare function formatDisplayAmountText(value: string | number | null | undefined, options?: AmountDisplayOptions): string;
|
|
21
|
+
|
|
15
22
|
declare const buttonVariants: (props?: ({
|
|
16
23
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "glow" | "surface" | "cta" | "cta-gradient" | "danger-subtle" | "hyperlink" | "h1" | "h2" | "h3" | null | undefined;
|
|
17
24
|
size?: "default" | "cta" | "xs" | "sm" | "lg" | "xl" | "cta-lg" | "icon" | "icon-lg" | "icon-xl" | null | undefined;
|
|
@@ -642,11 +649,14 @@ interface BalanceBreakdownProps {
|
|
|
642
649
|
declare function BalanceBreakdown({ btcOnchain, btcLightning, btcSpark, btcArkade, totalBTC, rgbAssets, accounts, nodeInfo, balanceVisible, format, formatFiatValue, unit, label, cycle, isLoading, isPartial, btcOnchainPending, btcLightningPending, btcSparkPending, btcArkadePending, onRefresh, isRefreshing, onNavigate, compact, }: BalanceBreakdownProps): react_jsx_runtime.JSX.Element;
|
|
643
650
|
|
|
644
651
|
interface AssetSelectorOption {
|
|
645
|
-
id
|
|
652
|
+
id: string;
|
|
646
653
|
ticker: string;
|
|
647
654
|
name?: string;
|
|
648
655
|
icon?: string;
|
|
649
656
|
network?: NetworkType;
|
|
657
|
+
protocol?: string;
|
|
658
|
+
venue?: string;
|
|
659
|
+
assetId?: string;
|
|
650
660
|
category?: string | null;
|
|
651
661
|
categoryLabel?: string;
|
|
652
662
|
}
|
|
@@ -661,17 +671,22 @@ interface AssetSelectorProps {
|
|
|
661
671
|
options: AssetSelectorOption[];
|
|
662
672
|
categories?: AssetSelectorCategory[];
|
|
663
673
|
defaultActiveCategories?: string[];
|
|
674
|
+
networkFilter?: NetworkType | null;
|
|
675
|
+
venueFilter?: string | null;
|
|
664
676
|
disabled?: boolean;
|
|
665
677
|
disabledTicker?: string;
|
|
678
|
+
disabledId?: string;
|
|
666
679
|
compact?: boolean;
|
|
667
680
|
onOpenPanelHeightChange?: (height: number) => void;
|
|
668
681
|
onChange: (id: string) => void;
|
|
669
682
|
}
|
|
670
|
-
declare function AssetSelector({ label, selectedTicker, selectedId, options, categories, defaultActiveCategories, disabled, disabledTicker, compact, onOpenPanelHeightChange, onChange, }: AssetSelectorProps): react_jsx_runtime.JSX.Element;
|
|
683
|
+
declare function AssetSelector({ label, selectedTicker, selectedId, options, categories, defaultActiveCategories, networkFilter, venueFilter, disabled, disabledTicker, disabledId, compact, onOpenPanelHeightChange, onChange, }: AssetSelectorProps): react_jsx_runtime.JSX.Element;
|
|
671
684
|
|
|
672
685
|
interface SwapInputCardProps {
|
|
673
686
|
fromTicker: string;
|
|
674
687
|
toTicker: string;
|
|
688
|
+
fromSelectedId?: string;
|
|
689
|
+
toSelectedId?: string;
|
|
675
690
|
fromInput: string;
|
|
676
691
|
fromOptions: AssetSelectorOption[];
|
|
677
692
|
toOptions: AssetSelectorOption[];
|
|
@@ -683,9 +698,11 @@ interface SwapInputCardProps {
|
|
|
683
698
|
selectedPercentage?: number | null;
|
|
684
699
|
percentageDisabled?: boolean;
|
|
685
700
|
fromUnitLabel: string;
|
|
701
|
+
fromDisplayUnit?: AmountDisplayUnit;
|
|
686
702
|
fromUnitIsToggle?: boolean;
|
|
687
703
|
receiveAmount?: string | null;
|
|
688
704
|
receiveUnitLabel?: string;
|
|
705
|
+
receiveDisplayUnit?: AmountDisplayUnit;
|
|
689
706
|
isLoadingQuote?: boolean;
|
|
690
707
|
quoteError?: string | null;
|
|
691
708
|
quoteRateText?: string | null;
|
|
@@ -709,7 +726,7 @@ interface SwapInputCardProps {
|
|
|
709
726
|
onFlip: () => void;
|
|
710
727
|
onSubmit: () => void;
|
|
711
728
|
}
|
|
712
|
-
declare function SwapInputCard({ fromTicker, toTicker, fromInput, fromOptions, toOptions, categories, defaultActiveCategories, availableText, showMaxText, maxText, selectedPercentage, percentageDisabled, fromUnitLabel, fromUnitIsToggle, receiveAmount, receiveUnitLabel, isLoadingQuote, quoteError, quoteRateText, quoteVenueText, quoteVenueTone, quoteFeeText, quoteExpiresText, quoteExpiresUrgent, warning, submitLabel, submitIcon, submitVariant, submitDisabled, onFromTickerChange, onToTickerChange, onFromInputChange, onPercentageClick, onToggleFromUnit, onFlip, onSubmit, }: SwapInputCardProps): react_jsx_runtime.JSX.Element;
|
|
729
|
+
declare function SwapInputCard({ fromTicker, toTicker, fromSelectedId, toSelectedId, fromInput, fromOptions, toOptions, categories, defaultActiveCategories, availableText, showMaxText, maxText, selectedPercentage, percentageDisabled, fromUnitLabel, fromDisplayUnit, fromUnitIsToggle, receiveAmount, receiveUnitLabel, receiveDisplayUnit, isLoadingQuote, quoteError, quoteRateText, quoteVenueText, quoteVenueTone, quoteFeeText, quoteExpiresText, quoteExpiresUrgent, warning, submitLabel, submitIcon, submitVariant, submitDisabled, onFromTickerChange, onToTickerChange, onFromInputChange, onPercentageClick, onToggleFromUnit, onFlip, onSubmit, }: SwapInputCardProps): react_jsx_runtime.JSX.Element;
|
|
713
730
|
|
|
714
731
|
interface ActivityListItem<TData = unknown> {
|
|
715
732
|
id: string;
|
|
@@ -1466,4 +1483,4 @@ declare function getFallbackAssetIconUrl(seed: string): string;
|
|
|
1466
1483
|
*/
|
|
1467
1484
|
declare function useAssetIcon(ticker: string, cdnBaseUrl?: string): string;
|
|
1468
1485
|
|
|
1469
|
-
export { AccountCapabilitiesCard, type AccountCapabilitiesCardProps, AccountChoiceChip, AccountHeaderIcons, AccountInfoGrid, AccountNetworkNotice, AccountNetworkPicker, AccountNetworkSelector, AccountNotice, type AccountSettingsNetwork, type AccountSettingsProtocol, AccountSettingsRow, AccountSettingsShell, AccountStatusPills, type AccountStatusTabItem, AccountStatusTabs, type AccountStatusTabsProps, ActionTile, type ActionTileProps, ActivityDetailRow, type ActivityDetailRowProps, ActivityFilterBar, type ActivityFilterBarProps, ActivityList, type ActivityListItem, type ActivityListProps, type ActivityNetworkFilterOption, type ActivityNetworkFilterValue, ActivityNetworkFilters, type ActivityNetworkFiltersProps, type ActivityStatusOption, type ActivityTypeTabCounts, type ActivityTypeTabValue, ActivityTypeTabs, AlertBanner, AppIcon, type AppIconName, type AppIconProps, ArkadeNetworkIcon, AssetCard, type AssetCardProps, AssetIcon, AssetSelector, type AssetSelectorCategory, type AssetSelectorOption, type AssetSelectorProps, BalanceBreakdown, type BalanceBreakdownAccounts, type BalanceBreakdownAsset, type BalanceBreakdownNodeInfo, type BalanceBreakdownProps, BottomNav, type BottomNavItem, type BottomNavProps, BtcUnifiedReceive, type BtcUnifiedReceiveAddress, type BtcUnifiedReceiveProps, type BtcUnifiedReceiveResult, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CopyIcon, type DepositAccountId, DepositAssetSelection, type DepositAssetSelectionProps, type DepositGeneratedAsset, DepositGeneratedView, type DepositGeneratedViewProps, type DepositGenerationController, type DepositInvoiceAsset, DepositInvoiceGeneration, type DepositInvoiceGenerationProps, type DepositNetworkConfigEntry, DepositNetworkDefaultModal, type DepositNetworkDefaultModalProps, type DepositNetworkKey, type DepositNetworkOption, DepositPreGeneration, type DepositPreGenerationAsset, type DepositPreGenerationProps, type DepositSelectionAsset, DepositSuccessScreen, type DepositSuccessScreenProps, type DepositTransferMethod, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotPagination, type DotPaginationProps, type DotTone, ErrorBoundary, ErrorCard, type ErrorCardProps, ExpandIcon, FadeOverlay, type FadeOverlayProps, FilterDropdown, type FilterDropdownOption, type FilterDropdownProps, HeadlineGradient, type HeadlineGradientProps, Icon, type IconName, type IconProps, Icons, InlineAction, InlineSelector, type InlineSelectorOption, type InlineSelectorProps, Input, type InputProps, InvoiceStatusBanner, KaleidoScopeHeroAnimation, type KaleidoScopeHeroAnimationProps, Label, LightningNetworkIcon, LoadingCard, type LoadingCardProps, MethodChoiceChip, MobileHeroAnimation, type MobileHeroAnimationProps, NETWORK_CONFIG, NetworkBadge, type NetworkBadgeProps, type NetworkIconProps, NetworkInfoDisclosure, NetworkStatusChip, type NetworkStatusChipProps, type NetworkType, NumberInput, type NumberInputProps, OptionSelector, type OptionSelectorOption, type OptionSelectorProps, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, PaidOverlay, QrCode, type QrCodeProps, RecoveryPhraseCard, type RecoveryPhraseCardProps, ScrollArea, type ScrollAreaProps, SectionLabel, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SettingItem, SettingsActionButton, SettingsStatusPanel, SettingsTile, type SettingsTileProps, SparkNetworkIcon, StatusBadge, type StatusType, SwapInputCard, type SwapInputCardProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, TransactionCard, type TransactionCardProps, TransferRouteCard, WalletAssetList, type WalletAssetListEmptyState, type WalletAssetListItem, type WalletAssetListProps, type WithdrawAddressType, WithdrawAmountInput, type WithdrawAmountInputProps, WithdrawConfirmation, type WithdrawConfirmationProps, type WithdrawConfirmationRgbInvoice, type WithdrawDecodedLnInvoice, type WithdrawDecodedRgbInvoice, WithdrawDestinationInput, type WithdrawDestinationInputProps, type WithdrawInvoiceAsset, WithdrawInvoiceInfo, type WithdrawInvoiceInfoLnInvoice, type WithdrawInvoiceInfoProps, type WithdrawInvoiceInfoRgbInvoice, type WithdrawLnurlPayData, type WithdrawRouteOption, WithdrawRouteSelector, type WithdrawRouteSelectorProps, type WithdrawRouteSummary, WithdrawSuccess, type WithdrawSuccessProps, buttonVariants, cn, getAccountNetworkLabel, getAccountNetworkUi, getAccountStatusUi, getActivityNetworkFilterIcon, getAssetIconUrl, getFallbackAssetIconUrl, toast, useAssetIcon, useToast };
|
|
1486
|
+
export { AccountCapabilitiesCard, type AccountCapabilitiesCardProps, AccountChoiceChip, AccountHeaderIcons, AccountInfoGrid, AccountNetworkNotice, AccountNetworkPicker, AccountNetworkSelector, AccountNotice, type AccountSettingsNetwork, type AccountSettingsProtocol, AccountSettingsRow, AccountSettingsShell, AccountStatusPills, type AccountStatusTabItem, AccountStatusTabs, type AccountStatusTabsProps, ActionTile, type ActionTileProps, ActivityDetailRow, type ActivityDetailRowProps, ActivityFilterBar, type ActivityFilterBarProps, ActivityList, type ActivityListItem, type ActivityListProps, type ActivityNetworkFilterOption, type ActivityNetworkFilterValue, ActivityNetworkFilters, type ActivityNetworkFiltersProps, type ActivityStatusOption, type ActivityTypeTabCounts, type ActivityTypeTabValue, ActivityTypeTabs, AlertBanner, type AmountDisplayOptions, type AmountDisplayUnit, AppIcon, type AppIconName, type AppIconProps, ArkadeNetworkIcon, AssetCard, type AssetCardProps, AssetIcon, AssetSelector, type AssetSelectorCategory, type AssetSelectorOption, type AssetSelectorProps, BalanceBreakdown, type BalanceBreakdownAccounts, type BalanceBreakdownAsset, type BalanceBreakdownNodeInfo, type BalanceBreakdownProps, BottomNav, type BottomNavItem, type BottomNavProps, BtcUnifiedReceive, type BtcUnifiedReceiveAddress, type BtcUnifiedReceiveProps, type BtcUnifiedReceiveResult, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CopyIcon, type DepositAccountId, DepositAssetSelection, type DepositAssetSelectionProps, type DepositGeneratedAsset, DepositGeneratedView, type DepositGeneratedViewProps, type DepositGenerationController, type DepositInvoiceAsset, DepositInvoiceGeneration, type DepositInvoiceGenerationProps, type DepositNetworkConfigEntry, DepositNetworkDefaultModal, type DepositNetworkDefaultModalProps, type DepositNetworkKey, type DepositNetworkOption, DepositPreGeneration, type DepositPreGenerationAsset, type DepositPreGenerationProps, type DepositSelectionAsset, DepositSuccessScreen, type DepositSuccessScreenProps, type DepositTransferMethod, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotPagination, type DotPaginationProps, type DotTone, ErrorBoundary, ErrorCard, type ErrorCardProps, ExpandIcon, FadeOverlay, type FadeOverlayProps, FilterDropdown, type FilterDropdownOption, type FilterDropdownProps, HeadlineGradient, type HeadlineGradientProps, Icon, type IconName, type IconProps, Icons, InlineAction, InlineSelector, type InlineSelectorOption, type InlineSelectorProps, Input, type InputProps, InvoiceStatusBanner, KaleidoScopeHeroAnimation, type KaleidoScopeHeroAnimationProps, Label, LightningNetworkIcon, LoadingCard, type LoadingCardProps, MethodChoiceChip, MobileHeroAnimation, type MobileHeroAnimationProps, NETWORK_CONFIG, NetworkBadge, type NetworkBadgeProps, type NetworkIconProps, NetworkInfoDisclosure, NetworkStatusChip, type NetworkStatusChipProps, type NetworkType, NumberInput, type NumberInputProps, OptionSelector, type OptionSelectorOption, type OptionSelectorProps, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, PaidOverlay, QrCode, type QrCodeProps, RecoveryPhraseCard, type RecoveryPhraseCardProps, ScrollArea, type ScrollAreaProps, SectionLabel, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SettingItem, SettingsActionButton, SettingsStatusPanel, SettingsTile, type SettingsTileProps, SparkNetworkIcon, StatusBadge, type StatusType, SwapInputCard, type SwapInputCardProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, TransactionCard, type TransactionCardProps, TransferRouteCard, WalletAssetList, type WalletAssetListEmptyState, type WalletAssetListItem, type WalletAssetListProps, type WithdrawAddressType, WithdrawAmountInput, type WithdrawAmountInputProps, WithdrawConfirmation, type WithdrawConfirmationProps, type WithdrawConfirmationRgbInvoice, type WithdrawDecodedLnInvoice, type WithdrawDecodedRgbInvoice, WithdrawDestinationInput, type WithdrawDestinationInputProps, type WithdrawInvoiceAsset, WithdrawInvoiceInfo, type WithdrawInvoiceInfoLnInvoice, type WithdrawInvoiceInfoProps, type WithdrawInvoiceInfoRgbInvoice, type WithdrawLnurlPayData, type WithdrawRouteOption, WithdrawRouteSelector, type WithdrawRouteSelectorProps, type WithdrawRouteSummary, WithdrawSuccess, type WithdrawSuccessProps, buttonVariants, cn, formatDisplayAmountText, getAccountNetworkLabel, getAccountNetworkUi, getAccountStatusUi, getActivityNetworkFilterIcon, getAssetIconUrl, getFallbackAssetIconUrl, toast, useAssetIcon, useToast };
|
package/dist/web/index.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
|
12
12
|
|
|
13
13
|
declare function cn(...inputs: ClassValue[]): string;
|
|
14
14
|
|
|
15
|
+
type AmountDisplayUnit = 'token' | 'sats' | 'BTC' | 'mBTC';
|
|
16
|
+
interface AmountDisplayOptions {
|
|
17
|
+
unit?: AmountDisplayUnit;
|
|
18
|
+
maxDecimals?: number;
|
|
19
|
+
}
|
|
20
|
+
declare function formatDisplayAmountText(value: string | number | null | undefined, options?: AmountDisplayOptions): string;
|
|
21
|
+
|
|
15
22
|
declare const buttonVariants: (props?: ({
|
|
16
23
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "glow" | "surface" | "cta" | "cta-gradient" | "danger-subtle" | "hyperlink" | "h1" | "h2" | "h3" | null | undefined;
|
|
17
24
|
size?: "default" | "cta" | "xs" | "sm" | "lg" | "xl" | "cta-lg" | "icon" | "icon-lg" | "icon-xl" | null | undefined;
|
|
@@ -642,11 +649,14 @@ interface BalanceBreakdownProps {
|
|
|
642
649
|
declare function BalanceBreakdown({ btcOnchain, btcLightning, btcSpark, btcArkade, totalBTC, rgbAssets, accounts, nodeInfo, balanceVisible, format, formatFiatValue, unit, label, cycle, isLoading, isPartial, btcOnchainPending, btcLightningPending, btcSparkPending, btcArkadePending, onRefresh, isRefreshing, onNavigate, compact, }: BalanceBreakdownProps): react_jsx_runtime.JSX.Element;
|
|
643
650
|
|
|
644
651
|
interface AssetSelectorOption {
|
|
645
|
-
id
|
|
652
|
+
id: string;
|
|
646
653
|
ticker: string;
|
|
647
654
|
name?: string;
|
|
648
655
|
icon?: string;
|
|
649
656
|
network?: NetworkType;
|
|
657
|
+
protocol?: string;
|
|
658
|
+
venue?: string;
|
|
659
|
+
assetId?: string;
|
|
650
660
|
category?: string | null;
|
|
651
661
|
categoryLabel?: string;
|
|
652
662
|
}
|
|
@@ -661,17 +671,22 @@ interface AssetSelectorProps {
|
|
|
661
671
|
options: AssetSelectorOption[];
|
|
662
672
|
categories?: AssetSelectorCategory[];
|
|
663
673
|
defaultActiveCategories?: string[];
|
|
674
|
+
networkFilter?: NetworkType | null;
|
|
675
|
+
venueFilter?: string | null;
|
|
664
676
|
disabled?: boolean;
|
|
665
677
|
disabledTicker?: string;
|
|
678
|
+
disabledId?: string;
|
|
666
679
|
compact?: boolean;
|
|
667
680
|
onOpenPanelHeightChange?: (height: number) => void;
|
|
668
681
|
onChange: (id: string) => void;
|
|
669
682
|
}
|
|
670
|
-
declare function AssetSelector({ label, selectedTicker, selectedId, options, categories, defaultActiveCategories, disabled, disabledTicker, compact, onOpenPanelHeightChange, onChange, }: AssetSelectorProps): react_jsx_runtime.JSX.Element;
|
|
683
|
+
declare function AssetSelector({ label, selectedTicker, selectedId, options, categories, defaultActiveCategories, networkFilter, venueFilter, disabled, disabledTicker, disabledId, compact, onOpenPanelHeightChange, onChange, }: AssetSelectorProps): react_jsx_runtime.JSX.Element;
|
|
671
684
|
|
|
672
685
|
interface SwapInputCardProps {
|
|
673
686
|
fromTicker: string;
|
|
674
687
|
toTicker: string;
|
|
688
|
+
fromSelectedId?: string;
|
|
689
|
+
toSelectedId?: string;
|
|
675
690
|
fromInput: string;
|
|
676
691
|
fromOptions: AssetSelectorOption[];
|
|
677
692
|
toOptions: AssetSelectorOption[];
|
|
@@ -683,9 +698,11 @@ interface SwapInputCardProps {
|
|
|
683
698
|
selectedPercentage?: number | null;
|
|
684
699
|
percentageDisabled?: boolean;
|
|
685
700
|
fromUnitLabel: string;
|
|
701
|
+
fromDisplayUnit?: AmountDisplayUnit;
|
|
686
702
|
fromUnitIsToggle?: boolean;
|
|
687
703
|
receiveAmount?: string | null;
|
|
688
704
|
receiveUnitLabel?: string;
|
|
705
|
+
receiveDisplayUnit?: AmountDisplayUnit;
|
|
689
706
|
isLoadingQuote?: boolean;
|
|
690
707
|
quoteError?: string | null;
|
|
691
708
|
quoteRateText?: string | null;
|
|
@@ -709,7 +726,7 @@ interface SwapInputCardProps {
|
|
|
709
726
|
onFlip: () => void;
|
|
710
727
|
onSubmit: () => void;
|
|
711
728
|
}
|
|
712
|
-
declare function SwapInputCard({ fromTicker, toTicker, fromInput, fromOptions, toOptions, categories, defaultActiveCategories, availableText, showMaxText, maxText, selectedPercentage, percentageDisabled, fromUnitLabel, fromUnitIsToggle, receiveAmount, receiveUnitLabel, isLoadingQuote, quoteError, quoteRateText, quoteVenueText, quoteVenueTone, quoteFeeText, quoteExpiresText, quoteExpiresUrgent, warning, submitLabel, submitIcon, submitVariant, submitDisabled, onFromTickerChange, onToTickerChange, onFromInputChange, onPercentageClick, onToggleFromUnit, onFlip, onSubmit, }: SwapInputCardProps): react_jsx_runtime.JSX.Element;
|
|
729
|
+
declare function SwapInputCard({ fromTicker, toTicker, fromSelectedId, toSelectedId, fromInput, fromOptions, toOptions, categories, defaultActiveCategories, availableText, showMaxText, maxText, selectedPercentage, percentageDisabled, fromUnitLabel, fromDisplayUnit, fromUnitIsToggle, receiveAmount, receiveUnitLabel, receiveDisplayUnit, isLoadingQuote, quoteError, quoteRateText, quoteVenueText, quoteVenueTone, quoteFeeText, quoteExpiresText, quoteExpiresUrgent, warning, submitLabel, submitIcon, submitVariant, submitDisabled, onFromTickerChange, onToTickerChange, onFromInputChange, onPercentageClick, onToggleFromUnit, onFlip, onSubmit, }: SwapInputCardProps): react_jsx_runtime.JSX.Element;
|
|
713
730
|
|
|
714
731
|
interface ActivityListItem<TData = unknown> {
|
|
715
732
|
id: string;
|
|
@@ -1466,4 +1483,4 @@ declare function getFallbackAssetIconUrl(seed: string): string;
|
|
|
1466
1483
|
*/
|
|
1467
1484
|
declare function useAssetIcon(ticker: string, cdnBaseUrl?: string): string;
|
|
1468
1485
|
|
|
1469
|
-
export { AccountCapabilitiesCard, type AccountCapabilitiesCardProps, AccountChoiceChip, AccountHeaderIcons, AccountInfoGrid, AccountNetworkNotice, AccountNetworkPicker, AccountNetworkSelector, AccountNotice, type AccountSettingsNetwork, type AccountSettingsProtocol, AccountSettingsRow, AccountSettingsShell, AccountStatusPills, type AccountStatusTabItem, AccountStatusTabs, type AccountStatusTabsProps, ActionTile, type ActionTileProps, ActivityDetailRow, type ActivityDetailRowProps, ActivityFilterBar, type ActivityFilterBarProps, ActivityList, type ActivityListItem, type ActivityListProps, type ActivityNetworkFilterOption, type ActivityNetworkFilterValue, ActivityNetworkFilters, type ActivityNetworkFiltersProps, type ActivityStatusOption, type ActivityTypeTabCounts, type ActivityTypeTabValue, ActivityTypeTabs, AlertBanner, AppIcon, type AppIconName, type AppIconProps, ArkadeNetworkIcon, AssetCard, type AssetCardProps, AssetIcon, AssetSelector, type AssetSelectorCategory, type AssetSelectorOption, type AssetSelectorProps, BalanceBreakdown, type BalanceBreakdownAccounts, type BalanceBreakdownAsset, type BalanceBreakdownNodeInfo, type BalanceBreakdownProps, BottomNav, type BottomNavItem, type BottomNavProps, BtcUnifiedReceive, type BtcUnifiedReceiveAddress, type BtcUnifiedReceiveProps, type BtcUnifiedReceiveResult, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CopyIcon, type DepositAccountId, DepositAssetSelection, type DepositAssetSelectionProps, type DepositGeneratedAsset, DepositGeneratedView, type DepositGeneratedViewProps, type DepositGenerationController, type DepositInvoiceAsset, DepositInvoiceGeneration, type DepositInvoiceGenerationProps, type DepositNetworkConfigEntry, DepositNetworkDefaultModal, type DepositNetworkDefaultModalProps, type DepositNetworkKey, type DepositNetworkOption, DepositPreGeneration, type DepositPreGenerationAsset, type DepositPreGenerationProps, type DepositSelectionAsset, DepositSuccessScreen, type DepositSuccessScreenProps, type DepositTransferMethod, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotPagination, type DotPaginationProps, type DotTone, ErrorBoundary, ErrorCard, type ErrorCardProps, ExpandIcon, FadeOverlay, type FadeOverlayProps, FilterDropdown, type FilterDropdownOption, type FilterDropdownProps, HeadlineGradient, type HeadlineGradientProps, Icon, type IconName, type IconProps, Icons, InlineAction, InlineSelector, type InlineSelectorOption, type InlineSelectorProps, Input, type InputProps, InvoiceStatusBanner, KaleidoScopeHeroAnimation, type KaleidoScopeHeroAnimationProps, Label, LightningNetworkIcon, LoadingCard, type LoadingCardProps, MethodChoiceChip, MobileHeroAnimation, type MobileHeroAnimationProps, NETWORK_CONFIG, NetworkBadge, type NetworkBadgeProps, type NetworkIconProps, NetworkInfoDisclosure, NetworkStatusChip, type NetworkStatusChipProps, type NetworkType, NumberInput, type NumberInputProps, OptionSelector, type OptionSelectorOption, type OptionSelectorProps, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, PaidOverlay, QrCode, type QrCodeProps, RecoveryPhraseCard, type RecoveryPhraseCardProps, ScrollArea, type ScrollAreaProps, SectionLabel, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SettingItem, SettingsActionButton, SettingsStatusPanel, SettingsTile, type SettingsTileProps, SparkNetworkIcon, StatusBadge, type StatusType, SwapInputCard, type SwapInputCardProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, TransactionCard, type TransactionCardProps, TransferRouteCard, WalletAssetList, type WalletAssetListEmptyState, type WalletAssetListItem, type WalletAssetListProps, type WithdrawAddressType, WithdrawAmountInput, type WithdrawAmountInputProps, WithdrawConfirmation, type WithdrawConfirmationProps, type WithdrawConfirmationRgbInvoice, type WithdrawDecodedLnInvoice, type WithdrawDecodedRgbInvoice, WithdrawDestinationInput, type WithdrawDestinationInputProps, type WithdrawInvoiceAsset, WithdrawInvoiceInfo, type WithdrawInvoiceInfoLnInvoice, type WithdrawInvoiceInfoProps, type WithdrawInvoiceInfoRgbInvoice, type WithdrawLnurlPayData, type WithdrawRouteOption, WithdrawRouteSelector, type WithdrawRouteSelectorProps, type WithdrawRouteSummary, WithdrawSuccess, type WithdrawSuccessProps, buttonVariants, cn, getAccountNetworkLabel, getAccountNetworkUi, getAccountStatusUi, getActivityNetworkFilterIcon, getAssetIconUrl, getFallbackAssetIconUrl, toast, useAssetIcon, useToast };
|
|
1486
|
+
export { AccountCapabilitiesCard, type AccountCapabilitiesCardProps, AccountChoiceChip, AccountHeaderIcons, AccountInfoGrid, AccountNetworkNotice, AccountNetworkPicker, AccountNetworkSelector, AccountNotice, type AccountSettingsNetwork, type AccountSettingsProtocol, AccountSettingsRow, AccountSettingsShell, AccountStatusPills, type AccountStatusTabItem, AccountStatusTabs, type AccountStatusTabsProps, ActionTile, type ActionTileProps, ActivityDetailRow, type ActivityDetailRowProps, ActivityFilterBar, type ActivityFilterBarProps, ActivityList, type ActivityListItem, type ActivityListProps, type ActivityNetworkFilterOption, type ActivityNetworkFilterValue, ActivityNetworkFilters, type ActivityNetworkFiltersProps, type ActivityStatusOption, type ActivityTypeTabCounts, type ActivityTypeTabValue, ActivityTypeTabs, AlertBanner, type AmountDisplayOptions, type AmountDisplayUnit, AppIcon, type AppIconName, type AppIconProps, ArkadeNetworkIcon, AssetCard, type AssetCardProps, AssetIcon, AssetSelector, type AssetSelectorCategory, type AssetSelectorOption, type AssetSelectorProps, BalanceBreakdown, type BalanceBreakdownAccounts, type BalanceBreakdownAsset, type BalanceBreakdownNodeInfo, type BalanceBreakdownProps, BottomNav, type BottomNavItem, type BottomNavProps, BtcUnifiedReceive, type BtcUnifiedReceiveAddress, type BtcUnifiedReceiveProps, type BtcUnifiedReceiveResult, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CopyIcon, type DepositAccountId, DepositAssetSelection, type DepositAssetSelectionProps, type DepositGeneratedAsset, DepositGeneratedView, type DepositGeneratedViewProps, type DepositGenerationController, type DepositInvoiceAsset, DepositInvoiceGeneration, type DepositInvoiceGenerationProps, type DepositNetworkConfigEntry, DepositNetworkDefaultModal, type DepositNetworkDefaultModalProps, type DepositNetworkKey, type DepositNetworkOption, DepositPreGeneration, type DepositPreGenerationAsset, type DepositPreGenerationProps, type DepositSelectionAsset, DepositSuccessScreen, type DepositSuccessScreenProps, type DepositTransferMethod, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotPagination, type DotPaginationProps, type DotTone, ErrorBoundary, ErrorCard, type ErrorCardProps, ExpandIcon, FadeOverlay, type FadeOverlayProps, FilterDropdown, type FilterDropdownOption, type FilterDropdownProps, HeadlineGradient, type HeadlineGradientProps, Icon, type IconName, type IconProps, Icons, InlineAction, InlineSelector, type InlineSelectorOption, type InlineSelectorProps, Input, type InputProps, InvoiceStatusBanner, KaleidoScopeHeroAnimation, type KaleidoScopeHeroAnimationProps, Label, LightningNetworkIcon, LoadingCard, type LoadingCardProps, MethodChoiceChip, MobileHeroAnimation, type MobileHeroAnimationProps, NETWORK_CONFIG, NetworkBadge, type NetworkBadgeProps, type NetworkIconProps, NetworkInfoDisclosure, NetworkStatusChip, type NetworkStatusChipProps, type NetworkType, NumberInput, type NumberInputProps, OptionSelector, type OptionSelectorOption, type OptionSelectorProps, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, PaidOverlay, QrCode, type QrCodeProps, RecoveryPhraseCard, type RecoveryPhraseCardProps, ScrollArea, type ScrollAreaProps, SectionLabel, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SettingItem, SettingsActionButton, SettingsStatusPanel, SettingsTile, type SettingsTileProps, SparkNetworkIcon, StatusBadge, type StatusType, SwapInputCard, type SwapInputCardProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, TransactionCard, type TransactionCardProps, TransferRouteCard, WalletAssetList, type WalletAssetListEmptyState, type WalletAssetListItem, type WalletAssetListProps, type WithdrawAddressType, WithdrawAmountInput, type WithdrawAmountInputProps, WithdrawConfirmation, type WithdrawConfirmationProps, type WithdrawConfirmationRgbInvoice, type WithdrawDecodedLnInvoice, type WithdrawDecodedRgbInvoice, WithdrawDestinationInput, type WithdrawDestinationInputProps, type WithdrawInvoiceAsset, WithdrawInvoiceInfo, type WithdrawInvoiceInfoLnInvoice, type WithdrawInvoiceInfoProps, type WithdrawInvoiceInfoRgbInvoice, type WithdrawLnurlPayData, type WithdrawRouteOption, WithdrawRouteSelector, type WithdrawRouteSelectorProps, type WithdrawRouteSummary, WithdrawSuccess, type WithdrawSuccessProps, buttonVariants, cn, formatDisplayAmountText, getAccountNetworkLabel, getAccountNetworkUi, getAccountStatusUi, getActivityNetworkFilterIcon, getAssetIconUrl, getFallbackAssetIconUrl, toast, useAssetIcon, useToast };
|
package/dist/web/index.js
CHANGED
|
@@ -7,6 +7,29 @@ function cn(...inputs) {
|
|
|
7
7
|
return twMerge(clsx(inputs));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// src/web/utils/amount-display.ts
|
|
11
|
+
var NUMBER_RE = /^(-?\d[\d,]*)(?:\.(\d+))?$/;
|
|
12
|
+
function formatDisplayAmountText(value, options = {}) {
|
|
13
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
14
|
+
const unit = options.unit ?? "token";
|
|
15
|
+
const maxDecimals = unit === "sats" ? 0 : unit === "BTC" ? 8 : unit === "mBTC" ? 5 : options.maxDecimals ?? 6;
|
|
16
|
+
const raw = typeof value === "number" ? String(value) : value.trim();
|
|
17
|
+
const suffixMatch = raw.match(/(\s+[A-Za-z][\w.-]*)$/u);
|
|
18
|
+
const suffix = suffixMatch?.[1] ?? "";
|
|
19
|
+
const numeric = suffix ? raw.slice(0, -suffix.length) : raw;
|
|
20
|
+
const match = numeric.match(NUMBER_RE);
|
|
21
|
+
if (!match) return raw;
|
|
22
|
+
const num = parseFloat(numeric.replace(/,/g, ""));
|
|
23
|
+
if (!Number.isFinite(num)) return raw;
|
|
24
|
+
const factor = Math.pow(10, maxDecimals);
|
|
25
|
+
const rounded = Math.round(num * factor) / factor;
|
|
26
|
+
const formatted = rounded.toLocaleString("en-US", {
|
|
27
|
+
minimumFractionDigits: 0,
|
|
28
|
+
maximumFractionDigits: maxDecimals
|
|
29
|
+
});
|
|
30
|
+
return `${formatted}${suffix}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
// src/web/primitives/button.tsx
|
|
11
34
|
import * as React from "react";
|
|
12
35
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -1612,6 +1635,7 @@ function AssetCard({
|
|
|
1612
1635
|
className
|
|
1613
1636
|
}) {
|
|
1614
1637
|
const shown = balanceVisible ? displayBalance : "\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
1638
|
+
const displayShown = balanceVisible ? formatDisplayAmountText(displayBalance) : shown;
|
|
1615
1639
|
const [hovered, setHovered] = useState5(false);
|
|
1616
1640
|
const gradientStyle = accentColor ? { background: `linear-gradient(135deg, var(--card) 30%, ${accentColor}${hovered ? "77" : "55"} 75%, ${accentColor}${hovered ? "dd" : "b3"} 100%)`, transition: "background 0.3s ease" } : void 0;
|
|
1617
1641
|
return /* @__PURE__ */ jsxs8(
|
|
@@ -1629,8 +1653,8 @@ function AssetCard({
|
|
|
1629
1653
|
onMouseLeave: () => setHovered(false),
|
|
1630
1654
|
children: [
|
|
1631
1655
|
/* @__PURE__ */ jsx19("div", { className: "absolute inset-0 bg-gradient-to-br from-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" }),
|
|
1632
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between
|
|
1633
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
|
|
1656
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative z-10 flex min-w-0 items-center justify-between gap-3", children: [
|
|
1657
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
1634
1658
|
/* @__PURE__ */ jsx19(
|
|
1635
1659
|
AssetIcon,
|
|
1636
1660
|
{
|
|
@@ -1640,23 +1664,31 @@ function AssetCard({
|
|
|
1640
1664
|
className: "group-hover:scale-105 transition-transform"
|
|
1641
1665
|
}
|
|
1642
1666
|
),
|
|
1643
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col", children: [
|
|
1667
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-col", children: [
|
|
1644
1668
|
/* @__PURE__ */ jsx19(
|
|
1645
1669
|
"span",
|
|
1646
1670
|
{
|
|
1647
1671
|
className: cn(
|
|
1648
|
-
"font-bold text-base leading-tight tracking-wide text-foreground",
|
|
1672
|
+
"max-w-full truncate font-bold text-base leading-tight tracking-wide text-foreground",
|
|
1649
1673
|
onClick && "transition-colors"
|
|
1650
1674
|
),
|
|
1675
|
+
title: name,
|
|
1651
1676
|
children: name
|
|
1652
1677
|
}
|
|
1653
1678
|
),
|
|
1654
1679
|
/* @__PURE__ */ jsx19("div", { className: "flex flex-nowrap gap-1 mt-1", children: networks.map((network) => /* @__PURE__ */ jsx19(NetworkBadge, { network, size: "sm" }, network)) })
|
|
1655
1680
|
] })
|
|
1656
1681
|
] }),
|
|
1657
|
-
/* @__PURE__ */ jsxs8("div", { className: "text-right", children: [
|
|
1658
|
-
/* @__PURE__ */ jsx19(
|
|
1659
|
-
|
|
1682
|
+
/* @__PURE__ */ jsxs8("div", { className: "min-w-0 max-w-[45%] text-right", children: [
|
|
1683
|
+
/* @__PURE__ */ jsx19(
|
|
1684
|
+
"p",
|
|
1685
|
+
{
|
|
1686
|
+
className: "max-w-full truncate font-bold text-lg tabular-nums tracking-tight text-foreground transition-colors group-hover:opacity-90",
|
|
1687
|
+
title: shown,
|
|
1688
|
+
children: displayShown
|
|
1689
|
+
}
|
|
1690
|
+
),
|
|
1691
|
+
/* @__PURE__ */ jsx19("p", { className: "mt-0.5 truncate text-tiny font-medium uppercase tracking-wide text-muted-foreground", children: ticker })
|
|
1660
1692
|
] })
|
|
1661
1693
|
] })
|
|
1662
1694
|
]
|
|
@@ -2431,7 +2463,7 @@ function InlineSelector({
|
|
|
2431
2463
|
),
|
|
2432
2464
|
children: [
|
|
2433
2465
|
renderPanelHeader?.(renderArgs),
|
|
2434
|
-
/* @__PURE__ */ jsx29("div", { className: "space-y-1", children: options.length === 0 ? /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-white/30", children: [
|
|
2466
|
+
/* @__PURE__ */ jsx29("div", { className: "max-h-[60vh] space-y-1 overflow-y-auto", children: options.length === 0 ? /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-white/30", children: [
|
|
2435
2467
|
/* @__PURE__ */ jsx29(Icon, { name: "search", size: "md", className: "opacity-40" }),
|
|
2436
2468
|
/* @__PURE__ */ jsx29("span", { children: "No results" })
|
|
2437
2469
|
] }) : options.map((option) => {
|
|
@@ -3509,8 +3541,11 @@ function AssetSelector({
|
|
|
3509
3541
|
options,
|
|
3510
3542
|
categories = [],
|
|
3511
3543
|
defaultActiveCategories,
|
|
3544
|
+
networkFilter,
|
|
3545
|
+
venueFilter,
|
|
3512
3546
|
disabled,
|
|
3513
3547
|
disabledTicker,
|
|
3548
|
+
disabledId,
|
|
3514
3549
|
compact,
|
|
3515
3550
|
onOpenPanelHeightChange,
|
|
3516
3551
|
onChange
|
|
@@ -3521,21 +3556,29 @@ function AssetSelector({
|
|
|
3521
3556
|
defaultActiveCategories ?? categories.map((category) => category.id)
|
|
3522
3557
|
);
|
|
3523
3558
|
const selectedKey = selectedId ?? selectedTicker;
|
|
3524
|
-
const selected = options.find((option) =>
|
|
3559
|
+
const selected = options.find((option) => option.id === selectedKey) ?? options.find((option) => option.ticker === selectedTicker);
|
|
3560
|
+
const selectedOptionId = selected?.id ?? selectedKey;
|
|
3525
3561
|
const hasCategoryFilters = categories.length > 0;
|
|
3526
3562
|
const filtered = options.filter((option) => {
|
|
3527
3563
|
const category = option.category ?? null;
|
|
3528
|
-
const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category)
|
|
3529
|
-
|
|
3564
|
+
const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category);
|
|
3565
|
+
const matchesNetwork = !networkFilter || option.network === networkFilter;
|
|
3566
|
+
const matchesVenue = !venueFilter || option.venue === venueFilter;
|
|
3567
|
+
if (!matchesCategory || !matchesNetwork || !matchesVenue) return false;
|
|
3568
|
+
if (!search) return true;
|
|
3530
3569
|
const searchValue = search.toLowerCase();
|
|
3531
|
-
const matchesSearch = option.ticker.toLowerCase().includes(searchValue) || (option.name?.toLowerCase().includes(searchValue) ?? false);
|
|
3532
|
-
return
|
|
3570
|
+
const matchesSearch = option.ticker.toLowerCase().includes(searchValue) || (option.name?.toLowerCase().includes(searchValue) ?? false) || (option.assetId?.toLowerCase().includes(searchValue) ?? false) || (option.network?.toLowerCase().includes(searchValue) ?? false) || (option.category?.toLowerCase().includes(searchValue) ?? false);
|
|
3571
|
+
return matchesSearch;
|
|
3572
|
+
}).sort((a, b) => {
|
|
3573
|
+
if (a.id === selectedOptionId) return -1;
|
|
3574
|
+
if (b.id === selectedOptionId) return 1;
|
|
3575
|
+
return a.ticker.localeCompare(b.ticker);
|
|
3533
3576
|
});
|
|
3534
3577
|
const inlineOptions = filtered.map((option) => ({
|
|
3535
3578
|
...option,
|
|
3536
|
-
id: option.id
|
|
3579
|
+
id: option.id,
|
|
3537
3580
|
label: option.ticker,
|
|
3538
|
-
disabled: option.ticker === disabledTicker
|
|
3581
|
+
disabled: option.id === disabledId || option.ticker === disabledTicker
|
|
3539
3582
|
}));
|
|
3540
3583
|
const categoryLabelById = new Map(categories.map((category) => [category.id, category.label]));
|
|
3541
3584
|
const renderAssetOption = (option, optionSelected, optionDisabled) => {
|
|
@@ -3555,7 +3598,14 @@ function AssetSelector({
|
|
|
3555
3598
|
),
|
|
3556
3599
|
/* @__PURE__ */ jsxs24("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-3 text-left", children: [
|
|
3557
3600
|
/* @__PURE__ */ jsxs24("span", { className: "min-w-0 flex flex-col leading-tight", children: [
|
|
3558
|
-
/* @__PURE__ */ jsx37(
|
|
3601
|
+
/* @__PURE__ */ jsx37(
|
|
3602
|
+
"span",
|
|
3603
|
+
{
|
|
3604
|
+
className: "max-w-full truncate text-base font-bold tracking-wide text-white",
|
|
3605
|
+
title: option.name ?? option.ticker,
|
|
3606
|
+
children: option.name ?? option.ticker
|
|
3607
|
+
}
|
|
3608
|
+
),
|
|
3559
3609
|
option.network && /* @__PURE__ */ jsx37("span", { className: "mt-1", children: /* @__PURE__ */ jsx37(
|
|
3560
3610
|
NetworkBadge,
|
|
3561
3611
|
{
|
|
@@ -3568,7 +3618,14 @@ function AssetSelector({
|
|
|
3568
3618
|
] }),
|
|
3569
3619
|
/* @__PURE__ */ jsxs24("span", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [
|
|
3570
3620
|
optionSelected ? /* @__PURE__ */ jsx37("span", { className: "rounded-full border border-primary/25 bg-primary/[0.14] px-2 py-0.5 text-xxs font-bold uppercase tracking-wide text-primary", children: "Current" }) : optionCategoryLabel && /* @__PURE__ */ jsx37("span", { className: "rounded-full bg-surface-card px-2 py-0.5 text-tiny font-bold uppercase tracking-wide text-text-dimmed shadow-inner", children: optionCategoryLabel }),
|
|
3571
|
-
/* @__PURE__ */ jsx37(
|
|
3621
|
+
/* @__PURE__ */ jsx37(
|
|
3622
|
+
"span",
|
|
3623
|
+
{
|
|
3624
|
+
className: "max-w-24 truncate text-tiny font-medium uppercase tracking-wide text-white/35",
|
|
3625
|
+
title: optionDisabled ? "In use" : option.ticker,
|
|
3626
|
+
children: optionDisabled ? "In use" : option.ticker
|
|
3627
|
+
}
|
|
3628
|
+
)
|
|
3572
3629
|
] })
|
|
3573
3630
|
] })
|
|
3574
3631
|
] });
|
|
@@ -3659,6 +3716,18 @@ function AssetSelector({
|
|
|
3659
3716
|
)
|
|
3660
3717
|
] }),
|
|
3661
3718
|
hasCategoryFilters && /* @__PURE__ */ jsxs24("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
3719
|
+
/* @__PURE__ */ jsx37(
|
|
3720
|
+
"button",
|
|
3721
|
+
{
|
|
3722
|
+
type: "button",
|
|
3723
|
+
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3724
|
+
className: cn(
|
|
3725
|
+
"rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
|
|
3726
|
+
activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
|
|
3727
|
+
),
|
|
3728
|
+
children: "All"
|
|
3729
|
+
}
|
|
3730
|
+
),
|
|
3662
3731
|
categories.map((category) => {
|
|
3663
3732
|
const isActive = activeCategories.includes(category.id);
|
|
3664
3733
|
return /* @__PURE__ */ jsx37(
|
|
@@ -3676,28 +3745,19 @@ function AssetSelector({
|
|
|
3676
3745
|
},
|
|
3677
3746
|
category.id
|
|
3678
3747
|
);
|
|
3679
|
-
})
|
|
3680
|
-
activeCategories.length !== categories.length && /* @__PURE__ */ jsx37(
|
|
3681
|
-
"button",
|
|
3682
|
-
{
|
|
3683
|
-
type: "button",
|
|
3684
|
-
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3685
|
-
className: "ml-auto rounded-full px-2 py-1 text-tiny font-bold uppercase tracking-wide text-white/40 transition-colors hover:text-white/75",
|
|
3686
|
-
children: "All"
|
|
3687
|
-
}
|
|
3688
|
-
)
|
|
3748
|
+
})
|
|
3689
3749
|
] })
|
|
3690
3750
|
] }),
|
|
3691
|
-
/* @__PURE__ */ jsx37(ScrollArea, { className: "min-h-0", viewportClassName: "px-2 py-2 pb-6", children: filtered.length === 0 ? /* @__PURE__ */ jsxs24("div", { className: "flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-white/30", children: [
|
|
3751
|
+
/* @__PURE__ */ jsx37(ScrollArea, { className: "min-h-0 flex-1", viewportClassName: "max-h-[56vh] px-2 py-2 pb-6", children: filtered.length === 0 ? /* @__PURE__ */ jsxs24("div", { className: "flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-white/30", children: [
|
|
3692
3752
|
/* @__PURE__ */ jsx37(Icon, { name: "search", size: "md", className: "opacity-40" }),
|
|
3693
3753
|
/* @__PURE__ */ jsxs24("span", { children: [
|
|
3694
|
-
"No
|
|
3695
|
-
search ? `
|
|
3754
|
+
"No assets match ",
|
|
3755
|
+
search ? `"${search}"` : "the active filters"
|
|
3696
3756
|
] })
|
|
3697
3757
|
] }) : filtered.map((option) => {
|
|
3698
|
-
const optionKey = option.id
|
|
3699
|
-
const optionSelected = optionKey ===
|
|
3700
|
-
const optionDisabled = option.ticker === disabledTicker;
|
|
3758
|
+
const optionKey = option.id;
|
|
3759
|
+
const optionSelected = optionKey === selectedOptionId;
|
|
3760
|
+
const optionDisabled = option.id === disabledId || option.ticker === disabledTicker;
|
|
3701
3761
|
return /* @__PURE__ */ jsx37(
|
|
3702
3762
|
"button",
|
|
3703
3763
|
{
|
|
@@ -3730,7 +3790,7 @@ function AssetSelector({
|
|
|
3730
3790
|
InlineSelector,
|
|
3731
3791
|
{
|
|
3732
3792
|
label,
|
|
3733
|
-
value:
|
|
3793
|
+
value: selectedOptionId,
|
|
3734
3794
|
options: inlineOptions,
|
|
3735
3795
|
onChange: (ticker) => {
|
|
3736
3796
|
onChange(ticker);
|
|
@@ -3817,6 +3877,18 @@ function AssetSelector({
|
|
|
3817
3877
|
)
|
|
3818
3878
|
] }),
|
|
3819
3879
|
hasCategoryFilters && /* @__PURE__ */ jsxs24("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
3880
|
+
/* @__PURE__ */ jsx37(
|
|
3881
|
+
"button",
|
|
3882
|
+
{
|
|
3883
|
+
type: "button",
|
|
3884
|
+
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3885
|
+
className: cn(
|
|
3886
|
+
"rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
|
|
3887
|
+
activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
|
|
3888
|
+
),
|
|
3889
|
+
children: "All"
|
|
3890
|
+
}
|
|
3891
|
+
),
|
|
3820
3892
|
categories.map((category) => {
|
|
3821
3893
|
const isActive = activeCategories.includes(category.id);
|
|
3822
3894
|
return /* @__PURE__ */ jsx37(
|
|
@@ -3834,16 +3906,7 @@ function AssetSelector({
|
|
|
3834
3906
|
},
|
|
3835
3907
|
category.id
|
|
3836
3908
|
);
|
|
3837
|
-
})
|
|
3838
|
-
activeCategories.length !== categories.length && /* @__PURE__ */ jsx37(
|
|
3839
|
-
"button",
|
|
3840
|
-
{
|
|
3841
|
-
type: "button",
|
|
3842
|
-
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
3843
|
-
className: "ml-auto rounded-full px-2 py-1 text-tiny font-bold uppercase tracking-wide text-white/40 transition-colors hover:text-white/75",
|
|
3844
|
-
children: "All"
|
|
3845
|
-
}
|
|
3846
|
-
)
|
|
3909
|
+
})
|
|
3847
3910
|
] })
|
|
3848
3911
|
] })
|
|
3849
3912
|
] }),
|
|
@@ -3860,6 +3923,8 @@ var PERCENTAGES = [25, 50, 75, 100];
|
|
|
3860
3923
|
function SwapInputCard({
|
|
3861
3924
|
fromTicker,
|
|
3862
3925
|
toTicker,
|
|
3926
|
+
fromSelectedId,
|
|
3927
|
+
toSelectedId,
|
|
3863
3928
|
fromInput,
|
|
3864
3929
|
fromOptions,
|
|
3865
3930
|
toOptions,
|
|
@@ -3871,9 +3936,11 @@ function SwapInputCard({
|
|
|
3871
3936
|
selectedPercentage = null,
|
|
3872
3937
|
percentageDisabled = false,
|
|
3873
3938
|
fromUnitLabel,
|
|
3939
|
+
fromDisplayUnit,
|
|
3874
3940
|
fromUnitIsToggle = false,
|
|
3875
3941
|
receiveAmount,
|
|
3876
3942
|
receiveUnitLabel,
|
|
3943
|
+
receiveDisplayUnit,
|
|
3877
3944
|
isLoadingQuote = false,
|
|
3878
3945
|
quoteError,
|
|
3879
3946
|
quoteRateText,
|
|
@@ -3895,6 +3962,15 @@ function SwapInputCard({
|
|
|
3895
3962
|
onFlip,
|
|
3896
3963
|
onSubmit
|
|
3897
3964
|
}) {
|
|
3965
|
+
const availableDisplayText = formatDisplayAmountText(availableText, {
|
|
3966
|
+
unit: fromDisplayUnit
|
|
3967
|
+
});
|
|
3968
|
+
const maxDisplayText = maxText ? formatDisplayAmountText(maxText, {
|
|
3969
|
+
unit: fromDisplayUnit
|
|
3970
|
+
}) : void 0;
|
|
3971
|
+
const receiveDisplayText = receiveAmount ? formatDisplayAmountText(receiveAmount, {
|
|
3972
|
+
unit: receiveDisplayUnit
|
|
3973
|
+
}) : null;
|
|
3898
3974
|
return /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
3899
3975
|
/* @__PURE__ */ jsxs25("div", { className: "relative mb-3 flex flex-col rounded-3xl bg-white/[0.03] shadow-2xl shadow-black/40 backdrop-blur-2xl transition-all duration-300", children: [
|
|
3900
3976
|
/* @__PURE__ */ jsxs25("div", { className: "p-3.5 pb-4", children: [
|
|
@@ -3925,23 +4001,25 @@ function SwapInputCard({
|
|
|
3925
4001
|
compact: true,
|
|
3926
4002
|
label: "From",
|
|
3927
4003
|
selectedTicker: fromTicker,
|
|
4004
|
+
selectedId: fromSelectedId,
|
|
3928
4005
|
options: fromOptions,
|
|
3929
4006
|
categories,
|
|
3930
4007
|
defaultActiveCategories,
|
|
3931
|
-
|
|
4008
|
+
disabledId: toSelectedId,
|
|
3932
4009
|
onChange: onFromTickerChange
|
|
3933
4010
|
}
|
|
3934
4011
|
),
|
|
3935
|
-
/* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1 text-right", children: [
|
|
4012
|
+
/* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1 overflow-hidden text-right", children: [
|
|
3936
4013
|
/* @__PURE__ */ jsx38(
|
|
3937
4014
|
"input",
|
|
3938
4015
|
{
|
|
3939
4016
|
type: "text",
|
|
3940
4017
|
inputMode: "decimal",
|
|
3941
4018
|
value: fromInput,
|
|
4019
|
+
maxLength: 24,
|
|
3942
4020
|
onChange: (event) => onFromInputChange(event.target.value),
|
|
3943
4021
|
placeholder: "0",
|
|
3944
|
-
className: "w-full border-none bg-transparent text-right text-2xl font-bold text-white placeholder:text-white/15 focus:outline-none"
|
|
4022
|
+
className: "w-full min-w-0 border-none bg-transparent text-right text-2xl font-bold tabular-nums text-white placeholder:text-white/15 focus:outline-none"
|
|
3945
4023
|
}
|
|
3946
4024
|
),
|
|
3947
4025
|
fromUnitIsToggle && onToggleFromUnit ? /* @__PURE__ */ jsx38(
|
|
@@ -3956,7 +4034,14 @@ function SwapInputCard({
|
|
|
3956
4034
|
) : /* @__PURE__ */ jsx38("p", { className: "mt-0.5 text-xs text-muted-foreground", children: fromUnitLabel })
|
|
3957
4035
|
] })
|
|
3958
4036
|
] }),
|
|
3959
|
-
/* @__PURE__ */ jsx38("div", { className: "mt-2 flex items-center justify-between gap-2", children: /* @__PURE__ */ jsx38(
|
|
4037
|
+
/* @__PURE__ */ jsx38("div", { className: "mt-2 flex items-center justify-between gap-2", children: /* @__PURE__ */ jsx38(
|
|
4038
|
+
"p",
|
|
4039
|
+
{
|
|
4040
|
+
className: "min-w-0 max-w-full truncate text-xxs font-medium tabular-nums text-white/60",
|
|
4041
|
+
title: showMaxText && maxText ? `Max: ${maxText}` : `Available: ${availableText}`,
|
|
4042
|
+
children: showMaxText && maxDisplayText ? `Max: ${maxDisplayText}` : `Available: ${availableDisplayText}`
|
|
4043
|
+
}
|
|
4044
|
+
) })
|
|
3960
4045
|
] }),
|
|
3961
4046
|
/* @__PURE__ */ jsx38("div", { className: "relative mx-6 flex h-px items-center justify-center bg-white/[0.08]", children: /* @__PURE__ */ jsx38("span", { className: "absolute flex h-11 w-11 items-center justify-center rounded-full bg-card shadow-lg shadow-black/35", children: /* @__PURE__ */ jsx38(
|
|
3962
4047
|
"button",
|
|
@@ -3977,15 +4062,23 @@ function SwapInputCard({
|
|
|
3977
4062
|
compact: true,
|
|
3978
4063
|
label: "To",
|
|
3979
4064
|
selectedTicker: toTicker,
|
|
4065
|
+
selectedId: toSelectedId,
|
|
3980
4066
|
options: toOptions,
|
|
3981
4067
|
categories,
|
|
3982
4068
|
defaultActiveCategories,
|
|
3983
|
-
|
|
4069
|
+
disabledId: fromSelectedId,
|
|
3984
4070
|
onChange: onToTickerChange
|
|
3985
4071
|
}
|
|
3986
4072
|
),
|
|
3987
4073
|
/* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1 text-right", children: [
|
|
3988
|
-
isLoadingQuote ? /* @__PURE__ */ jsx38("div", { className: "ml-auto h-8 w-28 animate-pulse rounded-lg bg-white/10" }) : receiveAmount ? /* @__PURE__ */ jsx38(
|
|
4074
|
+
isLoadingQuote ? /* @__PURE__ */ jsx38("div", { className: "ml-auto h-8 w-28 animate-pulse rounded-lg bg-white/10" }) : receiveAmount ? /* @__PURE__ */ jsx38(
|
|
4075
|
+
"span",
|
|
4076
|
+
{
|
|
4077
|
+
className: "block max-w-full truncate text-2xl font-bold tabular-nums text-primary",
|
|
4078
|
+
title: receiveAmount,
|
|
4079
|
+
children: receiveDisplayText
|
|
4080
|
+
}
|
|
4081
|
+
) : /* @__PURE__ */ jsx38("span", { className: "text-2xl font-bold text-white/15", children: "-" }),
|
|
3989
4082
|
/* @__PURE__ */ jsx38("p", { className: "mt-0.5 text-xs text-muted-foreground", children: receiveUnitLabel || toTicker || "-" })
|
|
3990
4083
|
] })
|
|
3991
4084
|
] })
|
|
@@ -8024,6 +8117,7 @@ export {
|
|
|
8024
8117
|
WithdrawSuccess,
|
|
8025
8118
|
buttonVariants,
|
|
8026
8119
|
cn,
|
|
8120
|
+
formatDisplayAmountText,
|
|
8027
8121
|
getAccountNetworkLabel,
|
|
8028
8122
|
getAccountNetworkUi,
|
|
8029
8123
|
getAccountStatusUi,
|
package/package.json
CHANGED