coinley-test 0.0.34 → 0.0.36
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 +72 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vanilla/coinley-vanilla.umd.js +2 -2
- package/dist/vanilla/coinley-vanilla.umd.js.map +1 -1
- package/dist/vanilla/style.css +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2032,7 +2032,7 @@ 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
|
+
const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0, width: 0, maxHeight: 400 });
|
|
2036
2036
|
const dropdownRef = useRef(null);
|
|
2037
2037
|
const buttonRef = useRef(null);
|
|
2038
2038
|
const filteredOptions = options.filter((option) => {
|
|
@@ -2045,11 +2045,35 @@ const ModernDropdown = ({
|
|
|
2045
2045
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
2046
2046
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
2047
2047
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
2048
|
+
const viewportHeight = window.innerHeight;
|
|
2049
|
+
const dropdownHeight = 400;
|
|
2050
|
+
const gap = 8;
|
|
2051
|
+
const spaceBelow = viewportHeight - rect.bottom;
|
|
2052
|
+
const spaceAbove = rect.top;
|
|
2053
|
+
let top, maxHeight;
|
|
2054
|
+
if (spaceBelow >= dropdownHeight + gap) {
|
|
2055
|
+
top = rect.bottom + scrollTop + gap;
|
|
2056
|
+
maxHeight = Math.min(dropdownHeight, spaceBelow - gap - 20);
|
|
2057
|
+
} else if (spaceAbove >= dropdownHeight + gap) {
|
|
2058
|
+
top = rect.top + scrollTop - dropdownHeight - gap;
|
|
2059
|
+
maxHeight = Math.min(dropdownHeight, spaceAbove - gap - 20);
|
|
2060
|
+
} else {
|
|
2061
|
+
if (spaceBelow > spaceAbove) {
|
|
2062
|
+
top = rect.bottom + scrollTop + gap;
|
|
2063
|
+
maxHeight = spaceBelow - gap - 20;
|
|
2064
|
+
} else {
|
|
2065
|
+
const constrainedHeight = spaceAbove - gap - 20;
|
|
2066
|
+
top = rect.top + scrollTop - constrainedHeight - gap;
|
|
2067
|
+
maxHeight = constrainedHeight;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
maxHeight = Math.max(maxHeight, 200);
|
|
2048
2071
|
setDropdownPosition({
|
|
2049
|
-
top:
|
|
2050
|
-
//
|
|
2072
|
+
top: Math.max(top, scrollTop + 10),
|
|
2073
|
+
// Ensure it's not too high
|
|
2051
2074
|
left: rect.left + scrollLeft,
|
|
2052
|
-
width: rect.width
|
|
2075
|
+
width: rect.width,
|
|
2076
|
+
maxHeight
|
|
2053
2077
|
});
|
|
2054
2078
|
}
|
|
2055
2079
|
};
|
|
@@ -2094,15 +2118,16 @@ const ModernDropdown = ({
|
|
|
2094
2118
|
"div",
|
|
2095
2119
|
{
|
|
2096
2120
|
ref: dropdownRef,
|
|
2097
|
-
className: "fixed
|
|
2121
|
+
className: "fixed bg-white border-2 border-gray-200 rounded-2xl shadow-2xl overflow-hidden",
|
|
2098
2122
|
style: {
|
|
2099
2123
|
top: dropdownPosition.top,
|
|
2100
2124
|
left: dropdownPosition.left,
|
|
2101
2125
|
width: dropdownPosition.width,
|
|
2102
|
-
maxHeight:
|
|
2103
|
-
|
|
2104
|
-
minWidth: "300px"
|
|
2126
|
+
maxHeight: dropdownPosition.maxHeight || 400,
|
|
2127
|
+
minWidth: "300px",
|
|
2105
2128
|
// Ensure minimum width
|
|
2129
|
+
zIndex: 999999
|
|
2130
|
+
// Very high z-index to appear above modal
|
|
2106
2131
|
},
|
|
2107
2132
|
children: [
|
|
2108
2133
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 border-b border-gray-200 bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -2117,34 +2142,45 @@ const ModernDropdown = ({
|
|
|
2117
2142
|
autoFocus: true
|
|
2118
2143
|
}
|
|
2119
2144
|
) }),
|
|
2120
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
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)
|
|
2145
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2146
|
+
"div",
|
|
2147
|
+
{
|
|
2148
|
+
className: "overflow-y-auto custom-scrollbar",
|
|
2149
|
+
style: {
|
|
2150
|
+
maxHeight: `${(dropdownPosition.maxHeight || 400) - 120}px`,
|
|
2151
|
+
// Subtract header and footer
|
|
2152
|
+
minHeight: "120px"
|
|
2143
2153
|
},
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2154
|
+
children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
|
|
2155
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 mb-2", children: "🔍" }),
|
|
2156
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No options found" }),
|
|
2157
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-gray-400 mt-1", children: "Try a different search term" })
|
|
2158
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
2159
|
+
/* @__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: [
|
|
2160
|
+
filteredOptions.length,
|
|
2161
|
+
" option",
|
|
2162
|
+
filteredOptions.length !== 1 ? "s" : "",
|
|
2163
|
+
" available"
|
|
2164
|
+
] }),
|
|
2165
|
+
filteredOptions.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2166
|
+
"button",
|
|
2167
|
+
{
|
|
2168
|
+
type: "button",
|
|
2169
|
+
onClick: () => {
|
|
2170
|
+
onChange(getOptionValue(option));
|
|
2171
|
+
setIsOpen(false);
|
|
2172
|
+
setSearchTerm("");
|
|
2173
|
+
},
|
|
2174
|
+
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"}`,
|
|
2175
|
+
style: { fontFamily: "Bricolage Grotesque, sans-serif" },
|
|
2176
|
+
children: renderOption(option)
|
|
2177
|
+
},
|
|
2178
|
+
getOptionKey(option)
|
|
2179
|
+
))
|
|
2180
|
+
] })
|
|
2181
|
+
}
|
|
2182
|
+
),
|
|
2183
|
+
/* @__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 > 3 ? "Scroll to see more options" : "Select an option above" })
|
|
2148
2184
|
]
|
|
2149
2185
|
}
|
|
2150
2186
|
);
|
|
@@ -2756,7 +2792,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
2756
2792
|
if (!isOpen) return null;
|
|
2757
2793
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-50", children: [
|
|
2758
2794
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 transition-opacity", onClick: onClose, "aria-hidden": "true" }),
|
|
2759
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative pt-6 w-full max-w-md mx-auto shadow-xl bg-gray-100 rounded-3xl overflow-hidden", children: [
|
|
2795
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 overflow-y-auto", style: { zIndex: 51 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative pt-6 w-full max-w-md mx-auto shadow-xl bg-gray-100 rounded-3xl overflow-hidden", style: { zIndex: 52 }, children: [
|
|
2760
2796
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white flex justify-between items-center mb-6 mr-3 ml-3 py-4 px-2 rounded-full", children: [
|
|
2761
2797
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex items-center gap-2 px-4", children: [
|
|
2762
2798
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-8 h-8 bg-purple-600 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-white font-bold text-sm", children: "C" }) }),
|