@fluentui/react-charting 5.24.5 → 5.24.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.json +43 -1
  2. package/CHANGELOG.md +22 -2
  3. package/dist/react-charting.js +1 -1
  4. package/dist/react-charting.min.js +1 -1
  5. package/lib/components/AreaChart/AreaChart.styles.js +2 -2
  6. package/lib/components/AreaChart/AreaChart.styles.js.map +1 -1
  7. package/lib/components/CommonComponents/CartesianChart.base.d.ts +3 -2
  8. package/lib/components/CommonComponents/CartesianChart.base.js +134 -112
  9. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  10. package/lib/components/CommonComponents/CartesianChart.styles.js +35 -62
  11. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/DonutChart.styles.js +2 -18
  15. package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
  16. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +15 -24
  17. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  18. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
  19. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
  20. package/lib/components/LineChart/LineChart.styles.js +3 -11
  21. package/lib/components/LineChart/LineChart.styles.js.map +1 -1
  22. package/lib/components/SankeyChart/SankeyChart.styles.js +2 -1
  23. package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  24. package/lib/components/ScatterChart/ScatterChart.styles.js +3 -14
  25. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  26. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +14 -12
  27. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  28. package/lib/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
  29. package/lib/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
  30. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +13 -17
  31. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  32. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
  33. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
  34. package/lib/utilities/Common.styles.d.ts +6 -0
  35. package/lib/utilities/Common.styles.js +51 -0
  36. package/lib/utilities/Common.styles.js.map +1 -0
  37. package/lib/utilities/SVGTooltipText.d.ts +1 -1
  38. package/lib/utilities/SVGTooltipText.js.map +1 -1
  39. package/lib/utilities/index.d.ts +1 -0
  40. package/lib/utilities/index.js +1 -0
  41. package/lib/utilities/index.js.map +1 -1
  42. package/lib/utilities/utilities.d.ts +3 -0
  43. package/lib/utilities/utilities.js +25 -38
  44. package/lib/utilities/utilities.js.map +1 -1
  45. package/lib/utilities/vbc-utils.d.ts +18 -0
  46. package/lib/utilities/vbc-utils.js +29 -0
  47. package/lib/utilities/vbc-utils.js.map +1 -1
  48. package/lib-amd/components/AreaChart/AreaChart.styles.js +2 -2
  49. package/lib-amd/components/AreaChart/AreaChart.styles.js.map +1 -1
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +3 -2
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js +133 -111
  52. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  53. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +33 -61
  54. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  55. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
  56. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  57. package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -17
  58. package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
  59. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -23
  60. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  61. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -13
  62. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
  63. package/lib-amd/components/LineChart/LineChart.styles.js +3 -10
  64. package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
  65. package/lib-amd/components/SankeyChart/SankeyChart.styles.js +2 -2
  66. package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  67. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +3 -13
  68. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  69. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +13 -11
  70. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  71. package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js +3 -13
  72. package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
  73. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +12 -16
  74. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  75. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -13
  76. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
  77. package/lib-amd/utilities/Common.styles.d.ts +6 -0
  78. package/lib-amd/utilities/Common.styles.js +57 -0
  79. package/lib-amd/utilities/Common.styles.js.map +1 -0
  80. package/lib-amd/utilities/SVGTooltipText.d.ts +1 -1
  81. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  82. package/lib-amd/utilities/index.d.ts +1 -0
  83. package/lib-amd/utilities/index.js +2 -1
  84. package/lib-amd/utilities/index.js.map +1 -1
  85. package/lib-amd/utilities/utilities.d.ts +3 -0
  86. package/lib-amd/utilities/utilities.js +26 -39
  87. package/lib-amd/utilities/utilities.js.map +1 -1
  88. package/lib-amd/utilities/vbc-utils.d.ts +18 -0
  89. package/lib-amd/utilities/vbc-utils.js +34 -1
  90. package/lib-amd/utilities/vbc-utils.js.map +1 -1
  91. package/lib-commonjs/components/AreaChart/AreaChart.styles.js +2 -2
  92. package/lib-commonjs/components/AreaChart/AreaChart.styles.js.map +1 -1
  93. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +3 -2
  94. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +133 -111
  95. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  96. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +33 -60
  97. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  98. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  100. package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -18
  101. package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
  102. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -23
  103. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  104. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
  105. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
  106. package/lib-commonjs/components/LineChart/LineChart.styles.js +3 -11
  107. package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
  108. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +2 -1
  109. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  110. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +3 -14
  111. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  112. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +13 -11
  113. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  114. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
  115. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
  116. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +12 -16
  117. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  118. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
  119. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
  120. package/lib-commonjs/utilities/Common.styles.d.ts +6 -0
  121. package/lib-commonjs/utilities/Common.styles.js +58 -0
  122. package/lib-commonjs/utilities/Common.styles.js.map +1 -0
  123. package/lib-commonjs/utilities/SVGTooltipText.d.ts +1 -1
  124. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  125. package/lib-commonjs/utilities/index.d.ts +1 -0
  126. package/lib-commonjs/utilities/index.js +1 -0
  127. package/lib-commonjs/utilities/index.js.map +1 -1
  128. package/lib-commonjs/utilities/utilities.d.ts +3 -0
  129. package/lib-commonjs/utilities/utilities.js +27 -40
  130. package/lib-commonjs/utilities/utilities.js.map +1 -1
  131. package/lib-commonjs/utilities/vbc-utils.d.ts +18 -0
  132. package/lib-commonjs/utilities/vbc-utils.js +34 -1
  133. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  134. package/package.json +1 -1
