@rash2x/bridge-widget 0.6.58 → 0.6.61

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.
@@ -16,8 +16,8 @@ import { cn as cn$2 } from "@/lib/utils";
16
16
  import { Skeleton } from "@/components/ui/skeleton";
17
17
  import { Input } from "@/components/ui/input";
18
18
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui/dialog";
19
+ import { XIcon, X as X$3, Loader2, AlertCircleIcon, ArrowRight, CheckCircle2, Clock } from "lucide-react";
19
20
  import { Switch } from "@/components/ui/switch";
20
- import { X as X$3, Loader2, AlertCircleIcon, ArrowRight, CheckCircle2, Clock } from "lucide-react";
21
21
  import { AnimatePresence, motion } from "framer-motion";
22
22
  import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@/components/ui/accordion";
23
23
  import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
@@ -2038,12 +2038,20 @@ const SearchInput = ({
2038
2038
  placeholder,
2039
2039
  className: cn$2(
2040
2040
  "w-full outline-none px-5 py-4 relative pl-16 bg-input border transition-all border-transparent rounded-xs ring-0 leading-0 h-13 text-base focus-visible:border focus-visible:border-ring",
2041
+ value && "pr-16",
2041
2042
  className
2042
2043
  ),
2043
2044
  value,
2044
2045
  onChange: (e2) => onChange(e2.target.value)
2045
2046
  }
2046
- )
2047
+ ),
2048
+ value && /* @__PURE__ */ jsx("div", { className: "absolute z-10 right-4 top-0 bottom-0 my-auto h-5 w-5 bg-accent flex items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(
2049
+ XIcon,
2050
+ {
2051
+ className: "w-4 h-4 text-foreground cursor-pointer hover:opacity-70 transition-opacity",
2052
+ onClick: () => onChange("")
2053
+ }
2054
+ ) })
2047
2055
  ] });
2048
2056
  };
2049
2057
  const ChainSelectModal = ({
@@ -2193,49 +2201,58 @@ const ChainSelectModal = ({
2193
2201
  chain2.chainKey
2194
2202
  );
2195
2203
  };
2196
- return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] fixed top-0 left-0 right-0 bottom-0 translate-x-0 translate-y-0 md:left-[50%] md:top-[50%] md:translate-x-[-50%] md:translate-y-[-50%] overflow-hidden flex flex-col p-10 pt-7 rounded-none md:rounded-lg", children: [
2197
- /* @__PURE__ */ jsx(DialogHeader, { className: "text-left pb-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl leading-8", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0", children: [
2198
- /* @__PURE__ */ jsx("div", { children: t2("bridge.select") }),
2199
- /* @__PURE__ */ jsx("div", { children: t2(isSource ? "bridge.sourceNetwork" : "bridge.destinationNetwork") })
2200
- ] }) }) }),
2201
- /* @__PURE__ */ jsx(
2202
- SearchInput,
2203
- {
2204
- placeholder: t2("bridge.search"),
2205
- value: query,
2206
- onChange: setQuery,
2207
- className: "text-foreground placeholder:text-muted-foreground"
2208
- }
2209
- ),
2210
- /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30", children: [
2211
- groupedChains.available.length > 0 && groupedChains.available.map((c2) => renderChainItem(c2, false)),
2212
- groupedChains.willChangeSrc.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
2213
- /* @__PURE__ */ jsx(
2214
- "p",
2215
- {
2216
- className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 ? "mt-10" : ""}`,
2217
- children: t2("bridge.willChangeSourceChain")
2218
- }
2219
- ),
2220
- groupedChains.willChangeSrc.map(
2221
- (c2) => renderChainItem(c2, true, false)
2222
- )
2223
- ] }),
2224
- groupedChains.willChangeTokenAndSrc.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
2204
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxs(
2205
+ DialogContent,
2206
+ {
2207
+ className: "md:max-h-[90dvh] md:h-[90dvh] fixed top-0 left-0 right-0 bottom-0 translate-x-0 translate-y-0 md:left-[50%] md:top-[50%] md:translate-x-[-50%] md:translate-y-[-50%] overflow-hidden flex flex-col p-6 md:p-10 md:pt-8 rounded-none md:rounded-lg",
2208
+ closeButtonClassName: "right-6 md:right-10",
2209
+ children: [
2210
+ /* @__PURE__ */ jsx(DialogHeader, { className: "text-left pb-2", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl leading-8", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0", children: [
2211
+ /* @__PURE__ */ jsx("div", { children: t2("bridge.select") }),
2212
+ /* @__PURE__ */ jsx("div", { children: t2(
2213
+ isSource ? "bridge.sourceNetwork" : "bridge.destinationNetwork"
2214
+ ) })
2215
+ ] }) }) }),
2225
2216
  /* @__PURE__ */ jsx(
2226
- "p",
2217
+ SearchInput,
2227
2218
  {
2228
- className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 || groupedChains.willChangeSrc.length > 0 ? "mt-10" : ""}`,
2229
- children: t2("bridge.willChangeSourceNetworkAndToken")
2219
+ placeholder: t2("bridge.search"),
2220
+ value: query,
2221
+ onChange: setQuery,
2222
+ className: "text-foreground placeholder:text-muted-foreground"
2230
2223
  }
