@sproutsocial/seeds-react-data-viz 0.15.0 → 0.16.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 +14 -44
- package/dist/bar/index.d.ts +14 -44
- package/dist/bar/index.js +88 -71
- package/dist/bar/index.js.map +1 -1
- package/dist/{chunk-VSZSIN34.js → chunk-XVV7PYQE.js} +2 -2
- package/dist/chunk-XVV7PYQE.js.map +1 -0
- package/dist/esm/bar/index.js +79 -62
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/{chunk-OAN5VC7M.js → chunk-ZXXFRUVF.js} +2 -2
- package/dist/esm/chunk-ZXXFRUVF.js.map +1 -0
- package/dist/esm/index.js +178 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +1 -1
- package/dist/index.js +221 -57
- package/dist/index.js.map +1 -1
- package/dist/line-area/index.js +8 -8
- package/package.json +1 -1
- package/dist/chunk-JXARPHQE.js +0 -193
- package/dist/chunk-JXARPHQE.js.map +0 -1
- package/dist/chunk-VSZSIN34.js.map +0 -1
- package/dist/esm/chunk-HQM3EIZW.js +0 -193
- package/dist/esm/chunk-HQM3EIZW.js.map +0 -1
- package/dist/esm/chunk-OAN5VC7M.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,20 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var _chunkJXARPHQEjs = require('./chunk-JXARPHQE.js');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
14
|
|
|
29
15
|
|
|
30
16
|
|
|
@@ -64,7 +50,7 @@ var getAreaChartLegendLabels = ({
|
|
|
64
50
|
}) => {
|
|
65
51
|
return data.map((series, index) => ({
|
|
66
52
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
67
|
-
color: _optionalChain([series, 'access',
|
|
53
|
+
color: _optionalChain([series, 'access', _2 => _2.styles, 'optionalAccess', _3 => _3.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
68
54
|
}));
|
|
69
55
|
};
|
|
70
56
|
var AreaChartLegend = _react.memo.call(void 0,
|
|
@@ -191,13 +177,13 @@ var ChartXAnnotationMarkerPortal = _react.memo.call(void 0,
|
|
|
191
177
|
(annotation) => annotation.setAttribute("data-annotation-marker", "false")
|
|
192
178
|
);
|
|
193
179
|
annotationContext.labels.forEach((label) => {
|
|
194
|
-
const labelElement = _optionalChain([label, 'access',
|
|
180
|
+
const labelElement = _optionalChain([label, 'access', _4 => _4.graphic, 'optionalAccess', _5 => _5.div]);
|
|
195
181
|
if (labelElement) {
|
|
196
182
|
labelElement.querySelectorAll("div[data-annotation-marker]").forEach((component) => component.remove());
|
|
197
183
|
const annotationDiv = document.createElement("div");
|
|
198
184
|
annotationDiv.setAttribute("data-annotation-marker", "true");
|
|
199
185
|
labelElement.appendChild(annotationDiv);
|
|
200
|
-
const xValue = _optionalChain([label, 'access',
|
|
186
|
+
const xValue = _optionalChain([label, 'access', _6 => _6.options, 'optionalAccess', _7 => _7.point, 'optionalAccess', _8 => _8.x]);
|
|
201
187
|
newContainers[xValue] = annotationDiv;
|
|
202
188
|
}
|
|
203
189
|
});
|
|
@@ -220,7 +206,7 @@ var ChartXAnnotationMarkerPortal = _react.memo.call(void 0,
|
|
|
220
206
|
}, [annotationContext.labels, xAnnotations, chartContainer]);
|
|
221
207
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: Object.entries(annotationContainers.current).map(
|
|
222
208
|
([xValue, container]) => {
|
|
223
|
-
const annotationComponent = _optionalChain([xAnnotations, 'optionalAccess',
|
|
209
|
+
const annotationComponent = _optionalChain([xAnnotations, 'optionalAccess', _9 => _9[Number(xValue)], 'optionalAccess', _10 => _10.marker]);
|
|
224
210
|
return annotationComponent ? _reactdom.createPortal.call(void 0, annotationComponent(), container) : null;
|
|
225
211
|
}
|
|
226
212
|
) });
|
|
@@ -229,7 +215,164 @@ var ChartXAnnotationMarkerPortal = _react.memo.call(void 0,
|
|
|
229
215
|
|
|
230
216
|
// src/hooks/useTimeSeriesChartOptions.ts
|
|
231
217
|
|
|
232
|
-
|
|
218
|
+
|
|
219
|
+
// src/constants/chartOptions.ts
|
|
220
|
+
var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
|
|
221
|
+
var baseChartOptions = {
|
|
222
|
+
chart: {
|
|
223
|
+
animation: false,
|
|
224
|
+
styledMode: true
|
|
225
|
+
},
|
|
226
|
+
credits: {
|
|
227
|
+
enabled: false
|
|
228
|
+
},
|
|
229
|
+
exporting: {
|
|
230
|
+
enabled: false,
|
|
231
|
+
fallbackToExportServer: false
|
|
232
|
+
},
|
|
233
|
+
legend: {
|
|
234
|
+
enabled: false
|
|
235
|
+
},
|
|
236
|
+
title: {
|
|
237
|
+
text: void 0
|
|
238
|
+
},
|
|
239
|
+
tooltip: {
|
|
240
|
+
hideDelay: 0,
|
|
241
|
+
outside: true,
|
|
242
|
+
padding: 0,
|
|
243
|
+
shape: "rect",
|
|
244
|
+
shared: true,
|
|
245
|
+
useHTML: true
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var TIME_SERIES_CHART_HEIGHT = 275;
|
|
249
|
+
var timeSeriesChartOptions = _lodash2.default.merge({}, baseChartOptions, {
|
|
250
|
+
annotations: [
|
|
251
|
+
{
|
|
252
|
+
draggable: "",
|
|
253
|
+
labelOptions: {
|
|
254
|
+
useHTML: true,
|
|
255
|
+
padding: 0
|
|
256
|
+
// removes "left" property padding created by highcharts so that label is centered
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
chart: {
|
|
261
|
+
// events.click is set at the component level because of the optional onClick prop
|
|
262
|
+
height: TIME_SERIES_CHART_HEIGHT,
|
|
263
|
+
spacing: [5, 1, 0, 2]
|
|
264
|
+
},
|
|
265
|
+
plotOptions: {
|
|
266
|
+
series: {
|
|
267
|
+
animation: false,
|
|
268
|
+
clip: false,
|
|
269
|
+
marker: {
|
|
270
|
+
enabled: false,
|
|
271
|
+
states: {
|
|
272
|
+
hover: {
|
|
273
|
+
enabled: false
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
xAxis: {
|
|
280
|
+
crosshair: {
|
|
281
|
+
zIndex: 3
|
|
282
|
+
},
|
|
283
|
+
minPadding: 0,
|
|
284
|
+
// must be handled dynamically instead of css
|
|
285
|
+
maxPadding: 0,
|
|
286
|
+
// must be handled dynamically instead of css
|
|
287
|
+
type: "datetime",
|
|
288
|
+
labels: {
|
|
289
|
+
useHTML: true
|
|
290
|
+
// formatter is set at the component level because of the required text locale prop
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
yAxis: {
|
|
294
|
+
labels: {
|
|
295
|
+
useHTML: true
|
|
296
|
+
// formatter is set at the component level because of the optional yAxisLabelFormatter prop
|
|
297
|
+
},
|
|
298
|
+
softMax: 0,
|
|
299
|
+
softMin: 0,
|
|
300
|
+
title: {
|
|
301
|
+
text: void 0
|
|
302
|
+
},
|
|
303
|
+
plotLines: [
|
|
304
|
+
/* Adds a custom plotLine at y=0 to represent the chart baseline.
|
|
305
|
+
This approach allows full control over the line's appearance (e.g., color, z-index),
|
|
306
|
+
unlike relying on the default xAxis line, which always renders at the bottom of the chart
|
|
307
|
+
even when y=0 appears elsewhere (e.g., with negative values).
|
|
308
|
+
*/
|
|
309
|
+
{
|
|
310
|
+
className: "y-axis-zero-line",
|
|
311
|
+
value: 0,
|
|
312
|
+
zIndex: 3
|
|
313
|
+
// ensures the line appears over the default y=0 line, which we can't seleect as specifically
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
var lineChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
|
|
319
|
+
// plotOptions.spline.events.click is set at the component level because of the optional onClick prop
|
|
320
|
+
});
|
|
321
|
+
var areaChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
|
|
322
|
+
plotOptions: {
|
|
323
|
+
areaspline: {
|
|
324
|
+
// events.click is set at the component level because of the optional onClick prop
|
|
325
|
+
stacking: "normal"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
var columnChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
|
|
330
|
+
plotOptions: {
|
|
331
|
+
column: {
|
|
332
|
+
stacking: "normal",
|
|
333
|
+
pointPadding: 0.25,
|
|
334
|
+
groupPadding: 0.25,
|
|
335
|
+
borderRadius: 4
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
xAxis: {
|
|
339
|
+
crosshair: false
|
|
340
|
+
},
|
|
341
|
+
yAxis: {
|
|
342
|
+
plotLines: [
|
|
343
|
+
{
|
|
344
|
+
// For stacked column charts with visible borders (e.g., white for contrast),
|
|
345
|
+
// we raise the zIndex of the y=0 plotLine to ensure it remains visible
|
|
346
|
+
// and isn't visually covered by overlapping column borders.
|
|
347
|
+
zIndex: 5
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
var VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
|
|
353
|
+
var DONUT_CHART_HALO_SIZE = 10;
|
|
354
|
+
var DONUT_CHART_HEIGHT = 250 + DONUT_CHART_HALO_SIZE * 2;
|
|
355
|
+
var DONUT_CHART_WIDTH = DONUT_CHART_HEIGHT;
|
|
356
|
+
var donutChartOptions = _lodash2.default.merge({}, baseChartOptions, {
|
|
357
|
+
chart: {
|
|
358
|
+
height: DONUT_CHART_HEIGHT,
|
|
359
|
+
spacing: [0, 0, 0, 0]
|
|
360
|
+
},
|
|
361
|
+
plotOptions: {
|
|
362
|
+
pie: {
|
|
363
|
+
animation: false,
|
|
364
|
+
borderRadius: 0,
|
|
365
|
+
// must be handled here instead of css because of path rendering
|
|
366
|
+
dataLabels: {
|
|
367
|
+
enabled: false
|
|
368
|
+
},
|
|
369
|
+
innerSize: "50%"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
// src/hooks/useTimeSeriesChartOptions.ts
|
|
375
|
+
|
|
233
376
|
var useTimeSeriesChartOptions = ({
|
|
234
377
|
xAnnotations,
|
|
235
378
|
data,
|
|
@@ -253,7 +396,7 @@ var useTimeSeriesChartOptions = ({
|
|
|
253
396
|
const handleFocus = (point) => point.series.chart.tooltip.refresh(point);
|
|
254
397
|
const handleBlur = (point) => point.series.chart.tooltip.hide(0);
|
|
255
398
|
series.flatMap((item) => item.data).forEach((point) => {
|
|
256
|
-
const pointElement = _optionalChain([point, 'optionalAccess',
|
|
399
|
+
const pointElement = _optionalChain([point, 'optionalAccess', _11 => _11.graphic, 'optionalAccess', _12 => _12.element]);
|
|
257
400
|
if (pointElement) {
|
|
258
401
|
pointElement.setAttribute("aria-describedby", tooltipId);
|
|
259
402
|
pointElement.addEventListener("focus", () => handleFocus(point));
|
|
@@ -280,20 +423,20 @@ var useTimeSeriesChartOptions = ({
|
|
|
280
423
|
const getBaseChartOptions = (type) => {
|
|
281
424
|
switch (type) {
|
|
282
425
|
case "areaspline":
|
|
283
|
-
return
|
|
426
|
+
return areaChartOptions;
|
|
284
427
|
case "spline":
|
|
285
|
-
return
|
|
428
|
+
return lineChartOptions;
|
|
286
429
|
case "column":
|
|
287
|
-
return
|
|
430
|
+
return columnChartOptions;
|
|
288
431
|
default:
|
|
289
|
-
return
|
|
432
|
+
return lineChartOptions;
|
|
290
433
|
}
|
|
291
434
|
};
|
|
292
435
|
const baseChartOptions2 = getBaseChartOptions(seriesType);
|
|
293
436
|
const hasCategoricalData = data.some(
|
|
294
437
|
(series) => series.points.some((point) => typeof point.x === "string")
|
|
295
438
|
);
|
|
296
|
-
const categories = hasCategoricalData ? _optionalChain([data, 'access',
|
|
439
|
+
const categories = hasCategoricalData ? _optionalChain([data, 'access', _13 => _13[0], 'optionalAccess', _14 => _14.points, 'access', _15 => _15.map, 'call', _16 => _16((point) => point.x)]) || [] : [];
|
|
297
440
|
const hasSparseTimelineData = !hasCategoricalData && seriesType === "column";
|
|
298
441
|
const options = _react.useMemo.call(void 0, () => {
|
|
299
442
|
return _lodash.merge.call(void 0, {}, baseChartOptions2, {
|
|
@@ -313,7 +456,7 @@ var useTimeSeriesChartOptions = ({
|
|
|
313
456
|
marginTop: chartMarginTop,
|
|
314
457
|
events: {
|
|
315
458
|
click: onClick ? function() {
|
|
316
|
-
return onClick({ x: _optionalChain([this, 'optionalAccess',
|
|
459
|
+
return onClick({ x: _optionalChain([this, 'optionalAccess', _17 => _17.hoverPoint, 'optionalAccess', _18 => _18.x]) });
|
|
317
460
|
} : void 0,
|
|
318
461
|
load: function() {
|
|
319
462
|
const tooltipId = _chunkEEVKTTT3js.generateChartTooltipPortalId.call(void 0, this.index);
|
|
@@ -407,7 +550,7 @@ var useTimeSeriesChartOptions = ({
|
|
|
407
550
|
Number
|
|
408
551
|
);
|
|
409
552
|
const value = this.value;
|
|
410
|
-
const unitName = _optionalChain([this, 'access',
|
|
553
|
+
const unitName = _optionalChain([this, 'access', _19 => _19.tickPositionInfo, 'optionalAccess', _20 => _20.unitName]);
|
|
411
554
|
if (typeof xAxisLabelFormatter2 === "function") {
|
|
412
555
|
return xAxisLabelFormatter2({
|
|
413
556
|
textLocale,
|
|
@@ -522,7 +665,7 @@ var AreaChartWithData = _react.memo.call(void 0, function AreaChartWithData2({
|
|
|
522
665
|
xAnnotations
|
|
523
666
|
});
|
|
524
667
|
const colors = data.map(
|
|
525
|
-
(series, index) => _nullishCoalesce(_optionalChain([series, 'access',
|
|
668
|
+
(series, index) => _nullishCoalesce(_optionalChain([series, 'access', _21 => _21.styles, 'optionalAccess', _22 => _22.color]), () => ( _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index]))
|
|
526
669
|
);
|
|
527
670
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
528
671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.GlobalChartStyleOverrides, {}),
|
|
@@ -541,11 +684,11 @@ var AreaChartWithData = _react.memo.call(void 0, function AreaChartWithData2({
|
|
|
541
684
|
callback
|
|
542
685
|
}
|
|
543
686
|
),
|
|
544
|
-
chart && _optionalChain([chart, 'access',
|
|
687
|
+
chart && _optionalChain([chart, 'access', _23 => _23.annotations, 'optionalAccess', _24 => _24.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
545
688
|
ChartXAnnotationMarkerPortal,
|
|
546
689
|
{
|
|
547
690
|
xAnnotations,
|
|
548
|
-
annotationContext: _optionalChain([chart, 'access',
|
|
691
|
+
annotationContext: _optionalChain([chart, 'access', _25 => _25.annotations, 'optionalAccess', _26 => _26[0]]),
|
|
549
692
|
chartContainer: chart.container
|
|
550
693
|
}
|
|
551
694
|
) : null,
|
|
@@ -560,7 +703,7 @@ var AreaChartWithData = _react.memo.call(void 0, function AreaChartWithData2({
|
|
|
560
703
|
});
|
|
561
704
|
const x = context.x;
|
|
562
705
|
const total = context.total;
|
|
563
|
-
const xAnnotationDetails = _optionalChain([xAnnotations, 'optionalAccess',
|
|
706
|
+
const xAnnotationDetails = _optionalChain([xAnnotations, 'optionalAccess', _27 => _27[x], 'optionalAccess', _28 => _28.details]);
|
|
564
707
|
return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
565
708
|
AreaChartTooltip,
|
|
566
709
|
{
|
|
@@ -647,7 +790,7 @@ var getDonutChartLegendLabels = ({
|
|
|
647
790
|
}) => {
|
|
648
791
|
return data.map((slice, index) => ({
|
|
649
792
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
|
|
650
|
-
color: _optionalChain([slice, 'access',
|
|
793
|
+
color: _optionalChain([slice, 'access', _29 => _29.styles, 'optionalAccess', _30 => _30.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
651
794
|
}));
|
|
652
795
|
};
|
|
653
796
|
var DonutChartLegend = _react.memo.call(void 0,
|
|
@@ -729,8 +872,8 @@ var transformDonutChartTooltipData = ({
|
|
|
729
872
|
}) => {
|
|
730
873
|
const colorIndex = context.colorIndex;
|
|
731
874
|
return {
|
|
732
|
-
color: _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'access',
|
|
733
|
-
..._optionalChain([data, 'access',
|
|
875
|
+
color: _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'access', _31 => _31[colorIndex], 'optionalAccess', _32 => _32.styles, 'optionalAccess', _33 => _33.color]), () => ( _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[colorIndex])), () => ( "")),
|
|
876
|
+
..._optionalChain([data, 'access', _34 => _34[colorIndex], 'optionalAccess', _35 => _35.icon]) ? { icon: _optionalChain([data, 'access', _36 => _36[colorIndex], 'optionalAccess', _37 => _37.icon]) } : {},
|
|
734
877
|
name: context.key,
|
|
735
878
|
percent: context.percentage,
|
|
736
879
|
value: context.y
|
|
@@ -762,7 +905,7 @@ var DonutChartWithData = _react.memo.call(void 0,
|
|
|
762
905
|
onClick,
|
|
763
906
|
tooltipClickLabel
|
|
764
907
|
}) {
|
|
765
|
-
const [options, setOptions] = _react.useState.call(void 0,
|
|
908
|
+
const [options, setOptions] = _react.useState.call(void 0, donutChartOptions);
|
|
766
909
|
const [chart, setChart] = _react.useState.call(void 0, null);
|
|
767
910
|
const callback = _react.useCallback.call(void 0, (chartInstance) => {
|
|
768
911
|
setChart(chartInstance);
|
|
@@ -779,15 +922,15 @@ var DonutChartWithData = _react.memo.call(void 0,
|
|
|
779
922
|
chart: {
|
|
780
923
|
events: {
|
|
781
924
|
render: function() {
|
|
782
|
-
const allSlices = _nullishCoalesce(_optionalChain([this, 'access',
|
|
925
|
+
const allSlices = _nullishCoalesce(_optionalChain([this, 'access', _38 => _38.series, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.data]), () => ( []));
|
|
783
926
|
const tooltipId = _chunkEEVKTTT3js.generateChartTooltipPortalId.call(void 0, this.index);
|
|
784
927
|
allSlices.forEach((slice) => {
|
|
785
|
-
const sliceElement = _optionalChain([slice, 'optionalAccess',
|
|
786
|
-
_optionalChain([sliceElement, 'optionalAccess',
|
|
787
|
-
_optionalChain([sliceElement, 'optionalAccess',
|
|
928
|
+
const sliceElement = _optionalChain([slice, 'optionalAccess', _41 => _41.graphic, 'optionalAccess', _42 => _42.element]);
|
|
929
|
+
_optionalChain([sliceElement, 'optionalAccess', _43 => _43.setAttribute, 'call', _44 => _44("aria-describedby", tooltipId)]);
|
|
930
|
+
_optionalChain([sliceElement, 'optionalAccess', _45 => _45.addEventListener, 'call', _46 => _46("focus", () => {
|
|
788
931
|
slice.series.chart.tooltip.refresh(slice);
|
|
789
932
|
})]);
|
|
790
|
-
_optionalChain([sliceElement, 'optionalAccess',
|
|
933
|
+
_optionalChain([sliceElement, 'optionalAccess', _47 => _47.addEventListener, 'call', _48 => _48("blur", () => {
|
|
791
934
|
slice.series.chart.tooltip.hide(0);
|
|
792
935
|
})]);
|
|
793
936
|
});
|
|
@@ -817,7 +960,7 @@ var DonutChartWithData = _react.memo.call(void 0,
|
|
|
817
960
|
});
|
|
818
961
|
}, [data]);
|
|
819
962
|
const colors = data.map(
|
|
820
|
-
(series, index) => _nullishCoalesce(_nullishCoalesce(_optionalChain([series, 'access',
|
|
963
|
+
(series, index) => _nullishCoalesce(_nullishCoalesce(_optionalChain([series, 'access', _49 => _49.styles, 'optionalAccess', _50 => _50.color]), () => ( _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index])), () => ( ""))
|
|
821
964
|
);
|
|
822
965
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
823
966
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.GlobalChartStyleOverrides, {}),
|
|
@@ -893,7 +1036,7 @@ var DonutChartLegendTable = _react.memo.call(void 0,
|
|
|
893
1036
|
);
|
|
894
1037
|
const rows = data.map((dataPoint, index) => {
|
|
895
1038
|
const { name, icon, styles, value } = dataPoint;
|
|
896
|
-
const color = _optionalChain([styles, 'optionalAccess',
|
|
1039
|
+
const color = _optionalChain([styles, 'optionalAccess', _51 => _51.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index];
|
|
897
1040
|
return {
|
|
898
1041
|
cells: [
|
|
899
1042
|
{
|
|
@@ -976,7 +1119,7 @@ var getLineChartLegendLabels = ({
|
|
|
976
1119
|
}) => {
|
|
977
1120
|
return data.map((series, index) => ({
|
|
978
1121
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
979
|
-
color: _optionalChain([series, 'access',
|
|
1122
|
+
color: _optionalChain([series, 'access', _52 => _52.styles, 'optionalAccess', _53 => _53.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
980
1123
|
}));
|
|
981
1124
|
};
|
|
982
1125
|
var LineChartLegend = _react.memo.call(void 0,
|
|
@@ -1091,9 +1234,9 @@ var LineChartWithData = _react.memo.call(void 0, function LineChartWithData2({
|
|
|
1091
1234
|
const { colors, patterns } = data.reduce(
|
|
1092
1235
|
(acc, item, index) => {
|
|
1093
1236
|
acc.colors.push(
|
|
1094
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'access',
|
|
1237
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'access', _54 => _54.styles, 'optionalAccess', _55 => _55.color]), () => ( _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index])), () => ( ""))
|
|
1095
1238
|
);
|
|
1096
|
-
acc.patterns.push(_nullishCoalesce(_optionalChain([item, 'access',
|
|
1239
|
+
acc.patterns.push(_nullishCoalesce(_optionalChain([item, 'access', _56 => _56.styles, 'optionalAccess', _57 => _57.pattern]), () => ( "solid")));
|
|
1097
1240
|
return acc;
|
|
1098
1241
|
},
|
|
1099
1242
|
{
|
|
@@ -1119,11 +1262,11 @@ var LineChartWithData = _react.memo.call(void 0, function LineChartWithData2({
|
|
|
1119
1262
|
callback
|
|
1120
1263
|
}
|
|
1121
1264
|
),
|
|
1122
|
-
chart && _optionalChain([chart, 'access',
|
|
1265
|
+
chart && _optionalChain([chart, 'access', _58 => _58.annotations, 'optionalAccess', _59 => _59.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1123
1266
|
ChartXAnnotationMarkerPortal,
|
|
1124
1267
|
{
|
|
1125
1268
|
xAnnotations,
|
|
1126
|
-
annotationContext: _optionalChain([chart, 'access',
|
|
1269
|
+
annotationContext: _optionalChain([chart, 'access', _60 => _60.annotations, 'optionalAccess', _61 => _61[0]]),
|
|
1127
1270
|
chartContainer: chart.container
|
|
1128
1271
|
}
|
|
1129
1272
|
) : null,
|
|
@@ -1137,7 +1280,7 @@ var LineChartWithData = _react.memo.call(void 0, function LineChartWithData2({
|
|
|
1137
1280
|
data
|
|
1138
1281
|
});
|
|
1139
1282
|
const x = context.x;
|
|
1140
|
-
const xAnnotationDetails = _optionalChain([xAnnotations, 'optionalAccess',
|
|
1283
|
+
const xAnnotationDetails = _optionalChain([xAnnotations, 'optionalAccess', _62 => _62[x], 'optionalAccess', _63 => _63.details]);
|
|
1141
1284
|
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1142
1285
|
LineChartTooltip,
|
|
1143
1286
|
{
|
|
@@ -1182,7 +1325,7 @@ var getVerticalBarChartLegendLabels = ({
|
|
|
1182
1325
|
}) => {
|
|
1183
1326
|
return data.map((series, index) => ({
|
|
1184
1327
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEVKTTT3js.ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
1185
|
-
color: _optionalChain([series, 'access',
|
|
1328
|
+
color: _optionalChain([series, 'access', _64 => _64.styles, 'optionalAccess', _65 => _65.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
1186
1329
|
}));
|
|
1187
1330
|
};
|
|
1188
1331
|
var VerticalBarChartLegend = _react.memo.call(void 0,
|
|
@@ -1251,15 +1394,36 @@ var VerticalBarChartTooltip = _react.memo.call(void 0,
|
|
|
1251
1394
|
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
1252
1395
|
|
|
1253
1396
|
|
|
1397
|
+
// src/components/VerticalBarChart/styles.ts
|
|
1398
|
+
|
|
1399
|
+
var verticalBarChartStyles = _styledcomponents.css`
|
|
1400
|
+
${_chunkEEVKTTT3js.timeSeriesChartStyles}
|
|
1401
|
+
|
|
1402
|
+
/*
|
|
1403
|
+
When the chart container is hovered, reduce the opacity of all columns.
|
|
1404
|
+
Then, for the column that is being hovered, restore its opacity.
|
|
1405
|
+
This gives the effect of fading out the non-hovered columns.
|
|
1406
|
+
*/
|
|
1407
|
+
.highcharts-container:hover .highcharts-point {
|
|
1408
|
+
fill-opacity: 0.3;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
.highcharts-point.column-hover {
|
|
1412
|
+
fill-opacity: 1 !important;
|
|
1413
|
+
}
|
|
1414
|
+
`;
|
|
1415
|
+
|
|
1416
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
1417
|
+
|
|
1254
1418
|
_accessibility2.default.call(void 0, _highcharts2.default);
|
|
1255
1419
|
_annotations2.default.call(void 0, _highcharts2.default);
|
|
1256
1420
|
var StyledBox4 = _styledcomponents2.default.call(void 0, _seedsreactbox.Box)`
|
|
1257
|
-
${
|
|
1421
|
+
${verticalBarChartStyles}
|
|
1258
1422
|
`;
|
|
1259
1423
|
var VerticalBarChart = _react.memo.call(void 0,
|
|
1260
1424
|
function VerticalBarChart2(props) {
|
|
1261
1425
|
const { data, showSeriesLimitWarning = true } = props;
|
|
1262
|
-
const seriesLimit = _nullishCoalesce(props.seriesLimit, () => (
|
|
1426
|
+
const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT));
|
|
1263
1427
|
const isSeriesLimitOverridden = props.seriesLimit !== void 0;
|
|
1264
1428
|
if (data.length === 0) {
|
|
1265
1429
|
return null;
|
|
@@ -1350,9 +1514,9 @@ var VerticalBarChartWithData = _react.memo.call(void 0,
|
|
|
1350
1514
|
const { colors, patterns } = data.reduce(
|
|
1351
1515
|
(acc, item, index) => {
|
|
1352
1516
|
acc.colors.push(
|
|
1353
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'access',
|
|
1517
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'access', _66 => _66.styles, 'optionalAccess', _67 => _67.color]), () => ( _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index])), () => ( ""))
|
|
1354
1518
|
);
|
|
1355
|
-
acc.patterns.push(_nullishCoalesce(_optionalChain([item, 'access',
|
|
1519
|
+
acc.patterns.push(_nullishCoalesce(_optionalChain([item, 'access', _68 => _68.styles, 'optionalAccess', _69 => _69.pattern]), () => ( "solid")));
|
|
1356
1520
|
return acc;
|
|
1357
1521
|
},
|
|
1358
1522
|
{
|
|
@@ -1377,11 +1541,11 @@ var VerticalBarChartWithData = _react.memo.call(void 0,
|
|
|
1377
1541
|
callback
|
|
1378
1542
|
}
|
|
1379
1543
|
),
|
|
1380
|
-
chart && _optionalChain([chart, 'access',
|
|
1544
|
+
chart && _optionalChain([chart, 'access', _70 => _70.annotations, 'optionalAccess', _71 => _71.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1381
1545
|
ChartXAnnotationMarkerPortal,
|
|
1382
1546
|
{
|
|
1383
1547
|
xAnnotations,
|
|
1384
|
-
annotationContext: _optionalChain([chart, 'access',
|
|
1548
|
+
annotationContext: _optionalChain([chart, 'access', _72 => _72.annotations, 'optionalAccess', _73 => _73[0]]),
|
|
1385
1549
|
chartContainer: chart.container
|
|
1386
1550
|
}
|
|
1387
1551
|
) : null,
|
|
@@ -1395,7 +1559,7 @@ var VerticalBarChartWithData = _react.memo.call(void 0,
|
|
|
1395
1559
|
data
|
|
1396
1560
|
});
|
|
1397
1561
|
const x = context.x;
|
|
1398
|
-
const xAnnotationDetails = typeof x === "number" ? _optionalChain([xAnnotations, 'optionalAccess',
|
|
1562
|
+
const xAnnotationDetails = typeof x === "number" ? _optionalChain([xAnnotations, 'optionalAccess', _74 => _74[x], 'optionalAccess', _75 => _75.details]) : void 0;
|
|
1399
1563
|
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1400
1564
|
VerticalBarChartTooltip,
|
|
1401
1565
|
{
|
|
@@ -1471,5 +1635,5 @@ var VerticalBarChartWithData = _react.memo.call(void 0,
|
|
|
1471
1635
|
|
|
1472
1636
|
|
|
1473
1637
|
|
|
1474
|
-
exports.AreaChart = AreaChart; exports.ChartLegend = _chunkEEVKTTT3js.ChartLegend; exports.ChartLegendLabel = _chunkEEVKTTT3js.ChartLegendLabel; exports.ChartTable = _chunkEEVKTTT3js.ChartTable; exports.ChartTooltip = _chunkEEVKTTT3js.ChartTooltip; exports.ChartTooltipFooter = _chunkEEVKTTT3js.ChartTooltipFooter; exports.ChartTooltipHeader = _chunkEEVKTTT3js.ChartTooltipHeader; exports.ChartTooltipPortal = _chunkEEVKTTT3js.ChartTooltipPortal; exports.ChartTooltipTable = _chunkEEVKTTT3js.ChartTooltipTable; exports.ChartTooltipTitle = _chunkEEVKTTT3js.ChartTooltipTitle; exports.ChartXAnnotationDetails = ChartXAnnotationDetails; exports.ChartXAnnotationMarker = ChartXAnnotationMarker; exports.ColorBox = _chunkEEVKTTT3js.ColorBox; exports.DONUT_CHART_HALO_SIZE =
|
|
1638
|
+
exports.AreaChart = AreaChart; exports.ChartLegend = _chunkEEVKTTT3js.ChartLegend; exports.ChartLegendLabel = _chunkEEVKTTT3js.ChartLegendLabel; exports.ChartTable = _chunkEEVKTTT3js.ChartTable; exports.ChartTooltip = _chunkEEVKTTT3js.ChartTooltip; exports.ChartTooltipFooter = _chunkEEVKTTT3js.ChartTooltipFooter; exports.ChartTooltipHeader = _chunkEEVKTTT3js.ChartTooltipHeader; exports.ChartTooltipPortal = _chunkEEVKTTT3js.ChartTooltipPortal; exports.ChartTooltipTable = _chunkEEVKTTT3js.ChartTooltipTable; exports.ChartTooltipTitle = _chunkEEVKTTT3js.ChartTooltipTitle; exports.ChartXAnnotationDetails = ChartXAnnotationDetails; exports.ChartXAnnotationMarker = ChartXAnnotationMarker; exports.ColorBox = _chunkEEVKTTT3js.ColorBox; exports.DONUT_CHART_HALO_SIZE = DONUT_CHART_HALO_SIZE; exports.DONUT_CHART_HEIGHT = DONUT_CHART_HEIGHT; exports.DONUT_CHART_WIDTH = DONUT_CHART_WIDTH; exports.DatavizColorBox = _chunkEEVKTTT3js.DatavizColorBox; exports.DonutChart = DonutChart; exports.DonutChartLegendTable = DonutChartLegendTable; exports.GlobalChartStyleOverrides = _chunkEEVKTTT3js.GlobalChartStyleOverrides; exports.LineChart = LineChart; exports.NetworkColorBox = _chunkEEVKTTT3js.NetworkColorBox; exports.TIME_SERIES_CHART_HEIGHT = TIME_SERIES_CHART_HEIGHT; exports.VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT; exports.VerticalBarChart = VerticalBarChart; exports.areaChartOptions = areaChartOptions; exports.areaChartStyles = _chunkEEVKTTT3js.areaChartStyles; exports.baseChartOptions = baseChartOptions; exports.baseChartStyles = _chunkEEVKTTT3js.baseChartStyles; exports.columnChartOptions = columnChartOptions; exports.donutChartOptions = donutChartOptions; exports.donutChartStyles = _chunkEEVKTTT3js.donutChartStyles; exports.generateChartTooltipPortalId = _chunkEEVKTTT3js.generateChartTooltipPortalId; exports.getDatavizColor = _chunkEEVKTTT3js.getDatavizColor; exports.getDatavizColorWithAlpha = _chunkEEVKTTT3js.getDatavizColorWithAlpha; exports.getDatavizOpacity = _chunkEEVKTTT3js.getDatavizOpacity; exports.getStorybookCategoricalData = _chunkEEVKTTT3js.getStorybookCategoricalData; exports.getStorybookSparseTimelineData = _chunkEEVKTTT3js.getStorybookSparseTimelineData; exports.isCategoricalHourData = _chunkEEVKTTT3js.isCategoricalHourData; exports.isHourlyTimeData = _chunkEEVKTTT3js.isHourlyTimeData; exports.lineChartOptions = lineChartOptions; exports.lineChartStyles = _chunkEEVKTTT3js.lineChartStyles; exports.timeSeriesChartOptions = timeSeriesChartOptions; exports.timeSeriesChartStyles = _chunkEEVKTTT3js.timeSeriesChartStyles; exports.transformDataToSeries = _chunkEEVKTTT3js.transformDataToSeries; exports.transformTimeSeriesTooltipData = _chunkEEVKTTT3js.transformTimeSeriesTooltipData; exports.xAxisLabelFormatter = _chunkEEVKTTT3js.xAxisLabelFormatter; exports.yAxisLabelFormatter = _chunkEEVKTTT3js.yAxisLabelFormatter;
|
|
1475
1639
|
//# sourceMappingURL=index.js.map
|