@dfds-ui/hooks 2.2.0-alpha.98e68873 → 2.2.0-alpha.9bb1ab0f
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/cjs/useDimensions.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface DimensionObject {
|
|
|
8
8
|
right: number;
|
|
9
9
|
bottom: number;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type UseDimensionsHook = [(node: HTMLElement | null) => void, DimensionObject, HTMLElement | null];
|
|
12
12
|
export interface UseDimensionsArgs {
|
|
13
13
|
liveMeasure?: boolean;
|
|
14
14
|
}
|
package/cjs/useDimensions.js
CHANGED
|
@@ -19,17 +19,13 @@ const EMPTY_DIMENSION_OBJECT = {
|
|
|
19
19
|
};
|
|
20
20
|
function getDimensionObject(node) {
|
|
21
21
|
const rect = node.getBoundingClientRect();
|
|
22
|
-
/** @ts-ignore */
|
|
23
|
-
const left = 'x' in rect ? rect.x : rect.left;
|
|
24
|
-
/** @ts-ignore */
|
|
25
|
-
const top = 'y' in rect ? rect.y : rect.top;
|
|
26
22
|
return {
|
|
27
23
|
width: rect.width,
|
|
28
24
|
height: rect.height,
|
|
29
|
-
x:
|
|
30
|
-
y:
|
|
31
|
-
top:
|
|
32
|
-
left:
|
|
25
|
+
x: rect.x,
|
|
26
|
+
y: rect.y,
|
|
27
|
+
top: rect.y,
|
|
28
|
+
left: rect.x,
|
|
33
29
|
right: rect.right,
|
|
34
30
|
bottom: rect.bottom
|
|
35
31
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React hooks",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.2.0-alpha.
|
|
6
|
+
"version": "2.2.0-alpha.9bb1ab0f",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"main": "./cjs/index.js",
|
|
9
9
|
"module": "./index.js",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"react-dom": ">= 18.3.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"use-resize-observer": "^9.0
|
|
17
|
+
"use-resize-observer": "^9.1.0"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "9bb1ab0fca74964da6edd580e53f175a223b4f49",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
}
|
package/useDimensions.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface DimensionObject {
|
|
|
8
8
|
right: number;
|
|
9
9
|
bottom: number;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type UseDimensionsHook = [(node: HTMLElement | null) => void, DimensionObject, HTMLElement | null];
|
|
12
12
|
export interface UseDimensionsArgs {
|
|
13
13
|
liveMeasure?: boolean;
|
|
14
14
|
}
|
package/useDimensions.js
CHANGED
|
@@ -18,17 +18,13 @@ var EMPTY_DIMENSION_OBJECT = {
|
|
|
18
18
|
};
|
|
19
19
|
function getDimensionObject(node) {
|
|
20
20
|
var rect = node.getBoundingClientRect();
|
|
21
|
-
/** @ts-ignore */
|
|
22
|
-
var left = 'x' in rect ? rect.x : rect.left;
|
|
23
|
-
/** @ts-ignore */
|
|
24
|
-
var top = 'y' in rect ? rect.y : rect.top;
|
|
25
21
|
return {
|
|
26
22
|
width: rect.width,
|
|
27
23
|
height: rect.height,
|
|
28
|
-
x:
|
|
29
|
-
y:
|
|
30
|
-
top:
|
|
31
|
-
left:
|
|
24
|
+
x: rect.x,
|
|
25
|
+
y: rect.y,
|
|
26
|
+
top: rect.y,
|
|
27
|
+
left: rect.x,
|
|
32
28
|
right: rect.right,
|
|
33
29
|
bottom: rect.bottom
|
|
34
30
|
};
|