@redsift/charts 12.6.6-alpha.2 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { _ as _objectWithoutProperties, a as _extends, b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
- import React__default, { forwardRef, useRef, createContext, useContext, useEffect, useMemo } from 'react';
2
+ import React, { forwardRef, useRef, createContext, useContext, useEffect, useMemo } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { useTheme, useMessageFormatter, Flexbox, Text, Number as Number$1, isComponent, RedsiftColorGreenD1, RedsiftColorRedD1, RedsiftColorNeutralBlack, useId } from '@redsift/design-system';
5
5
  import { scaleLinear, sum, scaleBand, scaleOrdinal, extent, scaleUtc, scalePoint, utcParse, scaleLog } from 'd3';
@@ -184,23 +184,23 @@ const EmptyBarChart = /*#__PURE__*/forwardRef((props, ref) => {
184
184
  };
185
185
  const chartHeight = height - margins.top - margins.bottom;
186
186
  const chartWidth = width - margins.left - margins.right;
187
- const scaleRef = useRef();
187
+ const scaleRef = useRef(undefined);
188
188
  if (!scaleRef.current) {
189
189
  scaleRef.current = scaleLinear().domain([]).range([0, chartWidth]);
190
190
  }
191
- return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
191
+ return /*#__PURE__*/React.createElement(StyledBarChart, _extends({}, forwardedProps, {
192
192
  className: className,
193
193
  ref: ref
194
- }), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledBarChartEmptyText, {
194
+ }), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledBarChartEmptyText, {
195
195
  $maxWidth: width,
196
196
  $textSize: chartDimensions.fontSize / 2,
197
197
  $theme: theme
198
- }, /*#__PURE__*/React__default.createElement("span", null, localeText === null || localeText === void 0 ? void 0 : localeText.emptyChartText)), /*#__PURE__*/React__default.createElement("svg", {
198
+ }, /*#__PURE__*/React.createElement("span", null, localeText === null || localeText === void 0 ? void 0 : localeText.emptyChartText)), /*#__PURE__*/React.createElement("svg", {
199
199
  width: width,
200
200
  height: height
201
- }, /*#__PURE__*/React__default.createElement("g", {
201
+ }, /*#__PURE__*/React.createElement("g", {
202
202
  transform: `translate(${margins.left},${margins.top})`
203
- }, /*#__PURE__*/React__default.createElement(Axis, {
203
+ }, /*#__PURE__*/React.createElement(Axis, {
204
204
  position: "bottom",
205
205
  length: chartWidth,
206
206
  scale: scaleRef.current,
@@ -216,7 +216,7 @@ const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
216
216
  className
217
217
  } = props,
218
218
  forwardedProps = _objectWithoutProperties(props, _excluded$6);
219
- return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
219
+ return /*#__PURE__*/React.createElement(StyledBarChart, _extends({}, forwardedProps, {
220
220
  className: className,
221
221
  ref: ref
222
222
  }), "Loading...");
@@ -270,7 +270,7 @@ function useBarChartContext() {
270
270
  return context;
271
271
  }
272
272
 
273
- const ChartTypeContext = /*#__PURE__*/React__default.createContext(undefined);
273
+ const ChartTypeContext = /*#__PURE__*/React.createContext(undefined);
274
274
 
275
275
  const _excluded$5 = ["areXLabelsRotated", "barProps", "caping", "className", "data", "dataType", "direction", "disableAnimations", "emptyComponent", "id", "isBarSelected", "getBarAnchorProps", "labelDecorator", "legendDecorator", "legendProps", "legendVariant", "localeText", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
276
276
  const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
@@ -327,7 +327,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
327
327
  yAxisTickValues
328
328
  } = props,
329
329
  forwardedProps = _objectWithoutProperties(props, _excluded$5);
330
- const cache = useRef();
330
+ const cache = useRef(undefined);
331
331
  const theme = useTheme();
332
332
  const format = useMessageFormatter(intlMessages);
333
333
  const {
@@ -375,11 +375,11 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
375
375
  }))]).range(isHorizontal ? [0, chartWidth] : [chartHeight, 0]), [data, size, isHorizontal]);
376
376
  const scaleCategory = useMemo(() => scaleBand().domain(visibleData.map(datum => datum.key)).range([0, isHorizontal ? chartHeight : chartWidth]), [data, size, isSelectionMode, isHorizontal]);
377
377
  const bars = visibleData;
378
- return /*#__PURE__*/React__default.createElement(ChartTypeContext.Provider, {
378
+ return /*#__PURE__*/React.createElement(ChartTypeContext.Provider, {
379
379
  value: "bar"
380
- }, /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
380
+ }, /*#__PURE__*/React.createElement(BarChartContext.Provider, {
381
381
  value: {}
382
- }, /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
382
+ }, /*#__PURE__*/React.createElement(StyledBarChart, _extends({
383
383
  mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
384
384
  definition: format('definition-ordinal', {
385
385
  barLength: bars.length
@@ -399,29 +399,28 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
399
399
  end: scale.domain()[1]
400
400
  }),
401
401
  dataTableRepresentation: {
402
- header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
402
+ header: /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
403
403
  scope: "col"
404
- }, "Key"), /*#__PURE__*/React__default.createElement("th", {
404
+ }, "Key"), /*#__PURE__*/React.createElement("th", {
405
405
  scope: "col"
406
406
  }, "Value"))),
407
- body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => /*#__PURE__*/React__default.createElement("tr", {
407
+ body: /*#__PURE__*/React.createElement("tbody", null, bars.map(datum => /*#__PURE__*/React.createElement("tr", {
408
408
  key: datum.key
409
- }, /*#__PURE__*/React__default.createElement("th", {
409
+ }, /*#__PURE__*/React.createElement("th", {
410
410
  scope: "row"
411
- }, datum.key), /*#__PURE__*/React__default.createElement("td", null, datum.value))))
411
+ }, datum.key), /*#__PURE__*/React.createElement("td", null, datum.value))))
412
412
  }
