UNPKG

@progress/kendo-react-charts

Version:

React Chart renders a wide range of high-quality data visualizations. KendoReact Charts package

64 lines (63 loc) 2.29 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as s from "react"; import { InstanceObserver as h } from "@progress/kendo-charts"; import { toDomEvent as l } from "../events/dom-event.mjs"; import { hasParent as m } from "../utils/index.mjs"; import { Popup as u } from "@progress/kendo-react-popup"; import { ChartContext as f } from "../ChartContext.mjs"; const v = { horizontal: "fit", vertical: "fit" }, d = "k-chart-tooltip", C = "k-chart-tooltip-wrapper", n = class n extends s.Component { constructor(o) { super(o), this.context = null, this.element = null, this.onChartMouseLeave = (t) => { const { syntheticEvent: e } = t; return !!m(e.relatedTarget, this.element); }, this.onMouseLeave = (t) => { const e = l(this, t); this.context.childrenObserver.trigger("onMouseLeave", e) && t.preventDefault(); }, this.popupRef = (t) => { this.element = t; const e = t && t.closest(".k-animation-container"); e && (e.style.transition = "initial"); }, this.chartObserver = new h(this, { onMouseLeave: "onChartMouseLeave" }); } componentDidMount() { var o; (o = this.context) == null || o.observersStore.dispatch({ type: "add", payload: this.chartObserver }); } render() { const { popupShown: o, popupAlign: t, popupOffset: e, popupStyles: r, popupContent: i, className: p } = this.props, c = [d, p].join(" ").trim(); return /* @__PURE__ */ s.createElement( u, { animate: !1, popupAlign: t, offset: e, show: o, collision: v, className: C }, /* @__PURE__ */ s.createElement("div", { className: c, style: r, onMouseLeave: this.onMouseLeave, ref: this.popupRef }, i()) ); } componentWillUnmount() { this.context.observersStore.dispatch({ type: "remove", payload: this.chartObserver }); } }; n.contextType = f; let a = n; export { a as TooltipPopup };