@semcore/d3-chart 2.17.5 → 3.0.0-beta.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +18 -2
  2. package/lib/cjs/Area.js +9 -9
  3. package/lib/cjs/Axis.js +14 -14
  4. package/lib/cjs/Bar.js +11 -10
  5. package/lib/cjs/Bar.js.map +1 -1
  6. package/lib/cjs/Bubble.js +18 -13
  7. package/lib/cjs/Bubble.js.map +1 -1
  8. package/lib/cjs/Donut.js +10 -8
  9. package/lib/cjs/Donut.js.map +1 -1
  10. package/lib/cjs/Dots.js +9 -9
  11. package/lib/cjs/HorizontalBar.js +11 -10
  12. package/lib/cjs/HorizontalBar.js.map +1 -1
  13. package/lib/cjs/Hover.js +33 -11
  14. package/lib/cjs/Hover.js.map +1 -1
  15. package/lib/cjs/Line.js +8 -8
  16. package/lib/cjs/Plot.js +3 -3
  17. package/lib/cjs/Radar.js +82 -71
  18. package/lib/cjs/Radar.js.map +1 -1
  19. package/lib/cjs/RadialTree.js +92 -74
  20. package/lib/cjs/RadialTree.js.map +1 -1
  21. package/lib/cjs/ReferenceLine.js +9 -9
  22. package/lib/cjs/ResponsiveContainer.js +1 -2
  23. package/lib/cjs/ResponsiveContainer.js.map +1 -1
  24. package/lib/cjs/ScatterPlot.js +15 -10
  25. package/lib/cjs/ScatterPlot.js.map +1 -1
  26. package/lib/cjs/Tooltip.js +8 -8
  27. package/lib/cjs/Venn.js +10 -8
  28. package/lib/cjs/Venn.js.map +1 -1
  29. package/lib/cjs/a11y/PlotA11yModule.js +2 -2
  30. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
  31. package/lib/cjs/a11y/PlotA11yView.js +3 -3
  32. package/lib/cjs/a11y/hints.js.map +1 -1
  33. package/lib/cjs/a11y/serialize.js.map +1 -1
  34. package/lib/cjs/createElement.d.js +2 -0
  35. package/lib/cjs/createElement.d.js.map +1 -0
  36. package/lib/cjs/types/Area.d.js.map +1 -1
  37. package/lib/cjs/types/Axis.d.js.map +1 -1
  38. package/lib/cjs/types/Bar.d.js.map +1 -1
  39. package/lib/cjs/types/Bubble.d.js.map +1 -1
  40. package/lib/cjs/types/ClipPath.d.js.map +1 -1
  41. package/lib/cjs/types/Donut.d.js.map +1 -1
  42. package/lib/cjs/types/GroupBar.d.js.map +1 -1
  43. package/lib/cjs/types/HorizontalBar.d.js.map +1 -1
  44. package/lib/cjs/types/Hover.d.js.map +1 -1
  45. package/lib/cjs/types/Line.d.js.map +1 -1
  46. package/lib/cjs/types/Plot.d.js +0 -2
  47. package/lib/cjs/types/Plot.d.js.map +1 -1
  48. package/lib/cjs/types/Radar.d.js +2 -0
  49. package/lib/cjs/types/Radar.d.js.map +1 -0
  50. package/lib/cjs/types/ReferenceLine.d.js.map +1 -1
  51. package/lib/cjs/types/ResponsiveContainer.d.js.map +1 -1
  52. package/lib/cjs/types/ScatterPlot.d.js.map +1 -1
  53. package/lib/cjs/types/StackBar.d.js.map +1 -1
  54. package/lib/cjs/types/StackedArea.d.js.map +1 -1
  55. package/lib/cjs/types/Tooltip.d.js.map +1 -1
  56. package/lib/cjs/types/Venn.d.js.map +1 -1
  57. package/lib/cjs/types/context.d.js.map +1 -1
  58. package/lib/cjs/types/index.d.js.map +1 -1
  59. package/lib/cjs/utils.js.map +1 -1
  60. package/lib/es6/Area.js +9 -9
  61. package/lib/es6/Axis.js +14 -14
  62. package/lib/es6/Bar.js +11 -10
  63. package/lib/es6/Bar.js.map +1 -1
  64. package/lib/es6/Bubble.js +18 -13
  65. package/lib/es6/Bubble.js.map +1 -1
  66. package/lib/es6/Donut.js +10 -8
  67. package/lib/es6/Donut.js.map +1 -1
  68. package/lib/es6/Dots.js +9 -9
  69. package/lib/es6/HorizontalBar.js +11 -10
  70. package/lib/es6/HorizontalBar.js.map +1 -1
  71. package/lib/es6/Hover.js +36 -12
  72. package/lib/es6/Hover.js.map +1 -1
  73. package/lib/es6/Line.js +8 -8
  74. package/lib/es6/Plot.js +3 -3
  75. package/lib/es6/Radar.js +84 -72
  76. package/lib/es6/Radar.js.map +1 -1
  77. package/lib/es6/RadialTree.js +90 -72
  78. package/lib/es6/RadialTree.js.map +1 -1
  79. package/lib/es6/ReferenceLine.js +9 -9
  80. package/lib/es6/ResponsiveContainer.js +0 -1
  81. package/lib/es6/ResponsiveContainer.js.map +1 -1
  82. package/lib/es6/ScatterPlot.js +15 -10
  83. package/lib/es6/ScatterPlot.js.map +1 -1
  84. package/lib/es6/Tooltip.js +8 -8
  85. package/lib/es6/Venn.js +10 -8
  86. package/lib/es6/Venn.js.map +1 -1
  87. package/lib/es6/a11y/PlotA11yModule.js +2 -2
  88. package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
  89. package/lib/es6/a11y/PlotA11yView.js +3 -3
  90. package/lib/es6/a11y/hints.js.map +1 -1
  91. package/lib/es6/a11y/serialize.js.map +1 -1
  92. package/lib/es6/createElement.d.js +2 -0
  93. package/lib/es6/createElement.d.js.map +1 -0
  94. package/lib/es6/types/Area.d.js.map +1 -1
  95. package/lib/es6/types/Axis.d.js.map +1 -1
  96. package/lib/es6/types/Bar.d.js.map +1 -1
  97. package/lib/es6/types/Bubble.d.js.map +1 -1
  98. package/lib/es6/types/ClipPath.d.js.map +1 -1
  99. package/lib/es6/types/Donut.d.js.map +1 -1
  100. package/lib/es6/types/GroupBar.d.js.map +1 -1
  101. package/lib/es6/types/HorizontalBar.d.js.map +1 -1
  102. package/lib/es6/types/Hover.d.js.map +1 -1
  103. package/lib/es6/types/Line.d.js.map +1 -1
  104. package/lib/es6/types/Plot.d.js +1 -1
  105. package/lib/es6/types/Plot.d.js.map +1 -1
  106. package/lib/es6/types/Radar.d.js +2 -0
  107. package/lib/es6/types/Radar.d.js.map +1 -0
  108. package/lib/es6/types/ReferenceLine.d.js.map +1 -1
  109. package/lib/es6/types/ResponsiveContainer.d.js.map +1 -1
  110. package/lib/es6/types/ScatterPlot.d.js.map +1 -1
  111. package/lib/es6/types/StackBar.d.js.map +1 -1
  112. package/lib/es6/types/StackedArea.d.js.map +1 -1
  113. package/lib/es6/types/Tooltip.d.js.map +1 -1
  114. package/lib/es6/types/Venn.d.js.map +1 -1
  115. package/lib/es6/types/context.d.js.map +1 -1
  116. package/lib/es6/types/index.d.js +3 -0
  117. package/lib/es6/types/index.d.js.map +1 -1
  118. package/lib/es6/utils.js.map +1 -1
  119. package/lib/types/Area.d.ts +26 -17
  120. package/lib/types/Axis.d.ts +40 -23
  121. package/lib/types/Bar.d.ts +32 -16
  122. package/lib/types/Bubble.d.ts +30 -12
  123. package/lib/types/ClipPath.d.ts +7 -5
  124. package/lib/types/Donut.d.ts +29 -13
  125. package/lib/types/GroupBar.d.ts +15 -12
  126. package/lib/types/HorizontalBar.d.ts +12 -12
  127. package/lib/types/Hover.d.ts +32 -8
  128. package/lib/types/Line.d.ts +33 -23
  129. package/lib/types/Plot.d.ts +34 -22
  130. package/lib/types/Radar.d.ts +145 -0
  131. package/lib/types/RadialTree.d.ts +53 -28
  132. package/lib/types/ReferenceLine.d.ts +27 -14
  133. package/lib/types/ResponsiveContainer.d.ts +18 -10
  134. package/lib/types/ScatterPlot.d.ts +25 -9
  135. package/lib/types/StackBar.d.ts +20 -14
  136. package/lib/types/StackedArea.d.ts +16 -12
  137. package/lib/types/Tooltip.d.ts +55 -23
  138. package/lib/types/Venn.d.ts +47 -29
  139. package/lib/types/a11y/PlotA11yModule.d.ts +1 -1
  140. package/lib/types/a11y/focus.d.ts +1 -1
  141. package/lib/types/a11y/hints.d.ts +5 -5
  142. package/lib/types/a11y/insights.d.ts +8 -8
  143. package/lib/types/a11y/intl.d.ts +1 -1
  144. package/lib/types/a11y/locale.d.ts +1 -1
  145. package/lib/types/a11y/serialize.d.ts +4 -4
  146. package/lib/types/a11y/summarize.d.ts +1 -1
  147. package/lib/types/context.d.ts +10 -0
  148. package/lib/types/createElement.d.ts +2 -0
  149. package/lib/types/index.d.ts +2 -0
  150. package/lib/types/utils.d.ts +10 -7
  151. package/package.json +10 -10
  152. package/lib/cjs/types/Radar.js +0 -2
  153. package/lib/cjs/types/Radar.js.map +0 -1
  154. package/lib/es6/types/Radar.js +0 -2
  155. package/lib/es6/types/Radar.js.map +0 -1
  156. package/lib/types/types/Radar.d.ts +0 -95
