@progress/kendo-react-tooltip 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.
Files changed (36) hide show
  1. package/dist/cdn/js/kendo-react-tooltip.js +8 -5
  2. package/index.d.mts +520 -5
  3. package/index.d.ts +520 -23
  4. package/index.js +8 -5
  5. package/index.mjs +13 -466
  6. package/package-metadata.js +8 -0
  7. package/package-metadata.mjs +19 -0
  8. package/package.json +3 -3
  9. package/popover/Popover.js +8 -0
  10. package/popover/Popover.mjs +185 -0
  11. package/popover/PopoverActionsBar.js +8 -0
  12. package/popover/PopoverActionsBar.mjs +45 -0
  13. package/tooltip/Tooltip.js +8 -0
  14. package/tooltip/Tooltip.mjs +220 -0
  15. package/tooltip/utils.js +8 -0
  16. package/tooltip/utils.mjs +59 -0
  17. package/package-metadata.d.ts +0 -9
  18. package/popover/Popover.d.ts +0 -19
  19. package/popover/PopoverActionsBar.d.ts +0 -23
  20. package/popover/interfaces/Align.d.ts +0 -28
  21. package/popover/interfaces/PopoverActionsBarProps.d.ts +0 -31
  22. package/popover/interfaces/PopoverAnimation.d.ts +0 -10
  23. package/popover/interfaces/PopoverCloseEvent.d.ts +0 -14
  24. package/popover/interfaces/PopoverCollision.d.ts +0 -18
  25. package/popover/interfaces/PopoverCollisionType.d.ts +0 -14
  26. package/popover/interfaces/PopoverMargin.d.ts +0 -18
  27. package/popover/interfaces/PopoverOffset.d.ts +0 -18
  28. package/popover/interfaces/PopoverOpenEvent.d.ts +0 -14
  29. package/popover/interfaces/PopoverPosition.d.ts +0 -13
  30. package/popover/interfaces/PopoverPositionEvent.d.ts +0 -22
  31. package/popover/interfaces/PopoverPositionMode.d.ts +0 -9
  32. package/popover/interfaces/PopoverProps.d.ts +0 -115
  33. package/tooltip/Tooltip.d.ts +0 -89
  34. package/tooltip/TooltipProps.d.ts +0 -112
  35. package/tooltip/events.d.ts +0 -35
  36. package/tooltip/utils.d.ts +0 -28
package/index.mjs CHANGED
@@ -1,469 +1,16 @@
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
- *-------------------------------------------------------------------------------------------*/
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
+ */
5
8
  "use client";