@@ -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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a;;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
@@ -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,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;YAoFxC,UAAI,GAAG;gBACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;YAEK,aAAO,GAAG;gBACf,KAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC;YAEM,kBAAY,GAAG;gBACrB,IAAI,KAAI,CAAC,YAAY,CAAC,OAAO,IAAI,OAAO,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;oBACzF,IAAM,IAAI,GAAG,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBACjD,KAAI,CAAC,QAAQ,CAAC;wBACZ,KAAK,EAAE,IAAI,CAAC,CAAC;wBACb,KAAK,EAAE,IAAI,CAAC,CAAC;wBACb,SAAS,EAAE,IAAI,CAAC,KAAK;wBACrB,UAAU,EAAE,IAAI,CAAC,MAAM;qBACxB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC;YAEM,uBAAiB,GAAG;gBAC1B,IAAI,CAAC,K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AAe,EACpC,aAAa,EAAE,IAAI,CAAC,cAAc,EAClC,YAAY,EAAE,IAAI,CAAC,oBAAoB,EACvC,YAAY,EAAE,IAAI,CAAC,oBAAoB,EACvC,SAAS,EAAE,IAAI,CAAC,iBAAiB,uBACd,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,KAEhE,OAAO,CACH;gBACN,WAAW,IAAI,oBAAC,iBAAO,uBAAK,kBAAkB,EAAI,CAClD,CACJ,CAAC;QACJ,CAAC;QAEM,0CAAiB,GAAxB;YACE,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;QAEM,2CAAkB,GAAzB,UAA0B,SAAyC;YACjE,IAAI,IAAI,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\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 = 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
+ {"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,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;YAoFxC,UAAI,GAAG;gBACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;YAEK,aAAO,GAAG;gBACf,KAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC;YAEM,kBAAY,GAAG;gBACrB,IAAI,KAAI,CAAC,YAAY,CAAC,OAAO,IAAI,OAAO,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;oBACzF,IAAM,IAAI,GAAG,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBACjD,KAAI,CAAC,QAAQ,CAAC;wBACZ,KAAK,EAAE,IAAI,CAAC,CAAC;wBACb,KAAK,EAAE,IAAI,CAAC,CAAC;wBACb,SAAS,EAAE,IAAI,CAAC,KAAK;wBACrB,UAAU,EAAE,IAAI,CAAC,MAAM;qBACxB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC;YAEM,uBAAiB,GAAG;gBAC1B,IAAI,C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AAC,eAAe,EACpC,aAAa,EAAE,IAAI,CAAC,cAAc,EAClC,YAAY,EAAE,IAAI,CAAC,oBAAoB,EACvC,YAAY,EAAE,IAAI,CAAC,oBAAoB,EACvC,SAAS,EAAE,IAAI,CAAC,iBAAiB,uBACd,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,KAEhE,OAAO,CACH;gBACN,WAAW,IAAI,oBAAC,iBAAO,uBAAK,kBAAkB,EAAI,CAClD,CACJ,CAAC;QACJ,CAAC;QAEM,0CAAiB,GAAxB;YACE,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;QAEM,2CAAkB,GAAzB,UAA0B,SAAyC;YACjE,IAAI,IAAI,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,4 +1,5 @@
1
1
  export * from './ChartHoverCard/index';
2
+ export * from './Common.styles';
2
3
  export * from './utilities';
3
4
  export * from './colors';
4
5
  export * from './gradients';
@@ -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"]}
@@ -34,6 +34,7 @@ export interface IWrapLabelProps {
34
34
  xAxis: NumericAxis | StringAxis;
35
35
  noOfCharsToTruncate: number;
36
36
  showXAxisLablesTooltip: boolean;
37
+ width?: number;
37
38
  }
38
39
  export interface IRotateLabelProps {
39
40
  node: SVGSVGElement | null;
@@ -84,6 +85,7 @@ export interface IXAxisParams {
84
85
  containerHeight: number;
85
86
  containerWidth: number;
86
87
  hideTickOverlap?: boolean;
88
+ calcMaxLabelWidth: (x: (string | number)[]) => number;
87
89
  }
88
90
  export interface ITickParams {
89
91
  tickValues?: Date[] | number[] | string[];
@@ -219,6 +221,7 @@ export declare function getUnique(arr: {
219
221
  * @param value
220
222
  */
221
223
  export declare function silceOrAppendToArray(array: string[], value: string): string[];
224
+ export declare const DEFAULT_WRAP_WIDTH = 10;
222
225
  /**
223
226
  * This method used for wrapping of x axis labels (tick values).
224
227
  * It breaks down given text value by space separated and calculates the total height needed to display all the words.
@@ -2,7 +2,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
2
2
  "use strict";
3
3
  var _a;
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.sortAxisCategories = exports.truncateString = exports.domainRangeOfNumericForScatterChart = exports.domainRangeOfDateForScatterChart = exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = exports.resolveCSSVariables = exports.areArraysEqual = exports.getSecureProps = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatScientificLimitWidth = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.computeLongestBars = exports.groupChartDataByYValue = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createNumericYAxis = exports.createYAxisForHorizontalBarChartWithAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.defaultYAxisTickFormatter = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
5
+ exports.sortAxisCategories = exports.truncateString = exports.domainRangeOfNumericForScatterChart = exports.domainRangeOfDateForScatterChart = exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = exports.resolveCSSVariables = exports.areArraysEqual = exports.getSecureProps = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatScientificLimitWidth = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.computeLongestBars = exports.groupChartDataByYValue = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.DEFAULT_WRAP_WIDTH = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createNumericYAxis = exports.createYAxisForHorizontalBarChartWithAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.defaultYAxisTickFormatter = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
6
6
  exports.MIN_DOMAIN_MARGIN = 8;
7
7
  exports.MIN_DONUT_RADIUS = 1;
8
8
  var ChartTypes;
@@ -63,7 +63,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
63
63
  */
64
64
  function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
65
65
  var _a;
66
- var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _b === void 0 ? true : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, _d = xAxisParams.tickPadding, tickPadding = _d === void 0 ? 10 : _d, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap;
66
+ var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _b === void 0 ? true : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, _d = xAxisParams.tickPadding, tickPadding = _d === void 0 ? 10 : _d, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
67
67
  var xAxisScale = (0, d3_scale_1.scaleLinear)()
68
68
  .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
69
69
  .range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
@@ -77,7 +77,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
77
77
  return (0, chart_utilities_1.formatToLocaleString)(xAxisValue, culture);
78
78
  };
79
79
  if (hideTickOverlap && typeof xAxisCount === 'undefined') {
80
- var longestLabelWidth = (0, exports.calculateLongestLabelWidth)(xAxisScale.ticks().map(tickFormat), '[class^="xAxis-"] text') + 20;
80
+ var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 20;
81
81
  var _e = xAxisScale.range(), start = _e[0], end = _e[1];
82
82
  tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
83
83
  }
@@ -203,7 +203,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
203
203
  */
204
204
  function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
205
205
  var _a;
206
- var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, xAxisCount = xAxisParams.xAxisCount;
206
+ var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
207
207
  var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
208
208
  xAxisScale
209
209
  .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
@@ -241,7 +241,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
241
241
  }
242
242
  return (0, chart_utilities_1.formatDateToLocaleString)(domainValue, culture, useUTC, false, formatOptions);
243
243
  };
244
- var longestLabelWidth = (0, exports.calculateLongestLabelWidth)(xAxisScale.ticks().map(tickFormat), '[class^="xAxis-"] text') + 40;
244
+ var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
245
245
  var _d = xAxisScale.range(), start = _d[0], end = _d[1];
246
246
  var maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
247
247
  tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
@@ -269,7 +269,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
269
269
  */
270
270
  function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
271
271
  var _a;
272
- var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, _d = xAxisParams.xAxisPadding, xAxisPadding = _d === void 0 ? 0.1 : _d, xAxisInnerPadding = xAxisParams.xAxisInnerPadding, xAxisOuterPadding = xAxisParams.xAxisOuterPadding, containerWidth = xAxisParams.containerWidth, hideTickOverlap = xAxisParams.hideTickOverlap;
272
+ var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, _d = xAxisParams.xAxisPadding, xAxisPadding = _d === void 0 ? 0.1 : _d, xAxisInnerPadding = xAxisParams.xAxisInnerPadding, xAxisOuterPadding = xAxisParams.xAxisOuterPadding, containerWidth = xAxisParams.containerWidth, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
273
273
  var xAxisScale = (0, d3_scale_1.scaleBand)()
274
274
  .domain(dataset)
275
275
  .range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
@@ -281,7 +281,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
281
281
  // Here, we need the width of each individual label to detect overlaps,
282
282
  // but calculateLongestLabelWidth returns the maximum pixel width from an array of labels.
283
283
  // So call this function separately for each label, instead of the entire array.
284
- var tickSizes = tickValues.map(function (value) { return (0, exports.calculateLongestLabelWidth)([value], '[class^="xAxis-"] text'); });
284
+ var tickSizes = tickValues.map(function (value) { return calcMaxLabelWidth([value]); });
285
285
  // for LTR
286
286
  var start = 0;
287
287
  var end = containerWidth;
@@ -395,10 +395,10 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
395
395
  if (roundedTicks === void 0) { roundedTicks = false; }
396
396
  var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, containerWidth = yAxisParams.containerWidth, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, eventAnnotationProps = yAxisParams.eventAnnotationProps, eventLabelHeight = yAxisParams.eventLabelHeight;
397
397
  // maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
398
- var tempVal = maxOfYVal || yMinMaxValues.endValue;
398
+ var tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
399
399
  var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
400
400
  var finalYmin = supportNegativeData
401
- ? Math.min(yMinMaxValues.startValue, yMinValue || 0)
401
+ ? Math.min(yMinMaxValues.startValue || 0, yMinValue || 0)
402
402
  : yMinMaxValues.startValue < yMinValue
403
403
  ? 0
404
404
  : yMinValue;
@@ -554,6 +554,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
554
554
  }
555
555
  }
