bianic-ui 2.5.1-beta.1 → 2.6.0
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 +16 -18
- package/dist/cjs/lib.css +1 -1
- package/dist/esm/index.js +16 -18
- package/dist/esm/lib.css +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1953,9 +1953,6 @@ var getDropdownStyle = function (anchorRef, popupRef) {
|
|
|
1953
1953
|
return style;
|
|
1954
1954
|
};
|
|
1955
1955
|
var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
1956
|
-
// In projects where bianic-ui is installed,
|
|
1957
|
-
// there is a delay in rendering styles,
|
|
1958
|
-
// which causes popups to lose their position and need to be re-rendered.
|
|
1959
1956
|
if (!anchorRef || !popupRef) {
|
|
1960
1957
|
return [{}, function () { }];
|
|
1961
1958
|
}
|
|
@@ -1968,18 +1965,23 @@ var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
|
1968
1965
|
setPositionStyle(newStyle);
|
|
1969
1966
|
};
|
|
1970
1967
|
React.useLayoutEffect(function () {
|
|
1971
|
-
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
|
|
1968
|
+
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || !(popupRef === null || popupRef === void 0 ? void 0 : popupRef.current))
|
|
1972
1969
|
return;
|
|
1973
1970
|
calcPosition();
|
|
1974
|
-
|
|
1971
|
+
var resizeObserver = new ResizeObserver(calcPosition);
|
|
1972
|
+
resizeObserver.observe(popupRef.current);
|
|
1973
|
+
window.addEventListener('scroll', calcPosition, true);
|
|
1975
1974
|
window.addEventListener('resize', calcPosition);
|
|
1976
|
-
setRepeateRender(0);
|
|
1977
1975
|
return function () {
|
|
1978
|
-
|
|
1976
|
+
resizeObserver.disconnect();
|
|
1977
|
+
window.removeEventListener('scroll', calcPosition, true);
|
|
1979
1978
|
window.removeEventListener('resize', calcPosition);
|
|
1980
1979
|
};
|
|
1981
|
-
}, [anchorRef]);
|
|
1980
|
+
}, [anchorRef, popupRef]);
|
|
1982
1981
|
React.useEffect(function () {
|
|
1982
|
+
// In projects where bianic-ui is installed,
|
|
1983
|
+
// there is a delay in rendering styles,
|
|
1984
|
+
// which causes popups to lose their position and need to be re-rendered.
|
|
1983
1985
|
if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
|
|
1984
1986
|
calcPosition();
|
|
1985
1987
|
setRepeateRender(repeateRender + 1);
|
|
@@ -3729,8 +3731,8 @@ var Notification = function (props) {
|
|
|
3729
3731
|
};
|
|
3730
3732
|
|
|
3731
3733
|
var sizeConfig$2 = {
|
|
3732
|
-
md: 'min-w-[
|
|
3733
|
-
sm: 'min-w-[
|
|
3734
|
+
md: 'min-w-[40px] h-[40px] text-[14px] font-semibold',
|
|
3735
|
+
sm: 'min-w-[30px] h-[30px] text-[12px] font-normal',
|
|
3734
3736
|
};
|
|
3735
3737
|
var positionConfig = {
|
|
3736
3738
|
start: 'justify-start',
|
|
@@ -3777,15 +3779,11 @@ function PaginationBar(_a) {
|
|
|
3777
3779
|
else
|
|
3778
3780
|
setStartIndex(0);
|
|
3779
3781
|
};
|
|
3780
|
-
var getStartIndex = function (index) {
|
|
3781
|
-
if (index + PAGE_SIZE > totalPages)
|
|
3782
|
-
return Math.max(0, totalPages - PAGE_SIZE);
|
|
3783
|
-
return index;
|
|
3784
|
-
};
|
|
3785
3782
|
React.useEffect(function () {
|
|
3786
|
-
var
|
|
3787
|
-
|
|
3788
|
-
|
|
3783
|
+
var start = Math.max(0, Math.min(startIndex, totalPages - PAGE_SIZE));
|
|
3784
|
+
var newPages = Array.from({ length: totalPages }, function (_, i) { return i + 1; }).slice(start, start + PAGE_SIZE);
|
|
3785
|
+
setShowedPages(newPages);
|
|
3786
|
+
}, [startIndex, totalPages]);
|
|
3789
3787
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
3790
3788
|
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
|
|
3791
3789
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|