@fluentui/react-charting 5.24.4 → 5.24.6
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.json +55 -1
- package/CHANGELOG.md +24 -2
- package/config/tests.js +0 -12
- package/dist/react-charting.d.ts +4 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +1 -0
- package/lib/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +28 -21
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +35 -58
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +38 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +215 -139
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +1 -0
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.styles.js +2 -0
- package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +3 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.styles.js +3 -11
- package/lib/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.styles.js +2 -1
- package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.styles.js +3 -14
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +3 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +3 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib/utilities/Common.styles.d.ts +6 -0
- package/lib/utilities/Common.styles.js +51 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/SVGTooltipText.d.ts +1 -1
- package/lib/utilities/SVGTooltipText.js +3 -3
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.d.ts +1 -0
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib-amd/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +28 -21
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +33 -57
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +37 -15
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +216 -139
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +3 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -13
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.styles.js +3 -10
- package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js +2 -2
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +3 -13
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +3 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js +3 -13
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +3 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -13
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib-amd/utilities/Common.styles.d.ts +6 -0
- package/lib-amd/utilities/Common.styles.js +57 -0
- package/lib-amd/utilities/Common.styles.js.map +1 -0
- package/lib-amd/utilities/SVGTooltipText.d.ts +1 -1
- package/lib-amd/utilities/SVGTooltipText.js +3 -3
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/index.d.ts +1 -0
- package/lib-amd/utilities/index.js +2 -1
- package/lib-amd/utilities/index.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +28 -21
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +33 -56
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +37 -15
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +216 -139
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -0
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +3 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.styles.js +3 -11
- package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +2 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +3 -14
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +3 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.d.ts +6 -0
- package/lib-commonjs/utilities/Common.styles.js +58 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.d.ts +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.d.ts +1 -0
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DonutChart/DonutChart.types.ts +5 -0
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
define(["require", "exports", "
|
|
1
|
+
define(["require", "exports", "../../utilities/index"], function (require, exports, index_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getStyles = void 0;
|
|
5
5
|
var getStyles = function (props) {
|
|
6
|
-
var _a;
|
|
7
6
|
var shouldHighlight = props.shouldHighlight, href = props.href, theme = props.theme;
|
|
8
7
|
return {
|
|
9
8
|
opacityChangeOnHover: {
|
|
10
9
|
opacity: shouldHighlight ? '' : '0.1',
|
|
11
10
|
cursor: href ? 'pointer' : 'default',
|
|
12
11
|
},
|
|
13
|
-
tooltip:
|
|
14
|
-
barLabel:
|
|
15
|
-
fontSize: Styling_1.FontSizes.small,
|
|
16
|
-
fontWeight: Styling_1.FontWeights.semibold,
|
|
17
|
-
fill: theme.palette.neutralPrimary,
|
|
18
|
-
selectors: (_a = {},
|
|
19
|
-
_a[Styling_1.HighContrastSelector] = {
|
|
20
|
-
fill: 'CanvasText',
|
|
21
|
-
},
|
|
22
|
-
_a),
|
|
23
|
-
},
|
|
12
|
+
tooltip: (0, index_1.getTooltipStyle)(theme),
|
|
13
|
+
barLabel: (0, index_1.getBarLabelStyle)(theme),
|
|
24
14
|
};
|
|
25
15
|
};
|
|
26
16
|
exports.getStyles = getStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalStackedBarChart.styles.js","sourceRoot":"../src/","sources":["components/VerticalStackedBarChart/VerticalStackedBarChart.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAAyC
|
|
1
|
+
{"version":3,"file":"VerticalStackedBarChart.styles.js","sourceRoot":"../src/","sources":["components/VerticalStackedBarChart/VerticalStackedBarChart.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAAyC;QACzD,IAAA,eAAe,GAAkB,KAAK,gBAAvB,EAAE,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QAC/C,OAAO;YACL,oBAAoB,EAAE;gBACpB,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;gBACrC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;aACrC;YACD,OAAO,EAAE,IAAA,uBAAe,EAAC,KAAK,CAAC;YAC/B,QAAQ,EAAE,IAAA,wBAAgB,EAAC,KAAK,CAAC;SAClC,CAAC;IACJ,CAAC,CAAC;IAVW,QAAA,SAAS,aAUpB","sourcesContent":["import { IVerticalStackedBarChartStyleProps, IVerticalStackedBarChartStyles } from './VerticalStackedBarChart.types';\nimport { getBarLabelStyle, getTooltipStyle } from '../../utilities/index';\n\nexport const getStyles = (props: IVerticalStackedBarChartStyleProps): IVerticalStackedBarChartStyles => {\n const { shouldHighlight, href, theme } = props;\n return {\n opacityChangeOnHover: {\n opacity: shouldHighlight ? '' : '0.1',\n cursor: href ? 'pointer' : 'default',\n },\n tooltip: getTooltipStyle(theme),\n barLabel: getBarLabelStyle(theme),\n };\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IStyle, ITheme } from '@fluentui/react/lib/Styling';
|
|
2
|
+
import type { IRawStyle } from '@fluentui/merge-styles';
|
|
3
|
+
export declare const getTooltipStyle: (theme: ITheme) => IStyle;
|
|
4
|
+
export declare const getAxisTitleStyle: (theme: ITheme, font: IRawStyle) => IStyle;
|
|
5
|
+
export declare const getBarLabelStyle: (theme: ITheme) => IStyle;
|
|
6
|
+
export declare const getMarkerLabelStyle: (theme: ITheme) => IStyle;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react/lib/Styling", "@fluentui/react"], function (require, exports, tslib_1, Styling_1, react_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getMarkerLabelStyle = exports.getBarLabelStyle = exports.getAxisTitleStyle = exports.getTooltipStyle = void 0;
|
|
5
|
+
var getTooltipStyle = function (theme) {
|
|
6
|
+
return tslib_1.__assign(tslib_1.__assign({}, theme.fonts.medium), { display: 'flex', flexDirection: 'column', padding: '8px', position: 'absolute', textAlign: 'center', top: '0px', background: theme.semanticColors.bodyBackground, borderRadius: '2px', pointerEvents: 'none', color: theme.semanticColors.bodyText });
|
|
7
|
+
};
|
|
8
|
+
exports.getTooltipStyle = getTooltipStyle;
|
|
9
|
+
var getAxisTitleStyle = function (theme, font) {
|
|
10
|
+
var _a;
|
|
11
|
+
return [
|
|
12
|
+
font,
|
|
13
|
+
(_a = {
|
|
14
|
+
textAlign: 'center',
|
|
15
|
+
fontWeight: Styling_1.FontWeights.semibold,
|
|
16
|
+
fontStyle: 'normal',
|
|
17
|
+
lineHeight: Styling_1.FontSizes.medium,
|
|
18
|
+
color: react_1.NeutralColors.gray160,
|
|
19
|
+
fill: theme.semanticColors.bodyText
|
|
20
|
+
},
|
|
21
|
+
_a[Styling_1.HighContrastSelector] = {
|
|
22
|
+
fill: 'CanvasText',
|
|
23
|
+
},
|
|
24
|
+
_a),
|
|
25
|
+
];
|
|
26
|
+
};
|
|
27
|
+
exports.getAxisTitleStyle = getAxisTitleStyle;
|
|
28
|
+
var getBarLabelStyle = function (theme) {
|
|
29
|
+
var _a;
|
|
30
|
+
return {
|
|
31
|
+
fontSize: Styling_1.FontSizes.small,
|
|
32
|
+
fontWeight: Styling_1.FontWeights.semibold,
|
|
33
|
+
fill: theme.palette.neutralPrimary,
|
|
34
|
+
selectors: (_a = {},
|
|
35
|
+
_a[Styling_1.HighContrastSelector] = {
|
|
36
|
+
fill: 'CanvasText',
|
|
37
|
+
},
|
|
38
|
+
_a),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.getBarLabelStyle = getBarLabelStyle;
|
|
42
|
+
var getMarkerLabelStyle = function (theme) {
|
|
43
|
+
var _a;
|
|
44
|
+
return {
|
|
45
|
+
fontSize: Styling_1.FontSizes.medium,
|
|
46
|
+
fill: theme.semanticColors.bodyText,
|
|
47
|
+
textAnchor: 'middle',
|
|
48
|
+
selectors: (_a = {},
|
|
49
|
+
_a[Styling_1.HighContrastSelector] = {
|
|
50
|
+
fill: 'CanvasText',
|
|
51
|
+
},
|
|
52
|
+
_a),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.getMarkerLabelStyle = getMarkerLabelStyle;
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=Common.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Common.styles.js","sourceRoot":"../src/","sources":["utilities/Common.styles.ts"],"names":[],"mappings":";;;;IAKO,IAAM,eAAe,GAAG,UAAC,KAAa;QAC3C,6CACK,KAAK,CAAC,KAAK,CAAC,MAAM,KACrB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,QAAQ,EACnB,GAAG,EAAE,KAAK,EACV,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,EAC/C,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,IACpC;IACJ,CAAC,CAAC;IAdW,QAAA,eAAe,mBAc1B;IAEK,IAAM,iBAAiB,GAAG,UAAC,KAAa,EAAE,IAAe;;QAC9D,OAAO;YACL,IAAI;;oBAEF,SAAS,EAAE,QAAQ;oBACnB,UAAU,EAAE,qBAAW,CAAC,QAAQ;oBAChC,SAAS,EAAE,QAAQ;oBACnB,UAAU,EAAE,mBAAS,CAAC,MAAM;oBAC5B,KAAK,EAAE,qBAAa,CAAC,OAAO;oBAC5B,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ;;gBACnC,GAAC,8BAAoB,IAAG;oBACtB,IAAI,EAAE,YAAY;iBACnB;;SAEJ,CAAC;IACJ,CAAC,CAAC;IAfW,QAAA,iBAAiB,qBAe5B;IAEK,IAAM,gBAAgB,GAAG,UAAC,KAAa;;QAC5C,OAAO;YACL,QAAQ,EAAE,mBAAS,CAAC,KAAK;YACzB,UAAU,EAAE,qBAAW,CAAC,QAAQ;YAChC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAClC,SAAS;gBACP,GAAC,8BAAoB,IAAG;oBACtB,IAAI,EAAE,YAAY;iBACnB;mBACF;SACF,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,gBAAgB,oBAW3B;IAEK,IAAM,mBAAmB,GAAG,UAAC,KAAa;;QAC/C,OAAO;YACL,QAAQ,EAAE,mBAAS,CAAC,MAAM;YAC1B,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ;YACnC,UAAU,EAAE,QAAQ;YACpB,SAAS;gBACP,GAAC,8BAAoB,IAAG;oBACtB,IAAI,EAAE,YAAY;iBACnB;mBACF;SACF,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,mBAAmB,uBAW9B","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport type { IRawStyle } from '@fluentui/merge-styles';\nimport { FontSizes, FontWeights, HighContrastSelector } from '@fluentui/react/lib/Styling';\nimport { NeutralColors } from '@fluentui/react';\n\nexport const getTooltipStyle = (theme: ITheme): IStyle => {\n return {\n ...theme.fonts.medium,\n display: 'flex',\n flexDirection: 'column',\n padding: '8px',\n position: 'absolute',\n textAlign: 'center',\n top: '0px',\n background: theme.semanticColors.bodyBackground,\n borderRadius: '2px',\n pointerEvents: 'none',\n color: theme.semanticColors.bodyText,\n };\n};\n\nexport const getAxisTitleStyle = (theme: ITheme, font: IRawStyle): IStyle => {\n return [\n font,\n {\n textAlign: 'center',\n fontWeight: FontWeights.semibold,\n fontStyle: 'normal',\n lineHeight: FontSizes.medium,\n color: NeutralColors.gray160,\n fill: theme.semanticColors.bodyText,\n [HighContrastSelector]: {\n fill: 'CanvasText',\n },\n },\n ];\n};\n\nexport const getBarLabelStyle = (theme: ITheme): IStyle => {\n return {\n fontSize: FontSizes.small,\n fontWeight: FontWeights.semibold,\n fill: theme.palette.neutralPrimary,\n selectors: {\n [HighContrastSelector]: {\n fill: 'CanvasText',\n },\n },\n };\n};\n\nexport const getMarkerLabelStyle = (theme: ITheme): IStyle => {\n return {\n fontSize: FontSizes.medium,\n fill: theme.semanticColors.bodyText,\n textAnchor: 'middle',\n selectors: {\n [HighContrastSelector]: {\n fill: 'CanvasText',\n },\n },\n };\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ITooltipHost, ITooltipProps, TooltipDelay } from '@fluentui/react/lib/Tooltip';
|
|
3
3
|
import { ITheme } from '@fluentui/react';
|
|
4
|
-
interface ISVGTooltipTextProps {
|
|
4
|
+
export interface ISVGTooltipTextProps {
|
|
5
5
|
/**
|
|
6
6
|
* Number of milliseconds to delay closing the tooltip, so that the user has time to hover over
|
|
7
7
|
* the tooltip and interact with it. Hovering over the tooltip will count as hovering over the
|
|
@@ -2,7 +2,7 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Tooltip", "
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SVGTooltipText = void 0;
|
|
5
|
-
var PADDING =
|
|
5
|
+
var PADDING = 3;
|
|
6
6
|
/**
|
|
7
7
|
* Component to render an SVG text element with an optional tooltip.
|
|
8
8
|
* The tooltip appears on hovering and focusing the element when its content overflows.
|
|
@@ -159,9 +159,9 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Tooltip", "
|
|
|
159
159
|
}, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, tooltipProps);
|
|
160
160
|
var showTooltip = (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);
|
|
161
161
|
var rectX = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.x) === 'number' ? textProps.x : 0) - (textWidth !== null && textWidth !== void 0 ? textWidth : 0) / 2 - PADDING;
|
|
162
|
-
var rectY = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.y) === 'number' ? textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - PADDING;
|
|
162
|
+
var rectY = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.y) === 'number' ? textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - 2 * PADDING;
|
|
163
163
|
return (React.createElement(React.Fragment, null,
|
|
164
|
-
showBackground && (React.createElement("rect", { x: rectX, y: rectY, width: (textWidth !== null && textWidth !== void 0 ? textWidth : 0) + 2 * PADDING, height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) +
|
|
164
|
+
showBackground && (React.createElement("rect", { x: rectX, y: rectY, width: (textWidth !== null && textWidth !== void 0 ? textWidth : 0) + 2 * PADDING, height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) + PADDING, transform: textProps === null || textProps === void 0 ? void 0 : textProps.transform, className: this.props.className })),
|
|
165
165
|
React.createElement("text", tslib_1.__assign({}, textProps, { id: this._tooltipHostId, ref: this._tooltipHost, onFocusCapture: this._onTooltipFocus, onBlurCapture: this._onTooltipBlur, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave, onKeyDown: this._onTooltipKeyDown, "data-is-focusable": shouldReceiveFocus && this.state.isOverflowing }), content),
|
|
166
166
|
showTooltip && React.createElement(Tooltip_1.Tooltip, tslib_1.__assign({}, tooltipRenderProps))));
|
|
167
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;IA4FA,IAAM,OAAO,GAAG,CAAC,CAAC;IAElB;;;OAGG;IACH;QACU,0CAA2D;QAkBnE,wBAAY,KAA2B;YACrC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAVf,6CAA6C;YACrC,kB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AAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAE,CAAC;gBAC/F,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAEM,6CAAoB,GAA3B;YACE,IAAI,cAAc,CAAC,sBAAsB,IAAI,cAAc,CAAC,sBAAsB,KAAK,IAAI,EAAE,CAAC;gBAC5F,cAAc,CAAC,sBAAsB,GAAG,SAAS,CAAC;YACpD,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QA9Fa,2BAAY,GAAG;YAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;SAC3B,AAFyB,CAExB;QAwPJ,qBAAC;KAAA,AA9PD,CACU,KAAK,CAAC,SAAS,GA6PxB;IA9PY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\nimport { ITheme } from '@fluentui/react';\n\ninterface ISVGTooltipTextProps {\n /**\n * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over\n * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the\n * host, so that the tooltip will stay open if the user is actively interacting with it.\n */\n closeDelay?: number;\n\n /**\n * Content to display in the Tooltip.\n */\n content?: string;\n\n /**\n * Length of delay before showing the tooltip on hover.\n * @defaultvalue TooltipDelay.medium\n */\n delay?: TooltipDelay;\n\n /**\n * Additional properties to pass through for Tooltip.\n */\n tooltipProps?: ITooltipProps;\n\n /**\n * Additional properties to pass through for SVG <text>.\n */\n textProps?: React.SVGAttributes<SVGTextElement>;\n\n /**\n * Max width of text\n */\n maxWidth?: number;\n\n /**\n * Max height of text\n */\n maxHeight?: number;\n\n /**\n * Pass false to make prevent the tooptip from receiving focus through keyboard\n * Eg: In Pie Chart, the focus should only land on the arcs and not on the text to\n * avoid repitition of the same datapoint\n * @defaultvalue true\n */\n shouldReceiveFocus?: boolean;\n\n /**\n * Pass true to show tooltip directly\n * Eg: In Pie Chart, the tooltip is shown when the arc is focussed, so the prop is set to true,\n * to directly show the tooltip from this component\n * @defaultvalue false\n */\n isTooltipVisibleProp?: boolean;\n\n /**\n * Function to wrap text within specified width and height\n * and return a boolean value indicating whether the text overflowed\n */\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n\n /**\n * Theme provided by High Order Component\n */\n theme?: ITheme;\n\n /**\n * @default false\n * Prop to selectively display the tooltip background\n */\n showBackground?: boolean;\n\n /**\n * Prop to set classname\n */\n className?: string;\n}\n\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n textX?: number;\n textY?: number;\n textWidth?: number;\n textHeight?: number;\n}\n\nconst PADDING = 4;\n\n/**\n * Component to render an SVG text element with an optional tooltip.\n * The tooltip appears on hovering and focusing the element when its content overflows.\n */\nexport class SVGTooltipText\n extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState>\n implements ITooltipHost\n{\n public static defaultProps = {\n delay: TooltipDelay.medium,\n };\n\n private static _currentVisibleTooltip: ITooltipHost | undefined;\n\n /** The element that gets the hover events */\n private _tooltipHost = React.createRef<SVGTextElement>();\n\n private _async: Async;\n private _dismissTimerId: number;\n private _openTimerId: number;\n private _tooltipHostId = getId('tooltip-host');\n private _ignoreNextFocusEvent: boolean;\n\n constructor(props: ISVGTooltipTextProps) {\n super(props);\n\n this.state = {\n isTooltipVisible: false,\n isOverflowing: false,\n };\n\n this._async = new Async(this);\n }\n\n public render(): React.ReactNode {\n const { content, tooltipProps, textProps, shouldReceiveFocus = true, showBackground = false } = this.props;\n const { isTooltipVisible, textWidth, textHeight } = this.state;\n const tooltipRenderProps: ITooltipProps = {\n content,\n targetElement: this._getTargetElement(),\n calloutProps: {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n },\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n ...tooltipProps,\n };\n\n const showTooltip =\n (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);\n const rectX = (typeof textProps?.x === 'number' ? textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof textProps?.y === 'number' ? textProps.y : 0) - (textHeight ?? 0) / 2 - PADDING;\n return (\n <>\n {showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + 2 * PADDING}\n transform={textProps?.transform}\n className={this.props.className}\n />\n )}\n <text\n {...textProps}\n id={this._tooltipHostId}\n ref={this._tooltipHost}\n onFocusCapture={this._onTooltipFocus}\n onBlurCapture={this._onTooltipBlur}\n onMouseEnter={this._onTooltipMouseEnter}\n onMouseLeave={this._onTooltipMouseLeave}\n onKeyDown={this._onTooltipKeyDown}\n data-is-focusable={shouldReceiveFocus && this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\n this._measureText();\n }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\n this._measureText();\n }\n }\n\n public componentWillUnmount(): void {\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n }\n\n public show = (): void => {\n this._toggleTooltip(true);\n };\n\n public dismiss = (): void => {\n this._hideTooltip();\n };\n\n private _measureText = (): void => {\n if (this._tooltipHost.current && typeof this._tooltipHost.current.getBBox === 'function') {\n const bbox = this._tooltipHost.current.getBBox();\n this.setState({\n textX: bbox.x,\n textY: bbox.y,\n textWidth: bbox.width,\n textHeight: bbox.height,\n });\n }\n };\n\n private _getTargetElement = (): HTMLElement | undefined => {\n if (!this._tooltipHost.current) {\n return undefined;\n }\n\n return this._tooltipHost.current as unknown as HTMLElement;\n };\n\n private _onTooltipFocus = (ev: React.FocusEvent<SVGElement>) => {\n if (this._ignoreNextFocusEvent) {\n this._ignoreNextFocusEvent = false;\n return;\n }\n\n this._onTooltipMouseEnter(ev);\n };\n\n private _onTooltipBlur = (ev: React.FocusEvent<SVGElement>) => {\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement,\n // and ignoring when it next gets focus back.\n // See https://github.com/microsoft/fluentui/issues/13541\n this._ignoreNextFocusEvent = document?.activeElement === ev.target;\n\n this._dismissTimerId = this._async.setTimeout(() => {\n this._hideTooltip();\n }, 0);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseEnter = (ev: any): void => {\n const { delay } = this.props;\n\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== this) {\n SVGTooltipText._currentVisibleTooltip.dismiss();\n }\n SVGTooltipText._currentVisibleTooltip = this;\n\n if (!this.state.isOverflowing) {\n return;\n }\n\n if (ev.target && portalContainsElement(ev.target as HTMLElement, this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n const delayTime = this._getDelayTime(delay!); // non-null assertion because we set it in `defaultProps`\n\n this._openTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(true);\n }, delayTime);\n } else {\n this._toggleTooltip(true);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseLeave = (ev: any): void => {\n const { closeDelay } = this.props;\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (closeDelay) {\n this._dismissTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(false);\n }, closeDelay);\n } else {\n this._toggleTooltip(false);\n }\n\n if (SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n };\n\n private _onTooltipKeyDown = (ev: React.KeyboardEvent<SVGElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && this.state.isTooltipVisible) {\n this._hideTooltip();\n ev.stopPropagation();\n }\n };\n\n private _clearDismissTimer = (): void => {\n this._async.clearTimeout(this._dismissTimerId);\n };\n\n private _clearOpenTimer = (): void => {\n this._async.clearTimeout(this._openTimerId);\n };\n\n private _hideTooltip = (): void => {\n this._clearOpenTimer();\n this._clearDismissTimer();\n this._toggleTooltip(false);\n };\n\n private _toggleTooltip = (isTooltipVisible: boolean): void => {\n if (this.state.isTooltipVisible !== isTooltipVisible) {\n this.setState({ isTooltipVisible });\n }\n };\n\n private _getDelayTime = (delay: TooltipDelay): number => {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n case TooltipDelay.long:\n return 500;\n default:\n return 0;\n }\n };\n\n private _wrapContent = () => {\n const { content, wrapContent, maxWidth = Number.POSITIVE_INFINITY, maxHeight } = this.props;\n\n let isOverflowing = false;\n if (content && wrapContent && wrapContent(content, this._tooltipHostId, maxWidth, maxHeight)) {\n isOverflowing = true;\n }\n\n if (this.state.isOverflowing !== isOverflowing) {\n this.setState({ isOverflowing });\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;IA4FA,IAAM,OAAO,GAAG,CAAC,CAAC;IAElB;;;OAGG;IACH;QACU,0CAA2D;QAkBnE,wBAAY,KAA2B;YACrC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAVf,6CA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CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAE,CAAC;gBAC/F,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAEM,6CAAoB,GAA3B;YACE,IAAI,cAAc,CAAC,sBAAsB,IAAI,cAAc,CAAC,sBAAsB,KAAK,IAAI,EAAE,CAAC;gBAC5F,cAAc,CAAC,sBAAsB,GAAG,SAAS,CAAC;YACpD,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QA9Fa,2BAAY,GAAG;YAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;SAC3B,AAFyB,CAExB;QAwPJ,qBAAC;KAAA,AA9PD,CACU,KAAK,CAAC,SAAS,GA6PxB;IA9PY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\nimport { ITheme } from '@fluentui/react';\n\nexport interface ISVGTooltipTextProps {\n /**\n * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over\n * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the\n * host, so that the tooltip will stay open if the user is actively interacting with it.\n */\n closeDelay?: number;\n\n /**\n * Content to display in the Tooltip.\n */\n content?: string;\n\n /**\n * Length of delay before showing the tooltip on hover.\n * @defaultvalue TooltipDelay.medium\n */\n delay?: TooltipDelay;\n\n /**\n * Additional properties to pass through for Tooltip.\n */\n tooltipProps?: ITooltipProps;\n\n /**\n * Additional properties to pass through for SVG <text>.\n */\n textProps?: React.SVGAttributes<SVGTextElement>;\n\n /**\n * Max width of text\n */\n maxWidth?: number;\n\n /**\n * Max height of text\n */\n maxHeight?: number;\n\n /**\n * Pass false to make prevent the tooptip from receiving focus through keyboard\n * Eg: In Pie Chart, the focus should only land on the arcs and not on the text to\n * avoid repitition of the same datapoint\n * @defaultvalue true\n */\n shouldReceiveFocus?: boolean;\n\n /**\n * Pass true to show tooltip directly\n * Eg: In Pie Chart, the tooltip is shown when the arc is focussed, so the prop is set to true,\n * to directly show the tooltip from this component\n * @defaultvalue false\n */\n isTooltipVisibleProp?: boolean;\n\n /**\n * Function to wrap text within specified width and height\n * and return a boolean value indicating whether the text overflowed\n */\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n\n /**\n * Theme provided by High Order Component\n */\n theme?: ITheme;\n\n /**\n * @default false\n * Prop to selectively display the tooltip background\n */\n showBackground?: boolean;\n\n /**\n * Prop to set classname\n */\n className?: string;\n}\n\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n textX?: number;\n textY?: number;\n textWidth?: number;\n textHeight?: number;\n}\n\nconst PADDING = 3;\n\n/**\n * Component to render an SVG text element with an optional tooltip.\n * The tooltip appears on hovering and focusing the element when its content overflows.\n */\nexport class SVGTooltipText\n extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState>\n implements ITooltipHost\n{\n public static defaultProps = {\n delay: TooltipDelay.medium,\n };\n\n private static _currentVisibleTooltip: ITooltipHost | undefined;\n\n /** The element that gets the hover events */\n private _tooltipHost = React.createRef<SVGTextElement>();\n\n private _async: Async;\n private _dismissTimerId: number;\n private _openTimerId: number;\n private _tooltipHostId = getId('tooltip-host');\n private _ignoreNextFocusEvent: boolean;\n\n constructor(props: ISVGTooltipTextProps) {\n super(props);\n\n this.state = {\n isTooltipVisible: false,\n isOverflowing: false,\n };\n\n this._async = new Async(this);\n }\n\n public render(): React.ReactNode {\n const { content, tooltipProps, textProps, shouldReceiveFocus = true, showBackground = false } = this.props;\n const { isTooltipVisible, textWidth, textHeight } = this.state;\n const tooltipRenderProps: ITooltipProps = {\n content,\n targetElement: this._getTargetElement(),\n calloutProps: {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n },\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n ...tooltipProps,\n };\n\n const showTooltip =\n (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);\n const rectX = (typeof textProps?.x === 'number' ? textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof textProps?.y === 'number' ? textProps.y : 0) - (textHeight ?? 0) / 2 - 2 * PADDING;\n return (\n <>\n {showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + PADDING}\n transform={textProps?.transform}\n className={this.props.className}\n />\n )}\n <text\n {...textProps}\n id={this._tooltipHostId}\n ref={this._tooltipHost}\n onFocusCapture={this._onTooltipFocus}\n onBlurCapture={this._onTooltipBlur}\n onMouseEnter={this._onTooltipMouseEnter}\n onMouseLeave={this._onTooltipMouseLeave}\n onKeyDown={this._onTooltipKeyDown}\n data-is-focusable={shouldReceiveFocus && this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\n this._measureText();\n }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\n this._measureText();\n }\n }\n\n public componentWillUnmount(): void {\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n }\n\n public show = (): void => {\n this._toggleTooltip(true);\n };\n\n public dismiss = (): void => {\n this._hideTooltip();\n };\n\n private _measureText = (): void => {\n if (this._tooltipHost.current && typeof this._tooltipHost.current.getBBox === 'function') {\n const bbox = this._tooltipHost.current.getBBox();\n this.setState({\n textX: bbox.x,\n textY: bbox.y,\n textWidth: bbox.width,\n textHeight: bbox.height,\n });\n }\n };\n\n private _getTargetElement = (): HTMLElement | undefined => {\n if (!this._tooltipHost.current) {\n return undefined;\n }\n\n return this._tooltipHost.current as unknown as HTMLElement;\n };\n\n private _onTooltipFocus = (ev: React.FocusEvent<SVGElement>) => {\n if (this._ignoreNextFocusEvent) {\n this._ignoreNextFocusEvent = false;\n return;\n }\n\n this._onTooltipMouseEnter(ev);\n };\n\n private _onTooltipBlur = (ev: React.FocusEvent<SVGElement>) => {\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement,\n // and ignoring when it next gets focus back.\n // See https://github.com/microsoft/fluentui/issues/13541\n this._ignoreNextFocusEvent = document?.activeElement === ev.target;\n\n this._dismissTimerId = this._async.setTimeout(() => {\n this._hideTooltip();\n }, 0);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseEnter = (ev: any): void => {\n const { delay } = this.props;\n\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== this) {\n SVGTooltipText._currentVisibleTooltip.dismiss();\n }\n SVGTooltipText._currentVisibleTooltip = this;\n\n if (!this.state.isOverflowing) {\n return;\n }\n\n if (ev.target && portalContainsElement(ev.target as HTMLElement, this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n const delayTime = this._getDelayTime(delay!); // non-null assertion because we set it in `defaultProps`\n\n this._openTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(true);\n }, delayTime);\n } else {\n this._toggleTooltip(true);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseLeave = (ev: any): void => {\n const { closeDelay } = this.props;\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (closeDelay) {\n this._dismissTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(false);\n }, closeDelay);\n } else {\n this._toggleTooltip(false);\n }\n\n if (SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n };\n\n private _onTooltipKeyDown = (ev: React.KeyboardEvent<SVGElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && this.state.isTooltipVisible) {\n this._hideTooltip();\n ev.stopPropagation();\n }\n };\n\n private _clearDismissTimer = (): void => {\n this._async.clearTimeout(this._dismissTimerId);\n };\n\n private _clearOpenTimer = (): void => {\n this._async.clearTimeout(this._openTimerId);\n };\n\n private _hideTooltip = (): void => {\n this._clearOpenTimer();\n this._clearDismissTimer();\n this._toggleTooltip(false);\n };\n\n private _toggleTooltip = (isTooltipVisible: boolean): void => {\n if (this.state.isTooltipVisible !== isTooltipVisible) {\n this.setState({ isTooltipVisible });\n }\n };\n\n private _getDelayTime = (delay: TooltipDelay): number => {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n case TooltipDelay.long:\n return 500;\n default:\n return 0;\n }\n };\n\n private _wrapContent = () => {\n const { content, wrapContent, maxWidth = Number.POSITIVE_INFINITY, maxHeight } = this.props;\n\n let isOverflowing = false;\n if (content && wrapContent && wrapContent(content, this._tooltipHostId, maxWidth, maxHeight)) {\n isOverflowing = true;\n }\n\n if (this.state.isOverflowing !== isOverflowing) {\n this.setState({ isOverflowing });\n }\n };\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./ChartHoverCard/index", "./utilities", "./colors", "./gradients", "./vbc-utils"], function (require, exports, tslib_1, index_1, utilities_1, colors_1, gradients_1, vbc_utils_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "./ChartHoverCard/index", "./Common.styles", "./utilities", "./colors", "./gradients", "./vbc-utils"], function (require, exports, tslib_1, index_1, Common_styles_1, utilities_1, colors_1, gradients_1, vbc_utils_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
tslib_1.__exportStar(index_1, exports);
|
|
5
|
+
tslib_1.__exportStar(Common_styles_1, exports);
|
|
5
6
|
tslib_1.__exportStar(utilities_1, exports);
|
|
6
7
|
tslib_1.__exportStar(colors_1, exports);
|
|
7
8
|
tslib_1.__exportStar(gradients_1, exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":";;;IAAA,uCAAuC;IACvC,2CAA4B;IAC5B,wCAAyB;IACzB,2CAA4B;IAC5B,2CAA4B","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './utilities';\nexport * from './colors';\nexport * from './gradients';\nexport * from './vbc-utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":";;;IAAA,uCAAuC;IACvC,+CAAgC;IAChC,2CAA4B;IAC5B,wCAAyB;IACzB,2CAA4B;IAC5B,2CAA4B","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './Common.styles';\nexport * from './utilities';\nexport * from './colors';\nexport * from './gradients';\nexport * from './vbc-utils';\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getStyles = void 0;
|
|
4
|
-
var
|
|
4
|
+
var index_1 = require("../../utilities/index");
|
|
5
5
|
var getStyles = function (props) {
|
|
6
6
|
return {
|
|
7
|
-
tooltip:
|
|
7
|
+
tooltip: (0, index_1.getTooltipStyle)(props.theme),
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
exports.getStyles = getStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaChart.styles.js","sourceRoot":"../src/","sources":["components/AreaChart/AreaChart.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AreaChart.styles.js","sourceRoot":"../src/","sources":["components/AreaChart/AreaChart.styles.ts"],"names":[],"mappings":";;;AACA,+CAAwD;AAEjD,IAAM,SAAS,GAAG,UAAC,KAA2B;IACnD,OAAO;QACL,OAAO,EAAE,IAAA,uBAAe,EAAC,KAAK,CAAC,KAAM,CAAC;KACvC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB","sourcesContent":["import { IAreaChartStyleProps, IAreaChartStyles } from './AreaChart.types';\nimport { getTooltipStyle } from '../../utilities/index';\n\nexport const getStyles = (props: IAreaChartStyleProps): IAreaChartStyles => {\n return {\n tooltip: getTooltipStyle(props.theme!),\n };\n};\n"]}
|
|
@@ -166,33 +166,34 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
166
166
|
: 20
|
|
167
167
|
: (_p = (_o = _this.props.margins) === null || _o === void 0 ? void 0 : _o.left) !== null && _p !== void 0 ? _p : 40,
|
|
168
168
|
};
|
|
169
|
-
var
|
|
169
|
+
var TITLE_MARGIN_HORIZONTAL = 24;
|
|
170
|
+
var TITLE_MARGIN_VERTICAL = 20;
|
|
170
171
|
if (_this.props.xAxisTitle !== undefined && _this.props.xAxisTitle !== '') {
|
|
171
|
-
_this.margins.bottom = (_r = (_q = _this.props.margins) === null || _q === void 0 ? void 0 : _q.bottom) !== null && _r !== void 0 ? _r : _this.margins.bottom +
|
|
172
|
+
_this.margins.bottom = (_r = (_q = _this.props.margins) === null || _q === void 0 ? void 0 : _q.bottom) !== null && _r !== void 0 ? _r : _this.margins.bottom + TITLE_MARGIN_VERTICAL;
|
|
172
173
|
}
|
|
173
174
|
if (_this.props.yAxisTitle !== undefined && _this.props.yAxisTitle !== '') {
|
|
174
175
|
_this.margins.left = _this._isRtl
|
|
175
176
|
? ((_t = (_s = _this.props.margins) === null || _s === void 0 ? void 0 : _s.right) !== null && _t !== void 0 ? _t : (_u = _this.props) === null || _u === void 0 ? void 0 : _u.secondaryYAxistitle)
|
|
176
|
-
? _this.margins.right + 2 *
|
|
177
|
-
: _this.margins.right +
|
|
178
|
-
: (_w = (_v = _this.props.margins) === null || _v === void 0 ? void 0 : _v.left) !== null && _w !== void 0 ? _w : _this.margins.left +
|
|
177
|
+
? _this.margins.right + 2 * TITLE_MARGIN_HORIZONTAL
|
|
178
|
+
: _this.margins.right + TITLE_MARGIN_HORIZONTAL
|
|
179
|
+
: (_w = (_v = _this.props.margins) === null || _v === void 0 ? void 0 : _v.left) !== null && _w !== void 0 ? _w : _this.margins.left + TITLE_MARGIN_HORIZONTAL;
|
|
179
180
|
_this.margins.right = _this._isRtl
|
|
180
|
-
? (_y = (_x = _this.props.margins) === null || _x === void 0 ? void 0 : _x.left) !== null && _y !== void 0 ? _y : _this.margins.left +
|
|
181
|
+
? (_y = (_x = _this.props.margins) === null || _x === void 0 ? void 0 : _x.left) !== null && _y !== void 0 ? _y : _this.margins.left + TITLE_MARGIN_HORIZONTAL
|
|
181
182
|
: ((_0 = (_z = _this.props.margins) === null || _z === void 0 ? void 0 : _z.right) !== null && _0 !== void 0 ? _0 : (_1 = _this.props) === null || _1 === void 0 ? void 0 : _1.secondaryYAxistitle)
|
|
182
|
-
? _this.margins.right + 2 *
|
|
183
|
-
: _this.margins.right +
|
|
183
|
+
? _this.margins.right + 2 * TITLE_MARGIN_HORIZONTAL
|
|
184
|
+
: _this.margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
184
185
|
}
|
|
185
186
|
if (_this.props.xAxisAnnotation !== undefined && _this.props.xAxisAnnotation !== '') {
|
|
186
|
-
_this.margins.top = (_3 = (_2 = _this.props.margins) === null || _2 === void 0 ? void 0 : _2.top) !== null && _3 !== void 0 ? _3 : _this.margins.top +
|
|
187
|
+
_this.margins.top = (_3 = (_2 = _this.props.margins) === null || _2 === void 0 ? void 0 : _2.top) !== null && _3 !== void 0 ? _3 : _this.margins.top + TITLE_MARGIN_VERTICAL;
|
|
187
188
|
}
|
|
188
189
|
if (_this.props.yAxisAnnotation !== undefined &&
|
|
189
190
|
_this.props.yAxisAnnotation !== '' &&
|
|
190
191
|
(_this.props.secondaryYAxistitle === undefined || _this.props.secondaryYAxistitle === '')) {
|
|
191
192
|
if (_this._isRtl) {
|
|
192
|
-
_this.margins.left = (_5 = (_4 = _this.props.margins) === null || _4 === void 0 ? void 0 : _4.right) !== null && _5 !== void 0 ? _5 : _this.margins.right +
|
|
193
|
+
_this.margins.left = (_5 = (_4 = _this.props.margins) === null || _4 === void 0 ? void 0 : _4.right) !== null && _5 !== void 0 ? _5 : _this.margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
193
194
|
}
|
|
194
195
|
else {
|
|
195
|
-
_this.margins.right = (_7 = (_6 = _this.props.margins) === null || _6 === void 0 ? void 0 : _6.right) !== null && _7 !== void 0 ? _7 : _this.margins.right +
|
|
196
|
+
_this.margins.right = (_7 = (_6 = _this.props.margins) === null || _6 === void 0 ? void 0 : _6.right) !== null && _7 !== void 0 ? _7 : _this.margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
return _this;
|
|
@@ -477,6 +478,12 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
477
478
|
this.margins.top -
|
|
478
479
|
this.state._removalValueForTextTuncate -
|
|
479
480
|
this.titleMargin;
|
|
481
|
+
var commonSvgToolTipProps = {
|
|
482
|
+
wrapContent: index_1.wrapContent,
|
|
483
|
+
theme: this.props.theme,
|
|
484
|
+
showBackground: true,
|
|
485
|
+
className: this._classNames.svgTooltip,
|
|
486
|
+
};
|
|
480
487
|
/**
|
|
481
488
|
* We have use the {@link defaultTabbableElement } to fix
|
|
482
489
|
* the Focus not landing on chart while tabbing, instead goes to legend.
|
|
@@ -506,20 +513,20 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
506
513
|
}, id: "xAxisGElement".concat(this.idForGraph),
|
|
507
514
|
// To add wrap of x axis lables feature, need to remove word height from svg height.
|
|
508
515
|
transform: "translate(0, ".concat(svgDimensions.height - this.margins.bottom - this.state._removalValueForTextTuncate, ")"), className: this._classNames.xAxis }),
|
|
509
|
-
this.props.xAxisTitle !== undefined && this.props.xAxisTitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.xAxisTitle, textProps: {
|
|
516
|
+
this.props.xAxisTitle !== undefined && this.props.xAxisTitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, tslib_1.__assign({ content: this.props.xAxisTitle, textProps: {
|
|
510
517
|
x: this.margins.left + this.state.startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
511
518
|
y: svgDimensions.height - this.titleMargin,
|
|
512
519
|
className: this._classNames.axisTitle,
|
|
513
520
|
textAnchor: 'middle',
|
|
514
521
|
'aria-hidden': true,
|
|
515
|
-
}, maxWidth: xAxisTitleMaximumAllowedWidth
|
|
516
|
-
this.props.xAxisAnnotation !== undefined && this.props.xAxisAnnotation !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.xAxisAnnotation, textProps: {
|
|
522
|
+
}, maxWidth: xAxisTitleMaximumAllowedWidth }, commonSvgToolTipProps))),
|
|
523
|
+
this.props.xAxisAnnotation !== undefined && this.props.xAxisAnnotation !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, tslib_1.__assign({ content: this.props.xAxisAnnotation, textProps: {
|
|
517
524
|
x: this.margins.left + this.state.startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
518
525
|
y: this.titleMargin + 3,
|
|
519
526
|
className: this._classNames.axisAnnotation,
|
|
520
527
|
textAnchor: 'middle',
|
|
521
528
|
'aria-hidden': true,
|
|
522
|
-
}, maxWidth: xAxisTitleMaximumAllowedWidth
|
|
529
|
+
}, maxWidth: xAxisTitleMaximumAllowedWidth }, commonSvgToolTipProps))),
|
|
523
530
|
React.createElement("g", { ref: function (e) {
|
|
524
531
|
_this.yAxisElement = e;
|
|
525
532
|
}, id: "yAxisGElement".concat(this.idForGraph), transform: "translate(".concat(this._isRtl
|
|
@@ -531,7 +538,7 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
531
538
|
}, id: "yAxisGElementSecondary".concat(this.idForGraph), transform: "translate(".concat(this._isRtl
|
|
532
539
|
? this.margins.left + this.state.startFromX
|
|
533
540
|
: svgDimensions.width - this.margins.right - this.state.startFromX, ", 0)"), className: this._classNames.yAxis }),
|
|
534
|
-
this.props.secondaryYAxistitle !== undefined && this.props.secondaryYAxistitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.secondaryYAxistitle, textProps: {
|
|
541
|
+
this.props.secondaryYAxistitle !== undefined && this.props.secondaryYAxistitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, tslib_1.__assign({ content: this.props.secondaryYAxistitle, textProps: {
|
|
535
542
|
x: (yAxisTitleMaximumAllowedHeight - this.margins.bottom) / 2 +
|
|
536
543
|
this.state._removalValueForTextTuncate,
|
|
537
544
|
y: this._isRtl
|
|
@@ -543,9 +550,9 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
543
550
|
: this.margins.right / 2 + this.titleMargin, ",\n ").concat(svgDimensions.height - this.margins.bottom - this.margins.top - this.titleMargin, ")rotate(-90)"),
|
|
544
551
|
className: this._classNames.axisTitle,
|
|
545
552
|
'aria-hidden': true,
|
|
546
|
-
}, maxWidth: yAxisTitleMaximumAllowedHeight
|
|
553
|
+
}, maxWidth: yAxisTitleMaximumAllowedHeight }, commonSvgToolTipProps))))),
|
|
547
554
|
children,
|
|
548
|
-
this.props.yAxisTitle !== undefined && this.props.yAxisTitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.yAxisTitle, textProps: {
|
|
555
|
+
this.props.yAxisTitle !== undefined && this.props.yAxisTitle !== '' && (React.createElement(SVGTooltipText_1.SVGTooltipText, tslib_1.__assign({ content: this.props.yAxisTitle, textProps: {
|
|
549
556
|
x: (yAxisTitleMaximumAllowedHeight - this.margins.bottom) / 2 +
|
|
550
557
|
this.state._removalValueForTextTuncate,
|
|
551
558
|
y: this._isRtl
|
|
@@ -555,10 +562,10 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
555
562
|
transform: "translate(0,\n ".concat(svgDimensions.height - this.margins.bottom - this.margins.top - this.titleMargin, ")rotate(-90)"),
|
|
556
563
|
className: this._classNames.axisTitle,
|
|
557
564
|
'aria-hidden': true,
|
|
558
|
-
}, maxWidth: yAxisTitleMaximumAllowedHeight
|
|
565
|
+
}, maxWidth: yAxisTitleMaximumAllowedHeight }, commonSvgToolTipProps))),
|
|
559
566
|
this.props.yAxisAnnotation !== undefined &&
|
|
560
567
|
this.props.yAxisAnnotation !== '' &&
|
|
561
|
-
(this.props.secondaryYAxistitle === undefined || this.props.secondaryYAxistitle === '') && (React.createElement(SVGTooltipText_1.SVGTooltipText, { content: this.props.yAxisAnnotation, textProps: {
|
|
568
|
+
(this.props.secondaryYAxistitle === undefined || this.props.secondaryYAxistitle === '') && (React.createElement(SVGTooltipText_1.SVGTooltipText, tslib_1.__assign({ content: this.props.yAxisAnnotation, textProps: {
|
|
562
569
|
x: (yAxisTitleMaximumAllowedHeight - this.margins.bottom) / 2 +
|
|
563
570
|
this.state._removalValueForTextTuncate,
|
|
564
571
|
y: this._isRtl
|
|
@@ -570,7 +577,7 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
570
577
|
: this.margins.right / 2 + this.titleMargin, ",\n ").concat(svgDimensions.height - this.margins.bottom - this.margins.top - this.titleMargin, ")rotate(-90)"),
|
|
571
578
|
className: this._classNames.axisAnnotation,
|
|
572
579
|
'aria-hidden': true,
|
|
573
|
-
}, maxWidth: yAxisTitleMaximumAllowedHeight
|
|
580
|
+
}, maxWidth: yAxisTitleMaximumAllowedHeight }, commonSvgToolTipProps))))),
|
|
574
581
|
!this.props.hideLegend && (React.createElement("div", { ref: function (e) { return (_this.legendContainer = e); }, className: this._classNames.legendContainer }, this.props.legendBars)),
|
|
575
582
|
callout && React.createElement(React.Suspense, { fallback: React.createElement("div", null, "Loading...") }, callout)));
|
|
576
583
|
};
|