@unovis/react 1.1.2-beta.0 → 1.1.2-beta.2

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.
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { NestedDonut, NestedDonutConfigInterface } from '@unovis/ts';
3
+ export declare type VisNestedDonutRef<Datum> = {
4
+ component?: NestedDonut<Datum>;
5
+ };
6
+ export declare type VisNestedDonutProps<Datum> = NestedDonutConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisNestedDonutRef<Datum>>;
9
+ };
10
+ export declare const VisNestedDonut: (<Datum>(props: VisNestedDonutProps<Datum>) => JSX.Element | null);
@@ -0,0 +1,30 @@
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
+ import { NestedDonut } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisNestedDonutFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const componentRef = useRef(undefined);
8
+ useEffect(() => {
9
+ const element = ref.current;
10
+ const c = new NestedDonut(props);
11
+ componentRef.current = c;
12
+ element.__component__ = c;
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
17
+ }, []);
18
+ useEffect(() => {
19
+ const component = componentRef.current;
20
+ if (props.data)
21
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
22
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
23
+ });
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
25
+ return React.createElement("vis-component", { ref: ref });
26
+ }
27
+ const VisNestedDonut = React.memo(React.forwardRef(VisNestedDonutFC), arePropsEqual);
28
+
29
+ export { VisNestedDonut };
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/nested-donut/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { NestedDonut, NestedDonutConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisNestedDonutRef<Datum> = {\n component?: NestedDonut<Datum>;\n}\n\nexport type VisNestedDonutProps<Datum> = NestedDonutConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisNestedDonutRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisNestedDonutFC<Datum> (props: VisNestedDonutProps<Datum>, fRef: ForwardedRef<VisNestedDonutRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<NestedDonut<Datum>>>(null)\n const componentRef = useRef<NestedDonut<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<NestedDonut<Datum>>)\n\n const c = new NestedDonut<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisNestedDonut: (<Datum>(props: VisNestedDonutProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisNestedDonutFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,gBAAgB,CAAS,KAAiC,EAAE,IAA4C,EAAA;AAC/G,IAAA,MAAM,GAAG,GAAG,MAAM,CAA0C,IAAI,CAAC,CAAA;AACjE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAiC,SAAS,CAAC,CAAA;IAGtE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAmD,CAAA;AAExE,QAAA,MAAM,CAAC,GAAG,IAAI,WAAW,CAAQ,KAAK,CAAC,CAAA;AACvC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,cAAc,GAAuE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,aAAa;;;;"}
package/components.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './components/donut';
8
8
  export * from './components/free-brush';
9
9
  export * from './components/graph';
10
10
  export * from './components/grouped-bar/';
11
+ export * from './components/nested-donut';
11
12
  export * from './components/scatter/';
12
13
  export * from './components/sankey';
13
14
  export * from './components/stacked-bar/';
package/index.js CHANGED
@@ -10,6 +10,7 @@ export { VisDonut } from './components/donut/index.js';
10
10
  export { VisFreeBrush } from './components/free-brush/index.js';
11
11
  export { VisGraph } from './components/graph/index.js';
12
12
  export { VisGroupedBar } from './components/grouped-bar/index.js';
13
+ export { VisNestedDonut } from './components/nested-donut/index.js';
13
14
  export { VisScatter } from './components/scatter/index.js';
14
15
  export { VisSankey } from './components/sankey/index.js';
15
16
  export { VisStackedBar } from './components/stacked-bar/index.js';
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unovis/react",
3
3
  "description": "Modular data visualization framework for React, Angular, Svelte, and vanilla TypeScript or JavaScript",
4
- "version": "1.1.2-beta.0",
4
+ "version": "1.1.2-beta.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/f5/unovis.git",
@@ -35,7 +35,7 @@
35
35
  "publish:dist": "rm -rf dist/.cache; cp ./{LICENSE,README.md,package.json} ./dist; cd ./dist; npm publish"
36
36
  },
37
37
  "peerDependencies": {
38
- "@unovis/ts": "1.1.2-beta.0",
38
+ "@unovis/ts": "1.1.2-beta.2",
39
39
  "react": ">=16.8.0 || ^17 || ^18",
40
40
  "react-dom": ">=16.8.0 || ^17 || ^18"
41
41
  },