@fluentui/react-charts 9.3.5 → 9.3.7

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 (337) hide show
  1. package/CHANGELOG.md +42 -2
  2. package/dist/index.d.ts +239 -55
  3. package/lib/AnnotationOnlyChart.js +1 -0
  4. package/lib/AnnotationOnlyChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +194 -0
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  7. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +1 -0
  8. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  9. package/lib/components/AnnotationOnlyChart/index.js +2 -0
  10. package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
  11. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +31 -0
  12. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  13. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +23 -0
  14. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  15. package/lib/components/AreaChart/AreaChart.js +3 -16
  16. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  17. package/lib/components/AreaChart/useAreaChartStyles.styles.js +11 -6
  18. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  19. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  20. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  21. package/lib/components/ChartTable/ChartTable.js +2 -10
  22. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  23. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  24. package/lib/components/ChartTable/useChartTableStyles.styles.js +59 -39
  25. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  26. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +5 -5
  27. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  28. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +617 -0
  29. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  30. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +1 -0
  31. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  32. package/lib/components/CommonComponents/Annotations/index.js +2 -0
  33. package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
  34. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +173 -0
  35. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  36. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +126 -0
  37. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  38. package/lib/components/CommonComponents/CartesianChart.js +159 -132
  39. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  40. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  41. package/lib/components/CommonComponents/ChartPopover.js +1 -2
  42. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  43. package/lib/components/CommonComponents/index.js +2 -0
  44. package/lib/components/CommonComponents/index.js.map +1 -1
  45. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +32 -14
  46. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  47. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +17 -2
  48. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  49. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +2 -6
  50. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  51. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +1 -2
  52. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  53. package/lib/components/DeclarativeChart/DeclarativeChart.js +83 -40
  54. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  55. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +4 -8
  56. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  57. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +692 -94
  58. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  59. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +23 -8
  60. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  61. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +2 -2
  62. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  63. package/lib/components/DonutChart/DonutChart.js +3 -12
  64. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  65. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  66. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  67. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  68. package/lib/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  69. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  70. package/lib/components/FunnelChart/FunnelChart.js +2 -10
  71. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  72. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  73. package/lib/components/GanttChart/GanttChart.js +6 -19
  74. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  75. package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
  76. package/lib/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  77. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  78. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  79. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  80. package/lib/components/GaugeChart/GaugeChart.js +2 -10
  81. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  82. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  83. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +8 -20
  84. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  85. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +11 -6
  86. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  87. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  88. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  89. package/lib/components/HeatMapChart/HeatMapChart.js +4 -17
  90. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  91. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  92. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  93. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  94. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  95. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  96. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +25 -12
  97. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  98. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +4 -4
  99. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  100. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -23
  101. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  102. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  103. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  104. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  105. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  106. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  107. package/lib/components/Legends/Legends.types.js.map +1 -1
  108. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  109. package/lib/components/Legends/useLegendsStyles.styles.js +97 -37
  110. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  111. package/lib/components/Legends/useLegendsStyles.styles.raw.js +10 -11
  112. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  113. package/lib/components/LineChart/LineChart.js +11 -20
  114. package/lib/components/LineChart/LineChart.js.map +1 -1
  115. package/lib/components/LineChart/LineChart.types.js +1 -1
  116. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  117. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
  118. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  119. package/lib/components/LineChart/useLineChartStyles.styles.js +15 -10
  120. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  121. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  122. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  123. package/lib/components/SankeyChart/SankeyChart.js +3 -9
  124. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  125. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  126. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +13 -10
  127. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  128. package/lib/components/ScatterChart/ScatterChart.js +24 -24
  129. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  130. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  131. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -8
  132. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  133. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  134. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  135. package/lib/components/Sparkline/Sparkline.js +11 -7
  136. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  137. package/lib/components/VerticalBarChart/VerticalBarChart.js +3 -15
  138. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  139. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +13 -8
  140. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  141. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  142. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  143. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +8 -18
  144. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  145. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  146. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +11 -6
  147. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  148. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  149. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  150. package/lib/index.js +1 -0
  151. package/lib/index.js.map +1 -1
  152. package/lib/types/ChartAnnotation.js +1 -0
  153. package/lib/types/ChartAnnotation.js.map +1 -0
  154. package/lib/types/DataPoint.js.map +1 -1
  155. package/lib/types/index.js +1 -0
  156. package/lib/types/index.js.map +1 -1
  157. package/lib/utilities/Common.styles.js +1 -2
  158. package/lib/utilities/Common.styles.js.map +1 -1
  159. package/lib/utilities/Common.styles.raw.js +1 -2
  160. package/lib/utilities/Common.styles.raw.js.map +1 -1
  161. package/lib/utilities/FocusableTooltipText.js +1 -1
  162. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  163. package/lib/utilities/getWindow.js +0 -1
  164. package/lib/utilities/getWindow.js.map +1 -1
  165. package/lib/utilities/hooks.js +34 -0
  166. package/lib/utilities/hooks.js.map +1 -0
  167. package/lib/utilities/image-export-utils.js +221 -73
  168. package/lib/utilities/image-export-utils.js.map +1 -1
  169. package/lib/utilities/utilities.js +39 -37
  170. package/lib/utilities/utilities.js.map +1 -1
  171. package/lib-commonjs/AnnotationOnlyChart.js +6 -0
  172. package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
  173. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +205 -0
  174. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  175. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +6 -0
  176. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  177. package/lib-commonjs/components/AnnotationOnlyChart/index.js +7 -0
  178. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
  179. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +56 -0
  180. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  181. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +33 -0
  182. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  183. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -15
  184. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  185. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +14 -15
  186. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  187. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  188. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  189. package/lib-commonjs/components/ChartTable/ChartTable.js +3 -10
  190. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  191. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  192. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +74 -102
  193. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  194. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +4 -4
  195. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  196. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +628 -0
  197. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  198. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +4 -0
  199. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  200. package/lib-commonjs/components/CommonComponents/Annotations/index.js +7 -0
  201. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
  202. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +265 -0
  203. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  204. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +161 -0
  205. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  206. package/lib-commonjs/components/CommonComponents/CartesianChart.js +159 -131
  207. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  208. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  209. package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
  210. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  211. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  212. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  213. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +35 -22
  214. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  215. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +17 -2
  216. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  217. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -14
  218. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  219. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -1
  220. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  221. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +82 -39
  222. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  223. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  224. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +678 -60
  225. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  226. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +25 -16
  227. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  228. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
  229. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  230. package/lib-commonjs/components/DonutChart/DonutChart.js +2 -11
  231. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  232. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  233. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  234. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  235. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  236. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  237. package/lib-commonjs/components/FunnelChart/FunnelChart.js +2 -10
  238. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  239. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  240. package/lib-commonjs/components/GanttChart/GanttChart.js +5 -18
  241. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  242. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
  243. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  244. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  245. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  246. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  247. package/lib-commonjs/components/GaugeChart/GaugeChart.js +2 -10
  248. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  249. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  250. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +8 -20
  251. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  252. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +14 -15
  253. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  254. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  255. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  256. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +3 -16
  257. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  258. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  259. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  260. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  261. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  262. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  263. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +47 -34
  264. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  265. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +3 -3
  266. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  267. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -21
  268. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  269. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  270. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  271. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  272. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  273. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  274. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  275. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  276. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +144 -86
  277. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  278. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +9 -10
  279. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  280. package/lib-commonjs/components/LineChart/LineChart.js +11 -20
  281. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  282. package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
  283. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  284. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
  285. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  286. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +18 -19
  287. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  288. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  289. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  290. package/lib-commonjs/components/SankeyChart/SankeyChart.js +3 -9
  291. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  292. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  293. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +16 -19
  294. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  295. package/lib-commonjs/components/ScatterChart/ScatterChart.js +22 -22
  296. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  297. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  298. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +16 -17
  299. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  300. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  301. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  302. package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
  303. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  304. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -15
  305. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  306. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +16 -17
  307. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  308. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  309. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  310. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +7 -17
  311. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  312. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  313. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +14 -15
  314. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  315. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  316. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  317. package/lib-commonjs/index.js +1 -0
  318. package/lib-commonjs/index.js.map +1 -1
  319. package/lib-commonjs/types/ChartAnnotation.js +6 -0
  320. package/lib-commonjs/types/ChartAnnotation.js.map +1 -0
  321. package/lib-commonjs/types/DataPoint.js.map +1 -1
  322. package/lib-commonjs/types/index.js +1 -0
  323. package/lib-commonjs/types/index.js.map +1 -1
  324. package/lib-commonjs/utilities/Common.styles.js +1 -2
  325. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  326. package/lib-commonjs/utilities/Common.styles.raw.js +1 -2
  327. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  328. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  329. package/lib-commonjs/utilities/getWindow.js +0 -1
  330. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  331. package/lib-commonjs/utilities/hooks.js +45 -0
  332. package/lib-commonjs/utilities/hooks.js.map +1 -0
  333. package/lib-commonjs/utilities/image-export-utils.js +222 -74
  334. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  335. package/lib-commonjs/utilities/utilities.js +37 -33
  336. package/lib-commonjs/utilities/utilities.js.map +1 -1
  337. package/package.json +11 -11
