@true-engineering/true-react-common-ui-kit 3.0.0-alpha.10 → 3.0.0-alpha.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.0.0-alpha.10",
3
+ "version": "3.0.0-alpha.12",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -65,6 +65,7 @@ export function FlexibleTable<Values extends Record<string, any>>({
65
65
  });
66
66
 
67
67
  const [isHorizontallyScrolled, setIsHorizontallyScrolled] = useState(false);
68
+ const [hasScrollBar, setHasScrollBar] = useState(false);
68
69
 
69
70
  const observer = useRef<IntersectionObserver>();
70
71
  const scrollRef = useRef<HTMLDivElement>(null);
@@ -107,12 +108,13 @@ export function FlexibleTable<Values extends Record<string, any>>({
107
108
  if (scrollContainer === null || !isHorizontallyScrollable || !isFirstColumnSticky) {
108
109
  return;
109
110
  }
111
+ setHasScrollBar(hasHorizontalScrollBar(scrollContainer));
110
112
  const scrollHandler = (e: Event) => {
111
113
  setIsHorizontallyScrolled((e.target as HTMLDivElement).scrollLeft > 0);
112
114
  };
113
115
  scrollContainer.addEventListener('scroll', scrollHandler);
114
116
  return () => scrollContainer.removeEventListener('scroll', scrollHandler);
115
- }, [scrollRef]);
117
+ }, [ref]);
116
118
 
117
119
  return (
118
120
  <div
@@ -120,7 +122,7 @@ export function FlexibleTable<Values extends Record<string, any>>({
120
122
  className={clsx({ [classes.scroll]: isHorizontallyScrollable })}
121
123
  {...addDataAttributes({
122
124
  scrolled: isHorizontallyScrolled ? true : undefined,
123
- scrollable: isHorizontallyScrollable && hasHorizontalScrollBar(ref.current),
125
+ scrollable: isHorizontallyScrollable && hasScrollBar ? true : undefined,
124
126
  })}
125
127
  >
126
128
  <table className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>