lecom-ui 5.2.97 → 5.2.98

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.
@@ -100,18 +100,27 @@ function useTagVisibility(ref, value) {
100
100
  setHiddenCount(newHiddenCount);
101
101
  }, [ref, calculateVisibleTags, value.length]);
102
102
  React.useLayoutEffect(() => {
103
- requestAnimationFrame(() => {
103
+ const calculateWhenVisible = () => {
104
104
  requestAnimationFrame(() => {
105
- calculateMaxVisible();
105
+ requestAnimationFrame(() => {
106
+ calculateMaxVisible();
107
+ });
106
108
  });
109
+ };
110
+ const observer = new IntersectionObserver((entries) => {
111
+ if (entries.some((entry) => entry.isIntersecting)) {
112
+ calculateWhenVisible();
113
+ }
107
114
  });
108
115
  const resizeObserver = new ResizeObserver(() => {
109
116
  calculateMaxVisible();
110
117
  });
111
118
  if (ref.current) {
119
+ observer.observe(ref.current);
112
120
  resizeObserver.observe(ref.current);
113
121
  }
114
122
  return () => {
123
+ observer.disconnect();
115
124
  resizeObserver.disconnect();
116
125
  };
117
126
  }, [value, calculateMaxVisible, ref]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.2.97",
3
+ "version": "5.2.98",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",