556
556
  exports.silceOrAppendToArray = silceOrAppendToArray;
557
+ exports.DEFAULT_WRAP_WIDTH = 10;
557
558
  /**
558
559
  * This method used for wrapping of x axis labels (tick values).
559
560
  * It breaks down given text value by space separated and calculates the total height needed to display all the words.
@@ -564,21 +565,19 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
564
565
  * @returns
565
566
  */
566
567
  function createWrapOfXLabels(wrapLabelProps) {
567
- var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip;
568
+ var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _a = wrapLabelProps.width, width = _a === void 0 ? exports.DEFAULT_WRAP_WIDTH : _a;
568
569
  if (node === null) {
569
570
  return;
570
571
  }
571
572
  var axisNode = (0, d3_selection_1.select)(node).call(xAxis);
572
573
  var removeVal = 0;
573
- var width = 10;
574
- var arr = [];
574
+ var maxLines = 1;
575
575
  axisNode.selectAll('.tick text').each(function () {
576
576
  var text = (0, d3_selection_1.select)(this);
577
577
  var totalWord = text.text();
578
578
  var truncatedWord = "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
579
579
  var totalWordLength = text.text().length;
580
580
  var words = text.text().split(/\s+/).reverse();
581
- arr.push(words.length);
582
581
  var word = '';
583
582
  var line = [];
584
583
  var lineNumber = 0;
@@ -599,7 +598,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
599
598
  .attr('id', 'showDots')
600
599
  .attr('x', 0)
601
600
  .attr('y', y)
602
- .attr('dy', ++lineNumber * lineHeight + dy + 'em')
601
+ .attr('dy', dy + 'em')
603
602
  .text(truncatedWord);
604
603
  }
605
604
  else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
@@ -608,7 +607,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
608
607
  .attr('id', 'LessLength')
609
608
  .attr('x', 0)
610
609
  .attr('y', y)
611
- .attr('dy', ++lineNumber * lineHeight + dy + 'em')
610
+ .attr('dy', dy + 'em')
612
611
  .text(totalWord);
613
612
  }
614
613
  else {
@@ -628,32 +627,20 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
628
627
  .text(word);
629
628
  }
630
629
  }
