coinley-test 0.0.32 → 0.0.34

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/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import { motion, AnimatePresence } from "framer-motion";
3
3
  import { ArrowLeft, X, Sparkles, Wallet, Zap, QrCode, Loader2, ChevronDown, CheckCircle2, Copy, ExternalLink, AlertCircle } from "lucide-react";
4
4
  import { createCoinleyWalletConfig, CoinleyWalletProvider, WalletModal, useWallet, useWalletConnect, useWalletDetection, useWalletTransaction, useWalletModal } from "@coinley/wallet-connect-core";
5
5
  import axios from "axios";
6
- import require$$0 from "react-dom";
6
+ import ReactDOM from "react-dom";
7
7
  var jsxRuntime = { exports: {} };
8
8
  var reactJsxRuntime_production_min = {};
9
9
  /**
@@ -2032,28 +2032,129 @@ const ModernDropdown = ({
2032
2032
  }) => {
2033
2033
  const [isOpen, setIsOpen] = useState(false);
2034
2034
  const [searchTerm, setSearchTerm] = useState("");
2035
+ const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0, width: 0 });
2035
2036
  const dropdownRef = useRef(null);
2037
+ const buttonRef = useRef(null);
2036
2038
  const filteredOptions = options.filter((option) => {
2037
2039
  const searchableText = getSearchableText ? getSearchableText(option) : "";
2038
2040
  return searchableText.toLowerCase().includes(searchTerm.toLowerCase());
2039
2041
  });
2040
2042
  const selectedOption = options.find((option) => getOptionValue(option) === value);
2043
+ const updateDropdownPosition = () => {
2044
+ if (buttonRef.current) {
2045
+ const rect = buttonRef.current.getBoundingClientRect();
2046
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
2047
+ const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
2048
+ setDropdownPosition({
2049
+ top: rect.bottom + scrollTop + 8,
2050
+ // 8px gap
2051
+ left: rect.left + scrollLeft,
2052
+ width: rect.width
2053
+ });
2054
+ }
2055
+ };
2041
2056
  useEffect(() => {
2042
2057
  const handleClickOutside = (event) => {
2043
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2058
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
2044
2059
  setIsOpen(false);
2045
2060
  setSearchTerm("");
2046
2061
  }
2047
2062
  };
2048
- document.addEventListener("mousedown", handleClickOutside);
2049
- return () => document.removeEventListener("mousedown", handleClickOutside);
2050
- }, []);
2051
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", ref: dropdownRef, children: [
2052
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2063
+ const handleScroll = () => {
2064
+ if (isOpen) {
2065
+ updateDropdownPosition();
2066
+ }
2067
+ };
2068
+ const handleResize = () => {
2069
+ if (isOpen) {
2070
+ updateDropdownPosition();
2071
+ }
2072
+ };
2073
+ if (isOpen) {
2074
+ updateDropdownPosition();
2075
+ document.addEventListener("mousedown", handleClickOutside);
2076
+ window.addEventListener("scroll", handleScroll, true);
2077
+ window.addEventListener("resize", handleResize);
2078
+ }
2079
+ return () => {
2080
+ document.removeEventListener("mousedown", handleClickOutside);
2081
+ window.removeEventListener("scroll", handleScroll, true);
2082
+ window.removeEventListener("resize", handleResize);
2083
+ };
2084
+ }, [isOpen]);
2085
+ const handleToggle = () => {
2086
+ if (!disabled) {
2087
+ if (!isOpen) {
2088
+ updateDropdownPosition();
2089
+ }
2090
+ setIsOpen(!isOpen);
2091
+ }
2092
+ };
2093
+ const dropdownContent = isOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs(
2094
+ "div",
2095
+ {
2096
+ ref: dropdownRef,
2097
+ className: "fixed z-[9999] bg-white border-2 border-gray-200 rounded-2xl shadow-2xl overflow-hidden",
2098
+ style: {
2099
+ top: dropdownPosition.top,
2100
+ left: dropdownPosition.left,
2101
+ width: dropdownPosition.width,
2102
+ maxHeight: "400px",
2103
+ // Increased max height
2104
+ minWidth: "300px"
2105
+ // Ensure minimum width
2106
+ },
2107
+ children: [
2108
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 border-b border-gray-200 bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2109
+ "input",
2110
+ {
2111
+ type: "text",
2112
+ placeholder: "Search networks and tokens...",
2113
+ value: searchTerm,
2114
+ onChange: (e) => setSearchTerm(e.target.value),
2115
+ className: "w-full p-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-[#7042D2]/20 focus:border-[#7042D2] text-sm",
2116
+ style: { fontFamily: "Bricolage Grotesque, sans-serif" },
2117
+ autoFocus: true
2118
+ }
2119
+ ) }),
2120
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-80 min-h-32 overflow-y-auto custom-scrollbar", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2121
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 mb-2", children: "🔍" }),
2122
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No options found" }),
2123
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-gray-400 mt-1", children: "Try a different search term" })
2124
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2125
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-100 text-xs text-gray-600", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2126
+ filteredOptions.length,
2127
+ " option",
2128
+ filteredOptions.length !== 1 ? "s" : "",
2129
+ " available"
2130
+ ] }),
2131
+ filteredOptions.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2132
+ "button",
2133
+ {
2134
+ type: "button",
2135
+ onClick: () => {
2136
+ onChange(getOptionValue(option));
2137
+ setIsOpen(false);
2138
+ setSearchTerm("");
2139
+ },
2140
+ className: `w-full p-4 text-left hover:bg-[#7042D2]/10 transition-colors duration-200 border-b border-gray-100 last:border-b-0 ${getOptionValue(option) === value ? "bg-[#7042D2]/20 text-[#7042D2]" : "text-gray-800"}`,
2141
+ style: { fontFamily: "Bricolage Grotesque, sans-serif" },
2142
+ children: renderOption(option)
2143
+ },
2144
+ getOptionKey(option)
2145
+ ))
2146
+ ] }) }),
2147
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-gray-50 border-t border-gray-200 text-xs text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: filteredOptions.length > 5 ? "Scroll to see more options" : "Select an option above" })
2148
+ ]
2149
+ }
2150
+ );
2151
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2053
2153
  "button",
2054
2154
  {
2155
+ ref: buttonRef,
2055
2156
  type: "button",
2056
- onClick: () => !disabled && setIsOpen(!isOpen),
2157
+ onClick: handleToggle,
2057
2158
  disabled,
2058
2159
  className: `w-full p-4 border-2 rounded-2xl bg-gradient-to-r from-white to-gray-50 text-left focus:outline-none focus:ring-3 focus:ring-[#7042D2]/20 focus:border-[#7042D2] transition-all duration-300 ease-out shadow-lg hover:shadow-xl ${disabled ? "opacity-50 cursor-not-allowed" : "hover:border-[#7042D2]/50 cursor-pointer"} ${isOpen ? "border-[#7042D2] ring-3 ring-[#7042D2]/20" : "border-gray-200"}`,
2059
2160
  style: {
@@ -2067,49 +2168,8 @@ const ModernDropdown = ({
2067
2168
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `transform transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5 text-[#7042D2]", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) })
2068
2169
  ] })
2069
2170
  }
2070
- ),
2071
- isOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-50 w-full mt-2 bg-white border-2 border-gray-200 rounded-2xl shadow-2xl overflow-hidden", children: [
2072
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 border-b border-gray-200 bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2073
- "input",
2074
- {
2075
- type: "text",
2076
- placeholder: "Search networks and tokens...",
2077
- value: searchTerm,
2078
- onChange: (e) => setSearchTerm(e.target.value),
2079
- className: "w-full p-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-[#7042D2]/20 focus:border-[#7042D2] text-sm",
2080
- style: { fontFamily: "Bricolage Grotesque, sans-serif" },
2081
- autoFocus: true
2082
- }
2083
- ) }),
2084
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-80 min-h-32 overflow-y-auto custom-scrollbar", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2085
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 mb-2", children: "🔍" }),
2086
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No options found" }),
2087
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-gray-400 mt-1", children: "Try a different search term" })
2088
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2089
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-100 text-xs text-gray-600", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2090
- filteredOptions.length,
2091
- " option",
2092
- filteredOptions.length !== 1 ? "s" : "",
2093
- " available"
2094
- ] }),
2095
- filteredOptions.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2096
- "button",
2097
- {
2098
- type: "button",
2099
- onClick: () => {
2100
- onChange(getOptionValue(option));
2101
- setIsOpen(false);
2102
- setSearchTerm("");
2103
- },
2104
- className: `w-full p-4 text-left hover:bg-[#7042D2]/10 transition-colors duration-200 border-b border-gray-100 last:border-b-0 ${getOptionValue(option) === value ? "bg-[#7042D2]/20 text-[#7042D2]" : "text-gray-800"}`,
2105
- style: { fontFamily: "Bricolage Grotesque, sans-serif" },
2106
- children: renderOption(option)
2107
- },
2108
- getOptionKey(option)
2109
- ))
2110
- ] }) }),
2111
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-gray-50 border-t border-gray-200 text-xs text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: "Scroll to see more options" })
2112
- ] }),
2171
+ ) }),
2172
+ typeof document !== "undefined" && document.body && ReactDOM.createPortal(dropdownContent, document.body),
2113
2173
  /* @__PURE__ */ jsxRuntimeExports.jsx("style", { jsx: true, children: `
2114
2174
  .custom-scrollbar {
2115
2175
  scrollbar-width: thin;
@@ -2951,7 +3011,7 @@ const EnhancedSimpleCoinleyPayment = ({
2951
3011
  ] });
2952
3012
  };
2953
3013
  var createRoot;
2954
- var m = require$$0;
3014
+ var m = ReactDOM;
2955
3015
  {
2956
3016
  createRoot = m.createRoot;
2957
3017
  m.hydrateRoot;