@react-fabric/chart 1.0.0-beta.9 → 1.0.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 (82) hide show
  1. package/{src/wrapper/Chart.module.css → css/_chart.css} +11 -11
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/charts/ActivityMap.js +70 -36
  4. package/dist/cjs/charts/CountSeries.js +67 -35
  5. package/dist/cjs/charts/DataSeries.js +75 -40
  6. package/dist/cjs/charts/Generic.js +41 -19
  7. package/dist/cjs/charts/MapSeries.js +41 -17
  8. package/dist/cjs/charts/TimeSeries.js +73 -40
  9. package/dist/cjs/charts/TimeSlider.js +40 -21
  10. package/dist/cjs/charts/WordBubble.js +65 -29
  11. package/dist/cjs/index.js +28 -0
  12. package/dist/cjs/theme/darkBase.js +13 -10
  13. package/dist/cjs/theme/index.js +43 -23
  14. package/dist/cjs/theme/lightBase.js +18 -15
  15. package/dist/cjs/theme/palettes.js +5 -54
  16. package/dist/cjs/types/charts.js +4 -2
  17. package/dist/cjs/types/utils.js +6 -9
  18. package/dist/cjs/wrapper/ChartContainer.js +26 -18
  19. package/dist/cjs/wrapper/ChartToolbar.js +4 -5
  20. package/dist/cjs/wrapper/ChartWrapper.js +4 -5
  21. package/dist/cjs/wrapper/PaletteSelect.js +31 -18
  22. package/dist/esm/charts/ActivityMap.js +71 -37
  23. package/dist/esm/charts/CountSeries.js +68 -36
  24. package/dist/esm/charts/DataSeries.js +76 -41
  25. package/dist/esm/charts/Generic.js +43 -21
  26. package/dist/esm/charts/MapSeries.js +41 -17
  27. package/dist/esm/charts/TimeSeries.js +74 -41
  28. package/dist/esm/charts/TimeSlider.js +41 -22
  29. package/dist/esm/charts/WordBubble.js +67 -31
  30. package/dist/esm/index.js +30 -0
  31. package/dist/esm/theme/darkBase.js +13 -10
  32. package/dist/esm/theme/index.js +43 -23
  33. package/dist/esm/theme/lightBase.js +18 -15
  34. package/dist/esm/theme/palettes.js +5 -54
  35. package/dist/esm/types/charts.js +4 -2
  36. package/dist/esm/types/utils.js +6 -9
  37. package/dist/esm/wrapper/ChartContainer.js +27 -19
  38. package/dist/esm/wrapper/ChartToolbar.js +4 -5
  39. package/dist/esm/wrapper/ChartWrapper.js +4 -5
  40. package/dist/esm/wrapper/PaletteSelect.js +32 -19
  41. package/dist/types/charts/ActivityMap.d.ts +20 -4
  42. package/dist/types/charts/CountSeries.d.ts +25 -3
  43. package/dist/types/charts/DataSeries.d.ts +26 -1
  44. package/dist/types/charts/Generic.d.ts +36 -52
  45. package/dist/types/charts/MapSeries.d.ts +31 -3
  46. package/dist/types/charts/TimeSeries.d.ts +24 -1
  47. package/dist/types/charts/TimeSlider.d.ts +19 -5
  48. package/dist/types/charts/WordBubble.d.ts +28 -5
  49. package/dist/types/index.d.ts +26 -0
  50. package/dist/types/theme/darkBase.d.ts +8 -5
  51. package/dist/types/theme/index.d.ts +3 -2
  52. package/dist/types/theme/lightBase.d.ts +8 -5
  53. package/dist/types/types/charts.d.ts +2 -1
  54. package/dist/types/types/index.d.ts +30 -12
  55. package/dist/types/types/world.svg.d.ts +1 -1
  56. package/dist/types/wrapper/ChartContainer.d.ts +7 -7
  57. package/dist/types/wrapper/ChartToolbar.d.ts +2 -3
  58. package/dist/types/wrapper/ChartWrapper.d.ts +3 -5
  59. package/dist/types/wrapper/PaletteSelect.d.ts +6 -1
  60. package/package.json +17 -21
  61. package/src/charts/ActivityMap.tsx +95 -94
  62. package/src/charts/CountSeries.tsx +73 -65
  63. package/src/charts/DataSeries.tsx +104 -98
  64. package/src/charts/Generic.tsx +56 -86
  65. package/src/charts/MapSeries.tsx +153 -151
  66. package/src/charts/TimeSeries.tsx +96 -79
  67. package/src/charts/TimeSlider.tsx +194 -195
  68. package/src/charts/WordBubble.tsx +97 -62
  69. package/src/index.ts +22 -17
  70. package/src/theme/darkBase.ts +12 -9
  71. package/src/theme/index.ts +92 -30
  72. package/src/theme/lightBase.ts +17 -14
  73. package/src/theme/palettes.ts +1 -52
  74. package/src/types/charts.ts +6 -2
  75. package/src/types/index.ts +40 -4
  76. package/src/types/utils.ts +18 -30
  77. package/src/wrapper/ChartContainer.tsx +48 -79
  78. package/src/wrapper/ChartToolbar.tsx +5 -12
  79. package/src/wrapper/ChartWrapper.tsx +5 -10
  80. package/src/wrapper/PaletteSelect.tsx +43 -40
  81. package/dist/cjs/wrapper/Chart.module.css +0 -1
  82. package/dist/esm/wrapper/Chart.module.css +0 -1
