@progress/kendo-react-dialogs 8.1.0-develop.9 → 8.1.0

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/Dialog.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),S=require("react-dom"),t=require("prop-types"),_=require("./DialogTitleBar.js"),u=require("./DialogActionsBar.js"),o=require("@progress/kendo-react-common"),m=require("./package-metadata.js"),N=require("./utils.js"),c=require("./constants.js");function g(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(s,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return s.default=r,Object.freeze(s)}const n=g(P),M=g(S),i=class i extends n.Component{constructor(s){super(s),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=e=>{e.preventDefault(),o.dispatchEvent(this.props.onClose,e,this,void 0)},this.onKeyDown=e=>{e.keyCode===o.Keys.esc&&this.props.onClose&&(e.preventDefault(),this.onCloseDialog(e)),o.keepFocusInContainer(e,this.element)},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:c.DEFAULT_DIALOGS_ZINDEX:this.state.zIndex>(this.context?this.context+c.ZINDEX_DIALOGS_STEP:0)?this.state.zIndex:this.context+c.ZINDEX_DIALOGS_STEP,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,o.validatePackage(m.packageMetadata),this.showLicenseWatermark=o.shouldShowValidationUI(m.packageMetadata)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:N.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const s=this.props.id!==void 0?this.props.id:this.titleId,{title:e,width:a,height:D,children:f,minWidth:b,dir:x,style:C,contentStyle:k,modal:w=!0}=this.props,d=n.Children.toArray(f),T=this.getContent(d),O=this.getActionBar(d),v=e?{"aria-labelledby":s}:null,E=this.props.closeIcon!==void 0?this.props.closeIcon:!0,p=this.getCurrentZIndex(),h=n.createElement(o.ZIndexContext.Provider,{value:p},n.createElement("div",{[c.DATA_DIALOGS_ID]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:x,style:{zIndex:p,...C},ref:A=>this.element=A},w&&n.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),n.createElement("div",{...v,className:o.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":s,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:a,height:D,minWidth:b}},this.props.title&&n.createElement(_.DialogTitleBar,{closeIcon:E,onCloseButtonClick:this.onCloseDialog,id:s},e),n.createElement("div",{className:"k-window-content k-dialog-content",style:k,id:this.contentId},T),O,this.showLicenseWatermark&&n.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?M.createPortal(h,this.props.appendTo||document.body):h:null}getActionBar(s){return s.filter(e=>e&&e.type===u.DialogActionsBar)}getContent(s){return s.filter(e=>e&&e.type!==u.DialogActionsBar)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};i.displayName="Dialog",i.propTypes={title:t.any,id:t.string,dir:t.string,style:t.object,closeIcon:t.bool,width:t.oneOfType([t.number,t.string]),height:t.oneOfType([t.number,t.string]),minWidth:t.oneOfType([t.number,t.string]),autoFocus:t.bool},i.defaultProps={autoFocus:!1},i.contextType=o.ZIndexContext;let l=i;const y=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(y,l));I.displayName="KendoReactDialog";exports.Dialog=I;exports.DialogPropsContext=y;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),S=require("react-dom"),t=require("prop-types"),_=require("./DialogTitleBar.js"),u=require("./DialogActionsBar.js"),s=require("@progress/kendo-react-common"),m=require("./package-metadata.js"),N=require("./utils.js"),c=require("./constants.js");function g(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const n=g(P),M=g(S),o=class o extends n.Component{constructor(i){super(i),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.activeElement=null,this.onCloseDialog=e=>{e.preventDefault(),s.dispatchEvent(this.props.onClose,e,this,void 0),setTimeout(()=>{this.activeElement&&this.activeElement.focus()})},this.onKeyDown=e=>{e.keyCode===s.Keys.esc&&this.props.onClose&&(e.preventDefault(),this.onCloseDialog(e)),s.keepFocusInContainer(e,this.element)},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:c.DEFAULT_DIALOGS_ZINDEX:this.state.zIndex>(this.context?this.context+c.ZINDEX_DIALOGS_STEP:0)?this.state.zIndex:this.context+c.ZINDEX_DIALOGS_STEP,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,s.validatePackage(m.packageMetadata),this.showLicenseWatermark=s.shouldShowValidationUI(m.packageMetadata),this.activeElement=document.activeElement}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus?this.element.focus():s.focusFirstFocusableChild(this.element),this.setState({zIndex:N.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const i=this.props.id!==void 0?this.props.id:this.titleId,{title:e,width:a,height:D,children:f,minWidth:b,dir:C,style:x,contentStyle:T,modal:k=!0}=this.props,d=n.Children.toArray(f),v=this.getContent(d),w=this.getActionBar(d),E=e?{"aria-labelledby":i}:null,O=this.props.closeIcon!==void 0?this.props.closeIcon:!0,h=this.getCurrentZIndex(),p=n.createElement(s.ZIndexContext.Provider,{value:h},n.createElement("div",{[c.DATA_DIALOGS_ID]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:C,style:{zIndex:h,...x},ref:A=>this.element=A},k&&n.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),n.createElement("div",{...E,className:s.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":i,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:a,height:D,minWidth:b}},this.props.title&&n.createElement(_.DialogTitleBar,{closeIcon:O,onCloseButtonClick:this.onCloseDialog,id:i},e),n.createElement("div",{className:"k-window-content k-dialog-content",style:T,id:this.contentId},v),w,this.showLicenseWatermark&&n.createElement(s.WatermarkOverlay,null))));return s.canUseDOM?this.props.appendTo!==null?M.createPortal(p,this.props.appendTo||document.body):p:null}getActionBar(i){return i.filter(e=>e&&e.type===u.DialogActionsBar)}getContent(i){return i.filter(e=>e&&e.type!==u.DialogActionsBar)}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};o.displayName="Dialog",o.propTypes={title:t.any,id:t.string,dir:t.string,style:t.object,closeIcon:t.bool,width:t.oneOfType([t.number,t.string]),height:t.oneOfType([t.number,t.string]),minWidth:t.oneOfType([t.number,t.string]),autoFocus:t.bool},o.defaultProps={autoFocus:!1},o.contextType=s.ZIndexContext;let l=o;const y=s.createPropsContext(),I=s.withIdHOC(s.withPropsContext(y,l));I.displayName="KendoReactDialog";exports.Dialog=I;exports.DialogPropsContext=y;
package/Dialog.mjs CHANGED
@@ -6,22 +6,24 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as o from "react";
10
- import * as v from "react-dom";
9
+ import * as i from "react";
10
+ import * as b from "react-dom";
11
11
  import e from "prop-types";
12
- import { DialogTitleBar as E } from "./DialogTitleBar.mjs";
12
+ import { DialogTitleBar as k } from "./DialogTitleBar.mjs";
13
13
  import { DialogActionsBar as c } from "./DialogActionsBar.mjs";
