@progress/kendo-react-dialogs 6.1.1-dev.202311151536 → 7.0.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 (88) hide show
  1. package/{dist/es/Dialog.d.ts → Dialog.d.ts} +6 -2
  2. package/{dist/npm/DialogActionsBar.d.ts → DialogActionsBar.d.ts} +4 -0
  3. package/{dist/es/DialogProps.d.ts → DialogProps.d.ts} +4 -1
  4. package/{dist/es/DialogTitleBar.d.ts → DialogTitleBar.d.ts} +4 -0
  5. package/LICENSE.md +1 -1
  6. package/{dist/es/MiddleLayerOptimization.d.ts → MiddleLayerOptimization.d.ts} +4 -0
  7. package/StageEnum.d.ts +9 -0
  8. package/{dist/es/Window.d.ts → Window.d.ts} +6 -2
  9. package/{dist/npm/WindowActionsBar.d.ts → WindowActionsBar.d.ts} +4 -0
  10. package/{dist/npm/WindowProps.d.ts → WindowProps.d.ts} +4 -1
  11. package/WindowResizeHandlers.d.ts +20 -0
  12. package/{dist/npm/WindowTitlebar.d.ts → WindowTitlebar.d.ts} +4 -0
  13. package/constants.d.ts +12 -0
  14. package/dist/cdn/js/kendo-react-dialogs.js +5 -1
  15. package/{dist/npm/events.d.ts → events.d.ts} +4 -0
  16. package/index.d.ts +13 -0
  17. package/index.js +5 -0
  18. package/index.mjs +677 -0
  19. package/{dist/npm/messages → messages}/index.d.ts +4 -0
  20. package/models/actions-layout.d.ts +8 -0
  21. package/package-metadata.d.ts +9 -0
  22. package/package.json +28 -36
  23. package/utils.d.ts +6 -0
  24. package/about.md +0 -3
  25. package/dist/es/Dialog.js +0 -203
  26. package/dist/es/DialogActionsBar.d.ts +0 -21
  27. package/dist/es/DialogActionsBar.js +0 -32
  28. package/dist/es/DialogProps.js +0 -3
  29. package/dist/es/DialogTitleBar.js +0 -13
  30. package/dist/es/MiddleLayerOptimization.js +0 -33
  31. package/dist/es/StageEnum.d.ts +0 -5
  32. package/dist/es/StageEnum.js +0 -6
  33. package/dist/es/Window.js +0 -643
  34. package/dist/es/WindowActionsBar.d.ts +0 -21
  35. package/dist/es/WindowActionsBar.js +0 -34
  36. package/dist/es/WindowProps.d.ts +0 -144
  37. package/dist/es/WindowProps.js +0 -2
  38. package/dist/es/WindowResizeHandlers.d.ts +0 -16
  39. package/dist/es/WindowResizeHandlers.js +0 -49
  40. package/dist/es/WindowTitlebar.d.ts +0 -63
  41. package/dist/es/WindowTitlebar.js +0 -47
  42. package/dist/es/constants.d.ts +0 -8
  43. package/dist/es/constants.js +0 -8
  44. package/dist/es/events.d.ts +0 -45
  45. package/dist/es/events.js +0 -2
  46. package/dist/es/main.d.ts +0 -9
  47. package/dist/es/main.js +0 -5
  48. package/dist/es/messages/index.d.ts +0 -25
  49. package/dist/es/messages/index.js +0 -26
  50. package/dist/es/models/actions-layout.d.ts +0 -4
  51. package/dist/es/models/actions-layout.js +0 -1
  52. package/dist/es/package-metadata.d.ts +0 -5
  53. package/dist/es/package-metadata.js +0 -11
  54. package/dist/es/utils.d.ts +0 -2
  55. package/dist/es/utils.js +0 -22
  56. package/dist/npm/Dialog.d.ts +0 -90
  57. package/dist/npm/Dialog.js +0 -206
  58. package/dist/npm/DialogActionsBar.js +0 -36
  59. package/dist/npm/DialogProps.d.ts +0 -74
  60. package/dist/npm/DialogProps.js +0 -4
  61. package/dist/npm/DialogTitleBar.d.ts +0 -26
  62. package/dist/npm/DialogTitleBar.js +0 -17
  63. package/dist/npm/MiddleLayerOptimization.d.ts +0 -17
  64. package/dist/npm/MiddleLayerOptimization.js +0 -36
  65. package/dist/npm/StageEnum.d.ts +0 -5
  66. package/dist/npm/StageEnum.js +0 -9
  67. package/dist/npm/Window.d.ts +0 -174
  68. package/dist/npm/Window.js +0 -646
  69. package/dist/npm/WindowActionsBar.js +0 -38
  70. package/dist/npm/WindowProps.js +0 -3
  71. package/dist/npm/WindowResizeHandlers.d.ts +0 -16
  72. package/dist/npm/WindowResizeHandlers.js +0 -52
  73. package/dist/npm/WindowTitlebar.js +0 -50
  74. package/dist/npm/constants.d.ts +0 -8
  75. package/dist/npm/constants.js +0 -11
  76. package/dist/npm/events.js +0 -3
  77. package/dist/npm/main.d.ts +0 -9
  78. package/dist/npm/main.js +0 -13
  79. package/dist/npm/messages/index.js +0 -29
  80. package/dist/npm/models/actions-layout.d.ts +0 -4
  81. package/dist/npm/models/actions-layout.js +0 -2
  82. package/dist/npm/package-metadata.d.ts +0 -5
  83. package/dist/npm/package-metadata.js +0 -14
  84. package/dist/npm/utils.d.ts +0 -2
  85. package/dist/npm/utils.js +0 -26
  86. package/dist/systemjs/kendo-react-dialogs.js +0 -1
  87. package/e2e-next/dialog.basic.tests.ts +0 -24
  88. package/e2e-next/window.basic.tests.ts +0 -24
