@redsift/charts 10.3.0-alpha.8 → 10.3.0-alpha.9

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
@@ -363,7 +363,7 @@ var k=/^--/;function I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeo
363
363
  const StyledDataPoint = styled(it.g)``;
364
364
 
365
365
  const _excluded$q = ["as", "href"],
366
- _excluded2$1 = ["anchorProps", "children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
366
+ _excluded2$5 = ["anchorProps", "children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
367
367
  const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
368
368
  const {
369
369
  anchorProps: {
@@ -384,7 +384,7 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
384
384
  theme: propsTheme
385
385
  } = props,
386
386
  anchorProps = _objectWithoutProperties(props.anchorProps, _excluded$q),
387
- forwardedProps = _objectWithoutProperties(props, _excluded2$1);
387
+ forwardedProps = _objectWithoutProperties(props, _excluded2$5);
388
388
  const [_id] = useId();
389
389
  const id = propsId !== null && propsId !== void 0 ? propsId : _id;
390
390
  const theme = useTheme(propsTheme);
@@ -1094,9 +1094,7 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
1094
1094
  t: 0
1095
1095
  }
1096
1096
  }));
1097
- return /*#__PURE__*/React__default.createElement(StyledBar, _extends({
1098
- "aria-hidden": "false"
1099
- }, forwardedProps, {
1097
+ return /*#__PURE__*/React__default.createElement(StyledBar, _extends({}, forwardedProps, {
1100
1098
  ref: ref,
1101
1099
  className: classNames(Bar.className, className),
1102
1100
  transform: isHorizontal ? `translate(0, ${scalePosition(data.data.key) + gap / 2})` : `translate(${scalePosition(data.data.key) + (isOrdinal ? width + gap / 2 : width / 2)}, ${maxHeight}), rotate(180)`,
@@ -1136,7 +1134,7 @@ const BarChartLegendVariant = {
1136
1134
  */
1137
1135
 
1138
1136
  var reset$1 = "Reset";
1139
- var enUS = {
1137
+ var enUS$4 = {
1140
1138
  "static-chart": "Static chart.",
1141
1139
  "interactive-chart": "Interactive chart.",
1142
1140
  "view-as-data-table": "View as data table",
@@ -1145,7 +1143,7 @@ var enUS = {
1145
1143
  };
1146
1144
 
1147
1145
  var reset = "Réinitialiser";
1148
- var frFR = {
1146
+ var frFR$4 = {
1149
1147
  "static-chart": "Graphique statique.",
1150
1148
  "interactive-chart": "Graphique intéractif.",
1151
1149
  "view-as-data-table": "Voir au format table de données",
@@ -1153,9 +1151,9 @@ var frFR = {
1153
1151
  reset: reset
1154
1152
  };
1155
1153
 
1156
- var intlMessages = {
1157
- 'en-US': enUS,
1158
- 'fr-FR': frFR
1154
+ var intlMessages$4 = {
1155
+ 'en-US': enUS$4,
1156
+ 'fr-FR': frFR$4
1159
1157
  };
1160
1158
 
1161
1159
  /**
@@ -1259,7 +1257,7 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1259
1257
  const theme = useTheme(propsTheme);
1260
1258
  const [viewAsDataTable, setViewAsDataTable] = useState(false);
1261
1259
  warnIfNoAccessibleLabelFound(props, [title]);
1262
- const format = useMessageFormatter(intlMessages);
1260
+ const format = useMessageFormatter(intlMessages$4);
1263
1261
  const ariaLabel = propsAriaLabel ? propsAriaLabel : propsAriaLabelledby || title ? undefined : undefined;
1264
1262
  const ariaLabelledby = propsAriaLabelledby ? propsAriaLabelledby : title ? `id${id}__title` : undefined;
1265
1263
  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
@@ -1271,7 +1269,7 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1271
1269
  role: "region",
1272
1270
  "aria-hidden": "false"
1273
1271
  }, ariaLabel ? {
1274
- 'aria-label': `${ariaLabel}. ${format(`${mode}-chart`)}`
1272
+ 'aria-label': `${ariaLabel}. ${mode}`
1275
1273
  } : {}, ariaLabelledby ? {
1276
1274
  'aria-labelledby': `${ariaLabelledby} id${id}__interactive-or-not`
1277
1275
  } : {}, forwardedProps, {
@@ -1302,15 +1300,15 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
1302
1300
  style: {
1303
1301
  display: 'none'
1304
1302
  }
1305
- }, format(`${mode}-chart`)), ariaLabel ? /*#__PURE__*/React__default.createElement("p", null, `${ariaLabel}. ${format(`${mode}-chart`)}`) : /*#__PURE__*/React__default.createElement("p", {
1303
+ }, mode), ariaLabel ? /*#__PURE__*/React__default.createElement("p", null, `${ariaLabel}. ${mode}`) : /*#__PURE__*/React__default.createElement("p", {
1306
1304
  "aria-labelledby": `${ariaLabelledby} id${id}__interactive-or-not`
1307
- }), /*#__PURE__*/React__default.createElement("div", null, definition), /*#__PURE__*/React__default.createElement("div", null, interactionExplanation), /*#__PURE__*/React__default.createElement("div", null, descriptionForAssistiveTechnology !== null && descriptionForAssistiveTechnology !== void 0 ? descriptionForAssistiveTechnology : description), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("button", {
1305
+ }), /*#__PURE__*/React__default.createElement("div", null, definition), /*#__PURE__*/React__default.createElement("div", null, interactionExplanation), /*#__PURE__*/React__default.createElement("div", null, descriptionForAssistiveTechnology !== null && descriptionForAssistiveTechnology !== void 0 ? descriptionForAssistiveTechnology : description), dataTableRepresentation ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("button", {
1308
1306
  tabIndex: -1,
1309
1307
  "aria-expanded": viewAsDataTable,
1310
1308
  onClick: () => setViewAsDataTable(!viewAsDataTable)
1311
1309
  }, format('view-as-data-table'), ', ', ariaLabel ? /*#__PURE__*/React__default.createElement("span", null, ariaLabel) : /*#__PURE__*/React__default.createElement("span", {
1312
1310
  "aria-labelledby": ariaLabelledby
1313
- }))), /*#__PURE__*/React__default.createElement("div", null, xAxisDefinition), /*#__PURE__*/React__default.createElement("div", null, yAxisDefinition))), title || onReset ? /*#__PURE__*/React__default.createElement(StyledChartContainerTitle, {
1311
+ }))) : null, /*#__PURE__*/React__default.createElement("div", null, xAxisDefinition), /*#__PURE__*/React__default.createElement("div", null, yAxisDefinition))), title || onReset ? /*#__PURE__*/React__default.createElement(StyledChartContainerTitle, {
1314
1312
  "aria-hidden": "true",
1315
1313
  $theme: theme,
1316
1314
  alignItems: "center",
@@ -1517,6 +1515,47 @@ const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1517
1515
  }), "Loading...");
1518
1516
  });
1519
1517
 
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
+
1520
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"];
1521
1560
  const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1522
1561
  const {
@@ -1556,6 +1595,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1556
1595
  forwardedProps = _objectWithoutProperties(props, _excluded$i);
1557
1596
  const cache = useRef();
1558
1597
  const theme = useTheme();
1598
+ const format = useMessageFormatter(intlMessages$3);
1559
1599
  const {
1560
1600
  data,
1561
1601
  colorScale
@@ -1598,8 +1638,24 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1598
1638
  const scaleCategory = useMemo(() => scaleBand().domain(data.filter(datum => datum.value).map(datum => datum.key)).range([0, isHorizontal ? chartHeight : chartWidth]), [size]);
1599
1639
  const bars = data.filter(datum => datum.value);
1600
1640
  return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
1601
- mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
1602
- definition: `Ordinal Bar Chart with ${bars.length} bars.`,
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
+ }),
1603
1659
  dataTableRepresentation: {
1604
1660
  header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
1605
1661
  scope: "col"
@@ -1618,7 +1674,9 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1618
1674
  ref: ref
1619
1675
  }), /*#__PURE__*/React__default.createElement("svg", {
1620
1676
  width: width,
1621
- height: height
1677
+ height: height,
1678
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
1679
+ "aria-hidden": "false"
1622
1680
  }, /*#__PURE__*/React__default.createElement("g", {
1623
1681
  transform: `translate(${margins.left},${margins.top})`
1624
1682
  }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
@@ -1859,7 +1917,7 @@ LegendItem.className = CLASSNAME$7;
1859
1917
  LegendItem.displayName = COMPONENT_NAME$7;
1860
1918
 
1861
1919
  const _excluded$g = ["className", "data", "isLegendItemSelected", "labelDecorator", "legendDecorator", "legendItemRole", "onLegendItemClick", "variant", "width"],
1862
- _excluded2 = ["color"];
1920
+ _excluded2$4 = ["color"];
1863
1921
  const COMPONENT_NAME$6 = 'Legend';
1864
1922
  const CLASSNAME$6 = 'redsift-chart-legend';
1865
1923
  const Legend = /*#__PURE__*/forwardRef((props, ref) => {
@@ -1885,7 +1943,7 @@ const Legend = /*#__PURE__*/forwardRef((props, ref) => {
1885
1943
  let {
1886
1944
  color
1887
1945
  } = _ref,
1888
- datum = _objectWithoutProperties(_ref, _excluded2);
1946
+ datum = _objectWithoutProperties(_ref, _excluded2$4);
1889
1947
  return /*#__PURE__*/React__default.createElement(LegendItem, {
1890
1948
  data: {
1891
1949
  data: _objectSpread2(_objectSpread2({}, datum), {}, {
@@ -1909,7 +1967,8 @@ const Legend = /*#__PURE__*/forwardRef((props, ref) => {
1909
1967
  Legend.className = CLASSNAME$6;
1910
1968
  Legend.displayName = COMPONENT_NAME$6;
1911
1969
 
1912
- 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"];
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"];
1913
1972
  const getKey = datum => Array.isArray(datum.key) ? datum.key[0] : datum.key;
1914
1973
  const filterData = (hasCategory, data, filterFn) => {
1915
1974
  if (hasCategory) {
@@ -1969,6 +2028,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1969
2028
  forwardedProps = _objectWithoutProperties(props, _excluded$f);
1970
2029
  const cache = useRef();
1971
2030
  const theme = useTheme();
2031
+ const format = useMessageFormatter(intlMessages$3);
1972
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;
1973
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;
1974
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;
@@ -2097,11 +2157,29 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2097
2157
  entry[category] = value;
2098
2158
  return acc;
2099
2159
  }, []);
2160
+ const _ref9 = legendProps || {},
2161
+ {
2162
+ extraLegendItems
2163
+ } = _ref9,
2164
+ forwardedLegendProps = _objectWithoutProperties(_ref9, _excluded2$3);
2100
2165
  return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
2101
- mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
2102
- definition: `Linear Bar Chart with ${hasCategory ? `${categories.length} categories and ` : ''}${bars.length} bars.`,
2103
- xAxisDefinition: `The chart has 1 X axis displaying ${xScaleType === 'number' ? 'Numbers' : 'Dates'} from ${xScaleType === 'number' ? scaleX.domain()[0] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[0]) : scaleX.domain()[0].toString()} to ${xScaleType === 'number' ? scaleX.domain()[1] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[1]) : scaleX.domain()[1].toString()}.`,
2104
- yAxisDefinition: `The chart has 1 Y axis displaying numbers from ${scaleY.domain()[0]} to ${scaleY.domain()[1]}.`,
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
+ }),
2105
2183
  dataTableRepresentation: hasCategory ? {
2106
2184
  header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
2107
2185
  scope: "col"
@@ -2144,17 +2222,22 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2144
2222
  ref: svgRef,
2145
2223
  width: width,
2146
2224
  height: height,
2147
- "aria-label": "Interactive Bar Chart",
2225
+ "aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
2148
2226
  "aria-hidden": "false"
2149
- }, categories.map((category, index) => {
2227
+ }, categories.map((category, categoryIndex) => {
2150
2228
  const filteredBars = bars.filter(bar => bar.category === category);
2151
2229
  return /*#__PURE__*/React__default.createElement("g", _extends({
2152
- key: category,
2230
+ key: `${id}-series-${category}`,
2153
2231
  transform: `translate(${margins.left},${margins.top})`,
2154
2232
  "aria-hidden": "false",
2155
2233
  role: "region"
2156
2234
  }, hasCategory ? {
2157
- 'aria-label': `${category}, category ${index + 1} of ${categories.length} with ${filteredBars.length} bars`
2235
+ 'aria-label': format('series-legend', {
2236
+ category,
2237
+ categoryIndex: categoryIndex + 1,
2238
+ categoryLength: categories.length,
2239
+ barLength: filteredBars.length
2240
+ })
2158
2241
  } : {}), filteredBars.map((bar, index) => {
2159
2242
  const to = {
2160
2243
  data: bar,
@@ -2167,10 +2250,10 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2167
2250
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
2168
2251
  data: to,
2169
2252
  gap: gap,
2170
- id: `id${id}__bar-${index}`,
2253
+ id: `id${id}__bar-${categoryIndex}.${index}`,
2171
2254
  index: index,
2172
2255
  isSelected: Boolean(isBarSelected(to)),
2173
- key: `bar _${index}`,
2256
+ key: `bar _${categoryIndex}.${index}`,
2174
2257
  labelDecorator: labelDecorator,
2175
2258
  maxHeight: scaleY(bar.cumulativeValue - bar.value),
2176
2259
  anchorProps: getBarAnchorProps ? getBarAnchorProps(to) : undefined,
@@ -2242,12 +2325,12 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
2242
2325
  tickRemodelling: yAxisTickRemodelling,
2243
2326
  variant: yAxisVariant
2244
2327
  }) : null))), hasCategory && legendVariant !== BarChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
2245
- data: statsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2328
+ data: (extraLegendItems ? [...statsByCategory, ...extraLegendItems] : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2246
2329
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
2247
2330
  })),
2248
2331
  variant: legendVariant === BarChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === BarChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === BarChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
2249
2332
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
2250
- }, legendProps)) : null);
2333
+ }, forwardedLegendProps)) : null);
2251
2334
  });
2252
2335
 
2253
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"];
@@ -2685,7 +2768,49 @@ const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2685
2768
  })))));