6
- import * as s from "react";
7
- import * as tt from "react-dom";
8
- import n from "prop-types";
9
- import { ZIndexContext as k, dispatchEvent as P, validatePackage as D, classNames as m } from "@progress/kendo-react-common";
10
- import { Popup as et } from "@progress/kendo-react-popup";
11
- const p = 10, u = 10, ot = (o, t, e, i, r) => {
12
- switch (r) {
13
- case "bottom":
14
- return i === "pointer" ? o - t / 2 : e.left - t / 2 + e.width / 2;
15
- case "left":
16
- return i === "pointer" ? o - t - p : e.left - t - p;
17
- case "right":
18
- return i === "pointer" ? o + p : e.right + p;
19
- case "top":
20
- return i === "pointer" ? o - t / 2 : e.left - t / 2 + e.width / 2;
21
- default:
22
- return i === "pointer" ? o < window.screen.availWidth / 2 ? o - p : o - t + p : o < window.screen.availWidth / 2 ? e.left : e.right - t;
23
- }
24
- }, nt = (o, t, e, i, r) => {
25
- switch (r) {
26
- case "bottom":
27
- return i === "pointer" ? o + u : t.bottom + u;
28
- case "left":
29
- return i === "pointer" ? o - e / 2 : t.top - e / 2 + t.height / 2;
30
- case "right":
31
- return i === "pointer" ? o - e / 2 : t.top - e / 2 + t.height / 2;
32
- case "top":
33
- return i === "pointer" ? o - e - u : t.top - e - u;
34
- default:
35
- return i === "pointer" ? o < window.innerHeight / 2 ? o + p : o - e - p : o < window.innerHeight / 2 ? t.bottom + u : t.top - e - u;
36
- }
37
- }, it = (o) => o !== null ? o.getBoundingClientRect() : document.body.getBoundingClientRect(), st = [
38
- "k-tooltip-content",
39
- "k-animation-container",
40
- "k-tooltip",
41
- "k-tooltip-title",
42
- "k-tooltip k-tooltip-closable",
43
- "k-icon k-i-close"
44
- ], N = (o) => {
45
- if (o === null)
46
- return !1;
47
- let t = o;
48
- for (; t; ) {
49
- if (t !== null && t.classList && t.classList.contains("k-tooltip"))
50
- return !0;
51
- t.parentNode !== null ? t = t.parentNode : t = !1;
52
- }
53
- return st.filter((e) => e === o.className).length > 0;
54
- }, R = {
55
- name: "@progress/kendo-react-tooltip",
56
- productName: "KendoReact",
57
- productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
58
- publishDate: 1709632290,
59
- version: "",
60
- licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
61
- }, rt = 100, A = class extends s.PureComponent {
62
- constructor(o) {
63
- super(o), this.context = 0, this.state = {
64
- targetElement: null,
65
- open: !1,
66
- title: ""
67
- }, this.top = 0, this.left = 0, this.willOpen = !1, this.handleMouseOut = (t) => {
68
- const { targetElement: e } = this.state, i = e ? e.ownerDocument : document;
69
- let r = i && i.elementFromPoint(t.clientX, t.clientY);
70
- N(r) || this.props.open || (clearInterval(this.updateIntervalId), this.willOpen = !1, this.onClose(t));
71
- }, this.handleMouseOver = (t) => {
72
- const e = t.target;
73
- !this.isVisible(e) || N(e) || e === this.state.targetElement || this.showToolTip(t);
74
- }, this.handleBodyMousemove = (t) => {
75
- this.top = t.clientY, this.left = t.clientX;
76
- }, this.onClose = (t) => {
77
- P(this.props.onClose, t, this, void 0), this.setState({ targetElement: null, open: !1, title: "" });
78
- }, this.setUpdateInterval = () => {
79
- this.props.updateInterval && (this.updateIntervalId = setInterval(
80
- this.onIntervalUpdate,
81
- this.props.updateInterval
82
- ));
83
- }, this.onIntervalUpdate = () => {
84
- const t = this.state.targetElement;
85
- t && (t.parentElement === null ? this.onClose({ target: t }) : this.showToolTip({ target: t }));
86
- }, this.position = (t) => {
87
- let e = it(this.state.targetElement);
88
- const i = ot(
89
- this.left,
90
- t.offsetWidth,
91
- e,
92
- this.props.anchorElement,
93
- this.props.position
94
- ), r = nt(
95
- this.top,
96
- e,
97
- t.offsetHeight,
98
- this.props.anchorElement,
99
- this.props.position
100
- );
101
- return { left: i, top: r };
102
- }, this.getTitle = (t) => {
103
- for (; t; ) {
104
- if (t.getAttribute("title") !== null || t.titleExpando)
105
- return { title: t.getAttribute("title") || t.titleExpando, element: t };
106
- t = this.props.parentTitle && t.parentElement || null;
107
- }
108
- return { title: "", element: t };
109
- }, this.calloutClassName = () => {
110
- switch (this.props.position) {
111
- case "bottom":
112
- return "k-callout k-callout-n";
113
- case "left":
114
- return "k-callout k-callout-e";
115
- case "right":
116
- return "k-callout k-callout-w";
117
- case "top":
118
- return "k-callout k-callout-s";
119
- default:
120
- return this.top < window.innerHeight / 2 ? "k-callout k-callout-n" : "k-callout k-callout-s";
121
- }
122
- }, this.getCurrentZIndex = () => this.context ? this.context : rt, D(R);
123
- }
124
- /**
125
- * @hidden
126
- */
127
- componentDidMount() {
128
- document && document.body.addEventListener("mousemove", this.handleBodyMousemove);
129
- }
130
- /**
131
- * @hidden
132
- */
133
- componentWillUnmount() {
134
- clearTimeout(this.openTimeoutId), clearInterval(this.updateIntervalId), document && document.body.removeEventListener("mousemove", this.handleBodyMousemove);
135
- }
136
- /**
137
- * @hidden
138
- */
139
- componentDidUpdate() {
140
- this.props.open && this.props.targetElement && this.showToolTip({ target: this.props.targetElement });
141
- }
142
- /**
143
- * @hidden
144
- */
145
- render() {
146
- if (this.props.children) {
147
- const { children: e, ...i } = this.props;
148
- let r = null;
149
- return /* @__PURE__ */ s.createElement(
150
- "div",
151
- {
152
- onMouseOver: (a) => {
153
- r && r.handleMouseOver(a);
154
- },
155
- onMouseOut: (a) => {
156
- r && r.handleMouseOut(a);
157
- }
158
- },
159
- /* @__PURE__ */ s.createElement(A, { ref: (a) => r = a, ...i }),
160
- e
161
- );
162
- }
163
- if (this.props.open === !1)
164
- return null;
165
- const { targetElement: o } = this.state, t = this.getCurrentZIndex();
166
- return o && this.state.title && o.ownerDocument && tt.createPortal(
167
- /* @__PURE__ */ s.createElement(
168
- "div",
169
- {
170
- ref: (e) => {
171
- if (!e)
172
- return;
173
- let i;
174
- if (this.props.onPosition) {
175
- const r = {
176
- element: e,
177
- targetElement: this.state.targetElement,
178
- mouseTop: this.top,
179
- mouseLeft: this.left,
180
- anchorElement: this.props.anchorElement,
181
- position: this.props.position,
182
- target: this,
183
- syntheticEvent: null,
184
- nativeEvent: null
185
- };
186
- i = this.props.onPosition.call(void 0, r);
187
- } else
188
- i = this.position(e);
189
- e.style.left = i.left + "px", e.style.top = i.top + "px";
190
- },
191
- className: m(
192
- "k-animation-container",
193
- "k-animation-container-fixed",
194
- "k-animation-container-shown",
195
- this.props.className
196
- ),
197
- style: {
198
- zIndex: t,
199
- ...this.props.style
200
- },
201
- tabIndex: 0
202
- },
203
- /* @__PURE__ */ s.createElement("div", { className: "k-child-animation-container" }, /* @__PURE__ */ s.createElement(
204
- "div",
205
- {
206
- id: this.props.id,
207
- role: "tooltip",
208
- className: m(
209
- "k-tooltip",
210
- this.props.tooltipClassName
211
- ),
212
- style: { position: "relative", ...this.props.tooltipStyle }
213
- },
214
- /* @__PURE__ */ s.createElement("div", { className: "k-tooltip-content" }, this.props.content && /* @__PURE__ */ s.createElement(this.props.content, { title: this.state.title, target: this.state.targetElement }) || this.state.title),
215
- this.props.showCallout && /* @__PURE__ */ s.createElement(
216
- "div",
217
- {
218
- ref: (e) => {
219
- e && (e.className = this.calloutClassName(), this.props.position === "auto" && (this.left < window.screen.availWidth / 2 ? e.style.left = this.props.setCalloutOnPositionAuto || "25%" : e.style.left = this.props.setCalloutOnPositionAuto || "75%"));
220
- }
221
- }
222
- )
223
- ))
224
- ),
225
- this.props.appendTo ? this.props.appendTo : o.ownerDocument.body
226
- );
227
- }
228
- showToolTip(o) {
229
- clearTimeout(this.openTimeoutId), clearInterval(this.updateIntervalId), o.target.hasChildNodes() && o.target.childNodes.forEach((i) => {
230
- i.nodeName === "title" && (o.target.titleExpando = i.innerHTML, i.remove());
231
- });
232
- const t = this.props.targetElement || o.target;
233
- let e = this.getTitle(t);
234
- if (!e.title) {
235
- this.state.open && this.onClose(o);
236
- return;
237
- }
238
- e.element && (e.element.titleExpando = e.title, e.element.title = ""), this.willOpen = !0, this.props.openDelay ? this.openTimeoutId = window.setTimeout(
239
- () => {
240
- this.willOpen && this.setState({ targetElement: t, open: !0, title: e.title }, this.setUpdateInterval);
241
- },
242
- this.props.openDelay
243
- ) : this.setState({ targetElement: t, open: !0, title: e.title }, this.setUpdateInterval), this.state.title !== e.title && P(this.props.onOpen, o, this, void 0);
244
- }
245
- isVisible(o) {
246
- return !this.props.filter || this.props.filter(o);
247
- }
248
- };
249
- let T = A;
250
- T.propTypes = {
251
- anchorElement: n.oneOf(["pointer", "target"]),
252
- content: n.func,
253
- filter: n.func,
254
- openDelay: n.number,
255
- position: n.oneOf(["right", "left", "top", "bottom", "auto"]),
256
- updateInterval: n.number
257
- };
258
- T.defaultProps = {
259
- anchorElement: "pointer",
260
- openDelay: 400,
261
- position: "auto",
262
- showCallout: !0,
263
- parentTitle: !1
264
- };
265
- T.contextType = k;
266
- const d = s.forwardRef((o, t) => {
267
- const e = s.useRef(null), i = s.useRef(null);
268
- return s.useImperativeHandle(i, () => ({ props: o, element: e.current })), s.useImperativeHandle(t, () => i.current), /* @__PURE__ */ s.createElement(
269
- "div",
270
- {
271
- ref: e,
272
- className: m(
273
- "k-popover-actions",
274
- "k-actions",
275
- {
276
- [`k-actions-${o.alignment}`]: o.alignment,
277
- [`k-actions-${o.orientation}`]: o.orientation
278
- }
279
- )
280
- },
281
- o.children
282
- );
283
- }), lt = {
284
- alignment: "stretched",
285
- orientation: "horizontal"
286
- };
287
- d.propTypes = {
288
- alignment: n.oneOf(["start", "center", "end", "stretched"]),
289
- orientation: n.oneOf(["horizontal", "vertical"]),
290
- children: n.oneOfType([
291
- n.element,
292
- n.node
293
- ])
294
- };
295
- d.defaultProps = lt;
296
- d.displayName = "KendoReactPopoverActionsBar";
297
- const at = 12e3, pt = 2e3, x = 15, ct = {
298
- top: "k-callout-s",
299
- left: "k-callout-e",
300
- bottom: "k-callout-n",
301
- right: "k-callout-w"
302
- }, ut = {
303
- top: "k-callout-n",
304
- left: "k-callout-w",
305
- bottom: "k-callout-s",
306
- right: "k-callout-e"
307
- }, ht = {
308
- top: { vertical: "bottom", horizontal: "center" },
309
- left: { vertical: "center", horizontal: "right" },
310
- bottom: { vertical: "top", horizontal: "center" },
311
- right: { vertical: "center", horizontal: "left" }
312
- }, dt = {
313
- top: { vertical: "top", horizontal: "center" },
314
- left: { vertical: "center", horizontal: "left" },
315
- bottom: { vertical: "bottom", horizontal: "center" },
316
- right: { vertical: "center", horizontal: "right" }
317
- }, ft = (o) => s.Children.toArray(o).filter((t) => t && t.type === d), mt = (o) => s.Children.toArray(o).filter((t) => t && t.type !== d), w = s.forwardRef((o, t) => {
318
- D(R);
319
- const {
320
- callout: e,
321
- position: i,
322
- title: r,
323
- children: a,
324
- show: M,
325
- anchor: z,
326
- appendTo: L,
327
- offset: U,
328
- animate: B,
329
- positionMode: S,
330
- scale: Z,
331
- popoverClass: c,
332
- className: _,
333
- id: F,
334
- style: K,
335
- collision: V,
336
- contentStyle: b,
337
- onPosition: v,
338
- onClose: g,
339
- onOpen: y
340
- } = o, [j, E] = s.useState(!1), I = i === "top" || i === "bottom", X = o.margin || {
341
- vertical: e && I ? x : 0,
342
- horizontal: e && !I ? x : 0
343
- }, H = ht[i], $ = dt[i], O = s.useContext(k), Y = O ? O + pt : at, h = s.useRef(null);
344
- s.useImperativeHandle(h, () => ({ props: o })), s.useImperativeHandle(t, () => h.current);
345
- const q = s.useCallback(
346
- (l) => {
347
- if (setTimeout(() => E(l.flipped)), v) {
348
- const W = { target: h.current, flipped: l.flipped, fitted: l.fitted };
349
- v.call(void 0, W);
350
- }
351
- },
352
- [v, E]
353
- ), G = s.useCallback(
354
- () => {
355
- if (y) {
356
- const l = { target: h.current };
357
- y.call(void 0, l);
358
- }
359
- },
360
- [y]
361
- ), J = s.useCallback(
362
- () => {
363
- if (g) {
364
- const l = { target: h.current };
365
- g.call(void 0, l);
366
- }
367
- },
368
- [g]
369
- ), f = { "k-popover": !0 };
370
- Array.isArray(c) ? c.forEach((l) => f[l] = !0) : typeof c == "object" ? Object.keys(c).forEach((l) => {
371
- f[l] = c[l];
372
- }) : c && (f[c] = !0);
373
- const Q = j ? ut[i] : ct[i], C = s.useMemo(
374
- () => /* @__PURE__ */ s.createElement(s.Fragment, null, r && /* @__PURE__ */ s.createElement("div", { className: "k-popover-header" }, r), /* @__PURE__ */ s.createElement("div", { className: "k-popover-body", style: b }, mt(a)), ft(a)),
375
- [a, b, r]
376
- );
377
- return /* @__PURE__ */ s.createElement(k.Provider, { value: Y }, /* @__PURE__ */ s.createElement(
378
- et,
379
- {
380
- id: F,
381
- role: "tooltip",
382
- animate: B,
383
- collision: V,
384
- anchor: z,
385
- offset: U,
386
- margin: X,
387
- popupAlign: H,
388
- anchorAlign: $,
389
- appendTo: L,
390
- show: M,
391
- scale: Z,
392
- positionMode: S,
393
- style: K,
394
- className: _,
395
- popupClass: f,
396
- onOpen: G,
397
- onClose: J,
398
- onPosition: q
399
- },
400
- e && i ? /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", { className: m("k-popover-callout", Q) }), /* @__PURE__ */ s.createElement("div", { className: "k-popover-inner" }, C)) : C
401
- ));
402
- }), vt = {
403
- callout: !0,
404
- position: "top",
405
- collision: {
406
- horizontal: "none",
407
- vertical: "none"
408
- }
409
- };
410
- w.propTypes = {
411
- callout: n.bool,
412
- title: n.node,
413
- position: n.oneOf(["top", "left", "bottom", "right"]),
414
- show: n.bool,
415
- animate: n.oneOfType([
416
- n.bool,
417
- n.shape({
418
- openDuration: n.number,
419
- closeDuration: n.number
420
- })
421
- ]),
422
- anchor: function(o) {
423
- const t = o.anchor;
424
- return t && typeof t.nodeType != "number" ? new Error(
425
- "Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."
426
- ) : null;
427
- },
428
- appendTo: function(o) {
429
- const t = o.appendTo;
430
- return t && typeof t.nodeType != "number" ? new Error(
431
- "Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."
432
- ) : null;
433
- },
434
- positionMode: n.oneOf([
435
- "fixed",
436
- "absolute"
437
- ]),
438
- scale: n.number,
439
- offset: n.shape({
440
- left: n.number,
441
- top: n.number
442
- }),
443
- children: n.oneOfType([
444
- n.element,
445
- n.node
446
- ]),
447
- className: n.oneOfType([
448
- n.string,
449
- n.arrayOf(n.string),
450
- n.object
451
- ]),
452
- id: n.string,
453
- popoverClass: n.oneOfType([
454
- n.string,
455
- n.arrayOf(n.string),
456
- n.object
457
- ]),
458
- style: n.object,
459
- onClose: n.func,
460
- onPosition: n.func,
461
- onOpen: n.func
462
- };
463
- w.defaultProps = vt;
464
- w.displayName = "KendoReactPopover";
9
+ import { Tooltip as e } from "./tooltip/Tooltip.mjs";
10
+ import { Popover as t } from "./popover/Popover.mjs";
11
+ import { PopoverActionsBar as i } from "./popover/PopoverActionsBar.mjs";
465
12
  export {
466
- w as Popover,
467
- d as PopoverActionsBar,
468
- T as Tooltip
13
+ t as Popover,
14
+ i as PopoverActionsBar,
15
+ e as Tooltip
469
16
  };
