@fluentui/react-charts 0.0.0-nightly-20250617-0407.1 → 0.0.0-nightly-20250619-0405.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 +37 -15
- package/dist/index.d.ts +66 -5
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +4 -4
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +25 -13
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +7 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -3
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +4 -4
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +2 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +51 -22
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib/components/ResponsiveContainer/index.js +2 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js +19 -0
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -3
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +3 -3
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +2 -2
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +25 -13
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +7 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +4 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +6 -4
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +2 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +47 -21
- 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/index.js +2 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +27 -0
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +4 -4
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +2 -2
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +13 -13
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +0 -23
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +0 -47
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +0 -1
|
@@ -10,19 +10,15 @@ Object.defineProperty(exports, "ResponsiveContainer", {
|
|
|
10
10
|
});
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
const
|
|
14
|
-
const _useResponsiveContainerStylesstyles = require("./useResponsiveContainerStyles.styles");
|
|
13
|
+
const _getWindow = require("../../utilities/getWindow");
|
|
15
14
|
const ResponsiveContainer = (props)=>{
|
|
16
15
|
const containerRef = _react.useRef(null);
|
|
17
16
|
const onResizeRef = _react.useRef();
|
|
18
|
-
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
19
|
-
const classes = (0, _useResponsiveContainerStylesstyles.useResponsiveContainerStyles)(props);
|
|
20
17
|
const [size, setSize] = _react.useState({});
|
|
21
18
|
onResizeRef.current = props.onResize;
|
|
22
|
-
const _window = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
|
|
23
19
|
_react.useEffect(()=>{
|
|
20
|
+
const _window = (0, _getWindow.getWindow)(containerRef.current);
|
|
24
21
|
let animationFrameId;
|
|
25
|
-
// eslint-disable-next-line no-restricted-globals
|
|
26
22
|
let resizeObserver;
|
|
27
23
|
const resizeCallback = (entries)=>{
|
|
28
24
|
var _onResizeRef_current;
|
|
@@ -44,7 +40,7 @@ const ResponsiveContainer = (props)=>{
|
|
|
44
40
|
});
|
|
45
41
|
(_onResizeRef_current = onResizeRef.current) === null || _onResizeRef_current === void 0 ? void 0 : _onResizeRef_current.call(onResizeRef, containerWidth, containerHeight);
|
|
46
42
|
};
|
|
47
|
-
if (_window
|
|
43
|
+
if (_window && _window.ResizeObserver) {
|
|
48
44
|
resizeObserver = new _window.ResizeObserver(resizeCallback);
|
|
49
45
|
if (containerRef.current) {
|
|
50
46
|
resizeObserver.observe(containerRef.current);
|
|
@@ -56,21 +52,51 @@ const ResponsiveContainer = (props)=>{
|
|
|
56
52
|
}
|
|
57
53
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
58
54
|
};
|
|
55
|
+
}, []);
|
|
56
|
+
const chartContent = _react.useMemo(()=>{
|
|
57
|
+
let calculatedWidth = size.containerWidth;
|
|
58
|
+
let calculatedHeight = size.containerHeight;
|
|
59
|
+
if (typeof props.aspect === 'number' && props.aspect > 0) {
|
|
60
|
+
if (calculatedWidth) {
|
|
61
|
+
calculatedHeight = calculatedWidth / props.aspect;
|
|
62
|
+
} else if (calculatedHeight) {
|
|
63
|
+
calculatedWidth = calculatedHeight * props.aspect;
|
|
64
|
+
}
|
|
65
|
+
if (typeof props.maxHeight === 'number' && calculatedHeight && calculatedHeight > props.maxHeight) {
|
|
66
|
+
calculatedHeight = props.maxHeight;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
var _props_width, _props_height;
|
|
70
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
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)=>{
|
|
84
|
+
return /*#__PURE__*/ _react.cloneElement(child, {
|
|
85
|
+
width: calculatedWidth,
|
|
86
|
+
height: calculatedHeight,
|
|
87
|
+
shouldResize: (calculatedWidth !== null && calculatedWidth !== void 0 ? calculatedWidth : 0) + (calculatedHeight !== null && calculatedHeight !== void 0 ? calculatedHeight : 0)
|
|
88
|
+
});
|
|
89
|
+
}));
|
|
59
90
|
}, [
|
|
60
|
-
|
|
91
|
+
size,
|
|
92
|
+
props.aspect,
|
|
93
|
+
props.maxHeight,
|
|
94
|
+
props.children,
|
|
95
|
+
props.width,
|
|
96
|
+
props.height,
|
|
97
|
+
props.minHeight,
|
|
98
|
+
props.minWidth
|
|
61
99
|
]);
|
|
62
|
-
return
|
|
63
|
-
ref: containerRef,
|
|
64
|
-
className: classes.root,
|
|
65
|
-
style: {
|
|
66
|
-
width: props.width,
|
|
67
|
-
height: props.height
|
|
68
|
-
}
|
|
69
|
-
}, _react.Children.map(props.children, (child)=>{
|
|
70
|
-
return /*#__PURE__*/ _react.cloneElement(child, {
|
|
71
|
-
width: size.containerWidth,
|
|
72
|
-
height: size.containerHeight
|
|
73
|
-
});
|
|
74
|
-
}));
|
|
100
|
+
return chartContent;
|
|
75
101
|
};
|
|
76
102
|
ResponsiveContainer.displayName = 'ResponsiveContainer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResponsiveContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
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 (\n <div\n ref={containerRef}\n style={\n {\n width: props.width ?? '100%',\n height: props.height ?? '100%',\n minWidth: props.minWidth,\n minHeight: props.minHeight,\n maxHeight: props.maxHeight,\n // Ensure the child element fills the parent container\n // https://stackoverflow.com/questions/8468066/child-inside-parent-with-min-height-100-not-inheriting-height\n '--root-width': calculatedWidth + 'px',\n '--root-height': calculatedHeight + 'px',\n } as React.CSSProperties\n }\n >\n {React.Children.map(props.children, child => {\n return React.cloneElement<ResponsiveChildProps>(child, {\n width: calculatedWidth,\n height: calculatedHeight,\n shouldResize: (calculatedWidth ?? 0) + (calculatedHeight ?? 0),\n });\n })}\n </div>\n );\n }, [size, props.aspect, props.maxHeight, props.children, props.width, props.height, props.minHeight, props.minWidth]);\n\n return chartContent;\n};\nResponsiveContainer.displayName = 'ResponsiveContainer';\n"],"names":["ResponsiveContainer","props","containerRef","React","useRef","onResizeRef","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","createElement","div","ref","style","minWidth","minHeight","Children","map","children","child","cloneElement","shouldResize","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;2BACG;AAOnB,MAAMA,sBAA0DC,CAAAA;IACrE,MAAMC,eAAeC,OAAMC,MAAM,CAAiB;IAClD,MAAMC,cAAcF,OAAMC,MAAM;IAEhC,MAAM,CAACE,MAAMC,QAAQ,GAAGJ,OAAMK,QAAQ,CAAwD,CAAC;IAE/FH,YAAYI,OAAO,GAAGR,MAAMS,QAAQ;IAEpCP,OAAMQ,SAAS,CAAC;QACd,MAAMC,UAAUC,IAAAA,oBAAAA,EAAUX,aAAaO,OAAO;QAC9C,IAAIK;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AM;QAAEnB,MAAM2C,SAAS;QAAE3C,MAAM0C,QAAQ;KAAC;IAEpH,OAAOV;AACT;AACAjC,oBAAoBmD,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResponsiveContainer.types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface
|
|
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"}
|
|
@@ -4,3 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
6
|
_export_star._(require("./ResponsiveContainer"), exports);
|
|
7
|
+
_export_star._(require("./ResponsiveContainer.types"), exports);
|
|
8
|
+
_export_star._(require("./withResponsiveContainer"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ResponsiveContainer';\n"],"names":[],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ResponsiveContainer';\nexport * from './ResponsiveContainer.types';\nexport * from './withResponsiveContainer';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */ "use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "withResponsiveContainer", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return withResponsiveContainer;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _ResponsiveContainer = require("./ResponsiveContainer");
|
|
14
|
+
function withResponsiveContainer(WrappedComponent) {
|
|
15
|
+
const ComponentWithResponsiveContainer = ({ aspect, width, height, minWidth, minHeight, maxHeight, onResize, ...restProps })=>{
|
|
16
|
+
return /*#__PURE__*/ _react.createElement(_ResponsiveContainer.ResponsiveContainer, {
|
|
17
|
+
aspect: aspect,
|
|
18
|
+
width: width,
|
|
19
|
+
height: height,
|
|
20
|
+
minWidth: minWidth,
|
|
21
|
+
minHeight: minHeight,
|
|
22
|
+
maxHeight: maxHeight,
|
|
23
|
+
onResize: onResize
|
|
24
|
+
}, /*#__PURE__*/ _react.createElement(WrappedComponent, restProps));
|
|
25
|
+
};
|
|
26
|
+
return ComponentWithResponsiveContainer;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["withResponsiveContainer.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { ResponsiveContainer } from './ResponsiveContainer';\nimport { ResponsiveContainerProps } from './ResponsiveContainer.types';\n\n/**\n * An HOC to update wrapped component on container resize.\n * {@docCategory ResponsiveContainer}\n */\nexport function withResponsiveContainer<TProps extends Omit<ResponsiveContainerProps, 'children'>>(\n WrappedComponent: React.ComponentType<TProps>,\n) {\n const ComponentWithResponsiveContainer: React.FC<TProps> = ({\n aspect,\n width,\n height,\n minWidth,\n minHeight,\n maxHeight,\n onResize,\n ...restProps\n }) => {\n return (\n <ResponsiveContainer\n aspect={aspect}\n width={width}\n height={height}\n minWidth={minWidth}\n minHeight={minHeight}\n maxHeight={maxHeight}\n onResize={onResize}\n >\n <WrappedComponent {...(restProps as any)} />\n </ResponsiveContainer>\n );\n };\n\n return ComponentWithResponsiveContainer;\n}\n"],"names":["withResponsiveContainer","WrappedComponent","ComponentWithResponsiveContainer","aspect","width","height","minWidth","minHeight","maxHeight","onResize","restProps","React","createElement","ResponsiveContainer"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,qDAAqD;;;;+BASrCA;;;eAAAA;;;;iEARO;qCACa;AAO7B,SAASA,wBACdC,gBAA6C;IAE7C,MAAMC,mCAAqD,CAAC,EAC1DC,MAAM,EACNC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACR,GAAGC,WACJ;QACC,OAAA,WAAA,GACEC,OAAAC,aAAA,CAACC,wCAAAA,EAAAA;YACCV,QAAQA;YACRC,OAAOA;YACPC,QAAQA;YACRC,UAAUA;YACVC,WAAWA;YACXC,WAAWA;YACXC,UAAUA;yBAEVE,OAAAC,aAAA,CAACX,kBAAsBS;IAG7B;IAEA,OAAOR;AACT"}
|
|
@@ -32,8 +32,8 @@ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
32
32
|
Bhrd7zp: "figsok6",
|
|
33
33
|
Bg96gwp: "f1i3iumi",
|
|
34
34
|
mc9l5x: "f22iagw",
|
|
35
|
-
a9b677: "
|
|
36
|
-
Bqenvij: "
|
|
35
|
+
a9b677: "fsr8r2d",
|
|
36
|
+
Bqenvij: "f50j5g9",
|
|
37
37
|
Beiy3e4: "f1vx9l62",
|
|
38
38
|
B68tc82: 0,
|
|
39
39
|
Bmxbyg5: 0,
|
|
@@ -106,8 +106,8 @@ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
106
106
|
".figsok6{font-weight:var(--fontWeightRegular);}",
|
|
107
107
|
".f1i3iumi{line-height:var(--lineHeightBase300);}",
|
|
108
108
|
".f22iagw{display:flex;}",
|
|
109
|
-
".
|
|
110
|
-
".
|
|
109
|
+
".fsr8r2d{width:var(--root-width, 100%);}",
|
|
110
|
+
".f50j5g9{height:var(--root-height, 100%);}",
|
|
111
111
|
".f1vx9l62{flex-direction:column;}",
|
|
112
112
|
[
|
|
113
113
|
".f1a3p1vp{overflow:hidden;}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useSankeyChartStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { HighContrastSelectorBlack } from '../../utilities/index';\nexport const sankeyChartClassNames = {\n root: 'fui-sc__root',\n nodes: 'fui-sc__nodes',\n links: 'fui-sc__links',\n nodeTextContainer: 'fui-sc__nodeTextContainer',\n toolTip: 'fui-sc__toolTip',\n chartWrapper: 'fui-sc__chartWrapper'\n};\nconst useStyles = makeStyles({\n root: {\n ...typographyStyles.body1,\n display: 'flex',\n width: '100%',\n height: '100%',\n flexDirection: 'column',\n overflow: 'hidden'\n },\n links: {\n fill: tokens.colorNeutralBackground1,\n strokeWidth: '3px',\n [HighContrastSelectorBlack]: {\n fill: 'Canvas'\n }\n },\n nodes: {\n fill: '#F5F5F5',\n [HighContrastSelectorBlack]: {\n fill: 'Canvas'\n }\n },\n toolTip: {\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n padding: '8px',\n position: 'absolute',\n textAlign: 'center',\n top: '0px',\n background: tokens.colorNeutralBackground1,\n borderRadius: '2px',\n pointerEvents: 'none'\n },\n nodeTextContainer: {\n '& text': {\n [HighContrastSelectorBlack]: {\n fill: 'CanvasText'\n }\n },\n marginTop: '4px',\n marginLeft: '8px',\n marginBottom: '4px',\n marginRight: '8px'\n },\n chartWrapper: {\n overflow: 'auto'\n }\n});\nexport const useSankeyChartStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(sankeyChartClassNames.root, baseStyles.root /*, props.styles?.root*/ ),\n nodes: mergeClasses(sankeyChartClassNames.nodes, baseStyles.nodes /*, props.styles?.nodes*/ ),\n links: mergeClasses(sankeyChartClassNames.links, baseStyles.links /*, props.styles?.links*/ ),\n nodeTextContainer: mergeClasses(sankeyChartClassNames.nodeTextContainer, baseStyles.nodeTextContainer /*, props.styles?.nodeTextContainer*/ ),\n toolTip: mergeClasses(sankeyChartClassNames.toolTip, baseStyles.toolTip /*, props.styles?.toolTip*/ ),\n chartWrapper: mergeClasses(sankeyChartClassNames.chartWrapper, props.enableReflow ? baseStyles.chartWrapper : '' /*, props.styles?.chartWrapper*/ )\n };\n};\n"],"names":["sankeyChartClassNames","useSankeyChartStyles","root","nodes","links","nodeTextContainer","toolTip","chartWrapper","useStyles","__styles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","a9b677","Bqenvij","Beiy3e4","B68tc82","Bmxbyg5","Bpg54ce","Bkfmm31","Be5yapy","Bcjfw9x","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","qhf8xq","fsow6f","Bhzewxz","Bgh53k4","B2eet1l","De3pzq","Bcmaq0h","gk0gix","B20660r","B8a6bjv","Bpptf2m","e5kdtc","Bkjc3bi","ayd6f0","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bkecrkj","Dzfv0s","B6of3ja","Frg6f3","jrapky","t21cq0","d","p","m","props","baseStyles","mergeClasses","enableReflow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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les.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { HighContrastSelectorBlack } from '../../utilities/index';\nexport const sankeyChartClassNames = {\n root: 'fui-sc__root',\n nodes: 'fui-sc__nodes',\n links: 'fui-sc__links',\n nodeTextContainer: 'fui-sc__nodeTextContainer',\n toolTip: 'fui-sc__toolTip',\n chartWrapper: 'fui-sc__chartWrapper'\n};\nconst useStyles = makeStyles({\n root: {\n ...typographyStyles.body1,\n display: 'flex',\n width: 'var(--root-width, 100%)',\n height: 'var(--root-height, 100%)',\n flexDirection: 'column',\n overflow: 'hidden'\n },\n links: {\n fill: tokens.colorNeutralBackground1,\n strokeWidth: '3px',\n [HighContrastSelectorBlack]: {\n fill: 'Canvas'\n }\n },\n nodes: {\n fill: '#F5F5F5',\n [HighContrastSelectorBlack]: {\n fill: 'Canvas'\n }\n },\n toolTip: {\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n padding: '8px',\n position: 'absolute',\n textAlign: 'center',\n top: '0px',\n background: tokens.colorNeutralBackground1,\n borderRadius: '2px',\n pointerEvents: 'none'\n },\n nodeTextContainer: {\n '& text': {\n [HighContrastSelectorBlack]: {\n fill: 'CanvasText'\n }\n },\n marginTop: '4px',\n marginLeft: '8px',\n marginBottom: '4px',\n marginRight: '8px'\n },\n chartWrapper: {\n overflow: 'auto'\n }\n});\nexport const useSankeyChartStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(sankeyChartClassNames.root, baseStyles.root /*, props.styles?.root*/ ),\n nodes: mergeClasses(sankeyChartClassNames.nodes, baseStyles.nodes /*, props.styles?.nodes*/ ),\n links: mergeClasses(sankeyChartClassNames.links, baseStyles.links /*, props.styles?.links*/ ),\n nodeTextContainer: mergeClasses(sankeyChartClassNames.nodeTextContainer, baseStyles.nodeTextContainer /*, props.styles?.nodeTextContainer*/ ),\n toolTip: mergeClasses(sankeyChartClassNames.toolTip, baseStyles.toolTip /*, props.styles?.toolTip*/ ),\n chartWrapper: mergeClasses(sankeyChartClassNames.chartWrapper, props.enableReflow ? baseStyles.chartWrapper : '' /*, props.styles?.chartWrapper*/ )\n };\n};\n"],"names":["sankeyChartClassNames","useSankeyChartStyles","root","nodes","links","nodeTextContainer","toolTip","chartWrapper","useStyles","__styles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","a9b677","Bqenvij","Beiy3e4","B68tc82","Bmxbyg5","Bpg54ce","Bkfmm31","Be5yapy","Bcjfw9x","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","qhf8xq","fsow6f","Bhzewxz","Bgh53k4","B2eet1l","De3pzq","Bcmaq0h","gk0gix","B20660r","B8a6bjv","Bpptf2m","e5kdtc","Bkjc3bi","ayd6f0","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bkecrkj","Dzfv0s","B6of3ja","Frg6f3","jrapky","t21cq0","d","p","m","props","baseStyles","mergeClasses","enableReflow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGaA,qBAAqB;eAArBA;;IAyDAC,oBAAoB;eAApBA;;;uBA5D4B;AAGlC,MAAMD,wBAAwB;IACjCE,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,mBAAmB;IACnBC,SAAS;IACTC,cAAc;AAClB;AACA,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAP,MAAA;QAAAQ,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,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,GAAA;YAAA;SAAA;KAAA;AAAA;AAiDX,MAAMvD,uBAAwBwD,CAAAA;IACjC,MAAMC,aAAalD;IACnB,OAAO;QACHN,MAAMyD,IAAAA,mBAAY,EAAC3D,sBAAsBE,IAAI,EAAEwD,WAAWxD,IAAI,CAAC,sBAAA;QAC/DC,OAAOwD,IAAAA,mBAAY,EAAC3D,sBAAsBG,KAAK,EAAEuD,WAAWvD,KAAK,CAAC,uBAAA;QAClEC,OAAOuD,IAAAA,mBAAY,EAAC3D,sBAAsBI,KAAK,EAAEsD,WAAWtD,KAAK,CAAC,uBAAA;QAClEC,mBAAmBsD,IAAAA,mBAAY,EAAC3D,sBAAsBK,iBAAiB,EAAEqD,WAAWrD,iBAAiB,CAAC,mCAAA;QACtGC,SAASqD,IAAAA,mBAAY,EAAC3D,sBAAsBM,OAAO,EAAEoD,WAAWpD,OAAO,CAAC,yBAAA;QACxEC,cAAcoD,IAAAA,mBAAY,EAAC3D,sBAAsBO,YAAY,EAAEkD,MAAMG,YAAY,GAAGF,WAAWnD,YAAY,GAAG,GAAG,8BAAA;IACrH;AACJ"}
|
package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VerticalStackedBarChart.types.ts"],"sourcesContent":["import * as React from 'react';\n//import { ICalloutProps } from '@fluentui/react/lib/Callout';\nimport { RenderFunction } from '../../utilities/index';\nimport {\n CartesianChartProps,\n CartesianChartStyleProps,\n CartesianChartStyles,\n LineChartLineOptions,\n VerticalStackedChartProps,\n VSChartDataPoint,\n} from '../../index';\n\n/**\n * Vertical Stacked Bar Chart properties\n * {@docCategory VerticalStackedBarChart}\n */\nexport interface VerticalStackedBarChartProps extends CartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data: VerticalStackedChartProps[];\n\n /**\n * Width of each bar in the chart. When set to `undefined` or `'default'`, the bar width defaults to 16px,\n * which may decrease to prevent overlap. When set to `'auto'`, the bar width is calculated from padding values.\n */\n barWidth?: number | 'default' | 'auto';\n\n /**\n * Gap (max) between bars in a stack. When non-zero, the bars in a stack will\n * be separated by gaps. The actual size of each gap is calculated as 20% of\n * the height of that stack, with a minimum size of 1px and a maximum given by\n * this prop.\n * @default 0\n */\n barGapMax?: number;\n\n /**\n * Corner radius of the bars\n * @default 0\n */\n barCornerRadius?: number;\n\n /**\n * The minimum height of a bar; bars below this height will be displayed at\n * this height. Note that this setting will result in the height of these data\n * points not being to scale.\n * @default 0\n */\n barMinimumHeight?: number;\n\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * To display multi stack callout or single callout\n * @default flase\n */\n isCalloutForStack?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: VerticalStackedBarChartStyles;\n\n /**\n * Define a custom callout renderer for a stack; default is to render per data point\n */\n onRenderCalloutPerStack?: RenderFunction<VerticalStackedChartProps>;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: RenderFunction<VSChartDataPoint>;\n\n /**\n * yMinValue is
|
|
1
|
+
{"version":3,"sources":["VerticalStackedBarChart.types.ts"],"sourcesContent":["import * as React from 'react';\n//import { ICalloutProps } from '@fluentui/react/lib/Callout';\nimport { RenderFunction } from '../../utilities/index';\nimport {\n CartesianChartProps,\n CartesianChartStyleProps,\n CartesianChartStyles,\n LineChartLineOptions,\n VerticalStackedChartProps,\n VSChartDataPoint,\n} from '../../index';\n\n/**\n * Vertical Stacked Bar Chart properties\n * {@docCategory VerticalStackedBarChart}\n */\nexport interface VerticalStackedBarChartProps extends CartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data: VerticalStackedChartProps[];\n\n /**\n * Width of each bar in the chart. When set to `undefined` or `'default'`, the bar width defaults to 16px,\n * which may decrease to prevent overlap. When set to `'auto'`, the bar width is calculated from padding values.\n */\n barWidth?: number | 'default' | 'auto';\n\n /**\n * Gap (max) between bars in a stack. When non-zero, the bars in a stack will\n * be separated by gaps. The actual size of each gap is calculated as 20% of\n * the height of that stack, with a minimum size of 1px and a maximum given by\n * this prop.\n * @default 0\n */\n barGapMax?: number;\n\n /**\n * Corner radius of the bars\n * @default 0\n */\n barCornerRadius?: number;\n\n /**\n * The minimum height of a bar; bars below this height will be displayed at\n * this height. Note that this setting will result in the height of these data\n * points not being to scale.\n * @default 0\n */\n barMinimumHeight?: number;\n\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * To display multi stack callout or single callout\n * @default flase\n */\n isCalloutForStack?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: VerticalStackedBarChartStyles;\n\n /**\n * Define a custom callout renderer for a stack; default is to render per data point\n */\n onRenderCalloutPerStack?: RenderFunction<VerticalStackedChartProps>;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: RenderFunction<VSChartDataPoint>;\n\n /**\n * yMinValue is supported for bar charts that has only lines\n */\n yMinValue?: number | undefined;\n\n /**\n * Allow hover actions on the legend\n * @default true\n */\n allowHoverOnLegend?: boolean;\n\n /**\n * Click handler for bars; type of data is dependant on isCalloutForStack\n */\n onBarClick?: (event: React.MouseEvent<SVGElement>, data: VerticalStackedChartProps | VSChartDataPoint) => void;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * it's padding between bar's or lines in the graph\n */\n xAxisPadding?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * Prop to hide the bar labels\n * @default false\n */\n hideLabels?: boolean;\n\n /**\n * Maximum width of a bar, in pixels.\n * @default 24\n */\n maxBarWidth?: number;\n\n /**\n * Padding between bars as a fraction of the [step](https://d3js.org/d3-scale/band#band_step).\n * Takes a number in the range [0, 1]. Only applicable to string x-axis.\n * @default 2/3\n */\n xAxisInnerPadding?: number;\n\n /**\n * Padding before the first bar and after the last bar as a fraction of\n * the [step](https://d3js.org/d3-scale/band#band_step). Takes a number in the range [0, 1].\n * Only applicable to string x-axis.\n */\n xAxisOuterPadding?: number;\n\n /**\n * @default false\n * The prop used to enable gradient fill color for the chart.\n */\n enableGradient?: boolean;\n\n /**\n * @default false\n * The prop used to enable rounded corners for the chart.\n */\n roundCorners?: boolean;\n\n /**\n * Specifies the mode of the chart.\n * @default 'default'\n */\n mode?: 'default' | 'plotly';\n}\n\n/**\n * Vertical Stacked Bar Chart style properties\n * {@docCategory VerticalStackedBarChart}\n */\nexport interface VerticalStackedBarChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Vertical Stacked Bar Chart styles\n * {@docCategory VerticalStackedBarChart}\n */\nexport interface VerticalStackedBarChartStyles extends CartesianChartStyles {\n /**\n * Style to change the opacity of bars in dataviz when we hover on a single bar or legends\n */\n opacityChangeOnHover?: string;\n\n /**\n * Style for the bar labels\n */\n barLabel: string;\n}\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
|
@@ -28,7 +28,7 @@ const SVGTooltipText = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
28
28
|
const tooltipHostId = (0, _react.useRef)((0, _reactutilities.useId)('tooltip-host')).current;
|
|
29
29
|
const ignoreNextFocusEvent = (0, _react.useRef)(false);
|
|
30
30
|
const portalMountNode = (0, _reactsharedcontexts.usePortalMountNode)();
|
|
31
|
-
const PADDING =
|
|
31
|
+
const PADDING = 3;
|
|
32
32
|
const wrapContentCallback = (0, _react.useCallback)(()=>{
|
|
33
33
|
var _props_maxWidth;
|
|
34
34
|
if (props.content && props.wrapContent && props.wrapContent(props.content, tooltipHostId, (_props_maxWidth = props.maxWidth) !== null && _props_maxWidth !== void 0 ? _props_maxWidth : 100, props.maxHeight)) {
|
|
@@ -153,12 +153,12 @@ const SVGTooltipText = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
153
153
|
]);
|
|
154
154
|
const showTooltip = props.isTooltipVisibleProp && isOverflowing && !!props.content || isTooltipVisible && !!props.content;
|
|
155
155
|
const rectX = (typeof ((_props_textProps = props.textProps) === null || _props_textProps === void 0 ? void 0 : _props_textProps.x) === 'number' ? props.textProps.x : 0) - (textWidth !== null && textWidth !== void 0 ? textWidth : 0) / 2 - PADDING;
|
|
156
|
-
const rectY = (typeof ((_props_textProps1 = props.textProps) === null || _props_textProps1 === void 0 ? void 0 : _props_textProps1.y) === 'number' ? props.textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - PADDING;
|
|
156
|
+
const rectY = (typeof ((_props_textProps1 = props.textProps) === null || _props_textProps1 === void 0 ? void 0 : _props_textProps1.y) === 'number' ? props.textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - 2 * PADDING;
|
|
157
157
|
return /*#__PURE__*/ _react.createElement(_react.Fragment, null, props.showBackground && /*#__PURE__*/ _react.createElement("rect", {
|
|
158
158
|
x: rectX,
|
|
159
159
|
y: rectY,
|
|
160
160
|
width: (textWidth !== null && textWidth !== void 0 ? textWidth : 0) + 2 * PADDING,
|
|
161
|
-
height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) +
|
|
161
|
+
height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) + PADDING,
|
|
162
162
|
transform: (_props_textProps2 = props.textProps) === null || _props_textProps2 === void 0 ? void 0 : _props_textProps2.transform,
|
|
163
163
|
className: props.className
|
|
164
164
|
}), /*#__PURE__*/ _react.createElement(_reacttooltip.Tooltip, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n showBackground?: boolean;\n className?: string;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [textWidth, setTextWidth] = useState(0);\n const [textHeight, setTextHeight] = useState(0);\n\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n const PADDING = 4;\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight)\n // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n const measureText = useCallback((): void => {\n if (tooltipHostRef.current && typeof tooltipHostRef.current.getBBox === 'function') {\n const bbox = tooltipHostRef.current.getBBox();\n setTextWidth(bbox.width);\n setTextHeight(bbox.height);\n }\n }, []);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n useEffect(() => {\n if (isTooltipVisible) {\n measureText();\n }\n }, [isTooltipVisible, measureText]);\n\n useEffect(() => {\n // Recalculate text dimensions when content or dimensions change\n measureText();\n }, [props.content, props.textProps, props.maxWidth, props.maxHeight, measureText]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n const rectX = (typeof props.textProps?.x === 'number' ? props.textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof props.textProps?.y === 'number' ? props.textProps.y : 0) - (textHeight ?? 0) / 2 - PADDING;\n\n return (\n <>\n {props.showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + 2 * PADDING}\n transform={props.textProps?.transform}\n className={props.className}\n />\n )}\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n\nSVGTooltipText.defaultProps = {\n delay: 0,\n showBackground: false,\n};\n"],"names":["SVGTooltipText","React","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","useState","isOverflowing","setIsOverflowing","textWidth","setTextWidth","textHeight","setTextHeight","tooltipHostRef","useRef","async","Async","current","dismissTimerId","openTimerId","tooltipHostId","useId","ignoreNextFocusEvent","portalMountNode","usePortalMountNode","PADDING","wrapContentCallback","useCallback","content","wrapContent","maxWidth","maxHeight","measureText","getBBox","bbox","width","height","useEffect","dispose","textProps","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","KeyCodes","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","rectX","x","rectY","y","createElement","Fragment","showBackground","rect","transform","className","Tooltip","relationship","tooltipProps","withArrow","visible","text","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;qCAEY;8BACX;4BACF;0BACG;gCACH;AAiBf,MAAMA,iBAAAA,WAAAA,GAA+DC,OAAMC,UAAU,CAG1F,CAACC,OAAOC;QA0IcD,kBACAA,mBAUHA;IApJnB,MAAM,CAACE,kBAAkBC,oBAAoB,GAAGC,IAAAA,eAAAA,EAAS;IACzD,MAAM,CAACC,eAAeC,iBAAiB,GAAGF,IAAAA,eAAAA,EAAS;IACnD,MAAM,CAACG,WAAWC,aAAa,GAAGJ,IAAAA,eAAAA,EAAS;IAC3C,MAAM,CAACK,YAAYC,cAAc,GAAGN,IAAAA,eAAAA,EAAS;IAE7C,MAAMO,iBAAiBC,IAAAA,aAAAA,EAAuB;IAC9C,MAAMC,QAAQD,IAAAA,aAAAA,EAAO,IAAIE,iBAAAA,IAASC,OAAO;IACzC,MAAMC,iBAAiBJ,IAAAA,aAAAA;IACvB,MAAMK,cAAcL,IAAAA,aAAAA;IACpB,MAAMM,gBAAgBN,IAAAA,aAAAA,EAAOO,IAAAA,qBAAAA,EAAM,iBAAiBJ,OAAO;IAC3D,MAAMK,uBAAuBR,IAAAA,aAAAA,EAAO;IACpC,MAAMS,kBAAkBC,IAAAA,uCAAAA;IACxB,MAAMC,UAAU;IAEhB,MAAMC,sBAAsBC,IAAAA,kBAAAA,EAAY;YAIYzB;QAHlD,IACEA,MAAM0B,OAAO,IACb1B,MAAM2B,WAAW,IACjB3B,MAAM2B,W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AA,cAAAA,KAAAA,IAAAA,YAAa,CAAA,IAAK,IAAIgB;QAC9BW,QAAQ,AAACzB,CAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,aAAc,CAAA,IAAK,IAAIc;QAChC6C,WAAS,AAAEpE,CAAAA,oBAAAA,MAAMqC,SAAS,AAATA,MAAS,QAAfrC,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAiBoE,SAAS;QACrCC,WAAWrE,MAAMqE,SAAS;sBAG9BvE,OAAAkE,aAAA,CAACM,qBAAAA,EAAAA;QACCC,cAAa;QACZ,GAAGvE,MAAMwE,YAAY;QACtBC,WAAAA;QACA/C,SAAS1B,MAAM0B,OAAO;QACtB,yGAAyG;QACzGgD,SAAShB;qBAET5D,OAAAkE,aAAA,CAACW,QAAAA;QACE,GAAG3E,MAAMqC,SAAS;QACnBuC,IAAI1D;QACJ2D,KAAKlE;QACLmE,gBAAgB9B;QAChB+B,eAAe9B;QACf+B,cAAcxC;QACdyC,cAAcnC;QACdoC,WAAW9B;QACX+B,qBAAmBnF,MAAMoF,kBAAkB,IAAI/E;OAE9CL,MAAM0B,OAAO;AAKxB;AAEA7B,eAAewF,YAAY,GAAG;IAC5BzC,OAAO;IACPsB,gBAAgB;AAClB"}
|
|
1
|
+
{"version":3,"sources":["SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n showBackground?: boolean;\n className?: string;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [textWidth, setTextWidth] = useState(0);\n const [textHeight, setTextHeight] = useState(0);\n\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n const PADDING = 3;\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight)\n // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n const measureText = useCallback((): void => {\n if (tooltipHostRef.current && typeof tooltipHostRef.current.getBBox === 'function') {\n const bbox = tooltipHostRef.current.getBBox();\n setTextWidth(bbox.width);\n setTextHeight(bbox.height);\n }\n }, []);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n useEffect(() => {\n if (isTooltipVisible) {\n measureText();\n }\n }, [isTooltipVisible, measureText]);\n\n useEffect(() => {\n // Recalculate text dimensions when content or dimensions change\n measureText();\n }, [props.content, props.textProps, props.maxWidth, props.maxHeight, measureText]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n const rectX = (typeof props.textProps?.x === 'number' ? props.textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof props.textProps?.y === 'number' ? props.textProps.y : 0) - (textHeight ?? 0) / 2 - 2 * PADDING;\n\n return (\n <>\n {props.showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + PADDING}\n transform={props.textProps?.transform}\n className={props.className}\n />\n )}\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n\nSVGTooltipText.defaultProps = {\n delay: 0,\n showBackground: false,\n};\n"],"names":["SVGTooltipText","React","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","useState","isOverflowing","setIsOverflowing","textWidth","setTextWidth","textHeight","setTextHeight","tooltipHostRef","useRef","async","Async","current","dismissTimerId","openTimerId","tooltipHostId","useId","ignoreNextFocusEvent","portalMountNode","usePortalMountNode","PADDING","wrapContentCallback","useCallback","content","wrapContent","maxWidth","maxHeight","measureText","getBBox","bbox","width","height","useEffect","dispose","textProps","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","KeyCodes","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","rectX","x","rectY","y","createElement","Fragment","showBackground","rect","transform","className","Tooltip","relationship","tooltipProps","withArrow","visible","text","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QAC5B6C,WAAS,AAAEpE,CAAAA,oBAAAA,MAAMqC,SAAS,AAATA,MAAS,QAAfrC,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAiBoE,SAAS;QACrCC,WAAWrE,MAAMqE,SAAS;sBAG9BvE,OAAAkE,aAAA,CAACM,qBAAAA,EAAAA;QACCC,cAAa;QACZ,GAAGvE,MAAMwE,YAAY;QACtBC,WAAAA;QACA/C,SAAS1B,MAAM0B,OAAO;QACtB,yGAAyG;QACzGgD,SAAShB;qBAET5D,OAAAkE,aAAA,CAACW,QAAAA;QACE,GAAG3E,MAAMqC,SAAS;QACnBuC,IAAI1D;QACJ2D,KAAKlE;QACLmE,gBAAgB9B;QAChB+B,eAAe9B;QACf+B,cAAcxC;QACdyC,cAAcnC;QACdoC,WAAW9B;QACX+B,qBAAmBnF,MAAMoF,kBAAkB,IAAI/E;OAE9CL,MAAM0B,OAAO;AAKxB;AAEA7B,eAAewF,YAAY,GAAG;IAC5BzC,OAAO;IACPsB,gBAAgB;AAClB"}
|
|
@@ -261,7 +261,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
|
261
261
|
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
262
262
|
const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 20;
|
|
263
263
|
const [start, end] = xAxisScale.range();
|
|
264
|
-
tickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
|
|
264
|
+
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
265
265
|
}
|
|
266
266
|
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
267
267
|
if (chartType === 6) {
|
|
@@ -508,7 +508,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
508
508
|
};
|
|
509
509
|
const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
|
|
510
510
|
const [start, end] = xAxisScale.range();
|
|
511
|
-
const maxPossibleTickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
|
|
511
|
+
const maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
512
512
|
tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
|
|
513
513
|
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
514
514
|
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|