@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,344 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities", "./ChartAnnotationLayer.styles"], function (require, exports, tslib_1, React, Utilities_1, ChartAnnotationLayer_styles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ChartAnnotationLayer = void 0;
5
+ var getClassNames = (0, Utilities_1.classNamesFunction)();
6
+ var DEFAULT_HORIZONTAL_ALIGN = 'center';
7
+ var DEFAULT_VERTICAL_ALIGN = 'middle';
8
+ var DEFAULT_FOREIGN_OBJECT_WIDTH = 180;
9
+ var DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;
10
+ var MIN_ARROW_SIZE = 6;
11
+ var MAX_ARROW_SIZE = 24;
12
+ var ARROW_SIZE_SCALE = 0.35;
13
+ var getAnnotationKey = function (annotation, index) {
14
+ var _a, _b;
15
+ 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);
16
+ };
17
+ var decodeHtmlEntities = function (html, documentRef) {
18
+ var _a, _b;
19
+ if (!html || html.indexOf('&') === -1) {
20
+ return html;
21
+ }
22
+ if (!((_a = documentRef === null || documentRef === void 0 ? void 0 : documentRef.implementation) === null || _a === void 0 ? void 0 : _a.createHTMLDocument)) {
23
+ return html;
24
+ }
25
+ var workingDocument = documentRef.implementation.createHTMLDocument('');
26
+ workingDocument.body.innerHTML = html;
27
+ return (_b = workingDocument.body.textContent) !== null && _b !== void 0 ? _b : '';
28
+ };
29
+ var sanitizeAnnotationHtml = function (html) {
30
+ var _a, _b;
31
+ if (!html) {
32
+ return '';
33
+ }
34
+ if (typeof window === 'undefined' || !((_b = (_a = window.document) === null || _a === void 0 ? void 0 : _a.implementation) === null || _b === void 0 ? void 0 : _b.createHTMLDocument)) {
35
+ return html;
36
+ }
37
+ var workingDocument = window.document.implementation.createHTMLDocument('');
38
+ workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);
39
+ workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(function (node) { return node.remove(); });
40
+ workingDocument.body.querySelectorAll('*').forEach(function (node) {
41
+ Array.from(node.attributes).forEach(function (attr) {
42
+ if (/^on/i.test(attr.name)) {
43
+ node.removeAttribute(attr.name);
44
+ }
45
+ });
46
+ });
47
+ return workingDocument.body.innerHTML;
48
+ };
49
+ var normalizeBandOffset = function (scale, value) {
50
+ var position = scale === null || scale === void 0 ? void 0 : scale(value);
51
+ if (typeof position !== 'number' || Number.isNaN(position)) {
52
+ return undefined;
53
+ }
54
+ if (scale && typeof scale.bandwidth === 'function') {
55
+ return position + scale.bandwidth() / 2;
56
+ }
57
+ return position;
58
+ };
59
+ var clamp = function (value, min, max) { return Math.max(min, Math.min(max, value)); };
60
+ var createMeasurementSignature = function (annotationHtml, containerStyle, contentStyle, layoutClassName, styleClassName) {
61
+ return JSON.stringify({
62
+ annotationHtml: annotationHtml,
63
+ containerStyle: containerStyle,
64
+ contentStyle: contentStyle,
65
+ layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
66
+ styleClassName: styleClassName !== null && styleClassName !== void 0 ? styleClassName : '',
67
+ });
68
+ };
69
+ var resolveCoordinates = function (annotation, context) {
70
+ var _a, _b;
71
+ var coordinates = annotation.coordinates, layout = annotation.layout;
72
+ if (!coordinates) {
73
+ return undefined;
74
+ }
75
+ var offsetX = (_a = layout === null || layout === void 0 ? void 0 : layout.offsetX) !== null && _a !== void 0 ? _a : 0;
76
+ var offsetY = (_b = layout === null || layout === void 0 ? void 0 : layout.offsetY) !== null && _b !== void 0 ? _b : 0;
77
+ var anchor = { x: 0, y: 0 };
78
+ switch (coordinates.type) {
79
+ case 'data': {
80
+ var x = coordinates.x, y = coordinates.y, _c = coordinates.yAxis, yAxis = _c === void 0 ? 'primary' : _c;
81
+ var xScale = context.xScale;
82
+ var yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
83
+ if (!xScale || !yScale) {
84
+ return undefined;
85
+ }
86
+ var xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);
87
+ var yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);
88
+ if (typeof xValue !== 'number' || typeof yValue !== 'number') {
89
+ return undefined;
90
+ }
91
+ anchor.x = xValue;
92
+ anchor.y = yValue;
93
+ break;
94
+ }
95
+ case 'relative': {
96
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
97
+ return undefined;
98
+ }
99
+ anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;
100
+ anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;
101
+ break;
102
+ }
103
+ case 'pixel': {
104
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
105
+ return undefined;
106
+ }
107
+ anchor.x = context.plotRect.x + coordinates.x;
108
+ anchor.y = context.plotRect.y + coordinates.y;
109
+ break;
110
+ }
111
+ default:
112
+ return undefined;
113
+ }
114
+ var left = anchor.x + offsetX;
115
+ var top = anchor.y + offsetY;
116
+ if (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) {
117
+ left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);
118
+ top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);
119
+ }
120
+ return {
121
+ anchor: anchor,
122
+ point: { x: left, y: top },
123
+ };
124
+ };
125
+ exports.ChartAnnotationLayer = React.memo(function (props) {
126
+ var annotationsProp = props.annotations, theme = props.theme, context = props.context, className = props.className;
127
+ var classNames = getClassNames(ChartAnnotationLayer_styles_1.getStyles, { theme: theme, className: className });
128
+ var idPrefix = React.useMemo(function () { return (0, Utilities_1.getId)('chart-annotation'); }, []);
129
+ var _a = React.useState({}), measurements = _a[0], setMeasurements = _a[1];
130
+ var resolvedAnnotations = React.useMemo(function () {
131
+ return (annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map(function (annotation, index) { return ({ annotation: annotation, key: getAnnotationKey(annotation, index) }); });
132
+ }, [annotationsProp]);
133
+ React.useEffect(function () {
134
+ setMeasurements(function (prev) {
135
+ if (resolvedAnnotations.length === 0) {
136
+ if (Object.keys(prev).length === 0) {
137
+ return prev;
138
+ }
139
+ return {};
140
+ }
141
+ var next = {};
142
+ resolvedAnnotations.forEach(function (_a) {
143
+ var key = _a.key;
144
+ if (prev[key]) {
145
+ next[key] = prev[key];
146
+ }
147
+ });
148
+ if (Object.keys(next).length === Object.keys(prev).length) {
149
+ var identical = true;
150
+ for (var _i = 0, _a = Object.keys(next); _i < _a.length; _i++) {
151
+ var key = _a[_i];
152
+ if (next[key] !== prev[key]) {
153
+ identical = false;
154
+ break;
155
+ }
156
+ }
157
+ if (identical) {
158
+ return prev;
159
+ }
160
+ }
161
+ return next;
162
+ });
163
+ }, [resolvedAnnotations]);
164
+ var updateMeasurement = React.useCallback(function (key, width, height, signature) {
165
+ setMeasurements(function (prev) {
166
+ var _a;
167
+ var prevEntry = prev[key];
168
+ if (prevEntry &&
169
+ prevEntry.signature === signature &&
170
+ Math.abs(prevEntry.width - width) < 0.5 &&
171
+ Math.abs(prevEntry.height - height) < 0.5) {
172
+ return prev;
173
+ }
174
+ if (width === 0 && height === 0) {
175
+ return prev;
176
+ }
177
+ return tslib_1.__assign(tslib_1.__assign({}, prev), (_a = {}, _a[key] = { width: width, height: height, signature: signature }, _a));
178
+ });
179
+ }, []);
180
+ var annotationForeignObjects = [];
181
+ var measurementElements = [];
182
+ var connectors = [];
183
+ resolvedAnnotations.forEach(function (_a) {
184
+ 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;
185
+ var annotation = _a.annotation, key = _a.key;
186
+ var resolved = resolveCoordinates(annotation, context);
187
+ if (!resolved) {
188
+ return;
189
+ }
190
+ var annotationHtml = sanitizeAnnotationHtml((_b = annotation.text) !== null && _b !== void 0 ? _b : '');
191
+ var layout = annotation.layout;
192
+ var horizontalAlign = (_c = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _c !== void 0 ? _c : DEFAULT_HORIZONTAL_ALIGN;
193
+ var verticalAlign = (_d = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _d !== void 0 ? _d : DEFAULT_VERTICAL_ALIGN;
194
+ 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;
195
+ var baseBackgroundColor = (_h = (_g = annotation.style) === null || _g === void 0 ? void 0 : _g.backgroundColor) !== null && _h !== void 0 ? _h : theme.semanticColors.bodyBackground;
196
+ 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;
197
+ var containerStyle = tslib_1.__assign(tslib_1.__assign({ maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth }, (hasCustomBackground && {
198
+ backgroundColor: (0, ChartAnnotationLayer_styles_1.applyOpacityToColor)(baseBackgroundColor, backgroundOpacity),
199
+ })), { 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 });
200
+ var contentStyle = {
201
+ color: (_u = annotation.style) === null || _u === void 0 ? void 0 : _u.textColor,
202
+ fontSize: (_v = annotation.style) === null || _v === void 0 ? void 0 : _v.fontSize,
203
+ fontWeight: (_w = annotation.style) === null || _w === void 0 ? void 0 : _w.fontWeight,
204
+ opacity: 1,
205
+ };
206
+ 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);
207
+ var measurementEntry = measurements[key];
208
+ var isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
209
+ var measuredSize = isMeasurementValid ? measurementEntry : undefined;
210
+ 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);
211
+ var height = Math.max((_0 = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _0 !== void 0 ? _0 : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
212
+ var offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;
213
+ var offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;
214
+ var baseTopLeftX = resolved.point.x + offsetX;
215
+ var baseTopLeftY = resolved.point.y + offsetY;
216
+ var usePlotBounds = (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) !== false;
217
+ var viewportX = usePlotBounds ? context.plotRect.x : 0;
218
+ var viewportY = usePlotBounds ? context.plotRect.y : 0;
219
+ var viewportWidth = usePlotBounds ? context.plotRect.width : (_1 = context.svgRect.width) !== null && _1 !== void 0 ? _1 : 0;
220
+ var viewportHeight = usePlotBounds ? context.plotRect.height : (_2 = context.svgRect.height) !== null && _2 !== void 0 ? _2 : 0;
221
+ var maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;
222
+ var maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;
223
+ var topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;
224
+ var topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;
225
+ var displayPoint = {
226
+ x: topLeftX - offsetX,
227
+ y: topLeftY - offsetY,
228
+ };
229
+ if (annotation.connector) {
230
+ var startPadding = (_3 = annotation.connector.startPadding) !== null && _3 !== void 0 ? _3 : 12;
231
+ var endPadding = (_4 = annotation.connector.endPadding) !== null && _4 !== void 0 ? _4 : 0;
232
+ var minArrowClearance = 6;
233
+ var minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);
234
+ var dx = displayPoint.x - resolved.anchor.x;
235
+ var dy = displayPoint.y - resolved.anchor.y;
236
+ var distance = Math.sqrt(dx * dx + dy * dy);
237
+ if (distance < minDistance) {
238
+ var fallbackDirection = { x: 0, y: -1 };
239
+ var ux = distance === 0 ? fallbackDirection.x : dx / distance;
240
+ var uy = distance === 0 ? fallbackDirection.y : dy / distance;
241
+ var desiredDisplayX = resolved.anchor.x + ux * minDistance;
242
+ var desiredDisplayY = resolved.anchor.y + uy * minDistance;
243
+ var desiredTopLeftX = desiredDisplayX + offsetX;
244
+ var desiredTopLeftY = desiredDisplayY + offsetY;
245
+ desiredTopLeftX =
246
+ viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;
247
+ desiredTopLeftY =
248
+ viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;
249
+ topLeftX = desiredTopLeftX;
250
+ topLeftY = desiredTopLeftY;
251
+ displayPoint = {
252
+ x: topLeftX - offsetX,
253
+ y: topLeftY - offsetY,
254
+ };
255
+ }
256
+ }
257
+ var measurementStyle = tslib_1.__assign({ left: topLeftX, top: topLeftY, pointerEvents: 'none' }, containerStyle);
258
+ if (!isMeasurementValid) {
259
+ measurementElements.push(React.createElement("div", { key: "".concat(key, "-measurement"), ref: function (node) {
260
+ if (node) {
261
+ var rect = node.getBoundingClientRect();
262
+ if (rect.width !== 0 || rect.height !== 0) {
263
+ updateMeasurement(key, rect.width, rect.height, measurementSignature);
264
+ }
265
+ }
266
+ }, 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" },
267
+ 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 } })));
268
+ }
269
+ 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 },
270
+ 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 },
271
+ 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 } }))));
272
+ if (annotation.connector) {
273
+ 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;
274
+ var dx = resolved.anchor.x - displayPoint.x;
275
+ var dy = resolved.anchor.y - displayPoint.y;
276
+ var distance = Math.sqrt(dx * dx + dy * dy) || 1;
277
+ var ux = dx / distance;
278
+ var uy = dy / distance;
279
+ var sizeBasis = Math.max(1, Math.min(width, height));
280
+ var proportionalSize = sizeBasis * ARROW_SIZE_SCALE;
281
+ var maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;
282
+ var maxByDistance = distance * 0.6;
283
+ var markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));
284
+ var markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);
285
+ var start = {
286
+ x: displayPoint.x + ux * startPadding,
287
+ y: displayPoint.y + uy * startPadding,
288
+ };
289
+ var end = {
290
+ x: resolved.anchor.x - ux * endPadding,
291
+ y: resolved.anchor.y - uy * endPadding,
292
+ };
293
+ connectors.push({
294
+ key: "".concat(key, "-connector"),
295
+ start: start,
296
+ end: end,
297
+ strokeColor: strokeColor,
298
+ strokeWidth: strokeWidth,
299
+ dashArray: dashArray,
300
+ arrow: arrow,
301
+ markerSize: markerSize,
302
+ markerStrokeWidth: markerStrokeWidth,
303
+ });
304
+ }
305
+ });
306
+ if (annotationForeignObjects.length === 0 && connectors.length === 0) {
307
+ return null;
308
+ }
309
+ var viewBoxWidth = context.svgRect.width || 1;
310
+ var viewBoxHeight = context.svgRect.height || 1;
311
+ var markerDefs = [];
312
+ var createMarkerId = function (color, position, size, markerStrokeWidth) {
313
+ var id = "".concat(idPrefix, "-").concat(position, "-").concat(markerDefs.length);
314
+ var refY = size / 2;
315
+ var refX = position === 'end' ? size : 0;
316
+ var pathEnd = "M0 0 L ".concat(size, " ").concat(refY, " L0 ").concat(size, " Z");
317
+ var pathStart = "M ".concat(size, " 0 L0 ").concat(refY, " L ").concat(size, " ").concat(size, " Z");
318
+ var path = position === 'end' ? pathEnd : pathStart;
319
+ 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" },
320
+ React.createElement("path", { d: path, fill: color, stroke: color, strokeWidth: markerStrokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
321
+ return id;
322
+ };
323
+ var connectorElements = connectors.map(function (connector) {
324
+ var markerStart;
325
+ var markerEnd;
326
+ if (connector.arrow === 'start' || connector.arrow === 'both') {
327
+ markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);
328
+ }
329
+ if (connector.arrow === 'end' || connector.arrow === 'both') {
330
+ markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);
331
+ }
332
+ 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 }));
333
+ });
334
+ var shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;
335
+ return (React.createElement("div", { className: classNames.root, role: "presentation", "data-chart-annotation-layer": "true" },
336
+ 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" },
337
+ markerDefs.length > 0 && React.createElement("defs", null, markerDefs),
338
+ connectorElements.length > 0 && (React.createElement("g", { "aria-hidden": "true", className: classNames.connectorGroup }, connectorElements)),
339
+ annotationForeignObjects)),
340
+ measurementElements));
341
+ });
342
+ exports.ChartAnnotationLayer.displayName = 'ChartAnnotationLayer';
343
+ });
344
+ //# sourceMappingURL=ChartAnnotationLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartAnnotationLayer.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.tsx"],"names":[],"mappings":";;;;IAuBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAgE,CAAC;IAEzG,IAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC1C,IAAM,sBAAsB,GAAG,QAAQ,CAAC;IACxC,IAAM,4BAA4B,GAAG,GAAG,CAAC;IACzC,IAAM,6BAA6B,GAAG,EAAE,CAAC;IACzC,IAAM,cAAc,GAAG,CAAC,CAAC;IACzB,IAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAM,gBAAgB,GAAG,UAAC,UAA4B,EAAE,KAAa;;QACnE,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;KAAA,CAAC;IAExB,IAAM,kBAAkB,GAAG,UAAC,IAAY,EAAE,WAAqB;;QAC7D,IAAI,CAAC,IAAI,IAA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EAC7D,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,eAAQ,SAAS,MAAG,CAAC,CAAC,CAAC,SAAS,GACvD,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAM,eAAe,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;QACrF,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAC,cAAc,iCAA6B,MAAM;YACpF,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;gBAE/B,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,kCAAO,UAAU,CAAQ;gBAClD,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,0CAAe,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,cAAc,IACvD,iBAAiB,CAChB,CACL;gBACA,wBAAwB,CACrB,CACP;YACA,mBAAmB,CAChB,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,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,119 @@
1
+ define(["require", "exports", "d3-color"], function (require, exports, d3_color_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ 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;
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
+ });
119
+ //# 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":";;;;IAsBa,QAAA,qCAAqC,GAAG,GAAG,CAAC;IAC5C,QAAA,0BAA0B,GAAG,SAAS,CAAC;IACvC,QAAA,+BAA+B,GAAG,EAAE,CAAC;IACrC,QAAA,6BAA6B,GAAG,CAAC,CAAC;IAClC,QAAA,8BAA8B,GAAG,CAAC,C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Aa,EAAE,MAAM;iBACtB;aACF;YACD,kCAAkC,EAAE;gBAClC;oBACE,aAAa,EAAE,MAAM;iBACtB;aACF;YACD,cAAc,EAAE;gBACd;oBACE,aAAa,EAAE,MAAM;iBACtB;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IA1FW,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"]}