14
- import { dispatchEvent as A, Keys as N, keepFocusInContainer as O, validatePackage as P, shouldShowValidationUI as S, ZIndexContext as d, classNames as Z, WatermarkOverlay as L, canUseDOM as _, createPropsContext as B, withIdHOC as F, withPropsContext as K } from "@progress/kendo-react-common";
15
- import { packageMetadata as p } from "./package-metadata.mjs";
16
- import { getMaxZIndex as M } from "./utils.mjs";
17
- import { DEFAULT_DIALOGS_ZINDEX as z, ZINDEX_DIALOGS_STEP as h, DATA_DIALOGS_ID as G } from "./constants.mjs";
18
- const i = class i extends o.Component {
14
+ import { dispatchEvent as A, Keys as N, keepFocusInContainer as O, validatePackage as P, shouldShowValidationUI as S, ZIndexContext as d, focusFirstFocusableChild as Z, classNames as F, WatermarkOverlay as L, canUseDOM as _, createPropsContext as B, withIdHOC as K, withPropsContext as M } from "@progress/kendo-react-common";
15
+ import { packageMetadata as h } from "./package-metadata.mjs";
16
+ import { getMaxZIndex as z } from "./utils.mjs";
17
+ import { DEFAULT_DIALOGS_ZINDEX as G, ZINDEX_DIALOGS_STEP as p, DATA_DIALOGS_ID as R } from "./constants.mjs";
18
+ const o = class o extends i.Component {
19
19
  constructor(s) {
20
- super(s), this.context = 0, this.titleId = this.generateTitleId(), this.contentId = this.generateContentId(), this.showLicenseWatermark = !1, this.onCloseDialog = (t) => {
21
- t.preventDefault(), A(this.props.onClose, t, this, void 0);
20
+ super(s), this.context = 0, this.titleId = this.generateTitleId(), this.contentId = this.generateContentId(), this.showLicenseWatermark = !1, this.activeElement = null, this.onCloseDialog = (t) => {
21
+ t.preventDefault(), A(this.props.onClose, t, this, void 0), setTimeout(() => {
22
+ this.activeElement && this.activeElement.focus();
23
+ });
22
24
  }, this.onKeyDown = (t) => {
23
25
  t.keyCode === N.esc && this.props.onClose && (t.preventDefault(), this.onCloseDialog(t)), O(t, this.element);
24
- }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : z : this.state.zIndex > (this.context ? this.context + h : 0) ? this.state.zIndex : this.context + h, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, P(p), this.showLicenseWatermark = S(p);
26
+ }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : G : this.state.zIndex > (this.context ? this.context + p : 0) ? this.state.zIndex : this.context + p, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, P(h), this.showLicenseWatermark = S(h), this.activeElement = document.activeElement;
25
27
  }
26
28
  get _id() {
27
29
  return this.props.id + "-accessibility-id";
@@ -30,20 +32,20 @@ const i = class i extends o.Component {
30
32
  * @hidden
31
33
  */
32
34
  componentDidMount() {
33
- this.element && (this.props.autoFocus && this.element.focus(), this.setState({
34
- zIndex: M(this.getCurrentZIndex(), this.getDocument(), this._id)
35
+ this.element && (this.props.autoFocus ? this.element.focus() : Z(this.element), this.setState({
36
+ zIndex: z(this.getCurrentZIndex(), this.getDocument(), this._id)
35
37
  }));
36
38
  }
37
39
  /**
38
40
  * @hidden
39
41
  */
40
42
  render() {
41
- const s = this.props.id !== void 0 ? this.props.id : this.titleId, { title: t, width: m, height: u, children: g, minWidth: y, dir: I, style: f, contentStyle: D, modal: x = !0 } = this.props, r = o.Children.toArray(g), C = this.getContent(r), w = this.getActionBar(r), k = t ? {
43
+ const s = this.props.id !== void 0 ? this.props.id : this.titleId, { title: t, width: m, height: u, children: g, minWidth: y, dir: I, style: f, contentStyle: D, modal: x = !0 } = this.props, r = i.Children.toArray(g), C = this.getContent(r), w = this.getActionBar(r), v = t ? {
42
44
  "aria-labelledby": s
43
- } : null, T = this.props.closeIcon !== void 0 ? this.props.closeIcon : !0, a = this.getCurrentZIndex(), l = /* @__PURE__ */ o.createElement(d.Provider, { value: a }, /* @__PURE__ */ o.createElement(
45
+ } : null, E = this.props.closeIcon !== void 0 ? this.props.closeIcon : !0, a = this.getCurrentZIndex(), l = /* @__PURE__ */ i.createElement(d.Provider, { value: a }, /* @__PURE__ */ i.createElement(
44
46
  "div",
45
47
  {
46
- [G]: this._id,
48
+ [R]: this._id,
47
49
  className: "k-dialog-wrapper" + (this.props.className ? " " + this.props.className : ""),
48
50
  onKeyDown: this.onKeyDown,
49
51
  tabIndex: 0,
@@ -52,20 +54,20 @@ const i = class i extends o.Component {
52
54
  zIndex: a,
53
55
  ...f
54
56
  },
55
- ref: (b) => this.element = b
57
+ ref: (T) => this.element = T
56
58
  },
57
- x && /* @__PURE__ */ o.createElement(
59
+ x && /* @__PURE__ */ i.createElement(
58
60
  "div",
59
61
  {
60
62
  className: "k-overlay",
61
63
  style: this.props.overlayStyle
62
64
  }
63
65
  ),
64
- /* @__PURE__ */ o.createElement(
66
+ /* @__PURE__ */ i.createElement(
65
67
  "div",
66
68
  {
67
- ...k,
68
- className: Z(
69
+ ...v,
70
+ className: F(
69
71
  "k-window k-dialog",
70
72
  {
71
73
  [`k-window-${this.props.themeColor}`]: this.props.themeColor
@@ -77,21 +79,21 @@ const i = class i extends o.Component {
77
79
  "aria-describedby": this.contentId,
78
80
  style: { width: m, height: u, minWidth: y }
79
81
  },
80
- this.props.title && /* @__PURE__ */ o.createElement(
81
- E,
82
+ this.props.title && /* @__PURE__ */ i.createElement(
83
+ k,
82
84
  {
83
- closeIcon: T,
85
+ closeIcon: E,
84
86
  onCloseButtonClick: this.onCloseDialog,
85
87
  id: s
86
88
  },
87
89
  t
88
90
  ),
89
- /* @__PURE__ */ o.createElement("div", { className: "k-window-content k-dialog-content", style: D, id: this.contentId }, C),
91
+ /* @__PURE__ */ i.createElement("div", { className: "k-window-content k-dialog-content", style: D, id: this.contentId }, C),
90
92
  w,
91
- this.showLicenseWatermark && /* @__PURE__ */ o.createElement(L, null)
93
+ this.showLicenseWatermark && /* @__PURE__ */ i.createElement(L, null)
92
94
  )
93
95
  ));
94
- return _ ? this.props.appendTo !== null ? v.createPortal(l, this.props.appendTo || document.body) : l : null;
96
+ return _ ? this.props.appendTo !== null ? b.createPortal(l, this.props.appendTo || document.body) : l : null;
95
97
  }
96
98
  getActionBar(s) {
97
99
  return s.filter((t) => t && t.type === c);
@@ -106,7 +108,7 @@ const i = class i extends o.Component {
106
108
  return "dialog-content-" + this._id;
107
109
  }
108
110
  };
109
- i.displayName = "Dialog", i.propTypes = {
111
+ o.displayName = "Dialog", o.propTypes = {
110
112
  title: e.any,
111
113
  id: e.string,
112
114
  dir: e.string,
@@ -116,13 +118,13 @@ i.displayName = "Dialog", i.propTypes = {
116
118
  height: e.oneOfType([e.number, e.string]),
117
119
  minWidth: e.oneOfType([e.number, e.string]),
118
120
  autoFocus: e.bool
119
- }, i.defaultProps = {
121
+ }, o.defaultProps = {
120
122
  autoFocus: !1
121
- }, i.contextType = d;
122
- let n = i;
123
- const R = B(), U = F(K(R, n));
124
- U.displayName = "KendoReactDialog";
123
+ }, o.contextType = d;
124
+ let n = o;
125
+ const U = B(), X = K(M(U, n));
126
+ X.displayName = "KendoReactDialog";
125
127
  export {
126
- U as Dialog,
127
- R as DialogPropsContext
128
+ X as Dialog,
129
+ U as DialogPropsContext
128
130
  };
package/Window.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),F=require("react-dom"),n=require("prop-types"),N=require("./WindowTitlebar.js"),o=require("@progress/kendo-react-common"),U=require("./WindowResizeHandlers.js"),k=require("./MiddleLayerOptimization.js"),s=require("./StageEnum.js"),y=require("./package-metadata.js"),M=require("./WindowActionsBar.js"),f=require("./constants.js"),A=require("./utils.js");function v(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const a=v(x),z=v(F),u=300,S=300,m=120,E=100,r=5,g=class g extends a.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||m,h=this.props.minHeight||E;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case o.Keys.up:t.preventDefault(),h<=this.height-r&&this.setState({height:this.height-r});break;case o.Keys.down:t.preventDefault(),this.setState({height:this.height+r});break;case o.Keys.left:e<=this.width-r&&this.setState({width:this.width-r});break;case o.Keys.right:this.setState({width:this.width+r});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case o.Keys.up:this.windowStage===s.windowStage.MINIMIZED?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})):this.windowStage===s.windowStage.DEFAULT&&(this.handleFullscreen(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.FULLSCREEN}));break;case o.Keys.down:this.windowStage===s.windowStage.FULLSCREEN?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})):this.windowStage===s.windowStage.DEFAULT&&(this.handleMinimize(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case o.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case o.Keys.up:this.setState({top:this.state.top-r});break;case o.Keys.down:this.setState({top:this.state.top+r});break;case o.Keys.left:this.setState({left:this.state.left-r});break;case o.Keys.right:this.setState({left:this.state.left+r});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==s.windowStage.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==s.windowStage.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:A.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=S;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=u;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=u;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=S;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:s.windowStage.MINIMIZED,height:0}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),h=e?e.innerWidth:0,d=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:h,height:this.props.appendTo?this.props.appendTo.offsetHeight:d,stage:s.windowStage.FULLSCREEN}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===s.windowStage.FULLSCREEN?this.setState({stage:s.windowStage.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===s.windowStage.MINIMIZED&&this.setState({stage:s.windowStage.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===s.windowStage.FULLSCREEN||this.windowStage===s.windowStage.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const h=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,d=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,w=this.width,p=this.height,C=this.props.minWidth||m,I=this.props.minHeight||E,T=this.top-d,L=this.left-h;let b=h-this.left,W=d-this.top;const l=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&I-(p+T)<0&&(this.top>0&&(l.height=p+T),l.top=d),e.direction.indexOf("s")>=0&&I-W<0&&(l.height=W),e.direction.indexOf("w")>=0&&C-(w+L)<0&&(this.left>0&&(l.width=w+L),l.left=h),e.direction.indexOf("e")>=0&&C-b<0&&(l.width=b),this.setState(l),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,h,d)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:h,end:d,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===s.windowStage.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,h=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:h})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:f.DEFAULT_DIALOGS_ZINDEX:this.state.zIndex>(this.context?this.context+f.ZINDEX_DIALOGS_STEP:0)?this.state.zIndex:this.context+f.ZINDEX_DIALOGS_STEP,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},o.validatePackage(y.packageMetadata),this.showLicenseWatermark=o.shouldShowValidationUI(y.packageMetadata),this.state={stage:this.props.stage||s.windowStage.DEFAULT,isDragging:!1,top:0,left:0,width:u,height:S,focused:!0,zIndex:f.DEFAULT_DIALOGS_ZINDEX}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||s.windowStage.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:A.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),h=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-h.left,this.offSetCoordinates.y=e.top-h.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=a.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),h=this.getCurrentZIndex(),d=o.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),w=a.createElement(o.ZIndexContext.Provider,{value:h},a.createElement(a.Fragment,null,this.props.modal&&a.createElement("div",{className:"k-overlay",style:{zIndex:h,...this.props.overlayStyle}}),a.createElement("div",{id:this.props.id,[f.DATA_DIALOGS_ID]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:p=>{this.windowElement=p,this.element=p},className:d,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:h,...this.props.style}},a.createElement(k.MiddleLayerOptimization,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},a.createElement(o.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:p=>this.draggable=p},a.createElement(N.WindowTitleBar,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==s.windowStage.MINIMIZED?a.createElement(a.Fragment,null,a.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===s.windowStage.DEFAULT&&this.props.resizable?a.createElement(U.ResizeHandlers,{onResize:this.handleResize}):null),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?z.createPortal(w,this.props.appendTo||document.body):w:null}get top(){return this.windowStage!==s.windowStage.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==s.windowStage.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===s.windowStage.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===s.windowStage.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===s.windowStage.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===M.WindowActionsBar)}getContent(i){return i.filter(t=>t&&t.type!==M.WindowActionsBar)}generateTitleId(){return"window-title-"+this._id}};g.displayName="Window",g.propTypes={width:n.number,height:n.number,left:n.number,top:n.number,initialWidth:n.number,initialHeight:n.number,initialLeft:n.number,initialTop:n.number,minWidth:n.number,minHeight:n.number,resizable:n.bool,draggable:n.bool,title:n.any,shouldUpdateOnDrag:n.bool,stage:n.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:n.string,id:n.string,style:n.object,overlayStyle:n.object},g.defaultProps={minWidth:m,minHeight:E,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},g.contextType=o.ZIndexContext;let D=g;const B=o.createPropsContext(),R=o.withIdHOC(o.withPropsContext(B,D));R.displayName="KendoReactWindow";exports.Window=R;exports.WindowPropsContext=B;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),F=require("react-dom"),n=require("prop-types"),N=require("./WindowTitlebar.js"),o=require("@progress/kendo-react-common"),U=require("./WindowResizeHandlers.js"),k=require("./MiddleLayerOptimization.js"),s=require("./StageEnum.js"),y=require("./package-metadata.js"),M=require("./WindowActionsBar.js"),f=require("./constants.js"),v=require("./utils.js");function A(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const a=A(x),z=A(F),u=300,S=300,m=120,E=100,d=5,g=class g extends a.Component{constructor(i){super(i),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.activeElement=null,this.onKeyDown=t=>{if(this.props.modal&&o.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const e=this.props.minWidth||m,h=this.props.minHeight||E;if((t.metaKey||t.ctrlKey)&&this.props.resizable){switch(t.keyCode){case o.Keys.up:t.preventDefault(),h<=this.height-d&&this.setState({height:this.height-d});break;case o.Keys.down:t.preventDefault(),this.setState({height:this.height+d});break;case o.Keys.left:e<=this.width-d&&this.setState({width:this.width-d});break;case o.Keys.right:this.setState({width:this.width+d});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0);return}if(t.altKey){switch(t.keyCode){case o.Keys.up:this.windowStage===s.windowStage.MINIMIZED?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})):this.windowStage===s.windowStage.DEFAULT&&(this.handleFullscreen(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.FULLSCREEN}));break;case o.Keys.down:this.windowStage===s.windowStage.FULLSCREEN?(this.handleRestore(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})):this.windowStage===s.windowStage.DEFAULT&&(this.handleMinimize(t),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.MINIMIZED}));break}return}if(!t.ctrlKey)switch(t.keyCode){case o.Keys.esc:this.props.onClose&&this.handleCloseWindow(t);return;case o.Keys.up:this.setState({top:this.state.top-d});break;case o.Keys.down:this.setState({top:this.state.top+d});break;case o.Keys.left:this.setState({left:this.state.left-d});break;case o.Keys.right:this.setState({left:this.state.left+d});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==s.windowStage.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==s.windowStage.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:v.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout(()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0}))},this.getInitialTop=()=>{if(this.props.top!==void 0)return this.props.top;if(this.props.initialTop!==void 0)return this.props.initialTop;let t=S;if(this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(this.props.left!==void 0)return this.props.left;if(this.props.initialLeft!==void 0)return this.props.initialLeft;let t=u;if(this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=u;return this.props.width!==void 0?t=this.props.width:this.props.initialWidth!==void 0&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=S;return this.props.height!==void 0?t=this.props.height:this.props.initialHeight!==void 0&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:s.windowStage.MINIMIZED,height:0}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),h=e?e.innerWidth:0,r=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:h,height:this.props.appendTo?this.props.appendTo.offsetHeight:r,stage:s.windowStage.FULLSCREEN}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===s.windowStage.FULLSCREEN?this.setState({stage:s.windowStage.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===s.windowStage.MINIMIZED&&this.setState({stage:s.windowStage.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),o.dispatchEvent(this.props.onStageChange,t,this,{state:s.windowStage.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),o.dispatchEvent(this.props.onClose,t,this,{state:void 0}),setTimeout(()=>{this.activeElement&&this.activeElement.focus()})},this.handleDoubleClick=t=>{this.windowStage===s.windowStage.FULLSCREEN||this.windowStage===s.windowStage.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const h=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,r=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,w=this.width,p=this.height,C=this.props.minWidth||m,I=this.props.minHeight||E,T=this.top-r,L=this.left-h;let b=h-this.left,W=r-this.top;const l=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&I-(p+T)<0&&(this.top>0&&(l.height=p+T),l.top=r),e.direction.indexOf("s")>=0&&I-W<0&&(l.height=W),e.direction.indexOf("w")>=0&&C-(w+L)<0&&(this.left>0&&(l.width=w+L),l.left=h),e.direction.indexOf("e")>=0&&C-b<0&&(l.width=b),this.setState(l),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,h,r)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:h,end:r,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===s.windowStage.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,h=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:h})}},this.getCurrentZIndex=()=>!this.state||this.context===void 0?this.context?this.context:f.DEFAULT_DIALOGS_ZINDEX:this.state.zIndex>(this.context?this.context+f.ZINDEX_DIALOGS_STEP:0)?this.state.zIndex:this.context+f.ZINDEX_DIALOGS_STEP,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},o.validatePackage(y.packageMetadata),this.showLicenseWatermark=o.shouldShowValidationUI(y.packageMetadata),this.state={stage:this.props.stage||s.windowStage.DEFAULT,isDragging:!1,top:0,left:0,width:u,height:S,focused:!0,zIndex:f.DEFAULT_DIALOGS_ZINDEX},this.activeElement=document.activeElement}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&this.element.focus();const i=this.getWindow();i&&i.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||s.windowStage.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:v.getMaxZIndex(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),h=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-h.left,this.offSetCoordinates.y=e.top-h.top}this.mounted=!0}componentWillUnmount(){const i=this.getWindow();i&&i.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const i=this.getDocument();if(this.props.appendTo&&i){let t=this.props.appendTo.getBoundingClientRect(),e=i.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-e.left,this.offSetCoordinates.y=t.top-e.top}this.mounted=!0}render(){const i=a.Children.toArray(this.props.children),t=this.getContent(i),e=this.getActionBar(i),h=this.getCurrentZIndex(),r=o.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":this.state.stage==="MINIMIZED","k-window-focused":this.state.focused}),w=a.createElement(o.ZIndexContext.Provider,{value:h},a.createElement(a.Fragment,null,this.props.modal&&a.createElement("div",{className:"k-overlay",style:{zIndex:h,...this.props.overlayStyle}}),a.createElement("div",{id:this.props.id,[f.DATA_DIALOGS_ID]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:p=>{this.windowElement=p,this.element=p},className:r,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:h,...this.props.style}},a.createElement(k.MiddleLayerOptimization,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},a.createElement(o.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:p=>this.draggable=p},a.createElement(N.WindowTitleBar,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==s.windowStage.MINIMIZED?a.createElement(a.Fragment,null,a.createElement("div",{className:"k-window-content"},t),e):null,this.windowStage===s.windowStage.DEFAULT&&this.props.resizable?a.createElement(U.ResizeHandlers,{onResize:this.handleResize}):null),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,null))));return o.canUseDOM?this.props.appendTo!==null?z.createPortal(w,this.props.appendTo||document.body):w:null}get top(){return this.windowStage!==s.windowStage.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==s.windowStage.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let i=this.props.width||this.state.width;if(this.windowStage===s.windowStage.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetWidth,i;const t=this.getWindow();i=t?t.innerWidth:0}return i}get height(){let i=this.props.height||this.state.height;if(this.windowStage===s.windowStage.FULLSCREEN){if(this.props.appendTo)return i=this.props.appendTo.offsetHeight,i;const t=this.getWindow();i=t?t.innerHeight:0}else this.windowStage===s.windowStage.MINIMIZED&&(i=0);return i}get windowStage(){return this.props.stage||this.state.stage}getActionBar(i){return i.filter(t=>t&&t.type===M.WindowActionsBar)}getContent(i){return i.filter(t=>t&&t.type!==M.WindowActionsBar)}generateTitleId(){return"window-title-"+this._id}};g.displayName="Window",g.propTypes={width:n.number,height:n.number,left:n.number,top:n.number,initialWidth:n.number,initialHeight:n.number,initialLeft:n.number,initialTop:n.number,minWidth:n.number,minHeight:n.number,resizable:n.bool,draggable:n.bool,title:n.any,shouldUpdateOnDrag:n.bool,stage:n.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:n.string,id:n.string,style:n.object,overlayStyle:n.object},g.defaultProps={minWidth:m,minHeight:E,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},g.contextType=o.ZIndexContext;let D=g;const B=o.createPropsContext(),R=o.withIdHOC(o.withPropsContext(B,D));R.displayName="KendoReactWindow";exports.Window=R;exports.WindowPropsContext=B;
package/Window.mjs CHANGED
@@ -7,36 +7,36 @@
7
7
  */
8
8
  "use client";
9
9
  import * as h from "react";
10
- import * as R from "react-dom";
10
+ import * as F from "react-dom";
11
11
  import o from "prop-types";
12
- import { WindowTitleBar as v } from "./WindowTitlebar.mjs";
13
- import { Keys as r, dispatchEvent as p, validatePackage as x, shouldShowValidationUI as U, ZIndexContext as W, classNames as N, Draggable as H, WatermarkOverlay as k, canUseDOM as z, createPropsContext as _, withIdHOC as Z, withPropsContext as O } from "@progress/kendo-react-common";
14
- import { ResizeHandlers as P } from "./WindowResizeHandlers.mjs";
15
- import { MiddleLayerOptimization as K } from "./MiddleLayerOptimization.mjs";
12
+ import { WindowTitleBar as R } from "./WindowTitlebar.mjs";
13
+ import { keepFocusInContainer as x, Keys as r, dispatchEvent as p, validatePackage as U, shouldShowValidationUI as N, ZIndexContext as W, classNames as k, Draggable as H, WatermarkOverlay as z, canUseDOM as _, createPropsContext as O, withIdHOC as Z, withPropsContext as P } from "@progress/kendo-react-common";
14
+ import { ResizeHandlers as K } from "./WindowResizeHandlers.mjs";
15
+ import { MiddleLayerOptimization as X } from "./MiddleLayerOptimization.mjs";
16
16
  import { windowStage as i } from "./StageEnum.mjs";
17
17
  import { packageMetadata as M } from "./package-metadata.mjs";
18
- import { WindowActionsBar as A } from "./WindowActionsBar.mjs";
19
- import { DEFAULT_DIALOGS_ZINDEX as y, ZINDEX_DIALOGS_STEP as B, DATA_DIALOGS_ID as X } from "./constants.mjs";
20
- import { getMaxZIndex as F } from "./utils.mjs";
21
- const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component {
18
+ import { WindowActionsBar as y } from "./WindowActionsBar.mjs";
19
+ import { DEFAULT_DIALOGS_ZINDEX as A, ZINDEX_DIALOGS_STEP as B, DATA_DIALOGS_ID as G } from "./constants.mjs";
20
+ import { getMaxZIndex as v } from "./utils.mjs";
21
+ const u = 300, w = 300, m = 120, S = 100, d = 5, c = class c extends h.Component {
22
22
  constructor(s) {
23
- super(s), this.context = 0, this.draggable = null, this.offSetCoordinates = { x: 0, y: 0 }, this.titleId = this.generateTitleId(), this.mounted = !1, this.showLicenseWatermark = !1, this.onKeyDown = (t) => {
24
- if (t.target !== t.currentTarget)
23
+ super(s), this.context = 0, this.draggable = null, this.offSetCoordinates = { x: 0, y: 0 }, this.titleId = this.generateTitleId(), this.mounted = !1, this.showLicenseWatermark = !1, this.activeElement = null, this.onKeyDown = (t) => {
24
+ if (this.props.modal && x(t, this.element), t.target !== t.currentTarget)
25
25
  return;
26
26
  const e = this.props.minWidth || m, n = this.props.minHeight || S;
27
- if (t.ctrlKey && this.props.resizable) {
27
+ if ((t.metaKey || t.ctrlKey) && this.props.resizable) {
28
28
  switch (t.keyCode) {
29
29
  case r.up:
30
- t.preventDefault(), n <= this.height - a && this.setState({ height: this.height - a });
30
+ t.preventDefault(), n <= this.height - d && this.setState({ height: this.height - d });
31
31
  break;
32
32
  case r.down:
33
- t.preventDefault(), this.setState({ height: this.height + a });
33
+ t.preventDefault(), this.setState({ height: this.height + d });
34
34
  break;
35
35
  case r.left:
36
- e <= this.width - a && this.setState({ width: this.width - a });
36
+ e <= this.width - d && this.setState({ width: this.width - d });
37
37
  break;
38
38
  case r.right:
39
- this.setState({ width: this.width + a });
39
+ this.setState({ width: this.width + d });
40
40
  break;
41
41
  default:
42
42
  return;
@@ -61,16 +61,16 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
61
61
  this.props.onClose && this.handleCloseWindow(t);
62
62
  return;
63
63
  case r.up:
64
- this.setState({ top: this.state.top - a });
64
+ this.setState({ top: this.state.top - d });
65
65
  break;
66
66
  case r.down:
67
- this.setState({ top: this.state.top + a });
67
+ this.setState({ top: this.state.top + d });
68
68
  break;
69
69
  case r.left:
70
- this.setState({ left: this.state.left - a });
70
+ this.setState({ left: this.state.left - d });
71
71
  break;
72
72
  case r.right:
73
- this.setState({ left: this.state.left + a });
73
+ this.setState({ left: this.state.left + d });
74
74
  break;
75
75
  default:
76
76
  return;
@@ -94,7 +94,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
94
94
  }, this.onFocus = () => {
95
95
  this._blurTimeout ? (clearTimeout(this._blurTimeout), this._blurTimeout = void 0) : this.setState({
96
96
  focused: !0,
97
- zIndex: F(this.getCurrentZIndex(), this.getDocument(), this._id)
97
+ zIndex: v(this.getCurrentZIndex(), this.getDocument(), this._id)
98
98
  });
99
99
  }, this.onBlur = () => {
100
100
  clearTimeout(this._blurTimeout);
@@ -107,7 +107,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
107
107
  return this.props.top;
108
108
  if (this.props.initialTop !== void 0)
109
109
  return this.props.initialTop;
110
- let t = u;
110
+ let t = w;
111
111
  if (this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), this.props.appendTo)
112
112
  return this.props.appendTo.offsetHeight / 2 - t / 2;
113
113
  const e = this.getWindow();
@@ -117,16 +117,16 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
117
117
  return this.props.left;
118
118
  if (this.props.initialLeft !== void 0)
119
119
  return this.props.initialLeft;
120
- let t = w;
120
+ let t = u;
121
121
  if (this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), this.props.appendTo)
122
122
  return this.props.appendTo.offsetWidth / 2 - t / 2;
123
123
  const e = this.getWindow();
124
124
  return e ? e.innerWidth / 2 - t / 2 : 0;
125
125
  }, this.getInitialWidth = () => {
126
- let t = w;
126
+ let t = u;
127
127
  return this.props.width !== void 0 ? t = this.props.width : this.props.initialWidth !== void 0 && (t = this.props.initialWidth), t;
128
128
  }, this.getInitialHeight = () => {
129
- let t = u;
129
+ let t = w;
130
130
  return this.props.height !== void 0 ? t = this.props.height : this.props.initialHeight !== void 0 && (t = this.props.initialHeight), t;
131
131
  }, this.handleMinimize = (t) => {
132
132
  t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height, this.setState({
@@ -135,12 +135,12 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
135
135
  }), p(this.props.onStageChange, t, this, { state: i.MINIMIZED });
136
136
  }, this.handleFullscreen = (t) => {
137
137
  t.preventDefault(), this.windowCoordinatesState.leftBeforeAction = this.left, this.windowCoordinatesState.topBeforeAction = this.top, this.windowCoordinatesState.widthBeforeAction = this.width, this.windowCoordinatesState.heightBeforeAction = this.height;
138
- const e = this.getWindow(), n = e ? e.innerWidth : 0, d = e ? e.innerHeight : 0;
138
+ const e = this.getWindow(), n = e ? e.innerWidth : 0, a = e ? e.innerHeight : 0;
139
139
  this.setState({
140
140
  left: 0,
141
141
  top: 0,
142
142
  width: this.props.appendTo ? this.props.appendTo.offsetWidth : n,
143
- height: this.props.appendTo ? this.props.appendTo.offsetHeight : d,
143
+ height: this.props.appendTo ? this.props.appendTo.offsetHeight : a,
144
144
  stage: i.FULLSCREEN
145
145
  }), p(this.props.onStageChange, t, this, { state: i.FULLSCREEN });
146
146
  }, this.handleRestore = (t) => {
@@ -155,19 +155,21 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
155
155
  height: this.windowCoordinatesState.heightBeforeAction
156
156
  }), p(this.props.onStageChange, t, this, { state: i.DEFAULT });
157
157
  }, this.handleCloseWindow = (t) => {
158
- t.preventDefault(), p(this.props.onClose, t, this, { state: void 0 });
158
+ t.preventDefault(), p(this.props.onClose, t, this, { state: void 0 }), setTimeout(() => {
159
+ this.activeElement && this.activeElement.focus();
160
+ });
159
161
  }, this.handleDoubleClick = (t) => {
160
162
  this.windowStage === i.FULLSCREEN || this.windowStage === i.MINIMIZED ? this.handleRestore(t) : this.handleFullscreen(t);
161
163
  }, this.handleResize = (t, e) => {
162
- const n = this.props.appendTo ? t.pageX - this.offSetCoordinates.x : t.pageX, d = this.props.appendTo ? t.pageY - this.offSetCoordinates.y : t.pageY, f = this.width, l = this.height, C = this.props.minWidth || m, D = this.props.minHeight || S, I = this.top - d, T = this.left - n;
163
- let L = n - this.left, b = d - this.top;
164
+ const n = this.props.appendTo ? t.pageX - this.offSetCoordinates.x : t.pageX, a = this.props.appendTo ? t.pageY - this.offSetCoordinates.y : t.pageY, f = this.width, l = this.height, C = this.props.minWidth || m, D = this.props.minHeight || S, I = this.top - a, T = this.left - n;
165
+ let L = n - this.left, b = a - this.top;
164
166
  const g = Object.assign({}, this.state, { isDragging: !e.end });
165
- e.direction.indexOf("n") >= 0 && D - (l + I) < 0 && (this.top > 0 && (g.height = l + I), g.top = d), e.direction.indexOf("s") >= 0 && D - b < 0 && (g.height = b), e.direction.indexOf("w") >= 0 && C - (f + T) < 0 && (this.left > 0 && (g.width = f + T), g.left = n), e.direction.indexOf("e") >= 0 && C - L < 0 && (g.width = L), this.setState(g), this.dispatchMoveEvent(this.props.onResize, t, !0, e.end);
166
- }, this.dispatchMoveEvent = (t, e, n, d) => {
167
+ e.direction.indexOf("n") >= 0 && D - (l + I) < 0 && (this.top > 0 && (g.height = l + I), g.top = a), e.direction.indexOf("s") >= 0 && D - b < 0 && (g.height = b), e.direction.indexOf("w") >= 0 && C - (f + T) < 0 && (this.left > 0 && (g.width = f + T), g.left = n), e.direction.indexOf("e") >= 0 && C - L < 0 && (g.width = L), this.setState(g), this.dispatchMoveEvent(this.props.onResize, t, !0, e.end);
168
+ }, this.dispatchMoveEvent = (t, e, n, a) => {
167
169
  t && t.call(void 0, {
168
170
  nativeEvent: e.nativeEvent ? e.nativeEvent : e.originalEvent,
169
171
  drag: n,
170
- end: d,
172
+ end: a,
171
173
  target: this,
172
174
  left: this.state.left,
173
175
  top: this.state.top,
@@ -183,19 +185,19 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
183
185
  height: this.props.appendTo ? this.props.appendTo.offsetHeight : n
184
186
  });
185
187
  }
186
- }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : y : this.state.zIndex > (this.context ? this.context + B : 0) ? this.state.zIndex : this.context + B, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, this.getWindow = () => {
188
+ }, this.getCurrentZIndex = () => !this.state || this.context === void 0 ? this.context ? this.context : A : this.state.zIndex > (this.context ? this.context + B : 0) ? this.state.zIndex : this.context + B, this.getDocument = () => this.props.appendTo ? this.props.appendTo.ownerDocument : document, this.getWindow = () => {
187
189
  const t = this.getDocument();
188
190
  return t && t.defaultView;
189
- }, x(M), this.showLicenseWatermark = U(M), this.state = {
191
+ }, U(M), this.showLicenseWatermark = N(M), this.state = {
190
192
  stage: this.props.stage || i.DEFAULT,
191
193
  isDragging: !1,
192
194
  top: 0,
193
195
  left: 0,
194
- width: w,
195
- height: u,
196
+ width: u,
197
+ height: w,
196
198
  focused: !0,
197
- zIndex: y
198
- };
199
+ zIndex: A
200
+ }, this.activeElement = document.activeElement;
199
201
  }
200
202
  get _id() {
201
203
  return this.props.id + "-accessibility-id";
@@ -204,6 +206,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
204
206
  * @hidden
205
207
  */
206
208
  componentDidMount() {
209
+ this.element && this.element.focus();
207
210
  const s = this.getWindow();
208
211
  s && s.addEventListener("resize", this.handleBrowserWindowResize), this.setState({
209
212
  stage: this.props.stage || i.DEFAULT,
@@ -213,7 +216,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
213
216
  width: this.getInitialWidth(),
214
217
  height: this.getInitialHeight(),
215
218
  focused: !0,
216
- zIndex: F(this.getCurrentZIndex(), this.getDocument(), this._id)
219
+ zIndex: v(this.getCurrentZIndex(), this.getDocument(), this._id)
217
220
  }), this.windowCoordinatesState = {
218
221
  leftBeforeAction: this.getInitialLeft(),
219
222
  topBeforeAction: this.getInitialTop(),
@@ -249,7 +252,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
249
252
  * @hidden
250
253
  */
251
254
  render() {
252
- const s = h.Children.toArray(this.props.children), t = this.getContent(s), e = this.getActionBar(s), n = this.getCurrentZIndex(), d = N(
255
+ const s = h.Children.toArray(this.props.children), t = this.getContent(s), e = this.getActionBar(s), n = this.getCurrentZIndex(), a = k(
253
256
  "k-window",
254
257
  this.props.className,
255
258
  {
@@ -270,7 +273,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
270
273
  "div",
271
274
  {
272
275
  id: this.props.id,
273
- [X]: this._id,
276
+ [G]: this._id,
274
277
  tabIndex: 0,
275
278
  role: "dialog",
276
279
  "aria-labelledby": this.titleId,
@@ -280,7 +283,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
280
283
  ref: (l) => {
281
284
  this.windowElement = l, this.element = l;
282
285
  },
283
- className: d,
286
+ className: a,
284
287
  style: {
285
288
  top: this.top,
286
289
  left: this.left,
@@ -291,7 +294,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
291
294
  }
292
295
  },
293
296
  /* @__PURE__ */ h.createElement(
294
- K,
297
+ X,
295
298
  {
296
299
  shouldUpdateOnDrag: this.props.shouldUpdateOnDrag || !1,
297
300
  isDragging: this.state.isDragging
@@ -305,7 +308,7 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
305
308
  ref: (l) => this.draggable = l
306
309
  },
307
310
  /* @__PURE__ */ h.createElement(
308
- v,
311
+ R,
309
312
  {
310
313
  stage: this.windowStage,
311
314
  onDoubleClick: this.props.doubleClickStageChange ? this.handleDoubleClick : void 0,
@@ -323,11 +326,11 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
323
326
  )
324
327
  ),
325
328
  this.windowStage !== i.MINIMIZED ? /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement("div", { className: "k-window-content" }, t), e) : null,
326
- this.windowStage === i.DEFAULT && this.props.resizable ? /* @__PURE__ */ h.createElement(P, { onResize: this.handleResize }) : null
329
+ this.windowStage === i.DEFAULT && this.props.resizable ? /* @__PURE__ */ h.createElement(K, { onResize: this.handleResize }) : null
327
330
  ),
328
- this.showLicenseWatermark && /* @__PURE__ */ h.createElement(k, null)
331
+ this.showLicenseWatermark && /* @__PURE__ */ h.createElement(z, null)
329
332
  )));
330
- return z ? this.props.appendTo !== null ? R.createPortal(f, this.props.appendTo || document.body) : f : null;
333
+ return _ ? this.props.appendTo !== null ? F.createPortal(f, this.props.appendTo || document.body) : f : null;
331
334
  }
332
335
  // Getters
333
336
  get top() {
@@ -361,10 +364,10 @@ const w = 300, u = 300, m = 120, S = 100, a = 5, c = class c extends h.Component
361
364
  return this.props.stage || this.state.stage;
362
365
  }
363
366
  getActionBar(s) {
364
- return s.filter((t) => t && t.type === A);
367
+ return s.filter((t) => t && t.type === y);
365
368
  }
366
369
  getContent(s) {
367
- return s.filter((t) => t && t.type !== A);
370
+ return s.filter((t) => t && t.type !== y);
368
371
  }
369
372
  generateTitleId() {
370
373
  return "window-title-" + this._id;
@@ -399,9 +402,9 @@ c.displayName = "Window", c.propTypes = {
399
402
  doubleClickStageChange: !0
400
403
  }, c.contextType = W;
401
404
  let E = c;
402
- const G = _(), Y = Z(O(G, E));
403
- Y.displayName = "KendoReactWindow";
405
+ const Y = O(), j = Z(P(Y, E));
406
+ j.displayName = "KendoReactWindow";
404
407
  export {
405
- Y as Window,
406
- G as WindowPropsContext
408
+ j as Window,
409
+ Y as WindowPropsContext
407
410
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactDialogs={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactButtons,t.KendoSvgIcons,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,s,o,n,a,r){"use strict";function h(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var d=h(e),l=h(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:s})=>d.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},d.createElement("span",{className:"k-window-title k-dialog-title"},t),s&&d.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},d.createElement(o.Button,{role:"button","aria-label":"Close",onClick:e,icon:"x",svgIcon:n.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),c=t=>{const e={layout:"stretched",...t},{layout:i,children:s}=e,o=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return d.createElement("div",{className:o},s)};c.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const g={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},u="data-windowid",w=10002,m=(t,e,i)=>{let s=t;if(e&&e.defaultView){let t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper"),o=!1;return t.forEach((t=>{let n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){let t=parseInt(n.zIndex,10);t>=s&&(s=t,o=!0)}})),o?s+2:s}return s},f=class extends d.Component{constructor(t){super(t),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.onCloseDialog=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,void 0)},this.onKeyDown=t=>{t.keyCode===a.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t)),a.keepFocusInContainer(t,this.element)},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:w,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g)}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus&&this.element.focus(),this.setState({zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const t=void 0!==this.props.id?this.props.id:this.titleId,{title:e,width:i,height:s,children:o,minWidth:n,dir:r,style:h,contentStyle:c,modal:g=!0}=this.props,w=d.Children.toArray(o),m=this.getContent(w),f=this.getActionBar(w),C=e?{"aria-labelledby":t}:null,E=void 0===this.props.closeIcon||this.props.closeIcon,v=this.getCurrentZIndex(),I=d.createElement(a.ZIndexContext.Provider,{value:v},d.createElement("div",{[u]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:r,style:{zIndex:v,...h},ref:t=>this.element=t},g&&d.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),d.createElement("div",{...C,className:a.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":t,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:i,height:s,minWidth:n}},this.props.title&&d.createElement(p,{closeIcon:E,onCloseButtonClick:this.onCloseDialog,id:t},e),d.createElement("div",{className:"k-window-content k-dialog-content",style:c,id:this.contentId},m),f,this.showLicenseWatermark&&d.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?l.createPortal(I,this.props.appendTo||document.body):I:null}getActionBar(t){return t.filter((t=>t&&t.type===c))}getContent(t){return t.filter((t=>t&&t.type!==c))}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};f.displayName="Dialog",f.propTypes={title:s.any,id:s.string,dir:s.string,style:s.object,closeIcon:s.bool,width:s.oneOfType([s.number,s.string]),height:s.oneOfType([s.number,s.string]),minWidth:s.oneOfType([s.number,s.string]),autoFocus:s.bool},f.defaultProps={autoFocus:!1},f.contextType=a.ZIndexContext;let C=f;const E=a.createPropsContext(),v=a.withIdHOC(a.withPropsContext(E,C));v.displayName="KendoReactDialog";var I=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(I||{});const k="dialogs.windowMaximizeButton",y="dialogs.windowMinimizeButton",S="dialogs.windowRestoreButton",b="dialogs.windowCloseButton",D={[k]:"maximize",[y]:"minimize",[S]:"restore",[b]:"close"},T=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:s,onFullScreenButtonClick:a,onRestoreButtonClick:h,onDoubleClick:l,stage:p,forwardedRef:c,id:g}=t,u=r.useLocalization(),w=t.minimizeButton?d.createElement(t.minimizeButton,{onClick:s,stage:p}):d.createElement(o.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:s,"aria-label":u.toLanguageString(y,D[y])}),m=t.maximizeButton?d.createElement(t.maximizeButton,{onClick:a,stage:p}):d.createElement(o.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":u.toLanguageString(k,D[k])}),f=t.restoreButton?d.createElement(t.restoreButton,{onClick:h,stage:p}):d.createElement(o.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:h,"aria-label":u.toLanguageString(S,D[S])}),C=t.closeButton?d.createElement(t.closeButton,{onClick:i,stage:p}):d.createElement(o.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":u.toLanguageString(b,D[b])});return d.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:l},d.createElement("span",{className:"k-window-title",id:g},e||""),d.createElement("div",{className:"k-window-titlebar-actions"},p===I.DEFAULT&&w,p===I.DEFAULT&&m,p!==I.DEFAULT&&f,C))},x=d.forwardRef(((t,e)=>d.createElement(T,{...t,forwardedRef:e}))),L=["n","e","s","w","se","sw","ne","nw"];let B=class extends d.Component{render(){return d.createElement("div",{className:"k-resize-handles-wrapper"}," ",L.map(((t,e)=>d.createElement(a.Draggable,{key:e,onDrag:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!1,direction:t})},onRelease:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!0,direction:t})}},d.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none"}})))))}};class N extends d.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const z=t=>{const e={layout:"end",...t},{layout:i,children:s}=e,o=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===i,"k-justify-content-center":"center"===i,"k-justify-content-end":"end"===i,"k-justify-content-stretch":"stretched"===i});return d.createElement("div",{className:o},s)};z.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const M=class extends d.Component{constructor(t){super(t),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.onKeyDown=t=>{if(t.target!==t.currentTarget)return;const e=this.props.minWidth||120,i=this.props.minHeight||100;if(t.ctrlKey&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),i<=this.height-5&&this.setState({height:this.height-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:this.height+5});break;case a.Keys.left:e<=this.width-5&&this.setState({width:this.width-5});break;case a.Keys.right:this.setState({width:this.width+5});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:this.windowStage===I.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN}));break;case a.Keys.down:this.windowStage===I.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(this.props.onClose&&this.handleCloseWindow(t));case a.Keys.up:this.setState({top:this.state.top-5});break;case a.Keys.down:this.setState({top:this.state.top+5});break;case a.Keys.left:this.setState({left:this.state.left-5});break;case a.Keys.right:this.setState({left:this.state.left+5});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)}},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==I.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==I.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout((()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0})))},this.getInitialTop=()=>{if(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let t=300;if(void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(void 0!==this.props.left)return this.props.left;if(void 0!==this.props.initialLeft)return this.props.initialLeft;let t=300;if(void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=300;return void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=300;return void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:I.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),i=e?e.innerWidth:0,s=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:i,height:this.props.appendTo?this.props.appendTo.offsetHeight:s,stage:I.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===I.FULLSCREEN?this.setState({stage:I.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===I.MINIMIZED&&this.setState({stage:I.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0})},this.handleDoubleClick=t=>{this.windowStage===I.FULLSCREEN||this.windowStage===I.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const i=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,s=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,o=this.width,n=this.height,a=this.props.minWidth||120,r=this.props.minHeight||100,h=this.top-s,d=this.left-i;let l=i-this.left,p=s-this.top;const c=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&r-(n+h)<0&&(this.top>0&&(c.height=n+h),c.top=s),e.direction.indexOf("s")>=0&&r-p<0&&(c.height=p),e.direction.indexOf("w")>=0&&a-(o+d)<0&&(this.left>0&&(c.width=o+d),c.left=i),e.direction.indexOf("e")>=0&&a-l<0&&(c.width=l),this.setState(c),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,s)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:s,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===I.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,i=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:i})}},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:w,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.state={stage:this.props.stage||I.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:w}}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){const t=this.getWindow();t&&t.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||I.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const e=this.getDocument();if(this.props.appendTo&&e){let t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}componentWillUnmount(){const t=this.getWindow();t&&t.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),i=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-i.left,this.offSetCoordinates.y=e.top-i.top}this.mounted=!0}render(){const t=d.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),s=this.getCurrentZIndex(),o=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-window-focused":this.state.focused}),n=d.createElement(a.ZIndexContext.Provider,{value:s},d.createElement(d.Fragment,null,this.props.modal&&d.createElement("div",{className:"k-overlay",style:{zIndex:s,...this.props.overlayStyle}}),d.createElement("div",{id:this.props.id,[u]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:t=>{this.windowElement=t,this.element=t},className:o,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:s,...this.props.style}},d.createElement(N,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},d.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:t=>this.draggable=t},d.createElement(x,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==I.MINIMIZED?d.createElement(d.Fragment,null,d.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===I.DEFAULT&&this.props.resizable?d.createElement(B,{onResize:this.handleResize}):null),this.showLicenseWatermark&&d.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?l.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetWidth,t;const e=this.getWindow();t=e?e.innerWidth:0}return t}get height(){let t=this.props.height||this.state.height;if(this.windowStage===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===I.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter((t=>t&&t.type===z))}getContent(t){return t.filter((t=>t&&t.type!==z))}generateTitleId(){return"window-title-"+this._id}};M.displayName="Window",M.propTypes={width:s.number,height:s.number,left:s.number,top:s.number,initialWidth:s.number,initialHeight:s.number,initialLeft:s.number,initialTop:s.number,minWidth:s.number,minHeight:s.number,resizable:s.bool,draggable:s.bool,title:s.any,shouldUpdateOnDrag:s.bool,stage:s.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:s.string,id:s.string,style:s.object,overlayStyle:s.object},M.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},M.contextType=a.ZIndexContext;let R=M;const W=a.createPropsContext(),F=a.withIdHOC(a.withPropsContext(W,R));F.displayName="KendoReactWindow",t.Dialog=v,t.DialogActionsBar=c,t.DialogPropsContext=E,t.Window=F,t.WindowActionsBar=z,t.WindowPropsContext=W}));
8
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactDialogs={},t.React,t.ReactDOM,t.PropTypes,t.KendoReactButtons,t.KendoSvgIcons,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,s,o,n,a,r){"use strict";function h(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var l=h(e),d=h(i);const p=({children:t,onCloseButtonClick:e,id:i,closeIcon:s})=>l.createElement("div",{className:"k-window-titlebar k-dialog-titlebar",id:i},l.createElement("span",{className:"k-window-title k-dialog-title"},t),s&&l.createElement("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions"},l.createElement(o.Button,{role:"button","aria-label":"Close",onClick:e,icon:"x",svgIcon:n.xIcon,fillMode:"flat",className:"k-window-titlebar-action k-dialog-titlebar-action"}))),c=t=>{const e={layout:"stretched",...t},{layout:i,children:s}=e,o=a.classNames("k-actions","k-actions-horizontal","k-window-actions k-dialog-actions",{[`k-actions-${i}`]:i});return l.createElement("div",{className:o},s)};c.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const g={name:"@progress/kendo-react-dialogs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},u="data-windowid",w=10002,m=(t,e,i)=>{let s=t;if(e&&e.defaultView){let t=e.querySelectorAll(".k-window:not(.k-dialog), .k-dialog-wrapper"),o=!1;return t.forEach((t=>{let n=e.defaultView.getComputedStyle(t,null);if(t.getAttribute(u)!==i&&null!==n.zIndex){let t=parseInt(n.zIndex,10);t>=s&&(s=t,o=!0)}})),o?s+2:s}return s},f=class extends l.Component{constructor(t){super(t),this.context=0,this.titleId=this.generateTitleId(),this.contentId=this.generateContentId(),this.showLicenseWatermark=!1,this.activeElement=null,this.onCloseDialog=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,void 0),setTimeout((()=>{this.activeElement&&this.activeElement.focus()}))},this.onKeyDown=t=>{t.keyCode===a.Keys.esc&&this.props.onClose&&(t.preventDefault(),this.onCloseDialog(t)),a.keepFocusInContainer(t,this.element)},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:w,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.activeElement=document.activeElement}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&(this.props.autoFocus?this.element.focus():a.focusFirstFocusableChild(this.element),this.setState({zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)}))}render(){const t=void 0!==this.props.id?this.props.id:this.titleId,{title:e,width:i,height:s,children:o,minWidth:n,dir:r,style:h,contentStyle:c,modal:g=!0}=this.props,w=l.Children.toArray(o),m=this.getContent(w),f=this.getActionBar(w),C=e?{"aria-labelledby":t}:null,E=void 0===this.props.closeIcon||this.props.closeIcon,v=this.getCurrentZIndex(),I=l.createElement(a.ZIndexContext.Provider,{value:v},l.createElement("div",{[u]:this._id,className:"k-dialog-wrapper"+(this.props.className?" "+this.props.className:""),onKeyDown:this.onKeyDown,tabIndex:0,dir:r,style:{zIndex:v,...h},ref:t=>this.element=t},g&&l.createElement("div",{className:"k-overlay",style:this.props.overlayStyle}),l.createElement("div",{...C,className:a.classNames("k-window k-dialog",{[`k-window-${this.props.themeColor}`]:this.props.themeColor}),role:"dialog","aria-labelledby":t,"aria-modal":!0,"aria-describedby":this.contentId,style:{width:i,height:s,minWidth:n}},this.props.title&&l.createElement(p,{closeIcon:E,onCloseButtonClick:this.onCloseDialog,id:t},e),l.createElement("div",{className:"k-window-content k-dialog-content",style:c,id:this.contentId},m),f,this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(I,this.props.appendTo||document.body):I:null}getActionBar(t){return t.filter((t=>t&&t.type===c))}getContent(t){return t.filter((t=>t&&t.type!==c))}generateTitleId(){return"dialog-title-"+this._id}generateContentId(){return"dialog-content-"+this._id}};f.displayName="Dialog",f.propTypes={title:s.any,id:s.string,dir:s.string,style:s.object,closeIcon:s.bool,width:s.oneOfType([s.number,s.string]),height:s.oneOfType([s.number,s.string]),minWidth:s.oneOfType([s.number,s.string]),autoFocus:s.bool},f.defaultProps={autoFocus:!1},f.contextType=a.ZIndexContext;let C=f;const E=a.createPropsContext(),v=a.withIdHOC(a.withPropsContext(E,C));v.displayName="KendoReactDialog";var I=(t=>(t.DEFAULT="DEFAULT",t.FULLSCREEN="FULLSCREEN",t.MINIMIZED="MINIMIZED",t))(I||{});const k="dialogs.windowMaximizeButton",y="dialogs.windowMinimizeButton",b="dialogs.windowRestoreButton",S="dialogs.windowCloseButton",D={[k]:"maximize",[y]:"minimize",[b]:"restore",[S]:"close"},T=t=>{const{children:e,onCloseButtonClick:i,onMinimizeButtonClick:s,onFullScreenButtonClick:a,onRestoreButtonClick:h,onDoubleClick:d,stage:p,forwardedRef:c,id:g}=t,u=r.useLocalization(),w=t.minimizeButton?l.createElement(t.minimizeButton,{onClick:s,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-minimize",svgIcon:n.windowMinimizeIcon,className:"k-window-titlebar-action",onClick:s,"aria-label":u.toLanguageString(y,D[y])}),m=t.maximizeButton?l.createElement(t.maximizeButton,{onClick:a,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-maximize",svgIcon:n.windowIcon,className:"k-window-titlebar-action",onClick:a,"aria-label":u.toLanguageString(k,D[k])}),f=t.restoreButton?l.createElement(t.restoreButton,{onClick:h,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"window-restore",svgIcon:n.windowRestoreIcon,className:"k-window-titlebar-action",onClick:h,"aria-label":u.toLanguageString(b,D[b])}),C=t.closeButton?l.createElement(t.closeButton,{onClick:i,stage:p}):l.createElement(o.Button,{fillMode:"flat",icon:"x",svgIcon:n.xIcon,className:"k-window-titlebar-action",onClick:i,"aria-label":u.toLanguageString(S,D[S])});return l.createElement("div",{className:"k-window-titlebar",style:{touchAction:"none"},ref:c,onDoubleClick:d},l.createElement("span",{className:"k-window-title",id:g},e||""),l.createElement("div",{className:"k-window-titlebar-actions"},p===I.DEFAULT&&w,p===I.DEFAULT&&m,p!==I.DEFAULT&&f,C))},x=l.forwardRef(((t,e)=>l.createElement(T,{...t,forwardedRef:e}))),L=["n","e","s","w","se","sw","ne","nw"];let B=class extends l.Component{render(){return l.createElement("div",{className:"k-resize-handles-wrapper"}," ",L.map(((t,e)=>l.createElement(a.Draggable,{key:e,onDrag:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!1,direction:t})},onRelease:e=>{const{event:i}=e;i.originalEvent.preventDefault(),this.props.onResize(i,{end:!0,direction:t})}},l.createElement("div",{className:"k-resize-handle k-resize-"+t,style:{display:"block",touchAction:"none"}})))))}};class N extends l.Component{shouldComponentUpdate(t){return t.shouldUpdateOnDrag||!t.isDragging}render(){return this.props.children}}const z=t=>{const e={layout:"end",...t},{layout:i,children:s}=e,o=a.classNames("k-actions","k-window-actions","k-actions-horizontal","k-hstack",{"k-justify-content-start":"start"===i,"k-justify-content-center":"center"===i,"k-justify-content-end":"end"===i,"k-justify-content-stretch":"stretched"===i});return l.createElement("div",{className:o},s)};z.propTypes={children:s.any,layout:s.oneOf(["start","center","end","stretched"])};const M=class extends l.Component{constructor(t){super(t),this.context=0,this.draggable=null,this.offSetCoordinates={x:0,y:0},this.titleId=this.generateTitleId(),this.mounted=!1,this.showLicenseWatermark=!1,this.activeElement=null,this.onKeyDown=t=>{if(this.props.modal&&a.keepFocusInContainer(t,this.element),t.target!==t.currentTarget)return;const e=this.props.minWidth||120,i=this.props.minHeight||100;if((t.metaKey||t.ctrlKey)&&this.props.resizable){switch(t.keyCode){case a.Keys.up:t.preventDefault(),i<=this.height-5&&this.setState({height:this.height-5});break;case a.Keys.down:t.preventDefault(),this.setState({height:this.height+5});break;case a.Keys.left:e<=this.width-5&&this.setState({width:this.width-5});break;case a.Keys.right:this.setState({width:this.width+5});break;default:return}this.dispatchMoveEvent(this.props.onResize,t,!1,void 0)}else if(t.altKey)switch(t.keyCode){case a.Keys.up:this.windowStage===I.MINIMIZED?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleFullscreen(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN}));break;case a.Keys.down:this.windowStage===I.FULLSCREEN?(this.handleRestore(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})):this.windowStage===I.DEFAULT&&(this.handleMinimize(t),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.MINIMIZED}))}else{if(!t.ctrlKey)switch(t.keyCode){case a.Keys.esc:return void(this.props.onClose&&this.handleCloseWindow(t));case a.Keys.up:this.setState({top:this.state.top-5});break;case a.Keys.down:this.setState({top:this.state.top+5});break;case a.Keys.left:this.setState({left:this.state.left-5});break;case a.Keys.right:this.setState({left:this.state.left+5});break;default:return}this.dispatchMoveEvent(this.props.onMove,t,!1,void 0)}},this.onPress=t=>{const e=t.event;this.windowCoordinatesState.differenceLeft=e.pageX-this.left,this.windowCoordinatesState.differenceTop=e.pageY-this.top},this.onDrag=t=>{const e=t.event;e.originalEvent.preventDefault(),this.windowStage!==I.FULLSCREEN&&this.props.draggable&&(this.setState({top:Math.max(e.pageY-this.windowCoordinatesState.differenceTop,0),left:e.pageX-this.windowCoordinatesState.differenceLeft,isDragging:!0}),this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!1))},this.onRelease=t=>{const e=t.event;this.windowStage!==I.FULLSCREEN&&this.props.draggable&&this.props.onMove&&this.dispatchMoveEvent(this.props.onMove,e,!0,!0),this.setState({isDragging:!1})},this.onFocus=()=>{this._blurTimeout?(clearTimeout(this._blurTimeout),this._blurTimeout=void 0):this.setState({focused:!0,zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)})},this.onBlur=()=>{clearTimeout(this._blurTimeout);const t=this.getWindow();t&&(this._blurTimeout=t.setTimeout((()=>{this.mounted&&this.setState({focused:!1}),this._blurTimeout=void 0})))},this.getInitialTop=()=>{if(void 0!==this.props.top)return this.props.top;if(void 0!==this.props.initialTop)return this.props.initialTop;let t=300;if(void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),this.props.appendTo)return this.props.appendTo.offsetHeight/2-t/2;const e=this.getWindow();return e?e.innerHeight/2-t/2:0},this.getInitialLeft=()=>{if(void 0!==this.props.left)return this.props.left;if(void 0!==this.props.initialLeft)return this.props.initialLeft;let t=300;if(void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),this.props.appendTo)return this.props.appendTo.offsetWidth/2-t/2;const e=this.getWindow();return e?e.innerWidth/2-t/2:0},this.getInitialWidth=()=>{let t=300;return void 0!==this.props.width?t=this.props.width:void 0!==this.props.initialWidth&&(t=this.props.initialWidth),t},this.getInitialHeight=()=>{let t=300;return void 0!==this.props.height?t=this.props.height:void 0!==this.props.initialHeight&&(t=this.props.initialHeight),t},this.handleMinimize=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height,this.setState({stage:I.MINIMIZED,height:0}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.MINIMIZED})},this.handleFullscreen=t=>{t.preventDefault(),this.windowCoordinatesState.leftBeforeAction=this.left,this.windowCoordinatesState.topBeforeAction=this.top,this.windowCoordinatesState.widthBeforeAction=this.width,this.windowCoordinatesState.heightBeforeAction=this.height;const e=this.getWindow(),i=e?e.innerWidth:0,s=e?e.innerHeight:0;this.setState({left:0,top:0,width:this.props.appendTo?this.props.appendTo.offsetWidth:i,height:this.props.appendTo?this.props.appendTo.offsetHeight:s,stage:I.FULLSCREEN}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.FULLSCREEN})},this.handleRestore=t=>{t.preventDefault(),this.windowStage===I.FULLSCREEN?this.setState({stage:I.DEFAULT,left:this.windowCoordinatesState.leftBeforeAction,top:this.windowCoordinatesState.topBeforeAction,width:this.windowCoordinatesState.widthBeforeAction,height:this.windowCoordinatesState.heightBeforeAction}):this.windowStage===I.MINIMIZED&&this.setState({stage:I.DEFAULT,height:this.windowCoordinatesState.heightBeforeAction}),a.dispatchEvent(this.props.onStageChange,t,this,{state:I.DEFAULT})},this.handleCloseWindow=t=>{t.preventDefault(),a.dispatchEvent(this.props.onClose,t,this,{state:void 0}),setTimeout((()=>{this.activeElement&&this.activeElement.focus()}))},this.handleDoubleClick=t=>{this.windowStage===I.FULLSCREEN||this.windowStage===I.MINIMIZED?this.handleRestore(t):this.handleFullscreen(t)},this.handleResize=(t,e)=>{const i=this.props.appendTo?t.pageX-this.offSetCoordinates.x:t.pageX,s=this.props.appendTo?t.pageY-this.offSetCoordinates.y:t.pageY,o=this.width,n=this.height,a=this.props.minWidth||120,r=this.props.minHeight||100,h=this.top-s,l=this.left-i;let d=i-this.left,p=s-this.top;const c=Object.assign({},this.state,{isDragging:!e.end});e.direction.indexOf("n")>=0&&r-(n+h)<0&&(this.top>0&&(c.height=n+h),c.top=s),e.direction.indexOf("s")>=0&&r-p<0&&(c.height=p),e.direction.indexOf("w")>=0&&a-(o+l)<0&&(this.left>0&&(c.width=o+l),c.left=i),e.direction.indexOf("e")>=0&&a-d<0&&(c.width=d),this.setState(c),this.dispatchMoveEvent(this.props.onResize,t,!0,e.end)},this.dispatchMoveEvent=(t,e,i,s)=>{t&&t.call(void 0,{nativeEvent:e.nativeEvent?e.nativeEvent:e.originalEvent,drag:i,end:s,target:this,left:this.state.left,top:this.state.top,width:this.state.width,hight:this.state.height,height:this.state.height})},this.handleBrowserWindowResize=()=>{if(this.windowStage===I.FULLSCREEN){const t=this.getWindow(),e=t?t.innerWidth:0,i=t?t.innerHeight:0;this.setState({width:this.props.appendTo?this.props.appendTo.offsetWidth:e,height:this.props.appendTo?this.props.appendTo.offsetHeight:i})}},this.getCurrentZIndex=()=>this.state&&void 0!==this.context?this.state.zIndex>(this.context?this.context+2:0)?this.state.zIndex:this.context+2:this.context?this.context:w,this.getDocument=()=>this.props.appendTo?this.props.appendTo.ownerDocument:document,this.getWindow=()=>{const t=this.getDocument();return t&&t.defaultView},a.validatePackage(g),this.showLicenseWatermark=a.shouldShowValidationUI(g),this.state={stage:this.props.stage||I.DEFAULT,isDragging:!1,top:0,left:0,width:300,height:300,focused:!0,zIndex:w},this.activeElement=document.activeElement}get _id(){return this.props.id+"-accessibility-id"}componentDidMount(){this.element&&this.element.focus();const t=this.getWindow();t&&t.addEventListener("resize",this.handleBrowserWindowResize),this.setState({stage:this.props.stage||I.DEFAULT,isDragging:!1,top:this.getInitialTop(),left:this.getInitialLeft(),width:this.getInitialWidth(),height:this.getInitialHeight(),focused:!0,zIndex:m(this.getCurrentZIndex(),this.getDocument(),this._id)}),this.windowCoordinatesState={leftBeforeAction:this.getInitialLeft(),topBeforeAction:this.getInitialTop(),widthBeforeAction:this.getInitialWidth(),heightBeforeAction:this.getInitialHeight()};const e=this.getDocument();if(this.props.appendTo&&e){let t=this.props.appendTo.getBoundingClientRect(),i=e.body.getBoundingClientRect();this.offSetCoordinates.x=t.left-i.left,this.offSetCoordinates.y=t.top-i.top}this.mounted=!0}componentWillUnmount(){const t=this.getWindow();t&&t.removeEventListener("resize",this.handleBrowserWindowResize),this.mounted=!1}componentDidUpdate(){const t=this.getDocument();if(this.props.appendTo&&t){let e=this.props.appendTo.getBoundingClientRect(),i=t.body.getBoundingClientRect();this.offSetCoordinates.x=e.left-i.left,this.offSetCoordinates.y=e.top-i.top}this.mounted=!0}render(){const t=l.Children.toArray(this.props.children),e=this.getContent(t),i=this.getActionBar(t),s=this.getCurrentZIndex(),o=a.classNames("k-window",this.props.className,{[`k-window-${this.props.themeColor}`]:this.props.themeColor,"k-window-minimized":"MINIMIZED"===this.state.stage,"k-window-focused":this.state.focused}),n=l.createElement(a.ZIndexContext.Provider,{value:s},l.createElement(l.Fragment,null,this.props.modal&&l.createElement("div",{className:"k-overlay",style:{zIndex:s,...this.props.overlayStyle}}),l.createElement("div",{id:this.props.id,[u]:this._id,tabIndex:0,role:"dialog","aria-labelledby":this.titleId,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,ref:t=>{this.windowElement=t,this.element=t},className:o,style:{top:this.top,left:this.left,width:this.width,height:this.height||"",zIndex:s,...this.props.style}},l.createElement(N,{shouldUpdateOnDrag:this.props.shouldUpdateOnDrag||!1,isDragging:this.state.isDragging},l.createElement(a.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,ref:t=>this.draggable=t},l.createElement(x,{stage:this.windowStage,onDoubleClick:this.props.doubleClickStageChange?this.handleDoubleClick:void 0,onMinimizeButtonClick:this.handleMinimize,onFullScreenButtonClick:this.handleFullscreen,onRestoreButtonClick:this.handleRestore,onCloseButtonClick:this.handleCloseWindow,closeButton:this.props.closeButton,minimizeButton:this.props.minimizeButton,maximizeButton:this.props.maximizeButton,restoreButton:this.props.restoreButton,id:this.titleId},this.props.title)),this.windowStage!==I.MINIMIZED?l.createElement(l.Fragment,null,l.createElement("div",{className:"k-window-content"},e),i):null,this.windowStage===I.DEFAULT&&this.props.resizable?l.createElement(B,{onResize:this.handleResize}):null),this.showLicenseWatermark&&l.createElement(a.WatermarkOverlay,null))));return a.canUseDOM?null!==this.props.appendTo?d.createPortal(n,this.props.appendTo||document.body):n:null}get top(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.top||this.state.top,0):0}get left(){return this.windowStage!==I.FULLSCREEN?Math.max(this.props.left||this.state.left,0):0}get width(){let t=this.props.width||this.state.width;if(this.windowStage===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetWidth,t;const e=this.getWindow();t=e?e.innerWidth:0}return t}get height(){let t=this.props.height||this.state.height;if(this.windowStage===I.FULLSCREEN){if(this.props.appendTo)return t=this.props.appendTo.offsetHeight,t;const e=this.getWindow();t=e?e.innerHeight:0}else this.windowStage===I.MINIMIZED&&(t=0);return t}get windowStage(){return this.props.stage||this.state.stage}getActionBar(t){return t.filter((t=>t&&t.type===z))}getContent(t){return t.filter((t=>t&&t.type!==z))}generateTitleId(){return"window-title-"+this._id}};M.displayName="Window",M.propTypes={width:s.number,height:s.number,left:s.number,top:s.number,initialWidth:s.number,initialHeight:s.number,initialLeft:s.number,initialTop:s.number,minWidth:s.number,minHeight:s.number,resizable:s.bool,draggable:s.bool,title:s.any,shouldUpdateOnDrag:s.bool,stage:s.oneOf(["DEFAULT","MINIMIZED","FULLSCREEN"]),className:s.string,id:s.string,style:s.object,overlayStyle:s.object},M.defaultProps={minWidth:120,minHeight:100,resizable:!0,draggable:!0,modal:!1,doubleClickStageChange:!0},M.contextType=a.ZIndexContext;let R=M;const W=a.createPropsContext(),F=a.withIdHOC(a.withPropsContext(W,R));F.displayName="KendoReactWindow",t.Dialog=v,t.DialogActionsBar=c,t.DialogPropsContext=E,t.Window=F,t.WindowActionsBar=z,t.WindowPropsContext=W}));
package/index.d.mts CHANGED
@@ -192,6 +192,7 @@ declare class DialogWithoutContext extends React_2.Component<DialogProps, Dialog
192
192
  private titleId;
193
193
  private contentId;
194
194
  private showLicenseWatermark;
195
+ private activeElement;
195
196
  constructor(props: DialogProps);
196
197
  /**
197
198
  * @hidden
@@ -538,6 +539,7 @@ declare class WindowWithoutContext extends React_2.Component<WindowProps, Window
538
539
  private _blurTimeout?;
539
540
  private mounted;
540
541
  private showLicenseWatermark;
542
+ private activeElement;
541
543
  constructor(props: WindowProps);
542
544
  /**
543
545
  * @hidden
package/index.d.ts CHANGED
@@ -192,6 +192,7 @@ declare class DialogWithoutContext extends React_2.Component<DialogProps, Dialog
192
192
  private titleId;
193
193
  private contentId;
194
194
  private showLicenseWatermark;
195
+ private activeElement;
195
196
  constructor(props: DialogProps);
196
197
  /**
197
198
  * @hidden
@@ -538,6 +539,7 @@ declare class WindowWithoutContext extends React_2.Component<WindowProps, Window
538
539
  private _blurTimeout?;
539
540
  private mounted;
540
541
  private showLicenseWatermark;
542
+ private activeElement;
541
543
  constructor(props: WindowProps);
542
544
  /**
543
545
  * @hidden
@@ -10,7 +10,7 @@ const e = {
10
10
  name: "@progress/kendo-react-dialogs",
11
11
  productName: "KendoReact",
12
12
  productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
- publishDate: 1718182039,
13
+ publishDate: 1719467341,
14
14
  version: "",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-dialogs",
3
- "version": "8.1.0-develop.9",
3
+ "version": "8.1.0",
4
4
  "description": "React Dialogs provide modal and non-modal windows for showing additional information to the user. KendoReact Dialogs 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-buttons": "8.1.0-develop.9",
27
- "@progress/kendo-react-common": "8.1.0-develop.9",
26
+ "@progress/kendo-react-buttons": "8.1.0",
27
+ "@progress/kendo-react-common": "8.1.0",
28
28
  "@progress/kendo-svg-icons": "^3.0.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"