@megha-ui/react 1.3.54 → 1.3.57
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;
|
|
@@ -432,7 +410,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
432
410
|
}, children: [isClear && (displayValue || selectedDisplay) && (_jsx("div", { style: { marginRight: "0.5rem" }, onClick: handleClear, id: clearId, title: "Click to clear the value", children: ClearIcon ? (ClearIcon) : (_jsx("span", { style: {
|
|
433
411
|
color: "var(--form-border-color, #dbdfe9)",
|
|
434
412
|
fontSize: "1rem",
|
|
435
|
-
}, children: "X" })) })), disabled ? (Tooltip && Tooltip) : DropDownIcon ? (DropDownIcon) : (_jsx(HiChevronDown, { fontSize: "1rem" })), withTooltip && Tooltip && Tooltip] })] }), _jsxs("ul", { style: Object.assign(Object.assign({ width: isGrouping ? "max-content" : dropdownListWidth || "100%", position: "absolute", backgroundColor: dropdownListBG || "var(--dropdown-bg)", boxShadow: "0 4px 0.75rem rgba(0, 0, 0, 0.1)", border: "1px solid var(--divider, #f5f5f5)", zIndex: 10, marginTop: 4, borderRadius: 4, overflow: "hidden" }, clickStyle), { display: !isOpen ? "none" : "" }), children: [searchEnabled && (_jsx("li", { style: { padding: "0.5rem" }, ref: searchOptionRef, children: _jsx("input", { ref: searchInputRef, type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), disabled: disabled, style: {
|
|
413
|
+
}, children: "X" })) })), disabled ? (Tooltip && Tooltip) : DropDownIcon ? (DropDownIcon) : (_jsx(HiChevronDown, { fontSize: "1rem" })), withTooltip && Tooltip && Tooltip] })] }), _jsxs("ul", { style: Object.assign(Object.assign({ width: isGrouping ? "max-content" : dropdownListWidth || "100%", position: autoPosition ? "absolute" : "static", backgroundColor: dropdownListBG || "var(--dropdown-bg)", boxShadow: "0 4px 0.75rem rgba(0, 0, 0, 0.1)", border: "1px solid var(--divider, #f5f5f5)", zIndex: 10, marginTop: 4, borderRadius: 4, overflow: "hidden" }, (autoPosition ? clickStyle : {})), { display: !isOpen ? "none" : "" }), children: [searchEnabled && (_jsx("li", { style: { padding: "0.5rem" }, ref: searchOptionRef, children: _jsx("input", { ref: searchInputRef, type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), disabled: disabled, style: {
|
|
436
414
|
width: "100%",
|
|
437
415
|
padding: "0.5rem",
|
|
438
416
|
boxSizing: "border-box",
|
package/package.json
CHANGED