@progress/kendo-react-popup
Advanced tools
Comparing version 8.2.0-develop.33 to 8.2.0-develop.34
@@ -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-popup-common")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-popup-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactPopup={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoPopupCommon)}(this,(function(t,e,o,n,i,s){"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 p=r(e),l=r(o);const a=t=>{t.style.transitionDuration="",Array.from(t.classList).forEach((e=>{e.startsWith("k-slide-")&&t.classList.remove(e)}))},c="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),h={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};function u(t,e){if(t===e)return!0;if(!!t!=!!e)return!1;const o=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(e);if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){let i=o[n];if(t[i]!==e[i])return!1}return!0}const d="k-animation-container-shown",f=class extends p.Component{constructor(t){super(t),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:e,popupAlign:o,collision:n,offset:i,anchor:r,margin:p,scale:l,positionMode:a}=this.props;const{width:c,height:h}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const u=s.alignElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,offset:i,margin:p,positionMode:a,scale:l}),d=s.positionElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,collisions:n,currentLocation:u,margin:this.props.margin});if(t.style.top=d.offset.top+"px",t.style.left=d.offset.left+"px",t.style.width=c,t.style.height=h,this._collisions={fit:d.fit,fitted:d.fitted,flip:d.flip,flipped:d.flipped},this.props.onPosition){const t={target:this,flipped:d.flipped,fitted:d.fitted};this.props.onPosition.call(void 0,t)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(d),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,e,o)=>{if(!this.props.popupAlign)return;let n;const{horizontal:i,vertical:s}=this.props.popupAlign;n="left"===i&&"center"===s?"right":"right"===i&&"center"===s?"left":"top"===s?"down":"up";this._collisions&&this._collisions.flipped&&(n={down:"up",up:"down",left:"right",right:"left"}[n]),((t,e,o,n,i)=>{if(0===o)return i();const s="k-slide-"+e+"-"+n,r=s+"-active",p=e=>{e.target===t&&(t.removeEventListener("transitionend",p),a(t),t.style.display="exit"===n?"none":"",i())};t.addEventListener("transitionend",p);const l=t.ownerDocument;if(!l)return;const h=l.defaultView;if(!h)return;const u=()=>{a(t),t.classList.add(s),h.requestAnimationFrame((()=>{t.style.transitionDuration=o+"ms",t.classList.add(r)}))};c?h.requestAnimationFrame(u):u()})(t,n,this.animationDuration[e],e,o)},this.onClosing=t=>{this.props.show||t.classList.remove(d),this.detachRepositionHandlers()},this.onClosed=()=>{"hiding"===this.state.current&&"shown"===this.state.previous&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+1:100,i.validatePackage(h),this.reposition=function(t,e,o={}){let n,i,s,r,p=0;o=o||{};const l=function(){p=!1===o.leading?0:(new Date).getTime(),n=void 0,r=t.apply(i,s),n||(i=s=null)};return function(){const a=(new Date).getTime();!p&&!1===o.leading&&(p=a);const c=e-(a-p);return i=void 0,s=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=void 0),p=a,r=t.apply(i,s),n||(i=s=null)):!n&&!1!==o.trailing&&(n=window.setTimeout(l,c)),r}}(this.reposition.bind(this),16.666666666666668)}get element(){return this._popup}static getDerivedStateFromProps(t,e){const{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}=t,f={...e,props:{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}};return t.show?"hidden"===e.current||"hiding"===e.current?{...f,current:"showing",previous:e.current}:"showing"===e.current?{...f,current:"shown",previous:e.current}:"shown"!==e.current||u(h,e.props.offset)&&u(i,e.props.anchorAlign)&&u(s,e.props.appendTo)&&u(r,e.props.collision)&&u(p,e.props.popupAlign)&&u(c,e.props.style)&&n===e.props.anchor&&a===e.props.popupClass&&l===e.props.className?f:{...f,current:"reposition",previous:e.current}:"hiding"===e.current||"hidden"===e.current?{...f,current:"hidden",previous:e.current}:{...f,current:"hiding",previous:e.current}}componentDidUpdate(t){"showing"===this.state.current&&this._popup?this.show(this._popup):"hiding"===this.state.current&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):"reposition"===this.state.current&&"shown"===this.state.previous?setTimeout((()=>{this.setState({current:"shown",previous:this.state.current})}),0):"shown"===this.state.current&&t.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){"showing"===this.state.current&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:t,className:e,popupClass:o,show:n,id:s,positionMode:r}=this.props,a=this.props.appendTo?this.props.appendTo:i.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;"reposition"===this.state.current&&"shown"===this.state.previous&&this._popup&&this.setPosition(this._popup);const c=Object.assign({},{position:r,top:0,left:-1e4},this.props.style||{}),h="hiding"===this.state.current;if((n||h)&&a){const n=this.getCurrentZIndex(),r=p.createElement(i.ZIndexContext.Provider,{value:n},p.createElement("div",{className:i.classNames("k-animation-container",e),id:s,ref:t=>this._popup=t,style:{zIndex:n,...c}},p.createElement("div",{className:i.classNames("k-child-animation-container"),style:{transitionDelay:"0ms"}},p.createElement("div",{role:this.props.role,className:i.classNames("k-popup",o)},t))));return null!==this.props.appendTo?l.createPortal(r,a):r}return null}get animationDuration(){const t=this.props.animate;let e=0,o=0;return t&&(!0===t?e=o=300:(e=t.openDuration||0,o=t.closeDuration||0)),{enter:e,exit:o}}attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=s.domUtils.scrollableParents(this.props.anchor||t),this._scrollableParents&&this._scrollableParents.map((t=>t.addEventListener("scroll",this.reposition))),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map((t=>t.removeEventListener("scroll",this.reposition))),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};f.propTypes={anchor:function(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. 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 Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none]),vertical:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),margin:n.shape({horizontal:n.number,vertical:n.number}),positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func},f.defaultProps={collision:{horizontal:s.Collision.fit,vertical:s.Collision.flip},anchorAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.bottom},popupAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},f.contextType=i.ZIndexContext,f.displayName="PopupComponent";let m=f;const g=p.createContext((t=>t)),v=p.forwardRef(((t,e)=>{const o=p.useContext(g).call(void 0,t);return p.createElement(m,{ref:e,...o})}));v.displayName="Popup",t.Popup=v,t.PopupPropsContext=g,t.PopupWithoutContext=m})); | ||
!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-popup-common")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-popup-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactPopup={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoPopupCommon)}(this,(function(t,e,o,n,i,s){"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 p=r(e),l=r(o);const a=t=>{t.style.transitionDuration="",Array.from(t.classList).forEach((e=>{e.startsWith("k-slide-")&&t.classList.remove(e)}))},c="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),h={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};function u(t,e){if(t===e)return!0;if(!!t!=!!e)return!1;const o=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(e);if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){let i=o[n];if(t[i]!==e[i])return!1}return!0}const d="k-animation-container-shown",f=class extends p.Component{constructor(t){super(t),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:e,popupAlign:o,collision:n,offset:i,anchor:r,margin:p,scale:l,positionMode:a}=this.props;const{width:c,height:h}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const u=s.alignElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,offset:i,margin:p,positionMode:a,scale:l}),d=s.positionElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,collisions:n,currentLocation:u,margin:this.props.margin});if(t.style.top=d.offset.top+"px",t.style.left=d.offset.left+"px",t.style.width=c,t.style.height=h,this._collisions={fit:d.fit,fitted:d.fitted,flip:d.flip,flipped:d.flipped},this.props.onPosition){const t={target:this,flipped:d.flipped,fitted:d.fitted};this.props.onPosition.call(void 0,t)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(d),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,e,o)=>{if(!this.props.popupAlign)return;let n;const{horizontal:i,vertical:s}=this.props.popupAlign;n="left"===i&&"center"===s?"right":"right"===i&&"center"===s?"left":"top"===s?"down":"up";this._collisions&&this._collisions.flipped&&(n={down:"up",up:"down",left:"right",right:"left"}[n]),((t,e,o,n,i)=>{if(0===o)return i();const s="k-slide-"+e+"-"+n,r=s+"-active",p=e=>{e.target===t&&(t.removeEventListener("transitionend",p),a(t),t.style.display="exit"===n?"none":"",i())};t.addEventListener("transitionend",p);const l=t.ownerDocument;if(!l)return;const h=l.defaultView;if(!h)return;const u=()=>{a(t),t.classList.add(s),h.requestAnimationFrame((()=>{t.style.transitionDuration=o+"ms",t.classList.add(r)}))};c?h.requestAnimationFrame(u):u()})(t,n,this.animationDuration[e],e,o)},this.onClosing=t=>{this.props.show||t.classList.remove(d),this.detachRepositionHandlers()},this.onClosed=()=>{"hiding"===this.state.current&&"shown"===this.state.previous&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+1:100,i.validatePackage(h),this.reposition=function(t,e,o={}){let n,i,s,r,p=0;o=o||{};const l=function(){p=!1===o.leading?0:(new Date).getTime(),n=void 0,r=t.apply(i,s),n||(i=s=null)};return function(){const a=(new Date).getTime();!p&&!1===o.leading&&(p=a);const c=e-(a-p);return i=void 0,s=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=void 0),p=a,r=t.apply(i,s),n||(i=s=null)):!n&&!1!==o.trailing&&(n=window.setTimeout(l,c)),r}}(this.reposition.bind(this),16.666666666666668)}get element(){return this._popup}static getDerivedStateFromProps(t,e){const{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}=t,f={...e,props:{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}};return t.show?"hidden"===e.current||"hiding"===e.current?{...f,current:"showing",previous:e.current}:"showing"===e.current?{...f,current:"shown",previous:e.current}:"shown"!==e.current||u(h,e.props.offset)&&u(i,e.props.anchorAlign)&&u(s,e.props.appendTo)&&u(r,e.props.collision)&&u(p,e.props.popupAlign)&&u(c,e.props.style)&&n===e.props.anchor&&a===e.props.popupClass&&l===e.props.className?f:{...f,current:"reposition",previous:e.current}:"hiding"===e.current||"hidden"===e.current?{...f,current:"hidden",previous:e.current}:{...f,current:"hiding",previous:e.current}}componentDidUpdate(t){"showing"===this.state.current&&this._popup?this.show(this._popup):"hiding"===this.state.current&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):"reposition"===this.state.current&&"shown"===this.state.previous?setTimeout((()=>{this.setState({current:"shown",previous:this.state.current})}),0):"shown"===this.state.current&&t.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){"showing"===this.state.current&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:t,className:e,popupClass:o,show:n,id:s,positionMode:r}=this.props,a=this.props.appendTo?this.props.appendTo:i.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;"reposition"===this.state.current&&"shown"===this.state.previous&&this._popup&&this.setPosition(this._popup);const c=Object.assign({},{position:r,top:0,left:-1e4},this.props.style||{}),h="hiding"===this.state.current;if((n||h)&&a){const n=this.getCurrentZIndex(),r=p.createElement(i.ZIndexContext.Provider,{value:n},p.createElement("div",{onKeyDown:this.props.onKeyDown,className:i.classNames("k-animation-container",e),id:s,ref:t=>this._popup=t,style:{zIndex:n,...c}},p.createElement("div",{className:i.classNames("k-child-animation-container"),style:{transitionDelay:"0ms"}},p.createElement("div",{role:this.props.role,className:i.classNames("k-popup",o)},t))));return null!==this.props.appendTo?l.createPortal(r,a):r}return null}get animationDuration(){const t=this.props.animate;let e=0,o=0;return t&&(!0===t?e=o=300:(e=t.openDuration||0,o=t.closeDuration||0)),{enter:e,exit:o}}attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=s.domUtils.scrollableParents(this.props.anchor||t),this._scrollableParents&&this._scrollableParents.map((t=>t.addEventListener("scroll",this.reposition))),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map((t=>t.removeEventListener("scroll",this.reposition))),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};f.propTypes={anchor:function(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. 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 Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none]),vertical:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),margin:n.shape({horizontal:n.number,vertical:n.number}),positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func,onKeyPress:n.func},f.defaultProps={collision:{horizontal:s.Collision.fit,vertical:s.Collision.flip},anchorAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.bottom},popupAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},f.contextType=i.ZIndexContext,f.displayName="PopupComponent";let m=f;const g=p.createContext((t=>t)),y=p.forwardRef(((t,e)=>{const o=p.useContext(g).call(void 0,t);return p.createElement(m,{ref:e,...o})}));y.displayName="Popup",t.Popup=y,t.PopupPropsContext=g,t.PopupWithoutContext=m})); |
@@ -251,2 +251,6 @@ /** | ||
role?: string; | ||
/** | ||
* @hidden | ||
*/ | ||
onKeyDown?: (event: React.KeyboardEvent) => void; | ||
} | ||
@@ -333,2 +337,3 @@ | ||
onOpen: PropTypes.Requireable<(...args: any[]) => any>; | ||
onKeyPress: PropTypes.Requireable<(...args: any[]) => any>; | ||
}; | ||
@@ -335,0 +340,0 @@ /** |
{ | ||
"name": "@progress/kendo-react-popup", | ||
"version": "8.2.0-develop.33", | ||
"version": "8.2.0-develop.34", | ||
"description": "React Popup positions a piece of content next to a specific anchor component. KendoReact Popup package", | ||
@@ -27,3 +27,3 @@ "author": "Progress", | ||
"@progress/kendo-popup-common": "^1.9.0", | ||
"@progress/kendo-react-common": "8.2.0-develop.33", | ||
"@progress/kendo-react-common": "8.2.0-develop.34", | ||
"react": "^16.8.2 || ^17.0.0 || ^18.0.0", | ||
@@ -30,0 +30,0 @@ "react-dom": "^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 N=require("react"),C=require("react-dom"),e=require("prop-types"),D=require("./animation.js"),f=require("@progress/kendo-react-common"),n=require("@progress/kendo-popup-common"),y=require("./util.js"),E=require("./package-metadata.js");function _(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(i,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return i.default=a,Object.freeze(i)}const O=_(N),I=_(C),R=100,x=1;function P(a,i){if(a===i)return!0;if(!!a!=!!i)return!1;const t=Object.getOwnPropertyNames(a),o=Object.getOwnPropertyNames(i);if(t.length!==o.length)return!1;for(let l=0;l<t.length;l++){let s=t[l];if(a[s]!==i[s])return!1}return!0}const M={left:-1e3,top:0},z="k-animation-container",b="k-animation-container-shown",S="k-child-animation-container",j="k-popup",v=class v extends O.Component{constructor(i){super(i),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:o,popupAlign:l,collision:s,offset:c,anchor:p,margin:h,scale:g,positionMode:u}=this.props;const{width:d,height:m}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const A=n.alignElement({anchor:p,anchorAlign:o,element:t,elementAlign:l,offset:c,margin:h,positionMode:u,scale:g}),r=n.positionElement({anchor:p,anchorAlign:o,element:t,elementAlign:l,collisions:s,currentLocation:A,margin:this.props.margin});if(t.style.top=r.offset.top+"px",t.style.left=r.offset.left+"px",t.style.width=d,t.style.height=m,this._collisions={fit:r.fit,fitted:r.fitted,flip:r.flip,flipped:r.flipped},this.props.onPosition){const T={target:this,flipped:r.flipped,fitted:r.fitted};this.props.onPosition.call(void 0,T)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(b),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,o,l)=>{if(!this.props.popupAlign)return;let s;const{horizontal:c,vertical:p}=this.props.popupAlign;c==="left"&&p==="center"?s="right":c==="right"&&p==="center"?s="left":p==="top"?s="down":s="up";const h={down:"up",up:"down",left:"right",right:"left"};this._collisions&&this._collisions.flipped&&(s=h[s]),D.slide(t,s,this.animationDuration[o],o,l)},this.onClosing=t=>{this.props.show||t.classList.remove(b),this.detachRepositionHandlers()},this.onClosed=()=>{this.state.current==="hiding"&&this.state.previous==="shown"&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+x:R,f.validatePackage(E.packageMetadata),this.reposition=y.throttle(this.reposition.bind(this),y.FRAME_DURATION)}get element(){return this._popup}static getDerivedStateFromProps(i,t){const{show:o,anchor:l,anchorAlign:s,appendTo:c,collision:p,popupAlign:h,className:g,popupClass:u,style:d,offset:m,contentKey:A}=i,r={...t,props:{show:o,anchor:l,anchorAlign:s,appendTo:c,collision:p,popupAlign:h,className:g,popupClass:u,style:d,offset:m,contentKey:A}};return i.show?t.current==="hidden"||t.current==="hiding"?{...r,current:"showing",previous:t.current}:t.current==="showing"?{...r,current:"shown",previous:t.current}:t.current==="shown"&&(!P(m,t.props.offset)||!P(s,t.props.anchorAlign)||!P(c,t.props.appendTo)||!P(p,t.props.collision)||!P(h,t.props.popupAlign)||!P(d,t.props.style)||l!==t.props.anchor||u!==t.props.popupClass||g!==t.props.className)?{...r,current:"reposition",previous:t.current}:r:t.current==="hiding"||t.current==="hidden"?{...r,current:"hidden",previous:t.current}:{...r,current:"hiding",previous:t.current}}componentDidUpdate(i){this.state.current==="showing"&&this._popup?this.show(this._popup):this.state.current==="hiding"&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):this.state.current==="reposition"&&this.state.previous==="shown"?setTimeout(()=>{this.setState({current:"shown",previous:this.state.current})},0):this.state.current==="shown"&&i.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){this.state.current==="showing"&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:i,className:t,popupClass:o,show:l,id:s,positionMode:c}=this.props,p=this.props.appendTo?this.props.appendTo:f.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;this.state.current==="reposition"&&this.state.previous==="shown"&&this._popup&&this.setPosition(this._popup);const h=Object.assign({},{position:c,top:0,left:-1e4},this.props.style||{}),g=this.state.current==="hiding";if((l||g)&&p){const u=this.getCurrentZIndex(),d=O.createElement(f.ZIndexContext.Provider,{value:u},O.createElement("div",{className:f.classNames(z,t),id:s,ref:m=>this._popup=m,style:{zIndex:u,...h}},O.createElement("div",{className:f.classNames(S),style:{transitionDelay:"0ms"}},O.createElement("div",{role:this.props.role,className:f.classNames(j,o)},i))));return this.props.appendTo!==null?I.createPortal(d,p):d}return null}get animationDuration(){const i=this.props.animate;let t=0,o=0;return i&&(i===!0?t=o=300:(t=i.openDuration||0,o=i.closeDuration||0)),{enter:t,exit:o}}attachRepositionHandlers(i){this.detachRepositionHandlers(),this._scrollableParents=n.domUtils.scrollableParents(this.props.anchor||i),this._scrollableParents&&this._scrollableParents.map(t=>t.addEventListener("scroll",this.reposition)),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map(i=>i.removeEventListener("scroll",this.reposition)),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};v.propTypes={anchor:function(i){const t=i.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(i){const t=i.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popupClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),collision:e.shape({horizontal:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none]),vertical:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none])}),anchorAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),popupAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),margin:e.shape({horizontal:e.number,vertical:e.number}),positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func},v.defaultProps={collision:{horizontal:n.Collision.fit,vertical:n.Collision.flip},anchorAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.bottom},popupAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.top},offset:M,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},v.contextType=f.ZIndexContext,v.displayName="PopupComponent";let w=v;exports.PopupWithoutContext=w; | ||
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),C=require("react-dom"),e=require("prop-types"),D=require("./animation.js"),f=require("@progress/kendo-react-common"),n=require("@progress/kendo-popup-common"),w=require("./util.js"),E=require("./package-metadata.js");function _(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(i,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return i.default=a,Object.freeze(i)}const O=_(N),I=_(C),R=100,x=1;function P(a,i){if(a===i)return!0;if(!!a!=!!i)return!1;const t=Object.getOwnPropertyNames(a),o=Object.getOwnPropertyNames(i);if(t.length!==o.length)return!1;for(let l=0;l<t.length;l++){let s=t[l];if(a[s]!==i[s])return!1}return!0}const M={left:-1e3,top:0},z="k-animation-container",b="k-animation-container-shown",S="k-child-animation-container",j="k-popup",v=class v extends O.Component{constructor(i){super(i),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:o,popupAlign:l,collision:s,offset:c,anchor:p,margin:h,scale:g,positionMode:u}=this.props;const{width:d,height:m}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const A=n.alignElement({anchor:p,anchorAlign:o,element:t,elementAlign:l,offset:c,margin:h,positionMode:u,scale:g}),r=n.positionElement({anchor:p,anchorAlign:o,element:t,elementAlign:l,collisions:s,currentLocation:A,margin:this.props.margin});if(t.style.top=r.offset.top+"px",t.style.left=r.offset.left+"px",t.style.width=d,t.style.height=m,this._collisions={fit:r.fit,fitted:r.fitted,flip:r.flip,flipped:r.flipped},this.props.onPosition){const T={target:this,flipped:r.flipped,fitted:r.fitted};this.props.onPosition.call(void 0,T)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(b),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,o,l)=>{if(!this.props.popupAlign)return;let s;const{horizontal:c,vertical:p}=this.props.popupAlign;c==="left"&&p==="center"?s="right":c==="right"&&p==="center"?s="left":p==="top"?s="down":s="up";const h={down:"up",up:"down",left:"right",right:"left"};this._collisions&&this._collisions.flipped&&(s=h[s]),D.slide(t,s,this.animationDuration[o],o,l)},this.onClosing=t=>{this.props.show||t.classList.remove(b),this.detachRepositionHandlers()},this.onClosed=()=>{this.state.current==="hiding"&&this.state.previous==="shown"&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+x:R,f.validatePackage(E.packageMetadata),this.reposition=w.throttle(this.reposition.bind(this),w.FRAME_DURATION)}get element(){return this._popup}static getDerivedStateFromProps(i,t){const{show:o,anchor:l,anchorAlign:s,appendTo:c,collision:p,popupAlign:h,className:g,popupClass:u,style:d,offset:m,contentKey:A}=i,r={...t,props:{show:o,anchor:l,anchorAlign:s,appendTo:c,collision:p,popupAlign:h,className:g,popupClass:u,style:d,offset:m,contentKey:A}};return i.show?t.current==="hidden"||t.current==="hiding"?{...r,current:"showing",previous:t.current}:t.current==="showing"?{...r,current:"shown",previous:t.current}:t.current==="shown"&&(!P(m,t.props.offset)||!P(s,t.props.anchorAlign)||!P(c,t.props.appendTo)||!P(p,t.props.collision)||!P(h,t.props.popupAlign)||!P(d,t.props.style)||l!==t.props.anchor||u!==t.props.popupClass||g!==t.props.className)?{...r,current:"reposition",previous:t.current}:r:t.current==="hiding"||t.current==="hidden"?{...r,current:"hidden",previous:t.current}:{...r,current:"hiding",previous:t.current}}componentDidUpdate(i){this.state.current==="showing"&&this._popup?this.show(this._popup):this.state.current==="hiding"&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):this.state.current==="reposition"&&this.state.previous==="shown"?setTimeout(()=>{this.setState({current:"shown",previous:this.state.current})},0):this.state.current==="shown"&&i.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){this.state.current==="showing"&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:i,className:t,popupClass:o,show:l,id:s,positionMode:c}=this.props,p=this.props.appendTo?this.props.appendTo:f.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;this.state.current==="reposition"&&this.state.previous==="shown"&&this._popup&&this.setPosition(this._popup);const h=Object.assign({},{position:c,top:0,left:-1e4},this.props.style||{}),g=this.state.current==="hiding";if((l||g)&&p){const u=this.getCurrentZIndex(),d=O.createElement(f.ZIndexContext.Provider,{value:u},O.createElement("div",{onKeyDown:this.props.onKeyDown,className:f.classNames(z,t),id:s,ref:m=>this._popup=m,style:{zIndex:u,...h}},O.createElement("div",{className:f.classNames(S),style:{transitionDelay:"0ms"}},O.createElement("div",{role:this.props.role,className:f.classNames(j,o)},i))));return this.props.appendTo!==null?I.createPortal(d,p):d}return null}get animationDuration(){const i=this.props.animate;let t=0,o=0;return i&&(i===!0?t=o=300:(t=i.openDuration||0,o=i.closeDuration||0)),{enter:t,exit:o}}attachRepositionHandlers(i){this.detachRepositionHandlers(),this._scrollableParents=n.domUtils.scrollableParents(this.props.anchor||i),this._scrollableParents&&this._scrollableParents.map(t=>t.addEventListener("scroll",this.reposition)),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map(i=>i.removeEventListener("scroll",this.reposition)),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};v.propTypes={anchor:function(i){const t=i.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(i){const t=i.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popupClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),collision:e.shape({horizontal:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none]),vertical:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none])}),anchorAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),popupAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),margin:e.shape({horizontal:e.number,vertical:e.number}),positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func,onKeyPress:e.func},v.defaultProps={collision:{horizontal:n.Collision.fit,vertical:n.Collision.flip},anchorAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.bottom},popupAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.top},offset:M,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},v.contextType=f.ZIndexContext,v.displayName="PopupComponent";let y=v;exports.PopupWithoutContext=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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90624
1035
4