@onesy/ui-react 1.0.140 → 1.0.142

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.
@@ -217,7 +217,7 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
217
217
  if (sticky) {
218
218
  if (root) {
219
219
  let offsetOriginal = root.offsetLeft;
220
- const parentOverflow = (0, _utils2.getOverflowParent)(root.parentElement, false);
220
+ const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
221
221
  root.style.position = 'unset';
222
222
  offsetOriginal = root.offsetLeft;
223
223
  root.style.position = 'sticky';
@@ -233,12 +233,10 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
233
233
  offsetOriginal = root.offsetLeft;
234
234
  root.style.position = 'sticky';
235
235
  method();
236
- }, 150);
237
- if (parentOverflow) {
238
- parentOverflow.addEventListener('scroll', method, {
239
- passive: false
240
- });
241
- }
236
+ }, 400);
237
+ if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
238
+ passive: false
239
+ });
242
240
  return () => {
243
241
  if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
244
242
  };
@@ -92,17 +92,29 @@ const TableHead = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
92
92
  _react.default.useEffect(() => {
93
93
  if (sticky) {
94
94
  if (root) {
95
- const parentOverflow = (0, _utils2.getOverflowParent)(root);
96
- const offsetPrevious = root.offsetTop;
95
+ let offsetOriginal = root.offsetTop;
96
+ const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
97
+ root.style.position = 'unset';
98
+ offsetOriginal = root.offsetTop;
99
+ root.style.position = 'sticky';
97
100
  const method = () => {
98
101
  const offsetNew = root.offsetTop;
99
- setStickyActive(offsetPrevious !== offsetNew);
102
+ setStickyActive(offsetOriginal !== offsetNew);
100
103
  };
104
+
105
+ // initial
106
+ method();
107
+ setTimeout(() => {
108
+ root.style.position = 'unset';
109
+ offsetOriginal = root.offsetTop;
110
+ root.style.position = 'sticky';
111
+ method();
112
+ }, 400);
101
113
  if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
102
114
  passive: false
103
115
  });
104
116
  return () => {
105
- parentOverflow.removeEventListener('scroll', method);
117
+ if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
106
118
  };
107
119
  }
108
120
  }
@@ -12,7 +12,7 @@ import LineElement from '../Line';
12
12
  import IconButtonElement from '../IconButton';
13
13
  import TypeElement from '../Type';
14
14
  import DividerElement from '../Divider';
15
- import { getOverflowParent, staticClassName } from '../utils';
15
+ import { staticClassName } from '../utils';
16
16
  import Tooltip from '../Tooltip';
17
17
  import useResize from '../useResize';
18
18
  const useStyle = styleMethod(theme => ({
@@ -194,7 +194,7 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
194
194
  if (sticky) {
195
195
  if (root) {
196
196
  let offsetOriginal = root.offsetLeft;
197
- const parentOverflow = getOverflowParent(root.parentElement, false);
197
+ const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
198
198
  root.style.position = 'unset';
199
199
  offsetOriginal = root.offsetLeft;
200
200
  root.style.position = 'sticky';
@@ -210,12 +210,10 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
210
210
  offsetOriginal = root.offsetLeft;
211
211
  root.style.position = 'sticky';
212
212
  method();
213
- }, 150);
214
- if (parentOverflow) {
215
- parentOverflow.addEventListener('scroll', method, {
216
- passive: false
217
- });
218
- }
213
+ }, 400);
214
+ if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
215
+ passive: false
216
+ });
219
217
  return () => {
220
218
  if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
221
219
  };
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  import { is } from '@onesy/utils';
9
9
  import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
10
10
  import SurfaceElement from '../Surface';
11
- import { getOverflowParent, staticClassName } from '../utils';
11
+ import { staticClassName } from '../utils';
12
12
  import TableRowElement from '../TableRow';
13
13
  import LinearProgressElement from '../LinearProgress';
14
14
  const useStyle = styleMethod(theme => ({
@@ -73,17 +73,29 @@ const TableHead = /*#__PURE__*/React.forwardRef((props_, ref) => {
73
73
  React.useEffect(() => {
74
74
  if (sticky) {
75
75
  if (root) {
76
- const parentOverflow = getOverflowParent(root);
77
- const offsetPrevious = root.offsetTop;
76
+ let offsetOriginal = root.offsetTop;
77
+ const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
78
+ root.style.position = 'unset';
79
+ offsetOriginal = root.offsetTop;
80
+ root.style.position = 'sticky';
78
81
  const method = () => {
79
82
  const offsetNew = root.offsetTop;
80
- setStickyActive(offsetPrevious !== offsetNew);
83
+ setStickyActive(offsetOriginal !== offsetNew);
81
84
  };
85
+
86
+ // initial
87
+ method();
88
+ setTimeout(() => {
89
+ root.style.position = 'unset';
90
+ offsetOriginal = root.offsetTop;
91
+ root.style.position = 'sticky';
92
+ method();
93
+ }, 400);
82
94
  if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
83
95
  passive: false
84
96
  });
85
97
  return () => {
86
- parentOverflow.removeEventListener('scroll', method);
98
+ if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
87
99
  };
88
100
  }
89
101
  }
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.139
1
+ /** @license UiReact v1.0.141
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.139
1
+ /** @license UiReact v1.0.141
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.140",
3
+ "version": "1.0.142",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar Erić <lazareric1@proton.me>",