@progress/kendo-react-popup 8.3.0-develop.3 → 8.3.0-develop.5
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 +12 -10
- package/PopupWithoutContext.js +1 -1
- package/PopupWithoutContext.mjs +116 -102
- package/animation.js +1 -1
- package/animation.mjs +17 -18
- package/dist/cdn/js/kendo-react-popup.js +1 -1
- package/index.d.mts +5 -0
- package/index.d.ts +5 -0
- 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
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=require("./PopupWithoutContext.js"),l=require("@progress/kendo-react-common");function i(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const r=i(s),c=r.createContext(e=>e),u=r.forwardRef((e,o)=>{const t=r.useContext(c),n=l.useUnstyled(),p=t.call(void 0,e);return r.createElement(a.PopupWithoutContext,{ref:o,unstyled:n,...p})});u.displayName="Popup";exports.Popup=u;exports.PopupPropsContext=c;
|
package/Popup.mjs
CHANGED
|
@@ -6,20 +6,22 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { PopupWithoutContext as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import { PopupWithoutContext as s } from "./PopupWithoutContext.mjs";
|
|
11
|
+
import { useUnstyled as c } from "@progress/kendo-react-common";
|
|
12
|
+
const u = t.createContext((o) => o), a = t.forwardRef((o, e) => {
|
|
13
|
+
const p = t.useContext(u), r = c(), n = p.call(void 0, o);
|
|
14
|
+
return /* @__PURE__ */ t.createElement(
|
|
15
|
+
s,
|
|
15
16
|
{
|
|
16
17
|
ref: e,
|
|
17
|
-
|
|
18
|
+
unstyled: r,
|
|
19
|
+
...n
|
|
18
20
|
}
|
|
19
21
|
);
|
|
20
22
|
});
|
|
21
|
-
|
|
23
|
+
a.displayName = "Popup";
|
|
22
24
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
a as Popup,
|
|
26
|
+
u as PopupPropsContext
|
|
25
27
|
};
|
package/PopupWithoutContext.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),T=require("react-dom"),e=require("prop-types"),D=require("./animation.js"),l=require("@progress/kendo-react-common"),n=require("@progress/kendo-popup-common"),O=require("./util.js"),E=require("./package-metadata.js");function A(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,o.get?o:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const w=A(_),N=A(T),x=100,R=1;function v(c,i){if(c===i)return!0;if(!!c!=!!i)return!1;const t=Object.getOwnPropertyNames(c),o=Object.getOwnPropertyNames(i);if(t.length!==o.length)return!1;for(let r=0;r<t.length;r++){let s=t[r];if(c[s]!==i[s])return!1}return!0}const S={left:-1e3,top:0},y=class y extends w.Component{constructor(i){super(i),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:o,popupAlign:r,collision:s,offset:d,anchor:a,margin:h,scale:u,positionMode:f}=this.props;const{width:g,height:m}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const P=n.alignElement({anchor:a,anchorAlign:o,element:t,elementAlign:r,offset:d,margin:h,positionMode:f,scale:u}),p=n.positionElement({anchor:a,anchorAlign:o,element:t,elementAlign:r,collisions:s,currentLocation:P,margin:this.props.margin});if(t.style.top=p.offset.top+"px",t.style.left=p.offset.left+"px",t.style.width=g,t.style.height=m,this._collisions={fit:p.fit,fitted:p.fitted,flip:p.flip,flipped:p.flipped},this.props.onPosition){const C={target:this,flipped:p.flipped,fitted:p.fitted};this.props.onPosition.call(void 0,C)}},this.onOpened=()=>{const t=this._popup;if(t){if(this.props.show){const{unstyled:o}=this.props,r=o&&o.uPopup;t.classList.add(...l.classNames(l.uPopup.animationContainerShown({c:r})).split(" ").filter(s=>s))}this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this})}},this.animate=(t,o,r)=>{if(!this.props.popupAlign)return;let s;const{horizontal:d,vertical:a}=this.props.popupAlign;d==="left"&&a==="center"?s="right":d==="right"&&a==="center"?s="left":a==="top"?s="down":s="up";const h={down:"up",up:"down",left:"right",right:"left"};this._collisions&&this._collisions.flipped&&(s=h[s]);const{unstyled:u}=this.props,f=u&&u.uPopup;D.slide(t,s,this.animationDuration[o],o,r,f)},this.onClosing=t=>{if(!this.props.show){const{unstyled:o}=this.props,r=o&&o.uPopup;t.classList.remove(...l.classNames(l.uPopup.animationContainerShown({c:r})).split(" ").filter(s=>s))}this.detachRepositionHandlers()},this.onClosed=()=>{this.state.current==="hiding"&&this.state.previous==="shown"&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+R:x,l.validatePackage(E.packageMetadata),this.reposition=O.throttle(this.reposition.bind(this),O.FRAME_DURATION)}get element(){return this._popup}static getDerivedStateFromProps(i,t){const{show:o,anchor:r,anchorAlign:s,appendTo:d,collision:a,popupAlign:h,className:u,popupClass:f,style:g,offset:m,contentKey:P}=i,p={...t,props:{show:o,anchor:r,anchorAlign:s,appendTo:d,collision:a,popupAlign:h,className:u,popupClass:f,style:g,offset:m,contentKey:P}};return i.show?t.current==="hidden"||t.current==="hiding"?{...p,current:"showing",previous:t.current}:t.current==="showing"?{...p,current:"shown",previous:t.current}:t.current==="shown"&&(!v(m,t.props.offset)||!v(s,t.props.anchorAlign)||!v(d,t.props.appendTo)||!v(a,t.props.collision)||!v(h,t.props.popupAlign)||!v(g,t.props.style)||r!==t.props.anchor||f!==t.props.popupClass||u!==t.props.className)?{...p,current:"reposition",previous:t.current}:p:t.current==="hiding"||t.current==="hidden"?{...p,current:"hidden",previous:t.current}:{...p,current:"hiding",previous:t.current}}componentDidUpdate(i){this.state.current==="showing"&&this._popup?this.show(this._popup):this.state.current==="hiding"&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):this.state.current==="reposition"&&this.state.previous==="shown"?setTimeout(()=>{this.setState({current:"shown",previous:this.state.current})},0):this.state.current==="shown"&&i.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){this.state.current==="showing"&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:i,className:t,popupClass:o,unstyled:r,show:s,id:d,positionMode:a}=this.props,h=r&&r.uPopup,u=this.props.appendTo?this.props.appendTo:l.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;this.state.current==="reposition"&&this.state.previous==="shown"&&this._popup&&this.setPosition(this._popup);const f=Object.assign({},{position:a,top:0,left:-1e4},this.props.style||{}),g=this.state.current==="hiding";if((s||g)&&u){const m=this.getCurrentZIndex(),P=w.createElement(l.ZIndexContext.Provider,{value:m},w.createElement("div",{onKeyDown:this.props.onKeyDown,className:l.classNames(l.uPopup.animationContainer({c:h}),t),id:d,ref:p=>this._popup=p,style:{zIndex:m,...f}},w.createElement("div",{className:l.classNames(l.uPopup.animationChild({c:h})),style:{transitionDelay:"0ms"}},w.createElement("div",{role:this.props.role,className:l.classNames(l.uPopup.popup({c:h}),o)},i))));return this.props.appendTo!==null?N.createPortal(P,u):P}return null}get animationDuration(){const i=this.props.animate;let t=0,o=0;return i&&(i===!0?t=o=300:(t=i.openDuration||0,o=i.closeDuration||0)),{enter:t,exit:o}}attachRepositionHandlers(i){this.detachRepositionHandlers(),this._scrollableParents=n.domUtils.scrollableParents(this.props.anchor||i),this._scrollableParents&&this._scrollableParents.map(t=>t.addEventListener("scroll",this.reposition)),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map(i=>i.removeEventListener("scroll",this.reposition)),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};y.propTypes={anchor:function(i){const t=i.anchor;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(i){const t=i.appendTo;return t&&typeof t.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popupClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),collision:e.shape({horizontal:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none]),vertical:e.oneOf([n.Collision.fit,n.Collision.flip,n.Collision.none])}),anchorAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),popupAlign:e.shape({horizontal:e.oneOf([n.AlignPoint.left,n.AlignPoint.center,n.AlignPoint.right]),vertical:e.oneOf([n.AlignPoint.top,n.AlignPoint.center,n.AlignPoint.bottom])}),offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),margin:e.shape({horizontal:e.number,vertical:e.number}),positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func,onKeyPress:e.func},y.defaultProps={collision:{horizontal:n.Collision.fit,vertical:n.Collision.flip},anchorAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.bottom},popupAlign:{horizontal:n.AlignPoint.left,vertical:n.AlignPoint.top},offset:S,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},y.contextType=l.ZIndexContext,y.displayName="PopupComponent";let b=y;exports.PopupWithoutContext=b;
|
package/PopupWithoutContext.mjs
CHANGED
|
@@ -6,26 +6,26 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
9
|
+
import * as y from "react";
|
|
10
|
+
import * as C from "react-dom";
|
|
11
11
|
import e from "prop-types";
|
|
12
12
|
import { slide as E } from "./animation.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import { alignElement as
|
|
15
|
-
import { throttle as
|
|
13
|
+
import { classNames as P, uPopup as b, validatePackage as A, ZIndexContext as _, canUseDOM as x } from "@progress/kendo-react-common";
|
|
14
|
+
import { alignElement as N, positionElement as z, Collision as f, AlignPoint as p, domUtils as R } from "@progress/kendo-popup-common";
|
|
15
|
+
import { throttle as I, FRAME_DURATION as S } from "./util.mjs";
|
|
16
16
|
import { packageMetadata as L } from "./package-metadata.mjs";
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
17
|
+
const M = 100, U = 1;
|
|
18
|
+
function v(O, i) {
|
|
19
|
+
if (O === i)
|
|
20
20
|
return !0;
|
|
21
|
-
if (!!
|
|
21
|
+
if (!!O != !!i)
|
|
22
22
|
return !1;
|
|
23
|
-
const t = Object.getOwnPropertyNames(
|
|
24
|
-
if (t.length !==
|
|
23
|
+
const t = Object.getOwnPropertyNames(O), o = Object.getOwnPropertyNames(i);
|
|
24
|
+
if (t.length !== o.length)
|
|
25
25
|
return !1;
|
|
26
|
-
for (let
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
26
|
+
for (let n = 0; n < t.length; n++) {
|
|
27
|
+
let s = t[n];
|
|
28
|
+
if (O[s] !== i[s])
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
31
|
return !0;
|
|
@@ -33,72 +33,85 @@ function g(y, i) {
|
|
|
33
33
|
const K = {
|
|
34
34
|
left: -1e3,
|
|
35
35
|
top: 0
|
|
36
|
-
},
|
|
36
|
+
}, w = class w extends y.Component {
|
|
37
37
|
constructor(i) {
|
|
38
38
|
super(i), this.context = 0, this.state = { current: "hidden", previous: "hidden", props: {} }, this._popup = null, this.show = (t) => {
|
|
39
39
|
this.setPosition(t), this.animate(t.firstChild, "enter", this.onOpened), this.setState({ current: "shown", previous: this.state.current });
|
|
40
40
|
}, this.setPosition = (t) => {
|
|
41
|
-
let { anchorAlign:
|
|
42
|
-
const { width:
|
|
41
|
+
let { anchorAlign: o, popupAlign: n, collision: s, offset: c, anchor: l, margin: a, scale: h, positionMode: u } = this.props;
|
|
42
|
+
const { width: m, height: d } = t.style;
|
|
43
43
|
t.style.width = t.offsetWidth + "px", t.style.height = t.offsetHeight + "px";
|
|
44
|
-
const
|
|
44
|
+
const g = N({
|
|
45
45
|
anchor: l,
|
|
46
|
-
anchorAlign:
|
|
46
|
+
anchorAlign: o,
|
|
47
47
|
element: t,
|
|
48
|
-
elementAlign:
|
|
49
|
-
offset:
|
|
50
|
-
margin:
|
|
48
|
+
elementAlign: n,
|
|
49
|
+
offset: c,
|
|
50
|
+
margin: a,
|
|
51
51
|
positionMode: u,
|
|
52
|
-
scale:
|
|
53
|
-
}), r =
|
|
52
|
+
scale: h
|
|
53
|
+
}), r = z({
|
|
54
54
|
anchor: l,
|
|
55
|
-
anchorAlign:
|
|
55
|
+
anchorAlign: o,
|
|
56
56
|
element: t,
|
|
57
|
-
elementAlign:
|
|
58
|
-
collisions:
|
|
59
|
-
currentLocation:
|
|
57
|
+
elementAlign: n,
|
|
58
|
+
collisions: s,
|
|
59
|
+
currentLocation: g,
|
|
60
60
|
margin: this.props.margin
|
|
61
61
|
});
|
|
62
|
-
if (t.style.top = r.offset.top + "px", t.style.left = r.offset.left + "px", t.style.width =
|
|
62
|
+
if (t.style.top = r.offset.top + "px", t.style.left = r.offset.left + "px", t.style.width = m, t.style.height = d, this._collisions = {
|
|
63
63
|
fit: r.fit,
|
|
64
64
|
fitted: r.fitted,
|
|
65
65
|
flip: r.flip,
|
|
66
66
|
flipped: r.flipped
|
|
67
67
|
}, this.props.onPosition) {
|
|
68
|
-
const
|
|
68
|
+
const D = {
|
|
69
69
|
target: this,
|
|
70
70
|
flipped: r.flipped,
|
|
71
71
|
fitted: r.fitted
|
|
72
72
|
};
|
|
73
|
-
this.props.onPosition.call(void 0,
|
|
73
|
+
this.props.onPosition.call(void 0, D);
|
|
74
74
|
}
|
|
75
75
|
}, this.onOpened = () => {
|
|
76
76
|
const t = this._popup;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (t) {
|
|
78
|
+
if (this.props.show) {
|
|
79
|
+
const { unstyled: o } = this.props, n = o && o.uPopup;
|
|
80
|
+
t.classList.add(...P(b.animationContainerShown({ c: n })).split(" ").filter((s) => s));
|
|
81
|
+
}
|
|
82
|
+
this.attachRepositionHandlers(t), this.props.onOpen && this.props.onOpen.call(void 0, { target: this });
|
|
83
|
+
}
|
|
84
|
+
}, this.animate = (t, o, n) => {
|
|
79
85
|
if (!this.props.popupAlign)
|
|
80
86
|
return;
|
|
81
|
-
let
|
|
82
|
-
const { horizontal:
|
|
83
|
-
|
|
84
|
-
const
|
|
87
|
+
let s;
|
|
88
|
+
const { horizontal: c, vertical: l } = this.props.popupAlign;
|
|
89
|
+
c === "left" && l === "center" ? s = "right" : c === "right" && l === "center" ? s = "left" : l === "top" ? s = "down" : s = "up";
|
|
90
|
+
const a = {
|
|
85
91
|
down: "up",
|
|
86
92
|
up: "down",
|
|
87
93
|
left: "right",
|
|
88
94
|
right: "left"
|
|
89
95
|
};
|
|
90
|
-
this._collisions && this._collisions.flipped && (
|
|
96
|
+
this._collisions && this._collisions.flipped && (s = a[s]);
|
|
97
|
+
const { unstyled: h } = this.props, u = h && h.uPopup;
|
|
98
|
+
E(
|
|
91
99
|
t,
|
|
92
|
-
o,
|
|
93
|
-
this.animationDuration[s],
|
|
94
100
|
s,
|
|
95
|
-
|
|
101
|
+
this.animationDuration[o],
|
|
102
|
+
o,
|
|
103
|
+
n,
|
|
104
|
+
u
|
|
96
105
|
);
|
|
97
106
|
}, this.onClosing = (t) => {
|
|
98
|
-
this.props.show
|
|
107
|
+
if (!this.props.show) {
|
|
108
|
+
const { unstyled: o } = this.props, n = o && o.uPopup;
|
|
109
|
+
t.classList.remove(...P(b.animationContainerShown({ c: n })).split(" ").filter((s) => s));
|
|
110
|
+
}
|
|
111
|
+
this.detachRepositionHandlers();
|
|
99
112
|
}, this.onClosed = () => {
|
|
100
113
|
this.state.current === "hiding" && this.state.previous === "shown" && this.setState({ current: "hidden", previous: this.state.current }), this.props.onClose && this.props.onClose.call(void 0, { target: this });
|
|
101
|
-
}, this.getCurrentZIndex = () => this.context ? this.context +
|
|
114
|
+
}, this.getCurrentZIndex = () => this.context ? this.context + U : M, A(L), this.reposition = I(this.reposition.bind(this), S);
|
|
102
115
|
}
|
|
103
116
|
/**
|
|
104
117
|
* Represents the Popup DOM element.
|
|
@@ -110,23 +123,23 @@ const K = {
|
|
|
110
123
|
* @hidden
|
|
111
124
|
*/
|
|
112
125
|
static getDerivedStateFromProps(i, t) {
|
|
113
|
-
const { show:
|
|
126
|
+
const { show: o, anchor: n, anchorAlign: s, appendTo: c, collision: l, popupAlign: a, className: h, popupClass: u, style: m, offset: d, contentKey: g } = i, r = {
|
|
114
127
|
...t,
|
|
115
128
|
props: {
|
|
116
|
-
show:
|
|
117
|
-
anchor:
|
|
118
|
-
anchorAlign:
|
|
119
|
-
appendTo:
|
|
129
|
+
show: o,
|
|
130
|
+
anchor: n,
|
|
131
|
+
anchorAlign: s,
|
|
132
|
+
appendTo: c,
|
|
120
133
|
collision: l,
|
|
121
|
-
popupAlign:
|
|
122
|
-
className:
|
|
134
|
+
popupAlign: a,
|
|
135
|
+
className: h,
|
|
123
136
|
popupClass: u,
|
|
124
|
-
style:
|
|
125
|
-
offset:
|
|
126
|
-
contentKey:
|
|
137
|
+
style: m,
|
|
138
|
+
offset: d,
|
|
139
|
+
contentKey: g
|
|
127
140
|
}
|
|
128
141
|
};
|
|
129
|
-
return i.show ? t.current === "hidden" || t.current === "hiding" ? { ...r, current: "showing", previous: t.current } : t.current === "showing" ? { ...r, current: "shown", previous: t.current } : t.current === "shown" && (!
|
|
142
|
+
return i.show ? t.current === "hidden" || t.current === "hiding" ? { ...r, current: "showing", previous: t.current } : t.current === "showing" ? { ...r, current: "shown", previous: t.current } : t.current === "shown" && (!v(d, t.props.offset) || !v(s, t.props.anchorAlign) || !v(c, t.props.appendTo) || !v(l, t.props.collision) || !v(a, t.props.popupAlign) || !v(m, t.props.style) || n !== t.props.anchor || u !== t.props.popupClass || h !== t.props.className) ? { ...r, current: "reposition", previous: t.current } : r : t.current === "hiding" || t.current === "hidden" ? { ...r, current: "hidden", previous: t.current } : { ...r, current: "hiding", previous: t.current };
|
|
130
143
|
}
|
|
131
144
|
/**
|
|
132
145
|
*
|
|
@@ -156,47 +169,48 @@ const K = {
|
|
|
156
169
|
const {
|
|
157
170
|
children: i,
|
|
158
171
|
className: t,
|
|
159
|
-
popupClass:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
popupClass: o,
|
|
173
|
+
unstyled: n,
|
|
174
|
+
show: s,
|
|
175
|
+
id: c,
|
|
176
|
+
positionMode: l
|
|
177
|
+
} = this.props, a = n && n.uPopup, h = this.props.appendTo ? this.props.appendTo : x ? this.props.anchor && this.props.anchor.ownerDocument ? this.props.anchor.ownerDocument.body : document.body : void 0;
|
|
164
178
|
this.state.current === "reposition" && this.state.previous === "shown" && this._popup && this.setPosition(this._popup);
|
|
165
|
-
const
|
|
179
|
+
const u = Object.assign(
|
|
166
180
|
{},
|
|
167
|
-
{ position:
|
|
181
|
+
{ position: l, top: 0, left: -1e4 },
|
|
168
182
|
this.props.style || {}
|
|
169
|
-
),
|
|
170
|
-
if ((
|
|
171
|
-
const
|
|
183
|
+
), m = this.state.current === "hiding";
|
|
184
|
+
if ((s || m) && h) {
|
|
185
|
+
const d = this.getCurrentZIndex(), g = /* @__PURE__ */ y.createElement(_.Provider, { value: d }, /* @__PURE__ */ y.createElement(
|
|
172
186
|
"div",
|
|
173
187
|
{
|
|
174
188
|
onKeyDown: this.props.onKeyDown,
|
|
175
|
-
className: P(
|
|
176
|
-
id:
|
|
177
|
-
ref: (
|
|
189
|
+
className: P(b.animationContainer({ c: a }), t),
|
|
190
|
+
id: c,
|
|
191
|
+
ref: (r) => this._popup = r,
|
|
178
192
|
style: {
|
|
179
|
-
zIndex:
|
|
180
|
-
...
|
|
193
|
+
zIndex: d,
|
|
194
|
+
...u
|
|
181
195
|
}
|
|
182
196
|
},
|
|
183
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ y.createElement("div", { className: P(b.animationChild({ c: a })), style: { transitionDelay: "0ms" } }, /* @__PURE__ */ y.createElement(
|
|
184
198
|
"div",
|
|
185
199
|
{
|
|
186
200
|
role: this.props.role,
|
|
187
|
-
className: P(
|
|
201
|
+
className: P(b.popup({ c: a }), o)
|
|
188
202
|
},
|
|
189
203
|
i
|
|
190
204
|
))
|
|
191
205
|
));
|
|
192
|
-
return this.props.appendTo !== null ?
|
|
206
|
+
return this.props.appendTo !== null ? C.createPortal(g, h) : g;
|
|
193
207
|
}
|
|
194
208
|
return null;
|
|
195
209
|
}
|
|
196
210
|
get animationDuration() {
|
|
197
211
|
const i = this.props.animate;
|
|
198
|
-
let t = 0,
|
|
199
|
-
return i && (i === !0 ? t =
|
|
212
|
+
let t = 0, o = 0;
|
|
213
|
+
return i && (i === !0 ? t = o = 300 : (t = i.openDuration || 0, o = i.closeDuration || 0)), { enter: t, exit: o };
|
|
200
214
|
}
|
|
201
215
|
attachRepositionHandlers(i) {
|
|
202
216
|
this.detachRepositionHandlers(), this._scrollableParents = R.scrollableParents(this.props.anchor || i), this._scrollableParents && this._scrollableParents.map((t) => t.addEventListener("scroll", this.reposition)), window.addEventListener("resize", this.reposition);
|
|
@@ -208,7 +222,7 @@ const K = {
|
|
|
208
222
|
this.setState({ current: "reposition", previous: this.state.current });
|
|
209
223
|
}
|
|
210
224
|
};
|
|
211
|
-
|
|
225
|
+
w.propTypes = {
|
|
212
226
|
anchor: function(i) {
|
|
213
227
|
const t = i.anchor;
|
|
214
228
|
return t && typeof t.nodeType != "number" ? new Error(
|
|
@@ -234,38 +248,38 @@ v.propTypes = {
|
|
|
234
248
|
]),
|
|
235
249
|
collision: e.shape({
|
|
236
250
|
horizontal: e.oneOf([
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
251
|
+
f.fit,
|
|
252
|
+
f.flip,
|
|
253
|
+
f.none
|
|
240
254
|
]),
|
|
241
255
|
vertical: e.oneOf([
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
f.fit,
|
|
257
|
+
f.flip,
|
|
258
|
+
f.none
|
|
245
259
|
])
|
|
246
260
|
}),
|
|
247
261
|
anchorAlign: e.shape({
|
|
248
262
|
horizontal: e.oneOf([
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
263
|
+
p.left,
|
|
264
|
+
p.center,
|
|
265
|
+
p.right
|
|
252
266
|
]),
|
|
253
267
|
vertical: e.oneOf([
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
268
|
+
p.top,
|
|
269
|
+
p.center,
|
|
270
|
+
p.bottom
|
|
257
271
|
])
|
|
258
272
|
}),
|
|
259
273
|
popupAlign: e.shape({
|
|
260
274
|
horizontal: e.oneOf([
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
275
|
+
p.left,
|
|
276
|
+
p.center,
|
|
277
|
+
p.right
|
|
264
278
|
]),
|
|
265
279
|
vertical: e.oneOf([
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
280
|
+
p.top,
|
|
281
|
+
p.center,
|
|
282
|
+
p.bottom
|
|
269
283
|
])
|
|
270
284
|
}),
|
|
271
285
|
offset: e.shape({
|
|
@@ -298,18 +312,18 @@ v.propTypes = {
|
|
|
298
312
|
onPosition: e.func,
|
|
299
313
|
onOpen: e.func,
|
|
300
314
|
onKeyPress: e.func
|
|
301
|
-
},
|
|
315
|
+
}, w.defaultProps = {
|
|
302
316
|
collision: {
|
|
303
|
-
horizontal:
|
|
304
|
-
vertical:
|
|
317
|
+
horizontal: f.fit,
|
|
318
|
+
vertical: f.flip
|
|
305
319
|
},
|
|
306
320
|
anchorAlign: {
|
|
307
|
-
horizontal:
|
|
308
|
-
vertical:
|
|
321
|
+
horizontal: p.left,
|
|
322
|
+
vertical: p.bottom
|
|
309
323
|
},
|
|
310
324
|
popupAlign: {
|
|
311
|
-
horizontal:
|
|
312
|
-
vertical:
|
|
325
|
+
horizontal: p.left,
|
|
326
|
+
vertical: p.top
|
|
313
327
|
},
|
|
314
328
|
offset: K,
|
|
315
329
|
animate: !0,
|
|
@@ -319,8 +333,8 @@ v.propTypes = {
|
|
|
319
333
|
vertical: 0
|
|
320
334
|
},
|
|
321
335
|
positionMode: "absolute"
|
|
322
|
-
},
|
|
323
|
-
let T =
|
|
336
|
+
}, w.contextType = _, w.displayName = "PopupComponent";
|
|
337
|
+
let T = w;
|
|
324
338
|
export {
|
|
325
339
|
T as PopupWithoutContext
|
|
326
340
|
};
|
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@progress/kendo-react-common"),w=(i,s,n)=>{i.style.transitionDuration="",s&&i.classList.remove(...s.split(" ")),s&&i.classList.remove(...n.split(" "))},p=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),y=(i,s,n,r,d,u)=>{if(n===0)return d();const o=e.classNames(e.uPopup.slide({direction:s,type:r,c:u})),a=e.classNames(e.uPopup.slideActive({direction:s,type:r,c:u})),f=t=>{t.target===i&&(i.removeEventListener("transitionend",f),w(i,o,a),r==="exit"?i.style.display="none":i.style.display="",d())};i.addEventListener("transitionend",f);const l=i.ownerDocument;if(!l)return;const c=l.defaultView;if(!c)return;const v=()=>{w(i,o,a),o&&i.classList.add(...o.split(" ").filter(t=>t)),c.requestAnimationFrame(()=>{i.style.transitionDuration=n+"ms",i.classList.add(...a.split(" ").filter(t=>t))})};p?c.requestAnimationFrame(v):v()};exports.slide=y;
|
package/animation.mjs
CHANGED
|
@@ -6,30 +6,29 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, w = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), v = (s, i, n, r, o) => {
|
|
9
|
+
import { classNames as v, uPopup as w } from "@progress/kendo-react-common";
|
|
10
|
+
const p = (i, s, n) => {
|
|
11
|
+
i.style.transitionDuration = "", s && i.classList.remove(...s.split(" ")), s && i.classList.remove(...n.split(" "));
|
|
12
|
+
}, L = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), A = (i, s, n, r, c, d) => {
|
|
14
13
|
if (n === 0)
|
|
15
|
-
return
|
|
16
|
-
const
|
|
17
|
-
|
|
14
|
+
return c();
|
|
15
|
+
const o = v(w.slide({ direction: s, type: r, c: d })), a = v(w.slideActive({ direction: s, type: r, c: d })), f = (t) => {
|
|
16
|
+
t.target === i && (i.removeEventListener("transitionend", f), p(i, o, a), r === "exit" ? i.style.display = "none" : i.style.display = "", c());
|
|
18
17
|
};
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
18
|
+
i.addEventListener("transitionend", f);
|
|
19
|
+
const u = i.ownerDocument;
|
|
20
|
+
if (!u)
|
|
22
21
|
return;
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
22
|
+
const e = u.defaultView;
|
|
23
|
+
if (!e)
|
|
25
24
|
return;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const l = () => {
|
|
26
|
+
p(i, o, a), o && i.classList.add(...o.split(" ").filter((t) => t)), e.requestAnimationFrame(() => {
|
|
27
|
+
i.style.transitionDuration = n + "ms", i.classList.add(...a.split(" ").filter((t) => t));
|
|
29
28
|
});
|
|
30
29
|
};
|
|
31
|
-
|
|
30
|
+
L ? e.requestAnimationFrame(l) : l();
|
|
32
31
|
};
|
|
33
32
|
export {
|
|
34
|
-
|
|
33
|
+
A as slide
|
|
35
34
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-popup-common")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-popup-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactPopup={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoPopupCommon)}(this,(function(t,e,o,n,i,s){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var p=r(e),l=r(o);const a=t=>{t.style.transitionDuration="",Array.from(t.classList).forEach((e=>{e.startsWith("k-slide-")&&t.classList.remove(e)}))},c="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),h={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};function u(t,e){if(t===e)return!0;if(!!t!=!!e)return!1;const o=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(e);if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){let i=o[n];if(t[i]!==e[i])return!1}return!0}const d="k-animation-container-shown",f=class extends p.Component{constructor(t){super(t),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:e,popupAlign:o,collision:n,offset:i,anchor:r,margin:p,scale:l,positionMode:a}=this.props;const{width:c,height:h}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const u=s.alignElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,offset:i,margin:p,positionMode:a,scale:l}),d=s.positionElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,collisions:n,currentLocation:u,margin:this.props.margin});if(t.style.top=d.offset.top+"px",t.style.left=d.offset.left+"px",t.style.width=c,t.style.height=h,this._collisions={fit:d.fit,fitted:d.fitted,flip:d.flip,flipped:d.flipped},this.props.onPosition){const t={target:this,flipped:d.flipped,fitted:d.fitted};this.props.onPosition.call(void 0,t)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(d),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,e,o)=>{if(!this.props.popupAlign)return;let n;const{horizontal:i,vertical:s}=this.props.popupAlign;n="left"===i&&"center"===s?"right":"right"===i&&"center"===s?"left":"top"===s?"down":"up";this._collisions&&this._collisions.flipped&&(n={down:"up",up:"down",left:"right",right:"left"}[n]),((t,e,o,n,i)=>{if(0===o)return i();const s="k-slide-"+e+"-"+n,r=s+"-active",p=e=>{e.target===t&&(t.removeEventListener("transitionend",p),a(t),t.style.display="exit"===n?"none":"",i())};t.addEventListener("transitionend",p);const l=t.ownerDocument;if(!l)return;const h=l.defaultView;if(!h)return;const u=()=>{a(t),t.classList.add(s),h.requestAnimationFrame((()=>{t.style.transitionDuration=o+"ms",t.classList.add(r)}))};c?h.requestAnimationFrame(u):u()})(t,n,this.animationDuration[e],e,o)},this.onClosing=t=>{this.props.show||t.classList.remove(d),this.detachRepositionHandlers()},this.onClosed=()=>{"hiding"===this.state.current&&"shown"===this.state.previous&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+1:100,i.validatePackage(h),this.reposition=function(t,e,o={}){let n,i,s,r,p=0;o=o||{};const l=function(){p=!1===o.leading?0:(new Date).getTime(),n=void 0,r=t.apply(i,s),n||(i=s=null)};return function(){const a=(new Date).getTime();!p&&!1===o.leading&&(p=a);const c=e-(a-p);return i=void 0,s=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=void 0),p=a,r=t.apply(i,s),n||(i=s=null)):!n&&!1!==o.trailing&&(n=window.setTimeout(l,c)),r}}(this.reposition.bind(this),16.666666666666668)}get element(){return this._popup}static getDerivedStateFromProps(t,e){const{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}=t,f={...e,props:{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:h,contentKey:d}};return t.show?"hidden"===e.current||"hiding"===e.current?{...f,current:"showing",previous:e.current}:"showing"===e.current?{...f,current:"shown",previous:e.current}:"shown"!==e.current||u(h,e.props.offset)&&u(i,e.props.anchorAlign)&&u(s,e.props.appendTo)&&u(r,e.props.collision)&&u(p,e.props.popupAlign)&&u(c,e.props.style)&&n===e.props.anchor&&a===e.props.popupClass&&l===e.props.className?f:{...f,current:"reposition",previous:e.current}:"hiding"===e.current||"hidden"===e.current?{...f,current:"hidden",previous:e.current}:{...f,current:"hiding",previous:e.current}}componentDidUpdate(t){"showing"===this.state.current&&this._popup?this.show(this._popup):"hiding"===this.state.current&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):"reposition"===this.state.current&&"shown"===this.state.previous?setTimeout((()=>{this.setState({current:"shown",previous:this.state.current})}),0):"shown"===this.state.current&&t.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){"showing"===this.state.current&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:t,className:e,popupClass:o,show:n,id:s,positionMode:r}=this.props,a=this.props.appendTo?this.props.appendTo:i.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;"reposition"===this.state.current&&"shown"===this.state.previous&&this._popup&&this.setPosition(this._popup);const c=Object.assign({},{position:r,top:0,left:-1e4},this.props.style||{}),h="hiding"===this.state.current;if((n||h)&&a){const n=this.getCurrentZIndex(),r=p.createElement(i.ZIndexContext.Provider,{value:n},p.createElement("div",{onKeyDown:this.props.onKeyDown,className:i.classNames("k-animation-container",e),id:s,ref:t=>this._popup=t,style:{zIndex:n,...c}},p.createElement("div",{className:i.classNames("k-child-animation-container"),style:{transitionDelay:"0ms"}},p.createElement("div",{role:this.props.role,className:i.classNames("k-popup",o)},t))));return null!==this.props.appendTo?l.createPortal(r,a):r}return null}get animationDuration(){const t=this.props.animate;let e=0,o=0;return t&&(!0===t?e=o=300:(e=t.openDuration||0,o=t.closeDuration||0)),{enter:e,exit:o}}attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=s.domUtils.scrollableParents(this.props.anchor||t),this._scrollableParents&&this._scrollableParents.map((t=>t.addEventListener("scroll",this.reposition))),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map((t=>t.removeEventListener("scroll",this.reposition))),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};f.propTypes={anchor:function(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(t){const e=t.appendTo;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none]),vertical:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),margin:n.shape({horizontal:n.number,vertical:n.number}),positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func,onKeyPress:n.func},f.defaultProps={collision:{horizontal:s.Collision.fit,vertical:s.Collision.flip},anchorAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.bottom},popupAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},f.contextType=i.ZIndexContext,f.displayName="PopupComponent";let m=f;const g=p.createContext((t=>t)),y=p.forwardRef(((t,e)=>{const o=p.useContext(g).call(void 0,t);return p.createElement(m,{ref:e,...o})}));y.displayName="Popup",t.Popup=y,t.PopupPropsContext=g,t.PopupWithoutContext=m}));
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-popup-common")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-common","@progress/kendo-popup-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactPopup={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactCommon,t.KendoPopupCommon)}(this,(function(t,e,o,n,i,s){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var p=r(e),l=r(o);const a=(t,e,o)=>{t.style.transitionDuration="",e&&t.classList.remove(...e.split(" ")),e&&t.classList.remove(...o.split(" "))},c="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent),u={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};function h(t,e){if(t===e)return!0;if(!!t!=!!e)return!1;const o=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(e);if(o.length!==n.length)return!1;for(let n=0;n<o.length;n++){let i=o[n];if(t[i]!==e[i])return!1}return!0}const d=class extends p.Component{constructor(t){super(t),this.context=0,this.state={current:"hidden",previous:"hidden",props:{}},this._popup=null,this.show=t=>{this.setPosition(t),this.animate(t.firstChild,"enter",this.onOpened),this.setState({current:"shown",previous:this.state.current})},this.setPosition=t=>{let{anchorAlign:e,popupAlign:o,collision:n,offset:i,anchor:r,margin:p,scale:l,positionMode:a}=this.props;const{width:c,height:u}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const h=s.alignElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,offset:i,margin:p,positionMode:a,scale:l}),d=s.positionElement({anchor:r,anchorAlign:e,element:t,elementAlign:o,collisions:n,currentLocation:h,margin:this.props.margin});if(t.style.top=d.offset.top+"px",t.style.left=d.offset.left+"px",t.style.width=c,t.style.height=u,this._collisions={fit:d.fit,fitted:d.fitted,flip:d.flip,flipped:d.flipped},this.props.onPosition){const t={target:this,flipped:d.flipped,fitted:d.fitted};this.props.onPosition.call(void 0,t)}},this.onOpened=()=>{const t=this._popup;if(t){if(this.props.show){const{unstyled:e}=this.props,o=e&&e.uPopup;t.classList.add(...i.classNames(i.uPopup.animationContainerShown({c:o})).split(" ").filter((t=>t)))}this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this})}},this.animate=(t,e,o)=>{if(!this.props.popupAlign)return;let n;const{horizontal:s,vertical:r}=this.props.popupAlign;n="left"===s&&"center"===r?"right":"right"===s&&"center"===r?"left":"top"===r?"down":"up";this._collisions&&this._collisions.flipped&&(n={down:"up",up:"down",left:"right",right:"left"}[n]);const{unstyled:p}=this.props,l=p&&p.uPopup;((t,e,o,n,s,r)=>{if(0===o)return s();const p=i.classNames(i.uPopup.slide({direction:e,type:n,c:r})),l=i.classNames(i.uPopup.slideActive({direction:e,type:n,c:r})),u=e=>{e.target===t&&(t.removeEventListener("transitionend",u),a(t,p,l),t.style.display="exit"===n?"none":"",s())};t.addEventListener("transitionend",u);const h=t.ownerDocument;if(!h)return;const d=h.defaultView;if(!d)return;const f=()=>{a(t,p,l),p&&t.classList.add(...p.split(" ").filter((t=>t))),d.requestAnimationFrame((()=>{t.style.transitionDuration=o+"ms",t.classList.add(...l.split(" ").filter((t=>t)))}))};c?d.requestAnimationFrame(f):f()})(t,n,this.animationDuration[e],e,o,l)},this.onClosing=t=>{if(!this.props.show){const{unstyled:e}=this.props,o=e&&e.uPopup;t.classList.remove(...i.classNames(i.uPopup.animationContainerShown({c:o})).split(" ").filter((t=>t)))}this.detachRepositionHandlers()},this.onClosed=()=>{"hiding"===this.state.current&&"shown"===this.state.previous&&this.setState({current:"hidden",previous:this.state.current}),this.props.onClose&&this.props.onClose.call(void 0,{target:this})},this.getCurrentZIndex=()=>this.context?this.context+1:100,i.validatePackage(u),this.reposition=function(t,e,o={}){let n,i,s,r,p=0;o=o||{};const l=function(){p=!1===o.leading?0:(new Date).getTime(),n=void 0,r=t.apply(i,s),n||(i=s=null)};return function(){const a=(new Date).getTime();!p&&!1===o.leading&&(p=a);const c=e-(a-p);return i=void 0,s=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=void 0),p=a,r=t.apply(i,s),n||(i=s=null)):!n&&!1!==o.trailing&&(n=window.setTimeout(l,c)),r}}(this.reposition.bind(this),16.666666666666668)}get element(){return this._popup}static getDerivedStateFromProps(t,e){const{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:u,contentKey:d}=t,f={...e,props:{show:o,anchor:n,anchorAlign:i,appendTo:s,collision:r,popupAlign:p,className:l,popupClass:a,style:c,offset:u,contentKey:d}};return t.show?"hidden"===e.current||"hiding"===e.current?{...f,current:"showing",previous:e.current}:"showing"===e.current?{...f,current:"shown",previous:e.current}:"shown"!==e.current||h(u,e.props.offset)&&h(i,e.props.anchorAlign)&&h(s,e.props.appendTo)&&h(r,e.props.collision)&&h(p,e.props.popupAlign)&&h(c,e.props.style)&&n===e.props.anchor&&a===e.props.popupClass&&l===e.props.className?f:{...f,current:"reposition",previous:e.current}:"hiding"===e.current||"hidden"===e.current?{...f,current:"hidden",previous:e.current}:{...f,current:"hiding",previous:e.current}}componentDidUpdate(t){"showing"===this.state.current&&this._popup?this.show(this._popup):"hiding"===this.state.current&&this._popup?(this.onClosing(this._popup),this.animate(this._popup.firstChild,"exit",this.onClosed)):"reposition"===this.state.current&&"shown"===this.state.previous?setTimeout((()=>{this.setState({current:"shown",previous:this.state.current})}),0):"shown"===this.state.current&&t.contentKey!==this.props.contentKey&&this._popup&&this.setPosition(this._popup)}componentDidMount(){"showing"===this.state.current&&this._popup&&this.show(this._popup)}componentWillUnmount(){this.detachRepositionHandlers()}render(){const{children:t,className:e,popupClass:o,unstyled:n,show:s,id:r,positionMode:a}=this.props,c=n&&n.uPopup,u=this.props.appendTo?this.props.appendTo:i.canUseDOM?this.props.anchor&&this.props.anchor.ownerDocument?this.props.anchor.ownerDocument.body:document.body:void 0;"reposition"===this.state.current&&"shown"===this.state.previous&&this._popup&&this.setPosition(this._popup);const h=Object.assign({},{position:a,top:0,left:-1e4},this.props.style||{}),d="hiding"===this.state.current;if((s||d)&&u){const n=this.getCurrentZIndex(),s=p.createElement(i.ZIndexContext.Provider,{value:n},p.createElement("div",{onKeyDown:this.props.onKeyDown,className:i.classNames(i.uPopup.animationContainer({c:c}),e),id:r,ref:t=>this._popup=t,style:{zIndex:n,...h}},p.createElement("div",{className:i.classNames(i.uPopup.animationChild({c:c})),style:{transitionDelay:"0ms"}},p.createElement("div",{role:this.props.role,className:i.classNames(i.uPopup.popup({c:c}),o)},t))));return null!==this.props.appendTo?l.createPortal(s,u):s}return null}get animationDuration(){const t=this.props.animate;let e=0,o=0;return t&&(!0===t?e=o=300:(e=t.openDuration||0,o=t.closeDuration||0)),{enter:e,exit:o}}attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=s.domUtils.scrollableParents(this.props.anchor||t),this._scrollableParents&&this._scrollableParents.map((t=>t.addEventListener("scroll",this.reposition))),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map((t=>t.removeEventListener("scroll",this.reposition))),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}};d.propTypes={anchor:function(t){const e=t.anchor;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(t){const e=t.appendTo;return e&&"number"!=typeof e.nodeType?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),id:n.string,popupClass:n.oneOfType([n.string,n.arrayOf(n.string),n.object]),collision:n.shape({horizontal:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none]),vertical:n.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none])}),anchorAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),popupAlign:n.shape({horizontal:n.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:n.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),offset:n.shape({left:n.number,top:n.number}),children:n.oneOfType([n.element,n.node]),show:n.bool,animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),margin:n.shape({horizontal:n.number,vertical:n.number}),positionMode:n.oneOf(["fixed","absolute"]),scale:n.number,style:n.object,onClose:n.func,onPosition:n.func,onOpen:n.func,onKeyPress:n.func},d.defaultProps={collision:{horizontal:s.Collision.fit,vertical:s.Collision.flip},anchorAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.bottom},popupAlign:{horizontal:s.AlignPoint.left,vertical:s.AlignPoint.top},offset:{left:-1e3,top:0},animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"},d.contextType=i.ZIndexContext,d.displayName="PopupComponent";let f=d;const m=p.createContext((t=>t)),g=p.forwardRef(((t,e)=>{const o=p.useContext(m),n=i.useUnstyled(),s=o.call(void 0,t);return p.createElement(f,{ref:e,unstyled:n,...s})}));g.displayName="Popup",t.Popup=g,t.PopupPropsContext=m,t.PopupWithoutContext=f}));
|
package/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ import { CollisionType as CollisionType_2 } from '@progress/kendo-popup-common';
|
|
|
10
10
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
11
11
|
import { MarginSettings } from '@progress/kendo-popup-common';
|
|
12
12
|
import { OffsetPosition } from '@progress/kendo-popup-common';
|
|
13
|
+
import { PopupClassStructure } from '@progress/kendo-react-common';
|
|
13
14
|
import { PopupSettings } from '@progress/kendo-popup-common';
|
|
14
15
|
import { PositionMode as PositionMode_2 } from '@progress/kendo-popup-common';
|
|
15
16
|
import PropTypes from 'prop-types';
|
|
@@ -252,6 +253,10 @@ export declare interface PopupProps extends PopupSettings {
|
|
|
252
253
|
* @hidden
|
|
253
254
|
*/
|
|
254
255
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
256
|
+
/**
|
|
257
|
+
* @hidden
|
|
258
|
+
*/
|
|
259
|
+
unstyled?: PopupClassStructure;
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
/**
|
package/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { CollisionType as CollisionType_2 } from '@progress/kendo-popup-common';
|
|
|
10
10
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
11
11
|
import { MarginSettings } from '@progress/kendo-popup-common';
|
|
12
12
|
import { OffsetPosition } from '@progress/kendo-popup-common';
|
|
13
|
+
import { PopupClassStructure } from '@progress/kendo-react-common';
|
|
13
14
|
import { PopupSettings } from '@progress/kendo-popup-common';
|
|
14
15
|
import { PositionMode as PositionMode_2 } from '@progress/kendo-popup-common';
|
|
15
16
|
import PropTypes from 'prop-types';
|
|
@@ -252,6 +253,10 @@ export declare interface PopupProps extends PopupSettings {
|
|
|
252
253
|
* @hidden
|
|
253
254
|
*/
|
|
254
255
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
256
|
+
/**
|
|
257
|
+
* @hidden
|
|
258
|
+
*/
|
|
259
|
+
unstyled?: PopupClassStructure;
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
/**
|
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: 1723701870,
|
|
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": "8.3.0-develop.
|
|
3
|
+
"version": "8.3.0-develop.5",
|
|
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": "8.3.0-develop.
|
|
27
|
+
"@progress/kendo-react-common": "8.3.0-develop.5",
|
|
28
28
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
29
29
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
30
30
|
},
|