@progress/kendo-react-popup 12.0.3-develop.2 → 12.1.0-develop.2

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 we=require("react"),ve=require("react-dom"),n=require("prop-types"),ye=require("./animation.js"),a=require("@progress/kendo-react-common"),t=require("@progress/kendo-popup-common"),ee=require("./util.js");function ne(i){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const h in i)if(h!=="default"){const v=Object.getOwnPropertyDescriptor(i,h);Object.defineProperty(u,h,v.get?v:{enumerable:!0,get:()=>i[h]})}}return u.default=i,Object.freeze(u)}const l=ne(we),Oe=ne(ve),te=l.createContext(i=>i),Ae=100,be=1;function E(i,u){if(i===u)return!0;if(!!i!=!!u)return!1;const h=Object.getOwnPropertyNames(i),v=Object.getOwnPropertyNames(u);if(h.length!==v.length)return!1;for(let P=0;P<h.length;P++){const w=h[P];if(i[w]!==u[w])return!1}return!0}const Ce={left:-1e3,top:0},U=l.forwardRef((i,u)=>{const v=l.useContext(te).call(void 0,i),{collision:P=g.collision,anchorAlign:w=g.anchorAlign,popupAlign:y=g.popupAlign,offset:R=g.offset,animate:oe=g.animate,show:O=g.show,margin:H=g.margin,positionMode:K=g.positionMode,appendTo:A,contentKey:T,anchor:d,scale:re,role:ie,onKeyDown:se,onPosition:Z,onOpen:F,onMouseDownOutside:V,onClose:W,className:N,popupClass:z,id:le,style:M,children:ce}=v,ue=a.useUnstyled(),S=v.unstyled||ue,D=S&&S.uPopup,[o,I]=l.useState({current:"hidden",previous:"hidden",props:{}}),X=e=>{window==null||window.addEventListener("mousedown",G),L(e),B(e.firstChild,"enter",ae),I({...r,current:"shown",previous:r.current})},L=e=>{const{width:s,height:m}=e.style;if(e.offsetWidth===0&&e.offsetHeight===0)return;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const p=t.alignElement({anchor:d,anchorAlign:w,element:e,elementAlign:y,offset:R,margin:H,positionMode:K,scale:re}),f=t.positionElement({anchor:d,anchorAlign:w,element:e,elementAlign:y,collisions:P,currentLocation:p,margin:H});if(e.style.top=f.offset.top+"px",e.style.left=f.offset.left+"px",e.style.width=s,e.style.height=m,k.current={fit:f.fit,fitted:f.fitted,flip:f.flip,flipped:f.flipped},Z){const x={target:C.current,flipped:f.flipped,fitted:f.fitted};Z.call(void 0,x)}},ae=()=>{const e=c.current;e&&(O&&e.classList.add(...a.classNames(a.uPopup.animationContainerShown({c:D})).split(" ").filter(s=>s)),de(e),F&&F.call(void 0,{target:C.current}))},B=(e,s,m)=>{if(!y)return;let p;const{horizontal:f,vertical:x}=y;typeof i.animate=="object"&&i.animate.direction?p=i.animate.direction:f==="left"&&x==="center"?p="right":f==="right"&&x==="center"?p="left":x==="top"?p="down":p="up";const Pe={down:"up",up:"down",left:"right",right:"left"};k.current&&k.current.flipped&&(p=Pe[p]),ye.slide(e,p,fe()[s],s,m,D)},G=e=>{var p;const s=((p=e==null?void 0:e.target)==null?void 0:p.closest(".k-animation-container"))===null,m=(d==null?void 0:d.contains(e==null?void 0:e.target))||!1;if(s){if(V){const f={target:C.current,event:e,state:o,isAnchorClicked:m};V.call(void 0,f)}window==null||window.removeEventListener("mousedown",G)}},pe=e=>{if(!O){const s=S&&S.uPopup;e.classList.remove(...a.classNames(a.uPopup.animationContainerShown({c:s})).split(" ").filter(m=>m))}_()},J=()=>{r.current==="hiding"&&(r.previous==="shown"||r.previous==="reposition")&&I({...r,current:"hidden",previous:r.current}),W&&W.call(void 0,{target:C.current})},fe=()=>{const e=oe;let s=0,m=0;return e&&(e===!0?s=m=300:(s=e.openDuration||0,m=e.closeDuration||0)),{enter:s,exit:m}},de=e=>{_(),b.current=t.domUtils.scrollableParents(d||e),b.current&&b.current.map(s=>s.addEventListener("scroll",j)),window.addEventListener("resize",j)},_=()=>{b.current&&(b.current.map(e=>e.removeEventListener("scroll",j)),b.current=void 0),window.removeEventListener("resize",j)},j=ee.throttle(()=>{c.current&&r.current!=="hidden"&&r.current!=="hiding"&&I({...o,current:"reposition",previous:r.current})},ee.FRAME_DURATION),me=()=>Q?Q+be:Ae,Q=a.useZIndexContext()||0,k=l.useRef(void 0),b=l.useRef(void 0),c=l.useRef(null),C=l.useRef(null),Y=l.useRef({}),q=l.useRef(!1);l.useImperativeHandle(C,()=>({element:c.current,setPosition:L,props:i})),l.useImperativeHandle(u,()=>C.current);const r=l.useMemo(()=>{const e={...o,props:{show:O,anchor:d,anchorAlign:w,appendTo:A,collision:P,popupAlign:y,className:N,popupClass:z,style:M,offset:R,contentKey:T}};return O?o.current==="hidden"||o.current==="hiding"?{...e,current:"showing",previous:o.current}:o.current==="showing"?{...e,current:"shown",previous:o.current}:o.current==="shown"&&(!E(R,o.props.offset)||!E(w,o.props.anchorAlign)||!E(A,o.props.appendTo)||!E(P,o.props.collision)||!E(y,o.props.popupAlign)||!E(M,o.props.style)||d!==o.props.anchor||z!==o.props.popupClass||N!==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}},[O,d,w,A,P,y,N,z,M,R,T,o]);l.useEffect(()=>{r.current==="hiding"&&!q.current&&c.current?(q.current=!0,pe(c.current),B(c.current.firstChild,"exit",J)):(q.current=!1,r.current==="showing"&&c.current&&!c.current.classList.contains("k-animation-container-shown")?X(c.current):r.current==="hiding"&&c.current?J():r.current==="reposition"&&r.previous==="shown"?setTimeout(()=>{I({...r,current:"shown",previous:r.current})},0):r.current==="shown"&&Y.current.contentKey!==T&&c.current&&L(c.current)),r.current==="reposition"&&(r.previous==="shown"||r.previous==="showing")&&c.current&&L(c.current),Y.current={contentKey:T}},[r]),l.useEffect(()=>(r.current==="showing"&&c.current&&X(c.current),()=>{_()}),[]);const $=A||(a.canUseDOM?d&&d.ownerDocument?d.ownerDocument.body:document.body:void 0),he=Object.assign({},{position:K,top:0,left:-1e4},M||{}),ge=r.current==="hiding";if((O||ge)&&$){const e=me(),s=l.createElement(a.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:se,className:a.classNames(a.uPopup.animationContainer({c:D}),N),id:le,ref:c,style:{zIndex:e,...he}},l.createElement("div",{className:a.classNames(a.uPopup.animationChild({c:D})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:ie,className:a.classNames(a.uPopup.popup({c:D}),z)},ce))));return A!==null?Oe.createPortal(s,$):s}return null}),g={collision:{horizontal:t.Collision.fit,vertical:t.Collision.flip},anchorAlign:{horizontal:t.AlignPoint.left,vertical:t.AlignPoint.bottom},popupAlign:{horizontal:t.AlignPoint.left,vertical:t.AlignPoint.top},offset:Ce,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"};U.displayName="Popup";U.propTypes={anchor:function(i){const u=i.anchor;return u&&typeof u.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(i){const u=i.appendTo;return u&&typeof u.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string.isRequired)]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([t.Collision.fit,t.Collision.flip,t.Collision.none]),vertical:n.oneOf([t.Collision.fit,t.Collision.flip,t.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([t.AlignPoint.left,t.AlignPoint.center,t.AlignPoint.right]),vertical:n.oneOf([t.AlignPoint.top,t.AlignPoint.center,t.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([t.AlignPoint.left,t.AlignPoint.center,t.AlignPoint.right]),vertical:n.oneOf([t.AlignPoint.top,t.AlignPoint.center,t.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,onKeyDown:n.func,onMouseDownOutside:n.func};exports.Popup=U;exports.PopupPropsContext=te;exports.popupDefaultProps=g;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("react"),Ae=require("react-dom"),n=require("prop-types"),oe=require("./animation.js"),a=require("@progress/kendo-react-common"),t=require("@progress/kendo-popup-common"),ie=require("./util.js");function se(r){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const h in r)if(h!=="default"){const v=Object.getOwnPropertyDescriptor(r,h);Object.defineProperty(u,h,v.get?v:{enumerable:!0,get:()=>r[h]})}}return u.default=r,Object.freeze(u)}const c=se(Oe),be=se(Ae),ce=c.createContext(r=>r),Ce=100,Ee=1;function D(r,u){if(r===u)return!0;if(!!r!=!!u)return!1;const h=Object.getOwnPropertyNames(r),v=Object.getOwnPropertyNames(u);if(h.length!==v.length)return!1;for(let P=0;P<h.length;P++){const w=h[P];if(r[w]!==u[w])return!1}return!0}const De={left:-1e3,top:0},K=c.forwardRef((r,u)=>{const v=c.useContext(ce).call(void 0,r),{collision:P=g.collision,anchorAlign:w=g.anchorAlign,popupAlign:y=g.popupAlign,offset:T=g.offset,animate:N=g.animate,show:O=g.show,margin:Z=g.margin,positionMode:F=g.positionMode,appendTo:A,contentKey:z,anchor:d,scale:le,role:ue,onKeyDown:ae,onPosition:V,onOpen:W,onMouseDownOutside:X,onClose:B,className:M,popupClass:S,id:pe,style:j,children:fe}=v,de=a.useUnstyled(),I=v.unstyled||de,b=I&&I.uPopup,[o,L]=c.useState({current:"hidden",previous:"hidden",props:{}}),x=N&&typeof N!="object"?re:{...re,...N},G=e=>{window==null||window.addEventListener("mousedown",Q),_(e),J(e.firstChild,"enter",me),L({...i,current:"shown",previous:i.current})},_=e=>{const{width:s,height:m}=e.style;if(e.offsetWidth===0&&e.offsetHeight===0)return;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const p=t.alignElement({anchor:d,anchorAlign:w,element:e,elementAlign:y,offset:T,margin:Z,positionMode:F,scale:le}),f=t.positionElement({anchor:d,anchorAlign:w,element:e,elementAlign:y,collisions:P,currentLocation:p,margin:Z});if(e.style.top=f.offset.top+"px",e.style.left=f.offset.left+"px",e.style.width=s,e.style.height=m,U.current={fit:f.fit,fitted:f.fitted,flip:f.flip,flipped:f.flipped},V){const R={target:E.current,flipped:f.flipped,fitted:f.fitted};V.call(void 0,R)}},me=()=>{const e=l.current;e&&(O&&e.classList.add(...a.classNames(a.uPopup.animationContainerShown({c:b})).split(" ").filter(s=>s)),ge(e),W&&W.call(void 0,{target:E.current}))},J=(e,s,m)=>{if(y){if(x.type==="slide"){let p;const{horizontal:f,vertical:R}=y;typeof r.animate=="object"&&r.animate.direction?p=x.direction:f==="left"&&R==="center"?p="right":f==="right"&&R==="center"?p="left":R==="top"?p="down":p="up";const ye={down:"up",up:"down",left:"right",right:"left"};U.current&&U.current.flipped&&(p=ye[p],oe.animations(e,$()[s],s,m,b,x.type,p))}oe.animations(e,$()[s],s,m,b,x.type,x.direction)}},Q=e=>{var p;const s=((p=e==null?void 0:e.target)==null?void 0:p.closest(".k-animation-container"))===null,m=(d==null?void 0:d.contains(e==null?void 0:e.target))||!1;if(s){if(X){const f={target:E.current,event:e,state:o,isAnchorClicked:m};X.call(void 0,f)}window==null||window.removeEventListener("mousedown",Q)}},he=e=>{if(!O){const s=I&&I.uPopup;e.classList.remove(...a.classNames(a.uPopup.animationContainerShown({c:s})).split(" ").filter(m=>m))}q()},Y=()=>{i.current==="hiding"&&(i.previous==="shown"||i.previous==="reposition")&&L({...i,current:"hidden",previous:i.current}),B&&B.call(void 0,{target:E.current})},$=()=>{const e=N;let s=0,m=0;return e&&(e===!0?s=m=300:(s=e.openDuration||0,m=e.closeDuration||0)),{enter:s,exit:m}},ge=e=>{q(),C.current=t.domUtils.scrollableParents(d||e),C.current&&C.current.map(s=>s.addEventListener("scroll",k)),window.addEventListener("resize",k)},q=()=>{C.current&&(C.current.map(e=>e.removeEventListener("scroll",k)),C.current=void 0),window.removeEventListener("resize",k)},k=ie.throttle(()=>{l.current&&i.current!=="hidden"&&i.current!=="hiding"&&L({...o,current:"reposition",previous:i.current})},ie.FRAME_DURATION),Pe=()=>ee?ee+Ee:Ce,ee=a.useZIndexContext()||0,U=c.useRef(void 0),C=c.useRef(void 0),l=c.useRef(null),E=c.useRef(null),ne=c.useRef({}),H=c.useRef(!1);c.useImperativeHandle(E,()=>({element:l.current,setPosition:_,props:r})),c.useImperativeHandle(u,()=>E.current);const i=c.useMemo(()=>{const e={...o,props:{show:O,anchor:d,anchorAlign:w,appendTo:A,collision:P,popupAlign:y,className:M,popupClass:S,style:j,offset:T,contentKey:z}};return O?o.current==="hidden"||o.current==="hiding"?{...e,current:"showing",previous:o.current}:o.current==="showing"?{...e,current:"shown",previous:o.current}:o.current==="shown"&&(!D(T,o.props.offset)||!D(w,o.props.anchorAlign)||!D(A,o.props.appendTo)||!D(P,o.props.collision)||!D(y,o.props.popupAlign)||!D(j,o.props.style)||d!==o.props.anchor||S!==o.props.popupClass||M!==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}},[O,d,w,A,P,y,M,S,j,T,z,o]);c.useEffect(()=>{i.current==="hiding"&&!H.current&&l.current?(H.current=!0,he(l.current),J(l.current.firstChild,"exit",Y)):(H.current=!1,i.current==="showing"&&l.current&&!l.current.classList.contains("k-animation-container-shown")?G(l.current):i.current==="hiding"&&l.current?Y():i.current==="reposition"&&i.previous==="shown"?setTimeout(()=>{L({...i,current:"shown",previous:i.current})},0):i.current==="shown"&&ne.current.contentKey!==z&&l.current&&_(l.current)),i.current==="reposition"&&(i.previous==="shown"||i.previous==="showing")&&l.current&&_(l.current),ne.current={contentKey:z}},[i]),c.useEffect(()=>(i.current==="showing"&&l.current&&G(l.current),()=>{q()}),[]);const te=A||(a.canUseDOM?d&&d.ownerDocument?d.ownerDocument.body:document.body:void 0),we=Object.assign({},{position:F,top:0,left:-1e4},j||{}),ve=i.current==="hiding";if((O||ve)&&te){const e=Pe(),s=c.createElement(a.ZIndexContext.Provider,{value:e},c.createElement("div",{onKeyDown:ae,className:a.classNames(a.uPopup.animationContainer({c:b}),M),id:pe,ref:l,style:{zIndex:e,...we}},c.createElement("div",{className:a.classNames(a.uPopup.animationChild({c:b})),style:{transitionDelay:"0ms"}},c.createElement("div",{role:ue,className:a.classNames(a.uPopup.popup({c:b}),S)},fe))));return A!==null?be.createPortal(s,te):s}return null}),g={collision:{horizontal:t.Collision.fit,vertical:t.Collision.flip},anchorAlign:{horizontal:t.AlignPoint.left,vertical:t.AlignPoint.bottom},popupAlign:{horizontal:t.AlignPoint.left,vertical:t.AlignPoint.top},offset:De,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 u=r.anchor;return u&&typeof u.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(r){const u=r.appendTo;return u&&typeof u.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string.isRequired)]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([t.Collision.fit,t.Collision.flip,t.Collision.none]),vertical:n.oneOf([t.Collision.fit,t.Collision.flip,t.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([t.AlignPoint.left,t.AlignPoint.center,t.AlignPoint.right]),vertical:n.oneOf([t.AlignPoint.top,t.AlignPoint.center,t.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([t.AlignPoint.left,t.AlignPoint.center,t.AlignPoint.right]),vertical:n.oneOf([t.AlignPoint.top,t.AlignPoint.center,t.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({type:n.oneOf(["slide","zoom","push","expand","fade"]),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,onKeyDown:n.func,onMouseDownOutside:n.func};exports.Popup=K;exports.PopupPropsContext=ce;exports.popupDefaultProps=g;
package/Popup.mjs CHANGED
@@ -6,157 +6,176 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as i from "react";
9
- import * as we from "react-dom";
9
+ import * as Pe from "react-dom";
10
10
  import t from "prop-types";
11
- import { slide as ve } from "./animation.mjs";
12
- import { useUnstyled as ye, useZIndexContext as Pe, canUseDOM as Oe, ZIndexContext as Ee, classNames as D, uPopup as A } from "@progress/kendo-react-common";
13
- import { Collision as w, AlignPoint as l, alignElement as be, positionElement as Ce, domUtils as xe } from "@progress/kendo-popup-common";
14
- import { throttle as De, FRAME_DURATION as Ae } from "./util.mjs";
15
- const Te = i.createContext((c) => c), Re = 100, Ne = 1;
16
- function b(c, p) {
17
- if (c === p)
11
+ import { animations as re } from "./animation.mjs";
12
+ import { useUnstyled as Oe, useZIndexContext as Ee, canUseDOM as be, ZIndexContext as Ce, classNames as D, uPopup as T } from "@progress/kendo-react-common";
13
+ import { Collision as w, AlignPoint as c, alignElement as xe, positionElement as Ae, domUtils as De } from "@progress/kendo-popup-common";
14
+ import { throttle as Te, FRAME_DURATION as Re } from "./util.mjs";
15
+ const ze = i.createContext((l) => l), Ne = 100, Ie = 1;
16
+ function C(l, p) {
17
+ if (l === p)
18
18
  return !0;
19
- if (!!c != !!p)
19
+ if (!!l != !!p)
20
20
  return !1;
21
- const T = Object.getOwnPropertyNames(c), R = Object.getOwnPropertyNames(p);
22
- if (T.length !== R.length)
21
+ const R = Object.getOwnPropertyNames(l), z = Object.getOwnPropertyNames(p);
22
+ if (R.length !== z.length)
23
23
  return !1;
24
- for (let m = 0; m < T.length; m++) {
25
- const h = T[m];
26
- if (c[h] !== p[h])
24
+ for (let m = 0; m < R.length; m++) {
25
+ const h = R[m];
26
+ if (l[h] !== p[h])
27
27
  return !1;
28
28
  }
29
29
  return !0;
30
30
  }
31
- const ze = {
31
+ const Le = {
32
32
  left: -1e3,
33
33
  top: 0
34
- }, te = i.forwardRef((c, p) => {
35
- const R = i.useContext(Te).call(void 0, c), {
34
+ }, se = i.forwardRef((l, p) => {
35
+ const z = i.useContext(ze).call(void 0, l), {
36
36
  collision: m = g.collision,
37
37
  anchorAlign: h = g.anchorAlign,
38
38
  popupAlign: v = g.popupAlign,
39
39
  offset: N = g.offset,
40
- animate: ne = g.animate,
40
+ animate: I = g.animate,
41
41
  show: y = g.show,
42
- margin: _ = g.margin,
43
- positionMode: F = g.positionMode,
42
+ margin: q = g.margin,
43
+ positionMode: V = g.positionMode,
44
44
  appendTo: P,
45
- contentKey: z,
45
+ contentKey: L,
46
46
  anchor: f,
47
- scale: oe,
48
- role: re,
49
- onKeyDown: ie,
50
- onPosition: q,
51
- onOpen: V,
52
- onMouseDownOutside: W,
53
- onClose: X,
54
- className: I,
55
- popupClass: L,
56
- id: se,
57
- style: M,
58
- children: ce
59
- } = R, le = ye(), S = R.unstyled || le, C = S && S.uPopup, [n, U] = i.useState({
47
+ scale: ce,
48
+ role: le,
49
+ onKeyDown: ae,
50
+ onPosition: W,
51
+ onOpen: X,
52
+ onMouseDownOutside: B,
53
+ onClose: G,
54
+ className: M,
55
+ popupClass: S,
56
+ id: ue,
57
+ style: U,
58
+ children: pe
59
+ } = z, fe = Oe(), j = z.unstyled || fe, O = j && j.uPopup, [n, k] = i.useState({
60
60
  current: "hidden",
61
61
  previous: "hidden",
62
62
  props: {}
63
- }), B = (e) => {
64
- window == null || window.addEventListener("mousedown", J), k(e), G(e.firstChild, "enter", ae), U({ ...o, current: "shown", previous: o.current });
65
- }, k = (e) => {
63
+ }), x = I && typeof I != "object" ? ie : { ...ie, ...I }, J = (e) => {
64
+ window == null || window.addEventListener("mousedown", Y), H(e), Q(e.firstChild, "enter", de), k({ ...o, current: "shown", previous: o.current });
65
+ }, H = (e) => {
66
66
  const { width: r, height: d } = e.style;
67
67
  if (e.offsetWidth === 0 && e.offsetHeight === 0)
68
68
  return;
69
69
  e.style.width = e.offsetWidth + "px", e.style.height = e.offsetHeight + "px";
70
- const a = be({
70
+ const a = xe({
71
71
  anchor: f,
72
72
  anchorAlign: h,
73
73
  element: e,
74
74
  elementAlign: v,
75
75
  offset: N,
76
- margin: _,
77
- positionMode: F,
78
- scale: oe
79
- }), u = Ce({
76
+ margin: q,
77
+ positionMode: V,
78
+ scale: ce
79
+ }), u = Ae({
80
80
  anchor: f,
81
81
  anchorAlign: h,
82
82
  element: e,
83
83
  elementAlign: v,
84
84
  collisions: m,
85
85
  currentLocation: a,
86
- margin: _
86
+ margin: q
87
87
  });
88
- if (e.style.top = u.offset.top + "px", e.style.left = u.offset.left + "px", e.style.width = r, e.style.height = d, K.current = {
88
+ if (e.style.top = u.offset.top + "px", e.style.left = u.offset.left + "px", e.style.width = r, e.style.height = d, _.current = {
89
89
  fit: u.fit,
90
90
  fitted: u.fitted,
91
91
  flip: u.flip,
92
92
  flipped: u.flipped
93
- }, q) {
94
- const x = {
95
- target: E.current,
93
+ }, W) {
94
+ const A = {
95
+ target: b.current,
96
96
  flipped: u.flipped,
97
97
  fitted: u.fitted
98
98
  };
99
- q.call(void 0, x);
99
+ W.call(void 0, A);
100
100
  }
101
- }, ae = () => {
101
+ }, de = () => {
102
102
  const e = s.current;
103
103
  e && (y && e.classList.add(
104
- ...D(A.animationContainerShown({ c: C })).split(" ").filter((r) => r)
105
- ), fe(e), V && V.call(void 0, { target: E.current }));
106
- }, G = (e, r, d) => {
107
- if (!v)
108
- return;
109
- let a;
110
- const { horizontal: u, vertical: x } = v;
111
- typeof c.animate == "object" && c.animate.direction ? a = c.animate.direction : u === "left" && x === "center" ? a = "right" : u === "right" && x === "center" ? a = "left" : x === "top" ? a = "down" : a = "up";
112
- const ge = {
113
- down: "up",
114
- up: "down",
115
- left: "right",
116
- right: "left"
117
- };
118
- K.current && K.current.flipped && (a = ge[a]), ve(e, a, pe()[r], r, d, C);
119
- }, J = (e) => {
104
+ ...D(T.animationContainerShown({ c: O })).split(" ").filter((r) => r)
105
+ ), he(e), X && X.call(void 0, { target: b.current }));
106
+ }, Q = (e, r, d) => {
107
+ if (v) {
108
+ if (x.type === "slide") {
109
+ let a;
110
+ const { horizontal: u, vertical: A } = v;
111
+ typeof l.animate == "object" && l.animate.direction ? a = x.direction : u === "left" && A === "center" ? a = "right" : u === "right" && A === "center" ? a = "left" : A === "top" ? a = "down" : a = "up";
112
+ const ye = {
113
+ down: "up",
114
+ up: "down",
115
+ left: "right",
116
+ right: "left"
117
+ };
118
+ _.current && _.current.flipped && (a = ye[a], re(
119
+ e,
120
+ ee()[r],
121
+ r,
122
+ d,
123
+ O,
124
+ x.type,
125
+ a
126
+ ));
127
+ }
128
+ re(
129
+ e,
130
+ ee()[r],
131
+ r,
132
+ d,
133
+ O,
134
+ x.type,
135
+ x.direction
136
+ );
137
+ }
138
+ }, Y = (e) => {
120
139
  var a;
121
140
  const r = ((a = e == null ? void 0 : e.target) == null ? void 0 : a.closest(".k-animation-container")) === null, d = (f == null ? void 0 : f.contains(e == null ? void 0 : e.target)) || !1;
122
141
  if (r) {
123
- if (W) {
142
+ if (B) {
124
143
  const u = {
125
- target: E.current,
144
+ target: b.current,
126
145
  event: e,
127
146
  state: n,
128
147
  isAnchorClicked: d
129
148
  };
130
- W.call(void 0, u);
149
+ B.call(void 0, u);
131
150
  }
132
- window == null || window.removeEventListener("mousedown", J);
151
+ window == null || window.removeEventListener("mousedown", Y);
133
152
  }
134
- }, ue = (e) => {
153
+ }, me = (e) => {
135
154
  if (!y) {
136
- const r = S && S.uPopup;
155
+ const r = j && j.uPopup;
137
156
  e.classList.remove(
138
- ...D(A.animationContainerShown({ c: r })).split(" ").filter((d) => d)
157
+ ...D(T.animationContainerShown({ c: r })).split(" ").filter((d) => d)
139
158
  );
140
159
  }
141
- H();
142
- }, Q = () => {
143
- o.current === "hiding" && (o.previous === "shown" || o.previous === "reposition") && U({ ...o, current: "hidden", previous: o.current }), X && X.call(void 0, { target: E.current });
144
- }, pe = () => {
145
- const e = ne;
160
+ Z();
161
+ }, $ = () => {
162
+ o.current === "hiding" && (o.previous === "shown" || o.previous === "reposition") && k({ ...o, current: "hidden", previous: o.current }), G && G.call(void 0, { target: b.current });
163
+ }, ee = () => {
164
+ const e = I;
146
165
  let r = 0, d = 0;
147
166
  return e && (e === !0 ? r = d = 300 : (r = e.openDuration || 0, d = e.closeDuration || 0)), { enter: r, exit: d };
148
- }, fe = (e) => {
149
- H(), O.current = xe.scrollableParents(f || e), O.current && O.current.map((r) => r.addEventListener("scroll", j)), window.addEventListener("resize", j);
150
- }, H = () => {
151
- O.current && (O.current.map((e) => e.removeEventListener("scroll", j)), O.current = void 0), window.removeEventListener("resize", j);
152
- }, j = De(() => {
153
- s.current && o.current !== "hidden" && o.current !== "hiding" && U({ ...n, current: "reposition", previous: o.current });
154
- }, Ae), de = () => Y ? Y + Ne : Re, Y = Pe() || 0, K = i.useRef(void 0), O = i.useRef(void 0), s = i.useRef(null), E = i.useRef(null), $ = i.useRef({}), Z = i.useRef(!1);
155
- i.useImperativeHandle(E, () => ({
167
+ }, he = (e) => {
168
+ Z(), E.current = De.scrollableParents(f || e), E.current && E.current.map((r) => r.addEventListener("scroll", K)), window.addEventListener("resize", K);
169
+ }, Z = () => {
170
+ E.current && (E.current.map((e) => e.removeEventListener("scroll", K)), E.current = void 0), window.removeEventListener("resize", K);
171
+ }, K = Te(() => {
172
+ s.current && o.current !== "hidden" && o.current !== "hiding" && k({ ...n, current: "reposition", previous: o.current });
173
+ }, Re), ge = () => te ? te + Ie : Ne, te = Ee() || 0, _ = i.useRef(void 0), E = i.useRef(void 0), s = i.useRef(null), b = i.useRef(null), ne = i.useRef({}), F = i.useRef(!1);
174
+ i.useImperativeHandle(b, () => ({
156
175
  element: s.current,
157
- setPosition: k,
158
- props: c
159
- })), i.useImperativeHandle(p, () => E.current);
176
+ setPosition: H,
177
+ props: l
178
+ })), i.useImperativeHandle(p, () => b.current);
160
179
  const o = i.useMemo(() => {
161
180
  const e = {
162
181
  ...n,
@@ -167,14 +186,14 @@ const ze = {
167
186
  appendTo: P,
168
187
  collision: m,
169
188
  popupAlign: v,
170
- className: I,
171
- popupClass: L,
172
- style: M,
189
+ className: M,
190
+ popupClass: S,
191
+ style: U,
173
192
  offset: N,
174
- contentKey: z
193
+ contentKey: L
175
194
  }
176
195
  };
177
- return y ? n.current === "hidden" || n.current === "hiding" ? { ...e, current: "showing", previous: n.current } : n.current === "showing" ? { ...e, current: "shown", previous: n.current } : n.current === "shown" && (!b(N, n.props.offset) || !b(h, n.props.anchorAlign) || !b(P, n.props.appendTo) || !b(m, n.props.collision) || !b(v, n.props.popupAlign) || !b(M, n.props.style) || f !== n.props.anchor || L !== n.props.popupClass || I !== n.props.className) ? { ...e, current: "reposition", previous: n.current } : e : n.current === "hiding" || n.current === "hidden" ? { ...e, current: "hidden", previous: n.current } : { ...e, current: "hiding", previous: n.current };
196
+ return y ? n.current === "hidden" || n.current === "hiding" ? { ...e, current: "showing", previous: n.current } : n.current === "showing" ? { ...e, current: "shown", previous: n.current } : n.current === "shown" && (!C(N, n.props.offset) || !C(h, n.props.anchorAlign) || !C(P, n.props.appendTo) || !C(m, n.props.collision) || !C(v, n.props.popupAlign) || !C(U, n.props.style) || f !== n.props.anchor || S !== n.props.popupClass || M !== n.props.className) ? { ...e, current: "reposition", previous: n.current } : e : n.current === "hiding" || n.current === "hidden" ? { ...e, current: "hidden", previous: n.current } : { ...e, current: "hiding", previous: n.current };
178
197
  }, [
179
198
  y,
180
199
  f,
@@ -182,48 +201,48 @@ const ze = {
182
201
  P,
183
202
  m,
184
203
  v,
185
- I,
186
- L,
187
204
  M,
205
+ S,
206
+ U,
188
207
  N,
189
- z,
208
+ L,
190
209
  n
191
210
  ]);
192
211
  i.useEffect(() => {
193
- o.current === "hiding" && !Z.current && s.current ? (Z.current = !0, ue(s.current), G(s.current.firstChild, "exit", Q)) : (Z.current = !1, o.current === "showing" && s.current && !s.current.classList.contains("k-animation-container-shown") ? B(s.current) : o.current === "hiding" && s.current ? Q() : o.current === "reposition" && o.previous === "shown" ? setTimeout(() => {
194
- U({ ...o, current: "shown", previous: o.current });
195
- }, 0) : o.current === "shown" && $.current.contentKey !== z && s.current && k(s.current)), o.current === "reposition" && (o.previous === "shown" || o.previous === "showing") && s.current && k(s.current), $.current = { contentKey: z };
196
- }, [o]), i.useEffect(() => (o.current === "showing" && s.current && B(s.current), () => {
197
- H();
212
+ o.current === "hiding" && !F.current && s.current ? (F.current = !0, me(s.current), Q(s.current.firstChild, "exit", $)) : (F.current = !1, o.current === "showing" && s.current && !s.current.classList.contains("k-animation-container-shown") ? J(s.current) : o.current === "hiding" && s.current ? $() : o.current === "reposition" && o.previous === "shown" ? setTimeout(() => {
213
+ k({ ...o, current: "shown", previous: o.current });
214
+ }, 0) : o.current === "shown" && ne.current.contentKey !== L && s.current && H(s.current)), o.current === "reposition" && (o.previous === "shown" || o.previous === "showing") && s.current && H(s.current), ne.current = { contentKey: L };
215
+ }, [o]), i.useEffect(() => (o.current === "showing" && s.current && J(s.current), () => {
216
+ Z();
198
217
  }), []);
199
- const ee = P || (Oe ? f && f.ownerDocument ? f.ownerDocument.body : document.body : void 0), me = Object.assign(
218
+ const oe = P || (be ? f && f.ownerDocument ? f.ownerDocument.body : document.body : void 0), we = Object.assign(
200
219
  {},
201
- { position: F, top: 0, left: -1e4 },
202
- M || {}
203
- ), he = o.current === "hiding";
204
- if ((y || he) && ee) {
205
- const e = de(), r = /* @__PURE__ */ i.createElement(Ee.Provider, { value: e }, /* @__PURE__ */ i.createElement(
220
+ { position: V, top: 0, left: -1e4 },
221
+ U || {}
222
+ ), ve = o.current === "hiding";
223
+ if ((y || ve) && oe) {
224
+ const e = ge(), r = /* @__PURE__ */ i.createElement(Ce.Provider, { value: e }, /* @__PURE__ */ i.createElement(
206
225
  "div",
207
226
  {
208
- onKeyDown: ie,
209
- className: D(A.animationContainer({ c: C }), I),
210
- id: se,
227
+ onKeyDown: ae,
228
+ className: D(T.animationContainer({ c: O }), M),
229
+ id: ue,
211
230
  ref: s,
212
231
  style: {
213
232
  zIndex: e,
214
- ...me
233
+ ...we
215
234
  }
216
235
  },
217
236
  /* @__PURE__ */ i.createElement(
218
237
  "div",
219
238
  {
220
- className: D(A.animationChild({ c: C })),
239
+ className: D(T.animationChild({ c: O })),
221
240
  style: { transitionDelay: "0ms" }
222
241
  },
223
- /* @__PURE__ */ i.createElement("div", { role: re, className: D(A.popup({ c: C }), L) }, ce)
242
+ /* @__PURE__ */ i.createElement("div", { role: le, className: D(T.popup({ c: O }), S) }, pe)
224
243
  )
225
244
  ));
226
- return P !== null ? we.createPortal(r, ee) : r;
245
+ return P !== null ? Pe.createPortal(r, oe) : r;
227
246
  }
228
247
  return null;
229
248
  }), g = {
@@ -232,14 +251,14 @@ const ze = {
232
251
  vertical: w.flip
233
252
  },
234
253
  anchorAlign: {
235
- horizontal: l.left,
236
- vertical: l.bottom
254
+ horizontal: c.left,
255
+ vertical: c.bottom
237
256
  },
238
257
  popupAlign: {
239
- horizontal: l.left,
240
- vertical: l.top
258
+ horizontal: c.left,
259
+ vertical: c.top
241
260
  },
242
- offset: ze,
261
+ offset: Le,
243
262
  animate: !0,
244
263
  show: !1,
245
264
  margin: {
@@ -247,15 +266,18 @@ const ze = {
247
266
  vertical: 0
248
267
  },
249
268
  positionMode: "absolute"
269
+ }, ie = {
270
+ type: "slide",
271
+ direction: "down"
250
272
  };
251
- te.displayName = "Popup";
252
- te.propTypes = {
253
- anchor: function(c) {
254
- const p = c.anchor;
273
+ se.displayName = "Popup";
274
+ se.propTypes = {
275
+ anchor: function(l) {
276
+ const p = l.anchor;
255
277
  return p && typeof p.nodeType != "number" ? new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed.") : null;
256
278
  },
257
- appendTo: function(c) {
258
- const p = c.appendTo;
279
+ appendTo: function(l) {
280
+ const p = l.appendTo;
259
281
  return p && typeof p.nodeType != "number" ? new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed.") : null;
260
282
  },
261
283
  className: t.oneOfType([t.string, t.arrayOf(t.string.isRequired)]),
@@ -266,12 +288,12 @@ te.propTypes = {
266
288
  vertical: t.oneOf([w.fit, w.flip, w.none])
267
289
  }),
268
290
  anchorAlign: t.shape({
269
- horizontal: t.oneOf([l.left, l.center, l.right]),
270
- vertical: t.oneOf([l.top, l.center, l.bottom])
291
+ horizontal: t.oneOf([c.left, c.center, c.right]),
292
+ vertical: t.oneOf([c.top, c.center, c.bottom])
271
293
  }),
272
294
  popupAlign: t.shape({
273
- horizontal: t.oneOf([l.left, l.center, l.right]),
274
- vertical: t.oneOf([l.top, l.center, l.bottom])
295
+ horizontal: t.oneOf([c.left, c.center, c.right]),
296
+ vertical: t.oneOf([c.top, c.center, c.bottom])
275
297
  }),
276
298
  offset: t.shape({
277
299
  left: t.number,
@@ -282,6 +304,7 @@ te.propTypes = {
282
304
  animate: t.oneOfType([
283
305
  t.bool,
284
306
  t.shape({
307
+ type: t.oneOf(["slide", "zoom", "push", "expand", "fade"]),
285
308
  openDuration: t.number,
286
309
  closeDuration: t.number
287
310
  })
@@ -300,7 +323,7 @@ te.propTypes = {
300
323
  onMouseDownOutside: t.func
301
324
  };
302
325
  export {
303
- te as Popup,
304
- Te as PopupPropsContext,
326
+ se as Popup,
327
+ ze as PopupPropsContext,
305
328
  g as popupDefaultProps
306
329
  };
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 e=require("@progress/kendo-react-common"),w=(i,s,t)=>{i.style.transitionDuration="",s&&i.classList.remove(...s.split(" ")),t&&i.classList.remove(...t.split(" "))},y=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),p=(i,s,t,o,c,f)=>{if(t===0)return c();const r=e.classNames(e.uPopup.slide({direction:s,type:o,c:f})),a=e.classNames(e.uPopup.slideActive({direction:s,type:o,c:f})),u=n=>{n.target===i&&(i.removeEventListener("transitionend",u),w(i,r,a),o==="exit"?i.style.display="none":i.style.display="",c())};i.addEventListener("transitionend",u);const l=i.ownerDocument;if(!l)return;const d=l.defaultView;if(!d)return;const v=()=>{w(i,r,a),o==="enter"&&(i.style.display=""),r&&i.classList.add(...r.split(" ").filter(n=>n)),d.requestAnimationFrame(()=>{i.style.transitionDuration=t+"ms",i.classList.add(...a.split(" ").filter(n=>n))})};y?d.requestAnimationFrame(v):v()};exports.slide=p;
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;
package/animation.mjs CHANGED
@@ -5,29 +5,29 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { classNames as w, uPopup as v } from "@progress/kendo-react-common";
9
- const p = (i, s, t) => {
8
+ import { classNames as l, uPopup as p } from "@progress/kendo-react-common";
9
+ const y = (i, s, t) => {
10
10
  i.style.transitionDuration = "", s && i.classList.remove(...s.split(" ")), t && i.classList.remove(...t.split(" "));
11
- }, y = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), x = (i, s, t, r, d, f) => {
12
- if (t === 0)
13
- return d();
14
- const o = w(v.slide({ direction: s, type: r, c: f })), a = w(v.slideActive({ direction: s, type: r, c: f })), c = (n) => {
15
- n.target === i && (i.removeEventListener("transitionend", c), p(i, o, a), r === "exit" ? i.style.display = "none" : i.style.display = "", d());
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
16
  };
17
- i.addEventListener("transitionend", c);
18
- const u = i.ownerDocument;
19
- if (!u)
17
+ i.addEventListener("transitionend", u);
18
+ const v = i.ownerDocument;
19
+ if (!v)
20
20
  return;
21
- const e = u.defaultView;
22
- if (!e)
21
+ const a = v.defaultView;
22
+ if (!a)
23
23
  return;
24
- const l = () => {
25
- p(i, o, a), r === "enter" && (i.style.display = ""), o && i.classList.add(...o.split(" ").filter((n) => n)), e.requestAnimationFrame(() => {
26
- i.style.transitionDuration = t + "ms", i.classList.add(...a.split(" ").filter((n) => n));
24
+ 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
27
  });
28
28
  };
29
- y ? e.requestAnimationFrame(l) : l();
29
+ A ? a.requestAnimationFrame(w) : w();
30
30
  };
31
31
  export {
32
- x as slide
32
+ x as animations
33
33
  };
@@ -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,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 u=(e,n,t)=>{e.style.transitionDuration="",n&&e.classList.remove(...n.split(" ")),t&&e.classList.remove(...t.split(" "))},a="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),p=(e,n,t,o,i,s)=>{if(0===t)return i();const l=r.classNames(r.uPopup.slide({direction:n,type:o,c:s})),c=r.classNames(r.uPopup.slideActive({direction:n,type:o,c:s})),p=n=>{n.target===e&&(e.removeEventListener("transitionend",p),u(e,l,c),e.style.display="exit"===o?"none":"",i())};e.addEventListener("transitionend",p);const d=e.ownerDocument;if(!d)return;const f=d.defaultView;if(!f)return;const m=()=>{u(e,l,c),"enter"===o&&(e.style.display=""),l&&e.classList.add(...l.split(" ").filter((e=>e))),f.requestAnimationFrame((()=>{e.style.transitionDuration=t+"ms",e.classList.add(...c.split(" ").filter((e=>e)))}))};a?f.requestAnimationFrame(m):m()},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 r=t[o];if(e[r]!==n[r])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:u=h.popupAlign,offset:a=h.offset,animate:m=h.animate,show:g=h.show,margin:v=h.margin,positionMode:w=h.positionMode,appendTo:y,contentKey:P,anchor:A,scale:b,role:O,onKeyDown:C,onPosition:T,onOpen:x,onMouseDownOutside:D,onClose:E,className:N,popupClass:L,id:R,style:z,children:j}=t,K=r.useUnstyled(),M=t.unstyled||K,k=M&&M.uPopup,[q,I]=l.useState({current:"hidden",previous:"hidden",props:{}}),H=e=>{null==window||window.addEventListener("mousedown",V),F(e),U(e.firstChild,"enter",S),I({...te,current:"shown",previous:te.current})},F=e=>{const{width:n,height:t}=e.style;if(0===e.offsetWidth&&0===e.offsetHeight)return;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const r=i.alignElement({anchor:A,anchorAlign:s,element:e,elementAlign:u,offset:a,margin:v,positionMode:w,scale:b}),l=i.positionElement({anchor:A,anchorAlign:s,element:e,elementAlign:u,collisions:o,currentLocation:r,margin:v});if(e.style.top=l.offset.top+"px",e.style.left=l.offset.left+"px",e.style.width=n,e.style.height=t,X.current={fit:l.fit,fitted:l.fitted,flip:l.flip,flipped:l.flipped},T){const e={target:_.current,flipped:l.flipped,fitted:l.fitted};T.call(void 0,e)}},S=()=>{const e=$.current;e&&(g&&e.classList.add(...r.classNames(r.uPopup.animationContainerShown({c:k})).split(" ").filter((e=>e))),B(e),x&&x.call(void 0,{target:_.current}))},U=(n,t,o)=>{if(!u)return;let r;const{horizontal:i,vertical:s}=u;r="object"==typeof e.animate&&e.animate.direction?e.animate.direction:"left"===i&&"center"===s?"right":"right"===i&&"center"===s?"left":"top"===s?"down":"up";X.current&&X.current.flipped&&(r={down:"up",up:"down",left:"right",right:"left"}[r]),p(n,r,Z()[t],t,o,k)},V=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(D){const n={target:_.current,event:e,state:q,isAnchorClicked:o};D.call(void 0,n)}null==window||window.removeEventListener("mousedown",V)}},W=()=>{"hiding"===te.current&&("shown"===te.previous||"reposition"===te.previous)&&I({...te,current:"hidden",previous:te.current}),E&&E.call(void 0,{target:_.current})},Z=()=>{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}},B=e=>{G(),Y.current=i.domUtils.scrollableParents(A||e),Y.current&&Y.current.map((e=>e.addEventListener("scroll",J))),window.addEventListener("resize",J)},G=()=>{Y.current&&(Y.current.map((e=>e.removeEventListener("scroll",J))),Y.current=void 0),window.removeEventListener("resize",J)},J=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 u=(new Date).getTime();!l&&!1===t.leading&&(l=u);const a=n-(u-l);return r=void 0,i=arguments,a<=0||a>n?(o&&(clearTimeout(o),o=void 0),l=u,s=e.apply(r,i),o||(r=i=null)):!o&&!1!==t.trailing&&(o=window.setTimeout(c,a)),s}}((()=>{$.current&&"hidden"!==te.current&&"hiding"!==te.current&&I({...q,current:"reposition",previous:te.current})}),16.666666666666668),Q=r.useZIndexContext()||0,X=l.useRef(void 0),Y=l.useRef(void 0),$=l.useRef(null),_=l.useRef(null),ee=l.useRef({}),ne=l.useRef(!1);l.useImperativeHandle(_,(()=>({element:$.current,setPosition:F,props:e}))),l.useImperativeHandle(n,(()=>_.current));const te=l.useMemo((()=>{const e={...q,props:{show:g,anchor:A,anchorAlign:s,appendTo:y,collision:o,popupAlign:u,className:N,popupClass:L,style:z,offset:a,contentKey:P}};return g?"hidden"===q.current||"hiding"===q.current?{...e,current:"showing",previous:q.current}:"showing"===q.current?{...e,current:"shown",previous:q.current}:"shown"!==q.current||f(a,q.props.offset)&&f(s,q.props.anchorAlign)&&f(y,q.props.appendTo)&&f(o,q.props.collision)&&f(u,q.props.popupAlign)&&f(z,q.props.style)&&A===q.props.anchor&&L===q.props.popupClass&&N===q.props.className?e:{...e,current:"reposition",previous:q.current}:"hiding"===q.current||"hidden"===q.current?{...e,current:"hidden",previous:q.current}:{...e,current:"hiding",previous:q.current}}),[g,A,s,y,o,u,N,L,z,a,P,q]);l.useEffect((()=>{"hiding"===te.current&&!ne.current&&$.current?(ne.current=!0,(e=>{if(!g){const n=M&&M.uPopup;e.classList.remove(...r.classNames(r.uPopup.animationContainerShown({c:n})).split(" ").filter((e=>e)))}G()})($.current),U($.current.firstChild,"exit",W)):(ne.current=!1,"showing"===te.current&&$.current&&!$.current.classList.contains("k-animation-container-shown")?H($.current):"hiding"===te.current&&$.current?W():"reposition"===te.current&&"shown"===te.previous?setTimeout((()=>{I({...te,current:"shown",previous:te.current})}),0):"shown"===te.current&&ee.current.contentKey!==P&&$.current&&F($.current)),"reposition"===te.current&&("shown"===te.previous||"showing"===te.previous)&&$.current&&F($.current),ee.current={contentKey:P}}),[te]),l.useEffect((()=>("showing"===te.current&&$.current&&H($.current),()=>{G()})),[]);const oe=y||(r.canUseDOM?A&&A.ownerDocument?A.ownerDocument.body:document.body:void 0),re=Object.assign({},{position:w,top:0,left:-1e4},z||{}),ie="hiding"===te.current;if((g||ie)&&oe){const e=Q?Q+1:100,n=l.createElement(r.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:C,className:r.classNames(r.uPopup.animationContainer({c:k}),N),id:R,ref:$,style:{zIndex:e,...re}},l.createElement("div",{className:r.classNames(r.uPopup.animationChild({c:k})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:O,className:r.classNames(r.uPopup.popup({c:k}),L)},j))));return null!==y?c.createPortal(n,oe):n}return null})),h={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"};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([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({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 p=(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),a=(e,n,t,o,i,s,l)=>{if(0===n)return o();const c=`${s}Active`,a=r.classNames(r.uPopup[s]({direction:l,type:t,c:i})),d=r.classNames(r.uPopup[c]({direction:l,type:t,c:i})),f=n=>{n.target===e&&(e.removeEventListener("transitionend",f),p(e,a,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=()=>{p(e,a,d),"enter"===t&&(e.style.display=""),a&&e.classList.add(...a.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 r=t[o];if(e[r]!==n[r])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:p=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:A,anchor:b,scale:O,role:C,onKeyDown:x,onPosition:T,onOpen:D,onMouseDownOutside:E,onClose:N,className:L,popupClass:z,id:R,style:j,children:K}=t,M=r.useUnstyled(),k=t.unstyled||M,q=k&&k.uPopup,[I,H]=l.useState({current:"hidden",previous:"hidden",props:{}}),F=m&&"object"!=typeof m?g:{...g,...m},S=e=>{null==window||window.addEventListener("mousedown",Z),U(e),W(e.firstChild,"enter",V),H({...re,current:"shown",previous:re.current})},U=e=>{const{width:n,height:t}=e.style;if(0===e.offsetWidth&&0===e.offsetHeight)return;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const r=i.alignElement({anchor:b,anchorAlign:s,element:e,elementAlign:p,offset:u,margin:y,positionMode:w,scale:O}),l=i.positionElement({anchor:b,anchorAlign:s,element:e,elementAlign:p,collisions:o,currentLocation:r,margin:y});if(e.style.top=l.offset.top+"px",e.style.left=l.offset.left+"px",e.style.width=n,e.style.height=t,Y.current={fit:l.fit,fitted:l.fitted,flip:l.flip,flipped:l.flipped},T){const e={target:ne.current,flipped:l.flipped,fitted:l.fitted};T.call(void 0,e)}},V=()=>{const e=ee.current;e&&(v&&e.classList.add(...r.classNames(r.uPopup.animationContainerShown({c:q})).split(" ").filter((e=>e))),G(e),D&&D.call(void 0,{target:ne.current}))},W=(n,t,o)=>{if(p){if("slide"===F.type){let r;const{horizontal:i,vertical:s}=p;r="object"==typeof e.animate&&e.animate.direction?F.direction:"left"===i&&"center"===s?"right":"right"===i&&"center"===s?"left":"top"===s?"down":"up";const l={down:"up",up:"down",left:"right",right:"left"};Y.current&&Y.current.flipped&&(r=l[r],a(n,B()[t],t,o,q,F.type,r))}a(n,B()[t],t,o,q,F.type,F.direction)}},Z=e=>{var n;const t=null===(null==(n=null==e?void 0:e.target)?void 0:n.closest(".k-animation-container")),o=(null==b?void 0:b.contains(null==e?void 0:e.target))||!1;if(t){if(E){const n={target:ne.current,event:e,state:I,isAnchorClicked:o};E.call(void 0,n)}null==window||window.removeEventListener("mousedown",Z)}},$=()=>{"hiding"===re.current&&("shown"===re.previous||"reposition"===re.previous)&&H({...re,current:"hidden",previous:re.current}),N&&N.call(void 0,{target:ne.current})},B=()=>{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}},G=e=>{J(),_.current=i.domUtils.scrollableParents(b||e),_.current&&_.current.map((e=>e.addEventListener("scroll",Q))),window.addEventListener("resize",Q)},J=()=>{_.current&&(_.current.map((e=>e.removeEventListener("scroll",Q))),_.current=void 0),window.removeEventListener("resize",Q)},Q=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 p=(new Date).getTime();!l&&!1===t.leading&&(l=p);const u=n-(p-l);return r=void 0,i=arguments,u<=0||u>n?(o&&(clearTimeout(o),o=void 0),l=p,s=e.apply(r,i),o||(r=i=null)):!o&&!1!==t.trailing&&(o=window.setTimeout(c,u)),s}}((()=>{ee.current&&"hidden"!==re.current&&"hiding"!==re.current&&H({...I,current:"reposition",previous:re.current})}),16.666666666666668),X=r.useZIndexContext()||0,Y=l.useRef(void 0),_=l.useRef(void 0),ee=l.useRef(null),ne=l.useRef(null),te=l.useRef({}),oe=l.useRef(!1);l.useImperativeHandle(ne,(()=>({element:ee.current,setPosition:U,props:e}))),l.useImperativeHandle(n,(()=>ne.current));const re=l.useMemo((()=>{const e={...I,props:{show:v,anchor:b,anchorAlign:s,appendTo:P,collision:o,popupAlign:p,className:L,popupClass:z,style:j,offset:u,contentKey:A}};return v?"hidden"===I.current||"hiding"===I.current?{...e,current:"showing",previous:I.current}:"showing"===I.current?{...e,current:"shown",previous:I.current}:"shown"!==I.current||f(u,I.props.offset)&&f(s,I.props.anchorAlign)&&f(P,I.props.appendTo)&&f(o,I.props.collision)&&f(p,I.props.popupAlign)&&f(j,I.props.style)&&b===I.props.anchor&&z===I.props.popupClass&&L===I.props.className?e:{...e,current:"reposition",previous:I.current}:"hiding"===I.current||"hidden"===I.current?{...e,current:"hidden",previous:I.current}:{...e,current:"hiding",previous:I.current}}),[v,b,s,P,o,p,L,z,j,u,A,I]);l.useEffect((()=>{"hiding"===re.current&&!oe.current&&ee.current?(oe.current=!0,(e=>{if(!v){const n=k&&k.uPopup;e.classList.remove(...r.classNames(r.uPopup.animationContainerShown({c:n})).split(" ").filter((e=>e)))}J()})(ee.current),W(ee.current.firstChild,"exit",$)):(oe.current=!1,"showing"===re.current&&ee.current&&!ee.current.classList.contains("k-animation-container-shown")?S(ee.current):"hiding"===re.current&&ee.current?$():"reposition"===re.current&&"shown"===re.previous?setTimeout((()=>{H({...re,current:"shown",previous:re.current})}),0):"shown"===re.current&&te.current.contentKey!==A&&ee.current&&U(ee.current)),"reposition"===re.current&&("shown"===re.previous||"showing"===re.previous)&&ee.current&&U(ee.current),te.current={contentKey:A}}),[re]),l.useEffect((()=>("showing"===re.current&&ee.current&&S(ee.current),()=>{J()})),[]);const ie=P||(r.canUseDOM?b&&b.ownerDocument?b.ownerDocument.body:document.body:void 0),se=Object.assign({},{position:w,top:0,left:-1e4},j||{}),le="hiding"===re.current;if((v||le)&&ie){const e=X?X+1:100,n=l.createElement(r.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:x,className:r.classNames(r.uPopup.animationContainer({c:q}),L),id:R,ref:ee,style:{zIndex:e,...se}},l.createElement("div",{className:r.classNames(r.uPopup.animationChild({c:q})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:C,className:r.classNames(r.uPopup.popup({c:q}),z)},K))));return null!==P?c.createPortal(n,ie):n}return null})),h={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"},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([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=m,e.PopupPropsContext=d}));
package/index.d.mts CHANGED
@@ -38,6 +38,22 @@ export declare interface Align extends AlignStrategy {
38
38
  vertical: 'top' | 'center' | 'bottom';
39
39
  }
40
40
 
41
+ /**
42
+ * The available animation types for the Popup component.
43
+ *
44
+ * Possible values: 'slide', 'zoom', 'push', 'expand', 'fade'.
45
+ *
46
+ * @example
47
+ * <Popup animation={{ type: 'slide' }} />
48
+ */
49
+ declare const animationTypes: {
50
+ readonly slide: "slide";
51
+ readonly zoom: "zoom";
52
+ readonly push: "push";
53
+ readonly expand: "expand";
54
+ readonly fade: "fade";
55
+ };
56
+
41
57
  /**
42
58
  * Defines the horizontal and vertical collision behavior of the Popup.
43
59
  */
@@ -62,6 +78,44 @@ export declare interface Collision {
62
78
  */
63
79
  export declare type CollisionType = CollisionType_2;
64
80
 
81
+ /**
82
+ * Defines the expand animation settings for the Popup component.
83
+ *
84
+ * Use this to configure expand type and direction
85
+ *
86
+ * @example
87
+ * <Popup animation={{ type: 'expand', direction: 'vertical' }} />
88
+ */
89
+ export declare interface ExpandPopupAnimation {
90
+ /**
91
+ * The type of the animation. Must be 'expand'.
92
+ */
93
+ type: typeof animationTypes.expand;
94
+ /**
95
+ * The direction of the expand animation. Possible values: 'horizontal', 'vertical'.
96
+ */
97
+ direction: PopupExpandDirection;
98
+ }
99
+
100
+ /**
101
+ * Defines the fade animation settings for the Popup component.
102
+ *
103
+ * Use this to configure fade type. Direction is always 'none'.
104
+ *
105
+ * @example
106
+ * <Popup animation={{ type: 'fade' }} />
107
+ */
108
+ export declare interface FadePopupAnimation {
109
+ /**
110
+ * The type of the animation. Must be 'fade'.
111
+ */
112
+ type: typeof animationTypes.fade;
113
+ /**
114
+ * @hidden
115
+ */
116
+ direction?: PopupNoDirection;
117
+ }
118
+
65
119
  /**
66
120
  * Defines the horizontal and the vertical margin offset of the component.
67
121
  */
@@ -118,9 +172,19 @@ export declare interface Offset extends OffsetPosition {
118
172
  export declare const Popup: React_2.ForwardRefExoticComponent<PopupProps & React_2.RefAttributes<PopupHandle | null>>;
119
173
 
120
174
  /**
121
- * The animation settings for the Popup component.
175
+ * The animation settings for the Popup component
122
176
  */
123
- export declare interface PopupAnimation {
177
+ export declare type PopupAnimation = PopupAnimationBase & (FadePopupAnimation | SlidePopupAnimation | ZoomPopupAnimation | PushPopupAnimation | ExpandPopupAnimation);
178
+
179
+ /**
180
+ * Defines the base animation settings for the Popup component.
181
+ *
182
+ * Includes duration properties for opening and closing animations
183
+ *
184
+ * @example
185
+ * <Popup animation={{ openDuration: 500, closeDuration: 200 }} />
186
+ */
187
+ export declare interface PopupAnimationBase {
124
188
  /**
125
189
  * The duration of the opening animation in milliseconds. Defaults to `300ms`.
126
190
  */
@@ -129,12 +193,38 @@ export declare interface PopupAnimation {
129
193
  * The duration of the closing animation in milliseconds. Defaults to `300ms`.
130
194
  */
131
195
  closeDuration?: number;
132
- /**
133
- * The direction of the animation.
134
- */
135
- direction?: 'left' | 'right' | 'up' | 'down';
136
196
  }
137
197
 
198
+ /**
199
+ * Represents all possible direction values for Popup animations.
200
+ *
201
+ * Includes directions for slide, zoom, push, expand, and fade animations.
202
+ * Useful for type-safe direction assignment in animation settings.
203
+ *
204
+ * Possible values: 'left', 'right', 'up', 'down', 'in', 'out', 'horizontal', 'vertical', 'none'.
205
+ */
206
+ export declare type PopupAnimationDirection = NonNullable<FadePopupAnimation['direction'] | SlidePopupAnimation['direction'] | ZoomPopupAnimation['direction'] | PushPopupAnimation['direction'] | ExpandPopupAnimation['direction']>;
207
+
208
+ /**
209
+ * The type representing all possible animation type values.
210
+ *
211
+ * Possible values: 'slide', 'zoom', 'push', 'expand', 'fade'
212
+ *
213
+ * @example
214
+ * <Popup animation={{ type: 'fade' }} />
215
+ */
216
+ export declare type PopupAnimationType = (typeof animationTypes)[keyof typeof animationTypes];
217
+
218
+ /**
219
+ * The possible base directions for slide and push animations.
220
+ *
221
+ * Possible values: 'left', 'right', 'up', 'down'.
222
+ *
223
+ * @example
224
+ * <Popup animation={{ direction: 'left' }} />
225
+ */
226
+ export declare type PopupBaseDirections = 'left' | 'right' | 'up' | 'down';
227
+
138
228
  /**
139
229
  * Represents the object of the `Close` Popup event.
140
230
  */
@@ -145,6 +235,16 @@ export declare interface PopupCloseEvent {
145
235
  target: PopupHandle;
146
236
  }
147
237
 
238
+ /**
239
+ * The possible directions for expand animations.
240
+ *
241
+ * Possible values: 'horizontal', 'vertical'.
242
+ *
243
+ * @example
244
+ * <Popup animation={{ type: 'expand', direction: 'vertical' }} />
245
+ */
246
+ export declare type PopupExpandDirection = 'horizontal' | 'vertical';
247
+
148
248
  /**
149
249
  * The KendoReact PopupHandle component.
150
250
  */
@@ -159,6 +259,16 @@ export declare interface PopupHandle {
159
259
  props: PopupProps;
160
260
  }
161
261
 
262
+ /**
263
+ * Represents no direction for fade animation.
264
+ *
265
+ * Possible value: 'none'.
266
+ *
267
+ * @example
268
+ * <Popup animation={{ type: 'fade', direction: 'none' }} />
269
+ */
270
+ export declare type PopupNoDirection = 'none';
271
+
162
272
  /**
163
273
  * Represents the object of the `Open` Popup event.
164
274
  */
@@ -427,6 +537,16 @@ declare interface PopupState {
427
537
  };
428
538
  }
429
539
 
540
+ /**
541
+ * The possible directions for zoom animations.
542
+ *
543
+ * Possible values: 'in', 'out'.
544
+ *
545
+ * @example
546
+ * <Popup animation={{ type: 'zoom', direction: 'in' }} />
547
+ */
548
+ export declare type PopupZoomDirections = 'in' | 'out';
549
+
430
550
  /**
431
551
  * Represents the object of the `Position` Popup event.
432
552
  */
@@ -450,6 +570,44 @@ export declare interface PositionEvent {
450
570
  */
451
571
  export declare type PositionMode = PositionMode_2;
452
572
 
573
+ /**
574
+ * Defines the push animation settings for the Popup component.
575
+ *
576
+ * Use this to configure push type and direction
577
+ *
578
+ * @example
579
+ * <Popup animation={{ type: 'push', direction: 'down' }} />
580
+ */
581
+ export declare interface PushPopupAnimation {
582
+ /**
583
+ * The type of the animation. Must be 'push'.
584
+ */
585
+ type: typeof animationTypes.push;
586
+ /**
587
+ * The direction of the push animation. Possible values: 'left', 'right', 'up', 'down'.
588
+ */
589
+ direction: PopupBaseDirections;
590
+ }
591
+
592
+ /**
593
+ * Defines the slide animation settings for the Popup component.
594
+ *
595
+ * Use this to configure slide type and direction
596
+ *
597
+ * @example
598
+ * <Popup animation={{ type: 'slide', direction: 'left' }} />
599
+ */
600
+ export declare interface SlidePopupAnimation {
601
+ /**
602
+ * The type of the animation. Default is 'slide'.
603
+ */
604
+ type?: typeof animationTypes.slide;
605
+ /**
606
+ * The direction of the slide animation. Possible values: 'left', 'right', 'up', 'down'.
607
+ */
608
+ direction?: PopupBaseDirections;
609
+ }
610
+
453
611
  declare enum Status {
454
612
  hiding = "hiding",
455
613
  hidden = "hidden",
@@ -458,4 +616,23 @@ declare enum Status {
458
616
  reposition = "reposition"
459
617
  }
460
618
 
619
+ /**
620
+ * Defines the zoom animation settings for the Popup component.
621
+ *
622
+ * Use this to configure zoom type and direction
623
+ *
624
+ * @example
625
+ * <Popup animation={{ type: 'zoom', direction: 'in' }} />
626
+ */
627
+ export declare interface ZoomPopupAnimation {
628
+ /**
629
+ * The type of the animation. Must be 'zoom'.
630
+ */
631
+ type: typeof animationTypes.zoom;
632
+ /**
633
+ * The direction of the zoom animation. Possible values: 'in', 'out'.
634
+ */
635
+ direction: PopupZoomDirections;
636
+ }
637
+
461
638
  export { }
package/index.d.ts CHANGED
@@ -38,6 +38,22 @@ export declare interface Align extends AlignStrategy {
38
38
  vertical: 'top' | 'center' | 'bottom';
39
39
  }
40
40
 
41
+ /**
42
+ * The available animation types for the Popup component.
43
+ *
44
+ * Possible values: 'slide', 'zoom', 'push', 'expand', 'fade'.
45
+ *
46
+ * @example
47
+ * <Popup animation={{ type: 'slide' }} />
48
+ */
49
+ declare const animationTypes: {
50
+ readonly slide: "slide";
51
+ readonly zoom: "zoom";
52
+ readonly push: "push";
53
+ readonly expand: "expand";
54
+ readonly fade: "fade";
55
+ };
56
+
41
57
  /**
42
58
  * Defines the horizontal and vertical collision behavior of the Popup.
43
59
  */
@@ -62,6 +78,44 @@ export declare interface Collision {
62
78
  */
63
79
  export declare type CollisionType = CollisionType_2;
64
80
 
81
+ /**
82
+ * Defines the expand animation settings for the Popup component.
83
+ *
84
+ * Use this to configure expand type and direction
85
+ *
86
+ * @example
87
+ * <Popup animation={{ type: 'expand', direction: 'vertical' }} />
88
+ */
89
+ export declare interface ExpandPopupAnimation {
90
+ /**
91
+ * The type of the animation. Must be 'expand'.
92
+ */
93
+ type: typeof animationTypes.expand;
94
+ /**
95
+ * The direction of the expand animation. Possible values: 'horizontal', 'vertical'.
96
+ */
97
+ direction: PopupExpandDirection;
98
+ }
99
+
100
+ /**
101
+ * Defines the fade animation settings for the Popup component.
102
+ *
103
+ * Use this to configure fade type. Direction is always 'none'.
104
+ *
105
+ * @example
106
+ * <Popup animation={{ type: 'fade' }} />
107
+ */
108
+ export declare interface FadePopupAnimation {
109
+ /**
110
+ * The type of the animation. Must be 'fade'.
111
+ */
112
+ type: typeof animationTypes.fade;
113
+ /**
114
+ * @hidden
115
+ */
116
+ direction?: PopupNoDirection;
117
+ }
118
+
65
119
  /**
66
120
  * Defines the horizontal and the vertical margin offset of the component.
67
121
  */
@@ -118,9 +172,19 @@ export declare interface Offset extends OffsetPosition {
118
172
  export declare const Popup: React_2.ForwardRefExoticComponent<PopupProps & React_2.RefAttributes<PopupHandle | null>>;
119
173
 
120
174
  /**
121
- * The animation settings for the Popup component.
175
+ * The animation settings for the Popup component
122
176
  */
123
- export declare interface PopupAnimation {
177
+ export declare type PopupAnimation = PopupAnimationBase & (FadePopupAnimation | SlidePopupAnimation | ZoomPopupAnimation | PushPopupAnimation | ExpandPopupAnimation);
178
+
179
+ /**
180
+ * Defines the base animation settings for the Popup component.
181
+ *
182
+ * Includes duration properties for opening and closing animations
183
+ *
184
+ * @example
185
+ * <Popup animation={{ openDuration: 500, closeDuration: 200 }} />
186
+ */
187
+ export declare interface PopupAnimationBase {
124
188
  /**
125
189
  * The duration of the opening animation in milliseconds. Defaults to `300ms`.
126
190
  */
@@ -129,12 +193,38 @@ export declare interface PopupAnimation {
129
193
  * The duration of the closing animation in milliseconds. Defaults to `300ms`.
130
194
  */
131
195
  closeDuration?: number;
132
- /**
133
- * The direction of the animation.
134
- */
135
- direction?: 'left' | 'right' | 'up' | 'down';
136
196
  }
137
197
 
198
+ /**
199
+ * Represents all possible direction values for Popup animations.
200
+ *
201
+ * Includes directions for slide, zoom, push, expand, and fade animations.
202
+ * Useful for type-safe direction assignment in animation settings.
203
+ *
204
+ * Possible values: 'left', 'right', 'up', 'down', 'in', 'out', 'horizontal', 'vertical', 'none'.
205
+ */
206
+ export declare type PopupAnimationDirection = NonNullable<FadePopupAnimation['direction'] | SlidePopupAnimation['direction'] | ZoomPopupAnimation['direction'] | PushPopupAnimation['direction'] | ExpandPopupAnimation['direction']>;
207
+
208
+ /**
209
+ * The type representing all possible animation type values.
210
+ *
211
+ * Possible values: 'slide', 'zoom', 'push', 'expand', 'fade'
212
+ *
213
+ * @example
214
+ * <Popup animation={{ type: 'fade' }} />
215
+ */
216
+ export declare type PopupAnimationType = (typeof animationTypes)[keyof typeof animationTypes];
217
+
218
+ /**
219
+ * The possible base directions for slide and push animations.
220
+ *
221
+ * Possible values: 'left', 'right', 'up', 'down'.
222
+ *
223
+ * @example
224
+ * <Popup animation={{ direction: 'left' }} />
225
+ */
226
+ export declare type PopupBaseDirections = 'left' | 'right' | 'up' | 'down';
227
+
138
228
  /**
139
229
  * Represents the object of the `Close` Popup event.
140
230
  */
@@ -145,6 +235,16 @@ export declare interface PopupCloseEvent {
145
235
  target: PopupHandle;
146
236
  }
147
237
 
238
+ /**
239
+ * The possible directions for expand animations.
240
+ *
241
+ * Possible values: 'horizontal', 'vertical'.
242
+ *
243
+ * @example
244
+ * <Popup animation={{ type: 'expand', direction: 'vertical' }} />
245
+ */
246
+ export declare type PopupExpandDirection = 'horizontal' | 'vertical';
247
+
148
248
  /**
149
249
  * The KendoReact PopupHandle component.
150
250
  */
@@ -159,6 +259,16 @@ export declare interface PopupHandle {
159
259
  props: PopupProps;
160
260
  }
161
261
 
262
+ /**
263
+ * Represents no direction for fade animation.
264
+ *
265
+ * Possible value: 'none'.
266
+ *
267
+ * @example
268
+ * <Popup animation={{ type: 'fade', direction: 'none' }} />
269
+ */
270
+ export declare type PopupNoDirection = 'none';
271
+
162
272
  /**
163
273
  * Represents the object of the `Open` Popup event.
164
274
  */
@@ -427,6 +537,16 @@ declare interface PopupState {
427
537
  };
428
538
  }
429
539
 
540
+ /**
541
+ * The possible directions for zoom animations.
542
+ *
543
+ * Possible values: 'in', 'out'.
544
+ *
545
+ * @example
546
+ * <Popup animation={{ type: 'zoom', direction: 'in' }} />
547
+ */
548
+ export declare type PopupZoomDirections = 'in' | 'out';
549
+
430
550
  /**
431
551
  * Represents the object of the `Position` Popup event.
432
552
  */
@@ -450,6 +570,44 @@ export declare interface PositionEvent {
450
570
  */
451
571
  export declare type PositionMode = PositionMode_2;
452
572
 
573
+ /**
574
+ * Defines the push animation settings for the Popup component.
575
+ *
576
+ * Use this to configure push type and direction
577
+ *
578
+ * @example
579
+ * <Popup animation={{ type: 'push', direction: 'down' }} />
580
+ */
581
+ export declare interface PushPopupAnimation {
582
+ /**
583
+ * The type of the animation. Must be 'push'.
584
+ */
585
+ type: typeof animationTypes.push;
586
+ /**
587
+ * The direction of the push animation. Possible values: 'left', 'right', 'up', 'down'.
588
+ */
589
+ direction: PopupBaseDirections;
590
+ }
591
+
592
+ /**
593
+ * Defines the slide animation settings for the Popup component.
594
+ *
595
+ * Use this to configure slide type and direction
596
+ *
597
+ * @example
598
+ * <Popup animation={{ type: 'slide', direction: 'left' }} />
599
+ */
600
+ export declare interface SlidePopupAnimation {
601
+ /**
602
+ * The type of the animation. Default is 'slide'.
603
+ */
604
+ type?: typeof animationTypes.slide;
605
+ /**
606
+ * The direction of the slide animation. Possible values: 'left', 'right', 'up', 'down'.
607
+ */
608
+ direction?: PopupBaseDirections;
609
+ }
610
+
453
611
  declare enum Status {
454
612
  hiding = "hiding",
455
613
  hidden = "hidden",
@@ -458,4 +616,23 @@ declare enum Status {
458
616
  reposition = "reposition"
459
617
  }
460
618
 
619
+ /**
620
+ * Defines the zoom animation settings for the Popup component.
621
+ *
622
+ * Use this to configure zoom type and direction
623
+ *
624
+ * @example
625
+ * <Popup animation={{ type: 'zoom', direction: 'in' }} />
626
+ */
627
+ export declare interface ZoomPopupAnimation {
628
+ /**
629
+ * The type of the animation. Must be 'zoom'.
630
+ */
631
+ type: typeof animationTypes.zoom;
632
+ /**
633
+ * The direction of the zoom animation. Possible values: 'in', 'out'.
634
+ */
635
+ direction: PopupZoomDirections;
636
+ }
637
+
461
638
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-popup",
3
- "version": "12.0.3-develop.2",
3
+ "version": "12.1.0-develop.2",
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.0",
29
29
  "@progress/kendo-popup-common": "^1.9.0",
30
- "@progress/kendo-react-common": "12.0.3-develop.2",
30
+ "@progress/kendo-react-common": "12.1.0-develop.2",
31
31
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
32
32
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
33
33
  },