@fluentui/react-charting 5.17.2 → 5.17.4

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 (110) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/react-charting.js +1 -1
  4. package/dist/react-charting.min.js +1 -1
  5. package/docs/TestPlans/VerticalStackedBarChart/ComponentTests.md +73 -0
  6. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +9 -0
  7. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js +34 -3
  8. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  9. package/lib/components/HorizontalBarChart/HorizontalBarChart.styles.js +1 -4
  10. package/lib/components/HorizontalBarChart/HorizontalBarChart.styles.js.map +1 -1
  11. package/lib/components/PieChart/Arc/Arc.d.ts +8 -3
  12. package/lib/components/PieChart/Arc/Arc.js +50 -19
  13. package/lib/components/PieChart/Arc/Arc.js.map +1 -1
  14. package/lib/components/PieChart/Arc/Arc.styles.d.ts +2 -1
  15. package/lib/components/PieChart/Arc/Arc.styles.js +5 -2
  16. package/lib/components/PieChart/Arc/Arc.styles.js.map +1 -1
  17. package/lib/components/PieChart/Arc/Arc.types.d.ts +15 -2
  18. package/lib/components/PieChart/Arc/Arc.types.js.map +1 -1
  19. package/lib/components/PieChart/Pie/Pie.js +16 -5
  20. package/lib/components/PieChart/Pie/Pie.js.map +1 -1
  21. package/lib/components/PieChart/Pie/Pie.types.d.ts +2 -1
  22. package/lib/components/PieChart/Pie/Pie.types.js.map +1 -1
  23. package/lib/components/PieChart/PieChart.base.js +9 -3
  24. package/lib/components/PieChart/PieChart.base.js.map +1 -1
  25. package/lib/components/StackedBarChart/MultiStackedBarChart.base.d.ts +9 -0
  26. package/lib/components/StackedBarChart/MultiStackedBarChart.base.js +38 -6
  27. package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  28. package/lib/components/StackedBarChart/MultiStackedBarChart.styles.js +0 -4
  29. package/lib/components/StackedBarChart/MultiStackedBarChart.styles.js.map +1 -1
  30. package/lib/components/StackedBarChart/StackedBarChart.base.d.ts +10 -0
  31. package/lib/components/StackedBarChart/StackedBarChart.base.js +36 -4
  32. package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  33. package/lib/components/StackedBarChart/StackedBarChart.styles.js +1 -2
  34. package/lib/components/StackedBarChart/StackedBarChart.styles.js.map +1 -1
  35. package/lib/utilities/SVGTooltipText.d.ts +14 -0
  36. package/lib/utilities/SVGTooltipText.js +3 -3
  37. package/lib/utilities/SVGTooltipText.js.map +1 -1
  38. package/lib/version.js +1 -1
  39. package/lib/version.js.map +1 -1
  40. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +9 -0
  41. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js +34 -3
  42. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  43. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.styles.js +1 -4
  44. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.styles.js.map +1 -1
  45. package/lib-amd/components/PieChart/Arc/Arc.d.ts +8 -3
  46. package/lib-amd/components/PieChart/Arc/Arc.js +47 -17
  47. package/lib-amd/components/PieChart/Arc/Arc.js.map +1 -1
  48. package/lib-amd/components/PieChart/Arc/Arc.styles.d.ts +2 -1
  49. package/lib-amd/components/PieChart/Arc/Arc.styles.js +5 -2
  50. package/lib-amd/components/PieChart/Arc/Arc.styles.js.map +1 -1
  51. package/lib-amd/components/PieChart/Arc/Arc.types.d.ts +15 -2
  52. package/lib-amd/components/PieChart/Arc/Arc.types.js.map +1 -1
  53. package/lib-amd/components/PieChart/Pie/Pie.js +15 -6
  54. package/lib-amd/components/PieChart/Pie/Pie.js.map +1 -1
  55. package/lib-amd/components/PieChart/Pie/Pie.types.d.ts +2 -1
  56. package/lib-amd/components/PieChart/Pie/Pie.types.js.map +1 -1
  57. package/lib-amd/components/PieChart/PieChart.base.js +9 -3
  58. package/lib-amd/components/PieChart/PieChart.base.js.map +1 -1
  59. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.d.ts +9 -0
  60. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js +38 -6
  61. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  62. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.styles.js +0 -4
  63. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.styles.js.map +1 -1
  64. package/lib-amd/components/StackedBarChart/StackedBarChart.base.d.ts +10 -0
  65. package/lib-amd/components/StackedBarChart/StackedBarChart.base.js +35 -3
  66. package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  67. package/lib-amd/components/StackedBarChart/StackedBarChart.styles.js +1 -2
  68. package/lib-amd/components/StackedBarChart/StackedBarChart.styles.js.map +1 -1
  69. package/lib-amd/utilities/SVGTooltipText.d.ts +14 -0
  70. package/lib-amd/utilities/SVGTooltipText.js +3 -3
  71. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  72. package/lib-amd/version.js +1 -1
  73. package/lib-amd/version.js.map +1 -1
  74. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +9 -0
  75. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js +34 -3
  76. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  77. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.styles.js +1 -4
  78. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.styles.js.map +1 -1
  79. package/lib-commonjs/components/PieChart/Arc/Arc.d.ts +8 -3
  80. package/lib-commonjs/components/PieChart/Arc/Arc.js +47 -16
  81. package/lib-commonjs/components/PieChart/Arc/Arc.js.map +1 -1
  82. package/lib-commonjs/components/PieChart/Arc/Arc.styles.d.ts +2 -1
  83. package/lib-commonjs/components/PieChart/Arc/Arc.styles.js +5 -2
  84. package/lib-commonjs/components/PieChart/Arc/Arc.styles.js.map +1 -1
  85. package/lib-commonjs/components/PieChart/Arc/Arc.types.d.ts +15 -2
  86. package/lib-commonjs/components/PieChart/Arc/Arc.types.js.map +1 -1
  87. package/lib-commonjs/components/PieChart/Pie/Pie.js +16 -5
  88. package/lib-commonjs/components/PieChart/Pie/Pie.js.map +1 -1
  89. package/lib-commonjs/components/PieChart/Pie/Pie.types.d.ts +2 -1
  90. package/lib-commonjs/components/PieChart/Pie/Pie.types.js.map +1 -1
  91. package/lib-commonjs/components/PieChart/PieChart.base.js +9 -3
  92. package/lib-commonjs/components/PieChart/PieChart.base.js.map +1 -1
  93. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.d.ts +9 -0
  94. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js +38 -6
  95. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  96. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.styles.js +0 -4
  97. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.styles.js.map +1 -1
  98. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.d.ts +10 -0
  99. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js +35 -3
  100. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  101. package/lib-commonjs/components/StackedBarChart/StackedBarChart.styles.js +1 -2
  102. package/lib-commonjs/components/StackedBarChart/StackedBarChart.styles.js.map +1 -1
  103. package/lib-commonjs/utilities/SVGTooltipText.d.ts +14 -0
  104. package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
  105. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  106. package/lib-commonjs/version.js +1 -1
  107. package/lib-commonjs/version.js.map +1 -1
  108. package/package.json +3 -3
  109. package/src/components/PieChart/Arc/Arc.types.ts +19 -2
  110. package/src/components/PieChart/Pie/Pie.types.ts +3 -1
