@unovis/react 1.0.0-beta.0

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.
Files changed (112) hide show
  1. package/LICENSE +193 -0
  2. package/components/area/index.d.ts +10 -0
  3. package/components/area/index.js +22 -0
  4. package/components/area/index.js.map +1 -0
  5. package/components/axis/index.d.ts +10 -0
  6. package/components/axis/index.js +22 -0
  7. package/components/axis/index.js.map +1 -0
  8. package/components/brush/index.d.ts +10 -0
  9. package/components/brush/index.js +22 -0
  10. package/components/brush/index.js.map +1 -0
  11. package/components/chord-diagram/index.d.ts +13 -0
  12. package/components/crosshair/index.d.ts +10 -0
  13. package/components/crosshair/index.js +22 -0
  14. package/components/crosshair/index.js.map +1 -0
  15. package/components/donut/index.d.ts +10 -0
  16. package/components/donut/index.js +22 -0
  17. package/components/donut/index.js.map +1 -0
  18. package/components/free-brush/index.d.ts +10 -0
  19. package/components/free-brush/index.js +22 -0
  20. package/components/free-brush/index.js.map +1 -0
  21. package/components/graph/index.d.ts +10 -0
  22. package/components/graph/index.js +22 -0
  23. package/components/graph/index.js.map +1 -0
  24. package/components/grouped-bar/index.d.ts +10 -0
  25. package/components/grouped-bar/index.js +22 -0
  26. package/components/grouped-bar/index.js.map +1 -0
  27. package/components/line/index.d.ts +10 -0
  28. package/components/line/index.js +22 -0
  29. package/components/line/index.js.map +1 -0
  30. package/components/sankey/index.d.ts +10 -0
  31. package/components/sankey/index.js +22 -0
  32. package/components/sankey/index.js.map +1 -0
  33. package/components/scatter/index.d.ts +10 -0
  34. package/components/scatter/index.js +22 -0
  35. package/components/scatter/index.js.map +1 -0
  36. package/components/stacked-bar/index.d.ts +10 -0
  37. package/components/stacked-bar/index.js +22 -0
  38. package/components/stacked-bar/index.js.map +1 -0
  39. package/components/timeline/index.d.ts +10 -0
  40. package/components/timeline/index.js +22 -0
  41. package/components/timeline/index.js.map +1 -0
  42. package/components/tooltip/index.d.ts +10 -0
  43. package/components/tooltip/index.js +20 -0
  44. package/components/tooltip/index.js.map +1 -0
  45. package/components/topojson-map/index.d.ts +14 -0
  46. package/components/topojson-map/index.js +22 -0
  47. package/components/topojson-map/index.js.map +1 -0
  48. package/components/xy-labels/index.d.ts +10 -0
  49. package/components/xy-labels/index.js +22 -0
  50. package/components/xy-labels/index.js.map +1 -0
  51. package/components.d.ts +19 -0
  52. package/composites/time-series/index.d.ts +54 -0
  53. package/composites/time-series/index.js +63 -0
  54. package/composites/time-series/index.js.map +1 -0
  55. package/composites/time-series/style.d.ts +3 -0
  56. package/composites/time-series/style.js +21 -0
  57. package/composites/time-series/style.js.map +1 -0
  58. package/composites.d.ts +1 -0
  59. package/containers/single-container/index.d.ts +6 -0
  60. package/containers/single-container/index.js +31 -0
  61. package/containers/single-container/index.js.map +1 -0
  62. package/containers/xy-container/index.d.ts +8 -0
  63. package/containers/xy-container/index.js +39 -0
  64. package/containers/xy-container/index.js.map +1 -0
  65. package/containers.d.ts +2 -0
  66. package/html-components/bullet-legend/index.d.ts +3 -0
  67. package/html-components/bullet-legend/index.js +18 -0
  68. package/html-components/bullet-legend/index.js.map +1 -0
  69. package/html-components/leaflet-flow-map/index.d.ts +15 -0
  70. package/html-components/leaflet-flow-map/index.js +23 -0
  71. package/html-components/leaflet-flow-map/index.js.map +1 -0
  72. package/html-components/leaflet-map/index.d.ts +12 -0
  73. package/html-components/leaflet-map/index.js +23 -0
  74. package/html-components/leaflet-map/index.js.map +1 -0
  75. package/index.d.ts +3 -0
  76. package/index.js +23 -0
  77. package/index.js.map +1 -0
  78. package/package.json +41 -0
  79. package/src/components/area/index.d.ts +10 -0
  80. package/src/components/axis/index.d.ts +10 -0
  81. package/src/components/brush/index.d.ts +10 -0
  82. package/src/components/chord-diagram/index.d.ts +13 -0
  83. package/src/components/crosshair/index.d.ts +10 -0
  84. package/src/components/donut/index.d.ts +10 -0
  85. package/src/components/free-brush/index.d.ts +10 -0
  86. package/src/components/graph/index.d.ts +10 -0
  87. package/src/components/grouped-bar/index.d.ts +10 -0
  88. package/src/components/line/index.d.ts +10 -0
  89. package/src/components/sankey/index.d.ts +10 -0
  90. package/src/components/scatter/index.d.ts +10 -0
  91. package/src/components/stacked-bar/index.d.ts +10 -0
  92. package/src/components/timeline/index.d.ts +10 -0
  93. package/src/components/tooltip/index.d.ts +10 -0
  94. package/src/components/topojson-map/index.d.ts +14 -0
  95. package/src/components/xy-labels/index.d.ts +10 -0
  96. package/src/components.d.ts +19 -0
  97. package/src/composites/time-series/index.d.ts +54 -0
  98. package/src/composites/time-series/style.d.ts +3 -0
  99. package/src/composites.d.ts +1 -0
  100. package/src/containers/single-container/index.d.ts +6 -0
  101. package/src/containers/xy-container/index.d.ts +8 -0
  102. package/src/containers.d.ts +2 -0
  103. package/src/html-components/bullet-legend/index.d.ts +3 -0
  104. package/src/html-components/leaflet-flow-map/index.d.ts +15 -0
  105. package/src/html-components/leaflet-map/index.d.ts +12 -0
  106. package/src/index.d.ts +3 -0
  107. package/src/types/dom.d.ts +3 -0
  108. package/src/utils/react.d.ts +4 -0
  109. package/types/dom.d.ts +3 -0
  110. package/utils/react.d.ts +4 -0
  111. package/utils/react.js +27 -0
  112. package/utils/react.js.map +1 -0
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { Sankey } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisSankeyFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new Sankey(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisSankey = React.memo(React.forwardRef(VisSankeyFC), arePropsEqual);
20
+
21
+ export { VisSankey };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/sankey/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Sankey, SankeyConfigInterface, SankeyInputNode, SankeyInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSankeyRef<N extends SankeyInputNode, L extends SankeyInputLink> = {\n component: Sankey<N, L>;\n}\n\nexport type VisSankeyProps<N extends SankeyInputNode, L extends SankeyInputLink> = SankeyConfigInterface<N, L> & {\n data?: any;\n ref?: Ref<VisSankeyRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSankeyFC<N extends SankeyInputNode, L extends SankeyInputLink> (props: VisSankeyProps<N, L>, fRef: ForwardedRef<VisSankeyRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Sankey<N, L>>>(null)\n const [component] = useState<Sankey<N, L>>(new Sankey(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<Sankey<N, L>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisSankey: (<N extends SankeyInputNode, L extends SankeyInputLink>(props: VisSankeyProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisSankeyFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,WAAW,CAAwD,KAA2B,EAAE,IAAsC,EAAA;AAC7I,IAAA,MAAM,GAAG,GAAG,MAAM,CAAoC,IAAI,CAAC,CAAA;AAC3D,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAe,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAG7D,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAA6C,CAAC,aAAa,GAAG,SAAS,CAAA;KAC7E,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,SAAS,GAAgH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { Scatter, ScatterConfigInterface } from '@unovis/ts';
3
+ export declare type VisScatterRef<Datum> = {
4
+ component: Scatter<Datum>;
5
+ };
6
+ export declare type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisScatterRef<Datum>>;
9
+ };
10
+ export declare const VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null);
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { Scatter } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisScatterFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new Scatter(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisScatter = React.memo(React.forwardRef(VisScatterFC), arePropsEqual);
20
+
21
+ export { VisScatter };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/scatter/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Scatter, ScatterConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisScatterRef<Datum> = {\n component: Scatter<Datum>;\n}\n\nexport type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisScatterRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisScatterFC<Datum> (props: VisScatterProps<Datum>, fRef: ForwardedRef<VisScatterRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Scatter<Datum>>>(null)\n const [component] = useState<Scatter<Datum>>(new Scatter(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<Scatter<Datum>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisScatterFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAS,KAA6B,EAAE,IAAwC,EAAA;AACnG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAsC,IAAI,CAAC,CAAA;AAC7D,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAiB,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAGhE,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAA+C,CAAC,aAAa,GAAG,SAAS,CAAA;KAC/E,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,UAAU,GAAmE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { StackedBar, StackedBarConfigInterface } from '@unovis/ts';
3
+ export declare type VisStackedBarRef<Datum> = {
4
+ component: StackedBar<Datum>;
5
+ };
6
+ export declare type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisStackedBarRef<Datum>>;
9
+ };
10
+ export declare const VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null);
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { StackedBar } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisStackedBarFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new StackedBar(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisStackedBar = React.memo(React.forwardRef(VisStackedBarFC), arePropsEqual);
20
+
21
+ export { VisStackedBar };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/stacked-bar/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { StackedBar, StackedBarConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisStackedBarRef<Datum> = {\n component: StackedBar<Datum>;\n}\n\nexport type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisStackedBarRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisStackedBarFC<Datum> (props: VisStackedBarProps<Datum>, fRef: ForwardedRef<VisStackedBarRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<StackedBar<Datum>>>(null)\n const [component] = useState<StackedBar<Datum>>(new StackedBar(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<StackedBar<Datum>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisStackedBarFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,eAAe,CAAS,KAAgC,EAAE,IAA2C,EAAA;AAC5G,IAAA,MAAM,GAAG,GAAG,MAAM,CAAyC,IAAI,CAAC,CAAA;AAChE,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IAGtE,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAAkD,CAAC,aAAa,GAAG,SAAS,CAAA;KAClF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,aAAa,GAAsE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { Timeline, TimelineConfigInterface } from '@unovis/ts';
3
+ export declare type VisTimelineRef<Datum> = {
4
+ component: Timeline<Datum>;
5
+ };
6
+ export declare type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisTimelineRef<Datum>>;
9
+ };
10
+ export declare const VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null);
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { Timeline } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisTimelineFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new Timeline(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisTimeline = React.memo(React.forwardRef(VisTimelineFC), arePropsEqual);
20
+
21
+ export { VisTimeline };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Timeline, TimelineConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTimelineRef<Datum> = {\n component: Timeline<Datum>;\n}\n\nexport type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisTimelineRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTimelineFC<Datum> (props: VisTimelineProps<Datum>, fRef: ForwardedRef<VisTimelineRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Timeline<Datum>>>(null)\n const [component] = useState<Timeline<Datum>>(new Timeline(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<Timeline<Datum>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTimelineFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,aAAa,CAAS,KAA8B,EAAE,IAAyC,EAAA;AACtG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;AAC9D,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAkB,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;IAGlE,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAAgD,CAAC,aAAa,GAAG,SAAS,CAAA;KAChF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,WAAW,GAAoE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { Tooltip, TooltipConfigInterface } from '@unovis/ts';
3
+ export declare type VisTooltipRef = {
4
+ component: Tooltip;
5
+ };
6
+ export declare type VisTooltipProps = TooltipConfigInterface & {
7
+ data?: null;
8
+ ref?: Ref<VisTooltipRef>;
9
+ };
10
+ export declare const VisTooltip: ((props: VisTooltipProps) => JSX.Element | null);
@@ -0,0 +1,20 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { Tooltip } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisTooltipFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new Tooltip(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
13
+ });
14
+ useImperativeHandle(fRef, () => ({ component }));
15
+ return React.createElement("vis-tooltip", { ref: ref });
16
+ }
17
+ const VisTooltip = React.memo(React.forwardRef(VisTooltipFC), arePropsEqual);
18
+
19
+ export { VisTooltip };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Tooltip, TooltipConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTooltipRef = {\n component: Tooltip;\n}\n\nexport type VisTooltipProps = TooltipConfigInterface & {\n data?: null;\n ref?: Ref<VisTooltipRef>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTooltipFC (props: VisTooltipProps, fRef: ForwardedRef<VisTooltipRef>): JSX.Element {\n const ref = useRef<VisComponentElement<Tooltip>>(null)\n const [component] = useState<Tooltip>(new Tooltip(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<Tooltip>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\n return <vis-tooltip 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 VisTooltip: ((props: VisTooltipProps) => JSX.Element | null) = React.memo(React.forwardRef(VisTooltipFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAE,KAAsB,EAAE,IAAiC,EAAA;AAC9E,IAAA,MAAM,GAAG,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAA;AACtD,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAGzD,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAAwC,CAAC,aAAa,GAAG,SAAS,CAAA;KACxE,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAa,CAAA,aAAA,CAAA,aAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AAClC,CAAC;AAIY,MAAA,UAAU,GAAqD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,14 @@
1
+ import { Ref } from 'react';
2
+ import { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts';
3
+ export declare type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {
4
+ component: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;
5
+ };
6
+ export declare type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {
7
+ data?: {
8
+ areas?: AreaDatum[];
9
+ points?: PointDatum[];
10
+ links?: LinkDatum[];
11
+ };
12
+ ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;
13
+ };
14
+ export declare const VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null);
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { TopoJSONMap } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisTopoJSONMapFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new TopoJSONMap(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisTopoJSONMap = React.memo(React.forwardRef(VisTopoJSONMapFC), arePropsEqual);
20
+
21
+ export { VisTopoJSONMap };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/topojson-map/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {\n component: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;\n}\n\nexport type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {\n data?: {areas?: AreaDatum[]; points?: PointDatum[]; links?: LinkDatum[]};\n ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTopoJSONMapFC<AreaDatum, PointDatum, LinkDatum> (props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>, fRef: ForwardedRef<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>): JSX.Element {\n const ref = useRef<VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>>(null)\n const [component] = useState<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>(new TopoJSONMap(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTopoJSONMapFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,gBAAgB,CAAoC,KAA4D,EAAE,IAAuE,EAAA;AAChM,IAAA,MAAM,GAAG,GAAG,MAAM,CAAqE,IAAI,CAAC,CAAA;AAC5F,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAgD,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;IAGnG,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAA8E,CAAC,aAAa,GAAG,SAAS,CAAA;KAC9G,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,cAAc,GAA6H,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'react';
2
+ import { XYLabels, XYLabelsConfigInterface } from '@unovis/ts';
3
+ export declare type VisXYLabelsRef<Datum> = {
4
+ component: XYLabels<Datum>;
5
+ };
6
+ export declare type VisXYLabelsProps<Datum> = XYLabelsConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisXYLabelsRef<Datum>>;
9
+ };
10
+ export declare const VisXYLabels: (<Datum>(props: VisXYLabelsProps<Datum>) => JSX.Element | null);
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
+ import { XYLabels } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisXYLabelsFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const [component] = useState(new XYLabels(props));
8
+ useEffect(() => {
9
+ ref.current.__component__ = component;
10
+ }, []);
11
+ useEffect(() => {
12
+ if (props.data)
13
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
14
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
15
+ });
16
+ useImperativeHandle(fRef, () => ({ component }));
17
+ return React.createElement("vis-component", { ref: ref });
18
+ }
19
+ const VisXYLabels = React.memo(React.forwardRef(VisXYLabelsFC), arePropsEqual);
20
+
21
+ export { VisXYLabels };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/xy-labels/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { XYLabels, XYLabelsConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisXYLabelsRef<Datum> = {\n component: XYLabels<Datum>;\n}\n\nexport type VisXYLabelsProps<Datum> = XYLabelsConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisXYLabelsRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisXYLabelsFC<Datum> (props: VisXYLabelsProps<Datum>, fRef: ForwardedRef<VisXYLabelsRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<XYLabels<Datum>>>(null)\n const [component] = useState<XYLabels<Datum>>(new XYLabels(props))\n\n // On Mount\n useEffect(() => {\n (ref.current as VisComponentElement<XYLabels<Datum>>).__component__ = component\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }))\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 VisXYLabels: (<Datum>(props: VisXYLabelsProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisXYLabelsFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,aAAa,CAAS,KAA8B,EAAE,IAAyC,EAAA;AACtG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;AAC9D,IAAA,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAkB,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;IAGlE,SAAS,CAAC,MAAK;AACZ,QAAA,GAAG,CAAC,OAAgD,CAAC,aAAa,GAAG,SAAS,CAAA;KAChF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAChD,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,WAAW,GAAoE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,19 @@
1
+ export * from './components/line';
2
+ export * from './components/area';
3
+ export * from './components/axis';
4
+ export * from './components/brush/';
5
+ export * from './components/free-brush';
6
+ export * from './components/crosshair/';
7
+ export * from './components/donut/';
8
+ export * from './components/graph';
9
+ export * from './components/grouped-bar/';
10
+ export * from './components/scatter/';
11
+ export * from './components/sankey';
12
+ export * from './components/stacked-bar/';
13
+ export * from './components/tooltip/';
14
+ export * from './components/timeline/';
15
+ export * from './components/topojson-map/';
16
+ export * from './components/xy-labels';
17
+ export * from './html-components/bullet-legend';
18
+ export * from './html-components/leaflet-map';
19
+ export * from './html-components/leaflet-flow-map';
@@ -0,0 +1,54 @@
1
+ import { Spacing } from '@unovis/ts';
2
+ export declare type VisTimeSeriesDatum = {
3
+ timestamp: number;
4
+ value: number;
5
+ id?: string;
6
+ color?: string;
7
+ };
8
+ export declare type VisTimeSeriesProps<Datum> = {
9
+ data: Datum[];
10
+ margin: Spacing;
11
+ autoMargin: boolean;
12
+ x: (d: Datum, i: number) => number;
13
+ y: (d: Datum, i: number) => number;
14
+ id: (d: Datum, i: number) => string;
15
+ color: (d: Datum, i: number) => string;
16
+ cursor: string | ((d: Datum, i: number) => string);
17
+ formatXTicks?: (timestamp: number) => string;
18
+ formatYTicks?: (timestamp: number) => string;
19
+ selectionMinLength: number;
20
+ onBrushStart?: (selection: [number, number], e?: {
21
+ sourceEvent: MouseEvent;
22
+ }, userDriven?: boolean) => void;
23
+ onBrushMove?: (selection: [number, number], e?: {
24
+ sourceEvent: MouseEvent;
25
+ }, userDriven?: boolean) => void;
26
+ onBrushEnd?: (selection: [number, number], e?: {
27
+ sourceEvent: MouseEvent;
28
+ }, userDriven?: boolean) => void;
29
+ formatNavXTicks?: (timestamp: number) => string;
30
+ xLabel?: string;
31
+ yLabel?: string;
32
+ crosshairTemplate?: (d: Datum) => string | HTMLElement;
33
+ className?: string;
34
+ height?: string;
35
+ };
36
+ export declare function VisTimeSeries<Datum>(props: VisTimeSeriesProps<Datum>): JSX.Element;
37
+ export declare namespace VisTimeSeries {
38
+ var defaultProps: {
39
+ margin: {
40
+ top: number;
41
+ bottom: number;
42
+ left: number;
43
+ right: number;
44
+ };
45
+ autoMargin: boolean;
46
+ padding: {};
47
+ x: (d: VisTimeSeriesDatum) => number;
48
+ y: (d: VisTimeSeriesDatum) => number;
49
+ id: (d: VisTimeSeriesDatum) => string | undefined;
50
+ color: (d: VisTimeSeriesDatum) => string | undefined;
51
+ formatYTicks: (d: number) => string;
52
+ crosshairTemplate: (d: VisTimeSeriesDatum) => string;
53
+ };
54
+ }
@@ -0,0 +1,63 @@
1
+ import React, { useState, useMemo } from 'react';
2
+ import { cx } from '@emotion/css';
3
+ import { Scale, TextAlign } from '@unovis/ts';
4
+ import { VisXYContainer } from '../../containers/xy-container/index.js';
5
+ import { VisArea } from '../../components/area/index.js';
6
+ import { VisAxis } from '../../components/axis/index.js';
7
+ import { VisCrosshair } from '../../components/crosshair/index.js';
8
+ import { VisTooltip } from '../../components/tooltip/index.js';
9
+ import { VisBrush } from '../../components/brush/index.js';
10
+ import { timeSeriesContainer, timeSeriesModule, navigationModule } from './style.js';
11
+
12
+ function VisTimeSeries(props) {
13
+ var _a;
14
+ const [selectedRange, setSelectedRange] = useState(undefined);
15
+ const [animationDuration, setAnimationDuration] = useState(0);
16
+ const xScale = useMemo(() => Scale.scaleTime(), []);
17
+ const xScaleNav = useMemo(() => Scale.scaleTime(), []);
18
+ const onBrushStart = useMemo(() => (selection, e, userDriven) => {
19
+ var _a;
20
+ if (userDriven)
21
+ setAnimationDuration(0);
22
+ (_a = props.onBrushStart) === null || _a === void 0 ? void 0 : _a.call(props, selection, e, userDriven);
23
+ }, []);
24
+ const onBrushMove = useMemo(() => (selection, e, userDriven) => {
25
+ var _a;
26
+ if (userDriven && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange[0]) !== selection[0] && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange[1]) !== selection[1])
27
+ setSelectedRange(selection);
28
+ (_a = props.onBrushMove) === null || _a === void 0 ? void 0 : _a.call(props, selection, e, userDriven);
29
+ }, []);
30
+ const onBrushEnd = useMemo(() => (selection, e, userDriven) => {
31
+ var _a;
32
+ if (userDriven && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange[0]) !== selection[0] && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange[1]) !== selection[1])
33
+ setSelectedRange(selection);
34
+ setAnimationDuration(undefined);
35
+ (_a = props.onBrushEnd) === null || _a === void 0 ? void 0 : _a.call(props, selection, e, userDriven);
36
+ }, []);
37
+ return (React.createElement("div", { className: cx(timeSeriesContainer, props.className), style: { height: props.height } },
38
+ React.createElement(VisXYContainer, { className: timeSeriesModule, data: props.data, xScale: xScale, xDomain: selectedRange, duration: animationDuration, scaleByDomain: true },
39
+ React.createElement(VisArea, { x: props.x, y: props.y, color: props.color }),
40
+ React.createElement(VisAxis, { type: 'x', numTicks: 5, tickFormat: props.formatXTicks, tickTextAlign: TextAlign.Center }),
41
+ React.createElement(VisAxis, { type: 'y', tickFormat: props.formatYTicks, label: props.yLabel }),
42
+ React.createElement(VisTooltip, null),
43
+ React.createElement(VisCrosshair, { template: props.crosshairTemplate })),
44
+ React.createElement(VisXYContainer, { className: navigationModule, duration: 0, xScale: xScaleNav, data: props.data },
45
+ React.createElement(VisArea, { x: props.x, y: props.y }),
46
+ React.createElement(VisBrush, { draggable: true, onBrushStart: onBrushStart, onBrushMove: onBrushMove, onBrushEnd: onBrushEnd }),
47
+ React.createElement(VisAxis, { type: 'x', numTicks: 5, tickFormat: (_a = props.formatXTicks) !== null && _a !== void 0 ? _a : props.formatNavXTicks, tickTextAlign: TextAlign.Right, label: props.xLabel }),
48
+ React.createElement(VisAxis, { type: 'y', tickFormat: props.formatYTicks, minMaxTicksOnly: true, label: props.yLabel ? ' ' : undefined }))));
49
+ }
50
+ VisTimeSeries.defaultProps = {
51
+ margin: { top: 10, bottom: 10, left: 10, right: 10 },
52
+ autoMargin: true,
53
+ padding: {},
54
+ x: (d) => d.timestamp,
55
+ y: (d) => d.value,
56
+ id: (d) => d.id,
57
+ color: (d) => d.color,
58
+ formatYTicks: (d) => d.toFixed(1),
59
+ crosshairTemplate: (d) => { var _a; return `<div>Date: ${new Date(d.timestamp).toLocaleDateString()}</div><div>Value: ${(_a = d.value) === null || _a === void 0 ? void 0 : _a.toFixed(1)}</div>`; },
60
+ };
61
+
62
+ export { VisTimeSeries };
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/composites/time-series/index.tsx"],"sourcesContent":["import React, { useState, useMemo } from 'react'\nimport { cx } from '@emotion/css'\nimport { Spacing, TextAlign, Scale } from '@unovis/ts'\nimport { VisXYContainer } from '@unovis/react/containers/xy-container'\nimport { VisArea } from '@unovis/react/components/area'\nimport { VisAxis } from '@unovis/react/components/axis'\nimport { VisCrosshair } from '@unovis/react/components/crosshair'\nimport { VisTooltip } from '@unovis/react/components/tooltip'\nimport { VisBrush } from '@unovis/react/components/brush'\n\nimport * as s from './style'\n\nexport type VisTimeSeriesDatum = {\n timestamp: number;\n value: number;\n id?: string;\n color?: string;\n}\n\nexport type VisTimeSeriesProps<Datum> = {\n data: Datum[];\n margin: Spacing;\n autoMargin: boolean;\n\n x: (d: Datum, i: number) => number;\n y: (d: Datum, i: number) => number;\n id: (d: Datum, i: number) => string;\n color: (d: Datum, i: number) => string;\n cursor: string | ((d: Datum, i: number) => string);\n formatXTicks?: (timestamp: number) => string;\n formatYTicks?: (timestamp: number) => string;\n\n selectionMinLength: number;\n onBrushStart?: (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean) => void;\n onBrushMove?: (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean) => void;\n onBrushEnd?: (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean) => void;\n formatNavXTicks?: (timestamp: number) => string;\n\n xLabel?: string;\n yLabel?: string;\n\n crosshairTemplate?: (d: Datum) => string | HTMLElement;\n\n className?: string;\n height?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function VisTimeSeries<Datum> (props: VisTimeSeriesProps<Datum>): JSX.Element {\n const [selectedRange, setSelectedRange] = useState<[number, number] | undefined>(undefined)\n const [animationDuration, setAnimationDuration] = useState<number | undefined>(0)\n const xScale = useMemo(() => Scale.scaleTime(), [])\n const xScaleNav = useMemo(() => Scale.scaleTime(), [])\n\n // On Mount\n // useEffect(() => {}, [])\n\n // On Props Update\n // useEffect(() => {})\n\n // Brush callbacks\n const onBrushStart = useMemo(() => (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean): void => {\n if (userDriven) setAnimationDuration(0)\n props.onBrushStart?.(selection, e, userDriven)\n }, [])\n\n const onBrushMove = useMemo(() => (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean): void => {\n if (userDriven && selectedRange?.[0] !== selection[0] && selectedRange?.[1] !== selection[1]) setSelectedRange(selection)\n props.onBrushMove?.(selection, e, userDriven)\n }, [])\n\n const onBrushEnd = useMemo(() => (selection: [number, number], e?: { sourceEvent: MouseEvent }, userDriven?: boolean): void => {\n if (userDriven && selectedRange?.[0] !== selection[0] && selectedRange?.[1] !== selection[1]) setSelectedRange(selection)\n setAnimationDuration(undefined)\n props.onBrushEnd?.(selection, e, userDriven)\n }, [])\n\n return (\n <div className={cx(s.timeSeriesContainer, props.className)} style={{ height: props.height }}>\n <VisXYContainer\n className={s.timeSeriesModule}\n data={props.data}\n xScale={xScale}\n xDomain={selectedRange}\n duration={animationDuration}\n scaleByDomain={true}\n >\n <VisArea\n x={props.x}\n y={props.y}\n color={props.color}\n />\n <VisAxis type='x' numTicks={5} tickFormat={props.formatXTicks} tickTextAlign={TextAlign.Center}/>\n <VisAxis type='y' tickFormat={props.formatYTicks} label={props.yLabel}/>\n <VisTooltip />\n <VisCrosshair template={props.crosshairTemplate}/>\n </VisXYContainer>\n <VisXYContainer className={s.navigationModule} duration={0} xScale={xScaleNav} data={props.data}>\n <VisArea x={props.x} y={props.y} />\n <VisBrush draggable={true} onBrushStart={onBrushStart} onBrushMove={onBrushMove} onBrushEnd={onBrushEnd} />\n <VisAxis type='x' numTicks={5} tickFormat={props.formatXTicks ?? props.formatNavXTicks} tickTextAlign={TextAlign.Right} label={props.xLabel}/>\n <VisAxis type='y' tickFormat={props.formatYTicks} minMaxTicksOnly={true} label={props.yLabel ? ' ' : undefined}/>\n </VisXYContainer>\n </div>\n )\n}\n\nVisTimeSeries.defaultProps = {\n margin: { top: 10, bottom: 10, left: 10, right: 10 },\n autoMargin: true,\n padding: {},\n\n x: (d: VisTimeSeriesDatum) => d.timestamp,\n y: (d: VisTimeSeriesDatum) => d.value,\n id: (d: VisTimeSeriesDatum) => d.id,\n color: (d: VisTimeSeriesDatum) => d.color,\n\n formatYTicks: (d: number) => d.toFixed(1),\n\n crosshairTemplate: (d: VisTimeSeriesDatum) =>\n `<div>Date: ${new Date(d.timestamp).toLocaleDateString()}</div><div>Value: ${d.value?.toFixed(1)}</div>`,\n}\n"],"names":["s.timeSeriesContainer","s.timeSeriesModule","s.navigationModule"],"mappings":";;;;;;;;;;;AAgDM,SAAU,aAAa,CAAS,KAAgC,EAAA;;IACpE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAA+B,SAAS,CAAC,CAAA;IAC3F,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAqB,CAAC,CAAC,CAAA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,CAAA;AAC9I,YAAA,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAC,GAAG,EAAC,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,GAAG,GAAG,SAAS,EAAA,CAAG,CAClG,CACb,EACP;AACH,CAAC;AAED,aAAa,CAAC,YAAY,GAAG;AAC3B,IAAA,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;AACpD,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,OAAO,EAAE,EAAE;IAEX,CAAC,EAAE,CAAC,CAAqB,KAAK,CAAC,CAAC,SAAS;IACzC,CAAC,EAAE,CAAC,CAAqB,KAAK,CAAC,CAAC,KAAK;IACrC,EAAE,EAAE,CAAC,CAAqB,KAAK,CAAC,CAAC,EAAE;IACnC,KAAK,EAAE,CAAC,CAAqB,KAAK,CAAC,CAAC,KAAK;IAEzC,YAAY,EAAE,CAAC,CAAS,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzC,IAAA,iBAAiB,EAAE,CAAC,CAAqB,KAAI,EAAA,IAAA,EAAA,CAAA,CAC3C,OAAA,CAAA,WAAA,EAAc,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAA,kBAAA,EAAqB,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,CAAC,CAAC,CAAC,CAAA,MAAA,CAAQ,CAAA,EAAA;CAC3G;;;;"}
@@ -0,0 +1,3 @@
1
+ export declare const timeSeriesContainer: string;
2
+ export declare const timeSeriesModule: string;
3
+ export declare const navigationModule: string;
@@ -0,0 +1,21 @@
1
+ import { css } from '@emotion/css';
2
+
3
+ const timeSeriesContainer = css `
4
+ position: relative;
5
+ height: 400px;
6
+ width: 100%;
7
+ font-family: sans-serif;
8
+ `;
9
+ const timeSeriesModule = css `
10
+ width: 100%;
11
+ height: 70%;
12
+ position: relative;
13
+ `;
14
+ const navigationModule = css `
15
+ width: 100%;
16
+ height: 30%;
17
+ position: relative;
18
+ `;
19
+
20
+ export { navigationModule, timeSeriesContainer, timeSeriesModule };
21
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sources":["../../../src/composites/time-series/style.ts"],"sourcesContent":["import { css } from '@emotion/css'\n\nexport const timeSeriesContainer = css`\n position: relative;\n height: 400px;\n width: 100%;\n font-family: sans-serif;\n`\n\nexport const timeSeriesModule = css`\n width: 100%;\n height: 70%;\n position: relative;\n`\n\nexport const navigationModule = css`\n width: 100%;\n height: 30%;\n position: relative;\n`\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAmB,GAAG,GAAG,CAAA,CAAA;;;;;EAKrC;AAEM,MAAM,gBAAgB,GAAG,GAAG,CAAA,CAAA;;;;EAIlC;AAEM,MAAM,gBAAgB,GAAG,GAAG,CAAA,CAAA;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export * from './composites/time-series';
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { SingleContainerConfigInterface } from '@unovis/ts';
3
+ export declare type VisSingleContainerProps<Data> = SingleContainerConfigInterface<Data> & {
4
+ data?: Data;
5
+ };
6
+ export declare const VisSingleContainer: (<Data>(props: PropsWithChildren<VisSingleContainerProps<Data>>) => JSX.Element | null);
@@ -0,0 +1,31 @@
1
+ import React, { useRef, useState, useEffect } from 'react';
2
+ import { SingleContainer } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisSingleContainerFC(props) {
6
+ const container = useRef(null);
7
+ const [chart, setChart] = useState();
8
+ const [data, setData] = useState(undefined);
9
+ const getConfig = () => {
10
+ var _a, _b, _c, _d;
11
+ return (Object.assign(Object.assign({}, props), { component: (_b = (_a = container.current) === null || _a === void 0 ? void 0 : _a.querySelector('vis-component')) === null || _b === void 0 ? void 0 : _b.__component__, tooltip: (_d = (_c = container.current) === null || _c === void 0 ? void 0 : _c.querySelector('vis-tooltip')) === null || _d === void 0 ? void 0 : _d.__component__ }));
12
+ };
13
+ useEffect(() => {
14
+ setData(props.data);
15
+ setChart(new SingleContainer(container.current, getConfig(), props.data));
16
+ return () => chart === null || chart === void 0 ? void 0 : chart.destroy();
17
+ }, []);
18
+ useEffect(() => {
19
+ const preventRender = true;
20
+ if (props.data && (props.data !== data)) {
21
+ chart === null || chart === void 0 ? void 0 : chart.setData(props.data, preventRender);
22
+ setData(props.data);
23
+ }
24
+ chart === null || chart === void 0 ? void 0 : chart.updateContainer(getConfig());
25
+ });
26
+ return (React.createElement("div", { ref: container, style: { width: '100%', height: '100%', position: 'relative' } }, props.children));
27
+ }
28
+ const VisSingleContainer = React.memo(VisSingleContainerFC, arePropsEqual);
29
+
30
+ export { VisSingleContainer };
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/containers/single-container/index.tsx"],"sourcesContent":["// eslint-disable-next-line no-use-before-define\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { SingleContainer, SingleContainerConfigInterface, ComponentCore, Tooltip } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSingleContainerProps<Data> = SingleContainerConfigInterface<Data> & {\n data?: Data;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSingleContainerFC<Data> (props: PropsWithChildren<VisSingleContainerProps<Data>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const [chart, setChart] = useState<SingleContainer<Data>>()\n const [data, setData] = useState<Data | undefined>(undefined)\n\n const getConfig = (): SingleContainerConfigInterface<Data> => ({\n ...props,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n component: container.current?.querySelector<VisComponentElement<ComponentCore<Data>>>('vis-component')?.__component__,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n tooltip: container.current?.querySelector<VisComponentElement<Tooltip>>('vis-tooltip')?.__component__,\n })\n\n // On Mount\n useEffect(() => {\n setData(props.data)\n setChart(\n new SingleContainer<Data>(container.current as HTMLDivElement, getConfig(), props.data)\n )\n return () => chart?.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n const preventRender = true\n\n // Set new Data without re-render\n if (props.data && (props.data !== data)) {\n chart?.setData(props.data, preventRender)\n setData(props.data)\n }\n\n // Update Container and render\n chart?.updateContainer(getConfig())\n })\n\n return (\n <div ref={container} style={{ width: '100%', height: '100%', position: 'relative' }}>\n {props.children}\n </div>\n )\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 VisSingleContainer: (<Data>(props: PropsWithChildren<VisSingleContainerProps<Data>>) => JSX.Element | null) =\n React.memo(VisSingleContainerFC, arePropsEqual)\n"],"names":[],"mappings":";;;;AAeA,SAAS,oBAAoB,CAAQ,KAAuD,EAAA;AAC1F,IAAA,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAyB,CAAA;IAC3D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAmB,SAAS,CAAC,CAAA;IAE7D,MAAM,SAAS,GAAG,MAA2C;;AAAC,QAAA,QACzD,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,KAAK,CAER,EAAA,EAAA,SAAS,EAAE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,SAAS,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CA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,SAAS,EAAE,CAAC,CAAA;AACrC,KAAC,CAAC,CAAA;IAEF,QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAChF,EAAA,KAAK,CAAC,QAAQ,CACX,EACP;AACH,CAAC;AAIM,MAAM,kBAAkB,GAC7B,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa;;;;"}
@@ -0,0 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { XYContainerConfigInterface } from '@unovis/ts';
3
+ export declare type VisXYContainerProps<Datum> = XYContainerConfigInterface<Datum> & {
4
+ data?: Datum[];
5
+ className?: string;
6
+ };
7
+ export declare function VisXYContainerFC<Datum>(props: PropsWithChildren<VisXYContainerProps<Datum>>): JSX.Element;
8
+ export declare const VisXYContainer: (<Datum>(props: PropsWithChildren<VisXYContainerProps<Datum>>) => JSX.Element | null);
@@ -0,0 +1,39 @@
1
+ import React, { useRef, useState, useEffect } from 'react';
2
+ import { XYContainer, AxisType } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisXYContainerFC(props) {
6
+ const container = useRef(null);
7
+ const [chart, setChart] = useState();
8
+ const [data, setData] = useState(undefined);
9
+ const getConfig = () => {
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11
+ return (Object.assign({ components: Array
12
+ .from((_b = (_a = container.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('vis-component')) !== null && _b !== void 0 ? _b : [])
13
+ .map(c => c.__component__), tooltip: (_d = (_c = container.current) === null || _c === void 0 ? void 0 : _c.querySelector('vis-tooltip')) === null || _d === void 0 ? void 0 : _d.__component__, crosshair: (_f = (_e = container.current) === null || _e === void 0 ? void 0 : _e.querySelector('vis-crosshair')) === null || _f === void 0 ? void 0 : _f.__component__, xAxis: Array
14
+ .from((_h = (_g = container.current) === null || _g === void 0 ? void 0 : _g.querySelectorAll('vis-axis')) !== null && _h !== void 0 ? _h : [])
15
+ .map(c => c.__component__)
16
+ .find(c => c.config.type === AxisType.X), yAxis: Array
17
+ .from((_k = (_j = container.current) === null || _j === void 0 ? void 0 : _j.querySelectorAll('vis-axis')) !== null && _k !== void 0 ? _k : [])
18
+ .map(c => c.__component__)
19
+ .find(c => c.config.type === AxisType.Y), margin: { top: 5, left: 5, right: 5, bottom: 5 } }, props));
20
+ };
21
+ useEffect(() => {
22
+ setData(props.data);
23
+ setChart(new XYContainer(container.current, getConfig(), props.data));
24
+ return () => chart === null || chart === void 0 ? void 0 : chart.destroy();
25
+ }, []);
26
+ useEffect(() => {
27
+ const preventRender = true;
28
+ if (props.data && (props.data !== data)) {
29
+ chart === null || chart === void 0 ? void 0 : chart.setData(props.data, preventRender);
30
+ setData(props.data);
31
+ }
32
+ chart === null || chart === void 0 ? void 0 : chart.updateContainer(getConfig());
33
+ });
34
+ return (React.createElement("div", { ref: container, className: props.className }, props.children));
35
+ }
36
+ const VisXYContainer = React.memo(VisXYContainerFC, arePropsEqual);
37
+
38
+ export { VisXYContainer, VisXYContainerFC };
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/containers/xy-container/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { XYContainer, XYContainerConfigInterface, XYComponentCore, Tooltip, Crosshair, Axis, AxisType } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisXYContainerProps<Datum> = XYContainerConfigInterface<Datum> & {\n data?: Datum[];\n className?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function VisXYContainerFC<Datum> (props: PropsWithChildren<VisXYContainerProps<Datum>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const [chart, setChart] = useState<XYContainer<Datum>>()\n const [data, setData] = useState<Datum[] | undefined>(undefined)\n\n const getConfig = (): XYContainerConfigInterface<Datum> => ({\n components: Array\n .from(container.current?.querySelectorAll<VisComponentElement<XYComponentCore<Datum>>>('vis-component') ?? [])\n .map(c => c.__component__),\n tooltip: container.current?.querySelector<VisComponentElement<Tooltip>>('vis-tooltip')?.__component__,\n crosshair: container.current?.querySelector<VisComponentElement<Crosshair<Datum>>>('vis-crosshair')?.__component__,\n xAxis: Array\n .from(container.current?.querySelectorAll<VisComponentElement<Axis<Datum>>>('vis-axis') ?? [])\n .map(c => c.__component__)\n .find(c => c.config.type === AxisType.X),\n yAxis: Array\n .from(container.current?.querySelectorAll<VisComponentElement<Axis<Datum>>>('vis-axis') ?? [])\n .map(c => c.__component__)\n .find(c => c.config.type === AxisType.Y),\n margin: { top: 5, left: 5, right: 5, bottom: 5 },\n ...props,\n })\n\n // On Mount\n useEffect(() => {\n setData(props.data)\n setChart(\n new XYContainer<Datum>(container.current as HTMLDivElement, getConfig(), props.data)\n )\n\n return () => chart?.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n const preventRender = true\n\n // Set new Data without re-render\n if (props.data && (props.data !== data)) {\n chart?.setData(props.data, preventRender)\n setData(props.data)\n }\n // Update Container and render\n chart?.updateContainer(getConfig())\n })\n\n return (\n <div ref={container} className={props.className}>\n {props.children}\n </div>\n )\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 VisXYContainer: (<Datum>(props: PropsWithChildren<VisXYContainerProps<Datum>>) => JSX.Element | null) =\n React.memo(VisXYContainerFC, arePropsEqual)\n"],"names":[],"mappings":";;;;AAgBM,SAAU,gBAAgB,CAAS,KAAoD,EAAA;AAC3F,IAAA,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,KAA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