@fluentui/react-charts 0.0.0-nightly-20251210-0407.1 → 0.0.0-nightly-20251212-0406.1

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.
@@ -469,7 +469,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
469
469
  stroke: activePoint === circleId ? lineColor : '',
470
470
  role: "img",
471
471
  "aria-label": (_points_i_data__text = _points[i].data[0].text) !== null && _points_i_data__text !== void 0 ? _points_i_data__text : _getAriaLabel(i, 0),
472
- "data-is-focusable": isLegendSelected,
473
472
  ref: (e)=>{
474
473
  _refCallback(e, circleId);
475
474
  },
@@ -532,7 +531,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
532
531
  key: lineId,
533
532
  d: line(lineData),
534
533
  fill: "transparent",
535
- "data-is-focusable": true,
536
534
  stroke: lineColor,
537
535
  strokeWidth: strokeWidth,
538
536
  strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
@@ -552,7 +550,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
552
550
  key: lineId,
553
551
  d: line(lineData),
554
552
  fill: "transparent",
555
- "data-is-focusable": false,
553
+ tabIndex: -1,
556
554
  stroke: lineColor,
557
555
  strokeWidth: strokeWidth,
558
556
  strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
@@ -569,6 +567,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
569
567
  cy: 0,
570
568
  fill: _reacttheme.tokens.colorNeutralBackground1,
571
569
  strokeWidth: DEFAULT_LINE_STROKE_SIZE,
570
+ tabIndex: isLegendSelected ? 0 : undefined,
572
571
  stroke: lineColor,
573
572
  visibility: 'hidden',
574
573
  onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
@@ -592,11 +591,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
592
591
  cx: xPoint,
593
592
  cy: yPoint,
594
593
  fill: activePoint === _circleId ? _reacttheme.tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
594
+ tabIndex: isLegendSelected ? 0 : undefined,
595
595
  stroke: perPointColor || lineColor,
596
596
  strokeWidth: 1,
597
597
  opacity: isLegendSelected ? 1 : 0.1,
598
- onMouseMove: _onMouseOverLargeDataset.bind(i, verticaLineHeight, yScale),
599
- onMouseOver: _onMouseOverLargeDataset.bind(i, verticaLineHeight, yScale),
598
+ onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
599
+ onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
600
+ onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
600
601
  onMouseOut: _handleMouseOut
601
602
  }));
602
603
  }
@@ -634,7 +635,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
634
635
  r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
635
636
  cx: xPoint1,
636
637
  cy: yPoint1,
637
- "data-is-focusable": isLegendSelected,
638
+ tabIndex: isLegendSelected ? 0 : undefined,
638
639
  onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
639
640
  onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
640
641
  onMouseOut: _handleMouseOut,
@@ -657,7 +658,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
657
658
  id: circleId,
658
659
  key: circleId,
659
660
  d: path,
660
- "data-is-focusable": isLegendSelected,
661
661
  onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
662
662
  onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
663
663
  onMouseOut: _handleMouseOut,
@@ -696,7 +696,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
696
696
  r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
697
697
  cx: xPoint2,
698
698
  cy: yPoint2,
699
- "data-is-focusable": isLegendSelected,
699
+ tabIndex: isLegendSelected ? 0 : undefined,
700
700
  onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
701
701
  onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
702
702
  onMouseOut: _handleMouseOut,
@@ -718,7 +718,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
718
718
  id: lastCircleId,
719
719
  key: lastCircleId,
720
720
  d: path,
721
- "data-is-focusable": isLegendSelected,
722
721
  onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
723
722
  onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
724
723
  onMouseOut: _handleMouseOut,
@@ -946,6 +945,50 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
946
945
  refElement: element
947
946
  });
948
947
  }
948
+ // Helper function to update highlight circle, vertical line, and callout for large datasets
949
+ const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
950
+ // Check if this point is plottable. If not, close the popover and return.
951
+ const xPoint = _xAxisScale(pointToHighlight.x);
952
+ const yPoint = yScale(pointToHighlight.y);
953
+ if (!(0, _index1.isPlottable)(xPoint, yPoint)) {
954
+ return;
955
+ }
956
+ const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, pointToHighlight.x);
957
+ const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
958
+ // if no points need to be called out then don't show vertical line and callout card
959
+ if (found && pointToHighlightUpdated) {
960
+ _uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
961
+ (0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
962
+ (0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
963
+ const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
964
+ const rect = targetElement.getBoundingClientRect();
965
+ setNearestCircleToHighlight(pointToHighlight);
966
+ updatePosition(rect.x, rect.y);
967
+ setStackCalloutProps(found);
968
+ setYValueHover(found.values);
969
+ setDataPointCalloutProps(found);
970
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
971
+ setActivePoint('');
972
+ }
973
+ if (!found) {
974
+ setPopoverOpen(false);
975
+ setNearestCircleToHighlight(pointToHighlight);
976
+ setActivePoint('');
977
+ }
978
+ };
979
+ const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
980
+ focusEvent.persist();
981
+ const { data } = props;
982
+ const { lineChartData } = data;
983
+ // For focus events, we use the provided point index directly
984
+ const pointToHighlight = lineChartData[linenumber].data[pointIndex];
985
+ if (!pointToHighlight) {
986
+ return;
987
+ }
988
+ const { xAxisCalloutData } = pointToHighlight;
989
+ const formattedDate = pointToHighlight.x instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
990
+ _updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
991
+ };
949
992
  const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
950
993
  mouseEvent.persist();
951
994
  const { data } = props;
@@ -990,35 +1033,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
990
1033
  }
991
1034
  const { xAxisCalloutData } = lineChartData[linenumber].data[index];
992
1035
  const formattedDate = xPointToHighlight instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
993
- const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, xPointToHighlight);
994
1036
  const pointToHighlight = lineChartData[linenumber].data[index];
995
- // Check if this point is plottable. If not, close the popover and return.
996
- const xPoint = _xAxisScale(pointToHighlight.x);
997
- const yPoint = yScale(pointToHighlight.y);
998
- if (!(0, _index1.isPlottable)(xPoint, yPoint)) {
999
- return;
1000
- }
1001
- const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
1002
- // if no points need to be called out then don't show vertical line and callout card
1003
- if (found && pointToHighlightUpdated) {
1004
- _uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
1005
- (0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
1006
- (0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
1007
- const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
1008
- const rect = targetElement.getBoundingClientRect();
1009
- setNearestCircleToHighlight(pointToHighlight);
1010
- updatePosition(rect.x, rect.y);
1011
- setStackCalloutProps(found);
1012
- setYValueHover(found.values);
1013
- setDataPointCalloutProps(found);
1014
- xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
1015
- setActivePoint('');
1016
- }
1017
- if (!found) {
1018
- setPopoverOpen(false);
1019
- setNearestCircleToHighlight(pointToHighlight);
1020
- setActivePoint('');
1021
- }
1037
+ _updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
1022
1038
  };
1023
1039
  function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
1024
1040
  _uniqueCallOutID = circleId;
@@ -1221,7 +1237,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
1221
1237
  color: lineColor,
1222
1238
  XValue: hoverXValue,
1223
1239
  descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
1224
- 'data-is-focusable': true,
1240
+ tabIndex: 0,
1225
1241
  xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
1226
1242
  ...props.calloutProps,
1227
1243
  isPopoverOpen: isPopoverOpen,