@ai-matrx/design-system 0.21.11 → 0.21.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.
@@ -8633,6 +8633,10 @@ function TableToolbarAction({
8633
8633
  function hasSameRowReferences(previous, next) {
8634
8634
  return previous.length === next.length && previous.every((row, index) => row === next[index]);
8635
8635
  }
8636
+ var VERTICAL_SCROLL_GEOMETRY_TOLERANCE_PX = 2;
8637
+ function hasUsableVerticalScroll(element) {
8638
+ return element.scrollHeight - element.clientHeight > VERTICAL_SCROLL_GEOMETRY_TOLERANCE_PX;
8639
+ }
8636
8640
  function TableRowCopyControl({
8637
8641
  copy,
8638
8642
  row,
@@ -9148,7 +9152,7 @@ function MatrxDataTableCore({
9148
9152
  if (!scroll || !table || !header || !stickyHeader) return;
9149
9153
  let frame = 0;
9150
9154
  const update = () => {
9151
- const hasInternalVerticalScroll = scroll.scrollHeight > scroll.clientHeight + 1;
9155
+ const hasInternalVerticalScroll = hasUsableVerticalScroll(scroll);
9152
9156
  const nextDocumentSticky = !hasInternalVerticalScroll;
9153
9157
  if (documentStickyHeaderRef.current !== nextDocumentSticky) {
9154
9158
  documentStickyHeaderRef.current = nextDocumentSticky;
@@ -9168,7 +9172,7 @@ function MatrxDataTableCore({
9168
9172
  for (let ancestor = scroll.parentElement; ancestor; ancestor = ancestor.parentElement) {
9169
9173
  const ancestorStyle = window.getComputedStyle(ancestor);
9170
9174
  const overflowY = ancestorStyle.overflowY;
9171
- if (/^(auto|scroll|overlay)$/.test(overflowY) && ancestor.scrollHeight > ancestor.clientHeight + 1) {
9175
+ if (/^(auto|scroll|overlay)$/.test(overflowY) && hasUsableVerticalScroll(ancestor)) {
9172
9176
  const scrollPaddingTop = Number.parseFloat(ancestorStyle.scrollPaddingTop) || 0;
9173
9177
  scrollTargetTop = ancestor.getBoundingClientRect().top + scrollPaddingTop;
9174
9178
  break;