@react-magma/charts 13.0.0 → 13.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 (83) hide show
  1. package/dist/charts.js +2450 -1
  2. package/dist/charts.js.map +1 -1
  3. package/dist/charts.modern.module.js +2428 -1
  4. package/dist/charts.modern.module.js.map +1 -1
  5. package/dist/charts.umd.js +49165 -1
  6. package/dist/charts.umd.js.map +1 -1
  7. package/dist/components/CarbonChart/CarbonChart.d.ts +2 -1
  8. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +310 -0
  9. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +136 -0
  10. package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +214 -0
  11. package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +82 -0
  12. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +234 -0
  13. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +266 -0
  14. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +53 -0
  15. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +196 -0
  16. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +35 -0
  17. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +580 -0
  18. package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +120 -0
  19. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +43 -0
  20. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +89 -0
  21. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +577 -0
  22. package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +55 -0
  23. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +127 -0
  24. package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +101 -0
  25. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +98 -0
  26. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +173 -0
  27. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +51 -0
  28. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +38 -0
  29. package/dist/components/LineChart/Chart.d.ts +27 -0
  30. package/dist/components/LineChart/ChartDataTable.d.ts +17 -0
  31. package/dist/components/LineChart/CustomAxisComponent.d.ts +3 -0
  32. package/dist/components/LineChart/CustomPointComponent.d.ts +17 -0
  33. package/dist/components/LineChart/DataTable.d.ts +5 -0
  34. package/dist/components/LineChart/GraphTooltip.d.ts +3 -0
  35. package/dist/components/LineChart/LegendButton.d.ts +6 -0
  36. package/dist/components/LineChart/LineChart.d.ts +67 -0
  37. package/dist/components/LineChart/LineChart.stories.d.ts +113 -0
  38. package/dist/components/LineChart/index.d.ts +1 -0
  39. package/dist/components/LineChart/magma-charts.d.ts +1 -0
  40. package/dist/index.d.ts +1 -0
  41. package/package.json +28 -26
  42. package/src/components/CarbonChart/CarbonChart.test.js +506 -0
  43. package/src/components/CarbonChart/CarbonChart.tsx +53 -57
  44. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +1 -1
  45. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +1 -1
  46. package/src/components/CarbonChart/CarbonChartBar.stories.tsx +1 -1
  47. package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +1 -1
  48. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +1 -1
  49. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +1 -1
  50. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +1 -1
  51. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +1 -1
  52. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +1 -1
  53. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1 -1
  54. package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +1 -1
  55. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +1 -1
  56. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +1 -1
  57. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1 -1
  58. package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +1 -1
  59. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +1 -1
  60. package/src/components/CarbonChart/CarbonChartPie.stories.tsx +1 -1
  61. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +1 -1
  62. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +1 -1
  63. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +1 -1
  64. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +1 -1
  65. package/src/components/CarbonChart/carbon-charts.css +24931 -0
  66. package/src/components/LineChart/Chart.tsx +241 -0
  67. package/src/components/LineChart/ChartDataTable.test.js +165 -0
  68. package/src/components/LineChart/ChartDataTable.tsx +135 -0
  69. package/src/components/LineChart/CustomAxisComponent.tsx +30 -0
  70. package/src/components/LineChart/CustomPointComponent.tsx +93 -0
  71. package/src/components/LineChart/DataTable.tsx +57 -0
  72. package/src/components/LineChart/GraphTooltip.tsx +100 -0
  73. package/src/components/LineChart/LegendButton.tsx +77 -0
  74. package/src/components/LineChart/LineChart.stories.tsx +399 -0
  75. package/src/components/LineChart/LineChart.test.js +501 -0
  76. package/src/components/LineChart/LineChart.tsx +669 -0
  77. package/src/components/LineChart/index.ts +1 -0
  78. package/src/components/LineChart/magma-charts.ts +279 -0
  79. package/src/components/LineChart/test/exampleChartData.js +289 -0
  80. package/src/index.ts +1 -0
  81. package/dist/components/CarbonChart/CarbonChart.test.d.ts +0 -1
  82. package/dist/components/CarbonChart/embeddedStyles.d.ts +0 -1
  83. package/src/components/CarbonChart/embeddedStyles.ts +0 -24880
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { PointProps } from 'victory';
3
+ export interface CustomScatterDataComponentInterface extends PointProps {
4
+ lineIndex: number;
5
+ pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
6
+ registerPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
7
+ unregisterPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
8
+ }
9
+ export interface CustomPointComponentInterface {
10
+ lineIndex: number;
11
+ pointIndex: PointProps['index'];
12
+ pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
13
+ registerPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
14
+ unregisterPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
15
+ }
16
+ export declare const CustomScatterDataComponent: (props: CustomScatterDataComponentInterface) => React.JSX.Element;
17
+ export declare const CustomPointComponent: (props: CustomPointComponentInterface) => React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface DataTableProps {
3
+ data?: any;
4
+ }
5
+ export declare const DataTable: (props: any) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ export declare const GraphTooltip: (props: any) => React.JSX.Element | null;
3
+ export declare const AxisTooltip: (props: any) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface DataTableProps {
3
+ name?: string;
4
+ color?: string;
5
+ }
6
+ export declare const LegendButton: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+ import { VictoryAxisProps, VictoryChartProps, VictoryLineProps, VictoryScatterProps } from 'victory';
3
+ export declare type LineChartAxisStyle = VictoryAxisProps['style'];
4
+ export declare type DataGetterPropType = VictoryLineProps['x'];
5
+ export declare type ChartDataOptions = {
6
+ label: string;
7
+ x: string | number;
8
+ y: string | number;
9
+ [key: string]: any;
10
+ } | {
11
+ label: string;
12
+ [key: string]: any;
13
+ } | any;
14
+ export interface LineChartData<T> {
15
+ name: string;
16
+ data: T[];
17
+ }
18
+ export interface LineChartComponentProps {
19
+ chart?: VictoryChartProps;
20
+ line?: VictoryLineProps;
21
+ scatter?: VictoryScatterProps;
22
+ xAxis?: VictoryAxisProps;
23
+ yAxis?: VictoryAxisProps;
24
+ }
25
+ /**
26
+ * @deprecated Please use CarbonChart instead
27
+ */
28
+ export interface LineChartProps<T extends ChartDataOptions> {
29
+ /**
30
+ * Props passed to each component that makes up the line chart. See `victory` for accepted props.
31
+ */
32
+ componentProps?: LineChartComponentProps;
33
+ /**
34
+ * Data used to build the chart
35
+ */
36
+ data?: LineChartData<T>[];
37
+ isMulti?: boolean;
38
+ /**
39
+ * @internal
40
+ */
41
+ lastFocusedScatterPoint: React.MutableRefObject<SVGPathElement | null>;
42
+ /**
43
+ * @internal
44
+ */
45
+ pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
46
+ /**
47
+ * @internal
48
+ */
49
+ registerPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
50
+ /**
51
+ * @internal
52
+ */
53
+ tabRef: React.MutableRefObject<HTMLButtonElement | null>;
54
+ /**
55
+ * @internal
56
+ */
57
+ unregisterPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
58
+ /**
59
+ * Value of x key in chart data
60
+ */
61
+ x?: keyof T;
62
+ /**
63
+ * Value of y key in chart data
64
+ */
65
+ y?: keyof T;
66
+ }
67
+ export declare function LineChart<T>(props: LineChartProps<T>): React.JSX.Element;
@@ -0,0 +1,113 @@
1
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/types-6-0").ReactFramework, import("@storybook/react/types-6-0").Args>;
2
+ export default _default;
3
+ export declare const Default: {
4
+ args: {
5
+ data: {
6
+ name: string;
7
+ data: {
8
+ x: number;
9
+ y: number;
10
+ label: string;
11
+ }[];
12
+ }[];
13
+ description: string;
14
+ title: string;
15
+ type: string;
16
+ componentProps: {
17
+ xAxis: {
18
+ label: string;
19
+ tickFormat: string[];
20
+ };
21
+ yAxis: {
22
+ domain: number[];
23
+ label: string;
24
+ tickFormat: (t: any) => string;
25
+ tickValues: number[];
26
+ };
27
+ };
28
+ };
29
+ };
30
+ export declare const ExplicitData: {
31
+ args: {
32
+ componentProps: {
33
+ xAxis: {
34
+ tickFormat: string[];
35
+ label: string;
36
+ };
37
+ yAxis: {
38
+ domain: number[];
39
+ label: string;
40
+ tickFormat: (t: any) => string;
41
+ tickValues: number[];
42
+ };
43
+ };
44
+ data: {
45
+ name: string;
46
+ data: {
47
+ month: number;
48
+ sales: number;
49
+ label: string;
50
+ }[];
51
+ }[];
52
+ x: string;
53
+ y: string;
54
+ description: string;
55
+ title: string;
56
+ type: string;
57
+ };
58
+ };
59
+ export declare const HistoryOfTexas: {
60
+ args: {
61
+ description: string;
62
+ title: string;
63
+ componentProps: {
64
+ xAxis: {
65
+ label: string;
66
+ tickValues: number[];
67
+ };
68
+ yAxis: {
69
+ label: string;
70
+ tickFormat: (t: any) => any;
71
+ tickValues: number[];
72
+ };
73
+ };
74
+ data: any;
75
+ x: string;
76
+ y: string;
77
+ type: string;
78
+ };
79
+ };
80
+ export declare const SpendingRevenue: {
81
+ args: {
82
+ data: any;
83
+ title: string;
84
+ type: string;
85
+ componentProps: {
86
+ xAxis: {
87
+ label: string;
88
+ };
89
+ yAxis: {
90
+ label: string;
91
+ tickValues: number[];
92
+ };
93
+ };
94
+ };
95
+ };
96
+ export declare const VotingParticipation: {
97
+ args: {
98
+ data: any;
99
+ title: string;
100
+ type: string;
101
+ componentProps: {
102
+ xAxis: {
103
+ label: string;
104
+ };
105
+ yAxis: {
106
+ domain: number[];
107
+ label: string;
108
+ };
109
+ };
110
+ x: string;
111
+ y: string;
112
+ };
113
+ };
@@ -0,0 +1 @@
1
+ export * from './Chart';
@@ -0,0 +1 @@
1
+ export declare const magmaTheme: any;
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export * from './components/LineChart';
1
2
  export * from './components/CarbonChart';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-magma/charts",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -19,39 +19,41 @@