2686
2769
  });
2687
2770
 
2688
- 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"];
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"];
2689
2814
  const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2690
2815
  const {
2691
2816
  className,
@@ -2730,6 +2855,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2730
2855
  forwardedProps = _objectWithoutProperties(props, _excluded$9);
2731
2856
  const cache = useRef();
2732
2857
  const theme = useTheme();
2858
+ const format = useMessageFormatter(intlMessages$2);
2733
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;
2734
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;
2735
2861
  useEffect(() => {
@@ -2851,11 +2977,31 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2851
2977
  entry[category] = y;
2852
2978
  return acc;
2853
2979
  }, []);
2980
+ const _ref11 = legendProps || {},
2981
+ {
2982
+ extraLegendItems
2983
+ } = _ref11,
2984
+ forwardedLegendProps = _objectWithoutProperties(_ref11, _excluded2$2);
2854
2985
  return /*#__PURE__*/React__default.createElement(StyledLineChart, _extends({
2855
- mode: typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? 'interactive' : 'static',
2856
- definition: `Line Chart with ${hasCategory ? `${lines.length} lines and ` : ''}${circles.length} points.`,
2857
- xAxisDefinition: `The chart has 1 X axis displaying ${xScaleType === 'number' ? 'Numbers' : 'Dates'} from ${xScaleType === 'number' ? scaleX.domain()[0] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[0]) : scaleX.domain()[0].toString()} to ${xScaleType === 'number' ? scaleX.domain()[1] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[1]) : scaleX.domain()[1].toString()}.`,
2858
- yAxisDefinition: `The chart has 1 Y axis displaying numbers from ${scaleY.domain()[0]} to ${scaleY.domain()[1]}.`,
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
+ }),
2859
3005
  dataTableRepresentation: hasCategory ? {
2860
3006
  header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
2861
3007
  scope: "col"
@@ -2897,9 +3043,12 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2897
3043
  }, /*#__PURE__*/React__default.createElement("svg", {
2898
3044
  ref: svgRef,
2899
3045
  width: width,
2900
- height: height
3046
+ height: height,
3047
+ "aria-label": typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
3048
+ "aria-hidden": "false"
2901
3049
  }, /*#__PURE__*/React__default.createElement("g", {
2902
- transform: `translate(${margins.left},${margins.top})`
3050
+ transform: `translate(${margins.left},${margins.top})`,
3051
+ "aria-hidden": "true"
2903
3052
  }, lines.map((line, index) => {
2904
3053
  return /*#__PURE__*/React__default.createElement(Line, {
2905
3054
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(line[0].category),
@@ -2907,33 +3056,42 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2907
3056
  createLine: createLine,
2908
3057
  key: `line _${index}`
2909
3058
  });
2910
- })), /*#__PURE__*/React__default.createElement("g", {
2911
- transform: `translate(${margins.left},${margins.top})`
2912
- }, circles.map((circle, index) => {
2913
- const scaleXDomain = scaleX.domain();
2914
- const scaleYDomain = scaleY.domain();
2915
- if (xScaleType === 'number' && (circle.x < scaleXDomain[0] || circle.x > scaleXDomain[1] || circle.y < scaleYDomain[0] || circle.y > scaleYDomain[1])) {
2916
- return null;
2917
- }
2918
- const to = _objectSpread2(_objectSpread2({}, circle), {}, {
2919
- r: 4
2920
- });
2921
- return /*#__PURE__*/React__default.createElement(Dot, {
2922
- color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(circle.category),
2923
- data: to,
2924
- isSelected: Boolean(isDotSelected === null || isDotSelected === void 0 ? void 0 : isDotSelected(to)),
2925
- anchorProps: getDotAnchorProps ? getDotAnchorProps(to) : undefined,
2926
- key: `circle _${index}`,
2927
- labelDecorator: labelDecorator,
2928
- onClick: onDotClick,
2929
- role: dotRole,
2930
- scaleX: scaleX,
2931
- scaleY: scaleY,
2932
- tooltipDecorator: tooltipDecorator,
2933
- tooltipVariant: tooltipVariant,
2934
- variant: DotVariant.hollow
2935
- });
2936
- })), /*#__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", {
2937
3095
  transform: `translate(${margins.left},${margins.top})`
2938
3096
  }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
2939
3097
  position: "bottom",
@@ -2988,12 +3146,12 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
2988
3146
  tickRemodelling: yAxisTickRemodelling,
2989
3147
  variant: yAxisVariant
2990
3148
  }) : null))), hasCategory && legendVariant !== LineChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
2991
- data: statsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3149
+ data: (extraLegendItems ? [...statsByCategory, ...extraLegendItems] : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
2992
3150
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
2993
3151
  })),
2994
3152
  variant: legendVariant === LineChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === LineChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === LineChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
2995
3153
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
2996
- }, legendProps)) : null);
3154
+ }, forwardedLegendProps)) : null);
2997
3155
  });
2998
3156
 
2999
3157
  const _excluded$8 = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
@@ -3371,7 +3529,33 @@ const EmptyPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3371
3529
  }))));
3372
3530
  });
3373
3531
 
3374
- 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"];
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"];
3375
3559
  const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3376
3560
  const {
3377
3561
  caping,
@@ -3401,6 +3585,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3401
3585
  forwardedProps = _objectWithoutProperties(props, _excluded$5);
3402
3586
  const cache = useRef();
3403
3587
  const theme = useTheme();
3588
+ const format = useMessageFormatter(intlMessages$1);
3404
3589
  const isDonut = variant === PieChartVariant.donut || variant === PieChartVariant.spacedDonut;
3405
3590
  const isSpaced = variant === PieChartVariant.spaced || variant === PieChartVariant.spacedDonut;
3406
3591
  const {
@@ -3459,9 +3644,16 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3459
3644
  });
3460
3645
  }), total) : propsMiddleText;
3461
3646
  const filteredPieData = pieData.filter(datum => datum.data.value);
3647
+ const _ref = legendProps || {},
3648
+ {
3649
+ extraLegendItems
3650
+ } = _ref,
3651
+ forwardedLegendProps = _objectWithoutProperties(_ref, _excluded2$1);
3462
3652
  return /*#__PURE__*/React__default.createElement(StyledPieChart, _extends({
3463
- mode: typeof onSliceClick === 'function' || typeof getSliceAnchorProps === 'function' ? 'interactive' : 'static',
3464
- definition: `Pie Chart with ${filteredPieData.length} slices.`,
3653
+ mode: typeof onSliceClick === 'function' || typeof getSliceAnchorProps === 'function' ? format('interactive') : format('static'),
3654
+ definition: format('definition', {
3655
+ sliceLength: filteredPieData.length
3656
+ }),
3465
3657
  dataTableRepresentation: {
3466
3658
  header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
3467
3659
  scope: "col"
@@ -3487,7 +3679,9 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3487
3679
  $theme: theme
3488
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", {
3489
3681
  width: width,
3490
- 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"
3491
3685
  }, /*#__PURE__*/React__default.createElement(Arcs, {
3492
3686
  arcs: filteredPieData.map((datum, index) => {
3493
3687
  const percent = datum.data.value / total;
@@ -3528,14 +3722,14 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
3528
3722
  tooltipVariant: tooltipVariant,
3529
3723
  transform: `translate(${width / 2} ${isHalf ? height : height / 2})`
3530
3724
  }))), legendVariant !== PieChartLegendVariant.none && legendVariant !== PieChartLegendVariant.internal ? /*#__PURE__*/React__default.createElement(Legend, _extends({
3531
- data: data.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3725
+ data: (extraLegendItems ? [...data, ...extraLegendItems] : data).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
3532
3726
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
3533
3727
  })),
3534
3728
  variant: legendVariant === PieChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === PieChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === PieChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
3535
3729
  width: legendWidth.current,
3536
3730
  labelDecorator: labelDecorator ? (datum, props) => labelDecorator(datum, props) : undefined,
3537
3731
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
3538
- }, legendProps)) : null);
3732
+ }, forwardedLegendProps)) : null);
3539
3733
  });
