@oliasoft-open-source/react-ui-library 3.1.27 → 3.1.29

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25061,27 +25061,25 @@ const List = ({
25061
25061
  hideScrollbar: hideScrollbar2,
25062
25062
  triggerScrollToActiveItem,
25063
25063
  infiniteScroll,
25064
- infiniteScrollTarget,
25065
- limit: limit2
25064
+ infiniteScrollTarget
25066
25065
  } = scrollDetails;
25067
25066
  const listHeadingRef = useRef();
25068
25067
  const listRowRefs = useRef([]);
25069
25068
  const listContainerRef = useRef();
25070
- const [items, setItems] = useState(lodash.exports.slice(list2 == null ? void 0 : list2.items, 0, limit2));
25071
- const [index2, setIndex] = useState(limit2);
25069
+ const MIN_ITEM_HEIGHT = 44;
25070
+ const visibleRows = infiniteScroll ? Math.ceil(window.innerHeight / MIN_ITEM_HEIGHT) : list2.items.length;
25071
+ const [items, setItems] = useState(lodash.exports.slice(list2 == null ? void 0 : list2.items, 0, visibleRows));
25072
+ const [index2, setIndex] = useState(visibleRows);
25072
25073
  const [hasMore, setHasMore] = useState(index2 < (list2 == null ? void 0 : list2.items.length));
25073
25074
  useEffect(() => {
25074
25075
  listRowRefs.current = listRowRefs.current.slice(0, list2.items.length);
25075
25076
  }, [list2.items.length]);
25076
- useEffect(() => {
25077
- setItems(lodash.exports.slice(list2 == null ? void 0 : list2.items, 0, index2));
25078
- }, [list2.items]);
25079
25077
  const loadMoreItems = () => {
25080
25078
  if (index2 >= list2.items.length) {
25081
25079
  setHasMore(false);
25082
25080
  return;
25083
25081
  }
25084
- const newIndex = index2 + limit2;
25082
+ const newIndex = index2 + visibleRows;
25085
25083
  const newItems = lodash.exports.concat(items, lodash.exports.slice(list2 == null ? void 0 : list2.items, index2, newIndex));
25086
25084
  setIndex(newIndex);
25087
25085
  setItems(newItems);
@@ -27424,7 +27422,7 @@ const CustomSelect = ({
27424
27422
  const getLayerWidth = useCallback$1((triggerBounds2) => {
27425
27423
  if (!autoLayerWidth)
27426
27424
  return triggerBounds2.width;
27427
- const layerWidth = Math.max(getWidestOptionWidth(), triggerBounds2.width);
27425
+ const layerWidth = Math.max(getWidestOptionWidth(options, small2, isFontLoaded, placeholder3), triggerBounds2.width);
27428
27426
  return layerWidth;
27429
27427
  }, [options, isFontLoaded]);
27430
27428
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "3.1.27",
3
+ "version": "3.1.29",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",