@react-magma/charts 16.0.0-next.1 → 16.0.0-v6-next.3
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.js +1517 -114
- package/dist/charts.js.map +1 -1
- package/dist/charts.modern.module.js +1519 -117
- package/dist/charts.modern.module.js.map +1 -1
- package/dist/charts.umd.js +49860 -28910
- package/dist/charts.umd.js.map +1 -1
- package/dist/components/CarbonChart/CarbonChart.d.ts +1 -1
- package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +310 -0
- package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +136 -0
- package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +232 -0
- package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +82 -0
- package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +234 -0
- package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +266 -0
- package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +53 -0
- package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +196 -0
- package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +35 -0
- package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +580 -0
- package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +120 -0
- package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +43 -0
- package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +89 -0
- package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +577 -0
- package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +55 -0
- package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +127 -0
- package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +101 -0
- package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +98 -0
- package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +173 -0
- package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +51 -0
- package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +38 -0
- package/dist/components/ChartTable/ChartTable.stories.d.ts +166 -0
- package/dist/components/LineChart/Chart.d.ts +27 -0
- package/dist/components/LineChart/ChartDataTable.d.ts +17 -0
- package/dist/components/LineChart/CustomAxisComponent.d.ts +3 -0
- package/dist/components/LineChart/CustomPointComponent.d.ts +17 -0
- package/dist/components/LineChart/DataTable.d.ts +5 -0
- package/dist/components/LineChart/GraphTooltip.d.ts +3 -0
- package/dist/components/LineChart/LegendButton.d.ts +6 -0
- package/dist/components/LineChart/LineChart.d.ts +67 -0
- package/dist/components/LineChart/LineChart.stories.d.ts +113 -0
- package/dist/components/LineChart/index.d.ts +1 -0
- package/dist/components/LineChart/magma-charts.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +21 -24
- package/src/components/CarbonChart/CarbonChart.test.js +257 -173
- package/src/components/CarbonChart/CarbonChart.tsx +44 -39
- package/src/components/CarbonChart/CarbonChartArea.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBar.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartLine.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartPie.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +5 -3
- package/src/components/CarbonChart/CarbonChartStep.stories.tsx +5 -3
- package/src/components/ChartTable/ChartDataTable.tsx +0 -3
- package/src/components/ChartTable/ChartMoreOptionsButton.tsx +0 -1
- package/src/components/ChartTable/ChartTable.test.js +0 -8
- package/src/components/ChartTable/ChartTableButton.tsx +0 -1
- package/src/components/ChartTable/ChartToolbar.tsx +0 -1
- package/src/components/ChartTable/chartToolbarI18n.ts +1 -1
- package/src/components/LineChart/Chart.tsx +241 -0
- package/src/components/LineChart/ChartDataTable.test.js +165 -0
- package/src/components/LineChart/ChartDataTable.tsx +135 -0
- package/src/components/LineChart/CustomAxisComponent.tsx +30 -0
- package/src/components/LineChart/CustomPointComponent.tsx +93 -0
- package/src/components/LineChart/DataTable.tsx +57 -0
- package/src/components/LineChart/GraphTooltip.tsx +100 -0
- package/src/components/LineChart/LegendButton.tsx +77 -0
- package/src/components/LineChart/LineChart.stories.tsx +399 -0
- package/src/components/LineChart/LineChart.test.js +501 -0
- package/src/components/LineChart/LineChart.tsx +669 -0
- package/src/components/LineChart/index.ts +1 -0
- package/src/components/LineChart/magma-charts.ts +279 -0
- package/src/components/LineChart/test/exampleChartData.js +289 -0
- package/src/hooks/useCarbonModalFocusManagement.ts +0 -12
- package/src/index.ts +1 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// *
|
|
2
|
+
// * Colors
|
|
3
|
+
// *
|
|
4
|
+
// const yellow200 = '#FFF59D';
|
|
5
|
+
// const deepOrange600 = '#F4511E';
|
|
6
|
+
// const lime300 = '#DCE775';
|
|
7
|
+
// const lightGreen500 = '#8BC34A';
|
|
8
|
+
// const teal700 = '#00796B';
|
|
9
|
+
// const cyan900 = '#006064';
|
|
10
|
+
|
|
11
|
+
// const colors = [
|
|
12
|
+
// '#0085CC',
|
|
13
|
+
// '#E0004D',
|
|
14
|
+
// '#FA6600',
|
|
15
|
+
// '#48A200',
|
|
16
|
+
// '#B12FAD',
|
|
17
|
+
// '#00A393',
|
|
18
|
+
// ];
|
|
19
|
+
|
|
20
|
+
const colors = [
|
|
21
|
+
'#00507A',
|
|
22
|
+
'#8F0033',
|
|
23
|
+
'#B84900',
|
|
24
|
+
'#255200',
|
|
25
|
+
'#711E6E',
|
|
26
|
+
'#005249',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const blueGrey50 = '#DFDFDF';
|
|
30
|
+
const blueGrey300 = '#8F8F8F';
|
|
31
|
+
const blueGrey700 = '#3F3F3F';
|
|
32
|
+
const grey900 = 'pink';
|
|
33
|
+
|
|
34
|
+
// *
|
|
35
|
+
// * Typography
|
|
36
|
+
// *
|
|
37
|
+
const sansSerif = '"Work Sans",Helvetica,sans-serif';
|
|
38
|
+
const letterSpacing = 'normal';
|
|
39
|
+
const fontSize = 12;
|
|
40
|
+
|
|
41
|
+
// *
|
|
42
|
+
// * Layout
|
|
43
|
+
// *
|
|
44
|
+
const padding = 8;
|
|
45
|
+
const baseProps = {
|
|
46
|
+
width: 350,
|
|
47
|
+
height: 350,
|
|
48
|
+
padding: 50,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// *
|
|
52
|
+
// * Labels
|
|
53
|
+
// *
|
|
54
|
+
const baseLabelStyles = {
|
|
55
|
+
fontFamily: sansSerif,
|
|
56
|
+
fontSize,
|
|
57
|
+
letterSpacing,
|
|
58
|
+
padding,
|
|
59
|
+
fill: blueGrey700,
|
|
60
|
+
stroke: 'transparent',
|
|
61
|
+
strokeWidth: 0,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const centeredLabelStyles = { textAnchor: 'middle', ...baseLabelStyles };
|
|
65
|
+
// *
|
|
66
|
+
// * Strokes
|
|
67
|
+
// *
|
|
68
|
+
// const strokeDasharray = '10, 5';
|
|
69
|
+
const strokeLinecap = 'round';
|
|
70
|
+
const strokeLinejoin = 'round';
|
|
71
|
+
|
|
72
|
+
export const magmaTheme: any = {
|
|
73
|
+
area: {
|
|
74
|
+
style: {
|
|
75
|
+
data: {
|
|
76
|
+
fill: grey900,
|
|
77
|
+
},
|
|
78
|
+
labels: baseLabelStyles,
|
|
79
|
+
},
|
|
80
|
+
...baseProps,
|
|
81
|
+
},
|
|
82
|
+
axis: {
|
|
83
|
+
style: {
|
|
84
|
+
axis: {
|
|
85
|
+
fill: 'transparent',
|
|
86
|
+
stroke: blueGrey300,
|
|
87
|
+
strokeWidth: 1,
|
|
88
|
+
strokeLinecap,
|
|
89
|
+
strokeLinejoin,
|
|
90
|
+
},
|
|
91
|
+
axisLabel: {
|
|
92
|
+
...centeredLabelStyles,
|
|
93
|
+
padding,
|
|
94
|
+
stroke: 'transparent',
|
|
95
|
+
},
|
|
96
|
+
grid: {
|
|
97
|
+
fill: 'none',
|
|
98
|
+
stroke: '#dfdfdf',
|
|
99
|
+
//strokeDasharray,
|
|
100
|
+
strokeLinecap,
|
|
101
|
+
strokeLinejoin,
|
|
102
|
+
pointerEvents: 'painted',
|
|
103
|
+
},
|
|
104
|
+
ticks: {
|
|
105
|
+
fill: 'transparent',
|
|
106
|
+
size: 0,
|
|
107
|
+
stroke: blueGrey300,
|
|
108
|
+
strokeWidth: 0,
|
|
109
|
+
strokeLinecap,
|
|
110
|
+
strokeLinejoin,
|
|
111
|
+
},
|
|
112
|
+
tickLabels: {
|
|
113
|
+
...baseLabelStyles,
|
|
114
|
+
fill: blueGrey700,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
...baseProps,
|
|
118
|
+
},
|
|
119
|
+
polarDependentAxis: {
|
|
120
|
+
style: {
|
|
121
|
+
ticks: {
|
|
122
|
+
fill: 'transparent',
|
|
123
|
+
size: 1,
|
|
124
|
+
stroke: 'transparent',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
bar: {
|
|
129
|
+
style: {
|
|
130
|
+
data: {
|
|
131
|
+
fill: blueGrey700,
|
|
132
|
+
padding,
|
|
133
|
+
strokeWidth: 0,
|
|
134
|
+
},
|
|
135
|
+
labels: baseLabelStyles,
|
|
136
|
+
},
|
|
137
|
+
...baseProps,
|
|
138
|
+
},
|
|
139
|
+
boxplot: {
|
|
140
|
+
style: {
|
|
141
|
+
max: { padding, stroke: blueGrey700, strokeWidth: 1 },
|
|
142
|
+
maxLabels: { ...baseLabelStyles, padding: 3 },
|
|
143
|
+
median: { padding, stroke: blueGrey700, strokeWidth: 1 },
|
|
144
|
+
medianLabels: { ...baseLabelStyles, padding: 3 },
|
|
145
|
+
min: { padding, stroke: blueGrey700, strokeWidth: 1 },
|
|
146
|
+
minLabels: { ...baseLabelStyles, padding: 3 },
|
|
147
|
+
q1: { padding, fill: blueGrey700 },
|
|
148
|
+
q1Labels: { ...baseLabelStyles, padding: 3 },
|
|
149
|
+
q3: { padding, fill: blueGrey700 },
|
|
150
|
+
q3Labels: { ...baseLabelStyles, padding: 3 },
|
|
151
|
+
},
|
|
152
|
+
boxWidth: 20,
|
|
153
|
+
...baseProps,
|
|
154
|
+
},
|
|
155
|
+
candlestick: {
|
|
156
|
+
style: {
|
|
157
|
+
data: {
|
|
158
|
+
stroke: blueGrey700,
|
|
159
|
+
},
|
|
160
|
+
labels: { ...baseLabelStyles, padding: 5 },
|
|
161
|
+
},
|
|
162
|
+
candleColors: {
|
|
163
|
+
positive: '#ffffff',
|
|
164
|
+
negative: blueGrey700,
|
|
165
|
+
},
|
|
166
|
+
...baseProps,
|
|
167
|
+
},
|
|
168
|
+
chart: baseProps,
|
|
169
|
+
errorbar: {
|
|
170
|
+
borderWidth: 8,
|
|
171
|
+
style: {
|
|
172
|
+
data: {
|
|
173
|
+
fill: 'transparent',
|
|
174
|
+
opacity: 1,
|
|
175
|
+
stroke: blueGrey700,
|
|
176
|
+
strokeWidth: 2,
|
|
177
|
+
},
|
|
178
|
+
labels: baseLabelStyles,
|
|
179
|
+
},
|
|
180
|
+
...baseProps,
|
|
181
|
+
},
|
|
182
|
+
group: {
|
|
183
|
+
colorScale: colors,
|
|
184
|
+
...baseProps,
|
|
185
|
+
},
|
|
186
|
+
histogram: {
|
|
187
|
+
style: {
|
|
188
|
+
data: {
|
|
189
|
+
fill: blueGrey700,
|
|
190
|
+
stroke: grey900,
|
|
191
|
+
strokeWidth: 2,
|
|
192
|
+
},
|
|
193
|
+
labels: baseLabelStyles,
|
|
194
|
+
},
|
|
195
|
+
...baseProps,
|
|
196
|
+
},
|
|
197
|
+
legend: {
|
|
198
|
+
colorScale: colors,
|
|
199
|
+
gutter: 10,
|
|
200
|
+
orientation: 'vertical',
|
|
201
|
+
titleOrientation: 'top',
|
|
202
|
+
style: {
|
|
203
|
+
data: {
|
|
204
|
+
type: 'circle',
|
|
205
|
+
},
|
|
206
|
+
labels: baseLabelStyles,
|
|
207
|
+
title: { ...baseLabelStyles, padding: 5 },
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
line: {
|
|
211
|
+
style: {
|
|
212
|
+
data: {
|
|
213
|
+
fill: 'transparent',
|
|
214
|
+
opacity: 1,
|
|
215
|
+
stroke: blueGrey700,
|
|
216
|
+
strokeWidth: 2,
|
|
217
|
+
},
|
|
218
|
+
labels: baseLabelStyles,
|
|
219
|
+
},
|
|
220
|
+
...baseProps,
|
|
221
|
+
},
|
|
222
|
+
pie: {
|
|
223
|
+
colorScale: colors,
|
|
224
|
+
style: {
|
|
225
|
+
data: {
|
|
226
|
+
padding,
|
|
227
|
+
stroke: blueGrey50,
|
|
228
|
+
strokeWidth: 1,
|
|
229
|
+
},
|
|
230
|
+
labels: { ...baseLabelStyles, padding: 20 },
|
|
231
|
+
},
|
|
232
|
+
...baseProps,
|
|
233
|
+
},
|
|
234
|
+
scatter: {
|
|
235
|
+
style: {
|
|
236
|
+
data: {
|
|
237
|
+
fill: blueGrey700,
|
|
238
|
+
opacity: 1,
|
|
239
|
+
stroke: 'transparent',
|
|
240
|
+
strokeWidth: 0,
|
|
241
|
+
},
|
|
242
|
+
labels: baseLabelStyles,
|
|
243
|
+
},
|
|
244
|
+
...baseProps,
|
|
245
|
+
},
|
|
246
|
+
stack: {
|
|
247
|
+
colorScale: colors,
|
|
248
|
+
...baseProps,
|
|
249
|
+
},
|
|
250
|
+
tooltip: {
|
|
251
|
+
style: { ...baseLabelStyles, padding: 0, pointerEvents: 'none' },
|
|
252
|
+
flyoutStyle: {
|
|
253
|
+
stroke: grey900,
|
|
254
|
+
strokeWidth: 1,
|
|
255
|
+
fill: '#f0f0f0',
|
|
256
|
+
pointerEvents: 'none',
|
|
257
|
+
},
|
|
258
|
+
flyoutPadding: 5,
|
|
259
|
+
cornerRadius: 5,
|
|
260
|
+
pointerLength: 10,
|
|
261
|
+
},
|
|
262
|
+
voronoi: {
|
|
263
|
+
style: {
|
|
264
|
+
data: {
|
|
265
|
+
fill: 'transparent',
|
|
266
|
+
stroke: 'transparent',
|
|
267
|
+
strokeWidth: 0,
|
|
268
|
+
},
|
|
269
|
+
labels: { ...baseLabelStyles, padding: 5, pointerEvents: 'none' },
|
|
270
|
+
flyout: {
|
|
271
|
+
stroke: grey900,
|
|
272
|
+
strokeWidth: 1,
|
|
273
|
+
fill: '#f0f0f0',
|
|
274
|
+
pointerEvents: 'none',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
...baseProps,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
export const basicData = [
|
|
2
|
+
{
|
|
3
|
+
name: 'Team 1',
|
|
4
|
+
data: [
|
|
5
|
+
{ x: 1, y: 39, label: 'Team 1, January, $39k' },
|
|
6
|
+
{ x: 2, y: 28, label: 'Team 1, February, $28k' },
|
|
7
|
+
{ x: 3, y: 35, label: 'Team 1, March, $35k' },
|
|
8
|
+
{ x: 4, y: 44, label: 'Team 1, April, $44k' },
|
|
9
|
+
{ x: 5, y: 21, label: 'Team 1, May, $21k' },
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Team 2',
|
|
14
|
+
data: [
|
|
15
|
+
{ x: 1, y: 27, label: 'Team 2, January, $39k' },
|
|
16
|
+
{ x: 2, y: 33, label: 'Team 2, February, $33k' },
|
|
17
|
+
{ x: 3, y: 39, label: 'Team 2, March, $39k' },
|
|
18
|
+
{ x: 4, y: 28, label: 'Team 2, April, $28k' },
|
|
19
|
+
{ x: 5, y: 19, label: 'Team 2, May, $19k' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Team 3',
|
|
24
|
+
data: [
|
|
25
|
+
{ x: 1, y: 32, label: 'Team 3, January, $39k' },
|
|
26
|
+
{ x: 2, y: 41, label: 'Team 3, February, $39k' },
|
|
27
|
+
{ x: 3, y: 45, label: 'Team 3, March, $39k' },
|
|
28
|
+
{ x: 4, y: 56, label: 'Team 3, April, $39k' },
|
|
29
|
+
{ x: 5, y: 48, label: 'Team 3, May, $39k' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Team 4',
|
|
34
|
+
data: [
|
|
35
|
+
{ x: 1, y: 48, label: 'Team 4, January, $48k' },
|
|
36
|
+
{ x: 2, y: 66, label: 'Team 4, February, $66k' },
|
|
37
|
+
{ x: 3, y: 52, label: 'Team 4, March, $52k' },
|
|
38
|
+
{ x: 4, y: 36, label: 'Team 4, April, $36k' },
|
|
39
|
+
{ x: 5, y: 10, label: 'Team 4, May, $10k' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export const explicitData = [
|
|
45
|
+
{
|
|
46
|
+
name: 'Team 1',
|
|
47
|
+
data: [
|
|
48
|
+
{ month: 1, sales: 39, label: 'Team 1, January, $39k' },
|
|
49
|
+
{ month: 2, sales: 28, label: 'Team 1, February, $28k' },
|
|
50
|
+
{ month: 3, sales: 35, label: 'Team 1, March, $35k' },
|
|
51
|
+
{ month: 4, sales: 44, label: 'Team 1, April, $44k' },
|
|
52
|
+
{ month: 5, sales: 21, label: 'Team 1, May, $21k' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Team 2',
|
|
57
|
+
data: [
|
|
58
|
+
{ month: 1, sales: 27, label: 'Team 2, January, $39k' },
|
|
59
|
+
{ month: 2, sales: 33, label: 'Team 2, February, $33k' },
|
|
60
|
+
{ month: 3, sales: 39, label: 'Team 2, March, $39k' },
|
|
61
|
+
{ month: 4, sales: 28, label: 'Team 2, April, $28k' },
|
|
62
|
+
{ month: 5, sales: 19, label: 'Team 2, May, $19k' },
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Team 3',
|
|
67
|
+
data: [
|
|
68
|
+
{ month: 1, sales: 32, label: 'Team 3, January, $39k' },
|
|
69
|
+
{ month: 2, sales: 41, label: 'Team 3, February, $39k' },
|
|
70
|
+
{ month: 3, sales: 45, label: 'Team 3, March, $39k' },
|
|
71
|
+
{ month: 4, sales: 56, label: 'Team 3, April, $39k' },
|
|
72
|
+
{ month: 5, sales: 48, label: 'Team 3, May, $39k' },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Team 4',
|
|
77
|
+
data: [
|
|
78
|
+
{ month: 1, sales: 48, label: 'Team 4, January, $48k' },
|
|
79
|
+
{ month: 2, sales: 66, label: 'Team 4, February, $66k' },
|
|
80
|
+
{ month: 3, sales: 52, label: 'Team 4, March, $52k' },
|
|
81
|
+
{ month: 4, sales: 36, label: 'Team 4, April, $36k' },
|
|
82
|
+
{ month: 5, sales: 10, label: 'Team 4, May, $10k' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
export const historyOfTexas = [
|
|
88
|
+
{
|
|
89
|
+
name: 'Enslaved People in Texas',
|
|
90
|
+
data: [
|
|
91
|
+
{ year: 1836, number: 5000, label: '5000 people enslaved in 1836' },
|
|
92
|
+
{ year: 1845, number: 30000, label: '30,000 people enslaved in 1845' },
|
|
93
|
+
{ year: 1846, number: 30505, label: '30,505 people enslaved in 1846' },
|
|
94
|
+
{ year: 1847, number: 39056, label: '39,056 people enslaved in 1847' },
|
|
95
|
+
{ year: 1848, number: 40308, label: '40,308 people enslaved in 1848' },
|
|
96
|
+
{ year: 1849, number: 42759, label: '42,759 people enslaved in 1849' },
|
|
97
|
+
{ year: 1850, number: 48145, label: '48,145 people enslaved in 1850' },
|
|
98
|
+
{ year: 1851, number: 58740, label: '58,740 people enslaved in 1851' },
|
|
99
|
+
{ year: 1852, number: 68584, label: '68,584 people enslaved in 1852' },
|
|
100
|
+
{ year: 1853, number: 78306, label: '78,306 people enslaved in 1853' },
|
|
101
|
+
{ year: 1854, number: 90003, label: '90,003 people enslaved in 1854' },
|
|
102
|
+
{ year: 1855, number: 105186, label: '105,186 people enslaved in 1855' },
|
|
103
|
+
{ year: 1856, number: 113139, label: '113,139 people enslaved in 1856' },
|
|
104
|
+
{ year: 1857, number: 124782, label: '124,782 people enslaved in 1857' },
|
|
105
|
+
{ year: 1858, number: 133737, label: '133,737 people enslaved in 1858' },
|
|
106
|
+
{ year: 1859, number: 146370, label: '146,370 people enslaved in 1859' },
|
|
107
|
+
{ year: 1860, number: 160467, label: '160,467 people enslaved in 1860' },
|
|
108
|
+
{ year: 1861, number: 169166, label: '169,166 people enslaved in 1861' },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
export const spendingRevenue = [
|
|
114
|
+
{
|
|
115
|
+
name: 'Texas',
|
|
116
|
+
data: [
|
|
117
|
+
{ x: 'Personal Income Tax', y: 0, label: 'Texas Personal Income Tax 0%' },
|
|
118
|
+
{ x: 'Average Sales Tax', y: 0, label: 'Texas Average Sales Tax 0%' },
|
|
119
|
+
{
|
|
120
|
+
x: 'Average Property Tax',
|
|
121
|
+
y: 0.3,
|
|
122
|
+
label: 'Texas Average Property Tax 0.3%',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'US low',
|
|
128
|
+
data: [
|
|
129
|
+
{
|
|
130
|
+
x: 'Personal Income Tax',
|
|
131
|
+
y: 0,
|
|
132
|
+
label: 'US Low Personal Income Tax 0%',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
x: 'Average Sales Tax',
|
|
136
|
+
y: 8.19,
|
|
137
|
+
label: 'US Low Average Sales Tax 8.19%',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
x: 'Average Property Tax',
|
|
141
|
+
y: 1.69,
|
|
142
|
+
label: 'US Low Average Property Tax 1.69%',
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'US high',
|
|
148
|
+
data: [
|
|
149
|
+
{
|
|
150
|
+
x: 'Personal Income Tax',
|
|
151
|
+
y: 13,
|
|
152
|
+
label: 'US High Personal Income Tax 13%',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
x: 'Average Sales Tax',
|
|
156
|
+
y: 9.53,
|
|
157
|
+
label: 'US High Average Sales Tax 9.53%',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
x: 'Average Property Tax',
|
|
161
|
+
y: 2.21,
|
|
162
|
+
label: 'US High Average Property Tax 2.21%',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
export const votingParticipation = [
|
|
169
|
+
{
|
|
170
|
+
name: 'US Data',
|
|
171
|
+
data: [
|
|
172
|
+
{
|
|
173
|
+
year: '2000',
|
|
174
|
+
percent: 54.2,
|
|
175
|
+
label: '54.2% turnout in 2000',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
year: '2002',
|
|
179
|
+
percent: 39.5,
|
|
180
|
+
label: '39.5% turnout in 2000',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
year: '2004',
|
|
184
|
+
percent: 60.1,
|
|
185
|
+
label: '60.1% turnout in 2000',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
year: '2006',
|
|
189
|
+
percent: 40.4,
|
|
190
|
+
label: '40.4% turnout in 2000',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
year: '2008',
|
|
194
|
+
percent: 61.6,
|
|
195
|
+
label: '61.6% turnout in 2000',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
year: '2010',
|
|
199
|
+
percent: 41,
|
|
200
|
+
label: '41% turnout in 2000',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
year: '2012',
|
|
204
|
+
percent: 58,
|
|
205
|
+
label: '58% turnout in 2000',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
year: '2014',
|
|
209
|
+
percent: 36,
|
|
210
|
+
label: '36% turnout in 2000',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
year: '2016',
|
|
214
|
+
percent: 59.2,
|
|
215
|
+
label: '59.2% turnout in 2000',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
year: '2018',
|
|
219
|
+
percent: 49.4,
|
|
220
|
+
label: '49.4% turnout in 2000',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
year: '2020',
|
|
224
|
+
percent: 66.7,
|
|
225
|
+
label: '66.7% turnout in 2000',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'Texas Data',
|
|
231
|
+
data: [
|
|
232
|
+
{
|
|
233
|
+
year: '2000',
|
|
234
|
+
percent: 49.2,
|
|
235
|
+
label: '49.2% turnout in 2000',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
year: '2002',
|
|
239
|
+
percent: 34.2,
|
|
240
|
+
label: '34.2% turnout in 2000',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
year: '2004',
|
|
244
|
+
percent: 53.7,
|
|
245
|
+
label: '53.7% turnout in 2000',
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
year: '2006',
|
|
249
|
+
percent: 30.9,
|
|
250
|
+
label: '30.9% turnout in 2000',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
year: '2008',
|
|
254
|
+
percent: 54.1,
|
|
255
|
+
label: '54.1% turnout in 2000',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
year: '2010',
|
|
259
|
+
percent: 32.1,
|
|
260
|
+
label: '32.1% turnout in 2000',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
year: '2012',
|
|
264
|
+
percent: 49.6,
|
|
265
|
+
label: '49.6% turnout in 2000',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
year: '2014',
|
|
269
|
+
percent: 28.3,
|
|
270
|
+
label: '28.3% turnout in 2000',
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
year: '2016',
|
|
274
|
+
percent: 51.4,
|
|
275
|
+
label: '51.4% turnout in 2000',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
year: '2018',
|
|
279
|
+
percent: 45.6,
|
|
280
|
+
label: '45.6% turnout in 2000',
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
year: '2020',
|
|
284
|
+
percent: 60.4,
|
|
285
|
+
label: '60.4% turnout in 2000',
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
];
|
|
@@ -7,7 +7,6 @@ function getFocusableElements(container: HTMLElement): HTMLElement[] {
|
|
|
7
7
|
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
|
|
8
8
|
(el): el is HTMLElement => {
|
|
9
9
|
const style = window.getComputedStyle(el);
|
|
10
|
-
|
|
11
10
|
return (
|
|
12
11
|
style.display !== 'none' &&
|
|
13
12
|
style.visibility !== 'hidden' &&
|
|
@@ -19,7 +18,6 @@ function getFocusableElements(container: HTMLElement): HTMLElement[] {
|
|
|
19
18
|
|
|
20
19
|
function findVisibleModal(wrapper: HTMLElement): HTMLElement | null {
|
|
21
20
|
const modal = wrapper.querySelector<HTMLElement>('.cds--modal');
|
|
22
|
-
|
|
23
21
|
if (!modal) return null;
|
|
24
22
|
|
|
25
23
|
const isVisible =
|
|
@@ -42,17 +40,14 @@ export function useCarbonModalFocusManagement(
|
|
|
42
40
|
|
|
43
41
|
React.useEffect(() => {
|
|
44
42
|
const wrapper = wrapperRef.current;
|
|
45
|
-
|
|
46
43
|
if (!wrapper) return;
|
|
47
44
|
|
|
48
45
|
function focusModalCloseButton(modal: HTMLElement) {
|
|
49
46
|
const closeButton = modal.querySelector<HTMLElement>('.cds--modal-close');
|
|
50
|
-
|
|
51
47
|
if (closeButton) {
|
|
52
48
|
closeButton.focus();
|
|
53
49
|
} else {
|
|
54
50
|
const focusable = getFocusableElements(modal);
|
|
55
|
-
|
|
56
51
|
if (focusable.length > 0) {
|
|
57
52
|
focusable[0].focus();
|
|
58
53
|
}
|
|
@@ -67,7 +62,6 @@ export function useCarbonModalFocusManagement(
|
|
|
67
62
|
// (e.g. Carbon's overflow menu returning focus to its trigger).
|
|
68
63
|
focusinHandler.current = (event: FocusEvent) => {
|
|
69
64
|
const target = event.target as HTMLElement;
|
|
70
|
-
|
|
71
65
|
if (!modal.contains(target)) {
|
|
72
66
|
setTimeout(() => {
|
|
73
67
|
if (currentModal.current === modal) {
|
|
@@ -84,13 +78,11 @@ export function useCarbonModalFocusManagement(
|
|
|
84
78
|
if (modal.contains(document.activeElement)) return;
|
|
85
79
|
|
|
86
80
|
const closeBtn = modal.querySelector<HTMLElement>('.cds--modal-close');
|
|
87
|
-
|
|
88
81
|
if (
|
|
89
82
|
closeBtn &&
|
|
90
83
|
window.getComputedStyle(closeBtn).visibility !== 'hidden'
|
|
91
84
|
) {
|
|
92
85
|
closeBtn.focus();
|
|
93
|
-
|
|
94
86
|
return;
|
|
95
87
|
}
|
|
96
88
|
|
|
@@ -98,17 +90,14 @@ export function useCarbonModalFocusManagement(
|
|
|
98
90
|
requestAnimationFrame(pollAndFocus);
|
|
99
91
|
}
|
|
100
92
|
};
|
|
101
|
-
|
|
102
93
|
requestAnimationFrame(pollAndFocus);
|
|
103
94
|
|
|
104
95
|
keydownHandler.current = (event: KeyboardEvent) => {
|
|
105
96
|
if (event.key !== 'Tab') return;
|
|
106
97
|
|
|
107
98
|
const focusable = getFocusableElements(modal);
|
|
108
|
-
|
|
109
99
|
if (focusable.length === 0) {
|
|
110
100
|
event.preventDefault();
|
|
111
|
-
|
|
112
101
|
return;
|
|
113
102
|
}
|
|
114
103
|
|
|
@@ -117,7 +106,6 @@ export function useCarbonModalFocusManagement(
|
|
|
117
106
|
if (focusable[0] !== document.activeElement) {
|
|
118
107
|
focusable[0].focus();
|
|
119
108
|
}
|
|
120
|
-
|
|
121
109
|
return;
|
|
122
110
|
}
|
|
123
111
|
|
package/src/index.ts
CHANGED