3540
3734
 
3541
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"];
@@ -3817,18 +4011,56 @@ const EmptyScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3817
4011
  })))));
3818
4012
  });
3819
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
+
3820
4050
  // Material Design Icons v7.2.96
3821
4051
  var mdiChevronDown = "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z";
3822
4052
  var mdiChevronRight = "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";
3823
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";
3824
4054
 
3825
- 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"];
3826
4057
  const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3827
4058
  const {
3828
4059
  isBrushable,
3829
4060
  className,
3830
4061
  data: propsData,
3831
4062
  dotRole,
4063
+ getDotAnchorProps,
3832
4064
  hideControlKeyPanel,
3833
4065
  id,
3834
4066
  isDotSelected,
@@ -3864,6 +4096,7 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3864
4096
  forwardedProps = _objectWithoutProperties(props, _excluded$1);
3865
4097
  const cache = useRef();
3866
4098
  const theme = useTheme();
4099
+ const format = useMessageFormatter(intlMessages);
3867
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]));
3868
4101
  useEffect(() => {
3869
4102
  cache.current = data;
@@ -3932,23 +4165,76 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
3932
4165
  onBrush,
3933
4166
  onBrushEnd
3934
4167
  });
3935
- const circles = variant === ScatterPlotVariant.gridded ? group(data, scaleX, scaleY).sort((a, b) => descending(a.points.length, b.points.length)) : data.map(d => ({
3936
- category: d.key[2],
3937
- x: d.key[0],
3938
- y: d.key[1],
3939
- data: {
3940
- key: d.key,
3941
- value: 1
3942
- },
3943
- points: [d]
3944
- }));
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
+ });
3945
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;
3946
4190
  const legendWidth = useRef();