2231
2224
  ),
2232
- groupedChains.willChangeTokenAndSrc.map(
2233
- (c2) => renderChainItem(c2, false, true)
2234
- )
2235
- ] }),
2236
- groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.chainNotFound") })
2237
- ] })
2238
- ] }) });
2225
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30", children: [
2226
+ groupedChains.available.length > 0 && groupedChains.available.map((c2) => renderChainItem(c2, false)),
2227
+ groupedChains.willChangeSrc.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
2228
+ /* @__PURE__ */ jsx(
2229
+ "p",
2230
+ {
2231
+ className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 ? "mt-10" : ""}`,
2232
+ children: t2("bridge.willChangeSourceChain")
2233
+ }
2234
+ ),
2235
+ groupedChains.willChangeSrc.map(
2236
+ (c2) => renderChainItem(c2, true, false)
2237
+ )
2238
+ ] }),
2239
+ groupedChains.willChangeTokenAndSrc.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
2240
+ /* @__PURE__ */ jsx(
2241
+ "p",
2242
+ {
2243
+ className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 || groupedChains.willChangeSrc.length > 0 ? "mt-10" : ""}`,
2244
+ children: t2("bridge.willChangeSourceNetworkAndToken")
2245
+ }
2246
+ ),
2247
+ groupedChains.willChangeTokenAndSrc.map(
2248
+ (c2) => renderChainItem(c2, false, true)
2249
+ )
2250
+ ] }),
2251
+ groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.chainNotFound") })
2252
+ ] })
2253
+ ]
2254
+ }
2255
+ ) });
2239
2256
  };