19
19
  "src"
20
20
  ],
21
21
  "scripts": {
22
- "build": "microbundle build --jsx jsx --jsxImportSource react --globals react/jsx-runtime=jsx,@emotion/react=EmotionReact,@emotion/styled=EmotionStyled,@carbon/charts-react=CarbonChartsReact",
23
- "build-watch": "microbundle watch --jsx jsx --jsxImportSource react --globals react/jsx-runtime=jsx,@emotion/react=EmotionReact,@emotion/styled=EmotionStyled,@carbon/charts-react=CarbonChartsReact",
22
+ "build": "rollup -c rollup.config.js --bundleConfigAsCjs",
23
+ "build-watch": "rollup -c rollup.config.js --watch --bundleConfigAsCjs",
24
24
  "lint": "eslint ./src",
25
- "lint:fix": "eslint ./src --fix",
26
- "lint:check": "eslint ./src --max-warnings=0",
27
25
  "test": "jest",
28
- "test-watch": "jest --watch",
29
- "compiler-checks": "tsc --noEmit --project ./tsconfig.json"
26
+ "test-watch": "jest --watch"
30
27
  },
31
28
  "dependencies": {
32
- "@carbon/charts-react": "1.23.7",
33
- "d3": "7.9.0",
34
- "d3-cloud": "1.2.7",
35
- "d3-sankey": "0.12.3"
29
+ "@carbon/charts-react": "^1.14.8",
30
+ "d3": "^7.9.0",
31
+ "d3-cloud": "^1.2.7",
32
+ "d3-sankey": "^0.12.3",
33
+ "victory": "^37.3.6"
36
34
  },
