"use strict";var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),i=require("@babel/runtime/helpers/inherits"),r=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),o=require("react"),n=require("prop-types"),s=require("@material-ui/core/styles"),l=require("@material-ui/core/Typography"),c=require("@material-ui/core/TextField"),u=require("@material-ui/core/DialogTitle"),f=require("@material-ui/core/DialogContent"),d=require("@material-ui/core/DialogContentText"),p=require("@material-ui/core/DialogActions"),h=require("@material-ui/core/Button"),m=require("@material-ui/core/Dialog"),x=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=b(e),q=b(t),y=b(i),C=b(r),v=b(a),T=b(n),k=b(l),j=b(c),O=b(u),R=b(f),B=b(d),D=b(p),F=b(h),N=b(m);function S(e){var t=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(e){return!1}}();return function(){var i,r=v.default(e);if(t){var a=v.default(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return C.default(this,i)}}var w="confirmationDialog",P=function(e){y.default(i,e);var t=S(i);function i(e){var r;return g.default(this,i),(r=t.call(this,e)).state={confirmationTextField:""},r}return q.default(i,[{key:"actions",get:function(){return x.jsxs(x.Fragment,{children:[this.props.isShowCancel&&x.jsx(F.default,{variant:"text","data-testid":"".concat(w,"_cancelButton"),className:this.props.classes.actionButton,onClick:this.props.handleClose,color:"primary",children:"Cancel"}),x.jsx(F.default,{variant:"contained","data-testid":"".concat(w,"_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 e=this;return x.jsxs(N.default,{open:this.props.open,onClose:this.props.handleClose,"aria-labelledby":"confirmation-dialog-title",classes:{paper:this.props.classes.paper},children:[x.jsx(O.default,{id:"confirmation-dialog-title",children:this.props.title}),x.jsx(R.default,{children:x.jsxs(B.default,{children:[x.jsx(k.default,{variant:"body2",className:this.props.classes.content,children:this.props.text}),this.props.confirmationText&&x.jsx(j.default,{fullWidth:!0,"data-testid":"".concat(w,"_input"),label:this.props.confirmationText,value:this.state.confirmationTextField,onChange:function(t){return e.setState({confirmationTextField:t.target.value})},className:this.props.classes.confirmation})]})}),x.jsx(D.default,{className:this.props.classes.actions,children:this.actions})]})}}]),i}(o.Component);P.propTypes={open:T.default.bool.isRequired,title:T.default.string,text:T.default.string.isRequired,confirmationText:T.default.string,confirmation:T.default.string,handleClose:T.default.func,handleOk:T.default.func,okText:T.default.string,disableOk:T.default.bool,isShowCancel:T.default.bool,classes:T.default.shape({}).isRequired},P.defaultProps={title:void 0,confirmationText:null,confirmation:"",okText:"Ok",handleOk:function(){},handleClose:function(){},disableOk:!1,isShowCancel:!0};var _=s.withStyles({actionButton:{marginLeft:15},confirmation:{marginTop:10}})(P);module.exports=_;