@@ -0,0 +1,8 @@
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 e={name:"@progress/kendo-react-tooltip",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -0,0 +1,19 @@
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";
9
+ const e = {
10
+ name: "@progress/kendo-react-tooltip",
11
+ productName: "KendoReact",
12
+ productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
+ publishDate: 1709715783,
14
+ version: "",
15
+ licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
+ };
17
+ export {
18
+ e as packageMetadata
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-tooltip",
3
- "version": "7.2.4-develop.3",
3
+ "version": "7.3.0-develop.1",
4
4
  "description": "React Tooltips library represents popups with information that is related to a UI element. KendoReact Tooltips package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -23,8 +23,8 @@
23
23
  "sideEffects": false,
24
24
  "peerDependencies": {
25
25
  "@progress/kendo-licensing": "^1.3.4",
26
- "@progress/kendo-react-common": "7.2.4-develop.3",
27
- "@progress/kendo-react-popup": "7.2.4-develop.3",
26
+ "@progress/kendo-react-common": "7.3.0-develop.1",
27
+ "@progress/kendo-react-popup": "7.3.0-develop.1",
28
28
  "@progress/kendo-svg-icons": "^2.1.0",
29
29
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0",
30
30
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
@@ -0,0 +1,8 @@
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 H=require("react"),e=require("prop-types"),p=require("@progress/kendo-react-common"),U=require("../package-metadata.js"),X=require("@progress/kendo-react-popup"),C=require("./PopoverActionsBar.js");function G(o){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const l in o)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(n,l,a.get?a:{enumerable:!0,get:()=>o[l]})}}return n.default=o,Object.freeze(n)}const t=G(H),J=12e3,Q=2e3,k=15,W={top:"k-callout-s",left:"k-callout-e",bottom:"k-callout-n",right:"k-callout-w"},Y={top:"k-callout-n",left:"k-callout-w",bottom:"k-callout-s",right:"k-callout-e"},$={top:{vertical:"bottom",horizontal:"center"},left:{vertical:"center",horizontal:"right"},bottom:{vertical:"top",horizontal:"center"},right:{vertical:"center",horizontal:"left"}},ee={top:{vertical:"top",horizontal:"center"},left:{vertical:"center",horizontal:"left"},bottom:{vertical:"bottom",horizontal:"center"},right:{vertical:"center",horizontal:"right"}},te=o=>t.Children.toArray(o).filter(n=>n&&n.type===C.PopoverActionsBar),oe=o=>t.Children.toArray(o).filter(n=>n&&n.type!==C.PopoverActionsBar),u=t.forwardRef((o,n)=>{p.validatePackage(U.packageMetadata);const{callout:l,position:a,title:d,children:f,show:E,anchor:T,appendTo:A,offset:z,animate:R,positionMode:N,scale:j,popoverClass:c,className:x,id:I,style:w,collision:S,contentStyle:h,onPosition:m,onClose:v,onOpen:b}=o,[_,g]=t.useState(!1),y=a==="top"||a==="bottom",D=o.margin||{vertical:l&&y?k:0,horizontal:l&&!y?k:0},M=$[a],q=ee[a],P=t.useContext(p.ZIndexContext),B=P?P+Q:J,i=t.useRef(null);t.useImperativeHandle(i,()=>({props:o})),t.useImperativeHandle(n,()=>i.current);const Z=t.useCallback(r=>{if(setTimeout(()=>g(r.flipped)),m){const L={target:i.current,flipped:r.flipped,fitted:r.fitted};m.call(void 0,L)}},[m,g]),F=t.useCallback(()=>{if(b){const r={target:i.current};b.call(void 0,r)}},[b]),V=t.useCallback(()=>{if(v){const r={target:i.current};v.call(void 0,r)}},[v]),s={"k-popover":!0};Array.isArray(c)?c.forEach(r=>s[r]=!0):typeof c=="object"?Object.keys(c).forEach(r=>{s[r]=c[r]}):c&&(s[c]=!0);const K=_?Y[a]:W[a],O=t.useMemo(()=>t.createElement(t.Fragment,null,d&&t.createElement("div",{className:"k-popover-header"},d),t.createElement("div",{className:"k-popover-body",style:h},oe(f)),te(f)),[f,h,d]);return t.createElement(p.ZIndexContext.Provider,{value:B},t.createElement(X.Popup,{id:I,role:"tooltip",animate:R,collision:S,anchor:T,offset:z,margin:D,popupAlign:M,anchorAlign:q,appendTo:A,show:E,scale:j,positionMode:N,style:w,className:x,popupClass:s,onOpen:F,onClose:V,onPosition:Z},l&&a?t.createElement(t.Fragment,null,t.createElement("div",{className:p.classNames("k-popover-callout",K)}),t.createElement("div",{className:"k-popover-inner"},O)):O))}),ne={callout:!0,position:"top",collision:{horizontal:"none",vertical:"none"}};u.propTypes={callout:e.bool,title:e.node,position:e.oneOf(["top","left","bottom","right"]),show:e.bool,animate:e.oneOfType([e.bool,e.shape({openDuration:e.number,closeDuration:e.number})]),anchor:function(o){const n=o.anchor;return n&&typeof n.nodeType!="number"?new Error("Invalid prop `anchor` supplied to `Kendo React Popover`. Validation failed."):null},appendTo:function(o){const n=o.appendTo;return n&&typeof n.nodeType!="number"?new Error("Invalid prop `appendTo` supplied to `Kendo React Popover`. Validation failed."):null},positionMode:e.oneOf(["fixed","absolute"]),scale:e.number,offset:e.shape({left:e.number,top:e.number}),children:e.oneOfType([e.element,e.node]),className:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),id:e.string,popoverClass:e.oneOfType([e.string,e.arrayOf(e.string),e.object]),style:e.object,onClose:e.func,onPosition:e.func,onOpen:e.func};u.defaultProps=ne;u.displayName="KendoReactPopover";exports.Popover=u;