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