@fluentui/react-charts 0.0.0-nightly-20250722-0406.1 → 0.0.0-nightly-20250724-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.
Files changed (35) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/dist/index.d.ts +133 -0
  3. package/lib/FunnelChart.js +1 -0
  4. package/lib/FunnelChart.js.map +1 -0
  5. package/lib/components/FunnelChart/FunnelChart.js +391 -0
  6. package/lib/components/FunnelChart/FunnelChart.js.map +1 -0
  7. package/lib/components/FunnelChart/FunnelChart.types.js +1 -0
  8. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -0
  9. package/lib/components/FunnelChart/funnelGeometry.js +220 -0
  10. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -0
  11. package/lib/components/FunnelChart/index.js +2 -0
  12. package/lib/components/FunnelChart/index.js.map +1 -0
  13. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +59 -0
  14. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
  15. package/lib/index.js +1 -0
  16. package/lib/index.js.map +1 -1
  17. package/lib/utilities/colors.js +12 -0
  18. package/lib/utilities/colors.js.map +1 -1
  19. package/lib-commonjs/FunnelChart.js +6 -0
  20. package/lib-commonjs/FunnelChart.js.map +1 -0
  21. package/lib-commonjs/components/FunnelChart/FunnelChart.js +402 -0
  22. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -0
  23. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js +6 -0
  24. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -0
  25. package/lib-commonjs/components/FunnelChart/funnelGeometry.js +248 -0
  26. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -0
  27. package/lib-commonjs/components/FunnelChart/index.js +7 -0
  28. package/lib-commonjs/components/FunnelChart/index.js.map +1 -0
  29. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +79 -0
  30. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
  31. package/lib-commonjs/index.js +1 -0
  32. package/lib-commonjs/index.js.map +1 -1
  33. package/lib-commonjs/utilities/colors.js +18 -0
  34. package/lib-commonjs/utilities/colors.js.map +1 -1
  35. package/package.json +12 -12