package/index.mjs ADDED
@@ -0,0 +1,677 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as o from "react";
6
+ import * as P from "react-dom";
7
+ import * as n from "prop-types";
8
+ import { Button as D } from "@progress/kendo-react-buttons";
9
+ import { xIcon as K, windowMinimizeIcon as et, windowIcon as it, windowRestoreIcon as ot } from "@progress/kendo-svg-icons";
10
+ import { classNames as x, ZIndexContext as L, createPropsContext as j, withPropsContext as G, guid as X, dispatchEvent as m, Keys as p, getActiveElement as st, validatePackage as V, shouldShowValidationUI as Y, WatermarkOverlay as $, canUseDOM as q, Draggable as J } from "@progress/kendo-react-common";
11
+ import { useLocalization as nt } from "@progress/kendo-react-intl";
12
+ const at = ({ children: r, onCloseButtonClick: i, id: t, closeIcon: e }) => /* @__PURE__ */ o.createElement("div", { className: "k-window-titlebar k-dialog-titlebar", id: t }, /* @__PURE__ */ o.createElement("span", { className: "k-window-title k-dialog-title" }, r), /* @__PURE__ */ o.createElement("div", { className: "k-window-titlebar-actions k-dialog-titlebar-actions" }, e && /* @__PURE__ */ o.createElement(
13
+ D,
14
+ {
15
+ role: "button",
16
+ "aria-label": "Close",
17
+ onClick: i,
18
+ icon: "x",
19
+ svgIcon: K,
20
+ fillMode: "flat",
21
+ className: "k-window-titlebar-action k-dialog-titlebar-action"
22
+ }
23
+ ))), W = (r) => {
24
+ const i = {
25
+ layout: "stretched",
26
+ ...r
27
+ }, { layout: t, children: e } = i, s = x(
28
+ "k-actions",
29
+ "k-actions-horizontal",
30
+ "k-window-actions k-dialog-actions",
31
+ {
32
+ [`k-actions-${t}`]: t
33
+ }
34
+ );
35
+ return /* @__PURE__ */ o.createElement("div", { className: s }, e);
36
+ };
37
+ W.propTypes = {
38
+ children: n.any,
39
+ layout: n.oneOf(["start", "center", "end", "stretched"])
40
+ };
41
+ const y = {
42
+ name: "@progress/kendo-react-dialogs",
43
+ productName: "KendoReact",
44
+ productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
45
+ publishDate: 1700493744,
46
+ version: "",
47
+ licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
48
+ }, U = "data-windowid", Q = 10002, S = 2, rt = ".k-window:not(.k-dialog), .k-dialog-wrapper", B = (r, i, t) => {
49
+ let e = r;
50
+ if (i && i.defaultView) {
51
+ let s = i.querySelectorAll(rt), l = !1;
52
+ return s.forEach((d) => {
53
+ let h = i.defaultView.getComputedStyle(d, null);
54
+ if (d.getAttribute(U) !== t && h.zIndex !== null) {
55
+ let c = parseInt(h.zIndex, 10);
56
+ c >= e && (e = c, l = !0);
57
+ }
58
+ }), l ? e + S : e;
59
+ }
60
+ return e;
61
+ };
62
+ class b extends o.Component {
63
+ constructor(i) {
64
+ super(i), this.context = 0, this._id = X(), this.titleId = this.generateTitleId(), this.contentId = this.generateContentId(), this.showLicenseWatermark = !1, this.onCloseDialog = (t) => {
65
+ t.preventDefault(), m(this.props.onClose, t, this, void 0);
66
+ }, this.onKeyDown = (t) => {
67
+ t.keyCode === p.esc && this.props.onClose && (t.preventDefault(), this.onCloseDialog(t));
68
+ const e = this.element;
69
+ if (e && t.keyCode === p.tab) {
70
+ const s = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', l = e.querySelectorAll(s), d = l[0], h = l[l.length - 1], g = this.getDocument(), c = st(g);
71
+ t.shiftKey ? (g && c === d || g && c === this.element) && (h.focus(), t.preventDefault()) : g && c === h && (d.focus(), t.preventDefault());
72
+ }
73
+ }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : Q : this.state.zIndex > (this.context ? this.context + S : 0) ? this.state.zIndex : this.context + S, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, V(y), this.showLicenseWatermark = Y(y), this.state = {
74
+ zIndex: B(this.getCurrentZIndex(), this.getDocument(), this._id)
75
+ };
76
+ }
77
+ /**
78
+ * @hidden
79
+ */
80
+ componentDidMount() {
81
+ this.element && this.props.autoFocus && this.element.focus();
82
+ }
83
+ /**
84
+ * @hidden
85
+ */
86
+ render() {
87
+ const i = this.props.id !== void 0 ? this.props.id : this.titleId, { title: t, width: e, height: s, children: l, minWidth: d, dir: h, style: g, contentStyle: c } = this.props, f = o.Children.toArray(l), C = this.getContent(f), E = this.getActionBar(f), I = t ? {
88
+ "aria-labelledby": i
89
+ } : null, u = this.props.closeIcon !== void 0 ? this.props.closeIcon : !0, H = this.getCurrentZIndex(), _ = /* @__PURE__ */ o.createElement(L.Provider, { value: H }, /* @__PURE__ */ o.createElement(
90
+ "div",
91
+ {
92
+ [U]: this._id,
93
+ className: "k-dialog-wrapper" + (this.props.className ? " " + this.props.className : ""),
94
+ onKeyDown: this.onKeyDown,
95
+ tabIndex: 0,
96
+ dir: h,
97
+ style: {
98
+ zIndex: H,
99
+ ...g
100
+ },
101
+ ref: (tt) => this.element = tt
102
+ },
103
+ /* @__PURE__ */ o.createElement("div", { className: "k-overlay" }),
104
+ /* @__PURE__ */ o.createElement(
105
+ "div",
106
+ {
107
+ ...I,
108
+ className: x(
109
+ "k-window k-dialog",
110
+ {
111
+ [`k-window-${this.props.themeColor}`]: this.props.themeColor
112
+ }
113
+ ),
114
+ role: "dialog",
115
+ "aria-labelledby": i,
116
+ "aria-modal": !0,
117
+ "aria-describedby": this.contentId,
118
+ style: { width: e, height: s, minWidth: d }
119
+ },
120
+ this.props.title && /* @__PURE__ */ o.createElement(
121
+ at,
122
+ {
123
+ closeIcon: u,
124
+ onCloseButtonClick: this.onCloseDialog,
125
+ id: i
126
+ },
127
+ t
128
+ ),
129
+ /* @__PURE__ */ o.createElement("div", { className: "k-window-content k-dialog-content", style: c, id: this.contentId }, C),
130
+ E,
131
+ this.showLicenseWatermark && /* @__PURE__ */ o.createElement($, null)
132
+ )
133
+ ));
134
+ return q ? this.props.appendTo !== null ? P.createPortal(_, this.props.appendTo || document.body) : _ : null;
135
+ }
136
+ getActionBar(i) {
137
+ return i.filter((t) => t && t.type === W);
138
+ }
139
+ getContent(i) {
140
+ return i.filter((t) => t && t.type !== W);
141
+ }
142
+ generateTitleId() {
143
+ return "dialog-title" + this._id;
144
+ }
145
+ generateContentId() {
146
+ return "dialog-content" + this._id;
147
+ }
148
+ }
149
+ b.displayName = "Dialog";
150
+ b.propTypes = {
151
+ title: n.any,
152
+ id: n.string,
153
+ dir: n.string,
154
+ style: n.object,
155
+ closeIcon: n.bool,
156
+ width: n.oneOfType([n.number, n.string]),
157
+ height: n.oneOfType([n.number, n.string]),
158
+ minWidth: n.oneOfType([n.number, n.string]),
159
+ autoFocus: n.bool
160
+ };
161
+ b.defaultProps = {
162
+ autoFocus: !1
163
+ };
164
+ b.contextType = L;
165
+ const ht = j(), lt = G(ht, b);
166
+ lt.displayName = "KendoReactDialog";
167
+ var a = /* @__PURE__ */ ((r) => (r.DEFAULT = "DEFAULT", r.FULLSCREEN = "FULLSCREEN", r.MINIMIZED = "MINIMIZED", r))(a || {});
168
+ const v = "dialogs.windowMaximizeButton", N = "dialogs.windowMinimizeButton", z = "dialogs.windowRestoreButton", M = "dialogs.windowCloseButton", T = {
169
+ [v]: "maximize",
170
+ [N]: "minimize",
171
+ [z]: "restore",
172
+ [M]: "close"
173
+ }, dt = (r) => {
174
+ const {
175
+ children: i,
176
+ onCloseButtonClick: t,
177
+ onMinimizeButtonClick: e,
178
+ onFullScreenButtonClick: s,
179
+ onRestoreButtonClick: l,
180
+ onDoubleClick: d,
181
+ stage: h,
182
+ forwardedRef: g,
183
+ id: c
184
+ } = r, f = nt(), C = r.minimizeButton ? /* @__PURE__ */ o.createElement(r.minimizeButton, { onClick: e, stage: h }) : /* @__PURE__ */ o.createElement(
185
+ D,
186
+ {
187
+ fillMode: "flat",
188
+ icon: "window-minimize",
189
+ svgIcon: et,
190
+ className: "k-window-titlebar-action",
191
+ onClick: e,
192
+ "aria-label": f.toLanguageString(N, T[N])
193
+ }
194
+ ), E = r.maximizeButton ? /* @__PURE__ */ o.createElement(r.maximizeButton, { onClick: s, stage: h }) : /* @__PURE__ */ o.createElement(
195
+ D,
196
+ {
197
+ fillMode: "flat",
198
+ icon: "window-maximize",
199
+ svgIcon: it,
200
+ className: "k-window-titlebar-action",
201
+ onClick: s,
202
+ "aria-label": f.toLanguageString(v, T[v])
203
+ }
204
+ ), I = r.restoreButton ? /* @__PURE__ */ o.createElement(r.restoreButton, { onClick: l, stage: h }) : /* @__PURE__ */ o.createElement(
205
+ D,
206
+ {
207
+ fillMode: "flat",
208
+ icon: "window-restore",
209
+ svgIcon: ot,
210
+ className: "k-window-titlebar-action",
211
+ onClick: l,
212
+ "aria-label": f.toLanguageString(z, T[z])
213
+ }
214
+ ), u = r.closeButton ? /* @__PURE__ */ o.createElement(r.closeButton, { onClick: t, stage: h }) : /* @__PURE__ */ o.createElement(
215
+ D,
216
+ {
217
+ fillMode: "flat",
218
+ icon: "x",
219
+ svgIcon: K,
220
+ className: "k-window-titlebar-action",
221
+ onClick: t,
222
+ "aria-label": f.toLanguageString(M, T[M])
223
+ }
224
+ );
225
+ return /* @__PURE__ */ o.createElement(
226
+ "div",
227
+ {
228
+ className: "k-window-titlebar",
229
+ style: { touchAction: "none" },
230
+ ref: g,
231
+ onDoubleClick: d
232
+ },
233
+ /* @__PURE__ */ o.createElement("span", { className: "k-window-title", id: c }, i || ""),
234
+ /* @__PURE__ */ o.createElement("div", { className: "k-window-titlebar-actions" }, h === a.DEFAULT && C, h === a.DEFAULT && E, h !== a.DEFAULT && I, u)
235
+ );
236
+ }, ct = o.forwardRef((r, i) => /* @__PURE__ */ o.createElement(
237
+ dt,
238
+ {
239
+ ...r,
240
+ forwardedRef: i
241
+ }
242
+ )), pt = ["n", "e", "s", "w", "se", "sw", "ne", "nw"];
243
+ class gt extends o.Component {
244
+ render() {
245
+ return /* @__PURE__ */ o.createElement("div", { className: "k-resize-handles-wrapper" }, " ", pt.map((i, t) => /* @__PURE__ */ o.createElement(
246
+ J,
247
+ {
248
+ key: t,
249
+ onDrag: (e) => {
250
+ const { event: s } = e;
251
+ s.originalEvent.preventDefault(), this.props.onResize(s, { end: !1, direction: i });
252
+ },
253
+ onRelease: (e) => {
254
+ const { event: s } = e;
255
+ s.originalEvent.preventDefault(), this.props.onResize(s, { end: !0, direction: i });
256
+ }
257
+ },
258
+ /* @__PURE__ */ o.createElement(
259
+ "div",
260
+ {
261
+ className: "k-resize-handle k-resize-" + i,
262
+ style: { display: "block", touchAction: "none" }
263
+ }
264
+ )
265
+ )));
266
+ }
267
+ }
268
+ class ut extends o.Component {
269
+ shouldComponentUpdate(i) {
270
+ return i.shouldUpdateOnDrag || !i.isDragging;
271
+ }
272
+ render() {
273
+ return this.props.children;
274
+ }
275
+ }
276
+ const A = (r) => {
277
+ const i = {
278
+ layout: "end",
279
+ ...r
280
+ }, { layout: t, children: e } = i, s = x(
281
+ "k-actions",
282
+ "k-window-actions",
283
+ "k-actions-horizontal",
284
+ "k-hstack",
285
+ {
286
+ "k-justify-content-start": t === "start",
287
+ "k-justify-content-center": t === "center",
288
+ "k-justify-content-end": t === "end",
289
+ "k-justify-content-stretch": t === "stretched"
290
+ }
291
+ );
292
+ return /* @__PURE__ */ o.createElement("div", { className: s }, e);
293
+ };
294
+ A.propTypes = {
295
+ children: n.any,
296
+ layout: n.oneOf(["start", "center", "end", "stretched"])
297
+ };
298
+ const O = 300, Z = 300, R = 120, F = 100, w = 5;
299
+ class k extends o.Component {
300
+ constructor(i) {
301
+ super(i), this.context = 0, this.draggable = null, this.offSetCoordinates = { x: 0, y: 0 }, this._id = X(), this.titleId = this.generateTitleId(), this.mounted = !1, this.showLicenseWatermark = !1, this.onKeyDown = (t) => {
302
+ if (t.target !== t.currentTarget)
303
+ return;
304
+ const e = this.props.minWidth || R, s = this.props.minHeight || F;
305
+ if (t.ctrlKey && this.props.resizable) {
306
+ switch (t.keyCode) {
307
+ case p.up:
308
+ t.preventDefault(), s <= this.height - w && this.setState({ height: this.height - w });
309
+ break;
310
+ case p.down:
311
+ t.preventDefault(), this.setState({ height: this.height + w });
312
+ break;
313
+ case p.left:
314
+ e <= this.width - w && this.setState({ width: this.width - w });
315
+ break;
316
+ case p.right:
317
+ this.setState({ width: this.width + w });
318
+ break;
319
+ default:
320
+ return;
321
+ }
322
+ this.dispatchMoveEvent(this.props.onResize, t, !1, void 0);
323
+ return;
324
+ }
325
+ if (t.altKey) {
326
+ switch (t.keyCode) {
327
+ case p.up:
328
+ this.windowStage === a.MINIMIZED ? (this.handleRestore(t), m(this.props.onStageChange, t, this, { state: a.DEFAULT })) : this.windowStage === a.DEFAULT && (this.handleFullscreen(t), m(this.props.onStageChange, t, this, { state: a.FULLSCREEN }));
329
+ break;
330
+ case p.down:
331
+ this.windowStage === a.FULLSCREEN ? (this.handleRestore(t), m(this.props.onStageChange, t, this, { state: a.DEFAULT })) : this.windowStage === a.DEFAULT && (this.handleMinimize(t), m(this.props.onStageChange, t, this, { state: a.MINIMIZED }));
332
+ break;
333
+ }
334
+ return;
335
+ }
336
+ if (!t.ctrlKey)
337
+ switch (t.keyCode) {
338
+ case p.esc:
339
+ this.props.onClose && this.handleCloseWindow(t);
340
+ return;
341
+ case p.up:
342
+ this.setState({ top: this.state.top - w });
343
+ break;
344
+ case p.down:
345
+ this.setState({ top: this.state.top + w });
346
+ break;
347
+ case p.left:
348
+ this.setState({ left: this.state.left - w });
349
+ break;
350
+ case p.right:
351
+ this.setState({ left: this.state.left + w });
352
+ break;
353
+ default:
354
+ return;
355
+ }
356
+ this.dispatchMoveEvent(this.props.onMove, t, !1, void 0);
357
+ }, this.onPress = (t) => {
358
+ const e = t.event;
359
+ this.windowCoordinatesState.differenceLeft = e.pageX - this.left, this.windowCoordinatesState.differenceTop = e.pageY - this.top;
360
+ }, this.onDrag = (t) => {
361
+ const e = t.event;
362
+ e.originalEvent.preventDefault(), this.windowStage !== a.FULLSCREEN && this.props.draggable && (this.setState({
363
+ top: Math.max(e.pageY - this.windowCoordinatesState.differenceTop, 0),
364
+ left: e.pageX - this.windowCoordinatesState.differenceLeft,
365
+ isDragging: !0
366
+ }), this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !1));
367
+ }, this.onRelease = (t) => {
368
+ const e = t.event;
369
+ this.windowStage !== a.FULLSCREEN && this.props.draggable && this.props.onMove && this.dispatchMoveEvent(this.props.onMove, e, !0, !0), this.setState({
370
+ isDragging: !1
371
+ });
372
+ }, this.onFocus = () => {
373
+ this._blurTimeout ? (clearTimeout(this._blurTimeout), this._blurTimeout = void 0) : this.setState({
374
+ focused: !0,
375
+ zIndex: B(this.getCurrentZIndex(), this.getDocument(), this._id)
376
+ });
377
+ }, this.onBlur = () => {
378
+ clearTimeout(this._blurTimeout);
379
+ const t = this.getWindow();
380
+ t && (this._blurTimeout = t.setTimeout(() => {
381
+ this.mounted && this.setState({ focused: !1 }), this._blurTimeout = void 0;
382
+ }));
383
+ }, this.getInitialTop = () => {
384
+ if (this.props.top !== void 0)
385
+ return this.props.top;
386
+ if (this.props.initialTop !== void 0)
387
+ return this.props.initialTop;
388
+ let t = Z;
389
+ if (this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), this.props.appendTo)
390
+ return this.props.appendTo.offsetHeight / 2 - t / 2;
391
+ const e = this.getWindow();
392
+ return e ? e.innerHeight / 2 - t / 2 : 0;
393
+ }, this.getInitialLeft = () => {
394
+ if (this.props.left !== void 0)
395
+ return this.props.left;
396
+ if (this.props.initialLeft !== void 0)
397
+ return this.props.initialLeft;
398
+ let t = O;
399
+ if (this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), this.props.appendTo)
400
+ return this.props.appendTo.offsetWidth / 2 - t / 2;
401
+ const e = this.getWindow();
402
+ return e ? e.innerWidth / 2 - t / 2 : 0;
403
+ }, this.getInitialWidth = () => {
404
+ let t = O;
405
+ return this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), t;
406
+ }, this.getInitialHeight = () => {
407
+ let t = Z;
408
+ return this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), t;
409
+ }, this.handleMinimize = (t) => {
410
+ t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height, this.setState({
411
+ stage: a.MINIMIZED,
412
+ height: 0
413
+ }), m(this.props.onStageChange, t, this, { state: a.MINIMIZED });
414
+ }, this.handleFullscreen = (t) => {
415
+ t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height;
416
+ const e = this.getWindow(), s = e ? e.innerWidth : 0, l = e ? e.innerHeight : 0;
417
+ this.setState({
418
+ left: 0,
419
+ top: 0,
420
+ width: this.props.appendTo ? this.props.appendTo.offsetWidth : s,
421
+ height: this.props.appendTo ? this.props.appendTo.offsetHeight : l,
422
+ stage: a.FULLSCREEN
423
+ }), m(this.props.onStageChange, t, this, { state: a.FULLSCREEN });
424
+ }, this.handleRestore = (t) => {
425
+ t.preventDefault(), this.windowStage === a.FULLSCREEN ? this.setState({
426
+ stage: a.DEFAULT,
427
+ left: this.windowCoordinatesState.leftBeforeAction,
428
+ top: this.windowCoordinatesState.topBeforeAction,
429
+ width: this.windowCoordinatesState.widthBeforeAction,
430
+ height: this.windowCoordinatesState.heightBeforeAction
431
+ }) : this.windowStage === a.MINIMIZED && this.setState({
432
+ stage: a.DEFAULT,
433
+ height: this.windowCoordinatesState.heightBeforeAction
434
+ }), m(this.props.onStageChange, t, this, { state: a.DEFAULT });
435
+ }, this.handleCloseWindow = (t) => {
436
+ t.preventDefault(), m(this.props.onClose, t, this, { state: void 0 });
437
+ }, this.handleDoubleClick = (t) => {
438
+ this.windowStage === a.FULLSCREEN || this.windowStage === a.MINIMIZED ? this.handleRestore(t) : this.handleFullscreen(t);
439
+ }, this.handleResize = (t, e) => {
440
+ const s = this.props.appendTo ? t.pageX - this.offSetCoordinates.x : t.pageX, l = this.props.appendTo ? t.pageY - this.offSetCoordinates.y : t.pageY, d = this.width, h = this.height, g = this.props.minWidth || R, c = this.props.minHeight || F, f = this.top - l, C = this.left - s;
441
+ let E = s - this.left, I = l - this.top;
442
+ const u = Object.assign({}, this.state, { isDragging: !e.end });
443
+ e.direction.indexOf("n") >= 0 && c - (h + f) < 0 && (this.top > 0 && (u.height = h + f), u.top = l), e.direction.indexOf("s") >= 0 && c - I < 0 && (u.height = I), e.direction.indexOf("w") >= 0 && g - (d + C) < 0 && (this.left > 0 && (u.width = d + C), u.left = s), e.direction.indexOf("e") >= 0 && g - E < 0 && (u.width = E), this.setState(u), this.dispatchMoveEvent(this.props.onResize, t, !0, e.end);
444
+ }, this.dispatchMoveEvent = (t, e, s, l) => {
445
+ t && t.call(void 0, {
446
+ nativeEvent: e.nativeEvent ? e.nativeEvent : e.originalEvent,
447
+ drag: s,
448
+ end: l,
449
+ target: this,
450
+ left: this.state.left,
451
+ top: this.state.top,
452
+ width: this.state.width,
453
+ hight: this.state.height,
454
+ height: this.state.height
455
+ });
456
+ }, this.handleBrowserWindowResize = () => {
457
+ if (this.windowStage === a.FULLSCREEN) {
458
+ const t = this.getWindow(), e = t ? t.innerWidth : 0, s = t ? t.innerHeight : 0;
459
+ this.setState({
460
+ width: this.props.appendTo ? this.props.appendTo.offsetWidth : e,
461
+ height: this.props.appendTo ? this.props.appendTo.offsetHeight : s
462
+ });
463
+ }
464
+ }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : Q : this.state.zIndex > (this.context ? this.context + S : 0) ? this.state.zIndex : this.context + S, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, this.getWindow = () => {
465
+ const t = this.getDocument();
466
+ return t && t.defaultView;
467
+ }, V(y), this.showLicenseWatermark = Y(y), this.state = {
468
+ stage: this.props.stage || a.DEFAULT,
469
+ isDragging: !1,
470
+ top: this.getInitialTop(),
471
+ left: this.getInitialLeft(),
472
+ width: this.getInitialWidth(),
473
+ height: this.getInitialHeight(),
474
+ focused: !0,
475
+ zIndex: B(this.getCurrentZIndex(), this.getDocument(), this._id)
476
+ }, this.windowCoordinatesState = {
477
+ leftBeforeAction: this.getInitialLeft(),
478
+ topBeforeAction: this.getInitialTop(),
479
+ widthBeforeAction: this.getInitialWidth(),
480
+ heightBeforeAction: this.getInitialHeight()
481
+ };
482
+ }
483
+ /**
484
+ * @hidden
485
+ */
486
+ componentDidMount() {
487
+ const i = this.getWindow();
488
+ i && i.addEventListener("resize", this.handleBrowserWindowResize);
489
+ const t = this.getDocument();
490
+ if (this.props.appendTo && t) {
491
+ let e = this.props.appendTo.getBoundingClientRect(), s = t.body.getBoundingClientRect();
492
+ this.offSetCoordinates.x = e.left - s.left, this.offSetCoordinates.y = e.top - s.top;
493
+ }
494
+ this.mounted = !0;
495
+ }
496
+ /**
497
+ * @hidden
498
+ */
499
+ componentWillUnmount() {
500
+ const i = this.getWindow();
501
+ i && i.removeEventListener("resize", this.handleBrowserWindowResize), this.mounted = !1;
502
+ }
503
+ /**
504
+ * @hidden
505
+ */
506
+ componentDidUpdate() {
507
+ const i = this.getDocument();
508
+ if (this.props.appendTo && i) {
509
+ let t = this.props.appendTo.getBoundingClientRect(), e = i.body.getBoundingClientRect();
510
+ this.offSetCoordinates.x = t.left - e.left, this.offSetCoordinates.y = t.top - e.top;
511
+ }
512
+ this.mounted = !0;
513
+ }
514
+ /**
515
+ * @hidden
516
+ */
517
+ render() {
518
+ const i = o.Children.toArray(this.props.children), t = this.getContent(i), e = this.getActionBar(i), s = this.getCurrentZIndex(), l = x(
519
+ "k-window",
520
+ this.props.className,
521
+ {
522
+ [`k-window-${this.props.themeColor}`]: this.props.themeColor,
523
+ "k-window-minimized": this.state.stage === "MINIMIZED",
524
+ "k-window-focused": this.state.focused
525
+ }
526
+ ), d = /* @__PURE__ */ o.createElement(L.Provider, { value: s }, /* @__PURE__ */ o.createElement(o.Fragment, null, this.props.modal && /* @__PURE__ */ o.createElement(
527
+ "div",
528
+ {
529
+ className: "k-overlay",
530
+ style: {
531
+ zIndex: s,
532
+ ...this.props.overlayStyle
533
+ }
534
+ }
535
+ ), /* @__PURE__ */ o.createElement(
536
+ "div",
537
+ {
538
+ [U]: this._id,
539
+ tabIndex: 0,
540
+ role: "dialog",
541
+ "aria-labelledby": this.titleId,
542
+ onFocus: this.onFocus,
543
+ onBlur: this.onBlur,
544
+ onKeyDown: this.onKeyDown,
545
+ ref: (h) => {
546
+ this.windowElement = h, this.element = h;
547
+ },
548
+ className: l,
549
+ style: {
550
+ top: this.top,
551
+ left: this.left,
552
+ width: this.width,
553
+ height: this.height || "",
554
+ zIndex: s,
555
+ ...this.props.style
556
+ }
557
+ },
558
+ /* @__PURE__ */ o.createElement(
559
+ ut,
560
+ {
561
+ shouldUpdateOnDrag: this.props.shouldUpdateOnDrag || !1,
562
+ isDragging: this.state.isDragging
563
+ },
564
+ /* @__PURE__ */ o.createElement(
565
+ J,
566
+ {
567
+ onPress: this.onPress,
568
+ onDrag: this.onDrag,
569
+ onRelease: this.onRelease,
570
+ ref: (h) => this.draggable = h
571
+ },
572
+ /* @__PURE__ */ o.createElement(
573
+ ct,
574
+ {
575
+ stage: this.windowStage,
576
+ onDoubleClick: this.props.doubleClickStageChange ? this.handleDoubleClick : void 0,
577
+ onMinimizeButtonClick: this.handleMinimize,
578
+ onFullScreenButtonClick: this.handleFullscreen,
579
+ onRestoreButtonClick: this.handleRestore,
580
+ onCloseButtonClick: this.handleCloseWindow,
581
+ closeButton: this.props.closeButton,
582
+ minimizeButton: this.props.minimizeButton,
583
+ maximizeButton: this.props.maximizeButton,
584
+ restoreButton: this.props.restoreButton,
585
+ id: this.titleId
586
+ },
587
+ this.props.title
588
+ )
589
+ ),
590
+ this.windowStage !== a.MINIMIZED ? /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", { className: "k-window-content" }, t), e) : null,
591
+ this.windowStage === a.DEFAULT && this.props.resizable ? /* @__PURE__ */ o.createElement(gt, { onResize: this.handleResize }) : null
592
+ ),
593
+ this.showLicenseWatermark && /* @__PURE__ */ o.createElement($, null)
594
+ )));
595
+ return q ? this.props.appendTo !== null ? P.createPortal(d, this.props.appendTo || document.body) : d : null;
596
+ }
597
+ // Getters
598
+ get top() {
599
+ return this.windowStage !== a.FULLSCREEN ? Math.max(this.props.top || this.state.top, 0) : 0;
600
+ }
601
+ get left() {
602
+ return this.windowStage !== a.FULLSCREEN ? Math.max(this.props.left || this.state.left, 0) : 0;
603
+ }
604
+ get width() {
605
+ let i = this.props.width || this.state.width;
606
+ if (this.windowStage === a.FULLSCREEN) {
607
+ if (this.props.appendTo)
608
+ return i = this.props.appendTo.offsetWidth, i;
609
+ const t = this.getWindow();
610
+ i = t ? t.innerWidth : 0;
611
+ }
612
+ return i;
613
+ }
614
+ get height() {
615
+ let i = this.props.height || this.state.height;
616
+ if (this.windowStage === a.FULLSCREEN) {
617
+ if (this.props.appendTo)
618
+ return i = this.props.appendTo.offsetHeight, i;
619
+ const t = this.getWindow();
620
+ i = t ? t.innerHeight : 0;
621
+ } else
622
+ this.windowStage === a.MINIMIZED && (i = 0);
623
+ return i;
624
+ }
625
+ get windowStage() {
626
+ return this.props.stage || this.state.stage;
627
+ }
628
+ getActionBar(i) {
629
+ return i.filter((t) => t && t.type === A);
630
+ }
631
+ getContent(i) {
632
+ return i.filter((t) => t && t.type !== A);
633
+ }
634
+ generateTitleId() {
635
+ return "window-title-" + this._id;
636
+ }
637
+ }
638
+ k.displayName = "Window";
639
+ k.propTypes = {
640
+ width: n.number,
641
+ height: n.number,
642
+ left: n.number,
643
+ top: n.number,
644
+ initialWidth: n.number,
645
+ initialHeight: n.number,
646
+ initialLeft: n.number,
647
+ initialTop: n.number,
648
+ minWidth: n.number,
649
+ minHeight: n.number,
650
+ resizable: n.bool,
651
+ draggable: n.bool,
652
+ title: n.any,
653
+ shouldUpdateOnDrag: n.bool,
654
+ stage: n.oneOf(["DEFAULT", "MINIMIZED", "FULLSCREEN"]),
655
+ className: n.string,
656
+ style: n.object,
657
+ overlayStyle: n.object
658
+ };
659
+ k.defaultProps = {
660
+ minWidth: R,
661
+ minHeight: F,
662
+ resizable: !0,
663
+ draggable: !0,
664
+ modal: !1,
665
+ doubleClickStageChange: !0
666
+ };
667
+ k.contextType = L;
668
+ const ft = j(), wt = G(ft, k);
669
+ wt.displayName = "KendoReactWindow";
670
+ export {
671
+ lt as Dialog,
672
+ W as DialogActionsBar,
673
+ ht as DialogPropsContext,
674
+ wt as Window,
675
+ A as WindowActionsBar,
676
+ ft as WindowPropsContext
677
+ };
@@ -1,3 +1,7 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
4
+ *-------------------------------------------------------------------------------------------*/
1
5
  /**
2
6
  * @hidden
3
7
  */
@@ -0,0 +1,8 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ /**
6
+ * Lists the possible layout of the dialogs action buttons.
7
+ */
8
+ export type ActionsLayout = 'start' | 'center' | 'end' | 'stretched';