"use strict";var M=Object.create;var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.getPrototypeOf;var N=Object.prototype.hasOwnProperty;var b=(e,t)=>r(e,"name",{value:t,configurable:true});var j=(e,t)=>{for(var s in t)r(e,s,{get:t[s],enumerable:true})};var c=(e,t,s,i)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of E(t))if(!N.call(e,o)&&o!==s)r(e,o,{get:()=>t[o],enumerable:!(i=f(t,o))||i.enumerable})}return e};var a=(e,t,s)=>(s=e!=null?M(I(e)):{},c(t||!e||!e.__esModule?r(s,"default",{value:e,enumerable:true}):s,e));var R=e=>c(r({},"__esModule",{value:true}),e);var h=(e,t,s,i)=>{var o=i>1?void 0:i?f(t,s):t;for(var l=e.length-1,u;l>=0;l--)if(u=e[l])o=(i?u(t,s,o):u(o))||o;if(i&&o)r(t,s,o);return o};var U={};j(U,{default:()=>F});module.exports=R(U);var m=require("react/jsx-runtime");var g=require("mobx-react");var y=require("react");var p=require("react-intl");var x=a(require("react-jss"));var v=a(require("../../../components/ui/button"));var w=a(require("../../../components/ui/input/index"));var S=require("../../../helpers/validation-helpers");var P=a(require("../../../lib/Form"));var B=require("../index");const d=(0,p.defineMessages)({submitButton:{id:"settings.workspace.add.form.submitButton",defaultMessage:"Create workspace"},name:{id:"settings.workspace.add.form.name",defaultMessage:"Name"}});const T={form:{display:"flex"},input:{flexGrow:1,marginRight:"10px"},submitButton:{height:"inherit"}};let n=class extends y.Component{form;constructor(t){super(t);this.form=new P.default({fields:{name:{label:this.props.intl.formatMessage(d.name),placeholder:this.props.intl.formatMessage(d.name),value:"",validators:[S.required]}}})}submitForm(){this.form.submit({onSuccess:async t=>{const{onSubmit:s}=this.props;const i=t.values();s(i)}})}render(){const{classes:t,isSubmitting:s,intl:i}=this.props;const{form:o}=this;return(0,m.jsxs)("div",{className:t.form,children:[(0,m.jsx)(w.default,{...o.$("name").bind(),className:t.input,showLabel:false,onEnterKey:this.submitForm.bind(this,o),focus:B.workspaceStore.isUserAllowedToUseFeature}),(0,m.jsx)(v.default,{className:`${t.submitButton} franz-form__button`,type:"submit",label:i.formatMessage(d.submitButton),onClick:this.submitForm.bind(this,o),busy:s,buttonType:s?"secondary":"primary"})]})}};b(n,"CreateWorkspaceForm");n=h([g.observer],n);var F=(0,p.injectIntl)((0,x.default)(T,{injectTheme:true})(n));