@@ -141,16 +141,16 @@ var SVGTooltipText = /** @class */ (function (_super) {
141
141
  return _this;
142
142
  }
143
143
  SVGTooltipText.prototype.render = function () {
144
- var _a = this.props, content = _a.content, tooltipProps = _a.tooltipProps, textProps = _a.textProps;
144
+ var _a = this.props, content = _a.content, tooltipProps = _a.tooltipProps, textProps = _a.textProps, _b = _a.shouldReceiveFocus, shouldReceiveFocus = _b === void 0 ? true : _b;
145
145
  var isTooltipVisible = this.state.isTooltipVisible;
146
146
  var tooltipRenderProps = tslib_1.__assign({ content: content, targetElement: this._getTargetElement(), calloutProps: {
147
147
  onDismiss: this._hideTooltip,
148
148
  onMouseEnter: this._onTooltipMouseEnter,
149
149
  onMouseLeave: this._onTooltipMouseLeave,
150
150
  }, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, tooltipProps);
151
- var showTooltip = isTooltipVisible && !!content;
151
+ var showTooltip = (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);
152
152
  return (React.createElement(React.Fragment, null,
153
- 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": this.state.isOverflowing }), content),
153
+ 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),
154
154
  showTooltip && React.createElement(Tooltip_1.Tooltip, tslib_1.__assign({}, tooltipRenderProps))));
155
155
  };
156
156
  SVGTooltipText.prototype.componentDidMount = function () {
@@ -1 +1 @@
1
- {"version":3,"file":"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U,KAAK,CAAC,SAAS,GAmOxB;AApOY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\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 * 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\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n}\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 } = this.props;\n const { isTooltipVisible } = 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 = isTooltipVisible && !!content;\n\n return (\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={this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\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 }\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 _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 deprecation/deprecation\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":";;;;AAAA,6BAA+B;AAC/B,uDAAiG;AACjG,0CAA6E;AAqE7E;;;GAGG;AACH;IACU,0CAA2D;IAkBnE,wBAAY,KAA2B;QAAvC,YACE,kBAAM,KAAK,CAAC,SAQb;QAlBD,6CAA6C;QACrC,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;QAuExC,UAAI,GAAG;YACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEK,aAAO,GAAG;YACf,KAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC;QAEM,uBAAiB,GAAG;YAC1B,IAAI,CAAC,KAAI,CAAC,YAAY,CAAC,OAAO,EAA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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;YACN,WAAW,IAAI,oBAAC,iBAAO,uBAAK,kBAAkB,EAAI,CAClD,CACJ,CAAC;IACJ,CAAC;IAEM,0CAAiB,GAAxB;QACE,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAEM,2CAAkB,GAAzB,UAA0B,SAAyC;QACjE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAE;YAC9F,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;IACH,CAAC;IAEM,6CAAoB,GAA3B;QACE,IAAI,cAAc,CAAC,sBAAsB,IAAI,cAAc,CAAC,sBAAsB,KAAK,IAAI,EAAE;YAC3F,cAAc,CAAC,sBAAsB,GAAG,SAAS,CAAC;SACnD;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAjFa,2BAAY,GAAG;QAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;KAC3B,CAAC;IA+NJ,qBAAC;CAAA,AArOD,CACU,KAAK,CAAC,SAAS,GAoOxB;AArOY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\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\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n}\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 } = this.props;\n const { isTooltipVisible } = 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\n return (\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 }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\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 _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 deprecation/deprecation\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"]}
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // Do not modify this file; it is generated as part of publish.
4
4
  // The checked in version is a placeholder only and will not be updated.
5
5
  var set_version_1 = require("@fluentui/set-version");
6
- (0, set_version_1.setVersion)('@fluentui/react-charting', '5.17.2');
6
+ (0, set_version_1.setVersion)('@fluentui/react-charting', '5.17.4');
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,qDAAmD;AACnD,IAAA,wBAAU,EAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-charting', '5.17.2');"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,qDAAmD;AACnD,IAAA,wBAAU,EAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-charting', '5.17.4');"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-charting",
3
- "version": "5.17.2",
3
+ "version": "5.17.4",
4
4
  "description": "Experimental React charting components for building experiences for Microsoft 365.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@fluentui/react-focus": "^8.8.31",
