@wonderflow/react-components 12.6.0 → 12.8.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/components/card/card.module.css +1 -1
- package/dist/components/product-card/product-card.stories.js +1 -1
- package/dist/components/split-button/split-button.stories.d.ts +1 -1
- package/dist/components/tab/tab.stories.d.ts +1 -0
- package/dist/components/tab/tab.stories.d.ts.map +1 -1
- package/dist/components/tab/tab.stories.js +39 -2
- package/dist/components/table/mocked-data.d.ts +233 -0
- package/dist/components/table/mocked-data.d.ts.map +1 -0
- package/dist/components/table/mocked-data.js +923 -0
- package/dist/components/table/table.stories.d.ts.map +1 -1
- package/dist/components/table/table.stories.js +4 -915
- package/dist/examples/charts/mock-data/channels.d.ts +45 -0
- package/dist/examples/charts/mock-data/channels.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/channels.js +393 -0
- package/dist/examples/charts/mock-data/feedbackCount.d.ts +28 -0
- package/dist/examples/charts/mock-data/feedbackCount.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/feedbackCount.js +283 -0
- package/dist/examples/charts/mock-data/index.d.ts +4 -0
- package/dist/examples/charts/mock-data/index.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/index.js +18 -0
- package/dist/examples/charts/mock-data/prosCons.d.ts +7 -0
- package/dist/examples/charts/mock-data/prosCons.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/prosCons.js +83 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.d.ts +10 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.d.ts.map +1 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.js +114 -0
- package/dist/examples/charts/storybook/line-chart.stories.d.ts +19 -0
- package/dist/examples/charts/storybook/line-chart.stories.d.ts.map +1 -0
- package/dist/examples/charts/storybook/line-chart.stories.js +233 -0
- package/dist/examples/charts/storybook/sb-charts.module.css +1 -0
- package/package.json +24 -4
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CartesianChartLayout, LineChart } from '@wonderflow/charts';
|
|
3
|
+
import { Card } from '../../..';
|
|
4
|
+
// import { CartesianChartLayout, LineChart, LineChartProps } from '../../../../../charts/src';
|
|
5
|
+
import { channels, channelsB, feedbackCount, feedbackCountGaps, proCons, } from '../mock-data';
|
|
6
|
+
import styles from './sb-charts.module.css';
|
|
7
|
+
const story = {
|
|
8
|
+
title: 'Charts/Line Chart',
|
|
9
|
+
component: LineChart,
|
|
10
|
+
args: {
|
|
11
|
+
title: 'Line Charts',
|
|
12
|
+
subtitle: 'A trend line chart',
|
|
13
|
+
preventResponsive: false,
|
|
14
|
+
isLoading: false,
|
|
15
|
+
showMarker: false,
|
|
16
|
+
showMarkerLabel: false,
|
|
17
|
+
hideMissingDataConnection: false,
|
|
18
|
+
hideLegend: false,
|
|
19
|
+
hidePadding: false,
|
|
20
|
+
layout: CartesianChartLayout.HORIZONTAL,
|
|
21
|
+
renderAs: 'curves',
|
|
22
|
+
theme: 'light',
|
|
23
|
+
data: feedbackCount,
|
|
24
|
+
index: {
|
|
25
|
+
dataKey: 'date',
|
|
26
|
+
label: 'Year',
|
|
27
|
+
},
|
|
28
|
+
series: {
|
|
29
|
+
dataKey: ['feedback count'],
|
|
30
|
+
label: 'Feedback Count',
|
|
31
|
+
},
|
|
32
|
+
overlay: undefined,
|
|
33
|
+
},
|
|
34
|
+
argTypes: {
|
|
35
|
+
layout: {
|
|
36
|
+
options: ['horizontal', 'vertical'],
|
|
37
|
+
control: { type: 'radio' },
|
|
38
|
+
},
|
|
39
|
+
renderAs: {
|
|
40
|
+
options: ['curves', 'lines', 'steps'],
|
|
41
|
+
control: { type: 'radio' },
|
|
42
|
+
},
|
|
43
|
+
theme: {
|
|
44
|
+
options: ['light', 'dark'],
|
|
45
|
+
control: { type: 'radio' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export default story;
|
|
50
|
+
const Template = (args) => _jsx(LineChart, { ...args });
|
|
51
|
+
export const Default = Template.bind({});
|
|
52
|
+
Default.args = {};
|
|
53
|
+
export const withOverlay = Template.bind({});
|
|
54
|
+
withOverlay.args = {
|
|
55
|
+
subtitle: 'A trend line chart with overlay',
|
|
56
|
+
overlay: {
|
|
57
|
+
dataKey: 'overlay',
|
|
58
|
+
label: 'Overlay',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const withMissingData = Template.bind({});
|
|
62
|
+
withMissingData.args = {
|
|
63
|
+
data: feedbackCountGaps,
|
|
64
|
+
subtitle: 'A trend line chart with null values',
|
|
65
|
+
overlay: {
|
|
66
|
+
dataKey: 'overlay',
|
|
67
|
+
label: 'Overlay',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const withMultipleSeries = Template.bind({});
|
|
71
|
+
withMultipleSeries.args = {
|
|
72
|
+
title: 'Multiple Series',
|
|
73
|
+
subtitle: 'A trend line chart with multiple series',
|
|
74
|
+
data: proCons,
|
|
75
|
+
index: {
|
|
76
|
+
dataKey: 'date',
|
|
77
|
+
label: 'Time',
|
|
78
|
+
},
|
|
79
|
+
series: {
|
|
80
|
+
domain: [0, 200],
|
|
81
|
+
dataKey: ['positive', 'negative', 'neutral'],
|
|
82
|
+
label: 'Pros & cons',
|
|
83
|
+
style: [undefined, undefined, { stroke: 'gray' }],
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export const withLabelIndex = Template.bind({});
|
|
87
|
+
withLabelIndex.args = {
|
|
88
|
+
title: 'Multiple Series',
|
|
89
|
+
subtitle: 'A line chart with label index',
|
|
90
|
+
data: channels,
|
|
91
|
+
index: {
|
|
92
|
+
dataKey: 'channel',
|
|
93
|
+
label: 'Channels',
|
|
94
|
+
},
|
|
95
|
+
series: {
|
|
96
|
+
dataKey: ['1 star', '2 stars', '3 stars', '4 stars', '5 stars'],
|
|
97
|
+
label: 'Feedback count',
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
export const withNestedData = Template.bind({});
|
|
101
|
+
withNestedData.args = {
|
|
102
|
+
title: 'Multiple Series',
|
|
103
|
+
subtitle: 'A line chart rendered from nested data',
|
|
104
|
+
data: channelsB,
|
|
105
|
+
index: {
|
|
106
|
+
dataKey: 'channel',
|
|
107
|
+
label: 'Channels',
|
|
108
|
+
},
|
|
109
|
+
series: {
|
|
110
|
+
dataKey: ['1 star.value', '2 stars.value', '3 stars.value', '4 stars.value', '5 stars.value'],
|
|
111
|
+
label: 'Feedback count',
|
|
112
|
+
rename: (_, i) => Array(i + 1).fill('⭐').join(),
|
|
113
|
+
},
|
|
114
|
+
overlay: {
|
|
115
|
+
dataKey: 'overlay.value',
|
|
116
|
+
label: 'TGW',
|
|
117
|
+
domain: [0, 5],
|
|
118
|
+
style: {
|
|
119
|
+
strokeDasharray: '2 4',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
tooltip: {
|
|
123
|
+
extraSeriesData: series => `${series.percentage}%`,
|
|
124
|
+
extraOverlayData: overlay => `${overlay.percentage}%`,
|
|
125
|
+
extraContent: _jsx("div", { children: "some extra content" }),
|
|
126
|
+
},
|
|
127
|
+
renderAs: 'lines',
|
|
128
|
+
layout: CartesianChartLayout.VERTICAL,
|
|
129
|
+
showMarker: true,
|
|
130
|
+
};
|
|
131
|
+
export const withCustomLineStyle = Template.bind({});
|
|
132
|
+
withCustomLineStyle.args = {
|
|
133
|
+
title: 'Multiple Series',
|
|
134
|
+
subtitle: 'A trend line chart with multiple series',
|
|
135
|
+
data: proCons,
|
|
136
|
+
index: {
|
|
137
|
+
dataKey: 'date',
|
|
138
|
+
label: 'Time',
|
|
139
|
+
},
|
|
140
|
+
series: {
|
|
141
|
+
dataKey: ['positive', 'negative', 'neutral'],
|
|
142
|
+
label: 'Pros & cons',
|
|
143
|
+
style: [
|
|
144
|
+
undefined,
|
|
145
|
+
{
|
|
146
|
+
stroke: 'red',
|
|
147
|
+
strokeDasharray: '6 8',
|
|
148
|
+
strokeOpacity: '0.5',
|
|
149
|
+
strokeWidth: '3',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
stroke: 'grey',
|
|
153
|
+
strokeDasharray: '2 4',
|
|
154
|
+
strokeOpacity: '0.8',
|
|
155
|
+
strokeWidth: '1.5',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
export const withCustomDomain = Template.bind({});
|
|
161
|
+
withCustomDomain.args = {
|
|
162
|
+
subtitle: 'A trend line chart with custom domain',
|
|
163
|
+
series: {
|
|
164
|
+
dataKey: ['feedback count'],
|
|
165
|
+
label: 'Feedback Count',
|
|
166
|
+
domain: [-12000, 12000],
|
|
167
|
+
},
|
|
168
|
+
index: {
|
|
169
|
+
dataKey: 'date',
|
|
170
|
+
label: 'Year',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
export const withVerticalLayout = Template.bind({});
|
|
174
|
+
withVerticalLayout.args = {
|
|
175
|
+
layout: CartesianChartLayout.VERTICAL,
|
|
176
|
+
overlay: {
|
|
177
|
+
dataKey: 'overlay',
|
|
178
|
+
label: 'Overlay',
|
|
179
|
+
},
|
|
180
|
+
index: {
|
|
181
|
+
dataKey: 'date',
|
|
182
|
+
label: 'Year',
|
|
183
|
+
},
|
|
184
|
+
series: {
|
|
185
|
+
dataKey: ['feedback count'],
|
|
186
|
+
label: 'Feedback Count',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
export const withNoData = Template.bind({});
|
|
190
|
+
withNoData.args = {
|
|
191
|
+
data: [],
|
|
192
|
+
title: 'Line Charts',
|
|
193
|
+
subtitle: 'A trend line chart w/o data',
|
|
194
|
+
emptyStateMessage: 'Please select items from the right menu to render the chart.',
|
|
195
|
+
};
|
|
196
|
+
export const renderAsLines = Template.bind({});
|
|
197
|
+
renderAsLines.args = {
|
|
198
|
+
title: 'Multiple Series',
|
|
199
|
+
subtitle: 'A trend line chart rendered with lines',
|
|
200
|
+
data: proCons,
|
|
201
|
+
renderAs: 'lines',
|
|
202
|
+
index: {
|
|
203
|
+
dataKey: 'date',
|
|
204
|
+
label: 'Time',
|
|
205
|
+
},
|
|
206
|
+
series: {
|
|
207
|
+
domain: [0, 200],
|
|
208
|
+
dataKey: ['positive', 'negative'],
|
|
209
|
+
label: 'Pros & cons',
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
export const renderAsSteps = Template.bind({});
|
|
213
|
+
renderAsSteps.args = {
|
|
214
|
+
title: 'Multiple Series',
|
|
215
|
+
subtitle: 'A trend line chart rendered with steps',
|
|
216
|
+
data: proCons,
|
|
217
|
+
renderAs: 'steps',
|
|
218
|
+
index: {
|
|
219
|
+
dataKey: 'date',
|
|
220
|
+
label: 'Time',
|
|
221
|
+
},
|
|
222
|
+
series: {
|
|
223
|
+
domain: [0, 200],
|
|
224
|
+
dataKey: ['positive', 'negative'],
|
|
225
|
+
label: 'Pros & cons',
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
const WithinCardTemplate = args => (_jsx(Card, { bordered: true, className: styles.Card, children: _jsx(LineChart, { ...args }) }));
|
|
229
|
+
export const WithinCard = WithinCardTemplate.bind({});
|
|
230
|
+
WithinCard.args = {
|
|
231
|
+
subtitle: 'A trend line chart within a card 75vh and width 100%',
|
|
232
|
+
hidePadding: true,
|
|
233
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Card{div & [data-inner-element=Content]{height:75vh;overflow:hidden;width:100%}}.InfoState{transform:translateY(50%)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.8.0",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -78,12 +78,15 @@
|
|
|
78
78
|
"@storybook/test-runner": "0.9.4",
|
|
79
79
|
"@storybook/testing-react": "1.3.0",
|
|
80
80
|
"@storybook/theming": "6.5.16",
|
|
81
|
+
"@types/d3": "7.4.1",
|
|
81
82
|
"@types/react": "17.0.43",
|
|
82
83
|
"@types/react-dom": "17.0.14",
|
|
83
84
|
"@types/react-table": "7.7.12",
|
|
84
85
|
"@types/react-test-renderer": "18.0.0",
|
|
85
|
-
"@wonderflow/config": "12.
|
|
86
|
-
"@wonderflow/tokens": "12.
|
|
86
|
+
"@wonderflow/config": "12.8.0",
|
|
87
|
+
"@wonderflow/tokens": "12.8.0",
|
|
88
|
+
"@wonderflow/charts": "12.8.0",
|
|
89
|
+
"@types/uuid": "9.0.2",
|
|
87
90
|
"babel-loader": "8.2.5",
|
|
88
91
|
"cpy-cli": "3.1.1",
|
|
89
92
|
"postcss": "8.4.17",
|
|
@@ -100,10 +103,26 @@
|
|
|
100
103
|
},
|
|
101
104
|
"dependencies": {
|
|
102
105
|
"@radix-ui/react-tabs": "1.0.0",
|
|
106
|
+
"@visx/annotation": "3.3.0",
|
|
107
|
+
"@visx/axis": "3.3.0",
|
|
108
|
+
"@visx/curve": "3.3.0",
|
|
109
|
+
"@visx/event": "3.3.0",
|
|
110
|
+
"@visx/gradient": "3.3.0",
|
|
111
|
+
"@visx/grid": "3.3.0",
|
|
112
|
+
"@visx/group": "3.3.0",
|
|
113
|
+
"@visx/mock-data": "3.3.0",
|
|
114
|
+
"@visx/responsive": "3.3.0",
|
|
115
|
+
"@visx/scale": "3.3.0",
|
|
116
|
+
"@visx/shape": "3.3.0",
|
|
117
|
+
"@visx/text": "3.3.0",
|
|
118
|
+
"@visx/tooltip": "3.3.0",
|
|
119
|
+
"@visx/vendor": "3.3.0",
|
|
103
120
|
"ahooks": "3.7.5",
|
|
104
121
|
"clsx": "1.2.1",
|
|
105
122
|
"constate": "3.3.2",
|
|
123
|
+
"d3": "7.8.5",
|
|
106
124
|
"framer-motion": "6.5.1",
|
|
125
|
+
"lodash": "4.17.21",
|
|
107
126
|
"react-focus-on": "3.6.0",
|
|
108
127
|
"react-masonry-css": "1.0.16",
|
|
109
128
|
"react-merge-refs": "2.0.1",
|
|
@@ -113,6 +132,7 @@
|
|
|
113
132
|
"react-table": "7.8.0",
|
|
114
133
|
"react-uid": "2.3.2",
|
|
115
134
|
"slugify": "1.6.5",
|
|
116
|
-
"type-fest": "3.0.0"
|
|
135
|
+
"type-fest": "3.0.0",
|
|
136
|
+
"uuid": "9.0.0"
|
|
117
137
|
}
|
|
118
138
|
}
|