@progress/kendo-react-popup 7.2.4-develop.3 → 7.3.0-develop.1

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/index.d.ts CHANGED
@@ -1,16 +1,468 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Popup, PopupPropsContext } from './Popup';
6
- import { PopupWithoutContext } from './PopupWithoutContext';
7
- import type { PopupProps } from './models/PopupProps';
8
- import type { Align } from './models/Align';
9
- import type { Collision } from './models/Collision';
10
- import type { Offset } from './models/Offset';
11
- import type { PopupAnimation } from './models/PopupAnimation';
12
- import type { OpenEvent as PopupOpenEvent, CloseEvent as PopupCloseEvent } from './models/Events';
13
- import type { Margin } from './models/Margin';
14
- import type { CollisionType } from './models/CollisionType';
15
- import type { PositionMode } from './models/PositionMode';
16
- export { Popup, PopupWithoutContext, PopupPropsContext, PopupProps, Align, Collision, Offset, PopupAnimation, Margin, PositionMode, CollisionType, PopupOpenEvent, PopupCloseEvent };
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { AlignStrategy } from '@progress/kendo-popup-common';
9
+ import { CollisionType as CollisionType_2 } from '@progress/kendo-popup-common';
10
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
11
+ import { MarginSettings } from '@progress/kendo-popup-common';
12
+ import { OffsetPosition } from '@progress/kendo-popup-common';
13
+ import { PopupSettings } from '@progress/kendo-popup-common';
14
+ import { PositionMode as PositionMode_2 } from '@progress/kendo-popup-common';
15
+ import PropTypes from 'prop-types';
16
+ import * as React_2 from 'react';
17
+ import { ZIndexContext } from '@progress/kendo-react-common';
18
+ import { ZIndexContextType } from '@progress/kendo-react-common';
19
+
20
+ /**
21
+ * Defines the horizontal and vertical aligning point of the Popup.
22
+ */
23
+ export declare interface Align extends AlignStrategy {
24
+ /**
25
+ * Defines the possible horizontal point values that are relative to the anchor or the Popup.
26
+ *
27
+ * The available options are:
28
+ * - `left`—Uses the leftmost point of the anchor element.
29
+ * - `center`—Uses the center point of the anchor element.
30
+ * - `right`—Uses the rightmost point of the anchor element.
31
+ */
32
+ horizontal: 'left' | 'center' | 'right';
33
+ /**
34
+ * Defines the possible vertical point values that are relative to the anchor or the Popup.
35
+ *
36
+ * The available options are:
37
+ * - `top`—Uses the top point of the anchor element.
38
+ * - `center`—Uses the center point of the anchor element.
39
+ * - `bottom`—Uses the bottom point of the anchor element.
40
+ */
41
+ vertical: 'top' | 'center' | 'bottom';
42
+ }
43
+
44
+ /**
45
+ * Defines the horizontal and vertical collision behavior of the Popup.
46
+ */
47
+ export declare interface Collision {
48
+ /**
49
+ * Defines the horizontal collision behavior of the Popup.
50
+ */
51
+ horizontal: CollisionType;
52
+ /**
53
+ * Defines the vertical collision behavior of the Popup.
54
+ */
55
+ vertical: CollisionType;
56
+ }
57
+
58
+ /**
59
+ * Defines the possible collision behavior when the Popup is not fully visible.
60
+ *
61
+ * The available options are:
62
+ * - `fit`—Moves the Popup horizontally until it is fully displayed in the viewport.
63
+ * - `flip`—Flips the Popup position based on the origin and the position properties.
64
+ * - `none`—The Popup is rendered at its original position.
65
+ */
66
+ export declare type CollisionType = CollisionType_2;
67
+
68
+ /**
69
+ * Defines the horizontal and the vertical margin offset of the component.
70
+ */
71
+ export declare interface Margin extends MarginSettings {
72
+ /**
73
+ * Defines the possible horizontal margin value.
74
+ */
75
+ horizontal: number;
76
+ /**
77
+ * Defines the possible vertical margin value.
78
+ */
79
+ vertical: number;
80
+ }
81
+
82
+ /**
83
+ * The offset position of the Popup.
84
+ */
85
+ export declare interface Offset extends OffsetPosition {
86
+ /**
87
+ * Defines the top position of the Popup.
88
+ */
89
+ top: number;
90
+ /**
91
+ * Defines the left position of the Popup.
92
+ */
93
+ left: number;
94
+ }
95
+
96
+ /**
97
+ * The KendoReact Popup component.
98
+ */
99
+ export declare const Popup: React_2.ForwardRefExoticComponent<PopupProps & React_2.RefAttributes<unknown>>;
100
+
101
+ /** @hidden */
102
+ export declare type Popup = PopupHandle;
103
+
104
+ /**
105
+ * The animation settings for the Popup component.
106
+ */
107
+ export declare interface PopupAnimation {
108
+ /**
109
+ * The duration of the opening animation in milliseconds. Defaults to `300ms`.
110
+ */
111
+ openDuration?: number;
112
+ /**
113
+ * The duration of the closing animation in milliseconds. Defaults to `300ms`.
114
+ */
115
+ closeDuration?: number;
116
+ }
117
+
118
+ /**
119
+ * Represents the object of the `Close` Popup event.
120
+ */
121
+ export declare interface PopupCloseEvent {
122
+ /**
123
+ * An event target.
124
+ */
125
+ target: Popup;
126
+ }
127
+
128
+ declare interface PopupHandle extends Pick<PopupWithoutContext, keyof PopupWithoutContext> {
129
+ /**
130
+ * @hidden
131
+ */
132
+ element: any;
133
+ }
134
+
135
+ /**
136
+ * Represents the object of the `Open` Popup event.
137
+ */
138
+ export declare interface PopupOpenEvent {
139
+ /**
140
+ * An event target.
141
+ */
142
+ target: Popup;
143
+ }
144
+
145
+ /**
146
+ * Represents the props of the [KendoReact Popup component]({% slug overview_popup %}).
147
+ */
148
+ export declare interface PopupProps extends PopupSettings {
149
+ /**
150
+ * Controls the Popup animation ([see example]({% slug animations_popup %})). By default, the opening and closing animations are enabled.
151
+ */
152
+ animate?: boolean | PopupAnimation;
153
+ /**
154
+ * Specifies the element which will be used as an anchor ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that element.
155
+ */
156
+ anchor?: HTMLElement | null;
157
+ /**
158
+ * Defines the container to which the Popup will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
159
+ * * If set to `null` the Popup will be rendered without React Portal.
160
+ */
161
+ appendTo?: HTMLElement | null;
162
+ /**
163
+ * Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
164
+ */
165
+ anchorAlign?: Align;
166
+ /**
167
+ * Configures the collision behavior of the Popup ([see example]({% slug viewportboundarydetection_popup %})).
168
+ */
169
+ collision?: Collision;
170
+ /**
171
+ * Configures the margin value that will be added to the popup dimensions
172
+ * in pixels and leaves a blank space between the popup and the anchor.
173
+ */
174
+ margin?: Margin;
175
+ /**
176
+ * Specifies the position mode of the component. By default, the Popup uses fixed positioning.
177
+ * To make the Popup acquire absolute positioning, set this option to `absolute`.
178
+ *
179
+ * > If you need to support mobile browsers with the zoom option, use the `absolute` positioning of the Popup.
180
+ */
181
+ positionMode?: PositionMode;
182
+ /**
183
+ * Used to set the document scale when using a [scale transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale).
184
+ *
185
+ * The document or container scale is required to compute the popup position correctly. Detecting the scale is not reliable and must be set by providing a value for SCALE. See [Support for Document Scale]({% slug documentscale_popup %}).
186
+ *
187
+ * > Using this token is not necessary for user-applied browser zoom.
188
+ *
189
+ */
190
+ scale?: number;
191
+ /**
192
+ * Specifies the pivot point of the Popup ([see example]({% slug alignmentpositioning_popup %})).
193
+ */
194
+ popupAlign?: Align;
195
+ /**
196
+ * Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
197
+ */
198
+ offset?: Offset;
199
+ /**
200
+ * Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
201
+ */
202
+ popupClass?: string | Array<string> | {
203
+ [key: string]: boolean;
204
+ };
205
+ /**
206
+ * Specifies a list of CSS classes that will be added to the Popup element.
207
+ */
208
+ className?: string | Array<string>;
209
+ /**
210
+ * Specifies the id that will be added to the Popup element.
211
+ */
212
+ id?: string;
213
+ /**
214
+ * Represents the styles that are applied to the Popup.
215
+ */
216
+ style?: React.CSSProperties;
217
+ /**
218
+ * Fires after the Popup is opened and the opening animation ends.
219
+ */
220
+ onOpen?: (event: PopupOpenEvent) => void;
221
+ /**
222
+ * Fires after the Popup is closed.
223
+ */
224
+ onClose?: (event: PopupCloseEvent) => void;
225
+ /**
226
+ * Fires after the Popup position is set.
227
+ */
228
+ onPosition?: (event: PositionEvent) => void;
229
+ /**
230
+ * Controls the Popup visibility ([see example]({% slug hidden_popup %})). Defaults to `false`.
231
+ */
232
+ show?: boolean;
233
+ /**
234
+ * @hidden
235
+ *
236
+ * If contentKey has changed, the popup will recalculate its position.
237
+ */
238
+ contentKey?: any;
239
+ /**
240
+ * @hidden
241
+ */
242
+ children?: React.ReactNode;
243
+ /**
244
+ * @hidden
245
+ */
246
+ useBaseStyles?: boolean;
247
+ /**
248
+ * @hidden
249
+ */
250
+ role?: string;
251
+ }
252
+
253
+ /**
254
+ * The PopupPropsContext. It allows to configure the Popup props from a wrapper component.
255
+ *
256
+ * @example
257
+ * ```jsx-no-run
258
+ * <PopupPropsContext.Provider value={props => ({ ...props, appendTo: document.querySelector('myPopupsContainer') })}>
259
+ * <DropDownList />
260
+ * <Editor />
261
+ * </PopupPropsContext.Provider>
262
+ * ```
263
+ */
264
+ export declare const PopupPropsContext: React_2.Context<(props: PopupProps) => PopupProps>;
265
+
266
+ /**
267
+ * @hidden
268
+ */
269
+ declare interface PopupState {
270
+ current: Status;
271
+ previous: Status;
272
+ props: {
273
+ show?: boolean;
274
+ anchor?: HTMLElement;
275
+ anchorAlign?: Align;
276
+ appendTo?: HTMLElement;
277
+ collision?: Collision;
278
+ popupAlign?: Align;
279
+ className?: string | Array<string>;
280
+ popupClass?: string | Array<string>;
281
+ style?: React_2.CSSProperties;
282
+ offset?: Offset;
283
+ contentKey?: any;
284
+ };
285
+ }
286
+
287
+ /**
288
+ * @hidden
289
+ */
290
+ export declare class PopupWithoutContext extends React_2.Component<PopupProps, PopupState> {
291
+ /**
292
+ * @hidden
293
+ */
294
+ static propTypes: {
295
+ anchor: (props: PopupProps) => Error | null;
296
+ appendTo: (props: PopupProps) => Error | null;
297
+ className: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
298
+ id: PropTypes.Requireable<string>;
299
+ popupClass: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
300
+ collision: PropTypes.Requireable<PropTypes.InferProps<{
301
+ horizontal: PropTypes.Requireable<string>;
302
+ vertical: PropTypes.Requireable<string>;
303
+ }>>;
304
+ anchorAlign: PropTypes.Requireable<PropTypes.InferProps<{
305
+ horizontal: PropTypes.Requireable<string>;
306
+ vertical: PropTypes.Requireable<string>;
307
+ }>>;
308
+ popupAlign: PropTypes.Requireable<PropTypes.InferProps<{
309
+ horizontal: PropTypes.Requireable<string>;
310
+ vertical: PropTypes.Requireable<string>;
311
+ }>>;
312
+ offset: PropTypes.Requireable<PropTypes.InferProps<{
313
+ left: PropTypes.Requireable<number>;
314
+ top: PropTypes.Requireable<number>;
315
+ }>>;
316
+ children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
317
+ show: PropTypes.Requireable<boolean>;
318
+ animate: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
319
+ openDuration: PropTypes.Requireable<number>;
320
+ closeDuration: PropTypes.Requireable<number>;
321
+ }> | null | undefined>>;
322
+ margin: PropTypes.Requireable<PropTypes.InferProps<{
323
+ horizontal: PropTypes.Requireable<number>;
324
+ vertical: PropTypes.Requireable<number>;
325
+ }>>;
326
+ positionMode: PropTypes.Requireable<string>;
327
+ scale: PropTypes.Requireable<number>;
328
+ style: PropTypes.Requireable<object>;
329
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
330
+ onPosition: PropTypes.Requireable<(...args: any[]) => any>;
331
+ onOpen: PropTypes.Requireable<(...args: any[]) => any>;
332
+ };
333
+ /**
334
+ * @hidden
335
+ */
336
+ static defaultProps: {
337
+ collision: {
338
+ horizontal: string;
339
+ vertical: string;
340
+ };
341
+ anchorAlign: {
342
+ horizontal: string;
343
+ vertical: string;
344
+ };
345
+ popupAlign: {
346
+ horizontal: string;
347
+ vertical: string;
348
+ };
349
+ offset: {
350
+ left: number;
351
+ top: number;
352
+ };
353
+ animate: boolean;
354
+ show: boolean;
355
+ margin: {
356
+ horizontal: number;
357
+ vertical: number;
358
+ };
359
+ positionMode: string;
360
+ };
361
+ /**
362
+ * @hidden
363
+ */
364
+ static contextType: React_2.Context<ZIndexContextType>;
365
+ /**
366
+ * @hidden
367
+ */
368
+ context: React_2.ContextType<typeof ZIndexContext>;
369
+ /**
370
+ * @hidden
371
+ */
372
+ static displayName: string;
373
+ /**
374
+ * @hidden
375
+ */
376
+ readonly state: PopupState;
377
+ private _collisions;
378
+ private _scrollableParents;
379
+ private _popup;
380
+ /**
381
+ * Represents the Popup DOM element.
382
+ */
383
+ get element(): HTMLDivElement | null;
384
+ constructor(props: PopupProps);
385
+ /**
386
+ * @hidden
387
+ */
388
+ static getDerivedStateFromProps(props: PopupProps, state: PopupState): {
389
+ props: {
390
+ show: boolean | undefined;
391
+ anchor: HTMLElement | null | undefined;
392
+ anchorAlign: Align | undefined;
393
+ appendTo: HTMLElement | null | undefined;
394
+ collision: Collision | undefined;
395
+ popupAlign: Align | undefined;
396
+ className: string | string[] | undefined;
397
+ popupClass: string | string[] | {
398
+ [key: string]: boolean;
399
+ } | undefined;
400
+ style: React_2.CSSProperties | undefined;
401
+ offset: Offset | undefined;
402
+ contentKey: any;
403
+ };
404
+ current: Status;
405
+ previous: Status;
406
+ };
407
+ /**
408
+ *
409
+ * @hidden
410
+ */
411
+ componentDidUpdate(prevProps: PopupProps): void;
412
+ /**
413
+ * @hidden
414
+ */
415
+ componentDidMount(): void;
416
+ /**
417
+ * @hidden
418
+ */
419
+ componentWillUnmount(): void;
420
+ /**
421
+ * @hidden
422
+ */
423
+ render(): JSX_2.Element | null;
424
+ private show;
425
+ private setPosition;
426
+ private onOpened;
427
+ private animate;
428
+ private onClosing;
429
+ private onClosed;
430
+ private get animationDuration();
431
+ private attachRepositionHandlers;
432
+ private detachRepositionHandlers;
433
+ private reposition;
434
+ private getCurrentZIndex;
435
+ }
436
+
437
+ /**
438
+ * Represents the object of the `Position` Popup event.
439
+ */
440
+ declare interface PositionEvent {
441
+ /**
442
+ * An event target.
443
+ */
444
+ target: Popup;
445
+ /**
446
+ * Indicates if the position is fitted.
447
+ */
448
+ fitted: boolean;
449
+ /**
450
+ * Indicates if the position is flipped.
451
+ */
452
+ flipped: boolean;
453
+ }
454
+
455
+ /**
456
+ * The type which defines all possible position modes of the Popup.
457
+ */
458
+ export declare type PositionMode = PositionMode_2;
459
+
460
+ declare enum Status {
461
+ hiding = "hiding",
462
+ hidden = "hidden",
463
+ showing = "showing",
464
+ shown = "shown",
465
+ reposition = "reposition"
466
+ }
467
+
468
+ export { }
package/index.js CHANGED
@@ -1,5 +1,8 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),D=require("react-dom"),o=require("prop-types"),m=require("@progress/kendo-react-common"),s=require("@progress/kendo-popup-common");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const g=C(N),x=C(D),A=n=>{n.style.transitionDuration="",Array.from(n.classList).forEach(e=>{e.startsWith("k-slide-")&&n.classList.remove(e)})},E=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),I=(n,e,t,i,l)=>{if(t===0)return l();const r="k-slide-"+e+"-"+i,a=r+"-active",p=d=>{d.target===n&&(n.removeEventListener("transitionend",p),A(n),i==="exit"?n.style.display="none":n.style.display="",l())};n.addEventListener("transitionend",p);const u=n.ownerDocument;if(!u)return;const f=u.defaultView;if(!f)return;const h=()=>{A(n),n.classList.add(r),f.requestAnimationFrame(()=>{n.style.transitionDuration=t+"ms",n.classList.add(a)})};E?f.requestAnimationFrame(h):h()},R=1e3/60,L=function(n,e,t={}){let i,l,r,a,p=0;t=t||{};const u=function(){p=t.leading===!1?0:new Date().getTime(),i=void 0,a=n.apply(l,r),i||(l=r=null)};return function(){const h=new Date().getTime();!p&&t.leading===!1&&(p=h);const d=e-(h-p);return l=void 0,r=arguments,d<=0||d>e?(i&&(clearTimeout(i),i=void 0),p=h,a=n.apply(l,r),i||(l=r=null)):!i&&t.trailing!==!1&&(i=window.setTimeout(u,d)),a}},M={name:"@progress/kendo-react-popup",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},k=100,S=1;function v(n,e){if(n===e)return!0;if(!!n!=!!e)return!1;const t=Object.getOwnPropertyNames(n),i=Object.getOwnPropertyNames(e);if(t.length!==i.length)return!1;for(let l=0;l<t.length;l++){let r=t[l];if(n[r]!==e[r])return!1}return!0}const z={left:-1e3,top:0},U="k-animation-container",O="k-animation-container-shown",j="k-child-animation-container",F="k-popup";class w extends g.Component{constructor(e){super(e),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:i,popupAlign:l,collision:r,offset:a,anchor:p,margin:u,scale:f,positionMode:h}=this.props;const{width:d,height:P}=t.style;t.style.width=t.offsetWidth+"px",t.style.height=t.offsetHeight+"px";const y=s.alignElement({anchor:p,anchorAlign:i,element:t,elementAlign:l,offset:a,margin:u,positionMode:h,scale:f}),c=s.positionElement({anchor:p,anchorAlign:i,element:t,elementAlign:l,collisions:r,currentLocation:y,margin:this.props.margin});if(t.style.top=c.offset.top+"px",t.style.left=c.offset.left+"px",t.style.width=d,t.style.height=P,this._collisions={fit:c.fit,fitted:c.fitted,flip:c.flip,flipped:c.flipped},this.props.onPosition){const T={target:this,flipped:c.flipped,fitted:c.fitted};this.props.onPosition.call(void 0,T)}},this.onOpened=()=>{const t=this._popup;t&&(this.props.show&&t.classList.add(O),this.attachRepositionHandlers(t),this.props.onOpen&&this.props.onOpen.call(void 0,{target:this}))},this.animate=(t,i,l)=>{if(!this.props.popupAlign)return;let r;const{horizontal:a,vertical:p}=this.props.popupAlign;a==="left"&&p==="center"?r="right":a==="right"&&p==="center"?r="left":p==="top"?r="down":r="up";const u={down:"up",up:"down",left:"right",right:"left"};this._collisions&&this._collisions.flipped&&(r=u[r]),I(t,r,this.animationDuration[i],i,l)},this.onClosing=t=>{this.props.show||t.classList.remove(O),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+S:k,m.validatePackage(M),this.reposition=L(this.reposition.bind(this),R)}get element(){return this._popup}static getDerivedStateFromProps(e,t){const{show:i,anchor:l,anchorAlign:r,appendTo:a,collision:p,popupAlign:u,className:f,popupClass:h,style:d,offset:P,contentKey:y}=e,c={...t,props:{show:i,anchor:l,anchorAlign:r,appendTo:a,collision:p,popupAlign:u,className:f,popupClass:h,style:d,offset:P,contentKey:y}};return e.show?t.current==="hidden"||t.current==="hiding"?{...c,current:"showing",previous:t.current}:t.current==="showing"?{...c,current:"shown",previous:t.current}:t.current==="shown"&&(!v(P,t.props.offset)||!v(r,t.props.anchorAlign)||!v(a,t.props.appendTo)||!v(p,t.props.collision)||!v(u,t.props.popupAlign)||!v(d,t.props.style)||l!==t.props.anchor||h!==t.props.popupClass||f!==t.props.className)?{...c,current:"reposition",previous:t.current}:c:t.current==="hiding"||t.current==="hidden"?{...c,current:"hidden",previous:t.current}:{...c,current:"hiding",previous:t.current}}componentDidUpdate(e){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"&&e.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:e,className:t,popupClass:i,show:l,id:r,positionMode:a}=this.props,p=this.props.appendTo?this.props.appendTo:m.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 u=Object.assign({},{position:a,top:0,left:-1e4},this.props.style||{}),f=this.state.current==="hiding";if((l||f)&&p){const h=this.getCurrentZIndex(),d=g.createElement(m.ZIndexContext.Provider,{value:h},g.createElement("div",{className:m.classNames(U,t),id:r,ref:P=>this._popup=P,style:{zIndex:h,...u}},g.createElement("div",{className:m.classNames(j),style:{transitionDelay:"0ms"}},g.createElement("div",{role:this.props.role,className:m.classNames(F,i)},e))));return this.props.appendTo!==null?x.createPortal(d,p):d}return null}get animationDuration(){const e=this.props.animate;let t=0,i=0;return e&&(e===!0?t=i=300:(t=e.openDuration||0,i=e.closeDuration||0)),{enter:t,exit:i}}attachRepositionHandlers(e){this.detachRepositionHandlers(),this._scrollableParents=s.domUtils.scrollableParents(this.props.anchor||e),this._scrollableParents&&this._scrollableParents.map(t=>t.addEventListener("scroll",this.reposition)),window.addEventListener("resize",this.reposition)}detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map(e=>e.removeEventListener("scroll",this.reposition)),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)}reposition(){this.setState({current:"reposition",previous:this.state.current})}}w.propTypes={anchor:function(n){const e=n.anchor;return e&&typeof e.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed."):null},appendTo:function(n){const e=n.appendTo;return e&&typeof e.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed."):null},className:o.oneOfType([o.string,o.arrayOf(o.string),o.object]),id:o.string,popupClass:o.oneOfType([o.string,o.arrayOf(o.string),o.object]),collision:o.shape({horizontal:o.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none]),vertical:o.oneOf([s.Collision.fit,s.Collision.flip,s.Collision.none])}),anchorAlign:o.shape({horizontal:o.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:o.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.AlignPoint.bottom])}),popupAlign:o.shape({horizontal:o.oneOf([s.AlignPoint.left,s.AlignPoint.center,s.AlignPoint.right]),vertical:o.oneOf([s.AlignPoint.top,s.AlignPoint.center,s.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};w.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:z,animate:!0,show:!1,margin:{horizontal:0,vertical:0},positionMode:"absolute"};w.contextType=m.ZIndexContext;w.displayName="PopupComponent";const _=g.createContext(n=>n),b=g.forwardRef((n,e)=>{const i=g.useContext(_).call(void 0,n);return g.createElement(w,{ref:e,...i})});b.displayName="Popup";exports.Popup=b;exports.PopupPropsContext=_;exports.PopupWithoutContext=w;
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./Popup.js"),o=require("./PopupWithoutContext.js");exports.Popup=t.Popup;exports.PopupPropsContext=t.PopupPropsContext;exports.PopupWithoutContext=o.PopupWithoutContext;