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