@@ -21,215 +21,214 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import {
25
- useDebounce,
26
- useEffectDebugger,
27
- useMemoDebugger,
28
- } from "@react-fabric/core";
24
+ import { useDebounce, useEffectDebugger, useMemoDebugger } from "@react-fabric/core";
29
25
  import { isEmpty } from "@react-fabric/utilities";
30
26
  import { endOfDay, startOfDay } from "date-fns";
31
- import { type EChartOption, type EChartsType } from "echarts";
27
+ import type { DataZoomComponentOption, EChartsOption, EChartsType } from "echarts";
32
28
  import { memo, useCallback, useEffect, useRef, useState, type FC } from "react";
33
- import { type BaseChart } from "../types";
29
+ import type { BaseChart } from "../types";
34
30
  import { ChartContainer } from "../wrapper/ChartContainer";
35
31
  import { ChartWrapper } from "../wrapper/ChartWrapper";
36
32
 
37
33
  export interface TimeSliderProps extends BaseChart {
38
- data: Array<[Date, number]>;
34
+ series: Array<[Date, number]>;
39
35
  range?: { start: Date; end: Date };
40
36
  onBrush?: (range: { start: Date; end: Date }) => void;
41
37
  }
42
38
 
43
- const TimeSliderChart: FC<TimeSliderProps> = memo(
44
- ({ data, range: sliderRange, onBrush }: TimeSliderProps) => {
45
- const chartRef = useRef<EChartsType>(null);
46
-
47
- const [range, setRange] = useState({ startValue: 0, endValue: 0 });
48
-
49
- const handleBrush = useDebounce(
50
- (range: AnyObject) => onBrush?.(range),
51
- [onBrush],
52
- 100,
53
- );
54
-
55
- useEffect(() => {
56
- const defaultStart = data.length > 0 ? data?.[0]?.[0]?.getTime() : 0;
57
- const defaultEnd =
58
- data.length > 0 ? data?.[data.length - 1]?.[0]?.getTime() : 32;
59
-
60
- const getRangeValue = (v: number = 0, def = 0) =>
61
- v >= defaultStart && v <= defaultEnd ? v : def;
62
- setRange({
63
- startValue: getRangeValue(sliderRange?.start.getTime(), defaultStart),
64
- endValue: getRangeValue(sliderRange?.end.getTime(), defaultEnd),
65
- });
66
- }, [sliderRange, data]);
67
-
68
- const enableBrush = useCallback(() => {
69
- chartRef.current?.dispatchAction({
70
- type: "restore",
71
- });
72
- chartRef.current?.dispatchAction({
73
- type: "takeGlobalCursor",
74
- key: "dataZoomSelect",
75
- // Activate or inactivate.
76
- dataZoomSelectActive: true,
77
- });
78
- }, []);
79
-
80
- useEffectDebugger(
81
- () => {
82
- const chart = chartRef.current;
83
- if (chart && !chart?.isDisposed()) {
84
- enableBrush();
85
- chart.on("datazoom", () => {
86
- const zoom = chart.getOption().dataZoom?.[0];
87
- if (zoom) {
88
- const startValue = Math.floor(zoom.startValue as number);
89
- const endValue = Math.ceil(
90
- (zoom.endValue as number) + (24 * 60 * 60 * 1000 - 1),
91
- );
92
- handleBrush({
93
- start: startOfDay(new Date(startValue)),
94
- end: endOfDay(new Date(endValue)),
95
- });
96
- setRange({ startValue, endValue });
97
- }
98
- });
99
- return () => {
100
- !chart.isDisposed() && chart.off("datazoom");
101
- };
102
- }
103
- },
104
- [chartRef.current, handleBrush],
105
- "TimeSldier onBrush",
106
- );
107
-
108
- const options = useMemoDebugger<EChartOption>(
109
- () => {
110
- if (isEmpty(data)) {
111
- chartRef.current?.clear();
112
- return {};
113
- }
114
-
115
- const categoryAxis: AnyObject = {
116
- type: "time",
117
- nameGap: 0,
118
- nameLocation: "center",
119
- axisTick: {
120
- show: false,
121
- },
122
- axisLabel: {
123
- inside: true,
124
- },
125
- axisLine: {
126
- show: false,
127
- },
128
- position: "bottom",
129
- } as EChartOption.XAxis;
130
- const valueAxis: AnyObject = {
131
- type: "value",
132
- nameGap: 24,
133
- axisLabel: {
134
- show: false,
135
- },
136
- axisLine: {
137
- show: false,
138
- },
139
- axisTick: {
140
- show: false,
141
- },
142
- splitLine: {
143
- show: false,
144
- },
145
- nameLocation: "center",
146
- } as EChartOption.YAxis;
147
-
148
- const series = [
149
- {
150
- areaStyle: {},
151
- symbol: "none",
152
- type: "line",
153
- smooth: true,
154
- lineStyle: { width: 2 },
155
- data,
156
- } as AnyObject,
157
- ];
158
-
159
- return {
160
- grid: {
161
- top: 4,
162
- left: 0,
163
- right: 0,
164
- bottom: "50%",
165
- },
166
- xAxis: categoryAxis,
167
- yAxis: valueAxis,
168
- series,
169
- toolbox: {
170
- itemSize: 0,
171
- feature: {
172
- dataZoom: {
173
- yAxisIndex: "none",
174
- },
39
+ const TimeSliderChart: FC<TimeSliderProps> = memo(({ series: dataSeries, range: sliderRange, onBrush }: TimeSliderProps) => {
40
+ const chartRef = useRef<EChartsType>(null);
41
+
42
+ const [range, setRange] = useState({ startValue: 0, endValue: 0 });
43
+
44
+ const handleBrush = useDebounce((range: { start: Date; end: Date }) => onBrush?.(range), [onBrush], 250);
45
+
46
+ useEffect(() => {
47
+ const defaultStart = dataSeries.length > 0 ? dataSeries?.[0]?.[0]?.getTime() : 0;
48
+ const defaultEnd = dataSeries.length > 0 ? dataSeries?.[dataSeries.length - 1]?.[0]?.getTime() : 32;
49
+
50
+ const getRangeValue = (v: number = 0, def = 0) => (v >= defaultStart && v <= defaultEnd ? v : def);
51
+ // eslint-disable-next-line @eslint-react/set-state-in-effect
52
+ setRange({
53
+ startValue: getRangeValue(sliderRange?.start.getTime(), defaultStart),
54
+ endValue: getRangeValue(sliderRange?.end.getTime(), defaultEnd),
55
+ });
56
+ }, [sliderRange, dataSeries]);
57
+
58
+ const enableBrush = useCallback(() => {
59
+ chartRef.current?.dispatchAction({
60
+ type: "restore",
61
+ });
62
+ chartRef.current?.dispatchAction({
63
+ type: "takeGlobalCursor",
64
+ key: "dataZoomSelect",
65
+ // Activate or inactivate.
66
+ dataZoomSelectActive: true,
67
+ });
68
+ }, []);
69
+
70
+ useEffectDebugger(
71
+ () => {
72
+ const chart = chartRef.current;
73
+ if (chart && !chart?.isDisposed()) {
74
+ enableBrush();
75
+ chart.on("datazoom", () => {
76
+ const zoom = ((chart.getOption() as EChartsOption).dataZoom as DataZoomComponentOption[])?.[0];
77
+ if (zoom) {
78
+ const startValue = Math.floor(zoom.startValue as number);
79
+ const endValue = Math.ceil((zoom.endValue as number) + (24 * 60 * 60 * 1000 - 1));
80
+ handleBrush({
81
+ start: startOfDay(new Date(startValue)),
82
+ end: endOfDay(new Date(endValue)),
83
+ });
84
+ setRange({ startValue, endValue });
85
+ }
86
+ });
87
+ return () => {
88
+ if (!chart.isDisposed()) chart.off("datazoom");
89
+ };
90
+ }
91
+ },
92
+ [chartRef.current, handleBrush],
93
+ "TimeSldier onBrush",
94
+ );
95
+
96
+ const options = useMemoDebugger<EChartsOption>(
97
+ () => {
98
+ if (isEmpty(dataSeries)) {
99
+ chartRef.current?.clear();
100
+ return {};
101
+ }
102
+
103
+ const categoryAxis = {
104
+ type: "time",
105
+ nameGap: 0,
106
+ nameLocation: "center",
107
+ axisTick: {
108
+ show: false,
109
+ },
110
+ axisLabel: {
111
+ inside: true,
112
+ },
113
+ axisLine: {
114
+ show: false,
115
+ },
116
+ position: "bottom",
117
+ } as EChartsOption["xAxis"];
118
+ const valueAxis = {
119
+ type: "value",
120
+ nameGap: 24,
121
+ axisLabel: {
122
+ show: false,
123
+ },
124
+ axisLine: {
125
+ show: false,
126
+ },
127
+ axisTick: {
128
+ show: false,
129
+ },
130
+ splitLine: {
131
+ show: false,
132
+ },
133
+ nameLocation: "center",
134
+ } as EChartsOption["yAxis"];
135
+
136
+ const series = [
137
+ {
138
+ areaStyle: {},
139
+ symbol: "none",
140
+ type: "line" as const,
141
+ smooth: true,
142
+ lineStyle: { width: 2 },
143
+ data: dataSeries,
144
+ },
145
+ ];
146
+
147
+ return {
148
+ grid: {
149
+ top: 4,
150
+ left: 0,
151
+ right: 0,
152
+ bottom: "50%",
153
+ },
154
+ xAxis: categoryAxis,
155
+ yAxis: valueAxis,
156
+ series,
157
+ toolbox: {
158
+ itemSize: 0,
159
+ feature: {
160
+ dataZoom: {
161
+ yAxisIndex: "none",
175
162
  },
176
163
  },
177
- legend: {
178
- show: false,
164
+ },
165
+ legend: {
166
+ show: false,
167
+ },
168
+ dataZoom: {
169
+ type: "slider",
170
+ height: "45%",
171
+ bottom: 4,
172
+ left: 2,
173
+ right: 8,
174
+ ...range,
175
+ },
176
+ tooltip: {
177
+ trigger: "axis",
178
+ confine: true,
179
+ position: "top",
180
+ },
181
+ };
182
+ },
183
+ [dataSeries],
184
+ "TimeSlider options",
185
+ );
186
+
187
+ useEffect(() => {
188
+ const tmr = setTimeout(() => {
189
+ chartRef.current?.setOption({
190
+ dataZoom: [
191
+ {
192
+ type: "slider",
193
+ height: "45%",
194
+ bottom: 4,
195
+ left: 2,
196
+ right: 8,
197
+ ...range,
179
198
  },
180
- dataZoom: [
181
- {
182
- type: "slider",
183
- height: "45%",
184
- bottom: 4,
185
- left: 2,
186
- right: 8,
187
- ...range,
188
- },
189
- ],
190
- tooltip: {
191
- trigger: "axis",
192
- confine: true,
193
- position: "top",
194
- } as AnyObject,
195
- };
196
- },
197
- [data],
198
- "TimeSlider options",
199
- );
200
-
201
- useEffect(() => {
202
- setTimeout(() => {
203
- chartRef.current?.setOption({
204
- dataZoom: [
205
- {
206
- type: "slider",
207
- height: "45%",
208
- bottom: 4,
209
- left: 2,
210
- right: 8,
211
- ...range,
212
- } as AnyObject,
213
- ],
214
- });
215
- }, 50);
216
- }, [chartRef.current, range]);
217
-
218
- return (
219
- <ChartContainer
220
- options={options}
221
- chartRef={chartRef}
222
- isEmpty={isEmpty(data)}
223
- />
224
- );
225
- },
226
- );
199
+ ],
200
+ });
201
+ }, 50);
202
+ return () => {
203
+ clearTimeout(tmr);
204
+ };
205
+ }, [range]);
206
+
207
+ return <ChartContainer options={options} chartRef={chartRef} isEmpty={isEmpty(dataSeries)} />;
208
+ });
227
209
  TimeSliderChart.displayName = "TimeSliderChart";
228
210
 
229
211
  /**
230
- * Chart to display time scale data with zoom and brush */
231
- export const TimeSlider: FC<TimeSliderProps> = (props) => (
232
- <ChartWrapper>
233
- <TimeSliderChart {...props} />
234
- </ChartWrapper>
235
- );
212
+ * TimeSlider component renders a time slider chart.
213
+ * It allows users to visualize time-based data and interactively select a range.
214
+ * The chart supports brushing to select a specific time range,
215
+ * and it emits an event when the range is changed.
216
+ *
217
+ * @example
218
+ * ```jsx
219
+ * <TimeSlider
220
+ * data={data}
221
+ * range={{ start: new Date("2023-01-01"), end: new Date("2023-12-31") }}
222
+ * onBrush={(range) => console.log("Selected range:", range)}
223
+ * />
224
+ * ```
225
+ * @see {@link https://echarts.apache.org/en/option.html#dataZoom} for more details on the ECharts dataZoom feature.
226
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series.
227
+ */
228
+ export function TimeSlider(props: TimeSliderProps) {
229
+ return (
230
+ <ChartWrapper>
231
+ <TimeSliderChart {...props} />
232
+ </ChartWrapper>
233
+ );
234
+ }
@@ -21,85 +21,120 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { CoreIcons, useIsDark, useMemoDebugger } from "@react-fabric/core";
25
- import { compareValues, isEmpty } from "@react-fabric/utilities";
26
- import { type EChartOption } from "echarts";
24
+ import { useIsDark, useMemoDebugger } from "@react-fabric/core";
25
+ import { isEmpty } from "@react-fabric/utilities";
26
+ import { type EChartsOption } from "echarts";
27
27
  import { memo, type FC } from "react";
28
28
  import { ChartPalette } from "../theme/palettes";
29
- import { type BaseChart, type CountType } from "../types";
29
+ import { type BaseChart } from "../types";
30
30
  import { countRenderer } from "../types/utils";
31
31
  import { ChartContainer } from "../wrapper/ChartContainer";
32
32
  import { ChartWrapper } from "../wrapper/ChartWrapper";
33
33
 
34
- export interface WordBubbleProps extends Omit<BaseChart, "theme">, CountType {
34
+ export interface WordBubbleProps extends Omit<BaseChart, "theme"> {
35
+ series: Array<{ id: string; label?: string; count: number }>;
35
36
  onClick?: (key: string) => void;
36
37
  }
37
38
 
38
- const WordBubbleChart: FC<WordBubbleProps> = memo(
39
- ({ data, title, onExport, onClick }: WordBubbleProps) => {
40
- const isDark = useIsDark();
39
+ const WordBubbleChart: FC<WordBubbleProps> = memo(({ series, title, onExport, onClick }: WordBubbleProps) => {
40
+ const isDark = useIsDark();
41
41
 
42
- const options = useMemoDebugger<EChartOption>(
43
- () => {
44
- if (isEmpty(data)) return {};
42
+ const options = useMemoDebugger<EChartsOption>(
43
+ () => {
44
+ if (isEmpty(series)) return {};
45
45
 
46
- const palette = isDark
47
- ? ChartPalette.CloudDark
48
- : ChartPalette.CloudLight;
46
+ const palette = isDark ? ChartPalette.CloudDark : ChartPalette.CloudLight;
49
47
 
50
- return {
51
- legend: undefined,
52
- series: [
53
- {
54
- name: title,
55
- type: "wordCloud",
56
- shape: "circle",
57
- sizeRange: [12, 60],
58
- gridSize: 32,
59
- rotationRange: [-10, 10],
48
+ return {
49
+ legend: undefined,
50
+ tooltip: {
51
+ trigger: "axis",
52
+ confine: true,
53
+ position: "top",
54
+ appendToBody: true,
55
+ },
56
+ grid: {
57
+ top: 128,
58
+ bottom: 16,
59
+ },
60
+ series: [
61
+ {
62
+ name: title,
63
+ type: "custom",
64
+ renderItem: "wordCloud" as never,
65
+ coordinateSystem: "none",
66
+ itemPayload: {
67
+ shape: "circle" as const,
68
+ gridSize: 4,
69
+ sizeRange: [32, 96],
70
+ rotationRange: [0, 0],
60
71
  rotationStep: 1,
61
72
  drawOutOfBound: false,
62
- layoutAnimation: true,
63
- textStyle: {
64
- fontFamily: "sans-serif",
65
- fontWeight: "bold",
66
- color: ({ dataIndex }: KeyValue) =>
67
- palette[dataIndex % palette.length],
68
- },
69
- data: data
70
- .sort(compareValues("desc", "count"))
71
- .map(({ id: key, label, count }, index) => ({
72
- name: label ?? key,
73
- value: count,
74
- })),
73
+ top: 48,
74
+ bottom: 32,
75
+ left: 32,
76
+ right: 32,
75
77
  },
76
- ],
77
- };
78
- },
79
- [data, title, isDark],
80
- "WordChart options",
81
- );
78
+ data: series.map(({ id: key, label, count }, index) => ({
79
+ name: label ?? key,
80
+ value: [label ?? key, count],
81
+ itemStyle: {
82
+ color: palette[index % palette.length],
83
+ },
84
+ emphasis: {
85
+ itemStyle: {
86
+ color: "#f00",
87
+ },
88
+ },
89
+ })),
90
+ },
91
+ ],
92
+ };
93
+ },
94
+ [series, title, isDark],
95
+ "WordChart options",
96
+ );
82
97
 
83
- return (
84
- <ChartContainer
85
- title={title}
86
- onExport={onExport}
87
- options={options}
88
- isEmpty={isEmpty(data)}
89
- emptyIcon={CoreIcons.chartActivityScatter}
90
- dataTableRenderer={countRenderer}
91
- onClick={(e) => onClick?.(e?.name ?? "")}
92
- />
93
- );
94
- },
95
- );
98
+ return (
99
+ <ChartContainer
100
+ title={title}
101
+ onExport={onExport}
102
+ options={options}
103
+ isEmpty={isEmpty(series)}
104
+ emptyIcon="icon-[mdi--chart-bubble]"
105
+ dataTableRenderer={countRenderer}
106
+ onClick={(e) => onClick?.(e?.name ?? "")}
107
+ />
108
+ );
109
+ });
96
110
  WordBubbleChart.displayName = "WordBubbleChart";
97
111
 
98
112
  /**
99
- * Chart to display simple word cloud
113
+ * WordBubble component renders a word cloud chart using ECharts.
114
+ * It displays words with sizes proportional to their frequency in the data.
115
+ * Users can click on words to trigger an action, such as filtering or navigating.
116
+ * It also supports exporting the chart and displays an empty state when no data is available.
117
+ *
118
+ * @example
119
+ * ```jsx
120
+ * <WordBubble
121
+ * data={[
122
+ * { id: "1", label: "Word One", count: 10 },
123
+ * { id: "2", label: "Word Two", count: 20 },
124
+ * { id: "3", label: "Word Three", count: 30 },
125
+ * ]}
126
+ * title="Word Frequency"
127
+ * onExport={() => console.log("Exporting chart...")}
128
+ * onClick={(key) => console.log("Clicked word:", key)}
129
+ * theme="light"
130
+ * />
131
+ * ```
132
+ * @see {@link https://github.com/apache/echarts-custom-series} for the underlying chart implementation.
100
133
  */
101
- export const WordBubble: FC<WordBubbleProps> = (props) => (
102
- <ChartWrapper>
103
- <WordBubbleChart {...props} />
104
- </ChartWrapper>
105
- );
134
+ export function WordBubble(props: WordBubbleProps) {
135
+ return (
136
+ <ChartWrapper>
137
+ <WordBubbleChart {...props} />
138
+ </ChartWrapper>
139
+ );
140
+ }
package/src/index.ts CHANGED
@@ -1,26 +1,31 @@
1
- /*
1
+ /**
2
2
  * React Fabric
3
- * @version: 1.0.0
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
4
6
  *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
5
13
  *
6
- * The MIT License (MIT)
7
- * Copyright (c) 2024 Adarsh Pastakia
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
8
16
  *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all copies or substantial
16
- * portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
22
24
  */
23
25
 
26
+ export const CHARTS_PACKAGE = "@react-fabric/charts";
27
+ export const CHARTS_VERSION = "1.0.0";
28
+
24
29
  export { ActivityMap } from "./charts/ActivityMap";
25
30
  export { CountSeries } from "./charts/CountSeries";
26
31
  export { DataSeries } from "./charts/DataSeries";