@redsift/charts 10.2.0 → 10.3.0-alpha.10

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { brush, select, scaleOrdinal, zoom, interpolateRound, interpolate, scaleLinear, sum, scaleBand, extent, scaleTime, scalePoint, line, arc, pie, min, descending, scaleSqrt, max } from 'd3';
2
- import { RedsiftColorPresentationBlueDefault, RedsiftColorPresentationGreyDark, RedsiftColorPresentationAquaDefault, RedsiftColorPresentationPinkDefault, RedsiftColorPresentationGreyDefault, RedsiftColorPresentationYellowDefault, RedsiftColorPresentationPurpleDefault, RedsiftColorPresentationGreenDefault, RedsiftColorPresentationBrownDefault, RedsiftColorPresentationRedDefault, RedsiftColorPresentationOrangeDefault, RedsiftColorPresentationGreenDark, RedsiftColorPresentationPinkDark, RedsiftColorPresentationAquaDark, RedsiftColorPresentationBrownDark, RedsiftColorPresentationRedDark, RedsiftColorPresentationYellowDark, RedsiftColorPresentationPurpleDark, RedsiftColorPresentationOrangeDark, RedsiftColorPresentationBlueDark, RedsiftColorPresentationGreenDarker, RedsiftColorPresentationPinkDarker, RedsiftColorPresentationAquaDarker, RedsiftColorPresentationBrownDarker, RedsiftColorPresentationRedDarker, RedsiftColorPresentationYellowDarker, RedsiftColorPresentationPurpleDarker, RedsiftColorPresentationOrangeDarker, RedsiftColorPresentationBlueDarker, RedsiftColorPresentationGreyDarker, RedsiftColorPresentationGreenDarkerer, RedsiftColorPresentationPinkDarkerer, RedsiftColorPresentationAquaDarkerer, RedsiftColorPresentationBrownDarkerer, RedsiftColorPresentationRedDarkerer, RedsiftColorPresentationYellowDarkerer, RedsiftColorPresentationPurpleDarkerer, RedsiftColorPresentationOrangeDarkerer, RedsiftColorPresentationBlueDarkerer, RedsiftColorPresentationGreyDarkerer, RedsiftColorPresentationGreenLight, RedsiftColorPresentationPinkLight, RedsiftColorPresentationAquaLight, RedsiftColorPresentationBrownLight, RedsiftColorPresentationRedLight, RedsiftColorPresentationYellowLight, RedsiftColorPresentationPurpleLight, RedsiftColorPresentationOrangeLight, RedsiftColorPresentationBlueLight, RedsiftColorPresentationGreyLight, RedsiftColorPresentationGreenLighter, RedsiftColorPresentationPinkLighter, RedsiftColorPresentationAquaLighter, RedsiftColorPresentationBrownLighter, RedsiftColorPresentationRedLighter, RedsiftColorPresentationYellowLighter, RedsiftColorPresentationPurpleLighter, RedsiftColorPresentationOrangeLighter, RedsiftColorPresentationBlueLighter, RedsiftColorPresentationGreyLighter, RedsiftColorPresentationGreenLighterer, RedsiftColorPresentationPinkLighterer, RedsiftColorPresentationAquaLighterer, RedsiftColorPresentationBrownLighterer, RedsiftColorPresentationRedLighterer, RedsiftColorPresentationYellowLighterer, RedsiftColorPresentationPurpleLighterer, RedsiftColorPresentationOrangeLighterer, RedsiftColorPresentationBlueLighterer, RedsiftColorPresentationGreyLighterer, Theme, useId, useTheme, Text, Number as Number$1, baseStyling, baseContainer, focusRing, Flexbox, warnIfNoAccessibleLabelFound, useLocalizedStringFormatter, ThemeProvider, Heading, Button } from '@redsift/design-system';
2
+ import { RedsiftColorPresentationBlueDefault, RedsiftColorPresentationGreyDark, RedsiftColorPresentationAquaDefault, RedsiftColorPresentationPinkDefault, RedsiftColorPresentationGreyDefault, RedsiftColorPresentationYellowDefault, RedsiftColorPresentationPurpleDefault, RedsiftColorPresentationGreenDefault, RedsiftColorPresentationBrownDefault, RedsiftColorPresentationRedDefault, RedsiftColorPresentationOrangeDefault, RedsiftColorPresentationGreenDark, RedsiftColorPresentationPinkDark, RedsiftColorPresentationAquaDark, RedsiftColorPresentationBrownDark, RedsiftColorPresentationRedDark, RedsiftColorPresentationYellowDark, RedsiftColorPresentationPurpleDark, RedsiftColorPresentationOrangeDark, RedsiftColorPresentationBlueDark, RedsiftColorPresentationGreenDarker, RedsiftColorPresentationPinkDarker, RedsiftColorPresentationAquaDarker, RedsiftColorPresentationBrownDarker, RedsiftColorPresentationRedDarker, RedsiftColorPresentationYellowDarker, RedsiftColorPresentationPurpleDarker, RedsiftColorPresentationOrangeDarker, RedsiftColorPresentationBlueDarker, RedsiftColorPresentationGreyDarker, RedsiftColorPresentationGreenDarkerer, RedsiftColorPresentationPinkDarkerer, RedsiftColorPresentationAquaDarkerer, RedsiftColorPresentationBrownDarkerer, RedsiftColorPresentationRedDarkerer, RedsiftColorPresentationYellowDarkerer, RedsiftColorPresentationPurpleDarkerer, RedsiftColorPresentationOrangeDarkerer, RedsiftColorPresentationBlueDarkerer, RedsiftColorPresentationGreyDarkerer, RedsiftColorPresentationGreenLight, RedsiftColorPresentationPinkLight, RedsiftColorPresentationAquaLight, RedsiftColorPresentationBrownLight, RedsiftColorPresentationRedLight, RedsiftColorPresentationYellowLight, RedsiftColorPresentationPurpleLight, RedsiftColorPresentationOrangeLight, RedsiftColorPresentationBlueLight, RedsiftColorPresentationGreyLight, RedsiftColorPresentationGreenLighter, RedsiftColorPresentationPinkLighter, RedsiftColorPresentationAquaLighter, RedsiftColorPresentationBrownLighter, RedsiftColorPresentationRedLighter, RedsiftColorPresentationYellowLighter, RedsiftColorPresentationPurpleLighter, RedsiftColorPresentationOrangeLighter, RedsiftColorPresentationBlueLighter, RedsiftColorPresentationGreyLighter, RedsiftColorPresentationGreenLighterer, RedsiftColorPresentationPinkLighterer, RedsiftColorPresentationAquaLighterer, RedsiftColorPresentationBrownLighterer, RedsiftColorPresentationRedLighterer, RedsiftColorPresentationYellowLighterer, RedsiftColorPresentationPurpleLighterer, RedsiftColorPresentationOrangeLighterer, RedsiftColorPresentationBlueLighterer, RedsiftColorPresentationGreyLighterer, Theme, useId, useTheme, Text, Number as Number$1, baseStyling, baseContainer, focusRing, Flexbox, warnIfNoAccessibleLabelFound, useMessageFormatter, ThemeProvider, Heading, Button } from '@redsift/design-system';
3
3
  import * as React from 'react';
4
4
  import React__default, { useRef, useEffect, useMemo, useState, useLayoutEffect, forwardRef, useCallback, useContext } from 'react';
5
5
  import classNames from 'classnames';
@@ -362,9 +362,14 @@ var k=/^--/;function I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeo
362
362
  */
363
363
  const StyledDataPoint = styled(it.g)``;
364
364
 
365
- const _excluded$q = ["children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
365
+ const _excluded$q = ["as", "href"],
366
+ _excluded2$5 = ["anchorProps", "children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
366
367
  const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
367
368
  const {
369
+ anchorProps: {
370
+ as,
371
+ href
372
+ } = {},
368
373
  children,
369
374
  className,
370
375
  data,
@@ -378,7 +383,8 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
378
383
  tooltipVariant,
379
384
  theme: propsTheme
380
385
  } = props,
381
- forwardedProps = _objectWithoutProperties(props, _excluded$q);
386
+ anchorProps = _objectWithoutProperties(props.anchorProps, _excluded$q),
387
+ forwardedProps = _objectWithoutProperties(props, _excluded2$5);
382
388
  const [_id] = useId();
383
389
  const id = propsId !== null && propsId !== void 0 ? propsId : _id;
384
390
  const theme = useTheme(propsTheme);
@@ -405,21 +411,24 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
405
411
  }
406
412
  }
407
413
  };
