@fluentui/react-charts 9.3.8 → 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 (199) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/dist/index.d.ts +378 -0
  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/ChartTable/ChartTable.js +21 -7
  8. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  10. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  11. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  12. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  13. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  16. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  17. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +47 -3
  18. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  19. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  20. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  21. package/lib/components/CommonComponents/CartesianChart.js +32 -13
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +413 -210
  27. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  28. package/lib/components/DonutChart/DonutChart.js +18 -6
  29. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  30. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  31. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  32. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  33. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  34. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  35. package/lib/components/FunnelChart/FunnelChart.js +28 -6
  36. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  37. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  38. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  39. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  40. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  41. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  42. package/lib/components/GaugeChart/GaugeChart.js +7 -6
  43. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  44. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  45. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  46. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  47. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  48. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  50. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  51. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  52. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  53. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +58 -6
  54. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  55. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  56. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  57. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  58. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  59. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  60. package/lib/components/Legends/OverflowMenu.js +9 -2
  61. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  62. package/lib/components/LineChart/LineChart.js +5 -6
  63. package/lib/components/LineChart/LineChart.js.map +1 -1
  64. package/lib/components/PolarChart/PolarChart.js +577 -0
  65. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  66. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  67. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  68. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  69. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  70. package/lib/components/PolarChart/index.js +2 -0
  71. package/lib/components/PolarChart/index.js.map +1 -0
  72. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  73. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  74. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  75. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  76. package/lib/components/SankeyChart/SankeyChart.js +14 -4
  77. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  78. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  79. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
  80. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  81. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  82. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  83. package/lib/components/ScatterChart/ScatterChart.js +1 -5
  84. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
  86. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  87. package/lib/index.js +1 -0
  88. package/lib/index.js.map +1 -1
  89. package/lib/types/DataPoint.js +1 -1
  90. package/lib/types/DataPoint.js.map +1 -1
  91. package/lib/utilities/ChartTitle.js +45 -0
  92. package/lib/utilities/ChartTitle.js.map +1 -0
  93. package/lib/utilities/Common.styles.js +73 -1
  94. package/lib/utilities/Common.styles.js.map +1 -1
  95. package/lib/utilities/Common.styles.raw.js +70 -0
  96. package/lib/utilities/Common.styles.raw.js.map +1 -1
  97. package/lib/utilities/index.js +1 -0
  98. package/lib/utilities/index.js.map +1 -1
  99. package/lib/utilities/utilities.js +6 -6
  100. package/lib/utilities/utilities.js.map +1 -1
  101. package/lib-commonjs/PolarChart.js +6 -0
  102. package/lib-commonjs/PolarChart.js.map +1 -0
  103. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  104. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  105. package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
  106. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  107. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  108. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  109. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  111. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  112. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  113. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  114. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  115. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +58 -4
  116. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  118. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/CartesianChart.js +31 -12
  120. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  122. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  123. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  124. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +419 -213
  125. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  126. package/lib-commonjs/components/DonutChart/DonutChart.js +17 -5
  127. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  128. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  129. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  130. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  132. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/components/FunnelChart/FunnelChart.js +27 -5
  134. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  135. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  136. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  137. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  138. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  139. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  140. package/lib-commonjs/components/GaugeChart/GaugeChart.js +6 -5
  141. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  142. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  143. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  144. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  145. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  146. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  147. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  148. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  149. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  150. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  151. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +57 -5
  152. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  153. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  154. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  155. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  159. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  160. package/lib-commonjs/components/LineChart/LineChart.js +5 -6
  161. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  162. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  163. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  164. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  165. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  166. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  167. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  168. package/lib-commonjs/components/PolarChart/index.js +7 -0
  169. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  170. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  171. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  172. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  173. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  174. package/lib-commonjs/components/SankeyChart/SankeyChart.js +14 -4
  175. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  176. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  177. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
  178. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  179. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  180. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  181. package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -5
  182. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  183. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
  184. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  185. package/lib-commonjs/index.js +1 -0
  186. package/lib-commonjs/index.js.map +1 -1
  187. package/lib-commonjs/types/DataPoint.js +1 -1
  188. package/lib-commonjs/types/DataPoint.js.map +1 -1
  189. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  190. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  191. package/lib-commonjs/utilities/Common.styles.js +69 -0
  192. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  193. package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
  194. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  195. package/lib-commonjs/utilities/index.js +1 -0
  196. package/lib-commonjs/utilities/index.js.map +1 -1
  197. package/lib-commonjs/utilities/utilities.js +10 -4
  198. package/lib-commonjs/utilities/utilities.js.map +1 -1
  199. package/package.json +10 -16
@@ -5,6 +5,7 @@ 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';
9
10
  import { useArrowNavigationGroup } from '@fluentui/react-tabster';
10
11
  function invertHexColor(hex) {
@@ -37,7 +38,7 @@ function getSafeBackgroundColor(chartContainer, foreground, background) {
37
38
  return invertedContrast >= 3 ? invertedBg : fallbackBg;
38
39
  }
39
40
  export const ChartTable = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
40
- const { headers, rows, width, height } = props;
41
+ const { headers, rows, width, height, chartTitle } = props;
41
42
  const { chartContainerRef: _rootElem } = useImageExport(props.componentRef, true, false);
42
43
  const classes = useChartTableStyles(props);
43
44
  const arrowAttributes = useArrowNavigationGroup({
@@ -78,23 +79,36 @@ export const ChartTable = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>
78
79
  }
79
80
  }
80
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;
81
88
  return /*#__PURE__*/ React.createElement("div", {
82
89
  ref: (el)=>{
83
90
  _rootElem.current = el;
84
91
  },
85
92
  className: classes.root,
86
93
  style: {
87
- height: height ? `${height}px` : '650px',
94
+ height: `${totalHeight}px`,
88
95
  overflow: 'hidden'
89
96
  }
90
97
  }, /*#__PURE__*/ React.createElement("svg", {
91
- width: width !== null && width !== void 0 ? width : '100%',
92
- height: height !== null && height !== void 0 ? height : '650px'
93
- }, /*#__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", {
94
108
  x: "0",
95
- y: "0",
109
+ y: titleHeight,
96
110
  width: "100%",
97
- height: "100%"
111
+ height: tableHeight
98
112
  }, /*#__PURE__*/ React.createElement("div", {
99
113
  style: {
100
114
  maxHeight: height ? `${height}px` : '650px',
@@ -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';\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 } = 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 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 {...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","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","chartContainerRef","_rootElem","componentRef","classes","arrowAttributes","axis","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;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,cAAc,QAAQ,wBAAwB;AACvD,SAASC,uBAAuB,QAAQ,0BAA0B;AAElE,SAASC,eAAeC,GAAW;IACjC,MAAMC,QAAQP,GAAGO,KAAK,CAACD;IACvB,IAAI,CAACC,OAAO;QACV,OAAOR,OAAOS,uBAAuB;IACvC;IACA,MAAMC,MAAMF,MAAME,GAAG;IACrB,OAAOT,GAAGS,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,aAAanB,OAAOS,uBAAuB;IACjD,MAAMW,aAAap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,6BAAAA,OAAQC,KAAK,AAAhB;QAAiB;QACjC,MAAMzB,KAAKyB,MAAMzC,KAAK;QACtB,MAAMiB,KAAKwB,MAAMC,eAAe;QAEhC,IAAII,qBAAqB;YACvBL,MAAMC,eAAe,GAAGG;QAC1B,OAAO,IAAI7B,MAAMC,IAAI;YACnBwB,MAAMC,eAAe,GAAGnC,uBAAuBuB,UAAUuB,OAAO,EAAGrC,IAAIC;QACzE;QACA,qBACE,oBAACoD;YAAGC,KAAKF;YAAKd,WAAWtB,QAAQuC,UAAU;YAAE9B,OAAOA;YAAO+B,UAAU;WAClEhC,OAAOiC,KAAK;IAGnB,MAGH/C,QAAQA,KAAKS,MAAM,GAAG,mBACrB,oBAACuC,eACEhD,KAAKyC,GAAG,CAAC,CAACQ,KAAKC,uBACd,oBAACV;YAAGI,KAAKM;WACND,IAAIR,GAAG,CAAC,CAACU,MAAMC;YACd,MAAMrC,QAAQ;mBAAKoC,iBAAAA,2BAAAA,KAAMpC,KAAK,AAAd;YAAe;YAC/B,MAAMzB,KAAKyB,MAAMzC,KAAK;YACtB,MAAMiB,KAAKwB,MAAMC,eAAe;YAChC,IAAI1B,MAAMC,IAAI;gBACZwB,MAAMC,eAAe,GAAGnC,uBAAuBuB,UAAUuB,OAAO,EAAGrC,IAAIC;YACzE;YACA,qBACE,oBAAC8D;gBAAGT,KAAKQ;gBAAQxB,WAAWtB,QAAQgD,QAAQ;gBAAEvC,OAAOA;gBAAO+B,UAAU;eACnEK,KAAKJ,KAAK;QAGjB;AAWtB,GACA;AAEFpD,WAAW4D,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,yB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8B,OAAO,EAAG7C,IAAIC;QACzE;QACA,qBACE,oBAACiE;YAAGC,KAAKF;YAAKnB,WAAW7B,QAAQmD,UAAU;YAAE1C,OAAOA;YAAO2C,UAAU;WAClE5C,OAAO6C,KAAK;IAGnB,MAGH5D,QAAQA,KAAKU,MAAM,GAAG,mBACrB,oBAACmD,eACE7D,KAAKsD,GAAG,CAAC,CAACQ,KAAKC,uBACd,oBAACV;YAAGI,KAAKM;WACND,IAAIR,GAAG,CAAC,CAACU,MAAMC;YACd,MAAMjD,QAAQ;mBAAKgD,iBAAAA,2BAAAA,KAAMhD,KAAK,AAAd;YAAe;YAC/B,MAAM1B,KAAK0B,MAAM1C,KAAK;YACtB,MAAMiB,KAAKyB,MAAMC,eAAe;YAChC,IAAI3B,MAAMC,IAAI;gBACZyB,MAAMC,eAAe,GAAGpC,uBAAuBwB,UAAU8B,OAAO,EAAG7C,IAAIC;YACzE;YACA,qBACE,oBAAC2E;gBAAGT,KAAKQ;gBAAQ7B,WAAW7B,QAAQ4D,QAAQ;gBAAEnD,OAAOA;gBAAO2C,UAAU;eACnEK,KAAKJ,KAAK;QAGjB;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,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAApC,QAAA;IAAAM,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAG,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAE,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAvB,MAAA;IAAAM,MAAA;IAAAmB,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;AAAA,CA+BjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,mBAAmB,GAAIC,KAAK,IAAG;EAC5C,MAAMC,UAAU,GAAGxC,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHL,IAAI,EAAEJ,YAAY,CAACG,oBAAoB,CAACC,IAAI,EAAE6C,UAAU,CAAC7C,IAAI,CAAC,sBAAuB,CAAC;IACtFC,KAAK,EAAEL,YAAY,CAACG,oBAAoB,CAACE,KAAK,EAAE4C,UAAU,CAAC5C,KAAK,CAAC,uBAAwB,CAAC;IAC1FC,UAAU,EAAEN,YAAY,CAACG,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,EAAE,sBAAsB;EAC5BC,KAAK,EAAE,uBAAuB;EAC9BC,UAAU,EAAE,4BAA4B;EACxCC,QAAQ,EAAE,0BAA0B;EACpCC,KAAK,EAAE,uBAAuB;EAC9BC,UAAU,EAAE,4BAA4B;EACxCC,UAAU,EAAE;AAChB,CAAC;AACD,MAAMC,SAAS,gBAAGd,QAAA;EAAAO,IAAA;IAAAQ,MAAA;IAAAC,OAAA;EAAA;EAAAR,KAAA;IAAAS,MAAA;EAAA;EAAAR,UAAA;IAAAS,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,O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ACE,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;IACVC,OAAO;IACPC,YAAY;IACZC,YAAY;AACd,EAAE;AAEF,MAAMC,YAAYd,WAAW;IAC3BO,MAAM;QACJQ,OAAO;QACPC,WAAW;IACb;IACAR,OAAO;QACLS,gBAAgB;IAClB;IACAR,YAAY;QACV,GAAGN,iBAAiBe,QAAQ;QAC5BC,YAAYjB,OAAOkB,kBAAkB;QACrCC,iBAAiBnB,OAAOoB,uBAAuB;QAC/CC,OAAOrB,OAAOsB,uBAAuB;QACrCC,SAASvB,OAAOwB,kBAAkB;QAClCC,WAAW;QACXC,QAAQ,GAAG1B,OAAO2B,gBAAgB,CAAC,OAAO,EAAE3B,OAAO4B,mBAAmB,EAAE;QACxE,kCAAkC;YAChCT,iBAAiB;YACjBE,OAAO;QACT;IACF;IACAb,UAAU;QACR,GAAGP,iBAAiBe,QAAQ;QAC5BO,SAASvB,OAAOwB,kBAAkB;QAClCE,QAAQ,GAAG1B,OAAO2B,gBAAgB,CAAC,OAAO,EAAE3B,OAAO4B,mBAAmB,EAAE;QACxEP,OAAOrB,OAAOsB,uBAAuB;QACrCG,WAAW;QACX,kCAAkC;YAChCJ,OAAO;QACT;IACF;IACAX,YAAYR;IACZS,YAAY;QACVkB,MAAM7B,OAAO8B,uBAAuB;QACpC,CAAC3B,qBAAqB,EAAE;YACtB0B,MAAM;QACR;IACF;AACF;AAEA;;CAEC,GACD,OAAO,MAAME,sBAAsB,CAACC;IAClC,MAAMC,aAAarB;IAEnB,OAAO;QACLP,MAAMN,aAAaK,qBAAqBC,IAAI,EAAE4B,WAAW5B,IAAI,CAAC,oBAAoB;QAClFC,OAAOP,aAAaK,qBAAqBE,KAAK,EAAE2B,WAAW3B,KAAK,CAAC,qBAAqB;QACtFC,YAAYR,aAAaK,qBAAqBG,UAAU,EAAE0B,WAAW1B,UAAU,CAAC,0BAA0B;QAC1GC,UAAUT,aAAaK,qBAAqBI,QAAQ,EAAEyB,WAAWzB,QAAQ,CAAC,wBAAwB;QAClGC,OAAOV,aAAaK,qBAAqBK,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"}
@@ -320,7 +320,7 @@ const resolveCoordinates = (annotation, context)=>{
320
320
  };
321
321
  };
322
322
  export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
323
- const { annotations: annotationsProp, context } = props;
323
+ const { annotations: annotationsProp, context, hideDefaultStyles } = props;
324
324
  const classes = useChartAnnotationLayerStyles(props);
325
325
  const idPrefix = useId('chart-annotation');
326
326
  const autoKeyPrefix = useId('chart-annotation-item');
@@ -417,7 +417,7 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
417
417
  backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity, {
418
418
  preserveOriginalOpacity: ((_annotation_style4 = annotation.style) === null || _annotation_style4 === void 0 ? void 0 : _annotation_style4.opacity) === undefined
419
419
  })
420
- } : {
420
+ } : hideDefaultStyles ? {} : {
421
421
  backgroundColor: applyOpacityToColor(tokens.colorNeutralBackground1, DEFAULT_ANNOTATION_BACKGROUND_OPACITY)
422
422
  },
423
423
  borderColor: (_annotation_style5 = annotation.style) === null || _annotation_style5 === void 0 ? void 0 : _annotation_style5.borderColor,
@@ -503,6 +503,7 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
503
503
  visibility: 'hidden',
504
504
  ...containerStyle
505
505
  };
506
+ const annotationClass = hideDefaultStyles ? classes.annotationNoDefaults : classes.annotation;
506
507
  if (!isMeasurementValid) {
507
508
  var _annotation_style19, _annotation_style20;
508
509
  measurementElements.push(/*#__PURE__*/ React.createElement("div", {
@@ -515,7 +516,7 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
515
516
  }
516
517
  }
517
518
  },
518
- className: mergeClasses(classes.annotation, 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),
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),
519
520
  style: measurementStyle,
520
521
  "aria-hidden": true,
521
522
  "data-annotation-key": key,
@@ -535,15 +536,16 @@ export const ChartAnnotationLayer = /*#__PURE__*/ React.memo((props)=>{
535
536
  className: mergeClasses(classes.annotationForeignObject),
536
537
  "data-annotation-key": key
537
538
  }, /*#__PURE__*/ React.createElement("div", {
538
- className: mergeClasses(classes.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_annotation_style17 = annotation.style) === null || _annotation_style17 === void 0 ? void 0 : _annotation_style17.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),
539
540
  style: containerStyle,
540
541
  "data-annotation-key": key
541
542
  }, /*#__PURE__*/ React.createElement("div", {
542
- className: mergeClasses(classes.annotationContent, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
543
+ className: mergeClasses(classes.annotationContent, classes.annotationContentInteractive, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
543
544
  style: contentStyle,
544
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',
545
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,
546
547
  "aria-describedby": (_annotation_accessibility2 = annotation.accessibility) === null || _annotation_accessibility2 === void 0 ? void 0 : _annotation_accessibility2.ariaDescribedBy,
548
+ tabIndex: 0,
547
549
  "data-chart-annotation": "true",
548
550
  "data-annotation-key": key
549
551
  }, renderSimpleMarkup(annotationMarkupNodes, `${key}-content`)))));