@fluentui/react-charts 9.3.7 → 9.3.9

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 (259) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/dist/index.d.ts +433 -7
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  7. package/lib/components/AreaChart/AreaChart.js +1 -28
  8. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +27 -8
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  13. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  14. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  15. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  16. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  17. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  18. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  19. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  20. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  21. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +54 -4
  22. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  24. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  25. package/lib/components/CommonComponents/CartesianChart.js +81 -44
  26. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  27. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
  29. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  30. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
  31. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  33. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +643 -366
  35. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +24 -9
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  41. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  42. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  43. package/lib/components/FunnelChart/FunnelChart.js +33 -8
  44. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  45. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  47. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  48. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  49. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  50. package/lib/components/GanttChart/GanttChart.js +1 -1
  51. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  52. package/lib/components/GaugeChart/GaugeChart.js +13 -9
  53. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  54. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  55. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  56. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  57. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  58. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  59. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +18 -18
  60. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  61. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  62. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  63. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  64. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +60 -10
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  69. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  71. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  72. package/lib/components/Legends/Legends.js +3 -4
  73. package/lib/components/Legends/Legends.js.map +1 -1
  74. package/lib/components/Legends/OverflowMenu.js +9 -2
  75. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  76. package/lib/components/LineChart/LineChart.js +65 -64
  77. package/lib/components/LineChart/LineChart.js.map +1 -1
  78. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  79. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  80. package/lib/components/PolarChart/PolarChart.js +577 -0
  81. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  82. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  83. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  85. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  86. package/lib/components/PolarChart/index.js +2 -0
  87. package/lib/components/PolarChart/index.js.map +1 -0
  88. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  89. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  90. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  91. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  92. package/lib/components/SankeyChart/SankeyChart.js +15 -5
  93. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  94. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  95. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +24 -8
  96. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  98. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.js +13 -25
  100. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  102. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  103. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
  105. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  106. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  107. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +48 -68
  109. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  110. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  111. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  112. package/lib/index.js +1 -0
  113. package/lib/index.js.map +1 -1
  114. package/lib/types/ChartAnnotation.js.map +1 -1
  115. package/lib/types/DataPoint.js +1 -1
  116. package/lib/types/DataPoint.js.map +1 -1
  117. package/lib/utilities/ChartTitle.js +45 -0
  118. package/lib/utilities/ChartTitle.js.map +1 -0
  119. package/lib/utilities/Common.styles.js +73 -2
  120. package/lib/utilities/Common.styles.js.map +1 -1
  121. package/lib/utilities/Common.styles.raw.js +70 -1
  122. package/lib/utilities/Common.styles.raw.js.map +1 -1
  123. package/lib/utilities/image-export-utils.js +4 -4
  124. package/lib/utilities/image-export-utils.js.map +1 -1
  125. package/lib/utilities/index.js +1 -0
  126. package/lib/utilities/index.js.map +1 -1
  127. package/lib/utilities/utilities.js +219 -77
  128. package/lib/utilities/utilities.js.map +1 -1
  129. package/lib-commonjs/PolarChart.js +6 -0
  130. package/lib-commonjs/PolarChart.js.map +1 -0
  131. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  132. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
  134. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  135. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  136. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/ChartTable/ChartTable.js +27 -8
  138. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  139. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  140. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  141. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  143. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  145. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  146. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  147. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +65 -5
  148. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  149. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  150. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  151. package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
  152. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  153. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  154. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
  155. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
  157. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  159. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  160. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +649 -368
  161. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  162. package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
  163. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  164. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  165. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  166. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  167. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  168. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  169. package/lib-commonjs/components/FunnelChart/FunnelChart.js +31 -6
  170. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  171. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  172. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  173. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  174. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  175. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  176. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
  177. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  178. package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
  179. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  180. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  181. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  182. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  183. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  184. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  185. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +16 -16
  186. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  187. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  188. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  189. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  190. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  191. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +59 -9
  192. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  193. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  194. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  195. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  196. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  197. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  198. package/lib-commonjs/components/Legends/Legends.js +3 -4
  199. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  200. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  201. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  202. package/lib-commonjs/components/LineChart/LineChart.js +64 -63
  203. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  204. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  205. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  206. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  207. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  208. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  209. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  210. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  211. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  212. package/lib-commonjs/components/PolarChart/index.js +7 -0
  213. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  214. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  215. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  216. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  217. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  218. package/lib-commonjs/components/SankeyChart/SankeyChart.js +15 -5
  219. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  220. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  221. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -6
  222. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  223. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  224. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  225. package/lib-commonjs/components/ScatterChart/ScatterChart.js +12 -24
  226. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  227. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  228. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  229. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  230. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
  231. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  232. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  233. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  234. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +47 -67
  235. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  236. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  237. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  238. package/lib-commonjs/index.js +1 -0
  239. package/lib-commonjs/index.js.map +1 -1
  240. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  241. package/lib-commonjs/types/DataPoint.js +1 -1
  242. package/lib-commonjs/types/DataPoint.js.map +1 -1
  243. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  244. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  245. package/lib-commonjs/utilities/Common.styles.js +69 -1
  246. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  247. package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
  248. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  249. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  250. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  251. package/lib-commonjs/utilities/index.js +1 -0
  252. package/lib-commonjs/utilities/index.js.map +1 -1
  253. package/lib-commonjs/utilities/utilities.js +235 -78
  254. package/lib-commonjs/utilities/utilities.js.map +1 -1
  255. package/package.json +11 -17
  256. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  257. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  258. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  259. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -5,7 +5,9 @@ import { tokens } from '@fluentui/react-theme';
5
5
  import * as d3 from 'd3-color';
6
6
  import { getColorContrast } from '../../utilities/colors';
7
7
  import { resolveCSSVariables } from '../../utilities/utilities';
8
+ import { ChartTitle } from '../../utilities/index';
8
9
  import { useImageExport } from '../../utilities/hooks';
10
+ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
9
11
  function invertHexColor(hex) {
10
12
  const color = d3.color(hex);
11
13
  if (!color) {
@@ -36,9 +38,12 @@ function getSafeBackgroundColor(chartContainer, foreground, background) {
36
38
  return invertedContrast >= 3 ? invertedBg : fallbackBg;
37
39
  }
38
40
  export const ChartTable = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
39
- const { headers, rows, width, height } = props;
41
+ const { headers, rows, width, height, chartTitle } = props;
40
42
  const { chartContainerRef: _rootElem } = useImageExport(props.componentRef, true, false);
41
43
  const classes = useChartTableStyles(props);
44
+ const arrowAttributes = useArrowNavigationGroup({
45
+ axis: 'grid'
46
+ });
42
47
  if (!headers || headers.length === 0) {
43
48
  return /*#__PURE__*/ React.createElement("div", null, "No data available");
44
49
  }
@@ -74,23 +79,36 @@ export const ChartTable = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>
74
79
  }
75
80
  }
