@fluentui/react-charts 9.3.2 → 9.3.4

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 (145) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/dist/index.d.ts +151 -1
  3. package/lib/components/AreaChart/AreaChart.js +208 -60
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/ChartTable/ChartTable.js +14 -12
  6. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  7. package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
  8. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  9. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  10. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +5 -6
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/ChartPopover.js +2 -1
  14. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  15. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
  17. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  18. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  19. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  20. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
  21. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  22. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  23. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
  27. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  28. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +471 -207
  29. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  30. package/lib/components/DonutChart/Arc/Arc.js +8 -7
  31. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  32. package/lib/components/DonutChart/DonutChart.js +16 -32
  33. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  34. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  35. package/lib/components/DonutChart/Pie/Pie.js +4 -4
  36. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  37. package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
  38. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  41. package/lib/components/FunnelChart/FunnelChart.js +23 -45
  42. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  43. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
  44. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  45. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.js +21 -46
  48. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  49. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
  50. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  51. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  52. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  53. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
  54. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  55. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  56. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
  57. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  59. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  60. package/lib/components/Legends/Legends.js +1 -1
  61. package/lib/components/Legends/Legends.js.map +1 -1
  62. package/lib/components/LineChart/LineChart.js +145 -97
  63. package/lib/components/LineChart/LineChart.js.map +1 -1
  64. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
  65. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  66. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  67. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  68. package/lib/components/ScatterChart/ScatterChart.js +7 -11
  69. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  70. package/lib/types/DataPoint.js +1 -3
  71. package/lib/types/DataPoint.js.map +1 -1
  72. package/lib/utilities/utilities.js +77 -26
  73. package/lib/utilities/utilities.js.map +1 -1
  74. package/lib-commonjs/components/AreaChart/AreaChart.js +207 -59
  75. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  76. package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
  77. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  78. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
  79. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  81. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
  83. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  84. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
  85. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  87. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
  88. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  89. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  91. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
  92. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  93. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  94. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
  96. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
  98. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +470 -206
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  101. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
  102. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
  104. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  105. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  106. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -4
  107. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  108. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
  109. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  111. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  112. package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
  113. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  114. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
  115. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  116. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  117. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  118. package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
  119. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  120. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
  121. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  122. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  123. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  124. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
  125. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  126. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  127. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
  128. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  130. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  131. package/lib-commonjs/components/Legends/Legends.js +1 -1
  132. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  133. package/lib-commonjs/components/LineChart/LineChart.js +144 -96
  134. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  135. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
  136. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  138. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  139. package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
  140. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  141. package/lib-commonjs/types/DataPoint.js +1 -3
  142. package/lib-commonjs/types/DataPoint.js.map +1 -1
  143. package/lib-commonjs/utilities/utilities.js +80 -26
  144. package/lib-commonjs/utilities/utilities.js.map +1 -1
  145. package/package.json +13 -13
@@ -28,11 +28,8 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
28
28
  const [hoveredStage, setHoveredStage] = _react.useState(null);
29
29
  const [calloutData, setCalloutData] = _react.useState(null);
30
30
  const [selectedLegends, setSelectedLegends] = _react.useState([]);
31
- const [clickPosition, setClickPosition] = _react.useState({
32
- x: 0,
33
- y: 0
34
- });
35
31
  const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
32
+ const [refSelected, setRefSelected] = _react.useState(null);
36
33
  const chartContainerRef = _react.useRef(null);
37
34
  const isStacked = isStackedFunnelData(props.data);
38
35
  const _legendsRef = _react.useRef(null);
@@ -50,48 +47,38 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
50
47
  return (0, _imageexportutils.toImage)(chartContainerRef.current, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, isRTL, opts);
51
48
  }
52
49
  }), []);
