kaleido-ui 0.1.42 → 0.1.44

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.
@@ -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,30 @@ 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 raw = typeof value === "number" ? String(value) : value.trim();
183
+ const suffixMatch = raw.match(/(\s+[A-Za-z][\w.-]*)$/u);
184
+ const suffix = suffixMatch?.[1] ?? "";
185
+ const detectedUnit = suffix.trim() === "BTC" ? "BTC" : suffix.trim() === "sats" ? "sats" : suffix.trim() === "mBTC" ? "mBTC" : unit;
186
+ const maxDecimals = detectedUnit === "sats" ? 0 : detectedUnit === "BTC" ? 8 : detectedUnit === "mBTC" ? 5 : options.maxDecimals ?? 6;
187
+ const numeric = suffix ? raw.slice(0, -suffix.length) : raw;
188
+ const match = numeric.match(NUMBER_RE);
189
+ if (!match) return raw;
190
+ const num = parseFloat(numeric.replace(/,/g, ""));
191
+ if (!Number.isFinite(num)) return raw;
192
+ const factor = Math.pow(10, maxDecimals);
193
+ const rounded = Math.round(num * factor) / factor;
194
+ const formatted = rounded.toLocaleString("en-US", {
195
+ minimumFractionDigits: 0,
196
+ maximumFractionDigits: maxDecimals
197
+ });
198
+ return `${formatted}${suffix}`;
199
+ }
200
+
176
201
  // src/web/primitives/button.tsx
177
202
  var React = __toESM(require("react"), 1);
178
203
  var import_react_slot = require("@radix-ui/react-slot");
@@ -1598,13 +1623,19 @@ function NetworkBadge({
1598
1623
  backgroundColor: `var(${chipVar})`,
1599
1624
  color: `var(${textVar})`
1600
1625
  };
1601
- const renderGlyph = (className2) => network === "L1" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1602
- "span",
1626
+ const renderGlyph = (className2) => network === "L1" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1627
+ "svg",
1603
1628
  {
1604
- className: cn("material-symbols-outlined leading-none", className2),
1605
- style: { fontSize: size === "sm" ? 12 : size === "lg" ? 24 : 16 },
1629
+ viewBox: "0 0 47.5 47.5",
1630
+ fill: "currentColor",
1606
1631
  "aria-hidden": true,
1607
- children: "link"
1632
+ width: "1em",
1633
+ height: "1em",
1634
+ className: cn("inline-block shrink-0", className2),
1635
+ children: [
1636
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { transform: "matrix(1.25 0 0 -1.25 0 47.5)", d: "m16 28 6 6s6 6 12 0 0-12 0-12l-8-8s-6-6-12 0c-1.125 1.125-1.822 2.62-1.822 2.62l3.353 3.348S15.396 18.604 17 17c0 0 3-3 6 0l8 8s3 3 0 6-6 0-6 0l-3.729-3.729s-1.854 1.521-5.646.354L16 28Z" }),
1637
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { transform: "matrix(1.25 0 0 -1.25 0 47.5)", d: "m21.845 10-6-6s-6-6-12 0 0 12 0 12l8 8s6 6 12 0c1.125-1.125 1.822-2.62 1.822-2.62l-3.353-3.349s.135 1.365-1.469 2.969c0 0-3 3-6 0l-8-8s-3-3 0-6 6 0 6 0l3.729 3.729s1.854-1.52 5.646-.354L21.845 10Z" })
1638
+ ]
1608
1639
  }
1609
1640
  ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1610
1641
  "img",