@@ -0,0 +1,402 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FunnelChart", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FunnelChart;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _index = require("../../utilities/index");
15
+ const _index1 = require("../Legends/index");
16
+ const _reacttabster = require("@fluentui/react-tabster");
17
+ const _ChartPopover = require("../CommonComponents/ChartPopover");
18
+ const _chartutilities = require("@fluentui/chart-utilities");
19
+ const _colors = require("../../utilities/colors");
20
+ const _useFunnelChartStylesstyles = require("./useFunnelChartStyles.styles");
21
+ const _funnelGeometry = require("./funnelGeometry");
22
+ const FunnelChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
23
+ var _props_legendProps;
24
+ const _emptyChartId = (0, _reactutilities.useId)('_FunnelChart_empty');
25
+ const isRTL = (0, _index.useRtl)();
26
+ const [hoveredStage, setHoveredStage] = _react.useState(null);
27
+ const [calloutData, setCalloutData] = _react.useState(null);
28
+ const [selectedLegends, setSelectedLegends] = _react.useState([]);
29
+ const [clickPosition, setClickPosition] = _react.useState({
30
+ x: 0,
31
+ y: 0
32
+ });
33
+ const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
34
+ const chartContainerRef = _react.useRef(null);
35
+ const isStacked = isStackedFunnelData(props.data);
36
+ _react.useEffect(()=>{
37
+ var _props_legendProps;
38
+ if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) {
39
+ setSelectedLegends(props.legendProps.selectedLegends);
40
+ }
41
+ }, [
42
+ (_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends
43
+ ]);
44
+ function _handleHover(data, mouseEvent) {
45
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
46
+ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
47
+ setCalloutData(data);
48
+ setPopoverOpen(true);
49
+ }
50
+ function _handleFocus(data, focusEvent) {
51
+ focusEvent === null || focusEvent === void 0 ? void 0 : focusEvent.persist();
52
+ let x = 0;
53
+ let y = 0;
54
+ const targetRect = focusEvent.target.getBoundingClientRect();
55
+ x = targetRect.left + targetRect.width / 2;
56
+ y = targetRect.top + targetRect.height / 2;
57
+ updatePosition(x, y);
58
+ setCalloutData(data);
59
+ setPopoverOpen(true);
60
+ }
61
+ function _handleStackedHover(stage, subValue, mouseEvent) {
62
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
63
+ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
64
+ setCalloutData({
65
+ stage,
66
+ value: subValue.value,
67
+ color: subValue.color,
68
+ category: subValue.category
69
+ });
70
+ setPopoverOpen(true);
71
+ }
72
+ function _handleStackedFocus(stage, subValue, focusEvent) {
73
+ focusEvent === null || focusEvent === void 0 ? void 0 : focusEvent.persist();
74
+ let x = 0;
75
+ let y = 0;
76
+ const targetRect = focusEvent.target.getBoundingClientRect();
77
+ x = targetRect.left + targetRect.width / 2;
78
+ y = targetRect.top + targetRect.height / 2;
79
+ updatePosition(x, y);
80
+ setCalloutData({
81
+ stage,
82
+ value: subValue.value,
83
+ color: subValue.color,
84
+ category: subValue.category
85
+ });
86
+ setPopoverOpen(true);
87
+ }
88
+ function _handleMouseOut() {
89
+ setHoveredStage(null);
90
+ setPopoverOpen(false);
91
+ setCalloutData(null);
92
+ }
93
+ function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
94
+ var _props_legendProps, _props_legendProps1;
95
+ if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.canSelectMultipleLegends) {
96
+ setSelectedLegends(legendsSelected);
97
+ } else {
98
+ setSelectedLegends(legendsSelected.slice(-1));
99
+ }
100
+ if ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.onChange) {
101
+ props.legendProps.onChange(legendsSelected, event, currentLegend);
102
+ }
103
+ }
104
+ const _onLegendSelectionChangeCallback = _react.useCallback(_onLegendSelectionChange, [
105
+ props.legendProps
106
+ ]);
107
+ function getHighlightedLegend() {
108
+ return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [
109
+ hoveredStage
110
+ ] : [];
111
+ }
112
+ function legendHighlighted(legend) {
113
+ return getHighlightedLegend().includes(legend);
114
+ }
115
+ function noLegendHighlighted() {
116
+ return getHighlightedLegend().length === 0;
117
+ }
118
+ function _getEventHandlerProps(data, opacity) {
119
+ if ('subValue' in data) {
120
+ return {
121
+ culture: props.culture,
122
+ onMouseOver: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event) : undefined,
123
+ onMouseMove: opacity == 1 ? (event)=>_handleStackedHover(data.stage, data.subValue, event) : undefined,
124
+ onFocus: (event)=>_handleStackedFocus(data.stage, data.subValue, event),
125
+ onBlur: ()=>_handleMouseOut(),
126
+ onMouseOut: ()=>_handleMouseOut()
127
+ };
128
+ } else {
129
+ return {
130
+ culture: props.culture,
131
+ onMouseOver: opacity == 1 ? (event)=>_handleHover(data, event) : undefined,
132
+ onMouseMove: opacity == 1 ? (event)=>_handleHover(data, event) : undefined,
133
+ onFocus: (event)=>_handleFocus(data, event),
134
+ onBlur: ()=>_handleMouseOut(),
135
+ onMouseOut: ()=>_handleMouseOut()
136
+ };
137
+ }
138
+ }
139
+ function _renderSegmentText({ show, x, y, value, textColor }) {
140
+ if (!show) {
141
+ return null;
142
+ }
143
+ const textElement = /*#__PURE__*/ _react.createElement("text", {
144
+ x: isRTL ? funnelWidth - x : x,
145
+ y: y,
146
+ textAnchor: "middle",
147
+ alignmentBaseline: "middle",
148
+ fill: textColor
149
+ }, (0, _chartutilities.formatToLocaleString)(value.toString(), props.culture));
150
+ if (isRTL) {
151
+ return /*#__PURE__*/ _react.createElement("g", {
152
+ transform: `scale(-1,1) translate(${-funnelWidth},0)`
153
+ }, textElement);
154
+ }
155
+ return textElement;
156
+ }
157
+ function _renderFunnelSegment({ key, pathD, fill, opacity, textProps, data, tabIndex }) {
158
+ const eventHandlers = _getEventHandlerProps(data, opacity);
159
+ const textColor = (0, _colors.getContrastTextColor)(fill);
160
+ return /*#__PURE__*/ _react.createElement("g", {
161
+ key: key
162
+ }, /*#__PURE__*/ _react.createElement("path", {
163
+ d: pathD,
164
+ fill: fill,
165
+ opacity: opacity,
166
+ ...eventHandlers,
167
+ tabIndex: tabIndex
168
+ }), textProps && /*#__PURE__*/ _react.createElement("g", eventHandlers, _renderSegmentText({
169
+ ...textProps,
170
+ textColor
171
+ })));
172
+ }
173
+ function _createFunnel(containerHeight, containerWidth) {
174
+ const { data } = props;
175
+ const funnelWidth = containerWidth;
176
+ const funnelHeight = containerHeight * 0.8;
177
+ return data.map((d, i)=>{
178
+ const geometryProps = props.orientation === 'vertical' ? (0, _funnelGeometry.getVerticalFunnelSegmentGeometry)({
179
+ d,
180
+ i,
181
+ data,
182
+ funnelWidth,
183
+ funnelHeight,
184
+ isRTL
185
+ }) : (0, _funnelGeometry.getHorizontalFunnelSegmentGeometry)({
186
+ d,
187
+ i,
188
+ data,
189
+ funnelWidth,
190
+ funnelHeight,
191
+ isRTL
192
+ });
193
+ const { pathD, textX, textY, availableWidth } = geometryProps;
194
+ const minTextWidth = 16;
195
+ const eventHandlerProps = _getEventHandlerProps(d);
196
+ const textProps = (0, _funnelGeometry.getSegmentTextProps)({
197
+ availableWidth,
198
+ minTextWidth,
199
+ textX,
200
+ textY,
201
+ value: d.value,
202
+ ...eventHandlerProps
203
+ });
204
+ return _renderFunnelSegment({
205
+ key: i,
206
+ pathD,
207
+ fill: d.color,
208
+ opacity: legendHighlighted(d.stage) || noLegendHighlighted() ? 1 : 0.1,
209
+ textProps,
210
+ data: d,
211
+ tabIndex: legendHighlighted(d.stage) || noLegendHighlighted() ? 0 : undefined
212
+ });
213
+ });
214
+ }
215
+ function isStackedFunnelData(data) {
216
+ return Array.isArray(data) && data.every((stage)=>Array.isArray(stage.subValues));
217
+ }
218
+ function _renderStackedSegment(stage, subValue, stageIndex, subValueIndex, geometryParams) {
219
+ // Ensure stages have subValues for geometry functions
220
+ const stagesWithSubValues = geometryParams.stages.map((s)=>({
221
+ ...s,
222
+ subValues: s.subValues || []
223
+ }));
224
+ const geom = props.orientation === 'vertical' ? (0, _funnelGeometry.getStackedVerticalFunnelSegmentGeometry)({
225
+ ...geometryParams,
226
+ stages: stagesWithSubValues,
227
+ i: stageIndex,
228
+ k: subValueIndex
229
+ }) : (0, _funnelGeometry.getStackedHorizontalFunnelSegmentGeometry)({
230
+ ...geometryParams,
231
+ stages: stagesWithSubValues,
232
+ i: stageIndex,
233
+ k: subValueIndex
234
+ });
235
+ const minTextWidth = 16;
236
+ const eventHandlerProps = _getEventHandlerProps({
237
+ stage: stage.stage,
238
+ subValue
239
+ });
240
+ const textProps = (0, _funnelGeometry.getSegmentTextProps)({
241
+ availableWidth: geom.availableWidth,
242
+ minTextWidth,
243
+ textX: geom.textX,
244
+ textY: geom.textY,
245
+ value: subValue.value,
246
+ ...eventHandlerProps
247
+ });
248
+ return _renderFunnelSegment({
249
+ key: `${stageIndex}-${subValueIndex}`,
250
+ pathD: geom.pathD,
251
+ fill: subValue.color,
252
+ opacity: isStackedFunnelData(props.data) && legendHighlighted(subValue.category) || noLegendHighlighted() ? 1 : 0.1,
253
+ textProps,
254
+ data: {
255
+ stage: stage.stage,
256
+ subValue
257
+ },
258
+ tabIndex: legendHighlighted(subValue.category) || noLegendHighlighted() ? 0 : undefined
259
+ });
260
+ }
261
+ function _createStackedFunnel(containerHeight, containerWidth) {
262
+ const { data } = props;
263
+ const stages = data;
264
+ const totals = stages.map((s)=>{
265
+ var _s_subValues;
266
+ var _s_subValues_reduce;
267
+ return (_s_subValues_reduce = s === null || s === void 0 ? void 0 : (_s_subValues = s.subValues) === null || _s_subValues === void 0 ? void 0 : _s_subValues.reduce((sum, subValue)=>sum + subValue.value, 0)) !== null && _s_subValues_reduce !== void 0 ? _s_subValues_reduce : 0;
268
+ });
269
+ const maxTotal = Math.max(...totals);
270
+ const funnelWidth = containerWidth;
271
+ const funnelHeight = containerHeight * 0.8;
272
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
273
+ const paths = [];
274
+ const geometryParams = {
275
+ stages,
276
+ totals,
277
+ maxTotal,
278
+ funnelWidth,
279
+ funnelHeight,
280
+ isRTL
281
+ };
282
+ for(let i = 0; i < stages.length; i++){
283
+ const cur = stages[i];
284
+ var _cur_subValues;
285
+ for(let k = 0; k < ((_cur_subValues = cur.subValues) !== null && _cur_subValues !== void 0 ? _cur_subValues : []).length; k++){
286
+ var _cur_subValues1;
287
+ const v = (_cur_subValues1 = cur.subValues) === null || _cur_subValues1 === void 0 ? void 0 : _cur_subValues1[k];
288
+ if (!v) {
289
+ continue;
290
+ }
291
+ paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));
292
+ }
293
+ }
294
+ return paths;
295
+ }
296
+ function _renderLegends() {
297
+ if (props.hideLegend) {
298
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null);
299
+ }
300
+ let legends;
301
+ if (isStacked) {
302
+ // Collect unique categories and their color
303
+ const categoryMap = {};
304
+ props.data.forEach((stage)=>{
305
+ (stage.subValues || []).forEach((sub)=>{
306
+ if (!(sub.category in categoryMap)) {
307
+ categoryMap[sub.category] = sub.color;
308
+ }
309
+ });
310
+ });
311
+ legends = Object.entries(categoryMap).map(([category, color])=>({
312
+ title: category,
313
+ color,
314
+ hoverAction: ()=>setHoveredStage(category),
315
+ onMouseOutAction: ()=>setHoveredStage(null)
316
+ }));
317
+ } else {
318
+ legends = props.data.map((d)=>({
319
+ title: d.stage,
320
+ color: d.color,
321
+ hoverAction: ()=>setHoveredStage(d.stage),
322
+ onMouseOutAction: ()=>setHoveredStage(null)
323
+ }));
324
+ }
325
+ return /*#__PURE__*/ _react.createElement("div", {
326
+ style: {
327
+ display: 'flex',
328
+ justifyContent: 'center'
329
+ }
330
+ }, /*#__PURE__*/ _react.createElement(_index1.Legends, {
331
+ legends: legends,
332
+ centerLegends: true,
333
+ onChange: _onLegendSelectionChangeCallback,
334
+ ...props.legendProps
335
+ }));
336
+ }
337
+ function _isChartEmpty() {
338
+ return !(props.data && props.data.length > 0);
339
+ }
340
+ function updatePosition(newX, newY) {
341
+ const threshold = 1; // Set a threshold for movement
342
+ const { x, y } = clickPosition;
343
+ // Calculate the distance moved
344
+ const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
345
+ // Update the position only if the distance moved is greater than the threshold
346
+ if (distance > threshold) {
347
+ setClickPosition({
348
+ x: newX,
349
+ y: newY
350
+ });
351
+ setPopoverOpen(true);
352
+ }
353
+ }
354
+ const classes = (0, _useFunnelChartStylesstyles.useFunnelChartStyles)(props);
355
+ const calloutProps = {
356
+ ...props.calloutProps,
357
+ color: calloutData === null || calloutData === void 0 ? void 0 : calloutData.color,
358
+ hoverXValue: calloutData === null || calloutData === void 0 ? void 0 : calloutData.stage,
359
+ YValue: calloutData === null || calloutData === void 0 ? void 0 : calloutData.value
360
+ };
361
+ const width = props.width || 350;
362
+ const height = props.height || 500;
363
+ const funnelMarginTop = 40;
364
+ const funnelWidth = width * 0.8;
365
+ const funnelOffsetX = (width - funnelWidth) / 2;
366
+ const focusAttributes = (0, _reacttabster.useFocusableGroup)();
367
+ var _props_culture;
368
+ return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement("div", {
369
+ ref: chartContainerRef,
370
+ className: classes.root,
371
+ ...focusAttributes
372
+ }, /*#__PURE__*/ _react.createElement("svg", {
373
+ width: width,
374
+ height: height,
375
+ className: classes.chart,
376
+ role: 'img',
377
+ "aria-label": props.chartTitle
378
+ }, /*#__PURE__*/ _react.createElement("g", {
379
+ transform: isRTL ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)` : `translate(${funnelOffsetX}, ${funnelMarginTop})`
380
+ }, isStacked ? _createStackedFunnel(height - funnelMarginTop, funnelWidth) : _createFunnel(height - funnelMarginTop, funnelWidth))), isPopoverOpen && /*#__PURE__*/ _react.createElement(_ChartPopover.ChartPopover, {
381
+ ...props.calloutProps,
382
+ XValue: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.hoverXValue,
383
+ yCalloutValue: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.YValue,
384
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
385
+ clickPosition: clickPosition,
386
+ isPopoverOpen: isPopoverOpen,
387
+ color: calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.color,
388
+ isCartesian: false
389
+ }), _renderLegends()) : /*#__PURE__*/ _react.createElement("div", {
390
+ id: _emptyChartId,
391
+ role: 'alert',
392
+ style: {
393
+ opacity: '0'
394
+ },
395
+ "aria-label": 'Graph has no data to display'
396
+ });
397
+ });
398
+ FunnelChart.displayName = 'FunnelChart';
399
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
400
+ FunnelChart.defaultProps = {
401
+ orientation: 'vertical'
402
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FunnelChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends } 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 } from '../../index';\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\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\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 }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text x={isRTL ? funnelWidth - x : x} y={y} textAnchor=\"middle\" alignmentBaseline=\"middle\" fill={textColor}>\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 })}</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 JSX.Element[] {\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 JSX.Element {\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 JSX.Element[] {\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: JSX.Element[] = [];\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 JSX.Element {\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 />\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}>\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 ?? 'en-us'}\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":["FunnelChart","React","forwardRef","props","forwardedRef","_emptyChartId","useId","isRTL","useRtl","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","chartContainerRef","useRef","isStacked","isStackedFunnelData","data","useEffect","legendProps","_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","createElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","formatToLocaleString","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","getContrastTextColor","path","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","orientation","getVerticalFunnelSegmentGeometry","getHorizontalFunnelSegmentGeometry","textX","textY","availableWidth","minTextWidth","eventHandlerProps","getSegmentTextProps","Array","isArray","every","subValues","_renderStackedSegment","stageIndex","subValueIndex","geometryParams","stagesWithSubValues","stages","s","geom","getStackedVerticalFunnelSegmentGeometry","k","getStackedHorizontalFunnelSegmentGeometry","_createStackedFunnel","totals","reduce","sum","maxTotal","Math","max","paths","cur","v","push","_renderLegends","hideLegend","Fragment","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","Legends","centerLegends","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","classes","useFunnelChartStyles","calloutProps","hoverXValue","YValue","funnelMarginTop","funnelOffsetX","focusAttributes","useFocusableGroup","ref","className","root","svg","chart","role","aria-label","chartTitle","ChartPopover","XValue","yCalloutValue","isCartesian","id","displayName","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBaA;;;eAAAA;;;;iEAnBU;gCACD;uBACC;wBAES;8BACE;8BACL;gCACQ;wBACA;4CACA;gCAO9B;AAGA,MAAMA,cAAAA,WAAAA,GAAyDC,OAAMC,UAAU,CAGpF,CAACC,OAAOC;QAgBJD;IAfJ,MAAME,gBAAwBC,IAAAA,qBAAAA,EAAM;IACpC,MAAMC,QAAQC,IAAAA,aAAAA;IAEd,MAAM,CAACC,cAAcC,gBAAgB,GAAGT,OAAMU,QAAQ,CAAgB;IACtE,MAAM,CAACC,aAAaC,eAAe,GAAGZ,OAAMU,QAAQ,CAA8B;IAClF,MAAM,CAACG,iBAAiBC,mBAAmB,GAA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AAA,IAAAA,aAAcC,WAAW;QACjCgB,eAAejB,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnCrG,SAASlE,CAAAA,iBAAAA,MAAMkE,OAAO,AAAPA,MAAO,QAAblE,mBAAAA,KAAAA,IAAAA,iBAAiB;QAC1Ba,eAAeA;QACfI,eAAeA;QACf4B,OAAOwH,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcxH,KAAK;QAC1B0I,aAAa;QAGhB7C,oBAAAA,WAAAA,GAGH5I,OAAA+E,aAAA,CAACyE,OAAAA;QAAIkC,IAAItL;QAAe+K,MAAM;QAAS1B,OAAO;YAAEtF,SAAS;QAAI;QAAGiH,cAAY;;AAEhF;AACArL,YAAY4L,WAAW,GAAG;AAC1B,4DAA4D;AAC5D5L,YAAY6L,YAAY,GAAG;IACzBnF,aAAa;AACf"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FunnelChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Data point for funnel chart\n * {@docCategory FunnelChart}\n */\nexport interface FunnelChartDataPoint {\n /**\n * Stage name or identifier\n */\n stage: string | number;\n /**\n * Sub-values for stacked funnel charts\n * Each sub-value represents a category within the stage\n */\n subValues?: Array<{ category: string; value: number; color: string }>;\n /**\n * Value for the stage (used for non-stacked funnel charts)\n */\n value?: number;\n /**\n * Color for the stage (used for non-stacked funnel charts)\n */\n color?: string;\n}\n\n/**\n * Funnel Chart component props\n * {@docCategory FunnelChart}\n */\nexport interface FunnelChartProps {\n /**\n * Data points for the funnel chart\n */\n data: FunnelChartDataPoint[];\n /**\n * Title for the chart\n */\n chartTitle?: string;\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules\n */\n styles?: FunnelChartStyles;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Reference to the chart component\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentRef?: React.RefObject<any>;\n\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n\n /**\n * Orientation of the funnel chart\n * @defaultvalue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\n/**\n * Funnel Chart style properties\n * {@docCategory FunnelChart}\n */\nexport interface FunnelChartStyleProps {\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n /**\n * Width of the chart\n */\n chartWidth: number;\n /**\n * Height of the chart\n */\n chartHeight: number;\n}\n\n/**\n * Funnel Chart styles\n * {@docCategory FunnelChart}\n */\nexport interface FunnelChartStyles {\n /**\n * Styles for the root element\n */\n root?: string;\n\n /**\n * Styles for the chart\n */\n chart?: string;\n\n /**\n * Styles for text elements\n */\n text?: string;\n\n /**\n * Styles for the callout root element\n */\n calloutContentRoot?: string;\n}\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}