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