3947
4191
  if (countsByCategory && !legendWidth.current) {
3948
4192
  legendWidth.current = `${Math.max(...countsByCategory.map(d => d.key.length + String(d.value).length)) * 8 + 32}px`;
3949
4193
  }
3950
4194
  const [isKeyPanelOpen, setIsKeyPanelOpen] = useState(false);
3951
- 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, {
3952
4238
  id: id,
3953
4239
  className: className,
3954
4240
  ref: ref
@@ -4008,10 +4294,10 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
4008
4294
  }
4009
4295
  const to = _objectSpread2(_objectSpread2({}, circle), {}, {
4010
4296
  data: _objectSpread2(_objectSpread2({}, circle.data), {}, {
4011
- 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 => {
4012
4298
  let {
4013
4299
  key
4014
- } = _ref;
4300
+ } = _ref2;
4015
4301
  return key === circle.category;
4016
4302
  })) === null || _countsByCategory$fin === void 0 ? void 0 : _countsByCategory$fin.value) : undefined
4017
4303
  }),
@@ -4081,13 +4367,13 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
4081
4367
  tickFormat: yAxisTickFormat,
4082
4368
  variant: yAxisVariant
4083
4369
  }) : null))), hasCategory && legendVariant !== ScatterPlotLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
4084
- data: countsByCategory.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
4370
+ data: (extraLegendItems ? [...countsByCategory, ...extraLegendItems] : countsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
4085
4371
  color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
4086
4372
  })),
4087
4373
  variant: legendVariant === ScatterPlotLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === ScatterPlotLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === ScatterPlotLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
4088
4374
  width: legendWidth.current,
4089
4375
  legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
4090
- }, legendProps)) : null);
4376
+ }, forwardedLegendProps)) : null);
4091
4377
  });
4092
4378
 
4093
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"];