@@ -1,13 +1,16 @@
1
- import { ReturnEl } from '@semcore/core';
2
- import { MapProps } from './Plot';
3
- import IContext from './context';
1
+ import { UnknownProperties } from '@semcore/core';
2
+ import { Context } from './context';
3
+ import { TooltipType } from './Tooltip';
4
+ import { IntergalacticD3Component } from './Plot';
4
5
 
5
- export interface IScatterPlotProps extends IContext {
6
- /** Field from data for XAxis */
6
+ /** @deprecated */
7
+ export interface IScatterPlotProps extends ScatterPlotProps, UnknownProperties {}
8
+ export type ScatterPlotProps = Context & {
9
+ /** Field name from `data` array item for the XAxis */
7
10
  x: string;
8
- /** Field from data for YAxis */
11
+ /** Field name from `data` array item for the YAxis */
9
12
  y: string;
10
- /** Field from data for circle value */
13
+ /** Field name from `data` array item for the circle value */
11
14
  value?: string;
12
15
  /** Circle color */
13
16
  color?: string;
@@ -23,8 +26,21 @@ export interface IScatterPlotProps extends IContext {
23
26
  r?: number;
24
27
  /** Enables element transparency */
25
28
  transparent?: boolean;
26
- }
29
+ };
27
30
 
28
- declare const ScatterPlot: <T>(props: MapProps<IScatterPlotProps & T>) => ReturnEl;
31
+ declare const ScatterPlot: IntergalacticD3Component<'g', ScatterPlotProps, Context> & {
32
+ Tooltip: TooltipType<
33
+ ScatterPlotProps & {
34
+ /**
35
+ * @deprecated Use `index` instead.
36
+ */
37
+ xIndex: number;
38
+ /**
39
+ * Index of item in the `data` array used to render related circle.
40
+ */
41
+ index: number;
42
+ }
43
+ >;
44
+ };
29
45
 
30
46
  export default ScatterPlot;
@@ -1,27 +1,33 @@
1
- import { ReturnEl } from '@semcore/core';
2
- import { MapProps } from './Plot';
3
- import IContext from './context';
4
- import { IBarContext, IBarProps } from './Bar';
5
- import { IHorizontalBarProps } from './HorizontalBar';
1
+ import { UnknownProperties } from '@semcore/core';
2
+ import { Context } from './context';
3
+ import { BarContext, BarProps } from './Bar';
4
+ import { HorizontalBarProps } from './HorizontalBar';
5
+ import { IntergalacticD3Component } from './Plot';
6
6
 
7
- export interface IStackBarProps extends IContext {
8
- /** Field from data for XAxis */
7
+ /** @deprecated */
8
+ export interface IStackBarProps extends StackBarProps, UnknownProperties {}
9
+ export type StackBarProps = Context & {
10
+ /** Field name from `data` array item for the XAxis */
9
11
  x?: string;
10
- /** Field from data for YAxis */
12
+ /** Field name from `data` array item for the YAxis */
11
13
  y?: string;
12
14
  /** Stack generators
13
15
  * @default d3.stack() */
16
+ /** @deprecated */
14
17
  stack?: any;
15
- }
18
+ };
16
19
 
17
- export interface IStackBarContext {
20
+ /** @deprecated */
21
+ export interface IStackBarContext extends StackBarContext, UnknownProperties {}
22
+ export type StackBarContext = {
18
23
  /** Series is an array of points, where each point corresponds to the element in the input data. */
24
+ /** @deprecated */
19
25
  series: any[];
20
- }
26
+ };
21
27
 
22
- declare const StackBar: (<T>(props: MapProps<IStackBarProps & T, IStackBarContext>) => ReturnEl) & {
23
- Bar: <T>(props: MapProps<IBarProps & T, IBarContext>) => ReturnEl;
24
- HorizontalBar: <T>(props: MapProps<IHorizontalBarProps & T, IBarContext>) => ReturnEl;
28
+ declare const StackBar: IntergalacticD3Component<'g', StackBarProps, StackBarContext> & {
29
+ Bar: IntergalacticD3Component<'path', BarProps, BarContext>;
30
+ HorizontalBar: IntergalacticD3Component<'path', HorizontalBarProps, BarContext>;
25
31
  };
26
32
 
27
33
  export default StackBar;
@@ -1,26 +1,30 @@
1
- import { ReturnEl } from '@semcore/core';
2
- import { MapProps } from './Plot';
3
- import IContext from './context';
1
+ import { UnknownProperties } from '@semcore/core';
2
+ import { Context } from './context';
4
3
  import Area from './Area';
4
+ import { IntergalacticD3Component } from './Plot';
5
5
 
6
- export interface IStackedAreaProps extends IContext {
7
- /** Field from data for XAxis */
6
+ /** @deprecated */
7
+ export interface IStackedAreaProps extends StackedAreaProps, UnknownProperties {}
8
+ export type StackedAreaProps = Context & {
9
+ /** Field name from `data` array item for the XAxis */
8
10
  x?: string;
9
- /** Field from data for YAxis */
11
+ /** Field name from `data` array item for the YAxis */
10
12
  y?: string;
11
13
  /** Stack generators
12
14
  * @default d3.stack() */
15
+ /** @deprecated */
13
16
  stack?: any;
14
- }
17
+ };
15
18
 
16
- export interface IStackedAreaContext {
19
+ /** @deprecated */
20
+ export interface IStackedAreaContext extends StackedAreaContext, UnknownProperties {}
21
+ export type StackedAreaContext = {
17
22
  /** Series is an array of points, where each point corresponds to the element in the input data. */
23
+ /** @deprecated */
18
24
  series: any[];
19
- }
25
+ };
20
26
 
21
- declare const StackedArea: (<T>(
22
- props: MapProps<IStackedAreaProps & T, IStackedAreaContext>,
23
- ) => ReturnEl) & {
27
+ declare const StackedArea: IntergalacticD3Component<'g', StackedAreaProps, StackedAreaContext> & {
24
28
  Area: typeof Area;
25
29
  };
26
30
 
@@ -1,34 +1,66 @@
1
- import { ComponentProps } from 'react';
2
- import Popper, { IPopperProps, IPopperTriggerProps } from '@semcore/popper';
3
- import { PropGetterFn, ReturnEl } from '@semcore/core';
4
- import { MapProps } from './Plot';
5
- import { IBoxProps } from '@semcore/flex-box';
6
- import IContext from './context';
1
+ import Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';
2
+ import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
+ import { Box, BoxProps } from '@semcore/flex-box';
4
+ import { Context } from './context';
5
+ import { IntergalacticD3Component } from './Plot';
7
6
 
8
- export interface ITooltipChartProps extends IPopperProps, IPopperTriggerProps, IContext {
9
- /** Field from data for XAxis */
10
- x?: string;
11
- /** Field from data for YAxis */
12
- y?: string;
13
- }
7
+ /** @deprecated */
8
+ export interface ITooltipChartProps extends TooltipChartProps, UnknownProperties {}
9
+ export type TooltipChartProps = PopperProps &
10
+ PopperTriggerProps &
11
+ Context & {
12
+ /** Field name from `data` array item for the XAxis */
13
+ x?: string;
14
+ /** Field name from `data` array item for the YAxis */
15
+ y?: string;
16
+ };
14
17
 
15
- export interface ITooltipChartContext {
16
- getTriggerProps: PropGetterFn;
17
- getPopperProps: PropGetterFn;
18
+ /** @deprecated */
19
+ export interface ITooltipChartContext extends TooltipChartContext, UnknownProperties {
18
20
  /** Index active value for Axis x */
19
21
  xIndex: number | null;
20
22
  /** Index active value for Axis y */
21
23
  yIndex: number | null;
22
24
  }
25
+ export type TooltipChartContext = {
26
+ getTriggerProps: PropGetterFn;
27
+ getPopperProps: PropGetterFn;
28
+ };
23
29
 
24
- declare const Tooltip: (<T>(
25
- props: MapProps<ITooltipChartProps & T, ITooltipChartContext>,
26
- ) => ReturnEl) & {
27
- Trigger: <T>(props: MapProps<ComponentProps<typeof Popper.Trigger> & T>) => ReturnEl;
28
- Popper: <T>(props: MapProps<ComponentProps<typeof Popper.Popper> & T>) => ReturnEl;
29
- Title: <T>(props: MapProps<IBoxProps & T>) => ReturnEl;
30
- Dot: <T>(props: MapProps<IBoxProps & { color?: string } & T>) => ReturnEl;
31
- Footer: <T>(props: MapProps<IBoxProps & T>) => ReturnEl;
30
+ export type TooltipTypeBase = {
31
+ Trigger: typeof Popper.Trigger;
32
+ Popper: typeof Popper.Popper;
33
+ Title: typeof Box;
34
+ Dot: IntergalacticD3Component<'div', BoxProps & { color?: string }, TooltipChartContext>;
35
+ Footer: typeof Box;
32
36
  };
33
37
 
38
+ export type TooltipType<ChildrenRenderProps = {}, TooltipProps = {}> = (<
39
+ Tag extends Intergalactic.Tag = typeof Box,
40
+ >(
41
+ props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<
42
+ Tag,
43
+ TooltipProps,
44
+ ChildrenRenderProps & TooltipChartContext
45
+ >,
46
+ ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
47
+ Intergalactic.InternalTypings.ComponentAdditive<Intergalactic.Tag> &
48
+ TooltipTypeBase;
49
+
50
+ /**
51
+ * @deprecated Consider migration to better typed Bubble.Tooltip, HoverLine.Tooltip,
52
+ * HoverRect.Tooltip, Donut.Tooltip, Radar.Tooltip,
53
+ * ScatterPlot.Tooltip or Venn.Tooltip.
54
+ *
55
+ * Migration examples:
56
+ * 1. `<Tooltip tag={HoverLine}>...</Tooltip>` => `<HoverLine.Tooltip>...</HoverLine.Tooltip>`
57
+ * 2. `<Tooltip tag={HoverRect}>...</Tooltip>` => `<HoverRect.Tooltip>...</HoverRect.Tooltip>`
58
+ * 3. `<Tooltip tag={Radar.Hover}>...</Tooltip>` => `<Radar.Tooltip>...</Radar.Tooltip>`
59
+ * 4. `<Tooltip>...</Tooltip>` => `<Bubble.Tooltip>...</Bubble.Tooltip>`
60
+ * 5. `<Tooltip>...</Tooltip>` => `<Donut.Tooltip>...</Donut.Tooltip>`
61
+ * 6. `<Tooltip>...</Tooltip>` => `<ScatterPlot.Tooltip>...</ScatterPlot.Tooltip>`
62
+ * 7. `<Tooltip>...</Tooltip>` => `<Venn.Tooltip>...</Venn.Tooltip>`
63
+ */
64
+ declare const Tooltip: TooltipType;
65
+
34
66
  export default Tooltip;
@@ -1,26 +1,36 @@
1
- import { ReturnEl } from '@semcore/core';
2
- import { MapProps } from './Plot';
3
- import IContext from './context';
4
- import { IFadeInOutProps } from '@semcore/animation';
1
+ import { UnknownProperties } from '@semcore/core';
2
+ import { Context } from './context';
3
+ import { FadeInOutProps } from '@semcore/animation';
4
+ import { TooltipType } from './Tooltip';
5
+ import { IntergalacticD3Component } from './Plot';
5
6
 
6
- export interface IVennProps extends IContext, IFadeInOutProps {
7
- /**
8
- * Rotate sets in the chart
9
- * @default Math.PI / 2
10
- */
11
- orientation?: number;
12
- /**
13
- * The function for sorting sets inside the chart
14
- * @default (circle1, circle2) => circle2.radius - circle1.radius
15
- */
16
- orientationOrder?: (c1: number, c2: number) => number;
17
- }
7
+ /** @deprecated */
8
+ export interface IVennProps extends VennProps, UnknownProperties {}
9
+ export type VennProps = Context &
10
+ FadeInOutProps & {
11
+ /**
12
+ * Rotate sets in the chart
13
+ * @default Math.PI / 2
14
+ */
15
+ orientation?: number;
16
+ /**
17
+ * The function for sorting sets inside the chart
18
+ * @default (circle1, circle2) => circle2.radius - circle1.radius
19
+ */
20
+ orientationOrder?: (c1: number, c2: number) => number;
21
+ };
18
22
 
19
- export interface ICircleProps extends IContext {
23
+ /** @deprecated */
24
+ export interface ICircleProps extends CircleProps, UnknownProperties {}
25
+ export type CircleProps = Context & {
20
26
  /**
21
27
  * Name of the field in the data
22
28
  * */
23
29
  dataKey: string;
30
+ /**
31
+ * Human readable name of the circle
32
+ * */
33
+ name: string;
24
34
  /** Color circle
25
35
  @default #3AB011
26
36
  **/
@@ -31,20 +41,28 @@ export interface ICircleProps extends IContext {
31
41
  duration?: number;
32
42
  /** Enables element transparency */
33
43
  transparent?: boolean;
34
- }
44
+ };
35
45
 
36
- export interface IIntersectionProps extends IContext, IFadeInOutProps {
37
- /**
38
- * Name of the field in the data
39
- * */
40
- dataKey: string;
41
- /** Enables element transparency */
42
- transparent?: boolean;
43
- }
46
+ /** @deprecated */
47
+ export interface IIntersectionProps extends IntersectionProps, UnknownProperties {}
48
+ export type IntersectionProps = Context &
49
+ FadeInOutProps & {
50
+ /**
51
+ * Name of the field in the data
52
+ * */
53
+ dataKey: string;
54
+ /**
55
+ * Human readable name of the intersection
56
+ * */
57
+ name: string;
58
+ /** Enables element transparency */
59
+ transparent?: boolean;
60
+ };
44
61
 
45
- declare const Venn: (<T>(props: MapProps<IVennProps & T>) => ReturnEl) & {
46
- Circle: <T>(props: MapProps<ICircleProps & T>) => ReturnEl;
47
- Intersection: <T>(props: MapProps<IIntersectionProps & T>) => ReturnEl;
62
+ declare const Venn: IntergalacticD3Component<'g', VennProps, Context> & {
63
+ Circle: IntergalacticD3Component<'circle', CircleProps, Context>;
64
+ Intersection: IntergalacticD3Component<'path', IntersectionProps, Context>;
65
+ Tooltip: TooltipType<CircleProps>;
48
66
  };
49
67
 
50
68
  export default Venn;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DataStructureHints, PartialDataSummarizationConfig } from './hints';
3
- export declare type A11yViewProps = {
3
+ export type A11yViewProps = {
4
4
  id: string;
5
5
  data: Record<string, unknown>[];
6
6
  hints: DataStructureHints;
@@ -1,4 +1,4 @@
1
- declare type FocusableElement = Element & {
1
+ type FocusableElement = Element & {
2
2
  focus: () => void;
3
3
  };
4
4
  export declare const heavyFindNextFocusableElement: (base: Element, trace?: Map<Element, true>) => FocusableElement | null;
@@ -1,8 +1,8 @@
1
1
  import { SerializableDataType } from './insights';
2
- declare type DeepPartial<T> = T extends object ? {
2
+ type DeepPartial<T> = T extends object ? {
3
3
  [P in keyof T]?: DeepPartial<T[P]>;
4
4
  } : T;
5
- export declare type DataStructureHints = {
5
+ export type DataStructureHints = {
6
6
  fields: {
7
7
  verticalAxes: Set<string | number>;
8
8
  horizontalAxes: Set<string | number>;
@@ -38,7 +38,7 @@ export declare type DataStructureHints = {
38
38
  } | null;
39
39
  dataType: SerializableDataType | null;
40
40
  };
41
- export declare type DataSummarizationConfig = {
41
+ export type DataSummarizationConfig = {
42
42
  trendTangens: {
43
43
  static: number;
44
44
  weak: number;
@@ -61,7 +61,7 @@ export declare type DataSummarizationConfig = {
61
61
  override: string | undefined;
62
62
  additionalFields: string[];
63
63
  };
64
- export declare type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;
64
+ export type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;
65
65
  export declare const makeDataHintsContainer: () => DataStructureHints;
66
66
  export declare const makeDataHintsHandlers: (mutableContainer: DataStructureHints) => {
67
67
  specifyDataRowFields: (x?: string, y?: string, value?: string) => void;
@@ -74,6 +74,6 @@ export declare const makeDataHintsHandlers: (mutableContainer: DataStructureHint
74
74
  setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => void;
75
75
  setPointsDensity: (horizontalAxes: number, verticalAxes: number) => void;
76
76
  };
77
- export declare type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;
77
+ export type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;
78
78
  export declare const makeDataSummarizationConfig: (config?: PartialDataSummarizationConfig) => DataSummarizationConfig;
79
79
  export {};
@@ -1,5 +1,5 @@
1
1
  import { DataStructureHints, DataSummarizationConfig } from './hints';
2
- export declare type TrendNode = {
2
+ export type TrendNode = {
3
3
  type: 'trend';
4
4
  priority: number;
5
5
  change: {
@@ -11,10 +11,10 @@ export declare type TrendNode = {
11
11
  to: unknown;
12
12
  dataKey: string | number;
13
13
  };
14
- export declare type GeneralTrendNode = Omit<TrendNode, 'type'> & {
14
+ export type GeneralTrendNode = Omit<TrendNode, 'type'> & {
15
15
  type: 'general-trend';
16
16
  };
17
- export declare type ComparisonNode = {
17
+ export type ComparisonNode = {
18
18
  type: 'comparison';
19
19
  label?: string;
20
20
  priority: number;
@@ -23,8 +23,8 @@ export declare type ComparisonNode = {
23
23
  label: string;
24
24
  }[];
25
25
  };
26
- declare type ClusterRelativeSize = 'significantly-smaller' | 'smaller' | 'slightly-smaller' | 'average' | 'slightly-bigger' | 'bigger' | 'significantly-bigger';
27
- export declare type ClusterNode = {
26
+ type ClusterRelativeSize = 'significantly-smaller' | 'smaller' | 'slightly-smaller' | 'average' | 'slightly-bigger' | 'bigger' | 'significantly-bigger';
27
+ export type ClusterNode = {
28
28
  type: 'cluster';
29
29
  priority: number;
30
30
  size: number;
@@ -37,9 +37,9 @@ export declare type ClusterNode = {
37
37
  };
38
38
  relativeSize: ClusterRelativeSize;
39
39
  };
40
- export declare type Insight = TrendNode | GeneralTrendNode | ComparisonNode | ClusterNode;
41
- export declare type SerializableDataType = 'time-series' | 'points-cloud' | 'values-set' | 'grouped-values' | 'indexed-groups';
42
- export declare type AnalyzedData = {
40
+ export type Insight = TrendNode | GeneralTrendNode | ComparisonNode | ClusterNode;
41
+ export type SerializableDataType = 'time-series' | 'points-cloud' | 'values-set' | 'grouped-values' | 'indexed-groups';
42
+ export type AnalyzedData = {
43
43
  insights: Insight[];
44
44
  dataType: SerializableDataType;
45
45
  dataRange: {
@@ -1,6 +1,6 @@
1
1
  import { IntlShape } from '@formatjs/intl';
2
2
  import type { localizedMessages as localizedMessagesTypeBase } from './translations/view/__intergalactic-dynamic-locales';
3
- export declare type Intl = IntlShape<typeof localizedMessagesTypeBase['en']>;
3
+ export type Intl = IntlShape<typeof localizedMessagesTypeBase['en']>;
4
4
  export declare const getIntl: (locale: string, translations: {
5
5
  [messageId: string]: string;
6
6
  }, availableLocales: {
@@ -1,3 +1,3 @@
1
1
  export declare const normalizeLocale: (providedLocale: string, translations?: {
2
2
  [locale: string]: {};
3
- }) => string;
3
+ }) => string | null;
@@ -3,15 +3,15 @@ import { DataSummarizationConfig } from './hints';
3
3
  import { Intl } from './intl';
4
4
  export declare const formatValue: (intl: Intl, value: unknown, { siblingsTimeMark, maxListSymbols, datesWithTime, }?: {
5
5
  siblingsTimeMark?: unknown;
6
- maxListSymbols?: number;
7
- datesWithTime?: boolean;
6
+ maxListSymbols?: number | undefined;
7
+ datesWithTime?: boolean | undefined;
8
8
  }) => string;
9
9
  export declare const serialize: ({ insights, dataType, dataRange, dataTitle, entitiesCount }: AnalyzedData, { datesWithTime, maxListSymbols, clustersLimit, valuesLimit, groupsLimit, }: DataSummarizationConfig, { locale, translations, availableLocales, }: {
10
10
  locale: string;
11
11
  translations?: {
12
12
  [messageId: string]: string;
13
- };
13
+ } | undefined;
14
14
  availableLocales?: {
15
15
  [localeId: string]: any;
16
- };
16
+ } | undefined;
17
17
  }) => string | null;
@@ -3,4 +3,4 @@ export declare const summarize: (data: Record<string, unknown>[] | Record<string
3
3
  [messageId: string]: string;
4
4
  }, availableLocales: {
5
5
  [localeId: string]: any;
6
- }) => string;
6
+ }) => string | null;
@@ -1,7 +1,17 @@
1
+ export type Context = {
2
+ /** Data for graphic */
3
+ data?: unknown;
4
+ /** Scale for svg element */
5
+ scale?: unknown[];
6
+ };
7
+
8
+ /** @deprecated */
1
9
  export default interface IContext {
2
10
  /** Data for graphic */
11
+ /** @deprecated */
3
12
  data?: any;
4
13
  /** Scale for svg element */
14
+ /** @deprecated */
5
15
  scale?: any[];
6
16
 
7
17
  [key: string]: unknown;
@@ -0,0 +1,2 @@
1
+ declare const createElement: any;
2
+ export default createElement;
@@ -36,8 +36,10 @@ export * from './StackedArea';
36
36
 
37
37
  /** It becomes resolvable after building and moving file to lib dir */
38
38
 
39
+ // @ts-ignore
39
40
  export { default as RadialTree } from './RadialTree';
40
41
 
42
+ // @ts-ignore
41
43
  export * from './RadialTree';
42
44
 
43
45
  export { default as Radar } from './Radar';
@@ -1,11 +1,12 @@
1
1
  import { Numeric } from 'd3-array';
2
2
  import { ScaleIdentity, ScaleTime, ScaleContinuousNumeric, ScaleBand, ScalePoint } from 'd3-scale';
3
+ import React from 'react';
3
4
  declare const CONSTANT: {
4
5
  readonly VIRTUAL_ELEMENT: symbol;
5
6
  };
6
7
  export { CONSTANT };
7
8
  export declare const eventToPoint: (event: React.MouseEvent<HTMLElement>, svgRoot: SVGElement) => number[];
8
- declare type InvertableScale = ScaleIdentity | ScaleBand<unknown> | ScaleTime<unknown, unknown> | ScaleContinuousNumeric<unknown, unknown>;
9
+ type InvertableScale = ScaleIdentity | ScaleBand<{}> | ScaleTime<unknown, unknown> | ScaleContinuousNumeric<unknown, unknown>;
9
10
  export declare const invert: <Scale extends InvertableScale = InvertableScale>(scale: Scale, value: number) => number | Date;
10
11
  export declare const definedNullData: (x: number, y: number) => (plot: {
11
12
  [xOrY: number]: unknown;
@@ -13,13 +14,15 @@ export declare const definedNullData: (x: number, y: number) => (plot: {
13
14
  export declare const definedData: (x: number, y: number) => (plot: {
14
15
  [xOrY: number]: unknown;
15
16
  }) => boolean;
16
- export declare const scaleOfBandwidth: <Scale extends ScaleBand<{}>>(scale: Scale, value: number) => number;
17
- export declare const minMax: <Key extends string = string, Data extends Iterable<{ [key in Key]: Numeric; }> = Iterable<{ [key_1 in Key]: Numeric; }>>(data: Data, key: Key) => [{ [key in Key]: Numeric; }[Key], { [key in Key]: Numeric; }[Key]] | [string, string];
17
+ export declare const scaleOfBandwidth: <Scale extends ScaleBand<{}>>(scale: Scale, value: number) => number | undefined;
18
+ export declare const minMax: <Key extends string = string, Data extends {
19
+ [key: string]: Numeric | null | undefined;
20
+ }[] = {
21
+ [key: string]: Numeric | null | undefined;
22
+ }[]>(data: Data, key: Key) => [min: Data[0][Key], max: Data[0][Key]];
18
23
  export declare const getNullData: <Name extends string = string, Data extends { [name in Name]?: unknown; } = {}>(data: Data[], defined: (data: Data) => boolean, name: Name) => Data[];
19
- declare type IndexFromDataScale = ScaleIdentity | ScaleTime<unknown, unknown> | ScaleContinuousNumeric<unknown, unknown> | ScaleBand<{}> | ScalePoint<{}>;
20
- export declare const getIndexFromData: <Data extends {
21
- [key: string]: number;
22
- } = {}, Scale extends IndexFromDataScale = IndexFromDataScale>(data: Data[], scale: Scale, key: string, value: number) => number;
24
+ type IndexFromDataScale = ScaleIdentity | ScaleTime<unknown, unknown> | ScaleContinuousNumeric<unknown, unknown> | ScaleBand<{}> | ScalePoint<{}>;
25
+ export declare const getIndexFromData: <Key extends string, Data extends { [key in Key]: number; } = { [key_1 in Key]: number; }, Scale extends IndexFromDataScale = IndexFromDataScale>(data: Data[], scale: Scale, key: Key, value: number) => number | null;
23
26
  export declare const roundedPath: (x: number, y: number, w: number, h: number, r: number, tl?: boolean, tr?: boolean, bl?: boolean, br?: boolean) => string;
24
27
  export declare const getBandwidth: <Scale extends ScaleBand<{}>>(scale: Scale) => number;
25
28
  export declare const memoize: <Func extends (...args: any[]) => any>(func: Func) => Func;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/d3-chart",
3
3
  "description": "Semrush D3 Chart Component",
4
- "version": "2.17.5",
4
+ "version": "3.0.0-beta.1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -10,10 +10,10 @@
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@formatjs/intl": "2.3.0",
13
- "@semcore/animation": "^1",
14
- "@semcore/flex-box": "^4",
15
- "@semcore/popper": "^4.9",
16
- "@semcore/utils": "^3.42.0",
13
+ "@semcore/animation": "2.0.0-beta.1",
14
+ "@semcore/flex-box": "5.0.0-beta.1",
15
+ "@semcore/popper": "5.0.0-beta.1",
16
+ "@semcore/utils": "4.0.0-beta.1",
17
17
  "@types/d3-shape": "^3.1.0",
18
18
  "@upsetjs/venn.js": "1.4.1",
19
19
  "d3-array": "3.1.6",
@@ -22,11 +22,10 @@
22
22
  "d3-scale": "3.3.0",
23
23
  "d3-shape": "3.1.0",
24
24
  "d3-transition": "3.0.1",
25
- "hoist-non-react-statics": "3.3.2",
26
- "resize-observer-polyfill": "1.5.1"
25
+ "hoist-non-react-statics": "3.3.2"
27
26
  },
28
27
  "peerDependencies": {
29
- "@semcore/core": "^1.12",
28
+ "@semcore/core": "2.0.0-beta.1",
30
29
  "react": "16.8 - 18",
31
30
  "react-dom": "16.8 - 18"
32
31
  },
@@ -41,12 +40,13 @@
41
40
  "@semcore/checkbox": "*",
42
41
  "@semcore/dropdown-menu": "*",
43
42
  "@semcore/icon": "*",
44
- "@semcore/utils": "*",
45
43
  "@semcore/testing-utils": "1.0.0",
46
44
  "@semcore/typography": "*",
45
+ "@semcore/utils": "*",
47
46
  "@types/d3-array": "^3.0.2",
48
47
  "@types/d3-scale": "^4.0.2",
49
- "@types/d3-transition": "^3.0.1"
48
+ "@types/d3-transition": "^3.0.1",
49
+ "@types/react": "18.0.21"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "pnpm semcore-builder --source=js,ts"
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=Radar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Radar.js","names":[],"sources":["../../../src/types/Radar.ts"],"sourcesContent":["import IContext from './context';\nimport { MapProps } from './Plot';\nimport { ReturnEl } from '@semcore/core';\nimport { CurveFactory } from 'd3-shape';\n\nexport interface IRadarProps extends IContext {\n /**\n * Scale for radar element\n * */\n scale: any;\n /**\n * Graph type to be displayed\n * @default 'polygon'\n * */\n type?: 'polygon' | 'circle';\n /**\n * Indent from the edge of svg to graph\n * */\n offset?: number;\n\n /**\n * Label font size\n * @default 12\n * */\n textSize?: number;\n\n /**\n * Base angle of chart rotation\n * @default 0\n * @example Math.PI/3\n * */\n angleOffset?: number;\n}\n\nexport interface IRadarAxisProps extends IContext {\n /**\n * Sets the field name for categories\n * */\n dataKey: string;\n}\n\nexport interface IRadarAxisTicksProps {\n /**\n * Distance between auxiliary lines\n * @default 100\n * */\n tickSize?: number;\n}\n\nexport interface IRadarAxisLabelsProps {\n /**\n * Indent from graph to label\n * @default 10\n * */\n labelOffset?: number;\n}\n\nexport interface IRadialPolygonProps extends IContext {\n /**\n * Sets the field name for data\n * */\n dataKey: string;\n /**\n * Curve method\n * @default curveLinearClosed\n * */\n curve?: CurveFactory;\n /**\n * Sets the color of the entire polygon\n * */\n color?: string;\n /**\n * Sets the fill color\n * */\n fill?: string;\n}\n\nexport interface IRadialPolygonLineProps {\n /**\n * Sets the line color\n * */\n color?: string;\n}\n\nexport interface IRadialPolygonDotsProps {\n /**\n * Sets the dot color\n * */\n color?: string;\n}\n\nexport interface IRadarHoverProps extends IContext {}\n\ndeclare const Radar: (<T>(props: MapProps<IRadarProps & T>) => ReturnEl) & {\n Axis: (<T>(props: MapProps<IRadarAxisProps & T>) => ReturnEl) & {\n Ticks: <T>(props: MapProps<IRadarAxisTicksProps & T>) => ReturnEl;\n Labels: <T>(props: MapProps<IRadarAxisLabelsProps & T>) => ReturnEl;\n };\n Polygon: (<T>(props: MapProps<IRadialPolygonProps & T>) => ReturnEl) & {\n Line: <T>(props: MapProps<IRadialPolygonLineProps & T>) => ReturnEl;\n Dots: <T>(props: MapProps<IRadialPolygonDotsProps & T>) => ReturnEl;\n };\n Hover: <T>(props: MapProps<IRadarHoverProps & T>) => ReturnEl;\n};\n\nexport default Radar;\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Radar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Radar.js","names":[],"sources":["../../../src/types/Radar.ts"],"sourcesContent":["import IContext from './context';\nimport { MapProps } from './Plot';\nimport { ReturnEl } from '@semcore/core';\nimport { CurveFactory } from 'd3-shape';\n\nexport interface IRadarProps extends IContext {\n /**\n * Scale for radar element\n * */\n scale: any;\n /**\n * Graph type to be displayed\n * @default 'polygon'\n * */\n type?: 'polygon' | 'circle';\n /**\n * Indent from the edge of svg to graph\n * */\n offset?: number;\n\n /**\n * Label font size\n * @default 12\n * */\n textSize?: number;\n\n /**\n * Base angle of chart rotation\n * @default 0\n * @example Math.PI/3\n * */\n angleOffset?: number;\n}\n\nexport interface IRadarAxisProps extends IContext {\n /**\n * Sets the field name for categories\n * */\n dataKey: string;\n}\n\nexport interface IRadarAxisTicksProps {\n /**\n * Distance between auxiliary lines\n * @default 100\n * */\n tickSize?: number;\n}\n\nexport interface IRadarAxisLabelsProps {\n /**\n * Indent from graph to label\n * @default 10\n * */\n labelOffset?: number;\n}\n\nexport interface IRadialPolygonProps extends IContext {\n /**\n * Sets the field name for data\n * */\n dataKey: string;\n /**\n * Curve method\n * @default curveLinearClosed\n * */\n curve?: CurveFactory;\n /**\n * Sets the color of the entire polygon\n * */\n color?: string;\n /**\n * Sets the fill color\n * */\n fill?: string;\n}\n\nexport interface IRadialPolygonLineProps {\n /**\n * Sets the line color\n * */\n color?: string;\n}\n\nexport interface IRadialPolygonDotsProps {\n /**\n * Sets the dot color\n * */\n color?: string;\n}\n\nexport interface IRadarHoverProps extends IContext {}\n\ndeclare const Radar: (<T>(props: MapProps<IRadarProps & T>) => ReturnEl) & {\n Axis: (<T>(props: MapProps<IRadarAxisProps & T>) => ReturnEl) & {\n Ticks: <T>(props: MapProps<IRadarAxisTicksProps & T>) => ReturnEl;\n Labels: <T>(props: MapProps<IRadarAxisLabelsProps & T>) => ReturnEl;\n };\n Polygon: (<T>(props: MapProps<IRadialPolygonProps & T>) => ReturnEl) & {\n Line: <T>(props: MapProps<IRadialPolygonLineProps & T>) => ReturnEl;\n Dots: <T>(props: MapProps<IRadialPolygonDotsProps & T>) => ReturnEl;\n };\n Hover: <T>(props: MapProps<IRadarHoverProps & T>) => ReturnEl;\n};\n\nexport default Radar;\n"],"mappings":""}