414
+ if (data.data.key === 'Line Chart') {
415
+ console.log(showTooltip, isEmpty, text);
416
+ }
408
417
  const DataPointComponent = /*#__PURE__*/React__default.createElement(StyledDataPoint, _extends({
409
- tabIndex: onClick ? 0 : undefined
418
+ tabIndex: onClick ? 0 : undefined,
419
+ "aria-label": showTooltip && !isEmpty ? labelDecorator ? text : `${data.data.key}, ${data.data.value}` : undefined,
420
+ "aria-labelledby": !showTooltip && !isEmpty ? `${id}-title` : undefined,
421
+ "aria-selected": isSelected ? true : isDeselected ? false : undefined,
422
+ onClick: onClick ? () => onClick(data) : undefined,
423
+ onKeyDown: onClick ? e => onKeyDown(e) : undefined,
424
+ role: role ? role : onClick ? 'button' : href ? undefined : 'img'
410
425
  }, forwardedProps, {
411
426
  className: classNames(className, `_${index}`, {
412
427
  selected: isSelected,
413
428
  deselected: isDeselected
414
429
  }),
415
430
  ref: ref,
416
- "aria-label": showTooltip && !isEmpty ? `${text}: ${data.data.value}` : undefined,
417
- "aria-labelledby": !showTooltip && !isEmpty ? `${id}-title` : undefined,
418
- "aria-selected": isSelected ? true : isDeselected ? false : undefined,
419
431
  id: id,
420
- onClick: onClick ? () => onClick(data) : undefined,
421
- onKeyDown: onClick ? e => onKeyDown(e) : undefined,
422
- role: role ? role : onClick ? 'button' : undefined,
423
432
  $clickable: Boolean(onClick)
424
433
  }), children, !showTooltip && !isEmpty ? /*#__PURE__*/React__default.createElement("title", {
425
434
  id: `${id}-title`
@@ -428,7 +437,9 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
428
437
  return /*#__PURE__*/React__default.createElement(Tooltip, {
429
438
  placement: "right",
430
439
  theme: theme
431
- }, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, DataPointComponent), /*#__PURE__*/React__default.createElement(Tooltip.Content, null, isTooltipCustom ? tooltipDecorator(data, {
440
+ }, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, href !== undefined ? /*#__PURE__*/React__default.createElement(as || 'a', _objectSpread2({
441
+ href
442
+ }, anchorProps), DataPointComponent) : DataPointComponent), /*#__PURE__*/React__default.createElement(Tooltip.Content, null, isTooltipCustom ? tooltipDecorator(data, {
432
443
  index,
433
444
  isSelected: propsIsSelected,
434
445
  color: props.color
@@ -499,24 +510,9 @@ const config = (() => ({
499
510
  const _excluded$p = ["className", "createArc", "hasStroke", "previousData"];
500
511
  const COMPONENT_NAME$c = 'Arc';
501
512
  const CLASSNAME$c = 'redsift-arc';
502
- const DEFAULT_PROPS$c = {
503
- color: monochrome,
504
- index: 0,
505
- previousData: {
506
- data: {
507
- key: '',
508
- value: 0
509
- },
510
- startAngle: 0,
511
- endAngle: 0,
512
- padAngle: 0,
513
- value: 0,
514
- index: 0
515
- }
516
- };
517
513
  const Arc = /*#__PURE__*/forwardRef((props, ref) => {
518
514
  const {
519
- color,
515
+ color = monochrome,
520
516
  data,
521
517
  isSelected: propsIsSelected,
522
518
  onClick,
@@ -526,7 +522,17 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
526
522
  className,
527
523
  createArc,
528
524
  hasStroke,
529
- previousData
525
+ previousData = {
526
+ data: {
527
+ key: '',
528
+ value: 0
529
+ },
530
+ startAngle: 0,
531
+ endAngle: 0,
532
+ padAngle: 0,
533
+ value: 0,
534
+ index: 0
535
+ }
530
536
  } = props,
531
537
  forwardedProps = _objectWithoutProperties(props, _excluded$p);
532
538
  const theme = useTheme();
@@ -555,7 +561,6 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
555
561
  }));
556
562
  });
557
563
  Arc.className = CLASSNAME$c;
558
- Arc.defaultProps = DEFAULT_PROPS$c;
559
564
  Arc.displayName = COMPONENT_NAME$c;
560
565
 
561
566
  /**
@@ -566,7 +571,6 @@ const StyledArcs = styled.g``;
566
571
  const _excluded$o = ["arcs", "className", "color", "hasLabels", "hasStroke", "id", "labelDecorator", "onClick", "role", "sliceProps", "tooltipVariant"];
567
572
  const COMPONENT_NAME$b = 'Arcs';
568
573
  const CLASSNAME$b = 'redsift-arcs';
569
- const DEFAULT_PROPS$b = {};
570
574
  const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
571
575
  const {
572
576
  arcs,
@@ -637,7 +641,6 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
637
641
  })) : null);
638
642
  });
639
643
  Arcs.className = CLASSNAME$b;
640
- Arcs.defaultProps = DEFAULT_PROPS$b;
641
644
  Arcs.displayName = COMPONENT_NAME$b;
642
645
 
643
646
  /**
@@ -811,36 +814,25 @@ const computeTicks = _ref => {
811
814
  const _excluded$n = ["className", "length", "legend", "legendOffset", "legendPosition", "position", "scale", "tickPadding", "tickRotation", "tickSize", "tickValues", "tickFormat", "tickRemodelling", "variant", "x", "y"];
812
815
  const COMPONENT_NAME$a = 'Axis';
813
816
  const CLASSNAME$a = 'redsift-axis';
814
- const DEFAULT_PROPS$a = {
815
- position: AxisPosition.bottom,
816
- legendOffset: -32,
817
- legendPosition: 'end',
818
- tickPadding: 5,
819
- tickRotation: 0,
820
- tickSize: 5,
821
- variant: AxisVariant.default,
822
- x: 0,
823
- y: 0
824
- };
825
817
  const getAxisType = position => [AxisPosition.top, AxisPosition.bottom].includes(position) ? 'x' : 'y';
826
818
  const Axis = /*#__PURE__*/forwardRef((props, ref) => {
827
819
  const {
828
820
  className,
829
821
  length,
830
822
  legend,
831
- legendOffset,
832
- legendPosition,
833
- position,
823
+ legendOffset = -32,
824
+ legendPosition = 'end',
825
+ position = AxisPosition.bottom,
834
826
  scale,
835
- tickPadding,
836
- tickRotation,
837
- tickSize,
827
+ tickPadding = 5,
828
+ tickRotation = 0,
829
+ tickSize = 5,
838
830
  tickValues,
839
831
  tickFormat,
840
832
  tickRemodelling,
841
- variant,
842
- x,
843
- y
833
+ variant = AxisVariant.default,
834
+ x = 0,
835
+ y = 0
844
836
  } = props,
845
837
  forwardedProps = _objectWithoutProperties(props, _excluded$n);
846
838
  const theme = useTheme();
@@ -938,6 +930,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
938
930
  }
939
931
  }));
940
932
  return /*#__PURE__*/React__default.createElement(StyledAxis, _extends({
933
+ "aria-hidden": "true",
941
934
  className: classNames(Axis.className, className),
942
935
  $theme: theme
943
936
  }, forwardedProps, {
@@ -971,7 +964,6 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
971
964
  }) : null, legendNode);
972
965
  });
973
966
  Axis.className = CLASSNAME$a;
974
- Axis.defaultProps = DEFAULT_PROPS$a;
975
967
  Axis.displayName = COMPONENT_NAME$a;
976
968
 
977
969
  /**
@@ -1053,27 +1045,12 @@ const StyledBar = styled(DataPoint)`
1053
1045
  const _excluded$m = ["className", "gap", "height", "maxHeight", "orientation", "previousData", "scale", "scalePosition", "width"];
1054
1046
  const COMPONENT_NAME$9 = 'Bar';
1055
1047
  const CLASSNAME$9 = 'redsift-bar';
1056
- const DEFAULT_PROPS$9 = {
1057
- color: monochrome,
1058
- index: 0,
1059
- gap: 5,
1060
- height: 40,
1061
- maxHeight: 100,
1062
- orientation: BarOrientation.horizontal,
1063
- previousData: {
1064
- data: {
1065
- key: '',
1066
- value: 0
1067
- }
1068
- },
1069
- width: 40
1070
- };
1071
1048
  const getValue = data => data.cumulativeValue !== undefined ? data.cumulativeValue : data.value;
1072
1049
  const Bar = /*#__PURE__*/forwardRef((props, ref) => {
1073
1050
  const {
1074
- color,
1051
+ color = monochrome,
1075
1052
  data,
1076
- index,
1053
+ index = 0,
1077
1054
  isSelected: propsIsSelected,
1078
1055
  labelDecorator,
1079
1056
  onClick,
@@ -1081,14 +1058,19 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
1081
1058
  } = props;
1082
1059
  const {
1083
1060
  className,
1084
- gap,
1085
- height,
1086
- maxHeight,
1087
- orientation,
1088
- previousData,
1061
+ gap = 5,
1062
+ height = 40,
1063
+ maxHeight = 100,
1064
+ orientation = BarOrientation.horizontal,
1065
+ previousData = {
1066
+ data: {
1067
+ key: '',
1068
+ value: 0
1069
+ }
1070
+ },
1089
1071
  scale,
1090
1072
  scalePosition,
1091
- width
1073
+ width = 40
1092
1074
  } = props,
1093
1075
  forwardedProps = _objectWithoutProperties(props, _excluded$m);
1094
1076
  const theme = useTheme();
@@ -1134,7 +1116,6 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
1134
1116
  }, text) : null);
1135
1117
  });
1136
1118
  Bar.className = CLASSNAME$9;
1137
- Bar.defaultProps = DEFAULT_PROPS$9;
1138
1119
  Bar.displayName = COMPONENT_NAME$9;
1139
1120
 
1140
1121
  /**
@@ -1153,18 +1134,26 @@ const BarChartLegendVariant = {
1153
1134
  */
1154
1135
 
1155
1136
  var reset$1 = "Reset";
1156
- var enUS = {
1137
+ var enUS$4 = {
1138
+ "static-chart": "Static chart.",
1139
+ "interactive-chart": "Interactive chart.",
1140
+ "view-as-data-table": "View as data table",
1141
+ "table-summary": "Table representation of chart.",
1157
1142
  reset: reset$1
1158
1143
  };
1159
1144
 
1160
1145
  var reset = "Réinitialiser";
1161
- var frFR = {
1146
+ var frFR$4 = {
1147
+ "static-chart": "Graphique statique.",
1148
+ "interactive-chart": "Graphique intéractif.",
1149
+ "view-as-data-table": "Voir au format table de données",
1150
+ "table-summary": "Représentation du graphique sous forme de table de données.",
1162
1151
  reset: reset
1163
1152
  };
1164
1153
 
1165
- var intlMessages = {
1166
- 'en-US': enUS,
1167
- 'fr-FR': frFR
1154
+ var intlMessages$4 = {
1155
+ 'en-US': enUS$4,
1156
+ 'fr-FR': frFR$4
1168
1157
  };
1169
1158
 
1170
1159
  /**
@@ -1189,6 +1178,7 @@ const StyledChartContainer = styled.div`
1189
1178
 
1190
1179
  svg {
1191
1180
  display: block;
1181
+ user-select: none;
1192
1182
  }
1193
1183
 
1194
1184
  text {
@@ -1201,6 +1191,32 @@ const StyledChartContainer = styled.div`
1201
1191
  `;
1202
1192
  }}
1203
1193
  }
1194
+
1195
+ table {
1196
+ border-collapse: collapse;
1197
+ border: 1px solid #ebebeb;
1198
+ margin: 10px auto;
1199
+ text-align: center;
1200
+ width: 100%;
1201
+ max-width: 500px;
1202
+
1203
+ td, th, caption {
1204
+ padding: 0.5em;
1205
+ }
1206
+
1207
+ caption {
1208
+ padding: 1em 0;
1209
+ font-size: 1.2em;
1210
+ color: #555;
1211
+ }
1212
+
1213
+ thead tr, tr:nth-child(even) {
1214
+ background: #f8f8f8;
1215
+ }
1216
+
1217
+ th {
1218
+ font-weight: 600;
1219
+ }
1204
1220
  `;
1205
1221
  const StyledChartContainerTitle = styled(Flexbox)``;
1206
1222
  const StyledChartContainerCaption = styled.p`
@@ -1211,10 +1227,9 @@ const StyledChartContainerCaption = styled.p`
1211
1227
  margin: 8px;
1212
1228
  `;
1213
1229
 
1214
- const _excluded$l = ["aria-label", "aria-labelledby", "description", "chartProps", "chartRef", "children", "className", "id", "title", "onReset", "theme"];
1230
+ const _excluded$l = ["aria-label", "aria-labelledby", "description", "chartProps", "chartRef", "children", "className", "id", "title", "onReset", "theme", "mode", "definition", "interactionExplanation", "descriptionForAssistiveTechnology", "dataTableRepresentation", "xAxisDefinition", "yAxisDefinition"];
1215
1231
  const COMPONENT_NAME$8 = 'ChartContainer';
1216
1232
  const CLASSNAME$8 = 'redsift-chart-container';
1217
- const DEFAULT_PROPS$8 = {};
1218
1233
  const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1219
1234
  const {
1220
1235
  'aria-label': propsAriaLabel,
@@ -1227,27 +1242,74 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1227
1242
  id: propsId,
1228
1243
  title,
1229
1244
  onReset,
1230
- theme: propsTheme
1245
+ theme: propsTheme,
1246
+ mode = 'static',
1247
+ definition,
1248
+ interactionExplanation,
1249
+ descriptionForAssistiveTechnology,
1250
+ dataTableRepresentation,
1251
+ xAxisDefinition,
1252
+ yAxisDefinition
1231
1253
  } = props,
1232
1254
  forwardedProps = _objectWithoutProperties(props, _excluded$l);
1233
1255
  const [_id] = useId();
1234
1256
  const id = propsId !== null && propsId !== void 0 ? propsId : _id;
1235
1257
  const theme = useTheme(propsTheme);
1258
+ const [viewAsDataTable, setViewAsDataTable] = useState(false);
1236
1259
  warnIfNoAccessibleLabelFound(props, [title]);
1237
- const stringFormatter = useLocalizedStringFormatter(intlMessages);
1260
+ const format = useMessageFormatter(intlMessages$4);
1238
1261
  const ariaLabel = propsAriaLabel ? propsAriaLabel : propsAriaLabelledby || title ? undefined : undefined;
1239
1262
  const ariaLabelledby = propsAriaLabelledby ? propsAriaLabelledby : title ? `id${id}__title` : undefined;
1240
1263
  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
1241
1264
  value: {
1242
1265
  theme
1243
1266
  }
1244
- }, /*#__PURE__*/React__default.createElement(StyledChartContainer, _extends({
1245
- $theme: theme
1246
- }, forwardedProps, {
1267
+ }, /*#__PURE__*/React__default.createElement("figure", null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(StyledChartContainer, _extends({
1268
+ $theme: theme,
1269
+ role: "region",
1270
+ "aria-hidden": "false"
1271
+ }, ariaLabel ? {
1272
+ 'aria-label': `${ariaLabel}. ${mode}`
1273
+ } : {}, ariaLabelledby ? {
1274
+ 'aria-labelledby': `${ariaLabelledby} id${id}__interactive-or-not`
1275
+ } : {}, forwardedProps, {
1247
1276
  ref: ref,
1248
1277
  className: classNames(ChartContainer.className, className),
1249
1278
  id: id
1250
- }), title || onReset ? /*#__PURE__*/React__default.createElement(StyledChartContainerTitle, {
1279
+ }), /*#__PURE__*/React__default.createElement("div", {
1280
+ id: `id${id}__screen-reader-region-before`,
1281
+ "aria-hidden": "false",
1282
+ style: {
1283
+ position: 'relative'
1284
+ }
1285
+ }, /*#__PURE__*/React__default.createElement("div", {
1286
+ "aria-hidden": "false",
1287
+ style: {
1288
+ position: 'absolute',
1289
+ width: '1px',
1290
+ height: '1px',
1291
+ overflow: 'hidden',
1292
+ whiteSpace: 'nowrap',
1293
+ clip: 'rect(1px, 1px, 1px, 1px)',
1294
+ marginTop: '-3px',
1295
+ opacity: '0.01'
1296
+ }
1297
+ }, /*#__PURE__*/React__default.createElement("p", {
1298
+ id: `id${id}__interactive-or-not`,
1299
+ "aria-hidden": "true",
1300
+ style: {
1301
+ display: 'none'
1302
+ }
1303
+ }, format(`${mode}-chart`)), ariaLabel ? /*#__PURE__*/React__default.createElement("p", null, `${ariaLabel}. ${format(`${mode}-chart`)}`) : /*#__PURE__*/React__default.createElement("p", {
1304
+ "aria-labelledby": `${ariaLabelledby} id${id}__interactive-or-not`
1305
+ }), /*#__PURE__*/React__default.createElement("div", null, descriptionForAssistiveTechnology !== null && descriptionForAssistiveTechnology !== void 0 ? descriptionForAssistiveTechnology : description), /*#__PURE__*/React__default.createElement("div", null, interactionExplanation), /*#__PURE__*/React__default.createElement("div", null, definition), dataTableRepresentation ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("button", {
1306
+ tabIndex: -1,
1307
+ "aria-expanded": viewAsDataTable,
1308
+ onClick: () => setViewAsDataTable(!viewAsDataTable)
1309
+ }, format('view-as-data-table'), ', ', ariaLabel ? /*#__PURE__*/React__default.createElement("span", null, ariaLabel) : /*#__PURE__*/React__default.createElement("span", {
1310
+ "aria-labelledby": ariaLabelledby
1311
+ }))) : null, /*#__PURE__*/React__default.createElement("div", null, xAxisDefinition), /*#__PURE__*/React__default.createElement("div", null, yAxisDefinition))), title || onReset ? /*#__PURE__*/React__default.createElement(StyledChartContainerTitle, {
1312
+ "aria-hidden": "true",
1251
1313
  $theme: theme,
1252
1314
  alignItems: "center",
1253
1315
  justifyContent: "space-between",
@@ -1260,20 +1322,26 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1260
1322
  color: "grey",
1261
1323
  variant: "unstyled",
1262
1324
  onClick: onReset
1263
- }, stringFormatter.format('reset')) : null) : null, /*#__PURE__*/React__default.createElement(Flexbox, {
1325
+ }, format('reset')) : null) : null, /*#__PURE__*/React__default.createElement(Flexbox, {
1264
1326
  flexDirection: "column"
1265
- }, children ? /*#__PURE__*/React__default.createElement("div", _extends({}, chartProps, {
1327
+ }, children ? /*#__PURE__*/React__default.createElement("div", _extends({
1328
+ "aria-hidden": "false",
1329
+ dir: "ltr"
1330
+ }, chartProps, {
1266
1331
  ref: chartRef,
1267
- className: `${ChartContainer.className}__content`,
1268
- "aria-label": ariaLabel,
1269
- "aria-labelledby": ariaLabelledby
1332
+ className: `${ChartContainer.className}__content`
1270
1333
  }), children) : null, description ? /*#__PURE__*/React__default.createElement(StyledChartContainerCaption, {
1334
+ "aria-hidden": "true",
1271
1335
  $theme: theme,
1272
1336
  className: `${ChartContainer.className}__description`
1273
- }, description) : null)));
1337
+ }, description) : null, viewAsDataTable && dataTableRepresentation ? /*#__PURE__*/React__default.createElement("table", {
1338
+ tabIndex: -1,
1339
+ summary: format('table-summary')
1340
+ }, ariaLabel ? /*#__PURE__*/React__default.createElement("caption", null, ariaLabel) : /*#__PURE__*/React__default.createElement("caption", {
1341
+ "aria-labelledby": ariaLabelledby
1342
+ }), dataTableRepresentation.header, dataTableRepresentation.body) : null)))));
1274
1343
  });
