@rash2x/bridge-widget 0.7.7 → 0.7.8

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.
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
+ import * as React from "react";
5
6
  import { useEffect, useState, useCallback, useMemo, forwardRef, createContext, useContext, useRef, useLayoutEffect } from "react";
6
7
  import { initReactI18next, I18nextProvider, useTranslation } from "react-i18next";
7
8
  import i18n from "i18next";
@@ -3024,11 +3025,54 @@ const InfoIcon = (props) => {
3024
3025
  }
3025
3026
  );
3026
3027
  };
3028
+ const MOBILE_BREAKPOINT = 768;
3029
+ function useIsMobile() {
3030
+ const [isMobile2, setIsMobile] = React.useState(
3031
+ void 0
3032
+ );
3033
+ React.useEffect(() => {
3034
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
3035
+ const onChange = () => {
3036
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
3037
+ };
3038
+ mql.addEventListener("change", onChange);
3039
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
3040
+ return () => mql.removeEventListener("change", onChange);
3041
+ }, []);
3042
+ return !!isMobile2;
3043
+ }
3027
3044
  const Tip = (props) => {
3028
3045
  const { children, text } = props;
3029
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
3030
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "w-4 h-4 rounded-full bg-muted text-muted-foreground", children }),
3031
- /* @__PURE__ */ jsx(TooltipContent, { children: text })
3046
+ const [open, setOpen] = useState(false);
3047
+ const isMobile2 = useIsMobile();
3048
+ const tooltipRef = useRef(null);
3049
+ const handleToggle = () => {
3050
+ setOpen((prev) => !prev);
3051
+ };
3052
+ useEffect(() => {
3053
+ const handleClickOutside = (event) => {
3054
+ if (tooltipRef.current && !tooltipRef.current.contains(event.target)) {
3055
+ setOpen(false);
3056
+ }
3057
+ };
3058
+ document.addEventListener("mousedown", handleClickOutside);
3059
+ return () => {
3060
+ document.removeEventListener("mousedown", handleClickOutside);
3061
+ };
3062
+ }, []);
3063
+ return /* @__PURE__ */ jsxs(Tooltip, { open: isMobile2 ? open : void 0, children: [
3064
+ /* @__PURE__ */ jsx(
3065
+ TooltipTrigger,
3066
+ {
3067
+ onClick: (e2) => {
3068
+ e2.preventDefault();
3069
+ handleToggle();
3070
+ },
3071
+ className: "w-4 h-4 rounded-full bg-muted text-muted-foreground",
3072
+ children
3073
+ }
3074
+ ),
3075
+ /* @__PURE__ */ jsx(TooltipContent, { ref: tooltipRef, children: text })
3032
3076
  ] });
3033
3077
  };
3034
3078
  const BASE_URL = "https://icons-ckg.pages.dev/stargate-light/tokens";
@@ -26086,7 +26130,7 @@ class WalletConnectModal {
26086
26130
  }
26087
26131
  async initUi() {
26088
26132
  if (typeof window !== "undefined") {
26089
- await import("./index-D2IOd6mV.js");
26133
+ await import("./index-DIK7UXln.js");
26090
26134
  const modal = document.createElement("wcm-modal");
26091
26135
  document.body.insertAdjacentElement("beforeend", modal);
26092
26136
  OptionsCtrl.setIsUiLoaded(true);
@@ -26990,4 +27034,4 @@ export {
26990
27034
  calculateMinReceived as y,
26991
27035
  getQuoteDetails as z
26992
27036
  };
26993
- //# sourceMappingURL=index-KQ4SsUup.js.map
27037
+ //# sourceMappingURL=index-CEcrJo_G.js.map