@aristobyte-ui/dropdown 2.15.2 → 2.16.2
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/README.md +15 -13
- package/es/.tsbuildinfo +1 -1
- package/es/components/Dropdown/index.js +6 -3
- package/lib/.tsbuildinfo +1 -1
- package/lib/components/Dropdown/index.js +6 -3
- package/package.json +3 -3
|
@@ -54,8 +54,9 @@ export var Dropdown = function (_a) {
|
|
|
54
54
|
var boxRef = React.useRef(null);
|
|
55
55
|
var uniqueId = React.useId();
|
|
56
56
|
var computePosition = React.useCallback(function () {
|
|
57
|
-
if (!buttonContainerRef.current || !boxRef.current)
|
|
57
|
+
if (!buttonContainerRef.current || !boxRef.current) {
|
|
58
58
|
return;
|
|
59
|
+
}
|
|
59
60
|
var rect = buttonContainerRef.current.getBoundingClientRect();
|
|
60
61
|
var dropdownRect = boxRef.current.getBoundingClientRect();
|
|
61
62
|
var spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -95,15 +96,17 @@ export var Dropdown = function (_a) {
|
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
98
|
var handleToggle = function (e) {
|
|
98
|
-
if (disabled)
|
|
99
|
+
if (disabled) {
|
|
99
100
|
return;
|
|
101
|
+
}
|
|
100
102
|
if (button === null || button === void 0 ? void 0 : button.onClick)
|
|
101
103
|
button.onClick(e);
|
|
102
104
|
setIsOpened(function (prev) { return !prev; });
|
|
103
105
|
};
|
|
104
106
|
React.useLayoutEffect(function () {
|
|
105
|
-
if (!isOpened)
|
|
107
|
+
if (!isOpened) {
|
|
106
108
|
return;
|
|
109
|
+
}
|
|
107
110
|
var raf = requestAnimationFrame(function () {
|
|
108
111
|
computePosition();
|
|
109
112
|
});
|