kaleido-ui 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -10
- package/dist/icon-AvUL0Cws.d.cts +135 -0
- package/dist/icon-AvUL0Cws.d.ts +135 -0
- package/dist/native/index.cjs +0 -126
- package/dist/native/index.js +0 -126
- package/dist/web/assets/kaleidoswap-brand.js +11 -0
- package/dist/web/assets/protocol-icons.js +7 -0
- package/dist/web/chunk-25RRZDZ2.js +269 -0
- package/dist/web/chunk-27CY5EHL.js +230 -0
- package/dist/web/chunk-2GNXC446.js +84 -0
- package/dist/web/chunk-2NCH2ZDU.js +129 -0
- package/dist/web/chunk-2OGYEUYV.js +220 -0
- package/dist/web/chunk-2Q5SSNFO.js +63 -0
- package/dist/web/chunk-2REWXJEN.js +96 -0
- package/dist/web/chunk-2VAS6VYJ.js +106 -0
- package/dist/web/chunk-2VKFRAX3.js +39 -0
- package/dist/web/chunk-2Z6KFK4Z.js +41 -0
- package/dist/web/chunk-4246Y2F2.js +276 -0
- package/dist/web/chunk-4MLPMRXA.js +85 -0
- package/dist/web/chunk-4QLR4ZNK.js +383 -0
- package/dist/web/chunk-4UMKXXAK.js +33 -0
- package/dist/web/chunk-563GMWFT.js +32 -0
- package/dist/web/chunk-5BNDC7M4.js +50 -0
- package/dist/web/chunk-5GBURTY4.js +33 -0
- package/dist/web/chunk-5MM5YGGG.js +43 -0
- package/dist/web/chunk-5PZ2XVWL.js +85 -0
- package/dist/web/chunk-5V2KMO56.js +55 -0
- package/dist/web/chunk-5WBAFYPH.js +62 -0
- package/dist/web/chunk-62HIDJCD.js +98 -0
- package/dist/web/chunk-6IBQJIHT.js +56 -0
- package/dist/web/chunk-6PNGSAJB.js +55 -0
- package/dist/web/chunk-6VKWG5FJ.js +159 -0
- package/dist/web/chunk-76DAZT7Q.js +107 -0
- package/dist/web/chunk-7NS5S2PG.js +126 -0
- package/dist/web/chunk-7OE6AXLY.js +27 -0
- package/dist/web/chunk-7YUPXESC.js +666 -0
- package/dist/web/chunk-A3TKIXSI.js +197 -0
- package/dist/web/chunk-A3XHFJ6J.js +120 -0
- package/dist/web/chunk-A6MSV4MA.js +83 -0
- package/dist/web/chunk-A7MPRLJL.js +169 -0
- package/dist/web/chunk-AP7Q2FCS.js +43 -0
- package/dist/web/chunk-ASHU5XNR.js +21 -0
- package/dist/web/chunk-BGUBHWIO.js +41 -0
- package/dist/web/chunk-BY2KCPTX.js +444 -0
- package/dist/web/chunk-C7YIQDGQ.js +57 -0
- package/dist/web/chunk-CBE7BT3M.js +87 -0
- package/dist/web/chunk-CJATW6EO.js +108 -0
- package/dist/web/chunk-CRDCVB5X.js +96 -0
- package/dist/web/chunk-CRMLYZIX.js +35 -0
- package/dist/web/chunk-CXMCWSWC.js +20 -0
- package/dist/web/chunk-CZPNI33A.js +31 -0
- package/dist/web/chunk-DCUAE6PX.js +202 -0
- package/dist/web/chunk-DDMDRAD6.js +403 -0
- package/dist/web/chunk-DH7VXKGM.js +247 -0
- package/dist/web/chunk-DNHRMPKI.js +63 -0
- package/dist/web/chunk-DXFFYCU3.js +83 -0
- package/dist/web/chunk-EK5N3ZPW.js +417 -0
- package/dist/web/chunk-F2LIZX5K.js +140 -0
- package/dist/web/chunk-FSQV54O4.js +61 -0
- package/dist/web/chunk-FWOIRFV5.js +73 -0
- package/dist/web/chunk-G2MJL3VP.js +54 -0
- package/dist/web/chunk-G2ZYNR3W.js +28 -0
- package/dist/web/chunk-G373WZMN.js +150 -0
- package/dist/web/chunk-GMJGTSCQ.js +82 -0
- package/dist/web/chunk-GX7GBHJ6.js +362 -0
- package/dist/web/chunk-GZZ5KVON.js +70 -0
- package/dist/web/chunk-H3GYLFHP.js +30 -0
- package/dist/web/chunk-HDLOPDFX.js +89 -0
- package/dist/web/chunk-HP25HN7Q.js +69 -0
- package/dist/web/chunk-HVKSBEZN.js +98 -0
- package/dist/web/chunk-HWKXZNBN.js +74 -0
- package/dist/web/chunk-HY3VMT27.js +64 -0
- package/dist/web/chunk-IK32AIOS.js +27 -0
- package/dist/web/chunk-IMER4KGH.js +151 -0
- package/dist/web/chunk-IV6AAVUE.js +177 -0
- package/dist/web/chunk-JWMFTRDC.js +254 -0
- package/dist/web/chunk-JY3H7ZAI.js +41 -0
- package/dist/web/chunk-JY73M73T.js +175 -0
- package/dist/web/chunk-JYM5NHBA.js +80 -0
- package/dist/web/chunk-JZ3BUM5L.js +368 -0
- package/dist/web/chunk-KIMWCG5N.js +108 -0
- package/dist/web/chunk-L2UPQLY7.js +43 -0
- package/dist/web/chunk-LFAORJQK.js +81 -0
- package/dist/web/chunk-LOGZGZWN.js +1 -0
- package/dist/web/chunk-LPDB7EHH.js +65 -0
- package/dist/web/chunk-LSY4DY2I.js +72 -0
- package/dist/web/chunk-LYCLVP26.js +101 -0
- package/dist/web/chunk-LZ6PIXUO.js +43 -0
- package/dist/web/chunk-LZ723UCB.js +96 -0
- package/dist/web/chunk-M6RXTQEL.js +90 -0
- package/dist/web/chunk-MTQ22SKE.js +39 -0
- package/dist/web/chunk-MTQOAMDW.js +8 -0
- package/dist/web/chunk-NEXA6VGG.js +91 -0
- package/dist/web/chunk-NSA777UY.js +89 -0
- package/dist/web/chunk-O2TTO5FS.js +24 -0
- package/dist/web/chunk-O6NPTMDN.js +191 -0
- package/dist/web/chunk-OI7WX7NE.js +17 -0
- package/dist/web/chunk-OWSKP527.js +80 -0
- package/dist/web/chunk-OX3J3FYX.js +64 -0
- package/dist/web/chunk-PCKRLEAO.js +40 -0
- package/dist/web/chunk-PMGIJMRO.js +207 -0
- package/dist/web/chunk-PS7Q6MMU.js +60 -0
- package/dist/web/chunk-PTSOVDKH.js +169 -0
- package/dist/web/chunk-QBZSLR7U.js +54 -0
- package/dist/web/chunk-QCQRA6L5.js +63 -0
- package/dist/web/chunk-QFIGSIXA.js +558 -0
- package/dist/web/chunk-QRFFLA3N.js +84 -0
- package/dist/web/chunk-QXCCUYNY.js +232 -0
- package/dist/web/chunk-QXZ2WY3B.js +38 -0
- package/dist/web/chunk-R2MV4S4U.js +50 -0
- package/dist/web/chunk-R3IIXFGK.js +48 -0
- package/dist/web/chunk-RIOY4LFJ.js +141 -0
- package/dist/web/chunk-RV7Z3B3V.js +106 -0
- package/dist/web/chunk-RXXYUYBP.js +25 -0
- package/dist/web/chunk-S2ICIIH2.js +109 -0
- package/dist/web/chunk-SJNOBBU5.js +86 -0
- package/dist/web/chunk-STMNX3QT.js +109 -0
- package/dist/web/chunk-T7CEJV6P.js +66 -0
- package/dist/web/chunk-TBEKRQGW.js +99 -0
- package/dist/web/chunk-TCFHH5TE.js +179 -0
- package/dist/web/chunk-TI7NWMEQ.js +34 -0
- package/dist/web/chunk-TKRMGN7J.js +8 -0
- package/dist/web/chunk-TMK3SVYI.js +62 -0
- package/dist/web/chunk-TPGNO74K.js +67 -0
- package/dist/web/chunk-TS4UYWJJ.js +105 -0
- package/dist/web/chunk-TY6SGZC7.js +94 -0
- package/dist/web/chunk-UHXOPILM.js +101 -0
- package/dist/web/chunk-UK6ZL4MX.js +375 -0
- package/dist/web/chunk-UXLWWQ4J.js +20 -0
- package/dist/web/chunk-UZ4LWR4X.js +26 -0
- package/dist/web/chunk-VLZMX43R.js +45 -0
- package/dist/web/chunk-VM6AGMYO.js +46 -0
- package/dist/web/chunk-VUGV3ELU.js +176 -0
- package/dist/web/chunk-VYQHGSK6.js +244 -0
- package/dist/web/chunk-VZF5C3C6.js +146 -0
- package/dist/web/chunk-W4E2N3UN.js +58 -0
- package/dist/web/chunk-WEPSTI3Z.js +83 -0
- package/dist/web/chunk-WOAWUXER.js +139 -0
- package/dist/web/chunk-WURSWAKE.js +74 -0
- package/dist/web/chunk-WWF7IJBF.js +330 -0
- package/dist/web/chunk-X2RA4EG3.js +86 -0
- package/dist/web/chunk-XCQGJYGF.js +42 -0
- package/dist/web/chunk-XDSOOOYL.js +35 -0
- package/dist/web/chunk-XPHFJPUQ.js +291 -0
- package/dist/web/chunk-XXH4TYKZ.js +276 -0
- package/dist/web/chunk-XZQUQOR3.js +48 -0
- package/dist/web/chunk-Y3W6LOOE.js +66 -0
- package/dist/web/chunk-YNB4SSLD.js +113 -0
- package/dist/web/chunk-YQDCU7ZL.js +49 -0
- package/dist/web/chunk-YQQ7GDLZ.js +30 -0
- package/dist/web/chunk-YTXWYWVD.js +70 -0
- package/dist/web/chunk-YXVOFEDT.js +85 -0
- package/dist/web/chunk-Z2SS7UJ4.js +139 -0
- package/dist/web/chunk-Z5LVT3BD.js +128 -0
- package/dist/web/chunk-Z5O67WTL.js +85 -0
- package/dist/web/chunk-ZPNGHBKB.js +86 -0
- package/dist/web/chunk-ZR32WYJA.js +55 -0
- package/dist/web/chunk-ZRIBB4EB.js +62 -0
- package/dist/web/chunk-ZTVV4KBT.js +28 -0
- package/dist/web/chunk-ZXCT3Y6P.js +56 -0
- package/dist/web/components/account-capabilities-card.js +21 -0
- package/dist/web/components/account-menu.js +18 -0
- package/dist/web/components/account-settings-shared.js +50 -0
- package/dist/web/components/account-status-tabs.js +20 -0
- package/dist/web/components/action-tile.js +8 -0
- package/dist/web/components/activity-detail-row.js +22 -0
- package/dist/web/components/activity-filter-bar.js +22 -0
- package/dist/web/components/activity-list.js +23 -0
- package/dist/web/components/activity-network-filters.js +19 -0
- package/dist/web/components/activity-row.js +15 -0
- package/dist/web/components/activity-type-tabs.js +17 -0
- package/dist/web/components/alert-banner.js +13 -0
- package/dist/web/components/amount.js +8 -0
- package/dist/web/components/app-icon.js +15 -0
- package/dist/web/components/asset-card.js +21 -0
- package/dist/web/components/asset-icon.js +10 -0
- package/dist/web/components/asset-selector.js +24 -0
- package/dist/web/components/balance-breakdown.js +18 -0
- package/dist/web/components/basic-collapsible.js +11 -0
- package/dist/web/components/bottom-nav.js +13 -0
- package/dist/web/components/bottom-sheet.js +15 -0
- package/dist/web/components/btc-unified-receive.js +28 -0
- package/dist/web/components/charts/bar-chart.js +24 -0
- package/dist/web/components/charts/bar-list.js +24 -0
- package/dist/web/components/charts/core.js +63 -0
- package/dist/web/components/charts/donut-chart.js +26 -0
- package/dist/web/components/charts/index.js +72 -0
- package/dist/web/components/charts/line-chart.js +26 -0
- package/dist/web/components/charts/meter.js +24 -0
- package/dist/web/components/charts/mixed-chart.js +24 -0
- package/dist/web/components/charts/scatter-chart.js +24 -0
- package/dist/web/components/charts/sparkline.js +8 -0
- package/dist/web/components/choice-group.js +11 -0
- package/dist/web/components/code-block.js +21 -0
- package/dist/web/components/confirm-dialog.js +15 -0
- package/dist/web/components/copy-button.js +21 -0
- package/dist/web/components/copyable.js +20 -0
- package/dist/web/components/date-range-filter.js +16 -0
- package/dist/web/components/deposit-asset-selection.js +24 -0
- package/dist/web/components/deposit-generated-view.js +23 -0
- package/dist/web/components/deposit-invoice-generation.js +35 -0
- package/dist/web/components/deposit-network-default-modal.js +13 -0
- package/dist/web/components/deposit-pre-generation.js +17 -0
- package/dist/web/components/deposit-success-screen.js +20 -0
- package/dist/web/components/deposit-ui-shared.js +28 -0
- package/dist/web/components/disclosure-card.js +11 -0
- package/dist/web/components/dotted-leader.js +8 -0
- package/dist/web/components/empty-state.js +8 -0
- package/dist/web/components/environment-indicator.js +9 -0
- package/dist/web/components/error-boundary.js +10 -0
- package/dist/web/components/event-timeline.js +8 -0
- package/dist/web/components/extension-page-frame.js +15 -0
- package/dist/web/components/filter-bar.js +15 -0
- package/dist/web/components/filter-chip-group.js +8 -0
- package/dist/web/components/filter-dropdown.js +12 -0
- package/dist/web/components/floating-notice.js +12 -0
- package/dist/web/components/form-field.js +10 -0
- package/dist/web/components/halo-backdrop.js +8 -0
- package/dist/web/components/info-chip.js +24 -0
- package/dist/web/components/info-panel.js +13 -0
- package/dist/web/components/inline-selector.js +11 -0
- package/dist/web/components/instants-statement.js +20 -0
- package/dist/web/components/kaleidoscope-hero-animation.js +11 -0
- package/dist/web/components/kaleidoswap-logo.js +12 -0
- package/dist/web/components/list-field.js +14 -0
- package/dist/web/components/list-summary.js +8 -0
- package/dist/web/components/metric-card.js +14 -0
- package/dist/web/components/mobile-hero-animation.js +8 -0
- package/dist/web/components/network-badge.js +14 -0
- package/dist/web/components/network-icon.js +21 -0
- package/dist/web/components/network-status-chip.js +11 -0
- package/dist/web/components/notice-bar.js +8 -0
- package/dist/web/components/one-time-secret-dialog.js +18 -0
- package/dist/web/components/option-selector.js +12 -0
- package/dist/web/components/page-header.js +12 -0
- package/dist/web/components/page-shell.js +18 -0
- package/dist/web/components/pager.js +11 -0
- package/dist/web/components/period-select.js +20 -0
- package/dist/web/components/qr-code.js +10 -0
- package/dist/web/components/query-state.js +19 -0
- package/dist/web/components/read-status.js +15 -0
- package/dist/web/components/record-list.js +17 -0
- package/dist/web/components/recovery-phrase-card.js +20 -0
- package/dist/web/components/restricted.js +9 -0
- package/dist/web/components/secret-reveal-card.js +20 -0
- package/dist/web/components/section-header.js +9 -0
- package/dist/web/components/section-label.js +8 -0
- package/dist/web/components/selectable-card.js +8 -0
- package/dist/web/components/setting-item.js +13 -0
- package/dist/web/components/settings-section-card.js +11 -0
- package/dist/web/components/settings-selector-row.js +8 -0
- package/dist/web/components/settings-tile.js +21 -0
- package/dist/web/components/skeleton.js +10 -0
- package/dist/web/components/status-badge.js +13 -0
- package/dist/web/components/status-icon-badge.js +15 -0
- package/dist/web/components/stepper-number-input.js +10 -0
- package/dist/web/components/summary-rows.js +9 -0
- package/dist/web/components/swap-badge.js +11 -0
- package/dist/web/components/swap-input-card.js +28 -0
- package/dist/web/components/swap-step-list.js +10 -0
- package/dist/web/components/switch-row.js +9 -0
- package/dist/web/components/theme-toggle.js +12 -0
- package/dist/web/components/transaction-card.js +14 -0
- package/dist/web/components/trend-chart.js +28 -0
- package/dist/web/components/value-list.js +20 -0
- package/dist/web/components/wallet-asset-list.js +22 -0
- package/dist/web/components/withdraw-amount-input.js +13 -0
- package/dist/web/components/withdraw-confirmation.js +17 -0
- package/dist/web/components/withdraw-destination-input.js +14 -0
- package/dist/web/components/withdraw-invoice-info.js +10 -0
- package/dist/web/components/withdraw-route-selector.js +9 -0
- package/dist/web/components/withdraw-success.js +12 -0
- package/dist/web/hooks/use-asset-icon.js +11 -0
- package/dist/web/hooks/use-copy-to-clipboard.js +7 -0
- package/dist/web/hooks/use-media-query.js +9 -0
- package/dist/web/hooks/use-theme-mode.js +9 -0
- package/dist/web/hooks/use-toast.js +11 -0
- package/dist/web/icons/filled.js +15 -0
- package/dist/web/icons/index.js +13 -0
- package/dist/web/icons/outlined.js +221 -0
- package/dist/web/icons/public.js +248 -0
- package/dist/web/icons.cjs +776 -0
- package/dist/web/icons.d.cts +123 -0
- package/dist/web/icons.d.ts +123 -0
- package/dist/web/index.cjs +2547 -2496
- package/dist/web/index.d.cts +16 -107
- package/dist/web/index.d.ts +16 -107
- package/dist/web/index.js +592 -14464
- package/dist/web/primitives/avatar.js +10 -0
- package/dist/web/primitives/button.js +10 -0
- package/dist/web/primitives/card.js +20 -0
- package/dist/web/primitives/collapsible.js +16 -0
- package/dist/web/primitives/dialog.js +30 -0
- package/dist/web/primitives/dot-pagination.js +8 -0
- package/dist/web/primitives/drawer.js +43 -0
- package/dist/web/primitives/dropdown-menu.js +28 -0
- package/dist/web/primitives/glyph-button.js +10 -0
- package/dist/web/primitives/icon-button.js +15 -0
- package/dist/web/primitives/icon-glyph.js +8 -0
- package/dist/web/primitives/icon.js +16 -0
- package/dist/web/primitives/input.js +9 -0
- package/dist/web/primitives/label.js +9 -0
- package/dist/web/primitives/menu-search.js +20 -0
- package/dist/web/primitives/number-input.js +11 -0
- package/dist/web/primitives/popover.js +18 -0
- package/dist/web/primitives/scroll-area.js +12 -0
- package/dist/web/primitives/select.js +27 -0
- package/dist/web/primitives/switch.js +8 -0
- package/dist/web/primitives/table.js +27 -0
- package/dist/web/primitives/tabs.js +14 -0
- package/dist/web/primitives/toast.js +24 -0
- package/dist/web/primitives/toaster.js +15 -0
- package/dist/web/primitives/tooltip.js +10 -0
- package/dist/web/utils/amount-display.js +13 -0
- package/dist/web/utils/cn.js +7 -0
- package/dist/web/utils/field-styles.js +7 -0
- package/dist/web/utils/type-roles.js +7 -0
- package/package.json +9 -1
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
InlineSelector
|
|
4
|
+
} from "./chunk-Z2SS7UJ4.js";
|
|
5
|
+
import {
|
|
6
|
+
AssetIcon
|
|
7
|
+
} from "./chunk-2REWXJEN.js";
|
|
8
|
+
import {
|
|
9
|
+
iconBadgeOverlayClass
|
|
10
|
+
} from "./chunk-CZPNI33A.js";
|
|
11
|
+
import {
|
|
12
|
+
ScrollArea
|
|
13
|
+
} from "./chunk-DCUAE6PX.js";
|
|
14
|
+
import {
|
|
15
|
+
NetworkBadge
|
|
16
|
+
} from "./chunk-IV6AAVUE.js";
|
|
17
|
+
import {
|
|
18
|
+
eyebrow
|
|
19
|
+
} from "./chunk-MTQOAMDW.js";
|
|
20
|
+
import {
|
|
21
|
+
IconGlyph
|
|
22
|
+
} from "./chunk-YQQ7GDLZ.js";
|
|
23
|
+
import {
|
|
24
|
+
Check,
|
|
25
|
+
ExpandMore,
|
|
26
|
+
Hub,
|
|
27
|
+
Search
|
|
28
|
+
} from "./chunk-XXH4TYKZ.js";
|
|
29
|
+
import {
|
|
30
|
+
cn
|
|
31
|
+
} from "./chunk-PMGIJMRO.js";
|
|
32
|
+
|
|
33
|
+
// src/web/components/asset-selector.tsx
|
|
34
|
+
import { useState } from "react";
|
|
35
|
+
import { createPortal } from "react-dom";
|
|
36
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
function NetworkMiniBadge({ iconUrl, label }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("span", { className: cn(iconBadgeOverlayClass, "overflow-hidden bg-card"), children: iconUrl ? /* @__PURE__ */ jsx("img", { src: iconUrl, alt: label ?? "", className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsx("span", { className: cn("flex h-full w-full items-center justify-center bg-muted leading-none text-muted-foreground", eyebrow), children: label?.charAt(0) }) });
|
|
39
|
+
}
|
|
40
|
+
function readableTagColor(color) {
|
|
41
|
+
const raw = color.replace("#", "");
|
|
42
|
+
const hex = raw.length === 3 ? raw.split("").map((char) => char + char).join("") : raw;
|
|
43
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex)) return color;
|
|
44
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
45
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
46
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
47
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
48
|
+
return luminance < 0.45 ? `color-mix(in srgb, ${color} 45%, white)` : color;
|
|
49
|
+
}
|
|
50
|
+
var chipBaseClass = cn("shrink-0 rounded-full transition-all duration-200", eyebrow);
|
|
51
|
+
var chipActiveClass = "bg-primary bg-gradient-primary text-primary-foreground shadow-button-primary";
|
|
52
|
+
var chipIdleClass = "bg-surface-card text-text-dimmed shadow-raised hover-gradient-violet hover:text-secondary-content";
|
|
53
|
+
function AssetSelectorNetworkMark({ network }) {
|
|
54
|
+
return network.iconUrl ? /* @__PURE__ */ jsx("img", { src: network.iconUrl, alt: "", className: "size-4 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx("span", { className: cn("flex size-4 shrink-0 items-center justify-center rounded-full bg-muted leading-none text-muted-foreground", eyebrow), children: network.label.charAt(0) });
|
|
55
|
+
}
|
|
56
|
+
var NETWORK_STACK_VISIBLE = 3;
|
|
57
|
+
function AssetSelectorNetworkFilterTrigger({
|
|
58
|
+
activeNetworkOption,
|
|
59
|
+
networks,
|
|
60
|
+
open,
|
|
61
|
+
onClick
|
|
62
|
+
}) {
|
|
63
|
+
const visibleNetworks = networks.slice(0, NETWORK_STACK_VISIBLE);
|
|
64
|
+
const overflowCount = networks.length - visibleNetworks.length;
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick,
|
|
70
|
+
"aria-label": activeNetworkOption ? void 0 : "All networks",
|
|
71
|
+
className: cn(
|
|
72
|
+
chipBaseClass,
|
|
73
|
+
"flex items-center gap-1.5 py-1 pl-1.5 pr-2.5",
|
|
74
|
+
activeNetworkOption || open ? chipActiveClass : chipIdleClass
|
|
75
|
+
),
|
|
76
|
+
children: [
|
|
77
|
+
activeNetworkOption ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ jsx(AssetSelectorNetworkMark, { network: activeNetworkOption }),
|
|
79
|
+
activeNetworkOption.label
|
|
80
|
+
] }) : /* @__PURE__ */ jsxs("span", { className: "flex items-center -space-x-1.5", "aria-hidden": "true", children: [
|
|
81
|
+
visibleNetworks.map((network) => /* @__PURE__ */ jsx("span", { className: "rounded-full ring-2 ring-card", children: /* @__PURE__ */ jsx(AssetSelectorNetworkMark, { network }) }, network.id)),
|
|
82
|
+
overflowCount > 0 && /* @__PURE__ */ jsxs("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-xxs font-bold leading-none text-muted-foreground ring-2 ring-card", children: [
|
|
83
|
+
"+",
|
|
84
|
+
overflowCount
|
|
85
|
+
] })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
IconGlyph,
|
|
89
|
+
{
|
|
90
|
+
glyph: ExpandMore,
|
|
91
|
+
size: "xs",
|
|
92
|
+
className: cn("shrink-0 transition-transform duration-200", open && "rotate-180")
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function AssetSelector({
|
|
100
|
+
label,
|
|
101
|
+
selectedTicker,
|
|
102
|
+
selectedId,
|
|
103
|
+
options,
|
|
104
|
+
categories = [],
|
|
105
|
+
defaultActiveCategories,
|
|
106
|
+
networks = [],
|
|
107
|
+
quickAssets = [],
|
|
108
|
+
networkFilter,
|
|
109
|
+
venueFilter,
|
|
110
|
+
disabled,
|
|
111
|
+
disabledTicker,
|
|
112
|
+
disabledId,
|
|
113
|
+
compact,
|
|
114
|
+
onOpenPanelHeightChange,
|
|
115
|
+
onChange
|
|
116
|
+
}) {
|
|
117
|
+
const [open, setOpen] = useState(false);
|
|
118
|
+
const [search, setSearch] = useState("");
|
|
119
|
+
const [activeCategories, setActiveCategories] = useState(
|
|
120
|
+
defaultActiveCategories ?? categories.map((category) => category.id)
|
|
121
|
+
);
|
|
122
|
+
const [activeNetwork, setActiveNetwork] = useState(null);
|
|
123
|
+
const [networkMenuOpen, setNetworkMenuOpen] = useState(false);
|
|
124
|
+
const [activeQuickAsset, setActiveQuickAsset] = useState(null);
|
|
125
|
+
const selectedKey = selectedId ?? selectedTicker;
|
|
126
|
+
const selected = options.find((option) => option.id === selectedKey) ?? options.find((option) => option.ticker === selectedTicker);
|
|
127
|
+
const selectedOptionId = selected?.id ?? selectedKey;
|
|
128
|
+
const hasCategoryFilters = categories.length > 0;
|
|
129
|
+
const hasNetworkFilter = networks.length > 0;
|
|
130
|
+
const hasQuickAssets = quickAssets.length > 0;
|
|
131
|
+
const activeNetworkOption = networks.find((network) => network.id === activeNetwork) ?? null;
|
|
132
|
+
const filtered = options.filter((option) => {
|
|
133
|
+
const category = option.category ?? null;
|
|
134
|
+
const matchesCategory = !hasCategoryFilters || category === null || activeCategories.includes(category);
|
|
135
|
+
const matchesNetwork = !networkFilter || option.network === networkFilter;
|
|
136
|
+
const matchesNetworkFilter = !activeNetwork || option.networkId == null || option.networkId === activeNetwork;
|
|
137
|
+
const matchesQuickAsset = !activeQuickAsset || option.ticker.toUpperCase() === activeQuickAsset;
|
|
138
|
+
const matchesVenue = !venueFilter || option.venue === venueFilter;
|
|
139
|
+
if (!matchesCategory || !matchesNetwork || !matchesNetworkFilter || !matchesQuickAsset || !matchesVenue)
|
|
140
|
+
return false;
|
|
141
|
+
if (!search) return true;
|
|
142
|
+
const searchValue = search.toLowerCase();
|
|
143
|
+
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.networkTag?.label.toLowerCase().includes(searchValue) ?? false) || (option.category?.toLowerCase().includes(searchValue) ?? false);
|
|
144
|
+
return matchesSearch;
|
|
145
|
+
}).sort((a, b) => {
|
|
146
|
+
if (a.id === selectedOptionId) return -1;
|
|
147
|
+
if (b.id === selectedOptionId) return 1;
|
|
148
|
+
return a.ticker.localeCompare(b.ticker);
|
|
149
|
+
});
|
|
150
|
+
const inlineOptions = filtered.map((option) => ({
|
|
151
|
+
...option,
|
|
152
|
+
id: option.id,
|
|
153
|
+
label: option.ticker,
|
|
154
|
+
disabled: option.id === disabledId || option.ticker === disabledTicker
|
|
155
|
+
}));
|
|
156
|
+
const categoryLabelById = new Map(categories.map((category) => [category.id, category.label]));
|
|
157
|
+
const networkFilterButton = hasNetworkFilter && /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
AssetSelectorNetworkFilterTrigger,
|
|
160
|
+
{
|
|
161
|
+
activeNetworkOption,
|
|
162
|
+
networks,
|
|
163
|
+
open: networkMenuOpen,
|
|
164
|
+
onClick: () => setNetworkMenuOpen((value) => !value)
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
networkMenuOpen && /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-full z-10 mt-1.5 w-48 overflow-hidden rounded-xl bg-popover shadow-popover", children: /* @__PURE__ */ jsxs(ScrollArea, { viewportClassName: "max-h-60 p-1", children: [
|
|
168
|
+
/* @__PURE__ */ jsxs(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
type: "button",
|
|
172
|
+
onClick: () => {
|
|
173
|
+
setActiveNetwork(null);
|
|
174
|
+
setNetworkMenuOpen(false);
|
|
175
|
+
},
|
|
176
|
+
className: cn(
|
|
177
|
+
"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-caption font-semibold transition-colors",
|
|
178
|
+
activeNetwork === null ? "bg-secondary/15 text-secondary-content" : "text-foreground/75 hover-gradient-violet hover:text-foreground"
|
|
179
|
+
),
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: Hub, size: "xs", className: "shrink-0" }),
|
|
182
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left", children: "All networks" }),
|
|
183
|
+
activeNetwork === null && /* @__PURE__ */ jsx(IconGlyph, { glyph: Check, size: "xs", className: "shrink-0 text-secondary-content" })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
networks.map((network) => {
|
|
188
|
+
const isActive = activeNetwork === network.id;
|
|
189
|
+
return /* @__PURE__ */ jsxs(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
onClick: () => {
|
|
194
|
+
setActiveNetwork(network.id);
|
|
195
|
+
setNetworkMenuOpen(false);
|
|
196
|
+
},
|
|
197
|
+
className: cn(
|
|
198
|
+
"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-caption font-semibold transition-colors",
|
|
199
|
+
isActive ? "bg-secondary/15 text-secondary-content" : "text-foreground/75 hover-gradient-violet hover:text-foreground"
|
|
200
|
+
),
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx(AssetSelectorNetworkMark, { network }),
|
|
203
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left", children: network.label }),
|
|
204
|
+
isActive && /* @__PURE__ */ jsx(IconGlyph, { glyph: Check, size: "xs", className: "shrink-0 text-secondary-content" })
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
network.id
|
|
208
|
+
);
|
|
209
|
+
})
|
|
210
|
+
] }) })
|
|
211
|
+
] });
|
|
212
|
+
const filterControls = (hasQuickAssets || hasCategoryFilters) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
213
|
+
hasQuickAssets && /* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: quickAssets.map((quick) => {
|
|
214
|
+
const tickerKey = quick.ticker.toUpperCase();
|
|
215
|
+
const isActive = activeQuickAsset === tickerKey;
|
|
216
|
+
return /* @__PURE__ */ jsxs(
|
|
217
|
+
"button",
|
|
218
|
+
{
|
|
219
|
+
type: "button",
|
|
220
|
+
onClick: () => setActiveQuickAsset(isActive ? null : tickerKey),
|
|
221
|
+
className: cn(
|
|
222
|
+
chipBaseClass,
|
|
223
|
+
"flex items-center gap-1.5 py-1 pl-1.5 pr-2.5",
|
|
224
|
+
isActive ? chipActiveClass : chipIdleClass
|
|
225
|
+
),
|
|
226
|
+
children: [
|
|
227
|
+
quick.iconUrl ? /* @__PURE__ */ jsx("img", { src: quick.iconUrl, alt: "", className: "size-4 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx(AssetIcon, { ticker: quick.ticker, size: 16, className: "shrink-0" }),
|
|
228
|
+
quick.ticker
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
tickerKey
|
|
232
|
+
);
|
|
233
|
+
}) }),
|
|
234
|
+
hasCategoryFilters && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
type: "button",
|
|
239
|
+
onClick: () => setActiveCategories(categories.map((category) => category.id)),
|
|
240
|
+
className: cn(
|
|
241
|
+
chipBaseClass,
|
|
242
|
+
"px-2.5 py-1",
|
|
243
|
+
activeCategories.length === categories.length ? chipActiveClass : chipIdleClass
|
|
244
|
+
),
|
|
245
|
+
children: "All"
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
categories.map((category) => {
|
|
249
|
+
const isActive = activeCategories.includes(category.id);
|
|
250
|
+
return /* @__PURE__ */ jsx(
|
|
251
|
+
"button",
|
|
252
|
+
{
|
|
253
|
+
type: "button",
|
|
254
|
+
onClick: () => setActiveCategories(
|
|
255
|
+
(current) => current.includes(category.id) ? current.filter((value) => value !== category.id) : [...current, category.id]
|
|
256
|
+
),
|
|
257
|
+
className: cn(
|
|
258
|
+
chipBaseClass,
|
|
259
|
+
"px-2.5 py-1",
|
|
260
|
+
isActive ? chipActiveClass : chipIdleClass
|
|
261
|
+
),
|
|
262
|
+
children: category.label
|
|
263
|
+
},
|
|
264
|
+
category.id
|
|
265
|
+
);
|
|
266
|
+
})
|
|
267
|
+
] })
|
|
268
|
+
] });
|
|
269
|
+
const renderAssetOption = (option, optionSelected, optionDisabled) => {
|
|
270
|
+
const optionCategoryLabel = option.categoryLabel || (option.category ? categoryLabelById.get(option.category) : void 0);
|
|
271
|
+
const hasNetworkBadge = Boolean(option.networkIconUrl || option.networkTag);
|
|
272
|
+
return /* @__PURE__ */ jsxs("span", { className: "group flex w-full items-center gap-3 text-body", children: [
|
|
273
|
+
/* @__PURE__ */ jsxs("span", { className: "relative shrink-0", children: [
|
|
274
|
+
/* @__PURE__ */ jsx(
|
|
275
|
+
AssetIcon,
|
|
276
|
+
{
|
|
277
|
+
ticker: option.ticker,
|
|
278
|
+
logoUri: option.icon,
|
|
279
|
+
size: 38,
|
|
280
|
+
className: cn(
|
|
281
|
+
"shrink-0 transition-transform duration-200",
|
|
282
|
+
!optionDisabled && "group-hover:scale-[1.04]"
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
hasNetworkBadge && /* @__PURE__ */ jsx(
|
|
287
|
+
NetworkMiniBadge,
|
|
288
|
+
{
|
|
289
|
+
iconUrl: option.networkIconUrl,
|
|
290
|
+
label: option.networkTag?.label
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-3 text-left", children: [
|
|
295
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex flex-col leading-tight", children: /* @__PURE__ */ jsx(
|
|
296
|
+
"span",
|
|
297
|
+
{
|
|
298
|
+
className: "max-w-full truncate text-body font-bold tracking-wide text-foreground",
|
|
299
|
+
title: option.name ?? option.ticker,
|
|
300
|
+
children: option.name ?? option.ticker
|
|
301
|
+
}
|
|
302
|
+
) }),
|
|
303
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [
|
|
304
|
+
optionSelected ? /* @__PURE__ */ jsx("span", { className: cn("rounded-full bg-primary bg-gradient-primary px-2 py-0.5 text-primary-foreground shadow-button-primary", eyebrow), children: "Current" }) : option.networkTag ? /* @__PURE__ */ jsx(
|
|
305
|
+
"span",
|
|
306
|
+
{
|
|
307
|
+
className: cn(
|
|
308
|
+
"rounded-full px-2 py-0.5",
|
|
309
|
+
eyebrow,
|
|
310
|
+
!option.networkTag.color && "bg-secondary/15 text-secondary-content"
|
|
311
|
+
),
|
|
312
|
+
style: option.networkTag.color ? {
|
|
313
|
+
backgroundColor: `color-mix(in srgb, ${option.networkTag.color} 15%, transparent)`,
|
|
314
|
+
color: readableTagColor(option.networkTag.color)
|
|
315
|
+
} : void 0,
|
|
316
|
+
children: option.networkTag.label
|
|
317
|
+
}
|
|
318
|
+
) : optionCategoryLabel && /* @__PURE__ */ jsx("span", { className: cn("rounded-full bg-secondary/15 px-2 py-0.5 text-muted-foreground", eyebrow), children: optionCategoryLabel }),
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
"span",
|
|
321
|
+
{
|
|
322
|
+
className: cn(
|
|
323
|
+
"max-w-24 truncate",
|
|
324
|
+
option.networkTag ? "text-caption text-muted-foreground" : cn(eyebrow, "text-muted-foreground")
|
|
325
|
+
),
|
|
326
|
+
title: optionDisabled ? "In use" : option.ticker,
|
|
327
|
+
children: optionDisabled ? "In use" : option.ticker
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] })
|
|
331
|
+
] })
|
|
332
|
+
] });
|
|
333
|
+
};
|
|
334
|
+
if (compact) {
|
|
335
|
+
const closePanel = () => {
|
|
336
|
+
setOpen(false);
|
|
337
|
+
setSearch("");
|
|
338
|
+
setNetworkMenuOpen(false);
|
|
339
|
+
};
|
|
340
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative w-36 flex-shrink-0", children: [
|
|
341
|
+
/* @__PURE__ */ jsx(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
type: "button",
|
|
345
|
+
disabled,
|
|
346
|
+
onClick: () => !disabled && setOpen((value) => !value),
|
|
347
|
+
className: cn(
|
|
348
|
+
"group flex w-full items-center gap-3 rounded-full px-3 py-2 text-left transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50",
|
|
349
|
+
open ? "bg-gradient-active ring-1 ring-inset ring-primary/40" : "bg-foreground/5 shadow-raised hover-gradient-violet"
|
|
350
|
+
),
|
|
351
|
+
children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
352
|
+
/* @__PURE__ */ jsxs("span", { className: "relative shrink-0", children: [
|
|
353
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 38 }),
|
|
354
|
+
selected.networkIconUrl || selected.networkTag ? /* @__PURE__ */ jsx(
|
|
355
|
+
NetworkMiniBadge,
|
|
356
|
+
{
|
|
357
|
+
iconUrl: selected.networkIconUrl,
|
|
358
|
+
label: selected.networkTag?.label
|
|
359
|
+
}
|
|
360
|
+
) : selected.network && /* @__PURE__ */ jsx(
|
|
361
|
+
NetworkBadge,
|
|
362
|
+
{
|
|
363
|
+
network: selected.network,
|
|
364
|
+
size: "sm",
|
|
365
|
+
className: "absolute -bottom-2 -right-2"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 text-left", children: /* @__PURE__ */ jsx("span", { className: "block truncate text-title font-bold leading-tight text-foreground", children: selected.ticker }) })
|
|
370
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "px-1 py-1 text-caption font-semibold text-foreground/55", children: "Select..." })
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
open && typeof document !== "undefined" && createPortal(
|
|
374
|
+
/* @__PURE__ */ jsx(
|
|
375
|
+
"div",
|
|
376
|
+
{
|
|
377
|
+
className: "fixed inset-0 z-[var(--z-modal)] flex items-end justify-center bg-black/70 backdrop-blur-sm duration-200 animate-in fade-in sm:items-center sm:p-4",
|
|
378
|
+
onClick: closePanel,
|
|
379
|
+
children: /* @__PURE__ */ jsxs(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
className: "flex max-h-[85vh] w-full max-w-[26rem] flex-col overflow-hidden rounded-t-2xl bg-popover bg-gradient-card-hero shadow-popover duration-300 animate-in slide-in-from-bottom-8 sm:max-h-[80vh] sm:rounded-2xl sm:slide-in-from-bottom-0 sm:zoom-in-95",
|
|
383
|
+
onClick: (event) => event.stopPropagation(),
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 bg-secondary/5 px-4 py-3.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
386
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
387
|
+
/* @__PURE__ */ jsxs("p", { className: "text-mini font-medium uppercase tracking-eyebrow-wide text-muted-foreground", children: [
|
|
388
|
+
label,
|
|
389
|
+
" Asset"
|
|
390
|
+
] }),
|
|
391
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-body font-semibold text-foreground/90", children: [
|
|
392
|
+
filtered.length,
|
|
393
|
+
" option",
|
|
394
|
+
filtered.length === 1 ? "" : "s",
|
|
395
|
+
" available"
|
|
396
|
+
] })
|
|
397
|
+
] }),
|
|
398
|
+
networkFilterButton || selected && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-full bg-secondary/15 px-2.5 py-1 shadow-raised", children: [
|
|
399
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 18 }),
|
|
400
|
+
/* @__PURE__ */ jsx("span", { className: "text-tiny font-semibold text-foreground", children: selected.ticker })
|
|
401
|
+
] })
|
|
402
|
+
] }) }),
|
|
403
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 px-4 py-3", children: [
|
|
404
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
405
|
+
/* @__PURE__ */ jsx(
|
|
406
|
+
IconGlyph,
|
|
407
|
+
{
|
|
408
|
+
glyph: Search,
|
|
409
|
+
size: "sm",
|
|
410
|
+
className: "absolute left-3.5 top-1/2 -translate-y-1/2 text-foreground/55"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ jsx(
|
|
414
|
+
"input",
|
|
415
|
+
{
|
|
416
|
+
autoFocus: true,
|
|
417
|
+
type: "text",
|
|
418
|
+
value: search,
|
|
419
|
+
onChange: (event) => setSearch(event.target.value),
|
|
420
|
+
placeholder: "Search...",
|
|
421
|
+
className: "h-11 w-full rounded-2xl bg-foreground/[0.06] ring-1 ring-inset ring-border hover:ring-secondary/40 pl-10 pr-3 text-caption text-foreground shadow-inner transition-all placeholder:text-muted-foreground focus:ring-primary/50 focus:shadow-glow-primary-soft focus:outline-none"
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] }),
|
|
425
|
+
filterControls
|
|
426
|
+
] }),
|
|
427
|
+
/* @__PURE__ */ jsx("div", { className: "mx-4 h-px bg-border" }),
|
|
428
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "min-h-0 flex-1", viewportClassName: "max-h-[56vh] px-2 py-2 pb-6", children: filtered.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 px-4 py-10 text-center text-caption text-foreground/55", children: [
|
|
429
|
+
/* @__PURE__ */ jsx(IconGlyph, { glyph: Search, size: "md", className: "opacity-40" }),
|
|
430
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
431
|
+
"No assets match ",
|
|
432
|
+
search ? `"${search}"` : "the active filters"
|
|
433
|
+
] })
|
|
434
|
+
] }) : filtered.map((option) => {
|
|
435
|
+
const optionKey = option.id;
|
|
436
|
+
const optionSelected = optionKey === selectedOptionId;
|
|
437
|
+
const optionDisabled = option.id === disabledId || option.ticker === disabledTicker;
|
|
438
|
+
return /* @__PURE__ */ jsx(
|
|
439
|
+
"button",
|
|
440
|
+
{
|
|
441
|
+
type: "button",
|
|
442
|
+
disabled: optionDisabled,
|
|
443
|
+
onClick: () => {
|
|
444
|
+
if (optionDisabled) return;
|
|
445
|
+
onChange(optionKey);
|
|
446
|
+
closePanel();
|
|
447
|
+
},
|
|
448
|
+
className: cn(
|
|
449
|
+
"group flex w-full items-center gap-3 rounded-2xl border px-3 py-3 text-body transition-all duration-200",
|
|
450
|
+
optionSelected ? "border-transparent bg-gradient-active ring-1 ring-inset ring-primary/40" : optionDisabled ? "cursor-not-allowed border-transparent bg-foreground/[0.015] opacity-45" : "border-transparent bg-transparent hover-gradient-violet"
|
|
451
|
+
),
|
|
452
|
+
children: renderAssetOption(option, optionSelected, optionDisabled)
|
|
453
|
+
},
|
|
454
|
+
optionKey
|
|
455
|
+
);
|
|
456
|
+
}) })
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
document.body
|
|
463
|
+
)
|
|
464
|
+
] });
|
|
465
|
+
}
|
|
466
|
+
return /* @__PURE__ */ jsx(
|
|
467
|
+
InlineSelector,
|
|
468
|
+
{
|
|
469
|
+
label,
|
|
470
|
+
value: selectedOptionId,
|
|
471
|
+
options: inlineOptions,
|
|
472
|
+
onChange: (ticker) => {
|
|
473
|
+
onChange(ticker);
|
|
474
|
+
setSearch("");
|
|
475
|
+
},
|
|
476
|
+
disabled,
|
|
477
|
+
className: "space-y-1.5",
|
|
478
|
+
panelClassName: "bg-popover bg-gradient-card-hero p-0 shadow-popover",
|
|
479
|
+
optionClassName: "mx-1.5 px-3 py-3",
|
|
480
|
+
onOpenPanelHeightChange,
|
|
481
|
+
renderTrigger: ({ open: open2 }) => /* @__PURE__ */ jsxs("span", { className: "block", children: [
|
|
482
|
+
/* @__PURE__ */ jsx("span", { className: cn("mb-1.5 ml-1 block text-muted-foreground", eyebrow), children: label }),
|
|
483
|
+
/* @__PURE__ */ jsxs("span", { className: "flex w-full items-center justify-between rounded-2xl bg-card/55 backdrop-blur-xl backdrop-saturate-150 bg-gradient-card px-4 py-3 text-left shadow-card transition-all duration-200 hover:shadow-card-hover", children: [
|
|
484
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center gap-3", children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
485
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 32 }),
|
|
486
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
487
|
+
/* @__PURE__ */ jsx("span", { className: "text-body font-semibold text-foreground", children: selected.ticker }),
|
|
488
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-caption text-foreground/55", children: selected.name })
|
|
489
|
+
] })
|
|
490
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "text-caption text-foreground/55", children: "Select asset..." }) }),
|
|
491
|
+
/* @__PURE__ */ jsx(
|
|
492
|
+
IconGlyph,
|
|
493
|
+
{
|
|
494
|
+
glyph: ExpandMore,
|
|
495
|
+
size: "sm",
|
|
496
|
+
className: cn(
|
|
497
|
+
"ml-2 flex-shrink-0 text-foreground/55 transition-transform duration-200",
|
|
498
|
+
open2 && "rotate-180"
|
|
499
|
+
)
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] })
|
|
503
|
+
] }),
|
|
504
|
+
renderPanelHeader: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
505
|
+
/* @__PURE__ */ jsx("div", { className: "bg-secondary/5 px-4 py-3.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
506
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
507
|
+
/* @__PURE__ */ jsxs("p", { className: "text-mini font-medium uppercase tracking-eyebrow-wide text-muted-foreground", children: [
|
|
508
|
+
label,
|
|
509
|
+
" Asset"
|
|
510
|
+
] }),
|
|
511
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-body font-semibold text-foreground/90", children: [
|
|
512
|
+
filtered.length,
|
|
513
|
+
" option",
|
|
514
|
+
filtered.length === 1 ? "" : "s",
|
|
515
|
+
" available"
|
|
516
|
+
] })
|
|
517
|
+
] }),
|
|
518
|
+
networkFilterButton || selected && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-full bg-secondary/15 px-2.5 py-1 shadow-raised", children: [
|
|
519
|
+
/* @__PURE__ */ jsx(AssetIcon, { ticker: selected.ticker, logoUri: selected.icon, size: 18 }),
|
|
520
|
+
/* @__PURE__ */ jsx("span", { className: "text-tiny font-semibold text-foreground", children: selected.ticker })
|
|
521
|
+
] })
|
|
522
|
+
] }) }),
|
|
523
|
+
/* @__PURE__ */ jsxs("div", { className: "px-4 py-3", children: [
|
|
524
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
525
|
+
/* @__PURE__ */ jsx(
|
|
526
|
+
IconGlyph,
|
|
527
|
+
{
|
|
528
|
+
glyph: Search,
|
|
529
|
+
size: "sm",
|
|
530
|
+
className: "absolute left-3.5 top-1/2 -translate-y-1/2 text-foreground/55"
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
/* @__PURE__ */ jsx(
|
|
534
|
+
"input",
|
|
535
|
+
{
|
|
536
|
+
autoFocus: true,
|
|
537
|
+
type: "text",
|
|
538
|
+
value: search,
|
|
539
|
+
onChange: (event) => setSearch(event.target.value),
|
|
540
|
+
placeholder: "Search...",
|
|
541
|
+
className: "h-11 w-full rounded-2xl bg-foreground/[0.06] ring-1 ring-inset ring-border hover:ring-secondary/40 pl-10 pr-3 text-caption text-foreground shadow-inner transition-all placeholder:text-muted-foreground focus:ring-primary/50 focus:shadow-glow-primary-soft focus:outline-none"
|
|
542
|
+
}
|
|
543
|
+
)
|
|
544
|
+
] }),
|
|
545
|
+
filterControls
|
|
546
|
+
] })
|
|
547
|
+
] }),
|
|
548
|
+
renderOption: ({ option, selected: optionSelected, disabled: optionDisabled }) => {
|
|
549
|
+
return renderAssetOption(option, optionSelected, optionDisabled);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export {
|
|
556
|
+
AssetSelectorNetworkFilterTrigger,
|
|
557
|
+
AssetSelector
|
|
558
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-PMGIJMRO.js";
|
|
5
|
+
|
|
6
|
+
// src/web/primitives/switch.tsx
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var Switch = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
checked = false,
|
|
12
|
+
onCheckedChange,
|
|
13
|
+
disabled = false,
|
|
14
|
+
className,
|
|
15
|
+
icons,
|
|
16
|
+
id,
|
|
17
|
+
title,
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
"aria-labelledby": ariaLabelledBy,
|
|
20
|
+
"aria-describedby": ariaDescribedBy,
|
|
21
|
+
"data-slot": dataSlot = "switch",
|
|
22
|
+
"data-mode": dataMode
|
|
23
|
+
}, ref) => {
|
|
24
|
+
const glyph = (on) => cn(
|
|
25
|
+
"relative z-10 flex size-7 items-center justify-center transition-colors duration-300",
|
|
26
|
+
checked === on ? "text-brand" : "text-muted-foreground group-hover:text-foreground/80"
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
id,
|
|
33
|
+
type: "button",
|
|
34
|
+
role: "switch",
|
|
35
|
+
"aria-checked": checked,
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-labelledby": ariaLabelledBy,
|
|
38
|
+
"aria-describedby": ariaDescribedBy,
|
|
39
|
+
title,
|
|
40
|
+
"data-slot": dataSlot,
|
|
41
|
+
"data-mode": dataMode,
|
|
42
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
43
|
+
disabled,
|
|
44
|
+
onClick: () => onCheckedChange?.(!checked),
|
|
45
|
+
className: cn(
|
|
46
|
+
// The base: an inset track and a raised card thumb. Only the off track
|
|
47
|
+
// is ringed in violet: on light it would otherwise have no edge.
|
|
48
|
+
"group relative inline-flex shrink-0 cursor-pointer items-center rounded-full p-1 shadow-inner transition-all duration-300",
|
|
49
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:shadow-glow-primary-soft",
|
|
50
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
51
|
+
// The wide track is 18 steps: p-1 + two size-7 glyphs + p-1 leaves 2 between
|
|
52
|
+
// them, so the thumb's 9-step slide lands exactly on the second glyph.
|
|
53
|
+
icons ? "h-9 w-18" : "h-6 w-11",
|
|
54
|
+
!icons && checked ? "bg-primary bg-gradient-primary" : "bg-foreground/8 ring-1 ring-inset ring-secondary/20",
|
|
55
|
+
className
|
|
56
|
+
),
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
className: cn(
|
|
63
|
+
"pointer-events-none absolute left-1 top-1 rounded-full shadow-raised transition-transform duration-300 ease-out motion-reduce:transition-none",
|
|
64
|
+
icons ? "size-7" : "size-4",
|
|
65
|
+
// Compact and off, a card thumb would vanish into the track.
|
|
66
|
+
!icons && !checked ? "bg-secondary-content" : "bg-card bg-gradient-card",
|
|
67
|
+
checked && (icons ? "translate-x-9" : "translate-x-5")
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
icons && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: glyph(false), children: icons.off }),
|
|
73
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(glyph(true), "ml-auto"), children: icons.on })
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
Switch.displayName = "Switch";
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
Switch
|
|
84
|
+
};
|