@react-magma/charts 0.0.0-9de073 → 0.0.0-next.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 (39) hide show
  1. package/README.md +1 -40
  2. package/dist/charts.js +1 -1
  3. package/dist/charts.js.map +1 -1
  4. package/dist/charts.modern.js +63 -25
  5. package/dist/charts.modern.js.map +1 -1
  6. package/dist/charts.modern.module.js +1 -1
  7. package/dist/charts.modern.module.js.map +1 -1
  8. package/dist/charts.umd.js +1 -1
  9. package/dist/charts.umd.js.map +1 -1
  10. package/dist/components/LineChart/Chart.d.ts +11 -2
  11. package/dist/components/LineChart/ChartDataTable.d.ts +2 -1
  12. package/dist/components/LineChart/CustomAxisComponent.d.ts +3 -0
  13. package/dist/components/LineChart/CustomPointComponent.d.ts +17 -1
  14. package/dist/components/LineChart/DataTable.d.ts +1 -0
  15. package/dist/components/LineChart/GraphTooltip.d.ts +2 -1
  16. package/dist/components/LineChart/LegendButton.d.ts +1 -1
  17. package/dist/components/LineChart/LineChart.d.ts +29 -1
  18. package/dist/components/LineChart/LineChart.stories.d.ts +6 -7
  19. package/dist/components/LineChart/magma-charts.d.ts +1 -457
  20. package/dist/index.d.ts +0 -1
  21. package/package.json +8 -6
  22. package/src/components/LineChart/Chart.tsx +180 -20
  23. package/src/components/LineChart/ChartDataTable.test.js +1 -1
  24. package/src/components/LineChart/ChartDataTable.tsx +38 -32
  25. package/src/components/LineChart/CustomAxisComponent.tsx +29 -0
  26. package/src/components/LineChart/CustomPointComponent.tsx +81 -8
  27. package/src/components/LineChart/DataTable.tsx +3 -1
  28. package/src/components/LineChart/GraphTooltip.tsx +58 -26
  29. package/src/components/LineChart/LegendButton.tsx +32 -32
  30. package/src/components/LineChart/LineChart.stories.tsx +9 -9
  31. package/src/components/LineChart/LineChart.test.js +105 -11
  32. package/src/components/LineChart/LineChart.tsx +277 -113
  33. package/src/components/LineChart/magma-charts.ts +279 -0
  34. package/src/index.ts +0 -1
  35. package/dist/components/DataViz/DataVizTabs.d.ts +0 -8
  36. package/dist/components/DataViz/index.d.ts +0 -1
  37. package/src/components/DataViz/DataVizTabs.tsx +0 -48
  38. package/src/components/DataViz/index.ts +0 -1
  39. package/src/components/LineChart/magma-charts.js +0 -309
@@ -1,15 +1,24 @@
1
1
  import * as React from 'react';
2
2
  import { LineChartProps } from './LineChart';
3
3
  interface BaseChartProps {
4
+ /**
5
+ * Description of what the line chart data represents placed above the chart
6
+ */
4
7
  description?: string;
5
8
  testId?: string;
9
+ /**
10
+ * Title of the line chart
11
+ */
6
12
  title: string;
13
+ /**
14
+ * Type of chart - for now just 'line' is accepted
15
+ */
7
16
  type: string;
8
17
  }
9
18
  export interface ChartProps<T extends any> extends BaseChartProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>, LineChartProps<T> {
10
19
  }
