@heartlandone/vega-react 1.37.0 → 1.38.1
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/dist/hooks/use-vega-ref.d.ts +15 -0
- package/dist/hooks/use-vega-ref.js +20 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type VegaRef<T> = {
|
|
2
|
+
current: T;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* useVegaRef returns a callback that can be used to store a reference to a DOM node.
|
|
6
|
+
* It will be overridden to type {@link VegaRef} which value is stored by the callback
|
|
7
|
+
*
|
|
8
|
+
* Note: use `useVegaRef` instead `useRef` to store the reference of the Vega components when using `FeatureFlag.enable("VEGA_REACT.PREVENT_SSR");` to disable the SSR
|
|
9
|
+
*
|
|
10
|
+
* See more info here: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
|
|
11
|
+
* Link issue: https://gethired.atlassian.net/browse/VD-1297
|
|
12
|
+
*
|
|
13
|
+
* @returns {VegaRef} a callback function of type `VegaRef<T>`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useVegaRef<T>(): VegaRef<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* useVegaRef returns a callback that can be used to store a reference to a DOM node.
|
|
4
|
+
* It will be overridden to type {@link VegaRef} which value is stored by the callback
|
|
5
|
+
*
|
|
6
|
+
* Note: use `useVegaRef` instead `useRef` to store the reference of the Vega components when using `FeatureFlag.enable("VEGA_REACT.PREVENT_SSR");` to disable the SSR
|
|
7
|
+
*
|
|
8
|
+
* See more info here: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
|
|
9
|
+
* Link issue: https://gethired.atlassian.net/browse/VD-1297
|
|
10
|
+
*
|
|
11
|
+
* @returns {VegaRef} a callback function of type `VegaRef<T>`.
|
|
12
|
+
*/
|
|
13
|
+
export function useVegaRef() {
|
|
14
|
+
const [refState, setRefState] = useState(undefined);
|
|
15
|
+
const refCallback = useCallback((node) => {
|
|
16
|
+
setRefState(node);
|
|
17
|
+
}, []);
|
|
18
|
+
refCallback.current = refState;
|
|
19
|
+
return refCallback;
|
|
20
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./hooks/use-vega-ref";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./hooks/use-vega-ref";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heartlandone/vega-react",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.38.1",
|
|
5
5
|
"description": "React specific wrapper for @heartlandone/vega",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"stencil-postbuild": "node ./src/scripts/stencil-post-build-script.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript": "^4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@heartlandone/vega": "1.
|
|
41
|
+
"@heartlandone/vega": "1.38.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=16.7.0",
|