53
- function _handleHover(data, mouseEvent) {
50
+ function _handleHover(data, mouseEvent, targetElement) {
54
51
  mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
55
- updatePosition(mouseEvent.clientX, mouseEvent.clientY);
56
52
  setCalloutData(data);
53
+ setRefSelected(targetElement);
57
54
  setPopoverOpen(true);
58
55
  }
59
- function _handleFocus(data, focusEvent) {
56
+ function _handleFocus(data, focusEvent, targetElement) {
60
57
  focusEvent === null || focusEvent === void 0 ? void 0 : focusEvent.persist();
61
- let x = 0;
62
- let y = 0;
63
- const targetRect = focusEvent.target.getBoundingClientRect();
64
- x = targetRect.left + targetRect.width / 2;
65
- y = targetRect.top + targetRect.height / 2;
66
- updatePosition(x, y);
67
58
  setCalloutData(data);
59
+ setRefSelected(targetElement);
68
60
  setPopoverOpen(true);
69
61
  }
70
- function _handleStackedHover(stage, subValue, mouseEvent) {
62
+ function _handleStackedHover(stage, subValue, mouseEvent, targetElement) {
71
63
  mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
72
- updatePosition(mouseEvent.clientX, mouseEvent.clientY);
73
64
  setCalloutData({
74
65
  stage,
75
66
  value: subValue.value,
76
67
  color: subValue.color,
77
68
  category: subValue.category
78
69
  });
70
+ setRefSelected(targetElement);
79
71
  setPopoverOpen(true);
80
72
  }
81
- function _handleStackedFocus(stage, subValue, focusEvent) {
73
+ function _handleStackedFocus(stage, subValue, focusEvent, targetElement) {
82
74
  focusEvent === null || focusEvent === void 0 ? void 0 : focusEvent.persist();
83
- let x = 0;
84
- let y = 0;
85
- const targetRect = focusEvent.target.getBoundingClientRect();
86
- x = targetRect.left + targetRect.width / 2;
87
- y = targetRect.top + targetRect.height / 2;
88
- updatePosition(x, y);
89
75
  setCalloutData({
90
76
  stage,
91
77
  value: subValue.value,
92
78
  color: subValue.color,
93
79
  category: subValue.category
94
80
  });
81
+ setRefSelected(targetElement);
95
82
  setPopoverOpen(true);
96
83
  }
97
84
  function _handleMouseOut() {
@@ -124,22 +111,23 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
124
111
  function noLegendHighlighted() {
125
112
  return getHighlightedLegend().length === 0;
126
113
  }
127
- function _getEventHandlerProps(data, opacity) {
114
+ function _getEventHandlerProps(data, opacity, segmentId) {
115
+ const targetElement = document.getElementById(segmentId);
128
116
  if ('subValue' in data) {
129
117
  return {
130
118
  culture: props.culture,
131
- onMouseOver: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event) : undefined,
132
- onMouseMove: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event) : undefined,
133
- onFocus: (event)=>_handleStackedFocus(data.stage, data.subValue, event),
119
+ onMouseOver: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event, targetElement) : undefined,
120
+ onMouseMove: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event, targetElement) : undefined,
121
+ onFocus: (event)=>_handleStackedFocus(data.stage, data.subValue, event, targetElement),
134
122
  onBlur: ()=>_handleMouseOut(),
135
123
  onMouseOut: ()=>_handleMouseOut()
136
124
  };
137
125
  } else {
138
126
  return {
139
127
  culture: props.culture,
140
- onMouseOver: opacity == 1 ? (event)=>_handleHover(data, event) : undefined,
141
- onMouseMove: opacity == 1 ? (event)=>_handleHover(data, event) : undefined,
142
- onFocus: (event)=>_handleFocus(data, event),
128
+ onMouseOver: opacity == 1 ? (event)=>_handleHover(data, event, targetElement) : undefined,
129
+ onMouseMove: opacity == 1 ? (event)=>_handleHover(data, event, targetElement) : undefined,
130
+ onFocus: (event)=>_handleFocus(data, event, targetElement),
143
131
  onBlur: ()=>_handleMouseOut(),
144
132
  onMouseOut: ()=>_handleMouseOut()
145
133
  };
@@ -165,11 +153,13 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
165
153
  return textElement;
166
154
  }
167
155
  function _renderFunnelSegment({ key, pathD, fill, opacity, textProps, data, tabIndex }) {
168
- const eventHandlers = _getEventHandlerProps(data, opacity);
156
+ const segmentId = `funnel-segment-${key}`;
157
+ const eventHandlers = _getEventHandlerProps(data, opacity, segmentId);
169
158
  const textColor = (0, _colors.getContrastTextColor)(fill);
170
159
  return /*#__PURE__*/ _react.createElement("g", {
171
160
  key: key
172
161
  }, /*#__PURE__*/ _react.createElement("path", {
162
+ id: segmentId,
173
163
  d: pathD,
174
164
  fill: fill,
175
165
  opacity: opacity,
@@ -349,20 +339,6 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
349
339
  function _isChartEmpty() {
350
340
  return !(props.data && props.data.length > 0);
351
341
  }
352
- function updatePosition(newX, newY) {
353
- const threshold = 1; // Set a threshold for movement
354
- const { x, y } = clickPosition;
355
- // Calculate the distance moved
356
- const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
357
- // Update the position only if the distance moved is greater than the threshold
358
- if (distance > threshold) {
359
- setClickPosition({
360
- x: newX,
361
- y: newY
362
- });
363
- setPopoverOpen(true);
364
- }
365
- }
366
342
  const classes = (0, _useFunnelChartStylesstyles.useFunnelChartStyles)(props);
367
343
  const calloutProps = {
368
344
  ...props.calloutProps,
@@ -397,7 +373,9 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
397
373
  XValue: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.hoverXValue,
398
374
  yCalloutValue: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.YValue,
399
375
  culture: props.culture,
400
- clickPosition: clickPosition,
376
+ positioning: {
377
+ target: refSelected
378
+ },
401
379
  isPopoverOpen: isPopoverOpen,
402
380
  color: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.color,
403
381
  isCartesian: false
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getContrastTextColor } from '../../utilities/colors';\nimport { useFunnelChartStyles } from './useFunnelChartStyles.styles';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport { ChartPopoverProps, ImageExportOptions } from '../../index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>((props, forwardedRef) => {\n const _emptyChartId: string = useId('_FunnelChart_empty');\n const isRTL = useRtl();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [calloutData, setCalloutData] = React.useState<FunnelChartDataPoint | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const _legendsRef = React.useRef<LegendContainer>(null);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(chartContainerRef.current, _legendsRef.current?.toSVG, isRTL, opts);\n },\n }),\n [],\n );\n\n function _handleHover(data: FunnelChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData(data);\n setPopoverOpen(true);\n }\n\n function _handleFocus(data: FunnelChartDataPoint, focusEvent: React.FocusEvent<SVGPathElement>) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData(data);\n setPopoverOpen(true);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n ) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setPopoverOpen(true);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n ) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setPopoverOpen(true);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setPopoverOpen(false);\n setCalloutData(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getEventHandlerProps(\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n ) {\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleStackedFocus(data.stage, data.subValue, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onMouseMove: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n opacity,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n opacity: number;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text\n x={isRTL ? funnelWidth - x : x}\n y={y}\n opacity={opacity}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n fill={textColor}\n >\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n tabIndex,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n tabIndex?: number;\n }) {\n const eventHandlers = _getEventHandlerProps(data, opacity);\n const textColor = getContrastTextColor(fill);\n\n return (\n <g key={key}>\n <path d={pathD} fill={fill} opacity={opacity} {...eventHandlers} tabIndex={tabIndex} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor, opacity })}</g>}\n </g>\n );\n }\n\n function _createFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n props.orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n tabIndex: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 0 : undefined,\n });\n });\n }\n\n function isStackedFunnelData(data: FunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: FunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: FunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n const geom =\n props.orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n tabIndex: legendHighlighted(subValue.category) || noLegendHighlighted() ? 0 : undefined,\n });\n }\n\n function _createStackedFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: Legend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: FunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: FunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n const classes = useFunnelChartStyles(props);\n\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n color: calloutData?.color,\n hoverXValue: calloutData?.stage,\n YValue: calloutData?.value,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n\n const funnelMarginTop = 40;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n const focusAttributes = useFocusableGroup();\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} {...focusAttributes} style={{ width, height }}>\n <svg width={width} height={height} className={classes.chart} role={'img'} aria-label={props.chartTitle}>\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n </svg>\n {isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n XValue={calloutProps?.hoverXValue as string}\n yCalloutValue={calloutProps?.YValue as string}\n culture={props.culture}\n clickPosition={clickPosition}\n isPopoverOpen={isPopoverOpen}\n color={calloutProps?.color}\n isCartesian={false}\n />\n )}\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChart.displayName = 'FunnelChart';\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nFunnelChart.defaultProps = {\n orientation: 'vertical',\n};\n"],"names":["React","useId","useRtl","Legends","useFocusableGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","toImage","FunnelChart","forwardRef","props","forwardedRef","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","chartContainerRef","useRef","isStacked","isStackedFunnelData","data","_legendsRef","useEffect","legendProps","useImperativeHandle","componentRef","opts","current","toSVG","_handleHover","mouseEvent","persist","updatePosition","clientX","clientY","_handleFocus","focusEvent","targetRect","target","getBoundingClientRect","left","width","top","height","_handleStackedHover","stage","subValue","value","color","category","_handleStackedFocus","_handleMouseOut","_onLegendSelectionChange","legendsSelected","event","currentLegend","canSelectMultipleLegends","slice","onChange","_onLegendSelectionChangeCallback","useCallback","getHighlightedLegend","length","legendHighlighted","legend","includes","noLegendHighlighted","_getEventHandlerProps","opacity","culture","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","orientation","textX","textY","availableWidth","minTextWidth","eventHandlerProps","Array","isArray","every","subValues","_renderStackedSegment","stageIndex","subValueIndex","geometryParams","stagesWithSubValues","stages","s","geom","k","_createStackedFunnel","totals","reduce","sum","maxTotal","Math","max","paths","cur","v","push","_renderLegends","hideLegend","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","classes","calloutProps","hoverXValue","YValue","funnelMarginTop","funnelOffsetX","focusAttributes","ref","className","root","svg","chart","role","aria-label","chartTitle","XValue","yCalloutValue","isCartesian","id","displayName","defaultProps"],"mappings":"AAAA;;;;;+BAuBae;;;;;;;iEArBU,QAAQ;gCACT,4BAA4B;uBAE3B,wBAAwB;wBAEE,mBAAmB;8BAClC,0BAA0B;8BAC/B,mCAAmC;gCAC3B,4BAA4B;wBAC5B,yBAAyB;4CACzB,gCAAgC;gCAO9D,mBAAmB;kCAEF,qCAAqC;AAEtD,oBAAMA,WAAAA,GAAyDf,OAAMgB,UAAU,CAGpF,CAACC,OAAOC;QAiBJD;IAhBJ,MAAME,oBAAwBlB,qBAAAA,EAAM;IACpC,MAAMmB,YAAQlB,aAAAA;IAEd,MAAM,CAACmB,cAAcC,gBAAgB,G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ErF,QACI,CAAC,UAAU,EAAEgK,gBAAgBjF,YAAY,EAAE,EAAEgF,gBAAgB,aAAa,CAAC,GAC3E,CAAC,UAAU,EAAEC,cAAc,EAAE,EAAED,gBAAgB,CAAC,CAAC;OAGtD/I,YACGwG,qBAAqB/E,SAASsH,iBAAiBhF,eAC/Ce,cAAcrD,SAASsH,iBAAiBhF,gBAG/CnE,iBAAAA,WAAAA,GACC,OAAA,aAAA,CAAC3B,0BAAAA,EAAAA;QACE,GAAGY,MAAM+J,YAAY;QACtBc,MAAM,EAAEd,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,WAAW;QACjCc,aAAa,EAAEf,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnC3F,SAAStE,MAAMsE,OAAO;QACtB3D,eAAeA;QACfI,eAAeA;QACfkC,KAAK,EAAE8G,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAc9G,KAAK;QAC1B8H,aAAa;QAGhBzC,oBAAAA,WAAAA,GAGH,OAAA,aAAA,CAACW,OAAAA;QAAI+B,IAAI9K;QAAewK,MAAM;QAASxB,OAAO;YAAE7E,SAAS;QAAI;QAAGsG,cAAY;;AAEhF,GAAG;AACH7K,YAAYmL,WAAW,GAAG;AAC1B,4DAA4D;AAC5DnL,YAAYoL,YAAY,GAAG;IACzB1E,aAAa;AACf"}
1
+ {"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getContrastTextColor } from '../../utilities/colors';\nimport { useFunnelChartStyles } from './useFunnelChartStyles.styles';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport { ChartPopoverProps, ImageExportOptions } from '../../index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>((props, forwardedRef) => {\n const _emptyChartId: string = useId('_FunnelChart_empty');\n const isRTL = useRtl();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [calloutData, setCalloutData] = React.useState<FunnelChartDataPoint | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const _legendsRef = React.useRef<LegendContainer>(null);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(chartContainerRef.current, _legendsRef.current?.toSVG, isRTL, opts);\n },\n }),\n [],\n );\n\n function _handleHover(\n data: FunnelChartDataPoint,\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleFocus(\n data: FunnelChartDataPoint,\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setPopoverOpen(false);\n setCalloutData(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getEventHandlerProps(\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n segmentId?: string,\n ) {\n const targetElement = document.getElementById(segmentId!);\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) =>\n _handleStackedFocus(data.stage, data.subValue, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onMouseMove:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n opacity,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n opacity: number;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text\n x={isRTL ? funnelWidth - x : x}\n y={y}\n opacity={opacity}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n fill={textColor}\n >\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n tabIndex,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n tabIndex?: number;\n }) {\n const segmentId = `funnel-segment-${key}`;\n const eventHandlers = _getEventHandlerProps(data, opacity, segmentId);\n const textColor = getContrastTextColor(fill);\n return (\n <g key={key}>\n <path id={segmentId} d={pathD} fill={fill} opacity={opacity} {...eventHandlers} tabIndex={tabIndex} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor, opacity })}</g>}\n </g>\n );\n }\n\n function _createFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n props.orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n tabIndex: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 0 : undefined,\n });\n });\n }\n\n function isStackedFunnelData(data: FunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: FunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: FunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n const geom =\n props.orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n tabIndex: legendHighlighted(subValue.category) || noLegendHighlighted() ? 0 : undefined,\n });\n }\n\n function _createStackedFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: Legend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: FunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: FunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n const classes = useFunnelChartStyles(props);\n\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n color: calloutData?.color,\n hoverXValue: calloutData?.stage,\n YValue: calloutData?.value,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n\n const funnelMarginTop = 40;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n const focusAttributes = useFocusableGroup();\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} {...focusAttributes} style={{ width, height }}>\n <svg width={width} height={height} className={classes.chart} role={'img'} aria-label={props.chartTitle}>\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n </svg>\n {isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n XValue={calloutProps?.hoverXValue as string}\n yCalloutValue={calloutProps?.YValue as string}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={isPopoverOpen}\n color={calloutProps?.color}\n isCartesian={false}\n />\n )}\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChart.displayName = 'FunnelChart';\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nFunnelChart.defaultProps = {\n orientation: 'vertical',\n};\n"],"names":["React","useId","useRtl","Legends","useFocusableGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","toImage","FunnelChart","forwardRef","props","forwardedRef","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","isPopoverOpen","setPopoverOpen","refSelected","setRefSelected","chartContainerRef","useRef","isStacked","isStackedFunnelData","data","_legendsRef","useEffect","legendProps","useImperativeHandle","componentRef","opts","current","toSVG","_handleHover","mouseEvent","targetElement","persist","_handleFocus","focusEvent","_handleStackedHover","stage","subValue","value","color","category","_handleStackedFocus","_handleMouseOut","_onLegendSelectionChange","legendsSelected","event","currentLegend","canSelectMultipleLegends","slice","onChange","_onLegendSelectionChangeCallback","useCallback","getHighlightedLegend","length","legendHighlighted","legend","includes","noLegendHighlighted","_getEventHandlerProps","opacity","segmentId","document","getElementById","culture","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","x","y","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","id","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","orientation","textX","textY","availableWidth","minTextWidth","eventHandlerProps","Array","isArray","every","subValues","_renderStackedSegment","stageIndex","subValueIndex","geometryParams","stagesWithSubValues","stages","s","geom","k","_createStackedFunnel","totals","reduce","sum","maxTotal","Math","max","paths","cur","v","push","_renderLegends","hideLegend","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","classes","calloutProps","hoverXValue","YValue","width","height","funnelMarginTop","funnelOffsetX","focusAttributes","ref","className","root","svg","chart","role","aria-label","chartTitle","XValue","yCalloutValue","positioning","target","isCartesian","displayName","defaultProps"],"mappings":"AAAA;;;;;+BAuBae;;;;;;;iEArBU,QAAQ;gCACT,4BAA4B;uBAE3B,wBAAwB;wBAEE,mBAAmB;8BAClC,0BAA0B;8BAC/B,mCAAmC;gCAC3B,4BAA4B;wBAC5B,yBAAyB;4CACzB,gCAAgC;gCAO9D,mBAAmB;kCAEF,qCAAqC;AAEtD,oBAAMA,WAAAA,GAAyDf,OAAMgB,UAAU,CAGpF,CAACC,OAAOC;QAiBJD;IAhBJ,MAAME,oBAAwBlB,qBAAAA,EAAM;IACpC,MAAMmB,YAAQlB,aAAAA;IAEd,MAAM,CAACmB,cAAcC,gBAAgB,GAAGtB,OAAMuB,QAAQ,CAAgB;IACtE,MAAM,CAACC,aAAaC,eAAe,GAAGzB,OAAMuB,QAAQ,CAA8B;IAClF,MAAM,CAACG,iBAAiBC,mBAAmB,GAAG3B,OAAMuB,QAAQ,CAAW,EAAE;IACzE,MAAM,CAACK,eAAeC,eAAe,GAAG7B,OAAMuB,QAAQ,CAAC;IACvD,MAAM,CAACO,aAAaC,eAAe,GAAG/B,OAAMuB,QAAQ,CAAqB;IACzE,MAAMS,oBAAoBhC,OAAMiC,MAAM,CAAwB;IAC9D,MAAMC,YAAYC,oBAAoBlB,MAAMmB,IAAI;IAChD,MAAMC,cAAcrC,OAAMiC,MAAM,CAAkB;IAElDjC,OAAMsC,SAAS,CAAC;YACVrB;QAAJ,IAAA,CAAIA,qBAA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c9l5x: "ftgm304",
@@ -60,6 +64,8 @@ const funnelClassNames = {
60
64
  ".fkhj508{font-size:var(--fontSizeBase300);}",
61
65
  ".figsok6{font-weight:var(--fontWeightRegular);}",
62
66
  ".f10pi13n{position:relative;}",
67
+ ".f1o700av{text-align:left;}",
68
+ ".fes3tcz{text-align:right;}",
63
69
  ".ftgm304{display:block;}",
64
70
  ".f1aehjj5{pointer-events:none;}",
65
71
  ".fl43uef{font-weight:var(--fontWeightSemibold);}",
@@ -1 +1 @@
1
- {"version":3,"sources":["useFunnelChartStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const funnelClassNames = {\n root: 'fui-funnel__root',\n chart: 'fui-funnel__chart',\n text: 'fui-funnel__text',\n calloutContentRoot: 'fui-funnel__callout-content-root'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n position: 'relative'\n },\n chart: {\n display: 'block',\n width: '100%',\n height: '100%'\n },\n text: {\n pointerEvents: 'none',\n fontWeight: tokens.fontWeightSemibold,\n fill: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300\n },\n calloutContentRoot: {\n maxWidth: '238px'\n }\n});\n/**\n * Apply styling to the FunnelChart component\n */ export const useFunnelChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2, _props_styles3;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(funnelClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n chart: mergeClasses(funnelClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),\n text: mergeClasses(funnelClassNames.text, baseStyles.text, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.text),\n calloutContentRoot: mergeClasses(baseStyles.calloutContentRoot, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.calloutContentRoot)\n };\n};\n"],"names":["__styles","mergeClasses","tokens","funnelClassNames","root","chart","text","calloutContentRoot","useStyles","Bt984gj","a9b677","Bqenvij","Bahqtrf","Be2twd7","Bhrd7zp","qhf8xq","mc9l5x","Bkecrkj","Bkfmm31","B2u0y6b","d","useFunnelChartStyles","props","_props_styles","_props_styles1","_props_styles2","_props_styles3","className","baseStyles","styles"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAKKG,gBAAgB;;;wBAoCI;eAApBkB;;;uBAxCwB,gBAAgB;AAI9C,yBAAyB;IAChCjB,IAAI,EAAE,kBAAkB;IACxBC,KAAK,EAAE,mBAAmB;IAC1BC,IAAI,EAAE,kBAAkB;IACxBC,kBAAkB,EAAE;AACxB,CAAC;AACD;;CAEA,GAAI,MAAMC,SAAS,GAAA,WAAA,OAAGR,eAAA,EAAA;IAAAI,IAAA,EAAA;QAAAK,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAV,KAAA,EAAA;QAAAW,MAAA,EAAA;QAAAN,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAL,IAAA,EAAA;QAAAW,OAAA,EAAA;QAAAH,OAAA,EAAA;QAAAI,OAAA,EAAA;QAAAN,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAN,kBAAA,EAAA;QAAAY,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAyBrB,CAAC;AAGS,8BAA8BE,KAAK,IAAG;IAC7C,IAAIC,aAAa,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc;IACjE,MAAM,EAAEC,SAAAA,EAAW,GAAGL,KAAK;IAC3B,MAAMM,UAAU,GAAGpB,SAAS,CAAC,CAAC;IAC9B,OAAO;QACHJ,IAAI,MAAEH,mBAAY,EAACE,gBAAgB,CAACC,IAAI,EAAEwB,UAAU,CAACxB,IAAI,EAAEuB,SAAS,EAAE,CAACJ,aAAa,GAAGD,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIN,aAAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACnB,IAAI,CAAC;QACxKC,KAAK,MAAEJ,mBAAY,EAACE,gBAAgB,CAACE,KAAK,EAAEuB,UAAU,CAACvB,KAAK,EAAE,CAACmB,cAAc,GAAGF,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIL,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACnB,KAAK,CAAC;QACpKC,IAAI,MAAEL,mBAAY,EAACE,gBAAgB,CAACG,IAAI,EAAEsB,UAAU,CAACtB,IAAI,EAAE,CAACmB,cAAc,GAAGH,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIJ,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACnB,IAAI,CAAC;QAChKC,kBAAkB,MAAEN,mBAAY,EAAC2B,UAAU,CAACrB,kBAAkB,EAAE,CAACmB,cAAc,GAAGJ,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIH,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACnB,kBAAkB;IACtL,CAAC;AACL,CAAC"}
1
+ {"version":3,"sources":["useFunnelChartStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const funnelClassNames = {\n root: 'fui-funnel__root',\n chart: 'fui-funnel__chart',\n text: 'fui-funnel__text',\n calloutContentRoot: 'fui-funnel__callout-content-root'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n position: 'relative',\n textAlign: 'left'\n },\n chart: {\n display: 'block',\n width: '100%',\n height: '100%'\n },\n text: {\n pointerEvents: 'none',\n fontWeight: tokens.fontWeightSemibold,\n fill: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300\n },\n calloutContentRoot: {\n maxWidth: '238px'\n }\n});\n/**\n * Apply styling to the FunnelChart component\n */ export const useFunnelChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2, _props_styles3;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(funnelClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n chart: mergeClasses(funnelClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),\n text: mergeClasses(funnelClassNames.text, baseStyles.text, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.text),\n calloutContentRoot: mergeClasses(baseStyles.calloutContentRoot, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.calloutContentRoot)\n };\n};\n"],"names":["__styles","mergeClasses","tokens","funnelClassNames","root","chart","text","calloutContentRoot","useStyles","Bt984gj","a9b677","Bqenvij","Bahqtrf","Be2twd7","Bhrd7zp","qhf8xq","fsow6f","mc9l5x","Bkecrkj","Bkfmm31","B2u0y6b","d","useFunnelChartStyles","props","_props_styles","_props_styles1","_props_styles2","_props_styles3","className","baseStyles","styles"],"mappings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AAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACpB,IAAI,CAAC;QACxKC,KAAK,EAAEJ,uBAAY,EAACE,gBAAgB,CAACE,KAAK,EAAEwB,UAAU,CAACxB,KAAK,EAAE,CAACoB,cAAc,GAAGF,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIL,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACpB,KAAK,CAAC;QACpKC,IAAI,MAAEL,mBAAY,EAACE,gBAAgB,CAACG,IAAI,EAAEuB,UAAU,CAACvB,IAAI,EAAE,CAACoB,cAAc,GAAGH,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIJ,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACpB,IAAI,CAAC;QAChKC,kBAAkB,MAAEN,mBAAY,EAAC4B,UAAU,CAACtB,kBAAkB,EAAE,CAACoB,cAAc,GAAGJ,KAAK,CAACO,MAAAA,AAAM,MAAM,IAAI,IAAIH,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACpB,kBAAkB;IACtL,CAAC;AACL,CAAC"}
@@ -35,7 +35,8 @@ const funnelClassNames = {
35
35
  fontFamily: _reacttheme.tokens.fontFamilyBase,
36
36
  fontSize: _reacttheme.tokens.fontSizeBase300,
37
37
  fontWeight: _reacttheme.tokens.fontWeightRegular,
38
- position: 'relative'
38
+ position: 'relative',
39
+ textAlign: 'left'
39
40
  },
40
41
  chart: {
41
42
  display: 'block',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/FunnelChart/useFunnelChartStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { FunnelChartProps, FunnelChartStyles } from './index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n/**\n * @internal\n */\nexport const funnelClassNames: SlotClassNames<FunnelChartStyles> = {\n root: 'fui-funnel__root',\n chart: 'fui-funnel__chart',\n text: 'fui-funnel__text',\n calloutContentRoot: 'fui-funnel__callout-content-root',\n};\n\n/**\n * Base Styles\n */\nconst useStyles = makeStyles({\n root: {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n position: 'relative',\n },\n chart: {\n display: 'block',\n width: '100%',\n height: '100%',\n },\n text: {\n pointerEvents: 'none',\n fontWeight: tokens.fontWeightSemibold,\n fill: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n },\n calloutContentRoot: {\n maxWidth: '238px',\n },\n});\n\n/**\n * Apply styling to the FunnelChart component\n */\nexport const useFunnelChartStyles = (props: FunnelChartProps): FunnelChartStyles => {\n const { className } = props;\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(funnelClassNames.root, baseStyles.root, className, props.styles?.root),\n chart: mergeClasses(funnelClassNames.chart, baseStyles.chart, props.styles?.chart),\n text: mergeClasses(funnelClassNames.text, baseStyles.text, props.styles?.text),\n calloutContentRoot: mergeClasses(baseStyles.calloutContentRoot, props.styles?.calloutContentRoot),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","funnelClassNames","root","chart","text","calloutContentRoot","useStyles","alignItems","width","height","fontFamily","fontFamilyBase","fontSize","fontSizeBase300","fontWeight","fontWeightRegular","position","display","pointerEvents","fontWeightSemibold","fill","colorNeutralForeground1","maxWidth","useFunnelChartStyles","props","className","baseStyles","styles"],"mappings":"AAAA;;;;;;;;;;;;IAUaG,gBAAAA;;;wBAwCAsB;eAAAA;;;uBAhD4B,iBAAiB;4BACnC,wBAAwB;AAOxC,yBAA4D;IACjErB,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,oBAAoB;AACtB,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYR,iBAAAA,EA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AAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcnB,kBAAkB;IAClG;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/FunnelChart/useFunnelChartStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { FunnelChartProps, FunnelChartStyles } from './index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n/**\n * @internal\n */\nexport const funnelClassNames: SlotClassNames<FunnelChartStyles> = {\n root: 'fui-funnel__root',\n chart: 'fui-funnel__chart',\n text: 'fui-funnel__text',\n calloutContentRoot: 'fui-funnel__callout-content-root',\n};\n\n/**\n * Base Styles\n */\nconst useStyles = makeStyles({\n root: {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n position: 'relative',\n textAlign: 'left',\n },\n chart: {\n display: 'block',\n width: '100%',\n height: '100%',\n },\n text: {\n pointerEvents: 'none',\n fontWeight: tokens.fontWeightSemibold,\n fill: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n },\n calloutContentRoot: {\n maxWidth: '238px',\n },\n});\n\n/**\n * Apply styling to the FunnelChart component\n */\nexport const useFunnelChartStyles = (props: FunnelChartProps): FunnelChartStyles => {\n const { className } = props;\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(funnelClassNames.root, baseStyles.root, className, props.styles?.root),\n chart: mergeClasses(funnelClassNames.chart, baseStyles.chart, props.styles?.chart),\n text: mergeClasses(funnelClassNames.text, baseStyles.text, props.styles?.text),\n calloutContentRoot: mergeClasses(baseStyles.calloutContentRoot, props.styles?.calloutContentRoot),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","funnelClassNames","root","chart","text","calloutContentRoot","useStyles","alignItems","width","height","fontFamily","fontFamilyBase","fontSize","fontSizeBase300","fontWeight","fontWeightRegular","position","textAlign","display","pointerEvents","fontWeightSemibold","fill","colorNeutralForeground1","maxWidth","useFunnelChartStyles","props","className","baseStyles","styles"],"mappings":"AAAA;;;;;;;;;;;;IAUaG,gBAAAA;;;wBAyCAuB;eAAAA;;;uBAjD4B,iBAAiB;4BACnC,wBAAwB;AAOxC,yBAA4D;IACjEtB,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,oBAAoB;AACtB,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYR,iBAAAA,EAAW;IAC3BI,MAAM;QACJK,YAAY;QACZC,OAAO;QACPC,QAAQ;QACRC,YAAYV,kBAAAA,CAAOW,cAAc;QACjCC,UAAUZ,kBAAAA,CAAOa,eAAe;QAChCC,YAAYd,kBAAAA,CAAOe,iBAAiB;QACpCC,UAAU;QACVC,WAAW;IACb;IACAd,OAAO;QACLe,SAAS;QACTV,OAAO;QACPC,QAAQ;IACV;IACAL,MAAM;QACJe,eAAe;QACfL,YAAYd,kBAAAA,CAAOoB,kBAAkB;QACrCC,MAAMrB,kBAAAA,CAAOsB,uBAAuB;QACpCZ,YAAYV,kBAAAA,CAAOW,cAAc;QACjCC,UAAUZ,kBAAAA,CAAOa,eAAe;IAClC;IACAR,oBAAoB;QAClBkB,UAAU;IACZ;AACF;AAKO,6BAA6B,CAACE;QAKqCA,eACRA,gBACHA,gBACKA;IAPlE,MAAM,EAAEC,SAAS,EAAE,GAAGD;IACtB,MAAME,aAAarB;IAEnB,OAAO;QACLJ,UAAMH,mBAAAA,EAAaE,iBAAiBC,IAAI,EAAEyB,WAAWzB,IAAI,EAAEwB,WAAAA,CAAWD,gBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcvB,IAAI;QACxFC,OAAOJ,uBAAAA,EAAaE,iBAAiBE,KAAK,EAAEwB,WAAWxB,KAAK,EAAA,CAAEsB,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAActB,KAAK;QACjFC,UAAML,mBAAAA,EAAaE,iBAAiBG,IAAI,EAAEuB,WAAWvB,IAAI,EAAA,CAAEqB,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcrB,IAAI;QAC7EC,wBAAoBN,mBAAAA,EAAa4B,WAAWtB,kBAAkB,EAAA,CAAEoB,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcpB,kBAAkB;IAClG;AACF,EAAE"}
@@ -127,14 +127,10 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
127
127
  const [hoveredLegend, setHoveredLegend] = _react.useState('');
128
128
  const [selectedLegends, setSelectedLegends] = _react.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
129
129
  const [focusedElement, setFocusedElement] = _react.useState('');
130
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
- const [clickPosition, setClickPosition] = _react.useState({
132
- x: 0,
133
- y: 0
134
- });
135
130
  const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
136
131
  const [hoverXValue, setHoverXValue] = _react.useState('');
137
132
  const [hoverYValues, setHoverYValues] = _react.useState([]);
133
+ const [refSelected, setRefSelected] = _react.useState(null);
138
134
  const prevPropsRef = _react.useRef(null);
139
135
  const _width = props.width || width;
140
136
  const _height = props.height || height;
@@ -244,6 +240,7 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
244
240
  const strokeWidth = 2;
245
241
  const halfStrokeWidth = strokeWidth / 2;
246
242
  const needleLength = _outerRadius - _innerRadius + EXTRA_NEEDLE_LENGTH;
243
+ const needleId = `gauge-chart-needle`;
247
244
  return /*#__PURE__*/ _react.createElement("g", {
248
245
  transform: `rotate(${rtlSafeNeedleRotation}, 0, 0)`
249
246
  }, /*#__PURE__*/ _react.createElement("path", {
@@ -254,14 +251,15 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
254
251
  L 0,${halfStrokeWidth + 3}
255
252
  A ${halfStrokeWidth + 3},${halfStrokeWidth + 3},0,0,0,0,${-halfStrokeWidth - 3}
256
253
  `,
254
+ id: needleId,
257
255
  strokeWidth: strokeWidth,
258
256
  className: classes.needle,
259
257
  transform: `translate(${-_innerRadius + EXTRA_NEEDLE_LENGTH / 2})`,
260
258
  "data-is-focusable": true,
261
- onFocus: (e)=>_handleFocus(e, 'Needle'),
259
+ onFocus: (e)=>_handleFocus(e, 'Needle', needleId),
262
260
  onBlur: _handleBlur,
263
- onMouseEnter: (e)=>_handleMouseOver(e, 'Needle'),
264
- onMouseMove: (e)=>_handleMouseOver(e, 'Needle'),
261
+ onMouseEnter: (e)=>_handleMouseOver(e, 'Needle', needleId),
262
+ onMouseMove: (e)=>_handleMouseOver(e, 'Needle', needleId),
265
263
  role: "img",
266
264
  "aria-label": 'Current value: ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat)
267
265
  }));
@@ -324,14 +322,14 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
324
322
  ] : [];
325
323
  }
326
324
  // eslint-disable-next-line @typescript-eslint/no-shadow
327
- function _handleFocus(focusEvent, focusedElement) {
328
- _showCallout(focusEvent, focusedElement, true);
325
+ function _handleFocus(focusEvent, focusedElement, elementId) {
326
+ _showCallout(focusEvent, focusedElement, true, elementId);
329
327
  }
330
328
  function _handleBlur() {
331
329
  _hideCallout(true);
332
330
  }
333
- function _handleMouseOver(mouseEvent, hoveredElement) {
334
- _showCallout(mouseEvent, hoveredElement, false);
331
+ function _handleMouseOver(mouseEvent, hoveredElement, elementId) {
332
+ _showCallout(mouseEvent, hoveredElement, false, elementId);
335
333
  }
336
334
  function _handleMouseOut() {
337
335
  _hideCallout(false);
@@ -340,24 +338,11 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
340
338
  _hideCallout(false);
341
339
  }
342
340
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
343
- function _showCallout(event, legend, isFocusEvent) {
341
+ function _showCallout(event, legend, isFocusEvent, elementId) {
344
342
  if (_calloutAnchor === legend) {
345
343
  return;
346
344
  }
347
- let clientX = 0;
348
- let clientY = 0;
349
- if ('clientX' in event) {
350
- clientX = event.clientX;
351
- clientY = event.clientY;
352
- } else {
353
- // eslint-disable-next-line @typescript-eslint/no-shadow
354
- const target = event.currentTarget;
355
- if (target && 'getBoundingClientRect' in target) {
356
- const boundingRect = target.getBoundingClientRect();
357
- clientX = boundingRect.left + boundingRect.width / 2;
358
- clientY = boundingRect.top + boundingRect.height / 2;
359
- }
360
- }
345
+ const targetElement = document.getElementById(elementId);
361
346
  _calloutAnchor = legend;
362
347
  // eslint-disable-next-line @typescript-eslint/no-shadow
363
348
  const hoverXValue = 'Current value is ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat, true);
@@ -370,11 +355,11 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
370
355
  };
371
356
  return yValue;
372
357
  });
373
- _updatePosition(clientX, clientY);
374
358
  setPopoverOpen([
375
359
  'Needle',
376
360
  'Chart value'
377
361
  ].includes(legend) || _noLegendHighlighted() || _legendHighlighted(legend));
362
+ setRefSelected(targetElement);
378
363
  setHoverXValue(hoverXValue);
379
364
  setHoverYValues(hoverYValues);
380
365
  if (isFocusEvent) {
@@ -510,20 +495,6 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
510
495
  }));
511
496
  }
512
497
  }
513
- function _updatePosition(newX, newY) {
514
- const threshold = 1; // Set a threshold for movement
515
- const { x, y } = clickPosition;
516
- // Calculate the distance moved
517
- const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
518
- // Update the position only if the distance moved is greater than the threshold
519
- if (distance > threshold) {
520
- setClickPosition({
521
- x: newX,
522
- y: newY
523
- });
524
- setPopoverOpen(true);
525
- }
526
- }
527
498
  function _getChartTitle() {
528
499
  const { chartTitle } = props;
529
500
  return (chartTitle ? `${chartTitle}. ` : '') + `Gauge chart with ${_segments.length} segments. `;
@@ -567,10 +538,12 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
567
538
  "aria-label": `Max value: ${_maxValue}`
568
539
  }, (0, _index.formatScientificLimitWidth)(_maxValue))), arcs.map((arc, index)=>{
569
540
  const segment = _segments[arc.segmentIndex];
541
+ const arcId = `gauge-chart-arc-${index}`;
570
542
  return /*#__PURE__*/ _react.createElement(_react.Fragment, {
571
543
  key: index
572
544
  }, /*#__PURE__*/ _react.createElement("path", {
573
545
  d: arc.d,
546
+ id: arcId,
574
547
  strokeWidth: focusedElement === segment.legend ? ARC_PADDING : 0,
575
548
  className: classes.segment,
576
549
  fill: segment.color,
@@ -579,11 +552,11 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
579
552
  ariaLabel: getSegmentLabel(segment, _minValue, _maxValue, props.variant, true),
580
553
  ...segment.accessibilityData
581
554
  }, 'img', true),
582
- onFocus: (e)=>_handleFocus(e, segment.legend),
555
+ onFocus: (e)=>_handleFocus(e, segment.legend, arcId),
583
556
  onBlur: _handleBlur,
584
- onMouseEnter: (e)=>_handleMouseOver(e, segment.legend),
557
+ onMouseEnter: (e)=>_handleMouseOver(e, segment.legend, arcId),
585
558
  onMouseLeave: (e)=>_handleCalloutDismiss(),
586
- onMouseMove: (e)=>_handleMouseOver(e, segment.legend),
559
+ onMouseMove: (e)=>_handleMouseOver(e, segment.legend, arcId),
587
560
  tabIndex: _legendHighlighted(segment.legend) || _noLegendHighlighted() ? 0 : undefined
588
561
  }));
589
562
  }), _renderNeedle(), /*#__PURE__*/ _react.createElement("g", {
@@ -614,7 +587,9 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
614
587
  wrapContent: _wrapContent
615
588
  })))), _renderLegends(), !props.hideTooltip && isPopoverOpen && /*#__PURE__*/ _react.createElement(_ChartPopover.ChartPopover, {
616
589
  ...props.calloutProps,
617
- clickPosition: clickPosition,
590
+ positioning: {
591
+ target: refSelected
592
+ },
618
593
  isPopoverOpen: isPopoverOpen,
619
594
  customCallout: {
620
595
  customizedCallout: _multiValueCallout({