@fluentui/react-charting 5.24.39 → 5.25.0

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 (111) hide show
  1. package/CHANGELOG.json +60 -1
  2. package/CHANGELOG.md +21 -2
  3. package/dist/react-charting.d.ts +127 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +74 -0
  7. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  8. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
  9. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  10. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  11. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
  12. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  16. package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
  17. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  18. package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
  19. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  20. package/lib/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/index.d.ts +2 -0
  23. package/lib/components/CommonComponents/index.js +2 -0
  24. package/lib/components/CommonComponents/index.js.map +1 -1
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  27. package/lib/index.d.ts +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/types/IChartAnnotation.d.ts +99 -0
  30. package/lib/types/IChartAnnotation.js +2 -0
  31. package/lib/types/IChartAnnotation.js.map +1 -0
  32. package/lib/types/IDataPoint.d.ts +4 -0
  33. package/lib/types/IDataPoint.js.map +1 -1
  34. package/lib/types/index.d.ts +1 -0
  35. package/lib/types/index.js +1 -0
  36. package/lib/types/index.js.map +1 -1
  37. package/lib/utilities/image-export-utils.js +55 -0
  38. package/lib/utilities/image-export-utils.js.map +1 -1
  39. package/lib/utilities/utilities.js +72 -20
  40. package/lib/utilities/utilities.js.map +1 -1
  41. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  42. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
  43. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  44. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  45. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
  46. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  47. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  48. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
  49. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  52. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
  53. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  54. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  56. package/lib-amd/components/CommonComponents/index.d.ts +2 -0
  57. package/lib-amd/components/CommonComponents/index.js +3 -1
  58. package/lib-amd/components/CommonComponents/index.js.map +1 -1
  59. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  60. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  61. package/lib-amd/index.d.ts +1 -1
  62. package/lib-amd/index.js.map +1 -1
  63. package/lib-amd/types/IChartAnnotation.d.ts +99 -0
  64. package/lib-amd/types/IChartAnnotation.js +5 -0
  65. package/lib-amd/types/IChartAnnotation.js.map +1 -0
  66. package/lib-amd/types/IDataPoint.d.ts +4 -0
  67. package/lib-amd/types/IDataPoint.js.map +1 -1
  68. package/lib-amd/types/index.d.ts +1 -0
  69. package/lib-amd/types/index.js +2 -1
  70. package/lib-amd/types/index.js.map +1 -1
  71. package/lib-amd/utilities/image-export-utils.js +55 -0
  72. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  73. package/lib-amd/utilities/utilities.js +72 -20
  74. package/lib-amd/utilities/utilities.js.map +1 -1
  75. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  76. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
  77. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  78. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  79. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
  80. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  81. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  82. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
  83. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  84. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
  85. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
  87. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  89. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
  91. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  92. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  93. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  94. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  95. package/lib-commonjs/index.d.ts +1 -1
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
  98. package/lib-commonjs/types/IChartAnnotation.js +3 -0
  99. package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
  100. package/lib-commonjs/types/IDataPoint.d.ts +4 -0
  101. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  102. package/lib-commonjs/types/index.d.ts +1 -0
  103. package/lib-commonjs/types/index.js +1 -0
  104. package/lib-commonjs/types/index.js.map +1 -1
  105. package/lib-commonjs/utilities/image-export-utils.js +55 -0
  106. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  107. package/lib-commonjs/utilities/utilities.js +72 -20
  108. package/lib-commonjs/utilities/utilities.js.map +1 -1
  109. package/package.json +9 -9
  110. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
  111. package/src/components/CommonComponents/CartesianChart.types.ts +21 -0
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { IChartAnnotationLayerProps } from './ChartAnnotationLayer.types';
3
+ export declare const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps>;
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChartAnnotationLayer = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var React = require("react");
6
+ var Utilities_1 = require("@fluentui/react/lib/Utilities");
7
+ var ChartAnnotationLayer_styles_1 = require("./ChartAnnotationLayer.styles");
8
+ var getClassNames = (0, Utilities_1.classNamesFunction)();
9
+ var DEFAULT_HORIZONTAL_ALIGN = 'center';
10
+ var DEFAULT_VERTICAL_ALIGN = 'middle';
11
+ var DEFAULT_FOREIGN_OBJECT_WIDTH = 180;
12
+ var DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;
13
+ var MIN_ARROW_SIZE = 6;
14
+ var MAX_ARROW_SIZE = 24;
15
+ var ARROW_SIZE_SCALE = 0.35;
16
+ var getAnnotationKey = function (annotation, index) {
17
+ var _a, _b;
18
+ return (_b = (_a = annotation.id) !== null && _a !== void 0 ? _a : (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined)) !== null && _b !== void 0 ? _b : "annotation-".concat(index);
19
+ };
20
+ var decodeHtmlEntities = function (html, documentRef) {
21
+ var _a, _b;
22
+ if (!html || html.indexOf('&') === -1) {
23
+ return html;
24
+ }
25
+ if (!((_a = documentRef === null || documentRef === void 0 ? void 0 : documentRef.implementation) === null || _a === void 0 ? void 0 : _a.createHTMLDocument)) {
26
+ return html;
27
+ }
28
+ var workingDocument = documentRef.implementation.createHTMLDocument('');
29
+ workingDocument.body.innerHTML = html;
30
+ return (_b = workingDocument.body.textContent) !== null && _b !== void 0 ? _b : '';
31
+ };
32
+ var sanitizeAnnotationHtml = function (html) {
33
+ var _a, _b;
34
+ if (!html) {
35
+ return '';
36
+ }
37
+ if (typeof window === 'undefined' || !((_b = (_a = window.document) === null || _a === void 0 ? void 0 : _a.implementation) === null || _b === void 0 ? void 0 : _b.createHTMLDocument)) {
38
+ return html;
39
+ }
40
+ var workingDocument = window.document.implementation.createHTMLDocument('');
41
+ workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);
42
+ workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(function (node) { return node.remove(); });
43
+ workingDocument.body.querySelectorAll('*').forEach(function (node) {
44
+ Array.from(node.attributes).forEach(function (attr) {
45
+ if (/^on/i.test(attr.name)) {
46
+ node.removeAttribute(attr.name);
47
+ }
48
+ });
49
+ });
50
+ return workingDocument.body.innerHTML;
51
+ };
52
+ var normalizeBandOffset = function (scale, value) {
53
+ var position = scale === null || scale === void 0 ? void 0 : scale(value);
54
+ if (typeof position !== 'number' || Number.isNaN(position)) {
55
+ return undefined;
56
+ }
57
+ if (scale && typeof scale.bandwidth === 'function') {
58
+ return position + scale.bandwidth() / 2;
59
+ }
60
+ return position;
61
+ };
62
+ var clamp = function (value, min, max) { return Math.max(min, Math.min(max, value)); };
63
+ var createMeasurementSignature = function (annotationHtml, containerStyle, contentStyle, layoutClassName, styleClassName) {
64
+ return JSON.stringify({
65
+ annotationHtml: annotationHtml,
66
+ containerStyle: containerStyle,
67
+ contentStyle: contentStyle,
68
+ layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
69
+ styleClassName: styleClassName !== null && styleClassName !== void 0 ? styleClassName : '',
70
+ });
71
+ };
72
+ var resolveCoordinates = function (annotation, context) {
73
+ var _a, _b;
74
+ var coordinates = annotation.coordinates, layout = annotation.layout;
75
+ if (!coordinates) {
76
+ return undefined;
77
+ }
78
+ var offsetX = (_a = layout === null || layout === void 0 ? void 0 : layout.offsetX) !== null && _a !== void 0 ? _a : 0;
79
+ var offsetY = (_b = layout === null || layout === void 0 ? void 0 : layout.offsetY) !== null && _b !== void 0 ? _b : 0;
80
+ var anchor = { x: 0, y: 0 };
81
+ switch (coordinates.type) {
82
+ case 'data': {
83
+ var x = coordinates.x, y = coordinates.y, _c = coordinates.yAxis, yAxis = _c === void 0 ? 'primary' : _c;
84
+ var xScale = context.xScale;
85
+ var yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
86
+ if (!xScale || !yScale) {
87
+ return undefined;
88
+ }
89
+ var xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);
90
+ var yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);
91
+ if (typeof xValue !== 'number' || typeof yValue !== 'number') {
92
+ return undefined;
93
+ }
94
+ anchor.x = xValue;
95
+ anchor.y = yValue;
96
+ break;
97
+ }
98
+ case 'relative': {
99
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
100
+ return undefined;
101
+ }
102
+ anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;
103
+ anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;
104
+ break;
105
+ }
106
+ case 'pixel': {
107
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
108
+ return undefined;
109
+ }
110
+ anchor.x = context.plotRect.x + coordinates.x;
111
+ anchor.y = context.plotRect.y + coordinates.y;
112
+ break;
113
+ }
114
+ default:
115
+ return undefined;
116
+ }
117
+ var left = anchor.x + offsetX;
118
+ var top = anchor.y + offsetY;
119
+ if (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) {
120
+ left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);
121
+ top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);
122
+ }
123
+ return {
124
+ anchor: anchor,
125
+ point: { x: left, y: top },
126
+ };
127
+ };
128
+ exports.ChartAnnotationLayer = React.memo(function (props) {
129
+ var annotationsProp = props.annotations, theme = props.theme, context = props.context, className = props.className;
130
+ var classNames = getClassNames(ChartAnnotationLayer_styles_1.getStyles, { theme: theme, className: className });
131
+ var idPrefix = React.useMemo(function () { return (0, Utilities_1.getId)('chart-annotation'); }, []);
132
+ var _a = React.useState({}), measurements = _a[0], setMeasurements = _a[1];
133
+ var resolvedAnnotations = React.useMemo(function () {
134
+ return (annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map(function (annotation, index) { return ({ annotation: annotation, key: getAnnotationKey(annotation, index) }); });
135
+ }, [annotationsProp]);
136
+ React.useEffect(function () {
137
+ setMeasurements(function (prev) {
138
+ if (resolvedAnnotations.length === 0) {
139
+ if (Object.keys(prev).length === 0) {
140
+ return prev;
141
+ }
142
+ return {};
143
+ }
144
+ var next = {};
145
+ resolvedAnnotations.forEach(function (_a) {
146
+ var key = _a.key;
147
+ if (prev[key]) {
148
+ next[key] = prev[key];
149
+ }
150
+ });
151
+ if (Object.keys(next).length === Object.keys(prev).length) {
152
+ var identical = true;
153
+ for (var _i = 0, _a = Object.keys(next); _i < _a.length; _i++) {
154
+ var key = _a[_i];
155
+ if (next[key] !== prev[key]) {
156
+ identical = false;
157
+ break;
158
+ }
159
+ }
160
+ if (identical) {
161
+ return prev;
162
+ }
163
+ }
164
+ return next;
165
+ });
166
+ }, [resolvedAnnotations]);
167
+ var updateMeasurement = React.useCallback(function (key, width, height, signature) {
168
+ setMeasurements(function (prev) {
169
+ var _a;
170
+ var prevEntry = prev[key];
171
+ if (prevEntry &&
172
+ prevEntry.signature === signature &&
173
+ Math.abs(prevEntry.width - width) < 0.5 &&
174
+ Math.abs(prevEntry.height - height) < 0.5) {
175
+ return prev;
176
+ }
177
+ if (width === 0 && height === 0) {
178
+ return prev;
179
+ }
180
+ return tslib_1.__assign(tslib_1.__assign({}, prev), (_a = {}, _a[key] = { width: width, height: height, signature: signature }, _a));
181
+ });
182
+ }, []);
183
+ var annotationForeignObjects = [];
184
+ var measurementElements = [];
185
+ var connectors = [];
186
+ resolvedAnnotations.forEach(function (_a) {
187
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
188
+ var annotation = _a.annotation, key = _a.key;
189
+ var resolved = resolveCoordinates(annotation, context);
190
+ if (!resolved) {
191
+ return;
192
+ }
193
+ var annotationHtml = sanitizeAnnotationHtml((_b = annotation.text) !== null && _b !== void 0 ? _b : '');
194
+ var layout = annotation.layout;
195
+ var horizontalAlign = (_c = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _c !== void 0 ? _c : DEFAULT_HORIZONTAL_ALIGN;
196
+ var verticalAlign = (_d = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _d !== void 0 ? _d : DEFAULT_VERTICAL_ALIGN;
197
+ var backgroundOpacity = (_f = (_e = annotation.style) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : ChartAnnotationLayer_styles_1.DEFAULT_ANNOTATION_BACKGROUND_OPACITY;
198
+ var baseBackgroundColor = (_h = (_g = annotation.style) === null || _g === void 0 ? void 0 : _g.backgroundColor) !== null && _h !== void 0 ? _h : theme.semanticColors.bodyBackground;
199
+ var hasCustomBackground = ((_j = annotation.style) === null || _j === void 0 ? void 0 : _j.backgroundColor) !== undefined || ((_k = annotation.style) === null || _k === void 0 ? void 0 : _k.opacity) !== undefined;
200
+ var containerStyle = tslib_1.__assign(tslib_1.__assign({ maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth }, (hasCustomBackground && {
201
+ backgroundColor: (0, ChartAnnotationLayer_styles_1.applyOpacityToColor)(baseBackgroundColor, backgroundOpacity),
202
+ })), { borderColor: (_l = annotation.style) === null || _l === void 0 ? void 0 : _l.borderColor, borderWidth: (_m = annotation.style) === null || _m === void 0 ? void 0 : _m.borderWidth, borderStyle: (_p = (_o = annotation.style) === null || _o === void 0 ? void 0 : _o.borderStyle) !== null && _p !== void 0 ? _p : (((_q = annotation.style) === null || _q === void 0 ? void 0 : _q.borderColor) ? 'solid' : undefined), borderRadius: (_r = annotation.style) === null || _r === void 0 ? void 0 : _r.borderRadius, padding: (_s = annotation.style) === null || _s === void 0 ? void 0 : _s.padding, boxShadow: (_t = annotation.style) === null || _t === void 0 ? void 0 : _t.boxShadow });
203
+ var contentStyle = {
204
+ color: (_u = annotation.style) === null || _u === void 0 ? void 0 : _u.textColor,
205
+ fontSize: (_v = annotation.style) === null || _v === void 0 ? void 0 : _v.fontSize,
206
+ fontWeight: (_w = annotation.style) === null || _w === void 0 ? void 0 : _w.fontWeight,
207
+ opacity: 1,
208
+ };
209
+ var measurementSignature = createMeasurementSignature(annotationHtml, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_x = annotation.style) === null || _x === void 0 ? void 0 : _x.className);
210
+ var measurementEntry = measurements[key];
211
+ var isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
212
+ var measuredSize = isMeasurementValid ? measurementEntry : undefined;
213
+ var width = Math.max((_z = (_y = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) !== null && _y !== void 0 ? _y : layout === null || layout === void 0 ? void 0 : layout.maxWidth) !== null && _z !== void 0 ? _z : DEFAULT_FOREIGN_OBJECT_WIDTH, 1);
214
+ var height = Math.max((_0 = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _0 !== void 0 ? _0 : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
215
+ var offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;
216
+ var offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;
217
+ var baseTopLeftX = resolved.point.x + offsetX;
218
+ var baseTopLeftY = resolved.point.y + offsetY;
219
+ var usePlotBounds = (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) !== false;
220
+ var viewportX = usePlotBounds ? context.plotRect.x : 0;
221
+ var viewportY = usePlotBounds ? context.plotRect.y : 0;
222
+ var viewportWidth = usePlotBounds ? context.plotRect.width : (_1 = context.svgRect.width) !== null && _1 !== void 0 ? _1 : 0;
223
+ var viewportHeight = usePlotBounds ? context.plotRect.height : (_2 = context.svgRect.height) !== null && _2 !== void 0 ? _2 : 0;
224
+ var maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;
225
+ var maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;
226
+ var topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;
227
+ var topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;
228
+ var displayPoint = {
229
+ x: topLeftX - offsetX,
230
+ y: topLeftY - offsetY,
231
+ };
232
+ if (annotation.connector) {
233
+ var startPadding = (_3 = annotation.connector.startPadding) !== null && _3 !== void 0 ? _3 : 12;
234
+ var endPadding = (_4 = annotation.connector.endPadding) !== null && _4 !== void 0 ? _4 : 0;
235
+ var minArrowClearance = 6;
236
+ var minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);
237
+ var dx = displayPoint.x - resolved.anchor.x;
238
+ var dy = displayPoint.y - resolved.anchor.y;
239
+ var distance = Math.sqrt(dx * dx + dy * dy);
240
+ if (distance < minDistance) {
241
+ var fallbackDirection = { x: 0, y: -1 };
242
+ var ux = distance === 0 ? fallbackDirection.x : dx / distance;
243
+ var uy = distance === 0 ? fallbackDirection.y : dy / distance;
244
+ var desiredDisplayX = resolved.anchor.x + ux * minDistance;
245
+ var desiredDisplayY = resolved.anchor.y + uy * minDistance;
246
+ var desiredTopLeftX = desiredDisplayX + offsetX;
247
+ var desiredTopLeftY = desiredDisplayY + offsetY;
248
+ desiredTopLeftX =
249
+ viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;
250
+ desiredTopLeftY =
251
+ viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;
252
+ topLeftX = desiredTopLeftX;
253
+ topLeftY = desiredTopLeftY;
254
+ displayPoint = {
255
+ x: topLeftX - offsetX,
256
+ y: topLeftY - offsetY,
257
+ };
258
+ }
259
+ }
260
+ var measurementStyle = tslib_1.__assign({ left: topLeftX, top: topLeftY, pointerEvents: 'none' }, containerStyle);
261
+ if (!isMeasurementValid) {
262
+ measurementElements.push(React.createElement("div", { key: "".concat(key, "-measurement"), ref: function (node) {
263
+ if (node) {
264
+ var rect = node.getBoundingClientRect();
265
+ if (rect.width !== 0 || rect.height !== 0) {
266
+ updateMeasurement(key, rect.width, rect.height, measurementSignature);
267
+ }
268
+ }
269
+ }, className: (0, Utilities_1.css)(classNames.annotation, classNames.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_5 = annotation.style) === null || _5 === void 0 ? void 0 : _5.className), style: measurementStyle, "aria-hidden": true, "data-annotation-key": key, "data-chart-annotation-measurement": "true" },
270
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_6 = annotation.style) === null || _6 === void 0 ? void 0 : _6.className), style: contentStyle, dangerouslySetInnerHTML: { __html: annotationHtml } })));
271
+ }
272
+ annotationForeignObjects.push(React.createElement("foreignObject", { key: "".concat(key, "-annotation"), x: topLeftX, y: topLeftY, width: width, height: height, className: (0, Utilities_1.css)(classNames.annotationForeignObject), "data-annotation-key": key },
273
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_7 = annotation.style) === null || _7 === void 0 ? void 0 : _7.className), style: containerStyle, "data-annotation-key": key },
274
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, (_8 = annotation.style) === null || _8 === void 0 ? void 0 : _8.className), style: contentStyle, role: (_10 = (_9 = annotation.accessibility) === null || _9 === void 0 ? void 0 : _9.role) !== null && _10 !== void 0 ? _10 : 'note', "aria-label": (_11 = annotation.accessibility) === null || _11 === void 0 ? void 0 : _11.ariaLabel, "aria-describedby": (_12 = annotation.accessibility) === null || _12 === void 0 ? void 0 : _12.ariaDescribedBy, "data-chart-annotation": "true", "data-annotation-key": key, dangerouslySetInnerHTML: { __html: annotationHtml } }))));
275
+ if (annotation.connector) {
276
+ var _13 = annotation.connector, _14 = _13.startPadding, startPadding = _14 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_START_PADDING : _14, _15 = _13.endPadding, endPadding = _15 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_END_PADDING : _15, _16 = _13.strokeColor, strokeColor = _16 === void 0 ? (0, ChartAnnotationLayer_styles_1.getDefaultConnectorStrokeColor)(theme) : _16, _17 = _13.strokeWidth, strokeWidth = _17 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_STROKE_WIDTH : _17, dashArray = _13.dashArray, _18 = _13.arrow, arrow = _18 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_ARROW : _18;
277
+ var dx = resolved.anchor.x - displayPoint.x;
278
+ var dy = resolved.anchor.y - displayPoint.y;
279
+ var distance = Math.sqrt(dx * dx + dy * dy) || 1;
280
+ var ux = dx / distance;
281
+ var uy = dy / distance;
282
+ var sizeBasis = Math.max(1, Math.min(width, height));
283
+ var proportionalSize = sizeBasis * ARROW_SIZE_SCALE;
284
+ var maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;
285
+ var maxByDistance = distance * 0.6;
286
+ var markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));
287
+ var markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);
288
+ var start = {
289
+ x: displayPoint.x + ux * startPadding,
290
+ y: displayPoint.y + uy * startPadding,
291
+ };
292
+ var end = {
293
+ x: resolved.anchor.x - ux * endPadding,
294
+ y: resolved.anchor.y - uy * endPadding,
295
+ };
296
+ connectors.push({
297
+ key: "".concat(key, "-connector"),
298
+ start: start,
299
+ end: end,
300
+ strokeColor: strokeColor,
301
+ strokeWidth: strokeWidth,
302
+ dashArray: dashArray,
303
+ arrow: arrow,
304
+ markerSize: markerSize,
305
+ markerStrokeWidth: markerStrokeWidth,
306
+ });
307
+ }
308
+ });
309
+ if (annotationForeignObjects.length === 0 && connectors.length === 0) {
310
+ return null;
311
+ }
312
+ var viewBoxWidth = context.svgRect.width || 1;
313
+ var viewBoxHeight = context.svgRect.height || 1;
314
+ var markerDefs = [];
315
+ var createMarkerId = function (color, position, size, markerStrokeWidth) {
316
+ var id = "".concat(idPrefix, "-").concat(position, "-").concat(markerDefs.length);
317
+ var refY = size / 2;
318
+ var refX = position === 'end' ? size : 0;
319
+ var pathEnd = "M0 0 L ".concat(size, " ").concat(refY, " L0 ").concat(size, " Z");
320
+ var pathStart = "M ".concat(size, " 0 L0 ").concat(refY, " L ").concat(size, " ").concat(size, " Z");
321
+ var path = position === 'end' ? pathEnd : pathStart;
322
+ markerDefs.push(React.createElement("marker", { key: id, id: id, markerWidth: size, markerHeight: size, viewBox: "0 0 ".concat(size, " ").concat(size), refX: refX, refY: refY, orient: "auto", markerUnits: "userSpaceOnUse" },
323
+ React.createElement("path", { d: path, fill: color, stroke: color, strokeWidth: markerStrokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
324
+ return id;
325
+ };
326
+ var connectorElements = connectors.map(function (connector) {
327
+ var markerStart;
328
+ var markerEnd;
329
+ if (connector.arrow === 'start' || connector.arrow === 'both') {
330
+ markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);
331
+ }
332
+ if (connector.arrow === 'end' || connector.arrow === 'both') {
333
+ markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);
334
+ }
335
+ return (React.createElement("line", { key: connector.key, x1: connector.start.x, y1: connector.start.y, x2: connector.end.x, y2: connector.end.y, stroke: connector.strokeColor, strokeWidth: connector.strokeWidth, strokeDasharray: connector.dashArray, strokeLinecap: "round", markerStart: markerStart ? "url(#".concat(markerStart, ")") : undefined, markerEnd: markerEnd ? "url(#".concat(markerEnd, ")") : undefined }));
336
+ });
337
+ var shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;
338
+ return (React.createElement("div", { className: classNames.root, role: "presentation", "data-chart-annotation-layer": "true" },
339
+ shouldRenderSvg && (React.createElement("svg", { className: classNames.connectorLayer, width: "100%", height: "100%", viewBox: "0 0 ".concat(viewBoxWidth, " ").concat(viewBoxHeight), preserveAspectRatio: "none", "data-chart-annotation-svg": "true" },
340
+ markerDefs.length > 0 && React.createElement("defs", null, markerDefs),
341
+ connectorElements.length > 0 && (React.createElement("g", { "aria-hidden": "true", className: classNames.connectorGroup }, connectorElements)),
342
+ annotationForeignObjects)),
343
+ measurementElements));
344
+ });
345
+ exports.ChartAnnotationLayer.displayName = 'ChartAnnotationLayer';
346
+ //# sourceMappingURL=ChartAnnotationLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartAnnotationLayer.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,2DAA+E;AAS/E,6EAWuC;AAEvC,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAgE,CAAC;AAEzG,IAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,IAAM,sBAAsB,GAAG,QAAQ,CAAC;AACxC,IAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,IAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,IAAM,cAAc,GAAG,CAAC,CAAC;AACzB,IAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,IAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,IAAM,gBAAgB,GAAG,UAAC,UAA4B,EAAE,KAAa;;IACnE,OAAA,MAAA,MAAA,UAAU,CAAC,EAAE,mCACb,CAAC,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,mCAClH,qBAAc,KAAK,CAAE,CAAA;CAAA,CAAC;AAExB,IAAM,kBAAkB,GAAG,UAAC,I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,SAAS,MAAG,CAAC,CAAC,CAAC,SAAS,GACvD,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAM,eAAe,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;IACrF,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAC,cAAc,iCAA6B,MAAM;QACpF,eAAe,IAAI,CAClB,6BACE,SAAS,EAAE,UAAU,CAAC,cAAc,EACpC,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,OAAO,EAAE,cAAO,YAAY,cAAI,aAAa,CAAE,EAC/C,mBAAmB,EAAC,MAAM,+BACA,MAAM;YAE/B,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,kCAAO,UAAU,CAAQ;YAClD,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,0CAAe,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,cAAc,IACvD,iBAAiB,CAChB,CACL;YACA,wBAAwB,CACrB,CACP;QACA,mBAAmB,CAChB,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,4BAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, css, getId } from '@fluentui/react/lib/Utilities';\nimport { IChartAnnotation } from '../../../types/IChartAnnotation';\nimport {\n IAnnotationPoint,\n IChartAnnotationContext,\n IChartAnnotationLayerProps,\n ConnectorRenderData,\n IResolvedAnnotationPosition,\n} from './ChartAnnotationLayer.types';\nimport {\n applyOpacityToColor,\n DEFAULT_ANNOTATION_BACKGROUND_OPACITY,\n DEFAULT_CONNECTOR_ARROW,\n DEFAULT_CONNECTOR_END_PADDING,\n DEFAULT_CONNECTOR_START_PADDING,\n DEFAULT_CONNECTOR_STROKE_WIDTH,\n getDefaultConnectorStrokeColor,\n getStyles,\n IChartAnnotationLayerStyleProps,\n IChartAnnotationLayerStyles,\n} from './ChartAnnotationLayer.styles';\n\nconst getClassNames = classNamesFunction<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>();\n\nconst DEFAULT_HORIZONTAL_ALIGN = 'center';\nconst DEFAULT_VERTICAL_ALIGN = 'middle';\nconst DEFAULT_FOREIGN_OBJECT_WIDTH = 180;\nconst DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;\nconst MIN_ARROW_SIZE = 6;\nconst MAX_ARROW_SIZE = 24;\nconst ARROW_SIZE_SCALE = 0.35;\nconst getAnnotationKey = (annotation: IChartAnnotation, index: number) =>\n annotation.id ??\n (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) ??\n `annotation-${index}`;\n\nconst decodeHtmlEntities = (html: string, documentRef: Document): string => {\n if (!html || html.indexOf('&') === -1) {\n return html;\n }\n\n if (!documentRef?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = documentRef.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = html;\n return workingDocument.body.textContent ?? '';\n};\n\nconst sanitizeAnnotationHtml = (html: string): string => {\n if (!html) {\n return '';\n }\n\n if (typeof window === 'undefined' || !window.document?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = window.document.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);\n\n workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(node => node.remove());\n\n workingDocument.body.querySelectorAll('*').forEach(node => {\n Array.from(node.attributes).forEach(attr => {\n if (/^on/i.test(attr.name)) {\n node.removeAttribute(attr.name);\n }\n });\n });\n\n return workingDocument.body.innerHTML;\n};\n\nconst normalizeBandOffset = (\n scale: (((value: unknown) => number) & { bandwidth?: () => number }) | undefined,\n value: unknown,\n) => {\n const position = scale?.(value as never);\n if (typeof position !== 'number' || Number.isNaN(position)) {\n return undefined;\n }\n if (scale && typeof scale.bandwidth === 'function') {\n return position + scale.bandwidth() / 2;\n }\n return position;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));\n\nconst createMeasurementSignature = (\n annotationHtml: string,\n containerStyle: React.CSSProperties,\n contentStyle: React.CSSProperties,\n layoutClassName?: string,\n styleClassName?: string,\n) =>\n JSON.stringify({\n annotationHtml,\n containerStyle,\n contentStyle,\n layoutClassName: layoutClassName ?? '',\n styleClassName: styleClassName ?? '',\n });\n\ntype MeasurementEntry = { width: number; height: number; signature: string };\n\nconst resolveCoordinates = (\n annotation: IChartAnnotation,\n context: IChartAnnotationContext,\n): IResolvedAnnotationPosition | undefined => {\n const { coordinates, layout } = annotation;\n\n if (!coordinates) {\n return undefined;\n }\n\n const offsetX = layout?.offsetX ?? 0;\n const offsetY = layout?.offsetY ?? 0;\n\n const anchor: IAnnotationPoint = { x: 0, y: 0 };\n\n switch (coordinates.type) {\n case 'data': {\n const { x, y, yAxis = 'primary' } = coordinates;\n const xScale = context.xScale;\n const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;\n if (!xScale || !yScale) {\n return undefined;\n }\n const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);\n const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);\n if (typeof xValue !== 'number' || typeof yValue !== 'number') {\n return undefined;\n }\n anchor.x = xValue;\n anchor.y = yValue;\n break;\n }\n case 'relative': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;\n anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;\n break;\n }\n case 'pixel': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + coordinates.x;\n anchor.y = context.plotRect.y + coordinates.y;\n break;\n }\n default:\n return undefined;\n }\n\n let left = anchor.x + offsetX;\n let top = anchor.y + offsetY;\n\n if (layout?.clipToBounds) {\n left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);\n top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);\n }\n\n return {\n anchor,\n point: { x: left, y: top },\n };\n};\n\nexport const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps> = React.memo(props => {\n const { annotations: annotationsProp, theme, context, className } = props;\n\n const classNames = getClassNames(getStyles, { theme, className });\n const idPrefix = React.useMemo(() => getId('chart-annotation'), []);\n\n const [measurements, setMeasurements] = React.useState<Record<string, MeasurementEntry>>({});\n\n const resolvedAnnotations = React.useMemo(\n () =>\n (annotationsProp ?? []).map((annotation, index) => ({ annotation, key: getAnnotationKey(annotation, index) })),\n [annotationsProp],\n );\n\n React.useEffect(() => {\n setMeasurements(prev => {\n if (resolvedAnnotations.length === 0) {\n if (Object.keys(prev).length === 0) {\n return prev;\n }\n return {} as Record<string, MeasurementEntry>;\n }\n\n const next: Record<string, MeasurementEntry> = {};\n resolvedAnnotations.forEach(({ key }) => {\n if (prev[key]) {\n next[key] = prev[key];\n }\n });\n\n if (Object.keys(next).length === Object.keys(prev).length) {\n let identical = true;\n for (const key of Object.keys(next)) {\n if (next[key] !== prev[key]) {\n identical = false;\n break;\n }\n }\n if (identical) {\n return prev;\n }\n }\n\n return next;\n });\n }, [resolvedAnnotations]);\n\n const updateMeasurement = React.useCallback((key: string, width: number, height: number, signature: string) => {\n setMeasurements(prev => {\n const prevEntry = prev[key];\n if (\n prevEntry &&\n prevEntry.signature === signature &&\n Math.abs(prevEntry.width - width) < 0.5 &&\n Math.abs(prevEntry.height - height) < 0.5\n ) {\n return prev;\n }\n\n if (width === 0 && height === 0) {\n return prev;\n }\n\n return {\n ...prev,\n [key]: { width, height, signature },\n };\n });\n }, []);\n\n const annotationForeignObjects: React.ReactNode[] = [];\n const measurementElements: React.ReactNode[] = [];\n const connectors: ConnectorRenderData[] = [];\n\n resolvedAnnotations.forEach(({ annotation, key }) => {\n const resolved = resolveCoordinates(annotation, context);\n if (!resolved) {\n return;\n }\n\n const annotationHtml = sanitizeAnnotationHtml(annotation.text ?? '');\n\n const layout = annotation.layout;\n const horizontalAlign = layout?.align ?? DEFAULT_HORIZONTAL_ALIGN;\n const verticalAlign = layout?.verticalAlign ?? DEFAULT_VERTICAL_ALIGN;\n const backgroundOpacity = annotation.style?.opacity ?? DEFAULT_ANNOTATION_BACKGROUND_OPACITY;\n const baseBackgroundColor = annotation.style?.backgroundColor ?? theme.semanticColors.bodyBackground;\n const hasCustomBackground =\n annotation.style?.backgroundColor !== undefined || annotation.style?.opacity !== undefined;\n\n const containerStyle: React.CSSProperties = {\n maxWidth: layout?.maxWidth,\n ...(hasCustomBackground && {\n backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity),\n }),\n borderColor: annotation.style?.borderColor,\n borderWidth: annotation.style?.borderWidth,\n borderStyle: annotation.style?.borderStyle ?? (annotation.style?.borderColor ? 'solid' : undefined),\n borderRadius: annotation.style?.borderRadius,\n padding: annotation.style?.padding,\n boxShadow: annotation.style?.boxShadow,\n };\n\n const contentStyle: React.CSSProperties = {\n color: annotation.style?.textColor,\n fontSize: annotation.style?.fontSize,\n fontWeight: annotation.style?.fontWeight,\n opacity: 1,\n };\n\n const measurementSignature = createMeasurementSignature(\n annotationHtml,\n containerStyle,\n contentStyle,\n layout?.className,\n annotation.style?.className,\n );\n const measurementEntry = measurements[key];\n const isMeasurementValid = measurementEntry?.signature === measurementSignature;\n const measuredSize = isMeasurementValid ? measurementEntry : undefined;\n const width = Math.max(measuredSize?.width ?? layout?.maxWidth ?? DEFAULT_FOREIGN_OBJECT_WIDTH, 1);\n const height = Math.max(measuredSize?.height ?? DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);\n\n const offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;\n const offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;\n\n const baseTopLeftX = resolved.point.x + offsetX;\n const baseTopLeftY = resolved.point.y + offsetY;\n\n const usePlotBounds = layout?.clipToBounds !== false;\n const viewportX = usePlotBounds ? context.plotRect.x : 0;\n const viewportY = usePlotBounds ? context.plotRect.y : 0;\n const viewportWidth = usePlotBounds ? context.plotRect.width : context.svgRect.width ?? 0;\n const viewportHeight = usePlotBounds ? context.plotRect.height : context.svgRect.height ?? 0;\n\n const maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;\n const maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;\n\n let topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;\n let topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;\n\n let displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n\n if (annotation.connector) {\n const startPadding = annotation.connector.startPadding ?? 12;\n const endPadding = annotation.connector.endPadding ?? 0;\n const minArrowClearance = 6;\n const minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);\n\n const dx = displayPoint.x - resolved.anchor.x;\n const dy = displayPoint.y - resolved.anchor.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < minDistance) {\n const fallbackDirection: IAnnotationPoint = { x: 0, y: -1 };\n const ux = distance === 0 ? fallbackDirection.x : dx / distance;\n const uy = distance === 0 ? fallbackDirection.y : dy / distance;\n\n const desiredDisplayX = resolved.anchor.x + ux * minDistance;\n const desiredDisplayY = resolved.anchor.y + uy * minDistance;\n\n let desiredTopLeftX = desiredDisplayX + offsetX;\n let desiredTopLeftY = desiredDisplayY + offsetY;\n\n desiredTopLeftX =\n viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;\n desiredTopLeftY =\n viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;\n\n topLeftX = desiredTopLeftX;\n topLeftY = desiredTopLeftY;\n displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n }\n }\n\n const measurementStyle: React.CSSProperties = {\n left: topLeftX,\n top: topLeftY,\n pointerEvents: 'none',\n ...containerStyle,\n };\n\n if (!isMeasurementValid) {\n measurementElements.push(\n <div\n key={`${key}-measurement`}\n ref={node => {\n if (node) {\n const rect = node.getBoundingClientRect();\n if (rect.width !== 0 || rect.height !== 0) {\n updateMeasurement(key, rect.width, rect.height, measurementSignature);\n }\n }\n }}\n className={css(classNames.annotation, classNames.measurement, layout?.className, annotation.style?.className)}\n style={measurementStyle}\n aria-hidden={true}\n data-annotation-key={key}\n data-chart-annotation-measurement=\"true\"\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, layout?.className, annotation.style?.className)}\n style={contentStyle}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>,\n );\n }\n\n annotationForeignObjects.push(\n <foreignObject\n key={`${key}-annotation`}\n x={topLeftX}\n y={topLeftY}\n width={width}\n height={height}\n className={css(classNames.annotationForeignObject)}\n data-annotation-key={key}\n >\n <div\n className={css(classNames.annotation, layout?.className, annotation.style?.className)}\n style={containerStyle}\n data-annotation-key={key}\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, annotation.style?.className)}\n style={contentStyle}\n role={annotation.accessibility?.role ?? 'note'}\n aria-label={annotation.accessibility?.ariaLabel}\n aria-describedby={annotation.accessibility?.ariaDescribedBy}\n data-chart-annotation=\"true\"\n data-annotation-key={key}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>\n </foreignObject>,\n );\n\n if (annotation.connector) {\n const {\n startPadding = DEFAULT_CONNECTOR_START_PADDING,\n endPadding = DEFAULT_CONNECTOR_END_PADDING,\n strokeColor = getDefaultConnectorStrokeColor(theme),\n strokeWidth = DEFAULT_CONNECTOR_STROKE_WIDTH,\n dashArray,\n arrow = DEFAULT_CONNECTOR_ARROW,\n } = annotation.connector;\n\n const dx = resolved.anchor.x - displayPoint.x;\n const dy = resolved.anchor.y - displayPoint.y;\n const distance = Math.sqrt(dx * dx + dy * dy) || 1;\n const ux = dx / distance;\n const uy = dy / distance;\n\n const sizeBasis = Math.max(1, Math.min(width, height));\n const proportionalSize = sizeBasis * ARROW_SIZE_SCALE;\n const maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;\n const maxByDistance = distance * 0.6;\n const markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));\n const markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);\n\n const start: IAnnotationPoint = {\n x: displayPoint.x + ux * startPadding,\n y: displayPoint.y + uy * startPadding,\n };\n\n const end: IAnnotationPoint = {\n x: resolved.anchor.x - ux * endPadding,\n y: resolved.anchor.y - uy * endPadding,\n };\n\n connectors.push({\n key: `${key}-connector`,\n start,\n end,\n strokeColor,\n strokeWidth,\n dashArray,\n arrow,\n markerSize,\n markerStrokeWidth,\n });\n }\n });\n\n if (annotationForeignObjects.length === 0 && connectors.length === 0) {\n return null;\n }\n\n const viewBoxWidth = context.svgRect.width || 1;\n const viewBoxHeight = context.svgRect.height || 1;\n\n const markerDefs: React.ReactNode[] = [];\n\n const createMarkerId = (color: string, position: 'start' | 'end', size: number, markerStrokeWidth: number) => {\n const id = `${idPrefix}-${position}-${markerDefs.length}`;\n const refY = size / 2;\n const refX = position === 'end' ? size : 0;\n const pathEnd = `M0 0 L ${size} ${refY} L0 ${size} Z`;\n const pathStart = `M ${size} 0 L0 ${refY} L ${size} ${size} Z`;\n const path = position === 'end' ? pathEnd : pathStart;\n\n markerDefs.push(\n <marker\n key={id}\n id={id}\n markerWidth={size}\n markerHeight={size}\n viewBox={`0 0 ${size} ${size}`}\n refX={refX}\n refY={refY}\n orient=\"auto\"\n markerUnits=\"userSpaceOnUse\"\n >\n <path\n d={path}\n fill={color}\n stroke={color}\n strokeWidth={markerStrokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </marker>,\n );\n\n return id;\n };\n\n const connectorElements = connectors.map(connector => {\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n\n if (connector.arrow === 'start' || connector.arrow === 'both') {\n markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);\n }\n if (connector.arrow === 'end' || connector.arrow === 'both') {\n markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);\n }\n\n return (\n <line\n key={connector.key}\n x1={connector.start.x}\n y1={connector.start.y}\n x2={connector.end.x}\n y2={connector.end.y}\n stroke={connector.strokeColor}\n strokeWidth={connector.strokeWidth}\n strokeDasharray={connector.dashArray}\n strokeLinecap=\"round\"\n markerStart={markerStart ? `url(#${markerStart})` : undefined}\n markerEnd={markerEnd ? `url(#${markerEnd})` : undefined}\n />\n );\n });\n\n const shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;\n return (\n <div className={classNames.root} role=\"presentation\" data-chart-annotation-layer=\"true\">\n {shouldRenderSvg && (\n <svg\n className={classNames.connectorLayer}\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}\n preserveAspectRatio=\"none\"\n data-chart-annotation-svg=\"true\"\n >\n {markerDefs.length > 0 && <defs>{markerDefs}</defs>}\n {connectorElements.length > 0 && (\n <g aria-hidden=\"true\" className={classNames.connectorGroup}>\n {connectorElements}\n </g>\n )}\n {annotationForeignObjects}\n </svg>\n )}\n {measurementElements}\n </div>\n );\n});\n\nChartAnnotationLayer.displayName = 'ChartAnnotationLayer';\n"]}
@@ -0,0 +1,28 @@
1
+ import { ITheme, IStyle } from '@fluentui/react/lib/Styling';
2
+ import { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
3
+ export interface IChartAnnotationLayerStyleProps {
4
+ theme: ITheme;
5
+ className?: string;
6
+ }
7
+ import { ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';
8
+ export interface IChartAnnotationLayerStyles {
9
+ root?: IStyle;
10
+ annotation?: IStyle;
11
+ connectorLayer?: IStyle;
12
+ measurement?: IStyle;
13
+ annotationContent?: IStyle;
14
+ annotationForeignObject?: IStyle;
15
+ annotationContentInteractive?: IStyle;
16
+ annotationForeignObjectInteractive?: IStyle;
17
+ connectorGroup?: IStyle;
18
+ }
19
+ export declare const DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;
20
+ export declare const DEFAULT_ANNOTATION_PADDING = "4px 8px";
21
+ export declare const DEFAULT_CONNECTOR_START_PADDING = 12;
22
+ export declare const DEFAULT_CONNECTOR_END_PADDING = 0;
23
+ export declare const DEFAULT_CONNECTOR_STROKE_WIDTH = 2;
24
+ export declare const DEFAULT_CONNECTOR_ARROW: ChartAnnotationArrowHead;
25
+ export declare const applyOpacityToColor: (color: string | undefined, opacity: number) => string | undefined;
26
+ export declare const getDefaultAnnotationBackgroundColor: (theme: ITheme) => string | undefined;
27
+ export declare const getDefaultConnectorStrokeColor: (theme: ITheme) => string;
28
+ export declare const getStyles: IStyleFunctionOrObject<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStyles = exports.getDefaultConnectorStrokeColor = exports.getDefaultAnnotationBackgroundColor = exports.applyOpacityToColor = exports.DEFAULT_CONNECTOR_ARROW = exports.DEFAULT_CONNECTOR_STROKE_WIDTH = exports.DEFAULT_CONNECTOR_END_PADDING = exports.DEFAULT_CONNECTOR_START_PADDING = exports.DEFAULT_ANNOTATION_PADDING = exports.DEFAULT_ANNOTATION_BACKGROUND_OPACITY = void 0;
4
+ var d3_color_1 = require("d3-color");
5
+ exports.DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;
6
+ exports.DEFAULT_ANNOTATION_PADDING = '4px 8px';
7
+ exports.DEFAULT_CONNECTOR_START_PADDING = 12;
8
+ exports.DEFAULT_CONNECTOR_END_PADDING = 0;
9
+ exports.DEFAULT_CONNECTOR_STROKE_WIDTH = 2;
10
+ exports.DEFAULT_CONNECTOR_ARROW = 'end';
11
+ var applyOpacityToColor = function (color, opacity) {
12
+ if (!color) {
13
+ return undefined;
14
+ }
15
+ var parsed = (0, d3_color_1.color)(color);
16
+ if (!parsed) {
17
+ return color;
18
+ }
19
+ parsed.opacity = Math.max(0, Math.min(1, opacity));
20
+ return parsed.toString();
21
+ };
22
+ exports.applyOpacityToColor = applyOpacityToColor;
23
+ var getDefaultAnnotationBackgroundColor = function (theme) {
24
+ return (0, exports.applyOpacityToColor)(theme.semanticColors.bodyBackground, exports.DEFAULT_ANNOTATION_BACKGROUND_OPACITY);
25
+ };
26
+ exports.getDefaultAnnotationBackgroundColor = getDefaultAnnotationBackgroundColor;
27
+ var getDefaultConnectorStrokeColor = function (theme) { return theme.palette.neutralPrimary; };
28
+ exports.getDefaultConnectorStrokeColor = getDefaultConnectorStrokeColor;
29
+ var getStyles = function (props) {
30
+ var theme = props.theme, className = props.className;
31
+ var defaultBackground = (0, exports.getDefaultAnnotationBackgroundColor)(theme);
32
+ var defaultTextColor = theme.semanticColors.bodyText;
33
+ var defaultBorderColor = theme.semanticColors.bodyDivider;
34
+ return {
35
+ root: [
36
+ {
37
+ position: 'absolute',
38
+ top: 0,
39
+ left: 0,
40
+ right: 0,
41
+ bottom: 0,
42
+ width: '100%',
43
+ height: '100%',
44
+ pointerEvents: 'none',
45
+ overflow: 'visible',
46
+ zIndex: 1,
47
+ },
48
+ className,
49
+ ],
50
+ annotation: [
51
+ theme.fonts.small,
52
+ {
53
+ position: 'absolute',
54
+ pointerEvents: 'none',
55
+ display: 'flex',
56
+ alignItems: 'center',
57
+ justifyContent: 'center',
58
+ textAlign: 'center',
59
+ backgroundColor: defaultBackground,
60
+ color: defaultTextColor,
61
+ padding: exports.DEFAULT_ANNOTATION_PADDING,
62
+ borderRadius: 4,
63
+ boxShadow: theme.effects.elevation4,
64
+ border: "1px solid ".concat(defaultBorderColor),
65
+ whiteSpace: 'pre-wrap',
66
+ zIndex: 2,
67
+ },
68
+ ],
69
+ connectorLayer: [
70
+ {
71
+ position: 'absolute',
72
+ top: 0,
73
+ left: 0,
74
+ width: '100%',
75
+ height: '100%',
76
+ pointerEvents: 'none',
77
+ overflow: 'visible',
78
+ },
79
+ ],
80
+ measurement: [
81
+ {
82
+ position: 'absolute',
83
+ visibility: 'hidden',
84
+ pointerEvents: 'none',
85
+ },
86
+ ],
87
+ annotationContent: [
88
+ {
89
+ width: '100%',
90
+ height: '100%',
91
+ pointerEvents: 'none',
92
+ },
93
+ ],
94
+ annotationForeignObject: [
95
+ {
96
+ overflow: 'visible',
97
+ pointerEvents: 'none',
98
+ },
99
+ ],
100
+ annotationContentInteractive: [
101
+ {
102
+ pointerEvents: 'auto',
103
+ },
104
+ ],
105
+ annotationForeignObjectInteractive: [
106
+ {
107
+ pointerEvents: 'auto',
108
+ },
109
+ ],
110
+ connectorGroup: [
111
+ {
112
+ pointerEvents: 'none',
113
+ },
114
+ ],
115
+ };
116
+ };
117
+ exports.getStyles = getStyles;
118
+ //# sourceMappingURL=ChartAnnotationLayer.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartAnnotationLayer.styles.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.styles.ts"],"names":[],"mappings":";;;AAOA,qCAA4C;AAe/B,QAAA,qCAAqC,GAAG,GAAG,CAAC;AAC5C,QAAA,0BAA0B,GAAG,SAAS,CAAC;AACvC,QAAA,+BAA+B,GAAG,EAAE,CAAC;AACrC,QAAA,6BAA6B,GAAG,CAAC,CAAC;AAClC,QAAA,8BAA8B,GAAG,CAAC,CAAC;AACnC,QAAA,uBAAuB,GAA6B,KAAK,CAAC;AAEhE,IAAM,mBAAm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SACF;QACD,cAAc,EAAE;YACd;gBACE,aAAa,EAAE,MAAM;aACtB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA1FW,QAAA,SAAS,aA0FpB","sourcesContent":["import { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\n\nexport interface IChartAnnotationLayerStyleProps {\n theme: ITheme;\n className?: string;\n}\nimport { color as d3Color } from 'd3-color';\nimport { ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';\n\nexport interface IChartAnnotationLayerStyles {\n root?: IStyle;\n annotation?: IStyle;\n connectorLayer?: IStyle;\n measurement?: IStyle;\n annotationContent?: IStyle;\n annotationForeignObject?: IStyle;\n annotationContentInteractive?: IStyle;\n annotationForeignObjectInteractive?: IStyle;\n connectorGroup?: IStyle;\n}\n\nexport const DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;\nexport const DEFAULT_ANNOTATION_PADDING = '4px 8px';\nexport const DEFAULT_CONNECTOR_START_PADDING = 12;\nexport const DEFAULT_CONNECTOR_END_PADDING = 0;\nexport const DEFAULT_CONNECTOR_STROKE_WIDTH = 2;\nexport const DEFAULT_CONNECTOR_ARROW: ChartAnnotationArrowHead = 'end';\n\nexport const applyOpacityToColor = (color: string | undefined, opacity: number): string | undefined => {\n if (!color) {\n return undefined;\n }\n\n const parsed = d3Color(color);\n if (!parsed) {\n return color;\n }\n\n parsed.opacity = Math.max(0, Math.min(1, opacity));\n return parsed.toString();\n};\n\nexport const getDefaultAnnotationBackgroundColor = (theme: ITheme): string | undefined =>\n applyOpacityToColor(theme.semanticColors.bodyBackground, DEFAULT_ANNOTATION_BACKGROUND_OPACITY);\n\nexport const getDefaultConnectorStrokeColor = (theme: ITheme): string => theme.palette.neutralPrimary;\n\nexport const getStyles: IStyleFunctionOrObject<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles> = (\n props: IChartAnnotationLayerStyleProps,\n) => {\n const { theme, className } = props;\n const defaultBackground = getDefaultAnnotationBackgroundColor(theme);\n const defaultTextColor = theme.semanticColors.bodyText;\n const defaultBorderColor = theme.semanticColors.bodyDivider;\n\n return {\n root: [\n {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n zIndex: 1,\n },\n className,\n ],\n annotation: [\n theme.fonts.small,\n {\n position: 'absolute',\n pointerEvents: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n backgroundColor: defaultBackground,\n color: defaultTextColor,\n padding: DEFAULT_ANNOTATION_PADDING,\n borderRadius: 4,\n boxShadow: theme.effects.elevation4,\n border: `1px solid ${defaultBorderColor}`,\n whiteSpace: 'pre-wrap',\n zIndex: 2,\n },\n ],\n connectorLayer: [\n {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n },\n ],\n measurement: [\n {\n position: 'absolute',\n visibility: 'hidden',\n pointerEvents: 'none',\n },\n ],\n annotationContent: [\n {\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n },\n ],\n annotationForeignObject: [\n {\n overflow: 'visible',\n pointerEvents: 'none',\n },\n ],\n annotationContentInteractive: [\n {\n pointerEvents: 'auto',\n },\n ],\n annotationForeignObjectInteractive: [\n {\n pointerEvents: 'auto',\n },\n ],\n connectorGroup: [\n {\n pointerEvents: 'none',\n },\n ],\n };\n};\n"]}