@fluentui/react-charts 9.1.9 → 9.2.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 (451) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/dist/index.d.ts +348 -11
  3. package/lib/AreaChart.js.map +1 -1
  4. package/lib/CartesianChart.js.map +1 -1
  5. package/lib/DeclarativeChart.js.map +1 -1
  6. package/lib/DonutChart.js.map +1 -1
  7. package/lib/FunnelChart.js +1 -0
  8. package/lib/FunnelChart.js.map +1 -0
  9. package/lib/GanttChart.js +1 -0
  10. package/lib/GanttChart.js.map +1 -0
  11. package/lib/GaugeChart.js.map +1 -1
  12. package/lib/GroupedVerticalBarChart.js.map +1 -1
  13. package/lib/HeatMapChart.js.map +1 -1
  14. package/lib/HorizontalBarChart.js.map +1 -1
  15. package/lib/HorizontalBarChartWithAxis.js.map +1 -1
  16. package/lib/Legends.js.map +1 -1
  17. package/lib/LineChart.js.map +1 -1
  18. package/lib/Popover.js.map +1 -1
  19. package/lib/ResponsiveContainer.js.map +1 -1
  20. package/lib/SankeyChart.js.map +1 -1
  21. package/lib/ScatterChart.js.map +1 -1
  22. package/lib/Sparkline.js.map +1 -1
  23. package/lib/VerticalBarChart.js.map +1 -1
  24. package/lib/VerticalStackedBarChart.js.map +1 -1
  25. package/lib/components/AreaChart/AreaChart.js +24 -8
  26. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  27. package/lib/components/AreaChart/AreaChart.types.js.map +1 -1
  28. package/lib/components/AreaChart/index.js.map +1 -1
  29. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  30. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +41 -0
  31. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -0
  32. package/lib/components/CommonComponents/CartesianChart.js +12 -8
  33. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  34. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  35. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  36. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  37. package/lib/components/CommonComponents/index.js.map +1 -1
  38. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +1 -2
  39. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +128 -0
  40. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -0
  41. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +1 -2
  42. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +126 -0
  43. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -0
  44. package/lib/components/DeclarativeChart/DeclarativeChart.js +15 -7
  45. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  46. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +44 -13
  47. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  48. package/lib/components/DeclarativeChart/imageExporter.js +1 -0
  49. package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
  50. package/lib/components/DeclarativeChart/index.js.map +1 -1
  51. package/lib/components/DonutChart/Arc/Arc.js +5 -5
  52. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  53. package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
  54. package/lib/components/DonutChart/Arc/index.js.map +1 -1
  55. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +1 -2
  56. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +44 -0
  57. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -0
  58. package/lib/components/DonutChart/DonutChart.js +18 -4
  59. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  60. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  61. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  62. package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -1
  63. package/lib/components/DonutChart/Pie/index.js.map +1 -1
  64. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +1 -2
  65. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js +29 -0
  66. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -0
  67. package/lib/components/DonutChart/index.js.map +1 -1
  68. package/lib/components/DonutChart/useDonutChartStyles.styles.js +1 -2
  69. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +45 -0
  70. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -0
  71. package/lib/components/FunnelChart/FunnelChart.js +400 -0
  72. package/lib/components/FunnelChart/FunnelChart.js.map +1 -0
  73. package/lib/components/FunnelChart/FunnelChart.types.js +1 -0
  74. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -0
  75. package/lib/components/FunnelChart/funnelGeometry.js +220 -0
  76. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -0
  77. package/lib/components/FunnelChart/index.js +2 -0
  78. package/lib/components/FunnelChart/index.js.map +1 -0
  79. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +58 -0
  80. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
  81. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +51 -0
  82. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -0
  83. package/lib/components/GanttChart/GanttChart.js +547 -0
  84. package/lib/components/GanttChart/GanttChart.js.map +1 -0
  85. package/lib/components/GanttChart/GanttChart.types.js +4 -0
  86. package/lib/components/GanttChart/GanttChart.types.js.map +1 -0
  87. package/lib/components/GanttChart/index.js +2 -0
  88. package/lib/components/GanttChart/index.js.map +1 -0
  89. package/lib/components/GanttChart/useGanttChartStyles.styles.js +24 -0
  90. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -0
  91. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +23 -0
  92. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -0
  93. package/lib/components/GaugeChart/GaugeChart.js +9 -2
  94. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  95. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  96. package/lib/components/GaugeChart/index.js.map +1 -1
  97. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +1 -2
  98. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +142 -0
  99. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -0
  100. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +77 -60
  101. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  102. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  103. package/lib/components/GroupedVerticalBarChart/index.js.map +1 -1
  104. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  105. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +53 -0
  106. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -0
  107. package/lib/components/HeatMapChart/HeatMapChart.js +11 -3
  108. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  109. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  110. package/lib/components/HeatMapChart/index.js.map +1 -1
  111. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +1 -2
  112. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +38 -0
  113. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -0
  114. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +23 -26
  115. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  116. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +5 -3
  117. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  118. package/lib/components/HorizontalBarChart/index.js.map +1 -1
  119. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +1 -2
  120. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +120 -0
  121. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -0
  122. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +18 -5
  123. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  124. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  125. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -1
  126. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +1 -2
  127. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +39 -0
  128. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -0
  129. package/lib/components/Legends/Legends.js +28 -10
  130. package/lib/components/Legends/Legends.js.map +1 -1
  131. package/lib/components/Legends/Legends.types.js.map +1 -1
  132. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  133. package/lib/components/Legends/index.js.map +1 -1
  134. package/lib/components/Legends/shape.js +3 -3
  135. package/lib/components/Legends/shape.js.map +1 -1
  136. package/lib/components/Legends/useLegendsStyles.styles.js +57 -14
  137. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  138. package/lib/components/Legends/useLegendsStyles.styles.raw.js +138 -0
  139. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -0
  140. package/lib/components/LineChart/LineChart.js +23 -9
  141. package/lib/components/LineChart/LineChart.js.map +1 -1
  142. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  143. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  144. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  145. package/lib/components/LineChart/eventAnnotation/Textbox.js +2 -1
  146. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  147. package/lib/components/LineChart/index.js.map +1 -1
  148. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  149. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +52 -0
  150. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -0
  151. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  152. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
  153. package/lib/components/ResponsiveContainer/index.js.map +1 -1
  154. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +1 -2
  155. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +28 -0
  156. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -0
  157. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  158. package/lib/components/SankeyChart/SankeyChart.js +5 -1
  159. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  160. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  161. package/lib/components/SankeyChart/index.js.map +1 -1
  162. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
  163. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +77 -0
  164. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -0
  165. package/lib/components/ScatterChart/ScatterChart.js +19 -5
  166. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  167. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  168. package/lib/components/ScatterChart/index.js.map +1 -1
  169. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  170. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +43 -0
  171. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -0
  172. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  173. package/lib/components/Sparkline/Sparkline.types.js.map +1 -1
  174. package/lib/components/Sparkline/index.js.map +1 -1
  175. package/lib/components/Sparkline/useSparklineStyles.styles.js +1 -2
  176. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js +30 -0
  177. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -0
  178. package/lib/components/VerticalBarChart/VerticalBarChart.js +71 -31
  179. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  180. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  181. package/lib/components/VerticalBarChart/index.js.map +1 -1
  182. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  183. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +58 -0
  184. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -0
  185. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -12
  186. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  187. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  188. package/lib/components/VerticalStackedBarChart/index.js.map +1 -1
  189. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  190. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +49 -0
  191. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -0
  192. package/lib/index.js +2 -0
  193. package/lib/index.js.map +1 -1
  194. package/lib/types/DataPoint.js +3 -1
  195. package/lib/types/DataPoint.js.map +1 -1
  196. package/lib/types/EventAnnotation.js.map +1 -1
  197. package/lib/types/LegendDataItem.js.map +1 -1
  198. package/lib/types/index.js.map +1 -1
  199. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  200. package/lib/utilities/KeyCodes.js.map +1 -1
  201. package/lib/utilities/SVGTooltipText.js +2 -0
  202. package/lib/utilities/SVGTooltipText.js.map +1 -1
  203. package/lib/utilities/async-utils.js.map +1 -1
  204. package/lib/utilities/colors.js +12 -0
  205. package/lib/utilities/colors.js.map +1 -1
  206. package/lib/utilities/getWindow.js.map +1 -1
  207. package/lib/utilities/image-export-utils.js +256 -0
  208. package/lib/utilities/image-export-utils.js.map +1 -0
  209. package/lib/utilities/index.js.map +1 -1
  210. package/lib/utilities/overflow-utils.js.map +1 -1
  211. package/lib/utilities/string.js.map +1 -1
  212. package/lib/utilities/test-data.js +236 -0
  213. package/lib/utilities/test-data.js.map +1 -1
  214. package/lib/utilities/utilities.js +140 -27
  215. package/lib/utilities/utilities.js.map +1 -1
  216. package/lib/utilities/vbc-utils.js +2 -2
  217. package/lib/utilities/vbc-utils.js.map +1 -1
  218. package/lib-commonjs/AreaChart.js.map +1 -1
  219. package/lib-commonjs/CartesianChart.js.map +1 -1
  220. package/lib-commonjs/DeclarativeChart.js.map +1 -1
  221. package/lib-commonjs/DonutChart.js.map +1 -1
  222. package/lib-commonjs/FunnelChart.js +6 -0
  223. package/lib-commonjs/FunnelChart.js.map +1 -0
  224. package/lib-commonjs/GanttChart.js +6 -0
  225. package/lib-commonjs/GanttChart.js.map +1 -0
  226. package/lib-commonjs/GaugeChart.js.map +1 -1
  227. package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -1
  228. package/lib-commonjs/HeatMapChart.js.map +1 -1
  229. package/lib-commonjs/HorizontalBarChart.js.map +1 -1
  230. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -1
  231. package/lib-commonjs/Legends.js.map +1 -1
  232. package/lib-commonjs/LineChart.js.map +1 -1
  233. package/lib-commonjs/Popover.js.map +1 -1
  234. package/lib-commonjs/ResponsiveContainer.js.map +1 -1
  235. package/lib-commonjs/SankeyChart.js.map +1 -1
  236. package/lib-commonjs/ScatterChart.js.map +1 -1
  237. package/lib-commonjs/Sparkline.js.map +1 -1
  238. package/lib-commonjs/VerticalBarChart.js.map +1 -1
  239. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -1
  240. package/lib-commonjs/components/AreaChart/AreaChart.js +23 -7
  241. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  242. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -1
  243. package/lib-commonjs/components/AreaChart/index.js.map +1 -1
  244. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +1 -1
  245. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  246. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +57 -0
  247. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -0
  248. package/lib-commonjs/components/CommonComponents/CartesianChart.js +11 -7
  249. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  250. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  251. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  252. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  253. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  254. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +1 -1
  255. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  256. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +142 -0
  257. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -0
  258. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +1 -1
  259. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  260. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +140 -0
  261. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -0
  262. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +14 -6
  263. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  264. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +47 -13
  265. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  266. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +1 -0
  267. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
  268. package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -1
  269. package/lib-commonjs/components/DonutChart/Arc/Arc.js +5 -5
  270. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  271. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
  272. package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -1
  273. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +1 -1
  274. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  275. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +58 -0
  276. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -0
  277. package/lib-commonjs/components/DonutChart/DonutChart.js +17 -3
  278. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  279. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  280. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  281. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -1
  282. package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -1
  283. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +1 -1
  284. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
  285. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js +43 -0
  286. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -0
  287. package/lib-commonjs/components/DonutChart/index.js.map +1 -1
  288. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +1 -1
  289. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  290. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +59 -0
  291. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -0
  292. package/lib-commonjs/components/FunnelChart/FunnelChart.js +411 -0
  293. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -0
  294. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js +6 -0
  295. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -0
  296. package/lib-commonjs/components/FunnelChart/funnelGeometry.js +248 -0
  297. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -0
  298. package/lib-commonjs/components/FunnelChart/index.js +7 -0
  299. package/lib-commonjs/components/FunnelChart/index.js.map +1 -0
  300. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +79 -0
  301. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
  302. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +65 -0
  303. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -0
  304. package/lib-commonjs/components/GanttChart/GanttChart.js +558 -0
  305. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
  306. package/lib-commonjs/components/GanttChart/GanttChart.types.js +7 -0
  307. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
  308. package/lib-commonjs/components/GanttChart/index.js +7 -0
  309. package/lib-commonjs/components/GanttChart/index.js.map +1 -0
  310. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +39 -0
  311. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -0
  312. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +39 -0
  313. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -0
  314. package/lib-commonjs/components/GaugeChart/GaugeChart.js +9 -2
  315. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  316. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  317. package/lib-commonjs/components/GaugeChart/index.js.map +1 -1
  318. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +1 -1
  319. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  320. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +160 -0
  321. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -0
  322. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +77 -60
  323. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  324. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  325. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -1
  326. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -1
  327. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  328. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +69 -0
  329. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -0
  330. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +10 -2
  331. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  332. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  333. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -1
  334. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +1 -1
  335. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  336. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +56 -0
  337. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -0
  338. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +23 -26
  339. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  340. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +3 -3
  341. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  342. package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -1
  343. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +1 -1
  344. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  345. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +134 -0
  346. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -0
  347. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +18 -5
  348. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  349. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  350. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -1
  351. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +1 -1
  352. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  353. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +55 -0
  354. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -0
  355. package/lib-commonjs/components/Legends/Legends.js +28 -10
  356. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  357. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  358. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  359. package/lib-commonjs/components/Legends/index.js.map +1 -1
  360. package/lib-commonjs/components/Legends/shape.js +2 -2
  361. package/lib-commonjs/components/Legends/shape.js.map +1 -1
  362. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +101 -28
  363. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  364. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +174 -0
  365. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -0
  366. package/lib-commonjs/components/LineChart/LineChart.js +23 -9
  367. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  368. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  369. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  370. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  371. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +2 -1
  372. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  373. package/lib-commonjs/components/LineChart/index.js.map +1 -1
  374. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +1 -1
  375. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  376. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +66 -0
  377. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -0
  378. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  379. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
  380. package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -1
  381. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +1 -1
  382. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
  383. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +46 -0
  384. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -0
  385. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  386. package/lib-commonjs/components/SankeyChart/SankeyChart.js +5 -1
  387. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  388. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  389. package/lib-commonjs/components/SankeyChart/index.js.map +1 -1
  390. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +1 -1
  391. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  392. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +95 -0
  393. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -0
  394. package/lib-commonjs/components/ScatterChart/ScatterChart.js +18 -4
  395. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  396. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  397. package/lib-commonjs/components/ScatterChart/index.js.map +1 -1
  398. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +1 -1
  399. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  400. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +57 -0
  401. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -0
  402. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  403. package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -1
  404. package/lib-commonjs/components/Sparkline/index.js.map +1 -1
  405. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +1 -1
  406. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
  407. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js +44 -0
  408. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -0
  409. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +71 -31
  410. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  411. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  412. package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -1
  413. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -1
  414. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  415. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +74 -0
  416. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -0
  417. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -12
  418. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  419. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  420. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -1
  421. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -1
  422. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  423. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +67 -0
  424. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -0
  425. package/lib-commonjs/index.js +2 -0
  426. package/lib-commonjs/index.js.map +1 -1
  427. package/lib-commonjs/types/DataPoint.js +3 -1
  428. package/lib-commonjs/types/DataPoint.js.map +1 -1
  429. package/lib-commonjs/types/EventAnnotation.js.map +1 -1
  430. package/lib-commonjs/types/LegendDataItem.js.map +1 -1
  431. package/lib-commonjs/types/index.js.map +1 -1
  432. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  433. package/lib-commonjs/utilities/KeyCodes.js.map +1 -1
  434. package/lib-commonjs/utilities/SVGTooltipText.js +2 -0
  435. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  436. package/lib-commonjs/utilities/async-utils.js.map +1 -1
  437. package/lib-commonjs/utilities/colors.js +18 -0
  438. package/lib-commonjs/utilities/colors.js.map +1 -1
  439. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  440. package/lib-commonjs/utilities/image-export-utils.js +274 -0
  441. package/lib-commonjs/utilities/image-export-utils.js.map +1 -0
  442. package/lib-commonjs/utilities/index.js.map +1 -1
  443. package/lib-commonjs/utilities/overflow-utils.js.map +1 -1
  444. package/lib-commonjs/utilities/string.js.map +1 -1
  445. package/lib-commonjs/utilities/test-data.js +245 -0
  446. package/lib-commonjs/utilities/test-data.js.map +1 -1
  447. package/lib-commonjs/utilities/utilities.js +142 -22
  448. package/lib-commonjs/utilities/utilities.js.map +1 -1
  449. package/lib-commonjs/utilities/vbc-utils.js +2 -2
  450. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  451. package/package.json +12 -22
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ useVerticalStackedBarChartStyles: function() {
13
+ return useVerticalStackedBarChartStyles;
14
+ },
15
+ verticalstackedbarchartClassNames: function() {
16
+ return verticalstackedbarchartClassNames;
17
+ }
18
+ });
19
+ const _react = require("@griffel/react");
20
+ const _reacttheme = require("@fluentui/react-theme");
21
+ const verticalstackedbarchartClassNames = {
22
+ opacityChangeOnHover: 'fui-vsbc__opacityChangeOnHover',
23
+ tooltip: 'fui-vsbc__tooltip',
24
+ barLabel: 'fui-vsbc__barLabel',
25
+ root: '',
26
+ xAxis: '',
27
+ yAxis: '',
28
+ legendContainer: '',
29
+ hover: '',
30
+ descriptionMessage: '',
31
+ axisTitle: '',
32
+ chartTitle: '',
33
+ shapeStyles: '',
34
+ chartWrapper: '',
35
+ svgTooltip: '',
36
+ chart: ''
37
+ };
38
+ const useStyles = (0, _react.makeStyles)({
39
+ opacityChangeOnHover: {
40
+ cursor: 'default'
41
+ },
42
+ tooltip: {
43
+ ..._reacttheme.typographyStyles.body1,
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ ..._react.shorthands.padding(_reacttheme.tokens.spacingHorizontalS),
47
+ position: 'absolute',
48
+ textAlign: 'center',
49
+ top: _reacttheme.tokens.spacingVerticalNone,
50
+ fill: _reacttheme.tokens.colorNeutralBackground1,
51
+ borderRadius: _reacttheme.tokens.borderRadiusSmall,
52
+ pointerEvents: 'none'
53
+ },
54
+ barLabel: {
55
+ ..._reacttheme.typographyStyles.caption1Strong,
56
+ fill: _reacttheme.tokens.colorNeutralForeground1,
57
+ forcedColorAdjust: 'auto'
58
+ }
59
+ });
60
+ const useVerticalStackedBarChartStyles = (props)=>{
61
+ const baseStyles = useStyles();
62
+ return {
63
+ opacityChangeOnHover: (0, _react.mergeClasses)(verticalstackedbarchartClassNames.opacityChangeOnHover, baseStyles.opacityChangeOnHover, props.href ? 'pointer' : 'default'),
64
+ tooltip: (0, _react.mergeClasses)(verticalstackedbarchartClassNames.tooltip, baseStyles.tooltip),
65
+ barLabel: (0, _react.mergeClasses)(verticalstackedbarchartClassNames.barLabel, baseStyles.barLabel)
66
+ };
67
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { VerticalStackedBarChartProps, VerticalStackedBarChartStyles } from './VerticalStackedBarChart.types';\nimport { SlotClassNames } from '@fluentui/react-utilities/src/index';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const verticalstackedbarchartClassNames: SlotClassNames<VerticalStackedBarChartStyles> = {\n opacityChangeOnHover: 'fui-vsbc__opacityChangeOnHover',\n tooltip: 'fui-vsbc__tooltip',\n barLabel: 'fui-vsbc__barLabel',\n root: '',\n xAxis: '',\n yAxis: '',\n legendContainer: '',\n hover: '',\n descriptionMessage: '',\n axisTitle: '',\n chartTitle: '',\n shapeStyles: '',\n chartWrapper: '',\n svgTooltip: '',\n chart: '',\n};\n\nconst useStyles = makeStyles({\n opacityChangeOnHover: {\n cursor: 'default',\n },\n tooltip: {\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.padding(tokens.spacingHorizontalS),\n position: 'absolute',\n textAlign: 'center',\n top: tokens.spacingVerticalNone,\n fill: tokens.colorNeutralBackground1,\n borderRadius: tokens.borderRadiusSmall,\n pointerEvents: 'none',\n },\n barLabel: {\n ...typographyStyles.caption1Strong,\n fill: tokens.colorNeutralForeground1,\n forcedColorAdjust: 'auto',\n },\n});\n\nexport const useVerticalStackedBarChartStyles = (\n props: VerticalStackedBarChartProps,\n): VerticalStackedBarChartStyles => {\n const baseStyles = useStyles();\n\n return {\n opacityChangeOnHover: mergeClasses(\n verticalstackedbarchartClassNames.opacityChangeOnHover,\n baseStyles.opacityChangeOnHover,\n props.href ? 'pointer' : 'default',\n ),\n tooltip: mergeClasses(verticalstackedbarchartClassNames.tooltip, baseStyles.tooltip),\n barLabel: mergeClasses(verticalstackedbarchartClassNames.barLabel, baseStyles.barLabel),\n };\n};\n"],"names":["makeStyles","mergeClasses","shorthands","tokens","typographyStyles","verticalstackedbarchartClassNames","opacityChangeOnHover","tooltip","barLabel","root","xAxis","yAxis","legendContainer","hover","descriptionMessage","axisTitle","chartTitle","shapeStyles","chartWrapper","svgTooltip","chart","useStyles","cursor","body1","display","flexDirection","padding","spacingHorizontalS","position","textAlign","top","spacingVerticalNone","fill","colorNeutralBackground1","borderRadius","borderRadiusSmall","pointerEvents","caption1Strong","colorNeutralForeground1","forcedColorAdjust","useVerticalStackedBarChartStyles","props","baseStyles","href"],"mappings":";;;;;;;;;;;oCA8CawC;;;IAzCAnC,iCAAAA;;;;uBALwC,iBAAiB;4BAG7B,wBAAwB;AAE1D,0CAAyF;IAC9FC,sBAAsB;IACtBC,SAAS;IACTC,UAAU;IACVC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,iBAAiB;IACjBC,OAAO;IACPC,oBAAoB;IACpBC,WAAW;IACXC,YAAY;IACZC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC,OAAO;AACT,EAAE;AAEF,MAAMC,gBAAYrB,iBAAAA,EAAW;IAC3BM,sBAAsB;QACpBgB,QAAQ;IACV;IACAf,SAAS;QACP,GAAGH,4BAAAA,CAAiBmB,KAAK;QACzBC,SAAS;QACTC,eAAe;QACf,GAAGvB,iBAAAA,CAAWwB,OAAO,CAACvB,kBAAAA,CAAOwB,kBAAkB,CAAC;QAChDC,UAAU;QACVC,WAAW;QACXC,KAAK3B,kBAAAA,CAAO4B,mBAAmB;QAC/BC,MAAM7B,kBAAAA,CAAO8B,uBAAuB;QACpCC,cAAc/B,kBAAAA,CAAOgC,iBAAiB;QACtCC,eAAe;IACjB;IACA5B,UAAU;QACR,GAAGJ,4BAAAA,CAAiBiC,cAAc;QAClCL,MAAM7B,kBAAAA,CAAOmC,uBAAuB;QACpCC,mBAAmB;IACrB;AACF;AAEO,MAAMC,mCAAmC,CAC9CC;IAEA,MAAMC,aAAarB;IAEnB,OAAO;QACLf,0BAAsBL,mBAAAA,EACpBI,kCAAkCC,oBAAoB,EACtDoC,WAAWpC,oBAAoB,EAC/BmC,MAAME,IAAI,GAAG,YAAY;QAE3BpC,aAASN,mBAAAA,EAAaI,kCAAkCE,OAAO,EAAEmC,WAAWnC,OAAO;QACnFC,cAAUP,mBAAAA,EAAaI,kCAAkCG,QAAQ,EAAEkC,WAAWlC,QAAQ;IACxF;AACF,EAAE"}
@@ -23,3 +23,5 @@ _export_star._(require("./AreaChart"), exports);
23
23
  _export_star._(require("./HorizontalBarChartWithAxis"), exports);
24
24
  _export_star._(require("./HeatMapChart"), exports);
25
25
  _export_star._(require("./SankeyChart"), exports);
26
+ _export_star._(require("./FunnelChart"), exports);
27
+ _export_star._(require("./GanttChart"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './VerticalBarChart';\nexport * from './VerticalStackedBarChart';\nexport * from './GroupedVerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './Sparkline';\nexport * from './ScatterChart';\nexport * from './GaugeChart';\nexport * from './utilities/colors';\nexport * from './Popover';\nexport * from './ResponsiveContainer';\nexport * from './DeclarativeChart';\nexport * from './AreaChart';\nexport * from './HorizontalBarChartWithAxis';\nexport * from './HeatMapChart';\nexport * from './SankeyChart';\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './VerticalBarChart';\nexport * from './VerticalStackedBarChart';\nexport * from './GroupedVerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './Sparkline';\nexport * from './ScatterChart';\nexport * from './GaugeChart';\nexport * from './utilities/colors';\nexport * from './Popover';\nexport * from './ResponsiveContainer';\nexport * from './DeclarativeChart';\nexport * from './AreaChart';\nexport * from './HorizontalBarChartWithAxis';\nexport * from './HeatMapChart';\nexport * from './SankeyChart';\nexport * from './FunnelChart';\nexport * from './GanttChart';\n"],"names":[],"mappings":";;;;;uBAAc,uBAAuB;uBACvB,eAAe;uBACf,YAAY;uBACZ,cAAc;uBACd,qBAAqB;uBACrB,4BAA4B;uBAC5B,4BAA4B;uBAC5B,mBAAmB;uBACnB,gBAAgB;uBAChB,cAAc;uBACd,iBAAiB;uBACjB,eAAe;uBACf,qBAAqB;uBACrB,YAAY;uBACZ,wBAAwB;uBACxB,qBAAqB;uBACrB,cAAc;uBACd,+BAA+B;uBAC/B,iBAAiB;uBACjB,gBAAgB;uBAChB,gBAAgB;uBAChB,eAAe"}
@@ -1,4 +1,6 @@
1
- "use strict";
1
+ /**
2
+ * {@docCategory IChartData}
3
+ */ "use strict";
2
4
  Object.defineProperty(exports, "__esModule", {
3
5
  value: true
4
6
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface Basestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface DataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: HorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: LineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\ninterface BaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory ChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface ScatterChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface LineChartLineOptions extends SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: LineChartDataPoint[] | ScatterChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: SankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface AccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\n y: number;\n color: string;\n legend: string;\n /**\n * Data to show in callout\n */\n data?: number;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color: string;\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface GVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n}\n\nexport interface HeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: HeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface SankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface SNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface SLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n}\n\nexport type SNode = SankeyNode<SNodeExtra, SLinkExtra>;\nexport type SLink = SankeyLink<SNodeExtra, SLinkExtra>;\n"],"names":[],"rangeMappings":"","mappings":""}
1
+ {"version":3,"sources":["../src/types/DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface Basestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface DataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: HorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: LineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\ninterface BaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory ChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface ScatterChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface LineChartLineOptions extends SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: LineChartDataPoint[] | ScatterChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: SankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface AccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\n y: number;\n color: string;\n legend: string;\n /**\n * Data to show in callout\n */\n data?: number;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color: string;\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface GVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n toImage?: (opts?: ImageExportOptions) => Promise<string>;\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport interface HeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: HeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface SankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface SNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface SLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n}\n\nexport type SNode = SankeyNode<SNodeExtra, SLinkExtra>;\nexport type SLink = SankeyLink<SNodeExtra, SLinkExtra>;\n\n/**\n * Specifies the ordering options for axis categories in Cartesian charts.\n *\n * - `'default'`: Uses the original order before custom ordering was supported.\n * In some charts, this behaves the same as `'data'`.\n * - `'data'`: Preserves the order of categories as provided in the input data.\n * - `string[]`: Explicitly defines the custom order of categories as an array of category names.\n * - `'category ascending' | 'category descending'`: Orders categories alphanumerically.\n * - `'total ascending' | 'total descending'`: Orders categories by the total of their associated values.\n * - `'min ascending' | 'min descending'`: Orders by the minimum value within each category.\n * - `'max ascending' | 'max descending'`: Orders by the maximum value within each category.\n * - `'sum ascending' | 'sum descending'`: Orders by the sum of values for each category (same as 'total').\n * - `'mean ascending' | 'mean descending'`: Orders by the average of values in each category.\n * - `'median ascending' | 'median descending'`: Orders by the median value of each category.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisCategoryOrder =\n | 'default'\n | 'data'\n | string[]\n | 'category ascending'\n | 'category descending'\n | 'total ascending'\n | 'total descending'\n | 'min ascending'\n | 'min descending'\n | 'max ascending'\n | 'max descending'\n | 'sum ascending'\n | 'sum descending'\n | 'mean ascending'\n | 'mean descending'\n | 'median ascending'\n | 'median descending';\n\n/**\n * {@docCategory IChartData}\n */\nexport interface GanttChartDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: {\n start: Date | number;\n end: Date | number;\n };\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n"],"names":[],"mappings":"AA03BA;;CAEC,GACD,WAqDC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["EventAnnotation.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface EventAnnotation {\n date: Date;\n event: string;\n onRenderCard?: () => React.ReactNode;\n}\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
1
+ {"version":3,"sources":["../src/types/EventAnnotation.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface EventAnnotation {\n date: Date;\n event: string;\n onRenderCard?: () => React.ReactNode;\n}\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["LegendDataItem.ts"],"sourcesContent":["export interface LegendDataItem {\n /**\n * Text to be displayed for legend item.\n */\n legendText: string | number;\n\n /**\n * Color for the specific legend\n */\n legendColor: string;\n}\n"],"names":[],"rangeMappings":"","mappings":""}
1
+ {"version":3,"sources":["../src/types/LegendDataItem.ts"],"sourcesContent":["export interface LegendDataItem {\n /**\n * Text to be displayed for legend item.\n */\n legendText: string | number;\n\n /**\n * Color for the specific legend\n */\n legendColor: string;\n}\n"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './DataPoint';\nexport * from './LegendDataItem';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
1
+ {"version":3,"sources":["../src/types/index.ts"],"sourcesContent":["export * from './DataPoint';\nexport * from './LegendDataItem';\n"],"names":[],"mappings":";;;;;uBAAc,cAAc;uBACd,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["FocusableTooltipText.tsx"],"sourcesContent":["/* eslint-disable no-restricted-globals */\nimport * as React from 'react';\nimport { useCallback, useState, useEffect, useRef } from 'react';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { hasOverflow } from './overflow-utils';\nimport { getAccessibleDataObject } from './index';\nimport { AccessibilityProps } from '../types/index';\nimport { Async } from './async-utils';\n\ninterface IFocusableTooltipTextProps {\n className?: string;\n content: string | JSX.Element | JSX.Element[];\n accessibilityData?: AccessibilityProps;\n}\n\nexport const FocusableTooltipText: React.FunctionComponent<IFocusableTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n IFocusableTooltipTextProps\n>((props, forwardedRef) => {\n const [textOverflow, setTextOverflow] = useState(false);\n const tooltipChild = useRef<HTMLSpanElement>(null);\n const async = useRef(new Async()).current;\n const resizeObserver = useRef<ResizeObserver>();\n\n const getTargetElement = useCallback((): HTMLElement | undefined => {\n if (!tooltipChild.current || !tooltipChild.current.parentElement) {\n return undefined;\n }\n return tooltipChild.current.parentElement;\n }, [tooltipChild]);\n\n const checkTextOverflow = useCallback(() => {\n const overflowElement = getTargetElement();\n const isTextOverflow = !!overflowElement && hasOverflow(overflowElement);\n if (isTextOverflow !== textOverflow) {\n setTextOverflow(isTextOverflow);\n }\n }, [getTargetElement, textOverflow, setTextOverflow]);\n\n useEffect(() => {\n checkTextOverflow();\n }, [checkTextOverflow]);\n\n useEffect(() => {\n // setup part executed only when the component mounts/updates\n const overflowElement = getTargetElement();\n if (window.ResizeObserver && overflowElement) {\n resizeObserver.current = new window.ResizeObserver(async.debounce(checkTextOverflow, 500));\n resizeObserver.current.observe(overflowElement);\n }\n // cleanup part executed only when the component unmounts\n return () => {\n resizeObserver.current?.disconnect();\n async.dispose();\n };\n }, [async, checkTextOverflow, getTargetElement]);\n\n return (\n <div className={props.className}>\n <Tooltip content={props.content} relationship=\"description\">\n <span {...getAccessibleDataObject(props.accessibilityData)} ref={tooltipChild} data-is-focusable={textOverflow}>\n {props.content}\n </span>\n </Tooltip>\n </div>\n );\n});\n"],"names":["FocusableTooltipText","React","forwardRef","props","forwardedRef","textOverflow","setTextOverflow","useState","tooltipChild","useRef","async","Async","current","resizeObserver","getTargetElement","useCallback","parentElement","undefined","checkTextOverflow","overflowElement","isTextOverflow","hasOverflow","useEffect","window","ResizeObserver","debounce","observe","disconnect","dispose","createElement","div","className","Tooltip","content","relationship","span","getAccessibleDataObject","accessibilityData","ref","data-is-focusable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,wCAAwC;;;;+BAe3BA;;;eAAAA;;;;iEAdU;8BAEC;+BACI;uBACY;4BAElB;AAQf,MAAMA,uBAAAA,WAAAA,GAA4EC,OAAMC,UAAU,CAGvG,CAACC,OAAOC;IACR,MAAM,CAACC,cAAcC,gBAAgB,GAAGC,IAAAA,eAAAA,EAAS;IACjD,MAAMC,eAAeC,IAAAA,aAAAA,EAAwB;IAC7C,MAAMC,QAAQD,IAAAA,aAAAA,EAAO,IAAIE,iBAAAA,IAASC,OAAO;IACzC,MAAMC,iBAAiBJ,IAAAA,aAAAA;IAEvB,MAAMK,mBAAmBC,IAAAA,kBAAAA,EAAY;QACnC,IAAI,CAACP,aAAaI,OAAO,IAAI,CAACJ,aAAaI,OAAO,CAACI,aAAa,EAAE;YAChE,OAAOC;QACT;QACA,OAAOT,aAAaI,OAAO,CAACI,aAAa;IAC3C,GAAG;QAACR;KAAa;IAEjB,MAAMU,oBAAoBH,IAAAA,kBAAAA,EAAY;QACpC,MAAMI,kBAAkBL;QACxB,MAAMM,iBAAiB,CAAC,CAACD,mBAAmBE,IAAAA,0BAAAA,EAAYF;QACxD,IAAIC,mBAAmBf,cAAc;YACnCC,gBAAgBc;QAClB;IACF,GAAG;QAACN;QAAkBT;QAAcC;KAAgB;IAEpDgB,IAAAA,gBAAAA,EAAU;QACRJ;IACF,GAAG;QAACA;KAAkB;IAEtBI,IAAAA,gBAAAA,EAAU;QACR,6DAA6D;QAC7D,MAAMH,kBAAkBL;QACxB,IAAIS,OAAOC,cAAc,IAAIL,iBAAiB;YAC5CN,eAAeD,OAAO,GAAG,IAAIW,OAAOC,cAAc,CAACd,MAAMe,QAAQ,CAACP,mBAAmB;YACrFL,eAAeD,OAAO,CAACc,OAAO,CAACP;QACjC;QACA,yDAAyD;QACzD,OAAO;gBACLN;YAAAA,CAAAA,0BAAAA,eAAeD,OAAO,AAAPA,MAAO,QAAtBC,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAwBc,UAAU;YAClCjB,MAAMkB,OAAO;QACf;IACF,GAAG;QAAClB;QAAOQ;QAAmBJ;KAAiB;IAE/C,OAAA,WAAA,GACEb,OAAA4B,aAAA,CAACC,OAAAA;QAAIC,WAAW5B,MAAM4B,SAAS;qBAC7B9B,OAAA4B,aAAA,CAACG,qBAAAA,EAAAA;QAAQC,SAAS9B,MAAM8B,OAAO;QAAEC,cAAa;qBAC5CjC,OAAA4B,aAAA,CAACM,QAAAA;QAAM,GAAGC,IAAAA,8BAAAA,EAAwBjC,MAAMkC,iBAAiB,CAAC;QAAEC,KAAK9B;QAAc+B,qBAAmBlC;OAC/FF,MAAM8B,OAAO;AAKxB"}
1
+ {"version":3,"sources":["../src/utilities/FocusableTooltipText.tsx"],"sourcesContent":["/* eslint-disable no-restricted-globals */\nimport * as React from 'react';\nimport { useCallback, useState, useEffect, useRef } from 'react';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { hasOverflow } from './overflow-utils';\nimport { getAccessibleDataObject } from './index';\nimport { AccessibilityProps } from '../types/index';\nimport { Async } from './async-utils';\n\ninterface IFocusableTooltipTextProps {\n className?: string;\n content:\n | string\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | JSX.Element\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | JSX.Element[];\n accessibilityData?: AccessibilityProps;\n}\n\nexport const FocusableTooltipText: React.FunctionComponent<IFocusableTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n IFocusableTooltipTextProps\n>((props, forwardedRef) => {\n const [textOverflow, setTextOverflow] = useState(false);\n const tooltipChild = useRef<HTMLSpanElement>(null);\n const async = useRef(new Async()).current;\n const resizeObserver = useRef<ResizeObserver>();\n\n const getTargetElement = useCallback((): HTMLElement | undefined => {\n if (!tooltipChild.current || !tooltipChild.current.parentElement) {\n return undefined;\n }\n return tooltipChild.current.parentElement;\n }, [tooltipChild]);\n\n const checkTextOverflow = useCallback(() => {\n const overflowElement = getTargetElement();\n const isTextOverflow = !!overflowElement && hasOverflow(overflowElement);\n if (isTextOverflow !== textOverflow) {\n setTextOverflow(isTextOverflow);\n }\n }, [getTargetElement, textOverflow, setTextOverflow]);\n\n useEffect(() => {\n checkTextOverflow();\n }, [checkTextOverflow]);\n\n useEffect(() => {\n // setup part executed only when the component mounts/updates\n const overflowElement = getTargetElement();\n if (window.ResizeObserver && overflowElement) {\n resizeObserver.current = new window.ResizeObserver(async.debounce(checkTextOverflow, 500));\n resizeObserver.current.observe(overflowElement);\n }\n // cleanup part executed only when the component unmounts\n return () => {\n resizeObserver.current?.disconnect();\n async.dispose();\n };\n }, [async, checkTextOverflow, getTargetElement]);\n\n return (\n <div className={props.className}>\n <Tooltip content={props.content} relationship=\"description\">\n <span {...getAccessibleDataObject(props.accessibilityData)} ref={tooltipChild} data-is-focusable={textOverflow}>\n {props.content}\n </span>\n </Tooltip>\n </div>\n );\n});\n"],"names":["React","useCallback","useState","useEffect","useRef","Tooltip","hasOverflow","getAccessibleDataObject","Async","FocusableTooltipText","forwardRef","props","forwardedRef","textOverflow","setTextOverflow","tooltipChild","async","current","resizeObserver","getTargetElement","parentElement","undefined","checkTextOverflow","overflowElement","isTextOverflow","window","ResizeObserver","debounce","observe","disconnect","dispose","div","className","content","relationship","span","accessibilityData","ref","data-is-focusable"],"mappings":"AAAA,wCAAwC,GACxC,YAAYA;;;;+BAmBCS;;;;;;;iEAnBU,QAAQ;8BAEP,0BAA0B;+BACtB,mBAAmB;uBACP,UAAU;4BAE5B,gBAAgB;AAa/B,6BAAMA,WAAAA,GAA4ET,OAAMU,UAAU,CAGvG,CAACC,OAAOC;IACR,MAAM,CAACC,cAAcC,gBAAgB,OAAGZ,eAAAA,EAAS;IACjD,MAAMa,mBAAeX,aAAAA,EAAwB;IAC7C,MAAMY,YAAQZ,aAAAA,EAAO,IAAII,iBAAAA,IAASS,OAAO;IACzC,MAAMC,qBAAiBd,aAAAA;IAEvB,MAAMe,uBAAmBlB,kBAAAA,EAAY;QACnC,IAAI,CAACc,aAAaE,OAAO,IAAI,CAACF,aAAaE,OAAO,CAACG,aAAa,EAAE;YAChE,OAAOC;QACT;QACA,OAAON,aAAaE,OAAO,CAACG,aAAa;IAC3C,GAAG;QAACL;KAAa;IAEjB,MAAMO,wBAAoBrB,kBAAAA,EAAY;QACpC,MAAMsB,kBAAkBJ;QACxB,MAAMK,iBAAiB,CAAC,CAACD,uBAAmBjB,0BAAAA,EAAYiB;QACxD,IAAIC,mBAAmBX,cAAc;YACnCC,gBAAgBU;QAClB;IACF,GAAG;QAACL;QAAkBN;QAAcC;KAAgB;QAEpDX,gBAAAA,EAAU;QACRmB;IACF,GAAG;QAACA;KAAkB;QAEtBnB,gBAAAA,EAAU;QACR,6DAA6D;QAC7D,MAAMoB,kBAAkBJ;QACxB,IAAIM,OAAOC,cAAc,IAAIH,iBAAiB;YAC5CL,eAAeD,OAAO,GAAG,IAAIQ,OAAOC,cAAc,CAACV,MAAMW,QAAQ,CAACL,mBAAmB;YACrFJ,eAAeD,OAAO,CAACW,OAAO,CAACL;QACjC;QACA,yDAAyD;QACzD,OAAO;gBACLL;aAAAA,0BAAAA,eAAeD,OAAAA,AAAO,MAAA,QAAtBC,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAwBW,UAAU;YAClCb,MAAMc,OAAO;QACf;IACF,GAAG;QAACd;QAAOM;QAAmBH;KAAiB;IAE/C,OAAA,WAAA,GACE,OAAA,aAAA,CAACY,OAAAA;QAAIC,WAAWrB,MAAMqB,SAAS;qBAC7B,OAAA,aAAA,CAAC3B,qBAAAA,EAAAA;QAAQ4B,SAAStB,MAAMsB,OAAO;QAAEC,cAAa;qBAC5C,OAAA,aAAA,CAACC,QAAAA;QAAM,OAAG5B,8BAAAA,EAAwBI,MAAMyB,iBAAiB,CAAC;QAAEC,KAAKtB;QAAcuB,qBAAmBzB;OAC/FF,MAAMsB,OAAO;AAKxB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["KeyCodes.ts"],"sourcesContent":["/**\n * Simulated enum for keycodes. These will get inlined by uglify when used much like an enum\n *\n * @public\n * {@docCategory KeyCodes}\n */\nexport const KeyCodes = {\n escape: 27 as 27,\n};\nexport type KeyCodes = number;\n"],"names":["KeyCodes","escape"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,WAAW;IACtBC,QAAQ;AACV"}
1
+ {"version":3,"sources":["../src/utilities/KeyCodes.ts"],"sourcesContent":["/**\n * Simulated enum for keycodes. These will get inlined by uglify when used much like an enum\n *\n * @public\n * {@docCategory KeyCodes}\n */\nexport const KeyCodes = {\n escape: 27 as 27,\n};\nexport type KeyCodes = number;\n"],"names":["KeyCodes","escape"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;AAAO,MAAMA,WAAW;IACtBC,QAAQ;AACV,EAAE"}
@@ -143,6 +143,7 @@ const SVGTooltipText = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
143
143
  async
144
144
  ]);
145
145
  const onTooltipKeyDown = (0, _react.useCallback)((ev)=>{
146
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
146
147
  if ((ev.which === _KeyCodes.KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {
147
148
  hideTooltip();
148
149
  ev.stopPropagation();
@@ -180,6 +181,7 @@ const SVGTooltipText = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
180
181
  "data-is-focusable": props.shouldReceiveFocus && isOverflowing
181
182
  }, props.content)));
182
183
  });
184
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
183
185
  SVGTooltipText.defaultProps = {
184
186
  delay: 0,
185
187
  showBackground: false
@@ -1 +1 @@
1
- {"version":3,"sources":["SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n showBackground?: boolean;\n className?: string;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [textWidth, setTextWidth] = useState(0);\n const [textHeight, setTextHeight] = useState(0);\n\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n const PADDING = 3;\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight)\n // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n const measureText = useCallback((): void => {\n if (tooltipHostRef.current && typeof tooltipHostRef.current.getBBox === 'function') {\n const bbox = tooltipHostRef.current.getBBox();\n setTextWidth(bbox.width);\n setTextHeight(bbox.height);\n }\n }, []);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n useEffect(() => {\n if (isTooltipVisible) {\n measureText();\n }\n }, [isTooltipVisible, measureText]);\n\n useEffect(() => {\n // Recalculate text dimensions when content or dimensions change\n measureText();\n }, [props.content, props.textProps, props.maxWidth, props.maxHeight, measureText]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n const rectX = (typeof props.textProps?.x === 'number' ? props.textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof props.textProps?.y === 'number' ? props.textProps.y : 0) - (textHeight ?? 0) / 2 - 2 * PADDING;\n\n return (\n <>\n {props.showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + PADDING}\n transform={props.textProps?.transform}\n className={props.className}\n />\n )}\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n\nSVGTooltipText.defaultProps = {\n delay: 0,\n showBackground: false,\n};\n"],"names":["SVGTooltipText","React","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","useState","isOverflowing","setIsOverflowing","textWidth","setTextWidth","textHeight","setTextHeight","tooltipHostRef","useRef","async","Async","current","dismissTimerId","openTimerId","tooltipHostId","useId","ignoreNextFocusEvent","portalMountNode","usePortalMountNode","PADDING","wrapContentCallback","useCallback","content","wrapContent","maxWidth","maxHeight","measureText","getBBox","bbox","width","height","useEffect","dispose","textProps","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","KeyCodes","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","rectX","x","rectY","y","createElement","Fragment","showBackground","rect","transform","className","Tooltip","relationship","tooltipProps","withArrow","visible","text","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;qCAEY;8BACX;4BACF;0BACG;gCACH;AAiBf,MAAMA,iBAAAA,WAAAA,GAA+DC,OAAMC,UAAU,CAG1F,CAACC,OAAOC;QA0IcD,kBACAA,mBAUHA;IApJnB,MAAM,CAACE,kBAAkBC,oBAAoB,GAAGC,IAAAA,eAAAA,EAAS;IACzD,MAAM,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E,gBAAgB9B;QAChB+B,eAAe9B;QACf+B,cAAcxC;QACdyC,cAAcnC;QACdoC,WAAW9B;QACX+B,qBAAmBnF,MAAMoF,kBAAkB,IAAI/E;OAE9CL,MAAM0B,OAAO;AAKxB;AAEA7B,eAAewF,YAAY,GAAG;IAC5BzC,OAAO;IACPsB,gBAAgB;AAClB"}
1
+ {"version":3,"sources":["../src/utilities/SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n showBackground?: boolean;\n className?: string;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [textWidth, setTextWidth] = useState(0);\n const [textHeight, setTextHeight] = useState(0);\n\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n const PADDING = 3;\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight)\n // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n const measureText = useCallback((): void => {\n if (tooltipHostRef.current && typeof tooltipHostRef.current.getBBox === 'function') {\n const bbox = tooltipHostRef.current.getBBox();\n setTextWidth(bbox.width);\n setTextHeight(bbox.height);\n }\n }, []);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n useEffect(() => {\n if (isTooltipVisible) {\n measureText();\n }\n }, [isTooltipVisible, measureText]);\n\n useEffect(() => {\n // Recalculate text dimensions when content or dimensions change\n measureText();\n }, [props.content, props.textProps, props.maxWidth, props.maxHeight, measureText]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n const rectX = (typeof props.textProps?.x === 'number' ? props.textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof props.textProps?.y === 'number' ? props.textProps.y : 0) - (textHeight ?? 0) / 2 - 2 * PADDING;\n\n return (\n <>\n {props.showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + PADDING}\n transform={props.textProps?.transform}\n className={props.className}\n />\n )}\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nSVGTooltipText.defaultProps = {\n delay: 0,\n showBackground: false,\n};\n"],"names":["React","useState","useRef","useEffect","useCallback","usePortalMountNode","Tooltip","Async","KeyCodes","useId","SVGTooltipText","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","isOverflowing","setIsOverflowing","textWidth","setTextWidth","textHeight","setTextHeight","tooltipHostRef","async","current","dismissTimerId","openTimerId","tooltipHostId","ignoreNextFocusEvent","portalMountNode","PADDING","wrapContentCallback","content","wrapContent","maxWidth","maxHeight","measureText","getBBox","bbox","width","height","dispose","textProps","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","rectX","x","rectY","y","showBackground","rect","transform","className","relationship","tooltipProps","withArrow","visible","text","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"mappings":";;;;+BAuBaU;;;;;;;iEAvBU,QAAQ;qCAEI,kCAAkC;8BAC7C,0BAA0B;4BAC5B,gBAAgB;0BACb,aAAa;gCAChB,4BAA4B;AAiB3C,uBAAMA,WAAAA,GAA+DV,OAAMW,UAAU,CAG1F,CAACC,OAAOC;QA2IcD,kBACAA,mBAUHA;IArJnB,MAAM,CAACE,kBAAkBC,oBAAoB,OAAGd,eAAAA,EAAS;IACzD,MAAM,CAACe,eAAeC,iBAAiB,OAAGhB,eAAAA,EAAS;IACnD,MAAM,CAACiB,WAAWC,aAAa,OAAGlB,eAAAA,EAAS;IAC3C,MAAM,CAACmB,YAAYC,cAAc,OAAGpB,eAAAA,EAAS;IAE7C,MAAMqB,qBAAiBpB,aAAAA,EAAuB;IAC9C,MAAMqB,YAAQrB,aAAAA,EAAO,IAAIK,iBAAAA,IAASiB,OAAO;IACzC,MAAMC,qBAAiBvB,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AIU;IAE7G,OAAA,WAAA,GACE,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MACGlB,MAAMwD,cAAc,IAAA,WAAA,GACnB,OAAA,aAAA,CAACC,QAAAA;QACCJ,GAAGD;QACHG,GAAGD;QACH3B,OAAQrB,CAAAA,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,aAAa,CAAA,GAAK,IAAIY;QAC9BU,QAASpB,CAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,cAAc,CAAA,GAAKU;QAC5BwC,SAAS,EAAA,CAAE1D,oBAAAA,MAAM8B,SAAAA,AAAS,MAAA,QAAf9B,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAiB0D,SAAS;QACrCC,WAAW3D,MAAM2D,SAAS;sBAG9B,OAAA,aAAA,CAACjE,qBAAAA,EAAAA;QACCkE,cAAa;QACZ,GAAG5D,MAAM6D,YAAY;QACtBC,WAAAA;QACA1C,SAASpB,MAAMoB,OAAO;QACtB,yGAAyG;QACzG2C,SAASb;qBAET,OAAA,aAAA,CAACc,QAAAA;QACE,GAAGhE,MAAM8B,SAAS;QACnBmC,IAAIlD;QACJmD,KAAKxD;QACLyD,gBAAgB1B;QAChB2B,eAAe1B;QACf2B,cAAcpC;QACdqC,cAAc/B;QACdgC,WAAW1B;QACX2B,qBAAmBxE,MAAMyE,kBAAkB,IAAIrE;OAE9CJ,MAAMoB,OAAO;AAKxB,GAAG;AACH,4DAA4D;AAC5DtB,eAAe4E,YAAY,GAAG;IAC5BrC,OAAO;IACPmB,gBAAgB;AAClB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["async-utils.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\ndeclare function setTimeout(cb: Function, delay: number): number;\ndeclare function setInterval(cb: Function, delay: number): number;\n\n/**\n * Bugs often appear in async code when stuff gets disposed, but async operations don't get canceled.\n * This Async helper class solves these issues by tying async code to the lifetime of a disposable object.\n *\n * Usage: Anything class extending from BaseModel can access this helper via this.async. Otherwise create a\n * new instance of the class and remember to call dispose() during your code's dispose handler.\n *\n * @public\n */\nexport class Async {\n private _timeoutIds: { [id: number]: boolean } | null = null;\n private _immediateIds: { [id: number]: boolean } | null = null;\n private _intervalIds: { [id: number]: boolean } | null = null;\n private _animationFrameIds: { [id: number]: boolean } | null = null;\n private _isDisposed: boolean;\n private _parent: object | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onErrorHandler: ((e: any) => void) | undefined;\n private _noop: () => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(parent?: object, onError?: (e: any) => void) {\n this._isDisposed = false;\n this._parent = parent || null;\n this._onErrorHandler = onError;\n this._noop = () => {\n /* do nothing */\n };\n }\n\n /**\n * Dispose function, clears all async operations.\n */\n public dispose(): void {\n let id;\n\n this._isDisposed = true;\n this._parent = null;\n\n // Clear timeouts.\n if (this._timeoutIds) {\n for (id in this._timeoutIds) {\n if (this._timeoutIds.hasOwnProperty(id)) {\n this.clearTimeout(parseInt(id, 10));\n }\n }\n\n this._timeoutIds = null;\n }\n\n // Clear immediates.\n if (this._immediateIds) {\n for (id in this._immediateIds) {\n if (this._immediateIds.hasOwnProperty(id)) {\n this.clearImmediate(parseInt(id, 10));\n }\n }\n\n this._immediateIds = null;\n }\n\n // Clear intervals.\n if (this._intervalIds) {\n for (id in this._intervalIds) {\n if (this._intervalIds.hasOwnProperty(id)) {\n this.clearInterval(parseInt(id, 10));\n }\n }\n this._intervalIds = null;\n }\n\n // Clear animation frames.\n if (this._animationFrameIds) {\n for (id in this._animationFrameIds) {\n if (this._animationFrameIds.hasOwnProperty(id)) {\n this.cancelAnimationFrame(parseInt(id, 10));\n }\n }\n\n this._animationFrameIds = null;\n }\n }\n\n /**\n * SetTimeout override, which will auto cancel the timeout during dispose.\n * @param callback - Callback to execute.\n * @param duration - Duration in milliseconds.\n * @returns The setTimeout id.\n */\n public setTimeout(callback: () => void, duration: number): number {\n let timeoutId = 0;\n\n if (!this._isDisposed) {\n if (!this._timeoutIds) {\n this._timeoutIds = {};\n }\n\n timeoutId = setTimeout(() => {\n // Time to execute the timeout, enqueue it as a foreground task to be executed.\n\n try {\n // Now delete the record and call the callback.\n if (this._timeoutIds) {\n delete this._timeoutIds[timeoutId];\n }\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n }, duration);\n\n this._timeoutIds[timeoutId] = true;\n }\n\n return timeoutId;\n }\n\n /**\n * Clears the timeout.\n * @param id - Id to cancel.\n */\n public clearTimeout(id: number): void {\n if (this._timeoutIds && this._timeoutIds[id]) {\n clearTimeout(id);\n delete this._timeoutIds[id];\n }\n }\n\n /**\n * SetImmediate override, which will auto cancel the immediate during dispose.\n * @param callback - Callback to execute.\n * @param targetElement - Optional target element to use for identifying the correct window.\n * @returns The setTimeout id.\n */\n public setImmediate(callback: () => void, targetElement?: Element | null): number {\n let immediateId = 0;\n const win = getWindow(targetElement)!;\n\n if (!this._isDisposed) {\n if (!this._immediateIds) {\n this._immediateIds = {};\n }\n\n let setImmediateCallback = () => {\n // Time to execute the timeout, enqueue it as a foreground task to be executed.\n\n try {\n // Now delete the record and call the callback.\n if (this._immediateIds) {\n delete this._immediateIds[immediateId];\n }\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n };\n\n immediateId = win.setTimeout(setImmediateCallback, 0);\n\n this._immediateIds[immediateId] = true;\n }\n\n return immediateId;\n }\n\n /**\n * Clears the immediate.\n * @param id - Id to cancel.\n * @param targetElement - Optional target element to use for identifying the correct window.\n */\n public clearImmediate(id: number, targetElement?: Element | null): void {\n const win = getWindow(targetElement)!;\n\n if (this._immediateIds && this._immediateIds[id]) {\n win.clearTimeout(id);\n delete this._immediateIds[id];\n }\n }\n\n /**\n * SetInterval override, which will auto cancel the timeout during dispose.\n * @param callback - Callback to execute.\n * @param duration - Duration in milliseconds.\n * @returns The setTimeout id.\n */\n public setInterval(callback: () => void, duration: number): number {\n let intervalId = 0;\n\n if (!this._isDisposed) {\n if (!this._intervalIds) {\n this._intervalIds = {};\n }\n\n intervalId = setInterval(() => {\n // Time to execute the interval callback, enqueue it as a foreground task to be executed.\n try {\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n }, duration);\n\n this._intervalIds[intervalId] = true;\n }\n\n return intervalId;\n }\n\n /**\n * Clears the interval.\n * @param id - Id to cancel.\n */\n public clearInterval(id: number): void {\n if (this._intervalIds && this._intervalIds[id]) {\n clearInterval(id);\n delete this._intervalIds[id];\n }\n }\n\n /**\n * Creates a function that, when executed, will only call the func function at most once per\n * every wait milliseconds. Provide an options object to indicate that func should be invoked\n * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled\n * function will return the result of the last func call.\n *\n * Note: If leading and trailing options are true func will be called on the trailing edge of\n * the timeout only if the throttled function is invoked more than once during the wait timeout.\n *\n * @param func - The function to throttle.\n * @param wait - The number of milliseconds to throttle executions to. Defaults to 0.\n * @param options - The options object.\n * @returns The new throttled function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public throttle<T extends (...args: any[]) => any>(\n func: T,\n wait?: number,\n options?: {\n leading?: boolean;\n trailing?: boolean;\n },\n ): T {\n if (this._isDisposed) {\n return this._noop as T;\n }\n\n let waitMS = wait || 0;\n let leading = true;\n let trailing = true;\n let lastExecuteTime = 0;\n let lastResult: T;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let lastArgs: any[];\n let timeoutId: number | null = null;\n\n if (options && typeof options.leading === 'boolean') {\n leading = options.leading;\n }\n\n if (options && typeof options.trailing === 'boolean') {\n trailing = options.trailing;\n }\n\n let callback = (userCall?: boolean) => {\n let now = Date.now();\n let delta = now - lastExecuteTime;\n let waitLength = leading ? waitMS - delta : waitMS;\n if (delta >= waitMS && (!userCall || leading)) {\n lastExecuteTime = now;\n if (timeoutId) {\n this.clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastResult = func.apply(this._parent, lastArgs);\n } else if (timeoutId === null && trailing) {\n timeoutId = this.setTimeout(callback, waitLength);\n }\n\n return lastResult;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let resultFunction = ((...args: any[]): any => {\n lastArgs = args;\n return callback(true);\n }) as T;\n\n return resultFunction;\n }\n\n /**\n * Creates a function that will delay the execution of func until after wait milliseconds have\n * elapsed since the last time it was invoked. Provide an options object to indicate that func\n * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls\n * to the debounced function will return the result of the last func call.\n *\n * Note: If leading and trailing options are true func will be called on the trailing edge of\n * the timeout only if the debounced function is invoked more than once during the wait\n * timeout.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns The new debounced function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public debounce<T extends (...args: any[]) => any>(\n func: T,\n wait?: number,\n options?: {\n leading?: boolean;\n maxWait?: number;\n trailing?: boolean;\n },\n ): ICancelable<T> & T {\n if (this._isDisposed) {\n let noOpFunction = (() => {\n /** Do nothing */\n }) as ICancelable<T> & T;\n\n noOpFunction.cancel = () => {\n return;\n };\n noOpFunction.flush = (() => null) as unknown as () => ReturnType<T>;\n noOpFunction.pending = () => false;\n\n return noOpFunction;\n }\n\n let waitMS = wait || 0;\n let leading = false;\n let trailing = true;\n let maxWait: number | null = null;\n let lastCallTime = 0;\n let lastExecuteTime = Date.now();\n let lastResult: ReturnType<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let lastArgs: any[];\n let timeoutId: number | null = null;\n\n if (options && typeof options.leading === 'boolean') {\n leading = options.leading;\n }\n\n if (options && typeof options.trailing === 'boolean') {\n trailing = options.trailing;\n }\n\n if (options && typeof options.maxWait === 'number' && !isNaN(options.maxWait)) {\n maxWait = options.maxWait;\n }\n\n let markExecuted = (time: number) => {\n if (timeoutId) {\n this.clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastExecuteTime = time;\n };\n\n let invokeFunction = (time: number) => {\n markExecuted(time);\n lastResult = func.apply(this._parent, lastArgs);\n };\n\n let callback = (userCall?: boolean) => {\n let now = Date.now();\n let executeImmediately = false;\n if (userCall) {\n if (leading && now - lastCallTime >= waitMS) {\n executeImmediately = true;\n }\n lastCallTime = now;\n }\n let delta = now - lastCallTime;\n let waitLength = waitMS - delta;\n let maxWaitDelta = now - lastExecuteTime;\n let maxWaitExpired = false;\n\n if (maxWait !== null) {\n // maxWait only matters when there is a pending callback\n if (maxWaitDelta >= maxWait && timeoutId) {\n maxWaitExpired = true;\n } else {\n waitLength = Math.min(waitLength, maxWait - maxWaitDelta);\n }\n }\n\n if (delta >= waitMS || maxWaitExpired || executeImmediately) {\n invokeFunction(now);\n } else if ((timeoutId === null || !userCall) && trailing) {\n timeoutId = this.setTimeout(callback, waitLength);\n }\n\n return lastResult;\n };\n\n let pending = (): boolean => {\n return !!timeoutId;\n };\n\n let cancel = (): void => {\n if (pending()) {\n // Mark the debounced function as having executed\n markExecuted(Date.now());\n }\n };\n\n let flush = () => {\n if (pending()) {\n invokeFunction(Date.now());\n }\n\n return lastResult;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let resultFunction = ((...args: any[]) => {\n lastArgs = args;\n return callback(true);\n }) as ICancelable<T> & T;\n\n resultFunction.cancel = cancel;\n resultFunction.flush = flush;\n resultFunction.pending = pending;\n\n return resultFunction;\n }\n\n public requestAnimationFrame(callback: () => void, targetElement?: Element | null): number {\n let animationFrameId = 0;\n const win = getWindow(targetElement)!;\n\n if (!this._isDisposed) {\n if (!this._animationFrameIds) {\n this._animationFrameIds = {};\n }\n\n let animationFrameCallback = () => {\n try {\n // Now delete the record and call the callback.\n if (this._animationFrameIds) {\n delete this._animationFrameIds[animationFrameId];\n }\n\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n };\n\n animationFrameId = win.requestAnimationFrame\n ? win.requestAnimationFrame(animationFrameCallback)\n : win.setTimeout(animationFrameCallback, 0);\n\n this._animationFrameIds[animationFrameId] = true;\n }\n\n return animationFrameId;\n }\n\n public cancelAnimationFrame(id: number, targetElement?: Element | null): void {\n const win = getWindow(targetElement)!;\n\n if (this._animationFrameIds && this._animationFrameIds[id]) {\n win.cancelAnimationFrame ? win.cancelAnimationFrame(id) : win.clearTimeout(id);\n delete this._animationFrameIds[id];\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected _logError(e: any): void {\n if (this._onErrorHandler) {\n this._onErrorHandler(e);\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ICancelable<T extends (...args: any[]) => any> = {\n flush: () => ReturnType<T>;\n cancel: () => void;\n pending: () => boolean;\n};\n"],"names":["Async","dispose","id","_isDisposed","_parent","_timeoutIds","hasOwnProperty","clearTimeout","parseInt","_immediateIds","clearImmediate","_intervalIds","clearInterval","_animationFrameIds","cancelAnimationFrame","setTimeout","callback","duration","timeoutId","apply","e","_logError","setImmediate","targetElement","immediateId","win","getWindow","setImmediateCallback","setInterval","intervalId","throttle","func","wait","options","_noop","waitMS","leading","trailing","lastExecuteTime","lastResult","lastArgs","userCall","now","Date","delta","waitLength","resultFunction","args","debounce","noOpFunction","cancel","flush","pending","maxWait","lastCallTime","isNaN","markExecuted","time","invokeFunction","executeImmediately","maxWaitDelta","maxWaitExpired","Math","min","requestAnimationFrame","animationFrameId","animationFrameCallback","_onErrorHandler","constructor","parent","onError","_define_property"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Z,EAAU,EAAEqB,aAA8B,EAAQ;QAC5E,MAAME,MAAMC,IAAAA,oBAAAA,EAAUH;QAEtB,IAAI,IAAI,CAACV,kBAAkB,IAAI,IAAI,CAACA,kBAAkB,CAACX,GAAG,EAAE;YAC1DuB,IAAIX,oBAAoB,GAAGW,IAAIX,oBAAoB,CAACZ,MAAMuB,IAAIlB,YAAY,CAACL;YAC3E,OAAO,IAAI,CAACW,kBAAkB,CAACX,GAAG;QACpC;IACF;IAEA,8DAA8D;IACpDmB,UAAUD,CAAM,EAAQ;QAChC,IAAI,IAAI,CAAC+C,eAAe,EAAE;YACxB,IAAI,CAACA,eAAe,CAAC/C;QACvB;IACF;IAvcA,8DAA8D;IAC9DgD,YAAYC,MAAe,EAAEC,OAA0B,CAAE;QAVzDC,IAAAA,kBAAA,EAAA,IAAA,EAAQlE,eAAgD;QACxDkE,IAAAA,kBAAA,EAAA,IAAA,EAAQ9D,iBAAkD;QAC1D8D,IAAAA,kBAAA,EAAA,IAAA,EAAQ5D,gBAAiD;QACzD4D,IAAAA,kBAAA,EAAA,IAAA,EAAQ1D,sBAAuD;QAC/D0D,IAAAA,kBAAA,EAAA,IAAA,EAAQpE,eAAR,KAAA;QACAoE,IAAAA,kBAAA,EAAA,IAAA,EAAQnE,WAAR,KAAA;QACA,8DAA8D;QAC9DmE,IAAAA,kBAAA,EAAA,IAAA,EAAQJ,mBAAR,KAAA;QACAI,IAAAA,kBAAA,EAAA,IAAA,EAAQrC,SAAR,KAAA;QAGE,IAAI,CAAC/B,WAAW,GAAG;QACnB,IAAI,CAACC,OAAO,GAAGiE,UAAU;QACzB,IAAI,CAACF,eAAe,GAAGG;QACvB,IAAI,CAACpC,KAAK,GAAG;QACX,cAAc,GAChB;IACF;AAgcF"}
1
+ {"version":3,"sources":["../src/utilities/async-utils.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\ndeclare function setTimeout(cb: Function, delay: number): number;\ndeclare function setInterval(cb: Function, delay: number): number;\n\n/**\n * Bugs often appear in async code when stuff gets disposed, but async operations don't get canceled.\n * This Async helper class solves these issues by tying async code to the lifetime of a disposable object.\n *\n * Usage: Anything class extending from BaseModel can access this helper via this.async. Otherwise create a\n * new instance of the class and remember to call dispose() during your code's dispose handler.\n *\n * @public\n */\nexport class Async {\n private _timeoutIds: { [id: number]: boolean } | null = null;\n private _immediateIds: { [id: number]: boolean } | null = null;\n private _intervalIds: { [id: number]: boolean } | null = null;\n private _animationFrameIds: { [id: number]: boolean } | null = null;\n private _isDisposed: boolean;\n private _parent: object | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onErrorHandler: ((e: any) => void) | undefined;\n private _noop: () => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(parent?: object, onError?: (e: any) => void) {\n this._isDisposed = false;\n this._parent = parent || null;\n this._onErrorHandler = onError;\n this._noop = () => {\n /* do nothing */\n };\n }\n\n /**\n * Dispose function, clears all async operations.\n */\n public dispose(): void {\n let id;\n\n this._isDisposed = true;\n this._parent = null;\n\n // Clear timeouts.\n if (this._timeoutIds) {\n for (id in this._timeoutIds) {\n if (this._timeoutIds.hasOwnProperty(id)) {\n this.clearTimeout(parseInt(id, 10));\n }\n }\n\n this._timeoutIds = null;\n }\n\n // Clear immediates.\n if (this._immediateIds) {\n for (id in this._immediateIds) {\n if (this._immediateIds.hasOwnProperty(id)) {\n this.clearImmediate(parseInt(id, 10));\n }\n }\n\n this._immediateIds = null;\n }\n\n // Clear intervals.\n if (this._intervalIds) {\n for (id in this._intervalIds) {\n if (this._intervalIds.hasOwnProperty(id)) {\n this.clearInterval(parseInt(id, 10));\n }\n }\n this._intervalIds = null;\n }\n\n // Clear animation frames.\n if (this._animationFrameIds) {\n for (id in this._animationFrameIds) {\n if (this._animationFrameIds.hasOwnProperty(id)) {\n this.cancelAnimationFrame(parseInt(id, 10));\n }\n }\n\n this._animationFrameIds = null;\n }\n }\n\n /**\n * SetTimeout override, which will auto cancel the timeout during dispose.\n * @param callback - Callback to execute.\n * @param duration - Duration in milliseconds.\n * @returns The setTimeout id.\n */\n public setTimeout(callback: () => void, duration: number): number {\n let timeoutId = 0;\n\n if (!this._isDisposed) {\n if (!this._timeoutIds) {\n this._timeoutIds = {};\n }\n\n timeoutId = setTimeout(() => {\n // Time to execute the timeout, enqueue it as a foreground task to be executed.\n\n try {\n // Now delete the record and call the callback.\n if (this._timeoutIds) {\n delete this._timeoutIds[timeoutId];\n }\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n }, duration);\n\n this._timeoutIds[timeoutId] = true;\n }\n\n return timeoutId;\n }\n\n /**\n * Clears the timeout.\n * @param id - Id to cancel.\n */\n public clearTimeout(id: number): void {\n if (this._timeoutIds && this._timeoutIds[id]) {\n clearTimeout(id);\n delete this._timeoutIds[id];\n }\n }\n\n /**\n * SetImmediate override, which will auto cancel the immediate during dispose.\n * @param callback - Callback to execute.\n * @param targetElement - Optional target element to use for identifying the correct window.\n * @returns The setTimeout id.\n */\n public setImmediate(callback: () => void, targetElement?: Element | null): number {\n let immediateId = 0;\n const win = getWindow(targetElement)!;\n\n if (!this._isDisposed) {\n if (!this._immediateIds) {\n this._immediateIds = {};\n }\n\n let setImmediateCallback = () => {\n // Time to execute the timeout, enqueue it as a foreground task to be executed.\n\n try {\n // Now delete the record and call the callback.\n if (this._immediateIds) {\n delete this._immediateIds[immediateId];\n }\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n };\n\n immediateId = win.setTimeout(setImmediateCallback, 0);\n\n this._immediateIds[immediateId] = true;\n }\n\n return immediateId;\n }\n\n /**\n * Clears the immediate.\n * @param id - Id to cancel.\n * @param targetElement - Optional target element to use for identifying the correct window.\n */\n public clearImmediate(id: number, targetElement?: Element | null): void {\n const win = getWindow(targetElement)!;\n\n if (this._immediateIds && this._immediateIds[id]) {\n win.clearTimeout(id);\n delete this._immediateIds[id];\n }\n }\n\n /**\n * SetInterval override, which will auto cancel the timeout during dispose.\n * @param callback - Callback to execute.\n * @param duration - Duration in milliseconds.\n * @returns The setTimeout id.\n */\n public setInterval(callback: () => void, duration: number): number {\n let intervalId = 0;\n\n if (!this._isDisposed) {\n if (!this._intervalIds) {\n this._intervalIds = {};\n }\n\n intervalId = setInterval(() => {\n // Time to execute the interval callback, enqueue it as a foreground task to be executed.\n try {\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n }, duration);\n\n this._intervalIds[intervalId] = true;\n }\n\n return intervalId;\n }\n\n /**\n * Clears the interval.\n * @param id - Id to cancel.\n */\n public clearInterval(id: number): void {\n if (this._intervalIds && this._intervalIds[id]) {\n clearInterval(id);\n delete this._intervalIds[id];\n }\n }\n\n /**\n * Creates a function that, when executed, will only call the func function at most once per\n * every wait milliseconds. Provide an options object to indicate that func should be invoked\n * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled\n * function will return the result of the last func call.\n *\n * Note: If leading and trailing options are true func will be called on the trailing edge of\n * the timeout only if the throttled function is invoked more than once during the wait timeout.\n *\n * @param func - The function to throttle.\n * @param wait - The number of milliseconds to throttle executions to. Defaults to 0.\n * @param options - The options object.\n * @returns The new throttled function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public throttle<T extends (...args: any[]) => any>(\n func: T,\n wait?: number,\n options?: {\n leading?: boolean;\n trailing?: boolean;\n },\n ): T {\n if (this._isDisposed) {\n return this._noop as T;\n }\n\n let waitMS = wait || 0;\n let leading = true;\n let trailing = true;\n let lastExecuteTime = 0;\n let lastResult: T;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let lastArgs: any[];\n let timeoutId: number | null = null;\n\n if (options && typeof options.leading === 'boolean') {\n leading = options.leading;\n }\n\n if (options && typeof options.trailing === 'boolean') {\n trailing = options.trailing;\n }\n\n let callback = (userCall?: boolean) => {\n let now = Date.now();\n let delta = now - lastExecuteTime;\n let waitLength = leading ? waitMS - delta : waitMS;\n if (delta >= waitMS && (!userCall || leading)) {\n lastExecuteTime = now;\n if (timeoutId) {\n this.clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastResult = func.apply(this._parent, lastArgs);\n } else if (timeoutId === null && trailing) {\n timeoutId = this.setTimeout(callback, waitLength);\n }\n\n return lastResult;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let resultFunction = ((...args: any[]): any => {\n lastArgs = args;\n return callback(true);\n }) as T;\n\n return resultFunction;\n }\n\n /**\n * Creates a function that will delay the execution of func until after wait milliseconds have\n * elapsed since the last time it was invoked. Provide an options object to indicate that func\n * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls\n * to the debounced function will return the result of the last func call.\n *\n * Note: If leading and trailing options are true func will be called on the trailing edge of\n * the timeout only if the debounced function is invoked more than once during the wait\n * timeout.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns The new debounced function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public debounce<T extends (...args: any[]) => any>(\n func: T,\n wait?: number,\n options?: {\n leading?: boolean;\n maxWait?: number;\n trailing?: boolean;\n },\n ): ICancelable<T> & T {\n if (this._isDisposed) {\n let noOpFunction = (() => {\n /** Do nothing */\n }) as ICancelable<T> & T;\n\n noOpFunction.cancel = () => {\n return;\n };\n noOpFunction.flush = (() => null) as unknown as () => ReturnType<T>;\n noOpFunction.pending = () => false;\n\n return noOpFunction;\n }\n\n let waitMS = wait || 0;\n let leading = false;\n let trailing = true;\n let maxWait: number | null = null;\n let lastCallTime = 0;\n let lastExecuteTime = Date.now();\n let lastResult: ReturnType<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let lastArgs: any[];\n let timeoutId: number | null = null;\n\n if (options && typeof options.leading === 'boolean') {\n leading = options.leading;\n }\n\n if (options && typeof options.trailing === 'boolean') {\n trailing = options.trailing;\n }\n\n if (options && typeof options.maxWait === 'number' && !isNaN(options.maxWait)) {\n maxWait = options.maxWait;\n }\n\n let markExecuted = (time: number) => {\n if (timeoutId) {\n this.clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastExecuteTime = time;\n };\n\n let invokeFunction = (time: number) => {\n markExecuted(time);\n lastResult = func.apply(this._parent, lastArgs);\n };\n\n let callback = (userCall?: boolean) => {\n let now = Date.now();\n let executeImmediately = false;\n if (userCall) {\n if (leading && now - lastCallTime >= waitMS) {\n executeImmediately = true;\n }\n lastCallTime = now;\n }\n let delta = now - lastCallTime;\n let waitLength = waitMS - delta;\n let maxWaitDelta = now - lastExecuteTime;\n let maxWaitExpired = false;\n\n if (maxWait !== null) {\n // maxWait only matters when there is a pending callback\n if (maxWaitDelta >= maxWait && timeoutId) {\n maxWaitExpired = true;\n } else {\n waitLength = Math.min(waitLength, maxWait - maxWaitDelta);\n }\n }\n\n if (delta >= waitMS || maxWaitExpired || executeImmediately) {\n invokeFunction(now);\n } else if ((timeoutId === null || !userCall) && trailing) {\n timeoutId = this.setTimeout(callback, waitLength);\n }\n\n return lastResult;\n };\n\n let pending = (): boolean => {\n return !!timeoutId;\n };\n\n let cancel = (): void => {\n if (pending()) {\n // Mark the debounced function as having executed\n markExecuted(Date.now());\n }\n };\n\n let flush = () => {\n if (pending()) {\n invokeFunction(Date.now());\n }\n\n return lastResult;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let resultFunction = ((...args: any[]) => {\n lastArgs = args;\n return callback(true);\n }) as ICancelable<T> & T;\n\n resultFunction.cancel = cancel;\n resultFunction.flush = flush;\n resultFunction.pending = pending;\n\n return resultFunction;\n }\n\n public requestAnimationFrame(callback: () => void, targetElement?: Element | null): number {\n let animationFrameId = 0;\n const win = getWindow(targetElement)!;\n\n if (!this._isDisposed) {\n if (!this._animationFrameIds) {\n this._animationFrameIds = {};\n }\n\n let animationFrameCallback = () => {\n try {\n // Now delete the record and call the callback.\n if (this._animationFrameIds) {\n delete this._animationFrameIds[animationFrameId];\n }\n\n callback.apply(this._parent);\n } catch (e) {\n this._logError(e);\n }\n };\n\n animationFrameId = win.requestAnimationFrame\n ? win.requestAnimationFrame(animationFrameCallback)\n : win.setTimeout(animationFrameCallback, 0);\n\n this._animationFrameIds[animationFrameId] = true;\n }\n\n return animationFrameId;\n }\n\n public cancelAnimationFrame(id: number, targetElement?: Element | null): void {\n const win = getWindow(targetElement)!;\n\n if (this._animationFrameIds && this._animationFrameIds[id]) {\n win.cancelAnimationFrame ? win.cancelAnimationFrame(id) : win.clearTimeout(id);\n delete this._animationFrameIds[id];\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected _logError(e: any): void {\n if (this._onErrorHandler) {\n this._onErrorHandler(e);\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ICancelable<T extends (...args: any[]) => any> = {\n flush: () => ReturnType<T>;\n cancel: () => void;\n pending: () => boolean;\n};\n"],"names":["getWindow","Async","dispose","id","_isDisposed","_parent","_timeoutIds","hasOwnProperty","clearTimeout","parseInt","_immediateIds","clearImmediate","_intervalIds","clearInterval","_animationFrameIds","cancelAnimationFrame","setTimeout","callback","duration","timeoutId","apply","e","_logError","setImmediate","targetElement","immediateId","win","setImmediateCallback","setInterval","intervalId","throttle","func","wait","options","_noop","waitMS","leading","trailing","lastExecuteTime","lastResult","lastArgs","userCall","now","Date","delta","waitLength","resultFunction","args","debounce","noOpFunction","cancel","flush","pending","maxWait","lastCallTime","isNaN","markExecuted","time","invokeFunction","executeImmediately","maxWaitDelta","maxWaitExpired","Math","min","requestAnimationFrame","animationFrameId","animationFrameCallback","_onErrorHandler","constructor","parent","onError"],"mappings":";;;;;;;eAcaC;;;;2BAda,cAAc;AAcjC;IAoBL;;GAEC,GACMC,UAAgB;QACrB,IAAIC;QAEJ,IAAI,CAACC,WAAW,GAAG;QACnB,IAAI,CAACC,OAAO,GAAG;QAEf,kBAAkB;QAClB,IAAI,IAAI,CAACC,WAAW,EAAE;YACpB,IAAKH,MAAM,IAAI,CAACG,WAAW,CAAE;gBAC3B,IAAI,IAAI,CAACA,WAAW,CAACC,cAAc,CAACJ,KAAK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Ae,CAAC9C;QACvB;IACF;IAvcA,8DAA8D;IAC9D+C,YAAYC,MAAe,EAAEC,OAA0B,CAAE;YAVzD,kBAAA,EAAA,IAAA,EAAQhE,eAAgD;QACxD,sBAAA,EAAA,IAAA,EAAQI,iBAAkD;YAC1D,kBAAA,EAAA,IAAA,EAAQE,gBAAiD;YACzD,kBAAA,EAAA,IAAA,EAAQE,sBAAuD;YAC/D,kBAAA,EAAA,IAAA,EAAQV,eAAR,KAAA;QACA,sBAAA,EAAA,IAAA,EAAQC,WAAR,KAAA;QACA,8DAA8D;YAC9D,kBAAA,EAAA,IAAA,EAAQ8D,mBAAR,KAAA;YACA,kBAAA,EAAA,IAAA,EAAQjC,SAAR,KAAA;QAGE,IAAI,CAAC9B,WAAW,GAAG;QACnB,IAAI,CAACC,OAAO,GAAGgE,UAAU;QACzB,IAAI,CAACF,eAAe,GAAGG;QACvB,IAAI,CAACpC,KAAK,GAAG;QACX,cAAc,GAChB;IACF;AAgcF"}
@@ -18,10 +18,17 @@ _export(exports, {
18
18
  getColorFromToken: function() {
19
19
  return getColorFromToken;
20
20
  },
21
+ getContrastTextColor: function() {
22
+ return getContrastTextColor;
23
+ },
24
+ getInvertedTextColor: function() {
25
+ return getInvertedTextColor;
26
+ },
21
27
  getNextColor: function() {
22
28
  return getNextColor;
23
29
  }
24
30
  });
31
+ const _reacttheme = require("@fluentui/react-theme");
25
32
  const _d3color = require("d3-color");
26
33
  const DataVizPalette = {
27
34
  color1: 'qualitative.1',
@@ -291,3 +298,14 @@ const getColorContrast = (c1, c2)=>{
291
298
  const l2 = lrgbLuminance(rgbLrgb((0, _d3color.rgb)(c2)));
292
299
  return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
293
300
  };
301
+ const getInvertedTextColor = (color, isDarkTheme = false)=>{
302
+ return color === _reacttheme.tokens.colorNeutralForeground1 ? _reacttheme.tokens.colorNeutralBackground1 : _reacttheme.tokens.colorNeutralForeground1;
303
+ };
304
+ function getContrastTextColor(backgroundColor, isDarkTheme = false) {
305
+ let textColor = _reacttheme.tokens.colorNeutralForeground1;
306
+ const contrastRatio = getColorContrast(textColor, backgroundColor);
307
+ if (contrastRatio < 3) {
308
+ textColor = getInvertedTextColor(textColor, isDarkTheme);
309
+ }
310
+ return textColor;
311
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["colors.ts"],"sourcesContent":["import { rgb as d3Rgb } from 'd3-color';\n\nexport const DataVizPalette = {\n color1: 'qualitative.1',\n color2: 'qualitative.2',\n color3: 'qualitative.3',\n color4: 'qualitative.4',\n color5: 'qualitative.5',\n color6: 'qualitative.6',\n color7: 'qualitative.7',\n color8: 'qualitative.8',\n color9: 'qualitative.9',\n color10: 'qualitative.10',\n color11: 'qualitative.11',\n color12: 'qualitative.12',\n color13: 'qualitative.13',\n color14: 'qualitative.14',\n color15: 'qualitative.15',\n color16: 'qualitative.16',\n color17: 'qualitative.17',\n color18: 'qualitative.18',\n color19: 'qualitative.19',\n color20: 'qualitative.20',\n color21: 'qualitative.21',\n color22: 'qualitative.22',\n color23: 'qualitative.23',\n color24: 'qualitative.24',\n color25: 'qualitative.25',\n color26: 'qualitative.26',\n color27: 'qualitative.27',\n color28: 'qualitative.28',\n color29: 'qualitative.29',\n color30: 'qualitative.30',\n color31: 'qualitative.31',\n color32: 'qualitative.32',\n color33: 'qualitative.33',\n color34: 'qualitative.34',\n color35: 'qualitative.35',\n color36: 'qualitative.36',\n color37: 'qualitative.37',\n color38: 'qualitative.38',\n color39: 'qualitative.39',\n color40: 'qualitative.40',\n info: 'semantic.info',\n disabled: 'semantic.disabled',\n highError: 'semantic.highError',\n error: 'semantic.error',\n warning: 'semantic.warning',\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n};\n\n/**\n * Key: Color code.\n * Value:\n * Index 0 - Default color / Color for light theme,\n * Index 1 - Color for dark theme\n */\ntype Palette = { [key: string]: string[] };\n\nconst QualitativePalette: Palette = {\n '1': ['#637cef'], // [cornflower.tint10],\n '2': ['#e3008c'], // [hotPink.primary],\n '3': ['#2aa0a4'], // [teal.tint20],\n '4': ['#9373c0'], // [orchid.tint10],\n '5': ['#13a10e'], // [lightGreen.primary],\n '6': ['#3a96dd'], // [lightBlue.primary],\n '7': ['#ca5010'], // [pumpkin.primary],\n '8': ['#57811b'], // [lime.shade20],\n '9': ['#b146c2'], // [lilac.primary],\n '10': ['#ae8c00'], // [gold.shade10],\n '11': ['#3c51b4', '#93a4f4'], // [cornflower.shade20, cornflower.tint30],\n '12': ['#ad006a', '#ee5fb7'], // [hotPink.shade20, hotPink.tint30],\n '13': ['#026467', '#4cb4b7'], // [teal.shade20, teal.tint30],\n '14': ['#674c8c', '#a083c9'], // [orchid.shade20, orchid.tint20],\n '15': ['#0e7a0b', '#27ac22'], // [lightGreen.shade20, lightGreen.tint10],\n '16': ['#2c72a8', '#4fa1e1'], // [lightBlue.shade20, lightBlue.tint10],\n '17': ['#9a3d0c', '#d77440'], // [pumpkin.shade20, pumpkin.tint20],\n '18': ['#405f14', '#73aa24'], // [lime.shade30, lime.primary],\n '19': ['#863593', '#c36bd1'], // [lilac.shade20, lilac.tint20],\n '20': ['#6d5700', '#d0b232'], // [gold.shade30, gold.tint20],\n '21': ['#4f6bed'], // [cornflower.primary],\n '22': ['#ea38a6'], // [hotPink.tint20],\n '23': ['#038387'], // [teal.primary],\n '24': ['#8764b8'], // [orchid.primary],\n '25': ['#11910d'], // [lightGreen.shade10],\n '26': ['#3487c7'], // [lightBlue.shade10],\n '27': ['#d06228'], // [pumpkin.tint10],\n '28': ['#689920'], // [lime.shade10],\n '29': ['#ba58c9'], // [lilac.tint10],\n '30': ['#937700', '#c19c00'], // [gold.shade20, gold.primary],\n '31': ['#2c3c85', '#c8d1fa'], // [cornflower.shade30, cornflower.tint40],\n '32': ['#7f004e', '#f7adda'], // [hotPink.shade30, hotPink.tint40],\n '33': ['#02494c', '#9bd9db'], // [teal.shade30, teal.tint40],\n '34': ['#4c3867', '#b29ad4'], // [orchid.shade30, orchid.tint30],\n '35': ['#0b5a08', '#a7e3a5'], // [lightGreen.shade30, lightGreen.tint40],\n '36': ['#20547c', '#83bdeb'], // [lightBlue.shade30, lightBlue.tint30],\n '37': ['#712d09', '#df8e64'], // [pumpkin.shade30, pumpkin.tint30],\n '38': ['#23330b', '#a4cc6c'], // [lime.shade40, lime.tint30],\n '39': ['#63276d', '#cf87da'], // [lilac.shade30, lilac.tint30],\n '40': ['#3a2f00', '#dac157'], // [gold.shade40, gold.tint30],\n};\n\nconst SemanticPalette: Palette = {\n info: ['#015cda'],\n disabled: ['#dbdbdb', '#4d4d4d'], // [grey[86], grey[30]]\n highError: ['#6e0811', '#cc2635'], // [cranberry.shade30, cranberry.tint10],\n error: ['#c50f1f', '#dc626d'], // [cranberry.primary, cranberry.tint30],\n warning: ['#f7630c', '#f87528'], // [orange.primary, orange.tint10],\n success: ['#107c10', '#54b054'], // [green.primary, green.tint30],\n highSuccess: ['#094509', '#218c21'], // [green.shade30, green.tint10],\n};\n\nconst Colors: { [key: string]: Palette } = {\n qualitative: QualitativePalette,\n semantic: SemanticPalette,\n};\n\nconst QUALITATIVE_COLORS = Object.values(QualitativePalette);\nconst TOKENS = Object.values(DataVizPalette);\n\nconst getThemeSpecificColor = (colors: string[], isDarkTheme: boolean): string => {\n if (colors.length === 0) {\n return '';\n }\n const colorIdx = Number(isDarkTheme);\n if (colorIdx < colors.length) {\n return colors[colorIdx];\n }\n return colors[0];\n};\n\nexport const getNextColor = (index: number, offset: number = 0, isDarkTheme: boolean = false): string => {\n const colors = QUALITATIVE_COLORS[(index + offset) % QUALITATIVE_COLORS.length];\n return getThemeSpecificColor(colors, isDarkTheme);\n};\n\nexport const getColorFromToken = (token: string, isDarkTheme: boolean = false): string => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Colors[paletteName][colorCode];\n return getThemeSpecificColor(colors, isDarkTheme);\n }\n return token;\n};\n\n//For reference to how these numbers are calculated, refer https://www.w3.org/TR/WCAG/#dfn-contrast-ratio\nconst rgbLrgb1 = (v: number): number => {\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\n\nconst rgbLrgb = ({ r, g, b }: { r: number; g: number; b: number }): { r: number; g: number; b: number } => {\n return {\n r: rgbLrgb1(r / 255),\n g: rgbLrgb1(g / 255),\n b: rgbLrgb1(b / 255),\n };\n};\n\nconst lrgbLuminance = ({ r, g, b }: { r: number; g: number; b: number }): number => {\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nexport const getColorContrast = (c1: string, c2: string): number => {\n const l1 = lrgbLuminance(rgbLrgb(d3Rgb(c1)));\n const l2 = lrgbLuminance(rgbLrgb(d3Rgb(c2)));\n return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);\n};\n"],"names":["DataVizPalette","getColorContrast","getColorFromToken","getNextColor","color1","color2","color3","color4","color5","color6","color7","color8","color9","color10","color11","color12","color13","color14","color15","color16","color17","color18","color19","color20","color21","color22","color23","color24","color25","color26","color27","color28","color29","color30","color31","color32","color33","color34","color35","color36","color37","color38","color39","color40","info","disabled","highError","error","warning","success","highSuccess","QualitativePalette","SemanticPalette","Colors","qualitative","semantic","QUALITATIVE_COLORS","Object","values","TOKENS","getThemeSpecificColor","colors","isDarkTheme","length","colorIdx","Number","index","offset","token","indexOf","paletteName","colorCode","split","rgbLrgb1","v","rgbLrgb","r","g","b","lrgbLuminance","c1","c2","l1","d3Rgb","l2","Math","max","min"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GAAG,CAACL,IAAIE,MAAM,IAAA;AACzD"}
1
+ {"version":3,"sources":["../src/utilities/colors.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { rgb as d3Rgb } from 'd3-color';\n\nexport const DataVizPalette = {\n color1: 'qualitative.1',\n color2: 'qualitative.2',\n color3: 'qualitative.3',\n color4: 'qualitative.4',\n color5: 'qualitative.5',\n color6: 'qualitative.6',\n color7: 'qualitative.7',\n color8: 'qualitative.8',\n color9: 'qualitative.9',\n color10: 'qualitative.10',\n color11: 'qualitative.11',\n color12: 'qualitative.12',\n color13: 'qualitative.13',\n color14: 'qualitative.14',\n color15: 'qualitative.15',\n color16: 'qualitative.16',\n color17: 'qualitative.17',\n color18: 'qualitative.18',\n color19: 'qualitative.19',\n color20: 'qualitative.20',\n color21: 'qualitative.21',\n color22: 'qualitative.22',\n color23: 'qualitative.23',\n color24: 'qualitative.24',\n color25: 'qualitative.25',\n color26: 'qualitative.26',\n color27: 'qualitative.27',\n color28: 'qualitative.28',\n color29: 'qualitative.29',\n color30: 'qualitative.30',\n color31: 'qualitative.31',\n color32: 'qualitative.32',\n color33: 'qualitative.33',\n color34: 'qualitative.34',\n color35: 'qualitative.35',\n color36: 'qualitative.36',\n color37: 'qualitative.37',\n color38: 'qualitative.38',\n color39: 'qualitative.39',\n color40: 'qualitative.40',\n info: 'semantic.info',\n disabled: 'semantic.disabled',\n highError: 'semantic.highError',\n error: 'semantic.error',\n warning: 'semantic.warning',\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n};\n\n/**\n * Key: Color code.\n * Value:\n * Index 0 - Default color / Color for light theme,\n * Index 1 - Color for dark theme\n */\ntype Palette = { [key: string]: string[] };\n\nconst QualitativePalette: Palette = {\n '1': ['#637cef'], // [cornflower.tint10],\n '2': ['#e3008c'], // [hotPink.primary],\n '3': ['#2aa0a4'], // [teal.tint20],\n '4': ['#9373c0'], // [orchid.tint10],\n '5': ['#13a10e'], // [lightGreen.primary],\n '6': ['#3a96dd'], // [lightBlue.primary],\n '7': ['#ca5010'], // [pumpkin.primary],\n '8': ['#57811b'], // [lime.shade20],\n '9': ['#b146c2'], // [lilac.primary],\n '10': ['#ae8c00'], // [gold.shade10],\n '11': ['#3c51b4', '#93a4f4'], // [cornflower.shade20, cornflower.tint30],\n '12': ['#ad006a', '#ee5fb7'], // [hotPink.shade20, hotPink.tint30],\n '13': ['#026467', '#4cb4b7'], // [teal.shade20, teal.tint30],\n '14': ['#674c8c', '#a083c9'], // [orchid.shade20, orchid.tint20],\n '15': ['#0e7a0b', '#27ac22'], // [lightGreen.shade20, lightGreen.tint10],\n '16': ['#2c72a8', '#4fa1e1'], // [lightBlue.shade20, lightBlue.tint10],\n '17': ['#9a3d0c', '#d77440'], // [pumpkin.shade20, pumpkin.tint20],\n '18': ['#405f14', '#73aa24'], // [lime.shade30, lime.primary],\n '19': ['#863593', '#c36bd1'], // [lilac.shade20, lilac.tint20],\n '20': ['#6d5700', '#d0b232'], // [gold.shade30, gold.tint20],\n '21': ['#4f6bed'], // [cornflower.primary],\n '22': ['#ea38a6'], // [hotPink.tint20],\n '23': ['#038387'], // [teal.primary],\n '24': ['#8764b8'], // [orchid.primary],\n '25': ['#11910d'], // [lightGreen.shade10],\n '26': ['#3487c7'], // [lightBlue.shade10],\n '27': ['#d06228'], // [pumpkin.tint10],\n '28': ['#689920'], // [lime.shade10],\n '29': ['#ba58c9'], // [lilac.tint10],\n '30': ['#937700', '#c19c00'], // [gold.shade20, gold.primary],\n '31': ['#2c3c85', '#c8d1fa'], // [cornflower.shade30, cornflower.tint40],\n '32': ['#7f004e', '#f7adda'], // [hotPink.shade30, hotPink.tint40],\n '33': ['#02494c', '#9bd9db'], // [teal.shade30, teal.tint40],\n '34': ['#4c3867', '#b29ad4'], // [orchid.shade30, orchid.tint30],\n '35': ['#0b5a08', '#a7e3a5'], // [lightGreen.shade30, lightGreen.tint40],\n '36': ['#20547c', '#83bdeb'], // [lightBlue.shade30, lightBlue.tint30],\n '37': ['#712d09', '#df8e64'], // [pumpkin.shade30, pumpkin.tint30],\n '38': ['#23330b', '#a4cc6c'], // [lime.shade40, lime.tint30],\n '39': ['#63276d', '#cf87da'], // [lilac.shade30, lilac.tint30],\n '40': ['#3a2f00', '#dac157'], // [gold.shade40, gold.tint30],\n};\n\nconst SemanticPalette: Palette = {\n info: ['#015cda'],\n disabled: ['#dbdbdb', '#4d4d4d'], // [grey[86], grey[30]]\n highError: ['#6e0811', '#cc2635'], // [cranberry.shade30, cranberry.tint10],\n error: ['#c50f1f', '#dc626d'], // [cranberry.primary, cranberry.tint30],\n warning: ['#f7630c', '#f87528'], // [orange.primary, orange.tint10],\n success: ['#107c10', '#54b054'], // [green.primary, green.tint30],\n highSuccess: ['#094509', '#218c21'], // [green.shade30, green.tint10],\n};\n\nconst Colors: { [key: string]: Palette } = {\n qualitative: QualitativePalette,\n semantic: SemanticPalette,\n};\n\nconst QUALITATIVE_COLORS = Object.values(QualitativePalette);\nconst TOKENS = Object.values(DataVizPalette);\n\nconst getThemeSpecificColor = (colors: string[], isDarkTheme: boolean): string => {\n if (colors.length === 0) {\n return '';\n }\n const colorIdx = Number(isDarkTheme);\n if (colorIdx < colors.length) {\n return colors[colorIdx];\n }\n return colors[0];\n};\n\nexport const getNextColor = (index: number, offset: number = 0, isDarkTheme: boolean = false): string => {\n const colors = QUALITATIVE_COLORS[(index + offset) % QUALITATIVE_COLORS.length];\n return getThemeSpecificColor(colors, isDarkTheme);\n};\n\nexport const getColorFromToken = (token: string, isDarkTheme: boolean = false): string => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Colors[paletteName][colorCode];\n return getThemeSpecificColor(colors, isDarkTheme);\n }\n return token;\n};\n\n//For reference to how these numbers are calculated, refer https://www.w3.org/TR/WCAG/#dfn-contrast-ratio\nconst rgbLrgb1 = (v: number): number => {\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\n\nconst rgbLrgb = ({ r, g, b }: { r: number; g: number; b: number }): { r: number; g: number; b: number } => {\n return {\n r: rgbLrgb1(r / 255),\n g: rgbLrgb1(g / 255),\n b: rgbLrgb1(b / 255),\n };\n};\n\nconst lrgbLuminance = ({ r, g, b }: { r: number; g: number; b: number }): number => {\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nexport const getColorContrast = (c1: string, c2: string): number => {\n const l1 = lrgbLuminance(rgbLrgb(d3Rgb(c1)));\n const l2 = lrgbLuminance(rgbLrgb(d3Rgb(c2)));\n return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);\n};\n\nexport const getInvertedTextColor = (color: string, isDarkTheme: boolean = false): string => {\n return color === tokens.colorNeutralForeground1 ? tokens.colorNeutralBackground1 : tokens.colorNeutralForeground1;\n};\n\nexport function getContrastTextColor(backgroundColor: string, isDarkTheme: boolean = false): string {\n let textColor = tokens.colorNeutralForeground1;\n const contrastRatio = getColorContrast(textColor, backgroundColor);\n if (contrastRatio < 3) {\n textColor = getInvertedTextColor(textColor, isDarkTheme);\n }\n return textColor;\n}\n"],"names":["tokens","rgb","d3Rgb","DataVizPalette","color1","color2","color3","color4","color5","color6","color7","color8","color9","color10","color11","color12","color13","color14","color15","color16","color17","color18","color19","color20","color21","color22","color23","color24","color25","color26","color27","color28","color29","color30","color31","color32","color33","color34","color35","color36","color37","color38","color39","color40","info","disabled","highError","error","warning","success","highSuccess","QualitativePalette","SemanticPalette","Colors","qualitative","semantic","QUALITATIVE_COLORS","Object","values","TOKENS","getThemeSpecificColor","colors","isDarkTheme","length","colorIdx","Number","getNextColor","index","offset","getColorFromToken","token","indexOf","paletteName","colorCode","split","rgbLrgb1","v","rgbLrgb","r","g","b","lrgbLuminance","getColorContrast","c1","c2","l1","l2","Math","max","min","getInvertedTextColor","color","colorNeutralForeground1","colorNeutralBackground1","getContrastTextColor","backgroundColor","textColor","contrastRatio"],"mappings":";;;;;;;;;;;IAGaG,cAAAA;;;IAiKA+E,gBAAA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6B,UAAU3F,kBAAAA,CAAO4F,uBAAuB,GAAG5F,kBAAAA,CAAO6F,uBAAuB,GAAG7F,kBAAAA,CAAO4F,uBAAuB;AACnH,EAAE;AAEK,8BAA8BG,eAAuB,EAAEjC,cAAuB,KAAK;IACxF,IAAIkC,YAAYhG,kBAAAA,CAAO4F,uBAAuB;IAC9C,MAAMK,gBAAgBf,iBAAiBc,WAAWD;IAClD,IAAIE,gBAAgB,GAAG;QACrBD,YAAYN,qBAAqBM,WAAWlC;IAC9C;IACA,OAAOkC;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["getWindow","_window","undefined","window","e","rootElement","canUseDOM","el","ownerDocument","defaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBgBA;;;eAAAA;;;gCAtBU;AAE1B,IAAIC,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,iDAAiD;IACjDD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAUO,SAASJ,UAAUK,WAA4B;IACpD,IAAI,CAACC,IAAAA,yBAAAA,OAAe,OAAOL,YAAY,aAAa;QAClD,OAAOC;IACT,OAAO;QACL,MAAMK,KAAKF;QAEX,OAAOE,MAAMA,GAAGC,aAAa,IAAID,GAAGC,aAAa,CAACC,WAAW,GAAGF,GAAGC,aAAa,CAACC,WAAW,GAAGR;IACjG;AACF"}
1
+ {"version":3,"sources":["../src/utilities/getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["canUseDOM","_window","undefined","window","e","getWindow","rootElement","el","ownerDocument","defaultView"],"mappings":";;;;+BAsBgBK;;;;;;gCAtBU,4BAA4B;AAEtD,IAAIJ,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,iDAAiD;IACjDD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAUO,mBAAmBE,WAA4B;IACpD,IAAI,KAACN,yBAAAA,OAAe,OAAOC,YAAY,aAAa;QAClD,OAAOC;IACT,OAAO;QACL,MAAMK,KAAKD;QAEX,OAAOC,MAAMA,GAAGC,aAAa,IAAID,GAAGC,aAAa,CAACC,WAAW,GAAGF,GAAGC,aAAa,CAACC,WAAW,GAAGR;IACjG;AACF"}