@progress/kendo-react-tooltip 7.2.4-develop.3 → 7.2.4-develop.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 (36) hide show
  1. package/dist/cdn/js/kendo-react-tooltip.js +8 -5
  2. package/index.d.mts +520 -5
  3. package/index.d.ts +520 -23
  4. package/index.js +8 -5
  5. package/index.mjs +13 -466
  6. package/package-metadata.js +8 -0
  7. package/package-metadata.mjs +19 -0
  8. package/package.json +3 -3
  9. package/popover/Popover.js +8 -0
  10. package/popover/Popover.mjs +185 -0
  11. package/popover/PopoverActionsBar.js +8 -0
  12. package/popover/PopoverActionsBar.mjs +45 -0
  13. package/tooltip/Tooltip.js +8 -0
  14. package/tooltip/Tooltip.mjs +220 -0
  15. package/tooltip/utils.js +8 -0
  16. package/tooltip/utils.mjs +59 -0
  17. package/package-metadata.d.ts +0 -9
  18. package/popover/Popover.d.ts +0 -19
  19. package/popover/PopoverActionsBar.d.ts +0 -23
  20. package/popover/interfaces/Align.d.ts +0 -28
  21. package/popover/interfaces/PopoverActionsBarProps.d.ts +0 -31
  22. package/popover/interfaces/PopoverAnimation.d.ts +0 -10
  23. package/popover/interfaces/PopoverCloseEvent.d.ts +0 -14
  24. package/popover/interfaces/PopoverCollision.d.ts +0 -18
  25. package/popover/interfaces/PopoverCollisionType.d.ts +0 -14
  26. package/popover/interfaces/PopoverMargin.d.ts +0 -18
  27. package/popover/interfaces/PopoverOffset.d.ts +0 -18
  28. package/popover/interfaces/PopoverOpenEvent.d.ts +0 -14
  29. package/popover/interfaces/PopoverPosition.d.ts +0 -13
  30. package/popover/interfaces/PopoverPositionEvent.d.ts +0 -22
  31. package/popover/interfaces/PopoverPositionMode.d.ts +0 -9
  32. package/popover/interfaces/PopoverProps.d.ts +0 -115
  33. package/tooltip/Tooltip.d.ts +0 -89
  34. package/tooltip/TooltipProps.d.ts +0 -112
  35. package/tooltip/events.d.ts +0 -35
  36. package/tooltip/utils.d.ts +0 -28