37
35
  "devDependencies": {
38
- "@emotion/react": "11.14.0",
39
- "@emotion/styled": "11.14.0",
40
- "dom-to-image-more": "3.6.0",
41
- "framer-motion": "^12.23.22",
42
- "identity-obj-proxy": "3.0.0",
43
- "react": "18.3.1",
44
- "react-dom": "18.3.1",
45
- "react-magma-dom": "4.9.0-next.27",
46
- "react-magma-icons": "^3.1.0"
36
+ "@emotion/react": "^11.13.0",
37
+ "@emotion/styled": "^11.13.0",
38
+ "@rollup/plugin-commonjs": "^28.0.8",
39
+ "@rollup/plugin-node-resolve": "^16.0.3",
40
+ "@rollup/plugin-typescript": "^12.1.4",
41
+ "dom-to-image-more": "3.1.4",
42
+ "identity-obj-proxy": "^3.0.0",
43
+ "react": "^17.0.2",
44
+ "react-dom": "^17.0.2",
45
+ "react-magma-dom": "^4.11.0",
46
+ "react-magma-icons": "^3.2.4",
47
+ "rollup": "^4.52.4",
48
+ "rollup-plugin-postcss": "^4.0.2"
47
49
  },
48
50
  "peerDependencies": {
49
- "@emotion/react": "^11.14.0",
50
- "@emotion/styled": "^11.14.0",
51
- "react": "^18.3.1",
52
- "react-dom": "^18.3.1",
53
- "react-magma-dom": "^4.9.0-next.27",
54
- "react-magma-icons": "^3.2.0"
51
+ "@emotion/react": "^11.13.0",
52
+ "@emotion/styled": "^11.13.0",
53
+ "react": "^17.0.2",
54
+ "react-dom": "^17.0.2",
55
+ "react-magma-dom": "^4.11.0-next.3",
56
+ "react-magma-icons": "^3.2.4"
55
57
  },
56
58
  "engines": {
57
59
  "node": ">=14.15.0",