@megha-ui/react 1.3.53 → 1.3.56
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.
|
@@ -68,10 +68,10 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
68
68
|
const available = shouldOpenTop ? spaceAbove : spaceBelow;
|
|
69
69
|
const resolvedMax = Math.min(available, preferredMaxHeight);
|
|
70
70
|
if (shouldOpenTop) {
|
|
71
|
-
setClickStyle({ left: 0, bottom: "100%" });
|
|
71
|
+
setClickStyle(Object.assign(Object.assign({}, (menuFrom === "right" ? { right: 0 } : { left: 0 })), { bottom: "100%" }));
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
setClickStyle({ left: 0, top: "100%" });
|
|
74
|
+
setClickStyle(Object.assign(Object.assign({}, (menuFrom === "right" ? { right: 0 } : { left: 0 })), { top: "100%" }));
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
useEffect(() => {
|
|
@@ -173,28 +173,6 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
173
173
|
window.addEventListener("keydown", handleKeyDown);
|
|
174
174
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
175
175
|
}, [isOpen, filteredOptions, highlightIndex]);
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
if (menuFrom !== "left") {
|
|
178
|
-
if (menuFrom === "top") {
|
|
179
|
-
setClickStyle({
|
|
180
|
-
bottom: "calc(100% + 5px)",
|
|
181
|
-
left: 0,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
else if (menuFrom === "bottom") {
|
|
185
|
-
setClickStyle({
|
|
186
|
-
top: 0,
|
|
187
|
-
right: 0,
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
setClickStyle({
|
|
192
|
-
right: 0,
|
|
193
|
-
top: "100%",
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}, [menuFrom]);
|
|
198
176
|
useEffect(() => {
|
|
199
177
|
if (!autoPosition)
|
|
200
178
|
return;
|
package/package.json
CHANGED