41
- "@fluentui/theme-samples": "^8.7.108",
41
+ "@fluentui/theme-samples": "^8.7.110",
42
42
  "@microsoft/load-themed-styles": "^1.10.26",
43
43
  "@types/d3-array": "1.2.1",
44
44
  "@types/d3-axis": "1.0.10",
@@ -64,7 +64,7 @@
64
64
  "tslib": "^2.1.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@fluentui/react": "^8.110.15",
67
+ "@fluentui/react": "^8.111.1",
68
68
  "@types/react": ">=16.8.0 <19.0.0",
69
69
  "@types/react-dom": ">=16.8.0 <19.0.0",
70
70
  "react": ">=16.8.0 <19.0.0",
@@ -1,4 +1,4 @@
1
- import { IStyle } from '@fluentui/react/lib/Styling';
1
+ import { IStyle, ITheme } from '@fluentui/react/lib/Styling';
2
2
  import { IDataPoint } from '../PieChart.types';
3
3
 
4
4
  export interface IArcProps {
@@ -30,6 +30,17 @@ export interface IArcProps {
30
30
  * The prop used to define the culture to localized the numbers
31
31
  */
32
32
  culture?: string;
33
+ /**
34
+ * to pass the theme
35
+ */
36
+ theme?: ITheme;
37
+ }
38
+
39
+ export interface IArcState {
40
+ /**
41
+ * The state controls, whether the arc needs to be focused or not
42
+ */
43
+ isArcFocused?: boolean;
33
44
  }
34
45
 
35
46
  export interface IArcData {
@@ -63,5 +74,11 @@ export interface IArcStyles {
63
74
  /**
64
75
  * Style set for the card header component root
65
76
  */
66
- root: IStyle;
77
+ arcRoot: IStyle;
78
+
79
+ arc: IStyle;
80
+
81
+ arcRootFocussed: IStyle;
82
+
83
+ arcText: IStyle;
67
84
  }
@@ -1,4 +1,4 @@
1
- import { IStyle } from '@fluentui/react/lib/Styling';
1
+ import { IStyle, ITheme } from '@fluentui/react/lib/Styling';
2
2
  import { IDataPoint } from '../PieChart.types';
3
3
 
4
4
  export interface IPieProps {
@@ -40,6 +40,8 @@ export interface IPieProps {
40
40
  * The prop used to define the culture to localized the numbers
41
41
  */
42
42
  culture?: string;
43
+
44
+ theme?: ITheme;
43
45
  }
44
46
 
45
47
  export interface IPieStyles {