631
- var maxDigit = Math.max.apply(Math, arr);
632
- var maxHeight_1 = 12; // intial value to render corretly first time
633
- axisNode.selectAll('text').each(function () {
634
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
635
- var outerHTMLElement = document.getElementById('WordBreakId');
636
- var BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
637
- var boxHeight = BoxCordinates && BoxCordinates.height;
638
- if (boxHeight > maxHeight_1) {
639
- maxHeight_1 = boxHeight;
640
- }
641
- });
642
- // If we take directly maxDigit * maxheight, then it will show more height between x axis tick values and bottom.
643
- // To avoid this, reducing maxDigit value by removing some digit based on legth of word.
644
- var removeDigit = 4;
645
- if (maxDigit <= 2) {
646
- removeDigit = 1;
647
- }
648
- else if (maxDigit > 2 && maxDigit <= 6) {
649
- removeDigit = 2;
650
- }
651
- else if (maxDigit > 6 && maxDigit <= 9) {
652
- removeDigit = 3;
653
- }
654
- removeVal = (maxDigit - removeDigit) * maxHeight_1;
655
630
  }
631
+ maxLines = Math.max(maxLines, lineNumber + 1);
656
632
  });
633
+ if (!showXAxisLablesTooltip) {
634
+ var maxHeight = 12; // intial value to render corretly first time
635
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
636
+ var outerHTMLElement = document.getElementById('WordBreakId');
637
+ var BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
638
+ var boxHeight = BoxCordinates && BoxCordinates.height;
639
+ if (boxHeight > maxHeight) {
640
+ maxHeight = boxHeight;
641
+ }
642
+ removeVal = (maxLines - 1) * maxHeight;
643
+ }
657
644
  return removeVal > 0 ? removeVal : 0;
658
645
  }
659
646
  exports.createWrapOfXLabels = createWrapOfXLabels;