413
413
  }, forwardedProps, {
414
414
  id: id,
415
415
  className: className,
416
416
  ref: ref
417
- }), /*#__PURE__*/React__default.createElement("svg", {
417
+ }), /*#__PURE__*/React.createElement("svg", {
418
418
  width: width,
419
419
  height: height,
420
- "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
421
- "aria-hidden": "false"
422
- }, /*#__PURE__*/React__default.createElement("g", {
420
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart')
421
+ }, /*#__PURE__*/React.createElement("g", {
423
422
  transform: `translate(${margins.left},${margins.top})`
424
- }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
423
+ }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
425
424
  disableAnimations: disableAnimations,
426
425
  position: "bottom",
427
426
  length: chartWidth,
@@ -434,7 +433,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
434
433
  tickSize: xAxisTickSize,
435
434
  tickFormat: xAxisTickFormat,
436
435
  variant: xAxisVariant
437
- }) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
436
+ }) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
438
437
  disableAnimations: disableAnimations,
439
438
  position: "top",
440
439
  length: chartWidth,
@@ -447,7 +446,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
447
446
  tickSize: xAxisTickSize,
448
447
  tickFormat: xAxisTickFormat,
449
448
  variant: xAxisVariant
450
- }) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
449
+ }) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
451
450
  disableAnimations: disableAnimations,
452
451
  position: "left",
453
452
  length: chartHeight,
@@ -460,7 +459,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
460
459
  tickSize: yAxisTickSize,
461
460
  tickFormat: yAxisTickFormat,
462
461
  variant: yAxisVariant
463
- }) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
462
+ }) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
464
463
  disableAnimations: disableAnimations,
465
464
  position: "right",
466
465
  length: chartHeight,
@@ -473,7 +472,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
473
472
  tickSize: yAxisTickSize,
474
473
  tickFormat: yAxisTickFormat,
475
474
  variant: yAxisVariant
