@rash2x/bridge-widget 0.6.58 → 0.6.62

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