@@ -1778,6 +1809,7 @@ function AssetCard({
1778
1809
  className
1779
1810
  }) {
1780
1811
  const shown = balanceVisible ? displayBalance : "\u2022\u2022\u2022\u2022\u2022\u2022";
1812
+ const displayShown = balanceVisible ? formatDisplayAmountText(displayBalance) : shown;
1781
1813
  const [hovered, setHovered] = (0, import_react4.useState)(false);
1782
1814
  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
1815
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
@@ -1795,8 +1827,8 @@ function AssetCard({
1795
1827
  onMouseLeave: () => setHovered(false),
1796
1828
  children: [
1797
1829
  /* @__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 relative z-10", children: [
1799
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3", children: [
1830
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative z-10 flex min-w-0 items-center justify-between gap-3", children: [
1831
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
1800
1832
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1801
1833
  AssetIcon,
1802
1834
  {
@@ -1806,23 +1838,31 @@ function AssetCard({
1806
1838
  className: "group-hover:scale-105 transition-transform"
1807
1839
  }
1808
1840
  ),
1809
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col", children: [
1841
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
1810
1842
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1811
1843
  "span",
1812
1844
  {
1813
1845
  className: cn(
1814
- "font-bold text-base leading-tight tracking-wide text-foreground",
1846
+ "max-w-full truncate font-bold text-base leading-tight tracking-wide text-foreground",
1815
1847
  onClick && "transition-colors"
1816
1848
  ),
1849
+ title: name,
1817
1850
  children: name
1818
1851
  }
1819
1852
  ),
1820
1853
  /* @__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
1854
  ] })
1822
1855
  ] }),
1823
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "text-right", children: [
1824
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "font-bold text-lg tracking-tight text-foreground group-hover:opacity-90 transition-colors", children: shown }),
1825
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-tiny text-muted-foreground font-medium tracking-wide uppercase mt-0.5", children: ticker })
1856
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "min-w-0 max-w-[45%] text-right", children: [
1857
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1858
+ "p",
1859
+ {
1860
+ className: "max-w-full truncate font-bold text-lg tabular-nums tracking-tight text-foreground transition-colors group-hover:opacity-90",
1861
+ title: shown,
1862
+ children: displayShown
1863
+ }
1864
+ ),
1865
+ /* @__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
1866
  ] })
1827
1867
  ] })
1828
1868
  ]
@@ -2591,7 +2631,7 @@ function InlineSelector({
2591
2631
  ),
2592
2632
  children: [
2593
2633
  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: [
2634
+ /* @__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
2635
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "search", size: "md", className: "opacity-40" }),
2596
2636
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "No results" })
2597
2637
  ] }) : options.map((option) => {
@@ -3313,7 +3353,7 @@ function ImageIcon({
3313
3353
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("img", { src, alt, className });
3314
3354
  }
3315
3355
  function numberOnly(formatted) {
3316
- return formatted.replace(/\u00a0(sats|BTC|mBTC)$/, "").replace(/^\u20bf/, "");
3356
+ return formatted.replace(/[\u00a0 ](sats|BTC|mBTC)$/, "").replace(/^\u20bf/, "");
3317
3357
  }
3318
3358
  function BalanceBreakdown({
3319
3359
  btcOnchain,
@@ -3669,8 +3709,11 @@ function AssetSelector({
3669
3709
  options,
3670
3710
  categories = [],
3671
3711
  defaultActiveCategories,
3712
+ networkFilter,
3713
+ venueFilter,
3672
3714
  disabled,
3673
3715
  disabledTicker,
3716
+ disabledId,
3674
3717
  compact,
3675
3718
  onOpenPanelHeightChange,
3676
3719
  onChange
@@ -3681,21 +3724,29 @@ function AssetSelector({
3681
3724
  defaultActiveCategories ?? categories.map((category) => category.id)
3682
3725
  );
3683
3726
  const selectedKey = selectedId ?? selectedTicker;
3684
- const selected = options.find((option) => (option.id ?? option.ticker) === selectedKey);
3727
+ const selected = options.find((option) => option.id === selectedKey) ?? options.find((option) => option.ticker === selectedTicker);
3728
+ const selectedOptionId = selected?.id ?? selectedKey;
3685
3729
  const hasCategoryFilters = categories.length > 0;
3686
3730
  const filtered = options.filter((option) => {
3687
3731
  const category = option.category ?? null;
3688
- const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category) || (option.id ?? option.ticker) === selectedKey || option.ticker === disabledTicker;
3689
- if (!search) return matchesCategory;
3732
+ const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category);
3733
+ const matchesNetwork = !networkFilter || option.network === networkFilter;
3734
+ const matchesVenue = !venueFilter || option.venue === venueFilter;
3735
+ if (!matchesCategory || !matchesNetwork || !matchesVenue) return false;
3736
+ if (!search) return true;
3690
3737
  const searchValue = search.toLowerCase();
3691
- const matchesSearch = option.ticker.toLowerCase().includes(searchValue) || (option.name?.toLowerCase().includes(searchValue) ?? false);
3692
- return matchesCategory && matchesSearch;
3738
+ 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);
3739
+ return matchesSearch;
3740
+ }).sort((a, b) => {
3741
+ if (a.id === selectedOptionId) return -1;
3742
+ if (b.id === selectedOptionId) return 1;
3743
+ return a.ticker.localeCompare(b.ticker);
3693
3744
  });
3694
3745
  const inlineOptions = filtered.map((option) => ({
3695
3746
  ...option,
3696
- id: option.id ?? option.ticker,
3747
+ id: option.id,
3697
3748
  label: option.ticker,
3698
- disabled: option.ticker === disabledTicker
3749
+ disabled: option.id === disabledId || option.ticker === disabledTicker
3699
3750
  }));
3700
3751
  const categoryLabelById = new Map(categories.map((category) => [category.id, category.label]));
3701
3752
  const renderAssetOption = (option, optionSelected, optionDisabled) => {
@@ -3715,7 +3766,14 @@ function AssetSelector({
3715
3766
  ),
3716
3767
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-3 text-left", children: [
3717
3768
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "min-w-0 flex flex-col leading-tight", children: [
3718
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "truncate text-base font-bold tracking-wide text-white", children: option.name ?? option.ticker }),
3769
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3770
+ "span",
3771
+ {
3772
+ className: "max-w-full truncate text-base font-bold tracking-wide text-white",
3773
+ title: option.name ?? option.ticker,
3774
+ children: option.name ?? option.ticker
3775
+ }
3776
+ ),
3719
3777
  option.network && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3720
3778
  NetworkBadge,
3721
3779
  {
@@ -3728,7 +3786,14 @@ function AssetSelector({
3728
3786
  ] }),
3729
3787
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [
3730
3788
  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)("span", { className: "text-tiny font-medium uppercase tracking-wide text-white/35", children: optionDisabled ? "In use" : option.ticker })
3789
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3790
+ "span",
3791
+ {
3792
+ className: "max-w-24 truncate text-tiny font-medium uppercase tracking-wide text-white/35",
3793
+ title: optionDisabled ? "In use" : option.ticker,
3794
+ children: optionDisabled ? "In use" : option.ticker
3795
+ }
3796
+ )
3732
3797
  ] })
3733
3798
  ] })
3734
3799
  ] });
@@ -3774,10 +3839,10 @@ function AssetSelector({
3774
3839
  children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3775
3840
  "div",
3776
3841
  {
3777
- className: "flex max-h-[85vh] w-full max-w-[26rem] flex-col overflow-hidden rounded-t-3xl border-t border-border bg-popover/95 shadow-popover backdrop-blur-2xl duration-300 animate-in slide-in-from-bottom-8 sm:max-h-[80vh] sm:rounded-3xl sm:border sm:slide-in-from-bottom-0 sm:zoom-in-95",
3842
+ className: "flex max-h-[85vh] w-full max-w-[26rem] flex-col overflow-hidden rounded-t-3xl bg-popover/95 shadow-popover backdrop-blur-2xl duration-300 animate-in slide-in-from-bottom-8 sm:max-h-[80vh] sm:rounded-3xl sm:border sm:slide-in-from-bottom-0 sm:zoom-in-95",
3778
3843
  onClick: (event) => event.stopPropagation(),
3779
3844
  children: [
3780
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex-shrink-0 border-b border-white/[0.08] bg-white/[0.03] px-4 py-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
3845
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex-shrink-0 bg-white/[0.03] px-4 py-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
3781
3846
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "min-w-0", children: [
3782
3847
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "text-xxs font-bold uppercase tracking-eyebrow-wide text-text-dimmed", children: [
3783
3848
  label,
@@ -3790,13 +3855,13 @@ function AssetSelector({
3790
3855
  " available"
3791
3856
  ] })
3792
3857
  ] }),
3793
- selected && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-2.5 py-1", children: [
3858
+ selected && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 rounded-full bg-white/5 px-2.5 py-1", children: [
3794
3859
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 18 }),
3795
3860
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-tiny font-semibold text-white", children: selected.ticker }),
3796
3861
  selected.network && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(NetworkBadge, { network: selected.network, showLabel: true, className: "py-[1px]" })
3797
3862
  ] })
3798
3863
  ] }) }),
3799
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex-shrink-0 border-b border-white/[0.08] px-4 py-3", children: [
3864
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex-shrink-0 px-4 py-3", children: [
3800
3865
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "relative", children: [
3801
3866
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3802
3867
  Icon,
@@ -3819,6 +3884,18 @@ function AssetSelector({
3819
3884
  )
3820
3885
  ] }),
3821
3886
  hasCategoryFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
3887
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3888
+ "button",
3889
+ {
3890
+ type: "button",
3891
+ onClick: () => setActiveCategories(categories.map((category) => category.id)),
3892
+ className: cn(
3893
+ "rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
3894
+ activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
3895
+ ),
3896
+ children: "All"
3897
+ }
3898
+ ),
3822
3899
  categories.map((category) => {
3823
3900
  const isActive = activeCategories.includes(category.id);
3824
3901
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -3836,28 +3913,20 @@ function AssetSelector({
3836
3913
  },
3837
3914
  category.id
3838
3915
  );
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
- )
3916
+ })
3849
3917
  ] })
3850
3918
  ] }),
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: [
3919
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "mx-4 h-px bg-white/[0.06]" }),
3920
+ /* @__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
3921
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "search", size: "md", className: "opacity-40" }),
3853
3922
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
3854
- "No results",
3855
- search ? ` for "${search}"` : ""
3923
+ "No assets match ",
3924
+ search ? `"${search}"` : "the active filters"
3856
3925
  ] })
3857
3926
  ] }) : filtered.map((option) => {
3858
- const optionKey = option.id ?? option.ticker;
3859
- const optionSelected = optionKey === selectedKey;
3860
- const optionDisabled = option.ticker === disabledTicker;
3927
+ const optionKey = option.id;
3928
+ const optionSelected = optionKey === selectedOptionId;
3929
+ const optionDisabled = option.id === disabledId || option.ticker === disabledTicker;
3861
3930
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3862
3931
  "button",
3863
3932
  {
@@ -3890,7 +3959,7 @@ function AssetSelector({
3890
3959
  InlineSelector,
3891
3960
  {
3892
3961
  label,
3893
- value: selectedKey,
3962
+ value: selectedOptionId,
3894
3963
  options: inlineOptions,
3895
3964
  onChange: (ticker) => {
3896
3965
  onChange(ticker);
@@ -3935,7 +4004,7 @@ function AssetSelector({
3935
4004
  ] })
3936
4005
  ] }),
3937
4006
  renderPanelHeader: () => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3938
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "border-b border-white/[0.08] bg-white/[0.03] px-4 py-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
4007
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "bg-white/[0.03] px-4 py-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
3939
4008
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "min-w-0", children: [
3940
4009
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "text-xxs font-bold uppercase tracking-eyebrow-wide text-text-dimmed", children: [
3941
4010
  label,
@@ -3948,13 +4017,13 @@ function AssetSelector({
3948
4017
  " available"
3949
4018
  ] })
3950
4019
  ] }),
3951
- selected && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-2.5 py-1", children: [
4020
+ selected && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 rounded-full bg-white/5 px-2.5 py-1", children: [
3952
4021
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 18 }),
3953
4022
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-tiny font-semibold text-white", children: selected.ticker }),
3954
4023
  selected.network && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(NetworkBadge, { network: selected.network, showLabel: true, className: "py-[1px]" })
3955
4024
  ] })
3956
4025
  ] }) }),
3957
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "border-b border-white/[0.08] px-4 py-3", children: [
4026
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "px-4 py-3", children: [
3958
4027
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "relative", children: [
3959
4028
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3960
4029
  Icon,
@@ -3977,6 +4046,18 @@ function AssetSelector({
3977
4046
  )
3978
4047
  ] }),
3979
4048
  hasCategoryFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
4049
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4050
+ "button",
4051
+ {
4052
+ type: "button",
4053
+ onClick: () => setActiveCategories(categories.map((category) => category.id)),
4054
+ className: cn(
4055
+ "rounded-full px-2.5 py-1 text-tiny font-bold uppercase tracking-wide shadow-inner transition-colors",
4056
+ activeCategories.length === categories.length ? "bg-primary/[0.14] text-primary" : "bg-surface-card text-text-dimmed hover:text-white/75"
4057
+ ),
4058
+ children: "All"
4059
+ }
4060
+ ),
3980
4061
  categories.map((category) => {
3981
4062
  const isActive = activeCategories.includes(category.id);
3982
4063
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -3994,16 +4075,7 @@ function AssetSelector({
3994
4075
  },
3995
4076
  category.id
3996
4077
  );
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
- )
4078
+ })
4007
4079
  ] })
4008
4080
  ] })
4009
4081
  ] }),
@@ -4020,6 +4092,8 @@ var PERCENTAGES = [25, 50, 75, 100];
4020
4092
  function SwapInputCard({
4021
4093
  fromTicker,
4022
4094
  toTicker,
4095
+ fromSelectedId,
4096
+ toSelectedId,
4023
4097
  fromInput,
4024
4098
  fromOptions,
4025
4099
  toOptions,
@@ -4031,9 +4105,11 @@ function SwapInputCard({
4031
4105
  selectedPercentage = null,
4032
4106
  percentageDisabled = false,
4033
4107
  fromUnitLabel,
4108
+ fromDisplayUnit,
4034
4109
  fromUnitIsToggle = false,
4035
4110
  receiveAmount,
4036
4111
  receiveUnitLabel,
4112
+ receiveDisplayUnit,
4037
4113
  isLoadingQuote = false,
4038
4114
  quoteError,
4039
4115
  quoteRateText,
@@ -4055,6 +4131,15 @@ function SwapInputCard({
4055
4131
  onFlip,
4056
4132
  onSubmit
4057
4133
  }) {
4134
+ const availableDisplayText = formatDisplayAmountText(availableText, {
4135
+ unit: fromDisplayUnit
4136
+ });
4137
+ const maxDisplayText = maxText ? formatDisplayAmountText(maxText, {
4138
+ unit: fromDisplayUnit
4139
+ }) : void 0;
4140
+ const receiveDisplayText = receiveAmount ? formatDisplayAmountText(receiveAmount, {
4141
+ unit: receiveDisplayUnit
4142
+ }) : null;
4058
4143
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
4059
4144
  /* @__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
4145
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3.5 pb-4", children: [
@@ -4085,23 +4170,25 @@ function SwapInputCard({
4085
4170
  compact: true,
4086
4171
  label: "From",
4087
4172
  selectedTicker: fromTicker,
4173
+ selectedId: fromSelectedId,
4088
4174
  options: fromOptions,
4089
4175
  categories,
4090
4176
  defaultActiveCategories,
4091
- disabledTicker: toTicker,
4177
+ disabledId: toSelectedId,
4092
4178
  onChange: onFromTickerChange
4093
4179
  }
4094
4180
  ),
4095
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1 text-right", children: [
4181
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1 overflow-hidden text-right", children: [
4096
4182
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4097
4183
  "input",
4098
4184
  {
4099
4185
  type: "text",
4100
4186
  inputMode: "decimal",
4101
4187
  value: fromInput,
4188
+ maxLength: 24,
4102
4189
  onChange: (event) => onFromInputChange(event.target.value),
4103
4190
  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"
4191
+ 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
4192
  }
4106
4193
  ),
4107
4194
  fromUnitIsToggle && onToggleFromUnit ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
@@ -4116,7 +4203,14 @@ function SwapInputCard({
4116
4203
  ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: fromUnitLabel })
4117
4204
  ] })
4118
4205
  ] }),
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)("p", { className: "text-xxs font-medium text-white/60", children: showMaxText && maxText ? `Max: ${maxText}` : `Available: ${availableText}` }) })
4206
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mt-2 flex items-center justify-between gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4207
+ "p",
4208
+ {
4209
+ className: "min-w-0 max-w-full truncate text-xxs font-medium tabular-nums text-white/60",
4210
+ title: showMaxText && maxText ? `Max: ${maxText}` : `Available: ${availableText}`,
4211
+ children: showMaxText && maxDisplayText ? `Max: ${maxDisplayText}` : `Available: ${availableDisplayText}`
4212
+ }
4213
+ ) })
4120
4214
  ] }),
4121
4215
  /* @__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
4216
  "button",
@@ -4137,15 +4231,23 @@ function SwapInputCard({
4137
4231
  compact: true,
4138
4232
  label: "To",
4139
4233
  selectedTicker: toTicker,
4234
+ selectedId: toSelectedId,
4140
4235
  options: toOptions,
4141
4236
  categories,
4142
4237
  defaultActiveCategories,
4143
- disabledTicker: fromTicker,
4238
+ disabledId: fromSelectedId,
4144
4239
  onChange: onToTickerChange
4145
4240
  }
4146
4241
  ),
4147
4242
  /* @__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)("span", { className: "text-2xl font-bold text-primary", children: receiveAmount }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-2xl font-bold text-white/15", children: "-" }),
4243
+ 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)(
4244
+ "span",
4245
+ {
4246
+ className: "block max-w-full truncate text-2xl font-bold tabular-nums text-primary",
4247
+ title: receiveAmount,
4248
+ children: receiveDisplayText
4249
+ }
4250
+ ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-2xl font-bold text-white/15", children: "-" }),
4149
4251
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: receiveUnitLabel || toTicker || "-" })
4150
4252
  ] })
4151
4253
  ] })
@@ -4262,7 +4364,7 @@ function LoadingCard({ message = "Loading...", className }) {
4262
4364
  className
4263
4365
  ),
4264
4366
  children: [
4265
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "mb-4 size-12 animate-spin rounded-full border-2 border-primary/20 border-t-primary" }),
4367
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "mb-4 size-12 animate-spin rounded-full border-4 border-primary/20 border-t-primary" }),
4266
4368
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm", children: message })
4267
4369
  ]
4268
4370
  }
@@ -7441,9 +7543,6 @@ function formatAssetBalance(asset) {
7441
7543
  maximumFractionDigits: Math.min(precision, 8)
7442
7544
  });
7443
7545
  }
7444
- function NetBadge({ icon, className }) {
7445
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: cn("inline-flex items-center justify-center rounded border px-1.5 py-0.5", className), children: icon });
7446
- }
7447
7546
  function DepositAssetSelection({
7448
7547
  setCurrentView,
7449
7548
  isNewAsset,
@@ -7547,7 +7646,7 @@ function DepositAssetSelection({
7547
7646
  {
7548
7647
  type: "button",
7549
7648
  "data-testid": "deposit-asset-btc",
7550
- className: "group flex w-full items-center gap-3 rounded-2xl border border-white/8 bg-white/3 px-4 py-3 text-sm transition-all hover:border-border hover:bg-accent",
7649
+ className: "group flex w-full items-center gap-3 rounded-2xl bg-white/3 px-4 py-3 text-sm transition-all hover:bg-accent",
7551
7650
  onClick: () => onSelectAsset(btcAsset),
7552
7651
  children: [
7553
7652
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(AssetIcon, { ticker: "BTC", size: 40 }),
@@ -7556,34 +7655,10 @@ function DepositAssetSelection({
7556
7655
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mt-0.5 text-xs text-white/40", children: "Choose destination account next" })
7557
7656
  ] }),
7558
7657
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-shrink-0 gap-1", children: [
7559
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7560
- NetBadge,
7561
- {
7562
- className: "border-network-bitcoin/20 bg-network-bitcoin/15",
7563
- icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "material-symbols-outlined leading-none text-network-bitcoin", style: { fontSize: 10 }, children: "link" })
7564
- }
7565
- ),
7566
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7567
- NetBadge,
7568
- {
7569
- className: "border-warning/20 bg-warning/15",
7570
- icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: "/icons/lightning/lightning.svg", className: "h-2.5 w-2.5", alt: "" })
7571
- }
7572
- ),
7573
- isSparkConnected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7574
- NetBadge,
7575
- {
7576
- className: "border-info/20 bg-info/15",
7577
- icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: "/icons/spark/Asterisk/Spark Asterisk White.svg", className: "h-2.5 w-2.5", alt: "Spark" })
7578
- }
7579
- ),
7580
- isArkadeConnected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7581
- NetBadge,
7582
- {
7583
- className: "border-network-arkade/20 bg-network-arkade/15",
7584
- icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: "/icons/arkade/arkade-icon.svg", className: "h-2.5 w-2.5 rounded-sm", alt: "Arkade" })
7585
- }
7586
- )
7658
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NetworkBadge, { network: "L1", size: "sm" }),
7659
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NetworkBadge, { network: "LN", size: "sm" }),
7660
+ isSparkConnected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NetworkBadge, { network: "Spark", size: "sm" }),
7661
+ isArkadeConnected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NetworkBadge, { network: "Arkade", size: "sm" })
7587
7662
  ] }),
7588
7663
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "material-symbols-outlined flex-shrink-0 text-icon-md text-white/20 transition-colors group-hover:text-white/50", children: "arrow_forward" })
7589
7664
  ]
@@ -7602,8 +7677,8 @@ function DepositAssetSelection({
7602
7677
  onClick: () => !isSearching && setAssetsExpanded((value) => !value),
7603
7678
  disabled: isSearching,
7604
7679
  className: cn(
7605
- "flex w-full items-center gap-2 rounded-2xl border px-4 py-2.5 transition-all",
7606
- showOwnedAssets ? "border-white/10 bg-white/4" : "border-white/8 bg-white/3 hover:border-border hover:bg-accent",
7680
+ "flex w-full items-center gap-2 rounded-2xl px-4 py-2.5 transition-all",
7681
+ showOwnedAssets ? "bg-white/4" : "bg-white/3 hover:bg-accent",
7607
7682
  isSearching && "cursor-default"
7608
7683
  ),
7609
7684
  children: [
@@ -8185,6 +8260,7 @@ function DepositInvoiceGeneration({
8185
8260
  WithdrawSuccess,
8186
8261
  buttonVariants,
8187
8262
  cn,
8263
+ formatDisplayAmountText,
8188
8264
  getAccountNetworkLabel,
8189
8265
  getAccountNetworkUi,
8190
8266
  getAccountStatusUi,