@trackunit/react-components 1.9.26 → 1.9.28

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/index.cjs.js CHANGED
@@ -1327,15 +1327,30 @@ const useElevatedState = (initialState, customState) => {
1327
1327
  * Size and position of the element relative to the viewport.
1328
1328
  */
1329
1329
  const useGeometry = (ref, { skip = false } = {}) => {
1330
- const [geometry, setGeometry] = react.useState({
1331
- width: 0,
1332
- height: 0,
1333
- top: 0,
1334
- bottom: 0,
1335
- left: 0,
1336
- right: 0,
1337
- x: 0,
1338
- y: 0,
1330
+ const [geometry, setGeometry] = react.useState(() => {
1331
+ const rect = ref.current?.getBoundingClientRect();
1332
+ if (!rect) {
1333
+ return {
1334
+ width: 0,
1335
+ height: 0,
1336
+ top: 0,
1337
+ bottom: 0,
1338
+ left: 0,
1339
+ right: 0,
1340
+ x: 0,
1341
+ y: 0,
1342
+ };
1343
+ }
1344
+ return {
1345
+ width: rect.width,
1346
+ height: rect.height,
1347
+ top: rect.top,
1348
+ bottom: rect.bottom,
1349
+ left: rect.left,
1350
+ right: rect.right,
1351
+ x: rect.x,
1352
+ y: rect.y,
1353
+ };
1339
1354
  });
1340
1355
  const resizeObserver = react.useRef(null);
1341
1356
  react.useEffect(() => {
package/index.esm.js CHANGED
@@ -1325,15 +1325,30 @@ const useElevatedState = (initialState, customState) => {
1325
1325
  * Size and position of the element relative to the viewport.
1326
1326
  */
1327
1327
  const useGeometry = (ref, { skip = false } = {}) => {
1328
- const [geometry, setGeometry] = useState({
1329
- width: 0,
1330
- height: 0,
1331
- top: 0,
1332
- bottom: 0,
1333
- left: 0,
1334
- right: 0,
1335
- x: 0,
1336
- y: 0,
1328
+ const [geometry, setGeometry] = useState(() => {
1329
+ const rect = ref.current?.getBoundingClientRect();
1330
+ if (!rect) {
1331
+ return {
1332
+ width: 0,
1333
+ height: 0,
1334
+ top: 0,
1335
+ bottom: 0,
1336
+ left: 0,
1337
+ right: 0,
1338
+ x: 0,
1339
+ y: 0,
1340
+ };
1341
+ }
1342
+ return {
1343
+ width: rect.width,
1344
+ height: rect.height,
1345
+ top: rect.top,
1346
+ bottom: rect.bottom,
1347
+ left: rect.left,
1348
+ right: rect.right,
1349
+ x: rect.x,
1350
+ y: rect.y,
1351
+ };
1337
1352
  });
1338
1353
  const resizeObserver = useRef(null);
1339
1354
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.9.26",
3
+ "version": "1.9.28",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -16,11 +16,11 @@
16
16
  "@floating-ui/react": "^0.26.25",
17
17
  "string-ts": "^2.0.0",
18
18
  "tailwind-merge": "^2.0.0",
19
- "@trackunit/ui-design-tokens": "1.7.17",
20
- "@trackunit/css-class-variance-utilities": "1.7.16",
21
- "@trackunit/shared-utils": "1.9.16",
22
- "@trackunit/ui-icons": "1.7.18",
23
- "@trackunit/react-test-setup": "1.4.16",
19
+ "@trackunit/ui-design-tokens": "1.7.19",
20
+ "@trackunit/css-class-variance-utilities": "1.7.18",
21
+ "@trackunit/shared-utils": "1.9.18",
22
+ "@trackunit/ui-icons": "1.7.20",
23
+ "@trackunit/react-test-setup": "1.4.18",
24
24
  "@tanstack/react-router": "1.114.29",
25
25
  "es-toolkit": "^1.39.10",
26
26
  "@tanstack/react-virtual": "3.13.12"