@@ -0,0 +1,185 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as o from "react";
10
+ import e from "prop-types";
11
+ import { validatePackage as U, ZIndexContext as C, classNames as X } from "@progress/kendo-react-common";
12
+ import { packageMetadata as q } from "../package-metadata.mjs";
13
+ import { Popup as G } from "@progress/kendo-react-popup";
14
+ import { PopoverActionsBar as k } from "./PopoverActionsBar.mjs";
15
+ const J = 12e3, Q = 2e3, E = 15, W = {
16
+ top: "k-callout-s",
17
+ left: "k-callout-e",
18
+ bottom: "k-callout-n",
19
+ right: "k-callout-w"
20
+ }, Y = {
21
+ top: "k-callout-n",
22
+ left: "k-callout-w",
23
+ bottom: "k-callout-s",
24
+ right: "k-callout-e"
25
+ }, $ = {
26
+ top: { vertical: "bottom", horizontal: "center" },
27
+ left: { vertical: "center", horizontal: "right" },
28
+ bottom: { vertical: "top", horizontal: "center" },
29
+ right: { vertical: "center", horizontal: "left" }
30
+ }, ee = {
31
+ top: { vertical: "top", horizontal: "center" },
32
+ left: { vertical: "center", horizontal: "left" },
33
+ bottom: { vertical: "bottom", horizontal: "center" },
34
+ right: { vertical: "center", horizontal: "right" }
35
+ }, oe = (r) => o.Children.toArray(r).filter((t) => t && t.type === k), te = (r) => o.Children.toArray(r).filter((t) => t && t.type !== k), v = o.forwardRef((r, t) => {
36
+ U(q);
37
+ const {
38
+ callout: s,
39
+ position: l,
40
+ title: p,
41
+ children: u,
42
+ show: O,
43
+ anchor: T,
44
+ appendTo: A,
45
+ offset: z,
46
+ animate: N,
47
+ positionMode: R,
48
+ scale: x,
49
+ popoverClass: a,
50
+ className: I,
51
+ id: w,
52
+ style: j,
53
+ collision: D,
54
+ contentStyle: h,
55
+ onPosition: f,
56
+ onClose: d,
57
+ onOpen: m
58
+ } = r, [F, b] = o.useState(!1), g = l === "top" || l === "bottom", V = r.margin || {
59
+ vertical: s && g ? E : 0,
60
+ horizontal: s && !g ? E : 0
61
+ }, Z = $[l], _ = ee[l], y = o.useContext(C), B = y ? y + Q : J, i = o.useRef(null);
62
+ o.useImperativeHandle(i, () => ({ props: r })), o.useImperativeHandle(t, () => i.current);
63
+ const M = o.useCallback(
64
+ (n) => {
65
+ if (setTimeout(() => b(n.flipped)), f) {
66
+ const H = { target: i.current, flipped: n.flipped, fitted: n.fitted };
67
+ f.call(void 0, H);
68
+ }
69
+ },
70
+ [f, b]
71
+ ), S = o.useCallback(
72
+ () => {
73
+ if (m) {
74
+ const n = { target: i.current };
75
+ m.call(void 0, n);
76
+ }
77
+ },
78
+ [m]
79
+ ), K = o.useCallback(
80
+ () => {
81
+ if (d) {
82
+ const n = { target: i.current };
83
+ d.call(void 0, n);
84
+ }
85
+ },
86
+ [d]
87
+ ), c = { "k-popover": !0 };
88
+ Array.isArray(a) ? a.forEach((n) => c[n] = !0) : typeof a == "object" ? Object.keys(a).forEach((n) => {
89
+ c[n] = a[n];
90
+ }) : a && (c[a] = !0);
91
+ const L = F ? Y[l] : W[l], P = o.useMemo(
92
+ () => /* @__PURE__ */ o.createElement(o.Fragment, null, p && /* @__PURE__ */ o.createElement("div", { className: "k-popover-header" }, p), /* @__PURE__ */ o.createElement("div", { className: "k-popover-body", style: h }, te(u)), oe(u)),
93
+ [u, h, p]
94
+ );
95
+ return /* @__PURE__ */ o.createElement(C.Provider, { value: B }, /* @__PURE__ */ o.createElement(
96
+ G,
97
+ {
98
+ id: w,
99
+ role: "tooltip",
100
+ animate: N,
101
+ collision: D,
102
+ anchor: T,
103
+ offset: z,
104
+ margin: V,
105
+ popupAlign: Z,
106
+ anchorAlign: _,
107
+ appendTo: A,
108
+ show: O,
109
+ scale: x,
110
+ positionMode: R,
111
+ style: j,
112
+ className: I,
113
+ popupClass: c,
114
+ onOpen: S,
115
+ onClose: K,
116
+ onPosition: M
117
+ },
118
+ s && l ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", { className: X("k-popover-callout", L) }), /* @__PURE__ */ o.createElement("div", { className: "k-popover-inner" }, P)) : P
119
+ ));
120
+ }), ne = {
121
+ callout: !0,
122
+ position: "top",
123
+ collision: {
124
+ horizontal: "none",
125
+ vertical: "none"
126
+ }
127
+ };
128
+ v.propTypes = {
129
+ callout: e.bool,
130
+ title: e.node,
131
+ position: e.oneOf(["top", "left", "bottom", "right"]),
132
+ show: e.bool,
133
+ animate: e.oneOfType([
134
+ e.bool,
135
+ e.shape({
136
+ openDuration: e.number,
137
+ closeDuration: e.number
138
+ })
139
+ ]),
140
+ anchor: function(r) {
141
+ const t = r.anchor;
142
+ return t && typeof t.nodeType != "number" ? new Error(
143
+ "Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."
144
+ ) : null;
145
+ },
146
+ appendTo: function(r) {
147
+ const t = r.appendTo;
148
+ return t && typeof t.nodeType != "number" ? new Error(
149
+ "Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."
150
+ ) : null;
151
+ },
152
+ positionMode: e.oneOf([
153
+ "fixed",
154
+ "absolute"
155
+ ]),
156
+ scale: e.number,
157
+ offset: e.shape({
158
+ left: e.number,
159
+ top: e.number
160
+ }),
161
+ children: e.oneOfType([
162
+ e.element,
163
+ e.node
164
+ ]),
165
+ className: e.oneOfType([
166
+ e.string,
167
+ e.arrayOf(e.string),
168
+ e.object
169
+ ]),
170
+ id: e.string,
171
+ popoverClass: e.oneOfType([
172
+ e.string,
173
+ e.arrayOf(e.string),
174
+ e.object
175
+ ]),
176
+ style: e.object,
177
+ onClose: e.func,
178
+ onPosition: e.func,
179
+ onOpen: e.func
180
+ };
181
+ v.defaultProps = ne;
182
+ v.displayName = "KendoReactPopover";
183
+ export {
184
+ v as Popover
185
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common");function s(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const n=s(i),c=n.forwardRef((e,o)=>{const t=n.useRef(null),r=n.useRef(null);return n.useImperativeHandle(r,()=>({props:e,element:t.current})),n.useImperativeHandle(o,()=>r.current),n.createElement("div",{ref:t,className:l.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),u={alignment:"stretched",orientation:"horizontal"};c.propTypes={alignment:a.oneOf(["start","center","end","stretched"]),orientation:a.oneOf(["horizontal","vertical"]),children:a.oneOfType([a.element,a.node])};c.defaultProps=u;c.displayName="KendoReactPopoverActionsBar";exports.PopoverActionsBar=c;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as t from "react";
10
+ import n from "prop-types";
11
+ import { classNames as l } from "@progress/kendo-react-common";
12
+ const o = t.forwardRef((e, i) => {
13
+ const r = t.useRef(null), a = t.useRef(null);
14
+ return t.useImperativeHandle(a, () => ({ props: e, element: r.current })), t.useImperativeHandle(i, () => a.current), /* @__PURE__ */ t.createElement(
15
+ "div",
16
+ {
17
+ ref: r,
18
+ className: l(
19
+ "k-popover-actions",
20
+ "k-actions",
21
+ {
22
+ [`k-actions-${e.alignment}`]: e.alignment,
23
+ [`k-actions-${e.orientation}`]: e.orientation
24
+ }
25
+ )
26
+ },
27
+ e.children
28
+ );
29
+ }), c = {
30
+ alignment: "stretched",
31
+ orientation: "horizontal"
32
+ };
33
+ o.propTypes = {
34
+ alignment: n.oneOf(["start", "center", "end", "stretched"]),
35
+ orientation: n.oneOf(["horizontal", "vertical"]),
36
+ children: n.oneOfType([
37
+ n.element,
38
+ n.node
39
+ ])
40
+ };
41
+ o.defaultProps = c;
42
+ o.displayName = "KendoReactPopoverActionsBar";
43
+ export {
44
+ o as PopoverActionsBar
45
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),f=require("react-dom"),l=require("prop-types"),r=require("@progress/kendo-react-common"),c=require("./utils.js"),g=require("../package-metadata.js");function d(p){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>p[t]})}}return s.default=p,Object.freeze(s)}const n=d(m),E=d(f),v=100,a=class a extends n.PureComponent{constructor(s){super(s),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:e}=this.state,o=e?e.ownerDocument:document;let i=o&&o.elementFromPoint(t.clientX,t.clientY);c.isTooltipElement(i)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const e=t.target;!this.isVisible(e)||c.isTooltipElement(e)||e===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{r.dispatchEvent(this.props.onClose,t,this,void 0),this.setState({targetElement:null,open:!1,title:""})},this.setUpdateInterval=()=>{this.props.updateInterval&&(this.updateIntervalId=setInterval(this.onIntervalUpdate,this.props.updateInterval))},this.onIntervalUpdate=()=>{const t=this.state.targetElement;t&&(t.parentElement===null?this.onClose({target:t}):this.showToolTip({target:t}))},this.position=t=>{let e=c.getDomRect(this.state.targetElement);const o=c.getLeftPosition(this.left,t.offsetWidth,e,this.props.anchorElement,this.props.position),i=c.getTopPosition(this.top,e,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:o,top:i}},this.getTitle=t=>{for(;t;){if(t.getAttribute("title")!==null||t.titleExpando)return{title:t.getAttribute("title")||t.titleExpando,element:t};t=this.props.parentTitle&&t.parentElement||null}return{title:"",element:t}},this.calloutClassName=()=>{switch(this.props.position){case"bottom":return"k-callout k-callout-n";case"left":return"k-callout k-callout-e";case"right":return"k-callout k-callout-w";case"top":return"k-callout k-callout-s";default:return this.top<window.innerHeight/2?"k-callout k-callout-n":"k-callout k-callout-s"}},this.getCurrentZIndex=()=>this.context?this.context:v,r.validatePackage(g.packageMetadata)}componentDidMount(){document&&document.body.addEventListener("mousemove",this.handleBodyMousemove)}componentWillUnmount(){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),document&&document.body.removeEventListener("mousemove",this.handleBodyMousemove)}componentDidUpdate(){this.props.open&&this.props.targetElement&&this.showToolTip({target:this.props.targetElement})}render(){if(this.props.children){const{children:e,...o}=this.props;let i=null;return n.createElement("div",{onMouseOver:h=>{i&&i.handleMouseOver(h)},onMouseOut:h=>{i&&i.handleMouseOut(h)}},n.createElement(a,{ref:h=>i=h,...o}),e)}if(this.props.open===!1)return null;const{targetElement:s}=this.state,t=this.getCurrentZIndex();return s&&this.state.title&&s.ownerDocument&&E.createPortal(n.createElement("div",{ref:e=>{if(!e)return;let o;if(this.props.onPosition){const i={element:e,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};o=this.props.onPosition.call(void 0,i)}else o=this.position(e);e.style.left=o.left+"px",e.style.top=o.top+"px"},className:r.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},n.createElement("div",{className:"k-child-animation-container"},n.createElement("div",{id:this.props.id,role:"tooltip",className:r.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},n.createElement("div",{className:"k-tooltip-content"},this.props.content&&n.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&n.createElement("div",{ref:e=>{e&&(e.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?e.style.left=this.props.setCalloutOnPositionAuto||"25%":e.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:s.ownerDocument.body)}showToolTip(s){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),s.target.hasChildNodes()&&s.target.childNodes.forEach(o=>{o.nodeName==="title"&&(s.target.titleExpando=o.innerHTML,o.remove())});const t=this.props.targetElement||s.target;let e=this.getTitle(t);if(!e.title){this.state.open&&this.onClose(s);return}e.element&&(e.element.titleExpando=e.title,e.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:e.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:e.title},this.setUpdateInterval),this.state.title!==e.title&&r.dispatchEvent(this.props.onOpen,s,this,void 0)}isVisible(s){return!this.props.filter||this.props.filter(s)}};a.propTypes={anchorElement:l.oneOf(["pointer","target"]),content:l.func,filter:l.func,openDelay:l.number,position:l.oneOf(["right","left","top","bottom","auto"]),updateInterval:l.number},a.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1},a.contextType=r.ZIndexContext;let u=a;exports.Tooltip=u;
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as n from "react";
10
+ import * as m from "react-dom";
11
+ import l from "prop-types";
12
+ import { dispatchEvent as p, validatePackage as d, ZIndexContext as f, classNames as h } from "@progress/kendo-react-common";
13
+ import { isTooltipElement as u, getDomRect as g, getLeftPosition as E, getTopPosition as v } from "./utils.mjs";
14
+ import { packageMetadata as I } from "../package-metadata.mjs";
15
+ const T = 100, r = class r extends n.PureComponent {
16
+ constructor(s) {
17
+ super(s), this.context = 0, this.state = {
18
+ targetElement: null,
19
+ open: !1,
20
+ title: ""
21
+ }, this.top = 0, this.left = 0, this.willOpen = !1, this.handleMouseOut = (t) => {
22
+ const { targetElement: e } = this.state, o = e ? e.ownerDocument : document;
23
+ let i = o && o.elementFromPoint(t.clientX, t.clientY);
24
+ u(i) || this.props.open || (clearInterval(this.updateIntervalId), this.willOpen = !1, this.onClose(t));
25
+ }, this.handleMouseOver = (t) => {
26
+ const e = t.target;
27
+ !this.isVisible(e) || u(e) || e === this.state.targetElement || this.showToolTip(t);
28
+ }, this.handleBodyMousemove = (t) => {
29
+ this.top = t.clientY, this.left = t.clientX;
30
+ }, this.onClose = (t) => {
31
+ p(this.props.onClose, t, this, void 0), this.setState({ targetElement: null, open: !1, title: "" });
32
+ }, this.setUpdateInterval = () => {
33
+ this.props.updateInterval && (this.updateIntervalId = setInterval(
34
+ this.onIntervalUpdate,
35
+ this.props.updateInterval
36
+ ));
37
+ }, this.onIntervalUpdate = () => {
38
+ const t = this.state.targetElement;
39
+ t && (t.parentElement === null ? this.onClose({ target: t }) : this.showToolTip({ target: t }));
40
+ }, this.position = (t) => {
41
+ let e = g(this.state.targetElement);
42
+ const o = E(
43
+ this.left,
44
+ t.offsetWidth,
45
+ e,
46
+ this.props.anchorElement,
47
+ this.props.position
48
+ ), i = v(
49
+ this.top,
50
+ e,
51
+ t.offsetHeight,
52
+ this.props.anchorElement,
53
+ this.props.position
54
+ );
55
+ return { left: o, top: i };
56
+ }, this.getTitle = (t) => {
57
+ for (; t; ) {
58
+ if (t.getAttribute("title") !== null || t.titleExpando)
59
+ return { title: t.getAttribute("title") || t.titleExpando, element: t };
60
+ t = this.props.parentTitle && t.parentElement || null;
61
+ }
62
+ return { title: "", element: t };
63
+ }, this.calloutClassName = () => {
64
+ switch (this.props.position) {
65
+ case "bottom":
66
+ return "k-callout k-callout-n";
67
+ case "left":
68
+ return "k-callout k-callout-e";
69
+ case "right":
70
+ return "k-callout k-callout-w";
71
+ case "top":
72
+ return "k-callout k-callout-s";
73
+ default:
74
+ return this.top < window.innerHeight / 2 ? "k-callout k-callout-n" : "k-callout k-callout-s";
75
+ }
76
+ }, this.getCurrentZIndex = () => this.context ? this.context : T, d(I);
77
+ }
78
+ /**
79
+ * @hidden
80
+ */
81
+ componentDidMount() {
82
+ document && document.body.addEventListener("mousemove", this.handleBodyMousemove);
83
+ }
84
+ /**
85
+ * @hidden
86
+ */
87
+ componentWillUnmount() {
88
+ clearTimeout(this.openTimeoutId), clearInterval(this.updateIntervalId), document && document.body.removeEventListener("mousemove", this.handleBodyMousemove);
89
+ }
90
+ /**
91
+ * @hidden
92
+ */
93
+ componentDidUpdate() {
94
+ this.props.open && this.props.targetElement && this.showToolTip({ target: this.props.targetElement });
95
+ }
96
+ /**
97
+ * @hidden
98
+ */
99
+ render() {
100
+ if (this.props.children) {
101
+ const { children: e, ...o } = this.props;
102
+ let i = null;
103
+ return /* @__PURE__ */ n.createElement(
104
+ "div",
105
+ {
106
+ onMouseOver: (a) => {
107
+ i && i.handleMouseOver(a);
108
+ },
109
+ onMouseOut: (a) => {
110
+ i && i.handleMouseOut(a);
111
+ }
112
+ },
113
+ /* @__PURE__ */ n.createElement(r, { ref: (a) => i = a, ...o }),
114
+ e
115
+ );
116
+ }
117
+ if (this.props.open === !1)
118
+ return null;
119
+ const { targetElement: s } = this.state, t = this.getCurrentZIndex();
120
+ return s && this.state.title && s.ownerDocument && m.createPortal(
121
+ /* @__PURE__ */ n.createElement(
122
+ "div",
123
+ {
124
+ ref: (e) => {
125
+ if (!e)
126
+ return;
127
+ let o;
128
+ if (this.props.onPosition) {
129
+ const i = {
130
+ element: e,
131
+ targetElement: this.state.targetElement,
132
+ mouseTop: this.top,
133
+ mouseLeft: this.left,
134
+ anchorElement: this.props.anchorElement,
135
+ position: this.props.position,
136
+ target: this,
137
+ syntheticEvent: null,
138
+ nativeEvent: null
139
+ };
140
+ o = this.props.onPosition.call(void 0, i);
141
+ } else
142
+ o = this.position(e);
143
+ e.style.left = o.left + "px", e.style.top = o.top + "px";
144
+ },
145
+ className: h(
146
+ "k-animation-container",
147
+ "k-animation-container-fixed",
148
+ "k-animation-container-shown",
149
+ this.props.className
150
+ ),
151
+ style: {
152
+ zIndex: t,
153
+ ...this.props.style
154
+ },
155
+ tabIndex: 0
156
+ },
157
+ /* @__PURE__ */ n.createElement("div", { className: "k-child-animation-container" }, /* @__PURE__ */ n.createElement(
158
+ "div",
159
+ {
160
+ id: this.props.id,
161
+ role: "tooltip",
162
+ className: h(
163
+ "k-tooltip",
164
+ this.props.tooltipClassName
165
+ ),
166
+ style: { position: "relative", ...this.props.tooltipStyle }
167
+ },
168
+ /* @__PURE__ */ n.createElement("div", { className: "k-tooltip-content" }, this.props.content && /* @__PURE__ */ n.createElement(this.props.content, { title: this.state.title, target: this.state.targetElement }) || this.state.title),
169
+ this.props.showCallout && /* @__PURE__ */ n.createElement(
170
+ "div",
171
+ {
172
+ ref: (e) => {
173
+ e && (e.className = this.calloutClassName(), this.props.position === "auto" && (this.left < window.screen.availWidth / 2 ? e.style.left = this.props.setCalloutOnPositionAuto || "25%" : e.style.left = this.props.setCalloutOnPositionAuto || "75%"));
174
+ }
175
+ }
176
+ )
177
+ ))
178
+ ),
179
+ this.props.appendTo ? this.props.appendTo : s.ownerDocument.body
180
+ );
181
+ }
182
+ showToolTip(s) {
183
+ clearTimeout(this.openTimeoutId), clearInterval(this.updateIntervalId), s.target.hasChildNodes() && s.target.childNodes.forEach((o) => {
184
+ o.nodeName === "title" && (s.target.titleExpando = o.innerHTML, o.remove());
185
+ });
186
+ const t = this.props.targetElement || s.target;
187
+ let e = this.getTitle(t);
188
+ if (!e.title) {
189
+ this.state.open && this.onClose(s);
190
+ return;
191
+ }
192
+ e.element && (e.element.titleExpando = e.title, e.element.title = ""), this.willOpen = !0, this.props.openDelay ? this.openTimeoutId = window.setTimeout(
193
+ () => {
194
+ this.willOpen && this.setState({ targetElement: t, open: !0, title: e.title }, this.setUpdateInterval);
195
+ },
196
+ this.props.openDelay
197
+ ) : this.setState({ targetElement: t, open: !0, title: e.title }, this.setUpdateInterval), this.state.title !== e.title && p(this.props.onOpen, s, this, void 0);
198
+ }
199
+ isVisible(s) {
200
+ return !this.props.filter || this.props.filter(s);
201
+ }
202
+ };
203
+ r.propTypes = {
204
+ anchorElement: l.oneOf(["pointer", "target"]),
205
+ content: l.func,
206
+ filter: l.func,
207
+ openDelay: l.number,
208
+ position: l.oneOf(["right", "left", "top", "bottom", "auto"]),
209
+ updateInterval: l.number
210
+ }, r.defaultProps = {
211
+ anchorElement: "pointer",
212
+ openDelay: 400,
213
+ position: "auto",
214
+ showCallout: !0,
215
+ parentTitle: !1
216
+ }, r.contextType = f;
217
+ let c = r;
218
+ export {
219
+ c as Tooltip
220
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=10,n=10,p=(i,o,s,r,u)=>{switch(u){case"bottom":return r==="pointer"?i-o/2:s.left-o/2+s.width/2;case"left":return r==="pointer"?i-o-t:s.left-o-t;case"right":return r==="pointer"?i+t:s.right+t;case"top":return r==="pointer"?i-o/2:s.left-o/2+s.width/2;default:return r==="pointer"?i<window.screen.availWidth/2?i-t:i-o+t:i<window.screen.availWidth/2?s.left:s.right-o}},w=(i,o,s,r,u)=>{switch(u){case"bottom":return r==="pointer"?i+n:o.bottom+n;case"left":return r==="pointer"?i-s/2:o.top-s/2+o.height/2;case"right":return r==="pointer"?i-s/2:o.top-s/2+o.height/2;case"top":return r==="pointer"?i-s-n:o.top-s-n;default:return r==="pointer"?i<window.innerHeight/2?i+t:i-s-t:i<window.innerHeight/2?o.bottom+n:o.top-s-n}},d=i=>i!==null?i.getBoundingClientRect():document.body.getBoundingClientRect(),c=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],f=i=>{if(i===null)return!1;let o=i;for(;o;){if(o!==null&&o.classList&&o.classList.contains("k-tooltip"))return!0;o.parentNode!==null?o=o.parentNode:o=!1}return c.filter(s=>s===i.className).length>0};exports.getDomRect=d;exports.getLeftPosition=p;exports.getTopPosition=w;exports.isTooltipElement=f;exports.toolTipSelectors=c;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ const u = (i, o, r, s, t) => {
10
+ switch (t) {
11
+ case "bottom":
12
+ return s === "pointer" ? i - o / 2 : r.left - o / 2 + r.width / 2;
13
+ case "left":
14
+ return s === "pointer" ? i - o - 10 : r.left - o - 10;
15
+ case "right":
16
+ return s === "pointer" ? i + 10 : r.right + 10;
17
+ case "top":
18
+ return s === "pointer" ? i - o / 2 : r.left - o / 2 + r.width / 2;
19
+ default:
20
+ return s === "pointer" ? i < window.screen.availWidth / 2 ? i - 10 : i - o + 10 : i < window.screen.availWidth / 2 ? r.left : r.right - o;
21
+ }
22
+ }, c = (i, o, r, s, t) => {
23
+ switch (t) {
24
+ case "bottom":
25
+ return s === "pointer" ? i + 10 : o.bottom + 10;
26
+ case "left":
27
+ return s === "pointer" ? i - r / 2 : o.top - r / 2 + o.height / 2;
28
+ case "right":
29
+ return s === "pointer" ? i - r / 2 : o.top - r / 2 + o.height / 2;
30
+ case "top":
31
+ return s === "pointer" ? i - r - 10 : o.top - r - 10;
32
+ default:
33
+ return s === "pointer" ? i < window.innerHeight / 2 ? i + 10 : i - r - 10 : i < window.innerHeight / 2 ? o.bottom + 10 : o.top - r - 10;
34
+ }
35
+ }, n = (i) => i !== null ? i.getBoundingClientRect() : document.body.getBoundingClientRect(), w = [
36
+ "k-tooltip-content",
37
+ "k-animation-container",
38
+ "k-tooltip",
39
+ "k-tooltip-title",
40
+ "k-tooltip k-tooltip-closable",
41
+ "k-icon k-i-close"
42
+ ], p = (i) => {
43
+ if (i === null)
44
+ return !1;
45
+ let o = i;
46
+ for (; o; ) {
47
+ if (o !== null && o.classList && o.classList.contains("k-tooltip"))
48
+ return !0;
49
+ o.parentNode !== null ? o = o.parentNode : o = !1;
50
+ }
51
+ return w.filter((r) => r === i.className).length > 0;
52
+ };
53
+ export {
54
+ n as getDomRect,
55
+ u as getLeftPosition,
56
+ c as getTopPosition,
57
+ p as isTooltipElement,
58
+ w as toolTipSelectors
59
+ };
@@ -1,9 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { PackageMetadata } from '@progress/kendo-licensing';
6
- /**
7
- * @hidden
8
- */
9
- export declare const packageMetadata: PackageMetadata;
@@ -1,19 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import { PopoverProps } from './interfaces/PopoverProps';
7
- /**
8
- * Represents the Object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the Popover component.
9
- */
10
- export interface PopoverHandle {
11
- /**
12
- * The props of the Popover.
13
- */
14
- props: PopoverProps;
15
- }
16
- /**
17
- * Represents the Popover component.
18
- */
19
- export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<PopoverHandle | null>>;
@@ -1,23 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import { PopoverActionsBarProps } from './interfaces/PopoverActionsBarProps';
7
- /**
8
- * Represents the Object which is passed to the [`ref`](https://reactjs.org/docs/refs-and-the-dom.html) callback of the PopoverActionBar component.
9
- */
10
- export interface PopoverActionsBarHandle {
11
- /**
12
- * The props of the PopoverActionsBar.
13
- */
14
- props: PopoverActionsBarProps;
15
- /**
16
- * The current element or `null` if there is none.
17
- */
18
- element: HTMLDivElement | null;
19
- }
20
- /**
21
- * Represents the PopoverActionsBar component.
22
- */
23
- export declare const PopoverActionsBar: React.ForwardRefExoticComponent<PopoverActionsBarProps & React.RefAttributes<PopoverActionsBarHandle | null>>;
@@ -1,28 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Align as AlignBase } from '@progress/kendo-react-popup';
6
- /**
7
- * Defines the horizontal and vertical aligning point of the Popup.
8
- */
9
- export interface Align extends AlignBase {
10
- /**
11
- * Defines the possible horizontal point values that are relative to the anchor or the Popup.
12
- *
13
- * The available options are:
14
- * - `left`&mdash;Uses the leftmost point of the anchor element.
15
- * - `center`&mdash;Uses the center point of the anchor element.
16
- * - `right`&mdash;Uses the rightmost point of the anchor element.
17
- */
18
- horizontal: 'left' | 'center' | 'right';
19
- /**
20
- * Defines the possible vertical point values that are relative to the anchor or the Popup.
21
- *
22
- * The available options are:
23
- * - `top`&mdash;Uses the top point of the anchor element.
24
- * - `center`&mdash;Uses the center point of the anchor element.
25
- * - `bottom`&mdash;Uses the bottom point of the anchor element.
26
- */
27
- vertical: 'top' | 'center' | 'bottom';
28
- }
@@ -1,31 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Represents the props of the [KendoReact PopoverActionsBar]({% slug api_tooltip_popoveractionsbar %}) component.
7
- */
8
- export interface PopoverActionsBarProps {
9
- /**
10
- * Sets the horizontal alignment of the PopoverActionsBar buttons.
11
- *
12
- * The possible values are:
13
- * * `start`
14
- * * `center`
15
- * * `end`
16
- * * `stretched` (default)
17
- */
18
- alignment?: string;
19
- /**
20
- * Sets the orientation of the PopoverActionsBar buttons.
21
- *
22
- * The possible values are:
23
- * * `horizontal` (default)
24
- * * `vertical`
25
- */
26
- orientation?: string;
27
- /**
28
- * @hidden
29
- */
30
- children?: React.ReactNode;
31
- }