11
- declare function BaseChart<T>(props: ChartProps<T>, ref: React.MutableRefObject<HTMLDivElement>): JSX.Element;
20
+ declare function BaseChart<T>(props: ChartProps<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
12
21
  export declare const Chart: <T>(props: ChartProps<T> & {
13
- ref?: React.MutableRefObject<HTMLDivElement>;
22
+ ref?: React.MutableRefObject<HTMLDivElement> | undefined;
14
23
  }) => ReturnType<typeof BaseChart>;
15
24
  export {};
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { VictoryAxisProps } from 'victory';
2
- export declare function toCamelCase(str: any): any;
3
+ export declare function toCamelCase(str: string): string;
3
4
  export interface DataTableProps {
4
5
  data?: any[];
5
6
  xData: {
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { LineSegmentProps } from 'victory';
3
+ export declare const CustomAxisComponent: React.FunctionComponent<LineSegmentProps>;
@@ -1 +1,17 @@
1
- export declare const CustomPointComponent: (props: any) => JSX.Element;
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) => JSX.Element;
17
+ export declare const CustomPointComponent: (props: CustomPointComponentInterface) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface DataTableProps {
2
3
  data?: any;
3
4
  }
@@ -1,2 +1,3 @@
1
- export declare const GraphTooltip: (props: any) => JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const GraphTooltip: (props: any) => JSX.Element | null;
2
3
  export declare const AxisTooltip: (props: any) => JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface DataTableProps {
3
- children?: any;
3
+ name?: string;
4
4
  color?: string;
5
5
  }
6
6
  export declare const LegendButton: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLButtonElement>>;
@@ -23,14 +23,42 @@ export interface LineChartComponentProps {
23
23
  yAxis?: VictoryAxisProps;
24
24
  }
25
25
  export interface LineChartProps<T extends ChartDataOptions> {
26
+ /**
27
+ * Props passed to each component that makes up the line chart. See `victory` for accepted props.
28
+ */
26
29
  componentProps?: LineChartComponentProps;
30
+ /**
31
+ * Data used to build the chart
32
+ */
27
33
  data?: LineChartData<T>[];
28
34
  isMulti?: boolean;
29
35
  /**
30
36
  * @internal
31
37
  */
32
- tabRef?: React.MutableRefObject<HTMLButtonElement>;
38
+ lastFocusedScatterPoint: React.MutableRefObject<SVGPathElement | null>;
39
+ /**
40
+ * @internal
41
+ */
42
+ pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
43
+ /**
44
+ * @internal
45
+ */
46
+ registerPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
47
+ /**
48
+ * @internal
49
+ */
50
+ tabRef: React.MutableRefObject<HTMLButtonElement | null>;
51
+ /**
52
+ * @internal
53
+ */
54
+ unregisterPoint: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
55
+ /**
56
+ * Value of x key in chart data
57
+ */
33
58
  x?: keyof T;
59
+ /**
60
+ * Value of y key in chart data
61
+ */
34
62
  y?: keyof T;
35
63
  }
36
64
  export declare function LineChart<T>(props: LineChartProps<T>): JSX.Element;
@@ -1,24 +1,23 @@
1
1
  import { ChartProps } from './index';
2
- import { Story, Meta } from '@storybook/react/types-6-0';
3
- declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
2
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/types-6-0").ReactFramework, import("@storybook/react/types-6-0").Args>;
4
3
  export default _default;
5
- export declare const Default: Story<ChartProps<any>>;
4
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, ChartProps<any>>;
6
5
  interface ExplicitDataInterface {
7
6
  month: string | number;
8
7
  sales: string | number;
9
8
  [key: string]: any;
10
9
  }
11
- export declare const ExplicitData: Story<ChartProps<ExplicitDataInterface>>;
10
+ export declare const ExplicitData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, ChartProps<ExplicitDataInterface>>;
12
11
  interface HistoryOfTexasInterface {
13
12
  year: number;
14
13
  number: number;
15
14
  label: string;
16
15
  }
17
- export declare const HistoryOfTexas: Story<ChartProps<HistoryOfTexasInterface>>;
18
- export declare const SpendingRevenue: Story<ChartProps<any>>;
16
+ export declare const HistoryOfTexas: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, ChartProps<HistoryOfTexasInterface>>;
17
+ export declare const SpendingRevenue: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, ChartProps<any>>;
19
18
  interface VotingParticipationInterface {
20
19
  year: number;
21
20
  percent: number;
22
21
  label: string;
23
22
  }
24
- export declare const VotingParticipation: Story<ChartProps<VotingParticipationInterface>>;
23
+ export declare const VotingParticipation: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, ChartProps<VotingParticipationInterface>>;
@@ -1,457 +1 @@
1
- declare namespace _default {
2
- export const area: {
3
- style: {
4
- data: {
5
- fill: string;
6
- };
7
- labels: {
8
- fontFamily: string;
9
- fontSize: number;
10
- letterSpacing: string;
11
- padding: number;
12
- fill: string;
13
- stroke: string;
14
- strokeWidth: number;
15
- };
16
- };
17
- } & {
18
- width: number;
19
- height: number;
20
- padding: number;
21
- };
22
- export const axis: {
23
- style: {
24
- axis: {
25
- fill: string;
26
- stroke: string;
27
- strokeWidth: number;
28
- strokeLinecap: string;
29
- strokeLinejoin: string;
30
- };
31
- axisLabel: {
32
- textAnchor: string;
33
- } & {
34
- fontFamily: string;
35
- fontSize: number;
36
- letterSpacing: string;
37
- padding: number;
38
- fill: string;
39
- stroke: string;
40
- strokeWidth: number;
41
- } & {
42
- padding: number;
43
- stroke: string;
44
- };
45
- grid: {
46
- fill: string;
47
- stroke: string;
48
- strokeLinecap: string;
49
- strokeLinejoin: string;
50
- pointerEvents: string;
51
- };
52
- ticks: {
53
- fill: string;
54
- size: number;
55
- stroke: string;
56
- strokeWidth: number;
57
- strokeLinecap: string;
58
- strokeLinejoin: string;
59
- };
60
- tickLabels: {
61
- fontFamily: string;
62
- fontSize: number;
63
- letterSpacing: string;
64
- padding: number;
65
- fill: string;
66
- stroke: string;
67
- strokeWidth: number;
68
- } & {
69
- fill: string;
70
- };
71
- };
72
- } & {
73
- width: number;
74
- height: number;
75
- padding: number;
76
- };
77
- export namespace polarDependentAxis {
78
- export namespace style {
79
- export namespace ticks {
80
- export const fill: string;
81
- export const size: number;
82
- export const stroke: string;
83
- }
84
- }
85
- }
86
- export const bar: {
87
- style: {
88
- data: {
89
- fill: string;
90
- padding: number;
91
- strokeWidth: number;
92
- };
93
- labels: {
94
- fontFamily: string;
95
- fontSize: number;
96
- letterSpacing: string;
97
- padding: number;
98
- fill: string;
99
- stroke: string;
100
- strokeWidth: number;
101
- };
102
- };
103
- } & {
104
- width: number;
105
- height: number;
106
- padding: number;
107
- };
108
- export const boxplot: {
109
- style: {
110
- max: {
111
- padding: number;
112
- stroke: string;
113
- strokeWidth: number;
114
- };
115
- maxLabels: {
116
- fontFamily: string;
117
- fontSize: number;
118
- letterSpacing: string;
119
- padding: number;
120
- fill: string;
121
- stroke: string;
122
- strokeWidth: number;
123
- } & {
124
- padding: number;
125
- };
126
- median: {
127
- padding: number;
128
- stroke: string;
129
- strokeWidth: number;
130
- };
131
- medianLabels: {
132
- fontFamily: string;
133
- fontSize: number;
134
- letterSpacing: string;
135
- padding: number;
136
- fill: string;
137
- stroke: string;
138
- strokeWidth: number;
139
- } & {
140
- padding: number;
141
- };
142
- min: {
143
- padding: number;
144
- stroke: string;
145
- strokeWidth: number;
146
- };
147
- minLabels: {
148
- fontFamily: string;
149
- fontSize: number;
150
- letterSpacing: string;
151
- padding: number;
152
- fill: string;
153
- stroke: string;
154
- strokeWidth: number;
155
- } & {
156
- padding: number;
157
- };
158
- q1: {
159
- padding: number;
160
- fill: string;
161
- };
162
- q1Labels: {
163
- fontFamily: string;
164
- fontSize: number;
165
- letterSpacing: string;
166
- padding: number;
167
- fill: string;
168
- stroke: string;
169
- strokeWidth: number;
170
- } & {
171
- padding: number;
172
- };
173
- q3: {
174
- padding: number;
175
- fill: string;
176
- };
177
- q3Labels: {
178
- fontFamily: string;
179
- fontSize: number;
180
- letterSpacing: string;
181
- padding: number;
182
- fill: string;
183
- stroke: string;
184
- strokeWidth: number;
185
- } & {
186
- padding: number;
187
- };
188
- };
189
- boxWidth: number;
190
- } & {
191
- width: number;
192
- height: number;
193
- padding: number;
194
- };
195
- export const candlestick: {
196
- style: {
197
- data: {
198
- stroke: string;
199
- };
200
- labels: {
201
- fontFamily: string;
202
- fontSize: number;
203
- letterSpacing: string;
204
- padding: number;
205
- fill: string;
206
- stroke: string;
207
- strokeWidth: number;
208
- } & {
209
- padding: number;
210
- };
211
- };
212
- candleColors: {
213
- positive: string;
214
- negative: string;
215
- };
216
- } & {
217
- width: number;
218
- height: number;
219
- padding: number;
220
- };
221
- export { baseProps as chart };
222
- export const errorbar: {
223
- borderWidth: number;
224
- style: {
225
- data: {
226
- fill: string;
227
- opacity: number;
228
- stroke: string;
229
- strokeWidth: number;
230
- };
231
- labels: {
232
- fontFamily: string;
233
- fontSize: number;
234
- letterSpacing: string;
235
- padding: number;
236
- fill: string;
237
- stroke: string;
238
- strokeWidth: number;
239
- };
240
- };
241
- } & {
242
- width: number;
243
- height: number;
244
- padding: number;
245
- };
246
- export const group: {
247
- colorScale: string[];
248
- } & {
249
- width: number;
250
- height: number;
251
- padding: number;
252
- };
253
- export const histogram: {
254
- style: {
255
- data: {
256
- fill: string;
257
- stroke: string;
258
- strokeWidth: number;
259
- };
260
- labels: {
261
- fontFamily: string;
262
- fontSize: number;
263
- letterSpacing: string;
264
- padding: number;
265
- fill: string;
266
- stroke: string;
267
- strokeWidth: number;
268
- };
269
- };
270
- } & {
271
- width: number;
272
- height: number;
273
- padding: number;
274
- };
275
- export namespace legend {
276
- export { colors as colorScale };
277
- export const gutter: number;
278
- export const orientation: string;
279
- export const titleOrientation: string;
280
- export namespace style_1 {
281
- export const data: {
282
- type: string;
283
- };
284
- export { baseLabelStyles as labels };
285
- export const title: {
286
- fontFamily: string;
287
- fontSize: number;
288
- letterSpacing: string;
289
- padding: number;
290
- fill: string;
291
- stroke: string;
292
- strokeWidth: number;
293
- } & {
294
- padding: number;
295
- };
296
- }
297
- export { style_1 as style };
298
- }
299
- export const line: {
300
- style: {
301
- data: {
302
- fill: string;
303
- opacity: number;
304
- stroke: string;
305
- strokeWidth: number;
306
- };
307
- labels: {
308
- fontFamily: string;
309
- fontSize: number;
310
- letterSpacing: string;
311
- padding: number;
312
- fill: string;
313
- stroke: string;
314
- strokeWidth: number;
315
- };
316
- };
317
- } & {
318
- width: number;
319
- height: number;
320
- padding: number;
321
- };
322
- export const pie: {
323
- colorScale: string[];
324
- style: {
325
- data: {
326
- padding: number;
327
- stroke: string;
328
- strokeWidth: number;
329
- };
330
- labels: {
331
- fontFamily: string;
332
- fontSize: number;
333
- letterSpacing: string;
334
- padding: number;
335
- fill: string;
336
- stroke: string;
337
- strokeWidth: number;
338
- } & {
339
- padding: number;
340
- };
341
- };
342
- } & {
343
- width: number;
344
- height: number;
345
- padding: number;
346
- };
347
- export const scatter: {
348
- style: {
349
- data: {
350
- fill: string;
351
- opacity: number;
352
- stroke: string;
353
- strokeWidth: number;
354
- };
355
- labels: {
356
- fontFamily: string;
357
- fontSize: number;
358
- letterSpacing: string;
359
- padding: number;
360
- fill: string;
361
- stroke: string;
362
- strokeWidth: number;
363
- };
364
- };
365
- } & {
366
- width: number;
367
- height: number;
368
- padding: number;
369
- };
370
- export const stack: {
371
- colorScale: string[];
372
- } & {
373
- width: number;
374
- height: number;
375
- padding: number;
376
- };
377
- export namespace tooltip {
378
- const style_2: {
379
- fontFamily: string;
380
- fontSize: number;
381
- letterSpacing: string;
382
- padding: number;
383
- fill: string;
384
- stroke: string;
385
- strokeWidth: number;
386
- } & {
387
- padding: number;
388
- pointerEvents: string;
389
- };
390
- export { style_2 as style };
391
- export namespace flyoutStyle {
392
- export { grey900 as stroke };
393
- export const strokeWidth: number;
394
- const fill_1: string;
395
- export { fill_1 as fill };
396
- export const pointerEvents: string;
397
- }
398
- export const flyoutPadding: number;
399
- export const cornerRadius: number;
400
- export const pointerLength: number;
401
- }
402
- export const voronoi: {
403
- style: {
404
- data: {
405
- fill: string;
406
- stroke: string;
407
- strokeWidth: number;
408
- };
409
- labels: {
410
- fontFamily: string;
411
- fontSize: number;
412
- letterSpacing: string;
413
- padding: number;
414
- fill: string;
415
- stroke: string;
416
- strokeWidth: number;
417
- } & {
418
- padding: number;
419
- pointerEvents: string;
420
- };
421
- flyout: {
422
- stroke: string;
423
- strokeWidth: number;
424
- fill: string;
425
- pointerEvents: string;
426
- };
427
- };
428
- } & {
429
- width: number;
430
- height: number;
431
- padding: number;
432
- };
433
- }
434
- export default _default;
435
- declare namespace baseProps {
436
- export const width: number;
437
- export const height: number;
438
- export const padding: number;
439
- }
440
- declare const colors: string[];
441
- declare namespace baseLabelStyles {
442
- export { sansSerif as fontFamily };
443
- export { fontSize };
444
- export { letterSpacing };
445
- export { padding };
446
- export { blueGrey700 as fill };
447
- const stroke_1: string;
448
- export { stroke_1 as stroke };
449
- const strokeWidth_1: number;
450
- export { strokeWidth_1 as strokeWidth };
451
- }
452
- declare const grey900: "pink";
453
- declare const sansSerif: "\"Open Sans\",Helvetica,sans-serif";
454
- declare const fontSize: 12;
455
- declare const letterSpacing: "normal";
456
- declare const padding_1: 8;
457
- declare const blueGrey700: "#3F3F3F";
1
+ export declare const magmaTheme: any;
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from './components/LineChart';
2
- export * from './components/DataViz';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-magma/charts",
3
- "version": "0.0.0-9de073",
3
+ "version": "0.0.0-next.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,18 +28,20 @@
28
28
  "peerDependencies": {
29
29
  "@emotion/core": "^10.1.1",
30
30
  "@emotion/styled": "^10.0.27",
31
- "react": "^15.0.0 || ^16.0.0",
32
- "react-dom": "^15.0.0 || ^16.0.0"
31
+ "react": "^15.0.0 || ^16.0.0 || ^17.0.0",
32
+ "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0",
33
+ "react-magma-dom": "^2.5.7-next.1",
34
+ "react-magma-icons": "^2.3.1"
33
35
  },
34
36
  "dependencies": {
35
- "react-magma-dom": "^2.5.1-next.0",
36
- "react-magma-icons": "^2.3.0",
37
37
  "victory": "^35.4.12"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@emotion/core": "^10.1.1",
41
41
  "@emotion/styled": "^10.0.27",
42
42
  "react": "^16.10.0",
43
- "react-dom": "^16.10.0"
43
+ "react-dom": "^16.10.0",
44
+ "react-magma-dom": "^2.5.7-next.1",
45
+ "react-magma-icons": "^2.3.1"
44
46
  }
45
47
  }