@react-magma/charts 11.0.0-next.2 → 11.0.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.
- package/dist/charts +100 -79
- package/dist/charts.css +19 -3
- package/dist/charts.css.map +1 -1
- package/dist/charts.js +1 -1
- package/dist/charts.js.map +1 -1
- package/dist/charts.map +1 -1
- package/dist/charts.modern.module.js +1 -1
- package/dist/charts.modern.module.js.map +1 -1
- package/dist/charts.umd.js +1 -1
- package/dist/charts.umd.js.map +1 -1
- package/dist/components/CarbonChart/index.d.ts +1 -1
- package/dist/components/LineChart/ChartDataTable.d.ts +1 -0
- package/dist/components/LineChart/DataTable.d.ts +1 -0
- package/dist/components/LineChart/GraphTooltip.d.ts +1 -0
- package/package.json +26 -26
- package/src/components/CarbonChart/CarbonChart.test.js +3 -1
- package/src/components/CarbonChart/CarbonChart.tsx +123 -101
- package/src/components/CarbonChart/CarbonChartArea.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartBar.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +4 -4
- package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartLine.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartPie.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +4 -2
- package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +3 -1
- package/src/components/CarbonChart/CarbonChartStep.stories.tsx +3 -1
- package/src/components/CarbonChart/index.ts +1 -1
- package/src/components/CarbonChart/styles.min.css +24790 -3
- package/src/components/LineChart/Chart.tsx +10 -5
- package/src/components/LineChart/ChartDataTable.test.js +3 -1
- package/src/components/LineChart/ChartDataTable.tsx +6 -6
- package/src/components/LineChart/CustomAxisComponent.tsx +1 -0
- package/src/components/LineChart/CustomPointComponent.tsx +2 -1
- package/src/components/LineChart/GraphTooltip.tsx +2 -2
- package/src/components/LineChart/LegendButton.tsx +1 -0
- package/src/components/LineChart/LineChart.stories.tsx +4 -1
- package/src/components/LineChart/LineChart.test.js +4 -1
- package/src/components/LineChart/LineChart.tsx +11 -12
- package/src/index.ts +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
import { KeyboardIcon } from 'react-magma-icons';
|
|
4
2
|
|
|
5
|
-
import {
|
|
6
|
-
import { ChartDataTable } from './ChartDataTable';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
7
4
|
import {
|
|
8
5
|
Announce,
|
|
9
6
|
ButtonVariant,
|
|
@@ -22,6 +19,10 @@ import {
|
|
|
22
19
|
useDescendants,
|
|
23
20
|
styled,
|
|
24
21
|
} from 'react-magma-dom';
|
|
22
|
+
import { KeyboardIcon } from 'react-magma-icons';
|
|
23
|
+
|
|
24
|
+
import { ChartDataTable } from './ChartDataTable';
|
|
25
|
+
import { LineChart, LineChartProps } from './LineChart';
|
|
25
26
|
|
|
26
27
|
interface BaseChartProps {
|
|
27
28
|
/**
|
|
@@ -119,7 +120,11 @@ function BaseChart<T>(props: ChartProps<T>, ref: React.Ref<HTMLDivElement>) {
|
|
|
119
120
|
setIsKeyboardInstructionsOpen(prevOpen => !prevOpen);
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
function handleKeyboardInstructionsButtonKeydown(event: {
|
|
123
|
+
function handleKeyboardInstructionsButtonKeydown(event: {
|
|
124
|
+
preventDefault?: any;
|
|
125
|
+
key?: any;
|
|
126
|
+
shiftKey?: any;
|
|
127
|
+
}) {
|
|
123
128
|
const { key, shiftKey } = event;
|
|
124
129
|
|
|
125
130
|
switch (key) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
|
|
2
3
|
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
+
|
|
4
5
|
import { ChartDataTable } from './ChartDataTable';
|
|
6
|
+
import { basicData, explicitData } from './test/exampleChartData';
|
|
5
7
|
|
|
6
8
|
describe('Chart Data Table', () => {
|
|
7
9
|
describe('Basic Data', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { VictoryAxisProps } from 'victory';
|
|
3
2
|
|
|
4
3
|
import { Card, Datagrid, Spinner } from 'react-magma-dom';
|
|
4
|
+
import { VictoryAxisProps } from 'victory';
|
|
5
5
|
|
|
6
6
|
export function toCamelCase(str: string) {
|
|
7
7
|
return str
|
|
@@ -58,7 +58,7 @@ export const ChartDataTable = (props: DataTableProps) => {
|
|
|
58
58
|
return valuesArray;
|
|
59
59
|
}, []);
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
const baseTableData = {
|
|
62
62
|
columns:
|
|
63
63
|
xTickValuesArray.length > 0
|
|
64
64
|
? [
|
|
@@ -79,10 +79,10 @@ export const ChartDataTable = (props: DataTableProps) => {
|
|
|
79
79
|
? xTickFormat(xTickValues[tick - 1])
|
|
80
80
|
: xTickValues[tick - 1]
|
|
81
81
|
: xTickFormat && Array.isArray(xTickFormat)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
? xTickFormat[tick - 1]
|
|
83
|
+
: xTickFormat && typeof xTickFormat === 'function'
|
|
84
|
+
? xTickFormat(tick)
|
|
85
|
+
: tick;
|
|
86
86
|
agg.push({
|
|
87
87
|
[xField]: tickValue,
|
|
88
88
|
id: index,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { useForceUpdate } from 'react-magma-dom';
|
|
4
|
+
import { Point, PointProps } from 'victory';
|
|
4
5
|
|
|
5
6
|
export interface CustomScatterDataComponentInterface extends PointProps {
|
|
6
7
|
lineIndex: number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import styled from '@emotion/styled';
|
|
2
4
|
import {
|
|
3
5
|
StyledTooltip,
|
|
4
6
|
ThemeContext,
|
|
@@ -7,8 +9,6 @@ import {
|
|
|
7
9
|
ThemeInterface,
|
|
8
10
|
} from 'react-magma-dom';
|
|
9
11
|
|
|
10
|
-
import styled from '@emotion/styled';
|
|
11
|
-
|
|
12
12
|
const StyledGraphTooltip = styled(StyledTooltip)`
|
|
13
13
|
background: ${(props: any) => props.theme.colors.neutral100};
|
|
14
14
|
border: 1px solid ${(props: any) => props.theme.colors.neutral300};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
4
|
+
|
|
4
5
|
import {
|
|
5
6
|
historyOfTexas as historyOfTexasData,
|
|
6
7
|
spendingRevenue as spendingRevenueData,
|
|
7
8
|
votingParticipation as votingParticipationData,
|
|
8
9
|
} from './test/exampleChartData';
|
|
9
10
|
|
|
11
|
+
import { Chart, ChartProps } from './index';
|
|
12
|
+
|
|
10
13
|
const data = [
|
|
11
14
|
{
|
|
12
15
|
name: 'Team 1',
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
|
|
2
3
|
import { render, fireEvent } from '@testing-library/react';
|
|
3
4
|
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { defaultI18n } from 'react-magma-dom';
|
|
6
|
+
|
|
4
7
|
import { basicData, explicitData } from './test/exampleChartData';
|
|
8
|
+
|
|
5
9
|
import { Chart } from '.';
|
|
6
|
-
import { defaultI18n } from 'react-magma-dom';
|
|
7
10
|
|
|
8
11
|
const componentProps = {
|
|
9
12
|
xAxis: {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import {
|
|
5
|
+
I18nContext,
|
|
6
|
+
ThemeContext,
|
|
7
|
+
ThemeInterface,
|
|
8
|
+
I18nInterface,
|
|
9
|
+
} from 'react-magma-dom';
|
|
2
10
|
import {
|
|
3
11
|
VictoryAxis,
|
|
4
12
|
VictoryAxisProps,
|
|
@@ -12,20 +20,11 @@ import {
|
|
|
12
20
|
VictoryVoronoiContainer,
|
|
13
21
|
} from 'victory';
|
|
14
22
|
|
|
15
|
-
import {
|
|
16
|
-
I18nContext,
|
|
17
|
-
ThemeContext,
|
|
18
|
-
ThemeInterface,
|
|
19
|
-
I18nInterface,
|
|
20
|
-
} from 'react-magma-dom';
|
|
21
|
-
|
|
22
|
-
import { magmaTheme } from './magma-charts';
|
|
23
|
-
import { AxisTooltip, GraphTooltip } from './GraphTooltip';
|
|
24
|
-
import { CustomScatterDataComponent } from './CustomPointComponent';
|
|
25
23
|
import { CustomAxisComponent } from './CustomAxisComponent';
|
|
24
|
+
import { CustomScatterDataComponent } from './CustomPointComponent';
|
|
25
|
+
import { AxisTooltip, GraphTooltip } from './GraphTooltip';
|
|
26
26
|
import { LegendButton } from './LegendButton';
|
|
27
|
-
|
|
28
|
-
import styled from '@emotion/styled';
|
|
27
|
+
import { magmaTheme } from './magma-charts';
|
|
29
28
|
|
|
30
29
|
export type LineChartAxisStyle = VictoryAxisProps['style'];
|
|
31
30
|
export type DataGetterPropType = VictoryLineProps['x'];
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './components/LineChart';
|
|
2
|
-
export * from './components/CarbonChart';
|
|
2
|
+
export * from './components/CarbonChart';
|