@progress/kendo-react-popup 16.2.0-develop.10 → 16.2.0-develop.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Popup.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("react"),Re=require("react-dom"),t=require("prop-types"),xe=require("./animation.js"),p=require("@progress/kendo-react-common"),n=require("@progress/kendo-popup-common"),ie=require("./util.js");function se(r){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const g in r)if(g!=="default"){const m=Object.getOwnPropertyDescriptor(r,g);Object.defineProperty(c,g,m.get?m:{enumerable:!0,get:()=>r[g]})}}return c.default=r,Object.freeze(c)}const l=se(De),Te=se(Re),le=l.createContext(r=>r),Ne=12e3,ze=1;function b(r,c){if(r===c)return!0;if(!!r!=!!c)return!1;const g=Object.getOwnPropertyNames(r),m=Object.getOwnPropertyNames(c);if(g.length!==m.length)return!1;for(let P=0;P<g.length;P++){const y=g[P];if(r[y]!==c[y])return!1}return!0}const Se={left:-1e3,top:0},K=l.forwardRef((r,c)=>{const m=l.useContext(le).call(void 0,r),{collision:P=h.collision,anchorAlign:y=h.anchorAlign,popupAlign:v=h.popupAlign,offset:T=h.offset,animate:N=h.animate,show:C=h.show,margin:H=h.margin,positionMode:B=h.positionMode,appendTo:A,contentKey:z,anchor:f,scale:ce,role:ae,ariaLabelledBy:ue,ariaDescribedBy:pe,onKeyDown:fe,onPosition:V,onOpen:W,onMouseDownOutside:X,onClose:G,className:S,popupClass:M,id:de,style:L,children:me}=m,he=p.useUnstyled(),j=m.unstyled||he,x=j&&j.uPopup,[o,I]=l.useState({current:"hidden",previous:"hidden",props:{}}),_=N&&typeof N!="object"?re:{...re,...N},ge=e=>{window==null||window.addEventListener("mousedown",Q),k(e),J(e.firstChild,"enter",Pe),I({...i,current:"shown",previous:i.current})},k=e=>{const{width:s,height:d}=e.style;if(e.offsetWidth===0&&e.offsetHeight===0)return;const u=getComputedStyle(e),O=parseFloat(u.width),U=O>0?e.getBoundingClientRect().width/O:1,R=(ce||1)*U;e.style.width=u.width,e.style.height=u.height;const oe=n.alignElement({anchor:f,anchorAlign:y,element:e,elementAlign:v,offset:T,margin:H,positionMode:B,scale:R}),w=n.positionElement({anchor:f,anchorAlign:y,element:e,elementAlign:v,collisions:P,currentLocation:oe,margin:H,scale:R});if(e.style.top=w.offset.top+"px",e.style.left=w.offset.left+"px",e.style.width=s,e.style.height=d,ee.current={fit:w.fit,fitted:w.fitted,flip:w.flip,flipped:w.flipped},V){const Ee={target:D.current,flipped:w.flipped,fitted:w.fitted};V.call(void 0,Ee)}},Pe=()=>{const e=a.current;e&&(C&&e.classList.add(...p.classNames(p.uPopup.animationContainerShown({c:x})).split(" ").filter(s=>s)),ve(e),W&&W.call(void 0,{target:D.current}))},J=(e,s,d)=>{var O;if(!v)return;let u=_.direction;if(_.type==="slide"){const{horizontal:U,vertical:R}=v;typeof r.animate=="object"&&r.animate.direction?u=_.direction:U==="left"&&R==="center"?u="right":U==="right"&&R==="center"?u="left":R==="top"?u="down":u="up",(O=ee.current)!=null&&O.flipped&&(u={down:"up",up:"down",left:"right",right:"left"}[u])}xe.animations(e,we()[s],s,d,x,_.type,u)},Q=e=>{var u;const s=((u=e==null?void 0:e.target)==null?void 0:u.closest(".k-animation-container"))===null,d=(f==null?void 0:f.contains(e==null?void 0:e.target))||!1;if(s){if(X){const O={target:D.current,event:e,state:o,isAnchorClicked:d};X.call(void 0,O)}window==null||window.removeEventListener("mousedown",Q)}},ye=e=>{if(!C){const s=j&&j.uPopup;e.classList.remove(...p.classNames(p.uPopup.animationContainerShown({c:s})).split(" ").filter(d=>d))}Z()},Y=()=>{i.current==="hiding"&&(i.previous==="shown"||i.previous==="reposition")&&I({...i,current:"hidden",previous:i.current}),G&&G.call(void 0,{target:D.current})},we=()=>{const e=N;let s=0,d=0;return e&&(e===!0?s=d=300:(s=e.openDuration||0,d=e.closeDuration||0)),{enter:s,exit:d}},ve=e=>{Z(),E.current=n.domUtils.scrollableParents(f||e),E.current&&E.current.map(s=>s.addEventListener("scroll",q)),window.addEventListener("resize",q)},Z=()=>{E.current&&(E.current.map(e=>e.removeEventListener("scroll",q)),E.current=void 0),window.removeEventListener("resize",q)},q=ie.throttle(()=>{a.current&&i.current!=="hidden"&&i.current!=="hiding"&&I({...o,current:"reposition",previous:i.current})},ie.FRAME_DURATION),Oe=()=>$?$+ze:Ne,$=p.useZIndexContext()||0,ee=l.useRef(void 0),E=l.useRef(void 0),a=l.useRef(null),D=l.useRef(null),te=l.useRef({}),F=l.useRef(!1);l.useImperativeHandle(D,()=>({element:a.current,setPosition:k,props:r})),l.useImperativeHandle(c,()=>D.current);const i=l.useMemo(()=>{const e={...o,props:{show:C,anchor:f,anchorAlign:y,appendTo:A,collision:P,popupAlign:v,className:S,popupClass:M,style:L,offset:T,contentKey:z}};return C?o.current==="hidden"||o.current==="hiding"?{...e,current:"showing",previous:o.current}:o.current==="showing"?{...e,current:"shown",previous:o.current}:o.current==="shown"&&(!b(T,o.props.offset)||!b(y,o.props.anchorAlign)||!b(A,o.props.appendTo)||!b(P,o.props.collision)||!b(v,o.props.popupAlign)||!b(L,o.props.style)||f!==o.props.anchor||M!==o.props.popupClass||S!==o.props.className)?{...e,current:"reposition",previous:o.current}:e:o.current==="hiding"||o.current==="hidden"?{...e,current:"hidden",previous:o.current}:{...e,current:"hiding",previous:o.current}},[C,f,y,A,P,v,S,M,L,T,z,o]);l.useEffect(()=>{i.current==="hiding"&&!F.current&&a.current?(F.current=!0,ye(a.current),J(a.current.firstChild,"exit",Y)):(F.current=!1,i.current==="showing"&&a.current&&!a.current.classList.contains("k-animation-container-shown")?ge(a.current):i.current==="hiding"&&a.current?Y():i.current==="reposition"&&i.previous==="shown"?setTimeout(()=>{I({...i,current:"shown",previous:i.current})},0):i.current==="shown"&&te.current.contentKey!==z&&a.current&&k(a.current)),i.current==="reposition"&&(i.previous==="shown"||i.previous==="showing")&&a.current&&k(a.current),te.current={contentKey:z}},[i]),l.useEffect(()=>()=>{Z()},[]);const ne=A||(p.canUseDOM?f&&f.ownerDocument?f.ownerDocument.body:document.body:void 0),be=Object.assign({},{position:B,top:0,left:-1e4},L||{}),Ce=m.offset!==void 0&&!b(m.offset,h.offset)||m.margin!==void 0,Ae=i.current==="hiding";if((C||Ae)&&ne){const e=Oe(),s=l.createElement(p.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:fe,className:p.classNames(p.uPopup.animationContainer({c:x}),S),id:de,ref:a,style:{zIndex:e,...be}},l.createElement("div",{className:p.classNames(p.uPopup.animationChild({c:x})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:ae,"aria-labelledby":ue,"aria-describedby":pe,className:p.classNames(p.uPopup.popup({c:x}),M),style:Ce?{margin:0}:void 0},me))));return A!==null?Te.createPortal(s,ne):s}return null}),h={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:Se,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},re={type:"slide",direction:"down"};K.displayName="Popup";K.propTypes={anchor:function(r){const c=r.anchor;return c&&typeof c.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(r){const c=r.appendTo;return c&&typeof c.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:t.oneOfType([t.string,t.arrayOf(t.string.isRequired)]),id:t.string,popupClass:t.oneOfType([t.string,t.arrayOf(t.string),t.object]),collision:t.shape({horizontal:t.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none]),vertical:t.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none])}),anchorAlign:t.shape({horizontal:t.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:t.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),popupAlign:t.shape({horizontal:t.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:t.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),offset:t.shape({left:t.number,top:t.number}),children:t.oneOfType([t.element,t.node]),show:t.bool,animate:t.oneOfType([t.bool,t.shape({type:t.oneOf(["slide","zoom","push","expand","fade"]),openDuration:t.number,closeDuration:t.number})]),margin:t.shape({horizontal:t.number,vertical:t.number}),positionMode:t.oneOf(["fixed","absolute"]),scale:t.number,style:t.object,onClose:t.func,onPosition:t.func,onOpen:t.func,onKeyDown:t.func,onMouseDownOutside:t.func};exports.Popup=K;exports.PopupPropsContext=le;exports.popupDefaultProps=h;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Re=require("react"),xe=require("react-dom"),t=require("prop-types"),Te=require("./animation.js"),p=require("@progress/kendo-react-common"),n=require("@progress/kendo-popup-common"),re=require("./util.js");function ce(r){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const g in r)if(g!=="default"){const m=Object.getOwnPropertyDescriptor(r,g);Object.defineProperty(l,g,m.get?m:{enumerable:!0,get:()=>r[g]})}}return l.default=r,Object.freeze(l)}const s=ce(Re),Ne=ce(xe),le=s.createContext(r=>r),ze=12e3,Se=1;function b(r,l){if(r===l)return!0;if(!!r!=!!l)return!1;const g=Object.getOwnPropertyNames(r),m=Object.getOwnPropertyNames(l);if(g.length!==m.length)return!1;for(let P=0;P<g.length;P++){const y=g[P];if(r[y]!==l[y])return!1}return!0}const Me={left:-1e3,top:0},K=s.forwardRef((r,l)=>{const m=s.useContext(le).call(void 0,r),{collision:P=h.collision,anchorAlign:y=h.anchorAlign,popupAlign:v=h.popupAlign,offset:T=h.offset,animate:N=h.animate,show:A=h.show,margin:H=h.margin,positionMode:B=h.positionMode,appendTo:C,contentKey:z,anchor:f,scale:ae,role:ue,ariaLabelledBy:pe,ariaDescribedBy:fe,onKeyDown:de,onPosition:V,onOpen:W,onMouseDownOutside:X,onClose:G,className:S,popupClass:M,id:me,style:L,children:he}=m,ge=p.useUnstyled(),j=m.unstyled||ge,x=j&&j.uPopup,[o,I]=s.useState({current:"hidden",previous:"hidden",props:{}}),_=N&&typeof N!="object"?se:{...se,...N},Pe=e=>{window==null||window.addEventListener("mousedown",Q),k(e),J(e.firstChild,"enter",ye),I({...i,current:"shown",previous:i.current})},k=e=>{const{width:c,height:d}=e.style;if(e.offsetWidth===0&&e.offsetHeight===0)return;const u=getComputedStyle(e),O=parseFloat(u.width),U=O>0?e.getBoundingClientRect().width/O:1,R=(ae||1)*U;e.style.width=u.width,e.style.height=u.height;const ie=n.alignElement({anchor:f,anchorAlign:y,element:e,elementAlign:v,offset:T,margin:H,positionMode:B,scale:R}),w=n.positionElement({anchor:f,anchorAlign:y,element:e,elementAlign:v,collisions:P,currentLocation:ie,margin:H,scale:R});if(e.style.top=w.offset.top+"px",e.style.left=w.offset.left+"px",e.style.width=c,e.style.height=d,ee.current={fit:w.fit,fitted:w.fitted,flip:w.flip,flipped:w.flipped},V){const De={target:D.current,flipped:w.flipped,fitted:w.fitted};V.call(void 0,De)}},ye=()=>{const e=a.current;e&&(A&&e.classList.add(...p.classNames(p.uPopup.animationContainerShown({c:x})).split(" ").filter(c=>c)),Oe(e),W&&W.call(void 0,{target:D.current}))},J=(e,c,d)=>{var O;if(!v)return;let u=_.direction;if(_.type==="slide"){const{horizontal:U,vertical:R}=v;typeof r.animate=="object"&&r.animate.direction?u=_.direction:U==="left"&&R==="center"?u="right":U==="right"&&R==="center"?u="left":R==="top"?u="down":u="up",(O=ee.current)!=null&&O.flipped&&(u={down:"up",up:"down",left:"right",right:"left"}[u])}ne.current=Te.animations(e,ve()[c],c,d,x,_.type,u)},Q=e=>{var u;const c=((u=e==null?void 0:e.target)==null?void 0:u.closest(".k-animation-container"))===null,d=(f==null?void 0:f.contains(e==null?void 0:e.target))||!1;if(c){if(X){const O={target:D.current,event:e,state:o,isAnchorClicked:d};X.call(void 0,O)}window==null||window.removeEventListener("mousedown",Q)}},we=e=>{if(!A){const c=j&&j.uPopup;e.classList.remove(...p.classNames(p.uPopup.animationContainerShown({c})).split(" ").filter(d=>d))}Z()},Y=()=>{i.current==="hiding"&&(i.previous==="shown"||i.previous==="reposition")&&I({...i,current:"hidden",previous:i.current}),G&&G.call(void 0,{target:D.current})},ve=()=>{const e=N;let c=0,d=0;return e&&(e===!0?c=d=300:(c=e.openDuration||0,d=e.closeDuration||0)),{enter:c,exit:d}},Oe=e=>{Z(),E.current=n.domUtils.scrollableParents(f||e),E.current&&E.current.map(c=>c.addEventListener("scroll",q)),window.addEventListener("resize",q)},Z=()=>{E.current&&(E.current.map(e=>e.removeEventListener("scroll",q)),E.current=void 0),window.removeEventListener("resize",q)},q=re.throttle(()=>{a.current&&i.current!=="hidden"&&i.current!=="hiding"&&I({...o,current:"reposition",previous:i.current})},re.FRAME_DURATION),be=()=>$?$+Se:ze,$=p.useZIndexContext()||0,ee=s.useRef(void 0),E=s.useRef(void 0),a=s.useRef(null),D=s.useRef(null),te=s.useRef({}),F=s.useRef(!1),ne=s.useRef(()=>{});s.useImperativeHandle(D,()=>({element:a.current,setPosition:k,props:r})),s.useImperativeHandle(l,()=>D.current);const i=s.useMemo(()=>{const e={...o,props:{show:A,anchor:f,anchorAlign:y,appendTo:C,collision:P,popupAlign:v,className:S,popupClass:M,style:L,offset:T,contentKey:z}};return A?o.current==="hidden"||o.current==="hiding"?{...e,current:"showing",previous:o.current}:o.current==="showing"?{...e,current:"shown",previous:o.current}:o.current==="shown"&&(!b(T,o.props.offset)||!b(y,o.props.anchorAlign)||!b(C,o.props.appendTo)||!b(P,o.props.collision)||!b(v,o.props.popupAlign)||!b(L,o.props.style)||f!==o.props.anchor||M!==o.props.popupClass||S!==o.props.className)?{...e,current:"reposition",previous:o.current}:e:o.current==="hiding"||o.current==="hidden"?{...e,current:"hidden",previous:o.current}:{...e,current:"hiding",previous:o.current}},[A,f,y,C,P,v,S,M,L,T,z,o]);s.useEffect(()=>{i.current==="hiding"&&!F.current&&a.current?(F.current=!0,we(a.current),J(a.current.firstChild,"exit",Y)):(F.current=!1,i.current==="showing"&&a.current&&!a.current.classList.contains("k-animation-container-shown")?Pe(a.current):i.current==="hiding"&&a.current?Y():i.current==="reposition"&&i.previous==="shown"?setTimeout(()=>{I({...i,current:"shown",previous:i.current})},0):i.current==="shown"&&te.current.contentKey!==z&&a.current&&k(a.current)),i.current==="reposition"&&(i.previous==="shown"||i.previous==="showing")&&a.current&&k(a.current),te.current={contentKey:z}},[i]),s.useEffect(()=>()=>{ne.current(),Z()},[]);const oe=C||(p.canUseDOM?f&&f.ownerDocument?f.ownerDocument.body:document.body:void 0),Ae=Object.assign({},{position:B,top:0,left:-1e4},L||{}),Ce=m.offset!==void 0&&!b(m.offset,h.offset)||m.margin!==void 0,Ee=i.current==="hiding";if((A||Ee)&&oe){const e=be(),c=s.createElement(p.ZIndexContext.Provider,{value:e},s.createElement("div",{onKeyDown:de,className:p.classNames(p.uPopup.animationContainer({c:x}),S),id:me,ref:a,style:{zIndex:e,...Ae}},s.createElement("div",{className:p.classNames(p.uPopup.animationChild({c:x})),style:{transitionDelay:"0ms"}},s.createElement("div",{role:ue,"aria-labelledby":pe,"aria-describedby":fe,className:p.classNames(p.uPopup.popup({c:x}),M),style:Ce?{margin:0}:void 0},he))));return C!==null?Ne.createPortal(c,oe):c}return null}),h={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:Me,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},se={type:"slide",direction:"down"};K.displayName="Popup";K.propTypes={anchor:function(r){const l=r.anchor;return l&&typeof l.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(r){const l=r.appendTo;return l&&typeof l.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:t.oneOfType([t.string,t.arrayOf(t.string.isRequired)]),id:t.string,popupClass:t.oneOfType([t.string,t.arrayOf(t.string),t.object]),collision:t.shape({horizontal:t.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none]),vertical:t.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none])}),anchorAlign:t.shape({horizontal:t.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:t.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),popupAlign:t.shape({horizontal:t.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:t.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),offset:t.shape({left:t.number,top:t.number}),children:t.oneOfType([t.element,t.node]),show:t.bool,animate:t.oneOfType([t.bool,t.shape({type:t.oneOf(["slide","zoom","push","expand","fade"]),openDuration:t.number,closeDuration:t.number})]),margin:t.shape({horizontal:t.number,vertical:t.number}),positionMode:t.oneOf(["fixed","absolute"]),scale:t.number,style:t.object,onClose:t.func,onPosition:t.func,onOpen:t.func,onKeyDown:t.func,onMouseDownOutside:t.func};exports.Popup=K;exports.PopupPropsContext=le;exports.popupDefaultProps=h;
package/Popup.mjs CHANGED
@@ -5,14 +5,14 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as i from "react";
9
- import * as Ae from "react-dom";
8
+ import * as r from "react";
9
+ import * as De from "react-dom";
10
10
  import t from "prop-types";
11
- import { animations as De } from "./animation.mjs";
12
- import { useUnstyled as xe, useZIndexContext as Re, canUseDOM as Te, ZIndexContext as ze, classNames as R, uPopup as T } from "@progress/kendo-react-common";
13
- import { Collision as w, AlignPoint as s, alignElement as Ne, positionElement as Le, domUtils as Ie } from "@progress/kendo-popup-common";
14
- import { throttle as Se, FRAME_DURATION as Me } from "./util.mjs";
15
- const Ue = i.createContext((c) => c), je = 12e3, ke = 1;
11
+ import { animations as xe } from "./animation.mjs";
12
+ import { useUnstyled as Re, useZIndexContext as Te, canUseDOM as ze, ZIndexContext as Ne, classNames as R, uPopup as T } from "@progress/kendo-react-common";
13
+ import { Collision as w, AlignPoint as s, alignElement as Le, positionElement as Ie, domUtils as Se } from "@progress/kendo-popup-common";
14
+ import { throttle as Me, FRAME_DURATION as Ue } from "./util.mjs";
15
+ const je = r.createContext((c) => c), ke = 12e3, Ze = 1;
16
16
  function O(c, u) {
17
17
  if (c === u)
18
18
  return !0;
@@ -28,11 +28,11 @@ function O(c, u) {
28
28
  }
29
29
  return !0;
30
30
  }
31
- const Ze = {
31
+ const Fe = {
32
32
  left: -1e3,
33
33
  top: 0
34
- }, se = i.forwardRef((c, u) => {
35
- const v = i.useContext(Ue).call(void 0, c), {
34
+ }, ce = r.forwardRef((c, u) => {
35
+ const v = r.useContext(je).call(void 0, c), {
36
36
  collision: m = d.collision,
37
37
  anchorAlign: h = d.anchorAlign,
38
38
  popupAlign: y = d.popupAlign,
@@ -44,33 +44,33 @@ const Ze = {
44
44
  appendTo: C,
45
45
  contentKey: I,
46
46
  anchor: p,
47
- scale: ce,
48
- role: le,
49
- ariaLabelledBy: ae,
50
- ariaDescribedBy: ue,
51
- onKeyDown: pe,
47
+ scale: le,
48
+ role: ae,
49
+ ariaLabelledBy: ue,
50
+ ariaDescribedBy: pe,
51
+ onKeyDown: fe,
52
52
  onPosition: W,
53
53
  onOpen: X,
54
54
  onMouseDownOutside: G,
55
55
  onClose: J,
56
56
  className: S,
57
57
  popupClass: M,
58
- id: fe,
58
+ id: de,
59
59
  style: U,
60
- children: de
61
- } = v, me = xe(), j = v.unstyled || me, x = j && j.uPopup, [n, k] = i.useState({
60
+ children: me
61
+ } = v, he = Re(), j = v.unstyled || he, x = j && j.uPopup, [n, k] = r.useState({
62
62
  current: "hidden",
63
63
  previous: "hidden",
64
64
  props: {}
65
- }), Z = L && typeof L != "object" ? ie : { ...ie, ...L }, he = (e) => {
66
- window == null || window.addEventListener("mousedown", Y), F(e), Q(e.firstChild, "enter", ge), k({ ...o, current: "shown", previous: o.current });
65
+ }), Z = L && typeof L != "object" ? se : { ...se, ...L }, ge = (e) => {
66
+ window == null || window.addEventListener("mousedown", Y), F(e), Q(e.firstChild, "enter", we), k({ ...o, current: "shown", previous: o.current });
67
67
  }, F = (e) => {
68
- const { width: r, height: f } = e.style;
68
+ const { width: i, height: f } = e.style;
69
69
  if (e.offsetWidth === 0 && e.offsetHeight === 0)
70
70
  return;
71
- const a = getComputedStyle(e), P = parseFloat(a.width), _ = P > 0 ? e.getBoundingClientRect().width / P : 1, D = (ce || 1) * _;
71
+ const a = getComputedStyle(e), P = parseFloat(a.width), _ = P > 0 ? e.getBoundingClientRect().width / P : 1, D = (le || 1) * _;
72
72
  e.style.width = a.width, e.style.height = a.height;
73
- const re = Ne({
73
+ const ie = Le({
74
74
  anchor: p,
75
75
  anchorAlign: h,
76
76
  element: e,
@@ -79,35 +79,35 @@ const Ze = {
79
79
  margin: q,
80
80
  positionMode: V,
81
81
  scale: D
82
- }), g = Le({
82
+ }), g = Ie({
83
83
  anchor: p,
84
84
  anchorAlign: h,
85
85
  element: e,
86
86
  elementAlign: y,
87
87
  collisions: m,
88
- currentLocation: re,
88
+ currentLocation: ie,
89
89
  margin: q,
90
90
  scale: D
91
91
  });
92
- if (e.style.top = g.offset.top + "px", e.style.left = g.offset.left + "px", e.style.width = r, e.style.height = f, te.current = {
92
+ if (e.style.top = g.offset.top + "px", e.style.left = g.offset.left + "px", e.style.width = i, e.style.height = f, te.current = {
93
93
  fit: g.fit,
94
94
  fitted: g.fitted,
95
95
  flip: g.flip,
96
96
  flipped: g.flipped
97
97
  }, W) {
98
- const Ee = {
98
+ const Ae = {
99
99
  target: A.current,
100
100
  flipped: g.flipped,
101
101
  fitted: g.fitted
102
102
  };
103
- W.call(void 0, Ee);
103
+ W.call(void 0, Ae);
104
104
  }
105
- }, ge = () => {
105
+ }, we = () => {
106
106
  const e = l.current;
107
107
  e && (b && e.classList.add(
108
- ...R(T.animationContainerShown({ c: x })).split(" ").filter((r) => r)
109
- ), ye(e), X && X.call(void 0, { target: A.current }));
110
- }, Q = (e, r, f) => {
108
+ ...R(T.animationContainerShown({ c: x })).split(" ").filter((i) => i)
109
+ ), Pe(e), X && X.call(void 0, { target: A.current }));
110
+ }, Q = (e, i, f) => {
111
111
  var P;
112
112
  if (!y)
113
113
  return;
@@ -121,10 +121,10 @@ const Ze = {
121
121
  right: "left"
122
122
  }[a]);
123
123
  }
124
- De(
124
+ oe.current = xe(
125
125
  e,
126
- ve()[r],
127
- r,
126
+ ye()[i],
127
+ i,
128
128
  f,
129
129
  x,
130
130
  Z.type,
@@ -132,8 +132,8 @@ const Ze = {
132
132
  );
133
133
  }, Y = (e) => {
134
134
  var a;
135
- const r = ((a = e == null ? void 0 : e.target) == null ? void 0 : a.closest(".k-animation-container")) === null, f = (p == null ? void 0 : p.contains(e == null ? void 0 : e.target)) || !1;
136
- if (r) {
135
+ const i = ((a = e == null ? void 0 : e.target) == null ? void 0 : a.closest(".k-animation-container")) === null, f = (p == null ? void 0 : p.contains(e == null ? void 0 : e.target)) || !1;
136
+ if (i) {
137
137
  if (G) {
138
138
  const P = {
139
139
  target: A.current,
@@ -145,33 +145,34 @@ const Ze = {
145
145
  }
146
146
  window == null || window.removeEventListener("mousedown", Y);
147
147
  }
148
- }, we = (e) => {
148
+ }, ve = (e) => {
149
149
  if (!b) {
150
- const r = j && j.uPopup;
150
+ const i = j && j.uPopup;
151
151
  e.classList.remove(
152
- ...R(T.animationContainerShown({ c: r })).split(" ").filter((f) => f)
152
+ ...R(T.animationContainerShown({ c: i })).split(" ").filter((f) => f)
153
153
  );
154
154
  }
155
155
  H();
156
156
  }, $ = () => {
157
157
  o.current === "hiding" && (o.previous === "shown" || o.previous === "reposition") && k({ ...o, current: "hidden", previous: o.current }), J && J.call(void 0, { target: A.current });
158
- }, ve = () => {
158
+ }, ye = () => {
159
159
  const e = L;
160
- let r = 0, f = 0;
161
- return e && (e === !0 ? r = f = 300 : (r = e.openDuration || 0, f = e.closeDuration || 0)), { enter: r, exit: f };
162
- }, ye = (e) => {
163
- H(), E.current = Ie.scrollableParents(p || e), E.current && E.current.map((r) => r.addEventListener("scroll", K)), window.addEventListener("resize", K);
160
+ let i = 0, f = 0;
161
+ return e && (e === !0 ? i = f = 300 : (i = e.openDuration || 0, f = e.closeDuration || 0)), { enter: i, exit: f };
162
+ }, Pe = (e) => {
163
+ H(), E.current = Se.scrollableParents(p || e), E.current && E.current.map((i) => i.addEventListener("scroll", K)), window.addEventListener("resize", K);
164
164
  }, H = () => {
165
165
  E.current && (E.current.map((e) => e.removeEventListener("scroll", K)), E.current = void 0), window.removeEventListener("resize", K);
166
- }, K = Se(() => {
166
+ }, K = Me(() => {
167
167
  l.current && o.current !== "hidden" && o.current !== "hiding" && k({ ...n, current: "reposition", previous: o.current });
168
- }, Me), Pe = () => ee ? ee + ke : je, ee = Re() || 0, te = i.useRef(void 0), E = i.useRef(void 0), l = i.useRef(null), A = i.useRef(null), ne = i.useRef({}), B = i.useRef(!1);
169
- i.useImperativeHandle(A, () => ({
168
+ }, Ue), Oe = () => ee ? ee + Ze : ke, ee = Te() || 0, te = r.useRef(void 0), E = r.useRef(void 0), l = r.useRef(null), A = r.useRef(null), ne = r.useRef({}), B = r.useRef(!1), oe = r.useRef(() => {
169
+ });
170
+ r.useImperativeHandle(A, () => ({
170
171
  element: l.current,
171
172
  setPosition: F,
172
173
  props: c
173
- })), i.useImperativeHandle(u, () => A.current);
174
- const o = i.useMemo(() => {
174
+ })), r.useImperativeHandle(u, () => A.current);
175
+ const o = r.useMemo(() => {
175
176
  const e = {
176
177
  ...n,
177
178
  props: {
@@ -203,51 +204,51 @@ const Ze = {
203
204
  I,
204
205
  n
205
206
  ]);
206
- i.useEffect(() => {
207
- o.current === "hiding" && !B.current && l.current ? (B.current = !0, we(l.current), Q(l.current.firstChild, "exit", $)) : (B.current = !1, o.current === "showing" && l.current && !l.current.classList.contains("k-animation-container-shown") ? he(l.current) : o.current === "hiding" && l.current ? $() : o.current === "reposition" && o.previous === "shown" ? setTimeout(() => {
207
+ r.useEffect(() => {
208
+ o.current === "hiding" && !B.current && l.current ? (B.current = !0, ve(l.current), Q(l.current.firstChild, "exit", $)) : (B.current = !1, o.current === "showing" && l.current && !l.current.classList.contains("k-animation-container-shown") ? ge(l.current) : o.current === "hiding" && l.current ? $() : o.current === "reposition" && o.previous === "shown" ? setTimeout(() => {
208
209
  k({ ...o, current: "shown", previous: o.current });
209
210
  }, 0) : o.current === "shown" && ne.current.contentKey !== I && l.current && F(l.current)), o.current === "reposition" && (o.previous === "shown" || o.previous === "showing") && l.current && F(l.current), ne.current = { contentKey: I };
210
- }, [o]), i.useEffect(() => () => {
211
- H();
211
+ }, [o]), r.useEffect(() => () => {
212
+ oe.current(), H();
212
213
  }, []);
213
- const oe = C || (Te ? p && p.ownerDocument ? p.ownerDocument.body : document.body : void 0), Oe = Object.assign(
214
+ const re = C || (ze ? p && p.ownerDocument ? p.ownerDocument.body : document.body : void 0), be = Object.assign(
214
215
  {},
215
216
  { position: V, top: 0, left: -1e4 },
216
217
  U || {}
217
- ), be = v.offset !== void 0 && !O(v.offset, d.offset) || v.margin !== void 0, Ce = o.current === "hiding";
218
- if ((b || Ce) && oe) {
219
- const e = Pe(), r = /* @__PURE__ */ i.createElement(ze.Provider, { value: e }, /* @__PURE__ */ i.createElement(
218
+ ), Ce = v.offset !== void 0 && !O(v.offset, d.offset) || v.margin !== void 0, Ee = o.current === "hiding";
219
+ if ((b || Ee) && re) {
220
+ const e = Oe(), i = /* @__PURE__ */ r.createElement(Ne.Provider, { value: e }, /* @__PURE__ */ r.createElement(
220
221
  "div",
221
222
  {
222
- onKeyDown: pe,
223
+ onKeyDown: fe,
223
224
  className: R(T.animationContainer({ c: x }), S),
224
- id: fe,
225
+ id: de,
225
226
  ref: l,
226
227
  style: {
227
228
  zIndex: e,
228
- ...Oe
229
+ ...be
229
230
  }
230
231
  },
231
- /* @__PURE__ */ i.createElement(
232
+ /* @__PURE__ */ r.createElement(
232
233
  "div",
233
234
  {
234
235
  className: R(T.animationChild({ c: x })),
235
236
  style: { transitionDelay: "0ms" }
236
237
  },
237
- /* @__PURE__ */ i.createElement(
238
+ /* @__PURE__ */ r.createElement(
238
239
  "div",
239
240
  {
240
- role: le,
241
- "aria-labelledby": ae,
242
- "aria-describedby": ue,
241
+ role: ae,
242
+ "aria-labelledby": ue,
243
+ "aria-describedby": pe,
243
244
  className: R(T.popup({ c: x }), M),
244
- style: be ? { margin: 0 } : void 0
245
+ style: Ce ? { margin: 0 } : void 0
245
246
  },
246
- de
247
+ me
247
248
  )
248
249
  )
249
250
  ));
250
- return C !== null ? Ae.createPortal(r, oe) : r;
251
+ return C !== null ? De.createPortal(i, re) : i;
251
252
  }
252
253
  return null;
253
254
  }), d = {
@@ -263,7 +264,7 @@ const Ze = {
263
264
  horizontal: s.left,
264
265
  vertical: s.top
265
266
  },
266
- offset: Ze,
267
+ offset: Fe,
267
268
  animate: !0,
268
269
  show: !1,
269
270
  margin: {
@@ -271,12 +272,12 @@ const Ze = {
271
272
  vertical: 0
272
273
  },
273
274
  positionMode: "absolute"
274
- }, ie = {
275
+ }, se = {
275
276
  type: "slide",
276
277
  direction: "down"
277
278
  };
278
- se.displayName = "Popup";
279
- se.propTypes = {
279
+ ce.displayName = "Popup";
280
+ ce.propTypes = {
280
281
  anchor: function(c) {
281
282
  const u = c.anchor;
282
283
  return u && typeof u.nodeType != "number" ? new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed.") : null;
@@ -328,7 +329,7 @@ se.propTypes = {
328
329
  onMouseDownOutside: t.func
329
330
  };
330
331
  export {
331
- se as Popup,
332
- Ue as PopupPropsContext,
332
+ ce as Popup,
333
+ je as PopupPropsContext,
333
334
  d as popupDefaultProps
334
335
  };
package/animation.d.ts CHANGED
@@ -9,4 +9,4 @@ import { PopupAnimationType, PopupAnimationDirection } from './models/PopupAnima
9
9
  /**
10
10
  * @hidden
11
11
  */
12
- export declare const animations: (element: HTMLElement, duration: number, type: 'enter' | 'exit', callback: Function, popupClasses: any, animationType: PopupAnimationType, direction?: PopupAnimationDirection) => any;
12
+ export declare const animations: (element: HTMLElement, duration: number, type: 'enter' | 'exit', callback: Function, popupClasses: any, animationType: PopupAnimationType, direction?: PopupAnimationDirection) => () => void;
package/animation.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@progress/kendo-react-common"),y=(i,s,t)=>{i.style.transitionDuration="",s&&i.classList.remove(...s.split(" ")),t&&i.classList.remove(...t.split(" "))},p=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),L=(i,s,t,c,f,u,d)=>{if(s===0)return c();const m=`${u}Active`,o=a.classNames(a.uPopup[u]({direction:d,type:t,c:f})),r=a.classNames(a.uPopup[m]({direction:d,type:t,c:f})),l=n=>{n.target===i&&(i.removeEventListener("transitionend",l),y(i,o,r),t==="exit"?i.style.display="none":i.style.display="",c())};i.addEventListener("transitionend",l);const v=i.ownerDocument;if(!v)return;const e=v.defaultView;if(!e)return;const w=()=>{y(i,o,r),t==="enter"&&(i.style.display=""),o&&i.classList.add(...o.split(" ").filter(n=>n)),e.requestAnimationFrame(()=>{i.style.transitionDuration=s+"ms",i.classList.add(...r.split(" ").filter(n=>n))})};p?e.requestAnimationFrame(w):w()};exports.animations=L;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@progress/kendo-react-common"),F=(i,t,s)=>{i.style.transitionDuration="",t&&i.classList.remove(...t.split(" ")),s&&i.classList.remove(...s.split(" "))},E=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),P=50,c=new WeakMap,q=i=>{var t;(t=c.get(i))==null||t()},x=(i,t,s,l,m,p,A)=>{var y;if(q(i),t===0)return l(),()=>{};const L=`${p}Active`,o=e.classNames(e.uPopup[p]({direction:A,type:s,c:m})),f=e.classNames(e.uPopup[L]({direction:A,type:s,c:m})),a=(y=i.ownerDocument)==null?void 0:y.defaultView;if(!a)return()=>{};let u=!1;const d=[],r=()=>{u||(u=!0,i.removeEventListener("transitionend",v),a.clearTimeout(h),d.forEach(n=>a.cancelAnimationFrame(n)),F(i,o,f),c.get(i)===r&&c.delete(i))},g=()=>{u||(r(),s==="exit"?i.style.display="none":i.style.display="",l())},v=n=>{n.target===i&&g()};i.addEventListener("transitionend",v);const h=a.setTimeout(g,t+P);c.set(i,r);const w=()=>{F(i,o,f),s==="enter"&&(i.style.display=""),o&&i.classList.add(...o.split(" ").filter(n=>n)),d.push(a.requestAnimationFrame(()=>{i.style.transitionDuration=t+"ms",i.classList.add(...f.split(" ").filter(n=>n))}))};return E?d.push(a.requestAnimationFrame(w)):w(),r};exports.animations=x;
package/animation.mjs CHANGED
@@ -5,29 +5,41 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { classNames as l, uPopup as p } from "@progress/kendo-react-common";
9
- const y = (i, s, t) => {
10
- i.style.transitionDuration = "", s && i.classList.remove(...s.split(" ")), t && i.classList.remove(...t.split(" "));
11
- }, A = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), x = (i, s, t, f, c, e, d) => {
12
- if (s === 0)
13
- return f();
14
- const L = `${e}Active`, o = l(p[e]({ direction: d, type: t, c })), r = l(p[L]({ direction: d, type: t, c })), u = (n) => {
15
- n.target === i && (i.removeEventListener("transitionend", u), y(i, o, r), t === "exit" ? i.style.display = "none" : i.style.display = "", f());
16
- };
17
- i.addEventListener("transitionend", u);
18
- const v = i.ownerDocument;
19
- if (!v)
20
- return;
21
- const a = v.defaultView;
8
+ import { classNames as L, uPopup as g } from "@progress/kendo-react-common";
9
+ const y = (i, t, s) => {
10
+ i.style.transitionDuration = "", t && i.classList.remove(...t.split(" ")), s && i.classList.remove(...s.split(" "));
11
+ }, E = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), D = 50, c = /* @__PURE__ */ new WeakMap(), q = (i) => {
12
+ var t;
13
+ (t = c.get(i)) == null || t();
14
+ }, P = (i, t, s, u, l, p, A) => {
15
+ var F;
16
+ if (q(i), t === 0)
17
+ return u(), () => {
18
+ };
19
+ const h = `${p}Active`, o = L(g[p]({ direction: A, type: s, c: l })), e = L(g[h]({ direction: A, type: s, c: l })), a = (F = i.ownerDocument) == null ? void 0 : F.defaultView;
22
20
  if (!a)
23
- return;
21
+ return () => {
22
+ };
23
+ let f = !1;
24
+ const d = [], r = () => {
25
+ f || (f = !0, i.removeEventListener("transitionend", v), a.clearTimeout(x), d.forEach((n) => a.cancelAnimationFrame(n)), y(i, o, e), c.get(i) === r && c.delete(i));
26
+ }, m = () => {
27
+ f || (r(), s === "exit" ? i.style.display = "none" : i.style.display = "", u());
28
+ }, v = (n) => {
29
+ n.target === i && m();
30
+ };
31
+ i.addEventListener("transitionend", v);
32
+ const x = a.setTimeout(m, t + D);
33
+ c.set(i, r);
24
34
  const w = () => {
25
- y(i, o, r), t === "enter" && (i.style.display = ""), o && i.classList.add(...o.split(" ").filter((n) => n)), a.requestAnimationFrame(() => {
26
- i.style.transitionDuration = s + "ms", i.classList.add(...r.split(" ").filter((n) => n));
27
- });
35
+ y(i, o, e), s === "enter" && (i.style.display = ""), o && i.classList.add(...o.split(" ").filter((n) => n)), d.push(
36
+ a.requestAnimationFrame(() => {
37
+ i.style.transitionDuration = t + "ms", i.classList.add(...e.split(" ").filter((n) => n));
38
+ })
39
+ );
28
40
  };
29
- A ? a.requestAnimationFrame(w) : w();
41
+ return E ? d.push(a.requestAnimationFrame(w)) : w(), r;
30
42
  };
31
43
  export {
32
- x as animations
44
+ P as animations
33
45
  };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(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"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPopup={},e.React,e.ReactDOM,e.PropTypes,e.KendoReactCommon,e.KendoPopupCommon)}(this,function(e,n,t,o,i,r){"use strict";function s(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var l=s(n),c=s(t);const a=(e,n,t)=>{e.style.transitionDuration="",n&&e.classList.remove(...n.split(" ")),t&&e.classList.remove(...t.split(" "))},u="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),p=(e,n,t,o,r,s,l)=>{if(0===n)return o();const c=`${s}Active`,p=i.classNames(i.uPopup[s]({direction:l,type:t,c:r})),d=i.classNames(i.uPopup[c]({direction:l,type:t,c:r})),f=n=>{n.target===e&&(e.removeEventListener("transitionend",f),a(e,p,d),e.style.display="exit"===t?"none":"",o())};e.addEventListener("transitionend",f);const m=e.ownerDocument;if(!m)return;const h=m.defaultView;if(!h)return;const g=()=>{a(e,p,d),"enter"===t&&(e.style.display=""),p&&e.classList.add(...p.split(" ").filter(e=>e)),h.requestAnimationFrame(()=>{e.style.transitionDuration=n+"ms",e.classList.add(...d.split(" ").filter(e=>e))})};u?h.requestAnimationFrame(g):g()},d=l.createContext(e=>e);function f(e,n){if(e===n)return!0;if(!!e!=!!n)return!1;const t=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(n);if(t.length!==o.length)return!1;for(let o=0;o<t.length;o++){const i=t[o];if(e[i]!==n[i])return!1}return!0}const m=l.forwardRef((e,n)=>{const t=l.useContext(d).call(void 0,e),{collision:o=h.collision,anchorAlign:s=h.anchorAlign,popupAlign:a=h.popupAlign,offset:u=h.offset,animate:m=h.animate,show:v=h.show,margin:y=h.margin,positionMode:w=h.positionMode,appendTo:P,contentKey:b,anchor:A,scale:O,role:C,ariaLabelledBy:D,ariaDescribedBy:T,onKeyDown:x,onPosition:E,onOpen:L,onMouseDownOutside:N,onClose:R,className:z,popupClass:j,id:K,style:M,children:k}=t,q=i.useUnstyled(),I=t.unstyled||q,F=I&&I.uPopup,[S,B]=l.useState({current:"hidden",previous:"hidden",props:{}}),H=m&&"object"!=typeof m?g:{...g,...m},U=e=>{const{width:n,height:t}=e.style;if(0===e.offsetWidth&&0===e.offsetHeight)return;const i=getComputedStyle(e),l=parseFloat(i.width),c=l>0?e.getBoundingClientRect().width/l:1,p=(O||1)*c;e.style.width=i.width,e.style.height=i.height;const d=r.alignElement({anchor:A,anchorAlign:s,element:e,elementAlign:a,offset:u,margin:y,positionMode:w,scale:p}),f=r.positionElement({anchor:A,anchorAlign:s,element:e,elementAlign:a,collisions:o,currentLocation:d,margin:y,scale:p});if(e.style.top=f.offset.top+"px",e.style.left=f.offset.left+"px",e.style.width=n,e.style.height=t,_.current={fit:f.fit,fitted:f.fitted,flip:f.flip,flipped:f.flipped},E){const e={target:te.current,flipped:f.flipped,fitted:f.fitted};E.call(void 0,e)}},V=()=>{const e=ne.current;e&&(v&&e.classList.add(...i.classNames(i.uPopup.animationContainerShown({c:F})).split(" ").filter(e=>e)),J(e),L&&L.call(void 0,{target:te.current}))},Z=(n,t,o)=>{var i;if(!a)return;let r=H.direction;if("slide"===H.type){const{horizontal:n,vertical:t}=a;r="object"==typeof e.animate&&e.animate.direction?H.direction:"left"===n&&"center"===t?"right":"right"===n&&"center"===t?"left":"top"===t?"down":"up",null!=(i=_.current)&&i.flipped&&(r={down:"up",up:"down",left:"right",right:"left"}[r])}p(n,G()[t],t,o,F,H.type,r)},W=e=>{var n;const t=null===(null==(n=null==e?void 0:e.target)?void 0:n.closest(".k-animation-container")),o=(null==A?void 0:A.contains(null==e?void 0:e.target))||!1;if(t){if(N){const n={target:te.current,event:e,state:S,isAnchorClicked:o};N.call(void 0,n)}null==window||window.removeEventListener("mousedown",W)}},$=()=>{"hiding"===re.current&&("shown"===re.previous||"reposition"===re.previous)&&B({...re,current:"hidden",previous:re.current}),R&&R.call(void 0,{target:te.current})},G=()=>{const e=m;let n=0,t=0;return e&&(!0===e?n=t=300:(n=e.openDuration||0,t=e.closeDuration||0)),{enter:n,exit:t}},J=e=>{Q(),ee.current=r.domUtils.scrollableParents(A||e),ee.current&&ee.current.map(e=>e.addEventListener("scroll",X)),window.addEventListener("resize",X)},Q=()=>{ee.current&&(ee.current.map(e=>e.removeEventListener("scroll",X)),ee.current=void 0),window.removeEventListener("resize",X)},X=function(e,n,t={}){let o,i,r,s,l=0;t=t||{};const c=function(){l=!1===t.leading?0:(new Date).getTime(),o=void 0,s=e.apply(i,r),o||(i=r=null)};return function(){const a=(new Date).getTime();!l&&!1===t.leading&&(l=a);const u=n-(a-l);return i=void 0,r=arguments,u<=0||u>n?(o&&(clearTimeout(o),o=void 0),l=a,s=e.apply(i,r),o||(i=r=null)):!o&&!1!==t.trailing&&(o=window.setTimeout(c,u)),s}}(()=>{ne.current&&"hidden"!==re.current&&"hiding"!==re.current&&B({...S,current:"reposition",previous:re.current})},16.666666666666668),Y=i.useZIndexContext()||0,_=l.useRef(void 0),ee=l.useRef(void 0),ne=l.useRef(null),te=l.useRef(null),oe=l.useRef({}),ie=l.useRef(!1);l.useImperativeHandle(te,()=>({element:ne.current,setPosition:U,props:e})),l.useImperativeHandle(n,()=>te.current);const re=l.useMemo(()=>{const e={...S,props:{show:v,anchor:A,anchorAlign:s,appendTo:P,collision:o,popupAlign:a,className:z,popupClass:j,style:M,offset:u,contentKey:b}};return v?"hidden"===S.current||"hiding"===S.current?{...e,current:"showing",previous:S.current}:"showing"===S.current?{...e,current:"shown",previous:S.current}:"shown"!==S.current||f(u,S.props.offset)&&f(s,S.props.anchorAlign)&&f(P,S.props.appendTo)&&f(o,S.props.collision)&&f(a,S.props.popupAlign)&&f(M,S.props.style)&&A===S.props.anchor&&j===S.props.popupClass&&z===S.props.className?e:{...e,current:"reposition",previous:S.current}:"hiding"===S.current||"hidden"===S.current?{...e,current:"hidden",previous:S.current}:{...e,current:"hiding",previous:S.current}},[v,A,s,P,o,a,z,j,M,u,b,S]);l.useEffect(()=>{var e;"hiding"===re.current&&!ie.current&&ne.current?(ie.current=!0,(e=>{if(!v){const n=I&&I.uPopup;e.classList.remove(...i.classNames(i.uPopup.animationContainerShown({c:n})).split(" ").filter(e=>e))}Q()})(ne.current),Z(ne.current.firstChild,"exit",$)):(ie.current=!1,"showing"===re.current&&ne.current&&!ne.current.classList.contains("k-animation-container-shown")?(e=ne.current,null==window||window.addEventListener("mousedown",W),U(e),Z(e.firstChild,"enter",V),B({...re,current:"shown",previous:re.current})):"hiding"===re.current&&ne.current?$():"reposition"===re.current&&"shown"===re.previous?setTimeout(()=>{B({...re,current:"shown",previous:re.current})},0):"shown"===re.current&&oe.current.contentKey!==b&&ne.current&&U(ne.current)),"reposition"===re.current&&("shown"===re.previous||"showing"===re.previous)&&ne.current&&U(ne.current),oe.current={contentKey:b}},[re]),l.useEffect(()=>()=>{Q()},[]);const se=P||(i.canUseDOM?A&&A.ownerDocument?A.ownerDocument.body:document.body:void 0),le=Object.assign({},{position:w,top:0,left:-1e4},M||{}),ce=void 0!==t.offset&&!f(t.offset,h.offset)||void 0!==t.margin,ae="hiding"===re.current;if((v||ae)&&se){const e=Y?Y+1:12e3,n=l.createElement(i.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:x,className:i.classNames(i.uPopup.animationContainer({c:F}),z),id:K,ref:ne,style:{zIndex:e,...le}},l.createElement("div",{className:i.classNames(i.uPopup.animationChild({c:F})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:C,"aria-labelledby":D,"aria-describedby":T,className:i.classNames(i.uPopup.popup({c:F}),j),style:ce?{margin:0}:void 0},k))));return null!==P?c.createPortal(n,se):n}return null}),h={collision:{horizontal:r.Collision.fit,vertical:r.Collision.flip},anchorAlign:{horizontal:r.AlignPoint.left,vertical:r.AlignPoint.bottom},popupAlign:{horizontal:r.AlignPoint.left,vertical:r.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},g={type:"slide",direction:"down"};m.displayName="Popup",m.propTypes={anchor:function(e){const n=e.anchor;return n&&"number"!=typeof n.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(e){const n=e.appendTo;return n&&"number"!=typeof n.nodeType?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:o.oneOfType([o.string,o.arrayOf(o.string.isRequired)]),id:o.string,popupClass:o.oneOfType([o.string,o.arrayOf(o.string),o.object]),collision:o.shape({horizontal:o.oneOf([r.Collision.fit,r.Collision.flip,r.Collision.none]),vertical:o.oneOf([r.Collision.fit,r.Collision.flip,r.Collision.none])}),anchorAlign:o.shape({horizontal:o.oneOf([r.AlignPoint.left,r.AlignPoint.center,r.AlignPoint.right]),vertical:o.oneOf([r.AlignPoint.top,r.AlignPoint.center,r.AlignPoint.bottom])}),popupAlign:o.shape({horizontal:o.oneOf([r.AlignPoint.left,r.AlignPoint.center,r.AlignPoint.right]),vertical:o.oneOf([r.AlignPoint.top,r.AlignPoint.center,r.AlignPoint.bottom])}),offset:o.shape({left:o.number,top:o.number}),children:o.oneOfType([o.element,o.node]),show:o.bool,animate:o.oneOfType([o.bool,o.shape({type:o.oneOf(["slide","zoom","push","expand","fade"]),openDuration:o.number,closeDuration:o.number})]),margin:o.shape({horizontal:o.number,vertical:o.number}),positionMode:o.oneOf(["fixed","absolute"]),scale:o.number,style:o.object,onClose:o.func,onPosition:o.func,onOpen:o.func,onKeyDown:o.func,onMouseDownOutside:o.func},e.Popup=m,e.PopupPropsContext=d});
15
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(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"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPopup={},e.React,e.ReactDOM,e.PropTypes,e.KendoReactCommon,e.KendoPopupCommon)}(this,function(e,n,t,o,r,i){"use strict";function s(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var l=s(n),c=s(t);const a=(e,n,t)=>{e.style.transitionDuration="",n&&e.classList.remove(...n.split(" ")),t&&e.classList.remove(...t.split(" "))},u="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),p=new WeakMap,d=(e,n,t,o,i,s,l)=>{var c;if((e=>{var n;null==(n=p.get(e))||n()})(e),0===n)return o(),()=>{};const d=`${s}Active`,f=r.classNames(r.uPopup[s]({direction:l,type:t,c:i})),m=r.classNames(r.uPopup[d]({direction:l,type:t,c:i})),h=null==(c=e.ownerDocument)?void 0:c.defaultView;if(!h)return()=>{};let g=!1;const v=[],y=()=>{g||(g=!0,e.removeEventListener("transitionend",P),h.clearTimeout(b),v.forEach(e=>h.cancelAnimationFrame(e)),a(e,f,m),p.get(e)===y&&p.delete(e))},w=()=>{g||(y(),e.style.display="exit"===t?"none":"",o())},P=n=>{n.target===e&&w()};e.addEventListener("transitionend",P);const b=h.setTimeout(w,n+50);p.set(e,y);const A=()=>{a(e,f,m),"enter"===t&&(e.style.display=""),f&&e.classList.add(...f.split(" ").filter(e=>e)),v.push(h.requestAnimationFrame(()=>{e.style.transitionDuration=n+"ms",e.classList.add(...m.split(" ").filter(e=>e))}))};return u?v.push(h.requestAnimationFrame(A)):A(),y},f=l.createContext(e=>e);function m(e,n){if(e===n)return!0;if(!!e!=!!n)return!1;const t=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(n);if(t.length!==o.length)return!1;for(let o=0;o<t.length;o++){const r=t[o];if(e[r]!==n[r])return!1}return!0}const h=l.forwardRef((e,n)=>{const t=l.useContext(f).call(void 0,e),{collision:o=g.collision,anchorAlign:s=g.anchorAlign,popupAlign:a=g.popupAlign,offset:u=g.offset,animate:p=g.animate,show:h=g.show,margin:y=g.margin,positionMode:w=g.positionMode,appendTo:P,contentKey:b,anchor:A,scale:O,role:C,ariaLabelledBy:T,ariaDescribedBy:D,onKeyDown:E,onPosition:x,onOpen:L,onMouseDownOutside:N,onClose:R,className:z,popupClass:j,id:K,style:M,children:k}=t,q=r.useUnstyled(),I=t.unstyled||q,F=I&&I.uPopup,[S,B]=l.useState({current:"hidden",previous:"hidden",props:{}}),H=p&&"object"!=typeof p?v:{...v,...p},U=e=>{const{width:n,height:t}=e.style;if(0===e.offsetWidth&&0===e.offsetHeight)return;const r=getComputedStyle(e),l=parseFloat(r.width),c=l>0?e.getBoundingClientRect().width/l:1,p=(O||1)*c;e.style.width=r.width,e.style.height=r.height;const d=i.alignElement({anchor:A,anchorAlign:s,element:e,elementAlign:a,offset:u,margin:y,positionMode:w,scale:p}),f=i.positionElement({anchor:A,anchorAlign:s,element:e,elementAlign:a,collisions:o,currentLocation:d,margin:y,scale:p});if(e.style.top=f.offset.top+"px",e.style.left=f.offset.left+"px",e.style.width=n,e.style.height=t,_.current={fit:f.fit,fitted:f.fitted,flip:f.flip,flipped:f.flipped},x){const e={target:te.current,flipped:f.flipped,fitted:f.fitted};x.call(void 0,e)}},V=()=>{const e=ne.current;e&&(h&&e.classList.add(...r.classNames(r.uPopup.animationContainerShown({c:F})).split(" ").filter(e=>e)),J(e),L&&L.call(void 0,{target:te.current}))},W=(n,t,o)=>{var r;if(!a)return;let i=H.direction;if("slide"===H.type){const{horizontal:n,vertical:t}=a;i="object"==typeof e.animate&&e.animate.direction?H.direction:"left"===n&&"center"===t?"right":"right"===n&&"center"===t?"left":"top"===t?"down":"up",null!=(r=_.current)&&r.flipped&&(i={down:"up",up:"down",left:"right",right:"left"}[i])}ie.current=d(n,G()[t],t,o,F,H.type,i)},Z=e=>{var n;const t=null===(null==(n=null==e?void 0:e.target)?void 0:n.closest(".k-animation-container")),o=(null==A?void 0:A.contains(null==e?void 0:e.target))||!1;if(t){if(N){const n={target:te.current,event:e,state:S,isAnchorClicked:o};N.call(void 0,n)}null==window||window.removeEventListener("mousedown",Z)}},$=()=>{"hiding"===se.current&&("shown"===se.previous||"reposition"===se.previous)&&B({...se,current:"hidden",previous:se.current}),R&&R.call(void 0,{target:te.current})},G=()=>{const e=p;let n=0,t=0;return e&&(!0===e?n=t=300:(n=e.openDuration||0,t=e.closeDuration||0)),{enter:n,exit:t}},J=e=>{Q(),ee.current=i.domUtils.scrollableParents(A||e),ee.current&&ee.current.map(e=>e.addEventListener("scroll",X)),window.addEventListener("resize",X)},Q=()=>{ee.current&&(ee.current.map(e=>e.removeEventListener("scroll",X)),ee.current=void 0),window.removeEventListener("resize",X)},X=function(e,n,t={}){let o,r,i,s,l=0;t=t||{};const c=function(){l=!1===t.leading?0:(new Date).getTime(),o=void 0,s=e.apply(r,i),o||(r=i=null)};return function(){const a=(new Date).getTime();!l&&!1===t.leading&&(l=a);const u=n-(a-l);return r=void 0,i=arguments,u<=0||u>n?(o&&(clearTimeout(o),o=void 0),l=a,s=e.apply(r,i),o||(r=i=null)):!o&&!1!==t.trailing&&(o=window.setTimeout(c,u)),s}}(()=>{ne.current&&"hidden"!==se.current&&"hiding"!==se.current&&B({...S,current:"reposition",previous:se.current})},16.666666666666668),Y=r.useZIndexContext()||0,_=l.useRef(void 0),ee=l.useRef(void 0),ne=l.useRef(null),te=l.useRef(null),oe=l.useRef({}),re=l.useRef(!1),ie=l.useRef(()=>{});l.useImperativeHandle(te,()=>({element:ne.current,setPosition:U,props:e})),l.useImperativeHandle(n,()=>te.current);const se=l.useMemo(()=>{const e={...S,props:{show:h,anchor:A,anchorAlign:s,appendTo:P,collision:o,popupAlign:a,className:z,popupClass:j,style:M,offset:u,contentKey:b}};return h?"hidden"===S.current||"hiding"===S.current?{...e,current:"showing",previous:S.current}:"showing"===S.current?{...e,current:"shown",previous:S.current}:"shown"!==S.current||m(u,S.props.offset)&&m(s,S.props.anchorAlign)&&m(P,S.props.appendTo)&&m(o,S.props.collision)&&m(a,S.props.popupAlign)&&m(M,S.props.style)&&A===S.props.anchor&&j===S.props.popupClass&&z===S.props.className?e:{...e,current:"reposition",previous:S.current}:"hiding"===S.current||"hidden"===S.current?{...e,current:"hidden",previous:S.current}:{...e,current:"hiding",previous:S.current}},[h,A,s,P,o,a,z,j,M,u,b,S]);l.useEffect(()=>{var e;"hiding"===se.current&&!re.current&&ne.current?(re.current=!0,(e=>{if(!h){const n=I&&I.uPopup;e.classList.remove(...r.classNames(r.uPopup.animationContainerShown({c:n})).split(" ").filter(e=>e))}Q()})(ne.current),W(ne.current.firstChild,"exit",$)):(re.current=!1,"showing"===se.current&&ne.current&&!ne.current.classList.contains("k-animation-container-shown")?(e=ne.current,null==window||window.addEventListener("mousedown",Z),U(e),W(e.firstChild,"enter",V),B({...se,current:"shown",previous:se.current})):"hiding"===se.current&&ne.current?$():"reposition"===se.current&&"shown"===se.previous?setTimeout(()=>{B({...se,current:"shown",previous:se.current})},0):"shown"===se.current&&oe.current.contentKey!==b&&ne.current&&U(ne.current)),"reposition"===se.current&&("shown"===se.previous||"showing"===se.previous)&&ne.current&&U(ne.current),oe.current={contentKey:b}},[se]),l.useEffect(()=>()=>{ie.current(),Q()},[]);const le=P||(r.canUseDOM?A&&A.ownerDocument?A.ownerDocument.body:document.body:void 0),ce=Object.assign({},{position:w,top:0,left:-1e4},M||{}),ae=void 0!==t.offset&&!m(t.offset,g.offset)||void 0!==t.margin,ue="hiding"===se.current;if((h||ue)&&le){const e=Y?Y+1:12e3,n=l.createElement(r.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:E,className:r.classNames(r.uPopup.animationContainer({c:F}),z),id:K,ref:ne,style:{zIndex:e,...ce}},l.createElement("div",{className:r.classNames(r.uPopup.animationChild({c:F})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:C,"aria-labelledby":T,"aria-describedby":D,className:r.classNames(r.uPopup.popup({c:F}),j),style:ae?{margin:0}:void 0},k))));return null!==P?c.createPortal(n,le):n}return null}),g={collision:{horizontal:i.Collision.fit,vertical:i.Collision.flip},anchorAlign:{horizontal:i.AlignPoint.left,vertical:i.AlignPoint.bottom},popupAlign:{horizontal:i.AlignPoint.left,vertical:i.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},v={type:"slide",direction:"down"};h.displayName="Popup",h.propTypes={anchor:function(e){const n=e.anchor;return n&&"number"!=typeof n.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(e){const n=e.appendTo;return n&&"number"!=typeof n.nodeType?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:o.oneOfType([o.string,o.arrayOf(o.string.isRequired)]),id:o.string,popupClass:o.oneOfType([o.string,o.arrayOf(o.string),o.object]),collision:o.shape({horizontal:o.oneOf([i.Collision.fit,i.Collision.flip,i.Collision.none]),vertical:o.oneOf([i.Collision.fit,i.Collision.flip,i.Collision.none])}),anchorAlign:o.shape({horizontal:o.oneOf([i.AlignPoint.left,i.AlignPoint.center,i.AlignPoint.right]),vertical:o.oneOf([i.AlignPoint.top,i.AlignPoint.center,i.AlignPoint.bottom])}),popupAlign:o.shape({horizontal:o.oneOf([i.AlignPoint.left,i.AlignPoint.center,i.AlignPoint.right]),vertical:o.oneOf([i.AlignPoint.top,i.AlignPoint.center,i.AlignPoint.bottom])}),offset:o.shape({left:o.number,top:o.number}),children:o.oneOfType([o.element,o.node]),show:o.bool,animate:o.oneOfType([o.bool,o.shape({type:o.oneOf(["slide","zoom","push","expand","fade"]),openDuration:o.number,closeDuration:o.number})]),margin:o.shape({horizontal:o.number,vertical:o.number}),positionMode:o.oneOf(["fixed","absolute"]),scale:o.number,style:o.object,onClose:o.func,onPosition:o.func,onOpen:o.func,onKeyDown:o.func,onMouseDownOutside:o.func},e.Popup=h,e.PopupPropsContext=f});
@@ -7,7 +7,7 @@ export const packageMetadata = Object.freeze({
7
7
  productName: 'KendoReact',
8
8
  productCode: 'KENDOUIREACT',
9
9
  productCodes: ['KENDOUIREACT'],
10
- publishDate: 1790164189,
11
- version: '16.2.0-develop.10',
10
+ publishDate: 1790167470,
11
+ version: '16.2.0-develop.11',
12
12
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/components/my-license/'
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-popup",
3
- "version": "16.2.0-develop.10",
3
+ "version": "16.2.0-develop.11",
4
4
  "description": "React Popup positions a piece of content next to a specific anchor component. KendoReact Popup package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -27,7 +27,7 @@
27
27
  "peerDependencies": {
28
28
  "@progress/kendo-licensing": "^1.7.2",
29
29
  "@progress/kendo-popup-common": "^1.9.5",
30
- "@progress/kendo-react-common": "16.2.0-develop.10",
30
+ "@progress/kendo-react-common": "16.2.0-develop.11",
31
31
  "react": "^18.0.0 || ^19.0.0",
32
32
  "react-dom": "^18.0.0 || ^19.0.0"
33
33
  },
@@ -54,7 +54,7 @@
54
54
  "package": {
55
55
  "productName": "KendoReact",
56
56
  "productCode": "KENDOUIREACT",
57
- "publishDate": 1790164189,
57
+ "publishDate": 1790167470,
58
58
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
59
59
  }
60
60
  },