@fluentui/react-charts 0.0.0-nightly-20260112-0407.1 → 0.0.0-nightly-20260114-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.
- package/CHANGELOG.md +13 -13
- package/dist/index.d.ts +360 -0
- package/lib/PolarChart.js +1 -0
- package/lib/PolarChart.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.js +21 -7
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +5 -3
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +250 -153
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +14 -4
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +13 -4
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +6 -5
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/PolarChart/PolarChart.js +576 -0
- package/lib/components/PolarChart/PolarChart.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.types.js +1 -0
- package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.utils.js +174 -0
- package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib/components/PolarChart/index.js +2 -0
- package/lib/components/PolarChart/index.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +13 -3
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.js +33 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.js +73 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +2 -2
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/PolarChart.js +6 -0
- package/lib-commonjs/PolarChart.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +256 -156
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +13 -3
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +12 -3
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -4
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/PolarChart/PolarChart.js +586 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-commonjs/components/PolarChart/index.js +7 -0
- package/lib-commonjs/components/PolarChart/index.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +13 -3
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/ChartTitle.js +41 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.js +69 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +6 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/PolarChart.ts"],"sourcesContent":["export * from './components/PolarChart/index';\n"],"names":[],"mappings":";;;;;uBAAc,gCAAgC"}
|
|
@@ -16,6 +16,7 @@ const _reacttheme = require("@fluentui/react-theme");
|
|
|
16
16
|
const _d3color = /*#__PURE__*/ _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:
|
|
105
|
+
height: `${totalHeight}px`,
|
|
99
106
|
overflow: 'hidden'
|
|
100
107
|
}
|
|
101
108
|
}, /*#__PURE__*/ _react.createElement("svg", {
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
104
|
-
}, /*#__PURE__*/ _react.createElement(
|
|
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:
|
|
120
|
+
y: titleHeight,
|
|
107
121
|
width: "100%",
|
|
108
|
-
height:
|
|
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;;;;;+BA+Ca+B;;;;;;;iEA7CU,QAAQ;2CAEK,+BAA+B;4BAC5C,wBAAwB;mEAC3B,WAAW;wBACE,yBAAyB;2BACtB,4BAA4B;uBACjC,wBAAwB;8BACf,0BAA0B;AAElE,SAASvB,eAAeC,GAAW;IACjC,MAAMC,QAAQP,SAAGO,KAAK,CAACD;IACvB,IAAI,CAACC,OAAO;QACV,OAAOR,kBAAAA,CAAOS,uBAAuB;IACvC;IACA,MAAMC,MAAMF,MAAME,GAAG;IACrB,OAAOT,SAAGS,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,kBAAAA,CAAOS,uBAAuB;IACjD,MAAMW,aAAapB,kBAAAA,CAAOqB,uBAAuB;IACjD,IAAI,CAACL,gBAAgB;QACnB,OAAOI;IACT;IAEA,MAAME,iBAAanB,8BAAAA,EAAoBa,gBAAgBC,cAAcE;IACrE,MAAMI,aAAapB,kCAAAA,EAAoBa,gBAAgBE,cAAcE;IAErE,MAAMI,KAAKvB,SAAGO,KAAK,CAACc;IACpB,MAAMG,KAAKxB,SAAGO,KAAK,CAACe;IAEpB,IAAI,CAACC,MAAM,CAACC,IAAI;QACd,OAAOF;IACT;IACA,MAAMG,WAAWxB,4BAAAA,EAAiBsB,GAAGV,SAAS,IAAIW,GAAGX,SAAS;IAC9D,IAAIY,YAAY,GAAG;QACjB,OAAOD,GAAGX,SAAS;IACrB;IAEA,MAAMa,aAAarB,eAAem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],"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","tb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AAe,GAAGpC,uBAAuBwB,UAAU8B,OAAO,EAAG7C,IAAIC;YACzE;YACA,OAAA,WAAA,GACE,OAAA,aAAA,CAAC2E,MAAAA;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":";;;;;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;;;;;;;;;;;;
|
|
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","jrapky","Bxms50k","d","p","m","useChartTableStyles","props","baseStyles"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAMKM,oBAAoB;;;uBAkDD;;;;uBAvDK,gBAAgB;AAK9C,6BAA6B;IACpCC,IAAI,EAAE,sBAAsB;IAC5BC,KAAK,EAAE,uBAAuB;IAC9BC,UAAU,EAAE,4BAA4B;IACxCC,QAAQ,EAAE,0BAA0B;IACpCC,KAAK,EAAE,uBAAuB;IAC9BC,UAAU,EAAE,4BAA4B;IACxCC,UAAU,EAAE;AAChB,CAAC;AACD,MAAMC,SAAS,GAAA,WAAA,OAAGd,eAAA,EAAA;IAAAO,IAAA,EAAA;QAAAQ,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAR,KAAA,EAAA;QAAAS,MAAA,EAAA;IAAA;IAAAR,UAAA,EAAA;QAAAS,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,OA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,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","textAlign","border","strokeWidthThick","colorNeutralStroke2","useChartTableStyles","props","baseStyles"],"mappings":"AAAA;;;;;;;;;;;;
|
|
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,OAAO;QACPC,WAAW;IACb;IACAR,OAAO;QACLS,gBAAgB;IAClB;IACAR,YAAY;QACV,GAAGN,4BAAAA,CAAiBe,QAAQ;QAC5BC,YAAYjB,kBAAAA,CAAOkB,kBAAkB;QACrCC,iBAAiBnB,kBAAAA,CAAOoB,uBAAuB;QAC/CC,OAAOrB,kBAAAA,CAAOsB,uBAAuB;QACrCC,SAASvB,kBAAAA,CAAOwB,kBAAkB;QAClCC,WAAW;QACXC,QAAQ,GAAG1B,kBAAAA,CAAO2B,gBAAgB,CAAC,OAAO,EAAE3B,kBAAAA,CAAO4B,mBAAmB,EAAE;QACxE,kCAAkC;YAChCT,iBAAiB;YACjBE,OAAO;QACT;IACF;IACAb,UAAU;QACR,GAAGP,4BAAAA,CAAiBe,QAAQ;QAC5BO,SAASvB,kBAAAA,CAAOwB,kBAAkB;QAClCE,QAAQ,GAAG1B,kBAAAA,CAAO2B,gBAAgB,CAAC,OAAO,EAAE3B,kBAAAA,CAAO4B,mBAAmB,EAAE;QACxEP,OAAOrB,kBAAAA,CAAOsB,uBAAuB;QACrCG,WAAW;QACX,kCAAkC;YAChCJ,OAAO;QACT;IACF;IACAX,gBAAYR,0BAAAA;IACZS,YAAY;QACVkB,MAAM7B,kBAAAA,CAAO8B,uBAAuB;QACpC,CAAC3B,2BAAAA,CAAqB,EAAE;YACtB0B,MAAM;QACR;IACF;AACF;AAKO,4BAA4B,CAACG;IAClC,MAAMC,aAAarB;IAEnB,OAAO;QACLP,UAAMN,mBAAAA,EAAaK,qBAAqBC,IAAI,EAAE4B,WAAW5B,IAAI,CAAC,oBAAoB;QAClFC,WAAOP,mBAAAA,EAAaK,qBAAqBE,KAAK,EAAE2B,WAAW3B,KAAK,CAAC,qBAAqB;QACtFC,YAAYR,uBAAAA,EAAaK,qBAAqBG,UAAU,EAAE0B,WAAW1B,UAAU,CAAC,0BAA0B;QAC1GC,cAAUT,mBAAAA,EAAaK,qBAAqBI,QAAQ,EAAEyB,WAAWzB,QAAQ,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"}
|
|
@@ -25,6 +25,7 @@ const AXIS_TITLE_PADDING = 8;
|
|
|
25
25
|
const DEFAULT_MARGIN_WITH_TICKS = 40;
|
|
26
26
|
const DEFAULT_MARGIN_NO_TICKS = 20;
|
|
27
27
|
const CartesianChart = /*#__PURE__*/ _react.forwardRef(({ hideTickOverlap = true, ...props }, forwardedRef)=>{
|
|
28
|
+
var _props_titleStyles_titleFont, _props_titleStyles, _props_titleStyles1;
|
|
28
29
|
const chartContainer = _react.useRef(null);
|
|
29
30
|
let legendContainer;
|
|
30
31
|
const minLegendContainerHeight = 40;
|
|
@@ -584,10 +585,11 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef(({ hideTickOverlap = true
|
|
|
584
585
|
content: props.xAxisAnnotation,
|
|
585
586
|
textProps: {
|
|
586
587
|
x: margins.left + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,
|
|
587
|
-
y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,
|
|
588
|
+
y: Math.max((typeof ((_props_titleStyles = props.titleStyles) === null || _props_titleStyles === void 0 ? void 0 : (_props_titleStyles_titleFont = _props_titleStyles.titleFont) === null || _props_titleStyles_titleFont === void 0 ? void 0 : _props_titleStyles_titleFont.size) === 'number' ? props.titleStyles.titleFont.size : 13) + AXIS_TITLE_PADDING, VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING),
|
|
588
589
|
className: classes.axisAnnotation,
|
|
589
590
|
textAnchor: 'middle',
|
|
590
|
-
'aria-hidden': true
|
|
591
|
+
'aria-hidden': true,
|
|
592
|
+
style: (0, _index.getChartTitleInlineStyles)((_props_titleStyles1 = props.titleStyles) === null || _props_titleStyles1 === void 0 ? void 0 : _props_titleStyles1.titleFont)
|
|
591
593
|
},
|
|
592
594
|
maxWidth: xAxisTitleMaxWidth
|
|
593
595
|
}), /*#__PURE__*/ _react.createElement("g", {
|