import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import i from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import{Component as n}from"react";import a from"prop-types";import{withStyles as s}from"@material-ui/core/styles";import l from"@material-ui/core/Typography";import c from"@material-ui/core/TextField";import p from"@material-ui/core/DialogTitle";import m from"@material-ui/core/DialogContent";import f from"@material-ui/core/DialogContentText";import u from"@material-ui/core/DialogActions";import h from"@material-ui/core/Button";import d from"@material-ui/core/Dialog";import{jsxs as b,Fragment as g,jsx as x}from"react/jsx-runtime";function y(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=r(t);if(e){var a=r(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return o(this,i)}}var C="confirmationDialog",T=function(o){i(a,n);var r=y(a);function a(e){var i;return t(this,a),(i=r.call(this,e)).state={confirmationTextField:""},i}return e(a,[{key:"actions",get:function(){return b(g,{children:[this.props.isShowCancel&&x(h,{variant:"text","data-testid":"".concat(C,"_cancelButton"),className:this.props.classes.actionButton,onClick:this.props.handleClose,color:"primary",children:"Cancel"}),x(h,{variant:"contained","data-testid":"".concat(C,"_confirmButton"),className:this.props.classes.actionButton,onClick:this.props.handleOk,disabled:this.props.disableOk||this.props.confirmationText&&this.props.confirmation!==this.state.confirmationTextField,color:"primary",children:this.props.okText})]})}},{key:"render",value:function(){var t=this;return b(d,{open:this.props.open,onClose:this.props.handleClose,"aria-labelledby":"confirmation-dialog-title",classes:{paper:this.props.classes.paper},children:[x(p,{id:"confirmation-dialog-title",children:this.props.title}),x(m,{children:b(f,{children:[x(l,{variant:"body2",className:this.props.classes.content,children:this.props.text}),this.props.confirmationText&&x(c,{fullWidth:!0,"data-testid":"".concat(C,"_input"),label:this.props.confirmationText,value:this.state.confirmationTextField,onChange:function(e){return t.setState({confirmationTextField:e.target.value})},className:this.props.classes.confirmation})]})}),x(u,{className:this.props.classes.actions,children:this.actions})]})}}]),a}();T.propTypes={open:a.bool.isRequired,title:a.string,text:a.string.isRequired,confirmationText:a.string,confirmation:a.string,handleClose:a.func,handleOk:a.func,okText:a.string,disableOk:a.bool,isShowCancel:a.bool,classes:a.shape({}).isRequired},T.defaultProps={title:void 0,confirmationText:null,confirmation:"",okText:"Ok",handleOk:function(){},handleClose:function(){},disableOk:!1,isShowCancel:!0};var v=s({actionButton:{marginLeft:15},confirmation:{marginTop:10}})(T);export{v as default};
//# sourceMappingURL=ConfirmationDialog.js.map
