UNPKG

@progress/kendo-react-map

Version:
66 lines (65 loc) 2 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 l } from "@progress/kendo-charts"; import { hasParent as h } from "../utils/index.mjs"; import { Popup as u } from "@progress/kendo-react-popup"; import { MapContext as f } from "../MapContext.mjs"; const v = { horizontal: "fit", vertical: "fit" }, d = ["k-tooltip", "k-map-tooltip"], O = "k-tooltip-wrapper", n = class n extends s.Component { constructor(t) { super(t), this.context = null, this.element = null, this.onMapMouseLeave = (e) => { const { syntheticEvent: o } = e; return !!h(o.relatedTarget, this.element); }, this.mapObserver = new l(this, { onMouseLeave: "onMapMouseLeave" }); } componentDidMount() { var t; (t = this.context) == null || t.observersStore.dispatch({ type: "add", payload: this.mapObserver }); } render() { const { popupShown: t, popupAlign: e, popupOffset: o, popupStyles: p, popupContent: a, className: i } = this.props, m = [...d, i].join(" ").trim(); return /* @__PURE__ */ s.createElement( u, { animate: !0, popupAlign: e, offset: o, show: t, collision: v, className: O }, /* @__PURE__ */ s.createElement( "div", { className: m, style: p, ref: (c) => { this.element = c; } }, a() ) ); } componentWillUnmount() { this.context.observersStore.dispatch({ type: "remove", payload: this.mapObserver }); } }; n.contextType = f; let r = n; export { r as TooltipPopup };