@fluentui/react-charts 9.1.5 → 9.1.7
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 +30 -2
- package/dist/index.d.ts +46 -4
- package/lib/components/AreaChart/AreaChart.js +3 -3
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +42 -9
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +3 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +37 -9
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +11 -5
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -13
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +10 -3
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +7 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +7 -6
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +16 -17
- 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 +15 -13
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +3 -3
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +4 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +9 -3
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +14 -3
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -61
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +6 -31
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.js +2 -1
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +3 -3
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +2 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +25 -23
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +29 -0
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +29 -35
- 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 +13 -7
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +15 -17
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +3 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +19 -21
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +17 -14
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/utilities/utilities.js +11 -5
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +41 -8
- 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/CommonComponents/ChartPopover.js +3 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +55 -9
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +14 -5
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -13
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +10 -3
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +10 -2
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +8 -7
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +16 -17
- 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 +13 -23
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +4 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +10 -3
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +14 -3
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -61
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +5 -54
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +2 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +2 -2
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +2 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +25 -23
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +49 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +29 -35
- 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 +15 -8
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +13 -15
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +5 -4
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +18 -20
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +16 -13
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +16 -7
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResponsiveContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getWindow } from '../../utilities/getWindow';\nimport { ResponsiveChildProps, ResponsiveContainerProps } from './ResponsiveContainer.types';\n\n/**\n * Responsive Container component\n * {@docCategory ResponsiveContainer}\n */\nexport const ResponsiveContainer: React.FC<ResponsiveContainerProps> = props => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const onResizeRef = React.useRef<ResponsiveContainerProps['onResize']>();\n\n const [size, setSize] = React.useState<{ containerWidth?: number; containerHeight?: number }>({});\n\n onResizeRef.current = props.onResize;\n\n React.useEffect(() => {\n const _window = getWindow(containerRef.current) as (Window & typeof globalThis) | undefined;\n let animationFrameId: number | undefined;\n let resizeObserver: ResizeObserver | undefined;\n\n const resizeCallback = (entries: ResizeObserverEntry[]) => {\n const { width: containerWidth, height: containerHeight } = entries[0].contentRect;\n // rAF is an alternative to the throttle function. For more info, see:\n // https://css-tricks.com/debouncing-throttling-explained-examples/#aa-requestanimationframe-raf\n animationFrameId = _window?.requestAnimationFrame(() => {\n setSize(prevSize => {\n const roundedWidth = Math.floor(containerWidth);\n const roundedHeight = Math.floor(containerHeight);\n if (prevSize.containerWidth === roundedWidth && prevSize.containerHeight === roundedHeight) {\n return prevSize;\n }\n\n return { containerWidth: roundedWidth, containerHeight: roundedHeight };\n });\n });\n onResizeRef.current?.(containerWidth, containerHeight);\n };\n\n if (_window && _window.ResizeObserver) {\n resizeObserver = new _window.ResizeObserver(resizeCallback);\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n }\n\n return () => {\n if (animationFrameId) {\n _window?.cancelAnimationFrame(animationFrameId);\n }\n\n resizeObserver?.disconnect();\n };\n }, []);\n\n const chartContent = React.useMemo(() => {\n let calculatedWidth = size.containerWidth;\n let calculatedHeight = size.containerHeight;\n\n if (typeof props.aspect === 'number' && props.aspect > 0) {\n if (calculatedWidth) {\n calculatedHeight = calculatedWidth / props.aspect;\n } else if (calculatedHeight) {\n calculatedWidth = calculatedHeight * props.aspect;\n }\n\n if (typeof props.maxHeight === 'number' && calculatedHeight && calculatedHeight > props.maxHeight) {\n calculatedHeight = props.maxHeight;\n }\n }\n\n return
|
|
1
|
+
{"version":3,"sources":["ResponsiveContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getWindow } from '../../utilities/getWindow';\nimport { ResponsiveChildProps, ResponsiveContainerProps } from './ResponsiveContainer.types';\nimport { useResponsiveChildStyles } from './useResponsiveChildStyles.styles';\nimport { mergeClasses } from '@griffel/react';\n\n/**\n * Responsive Container component\n * {@docCategory ResponsiveContainer}\n */\nexport const ResponsiveContainer: React.FC<ResponsiveContainerProps> = props => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const onResizeRef = React.useRef<ResponsiveContainerProps['onResize']>();\n const childClasses = useResponsiveChildStyles();\n\n const [size, setSize] = React.useState<{ containerWidth?: number; containerHeight?: number }>({});\n\n onResizeRef.current = props.onResize;\n\n React.useEffect(() => {\n const _window = getWindow(containerRef.current) as (Window & typeof globalThis) | undefined;\n let animationFrameId: number | undefined;\n let resizeObserver: ResizeObserver | undefined;\n\n const resizeCallback = (entries: ResizeObserverEntry[]) => {\n const { width: containerWidth, height: containerHeight } = entries[0].contentRect;\n // rAF is an alternative to the throttle function. For more info, see:\n // https://css-tricks.com/debouncing-throttling-explained-examples/#aa-requestanimationframe-raf\n animationFrameId = _window?.requestAnimationFrame(() => {\n setSize(prevSize => {\n const roundedWidth = Math.floor(containerWidth);\n const roundedHeight = Math.floor(containerHeight);\n if (prevSize.containerWidth === roundedWidth && prevSize.containerHeight === roundedHeight) {\n return prevSize;\n }\n\n return { containerWidth: roundedWidth, containerHeight: roundedHeight };\n });\n });\n onResizeRef.current?.(containerWidth, containerHeight);\n };\n\n if (_window && _window.ResizeObserver) {\n resizeObserver = new _window.ResizeObserver(resizeCallback);\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n }\n\n return () => {\n if (animationFrameId) {\n _window?.cancelAnimationFrame(animationFrameId);\n }\n\n resizeObserver?.disconnect();\n };\n }, []);\n\n const chartContent = React.useMemo(() => {\n let calculatedWidth = size.containerWidth;\n let calculatedHeight = size.containerHeight;\n\n if (typeof props.aspect === 'number' && props.aspect > 0) {\n if (calculatedWidth) {\n calculatedHeight = calculatedWidth / props.aspect;\n } else if (calculatedHeight) {\n calculatedWidth = calculatedHeight * props.aspect;\n }\n\n if (typeof props.maxHeight === 'number' && calculatedHeight && calculatedHeight > props.maxHeight) {\n calculatedHeight = props.maxHeight;\n }\n }\n\n return React.Children.map(props.children, child => {\n return React.cloneElement<ResponsiveChildProps>(child, {\n width: calculatedWidth,\n height: calculatedHeight,\n // For SankeyChart\n shouldResize: (calculatedWidth ?? 0) + (calculatedHeight ?? 0),\n styles: {\n root: mergeClasses(child.props.styles?.root, childClasses.root),\n chartWrapper: mergeClasses(child.props.styles?.chartWrapper, childClasses.chartWrapper),\n chart: mergeClasses(child.props.styles?.chart, childClasses.chart),\n },\n });\n });\n }, [size, props.aspect, props.maxHeight, props.children]);\n\n return (\n <div\n ref={containerRef}\n style={{\n width: props.width ?? '100%',\n height: props.height ?? '100%',\n minWidth: props.minWidth,\n minHeight: props.minHeight,\n maxHeight: props.maxHeight,\n }}\n >\n {chartContent}\n </div>\n );\n};\nResponsiveContainer.displayName = 'ResponsiveContainer';\n"],"names":["React","getWindow","useResponsiveChildStyles","mergeClasses","ResponsiveContainer","props","containerRef","useRef","onResizeRef","childClasses","size","setSize","useState","current","onResize","useEffect","_window","animationFrameId","resizeObserver","resizeCallback","entries","width","containerWidth","height","containerHeight","contentRect","requestAnimationFrame","prevSize","roundedWidth","Math","floor","roundedHeight","ResizeObserver","observe","cancelAnimationFrame","disconnect","chartContent","useMemo","calculatedWidth","calculatedHeight","aspect","maxHeight","Children","map","children","child","cloneElement","shouldResize","styles","root","chartWrapper","chart","div","ref","style","minWidth","minHeight","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,wBAAwB,QAAQ,oCAAoC;AAC7E,SAASC,YAAY,QAAQ,iBAAiB;AAE9C;;;CAGC,GACD,OAAO,MAAMC,sBAA0DC,CAAAA;IACrE,MAAMC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KAAK/C;QACLgD,OAAO;YACLjC,OAAOhB,CAAAA,eAAAA,MAAMgB,KAAK,cAAXhB,0BAAAA,eAAe;YACtBkB,QAAQlB,CAAAA,gBAAAA,MAAMkB,MAAM,cAAZlB,2BAAAA,gBAAgB;YACxBkD,UAAUlD,MAAMkD,QAAQ;YACxBC,WAAWnD,MAAMmD,SAAS;YAC1Bf,WAAWpC,MAAMoC,SAAS;QAC5B;OAECL;AAGP,EAAE;AACFhC,oBAAoBqD,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResponsiveContainer.types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Responsive Child props\n * {@docCategory ResponsiveContainer}\n */\nexport interface ResponsiveChildProps {\n width?: number;\n height?: number;\n shouldResize?: number;\n}\n\n/**\n * Responsive Container props\n * {@docCategory ResponsiveContainer}\n */\nexport interface ResponsiveContainerProps {\n /**\n * Aspect ratio (width / height) of the container. If specified, the height will be calculated by width / aspect.\n */\n aspect?: number;\n\n /**\n * Width of the container\n */\n width?: number | string;\n\n /**\n * Height of the container\n */\n height?: number | string;\n\n /**\n * Minimum width of the container\n */\n minWidth?: number | string;\n\n /**\n * Minimum height of the container\n */\n minHeight?: number | string;\n\n /**\n * Maximum height of the container\n */\n maxHeight?: number;\n\n /**\n * Callback providing the updated chart width and height values when the container is resized\n */\n onResize?: (width: number, height: number) => void;\n\n /**\n * Child component to be rendered within the container\n */\n children: React.ReactElement<ResponsiveChildProps>;\n}\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["ResponsiveContainer.types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Responsive Child styles\n * {@docCategory ResponsiveContainer}\n */\nexport interface ResponsiveChildStyles {\n root?: string;\n chartWrapper?: string;\n chart?: string;\n}\n\n/**\n * Responsive Child props\n * {@docCategory ResponsiveContainer}\n */\nexport interface ResponsiveChildProps {\n width?: number;\n height?: number;\n shouldResize?: number;\n styles?: ResponsiveChildStyles;\n}\n\n/**\n * Responsive Container props\n * {@docCategory ResponsiveContainer}\n */\nexport interface ResponsiveContainerProps {\n /**\n * Aspect ratio (width / height) of the container. If specified, the height will be calculated by width / aspect.\n */\n aspect?: number;\n\n /**\n * Width of the container\n */\n width?: number | string;\n\n /**\n * Height of the container\n */\n height?: number | string;\n\n /**\n * Minimum width of the container\n */\n minWidth?: number | string;\n\n /**\n * Minimum height of the container\n */\n minHeight?: number | string;\n\n /**\n * Maximum height of the container\n */\n maxHeight?: number;\n\n /**\n * Callback providing the updated chart width and height values when the container is resized\n */\n onResize?: (width: number, height: number) => void;\n\n /**\n * Child component to be rendered within the container\n */\n children: React.ReactElement<ResponsiveChildProps>;\n}\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
+
export const responsiveChildClassNames = {
|
|
3
|
+
root: 'fui-charts-resp-child__root',
|
|
4
|
+
chartWrapper: 'fui-charts-resp-child__chartWrapper',
|
|
5
|
+
chart: 'fui-charts-resp-child__chart'
|
|
6
|
+
};
|
|
7
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
8
|
+
root: {
|
|
9
|
+
a9b677: "fly5x3f",
|
|
10
|
+
Bqenvij: "f1l02sjl"
|
|
11
|
+
},
|
|
12
|
+
chartWrapper: {
|
|
13
|
+
a9b677: "fly5x3f"
|
|
14
|
+
},
|
|
15
|
+
chart: {
|
|
16
|
+
a9b677: "fly5x3f"
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
d: [".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}"]
|
|
20
|
+
});
|
|
21
|
+
export const useResponsiveChildStyles = () => {
|
|
22
|
+
const baseStyles = useStyles();
|
|
23
|
+
return {
|
|
24
|
+
root: mergeClasses(responsiveChildClassNames.root, baseStyles.root),
|
|
25
|
+
chartWrapper: mergeClasses(responsiveChildClassNames.chartWrapper, baseStyles.chartWrapper),
|
|
26
|
+
chart: mergeClasses(responsiveChildClassNames.chart, baseStyles.chart)
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useResponsiveChildStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","responsiveChildClassNames","root","chartWrapper","chart","useStyles","a9b677","Bqenvij","d","useResponsiveChildStyles","baseStyles"],"sources":["useResponsiveChildStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nexport const responsiveChildClassNames = {\n root: 'fui-charts-resp-child__root',\n chartWrapper: 'fui-charts-resp-child__chartWrapper',\n chart: 'fui-charts-resp-child__chart'\n};\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n height: '100%'\n },\n chartWrapper: {\n width: '100%'\n },\n chart: {\n // This overrides the pixel width of svg allowing it to resize properly within a flexbox or grid layout.\n // Note: height is not set to 100% because that causes the charts to resize vertically in an infinite loop.\n width: '100%'\n }\n});\nexport const useResponsiveChildStyles = ()=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(responsiveChildClassNames.root, baseStyles.root),\n chartWrapper: mergeClasses(responsiveChildClassNames.chartWrapper, baseStyles.chartWrapper),\n chart: mergeClasses(responsiveChildClassNames.chart, baseStyles.chart)\n };\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,OAAO,MAAMC,yBAAyB,GAAG;EACrCC,IAAI,EAAE,6BAA6B;EACnCC,YAAY,EAAE,qCAAqC;EACnDC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,SAAS,gBAAGN,QAAA;EAAAG,IAAA;IAAAI,MAAA;IAAAC,OAAA;EAAA;EAAAJ,YAAA;IAAAG,MAAA;EAAA;EAAAF,KAAA;IAAAE,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,CAajB,CAAC;AACF,OAAO,MAAMC,wBAAwB,GAAGA,CAAA,KAAI;EACxC,MAAMC,UAAU,GAAGL,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHH,IAAI,EAAEF,YAAY,CAACC,yBAAyB,CAACC,IAAI,EAAEQ,UAAU,CAACR,IAAI,CAAC;IACnEC,YAAY,EAAEH,YAAY,CAACC,yBAAyB,CAACE,YAAY,EAAEO,UAAU,CAACP,YAAY,CAAC;IAC3FC,KAAK,EAAEJ,YAAY,CAACC,yBAAyB,CAACG,KAAK,EAAEM,UAAU,CAACN,KAAK;EACzE,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -286,22 +286,20 @@ function linkValue(originalLinks, link) {
|
|
|
286
286
|
// This is exported for unit tests.
|
|
287
287
|
export function preRenderLayout(margins, containerWidth, containerHeight, isRtl) {
|
|
288
288
|
const { left, right, top, bottom } = margins;
|
|
289
|
-
const width = containerWidth - right;
|
|
290
|
-
const height = containerHeight - bottom > 0 ? containerHeight - bottom : 0;
|
|
291
289
|
const sankey = d3Sankey().nodeWidth(NODE_WIDTH).extent([
|
|
292
290
|
[
|
|
293
291
|
left,
|
|
294
292
|
top
|
|
295
293
|
],
|
|
296
294
|
[
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
containerWidth - right,
|
|
296
|
+
containerHeight - bottom
|
|
299
297
|
]
|
|
300
298
|
]).nodeAlign(isRtl ? sankeyRight : sankeyJustify);
|
|
301
299
|
return {
|
|
302
300
|
sankey,
|
|
303
|
-
height,
|
|
304
|
-
width
|
|
301
|
+
height: containerHeight,
|
|
302
|
+
width: containerWidth
|
|
305
303
|
};
|
|
306
304
|
}
|
|
307
305
|
const elipsis = '...';
|
|
@@ -428,6 +426,7 @@ function nodeTextColor(state, singleNode) {
|
|
|
428
426
|
return !(!state.selectedState || state.selectedNodes.has(singleNode.index) && state.selectedNode || !state.selectedNode) ? DEFAULT_TEXT_COLOR : NON_SELECTED_TEXT_COLOR;
|
|
429
427
|
}
|
|
430
428
|
export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
429
|
+
var _props_reflowProps;
|
|
431
430
|
const classes = useSankeyChartStyles(props);
|
|
432
431
|
const chartContainer = React.useRef(null);
|
|
433
432
|
const _reqID = React.useRef();
|
|
@@ -474,7 +473,8 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
474
473
|
// NOTE: Calls to this method trigger a re-render.
|
|
475
474
|
const container = props.parentRef ? props.parentRef : chartContainer.current;
|
|
476
475
|
if (container) {
|
|
477
|
-
|
|
476
|
+
var _props_reflowProps;
|
|
477
|
+
const currentContainerWidth = ((_props_reflowProps = props.reflowProps) === null || _props_reflowProps === void 0 ? void 0 : _props_reflowProps.mode) === 'min-width' ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth()) : container.getBoundingClientRect().width;
|
|
478
478
|
const currentContainerHeight = container.getBoundingClientRect().height;
|
|
479
479
|
setContainerWidth(currentContainerWidth);
|
|
480
480
|
setContainerHeight(currentContainerHeight);
|
|
@@ -482,7 +482,7 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
482
482
|
});
|
|
483
483
|
}, [
|
|
484
484
|
_window,
|
|
485
|
-
props.
|
|
485
|
+
(_props_reflowProps = props.reflowProps) === null || _props_reflowProps === void 0 ? void 0 : _props_reflowProps.mode,
|
|
486
486
|
props.parentRef
|
|
487
487
|
]);
|
|
488
488
|
React.useEffect(()=>{
|
|
@@ -591,7 +591,7 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
591
591
|
const nodeValues = valuesOfNodes(transformed.nodes);
|
|
592
592
|
const linkValues = valuesOfLinks(transformed.links);
|
|
593
593
|
adjustOnePercentHeightNodes(nodesInColumn, nodeValues, linkValues);
|
|
594
|
-
adjustPadding(sankey,
|
|
594
|
+
adjustPadding(sankey, containerHeight - _margins.current.top - _margins.current.bottom, nodesInColumn);
|
|
595
595
|
// `sankey` is called a second time, probably to re-layout the nodes with the one-percent adjusted weights.
|
|
596
596
|
// NOTE: The second call to `sankey` is required to allow links to be hoverable.
|
|
597
597
|
// Without the second call, the links are not hoverable.
|
|
@@ -734,32 +734,28 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
734
734
|
const _onHover = (singleNode, mouseEvent)=>{
|
|
735
735
|
mouseEvent.persist();
|
|
736
736
|
_onCloseCallout();
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
setYCalloutValue(_formatNumber(singleNode.actualValue));
|
|
750
|
-
}
|
|
737
|
+
const _selectedLinks = getSelectedLinks(singleNode);
|
|
738
|
+
const _selectedNodes = getSelectedNodes(_selectedLinks);
|
|
739
|
+
_selectedNodes.push(singleNode);
|
|
740
|
+
setSelectedState(true);
|
|
741
|
+
setSelectedNodes(new Set(Array.from(_selectedNodes).map((node)=>node.index)));
|
|
742
|
+
setSelectedLinks(new Set(Array.from(_selectedLinks).map((link)=>link.index)));
|
|
743
|
+
setSelectedNode(singleNode);
|
|
744
|
+
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
745
|
+
setCalloutVisible(singleNode.y1 - singleNode.y0 < MIN_HEIGHT_FOR_TYPE);
|
|
746
|
+
setColor(singleNode.color);
|
|
747
|
+
setXCalloutValue(singleNode.name);
|
|
748
|
+
setYCalloutValue(_formatNumber(singleNode.actualValue));
|
|
751
749
|
};
|
|
752
750
|
const _onStreamHover = (mouseEvent, singleLink, from)=>{
|
|
753
751
|
mouseEvent.persist();
|
|
754
752
|
_onCloseCallout();
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
_linkCalloutAttributes(singleLink, from);
|
|
762
|
-
}
|
|
753
|
+
const { selectedLinks: _selectedLinks, selectedNodes: _selectedNodes } = getSelectedLinksforStreamHover(singleLink);
|
|
754
|
+
setSelectedState(true);
|
|
755
|
+
setSelectedNodes(new Set(Array.from(_selectedNodes).map((node)=>node.index)));
|
|
756
|
+
setSelectedLinks(new Set(Array.from(_selectedLinks).map((link)=>link.index)));
|
|
757
|
+
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
758
|
+
_linkCalloutAttributes(singleLink, from);
|
|
763
759
|
};
|
|
764
760
|
const _onStreamLeave = (singleLink)=>{
|
|
765
761
|
if (selectedState) {
|
|
@@ -984,7 +980,8 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
984
980
|
}, /*#__PURE__*/ React.createElement("svg", {
|
|
985
981
|
width: width,
|
|
986
982
|
height: height,
|
|
987
|
-
id: _chartId
|
|
983
|
+
id: _chartId,
|
|
984
|
+
className: classes.chart
|
|
988
985
|
}, nodeLinkDomOrderArray.map((item)=>{
|
|
989
986
|
if (item.type === 'node') {
|
|
990
987
|
return /*#__PURE__*/ React.createElement("g", {
|
|
@@ -1018,6 +1015,3 @@ export const SankeyChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=
|
|
|
1018
1015
|
});
|
|
1019
1016
|
});
|
|
1020
1017
|
SankeyChart.displayName = 'SankeyChart';
|
|
1021
|
-
SankeyChart.defaultProps = {
|
|
1022
|
-
enableReflow: true
|
|
1023
|
-
};
|