2240
2257
  const useWalletSelectModal = create((set2) => ({
2241
2258
  isOpen: false,
@@ -2865,7 +2882,9 @@ function useGasEstimate(amountNum) {
2865
2882
  try {
2866
2883
  const estimateValue = await strategy.estimateNetworkFee(steps);
2867
2884
  if (cancelled) return;
2868
- setNetworkFeeEstimate(Number.isFinite(estimateValue) ? estimateValue : 0);
2885
+ setNetworkFeeEstimate(
2886
+ Number.isFinite(estimateValue) ? estimateValue : 0
2887
+ );
2869
2888
  } catch {
2870
2889
  if (cancelled) return;
2871
2890
  setNetworkFeeEstimate(0);
@@ -6623,6 +6642,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6623
6642
  const TOKEN_ROW_HEIGHT = 52;
6624
6643
  const TokenRow = ({
6625
6644
  symbol,
6645
+ willChangeSrc,
6626
6646
  name,
6627
6647
  isSelected,
6628
6648
  hasAnyWallet,
@@ -6635,7 +6655,7 @@ const TokenRow = ({
6635
6655
  Button,
6636
6656
  {
6637
6657
  onClick: onPick,
6638
- className: `w-full px-5 rounded-xs bg-transparent flex items-center justify-between gap-3 hover:bg-accent hover:scale-100 ${isSelected ? "border border-primary" : ""}`,
6658
+ className: `w-full px-5 rounded-xs bg-transparent flex items-center justify-between gap-3 hover:bg-accent hover:scale-100 ${isSelected ? "border border-primary" : ""} ${willChangeSrc ? "opacity-50 hover:opacity-100" : ""}`,
6639
6659
  children: [
6640
6660
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
6641
6661
  /* @__PURE__ */ jsx(
@@ -6871,7 +6891,7 @@ const TokenSelectModal = ({
6871
6891
  "div",
6872
6892
  {
6873
6893
  style: { ...style, height: TOKEN_ROW_HEIGHT },
6874
- className: "px-5 flex leading-4 text-base py-2 text-muted-foreground uppercase mt-8",
6894
+ className: "px-5 flex leading-4 text-base py-2 text-muted-foreground uppercase mt-3",
6875
6895
  children: /* @__PURE__ */ jsx("p", { children: item.text })
6876
6896
  }
6877
6897
  );
@@ -6890,6 +6910,7 @@ const TokenSelectModal = ({
6890
6910
  balance: bal,
6891
6911
  usdValue: usd,
6892
6912
  isBalanceLoading: balancesQuery.isLoading || balancesQuery.isFetching,
6913
+ willChangeSrc,
6893
6914
  onPick: () => onPick(token.symbol, willChangeSrc)
6894
6915
  }
6895
6916
  ) });
@@ -6914,67 +6935,74 @@ const TokenSelectModal = ({
6914
6935
  },
6915
6936
  [effectiveTab, virtualItems]
6916
6937
  );
6917
- return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col fixed top-0 left-0 right-0 bottom-0 translate-x-0 translate-y-0 md:left-[50%] md:top-[50%] md:translate-x-[-50%] md:translate-y-[-50%] p-10 pt-7 rounded-none md:rounded-lg", children: [
6918
- /* @__PURE__ */ jsx(DialogHeader, { className: "text-left", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-2xl leading-8", children: t2("bridge.selectToken") }) }),
6919
- /* @__PURE__ */ jsx(
6920
- SearchInput,
6921
- {
6922
- placeholder: t2("bridge.searchToken"),
6923
- value: query,
6924
- onChange: setQuery
6925
- }
6926
- ),
6927
- hasSourceWallet() && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
6928
- /* @__PURE__ */ jsx(
6929
- Button,
6930
- {
6931
- variant: effectiveTab === "my" ? "default" : "ghost",
6932
- onClick: () => {
6933
- setTab("my");
6934
- setManualTabSwitch(true);
6935
- },
6936
- size: "sm",
6937
- className: cn$2(
6938
- "px-4 cursor-pointer",
6939
- effectiveTab !== "my" && "bg-muted hover:bg-accent"
6940
- ),
6941
- children: t2("bridge.myTokens")
6942
- }
6943
- ),
6944
- /* @__PURE__ */ jsx(
6945
- Button,
6946
- {
6947
- variant: effectiveTab === "all" ? "default" : "ghost",
6948
- onClick: () => {
6949
- setTab("all");
6950
- setManualTabSwitch(true);
6951
- },
6952
- size: "sm",
6953
- className: cn$2(
6954
- "px-4 cursor-pointer",
6955
- effectiveTab !== "all" && "bg-muted hover:bg-accent"
6938
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxs(
6939
+ DialogContent,
6940
+ {
6941
+ className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col fixed top-0 left-0 right-0 bottom-0 translate-x-0 translate-y-0 md:left-[50%] md:top-[50%] md:translate-x-[-50%] md:translate-y-[-50%] p-6 md:p-10 md:pt-8 rounded-none md:rounded-lg",
6942
+ closeButtonClassName: "right-6 md:right-10",
6943
+ children: [
6944
+ /* @__PURE__ */ jsx(DialogHeader, { className: "text-left pb-2", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-2xl leading-8", children: t2("bridge.selectToken") }) }),
6945
+ /* @__PURE__ */ jsx(
6946
+ SearchInput,
6947
+ {
6948
+ placeholder: t2("bridge.searchToken"),
6949
+ value: query,
6950
+ onChange: setQuery
6951
+ }
6952
+ ),
6953
+ hasSourceWallet() && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
6954
+ /* @__PURE__ */ jsx(
6955
+ Button,
6956
+ {
6957
+ variant: effectiveTab === "my" ? "default" : "ghost",
6958
+ onClick: () => {
6959
+ setTab("my");
6960
+ setManualTabSwitch(true);
6961
+ },
6962
+ size: "sm",
6963
+ className: cn$2(
6964
+ "px-4 h-9 cursor-pointer",
6965
+ effectiveTab !== "my" && "bg-muted hover:bg-accent"
6966
+ ),
6967
+ children: t2("bridge.myTokens")
6968
+ }
6956
6969
  ),
6957
- children: t2("bridge.allTokens")
6958
- }
6959
- )
6960
- ] }),
6961
- /* @__PURE__ */ jsx("div", { id: "token-select-list", className: "flex-1 -mx-5 min-h-0", children: hasNoResults ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.tokenNotFound") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6962
- effectiveTab === "my" && myTokens.length === 0 && /* @__PURE__ */ jsx("p", { className: "leading-4 px-5 text-base text-muted-foreground uppercase py-2", children: t2("bridge.noBalancesFound") }),
6963
- /* @__PURE__ */ jsx(
6964
- FixedSizeList,
6965
- {
6966
- height: listHeight,
6967
- itemCount: virtualItems.length,
6968
- itemSize: TOKEN_ROW_HEIGHT,
6969
- width: "100%",
6970
- itemKey,
6971
- className: "[&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30",
6972
- overscanCount: 5,
6973
- children: VirtualRow
6974
- }
6975
- )
6976
- ] }) })
6977
- ] }) });
6970
+ /* @__PURE__ */ jsx(
6971
+ Button,
6972
+ {
6973
+ variant: effectiveTab === "all" ? "default" : "ghost",
6974
+ onClick: () => {
6975
+ setTab("all");
6976
+ setManualTabSwitch(true);
6977
+ },
6978
+ size: "sm",
6979
+ className: cn$2(
6980
+ "px-4 h-9 cursor-pointer",
6981
+ effectiveTab !== "all" && "bg-muted hover:bg-accent"
6982
+ ),
6983
+ children: t2("bridge.allTokens")
6984
+ }
6985
+ )
6986
+ ] }),
6987
+ /* @__PURE__ */ jsx("div", { id: "token-select-list", className: "flex-1 -mx-5 min-h-0", children: hasNoResults ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.tokenNotFound") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6988
+ effectiveTab === "my" && myTokens.length === 0 && /* @__PURE__ */ jsx("p", { className: "leading-4 px-5 text-base text-muted-foreground uppercase py-2", children: t2("bridge.noBalancesFound") }),
6989
+ /* @__PURE__ */ jsx(
6990
+ FixedSizeList,
6991
+ {
6992
+ height: listHeight,
6993
+ itemCount: virtualItems.length,
6994
+ itemSize: TOKEN_ROW_HEIGHT,
6995
+ width: "100%",
6996
+ itemKey,
6997
+ className: "[&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30",
6998
+ overscanCount: 5,
6999
+ children: VirtualRow
7000
+ }
7001
+ )
7002
+ ] }) })
7003
+ ]
7004
+ }
7005
+ ) });
6978
7006
  };
6979
7007
  function useBridgeRefresh() {
6980
7008
  const qc = useQueryClient();
@@ -25793,7 +25821,7 @@ class WalletConnectModal {
25793
25821
  }
25794
25822
  async initUi() {
25795
25823
  if (typeof window !== "undefined") {
25796
- await import("./index-D8sxoZ5P.js");
25824
+ await import("./index-yQkayDGz.js");
25797
25825
  const modal = document.createElement("wcm-modal");
25798
25826
  document.body.insertAdjacentElement("beforeend", modal);
25799
25827
  OptionsCtrl.setIsUiLoaded(true);
@@ -26561,4 +26589,4 @@ export {
26561
26589
  getQuoteFees as y,
26562
26590
  calculateMinReceived as z
26563
26591
  };
26564
- //# sourceMappingURL=index-CDUxAooI.js.map
26592
+ //# sourceMappingURL=index-D0OSdsmf.js.map