bianic-ui 1.15.0-alpha.3 → 1.15.0-alpha.5
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 +7 -7
- package/dist/esm/index.js +8 -8
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2391,8 +2391,6 @@ 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);
|
|
2396
2394
|
var spaceToBottom = window.innerHeight - anchorRect.bottom;
|
|
2397
2395
|
var spaceToTop = anchorRect.top;
|
|
2398
2396
|
var style = {
|
|
@@ -2411,11 +2409,10 @@ var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
|
2411
2409
|
return style;
|
|
2412
2410
|
};
|
|
2413
2411
|
var DropdownContainer = function (propsComp) {
|
|
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"]);
|
|
2412
|
+
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 100 : _h, anchorRef = propsComp.anchorRef, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef"]);
|
|
2416
2413
|
if (!open)
|
|
2417
2414
|
return null;
|
|
2418
|
-
var
|
|
2415
|
+
var _j = React.useState({ minWidth: 'auto' }), positionStyle = _j[0], setPositionStyle = _j[1];
|
|
2419
2416
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2420
2417
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2421
2418
|
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
@@ -2439,13 +2436,16 @@ var DropdownContainer = function (propsComp) {
|
|
|
2439
2436
|
window.removeEventListener('resize', handleScrollOrResize);
|
|
2440
2437
|
};
|
|
2441
2438
|
}, [anchorRef]);
|
|
2442
|
-
var rect = (
|
|
2439
|
+
var rect = React.useMemo(function () {
|
|
2440
|
+
var _a;
|
|
2441
|
+
return (_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2442
|
+
}, [anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current]);
|
|
2443
2443
|
React.useEffect(function () {
|
|
2444
2444
|
if (!anchorRef || !anchorRef.current || !rect)
|
|
2445
2445
|
return;
|
|
2446
2446
|
setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
|
|
2447
2447
|
console.log('rect changed', rect);
|
|
2448
|
-
}, [rect]);
|
|
2448
|
+
}, [rect === null || rect === void 0 ? void 0 : rect.left, rect === null || rect === void 0 ? void 0 : rect.top, rect === null || rect === void 0 ? void 0 : rect.width, rect === null || rect === void 0 ? void 0 : rect.height]);
|
|
2449
2449
|
return (React.createElement(React.Fragment, null,
|
|
2450
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(); } })),
|
|
2451
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) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, forwardRef, useRef, cloneElement, Children, useLayoutEffect, useCallback, isValidElement } from 'react';
|
|
1
|
+
import React, { useState, useEffect, forwardRef, useRef, cloneElement, Children, useLayoutEffect, useMemo, useCallback, isValidElement } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
|
|
4
4
|
function Accordions(_a) {
|
|
@@ -2389,8 +2389,6 @@ var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
|
2389
2389
|
}
|
|
2390
2390
|
var anchorRect = anchorRef.current.getBoundingClientRect();
|
|
2391
2391
|
var dropdownHeight = dropdownRef.current.offsetHeight;
|
|
2392
|
-
console.log('window.scrollY', window.scrollY);
|
|
2393
|
-
console.log('window.scrollX', window.scrollX);
|
|
2394
2392
|
var spaceToBottom = window.innerHeight - anchorRect.bottom;
|
|
2395
2393
|
var spaceToTop = anchorRect.top;
|
|
2396
2394
|
var style = {
|
|
@@ -2409,11 +2407,10 @@ var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
|
2409
2407
|
return style;
|
|
2410
2408
|
};
|
|
2411
2409
|
var DropdownContainer = function (propsComp) {
|
|
2412
|
-
var _a;
|
|
2413
|
-
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"]);
|
|
2410
|
+
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 100 : _h, anchorRef = propsComp.anchorRef, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef"]);
|
|
2414
2411
|
if (!open)
|
|
2415
2412
|
return null;
|
|
2416
|
-
var
|
|
2413
|
+
var _j = useState({ minWidth: 'auto' }), positionStyle = _j[0], setPositionStyle = _j[1];
|
|
2417
2414
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2418
2415
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2419
2416
|
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
@@ -2437,13 +2434,16 @@ var DropdownContainer = function (propsComp) {
|
|
|
2437
2434
|
window.removeEventListener('resize', handleScrollOrResize);
|
|
2438
2435
|
};
|
|
2439
2436
|
}, [anchorRef]);
|
|
2440
|
-
var rect = (
|
|
2437
|
+
var rect = useMemo(function () {
|
|
2438
|
+
var _a;
|
|
2439
|
+
return (_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2440
|
+
}, [anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current]);
|
|
2441
2441
|
useEffect(function () {
|
|
2442
2442
|
if (!anchorRef || !anchorRef.current || !rect)
|
|
2443
2443
|
return;
|
|
2444
2444
|
setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
|
|
2445
2445
|
console.log('rect changed', rect);
|
|
2446
|
-
}, [rect]);
|
|
2446
|
+
}, [rect === null || rect === void 0 ? void 0 : rect.left, rect === null || rect === void 0 ? void 0 : rect.top, rect === null || rect === void 0 ? void 0 : rect.width, rect === null || rect === void 0 ? void 0 : rect.height]);
|
|
2447
2447
|
return (React.createElement(React.Fragment, null,
|
|
2448
2448
|
isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
|
|
2449
2449
|
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), Children.map(children, function (child) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"@biaenergi:registry": "https://gitlab.com/api/v4/projects/50905269/packages/npm/"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.15.0-alpha.
|
|
6
|
+
"version": "1.15.0-alpha.5",
|
|
7
7
|
"description": "Design Language System develop by BIAENERGI",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"rollup": "rollup -c",
|