@progress/kendo-react-popup 9.1.0-develop.7 → 9.1.0-develop.8
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 +1 -1
- package/Popup.mjs +40 -42
- package/dist/cdn/js/kendo-react-popup.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +2 -2
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 client";"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"),Oe=require("./package-metadata.js");function ne(i){const c=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(c,h,v.get?v:{enumerable:!0,get:()=>i[h]})}}return c.default=i,Object.freeze(c)}const l=ne(we),Ae=ne(ve),te=l.createContext(i=>i),Ce=100,be=1;function E(i,c){if(i===c)return!0;if(!!i!=!!c)return!1;const h=Object.getOwnPropertyNames(i),v=Object.getOwnPropertyNames(c);if(h.length!==v.length)return!1;for(let P=0;P<h.length;P++){const w=h[P];if(i[w]!==c[w])return!1}return!0}const Ee={left:-1e3,top:0},U=l.forwardRef((i,c)=>{const v=l.useContext(te).call(void 0,i);a.validatePackage(Oe.packageMetadata);const{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:K=g.margin,positionMode:Z=g.positionMode,appendTo:A,contentKey:T,anchor:f,scale:re,role:ie,onKeyDown:se,onPosition:F,onOpen:H,onMouseDownOutside:V,onClose:X,className:N,popupClass:M,id:le,style:z,children:ce}=v,ue=a.useUnstyled(),S=v.unstyled||ue,D=S&&S.uPopup,[
|
|
8
|
+
"use client";"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"),Oe=require("./package-metadata.js");function ne(i){const c=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(c,h,v.get?v:{enumerable:!0,get:()=>i[h]})}}return c.default=i,Object.freeze(c)}const l=ne(we),Ae=ne(ve),te=l.createContext(i=>i),Ce=100,be=1;function E(i,c){if(i===c)return!0;if(!!i!=!!c)return!1;const h=Object.getOwnPropertyNames(i),v=Object.getOwnPropertyNames(c);if(h.length!==v.length)return!1;for(let P=0;P<h.length;P++){const w=h[P];if(i[w]!==c[w])return!1}return!0}const Ee={left:-1e3,top:0},U=l.forwardRef((i,c)=>{const v=l.useContext(te).call(void 0,i);a.validatePackage(Oe.packageMetadata);const{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:K=g.margin,positionMode:Z=g.positionMode,appendTo:A,contentKey:T,anchor:f,scale:re,role:ie,onKeyDown:se,onPosition:F,onOpen:H,onMouseDownOutside:V,onClose:X,className:N,popupClass:M,id:le,style:z,children:ce}=v,ue=a.useUnstyled(),S=v.unstyled||ue,D=S&&S.uPopup,[r,k]=l.useState({current:"hidden",previous:"hidden",props:{}}),W=e=>{window==null||window.addEventListener("mousedown",G),I(e),B(e.firstChild,"enter",ae),k({...o,current:"shown",previous:o.current})},I=e=>{const{width:s,height:m}=e.style;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const d=t.alignElement({anchor:f,anchorAlign:w,element:e,elementAlign:y,offset:R,margin:K,positionMode:Z,scale:re}),p=t.positionElement({anchor:f,anchorAlign:w,element:e,elementAlign:y,collisions:P,currentLocation:d,margin:K});if(e.style.top=p.offset.top+"px",e.style.left=p.offset.left+"px",e.style.width=s,e.style.height=m,j.current={fit:p.fit,fitted:p.fitted,flip:p.flip,flipped:p.flipped},F){const x={target:b.current,flipped:p.flipped,fitted:p.fitted};F.call(void 0,x)}},ae=()=>{const e=u.current;e&&(O&&e.classList.add(...a.classNames(a.uPopup.animationContainerShown({c:D})).split(" ").filter(s=>s)),de(e),H&&H.call(void 0,{target:b.current}))},B=(e,s,m)=>{if(!y)return;let d;const{horizontal:p,vertical:x}=y;p==="left"&&x==="center"?d="right":p==="right"&&x==="center"?d="left":x==="top"?d="down":d="up";const Pe={down:"up",up:"down",left:"right",right:"left"};j.current&&j.current.flipped&&(d=Pe[d]),ye.slide(e,d,fe()[s],s,m,D)},G=e=>{var d;const s=((d=e==null?void 0:e.target)==null?void 0:d.closest(".k-animation-container"))===null,m=(f==null?void 0:f.contains(e==null?void 0:e.target))||!1;if(s){if(V){const p={target:b.current,event:e,state:o,isAnchorClicked:m};V.call(void 0,p)}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=()=>{o.current==="hiding"&&(o.previous==="shown"||o.previous==="reposition")&&k({...o,current:"hidden",previous:o.current}),X&&X.call(void 0,{target:b.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=>{_(),C.current=t.domUtils.scrollableParents(f||e),C.current&&C.current.map(s=>s.addEventListener("scroll",L)),window.addEventListener("resize",L)},_=()=>{C.current&&(C.current.map(e=>e.removeEventListener("scroll",L)),C.current=void 0),window.removeEventListener("resize",L)},L=ee.throttle(()=>{o.current!=="hidden"&&o.current!=="hiding"&&k({...r,current:"reposition",previous:o.current})},ee.FRAME_DURATION),me=()=>Q?Q+be:Ce,Q=a.useZIndexContext()||0,j=l.useRef(),C=l.useRef(),u=l.useRef(null),b=l.useRef(null),Y=l.useRef({}),q=l.useRef(!1);l.useImperativeHandle(b,()=>({element:u.current,setPosition:I,props:i})),l.useImperativeHandle(c,()=>b.current);const o=l.useMemo(()=>{const e={...r,props:{show:O,anchor:f,anchorAlign:w,appendTo:A,collision:P,popupAlign:y,className:N,popupClass:M,style:z,offset:R,contentKey:T}};return O?r.current==="hidden"||r.current==="hiding"?{...e,current:"showing",previous:r.current}:r.current==="showing"?{...e,current:"shown",previous:r.current}:r.current==="shown"&&(!E(R,r.props.offset)||!E(w,r.props.anchorAlign)||!E(A,r.props.appendTo)||!E(P,r.props.collision)||!E(y,r.props.popupAlign)||!E(z,r.props.style)||f!==r.props.anchor||M!==r.props.popupClass||N!==r.props.className)?{...e,current:"reposition",previous:r.current}:e:r.current==="hiding"||r.current==="hidden"?{...e,current:"hidden",previous:r.current}:{...e,current:"hiding",previous:r.current}},[O,f,w,A,P,y,N,M,z,R,T,r]);l.useEffect(()=>{o.current==="hiding"&&!q.current&&u.current?(q.current=!0,pe(u.current),B(u.current.firstChild,"exit",J)):(q.current=!1,o.current==="showing"&&u.current?W(u.current):o.current==="hiding"&&u.current?J():o.current==="reposition"&&o.previous==="shown"?setTimeout(()=>{k({...o,current:"shown",previous:o.current})},0):o.current==="shown"&&Y.current.contentKey!==T&&u.current&&I(u.current)),o.current==="reposition"&&(o.previous==="shown"||o.previous==="showing")&&u.current&&I(u.current),Y.current={contentKey:T}},[o]),l.useEffect(()=>(o.current==="showing"&&u.current&&W(u.current),()=>{_()}),[]);const $=A||(a.canUseDOM?f&&f.ownerDocument?f.ownerDocument.body:document.body:void 0),he=Object.assign({},{position:Z,top:0,left:-1e4},z||{}),ge=o.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:u,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}),M)},ce))));return A!==null?Ae.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:Ee,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"};U.displayName="Popup";U.propTypes={anchor:function(i){const c=i.anchor;return c&&typeof c.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(i){const c=i.appendTo;return c&&typeof c.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;
|
package/Popup.mjs
CHANGED
|
@@ -15,17 +15,17 @@ import { Collision as w, AlignPoint as s, alignElement as Ce, positionElement as
|
|
|
15
15
|
import { throttle as Ae, FRAME_DURATION as Te } from "./util.mjs";
|
|
16
16
|
import { packageMetadata as Re } from "./package-metadata.mjs";
|
|
17
17
|
const Ne = i.createContext((l) => l), ze = 100, Ie = 1;
|
|
18
|
-
function b(l,
|
|
19
|
-
if (l ===
|
|
18
|
+
function b(l, a) {
|
|
19
|
+
if (l === a)
|
|
20
20
|
return !0;
|
|
21
|
-
if (!!l != !!
|
|
21
|
+
if (!!l != !!a)
|
|
22
22
|
return !1;
|
|
23
|
-
const T = Object.getOwnPropertyNames(l), R = Object.getOwnPropertyNames(
|
|
23
|
+
const T = Object.getOwnPropertyNames(l), R = Object.getOwnPropertyNames(a);
|
|
24
24
|
if (T.length !== R.length)
|
|
25
25
|
return !1;
|
|
26
26
|
for (let m = 0; m < T.length; m++) {
|
|
27
27
|
const h = T[m];
|
|
28
|
-
if (l[h] !==
|
|
28
|
+
if (l[h] !== a[h])
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
31
|
return !0;
|
|
@@ -33,7 +33,7 @@ function b(l, u) {
|
|
|
33
33
|
const Me = {
|
|
34
34
|
left: -1e3,
|
|
35
35
|
top: 0
|
|
36
|
-
}, te = i.forwardRef((l,
|
|
36
|
+
}, te = i.forwardRef((l, a) => {
|
|
37
37
|
const R = i.useContext(Ne).call(void 0, l);
|
|
38
38
|
ye(Re);
|
|
39
39
|
const {
|
|
@@ -60,12 +60,12 @@ const Me = {
|
|
|
60
60
|
id: se,
|
|
61
61
|
style: L,
|
|
62
62
|
children: ce
|
|
63
|
-
} = R, le = Pe(), S = R.unstyled || le, C = S && S.uPopup, [
|
|
63
|
+
} = R, le = Pe(), S = R.unstyled || le, C = S && S.uPopup, [o, U] = i.useState({
|
|
64
64
|
current: "hidden",
|
|
65
65
|
previous: "hidden",
|
|
66
66
|
props: {}
|
|
67
67
|
}), B = (e) => {
|
|
68
|
-
window == null || window.addEventListener("mousedown", J), k(e), G(e.firstChild, "enter",
|
|
68
|
+
window == null || window.addEventListener("mousedown", J), k(e), G(e.firstChild, "enter", ue), U({ ...n, current: "shown", previous: n.current });
|
|
69
69
|
}, k = (e) => {
|
|
70
70
|
const { width: r, height: d } = e.style;
|
|
71
71
|
e.style.width = e.offsetWidth + "px", e.style.height = e.offsetHeight + "px";
|
|
@@ -78,7 +78,7 @@ const Me = {
|
|
|
78
78
|
margin: F,
|
|
79
79
|
positionMode: H,
|
|
80
80
|
scale: oe
|
|
81
|
-
}),
|
|
81
|
+
}), u = xe({
|
|
82
82
|
anchor: p,
|
|
83
83
|
anchorAlign: h,
|
|
84
84
|
element: e,
|
|
@@ -87,20 +87,20 @@ const Me = {
|
|
|
87
87
|
currentLocation: f,
|
|
88
88
|
margin: F
|
|
89
89
|
});
|
|
90
|
-
if (e.style.top =
|
|
91
|
-
fit:
|
|
92
|
-
fitted:
|
|
93
|
-
flip:
|
|
94
|
-
flipped:
|
|
90
|
+
if (e.style.top = u.offset.top + "px", e.style.left = u.offset.left + "px", e.style.width = r, e.style.height = d, _.current = {
|
|
91
|
+
fit: u.fit,
|
|
92
|
+
fitted: u.fitted,
|
|
93
|
+
flip: u.flip,
|
|
94
|
+
flipped: u.flipped
|
|
95
95
|
}, q) {
|
|
96
96
|
const x = {
|
|
97
97
|
target: E.current,
|
|
98
|
-
flipped:
|
|
99
|
-
fitted:
|
|
98
|
+
flipped: u.flipped,
|
|
99
|
+
fitted: u.fitted
|
|
100
100
|
};
|
|
101
101
|
q.call(void 0, x);
|
|
102
102
|
}
|
|
103
|
-
},
|
|
103
|
+
}, ue = () => {
|
|
104
104
|
const e = c.current;
|
|
105
105
|
e && (y && e.classList.add(
|
|
106
106
|
...D(A.animationContainerShown({ c: C })).split(" ").filter((r) => r)
|
|
@@ -109,8 +109,8 @@ const Me = {
|
|
|
109
109
|
if (!v)
|
|
110
110
|
return;
|
|
111
111
|
let f;
|
|
112
|
-
const { horizontal:
|
|
113
|
-
|
|
112
|
+
const { horizontal: u, vertical: x } = v;
|
|
113
|
+
u === "left" && x === "center" ? f = "right" : u === "right" && x === "center" ? f = "left" : x === "top" ? f = "down" : f = "up";
|
|
114
114
|
const ge = {
|
|
115
115
|
down: "up",
|
|
116
116
|
up: "down",
|
|
@@ -123,17 +123,17 @@ const Me = {
|
|
|
123
123
|
const r = ((f = e == null ? void 0 : e.target) == null ? void 0 : f.closest(".k-animation-container")) === null, d = (p == null ? void 0 : p.contains(e == null ? void 0 : e.target)) || !1;
|
|
124
124
|
if (r) {
|
|
125
125
|
if (X) {
|
|
126
|
-
const
|
|
126
|
+
const u = {
|
|
127
127
|
target: E.current,
|
|
128
128
|
event: e,
|
|
129
|
-
state:
|
|
129
|
+
state: n,
|
|
130
130
|
isAnchorClicked: d
|
|
131
131
|
};
|
|
132
|
-
X.call(void 0,
|
|
132
|
+
X.call(void 0, u);
|
|
133
133
|
}
|
|
134
134
|
window == null || window.removeEventListener("mousedown", J);
|
|
135
135
|
}
|
|
136
|
-
},
|
|
136
|
+
}, ae = (e) => {
|
|
137
137
|
if (!y) {
|
|
138
138
|
const r = S && S.uPopup;
|
|
139
139
|
e.classList.remove(
|
|
@@ -142,7 +142,7 @@ const Me = {
|
|
|
142
142
|
}
|
|
143
143
|
Z();
|
|
144
144
|
}, Q = () => {
|
|
145
|
-
|
|
145
|
+
n.current === "hiding" && (n.previous === "shown" || n.previous === "reposition") && U({ ...n, current: "hidden", previous: n.current }), W && W.call(void 0, { target: E.current });
|
|
146
146
|
}, pe = () => {
|
|
147
147
|
const e = ne;
|
|
148
148
|
let r = 0, d = 0;
|
|
@@ -152,16 +152,16 @@ const Me = {
|
|
|
152
152
|
}, Z = () => {
|
|
153
153
|
O.current && (O.current.map((e) => e.removeEventListener("scroll", K)), O.current = void 0), window.removeEventListener("resize", K);
|
|
154
154
|
}, K = Ae(() => {
|
|
155
|
-
n.current !== "hidden" && n.current !== "hiding" && U({ ...
|
|
155
|
+
n.current !== "hidden" && n.current !== "hiding" && U({ ...o, current: "reposition", previous: n.current });
|
|
156
156
|
}, Te), de = () => Y ? Y + Ie : ze, Y = Oe() || 0, _ = i.useRef(), O = i.useRef(), c = i.useRef(null), E = i.useRef(null), $ = i.useRef({}), j = i.useRef(!1);
|
|
157
157
|
i.useImperativeHandle(E, () => ({
|
|
158
158
|
element: c.current,
|
|
159
159
|
setPosition: k,
|
|
160
160
|
props: l
|
|
161
|
-
})), i.useImperativeHandle(
|
|
162
|
-
const
|
|
161
|
+
})), i.useImperativeHandle(a, () => E.current);
|
|
162
|
+
const n = i.useMemo(() => {
|
|
163
163
|
const e = {
|
|
164
|
-
...
|
|
164
|
+
...o,
|
|
165
165
|
props: {
|
|
166
166
|
show: y,
|
|
167
167
|
anchor: p,
|
|
@@ -176,7 +176,7 @@ const Me = {
|
|
|
176
176
|
contentKey: z
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
return y ?
|
|
179
|
+
return y ? 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(N, o.props.offset) || !b(h, o.props.anchorAlign) || !b(P, o.props.appendTo) || !b(m, o.props.collision) || !b(v, o.props.popupAlign) || !b(L, o.props.style) || p !== o.props.anchor || M !== o.props.popupClass || I !== 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 };
|
|
180
180
|
}, [
|
|
181
181
|
y,
|
|
182
182
|
p,
|
|
@@ -189,22 +189,20 @@ const Me = {
|
|
|
189
189
|
L,
|
|
190
190
|
N,
|
|
191
191
|
z,
|
|
192
|
-
|
|
192
|
+
o
|
|
193
193
|
]);
|
|
194
194
|
i.useEffect(() => {
|
|
195
|
-
|
|
196
|
-
U({ ...
|
|
197
|
-
}, 0) :
|
|
198
|
-
}, [
|
|
195
|
+
n.current === "hiding" && !j.current && c.current ? (j.current = !0, ae(c.current), G(c.current.firstChild, "exit", Q)) : (j.current = !1, n.current === "showing" && c.current ? B(c.current) : n.current === "hiding" && c.current ? Q() : n.current === "reposition" && n.previous === "shown" ? setTimeout(() => {
|
|
196
|
+
U({ ...n, current: "shown", previous: n.current });
|
|
197
|
+
}, 0) : n.current === "shown" && $.current.contentKey !== z && c.current && k(c.current)), n.current === "reposition" && (n.previous === "shown" || n.previous === "showing") && c.current && k(c.current), $.current = { contentKey: z };
|
|
198
|
+
}, [n]), i.useEffect(() => (n.current === "showing" && c.current && B(c.current), () => {
|
|
199
199
|
Z();
|
|
200
200
|
}), []);
|
|
201
|
-
const ee = P || (Ee ? p && p.ownerDocument ? p.ownerDocument.body : document.body : void 0)
|
|
202
|
-
o.current === "reposition" && o.previous === "shown" && c.current && k(c.current);
|
|
203
|
-
const me = Object.assign(
|
|
201
|
+
const ee = P || (Ee ? p && p.ownerDocument ? p.ownerDocument.body : document.body : void 0), me = Object.assign(
|
|
204
202
|
{},
|
|
205
203
|
{ position: H, top: 0, left: -1e4 },
|
|
206
204
|
L || {}
|
|
207
|
-
), he =
|
|
205
|
+
), he = n.current === "hiding";
|
|
208
206
|
if ((y || he) && ee) {
|
|
209
207
|
const e = de(), r = /* @__PURE__ */ i.createElement(be.Provider, { value: e }, /* @__PURE__ */ i.createElement(
|
|
210
208
|
"div",
|
|
@@ -255,12 +253,12 @@ const Me = {
|
|
|
255
253
|
te.displayName = "Popup";
|
|
256
254
|
te.propTypes = {
|
|
257
255
|
anchor: function(l) {
|
|
258
|
-
const
|
|
259
|
-
return
|
|
256
|
+
const a = l.anchor;
|
|
257
|
+
return a && typeof a.nodeType != "number" ? new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed.") : null;
|
|
260
258
|
},
|
|
261
259
|
appendTo: function(l) {
|
|
262
|
-
const
|
|
263
|
-
return
|
|
260
|
+
const a = l.appendTo;
|
|
261
|
+
return a && typeof a.nodeType != "number" ? new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed.") : null;
|
|
264
262
|
},
|
|
265
263
|
className: t.oneOfType([t.string, t.arrayOf(t.string.isRequired)]),
|
|
266
264
|
id: t.string,
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!function(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(" "))},p="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),a=(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})),a=n=>{n.target===e&&(e.removeEventListener("transitionend",a),u(e,l,c),e.style.display="exit"===o?"none":"",i())};e.addEventListener("transitionend",a);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)))}))};p?f.requestAnimationFrame(m):m()},d={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},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 g=l.forwardRef(((e,n)=>{const t=l.useContext(f).call(void 0,e);r.validatePackage(d);const{collision:o=h.collision,anchorAlign:s=h.anchorAlign,popupAlign:u=h.popupAlign,offset:p=h.offset,animate:g=h.animate,show:v=h.show,margin:w=h.margin,positionMode:y=h.positionMode,appendTo:P,contentKey:A,anchor:b,scale:O,role:C,onKeyDown:D,onPosition:E,onOpen:T,onMouseDownOutside:x,onClose:N,className:L,popupClass:R,id:K,style:z,children:j}=t,k=r.useUnstyled(),M=t.unstyled||k,I=M&&M.uPopup,[q,U]=l.useState({current:"hidden",previous:"hidden",props:{}}),F=e=>{null==window||window.addEventListener("mousedown",Z),H(e),V(e.firstChild,"enter",S),U({...oe,current:"shown",previous:oe.current})},H=e=>{const{width:n,height:t}=e.style;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const r=i.alignElement({anchor:b,anchorAlign:s,element:e,elementAlign:u,offset:p,margin:w,positionMode:y,scale:O}),l=i.positionElement({anchor:b,anchorAlign:s,element:e,elementAlign:u,collisions:o,currentLocation:r,margin:w});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},E){const e={target:ee.current,flipped:l.flipped,fitted:l.fitted};E.call(void 0,e)}},S=()=>{const e=_.current;e&&(v&&e.classList.add(...r.classNames(r.uPopup.animationContainerShown({c:I})).split(" ").filter((e=>e))),G(e),T&&T.call(void 0,{target:ee.current}))},V=(e,n,t)=>{if(!u)return;let o;const{horizontal:r,vertical:i}=u;o="left"===r&&"center"===i?"right":"right"===r&&"center"===i?"left":"top"===i?"down":"up";Y.current&&Y.current.flipped&&(o={down:"up",up:"down",left:"right",right:"left"}[o]),a(e,o,B()[n],n,t,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==b?void 0:b.contains(null==e?void 0:e.target))||!1;if(t){if(x){const n={target:ee.current,event:e,state:oe,isAnchorClicked:o};x.call(void 0,n)}null==window||window.removeEventListener("mousedown",Z)}},W=()=>{"hiding"===oe.current&&"shown"===oe.previous&&U({...oe,current:"hidden",previous:oe.current}),N&&N.call(void 0,{target:ee.current})},B=()=>{const e=g;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 u=(new Date).getTime();!l&&!1===t.leading&&(l=u);const p=n-(u-l);return r=void 0,i=arguments,p<=0||p>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,p)),s}}((()=>{"hidden"!==
|
|
8
|
+
!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(" "))},p="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),a=(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})),a=n=>{n.target===e&&(e.removeEventListener("transitionend",a),u(e,l,c),e.style.display="exit"===o?"none":"",i())};e.addEventListener("transitionend",a);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)))}))};p?f.requestAnimationFrame(m):m()},d={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},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 g=l.forwardRef(((e,n)=>{const t=l.useContext(f).call(void 0,e);r.validatePackage(d);const{collision:o=h.collision,anchorAlign:s=h.anchorAlign,popupAlign:u=h.popupAlign,offset:p=h.offset,animate:g=h.animate,show:v=h.show,margin:w=h.margin,positionMode:y=h.positionMode,appendTo:P,contentKey:A,anchor:b,scale:O,role:C,onKeyDown:D,onPosition:E,onOpen:T,onMouseDownOutside:x,onClose:N,className:L,popupClass:R,id:K,style:z,children:j}=t,k=r.useUnstyled(),M=t.unstyled||k,I=M&&M.uPopup,[q,U]=l.useState({current:"hidden",previous:"hidden",props:{}}),F=e=>{null==window||window.addEventListener("mousedown",Z),H(e),V(e.firstChild,"enter",S),U({...oe,current:"shown",previous:oe.current})},H=e=>{const{width:n,height:t}=e.style;e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";const r=i.alignElement({anchor:b,anchorAlign:s,element:e,elementAlign:u,offset:p,margin:w,positionMode:y,scale:O}),l=i.positionElement({anchor:b,anchorAlign:s,element:e,elementAlign:u,collisions:o,currentLocation:r,margin:w});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},E){const e={target:ee.current,flipped:l.flipped,fitted:l.fitted};E.call(void 0,e)}},S=()=>{const e=_.current;e&&(v&&e.classList.add(...r.classNames(r.uPopup.animationContainerShown({c:I})).split(" ").filter((e=>e))),G(e),T&&T.call(void 0,{target:ee.current}))},V=(e,n,t)=>{if(!u)return;let o;const{horizontal:r,vertical:i}=u;o="left"===r&&"center"===i?"right":"right"===r&&"center"===i?"left":"top"===i?"down":"up";Y.current&&Y.current.flipped&&(o={down:"up",up:"down",left:"right",right:"left"}[o]),a(e,o,B()[n],n,t,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==b?void 0:b.contains(null==e?void 0:e.target))||!1;if(t){if(x){const n={target:ee.current,event:e,state:oe,isAnchorClicked:o};x.call(void 0,n)}null==window||window.removeEventListener("mousedown",Z)}},W=()=>{"hiding"===oe.current&&("shown"===oe.previous||"reposition"===oe.previous)&&U({...oe,current:"hidden",previous:oe.current}),N&&N.call(void 0,{target:ee.current})},B=()=>{const e=g;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 u=(new Date).getTime();!l&&!1===t.leading&&(l=u);const p=n-(u-l);return r=void 0,i=arguments,p<=0||p>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,p)),s}}((()=>{"hidden"!==oe.current&&"hiding"!==oe.current&&U({...q,current:"reposition",previous:oe.current})}),16.666666666666668),X=r.useZIndexContext()||0,Y=l.useRef(),$=l.useRef(),_=l.useRef(null),ee=l.useRef(null),ne=l.useRef({}),te=l.useRef(!1);l.useImperativeHandle(ee,(()=>({element:_.current,setPosition:H,props:e}))),l.useImperativeHandle(n,(()=>ee.current));const oe=l.useMemo((()=>{const e={...q,props:{show:v,anchor:b,anchorAlign:s,appendTo:P,collision:o,popupAlign:u,className:L,popupClass:R,style:z,offset:p,contentKey:A}};return v?"hidden"===q.current||"hiding"===q.current?{...e,current:"showing",previous:q.current}:"showing"===q.current?{...e,current:"shown",previous:q.current}:"shown"!==q.current||m(p,q.props.offset)&&m(s,q.props.anchorAlign)&&m(P,q.props.appendTo)&&m(o,q.props.collision)&&m(u,q.props.popupAlign)&&m(z,q.props.style)&&b===q.props.anchor&&R===q.props.popupClass&&L===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}}),[v,b,s,P,o,u,L,R,z,p,A,q]);l.useEffect((()=>{"hiding"===oe.current&&!te.current&&_.current?(te.current=!0,(e=>{if(!v){const n=M&&M.uPopup;e.classList.remove(...r.classNames(r.uPopup.animationContainerShown({c:n})).split(" ").filter((e=>e)))}J()})(_.current),V(_.current.firstChild,"exit",W)):(te.current=!1,"showing"===oe.current&&_.current?F(_.current):"hiding"===oe.current&&_.current?W():"reposition"===oe.current&&"shown"===oe.previous?setTimeout((()=>{U({...oe,current:"shown",previous:oe.current})}),0):"shown"===oe.current&&ne.current.contentKey!==A&&_.current&&H(_.current)),"reposition"===oe.current&&("shown"===oe.previous||"showing"===oe.previous)&&_.current&&H(_.current),ne.current={contentKey:A}}),[oe]),l.useEffect((()=>("showing"===oe.current&&_.current&&F(_.current),()=>{J()})),[]);const re=P||(r.canUseDOM?b&&b.ownerDocument?b.ownerDocument.body:document.body:void 0),ie=Object.assign({},{position:y,top:0,left:-1e4},z||{}),se="hiding"===oe.current;if((v||se)&&re){const e=X?X+1:100,n=l.createElement(r.ZIndexContext.Provider,{value:e},l.createElement("div",{onKeyDown:D,className:r.classNames(r.uPopup.animationContainer({c:I}),L),id:K,ref:_,style:{zIndex:e,...ie}},l.createElement("div",{className:r.classNames(r.uPopup.animationChild({c:I})),style:{transitionDelay:"0ms"}},l.createElement("div",{role:C,className:r.classNames(r.uPopup.popup({c:I}),R)},j))));return null!==P?c.createPortal(n,re):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.displayName="Popup",g.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=g,e.PopupPropsContext=f}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-popup",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1733146204,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-popup",
|
|
3
|
-
"version": "9.1.0-develop.
|
|
3
|
+
"version": "9.1.0-develop.8",
|
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
26
|
"@progress/kendo-popup-common": "^1.9.0",
|
|
27
|
-
"@progress/kendo-react-common": "9.1.0-develop.
|
|
27
|
+
"@progress/kendo-react-common": "9.1.0-develop.8",
|
|
28
28
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
29
29
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
30
30
|
},
|