76
81
  }
82
+ const titleHeight = chartTitle ? 30 : 0;
83
+ const totalHeight = typeof height === 'number' ? height : 650;
84
+ const tableHeight = `${totalHeight - titleHeight}px`;
85
+ const svgWidth = typeof width === 'number' ? width : '100%';
86
+ const titleMaxWidth = typeof width === 'number' ? width - 20 : undefined;
87
+ const titleX = typeof width === 'number' ? width / 2 : 0;
77
88
  return /*#__PURE__*/ React.createElement("div", {
78
89
  ref: (el)=>{
79
90
  _rootElem.current = el;
80
91
  },
81
92
  className: classes.root,
82
93
  style: {
83
- height: height ? `${height}px` : '650px',
94
+ height: `${totalHeight}px`,
84
95
  overflow: 'hidden'
85
96
  }
86
97
  }, /*#__PURE__*/ React.createElement("svg", {
87
- width: width !== null && width !== void 0 ? width : '100%',
88
- height: height !== null && height !== void 0 ? height : '650px'
89
- }, /*#__PURE__*/ React.createElement("foreignObject", {
98
+ width: svgWidth,
99
+ height: `${totalHeight}px`
100
+ }, chartTitle && /*#__PURE__*/ React.createElement(ChartTitle, {
101
+ title: chartTitle,
102
+ x: titleX,
103
+ maxWidth: titleMaxWidth,
104
+ className: classes.chartTitle,
105
+ titleStyles: props.titleStyles,
106
+ tooltipClassName: classes.svgTooltip
107
+ }), /*#__PURE__*/ React.createElement("foreignObject", {
90
108
  x: "0",
91
- y: "0",
109
+ y: titleHeight,
92
110
  width: "100%",
93
- height: "100%"
111
+ height: tableHeight
94
112
  }, /*#__PURE__*/ React.createElement("div", {
95
113
  style: {
96
114
  maxHeight: height ? `${height}px` : '650px',
@@ -101,7 +119,8 @@ export const ChartTable = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>
101
119
  className: classes.table,
102
120
  style: {
103
121
  width: width ? `${width}px` : '100%'
104
- }
122
+ },
123
+ ...arrowAttributes
105
124
  }, /*#__PURE__*/ React.createElement("thead", null, /*#__PURE__*/ React.createElement("tr", null, headers.map((header, idx)=>{
106
125
  const style = {
107
126
  ...header === null || header === void 0 ? void 0 : header.style
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ChartTable/ChartTable.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartTableProps } from './ChartTable.types';\nimport { useChartTableStyles } from './useChartTableStyles.styles';\nimport { tokens } from '@fluentui/react-theme';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\nimport { resolveCSSVariables } from '../../utilities/utilities';\nimport { useImageExport } from '../../utilities/hooks';\n\nfunction invertHexColor(hex: string): string {\n const color = d3.color(hex);\n if (!color) {\n return tokens.colorNeutralForeground1!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(chartContainer: HTMLElement, foreground?: string, background?: string): string {\n const fallbackFg = tokens.colorNeutralForeground1;\n const fallbackBg = tokens.colorNeutralBackground1;\n if (!chartContainer) {\n return fallbackBg;\n }\n\n const resolvedFg = resolveCSSVariables(chartContainer, foreground || fallbackFg);\n const resolvedBg = resolveCSSVariables(chartContainer, background || fallbackBg);\n\n const fg = d3.color(resolvedFg);\n const bg = d3.color(resolvedBg);\n\n if (!fg || !bg) {\n return resolvedBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex());\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\n\nexport const ChartTable: React.FunctionComponent<ChartTableProps> = React.forwardRef<HTMLDivElement, ChartTableProps>(\n (props, forwardedRef) => {\n const { headers, rows, width, height } = props;\n const { chartContainerRef: _rootElem } = useImageExport(props.componentRef, true, false);\n const classes = useChartTableStyles(props);\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\n }\n\n return (\n <div\n ref={el => {\n _rootElem.current = el;\n }}\n className={classes.root as string}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classes.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => {\n const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(_rootElem.current!, fg, bg);\n }\n return (\n <th key={idx} className={classes.headerCell} style={style} tabIndex={0}>\n {header.value}\n </th>\n );\n })}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => {\n const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(_rootElem.current!, fg, bg);\n }\n return (\n <td key={colIdx} className={classes.bodyCell} style={style} tabIndex={0}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n },\n);\n\nChartTable.displayName = 'ChartTable';\n"],"names":["React","useChartTableStyles","tokens","d3","getColorContrast","resolveCSSVariables","useImageExport","invertHexColor","hex","color","colorNeutralForeground1","rgb","r","g","b","formatHex","getSafeBackgroundColor","chartContainer","foreground","background","fallbackFg","fallbackBg","colorNeutralBackground1","resolvedFg","resolvedBg","fg","bg","contrast","invertedBg","invertedContrast","ChartTable","forwardRef","props","forwardedRef","headers","rows","width","height","chartContainerRef","_rootElem","componentRef","classes","length","div","bgColorSet","Set","forEach","header","style","backgroundColor","normalized","add","sharedBackgroundColor","useSharedBackground","size","candidateBg","Array","from","ref","el","current","className","root","overflow","svg","foreignObject","x","y","maxHeight","overflowY","overflowX","table","thead","tr","map","idx","th","key","headerCell","tabIndex","value","tbody","row","rowIdx","cell","colIdx","td","bodyCell","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;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;YAChC,IAAIxB,MAAMC,IAAI;gBACZsB,MAAMC,eAAe,GAAGjC,uBAAuBuB,UAAUqB,OAAO,EAAGnC,IAAIC;YACzE;YACA,qBACE,oBAAC4D;gBAAGT,KAAKQ;gBAAQxB,WAAWpB,QAAQ8C,QAAQ;gBAAEvC,OAAOA;gBAAO+B,UAAU;eACnEK,KAAKJ,KAAK;QAGjB;AAWtB,GACA;AAEFlD,WAAW0D,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/ChartTable/ChartTable.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartTableProps } from './ChartTable.types';\nimport { useChartTableStyles } from './useChartTableStyles.styles';\nimport { tokens } from '@fluentui/react-theme';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\nimport { resolveCSSVariables } from '../../utilities/utilities';\nimport { ChartTitle } from '../../utilities/index';\nimport { useImageExport } from '../../utilities/hooks';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\n\nfunction invertHexColor(hex: string): string {\n const color = d3.color(hex);\n if (!color) {\n return tokens.colorNeutralForeground1!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(chartContainer: HTMLElement, foreground?: string, background?: string): string {\n const fallbackFg = tokens.colorNeutralForeground1;\n const fallbackBg = tokens.colorNeutralBackground1;\n if (!chartContainer) {\n return fallbackBg;\n }\n\n const resolvedFg = resolveCSSVariables(chartContainer, foreground || fallbackFg);\n const resolvedBg = resolveCSSVariables(chartContainer, background || fallbackBg);\n\n const fg = d3.color(resolvedFg);\n const bg = d3.color(resolvedBg);\n\n if (!fg || !bg) {\n return resolvedBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex());\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\n\nexport const ChartTable: React.FunctionComponent<ChartTableProps> = React.forwardRef<HTMLDivElement, ChartTableProps>(\n (props, forwardedRef) => {\n const { headers, rows, width, height, chartTitle } = props;\n const { chartContainerRef: _rootElem } = useImageExport(props.componentRef, true, false);\n const classes = useChartTableStyles(props);\n const arrowAttributes = useArrowNavigationGroup({ axis: 'grid' });\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\n }\n\n const titleHeight = chartTitle ? 30 : 0;\n const totalHeight = typeof height === 'number' ? height : 650;\n const tableHeight = `${totalHeight - titleHeight}px`;\n const svgWidth = typeof width === 'number' ? width : '100%';\n const titleMaxWidth = typeof width === 'number' ? width - 20 : undefined;\n const titleX = typeof width === 'number' ? width / 2 : 0;\n\n return (\n <div\n ref={el => {\n _rootElem.current = el;\n }}\n className={classes.root as string}\n style={{ height: `${totalHeight}px`, overflow: 'hidden' }}\n >\n <svg width={svgWidth} height={`${totalHeight}px`}>\n {chartTitle && (\n <ChartTitle\n title={chartTitle}\n x={titleX}\n maxWidth={titleMaxWidth}\n className={classes.chartTitle}\n titleStyles={props.titleStyles}\n tooltipClassName={classes.svgTooltip}\n />\n )}\n <foreignObject x=\"0\" y={titleHeight} width=\"100%\" height={tableHeight}>\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classes.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n {...arrowAttributes}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => {\n const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(_rootElem.current!, fg, bg);\n }\n return (\n <th key={idx} className={classes.headerCell} style={style} tabIndex={0}>\n {header.value}\n </th>\n );\n })}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => {\n const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(_rootElem.current!, fg, bg);\n }\n return (\n <td key={colIdx} className={classes.bodyCell} style={style} tabIndex={0}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n },\n);\n\nChartTable.displayName = 'ChartTable';\n"],"names":["React","useChartTableStyles","tokens","d3","getColorContrast","resolveCSSVariables","ChartTitle","useImageExport","useArrowNavigationGroup","invertHexColor","hex","color","colorNeutralForeground1","rgb","r","g","b","formatHex","getSafeBackgroundColor","chartContainer","foreground","background","fallbackFg","fallbackBg","colorNeutralBackground1","resolvedFg","resolvedBg","fg","bg","contrast","invertedBg","invertedContrast","ChartTable","forwardRef","props","forwardedRef","headers","rows","width","height","chartTitle","chartContainerRef","_rootElem","componentRef","classes","arrowAttributes","axis","length","div","bgColorSet","Set","forEach","header","style","backgroundColor","normalized","add","sharedBackgroundColor","useSharedBackground","size","candidateBg","Array","from","titleHeight","totalHeight","tableHeight","svgWidth","titleMaxWidth","undefined","titleX","ref","el","current","className","root","overflow","svg","title","x","maxWidth","titleStyles","tooltipClassName","svgTooltip","foreignObject","y","maxHeight","overflowY","overflowX","table","thead","tr","map","idx","th","key","headerCell","tabIndex","value","tbody","row","rowIdx","cell","colIdx","td","bodyCell","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,YAAYC,QAAQ,WAAW;AAC/B,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,uBAAuB,QAAQ,0BAA0B;AAElE,SAASC,eAAeC,GAAW;IACjC,MAAMC,QAAQR,GAAGQ,KAAK,CAACD;IACvB,IAAI,CAACC,OAAO;QACV,OAAOT,OAAOU,uBAAuB;IACvC;IACA,MAAMC,MAAMF,MAAME,GAAG;IACrB,OAAOV,GAAGU,GAAG,CAAC,MAAMA,IAAIC,CAAC,EAAE,MAAMD,IAAIE,CAAC,EAAE,MAAMF,IAAIG,CAAC,EAAEC,SAAS;AAChE;AAEA,SAASC,uBAAuBC,cAA2B,EAAEC,UAAmB,EAAEC,UAAmB;IACnG,MAAMC,aAAapB,OAAOU,uBAAuB;IACjD,MAAMW,aAAarB,OAAOsB,uBAAuB;IACjD,IAAI,CAACL,gBAAgB;QACnB,OAAOI;IACT;IAEA,MAAME,aAAapB,oBAAoBc,gBAAgBC,cAAcE;IACrE,MAAMI,aAAarB,oBAAoBc,gBAAgBE,cAAcE;IAEr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B;AAWtB,GACA;AAEFjE,WAAWyE,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ChartTable/ChartTable.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { Chart } from './index';\n\n/**\n * Chart Table properties\n * {@docCategory ChartTable}\n */\nexport interface ChartTableProps {\n /**\n * 1d or 2d Array of header values.\n */\n headers: { value: string | number | boolean | null; style?: React.CSSProperties }[];\n\n /**\n * Array of rows. Each row corresponds to one data entry under each column.\n */\n rows: { value: string | number | boolean | null; style?: React.CSSProperties }[][];\n\n /**\n * Optional width for the table\n * @default '100%'\n */\n width?: string | number;\n\n /**\n * Optional height for the table\n * @default '650px'\n */\n height?: string | number;\n\n /**\n * Additional class name(s) to apply to the table chart\n */\n className?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ChartTableStyles;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<Chart>;\n}\n\n/**\n * Table Chart styles\n * {@docCategory ChartTable}\n */\nexport interface ChartTableStyles {\n root?: string | React.CSSProperties;\n table?: string;\n headerCell?: string;\n bodyCell?: string;\n chart?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../src/components/ChartTable/ChartTable.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TitleStyles } from '../../utilities/Common.styles';\nimport { Chart } from './index';\n\n/**\n * Chart Table properties\n * {@docCategory ChartTable}\n */\nexport interface ChartTableProps {\n /**\n * Title styles configuration for the chart title\n */\n titleStyles?: TitleStyles;\n\n /**\n * 1d or 2d Array of header values.\n */\n headers: { value: string | number | boolean | null; style?: React.CSSProperties }[];\n\n /**\n * Array of rows. Each row corresponds to one data entry under each column.\n */\n rows: { value: string | number | boolean | null; style?: React.CSSProperties }[][];\n\n /**\n * Optional width for the table\n * @default '100%'\n */\n width?: string | number;\n\n /**\n * Optional height for the table\n * @default '650px'\n */\n height?: string | number;\n\n /**\n * Chart title to display above the table\n */\n chartTitle?: string;\n\n /**\n * Additional class name(s) to apply to the table chart\n */\n className?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ChartTableStyles;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<Chart>;\n}\n\n/**\n * Table Chart styles\n * {@docCategory ChartTable}\n */\nexport interface ChartTableStyles {\n root?: string | React.CSSProperties;\n table?: string;\n headerCell?: string;\n bodyCell?: string;\n chart?: string;\n chartTitle?: string;\n svgTooltip?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { __styles, mergeClasses } from '@griffel/react';
4
4
  import { tokens, typographyStyles } from '@fluentui/react-theme';
5
+ import { getChartTitleStyles, HighContrastSelector } from '../../utilities/index';
5
6
  /**
6
7
  * @internal
7
8
  */
@@ -10,7 +11,9 @@ export const chartTableClassNames = {
10
11
  table: 'fui-ChartTable__table',
11
12
  headerCell: 'fui-ChartTable__headerCell',
12
13
  bodyCell: 'fui-ChartTable__bodyCell',
13
- chart: 'fui-ChartTable__chart'
14
+ chart: 'fui-ChartTable__chart',
15
+ chartTitle: 'fui-ChartTable__chartTitle',
16
+ svgTooltip: 'fui-ChartTable__svgTooltip'
14
17
  };
15
18
  const useStyles = /*#__PURE__*/__styles({
16
19
  root: {
@@ -83,6 +86,20 @@ const useStyles = /*#__PURE__*/__styles({
83
86
  sj55zd: "f19n0e5",
84
87
  fsow6f: ["f1o700av", "fes3tcz"],
85
88
  B7iucu3: "fhs7xo9"
89
+ },
90
+ chartTitle: {
91
+ Bahqtrf: "fk6fouc",
92
+ Be2twd7: "f13mqy1h",
93
+ Bhrd7zp: "fl43uef",
94
+ Bg96gwp: "fcpl73t",
95
+ Bkfmm31: "fhuob2q",
96
+ Bvjb7m6: "fhv2zbx",
97
+ fsow6f: "f17mccla",
98
+ jrapky: "fqcjy3b"
99
+ },
100
+ svgTooltip: {
101
+ Bkfmm31: "f5q6cfr",
102
+ Bxms50k: "f1bgda6t"
86
103
  }
87
104
  }, {
88
105
  d: [".fly5x3f{width:100%;}", ".f1oy3dpc{overflow-x:auto;}", ".fgkb47j{border-collapse:collapse;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f16xq7d1{background-color:var(--colorNeutralBackground3);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", [".f1bnz8pu{padding:var(--spacingHorizontalS);}", {
@@ -93,11 +110,13 @@ const useStyles = /*#__PURE__*/__styles({
93
110
  p: -1
94
111
  }], [".fox1scm{border:var(--strokeWidthThick) solid var(--colorNeutralStroke2);}", {
95
112
  p: -2
96
- }]],
113
+ }], ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".fcpl73t{line-height:var(--lineHeightBase100);}", ".fhuob2q{fill:var(--colorNeutralForeground1);}", ".fhv2zbx{forced-color-adjust:auto;}", ".f17mccla{text-align:center;}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f5q6cfr{fill:var(--colorNeutralBackground1);}"],
97
114
  m: [["@media (forced-colors: active){.ftx6bta{background-color:Window;}}", {
98
115
  m: "(forced-colors: active)"
99
116
  }], ["@media (forced-colors: active){.fhs7xo9{color:WindowText;}}", {
100
117
  m: "(forced-colors: active)"
118
+ }], ["@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f1bgda6t{fill:Canvas;}}", {
119
+ m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
101
120
  }]]
102
121
  });
103
122
  /**
@@ -110,6 +129,8 @@ export const useChartTableStyles = props => {
110
129
  table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/),
111
130
  headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/),
112
131
  bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/),
113
- chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/)
132
+ chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/),
133
+ chartTitle: mergeClasses(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/),
134
+ svgTooltip: mergeClasses(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/)
114
135
  };
115
136
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","mergeClasses","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","a9b677","B68tc82","po53p8","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","De3pzq","sj55zd","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","fsow6f","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","By8wz76","B7iucu3","d","p","m","useChartTableStyles","props","baseStyles"],"sources":["useChartTableStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const chartTableClassNames = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart'\n};\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto'\n },\n table: {\n borderCollapse: 'collapse'\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n padding: tokens.spacingHorizontalS,\n textAlign: 'left',\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText'\n }\n },\n bodyCell: {\n ...typographyStyles.caption1,\n padding: tokens.spacingHorizontalS,\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText'\n }\n }\n});\n/**\n * Apply styling to the ChartTable slots based on the state\n */ export const useChartTableStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ )\n };\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE;AACA;AACA;AAAI,OAAO,MAAMC,oBAAoB,GAAG;EACpCC,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE,uBAAuB;EAC9BC,UAAU,EAAE,4BAA4B;EACxCC,QAAQ,EAAE,0BAA0B;EACpCC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,SAAS,gBAAGV,QAAA;EAAAK,IAAA;IAAAM,MAAA;IAAAC,OAAA;EAAA;EAAAN,KAAA;IAAAO,MAAA;EAAA;EAAAN,UAAA;IAAAO,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MA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G,oBAAoB,CAACG,UAAU,EAAE2C,UAAU,CAAC3C,UAAU,CAAC,4BAA6B,CAAC;IAC9GC,QAAQ,EAAEP,YAAY,CAACG,oBAAoB,CAACI,QAAQ,EAAE0C,UAAU,CAAC1C,QAAQ,CAAC,0BAA2B,CAAC;IACtGC,KAAK,EAAER,YAAY,CAACG,oBAAoB,CAACK,KAAK,CAAC,uBAAwB;EAC3E,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__styles","mergeClasses","tokens","typographyStyles","getChartTitleStyles","HighContrastSelector","chartTableClassNames","root","table","headerCell","bodyCell","chart","chartTitle","svgTooltip","useStyles","a9b677","B68tc82","po53p8","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","De3pzq","sj55zd","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","fsow6f","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","By8wz76","B7iucu3","Bkfmm31","Bvjb7m6","jrapky","Bxms50k","d","p","m","useChartTableStyles","props","baseStyles"],"sources":["useChartTableStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { getChartTitleStyles, HighContrastSelector } from '../../utilities/index';\n/**\n * @internal\n */ export const chartTableClassNames = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart',\n chartTitle: 'fui-ChartTable__chartTitle',\n svgTooltip: 'fui-ChartTable__svgTooltip'\n};\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto'\n },\n table: {\n borderCollapse: 'collapse'\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n padding: tokens.spacingHorizontalS,\n textAlign: 'left',\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText'\n }\n },\n bodyCell: {\n ...typographyStyles.caption1,\n padding: tokens.spacingHorizontalS,\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText'\n }\n },\n chartTitle: getChartTitleStyles(),\n svgTooltip: {\n fill: tokens.colorNeutralBackground1,\n [HighContrastSelector]: {\n fill: 'Canvas'\n }\n }\n});\n/**\n * Apply styling to the ChartTable slots based on the state\n */ export const useChartTableStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ ),\n chartTitle: mergeClasses(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/ ),\n svgTooltip: mergeClasses(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/ )\n };\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,uBAAuB;AACjF;AACA;AACA;AAAI,OAAO,MAAMC,oBAAoB,GAAG;EACpCC,IAAI,E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AAArB,MAAA;IAAAsB,MAAA;EAAA;EAAAtC,UAAA;IAAAoC,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;EAAAC,CAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAsCjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,mBAAmB,GAAIC,KAAK,IAAG;EAC5C,MAAMC,UAAU,GAAG5C,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHP,IAAI,EAAEN,YAAY,CAACK,oBAAoB,CAACC,IAAI,EAAEmD,UAAU,CAACnD,IAAI,CAAC,sBAAuB,CAAC;IACtFC,KAAK,EAAEP,YAAY,CAACK,oBAAoB,CAACE,KAAK,EAAEkD,UAAU,CAAClD,KAAK,CAAC,uBAAwB,CAAC;IAC1FC,UAAU,EAAER,YAAY,CAACK,oBAAoB,CAACG,UAAU,EAAEiD,UAAU,CAACjD,UAAU,CAAC,4BAA6B,CAAC;IAC9GC,QAAQ,EAAET,YAAY,CAACK,oBAAoB,CAACI,QAAQ,EAAEgD,UAAU,CAAChD,QAAQ,CAAC,0BAA2B,CAAC;IACtGC,KAAK,EAAEV,YAAY,CAACK,oBAAoB,CAACK,KAAK,CAAC,uBAAwB,CAAC;IACxEC,UAAU,EAAEX,YAAY,CAACK,oBAAoB,CAACM,UAAU,EAAE8C,UAAU,CAAC9C,UAAU,CAAC,4BAA6B,CAAC;IAC9GC,UAAU,EAAEZ,YAAY,CAACK,oBAAoB,CAACO,UAAU,EAAE6C,UAAU,CAAC7C,UAAU,CAAC,4BAA6B;EACjH,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { makeStyles, mergeClasses } from '@griffel/react';
3
3
  import { tokens, typographyStyles } from '@fluentui/react-theme';
4
+ import { getChartTitleStyles, HighContrastSelector } from '../../utilities/index';
4
5
  /**
5
6
  * @internal
6
7
  */ export const chartTableClassNames = {
@@ -8,7 +9,9 @@ import { tokens, typographyStyles } from '@fluentui/react-theme';
8
9
  table: 'fui-ChartTable__table',
9
10
  headerCell: 'fui-ChartTable__headerCell',
10
11
  bodyCell: 'fui-ChartTable__bodyCell',
11
- chart: 'fui-ChartTable__chart'
12
+ chart: 'fui-ChartTable__chart',
13
+ chartTitle: 'fui-ChartTable__chartTitle',
14
+ svgTooltip: 'fui-ChartTable__svgTooltip'
12
15
  };
13
16
  const useStyles = makeStyles({
14
17
  root: {
@@ -40,6 +43,13 @@ const useStyles = makeStyles({
40
43
  '@media (forced-colors: active)': {
41
44
  color: 'WindowText'
42
45
  }
46
+ },
47
+ chartTitle: getChartTitleStyles(),
48
+ svgTooltip: {
49
+ fill: tokens.colorNeutralBackground1,
50
+ [HighContrastSelector]: {
51
+ fill: 'Canvas'
52
+ }
43
53
  }
44
54
  });
45
55
  /**
@@ -51,6 +61,8 @@ const useStyles = makeStyles({
51
61
  table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
52
62
  headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
53
63
  bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
54
- chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ )
64
+ chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ ),
65
+ chartTitle: mergeClasses(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/ ),
66
+ svgTooltip: mergeClasses(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/ )
55
67
  };
56
68
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ChartTable/useChartTableStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { ChartTableProps, ChartTableStyles } from './ChartTable.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\n/**\n * @internal\n */\nexport const chartTableClassNames: SlotClassNames<ChartTableStyles> = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart',\n};\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto',\n },\n table: {\n borderCollapse: 'collapse',\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n padding: tokens.spacingHorizontalS,\n textAlign: 'left',\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText',\n },\n },\n bodyCell: {\n ...typographyStyles.caption1,\n padding: tokens.spacingHorizontalS,\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText',\n },\n },\n});\n\n/**\n * Apply styling to the ChartTable slots based on the state\n */\nexport const useChartTableStyles = (props: ChartTableProps): ChartTableStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","width","overflowX","borderCollapse","caption1","fontWeight","fontWeightSemibold","backgroundColor","colorNeutralBackground3","color","colorNeutralForeground1","padding","spacingHorizontalS","textAlign","border","strokeWidthThick","colorNeutralStroke2","useChartTableStyles","props","baseStyles"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAG1D,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AAEjE;;CAEC,GACD,OAAO,MAAMC,uBAAyD;IACpEC,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,UAAU;IACVC,OAAO;AACT,EAAE;AAEF,MAAMC,YAAYV,WAAW;IAC3BK,MAAM;QACJM,OAAO;QACPC,WAAW;IACb;IACAN,OAAO;QACLO,gBAAgB;IAClB;IACAN,YAAY;QACV,GAAGJ,iBAAiBW,QAAQ;QAC5BC,YAAYb,OAAOc,kBAAkB;QACrCC,iBAAiBf,OAAOgB,uBAAuB;QAC/CC,OAAOjB,OAAOkB,uBAAuB;QACrCC,SAASnB,OAAOoB,kBAAkB;QAClCC,WAAW;QACXC,QAAQ,GAAGtB,OAAOuB,gBAAgB,CAAC,OAAO,EAAEvB,OAAOwB,mBAAmB,EAAE;QACxE,kCAAkC;YAChCT,iBAAiB;YACjBE,OAAO;QACT;IACF;IACAX,UAAU;QACR,GAAGL,iBAAiBW,QAAQ;QAC5BO,SAASnB,OAAOoB,kBAAkB;QAClCE,QAAQ,GAAGtB,OAAOuB,gBAAgB,CAAC,OAAO,EAAEvB,OAAOwB,mBAAmB,EAAE;QACxEP,OAAOjB,OAAOkB,uBAAuB;QACrCG,WAAW;QACX,kCAAkC;YAChCJ,OAAO;QACT;IACF;AACF;AAEA;;CAEC,GACD,OAAO,MAAMQ,sBAAsB,CAACC;IAClC,MAAMC,aAAanB;IAEnB,OAAO;QACLL,MAAMJ,aAAaG,qBAAqBC,IAAI,EAAEwB,WAAWxB,IAAI,CAAC,oBAAoB;QAClFC,OAAOL,aAAaG,qBAAqBE,KAAK,EAAEuB,WAAWvB,KAAK,CAAC,qBAAqB;QACtFC,YAAYN,aAAaG,qBAAqBG,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;QAC1GC,UAAUP,aAAaG,qBAAqBI,QAAQ,EAAEqB,WAAWrB,QAAQ,CAAC,wBAAwB;QAClGC,OAAOR,aAAaG,qBAAqBK,KAAK,CAAC,qBAAqB;IACtE;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/ChartTable/useChartTableStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { GriffelStyle, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { ChartTableProps, ChartTableStyles } from './ChartTable.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { getChartTitleStyles, HighContrastSelector } from '../../utilities/index';\n\n/**\n * @internal\n */\nexport const chartTableClassNames: SlotClassNames<ChartTableStyles> = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart',\n chartTitle: 'fui-ChartTable__chartTitle',\n svgTooltip: 'fui-ChartTable__svgTooltip',\n};\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto',\n },\n table: {\n borderCollapse: 'collapse',\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n padding: tokens.spacingHorizontalS,\n textAlign: 'left',\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText',\n },\n },\n bodyCell: {\n ...typographyStyles.caption1,\n padding: tokens.spacingHorizontalS,\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText',\n },\n },\n chartTitle: getChartTitleStyles() as GriffelStyle,\n svgTooltip: {\n fill: tokens.colorNeutralBackground1,\n [HighContrastSelector]: {\n fill: 'Canvas',\n },\n },\n});\n\n/**\n * Apply styling to the ChartTable slots based on the state\n */\nexport const useChartTableStyles = (props: ChartTableProps): ChartTableStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/),\n chartTitle: mergeClasses(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/),\n svgTooltip: mergeClasses(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","getChartTitleStyles","HighContrastSelector","chartTableClassNames","root","table","headerCell","bodyCell","chart","chartTitle","svgTooltip","useStyles","width","overflowX","borderCollapse","caption1","fontWeight","fontWeightSemibold","backgroundColor","colorNeutralBackground3","color","colorNeutralForeground1","padding","spacingHorizontalS","textAlign","border","strokeWidthThick","colorNeutralStroke2","fill","colorNeutralBackground1","useChartTableStyles","props","baseStyles"],"mappings":"AAAA;AAEA,SAAuBA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAGxE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AACjE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAElF;;CAEC,GACD,OAAO,MAAMC,uBAAyD;IACpEC,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,UAAU;IAC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BK,KAAK,CAAC,qBAAqB;QACpEC,YAAYX,aAAaK,qBAAqBM,UAAU,EAAEuB,WAAWvB,UAAU,CAAC,0BAA0B;QAC1GC,YAAYZ,aAAaK,qBAAqBO,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;IAC5G;AACF,EAAE"}
@@ -14,10 +14,6 @@ const ARROW_SIZE_SCALE = 0.35;
14
14
  const MAX_SIMPLE_MARKUP_DEPTH = 5;
15
15
  const CHAR_CODE_LESS_THAN = '<'.codePointAt(0);
16
16
  const CHAR_CODE_GREATER_THAN = '>'.codePointAt(0);
17
- const getAnnotationKey = (annotation, index)=>{
18
- var _annotation_id, _ref;
19
- return (_ref = (_annotation_id = annotation.id) !== null && _annotation_id !== void 0 ? _annotation_id : typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) !== null && _ref !== void 0 ? _ref : `annotation-${index}`;
20
- };
21
17
  const decodeSimpleMarkupInput = (input)=>{
22
18
  const namedEntities = {
23
19
  amp: '&',
@@ -216,6 +212,40 @@ const normalizeBandOffset = (scale, value)=>{
216
212
  return position;
217
213
  };
218
214
  const clamp = (value, min, max)=>Math.max(min, Math.min(max, value));
215
+ const resolveDataCoordinate = (axis, value, context, yAxis = 'primary')=>{
216
+ if (axis === 'x') {
217
+ const xScale = context.xScale;
218
+ if (!xScale) {
219
+ return undefined;
220
+ }
221
+ const parsedValue = value instanceof Date ? value.getTime() : value;
222
+ return normalizeBandOffset(xScale, parsedValue);
223
+ }
224
+ const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
225
+ if (!yScale) {
226
+ return undefined;
227
+ }
228
+ const parsedValue = value instanceof Date ? value.getTime() : value;
229
+ return normalizeBandOffset(yScale, parsedValue);
230
+ };
231
+ const resolveAxisCoordinate = (axis, coordinateType, value, context, options = {})=>{
232
+ switch(coordinateType){
233
+ case 'data':
234
+ return resolveDataCoordinate(axis, value, context, options.yAxis);
235
+ case 'relative':
236
+ if (typeof value !== 'number' || Number.isNaN(value)) {
237
+ return undefined;
238
+ }
239
+ return axis === 'x' ? context.plotRect.x + context.plotRect.width * value : context.plotRect.y + context.plotRect.height * value;
240
+ case 'pixel':
241
+ if (typeof value !== 'number' || Number.isNaN(value)) {
242
+ return undefined;
243
+ }
244
+ return axis === 'x' ? context.plotRect.x + value : context.plotRect.y + value;
245
+ default:
246
+ return undefined;
247
+ }
248
+ };
219
249
  const createMeasurementSignature = (annotationContentSignature, containerStyle, contentStyle, layoutClassName, styleClassName)=>JSON.stringify({
220
250
  annotationContentSignature,
221
251
  containerStyle,
@@ -223,58 +253,58 @@ const createMeasurementSignature = (annotationContentSignature, containerStyle,
223
253
  layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
224
254
  styleClassName: styleClassName !== null && styleClassName !== void 0 ? styleClassName : ''
225
255
  });
256
+ const getCoordinateDescriptor = (coordinates)=>{
257
+ switch(coordinates.type){
258
+ case 'data':
259
+ return {
260
+ xType: 'data',
261
+ yType: 'data',
262
+ yAxis: coordinates.yAxis
263
+ };
264
+ case 'relative':
265
+ return {
266
+ xType: 'relative',
267
+ yType: 'relative'
268
+ };
269
+ case 'pixel':
270
+ return {
271
+ xType: 'pixel',
272
+ yType: 'pixel'
273
+ };
274
+ case 'mixed':
275
+ return {
276
+ xType: coordinates.xCoordinateType,
277
+ yType: coordinates.yCoordinateType,
278
+ yAxis: coordinates.yAxis
279
+ };
280
+ default:
281
+ return undefined;
282
+ }
283
+ };
226
284
  const resolveCoordinates = (annotation, context)=>{
227
285
  const { coordinates, layout } = annotation;
228
286
  if (!coordinates) {
229
287
  return undefined;
230
288
  }
289
+ const descriptor = getCoordinateDescriptor(coordinates);
290
+ if (!descriptor) {
291
+ return undefined;
292
+ }
231
293
  var _layout_offsetX;
232
294
  const offsetX = (_layout_offsetX = layout === null || layout === void 0 ? void 0 : layout.offsetX) !== null && _layout_offsetX !== void 0 ? _layout_offsetX : 0;
233
295
  var _layout_offsetY;
234
296
  const offsetY = (_layout_offsetY = layout === null || layout === void 0 ? void 0 : layout.offsetY) !== null && _layout_offsetY !== void 0 ? _layout_offsetY : 0;
297
+ const anchorX = resolveAxisCoordinate('x', descriptor.xType, coordinates.x, context);
298
+ const anchorY = resolveAxisCoordinate('y', descriptor.yType, coordinates.y, context, {
299
+ yAxis: descriptor.yAxis
300
+ });
301
+ if (anchorX === undefined || anchorY === undefined) {
302
+ return undefined;
303
+ }
235
304
  const anchor = {
236
- x: 0,
237
- y: 0
305
+ x: anchorX,
306
+ y: anchorY
238
307
  };
239
- switch(coordinates.type){
240
- case 'data':
241
- {
242
- const { x, y, yAxis = 'primary' } = coordinates;
243
- const xScale = context.xScale;
244
- const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
245
- if (!xScale || !yScale) {
246
- return undefined;
247
- }
248
- const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);
249
- const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);
250
- if (typeof xValue !== 'number' || typeof yValue !== 'number') {
251
- return undefined;
252
- }
253
- anchor.x = xValue;
254
- anchor.y = yValue;
255
- break;
256
- }
257
- case 'relative':
258
- {
259
- if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
260
- return undefined;
261
- }
262
- anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;
263
- anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;
264
- break;
265
- }
266
- case 'pixel':
267
- {
268
- if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
269
- return undefined;
270
- }
271
- anchor.x = context.plotRect.x + coordinates.x;
272
- anchor.y = context.plotRect.y + coordinates.y;
273
- break;
274
- }
275
- default:
276
- return undefined;
277
- }
278
308
  let left = anchor.x + offsetX;
279
309
  let top = anchor.y + offsetY;
280
310
  if (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) {
@@ -290,15 +320,23 @@ const resolveCoordinates = (annotation, context)=>{
290
320
  };
291
321
  };
292
322
  export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
293
- const { annotations: annotationsProp, context } = props;
323
+ const { annotations: annotationsProp, context, hideDefaultStyles } = props;
294
324
  const classes = useChartAnnotationLayerStyles(props);
295
325
  const idPrefix = useId('chart-annotation');
326
+ const autoKeyPrefix = useId('chart-annotation-item');
296
327
  const [measurements, setMeasurements] = React.useState({});
297
- const resolvedAnnotations = React.useMemo(()=>(annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map((annotation, index)=>({
328
+ const resolvedAnnotations = React.useMemo(()=>{
329
+ let fallbackIndex = 0;
330
+ return (annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map((annotation)=>{
331
+ var _annotation_id;
332
+ return {
298
333
  annotation,
299
- key: getAnnotationKey(annotation, index)
300
- })), [
301
- annotationsProp
334
+ key: (_annotation_id = annotation.id) !== null && _annotation_id !== void 0 ? _annotation_id : `${autoKeyPrefix}-${fallbackIndex++}`
335
+ };
336
+ });
337
+ }, [
338
+ annotationsProp,
339
+ autoKeyPrefix
302
340
  ]);
303
341
  React.useEffect(()=>{
304
342
  setMeasurements((prev)=>{
@@ -354,7 +392,7 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
354
392
  const measurementElements = [];
355
393
  const connectors = [];
356
394
  resolvedAnnotations.forEach(({ annotation, key })=>{
357
- var _annotation_style, _annotation_style1, _annotation_style2, _annotation_style3, _annotation_style4, _annotation_style5, _annotation_style6, _annotation_style7, _annotation_style8, _annotation_style9, _annotation_style10, _annotation_style11, _annotation_style12, _annotation_style13, _annotation_style14, _annotation_style15, _annotation_style16, _annotation_style17, _annotation_accessibility, _annotation_accessibility1, _annotation_accessibility2;
395
+ var _annotation_style, _annotation_style1, _annotation_style2, _annotation_style3, _annotation_style4, _annotation_style5, _annotation_style6, _annotation_style7, _annotation_style8, _annotation_style9, _annotation_style10, _annotation_style11, _annotation_style12, _annotation_style13, _annotation_style14, _annotation_style15, _annotation_style16, _annotation_style17, _annotation_style18, _annotation_accessibility, _annotation_accessibility1, _annotation_accessibility2;
358
396
  const resolved = resolveCoordinates(annotation, context);
359
397
  if (!resolved) {
360
398
  return;
@@ -376,28 +414,30 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
376
414
  const containerStyle = {
377
415
  maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth,
378
416
  ...hasCustomBackground ? {
379
- backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity)
380
- } : {
417
+ backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity, {
418
+ preserveOriginalOpacity: ((_annotation_style4 = annotation.style) === null || _annotation_style4 === void 0 ? void 0 : _annotation_style4.opacity) === undefined
419
+ })
420
+ } : hideDefaultStyles ? {} : {
381
421
  backgroundColor: applyOpacityToColor(tokens.colorNeutralBackground1, DEFAULT_ANNOTATION_BACKGROUND_OPACITY)
382
422
  },
383
- borderColor: (_annotation_style4 = annotation.style) === null || _annotation_style4 === void 0 ? void 0 : _annotation_style4.borderColor,
384
- borderWidth: (_annotation_style5 = annotation.style) === null || _annotation_style5 === void 0 ? void 0 : _annotation_style5.borderWidth,
385
- borderStyle: (_annotation_style_borderStyle = (_annotation_style6 = annotation.style) === null || _annotation_style6 === void 0 ? void 0 : _annotation_style6.borderStyle) !== null && _annotation_style_borderStyle !== void 0 ? _annotation_style_borderStyle : ((_annotation_style7 = annotation.style) === null || _annotation_style7 === void 0 ? void 0 : _annotation_style7.borderColor) ? 'solid' : undefined,
386
- borderRadius: (_annotation_style8 = annotation.style) === null || _annotation_style8 === void 0 ? void 0 : _annotation_style8.borderRadius,
387
- padding: (_annotation_style9 = annotation.style) === null || _annotation_style9 === void 0 ? void 0 : _annotation_style9.padding,
388
- boxShadow: (_annotation_style10 = annotation.style) === null || _annotation_style10 === void 0 ? void 0 : _annotation_style10.boxShadow
423
+ borderColor: (_annotation_style5 = annotation.style) === null || _annotation_style5 === void 0 ? void 0 : _annotation_style5.borderColor,
424
+ borderWidth: (_annotation_style6 = annotation.style) === null || _annotation_style6 === void 0 ? void 0 : _annotation_style6.borderWidth,
425
+ borderStyle: (_annotation_style_borderStyle = (_annotation_style7 = annotation.style) === null || _annotation_style7 === void 0 ? void 0 : _annotation_style7.borderStyle) !== null && _annotation_style_borderStyle !== void 0 ? _annotation_style_borderStyle : ((_annotation_style8 = annotation.style) === null || _annotation_style8 === void 0 ? void 0 : _annotation_style8.borderColor) ? 'solid' : undefined,
426
+ borderRadius: (_annotation_style9 = annotation.style) === null || _annotation_style9 === void 0 ? void 0 : _annotation_style9.borderRadius,
427
+ padding: (_annotation_style10 = annotation.style) === null || _annotation_style10 === void 0 ? void 0 : _annotation_style10.padding,
428
+ boxShadow: (_annotation_style11 = annotation.style) === null || _annotation_style11 === void 0 ? void 0 : _annotation_style11.boxShadow
389
429
  };
390
430
  const contentStyle = {
391
- color: (_annotation_style11 = annotation.style) === null || _annotation_style11 === void 0 ? void 0 : _annotation_style11.textColor,
392
- fontSize: (_annotation_style12 = annotation.style) === null || _annotation_style12 === void 0 ? void 0 : _annotation_style12.fontSize,
393
- fontWeight: (_annotation_style13 = annotation.style) === null || _annotation_style13 === void 0 ? void 0 : _annotation_style13.fontWeight,
431
+ color: (_annotation_style12 = annotation.style) === null || _annotation_style12 === void 0 ? void 0 : _annotation_style12.textColor,
432
+ fontSize: (_annotation_style13 = annotation.style) === null || _annotation_style13 === void 0 ? void 0 : _annotation_style13.fontSize,
433
+ fontWeight: (_annotation_style14 = annotation.style) === null || _annotation_style14 === void 0 ? void 0 : _annotation_style14.fontWeight,
394
434
  opacity: 1
395
435
  };
396
- if (typeof ((_annotation_style14 = annotation.style) === null || _annotation_style14 === void 0 ? void 0 : _annotation_style14.rotation) === 'number' && !Number.isNaN(annotation.style.rotation)) {
436
+ if (typeof ((_annotation_style15 = annotation.style) === null || _annotation_style15 === void 0 ? void 0 : _annotation_style15.rotation) === 'number' && !Number.isNaN(annotation.style.rotation)) {
397
437
  containerStyle.transform = `rotate(${annotation.style.rotation}deg)`;
398
438
  containerStyle.transformOrigin = '50% 50%';
399
439
  }
400
- const measurementSignature = createMeasurementSignature(annotationMarkupSignature, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style15 = annotation.style) === null || _annotation_style15 === void 0 ? void 0 : _annotation_style15.className);
440
+ const measurementSignature = createMeasurementSignature(annotationMarkupSignature, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style16 = annotation.style) === null || _annotation_style16 === void 0 ? void 0 : _annotation_style16.className);
401
441
  const measurementEntry = measurements[key];
402
442
  const isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
403
443
  const measuredSize = isMeasurementValid ? measurementEntry : undefined;
@@ -463,8 +503,9 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
463
503
  visibility: 'hidden',
464
504
  ...containerStyle
465
505
  };
506
+ const annotationClass = hideDefaultStyles ? classes.annotationNoDefaults : classes.annotation;
466
507
  if (!isMeasurementValid) {
467
- var _annotation_style18, _annotation_style19;
508
+ var _annotation_style19, _annotation_style20;
468
509
  measurementElements.push(/*#__PURE__*/ React.createElement("div", {
469
510
  key: `${key}-measurement`,
470
511
  ref: (node)=>{
@@ -475,13 +516,13 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
475
516
  }
476
517
  }
477
518
  },
478
- className: mergeClasses(classes.annotation, classes.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
519
+ className: mergeClasses(annotationClass, classes.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style19 = annotation.style) === null || _annotation_style19 === void 0 ? void 0 : _annotation_style19.className),
479
520
  style: measurementStyle,
480
521
  "aria-hidden": true,
481
522
  "data-annotation-key": key,
482
523
  "data-chart-annotation-measurement": "true"
483
524
  }, /*#__PURE__*/ React.createElement("div", {
484
- className: mergeClasses(classes.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style19 = annotation.style) === null || _annotation_style19 === void 0 ? void 0 : _annotation_style19.className),
525
+ className: mergeClasses(classes.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style20 = annotation.style) === null || _annotation_style20 === void 0 ? void 0 : _annotation_style20.className),
485
526
  style: contentStyle
486
527
  }, renderSimpleMarkup(annotationMarkupNodes, `${key}-measurement`))));
487
528
  }
@@ -495,15 +536,16 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
495
536
  className: mergeClasses(classes.annotationForeignObject),
496
537
  "data-annotation-key": key
497
538
  }, /*#__PURE__*/ React.createElement("div", {
498
- className: mergeClasses(classes.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style16 = annotation.style) === null || _annotation_style16 === void 0 ? void 0 : _annotation_style16.className),
539
+ className: mergeClasses(annotationClass, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style17 = annotation.style) === null || _annotation_style17 === void 0 ? void 0 : _annotation_style17.className),
499
540
  style: containerStyle,
500
541
  "data-annotation-key": key
501
542
  }, /*#__PURE__*/ React.createElement("div", {
502
- className: mergeClasses(classes.annotationContent, (_annotation_style17 = annotation.style) === null || _annotation_style17 === void 0 ? void 0 : _annotation_style17.className),
543
+ className: mergeClasses(classes.annotationContent, classes.annotationContentInteractive, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
503
544
  style: contentStyle,
504
545
  role: (_annotation_accessibility_role = (_annotation_accessibility = annotation.accessibility) === null || _annotation_accessibility === void 0 ? void 0 : _annotation_accessibility.role) !== null && _annotation_accessibility_role !== void 0 ? _annotation_accessibility_role : 'note',
505
546
  "aria-label": (_annotation_accessibility_ariaLabel = (_annotation_accessibility1 = annotation.accessibility) === null || _annotation_accessibility1 === void 0 ? void 0 : _annotation_accessibility1.ariaLabel) !== null && _annotation_accessibility_ariaLabel !== void 0 ? _annotation_accessibility_ariaLabel : annotationPlainText ? annotationPlainText : undefined,
506
547
  "aria-describedby": (_annotation_accessibility2 = annotation.accessibility) === null || _annotation_accessibility2 === void 0 ? void 0 : _annotation_accessibility2.ariaDescribedBy,
548
+ tabIndex: 0,
507
549
  "data-chart-annotation": "true",
508
550
  "data-annotation-key": key
509
551
  }, renderSimpleMarkup(annotationMarkupNodes, `${key}-content`)))));