@sproutsocial/seeds-react-data-viz 0.19.0 → 0.20.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/bar/index.d.mts +18 -4
- package/dist/bar/index.d.ts +18 -4
- package/dist/bar/index.js +31 -16
- package/dist/bar/index.js.map +1 -1
- package/dist/charts.css +583 -0
- package/dist/{chunk-DLO4WZLT.js → chunk-27M4FDNK.js} +14 -14
- package/dist/chunk-27M4FDNK.js.map +1 -0
- package/dist/chunk-46L4YBLC.js +544 -0
- package/dist/chunk-46L4YBLC.js.map +1 -0
- package/dist/{chunk-4IOYAUAK.js → chunk-XYE6O77Z.js} +3 -3
- package/dist/{chunk-4IOYAUAK.js.map → chunk-XYE6O77Z.js.map} +1 -1
- package/dist/donut/index.d.mts +13 -4
- package/dist/donut/index.d.ts +13 -4
- package/dist/donut/index.js +16 -10
- package/dist/donut/index.js.map +1 -1
- package/dist/esm/bar/index.js +18 -3
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/{chunk-J5QE7VCW.js → chunk-KMFRRUTY.js} +2 -2
- package/dist/esm/{chunk-U6ZOSXK7.js → chunk-QSSYSKRP.js} +2 -2
- package/dist/esm/chunk-QSSYSKRP.js.map +1 -0
- package/dist/esm/chunk-XEKQTAUH.js +544 -0
- package/dist/esm/chunk-XEKQTAUH.js.map +1 -0
- package/dist/esm/donut/index.js +12 -6
- package/dist/esm/donut/index.js.map +1 -1
- package/dist/esm/index.js +536 -134
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +11 -5
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +2 -2
- package/dist/index.js +497 -95
- package/dist/index.js.map +1 -1
- package/dist/interactions-DoWoL7bu.d.mts +29 -0
- package/dist/interactions-DoWoL7bu.d.ts +29 -0
- package/dist/line-area/index.d.mts +15 -4
- package/dist/line-area/index.d.ts +15 -4
- package/dist/line-area/index.js +16 -10
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.js +4 -4
- package/package.json +7 -2
- package/dist/chunk-DLO4WZLT.js.map +0 -1
- package/dist/chunk-WEKDYQ4T.js +0 -968
- package/dist/chunk-WEKDYQ4T.js.map +0 -1
- package/dist/esm/chunk-U6ZOSXK7.js.map +0 -1
- package/dist/esm/chunk-Z4LOM4OZ.js +0 -968
- package/dist/esm/chunk-Z4LOM4OZ.js.map +0 -1
- /package/dist/esm/{chunk-J5QE7VCW.js.map → chunk-KMFRRUTY.js.map} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -23,27 +23,15 @@ import {
|
|
|
23
23
|
ChartTooltipTable,
|
|
24
24
|
ChartTooltipTitle,
|
|
25
25
|
ColorBox,
|
|
26
|
-
DatavizColorBox,
|
|
27
26
|
GlobalChartStyleOverrides,
|
|
28
|
-
NetworkColorBox,
|
|
29
27
|
areaChartStyles,
|
|
30
28
|
baseChartStyles,
|
|
31
29
|
donutChartStyles,
|
|
32
30
|
generateChartTooltipPortalId,
|
|
33
|
-
getDatavizColor,
|
|
34
|
-
getDatavizColorWithAlpha,
|
|
35
|
-
getDatavizOpacity,
|
|
36
|
-
getStorybookCategoricalData,
|
|
37
|
-
getStorybookSparseTimelineData,
|
|
38
|
-
isCategoricalHourData,
|
|
39
|
-
isHourlyTimeData,
|
|
40
31
|
lineChartStyles,
|
|
41
32
|
timeSeriesChartStyles,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
xAxisLabelFormatter,
|
|
45
|
-
yAxisLabelFormatter
|
|
46
|
-
} from "./chunk-Z4LOM4OZ.js";
|
|
33
|
+
transformTimeSeriesTooltipData
|
|
34
|
+
} from "./chunk-XEKQTAUH.js";
|
|
47
35
|
|
|
48
36
|
// src/components/AreaChart/AreaChart.tsx
|
|
49
37
|
import { memo as memo4 } from "react";
|
|
@@ -51,24 +39,62 @@ import Highcharts from "highcharts";
|
|
|
51
39
|
import { HighchartsReact } from "highcharts-react-official";
|
|
52
40
|
import highchartsAccessibility from "highcharts/modules/accessibility";
|
|
53
41
|
import highchartsAnnotations from "highcharts/modules/annotations";
|
|
54
|
-
import
|
|
42
|
+
import styled2 from "styled-components";
|
|
55
43
|
import { Box as Box2 } from "@sproutsocial/seeds-react-box";
|
|
56
44
|
|
|
57
45
|
// src/components/AreaChart/components/AreaChartLegend.tsx
|
|
58
46
|
import { memo } from "react";
|
|
47
|
+
import { theme as theme2 } from "@sproutsocial/seeds-react-theme";
|
|
48
|
+
|
|
49
|
+
// src/components/ColorBox/DatavizColorBox.tsx
|
|
50
|
+
import styled from "styled-components";
|
|
59
51
|
import { theme } from "@sproutsocial/seeds-react-theme";
|
|
52
|
+
var DatavizColorBox = styled(ColorBox).attrs(
|
|
53
|
+
({ colorIndex }) => ({
|
|
54
|
+
style: {
|
|
55
|
+
background: getDatavizColor(colorIndex),
|
|
56
|
+
opacity: getDatavizOpacity(colorIndex)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
)``;
|
|
60
|
+
var getDatavizColor = (colorIndex) => theme.colors.DATAVIZ_COLORS_LIST[colorIndex % theme.colors.DATAVIZ_COLORS_LIST.length] || "";
|
|
61
|
+
var getDatavizOpacity = (colorIndex) => {
|
|
62
|
+
const opacitySteps = [1, 0.6, 0.4, 0.2];
|
|
63
|
+
const opacityStep = Math.floor(colorIndex / theme.colors.DATAVIZ_COLORS_LIST.length) % opacitySteps.length;
|
|
64
|
+
return opacitySteps[opacityStep];
|
|
65
|
+
};
|
|
66
|
+
var getDatavizColorWithAlpha = (colorIndex) => {
|
|
67
|
+
const color = getDatavizColor(colorIndex);
|
|
68
|
+
const opacity = getDatavizOpacity(colorIndex);
|
|
69
|
+
if (opacity < 0 || opacity > 1) {
|
|
70
|
+
return color;
|
|
71
|
+
}
|
|
72
|
+
return `${color}${Math.floor(opacity * 255).toString(16).padStart(2, "0")}`;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/components/ColorBox/NetworkColorBox.tsx
|
|
76
|
+
import NETWORK_COLORS from "@sproutsocial/seeds-networkcolor";
|
|
60
77
|
import { jsx } from "react/jsx-runtime";
|
|
78
|
+
var NetworkColorBox = ({
|
|
79
|
+
networkColor,
|
|
80
|
+
...props
|
|
81
|
+
}) => {
|
|
82
|
+
return /* @__PURE__ */ jsx(ColorBox, { ...props, bg: NETWORK_COLORS[networkColor] });
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/components/AreaChart/components/AreaChartLegend.tsx
|
|
86
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
61
87
|
var getAreaChartLegendLabels = ({
|
|
62
88
|
data
|
|
63
89
|
}) => {
|
|
64
90
|
return data.map((series, index) => ({
|
|
65
|
-
content: /* @__PURE__ */
|
|
66
|
-
color: series.styles?.color ||
|
|
91
|
+
content: /* @__PURE__ */ jsx2(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
92
|
+
color: series.styles?.color || theme2.colors.DATAVIZ_COLORS_LIST[index]
|
|
67
93
|
}));
|
|
68
94
|
};
|
|
69
95
|
var AreaChartLegend = memo(
|
|
70
96
|
function AreaChartLegend2({ data }) {
|
|
71
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ jsx2(ChartLegend, { legendLabels: getAreaChartLegendLabels({ data }) });
|
|
72
98
|
}
|
|
73
99
|
);
|
|
74
100
|
|
|
@@ -79,7 +105,7 @@ import { Duration } from "@sproutsocial/seeds-react-duration";
|
|
|
79
105
|
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
80
106
|
import { Numeral } from "@sproutsocial/seeds-react-numeral";
|
|
81
107
|
import { Text } from "@sproutsocial/seeds-react-text";
|
|
82
|
-
import { jsx as
|
|
108
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
83
109
|
var AreaChartTooltip = memo2(
|
|
84
110
|
function AreaChartTooltip2({
|
|
85
111
|
data,
|
|
@@ -101,10 +127,10 @@ var AreaChartTooltip = memo2(
|
|
|
101
127
|
return {
|
|
102
128
|
cells: [
|
|
103
129
|
{
|
|
104
|
-
content: /* @__PURE__ */
|
|
130
|
+
content: /* @__PURE__ */ jsx3(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx3(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx3(Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
105
131
|
},
|
|
106
132
|
{
|
|
107
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */
|
|
133
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx3(Text, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx3(Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx3(
|
|
108
134
|
Numeral,
|
|
109
135
|
{
|
|
110
136
|
abbreviate: false,
|
|
@@ -123,7 +149,7 @@ var AreaChartTooltip = memo2(
|
|
|
123
149
|
{
|
|
124
150
|
cells: [
|
|
125
151
|
{
|
|
126
|
-
content: /* @__PURE__ */
|
|
152
|
+
content: /* @__PURE__ */ jsx3(
|
|
127
153
|
Text,
|
|
128
154
|
{
|
|
129
155
|
fontWeight: "semibold",
|
|
@@ -133,7 +159,7 @@ var AreaChartTooltip = memo2(
|
|
|
133
159
|
)
|
|
134
160
|
},
|
|
135
161
|
{
|
|
136
|
-
content: /* @__PURE__ */
|
|
162
|
+
content: /* @__PURE__ */ jsx3(Text, { fontWeight: "bold", children: total === null && invalidNumberLabel ? invalidNumberLabel : numberFormat === "duration" ? /* @__PURE__ */ jsx3(Duration, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ jsx3(
|
|
137
163
|
Numeral,
|
|
138
164
|
{
|
|
139
165
|
abbreviate: false,
|
|
@@ -151,16 +177,16 @@ var AreaChartTooltip = memo2(
|
|
|
151
177
|
] : [];
|
|
152
178
|
return /* @__PURE__ */ jsxs(ChartTooltip, { children: [
|
|
153
179
|
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ jsx3(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
181
|
+
/* @__PURE__ */ jsx3(
|
|
156
182
|
ChartTooltipTable,
|
|
157
183
|
{
|
|
158
184
|
rows: [...rows, ...appendedRows]
|
|
159
185
|
}
|
|
160
186
|
),
|
|
161
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
187
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx3(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
188
|
+
/* @__PURE__ */ jsx3(Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
189
|
+
/* @__PURE__ */ jsx3(Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
164
190
|
] }) : tooltipClickLabel }) : null
|
|
165
191
|
] });
|
|
166
192
|
}
|
|
@@ -170,7 +196,7 @@ var AreaChartTooltip = memo2(
|
|
|
170
196
|
import { memo as memo3, useEffect, useState, useRef } from "react";
|
|
171
197
|
import { createPortal } from "react-dom";
|
|
172
198
|
import "highcharts";
|
|
173
|
-
import { Fragment, jsx as
|
|
199
|
+
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
174
200
|
var ChartXAnnotationMarkerPortal = memo3(
|
|
175
201
|
function ChartXAnnotationMarkerPortal2({
|
|
176
202
|
xAnnotations,
|
|
@@ -217,7 +243,7 @@ var ChartXAnnotationMarkerPortal = memo3(
|
|
|
217
243
|
});
|
|
218
244
|
}
|
|
219
245
|
}, [annotationContext.labels, xAnnotations, chartContainer]);
|
|
220
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: Object.entries(annotationContainers.current).map(
|
|
221
247
|
([xValue, container]) => {
|
|
222
248
|
const annotationComponent = xAnnotations?.[Number(xValue)]?.marker;
|
|
223
249
|
return annotationComponent ? createPortal(annotationComponent(), container) : null;
|
|
@@ -226,6 +252,382 @@ var ChartXAnnotationMarkerPortal = memo3(
|
|
|
226
252
|
}
|
|
227
253
|
);
|
|
228
254
|
|
|
255
|
+
// src/helpers/transformDataToSeries.ts
|
|
256
|
+
var transformDataToSeries = ({
|
|
257
|
+
data
|
|
258
|
+
}, type) => {
|
|
259
|
+
const hasCategoricalData = data.some(
|
|
260
|
+
(series) => series.points.some((point) => typeof point.x === "string")
|
|
261
|
+
);
|
|
262
|
+
return data.map((dataItem, dataIndex) => {
|
|
263
|
+
const points = dataItem.points || [];
|
|
264
|
+
const dataPoints = points.map((point, pointsIndex) => {
|
|
265
|
+
let enableMarker = false;
|
|
266
|
+
const isFirstPoint = pointsIndex === 0;
|
|
267
|
+
const isLastPoint = pointsIndex === points.length - 1;
|
|
268
|
+
const previousY = isFirstPoint ? null : points[pointsIndex - 1].y;
|
|
269
|
+
const nextY = isLastPoint ? null : points[pointsIndex + 1].y;
|
|
270
|
+
if (isFirstPoint && nextY === null) {
|
|
271
|
+
enableMarker = true;
|
|
272
|
+
} else if (isLastPoint && previousY === null) {
|
|
273
|
+
enableMarker = true;
|
|
274
|
+
} else if (previousY === null && nextY === null) {
|
|
275
|
+
enableMarker = true;
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
x: hasCategoricalData ? pointsIndex : point.x,
|
|
279
|
+
y: point.y,
|
|
280
|
+
marker: {
|
|
281
|
+
enabled: enableMarker ? enableMarker : void 0,
|
|
282
|
+
symbol: enableMarker ? "circle" : void 0
|
|
283
|
+
},
|
|
284
|
+
// For categorical data, store the original category name
|
|
285
|
+
...hasCategoricalData && { name: point.x }
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
return {
|
|
289
|
+
colorIndex: dataIndex,
|
|
290
|
+
data: dataPoints,
|
|
291
|
+
name: dataItem.name,
|
|
292
|
+
type
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/helpers/yAxisLabelFormatter.ts
|
|
298
|
+
import { formatDuration } from "@sproutsocial/seeds-react-duration";
|
|
299
|
+
import { formatNumeral } from "@sproutsocial/seeds-react-numeral";
|
|
300
|
+
var yAxisLabelFormatter = ({
|
|
301
|
+
numberLocale,
|
|
302
|
+
textLocale,
|
|
303
|
+
tickPositions,
|
|
304
|
+
value,
|
|
305
|
+
currency = "USD",
|
|
306
|
+
numberFormat = "decimal"
|
|
307
|
+
}) => {
|
|
308
|
+
const numberValue = Number(value);
|
|
309
|
+
if (numberValue === 0) {
|
|
310
|
+
return formatNumeral({
|
|
311
|
+
locale: numberLocale,
|
|
312
|
+
number: numberValue
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (numberFormat === "duration") {
|
|
316
|
+
return formatDuration({
|
|
317
|
+
display: "narrow",
|
|
318
|
+
locale: textLocale,
|
|
319
|
+
milliseconds: numberValue
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
const maxValue = tickPositions && tickPositions.length > 0 ? tickPositions[tickPositions.length - 1] : void 0;
|
|
323
|
+
const abbreviate = typeof maxValue === "number" && maxValue > 9999 ? 1e3 : true;
|
|
324
|
+
return formatNumeral({
|
|
325
|
+
abbreviate,
|
|
326
|
+
currency,
|
|
327
|
+
format: numberFormat,
|
|
328
|
+
locale: numberLocale,
|
|
329
|
+
number: numberValue
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// src/helpers/xAxisLabelFormatter.ts
|
|
334
|
+
var getDatePartsInTimezone = (date, timezone) => {
|
|
335
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
336
|
+
year: "numeric",
|
|
337
|
+
month: "numeric",
|
|
338
|
+
day: "numeric",
|
|
339
|
+
timeZone: timezone
|
|
340
|
+
});
|
|
341
|
+
const parts = formatter.formatToParts(date);
|
|
342
|
+
return {
|
|
343
|
+
day: parseInt(parts.find((p) => p.type === "day")?.value ?? "0", 10),
|
|
344
|
+
month: parseInt(parts.find((p) => p.type === "month")?.value ?? "0", 10),
|
|
345
|
+
year: parseInt(parts.find((p) => p.type === "year")?.value ?? "0", 10)
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
var xAxisLabelFormatter = ({
|
|
349
|
+
textLocale,
|
|
350
|
+
tickPositions = [],
|
|
351
|
+
unitName,
|
|
352
|
+
value,
|
|
353
|
+
// optional
|
|
354
|
+
timeFormat = "12",
|
|
355
|
+
timezone = "UTC"
|
|
356
|
+
}) => {
|
|
357
|
+
if (typeof value === "string") {
|
|
358
|
+
return `<span>${value}</span>`;
|
|
359
|
+
}
|
|
360
|
+
const tickIndex = tickPositions.indexOf(value);
|
|
361
|
+
const isFirst = tickIndex === 0;
|
|
362
|
+
const previousValue = tickPositions[tickIndex - 1];
|
|
363
|
+
const valueDate = new Date(value);
|
|
364
|
+
const valueParts = getDatePartsInTimezone(valueDate, timezone);
|
|
365
|
+
const previousValueDate = previousValue ? new Date(previousValue) : void 0;
|
|
366
|
+
const previousValueParts = previousValueDate ? getDatePartsInTimezone(previousValueDate, timezone) : void 0;
|
|
367
|
+
let firstPartOptions = {};
|
|
368
|
+
let secondPartOptions = {};
|
|
369
|
+
switch (unitName) {
|
|
370
|
+
case "hour":
|
|
371
|
+
firstPartOptions = timeFormat === "24" ? { hour: "numeric", minute: "numeric", hour12: false } : { hour: "numeric" };
|
|
372
|
+
if (isFirst || valueParts.day !== previousValueParts?.day) {
|
|
373
|
+
secondPartOptions = { day: "numeric", month: "short" };
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
case "day":
|
|
377
|
+
case "week":
|
|
378
|
+
firstPartOptions = { day: "numeric" };
|
|
379
|
+
if (isFirst || valueParts.month !== previousValueParts?.month) {
|
|
380
|
+
secondPartOptions = { month: "short" };
|
|
381
|
+
}
|
|
382
|
+
break;
|
|
383
|
+
case "month":
|
|
384
|
+
firstPartOptions = { month: "short" };
|
|
385
|
+
if (isFirst || valueParts.year !== previousValueParts?.year) {
|
|
386
|
+
secondPartOptions = { year: "numeric" };
|
|
387
|
+
}
|
|
388
|
+
break;
|
|
389
|
+
case "year":
|
|
390
|
+
firstPartOptions = { year: "numeric" };
|
|
391
|
+
break;
|
|
392
|
+
default:
|
|
393
|
+
firstPartOptions = {};
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
const firstPart = new Intl.DateTimeFormat(textLocale, {
|
|
397
|
+
...firstPartOptions,
|
|
398
|
+
timeZone: timezone
|
|
399
|
+
}).format(valueDate);
|
|
400
|
+
const secondPart = Object.keys(secondPartOptions).length > 0 ? new Intl.DateTimeFormat(textLocale, {
|
|
401
|
+
...secondPartOptions,
|
|
402
|
+
timeZone: timezone
|
|
403
|
+
}).format(valueDate) : void 0;
|
|
404
|
+
return `<span>${firstPart}</span>${secondPart ? `<span>${secondPart}</span>` : ""}`;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// src/helpers/isHourlyTimeData.ts
|
|
408
|
+
function isHourlyTimeData(data) {
|
|
409
|
+
if (!data.length) return false;
|
|
410
|
+
const xVals = data.flatMap((series) => series.points.map((p) => p.x));
|
|
411
|
+
if (!xVals.length) return false;
|
|
412
|
+
if (xVals.some((x) => typeof x === "string")) return false;
|
|
413
|
+
const dates = xVals.map((x) => {
|
|
414
|
+
const d = new Date(x);
|
|
415
|
+
return `${d.getUTCFullYear()}-${d.getUTCMonth()}-${d.getUTCDate()}`;
|
|
416
|
+
});
|
|
417
|
+
const uniqueDates = new Set(dates);
|
|
418
|
+
if (uniqueDates.size !== 1) return false;
|
|
419
|
+
return xVals.every((x) => {
|
|
420
|
+
const d = new Date(x);
|
|
421
|
+
const hour = d.getUTCHours();
|
|
422
|
+
const minutes = d.getUTCMinutes();
|
|
423
|
+
const seconds = d.getUTCSeconds();
|
|
424
|
+
return hour >= 0 && hour <= 23 && minutes === 0 && seconds === 0;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// src/helpers/isCategoricalHourData.ts
|
|
429
|
+
function isCategoricalHourData(data) {
|
|
430
|
+
if (!data.length) return false;
|
|
431
|
+
const xVals = data.flatMap((series) => series.points.map((p) => p.x));
|
|
432
|
+
if (!xVals.length) return false;
|
|
433
|
+
if (xVals.some((x) => typeof x !== "string")) return false;
|
|
434
|
+
const hour12Pattern = /^\d{1,2} (AM|PM)$/;
|
|
435
|
+
const hour24Pattern = /^([01]?\d|2[0-3]):([0-5]\d)$/;
|
|
436
|
+
const stringValues = xVals;
|
|
437
|
+
const allMatch12Hour = stringValues.every((x) => hour12Pattern.test(x));
|
|
438
|
+
const allMatch24Hour = stringValues.every((x) => hour24Pattern.test(x));
|
|
439
|
+
return allMatch12Hour || allMatch24Hour;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// src/helpers/getStorybookRandomColor.ts
|
|
443
|
+
var getStorybookRandomColor = () => {
|
|
444
|
+
const letters = "0123456789ABCDEF";
|
|
445
|
+
let color = "#";
|
|
446
|
+
for (let i = 0; i < 6; i++) {
|
|
447
|
+
color += letters[Math.floor(Math.random() * 16)];
|
|
448
|
+
}
|
|
449
|
+
return color;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// src/helpers/getStorybookCategoricalData.ts
|
|
453
|
+
var getStorybookCategoricalData = ({
|
|
454
|
+
showNulls,
|
|
455
|
+
showNegativeValues,
|
|
456
|
+
numberOfSeries,
|
|
457
|
+
yAxisMax,
|
|
458
|
+
showCustomColors,
|
|
459
|
+
showDashedLines,
|
|
460
|
+
categoryType
|
|
461
|
+
}) => {
|
|
462
|
+
const categoryOptions = {
|
|
463
|
+
hours: [
|
|
464
|
+
"12 AM",
|
|
465
|
+
"1 AM",
|
|
466
|
+
"2 AM",
|
|
467
|
+
"3 AM",
|
|
468
|
+
"4 AM",
|
|
469
|
+
"5 AM",
|
|
470
|
+
"6 AM",
|
|
471
|
+
"7 AM",
|
|
472
|
+
"8 AM",
|
|
473
|
+
"9 AM",
|
|
474
|
+
"10 AM",
|
|
475
|
+
"11 AM",
|
|
476
|
+
"12 PM",
|
|
477
|
+
"1 PM",
|
|
478
|
+
"2 PM",
|
|
479
|
+
"3 PM",
|
|
480
|
+
"4 PM",
|
|
481
|
+
"5 PM",
|
|
482
|
+
"6 PM",
|
|
483
|
+
"7 PM",
|
|
484
|
+
"8 PM",
|
|
485
|
+
"9 PM",
|
|
486
|
+
"10 PM",
|
|
487
|
+
"11 PM"
|
|
488
|
+
],
|
|
489
|
+
hours24: [
|
|
490
|
+
"00:00",
|
|
491
|
+
"01:00",
|
|
492
|
+
"02:00",
|
|
493
|
+
"03:00",
|
|
494
|
+
"04:00",
|
|
495
|
+
"05:00",
|
|
496
|
+
"06:00",
|
|
497
|
+
"07:00",
|
|
498
|
+
"08:00",
|
|
499
|
+
"09:00",
|
|
500
|
+
"10:00",
|
|
501
|
+
"11:00",
|
|
502
|
+
"12:00",
|
|
503
|
+
"13:00",
|
|
504
|
+
"14:00",
|
|
505
|
+
"15:00",
|
|
506
|
+
"16:00",
|
|
507
|
+
"17:00",
|
|
508
|
+
"18:00",
|
|
509
|
+
"19:00",
|
|
510
|
+
"20:00",
|
|
511
|
+
"21:00",
|
|
512
|
+
"22:00",
|
|
513
|
+
"23:00"
|
|
514
|
+
],
|
|
515
|
+
days: [
|
|
516
|
+
"Monday",
|
|
517
|
+
"Tuesday",
|
|
518
|
+
"Wednesday",
|
|
519
|
+
"Thursday",
|
|
520
|
+
"Friday",
|
|
521
|
+
"Saturday",
|
|
522
|
+
"Sunday"
|
|
523
|
+
],
|
|
524
|
+
months: [
|
|
525
|
+
"January",
|
|
526
|
+
"February",
|
|
527
|
+
"March",
|
|
528
|
+
"April",
|
|
529
|
+
"May",
|
|
530
|
+
"June",
|
|
531
|
+
"July",
|
|
532
|
+
"August",
|
|
533
|
+
"September",
|
|
534
|
+
"October",
|
|
535
|
+
"November",
|
|
536
|
+
"December"
|
|
537
|
+
],
|
|
538
|
+
custom: [
|
|
539
|
+
"Category A",
|
|
540
|
+
"Category B",
|
|
541
|
+
"Category C",
|
|
542
|
+
"Category D",
|
|
543
|
+
"Category E"
|
|
544
|
+
]
|
|
545
|
+
};
|
|
546
|
+
const categories = categoryOptions[categoryType];
|
|
547
|
+
const numberOfPoints = categories.length;
|
|
548
|
+
return [...Array(numberOfSeries).keys()].map((seriesIndex) => {
|
|
549
|
+
let nullsArray = [];
|
|
550
|
+
if (showNulls) {
|
|
551
|
+
const nullsArrayLength = Math.floor(numberOfPoints / 5);
|
|
552
|
+
nullsArray = [...Array(nullsArrayLength)].map(
|
|
553
|
+
() => Math.floor(Math.random() * numberOfPoints)
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
points: categories.map((category, pointIndex) => {
|
|
558
|
+
const showNull = nullsArray && nullsArray.length > 0 ? nullsArray.includes(pointIndex) : false;
|
|
559
|
+
const randomValue = Math.random();
|
|
560
|
+
const positiveOrNegativeYAxisMax = showNegativeValues ? randomValue < 0.5 ? -yAxisMax : yAxisMax : yAxisMax;
|
|
561
|
+
return {
|
|
562
|
+
x: category,
|
|
563
|
+
y: showNull ? null : Math.floor(randomValue * positiveOrNegativeYAxisMax)
|
|
564
|
+
};
|
|
565
|
+
}),
|
|
566
|
+
name: `Series ${seriesIndex + 1}`,
|
|
567
|
+
styles: {
|
|
568
|
+
color: showCustomColors ? getStorybookRandomColor() : void 0,
|
|
569
|
+
pattern: showDashedLines ? "dashed" : "solid"
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
});
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
// src/helpers/getStorybookSparseTimelineData.ts
|
|
576
|
+
var getStorybookSparseTimelineData = ({
|
|
577
|
+
showNulls,
|
|
578
|
+
showNegativeValues,
|
|
579
|
+
numberOfSeries,
|
|
580
|
+
yAxisMax,
|
|
581
|
+
showCustomColors,
|
|
582
|
+
showDashedLines,
|
|
583
|
+
numberOfPoints = 5,
|
|
584
|
+
timeSpanHours = 24
|
|
585
|
+
}) => {
|
|
586
|
+
const seriesNames = [
|
|
587
|
+
"Posts Published",
|
|
588
|
+
"Comments",
|
|
589
|
+
"Likes",
|
|
590
|
+
"Shares",
|
|
591
|
+
"Clicks",
|
|
592
|
+
"Views",
|
|
593
|
+
"Saves",
|
|
594
|
+
"Reposts",
|
|
595
|
+
"Mentions",
|
|
596
|
+
"Reactions"
|
|
597
|
+
];
|
|
598
|
+
const baseDate = /* @__PURE__ */ new Date("2024-01-01T00:00:00Z");
|
|
599
|
+
const timeSpanMs = timeSpanHours * 60 * 60 * 1e3;
|
|
600
|
+
return [...Array(numberOfSeries).keys()].map((seriesIndex) => {
|
|
601
|
+
let nullsArray = [];
|
|
602
|
+
if (showNulls) {
|
|
603
|
+
const nullsArrayLength = Math.floor(numberOfPoints / 5);
|
|
604
|
+
nullsArray = [...Array(nullsArrayLength)].map(
|
|
605
|
+
() => Math.floor(Math.random() * numberOfPoints)
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
const timestamps = [...Array(numberOfPoints)].map(() => {
|
|
609
|
+
const randomOffset = Math.random() * timeSpanMs;
|
|
610
|
+
return baseDate.getTime() + randomOffset;
|
|
611
|
+
}).sort((a, b) => a - b);
|
|
612
|
+
return {
|
|
613
|
+
points: timestamps.map((timestamp, pointIndex) => {
|
|
614
|
+
const showNull = nullsArray && nullsArray.length > 0 ? nullsArray.includes(pointIndex) : false;
|
|
615
|
+
const randomValue = Math.random();
|
|
616
|
+
const positiveOrNegativeYAxisMax = showNegativeValues ? randomValue < 0.5 ? -yAxisMax : yAxisMax : yAxisMax;
|
|
617
|
+
return {
|
|
618
|
+
x: timestamp,
|
|
619
|
+
y: showNull ? null : Math.floor(randomValue * positiveOrNegativeYAxisMax)
|
|
620
|
+
};
|
|
621
|
+
}),
|
|
622
|
+
name: seriesNames[seriesIndex] || `Series ${seriesIndex + 1}`,
|
|
623
|
+
styles: {
|
|
624
|
+
color: showCustomColors ? getStorybookRandomColor() : void 0,
|
|
625
|
+
pattern: showDashedLines ? "dashed" : "solid"
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
|
|
229
631
|
// src/hooks/useTimeSeriesChartOptions.ts
|
|
230
632
|
import { useState as useState2, useCallback, useMemo } from "react";
|
|
231
633
|
import { merge } from "lodash";
|
|
@@ -476,16 +878,16 @@ var useTimeSeriesChartOptions = ({
|
|
|
476
878
|
var xAxisLabelFormatterDefault = xAxisLabelFormatter;
|
|
477
879
|
|
|
478
880
|
// src/components/AreaChart/AreaChart.tsx
|
|
479
|
-
import { theme as
|
|
480
|
-
import { Fragment as Fragment2, jsx as
|
|
881
|
+
import { theme as theme3 } from "@sproutsocial/seeds-react-theme";
|
|
882
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
481
883
|
highchartsAccessibility(Highcharts);
|
|
482
884
|
highchartsAnnotations(Highcharts);
|
|
483
|
-
var StyledBox =
|
|
885
|
+
var StyledBox = styled2(Box2)`
|
|
484
886
|
${areaChartStyles}
|
|
485
887
|
`;
|
|
486
888
|
var AreaChart = memo4(function AreaChart2(props) {
|
|
487
889
|
const { data } = props;
|
|
488
|
-
return data.length === 0 ? null : /* @__PURE__ */
|
|
890
|
+
return data.length === 0 ? null : /* @__PURE__ */ jsx5(AreaChartWithData, { ...props });
|
|
489
891
|
});
|
|
490
892
|
var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
491
893
|
data,
|
|
@@ -521,10 +923,10 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
521
923
|
xAnnotations
|
|
522
924
|
});
|
|
523
925
|
const colors = data.map(
|
|
524
|
-
(series, index) => series.styles?.color ??
|
|
926
|
+
(series, index) => series.styles?.color ?? theme3.colors.DATAVIZ_COLORS_LIST[index]
|
|
525
927
|
);
|
|
526
928
|
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
527
|
-
/* @__PURE__ */
|
|
929
|
+
/* @__PURE__ */ jsx5(GlobalChartStyleOverrides, {}),
|
|
528
930
|
/* @__PURE__ */ jsxs2(
|
|
529
931
|
StyledBox,
|
|
530
932
|
{
|
|
@@ -532,7 +934,7 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
532
934
|
$hasOnClick: Boolean(onClick),
|
|
533
935
|
bg: "container.background.base",
|
|
534
936
|
children: [
|
|
535
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ jsx5(
|
|
536
938
|
HighchartsReact,
|
|
537
939
|
{
|
|
538
940
|
highcharts: Highcharts,
|
|
@@ -540,7 +942,7 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
540
942
|
callback
|
|
541
943
|
}
|
|
542
944
|
),
|
|
543
|
-
chart && chart.annotations?.length ? /* @__PURE__ */
|
|
945
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ jsx5(
|
|
544
946
|
ChartXAnnotationMarkerPortal,
|
|
545
947
|
{
|
|
546
948
|
xAnnotations,
|
|
@@ -548,7 +950,7 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
548
950
|
chartContainer: chart.container
|
|
549
951
|
}
|
|
550
952
|
) : null,
|
|
551
|
-
chart && !disableTooltips ? /* @__PURE__ */
|
|
953
|
+
chart && !disableTooltips ? /* @__PURE__ */ jsx5(
|
|
552
954
|
ChartTooltipPortal,
|
|
553
955
|
{
|
|
554
956
|
chart,
|
|
@@ -560,7 +962,7 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
560
962
|
const x = context.x;
|
|
561
963
|
const total = context.total;
|
|
562
964
|
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
563
|
-
return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */
|
|
965
|
+
return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */ jsx5(
|
|
564
966
|
AreaChartTooltip,
|
|
565
967
|
{
|
|
566
968
|
currency,
|
|
@@ -581,7 +983,7 @@ var AreaChartWithData = memo4(function AreaChartWithData2({
|
|
|
581
983
|
}
|
|
582
984
|
}
|
|
583
985
|
) : null,
|
|
584
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ jsx5(Box2, { mt: 350, children: /* @__PURE__ */ jsx5(AreaChartLegend, { data }) })
|
|
585
987
|
]
|
|
586
988
|
}
|
|
587
989
|
)
|
|
@@ -593,12 +995,12 @@ import { memo as memo5 } from "react";
|
|
|
593
995
|
import { Box as Box3 } from "@sproutsocial/seeds-react-box";
|
|
594
996
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
595
997
|
import { Text as Text2 } from "@sproutsocial/seeds-react-text";
|
|
596
|
-
import { jsx as
|
|
998
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
597
999
|
var ChartXAnnotationDetails = memo5(
|
|
598
1000
|
function ChartXAnnotationDetails2({ iconName, text }) {
|
|
599
|
-
return /* @__PURE__ */
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ jsx6(ChartTooltipHeader, { children: /* @__PURE__ */ jsxs3(Box3, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1002
|
+
/* @__PURE__ */ jsx6(Icon2, { name: iconName, size: "mini", color: "icon.base" }),
|
|
1003
|
+
/* @__PURE__ */ jsx6(Text2, { color: "text.body", fontSize: 200, children: text })
|
|
602
1004
|
] }) });
|
|
603
1005
|
}
|
|
604
1006
|
);
|
|
@@ -607,11 +1009,11 @@ var ChartXAnnotationDetails = memo5(
|
|
|
607
1009
|
import { memo as memo6 } from "react";
|
|
608
1010
|
import { Box as Box4 } from "@sproutsocial/seeds-react-box";
|
|
609
1011
|
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
610
|
-
import { jsx as
|
|
1012
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
611
1013
|
var ChartXAnnotationMarker = memo6(
|
|
612
1014
|
function ChartXAnnotationMarker2({ iconName }) {
|
|
613
1015
|
return /* @__PURE__ */ jsxs4(Box4, { display: "flex", flexDirection: "column", alignItems: "center", gap: 200, children: [
|
|
614
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ jsx7(
|
|
615
1017
|
Box4,
|
|
616
1018
|
{
|
|
617
1019
|
display: "flex",
|
|
@@ -621,10 +1023,10 @@ var ChartXAnnotationMarker = memo6(
|
|
|
621
1023
|
height: "20px",
|
|
622
1024
|
bg: "icon.base",
|
|
623
1025
|
borderRadius: "50%",
|
|
624
|
-
children: /* @__PURE__ */
|
|
1026
|
+
children: /* @__PURE__ */ jsx7(Icon3, { name: iconName, size: "mini", color: "icon.inverse" })
|
|
625
1027
|
}
|
|
626
1028
|
),
|
|
627
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ jsx7(Box4, { height: `199px`, width: "0.5px", bg: "neutral.200" })
|
|
628
1030
|
] });
|
|
629
1031
|
}
|
|
630
1032
|
);
|
|
@@ -634,24 +1036,24 @@ import { memo as memo9, useState as useState3, useEffect as useEffect2, useCallb
|
|
|
634
1036
|
import Highcharts2 from "highcharts";
|
|
635
1037
|
import { HighchartsReact as HighchartsReact2 } from "highcharts-react-official";
|
|
636
1038
|
import highchartsAccessibility2 from "highcharts/modules/accessibility";
|
|
637
|
-
import
|
|
1039
|
+
import styled3 from "styled-components";
|
|
638
1040
|
import { Box as Box6 } from "@sproutsocial/seeds-react-box";
|
|
639
1041
|
|
|
640
1042
|
// src/components/DonutChart/components/DonutChartLegend.tsx
|
|
641
1043
|
import { memo as memo7 } from "react";
|
|
642
|
-
import { theme as
|
|
643
|
-
import { jsx as
|
|
1044
|
+
import { theme as theme4 } from "@sproutsocial/seeds-react-theme";
|
|
1045
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
644
1046
|
var getDonutChartLegendLabels = ({
|
|
645
1047
|
data
|
|
646
1048
|
}) => {
|
|
647
1049
|
return data.map((slice, index) => ({
|
|
648
|
-
content: /* @__PURE__ */
|
|
649
|
-
color: slice.styles?.color ||
|
|
1050
|
+
content: /* @__PURE__ */ jsx8(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
|
|
1051
|
+
color: slice.styles?.color || theme4.colors.DATAVIZ_COLORS_LIST[index]
|
|
650
1052
|
}));
|
|
651
1053
|
};
|
|
652
1054
|
var DonutChartLegend = memo7(
|
|
653
1055
|
function DonutChartLegend2({ data }) {
|
|
654
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ jsx8(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
|
|
655
1057
|
}
|
|
656
1058
|
);
|
|
657
1059
|
|
|
@@ -662,7 +1064,7 @@ import { Duration as Duration2 } from "@sproutsocial/seeds-react-duration";
|
|
|
662
1064
|
import { Icon as Icon4 } from "@sproutsocial/seeds-react-icon";
|
|
663
1065
|
import { Numeral as Numeral2 } from "@sproutsocial/seeds-react-numeral";
|
|
664
1066
|
import { Text as Text3 } from "@sproutsocial/seeds-react-text";
|
|
665
|
-
import { jsx as
|
|
1067
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
666
1068
|
var DonutChartTooltip = memo8(
|
|
667
1069
|
function DonutChartTooltip2({
|
|
668
1070
|
color,
|
|
@@ -681,11 +1083,11 @@ var DonutChartTooltip = memo8(
|
|
|
681
1083
|
{
|
|
682
1084
|
cells: [
|
|
683
1085
|
{
|
|
684
|
-
content: /* @__PURE__ */
|
|
1086
|
+
content: /* @__PURE__ */ jsx9(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx9(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx9(Text3, { "aria-label": `${name}: `, children: name }) }) })
|
|
685
1087
|
},
|
|
686
1088
|
{
|
|
687
1089
|
content: /* @__PURE__ */ jsxs5(Box5, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
688
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ jsx9(
|
|
689
1091
|
Numeral2,
|
|
690
1092
|
{
|
|
691
1093
|
number: percent,
|
|
@@ -694,7 +1096,7 @@ var DonutChartTooltip = memo8(
|
|
|
694
1096
|
locale: numberLocale
|
|
695
1097
|
}
|
|
696
1098
|
),
|
|
697
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsx9(Text3, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx9(Duration2, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx9(
|
|
698
1100
|
Numeral2,
|
|
699
1101
|
{
|
|
700
1102
|
abbreviate: false,
|
|
@@ -711,24 +1113,24 @@ var DonutChartTooltip = memo8(
|
|
|
711
1113
|
}
|
|
712
1114
|
];
|
|
713
1115
|
return /* @__PURE__ */ jsxs5(ChartTooltip, { children: [
|
|
714
|
-
/* @__PURE__ */
|
|
715
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ jsx9(ChartTooltipTable, { rows }),
|
|
1117
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx9(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs5(Box5, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1118
|
+
/* @__PURE__ */ jsx9(Icon4, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1119
|
+
/* @__PURE__ */ jsx9(Text3, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
718
1120
|
] }) : tooltipClickLabel }) : null
|
|
719
1121
|
] });
|
|
720
1122
|
}
|
|
721
1123
|
);
|
|
722
1124
|
|
|
723
1125
|
// src/components/DonutChart/helpers/transformDonutChartTooltipData.ts
|
|
724
|
-
import { theme as
|
|
1126
|
+
import { theme as theme5 } from "@sproutsocial/seeds-react-theme";
|
|
725
1127
|
var transformDonutChartTooltipData = ({
|
|
726
1128
|
context,
|
|
727
1129
|
data
|
|
728
1130
|
}) => {
|
|
729
1131
|
const colorIndex = context.colorIndex;
|
|
730
1132
|
return {
|
|
731
|
-
color: data[colorIndex]?.styles?.color ??
|
|
1133
|
+
color: data[colorIndex]?.styles?.color ?? theme5.colors.DATAVIZ_COLORS_LIST[colorIndex] ?? "",
|
|
732
1134
|
...data[colorIndex]?.icon ? { icon: data[colorIndex]?.icon } : {},
|
|
733
1135
|
name: context.key,
|
|
734
1136
|
percent: context.percentage,
|
|
@@ -737,15 +1139,15 @@ var transformDonutChartTooltipData = ({
|
|
|
737
1139
|
};
|
|
738
1140
|
|
|
739
1141
|
// src/components/DonutChart/DonutChart.tsx
|
|
740
|
-
import { theme as
|
|
741
|
-
import { Fragment as Fragment3, jsx as
|
|
1142
|
+
import { theme as theme6 } from "@sproutsocial/seeds-react-theme";
|
|
1143
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
742
1144
|
highchartsAccessibility2(Highcharts2);
|
|
743
|
-
var StyledBox2 =
|
|
1145
|
+
var StyledBox2 = styled3(Box6)`
|
|
744
1146
|
${donutChartStyles}
|
|
745
1147
|
`;
|
|
746
1148
|
var DonutChart = memo9(function DonutChart2(props) {
|
|
747
1149
|
const { data } = props;
|
|
748
|
-
return data.length === 0 ? null : /* @__PURE__ */
|
|
1150
|
+
return data.length === 0 ? null : /* @__PURE__ */ jsx10(DonutChartWithData, { ...props });
|
|
749
1151
|
});
|
|
750
1152
|
var DonutChartWithData = memo9(
|
|
751
1153
|
function DonutChartWithData2({
|
|
@@ -816,10 +1218,10 @@ var DonutChartWithData = memo9(
|
|
|
816
1218
|
});
|
|
817
1219
|
}, [data]);
|
|
818
1220
|
const colors = data.map(
|
|
819
|
-
(series, index) => series.styles?.color ??
|
|
1221
|
+
(series, index) => series.styles?.color ?? theme6.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
820
1222
|
);
|
|
821
1223
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
822
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsx10(GlobalChartStyleOverrides, {}),
|
|
823
1225
|
/* @__PURE__ */ jsxs6(
|
|
824
1226
|
StyledBox2,
|
|
825
1227
|
{
|
|
@@ -827,7 +1229,7 @@ var DonutChartWithData = memo9(
|
|
|
827
1229
|
$hasOnClick: Boolean(onClick),
|
|
828
1230
|
bg: "container.background.base",
|
|
829
1231
|
children: [
|
|
830
|
-
/* @__PURE__ */
|
|
1232
|
+
/* @__PURE__ */ jsx10(
|
|
831
1233
|
HighchartsReact2,
|
|
832
1234
|
{
|
|
833
1235
|
highcharts: Highcharts2,
|
|
@@ -835,13 +1237,13 @@ var DonutChartWithData = memo9(
|
|
|
835
1237
|
callback
|
|
836
1238
|
}
|
|
837
1239
|
),
|
|
838
|
-
chart && !disableTooltips ? /* @__PURE__ */
|
|
1240
|
+
chart && !disableTooltips ? /* @__PURE__ */ jsx10(
|
|
839
1241
|
ChartTooltipPortal,
|
|
840
1242
|
{
|
|
841
1243
|
chart,
|
|
842
1244
|
renderContent: (context) => {
|
|
843
1245
|
const { color, icon, name, percent, value } = transformDonutChartTooltipData({ context, data });
|
|
844
|
-
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */
|
|
1246
|
+
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ jsx10(
|
|
845
1247
|
DonutChartTooltip,
|
|
846
1248
|
{
|
|
847
1249
|
color,
|
|
@@ -860,7 +1262,7 @@ var DonutChartWithData = memo9(
|
|
|
860
1262
|
}
|
|
861
1263
|
}
|
|
862
1264
|
) : null,
|
|
863
|
-
hideLegend ? null : /* @__PURE__ */
|
|
1265
|
+
hideLegend ? null : /* @__PURE__ */ jsx10(Box6, { mt: 350, children: /* @__PURE__ */ jsx10(DonutChartLegend, { data }) })
|
|
864
1266
|
]
|
|
865
1267
|
}
|
|
866
1268
|
)
|
|
@@ -874,8 +1276,8 @@ import { Box as Box7 } from "@sproutsocial/seeds-react-box";
|
|
|
874
1276
|
import { Duration as Duration3 } from "@sproutsocial/seeds-react-duration";
|
|
875
1277
|
import { Numeral as Numeral3 } from "@sproutsocial/seeds-react-numeral";
|
|
876
1278
|
import { Text as Text4 } from "@sproutsocial/seeds-react-text";
|
|
877
|
-
import { theme as
|
|
878
|
-
import { jsx as
|
|
1279
|
+
import { theme as theme7 } from "@sproutsocial/seeds-react-theme";
|
|
1280
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
879
1281
|
var DonutChartLegendTable = memo10(
|
|
880
1282
|
function DonutChartLegendTable2({
|
|
881
1283
|
data,
|
|
@@ -892,15 +1294,15 @@ var DonutChartLegendTable = memo10(
|
|
|
892
1294
|
);
|
|
893
1295
|
const rows = data.map((dataPoint, index) => {
|
|
894
1296
|
const { name, icon, styles, value } = dataPoint;
|
|
895
|
-
const color = styles?.color ||
|
|
1297
|
+
const color = styles?.color || theme7.colors.DATAVIZ_COLORS_LIST[index];
|
|
896
1298
|
return {
|
|
897
1299
|
cells: [
|
|
898
1300
|
{
|
|
899
|
-
content: /* @__PURE__ */
|
|
1301
|
+
content: /* @__PURE__ */ jsx11(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx11(ChartLegendLabelContentWithIcon, { icon, children: name }) })
|
|
900
1302
|
},
|
|
901
1303
|
{
|
|
902
1304
|
content: /* @__PURE__ */ jsxs7(Box7, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
903
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ jsx11(Text4, { color: "text.body", children: /* @__PURE__ */ jsx11(
|
|
904
1306
|
Numeral3,
|
|
905
1307
|
{
|
|
906
1308
|
abbreviate: false,
|
|
@@ -909,7 +1311,7 @@ var DonutChartLegendTable = memo10(
|
|
|
909
1311
|
number: value / total * 100
|
|
910
1312
|
}
|
|
911
1313
|
) }),
|
|
912
|
-
/* @__PURE__ */
|
|
1314
|
+
/* @__PURE__ */ jsx11(Text4, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx11(Duration3, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx11(
|
|
913
1315
|
Numeral3,
|
|
914
1316
|
{
|
|
915
1317
|
abbreviate: false,
|
|
@@ -929,10 +1331,10 @@ var DonutChartLegendTable = memo10(
|
|
|
929
1331
|
{
|
|
930
1332
|
cells: [
|
|
931
1333
|
{
|
|
932
|
-
content: /* @__PURE__ */
|
|
1334
|
+
content: /* @__PURE__ */ jsx11(Text4, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
|
|
933
1335
|
},
|
|
934
1336
|
{
|
|
935
|
-
content: /* @__PURE__ */
|
|
1337
|
+
content: /* @__PURE__ */ jsx11(Text4, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx11(Duration3, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ jsx11(
|
|
936
1338
|
Numeral3,
|
|
937
1339
|
{
|
|
938
1340
|
abbreviate: false,
|
|
@@ -948,7 +1350,7 @@ var DonutChartLegendTable = memo10(
|
|
|
948
1350
|
isAppendedRow: true
|
|
949
1351
|
}
|
|
950
1352
|
];
|
|
951
|
-
return /* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ jsx11(
|
|
952
1354
|
ChartTable,
|
|
953
1355
|
{
|
|
954
1356
|
rows: [...rows, ...totalRow]
|
|
@@ -963,24 +1365,24 @@ import Highcharts3 from "highcharts";
|
|
|
963
1365
|
import { HighchartsReact as HighchartsReact3 } from "highcharts-react-official";
|
|
964
1366
|
import highchartsAccessibility3 from "highcharts/modules/accessibility";
|
|
965
1367
|
import highchartsAnnotations2 from "highcharts/modules/annotations";
|
|
966
|
-
import
|
|
1368
|
+
import styled4 from "styled-components";
|
|
967
1369
|
import { Box as Box9 } from "@sproutsocial/seeds-react-box";
|
|
968
1370
|
|
|
969
1371
|
// src/components/LineChart/components/LineChartLegend.tsx
|
|
970
1372
|
import { memo as memo11 } from "react";
|
|
971
|
-
import { theme as
|
|
972
|
-
import { jsx as
|
|
1373
|
+
import { theme as theme8 } from "@sproutsocial/seeds-react-theme";
|
|
1374
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
973
1375
|
var getLineChartLegendLabels = ({
|
|
974
1376
|
data
|
|
975
1377
|
}) => {
|
|
976
1378
|
return data.map((series, index) => ({
|
|
977
|
-
content: /* @__PURE__ */
|
|
978
|
-
color: series.styles?.color ||
|
|
1379
|
+
content: /* @__PURE__ */ jsx12(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
1380
|
+
color: series.styles?.color || theme8.colors.DATAVIZ_COLORS_LIST[index]
|
|
979
1381
|
}));
|
|
980
1382
|
};
|
|
981
1383
|
var LineChartLegend = memo11(
|
|
982
1384
|
function LineChartLegend2({ data }) {
|
|
983
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ jsx12(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
|
|
984
1386
|
}
|
|
985
1387
|
);
|
|
986
1388
|
|
|
@@ -991,7 +1393,7 @@ import { Duration as Duration4 } from "@sproutsocial/seeds-react-duration";
|
|
|
991
1393
|
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
992
1394
|
import { Numeral as Numeral4 } from "@sproutsocial/seeds-react-numeral";
|
|
993
1395
|
import { Text as Text5 } from "@sproutsocial/seeds-react-text";
|
|
994
|
-
import { jsx as
|
|
1396
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
995
1397
|
var LineChartTooltip = memo12(
|
|
996
1398
|
function LineChartTooltip2({
|
|
997
1399
|
data,
|
|
@@ -1011,10 +1413,10 @@ var LineChartTooltip = memo12(
|
|
|
1011
1413
|
return {
|
|
1012
1414
|
cells: [
|
|
1013
1415
|
{
|
|
1014
|
-
content: /* @__PURE__ */
|
|
1416
|
+
content: /* @__PURE__ */ jsx13(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx13(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx13(Text5, { "aria-label": `${name}: `, children: name }) }) })
|
|
1015
1417
|
},
|
|
1016
1418
|
{
|
|
1017
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */
|
|
1419
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx13(Text5, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx13(Duration4, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx13(
|
|
1018
1420
|
Numeral4,
|
|
1019
1421
|
{
|
|
1020
1422
|
abbreviate: false,
|
|
@@ -1031,27 +1433,27 @@ var LineChartTooltip = memo12(
|
|
|
1031
1433
|
});
|
|
1032
1434
|
return /* @__PURE__ */ jsxs8(ChartTooltip, { children: [
|
|
1033
1435
|
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1436
|
+
/* @__PURE__ */ jsx13(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
1437
|
+
/* @__PURE__ */ jsx13(ChartTooltipTable, { rows }),
|
|
1438
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx13(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs8(Box8, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1439
|
+
/* @__PURE__ */ jsx13(Icon5, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1440
|
+
/* @__PURE__ */ jsx13(Text5, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
1039
1441
|
] }) : tooltipClickLabel }) : null
|
|
1040
1442
|
] });
|
|
1041
1443
|
}
|
|
1042
1444
|
);
|
|
1043
1445
|
|
|
1044
1446
|
// src/components/LineChart/LineChart.tsx
|
|
1045
|
-
import { theme as
|
|
1046
|
-
import { Fragment as Fragment4, jsx as
|
|
1447
|
+
import { theme as theme9 } from "@sproutsocial/seeds-react-theme";
|
|
1448
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1047
1449
|
highchartsAccessibility3(Highcharts3);
|
|
1048
1450
|
highchartsAnnotations2(Highcharts3);
|
|
1049
|
-
var StyledBox3 =
|
|
1451
|
+
var StyledBox3 = styled4(Box9)`
|
|
1050
1452
|
${lineChartStyles}
|
|
1051
1453
|
`;
|
|
1052
1454
|
var LineChart = memo13(function LineChart2(props) {
|
|
1053
1455
|
const { data } = props;
|
|
1054
|
-
return data.length === 0 ? null : /* @__PURE__ */
|
|
1456
|
+
return data.length === 0 ? null : /* @__PURE__ */ jsx14(LineChartWithData, { ...props });
|
|
1055
1457
|
});
|
|
1056
1458
|
var LineChartWithData = memo13(function LineChartWithData2({
|
|
1057
1459
|
data,
|
|
@@ -1090,7 +1492,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1090
1492
|
const { colors, patterns } = data.reduce(
|
|
1091
1493
|
(acc, item, index) => {
|
|
1092
1494
|
acc.colors.push(
|
|
1093
|
-
item.styles?.color ??
|
|
1495
|
+
item.styles?.color ?? theme9.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
1094
1496
|
);
|
|
1095
1497
|
acc.patterns.push(item.styles?.pattern ?? "solid");
|
|
1096
1498
|
return acc;
|
|
@@ -1101,7 +1503,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1101
1503
|
}
|
|
1102
1504
|
);
|
|
1103
1505
|
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1104
|
-
/* @__PURE__ */
|
|
1506
|
+
/* @__PURE__ */ jsx14(GlobalChartStyleOverrides, {}),
|
|
1105
1507
|
/* @__PURE__ */ jsxs9(
|
|
1106
1508
|
StyledBox3,
|
|
1107
1509
|
{
|
|
@@ -1110,7 +1512,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1110
1512
|
$hasOnClick: Boolean(onClick),
|
|
1111
1513
|
bg: "container.background.base",
|
|
1112
1514
|
children: [
|
|
1113
|
-
/* @__PURE__ */
|
|
1515
|
+
/* @__PURE__ */ jsx14(
|
|
1114
1516
|
HighchartsReact3,
|
|
1115
1517
|
{
|
|
1116
1518
|
highcharts: Highcharts3,
|
|
@@ -1118,7 +1520,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1118
1520
|
callback
|
|
1119
1521
|
}
|
|
1120
1522
|
),
|
|
1121
|
-
chart && chart.annotations?.length ? /* @__PURE__ */
|
|
1523
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ jsx14(
|
|
1122
1524
|
ChartXAnnotationMarkerPortal,
|
|
1123
1525
|
{
|
|
1124
1526
|
xAnnotations,
|
|
@@ -1126,7 +1528,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1126
1528
|
chartContainer: chart.container
|
|
1127
1529
|
}
|
|
1128
1530
|
) : null,
|
|
1129
|
-
chart && !disableTooltips ? /* @__PURE__ */
|
|
1531
|
+
chart && !disableTooltips ? /* @__PURE__ */ jsx14(
|
|
1130
1532
|
ChartTooltipPortal,
|
|
1131
1533
|
{
|
|
1132
1534
|
chart,
|
|
@@ -1137,7 +1539,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1137
1539
|
});
|
|
1138
1540
|
const x = context.x;
|
|
1139
1541
|
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
1140
|
-
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */
|
|
1542
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx14(
|
|
1141
1543
|
LineChartTooltip,
|
|
1142
1544
|
{
|
|
1143
1545
|
currency,
|
|
@@ -1156,7 +1558,7 @@ var LineChartWithData = memo13(function LineChartWithData2({
|
|
|
1156
1558
|
}
|
|
1157
1559
|
}
|
|
1158
1560
|
) : null,
|
|
1159
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ jsx14(Box9, { mt: 350, children: /* @__PURE__ */ jsx14(LineChartLegend, { data }) })
|
|
1160
1562
|
]
|
|
1161
1563
|
}
|
|
1162
1564
|
)
|
|
@@ -1169,24 +1571,24 @@ import Highcharts4 from "highcharts";
|
|
|
1169
1571
|
import { HighchartsReact as HighchartsReact4 } from "highcharts-react-official";
|
|
1170
1572
|
import highchartsAccessibility4 from "highcharts/modules/accessibility";
|
|
1171
1573
|
import highchartsAnnotations3 from "highcharts/modules/annotations";
|
|
1172
|
-
import
|
|
1574
|
+
import styled5 from "styled-components";
|
|
1173
1575
|
import { Box as Box11 } from "@sproutsocial/seeds-react-box";
|
|
1174
1576
|
|
|
1175
1577
|
// src/components/VerticalBarChart/components/VerticalBarChartLegend.tsx
|
|
1176
1578
|
import { memo as memo14 } from "react";
|
|
1177
|
-
import { theme as
|
|
1178
|
-
import { jsx as
|
|
1579
|
+
import { theme as theme10 } from "@sproutsocial/seeds-react-theme";
|
|
1580
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1179
1581
|
var getVerticalBarChartLegendLabels = ({
|
|
1180
1582
|
data
|
|
1181
1583
|
}) => {
|
|
1182
1584
|
return data.map((series, index) => ({
|
|
1183
|
-
content: /* @__PURE__ */
|
|
1184
|
-
color: series.styles?.color ||
|
|
1585
|
+
content: /* @__PURE__ */ jsx15(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
1586
|
+
color: series.styles?.color || theme10.colors.DATAVIZ_COLORS_LIST[index]
|
|
1185
1587
|
}));
|
|
1186
1588
|
};
|
|
1187
1589
|
var VerticalBarChartLegend = memo14(
|
|
1188
1590
|
function VerticalbarChartLegend({ data }) {
|
|
1189
|
-
return /* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ jsx15(ChartLegend, { legendLabels: getVerticalBarChartLegendLabels({ data }) });
|
|
1190
1592
|
}
|
|
1191
1593
|
);
|
|
1192
1594
|
|
|
@@ -1197,7 +1599,7 @@ import { Duration as Duration5 } from "@sproutsocial/seeds-react-duration";
|
|
|
1197
1599
|
import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
|
|
1198
1600
|
import { Numeral as Numeral5 } from "@sproutsocial/seeds-react-numeral";
|
|
1199
1601
|
import { Text as Text6 } from "@sproutsocial/seeds-react-text";
|
|
1200
|
-
import { jsx as
|
|
1602
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1201
1603
|
var VerticalBarChartTooltip = memo15(
|
|
1202
1604
|
function VerticalBarChartTooltip2({
|
|
1203
1605
|
data,
|
|
@@ -1217,10 +1619,10 @@ var VerticalBarChartTooltip = memo15(
|
|
|
1217
1619
|
return {
|
|
1218
1620
|
cells: [
|
|
1219
1621
|
{
|
|
1220
|
-
content: /* @__PURE__ */
|
|
1622
|
+
content: /* @__PURE__ */ jsx16(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx16(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx16(Text6, { "aria-label": `${name}: `, children: name }) }) })
|
|
1221
1623
|
},
|
|
1222
1624
|
{
|
|
1223
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */
|
|
1625
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx16(Text6, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx16(Duration5, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx16(
|
|
1224
1626
|
Numeral5,
|
|
1225
1627
|
{
|
|
1226
1628
|
abbreviate: false,
|
|
@@ -1237,18 +1639,18 @@ var VerticalBarChartTooltip = memo15(
|
|
|
1237
1639
|
});
|
|
1238
1640
|
return /* @__PURE__ */ jsxs10(ChartTooltip, { children: [
|
|
1239
1641
|
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1642
|
+
/* @__PURE__ */ jsx16(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
1643
|
+
/* @__PURE__ */ jsx16(ChartTooltipTable, { rows }),
|
|
1644
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx16(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs10(Box10, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1645
|
+
/* @__PURE__ */ jsx16(Icon6, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1646
|
+
/* @__PURE__ */ jsx16(Text6, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
1245
1647
|
] }) : tooltipClickLabel }) : null
|
|
1246
1648
|
] });
|
|
1247
1649
|
}
|
|
1248
1650
|
);
|
|
1249
1651
|
|
|
1250
1652
|
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
1251
|
-
import { theme as
|
|
1653
|
+
import { theme as theme11 } from "@sproutsocial/seeds-react-theme";
|
|
1252
1654
|
|
|
1253
1655
|
// src/components/VerticalBarChart/styles.ts
|
|
1254
1656
|
import { css } from "styled-components";
|
|
@@ -1270,10 +1672,10 @@ var verticalBarChartStyles = css`
|
|
|
1270
1672
|
`;
|
|
1271
1673
|
|
|
1272
1674
|
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
1273
|
-
import { Fragment as Fragment5, jsx as
|
|
1675
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1274
1676
|
highchartsAccessibility4(Highcharts4);
|
|
1275
1677
|
highchartsAnnotations3(Highcharts4);
|
|
1276
|
-
var StyledBox4 =
|
|
1678
|
+
var StyledBox4 = styled5(Box11)`
|
|
1277
1679
|
${verticalBarChartStyles}
|
|
1278
1680
|
`;
|
|
1279
1681
|
var VerticalBarChart = memo16(
|
|
@@ -1293,7 +1695,7 @@ var VerticalBarChart = memo16(
|
|
|
1293
1695
|
}
|
|
1294
1696
|
chartData = data.slice(0, seriesLimit);
|
|
1295
1697
|
}
|
|
1296
|
-
return /* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ jsx17(VerticalBarChartWithData, { ...props, data: chartData });
|
|
1297
1699
|
}
|
|
1298
1700
|
);
|
|
1299
1701
|
var VerticalBarChartWithData = memo16(
|
|
@@ -1370,7 +1772,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1370
1772
|
const { colors } = data.reduce(
|
|
1371
1773
|
(acc, item, index) => {
|
|
1372
1774
|
acc.colors.push(
|
|
1373
|
-
item.styles?.color ??
|
|
1775
|
+
item.styles?.color ?? theme11.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
1374
1776
|
);
|
|
1375
1777
|
acc.patterns.push(item.styles?.pattern ?? "solid");
|
|
1376
1778
|
return acc;
|
|
@@ -1381,7 +1783,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1381
1783
|
}
|
|
1382
1784
|
);
|
|
1383
1785
|
return /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1384
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ jsx17(GlobalChartStyleOverrides, {}),
|
|
1385
1787
|
/* @__PURE__ */ jsxs11(
|
|
1386
1788
|
StyledBox4,
|
|
1387
1789
|
{
|
|
@@ -1389,7 +1791,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1389
1791
|
$hasOnClick: Boolean(onClick),
|
|
1390
1792
|
bg: "container.background.base",
|
|
1391
1793
|
children: [
|
|
1392
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ jsx17(
|
|
1393
1795
|
HighchartsReact4,
|
|
1394
1796
|
{
|
|
1395
1797
|
highcharts: Highcharts4,
|
|
@@ -1397,7 +1799,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1397
1799
|
callback
|
|
1398
1800
|
}
|
|
1399
1801
|
),
|
|
1400
|
-
chart && chart.annotations?.length ? /* @__PURE__ */
|
|
1802
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ jsx17(
|
|
1401
1803
|
ChartXAnnotationMarkerPortal,
|
|
1402
1804
|
{
|
|
1403
1805
|
xAnnotations,
|
|
@@ -1405,7 +1807,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1405
1807
|
chartContainer: chart.container
|
|
1406
1808
|
}
|
|
1407
1809
|
) : null,
|
|
1408
|
-
chart ? /* @__PURE__ */
|
|
1810
|
+
chart ? /* @__PURE__ */ jsx17(
|
|
1409
1811
|
ChartTooltipPortal,
|
|
1410
1812
|
{
|
|
1411
1813
|
chart,
|
|
@@ -1416,7 +1818,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1416
1818
|
});
|
|
1417
1819
|
const x = context.x;
|
|
1418
1820
|
const xAnnotationDetails = typeof x === "number" ? xAnnotations?.[x]?.details : void 0;
|
|
1419
|
-
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */
|
|
1821
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx17(
|
|
1420
1822
|
VerticalBarChartTooltip,
|
|
1421
1823
|
{
|
|
1422
1824
|
currency,
|
|
@@ -1435,7 +1837,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1435
1837
|
}
|
|
1436
1838
|
}
|
|
1437
1839
|
) : null,
|
|
1438
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ jsx17(Box11, { mt: 350, children: /* @__PURE__ */ jsx17(VerticalBarChartLegend, { data }) })
|
|
1439
1841
|
]
|
|
1440
1842
|
}
|
|
1441
1843
|
)
|