1275
1344
  ChartContainer.className = CLASSNAME$8;
1276
- ChartContainer.defaultProps = DEFAULT_PROPS$8;
1277
1345
  ChartContainer.displayName = COMPONENT_NAME$8;
1278
1346
 
1279
1347
  /**
@@ -1447,7 +1515,48 @@ const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1447
1515
  }), "Loading...");
1448
1516
  });
1449
1517
 
1450
- const _excluded$i = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
1518
+ var interactive$7 = "interactive";
1519
+ var enUS$3 = {
1520
+ interactive: interactive$7,
1521
+ "static": "static",
1522
+ "interactive-chart": "Interactive Bar Chart",
1523
+ "static-chart": "Static Bar Chart",
1524
+ "definition-linear": "Linear Bar Chart with {barLength} bars.",
1525
+ "definition-linear-with-categories": "Linear Bar Chart with {categoryLength} categories and {barLength} bars.",
1526
+ "definition-ordinal": "Ordinal Bar Chart with {barLength} bars.",
1527
+ "x-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying numbers from {start, number} to {end, number}.",
1528
+ "y-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying numbers from {start, number} to {end, number}.",
1529
+ "x-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying dates from {start, date, ::yyyyMMdd} to {end, date, ::yyyyMMdd}.",
1530
+ "y-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying dates from {start, date, ::yyyyMMdd} to {end, date, ::yyyyMMdd}.",
1531
+ "x-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying categories.",
1532
+ "y-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying categories.",
1533
+ "series-legend": "{category}, category {categoryIndex} of {categoryLength} with {barLength} bars"
1534
+ };
1535
+
1536
+ var interactive$6 = "interactif";
1537
+ var frFR$3 = {
1538
+ interactive: interactive$6,
1539
+ "static": "statique",
1540
+ "interactive-chart": "Diagrammes à bandes interactif",
1541
+ "static-chart": "Diagrammes à bandes statique",
1542
+ "definition-linear": "Diagrammes à bandes contenant {barLength} bandes réparties sur un axe linéraire.",
1543
+ "definition-linear-with-categories": "Diagrammes à bandes contenant {categoryLength} catégories et {barLength} bandes réparties sur un axe linéraire.",
1544
+ "definition-ordinal": "Diagrammes à bandes contenant {barLength} bandes.",
1545
+ "x-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des nombres allant de {start, number} à {end, number}.",
1546
+ "y-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des nombres allant de {start, number} à {end, number}.",
1547
+ "x-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
1548
+ "y-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
1549
+ "x-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des categories.",
1550
+ "y-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des categories.",
1551
+ "series-legend": "{category}, catégorie {categoryIndex} sur {categoryLength} contenant {barLength} bandes"
1552
+ };
1553
+
1554
+ var intlMessages$3 = {
1555
+ 'en-US': enUS$3,
1556
+ 'fr-FR': frFR$3
1557
+ };
1558
+
1559
+ const _excluded$i = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "getBarAnchorProps", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
1451
1560
  const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1452
1561
  const {
1453
1562
  areXLabelsRotated,
@@ -1457,6 +1566,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1457
1566
  data: propsData,
1458
1567
  id,
1459
1568
  isBarSelected,
1569
+ getBarAnchorProps,
1460
1570
  labelDecorator,
1461
1571
  margins: propsMargins,
1462
1572
  onBarClick,
@@ -1485,6 +1595,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1485
1595
  forwardedProps = _objectWithoutProperties(props, _excluded$i);
1486
1596
  const cache = useRef();
1487
1597
  const theme = useTheme();
1598
+ const format = useMessageFormatter(intlMessages$3);
1488
1599
  const {
1489
1600
  data,
1490
1601
  colorScale
@@ -1525,13 +1636,47 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1525
1636
  return value;
1526
1637
  }))]).range(isHorizontal ? [0, chartWidth] : [chartHeight, 0]), [size]);
1527
1638
  const scaleCategory = useMemo(() => scaleBand().domain(data.filter(datum => datum.value).map(datum => datum.key)).range([0, isHorizontal ? chartHeight : chartWidth]), [size]);
1528
- return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
1639
+ const bars = data.filter(datum => datum.value);
1640
+ return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
1641
+ mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive') : format('static'),
1642
+ definition: format('definition-ordinal', {
1643
+ barLength: bars.length
1644
+ }),
1645
+ xAxisDefinition: isHorizontal ? format('x-axis-numbers-definition', {
1646
+ numAxis: xAxisPlacement === 'both' ? 2 : 1,
1647
+ start: scale.domain()[0],
1648
+ end: scale.domain()[1]
1649
+ }) : format('x-axis-categories-definition', {
1650
+ numAxis: xAxisPlacement === 'both' ? 2 : 1
1651
+ }),
1652
+ yAxisDefinition: isHorizontal ? format('y-axis-categories-definition', {
1653
+ numAxis: yAxisPlacement === 'both' ? 2 : 1
1654
+ }) : format('y-axis-numbers-definition', {
1655
+ numAxis: yAxisPlacement === 'both' ? 2 : 1,
1656
+ start: scale.domain()[0],
1657
+ end: scale.domain()[1]
1658
+ }),
1659
+ dataTableRepresentation: {
1660
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
1661
+ scope: "col"
1662
+ }, "Key"), /*#__PURE__*/React__default.createElement("th", {
1663
+ scope: "col"
1664
+ }, "Value"))),
1665
+ body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => /*#__PURE__*/React__default.createElement("tr", {
1666
+ key: datum.key
1667
+ }, /*#__PURE__*/React__default.createElement("th", {
1668
+ scope: "row"
1669
+ }, datum.key), /*#__PURE__*/React__default.createElement("td", null, datum.value))))
1670
+ }
1671
+ }, forwardedProps, {
1529
1672
  id: id,
1530
1673
  className: className,
1531
1674
  ref: ref
1532
1675
  }), /*#__PURE__*/React__default.createElement("svg", {
1533
1676
  width: width,
1534
- height: height
1677
+ height: height,
1678
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
1679
+ "aria-hidden": "false"
1535
1680
  }, /*#__PURE__*/React__default.createElement("g", {
1536
1681
  transform: `translate(${margins.left},${margins.top})`
1537
1682
  }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
@@ -1584,7 +1729,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1584
1729
  variant: yAxisVariant
1585
1730
  }) : null), /*#__PURE__*/React__default.createElement("g", {
1586
1731
  transform: `translate(${margins.left},${margins.top})`
1587
- }, data.filter(datum => datum.value).map((datum, index) => {
1732
+ }, bars.map((datum, index) => {
1588
1733
  const percent = datum.value / total;
1589
1734
  const to = {
1590
1735
  data: _objectSpread2(_objectSpread2({}, datum), {}, {
@@ -1594,25 +1739,27 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1594
1739
  const from = cache.current ? {
1595
1740
  data: cache.current[index]
1596
1741
  } : undefined;
1597
- return /*#__PURE__*/React__default.createElement(Bar, _extends({}, barProps, {
1742
+ return /*#__PURE__*/React__default.createElement(Bar, _extends({
1598
1743
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
1599
1744
  data: to,
1600
1745
  gap: gap,
1601
- height: isHorizontal ? barHeight : undefined,
1602
1746
  id: `id${id}__bar-${index}`,
1603
1747
  index: index,
1604
1748
  isSelected: Boolean(isBarSelected(to)),
1605
1749
  key: `bar _${index}`,
1606
1750
  labelDecorator: labelDecorator,
1607
1751
  maxHeight: isHorizontal ? undefined : chartHeight,
1752
+ anchorProps: getBarAnchorProps ? getBarAnchorProps(to) : undefined,
1608
1753
  onClick: onBarClick,
1609
1754
  orientation: orientation,
1610
1755
  previousData: from,
1611
- role: barRole,
1612
1756
  scale: scale,
1613
1757
  scalePosition: scaleCategory,
1614
- tooltipVariant: tooltipVariant,
1615
- width: isHorizontal ? undefined : barWidth
1758
+ tooltipVariant: tooltipVariant
1759
+ }, barProps, {
1760
+ width: isHorizontal ? undefined : barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
1761
+ height: isHorizontal ? barProps !== null && barProps !== void 0 && barProps.height && typeof barProps.height === 'number' ? barProps.height : barHeight : undefined,
1762
+ role: barRole
1616
1763
  }));
1617
1764
  }))));
1618
1765
  });
@@ -1687,13 +1834,9 @@ const StyledLegendItem = styled.li`
1687
1834
  const _excluded$h = ["className", "color", "data", "id", "variant"];
1688
1835
  const COMPONENT_NAME$7 = 'LegendItem';
1689
1836
  const CLASSNAME$7 = 'redsift-legend-item';
1690
- const DEFAULT_PROPS$7 = {
1691
- color: monochrome,
1692
- index: 0
1693
- };
1694
1837
  const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
1695
1838
  const {
1696
- index,
1839
+ index = 0,
1697
1840
  isSelected: propsIsSelected,
1698
1841
  labelDecorator,
1699
1842
  legendDecorator,
@@ -1702,7 +1845,7 @@ const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
1702
1845
  } = props;
1703
1846
  const {
1704
1847
  className,
1705
- color,
1848
+ color = monochrome,
1706
1849
  data,
1707
1850
  id: propsId,
1708
1851
  variant
@@ -1771,27 +1914,22 @@ const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
1771
1914
  }, text) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, text)));
1772
1915
  });
1773
1916
  LegendItem.className = CLASSNAME$7;
1774
- LegendItem.defaultProps = DEFAULT_PROPS$7;
1775
1917
  LegendItem.displayName = COMPONENT_NAME$7;
1776
1918
 
1777
1919
  const _excluded$g = ["className", "data", "isLegendItemSelected", "labelDecorator", "legendDecorator", "legendItemRole", "onLegendItemClick", "variant", "width"],
1778
- _excluded2 = ["color"];
1920
+ _excluded2$4 = ["color"];
1779
1921
  const COMPONENT_NAME$6 = 'Legend';
1780
1922
  const CLASSNAME$6 = 'redsift-chart-legend';
1781
- const DEFAULT_PROPS$6 = {
1782
- isLegendItemSelected: () => true,
1783
- variant: LegendVariant.label
1784
- };
1785
1923
  const Legend = /*#__PURE__*/forwardRef((props, ref) => {
1786
1924
  const {
1787
1925
  className,
1788
1926
  data,
1789
- isLegendItemSelected,
1927
+ isLegendItemSelected = () => true,
1790
1928
  labelDecorator,
1791
1929
  legendDecorator,
1792
1930
  legendItemRole,
1793
1931
  onLegendItemClick,
1794
- variant,
1932
+ variant = LegendVariant.label,
1795
1933
  width
1796
1934
  } = props,
1797
1935
  forwardedProps = _objectWithoutProperties(props, _excluded$g);
@@ -1805,7 +1943,7 @@ const Legend = /*#__PURE__*/forwardRef((props, ref) => {
1805
1943
  let {
1806
1944
  color
1807
1945
  } = _ref,
1808
- datum = _objectWithoutProperties(_ref, _excluded2);
1946
+ datum = _objectWithoutProperties(_ref, _excluded2$4);
1809
1947
  return /*#__PURE__*/React__default.createElement(LegendItem, {
1810
1948
  data: {
1811
1949
  data: _objectSpread2(_objectSpread2({}, datum), {}, {
@@ -1827,10 +1965,10 @@ const Legend = /*#__PURE__*/forwardRef((props, ref) => {
1827
1965
  }));
1828
1966
  });
1829
1967
  Legend.className = CLASSNAME$6;
1830
- Legend.defaultProps = DEFAULT_PROPS$6;
1831
1968
  Legend.displayName = COMPONENT_NAME$6;
1832
1969
 
1833
- const _excluded$f = ["barProps", "className", "data", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "xScaleType", "dateParser"];
1970
+ const _excluded$f = ["barProps", "className", "data", "id", "getBarAnchorProps", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "xScaleType", "dateParser"],
1971
+ _excluded2$3 = ["extraLegendItems"];
1834
1972
  const getKey = datum => Array.isArray(datum.key) ? datum.key[0] : datum.key;
1835
1973
  const filterData = (hasCategory, data, filterFn) => {
1836
1974
  if (hasCategory) {
@@ -1851,6 +1989,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1851
1989
  className,
1852
1990
  data: propsData,
1853
1991
  id,
1992
+ getBarAnchorProps,
1854
1993
  isBarSelected,
1855
1994
  labelDecorator,
1856
1995
  legendDecorator,
@@ -1889,6 +2028,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1889
2028
  forwardedProps = _objectWithoutProperties(props, _excluded$f);
1890
2029
  const cache = useRef();
1891
2030
  const theme = useTheme();
2031
+ const format = useMessageFormatter(intlMessages$3);
1892
2032
  const hasCategory = propsData[0] && Array.isArray(propsData[0].key) && propsData[0].key.length >= 2 && propsData[0].key[1] !== null && propsData[0].key[1] !== undefined;
1893
2033
  const xScaleType = propsXScaleType ? propsXScaleType : getKey(propsData[0]) instanceof Date ? 'Date' : typeof getKey(propsData[0]) === 'number' ? 'number' : typeof getKey(propsData[0]) === 'string' && isValidDate(getKey(propsData[0])) ? 'dateString' : undefined;
1894
2034
  const data = xScaleType === 'number' ? filterData(hasCategory, propsData, datum => typeof getKey(datum) === 'number' && !Number.isNaN(getKey(datum))) : xScaleType === 'dateString' ? filterData(hasCategory, propsData, datum => isValidDate(getKey(datum))) : xScaleType === 'Date' ? filterData(hasCategory, propsData, datum => getKey(datum) instanceof Date) : propsData;
@@ -1909,9 +2049,9 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1909
2049
  }, propsMargins);
1910
2050
  const chartHeight = height - margins.top - margins.bottom;
1911
2051
  const chartWidth = width - margins.left - margins.right;
1912
- const numberOfRows = filterData(hasCategory, data, datum => datum.value).length;
2052
+ const numberOfBars = filterData(hasCategory, data, datum => datum.value).length;
1913
2053
  const gap = 5;
1914
- let barWidth = chartWidth / (numberOfRows * 2) - gap;
2054
+ let barWidth = chartWidth / (numberOfBars * 2) - gap;
1915
2055
  const scaleX = (() => {
1916
2056
  if (xScaleType === 'number') {
1917
2057
  var _ref, _ref2;
@@ -1928,7 +2068,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1928
2068
  domain[0] = (_ref3 = xAxisMinValue) !== null && _ref3 !== void 0 ? _ref3 : domain[0];
1929
2069
  domain[1] = (_ref4 = xAxisMaxValue) !== null && _ref4 !== void 0 ? _ref4 : domain[1];
1930
2070
  const startDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[0]), -1) : new Date(domain[0]);
1931
- const endDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]), 0) : new Date(domain[1]);
2071
+ const endDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]), 1) : new Date(domain[1]);
1932
2072
  return scaleTime().domain([startDate, endDate]).range([0, chartWidth]).nice();
1933
2073
  } else {
1934
2074
  var _ref5, _ref6;
@@ -1996,7 +2136,81 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1996
2136
  const minimalGap = Math.min(...bars.map((bar, i) => i > 0 ? Math.abs(bar.key - bars[i - 1].key) : undefined).filter(k => k)) * 0.9;
1997
2137
  barWidth = Math.min(barWidth, chartWidth / ((scaleX.domain()[1] - scaleX.domain()[0]) / minimalGap), chartWidth / (xAxisTickValues && typeof xAxisTickValues !== 'string' ? typeof xAxisTickValues === 'number' ? xAxisTickValues : Array.isArray(xAxisTickValues) ? xAxisTickValues.length : xAxisTickValues.range(scaleX.domain()[0], scaleX.domain()[1]).length : 1));
1998
2138
  }
1999
- return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
2139
+ const categories = [];
2140
+ const pivotedTable = bars.reduce((acc, item) => {
2141
+ const {
2142
+ key,
2143
+ category,
2144
+ value
2145
+ } = item;
2146
+ if (!categories.includes(category)) {
2147
+ categories.push(category);
2148
+ }
2149
+ const formattedKey = xAxisTickFormat ? xAxisTickFormat(key) : key.toString();
2150
+ let entry = acc.find(e => e.key === formattedKey);
2151
+ if (!entry) {
2152
+ entry = {
2153
+ key: formattedKey
2154
+ };
2155
+ acc.push(entry);
2156
+ }
2157
+ entry[category] = value;
2158
+ return acc;
2159
+ }, []);
2160
+ const _ref9 = legendProps || {},
2161
+ {
2162
+ extraLegendItems
2163
+ } = _ref9,
2164
+ forwardedLegendProps = _objectWithoutProperties(_ref9, _excluded2$3);
2165
+ return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
2166
+ mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive') : format('static'),
2167
+ definition: hasCategory ? format('definition-linear-with-categories', {
2168
+ categoryLength: categories.length,
2169
+ barLength: bars.length
2170
+ }) : format('definition-linear', {
2171
+ barLength: bars.length
2172
+ }),
2173
+ xAxisDefinition: format(`x-axis-${xScaleType === 'number' ? 'numbers' : 'dates'}-definition`, {
2174
+ numAxis: xAxisPlacement === 'both' ? 2 : 1,
2175
+ start: scaleX.domain()[0],
2176
+ end: scaleX.domain()[1]
2177
+ }),
2178
+ yAxisDefinition: format('y-axis-numbers-definition', {
2179
+ numAxis: yAxisPlacement === 'both' ? 2 : 1,
2180
+ start: scaleY.domain()[0],
2181
+ end: scaleY.domain()[1]
2182
+ }),
2183
+ dataTableRepresentation: hasCategory ? {
2184
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
2185
+ scope: "col"
2186
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
2187
+ key: category,
2188
+ scope: "col"
2189
+ }, category)))),
2190
+ body: /*#__PURE__*/React__default.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React__default.createElement("tr", {
2191
+ key: row.key
2192
+ }, /*#__PURE__*/React__default.createElement("th", {
2193
+ scope: "row"
2194
+ }, row.key), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
2195
+ key: `${row.key}-${category}-${row[category]}`,
2196
+ scope: "col"
2197
+ }, row[category])))))
2198
+ } : {
2199
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
2200
+ scope: "col"
2201
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React__default.createElement("th", {
2202
+ scope: "col"
2203
+ }, "Value"))),
2204
+ body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => {
2205
+ const key = xAxisTickFormat ? xAxisTickFormat(datum.key) : datum.key.toString();
2206
+ return /*#__PURE__*/React__default.createElement("tr", {
2207
+ key: key
2208
+ }, /*#__PURE__*/React__default.createElement("th", {
2209
+ scope: "row"
2210
+ }, key), /*#__PURE__*/React__default.createElement("td", null, datum.value));
2211
+ }))
2212
+ }
2213
+ }, forwardedProps, {
2000
2214
  id: id,
2001
2215
  className: className,
2002
2216
  ref: ref
@@ -2007,37 +2221,58 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2007
2221
  }, /*#__PURE__*/React__default.createElement("svg", {
2008
2222
  ref: svgRef,
2009
2223
  width: width,
2010
- height: height
2011
- }, /*#__PURE__*/React__default.createElement("g", {
2012
- transform: `translate(${margins.left},${margins.top})`
2013
- }, bars.map((bar, index) => {
2014
- const to = {
2015
- data: bar
2016
- };
2017
- const from = cache.current ? {
2018
- data: cache.current[index]
2019
- } : undefined;
2020
- return /*#__PURE__*/React__default.createElement(Bar, _extends({}, barProps, {
2021
- color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
2022
- data: to,
2023
- gap: gap,
2024
- height: undefined,
2025
- id: `id${id}__bar-${index}`,
2026
- index: index,
2027
- isSelected: Boolean(isBarSelected(to)),
2028
- key: `bar _${index}`,
2029
- labelDecorator: labelDecorator,
2030
- maxHeight: scaleY(bar.cumulativeValue - bar.value),
2031
- onClick: onBarClick,
2032
- orientation: BarOrientation.vertical,
2033
- previousData: from,
2034
- role: barRole,
2035
- scale: scaleY,
2036
- scalePosition: scaleX,
2037
- tooltipVariant: tooltipVariant,
2038
- width: barWidth
2224
+ height: height,
2225
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
2226
+ "aria-hidden": "false"
2227
+ }, categories.map((category, categoryIndex) => {
2228
+ const filteredBars = bars.filter(bar => bar.category === category);
2229
+ return /*#__PURE__*/React__default.createElement("g", _extends({
2230
+ key: `${id}-series-${category}`,
2231
+ transform: `translate(${margins.left},${margins.top})`,
2232
+ "aria-hidden": "false",
2233
+ role: "region"
2234
+ }, hasCategory ? {
2235
+ 'aria-label': format('series-legend', {
2236
+ category,
2237
+ categoryIndex: categoryIndex + 1,
2238
+ categoryLength: categories.length,
2239
+ barLength: filteredBars.length
2240
+ })
2241
+ } : {}), filteredBars.map((bar, index) => {
2242
+ const to = {
2243
+ data: bar,
2244
+ category
2245
+ };
2246
+ const from = cache.current ? {
2247
+ data: cache.current[index]
2248
+ } : undefined;
2249
+ return /*#__PURE__*/React__default.createElement(Bar, _extends({
2250
+ color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
2251
+ data: to,
2252
+ gap: gap,
2253
+ id: `id${id}__bar-${categoryIndex}.${index}`,
2254
+ index: index,
2255
+ isSelected: Boolean(isBarSelected(to)),
2256
+ key: `bar _${categoryIndex}.${index}`,
2257
+ labelDecorator: labelDecorator,
2258
+ maxHeight: scaleY(bar.cumulativeValue - bar.value),
2259
+ anchorProps: getBarAnchorProps ? getBarAnchorProps(to) : undefined,
2260
+ onClick: onBarClick,
2261
+ orientation: BarOrientation.vertical,
2262
+ previousData: from,
2263
+ scale: scaleY,
2264
+ scalePosition: scaleX,
2265
+ tooltipVariant: tooltipVariant
2266
+ }, barProps, {
2267
+ width: barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
2268
+ height: undefined,
2269
+ role: barRole
2270
+ }));
2039
2271
  }));
2040
- }), ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
2272
+ }), /*#__PURE__*/React__default.createElement("g", {
2273
+ transform: `translate(${margins.left},${margins.top})`,
2274
+ "aria-hidden": "true"
2275
+ }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
2041
2276
  position: "bottom",
2042
2277
  length: chartWidth,
2043
2278
  scale: scaleX,
@@ -2090,54 +2325,45 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2090
2325
  tickRemodelling: yAxisTickRemodelling,
2091
2326
  variant: yAxisVariant
2092
2327
  }) : null))), hasCategory && legendVariant !== BarChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
2093
- data: statsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2328
+ data: (extraLegendItems ? [...statsByCategory, ...extraLegendItems] : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2094
2329
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
2095
2330
  })),
2096
2331
  variant: legendVariant === BarChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === BarChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === BarChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
2097
2332
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
2098
- }, legendProps)) : null);
2333
+ }, forwardedLegendProps)) : null);
2099
2334
  });
2100
2335
 
2101
- const _excluded$e = ["caping", "chartRef", "className", "data", "dataType", "emptyComponent", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBarClick", "orientation", "others", "size", "barRole", "theme", "tooltipDecorator", "colorTheme", "tooltipVariant"];
2336
+ const _excluded$e = ["barRole", "caping", "chartRef", "className", "colorTheme", "data", "dataType", "emptyComponent", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBarClick", "orientation", "others", "size", "sortingMethod", "theme", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "yAxisPlacement"];
2102
2337
  const COMPONENT_NAME$5 = 'BarChart';
2103
2338
  const CLASSNAME$5 = 'redsift-barchart';
2104
- const DEFAULT_PROPS$5 = {
2105
- isBarSelected: () => true,
2106
- orientation: BarOrientation.horizontal,
2107
- others: true,
2108
- size: ChartSize.medium,
2109
- sortingMethod: 'desc-value',
2110
- colorTheme: ColorTheme.default,
2111
- tooltipVariant: TooltipVariant.value,
2112
- localeText: {
2113
- emptyChartText: 'No Data'
2114
- },
2115
- xAxisPlacement: 'bottom',
2116
- yAxisPlacement: 'left'
2117
- };
2118
2339
  const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
2119
2340
  const {
2341
+ barRole,
2120
2342
  caping,
2121
2343
  chartRef,
2122
2344
  className,
2345
+ colorTheme = ColorTheme.default,
2123
2346
  data: propsData,
2124
2347
  dataType: propsDataType,
2125
2348
  emptyComponent,
2126
2349
  id: propsId,
2127
- isBarSelected,
2350
+ isBarSelected = () => true,
2128
2351
  labelDecorator,
2129
2352
  legendDecorator,
2130
2353
  legendVariant: propsLegendVariant,
2131
- localeText,
2354
+ localeText = {
2355
+ emptyChartText: 'No Data'
2356
+ },
2132
2357
  onBarClick,
2133
- orientation,
2134
- others,
2135
- size,
2136
- barRole,
2358
+ orientation = BarOrientation.horizontal,
2359
+ others = true,
2360
+ size = ChartSize.medium,
2361
+ sortingMethod = 'desc-value',
2137
2362
  theme,
2138
2363
  tooltipDecorator,
2139
- colorTheme,
2140
- tooltipVariant
2364
+ tooltipVariant = TooltipVariant.value,
2365
+ xAxisPlacement = 'bottom',
2366
+ yAxisPlacement = 'left'
2141
2367
  } = props,
2142
2368
  forwardedProps = _objectWithoutProperties(props, _excluded$e);
2143
2369
  const [_id] = useId();
@@ -2176,10 +2402,13 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
2176
2402
  orientation: orientation,
2177
2403
  others: others,
2178
2404
  size: size,
2405
+ sortingMethod: sortingMethod,
2179
2406
  theme: theme,
2180
2407
  tooltipDecorator: tooltipDecorator,
2181
2408
  colorTheme: colorTheme,
2182
- tooltipVariant: tooltipVariant
2409
+ tooltipVariant: tooltipVariant,
2410
+ xAxisPlacement: xAxisPlacement,
2411
+ yAxisPlacement: yAxisPlacement
2183
2412
  }, forwardedProps, {
2184
2413
  ref: ref
2185
2414
  }));
@@ -2196,10 +2425,13 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
2196
2425
  legendVariant: legendVariant,
2197
2426
  onBarClick: onBarClick,
2198
2427
  size: size,
2428
+ sortingMethod: sortingMethod,
2199
2429
  theme: theme,
2200
2430
  tooltipDecorator: tooltipDecorator,
2201
2431
  colorTheme: colorTheme,
2202
- tooltipVariant: tooltipVariant
2432
+ tooltipVariant: tooltipVariant,
2433
+ xAxisPlacement: xAxisPlacement,
2434
+ yAxisPlacement: yAxisPlacement
2203
2435
  }, forwardedProps, {
2204
2436
  ref: ref
2205
2437
  }));
@@ -2207,7 +2439,6 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
2207
2439
  return null;
2208
2440
  });
2209
2441
  BarChart.className = CLASSNAME$5;
2210
- BarChart.defaultProps = DEFAULT_PROPS$5;
2211
2442
  BarChart.displayName = COMPONENT_NAME$5;
2212
2443
 
2213
2444
  /**
@@ -2261,20 +2492,12 @@ const StyledDot = styled(DataPoint)`
2261
2492
  }}}
