@progress/kendo-react-tooltip 7.0.0-develop.11 → 7.0.0-develop.12
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.
- package/dist/cdn/js/kendo-react-tooltip.js +1 -1
- package/index.js +1 -1
- package/index.mjs +2 -1
- package/package.json +3 -3
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.KendoReactTooltip={},l.React,l.ReactDOM,l.PropTypes,l.KendoReactCommon,l.KendoReactPopup))})(this,function(l,m,R,z,p,_){"use strict";function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=b(m),L=b(R),n=b(z),u=10,h=10,S=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;case"left":return i==="pointer"?e-t-u:o.left-t-u;case"right":return i==="pointer"?e+u:o.right+u;case"top":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;default:return i==="pointer"?e<window.screen.availWidth/2?e-u:e-t+u:e<window.screen.availWidth/2?o.left:o.right-t}},U=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e+h:t.bottom+h;case"left":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"right":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"top":return i==="pointer"?e-o-h:t.top-o-h;default:return i==="pointer"?e<window.innerHeight/2?e+u:e-o-u:e<window.innerHeight/2?t.bottom+h:t.top-o-h}},j=e=>e!==null?e.getBoundingClientRect():document.body.getBoundingClientRect(),B=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],P=e=>{if(e===null)return!1;let t=e;for(;t;){if(t!==null&&t.classList&&t.classList.contains("k-tooltip"))return!0;t.parentNode!==null?t=t.parentNode:t=!1}return B.filter(o=>o===e.className).length>0},E={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},Z=100,I=class extends s.PureComponent{constructor(e){super(e),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:o}=this.state,i=o?o.ownerDocument:document;let r=i&&i.elementFromPoint(t.clientX,t.clientY);P(r)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const o=t.target;!this.isVisible(o)||P(o)||o===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{p.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 o=j(this.state.targetElement);const i=S(this.left,t.offsetWidth,o,this.props.anchorElement,this.props.position),r=U(this.top,o,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:i,top:r}},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:Z,p.validatePackage(E)}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:o,...i}=this.props;let r=null;return s.createElement("div",{onMouseOver:c=>{r&&r.handleMouseOver(c)},onMouseOut:c=>{r&&r.handleMouseOut(c)}},s.createElement(I,{ref:c=>r=c,...i}),o)}if(this.props.open===!1)return null;const{targetElement:e}=this.state,t=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&L.createPortal(s.createElement("div",{ref:o=>{if(!o)return;let i;if(this.props.onPosition){const r={element:o,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};i=this.props.onPosition.call(void 0,r)}else i=this.position(o);o.style.left=i.left+"px",o.style.top=i.top+"px"},className:p.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:p.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},s.createElement("div",{className:"k-tooltip-content"},this.props.content&&s.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&s.createElement("div",{ref:o=>{o&&(o.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?o.style.left=this.props.setCalloutOnPositionAuto||"25%":o.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(e){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),e.target.hasChildNodes()&&e.target.childNodes.forEach(i=>{i.nodeName==="title"&&(e.target.titleExpando=i.innerHTML,i.remove())});const t=this.props.targetElement||e.target;let o=this.getTitle(t);if(!o.title){this.state.open&&this.onClose(e);return}o.element&&(o.element.titleExpando=o.title,o.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&p.dispatchEvent(this.props.onOpen,e,this,void 0)}isVisible(e){return!this.props.filter||this.props.filter(e)}};let g=I;g.propTypes={anchorElement:n.oneOf(["pointer","target"]),content:n.func,filter:n.func,openDelay:n.number,position:n.oneOf(["right","left","top","bottom","auto"]),updateInterval:n.number},g.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1},g.contextType=p.ZIndexContext;const f=s.forwardRef((e,t)=>{const o=s.useRef(null),i=s.useRef(null);return s.useImperativeHandle(i,()=>({props:e,element:o.current})),s.useImperativeHandle(t,()=>i.current),s.createElement("div",{ref:o,className:p.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),K={alignment:"stretched",orientation:"horizontal"};f.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])},f.defaultProps=K,f.displayName="KendoReactPopoverActionsBar";const F=12e3,V=2e3,N=15,q={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},X={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},H={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},$={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},Y=e=>s.Children.toArray(e).filter(t=>t&&t.type===f),G=e=>s.Children.toArray(e).filter(t=>t&&t.type!==f),y=s.forwardRef((e,t)=>{p.validatePackage(E);const{callout:o,position:i,title:r,children:c,show:Q,anchor:W,appendTo:tt,offset:et,animate:ot,positionMode:nt,scale:it,popoverClass:d,className:st,id:rt,style:lt,collision:at,contentStyle:C,onPosition:w,onClose:O,onOpen:k}=e,[pt,x]=s.useState(!1),D=i==="top"||i==="bottom",ct=e.margin||{vertical:o&&D?N:0,horizontal:o&&!D?N:0},ut=H[i],dt=$[i],A=s.useContext(p.ZIndexContext),ht=A?A+V:F,v=s.useRef(null);s.useImperativeHandle(v,()=>({props:e})),s.useImperativeHandle(t,()=>v.current);const ft=s.useCallback(a=>{if(setTimeout(()=>x(a.flipped)),w){const yt={target:v.current,flipped:a.flipped,fitted:a.fitted};w.call(void 0,yt)}},[w,x]),mt=s.useCallback(()=>{if(k){const a={target:v.current};k.call(void 0,a)}},[k]),vt=s.useCallback(()=>{if(O){const a={target:v.current};O.call(void 0,a)}},[O]),T={"k-popover":!0};Array.isArray(d)?d.forEach(a=>T[a]=!0):typeof d=="object"?Object.keys(d).forEach(a=>{T[a]=d[a]}):d&&(T[d]=!0);const gt=pt?X[i]:q[i],M=s.useMemo(()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:C},G(c)),Y(c)),[c,C,r]);return s.createElement(p.ZIndexContext.Provider,{value:ht},s.createElement(_.Popup,{id:rt,role:"tooltip",animate:ot,collision:at,anchor:W,offset:et,margin:ct,popupAlign:ut,anchorAlign:dt,appendTo:tt,show:Q,scale:it,positionMode:nt,style:lt,className:st,popupClass:T,onOpen:mt,onClose:vt,onPosition:ft},o&&i?s.createElement(s.Fragment,null,s.createElement("div",{className:p.classNames("k-popover-callout",gt)}),s.createElement("div",{className:"k-popover-inner"},M)):M))}),J={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};y.propTypes={callout:n.bool,title:n.node,position:n.oneOf(["top","left","bottom","right"]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),anchor:function(e){const t=e.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(e){const t=e.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popoverClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func},y.defaultProps=J,y.displayName="KendoReactPopover",l.Popover=y,l.PopoverActionsBar=f,l.Tooltip=g,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.KendoReactTooltip={},l.React,l.ReactDOM,l.PropTypes,l.KendoReactCommon,l.KendoReactPopup))})(this,function(l,m,R,z,p,_){"use strict";"use client";function b(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=b(m),L=b(R),n=b(z),u=10,h=10,S=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;case"left":return i==="pointer"?e-t-u:o.left-t-u;case"right":return i==="pointer"?e+u:o.right+u;case"top":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;default:return i==="pointer"?e<window.screen.availWidth/2?e-u:e-t+u:e<window.screen.availWidth/2?o.left:o.right-t}},U=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e+h:t.bottom+h;case"left":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"right":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"top":return i==="pointer"?e-o-h:t.top-o-h;default:return i==="pointer"?e<window.innerHeight/2?e+u:e-o-u:e<window.innerHeight/2?t.bottom+h:t.top-o-h}},j=e=>e!==null?e.getBoundingClientRect():document.body.getBoundingClientRect(),B=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],P=e=>{if(e===null)return!1;let t=e;for(;t;){if(t!==null&&t.classList&&t.classList.contains("k-tooltip"))return!0;t.parentNode!==null?t=t.parentNode:t=!1}return B.filter(o=>o===e.className).length>0},E={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},Z=100,I=class extends s.PureComponent{constructor(e){super(e),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:o}=this.state,i=o?o.ownerDocument:document;let r=i&&i.elementFromPoint(t.clientX,t.clientY);P(r)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const o=t.target;!this.isVisible(o)||P(o)||o===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{p.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 o=j(this.state.targetElement);const i=S(this.left,t.offsetWidth,o,this.props.anchorElement,this.props.position),r=U(this.top,o,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:i,top:r}},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:Z,p.validatePackage(E)}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:o,...i}=this.props;let r=null;return s.createElement("div",{onMouseOver:c=>{r&&r.handleMouseOver(c)},onMouseOut:c=>{r&&r.handleMouseOut(c)}},s.createElement(I,{ref:c=>r=c,...i}),o)}if(this.props.open===!1)return null;const{targetElement:e}=this.state,t=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&L.createPortal(s.createElement("div",{ref:o=>{if(!o)return;let i;if(this.props.onPosition){const r={element:o,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};i=this.props.onPosition.call(void 0,r)}else i=this.position(o);o.style.left=i.left+"px",o.style.top=i.top+"px"},className:p.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:p.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},s.createElement("div",{className:"k-tooltip-content"},this.props.content&&s.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&s.createElement("div",{ref:o=>{o&&(o.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?o.style.left=this.props.setCalloutOnPositionAuto||"25%":o.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(e){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),e.target.hasChildNodes()&&e.target.childNodes.forEach(i=>{i.nodeName==="title"&&(e.target.titleExpando=i.innerHTML,i.remove())});const t=this.props.targetElement||e.target;let o=this.getTitle(t);if(!o.title){this.state.open&&this.onClose(e);return}o.element&&(o.element.titleExpando=o.title,o.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&p.dispatchEvent(this.props.onOpen,e,this,void 0)}isVisible(e){return!this.props.filter||this.props.filter(e)}};let g=I;g.propTypes={anchorElement:n.oneOf(["pointer","target"]),content:n.func,filter:n.func,openDelay:n.number,position:n.oneOf(["right","left","top","bottom","auto"]),updateInterval:n.number},g.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1},g.contextType=p.ZIndexContext;const f=s.forwardRef((e,t)=>{const o=s.useRef(null),i=s.useRef(null);return s.useImperativeHandle(i,()=>({props:e,element:o.current})),s.useImperativeHandle(t,()=>i.current),s.createElement("div",{ref:o,className:p.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),K={alignment:"stretched",orientation:"horizontal"};f.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])},f.defaultProps=K,f.displayName="KendoReactPopoverActionsBar";const F=12e3,V=2e3,N=15,q={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},X={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},H={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},$={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},Y=e=>s.Children.toArray(e).filter(t=>t&&t.type===f),G=e=>s.Children.toArray(e).filter(t=>t&&t.type!==f),y=s.forwardRef((e,t)=>{p.validatePackage(E);const{callout:o,position:i,title:r,children:c,show:Q,anchor:W,appendTo:tt,offset:et,animate:ot,positionMode:nt,scale:it,popoverClass:d,className:st,id:rt,style:lt,collision:at,contentStyle:C,onPosition:w,onClose:O,onOpen:k}=e,[pt,x]=s.useState(!1),D=i==="top"||i==="bottom",ct=e.margin||{vertical:o&&D?N:0,horizontal:o&&!D?N:0},ut=H[i],dt=$[i],A=s.useContext(p.ZIndexContext),ht=A?A+V:F,v=s.useRef(null);s.useImperativeHandle(v,()=>({props:e})),s.useImperativeHandle(t,()=>v.current);const ft=s.useCallback(a=>{if(setTimeout(()=>x(a.flipped)),w){const yt={target:v.current,flipped:a.flipped,fitted:a.fitted};w.call(void 0,yt)}},[w,x]),mt=s.useCallback(()=>{if(k){const a={target:v.current};k.call(void 0,a)}},[k]),vt=s.useCallback(()=>{if(O){const a={target:v.current};O.call(void 0,a)}},[O]),T={"k-popover":!0};Array.isArray(d)?d.forEach(a=>T[a]=!0):typeof d=="object"?Object.keys(d).forEach(a=>{T[a]=d[a]}):d&&(T[d]=!0);const gt=pt?X[i]:q[i],M=s.useMemo(()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:C},G(c)),Y(c)),[c,C,r]);return s.createElement(p.ZIndexContext.Provider,{value:ht},s.createElement(_.Popup,{id:rt,role:"tooltip",animate:ot,collision:at,anchor:W,offset:et,margin:ct,popupAlign:ut,anchorAlign:dt,appendTo:tt,show:Q,scale:it,positionMode:nt,style:lt,className:st,popupClass:T,onOpen:mt,onClose:vt,onPosition:ft},o&&i?s.createElement(s.Fragment,null,s.createElement("div",{className:p.classNames("k-popover-callout",gt)}),s.createElement("div",{className:"k-popover-inner"},M)):M))}),J={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};y.propTypes={callout:n.bool,title:n.node,position:n.oneOf(["top","left","bottom","right"]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),anchor:function(e){const t=e.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(e){const t=e.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popoverClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func},y.defaultProps=J,y.displayName="KendoReactPopover",l.Popover=y,l.PopoverActionsBar=f,l.Tooltip=g,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("react"),W=require("react-dom"),tt=require("prop-types"),a=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup");function T(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=T(Q),ot=T(W),n=T(tt),c=10,h=10,nt=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;case"left":return i==="pointer"?e-t-c:o.left-t-c;case"right":return i==="pointer"?e+c:o.right+c;case"top":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;default:return i==="pointer"?e<window.screen.availWidth/2?e-c:e-t+c:e<window.screen.availWidth/2?o.left:o.right-t}},it=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e+h:t.bottom+h;case"left":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"right":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"top":return i==="pointer"?e-o-h:t.top-o-h;default:return i==="pointer"?e<window.innerHeight/2?e+c:e-o-c:e<window.innerHeight/2?t.bottom+h:t.top-o-h}},st=e=>e!==null?e.getBoundingClientRect():document.body.getBoundingClientRect(),rt=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],I=e=>{if(e===null)return!1;let t=e;for(;t;){if(t!==null&&t.classList&&t.classList.contains("k-tooltip"))return!0;t.parentNode!==null?t=t.parentNode:t=!1}return rt.filter(o=>o===e.className).length>0},x={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},lt=100,R=class extends s.PureComponent{constructor(e){super(e),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:o}=this.state,i=o?o.ownerDocument:document;let r=i&&i.elementFromPoint(t.clientX,t.clientY);I(r)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const o=t.target;!this.isVisible(o)||I(o)||o===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{a.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 o=st(this.state.targetElement);const i=nt(this.left,t.offsetWidth,o,this.props.anchorElement,this.props.position),r=it(this.top,o,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:i,top:r}},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:lt,a.validatePackage(x)}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:o,...i}=this.props;let r=null;return s.createElement("div",{onMouseOver:p=>{r&&r.handleMouseOver(p)},onMouseOut:p=>{r&&r.handleMouseOut(p)}},s.createElement(R,{ref:p=>r=p,...i}),o)}if(this.props.open===!1)return null;const{targetElement:e}=this.state,t=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&ot.createPortal(s.createElement("div",{ref:o=>{if(!o)return;let i;if(this.props.onPosition){const r={element:o,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};i=this.props.onPosition.call(void 0,r)}else i=this.position(o);o.style.left=i.left+"px",o.style.top=i.top+"px"},className:a.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:a.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},s.createElement("div",{className:"k-tooltip-content"},this.props.content&&s.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&s.createElement("div",{ref:o=>{o&&(o.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?o.style.left=this.props.setCalloutOnPositionAuto||"25%":o.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(e){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),e.target.hasChildNodes()&&e.target.childNodes.forEach(i=>{i.nodeName==="title"&&(e.target.titleExpando=i.innerHTML,i.remove())});const t=this.props.targetElement||e.target;let o=this.getTitle(t);if(!o.title){this.state.open&&this.onClose(e);return}o.element&&(o.element.titleExpando=o.title,o.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&a.dispatchEvent(this.props.onOpen,e,this,void 0)}isVisible(e){return!this.props.filter||this.props.filter(e)}};let v=R;v.propTypes={anchorElement:n.oneOf(["pointer","target"]),content:n.func,filter:n.func,openDelay:n.number,position:n.oneOf(["right","left","top","bottom","auto"]),updateInterval:n.number};v.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1};v.contextType=a.ZIndexContext;const d=s.forwardRef((e,t)=>{const o=s.useRef(null),i=s.useRef(null);return s.useImperativeHandle(i,()=>({props:e,element:o.current})),s.useImperativeHandle(t,()=>i.current),s.createElement("div",{ref:o,className:a.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),at={alignment:"stretched",orientation:"horizontal"};d.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])};d.defaultProps=at;d.displayName="KendoReactPopoverActionsBar";const pt=12e3,ct=2e3,N=15,ut={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},ht={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},dt={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},ft={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},mt=e=>s.Children.toArray(e).filter(t=>t&&t.type===d),vt=e=>s.Children.toArray(e).filter(t=>t&&t.type!==d),g=s.forwardRef((e,t)=>{a.validatePackage(x);const{callout:o,position:i,title:r,children:p,show:D,anchor:A,appendTo:M,offset:z,animate:_,positionMode:L,scale:S,popoverClass:u,className:U,id:B,style:Z,collision:j,contentStyle:w,onPosition:y,onClose:b,onOpen:k}=e,[F,O]=s.useState(!1),P=i==="top"||i==="bottom",K=e.margin||{vertical:o&&P?N:0,horizontal:o&&!P?N:0},V=dt[i],q=ft[i],E=s.useContext(a.ZIndexContext),X=E?E+ct:pt,f=s.useRef(null);s.useImperativeHandle(f,()=>({props:e})),s.useImperativeHandle(t,()=>f.current);const H=s.useCallback(l=>{if(setTimeout(()=>O(l.flipped)),y){const J={target:f.current,flipped:l.flipped,fitted:l.fitted};y.call(void 0,J)}},[y,O]),$=s.useCallback(()=>{if(k){const l={target:f.current};k.call(void 0,l)}},[k]),Y=s.useCallback(()=>{if(b){const l={target:f.current};b.call(void 0,l)}},[b]),m={"k-popover":!0};Array.isArray(u)?u.forEach(l=>m[l]=!0):typeof u=="object"?Object.keys(u).forEach(l=>{m[l]=u[l]}):u&&(m[u]=!0);const G=F?ht[i]:ut[i],C=s.useMemo(()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:w},vt(p)),mt(p)),[p,w,r]);return s.createElement(a.ZIndexContext.Provider,{value:X},s.createElement(et.Popup,{id:B,role:"tooltip",animate:_,collision:j,anchor:A,offset:z,margin:K,popupAlign:V,anchorAlign:q,appendTo:M,show:D,scale:S,positionMode:L,style:Z,className:U,popupClass:m,onOpen:$,onClose:Y,onPosition:H},o&&i?s.createElement(s.Fragment,null,s.createElement("div",{className:a.classNames("k-popover-callout",G)}),s.createElement("div",{className:"k-popover-inner"},C)):C))}),gt={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};g.propTypes={callout:n.bool,title:n.node,position:n.oneOf(["top","left","bottom","right"]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),anchor:function(e){const t=e.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(e){const t=e.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popoverClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func};g.defaultProps=gt;g.displayName="KendoReactPopover";exports.Popover=g;exports.PopoverActionsBar=d;exports.Tooltip=v;
|
|
5
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("react"),W=require("react-dom"),tt=require("prop-types"),a=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup");function T(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=T(Q),ot=T(W),n=T(tt),c=10,h=10,nt=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;case"left":return i==="pointer"?e-t-c:o.left-t-c;case"right":return i==="pointer"?e+c:o.right+c;case"top":return i==="pointer"?e-t/2:o.left-t/2+o.width/2;default:return i==="pointer"?e<window.screen.availWidth/2?e-c:e-t+c:e<window.screen.availWidth/2?o.left:o.right-t}},it=(e,t,o,i,r)=>{switch(r){case"bottom":return i==="pointer"?e+h:t.bottom+h;case"left":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"right":return i==="pointer"?e-o/2:t.top-o/2+t.height/2;case"top":return i==="pointer"?e-o-h:t.top-o-h;default:return i==="pointer"?e<window.innerHeight/2?e+c:e-o-c:e<window.innerHeight/2?t.bottom+h:t.top-o-h}},st=e=>e!==null?e.getBoundingClientRect():document.body.getBoundingClientRect(),rt=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],I=e=>{if(e===null)return!1;let t=e;for(;t;){if(t!==null&&t.classList&&t.classList.contains("k-tooltip"))return!0;t.parentNode!==null?t=t.parentNode:t=!1}return rt.filter(o=>o===e.className).length>0},x={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},lt=100,R=class extends s.PureComponent{constructor(e){super(e),this.context=0,this.state={targetElement:null,open:!1,title:""},this.top=0,this.left=0,this.willOpen=!1,this.handleMouseOut=t=>{const{targetElement:o}=this.state,i=o?o.ownerDocument:document;let r=i&&i.elementFromPoint(t.clientX,t.clientY);I(r)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const o=t.target;!this.isVisible(o)||I(o)||o===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{a.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 o=st(this.state.targetElement);const i=nt(this.left,t.offsetWidth,o,this.props.anchorElement,this.props.position),r=it(this.top,o,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:i,top:r}},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:lt,a.validatePackage(x)}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:o,...i}=this.props;let r=null;return s.createElement("div",{onMouseOver:p=>{r&&r.handleMouseOver(p)},onMouseOut:p=>{r&&r.handleMouseOut(p)}},s.createElement(R,{ref:p=>r=p,...i}),o)}if(this.props.open===!1)return null;const{targetElement:e}=this.state,t=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&ot.createPortal(s.createElement("div",{ref:o=>{if(!o)return;let i;if(this.props.onPosition){const r={element:o,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};i=this.props.onPosition.call(void 0,r)}else i=this.position(o);o.style.left=i.left+"px",o.style.top=i.top+"px"},className:a.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:t,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:a.classNames("k-tooltip",this.props.tooltipClassName),style:{position:"relative",...this.props.tooltipStyle}},s.createElement("div",{className:"k-tooltip-content"},this.props.content&&s.createElement(this.props.content,{title:this.state.title,target:this.state.targetElement})||this.state.title),this.props.showCallout&&s.createElement("div",{ref:o=>{o&&(o.className=this.calloutClassName(),this.props.position==="auto"&&(this.left<window.screen.availWidth/2?o.style.left=this.props.setCalloutOnPositionAuto||"25%":o.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(e){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),e.target.hasChildNodes()&&e.target.childNodes.forEach(i=>{i.nodeName==="title"&&(e.target.titleExpando=i.innerHTML,i.remove())});const t=this.props.targetElement||e.target;let o=this.getTitle(t);if(!o.title){this.state.open&&this.onClose(e);return}o.element&&(o.element.titleExpando=o.title,o.element.title=""),this.willOpen=!0,this.props.openDelay?this.openTimeoutId=window.setTimeout(()=>{this.willOpen&&this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval)},this.props.openDelay):this.setState({targetElement:t,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&a.dispatchEvent(this.props.onOpen,e,this,void 0)}isVisible(e){return!this.props.filter||this.props.filter(e)}};let v=R;v.propTypes={anchorElement:n.oneOf(["pointer","target"]),content:n.func,filter:n.func,openDelay:n.number,position:n.oneOf(["right","left","top","bottom","auto"]),updateInterval:n.number};v.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1};v.contextType=a.ZIndexContext;const d=s.forwardRef((e,t)=>{const o=s.useRef(null),i=s.useRef(null);return s.useImperativeHandle(i,()=>({props:e,element:o.current})),s.useImperativeHandle(t,()=>i.current),s.createElement("div",{ref:o,className:a.classNames("k-popover-actions","k-actions",{[`k-actions-${e.alignment}`]:e.alignment,[`k-actions-${e.orientation}`]:e.orientation})},e.children)}),at={alignment:"stretched",orientation:"horizontal"};d.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])};d.defaultProps=at;d.displayName="KendoReactPopoverActionsBar";const pt=12e3,ct=2e3,N=15,ut={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},ht={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},dt={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},ft={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},mt=e=>s.Children.toArray(e).filter(t=>t&&t.type===d),vt=e=>s.Children.toArray(e).filter(t=>t&&t.type!==d),g=s.forwardRef((e,t)=>{a.validatePackage(x);const{callout:o,position:i,title:r,children:p,show:D,anchor:A,appendTo:M,offset:z,animate:_,positionMode:L,scale:S,popoverClass:u,className:U,id:B,style:Z,collision:j,contentStyle:w,onPosition:y,onClose:b,onOpen:k}=e,[F,O]=s.useState(!1),P=i==="top"||i==="bottom",K=e.margin||{vertical:o&&P?N:0,horizontal:o&&!P?N:0},V=dt[i],q=ft[i],E=s.useContext(a.ZIndexContext),X=E?E+ct:pt,f=s.useRef(null);s.useImperativeHandle(f,()=>({props:e})),s.useImperativeHandle(t,()=>f.current);const H=s.useCallback(l=>{if(setTimeout(()=>O(l.flipped)),y){const J={target:f.current,flipped:l.flipped,fitted:l.fitted};y.call(void 0,J)}},[y,O]),$=s.useCallback(()=>{if(k){const l={target:f.current};k.call(void 0,l)}},[k]),Y=s.useCallback(()=>{if(b){const l={target:f.current};b.call(void 0,l)}},[b]),m={"k-popover":!0};Array.isArray(u)?u.forEach(l=>m[l]=!0):typeof u=="object"?Object.keys(u).forEach(l=>{m[l]=u[l]}):u&&(m[u]=!0);const G=F?ht[i]:ut[i],C=s.useMemo(()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:w},vt(p)),mt(p)),[p,w,r]);return s.createElement(a.ZIndexContext.Provider,{value:X},s.createElement(et.Popup,{id:B,role:"tooltip",animate:_,collision:j,anchor:A,offset:z,margin:K,popupAlign:V,anchorAlign:q,appendTo:M,show:D,scale:S,positionMode:L,style:Z,className:U,popupClass:m,onOpen:$,onClose:Y,onPosition:H},o&&i?s.createElement(s.Fragment,null,s.createElement("div",{className:a.classNames("k-popover-callout",G)}),s.createElement("div",{className:"k-popover-inner"},C)):C))}),gt={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};g.propTypes={callout:n.bool,title:n.node,position:n.oneOf(["top","left","bottom","right"]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),anchor:function(e){const t=e.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(e){const t=e.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popoverClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func};g.defaultProps=gt;g.displayName="KendoReactPopover";exports.Popover=g;exports.PopoverActionsBar=d;exports.Tooltip=v;
|
package/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
"use client";
|
|
5
6
|
import * as s from "react";
|
|
6
7
|
import * as tt from "react-dom";
|
|
7
8
|
import * as n from "prop-types";
|
|
@@ -54,7 +55,7 @@ const p = 10, u = 10, ot = (o, t, e, i, r) => {
|
|
|
54
55
|
name: "@progress/kendo-react-tooltip",
|
|
55
56
|
productName: "KendoReact",
|
|
56
57
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
57
|
-
publishDate:
|
|
58
|
+
publishDate: 1701866539,
|
|
58
59
|
version: "",
|
|
59
60
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
60
61
|
}, rt = 100, A = class extends s.PureComponent {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-tooltip",
|
|
3
|
-
"version": "7.0.0-develop.
|
|
3
|
+
"version": "7.0.0-develop.12",
|
|
4
4
|
"description": "React Tooltips library represents popups with information that is related to a UI element. KendoReact Tooltips package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"sideEffects": false,
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@progress/kendo-licensing": "^1.3.0",
|
|
20
|
-
"@progress/kendo-react-common": "7.0.0-develop.
|
|
21
|
-
"@progress/kendo-react-popup": "7.0.0-develop.
|
|
20
|
+
"@progress/kendo-react-common": "7.0.0-develop.12",
|
|
21
|
+
"@progress/kendo-react-popup": "7.0.0-develop.12",
|
|
22
22
|
"@progress/kendo-svg-icons": "^2.0.0",
|
|
23
23
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
24
24
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|