bianic-ui 1.15.0-alpha.2 → 1.15.0-alpha.3
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/cjs/index.js +12 -2
- package/dist/cjs/lib.css +1 -1
- package/dist/esm/index.js +12 -2
- package/dist/esm/lib.css +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2391,6 +2391,8 @@ var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
var anchorRect = anchorRef.current.getBoundingClientRect();
|
|
2393
2393
|
var dropdownHeight = dropdownRef.current.offsetHeight;
|
|
2394
|
+
console.log('window.scrollY', window.scrollY);
|
|
2395
|
+
console.log('window.scrollX', window.scrollX);
|
|
2394
2396
|
var spaceToBottom = window.innerHeight - anchorRect.bottom;
|
|
2395
2397
|
var spaceToTop = anchorRect.top;
|
|
2396
2398
|
var style = {
|
|
@@ -2409,10 +2411,11 @@ var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
|
2409
2411
|
return style;
|
|
2410
2412
|
};
|
|
2411
2413
|
var DropdownContainer = function (propsComp) {
|
|
2412
|
-
var _a
|
|
2414
|
+
var _a;
|
|
2415
|
+
var _b = propsComp.isTopFlat, isTopFlat = _b === void 0 ? false : _b, children = propsComp.children, _c = propsComp.open, open = _c === void 0 ? true : _c, _d = propsComp.onClose, onClose = _d === void 0 ? function () { } : _d, _e = propsComp.className, className = _e === void 0 ? '' : _e, _f = propsComp.isWithOverlay, isWithOverlay = _f === void 0 ? true : _f, _g = propsComp.size, size = _g === void 0 ? 'md' : _g, _h = propsComp.onClickItem, onClickItem = _h === void 0 ? function () { } : _h, _j = propsComp.zIndex, zIndex = _j === void 0 ? 100 : _j, anchorRef = propsComp.anchorRef, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef"]);
|
|
2413
2416
|
if (!open)
|
|
2414
2417
|
return null;
|
|
2415
|
-
var
|
|
2418
|
+
var _k = React.useState({ minWidth: 'auto' }), positionStyle = _k[0], setPositionStyle = _k[1];
|
|
2416
2419
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2417
2420
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2418
2421
|
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
@@ -2436,6 +2439,13 @@ var DropdownContainer = function (propsComp) {
|
|
|
2436
2439
|
window.removeEventListener('resize', handleScrollOrResize);
|
|
2437
2440
|
};
|
|
2438
2441
|
}, [anchorRef]);
|
|
2442
|
+
var rect = (_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2443
|
+
React.useEffect(function () {
|
|
2444
|
+
if (!anchorRef || !anchorRef.current || !rect)
|
|
2445
|
+
return;
|
|
2446
|
+
setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
|
|
2447
|
+
console.log('rect changed', rect);
|
|
2448
|
+
}, [rect]);
|
|
2439
2449
|
return (React.createElement(React.Fragment, null,
|
|
2440
2450
|
isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
|
|
2441
2451
|
reactDom.createPortal(React.createElement("div", __assign({ ref: dropdownRef, className: "absolute max-w-fit bianic-dropdown-container bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(containerClass), style: __assign({ zIndex: zIndex + 10 }, positionStyle) }, restProps), React.Children.map(children, function (child) {
|