2262
2493
  `;
2263
2494
 
2264
- const _excluded$d = ["className", "scaleX", "scaleY", "variant"];
2495
+ const _excluded$d = ["className", "labelDecorator", "scaleX", "scaleY", "variant"];
2265
2496
  const COMPONENT_NAME$4 = 'Dot';
2266
2497
  const CLASSNAME$4 = 'redsift-dot';
2267
- const DEFAULT_PROPS$4 = {
2268
- color: monochrome,
2269
- index: 0,
2270
- labelDecorator: datum => {
2271
- return datum.data.key[2] !== undefined && datum.data.key[2] !== null ? datum.data.key[2] : `${datum.data.key[0]},${datum.data.key[1]}`;
2272
- },
2273
- variant: DotVariant.plain
2274
- };
2275
2498
  const Dot = /*#__PURE__*/forwardRef((props, ref) => {
2276
2499
  const {
2277
- color,
2500
+ color = monochrome,
2278
2501
  data,
2279
2502
  isSelected: propsIsSelected,
2280
2503
  onClick,
@@ -2282,15 +2505,20 @@ const Dot = /*#__PURE__*/forwardRef((props, ref) => {
2282
2505
  } = props;
2283
2506
  const {
2284
2507
  className,
2508
+ labelDecorator = datum => {
2509
+ return datum.data.key[2] !== undefined && datum.data.key[2] !== null ? datum.data.key[2] : `${datum.data.key[0]},${datum.data.key[1]}`;
2510
+ },
2285
2511
  scaleX,
2286
2512
  scaleY,
2287
- variant
2513
+ variant = DotVariant.plain
2288
2514
  } = props,
2289
2515
  forwardedProps = _objectWithoutProperties(props, _excluded$d);
2290
2516
  const theme = useTheme();
2291
2517
  const isSelectable = role === 'option';
2292
2518
  const isDeselected = isSelectable && propsIsSelected === false;
2293
- return /*#__PURE__*/React__default.createElement(StyledDot, _extends({}, forwardedProps, {
2519
+ return /*#__PURE__*/React__default.createElement(StyledDot, _extends({
2520
+ labelDecorator: labelDecorator
2521
+ }, forwardedProps, {
2294
2522
  ref: ref,
2295
2523
  className: classNames(Dot.className, className),
2296
2524
  $clickable: Boolean(onClick),
@@ -2306,7 +2534,6 @@ const Dot = /*#__PURE__*/forwardRef((props, ref) => {
2306
2534
  }));
2307
2535
  });
2308
2536
  Dot.className = CLASSNAME$4;
2309
- Dot.defaultProps = DEFAULT_PROPS$4;
2310
2537
  Dot.displayName = COMPONENT_NAME$4;
2311
2538
 
2312
2539
  /**
@@ -2317,13 +2544,9 @@ const StyledLine = styled('g')``;
2317
2544
  const _excluded$c = ["className", "createLine", "previousData"];
2318
2545
  const COMPONENT_NAME$3 = 'Line';
2319
2546
  const CLASSNAME$3 = 'redsift-line';
2320
- const DEFAULT_PROPS$3 = {
2321
- color: monochrome,
2322
- previousData: []
2323
- };
2324
2547
  const Line = /*#__PURE__*/forwardRef((props, ref) => {
2325
2548
  const {
2326
- color,
2549
+ color = monochrome,
2327
2550
  data,
2328
2551
  isSelected: propsIsSelected,
2329
2552
  role
@@ -2331,7 +2554,7 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
2331
2554
  const {
2332
2555
  className,
2333
2556
  createLine,
2334
- previousData
2557
+ previousData = []
2335
2558
  } = props,
2336
2559
  forwardedProps = _objectWithoutProperties(props, _excluded$c);
2337
2560
  const interpolator = interpolate(previousData, data);
@@ -2358,7 +2581,6 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
2358
2581
  }));
2359
2582
  });
2360
2583
  Line.className = CLASSNAME$3;
2361
- Line.defaultProps = DEFAULT_PROPS$3;
2362
2584
  Line.displayName = COMPONENT_NAME$3;
2363
2585
 
2364
2586
  /**
@@ -2546,12 +2768,55 @@ const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2546
2768
  })))));
2547
2769
  });
2548
2770
 
2549
- const _excluded$9 = ["className", "data", "dotRole", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "dateParser"];
2771
+ var interactive$5 = "interactive";
2772
+ var enUS$2 = {
2773
+ interactive: interactive$5,
2774
+ "static": "static",
2775
+ "interactive-chart": "Interactive Line Chart",
2776
+ "static-chart": "Static Line Chart",
2777
+ "definition-linear": "Linear Line Chart with {circleLength} circles.",
2778
+ "definition-linear-with-categories": "Linear Line Chart with {categoryLength} categories and {circleLength} circles.",
2779
+ "definition-ordinal": "Ordinal Line Chart with {circleLength} circles.",
2780
+ "x-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying numbers from {start, number} to {end, number}.",
2781
+ "y-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying numbers from {start, number} to {end, number}.",
2782
+ "x-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying dates from {start, date, ::yyyyMMdd} to {end, date, ::yyyyMMdd}.",
2783
+ "y-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying dates from {start, date, ::yyyyMMdd} to {end, date, ::yyyyMMdd}.",
2784
+ "x-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying categories.",
2785
+ "y-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying categories.",
2786
+ "series-legend": "{category}, line {categoryIndex} of {categoryLength} with {circleLength} circles"
2787
+ };
2788
+
2789
+ var interactive$4 = "interactif";
2790
+ var frFR$2 = {
2791
+ interactive: interactive$4,
2792
+ "static": "statique",
2793
+ "interactive-chart": "Graphique en courbe interactif",
2794
+ "static-chart": "Graphique en courbe statique",
2795
+ "definition-linear": "Graphique en courbe contenant {circleLength} points répartis sur un axe linéraire.",
2796
+ "definition-linear-with-categories": "Graphique en courbe contenant {categoryLength} courbes et {circleLength} points répartis sur un axe linéraire.",
2797
+ "definition-ordinal": "Graphique en courbe contenant {circleLength} points.",
2798
+ "x-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des nombres allant de {start, number} à {end, number}.",
2799
+ "y-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des nombres allant de {start, number} à {end, number}.",
2800
+ "x-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
2801
+ "y-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
2802
+ "x-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des categories.",
2803
+ "y-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des categories.",
2804
+ "series-legend": "{category}, courbe {categoryIndex} sur {categoryLength} contenant {circleLength} points"
2805
+ };
2806
+
2807
+ var intlMessages$2 = {
2808
+ 'en-US': enUS$2,
2809
+ 'fr-FR': frFR$2
2810
+ };
2811
+
2812
+ const _excluded$9 = ["className", "data", "dotRole", "getDotAnchorProps", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "dateParser"],
2813
+ _excluded2$2 = ["extraLegendItems"];
2550
2814
  const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2551
2815
  const {
2552
2816
  className,
2553
2817
  data: propsData,
2554
2818
  dotRole,
2819
+ getDotAnchorProps,
2555
2820
  id,
2556
2821
  isDotSelected,
2557
2822
  labelDecorator,
@@ -2590,6 +2855,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2590
2855
  forwardedProps = _objectWithoutProperties(props, _excluded$9);
2591
2856
  const cache = useRef();
2592
2857
  const theme = useTheme();
2858
+ const format = useMessageFormatter(intlMessages$2);
2593
2859
  const xScaleType = propsData[0].key[0] instanceof Date ? 'Date' : typeof propsData[0].key[0] === 'number' ? 'number' : typeof propsData[0].key[0] === 'string' && isValidDate(propsData[0].key[0]) ? 'dateString' : typeof propsData[0].key[0] === 'string' ? 'string' : undefined;
2594
2860
  const data = xScaleType === 'number' ? propsData.filter(datum => typeof datum.key[0] === 'number' && !Number.isNaN(datum.key[0])) : xScaleType === 'dateString' ? propsData.filter(datum => isValidDate(datum.key[0])) : xScaleType === 'string' ? propsData.filter(datum => typeof datum.key[0] === 'string') : xScaleType === 'Date' ? propsData.filter(datum => datum.key[0] instanceof Date) : propsData;
2595
2861
  useEffect(() => {
@@ -2669,16 +2935,19 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2669
2935
  return 0;
2670
2936
  }
2671
2937
  return 0;
2672
- }).filter(d => d.value !== null).map(d => ({
2673
- category: d.key[1],
2674
- x: xScaleType === 'dateString' ? dateParser ? dateParser(d.key[0]) : new Date(Date.parse(d.key[0])) : d.key[0],
2675
- y: d.value,
2676
- data: {
2677
- key: d.key,
2678
- value: d.value
2679
- },
2680
- points: [d]
2681
- }));
2938
+ }).filter(d => d.value !== null).map(d => {
2939
+ var _d$key$;
2940
+ return {
2941
+ category: (_d$key$ = d.key[1]) !== null && _d$key$ !== void 0 ? _d$key$ : 'default',
2942
+ x: xScaleType === 'dateString' ? dateParser ? dateParser(d.key[0]) : new Date(Date.parse(d.key[0])) : d.key[0],
2943
+ y: d.value,
2944
+ data: {
2945
+ key: d.key,
2946
+ value: d.value
2947
+ },
2948
+ points: [d]
2949
+ };
2950
+ });
2682
2951
  const lines = hasCategory ? Object.values(circles.reduce((prev, curr) => {
2683
2952
  if (!prev[curr.category]) {
2684
2953
  prev[curr.category] = [];
@@ -2687,7 +2956,83 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2687
2956
  return prev;
2688
2957
  }, {})) : [circles];
2689
2958
  const createLine = line().x(d => scaleX(d.x)).y(d => scaleY(d.y));
2690
- return /*#__PURE__*/React__default.createElement(StyledLineChart, _extends({}, forwardedProps, {
2959
+ const categories = [];
2960
+ const pivotedTable = circles.reduce((acc, item) => {
2961
+ const {
2962
+ x,
2963
+ category,
2964
+ y
2965
+ } = item;
2966
+ if (!categories.includes(category)) {
2967
+ categories.push(category);
2968
+ }
2969
+ const formattedKey = xAxisTickFormat ? xAxisTickFormat(x) : x.toString();
2970
+ let entry = acc.find(e => e.key === formattedKey);
2971
+ if (!entry) {
2972
+ entry = {
2973
+ key: formattedKey
2974
+ };
2975
+ acc.push(entry);
2976
+ }
2977
+ entry[category] = y;
2978
+ return acc;
2979
+ }, []);
2980
+ const _ref11 = legendProps || {},
2981
+ {
2982
+ extraLegendItems
2983
+ } = _ref11,
2984
+ forwardedLegendProps = _objectWithoutProperties(_ref11, _excluded2$2);
2985
+ return /*#__PURE__*/React__default.createElement(StyledLineChart, _extends({
2986
+ mode: typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive') : format('static'),
2987
+ definition: hasCategory ? format('definition-linear-with-categories', {
2988
+ categoryLength: categories.length,
2989
+ circleLength: circles.length
2990
+ }) : format('definition-linear', {
2991
+ circleLength: circles.length
2992
+ }),
2993
+ xAxisDefinition: xScaleType !== 'string' ? format(`x-axis-${xScaleType === 'number' ? 'numbers' : 'dates'}-definition`, {
2994
+ numAxis: xAxisPlacement === 'both' ? 2 : 1,
2995
+ start: scaleX.domain()[0],
2996
+ end: scaleX.domain()[1]
2997
+ }) : format('x-axis-categories-definition', {
2998
+ numAxis: xAxisPlacement === 'both' ? 2 : 1
2999
+ }),
3000
+ yAxisDefinition: format('y-axis-numbers-definition', {
3001
+ numAxis: yAxisPlacement === 'both' ? 2 : 1,
3002
+ start: scaleY.domain()[0],
3003
+ end: scaleY.domain()[1]
3004
+ }),
3005
+ dataTableRepresentation: hasCategory ? {
3006
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
3007
+ scope: "col"
3008
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
3009
+ key: category,
3010
+ scope: "col"
3011
+ }, category)))),
3012
+ body: /*#__PURE__*/React__default.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React__default.createElement("tr", {
3013
+ key: row.key
3014
+ }, /*#__PURE__*/React__default.createElement("th", {
3015
+ scope: "row"
3016
+ }, row.key), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
3017
+ key: `${row.key}-${category}-${row[category]}`,
3018
+ scope: "col"
3019
+ }, row[category])))))
3020
+ } : {
3021
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
3022
+ scope: "col"
3023
+ }, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React__default.createElement("th", {
3024
+ scope: "col"
3025
+ }, "Value"))),
3026
+ body: /*#__PURE__*/React__default.createElement("tbody", null, circles.map(datum => {
3027
+ const key = xAxisTickFormat ? xAxisTickFormat(datum.x) : datum.x.toString();
3028
+ return /*#__PURE__*/React__default.createElement("tr", {
3029
+ key: key
3030
+ }, /*#__PURE__*/React__default.createElement("th", {
3031
+ scope: "row"
3032
+ }, key), /*#__PURE__*/React__default.createElement("td", null, datum.y));
3033
+ }))
3034
+ }
3035
+ }, forwardedProps, {
2691
3036
  id: id,
2692
3037
  className: className,
2693
3038
  ref: ref
@@ -2698,9 +3043,12 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2698
3043
  }, /*#__PURE__*/React__default.createElement("svg", {
2699
3044
  ref: svgRef,
2700
3045
  width: width,
2701
- height: height
3046
+ height: height,
3047
+ "aria-label": typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
3048
+ "aria-hidden": "false"
2702
3049
  }, /*#__PURE__*/React__default.createElement("g", {
2703
- transform: `translate(${margins.left},${margins.top})`
3050
+ transform: `translate(${margins.left},${margins.top})`,
3051
+ "aria-hidden": "true"
2704
3052
  }, lines.map((line, index) => {
2705
3053
  return /*#__PURE__*/React__default.createElement(Line, {
2706
3054
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(line[0].category),
@@ -2708,32 +3056,42 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2708
3056
  createLine: createLine,
2709
3057
  key: `line _${index}`
2710
3058
  });
2711
- })), /*#__PURE__*/React__default.createElement("g", {
2712
- transform: `translate(${margins.left},${margins.top})`
2713
- }, circles.map((circle, index) => {
2714
- const scaleXDomain = scaleX.domain();
2715
- const scaleYDomain = scaleY.domain();
2716
- if (xScaleType === 'number' && (circle.x < scaleXDomain[0] || circle.x > scaleXDomain[1] || circle.y < scaleYDomain[0] || circle.y > scaleYDomain[1])) {
2717
- return null;
2718
- }
2719
- const to = _objectSpread2(_objectSpread2({}, circle), {}, {
2720
- r: 4
2721
- });
2722
- return /*#__PURE__*/React__default.createElement(Dot, {
2723
- color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(circle.category),
2724
- data: to,
2725
- isSelected: Boolean(isDotSelected === null || isDotSelected === void 0 ? void 0 : isDotSelected(to)),
2726
- key: `circle _${index}`,
2727
- labelDecorator: labelDecorator,
2728
- onClick: onDotClick,
2729
- role: dotRole,
2730
- scaleX: scaleX,
2731
- scaleY: scaleY,
2732
- tooltipDecorator: tooltipDecorator,
2733
- tooltipVariant: tooltipVariant,
2734
- variant: DotVariant.hollow
2735
- });
2736
- })), /*#__PURE__*/React__default.createElement("g", {
3059
+ })), categories.map((category, categoryIndex) => {
3060
+ const filteredCircles = circles.filter(circle => circle.category === category);
3061
+ return /*#__PURE__*/React__default.createElement("g", _extends({
3062
+ key: `${id}-series-${category}`,
3063
+ transform: `translate(${margins.left},${margins.top})`,
3064
+ "aria-hidden": "false",
3065
+ role: "region"
3066
+ }, hasCategory ? {
3067
+ 'aria-label': `${category}, category ${categoryIndex + 1} of ${categories.length} with ${filteredCircles.length} circles`
3068
+ } : {}), filteredCircles.map((circle, index) => {
3069
+ const scaleXDomain = scaleX.domain();
3070
+ const scaleYDomain = scaleY.domain();
3071
+ if (xScaleType === 'number' && (circle.x < scaleXDomain[0] || circle.x > scaleXDomain[1] || circle.y < scaleYDomain[0] || circle.y > scaleYDomain[1])) {
3072
+ return null;
3073
+ }
3074
+ const to = _objectSpread2(_objectSpread2({}, circle), {}, {
3075
+ r: 4
3076
+ });
3077
+ return /*#__PURE__*/React__default.createElement(Dot, {
3078
+ id: `id${id}__circle-${categoryIndex}.${index}`,
3079
+ color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(circle.category),
3080
+ data: to,
3081
+ isSelected: Boolean(isDotSelected === null || isDotSelected === void 0 ? void 0 : isDotSelected(to)),
3082
+ anchorProps: getDotAnchorProps ? getDotAnchorProps(to) : undefined,
3083
+ key: `circle _${categoryIndex}.${index}`,
3084
+ labelDecorator: labelDecorator,
3085
+ onClick: onDotClick,
3086
+ role: dotRole,
3087
+ scaleX: scaleX,
3088
+ scaleY: scaleY,
3089
+ tooltipDecorator: tooltipDecorator,
3090
+ tooltipVariant: tooltipVariant,
3091
+ variant: DotVariant.hollow
3092
+ });
3093
+ }));
3094
+ }), /*#__PURE__*/React__default.createElement("g", {
2737
3095
  transform: `translate(${margins.left},${margins.top})`
2738
3096
  }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
2739
3097
  position: "bottom",
@@ -2788,33 +3146,21 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2788
3146
  tickRemodelling: yAxisTickRemodelling,
2789
3147
  variant: yAxisVariant
2790
3148
  }) : null))), hasCategory && legendVariant !== LineChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
2791
- data: statsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3149
+ data: (extraLegendItems ? [...statsByCategory, ...extraLegendItems] : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2792
3150
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
2793
3151
  })),
2794
3152
  variant: legendVariant === LineChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === LineChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === LineChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
2795
3153
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
2796
- }, legendProps)) : null);
3154
+ }, forwardedLegendProps)) : null);
2797
3155
  });
2798
3156
 
2799
- const _excluded$8 = ["className", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "colorTheme", "tooltipDecorator", "tooltipVariant"];
3157
+ const _excluded$8 = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
2800
3158
  const COMPONENT_NAME$2 = 'LineChart';
2801
3159
  const CLASSNAME$2 = 'redsift-line-chart';
2802
- const DEFAULT_PROPS$2 = {
2803
- localeText: {
2804
- emptyChartText: 'No Data'
2805
- },
2806
- size: ChartSize.medium,
2807
- sortingMethod: 'desc-value',
2808
- colorTheme: ColorTheme.dark,
2809
- tooltipVariant: TooltipVariant.none,
2810
- xAxisVariant: AxisVariant.default,
2811
- xAxisPlacement: 'bottom',
2812
- yAxisVariant: AxisVariant.default,
2813
- yAxisPlacement: 'left'
2814
- };
2815
3160
  const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
2816
3161
  const {
2817
3162
  className,
3163
+ colorTheme = ColorTheme.dark,
2818
3164
  data: propsData,
2819
3165
  dotRole,
2820
3166
  emptyComponent,
@@ -2823,12 +3169,18 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
2823
3169
  labelDecorator,
2824
3170
  legendDecorator,
2825
3171
  legendVariant: propsLegendVariant,
2826
- localeText,
3172
+ localeText = {
3173
+ emptyChartText: 'No Data'
3174
+ },
2827
3175
  onDotClick,
2828
- size,
2829
- colorTheme,
3176
+ size = ChartSize.medium,
3177
+ sortingMethod = 'desc-value',
2830
3178
  tooltipDecorator,
2831
- tooltipVariant
3179
+ tooltipVariant = TooltipVariant.none,
3180
+ xAxisPlacement = 'bottom',
3181
+ xAxisVariant = AxisVariant.default,
3182
+ yAxisPlacement = 'left',
3183
+ yAxisVariant = AxisVariant.default
2832
3184
  } = props,
2833
3185
  forwardedProps = _objectWithoutProperties(props, _excluded$8);
2834
3186
  const [_id] = useId();
@@ -2846,13 +3198,19 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
2846
3198
  data: propsData,
2847
3199
  emptyComponent: emptyComponent,
2848
3200
  localeText: localeText,
2849
- size: size
3201
+ size: size,
3202
+ sortingMethod: sortingMethod,
3203
+ xAxisPlacement: xAxisPlacement,
3204
+ xAxisVariant: xAxisVariant,
3205
+ yAxisPlacement: yAxisPlacement,
3206
+ yAxisVariant: yAxisVariant
2850
3207
  }, forwardedProps, {
2851
3208
  ref: ref
2852
3209
  }));
2853
3210
  }
2854
3211
  return /*#__PURE__*/React__default.createElement(RenderedLineChart, _extends({
2855
3212
  className: classNames(LineChart.className, className),
3213
+ colorTheme: colorTheme,
2856
3214
  data: propsData,
2857
3215
  dotRole: dotRole,
2858
3216
  id: id,
@@ -2863,15 +3221,18 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
2863
3221
  localeText: localeText,
2864
3222
  onDotClick: onDotClick,
2865
3223
  size: size,
2866
- colorTheme: colorTheme,
3224
+ sortingMethod: sortingMethod,
2867
3225
  tooltipDecorator: tooltipDecorator,
2868
- tooltipVariant: tooltipVariant
3226
+ tooltipVariant: tooltipVariant,
3227
+ xAxisPlacement: xAxisPlacement,
3228
+ xAxisVariant: xAxisVariant,
3229
+ yAxisPlacement: yAxisPlacement,
3230
+ yAxisVariant: yAxisVariant
2869
3231
  }, forwardedProps, {
2870
3232
  ref: ref
2871
3233
  }));
2872
3234
  });
2873
3235
  LineChart.className = CLASSNAME$2;
2874
- LineChart.defaultProps = DEFAULT_PROPS$2;
2875
3236
  LineChart.displayName = COMPONENT_NAME$2;
2876
3237
 
2877
3238
  /**
@@ -3168,12 +3529,39 @@ const EmptyPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3168
3529
  }))));
3169
3530
  });
3170
3531
 
3171
- const _excluded$5 = ["caping", "className", "data", "id", "isHalf", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "sortingMethod", "subtext", "text", "colorTheme", "tooltipVariant", "variant"];
3532
+ var interactive$3 = "interactive";
3533
+ var definition$2 = "Pie Chart with {sliceLength} slices.";
3534
+ var enUS$1 = {
3535
+ interactive: interactive$3,
3536
+ "static": "static",
3537
+ "interactive-chart": "Interactive Line Chart",
3538
+ "static-chart": "Static Line Chart",
3539
+ definition: definition$2
3540
+ };
3541
+
3542
+ var interactive$2 = "interactif";
3543
+ var definition$1 = "Diagramme circulaire contenant {sliceLength} secteurs.";
3544
+ var frFR$1 = {
3545
+ interactive: interactive$2,
3546
+ "static": "statique",
3547
+ "interactive-chart": "Diagramme circulaire interactif",
3548
+ "static-chart": "Diagramme circulaire statique",
3549
+ definition: definition$1
3550
+ };
3551
+
3552
+ var intlMessages$1 = {
3553
+ 'en-US': enUS$1,
3554
+ 'fr-FR': frFR$1
3555
+ };
3556
+
3557
+ const _excluded$5 = ["caping", "className", "data", "getSliceAnchorProps", "id", "isHalf", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "sortingMethod", "subtext", "text", "colorTheme", "tooltipVariant", "variant"],
3558
+ _excluded2$1 = ["extraLegendItems"];
3172
3559
  const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3173
3560
  const {
3174
3561
  caping,
3175
3562
  className,
3176
3563
  data: propsData,
3564
+ getSliceAnchorProps,
3177
3565
  id,
3178
3566
  isHalf,
3179
3567
  isSliceSelected,
@@ -3197,6 +3585,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3197
3585
  forwardedProps = _objectWithoutProperties(props, _excluded$5);
3198
3586
  const cache = useRef();
3199
3587
  const theme = useTheme();
3588
+ const format = useMessageFormatter(intlMessages$1);
3200
3589
  const isDonut = variant === PieChartVariant.donut || variant === PieChartVariant.spacedDonut;
3201
3590
  const isSpaced = variant === PieChartVariant.spaced || variant === PieChartVariant.spacedDonut;
3202
3591
  const {
@@ -3254,7 +3643,30 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3254
3643
  })
3255
3644
  });
3256
3645
  }), total) : propsMiddleText;
3257
- return /*#__PURE__*/React__default.createElement(StyledPieChart, _extends({}, forwardedProps, {
3646
+ const filteredPieData = pieData.filter(datum => datum.data.value);
3647
+ const _ref = legendProps || {},
3648
+ {
3649
+ extraLegendItems
3650
+ } = _ref,
3651
+ forwardedLegendProps = _objectWithoutProperties(_ref, _excluded2$1);
3652
+ return /*#__PURE__*/React__default.createElement(StyledPieChart, _extends({
3653
+ mode: typeof onSliceClick === 'function' || typeof getSliceAnchorProps === 'function' ? format('interactive') : format('static'),
3654
+ definition: format('definition', {
3655
+ sliceLength: filteredPieData.length
3656
+ }),
3657
+ dataTableRepresentation: {
3658
+ header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
3659
+ scope: "col"
3660
+ }, "Key"), /*#__PURE__*/React__default.createElement("th", {
3661
+ scope: "col"
3662
+ }, "Value"))),
3663
+ body: /*#__PURE__*/React__default.createElement("tbody", null, filteredPieData.map(datum => /*#__PURE__*/React__default.createElement("tr", {
3664
+ key: datum.data.key
3665
+ }, /*#__PURE__*/React__default.createElement("th", {
3666
+ scope: "row"
3667
+ }, datum.data.key), /*#__PURE__*/React__default.createElement("td", null, datum.data.value))))
3668
+ }
3669
+ }, forwardedProps, {
3258
3670
  className: className,
3259
3671
  id: id,
3260
3672
  ref: ref
@@ -3267,9 +3679,11 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3267
3679
  $theme: theme
3268
3680
  }, subtext ? /*#__PURE__*/React__default.createElement("b", null, text) : /*#__PURE__*/React__default.createElement("span", null, text), middleText ? /*#__PURE__*/React__default.createElement("b", null, middleText) : null, /*#__PURE__*/React__default.createElement("span", null, subtext)) : null, /*#__PURE__*/React__default.createElement("svg", {
3269
3681
  width: width,
3270
- height: isHalf ? height + externalRadiusPadding : height
3682
+ height: isHalf ? height + externalRadiusPadding : height,
3683
+ "aria-label": typeof onSliceClick === 'function' || typeof getSliceAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
3684
+ "aria-hidden": "false"
3271
3685
  }, /*#__PURE__*/React__default.createElement(Arcs, {
3272
- arcs: pieData.filter(datum => datum.data.value).map((datum, index) => {
3686
+ arcs: filteredPieData.map((datum, index) => {
3273
3687
  const percent = datum.data.value / total;
3274
3688
  const from = previousPieData ? previousPieData[index] : {
3275
3689
  data: {
@@ -3291,11 +3705,12 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3291
3705
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
3292
3706
  createArc,
3293
3707
  previousData: from,
3294
- id: `id${id}__bar-${index}`,
3708
+ id: `id${id}__arc-${index}`,
3295
3709
  index,
3296
3710
  isSelected: isSliceSelected(to),
3297
- key: `id${id}__bar-${index}`,
3298
- data: to
3711
+ key: `id${id}__arc-${index}`,
3712
+ data: to,
3713
+ anchorProps: getSliceAnchorProps ? getSliceAnchorProps(to) : undefined
3299
3714
  };
3300
3715
  }),
3301
3716
  hasLabels: legendVariant === PieChartLegendVariant.internal,
@@ -3307,56 +3722,46 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3307
3722
  tooltipVariant: tooltipVariant,
3308
3723
  transform: `translate(${width / 2} ${isHalf ? height : height / 2})`
3309
3724
  }))), legendVariant !== PieChartLegendVariant.none && legendVariant !== PieChartLegendVariant.internal ? /*#__PURE__*/React__default.createElement(Legend, _extends({
3310
- data: data.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3725
+ data: (extraLegendItems ? [...data, ...extraLegendItems] : data).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3311
3726
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
3312
3727
  })),
3313
3728
  variant: legendVariant === PieChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === PieChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === PieChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
3314
3729
  width: legendWidth.current,
3315
3730
  labelDecorator: labelDecorator ? (datum, props) => labelDecorator(datum, props) : undefined,
3316
3731
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
3317
- }, legendProps)) : null);
3732
+ }, forwardedLegendProps)) : null);
3318
3733
  });
3319
3734
 
3320
- const _excluded$4 = ["caping", "chartRef", "className", "data", "emptyComponent", "id", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "middleText", "onSliceClick", "others", "size", "sliceRole", "subtext", "text", "colorTheme", "tooltipDecorator", "tooltipVariant", "variant"];
3735
+ const _excluded$4 = ["caping", "chartRef", "className", "colorTheme", "data", "emptyComponent", "id", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "middleText", "onSliceClick", "others", "size", "sliceRole", "sortingMethod", "subtext", "text", "tooltipDecorator", "tooltipVariant", "variant"];
3321
3736
  const COMPONENT_NAME$1 = 'PieChart';
3322
3737
  const CLASSNAME$1 = 'redsift-piechart';
3323
- const DEFAULT_PROPS$1 = {
3324
- isSliceSelected: () => true,
3325
- // legendVariant: PieChartLegendVariant.none,
3326
- others: true,
3327
- size: ChartSize.medium,
3328
- sortingMethod: 'desc-value',
3329
- colorTheme: ColorTheme.default,
3330
- variant: PieChartVariant.spaced,
3331
- tooltipVariant: TooltipVariant.value,
3332
- localeText: {
3333
- emptyChartText: 'No Data'
3334
- }
3335
- };
3336
3738
  const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
3337
3739
  const {
3338
3740
  caping,
3339
3741
  chartRef,
3340
3742
  className,
3743
+ colorTheme = ColorTheme.default,
3341
3744
  data: propsData,
3342
3745
  emptyComponent,
3343
3746
  id: propsId,
3344
- isSliceSelected,
3747
+ isSliceSelected = () => true,
3345
3748
  labelDecorator,
3346
3749
  legendDecorator,
3347
3750
  legendVariant: propsLegendVariant,
3348
- localeText,
3751
+ localeText = {
3752
+ emptyChartText: 'No Data'
3753
+ },
3349
3754
  middleText,
3350
3755
  onSliceClick,
3351
- others,
3352
- size,
3756
+ others = true,
3757
+ size = ChartSize.medium,
3353
3758
  sliceRole,
3759
+ sortingMethod = 'desc-value',
3354
3760
  subtext,
3355
3761
  text,
3356
- colorTheme,
3357
3762
  tooltipDecorator,
3358
- tooltipVariant,
3359
- variant
3763
+ tooltipVariant = TooltipVariant.value,
3764
+ variant = PieChartVariant.spaced
3360
3765
  } = props,
3361
3766
  forwardedProps = _objectWithoutProperties(props, _excluded$4);
3362
3767
  const [_id] = useId();
@@ -3376,6 +3781,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
3376
3781
  id: id,
3377
3782
  localeText: localeText,
3378
3783
  size: size,
3784
+ sortingMethod: sortingMethod,
3379
3785
  variant: variant
3380
3786
  }, forwardedProps, {
3381
3787
  ref: ref
@@ -3396,6 +3802,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
3396
3802
  others: others,
3397
3803
  size: size,
3398
3804
  sliceRole: sliceRole,
3805
+ sortingMethod: sortingMethod,
3399
3806
  subtext: subtext,
3400
3807
  text: text,
3401
3808
  colorTheme: colorTheme,
@@ -3407,7 +3814,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
3407
3814
  }));
3408
3815
  });
3409
3816
  PieChart.className = CLASSNAME$1;
3410
- PieChart.defaultProps = DEFAULT_PROPS$1;
3411
3817
  PieChart.displayName = COMPONENT_NAME$1;
3412
3818
 
3413
3819
  /**
@@ -3605,18 +4011,56 @@ const EmptyScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3605
4011
  })))));
3606
4012
  });
3607
4013
 
4014
+ var interactive$1 = "interactive";
4015
+ var definition = "Linear Scatter Plot with {circleLength} circles.";
4016
+ var enUS = {
4017
+ interactive: interactive$1,
4018
+ "static": "static",
4019
+ "interactive-chart": "Interactive Scatter Plot",
4020
+ "static-chart": "Static Scatter Plot",
4021
+ definition: definition,
4022
+ "definition-with-categories": "Linear Scatter Plot with {categoryLength} categories and {circleLength} circles.",
4023
+ "x-axis-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying numbers from {start, number} to {end, number}.",
4024
+ "y-axis-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying numbers from {start, number} to {end, number}."
4025
+ };
4026
+
4027
+ var interactive = "interactif";
4028
+ var frFR = {
4029
+ interactive: interactive,
4030
+ "static": "statique",
4031
+ "interactive-chart": "Graphique en courbe interactif",
4032
+ "static-chart": "Graphique en courbe statique",
4033
+ "definition-linear": "Graphique en courbe contenant {circleLength} points répartis sur un axe linéraire.",
4034
+ "definition-linear-with-categories": "Graphique en courbe contenant {categoryLength} courbes et {circleLength} points répartis sur un axe linéraire.",
4035
+ "definition-ordinal": "Graphique en courbe contenant {circleLength} points.",
4036
+ "x-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des nombres allant de {start, number} à {end, number}.",
4037
+ "y-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des nombres allant de {start, number} à {end, number}.",
4038
+ "x-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
4039
+ "y-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
4040
+ "x-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des categories.",
4041
+ "y-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des categories.",
4042
+ "series-legend": "{category}, courbe {categoryIndex} sur {categoryLength} contenant {circleLength} points"
4043
+ };
4044
+
4045
+ var intlMessages = {
4046
+ 'en-US': enUS,
4047
+ 'fr-FR': frFR
4048
+ };
4049
+
3608
4050
  // Material Design Icons v7.2.96
3609
4051
  var mdiChevronDown = "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z";
3610
4052
  var mdiChevronRight = "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";
3611
4053
  var mdiMouse = "M11,1.07C7.05,1.56 4,4.92 4,9H11M4,15A8,8 0 0,0 12,23A8,8 0 0,0 20,15V11H4M13,1.07V9H20C20,4.92 16.94,1.56 13,1.07Z";
3612
4054
 
3613
- const _excluded$1 = ["isBrushable", "className", "data", "dotRole", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "variant"];
4055
+ const _excluded$1 = ["isBrushable", "className", "data", "dotRole", "getDotAnchorProps", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "variant"],
4056
+ _excluded2 = ["extraLegendItems"];
3614
4057
  const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3615
4058
  const {
3616
4059
  isBrushable,
3617
4060
  className,
3618
4061
  data: propsData,
3619
4062
  dotRole,
4063
+ getDotAnchorProps,
3620
4064
  hideControlKeyPanel,
3621
4065
  id,
3622
4066
  isDotSelected,
@@ -3652,6 +4096,7 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3652
4096
  forwardedProps = _objectWithoutProperties(props, _excluded$1);
3653
4097
  const cache = useRef();
3654
4098
  const theme = useTheme();
4099
+ const format = useMessageFormatter(intlMessages);
3655
4100
  const data = propsData.filter(datum => datum.value && typeof datum.key[0] === 'number' && !Number.isNaN(datum.key[0]) && typeof datum.key[1] === 'number' && !Number.isNaN(datum.key[1]));
3656
4101
  useEffect(() => {
3657
4102
  cache.current = data;
@@ -3720,23 +4165,76 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3720
4165
  onBrush,
3721
4166
  onBrushEnd
3722
4167
  });
3723
- const circles = variant === ScatterPlotVariant.gridded ? group(data, scaleX, scaleY).sort((a, b) => descending(a.points.length, b.points.length)) : data.map(d => ({
3724
- category: d.key[2],
3725
- x: d.key[0],
3726
- y: d.key[1],
3727
- data: {
3728
- key: d.key,
3729
- value: 1
3730
- },
3731
- points: [d]
3732
- }));
4168
+ const circles = variant === ScatterPlotVariant.gridded ? group(data, scaleX, scaleY).sort((a, b) => {
4169
+ if (a.y !== b.y) {
4170
+ return b.y - a.y;
4171
+ }
4172
+ if (a.x !== b.x) {
4173
+ return a.x - b.x;
4174
+ }
4175
+ return descending(a.points.length, b.points.length);
4176
+ }) : data.map(d => {
4177
+ var _d$key$;
4178
+ return {
4179
+ category: (_d$key$ = d.key[2]) !== null && _d$key$ !== void 0 ? _d$key$ : 'default',
4180
+ x: d.key[0],
4181
+ y: d.key[1],
4182
+ data: {
4183
+ key: d.key,
4184
+ value: 1
4185
+ },
4186
+ points: [d]
4187
+ };
4188
+ });
3733
4189
  const globalSize = variant === ScatterPlotVariant.gridded ? scaleSqrt().domain([1, Math.max(max(circles, d => d.points.length), 1)]).range([3, minSize / BASE_NUMBER_OF_TICKS / 2]) : undefined;
3734
4190
  const legendWidth = useRef();
3735
4191
  if (countsByCategory && !legendWidth.current) {
3736
4192
  legendWidth.current = `${Math.max(...countsByCategory.map(d => d.key.length + String(d.value).length)) * 8 + 32}px`;
3737
4193
  }
3738
4194
  const [isKeyPanelOpen, setIsKeyPanelOpen] = useState(false);
3739
- return /*#__PURE__*/React__default.createElement(StyledScatterPlot, _extends({}, forwardedProps, {
4195
+ const categories = [];
4196
+ // const pivotedTable = circles.reduce((acc, item) => {
4197
+ // const { x, category, y } = item;
4198
+ // if (!categories.includes(category)) {
4199
+ // categories.push(category);
4200
+ // }
4201
+ // const formattedKey = xAxisTickFormat ? xAxisTickFormat(x as any) : x.toString();
4202
+
4203
+ // let entry = acc.find((e) => e.key === formattedKey);
4204
+ // if (!entry) {
4205
+ // entry = { key: formattedKey };
4206
+ // acc.push(entry);
4207
+ // }
4208
+
4209
+ // entry[category] = y;
4210
+
4211
+ // return acc;
4212
+ // }, [] as Array<Record<string, string | number | null | undefined> & { key: string }>);
4213
+
4214
+ const _ref = legendProps || {},
4215
+ {
4216
+ extraLegendItems
4217
+ } = _ref,
4218
+ forwardedLegendProps = _objectWithoutProperties(_ref, _excluded2);
4219
+ return /*#__PURE__*/React__default.createElement(StyledScatterPlot, _extends({
4220
+ mode: typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive') : format('static'),
4221
+ definition: hasCategory ? format('definition-with-categories', {
4222
+ categoryLength: categories.length,
4223
+ circleLength: circles.length
4224
+ }) : format('definition', {
4225
+ circleLength: circles.length
4226
+ }),
4227
+ xAxisDefinition: format('x-axis-definition', {
4228
+ numAxis: xAxisPlacement === 'both' ? 2 : 1,
4229
+ start: scaleX.domain()[0],
4230
+ end: scaleX.domain()[1]
4231
+ }),
4232
+ yAxisDefinition: format('y-axis-definition', {
4233
+ numAxis: yAxisPlacement === 'both' ? 2 : 1,
4234
+ start: scaleY.domain()[0],
4235
+ end: scaleY.domain()[1]
4236
+ })
4237
+ }, forwardedProps, {
3740
4238
  id: id,
3741
4239
  className: className,
3742
4240
  ref: ref
@@ -3796,10 +4294,10 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3796
4294
  }
3797
4295
  const to = _objectSpread2(_objectSpread2({}, circle), {}, {
3798
4296
  data: _objectSpread2(_objectSpread2({}, circle.data), {}, {
3799
- percent: circle.category ? circle.data.value / (countsByCategory === null || countsByCategory === void 0 ? void 0 : (_countsByCategory$fin = countsByCategory.find(_ref => {
4297
+ percent: circle.category ? circle.data.value / (countsByCategory === null || countsByCategory === void 0 ? void 0 : (_countsByCategory$fin = countsByCategory.find(_ref2 => {
3800
4298
  let {
3801
4299
  key
3802
- } = _ref;
4300
+ } = _ref2;
3803
4301
  return key === circle.category;
3804
4302
  })) === null || _countsByCategory$fin === void 0 ? void 0 : _countsByCategory$fin.value) : undefined
3805
4303
  }),
@@ -3869,54 +4367,46 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3869
4367
  tickFormat: yAxisTickFormat,
3870
4368
  variant: yAxisVariant
3871
4369
  }) : null))), hasCategory && legendVariant !== ScatterPlotLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
3872
- data: countsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
4370
+ data: (extraLegendItems ? [...countsByCategory, ...extraLegendItems] : countsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3873
4371
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
3874
4372
  })),
3875
4373
  variant: legendVariant === ScatterPlotLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === ScatterPlotLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === ScatterPlotLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
3876
4374
  width: legendWidth.current,
3877
4375
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
3878
- }, legendProps)) : null);
4376
+ }, forwardedLegendProps)) : null);
3879
4377
  });
3880
4378
 
3881
- const _excluded = ["className", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBrush", "onBrushEnd", "onDotClick", "size", "colorTheme", "tooltipDecorator", "tooltipVariant", "variant"];
4379
+ const _excluded = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "variant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
3882
4380
  const COMPONENT_NAME = 'ScatterPlot';
3883
4381
  const CLASSNAME = 'redsift-scatterplot';
3884
- const DEFAULT_PROPS = {
3885
- hideControlKeyPanel: false,
3886
- // legendVariant: ScatterPlotLegendVariant.externalLabel,
3887
- localeText: {
3888
- emptyChartText: 'No Data'
3889
- },
3890
- size: ChartSize.medium,
3891
- sortingMethod: 'desc-value',
3892
- colorTheme: ColorTheme.default,
3893
- tooltipVariant: TooltipVariant.none,
3894
- variant: ScatterPlotVariant.default,
3895
- xAxisVariant: AxisVariant.default,
3896
- xAxisPlacement: 'bottom',
3897
- yAxisVariant: AxisVariant.default,
3898
- yAxisPlacement: 'left'
3899
- };
3900
4382
  const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3901
4383
  const {
3902
4384
  className,
4385
+ colorTheme = ColorTheme.default,
3903
4386
  data: propsData,
3904
4387
  dotRole,
3905
4388
  emptyComponent,
4389
+ hideControlKeyPanel = false,
3906
4390
  id: propsId,
3907
4391
  isDotSelected,
3908
4392
  labelDecorator,
3909
4393
  legendDecorator,
3910
4394
  legendVariant: propsLegendVariant,
3911
- localeText,
4395
+ localeText = {
4396
+ emptyChartText: 'No Data'
4397
+ },
3912
4398
  onBrush,
3913
4399
  onBrushEnd,
3914
4400
  onDotClick,
3915
- size,
3916
- colorTheme,
4401
+ size = ChartSize.medium,
4402
+ sortingMethod = 'desc-value',
3917
4403
  tooltipDecorator,
3918
- tooltipVariant,
3919
- variant
4404
+ tooltipVariant = TooltipVariant.none,
4405
+ variant = ScatterPlotVariant.default,
4406
+ xAxisPlacement = 'bottom',
4407
+ xAxisVariant = AxisVariant.default,
4408
+ yAxisPlacement = 'left',
4409
+ yAxisVariant = AxisVariant.default
3920
4410
  } = props,
3921
4411
  forwardedProps = _objectWithoutProperties(props, _excluded);
3922
4412
  const [_id] = useId();
@@ -3933,16 +4423,24 @@ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3933
4423
  return /*#__PURE__*/React__default.createElement(EmptyScatterPlot, _extends({
3934
4424
  data: propsData,
3935
4425
  emptyComponent: emptyComponent,
4426
+ hideControlKeyPanel: hideControlKeyPanel,
3936
4427
  localeText: localeText,
3937
- size: size
4428
+ size: size,
4429
+ sortingMethod: sortingMethod,
4430
+ xAxisPlacement: xAxisPlacement,
4431
+ xAxisVariant: xAxisVariant,
4432
+ yAxisPlacement: yAxisPlacement,
4433
+ yAxisVariant: yAxisVariant
3938
4434
  }, forwardedProps, {
3939
4435
  ref: ref
3940
4436
  }));
3941
4437
  }
3942
4438
  return /*#__PURE__*/React__default.createElement(RenderedScatterPlot, _extends({
3943
4439
  className: classNames(ScatterPlot.className, className),
4440
+ colorTheme: colorTheme,
3944
4441
  data: propsData,
3945
4442
  dotRole: dotRole,
4443
+ hideControlKeyPanel: hideControlKeyPanel,
3946
4444
  id: id,
3947
4445
  isDotSelected: isDotSelected,
3948
4446
  labelDecorator: labelDecorator,
@@ -3953,16 +4451,19 @@ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3953
4451
  onBrushEnd: onBrushEnd,
3954
4452
  onDotClick: onDotClick,
3955
4453
  size: size,
3956
- colorTheme: colorTheme,
4454
+ sortingMethod: sortingMethod,
3957
4455
  tooltipDecorator: tooltipDecorator,
3958
4456
  tooltipVariant: tooltipVariant,
3959
- variant: variant
4457
+ variant: variant,
4458
+ xAxisPlacement: xAxisPlacement,
4459
+ xAxisVariant: xAxisVariant,
4460
+ yAxisPlacement: yAxisPlacement,
4461
+ yAxisVariant: yAxisVariant
3960
4462
  }, forwardedProps, {
3961
4463
  ref: ref
3962
4464
  }));
3963
4465
  });
3964
4466
  ScatterPlot.className = CLASSNAME;
3965
- ScatterPlot.defaultProps = DEFAULT_PROPS;
3966
4467
  ScatterPlot.displayName = COMPONENT_NAME;
3967
4468
 
3968
4469
  export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarChartLegendVariant, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, LegendVariant, Line, LineChart, LineChartLegendVariant, PieChart, PieChartLegendVariant, PieChartVariant, ScatterPlot, ScatterPlotLegendVariant, ScatterPlotVariant, StyledArc, StyledArcs, StyledAxis, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle, StyledDataPoint, StyledDot, StyledLegend, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledScatterPlot, StyledScatterPlotEmptyText, TooltipVariant, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };