@fluentui/react-charts 0.0.0-nightly-20260109-0406.1 → 0.0.0-nightly-20260113-0406.1

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 (173) hide show
  1. package/CHANGELOG.md +13 -13
  2. package/dist/index.d.ts +361 -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 +5 -3
  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 +250 -153
  27. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  28. package/lib/components/DonutChart/DonutChart.js +12 -4
  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 +27 -5
  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 +5 -5
  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 +8 -5
  46. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  47. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
  48. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  49. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
  50. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  51. package/lib/components/LineChart/LineChart.js +4 -1
  52. package/lib/components/LineChart/LineChart.js.map +1 -1
  53. package/lib/components/PolarChart/PolarChart.js +576 -0
  54. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  55. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  56. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  57. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  58. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  59. package/lib/components/PolarChart/index.js +2 -0
  60. package/lib/components/PolarChart/index.js.map +1 -0
  61. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  62. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  63. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  64. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  65. package/lib/components/SankeyChart/SankeyChart.js +13 -3
  66. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  67. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  68. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
  69. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  70. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  71. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  72. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
  73. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  74. package/lib/index.js +1 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/types/DataPoint.js +1 -1
  77. package/lib/types/DataPoint.js.map +1 -1
  78. package/lib/utilities/ChartTitle.js +33 -0
  79. package/lib/utilities/ChartTitle.js.map +1 -0
  80. package/lib/utilities/Common.styles.js +73 -1
  81. package/lib/utilities/Common.styles.js.map +1 -1
  82. package/lib/utilities/Common.styles.raw.js +70 -0
  83. package/lib/utilities/Common.styles.raw.js.map +1 -1
  84. package/lib/utilities/index.js +1 -0
  85. package/lib/utilities/index.js.map +1 -1
  86. package/lib/utilities/utilities.js +2 -2
  87. package/lib/utilities/utilities.js.map +1 -1
  88. package/lib-commonjs/PolarChart.js +6 -0
  89. package/lib-commonjs/PolarChart.js.map +1 -0
  90. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  91. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  92. package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
  93. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  94. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  95. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  96. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  97. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  98. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  99. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  100. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  101. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  102. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +58 -4
  103. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  104. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  105. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  106. package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -2
  107. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  108. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  109. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  110. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  111. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +256 -156
  112. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  113. package/lib-commonjs/components/DonutChart/DonutChart.js +11 -3
  114. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  115. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  116. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  117. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  118. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  119. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  120. package/lib-commonjs/components/FunnelChart/FunnelChart.js +26 -4
  121. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  122. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  123. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  124. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  125. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  126. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  127. package/lib-commonjs/components/GaugeChart/GaugeChart.js +4 -4
  128. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  129. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  130. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +10 -4
  131. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  132. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
  133. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  134. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
  135. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  136. package/lib-commonjs/components/LineChart/LineChart.js +4 -1
  137. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  138. package/lib-commonjs/components/PolarChart/PolarChart.js +586 -0
  139. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  140. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  141. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  142. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  143. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  144. package/lib-commonjs/components/PolarChart/index.js +7 -0
  145. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  146. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  147. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  148. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  149. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  150. package/lib-commonjs/components/SankeyChart/SankeyChart.js +13 -3
  151. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  152. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  153. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
  154. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  155. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  156. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  157. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
  158. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  159. package/lib-commonjs/index.js +1 -0
  160. package/lib-commonjs/index.js.map +1 -1
  161. package/lib-commonjs/types/DataPoint.js +1 -1
  162. package/lib-commonjs/types/DataPoint.js.map +1 -1
  163. package/lib-commonjs/utilities/ChartTitle.js +41 -0
  164. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  165. package/lib-commonjs/utilities/Common.styles.js +69 -0
  166. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  167. package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
  168. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  169. package/lib-commonjs/utilities/index.js +1 -0
  170. package/lib-commonjs/utilities/index.js.map +1 -1
  171. package/lib-commonjs/utilities/utilities.js +6 -0
  172. package/lib-commonjs/utilities/utilities.js.map +1 -1
  173. package/package.json +10 -10
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/PolarChart/index"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/PolarChart.ts"],"sourcesContent":["export * from './components/PolarChart/index';\n"],"names":[],"mappings":";;;;;uBAAc,gCAAgC"}
@@ -199,7 +199,8 @@ const AnnotationOnlyChart = (props)=>{
199
199
  role: "presentation"
200
200
  }, hasAnnotations ? /*#__PURE__*/ _react.createElement(_ChartAnnotationLayer.ChartAnnotationLayer, {
201
201
  annotations: resolvedAnnotations,
202
- context: context
202
+ context: context,
203
+ hideDefaultStyles: true
203
204
  }) : null)))));
204
205
  };
205
206
  AnnotationOnlyChart.displayName = 'AnnotationOnlyChart';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';\nimport { useRtl } from '../../utilities';\nimport { useAnnotationOnlyChartStyles } from './useAnnotationOnlyChartStyles.styles';\nimport type { AnnotationOnlyChartProps } from './AnnotationOnlyChart.types';\nimport type { ChartAnnotationContext } from '../CommonComponents/Annotations/ChartAnnotationLayer.types';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst DEFAULT_HEIGHT = 650;\nconst FALLBACK_WIDTH = 400;\n\nconst buildPadding = (margin: AnnotationOnlyChartProps['margin']): string | undefined => {\n if (!margin) {\n return undefined;\n }\n\n const top = margin.t ?? 0;\n const right = margin.r ?? 0;\n const bottom = margin.b ?? 0;\n const left = margin.l ?? 0;\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return undefined;\n }\n\n return `${top}px ${right}px ${bottom}px ${left}px`;\n};\n\nexport const AnnotationOnlyChart: React.FC<AnnotationOnlyChartProps> = props => {\n const {\n annotations,\n chartTitle,\n description,\n width,\n height,\n paperBackgroundColor,\n plotBackgroundColor,\n fontColor,\n fontFamily,\n margin,\n componentRef,\n } = props;\n\n const isRtl = useRtl();\n const classes = useAnnotationOnlyChartStyles();\n const { chartContainerRef: containerRef } = useImageExport(componentRef, true, false);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const [measuredWidth, setMeasuredWidth] = React.useState<number>(width ?? 0);\n const [contentHeight, setContentHeight] = React.useState<number>(height ?? DEFAULT_HEIGHT);\n\n React.useEffect(() => {\n if (typeof width === 'number' && width > 0) {\n setMeasuredWidth(width);\n return;\n }\n\n const node = containerRef.current;\n if (!node || typeof ResizeObserver === 'undefined') {\n const rect = node?.getBoundingClientRect();\n if (rect && rect.width > 0) {\n setMeasuredWidth(rect.width);\n } else {\n setMeasuredWidth(prev => (prev > 0 ? prev : FALLBACK_WIDTH));\n }\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n const newWidth = entry.contentRect.width;\n if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {\n setMeasuredWidth(newWidth);\n }\n });\n\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) {\n setMeasuredWidth(rect.width);\n }\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [width, measuredWidth]);\n\n const resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);\n const resolvedHeight = Math.max(height ?? DEFAULT_HEIGHT, 1);\n\n React.useEffect(() => {\n const node = contentRef.current;\n if (!node) {\n setContentHeight(prev => (prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n if (typeof ResizeObserver === 'undefined') {\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setContentHeight(prev => (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev));\n }\n });\n\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [\n resolvedHeight,\n resolvedWidth,\n annotations,\n chartTitle,\n description,\n margin,\n plotBackgroundColor,\n paperBackgroundColor,\n fontColor,\n fontFamily,\n ]);\n\n const svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);\n\n const context: ChartAnnotationContext = {\n plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },\n svgRect: { width: resolvedWidth, height: resolvedHeight },\n isRtl,\n };\n\n const padding = buildPadding(margin);\n\n // Inline styles for dynamic values that can't be in makeStyles\n const rootStyle: React.CSSProperties = React.useMemo(\n () => ({\n width: width ? `${width}px` : '100%',\n minHeight: resolvedHeight,\n ...(paperBackgroundColor && { backgroundColor: paperBackgroundColor }),\n ...(fontColor && { color: fontColor }),\n ...(fontFamily && { fontFamily }),\n ...(padding && { padding }),\n }),\n [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, width],\n );\n\n const contentStyle: React.CSSProperties = React.useMemo(\n () => ({\n ...(plotBackgroundColor && { backgroundColor: plotBackgroundColor }),\n }),\n [plotBackgroundColor],\n );\n\n const resolvedAnnotations = annotations ?? [];\n const hasAnnotations = resolvedAnnotations.length > 0;\n const ariaLabel = hasAnnotations ? description ?? chartTitle : undefined;\n\n return (\n <div ref={containerRef} data-chart-annotation-container=\"true\">\n <svg\n width={resolvedWidth}\n height={svgHeight}\n viewBox={`0 0 ${resolvedWidth} ${svgHeight}`}\n style={{ width: width ? `${width}px` : '100%', height: `${svgHeight}px`, display: 'block' }}\n role={ariaLabel ? 'img' : undefined}\n aria-label={ariaLabel}\n >\n <foreignObject x={0} y={0} width={resolvedWidth} height={svgHeight}>\n <div\n ref={contentRef}\n className={classes.root}\n style={rootStyle}\n data-chart-annotation-only=\"true\"\n aria-label={ariaLabel}\n >\n {chartTitle && (\n <span className={classes.title} aria-hidden=\"true\">\n {chartTitle}\n </span>\n )}\n <div className={classes.content} style={contentStyle} role=\"presentation\">\n {hasAnnotations ? <ChartAnnotationLayer annotations={resolvedAnnotations} context={context} /> : null}\n </div>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n};\n\nAnnotationOnlyChart.displayName = 'AnnotationOnlyChart';\n"],"names":["React","ChartAnnotationLayer","useRtl","useAnnotationOnlyChartStyles","useImageExport","DEFAULT_HEIGHT","FALLBACK_WIDTH","buildPadding","margin","undefined","top","t","right","r","bottom","b","left","l","AnnotationOnlyChart","props","annotations","chartTitle","description","width","height","paperBackgroundColor","plotBackgroundColor","fontColor","fontFamily","componentRef","isRtl","classes","chartContainerRef","containerRef","contentRef","useRef","measuredWidth","setMeasuredWidth","useState","contentHeight","setContentHeight","useEffect","node","current","ResizeObserver","rect","getBoundingClientRect","prev","observer","entries","entry","newWidth","contentRect","Math","abs","observe","disconnect","resolvedWidth","max","resolvedHeight","newHeight","svgHeight","ceil","context","plotRect","x","y","svgRect","padding","rootStyle","useMemo","minHeight","backgroundColor","color","contentStyle","resolvedAnnotations","hasAnnotations","length","ariaLabel","div","ref","data-chart-annotation-container","svg","viewBox","style","display","role","aria-label","foreignObject","className","root","data-chart-annotation-only","span","title","aria-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D,IAAI;QACvBN,OAAOf;QACPsB,8BAA2B;QAC3BJ,cAAYT;OAEXzD,cAAAA,WAAAA,GACC,OAAA,aAAA,CAACuE,QAAAA;QAAKH,WAAW1D,QAAQ8D,KAAK;QAAEC,eAAY;OACzCzE,aAAAA,WAAAA,GAGL,OAAA,aAAA,CAAC0D,OAAAA;QAAIU,WAAW1D,QAAQgE,OAAO;QAAEX,OAAOV;QAAcY,MAAK;OACxDV,iBAAAA,WAAAA,GAAiB,OAAA,aAAA,CAAC3E,0CAAAA,EAAAA;QAAqBmB,aAAauD;QAAqBZ,SAASA;SAAc;AAO/G,EAAE;AAEF7C,oBAAoB8E,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';\nimport { useRtl } from '../../utilities';\nimport { useAnnotationOnlyChartStyles } from './useAnnotationOnlyChartStyles.styles';\nimport type { AnnotationOnlyChartProps } from './AnnotationOnlyChart.types';\nimport type { ChartAnnotationContext } from '../CommonComponents/Annotations/ChartAnnotationLayer.types';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst DEFAULT_HEIGHT = 650;\nconst FALLBACK_WIDTH = 400;\n\nconst buildPadding = (margin: AnnotationOnlyChartProps['margin']): string | undefined => {\n if (!margin) {\n return undefined;\n }\n\n const top = margin.t ?? 0;\n const right = margin.r ?? 0;\n const bottom = margin.b ?? 0;\n const left = margin.l ?? 0;\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return undefined;\n }\n\n return `${top}px ${right}px ${bottom}px ${left}px`;\n};\n\nexport const AnnotationOnlyChart: React.FC<AnnotationOnlyChartProps> = props => {\n const {\n annotations,\n chartTitle,\n description,\n width,\n height,\n paperBackgroundColor,\n plotBackgroundColor,\n fontColor,\n fontFamily,\n margin,\n componentRef,\n } = props;\n\n const isRtl = useRtl();\n const classes = useAnnotationOnlyChartStyles();\n const { chartContainerRef: containerRef } = useImageExport(componentRef, true, false);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const [measuredWidth, setMeasuredWidth] = React.useState<number>(width ?? 0);\n const [contentHeight, setContentHeight] = React.useState<number>(height ?? DEFAULT_HEIGHT);\n\n React.useEffect(() => {\n if (typeof width === 'number' && width > 0) {\n setMeasuredWidth(width);\n return;\n }\n\n const node = containerRef.current;\n if (!node || typeof ResizeObserver === 'undefined') {\n const rect = node?.getBoundingClientRect();\n if (rect && rect.width > 0) {\n setMeasuredWidth(rect.width);\n } else {\n setMeasuredWidth(prev => (prev > 0 ? prev : FALLBACK_WIDTH));\n }\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n const newWidth = entry.contentRect.width;\n if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {\n setMeasuredWidth(newWidth);\n }\n });\n\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) {\n setMeasuredWidth(rect.width);\n }\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [width, measuredWidth]);\n\n const resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);\n const resolvedHeight = Math.max(height ?? DEFAULT_HEIGHT, 1);\n\n React.useEffect(() => {\n const node = contentRef.current;\n if (!node) {\n setContentHeight(prev => (prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n if (typeof ResizeObserver === 'undefined') {\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setContentHeight(prev => (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev));\n }\n });\n\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [\n resolvedHeight,\n resolvedWidth,\n annotations,\n chartTitle,\n description,\n margin,\n plotBackgroundColor,\n paperBackgroundColor,\n fontColor,\n fontFamily,\n ]);\n\n const svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);\n\n const context: ChartAnnotationContext = {\n plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },\n svgRect: { width: resolvedWidth, height: resolvedHeight },\n isRtl,\n };\n\n const padding = buildPadding(margin);\n\n // Inline styles for dynamic values that can't be in makeStyles\n const rootStyle: React.CSSProperties = React.useMemo(\n () => ({\n width: width ? `${width}px` : '100%',\n minHeight: resolvedHeight,\n ...(paperBackgroundColor && { backgroundColor: paperBackgroundColor }),\n ...(fontColor && { color: fontColor }),\n ...(fontFamily && { fontFamily }),\n ...(padding && { padding }),\n }),\n [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, width],\n );\n\n const contentStyle: React.CSSProperties = React.useMemo(\n () => ({\n ...(plotBackgroundColor && { backgroundColor: plotBackgroundColor }),\n }),\n [plotBackgroundColor],\n );\n\n const resolvedAnnotations = annotations ?? [];\n const hasAnnotations = resolvedAnnotations.length > 0;\n const ariaLabel = hasAnnotations ? description ?? chartTitle : undefined;\n\n return (\n <div ref={containerRef} data-chart-annotation-container=\"true\">\n <svg\n width={resolvedWidth}\n height={svgHeight}\n viewBox={`0 0 ${resolvedWidth} ${svgHeight}`}\n style={{ width: width ? `${width}px` : '100%', height: `${svgHeight}px`, display: 'block' }}\n role={ariaLabel ? 'img' : undefined}\n aria-label={ariaLabel}\n >\n <foreignObject x={0} y={0} width={resolvedWidth} height={svgHeight}>\n <div\n ref={contentRef}\n className={classes.root}\n style={rootStyle}\n data-chart-annotation-only=\"true\"\n aria-label={ariaLabel}\n >\n {chartTitle && (\n <span className={classes.title} aria-hidden=\"true\">\n {chartTitle}\n </span>\n )}\n <div className={classes.content} style={contentStyle} role=\"presentation\">\n {hasAnnotations ? (\n <ChartAnnotationLayer annotations={resolvedAnnotations} context={context} hideDefaultStyles={true} />\n ) : null}\n </div>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n};\n\nAnnotationOnlyChart.displayName = 'AnnotationOnlyChart';\n"],"names":["React","ChartAnnotationLayer","useRtl","useAnnotationOnlyChartStyles","useImageExport","DEFAULT_HEIGHT","FALLBACK_WIDTH","buildPadding","margin","undefined","top","t","right","r","bottom","b","left","l","AnnotationOnlyChart","props","annotations","chartTitle","description","width","height","paperBackgroundColor","plotBackgroundColor","fontColor","fontFamily","componentRef","isRtl","classes","chartContainerRef","containerRef","contentRef","useRef","measuredWidth","setMeasuredWidth","useState","contentHeight","setContentHeight","useEffect","node","current","ResizeObserver","rect","getBoundingClientRect","prev","observer","entries","entry","newWidth","contentRect","Math","abs","observe","disconnect","resolvedWidth","max","resolvedHeight","newHeight","svgHeight","ceil","context","plotRect","x","y","svgRect","padding","rootStyle","useMemo","minHeight","backgroundColor","color","contentStyle","resolvedAnnotations","hasAnnotations","length","ariaLabel","div","ref","data-chart-annotation-container","svg","viewBox","style","display","role","aria-label","foreignObject","className","root","data-chart-annotation-only","span","title","aria-hidden","content","hideDefaultStyles","displayName"],"mappings":"AAAA;;;;;+BA8BakB;;;;;;;iEA5BU,QAAQ;sCACM,uDAAuD;2BACrE,kBAAkB;oDACI,wCAAwC;uBAGtD,wBAAwB;AAEvD,MAAMb,iBAAiB;AACvB,MAAMC,iBAAiB;AAEvB,MAAMC,eAAe,CAACC;IACpB,IAAI,CAACA,QAAQ;QACX,OAAOC;IACT;QAEYD;IAAZ,MAAME,MAAMF,CAAAA,YAAAA,QAAOG,AAAC,MAAA,QAARH,cAAAA,KAAAA,IAAAA,YAAY;QACVA;IAAd,MAAMI,QAAQJ,CAAAA,YAAAA,QAAOK,AAAC,MAAA,QAARL,cAAAA,KAAAA,IAAAA,YAAY;QACXA;IAAf,MAAMM,SAASN,CAAAA,YAAAA,QAAOO,AAAC,MAAA,QAARP,cAAAA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URE__*/ _interop_require_wildcard._(require("d3-color"));
17
17
  const _colors = require("../../utilities/colors");
18
18
  const _utilities = require("../../utilities/utilities");
19
+ const _index = require("../../utilities/index");
19
20
  const _hooks = require("../../utilities/hooks");
20
21
  const _reacttabster = require("@fluentui/react-tabster");
21
22
  function invertHexColor(hex) {
@@ -48,7 +49,7 @@ function getSafeBackgroundColor(chartContainer, foreground, background) {
48
49
  return invertedContrast >= 3 ? invertedBg : fallbackBg;
49
50
  }
50
51
  const ChartTable = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
51
- const { headers, rows, width, height } = props;
52
+ const { headers, rows, width, height, chartTitle } = props;
52
53
  const { chartContainerRef: _rootElem } = (0, _hooks.useImageExport)(props.componentRef, true, false);
53
54
  const classes = (0, _useChartTableStylesstyles.useChartTableStyles)(props);
54
55
  const arrowAttributes = (0, _reacttabster.useArrowNavigationGroup)({
@@ -89,23 +90,36 @@ const ChartTable = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
89
90
  }
90
91
  }
91
92
  }
93
+ const titleHeight = chartTitle ? 30 : 0;
94
+ const totalHeight = typeof height === 'number' ? height : 650;
95
+ const tableHeight = `${totalHeight - titleHeight}px`;
96
+ const svgWidth = typeof width === 'number' ? width : '100%';
97
+ const titleMaxWidth = typeof width === 'number' ? width - 20 : undefined;
98
+ const titleX = typeof width === 'number' ? width / 2 : 0;
92
99
  return /*#__PURE__*/ _react.createElement("div", {
93
100
  ref: (el)=>{
94
101
  _rootElem.current = el;
95
102
  },
96
103
  className: classes.root,
97
104
  style: {
98
- height: height ? `${height}px` : '650px',
105
+ height: `${totalHeight}px`,
99
106
  overflow: 'hidden'
100
107
  }
101
108
  }, /*#__PURE__*/ _react.createElement("svg", {
102
- width: width !== null && width !== void 0 ? width : '100%',
103
- height: height !== null && height !== void 0 ? height : '650px'
104
- }, /*#__PURE__*/ _react.createElement("foreignObject", {
109
+ width: svgWidth,
110
+ height: `${totalHeight}px`
111
+ }, chartTitle && /*#__PURE__*/ _react.createElement(_index.ChartTitle, {
112
+ title: chartTitle,
113
+ x: titleX,
114
+ maxWidth: titleMaxWidth,
115
+ className: classes.chartTitle,
116
+ titleStyles: props.titleStyles,
117
+ tooltipClassName: classes.svgTooltip
118
+ }), /*#__PURE__*/ _react.createElement("foreignObject", {
105
119
  x: "0",
106
- y: "0",
120
+ y: titleHeight,
107
121
  width: "100%",
108
- height: "100%"
122
+ height: tableHeight
109
123
  }, /*#__PURE__*/ _react.createElement("div", {
110
124
  style: {
111
125
  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;;;;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GAAGG;QAC1B,OAAO,IAAI7B,MAAMC,IAAI;YACnBwB,MAAMC,eAAe,GAAGnC,uBAAuBuB,UAAUuB,OAAO,EAAGrC,IAAIC;QACzE;QACA,OAAA,WAAA,GACE,OAAA,aAAA,CAACoD,MAAAA;YAAGC,KAAKF;YAAKd,WAAWtB,QAAQuC,UAAU;YAAE9B,OAAOA;YAAO+B,UAAU;WAClEhC,OAAOiC,KAAK;IAGnB,MAGH/C,QAAQA,KAAKS,MAAM,GAAG,KAAA,WAAA,GACrB,OAAA,aAAA,CAACuC,SAAAA,MACEhD,KAAKyC,GAAG,CAAC,CAACQ,KAAKC,SAAAA,WAAAA,GACd,OAAA,aAAA,CAACV,MAAAA;YAAGI,KAAKM;WACND,IAAIR,GAAG,CAAC,CAACU,MAAMC;YACd,MAAMrC,QAAQ;mBAAKoC,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,KAAAA,IAAAA,KAAMpC,KAAT;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,OAAA,WAAA,GACE,OAAA,aAAA,CAAC8D,MAAAA;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;;;;;;;;eAgDagC;;;;iEA9CU,QAAQ;2CAEK,+BAA+B;4BAC5C,wBAAwB;mEAC3B,WAAW;wBACE,yBAAyB;2BACtB,4BAA4B;uBACrC,wBAAwB;uBACpB,wBAAwB;8BACf,0BAA0B;AAElE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K;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":";;;;;iEAAuB,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":";;;;;iEAAuB,QAAQ"}
@@ -23,7 +23,9 @@ const chartTableClassNames = {
23
23
  table: 'fui-ChartTable__table',
24
24
  headerCell: 'fui-ChartTable__headerCell',
25
25
  bodyCell: 'fui-ChartTable__bodyCell',
26
- chart: 'fui-ChartTable__chart'
26
+ chart: 'fui-ChartTable__chart',
27
+ chartTitle: 'fui-ChartTable__chartTitle',
28
+ svgTooltip: 'fui-ChartTable__svgTooltip'
27
29
  };
28
30
  const useStyles = /*#__PURE__*/ (0, _react.__styles)({
29
31
  root: {
@@ -102,6 +104,20 @@ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
102
104
  "fes3tcz"
103
105
  ],
104
106
  B7iucu3: "fhs7xo9"
107
+ },
108
+ chartTitle: {
109
+ Bahqtrf: "fk6fouc",
110
+ Be2twd7: "f13mqy1h",
111
+ Bhrd7zp: "fl43uef",
112
+ Bg96gwp: "fcpl73t",
113
+ Bkfmm31: "fhuob2q",
114
+ Bvjb7m6: "fhv2zbx",
115
+ fsow6f: "f17mccla",
116
+ jrapky: "fqcjy3b"
117
+ },
118
+ svgTooltip: {
119
+ Bkfmm31: "f5q6cfr",
120
+ Bxms50k: "f1bgda6t"
105
121
  }
106
122
  }, {
107
123
  d: [
@@ -140,7 +156,14 @@ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
140
156
  {
141
157
  p: -2
142
158
  }
143
- ]
159
+ ],
160
+ ".f13mqy1h{font-size:var(--fontSizeBase100);}",
161
+ ".fcpl73t{line-height:var(--lineHeightBase100);}",
162
+ ".fhuob2q{fill:var(--colorNeutralForeground1);}",
163
+ ".fhv2zbx{forced-color-adjust:auto;}",
164
+ ".f17mccla{text-align:center;}",
165
+ ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}",
166
+ ".f5q6cfr{fill:var(--colorNeutralBackground1);}"
144
167
  ],
145
168
  m: [
146
169
  [
@@ -154,6 +177,12 @@ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
154
177
  {
155
178
  m: "(forced-colors: active)"
156
179
  }
180
+ ],
181
+ [
182
+ "@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f1bgda6t{fill:Canvas;}}",
183
+ {
184
+ m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
185
+ }
157
186
  ]
158
187
  ]
159
188
  });
@@ -164,6 +193,8 @@ const useChartTableStyles = (props)=>{
164
193
  table: (0, _react.mergeClasses)(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
165
194
  headerCell: (0, _react.mergeClasses)(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
166
195
  bodyCell: (0, _react.mergeClasses)(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
167
- chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ )
196
+ chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ ),
197
+ chartTitle: (0, _react.mergeClasses)(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/ ),
198
+ svgTooltip: (0, _react.mergeClasses)(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/ )
168
199
  };
169
200
  };
@@ -1 +1 @@
1
- {"version":3,"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"],"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"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAKKI,oBAAoB;;;uBAyCD;eAAnB4C;;;uBA7CwB,gBAAgB;AAI9C,6BAA6B;IACpC3C,IAAI,EAAE,sBAAsB;IAC5BC,KAAK,EAAE,uBAAuB;IAC9BC,UAAU,EAAE,4BAA4B;IACxCC,QAAQ,EAAE,0BAA0B;IACpCC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,SAAS,GAAA,WAAA,OAAGV,eAAA,EAAA;IAAAK,IAAA,EAAA;QAAAM,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAN,KAAA,EAAA;QAAAO,MAAA,EAAA;IAAA;IAAAN,UAAA,EAAA;QAAAO,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAA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;IAC9B,OAAO;QACHL,IAAI,MAAEJ,mBAAY,EAACG,oBAAoB,CAACC,IAAI,EAAE6C,UAAU,CAAC7C,IAAI,CAAC,oBAAA,EAAuB,CAAC;QACtFC,KAAK,MAAEL,mBAAY,EAACG,oBAAoB,CAACE,KAAK,EAAE4C,UAAU,CAAC5C,KAAK,CAAC,qBAAA,EAAwB,CAAC;QAC1FC,UAAU,EAAEN,uBAAY,EAACG,oBAAoB,CAACG,UAAU,EAAE2C,UAAU,CAAC3C,UAAU,CAAC,0BAAA,EAA6B,CAAC;QAC9GC,QAAQ,MAAEP,mBAAY,EAACG,oBAAoB,CAACI,QAAQ,EAAE0C,UAAU,CAAC1C,QAAQ,CAAC,wBAAA,EAA2B,CAAC;QACtGC,KAAK,MAAER,mBAAY,EAACG,oBAAoB,CAACK,KAAK,CAAC,qBAAA,EAAwB;IAC3E,CAAC;AACL,CAAC"}
1
+ {"version":3,"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"],"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","j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A,CAAA,EAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA;YAAA;SAAA;KAAA;AAAA,CAsCjB,CAAC;AAGS,MAAMC,uBAAuBC,KAAK,IAAG;IAC5C,MAAMC,UAAU,GAAG5C,SAAS,CAAC,CAAC;IAC9B,OAAO;QACHP,IAAI,MAAEN,mBAAY,EAACK,oBAAoB,CAACC,IAAI,EAAEmD,UAAU,CAACnD,IAAI,CAAC,oBAAA,EAAuB,CAAC;QACtFC,KAAK,MAAEP,mBAAY,EAACK,oBAAoB,CAACE,KAAK,EAAEkD,UAAU,CAAClD,KAAK,CAAC,qBAAA,EAAwB,CAAC;QAC1FC,UAAU,EAAER,uBAAY,EAACK,oBAAoB,CAACG,UAAU,EAAEiD,UAAU,CAACjD,UAAU,CAAC,0BAAA,EAA6B,CAAC;QAC9GC,QAAQ,MAAET,mBAAY,EAACK,oBAAoB,CAACI,QAAQ,EAAEgD,UAAU,CAAChD,QAAQ,CAAC,wBAAA,EAA2B,CAAC;QACtGC,KAAK,MAAEV,mBAAY,EAACK,oBAAoB,CAACK,KAAK,CAAC,qBAAA,EAAwB,CAAC;QACxEC,UAAU,MAAEX,mBAAY,EAACK,oBAAoB,CAACM,UAAU,EAAE8C,UAAU,CAAC9C,UAAU,CAAC,0BAAA,EAA6B,CAAC;QAC9GC,UAAU,MAAEZ,mBAAY,EAACK,oBAAoB,CAACO,UAAU,EAAE6C,UAAU,CAAC7C,UAAU,CAAC,0BAAA,EAA6B;IACjH,CAAC;AACL,CAAC"}
@@ -19,12 +19,15 @@ _export(exports, {
19
19
  });
20
20
  const _react = require("@griffel/react");
21
21
  const _reacttheme = require("@fluentui/react-theme");
22
+ const _index = require("../../utilities/index");
22
23
  const chartTableClassNames = {
23
24
  root: 'fui-ChartTable__root',
24
25
  table: 'fui-ChartTable__table',
25
26
  headerCell: 'fui-ChartTable__headerCell',
26
27
  bodyCell: 'fui-ChartTable__bodyCell',
27
- chart: 'fui-ChartTable__chart'
28
+ chart: 'fui-ChartTable__chart',
29
+ chartTitle: 'fui-ChartTable__chartTitle',
30
+ svgTooltip: 'fui-ChartTable__svgTooltip'
28
31
  };
29
32
  const useStyles = (0, _react.makeStyles)({
30
33
  root: {
@@ -56,6 +59,13 @@ const useStyles = (0, _react.makeStyles)({
56
59
  '@media (forced-colors: active)': {
57
60
  color: 'WindowText'
58
61
  }
62
+ },
63
+ chartTitle: (0, _index.getChartTitleStyles)(),
64
+ svgTooltip: {
65
+ fill: _reacttheme.tokens.colorNeutralBackground1,
66
+ [_index.HighContrastSelector]: {
67
+ fill: 'Canvas'
68
+ }
59
69
  }
60
70
  });
61
71
  const useChartTableStyles = (props)=>{
@@ -65,6 +75,8 @@ const useChartTableStyles = (props)=>{
65
75
  table: (0, _react.mergeClasses)(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
66
76
  headerCell: (0, _react.mergeClasses)(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
67
77
  bodyCell: (0, _react.mergeClasses)(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
68
- chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ )
78
+ chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ ),
79
+ chartTitle: (0, _react.mergeClasses)(chartTableClassNames.chartTitle, baseStyles.chartTitle /*props.styles?.chartTitle*/ ),
80
+ svgTooltip: (0, _react.mergeClasses)(chartTableClassNames.svgTooltip, baseStyles.svgTooltip /*props.styles?.svgTooltip*/ )
69
81
  };
70
82
  };
@@ -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","text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AqB;QACtFC,gBAAYN,mBAAAA,EAAaG,qBAAqBG,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;QAC1GC,cAAUP,mBAAAA,EAAaG,qBAAqBI,QAAQ,EAAEqB,WAAWrB,QAAQ,CAAC,wBAAwB;QAClGC,WAAOR,mBAAAA,EAAaG,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;;;;;;;;;;;;IAWaM,oBAAAA;;;IAqDA2B,mBAAAA;;;;uBA9D0C,iBAAiB;4BAG/B,wBAAwB;uBACP,wBAAwB;AAK3E,6BAA+D;IACpE1B,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,UAAU;IACVC,OAAO;IACPC,YAAY;IACZC,YAAY;AACd,EAAE;AAEF,MAAMC,gBAAYd,iBAAAA,EAAW;IAC3BO,MAAM;QACJQ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,CAAC,wBAAwB;QAClGC,WAAOV,mBAAAA,EAAaK,qBAAqBK,KAAK,CAAC,qBAAqB;QACpEC,gBAAYX,mBAAAA,EAAaK,qBAAqBM,UAAU,EAAEuB,WAAWvB,UAAU,CAAC,0BAA0B;QAC1GC,gBAAYZ,mBAAAA,EAAaK,qBAAqBO,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;IAC5G;AACF,EAAE"}
@@ -331,7 +331,7 @@ const resolveCoordinates = (annotation, context)=>{
331
331
  };
332
332
  };
333
333
  const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
334
- const { annotations: annotationsProp, context } = props;
334
+ const { annotations: annotationsProp, context, hideDefaultStyles } = props;
335
335
  const classes = (0, _useChartAnnotationLayerstyles.useChartAnnotationLayerStyles)(props);
336
336
  const idPrefix = (0, _reactutilities.useId)('chart-annotation');
337
337
  const autoKeyPrefix = (0, _reactutilities.useId)('chart-annotation-item');
@@ -428,7 +428,7 @@ const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
428
428
  backgroundColor: (0, _useChartAnnotationLayerstyles.applyOpacityToColor)(baseBackgroundColor, backgroundOpacity, {
429
429
  preserveOriginalOpacity: ((_annotation_style4 = annotation.style) === null || _annotation_style4 === void 0 ? void 0 : _annotation_style4.opacity) === undefined
430
430
  })
431
- } : {
431
+ } : hideDefaultStyles ? {} : {
432
432
  backgroundColor: (0, _useChartAnnotationLayerstyles.applyOpacityToColor)(_reacttheme.tokens.colorNeutralBackground1, _useChartAnnotationLayerstyles.DEFAULT_ANNOTATION_BACKGROUND_OPACITY)
433
433
  },
434
434
  borderColor: (_annotation_style5 = annotation.style) === null || _annotation_style5 === void 0 ? void 0 : _annotation_style5.borderColor,
@@ -514,6 +514,7 @@ const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
514
514
  visibility: 'hidden',
515
515
  ...containerStyle
516
516
  };
517
+ const annotationClass = hideDefaultStyles ? classes.annotationNoDefaults : classes.annotation;
517
518
  if (!isMeasurementValid) {
518
519
  var _annotation_style19, _annotation_style20;
519
520
  measurementElements.push(/*#__PURE__*/ _react.createElement("div", {
@@ -526,7 +527,7 @@ const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
526
527
  }
527
528
  }
528
529
  },
529
- className: (0, _react1.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),
530
+ className: (0, _react1.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),
530
531
  style: measurementStyle,
531
532
  "aria-hidden": true,
532
533
  "data-annotation-key": key,
@@ -546,15 +547,16 @@ const ChartAnnotationLayer = /*#__PURE__*/ _react.memo((props)=>{
546
547
  className: (0, _react1.mergeClasses)(classes.annotationForeignObject),
547
548
  "data-annotation-key": key
548
549
  }, /*#__PURE__*/ _react.createElement("div", {
549
- className: (0, _react1.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),
550
+ className: (0, _react1.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),
550
551
  style: containerStyle,
551
552
  "data-annotation-key": key
552
553
  }, /*#__PURE__*/ _react.createElement("div", {
553
- className: (0, _react1.mergeClasses)(classes.annotationContent, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
554
+ className: (0, _react1.mergeClasses)(classes.annotationContent, classes.annotationContentInteractive, (_annotation_style18 = annotation.style) === null || _annotation_style18 === void 0 ? void 0 : _annotation_style18.className),
554
555
  style: contentStyle,
555
556
  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',
556
557
  "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,
557
558
  "aria-describedby": (_annotation_accessibility2 = annotation.accessibility) === null || _annotation_accessibility2 === void 0 ? void 0 : _annotation_accessibility2.ariaDescribedBy,
559
+ tabIndex: 0,
558
560
  "data-chart-annotation": "true",
559
561
  "data-annotation-key": key
560
562
  }, renderSimpleMarkup(annotationMarkupNodes, `${key}-content`)))));