New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@progress/kendo-react-tooltip

Package Overview
Dependencies
Maintainers
1
Versions
1210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progress/kendo-react-tooltip - npm Package Compare versions

Comparing version 8.2.0-develop.33 to 8.2.0-develop.34

popover/utils.js

2

dist/cdn/js/kendo-react-tooltip.js

@@ -8,2 +8,2 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactTooltip={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoReactPopup)}(this,(function(t,e,o,n,i,l){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var s=r(e),a=r(o);const p=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],c=t=>{if(null===t)return!1;let e=t;for(;e;){if(null!==e&&e.classList&&e.classList.contains("k-tooltip"))return!0;e=null!==e.parentNode&&e.parentNode}return p.filter((e=>e===t.className)).length>0},u={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},h=class t extends s.PureComponent{constructor(t){super(t),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 n=o&&o.elementFromPoint(t.clientX,t.clientY);c(n)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const e=t.target;!this.isVisible(e)||c(e)||e===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{i.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&&(null===t.parentElement?this.onClose({target:t}):this.showToolTip({target:t}))},this.position=t=>{let e=(t=>null!==t?t.getBoundingClientRect():document.body.getBoundingClientRect())(this.state.targetElement);const o=((t,e,o,n,i)=>{switch(i){case"bottom":case"top":return"pointer"===n?t-e/2:o.left-e/2+o.width/2;case"left":return"pointer"===n?t-e-10:o.left-e-10;case"right":return"pointer"===n?t+10:o.right+10;default:return"pointer"===n?t<window.screen.availWidth/2?t-10:t-e+10:t<window.screen.availWidth/2?o.left:o.right-e}})(this.left,t.offsetWidth,e,this.props.anchorElement,this.props.position),n=((t,e,o,n,i)=>{switch(i){case"bottom":return"pointer"===n?t+10:e.bottom+10;case"left":case"right":return"pointer"===n?t-o/2:e.top-o/2+e.height/2;case"top":return"pointer"===n?t-o-10:e.top-o-10;default:return"pointer"===n?t<window.innerHeight/2?t+10:t-o-10:t<window.innerHeight/2?e.bottom+10:e.top-o-10}})(this.top,e,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:o,top:n}},this.getTitle=t=>{for(;t;){if(null!==t.getAttribute("title")||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:100,i.validatePackage(u)}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 n=null;return s.createElement("div",{onMouseOver:t=>{n&&n.handleMouseOver(t)},onMouseOut:t=>{n&&n.handleMouseOut(t)}},s.createElement(t,{ref:t=>n=t,...o}),e)}if(!1===this.props.open)return null;const{targetElement:e}=this.state,o=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&a.createPortal(s.createElement("div",{ref:t=>{if(!t)return;let e;if(this.props.onPosition){const o={element:t,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};e=this.props.onPosition.call(void 0,o)}else e=this.position(t);t.style.left=e.left+"px",t.style.top=e.top+"px"},className:i.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:o,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:i.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:t=>{t&&(t.className=this.calloutClassName(),"auto"===this.props.position&&(this.left<window.screen.availWidth/2?t.style.left=this.props.setCalloutOnPositionAuto||"25%":t.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(t){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),t.target.hasChildNodes()&&t.target.childNodes.forEach((e=>{"title"===e.nodeName&&(t.target.titleExpando=e.innerHTML,e.remove())}));const e=this.props.targetElement||t.target;let o=this.getTitle(e);o.title?(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:e,open:!0,title:o.title},this.setUpdateInterval)}),this.props.openDelay):this.setState({targetElement:e,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&i.dispatchEvent(this.props.onOpen,t,this,void 0)):this.state.open&&this.onClose(t)}isVisible(t){return!this.props.filter||this.props.filter(t)}};h.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},h.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1},h.contextType=i.ZIndexContext;let d=h;const m=s.forwardRef(((t,e)=>{const o=s.useRef(null),n=s.useRef(null),{alignment:l=f.alignment,orientation:r=f.orientation}=t;return s.useImperativeHandle(n,(()=>({props:t,element:o.current}))),s.useImperativeHandle(e,(()=>n.current)),s.createElement("div",{ref:o,className:i.classNames("k-popover-actions","k-actions",{[`k-actions-${l}`]:l,[`k-actions-${r}`]:r})},t.children)})),f={alignment:"stretched",orientation:"horizontal"};m.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])},m.displayName="KendoReactPopoverActionsBar";const v={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},g={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},y={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},E={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},k=t=>s.Children.toArray(t).filter((t=>t&&t.type===m)),b=t=>s.Children.toArray(t).filter((t=>t&&t.type!==m)),w=s.forwardRef(((t,e)=>{i.validatePackage(u);const{callout:o=T.callout,position:n=T.position,collision:r=T.collision,title:a,children:p,show:c,anchor:h,appendTo:d,offset:m,animate:f,positionMode:w,scale:O,popoverClass:I,className:C,id:N,style:x,contentStyle:P,onPosition:R,onClose:D,onOpen:M}=t,[z,A]=s.useState(!1),j="top"===n||"bottom"===n,K=t.margin||{vertical:o&&j?15:0,horizontal:o&&!j?15:0},U=y[n],H=E[n],B=s.useContext(i.ZIndexContext),L=B?B+2e3:12e3,S=s.useRef(null);s.useImperativeHandle(S,(()=>({props:t}))),s.useImperativeHandle(e,(()=>S.current));const q=s.useCallback((t=>{if(setTimeout((()=>A(t.flipped))),R){const e={target:S.current,flipped:t.flipped,fitted:t.fitted};R.call(void 0,e)}}),[R,A]),W=s.useCallback((()=>{if(M){const t={target:S.current};M.call(void 0,t)}}),[M]),Z=s.useCallback((()=>{if(D){const t={target:S.current};D.call(void 0,t)}}),[D]),V={"k-popover":!0};Array.isArray(I)?I.forEach((t=>V[t]=!0)):"object"==typeof I?Object.keys(I).forEach((t=>{V[t]=I[t]})):I&&(V[I]=!0);const F=z?g[n]:v[n],X=s.useMemo((()=>s.createElement(s.Fragment,null,a&&s.createElement("div",{className:"k-popover-header"},a),s.createElement("div",{className:"k-popover-body",style:P},b(p)),k(p))),[p,P,a]);return s.createElement(i.ZIndexContext.Provider,{value:L},s.createElement(l.Popup,{id:N,role:"tooltip",animate:f,collision:r,anchor:h,offset:m,margin:K,popupAlign:U,anchorAlign:H,appendTo:d,show:c,scale:O,positionMode:w,style:x,className:C,popupClass:V,onOpen:W,onClose:Z,onPosition:q},o&&n?s.createElement(s.Fragment,null,s.createElement("div",{className:i.classNames("k-popover-callout",F)}),s.createElement("div",{className:"k-popover-inner"},X)):X))})),T={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};w.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(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(t){const e=t.appendTo;return e&&"number"!=typeof e.nodeType?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},w.displayName="KendoReactPopover",t.Popover=w,t.PopoverActionsBar=m,t.Tooltip=d}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactTooltip={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoReactPopup)}(this,(function(t,e,o,n,i,r){"use strict";function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var s=l(e),a=l(o);const p=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-close"],c=t=>{if(null===t)return!1;let e=t;for(;e;){if(null!==e&&e.classList&&e.classList.contains("k-tooltip"))return!0;e=null!==e.parentNode&&e.parentNode}return p.filter((e=>e===t.className)).length>0},u={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},h=class t extends s.PureComponent{constructor(t){super(t),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 n=o&&o.elementFromPoint(t.clientX,t.clientY);c(n)||this.props.open||(clearInterval(this.updateIntervalId),this.willOpen=!1,this.onClose(t))},this.handleMouseOver=t=>{const e=t.target;!this.isVisible(e)||c(e)||e===this.state.targetElement||this.showToolTip(t)},this.handleBodyMousemove=t=>{this.top=t.clientY,this.left=t.clientX},this.onClose=t=>{i.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&&(null===t.parentElement?this.onClose({target:t}):this.showToolTip({target:t}))},this.position=t=>{let e=(t=>null!==t?t.getBoundingClientRect():document.body.getBoundingClientRect())(this.state.targetElement);const o=((t,e,o,n,i)=>{switch(i){case"bottom":case"top":return"pointer"===n?t-e/2:o.left-e/2+o.width/2;case"left":return"pointer"===n?t-e-10:o.left-e-10;case"right":return"pointer"===n?t+10:o.right+10;default:return"pointer"===n?t<window.screen.availWidth/2?t-10:t-e+10:t<window.screen.availWidth/2?o.left:o.right-e}})(this.left,t.offsetWidth,e,this.props.anchorElement,this.props.position),n=((t,e,o,n,i)=>{switch(i){case"bottom":return"pointer"===n?t+10:e.bottom+10;case"left":case"right":return"pointer"===n?t-o/2:e.top-o/2+e.height/2;case"top":return"pointer"===n?t-o-10:e.top-o-10;default:return"pointer"===n?t<window.innerHeight/2?t+10:t-o-10:t<window.innerHeight/2?e.bottom+10:e.top-o-10}})(this.top,e,t.offsetHeight,this.props.anchorElement,this.props.position);return{left:o,top:n}},this.getTitle=t=>{for(;t;){if(null!==t.getAttribute("title")||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:100,i.validatePackage(u)}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 n=null;return s.createElement("div",{onMouseOver:t=>{n&&n.handleMouseOver(t)},onMouseOut:t=>{n&&n.handleMouseOut(t)}},s.createElement(t,{ref:t=>n=t,...o}),e)}if(!1===this.props.open)return null;const{targetElement:e}=this.state,o=this.getCurrentZIndex();return e&&this.state.title&&e.ownerDocument&&a.createPortal(s.createElement("div",{ref:t=>{if(!t)return;let e;if(this.props.onPosition){const o={element:t,targetElement:this.state.targetElement,mouseTop:this.top,mouseLeft:this.left,anchorElement:this.props.anchorElement,position:this.props.position,target:this,syntheticEvent:null,nativeEvent:null};e=this.props.onPosition.call(void 0,o)}else e=this.position(t);t.style.left=e.left+"px",t.style.top=e.top+"px"},className:i.classNames("k-animation-container","k-animation-container-fixed","k-animation-container-shown",this.props.className),style:{zIndex:o,...this.props.style},tabIndex:0},s.createElement("div",{className:"k-child-animation-container"},s.createElement("div",{id:this.props.id,role:"tooltip",className:i.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:t=>{t&&(t.className=this.calloutClassName(),"auto"===this.props.position&&(this.left<window.screen.availWidth/2?t.style.left=this.props.setCalloutOnPositionAuto||"25%":t.style.left=this.props.setCalloutOnPositionAuto||"75%"))}})))),this.props.appendTo?this.props.appendTo:e.ownerDocument.body)}showToolTip(t){clearTimeout(this.openTimeoutId),clearInterval(this.updateIntervalId),t.target.hasChildNodes()&&t.target.childNodes.forEach((e=>{"title"===e.nodeName&&(t.target.titleExpando=e.innerHTML,e.remove())}));const e=this.props.targetElement||t.target;let o=this.getTitle(e);o.title?(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:e,open:!0,title:o.title},this.setUpdateInterval)}),this.props.openDelay):this.setState({targetElement:e,open:!0,title:o.title},this.setUpdateInterval),this.state.title!==o.title&&i.dispatchEvent(this.props.onOpen,t,this,void 0)):this.state.open&&this.onClose(t)}isVisible(t){return!this.props.filter||this.props.filter(t)}};h.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},h.defaultProps={anchorElement:"pointer",openDelay:400,position:"auto",showCallout:!0,parentTitle:!1},h.contextType=i.ZIndexContext;let d=h;const m=s.forwardRef(((t,e)=>{const o=s.useRef(null),n=s.useRef(null),{alignment:r=f.alignment,orientation:l=f.orientation}=t;return s.useImperativeHandle(n,(()=>({props:t,element:o.current}))),s.useImperativeHandle(e,(()=>n.current)),s.createElement("div",{ref:o,className:i.classNames("k-popover-actions","k-actions",{[`k-actions-${r}`]:r,[`k-actions-${l}`]:l})},t.children)})),f={alignment:"stretched",orientation:"horizontal"};m.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])},m.displayName="KendoReactPopoverActionsBar";const v=t=>{if(t){const e=t.querySelectorAll(i.FOCUSABLE_ELEMENTS.join(", "));if(e.length)return e[0]}},g=t=>{const e=v(document.querySelector(".k-popover-inner")),o=(t=>{if(t){const e=t.querySelectorAll(i.FOCUSABLE_ELEMENTS.join(", "));if(e.length)return e[e.length-1]}})(document.querySelector(".k-popover-inner"));t.shiftKey&&t.target===e?(o&&o.focus(),t.preventDefault()):!t.shiftKey&&t.target===o&&(e&&e.focus(),t.preventDefault())},y={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},E={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},k={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},b={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},w=t=>s.Children.toArray(t).filter((t=>t&&t.type===m)),T=t=>s.Children.toArray(t).filter((t=>t&&t.type!==m)),O=s.forwardRef(((t,e)=>{i.validatePackage(u);const{callout:o=C.callout,position:n=C.position,collision:l=C.collision,title:a,children:p,show:c,anchor:h,appendTo:d,offset:m,animate:f,positionMode:O,scale:I,popoverClass:N,className:x,id:P,style:D,contentStyle:M,onPosition:R,onClose:A,onOpen:S,onKeyDown:z}=t,[K,j]=s.useState(!1),U="top"===n||"bottom"===n,L=t.margin||{vertical:o&&U?15:0,horizontal:o&&!U?15:0},q=k[n],B=b[n],H=s.useContext(i.ZIndexContext),F=H?H+2e3:12e3,W=s.useRef(null);s.useImperativeHandle(W,(()=>({props:t}))),s.useImperativeHandle(e,(()=>W.current));const Z=s.useCallback((t=>{if(setTimeout((()=>j(t.flipped))),R){const e={target:W.current,flipped:t.flipped,fitted:t.fitted};R.call(void 0,e)}}),[R,j]),V=s.useCallback((()=>{const t=v(document.querySelector(".k-popover-inner"));if(t&&t.focus(),S){const t={target:W.current};S.call(void 0,t)}}),[S]),X=s.useCallback((t=>{if(z&&"Escape"===t.key){const t={target:W.current,show:!1};z.call(void 0,t)}"Tab"===t.key&&g(t)}),[z]),Y=s.useCallback((t=>{if(A){const t={target:W.current};A.call(void 0,t)}t&&t.target&&t.target.props&&t.target.props.anchor&&t.target.props.anchor.focus()}),[A]),$={"k-popover":!0};Array.isArray(N)?N.forEach((t=>$[t]=!0)):"object"==typeof N?Object.keys(N).forEach((t=>{$[t]=N[t]})):N&&($[N]=!0);const _=K?E[n]:y[n],G=s.useMemo((()=>s.createElement(s.Fragment,null,a&&s.createElement("div",{className:"k-popover-header"},a),s.createElement("div",{className:"k-popover-body",style:M},T(p)),w(p))),[p,M,a]);return s.createElement(i.ZIndexContext.Provider,{value:F},s.createElement(r.Popup,{id:P,role:"tooltip",animate:f,collision:l,anchor:h,offset:m,margin:L,popupAlign:q,anchorAlign:B,appendTo:d,show:c,scale:I,positionMode:O,style:D,className:x,popupClass:$,onOpen:V,onClose:Y,onPosition:Z,onKeyDown:X},o&&n?s.createElement(s.Fragment,null,s.createElement("div",{className:i.classNames("k-popover-callout",_)}),s.createElement("div",{className:"k-popover-inner"},G)):G))})),C={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};O.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(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(t){const e=t.appendTo;return e&&"number"!=typeof e.nodeType?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},O.displayName="KendoReactPopover",t.Popover=O,t.PopoverActionsBar=m,t.Tooltip=d}));

@@ -123,2 +123,16 @@ /**

/**
* Represents the object of the `KeyDown` Popover event.
*/
export declare interface PopoverKeyDownEvent {
/**
* An event target.
*/
target: PopoverHandle;
/**
* A boolean value that indicates whether the Popover is visible.
*/
show?: boolean;
}
/**
* Defines the horizontal and the vertical margin offset of the component.

@@ -292,2 +306,6 @@ */

/**
* Fires when the Popover is focused and a key is pressed.
*/
onKeyDown?: (event: PopoverKeyDownEvent) => void;
/**
* @hidden

@@ -294,0 +312,0 @@ */

{
"name": "@progress/kendo-react-tooltip",
"version": "8.2.0-develop.33",
"version": "8.2.0-develop.34",
"description": "React Tooltips library represents popups with information that is related to a UI element. KendoReact Tooltips package",

@@ -26,4 +26,4 @@ "author": "Progress",

"@progress/kendo-licensing": "^1.3.4",
"@progress/kendo-react-common": "8.2.0-develop.33",
"@progress/kendo-react-popup": "8.2.0-develop.33",
"@progress/kendo-react-common": "8.2.0-develop.34",
"@progress/kendo-react-popup": "8.2.0-develop.34",
"@progress/kendo-svg-icons": "^3.0.0",

@@ -30,0 +30,0 @@ "react": "^16.8.2 || ^17.0.0 || ^18.0.0",

@@ -8,2 +8,2 @@ /**

*/
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),e=require("prop-types"),p=require("@progress/kendo-react-common"),X=require("../package-metadata.js"),G=require("@progress/kendo-react-popup"),E=require("./PopoverActionsBar.js");function J(o){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(n,a,l.get?l:{enumerable:!0,get:()=>o[a]})}}return n.default=o,Object.freeze(n)}const t=J(U),Q=12e3,W=2e3,C=15,Y={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},$={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},ee={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},te={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},oe=o=>t.Children.toArray(o).filter(n=>n&&n.type===E.PopoverActionsBar),ne=o=>t.Children.toArray(o).filter(n=>n&&n.type!==E.PopoverActionsBar),h=t.forwardRef((o,n)=>{p.validatePackage(X.packageMetadata);const{callout:a=b.callout,position:l=b.position,collision:T=b.collision,title:u,children:d,show:A,anchor:z,appendTo:R,offset:N,animate:j,positionMode:x,scale:I,popoverClass:i,className:w,id:S,style:_,contentStyle:g,onPosition:f,onClose:m,onOpen:v}=o,[D,y]=t.useState(!1),P=l==="top"||l==="bottom",M=o.margin||{vertical:a&&P?C:0,horizontal:a&&!P?C:0},q=ee[l],B=te[l],O=t.useContext(p.ZIndexContext),Z=O?O+W:Q,c=t.useRef(null);t.useImperativeHandle(c,()=>({props:o})),t.useImperativeHandle(n,()=>c.current);const F=t.useCallback(r=>{if(setTimeout(()=>y(r.flipped)),f){const H={target:c.current,flipped:r.flipped,fitted:r.fitted};f.call(void 0,H)}},[f,y]),V=t.useCallback(()=>{if(v){const r={target:c.current};v.call(void 0,r)}},[v]),K=t.useCallback(()=>{if(m){const r={target:c.current};m.call(void 0,r)}},[m]),s={"k-popover":!0};Array.isArray(i)?i.forEach(r=>s[r]=!0):typeof i=="object"?Object.keys(i).forEach(r=>{s[r]=i[r]}):i&&(s[i]=!0);const L=D?$[l]:Y[l],k=t.useMemo(()=>t.createElement(t.Fragment,null,u&&t.createElement("div",{className:"k-popover-header"},u),t.createElement("div",{className:"k-popover-body",style:g},ne(d)),oe(d)),[d,g,u]);return t.createElement(p.ZIndexContext.Provider,{value:Z},t.createElement(G.Popup,{id:S,role:"tooltip",animate:j,collision:T,anchor:z,offset:N,margin:M,popupAlign:q,anchorAlign:B,appendTo:R,show:A,scale:I,positionMode:x,style:_,className:w,popupClass:s,onOpen:V,onClose:K,onPosition:F},a&&l?t.createElement(t.Fragment,null,t.createElement("div",{className:p.classNames("k-popover-callout",L)}),t.createElement("div",{className:"k-popover-inner"},k)):k))}),b={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};h.propTypes={callout:e.bool,title:e.node,position:e.oneOf(["top","left","bottom","right"]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),anchor:function(o){const n=o.anchor;return n&&typeof n.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(o){const n=o.appendTo;return n&&typeof n.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popoverClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func};h.displayName="KendoReactPopover";exports.Popover=h;
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),e=require("prop-types"),u=require("@progress/kendo-react-common"),Q=require("../package-metadata.js"),W=require("@progress/kendo-react-popup"),w=require("./PopoverActionsBar.js"),T=require("./utils.js");function Y(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const l in n)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(n,l);Object.defineProperty(r,l,a.get?a:{enumerable:!0,get:()=>n[l]})}}return r.default=n,Object.freeze(r)}const t=Y(J),$=12e3,ee=2e3,A=15,te={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},oe={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},ne={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},re={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},ae=n=>t.Children.toArray(n).filter(r=>r&&r.type===w.PopoverActionsBar),le=n=>t.Children.toArray(n).filter(r=>r&&r.type!==w.PopoverActionsBar),y=t.forwardRef((n,r)=>{u.validatePackage(Q.packageMetadata);const{callout:l=b.callout,position:a=b.position,collision:z=b.collision,title:d,children:f,show:R,anchor:N,appendTo:j,offset:D,animate:x,positionMode:I,scale:S,popoverClass:c,className:q,id:F,style:_,contentStyle:P,onPosition:m,onClose:v,onOpen:g,onKeyDown:h}=n,[M,k]=t.useState(!1),O=a==="top"||a==="bottom",B=n.margin||{vertical:l&&O?A:0,horizontal:l&&!O?A:0},K=ne[a],Z=re[a],C=t.useContext(u.ZIndexContext),V=C?C+ee:$,s=t.useRef(null);t.useImperativeHandle(s,()=>({props:n})),t.useImperativeHandle(r,()=>s.current);const L=t.useCallback(o=>{if(setTimeout(()=>k(o.flipped)),m){const i={target:s.current,flipped:o.flipped,fitted:o.fitted};m.call(void 0,i)}},[m,k]),H=t.useCallback(()=>{const o=T.getFirstFocusableElement(document.querySelector(".k-popover-inner"));if(o&&o.focus(),g){const i={target:s.current};g.call(void 0,i)}},[g]),U=t.useCallback(o=>{if(h&&o.key==="Escape"){const i={target:s.current,show:!1};h.call(void 0,i)}o.key==="Tab"&&T.handleFocusTrap(o)},[h]),X=t.useCallback(o=>{if(v){const i={target:s.current};v.call(void 0,i)}o&&o.target&&o.target.props&&o.target.props.anchor&&o.target.props.anchor.focus()},[v]),p={"k-popover":!0};Array.isArray(c)?c.forEach(o=>p[o]=!0):typeof c=="object"?Object.keys(c).forEach(o=>{p[o]=c[o]}):c&&(p[c]=!0);const G=M?oe[a]:te[a],E=t.useMemo(()=>t.createElement(t.Fragment,null,d&&t.createElement("div",{className:"k-popover-header"},d),t.createElement("div",{className:"k-popover-body",style:P},le(f)),ae(f)),[f,P,d]);return t.createElement(u.ZIndexContext.Provider,{value:V},t.createElement(W.Popup,{id:F,role:"tooltip",animate:x,collision:z,anchor:N,offset:D,margin:B,popupAlign:K,anchorAlign:Z,appendTo:j,show:R,scale:S,positionMode:I,style:_,className:q,popupClass:p,onOpen:H,onClose:X,onPosition:L,onKeyDown:U},l&&a?t.createElement(t.Fragment,null,t.createElement("div",{className:u.classNames("k-popover-callout",G)}),t.createElement("div",{className:"k-popover-inner"},E)):E))}),b={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};y.propTypes={callout:e.bool,title:e.node,position:e.oneOf(["top","left","bottom","right"]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),anchor:function(n){const r=n.anchor;return r&&typeof r.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(n){const r=n.appendTo;return r&&typeof r.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popoverClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func};y.displayName="KendoReactPopover";exports.Popover=y;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc