@progress/kendo-react-popup 6.1.1 → 7.0.0-develop.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE.md +1 -1
  2. package/{dist/npm/Popup.d.ts → Popup.d.ts} +5 -1
  3. package/{dist/npm/PopupWithoutContext.d.ts → PopupWithoutContext.d.ts} +5 -1
  4. package/animation.d.ts +8 -0
  5. package/dist/cdn/js/kendo-react-popup.js +5 -1
  6. package/index.d.ts +16 -0
  7. package/index.js +5 -0
  8. package/index.mjs +372 -0
  9. package/{dist/npm/models → models}/Align.d.ts +4 -0
  10. package/{dist/npm/models → models}/Collision.d.ts +4 -0
  11. package/{dist/npm/models → models}/CollisionType.d.ts +5 -1
  12. package/{dist/es/models → models}/Events.d.ts +4 -0
  13. package/{dist/npm/models → models}/Margin.d.ts +4 -0
  14. package/models/Offset.d.ts +18 -0
  15. package/models/PopupAnimation.d.ts +17 -0
  16. package/{dist/es/models → models}/PopupProps.d.ts +4 -1
  17. package/models/PositionMode.d.ts +9 -0
  18. package/package-metadata.d.ts +9 -0
  19. package/package.json +27 -27
  20. package/{dist/npm/util.d.ts → util.d.ts} +4 -0
  21. package/about.md +0 -3
  22. package/dist/es/Popup.d.ts +0 -27
  23. package/dist/es/Popup.js +0 -34
  24. package/dist/es/PopupWithoutContext.d.ts +0 -183
  25. package/dist/es/PopupWithoutContext.js +0 -485
  26. package/dist/es/animation.d.ts +0 -4
  27. package/dist/es/animation.js +0 -59
  28. package/dist/es/main.d.ts +0 -12
  29. package/dist/es/main.js +0 -3
  30. package/dist/es/models/Align.d.ts +0 -24
  31. package/dist/es/models/Align.js +0 -1
  32. package/dist/es/models/Collision.d.ts +0 -14
  33. package/dist/es/models/Collision.js +0 -1
  34. package/dist/es/models/CollisionType.d.ts +0 -10
  35. package/dist/es/models/CollisionType.js +0 -1
  36. package/dist/es/models/Events.js +0 -1
  37. package/dist/es/models/Margin.d.ts +0 -14
  38. package/dist/es/models/Margin.js +0 -1
  39. package/dist/es/models/Offset.d.ts +0 -14
  40. package/dist/es/models/Offset.js +0 -1
  41. package/dist/es/models/PopupAnimation.d.ts +0 -13
  42. package/dist/es/models/PopupAnimation.js +0 -1
  43. package/dist/es/models/PopupProps.js +0 -1
  44. package/dist/es/models/PopupSettings.d.ts +0 -87
  45. package/dist/es/models/PopupSettings.js +0 -2
  46. package/dist/es/models/PositionMode.d.ts +0 -5
  47. package/dist/es/models/PositionMode.js +0 -1
  48. package/dist/es/package-metadata.d.ts +0 -5
  49. package/dist/es/package-metadata.js +0 -11
  50. package/dist/es/util.d.ts +0 -17
  51. package/dist/es/util.js +0 -58
  52. package/dist/npm/Popup.js +0 -37
  53. package/dist/npm/PopupWithoutContext.js +0 -488
  54. package/dist/npm/animation.d.ts +0 -4
  55. package/dist/npm/animation.js +0 -63
  56. package/dist/npm/main.d.ts +0 -12
  57. package/dist/npm/main.js +0 -8
  58. package/dist/npm/models/Align.js +0 -2
  59. package/dist/npm/models/Collision.js +0 -2
  60. package/dist/npm/models/CollisionType.js +0 -2
  61. package/dist/npm/models/Events.d.ts +0 -36
  62. package/dist/npm/models/Events.js +0 -2
  63. package/dist/npm/models/Margin.js +0 -2
  64. package/dist/npm/models/Offset.d.ts +0 -14
  65. package/dist/npm/models/Offset.js +0 -2
  66. package/dist/npm/models/PopupAnimation.d.ts +0 -13
  67. package/dist/npm/models/PopupAnimation.js +0 -2
  68. package/dist/npm/models/PopupProps.d.ts +0 -116
  69. package/dist/npm/models/PopupProps.js +0 -2
  70. package/dist/npm/models/PopupSettings.d.ts +0 -87
  71. package/dist/npm/models/PopupSettings.js +0 -3
  72. package/dist/npm/models/PositionMode.d.ts +0 -5
  73. package/dist/npm/models/PositionMode.js +0 -2
  74. package/dist/npm/package-metadata.d.ts +0 -5
  75. package/dist/npm/package-metadata.js +0 -14
  76. package/dist/npm/util.js +0 -64
  77. package/dist/systemjs/kendo-react-popup.js +0 -1
  78. package/e2e-legacy/basics.tests.ts +0 -164
  79. package/e2e-next/basic.tests.ts +0 -26
@@ -1,183 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { ZIndexContext } from '@progress/kendo-react-common';
4
- import { Offset } from './models/Offset';
5
- import { PopupProps } from './models/PopupProps';
6
- import { Align } from './models/Align';
7
- import { Collision } from './models/Collision';
8
- declare enum Status {
9
- hiding = "hiding",
10
- hidden = "hidden",
11
- showing = "showing",
12
- shown = "shown",
13
- reposition = "reposition"
14
- }
15
- /**
16
- * @hidden
17
- */
18
- export interface PopupState {
19
- current: Status;
20
- previous: Status;
21
- props: {
22
- show?: boolean;
23
- anchor?: HTMLElement;
24
- anchorAlign?: Align;
25
- appendTo?: HTMLElement;
26
- collision?: Collision;
27
- popupAlign?: Align;
28
- className?: string | Array<string>;
29
- popupClass?: string | Array<string>;
30
- style?: React.CSSProperties;
31
- offset?: Offset;
32
- contentKey?: any;
33
- };
34
- }
35
- /**
36
- * @hidden
37
- */
38
- export declare class PopupWithoutContext extends React.Component<PopupProps, PopupState> {
39
- /**
40
- * @hidden
41
- */
42
- static propTypes: {
43
- anchor: (props: PopupProps) => Error | null;
44
- appendTo: (props: PopupProps) => Error | null;
45
- className: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
46
- id: PropTypes.Requireable<string>;
47
- popupClass: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
48
- collision: PropTypes.Requireable<PropTypes.InferProps<{
49
- horizontal: PropTypes.Requireable<string>;
50
- vertical: PropTypes.Requireable<string>;
51
- }>>;
52
- anchorAlign: PropTypes.Requireable<PropTypes.InferProps<{
53
- horizontal: PropTypes.Requireable<string>;
54
- vertical: PropTypes.Requireable<string>;
55
- }>>;
56
- popupAlign: PropTypes.Requireable<PropTypes.InferProps<{
57
- horizontal: PropTypes.Requireable<string>;
58
- vertical: PropTypes.Requireable<string>;
59
- }>>;
60
- offset: PropTypes.Requireable<PropTypes.InferProps<{
61
- left: PropTypes.Requireable<number>;
62
- top: PropTypes.Requireable<number>;
63
- }>>;
64
- children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
65
- show: PropTypes.Requireable<boolean>;
66
- animate: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
67
- openDuration: PropTypes.Requireable<number>;
68
- closeDuration: PropTypes.Requireable<number>;
69
- }> | null | undefined>>;
70
- margin: PropTypes.Requireable<PropTypes.InferProps<{
71
- horizontal: PropTypes.Requireable<number>;
72
- vertical: PropTypes.Requireable<number>;
73
- }>>;
74
- positionMode: PropTypes.Requireable<string>;
75
- scale: PropTypes.Requireable<number>;
76
- style: PropTypes.Requireable<object>;
77
- onClose: PropTypes.Requireable<(...args: any[]) => any>;
78
- onPosition: PropTypes.Requireable<(...args: any[]) => any>;
79
- onOpen: PropTypes.Requireable<(...args: any[]) => any>;
80
- };
81
- /**
82
- * @hidden
83
- */
84
- static defaultProps: {
85
- collision: {
86
- horizontal: string;
87
- vertical: string;
88
- };
89
- anchorAlign: {
90
- horizontal: string;
91
- vertical: string;
92
- };
93
- popupAlign: {
94
- horizontal: string;
95
- vertical: string;
96
- };
97
- offset: {
98
- left: number;
99
- top: number;
100
- };
101
- animate: boolean;
102
- show: boolean;
103
- margin: {
104
- horizontal: number;
105
- vertical: number;
106
- };
107
- positionMode: string;
108
- };
109
- /**
110
- * @hidden
111
- */
112
- static contextType: React.Context<import("@progress/kendo-react-common").ZIndexContextType>;
113
- /**
114
- * @hidden
115
- */
116
- context: React.ContextType<typeof ZIndexContext>;
117
- /**
118
- * @hidden
119
- */
120
- static displayName: string;
121
- /**
122
- * @hidden
123
- */
124
- readonly state: PopupState;
125
- private _collisions;
126
- private _scrollableParents;
127
- private _popup;
128
- /**
129
- * Represents the Popup DOM element.
130
- */
131
- get element(): HTMLDivElement | null;
132
- constructor(props: PopupProps);
133
- /**
134
- * @hidden
135
- */
136
- static getDerivedStateFromProps(props: PopupProps, state: PopupState): {
137
- props: {
138
- show: boolean | undefined;
139
- anchor: HTMLElement | null | undefined;
140
- anchorAlign: Align | undefined;
141
- appendTo: HTMLElement | null | undefined;
142
- collision: Collision | undefined;
143
- popupAlign: Align | undefined;
144
- className: string | string[] | undefined;
145
- popupClass: string | string[] | {
146
- [key: string]: boolean;
147
- } | undefined;
148
- style: React.CSSProperties | undefined;
149
- offset: Offset | undefined;
150
- contentKey: any;
151
- };
152
- current: Status;
153
- previous: Status;
154
- };
155
- /**
156
- * @hidden
157
- */
158
- componentDidUpdate(prevProps: PopupProps): void;
159
- /**
160
- * @hidden
161
- */
162
- componentDidMount(): void;
163
- /**
164
- * @hidden
165
- */
166
- componentWillUnmount(): void;
167
- /**
168
- * @hidden
169
- */
170
- render(): JSX.Element | null;
171
- private show;
172
- private setPosition;
173
- private onOpened;
174
- private animate;
175
- private onClosing;
176
- private onClosed;
177
- private get animationDuration();
178
- private attachRepositionHandlers;
179
- private detachRepositionHandlers;
180
- private reposition;
181
- private getCurrentZIndex;
182
- }
183
- export {};
@@ -1,485 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- import * as React from 'react';
28
- import * as ReactDOM from 'react-dom';
29
- import * as PropTypes from 'prop-types';
30
- import { slide } from './animation';
31
- import { canUseDOM, ZIndexContext, validatePackage, classNames } from '@progress/kendo-react-common';
32
- import { AlignPoint, alignElement, domUtils, positionElement, Collision as CollisionEnum } from '@progress/kendo-popup-common';
33
- import { throttle, FRAME_DURATION } from './util';
34
- import { packageMetadata } from './package-metadata';
35
- var DEFAULT_POPUP_ZINDEX = 100;
36
- var ZINDEX_POPUP_STEP = 1;
37
- function isEquivalent(a, b) {
38
- if (a === b) {
39
- return true;
40
- }
41
- if (!!a !== !!b) {
42
- return false;
43
- }
44
- var aProps = Object.getOwnPropertyNames(a);
45
- var bProps = Object.getOwnPropertyNames(b);
46
- if (aProps.length !== bProps.length) {
47
- return false;
48
- }
49
- for (var i = 0; i < aProps.length; i++) {
50
- var propName = aProps[i];
51
- if (a[propName] !== b[propName]) {
52
- return false;
53
- }
54
- }
55
- return true;
56
- }
57
- var DEFAULT_OFFSET = {
58
- left: -1000,
59
- top: 0
60
- };
61
- var Status;
62
- (function (Status) {
63
- Status["hiding"] = "hiding";
64
- Status["hidden"] = "hidden";
65
- Status["showing"] = "showing";
66
- Status["shown"] = "shown";
67
- Status["reposition"] = "reposition";
68
- })(Status || (Status = {}));
69
- var ANIMATION_CONTAINER = 'k-animation-container';
70
- var ANIMATION_CONTAINER_SHOWN = 'k-animation-container-shown';
71
- var ANIMATION_CONTAINER_CHILD = 'k-child-animation-container';
72
- var K_POPUP = 'k-popup';
73
- /**
74
- * @hidden
75
- */
76
- var PopupWithoutContext = /** @class */ (function (_super) {
77
- __extends(PopupWithoutContext, _super);
78
- function PopupWithoutContext(props) {
79
- var _this = _super.call(this, props) || this;
80
- /**
81
- * @hidden
82
- */
83
- _this.context = 0;
84
- /**
85
- * @hidden
86
- */
87
- _this.state = { current: Status.hidden, previous: Status.hidden, props: {} };
88
- _this._popup = null;
89
- _this.show = function (popup) {
90
- _this.setPosition(popup);
91
- _this.animate(popup.firstChild, 'enter', _this.onOpened);
92
- _this.setState({ current: Status.shown, previous: _this.state.current });
93
- };
94
- _this.setPosition = function (popup) {
95
- var _a = _this.props, anchorAlign = _a.anchorAlign, popupAlign = _a.popupAlign, collision = _a.collision, offset = _a.offset, anchor = _a.anchor, margin = _a.margin, scale = _a.scale, positionMode = _a.positionMode;
96
- var _b = popup.style, width = _b.width, height = _b.height;
97
- // Calculations are wrong if popup does not have set size
98
- popup.style.width = popup.offsetWidth + 'px';
99
- popup.style.height = popup.offsetHeight + 'px';
100
- var alignedOffset = alignElement({
101
- anchor: anchor,
102
- anchorAlign: anchorAlign,
103
- element: popup,
104
- elementAlign: popupAlign,
105
- offset: offset,
106
- margin: margin,
107
- positionMode: positionMode,
108
- scale: scale
109
- });
110
- var position = positionElement({
111
- anchor: anchor,
112
- anchorAlign: anchorAlign,
113
- element: popup,
114
- elementAlign: popupAlign,
115
- collisions: collision,
116
- currentLocation: alignedOffset,
117
- margin: _this.props.margin
118
- });
119
- popup.style.top = position.offset.top + 'px';
120
- popup.style.left = position.offset.left + 'px';
121
- popup.style.width = width;
122
- popup.style.height = height;
123
- _this._collisions = {
124
- fit: position.fit,
125
- fitted: position.fitted,
126
- flip: position.flip,
127
- flipped: position.flipped
128
- };
129
- if (_this.props.onPosition) {
130
- var event_1 = {
131
- target: _this,
132
- flipped: position.flipped,
133
- fitted: position.fitted
134
- };
135
- _this.props.onPosition.call(undefined, event_1);
136
- }
137
- };
138
- _this.onOpened = function () {
139
- var element = _this._popup;
140
- if (!element) {
141
- return;
142
- }
143
- if (_this.props.show) {
144
- element.classList.add(ANIMATION_CONTAINER_SHOWN);
145
- }
146
- _this.attachRepositionHandlers(element);
147
- if (_this.props.onOpen) {
148
- _this.props.onOpen.call(undefined, { target: _this });
149
- }
150
- };
151
- _this.animate = function (element, type, callback) {
152
- if (!_this.props.popupAlign) {
153
- return;
154
- }
155
- var animationDirection;
156
- var _a = _this.props.popupAlign, horizontal = _a.horizontal, vertical = _a.vertical;
157
- if (horizontal === 'left' && vertical === 'center') {
158
- animationDirection = 'right';
159
- }
160
- else if (horizontal === 'right' && vertical === 'center') {
161
- animationDirection = 'left';
162
- }
163
- else if (vertical === 'top') {
164
- animationDirection = 'down';
165
- }
166
- else {
167
- animationDirection = 'up';
168
- }
169
- var flipPositions = {
170
- down: 'up',
171
- up: 'down',
172
- left: 'right',
173
- right: 'left'
174
- };
175
- if (_this._collisions && _this._collisions.flipped) {
176
- animationDirection = flipPositions[animationDirection];
177
- }
178
- slide(element, animationDirection, _this.animationDuration[type], type, callback);
179
- };
180
- _this.onClosing = function (popup) {
181
- if (!_this.props.show) {
182
- popup.classList.remove(ANIMATION_CONTAINER_SHOWN);
183
- }
184
- _this.detachRepositionHandlers();
185
- };
186
- _this.onClosed = function () {
187
- if (_this.state.current === Status.hiding && _this.state.previous === Status.shown) {
188
- _this.setState({ current: Status.hidden, previous: _this.state.current });
189
- }
190
- if (_this.props.onClose) {
191
- _this.props.onClose.call(undefined, { target: _this });
192
- }
193
- };
194
- _this.getCurrentZIndex = function () {
195
- return _this.context ? _this.context + ZINDEX_POPUP_STEP : DEFAULT_POPUP_ZINDEX;
196
- };
197
- validatePackage(packageMetadata);
198
- _this.reposition = throttle(_this.reposition.bind(_this), FRAME_DURATION);
199
- return _this;
200
- }
201
- Object.defineProperty(PopupWithoutContext.prototype, "element", {
202
- /**
203
- * Represents the Popup DOM element.
204
- */
205
- get: function () {
206
- return this._popup;
207
- },
208
- enumerable: false,
209
- configurable: true
210
- });
211
- /**
212
- * @hidden
213
- */
214
- PopupWithoutContext.getDerivedStateFromProps = function (props, state) {
215
- var show = props.show, anchor = props.anchor, anchorAlign = props.anchorAlign, appendTo = props.appendTo, collision = props.collision, popupAlign = props.popupAlign, className = props.className, popupClass = props.popupClass, style = props.style, offset = props.offset, contentKey = props.contentKey;
216
- var nextState = __assign(__assign({}, state), { props: {
217
- show: show,
218
- anchor: anchor,
219
- anchorAlign: anchorAlign,
220
- appendTo: appendTo,
221
- collision: collision,
222
- popupAlign: popupAlign,
223
- className: className,
224
- popupClass: popupClass,
225
- style: style,
226
- offset: offset,
227
- contentKey: contentKey
228
- } });
229
- if (props.show) {
230
- if (state.current === Status.hidden || state.current === Status.hiding) {
231
- return __assign(__assign({}, nextState), { current: Status.showing, previous: state.current });
232
- }
233
- if (state.current === Status.showing) {
234
- return __assign(__assign({}, nextState), { current: Status.shown, previous: state.current });
235
- }
236
- if (state.current === Status.shown &&
237
- (!isEquivalent(offset, state.props.offset) ||
238
- !isEquivalent(anchorAlign, state.props.anchorAlign) ||
239
- !isEquivalent(appendTo, state.props.appendTo) ||
240
- !isEquivalent(collision, state.props.collision) ||
241
- !isEquivalent(popupAlign, state.props.popupAlign) ||
242
- !isEquivalent(style, state.props.style) ||
243
- anchor !== state.props.anchor ||
244
- popupClass !== state.props.popupClass ||
245
- className !== state.props.className)) {
246
- return __assign(__assign({}, nextState), { current: Status.reposition, previous: state.current });
247
- }
248
- return nextState;
249
- }
250
- if (state.current === Status.hiding || state.current === Status.hidden) {
251
- return __assign(__assign({}, nextState), { current: Status.hidden, previous: state.current });
252
- }
253
- return __assign(__assign({}, nextState), { current: Status.hiding, previous: state.current });
254
- };
255
- /**
256
- * @hidden
257
- */
258
- PopupWithoutContext.prototype.componentDidUpdate = function (prevProps) {
259
- if (this.state.current === Status.showing && this._popup) {
260
- this.show(this._popup);
261
- }
262
- else if (this.state.current === Status.hiding && this._popup) {
263
- this.onClosing(this._popup);
264
- this.animate(this._popup.firstChild, 'exit', this.onClosed);
265
- }
266
- else if (this.state.current === Status.reposition && this.state.previous === Status.shown) {
267
- this.setState({ current: Status.shown, previous: this.state.current });
268
- }
269
- else if (this.state.current === Status.shown &&
270
- prevProps.contentKey !== this.props.contentKey && this._popup) {
271
- this.setPosition(this._popup);
272
- }
273
- };
274
- /**
275
- * @hidden
276
- */
277
- PopupWithoutContext.prototype.componentDidMount = function () {
278
- if (this.state.current === Status.showing && this._popup) {
279
- this.show(this._popup);
280
- }
281
- };
282
- /**
283
- * @hidden
284
- */
285
- PopupWithoutContext.prototype.componentWillUnmount = function () {
286
- this.detachRepositionHandlers();
287
- };
288
- /**
289
- * @hidden
290
- */
291
- PopupWithoutContext.prototype.render = function () {
292
- var _this = this;
293
- var _a = this.props, children = _a.children, className = _a.className, popupClass = _a.popupClass, show = _a.show, id = _a.id, positionMode = _a.positionMode;
294
- var calculatedAppendTo = this.props.appendTo ?
295
- this.props.appendTo :
296
- canUseDOM ?
297
- (this.props.anchor && this.props.anchor.ownerDocument ? this.props.anchor.ownerDocument.body : document.body)
298
- : undefined;
299
- if (this.state.current === Status.reposition && this.state.previous === Status.shown && this._popup) {
300
- this.setPosition(this._popup);
301
- }
302
- var style = Object.assign({}, { position: positionMode, top: 0, left: -10000 }, this.props.style || {});
303
- var closing = this.state.current === Status.hiding;
304
- if ((show || closing) && calculatedAppendTo) {
305
- var currentZIndex = this.getCurrentZIndex();
306
- var popupElement = (React.createElement(ZIndexContext.Provider, { value: currentZIndex },
307
- React.createElement("div", { className: classNames(ANIMATION_CONTAINER, className), id: id, ref: function (e) { return _this._popup = e; }, style: __assign({ zIndex: currentZIndex }, style) },
308
- React.createElement("div", { className: classNames(ANIMATION_CONTAINER_CHILD), style: { transitionDelay: '0ms' } },
309
- React.createElement("div", { role: this.props.role, className: classNames(K_POPUP, popupClass) }, children)))));
310
- return this.props.appendTo !== null ?
311
- ReactDOM.createPortal(popupElement, calculatedAppendTo) :
312
- popupElement;
313
- }
314
- return null;
315
- };
316
- Object.defineProperty(PopupWithoutContext.prototype, "animationDuration", {
317
- get: function () {
318
- var animate = this.props.animate;
319
- var enter = 0;
320
- var exit = 0;
321
- if (animate) {
322
- if (animate === true) {
323
- enter = exit = 300;
324
- }
325
- else {
326
- enter = animate.openDuration || 0;
327
- exit = animate.closeDuration || 0;
328
- }
329
- }
330
- return { enter: enter, exit: exit };
331
- },
332
- enumerable: false,
333
- configurable: true
334
- });
335
- PopupWithoutContext.prototype.attachRepositionHandlers = function (element) {
336
- var _this = this;
337
- this.detachRepositionHandlers();
338
- this._scrollableParents = domUtils.scrollableParents(this.props.anchor || element);
339
- if (this._scrollableParents) {
340
- this._scrollableParents.map(function (p) { return p.addEventListener('scroll', _this.reposition); });
341
- }
342
- window.addEventListener('resize', this.reposition);
343
- };
344
- PopupWithoutContext.prototype.detachRepositionHandlers = function () {
345
- var _this = this;
346
- if (this._scrollableParents) {
347
- this._scrollableParents.map(function (p) { return p.removeEventListener('scroll', _this.reposition); });
348
- this._scrollableParents = undefined;
349
- }
350
- window.removeEventListener('resize', this.reposition);
351
- };
352
- PopupWithoutContext.prototype.reposition = function () {
353
- this.setState({ current: Status.reposition, previous: this.state.current });
354
- };
355
- /**
356
- * @hidden
357
- */
358
- PopupWithoutContext.propTypes = {
359
- anchor: function (props) {
360
- var anchor = props.anchor;
361
- if (anchor && typeof anchor.nodeType !== 'number') {
362
- return new Error('Invalid prop `anchor` supplied to `Kendo React Popup`. Validation failed.');
363
- }
364
- return null;
365
- },
366
- appendTo: function (props) {
367
- var element = props.appendTo;
368
- if (element && typeof element.nodeType !== 'number') {
369
- return new Error('Invalid prop `appendTo` supplied to `Kendo React Popup`. Validation failed.');
370
- }
371
- return null;
372
- },
373
- className: PropTypes.oneOfType([
374
- PropTypes.string,
375
- PropTypes.arrayOf(PropTypes.string),
376
- PropTypes.object
377
- ]),
378
- id: PropTypes.string,
379
- popupClass: PropTypes.oneOfType([
380
- PropTypes.string,
381
- PropTypes.arrayOf(PropTypes.string),
382
- PropTypes.object
383
- ]),
384
- collision: PropTypes.shape({
385
- horizontal: PropTypes.oneOf([
386
- CollisionEnum.fit,
387
- CollisionEnum.flip,
388
- CollisionEnum.none
389
- ]),
390
- vertical: PropTypes.oneOf([
391
- CollisionEnum.fit,
392
- CollisionEnum.flip,
393
- CollisionEnum.none
394
- ])
395
- }),
396
- anchorAlign: PropTypes.shape({
397
- horizontal: PropTypes.oneOf([
398
- AlignPoint.left,
399
- AlignPoint.center,
400
- AlignPoint.right
401
- ]),
402
- vertical: PropTypes.oneOf([
403
- AlignPoint.top,
404
- AlignPoint.center,
405
- AlignPoint.bottom
406
- ])
407
- }),
408
- popupAlign: PropTypes.shape({
409
- horizontal: PropTypes.oneOf([
410
- AlignPoint.left,
411
- AlignPoint.center,
412
- AlignPoint.right
413
- ]),
414
- vertical: PropTypes.oneOf([
415
- AlignPoint.top,
416
- AlignPoint.center,
417
- AlignPoint.bottom
418
- ])
419
- }),
420
- offset: PropTypes.shape({
421
- left: PropTypes.number,
422
- top: PropTypes.number
423
- }),
424
- children: PropTypes.oneOfType([
425
- PropTypes.element,
426
- PropTypes.node
427
- ]),
428
- show: PropTypes.bool,
429
- animate: PropTypes.oneOfType([
430
- PropTypes.bool,
431
- PropTypes.shape({
432
- openDuration: PropTypes.number,
433
- closeDuration: PropTypes.number
434
- })
435
- ]),
436
- margin: PropTypes.shape({
437
- horizontal: PropTypes.number,
438
- vertical: PropTypes.number
439
- }),
440
- positionMode: PropTypes.oneOf([
441
- 'fixed',
442
- 'absolute'
443
- ]),
444
- scale: PropTypes.number,
445
- style: PropTypes.object,
446
- onClose: PropTypes.func,
447
- onPosition: PropTypes.func,
448
- onOpen: PropTypes.func
449
- };
450
- /**
451
- * @hidden
452
- */
453
- PopupWithoutContext.defaultProps = {
454
- collision: {
455
- horizontal: CollisionEnum.fit,
456
- vertical: CollisionEnum.flip
457
- },
458
- anchorAlign: {
459
- horizontal: AlignPoint.left,
460
- vertical: AlignPoint.bottom
461
- },
462
- popupAlign: {
463
- horizontal: AlignPoint.left,
464
- vertical: AlignPoint.top
465
- },
466
- offset: DEFAULT_OFFSET,
467
- animate: true,
468
- show: false,
469
- margin: {
470
- horizontal: 0,
471
- vertical: 0
472
- },
473
- positionMode: 'absolute'
474
- };
475
- /**
476
- * @hidden
477
- */
478
- PopupWithoutContext.contextType = ZIndexContext;
479
- /**
480
- * @hidden
481
- */
482
- PopupWithoutContext.displayName = 'PopupComponent';
483
- return PopupWithoutContext;
484
- }(React.Component));
485
- export { PopupWithoutContext };
@@ -1,4 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- export declare const slide: (element: HTMLElement, direction: 'up' | 'down' | 'left' | 'right', duration: number, type: 'enter' | 'exit', callback: Function) => any;