@@ -0,0 +1,628 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChartAnnotationLayer", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return ChartAnnotationLayer;
10
+ }
11
+ });
12
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ const _react1 = require("@griffel/react");
15
+ const _useChartAnnotationLayerstyles = require("./useChartAnnotationLayer.styles");
16
+ const _reactutilities = require("@fluentui/react-utilities");
17
+ const _reacttheme = require("@fluentui/react-theme");
18
+ const DEFAULT_HORIZONTAL_ALIGN = 'center';
19
+ const DEFAULT_VERTICAL_ALIGN = 'middle';
20
+ const DEFAULT_FOREIGN_OBJECT_WIDTH = 180;
21
+ const DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;
22
+ const MIN_ARROW_SIZE = 6;
23
+ const MAX_ARROW_SIZE = 24;
24
+ const ARROW_SIZE_SCALE = 0.35;
25
+ const MAX_SIMPLE_MARKUP_DEPTH = 5;
26
+ const CHAR_CODE_LESS_THAN = '<'.codePointAt(0);
27
+ const CHAR_CODE_GREATER_THAN = '>'.codePointAt(0);
28
+ const getAnnotationKey = (annotation, index)=>{
29
+ var _annotation_id, _ref;
30
+ return (_ref = (_annotation_id = annotation.id) !== null && _annotation_id !== void 0 ? _annotation_id : typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) !== null && _ref !== void 0 ? _ref : `annotation-${index}`;
31
+ };
32
+ const decodeSimpleMarkupInput = (input)=>{
33
+ const namedEntities = {
34
+ amp: '&',
35
+ quot: '"',
36
+ apos: "'",
37
+ nbsp: '\u00a0'
38
+ };
39
+ const withBasicEntitiesDecoded = input.replace(/&(#x?[0-9a-f]+|#\d+|[a-z][\w-]*);/gi, (match, entity)=>{
40
+ const lower = entity.toLowerCase();
41
+ if (lower === 'lt' || lower === 'gt') {
42
+ return `&${lower};`;
43
+ }
44
+ if (lower.startsWith('#')) {
45
+ const isHex = lower[1] === 'x';
46
+ const digits = lower.slice(isHex ? 2 : 1);
47
+ const codePoint = Number.parseInt(digits, isHex ? 16 : 10);
48
+ if (Number.isNaN(codePoint)) {
49
+ return match;
50
+ }
51
+ if (codePoint === CHAR_CODE_LESS_THAN) {
52
+ return '&lt;';
53
+ }
54
+ if (codePoint === CHAR_CODE_GREATER_THAN) {
55
+ return '&gt;';
56
+ }
57
+ return String.fromCodePoint(codePoint);
58
+ }
59
+ var _namedEntities_lower;
60
+ return (_namedEntities_lower = namedEntities[lower]) !== null && _namedEntities_lower !== void 0 ? _namedEntities_lower : match;
61
+ });
62
+ return withBasicEntitiesDecoded.replace(/&lt;([^;]+)&gt;/gi, (match, inner)=>{
63
+ const normalized = inner.trim().replace(/\s+/g, ' ');
64
+ const lower = normalized.toLowerCase();
65
+ switch(lower){
66
+ case 'b':
67
+ return '<b>';
68
+ case '/b':
69
+ return '</b>';
70
+ case 'i':
71
+ return '<i>';
72
+ case '/i':
73
+ return '</i>';
74
+ case 'br':
75
+ case 'br/':
76
+ case 'br /':
77
+ return '<br />';
78
+ default:
79
+ return match;
80
+ }
81
+ });
82
+ };
83
+ const appendTextNode = (nodes, text)=>{
84
+ if (text.length === 0) {
85
+ return;
86
+ }
87
+ const last = nodes[nodes.length - 1];
88
+ if (last && last.type === 'text') {
89
+ last.content += text;
90
+ } else {
91
+ nodes.push({
92
+ type: 'text',
93
+ content: text
94
+ });
95
+ }
96
+ };
97
+ const serializeSimpleMarkup = (nodes)=>nodes.map((node)=>{
98
+ if (node.type === 'text') {
99
+ return node.content;
100
+ }
101
+ if (node.type === 'br') {
102
+ return '<br />';
103
+ }
104
+ return `<${node.tag}>${serializeSimpleMarkup(node.children)}</${node.tag}>`;
105
+ }).join('');
106
+ const parseSimpleMarkup = (input)=>{
107
+ if (!input) {
108
+ return [];
109
+ }
110
+ const decodedInput = decodeSimpleMarkupInput(input);
111
+ const rootChildren = [];
112
+ const stack = [
113
+ {
114
+ node: null
115
+ }
116
+ ];
117
+ const currentChildren = ()=>{
118
+ var _stack__node;
119
+ var _stack__node_children;
120
+ return (_stack__node_children = (_stack__node = stack[stack.length - 1].node) === null || _stack__node === void 0 ? void 0 : _stack__node.children) !== null && _stack__node_children !== void 0 ? _stack__node_children : rootChildren;
121
+ };
122
+ const tagRegex = /<\/?([a-z]+)\s*\/?\s*>/gi;
123
+ let lastIndex = 0;
124
+ let match;
125
+ while((match = tagRegex.exec(decodedInput)) !== null){
126
+ const [fullMatch, rawTagName] = match;
127
+ const tagName = rawTagName.toLowerCase();
128
+ const isClosing = fullMatch.startsWith('</');
129
+ const isSelfClosing = /\/\s*>$/.test(fullMatch);
130
+ appendTextNode(currentChildren(), decodedInput.slice(lastIndex, match.index));
131
+ lastIndex = match.index + fullMatch.length;
132
+ if (tagName === 'br' && !isClosing) {
133
+ currentChildren().push({
134
+ type: 'br'
135
+ });
136
+ continue;
137
+ }
138
+ if ((tagName === 'b' || tagName === 'i') && !isSelfClosing) {
139
+ if (isClosing) {
140
+ const top = stack[stack.length - 1].node;
141
+ if (stack.length > 1 && (top === null || top === void 0 ? void 0 : top.tag) === tagName) {
142
+ stack.pop();
143
+ } else {
144
+ appendTextNode(currentChildren(), fullMatch);
145
+ }
146
+ } else {
147
+ if (stack.length - 1 >= MAX_SIMPLE_MARKUP_DEPTH) {
148
+ appendTextNode(currentChildren(), fullMatch);
149
+ continue;
150
+ }
151
+ const elementNode = {
152
+ type: 'element',
153
+ tag: tagName,
154
+ children: []
155
+ };
156
+ currentChildren().push(elementNode);
157
+ stack.push({
158
+ node: elementNode
159
+ });
160
+ }
161
+ continue;
162
+ }
163
+ appendTextNode(currentChildren(), fullMatch);
164
+ }
165
+ appendTextNode(currentChildren(), decodedInput.slice(lastIndex));
166
+ while(stack.length > 1){
167
+ var _stack__node;
168
+ const unclosed = stack.pop();
169
+ const elementNode = unclosed.node;
170
+ if (!elementNode) {
171
+ continue;
172
+ }
173
+ var _stack__node_children;
174
+ const parentChildren = (_stack__node_children = (_stack__node = stack[stack.length - 1].node) === null || _stack__node === void 0 ? void 0 : _stack__node.children) !== null && _stack__node_children !== void 0 ? _stack__node_children : rootChildren;
175
+ const lastChild = parentChildren[parentChildren.length - 1];
176
+ if (lastChild === elementNode) {
177
+ parentChildren.pop();
178
+ } else {
179
+ const nodeIndex = parentChildren.indexOf(elementNode);
180
+ if (nodeIndex !== -1) {
181
+ parentChildren.splice(nodeIndex, 1);
182
+ }
183
+ }
184
+ appendTextNode(parentChildren, `<${elementNode.tag}>${serializeSimpleMarkup(elementNode.children)}</${elementNode.tag}>`);
185
+ }
186
+ return rootChildren;
187
+ };
188
+ const simpleMarkupNodesToPlainText = (nodes)=>nodes.map((node)=>{
189
+ if (node.type === 'text') {
190
+ return node.content;
191
+ }
192
+ if (node.type === 'br') {
193
+ return '\n';
194
+ }
195
+ return simpleMarkupNodesToPlainText(node.children);
196
+ }).join('');
197
+ const renderSimpleMarkupNodeList = (nodes, keyPrefix)=>nodes.map((node, index)=>{
198
+ const key = `${keyPrefix}-${index}`;
199
+ if (node.type === 'text') {
200
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
201
+ key: key
202
+ }, node.content);
203
+ }
204
+ if (node.type === 'br') {
205
+ return /*#__PURE__*/ _react.createElement("br", {
206
+ key: key
207
+ });
208
+ }
209
+ const Tag = node.tag === 'b' ? 'strong' : 'em';
210
+ return /*#__PURE__*/ _react.createElement(Tag, {
211
+ key
212
+ }, ...renderSimpleMarkupNodeList(node.children, key));
213
+ });
214
+ const renderSimpleMarkup = (nodes, keyPrefix)=>{
215
+ const rendered = renderSimpleMarkupNodeList(nodes, keyPrefix);
216
+ var _rendered_;
217
+ return rendered.length <= 1 ? (_rendered_ = rendered[0]) !== null && _rendered_ !== void 0 ? _rendered_ : null : rendered;
218
+ };
219
+ const normalizeBandOffset = (scale, value)=>{
220
+ const position = scale === null || scale === void 0 ? void 0 : scale(value);
221
+ if (typeof position !== 'number' || Number.isNaN(position)) {
222
+ return undefined;
223
+ }
224
+ if (scale && typeof scale.bandwidth === 'function') {
225
+ return position + scale.bandwidth() / 2;
226
+ }
227
+ return position;
228
+ };
229
+ const clamp = (value, min, max)=>Math.max(min, Math.min(max, value));
230
+ const createMeasurementSignature = (annotationContentSignature, containerStyle, contentStyle, layoutClassName, styleClassName)=>JSON.stringify({
231
+ annotationContentSignature,
232
+ containerStyle,
233
+ contentStyle,
234
+ layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
235
+ styleClassName: styleClassName !== null && styleClassName !== void 0 ? styleClassName : ''
236
+ });
237
+ const resolveCoordinates = (annotation, context)=>{
238
+ const { coordinates, layout } = annotation;
239
+ if (!coordinates) {
240
+ return undefined;
241
+ }
242
+ var _layout_offsetX;
243
+ const offsetX = (_layout_offsetX = layout === null || layout === void 0 ? void 0 : layout.offsetX) !== null && _layout_offsetX !== void 0 ? _layout_offsetX : 0;
244
+ var _layout_offsetY;
245
+ const offsetY = (_layout_offsetY = layout === null || layout === void 0 ? void 0 : layout.offsetY) !== null && _layout_offsetY !== void 0 ? _layout_offsetY : 0;
246
+ const anchor = {
247
+ x: 0,
248
+ y: 0
249
+ };
250
+ switch(coordinates.type){
251
+ case 'data':
252
+ {
253
+ const { x, y, yAxis = 'primary' } = coordinates;
254
+ const xScale = context.xScale;
255
+ const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
256
+ if (!xScale || !yScale) {
257
+ return undefined;
258
+ }
259
+ const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);
260
+ const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);
261
+ if (typeof xValue !== 'number' || typeof yValue !== 'number') {
262
+ return undefined;
263
+ }
264
+ anchor.x = xValue;
265
+ anchor.y = yValue;
266
+ break;
267
+ }
268
+ case 'relative':
269
+ {
270
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
271
+ return undefined;
272
+ }
273
+ anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;
274
+ anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;
275
+ break;
276
+ }
277
+ case 'pixel':
278
+ {
279
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
280
+ return undefined;
281
+ }
282
+ anchor.x = context.plotRect.x + coordinates.x;
283
+ anchor.y = context.plotRect.y + coordinates.y;
284
+ break;
285
+ }
286
+ default:
287
+ return undefined;
288
+ }
289
+ let left = anchor.x + offsetX;
290
+ let top = anchor.y + offsetY;
291
+ if (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) {
292
+ left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);
293
+ top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);
294
+ }
295
+ return {
296
+ anchor,
297
+ point: {
298
+ x: left,
299
+ y: top
300
+ }
301
+ };
302
+ };
303
+ const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
304
+ const { annotations: annotationsProp, context } = props;
305
+ const classes = (0, _useChartAnnotationLayerstyles.useChartAnnotationLayerStyles)(props);
306
+ const idPrefix = (0, _reactutilities.useId)('chart-annotation');
307
+ const [measurements, setMeasurements] = _react.useState({});
308
+ const resolvedAnnotations = _react.useMemo(()=>(annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map((annotation, index)=>({
309
+ annotation,
310
+ key: getAnnotationKey(annotation, index)
311
+ })), [
312
+ annotationsProp
313
+ ]);
314
+ _react.useEffect(()=>{
315
+ setMeasurements((prev)=>{
316
+ if (resolvedAnnotations.length === 0) {
317
+ if (Object.keys(prev).length === 0) {
318
+ return prev;
319
+ }
320
+ return {};
321
+ }
322
+ const next = {};
323
+ resolvedAnnotations.forEach(({ key })=>{
324
+ if (prev[key]) {
325
+ next[key] = prev[key];
326
+ }
327
+ });
328
+ if (Object.keys(next).length === Object.keys(prev).length) {
329
+ let identical = true;
330
+ for (const key of Object.keys(next)){
331
+ if (next[key] !== prev[key]) {
332
+ identical = false;
333
+ break;
334
+ }
335
+ }
336
+ if (identical) {
337
+ return prev;
338
+ }
339
+ }
340
+ return next;
341
+ });
342
+ }, [
343
+ resolvedAnnotations
344
+ ]);
345
+ const updateMeasurement = _react.useCallback((key, width, height, signature)=>{
346
+ setMeasurements((prev)=>{
347
+ const prevEntry = prev[key];
348
+ if (prevEntry && prevEntry.signature === signature && Math.abs(prevEntry.width - width) < 0.5 && Math.abs(prevEntry.height - height) < 0.5) {
349
+ return prev;
350
+ }
351
+ if (width === 0 && height === 0) {
352
+ return prev;
353
+ }
354
+ return {
355
+ ...prev,
356
+ [key]: {
357
+ width,
358
+ height,
359
+ signature
360
+ }
361
+ };
362
+ });
363
+ }, []);
364
+ const annotationForeignObjects = [];
365
+ const measurementElements = [];
366
+ const connectors = [];
367
+ resolvedAnnotations.forEach(({ annotation, key })=>{
368
+ var _annotation_style, _annotation_style1, _annotation_style2, _annotation_style3, _annotation_style4, _annotation_style5, _annotation_style6, _annotation_style7, _annotation_style8, _annotation_style9, _annotation_style10, _annotation_style11, _annotation_style12, _annotation_style13, _annotation_style14, _annotation_style15, _annotation_style16, _annotation_style17, _annotation_accessibility, _annotation_accessibility1, _annotation_accessibility2;
369
+ const resolved = resolveCoordinates(annotation, context);
370
+ if (!resolved) {
371
+ return;
372
+ }
373
+ const rawAnnotationText = annotation.text === undefined || annotation.text === null ? '' : String(annotation.text);
374
+ const annotationMarkupNodes = parseSimpleMarkup(rawAnnotationText);
375
+ const annotationMarkupSignature = JSON.stringify(annotationMarkupNodes);
376
+ const annotationPlainText = simpleMarkupNodesToPlainText(annotationMarkupNodes);
377
+ const layout = annotation.layout;
378
+ var _layout_align;
379
+ const horizontalAlign = (_layout_align = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _layout_align !== void 0 ? _layout_align : DEFAULT_HORIZONTAL_ALIGN;
380
+ var _layout_verticalAlign;
381
+ const verticalAlign = (_layout_verticalAlign = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _layout_verticalAlign !== void 0 ? _layout_verticalAlign : DEFAULT_VERTICAL_ALIGN;
382
+ var _annotation_style_opacity;
383
+ const backgroundOpacity = (_annotation_style_opacity = (_annotation_style = annotation.style) === null || _annotation_style === void 0 ? void 0 : _annotation_style.opacity) !== null && _annotation_style_opacity !== void 0 ? _annotation_style_opacity : _useChartAnnotationLayerstyles.DEFAULT_ANNOTATION_BACKGROUND_OPACITY;
384
+ const baseBackgroundColor = (_annotation_style1 = annotation.style) === null || _annotation_style1 === void 0 ? void 0 : _annotation_style1.backgroundColor;
385
+ const hasCustomBackground = ((_annotation_style2 = annotation.style) === null || _annotation_style2 === void 0 ? void 0 : _annotation_style2.backgroundColor) !== undefined || ((_annotation_style3 = annotation.style) === null || _annotation_style3 === void 0 ? void 0 : _annotation_style3.opacity) !== undefined;
386
+ var _annotation_style_borderStyle;
387
+ const containerStyle = {
388
+ maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth,
389
+ ...hasCustomBackground ? {
390
+ backgroundColor: (0, _useChartAnnotationLayerstyles.applyOpacityToColor)(baseBackgroundColor, backgroundOpacity)
391
+ } : {
392
+ backgroundColor: (0, _useChartAnnotationLayerstyles.applyOpacityToColor)(_reacttheme.tokens.colorNeutralBackground1, _useChartAnnotationLayerstyles.DEFAULT_ANNOTATION_BACKGROUND_OPACITY)
393
+ },
394
+ borderColor: (_annotation_style4 = annotation.style) === null || _annotation_style4 === void 0 ? void 0 : _annotation_style4.borderColor,
395
+ borderWidth: (_annotation_style5 = annotation.style) === null || _annotation_style5 === void 0 ? void 0 : _annotation_style5.borderWidth,
396
+ borderStyle: (_annotation_style_borderStyle = (_annotation_style6 = annotation.style) === null || _annotation_style6 === void 0 ? void 0 : _annotation_style6.borderStyle) !== null && _annotation_style_borderStyle !== void 0 ? _annotation_style_borderStyle : ((_annotation_style7 = annotation.style) === null || _annotation_style7 === void 0 ? void 0 : _annotation_style7.borderColor) ? 'solid' : undefined,
397
+ borderRadius: (_annotation_style8 = annotation.style) === null || _annotation_style8 === void 0 ? void 0 : _annotation_style8.borderRadius,
398
+ padding: (_annotation_style9 = annotation.style) === null || _annotation_style9 === void 0 ? void 0 : _annotation_style9.padding,
399
+ boxShadow: (_annotation_style10 = annotation.style) === null || _annotation_style10 === void 0 ? void 0 : _annotation_style10.boxShadow
400
+ };
401
+ const contentStyle = {
402
+ color: (_annotation_style11 = annotation.style) === null || _annotation_style11 === void 0 ? void 0 : _annotation_style11.textColor,
403
+ fontSize: (_annotation_style12 = annotation.style) === null || _annotation_style12 === void 0 ? void 0 : _annotation_style12.fontSize,
404
+ fontWeight: (_annotation_style13 = annotation.style) === null || _annotation_style13 === void 0 ? void 0 : _annotation_style13.fontWeight,
405
+ opacity: 1
406
+ };
407
+ if (typeof ((_annotation_style14 = annotation.style) === null || _annotation_style14 === void 0 ? void 0 : _annotation_style14.rotation) === 'number' && !Number.isNaN(annotation.style.rotation)) {
408
+ containerStyle.transform = `rotate(${annotation.style.rotation}deg)`;
409
+ containerStyle.transformOrigin = '50% 50%';
410
+ }
411
+ const measurementSignature = createMeasurementSignature(annotationMarkupSignature, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style15 = annotation.style) === null || _annotation_style15 === void 0 ? void 0 : _annotation_style15.className);
412
+ const measurementEntry = measurements[key];
413
+ const isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
414
+ const measuredSize = isMeasurementValid ? measurementEntry : undefined;
415
+ var _measuredSize_width, _ref;
416
+ const width = Math.max((_ref = (_measuredSize_width = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) !== null && _measuredSize_width !== void 0 ? _measuredSize_width : layout === null || layout === void 0 ? void 0 : layout.maxWidth) !== null && _ref !== void 0 ? _ref : DEFAULT_FOREIGN_OBJECT_WIDTH, 1);
417
+ var _measuredSize_height;
418
+ const height = Math.max((_measuredSize_height = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _measuredSize_height !== void 0 ? _measuredSize_height : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
419
+ const offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;
420
+ const offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;
421
+ const baseTopLeftX = resolved.point.x + offsetX;
422
+ const baseTopLeftY = resolved.point.y + offsetY;
423
+ const usePlotBounds = (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) !== false;
424
+ const viewportX = usePlotBounds ? context.plotRect.x : 0;
425
+ const viewportY = usePlotBounds ? context.plotRect.y : 0;
426
+ var _context_svgRect_width;
427
+ const viewportWidth = usePlotBounds ? context.plotRect.width : (_context_svgRect_width = context.svgRect.width) !== null && _context_svgRect_width !== void 0 ? _context_svgRect_width : 0;
428
+ var _context_svgRect_height;
429
+ const viewportHeight = usePlotBounds ? context.plotRect.height : (_context_svgRect_height = context.svgRect.height) !== null && _context_svgRect_height !== void 0 ? _context_svgRect_height : 0;
430
+ const maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;
431
+ const maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;
432
+ let topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;
433
+ let topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;
434
+ let displayPoint = {
435
+ x: topLeftX - offsetX,
436
+ y: topLeftY - offsetY
437
+ };
438
+ if (annotation.connector) {
439
+ var _annotation_connector_startPadding;
440
+ const startPadding = (_annotation_connector_startPadding = annotation.connector.startPadding) !== null && _annotation_connector_startPadding !== void 0 ? _annotation_connector_startPadding : 12;
441
+ var _annotation_connector_endPadding;
442
+ const endPadding = (_annotation_connector_endPadding = annotation.connector.endPadding) !== null && _annotation_connector_endPadding !== void 0 ? _annotation_connector_endPadding : 0;
443
+ const minArrowClearance = 6;
444
+ const minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);
445
+ const dx = displayPoint.x - resolved.anchor.x;
446
+ const dy = displayPoint.y - resolved.anchor.y;
447
+ const distance = Math.sqrt(dx * dx + dy * dy);
448
+ if (distance < minDistance) {
449
+ const fallbackDirection = {
450
+ x: 0,
451
+ y: -1
452
+ };
453
+ const ux = distance === 0 ? fallbackDirection.x : dx / distance;
454
+ const uy = distance === 0 ? fallbackDirection.y : dy / distance;
455
+ const desiredDisplayX = resolved.anchor.x + ux * minDistance;
456
+ const desiredDisplayY = resolved.anchor.y + uy * minDistance;
457
+ let desiredTopLeftX = desiredDisplayX + offsetX;
458
+ let desiredTopLeftY = desiredDisplayY + offsetY;
459
+ desiredTopLeftX = viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;
460
+ desiredTopLeftY = viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;
461
+ topLeftX = desiredTopLeftX;
462
+ topLeftY = desiredTopLeftY;
463
+ displayPoint = {
464
+ x: topLeftX - offsetX,
465
+ y: topLeftY - offsetY
466
+ };
467
+ }
468
+ }
469
+ const measurementStyle = {
470
+ position: 'absolute',
471
+ left: topLeftX,
472
+ top: topLeftY,
473
+ pointerEvents: 'none',
474
+ visibility: 'hidden',
475
+ ...containerStyle
476
+ };
477
+ if (!isMeasurementValid) {
478
+ var _annotation_style18, _annotation_style19;
479
+ measurementElements.push(/*#__PURE__*/ _react.createElement("div", {
480
+ key: `${key}-measurement`,
481
+ ref: (node)=>{
482
+ if (node) {
483
+ const rect = node.getBoundingClientRect();
484
+ if (rect.width !== 0 || rect.height !== 0) {
485
+ updateMeasurement(key, rect.width, rect.height, measurementSignature);
486
+ }
487
+ }
488
+ },
489
+ className: (0, _react1.mergeClasses)(classes.annotation, classes.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
490
+ style: measurementStyle,
491
+ "aria-hidden": true,
492
+ "data-annotation-key": key,
493
+ "data-chart-annotation-measurement": "true"
494
+ }, /*#__PURE__*/ _react.createElement("div", {
495
+ className: (0, _react1.mergeClasses)(classes.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style19 = annotation.style) === null || _annotation_style19 === void 0 ? void 0 : _annotation_style19.className),
496
+ style: contentStyle
497
+ }, renderSimpleMarkup(annotationMarkupNodes, `${key}-measurement`))));
498
+ }
499
+ var _annotation_accessibility_role, _annotation_accessibility_ariaLabel;
500
+ annotationForeignObjects.push(/*#__PURE__*/ _react.createElement("foreignObject", {
501
+ key: `${key}-annotation`,
502
+ x: topLeftX,
503
+ y: topLeftY,
504
+ width: width,
505
+ height: height,
506
+ className: (0, _react1.mergeClasses)(classes.annotationForeignObject),
507
+ "data-annotation-key": key
508
+ }, /*#__PURE__*/ _react.createElement("div", {
509
+ className: (0, _react1.mergeClasses)(classes.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style16 = annotation.style) === null || _annotation_style16 === void 0 ? void 0 : _annotation_style16.className),
510
+ style: containerStyle,
511
+ "data-annotation-key": key
512
+ }, /*#__PURE__*/ _react.createElement("div", {
513
+ className: (0, _react1.mergeClasses)(classes.annotationContent, (_annotation_style17 = annotation.style) === null || _annotation_style17 === void 0 ? void 0 : _annotation_style17.className),
514
+ style: contentStyle,
515
+ role: (_annotation_accessibility_role = (_annotation_accessibility = annotation.accessibility) === null || _annotation_accessibility === void 0 ? void 0 : _annotation_accessibility.role) !== null && _annotation_accessibility_role !== void 0 ? _annotation_accessibility_role : 'note',
516
+ "aria-label": (_annotation_accessibility_ariaLabel = (_annotation_accessibility1 = annotation.accessibility) === null || _annotation_accessibility1 === void 0 ? void 0 : _annotation_accessibility1.ariaLabel) !== null && _annotation_accessibility_ariaLabel !== void 0 ? _annotation_accessibility_ariaLabel : annotationPlainText ? annotationPlainText : undefined,
517
+ "aria-describedby": (_annotation_accessibility2 = annotation.accessibility) === null || _annotation_accessibility2 === void 0 ? void 0 : _annotation_accessibility2.ariaDescribedBy,
518
+ "data-chart-annotation": "true",
519
+ "data-annotation-key": key
520
+ }, renderSimpleMarkup(annotationMarkupNodes, `${key}-content`)))));
521
+ if (annotation.connector) {
522
+ const { startPadding = _useChartAnnotationLayerstyles.DEFAULT_CONNECTOR_START_PADDING, endPadding = _useChartAnnotationLayerstyles.DEFAULT_CONNECTOR_END_PADDING, strokeColor = (0, _useChartAnnotationLayerstyles.getDefaultConnectorStrokeColor)(), strokeWidth = _useChartAnnotationLayerstyles.DEFAULT_CONNECTOR_STROKE_WIDTH, dashArray, arrow = _useChartAnnotationLayerstyles.DEFAULT_CONNECTOR_ARROW } = annotation.connector;
523
+ const dx = resolved.anchor.x - displayPoint.x;
524
+ const dy = resolved.anchor.y - displayPoint.y;
525
+ const distance = Math.sqrt(dx * dx + dy * dy) || 1;
526
+ const ux = dx / distance;
527
+ const uy = dy / distance;
528
+ const sizeBasis = Math.max(1, Math.min(width, height));
529
+ const proportionalSize = sizeBasis * ARROW_SIZE_SCALE;
530
+ const maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;
531
+ const maxByDistance = distance * 0.6;
532
+ const markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));
533
+ const markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);
534
+ const start = {
535
+ x: displayPoint.x + ux * startPadding,
536
+ y: displayPoint.y + uy * startPadding
537
+ };
538
+ const end = {
539
+ x: resolved.anchor.x - ux * endPadding,
540
+ y: resolved.anchor.y - uy * endPadding
541
+ };
542
+ connectors.push({
543
+ key: `${key}-connector`,
544
+ start,
545
+ end,
546
+ strokeColor,
547
+ strokeWidth,
548
+ dashArray,
549
+ arrow,
550
+ markerSize,
551
+ markerStrokeWidth
552
+ });
553
+ }
554
+ });
555
+ if (annotationForeignObjects.length === 0 && connectors.length === 0) {
556
+ return null;
557
+ }
558
+ const viewBoxWidth = context.svgRect.width || 1;
559
+ const viewBoxHeight = context.svgRect.height || 1;
560
+ const markerDefs = [];
561
+ const createMarkerId = (color, position, size, markerStrokeWidth)=>{
562
+ const id = `${idPrefix}-${position}-${markerDefs.length}`;
563
+ const refY = size / 2;
564
+ const refX = position === 'end' ? size : 0;
565
+ const pathEnd = `M0 0 L ${size} ${refY} L0 ${size} Z`;
566
+ const pathStart = `M ${size} 0 L0 ${refY} L ${size} ${size} Z`;
567
+ const path = position === 'end' ? pathEnd : pathStart;
568
+ markerDefs.push(/*#__PURE__*/ _react.createElement("marker", {
569
+ key: id,
570
+ id: id,
571
+ markerWidth: size,
572
+ markerHeight: size,
573
+ viewBox: `0 0 ${size} ${size}`,
574
+ refX: refX,
575
+ refY: refY,
576
+ orient: "auto",
577
+ markerUnits: "userSpaceOnUse"
578
+ }, /*#__PURE__*/ _react.createElement("path", {
579
+ d: path,
580
+ fill: color,
581
+ stroke: color,
582
+ strokeWidth: markerStrokeWidth,
583
+ strokeLinecap: "round",
584
+ strokeLinejoin: "round"
585
+ })));
586
+ return id;
587
+ };
588
+ const connectorElements = connectors.map((connector)=>{
589
+ let markerStart;
590
+ let markerEnd;
591
+ if (connector.arrow === 'start' || connector.arrow === 'both') {
592
+ markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);
593
+ }
594
+ if (connector.arrow === 'end' || connector.arrow === 'both') {
595
+ markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);
596
+ }
597
+ return /*#__PURE__*/ _react.createElement("line", {
598
+ key: connector.key,
599
+ x1: connector.start.x,
600
+ y1: connector.start.y,
601
+ x2: connector.end.x,
602
+ y2: connector.end.y,
603
+ stroke: connector.strokeColor,
604
+ strokeWidth: connector.strokeWidth,
605
+ strokeDasharray: connector.dashArray,
606
+ strokeLinecap: "round",
607
+ markerStart: markerStart ? `url(#${markerStart})` : undefined,
608
+ markerEnd: markerEnd ? `url(#${markerEnd})` : undefined
609
+ });
610
+ });
611
+ const shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;
612
+ return /*#__PURE__*/ _react.createElement("div", {
613
+ className: classes.root,
614
+ role: "presentation",
615
+ "data-chart-annotation-layer": "true"
616
+ }, shouldRenderSvg && /*#__PURE__*/ _react.createElement("svg", {
617
+ className: classes.connectorLayer,
618
+ width: "100%",
619
+ height: "100%",
620
+ viewBox: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
621
+ preserveAspectRatio: "none",
622
+ "data-chart-annotation-svg": "true"
623
+ }, markerDefs.length > 0 && /*#__PURE__*/ _react.createElement("defs", null, markerDefs), connectorElements.length > 0 && /*#__PURE__*/ _react.createElement("g", {
624
+ "aria-hidden": "true",
625
+ className: classes.connectorGroup
626
+ }, connectorElements), annotationForeignObjects), measurementElements);
627
+ });
628
+ ChartAnnotationLayer.displayName = 'ChartAnnotationLayer';