476
- }) : null), /*#__PURE__*/React__default.createElement("g", {
475
+ }) : null), /*#__PURE__*/React.createElement("g", {
477
476
  transform: `translate(${margins.left},${margins.top})`
478
477
  }, bars.map((datum, index) => {
479
478
  const percent = datum.value / total;
@@ -485,7 +484,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
485
484
  const from = cache.current ? {
486
485
  data: cache.current[index]
487
486
  } : undefined;
488
- return /*#__PURE__*/React__default.createElement(Bar, _extends({
487
+ return /*#__PURE__*/React.createElement(Bar, _extends({
489
488
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
490
489
  data: to,
491
490
  dataset: bars,
@@ -548,9 +547,8 @@ const BarChartBars = /*#__PURE__*/forwardRef((props, ref) => {
548
547
  const filteredBarChartBars = bars.filter(bar => bar.category === category && bar.value > 0);
549
548
  const categoryIndex = categories.indexOf(category);
550
549
  const categoryLength = categories.length;
551
- return /*#__PURE__*/React__default.createElement(StyledBarChartBars, _extends({
550
+ return /*#__PURE__*/React.createElement(StyledBarChartBars, _extends({
552
551
  key: `${id}-series-${category}`,
553
- "aria-hidden": "false",
554
552
  role: "region"
555
553
  }, hasCategory ? {
556
554
  'aria-label': format('series-legend', {
@@ -576,7 +574,7 @@ const BarChartBars = /*#__PURE__*/forwardRef((props, ref) => {
576
574
  const groupedBars = bars.filter(b => {
577
575
  return xScaleType === 'Date' || xScaleType === 'dateString' ? b.key.getTime() === bar.key.getTime() : b.key === bar.key;
578
576
  });
579
- return [/*#__PURE__*/React__default.createElement(Bar, _extends({
577
+ return [/*#__PURE__*/React.createElement(Bar, _extends({
580
578
  color: region && region.colorTheme ? (_d3scaleOrdinal$domai = scaleOrdinal().domain(Object.keys(region.colorTheme)).range(Object.values(region.colorTheme))) === null || _d3scaleOrdinal$domai === void 0 ? void 0 : _d3scaleOrdinal$domai(to.data.category) : colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
581
579
  data: to,
582
580
  dataset: bars,
@@ -625,34 +623,34 @@ const BarChartGroupedTooltip = _ref => {
625
623
  var _groupedData$find$val, _groupedData$find;
626
624
  return ((_groupedData$find$val = groupedData === null || groupedData === void 0 ? void 0 : (_groupedData$find = groupedData.find(d => d.category === category)) === null || _groupedData$find === void 0 ? void 0 : _groupedData$find.value) !== null && _groupedData$find$val !== void 0 ? _groupedData$find$val : 0) > 0;
627
625
  });
628
- return /*#__PURE__*/React__default.createElement(Flexbox, {
626
+ return /*#__PURE__*/React.createElement(Flexbox, {
629
627
  flexDirection: "column",
630
628
  margin: "16px",
631
629
  gap: "0"
632
- }, /*#__PURE__*/React__default.createElement(Flexbox, {
630
+ }, /*#__PURE__*/React.createElement(Flexbox, {
633
631
  flexDirection: "row",
634
632
  gap: "8px"
635
- }, /*#__PURE__*/React__default.createElement(Text, {
633
+ }, /*#__PURE__*/React.createElement(Text, {
636
634
  fontWeight: "700",
637
635
  fontSize: "14px"
638
- }, dateFormatter(datum.data.key))), /*#__PURE__*/React__default.createElement("div", {
636
+ }, dateFormatter(datum.data.key))), /*#__PURE__*/React.createElement("div", {
639
637
  style: {
640
638
  width: '100%',
641
639
  height: '1px',
642
640
  backgroundColor: '#858585',
643
641
  margin: '8px 0'
644
642
  }
645
- }), /*#__PURE__*/React__default.createElement(Flexbox, {
643
+ }), /*#__PURE__*/React.createElement(Flexbox, {
646
644
  flexDirection: "row",
647
645
  gap: "8px"
648
- }, /*#__PURE__*/React__default.createElement(Text, {
646
+ }, /*#__PURE__*/React.createElement(Text, {
649
647
  fontWeight: "400",
650
648
  fontSize: "14px"
651
- }, format('total')), /*#__PURE__*/React__default.createElement(Number$1, {
649
+ }, format('total')), /*#__PURE__*/React.createElement(Number$1, {
652
650
  fontWeight: "600",
653
651
  fontSize: "14px",
654
652
  value: (_groupedData$reduce = groupedData === null || groupedData === void 0 ? void 0 : groupedData.reduce((acc, d) => acc + d.value, 0)) !== null && _groupedData$reduce !== void 0 ? _groupedData$reduce : 0
655
- })), categoriesWithValue.length > 0 ? /*#__PURE__*/React__default.createElement(Flexbox, {
653
+ })), categoriesWithValue.length > 0 ? /*#__PURE__*/React.createElement(Flexbox, {
656
654
  flexDirection: "column",
657
655
  gap: "8px",
658
656
  margin: "4px 0"
@@ -660,21 +658,21 @@ const BarChartGroupedTooltip = _ref => {
660
658
  var _groupedData$find2;
661
659
  const value = groupedData === null || groupedData === void 0 ? void 0 : (_groupedData$find2 = groupedData.find(d => d.category === category)) === null || _groupedData$find2 === void 0 ? void 0 : _groupedData$find2.value;
662
660
  const color = categoryColor(category);
663
- return value ? /*#__PURE__*/React__default.createElement(Flexbox, {
661
+ return value ? /*#__PURE__*/React.createElement(Flexbox, {
664
662
  key: category,
665
663
  alignItems: "center",
666
664
  gap: "8px"
667
- }, /*#__PURE__*/React__default.createElement("div", {
665
+ }, /*#__PURE__*/React.createElement("div", {
668
666
  style: {
669
667
  width: '16px',
670
668
  height: '16px',
671
669
  backgroundColor: color
672
670
  }
673
- }), /*#__PURE__*/React__default.createElement(Text, {
671
+ }), /*#__PURE__*/React.createElement(Text, {
674
672
  fontWeight: "400",
675
673
  fontSize: "14px",
676
674
  lineHeight: "18px"
677
- }, categoryDecorator ? categoryDecorator(category) : category), /*#__PURE__*/React__default.createElement(Number$1, {
675
+ }, categoryDecorator ? categoryDecorator(category) : category), /*#__PURE__*/React.createElement(Number$1, {
678
676
  fontWeight: "600",
679
677
  fontSize: "14px",
680
678
  lineHeight: "18px",
@@ -694,7 +692,7 @@ const COMPONENT_TYPES = {
694
692
  };
695
693
  const getComponentPosition = child => {
696
694
  var _child$type;
697
- if (! /*#__PURE__*/React__default.isValidElement(child)) return null;
695
+ if (! /*#__PURE__*/React.isValidElement(child)) return null;
698
696
  const displayName = (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName;
699
697
  if (COMPONENT_TYPES.AXES === displayName) return 'axes';
700
698
  if (COMPONENT_TYPES.SECTIONS === displayName) return 'sections';
@@ -768,15 +766,15 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
768
766
  dateParser
769
767
  } = props,
770
768
  forwardedProps = _objectWithoutProperties(props, _excluded$3);
771
- const cache = useRef();
769
+ const cache = useRef(undefined);
772
770
  const theme = useTheme();
773
771
  const format = useMessageFormatter(intlMessages);
774
772
  const hasCategory = propsData[0] && Array.isArray(propsData[0].key) && propsData[0].key.length >= 2 && propsData[0].key[1] !== null && propsData[0].key[1] !== undefined;
775
773
  const sections = useMemo(() => {
776
774
  const sectionList = [];
777
- React__default.Children.forEach(children, child => {
775
+ React.Children.forEach(children, child => {
778
776
  if (isComponent('BarChartSection')(child)) {
779
- const categories = React__default.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
777
+ const categories = React.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
780
778
  sectionList.push(categories);
781
779
  }
782
780
  });
@@ -789,7 +787,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
789
787
  useEffect(() => {
790
788
  cache.current = data;
791
789
  });
792
- const svgRef = useRef();
790
+ const svgRef = useRef(undefined);
793
791
  const xAxisVariant = propsXAxisVariant ? propsXAxisVariant : AxisVariant.tickValue;
794
792
  const yAxisVariant = propsYAxisVariant ? propsYAxisVariant : AxisVariant.default;
795
793
  const chartDimensions = sizeToDimension(size);
@@ -950,7 +948,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
950
948
  let titleComponent;
951
949
  let descriptionComponent;
952
950
  const multipleScaleY = [];
953
- React__default.Children.forEach(children, (child, index) => {
951
+ React.Children.forEach(children, (child, index) => {
954
952
  const position = getComponentPosition(child);
955
953
  if (isComponent('ChartContainerTitle')(child)) {
956
954
  titleComponent = child;
@@ -958,13 +956,13 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
958
956
  if (isComponent('ChartContainerDescription')(child)) {
959
957
  descriptionComponent = child;
960
958
  }
961
- if (!position || ! /*#__PURE__*/React__default.isValidElement(child)) return;
959
+ if (!position || ! /*#__PURE__*/React.isValidElement(child)) return;
962
960
  let enhancedChild = child;
963
961
  if (isComponent('BarChartSection')(child)) {
964
- const categories = React__default.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
962
+ const categories = React.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
965
963
  const scaleY = getScaleY(child.props.direction || 'up', child.props.from, child.props.to, categories, child.props.title !== '');
966
964
  multipleScaleY.push(scaleY);
967
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
965
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
968
966
  scaleX: scaleX,
969
967
  scaleY: scaleY,
970
968
  key: child.key || `section-${child.props.from}-${child.props.to}-${categories.join('-')}`
@@ -973,7 +971,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
973
971
  if (isComponent('Axis')(child)) {
974
972
  var _ref10;
975
973
  const isX = getAxisType(child.props.position) === 'x';
976
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
974
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
977
975
  key: child.key || `axis-${child.props.position}-${index}`,
978
976
  chartWidth,
979
977
  chartHeight,
@@ -992,14 +990,14 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
992
990
  }, child.props));
993
991
  }
994
992
  if (isComponent('BarChartOverlay')(child)) {
995
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
993
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
996
994
  key: child.key || `overlay-${0}-${1}`,
997
995
  from: 0,
998
996
  to: 1
999
997
  }, child.props));
1000
998
  }
1001
999
  if (isComponent('Legend')(child)) {
1002
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
1000
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
1003
1001
  key: child.key || `legend-${index}`,
1004
1002
  data: (extraLegendItems ? mergeLegends(extraLegendItems, statsByCategory).sort(getSortingMethod(sortingMethod)) : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
1005
1003
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
@@ -1035,9 +1033,9 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1035
1033
  multipleScaleY
1036
1034
  };
1037
1035
  }, [children]);
1038
- return /*#__PURE__*/React__default.createElement(ChartTypeContext.Provider, {
1036
+ return /*#__PURE__*/React.createElement(ChartTypeContext.Provider, {
1039
1037
  value: "bar"
1040
- }, /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
1038
+ }, /*#__PURE__*/React.createElement(BarChartContext.Provider, {
1041
1039
  value: {
1042
1040
  barProps,
1043
1041
  barRole,
@@ -1079,7 +1077,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1079
1077
  yAxisTickRemodelling,
1080
1078
  yAxisVariant
1081
1079
  }
1082
- }, /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
1080
+ }, /*#__PURE__*/React.createElement(StyledBarChart, _extends({
1083
1081
  mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
1084
1082
  definition: hasCategory ? format('definition-linear-with-categories', {
1085
1083
  categoryLength: categories.length,
@@ -1102,34 +1100,34 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1102
1100
  end: scaleY.domain()[1]
1103
1101
  }),
1104
1102
  dataTableRepresentation: hasCategory ? {
1105
- header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
1103
+ header: /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
1106
1104
  scope: "col"
1107
- }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
1105
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React.createElement("th", {
1108
1106
  key: category,
1109
1107
  scope: "col"
1110
1108
  }, category)))),
1111
- body: /*#__PURE__*/React__default.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React__default.createElement("tr", {
1109
+ body: /*#__PURE__*/React.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React.createElement("tr", {
1112
1110
  key: row.key
1113
- }, /*#__PURE__*/React__default.createElement("th", {
1111
+ }, /*#__PURE__*/React.createElement("th", {
1114
1112
  scope: "row"
1115
- }, row.key), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
1113
+ }, row.key), categories.map(category => /*#__PURE__*/React.createElement("th", {
1116
1114
  key: `${row.key}-${category}-${row[category]}`,
1117
1115
  scope: "col"
1118
1116
  }, row[category])))))
1119
1117
  } : {
1120
- header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
1118
+ header: /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
1121
1119
  scope: "col"
1122
- }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React__default.createElement("th", {
1120
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React.createElement("th", {
1123
1121
  scope: "col"
1124
1122
  }, "Value"))),
1125
- body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => {
1123
+ body: /*#__PURE__*/React.createElement("tbody", null, bars.map(datum => {
1126
1124
  let key = xAxisTickFormat ? xAxisTickFormat(datum.key) : datum.key.toString();
1127
1125
  key = Array.isArray(key) ? key.join(' ') : key;
1128
- return /*#__PURE__*/React__default.createElement("tr", {
1126
+ return /*#__PURE__*/React.createElement("tr", {
1129
1127
  key: key
1130
- }, /*#__PURE__*/React__default.createElement("th", {
1128
+ }, /*#__PURE__*/React.createElement("th", {
1131
1129
  scope: "row"
1132
- }, key), /*#__PURE__*/React__default.createElement("td", null, datum.value));
1130
+ }, key), /*#__PURE__*/React.createElement("td", null, datum.value));
1133
1131
  }))
1134
1132
  },
1135
1133
  title: titleComponent,
@@ -1138,20 +1136,19 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1138
1136
  id: id,
1139
1137
  className: className,
1140
1138
  ref: ref
1141
- }), /*#__PURE__*/React__default.createElement(Flexbox, {
1139
+ }), /*#__PURE__*/React.createElement(Flexbox, {
1142
1140
  flexDirection: "column",
1143
1141
  alignItems: "center",
1144
1142
  gap: "8"
1145
- }, /*#__PURE__*/React__default.createElement("svg", {
1143
+ }, /*#__PURE__*/React.createElement("svg", {
1146
1144
  ref: svgRef,
1147
1145
  width: width,
1148
1146
  height: height,
1149
- "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
1150
- "aria-hidden": "false"
1151
- }, axisComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React__default.createElement("g", {
1147
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart')
1148
+ }, axisComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React.createElement("g", {
1152
1149
  transform: `translate(${margins.left},${margins.top})`,
1153
1150
  "aria-hidden": "true"
1154
- }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
1151
+ }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
1155
1152
  disableAnimations: disableAnimations,
1156
1153
  position: "bottom",
1157
1154
  length: chartWidth,
@@ -1165,7 +1162,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1165
1162
  tickFormat: xAxisTickFormat,
1166
1163
  tickRemodelling: xAxisTickRemodelling,
1167
1164
  variant: xAxisVariant
1168
- }) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
1165
+ }) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
1169
1166
  disableAnimations: disableAnimations,
1170
1167
  position: "top",
1171
1168
  length: chartWidth,
@@ -1179,7 +1176,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1179
1176
  tickFormat: xAxisTickFormat,
1180
1177
  tickRemodelling: xAxisTickRemodelling,
1181
1178
  variant: xAxisVariant
1182
- }) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
1179
+ }) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
1183
1180
  disableAnimations: disableAnimations,
1184
1181
  position: "left",
1185
1182
  length: chartHeight,
@@ -1193,7 +1190,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1193
1190
  tickFormat: yAxisTickFormat,
1194
1191
  tickRemodelling: yAxisTickRemodelling,
1195
1192
  variant: yAxisVariant
1196
- }) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
1193
+ }) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
1197
1194
  disableAnimations: disableAnimations,
1198
1195
  position: "right",
1199
1196
  length: chartHeight,
@@ -1207,19 +1204,19 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1207
1204
  tickFormat: yAxisTickFormat,
1208
1205
  tickRemodelling: yAxisTickRemodelling,
1209
1206
  variant: yAxisVariant
1210
- }) : null) : /*#__PURE__*/React__default.createElement("g", {
1207
+ }) : null) : /*#__PURE__*/React.createElement("g", {
1211
1208
  transform: `translate(${margins.left},${margins.top})`,
1212
1209
  "aria-hidden": "true"
1213
- }, axisComponents), sectionComponents, overlayComponents, barsComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React__default.createElement("g", {
1210
+ }, axisComponents), sectionComponents, overlayComponents, barsComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React.createElement("g", {
1214
1211
  transform: `translate(${margins.left},${margins.top})`,
1215
1212
  "aria-hidden": "true"
1216
- }, (hasSections ? sections : [categories]).map(section => section.map(category => /*#__PURE__*/React__default.createElement(BarChartBars, {
1213
+ }, (hasSections ? sections : [categories]).map(section => section.map(category => /*#__PURE__*/React.createElement(BarChartBars, {
1217
1214
  key: category,
1218
1215
  category: category
1219
- }))), ' ') : /*#__PURE__*/React__default.createElement("g", {
1216
+ }))), ' ') : /*#__PURE__*/React.createElement("g", {
1220
1217
  transform: `translate(${margins.left},${margins.top})`,
1221
1218
  "aria-hidden": "true"
1222
- }, barsComponents))), legendComponents.length === 0 && hasCategory && legendVariant !== BarChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
1219
+ }, barsComponents))), legendComponents.length === 0 && hasCategory && legendVariant !== BarChartLegendVariant.none ? /*#__PURE__*/React.createElement(Legend, _extends({
1223
1220
  data: (extraLegendItems ? mergeLegends(extraLegendItems, statsByCategory).sort(getSortingMethod(sortingMethod)) : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
1224
1221
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
1225
1222
  })),
@@ -1296,13 +1293,13 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1296
1293
  const titleAnchor = titlePosition === 'center' ? 'middle' : titlePosition === 'right' ? 'end' : 'start';
1297
1294
  const children = useMemo(() => {
1298
1295
  const renderedChildren = [];
1299
- React__default.Children.forEach(propsChildren, child => {
1300
- if (! /*#__PURE__*/React__default.isValidElement(child)) return;
1296
+ React.Children.forEach(propsChildren, child => {
1297
+ if (! /*#__PURE__*/React.isValidElement(child)) return;
1301
1298
  const isX = getAxisType(child.props.position) === 'x';
1302
1299
  let enhancedChild = child;
1303
1300
  if (isComponent('Axis')(child)) {
1304
1301
  var _ref;
1305
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
1302
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
1306
1303
  key: child.key || `axis-${from}-${to}-${child.props.position}`,
1307
1304
  chartWidth,
1308
1305
  chartHeight,
@@ -1324,7 +1321,7 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1324
1321
  }, child.props));
1325
1322
  }
1326
1323
  if (isComponent('BarChartOverlay')(child)) {
1327
- enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
1324
+ enhancedChild = /*#__PURE__*/React.cloneElement(child, _objectSpread2({
1328
1325
  key: child.key || `overlay-${from}-${to}`,
1329
1326
  from,
1330
1327
  to
@@ -1334,7 +1331,7 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1334
1331
  });
1335
1332
  return renderedChildren;
1336
1333
  }, [propsChildren]);
1337
- return /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
1334
+ return /*#__PURE__*/React.createElement(BarChartContext.Provider, {
1338
1335
  value: _objectSpread2(_objectSpread2({}, context), {}, {
1339
1336
  scaleX: scaleX,
1340
1337
  scaleY: scaleY,
@@ -1342,13 +1339,13 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1342
1339
  sectionHeight,
1343
1340
  regions
1344
1341
  })
1345
- }, /*#__PURE__*/React__default.createElement(StyledBarChartSection, _extends({}, forwardedProps, {
1342
+ }, /*#__PURE__*/React.createElement(StyledBarChartSection, _extends({}, forwardedProps, {
1346
1343
  className: classNames(BarChartSection.className, className),
1347
1344
  transform: `translate(${margins.left},${(margins.top || 0) + sectionY})`,
1348
1345
  ref: ref,
1349
1346
  $theme: theme,
1350
1347
  $textColor: textColor
1351
- }), backgroundColor ? /*#__PURE__*/React__default.createElement("rect", {
1348
+ }), backgroundColor ? /*#__PURE__*/React.createElement("rect", {
1352
1349
  x: 0,
1353
1350
  y: 0,
1354
1351
  width: chartWidth,
@@ -1371,7 +1368,7 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1371
1368
  }
1372
1369
  const x = Math.min(regionFrom, regionTo);
1373
1370
  const width = Math.abs(regionTo - regionFrom);
1374
- return /*#__PURE__*/React__default.createElement("rect", {
1371
+ return /*#__PURE__*/React.createElement("rect", {
1375
1372
  key: `region-${index}`,
1376
1373
  x: x,
1377
1374
  y: 0,
@@ -1380,7 +1377,7 @@ const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
1380
1377
  fill: region.backgroundColor || 'transparent',
1381
1378
  opacity: region.backgroundOpacity || 0.05
1382
1379
  });
1383
- }) : null, title && /*#__PURE__*/React__default.createElement("text", {
1380
+ }) : null, title && /*#__PURE__*/React.createElement("text", {
1384
1381
  className: "title colored",
1385
1382
  x: titleX,
1386
1383
  y: direction === 'up' ? 8 : direction === 'down' ? sectionHeight - 8 : sectionHeight / 2,
@@ -1425,9 +1422,8 @@ const BarChartOverlay = /*#__PURE__*/forwardRef((props, ref) => {
1425
1422
  const sectionHeight = Math.max(0, Math.min(1, to - from)) * chartHeight;
1426
1423
  const sectionY = Math.max(0, Math.min(1, from)) * chartHeight;
1427
1424
  const constantY = scaleLinear().domain(scaleY.domain()).range([sectionHeight, sectionHeight]);
1428
- return /*#__PURE__*/React__default.createElement(StyledBarChartOverlay, _extends({
1425
+ return /*#__PURE__*/React.createElement(StyledBarChartOverlay, _extends({
1429
1426
  key: `${id}-series-overlay`,
1430
- "aria-hidden": "false",
1431
1427
  role: "region"
1432
1428
  }, forwardedProps, {
1433
1429
  ref: ref,
@@ -1440,7 +1436,7 @@ const BarChartOverlay = /*#__PURE__*/forwardRef((props, ref) => {
1440
1436
  const groupedBars = bars.filter(b => {
1441
1437
  return xScaleType === 'Date' || xScaleType === 'dateString' ? b.key.getTime() === bar.key.getTime() : b.key === bar.key;
1442
1438
  });
1443
- return /*#__PURE__*/React__default.createElement(Bar, _extends({
1439
+ return /*#__PURE__*/React.createElement(Bar, _extends({
1444
1440
  color: "transparent",
1445
1441
  data: {
1446
1442
  data: bar
@@ -1581,14 +1577,14 @@ const BaseBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1581
1577
  const id = propsId !== null && propsId !== void 0 ? propsId : _id;
1582
1578
  const legendVariant = propsLegendVariant !== null && propsLegendVariant !== void 0 ? propsLegendVariant : BarChartLegendVariant.externalLabel;
1583
1579
  if (propsData === undefined || propsData === null) {
1584
- return /*#__PURE__*/React__default.createElement(LoadingBarChart, _extends({
1580
+ return /*#__PURE__*/React.createElement(LoadingBarChart, _extends({
1585
1581
  id: id
1586
1582
  }, forwardedProps, {
1587
1583
  ref: ref
1588
1584
  }));
1589
1585
  }
1590
1586
  if (propsData.length === 0) {
1591
- return /*#__PURE__*/React__default.createElement(EmptyBarChart, _extends({
1587
+ return /*#__PURE__*/React.createElement(EmptyBarChart, _extends({
1592
1588
  data: propsData,
1593
1589
  emptyComponent: emptyComponent,
1594
1590
  id: id,
@@ -1600,7 +1596,7 @@ const BaseBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1600
1596
  }
1601
1597
  const dataType = propsDataType ? propsDataType : Array.isArray(propsData[0].key) ? 'TwoCategoryData' : propsData[0].key instanceof Date ? 'LinearData' : typeof propsData[0].key === 'number' ? 'LinearData' : typeof propsData[0].key === 'string' && isValidDate(propsData[0].key) ? 'LinearData' : typeof propsData[0].key === 'string' ? 'CategoryData' : 'CategoryData';
1602
1598
  if (dataType === 'CategoryData') {
1603
- return /*#__PURE__*/React__default.createElement(RenderedOrdinalBarChart, _extends({
1599
+ return /*#__PURE__*/React.createElement(RenderedOrdinalBarChart, _extends({
1604
1600
  barProps: barProps,
1605
1601
  barRole: barRole,
1606
1602
  caping: caping,
@@ -1627,7 +1623,7 @@ const BaseBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1627
1623
  ref: ref
1628
1624
  }));
1629
1625
  } else if (dataType === 'LinearData' || dataType === 'TwoCategoryData') {
1630
- return /*#__PURE__*/React__default.createElement(RenderedLinearBarChart, _extends({
1626
+ return /*#__PURE__*/React.createElement(RenderedLinearBarChart, _extends({
1631
1627
  barProps: barProps,
1632
1628
  barRole: barRole,
1633
1629
  chartRef: chartRef,