@fluentui/react-charts 0.0.0-nightly-20250702-0405.1 → 0.0.0-nightly-20250703-1103.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 +15 -15
- package/dist/index.d.ts +37 -2
- 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 +1 -0
- 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 +1 -1
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +10 -7
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +5 -10
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.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 +13 -7
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.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.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- 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/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 +11 -13
- 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/useScatterChartStyles.styles.js +2 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.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/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.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 +1 -0
- 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 +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +11 -8
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +5 -10
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.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 -9
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.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.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- 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/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 +11 -13
- 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/useScatterChartStyles.styles.js +2 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.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/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/package.json +13 -13
|
@@ -11,9 +11,12 @@ Object.defineProperty(exports, "ResponsiveContainer", {
|
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _getWindow = require("../../utilities/getWindow");
|
|
14
|
+
const _useResponsiveChildStylesstyles = require("./useResponsiveChildStyles.styles");
|
|
15
|
+
const _react1 = require("@griffel/react");
|
|
14
16
|
const ResponsiveContainer = (props)=>{
|
|
15
17
|
const containerRef = _react.useRef(null);
|
|
16
18
|
const onResizeRef = _react.useRef();
|
|
19
|
+
const childClasses = (0, _useResponsiveChildStylesstyles.useResponsiveChildStyles)();
|
|
17
20
|
const [size, setSize] = _react.useState({});
|
|
18
21
|
onResizeRef.current = props.onResize;
|
|
19
22
|
_react.useEffect(()=>{
|
|
@@ -66,37 +69,36 @@ const ResponsiveContainer = (props)=>{
|
|
|
66
69
|
calculatedHeight = props.maxHeight;
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
ref: containerRef,
|
|
72
|
-
style: {
|
|
73
|
-
width: (_props_width = props.width) !== null && _props_width !== void 0 ? _props_width : '100%',
|
|
74
|
-
height: (_props_height = props.height) !== null && _props_height !== void 0 ? _props_height : '100%',
|
|
75
|
-
minWidth: props.minWidth,
|
|
76
|
-
minHeight: props.minHeight,
|
|
77
|
-
maxHeight: props.maxHeight,
|
|
78
|
-
// Ensure the child element fills the parent container
|
|
79
|
-
// https://stackoverflow.com/questions/8468066/child-inside-parent-with-min-height-100-not-inheriting-height
|
|
80
|
-
'--root-width': calculatedWidth + 'px',
|
|
81
|
-
'--root-height': calculatedHeight + 'px'
|
|
82
|
-
}
|
|
83
|
-
}, _react.Children.map(props.children, (child)=>{
|
|
72
|
+
return _react.Children.map(props.children, (child)=>{
|
|
73
|
+
var _child_props_styles, _child_props_styles1, _child_props_styles2;
|
|
84
74
|
return /*#__PURE__*/ _react.cloneElement(child, {
|
|
85
75
|
width: calculatedWidth,
|
|
86
76
|
height: calculatedHeight,
|
|
87
|
-
|
|
77
|
+
// For SankeyChart
|
|
78
|
+
shouldResize: (calculatedWidth !== null && calculatedWidth !== void 0 ? calculatedWidth : 0) + (calculatedHeight !== null && calculatedHeight !== void 0 ? calculatedHeight : 0),
|
|
79
|
+
styles: {
|
|
80
|
+
root: (0, _react1.mergeClasses)((_child_props_styles = child.props.styles) === null || _child_props_styles === void 0 ? void 0 : _child_props_styles.root, childClasses.root),
|
|
81
|
+
chartWrapper: (0, _react1.mergeClasses)((_child_props_styles1 = child.props.styles) === null || _child_props_styles1 === void 0 ? void 0 : _child_props_styles1.chartWrapper, childClasses.chartWrapper),
|
|
82
|
+
chart: (0, _react1.mergeClasses)((_child_props_styles2 = child.props.styles) === null || _child_props_styles2 === void 0 ? void 0 : _child_props_styles2.chart, childClasses.chart)
|
|
83
|
+
}
|
|
88
84
|
});
|
|
89
|
-
})
|
|
85
|
+
});
|
|
90
86
|
}, [
|
|
91
87
|
size,
|
|
92
88
|
props.aspect,
|
|
93
89
|
props.maxHeight,
|
|
94
|
-
props.children
|
|
95
|
-
props.width,
|
|
96
|
-
props.height,
|
|
97
|
-
props.minHeight,
|
|
98
|
-
props.minWidth
|
|
90
|
+
props.children
|
|
99
91
|
]);
|
|
100
|
-
|
|
92
|
+
var _props_width, _props_height;
|
|
93
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
94
|
+
ref: containerRef,
|
|
95
|
+
style: {
|
|
96
|
+
width: (_props_width = props.width) !== null && _props_width !== void 0 ? _props_width : '100%',
|
|
97
|
+
height: (_props_height = props.height) !== null && _props_height !== void 0 ? _props_height : '100%',
|
|
98
|
+
minWidth: props.minWidth,
|
|
99
|
+
minHeight: props.minHeight,
|
|
100
|
+
maxHeight: props.maxHeight
|
|
101
|
+
}
|
|
102
|
+
}, chartContent);
|
|
101
103
|
};
|
|
102
104
|
ResponsiveContainer.displayName = 'ResponsiveContainer';
|
|
@@ -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":["ResponsiveContainer","props","containerRef","React","useRef","onResizeRef","childClasses","useResponsiveChildStyles","size","setSize","useState","current","onResize","useEffect","_window","getWindow","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","mergeClasses","chartWrapper","chart","createElement","div","ref","style","minWidth","minHeight","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;;iEAVU;2BACG;gDAEe;wBACZ;AAMtB,MAAMA,sBAA0DC,CAAAA;IACrE,MAAMC,eAAeC,OAAMC,MAAM,CAAiB;IAClD,MAAMC,cAAcF,OAAMC,MAAM;IAChC,MAAME,eAAeC,IAAAA,wDAAAA;IAErB,MAAM,CAACC,MAAMC,QAAQ,GAAGN,OA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OF,IAAAA,oBAAAA,EAAAA,AAAaL,CAAAA,uBAAAA,MAAM3C,KAAK,CAAC8C,MAAM,AAANA,MAAM,QAAlBH,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAoBO,KAAK,EAAE7C,aAAa6C,KAAK;gBACnE;YACF;QACF;IACF,GAAG;QAAC3C;QAAMP,MAAMsC,MAAM;QAAEtC,MAAMuC,SAAS;QAAEvC,MAAM0C,QAAQ;KAAC;QAM3C1C,cACCA;IALd,OAAA,WAAA,GACEE,OAAAiD,aAAA,CAACC,OAAAA;QACCC,KAAKpD;QACLqD,OAAO;YACLnC,OAAOnB,CAAAA,eAAAA,MAAMmB,KAAK,AAALA,MAAK,QAAXnB,iBAAAA,KAAAA,IAAAA,eAAe;YACtBqB,QAAQrB,CAAAA,gBAAAA,MAAMqB,MAAM,AAANA,MAAM,QAAZrB,kBAAAA,KAAAA,IAAAA,gBAAgB;YACxBuD,UAAUvD,MAAMuD,QAAQ;YACxBC,WAAWxD,MAAMwD,SAAS;YAC1BjB,WAAWvC,MAAMuC,SAAS;QAC5B;OAECL;AAGP;AACAnC,oBAAoB0D,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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
|
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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
responsiveChildClassNames: function() {
|
|
13
|
+
return responsiveChildClassNames;
|
|
14
|
+
},
|
|
15
|
+
useResponsiveChildStyles: function() {
|
|
16
|
+
return useResponsiveChildStyles;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const responsiveChildClassNames = {
|
|
21
|
+
root: 'fui-charts-resp-child__root',
|
|
22
|
+
chartWrapper: 'fui-charts-resp-child__chartWrapper',
|
|
23
|
+
chart: 'fui-charts-resp-child__chart'
|
|
24
|
+
};
|
|
25
|
+
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
26
|
+
root: {
|
|
27
|
+
a9b677: "fly5x3f",
|
|
28
|
+
Bqenvij: "f1l02sjl"
|
|
29
|
+
},
|
|
30
|
+
chartWrapper: {
|
|
31
|
+
a9b677: "fly5x3f"
|
|
32
|
+
},
|
|
33
|
+
chart: {
|
|
34
|
+
a9b677: "fly5x3f"
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
d: [
|
|
38
|
+
".fly5x3f{width:100%;}",
|
|
39
|
+
".f1l02sjl{height:100%;}"
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
const useResponsiveChildStyles = ()=>{
|
|
43
|
+
const baseStyles = useStyles();
|
|
44
|
+
return {
|
|
45
|
+
root: (0, _react.mergeClasses)(responsiveChildClassNames.root, baseStyles.root),
|
|
46
|
+
chartWrapper: (0, _react.mergeClasses)(responsiveChildClassNames.chartWrapper, baseStyles.chartWrapper),
|
|
47
|
+
chart: (0, _react.mergeClasses)(responsiveChildClassNames.chart, baseStyles.chart)
|
|
48
|
+
};
|
|
49
|
+
}; //# sourceMappingURL=useResponsiveChildStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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"],"names":["responsiveChildClassNames","useResponsiveChildStyles","root","chartWrapper","chart","useStyles","__styles","a9b677","Bqenvij","d","baseStyles","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,yBAAyB;eAAzBA;;IAmBAC,wBAAwB;eAAxBA;;;uBApB4B;AAClC,MAAMD,4BAA4B;IACrCE,MAAM;IACNC,cAAc;IACdC,OAAO;AACX;AACA,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAJ,MAAA;QAAAK,QAAA;QAAAC,SAAA;IAAA;IAAAL,cAAA;QAAAI,QAAA;IAAA;IAAAH,OAAA;QAAAG,QAAA;IAAA;AAAA,GAAA;IAAAE,GAAA;QAAA;QAAA;KAAA;AAAA;AAcX,MAAMR,2BAA2BA;IACpC,MAAMS,aAAaL;IACnB,OAAO;QACHH,MAAMS,IAAAA,mBAAY,EAACX,0BAA0BE,IAAI,EAAEQ,WAAWR,IAAI;QAClEC,cAAcQ,IAAAA,mBAAY,EAACX,0BAA0BG,YAAY,EAAEO,WAAWP,YAAY;QAC1FC,OAAOO,IAAAA,mBAAY,EAACX,0BAA0BI,KAAK,EAAEM,WAAWN,KAAK;IACzE;AACJ"}
|
|
@@ -302,22 +302,20 @@ function linkValue(originalLinks, link) {
|
|
|
302
302
|
}
|
|
303
303
|
function preRenderLayout(margins, containerWidth, containerHeight, isRtl) {
|
|
304
304
|
const { left, right, top, bottom } = margins;
|
|
305
|
-
const width = containerWidth - right;
|
|
306
|
-
const height = containerHeight - bottom > 0 ? containerHeight - bottom : 0;
|
|
307
305
|
const sankey = (0, _d3sankey.sankey)().nodeWidth(NODE_WIDTH).extent([
|
|
308
306
|
[
|
|
309
307
|
left,
|
|
310
308
|
top
|
|
311
309
|
],
|
|
312
310
|
[
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
containerWidth - right,
|
|
312
|
+
containerHeight - bottom
|
|
315
313
|
]
|
|
316
314
|
]).nodeAlign(isRtl ? _d3sankey.sankeyRight : _d3sankey.sankeyJustify);
|
|
317
315
|
return {
|
|
318
316
|
sankey,
|
|
319
|
-
height,
|
|
320
|
-
width
|
|
317
|
+
height: containerHeight,
|
|
318
|
+
width: containerWidth
|
|
321
319
|
};
|
|
322
320
|
}
|
|
323
321
|
const elipsis = '...';
|
|
@@ -444,6 +442,7 @@ function nodeTextColor(state, singleNode) {
|
|
|
444
442
|
return !(!state.selectedState || state.selectedNodes.has(singleNode.index) && state.selectedNode || !state.selectedNode) ? DEFAULT_TEXT_COLOR : NON_SELECTED_TEXT_COLOR;
|
|
445
443
|
}
|
|
446
444
|
const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
445
|
+
var _props_reflowProps;
|
|
447
446
|
const classes = (0, _useSankeyChartStylesstyles.useSankeyChartStyles)(props);
|
|
448
447
|
const chartContainer = _react.useRef(null);
|
|
449
448
|
const _reqID = _react.useRef();
|
|
@@ -490,7 +489,8 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
490
489
|
// NOTE: Calls to this method trigger a re-render.
|
|
491
490
|
const container = props.parentRef ? props.parentRef : chartContainer.current;
|
|
492
491
|
if (container) {
|
|
493
|
-
|
|
492
|
+
var _props_reflowProps;
|
|
493
|
+
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;
|
|
494
494
|
const currentContainerHeight = container.getBoundingClientRect().height;
|
|
495
495
|
setContainerWidth(currentContainerWidth);
|
|
496
496
|
setContainerHeight(currentContainerHeight);
|
|
@@ -498,7 +498,7 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
498
498
|
});
|
|
499
499
|
}, [
|
|
500
500
|
_window,
|
|
501
|
-
props.
|
|
501
|
+
(_props_reflowProps = props.reflowProps) === null || _props_reflowProps === void 0 ? void 0 : _props_reflowProps.mode,
|
|
502
502
|
props.parentRef
|
|
503
503
|
]);
|
|
504
504
|
_react.useEffect(()=>{
|
|
@@ -607,7 +607,7 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
607
607
|
const nodeValues = valuesOfNodes(transformed.nodes);
|
|
608
608
|
const linkValues = valuesOfLinks(transformed.links);
|
|
609
609
|
adjustOnePercentHeightNodes(nodesInColumn, nodeValues, linkValues);
|
|
610
|
-
adjustPadding(sankey,
|
|
610
|
+
adjustPadding(sankey, containerHeight - _margins.current.top - _margins.current.bottom, nodesInColumn);
|
|
611
611
|
// `sankey` is called a second time, probably to re-layout the nodes with the one-percent adjusted weights.
|
|
612
612
|
// NOTE: The second call to `sankey` is required to allow links to be hoverable.
|
|
613
613
|
// Without the second call, the links are not hoverable.
|
|
@@ -1000,7 +1000,8 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1000
1000
|
}, /*#__PURE__*/ _react.createElement("svg", {
|
|
1001
1001
|
width: width,
|
|
1002
1002
|
height: height,
|
|
1003
|
-
id: _chartId
|
|
1003
|
+
id: _chartId,
|
|
1004
|
+
className: classes.chart
|
|
1004
1005
|
}, nodeLinkDomOrderArray.map((item)=>{
|
|
1005
1006
|
if (item.type === 'node') {
|
|
1006
1007
|
return /*#__PURE__*/ _react.createElement("g", {
|
|
@@ -1034,6 +1035,3 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1034
1035
|
});
|
|
1035
1036
|
});
|
|
1036
1037
|
SankeyChart.displayName = 'SankeyChart';
|
|
1037
|
-
SankeyChart.defaultProps = {
|
|
1038
|
-
enableReflow: true
|
|
1039
|
-
};
|