@fluentui/react-charts 0.0.0-nightly-20260108-0406.1 → 0.0.0-nightly-20260112-0407.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -13
  2. package/dist/index.d.ts +5 -0
  3. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  4. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  5. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  6. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  7. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  8. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +47 -3
  9. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  10. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  11. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  12. package/lib/components/FunnelChart/FunnelChart.js +15 -2
  13. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  14. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
  15. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  16. package/lib/components/LineChart/LineChart.js +4 -1
  17. package/lib/components/LineChart/LineChart.js.map +1 -1
  18. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
  19. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  20. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  21. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  22. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  23. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  24. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  25. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +58 -4
  26. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  27. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  28. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  29. package/lib-commonjs/components/FunnelChart/FunnelChart.js +15 -2
  30. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  31. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
  32. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  33. package/lib-commonjs/components/LineChart/LineChart.js +4 -1
  34. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  35. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
  36. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  37. package/package.json +10 -10
@@ -16,6 +16,7 @@ const _useVerticalStackedBarChartStylesstyles = require("./useVerticalStackedBar
16
16
  const _d3scale = require("d3-scale");
17
17
  const _reactutilities = require("@fluentui/react-utilities");
18
18
  const _reacttheme = require("@fluentui/react-theme");
19
+ const _reacttabster = require("@fluentui/react-tabster");
19
20
  const _index = require("../../index");
20
21
  const _index1 = require("../../utilities/index");
21
22
  const _chartutilities = require("@fluentui/chart-utilities");
@@ -34,6 +35,10 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
34
35
  const _isRtl = (0, _index1.useRtl)();
35
36
  const _createLegendsForLine = (data)=>_getLineLegends(data);
36
37
  const _emptyChartId = (0, _reactutilities.useId)('_VSBC_empty');
38
+ const _arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
39
+ axis: 'vertical',
40
+ circular: true
41
+ });
37
42
  let _points = [];
38
43
  let _dataset;
39
44
  let _xAxisLabels = [];
@@ -163,17 +168,14 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
163
168
  clientX = boundingRect.left + boundingRect.width / 2;
164
169
  clientY = boundingRect.top + boundingRect.height / 2;
165
170
  }
166
- if (_getHighlightedLegend().length === 1) {
167
- if (_noLegendHighlighted() || _isLegendHighlighted(lineData.legend)) {
168
- _updatePosition(clientX, clientY);
169
- setPopoverOpen(true);
170
- setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
171
- setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
172
- setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
173
- setColor(lineData.color);
174
- }
175
- } else {
176
- _onStackHoverFocus(lineData.xItem, event);
171
+ if (_noLegendHighlighted() || _isLegendHighlighted(lineData.legend)) {
172
+ _updatePosition(clientX, clientY);
173
+ setPopoverOpen(true);
174
+ setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
175
+ setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
176
+ setCalloutLegend(lineData.legend);
177
+ setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
178
+ setColor(lineData.color);
177
179
  }
178
180
  }
179
181
  function _onStackHoverFocus(stack, event) {
@@ -337,19 +339,9 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
337
339
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
338
340
  return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint && !_isHavingLines ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
339
341
  }
340
- function _toFocusWholeStack(_isHavingLines) {
342
+ function _toFocusWholeStack() {
341
343
  const { isCalloutForStack = false } = props;
342
- let shouldFocusStackOnly = false;
343
- if (_isHavingLines) {
344
- if (_getHighlightedLegend().length === 1) {
345
- shouldFocusStackOnly = false;
346
- } else {
347
- shouldFocusStackOnly = true;
348
- }
349
- } else {
350
- shouldFocusStackOnly = isCalloutForStack;
351
- }
352
- return shouldFocusStackOnly;
344
+ return isCalloutForStack;
353
345
  }
354
346
  function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
355
347
  let domainNRangeValue;
@@ -455,8 +447,8 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
455
447
  const circleRef = {
456
448
  refElement: null
457
449
  };
458
- const noBarsAndLinesActive = circlePoint.xItem.chartData.filter((dataPoint)=>_noLegendHighlighted() || _isLegendHighlighted(dataPoint.legend)).length === 0;
459
450
  const yScaleBandwidthTranslate = !circlePoint.useSecondaryYScale && _yAxisType === _index1.YAxisType.StringAxis ? yScalePrimary.bandwidth() / 2 : 0;
451
+ const shouldHighlight = _isLegendHighlighted(circlePoint.legend) || _noLegendHighlighted() ? true : false;
460
452
  dots.push(/*#__PURE__*/ _react.createElement("circle", {
461
453
  key: `${index}-${subIndex}-dot`,
462
454
  cx: xScale(circlePoint.xItem.xAxisPoint),
@@ -474,13 +466,11 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
474
466
  ref: (e)=>{
475
467
  circleRef.refElement = e;
476
468
  },
477
- ...noBarsAndLinesActive ? {
478
- tabIndex: !props.hideTooltip ? 0 : undefined,
479
- onFocus: (event)=>_lineFocus(event, circlePoint, circleRef),
480
- onBlur: _handleMouseOut,
481
- role: 'img',
482
- 'aria-label': _getAriaLabel(circlePoint.xItem, circlePoint)
483
- } : {}
469
+ tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
470
+ onFocus: (event)=>_lineFocus(event, circlePoint, circleRef),
471
+ onBlur: _handleMouseOut,
472
+ role: "img",
473
+ "aria-label": _getAriaLabel(circlePoint.xItem, circlePoint, true)
484
474
  }));
485
475
  });
486
476
  });
@@ -747,8 +737,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
747
737
  const classes = (0, _useVerticalStackedBarChartStylesstyles.useVerticalStackedBarChartStyles)(props);
748
738
  function _createBar(xBarScale, yBarScale, containerHeight, xElement) {
749
739
  const { barCornerRadius = 0, barMinimumHeight = 0 } = props;
750
- const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
751
- const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
740
+ const shouldFocusWholeStack = _toFocusWholeStack();
752
741
  if (_xAxisType === _index1.XAxisTypes.StringAxis) {
753
742
  _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
754
743
  }
@@ -1021,7 +1010,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
1021
1010
  if (!_isChartEmpty()) {
1022
1011
  _adjustProps();
1023
1012
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
1024
- const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
1013
+ const shouldFocusWholeStack = _toFocusWholeStack();
1025
1014
  _dataset = _createDataSetLayer();
1026
1015
  const legendBars = _getLegendData(_points, _createLegendsForLine(props.data));
1027
1016
  const calloutProps = {
@@ -1035,7 +1024,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
1035
1024
  ...(0, _index1.getAccessibleDataObject)(callOutAccessibilityData),
1036
1025
  clickPosition: clickPosition,
1037
1026
  isPopoverOpen: isPopoverOpen,
1038
- isCalloutForStack: props.isCalloutForStack || _isHavingLines && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
1027
+ isCalloutForStack: shouldFocusWholeStack,
1039
1028
  isCartesian: true,
1040
1029
  customCallout: {
1041
1030
  customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
@@ -1080,7 +1069,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
1080
1069
  ],
1081
1070
  getYDomainMargins: _getYDomainMargins,
1082
1071
  /* eslint-disable react/jsx-no-bind */ children: (props)=>{
1083
- return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", null, _bars), /*#__PURE__*/ _react.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
1072
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", _arrowNavigationAttributes, _bars), /*#__PURE__*/ _react.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
1084
1073
  }
1085
1074
  });
1086
1075
  }