@progress/kendo-react-tooltip 8.1.0-develop.21 → 8.1.0-develop.23
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.
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!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);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-${t.alignment}`]:t.alignment,[`k-actions-${t.orientation}`]:t.orientation})},t.children)}));m.propTypes={alignment:n.oneOf(["start","center","end","stretched"]),orientation:n.oneOf(["horizontal","vertical"]),children:n.oneOfType([n.element,n.node])},m.defaultProps={alignment:"stretched",orientation:"horizontal"},m.displayName="KendoReactPopoverActionsBar";const f={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},v={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},g={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},y={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},E=s.forwardRef(((t,e)=>{i.validatePackage(u);const{callout:o,position:n,title:r,children:a,show:p,anchor:c,appendTo:h,offset:d,animate:E,positionMode:k,scale:b,popoverClass:w,className:T,id:O,style:I,collision:C,contentStyle:N,onPosition:P,onClose:x,onOpen:R}=t,[D,M]=s.useState(!1),z="top"===n||"bottom"===n,A=t.margin||{vertical:o&&z?15:0,horizontal:o&&!z?15:0},j=g[n],K=y[n],U=s.useContext(i.ZIndexContext),H=U?U+2e3:12e3,B=s.useRef(null);s.useImperativeHandle(B,(()=>({props:t}))),s.useImperativeHandle(e,(()=>B.current));const L=s.useCallback((t=>{if(setTimeout((()=>M(t.flipped))),P){const e={target:B.current,flipped:t.flipped,fitted:t.fitted};P.call(void 0,e)}}),[P,M]),S=s.useCallback((()=>{if(R){const t={target:B.current};R.call(void 0,t)}}),[R]),q=s.useCallback((()=>{if(x){const t={target:B.current};x.call(void 0,t)}}),[x]),W={"k-popover":!0};Array.isArray(w)?w.forEach((t=>W[t]=!0)):"object"==typeof w?Object.keys(w).forEach((t=>{W[t]=w[t]})):w&&(W[w]=!0);const Z=D?v[n]:f[n],V=s.useMemo((()=>s.createElement(s.Fragment,null,r&&s.createElement("div",{className:"k-popover-header"},r),s.createElement("div",{className:"k-popover-body",style:N},(t=>s.Children.toArray(t).filter((t=>t&&t.type!==m)))(a)),(t=>s.Children.toArray(t).filter((t=>t&&t.type===m)))(a))),[a,N,r]);return s.createElement(i.ZIndexContext.Provider,{value:H},s.createElement(l.Popup,{id:O,role:"tooltip",animate:E,collision:C,anchor:c,offset:d,margin:A,popupAlign:j,anchorAlign:K,appendTo:h,show:p,scale:b,positionMode:k,style:I,className:T,popupClass:W,onOpen:S,onClose:q,onPosition:L},o&&n?s.createElement(s.Fragment,null,s.createElement("div",{className:i.classNames("k-popover-callout",Z)}),s.createElement("div",{className:"k-popover-inner"},V)):V))}));E.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},E.defaultProps={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}},E.displayName="KendoReactPopover",t.Popover=E,t.PopoverActionsBar=m,t.Tooltip=d}));
|
|
8
|
+
!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}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-tooltip",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1719228237,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-tooltip",
|
|
3
|
-
"version": "8.1.0-develop.
|
|
3
|
+
"version": "8.1.0-develop.23",
|
|
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",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
-
"@progress/kendo-react-common": "8.1.0-develop.
|
|
27
|
-
"@progress/kendo-react-popup": "8.1.0-develop.
|
|
26
|
+
"@progress/kendo-react-common": "8.1.0-develop.23",
|
|
27
|
+
"@progress/kendo-react-popup": "8.1.0-develop.23",
|
|
28
28
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
29
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
30
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
package/popover/Popover.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"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;
|
package/popover/Popover.mjs
CHANGED
|
@@ -8,67 +8,67 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as o from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
import { Popup as
|
|
11
|
+
import { validatePackage as X, ZIndexContext as C, classNames as q } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as G } from "../package-metadata.mjs";
|
|
13
|
+
import { Popup as J } from "@progress/kendo-react-popup";
|
|
14
14
|
import { PopoverActionsBar as k } from "./PopoverActionsBar.mjs";
|
|
15
|
-
const
|
|
15
|
+
const Q = 12e3, W = 2e3, E = 15, Y = {
|
|
16
16
|
top: "k-callout-s",
|
|
17
17
|
left: "k-callout-e",
|
|
18
18
|
bottom: "k-callout-n",
|
|
19
19
|
right: "k-callout-w"
|
|
20
|
-
},
|
|
20
|
+
}, $ = {
|
|
21
21
|
top: "k-callout-n",
|
|
22
22
|
left: "k-callout-w",
|
|
23
23
|
bottom: "k-callout-s",
|
|
24
24
|
right: "k-callout-e"
|
|
25
|
-
},
|
|
25
|
+
}, ee = {
|
|
26
26
|
top: { vertical: "bottom", horizontal: "center" },
|
|
27
27
|
left: { vertical: "center", horizontal: "right" },
|
|
28
28
|
bottom: { vertical: "top", horizontal: "center" },
|
|
29
29
|
right: { vertical: "center", horizontal: "left" }
|
|
30
|
-
},
|
|
30
|
+
}, oe = {
|
|
31
31
|
top: { vertical: "top", horizontal: "center" },
|
|
32
32
|
left: { vertical: "center", horizontal: "left" },
|
|
33
33
|
bottom: { vertical: "bottom", horizontal: "center" },
|
|
34
34
|
right: { vertical: "center", horizontal: "right" }
|
|
35
|
-
},
|
|
36
|
-
|
|
35
|
+
}, te = (r) => o.Children.toArray(r).filter((t) => t && t.type === k), ne = (r) => o.Children.toArray(r).filter((t) => t && t.type !== k), O = o.forwardRef((r, t) => {
|
|
36
|
+
X(G);
|
|
37
37
|
const {
|
|
38
|
-
callout: s,
|
|
39
|
-
position: l,
|
|
38
|
+
callout: s = v.callout,
|
|
39
|
+
position: l = v.position,
|
|
40
|
+
collision: T = v.collision,
|
|
40
41
|
title: p,
|
|
41
42
|
children: u,
|
|
42
|
-
show:
|
|
43
|
-
anchor:
|
|
44
|
-
appendTo:
|
|
45
|
-
offset:
|
|
46
|
-
animate:
|
|
47
|
-
positionMode:
|
|
48
|
-
scale:
|
|
43
|
+
show: A,
|
|
44
|
+
anchor: z,
|
|
45
|
+
appendTo: N,
|
|
46
|
+
offset: R,
|
|
47
|
+
animate: x,
|
|
48
|
+
positionMode: I,
|
|
49
|
+
scale: w,
|
|
49
50
|
popoverClass: a,
|
|
50
|
-
className:
|
|
51
|
-
id:
|
|
52
|
-
style:
|
|
53
|
-
collision: D,
|
|
51
|
+
className: j,
|
|
52
|
+
id: D,
|
|
53
|
+
style: F,
|
|
54
54
|
contentStyle: h,
|
|
55
55
|
onPosition: f,
|
|
56
56
|
onClose: d,
|
|
57
57
|
onOpen: m
|
|
58
|
-
} = r, [
|
|
58
|
+
} = r, [V, b] = o.useState(!1), g = l === "top" || l === "bottom", Z = r.margin || {
|
|
59
59
|
vertical: s && g ? E : 0,
|
|
60
60
|
horizontal: s && !g ? E : 0
|
|
61
|
-
},
|
|
61
|
+
}, _ = ee[l], B = oe[l], y = o.useContext(C), M = y ? y + W : Q, i = o.useRef(null);
|
|
62
62
|
o.useImperativeHandle(i, () => ({ props: r })), o.useImperativeHandle(t, () => i.current);
|
|
63
|
-
const
|
|
63
|
+
const S = o.useCallback(
|
|
64
64
|
(n) => {
|
|
65
65
|
if (setTimeout(() => b(n.flipped)), f) {
|
|
66
|
-
const
|
|
67
|
-
f.call(void 0,
|
|
66
|
+
const U = { target: i.current, flipped: n.flipped, fitted: n.fitted };
|
|
67
|
+
f.call(void 0, U);
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
[f, b]
|
|
71
|
-
),
|
|
71
|
+
), K = o.useCallback(
|
|
72
72
|
() => {
|
|
73
73
|
if (m) {
|
|
74
74
|
const n = { target: i.current };
|
|
@@ -76,7 +76,7 @@ const J = 12e3, Q = 2e3, E = 15, W = {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
[m]
|
|
79
|
-
),
|
|
79
|
+
), L = o.useCallback(
|
|
80
80
|
() => {
|
|
81
81
|
if (d) {
|
|
82
82
|
const n = { target: i.current };
|
|
@@ -88,36 +88,36 @@ const J = 12e3, Q = 2e3, E = 15, W = {
|
|
|
88
88
|
Array.isArray(a) ? a.forEach((n) => c[n] = !0) : typeof a == "object" ? Object.keys(a).forEach((n) => {
|
|
89
89
|
c[n] = a[n];
|
|
90
90
|
}) : a && (c[a] = !0);
|
|
91
|
-
const
|
|
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 },
|
|
91
|
+
const H = V ? $[l] : Y[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 }, ne(u)), te(u)),
|
|
93
93
|
[u, h, p]
|
|
94
94
|
);
|
|
95
|
-
return /* @__PURE__ */ o.createElement(C.Provider, { value:
|
|
96
|
-
|
|
95
|
+
return /* @__PURE__ */ o.createElement(C.Provider, { value: M }, /* @__PURE__ */ o.createElement(
|
|
96
|
+
J,
|
|
97
97
|
{
|
|
98
|
-
id:
|
|
98
|
+
id: D,
|
|
99
99
|
role: "tooltip",
|
|
100
|
-
animate:
|
|
101
|
-
collision:
|
|
102
|
-
anchor:
|
|
103
|
-
offset:
|
|
104
|
-
margin:
|
|
105
|
-
popupAlign:
|
|
106
|
-
anchorAlign:
|
|
107
|
-
appendTo:
|
|
108
|
-
show:
|
|
109
|
-
scale:
|
|
110
|
-
positionMode:
|
|
111
|
-
style:
|
|
112
|
-
className:
|
|
100
|
+
animate: x,
|
|
101
|
+
collision: T,
|
|
102
|
+
anchor: z,
|
|
103
|
+
offset: R,
|
|
104
|
+
margin: Z,
|
|
105
|
+
popupAlign: _,
|
|
106
|
+
anchorAlign: B,
|
|
107
|
+
appendTo: N,
|
|
108
|
+
show: A,
|
|
109
|
+
scale: w,
|
|
110
|
+
positionMode: I,
|
|
111
|
+
style: F,
|
|
112
|
+
className: j,
|
|
113
113
|
popupClass: c,
|
|
114
|
-
onOpen:
|
|
115
|
-
onClose:
|
|
116
|
-
onPosition:
|
|
114
|
+
onOpen: K,
|
|
115
|
+
onClose: L,
|
|
116
|
+
onPosition: S
|
|
117
117
|
},
|
|
118
|
-
s && l ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", { className:
|
|
118
|
+
s && l ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", { className: q("k-popover-callout", H) }), /* @__PURE__ */ o.createElement("div", { className: "k-popover-inner" }, P)) : P
|
|
119
119
|
));
|
|
120
|
-
}),
|
|
120
|
+
}), v = {
|
|
121
121
|
callout: !0,
|
|
122
122
|
position: "top",
|
|
123
123
|
collision: {
|
|
@@ -125,7 +125,7 @@ const J = 12e3, Q = 2e3, E = 15, W = {
|
|
|
125
125
|
vertical: "none"
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
O.propTypes = {
|
|
129
129
|
callout: e.bool,
|
|
130
130
|
title: e.node,
|
|
131
131
|
position: e.oneOf(["top", "left", "bottom", "right"]),
|
|
@@ -178,8 +178,7 @@ v.propTypes = {
|
|
|
178
178
|
onPosition: e.func,
|
|
179
179
|
onOpen: e.func
|
|
180
180
|
};
|
|
181
|
-
|
|
182
|
-
v.displayName = "KendoReactPopover";
|
|
181
|
+
O.displayName = "KendoReactPopover";
|
|
183
182
|
export {
|
|
184
|
-
|
|
183
|
+
O as Popover
|
|
185
184
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("prop-types"),d=require("@progress/kendo-react-common");function f(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=f(u),c=n.forwardRef((e,o)=>{const t=n.useRef(null),r=n.useRef(null),{alignment:i=l.alignment,orientation:s=l.orientation}=e;return n.useImperativeHandle(r,()=>({props:e,element:t.current})),n.useImperativeHandle(o,()=>r.current),n.createElement("div",{ref:t,className:d.classNames("k-popover-actions","k-actions",{[`k-actions-${i}`]:i,[`k-actions-${s}`]:s})},e.children)}),l={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.displayName="KendoReactPopoverActionsBar";exports.PopoverActionsBar=c;
|
|
@@ -6,40 +6,39 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import { classNames as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
return
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import t from "prop-types";
|
|
11
|
+
import { classNames as m } from "@progress/kendo-react-common";
|
|
12
|
+
const c = e.forwardRef((n, l) => {
|
|
13
|
+
const o = e.useRef(null), r = e.useRef(null), { alignment: a = s.alignment, orientation: i = s.orientation } = n;
|
|
14
|
+
return e.useImperativeHandle(r, () => ({ props: n, element: o.current })), e.useImperativeHandle(l, () => r.current), /* @__PURE__ */ e.createElement(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
|
-
ref:
|
|
18
|
-
className:
|
|
17
|
+
ref: o,
|
|
18
|
+
className: m(
|
|
19
19
|
"k-popover-actions",
|
|
20
20
|
"k-actions",
|
|
21
21
|
{
|
|
22
|
-
[`k-actions-${
|
|
23
|
-
[`k-actions-${
|
|
22
|
+
[`k-actions-${a}`]: a,
|
|
23
|
+
[`k-actions-${i}`]: i
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
n.children
|
|
28
28
|
);
|
|
29
|
-
}),
|
|
29
|
+
}), s = {
|
|
30
30
|
alignment: "stretched",
|
|
31
31
|
orientation: "horizontal"
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
alignment:
|
|
35
|
-
orientation:
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
c.propTypes = {
|
|
34
|
+
alignment: t.oneOf(["start", "center", "end", "stretched"]),
|
|
35
|
+
orientation: t.oneOf(["horizontal", "vertical"]),
|
|
36
|
+
children: t.oneOfType([
|
|
37
|
+
t.element,
|
|
38
|
+
t.node
|
|
39
39
|
])
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
o.displayName = "KendoReactPopoverActionsBar";
|
|
41
|
+
c.displayName = "KendoReactPopoverActionsBar";
|
|
43
42
|
export {
|
|
44
|
-
|
|
43
|
+
c as PopoverActionsBar
|
|
45
44
|
};
|